diff --git a/changelog/unreleased/routing-attempt-and-cooldown.md b/changelog/unreleased/routing-attempt-and-cooldown.md new file mode 100644 index 000000000..4ab3ab9fc --- /dev/null +++ b/changelog/unreleased/routing-attempt-and-cooldown.md @@ -0,0 +1,17 @@ +### English + +- Reserve an account and update rotation together. Full accounts do not consume an upstream attempt, and failover cannot leave the provider or region allowed by the request and API key. +- Use the selected account and concrete model for dispatch, cooldowns, and stream feedback, including native Responses and older workers. API-key concurrency is checked before any aggregation classifier can send an upstream request. +- Priority aggregations rotate among available targets in the best tier. `max_attempts` now caps dispatches of the requested model across all tiers, not the attempts per tier. +- Named dispatch groups preserve member order when a Responses request can use either protocol, and honor explicit no-failover errors. Early stream heartbeats do not announce a provisional account. +- Keep nested group listings and previews in sync with configured members. Quota checks use the resolved model, and late successes do not restore models that were explicitly rejected. +- Keep the public model list consistent with API-key grants and routing, including namespaced models and group names that shadow account aliases. Canceled streams no longer cool down healthy accounts, and stale session affinity cannot block a healthy fallback. + +### 中文 + +- 账号选择、占槽和轮转一起提交。满载账号不消耗上游尝试次数,失败回退不会越过请求和 API Key 允许的提供商或区域。 +- 派发、冷却和流式反馈使用实际选中的账号和模型,覆盖原生 Responses 和旧 worker。聚合分类请求发往上游前也会先取得 API Key 并发槽。 +- 优先级聚合在最高可用档内轮转。`max_attempts` 现在限制请求模型在所有档位的总派发次数,而不是每个档位各自计数。 +- 兼容两种协议的 Responses 请求按调度组顺序派发,并遵守明确禁止切换的错误。流式早期心跳不再公布尚未确定的账号。 +- 嵌套调度组列表和预览使用当前成员配置;额度按实际模型检查,旧请求晚到的成功不会恢复已明确拒绝的模型。 +- 公开模型列表与 API Key 授权和实际派发保持一致,正确处理带命名空间的模型及被调度组占用的账号别名。取消流式请求不会误冷却健康账号,失效的会话粘性也不会挡住健康备选。 diff --git a/docs/NATIVE_PROTOCOL_REQUESTS.md b/docs/NATIVE_PROTOCOL_REQUESTS.md index 9d0a17914..ff4c4a2df 100644 --- a/docs/NATIVE_PROTOCOL_REQUESTS.md +++ b/docs/NATIVE_PROTOCOL_REQUESTS.md @@ -4,9 +4,9 @@ title: 原生协议请求的现状与后续 scope: [gateway, executor, translate, providers] status: current read-when: 理解三个公共入口与上游协议的关系、改 Responses 原生链路或评估 ChatRequest 边界时 -summary: 三个公共入口的当前转发方式。Responses 在 adapter 声明原生能力时保留原文;Chat 与 Messages 仍先译成 ChatRequest。Codex 两条路径共用同一套上游约束。 +summary: 三个公共入口的当前转发方式。Responses 保留原文;可兼容转换的命名聚合组先按组策略选择成员,再决定是否原生派发。Chat 与 Messages 仍先译成 ChatRequest。 related: [AGENTS.md, docs/ARCHITECTURE_SUMMARY.md, docs/REFACTORING.md, docs/DEVELOPMENT.md] -last-updated: 2026-09-25 +last-updated: 2026-12-02 --- # 原生协议请求的现状与后续 @@ -17,7 +17,7 @@ last-updated: 2026-09-25 - `translate.ChatRequest` 仍是兼容表示,不再是所有请求的强制中间表示。 - 客户端入口决定返回协议,adapter 决定怎么访问上游。两边互不绑定。 -- `/v1/responses` 先保留原文。候选账号的 adapter 实现了 `NativeResponsesStreamer` 时走原生路径;否则才在兼容转换能成功时走 `ChatRequest`。 +- `/v1/responses` 先保留原文。普通请求优先走实现了 `NativeResponsesStreamer` 的候选账号;可兼容转换的命名聚合组先按组策略选成员,再按成员的 adapter 能力派发。 - `/v1/chat/completions` 和 `/v1/messages` 没有原生路径。它们仍先变成 `ChatRequest`。选中 Codex 时,adapter 再把它建成 Responses 请求。 - 路由、权限、冷却、重试和日志仍在 executor。没有第二套直通执行器。 - 原生能力看接口,不看 provider 名字。gateway 里没有 `if provider == "codex"`。 @@ -29,9 +29,9 @@ last-updated: 2026-09-25 ```text /v1/messages Messages → ChatRequest ─────────────┐ /v1/chat/completions ChatRequest ────────────────────────┼─→ 选号 -/v1/responses 保留原文 ──→ 有原生 adapter? │ - ├─ 是:原文副本 + 本次执行参数 ──┤ - └─ 否:能转 Chat 才继续 ────────┘ +/v1/responses 保留原文,尝试 Chat 兼容转换 ─────────┘ + 普通请求:有原生候选时只选原生 + 命名聚合组:转换成功时不按协议重排成员 │ 选中的 adapter 决定上游协议 Codex:两条路径都打 Responses,并套同一套上游约束 @@ -46,14 +46,18 @@ last-updated: 2026-09-25 `HandleResponses` 有上限地读完 body,解析为 `translate.NativeResponsesRequest`。非法 JSON、非对象、尾随值、缺 `model` 或 `input`、以及 `previous_response_id` / `conversation` 直接拒绝。 -兼容转换 `Compat()` 会试一次,但失败不再挡住请求。随后: +网关先尝试兼容转换 `Compat()`;转换失败只限制候选协议,不直接挡住请求。随后: -1. 有实现 `NativeResponsesStreamer` 的候选账号时,只在这些账号里选。每次尝试从原文取一份副本,带上 `providers.RequestOptions`(本次上游模型、是否去掉 system/developer)。流式转发上游 SSE;`stream:false` 仍向上游要 SSE,再由 `translate.CollectResponses` 取出终态 `response` 对象。失败不降级到 Chat 重建。 -2. 没有原生账号,且原文能转成 `ChatRequest` 时,走原来的 `ChatStream` / `ChatNonStream`,网关再把结果拼回 Responses。 -3. 两边都不行,返回 `unsupported_request`。 +1. **普通请求**:有原生候选时只选原生账号,暂时满载或冷却并不会让它降级到兼容路径。没有原生候选且转换成功时,使用 `ChatStream` / `ChatNonStream`,由网关把结果编码回 Responses。 +2. **命名聚合组且转换成功**:与 Chat 使用同一组选成员规则,不为了协议优先级重排。每次尝试由选中成员决定:支持 `NativeResponsesStreamer` 就用原文,否则用兼容 `ChatRequest`。组允许回退时,两种路径共用同一个 `max_attempts` 派发预算。 +3. **转换失败**:无论是否命名聚合组,都只允许原生成员;若没有符合条件的原生候选,返回 `unsupported_request`,不丢字段重建请求。 + +每次原生尝试用原文副本和 `providers.RequestOptions`(本次上游模型、是否去掉 system/developer)。流式请求转发 SSE;`stream:false` 仍向上游要 SSE,再由 `translate.CollectResponses` 取出终态 `response` 对象。 现在只有 Codex 实现了这个接口。 +**English summary:** Ordinary Responses requests remain native-only when the route has a native-capable candidate. A named aggregation whose request can be translated to Chat selects members using its configured strategy, then chooses native or Chat dispatch per member. Both share the group’s attempt budget. Requests that cannot be translated to Chat still require a native member. + ### 2.2 `/v1/chat/completions` 和 `/v1/messages` 这两条没有原文保留,也没有原生分派。 @@ -70,7 +74,7 @@ last-updated: 2026-09-25 | 内容 | 现在的位置 | 约束 | | --- | --- | --- | | Responses 原文 | `translate.NativeResponsesRequest` | 自有 body。`Fields()` 每次返回副本,failover 不能改到下一次 | -| 兼容表示 | `translate.ChatRequest` | Chat/Messages 的唯一内容;Responses 仅在没有原生账号且转换成功时使用 | +| 兼容表示 | `translate.ChatRequest` | Chat/Messages 的唯一内容;Responses 转换成功且本次路由使用兼容 adapter 时使用 | | 本次执行决定 | `providers.RequestOptions` | 显式参数,不放进 context。目前是上游模型 id 和 `DropSystemPrompt` | | 原生能力 | `NativeResponsesStreamer.ResponsesStream` | 入参是原文指针和 `RequestOptions`,返回上游 Responses SSE | | 事件判定 | `translate.ParseResponsesEvent` | relay 和 collector 共用。`response.failed` 是终态错误,不再补第二条错误帧 | @@ -115,9 +119,10 @@ Chat/Messages 翻译路径还会先做消息到 item 的重建(tool 结果变 - 原生流式转发上游事件,不压成 chat delta。namespace 工具名在响应里还原。 - 原生非流式只取 `response.completed` 或 `response.incomplete` 上的完整 `response` 对象,不经 `ChatOutcome`。 - `response.failed` 记为错误。事件已经转给客户端时,不再追加第二条错误帧。 -- 原生候选耗尽后不自动改走有损的 Chat 重建。没有原生候选且兼容转换也失败时,请求直接失败。 +- 普通请求的原生候选耗尽后不自动走兼容路径。只有转换成功的命名聚合组可以在同一派发预算内按配置回退到兼容成员,仍遵守上游明确禁止回退的错误。 - 协议不兼容不给账号加冷却。上游的限流、认证和可用性错误仍走原来的分类。 -- 响应已经开始写给客户端之后不换上游再拼一段。 +- 流式请求在接受首个有效上游事件后不换上游再拼一段。Chat 的早期 heartbeat 注释不是上游事件,只保活、不公布尚未确定的账号。 +- 如果客户端已取消,且流只给出 EOF 或无法确定来源的读取错误,不将其计作账号故障;已确认的终态成功或明确的上游错误保留原结果。 - 原文、加密内容和凭证不进默认日志。 fake 测试证明字段按上面的清单改写、其余成员留下来、失败终态不会被当成成功。它不证明某个真实 ChatGPT 账号接受全部保留字段,也不证明加密 reasoning 可以跨账号回放。 diff --git a/frontend/src/i18n/messages.ts b/frontend/src/i18n/messages.ts index facc331a6..afc8ae197 100644 --- a/frontend/src/i18n/messages.ts +++ b/frontend/src/i18n/messages.ts @@ -145,7 +145,7 @@ export const messages: Record = { modelPoolNameHint: 'Shown only in this console list, so you can tell groups apart. Clients never see it.', modelPoolNamePh: 'My Claude', modelPoolStrategy: 'Routing strategy', - modelPoolStrategyHint: 'Priority: always use the first working member (primary/backup). Round robin: spread requests evenly. Fill first: favor the highest-weight member. FEFO: prefer the member whose quota expires soonest.', + modelPoolStrategyHint: 'Priority: order eligible members by priority; later members are not failure backups unless failover is enabled. Round robin: spread requests evenly. Fill first: favor the highest-weight member. FEFO: prefer the member whose quota expires soonest.', modelPoolStrategy_priority: 'Priority order', 'modelPoolStrategy_round-robin': 'Round robin', 'modelPoolStrategy_fill-first': 'Fill first', @@ -154,7 +154,7 @@ export const messages: Record = { 'modelPoolStrategy_most-quota-first': 'Most remaining quota first', modelPoolFailover: 'Failover', modelPoolMaxAttempts: 'Max attempts', - modelPoolMaxAttemptsHint: 'Maximum providers tried before the request fails (1-64).', + modelPoolMaxAttemptsHint: 'With failover enabled, this caps total dispatches for the requested logical model, counting the first dispatch and later attempts across members (1-64); it is not a provider count.', modelPoolMembers: 'Provider models', modelPoolMembersHint: 'Only connected providers and the models enabled in their provider settings are selectable. The provider account pool picks the serving account automatically; order sets priority.', modelPoolAddMember: 'Add provider model', @@ -178,7 +178,7 @@ export const messages: Record = { modelPoolColFailover: 'Failover', modelPoolColEnabled: 'Enabled', modelPoolColActions: 'Actions', - modelPoolFailoverOn: 'On · {count} attempts', + modelPoolFailoverOn: 'On · up to {count} dispatches', modelPoolFailoverOff: 'Off', modelPoolEmpty: 'No dispatch groups', modelPoolEmptyHint: 'Add a group and clients get another model they can call.', @@ -193,22 +193,22 @@ export const messages: Record = { modelPoolEntryTitle: 'Request', modelPoolEntryDetail: 'Client model id', modelPoolEntryNote: 'Starts when a client calls this id', - modelPoolEntryHint: 'Each seat is one provider. Leave accounts empty to use all of them, or check several. Left to right is the try order.', + modelPoolEntryHint: 'Each provider/model can expand into one seat per checked account, in check order. With no accounts checked, all matching connected accounts are eligible; otherwise only checked accounts are included. The row strategy controls how its seats are scheduled.', modelPoolStepProvider: 'Provider', modelPoolStepProviderDetail: 'One provider', modelPoolAccounts: 'Accounts', - modelPoolAccountsHint: 'Leave this empty, or check several: saving uses every connected account of the provider. Check exactly one to use only that account.', + modelPoolAccountsHint: 'Leave accounts unchecked to include all matching connected accounts. Check one or more to include only those accounts; multiple picks expand into seats in check order.', modelPoolAccountsAll: 'All accounts', modelPoolAccountsAllCount: 'All {count} accounts', - modelPoolSeatOrderAll: 'Provider order', - modelPoolSeatOrderPicked: 'Check order', + modelPoolSeatOrderAll: 'Account-pool selection', + modelPoolSeatOrderPicked: 'Expanded in check order', modelPoolSeatCount: '{count} seats', modelPoolPathCount: '{count} paths', modelPoolAccountsCount: '{count} accounts', modelPoolAccountsSearch: 'Find an account', modelPoolAccountsNoMatch: 'No account matches', modelPoolNoAccounts: 'This provider has no connected account', - modelPoolAccountsDraft: 'Checking several accounts still saves as every account of the provider. Check exactly one to keep a single account.', + modelPoolAccountsDraft: 'Multiple selections include only the checked accounts; they expand into seats in check order.', modelPoolClientModel: 'Client model name', modelPoolCanvasPalette: 'Add a seat', modelPoolCanvasIncomplete: 'Set up', @@ -230,9 +230,9 @@ export const messages: Record = { modelPoolStepGroupNote: 'Keeps that pool\'s own order', modelPoolStepIntent: 'Intent', modelPoolStepIntentDetail: 'Latest user message', - modelPoolStepIntentNote: 'Keywords, or one classifier call', + modelPoolStepIntentNote: 'Keywords or classifier', modelPoolPathMatch: 'Match', - modelPoolPathDefault: 'Default', + modelPoolPathDefault: 'Default (unmatched)', modelPoolPathLabel: 'Path name', modelPoolAddPath: 'Add path', modelPoolRemovePath: 'Remove path', @@ -240,10 +240,10 @@ export const messages: Record = { modelPoolKeywordsHint: 'Comma-separated. Any case-insensitive hit on the latest user message selects this path.', modelPoolIntentLabel: 'Classifier label', modelPoolIntentHint: 'Matched against the classifier reply. The path name is also accepted.', - modelPoolPathFallback: 'Default path', + modelPoolPathFallback: 'Default path (no match; not a failure backup)', modelPoolClassifier: 'Classifier', modelPoolClassifierOff: 'Keywords only', - modelPoolClassifierHint: 'Optional. One non-streaming call before routing. It must be a concrete model.', + modelPoolClassifierHint: 'Optional. At a reached branch, a separate non-streaming request uses this concrete model to classify the message; other reached branches can trigger additional classifier requests.', modelPoolNestedPool: 'Group', modelPoolNestedPoolPick: 'Choose a group', modelPoolNestedPoolEmpty: 'No other groups yet', @@ -251,7 +251,8 @@ export const messages: Record = { modelPoolSelfGroup: 'A group cannot nest itself.', modelPoolClassifierIncomplete: 'The classifier needs a provider and a model.', modelPoolPreview: 'Try a message', - modelPoolPreviewHint: 'Shows the path and the attempt order for this draft. A classifier is called once when the draft has one.', + modelPoolPreviewHint: 'Shows at most one next candidate or cooling hint from the current pool state, not a full failover sequence. An empty result means the current pool could not confirm a route. Candidate selection reserves no account and advances no rotation; reached branches may dispatch non-streaming classifier requests. API-key grants, request-specific account pins, session affinity, protocol-specific request context, and concurrent or later pool changes are not included, so a live request may differ.', + modelPoolPreviewNoCandidate: 'No current candidate could be confirmed.', modelPoolPreviewPh: 'Plan the rollout', modelPoolPreviewRun: 'Preview', modelPoolPreviewPath: 'Path', @@ -1401,7 +1402,7 @@ export const messages: Record = { modelPoolNameHint: '只出现在这个控制台的列表里,用来辨认。客户端看不到。', modelPoolNamePh: '我的 Claude', modelPoolStrategy: '路由策略', - modelPoolStrategyHint: '优先级顺序:始终使用第一个可用成员(主备)。轮询:均匀分摊请求。优先填满:偏向权重最高的成员。最先过期优先:优先使用额度最快到期的成员。', + modelPoolStrategyHint: '优先级顺序:按优先级排列符合条件的成员;除非开启故障转移,后续成员不等于故障备份。轮询:均匀分摊请求。优先填满:偏向权重最高的成员。最先过期优先:优先选择额度最早到期的成员。', modelPoolStrategy_priority: '优先级顺序', 'modelPoolStrategy_round-robin': '轮询', 'modelPoolStrategy_fill-first': '优先填满', @@ -1410,7 +1411,7 @@ export const messages: Record = { 'modelPoolStrategy_most-quota-first': '剩余额度最多优先', modelPoolFailover: '故障转移', modelPoolMaxAttempts: '最大尝试次数', - modelPoolMaxAttemptsHint: '请求失败前最多尝试的供应商数量(1-64)。', + modelPoolMaxAttemptsHint: '开启故障转移时,此项限制主请求逻辑模型的总派发次数,包含首次派发和跨成员的后续尝试(1-64),不是供应商数量。', modelPoolMembers: '供应商模型', modelPoolMembersHint: '仅可选出已接入的供应商,以及对应供应商设置中启用的模型。账号由供应商账号池自动选择,顺序即优先级。', modelPoolAddMember: '添加供应商模型', @@ -1434,7 +1435,7 @@ export const messages: Record = { modelPoolColFailover: '故障转移', modelPoolColEnabled: '启用', modelPoolColActions: '操作', - modelPoolFailoverOn: '开启 · {count} 次尝试', + modelPoolFailoverOn: '开启 · 最多 {count} 次派发', modelPoolFailoverOff: '关闭', modelPoolEmpty: '还没有调度组', modelPoolEmptyHint: '添加一组,就会多一个客户端能调用的模型。', @@ -1449,22 +1450,22 @@ export const messages: Record = { modelPoolEntryTitle: '请求', modelPoolEntryDetail: '客户端模型 ID', modelPoolEntryNote: '客户端调用这个 ID 时开始', - modelPoolEntryHint: '一个座位是一个供应商。不选账号就用它的全部账号,也可以勾上多个。从左到右是尝试顺序。', + modelPoolEntryHint: '每个供应商/模型可按所勾账号展开成多个座位,顺序跟勾选顺序一致。不勾账号时,符合条件的全部已接入账号都可参与;有勾选时只包含所选账号。行内策略决定这些座位的调度方式。', modelPoolStepProvider: '供应商', modelPoolStepProviderDetail: '一个供应商', modelPoolAccounts: '账号', - modelPoolAccountsHint: '不选,或者勾多个,保存都是这个供应商已接入的全部账号。只勾一个,才只走那个账号。', + modelPoolAccountsHint: '账号全不勾选时,纳入符合条件的全部已接入账号。勾选一个或多个后,仅纳入所选账号;多选会按勾选顺序展开为座位。', modelPoolAccountsAll: '全部账号', modelPoolAccountsAllCount: '全部 {count} 个账号', - modelPoolSeatOrderAll: '供应商顺序', - modelPoolSeatOrderPicked: '勾选顺序', + modelPoolSeatOrderAll: '由账号池选择', + modelPoolSeatOrderPicked: '按勾选顺序展开', modelPoolSeatCount: '{count} 个座位', modelPoolPathCount: '{count} 条路径', modelPoolAccountsCount: '{count} 个账号', modelPoolAccountsSearch: '查找账号', modelPoolAccountsNoMatch: '没有匹配的账号', modelPoolNoAccounts: '这个供应商还没有接入账号', - modelPoolAccountsDraft: '勾了多个账号时,保存仍是这个供应商的全部账号。只勾一个,才会只记那一个。', + modelPoolAccountsDraft: '多选时仅包含所勾账号,并按勾选顺序展开为座位。', modelPoolClientModel: '客户端传来的模型名', modelPoolCanvasPalette: '添加座位', modelPoolCanvasIncomplete: '待设置', @@ -1486,9 +1487,9 @@ export const messages: Record = { modelPoolStepGroupNote: '内层保持自己的顺序', modelPoolStepIntent: '意图', modelPoolStepIntentDetail: '最新一条用户消息', - modelPoolStepIntentNote: '关键词,或一次分类调用', + modelPoolStepIntentNote: '关键词或分类模型', modelPoolPathMatch: '匹配', - modelPoolPathDefault: '默认', + modelPoolPathDefault: '默认(无匹配)', modelPoolPathLabel: '路径名称', modelPoolAddPath: '添加路径', modelPoolRemovePath: '移除路径', @@ -1496,10 +1497,10 @@ export const messages: Record = { modelPoolKeywordsHint: '用逗号分隔。最新一条用户消息里任意一个关键词命中(忽略大小写)即走这条路径。', modelPoolIntentLabel: '分类标签', modelPoolIntentHint: '与分类模型的回复比较。路径名称同样可以命中。', - modelPoolPathFallback: '默认路径', + modelPoolPathFallback: '默认路径(无匹配时使用,不是故障备份)', modelPoolClassifier: '分类模型', modelPoolClassifierOff: '只用关键词', - modelPoolClassifierHint: '可选。路由前做一次非流式调用,并且必须是具体模型。', + modelPoolClassifierHint: '可选。到达这条分支时,会用所选具体模型另发非流式请求来分类消息;同一次路由中其他实际到达的分支也可能触发额外分类请求。', modelPoolNestedPool: '调度组', modelPoolNestedPoolPick: '选择调度组', modelPoolNestedPoolEmpty: '还没有其他调度组', @@ -1507,7 +1508,8 @@ export const messages: Record = { modelPoolSelfGroup: '调度组不能嵌套自己。', modelPoolClassifierIncomplete: '分类模型需要同时选择供应商和模型。', modelPoolPreview: '试一句消息', - modelPoolPreviewHint: '按当前草稿显示路径和尝试顺序。草稿里有分类模型时会调用它一次。', + modelPoolPreviewHint: '按当前账号池状态显示至多一个下一候选或冷却提示,不是完整故障转移序列。结果为空表示当前账号池无法确认路由。候选选择不预占账号、不推进轮转;实际到达的分支可能发起非流式分类请求。预览不包含 API 密钥授权、请求级账号指定、会话粘性、协议请求上下文及并发或后续池状态变化,因此真实请求可能不同。', + modelPoolPreviewNoCandidate: '当前无法确认可用候选。', modelPoolPreviewPh: '帮我规划上线步骤', modelPoolPreviewRun: '预览', modelPoolPreviewPath: '路径', diff --git a/frontend/src/pages/ModelPoolEditorPage.tsx b/frontend/src/pages/ModelPoolEditorPage.tsx index 99b5e7f7c..47ccb2014 100644 --- a/frontend/src/pages/ModelPoolEditorPage.tsx +++ b/frontend/src/pages/ModelPoolEditorPage.tsx @@ -312,20 +312,18 @@ export function ModelPoolEditorPage() { [aggregations, doc, message, models, t], ) const previewRows = useMemo(() => { - if (preview?.attempts.length) { - return preview.attempts.map((attempt, index) => ({ - id: attempt.id || `${attempt.provider}-${attempt.model}-${index}`, - title: accountProviderLabel(attempt.provider, attempt.region || '', t), - detail: attempt.model ? modelTitle(models, attempt.model) : '', - note: attempt.status === 'skipped' - ? (attempt.reason === 'no ready account' ? t('modelPoolNoReady') : (attempt.reason || t('modelPoolCanvasSkip'))) - : '', - provider: attempt.provider, - })) - } - return draft.rows - }, [draft.rows, models, preview, t]) - const previewPath = preview?.path || draft.path + if (!preview) return previewError ? [] : draft.rows + return preview.attempts.map((attempt, index) => ({ + id: attempt.id || `${attempt.provider}-${attempt.model}-${index}`, + title: accountProviderLabel(attempt.provider, attempt.region || '', t), + detail: attempt.model ? modelTitle(models, attempt.model) : '', + note: attempt.status === 'skipped' + ? (attempt.reason === 'no ready account' ? t('modelPoolNoReady') : (attempt.reason || t('modelPoolCanvasSkip'))) + : '', + provider: attempt.provider, + })) + }, [draft.rows, models, preview, previewError, t]) + const previewPath = preview ? preview.path : previewError ? '' : draft.path if (poolLoading) return if (!enabled) return @@ -448,6 +446,7 @@ export function ModelPoolEditorPage() { {previewPath ?

{t('modelPoolPreviewPath')} · {previewPath}

: null} + {preview && preview.attempts.length === 0 ?

{t('modelPoolPreviewNoCandidate')}

: null} {previewError ?
: null} {previewRows.length ? (
    @@ -990,4 +989,3 @@ function accountsForProvider(accounts: AccountRow[], provider: string, region: s .filter((account) => !wantedRegion || normalizeRegion(account.region) === wantedRegion) .sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0) || (a.name || a.id).localeCompare(b.name || b.id)) } - diff --git a/internal/accounts/aggregation.go b/internal/accounts/aggregation.go index a5994eb13..c78c8ea14 100644 --- a/internal/accounts/aggregation.go +++ b/internal/accounts/aggregation.go @@ -120,55 +120,111 @@ func NormalizeAggregationStrategy(value string) AggregationStrategy { } } +// SplitProviderModelPrefix separates the gateway's reserved provider selector +// from a model ID. The remaining model may itself have slash-separated parts. +// Prefixes are case-sensitive; lookup in the registry alone is not. +func SplitProviderModelPrefix(model string) (provider, region, bare string) { + model = strings.TrimSpace(model) + prefix, bare, found := strings.Cut(model, "/") + if !found { + return "", "", model + } + family := func(segment string) string { + descriptor, ok := providers.Get(segment) + if ok && (segment == descriptor.ID || segment == "muse") { + return descriptor.ID + } + return "" + } + if provider = family(prefix); provider != "" { + return provider, "", bare + } + if i := strings.LastIndexByte(prefix, '-'); i >= 0 { + switch prefix[i+1:] { + case "cn": + region = "cn" + case "gl": + region = "global" + case "auto": + // No explicit region pin. + default: + return "", "", model + } + if provider = family(prefix[:i]); provider != "" { + return provider, region, bare + } + } + return "", "", model +} + // BareAggregationModel strips a provider or provider-region prefix that // belongs to this member. A foreign prefix stays intact. func BareAggregationModel(provider, region, model string) string { - return normalizeAggregationModel(provider, region, model) + bare, _ := splitAggregationTarget(provider, region, model) + return bare } -// normalizeAggregationModel stores the concrete upstream model without the -// provider or provider-region prefix a client-facing model list may have -// added. A foreign prefix, including Command's org-scoped ids, stays intact. -// An empty provider does not inherit the qoder default, so an unnamed member -// cannot strip a qoder/ prefix by accident. - -func normalizeAggregationModel(provider, region, model string) string { +// splitAggregationTarget recognizes a prefix belonging to the target's own +// provider. A foreign prefix, including Command's org-scoped IDs, stays intact. +// The region result is a hard pin implied by an explicit region qualifier. +func splitAggregationTarget(provider, region, model string) (bare, impliedRegion string) { model = strings.TrimSpace(model) - if model == "" { - return "" - } first, rest, found := strings.Cut(model, "/") - if !found { - return model - } - candidate := strings.ToLower(strings.TrimSpace(first)) raw := strings.ToLower(strings.TrimSpace(provider)) - if raw == "" || strings.TrimSpace(rest) == "" { - return model + rest = strings.TrimSpace(rest) + if !found || raw == "" || rest == "" { + return model, "" } + prefix := strings.ToLower(strings.TrimSpace(first)) family := NormalizeProviderFamily(raw) - names := []string{family} - if raw != family { - names = append(names, raw) + sameFamily := func(name string) bool { + return name != "" && NormalizeProviderFamily(name) == family + } + if sameFamily(prefix) { + return rest, "" + } + if i := strings.LastIndexByte(prefix, '-'); i >= 0 && sameFamily(prefix[:i]) { + switch suffix := prefix[i+1:]; suffix { + case "cn", "gl", "global": + return rest, NormalizeRegion(suffix) + case "auto": + return rest, "" + default: + // Legacy explicit region spelling (e.g. opencode-go). Do not + // infer unrecognized region qualifiers without a matching pin. + if suffix != "" && suffix == strings.ToLower(strings.TrimSpace(region)) { + return rest, "" + } + } } + return model, "" +} + +func normalizeAggregationTarget(provider, region, model string) (bare, targetRegion string, err error) { region = strings.ToLower(strings.TrimSpace(region)) - for _, name := range names { - if name == "" { - continue + bare = strings.TrimSpace(model) + // Remove all own-provider wrappers in one pass so serializing and parsing + // a document again cannot discover a different model or region. + for { + next, impliedRegion := splitAggregationTarget(provider, region, bare) + if next == bare { + return bare, region, nil } - if candidate == name || (region != "" && candidate == name+"-"+region) { - return strings.TrimSpace(rest) - } - for _, suffix := range []string{"-cn", "-gl", "-global", "-auto"} { - if candidate == name+suffix { - return strings.TrimSpace(rest) + if impliedRegion != "" { + if region == "" || region == "auto" { + region = impliedRegion + } else if NormalizeRegion(region) != impliedRegion { + return "", "", fmt.Errorf("model %q specifies region %q, which conflicts with region %q", strings.TrimSpace(model), impliedRegion, region) } } + bare = next } - return model } -func normalizeAggregationMembers(members []AggregationMember) ([]AggregationMember, error) { +// normalizeAggregationMembers validates and orders the compatibility member +// list. Normalize targets on flat writes; a pipeline has already normalized +// its own leaves and may contain unchanged flat members from a legacy child. +func normalizeAggregationMembers(members []AggregationMember, normalizeTargets bool) ([]AggregationMember, error) { if len(members) == 0 { return nil, fmt.Errorf("aggregation requires at least one member") } @@ -185,6 +241,13 @@ func normalizeAggregationMembers(members []AggregationMember) ([]AggregationMemb if provider == "" || model == "" { return nil, fmt.Errorf("aggregation member requires provider and model") } + if normalizeTargets { + var err error + model, region, err = normalizeAggregationTarget(provider, region, model) + if err != nil { + return nil, err + } + } if len(accountID) > 256 { return nil, fmt.Errorf("aggregation member account id is too long") } @@ -318,6 +381,15 @@ func PrepareCreateAggregation(input CreateAggregation) (CreateAggregation, error if !validAggregationID(id) { return CreateAggregation{}, fmt.Errorf("aggregation id required (lowercase letters, digits, '-' and '/')") } + if strings.HasPrefix(id, "/") || strings.HasSuffix(id, "/") || strings.Contains(id, "//") { + return CreateAggregation{}, fmt.Errorf("aggregation id must not contain an empty path segment") + } + if id == "new" { + return CreateAggregation{}, fmt.Errorf("aggregation id %q uses a reserved editor path", id) + } + if provider, _, _ := SplitProviderModelPrefix(id); provider != "" { + return CreateAggregation{}, fmt.Errorf("aggregation id %q uses a reserved provider prefix", id) + } name := strings.TrimSpace(input.Name) if name == "" { name = id @@ -327,7 +399,7 @@ func PrepareCreateAggregation(input CreateAggregation) (CreateAggregation, error } var members []AggregationMember if strings.TrimSpace(input.Document) == "" { - normalized, err := normalizeAggregationMembers(input.Members) + normalized, err := normalizeAggregationMembers(input.Members, true) if err != nil { return CreateAggregation{}, err } @@ -391,7 +463,7 @@ func ApplyAggregationUpdate(current Aggregation, input UpdateAggregation) (Aggre current.Document = strings.TrimSpace(*input.Document) } if input.Members != nil && strings.TrimSpace(current.Document) == "" { - members, err := normalizeAggregationMembers(*input.Members) + members, err := normalizeAggregationMembers(*input.Members, true) if err != nil { return Aggregation{}, err } diff --git a/internal/accounts/aggregation_grant_test.go b/internal/accounts/aggregation_grant_test.go index a8ea64299..906d84eda 100644 --- a/internal/accounts/aggregation_grant_test.go +++ b/internal/accounts/aggregation_grant_test.go @@ -24,6 +24,8 @@ func TestIsAggregationOnly(t *testing.T) { {[]string{"aggregation"}, true}, {[]string{"aggregation", "aggregation"}, true}, {[]string{"aggregation", "qoder"}, false}, + {[]string{" aggregation "}, false}, + {[]string{"aggregation", " aggregation"}, false}, {[]string{"qoder"}, false}, {nil, false}, } diff --git a/internal/accounts/aggregation_test.go b/internal/accounts/aggregation_test.go new file mode 100644 index 000000000..02e8e3b9f --- /dev/null +++ b/internal/accounts/aggregation_test.go @@ -0,0 +1,89 @@ +package accounts + +import ( + "strings" + "testing" + + "github.com/caigee-cmd/cli2api/internal/providers" +) + +func TestSplitProviderModelPrefix(t *testing.T) { + for _, entry := range providers.List() { + for _, variant := range []struct{ suffix, region string }{ + {"", ""}, {"-cn", "cn"}, {"-gl", "global"}, {"-auto", ""}, + } { + model := entry.ID + variant.suffix + "/namespace/upstream" + if provider, region, bare := SplitProviderModelPrefix(model); provider != entry.ID || region != variant.region || bare != "namespace/upstream" { + t.Errorf("SplitProviderModelPrefix(%q) = %q, %q, %q", model, provider, region, bare) + } + } + } + for _, tc := range []struct{ model, provider, region, bare string }{ + {" muse-cn/upstream ", "meta", "cn", "upstream"}, + {"qoder/", "qoder", "", ""}, + {"qoder-cn/ model", "qoder", "cn", " model"}, + {" Qoder-cn/model ", "", "", "Qoder-cn/model"}, + {"qoder /model", "", "", "qoder /model"}, + {"qoder-global/model", "", "", "qoder-global/model"}, + {"team/model", "", "", "team/model"}, + {"qoder", "", "", "qoder"}, + {" ", "", "", ""}, + } { + if provider, region, bare := SplitProviderModelPrefix(tc.model); provider != tc.provider || region != tc.region || bare != tc.bare { + t.Errorf("SplitProviderModelPrefix(%q) = %q, %q, %q; want %q, %q, %q", tc.model, provider, region, bare, tc.provider, tc.region, tc.bare) + } + } +} + +func TestPrepareCreateAggregationReservesOnlyDirectModelPrefixes(t *testing.T) { + input := CreateAggregation{Members: []AggregationMember{{Provider: "qoder", Model: "upstream"}}} + for _, id := range []string{" qOdEr/upstream ", "workbuddy-cn/upstream", "muse-gl/upstream", "codex-auto/name"} { + input.ID = id + if _, err := PrepareCreateAggregation(input); err == nil || !strings.Contains(err.Error(), "reserved provider prefix") { + t.Errorf("Create with reserved ID %q returned %v", id, err) + } + } + for _, id := range []string{"qoder", "team/review", "qoder-global/review", "review/qoder", "preview", "team/new"} { + input.ID = id + if got, err := PrepareCreateAggregation(input); err != nil || got.ID != id { + t.Errorf("Create with ID %q returned %q, %v", id, got.ID, err) + } + } +} + +func TestPrepareCreateAggregationRejectsUnmanageablePaths(t *testing.T) { + for _, id := range []string{" new ", "/", "/team", "team/", "team//review"} { + input := CreateAggregation{ID: id, Members: []AggregationMember{{Provider: "qoder", Model: "upstream"}}} + if _, err := PrepareCreateAggregation(input); err == nil { + t.Errorf("Create with ID %q succeeded", id) + } + } +} + +func TestFlatAggregationMemberProviderPrefixKeepsItsRegion(t *testing.T) { + for _, tc := range []struct { + provider, region, model string + wantRegion, wantModel string + }{ + {"qoder", "", " QODER-CN/upstream ", "cn", "upstream"}, + {"qoder", "GL", "qoder-global/upstream", "gl", "upstream"}, + {"qoder", "cn", "qoder-auto/upstream", "cn", "upstream"}, + {"meta", "", "muse-gl/upstream", "global", "upstream"}, + {"command", "", "command/org/upstream", "", "org/upstream"}, + {"command", "", "qoder-cn/upstream", "", "qoder-cn/upstream"}, + {"opencode", "go", "opencode-go/upstream", "go", "upstream"}, + } { + member := AggregationMember{Provider: tc.provider, Region: tc.region, Model: tc.model} + got, err := PrepareCreateAggregation(CreateAggregation{ID: "logical", Members: []AggregationMember{member}}) + if err != nil || len(got.Members) != 1 || got.Members[0].Region != tc.wantRegion || got.Members[0].Model != tc.wantModel { + t.Errorf("member %+v normalized to %+v, %v; want model %q and region %q", member, got.Members, err, tc.wantModel, tc.wantRegion) + } + } + conflict := []AggregationMember{{Provider: "qoder", Region: "global", Model: "qoder-cn/upstream"}} + if _, err := PrepareCreateAggregation(CreateAggregation{ID: "logical", Members: conflict}); err == nil || !strings.Contains(err.Error(), "conflicts") { + t.Fatalf("creation accepted conflicting region: %v", err) + } + if _, err := ApplyAggregationUpdate(Aggregation{ID: "logical"}, UpdateAggregation{Members: &conflict}); err == nil || !strings.Contains(err.Error(), "conflicts") { + t.Fatalf("update accepted conflicting region: %v", err) + } +} diff --git a/internal/accounts/grants.go b/internal/accounts/grants.go index aef22cb4c..2ae3c81d5 100644 --- a/internal/accounts/grants.go +++ b/internal/accounts/grants.go @@ -121,7 +121,7 @@ func IsAggregationOnly(allowed []string) bool { return false } for _, entry := range allowed { - grant, err := ParseProviderGrant(strings.TrimSpace(entry)) + grant, err := ParseProviderGrant(entry) if err != nil || grant.Provider != AggregationProvider { return false } diff --git a/internal/accounts/pipeline.go b/internal/accounts/pipeline.go index b847cf96d..de879886a 100644 --- a/internal/accounts/pipeline.go +++ b/internal/accounts/pipeline.go @@ -4,6 +4,8 @@ import ( "encoding/json" "fmt" "strings" + + "github.com/caigee-cmd/cli2api/internal/providers" ) const ( @@ -83,11 +85,12 @@ func CollectPipeline(id, document string, catalog map[string]Aggregation) (strin return "", nil, err } var seq int - members, err := collectSteps(id, doc.Steps, 0, map[string]bool{id: true}, catalog, &seq) + id = strings.ToLower(strings.TrimSpace(id)) + members, err := collectSteps(id, doc.Steps, 0, map[string]bool{id: true}, catalog, &seq, collectSubmitted) if err != nil { return "", nil, err } - members, err = normalizeAggregationMembers(members) + members, err = normalizeAggregationMembers(members, false) if err != nil { return "", nil, err } @@ -98,10 +101,56 @@ func CollectPipeline(id, document string, catalog map[string]Aggregation) (strin return string(raw), members, nil } +// PipelineCatalogMembers enumerates the members reachable through the current +// group snapshot. Unlike saving or compiling a request, it neither rewrites +// the document nor chooses or dispatches a classifier. Broken alternatives +// do not mask other valid intent paths, but a broken required step does. +func PipelineCatalogMembers(agg Aggregation, catalog map[string]Aggregation) ([]AggregationMember, error) { + if strings.TrimSpace(agg.Document) == "" { + return agg.Members, nil + } + doc, err := parsePipeline(agg.Document) + if err != nil { + return nil, err + } + var seq int + id := strings.ToLower(strings.TrimSpace(agg.ID)) + return collectSteps(id, doc.Steps, 0, map[string]bool{id: true}, catalog, &seq, collectCatalog) +} + // CompilePipeline selects one path and builds the seats for a single request. // labels maps ClassifierTarget.Key to the label a classifier returned. An // empty label falls through to keywords and then the fallback path. func CompilePipeline(agg Aggregation, catalog map[string]Aggregation, text string, labels map[string]string, allowed map[string]bool) (Aggregation, []RouteSeat, string, error) { + return compilePipeline(agg, catalog, text, allowed, func(c *pipelineClassifier) (string, error) { + return labels[c.target().Key()], nil + }) +} + +// CompilePipelineWithClassifier resolves labels only for branch steps reached +// on the selected path, including branches in selected groups. The callback +// is synchronous and called once per distinct target in this compile. An +// empty result keeps the same keyword and fallback rules as CompilePipeline. +func CompilePipelineWithClassifier(agg Aggregation, catalog map[string]Aggregation, text string, allowed map[string]bool, classify func(ClassifierTarget) string) (Aggregation, []RouteSeat, string, error) { + labels := make(map[string]string) + return compilePipeline(agg, catalog, text, allowed, func(c *pipelineClassifier) (string, error) { + if classify == nil { + return "", nil + } + target := c.target() + key := target.Key() + label, ok := labels[key] + if !ok { + label = classify(target) + labels[key] = label + } + return label, nil + }) +} + +type pipelineClassifierLookup func(*pipelineClassifier) (string, error) + +func compilePipeline(agg Aggregation, catalog map[string]Aggregation, text string, allowed map[string]bool, lookup pipelineClassifierLookup) (Aggregation, []RouteSeat, string, error) { if strings.TrimSpace(agg.Document) == "" { return agg, nil, "", nil } @@ -109,9 +158,10 @@ func CompilePipeline(agg Aggregation, catalog map[string]Aggregation, text strin if err != nil { return Aggregation{}, nil, "", err } - chosen, path := selectSteps(doc.Steps, text, labels) + var path string var seq int - seats, members, err := seatSteps(agg.ID, chosen, 0, map[string]bool{agg.ID: true}, catalog, text, labels, &seq) + id := strings.ToLower(strings.TrimSpace(agg.ID)) + seats, members, err := seatSteps(id, doc.Steps, 0, map[string]bool{id: true}, catalog, text, lookup, &seq, &path) if err != nil { return Aggregation{}, nil, "", err } @@ -139,6 +189,7 @@ func ClassifierTargets(id, document string, catalog map[string]Aggregation) ([]C } var out []ClassifierTarget seen := map[string]bool{} + id = strings.ToLower(strings.TrimSpace(id)) if err := walkClassifiers(id, doc.Steps, 0, map[string]bool{id: true}, catalog, seen, &out); err != nil { return nil, err } @@ -163,40 +214,17 @@ func parsePipeline(document string) (pipelineDoc, error) { return doc, nil } -// normalizePipelineSteps makes the stored document and the live compiler -// agree on provider, region, and model spelling, and turns a multi-account -// member into one seat per checked account. A hand-written document can -// otherwise carry "Qoder" or "qoder/glm" and compile to a seat no account -// can serve, or keep only the first checked account and widen the rest of -// the route to the whole provider. +// normalizePipelineSteps expands a multi-account member into one seat per +// checked account. Model selectors are normalized when each leaf is reached, +// so a stored invalid leaf on an unselected branch does not block routing. func normalizePipelineSteps(steps []pipelineStep) []pipelineStep { steps = expandMemberAccounts(steps) for i := range steps { step := &steps[i] switch step.Kind { - case "member": - rawProvider := strings.ToLower(strings.TrimSpace(step.Provider)) - if rawProvider != "" { - step.Provider = NormalizeProviderFamily(rawProvider) - } - step.Region = strings.ToLower(strings.TrimSpace(step.Region)) - if strings.TrimSpace(step.Model) != "" { - step.Model = normalizeAggregationModel(rawProvider, step.Region, step.Model) - } - step.AccountID = strings.TrimSpace(step.AccountID) case "group": step.AggregationID = strings.ToLower(strings.TrimSpace(step.AggregationID)) case "branch": - if step.Classifier != nil { - rawProvider := strings.ToLower(strings.TrimSpace(step.Classifier.Provider)) - if rawProvider != "" { - step.Classifier.Provider = NormalizeProviderFamily(rawProvider) - } - step.Classifier.Region = strings.ToLower(strings.TrimSpace(step.Classifier.Region)) - if strings.TrimSpace(step.Classifier.Model) != "" { - step.Classifier.Model = normalizeAggregationModel(rawProvider, step.Classifier.Region, step.Classifier.Model) - } - } for j := range step.Paths { step.Paths[j].Steps = normalizePipelineSteps(step.Paths[j].Steps) } @@ -266,18 +294,28 @@ func selectedAccountIDs(step pipelineStep) []string { return ids } -func collectSteps(self string, steps []pipelineStep, depth int, stack map[string]bool, catalog map[string]Aggregation, seq *int) ([]AggregationMember, error) { +type pipelineCollectMode uint8 + +const ( + collectSubmitted pipelineCollectMode = iota + collectStored + collectCatalog +) + +func collectSteps(self string, steps []pipelineStep, depth int, stack map[string]bool, catalog map[string]Aggregation, seq *int, mode pipelineCollectMode) ([]AggregationMember, error) { var out []AggregationMember - for _, step := range steps { + for i := range steps { + step := &steps[i] switch step.Kind { case "member": - member, err := leafMember(step, seq) + member, err := leafMember(*step, seq) if err != nil { return nil, err } + step.Provider, step.Region, step.Model, step.AccountID = member.Provider, member.Region, member.Model, member.AccountID out = append(out, member) case "group": - nested, err := openGroup(self, step, depth, stack, catalog) + nested, err := openGroup(self, *step, depth, stack, catalog) if err != nil { return nil, err } @@ -294,7 +332,13 @@ func collectSteps(self string, steps []pipelineStep, depth int, stack map[string return nil, err } stack[nested.ID] = true - inner, err := collectSteps(nested.ID, doc.Steps, depth+1, stack, catalog, seq) + // Only the submitted document is rewritten. A referenced legacy + // child retains the same first-default semantics as live compile. + nestedMode := mode + if nestedMode == collectSubmitted { + nestedMode = collectStored + } + inner, err := collectSteps(nested.ID, doc.Steps, depth+1, stack, catalog, seq, nestedMode) delete(stack, nested.ID) if err != nil { return nil, err @@ -304,20 +348,28 @@ func collectSteps(self string, steps []pipelineStep, depth int, stack map[string if err := validateClassifier(step.Classifier, catalog); err != nil { return nil, err } - paths := step.Paths - if len(step.Fallback) > 0 { - paths = append(paths, pipelinePath{ID: step.ID + "-fallback", Label: "Default", Fallback: true, Steps: step.Fallback}) + paths, err := pipelinePaths(*step, mode == collectSubmitted) + if err != nil { + return nil, err } if len(paths) == 0 { return nil, fmt.Errorf("branch %s has no paths", step.ID) } + validPath := false for _, path := range paths { - inner, err := collectSteps(self, path.Steps, depth, stack, catalog, seq) + inner, err := collectSteps(self, path.Steps, depth, stack, catalog, seq, mode) if err != nil { + if mode == collectCatalog { + continue + } return nil, err } + validPath = true out = append(out, inner...) } + if !validPath { + return nil, fmt.Errorf("branch %s has no valid path", step.ID) + } default: return nil, fmt.Errorf("unknown pipeline step %q", step.Kind) } @@ -325,7 +377,7 @@ func collectSteps(self string, steps []pipelineStep, depth int, stack map[string return out, nil } -func seatSteps(self string, steps []pipelineStep, depth int, stack map[string]bool, catalog map[string]Aggregation, text string, labels map[string]string, seq *int) ([]RouteSeat, []AggregationMember, error) { +func seatSteps(self string, steps []pipelineStep, depth int, stack map[string]bool, catalog map[string]Aggregation, text string, lookup pipelineClassifierLookup, seq *int, path *string) ([]RouteSeat, []AggregationMember, error) { var seats []RouteSeat var members []AggregationMember for _, step := range steps { @@ -345,9 +397,11 @@ func seatSteps(self string, steps []pipelineStep, depth int, stack map[string]bo seat := RouteSeat{ID: step.ID, Kind: "group", Priority: *seq, Weight: weightOf(step.Weight), GroupID: nested.ID, GroupStrategy: nested.Strategy} if strings.TrimSpace(nested.Document) == "" { for _, member := range nested.Members { + // Keep the child's configured tier for group scheduling. Only + // the compatibility member list uses the parent traversal order. + seat.GroupMembers = append(seat.GroupMembers, member) member.Priority = *seq *seq++ - seat.GroupMembers = append(seat.GroupMembers, member) members = append(members, member) } } else { @@ -355,9 +409,8 @@ func seatSteps(self string, steps []pipelineStep, depth int, stack map[string]bo if err != nil { return nil, nil, err } - chosen, _ := selectSteps(doc.Steps, text, labels) stack[nested.ID] = true - innerSeats, innerMembers, err := seatSteps(nested.ID, chosen, depth+1, stack, catalog, text, labels, seq) + innerSeats, innerMembers, err := seatSteps(nested.ID, doc.Steps, depth+1, stack, catalog, text, lookup, seq, nil) delete(stack, nested.ID) if err != nil { return nil, nil, err @@ -374,8 +427,22 @@ func seatSteps(self string, steps []pipelineStep, depth int, stack map[string]bo } seats = append(seats, seat) case "branch": - chosen, _ := selectSteps([]pipelineStep{step}, text, labels) - innerSeats, innerMembers, err := seatSteps(self, chosen, depth, stack, catalog, text, labels, seq) + var label string + if step.Classifier != nil { + if err := validateClassifier(step.Classifier, catalog); err != nil { + return nil, nil, err + } + var err error + label, err = lookup(step.Classifier) + if err != nil { + return nil, nil, err + } + } + chosen, pathLabel := choosePath(step, text, label) + if path != nil && *path == "" { + *path = pathLabel + } + innerSeats, innerMembers, err := seatSteps(self, chosen, depth, stack, catalog, text, lookup, seq, nil) if err != nil { return nil, nil, err } @@ -388,37 +455,42 @@ func seatSteps(self string, steps []pipelineStep, depth int, stack map[string]bo return seats, members, nil } -func selectSteps(steps []pipelineStep, text string, labels map[string]string) ([]pipelineStep, string) { - var out []pipelineStep - path := "" - for _, step := range steps { - if step.Kind != "branch" { - out = append(out, step) - continue +// pipelinePaths uses the first explicit default for legacy documents, just +// as routing always has. Reject duplicate defaults only in new writes. +func pipelinePaths(step pipelineStep, validateDefaults bool) ([]pipelinePath, error) { + paths := make([]pipelinePath, 0, len(step.Paths)+1) + seenDefault := false + for _, path := range step.Paths { + if path.Fallback { + if seenDefault { + if validateDefaults { + return nil, fmt.Errorf("branch %s has more than one fallback path", step.ID) + } + continue + } + seenDefault = true } - chosen, label := choosePath(step, text, labels) - if path == "" { - path = label + paths = append(paths, path) + } + if len(step.Fallback) > 0 { + if !seenDefault { + paths = append(paths, pipelinePath{Label: "Default", Fallback: true, Steps: step.Fallback}) + } else if validateDefaults { + return nil, fmt.Errorf("branch %s has more than one fallback path", step.ID) } - out = append(out, chosen...) } - return out, path + return paths, nil } -func choosePath(step pipelineStep, text string, labels map[string]string) ([]pipelineStep, string) { - paths := step.Paths - if len(step.Fallback) > 0 { - paths = append(paths, pipelinePath{Label: "Default", Fallback: true, Steps: step.Fallback}) - } - if step.Classifier != nil && labels != nil { - if label := strings.TrimSpace(labels[classifierKey(*step.Classifier)]); label != "" { - for _, path := range paths { - if path.Fallback { - continue - } - if strings.EqualFold(path.Intent, label) || strings.EqualFold(path.Label, label) { - return path.Steps, path.Label - } +func choosePath(step pipelineStep, text, classifierLabel string) ([]pipelineStep, string) { + paths, _ := pipelinePaths(step, false) + if label := strings.TrimSpace(classifierLabel); label != "" { + for _, path := range paths { + if path.Fallback { + continue + } + if strings.EqualFold(path.Intent, label) || strings.EqualFold(path.Label, label) { + return path.Steps, path.Label } } } @@ -470,11 +542,14 @@ func leafMember(step pipelineStep, seq *int) (AggregationMember, error) { if rawProvider == "" || model == "" { return AggregationMember{}, fmt.Errorf("member step %s needs a provider and a model", step.ID) } - region := strings.ToLower(strings.TrimSpace(step.Region)) + model, region, err := normalizeAggregationTarget(rawProvider, step.Region, model) + if err != nil { + return AggregationMember{}, fmt.Errorf("member step %s: %w", step.ID, err) + } member := AggregationMember{ Provider: NormalizeProviderFamily(rawProvider), Region: region, - Model: normalizeAggregationModel(rawProvider, region, model), + Model: model, AccountID: strings.TrimSpace(step.AccountID), Priority: *seq, Weight: weightOf(step.Weight), @@ -500,24 +575,28 @@ func validateClassifier(c *pipelineClassifier, catalog map[string]Aggregation) e return fmt.Errorf("classifier needs a provider and a model") } provider := NormalizeProviderFamily(rawProvider) - if provider == AggregationProvider || rawProvider == AggregationProvider { + if provider == AggregationProvider { return fmt.Errorf("classifier must be a concrete model") } - if _, ok := catalog[rawProvider]; ok { - return fmt.Errorf("classifier must be a concrete model") + // A registered provider denotes a direct target even if a logical + // aggregation happens to share its name. + if _, registered := providers.Get(provider); !registered { + if _, logical := catalog[provider]; logical { + return fmt.Errorf("classifier must be a concrete model") + } } - if _, ok := catalog[provider]; ok { - return fmt.Errorf("classifier must be a concrete model") + model, region, err := normalizeAggregationTarget(rawProvider, c.Region, model) + if err != nil { + return fmt.Errorf("classifier: %w", err) } - region := strings.ToLower(strings.TrimSpace(c.Region)) c.Provider = provider - c.Model = normalizeAggregationModel(rawProvider, region, model) + c.Model = model c.Region = region return nil } -func classifierKey(c pipelineClassifier) string { - return ClassifierTarget{Provider: c.Provider, Region: c.Region, Model: c.Model}.Key() +func (c pipelineClassifier) target() ClassifierTarget { + return ClassifierTarget{Provider: c.Provider, Region: c.Region, Model: c.Model} } func walkClassifiers(self string, steps []pipelineStep, depth int, stack map[string]bool, catalog map[string]Aggregation, seen map[string]bool, out *[]ClassifierTarget) error { @@ -528,20 +607,18 @@ func walkClassifiers(self string, steps []pipelineStep, depth int, stack map[str return err } if step.Classifier != nil { - target := ClassifierTarget{Provider: step.Classifier.Provider, Region: step.Classifier.Region, Model: step.Classifier.Model} + target := step.Classifier.target() if !seen[target.Key()] { seen[target.Key()] = true *out = append(*out, target) } } - for _, path := range step.Paths { + paths, _ := pipelinePaths(step, false) + for _, path := range paths { if err := walkClassifiers(self, path.Steps, depth, stack, catalog, seen, out); err != nil { return err } } - if err := walkClassifiers(self, step.Fallback, depth, stack, catalog, seen, out); err != nil { - return err - } case "group": nested, err := openGroup(self, step, depth, stack, catalog) if err != nil { diff --git a/internal/accounts/pipeline_test.go b/internal/accounts/pipeline_test.go index e154afcce..10d5c18db 100644 --- a/internal/accounts/pipeline_test.go +++ b/internal/accounts/pipeline_test.go @@ -72,6 +72,49 @@ func TestPipelineFallbackWhenClassifierMisses(t *testing.T) { } } +func TestPipelineClassifierVisitsOnlySelectedBranchesAndCachesLabels(t *testing.T) { + const doc = `{"version":1,"steps":[ + {"id":"root","kind":"branch","classifier":{"provider":"qoder","model":"classify-root"},"paths":[ + {"id":"chosen","label":"Chosen","intent":"choose","steps":[ + {"id":"inner","kind":"group","aggregation_id":"inner"} + ]}, + {"id":"fallback","label":"Fallback","fallback":true,"steps":[ + {"id":"unused","kind":"branch","classifier":{"provider":"qoder","model":"classify-unused"},"fallback":[ + {"id":"leaf","kind":"member","provider":"qoder","model":"unused"} + ]} + ]} + ]}, + {"id":"repeat","kind":"branch","classifier":{"provider":"qoder","model":"classify-root"},"fallback":[ + {"id":"tail","kind":"member","provider":"qoder","model":"tail"} + ]} + ]}` + const innerDoc = `{"version":1,"steps":[ + {"id":"inner","kind":"branch","classifier":{"provider":"workbuddy","region":"cn","model":"classify-inner"},"paths":[ + {"id":"match","label":"Match","keywords":["plan"],"steps":[ + {"id":"leaf","kind":"member","provider":"qoder","model":"chosen"} + ]} + ],"fallback":[{"id":"default","kind":"member","provider":"qoder","model":"default"}]} + ]}` + catalog := map[string]Aggregation{"inner": {ID: "inner", Enabled: true, Document: innerDoc}} + var visited []string + agg, _, path, err := CompilePipelineWithClassifier(Aggregation{ID: "outer", Document: doc}, catalog, "please plan", nil, func(target ClassifierTarget) string { + visited = append(visited, target.Key()) + if target.Model == "classify-root" { + return "choose" + } + return "" + }) + if err != nil { + t.Fatal(err) + } + if got := strings.Join(visited, ","); got != "qoder||classify-root,workbuddy|cn|classify-inner" { + t.Fatalf("classifier visits = %s, want only selected and deduplicated targets", got) + } + if path != "Chosen" || len(agg.Members) != 2 || agg.Members[0].Model != "chosen" || agg.Members[1].Model != "tail" { + t.Fatalf("compiled path=%q members=%+v", path, agg.Members) + } +} + func TestPipelineNestedGroupKeepsInnerOrder(t *testing.T) { inner := `{ "version": 1, @@ -105,6 +148,32 @@ func TestPipelineNestedGroupKeepsInnerOrder(t *testing.T) { } } +func TestPipelineKeepsLegacyGroupTiersWithoutChangingFlatOrder(t *testing.T) { + const doc = `{"version":1,"steps":[{"id":"group","kind":"group","aggregation_id":"inner"},{"id":"tail","kind":"member","provider":"qoder","model":"tail"}]}` + inner := Aggregation{ID: "inner", Enabled: true, Strategy: AggregationPriority, Members: []AggregationMember{ + {Provider: "qoder", Model: "a", Priority: 4}, + {Provider: "qoder", Model: "b", Priority: 4}, + {Provider: "qoder", Model: "c", Priority: 7}, + }} + agg, seats, _, err := CompilePipeline(Aggregation{ID: "outer", Document: doc, Strategy: AggregationPriority}, map[string]Aggregation{inner.ID: inner}, "", nil, nil) + if err != nil { + t.Fatal(err) + } + if len(seats) != 2 || len(seats[0].GroupMembers) != 3 || len(agg.Members) != 4 { + t.Fatalf("seats = %+v, members = %+v", seats, agg.Members) + } + for i, want := range []int{4, 4, 7} { + if got := seats[0].GroupMembers[i].Priority; got != want { + t.Fatalf("group member %d priority = %d, want %d", i, got, want) + } + } + for i, want := range []string{"a", "b", "c", "tail"} { + if got := agg.Members[i]; got.Model != want || got.Priority != i { + t.Fatalf("flat member %d = %+v, want %s at sequence %d", i, got, want, i) + } + } +} + func TestPipelineNormalizesRawMemberSpelling(t *testing.T) { doc := `{"version":1,"steps":[{"id":"m","kind":"member","provider":"Qoder","region":"GL","model":"qoder/model-a"},{"id":"c","kind":"branch","classifier":{"provider":"Qoder","model":"qoder/small"},"paths":[{"id":"p","label":"Plan","intent":"plan","steps":[{"id":"pm","kind":"member","provider":"WorkBuddy","model":"workbuddy/model-b"}]}]}]}` canonical, members, err := CollectPipeline("mine", doc, nil) @@ -165,3 +234,68 @@ func TestPipelineRejectsCycleDepthAndLogicalClassifier(t *testing.T) { t.Fatal("expected concrete classifier") } } + +func TestPipelineRegionSelectorsAgreeBetweenSaveAndCompile(t *testing.T) { + const raw = `{"steps":[{"id":"intent","kind":"branch", + "classifier":{"provider":"Qoder","model":"qoder/qoder-global/label"}, + "paths":[{"id":"cn","label":"China","intent":"cn","steps":[ + {"id":"member","kind":"member","provider":"workbuddy","model":"workbuddy-cn/upstream","account_ids":["cn-b","cn-a"]}]}], + "fallback":[{"id":"def","kind":"member","provider":"command","model":"command/org/upstream"}]}]}` + // A group sharing a provider name cannot turn a concrete classifier into + // a reference to the group (even if that group is disabled). + catalog := map[string]Aggregation{"qoder": {ID: "qoder"}} + canonical, members, err := CollectPipeline("team/review", raw, catalog) + if err != nil || len(members) != 3 || members[0].Region != "cn" || members[0].Model != "upstream" || members[2].Model != "org/upstream" { + t.Fatalf("stored model targets = %+v, %v", members, err) + } + for _, doc := range []string{raw, canonical} { + group := Aggregation{ID: "team/review", Document: doc} + got, _, path, err := CompilePipelineWithClassifier(group, catalog, "hi", nil, func(target ClassifierTarget) string { + if target.Key() != "qoder|global|label" { + t.Errorf("classifier target = %+v", target) + } + return "cn" + }) + if err != nil || path != "China" || len(got.Members) != 2 || got.Members[0] != members[0] || got.Members[1] != members[1] { + t.Fatalf("path = %q, targets = %+v, %v", path, got.Members, err) + } + if _, _, _, err := CompilePipeline(group, catalog, "hi", map[string]string{"qoder|global|label": "cn"}, map[string]bool{"command": true}); err == nil { + t.Fatal("filtered selected path fell through to a different branch") + } + } + + for _, conflict := range []string{ + strings.Replace(raw, `"model":"qoder/qoder-global/label"`, `"model":"qoder-cn/qoder-global/label"`, 1), + strings.Replace(raw, `"model":"workbuddy-cn/upstream"`, `"region":"global","model":"workbuddy-cn/upstream"`, 1), + } { + if _, _, err := CollectPipeline("team/review", conflict, catalog); err == nil || !strings.Contains(err.Error(), "conflicts") { + t.Fatalf("saved conflicting target: %v", err) + } + if _, _, _, err := CompilePipeline(Aggregation{ID: "team/review", Document: conflict}, catalog, "hi", map[string]string{"qoder|global|label": "cn"}, nil); err == nil || !strings.Contains(err.Error(), "conflicts") { + t.Fatalf("compiled conflicting target: %v", err) + } + } +} + +func TestPipelineConflictingDefaultsRejectNewWritesButKeepLegacyRoute(t *testing.T) { + const mixed = `{"steps":[{"id":"choose","kind":"branch","paths":[ + {"id":"old","label":"First","fallback":true,"steps":[{"kind":"member","provider":"qoder","model":"first"}]}], + "fallback":[{"kind":"member","provider":"qoder","model":"unreachable"}]}]}` + const repeated = `{"steps":[{"id":"choose","kind":"branch","paths":[ + {"id":"old","label":"First","fallback":true,"steps":[{"kind":"member","provider":"qoder","model":"first"}]}, + {"id":"second","label":"Second","fallback":true,"steps":[{"kind":"member","provider":"qoder","model":"unreachable"}]}]}]}` + for _, doc := range []string{mixed, repeated} { + if _, _, err := CollectPipeline("child", doc, nil); err == nil || !strings.Contains(err.Error(), "more than one fallback path") { + t.Fatalf("saved duplicate defaults: %v", err) + } + child := Aggregation{ID: "child", Document: doc, Enabled: true} + compiled, _, path, err := CompilePipeline(child, nil, "hi", nil, nil) + if err != nil || path != "First" || len(compiled.Members) != 1 || compiled.Members[0].Model != "first" { + t.Fatalf("legacy defaults changed: %q, %+v, %v", path, compiled.Members, err) + } + _, members, err := CollectPipeline("parent", `{"steps":[{"kind":"group","aggregation_id":"child"}]}`, map[string]Aggregation{"child": child}) + if err != nil || len(members) != 1 || members[0].Model != "first" { + t.Fatalf("legacy child leaked an unreachable default into parent: %+v, %v", members, err) + } + } +} diff --git a/internal/app/aggregation_catalog_contract_test.go b/internal/app/aggregation_catalog_contract_test.go new file mode 100644 index 000000000..852c68d6e --- /dev/null +++ b/internal/app/aggregation_catalog_contract_test.go @@ -0,0 +1,172 @@ +package app + +import ( + "context" + "encoding/json" + "errors" + "net/http/httptest" + "slices" + "testing" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/auth" + "github.com/caigee-cmd/cli2api/internal/control" + "github.com/caigee-cmd/cli2api/internal/executor" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +type syntheticNamedGroupFixture struct { + control.AggregationStore + groups []accounts.Aggregation +} + +func (f syntheticNamedGroupFixture) ListAggregations(context.Context) ([]accounts.Aggregation, error) { + return f.groups, nil +} + +func syntheticGroupApp(groups []accounts.Aggregation, cross bool, items ...executor.Item) *App { + pool := executor.NewPool(nil, nil) + for _, item := range items { + pool.Upsert(item) + } + a := &App{ + Pool: pool, Executor: executor.NewChatExecutor(pool, ""), + Control: &control.Services{Aggregations: control.NewAggregations(syntheticNamedGroupFixture{groups: groups})}, + } + a.CrossProviderModelPool.Store(cross) + return a +} + +func syntheticListedIDs(t *testing.T, a *App, identity auth.Identity, rows []map[string]any) []string { + t.Helper() + h := a.newGateway() + h.Models = func(bool, string) ([]map[string]any, error) { return rows, nil } + h.DecorateModels = nil + req := httptest.NewRequest("GET", "/v1/models", nil).WithContext(auth.WithIdentity(t.Context(), identity)) + rec := httptest.NewRecorder() + h.HandleModels(rec, req) + var response struct { + Data []struct { + ID string `json:"id"` + } `json:"data"` + } + if rec.Code != 200 { + t.Fatalf("list: HTTP %d: %s", rec.Code, rec.Body.String()) + } + if err := json.Unmarshal(rec.Body.Bytes(), &response); err != nil { + t.Fatalf("decode model list: %v", err) + } + var ids []string + for _, x := range response.Data { + ids = append(ids, x.ID) + } + return ids +} + +func syntheticPrepare(t *testing.T, a *App, identity auth.Identity, model string) (executor.PreparedRequest, error) { + t.Helper() + return a.Executor.Prepare(executor.PrepareInput{ + Context: t.Context(), Request: translate.ChatRequest{Model: model}, Identity: identity, + CrossProviderPool: a.CrossProviderModelPool.Load(), ModelAggregation: identity.ModelAggregation, Aggregations: a.Control.Aggregations, + }) +} + +func TestAggregationModelCatalogDoesNotReadvertiseShadowedAlias(t *testing.T) { + group := accounts.Aggregation{ID: "logical", Enabled: true, Members: []accounts.AggregationMember{{Provider: "workbuddy", Model: "hidden-member"}}} + a := syntheticGroupApp([]accounts.Aggregation{group}, true, executor.Item{ + ID: "allowed", Provider: "qoder", Runtime: "in_process", Models: []string{"real"}, + ModelAliases: map[string]string{"logical": "real", "independent": "real"}, + }) + identity := auth.Identity{AllowedProviders: []string{"qoder"}, ModelAggregation: true} + ids := syntheticListedIDs(t, a, identity, []map[string]any{{"id": "real", "provider": "qoder"}}) + _, err := syntheticPrepare(t, a, identity, "logical") + var prep *executor.PrepareError + if !errors.As(err, &prep) || prep.Code != "model_not_available" { + t.Fatalf("unexpected prepare: %v", err) + } + if !slices.Equal(ids, []string{"independent"}) { + t.Fatalf("listed uncallable same-name alias %v; prepare gives %s", ids, prep.Code) + } +} + +func TestAggregationModelCatalogKeepsNamespacedEnabledMember(t *testing.T) { + member := accounts.AggregationMember{Provider: "command", Model: "alpha/shared"} + a := syntheticGroupApp([]accounts.Aggregation{{ID: "logical", Enabled: true, Members: []accounts.AggregationMember{member}}}, true, executor.Item{ID: "allowed", Provider: "command", Runtime: "in_process", Models: []string{"alpha/shared"}, ModelsRestricted: true, EnabledModels: []string{"alpha/shared"}}) + identity := auth.Identity{AllowedProviders: []string{"command"}} + prepared, err := syntheticPrepare(t, a, identity, "logical") + if err != nil || !a.Pool.HasAggregateRoute(prepared.Route.AggregatePlan, executor.RouteQuery{AllowedProviders: identity.AllowedProviders}) { + t.Fatalf("expected usable route: %v", err) + } + ids := syntheticListedIDs(t, a, identity, []map[string]any{{"id": "alpha/shared", "provider": "command"}}) + if !slices.Contains(ids, "logical") { + t.Fatalf("usable named group missing with full-ID allowlist: %v", ids) + } +} + +func TestAggregationModelCatalogDoesNotBorrowUnallowedMergedRegion(t *testing.T) { + member := accounts.AggregationMember{Provider: "workbuddy", Region: "cn", Model: "shared"} + a := syntheticGroupApp([]accounts.Aggregation{{ID: "logical", Enabled: true, Members: []accounts.AggregationMember{member}}}, true, + executor.Item{ID: "cn", Provider: "workbuddy", Region: "cn", Runtime: "in_process", Models: []string{"shared"}}, + executor.Item{ID: "global", Provider: "workbuddy", Region: "global", Runtime: "in_process", Models: []string{"shared"}}) + rows := []map[string]any{{"id": "shared", "provider": "workbuddy", "regions": []string{"cn", "global"}}} + for _, aggregationKey := range []bool{false, true} { + for _, region := range []string{"cn", "global"} { + identity := auth.Identity{AllowedProviders: []string{"workbuddy:" + region}, ModelAggregation: aggregationKey} + want := region == "cn" + prepared, err := syntheticPrepare(t, a, identity, "logical") + if err != nil || a.Pool.HasAggregateRoute(prepared.Route.AggregatePlan, executor.RouteQuery{AllowedProviders: identity.AllowedProviders}) != want { + t.Fatalf("key=%+v: expected route=%v, prepare err=%v", identity, want, err) + } + ids := syntheticListedIDs(t, a, identity, rows) + if slices.Contains(ids, "logical") != want { + t.Fatalf("key=%+v: listed %v, want logical=%v", identity, ids, want) + } + } + } +} + +func TestAggregationModelCatalogPrefixesForeignNamespaceWithGlobalPoolOff(t *testing.T) { + a := syntheticGroupApp(nil, false, executor.Item{ID: "command", Provider: "command", Runtime: "in_process", Models: []string{"alpha/shared"}}) + identity := auth.Identity{AllowedProviders: []string{"command"}} + ids := syntheticListedIDs(t, a, identity, []map[string]any{{"id": "alpha/shared", "provider": "command"}}) + if !slices.Equal(ids, []string{"command/alpha/shared"}) { + t.Fatalf("want provider-prefixed full name, got %v", ids) + } + if _, err := syntheticPrepare(t, a, identity, ids[0]); err != nil { + t.Fatalf("global pool off advertised rejected ID %q: %v", ids[0], err) + } +} + +func TestAggregationModelCatalogDoesNotBorrowDifferentAccountForPin(t *testing.T) { + member := accounts.AggregationMember{Provider: "workbuddy", AccountID: "cn-only", Model: "shared"} + a := syntheticGroupApp([]accounts.Aggregation{{ID: "logical", Enabled: true, Members: []accounts.AggregationMember{member}}}, true, + executor.Item{ID: "cn-only", Provider: "workbuddy", Region: "cn", Runtime: "in_process", Models: []string{"shared"}}, + executor.Item{ID: "global", Provider: "workbuddy", Region: "global", Runtime: "in_process", Models: []string{"shared"}}) + identity := auth.Identity{AllowedProviders: []string{"workbuddy:global"}, ModelAggregation: true} + prepared, err := syntheticPrepare(t, a, identity, "logical") + if err != nil || a.Pool.HasAggregateRoute(prepared.Route.AggregatePlan, executor.RouteQuery{AllowedProviders: identity.AllowedProviders}) { + t.Fatalf("expected no granted pinned route: %v", err) + } + ids := syntheticListedIDs(t, a, identity, []map[string]any{{"id": "shared", "provider": "workbuddy", "regions": []string{"global"}}}) + if slices.Contains(ids, "logical") { + t.Fatalf("even a global-only row advertises a group pinned to an ungranted cn account: %v", ids) + } +} + +func TestAggregationModelCatalogListsValidMemberAliasForAggregationKey(t *testing.T) { + const childID = "team/child" + member := accounts.AggregationMember{Provider: "workbuddy", Region: "cn", Model: "member-alias"} + a := syntheticGroupApp([]accounts.Aggregation{ + {ID: "team/root", Enabled: true, Document: `{"steps":[{"kind":"group","aggregation_id":"team/child"}]}`}, + {ID: childID, Enabled: true, Members: []accounts.AggregationMember{member}}, + }, true, executor.Item{ID: "cn", Provider: "workbuddy", Region: "cn", Runtime: "in_process", Models: []string{"real"}, ModelAliases: map[string]string{"member-alias": "real"}}) + identity := auth.Identity{AllowedProviders: []string{"workbuddy:cn"}, ModelAggregation: true} + prepared, err := syntheticPrepare(t, a, identity, "team/root") + if err != nil || !a.Pool.HasAggregateRoute(prepared.Route.AggregatePlan, executor.RouteQuery{AllowedProviders: identity.AllowedProviders}) { + t.Fatalf("expected available nested member alias: %v", err) + } + ids := syntheticListedIDs(t, a, identity, []map[string]any{{"id": "real", "provider": "workbuddy", "regions": []string{"cn"}}}) + if !slices.Contains(ids, "team/root") { + t.Fatalf("routable named group based on a member alias is not advertised: %v", ids) + } +} diff --git a/internal/app/aggregation_models.go b/internal/app/aggregation_models.go index b38da21bb..f4e0278e4 100644 --- a/internal/app/aggregation_models.go +++ b/internal/app/aggregation_models.go @@ -3,7 +3,6 @@ package app import ( "context" "net/http" - "sort" "github.com/caigee-cmd/cli2api/internal/control" ) @@ -21,37 +20,9 @@ func (a *App) aggregationKeyModels(ctx context.Context, r *http.Request, models if !identity.ModelAggregation { return models } - aliases := control.AggregateModelEntries(models, identity, a.accountModelAllows()) var lister control.AggregationLister - if a.Control != nil { + if a.Control != nil && a.Control.Aggregations != nil { lister = a.Control.Aggregations } - merged := control.MergeAggregationModels(ctx, lister, models) - out := make([]map[string]any, 0, len(merged)+len(aliases)) - seen := make(map[string]bool, len(merged)+len(aliases)) - for _, model := range merged { - if provider, _ := model["provider"].(string); provider != "aggregation" { - continue - } - id, _ := model["id"].(string) - if id == "" || seen[id] { - continue - } - seen[id] = true - out = append(out, model) - } - for _, model := range aliases { - id, _ := model["id"].(string) - if id == "" || seen[id] { - continue - } - seen[id] = true - out = append(out, model) - } - sort.SliceStable(out, func(i, j int) bool { - left, _ := out[i]["id"].(string) - right, _ := out[j]["id"].(string) - return left < right - }) - return out + return control.AggregationKeyModelEntries(ctx, lister, models, identity, a.accountModelAllows()) } diff --git a/internal/app/gateway.go b/internal/app/gateway.go index cfb361b3f..f45585554 100644 --- a/internal/app/gateway.go +++ b/internal/app/gateway.go @@ -4,6 +4,7 @@ import ( "context" "net/http" + "github.com/caigee-cmd/cli2api/internal/auth" "github.com/caigee-cmd/cli2api/internal/control" apigateway "github.com/caigee-cmd/cli2api/internal/gateway" ) @@ -30,10 +31,11 @@ func (a *App) newGateway() *apigateway.Handler { return a.fetchDisplayModels(refresh, accountID, control.CatalogModeMerge) }, MergeAggregationModels: func(ctx context.Context, models []map[string]any) []map[string]any { - if a.Control == nil { + if a.Control == nil || a.Control.Aggregations == nil { return models } - return control.MergeAggregationModels(ctx, a.Control.Aggregations, models) + identity, _ := auth.IdentityFrom(ctx) + return control.MergeAggregationModelsForIdentity(ctx, a.Control.Aggregations, models, identity, a.accountModelAllows()) }, AggregationKeyModels: a.aggregationKeyModels, CatalogStatus: func() map[string]any { @@ -56,7 +58,7 @@ func (a *App) newGateway() *apigateway.Handler { } if a.Manager != nil { h.Catalogs = a.Manager - h.AfterAccountUse = a.Manager.RefreshFEFOQuotaAfterUse + h.AfterAccountUse = a.Manager.RefreshRouteQuotaAfterUse } if a.Recorder != nil { h.Logs = a.Recorder diff --git a/internal/app/model_catalog.go b/internal/app/model_catalog.go index 738ff64e5..bdb0fc8ba 100644 --- a/internal/app/model_catalog.go +++ b/internal/app/model_catalog.go @@ -1,9 +1,11 @@ package app import ( + "net/http" + "github.com/caigee-cmd/cli2api/internal/control" "github.com/caigee-cmd/cli2api/internal/endpoint" - "net/http" + "github.com/caigee-cmd/cli2api/internal/executor" ) func (a *App) RequestedAccount(r *http.Request) string { return endpoint.RequestedAccount(r) } @@ -17,9 +19,6 @@ func (a *App) filterModelsForIdentity(r *http.Request, models []map[string]any) } models = control.FilterModelsByAccountAllow(models, identity, allow) models = control.FilterModelsForIdentity(identity, models) - if !identity.ModelAggregation { - models = control.AggregateModelEntries(models, identity, allow) - } // Aggregation keys get their final provider-neutral list from // aggregationKeyModels after this filter: configured logical models first, // then account aliases. Returning the filtered catalog here keeps every @@ -36,17 +35,16 @@ func (a *App) accountModelAllows() []control.AccountModelAllow { return nil } items := a.Pool.Items() - if len(items) == 0 { - return nil - } out := make([]control.AccountModelAllow, 0, len(items)) for _, item := range items { out = append(out, control.AccountModelAllow{ + AccountID: item.ID, Provider: item.Provider, Region: item.Region, ModelsRestricted: item.ModelsRestricted, EnabledModels: item.EnabledModels, Aliases: item.ModelAliases, + CanRouteModel: func(model string) bool { return executor.ItemCouldServeModel(item, model) }, }) } return out diff --git a/internal/console/aggregation_preview_test.go b/internal/console/aggregation_preview_test.go new file mode 100644 index 000000000..16e3e6f7a --- /dev/null +++ b/internal/console/aggregation_preview_test.go @@ -0,0 +1,94 @@ +package console + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/control" + "github.com/caigee-cmd/cli2api/internal/executor" +) + +func TestHandleAggregationPreviewReturnsOneCurrentCandidate(t *testing.T) { + const nestedDoc = `{"version":1,"steps":[{"id":"z","kind":"member","provider":"qoder","model":"nested-z"},{"id":"a","kind":"member","provider":"qoder","model":"nested-a"}]}` + store := &aggregationPreviewStore{ + rows: map[string]accounts.Aggregation{ + "inner": {ID: "inner", Enabled: true, Strategy: accounts.AggregationPriority, Document: nestedDoc}, + }, + } + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: "z-account", Provider: "qoder", Models: []string{"nested-z"}}) + pool.Upsert(executor.Item{ID: "a-account", Provider: "qoder", Models: []string{"nested-a"}}) + pool.Upsert(executor.Item{ID: "fallback-account", Provider: "workbuddy", Models: []string{"fallback"}}) + h := &Handler{ + Control: &control.Services{Aggregations: control.NewAggregations(store)}, + Executor: &executor.ChatExecutor{Pool: pool}, + Pool: pool, + } + body := `{"id":"outer","strategy":"priority","document":{"version":1,"steps":[{"id":"group","kind":"group","aggregation_id":"inner"},{"id":"fallback","kind":"member","provider":"workbuddy","model":"fallback"}]},"message":""}` + req := httptest.NewRequest(http.MethodPost, "/api/aggregations/preview", strings.NewReader(body)) + rec := httptest.NewRecorder() + h.HandleAggregationPreview(rec, req) + if rec.Code != http.StatusOK { + t.Fatalf("status=%d body=%s", rec.Code, rec.Body.String()) + } + var response struct { + Path string `json:"path"` + Attempts []executor.AggregatePreviewCandidate `json:"attempts"` + } + if err := json.Unmarshal(rec.Body.Bytes(), &response); err != nil { + t.Fatal(err) + } + if len(response.Attempts) != 1 { + t.Fatalf("attempts=%+v, want only one current candidate", response.Attempts) + } + got := response.Attempts[0] + if got.Provider != "qoder" || got.Model != "nested-z" || got.Status != "candidate" { + t.Fatalf("candidate=%+v, want first nested priority winner", got) + } + if strings.Contains(rec.Body.String(), "z-account") { + t.Fatalf("preview must not expose account ID: %s", rec.Body.String()) + } +} + +type aggregationPreviewStore struct { + rows map[string]accounts.Aggregation +} + +func (s *aggregationPreviewStore) InsertAggregation(_ context.Context, agg accounts.Aggregation) (accounts.Aggregation, error) { + s.rows[agg.ID] = agg + return agg, nil +} + +func (s *aggregationPreviewStore) SaveAggregation(_ context.Context, agg accounts.Aggregation) (accounts.Aggregation, error) { + s.rows[agg.ID] = agg + return agg, nil +} + +func (s *aggregationPreviewStore) ListAggregations(context.Context) ([]accounts.Aggregation, error) { + rows := make([]accounts.Aggregation, 0, len(s.rows)) + for _, agg := range s.rows { + rows = append(rows, agg) + } + return rows, nil +} + +func (s *aggregationPreviewStore) GetAggregation(_ context.Context, id string) (accounts.Aggregation, error) { + agg, ok := s.rows[id] + if !ok { + return accounts.Aggregation{}, accounts.ErrAggregationNotFound + } + return agg, nil +} + +func (s *aggregationPreviewStore) DeleteAggregation(_ context.Context, id string) error { + if _, ok := s.rows[id]; !ok { + return accounts.ErrAggregationNotFound + } + delete(s.rows, id) + return nil +} diff --git a/internal/console/aggregations.go b/internal/console/aggregations.go index 6a5ca7842..c25652e34 100644 --- a/internal/console/aggregations.go +++ b/internal/console/aggregations.go @@ -4,6 +4,7 @@ import ( "encoding/json" "errors" "net/http" + "net/url" "strings" "github.com/caigee-cmd/cli2api/internal/accounts" @@ -71,25 +72,25 @@ func (h *Handler) HandleAggregationPreview(w http.ResponseWriter, r *http.Reques } catalog = loaded } - labels := map[string]string{} - if h.Executor != nil && strings.TrimSpace(input.Message) != "" { - targets, err := accounts.ClassifierTargets(agg.ID, agg.Document, catalog) - if err != nil { - writeErr(w, http.StatusBadRequest, "invalid_request", err.Error()) - return - } - labels = h.Executor.ClassifyIntent(r.Context(), targets, input.Message) + var plan *executor.AggregatePlan + var path string + var err error + if h.Executor != nil { + plan, path, err = h.Executor.CompileAggregationPreview(r.Context(), agg, catalog, input.Message) + } else { + plan, path, err = executor.CompileAggregatePreview(agg, catalog, input.Message, nil) } - compiled, seats, path, err := accounts.CompilePipeline(agg, catalog, input.Message, labels, nil) if err != nil { writeErr(w, http.StatusBadRequest, "invalid_request", err.Error()) return } - plan := executor.NewAggregatePlan(compiled) - plan.Seats = seats + attempts := make([]executor.AggregatePreviewCandidate, 0, 1) + if candidate, ok := h.Pool.PreviewAggregate(plan, executor.RouteQuery{PublicModel: plan.ID}); ok { + attempts = append(attempts, candidate) + } writeJSON(w, http.StatusOK, map[string]any{ "path": path, - "attempts": executor.ExplainSeats(h.Pool, plan), + "attempts": attempts, }) } @@ -154,7 +155,11 @@ func (h *Handler) HandleAggregations(w http.ResponseWriter, r *http.Request) { } func (h *Handler) HandleAggregationByID(w http.ResponseWriter, r *http.Request) { - id := strings.Trim(strings.TrimPrefix(r.URL.Path, "/api/aggregations/"), "/") + id, err := aggregationIDFromRequestPath(r) + if err != nil { + writeErr(w, http.StatusBadRequest, "invalid_request", "invalid aggregation id path") + return + } if id == "" { writeErr(w, http.StatusNotFound, "aggregation_not_found", "aggregation id required") return @@ -222,3 +227,24 @@ func (h *Handler) HandleAggregationByID(w http.ResponseWriter, r *http.Request) writeErr(w, http.StatusMethodNotAllowed, "method_not_allowed", "GET, PATCH, or DELETE only") } } + +// aggregationIDFromRequestPath preserves encoded slashes in IDs. Historically, +// unencoded leading/trailing slashes around the path suffix were trimmed, so keep +// that convenience while requiring encodeURIComponent-style escaping when a +// stored ID itself begins or ends with '/'. +func aggregationIDFromRequestPath(r *http.Request) (string, error) { + const prefix = "/api/aggregations/" + if r == nil || r.URL == nil { + return "", errors.New("aggregation request path is missing") + } + escapedPath := r.URL.EscapedPath() + if !strings.HasPrefix(escapedPath, prefix) { + return "", errors.New("aggregation request path has an invalid prefix") + } + rawID := strings.Trim(strings.TrimPrefix(escapedPath, prefix), "/") + id, err := url.PathUnescape(rawID) + if err != nil { + return "", err + } + return id, nil +} diff --git a/internal/console/aggregations_test.go b/internal/console/aggregations_test.go new file mode 100644 index 000000000..768c4c2cb --- /dev/null +++ b/internal/console/aggregations_test.go @@ -0,0 +1,55 @@ +package console + +import ( + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/control" +) + +func TestHandleAggregationByIDPreservesEncodedBoundarySlashes(t *testing.T) { + const id = "/legacy/review/" + // Simulate a pre-existing row. The current schema has no ID CHECK constraint, + // even though current create validation rejects empty path segments. + store := &aggregationPreviewStore{rows: map[string]accounts.Aggregation{id: {ID: id, Name: "legacy"}}} + h := &Handler{Control: &control.Services{Aggregations: control.NewAggregations(store)}} + encodedPath := "/api/aggregations/%2Flegacy%2Freview%2F" + + get := httptest.NewRecorder() + h.HandleAggregationByID(get, httptest.NewRequest(http.MethodGet, encodedPath, nil)) + if get.Code != http.StatusOK || !strings.Contains(get.Body.String(), id) { + t.Fatalf("GET status=%d body=%s", get.Code, get.Body.String()) + } + + patch := httptest.NewRecorder() + h.HandleAggregationByID(patch, httptest.NewRequest(http.MethodPatch, encodedPath, strings.NewReader("{\"name\":\"patched\"}"))) + if patch.Code != http.StatusOK { + t.Fatalf("PATCH status=%d body=%s", patch.Code, patch.Body.String()) + } + if got := store.rows[id].Name; got != "patched" { + t.Fatalf("updated aggregation name=%q, want patched", got) + } + + del := httptest.NewRecorder() + h.HandleAggregationByID(del, httptest.NewRequest(http.MethodDelete, encodedPath, nil)) + if del.Code != http.StatusNoContent { + t.Fatalf("DELETE status=%d body=%s", del.Code, del.Body.String()) + } + if _, ok := store.rows[id]; ok { + t.Fatal("encoded boundary-slash ID was not deleted") + } +} + +func TestHandleAggregationByIDKeepsUnencodedTrailingSlashConvenience(t *testing.T) { + const id = "team/review" + store := &aggregationPreviewStore{rows: map[string]accounts.Aggregation{id: {ID: id, Name: "legacy"}}} + h := &Handler{Control: &control.Services{Aggregations: control.NewAggregations(store)}} + rec := httptest.NewRecorder() + h.HandleAggregationByID(rec, httptest.NewRequest(http.MethodGet, "/api/aggregations/team/review/", nil)) + if rec.Code != http.StatusOK || !strings.Contains(rec.Body.String(), id) { + t.Fatalf("status=%d body=%s", rec.Code, rec.Body.String()) + } +} diff --git a/internal/control/aggregation.go b/internal/control/aggregation.go index 526f1d1a9..04ad8a038 100644 --- a/internal/control/aggregation.go +++ b/internal/control/aggregation.go @@ -193,11 +193,16 @@ func (a *Aggregations) Catalog(ctx context.Context) (map[string]accounts.Aggrega if err != nil { return nil, err } + return snapshot.catalog(), nil +} + +// catalog copies the map; the aggregation values remain read-only. +func (snapshot aggregationSnapshot) catalog() map[string]accounts.Aggregation { out := make(map[string]accounts.Aggregation, len(snapshot)) for id, agg := range snapshot { out[id] = agg } - return out, nil + return out } func (a *Aggregations) validateMembers(ctx context.Context, members []accounts.AggregationMember) error { @@ -250,12 +255,33 @@ func (a *Aggregations) resolveSnapshot(ctx context.Context) (aggregationSnapshot // filtered by the caller's allowed providers. The executor calls this once per // request before taking the Pool lock, and the result is read-only. The hot // path is served from an in-memory snapshot, so normal requests add no SQL. +// An enabled aggregation still resolves when filtering leaves no members; +// only a missing or disabled name can be treated as an ordinary model. func (a *Aggregations) Resolve(ctx context.Context, id string, allowedProviders map[string]bool) (accounts.Aggregation, error) { snapshot, err := a.resolveSnapshot(ctx) if err != nil { return accounts.Aggregation{}, err } - agg, ok := snapshot[id] + return snapshot.resolve(id, allowedProviders) +} + +// ResolveWithCatalog resolves a root and its nested group catalog from the +// same snapshot even if a concurrent write invalidates the cache. Flat roots +// need no catalog; pipeline compilation filters members of the copied catalog. +func (a *Aggregations) ResolveWithCatalog(ctx context.Context, id string, allowedProviders map[string]bool) (accounts.Aggregation, map[string]accounts.Aggregation, error) { + snapshot, err := a.resolveSnapshot(ctx) + if err != nil { + return accounts.Aggregation{}, nil, err + } + agg, err := snapshot.resolve(id, allowedProviders) + if err != nil || strings.TrimSpace(agg.Document) == "" { + return agg, nil, err + } + return agg, snapshot.catalog(), nil +} + +func (snapshot aggregationSnapshot) resolve(id string, allowedProviders map[string]bool) (accounts.Aggregation, error) { + agg, ok := snapshot[strings.ToLower(strings.TrimSpace(id))] if !ok || !agg.Enabled { return accounts.Aggregation{}, ErrAggregationNotFound } @@ -273,12 +299,6 @@ func (a *Aggregations) Resolve(ctx context.Context, id string, allowedProviders } members = append(members, member) } - // A document-only row has no persisted members. Keep it so the compiler - // can build seats from the document. An empty member list with no - // document is still not found. - if len(members) == 0 && strings.TrimSpace(agg.Document) == "" { - return accounts.Aggregation{}, ErrAggregationNotFound - } // Stable priority order; DoS-safe cap even if a stale row has more members. if len(members) > accounts.MaxAggregationMembers { members = members[:accounts.MaxAggregationMembers] diff --git a/internal/control/aggregation_catalog.go b/internal/control/aggregation_catalog.go index e2803f52c..eb7bd97d5 100644 --- a/internal/control/aggregation_catalog.go +++ b/internal/control/aggregation_catalog.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/auth" "github.com/caigee-cmd/cli2api/internal/providers" ) @@ -13,6 +14,32 @@ type AggregationLister interface { List(ctx context.Context) ([]accounts.Aggregation, error) } +// aggregateCatalogSnapshot uses the same copy-on-write snapshot as dispatch +// when backed by the control facade. Lightweight listers may supply one list. +func aggregateCatalogSnapshot(ctx context.Context, lister AggregationLister) (map[string]accounts.Aggregation, error) { + if lister == nil { + return nil, nil + } + if source, ok := lister.(interface { + Catalog(context.Context) (map[string]accounts.Aggregation, error) + }); ok { + return source.Catalog(ctx) + } + aggs, err := lister.List(ctx) + if err != nil { + return nil, err + } + catalog := make(map[string]accounts.Aggregation, len(aggs)) + for _, agg := range aggs { + catalog[logicalCatalogID(agg.ID)] = agg + } + return catalog, nil +} + +func logicalCatalogID(id string) string { + return strings.ToLower(strings.TrimSpace(id)) +} + // aggregationCatalogMember is one configured member resolved to the catalog // entry that actually serves it. Provider and region are honored so a member // never borrows another provider's copy of the same model name. @@ -65,51 +92,116 @@ var inheritedAggregationFields = []string{ // The catalog slices passed in/out are plain value maps, so this never mutates // the shared catalog cache. func MergeAggregationModels(ctx context.Context, lister AggregationLister, models []map[string]any) []map[string]any { - if lister == nil || len(models) == 0 { + return MergeAggregationModelsForIdentity(ctx, lister, models, auth.Identity{}, nil) +} + +// MergeAggregationModelsForIdentity also checks live account policy when a +// pool snapshot is supplied. A nil pool means the caller has no live view. +func MergeAggregationModelsForIdentity(ctx context.Context, lister AggregationLister, models []map[string]any, identity auth.Identity, pool []AccountModelAllow) []map[string]any { + if len(models) == 0 { return models } - aggs, err := lister.List(ctx) - if err != nil || len(aggs) == 0 { + catalog, err := aggregateCatalogSnapshot(ctx, lister) + if err != nil || len(catalog) == 0 { return models } + view := buildAggregationCatalog(models, catalog, identity, pool) + out := make([]map[string]any, 0, len(models)+len(view.entries)) + for _, model := range models { + id, _ := model["id"].(string) + key := logicalCatalogID(id) + if !view.shadowed[key] && !view.members[key] { + out = append(out, model) + } + } + out = append(out, view.entries...) + sortAggregationCatalog(out) + return out +} + +// AggregationKeyModelEntries publishes logical entries and unshadowed public +// aliases. Both group visibility and name ownership use the same snapshot, +// including enabled groups that a key cannot currently route to. +func AggregationKeyModelEntries(ctx context.Context, lister AggregationLister, models []map[string]any, identity auth.Identity, pool []AccountModelAllow) []map[string]any { + catalog, err := aggregateCatalogSnapshot(ctx, lister) + if err != nil { + // Without the logical namespace, an alias cannot be safely advertised. + return []map[string]any{} + } + view := buildAggregationCatalog(models, catalog, identity, pool) + out := view.entries + for _, alias := range AggregateModelEntries(models, identity, pool) { + id, _ := alias["id"].(string) + if !view.shadowed[logicalCatalogID(id)] { + out = append(out, alias) + } + } + sortAggregationCatalog(out) + return out +} +type aggregationCatalogView struct { + entries []map[string]any + shadowed map[string]bool + members map[string]bool +} + +func buildAggregationCatalog(models []map[string]any, catalog map[string]accounts.Aggregation, identity auth.Identity, pool []AccountModelAllow) aggregationCatalogView { + view := aggregationCatalogView{ + entries: make([]map[string]any, 0, len(catalog)), + shadowed: make(map[string]bool, len(catalog)), + members: make(map[string]bool), + } + if len(catalog) == 0 { + return view + } index := aggregationCatalogIndex(models) - hidden := map[string]bool{} - entries := make([]map[string]any, 0, len(aggs)) - for _, agg := range aggs { - if !agg.Enabled || len(agg.Members) == 0 { + scope := aggregationCatalogScope{identity: identity, aggregationOnly: identity.ModelAggregation && accounts.IsAggregationOnly(identity.AllowedProviders)} + if pool != nil { + scope.byProvider = make(map[string][]AccountModelAllow) + for _, account := range pool { + provider := accounts.NormalizeProviderFamily(account.Provider) + if scope.allows(provider, account.Region) { + scope.byProvider[provider] = append(scope.byProvider[provider], account) + } + } + } + for _, agg := range catalog { + if !agg.Enabled || logicalCatalogID(agg.ID) == "" { + continue + } + if provider, _, _ := accounts.SplitProviderModelPrefix(agg.ID); provider != "" { + // A legacy name using a reserved prefix routes directly, not here. + continue + } + // The runtime looks up the enabled logical ID before raw models. + // Avoid listing a duplicate or falsely advertising a shadowed model. + view.shadowed[logicalCatalogID(agg.ID)] = true + current, err := accounts.PipelineCatalogMembers(agg, catalog) + if err != nil { continue } - members := resolveAggregationCatalogMembers(agg, index) + agg.Members = current + members := scope.resolveMembers(agg, index) if len(members) == 0 { // Every member is filtered out by the caller's provider policy. Do // not advertise a logical ID that cannot route to any real model. continue } for _, member := range members { - hidden[member.id] = true + view.members[logicalCatalogID(member.id)] = true } - entries = append(entries, buildAggregationEntry(agg, members)) - } - if len(entries) == 0 && len(hidden) == 0 { - return models + view.entries = append(view.entries, buildAggregationEntry(agg, members)) } + return view +} - out := make([]map[string]any, 0, len(models)-len(hidden)+len(entries)) - for _, model := range models { - id, _ := model["id"].(string) - if hidden[id] { - continue - } - out = append(out, model) - } - out = append(out, entries...) - sort.SliceStable(out, func(i, j int) bool { - left, _ := out[i]["id"].(string) - right, _ := out[j]["id"].(string) +func sortAggregationCatalog(models []map[string]any) { + sort.SliceStable(models, func(i, j int) bool { + left, _ := models[i]["id"].(string) + right, _ := models[j]["id"].(string) return left < right }) - return out } // aggregationCatalogIndex groups catalog rows by (provider family, canonical @@ -122,7 +214,8 @@ func aggregationCatalogIndex(models []map[string]any) map[string][]map[string]an if strings.TrimSpace(id) == "" { continue } - key := aggregationCatalogKey(modelEntryProvider(model), modelAllowKey(id)) + provider := modelEntryProvider(model) + key := aggregationCatalogKey(provider, id) if key == "" { continue } @@ -131,34 +224,85 @@ func aggregationCatalogIndex(models []map[string]any) map[string][]map[string]an return index } -func aggregationCatalogKey(provider, modelKey string) string { - provider = accounts.NormalizeProviderFamily(provider) - if provider == "" || modelKey == "" { +func aggregationCatalogKey(provider, model string) string { + if model = modelAllowKey(provider, model); model == "" { return "" } - return provider + "\x00" + modelKey + return provider + "\x00" + model +} + +type aggregationCatalogScope struct { + identity auth.Identity + aggregationOnly bool + byProvider map[string][]AccountModelAllow } -func resolveAggregationCatalogMembers(agg accounts.Aggregation, index map[string][]map[string]any) []aggregationCatalogMember { +func (s aggregationCatalogScope) allows(provider, region string) bool { + return s.aggregationOnly || s.identity.AllowsProviderRegion(provider, region) +} + +func (s aggregationCatalogScope) resolveMembers(agg accounts.Aggregation, index map[string][]map[string]any) []aggregationCatalogMember { resolved := make([]aggregationCatalogMember, 0, len(agg.Members)) for _, member := range agg.Members { - key := aggregationCatalogKey(member.Provider, modelAllowKey(member.Model)) - if key == "" { + provider := accounts.NormalizeProviderFamily(member.Provider) + model := modelAllowKey(provider, member.Model) + if model == "" || (!s.aggregationOnly && !s.identity.AllowsProvider(provider)) { continue } - for _, candidate := range index[key] { - if member.Region != "" && !accountServesRegion(member.Region, EntryModelRegions(candidate)) { - continue + if s.byProvider == nil { + for _, candidate := range index[provider+"\x00"+model] { + if member.Region != "" { + if !s.allows(provider, member.Region) || !accountServesRegion(member.Region, catalogEntryRegions(candidate, provider)) { + continue + } + } else if !s.aggregationOnly && !identityAllowsAnyModelRegion(s.identity, candidate) { + continue + } + id, _ := candidate["id"].(string) + resolved = append(resolved, aggregationCatalogMember{id: id, entry: candidate}) } - id, _ := candidate["id"].(string) - if strings.TrimSpace(id) == "" { + continue + } + // Resolve the member, its alias target and the row through the same + // account. A provider-wide catalog row cannot authorize a different + // region or account, and a display alias cannot prove model support. + targets := make(map[string][]string) + for _, account := range s.byProvider[provider] { + region := accounts.NormalizeRegion(account.Region) + if (member.AccountID != "" && member.AccountID != account.AccountID) || + (member.Region != "" && accounts.NormalizeRegion(member.Region) != region) || + !accountServesModel(account, model) || + (account.CanRouteModel != nil && !account.CanRouteModel(member.Model)) { continue } - // A region-wide member can fail over to the same model in several - // regions. Keep every candidate so the advertised capability - // intersection covers all of them. IDs may repeat across those - // rows; the hidden set below deduplicates them. - resolved = append(resolved, aggregationCatalogMember{id: id, entry: candidate}) + target := model + if alias := account.Aliases[model]; alias != "" { + target = accounts.CanonicalModelID(alias) + } + targets[target] = append(targets[target], region) + } + keys := make([]string, 0, len(targets)) + for target := range targets { + keys = append(keys, target) + } + sort.Strings(keys) + for _, target := range keys { + for _, candidate := range index[provider+"\x00"+target] { + if alias, _ := candidate["alias_of"].(string); alias != "" { + continue + } + for _, region := range targets[target] { + if !accountServesRegion(region, catalogEntryRegions(candidate, provider)) { + continue + } + id, _ := candidate["id"].(string) + if target != model { + id = model // hide the configured alias, not its underlying row + } + resolved = append(resolved, aggregationCatalogMember{id: id, entry: candidate}) + break + } + } } } return resolved diff --git a/internal/control/aggregation_catalog_test.go b/internal/control/aggregation_catalog_test.go index 7c0093484..cd61e5437 100644 --- a/internal/control/aggregation_catalog_test.go +++ b/internal/control/aggregation_catalog_test.go @@ -2,9 +2,11 @@ package control import ( "context" + "errors" "testing" "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/auth" ) type aggregationCatalogLister []accounts.Aggregation @@ -13,6 +15,91 @@ func (l aggregationCatalogLister) List(context.Context) ([]accounts.Aggregation, return l, nil } +type aggregationCatalogSnapshotStub struct { + loads int + err error +} + +func (*aggregationCatalogSnapshotStub) List(context.Context) ([]accounts.Aggregation, error) { + panic("the live catalog must use its routing snapshot") +} + +func (s *aggregationCatalogSnapshotStub) Catalog(context.Context) (map[string]accounts.Aggregation, error) { + s.loads++ + return map[string]accounts.Aggregation{ + "active": {ID: "active", Enabled: true, Members: []accounts.AggregationMember{{Provider: "qoder", Model: "target"}}}, + "shadowed": {ID: "shadowed", Enabled: true, Members: []accounts.AggregationMember{{Provider: "workbuddy", Model: "target"}}}, + "disabled": {ID: "disabled"}, + }, s.err +} + +func TestAggregationKeyModelEntriesUsesOneSnapshotForShadowing(t *testing.T) { + source := &aggregationCatalogSnapshotStub{} + models := []map[string]any{{"id": "target", "provider": "qoder"}} + pool := []AccountModelAllow{{Provider: "qoder", Aliases: map[string]string{"shadowed": "target", "disabled": "target"}}} + identity := auth.Identity{ModelAggregation: true, AllowedProviders: []string{"qoder"}} + got := AggregationKeyModelEntries(t.Context(), source, models, identity, pool) + if source.loads != 1 || len(got) != 2 || got[0]["id"] != "active" || got[1]["id"] != "disabled" { + t.Fatalf("loads=%d, list=%#v: want active group and disabled group’s unshadowed alias", source.loads, got) + } + source.err = errors.New("snapshot unavailable") + if got := AggregationKeyModelEntries(t.Context(), source, models, identity, pool); len(got) != 0 { + t.Fatalf("advertised aliases without their logical namespace: %#v", got) + } +} + +func TestMergeAggregationModelsUsesCurrentNestedMembers(t *testing.T) { + old := accounts.AggregationMember{Provider: "qoder", Model: "old-model"} + list := aggregationCatalogLister{ + {ID: "parent", Enabled: true, Document: `{"steps":[{"kind":"group","aggregation_id":"child"}]}`, Members: []accounts.AggregationMember{old}}, + {ID: "child", Enabled: true, Members: []accounts.AggregationMember{{Provider: "qoder", Model: "new-model"}}}, + } + models := []map[string]any{ + {"id": "old-model", "provider": "qoder", "catalog_context_length": 32768}, + {"id": "new-model", "provider": "qoder", "catalog_context_length": 128000}, + {"id": "parent", "provider": "qoder"}, + } + got := MergeAggregationModels(t.Context(), list, models) + if parent := aggregationTestEntry(got, "parent"); parent == nil || parent["catalog_context_length"] != 128000 { + t.Fatalf("parent did not use live child capability: %#v", got) + } + if aggregationTestEntry(got, "old-model") == nil || len(got) != 3 { + t.Fatalf("retired leaf hidden or duplicate logical ID advertised: %#v", got) + } + list[1].Enabled = false + got = MergeAggregationModels(t.Context(), list, models[:2]) + if aggregationTestEntry(got, "parent") != nil || len(got) != 2 { + t.Fatalf("disabled child still advertised by its parent: %#v", got) + } +} + +func TestMergeAggregationModelsDoesNotBorrowAnotherNamespace(t *testing.T) { + list := aggregationCatalogLister{{ID: "logical", Enabled: true, Members: []accounts.AggregationMember{{Provider: "command", Model: "alpha/shared"}}}} + models := []map[string]any{ + {"id": "beta/shared", "provider": "command", "catalog_context_length": 32768}, + {"id": "command/alpha/shared", "provider": "command", "catalog_context_length": 128000}, + } + if got := MergeAggregationModels(t.Context(), list, models[:1]); len(got) != 1 || aggregationTestEntry(got, "logical") != nil { + t.Fatalf("advertised alpha using beta model: %#v", got) + } + got := MergeAggregationModels(t.Context(), list, models) + if entry := aggregationTestEntry(got, "logical"); entry == nil || entry["catalog_context_length"] != 128000 || aggregationTestEntry(got, "beta/shared") == nil { + t.Fatalf("did not match exact namespace: %#v", got) + } +} + +func TestMergeAggregationModelsKeepsUnrelatedModelsWhenGroupsAreMissingTargets(t *testing.T) { + models := []map[string]any{{"id": "usable-model", "provider": "qoder"}} + list := aggregationCatalogLister{ + {ID: "logical-a", Enabled: true, Members: []accounts.AggregationMember{{Provider: "qoder", Model: "missing-a"}}}, + {ID: "logical-b", Enabled: true, Members: []accounts.AggregationMember{{Provider: "qoder", Model: "missing-b"}}}, + } + got := MergeAggregationModels(t.Context(), list, models) + if len(got) != 1 || got[0]["id"] != "usable-model" { + t.Fatalf("unrelated catalog model lost: %#v", got) + } +} + func TestMergeAggregationModelsOmitsAggregationWithNoVisibleMembers(t *testing.T) { models := []map[string]any{{"id": "allowed-model", "provider": "qoder"}} list := aggregationCatalogLister{{ diff --git a/internal/control/aggregation_test.go b/internal/control/aggregation_test.go index 8f304601c..6c17fde95 100644 --- a/internal/control/aggregation_test.go +++ b/internal/control/aggregation_test.go @@ -2,10 +2,16 @@ package control import ( "context" + "errors" "fmt" + "net/http" "testing" "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/auth" + "github.com/caigee-cmd/cli2api/internal/executor" + "github.com/caigee-cmd/cli2api/internal/providers" + "github.com/caigee-cmd/cli2api/internal/translate" ) func TestAggregationResolveFiltersByProviderAndOrders(t *testing.T) { @@ -57,6 +63,114 @@ func TestAggregationResolveRejectsDisabledAndUnknown(t *testing.T) { } } +func TestAggregationResolveRetainsEnabledModelAfterFilteringAllMembers(t *testing.T) { + store := &aggTestStore{agg: accounts.Aggregation{ + ID: "shared", Enabled: true, + Members: []accounts.AggregationMember{{Provider: "qoder", Model: "upstream"}}, + }} + svc := NewAggregations(store) + got, err := svc.Resolve(context.Background(), "shared", map[string]bool{"workbuddy": true}) + if err != nil || got.ID != "shared" || !got.Enabled || len(got.Members) != 0 { + t.Fatalf("resolved aggregation=%+v err=%v, want known enabled model with no members", got, err) + } + got, err = svc.Resolve(context.Background(), "shared", nil) + if err != nil || len(got.Members) != 1 { + t.Fatalf("filtered lookup mutated the snapshot: %+v err=%v", got, err) + } +} + +func TestAggregationPrepareDoesNotDispatchSameNameOrdinaryModelOnFailure(t *testing.T) { + const model = "shared" + for _, tc := range []struct { + name string + agg accounts.Aggregation + requestModel string + listErr error + wantCode string + wantStatus int + }{ + {name: "unknown allows ordinary model"}, + {name: "disabled allows ordinary model", agg: accounts.Aggregation{ID: model}}, + { + name: "unauthorized members", + agg: accounts.Aggregation{ID: model, Enabled: true, Members: []accounts.AggregationMember{ + {Provider: "qoder", Model: "upstream"}, + }}, + wantCode: "model_not_available", wantStatus: http.StatusBadRequest, + }, + { + name: "stored aggregation ID is matched canonically", requestModel: " ShArEd ", + agg: accounts.Aggregation{ID: model, Enabled: true}, + wantCode: "model_not_available", wantStatus: http.StatusBadRequest, + }, + { + name: "invalid pipeline", + agg: accounts.Aggregation{ID: model, Enabled: true, Document: `{"version":1,`}, + wantCode: "aggregation_unavailable", wantStatus: http.StatusServiceUnavailable, + }, + { + name: "pipeline without reachable members", + agg: accounts.Aggregation{ + ID: model, Enabled: true, + Document: `{"version":1,"steps":[{"id":"member","kind":"member","provider":"qoder","model":"upstream"}]}`, + }, + wantCode: "aggregation_unavailable", wantStatus: http.StatusServiceUnavailable, + }, + { + name: "backend cannot resolve name", + listErr: errors.New("aggregation snapshot failed"), + wantCode: "aggregation_unavailable", wantStatus: http.StatusServiceUnavailable, + }, + } { + t.Run(tc.name, func(t *testing.T) { + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: "ordinary", Provider: "workbuddy", Runtime: "in_process", Models: []string{model}}) + chat := &aggregationOrdinaryChat{} + ex := executor.NewChatExecutor(pool, "") + ex.Providers = providers.NewRegistry() + ex.Providers.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) + requestModel := tc.requestModel + if requestModel == "" { + requestModel = model + } + prepared, err := ex.Prepare(executor.PrepareInput{ + Request: translate.ChatRequest{Model: requestModel}, + Identity: auth.Identity{AllowedProviders: []string{"workbuddy"}}, + CrossProviderPool: true, + Aggregations: NewAggregations(&aggTestStore{agg: tc.agg, listErr: tc.listErr}), + }) + if err == nil { + _, err = ex.ChatNonStreamPrepared(prepared.Context, prepared.Request, prepared.Route) + } + if tc.wantCode == "" { + if err != nil || chat.calls != 1 { + t.Fatalf("ordinary route calls=%d err=%v, want one successful dispatch", chat.calls, err) + } + return + } + var prepareError *executor.PrepareError + if !errors.As(err, &prepareError) || prepareError.Code != tc.wantCode || prepareError.Status != tc.wantStatus || chat.calls != 0 { + t.Fatalf("ordinary route calls=%d err=%#v; want no dispatch and %s / %d", chat.calls, err, tc.wantCode, tc.wantStatus) + } + }) + } +} + +type aggregationOrdinaryChat struct { + calls int + model string +} + +func (f *aggregationOrdinaryChat) ChatNonStream(_ context.Context, _ string, req translate.ChatRequest) (providers.ChatOutcome, error) { + f.calls++ + f.model = req.Model + return providers.ChatOutcome{Content: "ordinary"}, nil +} + +func (f *aggregationOrdinaryChat) ChatStream(context.Context, string, translate.ChatRequest) (*http.Response, providers.ResolvedChat, error) { + return nil, providers.ResolvedChat{}, errors.New("unexpected streaming dispatch") +} + func TestAggregationResolveUsesCacheAndInvalidatesOnWrite(t *testing.T) { store := &aggTestStore{agg: accounts.Aggregation{ ID: "my-model", Enabled: true, Strategy: accounts.AggregationRoundRobin, @@ -84,6 +198,135 @@ func TestAggregationResolveUsesCacheAndInvalidatesOnWrite(t *testing.T) { } } +func TestAggregationResolveWithCatalogKeepsOneVersion(t *testing.T) { + ctx := context.Background() + const doc = `{"steps":[{"id":"nested","kind":"group","aggregation_id":"team/child"}]}` + old := accounts.Aggregation{ID: "team/root", Enabled: true, Document: doc, Members: []accounts.AggregationMember{{Provider: "qoder", Model: "old"}}} + child := accounts.Aggregation{ID: "team/child", Enabled: true, Members: old.Members} + store := &aggTestStore{agg: child, extra: []accounts.Aggregation{old, {ID: "disabled"}}} + svc := NewAggregations(store) + root, catalog, err := svc.ResolveWithCatalog(ctx, " TEAM/ROOT ", nil) + if err != nil || root.ID != old.ID || len(root.Members) != 1 || catalog[child.ID].ID != child.ID || store.listCalls != 1 { + t.Fatalf("root=%+v catalog=%+v err=%v List calls=%d", root, catalog, err, store.listCalls) + } + if filtered, dir, err := svc.ResolveWithCatalog(ctx, old.ID, map[string]bool{"workbuddy": true}); err != nil || len(filtered.Members) != 0 || dir[child.ID].ID != child.ID || store.listCalls != 1 { + t.Fatalf("known root after filtering=%+v catalog=%+v err=%v List calls=%d", filtered, dir, err, store.listCalls) + } + for _, id := range []string{"disabled", "unknown"} { + if _, dir, err := svc.ResolveWithCatalog(ctx, id, nil); !errors.Is(err, ErrAggregationNotFound) || dir != nil { + t.Errorf("ResolveWithCatalog(%q) directory=%+v err=%v, want not found", id, dir, err) + } + } + if flat, dir, err := svc.ResolveWithCatalog(ctx, child.ID, nil); err != nil || flat.ID != child.ID || dir != nil { + t.Fatalf("flat root=%+v catalog=%+v err=%v", flat, dir, err) + } + // Disable the child after lookup and before compiling. The in-flight + // request keeps its original root/catalog; new requests see the update. + disable := false + if _, err := svc.Update(ctx, child.ID, accounts.UpdateAggregation{Enabled: &disable}); err != nil { + t.Fatal(err) + } + newRoot, newCatalog, err := svc.ResolveWithCatalog(ctx, old.ID, nil) + if err != nil || newCatalog[child.ID].Enabled || store.listCalls != 2 { + t.Fatalf("new catalog=%+v err=%v List calls=%d", newCatalog, err, store.listCalls) + } + if _, _, _, err := accounts.CompilePipeline(newRoot, newCatalog, "", nil, nil); err == nil { + t.Fatal("new request compiled a disabled child") + } + got, _, _, err := accounts.CompilePipeline(root, catalog, "", nil, nil) + if err != nil || len(got.Members) != 1 || got.Members[0].Model != "old" { + t.Fatalf("in-flight request lost its snapshot: %+v, %v", got, err) + } +} + +func TestAggregationCreateRejectsConflictsWithoutLockingOutOldData(t *testing.T) { + ctx := context.Background() + const oldDoc = `{"steps":[{"kind":"branch","paths":[{"fallback":true,"steps":[{"kind":"member","provider":"qoder","model":"a"}]}],"fallback":[{"kind":"member","provider":"qoder","model":"b"}]}]}` + store := &aggTestStore{agg: accounts.Aggregation{ID: "qoder-cn/legacy", Enabled: true, Document: oldDoc}} + svc := NewAggregations(store) + for _, input := range []accounts.CreateAggregation{ + {ID: "qoder-cn/forbidden", Members: []accounts.AggregationMember{{Provider: "qoder", Model: "a"}}}, + {ID: "new-model", Document: oldDoc}, + } { + _, err := svc.Create(ctx, input) + var op *OperationError + if !errors.As(err, &op) || op.Code != "invalid_request" || store.inserts != 0 { + t.Fatalf("Create(%q) err=%v Inserts=%d", input.ID, err, store.inserts) + } + } + name := "Manage legacy record" + if got, err := svc.Update(ctx, store.agg.ID, accounts.UpdateAggregation{Name: &name}); err != nil || got.Name != name || got.Document != oldDoc { + t.Fatalf("old record not manageable: %+v, %v", got, err) + } + doc := `{"steps":[{"kind":"member","provider":"qoder","model":"qoder-cn/a"}]}` + got, err := svc.Update(ctx, store.agg.ID, accounts.UpdateAggregation{Document: &doc}) + if err != nil || len(got.Members) != 1 || got.Members[0].Region != "cn" || got.Members[0].Model != "a" { + t.Fatalf("corrected document not saved: %+v, %v", got, err) + } +} + +func TestAggregationNestedAliasDispatchesOnlyWithinMemberRegionAndKeyGrant(t *testing.T) { + ctx := context.Background() + const childID = "team/child" + const rootID = "team/root" + store := &aggTestStore{} + svc := NewAggregations(store) + child, err := svc.Create(ctx, accounts.CreateAggregation{ + ID: childID, Enabled: true, + Document: `{"steps":[{"kind":"member","provider":"workbuddy","model":"workbuddy-cn/fast"}]}`, + }) + if err != nil { + t.Fatal(err) + } + store.agg = child + root, err := svc.Create(ctx, accounts.CreateAggregation{ + ID: rootID, Enabled: true, Strategy: accounts.AggregationPriority, + Document: `{"steps":[{"id":"nested","kind":"group","aggregation_id":" TEAM/CHILD "}]}`, + }) + if err != nil { + t.Fatal(err) + } + store.extra = []accounts.Aggregation{root} + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ + ID: "first-global", Provider: "workbuddy", Region: "global", Runtime: "in_process", + Models: []string{"upstream-global"}, ModelAliases: map[string]string{"fast": "upstream-global"}, + }) + pool.Upsert(executor.Item{ + ID: "second-cn", Provider: "workbuddy", Region: "cn", Runtime: "in_process", + Models: []string{"upstream-cn"}, ModelAliases: map[string]string{"fast": "upstream-cn"}, + }) + chat := &aggregationOrdinaryChat{} + ex := executor.NewChatExecutor(pool, "") + ex.Providers = providers.NewRegistry() + ex.Providers.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) + for _, tc := range []struct { + grant string + allowed bool + }{{"workbuddy", true}, {"workbuddy:cn", true}, {"workbuddy:global", false}} { + t.Run(tc.grant, func(t *testing.T) { + chat.calls, chat.model = 0, "" + prepared, err := ex.Prepare(executor.PrepareInput{ + Context: ctx, Request: translate.ChatRequest{Model: rootID}, + Identity: auth.Identity{AllowedProviders: []string{tc.grant}}, CrossProviderPool: true, Aggregations: svc, + }) + if err != nil { + t.Fatal(err) + } + got, err := ex.ChatNonStreamPrepared(prepared.Context, prepared.Request, prepared.Route) + if !tc.allowed { + if err == nil || chat.calls != 0 { + t.Fatalf("conflicting grant dispatched: calls=%d, err=%v", chat.calls, err) + } + return + } + if err != nil || chat.calls != 1 || got.AccountID != "second-cn" || chat.model != "upstream-cn" { + t.Fatalf("nested alias: account=%q, upstream=%q, calls=%d, err=%v", got.AccountID, chat.model, chat.calls, err) + } + }) + } +} + func TestAggregationCreateRejectsProviderDisabledModel(t *testing.T) { store := &aggTestStore{} validator := aggregationMemberRejector{model: "disabled-model"} @@ -133,6 +376,8 @@ func (r aggregationMemberRejector) ValidateAggregationMembers(_ context.Context, // aggTestStore implements only the narrow AggregationStore surface. type aggTestStore struct { agg accounts.Aggregation + extra []accounts.Aggregation + listErr error listCalls int inserts int saves int @@ -155,6 +400,6 @@ func (s *aggTestStore) SaveAggregation(_ context.Context, agg accounts.Aggregati } func (s *aggTestStore) ListAggregations(_ context.Context) ([]accounts.Aggregation, error) { s.listCalls++ - return []accounts.Aggregation{s.agg}, nil + return append([]accounts.Aggregation{s.agg}, s.extra...), s.listErr } func (s *aggTestStore) DeleteAggregation(_ context.Context, _ string) error { return nil } diff --git a/internal/control/catalog_policy.go b/internal/control/catalog_policy.go index f8bc89965..16063b447 100644 --- a/internal/control/catalog_policy.go +++ b/internal/control/catalog_policy.go @@ -288,6 +288,7 @@ func ProviderModelEntry(model providers.ModelInfo, provider string) map[string]a // contributes every model of its provider and region. Enabled IDs are the // canonical form stored by NormalizeAccountRouting. type AccountModelAllow struct { + AccountID string Provider string Region string ModelsRestricted bool @@ -296,6 +297,8 @@ type AccountModelAllow struct { // model this account rewrites it to. The public list keeps an alias only // when some granted account both defines it and may serve its target. Aliases map[string]string + // CanRouteModel optionally checks the account’s live model snapshot. + CanRouteModel func(string) bool } // ModelServedByAccounts reports whether at least one account the caller can @@ -330,9 +333,9 @@ func ModelServedByAccounts(entry map[string]any, identity auth.Identity, pool [] if !aggregationOnly && !identity.AllowsProvider(provider) { return false } - regions := EntryModelRegions(entry) + regions := catalogEntryRegions(entry, provider) id, _ := entry["id"].(string) - modelKey := modelAllowKey(id) + modelKey := modelAllowKey(provider, id) if modelKey == "" { return true } @@ -365,12 +368,12 @@ func ExpandModelAliases(models []map[string]any, pool []AccountModelAllow) []map existing := make(map[string]bool, len(models)) for _, model := range models { id, _ := model["id"].(string) - key := modelAllowKey(id) + provider := modelEntryProvider(model) + key := modelAllowKey(provider, id) if key == "" { continue } existing[key] = true - provider := modelEntryProvider(model) if provider != "" { byTarget[provider+"@"+key] = model } @@ -401,7 +404,7 @@ func ExpandModelAliases(models []map[string]any, pool []AccountModelAllow) []map if base == nil { base = byTarget["@"+targetKey] } - if base == nil || !accountServesRegion(account.Region, EntryModelRegions(base)) { + if base == nil || !accountServesRegion(account.Region, catalogEntryRegions(base, modelEntryProvider(base))) { continue } dedupeKey := provider + "@" + aliasKey @@ -439,7 +442,7 @@ func AggregateModelEntries(models []map[string]any, identity auth.Identity, pool realIDs := make(map[string]bool, len(models)) for _, model := range models { id, _ := model["id"].(string) - key := modelAllowKey(id) + key := modelAllowKey(modelEntryProvider(model), id) if key == "" { continue } @@ -458,10 +461,11 @@ func AggregateModelEntries(models []map[string]any, identity auth.Identity, pool for alias, target := range account.Aliases { aliasKey := accounts.CanonicalModelID(alias) targetKey := accounts.CanonicalModelID(target) - if aliasKey == "" || aliasKey == "auto" || targetKey == "" || targetKey == "auto" || aliasKey == targetKey { + if aliasKey == "" || aliasKey == "auto" || strings.Contains(aliasKey, "/") || targetKey == "" || targetKey == "auto" || aliasKey == targetKey { continue } - if realIDs[aliasKey] || seen[aliasKey] || !accountServesModel(account, targetKey) { + if realIDs[aliasKey] || seen[aliasKey] || !accountServesModel(account, aliasKey) || + (account.CanRouteModel != nil && !account.CanRouteModel(aliasKey)) { continue } base := aliasBaseEntry(byTarget[targetKey], provider, account.Region) @@ -492,12 +496,7 @@ func AggregateModelEntries(models []map[string]any, identity auth.Identity, pool // account lives in another region. func aliasBaseEntry(candidates []map[string]any, provider, region string) map[string]any { for _, candidate := range candidates { - if modelEntryProvider(candidate) == provider && accountServesRegion(region, EntryModelRegions(candidate)) { - return candidate - } - } - for _, candidate := range candidates { - if accountServesRegion(region, EntryModelRegions(candidate)) { + if modelEntryProvider(candidate) == provider && accountServesRegion(region, catalogEntryRegions(candidate, provider)) { return candidate } } @@ -556,19 +555,27 @@ func accountServesModel(account AccountModelAllow, modelKey string) bool { return false } -// modelAllowKey folds a catalog id the same way routing folds a request, and -// strips a provider prefix ("qoder/glm-5.2", "workbuddy-cn/glm-5.2") so a -// prefixed public list matches the bare ids stored on the account. "auto" is a -// real catalog entry and must obey a restricted account's enabled list; only an -// empty/unparseable id bypasses the allowlist. -func modelAllowKey(id string) string { - id = strings.TrimSpace(id) - if slash := strings.LastIndex(id, "/"); slash >= 0 { - id = id[slash+1:] +// modelAllowKey removes only the owning provider's route selector. The +// remaining ID can contain slashes (for example, Command's org/model IDs). +func modelAllowKey(provider, id string) string { + prefix, _, bare := accounts.SplitProviderModelPrefix(id) + if prefix != "" && prefix == accounts.NormalizeProviderFamily(provider) { + id = bare + } + if strings.TrimSpace(id) == "" { + return "" } return accounts.CanonicalModelID(id) } +func catalogEntryRegions(entry map[string]any, provider string) []string { + id, _ := entry["id"].(string) + if prefix, region, _ := accounts.SplitProviderModelPrefix(id); prefix != "" && prefix == provider && region != "" { + return []string{region} + } + return EntryModelRegions(entry) +} + // FilterModelsForIdentity applies grants after loading the shared catalog. func FilterModelsForIdentity(identity auth.Identity, models []map[string]any) []map[string]any { if len(identity.AllowedProviders) == 0 { @@ -600,9 +607,9 @@ func FilterModelsForIdentity(identity auth.Identity, models []map[string]any) [] // cross-provider pool is on; with it off, RejectsBareModel refuses them, so // model lists must match what the gateway accepts or every client that picks a // model from the list (console access page, /v1/models consumers) gets a 400. -// Entries already carrying a prefix, and the pooled qoder view (empty provider, -// owned_by=qoder), pass through unchanged. Region-qualified entries use the -// dash form so a specific region stays pinned ("workbuddy-cn/glm-5.3"). +// Entries already carrying their provider's route prefix pass through. A +// provider-native namespace is part of the model ID, not a route prefix. +// Region-qualified entries use the dash form ("workbuddy-cn/glm-5.3"). func PrefixModelEntries(models []map[string]any) []map[string]any { if len(models) == 0 { return models @@ -615,7 +622,12 @@ func PrefixModelEntries(models []map[string]any) []map[string]any { if provider == "" { provider, _ = model["owned_by"].(string) } - if id == "" || provider == "" || strings.Contains(id, "/") { + if id == "" || strings.TrimSpace(provider) == "" { + out = append(out, model) + continue + } + provider = accounts.NormalizeProviderFamily(provider) + if current, _, _ := accounts.SplitProviderModelPrefix(id); current == provider { out = append(out, model) continue } @@ -647,14 +659,11 @@ func CloneModelEntry(model map[string]any) map[string]any { } func identityAllowsAnyModelRegion(identity auth.Identity, model map[string]any) bool { - regions := EntryModelRegions(model) + provider := modelEntryProvider(model) + regions := catalogEntryRegions(model, provider) if len(regions) == 0 { return true } - provider, _ := model["provider"].(string) - if provider == "" { - provider, _ = model["owned_by"].(string) - } for _, region := range regions { if identity.AllowsProviderRegion(provider, region) { return true diff --git a/internal/control/provider_settings.go b/internal/control/provider_settings.go index f69ad2021..69ac739df 100644 --- a/internal/control/provider_settings.go +++ b/internal/control/provider_settings.go @@ -273,12 +273,12 @@ func providerPolicyAllowsModel(policy accounts.ProviderPolicy, model string) boo if len(policy.EnabledModels) == 0 { return true } - key := modelAllowKey(model) + key := modelAllowKey(policy.Provider, model) if target := policy.ModelAliases[key]; target != "" { - key = modelAllowKey(target) + key = accounts.CanonicalModelID(target) } for _, enabled := range policy.EnabledModels { - if modelAllowKey(enabled) == key { + if accounts.CanonicalModelID(enabled) == key { return true } } diff --git a/internal/executor/aggregation_e2e_test.go b/internal/executor/aggregation_e2e_test.go index 3b80f5515..dc9c413f3 100644 --- a/internal/executor/aggregation_e2e_test.go +++ b/internal/executor/aggregation_e2e_test.go @@ -45,7 +45,7 @@ func TestAggregateFailoverSettingsDriveAttempts(t *testing.T) { if err != nil { t.Fatalf("prepare: %v", err) } - loop := e.newRouteLoop(prepared.Context, "", "", prepared.Request) + loop := e.newRouteLoop(prepared.Route, prepared.Request.Model, nil) if loop.attempts != 1 { t.Fatalf("allow_fallbacks=false must cap attempts to 1, got %d", loop.attempts) } @@ -63,7 +63,7 @@ func TestAggregateFailoverSettingsDriveAttempts(t *testing.T) { if err != nil { t.Fatalf("prepare: %v", err) } - loop = e.newRouteLoop(prepared.Context, "", "", prepared.Request) + loop = e.newRouteLoop(prepared.Route, prepared.Request.Model, nil) if loop.attempts != 2 { t.Fatalf("max_attempts=2 must cap attempts to 2, got %d", loop.attempts) } @@ -95,23 +95,21 @@ func TestAggregatePrepareToRoute(t *testing.T) { if resolver.hit != 1 { t.Fatalf("resolver called %d times, want 1 (snapshot once)", resolver.hit) } - plan := aggregatePlanFrom(prepared.Context) + plan := prepared.Route.AggregatePlan if plan == nil || plan.ID != "my-model" { - t.Fatalf("plan not attached to context: %+v", plan) + t.Fatalf("plan not present in explicit route: %+v", plan) } // The loop must not pin a provider for an aggregated request and must route // only to members. - loop := e.newRouteLoop(prepared.Context, "", "", prepared.Request) - if loop.resolver == nil { - t.Fatal("route loop missing aggregate resolver") - } counts := map[string]int{} for i := 0; i < 10; i++ { - item, _, err := loop.pickNext(e, "my-model") + loop := e.newRouteLoop(prepared.Route, prepared.Request.Model, nil) + target, _, err := loop.pickNextReserved(e) if err != nil { t.Fatalf("pick: %v", err) } - counts[item.ID]++ + counts[target.item.ID]++ + e.releaseInFlight(prepared.RequestID, target.item.ID) } if counts["trae"] != 0 || counts["qoder"]+counts["workbuddy"] != 10 { t.Fatalf("unexpected aggregate routing: %v", counts) diff --git a/internal/executor/aggregation_plan.go b/internal/executor/aggregation_plan.go index bbb998f7c..55bb814e8 100644 --- a/internal/executor/aggregation_plan.go +++ b/internal/executor/aggregation_plan.go @@ -8,10 +8,8 @@ import ( ) // AggregatePlan is an immutable per-request snapshot of one logical model. -// It is resolved once in Prepare (before any Pool lock) and stored in the -// request context. Everything downstream treats it as read-only, so parallel -// requests never share mutable state and configuration updates cannot change -// the candidate set mid-flight. +// Prepare resolves it before taking the Pool lock and passes it in RouteInput. +// Routing treats the snapshot as read-only for the duration of the request. type AggregatePlan struct { ID string Strategy accounts.AggregationStrategy @@ -43,13 +41,18 @@ func NewAggregatePlan(agg accounts.Aggregation) *AggregatePlan { MaxAttempts: agg.MaxAttempts, ReasoningEffort: agg.ReasoningEffort, Members: agg.Members, - byProvider: make(map[string][]accounts.AggregationMember, len(agg.Members)), + byProvider: indexAggregateMembers(agg.Members), } - for _, member := range agg.Members { + return plan +} + +func indexAggregateMembers(members []accounts.AggregationMember) map[string][]accounts.AggregationMember { + index := make(map[string][]accounts.AggregationMember, len(members)) + for _, member := range members { key := aggregateMemberProvider(member.Provider) - plan.byProvider[key] = append(plan.byProvider[key], member) + index[key] = append(index[key], member) } - return plan + return index } // aggregateMemberProvider gives the same provider family for stored legacy @@ -81,16 +84,9 @@ func aggregatePlanFrom(ctx context.Context) *AggregatePlan { return plan } -// resolver returns a pure function that maps an Item to the concrete real -// model it should serve for this plan. The function: -// - reads only the immutable plan snapshot and the passed-in Item; -// - never calls Pool methods, the facade, DB, network, or channels; -// - is O(candidates for provider), typically O(1), with no allocation. -// -// It is safe to invoke while Pool.mu is held. If a member's region filter is -// set, only items in that region are considered; an empty region matches any. -// matchMember returns the member this item resolves to. Shared by resolver, -// priorityResolver and weightResolver so all three agree on the same member. +// matchMember is the single-model compatibility resolver. Request scheduling +// evaluates each concrete member independently; an account may serve more than +// one member and its first match need not be the one that is ready to dispatch. func (p *AggregatePlan) matchMember(item Item) (accounts.AggregationMember, bool) { if p == nil { return accounts.AggregationMember{}, false @@ -99,13 +95,7 @@ func (p *AggregatePlan) matchMember(item Item) (accounts.AggregationMember, bool region := NormalizeRegion(itemRegion(item)) var wildcard *accounts.AggregationMember for _, member := range candidates { - if member.AccountID != "" && member.AccountID != item.ID { - continue - } - if member.Region != "" && NormalizeRegion(member.Region) != region { - continue - } - if !itemHasModel(item, member.Model) { + if !aggregateMemberInScope(item.ID, region, member) || !itemHasModel(item, member.Model) { continue } // A deployment pinned to this exact account is more specific than a @@ -126,66 +116,32 @@ func (p *AggregatePlan) matchMember(item Item) (accounts.AggregationMember, bool return accounts.AggregationMember{}, false } +func aggregateMemberInScope(accountID, region string, member accounts.AggregationMember) bool { + return routeModel(member.Model) != "" && (member.AccountID == "" || member.AccountID == accountID) && + (member.Region == "" || NormalizeRegion(member.Region) == region) +} + // CanServeAccount reports whether this account can serve at least one member // of the logical model. Sticky routing uses it because the public model is a // virtual ID that is intentionally absent from every account catalog. func (p *AggregatePlan) CanServeAccount(item Item) bool { - _, ok := p.matchMember(item) - return ok -} - -// Priority returns the configured priority of the member this account serves. -func (p *AggregatePlan) Priority(item Item) (int, bool) { - member, ok := p.matchMember(item) - if !ok { - return 0, false - } - return member.Priority, true -} - -// PriorityTierCount counts distinct configured priority tiers. It is used to -// give each tier its own retry budget instead of spending the whole budget on -// sibling accounts of the first provider. -func (p *AggregatePlan) PriorityTierCount() int { if p == nil { - return 1 + return false } - seen := make(map[int]struct{}, len(p.Members)) if len(p.Seats) > 0 { - collectSeatPriorities(p.Seats, seen) - } else { - for _, member := range p.Members { - seen[member.Priority] = struct{}{} - } - } - if len(seen) == 0 { - if len(p.Seats) > 0 { - return len(p.Seats) - } - return 1 + return seatsCanServeAccount(p.Seats, item) } - return len(seen) -} - -// collectSeatPriorities mirrors noteTierFailure: a picked account is graded -// by the leaf member it matched, so a top-level group seat with several -// inner priorities has to count all of them. -func collectSeatPriorities(seats []accounts.RouteSeat, seen map[int]struct{}) { - for _, seat := range seats { - switch seat.Kind { - case "member": - seen[seat.Member.Priority] = struct{}{} - case "group": - if len(seat.GroupSeats) > 0 { - collectSeatPriorities(seat.GroupSeats, seen) - } - for _, member := range seat.GroupMembers { - seen[member.Priority] = struct{}{} - } + region := itemRegion(item) + for _, member := range p.byProvider[itemProvider(item)] { + if aggregateMemberInScope(item.ID, region, member) && itemCouldServeModel(item, member.Model) { + return true } } + return false } +// resolver maps one account to its historical default member for consumers +// that need a single model. It is not used to resolve a reserved target. func (p *AggregatePlan) resolver() func(Item) string { if p == nil || len(p.Members) == 0 { return nil diff --git a/internal/executor/aggregation_preview.go b/internal/executor/aggregation_preview.go new file mode 100644 index 000000000..7eabb2b45 --- /dev/null +++ b/internal/executor/aggregation_preview.go @@ -0,0 +1,63 @@ +package executor + +import ( + "context" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +// AggregatePreviewCandidate describes only the next candidate visible in the +// current pool snapshot. It intentionally omits the account ID and does not +// describe later attempts, API-key grants, request pins, or session affinity. +type AggregatePreviewCandidate struct { + ID string `json:"id"` + Model string `json:"model"` + Provider string `json:"provider"` + Region string `json:"region,omitempty"` + Status string `json:"status"` + Reason string `json:"reason,omitempty"` +} + +// CompileAggregationPreview uses the same lazy pipeline compiler and intent +// classifier as request preparation. The classifier is invoked only for branch +// steps reached while compiling the selected path. +func (e ChatExecutor) CompileAggregationPreview(ctx context.Context, agg accounts.Aggregation, catalog map[string]accounts.Aggregation, text string) (*AggregatePlan, string, error) { + classify := e.intentClassifier(ctx, text, RouteInput{}) + return CompileAggregatePreview(agg, catalog, text, classify) +} + +// CompileAggregatePreview is the shared pure pipeline compilation step. The +// callback may classify a branch target, and is called lazily only for reached +// branches by CompilePipelineWithClassifier. +func CompileAggregatePreview(agg accounts.Aggregation, catalog map[string]accounts.Aggregation, text string, classify func(accounts.ClassifierTarget) string) (*AggregatePlan, string, error) { + compiled, seats, path, err := accounts.CompilePipelineWithClassifier(agg, catalog, text, nil, classify) + if err != nil { + return nil, "", err + } + plan := NewAggregatePlan(compiled) + plan.Seats = seats + return plan, path, nil +} + +// PreviewAggregate returns the same immediate candidate as production aggregate +// routing without reserving a slot or committing any rotation cursor. A cooling +// member may be returned as a skipped retry hint; no candidate is returned when +// the current pool has no route it can identify. +func (p *Pool) PreviewAggregate(plan *AggregatePlan, q RouteQuery) (AggregatePreviewCandidate, bool) { + result := p.selectAggregate(plan, q, false) + if result.Item.ID == "" || result.Member.Model == "" { + return AggregatePreviewCandidate{}, false + } + attempt := AggregatePreviewCandidate{ + ID: result.Member.Provider + "/" + result.Member.Model, + Model: result.Member.Model, + Provider: result.Member.Provider, + Region: result.Member.Region, + Status: "candidate", + } + if !result.Available { + attempt.Status = "skipped" + attempt.Reason = "no ready account" + } + return attempt, true +} diff --git a/internal/executor/aggregation_preview_test.go b/internal/executor/aggregation_preview_test.go new file mode 100644 index 000000000..c064262f3 --- /dev/null +++ b/internal/executor/aggregation_preview_test.go @@ -0,0 +1,120 @@ +package executor + +import ( + "maps" + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +func TestCompileAggregatePreviewClassifiesOnlyReachedBranches(t *testing.T) { + const outerDoc = `{"version":1,"steps":[ + {"id":"root","kind":"branch","classifier":{"provider":"qoder","model":"root-classifier"},"paths":[ + {"id":"chosen","label":"Chosen","steps":[ + {"id":"nested","kind":"group","aggregation_id":"inner"} + ]}, + {"id":"unused","label":"Unused","steps":[ + {"id":"unused-branch","kind":"branch","classifier":{"provider":"workbuddy","model":"unused-classifier"},"fallback":[ + {"id":"unused-member","kind":"member","provider":"workbuddy","model":"unused-model"} + ]} + ]} + ]} + ]}` + const innerDoc = `{"version":1,"steps":[ + {"id":"inner-branch","kind":"branch","classifier":{"provider":"qoder","model":"inner-classifier"},"paths":[ + {"id":"match","label":"Match","intent":"match","steps":[ + {"id":"selected-member","kind":"member","provider":"qoder","model":"selected-model"} + ]} + ],"fallback":[{"id":"inner-fallback","kind":"member","provider":"qoder","model":"fallback-model"}]} + ]}` + catalog := map[string]accounts.Aggregation{ + "inner": {ID: "inner", Enabled: true, Document: innerDoc}, + } + var visits []string + plan, path, err := CompileAggregatePreview( + accounts.Aggregation{ID: "outer", Strategy: accounts.AggregationPriority, Document: outerDoc}, + catalog, "request", func(target accounts.ClassifierTarget) string { + visits = append(visits, target.Key()) + if target.Model == "root-classifier" { + return "Chosen" + } + if target.Model == "inner-classifier" { + return "Match" + } + return "" + }, + ) + if err != nil { + t.Fatal(err) + } + if path != "Chosen" { + t.Fatalf("path = %q, want Chosen", path) + } + if len(visits) != 2 || visits[0] != "qoder||root-classifier" || visits[1] != "qoder||inner-classifier" { + t.Fatalf("classifier visits = %v, want only reached root and nested branches", visits) + } + if plan == nil || len(plan.Members) != 1 || plan.Members[0].Model != "selected-model" || len(plan.Seats) != 1 || plan.Seats[0].Kind != "group" { + t.Fatalf("compiled plan = %+v, want selected nested member path", plan) + } +} + +func TestPreviewAggregateUsesCurrentNestedFEFOCandidateWithoutMutation(t *testing.T) { + pool := NewPool(nil, nil) + now := time.Now() + for id, expiry := range map[string]time.Duration{"late": 72 * time.Hour, "early": 24 * time.Hour} { + pool.Upsert(Item{ + ID: id, Provider: "qoder", Models: []string{id}, + Quota: &accounts.QuotaSnapshot{Packages: []accounts.QuotaPackage{{ + Scope: accounts.QuotaPackageScopeAccountFEFO, Unit: "credits", Remain: 1, EndsAt: now.Add(expiry).Unix(), + }}}, + }) + } + pool.Upsert(Item{ID: "outer-fallback", Provider: "workbuddy", Models: []string{"outer-fallback"}}) + pool.lastPicked = make(map[string]string) + pool.lastPicked["sentinel"] = "unchanged" + plan := NewAggregatePlan(accounts.Aggregation{ID: "outer", Strategy: accounts.AggregationPriority}) + plan.Seats = []accounts.RouteSeat{ + { + ID: "nested-fefo", Kind: "group", Priority: 0, GroupStrategy: accounts.AggregationFEFOStrategy, + GroupMembers: []accounts.AggregationMember{ + {Provider: "qoder", Model: "early", Priority: 0}, + {Provider: "qoder", Model: "late", Priority: 1}, + }, + }, + {ID: "fallback", Kind: "member", Priority: 1, Member: accounts.AggregationMember{Provider: "workbuddy", Model: "outer-fallback"}}, + } + q := RouteQuery{PublicModel: plan.ID} + beforePicked := maps.Clone(pool.lastPicked) + beforeEarly, _ := pool.ByID("early") + beforeLate, _ := pool.ByID("late") + expected := pool.selectAggregate(plan, q, false) + candidate, ok := pool.PreviewAggregate(plan, q) + if !ok || candidate.Status != "candidate" || candidate.ID != "qoder/early" || candidate.Model != expected.Member.Model || !expected.Available { + t.Fatalf("candidate=%+v ok=%v expected=%+v", candidate, ok, expected) + } + if expected.Member.Model != "early" { + t.Fatalf("FEFO candidate = %+v, want early", expected) + } + afterEarly, _ := pool.ByID("early") + afterLate, _ := pool.ByID("late") + if beforeEarly.InFlight != afterEarly.InFlight || beforeLate.InFlight != afterLate.InFlight || !maps.Equal(beforePicked, pool.lastPicked) { + t.Fatalf("preview mutated slots/cursors: early %d→%d late %d→%d picked=%v", beforeEarly.InFlight, afterEarly.InFlight, beforeLate.InFlight, afterLate.InFlight, pool.lastPicked) + } +} + +func TestPreviewAggregateReturnsCoolingHintWithoutReservation(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "cooling", Provider: "qoder", Models: []string{"model"}}) + pool.MarkClassified("cooling", Classified{Kind: KindRateLimit, Model: "model", Cooldown: time.Minute}) + plan := NewAggregatePlan(accounts.Aggregation{ID: "outer", Strategy: accounts.AggregationPriority, Members: []accounts.AggregationMember{{Provider: "qoder", Model: "model"}}}) + before, _ := pool.ByID("cooling") + candidate, ok := pool.PreviewAggregate(plan, RouteQuery{PublicModel: plan.ID}) + after, _ := pool.ByID("cooling") + if !ok || candidate.Status != "skipped" || candidate.Reason != "no ready account" || candidate.Model != "model" { + t.Fatalf("cooling hint = %+v ok=%v", candidate, ok) + } + if before.InFlight != after.InFlight { + t.Fatalf("cooling preview changed in-flight count: %d → %d", before.InFlight, after.InFlight) + } +} diff --git a/internal/executor/aggregation_priority.go b/internal/executor/aggregation_priority.go new file mode 100644 index 000000000..74544c706 --- /dev/null +++ b/internal/executor/aggregation_priority.go @@ -0,0 +1,410 @@ +package executor + +import ( + "math" + "strconv" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +// aggregateRouteResult keeps the selected member and miss evidence from the +// same pool snapshot. A cooling hint has an item and a member but no slot. +type aggregateRouteResult struct { + Item Item + Member accounts.AggregationMember + Available bool + FEFO bool // the selected path uses FEFO at one or more levels + RetryAfter time.Duration + HasRoute bool + Saturated bool + QuotaBlocked bool + Scoped bool +} + +// ReserveAggregate selects the best concrete member/account and reserves one +// account slot atomically. When only cooling candidates match, found is true +// and reserved is false; the returned member describes the retry hint. +func (p *Pool) ReserveAggregate(plan *AggregatePlan, q RouteQuery) (item Item, member accounts.AggregationMember, found, reserved bool) { + result := p.selectAggregate(plan, q, true) + return result.Item, result.Member, result.Available || result.RetryAfter > 0, result.Available +} + +// HasAggregateRoute probes whether the requested route has a capable member +// without consulting cooldowns, quota, the capacity limit, or rotation state. +func (p *Pool) HasAggregateRoute(plan *AggregatePlan, q RouteQuery) bool { + if p == nil || plan == nil { + return false + } + root := buildAggregateNode(plan) + scope := aggregateScope(q) + p.mu.Lock() + defer p.mu.Unlock() + for _, item := range p.items { + if routeReadyAndScoped(item, scope) && root.hasMember(item, q.ExcludedModels) { + return true + } + } + return false +} + +// selectAggregate examines the entire strategy tree, adjusts in-flight count, +// and commits the selected path's cursors under one lock. Preview does not +// initialize rotation state or advance any cursor. +func (p *Pool) selectAggregate(plan *AggregatePlan, q RouteQuery, reserve bool) aggregateRouteResult { + if p == nil || plan == nil { + return aggregateRouteResult{} + } + root := buildAggregateNode(plan) + p.mu.Lock() + defer p.mu.Unlock() + + now := time.Now() + q.StrategyOverride = string(root.strategy) + q, _ = p.configureRouteLocked(q, now) + scan := aggregateScan{pool: p, query: q, now: now} + scope := aggregateScope(q) + var scoped []int + var preferred []int + for i, item := range p.items { + if routeReadyAndScoped(item, scope) { + scoped = append(scoped, i) + if q.PreferAccount != "" && q.PreferAccount == item.ID { + preferred = append(preferred, i) + } + } + } + if len(scoped) == 0 { + return aggregateRouteResult{} + } + + key := rotationKey(q) + "|aggregate|" + strconv.Quote(plan.ID) + if len(preferred) > 0 { + choice := scan.choose(root, preferred, key, false) + if choice != nil { + // Like an ordinary account pin, taking a preferred slot does not + // move strategy cursors used by non-preferred traffic. + return scan.finish(choice, reserve, false) + } + } + choice := scan.choose(root, scoped, key, false) + return scan.finish(choice, reserve, true) +} + +// ExcludedModels is tested with the resolved member model, never with the +// virtual name. Other scoping (provider, region, grants, account exclusion, +// protocol) is common to all leaves and checked once per pool item. +func aggregateScope(q RouteQuery) RouteQuery { + q.ExcludedModels = nil + return q +} + +type aggregateCandidate struct { + index int + member accounts.AggregationMember + key string + expiry int64 + fefo bool +} + +type aggregateChoice struct { + target aggregateCandidate + cursors []aggregateCursor +} + +type aggregateCursor struct { + key string + value string +} + +type aggregateScan struct { + pool *Pool + query RouteQuery + now time.Time + result aggregateRouteResult + cooling aggregateCandidate + resume time.Time +} + +func (s *aggregateScan) finish(choice *aggregateChoice, reserve, rotate bool) aggregateRouteResult { + result := s.result + result.Scoped = true + if choice != nil { + item := &s.pool.items[choice.target.index] + if reserve { + acquireItemLocked(item, s.now) + if rotate { + for _, cursor := range choice.cursors { + s.pool.ensureRotationKey(cursor.key) + s.pool.lastPicked[cursor.key] = cursor.value + } + } + } + result.Item, result.Member, result.Available = item.clone(), choice.target.member, true + result.FEFO = choice.target.fefo + } else if !s.resume.IsZero() { + result.Item = s.pool.items[s.cooling.index].clone() + result.Member = s.cooling.member + result.RetryAfter = s.resume.Sub(s.now) + } + return result +} + +func (n *aggregateNode) hasMember(item Item, excluded map[routeModelKey]struct{}) bool { + for _, seat := range n.seats { + if seat.node.hasMember(item, excluded) { + return true + } + } + region := itemRegion(item) + for _, member := range n.members[itemProvider(item)] { + if _, ok := n.memberKey(item, region, member, excluded); ok { + return true + } + } + return false +} + +// An account-specific member overrides a provider-wide member only for the +// same concrete account/model, not for every other model the account serves. +// Its configured priority and weight still win even if the wildcard comes +// first. Both sides honor the item's alias when identifying the real model. +func (n *aggregateNode) memberKey(item Item, region string, member accounts.AggregationMember, excluded map[routeModelKey]struct{}) (routeModelKey, bool) { + if !aggregateMemberInScope(item.ID, region, member) || !itemCouldServeModel(item, member.Model) { + return routeModelKey{}, false + } + key := accountRouteModelKey(item, member.Model) + if _, skip := excluded[key]; skip { + return routeModelKey{}, false + } + if member.AccountID == "" { + for _, pin := range n.pins[item.ID] { + if aggregateMemberProvider(pin.Provider) == aggregateMemberProvider(member.Provider) && + aggregateMemberInScope(item.ID, region, pin) && accountRouteModelKey(item, pin.Model) == key && + itemCouldServeModel(item, pin.Model) { + return routeModelKey{}, false + } + } + } + return key, true +} + +func (s *aggregateScan) choose(node *aggregateNode, scoped []int, key string, fefo bool) *aggregateChoice { + fefo = fefo || node.strategy == accounts.AggregationFEFOStrategy + if len(node.seats) > 0 { + return s.chooseSeat(node, scoped, key, fefo) + } + var available []aggregateCandidate + q := s.query + q.ModelResolver = nil + q.fefoNow = time.Time{} + if fefo { + q.fefoNow = s.now + } + for _, i := range scoped { + item := s.pool.items[i] + region := itemRegion(item) + for _, member := range node.members[itemProvider(item)] { + target, ok := node.memberKey(item, region, member, q.ExcludedModels) + if !ok { + continue + } + s.result.HasRoute = true + q.PublicModel = member.Model + if !fefo { + // Price the actual model, not the configured alias spelling. + // The FEFO gate already resolves aliases, so passing the + // target there could follow a second alias by accident. + q.PublicModel = AccountModelID(item, member.Model) + } + if routeQuotaExceeded(item, q) { + s.result.QuotaBlocked = true + continue + } + q.PublicModel = member.Model // resumeAt resolves the cooldown key itself + candidate := aggregateCandidate{index: i, member: member, key: item.ID + "\x00" + target.Model, fefo: fefo} + if until := resumeAt(item, q); until.After(s.now) { + if s.resume.IsZero() || until.Before(s.resume) { + s.cooling, s.resume = candidate, until + } + continue + } + if itemSaturated(item) { + s.result.Saturated = true + continue + } + if fefo { + candidate.expiry, _ = fefoExpiry(item, member.Model, s.now) + } + available = append(available, candidate) + } + } + if len(available) == 0 { + return nil + } + return s.chooseMember(node.strategy, available, key) +} + +func (s *aggregateScan) chooseMember(strategy accounts.AggregationStrategy, available []aggregateCandidate, key string) *aggregateChoice { + switch strategy { + case accounts.AggregationPriority: + tier := available[0].member.Priority + for _, candidate := range available[1:] { + if candidate.member.Priority < tier { + tier = candidate.member.Priority + } + } + available = filterAggregateMembers(available, func(c aggregateCandidate) bool { return c.member.Priority == tier }) + key += "/priority/" + strconv.Itoa(tier) + case accounts.AggregationFillFirst: + best := available[0] + for _, candidate := range available[1:] { + if candidate.member.Weight > best.member.Weight || + (candidate.member.Weight == best.member.Weight && candidate.key < best.key) { + best = candidate + } + } + return &aggregateChoice{target: best} + case accounts.AggregationFEFOStrategy: + // As in the ordinary pool, compare billing days within each provider + // but let different providers share the route. + earliest := make(map[string]int64) + for _, candidate := range available { + if candidate.expiry == 0 { + continue + } + family := itemProvider(s.pool.items[candidate.index]) + if day := fefoCreditDay(candidate.expiry); earliest[family] == 0 || day < earliest[family] { + earliest[family] = day + } + } + available = filterAggregateMembers(available, func(c aggregateCandidate) bool { + day := earliest[itemProvider(s.pool.items[c.index])] + return day == 0 || (c.expiry > 0 && fefoCreditDay(c.expiry) == day) + }) + case accounts.AggregationLeastQuotaFirst, accounts.AggregationMostQuotaFirst: + var best float64 + var known bool + most := strategy == accounts.AggregationMostQuotaFirst + for _, candidate := range available { + if ratio, ok := s.quotaRatio(candidate); ok && (!known || betterRatio(ratio, best, most)) { + best, known = ratio, true + } + } + if known { + available = filterAggregateMembers(available, func(c aggregateCandidate) bool { + ratio, ok := s.quotaRatio(c) + return ok && ratio == best + }) + } + } + + // The cursor is per tier. A temporarily unavailable member does not + // reseat the rotation: resume from the lexical successor of its key. + last := s.pool.lastPicked[key] + first := available[0] + var next aggregateCandidate + for _, candidate := range available { + if candidate.key < first.key { + first = candidate + } + if candidate.key > last && (next.key == "" || candidate.key < next.key) { + next = candidate + } + } + if next.key == "" { + next = first + } + return &aggregateChoice{target: next, cursors: []aggregateCursor{{key: key, value: next.key}}} +} + +func betterRatio(a, b float64, most bool) bool { + if most { + return a > b + } + return a < b +} + +func (s *aggregateScan) quotaRatio(candidate aggregateCandidate) (float64, bool) { + ratio, known := quotaRemainingRatio(s.pool.items[candidate.index]) + return ratio, known && !math.IsNaN(ratio) +} + +func filterAggregateMembers(candidates []aggregateCandidate, keep func(aggregateCandidate) bool) []aggregateCandidate { + out := candidates[:0] + for _, c := range candidates { + if keep(c) { + out = append(out, c) + } + } + return out +} + +func (s *aggregateScan) chooseSeat(node *aggregateNode, scoped []int, key string, fefo bool) *aggregateChoice { + var best *aggregateChoice + bestIndex := -1 + cursorKey := key + "/seats" + for i, seat := range node.seats { + child := s.choose(seat.node, scoped, key+"/"+strconv.Quote(seat.key), fefo) + if child == nil { + continue + } + if best == nil || s.betterSeat(node, cursorKey, i, child.target, bestIndex, best.target) { + bestIndex, best = i, child + } + } + if best != nil { + seat := node.seats[bestIndex] + switch node.strategy { + case accounts.AggregationPriority: + cursorKey += "/priority/" + strconv.Itoa(seat.seat.Priority) + fallthrough + case accounts.AggregationRoundRobin: + best.cursors = append(best.cursors, aggregateCursor{key: cursorKey, value: seat.key}) + } + } + return best +} + +func (s *aggregateScan) betterSeat(node *aggregateNode, cursorKey string, i int, left aggregateCandidate, j int, right aggregateCandidate) bool { + a, b := node.seats[i].seat, node.seats[j].seat + switch node.strategy { + case accounts.AggregationFillFirst: + if a.Weight != b.Weight { + return a.Weight > b.Weight + } + return a.ID < b.ID + case accounts.AggregationLeastQuotaFirst, accounts.AggregationMostQuotaFirst: + // Compare the account the child would dispatch, not some other + // account in the child whose quota looks preferable. + l, lOK := s.quotaRatio(left) + r, rOK := s.quotaRatio(right) + if lOK != rOK { + return lOK + } + if lOK && l != r { + return betterRatio(l, r, node.strategy == accounts.AggregationMostQuotaFirst) + } + case accounts.AggregationFEFOStrategy: + if left.expiry != right.expiry { + return left.expiry > 0 && (right.expiry == 0 || left.expiry < right.expiry) + } + case accounts.AggregationPriority: + if a.Priority != b.Priority { + return a.Priority < b.Priority + } + cursorKey += "/priority/" + strconv.Itoa(a.Priority) + fallthrough + case accounts.AggregationRoundRobin: + last := s.pool.lastPicked[cursorKey] + for k, seat := range node.seats { + if seat.key == last { + // Configured order remains stable even when the last selected + // seat has no ready account on this request. + return (i-k-1+len(node.seats))%len(node.seats) < (j-k-1+len(node.seats))%len(node.seats) + } + } + return i < j + } + return a.Priority < b.Priority +} diff --git a/internal/executor/aggregation_priority_test.go b/internal/executor/aggregation_priority_test.go new file mode 100644 index 000000000..d176f93f3 --- /dev/null +++ b/internal/executor/aggregation_priority_test.go @@ -0,0 +1,195 @@ +package executor + +import ( + "sync" + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +func TestAggregateFlatPriorityRotatesOnlyWithinAvailableTier(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "a-top", Provider: "qoder", Models: []string{"top"}}) + pool.Upsert(Item{ID: "b-top", Provider: "qoder", Models: []string{"top"}}) + pool.Upsert(Item{ID: "0-lower", Provider: "qoder", Models: []string{"lower"}}) + plan := NewAggregatePlan(accounts.Aggregation{ID: "logical", Strategy: accounts.AggregationPriority, Members: []accounts.AggregationMember{ + {Provider: "qoder", Model: "top", Priority: 0}, + {Provider: "qoder", Model: "lower", Priority: 1}, + }}) + q := RouteQuery{PublicModel: "logical"} + assertAccount := func(want string) { + t.Helper() + if item, _ := reserveAggregateTest(t, pool, plan, q); item.ID != want { + t.Fatalf("pick = %q, want %q", item.ID, want) + } + } + for _, want := range []string{"a-top", "b-top", "a-top", "b-top"} { + assertAccount(want) + } + for _, id := range []string{"a-top", "b-top"} { + pool.MarkClassified(id, Classified{Kind: KindRateLimit, Model: "top", Cooldown: time.Minute}) + } + assertAccount("0-lower") + for _, id := range []string{"a-top", "b-top"} { + pool.MarkOK(id, "top") + } + assertAccount("a-top") +} + +func TestAggregateFlatSelectsSecondModelOnSameAccount(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "shared", Provider: "qoder", Models: []string{"model-a", "model-b"}}) + plan := NewAggregatePlan(accounts.Aggregation{ID: "logical", Strategy: accounts.AggregationPriority, Members: []accounts.AggregationMember{ + {Provider: "qoder", Model: "model-a", Priority: 0}, + {Provider: "qoder", Model: "model-b", Priority: 1}, + }}) + q := RouteQuery{PublicModel: "logical"} + a, memberA := reserveAggregateTest(t, pool, plan, q) + if memberA.Model != "model-a" { + t.Fatalf("first pick = %+v, want model-a", memberA) + } + q.ExcludedModels = map[routeModelKey]struct{}{accountRouteModelKey(a, memberA.Model): {}} + b, memberB := reserveAggregateTest(t, pool, plan, q) + if b.ID != a.ID || memberB.Model != "model-b" { + t.Fatalf("after excluding model-a pick = %s/%s, want %s/model-b", b.ID, memberB.Model, a.ID) + } + q.ExcludedModels = nil + pool.MarkClassified(a.ID, Classified{Kind: KindRateLimit, Model: "model-a", Cooldown: 10 * time.Minute}) + b, memberB = reserveAggregateTest(t, pool, plan, q) + if b.ID != a.ID || memberB.Model != "model-b" { + t.Fatalf("with model-a cooling pick = %s/%s, want %s/model-b", b.ID, memberB.Model, a.ID) + } + pool.MarkClassified(b.ID, Classified{Kind: KindRateLimit, Model: "model-b", Cooldown: time.Minute}) + peek := pool.selectAggregate(plan, q, true) + if peek.Available || peek.Item.ID != a.ID || peek.Member.Model != "model-b" || peek.RetryAfter <= 0 || peek.RetryAfter > time.Minute || peek.Item.InFlight != 0 { + t.Fatalf("cooling hint = %+v, want model-b's earlier release and no slot", peek) + } + if !pool.HasAggregateRoute(plan, q) { + t.Fatal("cooldowns must not hide aggregate capability") + } +} + +func TestAggregateAccountSpecificMemberRetainsPriorityForAliasTarget(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "a", Provider: "qoder", Models: []string{"model-a"}, ModelAliases: map[string]string{"alias-a": "model-a"}}) + pool.Upsert(Item{ID: "b", Provider: "qoder", Models: []string{"model-b"}}) + plan := NewAggregatePlan(accounts.Aggregation{ID: "logical", Strategy: accounts.AggregationPriority, Members: []accounts.AggregationMember{ + {Provider: "qoder", Model: "alias-a", Priority: 0, Weight: 100}, + {Provider: "qoder", Model: "model-b", Priority: 1, Weight: 100}, + {Provider: "qoder", Model: "model-a", AccountID: "a", Priority: 2, Weight: 400}, + }}) + q := RouteQuery{PublicModel: "logical"} + if item, _ := reserveAggregateTest(t, pool, plan, q); item.ID != "b" { + t.Fatalf("pick = %q, want b before a's account-specific tier", item.ID) + } + q.ExcludedModels = map[routeModelKey]struct{}{{AccountID: "b", Model: "model-b"}: {}} + item, member := reserveAggregateTest(t, pool, plan, q) + if item.ID != "a" || member.Model != "model-a" || member.Priority != 2 || member.Weight != 400 { + t.Fatalf("selected = %s %+v, want account-specific member", item.ID, member) + } + q.ExcludedModels[accountRouteModelKey(item, "alias-a")] = struct{}{} + if pool.HasAggregateRoute(plan, q) { + t.Fatal("an alternate spelling must not reintroduce the already tried account/model") + } +} + +func TestAggregateFlatRoundRobinCountsAliasTargetOncePerAccount(t *testing.T) { + pool := NewPool(nil, nil) + aliases := map[string]string{"alias": "model-a", "alternate": "model-a"} + pool.Upsert(Item{ID: "a", Provider: "qoder", Models: []string{"model-a", "model-b"}, ModelAliases: aliases}) + pool.Upsert(Item{ID: "b", Provider: "qoder", Models: []string{"model-a"}, ModelAliases: aliases}) + plan := NewAggregatePlan(accounts.Aggregation{ID: "logical", Strategy: accounts.AggregationRoundRobin, Members: []accounts.AggregationMember{ + {Provider: "qoder", Model: "alias"}, + {Provider: "qoder", Model: "alternate"}, + {Provider: "qoder", Model: "model-a", AccountID: "a"}, + {Provider: "qoder", Model: "model-b", AccountID: "a"}, + }}) + q := RouteQuery{PublicModel: plan.ID} + for i, want := range []string{"a/model-a", "a/model-b", "b/alias", "a/model-a", "a/model-b", "b/alias"} { + item, member := reserveAggregateTest(t, pool, plan, q) + if got := item.ID + "/" + member.Model; got != want { + t.Fatalf("pick %d = %q, want %q", i, got, want) + } + } + a, _ := pool.ByID("a") + b, _ := pool.ByID("b") + q.ExcludedModels = map[routeModelKey]struct{}{accountRouteModelKey(a, "alias"): {}, accountRouteModelKey(b, "alternate"): {}} + item, member := reserveAggregateTest(t, pool, plan, q) + if item.ID != "a" || member.Model != "model-b" { + t.Fatalf("with model-a excluded for both accounts, picked %s/%s, want a/model-b", item.ID, member.Model) + } +} + +func TestAggregatePriorityBudgetDoesNotSkipRemainingTierMembers(t *testing.T) { + pool := NewPool(nil, nil) + for _, id := range []string{"a-top", "b-top", "c-top"} { + pool.Upsert(Item{ID: id, Provider: "qoder", Region: "global", Models: []string{"top"}}) + } + pool.Upsert(Item{ID: "lower", Provider: "qoder", Region: "global", Models: []string{"lower"}}) + plan := NewAggregatePlan(accounts.Aggregation{ID: "logical", Strategy: accounts.AggregationPriority, AllowFallbacks: true, MaxAttempts: 2, Members: []accounts.AggregationMember{ + {Provider: "qoder", Model: "top", Priority: 0}, + {Provider: "qoder", Model: "lower", Priority: 1}, + }}) + ex := NewChatExecutor(pool, "") + loop := ex.newRouteLoop(RouteInput{AggregatePlan: plan, PublicModel: "logical"}, "logical", nil) + for i, want := range []string{"a-top", "b-top"} { + target, attempt, err := loop.pickNextReserved(ex) + if err != nil { + t.Fatal(err) + } + ex.releaseInFlight("", target.item.ID) + if attempt != i || target.item.ID != want || target.memberModel != "top" { + t.Fatalf("attempt %d = %s/%s (index %d), want %s/top", i, target.item.ID, target.memberModel, attempt, want) + } + if retry := loop.failover(ex, target, target.item.ID, Classified{Failover: true}, nil); retry != (i == 0) { + t.Fatalf("attempt %d retry=%t, cap must remain 2 across all tiers", i, retry) + } + } + if item, _ := reserveAggregateTest(t, pool, plan, RouteQuery{PublicModel: "logical"}); item.ID != "c-top" { + t.Fatalf("next request picks %q, want untried c-top in the best tier", item.ID) + } +} + +func TestAggregateSharedAccountCapacityIsAtomicAcrossMembers(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "shared", Provider: "qoder", Models: []string{"a", "b"}, MaxInFlight: 1}) + plan := NewAggregatePlan(accounts.Aggregation{ID: "logical", Strategy: accounts.AggregationRoundRobin}) + for _, model := range []string{"a", "b"} { + plan.Seats = append(plan.Seats, accounts.RouteSeat{ID: model, Kind: "member", Member: accounts.AggregationMember{Provider: "qoder", Model: model}}) + } + q := RouteQuery{PublicModel: "logical"} + const n = 16 + results := make(chan aggregateRouteResult, n) + start := make(chan struct{}) + var wg sync.WaitGroup + for i := 0; i < n; i++ { + wg.Add(1) + go func() { + defer wg.Done() + <-start + results <- pool.selectAggregate(plan, q, true) + }() + } + close(start) + wg.Wait() + close(results) + winners := 0 + for result := range results { + if result.Available { + if result.Member.Model != "a" { + t.Fatalf("winning initial model = %q, want a", result.Member.Model) + } + winners++ + } else if !result.Saturated { + t.Fatalf("losing reservation should report capacity, got %+v", result) + } + } + if item, _ := pool.ByID("shared"); winners != 1 || item.InFlight != 1 { + t.Fatalf("winners=%d, account in-flight=%d; want one atomic reservation", winners, item.InFlight) + } + pool.Release("shared") + if _, member := reserveAggregateTest(t, pool, plan, q); member.Model != "b" { + t.Fatalf("failed reservations moved the cursor: pick = %q, want b", member.Model) + } +} diff --git a/internal/executor/aggregation_route_contract_test.go b/internal/executor/aggregation_route_contract_test.go new file mode 100644 index 000000000..8e7850859 --- /dev/null +++ b/internal/executor/aggregation_route_contract_test.go @@ -0,0 +1,98 @@ +package executor + +import ( + "errors" + "io" + "net/http" + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/auth" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +func TestPreparedAggregateStreamRespectsExplicitNoFailover(t *testing.T) { + for _, tc := range []struct { + name, event, payload string + retryAfter time.Duration + }{ + {"worker-event", "error", `{"error":{"status":429,"message":"busy","code":"limited","failover":false}}`, time.Minute}, + {"nested-envelope", "", `{"statusCode":429,"retry_after":95,"failover":false,"body":{"error":{"message":"busy","code":"limited"}}}`, 95 * time.Second}, + } { + t.Run(tc.name, func(t *testing.T) { + var wire routeRegressionWire + pool := NewPool(nil, nil) + wire.add(t, pool, Item{ID: "primary", Provider: "qoder", Region: "cn", Models: []string{"primary-model"}}, func(w http.ResponseWriter, _ routeRegressionHit) { + w.Header().Set("Content-Type", "text/event-stream") + nl := string(rune(10)) + _, _ = io.WriteString(w, ": warming up"+nl+nl+"data:"+nl+nl) + if tc.event != "" { + _, _ = io.WriteString(w, "event: "+tc.event+nl) + } + _, _ = io.WriteString(w, "data: "+tc.payload+nl+nl) + }) + wire.add(t, pool, Item{ID: "backup", Provider: "workbuddy", Region: "cn", Models: []string{"backup-model"}}, nil) + ex := NewChatExecutor(pool, "") + resolver := &aggResolverStub{agg: accounts.Aggregation{ID: "no-switch", Enabled: true, Strategy: accounts.AggregationPriority, AllowFallbacks: true, MaxAttempts: 2, Members: []accounts.AggregationMember{ + {Provider: "qoder", Region: "cn", Model: "primary-model", Priority: 0}, + {Provider: "workbuddy", Region: "cn", Model: "backup-model", Priority: 1}, + }}} + p := routeRegressionPrepare(t, ex, PrepareInput{Request: translate.ChatRequest{Model: "no-switch", Stream: true}, Aggregations: resolver}) + _, attempts, err := routeRegressionExecute(t, ex, p) + got := ClassifyError(err) + if err == nil || attempts != 1 || got.Status != 429 || got.Code != "limited" || got.Failover || got.RetryAfter != tc.retryAfter { + t.Fatalf("attempts=%d failure=%+v err=%v", attempts, got, err) + } + wire.require(t, routeRegressionDispatchTo("primary", "primary-model", true)) + for _, id := range []string{"primary", "backup"} { + if item, _ := pool.ByID(id); item.InFlight != 0 { + t.Errorf("slot leaked for %s: %d", id, item.InFlight) + } + } + }) + } +} + +func TestPreparedAggregationKeyDoesNotRouteAliasToSameNamedRawModel(t *testing.T) { + var wire routeRegressionWire + pool := NewPool(nil, nil) + wire.add(t, pool, Item{ID: "a-raw", Provider: "qoder", Region: "cn", Models: []string{"friendly"}}, nil) + wire.add(t, pool, Item{ID: "b-global-alias", Provider: "qoder", Region: "global", Models: []string{"real"}, ModelAliases: map[string]string{"friendly": "real"}}, nil) + wire.add(t, pool, Item{ID: "z-granted-alias", Provider: "qoder", Region: "cn", Models: []string{"real"}, ModelAliases: map[string]string{"friendly": "real"}}, nil) + ex := NewChatExecutor(pool, "") + identity := auth.KeyIdentity(accounts.APIKey{ID: "agg-key", Enabled: true, ModelAggregation: true, Providers: []string{"qoder:cn"}}) + p := routeRegressionPrepare(t, ex, PrepareInput{Request: translate.ChatRequest{Model: "friendly"}, Identity: identity, ModelAggregation: true, PreferAccount: "a-raw"}) + if _, attempts, err := routeRegressionExecute(t, ex, p); err != nil || attempts != 1 { + t.Fatalf("attempts=%d err=%v", attempts, err) + } + wire.require(t, routeRegressionDispatchTo("z-granted-alias", "real", false)) +} + +func TestPreparedAggregationKeyDispatchesNamespacedGroupOnlyInGrantedRegion(t *testing.T) { + var wire routeRegressionWire + pool := NewPool(nil, nil) + wire.add(t, pool, Item{ID: "global", Provider: "qoder", Region: "global", Models: []string{"global-model"}}, nil) + wire.add(t, pool, Item{ID: "cn", Provider: "qoder", Region: "cn", Models: []string{"cn-model", "team/not-a-group"}}, nil) + ex := NewChatExecutor(pool, "") + resolver := &aggResolverStub{agg: accounts.Aggregation{ID: "team/review", Enabled: true, Strategy: accounts.AggregationPriority, Members: []accounts.AggregationMember{ + {Provider: "qoder", Region: "global", Model: "global-model", Priority: 0}, + {Provider: "qoder", Region: "cn", Model: "cn-model", Priority: 1}, + }}} + identity := auth.KeyIdentity(accounts.APIKey{ID: "agg-key", Enabled: true, ModelAggregation: true, Providers: []string{"qoder:cn"}}) + in := PrepareInput{Context: t.Context(), Request: translate.ChatRequest{Model: "team/review"}, Identity: identity, ModelAggregation: true, Aggregations: resolver} + p, err := ex.Prepare(in) + if err != nil { + t.Fatal(err) + } + if _, attempts, err := routeRegressionExecute(t, ex, p); err != nil || attempts != 1 { + t.Fatalf("attempts=%d err=%v", attempts, err) + } + in.Request.Model = "team/not-a-group" + _, err = ex.Prepare(in) + var rejected *PrepareError + if !errors.As(err, &rejected) || rejected.Code != "model_not_aggregated" { + t.Fatalf("unexpected result for non-group: %v", err) + } + wire.require(t, routeRegressionDispatchTo("cn", "cn-model", false)) +} diff --git a/internal/executor/aggregation_seats.go b/internal/executor/aggregation_seats.go index 274c8a8f4..b8f5ddf70 100644 --- a/internal/executor/aggregation_seats.go +++ b/internal/executor/aggregation_seats.go @@ -1,246 +1,144 @@ package executor import ( - "errors" "sort" "strconv" "strings" - "time" "github.com/caigee-cmd/cli2api/internal/accounts" ) -func (e ChatExecutor) pickSeats(requestID, prefer, providerFilter, regionFilter, publicModel string, allowed []string, excluded map[string]struct{}, eligible func(Item) bool, plan *AggregatePlan) (Item, error) { - order := e.orderedSeats(plan, publicModel, allowed, excluded, eligible, len(excluded) == 0) - var first error - for _, seat := range order { - child := planForSeat(plan, seat) - item, err := e.pick(requestID, prefer, providerFilter, regionFilter, publicModel, allowed, excluded, eligible, child) - if err == nil { - return item, nil - } - if first == nil { - first = err - } - if !seatMiss(err) { - return Item{}, err - } - } - if first != nil { - return Item{}, first - } - return Item{}, noAccountsError("no accounts available") +// aggregateNode is the query tree evaluated against one pool state. A flat +// node evaluates concrete members; an outer node orders seats, with each +// group seat retaining its own child strategy. +type aggregateNode struct { + strategy accounts.AggregationStrategy + members map[string][]accounts.AggregationMember + pins map[string][]accounts.AggregationMember + seats []aggregateSeat } -func (e ChatExecutor) orderedSeats(plan *AggregatePlan, publicModel string, allowed []string, excluded map[string]struct{}, eligible func(Item) bool, advance bool) []accounts.RouteSeat { - seats := append([]accounts.RouteSeat(nil), plan.Seats...) - switch plan.Strategy { - case accounts.AggregationFillFirst: - sort.SliceStable(seats, func(i, j int) bool { - if seats[i].Weight != seats[j].Weight { - return seats[i].Weight > seats[j].Weight - } - return seats[i].ID < seats[j].ID - }) - case accounts.AggregationLeastQuotaFirst, accounts.AggregationMostQuotaFirst: - ready := e.readyFor(plan, publicModel, allowed, excluded, eligible) - most := plan.Strategy == accounts.AggregationMostQuotaFirst - sort.SliceStable(seats, func(i, j int) bool { - left, leftOK := seatRatio(seats[i], ready) - right, rightOK := seatRatio(seats[j], ready) - if leftOK != rightOK { - return leftOK - } - if leftOK && left != right { - if most { - return left > right - } - return left < right - } - return seats[i].Priority < seats[j].Priority - }) - case accounts.AggregationFEFOStrategy: - ready := e.readyFor(plan, publicModel, allowed, excluded, eligible) - now := time.Now() - sort.SliceStable(seats, func(i, j int) bool { - left, leftOK := seatExpiry(seats[i], ready, now) - right, rightOK := seatExpiry(seats[j], ready, now) - if leftOK != rightOK { - return leftOK - } - if leftOK && left != right { - return left < right - } - return seats[i].Priority < seats[j].Priority - }) - case accounts.AggregationRoundRobin: - sort.SliceStable(seats, func(i, j int) bool { return seats[i].Priority < seats[j].Priority }) - // Seat ids come from the editable document and are not guaranteed - // unique. Rotate a stable key so a duplicate id cannot collapse two - // seats onto the map's last value. The list index is added only when - // two seats are otherwise identical, so reordering distinct seats - // does not move the cursor. - base := make([]string, len(seats)) - count := make(map[string]int, len(seats)) - for i, seat := range seats { - base[i] = seatRotationKey(seat) - count[base[i]]++ - } - keys := make([]string, len(seats)) - byKey := make(map[string]accounts.RouteSeat, len(seats)) - dup := make(map[string]int, len(seats)) - for i, seat := range seats { - key := base[i] - if count[key] > 1 { - n := dup[key] - dup[key]++ - key = key + "#" + strconv.Itoa(n) - } - keys[i] = key - byKey[key] = seat - } - if e.Pool != nil { - keys = e.Pool.RotateIDs(plan.ID+"|seats", keys, advance) - } - rotated := make([]accounts.RouteSeat, 0, len(keys)) - for _, key := range keys { - rotated = append(rotated, byKey[key]) - } - return rotated - default: - sort.SliceStable(seats, func(i, j int) bool { - if seats[i].Priority != seats[j].Priority { - return seats[i].Priority < seats[j].Priority - } - return seats[i].ID < seats[j].ID - }) - } - return seats +type aggregateSeat struct { + seat accounts.RouteSeat + key string + node *aggregateNode } -func (e ChatExecutor) readyFor(plan *AggregatePlan, publicModel string, allowed []string, excluded map[string]struct{}, eligible func(Item) bool) []Item { - if e.Pool == nil { - return nil - } - flat := *plan - flat.Seats = nil - return e.Pool.ReadyItems(e.routeQuery("", "", "", publicModel, allowed, excluded, eligible, &flat)) +func buildAggregateNode(plan *AggregatePlan) *aggregateNode { + return newAggregateNode(plan.Strategy, plan.byProvider, plan.Members, plan.Seats) } -func planForSeat(parent *AggregatePlan, seat accounts.RouteSeat) *AggregatePlan { - leaves := seatLeaves(seat) - id := parent.ID - strategy := accounts.AggregationPriority - if seat.Kind == "group" { - id = seat.GroupID - strategy = seat.GroupStrategy +func newAggregateNode(strategy accounts.AggregationStrategy, byProvider map[string][]accounts.AggregationMember, members []accounts.AggregationMember, seats []accounts.RouteSeat) *aggregateNode { + node := &aggregateNode{strategy: accounts.NormalizeAggregationStrategy(string(strategy))} + if len(seats) == 0 { + if byProvider == nil { + byProvider = indexAggregateMembers(members) + } + node.members = byProvider + for _, member := range members { + node.addPin(member) + } + return node } - plan := NewAggregatePlan(accounts.Aggregation{ - ID: id, Strategy: strategy, AllowFallbacks: parent.AllowFallbacks, MaxAttempts: parent.MaxAttempts, - ReasoningEffort: parent.ReasoningEffort, Members: leaves, + + ordered := append([]accounts.RouteSeat(nil), seats...) + sort.SliceStable(ordered, func(i, j int) bool { + if ordered[i].Priority != ordered[j].Priority { + return ordered[i].Priority < ordered[j].Priority + } + return node.strategy == accounts.AggregationPriority && ordered[i].ID < ordered[j].ID }) - if seat.Kind == "group" && len(seat.GroupSeats) > 0 { - plan.Seats = seat.GroupSeats - plan.Strategy = seat.GroupStrategy + for _, seat := range ordered { + if seat.Kind == "member" { + node.addPin(seat.Member) + } } - return plan -} -func seatLeaves(seat accounts.RouteSeat) []accounts.AggregationMember { - if seat.Kind == "member" { - return []accounts.AggregationMember{seat.Member} - } - if len(seat.GroupMembers) > 0 { - return append([]accounts.AggregationMember(nil), seat.GroupMembers...) - } - var out []accounts.AggregationMember - for _, child := range seat.GroupSeats { - out = append(out, seatLeaves(child)...) + // User-authored seat IDs are not guaranteed unique. Use the configured + // target and stable occurrence of identical seats, not just their IDs. + duplicates := make(map[string]int, len(ordered)) + for _, seat := range ordered { + base := seatRotationKey(seat) + occurrence := duplicates[base] + duplicates[base]++ + key := base + "#" + strconv.Itoa(occurrence) + var child *aggregateNode + switch seat.Kind { + case "member": + strategy := accounts.AggregationPriority + switch node.strategy { + case accounts.AggregationFEFOStrategy, accounts.AggregationLeastQuotaFirst, accounts.AggregationMostQuotaFirst: + // Direct seats have no child policy of their own. Rank their + // eligible accounts before comparing against other seats. + strategy = node.strategy + } + child = newAggregateNode(strategy, nil, []accounts.AggregationMember{seat.Member}, nil) + child.pins = node.pins + case "group": + child = newAggregateNode(seat.GroupStrategy, nil, seat.GroupMembers, seat.GroupSeats) + default: + continue + } + node.seats = append(node.seats, aggregateSeat{seat: seat, key: key, node: child}) } - return out + return node } -func seatRatio(seat accounts.RouteSeat, ready []Item) (float64, bool) { - plan := NewAggregatePlan(accounts.Aggregation{Members: seatLeaves(seat)}) - best := 0.0 - ok := false - for _, item := range ready { - if !plan.CanServeAccount(item) { - continue - } - ratio, known := quotaRemainingRatio(item) - if !known { - continue - } - if !ok || ratio < best { - best = ratio - ok = true - } +func (n *aggregateNode) addPin(member accounts.AggregationMember) { + if member.AccountID == "" { + return } - return best, ok + if n.pins == nil { + n.pins = make(map[string][]accounts.AggregationMember) + } + n.pins[member.AccountID] = append(n.pins[member.AccountID], member) } func seatRotationKey(seat accounts.RouteSeat) string { - switch seat.Kind { - case "member": + if seat.Kind == "member" { member := seat.Member return strings.Join([]string{ - "member", - seat.ID, - strings.TrimSpace(member.AccountID), - strings.ToLower(strings.TrimSpace(member.Provider)), - strings.ToLower(strings.TrimSpace(member.Region)), - strings.TrimSpace(member.Model), - strconv.Itoa(member.Priority), - }, "\x00") - default: - return strings.Join([]string{ - seat.Kind, - seat.ID, - seat.GroupID, - strconv.Itoa(seat.Priority), + "member", seat.ID, member.AccountID, aggregateMemberProvider(member.Provider), + member.Region, member.Model, strconv.Itoa(seat.Priority), strconv.Itoa(member.Priority), }, "\x00") } + return strings.Join([]string{seat.Kind, seat.ID, seat.GroupID, strconv.Itoa(seat.Priority)}, "\x00") } -func seatExpiry(seat accounts.RouteSeat, ready []Item, now time.Time) (int64, bool) { - plan := NewAggregatePlan(accounts.Aggregation{Members: seatLeaves(seat)}) - best := int64(0) - ok := false - for _, item := range ready { - member, matched := plan.matchMember(item) - if !matched { - continue - } - // FEFO packs are scoped to the concrete member model, not the logical - // aggregation id. The public logical model made a group seat look like - // it had no expiry at all. - expiry, depleted := fefoExpiry(item, member.Model, now) - if depleted || expiry == 0 { - continue - } - if !ok || expiry < best { - best = expiry - ok = true - } - } - return best, ok +func seatsCanServeAccount(seats []accounts.RouteSeat, item Item) bool { + return walkAggregateSeats(seats, func(member accounts.AggregationMember) bool { + return aggregateMemberProvider(member.Provider) == itemProvider(item) && + aggregateMemberInScope(item.ID, itemRegion(item), member) && itemCouldServeModel(item, member.Model) + }) } -func seatMiss(err error) bool { - var execution *ExecutionError - if !errors.As(err, &execution) { - return false - } - switch execution.Classified.Code { - case "model_not_available", "no_accounts_configured", "no_accounts", "rate_limit", "insufficient_quota": - return true - default: - return strings.Contains(execution.Classified.Message, "no accounts") +// walkAggregateSeats visits concrete leaves in configuration order and stops +// when visit returns true. GroupSeats is authoritative for nested groups. +func walkAggregateSeats(seats []accounts.RouteSeat, visit func(accounts.AggregationMember) bool) bool { + for _, seat := range seats { + switch seat.Kind { + case "member": + if visit(seat.Member) { + return true + } + case "group": + if len(seat.GroupSeats) > 0 { + if walkAggregateSeats(seat.GroupSeats, visit) { + return true + } + continue + } + for _, member := range seat.GroupMembers { + if visit(member) { + return true + } + } + } } + return false } -// PreviewAttempt is one concrete model in the order a request would try it. +// PreviewAttempt is one concrete model in the order configured for a route. type PreviewAttempt struct { ID string `json:"id"` Model string `json:"model"` @@ -251,7 +149,7 @@ type PreviewAttempt struct { } // ExplainSeats lists leaf members in seat order and marks leaves that have no -// ready account. +// ready account. Preview never reserves a slot or advances a rotation cursor. func ExplainSeats(pool *Pool, plan *AggregatePlan) []PreviewAttempt { if plan == nil { return nil @@ -263,24 +161,10 @@ func ExplainSeats(pool *Pool, plan *AggregatePlan) []PreviewAttempt { } return out } - var walk func(seats []accounts.RouteSeat) - walk = func(seats []accounts.RouteSeat) { - for _, seat := range seats { - switch seat.Kind { - case "member": - out = append(out, attemptFor(pool, plan, seat.Member)) - case "group": - if len(seat.GroupSeats) > 0 { - walk(seat.GroupSeats) - continue - } - for _, member := range seat.GroupMembers { - out = append(out, attemptFor(pool, plan, member)) - } - } - } - } - walk(plan.Seats) + walkAggregateSeats(plan.Seats, func(member accounts.AggregationMember) bool { + out = append(out, attemptFor(pool, plan, member)) + return false + }) return out } @@ -292,7 +176,7 @@ func attemptFor(pool *Pool, plan *AggregatePlan, member accounts.AggregationMemb return attempt } one := NewAggregatePlan(accounts.Aggregation{ID: plan.ID, Strategy: accounts.AggregationPriority, Members: []accounts.AggregationMember{member}}) - if len(pool.ReadyItems(RouteQuery{PublicModel: plan.ID, ModelResolver: one.resolver()})) == 0 { + if selected := pool.selectAggregate(one, RouteQuery{PublicModel: plan.ID}, false); !selected.Available { attempt.Status = "skipped" attempt.Reason = "no ready account" } diff --git a/internal/executor/aggregation_seats_test.go b/internal/executor/aggregation_seats_test.go index 635b41178..d60be16bf 100644 --- a/internal/executor/aggregation_seats_test.go +++ b/internal/executor/aggregation_seats_test.go @@ -2,39 +2,36 @@ package executor import ( "testing" + "time" "github.com/caigee-cmd/cli2api/internal/accounts" ) -func TestPriorityTierCountCountsNestedGroupLeaves(t *testing.T) { - plan := NewAggregatePlan(accounts.Aggregation{ID: "outer", Strategy: accounts.AggregationPriority}) - plan.Members = []accounts.AggregationMember{ - {Provider: "qoder", Model: "a", Priority: 0}, - {Provider: "qoder", Model: "b", Priority: 1}, - {Provider: "qoder", Model: "c", Priority: 2}, - } - plan.Seats = []accounts.RouteSeat{{ - ID: "group", Kind: "group", GroupStrategy: accounts.AggregationRoundRobin, - GroupMembers: plan.Members, - }} - if got := plan.PriorityTierCount(); got != 3 { - t.Fatalf("tier count = %d, want 3 leaf priorities", got) +func reserveAggregateTest(t *testing.T, pool *Pool, plan *AggregatePlan, q RouteQuery) (Item, accounts.AggregationMember) { + t.Helper() + item, member, found, reserved := pool.ReserveAggregate(plan, q) + if !found || !reserved { + t.Fatalf("aggregate reservation = %q/%q found=%t reserved=%t", item.ID, member.Model, found, reserved) } + pool.Release(item.ID) + return item, member } func TestRoundRobinKeepsDuplicateSeatIDs(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "shared", Provider: "qoder", Region: "global", Models: []string{"a", "b"}}) plan := NewAggregatePlan(accounts.Aggregation{ID: "outer", Strategy: accounts.AggregationRoundRobin}) - plan.Members = []accounts.AggregationMember{ - {Provider: "qoder", Model: "a", Priority: 0}, - {Provider: "qoder", Model: "b", Priority: 1}, - } plan.Seats = []accounts.RouteSeat{ - {ID: "same", Kind: "member", Member: plan.Members[0]}, - {ID: "same", Kind: "member", Member: plan.Members[1]}, + {ID: "same", Kind: "member", Member: accounts.AggregationMember{Provider: "qoder", Model: "a"}}, + {ID: "same", Kind: "member", Member: accounts.AggregationMember{Provider: "qoder", Model: "b"}}, + {ID: "same", Kind: "member", Member: accounts.AggregationMember{Provider: "qoder", Model: "a"}}, } - order := (ChatExecutor{}).orderedSeats(plan, "outer", nil, nil, nil, true) - if len(order) != 2 || order[0].Member.Model != "a" || order[1].Member.Model != "b" { - t.Fatalf("duplicate seat IDs collapsed the rotation: %+v", order) + q := RouteQuery{PublicModel: "outer"} + for i, want := range []string{"a", "b", "a", "a", "b", "a"} { + item, member := reserveAggregateTest(t, pool, plan, q) + if item.ID != "shared" || member.Model != want { + t.Fatalf("pick %d = %s/%s, want shared/%s", i, item.ID, member.Model, want) + } } } @@ -53,13 +50,277 @@ func TestSeatOrderDoesNotFlattenToModelName(t *testing.T) { {ID: "first", Kind: "member", Priority: 0, Weight: 100, Member: plan.Members[0]}, {ID: "second", Kind: "member", Priority: 1, Weight: 100, Member: plan.Members[1]}, } - exec := ChatExecutor{Pool: pool} - item, err := exec.pick("req", "", "", "", "outer", nil, map[string]struct{}{}, nil, plan) - if err != nil || item.ID != "z" { - t.Fatalf("first pick = %+v %v", item, err) + q := RouteQuery{PublicModel: "outer"} + item, member := reserveAggregateTest(t, pool, plan, q) + if item.ID != "z" || member.Model != "model-z" { + t.Fatalf("first pick = %s/%s", item.ID, member.Model) + } + q.ExcludedModels = map[routeModelKey]struct{}{accountRouteModelKey(item, member.Model): {}} + item, member = reserveAggregateTest(t, pool, plan, q) + if item.ID != "a" || member.Model != "model-a" { + t.Fatalf("second pick = %s/%s", item.ID, member.Model) + } +} + +func TestCompiledPriorityGroupRotatesWithinItsTier(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "z-top-a", Provider: "qoder", Models: []string{"a"}}) + pool.Upsert(Item{ID: "y-top-b", Provider: "qoder", Models: []string{"b"}}) + pool.Upsert(Item{ID: "a-low-c", Provider: "qoder", Models: []string{"c"}}) + pool.Upsert(Item{ID: "tail", Provider: "workbuddy", Models: []string{"tail"}}) + const doc = `{"version":1,"steps":[{"id":"group","kind":"group","aggregation_id":"inner"},{"id":"fallback","kind":"member","provider":"workbuddy","model":"tail"}]}` + inner := accounts.Aggregation{ID: "inner", Enabled: true, Strategy: accounts.AggregationPriority, Members: []accounts.AggregationMember{ + {Provider: "qoder", Model: "a", Priority: 4}, + {Provider: "qoder", Model: "b", Priority: 4}, + {Provider: "qoder", Model: "c", Priority: 7}, + }} + agg, seats, _, err := accounts.CompilePipeline(accounts.Aggregation{ID: "outer", Strategy: accounts.AggregationPriority, Document: doc}, map[string]accounts.Aggregation{inner.ID: inner}, "", nil, nil) + if err != nil { + t.Fatal(err) + } + plan := NewAggregatePlan(agg) + plan.Seats = seats + q := RouteQuery{PublicModel: "outer"} + for i, want := range []string{"b", "a", "b", "a"} { + _, member := reserveAggregateTest(t, pool, plan, q) + if member.Model != want || member.Priority != 4 { + t.Fatalf("pick %d = %+v, want member %s from tier 4", i, member, want) + } + } + q.ExcludedModels = map[routeModelKey]struct{}{{AccountID: "z-top-a", Model: "a"}: {}, {AccountID: "y-top-b", Model: "b"}: {}} + _, member := reserveAggregateTest(t, pool, plan, q) + if member.Model != "c" || member.Priority != 7 { + t.Fatalf("after tier 4 depletion picked %+v, want inner tier 7", member) + } + q.ExcludedModels[routeModelKey{AccountID: "a-low-c", Model: "c"}] = struct{}{} + _, member = reserveAggregateTest(t, pool, plan, q) + if member.Model != "tail" { + t.Fatalf("after exhausting the inner group picked %+v, want outer fallback", member) + } +} + +func TestAggregateSeatCursorAdvancesOnlyForAvailableReservations(t *testing.T) { + pool := NewPool(nil, nil) + for _, id := range []string{"a", "b", "c"} { + pool.Upsert(Item{ID: id, Provider: "qoder", Models: []string{id}, MaxInFlight: 1}) + } + plan := NewAggregatePlan(accounts.Aggregation{ID: "outer", Strategy: accounts.AggregationRoundRobin}) + for _, id := range []string{"a", "b", "c"} { + plan.Seats = append(plan.Seats, accounts.RouteSeat{ID: id, Kind: "member", Member: accounts.AggregationMember{Provider: "qoder", Model: id}}) + } + q := RouteQuery{PublicModel: "outer"} + if item, _ := reserveAggregateTest(t, pool, plan, q); item.ID != "a" { + t.Fatalf("first pick = %q, want a", item.ID) + } + for _, id := range []string{"a", "b", "c"} { + if !pool.Acquire(id) { + t.Fatalf("could not fill %s", id) + } + } + if miss := pool.selectAggregate(plan, q, true); miss.Available || !miss.Saturated || !miss.HasRoute { + t.Fatalf("saturated reservation = %+v", miss) + } + if !pool.HasAggregateRoute(plan, q) { + t.Fatal("saturation must not hide capability") + } + pool.Release("c") + if probe := pool.selectAggregate(plan, q, false); !probe.Available || probe.Item.ID != "c" || probe.Item.InFlight != 0 { + t.Fatalf("read-only probe = %+v", probe) + } + pool.Release("b") + if item, _ := reserveAggregateTest(t, pool, plan, q); item.ID != "b" { + t.Fatalf("after miss and probes pick = %q, want b after a", item.ID) + } + pool.Release("a") +} + +func TestAggregateSeatCursorCommitsTheWinnerNotTheStart(t *testing.T) { + pool := NewPool(nil, nil) + plan := NewAggregatePlan(accounts.Aggregation{ID: "outer", Strategy: accounts.AggregationRoundRobin}) + for _, id := range []string{"a", "b", "c"} { + pool.Upsert(Item{ID: id, Provider: "qoder", Models: []string{id}, MaxInFlight: 1}) + plan.Seats = append(plan.Seats, accounts.RouteSeat{ID: id, Kind: "member", Member: accounts.AggregationMember{Provider: "qoder", Model: id}}) + } + q := RouteQuery{PublicModel: "outer"} + if !pool.Acquire("a") { + t.Fatal("could not saturate a") + } + if item, _ := reserveAggregateTest(t, pool, plan, q); item.ID != "b" { + t.Fatalf("with a saturated pick = %q, want b", item.ID) + } + pool.Release("a") + if item, _ := reserveAggregateTest(t, pool, plan, q); item.ID != "c" { + t.Fatalf("after b was reserved pick = %q, want c", item.ID) + } +} + +func TestCompiledMultiAccountFillFirstKeepsSelectedScope(t *testing.T) { + const memberStep = `{"id":"selected","kind":"member","provider":"qoder","model":"model","weight":450,"account_ids":["z-checked","a-checked","z-checked"]}` + inner := accounts.Aggregation{ID: "inner", Enabled: true, Members: []accounts.AggregationMember{{Provider: "qoder", Model: "no-ready-model"}}} + for _, tc := range []struct { + name string + steps string + }{ + {name: "flat", steps: memberStep}, + {name: "nested", steps: memberStep + `,{"id":"group","kind":"group","aggregation_id":"inner"}`}, + } { + t.Run(tc.name, func(t *testing.T) { + pool := NewPool(nil, nil) + for _, id := range []string{"a-checked", "z-checked", "0-unchecked"} { + pool.Upsert(Item{ID: id, Provider: "qoder", Models: []string{"model"}, MaxInFlight: 1}) + } + compiled, seats, _, err := accounts.CompilePipeline(accounts.Aggregation{ + ID: "logical", Strategy: accounts.AggregationFillFirst, Document: `{"version":1,"steps":[` + tc.steps + `]}`, + }, map[string]accounts.Aggregation{inner.ID: inner}, "", nil, nil) + if err != nil { + t.Fatal(err) + } + plan := NewAggregatePlan(compiled) + plan.Seats = seats + q := RouteQuery{PublicModel: plan.ID} + first, _ := reserveAggregateTest(t, pool, plan, q) + if first.ID != "a-checked" && first.ID != "z-checked" { + t.Fatalf("picked unchecked account %s", first.ID) + } + if item, member := reserveAggregateTest(t, pool, plan, q); item.ID != first.ID || member.Weight != 450 { + t.Fatalf("equal-weight fill-first did not retain its winner and configured weight: %s, %+v", item.ID, member) + } + fill := func(id string) { + if !pool.Acquire(id) { + t.Fatalf("could not fill %s", id) + } + t.Cleanup(func() { pool.Release(id) }) + } + fill(first.ID) + second, _ := reserveAggregateTest(t, pool, plan, q) + if second.ID == first.ID || (second.ID != "a-checked" && second.ID != "z-checked") { + t.Fatalf("with %s full, got %s instead of the other checked account", first.ID, second.ID) + } + fill(second.ID) + if result := pool.selectAggregate(plan, q, true); result.Available || !result.Saturated || !result.HasRoute { + t.Fatalf("saturated selected accounts must not broaden the route: %+v", result) + } + }) + } +} + +func compileAggregateSeatTest(t *testing.T, strategy accounts.AggregationStrategy) *AggregatePlan { + t.Helper() + const doc = `{"version":1,"steps":[{"id":"group","kind":"group","aggregation_id":"inner"},{"id":"direct","kind":"member","provider":"qoder","model":"direct"}]}` + inner := accounts.Aggregation{ID: "inner", Enabled: true, Strategy: accounts.AggregationPriority, Members: []accounts.AggregationMember{ + {Provider: "qoder", Model: "chosen", Priority: 0}, + {Provider: "qoder", Model: "unchosen", Priority: 1}, + }} + compiled, seats, _, err := accounts.CompilePipeline(accounts.Aggregation{ID: "outer", Strategy: strategy, Document: doc}, map[string]accounts.Aggregation{inner.ID: inner}, "", nil, nil) + if err != nil { + t.Fatal(err) + } + plan := NewAggregatePlan(compiled) + plan.Seats = seats + return plan +} + +func TestAggregateNestedQuotaRanksTheChildStrategyWinner(t *testing.T) { + pool := NewPool(nil, nil) + for model, remaining := range map[string]float64{"chosen": 90, "unchosen": 10, "direct": 50} { + pool.Upsert(Item{ID: model, Provider: "qoder", Models: []string{model}, Quota: &accounts.QuotaSnapshot{Total: 100, Remaining: remaining}}) + } + for strategy, want := range map[accounts.AggregationStrategy]string{ + accounts.AggregationLeastQuotaFirst: "direct", + accounts.AggregationMostQuotaFirst: "chosen", + } { + t.Run(string(strategy), func(t *testing.T) { + plan := compileAggregateSeatTest(t, strategy) + item, member := reserveAggregateTest(t, pool, plan, RouteQuery{PublicModel: "outer"}) + if item.ID != want || member.Model != want { + t.Fatalf("picked %s/%s, want %s from child strategy winners", item.ID, member.Model, want) + } + }) + } +} + +func TestAggregateNestedFEFORanksTheChildStrategyWinner(t *testing.T) { + pool := NewPool(nil, nil) + now := time.Now() + for model, in := range map[string]time.Duration{"chosen": 72 * time.Hour, "unchosen": 24 * time.Hour, "direct": 48 * time.Hour} { + pool.Upsert(Item{ID: model, Provider: "qoder", Models: []string{model}, Quota: &accounts.QuotaSnapshot{Packages: []accounts.QuotaPackage{ + {Scope: accounts.QuotaPackageScopeAccountFEFO, Unit: "credits", Remain: 1, EndsAt: now.Add(in).Unix()}, + }}}) + } + plan := compileAggregateSeatTest(t, accounts.AggregationFEFOStrategy) + q := RouteQuery{PublicModel: "outer"} + result := pool.selectAggregate(plan, q, true) + if !result.Available || !result.FEFO || result.Item.ID != "direct" || result.Member.Model != "direct" { + t.Fatalf("first pick = %+v, want direct in the outer FEFO path", result) + } + pool.Release(result.Item.ID) + q.ExcludedModels = map[routeModelKey]struct{}{accountRouteModelKey(result.Item, result.Member.Model): {}} + item, member := reserveAggregateTest(t, pool, plan, q) + if item.ID != "chosen" || member.Model != "chosen" { + t.Fatalf("next pick = %s/%s, want the child's top-priority member", item.ID, member.Model) + } +} + +func TestAggregateNestedQuotaAndFEFOConsiderEveryDirectAccount(t *testing.T) { + for _, tc := range []struct { + strategy accounts.AggregationStrategy + worst float64 + best float64 + }{ + {accounts.AggregationLeastQuotaFirst, 90, 10}, + {accounts.AggregationMostQuotaFirst, 10, 90}, + {accounts.AggregationFEFOStrategy, 50, 50}, + } { + t.Run(string(tc.strategy), func(t *testing.T) { + pool := NewPool(nil, nil) + now := time.Now() + add := func(id, model string, ratio float64, days time.Duration) { + pool.Upsert(Item{ID: id, Provider: "qoder", Models: []string{model}, MaxInFlight: 1, Quota: &accounts.QuotaSnapshot{ + Total: 100, Remaining: ratio, Packages: []accounts.QuotaPackage{fefoPack(1, now.Add(days*24*time.Hour).Unix())}, + }}) + } + add("a-direct", "direct", tc.worst, 3) + add("z-direct", "direct", tc.best, 1) + add("middle", "chosen", 50, 2) + plan := compileAggregateSeatTest(t, tc.strategy) + q := RouteQuery{PublicModel: plan.ID} + flat := *plan + flat.Seats = nil // same models and accounts, with no nested seat boundary + if result := pool.selectAggregate(&flat, q, false); !result.Available || result.Item.ID != "z-direct" { + t.Fatalf("flat picked %q, want z-direct", result.Item.ID) + } + for i := 0; i < 2; i++ { + item, _ := reserveAggregateTest(t, pool, plan, q) + if item.ID != "z-direct" { + t.Fatalf("nested pick %d = %s, want z-direct as in the flat route; a direct member has no separate child strategy", i, item.ID) + } + } + if !pool.Acquire("z-direct") { + t.Fatal("could not fill the best direct account") + } + t.Cleanup(func() { pool.Release("z-direct") }) + if item, _ := reserveAggregateTest(t, pool, plan, q); item.ID != "middle" { + t.Fatalf("with z-direct full, picked %s, want middle", item.ID) + } + }) + } +} + +func TestAggregateFEFOOnlyReportsTheSelectedChildPath(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "fefo", Provider: "qoder", Models: []string{"fefo"}}) + pool.Upsert(Item{ID: "direct", Provider: "qoder", Models: []string{"direct"}}) + plan := NewAggregatePlan(accounts.Aggregation{ID: "outer", Strategy: accounts.AggregationRoundRobin}) + plan.Seats = []accounts.RouteSeat{ + {ID: "group", Kind: "group", GroupID: "child", GroupStrategy: accounts.AggregationFEFOStrategy, GroupMembers: []accounts.AggregationMember{{Provider: "qoder", Model: "fefo"}}}, + {ID: "direct", Kind: "member", Member: accounts.AggregationMember{Provider: "qoder", Model: "direct"}}, } - item, err = exec.pick("req", "", "", "", "outer", nil, map[string]struct{}{"z": {}}, nil, plan) - if err != nil || item.ID != "a" { - t.Fatalf("second pick = %+v %v", item, err) + q := RouteQuery{PublicModel: "outer"} + for _, want := range []string{"fefo", "direct", "fefo"} { + result := pool.selectAggregate(plan, q, true) + if !result.Available || result.Member.Model != want || result.FEFO != (want == "fefo") { + t.Fatalf("pick = %+v, want %s and its own path's FEFO flag", result, want) + } + pool.Release(result.Item.ID) } } diff --git a/internal/executor/aggregation_strategy_test.go b/internal/executor/aggregation_strategy_test.go index 1faf09137..5b9970dfb 100644 --- a/internal/executor/aggregation_strategy_test.go +++ b/internal/executor/aggregation_strategy_test.go @@ -1,24 +1,12 @@ package executor import ( - "context" "testing" "time" "github.com/caigee-cmd/cli2api/internal/accounts" - "github.com/caigee-cmd/cli2api/internal/translate" ) -func aggRouteQuery(plan *AggregatePlan) RouteQuery { - return RouteQuery{ - PublicModel: "my-model", - ModelResolver: plan.resolver(), - StrategyOverride: string(plan.Strategy), - PriorityResolver: plan.priorityResolver(), - WeightResolver: plan.weightResolver(), - } -} - // A member with AccountID is a deployment pinned to that account rather than // the whole provider pool. Sibling accounts keep serving legacy members but // cannot satisfy this member. @@ -41,9 +29,9 @@ func TestAggregateMemberAccountPin(t *testing.T) { t.Fatalf("q2 member = %+v ok=%v", member, ok) } for i := 0; i < 5; i++ { - item, ok := p.PickRoute(aggRouteQuery(plan)) - if !ok || item.ID != "q2" { - t.Fatalf("pinned member pick %d = %+v ok=%v", i, item, ok) + item, _ := reserveAggregateTest(t, p, plan, RouteQuery{PublicModel: plan.ID}) + if item.ID != "q2" { + t.Fatalf("pinned member pick %d = %+v", i, item) } } } @@ -62,9 +50,9 @@ func TestAggregateExcludesUnknownCatalogOutsideMemberRegion(t *testing.T) { }, }) for i := 0; i < 10; i++ { - item, ok := p.PickRoute(aggRouteQuery(plan)) - if !ok || item.ID != "q-global" { - t.Fatalf("aggregate pick %d = %+v ok=%v, want q-global", i, item, ok) + item, _ := reserveAggregateTest(t, p, plan, RouteQuery{PublicModel: plan.ID}) + if item.ID != "q-global" { + t.Fatalf("aggregate pick %d = %+v, want q-global", i, item) } } } @@ -97,11 +85,11 @@ func TestAggregatePriorityAlwaysPicksHighestPriority(t *testing.T) { {Provider: "qoder", Model: "model-a", Priority: 1, Weight: 100}, }, }) - q := aggRouteQuery(plan) + q := RouteQuery{PublicModel: plan.ID} for i := 0; i < 10; i++ { - item, ok := p.PickRoute(q) - if !ok || item.ID != "workbuddy" { - t.Fatalf("priority strategy pick %d = %+v (%v), want workbuddy", i, item, ok) + item, _ := reserveAggregateTest(t, p, plan, q) + if item.ID != "workbuddy" { + t.Fatalf("priority strategy pick %d = %+v, want workbuddy", i, item) } } } @@ -117,10 +105,66 @@ func TestAggregatePriorityFallsToNextOnCooldown(t *testing.T) { }) // Cool the top-priority member's real model. top, _ := p.ByID("workbuddy") - p.MarkClassified("workbuddy", Classified{Kind: KindRateLimit, Model: effectiveModel(top, aggRouteQuery(plan)), Cooldown: time.Minute}) - item, ok := p.PickRoute(aggRouteQuery(plan)) - if !ok || item.ID != "qoder" { - t.Fatalf("after top-priority cooldown want qoder, got %+v ok=%v", item, ok) + p.MarkClassified("workbuddy", Classified{Kind: KindRateLimit, Model: cooldownModel(top, "model-b"), Cooldown: time.Minute}) + item, _ := reserveAggregateTest(t, p, plan, RouteQuery{PublicModel: plan.ID}) + if item.ID != "qoder" { + t.Fatalf("after top-priority cooldown want qoder, got %+v", item) + } +} + +func TestAggregateQuotaGateUsesResolvedAliasTarget(t *testing.T) { + for _, layout := range []string{"flat", "nested"} { + for _, strategy := range []accounts.AggregationStrategy{accounts.AggregationPriority, accounts.AggregationFEFOStrategy} { + for _, gate := range []struct { + name string + quota accounts.QuotaSnapshot + }{ + {name: "exhausted", quota: accounts.QuotaSnapshot{Exceeded: true}}, + {name: "credit-floor", quota: accounts.QuotaSnapshot{Unit: "credits", Remaining: 1}}, + } { + t.Run(layout+"/"+string(strategy)+"/"+gate.name, func(t *testing.T) { + pool := NewPool(nil, nil) + pool.SetDefaultCreditFloor(10) + pool.Upsert(Item{ + ID: "account", Provider: "qoder", Models: []string{"free", "paid"}, + // Dispatch resolves aliases exactly once. "free" used as + // a member name points at paid, not the free entry in the catalog. + ModelAliases: map[string]string{"free-alias": "free", "free": "paid"}, + FreeModels: []string{"free"}, Quota: &gate.quota, + }) + for _, tc := range []struct { + model string + available bool + }{ + {model: "free-alias", available: true}, + {model: "free", available: false}, + } { + t.Run(tc.model, func(t *testing.T) { + members := []accounts.AggregationMember{{Provider: "qoder", Model: tc.model, AccountID: "account"}} + plan := NewAggregatePlan(accounts.Aggregation{ID: "logical", Strategy: strategy, Members: members}) + if layout == "nested" { + plan.Strategy = accounts.AggregationPriority + plan.Seats = []accounts.RouteSeat{{ID: "group", Kind: "group", GroupID: "inner", GroupStrategy: strategy, GroupMembers: members}} + } + q := RouteQuery{PublicModel: plan.ID} + if !pool.HasAggregateRoute(plan, q) { + t.Fatalf("quota must not hide the %q capability", tc.model) + } + result := pool.selectAggregate(plan, q, true) + if result.Available { + pool.Release(result.Item.ID) + } + if result.Available != tc.available || result.QuotaBlocked != !tc.available { + t.Fatalf("%q pick available=%t quotaBlocked=%t, want available=%t quotaBlocked=%t", tc.model, result.Available, result.QuotaBlocked, tc.available, !tc.available) + } + if result.Available && (result.Member.Model != tc.model || targetFor(result.Item, result.Member.Model).upstreamModel != "free") { + t.Fatalf("reservation must keep the configured spelling and dispatch the real free model, got %+v", result) + } + }) + } + }) + } + } } } @@ -137,8 +181,8 @@ func TestAggregateFillFirstUsesMemberWeight(t *testing.T) { p.items[1].Weight = 1 // workbuddy account weight tiny p.items[0].Weight = 200 // qoder account weight large for i := 0; i < 6; i++ { - item, ok := p.PickRoute(aggRouteQuery(plan)) - if !ok || item.ID != "workbuddy" { + item, _ := reserveAggregateTest(t, p, plan, RouteQuery{PublicModel: plan.ID}) + if item.ID != "workbuddy" { t.Fatalf("fill-first should use member weight, pick %d = %+v", i, item) } } @@ -154,13 +198,10 @@ func TestAggregateRoundRobinRotates(t *testing.T) { {Provider: "qoder", Model: "model-a", Priority: 1, Weight: 100}, }, }) - q := aggRouteQuery(plan) + q := RouteQuery{PublicModel: plan.ID} seen := map[string]bool{} for i := 0; i < 6; i++ { - item, ok := p.PickRoute(q) - if !ok { - t.Fatal("no route") - } + item, _ := reserveAggregateTest(t, p, plan, q) seen[item.ID] = true } if !seen["workbuddy"] || !seen["qoder"] { @@ -185,13 +226,10 @@ func TestAggregateRoundRobinDoesNotLatchRegion(t *testing.T) { {Provider: "workbuddy", Model: "shared", Priority: 0, Weight: 100}, }, }) - q := aggRouteQuery(plan) + q := RouteQuery{PublicModel: plan.ID} counts := map[string]int{} for i := 0; i < 20; i++ { - item, ok := p.PickRoute(q) - if !ok { - t.Fatal("no aggregate route") - } + item, _ := reserveAggregateTest(t, p, plan, q) counts[item.Provider]++ } if counts["qoder"] == 0 || counts["workbuddy"] == 0 { @@ -224,35 +262,38 @@ func TestAggregateFailoverCrossesMemberRegions(t *testing.T) { {Provider: "workbuddy", Region: "", Model: "shared", Priority: 1, Weight: 100}, }, }) - ctx := WithAggregatePlan(context.Background(), plan) e := ChatExecutor{Pool: p} - loop := e.newRouteLoop(ctx, "", "", translate.ChatRequest{Model: "my-model"}) + loop := e.newRouteLoop(RouteInput{AggregatePlan: plan, PublicModel: "my-model"}, "my-model", nil) - first, _, err := loop.pickNext(e, "my-model") + first, _, err := loop.pickNextReserved(e) if err != nil { t.Fatalf("first pick: %v", err) } - if got := NormalizeRegion(first.Region); got != "cn" { + if got := NormalizeRegion(first.item.Region); got != "cn" { t.Fatalf("first pick region=%q, want cn", got) } - if loop.regionFilter != "" { - t.Fatalf("aggregated loop must not pin a region, got %q", loop.regionFilter) + e.releaseInFlight("", first.item.ID) + if loop.working.RegionFilter != "" { + t.Fatalf("aggregated loop must not pin a region, got %q", loop.working.RegionFilter) } - if loop.attempts != 2 { - t.Fatalf("attempts after first pick=%d, want 2 (plan.MaxAttempts capped by candidates)", loop.attempts) + if loop.attempts != 3 { + t.Fatalf("attempts after first pick=%d, want 3 (plan.MaxAttempts is a total budget)", loop.attempts) } // A second attempt must be allowed to cross the member region. Excluding the // cn member leaves the global workbuddy member as the next candidate. - loop.excluded[first.ID] = struct{}{} - second, _, err := loop.pickNext(e, "my-model") + if !loop.failover(e, first, first.item.ID, Classified{Failover: true}, nil) { + t.Fatal("expected remaining attempt budget") + } + second, _, err := loop.pickNextReserved(e) if err != nil { t.Fatalf("failover should reach the global member: %v", err) } - if got := NormalizeRegion(second.Region); got != "global" { + e.releaseInFlight("", second.item.ID) + if got := NormalizeRegion(second.item.Region); got != "global" { t.Fatalf("failover region=%q, want global", got) } - if loop.attempts != 2 { - t.Fatalf("attempts after failover=%d, want 2 (plan.MaxAttempts must not be overwritten)", loop.attempts) + if loop.attempts != 3 { + t.Fatalf("attempts after failover=%d, want 3 (plan.MaxAttempts must not be overwritten)", loop.attempts) } } diff --git a/internal/executor/chat.go b/internal/executor/chat.go index 11116216e..0a5ba6974 100644 --- a/internal/executor/chat.go +++ b/internal/executor/chat.go @@ -12,7 +12,6 @@ import ( "net/http" "sort" "strings" - "sync" "time" "github.com/caigee-cmd/cli2api/internal/accounts" @@ -55,11 +54,16 @@ type ChatResult struct { Credits *float64 ConsumedCredits *float64 AccountID string + PoolAccountID string Provider string AttemptCount int RawNote string Routing string ReasoningLevel string + // CooldownModel is the canonical account model key, never a virtual + // aggregate ID, per-account alias, or response model label. + CooldownModel string + AggregateFEFO bool } type StreamResult struct { @@ -74,14 +78,23 @@ type StreamResult struct { TTFBMs int Routing string ReasoningLevel string + // CooldownModel is the effective model key used by routing/cooldown. See + // ChatResult.CooldownModel. + CooldownModel string + AggregateFEFO bool // NativeResponses marks the body as an upstream OpenAI Responses SSE stream // that /v1/responses can relay verbatim instead of translating. NativeResponses bool + completion *streamCompletion } type NativeResponseResult struct { - Response json.RawMessage + Response json.RawMessage + // CompatResult is set when a named aggregate selects a Chat member + // for a request that also has a compatible Chat representation. + CompatResult *ChatResult AccountID string + PoolAccountID string Provider string AttemptCount int Routing string @@ -90,6 +103,8 @@ type NativeResponseResult struct { PromptTokens *int OutputTokens *int CachedTokens *int + CooldownModel string + AggregateFEFO bool } type requestIDKey struct{} @@ -172,14 +187,15 @@ type routingPlan struct { Source string SessionKey string BoundAccount string + BoundVersion uint64 PublicModel string } -func (e ChatExecutor) bindSession(plan routingPlan, accountID string) { +func (e ChatExecutor) bindSession(plan routingPlan, accountID string) uint64 { if plan.Source == routingPin || plan.SessionKey == "" || e.SessionAffinity == nil { - return + return 0 } - e.SessionAffinity.Bind(plan.SessionKey, accountID) + return e.SessionAffinity.bindVersion(plan.SessionKey, accountID) } func (e ChatExecutor) observeRouting(plan *routingPlan, accountID string) { @@ -239,62 +255,13 @@ func itemProvider(item Item) string { // the same model so regional escape still works, but does not let that // unknown catalog pin a later, different model (Devin → Deepseek compact). func stickyAccountCanServeModel(item Item, publicModel string) bool { - if item.Models != nil { - return ItemCouldServeModel(item, publicModel) - } - if strings.TrimSpace(publicModel) == "" { - return true - } - if len(item.ProvenModels) == 0 { - return true - } - probe := item - probe.Models = []string{} - return ItemCouldServeModel(probe, publicModel) -} - -func (e ChatExecutor) prepareRouting(ctx context.Context, prefer, providerFilter string, req translate.ChatRequest, plan *AggregatePlan) (string, string, string, routingPlan) { - prefer = strings.TrimSpace(prefer) - providerFilter = strings.ToLower(strings.TrimSpace(providerFilter)) - publicModel := req.Model - if prefer != "" { - return prefer, providerFilter, "", routingPlan{Source: routingPin, PublicModel: publicModel} - } - - planRoute := routingPlan{Source: routingPool, SessionKey: resolveSessionKey(ctx, req), PublicModel: publicModel} - if planRoute.SessionKey == "" || e.SessionAffinity == nil || e.Pool == nil { - return "", providerFilter, "", planRoute - } - accountID, ok := e.SessionAffinity.Get(planRoute.SessionKey) - if !ok { - return "", providerFilter, "", planRoute - } - item, ok := e.Pool.ByID(accountID) - if !ok { - e.SessionAffinity.RecordEscape("account_missing") - e.SessionAffinity.Forget(planRoute.SessionKey) - return "", providerFilter, "", planRoute - } - if providerFilter != "" && providerFilter != itemProvider(item) { - e.SessionAffinity.RecordEscape("provider_mismatch") - return "", providerFilter, "", planRoute - } - if !accounts.ProviderRegionAllowed(itemProvider(item), accounts.NormalizeRegion(item.Region), allowedProvidersFrom(ctx)) { - e.SessionAffinity.RecordEscape("provider_not_allowed") - return "", providerFilter, "", planRoute - } - if plan != nil { - if !plan.CanServeAccount(item) { - e.SessionAffinity.RecordEscape("model_unavailable") - return "", providerFilter, "", planRoute - } - } else if !stickyAccountCanServeModel(item, publicModel) { - e.SessionAffinity.RecordEscape("model_unavailable") - return "", providerFilter, "", planRoute - } - return item.ID, itemProvider(item), accounts.NormalizeRegion(item.Region), routingPlan{ - Source: routingSticky, SessionKey: planRoute.SessionKey, BoundAccount: item.ID, PublicModel: publicModel, + if item.Models == nil && len(item.ProvenModels) > 0 { + // A catalog is unknown, but the session has evidence for other models. + item.Models = []string{} } + // Even without positive evidence, an explicit rejection (including an + // alias target) or a model restriction must rule out sticky preference. + return ItemCouldServeModel(item, publicModel) } func NewChatExecutor(pool *Pool, workerKey string) ChatExecutor { @@ -324,30 +291,6 @@ func capacityError(err error) bool { return execution.Classified.Code == "rate_limit" && execution.Classified.Message == "all accounts at capacity" } -// providerHasCapacity reports whether any provider other than the pinned one -// can take this model right now. The caller's own provider filter is a -// constraint, so saturation inside it is not a reason to leave. -func (e ChatExecutor) providerHasCapacity(pinnedProvider, pinnedRegion, publicModel string, allowed []string, eligible func(Item) bool) bool { - if e.Pool == nil || pinnedProvider == "" { - return false - } - query := e.routeQuery("", "", "", publicModel, allowed, nil, func(item Item) bool { - if itemProvider(item) == pinnedProvider && (pinnedRegion == "" || accounts.NormalizeRegion(item.Region) == pinnedRegion) { - return false - } - // A cooling account is not a free slot. HasCapacity also rejects one, - // but only after routeMatches, and a model-scoped cooldown would - // otherwise look like capacity and make a full provider leave for an - // account the next pick cannot dispatch. - now := time.Now() - if itemDown(item, now) || itemModelDown(item, RouteQuery{PublicModel: publicModel}, now) { - return false - } - return eligible == nil || eligible(item) - }) - return e.Pool.HasCapacity(query) -} - func (e ChatExecutor) routeQuery(prefer, providerFilter, regionFilter, publicModel string, allowed []string, excluded map[string]struct{}, eligible func(Item) bool, plan ...*AggregatePlan) RouteQuery { q := RouteQuery{ PublicModel: publicModel, @@ -370,89 +313,6 @@ func (e ChatExecutor) routeQuery(prefer, providerFilter, regionFilter, publicMod return q } -func (e ChatExecutor) pick(requestID, prefer, providerFilter, regionFilter, publicModel string, allowed []string, excluded map[string]struct{}, eligible func(Item) bool, plan *AggregatePlan) (Item, error) { - if plan != nil && len(plan.Seats) > 0 { - return e.pickSeats(requestID, prefer, providerFilter, regionFilter, publicModel, allowed, excluded, eligible, plan) - } - query := e.routeQuery(prefer, providerFilter, regionFilter, publicModel, allowed, excluded, eligible, plan) - if e.Pool != nil { - if item, ok := e.Pool.PickRoute(query); ok { - if retryAfter := e.Pool.RetryAfter(item, publicModel, query.ModelResolver); retryAfter > 0 { - return Item{}, coolingPickError(item, publicModel, retryAfter) - } - return item, nil - } - // PickRoute returned false with an eligible route: every - // eligible account is concurrency-saturated (a cooling account - // would have been surfaced with ok=true for a retry-after hint). - // Sending the request would just round-trip into the worker's - // 429 busy, so fail fast with a rate-limit so the client gets a - // clean Retry-After. This must precede the model_not_available - // check: saturated means the model IS served, just at capacity. - if e.Pool.LenRoute(query) > 0 { - return Item{}, NewExecutionError(Classified{ - Kind: accounts.KindRateLimit, Status: 429, Code: "rate_limit", - Type: "api_error", Message: "all accounts at capacity", - Cooldown: 5 * time.Second, RetryAfter: 5 * time.Second, Failover: true, - }, nil) - } - // No eligible account is ready right now. Before blaming the model or - // reporting "no accounts available", check whether accounts that could - // serve this model are blocked only by an exhausted quota. A stale or - // genuinely exhausted snapshot leaves no routing hint, so without this - // the client sees a generic "no accounts available" instead of a quota - // error that explains the real cause. - if _, ok := e.Pool.QuotaBlockedForModel(query); ok { - retryAfter := NextLocalMidnightCooldown() - return Item{}, NewExecutionError(Classified{ - Kind: accounts.KindQuota, Status: 429, Code: "insufficient_quota", - Type: "insufficient_quota", Failover: false, - Cooldown: retryAfter, RetryAfter: retryAfter, - Message: quotaBlockedMessage(publicModel), - }, nil) - } - if publicModel != "" && publicModel != "auto" { - unfiltered := query - unfiltered.PublicModel = "" - if e.Pool.LenRoute(unfiltered) > 0 { - e.logModelRouteMiss(requestID, query) - return Item{}, NewExecutionError(Classified{ - Kind: accounts.KindModelNotAvailable, Status: http.StatusBadRequest, - Code: "model_not_available", Type: "invalid_request_error", Failover: false, - Message: fmt.Sprintf("model_not_available: %s is not available for the selected accounts", publicModel), - }, nil) - } - } - } - if len(allowed) > 0 && providerFilter != "" && !accounts.ProviderAllowed(providerFilter, allowed) { - return Item{}, NewExecutionError(Classified{ - Kind: accounts.KindAuth, Status: http.StatusForbidden, Code: "provider_not_allowed", - Type: "permission_error", Failover: false, - Message: fmt.Sprintf("api key cannot use provider %s", providerFilter), - }, nil) - } - if providerFilter != "" && regionFilter != "" { - return Item{}, noAccountsError(fmt.Sprintf("no %s/%s accounts available", providerFilter, regionFilter)) - } - if providerFilter != "" { - // A key whose grant list narrows this family to a single region - // should fail with that region in the message, even when the - // request itself did not pin one. - if regionFilter, narrowed := keyGrantedSingleRegion(providerFilter, allowed); narrowed { - return Item{}, noAccountsError(fmt.Sprintf("no %s/%s accounts available", providerFilter, regionFilter)) - } - return Item{}, noAccountsError(fmt.Sprintf("no %s accounts available", providerFilter)) - } - if len(allowed) > 0 { - return Item{}, noAccountsError("no accounts available for this api key") - } - return Item{}, NewExecutionError(Classified{ - Kind: accounts.KindUnavailable, Status: http.StatusServiceUnavailable, - Code: "no_accounts_configured", Type: "api_error", Failover: false, - Message: "no worker accounts configured", - }, nil) -} - // noAccountsRetryAfter mirrors runtime's workerReconcileInterval: the liveness // watchdog re-probes an unready worker at most once per this interval, so a // retry before then cannot observe a recovery and would just repeat the miss. @@ -555,7 +415,7 @@ func quotaBlockedMessage(publicModel string) string { return "all accounts are out of quota" } -func coolingPickError(item Item, publicModel string, retryAfter time.Duration) error { +func coolingPickError(item Item, publicModel, modelKey string, retryAfter time.Duration) error { failover := true kind := accounts.KindRateLimit code := "rate_limit" @@ -573,7 +433,7 @@ func coolingPickError(item Item, publicModel string, retryAfter time.Duration) e message = "all accounts are on quota cooldown" } } else if strings.TrimSpace(publicModel) != "" { - if until, ok := item.ModelDownUntil[accounts.CanonicalModelID(publicModel)]; ok && !until.IsZero() { + if until, ok := item.ModelDownUntil[modelKey]; ok && !until.IsZero() { message = fmt.Sprintf("model %s is cooling down on all available accounts", publicModel) } } @@ -608,13 +468,6 @@ func (e ChatExecutor) attemptsFor(providerFilter, regionFilter, publicModel stri return 1 } -func pinRegion(current, next string) string { - if current != "" { - return current - } - return accounts.NormalizeRegion(next) -} - // keyGrantedSingleRegion inspects an API key allowlist for one provider // family. It returns the single region the grants narrow the family to, with // narrowed=true. A bare family entry or an empty allowlist means every region @@ -663,7 +516,7 @@ func (e ChatExecutor) ObserveStreamFailure(accountID string, err error, model st if e.Pool == nil || accountID == "" || err == nil || requestContextDone(nil, err) { return } - classified := e.classifyInProcessError(err) + classified := ClassifyError(err) if classified.Kind == "" || classified.Kind == accounts.KindCanceled { return } @@ -696,90 +549,75 @@ type replayReadCloser struct { io.Closer } -// probeStreamBody waits for the first event of an upstream stream. Nothing has -// been sent to the client yet at this point, so a stream that dies or reports -// an error before the first event can still fail over to another account. -// Blank lines and comments (: keep-alive) are skipped; the bytes read while -// probing are replayed so the relay sees the stream from the first byte. -// The returned Classified is only meaningful when err != nil. A read that -// fails because the caller's request was canceled returns that context error, -// so the caller can report KindCanceled instead of treating the account as -// healthy. A body that merely wraps a context error while the request is still -// alive is an upstream failure and fails over. -func probeStreamBody(ctx context.Context, body io.ReadCloser) (io.ReadCloser, Classified, error) { +// probeStreamBody examines the first complete SSE event before anything is +// exposed. SSE can span multiple data lines; deciding on the first line can +// turn a retryable error into an already-committed stream. +func probeStreamBody(body io.ReadCloser) (io.ReadCloser, Classified, error) { if body == nil { return nil, Classify(0, errEmptyStream.Error(), "", accounts.KindUnavailable, ""), errEmptyStream } reader := bufio.NewReaderSize(body, 64*1024) var consumed bytes.Buffer - eventName := "" + var fieldData []string + var eventName string + var lineStart int + replay := func() io.ReadCloser { + return &replayReadCloser{Reader: io.MultiReader(&consumed, reader), Closer: body} + } for { - line, err := reader.ReadString('\n') - if line != "" { - consumed.WriteString(line) - text := strings.TrimSpace(strings.TrimRight(line, "\r\n")) - switch { - case text == "", strings.HasPrefix(text, ":"): - // Frame separator or keep-alive comment: keep waiting. - case strings.HasPrefix(text, "event:"): - eventName = strings.TrimSpace(strings.TrimPrefix(text, "event:")) - case strings.HasPrefix(text, "data:"): - data := strings.TrimSpace(strings.TrimPrefix(text, "data:")) - if classified, failed := probeFrameFailure(eventName, data); failed { - body.Close() - return nil, classified, fmt.Errorf("upstream stream failed before the first event: %s", classified.Message) - } - return &replayReadCloser{Reader: io.MultiReader(&consumed, reader), Closer: body}, Classified{}, nil - default: - // Non-SSE payload: let the relay surface it unchanged. - return &replayReadCloser{Reader: io.MultiReader(&consumed, reader), Closer: body}, Classified{}, nil - } + part, err := reader.ReadSlice('\n') + if consumed.Len()+len(part) > maxWorkerResponseBytes { + body.Close() + err := fmt.Errorf("upstream stream exceeded %d bytes before its first event", maxWorkerResponseBytes) + return nil, Classify(0, err.Error(), "", accounts.KindUnavailable, ""), err + } + consumed.Write(part) + if err == bufio.ErrBufferFull { + continue } - if err != nil { - if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { - // A context error is not an account failure. Hand back what was - // already read and let the relay decide: a canceled request is - // reported as a cancellation, and a body that wrapped - // context.Canceled while the request is still alive replays - // through the relay, which fails over without a pre-stream 502. - return &replayReadCloser{Reader: io.MultiReader(&consumed, reader), Closer: body}, Classified{}, nil + line := strings.TrimRight(string(consumed.Bytes()[lineStart:]), "\r\n") + lineStart = consumed.Len() + blank := strings.TrimSpace(line) == "" + field, value, _ := strings.Cut(line, ":") + switch { + case blank || field == "" || field == "id" || field == "retry": + case field == "event": + eventName = strings.TrimSpace(value) + case field == "data": + fieldData = append(fieldData, strings.TrimPrefix(value, " ")) + default: + // Compatibility: leave non-SSE responses to the relay. + return replay(), Classified{}, nil + } + if blank || err != nil { + data := strings.Join(fieldData, "\n") + if failure := ClassifyStreamEvent(eventName, data); failure != nil { + body.Close() + classified := ClassifyError(failure) + return nil, classified, fmt.Errorf("upstream stream failed before the first event: %w", failure) } - body.Close() - if errors.Is(err, io.EOF) { - return nil, Classify(0, errEmptyStream.Error(), "", accounts.KindUnavailable, ""), errEmptyStream + if strings.TrimSpace(data) != "" { + return replay(), Classified{}, nil } - return nil, Classify(0, err.Error(), "", accounts.KindUnavailable, ""), err + eventName = "" + fieldData = fieldData[:0] } + if err == nil { + continue + } + if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { + // Preserve the relay contract: context sentinels in an accepted + // response body surface as stream cancellation, not account health. + return replay(), Classified{}, nil + } + body.Close() + if errors.Is(err, io.EOF) { + return nil, Classify(0, errEmptyStream.Error(), "", accounts.KindUnavailable, ""), errEmptyStream + } + return nil, Classify(0, err.Error(), "", accounts.KindUnavailable, ""), err } } -// probeFrameFailure recognizes an SSE error frame, such as the structured -// "event: error" the worker emits when the upstream dies before streaming any -// token. Content frames (the ones carrying choices) are not failures. -func probeFrameFailure(eventName, data string) (Classified, bool) { - if data == "" { - return Classified{}, false - } - var payload map[string]any - if json.Unmarshal([]byte(data), &payload) != nil { - return Classified{}, false - } - if _, ok := payload["choices"]; ok { - return Classified{}, false - } - status := 0 - if value, ok := payload["status"].(float64); ok { - status = int(value) - } - if _, ok := payload["error"]; ok { - return Classify(status, data, "", "", ""), true - } - if strings.EqualFold(eventName, "error") { - return Classify(status, data, "", "", ""), true - } - return Classified{}, false -} - func (e ChatExecutor) handleModelAvailabilityFailure(requestID, source, accountID, model string, classified Classified) { if e.Pool == nil || accountID == "" { return @@ -826,16 +664,6 @@ func (e ChatExecutor) markClassified(id string, c Classified, model string) { e.Pool.MarkClassified(id, c) } -// markOK records a success scoped to the requested public model so a 200 -// on one model does not discard a cooldown recorded for another. Pass an -// empty model for a true account-level recovery. -func (e ChatExecutor) markOK(id, model string) { - if e.Pool == nil { - return - } - e.Pool.MarkOK(id, e.cooldownModel(id, model)) -} - // cooldownModel records the account's real catalog model when the client // used that account's alias, so the alias and the real name share one cooldown. func (e ChatExecutor) cooldownModel(id, model string) string { @@ -933,332 +761,6 @@ func classifyWorkerErr(resp *http.Response, body string) Classified { return Classify(status, body, retryAfter, kind, failover) } -type routeLoop struct { - requestID string - prefer string - providerFilter string - regionFilter string - routing routingPlan - excluded map[string]struct{} - lastErr error - allowed []string - attempts int - pinned string - index int - // regionPinned records that this request chose its region implicitly from - // the first picked account (not from a model prefix, grant, or explicit - // pin). A later failure releases that pin so failover can cross regions. - regionPinned bool - // eligible narrows candidates to one protocol capability; nil admits all. - eligible func(Item) bool - // resolver maps an item to its concrete aggregated model. Nil for normal - // (non-aggregated) requests. Pure and read-only; safe under Pool.mu. - resolver func(Item) string - // plan is the immutable per-request aggregate plan; nil for normal routes. - // It carries the per-model strategy/weights used by Pool.PickRoute. - plan *AggregatePlan - // tierAttempts and tierBudget apply only to priority aggregation. Each - // priority tier gets its own budget, so sibling accounts of the first - // provider cannot consume every retry before a lower-priority provider is - // reached. When a tier is exhausted its remaining accounts are added to - // excluded. - tierAttempts map[int]int - tierBudget int -} - -func (e ChatExecutor) newRouteLoop(ctx context.Context, prefer, providerFilter string, req translate.ChatRequest) routeLoop { - aggPlan := aggregatePlanFrom(ctx) - prefer, providerFilter, regionFilter, routing := e.prepareRouting(ctx, prefer, providerFilter, req, aggPlan) - allowed := allowedProvidersFrom(ctx) - // Capture the aggregate resolver once from the immutable per-request plan. - // If a plan exists, the public model is virtual and must not be pinned by a - // provider prefix; the plan's members already carry provider/region. - var resolver func(Item) string - if aggPlan != nil { - resolver = aggPlan.resolver() - providerFilter, regionFilter = "", "" - switch routing.Source { - case routingSticky: - // Keep the cache-affine binding. The public ID is virtual, so the - // account was already validated against the plan's members in - // prepareRouting; prefer selects it without re-imposing a provider. - prefer = routing.BoundAccount - case routingPin: - // An explicit pin is useful only when the pinned account can serve - // a member of this logical model. - if e.Pool != nil { - if pinned, ok := e.Pool.ByID(prefer); ok && aggPlan.CanServeAccount(pinned) { - break - } - } - prefer = "" - routing = routingPlan{Source: routingPool, SessionKey: routing.SessionKey, PublicModel: req.Model} - default: - prefer = "" - routing = routingPlan{Source: routingPool, SessionKey: routing.SessionKey, PublicModel: req.Model} - } - } - // A model-name region prefix (e.g. "workbuddy-cn/model") sets an explicit - // region that overrides sticky-session and pin-derived regions. It - // coexists with key grants: routeBaseMatches enforces both filters - // independently, so a prefix that conflicts with a grant yields no - // candidates and a clean error. - if modelRegion := regionFilterFromContext(ctx); modelRegion != "" { - regionFilter = modelRegion - } else if providerFilter != "" { - // A key whose grants narrow the selected family to exactly one region - // pre-seeds the region filter: scheduling never even considers accounts - // of other regions — including a pin to an out-of-grant account (the - // grant overrides the pinned account's region, so the pin falls back - // into the granted region) and every failover hop. - if granted, narrowed := keyGrantedSingleRegion(providerFilter, allowed); narrowed { - regionFilter = granted - } - } - if aggPlan == nil && regionFilter == "" && prefer != "" && e.Pool != nil { - if pinnedItem, ok := e.Pool.ByID(prefer); ok { - regionFilter = pinRegion("", pinnedItem.Region) - } - } - // Per-model failover settings win over the executor global attempt budget. - // AllowFallbacks=false means the single best account only; MaxAttempts caps - // how many distinct accounts/members may be tried for one logical model. - // - // Keep aggregated routes at the same single candidate scan as normal routes: - // attemptsFor already does that scan, so a plan must not call attemptsFor and - // then LenRoute again. Only count candidates here when failover is possible. - var attempts int - var tierBudget int - if aggPlan != nil { - attempts = aggPlan.MaxAttempts - if attempts <= 0 { - attempts = 1 - } - if !aggPlan.AllowFallbacks { - attempts = 1 - } else if aggPlan.Strategy == accounts.AggregationPriority { - // LiteLLM-style ordered fallback: each order tier gets its own - // retry budget before escalating to the next tier. A global budget - // would otherwise be spent entirely on sibling accounts of the - // first provider when MaxAttempts is smaller than that provider's - // account count. - tierBudget = attempts - attempts *= aggPlan.PriorityTierCount() - if e.Pool != nil { - query := e.routeQuery("", providerFilter, regionFilter, req.Model, allowed, nil, nil, aggPlan) - if n := e.Pool.LenRoute(query); n > 0 && n < attempts { - attempts = n - } - } - } else if e.Pool != nil { - query := e.routeQuery("", providerFilter, regionFilter, req.Model, allowed, nil, nil, aggPlan) - if n := e.Pool.LenRoute(query); n > 0 && n < attempts { - attempts = n - } - } - } else { - attempts = e.attemptsFor(providerFilter, regionFilter, req.Model, allowed, nil) - } - loop := routeLoop{ - requestID: RequestIDFromContext(ctx), - prefer: prefer, - providerFilter: providerFilter, - regionFilter: regionFilter, - routing: routing, - excluded: map[string]struct{}{}, - allowed: allowed, - resolver: resolver, - plan: aggPlan, - attempts: attempts, - } - if tierBudget > 0 { - loop.tierAttempts = make(map[int]int) - loop.tierBudget = tierBudget - } - if routing.Source == routingPin { - loop.pinned = prefer - } - return loop -} - -func (l *routeLoop) pickNext(e ChatExecutor, publicModel string) (Item, int, error) { - item, err := e.pick(l.requestID, l.prefer, l.providerFilter, l.regionFilter, publicModel, l.allowed, l.excluded, l.eligible, l.plan) - if err != nil { - // Sticky routing pins the bound provider and region before this pick. - // A capacity check made before the pick races the slot: another request - // can fill the last one in between, and the pin then turns a full - // provider into rate_limit while another provider still has room. - // Drop the pin only after the pick itself reports saturation, and only - // when this request did not ask for that provider. - if l.routing.Source == routingSticky && l.index == 0 && l.pinned == "" && capacityError(err) && e.providerHasCapacity(l.providerFilter, l.regionFilter, publicModel, l.allowed, l.eligible) { - if e.SessionAffinity != nil { - e.SessionAffinity.RecordEscape("concurrency_saturated") - } - l.routing.Source = routingPool - l.prefer = "" - l.providerFilter = "" - l.regionFilter = "" - l.regionPinned = false - l.attempts = e.attemptsFor(l.providerFilter, l.regionFilter, publicModel, l.allowed, l.eligible, l.resolver) - item, err = e.pick(l.requestID, l.prefer, l.providerFilter, l.regionFilter, publicModel, l.allowed, l.excluded, l.eligible, l.plan) - } - if err != nil { - return Item{}, l.index, err - } - } - attemptIndex := l.index - e.observeRouting(&l.routing, item.ID) - l.prefer = "" - // Pin the first pick's region so a mixed-region pool does not flip regions - // while rotating within one request. The attempt budget was computed over - // every eligible candidate before this pick and must not shrink here: - // shrinking it to the pinned region's account count can leave a failed - // request with no failover hop at all, even though another provider or - // region is healthy. A failure releases the pin in exclude/failover. - if l.plan == nil && l.regionFilter == "" { - l.regionFilter = pinRegion(l.regionFilter, item.Region) - l.regionPinned = true - } - l.index++ - return item, attemptIndex, nil -} - -// attemptModel returns the concrete model used for this item. It is the -// resolved real model for aggregated requests, otherwise the public model. -// Cooldowns must be recorded against this value so different providers/models -// behind one virtual ID do not share a cooldown. -func (l routeLoop) attemptModel(item Item, req translate.ChatRequest) string { - if l.resolver != nil { - if model := l.resolver(item); model != "" { - return model - } - } - return req.Model -} - -// dispatchRequest returns the request for this attempt with an aggregated -// virtual model resolved to the concrete model chosen for this item. It only -// touches the local copy of the request; the shared Item is never modified. -func (l routeLoop) dispatchRequest(item Item, req translate.ChatRequest) translate.ChatRequest { - req.Model = l.attemptModel(item, req) - return req -} - -func (l routeLoop) canFailover(classified Classified) bool { - return classified.Failover && l.index < l.attempts -} - -func (l *routeLoop) exclude(item Item) { - l.excluded[item.ID] = struct{}{} - // A cross-provider route (no explicit provider filter) must be able to - // leave the region its first pick happened to choose; otherwise a bare - // model shared by several providers stays pinned to one supplier. - // - // A provider-scoped route keeps its region pin: Qoder global and CN are - // isolated upstreams (different catalogs/quota pools), and existing - // behavior explicitly forbids global -> CN failover. Aggregated routes - // carry their own provider/region per member and never pin here. - if l.regionPinned && l.providerFilter == "" { - l.regionFilter = "" - l.regionPinned = false - } -} - -// failover records an upstream failure and excludes the account. On a -// cross-provider route exclude also releases the implicit region pin, so the -// next pick can leave the first supplier's region. Provider-scoped routes keep -// their region pin. -// -// A sticky binding is invalidated on failover (401/429/5xx and other -// failover-classified failures), including after a sticky escape. The next -// request then rebinds to a healthy account instead of retrying the dead one -// first; a successfully retried request rebinds through bindSession. This -// mirrors mature gateways' session affinity: sticky on the cache-hit path, -// failover invalidates the binding. -func (l *routeLoop) failover(e ChatExecutor, item Item) { - l.exclude(item) - l.noteTierFailure(e, item) - // Any non-pin route that already carries a session key can have a stale - // binding (including a sticky-escape that started on another account). - // Invalidate it so the next turn does not retry the failed account first. - if l.routing.Source != routingPin && l.routing.SessionKey != "" && e.SessionAffinity != nil { - e.SessionAffinity.Forget(l.routing.SessionKey) - } -} - -// noteTierFailure gives each priority tier its own retry budget. Once the -// budget is consumed, the remaining accounts in that tier are excluded so the -// next pick can reach a lower-priority provider instead of retrying every -// sibling account of the same provider. -func (l *routeLoop) noteTierFailure(e ChatExecutor, item Item) { - if l.plan == nil || l.plan.Strategy != accounts.AggregationPriority || l.tierAttempts == nil || e.Pool == nil { - return - } - tier, ok := l.plan.Priority(item) - if !ok { - return - } - l.tierAttempts[tier]++ - if l.tierAttempts[tier] < l.tierBudget { - return - } - for _, candidate := range e.Pool.Items() { - if candidateTier, ok := l.plan.Priority(candidate); ok && candidateTier == tier { - l.excluded[candidate.ID] = struct{}{} - } - } -} - -func (l routeLoop) headerAccount(item Item, attemptIndex int) string { - if attemptIndex == 0 && l.pinned != "" { - return l.pinned - } - return item.ID -} - -func (l routeLoop) resultProvider(item Item) string { - return firstNonEmpty(item.Provider, "qoder") -} - -func (l routeLoop) pickFailure(err error) (int, string, string, error) { - if l.lastErr != nil { - return l.index, lastAccountID(l.excluded), l.providerFilter, l.lastErr - } - return 0, "", "", err -} - -// releaseCloser runs release exactly once when the body is closed, so a -// successful stream keeps its Acquire until the caller finishes reading. -type releaseCloser struct { - io.ReadCloser - once sync.Once - release func() -} - -func (c *releaseCloser) Close() error { - err := c.ReadCloser.Close() - if c.release != nil { - c.once.Do(c.release) - } - return err -} - -func (e ChatExecutor) acquireInFlight(requestID, id string) bool { - if e.Pool == nil { - if e.OnInFlightAcquire != nil && requestID != "" && id != "" { - e.OnInFlightAcquire(requestID, id) - } - return true - } - if !e.Pool.Acquire(id) { - return false - } - if e.OnInFlightAcquire != nil && requestID != "" { - e.OnInFlightAcquire(requestID, id) - } - return true -} - func (e ChatExecutor) releaseInFlight(requestID, id string) { if e.Pool != nil { e.Pool.Release(id) @@ -1268,342 +770,18 @@ func (e ChatExecutor) releaseInFlight(requestID, id string) { } } -// attachInFlightRelease transfers an acquired slot to the response body. -// Close releases the pool id that was Acquired (not a rewritten account id). -func (e ChatExecutor) attachInFlightRelease(resp *http.Response, requestID, poolID string) *http.Response { - if resp == nil || resp.Body == nil { - e.releaseInFlight(requestID, poolID) - return resp - } - resp.Body = &releaseCloser{ReadCloser: resp.Body, release: func() { e.releaseInFlight(requestID, poolID) }} - return resp -} - -func (e ChatExecutor) ChatNonStream(ctx context.Context, req translate.ChatRequest, prefer, providerFilter string) (result ChatResult, returnErr error) { - loop := e.newRouteLoop(ctx, prefer, providerFilter, req) - defer func() { result.Routing = loop.routing.Source }() - for loop.index < loop.attempts { - item, i, err := loop.pickNext(e, req.Model) - if err != nil { - attempts, accountID, provider, pickErr := loop.pickFailure(err) - if loop.lastErr != nil { - return ChatResult{AttemptCount: attempts, AccountID: accountID, Provider: provider}, pickErr - } - return ChatResult{}, pickErr - } - // Acquire with the pool id before any rewrite of item.ID (X-Qoder-Account). - poolID := item.ID - if !e.acquireInFlight(loop.requestID, poolID) { - loop.exclude(item) - continue - } - release := func() { e.releaseInFlight(loop.requestID, poolID) } - if isInProcessItem(item) || e.qoderDirect(item) { - result, classified, err := e.chatInProcessNonStreamAttempt(ctx, item, loop.dispatchRequest(item, req), i) - if err == nil { - result.AttemptCount = i + 1 - e.observeRouting(&loop.routing, poolID) - // Bind the pool account, not the upstream-reported label. A - // worker response may rewrite X-Qoder-Account, but session - // affinity and future Pool.ByID lookups are keyed by the pool ID. - e.bindSession(loop.routing, poolID) - release() - return result, nil - } - loop.lastErr = err - if requestContextDone(ctx, err) { - release() - return ChatResult{AttemptCount: i + 1, AccountID: item.ID, Provider: item.Provider}, err - } - if loop.canFailover(classified) { - release() - loop.failover(e, item) - continue - } - release() - return ChatResult{AttemptCount: i + 1, AccountID: item.ID, Provider: item.Provider}, err - } - payload, err := json.Marshal(buildWorkerChatPayload(sanitizeForItem(item, loop.dispatchRequest(item, req)), false)) - if err != nil { - release() - return ChatResult{}, err - } - headerAccount := loop.headerAccount(item, i) - httpReq, err := e.newWorkerRequest(ctx, item, payload, headerAccount) - if err != nil { - release() - return ChatResult{}, err - } - started := time.Now() - resp, err := e.HTTPClient.Do(httpReq) - if err != nil { - if requestContextDone(ctx, err) { - latency := int(time.Since(started).Milliseconds()) - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: ptrTime(time.Now().UTC()), - Status: accounts.AttemptStatusError, ErrorKind: accounts.KindUnavailable, ErrorMessage: err.Error(), LatencyMs: &latency, - }) - release() - return ChatResult{AttemptCount: i + 1, AccountID: item.ID, Provider: item.Provider}, err - } - classified := Classify(0, err.Error(), "", accounts.KindUnavailable, "") - loop.lastErr = NewExecutionError(classified, fmt.Errorf("worker %s request failed: %w", item.ID, err)) - e.markClassified(item.ID, classified, loop.attemptModel(item, req)) - latency := int(time.Since(started).Milliseconds()) - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: ptrTime(time.Now().UTC()), - Status: accounts.AttemptStatusFailover, ErrorKind: classified.Kind, ErrorMessage: loop.lastErr.Error(), LatencyMs: &latency, - }) - release() - loop.failover(e, item) - continue - } - // Non-stream worker responses are buffered whole; cap them so a - // pathological upstream cannot pin unbounded memory per request. - body, _ := io.ReadAll(io.LimitReader(resp.Body, maxWorkerResponseBytes)) - resp.Body.Close() - finished := time.Now().UTC() - latency := int(finished.Sub(started).Milliseconds()) - if account := resp.Header.Get("X-Qoder-Account"); account != "" { - item.ID = account - } - poolItem := item - poolItem.ID = poolID - if resp.StatusCode >= 300 { - msg := strings.TrimSpace(string(body)) - classified := classifyWorkerErr(resp, msg) - loop.lastErr = NewExecutionError(classified, nil) - if classified.Kind == accounts.KindModelNotAvailable { - e.handleModelAvailabilityFailure(RequestIDFromContext(ctx), "worker_non_stream", poolID, loop.attemptModel(item, req), classified) - } - e.markClassified(poolID, classified, loop.attemptModel(item, req)) - status := accounts.AttemptStatusError - if loop.canFailover(classified) { - status = accounts.AttemptStatusFailover - loop.failover(e, poolItem) - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, - Status: status, HTTPStatus: ptrInt(resp.StatusCode), ErrorKind: classified.Kind, - ErrorMessage: truncateErr(msg), LatencyMs: &latency, - }) - release() - continue - } - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, - Status: status, HTTPStatus: ptrInt(resp.StatusCode), ErrorKind: classified.Kind, - ErrorMessage: truncateErr(msg), LatencyMs: &latency, - }) - release() - return ChatResult{AttemptCount: i + 1, AccountID: item.ID, Provider: loop.resultProvider(item)}, loop.lastErr - } - result, err := decodeChatResult(req, body) - if err != nil { - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, - Status: accounts.AttemptStatusError, HTTPStatus: ptrInt(resp.StatusCode), - ErrorKind: accounts.KindUnavailable, ErrorMessage: truncateErr(err.Error()), LatencyMs: &latency, - }) - release() - return ChatResult{AttemptCount: i + 1, AccountID: item.ID, Provider: loop.resultProvider(item)}, err - } - result.AccountID = item.ID - result.Provider = loop.resultProvider(item) - result.AttemptCount = i + 1 - result.ReasoningLevel = RequestedReasoningLevel(req) - if result.ReasoningLevel != "" { - logResolvedReasoning(ctx, "chat_non_stream", item, req.Model, result.ReasoningLevel) - } - e.observeRouting(&loop.routing, poolID) - e.bindSession(loop.routing, poolID) - e.markOK(poolID, loop.attemptModel(item, req)) - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, - Status: accounts.AttemptStatusOK, HTTPStatus: ptrInt(resp.StatusCode), LatencyMs: &latency, - PromptTokens: ptrInt(result.PromptTokens), CompletionTokens: ptrInt(result.CompletionTokens), - UsageSource: result.UsageSource, - }) - release() - return result, nil - } - if loop.lastErr == nil { - loop.lastErr = fmt.Errorf("no worker accounts available") - } - return ChatResult{AttemptCount: loop.attempts}, loop.lastErr +// sanitizeForItem also resolves the native spelling for explicit probes. +func sanitizeForItem(item Item, req translate.ChatRequest) translate.ChatRequest { + return targetFor(item, req.Model).request(req) } -// sanitizeForItem applies the account-level system-prompt policy. Provider -// families with upstream content screening (WorkBuddy) strip caller system -// prompts when the account opts in; Qoder workers intentionally preserve them. -// WorkBuddy still needs a leading system slot after the strip (code 11128); -// the adapter inserts an empty placeholder, this helper only drops caller text. -func sanitizeForItem(item Item, req translate.ChatRequest) translate.ChatRequest { - req.Model = AccountModelID(item, req.Model) - if native := NativeModelID(item, req.Model); native != "" { - req.Model = native - } +func sanitizeChatForItem(item Item, req translate.ChatRequest) translate.ChatRequest { if item.DropSystemPrompt && itemProvider(item) != "qoder" { - return translate.DropSystemMessages(req) + req = translate.DropSystemMessages(req) } return req } -func (e ChatExecutor) chatInProcessNonStreamAttempt(ctx context.Context, item Item, req translate.ChatRequest, attemptIndex int) (ChatResult, Classified, error) { - adapter, _ := e.Providers.Get(itemProvider(item)) - if adapter.Chat == nil { - return ChatResult{}, Classified{}, fmt.Errorf("provider %s does not implement chat", item.Provider) - } - started := time.Now() - outcome, err := adapter.Chat.ChatNonStream(ctx, item.ID, sanitizeForItem(item, req)) - finished := time.Now().UTC() - latency := int(finished.Sub(started).Milliseconds()) - if err == nil { - logResolvedReasoning(ctx, "chat_non_stream", item, req.Model, outcome.ReasoningLevel) - } - if err != nil { - if requestContextDone(ctx, err) { - return ChatResult{AccountID: item.ID, Provider: item.Provider}, Classified{Kind: accounts.KindUnavailable, Message: err.Error()}, err - } - classified := e.classifyInProcessError(err) - if classified.Kind == accounts.KindModelNotAvailable { - e.handleModelAvailabilityFailure(RequestIDFromContext(ctx), "provider_non_stream", item.ID, req.Model, classified) - } - e.markClassified(item.ID, classified, req.Model) - status := accounts.AttemptStatusError - if classified.Failover { - status = accounts.AttemptStatusFailover - } - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: attemptIndex, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, - Status: status, ErrorKind: classified.Kind, ErrorMessage: truncateErr(err.Error()), LatencyMs: &latency, - }) - return ChatResult{AccountID: item.ID, Provider: item.Provider}, classified, NewExecutionError(classified, err) - } - e.markOK(item.ID, req.Model) - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: attemptIndex, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, - Status: accounts.AttemptStatusOK, LatencyMs: &latency, - PromptTokens: ptrInt(outcome.PromptTokens), CompletionTokens: ptrInt(outcome.CompletionTokens), - UsageSource: outcome.UsageSource, - }) - return ChatResult{ - Model: outcome.Model, - Content: outcome.Content, - Reasoning: outcome.Reasoning, - ToolCalls: outcome.ToolCalls, - FinishReason: outcome.FinishReason, - PromptTokens: outcome.PromptTokens, - CompletionTokens: outcome.CompletionTokens, - CacheReadTokens: outcome.CacheReadTokens, - CacheWriteTokens: outcome.CacheWriteTokens, - CachedTokens: outcome.CacheReadTokens, - UsageSource: outcome.UsageSource, - ConsumedCredits: outcome.Credits, - AccountID: item.ID, - Provider: item.Provider, - ReasoningLevel: outcome.ReasoningLevel, - }, Classified{}, nil -} - -func (e ChatExecutor) chatInProcessStreamAttempt(ctx context.Context, item Item, req translate.ChatRequest, native *translate.NativeResponsesRequest, attemptIndex int, preferNativeResponses bool) (StreamResult, Classified, error) { - adapter, ok := e.Providers.Get(itemProvider(item)) - if !ok { - return StreamResult{}, Classified{}, fmt.Errorf("provider %s is not registered", item.Provider) - } - if !preferNativeResponses && adapter.Chat == nil { - return StreamResult{}, Classified{}, fmt.Errorf("provider %s does not implement chat", item.Provider) - } - if preferNativeResponses && native != nil && adapter.NativeResponses == nil { - return StreamResult{}, Classified{}, providers.ErrUnsupported - } - started := time.Now() - var resp *http.Response - var resolved providers.ResolvedChat - var err error - nativeResponses := false - if preferNativeResponses && native != nil && adapter.NativeResponses != nil { - options := providers.RequestOptions{ - Model: NativeModelID(item, AccountModelID(item, req.Model)), - DropSystemPrompt: item.DropSystemPrompt && itemProvider(item) != "qoder", - } - resp, resolved, err = adapter.NativeResponses.ResponsesStream(ctx, item.ID, native, options) - nativeResponses = err == nil - } else { - resp, resolved, err = adapter.Chat.ChatStream(ctx, item.ID, sanitizeForItem(item, req)) - } - if err == nil { - logResolvedReasoning(ctx, "chat_stream", item, req.Model, resolved.ReasoningLevel) - } - if err != nil { - finished := time.Now().UTC() - latency := int(finished.Sub(started).Milliseconds()) - if errors.Is(err, providers.ErrUnsupported) { - return StreamResult{AccountID: item.ID, Provider: item.Provider}, Classified{Kind: accounts.KindInvalidRequest, Message: err.Error()}, err - } - if requestContextDone(ctx, err) { - - return StreamResult{AccountID: item.ID, Provider: item.Provider}, Classified{Kind: accounts.KindUnavailable, Message: err.Error()}, err - } - classified := e.classifyInProcessError(err) - if classified.Kind == accounts.KindModelNotAvailable { - e.handleModelAvailabilityFailure(RequestIDFromContext(ctx), "provider_stream", item.ID, req.Model, classified) - } - e.markClassified(item.ID, classified, req.Model) - status := accounts.AttemptStatusError - if classified.Failover { - status = accounts.AttemptStatusFailover - } - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: attemptIndex, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, - Status: status, ErrorKind: classified.Kind, ErrorMessage: truncateErr(err.Error()), LatencyMs: &latency, - }) - return StreamResult{AccountID: item.ID, Provider: item.Provider}, classified, NewExecutionError(classified, err) - } - probed, probeClassified, probeErr := probeStreamBody(ctx, resp.Body) - if probeErr != nil { - finished := time.Now().UTC() - latency := int(finished.Sub(started).Milliseconds()) - if requestContextDone(ctx, probeErr) { - // The client went away before the first event. Report the - // cancellation and leave the account's cooldown untouched. - classified := ClassifyError(probeErr) - return StreamResult{AccountID: item.ID, Provider: item.Provider}, classified, NewExecutionError(classified, probeErr) - } - classified := probeClassified - if classified.Kind == "" { - classified = Classify(0, probeErr.Error(), "", accounts.KindUnavailable, "") - } - e.markClassified(item.ID, classified, req.Model) - status := accounts.AttemptStatusError - if classified.Failover { - status = accounts.AttemptStatusFailover - } - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: attemptIndex, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, - Status: status, ErrorKind: classified.Kind, ErrorMessage: truncateErr(probeErr.Error()), LatencyMs: &latency, - }) - return StreamResult{AccountID: item.ID, Provider: item.Provider}, classified, NewExecutionError(classified, probeErr) - } - resp.Body = probed - e.markOK(item.ID, req.Model) - ttfb := int(time.Since(started).Milliseconds()) - headerAt := time.Now().UTC() - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: attemptIndex, AccountID: item.ID, StartedAt: started, FinishedAt: &headerAt, - Status: accounts.AttemptStatusOK, HTTPStatus: ptrInt(http.StatusOK), LatencyMs: &ttfb, - }) - return StreamResult{Response: resp, AccountID: item.ID, PoolAccountID: item.ID, Provider: item.Provider, TTFBMs: ttfb, ReasoningLevel: resolved.ReasoningLevel, NativeResponses: nativeResponses}, Classified{}, nil -} - -func (e ChatExecutor) classifyInProcessError(err error) Classified { return ClassifyError(err) } - -func lastAccountID(excluded map[string]struct{}) string { - for id := range excluded { - return id - } - return "" -} - func firstNonEmpty(vals ...string) string { for _, v := range vals { if strings.TrimSpace(v) != "" { @@ -1723,267 +901,6 @@ func (e ChatExecutor) streamHTTPClient() *http.Client { return client } -func (e ChatExecutor) ChatStreamProxy(ctx context.Context, req translate.ChatRequest, prefer, providerFilter string) (result StreamResult, returnErr error) { - return e.chatStreamProxy(ctx, req, nil, prefer, providerFilter, false) -} - -// ChatStreamProxyNativeResponses sends the original Responses request to a -// native-capable adapter. Once this path starts, retries remain native-only. -func (e ChatExecutor) ChatStreamProxyNativeResponses(ctx context.Context, req translate.ChatRequest, native *translate.NativeResponsesRequest, prefer, providerFilter string) (result StreamResult, returnErr error) { - return e.chatStreamProxy(ctx, req, native, prefer, providerFilter, true) -} - -func (e ChatExecutor) NativeResponsesNonStream(ctx context.Context, req translate.ChatRequest, native *translate.NativeResponsesRequest, prefer, providerFilter string) (result NativeResponseResult, returnErr error) { - upstream, err := e.ChatStreamProxyNativeResponses(ctx, req, native, prefer, providerFilter) - if err != nil { - return NativeResponseResult{AccountID: upstream.AccountID, Provider: upstream.Provider, AttemptCount: upstream.AttemptCount, Routing: upstream.Routing, ReasoningLevel: upstream.ReasoningLevel}, err - } - if upstream.Response == nil || upstream.Response.Body == nil { - return NativeResponseResult{AccountID: upstream.AccountID, Provider: upstream.Provider, AttemptCount: upstream.AttemptCount, Routing: upstream.Routing, ReasoningLevel: upstream.ReasoningLevel}, fmt.Errorf("native responses upstream returned no body") - } - defer upstream.Response.Body.Close() - collected, err := translate.CollectResponses(upstream.Response.Body) - result = NativeResponseResult{ - Response: collected.Response, AccountID: upstream.AccountID, Provider: upstream.Provider, - AttemptCount: upstream.AttemptCount, Routing: upstream.Routing, ReasoningLevel: upstream.ReasoningLevel, - FinishReason: collected.FinishReason, PromptTokens: collected.InputTokens, - OutputTokens: collected.OutputTokens, CachedTokens: collected.CachedTokens, - } - if err != nil { - e.ObserveStreamFailure(poolAccountID(upstream), err, req.Model) - return result, err - } - e.CommitSession(ctx, req, upstream.Routing, poolAccountID(upstream)) - return result, nil -} - -func poolAccountID(result StreamResult) string { - if strings.TrimSpace(result.PoolAccountID) != "" { - return result.PoolAccountID - } - return result.AccountID -} - -func (e ChatExecutor) HasNativeResponsesRoute(ctx context.Context, req translate.ChatRequest, prefer, providerFilter string) bool { - if e.Providers == nil { - return false - } - loop := e.newRouteLoop(ctx, prefer, providerFilter, req) - loop.eligible = func(item Item) bool { - adapter, ok := e.Providers.Get(itemProvider(item)) - return ok && adapter.NativeResponses != nil - } - if e.Pool == nil { - return false - } - query := e.routeQuery(loop.prefer, loop.providerFilter, loop.regionFilter, req.Model, loop.allowed, nil, loop.eligible, loop.plan) - return e.Pool.LenRoute(query) > 0 -} - -func (e ChatExecutor) chatStreamProxy(ctx context.Context, req translate.ChatRequest, native *translate.NativeResponsesRequest, prefer, providerFilter string, preferNativeResponses bool) (result StreamResult, returnErr error) { - loop := e.newRouteLoop(ctx, prefer, providerFilter, req) - if preferNativeResponses && native != nil && e.Providers == nil { - return StreamResult{}, providers.ErrUnsupported - } - if preferNativeResponses && native != nil { - loop.eligible = func(item Item) bool { - adapter, ok := e.Providers.Get(itemProvider(item)) - return ok && adapter.NativeResponses != nil - } - loop.attempts = e.attemptsFor(loop.providerFilter, loop.regionFilter, req.Model, loop.allowed, loop.eligible, loop.resolver) - } - defer func() { result.Routing = loop.routing.Source }() - startedAll := time.Now() - for loop.index < loop.attempts { - item, i, err := loop.pickNext(e, req.Model) - if err != nil { - attempts, accountID, provider, pickErr := loop.pickFailure(err) - if loop.lastErr != nil { - return StreamResult{AttemptCount: attempts, AccountID: accountID, Provider: provider}, pickErr - } - return StreamResult{}, pickErr - } - noteStreamRoute(ctx, item.ID, loop.resultProvider(item)) - poolID := item.ID - if !e.acquireInFlight(loop.requestID, poolID) { - loop.exclude(item) - continue - } - release := func() { e.releaseInFlight(loop.requestID, poolID) } - if isInProcessItem(item) || (e.qoderDirect(item) && !(preferNativeResponses && native != nil)) { - result, classified, err := e.chatInProcessStreamAttempt(ctx, item, loop.dispatchRequest(item, req), native, i, preferNativeResponses) - - if err == nil { - result.AttemptCount = i + 1 - e.observeRouting(&loop.routing, poolID) - // Bind at response headers, not after the stream body ends. A - // follow-up turn can start while the first stream is still - // running; waiting for [DONE] would let it select another - // account and lose the prompt cache. Bind the pool ID because - // the upstream-reported label is not a Pool routing key. - e.bindSession(loop.routing, poolID) - result.Response = e.attachInFlightRelease(result.Response, loop.requestID, poolID) - return result, nil - } - loop.lastErr = err - if requestContextDone(ctx, err) { - release() - return StreamResult{AttemptCount: i + 1, AccountID: item.ID, Provider: item.Provider}, err - } - if loop.canFailover(classified) { - release() - loop.failover(e, item) - continue - } - release() - return StreamResult{AttemptCount: i + 1, AccountID: item.ID, Provider: item.Provider}, err - } - payload, err := json.Marshal(buildWorkerChatPayload(sanitizeForItem(item, loop.dispatchRequest(item, req)), true)) - if err != nil { - release() - return StreamResult{}, err - } - headerAccount := loop.headerAccount(item, i) - httpReq, err := e.newWorkerRequest(ctx, item, payload, headerAccount) - if err != nil { - release() - return StreamResult{}, err - } - started := time.Now() - resp, err := e.streamHTTPClient().Do(httpReq) - if err != nil { - if requestContextDone(ctx, err) { - latency := int(time.Since(started).Milliseconds()) - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: ptrTime(time.Now().UTC()), - Status: accounts.AttemptStatusError, ErrorKind: accounts.KindUnavailable, ErrorMessage: err.Error(), LatencyMs: &latency, - }) - release() - return StreamResult{AttemptCount: i + 1, AccountID: item.ID, Provider: item.Provider}, err - } - classified := Classify(0, err.Error(), "", accounts.KindUnavailable, "") - loop.lastErr = NewExecutionError(classified, fmt.Errorf("worker %s stream request failed: %w", item.ID, err)) - e.markClassified(item.ID, classified, loop.attemptModel(item, req)) - latency := int(time.Since(started).Milliseconds()) - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: ptrTime(time.Now().UTC()), - Status: accounts.AttemptStatusFailover, ErrorKind: classified.Kind, ErrorMessage: loop.lastErr.Error(), LatencyMs: &latency, - }) - release() - loop.failover(e, item) - continue - } - if account := resp.Header.Get("X-Qoder-Account"); account != "" { - item.ID = account - noteStreamRoute(ctx, item.ID, loop.resultProvider(item)) - } - poolItem := item - poolItem.ID = poolID - if resp.StatusCode >= 300 { - body, _ := io.ReadAll(io.LimitReader(resp.Body, maxWorkerResponseBytes)) - resp.Body.Close() - msg := strings.TrimSpace(string(body)) - classified := classifyWorkerErr(resp, msg) - loop.lastErr = NewExecutionError(classified, nil) - if classified.Kind == accounts.KindModelNotAvailable { - e.handleModelAvailabilityFailure(RequestIDFromContext(ctx), "worker_stream", poolID, loop.attemptModel(item, req), classified) - } - e.markClassified(poolID, classified, loop.attemptModel(item, req)) - finished := time.Now().UTC() - latency := int(finished.Sub(started).Milliseconds()) - status := accounts.AttemptStatusError - if loop.canFailover(classified) { - status = accounts.AttemptStatusFailover - loop.failover(e, poolItem) - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, - Status: status, HTTPStatus: ptrInt(resp.StatusCode), ErrorKind: classified.Kind, - ErrorMessage: truncateErr(msg), LatencyMs: &latency, - }) - release() - continue - } - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, - Status: status, HTTPStatus: ptrInt(resp.StatusCode), ErrorKind: classified.Kind, - ErrorMessage: truncateErr(msg), LatencyMs: &latency, - }) - release() - return StreamResult{AttemptCount: i + 1, AccountID: item.ID, Provider: loop.resultProvider(item)}, loop.lastErr - } - probed, probeClassified, probeErr := probeStreamBody(ctx, resp.Body) - if probeErr != nil { - if requestContextDone(ctx, probeErr) { - // The client went away before the first event. Record the - // cancellation without cooling the account or failing over. - classified := ClassifyError(probeErr) - latency := int(time.Since(started).Milliseconds()) - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: ptrTime(time.Now().UTC()), - Status: accounts.AttemptStatusError, ErrorKind: classified.Kind, ErrorMessage: probeErr.Error(), LatencyMs: &latency, - }) - release() - return StreamResult{AttemptCount: i + 1, AccountID: item.ID, Provider: item.Provider}, NewExecutionError(classified, probeErr) - } - classified := probeClassified - if classified.Kind == "" { - classified = Classify(0, probeErr.Error(), "", accounts.KindUnavailable, "") - } - loop.lastErr = NewExecutionError(classified, fmt.Errorf("worker %s stream failed before the first event: %w", item.ID, probeErr)) - e.markClassified(poolID, classified, loop.attemptModel(item, req)) - finished := time.Now().UTC() - latency := int(finished.Sub(started).Milliseconds()) - status := accounts.AttemptStatusError - if loop.canFailover(classified) { - status = accounts.AttemptStatusFailover - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, - Status: status, HTTPStatus: ptrInt(resp.StatusCode), ErrorKind: classified.Kind, - ErrorMessage: truncateErr(probeErr.Error()), LatencyMs: &latency, - }) - loop.failover(e, poolItem) - release() - continue - } - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: &finished, - Status: status, HTTPStatus: ptrInt(resp.StatusCode), ErrorKind: classified.Kind, - ErrorMessage: truncateErr(probeErr.Error()), LatencyMs: &latency, - }) - release() - return StreamResult{AttemptCount: i + 1, AccountID: item.ID, Provider: loop.resultProvider(item)}, loop.lastErr - } - resp.Body = probed - e.markOK(poolID, loop.attemptModel(item, req)) - ttfb := int(time.Since(startedAll).Milliseconds()) - headerAt := time.Now().UTC() - e.recordAttempt(ctx, accounts.RequestAttempt{ - AttemptIndex: i, AccountID: item.ID, StartedAt: started, FinishedAt: &headerAt, - Status: accounts.AttemptStatusOK, HTTPStatus: ptrInt(resp.StatusCode), LatencyMs: &ttfb, - }) - e.observeRouting(&loop.routing, poolID) - e.bindSession(loop.routing, poolID) - resolved := RequestedReasoningLevel(req) - if resolved != "" { - logResolvedReasoning(ctx, "chat_stream", item, req.Model, resolved) - } - resp = e.attachInFlightRelease(resp, loop.requestID, poolID) - return StreamResult{ - Response: resp, - AccountID: item.ID, - PoolAccountID: poolID, - Provider: loop.resultProvider(item), - AttemptCount: i + 1, - TTFBMs: ttfb, - ReasoningLevel: resolved, - }, nil - } - if loop.lastErr == nil { - loop.lastErr = fmt.Errorf("no worker accounts available") - } - return StreamResult{AttemptCount: loop.attempts}, loop.lastErr -} - func ptrInt(value int) *int { return &value } func ptrTime(value time.Time) *time.Time { return &value } diff --git a/internal/executor/chat_test.go b/internal/executor/chat_test.go index a2ae876ff..5bc2e8727 100644 --- a/internal/executor/chat_test.go +++ b/internal/executor/chat_test.go @@ -277,11 +277,11 @@ func TestRouteFailoverKeepsAttemptBudgetAndCrossesRegion(t *testing.T) { p.Upsert(Item{ID: "c1", Provider: "workbuddy", Region: "cn", Models: []string{"shared"}}) e := ChatExecutor{Pool: p} - loop := e.newRouteLoop(context.Background(), "", "", translate.ChatRequest{Model: "shared"}) + loop := e.newRouteLoop(RouteInput{PublicModel: "shared"}, "shared", nil) if loop.attempts != 2 { t.Fatalf("attempts=%d, want 2", loop.attempts) } - first, _, err := loop.pickNext(e, "shared") + first, _, err := loop.pickNextReserved(e) if err != nil { t.Fatalf("first pick: %v", err) } @@ -289,13 +289,15 @@ func TestRouteFailoverKeepsAttemptBudgetAndCrossesRegion(t *testing.T) { t.Fatalf("attempt budget shrank after region pin: %d", loop.attempts) } - loop.failover(e, first) - second, _, err := loop.pickNext(e, "shared") + loop.failover(e, first, first.item.ID, Classified{Failover: true}, errors.New("first attempt failed")) + e.releaseInFlight("", first.item.ID) + second, _, err := loop.pickNextReserved(e) if err != nil { t.Fatalf("failover pick: %v", err) } - if second.Region == first.Region { - t.Fatalf("failover stayed in failed region %s: %+v", first.Region, second) + defer e.releaseInFlight("", second.item.ID) + if second.item.Region == first.item.Region { + t.Fatalf("failover stayed in failed region %s: %+v", first.item.Region, second) } } @@ -1022,11 +1024,10 @@ func TestChatStreamProxyWorkerAppliesAccountAlias(t *testing.T) { } } -// Priority aggregation must not spend the whole retry budget on sibling -// accounts of the first provider. Each priority tier gets its own budget, so -// two exhausted qoder accounts cannot prevent the workbuddy member from being -// tried. -func TestAggregatePriorityFallsThroughToNextProvider(t *testing.T) { +// The global budget is not multiplied by the number of priority tiers. +// The lower tier only gets traffic when both higher-tier accounts are +// unavailable and there is still budget, or a new request arrives. +func TestAggregatePriorityRespectsGlobalBudget(t *testing.T) { var q1Hits, q2Hits, w1Hits atomic.Int32 q1 := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { q1Hits.Add(1) @@ -1061,14 +1062,15 @@ func TestAggregatePriorityFallsThroughToNextProvider(t *testing.T) { }, }) executor := NewChatExecutor(pool, "") - result, err := executor.ChatNonStream(WithAggregatePlan(context.Background(), plan), translate.ChatRequest{ - Model: "logical", Messages: []translate.ChatMessage{{Role: "user", Content: "hi"}}, - }, "", "") - if err != nil { - t.Fatal(err) - } - if result.AccountID != "z-w1" || result.AttemptCount != 3 { - t.Fatalf("result = %+v, want z-w1 after 3 attempts", result) + req := translate.ChatRequest{Model: "logical", Messages: []translate.ChatMessage{{Role: "user", Content: "hi"}}} + route := RouteInput{PublicModel: "logical", AggregatePlan: plan} + result, err := executor.ChatNonStreamPrepared(context.Background(), req, route) + if err == nil || result.AttemptCount != 2 || q1Hits.Load() != 1 || q2Hits.Load() != 1 || w1Hits.Load() != 0 { + t.Fatalf("budget=2: result=%+v err=%v; hits q1=%d q2=%d w1=%d", result, err, q1Hits.Load(), q2Hits.Load(), w1Hits.Load()) + } + result, err = executor.ChatNonStreamPrepared(context.Background(), req, route) + if err != nil || result.AccountID != "z-w1" || result.AttemptCount != 1 { + t.Fatalf("second request result = %+v, err=%v, want z-w1 on first dispatch", result, err) } if q1Hits.Load() != 1 || q2Hits.Load() != 1 || w1Hits.Load() != 1 { t.Fatalf("hits q1=%d q2=%d w1=%d", q1Hits.Load(), q2Hits.Load(), w1Hits.Load()) diff --git a/internal/executor/classify.go b/internal/executor/classify.go index 6104f1c08..95331c7e2 100644 --- a/internal/executor/classify.go +++ b/internal/executor/classify.go @@ -304,7 +304,13 @@ func extractError(body string) (msg, code, typ, kind string) { } var parsed map[string]any if json.Unmarshal([]byte(text), &parsed) == nil { - if errObj, ok := parsed["error"].(map[string]any); ok { + errObj, _ := parsed["error"].(map[string]any) + if errObj == nil { + if response, ok := parsed["response"].(map[string]any); ok { + errObj, _ = response["error"].(map[string]any) + } + } + if errObj != nil { msg, _ = errObj["message"].(string) if msg == "" { msg, _ = errObj["msg"].(string) diff --git a/internal/executor/dispatch.go b/internal/executor/dispatch.go new file mode 100644 index 000000000..b871e61ed --- /dev/null +++ b/internal/executor/dispatch.go @@ -0,0 +1,545 @@ +package executor + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "strings" + "sync" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/providers" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +// dispatchAttempt owns the immutable route target and records one upstream +// request. The worker label is only used for presentation, not feedback. +type dispatchAttempt struct { + target dispatchTarget + index int + started time.Time + httpStatus int +} + +func (a dispatchAttempt) record(e ChatExecutor, ctx context.Context, status string, classified Classified, usage accounts.RequestAttempt) { + finished := time.Now().UTC() + latency := int(finished.Sub(a.started).Milliseconds()) + usage.AttemptIndex, usage.AccountID = a.index, a.target.item.ID + usage.StartedAt, usage.FinishedAt, usage.LatencyMs = a.started, &finished, &latency + usage.Status = status + if a.httpStatus != 0 { + usage.HTTPStatus = ptrInt(a.httpStatus) + } + usage.ErrorKind, usage.ErrorMessage = classified.Kind, truncateErr(classified.Message) + e.recordAttempt(ctx, usage) +} + +// feedback never resolves the model again: a catalog or alias can change +// while the request is on the wire. +func (e ChatExecutor) feedback(ctx context.Context, target dispatchTarget, source string, classified Classified) { + if e.Pool == nil || target.item.ID == "" { + return + } + switch classified.Kind { + case "", accounts.KindCanceled, accounts.KindInvalidRequest: + return + case accounts.KindModelNotAvailable: + e.handleModelAvailabilityFailure(RequestIDFromContext(ctx), source, target.item.ID, target.cooldownKey, classified) + return + case accounts.KindRateLimit: + classified.Model = target.cooldownKey + } + e.Pool.MarkClassified(target.item.ID, classified) +} + +func (e ChatExecutor) dispatchError(ctx context.Context, l *routeLoop, a dispatchAttempt, label, source string, classified Classified, err error) (bool, error) { + status := accounts.AttemptStatusError + retry := false + if canceled := dispatchCancellation(ctx, err, classified); canceled != nil { + err = canceled + classified = ClassifyError(canceled) + l.lastTarget, l.lastLabel, l.lastErr = a.target, label, err + } else { + e.feedback(ctx, a.target, source, classified) + retry = l.failover(e, a.target, label, classified, err) && ctx.Err() == nil + if retry { + status = accounts.AttemptStatusFailover + } + } + a.record(e, ctx, status, classified, accounts.RequestAttempt{}) + return retry, err +} + +func (e ChatExecutor) ChatNonStream(ctx context.Context, req translate.ChatRequest, prefer, providerFilter string) (ChatResult, error) { + return e.ChatNonStreamPrepared(ctx, req, routeInputFromContext(ctx, req, prefer, providerFilter)) +} + +func (e ChatExecutor) ChatNonStreamPrepared(ctx context.Context, req translate.ChatRequest, route RouteInput) (result ChatResult, returnErr error) { + ctx = dispatchContext(ctx, route) + l := e.newRouteLoop(route, req.Model, nil) + defer func() { result.Routing = l.routing.Source }() + for l.index < l.attempts { + if err := ctx.Err(); err != nil { + return l.chatError(err) + } + target, index, err := l.pickNextReserved(e) + if err != nil { + return l.chatError(err) + } + result, classified, a, err := e.nonStreamAttempt(ctx, target, index, l.headerAccount(target, index), req) + if err == nil { + e.Pool.markRouteOK(target.item, target.cooldownKey) + e.bindSession(l.routing, target.item.ID) + a.record(e, ctx, accounts.AttemptStatusOK, Classified{}, accounts.RequestAttempt{ + PromptTokens: ptrInt(result.PromptTokens), CompletionTokens: ptrInt(result.CompletionTokens), UsageSource: result.UsageSource, + }) + e.releaseInFlight(l.requestID, target.item.ID) + return result, nil + } + retry, err := e.dispatchError(ctx, &l, a, result.AccountID, "chat_non_stream", classified, err) + e.releaseInFlight(l.requestID, target.item.ID) + if !retry { + return l.chatError(err) + } + } + return l.chatError(noAccountsError("no accounts available")) +} + +func (e ChatExecutor) nonStreamAttempt(ctx context.Context, target dispatchTarget, index int, header string, req translate.ChatRequest) (result ChatResult, classified Classified, attempt dispatchAttempt, returnErr error) { + item := target.item + label := item.ID + attempt = dispatchAttempt{target: target, index: index, started: time.Now().UTC()} + defer func() { + result.AccountID, result.PoolAccountID, result.Provider = label, item.ID, target.provider() + result.AttemptCount, result.CooldownModel = index+1, target.cooldownKey + result.AggregateFEFO = target.aggregateFEFO + }() + if isInProcessItem(item) || e.qoderDirect(item) { + adapter, ok := e.Providers.Get(target.provider()) + if !ok || adapter.Chat == nil { + err := fmt.Errorf("provider %s does not implement chat", item.Provider) + return ChatResult{}, ClassifyError(err), attempt, err + } + out, err := adapter.Chat.ChatNonStream(ctx, item.ID, target.request(req)) + if err != nil { + classified := ClassifyError(err) + return ChatResult{}, classified, attempt, NewExecutionError(classified, err) + } + logResolvedReasoning(ctx, "chat_non_stream", item, target.memberModel, out.ReasoningLevel) + return ChatResult{ + Model: out.Model, Content: out.Content, Reasoning: out.Reasoning, ToolCalls: out.ToolCalls, FinishReason: out.FinishReason, + PromptTokens: out.PromptTokens, CompletionTokens: out.CompletionTokens, CacheReadTokens: out.CacheReadTokens, CacheWriteTokens: out.CacheWriteTokens, + CachedTokens: out.CacheReadTokens, UsageSource: out.UsageSource, ConsumedCredits: out.Credits, ReasoningLevel: out.ReasoningLevel, + }, Classified{}, attempt, nil + } + resp, classified, err := e.openWorker(ctx, target, header, req, false) + if resp != nil { + label = firstNonEmpty(resp.Header.Get("X-Qoder-Account"), label) + attempt.httpStatus = resp.StatusCode + } + if err != nil { + return ChatResult{}, classified, attempt, err + } + defer resp.Body.Close() + body, err := io.ReadAll(io.LimitReader(resp.Body, maxWorkerResponseBytes+1)) + if err == nil && len(body) > maxWorkerResponseBytes { + err = fmt.Errorf("worker response exceeds %d bytes", maxWorkerResponseBytes) + } + if err == nil { + result, err = decodeChatResult(req, body) + } + if err != nil { + classified = Classify(502, err.Error(), "", accounts.KindUnavailable, "") + return ChatResult{}, classified, attempt, NewExecutionError(classified, err) + } + result.ReasoningLevel = RequestedReasoningLevel(req) + logResolvedReasoning(ctx, "chat_non_stream", item, target.memberModel, result.ReasoningLevel) + return result, Classified{}, attempt, nil +} + +func (e ChatExecutor) openWorker(ctx context.Context, target dispatchTarget, header string, req translate.ChatRequest, stream bool) (*http.Response, Classified, error) { + payload, err := json.Marshal(buildWorkerChatPayload(target.request(req), stream)) + if err != nil { + return nil, Classified{}, err + } + httpReq, err := e.newWorkerRequest(ctx, target.item, payload, header) + if err != nil { + return nil, Classified{}, err + } + client := e.HTTPClient + if stream { + client = e.streamHTTPClient() + } else if client == nil { + client = http.DefaultClient + } + resp, err := client.Do(httpReq) + if err != nil { + if requestContextDone(ctx, err) { + return nil, ClassifyError(ctx.Err()), err + } + classified := Classify(0, err.Error(), "", accounts.KindUnavailable, "") + return nil, classified, NewExecutionError(classified, fmt.Errorf("worker %s request failed: %w", target.item.ID, err)) + } + if resp.StatusCode >= 300 { + body, _ := io.ReadAll(io.LimitReader(resp.Body, maxWorkerResponseBytes)) + resp.Body.Close() + classified := classifyWorkerErr(resp, strings.TrimSpace(string(body))) + return resp, classified, newUpstreamResponseError(classified) + } + return resp, Classified{}, nil +} + +func (e ChatExecutor) ChatStreamProxy(ctx context.Context, req translate.ChatRequest, prefer, providerFilter string) (StreamResult, error) { + return e.ChatStreamProxyPrepared(ctx, req, nil, routeInputFromContext(ctx, req, prefer, providerFilter)) +} + +// ChatStreamProxyNativeResponses retries only native-capable adapters. +func (e ChatExecutor) ChatStreamProxyNativeResponses(ctx context.Context, req translate.ChatRequest, native *translate.NativeResponsesRequest, prefer, providerFilter string) (StreamResult, error) { + return e.ChatStreamProxyNativeResponsesPrepared(ctx, req, native, routeInputFromContext(ctx, req, prefer, providerFilter)) +} + +func (e ChatExecutor) ChatStreamProxyPrepared(ctx context.Context, req translate.ChatRequest, _ *translate.NativeResponsesRequest, route RouteInput) (StreamResult, error) { + return e.chatStreamProxy(ctx, req, nil, route) +} + +func (e ChatExecutor) ChatStreamProxyNativeResponsesPrepared(ctx context.Context, req translate.ChatRequest, native *translate.NativeResponsesRequest, route RouteInput) (StreamResult, error) { + if native == nil || e.Providers == nil { + return StreamResult{}, providers.ErrUnsupported + } + return e.chatStreamProxy(ctx, req, native, route) +} + +// nativeResponsesCompatFallback keeps the named aggregate candidate set intact +// when the original Responses body can be represented by the shared Chat form. +// Non-aggregate requests retain the existing native-only route contract. +func nativeResponsesCompatFallback(plan *AggregatePlan, native *translate.NativeResponsesRequest) bool { + if plan == nil || native == nil { + return false + } + _, err := native.Compat() + return err == nil +} + +func (e ChatExecutor) chatStreamProxy(ctx context.Context, req translate.ChatRequest, native *translate.NativeResponsesRequest, route RouteInput) (result StreamResult, returnErr error) { + ctx = dispatchContext(ctx, route) + optionalNative := nativeResponsesCompatFallback(route.AggregatePlan, native) + var eligible func(Item) bool + if native != nil { + eligible = e.nativeResponsesEligible + if optionalNative { + eligible = nil + } + } + l := e.newRouteLoop(route, req.Model, eligible) + defer func() { result.Routing = l.routing.Source }() + started := time.Now() + upstream, a, err := e.openRoutedStream(ctx, &l, req, native, optionalNative) + if err != nil { + return upstream, err + } + upstream.TTFBMs = int(time.Since(started).Milliseconds()) + // Provisional affinity permits a follow-up while a stream is open. + // A late upstream failure only invalidates a binding to this account. + completion := &streamCompletion{attempt: a, sessionKey: l.routing.SessionKey, requestID: l.requestID} + if ctx.Err() == nil { + completion.bindingVersion = e.bindSession(l.routing, a.target.item.ID) + } + upstream.completion = completion + upstream.Response.Body = &releaseCloser{ReadCloser: upstream.Response.Body, release: func() { + // Legacy callers that close without relaying did not confirm success. + e.completeStream(ctx, completion, context.Canceled) + e.releaseInFlight(l.requestID, a.target.item.ID) + }} + return upstream, nil +} + +// openRoutedStream retries only failures before an accepted first event. +// It leaves the accepted attempt reserved for the relay or collector. +func (e ChatExecutor) openRoutedStream(ctx context.Context, l *routeLoop, req translate.ChatRequest, native *translate.NativeResponsesRequest, optionalNative bool) (StreamResult, dispatchAttempt, error) { + for l.index < l.attempts { + if err := ctx.Err(); err != nil { + r, err := l.streamError(err) + return r, dispatchAttempt{}, err + } + target, index, err := l.pickNextReserved(e) + if err != nil { + r, err := l.streamError(err) + return r, dispatchAttempt{}, err + } + noteStreamRoute(ctx, target.item.ID, target.provider()) + result, classified, a, err := e.streamAttempt(ctx, target, index, l.headerAccount(target, index), req, native, optionalNative) + if err == nil { + return result, a, nil + } + retry, err := e.dispatchError(ctx, l, a, result.AccountID, "chat_stream_open", classified, err) + e.releaseInFlight(l.requestID, target.item.ID) + if !retry { + return result, a, err + } + } + r, err := l.streamError(noAccountsError("no accounts available")) + return r, dispatchAttempt{}, err +} + +func (e ChatExecutor) streamAttempt(ctx context.Context, target dispatchTarget, index int, header string, req translate.ChatRequest, native *translate.NativeResponsesRequest, optionalNative bool) (StreamResult, Classified, dispatchAttempt, error) { + item := target.item + a := dispatchAttempt{target: target, index: index, started: time.Now().UTC()} + result := StreamResult{AccountID: item.ID, PoolAccountID: item.ID, Provider: target.provider(), AttemptCount: index + 1, CooldownModel: target.cooldownKey, AggregateFEFO: target.aggregateFEFO} + var resp *http.Response + var err error + var classified Classified + workerAttempt := false + inProcess := isInProcessItem(item) || e.qoderDirect(item) + var resolved providers.ResolvedChat + adapter, _ := e.Providers.Get(target.provider()) + switch { + case native != nil && adapter.NativeResponses != nil: + resp, resolved, err = adapter.NativeResponses.ResponsesStream(ctx, item.ID, native, providers.RequestOptions{ + Model: target.upstreamModel, DropSystemPrompt: item.DropSystemPrompt && target.provider() != "qoder", + }) + result.NativeResponses = err == nil + case native != nil && optionalNative && inProcess && adapter.Chat != nil: + resp, resolved, err = adapter.Chat.ChatStream(ctx, item.ID, target.request(req)) + case native != nil && optionalNative && !inProcess: + workerAttempt = true + resp, classified, err = e.openWorker(ctx, target, header, req, true) + case native == nil && inProcess && adapter.Chat != nil: + resp, resolved, err = adapter.Chat.ChatStream(ctx, item.ID, target.request(req)) + case native == nil && !inProcess: + workerAttempt = true + resp, classified, err = e.openWorker(ctx, target, header, req, true) + default: + err = providers.ErrUnsupported + } + result.ReasoningLevel = resolved.ReasoningLevel + if workerAttempt { + if resp != nil { + a.httpStatus = resp.StatusCode + result.AccountID = firstNonEmpty(resp.Header.Get("X-Qoder-Account"), result.AccountID) + noteStreamRoute(ctx, result.AccountID, target.provider()) + } + if err != nil { + return result, classified, a, err + } + result.ReasoningLevel = RequestedReasoningLevel(req) + } else if err != nil { + if resp != nil && resp.Body != nil { + resp.Body.Close() + } + if errors.Is(err, providers.ErrUnsupported) { + return result, Classified{Kind: accounts.KindInvalidRequest, Message: err.Error()}, a, err + } + classified := ClassifyError(err) + return result, classified, a, NewExecutionError(classified, err) + } + if resp == nil || resp.Body == nil { + err := StreamIncompleteError() + return result, ClassifyError(err), a, err + } + a.httpStatus = resp.StatusCode + body, classified, err := probeStreamBody(resp.Body) + if err != nil { + if classified.Kind == "" { + classified = ClassifyError(err) + } + return result, classified, a, NewExecutionError(classified, err) + } + resp.Body = body + result.Response = resp + result.TTFBMs = int(time.Since(a.started).Milliseconds()) + logResolvedReasoning(ctx, "chat_stream", item, target.memberModel, result.ReasoningLevel) + return result, Classified{}, a, nil +} + +type streamCompletion struct { + once sync.Once + attempt dispatchAttempt + requestID string + sessionKey string + bindingVersion uint64 +} + +// FinishStream reports the terminal result of an accepted relay. Call before +// closing the body; client cancellation must not cool the upstream account. +func (e ChatExecutor) FinishStream(ctx context.Context, result StreamResult, err error) { + if result.completion != nil { + e.completeStream(ctx, result.completion, err) + } else if err != nil && dispatchCancellation(ctx, err, ClassifyError(err)) == nil { + e.ObserveStreamFailure(result.PoolAccountID, err, result.CooldownModel) + } +} + +func (e ChatExecutor) completeStream(ctx context.Context, completion *streamCompletion, err error) { + if ctx == nil { + ctx = context.Background() + } + ctx = context.WithValue(ctx, requestIDKey{}, completion.requestID) + completion.once.Do(func() { + a := completion.attempt + if err == nil { + e.Pool.markRouteOK(a.target.item, a.target.cooldownKey) + e.SessionAffinity.touchVersion(completion.sessionKey, completion.bindingVersion) + a.record(e, ctx, accounts.AttemptStatusOK, Classified{}, accounts.RequestAttempt{}) + return + } + classified := ClassifyError(err) + if canceled := dispatchCancellation(ctx, err, classified); canceled != nil { + classified = ClassifyError(canceled) + } + if classified.Kind == accounts.KindQuota && classified.Cooldown <= 0 { + classified.Cooldown = NextLocalMidnightCooldown() + } + e.feedback(ctx, a.target, "stream_body", classified) + if classified.Failover { + e.SessionAffinity.forgetVersion(completion.sessionKey, completion.bindingVersion) + } + a.record(e, ctx, accounts.AttemptStatusError, classified, accounts.RequestAttempt{}) + }) +} + +// releaseCloser transfers the reservation to the caller, who must close the +// body after consuming or abandoning it. +type releaseCloser struct { + io.ReadCloser + once sync.Once + release func() + err error +} + +func (c *releaseCloser) Close() error { + c.once.Do(func() { + c.err = c.ReadCloser.Close() + c.release() + }) + return c.err +} + +func (e ChatExecutor) NativeResponsesNonStream(ctx context.Context, req translate.ChatRequest, native *translate.NativeResponsesRequest, prefer, providerFilter string) (NativeResponseResult, error) { + return e.NativeResponsesNonStreamPrepared(ctx, req, native, routeInputFromContext(ctx, req, prefer, providerFilter)) +} + +// NativeResponsesNonStreamPrepared collects upstream SSE before exposing +// anything to the client. Collection failures may retry within this same loop. +func (e ChatExecutor) NativeResponsesNonStreamPrepared(ctx context.Context, req translate.ChatRequest, native *translate.NativeResponsesRequest, route RouteInput) (result NativeResponseResult, returnErr error) { + if native == nil || e.Providers == nil { + return result, providers.ErrUnsupported + } + ctx = dispatchContext(ctx, route) + optionalNative := nativeResponsesCompatFallback(route.AggregatePlan, native) + var eligible func(Item) bool = e.nativeResponsesEligible + if optionalNative { + eligible = nil + } + l := e.newRouteLoop(route, req.Model, eligible) + defer func() { result.Routing = l.routing.Source }() + for l.index < l.attempts { + var upstream StreamResult + var a dispatchAttempt + if optionalNative { + if err := ctx.Err(); err != nil { + r, streamErr := l.streamError(err) + result = nativeResponsesResultFromStream(r) + return result, streamErr + } + target, index, err := l.pickNextReserved(e) + if err != nil { + r, streamErr := l.streamError(err) + result = nativeResponsesResultFromStream(r) + return result, streamErr + } + noteStreamRoute(ctx, target.item.ID, target.provider()) + if !e.nativeResponsesEligible(target.item) { + chatResult, classified, attempt, attemptErr := e.nonStreamAttempt(ctx, target, index, l.headerAccount(target, index), req) + result = nativeResponsesResultFromChat(chatResult) + if attemptErr == nil { + e.Pool.markRouteOK(target.item, target.cooldownKey) + e.bindSession(l.routing, target.item.ID) + attempt.record(e, ctx, accounts.AttemptStatusOK, Classified{}, accounts.RequestAttempt{ + PromptTokens: ptrInt(chatResult.PromptTokens), CompletionTokens: ptrInt(chatResult.CompletionTokens), UsageSource: chatResult.UsageSource, + }) + e.releaseInFlight(l.requestID, target.item.ID) + return result, nil + } + retry, attemptErr := e.dispatchError(ctx, &l, attempt, chatResult.AccountID, "chat_non_stream", classified, attemptErr) + e.releaseInFlight(l.requestID, target.item.ID) + if !retry { + return result, attemptErr + } + continue + } + var classified Classified + upstream, classified, a, err = e.streamAttempt(ctx, target, index, l.headerAccount(target, index), req, native, true) + if err != nil { + retry, err := e.dispatchError(ctx, &l, a, upstream.AccountID, "chat_stream_open", classified, err) + e.releaseInFlight(l.requestID, target.item.ID) + result = nativeResponsesResultFromStream(upstream) + if !retry { + return result, err + } + continue + } + } else { + var err error + upstream, a, err = e.openRoutedStream(ctx, &l, req, native, false) + result = nativeResponsesResultFromStream(upstream) + if err != nil { + return result, err + } + } + result = nativeResponsesResultFromStream(upstream) + collected, err := translate.CollectResponses(upstream.Response.Body) + upstream.Response.Body.Close() + if err == nil { + result.Response, result.FinishReason = collected.Response, collected.FinishReason + result.PromptTokens, result.OutputTokens, result.CachedTokens = collected.InputTokens, collected.OutputTokens, collected.CachedTokens + e.Pool.markRouteOK(a.target.item, a.target.cooldownKey) + e.bindSession(l.routing, a.target.item.ID) + a.record(e, ctx, accounts.AttemptStatusOK, Classified{}, accounts.RequestAttempt{PromptTokens: result.PromptTokens, CompletionTokens: result.OutputTokens}) + e.releaseInFlight(l.requestID, a.target.item.ID) + return result, nil + } + err = classifyResponsesCollectionError(err) + retry, err := e.dispatchError(ctx, &l, a, upstream.AccountID, "native_responses_body", ClassifyError(err), err) + e.releaseInFlight(l.requestID, a.target.item.ID) + if !retry { + return result, err + } + } + return result, l.lastErr +} + +func nativeResponsesResultFromStream(upstream StreamResult) NativeResponseResult { + return NativeResponseResult{ + AccountID: upstream.AccountID, PoolAccountID: upstream.PoolAccountID, Provider: upstream.Provider, + AttemptCount: upstream.AttemptCount, ReasoningLevel: upstream.ReasoningLevel, CooldownModel: upstream.CooldownModel, + AggregateFEFO: upstream.AggregateFEFO, + } +} + +func nativeResponsesResultFromChat(chat ChatResult) NativeResponseResult { + cached := chat.CacheReadTokens + if cached == nil { + cached = chat.CachedTokens + } + return NativeResponseResult{ + CompatResult: &chat, AccountID: chat.AccountID, PoolAccountID: chat.PoolAccountID, Provider: chat.Provider, + AttemptCount: chat.AttemptCount, ReasoningLevel: chat.ReasoningLevel, FinishReason: chat.FinishReason, + PromptTokens: ptrInt(chat.PromptTokens), OutputTokens: ptrInt(chat.CompletionTokens), CachedTokens: cached, + CooldownModel: chat.CooldownModel, AggregateFEFO: chat.AggregateFEFO, + } +} + +func classifyResponsesCollectionError(err error) error { + var upstream *translate.ResponsesStreamFailure + if errors.As(err, &upstream) { + return ClassifyUpstreamBody(0, upstream.Body) + } + if errors.Is(err, translate.ErrResponsesIncomplete) { + return StreamIncompleteError() + } + return StreamReadError(err) +} diff --git a/internal/executor/error.go b/internal/executor/error.go index d9d3247cc..a75767488 100644 --- a/internal/executor/error.go +++ b/internal/executor/error.go @@ -2,9 +2,11 @@ package executor import ( "context" + "encoding/json" "errors" "net/http" "net/url" + "strconv" "strings" "time" @@ -46,9 +48,146 @@ func NewExecutionError(classified Classified, err error) *ExecutionError { return &ExecutionError{Classified: classified, Err: err} } -// ClassifyUpstreamBody classifies an upstream HTTP/SSE error body once. +// ClassifyUpstreamBody classifies a known upstream failure envelope. func ClassifyUpstreamBody(status int, body string) error { - return NewExecutionError(Classify(status, body, "", "", ""), nil) + return newUpstreamResponseError(inspectUpstreamFailure(body).classify(status)) +} + +// ClassifyStreamEvent returns nil for ordinary SSE events. Use this for both +// pre-dispatch probing and the relay so nested worker and Responses errors +// have the same meaning before and after the stream is exposed. +func ClassifyStreamEvent(eventName, data string) error { + failure := inspectUpstreamFailure(data) + event := strings.ToLower(strings.TrimSpace(eventName)) + if event != "error" && event != "response.failed" && !failure.recognized { + return nil + } + return newUpstreamResponseError(failure.classify(0)) +} + +// An explicit upstream reply is distinct from a failed read. Keep that +// distinction through wrappers when the client disconnects at the same time. +type upstreamResponseError struct{ *ExecutionError } + +func (e upstreamResponseError) Unwrap() error { return e.ExecutionError } + +func newUpstreamResponseError(classified Classified) error { + return upstreamResponseError{NewExecutionError(classified, nil)} +} + +// dispatchCancellation treats an ambiguous read/open failure as cancellation +// only when the request context is actually done. An observed upstream reply +// (or a specific classification such as quota or rate limit) is still evidence +// about the selected account. A successful terminal result has no error. +func dispatchCancellation(ctx context.Context, err error, classified Classified) error { + if ctx == nil || err == nil { + return nil + } + cause := ctx.Err() + if cause == nil { + return nil + } + if requestContextDone(ctx, err) { + return cause + } + var upstream upstreamResponseError + if errors.As(err, &upstream) { + return nil + } + switch classified.Kind { + case "", accounts.KindCanceled, accounts.KindUnavailable: + return cause + default: + return nil + } +} + +type upstreamFailure struct { + raw, body string + status int + noFailover bool + recognized bool +} + +func inspectUpstreamFailure(raw string) upstreamFailure { + raw = strings.TrimSpace(raw) + f := upstreamFailure{raw: raw, body: raw} + // Wrapper metadata remains authoritative even when the diagnostic lives + // in a JSON string or an inner body. Bound traversal of wrappers. + for depth := 0; depth < 8; depth++ { + var value any + if json.Unmarshal([]byte(f.body), &value) != nil { + break + } + switch value := value.(type) { + case string: + f.body = strings.TrimSpace(value) + case map[string]any: + response, _ := value["response"].(map[string]any) + typ, _ := value["type"].(string) + if typ == "error" || typ == "response.failed" || value["error"] != nil || response["error"] != nil { + f.recognized = true + } + for _, obj := range []map[string]any{value, nestedFailureObject(value, "error"), response, nestedFailureObject(response, "error")} { + f.readMetadata(obj) + f.readMetadata(nestedFailureObject(obj, "data")) + } + if _, isChatChunk := value["choices"]; !isChatChunk && !strings.HasPrefix(typ, "response.") { + message, _ := value["message"].(string) + f.recognized = f.recognized || value["code"] != nil || value["msgCode"] != nil || value["kind"] != nil || strings.TrimSpace(message) != "" + } + if value["body"] == nil || value["error"] != nil || response["error"] != nil { + return f + } + inner, err := json.Marshal(value["body"]) + if err != nil { + return f + } + f.body = string(inner) + default: + return f + } + } + return f +} + +func nestedFailureObject(obj map[string]any, field string) map[string]any { + nested, _ := obj[field].(map[string]any) + return nested +} + +func (f *upstreamFailure) readMetadata(obj map[string]any) { + if v, ok := obj["failover"].(bool); ok && !v { + f.noFailover = true + } + if f.status != 0 { + return + } + for _, key := range []string{"status", "status_code", "statusCode", "statusCodeValue"} { + if status, err := strconv.Atoi(stringifyJSONCode(obj[key])); err == nil && status >= 400 && status <= 599 { + f.status, f.recognized = status, true + return + } + } +} + +func (f upstreamFailure) classify(status int) Classified { + if status == 0 { + status = f.status + } + var retryAfter string + if f.body != f.raw { + if retry := retryAfterFromBody(f.raw, time.Now()); retry > 0 { + retryAfter = retry.String() + } + } + var failover string + if f.noFailover { + // An upstream can forbid switching; it cannot make a request-level + // failure retryable against the executor's classification. + failover = "0" + } + return Classify(status, f.body, retryAfter, "", failover) } // StreamIncompleteError is a mid-body stream that ended without [DONE]. diff --git a/internal/executor/fefo.go b/internal/executor/fefo.go index b1297008e..5fbcb563e 100644 --- a/internal/executor/fefo.go +++ b/internal/executor/fefo.go @@ -196,29 +196,76 @@ func fefoCandidates(available []Item, publicModel string, now time.Time, resolve } // HasFEFOQuota reports whether a completed request could have consumed a -// trustworthy package balance. Runtime uses this gate to refresh only opt-in, -// supported routes; the historical strategies add no upstream traffic. +// trustworthy package balance under the global FEFO strategy. The legacy +// caller supplies a public model, so account aliases still apply. func (p *Pool) HasFEFOQuota(accountID, publicModel string) bool { + return p.hasFEFOQuotaForUse(accountID, publicModel, false, false) +} + +// HasRouteFEFOQuota checks the actual model key captured at dispatch. An +// aggregate FEFO path is eligible independently of the global pool strategy. +func (p *Pool) HasRouteFEFOQuota(accountID, concreteModel string, aggregateFEFO bool) bool { + return p.hasFEFOQuotaForUse(accountID, concreteModel, aggregateFEFO, true) +} + +func (p *Pool) hasFEFOQuotaForUse(accountID, model string, aggregateFEFO, concrete bool) bool { if p == nil || accountID == "" { return false } p.mu.Lock() defer p.mu.Unlock() - if p.routingStrategy != RoutingStrategyFEFO { + if !aggregateFEFO && p.routingStrategy != RoutingStrategyFEFO { + return false + } + item, ok := p.fefoQuotaAccountLocked(accountID) + if !ok { return false } + if !concrete { + model = effectiveCreditModel(item, model) + return model != "" && !itemServesFreeModel(item, model) + } + // The dispatched key is authoritative, even if it is also an alias in + // the current pool snapshot. Compare it directly to canonical free IDs. + if model == "" || model == "auto" || model != CanonicalModelID(model) { + return false + } + for _, free := range item.FreeModels { + if CanonicalModelID(free) == model { + return false + } + } + return true +} + +// FEFOQuotaAccount returns the latest item for a queued after-use refresh +// only while it still has trustworthy packages. Request-specific strategy +// and model checks belong to admission, not the account-wide fetch. +func (p *Pool) FEFOQuotaAccount(accountID string) (Item, bool) { + if p == nil || accountID == "" { + return Item{}, false + } + p.mu.Lock() + defer p.mu.Unlock() + item, ok := p.fefoQuotaAccountLocked(accountID) + if !ok { + return Item{}, false + } + return item.clone(), true +} + +func (p *Pool) fefoQuotaAccountLocked(accountID string) (Item, bool) { for _, item := range p.items { if item.ID != accountID { continue } - model := effectiveCreditModel(item, publicModel) - if model == "" || itemServesFreeModel(item, model) { - return false - } _, _, tracked := fefoQuotaState(item, time.Now()) - return tracked + if tracked { + return item, true + } + break } - return false + return Item{}, false } // FEFOQuotaDepleted reports whether an account routed by FEFO has a diff --git a/internal/executor/fefo_test.go b/internal/executor/fefo_test.go index 0c14b9853..0beb7cf92 100644 --- a/internal/executor/fefo_test.go +++ b/internal/executor/fefo_test.go @@ -317,3 +317,40 @@ func TestFEFOQuotaTrackingAndDepletion(t *testing.T) { t.Fatal("unknown dates must not be treated as depleted") } } + +func TestRouteFEFOQuotaChecksDispatchedKeyAndStrategy(t *testing.T) { + account := fefoItem("account", fefoPack(10, 0)) + account.FreeModels = []string{"FREE", "Vendor:Preview"} + account.ModelAliases = map[string]string{"public": "paid", "paid": "free", "free": "paid"} + untrusted := fefoItem("untrusted", fefoPack(10, 0)) + untrusted.Quota.Packages[0].Scope = "" + p := fefoPool(account, untrusted) + if !p.HasFEFOQuota(account.ID, "public") || p.HasFEFOQuota(account.ID, "paid") { + t.Fatal("legacy public names should still use one account alias lookup") + } + if !p.HasRouteFEFOQuota(account.ID, "paid", false) || p.HasRouteFEFOQuota(account.ID, "free", false) { + t.Fatal("dispatched keys must not resolve aliases even under global FEFO") + } + + p.SetRoutingStrategy(RoutingStrategyFillFirst) + if p.HasRouteFEFOQuota(account.ID, "paid", false) || !p.HasRouteFEFOQuota(account.ID, "paid", true) { + t.Fatal("only the selected aggregate FEFO path should bypass the global strategy") + } + for _, model := range []string{"", "auto", " Paid ", "free", "vendor:preview"} { + if p.HasRouteFEFOQuota(account.ID, model, true) { + t.Errorf("non-concrete or free model %q admitted to after-use refresh", model) + } + } + for _, id := range []string{"", "missing", untrusted.ID} { + if p.HasRouteFEFOQuota(id, "paid", true) { + t.Errorf("untracked account %q admitted to after-use refresh", id) + } + } + if item, ok := p.FEFOQuotaAccount(account.ID); !ok || item.ID != account.ID { + t.Fatalf("after-use worker could not find tracked account outside global FEFO: %q, %v", item.ID, ok) + } + p.MergeQuota(account.ID, untrusted.Quota) + if _, ok := p.FEFOQuotaAccount(account.ID); ok { + t.Fatal("after-use worker must not refresh an account once its packages lose their trusted scope") + } +} diff --git a/internal/executor/native_responses_test.go b/internal/executor/native_responses_test.go index 6da83d7bd..491d5260f 100644 --- a/internal/executor/native_responses_test.go +++ b/internal/executor/native_responses_test.go @@ -3,10 +3,14 @@ package executor import ( "context" "io" + "maps" "net/http" + "slices" "strings" "testing" + "time" + "github.com/caigee-cmd/cli2api/internal/accounts" "github.com/caigee-cmd/cli2api/internal/providers" "github.com/caigee-cmd/cli2api/internal/translate" ) @@ -56,3 +60,145 @@ func TestNativeResponsesDispatchDoesNotRequireChatCompatibility(t *testing.T) { t.Fatalf("native request changed: model=%q input=%s", streamer.model, streamer.input) } } + +// A native-only adapter can fail either before the first frame is exposed or +// after response.created while the non-stream handler is buffering. Both +// failures must use the real member and the original request budget. +func TestNativeAggregateFailureUsesSameBudgetAndTarget(t *testing.T) { + for _, tc := range []struct { + name string + firstEvent string + stream bool + fallback bool + }{ + {name: "first-frame", stream: true, fallback: true}, + {name: "collect", firstEvent: "data: {\"type\":\"response.created\"}\n\n", fallback: true}, + {name: "single-attempt", firstEvent: "data: {\"type\":\"response.created\"}\n\n"}, + } { + t.Run(tc.name, func(t *testing.T) { + var models []string + adapter := nativeDispatchFunc(func(accountID, upstreamModel string) string { + if accountID != "native-1" { + t.Errorf("account ID = %q", accountID) + } + models = append(models, upstreamModel) + if upstreamModel == "native-A" { + return tc.firstEvent + "event: response.failed\n" + + `data: {"type":"response.failed",` + "\n" + + `data: "response":{"status":"failed","error":{"status_code":429,"code":"tight_budget","message":"busy","retry_after":120}}}` + "\n\n" + } + return `data: {"type":"response.completed","response":{"status":"completed","output":[]}}` + "\n\n" + }) + p := NewPool(nil, nil) + p.Upsert(Item{ + ID: "native-1", Provider: "codex", Runtime: "in_process", MaxInFlight: 1, + Models: []string{"real-a", "real-b"}, ModelAliases: map[string]string{"alias-a": "real-a"}, + NativeModels: map[string]string{"real-a": "native-A", "real-b": "native-B"}, + }) + e := NewChatExecutor(p, "") + e.Providers = providers.NewRegistry() + e.Providers.Register(providers.Adapter{ID: "codex", NativeResponses: adapter}) + e.MaxAttempts = 1 // a prepared aggregate uses its own upper bound + var attempts []accounts.RequestAttempt + e.OnAttempt = func(a accounts.RequestAttempt) { attempts = append(attempts, a) } + plan := NewAggregatePlan(accounts.Aggregation{ID: "logical", Strategy: accounts.AggregationPriority, + AllowFallbacks: tc.fallback, MaxAttempts: 2, Members: []accounts.AggregationMember{ + {Provider: "codex", Model: "alias-a", Priority: 0}, + {Provider: "codex", Model: "real-b", Priority: 1}, + }, + }) + req := translate.ChatRequest{Model: "logical", Stream: tc.stream} + route := RouteInput{RequestID: "native-test", RouteModel: req.Model, AggregatePlan: plan} + native, err := translate.ParseNativeResponses([]byte(`{"model":"logical","input":"hi"}`)) + if err != nil { + t.Fatal(err) + } + if tc.stream { + result, err := e.ChatStreamProxyNativeResponsesPrepared(t.Context(), req, native, route) + if err != nil || result.CooldownModel != "real-b" || result.AttemptCount != 2 { + t.Fatalf("stream = %+v, err=%v", result, err) + } + defer result.Response.Body.Close() + _, err = translate.CollectResponses(result.Response.Body) + if err != nil { + t.Fatal(err) + } + e.FinishStream(t.Context(), result, nil) + result.Response.Body.Close() + } else { + result, err := e.NativeResponsesNonStreamPrepared(t.Context(), req, native, route) + if tc.fallback { + if err != nil || result.CooldownModel != "real-b" || result.AttemptCount != 2 { + t.Fatalf("buffered = %+v, err=%v", result, err) + } + } else if classified := ClassifyError(err); err == nil || result.AttemptCount != 1 || classified.Code != "tight_budget" || classified.Status != 429 || classified.RetryAfter != 120*time.Second { + t.Fatalf("terminal = %+v, class=%+v, err=%v", result, classified, err) + } + } + want := []string{"native-A"} + if tc.fallback { + want = append(want, "native-B") + } + if !slices.Equal(models, want) || len(attempts) != len(want) { + t.Fatalf("models=%v attempts=%+v, want %v", models, attempts, want) + } + for i, a := range attempts { + if a.AttemptIndex != i || a.AccountID != "native-1" || a.RequestID != route.RequestID { + t.Fatalf("attempt #%d = %+v", i, a) + } + } + item, _ := p.ByID("native-1") + if item.InFlight != 0 || len(item.ModelDownUntil) != 1 || item.ModelDownUntil["real-a"].IsZero() || !item.DownUntil.IsZero() { + t.Fatalf("feedback = %+v", item) + } + }) + } +} + +type nativeDispatchFunc func(accountID, upstreamModel string) string + +func (f nativeDispatchFunc) ResponsesStream(_ context.Context, id string, _ *translate.NativeResponsesRequest, options providers.RequestOptions) (*http.Response, providers.ResolvedChat, error) { + return &http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(strings.NewReader(f(id, options.Model)))}, providers.ResolvedChat{}, nil +} + +func TestNativeCapabilityProbeLeavesPoolAndAffinityUntouched(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "a", Provider: "workbuddy", Region: "cn", Models: []string{"model"}, MaxInFlight: 1}) + p.Upsert(Item{ID: "b", Provider: "workbuddy", Region: "cn", Models: []string{"model"}, MaxInFlight: 1}) + if !p.Acquire("a") { + t.Fatal("cannot occupy the first account") + } + p.MarkClassified("b", Classified{Kind: accounts.KindRateLimit, Model: "model", Cooldown: time.Hour}) + e := NewChatExecutor(p, "") + e.Providers = providers.NewRegistry() + e.Providers.Register(providers.Adapter{ID: "workbuddy", NativeResponses: &nativeOnlyStreamer{}}) + e.SessionAffinity.Bind("missing", "deleted") + before := e.SessionAffinity.Stats() + cursor, region := maps.Clone(p.lastPicked), maps.Clone(p.lastRegion) + req := translate.ChatRequest{Model: "model"} + route := RouteInput{RouteModel: req.Model, SessionKey: "missing", AllowedProviders: []string{"workbuddy:cn"}} + if !e.HasNativeResponsesRoutePrepared(t.Context(), req, route) { + t.Fatal("cooldown and contention hid an in-scope native route") + } + plan := NewAggregatePlan(accounts.Aggregation{ID: "logical", Strategy: accounts.AggregationPriority, Members: []accounts.AggregationMember{{Provider: "workbuddy", Model: "model"}}}) + route.AggregatePlan, route.RouteModel = plan, plan.ID + if !e.HasNativeResponsesRoutePrepared(t.Context(), req, route) { + t.Fatal("cooldown and contention hid an in-scope aggregate native route") + } + route.RegionFilter = "global" + if e.HasNativeResponsesRoutePrepared(t.Context(), req, route) { + t.Fatal("probe bypassed the region/grant intersection") + } + a, _ := p.ByID("a") + b, _ := p.ByID("b") + if a.InFlight != 1 || b.InFlight != 0 || b.ModelDownUntil["model"].IsZero() || !maps.Equal(cursor, p.lastPicked) || !maps.Equal(region, p.lastRegion) { + t.Fatalf("probe changed the pool: a=%+v b=%+v", a, b) + } + if got := e.SessionAffinity.Stats(); got != before { + t.Fatalf("probe changed affinity statistics: before=%+v after=%+v", before, got) + } + if bound, ok := e.SessionAffinity.Peek("missing"); !ok || bound != "deleted" { + t.Fatalf("probe changed the prior binding: %q, %t", bound, ok) + } + p.Release("a") +} diff --git a/internal/executor/pool.go b/internal/executor/pool.go index 71991fe47..1fd8c0068 100644 --- a/internal/executor/pool.go +++ b/internal/executor/pool.go @@ -2,7 +2,10 @@ package executor import ( "log" + "maps" + "slices" "sort" + "strconv" "strings" "sync" "time" @@ -82,6 +85,11 @@ type Item struct { // model-A look like a repeat. The account-wide LastKind covers // non-model-scoped failures. ModelLastKind map[string]string + // modelFeedback is short-lived, process-local model availability state. It + // keeps explicit model rejections scoped to one canonical model and records + // a per-model revision so a request selected before rejection cannot report + // stale success after a catalog refresh. It is deliberately not persisted. + modelFeedback map[string]modelFeedbackState // BackoffLevel climbs on repeated failures of the same kind and resets // on success, so a persistently failing account backs off instead of // being retried at a fixed interval. @@ -106,7 +114,7 @@ type Item struct { } // RouteQuery selects candidates for one public model request. Empty fields are -// not filtered; excluded account IDs are honored before anything else. +// not filtered; exclusions may target an entire account or one of its models. type RouteQuery struct { PublicModel string PreferAccount string @@ -114,9 +122,14 @@ type RouteQuery struct { RegionFilter string AllowedProviders []string Excluded map[string]struct{} + ExcludedModels map[routeModelKey]struct{} + // preferAffinity is a soft session hint. An unsupported model on this + // account must not block other candidates in the same route scope. + preferAffinity bool // Eligible, when set, admits only items that can serve the request's // protocol (for example native Responses input the chat form cannot - // carry). Nil admits every item. + // carry). Nil admits every item. Like ModelResolver, it must be a pure + // function and may not call back into the pool. Eligible func(Item) bool // ModelResolver, when set, maps an item to the concrete model it should // serve for this request (used by aggregated/virtual model IDs). It MUST be @@ -134,12 +147,41 @@ type RouteQuery struct { // fefoNow is set only by a FEFO pool. Other strategies keep the historical // quota gate, even when a cached package has since expired. fefoNow time.Time - // creditFloorDefault is the global floor, filled in by PickRoute from the - // pool. An account's Item.CreditFloor override wins when non-nil. + // creditFloorDefault is the global floor, filled in by the pool from the + // current configuration. An account's CreditFloor override wins when non-nil. creditFloorDefault float64 percentFloorDefault float64 } +type routeModelKey struct{ AccountID, Model string } + +type modelFeedbackState struct { + version uint64 + rejectedUntil time.Time + updatedAt time.Time +} + +const ( + modelRejectionTTL = 5 * time.Minute + maxModelFeedbackPerItem = 512 +) + +func accountRouteModelKey(item Item, model string) routeModelKey { + key := cooldownModel(item, model) + if key == "" { + key = "auto" + } + return routeModelKey{AccountID: item.ID, Model: key} +} + +func routeModelExcluded(item Item, model string, q RouteQuery) bool { + if len(q.ExcludedModels) == 0 { + return false + } + _, excluded := q.ExcludedModels[accountRouteModelKey(item, model)] + return excluded +} + // effectiveModel returns the concrete model to match/cooldown for an item. // Without a resolver this is exactly PublicModel, so all existing routes are // byte-for-byte equivalent. @@ -188,6 +230,61 @@ func itemHasProvenModel(item Item, want string) bool { return false } +func modelRejected(item Item, model string, now time.Time) bool { + key := routeModel(model) + if key == "" { + return false + } + state, ok := item.modelFeedback[key] + return ok && now.Before(state.rejectedUntil) +} + +func modelFeedbackVersion(item Item, model string) uint64 { + return item.modelFeedback[routeModel(model)].version +} + +func recordModelRejection(item *Item, model string, version uint64, now time.Time) { + if item == nil { + return + } + if item.modelFeedback == nil { + item.modelFeedback = make(map[string]modelFeedbackState) + } + if _, exists := item.modelFeedback[model]; !exists && len(item.modelFeedback) >= maxModelFeedbackPerItem { + // Keep the map bounded. Prefer evicting a recovered/expired entry; if + // every entry is still actively rejected, evict the oldest rejection. + // The cap is per account and far above a normal provider catalog. + oldestKey := "" + oldestActive := false + var oldest time.Time + for key, state := range item.modelFeedback { + active := now.Before(state.rejectedUntil) + if oldestKey == "" || (oldestActive && !active) || (oldestActive == active && state.updatedAt.Before(oldest)) || + (oldestActive == active && state.updatedAt.Equal(oldest) && key < oldestKey) { + oldestKey, oldestActive, oldest = key, active, state.updatedAt + } + } + delete(item.modelFeedback, oldestKey) + } + item.modelFeedback[model] = modelFeedbackState{ + version: version, rejectedUntil: now.Add(modelRejectionTTL), updatedAt: now, + } +} + +func clearModelRejection(item *Item, model string, now time.Time) { + key := routeModel(model) + if item == nil || key == "" { + return + } + state, ok := item.modelFeedback[key] + if !ok || state.rejectedUntil.IsZero() { + return + } + state.rejectedUntil = time.Time{} + state.updatedAt = now + item.modelFeedback[key] = state +} + func rememberProvenModel(item *Item, model string) { if item == nil { return @@ -235,6 +332,9 @@ func itemCouldServeModel(item Item, publicModel string) bool { if target := item.ModelAliases[want]; target != "" { want = routeModel(target) } + if modelRejected(item, want, time.Now()) { + return false + } if itemHasCatalogModel(item, want) || itemHasProvenModel(item, want) { return true } @@ -296,6 +396,9 @@ func itemHasModel(item Item, publicModel string) bool { if target := item.ModelAliases[want]; target != "" { want = routeModel(target) } + if modelRejected(item, want, time.Now()) { + return false + } if itemHasCatalogModel(item, want) || itemHasProvenModel(item, want) { return true } @@ -415,14 +518,7 @@ func routeReadyAndScoped(item Item, q RouteQuery) bool { // that its quota is exceeded. Free-model accounts are never quota-blocked: // they spend no credits, so an exhausted account can still serve them. func routeBlockedByQuota(item Item, q RouteQuery) bool { - if !routeQuotaExceeded(item, q) { - return false - } - resolved, ok := routeResolvedModel(item, q) - if !ok { - return false - } - return routeReadyAndScoped(item, q) && itemCouldServeModel(item, resolved) + return routeQuotaExceeded(item, q) && routeHasModelCandidate(item, q) } // routeResolvedModel returns the concrete model this item serves for the @@ -446,20 +542,36 @@ func routeMatches(item Item, q RouteQuery) bool { return false } resolved, ok := routeResolvedModel(item, q) - return ok && itemHasModel(item, resolved) + return ok && !routeModelExcluded(item, resolved, q) && itemHasModel(item, resolved) } func routeHintMatches(item Item, q RouteQuery) bool { - if !routeBaseMatches(item, q) { + return !routeQuotaExceeded(item, q) && routeHasModelCandidate(item, q) +} + +func routeHasModelCandidate(item Item, q RouteQuery) bool { + if !routeReadyAndScoped(item, q) { return false } resolved, ok := routeResolvedModel(item, q) - return ok && itemCouldServeModel(item, resolved) + return ok && !routeModelExcluded(item, resolved, q) && itemCouldServeModel(item, resolved) +} + +func routeDispatchable(item Item, q RouteQuery, now time.Time) bool { + return !itemSaturated(item) && routeMatchesNow(item, q, now) +} + +func routeMatchesNow(item Item, q RouteQuery, now time.Time) bool { + return !itemDown(item, now) && routeMatches(item, q) && !itemModelDown(item, q, now) } type Pool struct { mu sync.Mutex items []Item + // Removed accounts can be reinserted by a runtime restart before old + // requests release their slots. Keep those reservations by logical ID + // until their last release or until Upsert makes the account live again. + detachedSlots map[string]inFlightSlots // lastPicked tracks the rotation cursor per route, keyed by // provider|region|model, as the *ID* of the previous pick. // @@ -483,14 +595,19 @@ type Pool struct { // have no per-account override. Zero disables the floor. Guarded by mu. defaultCreditFloor float64 defaultPercentFloor float64 - // stateCounter is the monotonic source for Item.StateVersion. Bumped - // under p.mu on every persistable mutation, so the version stamped onto - // a snapshot reflects its true production order even though the observer - // runs after the lock is released. + // stateCounter allocates monotonic versions for Item.StateVersion and + // per-model feedback. Persistable mutations stamp Item.StateVersion under + // p.mu so observer snapshots keep production order; a model rejection can + // consume a version without invalidating unrelated models account-wide. stateCounter uint64 observer PoolObserver } +type inFlightSlots struct { + count int + since time.Time +} + // PoolObserver receives a cloned Item after a persistable mutation // (MarkClassified / MarkOK). The callback is data-only: Pool never // accepts *Store, and the Manager persist goroutine is the writer. @@ -529,6 +646,18 @@ func (p *Pool) effectiveRoutingStrategy(q RouteQuery) string { return strategy } +// configureRouteLocked takes the routing configuration for a decision made +// under p.mu. Quota and strategy must be evaluated from the same snapshot. +func (p *Pool) configureRouteLocked(q RouteQuery, now time.Time) (RouteQuery, string) { + strategy := p.effectiveRoutingStrategy(q) + if strategy == RoutingStrategyFEFO { + q.fefoNow = now + } + q.creditFloorDefault = p.defaultCreditFloor + q.percentFloorDefault = p.defaultPercentFloor + return q, strategy +} + func NewPool(urls []string, ids []string) *Pool { items := make([]Item, 0, len(urls)) for i, url := range urls { @@ -576,7 +705,7 @@ func (p *Pool) SetCreditFloor(id string, floor *float64) { defer p.mu.Unlock() for i := range p.items { if p.items[i].ID == id { - p.items[i].CreditFloor = floor + p.items[i].CreditFloor = clonePoolValue(floor) return } } @@ -591,7 +720,7 @@ func (p *Pool) SetPercentFloor(id string, floor *float64) { defer p.mu.Unlock() for i := range p.items { if p.items[i].ID == id { - p.items[i].PercentFloor = floor + p.items[i].PercentFloor = clonePoolValue(floor) return } } @@ -636,8 +765,6 @@ func (p *Pool) Len() int { return p.LenRoute(RouteQuery{}) } -// LenRoute counts the candidate set for one route query, so retry attempts -// match the current pool instead of every registered account. // ReadyItems returns ready accounts for a route without moving a cursor. func (p *Pool) ReadyItems(q RouteQuery) []Item { if p == nil { @@ -646,15 +773,11 @@ func (p *Pool) ReadyItems(q RouteQuery) []Item { p.mu.Lock() defer p.mu.Unlock() now := time.Now() - if p.effectiveRoutingStrategy(q) == RoutingStrategyFEFO { - q.fefoNow = now - } - q.creditFloorDefault = p.defaultCreditFloor - q.percentFloorDefault = p.defaultPercentFloor + q, _ = p.configureRouteLocked(q, now) out := make([]Item, 0) for _, item := range p.items { - if routeMatches(item, q) && !itemDown(item, now) && !itemModelDown(item, q, now) && !itemSaturated(item) { - out = append(out, item) + if routeDispatchable(item, q, now) { + out = append(out, item.clone()) } } return out @@ -669,21 +792,12 @@ func (p *Pool) RotateIDs(key string, ids []string, advance bool) []string { } p.mu.Lock() defer p.mu.Unlock() - p.ensureRotationKey(key) start := 0 if last, ok := p.lastPicked[key]; ok { - for i, id := range ids { - if id == last { - if advance { - start = (i + 1) % len(ids) - } else { - start = i - } - break - } - } + start = rotationStart(ids, last, advance) } if advance { + p.ensureRotationKey(key) p.lastPicked[key] = ids[start] } out := make([]string, 0, len(ids)) @@ -692,17 +806,30 @@ func (p *Pool) RotateIDs(key string, ids []string, advance bool) []string { return out } +// rotationStart reads an already ordered list without moving its cursor. A +// composite route can scan from here and commit the winning seat only after +// reserving a slot while still holding p.mu. +func rotationStart(ids []string, last string, after bool) int { + for i, id := range ids { + if id == last { + if after { + return (i + 1) % len(ids) + } + return i + } + } + return 0 +} + +// LenRoute counts the candidate set for one route query, so retry attempts +// match the current pool instead of every registered account. func (p *Pool) LenRoute(q RouteQuery) int { if p == nil { return 0 } p.mu.Lock() defer p.mu.Unlock() - if p.effectiveRoutingStrategy(q) == RoutingStrategyFEFO { - q.fefoNow = time.Now() - } - q.creditFloorDefault = p.defaultCreditFloor - q.percentFloorDefault = p.defaultPercentFloor + q, _ = p.configureRouteLocked(q, time.Now()) count := 0 for _, item := range p.items { if routeMatches(item, q) { @@ -723,13 +850,26 @@ func (p *Pool) HasCapacity(q RouteQuery) bool { p.mu.Lock() defer p.mu.Unlock() now := time.Now() - if p.effectiveRoutingStrategy(q) == RoutingStrategyFEFO { - q.fefoNow = now + q, _ = p.configureRouteLocked(q, now) + for _, item := range p.items { + if routeDispatchable(item, q, now) { + return true + } } - q.creditFloorDefault = p.defaultCreditFloor - q.percentFloorDefault = p.defaultPercentFloor + return false +} + +// HasRoute reports whether a ready, in-scope account belongs to the route, +// regardless of quota, cooldown, or slot capacity. Protocol probes use it +// without changing the scheduler or mistaking temporary load for no route. +func (p *Pool) HasRoute(q RouteQuery) bool { + if p == nil { + return false + } + p.mu.Lock() + defer p.mu.Unlock() for _, item := range p.items { - if routeMatches(item, q) && !itemDown(item, now) && !itemModelDown(item, q, now) && !itemSaturated(item) { + if routeHasModelCandidate(item, q) { return true } } @@ -746,26 +886,25 @@ func (p *Pool) QuotaBlockedForModel(q RouteQuery) (Item, bool) { } p.mu.Lock() defer p.mu.Unlock() - if p.effectiveRoutingStrategy(q) == RoutingStrategyFEFO { - q.fefoNow = time.Now() - } - q.creditFloorDefault = p.defaultCreditFloor - q.percentFloorDefault = p.defaultPercentFloor + q, _ = p.configureRouteLocked(q, time.Now()) for _, item := range p.items { if routeBlockedByQuota(item, q) { - return item, true + return item.clone(), true } } return Item{}, false } func (p *Pool) First() (Item, bool) { - if p == nil || len(p.items) == 0 { + if p == nil { return Item{}, false } p.mu.Lock() defer p.mu.Unlock() - return p.items[0], true + if len(p.items) == 0 { + return Item{}, false + } + return p.items[0].clone(), true } func (p *Pool) ByID(id string) (Item, bool) { @@ -776,7 +915,7 @@ func (p *Pool) ByID(id string) (Item, bool) { defer p.mu.Unlock() for _, item := range p.items { if item.ID == id { - return item, true + return item.clone(), true } } return Item{}, false @@ -790,44 +929,86 @@ func (p *Pool) Pick(prefer string, excluded map[string]struct{}) (Item, bool) { // round-robin are applied in that order. The fallback path returns the item // with the earliest cooldown so callers can surface a classified error. func (p *Pool) PickRoute(q RouteQuery) (Item, bool) { - if p == nil || len(p.items) == 0 { - return Item{}, false + pick := p.selectRoute(q, false, nil) + return pick.item, pick.found +} + +// ReserveRoute selects and reserves a dispatchable account under the same lock. +// Only reserved=true owns a slot and requires Release(item.ID). When found is +// true but reserved is false, item is a cooldown hint, never a dispatch target. +func (p *Pool) ReserveRoute(q RouteQuery) (item Item, found, reserved bool) { + item, found, reserved, _ = p.reserveRoute(q) + return item, found, reserved +} + +// reserveRoute also reports whether an otherwise dispatchable account was +// at capacity when there was neither a reservation nor a cooldown hint. +func (p *Pool) reserveRoute(q RouteQuery) (item Item, found, reserved, saturated bool) { + pick := p.selectRoute(q, true, nil) + return pick.item, pick.found, pick.reserved, pick.saturated +} + +type routeSelection struct { + item Item + found bool + reserved bool + saturated bool + staleAffinityModel bool + widened bool +} + +func (p *Pool) selectRoute(q RouteQuery, reserve bool, hardScope *RouteQuery) routeSelection { + if p == nil { + return routeSelection{} } p.mu.Lock() defer p.mu.Unlock() now := time.Now() - strategy := p.effectiveRoutingStrategy(q) - if strategy == RoutingStrategyFEFO { - q.fefoNow = now - } - q.creditFloorDefault = p.defaultCreditFloor - q.percentFloorDefault = p.defaultPercentFloor - eligible := make([]int, 0, len(p.items)) - for i, item := range p.items { - if routeMatches(item, q) { - eligible = append(eligible, i) + pick := p.selectRouteLocked(q, reserve, now) + // Only a proven model miss on the soft preference permits this wider + // search. Neither a miss nor a cooldown hint has reserved or rotated. + if reserve && hardScope != nil && !pick.reserved && pick.staleAffinityModel { + if wide := p.selectRouteLocked(*hardScope, true, now); wide.reserved { + wide.staleAffinityModel, wide.widened = true, true + return wide } } + return pick +} + +func (p *Pool) selectRouteLocked(q RouteQuery, reserve bool, now time.Time) routeSelection { + q, strategy := p.configureRouteLocked(q, now) + var staleAffinityModel bool if q.PreferAccount != "" { - var pinned *Item for i := range p.items { - if p.items[i].ID != q.PreferAccount { + pinned := &p.items[i] + if pinned.ID != q.PreferAccount { continue } - copy := p.items[i] - pinned = © - break - } - if pinned != nil { - if _, skip := q.Excluded[pinned.ID]; !skip { - if routeModel(q.PublicModel) != "" && !itemCouldServeModel(*pinned, effectiveModel(*pinned, q)) { - return Item{}, false + if _, skip := q.Excluded[pinned.ID]; skip { + break + } + model := effectiveModel(*pinned, q) + if routeModelExcluded(*pinned, model, q) { + break + } + if q.preferAffinity { + // Repeat the model and alias/protocol eligibility checks from + // routeScope against the current item under the pool lock. + if !stickyAccountCanServeModel(*pinned, model) || (q.Eligible != nil && !q.Eligible(*pinned)) { + staleAffinityModel = true + break } - if routeMatches(*pinned, q) && !itemDown(*pinned, now) && - !itemModelDown(*pinned, q, now) && !itemSaturated(*pinned) { - return *pinned, true + } else if routeModel(q.PublicModel) != "" && !itemCouldServeModel(*pinned, model) { + return routeSelection{} + } + if routeDispatchable(*pinned, q, now) { + if reserve { + acquireItemLocked(pinned, now) } + return routeSelection{item: pinned.clone(), found: true, reserved: reserve} } + break } // Historical Qoder clients may pin an unknown account label; fall back // to normal scheduling like the pre-provider pool did. A cooling pin @@ -835,12 +1016,17 @@ func (p *Pool) PickRoute(q RouteQuery) (Item, bool) { } // Candidates that are ready right now. Sorted by ID so the rotation // cursor can resume from the previous pick even as the set changes. - available := make([]Item, 0, len(eligible)) - for _, i := range eligible { - item := p.items[i] - if !itemDown(item, now) && !itemModelDown(item, q, now) && !itemSaturated(item) { - available = append(available, item) + available := make([]Item, 0, len(p.items)) + saturated := false + for _, item := range p.items { + if !routeMatchesNow(item, q, now) { + continue + } + if itemSaturated(item) { + saturated = true + continue } + available = append(available, item) } if len(available) == 0 { // Nothing is ready right now. Distinguish the two failure modes so @@ -851,28 +1037,30 @@ func (p *Pool) PickRoute(q RouteQuery) (Item, bool) { // If any account is cooling, surface the one that frees up soonest so // the caller can report a classified retry-after error. var best Item - found := false - for i := range p.items { - item := p.items[i] - if !routeHintMatches(item, q) { - continue - } - if !itemDown(item, now) && !itemModelDown(item, q, now) { - // Saturated only — skip; not a candidate for the retry hint. + var bestAt time.Time + for _, item := range p.items { + until := resumeAt(item, q) + if !now.Before(until) || !routeHintMatches(item, q) { continue } - if !found || resumeAt(item, q).Before(resumeAt(best, q)) { - best = item - found = true + if bestAt.IsZero() || until.Before(bestAt) { + best, bestAt = item, until } } - return best, found + found := !bestAt.IsZero() + return routeSelection{item: best.clone(), found: found, saturated: !found && saturated, staleAffinityModel: staleAffinityModel} } - // Priority strategy: order candidates by the aggregation member's - // configured priority (lower first), then ID for a stable tie-break. The - // existing failover loop excludes the picked account on error, which - // naturally falls through to the next priority. - if strategy == AggregationStrategyPriority && q.PriorityResolver != nil { + key := rotationKey(q) + priorityReserve := reserve && strategy == AggregationStrategyPriority + if priorityReserve { + // Each usable priority tier has its own ID cursor. An interlude in + // a fallback tier cannot perturb ordering in the preferred tier. + var tier int + available, tier = lowestPriorityItems(available, q.PriorityResolver) + key += "|priority|" + strconv.Itoa(tier) + } + if strategy == AggregationStrategyPriority && q.PriorityResolver != nil && !priorityReserve { + // Compatibility: non-reserving priority picks used a fixed ID tie-break. sort.SliceStable(available, func(i, j int) bool { pi, pj := q.PriorityResolver(available[i]), q.PriorityResolver(available[j]) if pi != pj { @@ -883,8 +1071,14 @@ func (p *Pool) PickRoute(q RouteQuery) (Item, bool) { } else { sort.Slice(available, func(i, j int) bool { return available[i].ID < available[j].ID }) } - key := rotationKey(q) - p.ensureRotationKey(key) + lastID, seen := p.lastPicked[key] + lastRegion := p.lastRegion[key] + weightCounters := p.weightCounter[key] + if !seen && len(p.lastPicked) >= rotationLimit { + // A successful pick here will reset the cursor maps. Rank as if the + // reset has happened, without mutating them before the reservation. + lastRegion, weightCounters = "", nil + } // When the caller has not pinned a region, keep serving the region this // route used last (if it still has a candidate). Request handlers pin the // region from the first account picked, so an unpinned pick decides the @@ -899,70 +1093,73 @@ func (p *Pool) PickRoute(q RouteQuery) (Item, bool) { // or an aggregated model whose members carry their own provider/region) // must rank every member; latching one region would silently pin the whole // route to that region's provider and strand the other members. - if q.RegionFilter == "" && q.ModelResolver == nil && !crossProviderCandidates(available) && !isQuotaRoutingStrategy(strategy) { - if previous, ok := p.lastRegion[key]; ok { - // The latch is a hint, not a commitment: the pool can change - // underneath it. Keep the remembered region only while it still - // carries a fair share of the route; a latch left far behind by - // a bulk pool change is dropped so the route re-seats below. - if subset := inRegion(available, previous); len(subset) > 0 && !regionLatchStale(len(subset), available) { - available = subset - } else { - delete(p.lastRegion, key) - } - } - if _, ok := p.lastRegion[key]; !ok { - if preferred := largestRegion(available); preferred != "" { - p.lastRegion[key] = preferred - if subset := inRegion(available, preferred); len(subset) > 0 { - available = subset - } - } + if !priorityReserve && q.RegionFilter == "" && q.ModelResolver == nil && !crossProviderCandidates(available) && !isQuotaRoutingStrategy(strategy) { + if subset := inRegion(available, lastRegion); len(subset) > 0 && !regionLatchStale(len(subset), available) { + available = subset + } else if preferred := largestRegion(available); preferred != "" { + available = inRegion(available, preferred) } - } else { - p.lastRegion[key] = itemRegion(available[0]) } if strategy == RoutingStrategyFEFO { available = fefoCandidates(available, q.PublicModel, now, q.ModelResolver) } - // Priority order always uses the highest-priority available member; on - // failure the route loop excludes it and the next retry takes the next one. - if strategy == AggregationStrategyPriority { - picked := available[0] - p.lastPicked[key] = picked.ID - p.lastRegion[key] = itemRegion(picked) - return picked, true - } - if strategy == RoutingStrategyLeastQuotaFirst || strategy == RoutingStrategyMostQuotaFirst { - picked := pickQuotaStrategy(available, strategy == RoutingStrategyMostQuotaFirst, p.lastPicked[key]) - p.lastPicked[key] = picked.ID - p.lastRegion[key] = itemRegion(picked) - return picked, true - } - if strategy == RoutingStrategyFillFirst { - picked := pickFillFirstWithWeight(available, q) - p.lastPicked[key] = picked.ID - p.lastRegion[key] = itemRegion(picked) - return picked, true - } - if strategy == RoutingStrategyWeightedRoundRobin { - weighted, ok := p.pickWeighted(available, key, q) - if !ok { - picked := available[successorIndex(available, p.lastPicked[key])] - p.lastPicked[key] = picked.ID - p.lastRegion[key] = itemRegion(picked) - return picked, true - } - // Differentiated weights: smooth weighted round-robin keeps the load - // proportional without bursting one high-weight account first. - p.lastPicked[key] = weighted.ID - p.lastRegion[key] = itemRegion(weighted) - return weighted, true - } - picked := available[successorIndex(available, p.lastPicked[key])] + var picked Item + var totalWeight int64 + switch strategy { + case AggregationStrategyPriority: + if priorityReserve { + picked = available[successorIndex(available, lastID)] + } else { + picked = available[0] + } + case RoutingStrategyLeastQuotaFirst, RoutingStrategyMostQuotaFirst: + picked = pickQuotaStrategy(available, strategy == RoutingStrategyMostQuotaFirst, lastID) + case RoutingStrategyFillFirst: + picked = pickFillFirstWithWeight(available, q) + case RoutingStrategyWeightedRoundRobin: + picked, totalWeight = pickWeighted(available, weightCounters, q) + if totalWeight == 0 { + picked = available[successorIndex(available, lastID)] + } + default: + picked = available[successorIndex(available, lastID)] + } + if reserve { + // The candidate set and p.items cannot change between selection and + // this write. If a legacy pool was supplied duplicate IDs, keep the + // first-ID ownership rule used by Acquire and Release. + i := p.itemIndexLocked(picked.ID) + if i < 0 || !routeDispatchable(p.items[i], q, now) { + return routeSelection{saturated: saturated || (i >= 0 && itemSaturated(p.items[i])), staleAffinityModel: staleAffinityModel} + } + acquireItemLocked(&p.items[i], now) + picked = p.items[i] + } + p.ensureRotationKey(key) + if totalWeight != 0 { + p.commitWeighted(available, key, q, picked.ID, totalWeight) + } p.lastPicked[key] = picked.ID p.lastRegion[key] = itemRegion(picked) - return picked, true + return routeSelection{item: picked.clone(), found: true, reserved: reserve, staleAffinityModel: staleAffinityModel} +} + +func lowestPriorityItems(items []Item, priority func(Item) int) ([]Item, int) { + if priority == nil { + return items, 0 + } + tier := priority(items[0]) + best := items[:1] + for _, item := range items[1:] { + rank := priority(item) + if rank < tier { + tier, best = rank, best[:0] + } + if rank == tier { + best = append(best, item) + } + } + return best, tier } func pickFillFirst(available []Item) Item { @@ -1053,49 +1250,47 @@ func pickQuotaStrategy(available []Item, most bool, lastID string) Item { return best[successorIndex(best, lastID)] } -// pickWeighted runs smooth weighted round-robin when candidates have differing -// weights. It reports false when every candidate shares one weight, which -// leaves plain round-robin in charge: with a uniform pool the two are -// equivalent, and the ID cursor is what keeps rotation stable across a -// changing candidate set. -func (p *Pool) pickWeighted(available []Item, key string, q RouteQuery) (Item, bool) { +// pickWeighted ranks a smooth WRR turn without changing its counters. A zero +// total means weights are uniform (or invalid), so the caller uses the plain +// ID cursor, which is stable even as candidates enter or leave the set. +func pickWeighted(available []Item, counters map[string]int64, q RouteQuery) (Item, int64) { total := int64(0) uniform := true first := routeItemWeight(available[0], q) - for _, item := range available { + best := available[0] + var bestCurrent int64 + for i, item := range available { weight := int64(routeItemWeight(item, q)) total += weight if weight != int64(first) { uniform = false } + if current := counters[item.ID] + weight; i == 0 || current > bestCurrent { + best, bestCurrent = item, current + } } if uniform || total <= 0 { - return Item{}, false + return Item{}, 0 } + return best, total +} + +// commitWeighted applies the winning WRR turn under p.mu. Give each current +// candidate its weight, then debit the total from the winner; this spreads +// picks in proportion to their weights without a burst at the start. +func (p *Pool) commitWeighted(available []Item, key string, q RouteQuery, winner string, total int64) { if p.weightCounter == nil { p.weightCounter = map[string]map[string]int64{} } - if p.weightCounter[key] == nil { - p.weightCounter[key] = map[string]int64{} - } - // Smooth WRR: add each candidate's weight to its running counter and take - // the largest, then subtract the total from the winner. This spreads picks - // evenly across a window instead of front-loading the heaviest candidate. - best := -1 - var bestCurrent int64 - for i := range available { - current := p.weightCounter[key][available[i].ID] + int64(routeItemWeight(available[i], q)) - p.weightCounter[key][available[i].ID] = current - if best < 0 || current > bestCurrent { - best = i - bestCurrent = current - } + counters := p.weightCounter[key] + if counters == nil { + counters = map[string]int64{} + p.weightCounter[key] = counters } - if best < 0 { - return Item{}, false + for _, item := range available { + counters[item.ID] += int64(routeItemWeight(item, q)) } - p.weightCounter[key][available[best].ID] -= total - return available[best], true + counters[winner] -= total } // successorIndex returns the position of the first candidate ordered after @@ -1200,8 +1395,8 @@ func inRegion(items []Item, region string) []Item { } // itemSaturated reports whether the account already serves its configured -// concurrency limit. InFlight is owned by Acquire/Release on the request -// path; PickRoute uses this to skip accounts already at capacity. +// concurrency limit. Only request-path reservations and releases change the +// live count; selection skips accounts already at capacity. func itemSaturated(item Item) bool { if item.MaxInFlight <= 0 { return false @@ -1428,6 +1623,20 @@ func (p *Pool) ClearAccountQuotaCooldown(id string) { // model is empty the account is treated as fully healthy: account-wide // cooldown, backoff, and all model-scoped state are cleared. func (p *Pool) MarkOK(id, model string) { + p.markOK(id, model, nil) +} + +// markRouteOK records a completed dispatch against its concrete cooldown +// key. Unlike the administrative reset, auto is not evidence that all the +// account's models recovered. A late success must not overwrite state that +// changed after the account was selected. +func (p *Pool) markRouteOK(item Item, model string) { + if routeModel(model) != "" { + p.markOK(item.ID, model, &item) + } +} + +func (p *Pool) markOK(id, model string, selected *Item) { if p == nil || id == "" { return } @@ -1438,6 +1647,12 @@ func (p *Pool) MarkOK(id, model string) { continue } scoped := routeModel(model) + if selected != nil && (p.items[i].StateVersion != selected.StateVersion || + !p.items[i].DownUntil.Equal(selected.DownUntil) || + !p.items[i].ModelDownUntil[scoped].Equal(selected.ModelDownUntil[scoped]) || + modelFeedbackVersion(p.items[i], scoped) != modelFeedbackVersion(*selected, scoped)) { + break + } if scoped != "" { wasCooling := false if until, ok := p.items[i].ModelDownUntil[scoped]; ok && time.Now().Before(until) { @@ -1473,6 +1688,7 @@ func (p *Pool) MarkOK(id, model string) { p.items[i].LastKind = "" p.items[i].BackoffLevel = 0 } + clearModelRejection(&p.items[i], scoped, time.Now()) rememberProvenModel(&p.items[i], model) } else { // Account-wide success: the account proved it can serve traffic. @@ -1497,9 +1713,7 @@ func (p *Pool) MarkOK(id, model string) { } } -// SetDropSystemPrompt updates only the request-sanitization flag on a live -// item. Routing and runtime state stay untouched so the change applies to the -// next request without disturbing cooldowns or health. +// SetModelRouting replaces the aliases and allowed-model settings for an account. func (p *Pool) SetModelRouting(id string, aliases map[string]string, enabled []string, restricted bool) { if p == nil || id == "" { return @@ -1513,7 +1727,7 @@ func (p *Pool) SetModelRouting(id string, aliases map[string]string, enabled []s if len(aliases) == 0 { p.items[i].ModelAliases = nil } else { - p.items[i].ModelAliases = aliases + p.items[i].ModelAliases = maps.Clone(aliases) } if len(enabled) == 0 { p.items[i].EnabledModels = nil @@ -1525,6 +1739,8 @@ func (p *Pool) SetModelRouting(id string, aliases map[string]string, enabled []s } } +// SetDropSystemPrompt updates the request-sanitization flag without changing +// the account's routing or health state. func (p *Pool) SetDropSystemPrompt(id string, drop bool) { if p == nil || id == "" { return @@ -1593,42 +1809,58 @@ func (p *Pool) Acquire(id string) bool { } p.mu.Lock() defer p.mu.Unlock() + i := p.itemIndexLocked(id) + if i < 0 || itemSaturated(p.items[i]) { + return false + } + acquireItemLocked(&p.items[i], time.Now()) + return true +} + +// acquireItemLocked is shared by all selectors. The caller holds p.mu and +// has already established that the item has room. +func acquireItemLocked(item *Item, now time.Time) { + if item.InFlight == 0 { + item.InFlightSince = now + } + item.InFlight++ +} + +func (p *Pool) itemIndexLocked(id string) int { for i := range p.items { - if p.items[i].ID != id { - continue - } - 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() + if p.items[i].ID == id { + return i } - p.items[i].InFlight++ - return true } - return false + return -1 } -// Release frees one in-flight slot. Unknown ids are a no-op; the counter -// never goes below zero. +// Release frees one in-flight slot. A removed account may still own slots; +// unknown IDs and already-idle accounts are a no-op. func (p *Pool) Release(id string) { if p == nil || id == "" { return } p.mu.Lock() defer p.mu.Unlock() - for i := range p.items { - if p.items[i].ID != id { - continue - } - if p.items[i].InFlight > 0 { - p.items[i].InFlight-- - if p.items[i].InFlight == 0 { - p.items[i].InFlightSince = time.Time{} + if i := p.itemIndexLocked(id); i >= 0 { + item := &p.items[i] + if item.InFlight > 0 { + item.InFlight-- + if item.InFlight == 0 { + item.InFlightSince = time.Time{} } } return } + if slots, ok := p.detachedSlots[id]; ok { + if slots.count == 1 { + delete(p.detachedSlots, id) + } else { + slots.count-- + p.detachedSlots[id] = slots + } + } } func (p *Pool) SetRuntimeState(id, state string, nextRestartAt time.Time, backoffLevel int, lastError string) { @@ -1734,20 +1966,25 @@ func (p *Pool) MergeModelsWithPricing(id string, models, freeModels []string) { freeSeen[canonical] = struct{}{} free = append(free, native) } + now := time.Now() p.mu.Lock() defer p.mu.Unlock() for i := range p.items { if p.items[i].ID == id { p.items[i].Models = copied p.items[i].FreeModels = free - p.items[i].ModelsAt = time.Now() + p.items[i].ModelsAt = now + for model := range seen { + clearModelRejection(&p.items[i], model, now) + } return } } } -// RemoveModel drops one public ID from a cached catalog so a stale snapshot -// cannot keep sending traffic to an account that no longer serves the model. +// RemoveModel drops one public ID from a cached catalog and temporarily marks +// that canonical account/model route unavailable. Unknown catalogs would +// otherwise fail open and immediately reselect the explicitly rejected model. func (p *Pool) RemoveModel(id, model string) { want := routeModel(model) if p == nil || id == "" || want == "" { @@ -1784,6 +2021,8 @@ func (p *Pool) RemoveModel(id, model string) { // Force the manager to refresh this account's catalog on the next // request instead of trusting the now-mutated snapshot for the TTL. p.items[i].ModelsAt = time.Time{} + p.stateCounter++ + recordModelRejection(&p.items[i], want, p.stateCounter, time.Now()) return } } @@ -1796,7 +2035,7 @@ func (p *Pool) MergeQuota(id string, quota *QuotaSnapshot) { defer p.mu.Unlock() for i := range p.items { if p.items[i].ID == id { - p.items[i].Quota = quota + p.items[i].Quota = clonePoolQuota(quota) return } } @@ -1852,40 +2091,45 @@ func itemDown(item Item, now time.Time) bool { return !item.DownUntil.IsZero() && now.Before(item.DownUntil) } -// clone returns a copy of item whose mutable reference fields no longer -// alias the live pool entry. The persistence observer hands the snapshot -// to an async drainer that reads ModelDownUntil/ModelBackoff/Models/Quota -// off the pool lock; without a deep copy those maps and slices race -// against MarkClassified/MergeModels mutations. +// clone makes a detached snapshot for readers and the persistence observer. +// In particular, cooldown maps and model slices can be changed in place +// under p.mu after the snapshot is returned. Nil catalogs mean unknown; a +// known empty catalog must stay non-nil while copying it. func (item Item) clone() Item { out := item - if item.ModelDownUntil != nil { - out.ModelDownUntil = make(map[string]time.Time, len(item.ModelDownUntil)) - for k, v := range item.ModelDownUntil { - out.ModelDownUntil[k] = v - } - } - if item.ModelBackoff != nil { - out.ModelBackoff = make(map[string]int, len(item.ModelBackoff)) - for k, v := range item.ModelBackoff { - out.ModelBackoff[k] = v - } - } - if item.ModelLastKind != nil { - out.ModelLastKind = make(map[string]string, len(item.ModelLastKind)) - for k, v := range item.ModelLastKind { - out.ModelLastKind[k] = v - } - } - if item.Models != nil { - out.Models = append([]string(nil), item.Models...) - } - if item.ProvenModels != nil { - out.ProvenModels = append([]string(nil), item.ProvenModels...) + out.Ready = clonePoolValue(item.Ready) + out.Hot = clonePoolValue(item.Hot) + out.CreditFloor = clonePoolValue(item.CreditFloor) + out.PercentFloor = clonePoolValue(item.PercentFloor) + out.Quota = clonePoolQuota(item.Quota) + out.Models = slices.Clone(item.Models) + out.NativeModels = maps.Clone(item.NativeModels) + out.FreeModels = slices.Clone(item.FreeModels) + out.ProvenModels = slices.Clone(item.ProvenModels) + out.ModelDownUntil = maps.Clone(item.ModelDownUntil) + out.ModelBackoff = maps.Clone(item.ModelBackoff) + out.ModelLastKind = maps.Clone(item.ModelLastKind) + out.modelFeedback = maps.Clone(item.modelFeedback) + out.ModelAliases = maps.Clone(item.ModelAliases) + out.EnabledModels = slices.Clone(item.EnabledModels) + return out +} + +func clonePoolValue[T any](value *T) *T { + if value == nil { + return nil } - if item.Quota != nil { - q := *item.Quota - out.Quota = &q + out := *value + return &out +} + +func clonePoolQuota(quota *QuotaSnapshot) *QuotaSnapshot { + out := clonePoolValue(quota) + if out != nil { + out.Windows = slices.Clone(quota.Windows) + out.Packages = slices.Clone(quota.Packages) + out.AddOnAvailable = clonePoolValue(quota.AddOnAvailable) + out.ResourcePackageAvailable = clonePoolValue(quota.ResourcePackageAvailable) } return out } @@ -1926,6 +2170,7 @@ func (p *Pool) Upsert(item Item) { } item.Provider = NormalizeProviderFamily(item.Provider) item.Region = NormalizeRegion(item.Region) + item = item.clone() p.mu.Lock() defer p.mu.Unlock() for i := range p.items { @@ -1955,6 +2200,9 @@ func (p *Pool) Upsert(item Item) { if len(item.ModelLastKind) == 0 && len(p.items[i].ModelLastKind) > 0 { item.ModelLastKind = p.items[i].ModelLastKind } + if len(item.modelFeedback) == 0 && len(p.items[i].modelFeedback) > 0 { + item.modelFeedback = maps.Clone(p.items[i].modelFeedback) + } if item.StateVersion == 0 { item.StateVersion = p.items[i].StateVersion } @@ -1979,10 +2227,10 @@ func (p *Pool) Upsert(item Item) { if item.Hot == nil { item.Hot = p.items[i].Hot } - // InFlight is owned by Acquire/Release on the request path. - // Runtime Upserts never carry a live counter, so always keep the - // existing value instead of wiping concurrent requests to zero. + // In-flight state belongs to the request path, not the runtime + // snapshot being upserted. item.InFlight = p.items[i].InFlight + item.InFlightSince = p.items[i].InFlightSince if item.Quota == nil { item.Quota = p.items[i].Quota } @@ -2019,6 +2267,10 @@ func (p *Pool) Upsert(item Item) { return } } + if slots, ok := p.detachedSlots[item.ID]; ok { + item.InFlight, item.InFlightSince = slots.count, slots.since + delete(p.detachedSlots, item.ID) + } p.items = append(p.items, item) } @@ -2032,10 +2284,16 @@ func (p *Pool) Remove(id string) { if p.items[i].ID != id { continue } + if item := p.items[i]; item.InFlight > 0 { + if p.detachedSlots == nil { + p.detachedSlots = make(map[string]inFlightSlots) + } + p.detachedSlots[id] = inFlightSlots{count: item.InFlight, since: item.InFlightSince} + } // The rotation cursor stores the previous pick's ID, so a removed // account is skipped naturally; only a cursor pointing at it needs // clearing. - p.items = append(p.items[:i], p.items[i+1:]...) + p.items = slices.Delete(p.items, i, i+1) p.dropRotationCursor(id) return } diff --git a/internal/executor/pool_model_feedback_test.go b/internal/executor/pool_model_feedback_test.go new file mode 100644 index 000000000..d50b827c2 --- /dev/null +++ b/internal/executor/pool_model_feedback_test.go @@ -0,0 +1,129 @@ +package executor + +import ( + "testing" + "time" +) + +func TestRemoveModelRejectsUnknownCatalogOnlyForThatAccountAndModel(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "rejected"}) + p.Upsert(Item{ID: "other"}) + + p.RemoveModel("rejected", "Model-A") + + modelA := RouteQuery{PublicModel: "model-a"} + if got, found, reserved := p.ReserveRoute(modelA); !found || !reserved || got.ID != "other" { + t.Fatalf("rejected account re-entered unknown-catalog route: got=%+v found=%v", got, found) + } else { + p.Release(got.ID) + } + + modelB := RouteQuery{PublicModel: "model-b", PreferAccount: "rejected"} + if got, found, reserved := p.ReserveRoute(modelB); !found || !reserved || got.ID != "rejected" { + t.Fatalf("rejection for model-a blocked unrelated model-b: got=%+v found=%v", got, found) + } else { + p.Release(got.ID) + } + for _, item := range p.Items() { + if item.ID == "rejected" && (ItemHasModel(item, "model-a") || ItemCouldServeModel(item, "model-a")) { + t.Fatal("rejected account still reports model-a as routable or potentially routable") + } + } +} + +func TestRemoveModelPreventsLateSuccessFromRestoringProof(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "a", Models: []string{"model-a"}}) + selected := reservePoolItem(t, p, RouteQuery{PublicModel: "model-a"}, "a") + p.RemoveModel("a", "model-a") + p.markRouteOK(selected, "model-a") + p.Release(selected.ID) + + got, _ := p.ByID("a") + if itemHasProvenModel(got, "model-a") || ItemHasModel(got, "model-a") { + t.Fatalf("late success restored explicitly rejected model: %+v", got) + } +} + +func TestRemoveModelDoesNotInvalidateOtherModelSuccess(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "a", ModelDownUntil: map[string]time.Time{"model-c": time.Now().Add(time.Hour)}}) + selected := reservePoolItem(t, p, RouteQuery{PublicModel: "model-b"}, "a") + p.RemoveModel("a", "model-a") + p.markRouteOK(selected, "model-b") + p.Release(selected.ID) + + got, _ := p.ByID("a") + if !itemHasProvenModel(got, "model-b") { + t.Fatalf("rejecting model-a discarded an in-flight model-b success: %+v", got) + } + if got.ModelDownUntil["model-c"].IsZero() { + t.Fatalf("rejecting model-a cleared model-c cooldown: %+v", got.ModelDownUntil) + } +} + +func TestSuccessfulCatalogRefreshRecoversRejectedModel(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "a"}) + oldRequest := reservePoolItem(t, p, RouteQuery{PublicModel: "model-a"}, "a") + p.RemoveModel("a", "model-a") + firstVersion, _ := p.ByID("a") + firstRevision := modelFeedbackVersion(firstVersion, "model-a") + p.Upsert(Item{ID: "a"}) + p.RemoveModel("a", "MODEL-A") + secondVersion, _ := p.ByID("a") + secondRevision := modelFeedbackVersion(secondVersion, "model-a") + if secondRevision <= firstRevision { + t.Fatalf("repeated removal did not advance the model revision: first=%d second=%d", firstRevision, secondRevision) + } + p.Upsert(Item{ID: "a"}) + if _, found, reserved := p.ReserveRoute(RouteQuery{PublicModel: "model-a"}); found || reserved { + t.Fatal("explicitly rejected unknown-catalog model remained routable before refresh") + } + + p.MergeModels("a", []string{"model-a"}) + got, _ := p.ByID("a") + if !ItemCouldServeModel(got, "model-a") { + t.Fatal("successful catalog refresh did not restore model capability") + } + p.markRouteOK(oldRequest, "model-a") + got, _ = p.ByID("a") + if itemHasProvenModel(got, "model-a") { + t.Fatal("late success from before rejection restored proof after catalog recovery") + } + current := reservePoolItem(t, p, RouteQuery{PublicModel: "model-a"}, "a") + p.markRouteOK(current, "model-a") + p.Release(current.ID) + got, _ = p.ByID("a") + if !itemHasProvenModel(got, "model-a") { + t.Fatalf("new success after catalog recovery was not accepted: %+v", got) + } +} + +func TestRejectedModelStateExpiresAndStaysBounded(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "a"}) + p.RemoveModel("a", "model-a") + p.mu.Lock() + state := p.items[0].modelFeedback["model-a"] + state.rejectedUntil = time.Now().Add(-time.Second) + p.items[0].modelFeedback["model-a"] = state + p.mu.Unlock() + if got, found, reserved := p.ReserveRoute(RouteQuery{PublicModel: "model-a"}); !found || !reserved || got.ID != "a" { + t.Fatalf("expired rejection did not become routable: got=%+v found=%v reserved=%v", got, found, reserved) + } + p.Release("a") + + for i := 0; i < maxModelFeedbackPerItem+10; i++ { + p.RemoveModel("a", "model-"+itoa(i)) + } + items := p.Items() + if len(items) != 1 || len(items[0].modelFeedback) > maxModelFeedbackPerItem { + t.Fatalf("model feedback state exceeded per-account cap: items=%d states=%d cap=%d", len(items), len(items[0].modelFeedback), maxModelFeedbackPerItem) + } + latest := "model-" + itoa(maxModelFeedbackPerItem+9) + if !modelRejected(items[0], latest, time.Now()) || ItemCouldServeModel(items[0], latest) { + t.Fatal("capacity eviction lost the most recent explicit rejection") + } +} diff --git a/internal/executor/pool_reservation_test.go b/internal/executor/pool_reservation_test.go new file mode 100644 index 000000000..6149240c2 --- /dev/null +++ b/internal/executor/pool_reservation_test.go @@ -0,0 +1,319 @@ +package executor + +import ( + "maps" + "sync" + "testing" + "time" +) + +func TestPoolReserveRouteOnlyOneConcurrentSlot(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "account", Models: []string{"model"}, MaxInFlight: 1}) + q := RouteQuery{PublicModel: "model"} + const contenders = 64 + start := make(chan struct{}) + type decision struct { + item Item + found, reserved, saturated bool + } + results := make(chan decision, contenders) + for i := 0; i < contenders; i++ { + go func() { + <-start + item, found, reserved, saturated := p.reserveRoute(q) + results <- decision{item, found, reserved, saturated} + }() + } + close(start) + winners := 0 + for i := 0; i < contenders; i++ { + result := <-results + if result.reserved { + winners++ + if !result.found || result.saturated || result.item.ID != "account" || result.item.InFlight != 1 || result.item.InFlightSince.IsZero() { + t.Errorf("bad reservation: %+v", result) + } + } else if result.found || !result.saturated || result.item.ID != "" { + t.Errorf("a losing request should see only saturation, got %+v", result) + } + } + if winners != 1 { + t.Fatalf("got %d reservations for one slot", winners) + } + p.Release("account") + idle, _ := p.ByID("account") + if idle.InFlight != 0 || !idle.InFlightSince.IsZero() { + t.Fatalf("release left a busy slot: %+v", idle) + } + reservePoolItem(t, p, q, "account") + p.Release("account") +} + +func TestPoolReserveRouteMissesDoNotCommitRotation(t *testing.T) { + p := NewPool(nil, nil) + p.SetRoutingStrategy(RoutingStrategyWeightedRoundRobin) + p.Upsert(Item{ID: "a", Weight: 80, MaxInFlight: 1}) + p.Upsert(Item{ID: "b", Weight: 40, MaxInFlight: 1}) + q := RouteQuery{PublicModel: "model"} + reservePoolItem(t, p, q, "a") + if !p.Acquire("b") { + t.Fatal("could not fill the second account") + } + key := rotationKey(q) + beforePicked, beforeRegion, beforeWeights := maps.Clone(p.lastPicked), maps.Clone(p.lastRegion), maps.Clone(p.weightCounter[key]) + if item, found, reserved := p.ReserveRoute(q); found || reserved || item.ID != "" { + t.Fatalf("saturated route = %q, found=%v reserved=%v", item.ID, found, reserved) + } + p.MarkClassified("a", Classified{Kind: KindRateLimit, Model: "model", Cooldown: 2 * time.Hour}) + p.MarkDown("b", time.Hour, "unavailable") + p.Release("a") + p.Release("b") + item, found, reserved := p.ReserveRoute(q) + if !found || reserved || item.ID != "b" || item.InFlight != 0 || p.RetryAfter(item, q.PublicModel) <= 0 { + t.Fatalf("cooling route = %+v, found=%v reserved=%v", item, found, reserved) + } + if !maps.Equal(beforePicked, p.lastPicked) || !maps.Equal(beforeRegion, p.lastRegion) || !maps.Equal(beforeWeights, p.weightCounter[key]) { + t.Fatalf("route misses changed the cursor, region latch, or weighted counters: %v %v %v", p.lastPicked, p.lastRegion, p.weightCounter[key]) + } + p.MarkOK("a", "model") + p.MarkOK("b", "") + reservePoolItem(t, p, q, "b") + p.Release("b") +} + +func TestPoolReserveRouteRotatesOnlyWithinLowestUsablePriority(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "c", Region: "global"}) + p.Upsert(Item{ID: "b", Region: "global"}) + p.Upsert(Item{ID: "a", Region: "cn"}) + q := RouteQuery{ + PublicModel: "logical", StrategyOverride: AggregationStrategyPriority, + ModelResolver: func(Item) string { return "real" }, + PriorityResolver: func(item Item) int { + if item.ID == "b" { + return 10 + } + return 2 + }, + } + reservePoolItem(t, p, q, "a") + p.Release("a") + for _, id := range []string{"a", "c"} { + p.MarkClassified(id, Classified{Kind: KindRateLimit, Model: "real", Cooldown: time.Hour}) + } + reservePoolItem(t, p, q, "b") + p.Release("b") + for _, id := range []string{"a", "c"} { + p.MarkOK(id, "real") + } + for _, id := range []string{"c", "a", "c"} { + reservePoolItem(t, p, q, id) + p.Release(id) + } + for i := 0; i < 2; i++ { + if item, found := p.PickRoute(q); !found || item.ID != "a" || item.InFlight != 0 { + t.Fatalf("legacy priority pick = %+v found=%v", item, found) + } + } +} + +func TestPoolReserveRouteModelExclusionAndRouteProbe(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ + ID: "a", Provider: "workbuddy", Region: "cn", MaxInFlight: 1, + Models: []string{"Actual-Model", "another"}, ModelAliases: map[string]string{"alias": "Actual-Model"}, + }) + q := RouteQuery{PublicModel: "alias", AllowedProviders: []string{"workbuddy:cn"}} + item := reservePoolItem(t, p, q, "a") + if !p.HasRoute(q) || p.HasCapacity(q) { + t.Fatal("saturation must not erase the route from protocol probes") + } + p.Release(item.ID) + p.MarkClassified("a", Classified{Kind: KindRateLimit, Model: "actual-model", Cooldown: time.Hour}) + if hint, found, reserved := p.ReserveRoute(q); !p.HasRoute(q) || !found || reserved || hint.ID != "a" { + t.Fatalf("alias missing its real model's cooling hint: %q, found=%v reserved=%v", hint.ID, found, reserved) + } + q.ExcludedModels = map[routeModelKey]struct{}{accountRouteModelKey(item, "alias"): {}} + if hint, found, reserved := p.ReserveRoute(q); p.HasRoute(q) || found || reserved { + t.Fatalf("excluded model still affects route selection: %q, found=%v reserved=%v", hint.ID, found, reserved) + } + display := q + display.PublicModel = "WorkBuddy: Actual Model" + if hint, found, reserved := p.ReserveRoute(display); p.HasRoute(display) || found || reserved { + t.Fatalf("display spelling bypassed the concrete exclusion: %q, found=%v reserved=%v", hint.ID, found, reserved) + } + p.MergeQuota("a", &QuotaSnapshot{Exceeded: true}) + if _, blocked := p.QuotaBlockedForModel(q); blocked { + t.Fatal("excluded model produced a quota diagnostic") + } + q.PublicModel = "another" + if !p.HasRoute(q) || p.HasCapacity(q) { + t.Fatal("quota should not hide an otherwise matching route") + } + otherKey := q + otherKey.AllowedProviders = []string{"workbuddy:global"} + if p.HasRoute(otherKey) { + t.Fatal("route probe escaped the key's allowed region") + } + p.MergeQuota("a", nil) + reservePoolItem(t, p, q, "a") + p.Release("a") +} + +func TestPoolReserveRouteHotUpsertAndReinsertPreserveSlots(t *testing.T) { + p := NewPool(nil, nil) + a := Item{ID: "a", MaxInFlight: 1, URL: "old"} + p.Upsert(a) + q := RouteQuery{PublicModel: "model"} + first := reservePoolItem(t, p, q, "a") + a.URL = "new" + p.Upsert(a) + current, _ := p.ByID("a") + if current.InFlight != 1 || !current.InFlightSince.Equal(first.InFlightSince) || current.URL != "new" { + t.Fatalf("hot upsert lost either the slot or the new endpoint: %+v", current) + } + p.Remove("a") + if _, found := p.First(); found { + t.Fatal("removed account is still visible") + } + p.Upsert(a) + if _, found, reserved := p.ReserveRoute(q); found || reserved { + t.Fatal("reinserted account ignored an outstanding reservation") + } + p.Release(first.ID) + next := reservePoolItem(t, p, q, "a") + if next.URL != "new" || next.InFlight != 1 { + t.Fatalf("wrong reservation after old release: %+v", next) + } + p.Remove("a") + p.Release(next.ID) + p.Upsert(a) + reservePoolItem(t, p, q, "a") + p.Release("a") +} + +func TestPoolHotUpdatesAndDetachedReadSnapshots(t *testing.T) { + p := NewPool(nil, nil) + initial := Item{ + ID: "a", MaxInFlight: 1, Models: make([]string, 0), ProvenModels: []string{"model"}, + NativeModels: map[string]string{"model": "native"}, ModelDownUntil: map[string]time.Time{"model": {}}, + } + p.Upsert(initial) + before, _ := p.ByID("a") + if before.Models == nil { + t.Fatal("known empty catalog turned into an unknown catalog after cloning") + } + p.RemoveModel("a", "model") + p.MarkClassified("a", Classified{Kind: KindRateLimit, Model: "model", Cooldown: time.Hour}) + if len(before.ProvenModels) != 1 || before.ProvenModels[0] != "model" || before.NativeModels["model"] != "native" || !before.ModelDownUntil["model"].IsZero() { + t.Fatalf("snapshot changed after mutating live routing state: %+v", before) + } + if got := initial.NativeModels["model"]; got != "native" { + t.Fatalf("pool mutated the caller's input: native model = %q", got) + } + q := RouteQuery{PublicModel: "model"} + const rounds = 200 + var wg sync.WaitGroup + start := make(chan struct{}) + wg.Go(func() { + <-start + for i := 0; i < rounds; i++ { + p.Remove("a") + p.Upsert(initial) + p.RemoveModel("a", "model") + p.MarkClassified("a", Classified{Kind: KindRateLimit, Model: "model", Cooldown: time.Hour}) + p.MarkOK("a", "model") + } + }) + wg.Go(func() { + <-start + for i := 0; i < rounds; i++ { + item, _ := p.First() + _ = item.ModelDownUntil["model"] + item, _ = p.PickRoute(q) + _ = NativeModelID(item, "model") + for _, item := range p.Items() { + _ = ItemHasModel(item, "model") + } + item, _, reserved := p.ReserveRoute(q) + if reserved { + if item.ID != "a" || item.InFlight != 1 { + t.Errorf("bad reservation during hot update: %+v", item) + } + p.Release(item.ID) + } + } + }) + close(start) + wg.Wait() + reservePoolItem(t, p, q, "a") + p.Release("a") +} + +func TestPoolRouteSuccessDoesNotEraseNewerFailure(t *testing.T) { + for _, tc := range []struct { + name string + failure Classified + }{ + {"model", Classified{Kind: KindRateLimit, Model: "model", Cooldown: time.Hour, Message: "new rate limit"}}, + {"account", Classified{Kind: KindAuth, Cooldown: time.Hour, Message: "new auth cooldown"}}, + {"account without cooldown", Classified{Kind: KindAuth, Message: "new auth failure"}}, + } { + t.Run(tc.name, func(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "a", MaxInFlight: 2}) + q := RouteQuery{PublicModel: "model"} + first := reservePoolItem(t, p, q, "a") + second := reservePoolItem(t, p, q, "a") + failed := make(chan struct{}) + done := make(chan struct{}) + go func() { + <-failed + p.markRouteOK(first, "model") + p.Release(first.ID) + close(done) + }() + p.MarkClassified(second.ID, tc.failure) + p.Release(second.ID) + want, _ := p.ByID("a") + close(failed) + <-done + got, _ := p.ByID("a") + if got.StateVersion != want.StateVersion || got.LastError != tc.failure.Message || got.LastKind != want.LastKind || + got.ModelLastKind["model"] != want.ModelLastKind["model"] || !got.DownUntil.Equal(want.DownUntil) || + !got.ModelDownUntil["model"].Equal(want.ModelDownUntil["model"]) { + t.Fatalf("late success overwrote the newer failure: got %+v, want %+v", got, want) + } + }) + } +} + +func TestPoolRouteSuccessRequiresConcreteModel(t *testing.T) { + p := NewPool(nil, nil) + p.Upsert(Item{ID: "a"}) + p.MarkClassified("a", Classified{Kind: KindRateLimit, Model: "other", Cooldown: time.Hour}) + item := reservePoolItem(t, p, RouteQuery{PublicModel: "auto"}, "a") + for _, model := range []string{"", "auto", " AUTO "} { + p.markRouteOK(item, model) + } + got, _ := p.ByID("a") + if got.StateVersion != item.StateVersion || got.ModelDownUntil["other"].IsZero() || len(got.ProvenModels) != 0 { + t.Fatalf("auto success modified account or model state: %+v", got) + } + p.markRouteOK(item, "model") + got, _ = p.ByID("a") + if !itemHasProvenModel(got, "model") || got.ModelDownUntil["other"].IsZero() { + t.Fatalf("concrete success not recorded independently: %+v", got) + } + p.Release("a") +} + +func reservePoolItem(t *testing.T, p *Pool, q RouteQuery, id string) Item { + t.Helper() + item, found, reserved := p.ReserveRoute(q) + if !found || !reserved || item.ID != id { + t.Fatalf("reservation = %q, found=%v reserved=%v; want %q", item.ID, found, reserved, id) + } + return item +} diff --git a/internal/executor/pool_route_test.go b/internal/executor/pool_route_test.go index f17a215d6..c14eab5f4 100644 --- a/internal/executor/pool_route_test.go +++ b/internal/executor/pool_route_test.go @@ -222,7 +222,6 @@ func TestAggregateMemberHonorsAccountAliasAfterPick(t *testing.T) { accounts.AggregationMember{Provider: "qoder", Model: "model-b", Priority: 0}, accounts.AggregationMember{Provider: "workbuddy", Model: "model-b", Priority: 1}, ) - loop := routeLoop{resolver: plan.resolver()} q1 := Item{ ID: "q1", Provider: "qoder", Models: []string{"model-a"}, ModelAliases: map[string]string{"model-b": "model-a"}, @@ -246,7 +245,8 @@ func TestAggregateMemberHonorsAccountAliasAfterPick(t *testing.T) { {w1, "model-b"}, } { req := translate.ChatRequest{Model: "logical-model-b"} - got := sanitizeForItem(tc.item, loop.dispatchRequest(tc.item, req)) + member, _ := plan.matchMember(tc.item) + got := targetFor(tc.item, member.Model).request(req) if got.Model != tc.want { t.Fatalf("%s aggregate model = %q want %q", tc.item.ID, got.Model, tc.want) } diff --git a/internal/executor/prepare.go b/internal/executor/prepare.go index 4c2603b48..15abb5622 100644 --- a/internal/executor/prepare.go +++ b/internal/executor/prepare.go @@ -5,7 +5,9 @@ import ( "crypto/sha256" "encoding/hex" "encoding/json" + "errors" "log" + "net/http" "os" "strconv" "strings" @@ -40,13 +42,21 @@ type CatalogPreparer interface { // AggregationResolver resolves a logical model ID to a read-only snapshot of // its provider/model members. Implemented by control.Aggregations and injected -// by the gateway. The executor never imports control directly. +// by the gateway. ErrAggregationNotFound means no enabled logical model by +// that ID exists. A known model with no permitted members still resolves, so +// the caller cannot accidentally route to an ordinary model of the same name. type AggregationResolver interface { Resolve(ctx context.Context, id string, allowedProviders map[string]bool) (accounts.Aggregation, error) } -// AggregationCatalog is implemented by the control facade. Prepare uses it to -// compile nested aggregations from the same snapshot Resolve just read. +// aggregationWithCatalog keeps the root and any referenced groups on one +// configuration version, including while the control plane applies an edit. +type aggregationWithCatalog interface { + ResolveWithCatalog(context.Context, string, map[string]bool) (accounts.Aggregation, map[string]accounts.Aggregation, error) +} + +// AggregationCatalog is the compatibility interface for resolvers that do not +// expose a single snapshot. Production preparation uses aggregationWithCatalog. type AggregationCatalog interface { Catalog(ctx context.Context) (map[string]accounts.Aggregation, error) } @@ -85,6 +95,54 @@ type PrepareInput struct { Catalogs CatalogPreparer Aggregations AggregationResolver Logs RequestStarter + // BeforeSideEffects admits the request after pure validation and before + // aggregation resolution (which can dispatch a classifier), catalog reads + // or request logging. A non-nil error stops preparation unchanged. + BeforeSideEffects func() error +} + +// RouteInput is the complete routing snapshot for a prepared request. Empty +// fields are authoritative too: they do not fall back to context values. +type RouteInput struct { + RequestID string + PublicModel string // Original client-facing name. + RouteModel string // Model without its gateway provider/region prefix. + ProviderFilter string + RegionFilter string + Prefer string + SessionKey string + AllowedProviders []string + AggregatePlan *AggregatePlan + // RequireModelAlias prevents an alias-only key from taking another + // account’s identically named catalog model. + RequireModelAlias bool +} + +// routeInputFromContext adapts legacy executor entry points exactly once, +// including their content-derived session key when no key was supplied. +func routeInputFromContext(ctx context.Context, req translate.ChatRequest, prefer, providerFilter string) RouteInput { + publicModel := req.Model + sessionKey := resolveSessionKey(ctx, req) + regionFilter := regionFilterFromContext(ctx) + // Keep the old entry point's precedence: an explicit model prefix + // replaces the corresponding filter; omitted options stay in force. + if provider, region := ResolveProviderFilter(&req, true); provider != "" { + providerFilter = provider + if region != "" { + regionFilter = region + } + } + return RouteInput{ + RequestID: RequestIDFromContext(ctx), + PublicModel: publicModel, + RouteModel: req.Model, + ProviderFilter: strings.ToLower(strings.TrimSpace(providerFilter)), + RegionFilter: regionFilter, + Prefer: strings.TrimSpace(prefer), + SessionKey: sessionKey, + AllowedProviders: append([]string(nil), allowedProvidersFrom(ctx)...), + AggregatePlan: aggregatePlanFrom(ctx), + } } type PreparedRequest struct { @@ -96,6 +154,7 @@ type PreparedRequest struct { PublicModel string ProviderFilter string Prefer string + Route RouteInput } func (e ChatExecutor) Prepare(in PrepareInput) (PreparedRequest, error) { @@ -109,32 +168,10 @@ func (e ChatExecutor) Prepare(in PrepareInput) (PreparedRequest, error) { request.Model = publicModel request.Stream = in.NativeRequest.Stream() } - // Resolve a logical aggregation model into an immutable per-request plan. - // This happens once, before any Pool lock, and the plan is carried in the - // context so routing uses a stable snapshot (no DB/facade access under lock, - // no cross-request mutable state). An aggregation key accepts both its - // provider-neutral account aliases and the logical models configured in the - // model pool, so the plan must exist before the key contract is checked. - var aggregatePlan *AggregatePlan - if in.Aggregations != nil && (in.CrossProviderPool || in.ModelAggregation) && ProviderPrefix(publicModel) == "" { - if plan, ok := e.resolveAggregation(in.Context, in.Aggregations, publicModel, in.Identity.AllowedProviders, request); ok { - aggregatePlan = plan - } + if in.ModelAggregation && ProviderPrefix(publicModel) != "" { + return PreparedRequest{}, aggregationModelRequired() } - if in.ModelAggregation { - // An aggregation key's contract is stricter than the shared pool: it may - // only call the provider-neutral names it exposes — an account alias or a - // configured logical model. A real catalog id or a provider-prefixed id - // would leak the split view back. - if strings.Contains(strings.TrimSpace(publicModel), "/") || - (aggregatePlan == nil && !e.servesAggregationAlias(publicModel, in.Identity)) { - return PreparedRequest{}, &PrepareError{ - Status: 400, - Code: "model_not_aggregated", - Message: "this API key only accepts its aggregated model names; call /v1/models for the list", - } - } - } else if RejectsBareModel(publicModel, in.CrossProviderPool) { + if !in.ModelAggregation && RejectsBareModel(publicModel, in.CrossProviderPool) { return PreparedRequest{}, &PrepareError{ Status: 400, Code: "provider_prefix_required", @@ -143,14 +180,37 @@ func (e ChatExecutor) Prepare(in PrepareInput) (PreparedRequest, error) { } providerFilter, modelRegion := ResolveProviderFilter(&request, in.CrossProviderPool || in.ModelAggregation) + if !in.Identity.AllowsProvider(providerFilter) { + return PreparedRequest{}, providerNotAllowed(providerFilter) + } + if in.BeforeSideEffects != nil { + if err := in.BeforeSideEffects(); err != nil { + return PreparedRequest{}, err + } + } + + // Resolve a logical model exactly once, before selection. An aggregation + // key accepts only account aliases or logical model names. Verifying these + // names needs the admitted request to read the catalog and possibly run + // a classifier, so it comes after the pure model and grant checks above. + var aggregatePlan *AggregatePlan + if in.Aggregations != nil && (in.CrossProviderPool || in.ModelAggregation) && providerFilter == "" { + var err error + aggregatePlan, err = e.resolveAggregation(in.Context, in.Aggregations, publicModel, in.Identity.AllowedProviders, request) + if err != nil { + return PreparedRequest{}, err + } + } + requireModelAlias := in.ModelAggregation && aggregatePlan == nil + if requireModelAlias && (strings.Contains(publicModel, "/") || !e.servesAggregationAlias(publicModel, in.Identity)) { + return PreparedRequest{}, aggregationModelRequired() + } prefer := strings.TrimSpace(in.PreferAccount) - providerFilter = ApplyPinnedProviderFilter(e.Pool, providerFilter, publicModel, prefer) - if providerFilter != "" && !in.Identity.AllowsProvider(providerFilter) { - return PreparedRequest{}, &PrepareError{ - Status: 403, - Code: "provider_not_allowed", - Message: "This API key cannot use provider " + providerFilter, + if pinnedProvider := ApplyPinnedProviderFilter(e.Pool, providerFilter, publicModel, prefer); pinnedProvider != providerFilter { + if !in.Identity.AllowsProvider(pinnedProvider) { + return PreparedRequest{}, providerNotAllowed(pinnedProvider) } + providerFilter = pinnedProvider } if in.NativeRequest == nil { if err := ApplyModelContextDefaults(in.Context, in.ModelContexts, &request, providerFilter); err != nil { @@ -210,7 +270,6 @@ func (e ChatExecutor) Prepare(in PrepareInput) (PreparedRequest, error) { // layer; membership is already constrained by the resolved plan. effectiveAllow = nil } - ctx := WithAllowedProviders(WithRequestID(in.Context, requestID), effectiveAllow) sessionKey := sessionKeyFor(in.SessionHeader, in.ConversationID, in.Identity, request) if sessionKey == "" && in.NativeRequest != nil { sessionKey = NativeSessionKeyFor(in.NativeRequest, in.Identity) @@ -225,19 +284,9 @@ func (e ChatExecutor) Prepare(in PrepareInput) (PreparedRequest, error) { sessionKey = shard } } - if sessionKey != "" { - ctx = WithSessionKey(ctx, sessionKey) - ctx = WithConversation(ctx, sessionKey) - } - if modelRegion != "" { - ctx = WithRegionFilter(ctx, modelRegion) - } if requestedReasoning != "" { log.Printf("request reasoning request_id=%q model=%q level=%q", requestID, request.Model, requestedReasoning) } - if aggregatePlan != nil { - ctx = WithAggregatePlan(ctx, aggregatePlan) - } if sessionKey != "" && sessionAffinityDebugOn() { source := "content-seed" if strings.TrimSpace(in.SessionHeader) != "" { @@ -250,6 +299,21 @@ func (e ChatExecutor) Prepare(in PrepareInput) (PreparedRequest, error) { log.Printf("session affinity request_id=%q source=%q key=%q model=%q tools=%t msgs=%d", requestID, source, shortSessionKey(sessionKey), request.Model, len(request.Tools) > 0, len(request.Messages)) } + route := RouteInput{ + RequestID: requestID, + PublicModel: publicModel, + RouteModel: request.Model, + ProviderFilter: providerFilter, + RegionFilter: modelRegion, + Prefer: prefer, + SessionKey: sessionKey, + AllowedProviders: append([]string(nil), effectiveAllow...), + AggregatePlan: aggregatePlan, + RequireModelAlias: requireModelAlias, + } + // Request ID and the provider-facing conversation are transport metadata, + // not a second source of routing constraints. + ctx := dispatchContext(in.Context, route) return PreparedRequest{ Context: ctx, RequestID: requestID, @@ -259,21 +323,37 @@ func (e ChatExecutor) Prepare(in PrepareInput) (PreparedRequest, error) { PublicModel: publicModel, ProviderFilter: providerFilter, Prefer: prefer, + Route: route, }, nil } +func aggregationModelRequired() *PrepareError { + return &PrepareError{ + Status: 400, + Code: "model_not_aggregated", + Message: "this API key only accepts its aggregated model names; call /v1/models for the list", + } +} + +func providerNotAllowed(provider string) *PrepareError { + return &PrepareError{ + Status: 403, + Code: "provider_not_allowed", + Message: "This API key cannot use provider " + provider, + } +} + // resolveAggregation attempts to resolve a bare public model ID as a logical -// aggregation model. It returns false for ordinary models so the normal route -// path is unchanged. Provider grants are reduced to a family set used to -// filter members; an empty allowlist means "all providers allowed" (nil map). -func (e ChatExecutor) resolveAggregation(ctx context.Context, resolver AggregationResolver, model string, grants []string, request translate.ChatRequest) (*AggregatePlan, bool) { +// aggregation model. Only a definite absence permits the ordinary route path. +// Provider grants are reduced to a family set used to filter members; an +// empty allowlist means "all providers allowed" (nil map). +func (e ChatExecutor) resolveAggregation(ctx context.Context, resolver AggregationResolver, model string, grants []string, request translate.ChatRequest) (*AggregatePlan, error) { allowed := map[string]bool(nil) + aggregationOnly := accounts.IsAggregationOnly(grants) // An aggregation-only key must not filter members by its own sentinel // grant (that would drop every real provider). nil means "no member // filtering"; the pool-level allowlist is cleared for these requests too. - if accounts.IsAggregationOnly(grants) { - allowed = nil - } else if len(grants) > 0 { + if !aggregationOnly && len(grants) > 0 { allowed = make(map[string]bool, len(grants)) for _, entry := range grants { // ParseProviderGrant already lowercases and trims; do not pre-fold @@ -285,83 +365,133 @@ func (e ChatExecutor) resolveAggregation(ctx context.Context, resolver Aggregati allowed[grant.Provider] = true } } - agg, err := resolver.Resolve(ctx, model, allowed) - if err != nil || (strings.TrimSpace(agg.Document) == "" && len(agg.Members) == 0) { - return nil, false + var ( + agg accounts.Aggregation + catalog map[string]accounts.Aggregation + err error + ) + snapshot, hasSnapshot := resolver.(aggregationWithCatalog) + if hasSnapshot { + agg, catalog, err = snapshot.ResolveWithCatalog(ctx, model, allowed) + } else { + agg, err = resolver.Resolve(ctx, model, allowed) } - if strings.TrimSpace(agg.Document) != "" { - var catalog map[string]accounts.Aggregation - if source, ok := resolver.(AggregationCatalog); ok { - catalog, _ = source.Catalog(ctx) - } - text := latestUserText(request) - labels := map[string]string{} - if len(text) > 0 { - targets, err := accounts.ClassifierTargets(agg.ID, agg.Document, catalog) - if err == nil { - classifyCtx := ctx - // Classifiers run before the request-level allowed-provider - // context is installed. Give them the same non-aggregation - // grants so a provider-scoped key cannot send the user's text - // to an out-of-scope provider named in the pipeline. - if !accounts.IsAggregationOnly(grants) && len(grants) > 0 { - classifyCtx = WithAllowedProviders(ctx, grants) - } - labels = e.ClassifyIntent(classifyCtx, targets, text) + if errors.Is(err, accounts.ErrAggregationNotFound) { + return nil, nil + } + if err != nil { + return nil, aggregationUnavailable() + } + if strings.TrimSpace(agg.Document) == "" { + if len(agg.Members) == 0 { + return nil, &PrepareError{ + Status: http.StatusBadRequest, + Code: "model_not_available", + Message: "The requested model has no available aggregation members", } } - compiled, seats, _, err := accounts.CompilePipeline(agg, catalog, text, labels, allowed) - if err != nil || len(compiled.Members) == 0 { - return nil, false + return NewAggregatePlan(agg), nil + } + + if !hasSnapshot { + if source, ok := resolver.(AggregationCatalog); ok { + catalog, err = source.Catalog(ctx) + if err != nil { + return nil, aggregationUnavailable() + } } - plan := NewAggregatePlan(compiled) - plan.Seats = seats - return plan, true } - return NewAggregatePlan(agg), true + text := latestUserText(request) + // A classifier routes to its own concrete target, never the virtual + // model's plan or session. Carry the full region-scoped grants, and let + // the compiler request a label only when it reaches that branch. + classifierRoute := RouteInput{} + if !aggregationOnly { + classifierRoute.AllowedProviders = grants + } + classifier := e.intentClassifier(ctx, text, classifierRoute) + compiled, seats, _, err := accounts.CompilePipelineWithClassifier(agg, catalog, text, allowed, classifier) + if err != nil || len(compiled.Members) == 0 { + return nil, aggregationUnavailable() + } + plan := NewAggregatePlan(compiled) + plan.Seats = seats + return plan, nil +} + +func aggregationUnavailable() *PrepareError { + return &PrepareError{ + Status: http.StatusServiceUnavailable, + Code: "aggregation_unavailable", + Message: "The requested model could not be resolved through the aggregation catalog", + } } type intentCallKey struct{} func (e ChatExecutor) ClassifyIntent(ctx context.Context, targets []accounts.ClassifierTarget, text string) map[string]string { - if e.Pool == nil || len(targets) == 0 || strings.TrimSpace(text) == "" || ctx.Value(intentCallKey{}) != nil { + // Keep the direct entry point's explicit legacy constraints, not any + // aggregate plan or affinity key of the caller. + classify := e.intentClassifier(ctx, text, RouteInput{ + RequestID: RequestIDFromContext(ctx), + RegionFilter: regionFilterFromContext(ctx), + AllowedProviders: append([]string(nil), allowedProvidersFrom(ctx)...), + }) + if len(targets) == 0 || classify == nil { return nil } labels := make(map[string]string, len(targets)) for _, target := range targets { - label, err := e.oneIntent(ctx, target, text) - if err != nil || strings.TrimSpace(label) == "" { - continue + if label := classify(target); label != "" { + labels[target.Key()] = label } - labels[target.Key()] = label } return labels } -func (e ChatExecutor) oneIntent(ctx context.Context, target accounts.ClassifierTarget, text string) (string, error) { - ctx, cancel := context.WithTimeout(context.WithValue(ctx, intentCallKey{}, true), 8*time.Second) - defer cancel() +func (e ChatExecutor) intentClassifier(ctx context.Context, text string, route RouteInput) func(accounts.ClassifierTarget) string { + if ctx == nil { + ctx = context.Background() + } + if e.Pool == nil || strings.TrimSpace(text) == "" || ctx.Value(intentCallKey{}) != nil { + return nil + } + return func(target accounts.ClassifierTarget) string { + label, err := e.oneIntent(ctx, target, text, route) + if err != nil { + return "" + } + return strings.TrimSpace(label) + } +} + +func (e ChatExecutor) oneIntent(ctx context.Context, target accounts.ClassifierTarget, text string, route RouteInput) (string, error) { rawProvider := strings.ToLower(strings.TrimSpace(target.Provider)) provider := "" if rawProvider != "" { provider = accounts.NormalizeProviderFamily(rawProvider) } - // ChatNonStream expects a bare model plus an explicit provider filter. - // A prefixed classifier model makes every account look unable to serve it. - // A blank region means any region of that provider. Only an explicit - // region pins the pool; NormalizeRegion would turn a blank into global. + // Dispatch the bare model with the classifier target's provider and any + // explicit target region. A blank target region adds no hard pin. model := accounts.BareAggregationModel(rawProvider, target.Region, target.Model) + route.PublicModel, route.RouteModel = target.Model, model + route.ProviderFilter = provider if region, pin := classifierRegionPin(target.Region); pin { - ctx = WithRegionFilter(ctx, region) + if inherited := strings.TrimSpace(route.RegionFilter); inherited != "" && accounts.NormalizeRegion(inherited) != region { + return "", nil // Neither hard region can override the other. + } + route.RegionFilter = region } - result, err := e.ChatNonStream(ctx, translate.ChatRequest{ + ctx, cancel := context.WithTimeout(context.WithValue(ctx, intentCallKey{}, true), 8*time.Second) + defer cancel() + result, err := e.ChatNonStreamPrepared(ctx, translate.ChatRequest{ Model: model, Messages: []translate.ChatMessage{ {Role: "system", Content: "Reply with only the path label."}, {Role: "user", Content: text}, }, MaxTokens: json.RawMessage("32"), - }, "", provider) + }, route) if err != nil { return "", err } @@ -395,46 +525,9 @@ func latestUserText(req translate.ChatRequest) string { return "" } -// providerPrefixes are the provider segments a client may pin with a leading -// "/" model id. Command Code's own model ids are org-namespaced -// ("deepseek/…", "moonshotai/…"), so its provider prefix sits in front of an -// already-namespaced id ("command/deepseek/…"). -var providerPrefixes = []string{"qoder/", "workbuddy/", "trae/", "devin/", "command/", "codex/", "zhipu/", "qwenwork/", "kimi/", "codearts/", "kiro/", "meta/", "muse/", "doubaowork/", "minimaxcode/", "opencode/"} - -// regionDashSuffixes are the region qualifiers that may be appended to a -// provider prefix with a dash: "workbuddy-cn/", "workbuddy-gl/", -// "workbuddy-auto/". "-auto/" is the opt-out: it pins the provider family -// while letting the pool pick the region (the lastRegion latch in pool.go). -var regionDashSuffixes = []string{"-cn/", "-gl/", "-auto/"} - -// regionAliases maps shorthand region tags to canonical region IDs. -// "auto" maps to "" (no region pin), which triggers the pool's automatic -// region selection instead of a fixed region. -var regionAliases = map[string]string{ - "cn": "cn", - "gl": "global", - "auto": "", -} - -// regionTag extracts the bare region tag from a dash suffix like "-cn/". -func regionTag(suffix string) string { - return strings.TrimSuffix(strings.TrimPrefix(suffix, "-"), "/") -} - func ProviderPrefix(model string) string { - model = strings.TrimSpace(model) - for _, prefix := range providerPrefixes { - if strings.HasPrefix(model, prefix) { - return strings.TrimSuffix(prefix, "/") - } - base := strings.TrimSuffix(prefix, "/") - for _, rs := range regionDashSuffixes { - if strings.HasPrefix(model, base+rs) { - return base - } - } - } - return "" + provider, _, _ := accounts.SplitProviderModelPrefix(model) + return provider } func RejectsBareModel(model string, crossProviderPool bool) bool { @@ -456,7 +549,7 @@ func (e ChatExecutor) servesAggregationAlias(model string, identity auth.Identit if !identity.AllowsProvider(item.Provider) || !identity.AllowsProviderRegion(item.Provider, item.Region) { continue } - if strings.TrimSpace(item.ModelAliases[want]) == "" { + if !definesModelAlias(item, want) { continue } if itemHasModel(item, want) { @@ -466,6 +559,10 @@ func (e ChatExecutor) servesAggregationAlias(model string, identity auth.Identit return false } +func definesModelAlias(item Item, model string) bool { + return strings.TrimSpace(item.ModelAliases[routeModel(model)]) != "" +} + // ResolveProviderFilter parses the provider prefix (and an optional region // qualifier) from the model id, strips both from req.Model, and returns the // provider family and the canonical region ("" when no region was specified). @@ -479,26 +576,12 @@ func (e ChatExecutor) servesAggregationAlias(model string, identity auth.Identit // The region coexists with API-key grants: routeBaseMatches enforces both // independently, so a prefix that conflicts with a grant yields no candidates. func ResolveProviderFilter(req *translate.ChatRequest, crossProviderPool bool) (provider, region string) { - model := strings.TrimSpace(req.Model) - if model == "" { - return "", "" - } - for _, prefix := range providerPrefixes { - base := strings.TrimSuffix(prefix, "/") - // Region-qualified dash form: "workbuddy-cn/model" - for _, rs := range regionDashSuffixes { - if strings.HasPrefix(model, base+rs) { - req.Model = strings.TrimPrefix(model, base+rs) - return accounts.NormalizeProviderFamily(base), regionAliases[regionTag(rs)] - } - } - // Standard form: "workbuddy/model" - if strings.HasPrefix(model, prefix) { - req.Model = strings.TrimPrefix(model, prefix) - return accounts.NormalizeProviderFamily(base), "" - } + provider, region, bare := accounts.SplitProviderModelPrefix(req.Model) + if provider != "" { + req.Model = bare + return provider, region } - if crossProviderPool { + if crossProviderPool || bare == "" { return "", "" } return "qoder", "" diff --git a/internal/executor/prepare_test.go b/internal/executor/prepare_test.go index f50d379d8..470593240 100644 --- a/internal/executor/prepare_test.go +++ b/internal/executor/prepare_test.go @@ -3,6 +3,9 @@ package executor import ( "context" "encoding/json" + "errors" + "net/http" + "reflect" "testing" "time" @@ -69,6 +72,9 @@ func TestPrepareStripsPrefixAndChecksGrants(t *testing.T) { if got.ProviderFilter != "workbuddy" || got.Prefer != "account-a" || got.Request.Model != "glm-5.2" || got.PublicModel != "workbuddy/glm-5.2" { t.Fatalf("%+v", got) } + if got.Route.RouteModel != "glm-5.2" || got.Route.PublicModel != "workbuddy/glm-5.2" { + t.Fatalf("prepare split the names incorrectly: %+v", got.Route) + } if got.RequestID != "req_fixed" { t.Fatalf("request id=%s", got.RequestID) } @@ -139,7 +145,7 @@ func TestPrepareAggregationKeyAcceptsLogicalModel(t *testing.T) { if err != nil { t.Fatalf("logical model on aggregation key: %v", err) } - plan := aggregatePlanFrom(got.Context) + plan := got.Route.AggregatePlan if plan == nil || plan.ID != "glm-5.2" || len(plan.Members) != 1 { t.Fatalf("plan=%+v", plan) } @@ -158,12 +164,18 @@ func TestPrepareAggregationKeyAcceptsLogicalModel(t *testing.T) { } type stubAggregationResolver struct { - agg accounts.Aggregation + agg accounts.Aggregation + onResolve func() + catalog map[string]accounts.Aggregation + catalogErr error } func (s stubAggregationResolver) Resolve(_ context.Context, id string, allowed map[string]bool) (accounts.Aggregation, error) { + if s.onResolve != nil { + s.onResolve() + } if id != s.agg.ID { - return accounts.Aggregation{}, context.Canceled + return accounts.Aggregation{}, accounts.ErrAggregationNotFound } out := s.agg out.Members = nil @@ -175,6 +187,10 @@ func (s stubAggregationResolver) Resolve(_ context.Context, id string, allowed m return out, nil } +func (s stubAggregationResolver) Catalog(context.Context) (map[string]accounts.Aggregation, error) { + return s.catalog, s.catalogErr +} + func TestPrepareDeniesUngrantedProvider(t *testing.T) { ex := NewChatExecutor(NewPool(nil, nil), "") _, err := ex.Prepare(PrepareInput{ @@ -189,6 +205,261 @@ func TestPrepareDeniesUngrantedProvider(t *testing.T) { } } +func TestPrepareChecksPureErrorsBeforeAdmission(t *testing.T) { + for _, tc := range []struct { + name string + input PrepareInput + code string + }{ + { + name: "missing provider prefix", + input: PrepareInput{Request: translate.ChatRequest{Model: "glm-5.2"}}, + code: "provider_prefix_required", + }, + { + name: "explicit provider out of grant", + input: PrepareInput{ + Request: translate.ChatRequest{Model: "qoder-cn/glm-5.2"}, + Identity: auth.Identity{AllowedProviders: []string{"workbuddy"}}, + }, + code: "provider_not_allowed", + }, + { + name: "aggregation key with a reserved provider prefix", + input: PrepareInput{ + Request: translate.ChatRequest{Model: "qoder-cn/model"}, + ModelAggregation: true, + }, + code: "model_not_aggregated", + }, + } { + t.Run(tc.name, func(t *testing.T) { + tc.input.BeforeSideEffects = func() error { + t.Fatal("pure rejection must not acquire a key slot") + return nil + } + tc.input.Aggregations = stubAggregationResolver{onResolve: func() { + t.Fatal("pure rejection must not access the aggregation resolver") + }} + _, err := (ChatExecutor{}).Prepare(tc.input) + var prepared *PrepareError + if !asPrepareError(err, &prepared) || prepared.Code != tc.code { + t.Fatalf("err=%v, want %s", err, tc.code) + } + }) + } +} + +func TestPrepareStopsBeforeSideEffectsWhenAdmissionFails(t *testing.T) { + rejected := &PrepareError{Status: 429, Code: "at_capacity"} + catalogs := &stubCatalogs{} + contexts := &stubContexts{} + logs := &stubLogs{} + calls := 0 + _, err := (ChatExecutor{}).Prepare(PrepareInput{ + Request: translate.ChatRequest{Model: "logical"}, + CrossProviderPool: true, + Aggregations: stubAggregationResolver{onResolve: func() { + t.Fatal("denied request reached the resolver") + }}, + Catalogs: catalogs, + ModelContexts: contexts, + Logs: logs, + NewRequestID: func() string { + t.Fatal("denied request generated a log ID") + return "" + }, + BeforeSideEffects: func() error { calls++; return rejected }, + }) + if err != rejected || calls != 1 { + t.Fatalf("err=%v calls=%d, want unchanged admission error and one call", err, calls) + } + if contexts.got != "" || catalogs.calls != 0 || len(logs.entries) != 0 { + t.Fatalf("denied request ran side effects: model=%q catalog=%d logs=%d", contexts.got, catalogs.calls, len(logs.entries)) + } +} + +func TestPrepareClassifierUsesOwnRouteAfterAdmission(t *testing.T) { + for _, tc := range []struct { + name string + region string + wantCalls int + wantMember string + }{ + {name: "classify with granted account", wantCalls: 1, wantMember: "planner"}, + {name: "different explicitly requested region is forbidden", region: "global", wantMember: "fallback"}, + } { + t.Run(tc.name, func(t *testing.T) { + pool := NewPool(nil, nil) + for _, region := range []string{"global", "cn"} { + pool.Upsert(Item{ID: region, Provider: "qoder", Region: region, Runtime: "in_process", Models: []string{"glm-5.2", "wrong"}}) + } + ex := NewChatExecutor(pool, "") + fake := &recordingIntentChat{} + ex.Providers = providers.NewRegistry() + ex.Providers.Register(providers.Adapter{ID: "qoder", Chat: fake}) + ex.SessionAffinity.Bind("stale-session", "global") + ctx := WithSessionKey(context.Background(), "stale-session") + ctx = WithConversation(ctx, "stale-conversation") + ctx = WithRequestID(ctx, "stale-request") + ctx = WithRegionFilter(ctx, "global") + ctx = WithAllowedProviders(ctx, []string{"workbuddy"}) + ctx = WithAggregatePlan(ctx, NewAggregatePlan(accounts.Aggregation{ + ID: "stale-plan", Members: []accounts.AggregationMember{{Provider: "qoder", Model: "wrong"}}, + })) + admitted := 0 + agg := accounts.Aggregation{ID: "logical", Document: `{"version":1,"steps":[ + {"id":"branch","kind":"branch","classifier":{"provider":"qoder","region":"` + tc.region + `","model":"glm-5.2"},"paths":[ + {"id":"plan","label":"Plan","intent":"ok","steps":[{"id":"p","kind":"member","provider":"qoder","model":"planner"}]}, + {"id":"default","label":"Default","fallback":true,"steps":[{"id":"f","kind":"member","provider":"qoder","model":"fallback"}]} + ]}]}`, + } + got, err := ex.Prepare(PrepareInput{ + Context: ctx, + Request: translate.ChatRequest{ + Model: "logical", Messages: []translate.ChatMessage{{Role: "user", Content: "hi"}}, + }, + Identity: auth.Identity{AllowedProviders: []string{"qoder:cn"}}, + CrossProviderPool: true, + BeforeSideEffects: func() error { admitted++; return nil }, + Aggregations: stubAggregationResolver{agg: agg, onResolve: func() { + if admitted != 1 { + t.Fatalf("resolver ran before exactly one admission: calls=%d", admitted) + } + }}, + }) + if err != nil { + t.Fatal(err) + } + if admitted != 1 || fake.calls != tc.wantCalls { + t.Fatalf("admission calls=%d classifier calls=%d, want 1 and %d", admitted, fake.calls, tc.wantCalls) + } + if fake.calls > 0 && (fake.accountID != "cn" || fake.conversation != "" || fake.requestID != "") { + t.Fatalf("classifier used account=%q conversation=%q requestID=%q, want cn with no parent metadata", fake.accountID, fake.conversation, fake.requestID) + } + if plan := got.Route.AggregatePlan; plan == nil || len(plan.Members) != 1 || plan.Members[0].Model != tc.wantMember { + t.Fatalf("plan=%+v, want member %q", plan, tc.wantMember) + } + if stats := ex.SessionAffinity.Stats(); stats.Bindings != 1 || stats.Hits != 0 || stats.Misses != 0 || stats.Escapes != 0 { + t.Fatalf("classifier touched affinity: %+v", stats) + } + }) + } +} + +type recordingIntentChat struct { + fakeInProcessChat + accountID string + conversation string + requestID string +} + +func (f *recordingIntentChat) ChatNonStream(ctx context.Context, accountID string, req translate.ChatRequest) (providers.ChatOutcome, error) { + f.accountID, f.conversation = accountID, providers.ConversationFromContext(ctx) + f.requestID = RequestIDFromContext(ctx) + return f.fakeInProcessChat.ChatNonStream(ctx, accountID, req) +} + +func TestPrepareDoesNotFallBackOnAggregationCatalogError(t *testing.T) { + for _, catalogErr := range []error{errors.New("backend detail"), accounts.ErrAggregationNotFound} { + got, err := (ChatExecutor{}).Prepare(PrepareInput{ + Request: translate.ChatRequest{Model: "same-name"}, + CrossProviderPool: true, + Aggregations: stubAggregationResolver{ + agg: accounts.Aggregation{ID: "same-name", Enabled: true, Document: `{"version":1,"steps":[{"id":"m","kind":"member","provider":"qoder","model":"real"}]}`}, + catalogErr: catalogErr, + }, + }) + var prepareErr *PrepareError + if !errors.As(err, &prepareErr) || prepareErr.Status != http.StatusServiceUnavailable || prepareErr.Code != "aggregation_unavailable" { + t.Fatalf("catalog error %v: prepared=%+v err=%v", catalogErr, got, err) + } + if prepareErr.Message == catalogErr.Error() { + t.Fatalf("prepare exposed catalog internals: %v", prepareErr) + } + } +} + +func TestPrepareDispatchesOnlyClassifiersInSelectedPipelineBranch(t *testing.T) { + root := accounts.Aggregation{ID: "logical", Enabled: true, Document: `{ + "version":1,"steps":[{"id":"root","kind":"branch","classifier":{"provider":"workbuddy","model":"root-classifier"},"paths":[ + {"id":"direct","label":"Direct","intent":"direct","steps":[{"id":"answer","kind":"member","provider":"workbuddy","model":"direct-answer"}]}, + {"id":"group","label":"Group","fallback":true,"steps":[{"id":"nested","kind":"group","aggregation_id":"nested"}]} + ]}]}`} + nested := accounts.Aggregation{ID: "nested", Enabled: true, Document: `{ + "version":1,"steps":[{"id":"child","kind":"branch","classifier":{"provider":"workbuddy","model":"nested-classifier"},"paths":[ + {"id":"deep","label":"Deep","intent":"deep","steps":[{"id":"answer","kind":"member","provider":"workbuddy","model":"nested-answer"}]} + ]}]}`} + for _, tc := range []struct { + name string + rootLabel string + want []string + }{ + {name: "unselected subtree makes no request", rootLabel: "direct", want: []string{"root-classifier", "direct-answer"}}, + {name: "selected subtree gets a label", rootLabel: "unknown", want: []string{"root-classifier", "nested-classifier", "nested-answer"}}, + } { + t.Run(tc.name, func(t *testing.T) { + fake := &pipelineRecordingChat{replies: map[string]string{ + "root-classifier": tc.rootLabel, "nested-classifier": "deep", "nested-answer": "nested", "direct-answer": "direct", + }} + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "workbuddy", Provider: "workbuddy", Region: "cn", Runtime: "in_process", + Models: []string{"root-classifier", "nested-classifier", "direct-answer", "nested-answer"}, + }) + ex := NewChatExecutor(pool, "") + ex.Providers = providers.NewRegistry() + ex.Providers.Register(providers.Adapter{ID: "workbuddy", Chat: fake}) + prepared, err := ex.Prepare(PrepareInput{ + Request: translate.ChatRequest{ + Model: "logical", Messages: []translate.ChatMessage{{Role: "user", Content: "select a path"}}, + }, + Identity: auth.Identity{AllowedProviders: []string{"workbuddy:cn"}}, + CrossProviderPool: true, + Aggregations: stubAggregationResolver{agg: root, catalog: map[string]accounts.Aggregation{"nested": nested}}, + }) + if err != nil || prepared.Route.AggregatePlan == nil { + t.Fatalf("prepare route=%+v err=%v", prepared.Route, err) + } + result, err := ex.ChatNonStreamPrepared(prepared.Context, prepared.Request, prepared.Route) + if err != nil || result.Model != tc.want[len(tc.want)-1] || !reflect.DeepEqual(fake.models, tc.want) { + t.Fatalf("dispatch result=%+v err=%v calls=%v want=%v", result, err, fake.models, tc.want) + } + }) + } +} + +type pipelineRecordingChat struct { + fakeInProcessChat + replies map[string]string + models []string +} + +func (f *pipelineRecordingChat) ChatNonStream(_ context.Context, _ string, req translate.ChatRequest) (providers.ChatOutcome, error) { + f.models = append(f.models, req.Model) + return providers.ChatOutcome{Model: req.Model, Content: f.replies[req.Model]}, nil +} + +func TestClassifyIntentDoesNotOverrideInheritedHardRegion(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "qoder-cn", Provider: "qoder", Region: "cn", Runtime: "in_process", Models: []string{"glm-5.2"}}) + pool.Upsert(Item{ID: "qoder-global", Provider: "qoder", Region: "global", Runtime: "in_process", Models: []string{"glm-5.2"}}) + ex := NewChatExecutor(pool, "") + fake := &recordingIntentChat{} + ex.Providers = providers.NewRegistry() + ex.Providers.Register(providers.Adapter{ID: "qoder", Chat: fake}) + ctx := WithRegionFilter(context.Background(), " CN ") + conflict := accounts.ClassifierTarget{Provider: "qoder", Region: "gl", Model: "glm-5.2"} + if labels := ex.ClassifyIntent(ctx, []accounts.ClassifierTarget{conflict}, "hello"); len(labels) != 0 || fake.calls != 0 { + t.Fatalf("conflicting target dispatched: labels=%v calls=%d", labels, fake.calls) + } + for i, region := range []string{"cn", "", "auto"} { + target := accounts.ClassifierTarget{Provider: "qoder", Region: region, Model: "glm-5.2"} + if labels := ex.ClassifyIntent(ctx, []accounts.ClassifierTarget{target}, "hello"); labels[target.Key()] != "OK" || fake.calls != i+1 || fake.accountID != "qoder-cn" { + t.Fatalf("target %+v: labels=%v calls=%d account=%q", target, labels, fake.calls, fake.accountID) + } + } +} + func TestPrepareQoderWindowGoesToMaxInputTokens(t *testing.T) { ex := NewChatExecutor(NewPool(nil, nil), "") contexts := &stubContexts{value: 500000, ok: true} @@ -252,7 +523,7 @@ func TestPrepareNativeResponsesKeepsCompatSeedAndReasoning(t *testing.T) { if err != nil { t.Fatal(err) } - if sessionKeyFromContext(got.Context) == "" || sessionKeyFromContext(got.Context) != sessionKeyFromContext(chatOnly.Context) { + if got.Route.SessionKey == "" || got.Route.SessionKey != chatOnly.Route.SessionKey { t.Fatal("native request replaced the compatibility session seed") } if len(logs.entries) != 1 || logs.entries[0].RequestedReasoning != "high" { @@ -295,6 +566,106 @@ func TestPrepareBareModelEmptyFilterWhenPoolEnabled(t *testing.T) { } } +func TestPrepareDoesNotInheritLegacyRouteOrConversation(t *testing.T) { + t.Setenv("CLI2API_MSGSTAT_SHARDS", "0") + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "only", Provider: "workbuddy", Region: "global", Runtime: "in_process", Models: []string{"glm-5.2"}}) + ex := NewChatExecutor(pool, "") + fake := &recordingIntentChat{} + ex.Providers = providers.NewRegistry() + ex.Providers.Register(providers.Adapter{ID: "workbuddy", Chat: fake}) + ex.SessionAffinity.Bind("stale-session", "missing") + + ctx := WithRequestID(context.Background(), "stale-request") + ctx = WithClientUserAgent(ctx, "test-agent") + ctx = WithConversation(ctx, "stale-conversation") + ctx = WithSessionKey(ctx, "stale-session") + ctx = WithRegionFilter(ctx, "cn") + ctx = WithAllowedProviders(ctx, []string{"qoder:cn"}) + ctx = WithAggregatePlan(ctx, NewAggregatePlan(accounts.Aggregation{ + ID: "stale-plan", Members: []accounts.AggregationMember{{Provider: "qoder", Region: "cn", Model: "wrong"}}, + })) + got, err := ex.Prepare(PrepareInput{ + Context: ctx, + Request: translate.ChatRequest{Model: "glm-5.2"}, + Identity: auth.ConsoleIdentity(), + CrossProviderPool: true, + NewRequestID: func() string { return "new-request" }, + }) + if err != nil { + t.Fatal(err) + } + route := got.Route + if route.RequestID != "new-request" || route.PublicModel != "glm-5.2" || route.ProviderFilter != "" || + route.RegionFilter != "" || route.Prefer != "" || route.SessionKey != "" || + len(route.AllowedProviders) != 0 || route.AggregatePlan != nil { + t.Fatalf("prepared route inherited stale constraints: %+v", route) + } + if providers.ConversationFromContext(got.Context) != "" || RequestIDFromContext(got.Context) != route.RequestID || + ClientUserAgentFromContext(got.Context) != "test-agent" || providers.ConversationFromContext(ctx) != "stale-conversation" { + t.Fatal("prepared context did not replace request/conversation metadata or preserve the user agent") + } + before := ex.SessionAffinity.Stats() + result, err := ex.ChatNonStreamPrepared(got.Context, got.Request, route) + if err != nil || result.AccountID != "only" || fake.calls != 1 || fake.conversation != "" || fake.requestID != route.RequestID { + t.Fatalf("prepared result=%+v err=%v calls=%d conversation=%q requestID=%q", result, err, fake.calls, fake.conversation, fake.requestID) + } + if after := ex.SessionAffinity.Stats(); before != after { + t.Fatalf("empty explicit session touched the cache: before=%+v after=%+v", before, after) + } +} + +func TestRouteInputFromContextKeepsLegacySnapshot(t *testing.T) { + req := translate.ChatRequest{Model: "glm-5.2", Messages: []translate.ChatMessage{{Role: "user", Content: "from legacy"}}} + plan := NewAggregatePlan(accounts.Aggregation{ID: "legacy-plan"}) + ctx := WithRequestID(context.Background(), "req-legacy") + ctx = WithRegionFilter(ctx, "cn") + ctx = WithAllowedProviders(ctx, []string{"qoder:cn"}) + ctx = WithAggregatePlan(ctx, plan) + route := routeInputFromContext(ctx, req, " account ", " QODER ") + if route.RequestID != "req-legacy" || route.PublicModel != req.Model || route.RouteModel != req.Model || route.ProviderFilter != "qoder" || + route.RegionFilter != "cn" || route.Prefer != "account" || route.SessionKey != contentSessionKey(req) || + route.SessionKey == "" || route.AggregatePlan != plan || len(route.AllowedProviders) != 1 || route.AllowedProviders[0] != "qoder:cn" { + t.Fatalf("legacy route snapshot=%+v", route) + } + route.AllowedProviders[0] = "other" + if allowedProvidersFrom(ctx)[0] != "qoder:cn" { + t.Fatal("legacy context allowlist was aliased") + } + if keyed := routeInputFromContext(WithSessionKey(ctx, "legacy-key"), req, "", ""); keyed.SessionKey != "legacy-key" { + t.Fatalf("explicit key did not override content: %q", keyed.SessionKey) + } +} + +func TestRouteInputFromContextParsesPrefixOnce(t *testing.T) { + ctx := WithRegionFilter(context.Background(), "global") + req := translate.ChatRequest{Model: "qoder-cn/example"} + route := routeInputFromContext(ctx, req, "", "workbuddy") + if route.PublicModel != "qoder-cn/example" || route.RouteModel != "example" || route.ProviderFilter != "qoder" || route.RegionFilter != "cn" { + t.Fatalf("route with explicit prefix = %+v", route) + } + req.Model = "command/deepseek/example" + route = routeInputFromContext(ctx, req, "", "") + if route.RouteModel != "deepseek/example" || route.ProviderFilter != "command" || route.RegionFilter != "global" { + t.Fatalf("route with namespace and legacy region = %+v", route) + } +} + +func TestPreparedDispatchUsesRouteModelRatherThanDisplayName(t *testing.T) { + pool := NewPool(nil, nil) + pool.Upsert(Item{ID: "workbuddy", Provider: "workbuddy", Runtime: "in_process", Models: []string{"glm-5.2"}}) + ex := NewChatExecutor(pool, "") + fake := &recordingIntentChat{} + ex.Providers = providers.NewRegistry() + ex.Providers.Register(providers.Adapter{ID: "workbuddy", Chat: fake}) + res, err := ex.ChatNonStreamPrepared(context.Background(), translate.ChatRequest{Model: "not-the-route-model"}, RouteInput{ + PublicModel: "qoder-cn/display-name", RouteModel: "glm-5.2", ProviderFilter: "workbuddy", RegionFilter: "global", + }) + if err != nil || res.Model != "glm-5.2" || fake.calls != 1 || fake.accountID != "workbuddy" { + t.Fatalf("dispatch disagrees with explicit route: res=%+v err=%v calls=%d account=%s", res, err, fake.calls, fake.accountID) + } +} + func TestPrepareSessionKeyIsolatesByIdentity(t *testing.T) { ex := NewChatExecutor(NewPool(nil, nil), "") req := translate.ChatRequest{Model: "qoder/glm-5.2", Messages: []translate.ChatMessage{{Role: "user", Content: "hi"}}} @@ -311,10 +682,10 @@ func TestPrepareSessionKeyIsolatesByIdentity(t *testing.T) { if err != nil { t.Fatal(err) } - if sessionKeyFromContext(console.Context) == "" || sessionKeyFromContext(console.Context) == sessionKeyFromContext(keyed.Context) { + if console.Route.SessionKey == "" || console.Route.SessionKey == keyed.Route.SessionKey { t.Fatalf("session keys must differ by identity") } - if providers.ConversationFromContext(console.Context) != sessionKeyFromContext(console.Context) { + if providers.ConversationFromContext(console.Context) != console.Route.SessionKey { t.Fatal("conversation id source must follow the session key") } header, err := ex.Prepare(PrepareInput{ @@ -325,7 +696,7 @@ func TestPrepareSessionKeyIsolatesByIdentity(t *testing.T) { if err != nil { t.Fatal(err) } - if sessionKeyFromContext(header.Context) == sessionKeyFromContext(console.Context) { + if header.Route.SessionKey == console.Route.SessionKey { t.Fatal("header session must not reuse content seed") } } @@ -473,12 +844,12 @@ func TestPrepareStripsAutoPrefix(t *testing.T) { if got.Request.Model != "qwen3.8-max" { t.Errorf("Request.Model = %q, want qwen3.8-max (prefix stripped)", got.Request.Model) } - if r := regionFilterFromContext(got.Context); r != "" { + if r := got.Route.RegionFilter; r != "" { t.Errorf("region = %q, want empty (auto selects region in pool)", r) } } -func TestPrepareStripsRegionPrefixIntoContext(t *testing.T) { +func TestPrepareStripsRegionPrefixIntoRoute(t *testing.T) { ex := NewChatExecutor(NewPool(nil, nil), "") got, err := ex.Prepare(PrepareInput{ Request: translate.ChatRequest{Model: "workbuddy-cn/glm-5.3-flash", Messages: []translate.ChatMessage{{Role: "user", Content: "hi"}}}, @@ -494,8 +865,8 @@ func TestPrepareStripsRegionPrefixIntoContext(t *testing.T) { if got.ProviderFilter != "workbuddy" || got.Request.Model != "glm-5.3-flash" || got.PublicModel != "workbuddy-cn/glm-5.3-flash" { t.Fatalf("provider=%q model=%q publicModel=%q", got.ProviderFilter, got.Request.Model, got.PublicModel) } - if r := regionFilterFromContext(got.Context); r != "cn" { - t.Fatalf("regionFilterFromContext = %q, want cn", r) + if r := got.Route.RegionFilter; r != "cn" { + t.Fatalf("regionFilter = %q, want cn", r) } } @@ -514,7 +885,7 @@ func TestPrepareBarePrefixSetsNoRegionFilter(t *testing.T) { if got.ProviderFilter != "qoder" || got.Request.Model != "qwen3.8-max" { t.Errorf("provider=%q model=%q, want qoder / qwen3.8-max", got.ProviderFilter, got.Request.Model) } - if r := regionFilterFromContext(got.Context); r != "" { + if r := got.Route.RegionFilter; r != "" { t.Errorf("region = %q, want empty (bare prefix must not pin cn)", r) } } diff --git a/internal/executor/probe.go b/internal/executor/probe.go index 6bc38402e..bc5a22886 100644 --- a/internal/executor/probe.go +++ b/internal/executor/probe.go @@ -55,10 +55,8 @@ const maxConcurrentProbeAttempts = 8 var probeAttemptSem = make(chan struct{}, maxConcurrentProbeAttempts) // ProbeModel checks publicModel against every currently routable account. It -// reuses normal routing and provider adapters, but caps output at one token so -// a full account/model matrix check stays cheap. Unlike a chat failover loop, -// it never stops after the first working account: the operator needs to know -// which accounts actually serve the model. +// uses the pool's availability checks and caps output at one token. Each +// account is checked independently of the request router and its feedback. func (e ChatExecutor) ProbeModel(ctx context.Context, publicModel string) ProbeModelResult { result := ProbeModelResult{Model: publicModel, Accounts: []ProbeAccountResult{}} publicModel = strings.TrimSpace(publicModel) @@ -86,89 +84,44 @@ func (e ChatExecutor) ProbeModel(ctx context.Context, publicModel string) ProbeM // bare when it is on. Resolve prefixes while allowing both; explicit // region prefixes still pin the route. providerFilter, modelRegion := ResolveProviderFilter(&request, true) - routeModel := request.Model - regionFilter := regionFilterFromContext(probeCtx) + regionFilter := strings.TrimSpace(regionFilterFromContext(probeCtx)) if regionFilter == "" { regionFilter = modelRegion + } else if modelRegion != "" && NormalizeRegion(regionFilter) != modelRegion { + result.Message = "no accounts available" + return result } - allowed := allowedProvidersFrom(probeCtx) - - items := e.probeAccounts(providerFilter, regionFilter, routeModel, allowed) + q := RouteQuery{ + PublicModel: request.Model, + ProviderFilter: providerFilter, + RegionFilter: regionFilter, + AllowedProviders: allowedProvidersFrom(probeCtx), + } + // Take a read-only snapshot of the matrix, excluding accounts that are + // already cooling or busy. Each row is rechecked before dispatch. + items := e.Pool.ReadyItems(q) if len(items) == 0 { result.Message = "no accounts available" return result } + sort.Slice(items, func(i, j int) bool { + if items[i].Provider != items[j].Provider { + return items[i].Provider < items[j].Provider + } + return items[i].ID < items[j].ID + }) started := time.Now() firstOK := -1 - firstFailure := -1 -probeAccountsLoop: - for _, item := range items { - // If the operator request (or the batch deadline) is gone, stop making - // new upstream calls instead of marking every remaining account as a - // client cancellation. - if err := probeCtx.Err(); err != nil { + for _, candidate := range items { + accountResult, checked := e.probeAccount(probeCtx, ctx, q, candidate, request) + if !checked { break } - accountResult := ProbeAccountResult{ - AccountID: item.ID, - Provider: firstNonEmpty(item.Provider, providerFilter), - Region: item.Region, - } - if !e.acquireInFlight("", item.ID) { - accountResult.Code = "account_busy" - accountResult.Kind = accounts.KindRateLimit - accountResult.Message = "account is at capacity" - result.Accounts = append(result.Accounts, accountResult) - if firstFailure < 0 { - firstFailure = len(result.Accounts) - 1 - } - continue - } - // Bound the number of simultaneous live calls across all probe batches. - select { - case probeAttemptSem <- struct{}{}: - case <-probeCtx.Done(): - e.releaseInFlight("", item.ID) - break probeAccountsLoop - } - accountStarted := time.Now() - accountCtx, accountCancel := context.WithTimeout(probeCtx, 15*time.Second) - probeErr := e.probeModelAttempt(accountCtx, item, request) - // Capture the deadline state before cancel(): cancel() always sets Err() - // to Canceled, which would hide a genuine probe-owned timeout. - accountTimedOut := errors.Is(accountCtx.Err(), context.DeadlineExceeded) - accountCancel() - <-probeAttemptSem - e.releaseInFlight("", item.ID) - accountResult.LatencyMS = int(time.Since(accountStarted).Milliseconds()) - if probeErr == nil { - accountResult.OK = true - accountResult.Status = http.StatusOK - result.Accounts = append(result.Accounts, accountResult) - if firstOK < 0 { - firstOK = len(result.Accounts) - 1 - } - continue - } - // A deadline owned by this probe is an upstream timeout, not a client - // cancellation. Only a cancelled parent request is a real cancellation. - if errors.Is(probeErr, context.DeadlineExceeded) && ctx.Err() == nil && accountTimedOut { - accountResult.Status = http.StatusBadGateway - accountResult.Code = "probe_timeout" - accountResult.Kind = accounts.KindUnavailable - accountResult.Message = "upstream probe timed out" - } else { - classified := classifyProbeError(probeErr) - accountResult.Status = classified.Status - accountResult.Code = classified.Code - accountResult.Kind = classified.Kind - accountResult.Message = classified.Message + if accountResult.OK && firstOK < 0 { + firstOK = len(result.Accounts) } result.Accounts = append(result.Accounts, accountResult) - if firstFailure < 0 { - firstFailure = len(result.Accounts) - 1 - } } result.AttemptCount = len(result.Accounts) @@ -181,8 +134,8 @@ probeAccountsLoop: result.LatencyMS = okAccount.LatencyMS return result } - if firstFailure >= 0 { - failed := result.Accounts[firstFailure] + if len(result.Accounts) > 0 { + failed := result.Accounts[0] result.Status = failed.Status result.Code = failed.Code result.Kind = failed.Kind @@ -191,30 +144,106 @@ probeAccountsLoop: return result } -// probeAccounts enumerates every currently routable account for the model. -// It uses a read-only Pool snapshot so probing never advances rotation cursors, -// region latches, or weight counters used by live traffic. -func (e ChatExecutor) probeAccounts(providerFilter, regionFilter, publicModel string, allowed []string) []Item { - if e.Pool == nil { - return nil +// probeAccount returns false if the batch stops before checking this row. +func (e ChatExecutor) probeAccount(ctx, parentCtx context.Context, q RouteQuery, candidate Item, request translate.ChatRequest) (ProbeAccountResult, bool) { + if ctx.Err() != nil { + return ProbeAccountResult{}, false } - q := RouteQuery{ - PublicModel: publicModel, - ProviderFilter: providerFilter, - RegionFilter: regionFilter, - AllowedProviders: allowed, + // Wait for the shared probe limit before occupying an account slot. + select { + case probeAttemptSem <- struct{}{}: + case <-ctx.Done(): + return ProbeAccountResult{}, false } - items := e.Pool.RoutableItems(q) - sort.Slice(items, func(i, j int) bool { - if items[i].Provider != items[j].Provider { - return items[i].Provider < items[j].Provider + defer func() { <-probeAttemptSem }() + + item, busy := e.Pool.reserveProbeAccount(ctx, candidate.ID, q) + if item.ID == "" { + if ctx.Err() != nil { + return ProbeAccountResult{}, false } - return items[i].ID < items[j].ID - }) - return items + result := ProbeAccountResult{ + AccountID: candidate.ID, + Provider: firstNonEmpty(candidate.Provider, q.ProviderFilter), + Region: candidate.Region, + } + if busy { + result.Code = "account_busy" + result.Kind = accounts.KindRateLimit + result.Message = "account is at capacity" + } else { + result.Status = http.StatusServiceUnavailable + result.Code = "account_unavailable" + result.Kind = accounts.KindUnavailable + result.Message = "account is no longer available for this model" + } + return result, true + } + defer e.Pool.Release(item.ID) + + started := time.Now() + accountCtx, cancel := context.WithTimeout(ctx, 15*time.Second) + defer cancel() + if accountCtx.Err() != nil { + return ProbeAccountResult{}, false + } + probeErr := e.probeModelAttempt(accountCtx, item, request) + result := ProbeAccountResult{ + AccountID: item.ID, + Provider: firstNonEmpty(item.Provider, q.ProviderFilter), + Region: item.Region, + LatencyMS: int(time.Since(started).Milliseconds()), + } + if probeErr == nil { + result.OK = true + result.Status = http.StatusOK + return result, true + } + // A probe-owned deadline is an upstream timeout while the parent request + // is still active. Check the deadline before the deferred cancel. + if errors.Is(probeErr, context.DeadlineExceeded) && parentCtx.Err() == nil && errors.Is(accountCtx.Err(), context.DeadlineExceeded) { + result.Status = http.StatusBadGateway + result.Code = "probe_timeout" + result.Kind = accounts.KindUnavailable + result.Message = "upstream probe timed out" + } else { + classified := classifyProbeError(probeErr) + result.Status = classified.Status + result.Code = classified.Code + result.Kind = classified.Kind + result.Message = classified.Message + } + return result, true +} + +// reserveProbeAccount rechecks a single matrix row and occupies its slot in +// the same critical section. Only that account can satisfy this reservation. +// The second result reports an otherwise eligible account at capacity. +func (p *Pool) reserveProbeAccount(ctx context.Context, id string, q RouteQuery) (Item, bool) { + p.mu.Lock() + defer p.mu.Unlock() + if ctx.Err() != nil { + return Item{}, false + } + i := p.itemIndexLocked(id) + if i < 0 { + return Item{}, false + } + item := &p.items[i] + now := time.Now() + q, _ = p.configureRouteLocked(q, now) + if !routeMatches(*item, q) || itemDown(*item, now) || itemModelDown(*item, q, now) { + return Item{}, false + } + if itemSaturated(*item) { + return Item{}, true + } + acquireItemLocked(item, now) + return item.clone(), false } func (e ChatExecutor) probeModelAttempt(ctx context.Context, item Item, request translate.ChatRequest) error { + request = sanitizeForItem(item, request) if isInProcessItem(item) || e.qoderDirect(item) { if e.Providers == nil { return fmt.Errorf("provider registry unavailable") @@ -223,7 +252,7 @@ func (e ChatExecutor) probeModelAttempt(ctx context.Context, item Item, request if !ok || adapter.Chat == nil { return fmt.Errorf("provider %s does not implement chat", itemProvider(item)) } - _, err := adapter.Chat.ChatNonStream(ctx, item.ID, sanitizeForItem(item, request)) + _, err := adapter.Chat.ChatNonStream(ctx, item.ID, request) return err } diff --git a/internal/executor/probe_test.go b/internal/executor/probe_test.go index 5a055618f..c0df9b95a 100644 --- a/internal/executor/probe_test.go +++ b/internal/executor/probe_test.go @@ -2,8 +2,13 @@ package executor import ( "context" + "encoding/json" + "io" "net/http" + "slices" + "strings" "testing" + "time" "github.com/caigee-cmd/cli2api/internal/accounts" "github.com/caigee-cmd/cli2api/internal/providers" @@ -15,12 +20,18 @@ type probeCaptureChat struct { reqs []translate.ChatRequest accounts []string err error + onChat func(context.Context, string) error } -func (f *probeCaptureChat) ChatNonStream(_ context.Context, accountID string, req translate.ChatRequest) (providers.ChatOutcome, error) { +func (f *probeCaptureChat) ChatNonStream(ctx context.Context, accountID string, req translate.ChatRequest) (providers.ChatOutcome, error) { f.req = req f.reqs = append(f.reqs, req) f.accounts = append(f.accounts, accountID) + if f.onChat != nil { + if err := f.onChat(ctx, accountID); err != nil { + return providers.ChatOutcome{}, err + } + } if f.err != nil { return providers.ChatOutcome{}, f.err } @@ -68,6 +79,9 @@ func TestProbeModelUsesMinimalRequestAndDoesNotCoolAccount(t *testing.T) { if !item.DownUntil.IsZero() || len(item.ModelDownUntil) != 0 { t.Fatalf("probe must not cool the account: down=%v model=%v", item.DownUntil, item.ModelDownUntil) } + if len(item.ProvenModels) != 0 || item.StateVersion != 0 { + t.Fatalf("probe must not persist model success: proven=%v version=%d", item.ProvenModels, item.StateVersion) + } if item.InFlight != 0 { t.Fatalf("probe leaked in-flight slot: %d", item.InFlight) } @@ -86,16 +100,19 @@ func TestProbeModelDoesNotMutateRoutingCursor(t *testing.T) { pool.mu.Lock() pool.ensureRotationKey(routeKey) pool.lastPicked[routeKey] = "wb1" - before := pool.lastPicked[routeKey] + pool.lastRegion[routeKey] = "cn" + pool.weightCounter = map[string]map[string]int64{routeKey: {"wb1": 7}} pool.mu.Unlock() - _ = e.ProbeModel(context.Background(), "glm-5.2") + if res := e.ProbeModel(context.Background(), "glm-5.2"); !res.OK || res.AttemptCount != 2 { + t.Fatalf("probe result: %+v", res) + } pool.mu.Lock() - after := pool.lastPicked[routeKey] + pick, region, weight := pool.lastPicked[routeKey], pool.lastRegion[routeKey], pool.weightCounter[routeKey]["wb1"] pool.mu.Unlock() - if after != before { - t.Fatalf("probe mutated routing cursor: before=%q after=%q", before, after) + if pick != "wb1" || region != "cn" || weight != 7 { + t.Fatalf("probe mutated routing state: account=%q region=%q weight counter=%d", pick, region, weight) } } @@ -141,9 +158,15 @@ func TestProbeModelFailureDoesNotCoolAccount(t *testing.T) { }} registry := providers.NewRegistry() registry.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) - e := ChatExecutor{Pool: pool, Providers: registry} + pool.SetObserver(func(Item) { t.Error("probe must not persist account state") }) + e := ChatExecutor{ + Pool: pool, Providers: registry, + OnAttempt: func(accounts.RequestAttempt) { t.Error("probe must not write request attempts") }, + OnInFlightAcquire: func(string, string) { t.Error("probe must not acquire a request recorder slot") }, + OnInFlightRelease: func(string, string) { t.Error("probe must not release a request recorder slot") }, + } - res := e.ProbeModel(context.Background(), "glm-5.2") + res := e.ProbeModel(WithRequestID(context.Background(), "probe"), "glm-5.2") if res.OK { t.Fatal("probe should report failure") } @@ -161,3 +184,202 @@ func TestProbeModelFailureDoesNotCoolAccount(t *testing.T) { t.Fatalf("probe leaked in-flight slot: %d", item.InFlight) } } + +func TestProbeModelRechecksAccountBeforeDispatch(t *testing.T) { + for _, tc := range []struct { + name, model, region string + allowed []string + update func(*Pool, Item) + wantCode string + }{ + {name: "provider", model: "workbuddy/glm-5.2", update: func(p *Pool, item Item) { + item.Provider = "qoder" + p.Upsert(item) + }}, + {name: "model region prefix", model: "workbuddy-cn/glm-5.2", update: func(p *Pool, item Item) { + item.Region = "global" + p.Upsert(item) + }}, + {name: "explicit region", model: "glm-5.2", region: "cn", update: func(p *Pool, item Item) { + item.Region = "global" + p.Upsert(item) + }}, + {name: "provider region grant", model: "glm-5.2", allowed: []string{"workbuddy:cn"}, update: func(p *Pool, item Item) { + item.Region = "global" + p.Upsert(item) + }}, + {name: "model grant", model: "glm-5.2", update: func(p *Pool, item Item) { + p.SetModelRouting(item.ID, nil, nil, true) + }}, + {name: "catalog", model: "glm-5.2", update: func(p *Pool, item Item) { + item.Models = []string{"another"} + p.Upsert(item) + }}, + {name: "removed", model: "glm-5.2", update: func(p *Pool, item Item) { + p.Remove(item.ID) + }}, + {name: "new account cooldown", model: "glm-5.2", update: func(p *Pool, item Item) { + item.DownUntil = time.Now().Add(time.Hour) + p.Upsert(item) + }}, + {name: "new model cooldown", model: "glm-5.2", update: func(p *Pool, item Item) { + item.ModelDownUntil = map[string]time.Time{"glm-5.2": time.Now().Add(time.Hour)} + p.Upsert(item) + }}, + {name: "newly busy", model: "glm-5.2", wantCode: "account_busy", update: func(p *Pool, item Item) { + p.Acquire(item.ID) + }}, + } { + t.Run(tc.name, func(t *testing.T) { + pool := NewPool(nil, nil) + first := Item{ID: "a", Provider: "workbuddy", Region: "cn", Runtime: string(providers.RuntimeInProcess), Models: []string{"glm-5.2"}, MaxInFlight: 1} + second := first + second.ID = "b" + pool.Upsert(first) + pool.Upsert(second) + chat := &probeCaptureChat{onChat: func(_ context.Context, id string) error { + if id == first.ID { + live, _ := pool.ByID(id) + if live.InFlight != 1 { + t.Errorf("first account has %d in-flight slots, want 1", live.InFlight) + } + tc.update(pool, second) + } + return nil + }} + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) + registry.Register(providers.Adapter{ID: "qoder", Chat: chat}) + e := ChatExecutor{Pool: pool, Providers: registry} + ctx := WithAllowedProviders(WithRegionFilter(context.Background(), tc.region), tc.allowed) + + res := e.ProbeModel(ctx, tc.model) + if !slices.Equal(chat.accounts, []string{first.ID}) { + t.Fatalf("dispatched accounts=%v, want [%s]", chat.accounts, first.ID) + } + wantCode := firstNonEmpty(tc.wantCode, "account_unavailable") + if !res.OK || len(res.Accounts) != 2 || res.Accounts[1].AccountID != second.ID || res.Accounts[1].OK || res.Accounts[1].Code != wantCode { + t.Fatalf("probe results=%+v, want second row rejected with %s", res.Accounts, wantCode) + } + wantInFlight := 0 + if wantCode == "account_busy" { + wantInFlight = 1 + } + if live, _ := pool.ByID(second.ID); live.InFlight != wantInFlight { + t.Fatalf("second account has %d in-flight slots, want %d", live.InFlight, wantInFlight) + } + }) + } +} + +func TestProbeModelMatrixRespectsCooldownsAndScope(t *testing.T) { + pool := NewPool(nil, nil) + cn := Item{ID: "cn", Provider: "workbuddy", Region: "cn", Runtime: string(providers.RuntimeInProcess), Models: []string{"glm-5.2"}} + global, accountCooling, modelCooling := cn, cn, cn + global.ID, global.Region = "global", "global" + accountCooling.ID, accountCooling.DownUntil = "account-cooling", time.Now().Add(time.Hour) + modelCooling.ID, modelCooling.ModelDownUntil = "model-cooling", map[string]time.Time{"glm-5.2": time.Now().Add(time.Hour)} + for _, item := range []Item{cn, global, accountCooling, modelCooling} { + pool.Upsert(item) + } + for _, tc := range []struct { + name, model, region string + allowed, want []string + }{ + {name: "unqualified matrix", model: "glm-5.2", want: []string{"cn", "global"}}, + {name: "same explicit region", model: "workbuddy-gl/glm-5.2", region: "gl", want: []string{"global"}}, + {name: "conflicting region scopes", model: "workbuddy-cn/glm-5.2", region: "global"}, + {name: "conflicting region grant", model: "workbuddy-cn/glm-5.2", allowed: []string{"workbuddy:global"}}, + } { + t.Run(tc.name, func(t *testing.T) { + chat := &probeCaptureChat{} + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) + e := ChatExecutor{Pool: pool, Providers: registry} + ctx := WithAllowedProviders(WithRegionFilter(context.Background(), tc.region), tc.allowed) + res := e.ProbeModel(ctx, tc.model) + if !slices.Equal(chat.accounts, tc.want) || res.AttemptCount != len(tc.want) { + t.Fatalf("checked accounts=%v, want %v (result=%+v)", chat.accounts, tc.want, res) + } + }) + } +} + +type probeRoundTripFunc func(*http.Request) (*http.Response, error) + +func (f probeRoundTripFunc) RoundTrip(r *http.Request) (*http.Response, error) { return f(r) } + +func TestProbeModelWorkerUsesCurrentAliasAndNativeModel(t *testing.T) { + pool := NewPool([]string{"http://first.test", "http://old.test"}, []string{"a", "b"}) + for _, id := range []string{"a", "b"} { + item, _ := pool.ByID(id) + item.Models = []string{"old-model"} + item.ModelAliases = map[string]string{"friendly": "old-model"} + item.NativeModels = map[string]string{"old-model": "Old.Native"} + pool.Upsert(item) + } + var got []string + client := &http.Client{Transport: probeRoundTripFunc(func(r *http.Request) (*http.Response, error) { + defer r.Body.Close() + var payload struct { + Model string `json:"model"` + MaxTokens int `json:"max_tokens"` + } + if err := json.NewDecoder(r.Body).Decode(&payload); err != nil { + return nil, err + } + id := r.Header.Get("X-Qoder-Account") + got = append(got, id+"/"+r.URL.Host+"/"+payload.Model) + if payload.MaxTokens != 1 { + t.Errorf("worker probe max_tokens=%d, want 1", payload.MaxTokens) + } + if id == "a" { + current, _ := pool.ByID("b") + current.URL = "http://new.test" + current.Models = []string{"new-model"} + current.ModelAliases = map[string]string{"friendly": "new-model"} + current.NativeModels = map[string]string{"new-model": "New.Native"} + pool.Upsert(current) + } + return &http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(strings.NewReader(`{"choices":[{"message":{"content":"OK"}}]}`))}, nil + })} + e := ChatExecutor{Pool: pool, HTTPClient: client} + res := e.ProbeModel(context.Background(), "qoder/friendly") + want := []string{"a/first.test/Old.Native", "b/new.test/New.Native"} + if !res.OK || !slices.Equal(got, want) { + t.Fatalf("worker probes=%v, want %v (result=%+v)", got, want, res) + } +} + +func TestProbeModelCancellationReleasesSlots(t *testing.T) { + pool := NewPool(nil, nil) + for _, id := range []string{"a", "b"} { + pool.Upsert(Item{ID: id, Provider: "workbuddy", Runtime: string(providers.RuntimeInProcess), Models: []string{"glm-5.2"}, MaxInFlight: 1}) + } + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + chat := &probeCaptureChat{onChat: func(ctx context.Context, id string) error { + item, _ := pool.ByID(id) + if item.InFlight != 1 { + t.Errorf("account %s has %d in-flight slots, want 1", id, item.InFlight) + } + cancel() + return ctx.Err() + }} + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) + e := ChatExecutor{Pool: pool, Providers: registry} + before := len(probeAttemptSem) + res := e.ProbeModel(ctx, "glm-5.2") + if !slices.Equal(chat.accounts, []string{"a"}) || len(res.Accounts) != 1 || res.Accounts[0].Kind != accounts.KindCanceled { + t.Fatalf("dispatched=%v, result=%+v, want one canceled attempt", chat.accounts, res) + } + if after := len(probeAttemptSem); after != before { + t.Errorf("probe semaphore count changed: before=%d after=%d", before, after) + } + for _, item := range pool.Items() { + if item.InFlight != 0 || !item.InFlightSince.IsZero() { + t.Errorf("probe leaked reservation for %s: slots=%d since=%v", item.ID, item.InFlight, item.InFlightSince) + } + } +} diff --git a/internal/executor/providers_test.go b/internal/executor/providers_test.go index bfdf6149e..e497deb19 100644 --- a/internal/executor/providers_test.go +++ b/internal/executor/providers_test.go @@ -482,7 +482,7 @@ func TestNoRoutableAccountsClassifiedAs503(t *testing.T) { // permission_error, never the generic 502. func TestPickProviderNotAllowedFallback(t *testing.T) { ex := NewChatExecutor(NewPool(nil, nil), "") - _, err := ex.pick("req", "", "trae", "", "glm-5.2", []string{"workbuddy:cn"}, nil, nil, nil) + _, err := ex.reserveTarget("req", RouteQuery{ProviderFilter: "trae", PublicModel: "glm-5.2", AllowedProviders: []string{"workbuddy:cn"}}, nil) if err == nil { t.Fatal("an ungranted provider filter must fail even with an empty pool") } diff --git a/internal/executor/route_integration_regression_test.go b/internal/executor/route_integration_regression_test.go new file mode 100644 index 000000000..b418edcd6 --- /dev/null +++ b/internal/executor/route_integration_regression_test.go @@ -0,0 +1,360 @@ +package executor + +import ( + "encoding/json" + "errors" + "io" + "net/http" + "net/http/httptest" + "slices" + "strings" + "sync" + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/auth" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +type routeRegressionHit struct { + endpoint, account, model string + stream bool +} + +// Keep a single wire trace across worker endpoints to verify where each +// dispatch really went and which model was in its request body. +type routeRegressionWire struct { + mu sync.Mutex + hits []routeRegressionHit +} + +func (wire *routeRegressionWire) add(t *testing.T, pool *Pool, item Item, respond func(http.ResponseWriter, routeRegressionHit)) { + t.Helper() + endpoint := item.ID + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost || r.URL.Path != "/v1/chat/completions" { + t.Errorf("%s received %s %s", endpoint, r.Method, r.URL.Path) + w.WriteHeader(http.StatusBadRequest) + return + } + var body struct { + Model string `json:"model"` + Stream bool `json:"stream"` + } + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + t.Errorf("%s decode request: %v", endpoint, err) + w.WriteHeader(http.StatusBadRequest) + return + } + hit := routeRegressionHit{endpoint: endpoint, account: r.Header.Get("X-Qoder-Account"), model: body.Model, stream: body.Stream} + wire.mu.Lock() + wire.hits = append(wire.hits, hit) + wire.mu.Unlock() + if respond != nil { + respond(w, hit) + } else { + routeRegressionOK(w, hit) + } + })) + t.Cleanup(server.Close) + item.URL = server.URL + item.Runtime = "child_process" + pool.Upsert(item) +} + +func routeRegressionDispatchTo(account, model string, stream bool) routeRegressionHit { + return routeRegressionHit{endpoint: account, account: account, model: model, stream: stream} +} + +func (wire *routeRegressionWire) require(t *testing.T, want ...routeRegressionHit) { + t.Helper() + wire.mu.Lock() + defer wire.mu.Unlock() + if !slices.Equal(wire.hits, want) { + t.Fatalf("upstream dispatches = %+v, want %+v", wire.hits, want) + } +} + +func routeRegressionOK(w http.ResponseWriter, hit routeRegressionHit) { + if hit.stream { + w.Header().Set("Content-Type", "text/event-stream") + _, _ = io.WriteString(w, `data: {"choices":[{"delta":{"content":"ok"}}]}`+"\n\ndata: [DONE]\n\n") + return + } + w.Header().Set("Content-Type", "application/json") + _, _ = io.WriteString(w, `{"choices":[{"message":{"content":"ok"},"finish_reason":"stop"}]}`) +} + +func routeRegressionLimited(w http.ResponseWriter) { + w.Header().Set("X-Qoder-Error-Kind", accounts.KindRateLimit) + w.Header().Set("Retry-After", "120") + http.Error(w, `{"error":{"message":"too many requests"}}`, http.StatusTooManyRequests) +} + +func routeRegressionPrepare(t *testing.T, executor ChatExecutor, in PrepareInput) PreparedRequest { + t.Helper() + in.Context = t.Context() + in.CrossProviderPool = true + in.SessionHeader = "routing-regression-session" + in.Request.Messages = []translate.ChatMessage{{Role: "user", Content: "test message"}} + if in.Identity.Kind == "" { + in.Identity = auth.ConsoleIdentity() + } + prepared, err := executor.Prepare(in) + if err != nil { + t.Fatalf("prepare %q: %v", in.Request.Model, err) + } + return prepared +} + +func routeRegressionExecute(t *testing.T, executor ChatExecutor, prepared PreparedRequest) (account string, attempts int, err error) { + t.Helper() + if !prepared.Request.Stream { + result, err := executor.ChatNonStreamPrepared(prepared.Context, prepared.Request, prepared.Route) + return result.AccountID, result.AttemptCount, err + } + result, err := executor.ChatStreamProxyPrepared(prepared.Context, prepared.Request, nil, prepared.Route) + if err != nil { + return result.AccountID, result.AttemptCount, err + } + if result.Response == nil || result.Response.Body == nil { + t.Fatal("stream dispatch returned no body") + } + defer result.Response.Body.Close() + body, err := io.ReadAll(result.Response.Body) + if err != nil || !strings.Contains(string(body), "data: [DONE]") { + t.Fatalf("read completed SSE: body=%q err=%v", body, err) + } + executor.FinishStream(prepared.Context, result, nil) + return result.AccountID, result.AttemptCount, nil +} + +func routeRegressionSeedBinding(t *testing.T, executor ChatExecutor, model string, identity auth.Identity, wantAccount string) { + t.Helper() + seed := routeRegressionPrepare(t, executor, PrepareInput{Request: translate.ChatRequest{Model: model}, Identity: identity}) + account, attempts, err := routeRegressionExecute(t, executor, seed) + if err != nil || account != wantAccount || attempts != 1 { + t.Fatalf("seed binding: account=%q attempts=%d err=%v; want %q in one attempt", account, attempts, err, wantAccount) + } + if bound, ok := executor.SessionAffinity.Get(seed.Route.SessionKey); !ok || bound != wantAccount { + t.Fatalf("seed did not establish affinity: account=%q exists=%v want=%q", bound, ok, wantAccount) + } +} + +func routeRegressionRequireRateLimit(t *testing.T, err error) { + t.Helper() + var execution *ExecutionError + if !errors.As(err, &execution) || execution.Classified.Kind != accounts.KindRateLimit { + t.Fatalf("execution error = %v, want rate limit", err) + } +} + +func TestPreparedRouteRegressionUnscopedStickyEscape(t *testing.T) { + for _, tc := range []struct { + name string + saturated, stream bool + }{ + {name: "saturated_non_stream", saturated: true}, + {name: "saturated_stream", saturated: true, stream: true}, + {name: "first_failure_non_stream"}, + {name: "first_failure_stream", stream: true}, + } { + t.Run(tc.name, func(t *testing.T) { + const seed, shared = "affinity-seed", "shared-model" + const bound, fallback = "z-bound", "a-fallback" + var wire routeRegressionWire + pool := NewPool(nil, nil) + wire.add(t, pool, Item{ID: bound, Provider: "workbuddy", Region: "cn", Models: []string{seed, shared}, MaxInFlight: 1}, func(w http.ResponseWriter, hit routeRegressionHit) { + if hit.model == shared { + routeRegressionLimited(w) + return + } + routeRegressionOK(w, hit) + }) + // The fallback sorts first in the ordinary pool, so skipping affinity + // cannot accidentally exercise the same first-failure path. + wire.add(t, pool, Item{ID: fallback, Provider: "qoder", Region: "global", Models: []string{shared}}, nil) + executor := NewChatExecutor(pool, "") + routeRegressionSeedBinding(t, executor, seed, auth.ConsoleIdentity(), bound) + want := []routeRegressionHit{routeRegressionDispatchTo(bound, seed, false)} + if tc.saturated { + if !pool.Acquire(bound) { + t.Fatal("occupy bound account slot") + } + defer pool.Release(bound) + } else { + want = append(want, routeRegressionDispatchTo(bound, shared, tc.stream)) + } + want = append(want, routeRegressionDispatchTo(fallback, shared, tc.stream)) + + prepared := routeRegressionPrepare(t, executor, PrepareInput{Request: translate.ChatRequest{Model: shared, Stream: tc.stream}}) + account, attempts, err := routeRegressionExecute(t, executor, prepared) + if err != nil || account != fallback || attempts != len(want)-1 { + t.Errorf("dispatch: account=%q attempts=%d err=%v; want fallback in %d upstream attempt(s)", account, attempts, err, len(want)-1) + } + wire.require(t, want...) + if id, ok := executor.SessionAffinity.Peek(prepared.Route.SessionKey); !ok || id != fallback { + t.Fatalf("affinity after failover = %q, exists=%v; want %q", id, ok, fallback) + } + }) + } +} + +func TestPreparedRouteRegressionHardRegionSurvivesStickyEscape(t *testing.T) { + for _, constraint := range []string{"prefix", "grant"} { + for _, failure := range []string{"saturated", "first_failure"} { + t.Run(constraint+"/"+failure, func(t *testing.T) { + const seed, shared = "affinity-seed", "shared-model" + const global, cn, cnBackup = "a-global", "b-cn", "c-cn" + var wire routeRegressionWire + pool := NewPool(nil, nil) + wire.add(t, pool, Item{ID: global, Provider: "qoder", Region: "global", Models: []string{seed, shared}}, nil) + limited := func(w http.ResponseWriter, _ routeRegressionHit) { + routeRegressionLimited(w) + } + wire.add(t, pool, Item{ID: cn, Provider: "qoder", Region: "cn", Models: []string{shared}, MaxInFlight: 1}, limited) + executor := NewChatExecutor(pool, "") + var seedIdentity, identity auth.Identity + model := "qoder-cn/" + shared + if constraint == "grant" { + // Tightening the grants keeps the identity and session cache key. + seedIdentity = auth.KeyIdentity(accounts.APIKey{ID: "same-key", Providers: []string{"qoder"}}) + identity = auth.KeyIdentity(accounts.APIKey{ID: "same-key", Providers: []string{"qoder:cn"}}) + model = shared + } + routeRegressionSeedBinding(t, executor, "qoder-gl/"+seed, seedIdentity, global) + want := []routeRegressionHit{routeRegressionDispatchTo(global, seed, false)} + stream := failure == "first_failure" + if stream { + // Another authorized CN account forces a genuine retry. The + // healthy global account must be skipped even though it sorts first. + wire.add(t, pool, Item{ID: cnBackup, Provider: "qoder", Region: "cn", Models: []string{shared}}, limited) + want = append(want, routeRegressionDispatchTo(cn, shared, true), routeRegressionDispatchTo(cnBackup, shared, true)) + } else { + if !pool.Acquire(cn) { + t.Fatal("occupy cn account slot") + } + defer pool.Release(cn) + } + + prepared := routeRegressionPrepare(t, executor, PrepareInput{Request: translate.ChatRequest{Model: model, Stream: stream}, Identity: identity}) + _, attempts, err := routeRegressionExecute(t, executor, prepared) + wire.require(t, want...) + routeRegressionRequireRateLimit(t, err) + if attempts != len(want)-1 { + t.Fatalf("attempts = %d, want %d", attempts, len(want)-1) + } + }) + } + } +} + +func TestPreparedRouteRegressionSendsHealthyMemberOnSameAccount(t *testing.T) { + for _, tc := range []struct { + name string + preCool, stream bool + }{ + {name: "member_a_already_cooling", preCool: true, stream: true}, + {name: "member_a_fails_this_attempt"}, + } { + t.Run(tc.name, func(t *testing.T) { + const realID, a, b, logical = "shared-account", "member-a", "member-b", "pooled-model" + var wire routeRegressionWire + pool := NewPool(nil, nil) + wire.add(t, pool, Item{ID: realID, Provider: "qoder", Region: "cn", Models: []string{a, b}}, func(w http.ResponseWriter, hit routeRegressionHit) { + if hit.model == a { + routeRegressionLimited(w) + return + } + routeRegressionOK(w, hit) + }) + executor := NewChatExecutor(pool, "") + var before time.Time + wantAttempts := 2 + if tc.preCool { + first := routeRegressionPrepare(t, executor, PrepareInput{Request: translate.ChatRequest{Model: "qoder-cn/" + a}}) + _, _, err := routeRegressionExecute(t, executor, first) + routeRegressionRequireRateLimit(t, err) + item, _ := pool.ByID(realID) + before = item.ModelDownUntil[a] + if !time.Now().Before(before) { + t.Fatal("the upstream 429 did not put member A on cooldown") + } + wantAttempts = 1 + } + + resolver := &aggResolverStub{agg: accounts.Aggregation{ + ID: logical, Enabled: true, Strategy: accounts.AggregationPriority, AllowFallbacks: true, MaxAttempts: 2, + Members: []accounts.AggregationMember{ + {Provider: "qoder", Region: "cn", AccountID: realID, Model: a, Priority: 0}, + {Provider: "qoder", Region: "cn", AccountID: realID, Model: b, Priority: 1}, + }, + }} + prepared := routeRegressionPrepare(t, executor, PrepareInput{Request: translate.ChatRequest{Model: logical, Stream: tc.stream}, Aggregations: resolver}) + account, attempts, err := routeRegressionExecute(t, executor, prepared) + if err != nil || account != realID || attempts != wantAttempts { + t.Errorf("dispatch: account=%q attempts=%d err=%v; want %q in %d upstream attempt(s)", account, attempts, err, realID, wantAttempts) + } + wire.require(t, routeRegressionDispatchTo(realID, a, false), routeRegressionDispatchTo(realID, b, tc.stream)) + after, _ := pool.ByID(realID) + if !time.Now().Before(after.ModelDownUntil[a]) || (tc.preCool && !after.ModelDownUntil[a].Equal(before)) { + t.Fatalf("success on member B lost or changed member A cooldown: %v -> %v", before, after.ModelDownUntil[a]) + } + }) + } +} + +func TestPreparedRouteRegressionWorkerLabelDoesNotOwnFeedback(t *testing.T) { + for _, mode := range []string{"non_stream", "stream"} { + t.Run(mode, func(t *testing.T) { + const realID, displayID, concrete, otherModel, logical = "actual-pool-id", "reported-label", "real-member", "other-model", "pooled-model" + var wire routeRegressionWire + pool := NewPool(nil, nil) + wire.add(t, pool, Item{ID: realID, Provider: "qoder", Region: "cn", Models: []string{concrete, otherModel}}, func(w http.ResponseWriter, hit routeRegressionHit) { + if hit.model == concrete { + w.Header().Set("X-Qoder-Account", displayID) + routeRegressionLimited(w) + return + } + routeRegressionOK(w, hit) + }) + // A displayed label can happen to match a different pool ID. + wire.add(t, pool, Item{ID: displayID, Provider: "qoder", Region: "cn", Models: []string{concrete}}, nil) + executor := NewChatExecutor(pool, "") + var recorded []accounts.RequestAttempt + executor.OnAttempt = func(attempt accounts.RequestAttempt) { recorded = append(recorded, attempt) } + resolver := &aggResolverStub{agg: accounts.Aggregation{ + ID: logical, Enabled: true, Strategy: accounts.AggregationPriority, + Members: []accounts.AggregationMember{{Provider: "qoder", Region: "cn", AccountID: realID, Model: concrete}}, + }} + stream := mode == "stream" + prepared := routeRegressionPrepare(t, executor, PrepareInput{Request: translate.ChatRequest{Model: logical, Stream: stream}, Aggregations: resolver}) + _, attempts, err := routeRegressionExecute(t, executor, prepared) + routeRegressionRequireRateLimit(t, err) + if attempts != 1 { + t.Errorf("attempts = %d, want 1", attempts) + } + wire.require(t, routeRegressionDispatchTo(realID, concrete, stream)) + actual, _ := pool.ByID(realID) + decoy, _ := pool.ByID(displayID) + if !time.Now().Before(actual.ModelDownUntil[concrete]) || len(actual.ModelDownUntil) != 1 || !actual.DownUntil.IsZero() { + t.Errorf("actual account cooldowns = %v, account-wide=%v; want cooldown only on %q, not virtual %q", actual.ModelDownUntil, actual.DownUntil, concrete, logical) + } + if len(decoy.ModelDownUntil) != 0 || !decoy.DownUntil.IsZero() { + t.Errorf("worker label pool account was cooled: models=%v account-wide=%v", decoy.ModelDownUntil, decoy.DownUntil) + } + if len(recorded) != 1 || recorded[0].AccountID != realID || recorded[0].ErrorKind != accounts.KindRateLimit { + t.Errorf("recorded feedback = %+v; want one rate-limit attempt on %q", recorded, realID) + } + + // Model-local failure must not take the actual account offline. + next := routeRegressionPrepare(t, executor, PrepareInput{Request: translate.ChatRequest{Model: "qoder-cn/" + otherModel}}) + account, _, err := routeRegressionExecute(t, executor, next) + if err != nil || account != realID { + t.Errorf("different model: account=%q err=%v, want %q", account, err, realID) + } + wire.require(t, routeRegressionDispatchTo(realID, concrete, stream), routeRegressionDispatchTo(realID, otherModel, false)) + }) + } +} diff --git a/internal/executor/route_refactor_test.go b/internal/executor/route_refactor_test.go new file mode 100644 index 000000000..0421ec19d --- /dev/null +++ b/internal/executor/route_refactor_test.go @@ -0,0 +1,143 @@ +package executor + +import ( + "context" + "io" + "net/http" + "net/http/httptest" + "strings" + "sync" + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +func TestConcurrentDispatchUsesFirstAttemptWhenPreferredSlotIsTaken(t *testing.T) { + entered, release := make(chan struct{}, 1), make(chan struct{}) + a := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + entered <- struct{}{} + select { + case <-release: + case <-r.Context().Done(): + } + _, _ = io.WriteString(w, `{"choices":[{"message":{"content":"a"}}]}`) + })) + defer a.Close() + b := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if got := r.Header.Get("X-Qoder-Account"); got != "b" { + t.Errorf("worker header=%q, want actual selected account b", got) + } + _, _ = io.WriteString(w, `{"choices":[{"message":{"content":"b"}}]}`) + })) + defer b.Close() + var releaseOnce sync.Once + unblock := func() { releaseOnce.Do(func() { close(release) }) } + defer unblock() + p := NewPool([]string{a.URL, b.URL}, []string{"a", "b"}) + for _, id := range []string{"a", "b"} { + item, _ := p.ByID(id) + item.MaxInFlight = 1 + p.Upsert(item) + } + e := NewChatExecutor(p, "") + e.MaxAttempts = 1 + attempts := make(chan accounts.RequestAttempt, 2) + e.OnAttempt = func(a accounts.RequestAttempt) { attempts <- a } + req := translate.ChatRequest{Model: "shared"} + route := RouteInput{PublicModel: "shared", Prefer: "a", RequestID: "attempt-a"} + ctx, cancel := context.WithTimeout(context.Background(), 4*time.Second) + defer cancel() + first := make(chan error, 1) + go func(route RouteInput) { _, err := e.ChatNonStreamPrepared(ctx, req, route); first <- err }(route) + select { + case <-entered: + case <-ctx.Done(): + t.Fatal("the first request did not take the slot") + } + route.RequestID = "attempt-b" + result, err := e.ChatNonStreamPrepared(ctx, req, route) + if err != nil || result.PoolAccountID != "b" || result.AttemptCount != 1 { + t.Fatalf("second dispatch = %+v, %v", result, err) + } + select { + case attempt := <-attempts: + if attempt.RequestID != "attempt-b" || attempt.AccountID != "b" || attempt.AttemptIndex != 0 { + t.Fatalf("dispatch attempt = %+v, want first attempt on b", attempt) + } + default: + t.Fatal("second request did not record its single attempt") + } + amb, _ := p.ByID("a") + free, _ := p.ByID("b") + if amb.InFlight != 1 || free.InFlight != 0 || amb.LastError != "" || len(amb.ModelDownUntil) != 0 { + t.Fatalf("contention polluted accounts: a=%+v b=%+v", amb, free) + } + unblock() + if err := <-first; err != nil { + t.Fatal(err) + } +} + +func TestStreamCompletionPreservesNewerBindingAndCooldown(t *testing.T) { + for _, oldFails := range []bool{false, true} { + name := "old-success" + if oldFails { + name = "old-failure" + } + t.Run(name, func(t *testing.T) { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/event-stream") + _, _ = io.WriteString(w, `data: {"choices":[{"delta":{"content":"ok"}}]}`+"\n\n") + if oldFails == (r.Header.Get("X-Request-Id") == "older") { + _, _ = io.WriteString(w, `data: {"error":{"status":429,"message":"slow down"}}`+"\n\n") + } else { + _, _ = io.WriteString(w, "data: [DONE]\n\n") + } + })) + defer server.Close() + p := NewPool(nil, nil) + p.Upsert(Item{ID: "a", URL: server.URL, Provider: "qoder", MaxInFlight: 2, Models: []string{"model"}}) + e := NewChatExecutor(p, "") + req := translate.ChatRequest{Model: "model", Stream: true} + route := RouteInput{SessionKey: "shared-session", RouteModel: req.Model, RequestID: "older"} + older, err := e.ChatStreamProxyPrepared(t.Context(), req, nil, route) + if err != nil { + t.Fatal(err) + } + defer older.Response.Body.Close() + route.RequestID = "newer" + newer, err := e.ChatStreamProxyPrepared(t.Context(), req, nil, route) + if err != nil || newer.Routing != routingSticky { + t.Fatalf("newer stream = %+v, err=%v", newer, err) + } + defer newer.Response.Body.Close() + finish := func(result StreamResult) { + t.Helper() + body, err := io.ReadAll(result.Response.Body) + if err != nil { + t.Fatal(err) + } + for _, line := range strings.Split(string(body), "\n") { + if payload, ok := strings.CutPrefix(line, "data: "); ok && strings.Contains(payload, `"error"`) { + err = ClassifyUpstreamBody(0, payload) + break + } + } + e.FinishStream(t.Context(), result, err) + result.Response.Body.Close() + } + finish(newer) + finish(older) + account, _ := p.ByID("a") + if account.ModelDownUntil["model"].IsZero() || account.InFlight != 0 { + t.Fatalf("parallel completion lost the failure or slot: %+v", account) + } + bound, ok := e.SessionAffinity.Peek(route.SessionKey) + if ok != oldFails || (ok && bound != "a") { + t.Fatalf("binding=%q, found=%v, newer stream succeeds=%v", bound, ok, oldFails) + } + }) + } +} diff --git a/internal/executor/routing.go b/internal/executor/routing.go new file mode 100644 index 000000000..256bdb9df --- /dev/null +++ b/internal/executor/routing.go @@ -0,0 +1,387 @@ +package executor + +import ( + "context" + "fmt" + "net/http" + "strings" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +// dispatchTarget describes one reserved attempt. It is built from the exact +// account snapshot and member returned by the pool, never from response +// headers or a later view of the pool/catalog. +type dispatchTarget struct { + item Item + memberModel string + upstreamModel string + cooldownKey string + aggregateFEFO bool + // These flags describe a locked recheck of a planned session preference. + staleAffinityModel bool + widenedAffinityScope bool +} + +func targetFor(item Item, model string) dispatchTarget { + accountModel := AccountModelID(item, model) + return dispatchTarget{ + item: item, memberModel: model, upstreamModel: NativeModelID(item, accountModel), + cooldownKey: routeModel(accountModel), + } +} + +func (t dispatchTarget) request(req translate.ChatRequest) translate.ChatRequest { + req.Model = t.upstreamModel + return sanitizeChatForItem(t.item, req) +} + +func (t dispatchTarget) provider() string { return itemProvider(t.item) } + +// routeLoop holds request-local scheduling state. hard is never changed by +// affinity or by failover; working may narrow it but can only widen to hard. +type routeLoop struct { + requestID string + plan *AggregatePlan + hard RouteQuery + working RouteQuery + routing routingPlan + sticky bool + implicitRegion bool + legacyWorkerLabel string + affinityEscape string + missingBinding uint64 + attempts int + index int + lastErr error + lastTarget dispatchTarget + lastLabel string +} + +// routeScope returns only hard constraints and a provisional affinity hint. +// Even executions look up affinity read-only here: a miss at the pool must +// not mutate the session cache. Probe callers never commit the hint. +func (e ChatExecutor) routeScope(route RouteInput, model string, eligible func(Item) bool) routeLoop { + if route.RouteModel != "" { + model = route.RouteModel + } + if route.RequireModelAlias { + protocolEligible := eligible + eligible = func(item Item) bool { + return definesModelAlias(item, model) && (protocolEligible == nil || protocolEligible(item)) + } + } + provider := strings.TrimSpace(route.ProviderFilter) + if provider != "" { + provider = NormalizeProviderFamily(provider) + } + region := strings.TrimSpace(route.RegionFilter) + if region != "" { + region = NormalizeRegion(region) + } else if granted, ok := keyGrantedSingleRegion(provider, route.AllowedProviders); ok { + region = granted + } + q := e.routeQuery("", provider, region, model, route.AllowedProviders, make(map[string]struct{}), eligible, route.AggregatePlan) + if route.AggregatePlan != nil { + q.ExcludedModels = make(map[routeModelKey]struct{}) + } + l := routeLoop{requestID: route.RequestID, plan: route.AggregatePlan, hard: q, working: q, routing: routingPlan{Source: routingPool, SessionKey: strings.TrimSpace(route.SessionKey), PublicModel: model}} + if prefer := strings.TrimSpace(route.Prefer); prefer != "" { + l.routing.Source = routingPin + l.routing.SessionKey = "" + pinned, found := e.Pool.ByID(prefer) + if found && matchesRouteScope(pinned, q) && (l.plan == nil || l.plan.CanServeAccount(pinned)) { + l.working.PreferAccount = prefer + if l.plan == nil && region == "" { + l.hard.RegionFilter = itemRegion(pinned) + l.working.RegionFilter = l.hard.RegionFilter + } + } else if !found && l.plan == nil && provider == "" && region == "" && len(q.AllowedProviders) == 0 { + // Narrow compatibility for a legacy Qoder label not registered in + // the pool; never forward a known, out-of-scope account ID. + l.legacyWorkerLabel = prefer + } else if l.plan != nil { + l.routing.Source = routingPool + } + return l + } + accountID, version, ok := e.SessionAffinity.peekVersion(l.routing.SessionKey) + if !ok { + return l + } + item, found := e.Pool.ByID(accountID) + switch { + case !found: + l.affinityEscape, l.missingBinding = "account_missing", version + case q.ProviderFilter != "" && itemProvider(item) != q.ProviderFilter: + l.affinityEscape = "provider_mismatch" + case q.RegionFilter != "" && itemRegion(item) != q.RegionFilter: + l.affinityEscape = "region_mismatch" + case !accounts.ProviderRegionAllowed(itemProvider(item), itemRegion(item), q.AllowedProviders): + l.affinityEscape = "provider_not_allowed" + case eligible != nil && !eligible(item): + l.affinityEscape = "protocol_unavailable" + case l.plan != nil && !l.plan.CanServeAccount(item), l.plan == nil && !stickyAccountCanServeModel(item, model): + l.affinityEscape = "model_unavailable" + default: + l.working.PreferAccount = accountID + l.routing.Source, l.routing.BoundAccount = routingSticky, accountID + l.routing.BoundVersion = version + if l.plan == nil { + l.working.preferAffinity = true + l.working.ProviderFilter, l.working.RegionFilter = itemProvider(item), itemRegion(item) + l.sticky = l.working.ProviderFilter != l.hard.ProviderFilter || l.working.RegionFilter != l.hard.RegionFilter + } + } + return l +} + +func matchesRouteScope(item Item, q RouteQuery) bool { + return (q.ProviderFilter == "" || q.ProviderFilter == itemProvider(item)) && + (q.RegionFilter == "" || q.RegionFilter == itemRegion(item)) && + accounts.ProviderRegionAllowed(itemProvider(item), itemRegion(item), q.AllowedProviders) && + (q.Eligible == nil || q.Eligible(item)) +} + +func (e ChatExecutor) newRouteLoop(route RouteInput, model string, eligible func(Item) bool) routeLoop { + l := e.routeScope(route, model, eligible) + if l.plan == nil { + l.attempts = e.attemptsFor(l.hard.ProviderFilter, l.hard.RegionFilter, l.hard.PublicModel, l.hard.AllowedProviders, l.hard.Eligible) + } else if !l.plan.AllowFallbacks || l.plan.MaxAttempts < 1 { + l.attempts = 1 + } else { + l.attempts = l.plan.MaxAttempts + } + return l +} + +// pickNextReserved is the sole commit point for an attempt. A saturated +// candidate is never picked, and a cooldown hint is never given a slot. +func (l *routeLoop) pickNextReserved(e ChatExecutor) (dispatchTarget, int, error) { + var hardScope *RouteQuery + if l.index == 0 && l.sticky && l.working.preferAffinity { + hardScope = &l.hard + } + target, err := e.reserveTargetWithFallback(l.requestID, l.working, l.plan, hardScope) + // A bare cross-provider request can leave its sticky scope after a real + // upstream failure. A provider-scoped route keeps the usual region pin + // on upstream failure. The pool has already handled a stale model; a + // pre-dispatch capacity miss may also drop a valid but contended pin. + if err != nil && l.sticky && ((l.index == 0 && !target.staleAffinityModel && capacityError(err)) || (l.index > 0 && l.hard.ProviderFilter == "")) { + // Try the wider, authorized route directly rather than check capacity + // in a different snapshot. Commit the escape only if it took a slot. + if alternate, wideErr := e.reserveTarget(l.requestID, l.hard, l.plan); wideErr == nil { + if l.index == 0 { + l.routing.Source = routingPool + l.affinityEscape = "concurrency_saturated" + } + l.working, l.sticky = l.hard, false + target, err = alternate, nil + } + } + if err != nil { + return dispatchTarget{}, l.index, err + } + if target.widenedAffinityScope { + l.working, l.sticky = l.hard, false + } + if target.staleAffinityModel && target.item.ID != l.routing.BoundAccount { + l.routing.Source = routingStickyEscape + l.affinityEscape = "model_unavailable" + } + if l.index == 0 && l.routing.SessionKey != "" && e.SessionAffinity != nil { + e.SessionAffinity.Get(l.routing.SessionKey) // commit hit/miss and LRU only after reservation + if l.affinityEscape != "" { + e.SessionAffinity.RecordEscape(l.affinityEscape) + } + if l.missingBinding != 0 { + e.SessionAffinity.forgetVersion(l.routing.SessionKey, l.missingBinding) + } + } + e.observeRouting(&l.routing, target.item.ID) + l.working.PreferAccount = "" + l.working.preferAffinity = false + if l.plan == nil && l.working.RegionFilter == "" { + l.working.RegionFilter = itemRegion(target.item) + l.implicitRegion = true + } + index := l.index + l.index++ + if e.OnInFlightAcquire != nil && l.requestID != "" { + e.OnInFlightAcquire(l.requestID, target.item.ID) + } + return target, index, nil +} + +func (l *routeLoop) failover(e ChatExecutor, target dispatchTarget, label string, classified Classified, err error) bool { + l.lastTarget, l.lastLabel, l.lastErr = target, label, err + if !classified.Failover { + return false + } + if l.plan != nil { + l.hard.ExcludedModels[accountRouteModelKey(target.item, target.memberModel)] = struct{}{} + } else { + l.hard.Excluded[target.item.ID] = struct{}{} + if l.implicitRegion && l.hard.ProviderFilter == "" { + l.working.RegionFilter = l.hard.RegionFilter + l.implicitRegion = false + } + } + if target.item.ID == l.routing.BoundAccount { + e.SessionAffinity.forgetVersion(l.routing.SessionKey, l.routing.BoundVersion) + } + return l.index < l.attempts +} + +func (l routeLoop) headerAccount(target dispatchTarget, attempt int) string { + if attempt == 0 && l.legacyWorkerLabel != "" && target.provider() == "qoder" { + return l.legacyWorkerLabel + } + return target.item.ID +} + +func (l routeLoop) chatError(err error) (ChatResult, error) { + if l.lastErr != nil { + return ChatResult{AttemptCount: l.index, AccountID: l.lastLabel, PoolAccountID: l.lastTarget.item.ID, Provider: l.lastTarget.provider(), CooldownModel: l.lastTarget.cooldownKey, AggregateFEFO: l.lastTarget.aggregateFEFO}, l.lastErr + } + return ChatResult{}, err +} + +func (l routeLoop) streamError(err error) (StreamResult, error) { + if l.lastErr != nil { + return StreamResult{AttemptCount: l.index, AccountID: l.lastLabel, PoolAccountID: l.lastTarget.item.ID, Provider: l.lastTarget.provider(), CooldownModel: l.lastTarget.cooldownKey, AggregateFEFO: l.lastTarget.aggregateFEFO}, l.lastErr + } + return StreamResult{}, err +} + +func (e ChatExecutor) nativeResponsesEligible(item Item) bool { + adapter, ok := e.Providers.Get(itemProvider(item)) + return ok && adapter.NativeResponses != nil +} + +func (e ChatExecutor) HasNativeResponsesRoute(ctx context.Context, req translate.ChatRequest, prefer, providerFilter string) bool { + return e.HasNativeResponsesRoutePrepared(ctx, req, routeInputFromContext(ctx, req, prefer, providerFilter)) +} + +// HasNativeResponsesRoutePrepared is a capability probe, not a dispatch +// attempt. Temporarily busy or cooling accounts still advertise capability. +func (e ChatExecutor) HasNativeResponsesRoutePrepared(_ context.Context, req translate.ChatRequest, route RouteInput) bool { + if e.Pool == nil || e.Providers == nil { + return false + } + l := e.routeScope(route, req.Model, e.nativeResponsesEligible) + if l.plan != nil { + return e.Pool.HasAggregateRoute(l.plan, l.hard) + } + return e.Pool.HasRoute(l.hard) +} + +// dispatchContext carries only adapter/logging metadata. Routing decisions +// consume RouteInput directly, not values written back onto the context. +func dispatchContext(ctx context.Context, route RouteInput) context.Context { + if ctx == nil { + ctx = context.Background() + } + return WithConversation(context.WithValue(ctx, requestIDKey{}, route.RequestID), route.SessionKey) +} + +func capacityPickError() error { + return NewExecutionError(Classified{ + Kind: accounts.KindRateLimit, Status: http.StatusTooManyRequests, Code: "rate_limit", + Type: "api_error", Message: "all accounts at capacity", + Cooldown: 5 * time.Second, RetryAfter: 5 * time.Second, Failover: true, + }, nil) +} + +func (e ChatExecutor) reserveTarget(requestID string, query RouteQuery, plan *AggregatePlan) (dispatchTarget, error) { + return e.reserveTargetWithFallback(requestID, query, plan, nil) +} + +func (e ChatExecutor) reserveTargetWithFallback(requestID string, query RouteQuery, plan *AggregatePlan, hardScope *RouteQuery) (dispatchTarget, error) { + if e.Pool != nil { + if plan != nil { + pick := e.Pool.selectAggregate(plan, query, true) + switch { + case pick.Available: + target := targetFor(pick.Item, pick.Member.Model) + target.aggregateFEFO = pick.FEFO + return target, nil + case pick.Item.ID != "": + return dispatchTarget{}, coolingPickError(pick.Item, query.PublicModel, cooldownModel(pick.Item, pick.Member.Model), pick.RetryAfter) + case pick.Saturated: + return dispatchTarget{}, capacityPickError() + case pick.QuotaBlocked: + return dispatchTarget{}, quotaPickError(query.PublicModel) + case pick.Scoped && !pick.HasRoute && routeModel(query.PublicModel) != "": + return dispatchTarget{}, e.modelPickError(requestID, query) + } + } else { + pick := e.Pool.selectRoute(query, true, hardScope) + if pick.reserved { + target := targetFor(pick.item, query.PublicModel) + target.staleAffinityModel, target.widenedAffinityScope = pick.staleAffinityModel, pick.widened + return target, nil + } + if pick.found { + retryAfter := max(e.Pool.RetryAfter(pick.item, query.PublicModel), time.Millisecond) + return dispatchTarget{}, coolingPickError(pick.item, query.PublicModel, cooldownModel(pick.item, query.PublicModel), retryAfter) + } + if pick.saturated { + return dispatchTarget{staleAffinityModel: pick.staleAffinityModel}, capacityPickError() + } + if _, ok := e.Pool.QuotaBlockedForModel(query); ok { + return dispatchTarget{}, quotaPickError(query.PublicModel) + } + if routeModel(query.PublicModel) != "" { + unfiltered := query + unfiltered.PublicModel = "" + if e.Pool.LenRoute(unfiltered) > 0 { + return dispatchTarget{}, e.modelPickError(requestID, query) + } + } + } + } + provider, region, allowed := query.ProviderFilter, query.RegionFilter, query.AllowedProviders + if len(allowed) > 0 && provider != "" && !accounts.ProviderAllowed(provider, allowed) { + return dispatchTarget{}, NewExecutionError(Classified{ + Kind: accounts.KindAuth, Status: http.StatusForbidden, Code: "provider_not_allowed", + Type: "permission_error", Message: fmt.Sprintf("api key cannot use provider %s", provider), + }, nil) + } + if provider != "" { + if region == "" { + region, _ = keyGrantedSingleRegion(provider, allowed) + } + if region != "" { + return dispatchTarget{}, noAccountsError(fmt.Sprintf("no %s/%s accounts available", provider, region)) + } + return dispatchTarget{}, noAccountsError(fmt.Sprintf("no %s accounts available", provider)) + } + if len(allowed) > 0 { + return dispatchTarget{}, noAccountsError("no accounts available for this api key") + } + return dispatchTarget{}, NewExecutionError(Classified{ + Kind: accounts.KindUnavailable, Status: http.StatusServiceUnavailable, + Code: "no_accounts_configured", Type: "api_error", Message: "no worker accounts configured", + }, nil) +} + +func quotaPickError(model string) error { + retryAfter := NextLocalMidnightCooldown() + return NewExecutionError(Classified{ + Kind: accounts.KindQuota, Status: http.StatusTooManyRequests, Code: "insufficient_quota", + Type: "insufficient_quota", Cooldown: retryAfter, RetryAfter: retryAfter, + Message: quotaBlockedMessage(model), + }, nil) +} + +func (e ChatExecutor) modelPickError(requestID string, query RouteQuery) error { + e.logModelRouteMiss(requestID, query) + return NewExecutionError(Classified{ + Kind: accounts.KindModelNotAvailable, Status: http.StatusBadRequest, + Code: "model_not_available", Type: "invalid_request_error", + Message: fmt.Sprintf("model_not_available: %s is not available for the selected accounts", query.PublicModel), + }, nil) +} diff --git a/internal/executor/session_affinity.go b/internal/executor/session_affinity.go index a4152b382..d268e1412 100644 --- a/internal/executor/session_affinity.go +++ b/internal/executor/session_affinity.go @@ -53,6 +53,7 @@ func resolveSessionKey(ctx context.Context, req translate.ChatRequest) string { type sessionBinding struct { key string accountID string + version uint64 expiresAt time.Time } @@ -78,6 +79,7 @@ type SessionAffinity struct { capacity int entries map[string]*list.Element lru *list.List + version uint64 hits uint64 misses uint64 escapes uint64 @@ -102,6 +104,32 @@ func NewSessionAffinity(ttl time.Duration, capacity int) *SessionAffinity { } } +// Peek reads a live binding without changing the LRU, statistics or entries. +// In particular, a capability probe does not delete an expired binding. +func (a *SessionAffinity) Peek(key string) (string, bool) { + accountID, _, ok := a.peekVersion(key) + return accountID, ok +} + +// peekVersion returns the token for the exact binding observed by a route. +func (a *SessionAffinity) peekVersion(key string) (string, uint64, bool) { + key = strings.TrimSpace(key) + if a == nil || key == "" { + return "", 0, false + } + a.mu.Lock() + defer a.mu.Unlock() + element, ok := a.entries[key] + if !ok { + return "", 0, false + } + binding := element.Value.(sessionBinding) + if !binding.expiresAt.After(time.Now()) { + return "", 0, false + } + return binding.accountID, binding.version, true +} + func (a *SessionAffinity) Get(key string) (string, bool) { if a == nil { return "", false @@ -131,30 +159,60 @@ func (a *SessionAffinity) Get(key string) (string, bool) { } func (a *SessionAffinity) Bind(key, accountID string) { - if a == nil { - return - } - key = strings.TrimSpace(key) - accountID = strings.TrimSpace(accountID) - if key == "" || accountID == "" { - return + a.bindVersion(key, accountID) +} + +// bindVersion identifies this write, even if the account has not changed. +func (a *SessionAffinity) bindVersion(key, accountID string) uint64 { + key, accountID = strings.TrimSpace(key), strings.TrimSpace(accountID) + if a == nil || key == "" || accountID == "" { + return 0 } a.mu.Lock() defer a.mu.Unlock() + a.version++ + if a.version == 0 { // Reserve zero for a missing binding. + a.version++ + } + binding := sessionBinding{key: key, accountID: accountID, version: a.version, expiresAt: time.Now().Add(a.ttl)} if element, ok := a.entries[key]; ok { previous := element.Value.(sessionBinding) if previous.accountID != accountID { a.rebindings++ } - element.Value = sessionBinding{key: key, accountID: accountID, expiresAt: time.Now().Add(a.ttl)} + element.Value = binding a.lru.MoveToFront(element) - return + return binding.version } - element := a.lru.PushFront(sessionBinding{key: key, accountID: accountID, expiresAt: time.Now().Add(a.ttl)}) + element := a.lru.PushFront(binding) a.entries[key] = element for a.lru.Len() > a.capacity { a.remove(a.lru.Back()) } + return binding.version +} + +// touchVersion extends only a live, unchanged binding. +func (a *SessionAffinity) touchVersion(key string, version uint64) bool { + key = strings.TrimSpace(key) + if a == nil || key == "" || version == 0 { + return false + } + a.mu.Lock() + defer a.mu.Unlock() + element, ok := a.entries[key] + if !ok { + return false + } + binding := element.Value.(sessionBinding) + now := time.Now() + if binding.version != version || !binding.expiresAt.After(now) { + return false + } + binding.expiresAt = now.Add(a.ttl) + element.Value = binding + a.lru.MoveToFront(element) + return true } func (a *SessionAffinity) RecordEscape(reason string) { @@ -202,6 +260,22 @@ func (a *SessionAffinity) Forget(key string) { } } +// forgetVersion cannot remove a newer binding, even on the same account. +func (a *SessionAffinity) forgetVersion(key string, version uint64) bool { + key = strings.TrimSpace(key) + if a == nil || key == "" || version == 0 { + return false + } + a.mu.Lock() + defer a.mu.Unlock() + element, ok := a.entries[key] + if !ok || element.Value.(sessionBinding).version != version { + return false + } + a.remove(element) + return true +} + func (a *SessionAffinity) remove(element *list.Element) { if element == nil { return diff --git a/internal/executor/session_affinity_test.go b/internal/executor/session_affinity_test.go index fa17685a6..5442139b8 100644 --- a/internal/executor/session_affinity_test.go +++ b/internal/executor/session_affinity_test.go @@ -52,6 +52,105 @@ func TestSessionAffinityStatsTrackRoutingEvents(t *testing.T) { } } +func TestSessionAffinityPeekDoesNotMutateCache(t *testing.T) { + affinity := NewSessionAffinity(time.Minute, 2) + affinity.Bind("one", "a") + affinity.Bind("two", "b") + before := affinity.Stats() + if id, ok := affinity.Peek(" one "); !ok || id != "a" { + t.Fatalf("peek hit = %q, %v", id, ok) + } + if id, ok := affinity.Peek("missing"); ok || id != "" { + t.Fatalf("peek miss = %q, %v", id, ok) + } + if after := affinity.Stats(); before != after { + t.Fatalf("peeks changed stats: before=%+v after=%+v", before, after) + } + affinity.Bind("three", "c") + if _, ok := affinity.Peek("one"); ok { + t.Fatal("peek changed LRU order") + } + + setAffinityExpiry(affinity, "two", time.Now().Add(-time.Minute)) + before = affinity.Stats() + if id, ok := affinity.Peek("two"); ok || id != "" { + t.Fatalf("peek expired = %q, %v", id, ok) + } + if after := affinity.Stats(); before != after { + t.Fatalf("expired peek changed cache: before=%+v after=%+v", before, after) + } + if _, ok := affinity.Get("two"); ok || affinity.Stats().LastMissReason != "expired" { + t.Fatal("real lookup must still observe and remove the expired entry") + } +} + +func TestSessionAffinityVersionDistinguishesSameAccountRebind(t *testing.T) { + affinity := NewSessionAffinity(time.Hour, 2) + old := affinity.bindVersion("session", "account") + // A newer request can legitimately choose the same account. Its binding + // is independent of the older stream's eventual success or failure. + affinity.Bind("session", "account") + id, current, ok := affinity.peekVersion("session") + if !ok || id != "account" || old == 0 || current == 0 || current == old { + t.Fatalf("same-account rebind: id=%q old=%d current=%d ok=%v", id, old, current, ok) + } + before := affinity.Stats() + if affinity.touchVersion("session", old) || affinity.forgetVersion("session", old) || affinity.touchVersion("missing", current) { + t.Fatal("late feedback changed a newer binding to the same account") + } + if _, version, ok := affinity.peekVersion("session"); !ok || version != current || affinity.Stats() != before { + t.Fatalf("new binding or statistics changed: version=%d ok=%v stats=%+v", version, ok, affinity.Stats()) + } + expires := time.Now().Add(time.Minute) + setAffinityExpiry(affinity, "session", expires) + affinity.Bind("other", "account") + if !affinity.touchVersion("session", current) { + t.Fatal("current binding was not renewed") + } + affinity.mu.Lock() + renewed := affinity.entries["session"].Value.(sessionBinding).expiresAt + affinity.mu.Unlock() + if !renewed.After(expires) { + t.Fatalf("touch did not extend TTL: before=%v after=%v", expires, renewed) + } + if _, version, ok := affinity.peekVersion("session"); !ok || version != current { + t.Fatalf("renewal replaced version: %d ok=%v", version, ok) + } + affinity.Bind("new", "account") + if _, _, ok := affinity.peekVersion("other"); ok { + t.Fatal("versioned touch did not update LRU") + } + if !affinity.forgetVersion("session", current) || affinity.forgetVersion("session", current) { + t.Fatal("current version should be removed exactly once") + } +} + +func TestSessionAffinityVersionIsNotReusedAfterEviction(t *testing.T) { + affinity := NewSessionAffinity(time.Hour, 1) + old := affinity.bindVersion("session", "account") + affinity.Bind("evicts-session", "account") + current := affinity.bindVersion("session", "account") + if current == old || affinity.touchVersion("session", old) || affinity.forgetVersion("session", old) { + t.Fatal("recreated binding used an old version") + } + setAffinityExpiry(affinity, "session", time.Now().Add(-time.Minute)) + if affinity.touchVersion("session", current) { + t.Fatal("touch revived an expired binding") + } + if _, version, ok := affinity.peekVersion("session"); ok || version != 0 { + t.Fatalf("expired binding still visible: version=%d ok=%v", version, ok) + } +} + +func setAffinityExpiry(affinity *SessionAffinity, key string, expiry time.Time) { + affinity.mu.Lock() + defer affinity.mu.Unlock() + element := affinity.entries[key] + binding := element.Value.(sessionBinding) + binding.expiresAt = expiry + element.Value = binding +} + // Cache affinity is account/session scoped, not a global region latch. A // bound conversation must stay on its account even when the route spans // providers and ordinary round-robin would pick another one first. diff --git a/internal/executor/session_key_test.go b/internal/executor/session_key_test.go index 13d85a255..fedb80ee3 100644 --- a/internal/executor/session_key_test.go +++ b/internal/executor/session_key_test.go @@ -61,7 +61,7 @@ func TestPrepareUsesConversationID(t *testing.T) { if err != nil { t.Fatal(err) } - if sessionKeyFromContext(plain.Context) == sessionKeyFromContext(withID.Context) { + if plain.Route.SessionKey == withID.Route.SessionKey { t.Fatal("conversation id must change the affinity key") } if providers.ConversationFromContext(withID.Context) == "" { @@ -100,7 +100,7 @@ func TestMessageStatShardsEnvAndFallback(t *testing.T) { t.Fatal(err) } contentKey := sessionKeyFor("", "", auth.ConsoleIdentity(), req) - if got := sessionKeyFromContext(prepared.Context); got != contentKey || got == a { + if got := prepared.Route.SessionKey; got != contentKey || got == a { t.Fatalf("shard replaced content seed: got %q seed %q shard %q", got, contentKey, a) } // No user anchor and no conversation id: the shard key is the only affinity. @@ -112,7 +112,7 @@ func TestMessageStatShardsEnvAndFallback(t *testing.T) { t.Fatal(err) } wantShard := ShardFallbackKey(auth.ConsoleIdentity(), anchorless) - if got := sessionKeyFromContext(fallback.Context); got == "" || got != wantShard { + if got := fallback.Route.SessionKey; got == "" || got != wantShard { t.Fatalf("anchorless request did not use shard: got %q want %q", got, wantShard) } t.Setenv("CLI2API_MSGSTAT_SHARDS", "bad") diff --git a/internal/executor/sticky_model_rejection_test.go b/internal/executor/sticky_model_rejection_test.go new file mode 100644 index 000000000..171fe8026 --- /dev/null +++ b/internal/executor/sticky_model_rejection_test.go @@ -0,0 +1,227 @@ +package executor + +import ( + "errors" + "net/http" + "sync/atomic" + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/auth" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +func TestStickyModelRejectionEscapesToHealthyAccount(t *testing.T) { + for _, tc := range []struct { + name string + stream bool + }{ + {"chat", false}, + {"stream", true}, + } { + t.Run(tc.name, func(t *testing.T) { + const model, alias = "model-a", "public-alias" + const public = "qoder-cn/" + alias + pool := NewPool(nil, nil) + wire := &routeRegressionWire{} + var reject atomic.Bool + aliases := map[string]string{alias: model} + wire.add(t, pool, Item{ID: "a", Provider: "qoder", Region: "cn", ModelAliases: aliases}, func(w http.ResponseWriter, hit routeRegressionHit) { + if reject.Load() { + w.Header().Set("X-Qoder-Error-Kind", accounts.KindModelNotAvailable) + http.Error(w, `{"error":{"message":"model does not exist"}}`, http.StatusBadRequest) + return + } + routeRegressionOK(w, hit) + }) + wire.add(t, pool, Item{ID: "b", Provider: "qoder", Region: "cn", Models: []string{model}, ModelAliases: aliases}, nil) + wire.add(t, pool, Item{ID: "0-out-of-region", Provider: "qoder", Region: "global", Models: []string{model}, ModelAliases: aliases}, nil) + e := NewChatExecutor(pool, "") + identity := auth.Identity{Kind: auth.KindKey, KeyID: "sticky-test", AllowedProviders: []string{"qoder:cn"}} + + routeRegressionSeedBinding(t, e, public, identity, "a") + reject.Store(true) + // A pin bypasses affinity, so this rejection does not update the old session. + rejection := routeRegressionPrepare(t, e, PrepareInput{Request: translate.ChatRequest{Model: public}, Identity: identity, PreferAccount: "a"}) + if account, attempts, err := routeRegressionExecute(t, e, rejection); err != nil || account != "b" || attempts != 2 { + t.Fatalf("rejection and fallback: account=%q attempts=%d err=%v", account, attempts, err) + } + item, _ := pool.ByID("a") + if item.Models != nil || len(item.ProvenModels) != 0 || ItemCouldServeModel(item, alias) { + t.Fatal("expected the explicit rejection of the last proven model on an unknown catalog") + } + + follow := routeRegressionPrepare(t, e, PrepareInput{Request: translate.ChatRequest{Model: public, Stream: tc.stream}, Identity: identity}) + if account, attempts, err := routeRegressionExecute(t, e, follow); err != nil || account != "b" || attempts != 1 { + t.Fatalf("old session: account=%q attempts=%d err=%v, want b in one attempt", account, attempts, err) + } + if account, ok := e.SessionAffinity.Get(follow.Route.SessionKey); !ok || account != "b" { + t.Fatalf("session was not rebound: account=%q bound=%v", account, ok) + } + wire.require(t, + routeRegressionDispatchTo("a", model, false), routeRegressionDispatchTo("a", model, false), + routeRegressionDispatchTo("b", model, false), routeRegressionDispatchTo("b", model, tc.stream), + ) + }) + } +} + +func TestStickyModelRejectionBetweenScopeAndReserve(t *testing.T) { + const model = "model-a" + pool := NewPool(nil, nil) + for _, item := range []Item{ + {ID: "a", Provider: "qoder", Region: "cn"}, + {ID: "b", Provider: "qoder", Region: "cn"}, + {ID: "0-other-region", Provider: "qoder", Region: "global"}, + {ID: "0-other-provider", Provider: "workbuddy", Region: "cn"}, + } { + item.Models = []string{model} + item.MaxInFlight = 1 + pool.Upsert(item) + } + e := NewChatExecutor(pool, "") + e.SessionAffinity.Bind("old-session", "a") + route := RouteInput{ + RouteModel: model, SessionKey: "old-session", + ProviderFilter: "qoder", RegionFilter: "cn", AllowedProviders: []string{"qoder:cn"}, + } + sticky := e.newRouteLoop(route, model, nil) + route.Prefer = "a" + explicit := e.newRouteLoop(route, model, nil) + if sticky.routing.Source != routingSticky || sticky.working.PreferAccount != "a" || explicit.working.PreferAccount != "a" { + t.Fatal("both routes must see the original model before the pool changes") + } + + // Place the rejection deterministically between the two snapshots. + pool.RemoveModel("a", model) + if target, _, err := explicit.pickNextReserved(e); target.item.ID != "" || explicit.index != 0 { + pool.Release(target.item.ID) + t.Fatalf("explicit model pin changed: picked %q after %d attempts (err=%v)", target.item.ID, explicit.index, err) + } else { + var execErr *ExecutionError + if !errors.As(err, &execErr) || execErr.Classified.Code != "model_not_available" { + t.Fatalf("explicit model pin error=%v, want model_not_available", err) + } + } + target, index, err := sticky.pickNextReserved(e) + defer pool.Release(target.item.ID) + if err != nil || target.item.ID != "b" || target.upstreamModel != model || index != 0 || sticky.index != 1 { + t.Fatalf("soft recheck: account=%q model=%q index=%d attempts=%d err=%v, want b in one attempt", target.item.ID, target.upstreamModel, index, sticky.index, err) + } + if sticky.routing.Source != routingStickyEscape || target.item.InFlight != 1 { + t.Fatalf("soft recheck: routing=%q in-flight=%d", sticky.routing.Source, target.item.InFlight) + } +} + +func TestStickyModelRejectionPrefersSoftThenHardScope(t *testing.T) { + const model = "model-a" + for _, tc := range []struct { + name string + route RouteInput + healthy Item + others []Item + wantSoft bool + }{ + { + name: "healthy-soft-scope-first", + route: RouteInput{RegionFilter: "cn", AllowedProviders: []string{"qoder:cn", "workbuddy:cn"}}, + healthy: Item{ID: "b", Provider: "qoder", Region: "cn"}, + others: []Item{{ID: "0-healthy-in-hard-scope", Provider: "workbuddy", Region: "cn"}}, + wantSoft: true, + }, + { + name: "hard-provider", + route: RouteInput{ProviderFilter: "qoder", AllowedProviders: []string{"qoder", "workbuddy:cn"}}, + healthy: Item{ID: "b", Provider: "qoder", Region: "global"}, + others: []Item{{ID: "0-outside-provider", Provider: "workbuddy", Region: "cn"}}, + }, + { + name: "hard-region-and-key", + route: RouteInput{RegionFilter: "cn", AllowedProviders: []string{"qoder:cn", "workbuddy"}}, + healthy: Item{ID: "b", Provider: "workbuddy", Region: "cn"}, + others: []Item{ + {ID: "0-outside-region", Provider: "workbuddy", Region: "global"}, + {ID: "0-outside-key", Provider: "trae", Region: "cn"}, + }, + }, + } { + t.Run(tc.name, func(t *testing.T) { + pool := NewPool(nil, nil) + items := append([]Item{ + {ID: "a", Provider: "qoder", Region: "cn"}, + {ID: "a-cooling", Provider: "qoder", Region: "cn", DownUntil: time.Now().Add(time.Hour)}, + tc.healthy, + }, tc.others...) + for _, item := range items { + item.Models = []string{model} + pool.Upsert(item) + } + e := NewChatExecutor(pool, "") + e.SessionAffinity.Bind("old-session", "a") + route := tc.route + route.RouteModel = model + route.SessionKey = "old-session" + loop := e.newRouteLoop(route, model, nil) + if !loop.sticky || loop.working.PreferAccount != "a" { + t.Fatal("expected to start with a narrower session preference") + } + softKey, hardKey := rotationKey(loop.working), rotationKey(loop.hard) + pool.RemoveModel("a", model) + + target, index, err := loop.pickNextReserved(e) + defer pool.Release(target.item.ID) + if err != nil || target.item.ID != tc.healthy.ID || index != 0 || loop.index != 1 { + t.Fatalf("fallback: target=%q index=%d attempts=%d err=%v, want b in one attempt", target.item.ID, index, loop.index, err) + } + if loop.sticky != tc.wantSoft || loop.routing.Source != routingStickyEscape { + t.Fatalf("fallback: kept soft scope=%v, want %v; routing=%q", loop.sticky, tc.wantSoft, loop.routing.Source) + } + winningKey, unusedKey := hardKey, softKey + if tc.wantSoft { + winningKey, unusedKey = softKey, hardKey + } + if pool.lastPicked[unusedKey] != "" || pool.lastPicked[winningKey] != tc.healthy.ID || len(pool.lastPicked) != 1 { + t.Fatalf("fallback must commit only the winning rotation: %v", pool.lastPicked) + } + for _, item := range pool.Items() { + want := 0 + if item.ID == tc.healthy.ID { + want = 1 + } + if item.InFlight != want { + t.Errorf("%s owns %d slots; want %d", item.ID, item.InFlight, want) + } + } + }) + } +} + +func TestStickyModelRejectionRechecksAliasEligibility(t *testing.T) { + const model, alias = "model-a", "public-alias" + pool := NewPool(nil, nil) + for _, item := range []Item{ + {ID: "a", Provider: "qoder", Region: "cn", Models: []string{alias, model}, ModelAliases: map[string]string{alias: model}}, + {ID: "b", Provider: "workbuddy", Region: "cn", Models: []string{model}, ModelAliases: map[string]string{alias: model}}, + {ID: "0-raw-model", Provider: "workbuddy", Region: "cn", Models: []string{alias}}, + } { + pool.Upsert(item) + } + e := NewChatExecutor(pool, "") + e.SessionAffinity.Bind("old-session", "a") + loop := e.newRouteLoop(RouteInput{ + RouteModel: alias, RegionFilter: "cn", SessionKey: "old-session", RequireModelAlias: true, + AllowedProviders: []string{"qoder:cn", "workbuddy:cn"}, + }, alias, nil) + if !loop.sticky || loop.working.PreferAccount != "a" { + t.Fatal("expected initial alias preference") + } + // A still advertises the equally named raw model. Neither it nor the + // equally named raw model on another provider can serve an alias-only key. + pool.SetModelRouting("a", nil, nil, false) + target, _, err := loop.pickNextReserved(e) + defer pool.Release(target.item.ID) + if err != nil || target.item.ID != "b" || target.upstreamModel != model || loop.index != 1 { + t.Fatalf("alias fallback: target=%q model=%q attempts=%d err=%v, want b/%s in one attempt", target.item.ID, target.upstreamModel, loop.index, err, model) + } +} diff --git a/internal/gateway/anthropic.go b/internal/gateway/anthropic.go index 4af2932d1..06d492fea 100644 --- a/internal/gateway/anthropic.go +++ b/internal/gateway/anthropic.go @@ -61,23 +61,20 @@ func (h *Handler) HandleAnthropicMessages(w http.ResponseWriter, r *http.Request writeAnthropicError(w, http.StatusBadRequest, "invalid_request_error", err.Error()) return } - execution, err := h.PrepareCompatibilityExecution(r, request) + reserveKey, releaseKey := h.keySlotHooks(r) + defer releaseKey() + execution, err := h.prepareCompatibilityExecution(r, request, reserveKey) if err != nil { writeAnthropicCompatibilityError(w, err) return } - releaseKey, ok := h.reserveKeySlot(r) - if !ok { - writeAnthropicKeyConcurrencyLimited(w) - return - } - defer releaseKey() w.Header().Set("X-Request-Id", execution.RequestID) if execution.Request.Stream { h.handleAnthropicMessagesStream(w, r, execution) return } - result, err := h.Executor.ChatNonStream(execution.Context, execution.Request, execution.Prefer, execution.ProviderFilter) + result, err := h.Executor.ChatNonStreamPrepared(execution.Context, execution.Request, execution.Route) + defer h.refreshQuotaAfterUse(result.PoolAccountID, result.CooldownModel, result.AggregateFEFO) if err != nil { h.finishCompatibility(execution, result.AccountID, result.Provider, result.Routing, accounts.RequestStatusError, 0, nil, err, result.AttemptCount, result.ReasoningLevel) writeAnthropicCompatibilityError(w, err) @@ -93,7 +90,8 @@ func (h *Handler) HandleAnthropicMessages(w http.ResponseWriter, r *http.Request } func (h *Handler) handleAnthropicMessagesStream(w http.ResponseWriter, r *http.Request, execution Execution) { - upstream, err := h.Executor.ChatStreamProxy(execution.Context, execution.Request, execution.Prefer, execution.ProviderFilter) + upstream, err := h.Executor.ChatStreamProxyPrepared(execution.Context, execution.Request, nil, execution.Route) + defer h.refreshQuotaAfterUse(upstream.PoolAccountID, upstream.CooldownModel, upstream.AggregateFEFO) if err != nil { h.finishCompatibility(execution, upstream.AccountID, upstream.Provider, upstream.Routing, accounts.RequestStatusError, upstream.TTFBMs, nil, err, upstream.AttemptCount, upstream.ReasoningLevel) writeAnthropicCompatibilityError(w, err) @@ -119,17 +117,17 @@ func (h *Handler) handleAnthropicMessagesStream(w http.ResponseWriter, r *http.R logErr = nil } h.finishCompatibility(execution, upstream.AccountID, upstream.Provider, upstream.Routing, status, ttfb, &stats, logErr, upstream.AttemptCount, upstream.ReasoningLevel) - if relayErr == nil { - h.Executor.CommitSession(execution.Context, execution.Request, upstream.Routing, firstNonEmpty(upstream.PoolAccountID, upstream.AccountID)) - return - } - if !IsStreamClientDisconnect(relayErr) { + h.finishRelayedStream(execution.Context, upstream, relayErr) + if relayErr != nil && !IsStreamClientDisconnect(relayErr) { _ = writeAnthropicStreamError(writer, relayErr) } - h.observeCompatibilityStreamFailure(r, execution, upstream, relayErr) } func writeAnthropicCompatibilityError(w http.ResponseWriter, err error) { + if errors.Is(err, errKeyConcurrencyLimited) { + writeAnthropicKeyConcurrencyLimited(w) + return + } var requestErr *chatHTTPError if errors.As(err, &requestErr) { writeAnthropicError(w, requestErr.Status, "invalid_request_error", requestErr.Message) diff --git a/internal/gateway/compat.go b/internal/gateway/compat.go index c0a75d7fc..1efcc9daa 100644 --- a/internal/gateway/compat.go +++ b/internal/gateway/compat.go @@ -95,10 +95,14 @@ func normalizeProxyToolCallArguments(calls []proxyToolCall) bool { } func (h *Handler) PrepareCompatibilityExecution(r *http.Request, request translate.ChatRequest) (Execution, error) { + return h.prepareCompatibilityExecution(r, request, nil) +} + +func (h *Handler) prepareCompatibilityExecution(r *http.Request, request translate.ChatRequest, beforeSideEffects func() error) (Execution, error) { if len(request.Messages) == 0 { return Execution{}, &chatHTTPError{Status: http.StatusBadRequest, Code: "invalid_request", Message: "input messages required"} } - return h.PrepareChatExecution(r, request) + return h.prepareExecution(r, request, nil, beforeSideEffects) } func (h *Handler) finishCompatibility(execution Execution, accountID, provider, routing, status string, ttfb int, stats *StreamRelayStats, err error, attempts int, resolvedReasoning string) { diff --git a/internal/gateway/compat_stream.go b/internal/gateway/compat_stream.go index 8fd5a2710..b8cc789ef 100644 --- a/internal/gateway/compat_stream.go +++ b/internal/gateway/compat_stream.go @@ -18,10 +18,13 @@ import ( "github.com/caigee-cmd/cli2api/internal/translate" ) -func (h *Handler) observeCompatibilityStreamFailure(r *http.Request, execution Execution, upstream executor.StreamResult, relayErr error) { - if r.Context().Err() == nil && !errors.Is(relayErr, context.Canceled) && !errors.Is(relayErr, context.DeadlineExceeded) && !IsStreamClientDisconnect(relayErr) { - h.Executor.ObserveStreamFailure(firstNonEmpty(upstream.PoolAccountID, upstream.AccountID), relayErr, execution.Request.Model) +func (h *Handler) finishRelayedStream(ctx context.Context, upstream executor.StreamResult, relayErr error) { + // A downstream write failure cancels the attempt; it says nothing about + // the selected account. The executor owns the target for upstream outcomes. + if IsStreamClientDisconnect(relayErr) { + relayErr = context.Canceled } + h.Executor.FinishStream(ctx, upstream, relayErr) } func setCompatibilityStreamHeaders(w http.ResponseWriter, accountID, provider string) { @@ -289,7 +292,6 @@ func consumeOpenAIStream(body io.Reader, handle func(json.RawMessage, *streamedC scanner := bufio.NewScanner(body) scanner.Buffer(make([]byte, 0, 64*1024), maxSSELineSize) var frame []string - sawDone := false flush := func() error { if len(frame) == 0 { return nil @@ -300,7 +302,7 @@ func consumeOpenAIStream(body io.Reader, handle func(json.RawMessage, *streamedC return classified } if strings.TrimSpace(data) == "[DONE]" { - sawDone = true + stats.SawDone = true return nil } payload := json.RawMessage(strings.TrimSpace(data)) @@ -323,7 +325,7 @@ func consumeOpenAIStream(body io.Reader, handle func(json.RawMessage, *streamedC for scanner.Scan() { line := strings.TrimSuffix(scanner.Text(), "\r") if line == "" { - if err := flush(); err != nil { + if err := flush(); err != nil || stats.SawDone { return stats, output, err } continue @@ -333,14 +335,10 @@ func consumeOpenAIStream(body io.Reader, handle func(json.RawMessage, *streamedC if err := scanner.Err(); err != nil { return stats, output, executor.StreamReadError(err) } - if err := flush(); err != nil { + if err := flush(); err != nil || stats.SawDone { return stats, output, err } - if !sawDone { - return stats, output, executor.StreamIncompleteError() - } - stats.SawDone = true - return stats, output, nil + return stats, output, executor.StreamIncompleteError() } func RelayAnthropicStream(writer io.Writer, body io.Reader, requestID, model string) (StreamRelayStats, error) { diff --git a/internal/gateway/fefo_quota_test.go b/internal/gateway/fefo_quota_test.go index cf8f726ae..053ce69a5 100644 --- a/internal/gateway/fefo_quota_test.go +++ b/internal/gateway/fefo_quota_test.go @@ -1,31 +1,99 @@ package gateway import ( + "io" + "net/http" + "net/http/httptest" + "strings" + "sync" "testing" "time" - "github.com/caigee-cmd/cli2api/internal/accounts" - "github.com/caigee-cmd/cli2api/internal/translate" + "github.com/caigee-cmd/cli2api/internal/auth" + "github.com/caigee-cmd/cli2api/internal/executor" ) +type firstDeltaRecorder struct { + *httptest.ResponseRecorder + delta chan struct{} + once sync.Once +} + +func (w *firstDeltaRecorder) Flush() { + w.ResponseRecorder.Flush() + if strings.Contains(w.Body.String(), "response.output_text.delta") { + w.once.Do(func() { close(w.delta) }) + } +} + func TestQuotaInvalidationRunsAfterTerminalResponseNotStreamHeaders(t *testing.T) { - var calls []string - h := &Handler{AfterAccountUse: func(id, model string) { calls = append(calls, id+":"+model) }} - finish := func(status, id, publicModel string) { - h.finishRequestLog("", time.Now(), translate.ChatRequest{Model: "paid"}, publicModel, id, "workbuddy", "", status, 0, nil, nil, 1, "") + const poolID, model = "qoder-pool", "paid" + allowFinish := make(chan struct{}) + unblock := sync.OnceFunc(func() { close(allowFinish) }) + worker := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Content-Type", "text/event-stream") + _, _ = io.WriteString(w, `data: {"choices":[{"delta":{"content":"first"}}]}`+"\n\n") + w.(http.Flusher).Flush() + <-allowFinish + _, _ = io.WriteString(w, `data: {"choices":[{"finish_reason":"stop"}]}`+"\n\n"+"data: [DONE]\n\n") + })) + defer worker.Close() + defer unblock() + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: poolID, URL: worker.URL, Provider: "qoder", Region: "global", Runtime: "child_process", Models: []string{model}, MaxInFlight: 1}) + ex := executor.NewChatExecutor(pool, "") + ex.HTTPClient = worker.Client() + quotaRefresh := make(chan string, 2) + h := &Handler{Executor: ex, Pool: pool, KeyLimits: &KeyInFlight{}, AfterAccountUse: func(id, routedModel string, aggregateFEFO bool) { + item, _ := pool.ByID(id) + if item.InFlight != 0 { + t.Errorf("quota invalidation happened before releasing the account slot: %+v", item) + } + quotaRefresh <- id + ":" + routedModel + }} + id := auth.Identity{Kind: auth.KindKey, KeyID: "limited", MaxInFlight: 1} + const path, input = "/v1/responses", `{"model":"qoder/paid","stream":true,"input":"hello"}` + req := httptest.NewRequest(http.MethodPost, path, strings.NewReader(input)) + w := &firstDeltaRecorder{ResponseRecorder: httptest.NewRecorder(), delta: make(chan struct{})} + done := make(chan struct{}) + go func() { + defer close(done) + h.HandleResponses(w, req.WithContext(auth.WithIdentity(req.Context(), id))) + }() + select { + case <-w.delta: + case <-done: + t.Fatalf("stream stopped before the first delta: %d %s", w.Code, w.Body.String()) + case <-time.After(5 * time.Second): + t.Fatal("first delta not relayed") + } + if extra := callGateway(h.HandleResponses, path, input, id); extra.Code != http.StatusTooManyRequests { + t.Fatalf("second request while stream was open: %d %s", extra.Code, extra.Body.String()) + } + select { + case call := <-quotaRefresh: + t.Fatalf("quota invalidation before stream finished: %s", call) + default: } - finish(accounts.RequestStatusStarted, "synthetic", "paid") - finish(accounts.RequestStatusStreaming, "synthetic", "paid") - finish(accounts.RequestStatusOK, "", "paid") - if len(calls) != 0 { - t.Fatalf("invalidated before account use finished: %v", calls) + unblock() + select { + case <-done: + if !strings.Contains(w.Body.String(), "response.completed") { + t.Fatalf("stream did not finish: %s", w.Body.String()) + } + case <-time.After(5 * time.Second): + t.Fatal("stream did not close") } - for _, status := range []string{accounts.RequestStatusOK, accounts.RequestStatusIncomplete, accounts.RequestStatusError, accounts.RequestStatusCanceled} { - finish(status, "synthetic", "paid") + select { + case call := <-quotaRefresh: + if call != poolID+":"+model { + t.Fatalf("quota invalidation used %s", call) + } + default: + t.Fatal("missing terminal quota invalidation") } - finish(accounts.RequestStatusOK, "synthetic", "workbuddy-cn/paid") - h.finishRequestLog("", time.Now(), translate.ChatRequest{Model: "alias"}, "workbuddy/alias", "synthetic", "workbuddy", "", accounts.RequestStatusOK, 0, nil, nil, 1, "") - if len(calls) != 6 || calls[0] != "synthetic:paid" || calls[4] != "synthetic:paid" || calls[5] != "synthetic:alias" { - t.Fatalf("terminal response invalidations = %v", calls) + if !h.KeyLimits.acquire(id) { + t.Fatal("Key slot did not release after stream completed") } + h.KeyLimits.release(id) } diff --git a/internal/gateway/handler.go b/internal/gateway/handler.go index 12f1bad7b..51e7d186e 100644 --- a/internal/gateway/handler.go +++ b/internal/gateway/handler.go @@ -34,9 +34,9 @@ type Handler struct { // AggregationKeyModels builds the provider-neutral list for a key with // model aggregation on: configured logical models plus account aliases. AggregationKeyModels func(context.Context, *http.Request, []map[string]any) []map[string]any - // AfterAccountUse is an optional non-blocking quota invalidation hook. It - // runs after the response/stream finishes, never on receipt of SSE headers. - AfterAccountUse func(accountID, publicModel string) + // AfterAccountUse receives the actual pool account and routed model after + // the response/stream finishes, never on receipt of SSE headers. + AfterAccountUse func(accountID, concreteModel string, aggregateFEFO bool) // KeyLimits caps concurrent chat requests per named API key. Nil means // unlimited, which tests and the console chat path rely on. KeyLimits *KeyInFlight @@ -63,3 +63,9 @@ func (h *Handler) requestedAccount(r *http.Request) string { func (h *Handler) crossProviderPoolOn() bool { return h != nil && h.CrossProviderPool != nil && h.CrossProviderPool.Load() } + +func (h *Handler) refreshQuotaAfterUse(poolAccountID, model string, aggregateFEFO bool) { + if h.AfterAccountUse != nil && poolAccountID != "" { + h.AfterAccountUse(poolAccountID, model, aggregateFEFO) + } +} diff --git a/internal/gateway/keylimit.go b/internal/gateway/keylimit.go index f6d06f73c..0adfe8ed6 100644 --- a/internal/gateway/keylimit.go +++ b/internal/gateway/keylimit.go @@ -1,6 +1,7 @@ package gateway import ( + "errors" "net/http" "sync" @@ -49,27 +50,37 @@ func (k *KeyInFlight) release(identity auth.Identity) { k.count[identity.KeyID]-- } -// reserveKeySlot takes one concurrency slot for a named key. A false result -// is a 429 the caller should write and return from. The returned function -// releases the slot and is safe to call when nothing was reserved. -func (h *Handler) reserveKeySlot(r *http.Request) (func(), bool) { +var errKeyConcurrencyLimited = errors.New("API key concurrency limit reached") + +// keySlotHooks gives Prepare a gate after pure validation and before side +// effects. The handler defers release before calling Prepare, keeping the +// slot through dispatch and response writing (including a stream body). +func (h *Handler) keySlotHooks(r *http.Request) (reserve func() error, release func()) { identity := h.requestIdentity(r) - if h == nil || h.KeyLimits == nil || !h.KeyLimits.acquire(identity) { - if h == nil || h.KeyLimits == nil { - return func() {}, true + limits := h.KeyLimits + held := false + return func() error { + if limits != nil && !held { + if !limits.acquire(identity) { + return errKeyConcurrencyLimited + } + held = true + } + return nil + }, func() { + if held { + limits.release(identity) + held = false + } } - return func() {}, false - } - var once sync.Once - return func() { once.Do(func() { h.KeyLimits.release(identity) }) }, true } func writeKeyConcurrencyLimited(w http.ResponseWriter) { w.Header().Set("Retry-After", "1") - writeErr(w, http.StatusTooManyRequests, "rate_limit", "API key concurrency limit reached") + writeErr(w, http.StatusTooManyRequests, "rate_limit", errKeyConcurrencyLimited.Error()) } func writeAnthropicKeyConcurrencyLimited(w http.ResponseWriter) { w.Header().Set("Retry-After", "1") - writeAnthropicError(w, http.StatusTooManyRequests, "rate_limit_error", "API key concurrency limit reached") + writeAnthropicError(w, http.StatusTooManyRequests, "rate_limit_error", errKeyConcurrencyLimited.Error()) } diff --git a/internal/gateway/keylimit_test.go b/internal/gateway/keylimit_test.go index 9121da02c..d56cb9977 100644 --- a/internal/gateway/keylimit_test.go +++ b/internal/gateway/keylimit_test.go @@ -2,15 +2,21 @@ package gateway import ( "bytes" + "context" "encoding/json" + "fmt" "net/http" "net/http/httptest" + "strings" "sync" + "sync/atomic" "testing" "time" + "github.com/caigee-cmd/cli2api/internal/accounts" "github.com/caigee-cmd/cli2api/internal/auth" "github.com/caigee-cmd/cli2api/internal/executor" + "github.com/caigee-cmd/cli2api/internal/translate" ) func TestKeyConcurrencyLimitRejectsTheExtraRequest(t *testing.T) { @@ -50,6 +56,136 @@ func TestKeyConcurrencyLimitRejectsTheExtraRequest(t *testing.T) { } } +type testAggregationResolver func(context.Context, string, map[string]bool) (accounts.Aggregation, error) + +func (f testAggregationResolver) Resolve(ctx context.Context, id string, allowed map[string]bool) (accounts.Aggregation, error) { + return f(ctx, id, allowed) +} + +type testCatalogPreparer func() + +func (f testCatalogPreparer) EnsureModelCatalogs(context.Context, bool) { f() } + +type testRequestStarter func(accounts.RequestLog) + +func (f testRequestStarter) Start(entry accounts.RequestLog) { f(entry) } + +func callGateway(handler http.HandlerFunc, path, body string, identity auth.Identity) *httptest.ResponseRecorder { + r := httptest.NewRequest(http.MethodPost, path, strings.NewReader(body)) + w := httptest.NewRecorder() + handler(w, r.WithContext(auth.WithIdentity(r.Context(), identity))) + return w +} + +func TestKeyConcurrencyRejectsBeforeAggregationClassifier(t *testing.T) { + const pipeline = `{ "version":1, "steps":[ + {"id":"route","kind":"branch","classifier":{"provider":"qoder","model":"classify"},"paths":[ + {"id":"answer","label":"Answer","intent":"answer","steps":[{"id":"m","kind":"member","provider":"qoder","model":"answer"}]} + ]} + ]}` + var resolveCalls, classifyCalls, answerCalls, catalogCalls, requestStarts atomic.Int32 + classifierStarted := make(chan struct{}) + allowClassifier := make(chan struct{}) + unblock := sync.OnceFunc(func() { close(allowClassifier) }) + worker := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var req translate.ChatRequest + if err := json.NewDecoder(r.Body).Decode(&req); err != nil { + t.Errorf("decode worker request: %v", err) + w.WriteHeader(http.StatusBadRequest) + return + } + switch req.Model { + case "classify": + if classifyCalls.Add(1) == 1 { + close(classifierStarted) + <-allowClassifier + } + case "answer": + answerCalls.Add(1) + default: + t.Errorf("unexpected worker model %q", req.Model) + w.WriteHeader(http.StatusBadRequest) + return + } + _, _ = fmt.Fprint(w, `{"model":"answer","choices":[{"message":{"content":"answer"},"finish_reason":"stop"}]}`) + })) + defer worker.Close() + defer unblock() + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: "qoder", URL: worker.URL, Provider: "qoder", Region: "global", Runtime: "child_process", Models: []string{"classify", "answer"}, MaxInFlight: 8}) + ex := executor.NewChatExecutor(pool, "") + ex.HTTPClient = worker.Client() + crossProvider := &atomic.Bool{} + crossProvider.Store(true) + h := &Handler{Executor: ex, Pool: pool, KeyLimits: &KeyInFlight{}, CrossProviderPool: crossProvider, + Aggregations: testAggregationResolver(func(_ context.Context, id string, _ map[string]bool) (accounts.Aggregation, error) { + resolveCalls.Add(1) + return accounts.Aggregation{ID: id, Name: "Pipeline", Enabled: true, Document: pipeline}, nil + }), + Catalogs: testCatalogPreparer(func() { catalogCalls.Add(1) }), + Logs: testRequestStarter(func(entry accounts.RequestLog) { + if entry.Status != accounts.RequestStatusStarted || entry.APIKeyID != "limited" { + t.Errorf("unexpected log start: %+v", entry) + } + requestStarts.Add(1) + }), + } + id := auth.Identity{Kind: auth.KindKey, KeyID: "limited", MaxInFlight: 1, AllowedProviders: []string{"qoder"}} + const chatBody = `{"model":%q,"messages":[{"role":"user","content":"hello"}]}` + firstDone := make(chan *httptest.ResponseRecorder, 1) + go func() { + firstDone <- callGateway(h.HandleChatCompletions, "/v1/chat/completions", fmt.Sprintf(chatBody, "pipeline"), id) + }() + select { + case <-classifierStarted: + case <-time.After(5 * time.Second): + t.Fatal("first request did not start the aggregation classifier") + } + + catalogBefore, startsBefore := catalogCalls.Load(), requestStarts.Load() + for _, tc := range []struct { + path, body, limitError, forbiddenError string + handler http.HandlerFunc + }{ + {"/v1/chat/completions", chatBody, `"code":"rate_limit"`, `"code":"provider_not_allowed"`, h.HandleChatCompletions}, + {"/v1/messages", `{"model":%q,"messages":[{"role":"user","content":"hello"}],"max_tokens":16}`, `"type":"rate_limit_error"`, `"type":"invalid_request_error"`, h.HandleAnthropicMessages}, + {"/v1/responses", `{"model":%q,"input":"hello"}`, `"code":"rate_limit"`, `"code":"provider_not_allowed"`, h.HandleResponses}, + } { + t.Run(tc.path, func(t *testing.T) { + got := callGateway(tc.handler, tc.path, fmt.Sprintf(tc.body, "pipeline"), id) + if got.Code != http.StatusTooManyRequests || got.Header().Get("Retry-After") != "1" || got.Header().Get("X-Request-Id") != "" || !strings.Contains(got.Body.String(), tc.limitError) { + t.Fatalf("limited response: %d %v %s", got.Code, got.Header(), got.Body.String()) + } + malformed := callGateway(tc.handler, tc.path, `{`, id) + if malformed.Code != http.StatusBadRequest || malformed.Header().Get("Retry-After") != "" { + t.Fatalf("malformed response: %d %v %s", malformed.Code, malformed.Header(), malformed.Body.String()) + } + forbidden := callGateway(tc.handler, tc.path, fmt.Sprintf(tc.body, "codex/answer"), id) + if forbidden.Code != http.StatusForbidden || forbidden.Header().Get("Retry-After") != "" || !strings.Contains(forbidden.Body.String(), tc.forbiddenError) { + t.Fatalf("forbidden response: %d %v %s", forbidden.Code, forbidden.Header(), forbidden.Body.String()) + } + }) + } + if resolveCalls.Load() != 1 || classifyCalls.Load() != 1 || answerCalls.Load() != 0 || catalogCalls.Load() != catalogBefore || requestStarts.Load() != startsBefore { + t.Fatalf("rejected requests ran Prepare effects: resolve=%d classify=%d dispatch=%d catalog=%d starts=%d", resolveCalls.Load(), classifyCalls.Load(), answerCalls.Load(), catalogCalls.Load(), requestStarts.Load()) + } + unblock() + select { + case first := <-firstDone: + if first.Code != http.StatusOK { + t.Fatalf("first request: %d %s", first.Code, first.Body.String()) + } + case <-time.After(5 * time.Second): + t.Fatal("first request did not finish") + } + if after := callGateway(h.HandleChatCompletions, "/v1/chat/completions", fmt.Sprintf(chatBody, "qoder/answer"), id); after.Code != http.StatusOK { + t.Fatalf("request after release: %d %s", after.Code, after.Body.String()) + } + if classifyCalls.Load() != 1 || answerCalls.Load() != 2 || requestStarts.Load() != 2 { + t.Fatalf("accepted counts: classify=%d dispatch=%d starts=%d", classifyCalls.Load(), answerCalls.Load(), requestStarts.Load()) + } +} + func TestKeyConcurrencyUnlimitedDoesNotCount(t *testing.T) { limits := &KeyInFlight{} identity := auth.Identity{Kind: auth.KindKey, KeyID: "key", MaxInFlight: 0} diff --git a/internal/gateway/native_responses.go b/internal/gateway/native_responses.go index af12ff547..237a8a458 100644 --- a/internal/gateway/native_responses.go +++ b/internal/gateway/native_responses.go @@ -27,7 +27,6 @@ func RelayNativeResponsesStream(writer io.Writer, body io.Reader, names map[stri scanner := bufio.NewScanner(body) scanner.Buffer(make([]byte, 0, 64*1024), maxSSELineSize) var frame []string - var sawTerminal bool flush := func() error { if len(frame) == 0 { return nil @@ -39,6 +38,9 @@ func RelayNativeResponsesStream(writer io.Writer, body io.Reader, names map[stri } frame = nil if classified := classifyStreamSSEError(eventName, data); classified != nil { + // This error frame is already on the wire. Mark it terminal so the + // handler does not synthesize another failure frame. + stats.FinishReason = "error" return classified } payload := strings.TrimSpace(data) @@ -56,7 +58,6 @@ func RelayNativeResponsesStream(writer io.Writer, body io.Reader, names map[stri if !event.Terminal { return nil } - sawTerminal = true stats.FinishReason = event.FinishReason stats.PromptTokens = event.InputTokens stats.CompletionTokens = event.OutputTokens @@ -68,12 +69,15 @@ func RelayNativeResponsesStream(writer io.Writer, body io.Reader, names map[stri if event.FinishReason == "error" { return executor.ClassifyUpstreamBody(0, payload) } + stats.SawDone = true return nil } for scanner.Scan() { line := strings.TrimSuffix(scanner.Text(), "\r") if line == "" { - if err := flush(); err != nil { + // The first successfully relayed terminal event settles the + // request; an error reading beyond it cannot change that result. + if err := flush(); err != nil || stats.SawDone { return stats, err } continue @@ -83,14 +87,10 @@ func RelayNativeResponsesStream(writer io.Writer, body io.Reader, names map[stri if err := scanner.Err(); err != nil { return stats, executor.StreamReadError(err) } - if err := flush(); err != nil { + if err := flush(); err != nil || stats.SawDone { return stats, err } - if !sawTerminal { - return stats, executor.StreamIncompleteError() - } - stats.SawDone = true - return stats, nil + return stats, executor.StreamIncompleteError() } // restoreNativeFrameToolNames returns the frame to write. Without a mapping, or diff --git a/internal/gateway/openai.go b/internal/gateway/openai.go index dc95bc777..dba96596a 100644 --- a/internal/gateway/openai.go +++ b/internal/gateway/openai.go @@ -57,20 +57,15 @@ func (h *Handler) HandleChatCompletions(w http.ResponseWriter, r *http.Request) writeErr(w, http.StatusBadRequest, "invalid_request", err.Error()) return } - execution, err := h.PrepareChatExecution(r, req) + reserveKey, releaseKey := h.keySlotHooks(r) + defer releaseKey() + execution, err := h.prepareExecution(r, req, nil, reserveKey) if err != nil { writeChatHTTPError(w, err) return } - releaseKey, ok := h.reserveKeySlot(r) - if !ok { - writeKeyConcurrencyLimited(w) - return - } - defer releaseKey() req = execution.Request publicModel := execution.PublicModel - prefer := execution.Prefer providerFilter := execution.ProviderFilter requestID := execution.RequestID started := execution.Started @@ -88,20 +83,14 @@ func (h *Handler) HandleChatCompletions(w http.ResponseWriter, r *http.Request) } } - // The heartbeat may commit SSE headers while ChatStreamProxy is still - // waiting for the upstream head. Account/provider are known as soon as - // the executor picks a route, so the timer reads them from this hint - // and includes them in the first flush. - routeHint := &executor.StreamRouteHint{} - ctx = executor.WithStreamRouteHint(ctx, routeHint) - + // The heartbeat can commit before an upstream stream is accepted. + // The selected account and provider can still change on failover, so + // only the handler may add identity headers from the accepted result. setStreamHeaders := func() { w.Header().Set("Content-Type", "text/event-stream; charset=utf-8") w.Header().Set("Cache-Control", "no-cache") w.Header().Set("Connection", "keep-alive") w.Header().Set("X-Accel-Buffering", "no") - accountID, provider := routeHint.Get() - applyStreamIdentityHeaders(accountID, firstNonEmpty(provider, providerFilter)) } // Start heartbeating before blocking on the upstream head. Silence @@ -111,7 +100,8 @@ func (h *Handler) HandleChatCompletions(w http.ResponseWriter, r *http.Request) heartbeat := newStreamHeartbeat(w) heartbeat.Arm(setStreamHeaders) - upstream, err := h.Executor.ChatStreamProxy(ctx, req, prefer, providerFilter) + upstream, err := h.Executor.ChatStreamProxyPrepared(ctx, req, nil, execution.Route) + defer h.refreshQuotaAfterUse(upstream.PoolAccountID, upstream.CooldownModel, upstream.AggregateFEFO) if err != nil { if heartbeat.Abandon() { // The headers are already on the wire, so the only channel left @@ -137,9 +127,9 @@ func (h *Handler) HandleChatCompletions(w http.ResponseWriter, r *http.Request) if heartbeat.clientGone() != nil || r.Context().Err() != nil { // The client left during the heartbeat wait. Do not record this // as a normal stream open; the headers may already be on the - // wire, but no upstream tokens were relayed. CommitSession stays - // uncalled: it binds only a stream that finished without a client - // error, and this one ended because the client left. + // wire, but no upstream tokens were relayed. There is no stream + // outcome to apply to account health; only cancel the attempt. + h.Executor.FinishStream(ctx, upstream, context.Canceled) h.finishRequestLog(requestID, started, req, publicModel, upstream.AccountID, firstNonEmpty(upstream.Provider, providerFilter), upstream.Routing, accounts.RequestStatusCanceled, upstream.TTFBMs, nil, context.Canceled, upstream.AttemptCount, upstream.ReasoningLevel) return } @@ -170,26 +160,15 @@ func (h *Handler) HandleChatCompletions(w http.ResponseWriter, r *http.Request) logErr = nil } h.finishRequestLog(requestID, started, req, publicModel, upstream.AccountID, firstNonEmpty(upstream.Provider, providerFilter), upstream.Routing, status, ttfb, &stats, logErr, upstream.AttemptCount, upstream.ReasoningLevel) - if relayErr == nil { - h.Executor.CommitSession(ctx, req, upstream.Routing, firstNonEmpty(upstream.PoolAccountID, upstream.AccountID)) - } + h.finishRelayedStream(ctx, upstream, relayErr) if relayErr != nil { - // The upstream answered 200 and failed inside the stream, so the - // executor's attempt loop never saw it. Feed the classified state - // back into the pool so the next request can route around a - // quota-exhausted account. Use req.Model (prefix-stripped by - // resolveProviderFilter) so the cooldown key matches the key - // PickRoute uses; publicModel may still carry "qoder/" and would - // write a cooldown that routing never hits. - if r.Context().Err() == nil && !errors.Is(relayErr, context.Canceled) && !errors.Is(relayErr, context.DeadlineExceeded) && !IsStreamClientDisconnect(relayErr) { - h.Executor.ObserveStreamFailure(firstNonEmpty(upstream.PoolAccountID, upstream.AccountID), relayErr, req.Model) - } panic(http.ErrAbortHandler) } return } - res, err := h.Executor.ChatNonStream(ctx, req, prefer, providerFilter) + res, err := h.Executor.ChatNonStreamPrepared(ctx, req, execution.Route) + defer h.refreshQuotaAfterUse(res.PoolAccountID, res.CooldownModel, res.AggregateFEFO) if err != nil { h.finishRequestLog(requestID, started, req, publicModel, res.AccountID, firstNonEmpty(res.Provider, providerFilter), res.Routing, accounts.RequestStatusError, 0, nil, err, res.AttemptCount, res.ReasoningLevel) WriteClassifiedErr(w, err) @@ -247,9 +226,6 @@ func (h *Handler) HandleChatCompletions(w http.ResponseWriter, r *http.Request) } func (h *Handler) finishRequestLog(requestID string, started time.Time, req translate.ChatRequest, publicModel, accountID, provider, routing, status string, ttfb int, stats *StreamRelayStats, err error, attemptCount int, resolvedReasoning string) { - if accountID != "" && h.AfterAccountUse != nil && status != accounts.RequestStatusStarted && status != accounts.RequestStatusStreaming { - h.AfterAccountUse(accountID, firstNonEmpty(req.Model, publicModel)) - } if h.Recorder == nil || requestID == "" { return } diff --git a/internal/gateway/openai_stream.go b/internal/gateway/openai_stream.go index 8071cc2ff..0c9cca8c4 100644 --- a/internal/gateway/openai_stream.go +++ b/internal/gateway/openai_stream.go @@ -87,9 +87,7 @@ func RelayOpenAIStream(w http.ResponseWriter, body io.Reader) (stats StreamRelay scanner := bufio.NewScanner(countedBody) scanner.Buffer(make([]byte, 0, 64*1024), maxSSELineSize) - sawDone := false var frame []string - var streamErr error normalizer := newOpenAIToolNormalizer() argsFlushed := false @@ -125,19 +123,18 @@ func RelayOpenAIStream(w http.ResponseWriter, body io.Reader) (stats StreamRelay stats.SSEEventCount++ stats.LastEvent = eventName if classifiedErr := classifyStreamSSEError(eventName, data); classifiedErr != nil { - if streamErr == nil { - streamErr = classifiedErr - } if err := writeStructuredStreamError(writer, classifiedErr); err != nil { return err } - frame = nil - return nil + // A structured error is terminal, even if the upstream does not + // close the socket or follows it with a synthetic [DONE]. + return classifiedErr } // Each data line is handled on its own: upstreams differ on whether they // put one JSON payload per line, and a frame may bundle content, usage and // [DONE] together. Tool-call fragments are absorbed and withheld here so // a damaged buffer never reaches the client as fragments. + frameDone := false lines := make([]string, 0, len(frame)) for _, rawLine := range frame { line := strings.TrimSuffix(rawLine, "\r") @@ -153,10 +150,9 @@ func RelayOpenAIStream(w http.ResponseWriter, body io.Reader) (stats StreamRelay if err := flushToolArguments(); err != nil { return err } - sawDone = true - stats.SawDone = true + frameDone = true lines = append(lines, line) - continue + break } if payload != "" { var decoded map[string]any @@ -198,6 +194,7 @@ func RelayOpenAIStream(w http.ResponseWriter, body io.Reader) (stats StreamRelay if _, err := io.WriteString(writer, strings.Join(lines, "\n")+"\n\n"); err != nil { return &StreamRelayWriteError{err: err} } + stats.SawDone = frameDone frame = nil return nil } @@ -208,14 +205,14 @@ func RelayOpenAIStream(w http.ResponseWriter, body io.Reader) (stats StreamRelay if err := flushFrame(); err != nil { return stats, err } + if stats.SawDone { + return stats, nil + } continue } frame = append(frame, line) } if err := scanner.Err(); err != nil { - if streamErr != nil { - return stats, streamErr - } streamErr := executor.StreamReadError(err) if writeErr := writeStructuredStreamError(writer, streamErr); writeErr != nil { return stats, writeErr @@ -225,12 +222,8 @@ func RelayOpenAIStream(w http.ResponseWriter, body io.Reader) (stats StreamRelay if err := flushFrame(); err != nil { return stats, err } - if streamErr != nil { - return stats, streamErr - } - if !sawDone { + if !stats.SawDone { if stats.FinishReason != "" && (stats.FirstTokenAt != nil || stats.SSEEventCount > 0) { - sawDone = true stats.SawDone = true if err := flushToolArguments(); err != nil { return stats, err @@ -313,121 +306,7 @@ func parseSSEFrame(lines []string) (eventName, data string) { } func classifyStreamSSEError(eventName, data string) error { - force := strings.EqualFold(strings.TrimSpace(eventName), "error") - if !force && !streamJSONLooksLikeError(data) { - return nil - } - status := streamErrorStatus(data) - body := strings.TrimSpace(data) - if inner := streamErrorBody(data); inner != "" { - body = inner - } - return executor.ClassifyUpstreamBody(status, body) -} - -func streamJSONLooksLikeError(raw string) bool { - var value any - if json.Unmarshal([]byte(strings.TrimSpace(raw)), &value) != nil { - return false - } - return streamValueLooksLikeError(value) -} - -func streamValueLooksLikeError(value any) bool { - object, ok := value.(map[string]any) - if !ok { - if nested, ok := value.(string); ok { - var parsed any - return json.Unmarshal([]byte(strings.TrimSpace(nested)), &parsed) == nil && streamValueLooksLikeError(parsed) - } - return false - } - if _, ok := object["choices"]; ok { - return false - } - if _, ok := object["error"]; ok { - return true - } - if nested, ok := object["body"]; ok { - if streamValueLooksLikeError(nested) { - return true - } - } - if status, ok := object["status"].(float64); ok && status >= 400 { - return true - } - for _, key := range []string{"code", "msgCode", "kind"} { - if _, ok := object[key]; ok { - return true - } - } - if message, ok := object["message"].(string); ok && strings.TrimSpace(message) != "" { - return true - } - return false -} - -func streamErrorBody(raw string) string { - var value any - if json.Unmarshal([]byte(strings.TrimSpace(raw)), &value) != nil { - return "" - } - for { - switch current := value.(type) { - case string: - var nested any - if json.Unmarshal([]byte(strings.TrimSpace(current)), &nested) != nil { - return current - } - value = nested - case map[string]any: - nested, ok := current["body"] - if !ok { - encoded, err := json.Marshal(current) - if err != nil { - return raw - } - return string(encoded) - } - value = nested - default: - return raw - } - } -} - -func streamErrorStatus(raw string) int { - var value any - if json.Unmarshal([]byte(strings.TrimSpace(raw)), &value) != nil { - return 0 - } - for { - switch current := value.(type) { - case map[string]any: - for _, key := range []string{"status", "statusCode", "statusCodeValue"} { - if status, ok := current[key].(float64); ok && int(status) >= 400 { - return int(status) - } - } - if nested, ok := current["body"]; ok { - value = nested - continue - } - if nested, ok := current["error"]; ok { - value = nested - continue - } - return 0 - case string: - var nested any - if json.Unmarshal([]byte(strings.TrimSpace(current)), &nested) != nil { - return 0 - } - value = nested - default: - return 0 - } - } + return executor.ClassifyStreamEvent(eventName, data) } func IsStreamClientDisconnect(err error) bool { diff --git a/internal/gateway/prepare.go b/internal/gateway/prepare.go index b634be481..2e000f016 100644 --- a/internal/gateway/prepare.go +++ b/internal/gateway/prepare.go @@ -23,23 +23,28 @@ type Execution struct { PublicModel string ProviderFilter string Prefer string + Route executor.RouteInput // ResponseToolNames restores namespaced Responses tool identities on the // reply. Gateway-local: it is never handed to the executor or a provider. ResponseToolNames map[string]translate.ResponseToolName } func (h *Handler) PrepareNativeResponsesExecution(r *http.Request, native *translate.NativeResponsesRequest, compat translate.ChatRequest) (Execution, error) { + return h.prepareNativeResponsesExecution(r, native, compat, nil) +} + +func (h *Handler) prepareNativeResponsesExecution(r *http.Request, native *translate.NativeResponsesRequest, compat translate.ChatRequest, beforeSideEffects func() error) (Execution, error) { if native == nil { return Execution{}, &chatHTTPError{Status: http.StatusBadRequest, Code: "invalid_request", Message: "responses request required"} } - return h.prepareExecution(r, compat, native) + return h.prepareExecution(r, compat, native, beforeSideEffects) } func (h *Handler) PrepareChatExecution(r *http.Request, request translate.ChatRequest) (Execution, error) { - return h.prepareExecution(r, request, nil) + return h.prepareExecution(r, request, nil, nil) } -func (h *Handler) prepareExecution(r *http.Request, request translate.ChatRequest, native *translate.NativeResponsesRequest) (Execution, error) { +func (h *Handler) prepareExecution(r *http.Request, request translate.ChatRequest, native *translate.NativeResponsesRequest, beforeSideEffects func() error) (Execution, error) { var identity auth.Identity if r != nil { identity = h.requestIdentity(r) @@ -86,6 +91,7 @@ func (h *Handler) prepareExecution(r *http.Request, request translate.ChatReques Catalogs: catalogs, Aggregations: aggregations, Logs: logs, + BeforeSideEffects: beforeSideEffects, }) if err != nil { return Execution{}, err @@ -100,10 +106,15 @@ func (h *Handler) prepareExecution(r *http.Request, request translate.ChatReques ProviderFilter: got.ProviderFilter, Prefer: got.Prefer, + Route: got.Route, }, nil } func writeChatHTTPError(w http.ResponseWriter, err error) { + if errors.Is(err, errKeyConcurrencyLimited) { + writeKeyConcurrencyLimited(w) + return + } var requestErr *chatHTTPError if errors.As(err, &requestErr) { writeErr(w, requestErr.Status, requestErr.Code, requestErr.Message) diff --git a/internal/gateway/responses.go b/internal/gateway/responses.go index e50d162a1..968d1a05b 100644 --- a/internal/gateway/responses.go +++ b/internal/gateway/responses.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "encoding/json" - "errors" "fmt" "io" "net/http" @@ -57,39 +56,65 @@ func (h *Handler) HandleResponses(w http.ResponseWriter, r *http.Request) { if compatErr == nil { compatRequest = translated.Chat } - execution, err := h.PrepareNativeResponsesExecution(r, native, compatRequest) + reserveKey, releaseKey := h.keySlotHooks(r) + defer releaseKey() + execution, err := h.prepareNativeResponsesExecution(r, native, compatRequest, reserveKey) if err != nil { - writeCompatibilityOpenAIError(w, err) - return - } - releaseKey, ok := h.reserveKeySlot(r) - if !ok { - writeKeyConcurrencyLimited(w) + writeChatHTTPError(w, err) return } - defer releaseKey() + w.Header().Set("X-Request-Id", execution.RequestID) execution.ResponseToolNames = translated.ToolNames if len(execution.ResponseToolNames) == 0 && execution.NativeRequest != nil { execution.ResponseToolNames = translate.ResponseToolNames(execution.NativeRequest.Body()) } - execution.UseNativeResponses = h.Executor.HasNativeResponsesRoute(execution.Context, execution.Request, execution.Prefer, execution.ProviderFilter) + // A compatible named aggregation must choose the same member it would for + // Chat first, then let that selected target decide whether native Responses + // is available. An incompatible request still requires a native member. + execution.UseNativeResponses = execution.Route.AggregatePlan != nil && compatErr == nil + if !execution.UseNativeResponses { + execution.UseNativeResponses = h.Executor.HasNativeResponsesRoutePrepared(execution.Context, execution.Request, execution.Route) + } if !execution.UseNativeResponses && compatErr != nil { - writeErr(w, http.StatusBadRequest, "unsupported_request", "this Responses request requires a native Responses adapter") + classified := executor.Classified{ + Kind: accounts.KindInvalidRequest, + Status: http.StatusBadRequest, + Code: "unsupported_request", + Message: "this Responses request requires a native Responses adapter", + } + h.finishCompatibility(execution, "", "", "", accounts.RequestStatusError, 0, nil, executor.NewExecutionError(classified, nil), 0, "") + writeErr(w, classified.Status, classified.Code, classified.Message) return } - w.Header().Set("X-Request-Id", execution.RequestID) if execution.Request.Stream { h.handleResponsesStream(w, r, execution) return } if execution.UseNativeResponses { - nativeResult, err := h.Executor.NativeResponsesNonStream(execution.Context, execution.Request, execution.NativeRequest, execution.Prefer, execution.ProviderFilter) + nativeResult, err := h.Executor.NativeResponsesNonStreamPrepared(execution.Context, execution.Request, execution.NativeRequest, execution.Route) + defer h.refreshQuotaAfterUse(nativeResult.PoolAccountID, nativeResult.CooldownModel, nativeResult.AggregateFEFO) if err != nil || nativeResult.FinishReason == "error" { if err == nil { err = fmt.Errorf("upstream Responses request failed") } h.finishCompatibility(execution, nativeResult.AccountID, nativeResult.Provider, nativeResult.Routing, accounts.RequestStatusError, 0, nil, err, nativeResult.AttemptCount, nativeResult.ReasoningLevel) - writeCompatibilityOpenAIError(w, err) + writeChatHTTPError(w, err) + return + } + if compatResult := nativeResult.CompatResult; compatResult != nil { + h.finishCompatibility(execution, nativeResult.AccountID, nativeResult.Provider, nativeResult.Routing, responsesRequestStatus(compatResult.FinishReason), 0, &StreamRelayStats{ + PromptTokens: ptrInt(compatResult.PromptTokens), CompletionTokens: ptrInt(compatResult.CompletionTokens), + CacheReadTokens: compatResult.CacheReadTokens, CacheWriteTokens: compatResult.CacheWriteTokens, + CachedTokens: compatResult.CachedTokens, UsageSource: compatResult.UsageSource, Credits: compatResult.Credits, + ConsumedCredits: compatResult.ConsumedCredits, Model: compatResult.Model, FinishReason: compatResult.FinishReason, + }, nil, nativeResult.AttemptCount, nativeResult.ReasoningLevel) + response := responsesResponse( + execution.RequestID, firstNonEmpty(compatResult.Model, execution.PublicModel), compatResult.Content, compatResult.Reasoning, + decodeOpenAIToolCalls(compatResult.ToolCalls), compatResult.PromptTokens, compatResult.CompletionTokens, compatResult.FinishReason, + compatResult.CacheReadTokens, compatResult.CacheWriteTokens, compatResult.CachedTokens, nil, + ) + translate.RestoreResponseToolNames(response, execution.ResponseToolNames) + writeJSON(w, http.StatusOK, response) return } h.finishCompatibility(execution, nativeResult.AccountID, nativeResult.Provider, nativeResult.Routing, responsesRequestStatus(nativeResult.FinishReason), 0, &StreamRelayStats{ @@ -102,10 +127,11 @@ func (h *Handler) HandleResponses(w http.ResponseWriter, r *http.Request) { _, _ = w.Write(response) return } - result, err := h.Executor.ChatNonStream(execution.Context, execution.Request, execution.Prefer, execution.ProviderFilter) + result, err := h.Executor.ChatNonStreamPrepared(execution.Context, execution.Request, execution.Route) + defer h.refreshQuotaAfterUse(result.PoolAccountID, result.CooldownModel, result.AggregateFEFO) if err != nil { h.finishCompatibility(execution, result.AccountID, result.Provider, result.Routing, accounts.RequestStatusError, 0, nil, err, result.AttemptCount, result.ReasoningLevel) - writeCompatibilityOpenAIError(w, err) + writeChatHTTPError(w, err) return } requestStatus := responsesRequestStatus(result.FinishReason) @@ -128,13 +154,14 @@ func (h *Handler) handleResponsesStream(w http.ResponseWriter, r *http.Request, var upstream executor.StreamResult var err error if execution.UseNativeResponses { - upstream, err = h.Executor.ChatStreamProxyNativeResponses(execution.Context, execution.Request, execution.NativeRequest, execution.Prefer, execution.ProviderFilter) + upstream, err = h.Executor.ChatStreamProxyNativeResponsesPrepared(execution.Context, execution.Request, execution.NativeRequest, execution.Route) } else { - upstream, err = h.Executor.ChatStreamProxy(execution.Context, execution.Request, execution.Prefer, execution.ProviderFilter) + upstream, err = h.Executor.ChatStreamProxyPrepared(execution.Context, execution.Request, nil, execution.Route) } + defer h.refreshQuotaAfterUse(upstream.PoolAccountID, upstream.CooldownModel, upstream.AggregateFEFO) if err != nil { h.finishCompatibility(execution, upstream.AccountID, upstream.Provider, upstream.Routing, accounts.RequestStatusError, upstream.TTFBMs, nil, err, upstream.AttemptCount, upstream.ReasoningLevel) - writeCompatibilityOpenAIError(w, err) + writeChatHTTPError(w, err) return } defer upstream.Response.Body.Close() @@ -154,7 +181,7 @@ func (h *Handler) handleResponsesStream(w http.ResponseWriter, r *http.Request, } else { stats, relayErr = RelayResponsesStream(writer, upstream.Response.Body, execution.RequestID, firstNonEmpty(execution.PublicModel, execution.Request.Model), execution.ResponseToolNames) } - completed := stats.SawDone || stats.FinishReason != "" + completed := stats.SawDone || (stats.FinishReason != "" && stats.FinishReason != "error") status := streamLogStatus(relayErr, completed, r.Context().Err() != nil) if relayErr == nil { status = responsesRequestStatus(stats.FinishReason) @@ -169,16 +196,12 @@ func (h *Handler) handleResponsesStream(w http.ResponseWriter, r *http.Request, logErr = nil } h.finishCompatibility(execution, upstream.AccountID, upstream.Provider, upstream.Routing, status, ttfb, &stats, logErr, upstream.AttemptCount, upstream.ReasoningLevel) - if relayErr == nil { - h.Executor.CommitSession(execution.Context, execution.Request, upstream.Routing, firstNonEmpty(upstream.PoolAccountID, upstream.AccountID)) - return - } + h.finishRelayedStream(execution.Context, upstream, relayErr) // A native failure event was already relayed as the stream's terminal // frame. Appending a second error event would contradict it. - if !IsStreamClientDisconnect(relayErr) && !(upstream.NativeResponses && stats.FinishReason == "error") { + if relayErr != nil && !IsStreamClientDisconnect(relayErr) && !(upstream.NativeResponses && stats.FinishReason == "error") { _ = writeResponsesStreamError(writer, relayErr) } - h.observeCompatibilityStreamFailure(r, execution, upstream, relayErr) } func restoreNativeResponseJSON(raw json.RawMessage, names map[string]translate.ResponseToolName) []byte { @@ -199,15 +222,6 @@ func restoreNativeResponseJSON(raw json.RawMessage, names map[string]translate.R return encoded } -func writeCompatibilityOpenAIError(w http.ResponseWriter, err error) { - var requestErr *chatHTTPError - if errors.As(err, &requestErr) { - writeErr(w, requestErr.Status, requestErr.Code, requestErr.Message) - return - } - WriteClassifiedErr(w, err) -} - type responsesTerminal struct { status string event string diff --git a/internal/gateway/responses_test.go b/internal/gateway/responses_test.go index 2fe8a8d37..551603574 100644 --- a/internal/gateway/responses_test.go +++ b/internal/gateway/responses_test.go @@ -4,13 +4,47 @@ import ( "context" "encoding/json" "errors" + "net/http" "net/http/httptest" "strings" "testing" "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/auth" + "github.com/caigee-cmd/cli2api/internal/executor" + applogs "github.com/caigee-cmd/cli2api/internal/logs" ) +func TestUnsupportedResponsesRequestFinishesLogAndReleasesKey(t *testing.T) { + store := &recordingRequestStore{} + recorder := applogs.NewRequestRecorder(store) + t.Cleanup(recorder.Close) + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: "chat-only", Provider: "qoder", Region: "global", Models: []string{"mock"}}) + h := &Handler{Executor: executor.NewChatExecutor(pool, ""), Pool: pool, Recorder: recorder, KeyLimits: &KeyInFlight{}} + id := auth.Identity{Kind: auth.KindKey, KeyID: "limited", MaxInFlight: 1} + response := callGateway(h.HandleResponses, "/v1/responses", `{"model":"qoder/mock","stream":true,"input":[{"type":"input_file","file_id":"fixture"}]}`, id) + requestID := response.Header().Get("X-Request-Id") + if response.Code != http.StatusBadRequest || requestID == "" || response.Header().Get("Content-Type") != "application/json" || !strings.Contains(response.Body.String(), `"code":"unsupported_request"`) { + t.Fatalf("unsupported request response: %d %v %s", response.Code, response.Header(), response.Body.String()) + } + if !h.KeyLimits.acquire(id) { + t.Fatal("unsupported request did not release the Key slot") + } + h.KeyLimits.release(id) + recorder.Close() // Wait for queued Start/Finish writes. + if len(store.updates) != 2 { + t.Fatalf("want one Start and one Finish, got %+v", store.updates) + } + started, finished := store.updates[0], store.updates[1] + if started.ID != requestID || started.Status != accounts.RequestStatusStarted || started.APIKeyID != id.KeyID { + t.Fatalf("unexpected Start: %+v", started) + } + if finished.ID != requestID || finished.Status != accounts.RequestStatusError || finished.FinishedAt == nil || finished.ErrorKind != accounts.KindInvalidRequest || finished.ErrorCode != "unsupported_request" || finished.AccountID != "" || finished.AttemptCount != 0 { + t.Fatalf("unexpected Finish: %+v", finished) + } +} + func TestRelayOpenAIStreamDoneSurvivesUsageReplacement(t *testing.T) { body := strings.Join([]string{ `data: {"choices":[{"delta":{"content":"hi"}}]}`, diff --git a/internal/gateway/route_lifecycle_test.go b/internal/gateway/route_lifecycle_test.go new file mode 100644 index 000000000..0253e6c96 --- /dev/null +++ b/internal/gateway/route_lifecycle_test.go @@ -0,0 +1,616 @@ +package gateway + +import ( + "context" + "fmt" + "io" + "net/http" + "net/http/httptest" + "reflect" + "strings" + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/auth" + "github.com/caigee-cmd/cli2api/internal/executor" + "github.com/caigee-cmd/cli2api/internal/providers" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +type nativeRouteAdapter func(string, *translate.NativeResponsesRequest, providers.RequestOptions) (*http.Response, providers.ResolvedChat, error) + +func (f nativeRouteAdapter) ResponsesStream(_ context.Context, accountID string, req *translate.NativeResponsesRequest, options providers.RequestOptions) (*http.Response, providers.ResolvedChat, error) { + return f(accountID, req, options) +} + +type observedStreamBody struct { + io.Reader + closed bool +} + +func (b *observedStreamBody) Close() error { + b.closed = true + return nil +} + +type unexpectedEOFReader struct{ read bool } + +func (r *unexpectedEOFReader) Read([]byte) (int, error) { + r.read = true + return 0, io.ErrUnexpectedEOF +} + +func TestNativeResponsesStreamIgnoresReadErrorAfterTerminal(t *testing.T) { + for _, status := range []string{"completed", "incomplete"} { + t.Run(status, func(t *testing.T) { + const accountID, model = "codex-pool", "model" + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: accountID, Provider: "codex", Region: "global", Runtime: "in_process", Models: []string{model}, MaxInFlight: 1}) + terminalType := "response." + status + terminal := fmt.Sprintf("event: %s\ndata: %s\n\n", terminalType, fmt.Sprintf(`{"type":%q,"response":{"status":%q,"output":[]}}`, terminalType, status)) + tail := &unexpectedEOFReader{} + body := &observedStreamBody{Reader: io.MultiReader(strings.NewReader(terminal), tail)} + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "codex", NativeResponses: nativeRouteAdapter(func(string, *translate.NativeResponsesRequest, providers.RequestOptions) (*http.Response, providers.ResolvedChat, error) { + return &http.Response{StatusCode: http.StatusOK, Header: make(http.Header), Body: body}, providers.ResolvedChat{}, nil + })}) + var attempts []accounts.RequestAttempt + ex := executor.NewChatExecutor(pool, "") + ex.Providers = registry + ex.OnAttempt = func(a accounts.RequestAttempt) { attempts = append(attempts, a) } + h := &Handler{Executor: ex, Pool: pool} + resp := callGateway(h.HandleResponses, "/v1/responses", `{"model":"codex/model","stream":true,"input":"hi"}`, auth.Identity{}) + if resp.Code != http.StatusOK || resp.Body.String() != terminal || tail.read || !body.closed { + t.Fatalf("terminal relay: status=%d readTail=%v closed=%v body=%s", resp.Code, tail.read, body.closed, resp.Body.String()) + } + if len(attempts) != 1 || attempts[0].AccountID != accountID || attempts[0].Status != accounts.AttemptStatusOK || attempts[0].ErrorKind != "" { + t.Fatalf("successful terminal must not produce failure feedback: %+v", attempts) + } + item, _ := pool.ByID(accountID) + if item.InFlight != 0 || !item.DownUntil.IsZero() || len(item.ModelDownUntil) != 0 || item.LastKind != "" { + t.Fatalf("successful terminal affected account health or leaked slot: %+v", item) + } + }) + } +} + +func TestAggregatedNativeResponsesTerminalFailureUsesActualModel(t *testing.T) { + for _, stream := range []bool{false, true} { + t.Run(fmt.Sprintf("stream=%t", stream), func(t *testing.T) { + const accountID, firstModel, secondModel, logicalModel = "codex-pool", "primary-model", "alternate-model", "logical-model" + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: accountID, Provider: "codex", Region: "global", Runtime: "in_process", + Models: []string{firstModel, secondModel}, NativeModels: map[string]string{firstModel: "provider-primary"}, MaxInFlight: 1}) + var models, quotaRefresh []string + var attempts []accounts.RequestAttempt + var body *observedStreamBody + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "codex", NativeResponses: nativeRouteAdapter(func(id string, req *translate.NativeResponsesRequest, opts providers.RequestOptions) (*http.Response, providers.ResolvedChat, error) { + if id != accountID || !strings.Contains(string(req.Fields()["input"]), `"input_file"`) { + t.Fatalf("native dispatch did not preserve input or account: %q %s", id, req.Fields()["input"]) + } + models = append(models, opts.Model) + source := "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"status\":\"in_progress\"}}\n\n" + if opts.Model == "provider-primary" { + source += "event: error\ndata: {\"type\":\"error\",\"code\":\"rate_limit_exceeded\",\"message\":\"slow down\"}\n\n" + } else { + source += "event: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_ok\",\"status\":\"completed\",\"output\":[]}}\n\n" + } + body = &observedStreamBody{Reader: strings.NewReader(source)} + return &http.Response{StatusCode: http.StatusOK, Header: make(http.Header), Body: body}, providers.ResolvedChat{}, nil + })}) + ex := executor.NewChatExecutor(pool, "") + ex.Providers = registry + ex.OnAttempt = func(a accounts.RequestAttempt) { + item, ok := pool.ByID(accountID) + if !ok || item.InFlight != 1 { + t.Errorf("attempt feedback must precede account slot release: %+v", item) + } + attempts = append(attempts, a) + } + h := &Handler{Executor: ex, Pool: pool, KeyLimits: &KeyInFlight{}, + Aggregations: testAggregationResolver(func(_ context.Context, id string, _ map[string]bool) (accounts.Aggregation, error) { + return accounts.Aggregation{ID: id, Enabled: true, Strategy: accounts.AggregationPriority, AllowFallbacks: true, MaxAttempts: 1, + Members: []accounts.AggregationMember{ + {Provider: "codex", Region: "global", Model: firstModel, Priority: 1, Weight: 1}, + {Provider: "codex", Region: "global", Model: secondModel, Priority: 2, Weight: 1}, + }}, nil + }), + AfterAccountUse: func(id, model string, aggregateFEFO bool) { + if body == nil || !body.closed { + t.Error("quota invalidation ran before stream body closed") + } + quotaRefresh = append(quotaRefresh, id+":"+model) + }, + } + identity := auth.Identity{Kind: auth.KindKey, KeyID: "limited", MaxInFlight: 1, ModelAggregation: true, AllowedProviders: []string{accounts.AggregationProvider}} + input := fmt.Sprintf(`{"model":%q,"stream":%t,"input":[{"type":"input_file","file_id":"fixture"}]}`, logicalModel, stream) + first := callGateway(h.HandleResponses, "/v1/responses", input, identity) + if stream { + if first.Code != http.StatusOK || strings.Count(first.Body.String(), "event: error\n") != 1 { + t.Fatalf("stream must forward one upstream error: %d %s", first.Code, first.Body.String()) + } + } else if first.Code != http.StatusTooManyRequests || !strings.Contains(first.Body.String(), "rate_limit_exceeded") { + t.Fatalf("collecting response should report upstream limit: %d %s", first.Code, first.Body.String()) + } + item, ok := pool.ByID(accountID) + if !ok || item.InFlight != 0 || !item.DownUntil.IsZero() || !item.ModelDownUntil[firstModel].After(time.Now()) || len(item.ModelDownUntil) != 1 { + t.Fatalf("wrong cooldown target or slot state: %+v", item) + } + second := callGateway(h.HandleResponses, "/v1/responses", input, identity) + if second.Code != http.StatusOK || !strings.Contains(second.Body.String(), "resp_ok") { + t.Fatalf("alternate member on same account should remain available: %d %s", second.Code, second.Body.String()) + } + if !reflect.DeepEqual(models, []string{"provider-primary", secondModel}) || !reflect.DeepEqual(quotaRefresh, []string{accountID + ":" + firstModel, accountID + ":" + secondModel}) { + t.Fatalf("dispatched models=%v; quota targets=%v", models, quotaRefresh) + } + if len(attempts) != 2 || attempts[0].Status != accounts.AttemptStatusError || attempts[0].ErrorKind != accounts.KindRateLimit || attempts[1].Status != accounts.AttemptStatusOK { + t.Fatalf("want one terminal record per dispatched attempt; got %+v", attempts) + } + }) + } +} + +func TestWorkerStreamRateLimitUsesPoolAccountNotDisplayLabel(t *testing.T) { + const poolID, displayID, actualModel = "worker-pool", "worker-display", "actual-model" + worker := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Content-Type", "text/event-stream") + w.Header().Set("X-Qoder-Account", displayID) + _, _ = io.WriteString(w, "data: {\"choices\":[{\"delta\":{\"content\":\"hi\"}}]}\n\n"+ + "event: error\ndata: {\"error\":{\"code\":\"rate_limit_exceeded\",\"message\":\"slow down\"}}\n\n") + })) + defer worker.Close() + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: poolID, URL: worker.URL, Provider: "qoder", Region: "global", Runtime: "child_process", + Models: []string{actualModel}, ModelAliases: map[string]string{"alias": actualModel}, MaxInFlight: 1}) + pool.Upsert(executor.Item{ID: displayID, URL: worker.URL, Provider: "qoder", Region: "global", Runtime: "child_process", Models: []string{actualModel}}) + ex := executor.NewChatExecutor(pool, "") + ex.HTTPClient = worker.Client() + var quotaRefresh []string + var attempts []accounts.RequestAttempt + ex.OnAttempt = func(a accounts.RequestAttempt) { attempts = append(attempts, a) } + h := &Handler{Executor: ex, Pool: pool, RequestedAccount: func(*http.Request) string { return poolID }, + AfterAccountUse: func(id, model string, aggregateFEFO bool) { quotaRefresh = append(quotaRefresh, id+":"+model) }} + id := auth.Identity{Kind: auth.KindKey, KeyID: "limited"} + response := callGateway(h.HandleResponses, "/v1/responses", `{"model":"qoder/alias","stream":true,"input":"hello"}`, id) + if response.Code != http.StatusOK || response.Header().Get("X-CLI2API-Account") != displayID || strings.Count(response.Body.String(), "event: error\n") != 1 { + t.Fatalf("public stream label or error changed: %d %v %s", response.Code, response.Header(), response.Body.String()) + } + actual, _ := pool.ByID(poolID) + display, _ := pool.ByID(displayID) + if !actual.ModelDownUntil[actualModel].After(time.Now()) || !actual.DownUntil.IsZero() || actual.InFlight != 0 || len(display.ModelDownUntil) != 0 || !display.DownUntil.IsZero() { + t.Fatalf("wrong feedback: actual=%+v display=%+v", actual, display) + } + if !reflect.DeepEqual(quotaRefresh, []string{poolID + ":" + actualModel}) { + t.Fatalf("quota invalidation targeted %v", quotaRefresh) + } + if len(attempts) != 1 || attempts[0].AccountID != poolID || attempts[0].ErrorKind != accounts.KindRateLimit || attempts[0].Status != accounts.AttemptStatusError { + t.Fatalf("unexpected attempt records: %+v", attempts) + } +} + +type disconnectedStreamWriter struct { + *httptest.ResponseRecorder +} + +func (w *disconnectedStreamWriter) Write([]byte) (int, error) { return 0, io.ErrClosedPipe } + +func TestAnthropicStreamClientDisconnectDoesNotCoolAccount(t *testing.T) { + const poolID, model = "worker-pool", "routed-model" + worker := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Content-Type", "text/event-stream") + _, _ = io.WriteString(w, `data: {"choices":[{"delta":{"content":"hi"}}]}`+"\n\ndata: [DONE]\n\n") + })) + defer worker.Close() + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: poolID, URL: worker.URL, Provider: "qoder", Region: "global", Runtime: "child_process", + Models: []string{model}, MaxInFlight: 1}) + ex := executor.NewChatExecutor(pool, "") + ex.HTTPClient = worker.Client() + var attempts []accounts.RequestAttempt + ex.OnAttempt = func(a accounts.RequestAttempt) { attempts = append(attempts, a) } + h := &Handler{Executor: ex, Pool: pool, KeyLimits: &KeyInFlight{}} + id := auth.Identity{Kind: auth.KindKey, KeyID: "limited", MaxInFlight: 1} + r := httptest.NewRequest(http.MethodPost, "/v1/messages", strings.NewReader(`{"model":"qoder/routed-model","stream":true,"messages":[{"role":"user","content":"hello"}],"max_tokens":16}`)) + h.HandleAnthropicMessages(&disconnectedStreamWriter{httptest.NewRecorder()}, r.WithContext(auth.WithIdentity(r.Context(), id))) + if len(attempts) != 1 || attempts[0].AccountID != poolID || attempts[0].ErrorKind != accounts.KindCanceled { + t.Fatalf("downstream disconnect should record cancellation once: %+v", attempts) + } + item, _ := pool.ByID(poolID) + if item.InFlight != 0 || !item.DownUntil.IsZero() || item.LastKind != "" || len(item.ModelDownUntil) != 0 { + t.Fatalf("downstream disconnect affected account health or leaked the account slot: %+v", item) + } + if !h.KeyLimits.acquire(id) { + t.Fatal("Key slot leaked on downstream disconnect") + } + h.KeyLimits.release(id) +} + +// cancellationStreamTail can finish the request independently of the read +// result an adapter exposes. No network scheduling is needed to exercise that ordering. +type cancellationStreamTail struct { + reader io.Reader + terminal error + beforeRead func() +} + +func (r cancellationStreamTail) Read(p []byte) (int, error) { + if r.beforeRead != nil { + r.beforeRead() + } + if r.reader != nil { + return r.reader.Read(p) + } + return 0, r.terminal +} + +func TestDispatchCancellationKeepsAccountFeedbackAccurate(t *testing.T) { + nl := string(rune(10)) + frame := func(event, data string) string { return "event: " + event + nl + "data: " + data + nl + nl } + nativeStart := frame("response.created", `{"type":"response.created"}`) + nativeDone := frame("response.completed", `{"type":"response.completed","response":{"status":"completed","output":[]}}`) + rateLimit := frame("error", `{"type":"error","error":{"status":429,"code":"rate_limit_exceeded","message":"slow down","retry_after":79,"failover":false}}`) + unavailable := frame("error", `{"type":"error","error":{"status":503,"code":"temporarily_unavailable","message":"try again later","failover":false}}`) + + for _, mode := range []struct { + name, path, request, provider, successMarker string + handler func(*Handler, http.ResponseWriter, *http.Request) + }{ + {"chat", "/v1/chat/completions", `{"model":"qoder/model","stream":true,"messages":[{"role":"user","content":"hello"}]}`, "qoder", "data: [DONE]", (*Handler).HandleChatCompletions}, + {"messages", "/v1/messages", `{"model":"qoder/model","stream":true,"max_tokens":16,"messages":[{"role":"user","content":"hello"}]}`, "qoder", "event: message_stop", (*Handler).HandleAnthropicMessages}, + {"compat-responses", "/v1/responses", `{"model":"qoder/model","stream":true,"input":"hello"}`, "qoder", "event: response.completed", (*Handler).HandleResponses}, + {"native-responses", "/v1/responses", `{"model":"codex/model","stream":true,"input":"hello"}`, "codex", "event: response.completed", (*Handler).HandleResponses}, + {"native-collect", "/v1/responses", `{"model":"codex/model","stream":false,"input":"hello"}`, "codex", `"status":"completed"`, (*Handler).HandleResponses}, + } { + start, terminal := chatStreamText, chatStreamDone + if mode.provider == "codex" { + start, terminal = nativeStart, nativeDone + } + for _, tc := range []struct { + name, first, tail string + err error + cancel bool + wantKind string + }{ + {name: "cancel-before-first-frame", err: io.EOF, cancel: true, wantKind: accounts.KindCanceled}, + {name: "cancel-at-eof", first: start, err: io.EOF, cancel: true, wantKind: accounts.KindCanceled}, + {name: "cancel-at-read-error", first: start, err: io.ErrUnexpectedEOF, cancel: true, wantKind: accounts.KindCanceled}, + {name: "cancel-with-sentinel", first: start, err: context.Canceled, cancel: true, wantKind: accounts.KindCanceled}, + {name: "eof-while-live", first: start, err: io.EOF, wantKind: accounts.KindUnavailable}, + {name: "read-error-while-live", first: start, err: io.ErrUnexpectedEOF, wantKind: accounts.KindUnavailable}, + {name: "complete-as-client-leaves", first: start, tail: terminal, cancel: true}, + {name: "provider-rate-limit-as-client-leaves", first: start, tail: rateLimit, cancel: true, wantKind: accounts.KindRateLimit}, + {name: "provider-rate-limit-before-first-frame", tail: rateLimit, cancel: true, wantKind: accounts.KindRateLimit}, + {name: "provider-unavailable-as-client-leaves", first: start, tail: unavailable, cancel: true, wantKind: accounts.KindUnavailable}, + {name: "provider-unavailable-before-first-frame", tail: unavailable, cancel: true, wantKind: accounts.KindUnavailable}, + } { + t.Run(mode.name+"/"+tc.name, func(t *testing.T) { + const accountID, backupID, model = "synthetic-pool", "synthetic-backup", "model" + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: accountID, Provider: mode.provider, Region: "global", Runtime: "in_process", Models: []string{model}, MaxInFlight: 1}) + // Canceled cases must not dispatch a second attempt even when a backup is ready. + // Live transport failures exercise account feedback without retrying this fixture body. + if tc.cancel { + pool.Upsert(executor.Item{ID: backupID, Provider: mode.provider, Region: "global", Runtime: "in_process", Models: []string{model}, MaxInFlight: 1}) + } + identity := auth.Identity{Kind: auth.KindKey, KeyID: "synthetic-cancel", MaxInFlight: 1} + ctx, cancel := context.WithCancel(auth.WithIdentity(t.Context(), identity)) + defer cancel() + + tail := cancellationStreamTail{terminal: tc.err} + if tc.tail != "" { + tail.reader = strings.NewReader(tc.tail) + } + if tc.cancel { + tail.beforeRead = cancel + } + body := &observedStreamBody{Reader: io.MultiReader(strings.NewReader(tc.first), tail)} + response := &http.Response{StatusCode: http.StatusOK, Header: make(http.Header), Body: body} + registry := providers.NewRegistry() + if mode.provider == "codex" { + registry.Register(providers.Adapter{ID: mode.provider, NativeResponses: nativeRouteAdapter(func(string, *translate.NativeResponsesRequest, providers.RequestOptions) (*http.Response, providers.ResolvedChat, error) { + return response, providers.ResolvedChat{}, nil + })}) + } else { + registry.Register(providers.Adapter{ID: mode.provider, Chat: streamRouteTestAdapter(func(context.Context, string, translate.ChatRequest) (*http.Response, error) { return response, nil })}) + } + var attempts []accounts.RequestAttempt + ex := executor.NewChatExecutor(pool, "") + ex.Providers = registry + ex.OnAttempt = func(a accounts.RequestAttempt) { attempts = append(attempts, a) } + handler := &Handler{Executor: ex, Pool: pool, KeyLimits: &KeyInFlight{}, RequestedAccount: func(*http.Request) string { return accountID }} + r := httptest.NewRequestWithContext(ctx, http.MethodPost, mode.path, strings.NewReader(mode.request)) + w := httptest.NewRecorder() + func() { + defer func() { + if caught := recover(); caught != nil && caught != http.ErrAbortHandler { + panic(caught) + } + }() + mode.handler(handler, w, r) + }() + + item, ok := pool.ByID(accountID) + if !ok || item.InFlight != 0 || !body.closed || (ctx.Err() != nil) != tc.cancel { + t.Fatalf("unexpected release or cancellation: item=%+v bodyClosed=%t ctxErr=%v", item, body.closed, ctx.Err()) + } + if !handler.KeyLimits.acquire(identity) { + t.Fatal("Key slot not released") + } + handler.KeyLimits.release(identity) + wantStatus := accounts.AttemptStatusError + if tc.wantKind == "" { + wantStatus = accounts.AttemptStatusOK + if w.Code != http.StatusOK || !strings.Contains(w.Body.String(), mode.successMarker) { + t.Errorf("confirmed terminal success not relayed: %d %s", w.Code, w.Body.String()) + } + } + if len(attempts) != 1 || attempts[0].AccountID != accountID || attempts[0].Status != wantStatus || attempts[0].ErrorKind != tc.wantKind { + t.Errorf("expected one %s/%s attempt, got %+v", wantStatus, tc.wantKind, attempts) + } + switch tc.wantKind { + case accounts.KindUnavailable: + if item.LastKind != accounts.KindUnavailable || !item.DownUntil.After(time.Now()) { + t.Errorf("actual truncation did not cool the account: %+v", item) + } + case accounts.KindRateLimit: + if !item.ModelDownUntil[model].After(time.Now().Add(time.Minute)) || !item.DownUntil.IsZero() { + t.Errorf("confirmed limit or retry hint lost: %+v", item) + } + default: + if item.LastKind != "" || !item.DownUntil.IsZero() || len(item.ModelDownUntil) != 0 { + t.Errorf("success/cancellation affected account health: %+v", item) + } + } + if tc.first == "" || mode.name == "native-collect" { + switch tc.wantKind { + case accounts.KindCanceled: + if w.Code != 499 || (mode.name != "messages" && !strings.Contains(w.Body.String(), "request_canceled")) { + t.Errorf("canceled dispatch returned %d: %s", w.Code, w.Body.String()) + } + case accounts.KindRateLimit: + if w.Code != http.StatusTooManyRequests || w.Header().Get("Retry-After") != "79" { + t.Errorf("rate-limited dispatch returned %d %v: %s", w.Code, w.Header(), w.Body.String()) + } + case accounts.KindUnavailable: + if tc.tail == unavailable && w.Code != http.StatusServiceUnavailable { + t.Errorf("confirmed 503 returned %d: %s", w.Code, w.Body.String()) + } + } + } + }) + } + } +} + +func TestNamedAggregationResponsesUsesSelectedMemberProtocol(t *testing.T) { + for _, tc := range []struct { + name string + stream bool + nativeFirst bool + }{ + {name: "chat-selected-stream", stream: true}, + {name: "chat-selected-nonstream"}, + {name: "native-selected-stream", stream: true, nativeFirst: true}, + {name: "native-selected-nonstream", nativeFirst: true}, + } { + t.Run(tc.name, func(t *testing.T) { + const logicalModel = "logical-model" + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: "chat-account", Provider: "workbuddy", Region: "global", Runtime: "in_process", Models: []string{"chat-model"}, MaxInFlight: 1}) + pool.Upsert(executor.Item{ID: "native-account", Provider: "codex", Region: "global", Runtime: "in_process", Models: []string{"native-model"}, MaxInFlight: 1}) + + chat := &namedAggregationResponsesChat{} + var nativeAccounts, nativeInputs, nativeMetadata, nativeModels []string + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) + registry.Register(providers.Adapter{ID: "codex", NativeResponses: nativeRouteAdapter(func(accountID string, req *translate.NativeResponsesRequest, options providers.RequestOptions) (*http.Response, providers.ResolvedChat, error) { + nativeAccounts = append(nativeAccounts, accountID) + nativeInputs = append(nativeInputs, string(req.Fields()["input"])) + nativeMetadata = append(nativeMetadata, string(req.Fields()["metadata"])) + nativeModels = append(nativeModels, options.Model) + data := fmt.Sprintf(`{"type":"response.completed","response":{"id":"native-response","status":"completed","model":%q,"output":[{"type":"message","content":[{"type":"output_text","text":"native-answer"}]}]}}`, options.Model) + body := strings.Join([]string{"event: response.completed", "data: " + data, "", ""}, string(rune(10))) + return &http.Response{StatusCode: http.StatusOK, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body))}, providers.ResolvedChat{}, nil + })}) + + chatPriority, nativePriority := 0, 1 + if tc.nativeFirst { + chatPriority, nativePriority = 1, 0 + } + aggregation := accounts.Aggregation{ID: logicalModel, Enabled: true, Strategy: accounts.AggregationPriority, MaxAttempts: 1, Members: []accounts.AggregationMember{ + {Provider: "workbuddy", Region: "global", Model: "chat-model", Priority: chatPriority}, + {Provider: "codex", Region: "global", Model: "native-model", Priority: nativePriority}, + }} + ex := executor.NewChatExecutor(pool, "") + ex.Providers = registry + h := &Handler{Executor: ex, Pool: pool, Aggregations: testAggregationResolver(func(_ context.Context, id string, _ map[string]bool) (accounts.Aggregation, error) { + if id != logicalModel { + t.Fatalf("aggregation id = %q", id) + } + return aggregation, nil + })} + identity := auth.Identity{Kind: auth.KindKey, KeyID: "native-order", ModelAggregation: true, AllowedProviders: []string{accounts.AggregationProvider}} + input := fmt.Sprintf(`{"model":%q,"stream":%t,"input":"hello","metadata":{"fixture":"keep-me"}}`, logicalModel, tc.stream) + response := callGateway(h.HandleResponses, "/v1/responses", input, identity) + if response.Code != http.StatusOK { + t.Fatalf("Responses status=%d body=%s", response.Code, response.Body.String()) + } + if tc.nativeFirst { + if !reflect.DeepEqual(nativeAccounts, []string{"native-account"}) || !reflect.DeepEqual(nativeModels, []string{"native-model"}) || !strings.Contains(nativeInputs[0], "hello") || !strings.Contains(nativeMetadata[0], "keep-me") { + t.Fatalf("selected native route lost target or raw fields: accounts=%v models=%v inputs=%v metadata=%v", nativeAccounts, nativeModels, nativeInputs, nativeMetadata) + } + if len(chat.streamCalls)+len(chat.nonStreamCalls) != 0 || !strings.Contains(response.Body.String(), "native-answer") { + t.Fatalf("native-selected response used compat path: chat=%+v body=%s", chat, response.Body.String()) + } + } else { + gotCalls := len(chat.streamCalls) + if !tc.stream { + gotCalls = len(chat.nonStreamCalls) + } + if len(nativeAccounts) != 0 || gotCalls != 1 || !strings.Contains(response.Body.String(), "compat-answer") { + t.Fatalf("selected Chat member was bypassed: native=%v chat=%+v body=%s", nativeAccounts, chat, response.Body.String()) + } + } + for _, id := range []string{"chat-account", "native-account"} { + item, ok := pool.ByID(id) + if !ok || item.InFlight != 0 { + t.Fatalf("account slot not released for %s: %+v", id, item) + } + } + }) + } +} + +type namedAggregationResponsesChat struct { + streamCalls []string + nonStreamCalls []string + nonStreamErr error +} + +func (c *namedAggregationResponsesChat) ChatNonStream(_ context.Context, accountID string, req translate.ChatRequest) (providers.ChatOutcome, error) { + c.nonStreamCalls = append(c.nonStreamCalls, accountID+":"+req.Model) + if c.nonStreamErr != nil { + return providers.ChatOutcome{}, c.nonStreamErr + } + return providers.ChatOutcome{Model: req.Model, Content: "compat-answer", FinishReason: "stop", PromptTokens: 1, CompletionTokens: 1}, nil +} + +func (c *namedAggregationResponsesChat) ChatStream(_ context.Context, accountID string, req translate.ChatRequest) (*http.Response, providers.ResolvedChat, error) { + c.streamCalls = append(c.streamCalls, accountID+":"+req.Model) + body := strings.Join([]string{ + `data: {"choices":[{"delta":{"content":"compat-answer"}}]}`, + `data: {"choices":[{"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":1,"completion_tokens":1}}`, + "data: [DONE]", + }, string(rune(10))+string(rune(10))) + return &http.Response{StatusCode: http.StatusOK, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body))}, providers.ResolvedChat{}, nil +} + +func TestNamedAggregationIncompatibleResponsesKeepsNativeHardFilterAndBudget(t *testing.T) { + const logicalModel = "logical-model" + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: "chat-account", Provider: "workbuddy", Region: "global", Runtime: "in_process", Models: []string{"chat-model"}, MaxInFlight: 1}) + pool.Upsert(executor.Item{ID: "native-a", Provider: "codex", Region: "global", Runtime: "in_process", Models: []string{"native-a-model"}, MaxInFlight: 1}) + pool.Upsert(executor.Item{ID: "native-b", Provider: "codex", Region: "global", Runtime: "in_process", Models: []string{"native-b-model"}, MaxInFlight: 1}) + chat := &namedAggregationResponsesChat{} + var nativeAccounts, nativeModels, nativeInputs []string + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) + registry.Register(providers.Adapter{ID: "codex", NativeResponses: nativeRouteAdapter(func(accountID string, req *translate.NativeResponsesRequest, options providers.RequestOptions) (*http.Response, providers.ResolvedChat, error) { + nativeAccounts = append(nativeAccounts, accountID) + nativeModels = append(nativeModels, options.Model) + nativeInputs = append(nativeInputs, string(req.Fields()["input"])) + var body string + if accountID == "native-a" { + body = strings.Join([]string{ + "event: response.failed", + `data: {"type":"response.failed","response":{"status":"failed","error":{"status_code":429,"code":"rate_limit_exceeded","message":"limited"}}}`, + "", + "", + }, string(rune(10))) + } else { + body = strings.Join([]string{ + "event: response.completed", + `data: {"type":"response.completed","response":{"id":"native-ok","status":"completed","model":"native-b-model","output":[]}}`, + "", + "", + }, string(rune(10))) + } + return &http.Response{StatusCode: http.StatusOK, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body))}, providers.ResolvedChat{}, nil + })}) + aggregation := accounts.Aggregation{ID: logicalModel, Enabled: true, Strategy: accounts.AggregationPriority, AllowFallbacks: true, MaxAttempts: 2, Members: []accounts.AggregationMember{ + {Provider: "workbuddy", Region: "global", Model: "chat-model", Priority: 0}, + {Provider: "codex", Region: "global", Model: "native-a-model", Priority: 1}, + {Provider: "codex", Region: "global", Model: "native-b-model", Priority: 2}, + }} + ex := executor.NewChatExecutor(pool, "") + ex.Providers = registry + var attempts []accounts.RequestAttempt + ex.OnAttempt = func(attempt accounts.RequestAttempt) { attempts = append(attempts, attempt) } + h := &Handler{Executor: ex, Pool: pool, Aggregations: testAggregationResolver(func(_ context.Context, id string, _ map[string]bool) (accounts.Aggregation, error) { + if id != logicalModel { + t.Fatalf("aggregation id = %q", id) + } + return aggregation, nil + })} + identity := auth.Identity{Kind: auth.KindKey, KeyID: "native-only", ModelAggregation: true, AllowedProviders: []string{accounts.AggregationProvider}} + response := callGateway(h.HandleResponses, "/v1/responses", `{"model":"logical-model","input":[{"type":"input_file","file_id":"fixture"}]}`, identity) + if response.Code != http.StatusOK || !strings.Contains(response.Body.String(), "native-ok") { + t.Fatalf("incompatible response=%d %s", response.Code, response.Body.String()) + } + if !reflect.DeepEqual(nativeAccounts, []string{"native-a", "native-b"}) || !reflect.DeepEqual(nativeModels, []string{"native-a-model", "native-b-model"}) { + t.Fatalf("native failover targets=%v models=%v", nativeAccounts, nativeModels) + } + if !strings.Contains(nativeInputs[0], "input_file") || len(chat.streamCalls)+len(chat.nonStreamCalls) != 0 { + t.Fatalf("incompatible request lost raw fields or downgraded: inputs=%v chat=%+v", nativeInputs, chat) + } + if len(attempts) != 2 || attempts[0].AccountID != "native-a" || attempts[0].ErrorKind != accounts.KindRateLimit || attempts[1].AccountID != "native-b" || attempts[1].Status != accounts.AttemptStatusOK { + t.Fatalf("native failover did not preserve one shared attempt budget: %+v", attempts) + } + first, _ := pool.ByID("native-a") + if first.InFlight != 0 || !first.ModelDownUntil["native-a-model"].After(time.Now()) { + t.Fatalf("native rate-limit feedback or slot state incorrect: %+v", first) + } + for _, id := range []string{"chat-account", "native-b"} { + item, ok := pool.ByID(id) + if !ok || item.InFlight != 0 || !item.DownUntil.IsZero() { + t.Fatalf("slot/health unexpectedly changed for %s: %+v", id, item) + } + } +} + +func TestNamedAggregationCompatibleResponsesSharesAttemptBudget(t *testing.T) { + const logicalModel = "logical-model" + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: "chat-account", Provider: "workbuddy", Region: "global", Runtime: "in_process", Models: []string{"chat-model"}, MaxInFlight: 1}) + pool.Upsert(executor.Item{ID: "native-account", Provider: "codex", Region: "global", Runtime: "in_process", Models: []string{"native-model"}, MaxInFlight: 1}) + chat := &namedAggregationResponsesChat{nonStreamErr: &providers.Error{Kind: accounts.KindRateLimit, Status: http.StatusTooManyRequests, Code: "rate_limit_exceeded", Message: "busy"}} + var nativeAccounts []string + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Chat: chat}) + registry.Register(providers.Adapter{ID: "codex", NativeResponses: nativeRouteAdapter(func(accountID string, req *translate.NativeResponsesRequest, options providers.RequestOptions) (*http.Response, providers.ResolvedChat, error) { + nativeAccounts = append(nativeAccounts, accountID) + if !strings.Contains(string(req.Fields()["input"]), "hello") || options.Model != "native-model" { + t.Errorf("native failover lost request or target: input=%s model=%s", req.Fields()["input"], options.Model) + } + body := strings.Join([]string{ + "event: response.completed", + `data: {"type":"response.completed","response":{"id":"native-after-chat","status":"completed","model":"native-model","output":[]}}`, + "", + "", + }, string(rune(10))) + return &http.Response{StatusCode: http.StatusOK, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body))}, providers.ResolvedChat{}, nil + })}) + aggregation := accounts.Aggregation{ID: logicalModel, Enabled: true, Strategy: accounts.AggregationPriority, AllowFallbacks: true, MaxAttempts: 2, Members: []accounts.AggregationMember{ + {Provider: "workbuddy", Region: "global", Model: "chat-model", Priority: 0}, + {Provider: "codex", Region: "global", Model: "native-model", Priority: 1}, + }} + ex := executor.NewChatExecutor(pool, "") + ex.Providers = registry + var attempts []accounts.RequestAttempt + ex.OnAttempt = func(attempt accounts.RequestAttempt) { attempts = append(attempts, attempt) } + h := &Handler{Executor: ex, Pool: pool, Aggregations: testAggregationResolver(func(_ context.Context, id string, _ map[string]bool) (accounts.Aggregation, error) { + if id != logicalModel { + t.Fatalf("aggregation id = %q", id) + } + return aggregation, nil + })} + identity := auth.Identity{Kind: auth.KindKey, KeyID: "compatible-failover", ModelAggregation: true, AllowedProviders: []string{accounts.AggregationProvider}} + response := callGateway(h.HandleResponses, "/v1/responses", `{"model":"logical-model","input":"hello"}`, identity) + if response.Code != http.StatusOK || !strings.Contains(response.Body.String(), "native-after-chat") { + t.Fatalf("compatible failover response=%d %s", response.Code, response.Body.String()) + } + if !reflect.DeepEqual(chat.nonStreamCalls, []string{"chat-account:chat-model"}) || len(chat.streamCalls) != 0 || !reflect.DeepEqual(nativeAccounts, []string{"native-account"}) { + t.Fatalf("selected Chat failure did not share group failover: chat=%+v native=%v", chat, nativeAccounts) + } + if len(attempts) != 2 || attempts[0].AttemptIndex != 0 || attempts[0].AccountID != "chat-account" || attempts[0].Status != accounts.AttemptStatusFailover || attempts[0].ErrorKind != accounts.KindRateLimit || attempts[1].AttemptIndex != 1 || attempts[1].AccountID != "native-account" || attempts[1].Status != accounts.AttemptStatusOK { + t.Fatalf("attempt budget/target sequence = %+v", attempts) + } + for _, id := range []string{"chat-account", "native-account"} { + item, ok := pool.ByID(id) + if !ok || item.InFlight != 0 { + t.Fatalf("slot not released for %s: %+v", id, item) + } + } +} diff --git a/internal/gateway/stream_heartbeat.go b/internal/gateway/stream_heartbeat.go index 98e2baad4..3322d19d5 100644 --- a/internal/gateway/stream_heartbeat.go +++ b/internal/gateway/stream_heartbeat.go @@ -69,15 +69,10 @@ func resolveMillisEnv(name string, fallback, floor time.Duration) time.Duration // streamHeartbeat owns the early-commit decision and the comment-frame pump. // -// Three goroutines can touch the ResponseWriter over the life of a request: the -// handler itself, the heartbeat timer, and the pump. net/http does not make -// ResponseWriter safe for concurrent use, so every write goes through writeMu: -// -// - the pump writes comment frames under writeMu; -// - handoff closes stop and then waits for pumpDone, so it returns only after -// the in-flight heartbeat write finished and no further one can start; -// - after handoff the handler owns the writer exclusively, and the pump has -// provably stopped. +// The timer callback and the handler arbitrate ownership under mu. The timer +// owns the writer only if it starts before handoff retires it. The callback +// serially commits the headers and writes heartbeats, and handoff waits for +// it to finish before returning the writer to the handler. // // A nil *streamHeartbeat is a valid no-op value, which is what a writer that // cannot flush gets. @@ -87,28 +82,14 @@ type streamHeartbeat struct { after time.Duration interval time.Duration - // writeMu serialises writes to w between the timer's commit and the pump. - writeMu sync.Mutex - - mu sync.Mutex - state heartbeatState - timer *time.Timer - stop chan struct{} - pumpDone chan struct{} - committed chan struct{} - writeErr error + mu sync.Mutex + retired bool + timer *time.Timer + stop chan struct{} + done chan struct{} // non-nil once the callback claims the writer + writeErr error } -type heartbeatState int - -const ( - heartbeatIdle heartbeatState = iota - heartbeatCommitting - heartbeatCommitted - heartbeatAdopted - heartbeatAbandoned -) - // newStreamHeartbeat returns nil when the writer cannot flush, which leaves the // original behaviour untouched. func newStreamHeartbeat(w http.ResponseWriter) *streamHeartbeat { @@ -129,11 +110,10 @@ func newStreamHeartbeatWith(w http.ResponseWriter, after, interval time.Duration interval = defaultHeartbeatInterval } return &streamHeartbeat{ - w: w, - flusher: flusher, - after: after, - interval: interval, - committed: make(chan struct{}), + w: w, + flusher: flusher, + after: after, + interval: interval, } } @@ -145,108 +125,65 @@ func (h *streamHeartbeat) Arm(setHeaders func()) { return } h.mu.Lock() - if h.state != heartbeatIdle { - h.mu.Unlock() + defer h.mu.Unlock() + if h.retired || h.timer != nil { return } h.timer = time.AfterFunc(h.after, func() { h.mu.Lock() - if h.state != heartbeatIdle { + if h.retired { h.mu.Unlock() return } - h.state = heartbeatCommitting h.stop = make(chan struct{}) - h.pumpDone = make(chan struct{}) + h.done = make(chan struct{}) h.mu.Unlock() + defer close(h.done) - h.writeMu.Lock() setHeaders() h.w.WriteHeader(http.StatusOK) h.flusher.Flush() - h.writeMu.Unlock() - - h.mu.Lock() - h.state = heartbeatCommitted - h.mu.Unlock() - close(h.committed) - h.pump() - close(h.pumpDone) }) - h.mu.Unlock() } // Adopt hands the response to the real relay. It reports whether the timer had // already committed the headers, in which case the caller must not set headers // or call WriteHeader again. func (h *streamHeartbeat) Adopt() bool { - return h.handoff(heartbeatAdopted) + return h.handoff() } // Abandon retires the heartbeat on the error path and reports whether the // headers were already committed. When they were, the failure can only be // reported as an in-stream error event. func (h *streamHeartbeat) Abandon() bool { - return h.handoff(heartbeatAbandoned) + return h.handoff() } -// handoff retires the heartbeat. When the headers were committed it blocks -// until the pump has exited, so the caller owns the writer exclusively. -func (h *streamHeartbeat) handoff(next heartbeatState) bool { +// handoff retires the timer and checks ownership in the same critical section; +// otherwise the timer could claim the writer between the check and retirement. +func (h *streamHeartbeat) handoff() bool { if h == nil { return false } h.mu.Lock() - state := h.state - stop := h.stop - committed := h.committed - pumpDone := h.pumpDone - h.mu.Unlock() - - switch state { - case heartbeatIdle: - // The timer never fired. Flip the state first: a late callback - // re-checks it under the same mutex and bails out before writing. - h.mu.Lock() - if h.state == heartbeatIdle { - h.state = next - } - h.mu.Unlock() - if h.timer != nil { + done := h.done + if !h.retired { + h.retired = true + if done != nil { + close(h.stop) + } else if h.timer != nil { h.timer.Stop() } - return false - case heartbeatCommitting, heartbeatCommitted: - if stop != nil { - select { - case <-stop: - default: - close(stop) - } - } - // committed is closed once the headers are on the wire; pumpDone once - // the pump has stopped writing. Waiting on pumpDone is what makes the - // handoff race-free. Both are created by the timer callback before it - // publishes heartbeatCommitting, so they are non-nil whenever this - // branch runs. - if committed != nil { - <-committed - } - if pumpDone != nil { - <-pumpDone - } - h.mu.Lock() - h.state = next - h.mu.Unlock() - if h.timer != nil { - h.timer.Stop() - } - return true - default: - // Already adopted or abandoned: the timer never committed headers. - return false } + h.mu.Unlock() + + if done != nil { + // This includes any in-progress initial commit, not just the pump. + <-done + } + return done != nil } // pump emits comment frames until handoff closes stop. @@ -258,12 +195,10 @@ func (h *streamHeartbeat) pump() { case <-h.stop: return case <-ticker.C: - h.writeMu.Lock() _, err := io.WriteString(h.w, ": keepalive\n\n") if err == nil { h.flusher.Flush() } - h.writeMu.Unlock() if err != nil { h.mu.Lock() if h.writeErr == nil { diff --git a/internal/gateway/stream_heartbeat_followup_test.go b/internal/gateway/stream_heartbeat_followup_test.go index 24bf0cffc..723869863 100644 --- a/internal/gateway/stream_heartbeat_followup_test.go +++ b/internal/gateway/stream_heartbeat_followup_test.go @@ -17,71 +17,59 @@ import ( applogs "github.com/caigee-cmd/cli2api/internal/logs" ) -// When the heartbeat commits before the upstream head arrives, the client must -// still see the account and provider headers on the response. -func TestHeartbeatCommitsAccountHeadersOnLiveStream(t *testing.T) { +// A direct provider request also omits unconfirmed identity after an early +// commit, but the heartbeat still keeps the connection alive for the answer. +func TestHeartbeatKeepsSlowStreamWithoutUnconfirmedIdentity(t *testing.T) { + allowUpstream := make(chan struct{}) upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - time.Sleep(3 * time.Second) + select { + case <-allowUpstream: + case <-r.Context().Done(): + return + } w.Header().Set("Content-Type", "text/event-stream; charset=utf-8") - w.WriteHeader(http.StatusOK) - flusher := w.(http.Flusher) - _, _ = w.Write([]byte(`data: {"choices":[{"index":0,"delta":{"content":"ok"},"finish_reason":null}]}` + "\n\n")) - flusher.Flush() - _, _ = w.Write([]byte("data: [DONE]\n\n")) - flusher.Flush() + _, _ = io.WriteString(w, `data: {"choices":[{"index":0,"delta":{"content":"ok"},"finish_reason":null}]}`+"\n\ndata: [DONE]\n\n") })) defer upstream.Close() - t.Setenv(heartbeatEnvAfter, "150") - t.Setenv(heartbeatEnvInterval, "100") + t.Setenv(heartbeatEnvAfter, "1000") + t.Setenv(heartbeatEnvInterval, "1000") handler, closeAll := newHeartbeatFollowupHandler(t, upstream.URL, nil) defer closeAll() gateway := httptest.NewServer(handler) defer gateway.Close() + allow := sync.OnceFunc(func() { close(allowUpstream) }) + defer allow() - resp, err := http.Post(gateway.URL+"/v1/chat/completions", "application/json", + client := gateway.Client() + client.Timeout = 8 * time.Second + resp, err := client.Post(gateway.URL+"/v1/chat/completions", "application/json", strings.NewReader(`{"model":"qoder/mock","stream":true,"messages":[{"role":"user","content":"hi"}]}`)) if err != nil { t.Fatalf("request failed: %v", err) } defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - body, _ := io.ReadAll(resp.Body) - t.Fatalf("status = %d, body = %s", resp.StatusCode, body) - } - if got := resp.Header.Get("X-CLI2API-Account"); got != "acct" { - t.Fatalf("X-CLI2API-Account = %q, want acct", got) - } - if got := resp.Header.Get("X-Qoder-Account"); got != "acct" { - t.Fatalf("X-Qoder-Account = %q, want acct", got) - } - if got := resp.Header.Get("X-CLI2API-Provider"); got != "qoder" { - t.Fatalf("X-CLI2API-Provider = %q, want qoder", got) + if resp.StatusCode != http.StatusOK || !strings.HasPrefix(resp.Header.Get("Content-Type"), "text/event-stream") { + t.Fatalf("status = %d, headers = %v", resp.StatusCode, resp.Header) + } + // The upstream has not returned, so the final routed account is not yet + // known; keep the early heartbeat identity-free to remain correct on retry. + for _, key := range []string{"X-CLI2API-Account", "X-Qoder-Account", "X-CLI2API-Provider"} { + if got := resp.Header.Values(key); len(got) != 0 { + t.Errorf("early heartbeat sent unconfirmed %s header values: %v", key, got) + } } - sawKeepalive, sawDone := false, false reader := bufio.NewReader(resp.Body) - deadline := time.Now().Add(5 * time.Second) - for time.Now().Before(deadline) { - line, err := reader.ReadString('\n') - if strings.HasPrefix(line, ": keepalive") { - sawKeepalive = true - } - if strings.HasPrefix(line, "data: [DONE]") { - sawDone = true - break - } - if err != nil { - break - } - } - if !sawKeepalive { - t.Fatal("expected a heartbeat frame before the upstream body, otherwise this did not test the early-commit path") + if line, err := reader.ReadString('\n'); err != nil || line != ": keepalive\n" { + t.Fatalf("expected a heartbeat before releasing the upstream, got %q (%v)", line, err) } - if !sawDone { - t.Fatal("stream did not complete") + allow() + body, err := io.ReadAll(reader) + if err != nil || !strings.Contains(string(body), `"content":"ok"`) || !strings.Contains(string(body), "data: [DONE]") { + t.Fatalf("stream did not complete: %s (%v)", body, err) } } diff --git a/internal/gateway/stream_heartbeat_test.go b/internal/gateway/stream_heartbeat_test.go index f46086289..155579587 100644 --- a/internal/gateway/stream_heartbeat_test.go +++ b/internal/gateway/stream_heartbeat_test.go @@ -6,6 +6,7 @@ import ( "strings" "sync" "testing" + "testing/synctest" "time" ) @@ -103,23 +104,21 @@ func TestHeartbeatCommitsHeadersWhileUpstreamHeadIsPending(t *testing.T) { // A fast upstream must keep the plain HTTP-status path: the timer is disarmed, // nothing is written, and the caller still owns the response. func TestHeartbeatDoesNotCommitBeforeDeadline(t *testing.T) { - w := newRecordingWriter() - h := newStreamHeartbeatWith(w, 5*time.Second, time.Second) - h.Arm(headerFunc(w)) - - if committed := h.Adopt(); committed { - t.Fatal("Adopt reported a commit, but the timer had not fired") - } - status, body, _, _ := w.snapshot() - if status != 0 || body != "" { - t.Fatalf("writer touched before the deadline: status=%d body=%q", status, body) - } - - // Prove the timer really was disarmed rather than merely late. - time.Sleep(80 * time.Millisecond) - if status, _, _, _ := w.snapshot(); status != 0 { - t.Fatalf("timer wrote headers after Adopt, status=%d", status) - } + synctest.Test(t, func(t *testing.T) { + w := newRecordingWriter() + h := newStreamHeartbeatWith(w, time.Second, time.Second) + h.Arm(headerFunc(w)) + + if h.Adopt() { + t.Fatal("Adopt reported a commit, but the timer had not fired") + } + // Advance past the deadline to distinguish a retired timer from a late one. + time.Sleep(2 * time.Second) + synctest.Wait() + if status, body, _, flushes := w.snapshot(); status != 0 || body != "" || flushes != 0 { + t.Fatalf("timer wrote after Adopt: status=%d body=%q flushes=%d", status, body, flushes) + } + }) } // The error path needs to know whether it can still answer with a status code. @@ -172,30 +171,35 @@ func TestHeartbeatDisabledWithoutFlusher(t *testing.T) { // The pump must stop once the relay takes over, otherwise it would keep // writing comment frames into a response body that already has real chunks. func TestHeartbeatPumpStopsAfterAdopt(t *testing.T) { - w := newRecordingWriter() - h := newStreamHeartbeatWith(w, 30*time.Millisecond, 10*time.Millisecond) - h.Arm(headerFunc(w)) - time.Sleep(90 * time.Millisecond) - - if !h.Adopt() { - t.Fatal("expected a commit") - } - _, _, writesAtAdopt, _ := w.snapshot() - writesAtAdopt = append([]time.Duration(nil), writesAtAdopt...) - - time.Sleep(120 * time.Millisecond) - _, _, writesLater, _ := w.snapshot() - if len(writesLater) > len(writesAtAdopt)+1 { - t.Fatalf("pump kept writing after Adopt: %d writes at adopt, %d later", - len(writesAtAdopt), len(writesLater)) - } + synctest.Test(t, func(t *testing.T) { + w := newRecordingWriter() + h := newStreamHeartbeatWith(w, time.Second, time.Second) + h.Arm(headerFunc(w)) + time.Sleep(3 * time.Second) + synctest.Wait() + + if !h.Adopt() { + t.Fatal("expected a commit") + } + _, _, writesAtAdopt, _ := w.snapshot() + if len(writesAtAdopt) == 0 { + t.Fatal("the pump did not write before Adopt") + } + + time.Sleep(3 * time.Second) + synctest.Wait() + _, _, writesLater, _ := w.snapshot() + if len(writesLater) != len(writesAtAdopt) { + t.Fatalf("pump kept writing after Adopt: %d writes at adopt, %d later", len(writesAtAdopt), len(writesLater)) + } + }) } // A heartbeat write failure means the client is gone; record it instead of // spinning. func TestHeartbeatRecordsClientWriteError(t *testing.T) { w := newRecordingWriter() - w.writeErr = errWriteClosed + w.writeErr = http.ErrHandlerTimeout h := newStreamHeartbeatWith(w, 30*time.Millisecond, 10*time.Millisecond) h.Arm(headerFunc(w)) time.Sleep(90 * time.Millisecond) @@ -208,30 +212,44 @@ func TestHeartbeatRecordsClientWriteError(t *testing.T) { } } -var errWriteClosed = &StreamRelayWriteError{err: http.ErrHandlerTimeout} - -// Identity headers registered in setHeaders must already be on the writer when -// the timer commits, because WriteHeader is the last chance to send them. -func TestHeartbeatCommitsAccountProviderHeaders(t *testing.T) { - w := newRecordingWriter() - h := newStreamHeartbeatWith(w, 40*time.Millisecond, 20*time.Millisecond) - h.Arm(func() { - w.Header().Set("Content-Type", "text/event-stream; charset=utf-8") - w.Header().Set("X-Qoder-Account", "acct-1") - w.Header().Set("X-CLI2API-Account", "acct-1") - w.Header().Set("X-CLI2API-Provider", "qoder") - }) - time.Sleep(120 * time.Millisecond) - if !h.Adopt() { - t.Fatal("expected the headers to be committed") - } - if got := w.header.Get("X-CLI2API-Account"); got != "acct-1" { - t.Fatalf("X-CLI2API-Account = %q, want acct-1", got) - } - if got := w.header.Get("X-Qoder-Account"); got != "acct-1" { - t.Fatalf("X-Qoder-Account = %q, want acct-1", got) - } - if got := w.header.Get("X-CLI2API-Provider"); got != "qoder" { - t.Fatalf("X-CLI2API-Provider = %q, want qoder", got) +func TestHeartbeatHandoffWaitsForCommit(t *testing.T) { + for _, tc := range []struct { + name string + handoff func(*streamHeartbeat) bool + }{ + {"adopt", (*streamHeartbeat).Adopt}, + {"abandon", (*streamHeartbeat).Abandon}, + } { + t.Run(tc.name, func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + w := newRecordingWriter() + h := newStreamHeartbeatWith(w, time.Second, time.Second) + committing, releaseCommit := make(chan struct{}), make(chan struct{}) + h.Arm(func() { + close(committing) + <-releaseCommit + headerFunc(w)() + }) + <-committing + + returned := make(chan bool, 1) + go func() { returned <- tc.handoff(h) }() + synctest.Wait() + select { + case committed := <-returned: + close(releaseCommit) + t.Fatalf("handoff returned %t during the initial SSE commit", committed) + default: + } + + close(releaseCommit) + if !<-returned { + t.Fatal("handoff missed the committed SSE response") + } + if status, body, _, flushes := w.snapshot(); status != http.StatusOK || body != "" || flushes != 1 { + t.Fatalf("unexpected writes: status=%d body=%q flushes=%d", status, body, flushes) + } + }) + }) } } diff --git a/internal/gateway/stream_route_identity_test.go b/internal/gateway/stream_route_identity_test.go new file mode 100644 index 000000000..29e5dca3a --- /dev/null +++ b/internal/gateway/stream_route_identity_test.go @@ -0,0 +1,183 @@ +package gateway + +import ( + "bufio" + "context" + "io" + "net/http" + "net/http/httptest" + "slices" + "strings" + "sync" + "testing" + "time" + + "github.com/caigee-cmd/cli2api/internal/accounts" + "github.com/caigee-cmd/cli2api/internal/auth" + "github.com/caigee-cmd/cli2api/internal/executor" + "github.com/caigee-cmd/cli2api/internal/providers" + "github.com/caigee-cmd/cli2api/internal/translate" +) + +type streamRouteTestCatalog map[string]accounts.Aggregation + +func (c streamRouteTestCatalog) Resolve(_ context.Context, id string, _ map[string]bool) (accounts.Aggregation, error) { + agg, ok := c[id] + if !ok { + return accounts.Aggregation{}, accounts.ErrAggregationNotFound + } + return agg, nil +} + +func (c streamRouteTestCatalog) Catalog(context.Context) (map[string]accounts.Aggregation, error) { + return c, nil +} + +type streamRouteTestAdapter func(context.Context, string, translate.ChatRequest) (*http.Response, error) + +func (f streamRouteTestAdapter) ChatNonStream(context.Context, string, translate.ChatRequest) (providers.ChatOutcome, error) { + return providers.ChatOutcome{}, providers.ErrUnsupported +} + +func (f streamRouteTestAdapter) ChatStream(ctx context.Context, id string, req translate.ChatRequest) (*http.Response, providers.ResolvedChat, error) { + resp, err := f(ctx, id, req) + return resp, providers.ResolvedChat{}, err +} + +func TestOpenAIStreamRouteIdentityWithNamedGroup(t *testing.T) { + const primaryID, backupID = "synthetic-primary", "synthetic-backup" + const rootID, tierID = "chat-route", "first-tier" + const pipeline = `{"version":1,"steps":[ + {"id":"first","kind":"group","aggregation_id":"first-tier"}, + {"id":"second","kind":"member","provider":"workbuddy","region":"cn","model":"backup-model"}]}` + + for _, tc := range []struct { + name string + early, fallback bool + }{ + {name: "early failover", early: true, fallback: true}, + {name: "fast failover", fallback: true}, + {name: "early terminal failure", early: true}, + {name: "fast terminal failure"}, + } { + t.Run(tc.name, func(t *testing.T) { + t.Setenv(heartbeatEnvInterval, "1000") + if tc.early { + t.Setenv(heartbeatEnvAfter, "1000") + } else { + t.Setenv(heartbeatEnvAfter, "60000") + } + + // Run the real handler and executor with a named priority group + // that tries its account before a separate fallback provider. + pool := executor.NewPool(nil, nil) + pool.Upsert(executor.Item{ID: primaryID, Provider: "qoder", Region: "global", Runtime: "in_process", Models: []string{"primary-model"}}) + pool.Upsert(executor.Item{ID: backupID, Provider: "workbuddy", Region: "cn", Runtime: "in_process", Models: []string{"backup-model"}}) + catalog := streamRouteTestCatalog{ + rootID: {ID: rootID, Enabled: true, Strategy: accounts.AggregationPriority, AllowFallbacks: tc.fallback, MaxAttempts: 2, Document: pipeline}, + tierID: {ID: tierID, Enabled: true, Strategy: accounts.AggregationPriority, Members: []accounts.AggregationMember{ + {AccountID: primaryID, Provider: "qoder", Region: "global", Model: "primary-model", Weight: 1}, + }}, + } + + primaryStarted := make(chan struct{}) + releasePrimary := make(chan struct{}) + unblock := sync.OnceFunc(func() { close(releasePrimary) }) + if !tc.early { + unblock() + } + var calls []string + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "qoder", Chat: streamRouteTestAdapter(func(ctx context.Context, id string, req translate.ChatRequest) (*http.Response, error) { + calls = append(calls, id+"/"+req.Model) + close(primaryStarted) + select { + case <-ctx.Done(): + return nil, ctx.Err() + case <-releasePrimary: + return nil, &providers.Error{Kind: accounts.KindRateLimit, Status: http.StatusTooManyRequests, Code: "rate_limit_exceeded", Message: "synthetic primary rate limit"} + } + })}) + registry.Register(providers.Adapter{ID: "workbuddy", Chat: streamRouteTestAdapter(func(_ context.Context, id string, req translate.ChatRequest) (*http.Response, error) { + calls = append(calls, id+"/"+req.Model) + body := `data: {"choices":[{"index":0,"delta":{"content":"served-by-backup"}}]}` + "\n\ndata: [DONE]\n\n" + return &http.Response{StatusCode: http.StatusOK, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body))}, nil + })}) + ex := executor.NewChatExecutor(pool, "") + ex.Providers = registry + h := &Handler{Executor: ex, Pool: pool, Aggregations: catalog} + identity := auth.Identity{Kind: auth.KindKey, KeyID: "synthetic-route-key", ModelAggregation: true, AllowedProviders: []string{accounts.AggregationProvider}} + handled := make(chan struct{}) + mux := http.NewServeMux() + mux.HandleFunc("/v1/chat/completions", func(w http.ResponseWriter, r *http.Request) { + defer close(handled) + h.HandleChatCompletions(w, r.WithContext(auth.WithIdentity(r.Context(), identity))) + }) + server := httptest.NewServer(mux) + defer server.Close() + defer unblock() + client := server.Client() + client.Timeout = 8 * time.Second + resp, err := client.Post(server.URL+"/v1/chat/completions", "application/json", strings.NewReader( + `{"model":"chat-route","messages":[{"role":"user","content":"hello"}],"stream":true}`)) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + reader := bufio.NewReader(resp.Body) + if tc.early { + first, err := reader.ReadString('\n') + if err != nil || first != ": keepalive\n" { + t.Fatalf("expected a heartbeat ahead of the blocked upstream, got %q (%v)", first, err) + } + select { + case <-primaryStarted: + default: + t.Fatal("the heartbeat must land after selecting the named group primary") + } + unblock() + } + body, err := io.ReadAll(reader) + if err != nil { + t.Fatal(err) + } + <-handled + + wantStatus := http.StatusOK + wantType, wantAccount, wantProvider := "text/event-stream", "", "" + wantCalls := []string{primaryID + "/primary-model"} + if tc.fallback { + wantCalls = append(wantCalls, backupID+"/backup-model") + if !strings.Contains(string(body), "served-by-backup") || !strings.Contains(string(body), "data: [DONE]") { + t.Fatalf("did not relay the backup answer and terminal event: %s", body) + } + if !tc.early { + wantAccount, wantProvider = backupID, "workbuddy" + } + } else { + if !tc.early { + wantStatus = http.StatusTooManyRequests + wantType = "application/json" + } + if !strings.Contains(string(body), `"code":"rate_limit_exceeded"`) || strings.Contains(string(body), "[DONE]") { + t.Fatalf("missing expected terminal rate-limit error: %s", body) + } + if tc.early && strings.Count(string(body), `data: {"error":`) != 1 { + t.Fatalf("want a single error event, got: %s", body) + } + } + if !slices.Equal(calls, wantCalls) { + t.Fatalf("dispatched %v, want %v", calls, wantCalls) + } + if resp.StatusCode != wantStatus || !strings.HasPrefix(resp.Header.Get("Content-Type"), wantType) || resp.Header.Get("X-Request-Id") == "" { + t.Fatalf("unexpected response: status=%d headers=%v body=%s", resp.StatusCode, resp.Header, body) + } + for k, want := range map[string]string{"X-CLI2API-Account": wantAccount, "X-Qoder-Account": wantAccount, "X-CLI2API-Provider": wantProvider} { + got := resp.Header.Values(k) + if (want == "" && len(got) != 0) || (want != "" && !slices.Equal(got, []string{want})) { + t.Errorf("%s = %q, want %q; response body = %s", k, got, want, body) + } + } + }) + } +} diff --git a/internal/gateway/stream_terminal_test.go b/internal/gateway/stream_terminal_test.go new file mode 100644 index 000000000..ba8040842 --- /dev/null +++ b/internal/gateway/stream_terminal_test.go @@ -0,0 +1,102 @@ +package gateway + +import ( + "io" + "net/http/httptest" + "strings" + "testing" + + "github.com/caigee-cmd/cli2api/internal/accounts" +) + +const chatStreamText = `data: {"choices":[{"delta":{"content":"hello"}}]}` + "\n\n" +const chatStreamFinish = `data: {"choices":[{"delta":{},"finish_reason":"stop"}]}` + "\n\n" +const chatStreamUsage = `data: {"usage":{"prompt_tokens":7,"completion_tokens":3}}` + "\n\n" +const chatStreamDone = "data: [DONE]\n\n" + +var chatStreamRelays = []struct { + name, terminal string + relay func(*httptest.ResponseRecorder, io.Reader) (StreamRelayStats, error) +}{ + {"openai", chatStreamDone, func(w *httptest.ResponseRecorder, body io.Reader) (StreamRelayStats, error) { + return RelayOpenAIStream(w, body) + }}, + {"anthropic", "event: message_stop\n", func(w *httptest.ResponseRecorder, body io.Reader) (StreamRelayStats, error) { + return RelayAnthropicStream(w, body, "req", "model") + }}, + {"responses", "event: response.completed\n", func(w *httptest.ResponseRecorder, body io.Reader) (StreamRelayStats, error) { + return RelayResponsesStream(w, body, "req", "model", nil) + }}, +} + +func TestChatStreamRelaysStopAtDone(t *testing.T) { + for _, tc := range chatStreamRelays { + t.Run(tc.name, func(t *testing.T) { + tail := &unexpectedEOFReader{} + upstream := io.MultiReader(strings.NewReader(chatStreamText+chatStreamFinish+chatStreamUsage+chatStreamDone), tail) + w := httptest.NewRecorder() + stats, err := tc.relay(w, upstream) + if err != nil || tail.read || !stats.SawDone || strings.Count(w.Body.String(), tc.terminal) != 1 { + t.Fatalf("err=%v readTail=%t done=%t body=%s", err, tail.read, stats.SawDone, w.Body.String()) + } + if derefInt(stats.PromptTokens) != 7 || derefInt(stats.CompletionTokens) != 3 { + t.Fatalf("usage before [DONE] was not preserved: %+v", stats) + } + }) + } +} + +func TestChatStreamRelaysKeepMissingDoneBehavior(t *testing.T) { + for _, tc := range chatStreamRelays { + t.Run(tc.name, func(t *testing.T) { + w := httptest.NewRecorder() + stats, err := tc.relay(w, strings.NewReader(chatStreamText+chatStreamFinish)) + if tc.name == "openai" { + if err != nil || !stats.SawDone || strings.Count(w.Body.String(), tc.terminal) != 1 { + t.Fatalf("raw relay should synthesize [DONE]: err=%v done=%t body=%s", err, stats.SawDone, w.Body.String()) + } + } else if err == nil || ClassifyAPIError(err).Code != "upstream_stream_incomplete" || stats.SawDone || strings.Contains(w.Body.String(), tc.terminal) { + t.Fatalf("compatibility relay must require [DONE]: err=%v done=%t body=%s", err, stats.SawDone, w.Body.String()) + } + }) + } +} + +func TestChatStreamRelaysStopAtUpstreamError(t *testing.T) { + for _, tc := range chatStreamRelays { + t.Run(tc.name, func(t *testing.T) { + const upstreamError = "event: error\n" + `data: {"error":{"code":"rate_limit_exceeded","message":"slow down"}}` + "\n\n" + tail := &unexpectedEOFReader{} + upstream := io.MultiReader(strings.NewReader(chatStreamText+upstreamError), tail) + w := httptest.NewRecorder() + stats, err := tc.relay(w, upstream) + if err == nil || ClassifyAPIError(err).Kind != accounts.KindRateLimit || tail.read || stats.SawDone { + t.Fatalf("want original rate limit without reading past it: err=%v readTail=%t done=%t body=%s", err, tail.read, stats.SawDone, w.Body.String()) + } + if tc.name == "openai" && strings.Count(w.Body.String(), "rate_limit_exceeded") != 1 { + t.Fatalf("raw relay should write the upstream failure once: %s", w.Body.String()) + } + if strings.Contains(w.Body.String(), tc.terminal) { + t.Fatalf("relay emitted a success frame after failure: %s", w.Body.String()) + } + }) + } +} + +type rejectDoneWriter struct{ *httptest.ResponseRecorder } + +func (w rejectDoneWriter) Write(p []byte) (int, error) { + if strings.Contains(string(p), "[DONE]") { + return 0, io.ErrClosedPipe + } + return w.ResponseRecorder.Write(p) +} + +func TestOpenAIStreamDoesNotMarkUnwrittenDone(t *testing.T) { + w := rejectDoneWriter{httptest.NewRecorder()} + tail := &unexpectedEOFReader{} + stats, err := RelayOpenAIStream(w, io.MultiReader(strings.NewReader(chatStreamText+chatStreamDone), tail)) + if !IsStreamClientDisconnect(err) || stats.SawDone || tail.read { + t.Fatalf("want a write failure without a terminal marker: err=%v done=%t readTail=%t", err, stats.SawDone, tail.read) + } +} diff --git a/internal/providers/client_ua.go b/internal/providers/client_ua.go index 419e9a1ad..f0672e346 100644 --- a/internal/providers/client_ua.go +++ b/internal/providers/client_ua.go @@ -34,16 +34,12 @@ func ClientUserAgentFromContext(ctx context.Context) string { // WithConversation records the gateway session key so a provider can keep one // upstream conversation id across the turns of a chat. Routing still owns the -// key; this only carries it. +// key; this only carries it. An empty key clears any inherited conversation. func WithConversation(ctx context.Context, key string) context.Context { if ctx == nil { ctx = context.Background() } - key = strings.TrimSpace(key) - if key == "" { - return ctx - } - return context.WithValue(ctx, conversationKey{}, key) + return context.WithValue(ctx, conversationKey{}, strings.TrimSpace(key)) } // ConversationFromContext returns the session key set by WithConversation, or diff --git a/internal/providers/trae/checkin.go b/internal/providers/trae/checkin.go index 58b9bc3e5..1e886293d 100644 --- a/internal/providers/trae/checkin.go +++ b/internal/providers/trae/checkin.go @@ -32,6 +32,8 @@ func (AlreadyCheckedInError) AlreadyCheckedIn() bool { return true } // re-probe so success is only reported when the account actually flipped. // "今日已签到" maps to Status="already"; session-dead surfaces KindAuth so the // manager can flag the account for re-login. +var checkinNow = time.Now + func (client *Client) Checkin(ctx context.Context, accountID string) (providers.CheckinResult, error) { credential, err := client.credential(ctx, accountID) if err != nil { @@ -62,7 +64,7 @@ func (client *Client) Checkin(ctx context.Context, accountID string) (providers. if errors.As(err, &already) { // The claim endpoint may replay yesterday's grant during the brief // post-midnight window; do not record that as today's success. - if providers.CheckinClaimProvisional(time.Now()) { + if providers.CheckinClaimProvisional(checkinNow()) { return providers.CheckinResult{Status: "unknown", Message: "上游日界尚未确认,稍后复核"}, nil } return providers.CheckinResult{Status: "already", Message: already.Msg}, nil diff --git a/internal/providers/trae/checkin_test.go b/internal/providers/trae/checkin_test.go index 463531fd2..0c39cbbf3 100644 --- a/internal/providers/trae/checkin_test.go +++ b/internal/providers/trae/checkin_test.go @@ -8,6 +8,7 @@ import ( "net/http" "strings" "testing" + "time" ) // seedCheckinCredential stores a long-lived Trae credential so Checkin does @@ -114,6 +115,9 @@ func TestCheckinAlreadyByBusinessMessage(t *testing.T) { } func TestCheckinClaimAlreadyRace(t *testing.T) { + oldNow := checkinNow + checkinNow = func() time.Time { return time.Date(2026, 1, 2, 12, 0, 0, 0, time.Local) } + defer func() { checkinNow = oldNow }() client, store := newTestClient(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") switch r.URL.Path { diff --git a/internal/runtime/checkin_status_test.go b/internal/runtime/checkin_status_test.go index f2d434cb9..0292bf0f9 100644 --- a/internal/runtime/checkin_status_test.go +++ b/internal/runtime/checkin_status_test.go @@ -186,11 +186,15 @@ func TestSyncCheckinStatusDoesNotOverwriteCheckinFinishedDuringProbe(t *testing. } func TestSyncCheckinStatusUnknownKeepsRealLocalSuccess(t *testing.T) { + oldNow := checkinStatusNow + fakeNow := time.Date(2026, 1, 2, 12, 0, 0, 0, time.UTC) + checkinStatusNow = func() time.Time { return fakeNow } + defer func() { checkinStatusNow = oldNow }() manager, account := newStatusManager(t, checkinStatusFunc(func(context.Context, string) (providers.CheckinResult, error) { // A provisional rollover answer: the provider cannot yet confirm today. return providers.CheckinResult{Status: "unknown", Message: "上游日界尚未确认,稍后复核", EarliestCheckin: "00:00"}, nil })) - old := time.Now().UTC().Add(-2 * time.Hour) + old := fakeNow.Add(-2 * time.Hour) if err := manager.store.RecordCheckin(context.Background(), account.ID, "success", "claimed earlier", old); err != nil { t.Fatal(err) } diff --git a/internal/runtime/manager_fefo.go b/internal/runtime/manager_fefo.go index 767396925..d45dbab16 100644 --- a/internal/runtime/manager_fefo.go +++ b/internal/runtime/manager_fefo.go @@ -5,12 +5,30 @@ import ( "time" ) -// RefreshFEFOQuotaAfterUse invalidates a trusted credit balance after the whole -// response (including an SSE body) finishes. It never waits on upstream quota in -// the request path. Concurrent completions share one fetch; a completion during -// that fetch requests one trailing fetch so its consumption is not lost. +// RefreshFEFOQuotaAfterUse is the legacy entry point for a public model under +// the global FEFO strategy. func (m *Manager) RefreshFEFOQuotaAfterUse(accountID, publicModel string) { - if m == nil || m.pool == nil || m.runCtx == nil || !m.pool.HasFEFOQuota(accountID, publicModel) { + if m == nil || m.pool == nil || !m.pool.HasFEFOQuota(accountID, publicModel) { + return + } + m.queueFEFOQuotaAfterUse(accountID) +} + +// RefreshRouteQuotaAfterUse requests an asynchronous refresh after the whole +// response (including any SSE body) finishes. The model key and aggregate +// FEFO flag describe the actual dispatch, not the public model or other seats. +func (m *Manager) RefreshRouteQuotaAfterUse(accountID, concreteModel string, aggregateFEFO bool) { + if m == nil || m.pool == nil || !m.pool.HasRouteFEFOQuota(accountID, concreteModel, aggregateFEFO) { + return + } + m.queueFEFOQuotaAfterUse(accountID) +} + +// Admission is per completion; fetching and coalescing are per account. An +// admitted completion during a fetch requests one trailing fetch, even if its +// model or strategy differs from the one that started the worker. +func (m *Manager) queueFEFOQuotaAfterUse(accountID string) { + if m.runCtx == nil { return } m.mu.Lock() @@ -33,7 +51,7 @@ func (m *Manager) RefreshFEFOQuotaAfterUse(accountID, publicModel string) { go func() { defer m.quotaAfterUseDone.Done() for { - if item, ok := m.pool.ByID(accountID); ok && m.pool.HasFEFOQuota(accountID, publicModel) { + if item, ok := m.pool.FEFOQuotaAccount(accountID); ok { ctx, cancel := context.WithTimeout(m.runCtx, 10*time.Second) m.refreshQuotaOnly(ctx, item) cancel() diff --git a/internal/runtime/manager_fefo_test.go b/internal/runtime/manager_fefo_test.go index 8b2a17f8b..08443b785 100644 --- a/internal/runtime/manager_fefo_test.go +++ b/internal/runtime/manager_fefo_test.go @@ -2,6 +2,7 @@ package runtime import ( "context" + "net/http" "path/filepath" "sync/atomic" "testing" @@ -11,6 +12,7 @@ import ( "github.com/caigee-cmd/cli2api/internal/executor" "github.com/caigee-cmd/cli2api/internal/providers" sqlstore "github.com/caigee-cmd/cli2api/internal/store" + "github.com/caigee-cmd/cli2api/internal/translate" ) type fefoRefreshProber struct { @@ -121,6 +123,81 @@ func TestFEFOCompletionRefreshSkipsHistoricalStrategiesAndFreeRoutes(t *testing. } } +type fefoRefreshChat struct{ accountID, model string } + +func (p *fefoRefreshChat) ChatNonStream(_ context.Context, accountID string, req translate.ChatRequest) (providers.ChatOutcome, error) { + p.accountID, p.model = accountID, req.Model + return providers.ChatOutcome{Model: "free", Content: "ok"}, nil +} + +func (*fefoRefreshChat) ChatStream(context.Context, string, translate.ChatRequest) (*http.Response, providers.ResolvedChat, error) { + return nil, providers.ResolvedChat{}, providers.ErrUnsupported +} + +func TestRouteFEFOCompletionRefreshUsesSelectedAggregatePath(t *testing.T) { + m, id, p := newFEFORefreshFixture(t) + m.pool.SetRoutingStrategy(accounts.RoutingStrategyFillFirst) + item, _ := m.pool.ByID(id) + item.ModelAliases = map[string]string{"alias": "paid", "paid": "free"} + item.NativeModels = map[string]string{"paid": "native-paid-key"} + m.pool.Upsert(item) + close(p.release) + chat := &fefoRefreshChat{} + registry := providers.NewRegistry() + registry.Register(providers.Adapter{ID: "workbuddy", Chat: chat, Prober: p}) + m.SetProviders(registry) + exec := executor.NewChatExecutor(m.pool, "") + exec.Providers = registry + + // Both seats send the same real model to the same account, but only the + // second seat enters a FEFO subtree. The model name alone cannot opt in. + const public = "bundle" + member := accounts.AggregationMember{Provider: "workbuddy", Region: "cn", Model: "alias"} + plan := executor.NewAggregatePlan(accounts.Aggregation{ID: public, Strategy: accounts.AggregationRoundRobin}) + plan.Seats = []accounts.RouteSeat{ + {ID: "direct", Kind: "member", Member: member}, + {ID: "group", Kind: "group", GroupID: "inner", GroupStrategy: accounts.AggregationFEFOStrategy, GroupMembers: []accounts.AggregationMember{member}}, + } + for i, wantFEFO := range []bool{false, true} { + result, err := exec.ChatNonStreamPrepared(t.Context(), translate.ChatRequest{Model: public}, executor.RouteInput{PublicModel: public, RouteModel: public, AggregatePlan: plan}) + if err != nil { + t.Fatal(err) + } + if chat.accountID != id || chat.model != "native-paid-key" || result.PoolAccountID != id || result.CooldownModel != "paid" || result.AggregateFEFO != wantFEFO { + t.Fatalf("dispatch %d: adapter got %s/%s, result got %s/%s FEFO=%t; want %s/paid FEFO=%t", i, chat.accountID, chat.model, result.PoolAccountID, result.CooldownModel, result.AggregateFEFO, id, wantFEFO) + } + m.RefreshRouteQuotaAfterUse(result.PoolAccountID, result.CooldownModel, result.AggregateFEFO) + m.quotaAfterUseDone.Wait() + if got := p.calls.Load(); got != int32(i) { + t.Fatalf("dispatch %d: %d quota fetches, want %d", i, got, i) + } + } + stored, err := m.store.Get(t.Context(), id) + if err != nil || stored.Quota == nil || !stored.Quota.Exceeded { + t.Fatalf("selected aggregate completion did not persist depleted quota: %v, %+v", err, stored.Quota) + } +} + +func TestRouteFEFOCompletionRefreshCoalescesAcrossStrategies(t *testing.T) { + m, id, p := newFEFORefreshFixture(t) + m.RefreshFEFOQuotaAfterUse(id, "paid") + awaitFEFORefresh(t, p, 1) + + // The legacy event that opened the worker no longer qualifies under the + // new global strategy; independently admitted aggregate events still do. + m.pool.SetRoutingStrategy(accounts.RoutingStrategyRoundRobin) + for i := 0; i < 100; i++ { + m.RefreshRouteQuotaAfterUse(id, "paid", true) + } + p.release <- struct{}{} + awaitFEFORefresh(t, p, 2) + p.release <- struct{}{} + m.quotaAfterUseDone.Wait() + if got := p.calls.Load(); got != 2 { + t.Fatalf("mixed-strategy completions made %d requests, want one initial and one trailing", got) + } +} + func TestFEFOCompletionRefreshStopsOnClose(t *testing.T) { m, id, p := newFEFORefreshFixture(t) m.RefreshFEFOQuotaAfterUse(id, "paid") diff --git a/internal/runtime/manager_maintenance.go b/internal/runtime/manager_maintenance.go index 8be1e926c..a5fec3389 100644 --- a/internal/runtime/manager_maintenance.go +++ b/internal/runtime/manager_maintenance.go @@ -218,6 +218,8 @@ const ( checkinStatusGrace = 15 * time.Minute ) +var checkinStatusNow = time.Now + // SyncCheckinStatuses refreshes every check-in-capable account from upstream. // It is safe to call concurrently; only one pass runs at a time. func (manager *Manager) SyncCheckinStatuses(ctx context.Context) { @@ -296,7 +298,7 @@ func (manager *Manager) syncCheckinStatus(ctx context.Context, account Account) stop := context.AfterFunc(manager.runCtx, cancel) defer stop() result, readErr := adapter.CheckinStatus.CheckinStatus(syncCtx, account.ID) - now := time.Now().UTC() + now := checkinStatusNow().UTC() // A manual/scheduled check-in can finish while the read-only probe is in // flight. Re-read the account before deciding, so the slower probe cannot // overwrite a fresh success with the state that preceded it. diff --git a/internal/server/router.go b/internal/server/router.go index 21fc40e4f..a7d6e740f 100644 --- a/internal/server/router.go +++ b/internal/server/router.go @@ -25,7 +25,7 @@ func (s *Server) routes() { s.mux.HandleFunc("/api/keys", s.withConsoleKey(s.consoleHandler().HandleAPIKeys)) s.mux.HandleFunc("/api/keys/", s.withConsoleKey(s.consoleHandler().HandleAPIKeyByID)) s.mux.HandleFunc("/api/aggregations", s.withConsoleKey(s.consoleHandler().HandleAggregations)) - s.mux.HandleFunc("/api/aggregations/preview", s.withConsoleKey(s.consoleHandler().HandleAggregationPreview)) + s.mux.HandleFunc("POST /api/aggregations/preview", s.withConsoleKey(s.consoleHandler().HandleAggregationPreview)) s.mux.HandleFunc("/api/aggregations/", s.withConsoleKey(s.consoleHandler().HandleAggregationByID)) s.mux.HandleFunc("/api/models", s.withConsoleKey(s.consoleHandler().HandleModelsAPI)) s.mux.HandleFunc("/api/models/check", s.withConsoleKey(s.consoleHandler().HandleModelProbe)) diff --git a/internal/webui/static/assets/AccessPage-DObXAGNo.js b/internal/webui/static/assets/AccessPage-D_rNpM5b.js similarity index 98% rename from internal/webui/static/assets/AccessPage-DObXAGNo.js rename to internal/webui/static/assets/AccessPage-D_rNpM5b.js index e3c9d7109..02c4cdba5 100644 --- a/internal/webui/static/assets/AccessPage-DObXAGNo.js +++ b/internal/webui/static/assets/AccessPage-D_rNpM5b.js @@ -1,4 +1,4 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./CaiaiSoftLink-CsNrM_a1.js";import{t as u}from"./CaretRight.es-CeI6iKxy.js";import{t as d}from"./clipboard-CWhuA-N0.js";import{t as f}from"./Plus.es-BPfWzgUg.js";import{n as p,pt as m,r as h}from"./useI18n-XrvNxGvP.js";import{t as g}from"./label-B8hTan2F.js";import{t as ee}from"./PageAlert-BbN7e2aZ.js";import{t as _}from"./EmptyPanel-Bs-jQMvG.js";import{t as v}from"./list-box-BtjELxmv.js";import{n as y,t as b}from"./tabs-DrJPw_Nc.js";import{t as x}from"./select-DSzMi7kM.js";import{d as S,f as te,i as C,o as w}from"./format-FfdyoNtB.js";import{D as T,O as E,d as ne,m as re,t as ie}from"./overview-ARhe2pSk.js";import{t as D}from"./gsap-DWxn8li7.js";import{Ht as ae,Mt as oe,N as se,Nt as ce,O as le,Ot as ue,i as de,j as O,kt as fe,t as pe,v as k,x as A,y as me}from"./index-CAlyInAP.js";import{t as he}from"./FilterToggle-BoD7X2r2.js";import{t as ge}from"./ProviderMark-C49bIWJW.js";import{n as _e}from"./provider-BZvt2HHB.js";import{t as ve}from"./LatencyStats-4FIN19Dh.js";var j=t(e(),1),ye=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M54.8,119.49A35.06,35.06,0,0,1,49.05,128a35.06,35.06,0,0,1,5.75,8.51C60,147.24,60,159.83,60,172c0,25.94,1.84,32,20,32a12,12,0,0,1,0,24c-19.14,0-32.2-6.9-38.8-20.51C36,196.76,36,184.17,36,172c0-25.94-1.84-32-20-32a12,12,0,0,1,0-24c18.16,0,20-6.06,20-32,0-12.17,0-24.76,5.2-35.49C47.8,34.9,60.86,28,80,28a12,12,0,0,1,0,24c-18.16,0-20,6.06-20,32C60,96.17,60,108.76,54.8,119.49ZM240,116c-18.16,0-20-6.06-20-32,0-12.17,0-24.76-5.2-35.49C208.2,34.9,195.14,28,176,28a12,12,0,0,0,0,24c18.16,0,20,6.06,20,32,0,12.17,0,24.76,5.2,35.49A35.06,35.06,0,0,0,207,128a35.06,35.06,0,0,0-5.75,8.51C196,147.24,196,159.83,196,172c0,25.94-1.84,32-20,32a12,12,0,0,0,0,24c19.14,0,32.2-6.9,38.8-20.51C220,196.76,220,184.17,220,172c0-25.94,1.84-32,20-32a12,12,0,0,0,0-24Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M240,128c-64,0,0,88-64,88H80c-64,0,0-88-64-88,64,0,0-88,64-88h96C240,40,176,128,240,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M43.18,128a29.78,29.78,0,0,1,8,10.26c4.8,9.9,4.8,22,4.8,33.74,0,24.31,1,36,24,36a8,8,0,0,1,0,16c-17.48,0-29.32-6.14-35.2-18.26-4.8-9.9-4.8-22-4.8-33.74,0-24.31-1-36-24-36a8,8,0,0,1,0-16c23,0,24-11.69,24-36,0-11.72,0-23.84,4.8-33.74C50.68,38.14,62.52,32,80,32a8,8,0,0,1,0,16C57,48,56,59.69,56,84c0,11.72,0,23.84-4.8,33.74A29.78,29.78,0,0,1,43.18,128ZM240,120c-23,0-24-11.69-24-36,0-11.72,0-23.84-4.8-33.74C205.32,38.14,193.48,32,176,32a8,8,0,0,0,0,16c23,0,24,11.69,24,36,0,11.72,0,23.84,4.8,33.74a29.78,29.78,0,0,0,8,10.26,29.78,29.78,0,0,0-8,10.26c-4.8,9.9-4.8,22-4.8,33.74,0,24.31-1,36-24,36a8,8,0,0,0,0,16c17.48,0,29.32-6.14,35.2-18.26,4.8-9.9,4.8-22,4.8-33.74,0-24.31,1-36,24-36a8,8,0,0,0,0-16Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM88,155.84c.29,14.26.41,20.16,16,20.16a8,8,0,0,1,0,16c-31.27,0-31.72-22.43-32-35.84C71.71,141.9,71.59,136,56,136a8,8,0,0,1,0-16c15.59,0,15.71-5.9,16-20.16C72.28,86.43,72.73,64,104,64a8,8,0,0,1,0,16c-15.59,0-15.71,5.9-16,20.16-.17,8.31-.41,20.09-8,27.84C87.59,135.75,87.83,147.53,88,155.84ZM200,136c-15.59,0-15.71,5.9-16,20.16-.28,13.41-.73,35.84-32,35.84a8,8,0,0,1,0-16c15.59,0,15.71-5.9,16-20.16.17-8.31.41-20.09,8-27.84-7.6-7.75-7.84-19.53-8-27.84C167.71,85.9,167.59,80,152,80a8,8,0,0,1,0-16c31.27,0,31.72,22.43,32,35.84.29,14.26.41,20.16,16,20.16a8,8,0,0,1,0,16Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M39.91,128a27.68,27.68,0,0,1,9.49,11.13C54,148.62,54,160.51,54,172c0,24.27,1.21,38,26,38a6,6,0,0,1,0,12c-16.88,0-27.81-5.6-33.4-17.13C42,195.38,42,183.49,42,172c0-24.27-1.21-38-26-38a6,6,0,0,1,0-12c24.79,0,26-13.73,26-38,0-11.49,0-23.38,4.6-32.87C52.19,39.6,63.12,34,80,34a6,6,0,0,1,0,12C55.21,46,54,59.73,54,84c0,11.49,0,23.38-4.6,32.87A27.68,27.68,0,0,1,39.91,128ZM240,122c-24.79,0-26-13.73-26-38,0-11.49,0-23.38-4.6-32.87C203.81,39.6,192.88,34,176,34a6,6,0,0,0,0,12c24.79,0,26,13.73,26,38,0,11.49,0,23.38,4.6,32.87A27.68,27.68,0,0,0,216.09,128a27.68,27.68,0,0,0-9.49,11.13C202,148.62,202,160.51,202,172c0,24.27-1.21,38-26,38a6,6,0,0,0,0,12c16.88,0,27.81-5.6,33.4-17.13,4.6-9.49,4.6-21.38,4.6-32.87,0-24.27,1.21-38,26-38a6,6,0,0,0,0-12Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M43.18,128a29.78,29.78,0,0,1,8,10.26c4.8,9.9,4.8,22,4.8,33.74,0,24.31,1,36,24,36a8,8,0,0,1,0,16c-17.48,0-29.32-6.14-35.2-18.26-4.8-9.9-4.8-22-4.8-33.74,0-24.31-1-36-24-36a8,8,0,0,1,0-16c23,0,24-11.69,24-36,0-11.72,0-23.84,4.8-33.74C50.68,38.14,62.52,32,80,32a8,8,0,0,1,0,16C57,48,56,59.69,56,84c0,11.72,0,23.84-4.8,33.74A29.78,29.78,0,0,1,43.18,128ZM240,120c-23,0-24-11.69-24-36,0-11.72,0-23.84-4.8-33.74C205.32,38.14,193.48,32,176,32a8,8,0,0,0,0,16c23,0,24,11.69,24,36,0,11.72,0,23.84,4.8,33.74a29.78,29.78,0,0,0,8,10.26,29.78,29.78,0,0,0-8,10.26c-4.8,9.9-4.8,22-4.8,33.74,0,24.31-1,36-24,36a8,8,0,0,0,0,16c17.48,0,29.32-6.14,35.2-18.26,4.8-9.9,4.8-22,4.8-33.74,0-24.31,1-36,24-36a8,8,0,0,0,0-16Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M35.89,128C52,136.23,52,155.64,52,172c0,24.8,1.35,40,28,40a4,4,0,0,1,0,8c-36,0-36-26.61-36-48,0-24.8-1.35-40-28-40a4,4,0,0,1,0-8c26.65,0,28-15.2,28-40,0-21.39,0-48,36-48a4,4,0,0,1,0,8C53.35,44,52,59.2,52,84,52,100.36,52,119.77,35.89,128ZM240,124c-26.65,0-28-15.2-28-40,0-21.39,0-48-36-48a4,4,0,0,0,0,8c26.65,0,28,15.2,28,40,0,16.36,0,35.77,16.11,44C204,136.23,204,155.64,204,172c0,24.8-1.35,40-28,40a4,4,0,0,0,0,8c36,0,36-26.61,36-48,0-24.8,1.35-40,28-40a4,4,0,0,0,0-8Z`}))]]),M=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M120,128a16,16,0,1,1-16-16A16,16,0,0,1,120,128Zm32-16a16,16,0,1,0,16,16A16,16,0,0,0,152,112Zm84,16A108,108,0,0,1,78.77,224.15L46.34,235A20,20,0,0,1,21,209.66l10.81-32.43A108,108,0,1,1,236,128Zm-24,0A84,84,0,1,0,55.27,170.06a12,12,0,0,1,1,9.81l-9.93,29.79,29.79-9.93a12.1,12.1,0,0,1,3.8-.62,12,12,0,0,1,6,1.62A84,84,0,0,0,212,128Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-4-1.08,7.85,7.85,0,0,0-2.53.42L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Zm12-88a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm-44,0a12,12,0,1,1-12-12A12,12,0,0,1,96,128Zm88,0a12,12,0,1,1-12-12A12,12,0,0,1,184,128Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24ZM84,140a12,12,0,1,1,12-12A12,12,0,0,1,84,140Zm44,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm44,0a12,12,0,1,1,12-12A12,12,0,0,1,172,140Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM84,118a10,10,0,1,0,10,10A10,10,0,0,0,84,118Zm88,0a10,10,0,1,0,10,10A10,10,0,0,0,172,118Zm58,10A102,102,0,0,1,79.31,217.65L44.44,229.27a14,14,0,0,1-17.71-17.71l11.62-34.87A102,102,0,1,1,230,128Zm-12,0A90,90,0,1,0,50.08,173.06a6,6,0,0,1,.5,4.91L38.12,215.35a2,2,0,0,0,2.53,2.53L78,205.42a6.2,6.2,0,0,1,1.9-.31,6.09,6.09,0,0,1,3,.81A90,90,0,0,0,218,128Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM84,116a12,12,0,1,0,12,12A12,12,0,0,0,84,116Zm88,0a12,12,0,1,0,12,12A12,12,0,0,0,172,116Zm60,12A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Zm-16,0A88,88,0,1,0,51.81,172.06a8,8,0,0,1,.66,6.54L40,216,77.4,203.53a7.85,7.85,0,0,1,2.53-.42,8,8,0,0,1,4,1.08A88,88,0,0,0,216,128Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-52-8a8,8,0,1,0,8,8A8,8,0,0,0,84,120Zm88,0a8,8,0,1,0,8,8A8,8,0,0,0,172,120Zm56,8A100,100,0,0,1,79.5,215.47l-35.69,11.9a12,12,0,0,1-15.18-15.18l11.9-35.69A100,100,0,1,1,228,128Zm-8,0A92,92,0,1,0,48.35,174.07a4,4,0,0,1,.33,3.27L36.22,214.72a4,4,0,0,0,5.06,5.06l37.38-12.46a3.93,3.93,0,0,1,1.27-.21,4.05,4.05,0,0,1,2,.54A92,92,0,0,0,220,128Z`}))]]),be=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,176A72,72,0,0,1,92,65.64a8,8,0,0,1,8,13.85,56,56,0,1,0,56,0,8,8,0,0,1,8-13.85A72,72,0,0,1,128,200Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M228,128a100,100,0,0,1-200,0c0-39.4,22.9-75.37,58.33-91.63a4,4,0,1,1,3.34,7.27C57.07,58.6,36,91.71,36,128a92,92,0,0,0,184,0c0-36.29-21.07-69.4-53.67-84.36a4,4,0,1,1,3.34-7.27C205.1,52.63,228,88.6,228,128Z`}))]]),xe=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z`}))]]),N=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M180,64H40A12,12,0,0,0,28,76V216a12,12,0,0,0,12,12H180a12,12,0,0,0,12-12V76A12,12,0,0,0,180,64ZM168,204H52V88H168ZM228,40V180a12,12,0,0,1-24,0V52H76a12,12,0,0,1,0-24H216A12,12,0,0,1,228,40Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,72V216H40V72Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M192,72V216a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H184A8,8,0,0,1,192,72Zm24-40H72a8,8,0,0,0,0,16H208V184a8,8,0,0,0,16,0V40A8,8,0,0,0,216,32Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,66H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H184a6,6,0,0,0,6-6V72A6,6,0,0,0,184,66Zm-6,144H46V78H178ZM222,40V184a6,6,0,0,1-12,0V46H72a6,6,0,0,1,0-12H216A6,6,0,0,1,222,40Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,68H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H184a4,4,0,0,0,4-4V72A4,4,0,0,0,184,68Zm-4,144H44V76H180ZM220,40V184a4,4,0,0,1-8,0V44H72a4,4,0,0,1,0-8H216A4,4,0,0,1,220,40Z`}))]]),P=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216.49,79.52l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.52ZM160,57l23,23H160ZM60,212V44h76V92a12,12,0,0,0,12,12h48V212Zm112-80a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,132Zm0,40a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,172Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M208,88H152V32Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,176H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm-8-56V44l44,44Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Zm-34-82a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,136Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,168Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40V216a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM200,220H56a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216A4,4,0,0,1,200,220Zm-36-84a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,136Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,168Z`}))]]),F=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M71.76,148H31.7a12,12,0,1,1,0-24H65.33l12.45-18.66a12,12,0,0,1,20,0l22,33,6-9a12,12,0,0,1,10-5.34h24a12,12,0,1,1,0,24h-17.6l-12.46,18.66a12,12,0,0,1-20,0l-22-33-6,9A12,12,0,0,1,71.76,148ZM177.91,36c-20.12,0-38,7.93-50.07,21.56C115.74,43.93,97.89,36,77.76,36A66,66,0,0,0,12.07,94.68,12,12,0,0,0,36,97.32,42,42,0,0,1,77.76,60c17.83,0,32.75,9.4,38.95,24.54a12,12,0,0,0,22.25,0C145.16,69.4,160.08,60,177.91,60A42.08,42.08,0,0,1,220,102c0,29.42-25.86,57.77-47.56,76.36a329,329,0,0,1-44.58,31.81c-10.87-6.45-35.37-22-56.51-42.73a12,12,0,1,0-16.84,17.12c30.39,29.81,66.15,49.2,67.66,50a12.06,12.06,0,0,0,11.39,0C138,232.14,244,174.34,244,102A66.12,66.12,0,0,0,177.91,36Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M232,102c0,66-104,122-104,122S24,168,24,102A54,54,0,0,1,78,48c22.59,0,41.94,12.31,50,32,8.06-19.69,27.41-32,50-32A54,54,0,0,1,232,102Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M72,144H32a8,8,0,0,1,0-16H67.72l13.62-20.44a8,8,0,0,1,13.32,0l25.34,38,9.34-14A8,8,0,0,1,136,128h24a8,8,0,0,1,0,16H140.28l-13.62,20.44a8,8,0,0,1-13.32,0L88,126.42l-9.34,14A8,8,0,0,1,72,144ZM178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,.75,0,1.5,0,2.25a8,8,0,1,0,16-.5c0-.58,0-1.17,0-1.75A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46c0,53.61-77.76,102.15-96,112.8-10.83-6.31-42.63-26-66.68-52.21a8,8,0,1,0-11.8,10.82c31.17,34,72.93,56.68,74.69,57.63a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M240,102c0,70-103.79,126.66-108.21,129a8,8,0,0,1-7.58,0c-3.35-1.8-63.55-34.69-92.68-80.89A4,4,0,0,1,34.92,144H72a8,8,0,0,0,6.66-3.56l9.34-14,25.34,38a8,8,0,0,0,9.16,3.16,8.23,8.23,0,0,0,4.28-3.34L140.28,144H160a8,8,0,0,0,8-8.53,8.18,8.18,0,0,0-8.25-7.47H136a8,8,0,0,0-6.66,3.56l-9.34,14-25.34-38a8,8,0,0,0-9.17-3.16,8.25,8.25,0,0,0-4.27,3.34L67.72,128H23.53a4,4,0,0,1-3.83-2.81A76.93,76.93,0,0,1,16,102,62.07,62.07,0,0,1,78,40c20.65,0,38.73,8.88,50,23.89C139.27,48.88,157.35,40,178,40A62.07,62.07,0,0,1,240,102Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M72,142H32a6,6,0,0,1,0-12H68.79L83,108.67a6,6,0,0,1,10,0l27,40.51,11-16.51a6,6,0,0,1,5-2.67h24a6,6,0,0,1,0,12H139.21L125,163.33a6,6,0,0,1-10,0L88,122.82,77,139.33A6,6,0,0,1,72,142ZM178,42c-21,0-39.26,9.47-50,25.34C117.26,51.47,99,42,78,42a60.07,60.07,0,0,0-60,60q0,1.09,0,2.19a6,6,0,0,0,12-.38c0-.6,0-1.21,0-1.81A48.05,48.05,0,0,1,78,54c20.28,0,37.31,10.83,44.45,28.27a6,6,0,0,0,11.1,0C140.69,64.83,157.72,54,178,54a48.05,48.05,0,0,1,48,48c0,55.73-81.61,105.65-98,115.11-9.84-5.66-43.09-25.82-68.16-53.16a6,6,0,1,0-8.84,8.1c30.94,33.77,72.41,56.29,74.16,57.23a6,6,0,0,0,5.68,0,334.68,334.68,0,0,0,53.06-37C219.8,161.59,238,131.2,238,102A60.07,60.07,0,0,0,178,42Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M72,144H32a8,8,0,0,1,0-16H67.72l13.62-20.44a8,8,0,0,1,13.32,0l25.34,38,9.34-14A8,8,0,0,1,136,128h24a8,8,0,0,1,0,16H140.28l-13.62,20.44a8,8,0,0,1-13.32,0L88,126.42l-9.34,14A8,8,0,0,1,72,144ZM178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,.75,0,1.5,0,2.25a8,8,0,1,0,16-.5c0-.58,0-1.17,0-1.75A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46c0,53.61-77.76,102.15-96,112.8-10.83-6.31-42.63-26-66.68-52.21a8,8,0,1,0-11.8,10.82c31.17,34,72.93,56.68,74.69,57.63a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M72,140H32a4,4,0,0,1,0-8H69.86l14.81-22.22a4,4,0,0,1,6.66,0l28.67,43,12.67-19A4,4,0,0,1,136,132h24a4,4,0,0,1,0,8H138.14l-14.81,22.22a4,4,0,0,1-6.66,0L88,119.21l-12.67,19A4,4,0,0,1,72,140ZM178,44c-21.44,0-39.92,10.19-50,27.07C117.92,54.19,99.44,44,78,44a58.07,58.07,0,0,0-58,58q0,1.06,0,2.13a4,4,0,1,0,8-.26c0-.62,0-1.24,0-1.87A50.06,50.06,0,0,1,78,52c21.11,0,38.85,11.31,46.3,29.51a4,4,0,0,0,7.4,0C139.15,63.31,156.89,52,178,52a50.06,50.06,0,0,1,50,50c0,58-86,109.46-100,117.42-8.47-4.82-43.5-25.61-69.63-54.12a4,4,0,0,0-5.9,5.4c30.72,33.52,71.9,55.89,73.63,56.82a4,4,0,0,0,3.8,0,333.81,333.81,0,0,0,52.7-36.73C218,160.47,236,130.59,236,102A58.07,58.07,0,0,0,178,44Z`}))]]),Se=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),I=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),L=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:ye}));L.displayName=`BracketsCurlyIcon`;var Ce=L,R=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:M}));R.displayName=`ChatCircleDotsIcon`;var z=R,B=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:be}));B.displayName=`CircleNotchIcon`;var we=B,Te=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:xe}));Te.displayName=`ClockIcon`;var Ee=Te,De=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:N}));De.displayName=`CopySimpleIcon`;var V=De,H=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:P}));H.displayName=`FileTextIcon`;var U=H,W=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:F}));W.displayName=`HeartbeatIcon`;var Oe=W,ke=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:Se}));ke.displayName=`PaperPlaneTiltIcon`;var G=ke,K=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:I}));K.displayName=`StopIcon`;var Ae=K;function q(){return`${location.protocol}//${location.host}`}function J(e){return e?/^https?:\/\//i.test(e)?e:e.startsWith(`/`)?`${q()}${e}`:`${q()}/${e}`:q()}var Y=n();function je({access:e}){let{t}=p(),[n,r]=(0,j.useState)(``),o=J(e?.openai_base_url||`/v1`),s=(0,j.useMemo)(()=>[{name:t(`endpointOpenAI`),url:o,method:`BASE`,hint:t(`endpointBaseHint`),icon:(0,Y.jsx)(Ce,{size:15})},{name:t(`endpointChat`),url:J(e?.chat_completions||`${o}/chat/completions`),method:`POST`,hint:t(`endpointChatHint`),icon:(0,Y.jsx)(G,{size:15})},{name:t(`endpointMessages`),url:J(e?.messages||`${o}/messages`),method:`POST`,hint:t(`endpointMessagesHint`),icon:(0,Y.jsx)(G,{size:15})},{name:t(`endpointResponses`),url:J(e?.responses||`${o}/responses`),method:`POST`,hint:t(`endpointResponsesHint`),icon:(0,Y.jsx)(G,{size:15})},{name:t(`endpointModels`),url:J(e?.models||`${o}/models`),method:`GET`,hint:t(`endpointModelsHint`),icon:(0,Y.jsx)(i,{size:15})},{name:t(`endpointHealth`),url:J(e?.health||`/health`),method:`GET`,hint:t(`endpointHealthHint`),icon:(0,Y.jsx)(Oe,{size:15})}],[e,o,t]);return(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`flex items-start justify-between gap-4 px-5 py-4 sm:px-6`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold`,children:t(`endpoints`)}),(0,Y.jsx)(se,{size:`sm`,variant:`soft`,children:t(`endpointCount`,{count:s.length-1})})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`routesHint`)})]})}),(0,Y.jsx)(`div`,{className:`grid gap-2 px-3 pb-3 sm:grid-cols-2 sm:px-4 sm:pb-4 lg:grid-cols-3`,children:s.map(e=>(0,Y.jsxs)(`div`,{className:`group min-w-0 rounded-xl bg-surface-secondary/40 p-3 transition-colors hover:bg-surface-secondary/70`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface text-muted`,children:e.icon}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`truncate text-body font-semibold`,children:e.name}),(0,Y.jsx)(`code`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.url})]})]}),(0,Y.jsx)(se,{size:`sm`,variant:`soft`,children:e.method})]}),(0,Y.jsx)(`p`,{className:`mt-2 text-caption leading-5 text-muted`,children:e.hint}),(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:e.method===`BASE`?t(`endpointBaseLabel`):t(`endpointAuthLabel`)}),(0,Y.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`copy`),onPress:()=>{d(e.url),r(e.name),window.setTimeout(()=>r(``),1100)},children:(0,Y.jsx)(a,{copied:n===e.name})}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`open`),onPress:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),children:(0,Y.jsx)(c,{size:14})})]})]})]},e.name))})]})}var Me=new Set(`txt.md.markdown.json.csv.tsv.yml.yaml.toml.xml.html.htm.css.scss.js.jsx.ts.tsx.mjs.cjs.py.go.rs.java.kt.swift.c.h.cpp.hpp.sh.bash.zsh.sql.graphql.env.ini.conf.log.rst.tex`.split(`.`)),Ne=new Set([`image/png`,`image/jpeg`,`image/jpg`,`image/gif`,`image/webp`]);function X(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t+1).toLowerCase():``}function Pe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}async function Z(e){let t=X(e.name),n=e.type||`application/octet-stream`,r=`${e.name}-${e.size}-${e.lastModified}-${Math.random().toString(36).slice(2,8)}`;if(Ne.has(n)||[`png`,`jpg`,`jpeg`,`gif`,`webp`].includes(t)){let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error||Error(`read failed`)),r.readAsDataURL(e)});return{id:r,name:e.name,mime:n,kind:`image`,dataUrl:t,size:e.size}}if(Me.has(t)||n.startsWith(`text/`)||n===`application/json`){let t=await e.text();return{id:r,name:e.name,mime:n,kind:`text`,text:t,size:e.size}}return null}function Q({ariaLabel:e,value:t,onChange:n,placeholder:r,isDisabled:i,options:a,className:o,tone:s=`default`}){let c=a.find(e=>e.id===t),l=s===`muted`?`text-muted hover:text-foreground`:`text-foreground`;return(0,Y.jsxs)(x,{className:o??`w-auto max-w-[11rem] min-w-0`,"aria-label":e,value:t||null,placeholder:r,isDisabled:i,onChange:e=>{typeof e==`string`&&e&&n(e)},children:[(0,Y.jsxs)(x.Trigger,{className:`h-8 min-h-8 gap-1 rounded-[10px] border-0 bg-transparent px-2.5 shadow-none items-center hover:bg-surface-secondary/80 data-[focus-visible=true]:bg-surface-secondary/80 ${l}`,children:[(0,Y.jsx)(x.Value,{className:`min-w-0 truncate text-caption font-medium`,children:({defaultChildren:e,isPlaceholder:t})=>t||!c?e:(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[c.icon?(0,Y.jsx)(`span`,{className:`grid size-3.5 shrink-0 place-items-center opacity-80`,children:c.icon}):null,(0,Y.jsx)(`span`,{className:`truncate`,children:c.label})]})}),(0,Y.jsx)(x.Indicator,{className:`size-2.5 opacity-50`})]}),(0,Y.jsx)(x.Popover,{placement:`top end`,className:`max-h-72 min-w-48`,children:(0,Y.jsx)(v,{children:a.map(e=>(0,Y.jsxs)(v.Item,{id:e.id,textValue:e.textValue,className:`gap-2`,children:[e.icon?(0,Y.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center`,children:e.icon}):null,(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(g,{className:`block truncate text-caption`,children:e.label}),e.hint?(0,Y.jsx)(`span`,{className:`block truncate text-caption text-muted`,children:e.hint}):null]}),(0,Y.jsx)(v.ItemIndicator,{})]},e.id))})})]})}function Fe({value:e,onChange:t,attachments:n,onAttachmentsChange:r,disabled:i,streaming:a,canSend:o,onSend:c,onStop:l,accountValue:u,onAccountChange:d,accountOptions:m,modelValue:g,onModelChange:ee,modelOptions:_,modelsLoading:v}){let{t:y}=p(),b=(0,j.useRef)(null);async function x(e){if(!e?.length)return;let t=[],i=[];for(let n of Array.from(e))try{let e=await Z(n);e?t.push(e):i.push(n.name)}catch{i.push(n.name)}t.length&&r([...n,...t]),i.length&&pe({type:`error`,title:y(`chatAttachUnsupported`,{names:i.join(`, `)})}),b.current&&(b.current.value=``)}function S(e){e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),!a&&o&&c())}return(0,Y.jsxs)(`div`,{className:`access-composer px-3 pb-3 pt-2.5 sm:px-4 sm:pb-3.5 sm:pt-3`,children:[(0,Y.jsxs)(`div`,{className:`access-composer-well overflow-hidden rounded-2xl`,children:[n.length?(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,children:n.map(e=>(0,Y.jsxs)(`span`,{className:`inline-flex max-w-[14rem] items-center gap-2 rounded-xl bg-surface/80 px-1.5 py-1.5 text-caption text-foreground`,children:[e.kind===`image`&&e.dataUrl?(0,Y.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-8 shrink-0 rounded-lg object-cover`}):(0,Y.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,Y.jsx)(U,{size:14})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate font-medium`,children:e.name}),(0,Y.jsx)(`span`,{className:`mono text-muted`,children:Pe(e.size)})]}),(0,Y.jsx)(`button`,{type:`button`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted hover:bg-surface-secondary hover:text-foreground`,"aria-label":y(`chatAttachRemove`),onClick:()=>r(n.filter(t=>t.id!==e.id)),children:(0,Y.jsx)(ue,{size:12})})]},e.id))}):null,(0,Y.jsx)(s,{fullWidth:!0,rows:3,className:`min-h-20 resize-none border-0 bg-transparent px-3.5 py-3 text-body leading-[1.65] shadow-none focus-visible:ring-0`,value:e,onChange:e=>t(e.target.value),onKeyDown:S,placeholder:y(`promptPlaceholder`),"aria-label":y(`prompt`),disabled:i||a}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 pb-2 pt-0.5`,children:[(0,Y.jsx)(`input`,{ref:b,type:`file`,className:`hidden`,multiple:!0,accept:`.txt,.md,.json,.csv,.yml,.yaml,.toml,.xml,.html,.css,.js,.jsx,.ts,.tsx,.py,.go,.rs,.sh,.sql,.png,.jpg,.jpeg,.gif,.webp,text/*,image/png,image/jpeg,image/gif,image/webp,application/json`,onChange:e=>void x(e.target.files)}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 shrink-0 rounded-[10px]`,"aria-label":y(`chatAttach`),isDisabled:i||a,onPress:()=>b.current?.click(),children:(0,Y.jsx)(f,{size:15})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,Y.jsx)(Q,{ariaLabel:y(`account`),value:u,onChange:d,options:m,isDisabled:i||a,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,Y.jsx)(Q,{ariaLabel:y(`model`),value:g,onChange:ee,placeholder:y(v?`requesting`:`model`),options:_,isDisabled:i||a||v||!_.length,className:`w-auto max-w-[10.5rem] min-w-0`}),(0,Y.jsxs)(`div`,{className:`relative size-8 shrink-0`,children:[(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`secondary`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`opacity-100`:`pointer-events-none opacity-0`}`,"aria-label":y(`chatTryStop`),onPress:l,children:(0,Y.jsx)(Ae,{size:14,weight:`fill`})}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`pointer-events-none opacity-0`:`opacity-100`}`,"aria-label":y(`chatTrySend`),isDisabled:!o||i||a,onPress:c,children:(0,Y.jsx)(G,{size:14,weight:`fill`})})]})]})]}),(0,Y.jsx)(`p`,{className:`mt-1 px-1 text-caption leading-4 text-muted/65`,children:y(`chatTryHelper`)})]})}function Ie({collapsed:e,onCollapsedChange:t,items:n,activeId:i,onSelect:a,onNew:o}){let{t:s}=p(),c=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let t=c.current;!t||A()||e||D.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:k.fast,ease:`power2.out`})},[e]),e?(0,Y.jsxs)(`div`,{className:`access-hist-rail flex w-9 shrink-0 flex-col items-center gap-1 border-r py-2`,children:[(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":s(`chatHistoryExpand`),onPress:()=>t(!1),children:(0,Y.jsx)(ce,{size:15})}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":s(`chatHistoryNew`),onPress:o,children:(0,Y.jsx)(f,{size:14})})]}):(0,Y.jsxs)(`aside`,{ref:c,className:`access-hist-rail flex w-[13rem] shrink-0 flex-col border-r`,"aria-label":s(`chatHistoryTitle`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate px-1.5 text-caption font-medium text-muted`,children:s(`chatHistoryTitle`)}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":s(`chatHistoryCollapse`),onPress:()=>t(!0),children:(0,Y.jsx)(r,{size:14})})]}),(0,Y.jsx)(`div`,{className:`px-2 pb-1.5`,children:(0,Y.jsxs)(h,{size:`sm`,variant:`ghost`,className:`h-8 w-full justify-start gap-1.5 rounded-[10px] px-2.5 text-caption font-medium text-muted hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onPress:o,children:[(0,Y.jsx)(f,{size:13}),s(`chatHistoryNew`)]})}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 space-y-0.5 overflow-y-auto px-1.5 pb-2.5`,children:n.length?n.map(e=>{let t=e.id===i;return(0,Y.jsx)(`button`,{type:`button`,"data-active":t?`true`:void 0,className:`access-hist-item flex h-8 w-full items-center rounded-[10px] px-2.5 text-left text-caption leading-5 ${t?`font-medium text-foreground`:`font-normal text-muted`}`,onClick:()=>a(e.id),children:(0,Y.jsx)(`span`,{className:`line-clamp-1 tracking-tight`,children:e.title||s(`chatHistoryUntitled`)})},e.id)}):(0,Y.jsx)(`p`,{className:`px-2.5 py-6 text-center text-caption leading-5 text-muted/70`,children:s(`chatHistoryEmpty`)})})]})}function Le({text:e,streaming:t,defaultOpen:n}){let{t:r}=p(),[i,a]=(0,j.useState)(!!n),[o,s]=(0,j.useState)(0),c=(0,j.useRef)(0),l=(0,j.useRef)(null),d=(0,j.useRef)(null);if((0,j.useEffect)(()=>{t?a(!1):n!=null&&a(!!n)},[t,n]),(0,j.useEffect)(()=>{if(!t)return;let e=Date.now();s(0);let n=window.setInterval(()=>{let t=Math.floor((Date.now()-e)/1e3);s(t),c.current=t},250);return()=>window.clearInterval(n)},[t]),(0,j.useEffect)(()=>{!t&&o===0&&c.current>0&&s(c.current)},[t,o]),(0,j.useEffect)(()=>{let t=l.current,n=d.current;if(!t)return;let r=A();if(!i||!e){if(r){t.style.height=`0px`,t.style.opacity=`0`;return}D.to(t,{height:0,opacity:0,duration:k.fast,ease:me.inOut,overwrite:!0});return}let a=n?.scrollHeight??0;if(r){t.style.height=`auto`,t.style.opacity=`1`;return}D.fromTo(t,{height:0,opacity:0},{height:a,opacity:1,duration:k.base,ease:me.out,overwrite:!0,onComplete:()=>{t.style.height=`auto`}})},[i,e]),!e&&!t)return null;let f=A(),m=t?o:o||c.current;return(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-xl`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-surface-secondary px-2.5 py-1 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:t?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(we,{size:12,className:`shrink-0 text-muted ${f?``:`animate-spin`}`}),(0,Y.jsx)(`span`,{className:f?``:`access-thinking-shimmer`,children:r(`thinkingWorking`)}),(0,Y.jsxs)(`span`,{className:`mono text-muted/80`,children:[o,`s`]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(u,{size:11,className:`shrink-0 transition-transform duration-200 ease-out ${i?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{children:r(`thinkingDone`)}),m>0?(0,Y.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingElapsed`,{n:m})}):null,!m&&e?(0,Y.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingChars`,{count:e.length})}):null]})}),(0,Y.jsx)(`div`,{ref:l,className:`overflow-hidden`,style:{height:0,opacity:0},children:e?(0,Y.jsx)(`pre`,{ref:d,className:`mt-1.5 max-h-52 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-surface-secondary/80 px-3 py-2 text-caption leading-5 text-muted`,children:e}):null})]})}function Re(e,t){return t(e===`running`?`toolCallRunning`:e===`error`?`toolCallError`:`toolCallSuccess`)}function ze({status:e}){return e===`running`?(0,Y.jsx)(oe,{size:12,className:`animate-spin text-muted`}):e===`error`?(0,Y.jsx)(fe,{size:12,weight:`fill`,className:`text-danger`}):(0,Y.jsx)(ae,{size:12,weight:`fill`,className:`text-success`})}function Be(e){if(!e.trim())return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Ve({call:e,forceOpen:t}){let{t:n}=p(),[r,i]=(0,j.useState)(e.status===`error`||!!t),[a,o]=(0,j.useState)(!1),s=(0,j.useMemo)(()=>Be(e.arguments||``),[e.arguments]);(0,j.useEffect)(()=>{e.status===`error`&&i(!0)},[e.status]),(0,j.useEffect)(()=>{t&&i(!0)},[t]);async function c(){s&&(await d(s),o(!0),window.setTimeout(()=>o(!1),1200))}return(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-lg`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[(0,Y.jsx)(u,{size:11,className:`shrink-0 text-muted transition-transform ${r?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-caption font-medium text-foreground`,children:e.name||n(`toolCallUntitled`)}),(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted`,children:[(0,Y.jsx)(ze,{status:e.status}),Re(e.status,n)]})]}),r?(0,Y.jsxs)(`div`,{className:`space-y-1.5 px-2 pb-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:n(`toolCallArgs`)}),(0,Y.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-caption text-muted hover:bg-surface-secondary hover:text-foreground`,onClick:e=>{e.stopPropagation(),c()},children:[(0,Y.jsx)(V,{size:12}),n(a?`copied`:`copy`)]})]}),(0,Y.jsx)(`pre`,{className:`mono max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary/80 px-2.5 py-2 text-caption leading-5 text-muted`,children:s||n(`toolCallArgsEmpty`)})]}):null]})}function He({calls:e}){let{t}=p(),n=e.some(e=>e.status===`error`),r=e.some(e=>e.status===`running`),[i,a]=(0,j.useState)(n||r||e.length===1);return(0,j.useEffect)(()=>{(n||r)&&a(!0)},[n,r]),e.length?e.length===1?(0,Y.jsx)(`div`,{className:`rounded-xl bg-surface-secondary/70`,children:(0,Y.jsx)(Ve,{call:e[0],forceOpen:e[0].status===`error`})}):(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-secondary/70`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[(0,Y.jsx)(u,{size:11,className:`shrink-0 transition-transform ${i?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:t(`toolCallGroup`,{n:e.length})}),r?(0,Y.jsx)(oe,{size:12,className:`animate-spin`}):null]}),i?(0,Y.jsx)(`div`,{className:`space-y-0.5 border-t border-separator/40 px-0.5 py-1`,children:e.map(e=>(0,Y.jsx)(Ve,{call:e},`${e.index}-${e.id||e.name}`))}):null]}):null}function Ue({message:e}){return e.attachments?.length?(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.attachments.map(e=>(0,Y.jsxs)(`span`,{className:`inline-flex max-w-[12rem] items-center gap-1.5 rounded-xl bg-surface/70 px-1.5 py-1 text-caption text-muted`,children:[e.kind===`image`&&e.dataUrl?(0,Y.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-7 shrink-0 rounded-lg object-cover`}):(0,Y.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface`,children:(0,Y.jsx)(U,{size:12})}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))}):null}function We({message:e}){let{t}=p(),n=e.usage;if(!n||n.credits==null)return null;let r=n.prompt_tokens,i=n.completion_tokens,a=typeof r==`number`||typeof i==`number`?t(`chatTryUsageTokens`,{prompt:C(r??0),completion:C(i??0)}):``;return(0,Y.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`chatTryUsageFoot`,{tokens:a,amount:w(n.credits)}):t(`chatTryCreditsUsed`,{amount:w(n.credits)})})}function Ge({text:e,streaming:t}){let n=e.split(/(\n{2,})/),r=-1;for(let e=n.length-1;e>=0;--e)if(n[e]&&!/^\n{2,}$/.test(n[e])){r=e;break}return(0,Y.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground ${t?`access-streaming`:``}`,children:n.map((e,n)=>e?/^\n{2,}$/.test(e)?(0,Y.jsx)(`span`,{children:e},`s-${n}`):(0,Y.jsx)(`span`,{className:t&&n===r?`access-stream-seg`:void 0,children:e},`p-${n}`):null)})}function Ke(){let e=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let t=e.current;!t||A()||D.from(t,{autoAlpha:0,duration:k.fast,ease:`power2.out`})},[]),e}function qe({message:e}){let{t}=p(),[n,r]=(0,j.useState)(!1),i=e.role===`user`,o=Ke();if(i)return(0,Y.jsx)(`div`,{ref:o,className:`ml-auto max-w-[92%] sm:max-w-[78%]`,children:(0,Y.jsxs)(`div`,{className:`access-bubble access-bubble--user rounded-2xl rounded-br-md px-3.5 py-2.5`,children:[e.content?(0,Y.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground`,children:e.content}):null,(0,Y.jsx)(Ue,{message:e})]})});let s=e.status===`streaming`&&!e.content&&!e.reasoning&&!e.toolCalls?.length,c=!!e.content&&e.status===`done`,l=e.status===`streaming`,u=!!(e.usage&&e.usage.credits!=null),f=e.status===`done`&&(e.latency_ms!=null||e.ttfb_ms!=null||typeof e.usage?.completion_tokens==`number`);async function m(){e.content&&(await d(e.content),r(!0),window.setTimeout(()=>r(!1),1200))}return(0,Y.jsxs)(`div`,{className:`group/access-msg max-w-[96%] space-y-1.5 sm:max-w-[88%]`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-1.5 px-0.5`,children:(0,Y.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center rounded-lg border border-border bg-surface-secondary`,children:(0,Y.jsx)(ge,{provider:e.provider,size:13})})}),e.reasoning||l?(0,Y.jsx)(Le,{text:e.reasoning||``,streaming:l&&(!e.content||!!e.reasoning),defaultOpen:e.reasoningOpen}):null,e.toolCalls?.length?(0,Y.jsx)(He,{calls:e.toolCalls}):null,e.status===`error`?(0,Y.jsx)(ee,{status:`danger`,title:t(`requestFailed`),description:e.error||``}):s?(0,Y.jsxs)(`div`,{className:`space-y-2 pt-0.5`,children:[(0,Y.jsx)(O,{className:`h-3 w-28 rounded-md`}),(0,Y.jsx)(O,{className:`h-3 w-full rounded-md`}),(0,Y.jsx)(O,{className:`h-3 w-[86%] rounded-md`}),(0,Y.jsx)(O,{className:`h-3 w-[68%] rounded-md`})]}):e.content?(0,Y.jsx)(`div`,{className:`access-bubble access-bubble--assistant px-0.5 py-0`,children:(0,Y.jsx)(Ge,{text:e.content,streaming:l})}):null,c||u||f?(0,Y.jsxs)(`div`,{className:`access-msg-foot space-y-1 px-0.5 pt-0.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[c?(0,Y.jsxs)(h,{size:`sm`,variant:`ghost`,className:`h-5 min-h-5 gap-1 px-1.5 text-caption text-muted/80`,onPress:()=>void m(),children:[(0,Y.jsx)(a,{copied:n,size:12}),t(n?`copied`:`copy`)]}):null,(0,Y.jsx)(We,{message:e})]}),f?(0,Y.jsx)(ve,{variant:`inline`,latencyMs:e.latency_ms,ttfbMs:e.ttfb_ms,completionTokens:e.usage?.completion_tokens,stream:!0,className:`access-latency-inline max-h-0 overflow-hidden opacity-0 transition-[opacity,max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] group-hover/access-msg:max-h-5 group-hover/access-msg:opacity-100 focus-within:max-h-5 focus-within:opacity-100`,labels:{ttft:t(`logsColTTFT`),total:t(`logsLatencyTotal`),tps:t(`logsOutputTPS`)}}):null]}):null]})}function Je({messages:e,busy:t,onLoadDemo:n}){let{t:r}=p(),i=(0,j.useRef)(null);(0,j.useEffect)(()=>{i.current?.scrollIntoView({block:`end`})},[e,t]);let a=!e.length;return(0,Y.jsxs)(`div`,{className:`access-thread min-h-0 flex-1 overflow-y-auto px-4 sm:px-6 ${a?`py-5 sm:py-6`:`pb-2 pt-4 sm:pb-2.5 sm:pt-5`}`,"aria-live":`polite`,"aria-busy":t,children:[a?(0,Y.jsx)(_,{className:`min-h-56`,icon:(0,Y.jsx)(z,{size:22}),title:r(`chatTryEmptyTitle`),hint:r(`chatTryEmptyHint`),action:n?(0,Y.jsx)(`button`,{type:`button`,className:`inline-flex h-8 items-center rounded-[10px] px-2.5 text-caption font-medium text-muted transition-colors hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onClick:n,children:r(`chatDemoLoad`)}):void 0}):(0,Y.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,Y.jsx)(qe,{message:e},e.id))}),(0,Y.jsx)(`div`,{ref:i})]})}function Ye({format:e,onFormatChange:t,requestPath:n,prompt:r,onPromptChange:i,onTest:o,requestState:c,elapsedMs:l,output:u,responseStatus:d,curl:f,copiedCurl:m,onCopyCurl:g,canSend:v,accountValue:y,onAccountChange:b,accountOptions:x,modelValue:S,onModelChange:te,modelOptions:C,modelsLoading:w,disabled:T}){let{t:E}=p();return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`px-1 text-caption leading-5 text-muted`,children:E(`rawFormatHint`)}),(0,Y.jsx)(`div`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:(0,Y.jsxs)(`div`,{className:`grid xl:grid-cols-[minmax(420px,.92fr)_minmax(0,1.08fr)]`,children:[(0,Y.jsxs)(`div`,{className:`xl:border-r xl:border-[color-mix(in_oklab,var(--foreground)_6%,transparent)]`,children:[(0,Y.jsxs)(`div`,{className:`px-4 py-3.5 sm:px-5`,children:[(0,Y.jsx)(`h3`,{className:`text-body font-semibold`,children:E(`requestBuilder`)}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-caption text-muted`,children:[`POST `,n]})]}),(0,Y.jsxs)(`div`,{className:`space-y-4 px-4 pb-4 sm:px-5 sm:pb-5`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:E(`rawFormatLabel`)}),(0,Y.jsx)(he,{className:`access-format-chips`,ariaLabel:E(`rawFormatLabel`),value:e,onChange:e=>t(e),options:[{id:`chat`,label:E(`rawFormatChat`)},{id:`messages`,label:E(`rawFormatMessages`)},{id:`responses`,label:E(`rawFormatResponses`)}]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,Y.jsx)(Q,{ariaLabel:E(`account`),value:y,onChange:b,options:x,isDisabled:T||c===`loading`,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,Y.jsx)(Q,{ariaLabel:E(`model`),value:S,onChange:te,placeholder:E(w?`requesting`:`model`),options:C,isDisabled:T||c===`loading`||w||!C.length,className:`w-auto max-w-[10.5rem] min-w-0`})]}),(0,Y.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:E(`prompt`)}),(0,Y.jsx)(`span`,{className:`mono text-caption text-muted`,children:r.length})]}),(0,Y.jsx)(s,{fullWidth:!0,rows:9,className:`min-h-52 resize-y rounded-xl border-0 bg-[var(--field-background)] px-3.5 py-3 text-body leading-[1.65] shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--field-border)_78%,var(--foreground))] focus-visible:ring-0`,value:r,onChange:e=>i(e.target.value),placeholder:E(`promptPlaceholder`),"aria-label":E(`prompt`),disabled:T||c===`loading`}),(0,Y.jsx)(`p`,{className:`text-caption leading-5 text-muted/70`,children:E(`promptHelper`)})]}),(0,Y.jsxs)(h,{fullWidth:!0,isPending:c===`loading`,isDisabled:!v||T,onPress:o,children:[(0,Y.jsx)(G,{size:15}),E(c===`loading`?`requesting`:`sendRequest`)]})]})]}),(0,Y.jsxs)(`div`,{className:`access-raw-panel__inspector flex min-h-[440px] min-w-0 flex-col`,"aria-live":`polite`,"aria-busy":c===`loading`,children:[(0,Y.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-body font-semibold`,children:E(`responseInspector`)}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:E(`responseInspectorHint`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l===null?null:(0,Y.jsxs)(`span`,{className:`mono flex items-center gap-1.5 text-caption text-muted`,children:[(0,Y.jsx)(Ee,{size:12}),l,` ms`]}),(0,Y.jsx)(se,{size:`sm`,variant:`soft`,color:c===`success`?`success`:c===`error`?`danger`:void 0,children:d})]})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 px-4 pb-4 sm:px-5 sm:pb-5`,children:c===`idle`?(0,Y.jsx)(_,{className:`min-h-64`,title:E(`responseEmptyTitle`),hint:E(`responseEmptyHint`)}):c===`loading`?(0,Y.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,Y.jsx)(O,{className:`h-3 w-32 rounded-lg`}),(0,Y.jsx)(O,{className:`h-3 w-full rounded-lg`}),(0,Y.jsx)(O,{className:`h-3 w-[88%] rounded-lg`}),(0,Y.jsx)(O,{className:`h-3 w-[72%] rounded-lg`}),(0,Y.jsx)(O,{className:`mt-7 h-3 w-[92%] rounded-lg`}),(0,Y.jsx)(O,{className:`h-3 w-[64%] rounded-lg`})]}):c===`error`?(0,Y.jsx)(`div`,{className:`space-y-3`,children:(0,Y.jsx)(ee,{status:`danger`,title:E(`requestFailed`),description:u})}):(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-caption font-medium text-success`,children:[(0,Y.jsx)(ae,{size:14,weight:`fill`}),E(`responseReceived`)]}),(0,Y.jsx)(`pre`,{className:`mono overflow-x-auto whitespace-pre-wrap break-words text-caption leading-6 text-muted`,children:u})]})})]})]})}),(0,Y.jsxs)(`section`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-body font-semibold`,children:E(`curlExample`)}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-caption text-muted`,children:E(`curlGeneratedHint`)})]}),(0,Y.jsxs)(h,{size:`sm`,variant:`ghost`,onPress:g,children:[(0,Y.jsx)(a,{copied:m}),E(m?`copied`:`copy`)]})]}),(0,Y.jsx)(`pre`,{className:`mono max-h-72 overflow-auto whitespace-pre-wrap px-4 pb-4 text-caption leading-6 text-muted sm:px-5 sm:pb-5`,children:f})]})]})}function Xe(e,t){let n=t.filter(e=>e.kind===`text`),r=t.filter(e=>e.kind===`image`&&e.dataUrl),i=e.trim();for(let e of n){let t=e.text??``;i=`${i}${i?` +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./CaiaiSoftLink-c1QhARkW.js";import{t as u}from"./CaretRight.es-DLLkzlqU.js";import{t as d}from"./clipboard-ADnALjHx.js";import{t as f}from"./Plus.es-DsoFTrCh.js";import{n as p,pt as m,r as h}from"./useI18n-BAo1UrJW.js";import{t as g}from"./label-DYYRLGoV.js";import{t as ee}from"./PageAlert-4fxVtrfI.js";import{t as _}from"./EmptyPanel-Bs-jQMvG.js";import{t as v}from"./list-box-DbrQLYNo.js";import{n as y,t as b}from"./tabs-WTDlSXp1.js";import{t as x}from"./select-DnqAZzCR.js";import{d as S,f as te,i as C,o as w}from"./format-BAkFbjAh.js";import{D as T,O as E,d as ne,m as re,t as ie}from"./overview-ARhe2pSk.js";import{t as D}from"./gsap-DWxn8li7.js";import{Ht as ae,Mt as oe,N as se,Nt as ce,O as le,Ot as ue,i as de,j as O,kt as fe,t as pe,v as k,x as A,y as me}from"./index-CWTBzWuK.js";import{t as he}from"./FilterToggle-CbYR8o3t.js";import{t as ge}from"./ProviderMark-C49bIWJW.js";import{n as _e}from"./provider-BZvt2HHB.js";import{t as ve}from"./LatencyStats-CPcR-mdd.js";var j=t(e(),1),ye=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M54.8,119.49A35.06,35.06,0,0,1,49.05,128a35.06,35.06,0,0,1,5.75,8.51C60,147.24,60,159.83,60,172c0,25.94,1.84,32,20,32a12,12,0,0,1,0,24c-19.14,0-32.2-6.9-38.8-20.51C36,196.76,36,184.17,36,172c0-25.94-1.84-32-20-32a12,12,0,0,1,0-24c18.16,0,20-6.06,20-32,0-12.17,0-24.76,5.2-35.49C47.8,34.9,60.86,28,80,28a12,12,0,0,1,0,24c-18.16,0-20,6.06-20,32C60,96.17,60,108.76,54.8,119.49ZM240,116c-18.16,0-20-6.06-20-32,0-12.17,0-24.76-5.2-35.49C208.2,34.9,195.14,28,176,28a12,12,0,0,0,0,24c18.16,0,20,6.06,20,32,0,12.17,0,24.76,5.2,35.49A35.06,35.06,0,0,0,207,128a35.06,35.06,0,0,0-5.75,8.51C196,147.24,196,159.83,196,172c0,25.94-1.84,32-20,32a12,12,0,0,0,0,24c19.14,0,32.2-6.9,38.8-20.51C220,196.76,220,184.17,220,172c0-25.94,1.84-32,20-32a12,12,0,0,0,0-24Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M240,128c-64,0,0,88-64,88H80c-64,0,0-88-64-88,64,0,0-88,64-88h96C240,40,176,128,240,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M43.18,128a29.78,29.78,0,0,1,8,10.26c4.8,9.9,4.8,22,4.8,33.74,0,24.31,1,36,24,36a8,8,0,0,1,0,16c-17.48,0-29.32-6.14-35.2-18.26-4.8-9.9-4.8-22-4.8-33.74,0-24.31-1-36-24-36a8,8,0,0,1,0-16c23,0,24-11.69,24-36,0-11.72,0-23.84,4.8-33.74C50.68,38.14,62.52,32,80,32a8,8,0,0,1,0,16C57,48,56,59.69,56,84c0,11.72,0,23.84-4.8,33.74A29.78,29.78,0,0,1,43.18,128ZM240,120c-23,0-24-11.69-24-36,0-11.72,0-23.84-4.8-33.74C205.32,38.14,193.48,32,176,32a8,8,0,0,0,0,16c23,0,24,11.69,24,36,0,11.72,0,23.84,4.8,33.74a29.78,29.78,0,0,0,8,10.26,29.78,29.78,0,0,0-8,10.26c-4.8,9.9-4.8,22-4.8,33.74,0,24.31-1,36-24,36a8,8,0,0,0,0,16c17.48,0,29.32-6.14,35.2-18.26,4.8-9.9,4.8-22,4.8-33.74,0-24.31,1-36,24-36a8,8,0,0,0,0-16Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM88,155.84c.29,14.26.41,20.16,16,20.16a8,8,0,0,1,0,16c-31.27,0-31.72-22.43-32-35.84C71.71,141.9,71.59,136,56,136a8,8,0,0,1,0-16c15.59,0,15.71-5.9,16-20.16C72.28,86.43,72.73,64,104,64a8,8,0,0,1,0,16c-15.59,0-15.71,5.9-16,20.16-.17,8.31-.41,20.09-8,27.84C87.59,135.75,87.83,147.53,88,155.84ZM200,136c-15.59,0-15.71,5.9-16,20.16-.28,13.41-.73,35.84-32,35.84a8,8,0,0,1,0-16c15.59,0,15.71-5.9,16-20.16.17-8.31.41-20.09,8-27.84-7.6-7.75-7.84-19.53-8-27.84C167.71,85.9,167.59,80,152,80a8,8,0,0,1,0-16c31.27,0,31.72,22.43,32,35.84.29,14.26.41,20.16,16,20.16a8,8,0,0,1,0,16Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M39.91,128a27.68,27.68,0,0,1,9.49,11.13C54,148.62,54,160.51,54,172c0,24.27,1.21,38,26,38a6,6,0,0,1,0,12c-16.88,0-27.81-5.6-33.4-17.13C42,195.38,42,183.49,42,172c0-24.27-1.21-38-26-38a6,6,0,0,1,0-12c24.79,0,26-13.73,26-38,0-11.49,0-23.38,4.6-32.87C52.19,39.6,63.12,34,80,34a6,6,0,0,1,0,12C55.21,46,54,59.73,54,84c0,11.49,0,23.38-4.6,32.87A27.68,27.68,0,0,1,39.91,128ZM240,122c-24.79,0-26-13.73-26-38,0-11.49,0-23.38-4.6-32.87C203.81,39.6,192.88,34,176,34a6,6,0,0,0,0,12c24.79,0,26,13.73,26,38,0,11.49,0,23.38,4.6,32.87A27.68,27.68,0,0,0,216.09,128a27.68,27.68,0,0,0-9.49,11.13C202,148.62,202,160.51,202,172c0,24.27-1.21,38-26,38a6,6,0,0,0,0,12c16.88,0,27.81-5.6,33.4-17.13,4.6-9.49,4.6-21.38,4.6-32.87,0-24.27,1.21-38,26-38a6,6,0,0,0,0-12Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M43.18,128a29.78,29.78,0,0,1,8,10.26c4.8,9.9,4.8,22,4.8,33.74,0,24.31,1,36,24,36a8,8,0,0,1,0,16c-17.48,0-29.32-6.14-35.2-18.26-4.8-9.9-4.8-22-4.8-33.74,0-24.31-1-36-24-36a8,8,0,0,1,0-16c23,0,24-11.69,24-36,0-11.72,0-23.84,4.8-33.74C50.68,38.14,62.52,32,80,32a8,8,0,0,1,0,16C57,48,56,59.69,56,84c0,11.72,0,23.84-4.8,33.74A29.78,29.78,0,0,1,43.18,128ZM240,120c-23,0-24-11.69-24-36,0-11.72,0-23.84-4.8-33.74C205.32,38.14,193.48,32,176,32a8,8,0,0,0,0,16c23,0,24,11.69,24,36,0,11.72,0,23.84,4.8,33.74a29.78,29.78,0,0,0,8,10.26,29.78,29.78,0,0,0-8,10.26c-4.8,9.9-4.8,22-4.8,33.74,0,24.31-1,36-24,36a8,8,0,0,0,0,16c17.48,0,29.32-6.14,35.2-18.26,4.8-9.9,4.8-22,4.8-33.74,0-24.31,1-36,24-36a8,8,0,0,0,0-16Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M35.89,128C52,136.23,52,155.64,52,172c0,24.8,1.35,40,28,40a4,4,0,0,1,0,8c-36,0-36-26.61-36-48,0-24.8-1.35-40-28-40a4,4,0,0,1,0-8c26.65,0,28-15.2,28-40,0-21.39,0-48,36-48a4,4,0,0,1,0,8C53.35,44,52,59.2,52,84,52,100.36,52,119.77,35.89,128ZM240,124c-26.65,0-28-15.2-28-40,0-21.39,0-48-36-48a4,4,0,0,0,0,8c26.65,0,28,15.2,28,40,0,16.36,0,35.77,16.11,44C204,136.23,204,155.64,204,172c0,24.8-1.35,40-28,40a4,4,0,0,0,0,8c36,0,36-26.61,36-48,0-24.8,1.35-40,28-40a4,4,0,0,0,0-8Z`}))]]),M=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M120,128a16,16,0,1,1-16-16A16,16,0,0,1,120,128Zm32-16a16,16,0,1,0,16,16A16,16,0,0,0,152,112Zm84,16A108,108,0,0,1,78.77,224.15L46.34,235A20,20,0,0,1,21,209.66l10.81-32.43A108,108,0,1,1,236,128Zm-24,0A84,84,0,1,0,55.27,170.06a12,12,0,0,1,1,9.81l-9.93,29.79,29.79-9.93a12.1,12.1,0,0,1,3.8-.62,12,12,0,0,1,6,1.62A84,84,0,0,0,212,128Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-4-1.08,7.85,7.85,0,0,0-2.53.42L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Zm12-88a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm-44,0a12,12,0,1,1-12-12A12,12,0,0,1,96,128Zm88,0a12,12,0,1,1-12-12A12,12,0,0,1,184,128Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24ZM84,140a12,12,0,1,1,12-12A12,12,0,0,1,84,140Zm44,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm44,0a12,12,0,1,1,12-12A12,12,0,0,1,172,140Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM84,118a10,10,0,1,0,10,10A10,10,0,0,0,84,118Zm88,0a10,10,0,1,0,10,10A10,10,0,0,0,172,118Zm58,10A102,102,0,0,1,79.31,217.65L44.44,229.27a14,14,0,0,1-17.71-17.71l11.62-34.87A102,102,0,1,1,230,128Zm-12,0A90,90,0,1,0,50.08,173.06a6,6,0,0,1,.5,4.91L38.12,215.35a2,2,0,0,0,2.53,2.53L78,205.42a6.2,6.2,0,0,1,1.9-.31,6.09,6.09,0,0,1,3,.81A90,90,0,0,0,218,128Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM84,116a12,12,0,1,0,12,12A12,12,0,0,0,84,116Zm88,0a12,12,0,1,0,12,12A12,12,0,0,0,172,116Zm60,12A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Zm-16,0A88,88,0,1,0,51.81,172.06a8,8,0,0,1,.66,6.54L40,216,77.4,203.53a7.85,7.85,0,0,1,2.53-.42,8,8,0,0,1,4,1.08A88,88,0,0,0,216,128Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-52-8a8,8,0,1,0,8,8A8,8,0,0,0,84,120Zm88,0a8,8,0,1,0,8,8A8,8,0,0,0,172,120Zm56,8A100,100,0,0,1,79.5,215.47l-35.69,11.9a12,12,0,0,1-15.18-15.18l11.9-35.69A100,100,0,1,1,228,128Zm-8,0A92,92,0,1,0,48.35,174.07a4,4,0,0,1,.33,3.27L36.22,214.72a4,4,0,0,0,5.06,5.06l37.38-12.46a3.93,3.93,0,0,1,1.27-.21,4.05,4.05,0,0,1,2,.54A92,92,0,0,0,220,128Z`}))]]),be=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,176A72,72,0,0,1,92,65.64a8,8,0,0,1,8,13.85,56,56,0,1,0,56,0,8,8,0,0,1,8-13.85A72,72,0,0,1,128,200Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M228,128a100,100,0,0,1-200,0c0-39.4,22.9-75.37,58.33-91.63a4,4,0,1,1,3.34,7.27C57.07,58.6,36,91.71,36,128a92,92,0,0,0,184,0c0-36.29-21.07-69.4-53.67-84.36a4,4,0,1,1,3.34-7.27C205.1,52.63,228,88.6,228,128Z`}))]]),xe=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z`}))]]),N=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M180,64H40A12,12,0,0,0,28,76V216a12,12,0,0,0,12,12H180a12,12,0,0,0,12-12V76A12,12,0,0,0,180,64ZM168,204H52V88H168ZM228,40V180a12,12,0,0,1-24,0V52H76a12,12,0,0,1,0-24H216A12,12,0,0,1,228,40Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,72V216H40V72Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M192,72V216a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H184A8,8,0,0,1,192,72Zm24-40H72a8,8,0,0,0,0,16H208V184a8,8,0,0,0,16,0V40A8,8,0,0,0,216,32Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,66H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H184a6,6,0,0,0,6-6V72A6,6,0,0,0,184,66Zm-6,144H46V78H178ZM222,40V184a6,6,0,0,1-12,0V46H72a6,6,0,0,1,0-12H216A6,6,0,0,1,222,40Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,64H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H184a8,8,0,0,0,8-8V72A8,8,0,0,0,184,64Zm-8,144H48V80H176ZM224,40V184a8,8,0,0,1-16,0V48H72a8,8,0,0,1,0-16H216A8,8,0,0,1,224,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M184,68H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H184a4,4,0,0,0,4-4V72A4,4,0,0,0,184,68Zm-4,144H44V76H180ZM220,40V184a4,4,0,0,1-8,0V44H72a4,4,0,0,1,0-8H216A4,4,0,0,1,220,40Z`}))]]),P=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216.49,79.52l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.52ZM160,57l23,23H160ZM60,212V44h76V92a12,12,0,0,0,12,12h48V212Zm112-80a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,132Zm0,40a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,172Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M208,88H152V32Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,176H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm-8-56V44l44,44Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Zm-34-82a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,136Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,168Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40V216a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM200,220H56a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216A4,4,0,0,1,200,220Zm-36-84a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,136Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,168Z`}))]]),F=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M71.76,148H31.7a12,12,0,1,1,0-24H65.33l12.45-18.66a12,12,0,0,1,20,0l22,33,6-9a12,12,0,0,1,10-5.34h24a12,12,0,1,1,0,24h-17.6l-12.46,18.66a12,12,0,0,1-20,0l-22-33-6,9A12,12,0,0,1,71.76,148ZM177.91,36c-20.12,0-38,7.93-50.07,21.56C115.74,43.93,97.89,36,77.76,36A66,66,0,0,0,12.07,94.68,12,12,0,0,0,36,97.32,42,42,0,0,1,77.76,60c17.83,0,32.75,9.4,38.95,24.54a12,12,0,0,0,22.25,0C145.16,69.4,160.08,60,177.91,60A42.08,42.08,0,0,1,220,102c0,29.42-25.86,57.77-47.56,76.36a329,329,0,0,1-44.58,31.81c-10.87-6.45-35.37-22-56.51-42.73a12,12,0,1,0-16.84,17.12c30.39,29.81,66.15,49.2,67.66,50a12.06,12.06,0,0,0,11.39,0C138,232.14,244,174.34,244,102A66.12,66.12,0,0,0,177.91,36Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M232,102c0,66-104,122-104,122S24,168,24,102A54,54,0,0,1,78,48c22.59,0,41.94,12.31,50,32,8.06-19.69,27.41-32,50-32A54,54,0,0,1,232,102Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M72,144H32a8,8,0,0,1,0-16H67.72l13.62-20.44a8,8,0,0,1,13.32,0l25.34,38,9.34-14A8,8,0,0,1,136,128h24a8,8,0,0,1,0,16H140.28l-13.62,20.44a8,8,0,0,1-13.32,0L88,126.42l-9.34,14A8,8,0,0,1,72,144ZM178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,.75,0,1.5,0,2.25a8,8,0,1,0,16-.5c0-.58,0-1.17,0-1.75A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46c0,53.61-77.76,102.15-96,112.8-10.83-6.31-42.63-26-66.68-52.21a8,8,0,1,0-11.8,10.82c31.17,34,72.93,56.68,74.69,57.63a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M240,102c0,70-103.79,126.66-108.21,129a8,8,0,0,1-7.58,0c-3.35-1.8-63.55-34.69-92.68-80.89A4,4,0,0,1,34.92,144H72a8,8,0,0,0,6.66-3.56l9.34-14,25.34,38a8,8,0,0,0,9.16,3.16,8.23,8.23,0,0,0,4.28-3.34L140.28,144H160a8,8,0,0,0,8-8.53,8.18,8.18,0,0,0-8.25-7.47H136a8,8,0,0,0-6.66,3.56l-9.34,14-25.34-38a8,8,0,0,0-9.17-3.16,8.25,8.25,0,0,0-4.27,3.34L67.72,128H23.53a4,4,0,0,1-3.83-2.81A76.93,76.93,0,0,1,16,102,62.07,62.07,0,0,1,78,40c20.65,0,38.73,8.88,50,23.89C139.27,48.88,157.35,40,178,40A62.07,62.07,0,0,1,240,102Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M72,142H32a6,6,0,0,1,0-12H68.79L83,108.67a6,6,0,0,1,10,0l27,40.51,11-16.51a6,6,0,0,1,5-2.67h24a6,6,0,0,1,0,12H139.21L125,163.33a6,6,0,0,1-10,0L88,122.82,77,139.33A6,6,0,0,1,72,142ZM178,42c-21,0-39.26,9.47-50,25.34C117.26,51.47,99,42,78,42a60.07,60.07,0,0,0-60,60q0,1.09,0,2.19a6,6,0,0,0,12-.38c0-.6,0-1.21,0-1.81A48.05,48.05,0,0,1,78,54c20.28,0,37.31,10.83,44.45,28.27a6,6,0,0,0,11.1,0C140.69,64.83,157.72,54,178,54a48.05,48.05,0,0,1,48,48c0,55.73-81.61,105.65-98,115.11-9.84-5.66-43.09-25.82-68.16-53.16a6,6,0,1,0-8.84,8.1c30.94,33.77,72.41,56.29,74.16,57.23a6,6,0,0,0,5.68,0,334.68,334.68,0,0,0,53.06-37C219.8,161.59,238,131.2,238,102A60.07,60.07,0,0,0,178,42Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M72,144H32a8,8,0,0,1,0-16H67.72l13.62-20.44a8,8,0,0,1,13.32,0l25.34,38,9.34-14A8,8,0,0,1,136,128h24a8,8,0,0,1,0,16H140.28l-13.62,20.44a8,8,0,0,1-13.32,0L88,126.42l-9.34,14A8,8,0,0,1,72,144ZM178,40c-20.65,0-38.73,8.88-50,23.89C116.73,48.88,98.65,40,78,40a62.07,62.07,0,0,0-62,62c0,.75,0,1.5,0,2.25a8,8,0,1,0,16-.5c0-.58,0-1.17,0-1.75A46.06,46.06,0,0,1,78,56c19.45,0,35.78,10.36,42.6,27a8,8,0,0,0,14.8,0c6.82-16.67,23.15-27,42.6-27a46.06,46.06,0,0,1,46,46c0,53.61-77.76,102.15-96,112.8-10.83-6.31-42.63-26-66.68-52.21a8,8,0,1,0-11.8,10.82c31.17,34,72.93,56.68,74.69,57.63a8,8,0,0,0,7.58,0C136.21,228.66,240,172,240,102A62.07,62.07,0,0,0,178,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M72,140H32a4,4,0,0,1,0-8H69.86l14.81-22.22a4,4,0,0,1,6.66,0l28.67,43,12.67-19A4,4,0,0,1,136,132h24a4,4,0,0,1,0,8H138.14l-14.81,22.22a4,4,0,0,1-6.66,0L88,119.21l-12.67,19A4,4,0,0,1,72,140ZM178,44c-21.44,0-39.92,10.19-50,27.07C117.92,54.19,99.44,44,78,44a58.07,58.07,0,0,0-58,58q0,1.06,0,2.13a4,4,0,1,0,8-.26c0-.62,0-1.24,0-1.87A50.06,50.06,0,0,1,78,52c21.11,0,38.85,11.31,46.3,29.51a4,4,0,0,0,7.4,0C139.15,63.31,156.89,52,178,52a50.06,50.06,0,0,1,50,50c0,58-86,109.46-100,117.42-8.47-4.82-43.5-25.61-69.63-54.12a4,4,0,0,0-5.9,5.4c30.72,33.52,71.9,55.89,73.63,56.82a4,4,0,0,0,3.8,0,333.81,333.81,0,0,0,52.7-36.73C218,160.47,236,130.59,236,102A58.07,58.07,0,0,0,178,44Z`}))]]),Se=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),I=new Map([[`bold`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),j.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,j.createElement(j.Fragment,null,j.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),L=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:ye}));L.displayName=`BracketsCurlyIcon`;var Ce=L,R=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:M}));R.displayName=`ChatCircleDotsIcon`;var z=R,B=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:be}));B.displayName=`CircleNotchIcon`;var we=B,Te=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:xe}));Te.displayName=`ClockIcon`;var Ee=Te,De=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:N}));De.displayName=`CopySimpleIcon`;var V=De,H=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:P}));H.displayName=`FileTextIcon`;var U=H,W=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:F}));W.displayName=`HeartbeatIcon`;var Oe=W,ke=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:Se}));ke.displayName=`PaperPlaneTiltIcon`;var G=ke,K=j.forwardRef((e,t)=>j.createElement(m,{ref:t,...e,weights:I}));K.displayName=`StopIcon`;var Ae=K;function q(){return`${location.protocol}//${location.host}`}function J(e){return e?/^https?:\/\//i.test(e)?e:e.startsWith(`/`)?`${q()}${e}`:`${q()}/${e}`:q()}var Y=n();function je({access:e}){let{t}=p(),[n,r]=(0,j.useState)(``),o=J(e?.openai_base_url||`/v1`),s=(0,j.useMemo)(()=>[{name:t(`endpointOpenAI`),url:o,method:`BASE`,hint:t(`endpointBaseHint`),icon:(0,Y.jsx)(Ce,{size:15})},{name:t(`endpointChat`),url:J(e?.chat_completions||`${o}/chat/completions`),method:`POST`,hint:t(`endpointChatHint`),icon:(0,Y.jsx)(G,{size:15})},{name:t(`endpointMessages`),url:J(e?.messages||`${o}/messages`),method:`POST`,hint:t(`endpointMessagesHint`),icon:(0,Y.jsx)(G,{size:15})},{name:t(`endpointResponses`),url:J(e?.responses||`${o}/responses`),method:`POST`,hint:t(`endpointResponsesHint`),icon:(0,Y.jsx)(G,{size:15})},{name:t(`endpointModels`),url:J(e?.models||`${o}/models`),method:`GET`,hint:t(`endpointModelsHint`),icon:(0,Y.jsx)(i,{size:15})},{name:t(`endpointHealth`),url:J(e?.health||`/health`),method:`GET`,hint:t(`endpointHealthHint`),icon:(0,Y.jsx)(Oe,{size:15})}],[e,o,t]);return(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`flex items-start justify-between gap-4 px-5 py-4 sm:px-6`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold`,children:t(`endpoints`)}),(0,Y.jsx)(se,{size:`sm`,variant:`soft`,children:t(`endpointCount`,{count:s.length-1})})]}),(0,Y.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`routesHint`)})]})}),(0,Y.jsx)(`div`,{className:`grid gap-2 px-3 pb-3 sm:grid-cols-2 sm:px-4 sm:pb-4 lg:grid-cols-3`,children:s.map(e=>(0,Y.jsxs)(`div`,{className:`group min-w-0 rounded-xl bg-surface-secondary/40 p-3 transition-colors hover:bg-surface-secondary/70`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface text-muted`,children:e.icon}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`truncate text-body font-semibold`,children:e.name}),(0,Y.jsx)(`code`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.url})]})]}),(0,Y.jsx)(se,{size:`sm`,variant:`soft`,children:e.method})]}),(0,Y.jsx)(`p`,{className:`mt-2 text-caption leading-5 text-muted`,children:e.hint}),(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:e.method===`BASE`?t(`endpointBaseLabel`):t(`endpointAuthLabel`)}),(0,Y.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`copy`),onPress:()=>{d(e.url),r(e.name),window.setTimeout(()=>r(``),1100)},children:(0,Y.jsx)(a,{copied:n===e.name})}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(`open`),onPress:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),children:(0,Y.jsx)(c,{size:14})})]})]})]},e.name))})]})}var Me=new Set(`txt.md.markdown.json.csv.tsv.yml.yaml.toml.xml.html.htm.css.scss.js.jsx.ts.tsx.mjs.cjs.py.go.rs.java.kt.swift.c.h.cpp.hpp.sh.bash.zsh.sql.graphql.env.ini.conf.log.rst.tex`.split(`.`)),Ne=new Set([`image/png`,`image/jpeg`,`image/jpg`,`image/gif`,`image/webp`]);function X(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t+1).toLowerCase():``}function Pe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}async function Z(e){let t=X(e.name),n=e.type||`application/octet-stream`,r=`${e.name}-${e.size}-${e.lastModified}-${Math.random().toString(36).slice(2,8)}`;if(Ne.has(n)||[`png`,`jpg`,`jpeg`,`gif`,`webp`].includes(t)){let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(r.error||Error(`read failed`)),r.readAsDataURL(e)});return{id:r,name:e.name,mime:n,kind:`image`,dataUrl:t,size:e.size}}if(Me.has(t)||n.startsWith(`text/`)||n===`application/json`){let t=await e.text();return{id:r,name:e.name,mime:n,kind:`text`,text:t,size:e.size}}return null}function Q({ariaLabel:e,value:t,onChange:n,placeholder:r,isDisabled:i,options:a,className:o,tone:s=`default`}){let c=a.find(e=>e.id===t),l=s===`muted`?`text-muted hover:text-foreground`:`text-foreground`;return(0,Y.jsxs)(x,{className:o??`w-auto max-w-[11rem] min-w-0`,"aria-label":e,value:t||null,placeholder:r,isDisabled:i,onChange:e=>{typeof e==`string`&&e&&n(e)},children:[(0,Y.jsxs)(x.Trigger,{className:`h-8 min-h-8 gap-1 rounded-[10px] border-0 bg-transparent px-2.5 shadow-none items-center hover:bg-surface-secondary/80 data-[focus-visible=true]:bg-surface-secondary/80 ${l}`,children:[(0,Y.jsx)(x.Value,{className:`min-w-0 truncate text-caption font-medium`,children:({defaultChildren:e,isPlaceholder:t})=>t||!c?e:(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[c.icon?(0,Y.jsx)(`span`,{className:`grid size-3.5 shrink-0 place-items-center opacity-80`,children:c.icon}):null,(0,Y.jsx)(`span`,{className:`truncate`,children:c.label})]})}),(0,Y.jsx)(x.Indicator,{className:`size-2.5 opacity-50`})]}),(0,Y.jsx)(x.Popover,{placement:`top end`,className:`max-h-72 min-w-48`,children:(0,Y.jsx)(v,{children:a.map(e=>(0,Y.jsxs)(v.Item,{id:e.id,textValue:e.textValue,className:`gap-2`,children:[e.icon?(0,Y.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center`,children:e.icon}):null,(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(g,{className:`block truncate text-caption`,children:e.label}),e.hint?(0,Y.jsx)(`span`,{className:`block truncate text-caption text-muted`,children:e.hint}):null]}),(0,Y.jsx)(v.ItemIndicator,{})]},e.id))})})]})}function Fe({value:e,onChange:t,attachments:n,onAttachmentsChange:r,disabled:i,streaming:a,canSend:o,onSend:c,onStop:l,accountValue:u,onAccountChange:d,accountOptions:m,modelValue:g,onModelChange:ee,modelOptions:_,modelsLoading:v}){let{t:y}=p(),b=(0,j.useRef)(null);async function x(e){if(!e?.length)return;let t=[],i=[];for(let n of Array.from(e))try{let e=await Z(n);e?t.push(e):i.push(n.name)}catch{i.push(n.name)}t.length&&r([...n,...t]),i.length&&pe({type:`error`,title:y(`chatAttachUnsupported`,{names:i.join(`, `)})}),b.current&&(b.current.value=``)}function S(e){e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),!a&&o&&c())}return(0,Y.jsxs)(`div`,{className:`access-composer px-3 pb-3 pt-2.5 sm:px-4 sm:pb-3.5 sm:pt-3`,children:[(0,Y.jsxs)(`div`,{className:`access-composer-well overflow-hidden rounded-2xl`,children:[n.length?(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,children:n.map(e=>(0,Y.jsxs)(`span`,{className:`inline-flex max-w-[14rem] items-center gap-2 rounded-xl bg-surface/80 px-1.5 py-1.5 text-caption text-foreground`,children:[e.kind===`image`&&e.dataUrl?(0,Y.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-8 shrink-0 rounded-lg object-cover`}):(0,Y.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-muted`,children:(0,Y.jsx)(U,{size:14})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate font-medium`,children:e.name}),(0,Y.jsx)(`span`,{className:`mono text-muted`,children:Pe(e.size)})]}),(0,Y.jsx)(`button`,{type:`button`,className:`grid size-6 shrink-0 place-items-center rounded-md text-muted hover:bg-surface-secondary hover:text-foreground`,"aria-label":y(`chatAttachRemove`),onClick:()=>r(n.filter(t=>t.id!==e.id)),children:(0,Y.jsx)(ue,{size:12})})]},e.id))}):null,(0,Y.jsx)(s,{fullWidth:!0,rows:3,className:`min-h-20 resize-none border-0 bg-transparent px-3.5 py-3 text-body leading-[1.65] shadow-none focus-visible:ring-0`,value:e,onChange:e=>t(e.target.value),onKeyDown:S,placeholder:y(`promptPlaceholder`),"aria-label":y(`prompt`),disabled:i||a}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 pb-2 pt-0.5`,children:[(0,Y.jsx)(`input`,{ref:b,type:`file`,className:`hidden`,multiple:!0,accept:`.txt,.md,.json,.csv,.yml,.yaml,.toml,.xml,.html,.css,.js,.jsx,.ts,.tsx,.py,.go,.rs,.sh,.sql,.png,.jpg,.jpeg,.gif,.webp,text/*,image/png,image/jpeg,image/gif,image/webp,application/json`,onChange:e=>void x(e.target.files)}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 shrink-0 rounded-[10px]`,"aria-label":y(`chatAttach`),isDisabled:i||a,onPress:()=>b.current?.click(),children:(0,Y.jsx)(f,{size:15})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,Y.jsx)(Q,{ariaLabel:y(`account`),value:u,onChange:d,options:m,isDisabled:i||a,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,Y.jsx)(Q,{ariaLabel:y(`model`),value:g,onChange:ee,placeholder:y(v?`requesting`:`model`),options:_,isDisabled:i||a||v||!_.length,className:`w-auto max-w-[10.5rem] min-w-0`}),(0,Y.jsxs)(`div`,{className:`relative size-8 shrink-0`,children:[(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`secondary`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`opacity-100`:`pointer-events-none opacity-0`}`,"aria-label":y(`chatTryStop`),onPress:l,children:(0,Y.jsx)(Ae,{size:14,weight:`fill`})}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,className:`absolute inset-0 size-8 rounded-[10px] transition-opacity duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] ${a?`pointer-events-none opacity-0`:`opacity-100`}`,"aria-label":y(`chatTrySend`),isDisabled:!o||i||a,onPress:c,children:(0,Y.jsx)(G,{size:14,weight:`fill`})})]})]})]}),(0,Y.jsx)(`p`,{className:`mt-1 px-1 text-caption leading-4 text-muted/65`,children:y(`chatTryHelper`)})]})}function Ie({collapsed:e,onCollapsedChange:t,items:n,activeId:i,onSelect:a,onNew:o}){let{t:s}=p(),c=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let t=c.current;!t||A()||e||D.fromTo(t,{autoAlpha:0},{autoAlpha:1,duration:k.fast,ease:`power2.out`})},[e]),e?(0,Y.jsxs)(`div`,{className:`access-hist-rail flex w-9 shrink-0 flex-col items-center gap-1 border-r py-2`,children:[(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":s(`chatHistoryExpand`),onPress:()=>t(!1),children:(0,Y.jsx)(ce,{size:15})}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":s(`chatHistoryNew`),onPress:o,children:(0,Y.jsx)(f,{size:14})})]}):(0,Y.jsxs)(`aside`,{ref:c,className:`access-hist-rail flex w-[13rem] shrink-0 flex-col border-r`,"aria-label":s(`chatHistoryTitle`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate px-1.5 text-caption font-medium text-muted`,children:s(`chatHistoryTitle`)}),(0,Y.jsx)(h,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-8 min-w-8 rounded-[10px] text-muted`,"aria-label":s(`chatHistoryCollapse`),onPress:()=>t(!0),children:(0,Y.jsx)(r,{size:14})})]}),(0,Y.jsx)(`div`,{className:`px-2 pb-1.5`,children:(0,Y.jsxs)(h,{size:`sm`,variant:`ghost`,className:`h-8 w-full justify-start gap-1.5 rounded-[10px] px-2.5 text-caption font-medium text-muted hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onPress:o,children:[(0,Y.jsx)(f,{size:13}),s(`chatHistoryNew`)]})}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 space-y-0.5 overflow-y-auto px-1.5 pb-2.5`,children:n.length?n.map(e=>{let t=e.id===i;return(0,Y.jsx)(`button`,{type:`button`,"data-active":t?`true`:void 0,className:`access-hist-item flex h-8 w-full items-center rounded-[10px] px-2.5 text-left text-caption leading-5 ${t?`font-medium text-foreground`:`font-normal text-muted`}`,onClick:()=>a(e.id),children:(0,Y.jsx)(`span`,{className:`line-clamp-1 tracking-tight`,children:e.title||s(`chatHistoryUntitled`)})},e.id)}):(0,Y.jsx)(`p`,{className:`px-2.5 py-6 text-center text-caption leading-5 text-muted/70`,children:s(`chatHistoryEmpty`)})})]})}function Le({text:e,streaming:t,defaultOpen:n}){let{t:r}=p(),[i,a]=(0,j.useState)(!!n),[o,s]=(0,j.useState)(0),c=(0,j.useRef)(0),l=(0,j.useRef)(null),d=(0,j.useRef)(null);if((0,j.useEffect)(()=>{t?a(!1):n!=null&&a(!!n)},[t,n]),(0,j.useEffect)(()=>{if(!t)return;let e=Date.now();s(0);let n=window.setInterval(()=>{let t=Math.floor((Date.now()-e)/1e3);s(t),c.current=t},250);return()=>window.clearInterval(n)},[t]),(0,j.useEffect)(()=>{!t&&o===0&&c.current>0&&s(c.current)},[t,o]),(0,j.useEffect)(()=>{let t=l.current,n=d.current;if(!t)return;let r=A();if(!i||!e){if(r){t.style.height=`0px`,t.style.opacity=`0`;return}D.to(t,{height:0,opacity:0,duration:k.fast,ease:me.inOut,overwrite:!0});return}let a=n?.scrollHeight??0;if(r){t.style.height=`auto`,t.style.opacity=`1`;return}D.fromTo(t,{height:0,opacity:0},{height:a,opacity:1,duration:k.base,ease:me.out,overwrite:!0,onComplete:()=>{t.style.height=`auto`}})},[i,e]),!e&&!t)return null;let f=A(),m=t?o:o||c.current;return(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-xl`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-surface-secondary px-2.5 py-1 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:t?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(we,{size:12,className:`shrink-0 text-muted ${f?``:`animate-spin`}`}),(0,Y.jsx)(`span`,{className:f?``:`access-thinking-shimmer`,children:r(`thinkingWorking`)}),(0,Y.jsxs)(`span`,{className:`mono text-muted/80`,children:[o,`s`]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(u,{size:11,className:`shrink-0 transition-transform duration-200 ease-out ${i?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{children:r(`thinkingDone`)}),m>0?(0,Y.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingElapsed`,{n:m})}):null,!m&&e?(0,Y.jsx)(`span`,{className:`mono text-muted/80`,children:r(`thinkingChars`,{count:e.length})}):null]})}),(0,Y.jsx)(`div`,{ref:l,className:`overflow-hidden`,style:{height:0,opacity:0},children:e?(0,Y.jsx)(`pre`,{ref:d,className:`mt-1.5 max-h-52 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-surface-secondary/80 px-3 py-2 text-caption leading-5 text-muted`,children:e}):null})]})}function Re(e,t){return t(e===`running`?`toolCallRunning`:e===`error`?`toolCallError`:`toolCallSuccess`)}function ze({status:e}){return e===`running`?(0,Y.jsx)(oe,{size:12,className:`animate-spin text-muted`}):e===`error`?(0,Y.jsx)(fe,{size:12,weight:`fill`,className:`text-danger`}):(0,Y.jsx)(ae,{size:12,weight:`fill`,className:`text-success`})}function Be(e){if(!e.trim())return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Ve({call:e,forceOpen:t}){let{t:n}=p(),[r,i]=(0,j.useState)(e.status===`error`||!!t),[a,o]=(0,j.useState)(!1),s=(0,j.useMemo)(()=>Be(e.arguments||``),[e.arguments]);(0,j.useEffect)(()=>{e.status===`error`&&i(!0)},[e.status]),(0,j.useEffect)(()=>{t&&i(!0)},[t]);async function c(){s&&(await d(s),o(!0),window.setTimeout(()=>o(!1),1200))}return(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-lg`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[(0,Y.jsx)(u,{size:11,className:`shrink-0 text-muted transition-transform ${r?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-caption font-medium text-foreground`,children:e.name||n(`toolCallUntitled`)}),(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-caption text-muted`,children:[(0,Y.jsx)(ze,{status:e.status}),Re(e.status,n)]})]}),r?(0,Y.jsxs)(`div`,{className:`space-y-1.5 px-2 pb-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:n(`toolCallArgs`)}),(0,Y.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-caption text-muted hover:bg-surface-secondary hover:text-foreground`,onClick:e=>{e.stopPropagation(),c()},children:[(0,Y.jsx)(V,{size:12}),n(a?`copied`:`copy`)]})]}),(0,Y.jsx)(`pre`,{className:`mono max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary/80 px-2.5 py-2 text-caption leading-5 text-muted`,children:s||n(`toolCallArgsEmpty`)})]}):null]})}function He({calls:e}){let{t}=p(),n=e.some(e=>e.status===`error`),r=e.some(e=>e.status===`running`),[i,a]=(0,j.useState)(n||r||e.length===1);return(0,j.useEffect)(()=>{(n||r)&&a(!0)},[n,r]),e.length?e.length===1?(0,Y.jsx)(`div`,{className:`rounded-xl bg-surface-secondary/70`,children:(0,Y.jsx)(Ve,{call:e[0],forceOpen:e[0].status===`error`})}):(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-surface-secondary/70`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-caption text-muted`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[(0,Y.jsx)(u,{size:11,className:`shrink-0 transition-transform ${i?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:t(`toolCallGroup`,{n:e.length})}),r?(0,Y.jsx)(oe,{size:12,className:`animate-spin`}):null]}),i?(0,Y.jsx)(`div`,{className:`space-y-0.5 border-t border-separator/40 px-0.5 py-1`,children:e.map(e=>(0,Y.jsx)(Ve,{call:e},`${e.index}-${e.id||e.name}`))}):null]}):null}function Ue({message:e}){return e.attachments?.length?(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.attachments.map(e=>(0,Y.jsxs)(`span`,{className:`inline-flex max-w-[12rem] items-center gap-1.5 rounded-xl bg-surface/70 px-1.5 py-1 text-caption text-muted`,children:[e.kind===`image`&&e.dataUrl?(0,Y.jsx)(`img`,{src:e.dataUrl,alt:``,className:`size-7 shrink-0 rounded-lg object-cover`}):(0,Y.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface`,children:(0,Y.jsx)(U,{size:12})}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id))}):null}function We({message:e}){let{t}=p(),n=e.usage;if(!n||n.credits==null)return null;let r=n.prompt_tokens,i=n.completion_tokens,a=typeof r==`number`||typeof i==`number`?t(`chatTryUsageTokens`,{prompt:C(r??0),completion:C(i??0)}):``;return(0,Y.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`chatTryUsageFoot`,{tokens:a,amount:w(n.credits)}):t(`chatTryCreditsUsed`,{amount:w(n.credits)})})}function Ge({text:e,streaming:t}){let n=e.split(/(\n{2,})/),r=-1;for(let e=n.length-1;e>=0;--e)if(n[e]&&!/^\n{2,}$/.test(n[e])){r=e;break}return(0,Y.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground ${t?`access-streaming`:``}`,children:n.map((e,n)=>e?/^\n{2,}$/.test(e)?(0,Y.jsx)(`span`,{children:e},`s-${n}`):(0,Y.jsx)(`span`,{className:t&&n===r?`access-stream-seg`:void 0,children:e},`p-${n}`):null)})}function Ke(){let e=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let t=e.current;!t||A()||D.from(t,{autoAlpha:0,duration:k.fast,ease:`power2.out`})},[]),e}function qe({message:e}){let{t}=p(),[n,r]=(0,j.useState)(!1),i=e.role===`user`,o=Ke();if(i)return(0,Y.jsx)(`div`,{ref:o,className:`ml-auto max-w-[92%] sm:max-w-[78%]`,children:(0,Y.jsxs)(`div`,{className:`access-bubble access-bubble--user rounded-2xl rounded-br-md px-3.5 py-2.5`,children:[e.content?(0,Y.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body leading-[1.65] text-foreground`,children:e.content}):null,(0,Y.jsx)(Ue,{message:e})]})});let s=e.status===`streaming`&&!e.content&&!e.reasoning&&!e.toolCalls?.length,c=!!e.content&&e.status===`done`,l=e.status===`streaming`,u=!!(e.usage&&e.usage.credits!=null),f=e.status===`done`&&(e.latency_ms!=null||e.ttfb_ms!=null||typeof e.usage?.completion_tokens==`number`);async function m(){e.content&&(await d(e.content),r(!0),window.setTimeout(()=>r(!1),1200))}return(0,Y.jsxs)(`div`,{className:`group/access-msg max-w-[96%] space-y-1.5 sm:max-w-[88%]`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-1.5 px-0.5`,children:(0,Y.jsx)(`span`,{className:`grid size-5 shrink-0 place-items-center rounded-lg border border-border bg-surface-secondary`,children:(0,Y.jsx)(ge,{provider:e.provider,size:13})})}),e.reasoning||l?(0,Y.jsx)(Le,{text:e.reasoning||``,streaming:l&&(!e.content||!!e.reasoning),defaultOpen:e.reasoningOpen}):null,e.toolCalls?.length?(0,Y.jsx)(He,{calls:e.toolCalls}):null,e.status===`error`?(0,Y.jsx)(ee,{status:`danger`,title:t(`requestFailed`),description:e.error||``}):s?(0,Y.jsxs)(`div`,{className:`space-y-2 pt-0.5`,children:[(0,Y.jsx)(O,{className:`h-3 w-28 rounded-md`}),(0,Y.jsx)(O,{className:`h-3 w-full rounded-md`}),(0,Y.jsx)(O,{className:`h-3 w-[86%] rounded-md`}),(0,Y.jsx)(O,{className:`h-3 w-[68%] rounded-md`})]}):e.content?(0,Y.jsx)(`div`,{className:`access-bubble access-bubble--assistant px-0.5 py-0`,children:(0,Y.jsx)(Ge,{text:e.content,streaming:l})}):null,c||u||f?(0,Y.jsxs)(`div`,{className:`access-msg-foot space-y-1 px-0.5 pt-0.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[c?(0,Y.jsxs)(h,{size:`sm`,variant:`ghost`,className:`h-5 min-h-5 gap-1 px-1.5 text-caption text-muted/80`,onPress:()=>void m(),children:[(0,Y.jsx)(a,{copied:n,size:12}),t(n?`copied`:`copy`)]}):null,(0,Y.jsx)(We,{message:e})]}),f?(0,Y.jsx)(ve,{variant:`inline`,latencyMs:e.latency_ms,ttfbMs:e.ttfb_ms,completionTokens:e.usage?.completion_tokens,stream:!0,className:`access-latency-inline max-h-0 overflow-hidden opacity-0 transition-[opacity,max-height] duration-200 ease-[cubic-bezier(0.2,0.7,0.2,1)] group-hover/access-msg:max-h-5 group-hover/access-msg:opacity-100 focus-within:max-h-5 focus-within:opacity-100`,labels:{ttft:t(`logsColTTFT`),total:t(`logsLatencyTotal`),tps:t(`logsOutputTPS`)}}):null]}):null]})}function Je({messages:e,busy:t,onLoadDemo:n}){let{t:r}=p(),i=(0,j.useRef)(null);(0,j.useEffect)(()=>{i.current?.scrollIntoView({block:`end`})},[e,t]);let a=!e.length;return(0,Y.jsxs)(`div`,{className:`access-thread min-h-0 flex-1 overflow-y-auto px-4 sm:px-6 ${a?`py-5 sm:py-6`:`pb-2 pt-4 sm:pb-2.5 sm:pt-5`}`,"aria-live":`polite`,"aria-busy":t,children:[a?(0,Y.jsx)(_,{className:`min-h-56`,icon:(0,Y.jsx)(z,{size:22}),title:r(`chatTryEmptyTitle`),hint:r(`chatTryEmptyHint`),action:n?(0,Y.jsx)(`button`,{type:`button`,className:`inline-flex h-8 items-center rounded-[10px] px-2.5 text-caption font-medium text-muted transition-colors hover:bg-[var(--sidebar-hover)] hover:text-foreground`,onClick:n,children:r(`chatDemoLoad`)}):void 0}):(0,Y.jsx)(`div`,{className:`space-y-4`,children:e.map(e=>(0,Y.jsx)(qe,{message:e},e.id))}),(0,Y.jsx)(`div`,{ref:i})]})}function Ye({format:e,onFormatChange:t,requestPath:n,prompt:r,onPromptChange:i,onTest:o,requestState:c,elapsedMs:l,output:u,responseStatus:d,curl:f,copiedCurl:m,onCopyCurl:g,canSend:v,accountValue:y,onAccountChange:b,accountOptions:x,modelValue:S,onModelChange:te,modelOptions:C,modelsLoading:w,disabled:T}){let{t:E}=p();return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(`p`,{className:`px-1 text-caption leading-5 text-muted`,children:E(`rawFormatHint`)}),(0,Y.jsx)(`div`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:(0,Y.jsxs)(`div`,{className:`grid xl:grid-cols-[minmax(420px,.92fr)_minmax(0,1.08fr)]`,children:[(0,Y.jsxs)(`div`,{className:`xl:border-r xl:border-[color-mix(in_oklab,var(--foreground)_6%,transparent)]`,children:[(0,Y.jsxs)(`div`,{className:`px-4 py-3.5 sm:px-5`,children:[(0,Y.jsx)(`h3`,{className:`text-body font-semibold`,children:E(`requestBuilder`)}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-caption text-muted`,children:[`POST `,n]})]}),(0,Y.jsxs)(`div`,{className:`space-y-4 px-4 pb-4 sm:px-5 sm:pb-5`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:E(`rawFormatLabel`)}),(0,Y.jsx)(he,{className:`access-format-chips`,ariaLabel:E(`rawFormatLabel`),value:e,onChange:e=>t(e),options:[{id:`chat`,label:E(`rawFormatChat`)},{id:`messages`,label:E(`rawFormatMessages`)},{id:`responses`,label:E(`rawFormatResponses`)}]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,Y.jsx)(Q,{ariaLabel:E(`account`),value:y,onChange:b,options:x,isDisabled:T||c===`loading`,tone:`muted`,className:`w-auto max-w-[8.5rem] min-w-0`}),(0,Y.jsx)(Q,{ariaLabel:E(`model`),value:S,onChange:te,placeholder:E(w?`requesting`:`model`),options:C,isDisabled:T||c===`loading`||w||!C.length,className:`w-auto max-w-[10.5rem] min-w-0`})]}),(0,Y.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:E(`prompt`)}),(0,Y.jsx)(`span`,{className:`mono text-caption text-muted`,children:r.length})]}),(0,Y.jsx)(s,{fullWidth:!0,rows:9,className:`min-h-52 resize-y rounded-xl border-0 bg-[var(--field-background)] px-3.5 py-3 text-body leading-[1.65] shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--field-border)_78%,var(--foreground))] focus-visible:ring-0`,value:r,onChange:e=>i(e.target.value),placeholder:E(`promptPlaceholder`),"aria-label":E(`prompt`),disabled:T||c===`loading`}),(0,Y.jsx)(`p`,{className:`text-caption leading-5 text-muted/70`,children:E(`promptHelper`)})]}),(0,Y.jsxs)(h,{fullWidth:!0,isPending:c===`loading`,isDisabled:!v||T,onPress:o,children:[(0,Y.jsx)(G,{size:15}),E(c===`loading`?`requesting`:`sendRequest`)]})]})]}),(0,Y.jsxs)(`div`,{className:`access-raw-panel__inspector flex min-h-[440px] min-w-0 flex-col`,"aria-live":`polite`,"aria-busy":c===`loading`,children:[(0,Y.jsxs)(`div`,{className:`flex min-h-12 items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-body font-semibold`,children:E(`responseInspector`)}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:E(`responseInspectorHint`)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l===null?null:(0,Y.jsxs)(`span`,{className:`mono flex items-center gap-1.5 text-caption text-muted`,children:[(0,Y.jsx)(Ee,{size:12}),l,` ms`]}),(0,Y.jsx)(se,{size:`sm`,variant:`soft`,color:c===`success`?`success`:c===`error`?`danger`:void 0,children:d})]})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 px-4 pb-4 sm:px-5 sm:pb-5`,children:c===`idle`?(0,Y.jsx)(_,{className:`min-h-64`,title:E(`responseEmptyTitle`),hint:E(`responseEmptyHint`)}):c===`loading`?(0,Y.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,Y.jsx)(O,{className:`h-3 w-32 rounded-lg`}),(0,Y.jsx)(O,{className:`h-3 w-full rounded-lg`}),(0,Y.jsx)(O,{className:`h-3 w-[88%] rounded-lg`}),(0,Y.jsx)(O,{className:`h-3 w-[72%] rounded-lg`}),(0,Y.jsx)(O,{className:`mt-7 h-3 w-[92%] rounded-lg`}),(0,Y.jsx)(O,{className:`h-3 w-[64%] rounded-lg`})]}):c===`error`?(0,Y.jsx)(`div`,{className:`space-y-3`,children:(0,Y.jsx)(ee,{status:`danger`,title:E(`requestFailed`),description:u})}):(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-caption font-medium text-success`,children:[(0,Y.jsx)(ae,{size:14,weight:`fill`}),E(`responseReceived`)]}),(0,Y.jsx)(`pre`,{className:`mono overflow-x-auto whitespace-pre-wrap break-words text-caption leading-6 text-muted`,children:u})]})})]})]})}),(0,Y.jsxs)(`section`,{className:`access-raw-panel overflow-hidden rounded-2xl`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 sm:px-5`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`text-body font-semibold`,children:E(`curlExample`)}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-caption text-muted`,children:E(`curlGeneratedHint`)})]}),(0,Y.jsxs)(h,{size:`sm`,variant:`ghost`,onPress:g,children:[(0,Y.jsx)(a,{copied:m}),E(m?`copied`:`copy`)]})]}),(0,Y.jsx)(`pre`,{className:`mono max-h-72 overflow-auto whitespace-pre-wrap px-4 pb-4 text-caption leading-6 text-muted sm:px-5 sm:pb-5`,children:f})]})]})}function Xe(e,t){let n=t.filter(e=>e.kind===`text`),r=t.filter(e=>e.kind===`image`&&e.dataUrl),i=e.trim();for(let e of n){let t=e.text??``;i=`${i}${i?` `:``}--- file: ${e.name} ---\n${t}`}if(!r.length)return i;let a=[];i&&a.push({type:`text`,text:i});for(let e of r)a.push({type:`image_url`,image_url:{url:e.dataUrl}});return a}function Ze(e,t){let n=[];for(let t of e)if(!(t.status===`error`&&t.role===`assistant`&&!t.content)){if(t.role===`user`){n.push({role:`user`,content:Xe(t.content,t.attachments||[])});continue}t.content&&n.push({role:`assistant`,content:t.content})}return[...n,t]}var Qe=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNkYPhfz0AEYBxVSF+FABJADveWkH6aAAAAAElFTkSuQmCC`;function $e(){return[{id:`demo-user-1`,role:`user`,content:`Summarize the attached screenshot and look up the endpoint.`,attachments:[{id:`demo-img-1`,name:`screenshot.png`,mime:`image/png`,kind:`image`,dataUrl:Qe,size:2048},{id:`demo-txt-1`,name:`notes.md`,mime:`text/markdown`,kind:`text`,text:`# notes placeholder`,size:128}],status:`done`},{id:`demo-assistant-1`,role:`assistant`,provider:`workbuddy`,content:`The screenshot shows the Access playground. I looked up the chat completions route and drafted a short summary below.`,reasoning:`User attached a UI screenshot and a notes file. diff --git a/internal/webui/static/assets/AccountsPage-DAwU5tJE.js b/internal/webui/static/assets/AccountsPage-P5RZ6rmI.js similarity index 98% rename from internal/webui/static/assets/AccountsPage-DAwU5tJE.js rename to internal/webui/static/assets/AccountsPage-P5RZ6rmI.js index a938b2322..258160902 100644 --- a/internal/webui/static/assets/AccountsPage-DAwU5tJE.js +++ b/internal/webui/static/assets/AccountsPage-P5RZ6rmI.js @@ -1,4 +1,4 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./CaiaiSoftLink-CsNrM_a1.js";import{t as u}from"./CaretRight.es-CeI6iKxy.js";import{n as d,t as f}from"./clipboard-CWhuA-N0.js";import{i as p,n as m,r as ee,t as h}from"./SearchBar-C0n-Lr5s.js";import{t as te}from"./Plus.es-BPfWzgUg.js";import{t as ne}from"./ShieldCheck.es-CF5xuEi8.js";import{t as g}from"./TrashSimple.es-CiBYahWn.js";import{H as _,I as v,Z as y,n as re,nt as b,pt as x,r as S}from"./useI18n-XrvNxGvP.js";import{B as C,F as ie,J as w,M as ae,N as oe,c as T,j as se,q as ce,s as le,z as E}from"./SharedElementTransition-BlCsXfb1.js";import{f as ue,t as de}from"./label-B8hTan2F.js";import{n as fe,t as pe}from"./PageAlert-BbN7e2aZ.js";import{t as me}from"./ConfirmDialog-DCaOykOx.js";import{n as he}from"./useToggle-55_Qx9vA.js";import{t as ge}from"./description-Du44nrYx.js";import{t as _e}from"./EmptyPanel-Bs-jQMvG.js";import{t as D}from"./input-CYN6ajmO.js";import{t as ve}from"./list-box-BtjELxmv.js";import{t as O}from"./modal-CQ6c3Rhf.js";import{n as ye,t as k}from"./number-field-BUGr_bpm.js";import{t as be}from"./select-DSzMi7kM.js";import{t as A}from"./CompactSwitch-Dd3U4EbK.js";import{d as j,f as M}from"./format-FfdyoNtB.js";import{o as N}from"./Input-CyXcxaPW.js";import{C as P,E as xe,F as Se,S as Ce,T as we,_ as Te,a as F,b as Ee,c as De,d as Oe,f as ke,i as Ae,j as I,k as je,l as Me,m as Ne,o as Pe,p as Fe,r as Ie,s as Le,u as L,v as Re,x as ze,y as Be}from"./overview-ARhe2pSk.js";import{t as Ve}from"./textfield-DAL_YlVh.js";import{t as R}from"./form-qle3Iim5.js";import{t as z}from"./gsap-DWxn8li7.js";import{Gt as He,Ht as B,J as Ue,K as We,Lt as Ge,N as V,Ot as Ke,S as qe,T as H,Vt as Je,X as U,Y as Ye,_ as Xe,a as Ze,bt as W,j as Qe,k as G,kt as $e,m as et,q as tt,t as K,v as nt,y as rt}from"./index-CAlyInAP.js";import{t as it}from"./FilterToggle-BoD7X2r2.js";import{t as at}from"./ProviderMark-C49bIWJW.js";import{n as ot,t as st}from"./provider-BZvt2HHB.js";import{a as ct,c as lt,d as ut,f as dt,h as ft,i as pt,l as mt,m as ht,n as gt,o as _t,p as vt,r as yt,s as bt,t as xt,u as q}from"./account-DCxVMo7p.js";import{t as J}from"./FormRow-CL_rVm7f.js";var Y=t(e(),1),St=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,28H188V24a12,12,0,0,0-24,0v4H92V24a12,12,0,0,0-24,0v4H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28ZM68,52a12,12,0,0,0,24,0h72a12,12,0,0,0,24,0h16V76H52V52ZM52,204V100H204V204Zm120.49-84.49a12,12,0,0,1,0,17l-48,48a12,12,0,0,1-17,0l-24-24a12,12,0,0,1,17-17L116,159l39.51-39.52A12,12,0,0,1,172.49,119.51Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V88H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Zm-38.34-85.66a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L116,164.69l42.34-42.35A8,8,0,0,1,169.66,122.34Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM169.66,133.66l-48,48a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L116,164.69l42.34-42.35a8,8,0,0,1,11.32,11.32ZM48,80V48H72v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,34H182V24a6,6,0,0,0-12,0V34H86V24a6,6,0,0,0-12,0V34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H74V56a6,6,0,0,0,12,0V46h84V56a6,6,0,0,0,12,0V46h26a2,2,0,0,1,2,2V82H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V94H210V208A2,2,0,0,1,208,210Zm-39.76-86.24a6,6,0,0,1,0,8.48l-48,48a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L116,167.51l43.76-43.75A6,6,0,0,1,168.24,123.76Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Zm-38.34-85.66a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L116,164.69l42.34-42.35A8,8,0,0,1,169.66,122.34Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,36H180V24a4,4,0,0,0-8,0V36H84V24a4,4,0,0,0-8,0V36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H76V56a4,4,0,0,0,8,0V44h88V56a4,4,0,0,0,8,0V44h28a4,4,0,0,1,4,4V84H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V92H212V208A4,4,0,0,1,208,212Zm-41.17-86.83a4,4,0,0,1,0,5.66l-48,48a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L116,170.34l45.17-45.17A4,4,0,0,1,166.83,125.17Z`}))]]),Ct=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),X=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,160H48l80-80Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z`}))]]),wt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M176,32V224a16,16,0,0,1-16,16H96a16,16,0,0,1-16-16V32A16,16,0,0,1,96,16h64A16,16,0,0,1,176,32Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM128,72a12,12,0,1,0-12-12A12,12,0,0,0,128,72Zm0,112a12,12,0,1,0,12,12A12,12,0,0,0,128,184Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M160,16H96A16,16,0,0,0,80,32V224a16,16,0,0,0,16,16h64a16,16,0,0,0,16-16V32A16,16,0,0,0,160,16ZM128,208a12,12,0,1,1,12-12A12,12,0,0,1,128,208Zm0-68a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm0-68a12,12,0,1,1,12-12A12,12,0,0,1,128,72Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M118,60a10,10,0,1,1,10,10A10,10,0,0,1,118,60Zm10,58a10,10,0,1,0,10,10A10,10,0,0,0,128,118Zm0,68a10,10,0,1,0,10,10A10,10,0,0,0,128,186Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM128,72a12,12,0,1,0-12-12A12,12,0,0,0,128,72Zm0,112a12,12,0,1,0,12,12A12,12,0,0,0,128,184Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M120,60a8,8,0,1,1,8,8A8,8,0,0,1,120,60Zm8,60a8,8,0,1,0,8,8A8,8,0,0,0,128,120Zm0,68a8,8,0,1,0,8,8A8,8,0,0,0,128,188Z`}))]]),Tt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M228,144v64a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V144a12,12,0,0,1,24,0v52H204V144a12,12,0,0,1,24,0Zm-108.49,8.49a12,12,0,0,0,17,0l40-40a12,12,0,0,0-17-17L140,115V32a12,12,0,0,0-24,0v83L96.49,95.51a12,12,0,0,0-17,17Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V208H40V48A16,16,0,0,1,56,32H200A16,16,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40A8,8,0,0,0,168,96H136V32a8,8,0,0,0-16,0V96H88a8,8,0,0,0-5.66,13.66Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M222,144v64a6,6,0,0,1-6,6H40a6,6,0,0,1-6-6V144a6,6,0,0,1,12,0v58H210V144a6,6,0,0,1,12,0Zm-98.24,4.24a6,6,0,0,0,8.48,0l40-40a6,6,0,0,0-8.48-8.48L134,129.51V32a6,6,0,0,0-12,0v97.51L92.24,99.76a6,6,0,0,0-8.48,8.48Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M220,144v64a4,4,0,0,1-4,4H40a4,4,0,0,1-4-4V144a4,4,0,0,1,8,0v60H212V144a4,4,0,0,1,8,0Zm-94.83,2.83a4,4,0,0,0,5.66,0l40-40a4,4,0,1,0-5.66-5.66L132,134.34V32a4,4,0,0,0-8,0V134.34L90.83,101.17a4,4,0,0,0-5.66,5.66Z`}))]]),Et=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M180.49,143.51a12,12,0,0,1,0,17l-24,24a12,12,0,0,1-17-17L155,152l-15.52-15.51a12,12,0,1,1,17-17Zm-64-24a12,12,0,0,0-17,0l-24,24a12,12,0,0,0,0,17l24,24a12,12,0,0,0,17-17L101,152l15.52-15.51A12,12,0,0,0,116.49,119.51ZM220,88V216a20,20,0,0,1-20,20H56a20,20,0,0,1-20-20V40A20,20,0,0,1,56,20h96a12,12,0,0,1,8.49,3.52l56,56A12,12,0,0,1,220,88ZM160,57V80h23Zm36,155V104H148a12,12,0,0,1-12-12V44H60V212Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,88H152V32Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M181.66,146.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32Zm-72-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L91.31,152l18.35-18.34A8,8,0,0,0,109.66,122.34ZM216,88V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm40,136V96H152a8,8,0,0,1-8-8V40H56V216H200Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34Zm-104,88a8,8,0,0,1-11.32,11.32l-24-24a8,8,0,0,1,0-11.32l24-24a8,8,0,0,1,11.32,11.32L91.31,152Zm72-12.68-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32l24,24A8,8,0,0,1,181.66,157.66ZM152,88V44l44,44Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M180.24,147.76a6,6,0,0,1,0,8.48l-24,24a6,6,0,0,1-8.48-8.48L167.51,152l-19.75-19.76a6,6,0,1,1,8.48-8.48Zm-72-24a6,6,0,0,0-8.48,0l-24,24a6,6,0,0,0,0,8.48l24,24a6,6,0,1,0,8.48-8.48L88.49,152l19.75-19.76A6,6,0,0,0,108.24,123.76ZM214,88V216a14,14,0,0,1-14,14H56a14,14,0,0,1-14-14V40A14,14,0,0,1,56,26h96a6,6,0,0,1,4.25,1.76l56,56A6,6,0,0,1,214,88Zm-56-6h35.52L158,46.48Zm44,134V94H152a6,6,0,0,1-6-6V38H56a2,2,0,0,0-2,2V216a2,2,0,0,0,2,2H200A2,2,0,0,0,202,216Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M181.66,146.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32Zm-72-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L91.31,152l18.35-18.34A8,8,0,0,0,109.66,122.34ZM216,88V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm40,136V96H152a8,8,0,0,1-8-8V40H56V216H200Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M178.83,149.17a4,4,0,0,1,0,5.66l-24,24a4,4,0,0,1-5.66-5.66L170.34,152l-21.17-21.17a4,4,0,1,1,5.66-5.66Zm-72-24a4,4,0,0,0-5.66,0l-24,24a4,4,0,0,0,0,5.66l24,24a4,4,0,1,0,5.66-5.66L85.66,152l21.17-21.17A4,4,0,0,0,106.83,125.17ZM212,88V216a12,12,0,0,1-12,12H56a12,12,0,0,1-12-12V40A12,12,0,0,1,56,28h96a4,4,0,0,1,2.83,1.17l56,56A4,4,0,0,1,212,88Zm-56-4h42.34L156,41.65Zm48,132V92H152a4,4,0,0,1-4-4V36H56a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H200A4,4,0,0,0,204,216Z`}))]]),Dt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M249.8,85.49l-116-64a12,12,0,0,0-11.6,0l-116,64a12,12,0,0,0,0,21l21.8,12v47.76a19.89,19.89,0,0,0,5.09,13.32C46.63,194.7,77,220,128,220a136.88,136.88,0,0,0,40-5.75V240a12,12,0,0,0,24,0V204.12a119.53,119.53,0,0,0,30.91-24.51A19.89,19.89,0,0,0,228,166.29V118.53l21.8-12a12,12,0,0,0,0-21ZM128,45.71,219.16,96,186,114.3a1.88,1.88,0,0,1-.18-.12l-52-28.69a12,12,0,0,0-11.6,21l39,21.49L128,146.3,36.84,96ZM128,196c-40.42,0-64.65-19.07-76-31.27v-33l70.2,38.74a12,12,0,0,0,11.6,0L168,151.64v37.23A110.46,110.46,0,0,1,128,196Zm76-31.27a93.21,93.21,0,0,1-12,10.81V138.39l12-6.62Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,113.07v53.22a8,8,0,0,1-2,5.31c-11.3,12.59-38.9,36.4-86,36.4s-74.68-23.81-86-36.4a8,8,0,0,1-2-5.31V113.07L128,160Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M251.76,88.94l-120-64a8,8,0,0,0-7.52,0l-120,64a8,8,0,0,0,0,14.12L32,117.87v48.42a15.91,15.91,0,0,0,4.06,10.65C49.16,191.53,78.51,216,128,216a130,130,0,0,0,48-8.76V240a8,8,0,0,0,16,0V199.51a115.63,115.63,0,0,0,27.94-22.57A15.91,15.91,0,0,0,224,166.29V117.87l27.76-14.81a8,8,0,0,0,0-14.12ZM128,200c-43.27,0-68.72-21.14-80-33.71V126.4l76.24,40.66a8,8,0,0,0,7.52,0L176,143.47v46.34C163.4,195.69,147.52,200,128,200Zm80-33.75a97.83,97.83,0,0,1-16,14.25V134.93l16-8.53ZM188,118.94l-.22-.13-56-29.87a8,8,0,0,0-7.52,14.12L171,128l-43,22.93L25,96,128,41.07,231,96Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M176,207.24a119,119,0,0,0,16-7.73V240a8,8,0,0,1-16,0Zm11.76-88.43-56-29.87a8,8,0,0,0-7.52,14.12L171,128l17-9.06Zm64-29.87-120-64a8,8,0,0,0-7.52,0l-120,64a8,8,0,0,0,0,14.12L32,117.87v48.42a15.91,15.91,0,0,0,4.06,10.65C49.16,191.53,78.51,216,128,216a130,130,0,0,0,48-8.76V130.67L171,128l-43,22.93L43.83,106l0,0L25,96,128,41.07,231,96l-18.78,10-.06,0L188,118.94a8,8,0,0,1,4,6.93v73.64a115.63,115.63,0,0,0,27.94-22.57A15.91,15.91,0,0,0,224,166.29V117.87l27.76-14.81a8,8,0,0,0,0-14.12Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M250.82,90.71l-120-64a5.94,5.94,0,0,0-5.64,0l-120,64a6,6,0,0,0,0,10.58L34,116.67v49.62a14,14,0,0,0,3.55,9.32C50.42,189.94,79.29,214,128,214a127.21,127.21,0,0,0,50-9.73V240a6,6,0,0,0,12,0V198.35a113.18,113.18,0,0,0,28.45-22.75,13.91,13.91,0,0,0,3.55-9.31V116.67l28.82-15.38a6,6,0,0,0,0-10.58ZM128,202c-44,0-70-21.56-81.52-34.41a2,2,0,0,1-.48-1.3V123.07l79.18,42.22a6,6,0,0,0,5.64,0L178,140.13v51C165,197.35,148.45,202,128,202Zm82-35.71a2,2,0,0,1-.48,1.3A100.25,100.25,0,0,1,190,184.3V133.73l20-10.66Zm-22.15-45a6.27,6.27,0,0,0-1-.71l-56-29.86a6,6,0,0,0-5.64,10.58L175.25,128,128,153.2,20.75,96,128,38.8,235.25,96Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M251.76,88.94l-120-64a8,8,0,0,0-7.52,0l-120,64a8,8,0,0,0,0,14.12L32,117.87v48.42a15.91,15.91,0,0,0,4.06,10.65C49.16,191.53,78.51,216,128,216a130,130,0,0,0,48-8.76V240a8,8,0,0,0,16,0V199.51a115.63,115.63,0,0,0,27.94-22.57A15.91,15.91,0,0,0,224,166.29V117.87l27.76-14.81a8,8,0,0,0,0-14.12ZM128,200c-43.27,0-68.72-21.14-80-33.71V126.4l76.24,40.66a8,8,0,0,0,7.52,0L176,143.47v46.34C163.4,195.69,147.52,200,128,200Zm80-33.75a97.83,97.83,0,0,1-16,14.25V134.93l16-8.53ZM188,118.94l-.22-.13-56-29.87a8,8,0,0,0-7.52,14.12L171,128l-43,22.93L25,96,128,41.07,231,96Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M249.88,92.47l-120-64a4,4,0,0,0-3.76,0l-120,64a4,4,0,0,0,0,7.06L36,115.47v50.82a11.92,11.92,0,0,0,3,8c12.65,14.09,41,37.73,89,37.73,21,0,38.2-4.52,52-10.79V240a4,4,0,0,0,8,0V197.18a111.64,111.64,0,0,0,29-22.91,11.94,11.94,0,0,0,3-8V115.47l29.88-15.94a4,4,0,0,0,0-7.06ZM128,204c-44.83,0-71.25-22-83-35.08a3.92,3.92,0,0,1-1-2.63V119.73l82.12,43.8a4,4,0,0,0,3.76,0L180,136.8v55.53C166.58,199,149.39,204,128,204Zm84-37.71a4,4,0,0,1-1,2.64,103.32,103.32,0,0,1-23,19v-55.4l24-12.8Zm-24.59-42.51a4,4,0,0,0-1.53-1.44l-56-29.87a4,4,0,0,0-3.76,7.06L179.5,128,128,155.47,16.5,96,128,36.53,239.5,96Z`}))]]),Ot=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),kt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,44a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,44Zm0,168a72,72,0,1,1,72-72A72.08,72.08,0,0,1,128,212ZM164.49,99.51a12,12,0,0,1,0,17l-28,28a12,12,0,0,1-17-17l28-28A12,12,0,0,1,164.49,99.51ZM92,16A12,12,0,0,1,104,4h48a12,12,0,0,1,0,24H104A12,12,0,0,1,92,16Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,136a88,88,0,1,1-88-88A88,88,0,0,1,216,136Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,216ZM173.66,90.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32l40-40A8,8,0,0,1,173.66,90.34ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm45.66,61.66-40,40a8,8,0,0,1-11.32-11.32l40-40a8,8,0,0,1,11.32,11.32ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,42a94,94,0,1,0,94,94A94.11,94.11,0,0,0,128,42Zm0,176a82,82,0,1,1,82-82A82.1,82.1,0,0,1,128,218ZM172.24,91.76a6,6,0,0,1,0,8.48l-40,40a6,6,0,1,1-8.48-8.48l40-40A6,6,0,0,1,172.24,91.76ZM98,16a6,6,0,0,1,6-6h48a6,6,0,0,1,0,12H104A6,6,0,0,1,98,16Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,216ZM173.66,90.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32l40-40A8,8,0,0,1,173.66,90.34ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,44a92,92,0,1,0,92,92A92.1,92.1,0,0,0,128,44Zm0,176a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,220ZM170.83,93.17a4,4,0,0,1,0,5.66l-40,40a4,4,0,1,1-5.66-5.66l40-40A4,4,0,0,1,170.83,93.17ZM100,16a4,4,0,0,1,4-4h48a4,4,0,0,1,0,8H104A4,4,0,0,1,100,16Z`}))]]),At=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M228,144v64a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V144a12,12,0,0,1,24,0v52H204V144a12,12,0,0,1,24,0ZM96.49,80.49,116,61v83a12,12,0,0,0,24,0V61l19.51,19.52a12,12,0,1,0,17-17l-40-40a12,12,0,0,0-17,0l-40,40a12,12,0,1,0,17,17Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V208H40V48A16,16,0,0,1,56,32H200A16,16,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM88,80h32v64a8,8,0,0,0,16,0V80h32a8,8,0,0,0,5.66-13.66l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,88,80Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M222,144v64a6,6,0,0,1-6,6H40a6,6,0,0,1-6-6V144a6,6,0,0,1,12,0v58H210V144a6,6,0,0,1,12,0ZM92.24,76.24,122,46.49V144a6,6,0,0,0,12,0V46.49l29.76,29.75a6,6,0,0,0,8.48-8.48l-40-40a6,6,0,0,0-8.48,0l-40,40a6,6,0,0,0,8.48,8.48Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M220,144v64a4,4,0,0,1-4,4H40a4,4,0,0,1-4-4V144a4,4,0,0,1,8,0v60H212V144a4,4,0,0,1,8,0ZM90.83,74.83,124,41.66V144a4,4,0,0,0,8,0V41.66l33.17,33.17a4,4,0,1,0,5.66-5.66l-40-40a4,4,0,0,0-5.66,0l-40,40a4,4,0,0,0,5.66,5.66Z`}))]]),jt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M168.49,104.49,145,128l23.52,23.51a12,12,0,0,1-17,17L128,145l-23.51,23.52a12,12,0,0,1-17-17L111,128,87.51,104.49a12,12,0,0,1,17-17L128,111l23.51-23.52a12,12,0,0,1,17,17ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,130.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M164.24,100.24,136.48,128l27.76,27.76a6,6,0,1,1-8.48,8.48L128,136.48l-27.76,27.76a6,6,0,0,1-8.48-8.48L119.52,128,91.76,100.24a6,6,0,0,1,8.48-8.48L128,119.52l27.76-27.76a6,6,0,0,1,8.48,8.48ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M162.83,98.83,133.66,128l29.17,29.17a4,4,0,0,1-5.66,5.66L128,133.66,98.83,162.83a4,4,0,0,1-5.66-5.66L122.34,128,93.17,98.83a4,4,0,0,1,5.66-5.66L128,122.34l29.17-29.17a4,4,0,1,1,5.66,5.66ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),Mt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:St}));Mt.displayName=`CalendarCheckIcon`;var Nt=Mt,Pt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:Ct}));Pt.displayName=`CaretDownIcon`;var Ft=Pt,It=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:X}));It.displayName=`CaretUpIcon`;var Lt=It,Rt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:wt}));Rt.displayName=`DotsThreeVerticalIcon`;var zt=Rt,Bt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:Tt}));Bt.displayName=`DownloadSimpleIcon`;var Vt=Bt,Ht=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:Et}));Ht.displayName=`FileCodeIcon`;var Ut=Ht,Wt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:Dt}));Wt.displayName=`GraduationCapIcon`;var Gt=Wt,Kt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:Ot}));Kt.displayName=`PencilSimpleIcon`;var qt=Kt,Jt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:kt}));Jt.displayName=`TimerIcon`;var Yt=Jt,Xt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:At}));Xt.displayName=`UploadSimpleIcon`;var Zt=Xt,Qt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:jt}));Qt.displayName=`XCircleIcon`;var $t=Qt,en=E({slots:{menu:`dropdown__menu`,popover:`dropdown__popover`,root:`dropdown`,trigger:`dropdown__trigger`}}),tn=E({defaultVariants:{color:`accent`,size:`md`},slots:{base:`meter`,fill:`meter__fill`,output:`meter__output`,track:`meter__track`},variants:{color:{accent:{base:`meter--accent`},danger:{base:`meter--danger`},default:{base:`meter--default`},success:{base:`meter--success`},warning:{base:`meter--warning`}},size:{lg:{base:`meter--lg`},md:{base:`meter--md`},sm:{base:`meter--sm`}}}}),nn=E({defaultVariants:{variant:`default`},slots:{indicator:`menu-item__indicator`,item:`menu-item`,submenuIndicator:`menu-item__indicator menu-item__indicator--submenu`},variants:{variant:{danger:{item:`menu-item--danger`},default:{item:`menu-item--default`}}}}),rn=E({base:`menu-section`});function an(e){let{value:t=0,minValue:n=0,maxValue:r=100,valueLabel:i,isIndeterminate:a,formatOptions:o={style:`percent`}}=e,s=ce(e,{labelable:!0}),{labelProps:c,fieldProps:l}=N({...e,labelElementType:`span`});t=b(t,n,r);let u=r-n,d=u===0?0:(t-n)/u,f=ye(o);if(!a&&!i){let e=o.style===`percent`?d:t;i=f.format(e)}return{progressBarProps:w(s,{...l,"aria-valuenow":a?void 0:t,"aria-valuemin":n,"aria-valuemax":r,"aria-valuetext":a?void 0:i,role:`progressbar`}),labelProps:c}}function on(e){let{progressBarProps:t,labelProps:n}=an(e);return{meterProps:{...t,role:`meter progressbar`},labelProps:n}}var sn=(0,Y.createContext)(null),cn=(0,Y.forwardRef)(function(e,t){[e,t]=se(e,t,sn);let{value:n=0,minValue:r=0,maxValue:i=100}=e;n=b(n,r,i);let a=i-r,[o,s]=oe(!e[`aria-label`]&&!e[`aria-labelledby`]),{meterProps:c,labelProps:l}=on({...e,label:s}),u=a===0?0:(n-r)/a*100,d=ae({...e,defaultClassName:`react-aria-Meter`,values:{percentage:u,valueText:c[`aria-valuetext`]}}),f=ce(e,{global:!0});return Y.createElement(ie.div,{...w(f,d,c),ref:t,slot:e.slot||void 0},Y.createElement(ue.Provider,{value:{...l,ref:o,elementType:`span`}},d.children))}),Z=n(),ln=(0,Y.createContext)({}),un=({children:e,className:t,variant:n,...r})=>{let i=Y.useMemo(()=>nn({variant:n}),[n]);return(0,Z.jsx)(tt,{className:T(t,i.item()),"data-slot":`menu-item`,...r,children:t=>(0,Z.jsx)(ln,{value:{slots:i,state:t},children:typeof e==`function`?e(t):e})})},dn=({children:e,className:t,type:n=`checkmark`,...r})=>{let{slots:i,state:a}=(0,Y.use)(ln),o=a?.isSelected,s=typeof e==`function`?e(a??{}):e||(n===`dot`?(0,Z.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`menu-item-indicator--dot`,fill:`currentColor`,fillRule:`evenodd`,role:`presentation`,viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,children:(0,Z.jsx)(`path`,{clipRule:`evenodd`,d:`M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14`,fillRule:`evenodd`})}):(0,Z.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`menu-item-indicator--checkmark`,fill:`none`,role:`presentation`,stroke:`currentColor`,strokeDasharray:22,strokeDashoffset:o?44:66,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 17 18`,children:(0,Z.jsx)(`polyline`,{points:`1 9 7 14 15 4`})}));return(0,Z.jsx)(C.span,{"aria-hidden":`true`,className:le(i?.indicator,t),"data-slot":`menu-item-indicator`,"data-type":n,"data-visible":o||void 0,...r,children:s})},fn=({children:e,className:t,...n})=>{let{slots:r,state:i}=(0,Y.use)(ln);if(!i?.hasSubmenu)return null;let a=e??(0,Z.jsx)(_,{});return(0,Z.jsx)(C.span,{"aria-hidden":`true`,className:le(r?.submenuIndicator,t),"data-slot":`submenu-indicator`,...n,children:a})},pn=({children:e,className:t,...n})=>{let r=Y.useMemo(()=>rn({class:typeof t==`string`?t:void 0}),[t]);return(0,Z.jsx)(Ue,{className:r,...n,children:e})},mn=(0,Y.createContext)({}),hn=({children:e,...t})=>{let n=Y.useMemo(()=>en(),[]);return(0,Z.jsx)(mn,{value:{slots:n},children:(0,Z.jsx)(We,{...t,children:e})})},gn=({children:e,className:t,...n})=>{let{slots:r}=(0,Y.use)(mn);return(0,Z.jsx)(y,{className:T(t,r?.trigger()),"data-slot":`dropdown-trigger`,...n,children:t=>(0,Z.jsx)(Z.Fragment,{children:typeof e==`function`?e(t):e})})},_n=({children:e,className:t,placement:n,...r})=>{let{slots:i}=(0,Y.use)(mn);return(0,Z.jsx)(v,{value:{variant:`default`},children:(0,Z.jsx)(W,{...r,className:T(t,i?.popover()),"data-slot":`dropdown-popover`,placement:n,children:e})})};function vn({className:e,...t}){let{slots:n}=(0,Y.use)(mn);return(0,Z.jsx)(Ye,{className:T(e,n?.menu()),"data-selection-mode":t.selectionMode,"data-slot":`dropdown-menu`,...t})}var yn=Object.assign(hn,{Root:hn,Trigger:gn,Popover:_n,Menu:vn,Section:e=>(0,Z.jsx)(pn,{...e}),Item:e=>(0,Z.jsx)(un,{...e}),ItemIndicator:e=>(0,Z.jsx)(dn,{...e}),SubmenuIndicator:e=>(0,Z.jsx)(fn,{...e}),SubmenuTrigger:({children:e,...t})=>(0,Z.jsx)(U,{"data-slot":`dropdown-submenu-trigger`,...t,children:e})}),bn=(0,Y.createContext)({}),xn=({children:e,className:t,color:n,size:r,...i})=>{let a=Y.useMemo(()=>tn({color:n,size:r}),[n,r]);return(0,Z.jsx)(cn,{"data-slot":`meter`,...i,className:T(t,a.base()),children:t=>(0,Z.jsx)(bn,{value:{slots:a,state:t},children:typeof e==`function`?e(t):e})})};xn.displayName=`HeroUI.Meter`;var Sn=({children:e,className:t,...n})=>{let{slots:r,state:i}=(0,Y.use)(bn);return(0,Z.jsx)(C.span,{className:le(r?.output,t),"data-slot":`meter-output`,...n,children:e??i?.valueText})};Sn.displayName=`HeroUI.Meter.Output`;var Cn=({children:e,className:t,...n})=>{let{slots:r}=(0,Y.use)(bn);return(0,Z.jsx)(C.div,{className:le(r?.track,t),"data-slot":`meter-track`,...n,children:e})};Cn.displayName=`HeroUI.Meter.Track`;var wn=({className:e,style:t,...n})=>{let{slots:r,state:i}=(0,Y.use)(bn);return(0,Z.jsx)(C.div,{className:le(r?.fill,e),"data-slot":`meter-fill`,style:{...t,width:`${i?.percentage??0}%`},...n})};wn.displayName=`HeroUI.Meter.Fill`;var Tn=Object.assign(xn,{Root:xn,Output:Sn,Track:Cn,Fill:wn}),En=()=>()=>{},Dn=new Set,On=Date.now(),kn=null;function An(){On=Date.now();for(let e of Dn)e()}function jn(e){return Dn.size===0&&(On=Date.now()),Dn.add(e),kn===null&&(kn=window.setInterval(An,1e3)),()=>{Dn.delete(e),Dn.size===0&&kn!==null&&(window.clearInterval(kn),kn=null)}}function Mn(){return On}function Nn(e=!0){return(0,Y.useSyncExternalStore)(e?jn:En,Mn,Mn)}function Pn(e,t){let n=e??0;return Number.isFinite(n)?`$${n.toFixed(t)}`:`—`}function Fn(e){let t=e?.overage_capability?.trim().toUpperCase()??``;return t===``||t===`OVERAGE_CAPABLE`}function In({quota:e,writable:t,pulling:n,switching:r,t:i,onPull:a,onToggle:o}){let s=e?.overage_status?.trim().toUpperCase()??``,c=Fn(e),l=s===`ENABLED`,u=i(s===`ENABLED`?`overageEnabled`:s===`DISABLED`?`overageDisabled`:`overageUnknown`),d=(e?.overage_cap??0)>0||(e?.overage_rate??0)>0||(e?.overage_current??0)>0,f=n||r;return(0,Z.jsxs)(`section`,{className:`mt-1.5 rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-caption font-medium text-foreground/80`,children:i(`overageTitle`)}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(S,{size:`sm`,variant:`secondary`,isPending:n,isDisabled:r,onPress:a,children:i(`overagePull`)}),(0,Z.jsx)(A,{isSelected:l,isDisabled:!c||!t||f,ariaLabel:i(`overageTitle`),onChange:o})]})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-caption leading-4 text-muted`,children:u}),d?(0,Z.jsx)(`p`,{className:`mono mt-1 text-caption leading-4 text-foreground/70`,children:i(`overageFigures`,{cap:Pn(e?.overage_cap,2),rate:Pn(e?.overage_rate,4),current:Pn(e?.overage_current,4)})}):null,c?t?(0,Z.jsx)(`p`,{className:`mt-1 text-caption leading-4 text-muted`,children:i(`overageHint`)}):(0,Z.jsx)(`p`,{className:`mt-1 text-caption leading-4 text-muted`,children:i(`overageReadOnly`)}):(0,Z.jsx)(`p`,{className:`mt-1 text-caption leading-4 text-danger`,children:i(`overageNotCapable`)})]})}function Ln(e){(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=z.context(()=>{z.matchMedia().add(`(prefers-reduced-motion: no-preference)`,()=>{let e=z.utils.toArray(`.meter__fill`);e.length&&z.from(e,{scaleX:0,transformOrigin:`left center`,duration:nt.calm,ease:rt.emphasized,stagger:qe.base,clearProps:`transform,transformOrigin`})})},t);return()=>n.revert()},[e])}var Rn=4;function zn(e,t,n,r,i,a){return[e.has_add_on&&e.add_on_available!==!1?`${n} ${ct(e.add_on_used)} / ${ct(e.add_on_total)} ${e.add_on_unit||`credits`}`:``,e.has_resource_package&&e.resource_package_available!==!1?`${r} ${t} ${ct(e.resource_package_remaining)} ${e.resource_package_unit||`credits`}`:``,a===`workbuddy`?bt(e,i):``].filter(Boolean)}function Bn(e,t,n){let r=e.total??0;if(!Number.isFinite(r)||r<=0)return``;let i=e.used??0,a=e.remaining??Math.max(0,r-i),o=e.unit||`credits`;return`${n} ${ct(a)} · ${t} ${ct(i)} / ${ct(r)} ${o}`}function Vn({window:e,t,extra:n,amountLine:r,resetAt:i}){let a=Math.round(e.percentage??0),o=dt(e,t),s=t(`quotaUsedPercent`,{n:a}),c=mt(i,t),l=`${o} · ${s}${r?` · ${r}`:``}${c?` · ${c}`:``}`,u=ut(e),d=q(e),f=d===`danger`?`danger`:d===`warn`?`warning`:`success`;return(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{className:`block w-full min-w-0`,children:(0,Z.jsxs)(`div`,{className:`w-full min-w-0 cursor-help`,children:[(0,Z.jsxs)(Tn,{className:`account-meter account-meter--window w-full`,color:f,size:`md`,minValue:0,maxValue:100,value:Math.round(u*100),"aria-label":o,valueLabel:l,children:[(0,Z.jsxs)(Tn.Output,{className:`flex w-full items-baseline justify-between gap-3 text-caption`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:o}),(0,Z.jsx)(`span`,{className:`mono shrink-0 text-foreground/70`,children:s})]}),(0,Z.jsx)(Tn.Track,{children:(0,Z.jsx)(Tn.Fill,{})})]}),r?(0,Z.jsx)(`div`,{className:`mono mt-1 truncate text-caption leading-4 text-foreground/70 tabular-nums`,children:r}):null,c?(0,Z.jsx)(`div`,{className:`mt-1 text-caption leading-4 text-muted`,children:c}):null]})}),(0,Z.jsx)(G.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(`div`,{children:l}),n?.map(e=>(0,Z.jsx)(`div`,{children:e},e))]})})]})}function Hn({quota:e,t,label:n,usedLabel:r,remainingLabel:i,addOnLabel:a,resourcePackageLabel:o,exceededLabel:s,provider:c}){let l=e.unit||`credits`,u=`${ct(e.used)} / ${ct(e.total)}`,d=`${ct(e.remaining)}`,f=zn(e,i,a,o,t,c),p=vt(e),m=c===`codearts`,ee=e.period_end_date||(m?p.find(e=>/^\d{4}-\d{2}-\d{2}$/.test(e.reset_at??``))?.reset_at:void 0),[h,te]=(0,Y.useState)(!1),ne=h?p:p.slice(0,Rn),g=Math.max(0,p.length-Rn),_=c===`codex`||c===`kiro`?yt(e.plan):``,v=ut(e),y=q(e),re=y===`danger`?`danger`:y===`warn`?`warning`:`success`,b=(0,Y.useRef)(null);Ln(b);let x=`${r} ${u} ${l} · ${i} ${d} ${l}${f.length?` · ${f.join(` · `)}`:``}`;return p.length>0?(0,Z.jsxs)(`div`,{ref:b,className:`account-quota-windows flex w-full min-w-0 flex-col gap-3`,children:[m&&(ee||e.expiring_soon_credits!=null)&&(0,Z.jsxs)(`div`,{className:`text-caption text-muted`,children:[ee&&(0,Z.jsx)(`div`,{children:t(`quotaPeriodEndDate`,{date:ee})}),e.expiring_soon_credits!=null&&(0,Z.jsx)(`div`,{className:`tabular-nums`,children:t(`quotaExpiringSoonCredits`,{amount:e.expiring_soon_credits})})]}),_?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-caption`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:t(`quotaPlan`)}),(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:_})]}):null,ne.map((e,n)=>(0,Z.jsx)(`div`,{className:`w-full min-w-0`,children:(0,Z.jsx)(Vn,{window:e,t,resetAt:m?void 0:e.reset_at,extra:n===0?f:void 0,amountLine:c===`kiro`?Bn(e,r,i):void 0})},e.id||String(n))),g>0?(0,Z.jsxs)(S,{size:`sm`,variant:`ghost`,className:`mx-auto -my-1 min-w-0 px-2 text-caption text-muted`,"aria-expanded":h,onPress:()=>te(e=>!e),children:[h?(0,Z.jsx)(Lt,{size:13}):(0,Z.jsx)(Ft,{size:13}),t(h?`quotaWindowsCollapse`:`quotaWindowsExpand`,{count:g})]}):null]}):(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(`div`,{ref:b,className:`w-full cursor-help`,children:(0,Z.jsxs)(Tn,{className:`account-meter w-full`,color:re,size:`md`,minValue:0,maxValue:100,value:Math.round(v*100),"aria-label":n,valueLabel:x,children:[(0,Z.jsxs)(Tn.Output,{className:`flex w-full items-baseline justify-between text-caption`,children:[(0,Z.jsxs)(`span`,{className:`text-body font-semibold leading-5 text-foreground tabular-nums`,children:[e.exceeded?(0,Z.jsx)(`span`,{className:`mr-1.5 text-danger`,children:s}):(0,Z.jsx)(`span`,{className:`mr-1.5 text-caption font-normal text-muted`,children:i}),d,(0,Z.jsx)(`span`,{className:`ml-1 text-caption font-normal text-foreground/60`,children:l})]}),(0,Z.jsxs)(`span`,{className:`mono text-foreground/55`,children:[u,` · `,Math.round(v*100),`%`]})]}),(0,Z.jsx)(Tn.Track,{children:(0,Z.jsx)(Tn.Fill,{})})]})})}),(0,Z.jsx)(G.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsxs)(`div`,{children:[r,` `,u,` `,l]}),(0,Z.jsxs)(`div`,{children:[i,` `,d,` `,l]}),f.map(e=>(0,Z.jsx)(`div`,{children:e},e))]})})]})}function Un({state:e,stateCopy:t,t:n}){let r=(0,Y.useRef)(null),i=ht(e),a=ft(e);return(0,Y.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=z.context(()=>{let e=z.utils.toArray(`[data-runtime-seg]`),t=e.filter((e,t)=>tt>=i),r=z.matchMedia();r.add(`(prefers-reduced-motion: reduce)`,()=>{z.set(t,{scaleY:1,autoAlpha:1}),z.set(n,{scaleY:.32,autoAlpha:.45})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{z.set(e,{transformOrigin:`center bottom`}),z.to(n,{scaleY:.32,autoAlpha:.45,duration:nt.fast,ease:rt.out,overwrite:!0}),z.to(t,{scaleY:1,autoAlpha:1,duration:nt.base,ease:rt.out,stagger:{amount:.08,from:`start`},overwrite:!0})})},e);return()=>t.revert()},[i,e]),(0,Z.jsx)(`div`,{ref:r,className:`flex items-center`,children:(0,Z.jsx)(`div`,{className:`runtime-meter min-w-[80px] flex-1`,"data-quiet":a===`ok`?`true`:void 0,role:`meter`,"aria-label":n(`runtimeState`),"aria-valuemin":0,"aria-valuemax":12,"aria-valuenow":i,"aria-valuetext":t,children:Array.from({length:12},(e,t)=>(0,Z.jsx)(`span`,{"data-runtime-seg":!0,"data-on":t{if(T)return Te.current&&window.clearTimeout(Te.current),Te.current=window.setTimeout(()=>Se(T),3e3),()=>{Te.current&&window.clearTimeout(Te.current)}},[T]);let De=Kn(j,j===`dead`?N:M,u),Oe=j===`hot`||j===`ready`?`success`:j===`cooling`?`warning`:j===`quota_exhausted`||j===`login`||j===`unavailable`||j===`dead`||j===`auth_failed`?`danger`:void 0,ke=e.last_error||e.lastError,Ae=e.last_error_kind||e.kind,I=ot(e.provider,e.region,u),je=String(e.region||``).toLowerCase(),Me=je===`cn`?u(`regionCN`):je===`global`?u(`regionGlobal`):je===`go`?`Go`:je===`zen`?`Zen`:``,Ne=e.remote_uid||e.id,Pe=Ne.length>12?Ne.slice(0,8):Ne,Fe=e.last_checkin_status,Ie=Fe===`success`?`checkinRecordSuccess`:Fe===`already`?`checkinRecordAlready`:Fe===`pending`?`checkinStatusPending`:Fe===`unknown`?`checkinStatusUnknown`:Fe===`skipped`?`checkinRecordSkipped`:Fe===`error`?`checkinRecordFailed`:`lastCheckinNone`,Le=gt(e,C),L=e.checkin_time||e.checkin_auto_time||x,Re=C&&C!==`Local`?C:`Asia/Shanghai`,ze=e.last_checkin_synced_at?Wn(e.last_checkin_synced_at,Re):``;return(0,Y.useLayoutEffect)(()=>{let e=pe.current;if(!e)return;let t=be.current;if(be.current=j,!t||t===j)return;let n=z.context(()=>{let t=z.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{z.set(e,{scale:1,autoAlpha:1})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{z.fromTo(e,{scale:.94,autoAlpha:.65},{scale:1,autoAlpha:1,duration:.2,ease:`power2.out`,overwrite:!0})})},e);return()=>n.revert()},[j]),(0,Y.useLayoutEffect)(()=>{let e=me.current;if(!e||!n)return;let t=z.context(()=>{let t=z.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{z.set(e,{autoAlpha:1,y:0})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{z.fromTo(e,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:.2,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[n]),(0,Z.jsxs)(he,{"data-gsap-reveal":!0,"data-state":j,className:`account-card overflow-hidden p-0`,children:[(0,Z.jsxs)(he.Header,{className:`flex-row items-start justify-between gap-2.5 px-4 pt-3.5 pb-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Z.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-tertiary`,title:I,children:(0,Z.jsx)(at,{provider:e.provider,size:20})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(he.Title,{className:`truncate text-body leading-5`,children:e.name||e.id}),Me?(0,Z.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-secondary px-1.5 py-px text-caption text-muted`,title:I,children:Me}):null]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Z.jsx)(he.Description,{className:`mono truncate text-caption leading-4 text-foreground/60`,title:`${e.id}${e.remote_uid?` · UID ${e.remote_uid}`:``}`,children:Pe}),(0,Z.jsx)(S,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-5 min-w-0 shrink-0 text-muted`,"aria-label":u(ve?`copied`:`copy`),onPress:()=>{f(Ne).then(e=>{e&&(O(!0),window.setTimeout(()=>O(!1),1100))})},children:(0,Z.jsx)(a,{copied:ve,size:12})})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex max-w-[48%] shrink-0 flex-wrap justify-end gap-1.5`,children:[(0,Z.jsx)(`span`,{ref:pe,children:P.length&&j===`cooling`?(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,Z.jsx)(V,{size:`sm`,variant:`soft`,color:Oe,children:De})})}),(0,Z.jsx)(G.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:u(`partialCooling`)}),P.map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`span`,{className:`mono text-foreground/65`,children:pt(t)})]},e))]})})]}):(0,Z.jsx)(V,{size:`sm`,variant:`soft`,color:Oe,children:De})}),P.length&&j!==`cooling`?(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,Z.jsx)(V,{size:`sm`,variant:`soft`,color:`warning`,children:u(`partialCooling`)})})}),(0,Z.jsx)(G.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:u(`partialCooling`)}),P.map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`span`,{className:`mono text-foreground/65`,children:pt(t)})]},e))]})})]}):null]})]}),(0,Z.jsxs)(he.Content,{className:`gap-1.5 px-4 pb-3`,children:[(0,Z.jsx)(Un,{state:j,stateCopy:De,t:u}),lt(e.quota)&&e.quota?(0,Z.jsx)(Hn,{quota:e.quota,t:u,label:u(`quota`),usedLabel:u(`quotaUsed`),remainingLabel:u(`quotaRemaining`),addOnLabel:u(`quotaAddOn`),resourcePackageLabel:u(`quotaResourcePackage`),exceededLabel:u(`quotaExceeded`),provider:e.provider}):(0,Z.jsx)(`span`,{className:`text-caption text-foreground/65`,children:Gn(j,e.provider||``,je,u)}),e.provider===`kiro`&&E&&ue?(0,Z.jsx)(In,{quota:e.quota,writable:fe,pulling:t===`overage-pull`,switching:t===`overage-switch`,t:u,onPull:E,onToggle:ue}):null,ke?(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsxs)(`div`,{className:`flex w-full cursor-help gap-2 rounded-lg bg-surface-secondary p-2 text-left text-caption leading-5 text-foreground`,children:[(0,Z.jsx)($e,{size:14,className:`mt-0.5 shrink-0 text-danger`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Ae?(0,Z.jsx)(`div`,{className:`mono mb-0.5 truncate text-caption opacity-75`,children:Ae}):null,(0,Z.jsx)(`p`,{className:`break-words line-clamp-3`,children:ke})]})]})}),(0,Z.jsx)(G.Content,{children:(0,Z.jsxs)(`div`,{className:`max-w-md whitespace-pre-wrap break-words`,children:[Ae?(0,Z.jsx)(`div`,{className:`mono mb-1 text-caption opacity-75`,children:Ae}):null,ke]})})]}):null,F?(0,Z.jsxs)(`div`,{className:`flex w-full items-start gap-2 rounded-lg bg-surface-secondary p-2 text-caption leading-5`,children:[F.kind===`success`?(0,Z.jsx)(B,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-success`}):F.kind===`error`?(0,Z.jsx)($t,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-danger`}):(0,Z.jsx)($e,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[F.kind===`success`?(0,Z.jsx)(`span`,{className:`font-medium text-success`,children:u(`checkinRecordSuccess`)}):F.kind===`already`?(0,Z.jsx)(`span`,{className:`font-medium text-warning`,children:u(`checkinRecordAlready`)}):F.kind===`skipped`?(0,Z.jsx)(`span`,{className:`font-medium text-warning`,children:u(`checkinRecordSkipped`)}):(0,Z.jsx)(`span`,{className:`font-medium text-danger`,children:u(`checkinRecordFailed`)}),F.message?(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[(0,Z.jsx)(`p`,{className:`break-words line-clamp-2 text-foreground/80`,children:F.message}),(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-caption text-muted`,children:u(`checkinTruncated`)}),(0,Z.jsxs)(S,{size:`sm`,variant:`ghost`,className:`h-6 min-w-0 gap-1 px-1.5 text-caption`,onPress:()=>{f(F.message||``).then(e=>{!e||!F||(we(F),window.setTimeout(()=>we(null),1100))})},children:[(0,Z.jsx)(a,{copied:Ee,size:13}),u(Ee?`copied`:`checkinCopyError`)]})]})]}):null]})]}):null]}),n&&e.enabled?(0,Z.jsx)(`section`,{ref:me,className:`grid gap-3 bg-surface-secondary/55 px-3 py-3`,children:e.provider===`doubaowork`?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:u(`doubaoCookieLabel`)}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-caption leading-5 text-muted`,children:u(`doubaoCookieLead`)}),(0,Z.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsxs)(Ve,{className:`flex-1`,type:`password`,value:l,onChange:p,children:[(0,Z.jsx)(de,{className:`sr-only`,children:u(`doubaoCookieLabel`)}),(0,Z.jsx)(D,{placeholder:u(`doubaoCookiePh`),"aria-label":u(`doubaoCookieLabel`)})]}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:t===`pat`,onPress:ee,children:[(0,Z.jsx)(Ge,{size:14}),u(`doubaoSaveCookie`)]})]}),o?(0,Z.jsx)(`p`,{className:`mt-1 text-caption text-muted`,children:o}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:u(`oauthDeviceFlow`)}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-caption leading-5 text-muted`,children:e.provider===`codex`?u(`wizardCodexBrowserLead`):u(`qoderLoginHint`)}),(0,Z.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:e.provider===`codex`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(S,{size:`sm`,isPending:t===`device`,onPress:()=>m(`cli`),children:[(0,Z.jsx)(ne,{size:14}),u(`startCodexCliLogin`)]}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`chatgpt`),children:[(0,Z.jsx)(ne,{size:14}),u(`startCodexChatGPTLogin`)]})]}):e.provider===`kiro`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(S,{size:`sm`,isPending:t===`device`,onPress:()=>m(`builder_id`),children:[(0,Z.jsx)(ne,{size:14}),u(`kiroLoginBuilder`)]}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`idc`),children:[(0,Z.jsx)(ne,{size:14}),u(`kiroLoginIDC`)]}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`microsoft`),children:[(0,Z.jsx)(ne,{size:14}),u(`kiroLoginMicrosoft`)]}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`sso`),children:[(0,Z.jsx)(ne,{size:14}),u(`kiroLoginSSO`)]})]}):(0,Z.jsxs)(S,{size:`sm`,isPending:t===`device`,onPress:()=>m(),children:[(0,Z.jsx)(ne,{size:14}),u(`startBrowserLogin`)]})}),(e.provider===`trae`||e.provider===`codex`||e.provider===`devin`||e.provider===`kiro`)&&_&&te?(0,Z.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:u(`wizardCallbackLead`)}),(0,Z.jsx)(s,{className:`h-24 w-full resize-none font-mono text-caption leading-5`,value:h||``,onChange:e=>te(e.target.value),placeholder:u(`wizardCallbackPh`),"aria-label":u(`wizardCallbackPh`)}),(0,Z.jsx)(S,{size:`sm`,variant:`secondary`,isPending:t===`callback`,onPress:_,children:u(`wizardSubmitCallback`)})]}):null]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:u(`patFallback`)}),(0,Z.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsxs)(Ve,{className:`flex-1`,type:`password`,value:l,onChange:p,children:[(0,Z.jsx)(de,{className:`sr-only`,children:u(`pat`)}),(0,Z.jsx)(D,{placeholder:u(`pasteToken`),"aria-label":u(`pat`)})]}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:t===`pat`,onPress:ee,children:[(0,Z.jsx)(Ge,{size:14}),u(`usePat`)]})]})]}),r||o?(0,Z.jsxs)(`div`,{className:`text-caption`,children:[r?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:u(`authUrl`)}),(0,Z.jsx)(`code`,{className:`mono block break-all text-foreground`,children:r}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,onPress:()=>window.open(r,`_blank`,`noopener,noreferrer`),children:[(0,Z.jsx)(c,{size:14}),u(`openAuthUrl`)]}),(0,Z.jsxs)(S,{size:`sm`,variant:`ghost`,onPress:()=>{f(r).then(e=>{e&&(_e(!0),window.setTimeout(()=>_e(!1),1100))})},children:[(0,Z.jsx)(a,{copied:ge}),u(ge?`copied`:`copy`)]})]})]}):null,o?(0,Z.jsx)(`p`,{className:`mt-1 text-muted`,children:o}):null]}):null]})}):null,w?(0,Z.jsxs)(`div`,{className:`mt-auto flex items-center justify-between gap-2 px-4 pb-2.5 text-caption text-muted`,children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 cursor-help flex-wrap items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-foreground/75`,children:u(`checkinStatus`)}),(0,Z.jsx)(`span`,{className:Fe===`error`?`text-danger`:``,children:u(Ie)}),!Le&&Fe===`pending`?(0,Z.jsx)(`span`,{className:`whitespace-nowrap rounded-full bg-warning/15 px-1.5 py-px font-medium text-warning`,children:u(`checkinPending`)}):null]})}),(0,Z.jsxs)(G.Content,{children:[e.last_checkin_at?u(`checkinServerTime`,{time:Wn(e.last_checkin_at,Re)}):u(`lastCheckinNone`),e.last_checkin_msg?` · ${e.last_checkin_msg}`:``,ze?` · ${u(`checkinUpstreamSynced`,{time:ze})}`:``]})]}),(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsxs)(`span`,{className:`flex shrink-0 cursor-help items-center gap-1.5 whitespace-nowrap`,children:[(0,Z.jsx)(`span`,{children:u(`checkinDaily`)}),(0,Z.jsx)(`span`,{className:`mono text-caption text-foreground/55`,children:L}),(0,Z.jsx)(A,{isSelected:!!e.auto_checkin,isDisabled:!!t,ariaLabel:u(`autoCheckin`),onChange:e=>ie?.(e)})]})}),(0,Z.jsxs)(G.Content,{children:[u(`checkinAutoScheduleHint`,{time:L??``}),` · ${u(`checkinServerClock`,{timezone:Re})}`]})]})]}):null,(0,Z.jsxs)(he.Footer,{className:`flex flex-nowrap items-center gap-1 bg-surface-secondary px-2 py-2${w?``:` mt-auto`}`,children:[y?(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(S,{isIconOnly:!0,size:`sm`,variant:`ghost`,isPending:t===`refresh`,onPress:y,"aria-label":u(`refreshAccount`),children:(0,Z.jsx)(He,{size:15})})}),(0,Z.jsx)(G.Content,{children:u(`refreshAccount`)})]}):null,(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(S,{isIconOnly:!0,size:`sm`,variant:n?`secondary`:`ghost`,isDisabled:!e.enabled,onPress:ce,"aria-label":u(`authentication`),children:(0,Z.jsx)(Ge,{size:15})})}),(0,Z.jsx)(G.Content,{children:u(`authentication`)})]}),(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(S,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:se,"aria-label":u(`editAccount`),children:(0,Z.jsx)(qt,{size:15})})}),(0,Z.jsx)(G.Content,{children:u(`editAccount`)})]}),ae?(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(S,{isIconOnly:!0,size:`sm`,variant:`ghost`,isPending:t===`student-credit`,isDisabled:!e.enabled,onPress:ae,"aria-label":u(`claimStudentCredit`),children:(0,Z.jsx)(Gt,{size:15})})}),(0,Z.jsx)(G.Content,{children:u(`claimStudentCredit`)})]}):null,(0,Z.jsxs)(yn,{children:[(0,Z.jsx)(yn.Trigger,{children:(0,Z.jsxs)(S,{isIconOnly:!0,size:`sm`,variant:ye?`secondary`:`ghost`,isPending:t===`checkin`,"aria-label":u(`more`),className:`relative`,children:[(0,Z.jsx)(zt,{size:16}),P.length?(0,Z.jsx)(`span`,{className:`absolute top-1 right-1 size-1.5 rounded-full bg-warning`,"aria-hidden":!0}):null]})}),(0,Z.jsx)(yn.Popover,{placement:`bottom start`,children:(0,Z.jsxs)(yn.Menu,{"aria-label":u(`more`),disabledKeys:!e.enabled||t?[`checkin`]:[],onAction:e=>{e===`models`&&le(),e===`cooldowns`&&k(e=>!e),e===`checkin`&&w?.(),e===`checkin-records`&&oe?.(),e===`export`&&v(),e===`delete`&&re()},children:[(0,Z.jsxs)(yn.Item,{id:`models`,textValue:u(`accountModels`),children:[(0,Z.jsx)(Je,{size:15}),u(`accountModels`)]}),(0,Z.jsxs)(yn.Item,{id:`cooldowns`,textValue:u(`modelCooldowns`),children:[(0,Z.jsx)(Yt,{size:15,className:P.length?`text-warning`:void 0}),u(`modelCooldowns`),P.length?(0,Z.jsx)(`span`,{className:`mono ml-auto text-caption text-warning`,children:P.length}):null]}),w?(0,Z.jsxs)(yn.Item,{id:`checkin`,textValue:u(`checkinNow`),children:[(0,Z.jsx)(Nt,{size:15}),u(`checkinNow`)]}):null,oe?(0,Z.jsxs)(yn.Item,{id:`checkin-records`,textValue:u(`checkinRecords`),children:[(0,Z.jsx)(i,{size:15}),u(`checkinRecords`)]}):null,e.auth_type===`none`?null:(0,Z.jsxs)(yn.Item,{id:`export`,textValue:u(`export`),children:[(0,Z.jsx)(d,{size:15}),u(`export`)]}),(0,Z.jsxs)(yn.Item,{id:`delete`,textValue:u(`delete`),className:`text-danger`,children:[(0,Z.jsx)(g,{size:15}),u(`delete`)]})]})})]}),(0,Z.jsx)(`div`,{className:`ml-auto flex shrink-0 flex-nowrap items-center whitespace-nowrap`,children:(0,Z.jsx)(A,{isSelected:!!e.enabled,isDisabled:t===`toggle`,ariaLabel:e.enabled?u(`disable`):u(`enable`),label:e.enabled?u(`enabledState`):u(`disabled`),onChange:b})})]}),ye?(0,Z.jsxs)(`section`,{className:`border-t border-separator bg-surface-secondary/55 px-4 py-2.5`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:u(`modelCooldownsTitle`)}),(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:P.length})]}),P.length?(0,Z.jsx)(`div`,{className:`space-y-1`,children:P.map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-surface px-2 py-1.5 text-caption`,children:[(0,Z.jsx)(`span`,{className:`mono min-w-0 truncate`,title:e,children:e}),(0,Z.jsx)(`span`,{className:`mono shrink-0 text-warning`,children:pt(t)})]},e))}):(0,Z.jsx)(`p`,{className:`text-caption text-muted`,children:u(`modelCooldownsEmpty`)})]}):null]})}function Jn(e,t){return e.status===`success`?{label:t(`checkinRecordSuccess`),color:`success`}:e.status===`already`?{label:t(`checkinRecordAlready`),color:`warning`}:e.status===`skipped`?{label:t(`checkinRecordSkipped`),color:`default`}:{label:t(`checkinRecordFailed`),color:`danger`}}function Yn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Xn({account:e,t,onClose:n}){let[r,i]=(0,Y.useState)([]),[a,o]=(0,Y.useState)(!!e?.id),[s,c]=(0,Y.useState)(``),l=e?.id||``,u=t(`checkinRecordsTitle`,{name:e?.name||e?.id||``});async function d(){if(l){o(!0),c(``);try{let e=await ke(l);i(e.data||[])}catch(e){i([]),c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}return(0,Y.useEffect)(()=>{l&&d()},[l]),(0,Z.jsx)(O.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,Z.jsx)(O.Backdrop,{variant:`blur`,children:(0,Z.jsx)(O.Container,{size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(O.Dialog,{children:[(0,Z.jsxs)(O.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(O.Heading,{className:`text-section font-semibold`,children:u}),(0,Z.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`checkinRecordsHint`)})]}),(0,Z.jsx)(O.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ke,{size:16})})]}),(0,Z.jsxs)(O.Body,{className:`px-5 pb-2`,children:[s?(0,Z.jsx)(`div`,{className:`mb-3`,children:(0,Z.jsx)(pe,{title:s})}):null,a?(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,Z.jsx)(et,{className:`h-16 w-full`}),(0,Z.jsx)(et,{className:`h-16 w-full`}),(0,Z.jsx)(et,{className:`h-16 w-full`})]}):r.length?(0,Z.jsx)(`div`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(e=>{let n=Jn(e,t);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-3`,children:[(0,Z.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0`,"data-state":e.status===`error`?`warn`:`ok`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{size:`sm`,variant:`soft`,color:n.color,children:n.label}),(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:Yn(e.created_at)})]}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-caption leading-5 text-foreground/75`,children:e.message||`—`})]})]},e.id)})}):(0,Z.jsx)(_e,{className:`min-h-44 rounded-3xl bg-surface-secondary`,title:t(`checkinRecordsEmpty`),hint:t(`checkinRecordsHint`)})]}),(0,Z.jsxs)(O.Footer,{className:`justify-between px-5 pb-5`,children:[(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:t(`checkinRecordsCount`,{count:r.length})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(S,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:a,onPress:()=>void d(),children:[(0,Z.jsx)(He,{size:14}),t(`refresh`)]})]})]})]})})})})}function Zn(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function Qn({account:e,t,onClose:n}){let[r,i]=(0,Y.useState)([]),[a,o]=(0,Y.useState)(!!e?.id),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(1),[p,m]=(0,Y.useState)(20),[h,te]=(0,Y.useState)(0),[ne,g]=(0,Y.useState)(1),_=(0,Y.useRef)(0),v=e?.id||``,y=t(`accountModelsTitle`,{name:e?.name||e?.id||``}),re=e?ot(e.provider,e.region,t):``;async function b(e=1,t=p,n=!1){if(!v)return;let r=++_.current;n?c(!0):o(!0),u(``);try{let a=await(n?P(v,void 0,{page:e,pageSize:t}):Ne(v,!1,void 0,{page:e,pageSize:t})),o=a.data||[],s=a.pagination,c=s?.total??o.length,l=s?.total_pages??Math.max(1,Math.ceil(c/t)),u=Math.min(Math.max(1,s?.page??e),l);if(r!==_.current)return;i(s?o:o.slice((u-1)*t,u*t)),te(c),g(l),f(u)}catch(e){if(r!==_.current)return;i([]),te(0),g(1),u(e instanceof Error?e.message:String(e))}finally{r===_.current&&(o(!1),c(!1))}}(0,Y.useEffect)(()=>{v&&(f(1),b(1,p))},[v]);let x=h===0?0:(d-1)*p+1,C=h===0?0:Math.min(h,x+r.length-1);return(0,Z.jsx)(O.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,Z.jsx)(O.Backdrop,{variant:`blur`,children:(0,Z.jsx)(O.Container,{size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(O.Dialog,{children:[(0,Z.jsxs)(O.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(O.Heading,{className:`text-section font-semibold`,children:y}),(0,Z.jsx)(`p`,{className:`mt-1 text-caption font-normal leading-5 text-muted`,children:t(`accountModelsHint`)}),e?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-caption text-muted`,children:[(0,Z.jsx)(at,{provider:e.provider,size:14}),(0,Z.jsx)(`span`,{children:re}),(0,Z.jsx)(`span`,{className:`text-border`,children:`·`}),(0,Z.jsx)(`span`,{className:`mono`,children:e.id})]}):null]}),(0,Z.jsx)(O.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ke,{size:16})})]}),(0,Z.jsxs)(O.Body,{className:`px-5 pb-2`,children:[l?(0,Z.jsx)(`div`,{className:`mb-3`,children:(0,Z.jsx)(pe,{title:t(`accountModelsError`,{msg:l})})}):null,a||s?(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,Z.jsx)(et,{className:`h-14 w-full`}),(0,Z.jsx)(et,{className:`h-14 w-full`}),(0,Z.jsx)(et,{className:`h-14 w-full`})]}):r.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(n=>{let r=n.provider||n.owned_by||e?.provider||`qoder`,i=Zn(n),a=j(n),o=M(n);return(0,Z.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2.5`,children:[(0,Z.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":n.stale?void 0:`ok`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body font-medium`,children:n.display_name||n.id}),o?(0,Z.jsx)(V,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null,a?(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:a}):null,n.stale?(0,Z.jsx)(V,{size:`sm`,variant:`soft`,color:`warning`,children:t(`fallback`)}):null]}),(0,Z.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:n.id}),i?(0,Z.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:t(`routedTo`,{model:i})}):null]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 pt-0.5 text-caption text-muted`,children:[(0,Z.jsx)(at,{provider:r,size:12}),(0,Z.jsx)(`span`,{children:r})]})]},n.id)})}):(0,Z.jsx)(_e,{className:`min-h-48 rounded-3xl bg-surface-secondary`,icon:(0,Z.jsx)(Je,{size:22}),title:t(`accountModelsEmpty`),hint:t(`noModelsYet`)})]}),(0,Z.jsxs)(O.Footer,{className:`flex-col items-stretch gap-3 px-5 pb-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`refreshing`):t(`shownTotal`,{shown:h?`${x}–${C}`:0,total:h})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(S,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:s,onPress:()=>void b(1,p,!0),children:[(0,Z.jsx)(He,{size:14}),t(s?`refreshing`:`refresh`)]})]})]}),h>0?(0,Z.jsx)(ee,{total:h,page:d,pageCount:ne,pageSize:p,loading:a||s,pageSizeLabel:t(`logsPageSize`),pageLabel:t(`logsPage`,{page:d,pages:ne}),prevLabel:t(`logsPrevPage`),nextLabel:t(`logsNextPage`),onPage:e=>void b(e,p),onPageSize:e=>{m(e),b(1,e)}}):null]})]})})})})}function $n({account:e,busy:t,t:n,onClose:r,onSave:i}){let[a,o]=(0,Y.useState)(e?.name||``),[s,c]=(0,Y.useState)(e?.max_inflight??4),[l,u]=(0,Y.useState)(e?.priority??50),[d,f]=(0,Y.useState)(``),p=n(`editAccountTitle`,{name:e?.name||e?.id||``}),m=e?ot(e.provider,e.region,n):``;async function ee(e){e?.preventDefault();let t=a.trim();if(!t){f(n(`accountNameRequired`));return}if(!Number.isInteger(s)||s<1||s>32){f(n(`maxInflightInvalid`));return}if(!Number.isInteger(l)||l<1||l>100){f(n(`priorityInvalid`));return}f(``);try{await i({name:t,max_inflight:s,priority:l}),r()}catch(e){f(e instanceof Error?e.message:String(e))}}return(0,Z.jsx)(O.Root,{isOpen:!!e,onOpenChange:e=>{!e&&!t&&r()},children:(0,Z.jsx)(O.Backdrop,{variant:`blur`,children:(0,Z.jsx)(O.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(O.Dialog,{className:`w-full sm:w-[42rem] sm:max-w-[calc(100vw-2rem)]`,children:[(0,Z.jsxs)(O.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(O.Heading,{className:`text-section font-semibold`,children:p}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-body font-normal leading-6 text-muted`,children:n(`editAccountHint`)}),e?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{size:`sm`,variant:`soft`,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(at,{provider:e.provider,size:14}),(0,Z.jsx)(`span`,{children:m})]})}),(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:e.id})]}):null]}),(0,Z.jsx)(O.CloseTrigger,{isDisabled:t,"aria-label":n(`close`),className:`grid size-9 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,Z.jsx)(Ke,{size:18})})]}),(0,Z.jsxs)(O.Body,{className:`px-6 pb-2 pt-1`,children:[d?(0,Z.jsxs)(fe,{status:`danger`,className:`mb-4`,children:[(0,Z.jsx)(fe.Indicator,{}),(0,Z.jsx)(fe.Content,{children:(0,Z.jsx)(fe.Title,{children:d})})]}):null,(0,Z.jsxs)(R,{className:`space-y-4`,onSubmit:e=>void ee(e),children:[(0,Z.jsx)(J,{label:n(`accountName`),children:(0,Z.jsx)(D,{value:a,onChange:e=>o(e.target.value),placeholder:n(`wizardNamePh`),"aria-label":n(`accountName`),disabled:t,autoFocus:!0})}),(0,Z.jsx)(J,{label:n(`maxInflight`),hint:n(`maxInflightHint`),children:(0,Z.jsx)(k,{value:s,onChange:e=>c(e??4),minValue:1,maxValue:32,isDisabled:t,isRequired:!0,children:(0,Z.jsxs)(k.Group,{children:[(0,Z.jsx)(k.DecrementButton,{}),(0,Z.jsx)(k.Input,{"aria-label":n(`maxInflight`)}),(0,Z.jsx)(k.IncrementButton,{})]})})}),(0,Z.jsx)(J,{label:n(`priority`),hint:n(`priorityHint`),children:(0,Z.jsx)(k,{value:l,onChange:e=>u(e??50),minValue:1,maxValue:100,isDisabled:t,isRequired:!0,children:(0,Z.jsxs)(k.Group,{children:[(0,Z.jsx)(k.DecrementButton,{}),(0,Z.jsx)(k.Input,{"aria-label":n(`priority`)}),(0,Z.jsx)(k.IncrementButton,{})]})})})]})]}),(0,Z.jsxs)(O.Footer,{className:`justify-end gap-2 px-6 pb-6`,children:[(0,Z.jsx)(S,{variant:`ghost`,isDisabled:t,onPress:r,children:n(`cancel`)}),(0,Z.jsx)(S,{isPending:t,onPress:()=>void ee(),children:n(`save`)})]})]})})})})}var er={1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-3`};function tr({options:e,value:t,onChange:n,ariaLabel:r,columns:i=2,className:a=``}){let o=(0,Y.useRef)(null);return(0,Y.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=z.context(()=>{let e=z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{z.set(`[data-option-tile]`,{autoAlpha:1,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{z.fromTo(`[data-option-tile]`,{autoAlpha:0,y:8},{autoAlpha:1,y:0,duration:.32,stagger:.035,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[e.length]),(0,Z.jsx)(`div`,{ref:o,role:`radiogroup`,"aria-label":r,className:`grid gap-3 ${er[i]} ${a}`.trim(),children:e.map(e=>{let r=e.value===t;return(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-option-tile":``,"data-selected":r||void 0,disabled:e.disabled,title:e.hint,onClick:()=>n(e.value),className:`flex h-16 min-w-0 items-center gap-3 rounded-xl bg-surface shadow-surface px-4 text-left transition-colors hover:bg-surface-secondary disabled:cursor-not-allowed disabled:opacity-50 data-selected:border-accent data-selected:bg-accent-soft`,children:[e.icon?(0,Z.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground [&_svg]:size-[18px]`,children:e.icon}):null,(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body font-medium leading-5 text-foreground`,children:e.label})]},e.value)})})}var nr=new Set([`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`]),rr=[`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`];function ir(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>{let r=n.get(e.id)??2**53-1,i=n.get(t.id)??2**53-1;return r===i?e.label.localeCompare(t.label):r-i})}function ar(e,t){return!t||`${e.label} ${e.subtitle||``} ${e.hint||``} ${e.provider} ${e.id}`.toLowerCase().includes(t)}function or({ariaLabel:e}){return(0,Z.jsx)(`div`,{className:`space-y-8`,"aria-busy":`true`,"aria-label":e,children:Array.from({length:2},(e,t)=>(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(Qe,{className:`h-3 w-24 rounded-lg`}),(0,Z.jsx)(Qe,{className:`h-3 w-40 rounded-lg`})]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:Array.from({length:t===0?5:6},(e,t)=>(0,Z.jsxs)(`div`,{className:`card flex flex-row items-center gap-3.5 rounded-xl bg-surface px-4 py-3.5`,children:[(0,Z.jsx)(Qe,{className:`size-10 shrink-0 rounded-lg`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,Z.jsx)(Qe,{className:`h-3.5 w-28 rounded-lg`}),(0,Z.jsx)(Qe,{className:`h-3 w-36 rounded-lg`})]})]},t))})]},t))})}function sr({tile:e,disabled:t,onSelect:n}){return(0,Z.jsxs)(`button`,{type:`button`,disabled:t,title:e.hint||e.subtitle||e.label,onClick:()=>n(e.id),className:`card flex min-w-0 flex-row items-center gap-3 rounded-xl bg-surface px-3.5 py-3 text-left transition-[transform,opacity,background-color] duration-200 ease-out hover:bg-surface-secondary active:translate-y-px active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:translate-y-0 motion-reduce:active:scale-100 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:translate-y-0 disabled:active:scale-100`,children:[(0,Z.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg text-foreground [&_svg]:size-[18px]`,children:(0,Z.jsx)(at,{provider:e.provider,size:18})}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block truncate text-body font-medium leading-5 text-foreground`,children:e.label}),e.subtitle?(0,Z.jsx)(`span`,{className:`mt-0.5 block truncate text-caption leading-4 text-muted`,children:e.subtitle}):null]})]})}function cr({title:e,subtitle:t,tiles:n,disabled:r,onSelect:i}){return n.length?(0,Z.jsxs)(`section`,{className:`space-y-3.5`,children:[(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(`h3`,{className:`text-[10px] font-semibold tracking-[0.12em] uppercase text-muted`,children:e}),t?(0,Z.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:n.map(e=>(0,Z.jsx)(sr,{tile:e,disabled:r,onSelect:i},e.id))})]}):null}function lr({options:e,onSelect:t,disabled:n,empty:r,ariaLabel:i}){let{t:a}=re(),[o,s]=(0,Y.useState)(``),c=o.trim().toLowerCase(),l=(0,Y.useMemo)(()=>{let t=ir(e.filter(e=>nr.has(e.id)),rr),n=e.filter(e=>!nr.has(e.id)).sort((e,t)=>e.label.localeCompare(t.label));return[{id:`subscriptions`,titleKey:`providerGroupSubscriptions`,subtitleKey:`providerGroupSubscriptionsHint`,tiles:t.filter(e=>ar(e,c))},{id:`experimental`,titleKey:`providerGroupExperimental`,subtitleKey:`providerGroupExperimentalHint`,tiles:n.filter(e=>ar(e,c))}]},[c,e]),u=l.reduce((e,t)=>e+t.tiles.length,0);return(0,Z.jsxs)(`div`,{className:`space-y-8`,role:`listbox`,"aria-label":i,children:[(0,Z.jsx)(h,{value:o,onChange:s,placeholder:a(`providerFindPlaceholder`),ariaLabel:a(`providerFindPlaceholder`),className:`max-w-sm`}),u===0?r||(0,Z.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:a(`providerFindEmpty`)}):l.map(e=>(0,Z.jsx)(cr,{title:a(e.titleKey),subtitle:a(e.subtitleKey),tiles:e.tiles,disabled:n,onSelect:t},e.id))]})}var ur={"workbuddy-accounts":`workbuddy`,"workbuddy-oauth-v1":`workbuddy`,"qoder-native-v1":`qoder`,"trae-oauth-v1":`trae`,"devin-session-v1":`devin`,"command-key-v1":`command`,"opencode-key-v1":`opencode`,"codex-oauth-v1":`codex`,"zhipu-key-v1":`zhipu`,"qwenwork-oauth-v1":`qwenwork`,"meta-oauth-v1":`meta`,"meta-key-v1":`meta`,"kiro-oauth-v1":`kiro`,"doubaowork-cookie-v1":`doubaowork`},dr=[`codebuddy.cn`,`workbuddy.cn`],fr=[`workbuddy.ai`,`workbuddy.com`],pr=new Set([`us-east-1`,`eu-central-1`]),mr=/arn:aws:codewhisperer:([a-z0-9-]+):/;function Q(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function $(e){return typeof e==`string`?e.trim():``}function hr(e){let t=e.trim();if(!t)return``;let n=t.toLowerCase();return n===`workbuddy-accounts`?`workbuddy-accounts`:n}function gr(e){return typeof e.format==`string`&&e.format.trim()?hr(e.format):typeof e.exportType==`string`&&e.exportType.trim()?hr(e.exportType):``}function _r(e){let t=[],n=e=>{typeof e==`string`&&e.trim()&&t.push(e.trim().toLowerCase())};if(n(e.domain),Q(e.account)&&n(e.account.domain),Q(e.auth)&&n(e.auth.domain),Array.isArray(e.accounts))for(let t of e.accounts)Q(t)&&(n(t.domain),Q(t.account)&&n(t.account.domain),Q(t.auth)&&n(t.auth.domain));return t}function vr(e){return dr.some(t=>e.includes(t))}function yr(e){return fr.some(t=>e.includes(t))}function br(e){return typeof e.accessToken==`string`||typeof e.access_token==`string`||typeof e.refreshToken==`string`||typeof e.refresh_token==`string`}function xr(e){if(!Q(e))return!1;if(br(e)||typeof e.domain==`string`||typeof e.uid==`string`)return!0;if(Q(e.account)||Q(e.auth)){let t=Q(e.account)?e.account:null,n=Q(e.auth)?e.auth:null;if(n&&(br(n)||typeof n.domain==`string`)||t&&(typeof t.uid==`string`||typeof t.domain==`string`))return!0}return!1}function Sr(e){let t=_r(e);if(t.length===0)return{region:`cn`,ambiguous:!0,warning:`region_unknown`};let n=t.some(vr),r=t.some(yr);return n&&r?{region:null,ambiguous:!0,warning:`region_mixed`}:n?{region:`cn`,ambiguous:!1}:r?{region:`global`,ambiguous:!1}:{region:`cn`,ambiguous:!0,warning:`region_unknown`}}function Cr(e){let t=$(e.region).toLowerCase();if(pr.has(t))return t;if(t===`eu`||t===`europe`)return`eu-central-1`;let n=$(e.profileArn)||$(e.profile_arn),r=mr.exec(n);if(r&&pr.has(r[1]))return r[1];for(let t of[`kiroApiKey`,`apiKey`,`api_key`,`accessToken`,`access_token`]){let n=$(e[t]),r=n.split(`|`);if(n.startsWith(`ksk_`)&&r.length===2&&pr.has(r[1].trim().toLowerCase()))return r[1].trim().toLowerCase()}return null}function wr(e){if(gr(e)===`kiro-oauth-v1`||Cr(e))return!0;let t=($(e.authMethod)||$(e.auth_method)).toLowerCase();if([`builder_id`,`builderid`,`external_idp`,`idc`,`social`].includes(t))return!0;let n=$(e.provider).toLowerCase();if([`builderid`,`kiro`,`apikey`,`github`,`google`,`social`].includes(n))return!0;for(let t of[`kiroApiKey`,`apiKey`,`api_key`,`accessToken`,`access_token`])if($(e[t]).startsWith(`ksk_`))return!0;let r=$(e.clientId)||$(e.client_id),i=$(e.clientSecret)||$(e.client_secret),a=$(e.refreshToken)||$(e.refresh_token),o=$(e.startUrl)||$(e.start_url);if(r&&i&&a||o.includes(`awsapps.com`)&&a||($(e.profileArn)||$(e.profile_arn)).includes(`codewhisperer`)&&(a||$(e.accessToken)||$(e.access_token)))return!0;let s=$(e.tokenEndpoint)||$(e.token_endpoint),c=$(e.issuerUrl)||$(e.issuer_url);return!!((s.includes(`microsoftonline`)||c.includes(`microsoftonline`))&&a)}function Tr(e){return Array.isArray(e.accounts)?e.accounts.filter(e=>Q(e)&&wr(e)):[]}function Er(e){return wr(e)||Tr(e).length>0?{format:`kiro-oauth-v1`,provider:`kiro`,confidence:`medium`}:Array.isArray(e.accounts)&&e.accounts.some(xr)?{format:`workbuddy-accounts`,provider:`workbuddy`,confidence:`medium`}:(typeof e.user_blob==`string`||typeof e.userBlob==`string`)&&(typeof e.machine_id==`string`||typeof e.machineId==`string`)?{format:`qoder-native-v1`,provider:`qoder`,confidence:`medium`}:typeof e.session_token==`string`||typeof e.sessionToken==`string`?{format:`devin-session-v1`,provider:`devin`,confidence:`low`}:br(e)||Q(e.account)&&br(e.account)||Q(e.auth)?{format:`workbuddy-oauth-v1`,provider:`workbuddy`,confidence:`low`}:typeof e.dca_token==`string`||typeof e.dcaToken==`string`||typeof e.access_token==`string`&&String(e.access_token).startsWith(`dca:`)||typeof e.accessToken==`string`&&String(e.accessToken).startsWith(`dca:`)?{format:`meta-oauth-v1`,provider:`meta`,confidence:`medium`}:typeof e.api_key==`string`||typeof e.apiKey==`string`?typeof e.organization==`string`||typeof e.project==`string`?{format:`zhipu-key-v1`,provider:`zhipu`,confidence:`low`}:typeof e.base_url==`string`&&String(e.base_url).includes(`meta.ai`)||typeof e.baseUrl==`string`&&String(e.baseUrl).includes(`meta.ai`)||typeof e.email==`string`?{format:`meta-key-v1`,provider:`meta`,confidence:`low`}:{format:`command-key-v1`,provider:`command`,confidence:`low`}:{format:null,provider:null,confidence:`low`}}function Dr(e){let t=Tr(e),n=t.length>0?t:[e],r=new Set(n.map(Cr).filter(e=>e!=null));return r.size===1?{region:[...r][0],ambiguous:!1}:(r.size,{region:null,ambiguous:!0})}function Or(e){if(!Q(e))return{format:null,provider:null,region:null,regionAmbiguous:!0,confidence:`low`,warnings:[`not_object`],batchImportSupported:!1};let t=[],n=gr(e),r=typeof e.format==`string`?e.format.trim():``,i=typeof e.exportType==`string`?e.exportType.trim():``,a=r||i,o=n||null,s=o?ur[o]??null:null,c=o&&s?`high`:`low`;if(!s){let r=Er(e);o||=r.format,s=r.provider,c=n&&!ur[n]?`low`:r.confidence,a&&!ur[n]&&t.push(`unknown_format`)}s!==`kiro`&&(wr(e)||Tr(e).length>0)&&(s=`kiro`,o=`kiro-oauth-v1`,c=n===`kiro-oauth-v1`?`high`:`medium`),s===`workbuddy`&&Array.isArray(e.accounts)&&(o=`workbuddy-accounts`);let l=null,u=!1;if(s===`workbuddy`){let n=Sr(e);l=n.region,u=n.ambiguous,n.warning&&t.push(n.warning)}if(s===`kiro`){let n=Dr(e);l=n.region,u=n.ambiguous,u&&t.push(Tr(e).length>1?`region_mixed`:`region_unknown`)}return{format:o,provider:s,region:l,regionAmbiguous:u,confidence:c,warnings:t,batchImportSupported:s===`workbuddy`||s===`kiro`}}function kr(e){let t;try{t=JSON.parse(e)}catch{throw Error(`bad_json`)}if(Array.isArray(t)){if(t.length===0||!t.every(Q))throw Error(`bad_json`);return{accounts:t}}if(!Q(t))throw Error(`bad_json`);return t}function Ar(e,t){let n={...e},r=n.format===`workbuddy-accounts`||Array.isArray(n.accounts);return n.format?r&&(n.format=`workbuddy-accounts`):n.format=r?`workbuddy-accounts`:`workbuddy-oauth-v1`,{...n,name:t.name?.trim()||n.name,enabled:t.enabled??!0,provider:`workbuddy`,region:t.region,max_inflight:t.max_inflight??4,priority:t.priority??50,drop_system_prompt:t.drop_system_prompt??!0,...t.proxy_url!=null&&t.proxy_url!==``?{proxy_url:t.proxy_url}:{}}}function jr(e,t){let n=typeof e?.succeeded==`number`?e.succeeded:e?.id||e?1:0,r=typeof e?.failed==`number`?e.failed:0,i=(e?.errors||[]).slice(0,3).map(e=>e.message||`index ${e.index}`).filter(Boolean).join(`; `),a;return a=r>0?t(`accountImportPartial`).replace(`{ok}`,String(n)).replace(`{fail}`,String(r))+(i?` — ${i}`:``):n>1?t(`accountImportBatch`).replace(`{n}`,String(n)):t(`accountImported`),{succeeded:n,failed:r,message:a}}async function Mr(e,t){let n=Ar(e,t);return Re(n)}var Nr={global:`Global`,cn:`CN`},Pr={"qoder-global":`accountTypeQoderGlobal`,"qoder-cn":`accountTypeQoderCN`,"workbuddy-cn":`accountTypeWorkBuddyCN`,"workbuddy-global":`accountTypeWorkBuddyGlobal`,"trae-cn":`accountTypeTraeCN`,"devin-global":`accountTypeDevinGlobal`,"command-global":`accountTypeCommandGlobal`,"codex-global":`accountTypeCodexGlobal`,"zhipu-cn":`accountTypeZhipuCN`,"qwenwork-global":`accountTypeQwenworkGlobal`,"qwenwork-cn":`accountTypeQwenworkCN`,"kimi-cn":`accountTypeKimiCN`,"codearts-cn-north-4":`accountTypeCodeArtsCN`,"doubaowork-cn":`accountTypeDoubaoworkCN`,"kiro-us-east-1":`accountTypeKiroUS`,"kiro-eu-central-1":`accountTypeKiroEU`,"meta-global":`accountTypeMetaGlobal`,"minimaxcode-cn":`accountTypeMiniMaxCodeCN`,"minimaxcode-global":`accountTypeMiniMaxCodeGlobal`,"opencode-go":`accountTypeOpenCode`,"opencode-zen":`accountTypeOpenCode`},Fr={"qoder-global":`accountTypeQoderGlobalHint`,"qoder-cn":`accountTypeQoderCNHint`,"workbuddy-cn":`accountTypeWorkBuddyCNHint`,"workbuddy-global":`accountTypeWorkBuddyGlobalHint`,"trae-cn":`accountTypeTraeCNHint`,"devin-global":`accountTypeDevinGlobalHint`,"command-global":`accountTypeCommandGlobalHint`,"codex-global":`accountTypeCodexGlobalHint`,"zhipu-cn":`accountTypeZhipuCNHint`,"qwenwork-global":`accountTypeQwenworkGlobalHint`,"qwenwork-cn":`accountTypeQwenworkCNHint`,"kimi-cn":`accountTypeKimiCNHint`,"codearts-cn-north-4":`accountTypeCodeArtsCNHint`,"doubaowork-cn":`accountTypeDoubaoworkCNHint`,"kiro-us-east-1":`accountTypeKiroUSHint`,"kiro-eu-central-1":`accountTypeKiroEUHint`,"meta-global":`accountTypeMetaGlobalHint`,"minimaxcode-cn":`accountTypeMiniMaxCodeCNHint`,"minimaxcode-global":`accountTypeMiniMaxCodeGlobalHint`,"opencode-go":`accountTypeOpenCodeGoHint`,"opencode-zen":`accountTypeOpenCodeZenHint`};async function Ir(){let e=(await Te().catch(()=>null))?.data||[],t=[];for(let n of e)for(let e of n.regions)t.push({id:`${n.id}-${e.id}`,provider:n.id,region:e.id,descriptor:n});return t}function Lr(e,t){let n=Pr[e.id];if(n){let e=t(n);if(e!==n)return e}let r=e.descriptor.regions.find(t=>t.id===e.region)?.label||Nr[e.region]||``,i=e.descriptor.regions.length>1&&r?` ${r}`:``;return`${e.descriptor.label}${i}`.trim()}function Rr(e,t){if(!e)return``;let n=Fr[e.id];if(!n)return``;let r=t(n);return r===n?``:r}function zr({phase:e,busy:t,tab:n,forTab:r}){return e===`done`?(0,Z.jsx)(B,{size:16,className:`text-success`}):t&&n===r?(0,Z.jsx)(Xe,{size:16,loading:!0}):null}var Br=90,Vr=2e3;function Hr({isOpen:e,onClose:t,onAdded:n}){let{t:i}=re(),[o,d]=(0,Y.useState)(`method`),[p,m]=(0,Y.useState)(`browser`),[ee,h]=(0,Y.useState)(``),[te,g]=(0,Y.useState)([]),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(!1),[x,C]=(0,Y.useState)(``),[ie,w]=(0,Y.useState)(4),[ae,oe]=(0,Y.useState)(50),[T,se]=(0,Y.useState)(``),[ce,le]=(0,Y.useState)(``),[E,ue]=(0,Y.useState)(`payg`),[fe,pe]=(0,Y.useState)(``),[me,he]=(0,Y.useState)(``),[_e,ve]=(0,Y.useState)(``),[ye,be]=(0,Y.useState)(``),[A,j]=(0,Y.useState)(`idle`),[M,N]=(0,Y.useState)(``),[P,Se]=(0,Y.useState)(``),[Ce,we]=(0,Y.useState)(!1),[Te,F]=(0,Y.useState)(``),[De,Oe]=(0,Y.useState)(`cli`),[ke,Ae]=(0,Y.useState)(`builder_id`),[I,je]=(0,Y.useState)(``),Me=(0,Y.useRef)(null),Ne=(0,Y.useRef)(null),Ie=(0,Y.useRef)(null),L=(0,Y.useRef)(``),ze=(0,Y.useRef)(null),Be=(0,Y.useRef)(null);function Ve(){ze.current!==null&&(window.clearTimeout(ze.current),ze.current=null)}(0,Y.useEffect)(()=>()=>Ve(),[]),(0,Y.useEffect)(()=>{if(!e)return;let t=!1;return v(!0),g([]),h(``),Ir().then(e=>{t||(g(e),h(``),m(`browser`))}).finally(()=>{t||v(!1)}),()=>{t=!0}},[e]);let R=te.find(e=>e.id===ee),He=!_&&te.length>0,Ue=R?.descriptor.capabilities?.pat_login!==!1,We=R?.descriptor.capabilities?.import_export!==!1,V=R?.descriptor.capabilities?.browser_login!==!1,qe=R?.provider===`trae`||R?.provider===`devin`||R?.provider===`codex`||R?.provider===`codearts`,H=A===`busy`||A===`polling`,Je=!!L.current||H,U=A===`done`,Ye=Rr(R,i);(0,Y.useEffect)(()=>{p===`pat`&&!Ue&&m(`browser`),p===`import`&&!We&&m(`browser`)},[We,Ue,p]),(0,Y.useEffect)(()=>{V||(Ue?m(`pat`):We&&m(`import`))},[V,We,Ue]);function Xe(){return!Number.isInteger(ie)||ie<1||ie>32?4:ie}function Ze(){return!Number.isInteger(ae)||ae<1||ae>100?50:ae}function W(){return{max_inflight:Xe(),priority:Ze()}}function Qe(){Ve(),d(`method`),m(`browser`),h(``),g([]),v(!1),C(``),w(4),oe(50),se(``),le(``),ue(`payg`),pe(``),he(``),ve(``),be(``),b(!1),j(`idle`),N(``),Se(``),we(!1),F(``),Oe(`cli`),L.current=``}function G(){H||(Qe(),t())}function $e(){Qe(),t()}(0,Y.useLayoutEffect)(()=>{let t=Me.current;if(e||(Ie.current=null),!t||!e)return;let n=z.context(()=>{let e=z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{z.set(t,{autoAlpha:1,x:0,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Ie.current,n=e&&e!==o?o===`login`?1:-1:0;z.fromTo(t,{autoAlpha:0,x:20*n,y:n?0:12},{autoAlpha:1,x:0,y:0,duration:nt.slow,ease:rt.out,overwrite:!0}),n&&Ne.current&&z.fromTo(Ne.current,{autoAlpha:0,y:6},{autoAlpha:1,y:0,duration:nt.base,ease:rt.out,overwrite:!0})})},t);return Ie.current=o,()=>n.revert()},[e,o]);function et(e){if(H||!He)return;let t=te.find(t=>t.id===e);h(e),m(t?.provider===`zhipu`||t?.provider===`doubaowork`?`pat`:`browser`),N(``),d(`login`)}async function tt(){if(L.current)return L.current;if(!R)throw Error(i(`accountTypeHint`));let e=W(),t=await Le(x.trim()||i(`account`),R.provider,R.region,e),n=t?.id||t?.data?.id;if(!n)throw Error(`create account returned no id`);return L.current=n,n}async function K(){N(``),Se(``);try{j(`busy`);let e=await tt();N(i(`wizardStartingSession`)),j(`polling`);let t=R?.provider===`codex`?De:R?.provider===`kiro`?ke:void 0,r=await xe(e,t,ke===`idc`?I.trim():void 0);r.authUrl&&Se(r.authUrl),N(i(`wizardWaitingBrowser`));for(let t=0;t{ze.current=window.setTimeout(e,Vr)});let n=(await Fe(e)).login||{};if(n.message&&N(n.message),n.status===`ok`)break;if(n.status===`error`)throw Error(n.message||`login failed`);if(t===89)throw Error(i(`wizardLoginTimeout`))}j(`done`),N(i(`wizardAccountReady`)),n(),window.setTimeout($e,900)}catch(e){j(`idle`),N(e instanceof Error?e.message:String(e))}}async function ot(){let e=Te.trim();if(!e){N(i(`wizardCallbackPh`));return}try{j(`busy`);let t=await tt();Ve(),await Pe(t,e),j(`done`),N(i(`wizardAccountReady`)),n(),window.setTimeout($e,900)}catch(e){j(`polling`),N(e instanceof Error?e.message:String(e))}}async function st(){let e=fe.trim();if(!e){N(i(`zhipuKeyRequired`));return}if(!R){N(i(`accountTypeHint`));return}N(``);try{j(`busy`);let t=W();await Re({format:`zhipu-key-v1`,api_key:e,mode:E,organization:E===`coding`?me.trim():``,project:E===`coding`?_e.trim():``,name:x.trim()||i(`accountTypeZhipuCN`),enabled:!0,provider:R.provider,region:R.region,max_inflight:t.max_inflight,priority:t.priority}),j(`done`),N(i(`wizardAccountReady`)),n(),window.setTimeout($e,700)}catch(e){j(`idle`),N(e instanceof Error?e.message:String(e))}}async function ct(){let e=T.trim();if(!e){N(i(`pastePatFirst`));return}N(``);try{j(`busy`);let t=await tt();N(i(`wizardStartingSession`)),await Ee(e,t),j(`done`),N(i(`patDone`)),n(),window.setTimeout($e,700)}catch(e){j(`idle`),N(e instanceof Error?e.message:String(e))}}async function lt(){let e=ye.trim();if(!e){N(i(`doubaoCookieRequired`));return}if(!R){N(i(`accountTypeHint`));return}N(``);try{j(`busy`);let t=W();await Re({format:`doubaowork-cookie-v1`,cookie:e,name:x.trim()||i(`accountTypeDoubaoworkCN`),enabled:!0,provider:R.provider,region:R.region,max_inflight:t.max_inflight,priority:t.priority}),j(`done`),N(i(`wizardAccountReady`)),n(),window.setTimeout($e,900)}catch(e){j(`idle`),N(e instanceof Error?e.message:String(e))}}async function ut(){N(``);let e;try{e=JSON.parse(ce)}catch{N(i(`wizardBadJson`));return}if(Array.isArray(e)){if(!e.every(e=>e&&typeof e==`object`&&!Array.isArray(e))){N(i(`wizardBadJson`));return}e={accounts:e}}if(!e||typeof e!=`object`){N(i(`wizardBadJson`));return}if(!R){N(i(`accountTypeHint`));return}let t=Or(e),r=t.provider||R.provider;if(r===`qoder`&&(typeof e.user_blob!=`string`||typeof e.machine_id!=`string`)){N(i(`wizardBadJson`));return}let a=W(),o;if(r===`kiro`){let t=typeof e.email==`string`?e.email.trim():``,n=typeof e.nickname==`string`?e.nickname.trim():``,r=Cr(e),{provider:i,accounts:s,...c}=e,l=Array.isArray(s)?s:[{...c,...i?{provider:i}:{}}];o={format:`kiro-oauth-v1`,provider:`kiro`,region:r||(R.provider===`kiro`?R.region:`us-east-1`),name:x.trim()||n||t||void 0,enabled:!0,accounts:l,max_inflight:a.max_inflight,priority:a.priority}}else if(r===`workbuddy`)o=Ar(e,{region:R.region===`global`?`global`:`cn`,name:x.trim()||void 0,enabled:!0,max_inflight:a.max_inflight,priority:a.priority});else{if(!e.format){let t=r;t===`trae`?e.format=`trae-oauth-v1`:t===`devin`?e.format=`devin-session-v1`:t===`command`?e.format=`command-key-v1`:t===`opencode`?e.format=`opencode-key-v1`:t===`qwenwork`?e.format=`qwenwork-oauth-v1`:t===`kimi`?e.format=`kimi-oauth-v1`:t===`codearts`?e.format=`codearts-oauth-v1`:t===`codex`?e.format=`codex-oauth-v1`:t===`meta`?e.format=`meta-oauth-v1`:e.format=`qoder-native-v1`}o={...e,name:x.trim()||e.name,enabled:!0,provider:r,region:t.region||R.region,max_inflight:a.max_inflight,priority:a.priority}}try{j(`busy`);let{failed:e,message:t}=jr(await Re(o),i);j(`done`),N(t),n(),window.setTimeout($e,e>0?1600:700)}catch(e){j(`idle`),N(e instanceof Error?e.message:String(e))}}function dt(){Be.current?.click()}function ft(e){let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>le(String(n.result||``)),n.readAsText(t),e.target.value=``}let pt=e=>H&&p===e,mt=R?.provider===`zhipu`,ht=R?.provider===`doubaowork`,gt=[R?.descriptor.capabilities?.browser_login===!1?null:{value:`browser`,label:i(`tabBrowser`)},Ue?{value:`pat`,label:i(`tabPat`)}:null,We?{value:`import`,label:i(`tabImport`)}:null].filter(Boolean),_t=i(p===`browser`?R?.provider===`codex`?`wizardCodexBrowserLead`:`wizardBrowserLead`:p===`pat`?R?.provider===`command`?`wizardPatLeadCommand`:R?.provider===`opencode`?`wizardPatLeadOpenCode`:R?.region===`cn`&&R?.provider===`qoder`?`wizardPatLeadCN`:`wizardPatLead`:`wizardImportLead`);return(0,Z.jsx)(O.Root,{isOpen:e,onOpenChange:e=>{e||G()},children:(0,Z.jsx)(O.Backdrop,{variant:`blur`,isDismissable:!H,children:(0,Z.jsx)(O.Container,{size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(O.Dialog,{className:`w-full sm:w-[36rem] sm:max-w-[calc(100vw-2rem)] sm:min-h-[36rem]`,children:[(0,Z.jsxs)(O.Header,{className:`relative items-center justify-center px-12 pt-5 text-center`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(O.Heading,{className:`text-section font-semibold`,children:i(`addAccountTitle`)}),(0,Z.jsx)(`p`,{ref:Ne,className:`mt-1 text-caption font-normal leading-5 text-muted`,children:o===`method`?i(`addAccountDesc`):Ye||i(`addAccountDesc`)})]}),(0,Z.jsx)(O.CloseTrigger,{"aria-label":i(`close`),className:`absolute right-4 top-4 grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ke,{size:16})})]}),(0,Z.jsx)(O.Body,{className:o===`method`?`px-8 pb-5 sm:px-10`:`px-6 pb-2`,children:(0,Z.jsx)(`div`,{ref:Me,children:o===`method`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`section`,{className:`space-y-2.5`,children:_?(0,Z.jsx)(or,{ariaLabel:i(`accountType`)}):He?(0,Z.jsx)(lr,{ariaLabel:i(`accountType`),options:te.map(e=>{let t=e.descriptor.regions.find(t=>t.id===e.region)?.label||Nr[e.region]||``;return{id:e.id,provider:e.provider,label:Lr(e,i),subtitle:t,hint:Rr(e,i)}}),onSelect:et,disabled:Je}):(0,Z.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:i(`accountTypeHint`)})}),(0,Z.jsx)(`div`,{className:`mt-4 text-center`,children:(0,Z.jsx)(l,{className:`text-xs`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`card flex flex-row items-center gap-3 rounded-xl bg-surface px-3 py-2.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:(0,Z.jsx)(at,{provider:R?.provider,size:18})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-body font-medium text-foreground`,children:R?Lr(R,i):i(`accountType`)}),(0,Z.jsx)(`div`,{className:`truncate text-caption text-muted`,children:Ye})]}),(0,Z.jsxs)(S,{size:`sm`,variant:`ghost`,onPress:()=>d(`method`),isDisabled:H||!!L.current,children:[(0,Z.jsx)(r,{size:12}),i(`wizardBack`)]})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(de,{className:`text-body font-medium text-muted`,children:i(`accountName`)}),(0,Z.jsx)(D,{fullWidth:!0,value:x,onChange:e=>C(e.target.value),"aria-label":i(`accountName`),disabled:Je,autoFocus:!0})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>b(e=>!e),"aria-expanded":y,className:`inline-flex items-center gap-1 text-caption font-medium text-muted transition-colors hover:text-foreground`,children:[(0,Z.jsx)(u,{size:12,className:`transition-transform duration-200 ${y?`rotate-90`:``}`}),i(`wizardAdvanced`)]}),y?(0,Z.jsx)(`div`,{className:`card gap-3 rounded-xl bg-surface px-3.5 py-3.5`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(de,{className:`text-body font-medium text-muted`,children:i(`maxInflight`)}),(0,Z.jsx)(k,{value:ie,onChange:e=>w(e??4),minValue:1,maxValue:32,isDisabled:Je,isRequired:!0,children:(0,Z.jsxs)(k.Group,{className:`w-full`,children:[(0,Z.jsx)(k.DecrementButton,{}),(0,Z.jsx)(k.Input,{"aria-label":i(`maxInflight`)}),(0,Z.jsx)(k.IncrementButton,{})]})}),(0,Z.jsx)(ge,{className:`text-caption leading-5 text-muted`,children:i(`maxInflightHint`)})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(de,{className:`text-body font-medium text-muted`,children:i(`priority`)}),(0,Z.jsx)(k,{value:ae,onChange:e=>oe(e??50),minValue:1,maxValue:100,isDisabled:Je,isRequired:!0,children:(0,Z.jsxs)(k.Group,{className:`w-full`,children:[(0,Z.jsx)(k.DecrementButton,{}),(0,Z.jsx)(k.Input,{"aria-label":i(`priority`)}),(0,Z.jsx)(k.IncrementButton,{})]})}),(0,Z.jsx)(ge,{className:`text-caption leading-5 text-muted`,children:i(`priorityHint`)})]})]})}):null]}),mt?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`span`,{className:`text-body font-medium text-muted`,children:i(`zhipuAccountMode`)}),(0,Z.jsx)(tr,{ariaLabel:i(`zhipuAccountMode`),columns:2,value:E,onChange:e=>{H||ue(e)},options:[{value:`payg`,label:i(`zhipuModePayg`),hint:i(`zhipuModePaygHint`),disabled:H},{value:`coding`,label:i(`zhipuModeCoding`),hint:i(`zhipuModeCodingHint`),disabled:H}]})]}),(0,Z.jsx)(J,{label:i(`zhipuApiKey`),children:(0,Z.jsx)(D,{type:`password`,value:fe,onChange:e=>pe(e.target.value),placeholder:i(`zhipuApiKeyPh`),"aria-label":i(`zhipuApiKey`),disabled:H})}),E===`coding`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(J,{label:i(`zhipuOrganization`),children:(0,Z.jsx)(D,{value:me,onChange:e=>he(e.target.value),placeholder:i(`zhipuOrganizationPh`),"aria-label":i(`zhipuOrganization`),disabled:H})}),(0,Z.jsx)(J,{label:i(`zhipuProject`),children:(0,Z.jsx)(D,{value:_e,onChange:e=>ve(e.target.value),placeholder:i(`zhipuProjectPh`),"aria-label":i(`zhipuProject`),disabled:H})})]}):null,M?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[U?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:U?`font-medium text-foreground`:`text-muted`,children:M})]}):null]}):null,ht?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,Z.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:i(`doubaoCookieLead`)}),(0,Z.jsx)(J,{label:i(`doubaoCookieLabel`),children:(0,Z.jsx)(s,{className:`min-h-28 font-mono text-caption leading-5`,value:ye,onChange:e=>be(e.target.value),placeholder:i(`doubaoCookiePh`),"aria-label":i(`doubaoCookieLabel`),disabled:H})}),M?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[U?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:U?`font-medium text-foreground`:`text-muted`,children:M})]}):null]}):null,mt||ht?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(it,{className:`mt-3`,value:p,onChange:e=>{!H&&e!==p&&(m(e),N(``),Se(``),we(!1))},ariaLabel:i(`authentication`),options:gt.map(e=>({id:e.value,label:e.label}))}),(0,Z.jsx)(`p`,{className:`mt-2 min-h-5 text-caption leading-5 text-muted`,children:_t}),(0,Z.jsx)(`div`,{className:`mt-3 flex flex-col gap-4`,children:p===`browser`?(0,Z.jsxs)(Z.Fragment,{children:[R?.provider===`codex`?(0,Z.jsx)(tr,{ariaLabel:i(`codexLoginMethod`),columns:2,value:De,onChange:e=>{H||Oe(e)},options:[{value:`cli`,label:i(`codexLoginCli`),hint:i(`codexLoginCliHint`),disabled:H||!!L.current},{value:`chatgpt`,label:i(`codexLoginChatGPT`),hint:i(`codexLoginChatGPTHint`),disabled:H||!!L.current}]}):null,R?.provider===`kiro`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(tr,{ariaLabel:i(`kiroLoginMethod`),columns:2,value:ke,onChange:e=>{H||Ae(e)},options:[{value:`builder_id`,label:i(`kiroLoginBuilder`),hint:i(`kiroLoginBuilderHint`),disabled:H||!!L.current},{value:`idc`,label:i(`kiroLoginIDC`),hint:i(`kiroLoginIDCHint`),disabled:H||!!L.current},{value:`sso`,label:i(`kiroLoginSSO`),hint:i(`kiroLoginSSOHint`),disabled:H||!!L.current},{value:`microsoft`,label:i(`kiroLoginMicrosoft`),hint:i(`kiroLoginMicrosoftHint`),disabled:H||!!L.current}]}),ke===`idc`?(0,Z.jsx)(J,{label:i(`kiroIDCStartURL`),children:(0,Z.jsx)(D,{value:I,onChange:e=>je(e.target.value),placeholder:i(`kiroIDCStartURLPh`),"aria-label":i(`kiroIDCStartURL`),disabled:H})}):null]}):null,P?(0,Z.jsxs)(`div`,{className:`card rounded-xl bg-surface px-3 py-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,Z.jsx)(zr,{phase:A,busy:H,tab:p,forTab:`browser`}),(0,Z.jsx)(`span`,{className:`text-muted`,children:M||i(`loginOpenMsg`)})]}),(0,Z.jsx)(`code`,{className:`mono mt-2 block break-all text-caption leading-5 text-foreground`,children:P}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,onPress:()=>window.open(P,`_blank`,`noopener,noreferrer`),children:[(0,Z.jsx)(c,{size:14}),i(`openAuthUrl`)]}),(0,Z.jsxs)(S,{size:`sm`,variant:`ghost`,onPress:()=>{f(P).then(e=>{e&&(we(!0),window.setTimeout(()=>we(!1),1100))})},children:[(0,Z.jsx)(a,{copied:Ce}),i(Ce?`copied`:`copy`)]})]})]}):null,M&&!P?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[U?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:U?`font-medium text-foreground`:`text-muted`,children:M})]}):null,qe?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:i(`wizardCallbackLead`)}),(0,Z.jsx)(s,{className:`h-28 w-full resize-none font-mono text-caption leading-5`,value:Te,onChange:e=>F(e.target.value),placeholder:i(`wizardCallbackPh`),"aria-label":i(`wizardCallbackPh`),disabled:U}),(0,Z.jsx)(S,{size:`sm`,variant:`secondary`,isPending:A===`busy`&&!!Te.trim(),onPress:()=>void ot(),isDisabled:U,children:i(`wizardSubmitCallback`)})]}):null]}):p===`pat`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(J,{label:i(`tabPat`),children:(0,Z.jsx)(D,{type:`password`,value:T,onChange:e=>se(e.target.value),placeholder:i(`wizardPatPh`),"aria-label":i(`wizardPatPh`),disabled:H})}),M?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[U?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:U?`font-medium text-foreground`:`text-muted`,children:M})]}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:`JSON`}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,onPress:dt,isDisabled:H,children:[(0,Z.jsx)(Ut,{size:13}),i(`wizardChooseFile`)]}),(0,Z.jsx)(`input`,{ref:Be,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:ft})]}),(0,Z.jsx)(s,{className:`min-h-32 font-mono text-caption`,value:ce,onChange:e=>le(e.target.value),placeholder:i(`wizardImportPh`),"aria-label":i(`tabImport`),disabled:H}),M?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[U?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:U?`font-medium text-foreground`:`text-muted`,children:M})]}):null]})})]})]})})}),(0,Z.jsxs)(O.Footer,{className:`justify-end gap-2 px-5 pb-5`,children:[(0,Z.jsx)(S,{variant:`ghost`,onPress:G,isDisabled:H,children:i(`cancel`)}),o===`login`&&mt?(0,Z.jsx)(S,{isPending:A===`busy`,onPress:()=>void st(),isDisabled:U,children:U?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`wizardAccountReady`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ge,{size:15}),i(`zhipuCreate`)]})}):null,o===`login`&&ht?(0,Z.jsx)(S,{isPending:A===`busy`,onPress:()=>void lt(),isDisabled:U,children:U?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`wizardAccountReady`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ge,{size:15}),i(`doubaoImport`)]})}):null,o===`login`&&!mt&&!ht&&p===`browser`?(0,Z.jsx)(S,{isPending:pt(`browser`),onPress:()=>void K(),isDisabled:U,children:U?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`wizardAccountReady`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ne,{size:15}),i(`wizardStartBrowser`)]})}):null,o===`login`&&!mt&&!ht&&p===`pat`?(0,Z.jsx)(S,{isPending:pt(`pat`),onPress:()=>void ct(),isDisabled:U,children:U?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`patDone`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ge,{size:15}),i(`wizardCreateAndLogin`)]})}):null,o===`login`&&!mt&&!ht&&p===`import`?(0,Z.jsx)(S,{isPending:pt(`import`),onPress:()=>void ut(),isDisabled:U,children:U?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`accountImported`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ut,{size:15}),i(`importCredential`)]})}):null]})]})})})})}var Ur=2e4,Wr=45e3,Gr=1e4;function Kr(e){let t=[],n=e.replace(/\r\n/g,` +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./CaiaiSoftLink-c1QhARkW.js";import{t as u}from"./CaretRight.es-DLLkzlqU.js";import{n as d,t as f}from"./clipboard-ADnALjHx.js";import{i as p,n as m,r as ee,t as h}from"./SearchBar-7OerD-fU.js";import{t as te}from"./Plus.es-DsoFTrCh.js";import{t as ne}from"./ShieldCheck.es-DUiHamsh.js";import{t as g}from"./TrashSimple.es-KG9lGXYp.js";import{H as _,I as v,Z as y,n as re,nt as b,pt as x,r as S}from"./useI18n-BAo1UrJW.js";import{B as C,F as ie,J as w,M as ae,N as oe,c as T,j as se,q as ce,s as le,z as E}from"./SharedElementTransition-BlCsXfb1.js";import{f as ue,t as de}from"./label-DYYRLGoV.js";import{n as fe,t as pe}from"./PageAlert-4fxVtrfI.js";import{t as me}from"./ConfirmDialog-BzgkrQpc.js";import{n as he}from"./useToggle-DpH7h_oD.js";import{t as ge}from"./description-CmJDGGCw.js";import{t as _e}from"./EmptyPanel-Bs-jQMvG.js";import{t as D}from"./input-BwBv1RBO.js";import{t as ve}from"./list-box-DbrQLYNo.js";import{t as O}from"./modal-6BQxrL1y.js";import{n as ye,t as k}from"./number-field-BQgq-gwR.js";import{t as be}from"./select-DnqAZzCR.js";import{t as A}from"./CompactSwitch-D0aW-Phm.js";import{d as j,f as M}from"./format-BAkFbjAh.js";import{o as N}from"./Input-C__Dw9HK.js";import{C as P,E as xe,F as Se,S as Ce,T as we,_ as Te,a as F,b as Ee,c as De,d as Oe,f as ke,i as Ae,j as I,k as je,l as Me,m as Ne,o as Pe,p as Fe,r as Ie,s as Le,u as L,v as Re,x as ze,y as Be}from"./overview-ARhe2pSk.js";import{t as Ve}from"./textfield-CjoS-G9O.js";import{t as R}from"./form-D5ELq0ds.js";import{t as z}from"./gsap-DWxn8li7.js";import{Gt as He,Ht as B,J as Ue,K as We,Lt as Ge,N as V,Ot as Ke,S as qe,T as H,Vt as Je,X as U,Y as Ye,_ as Xe,a as Ze,bt as W,j as Qe,k as G,kt as $e,m as et,q as tt,t as K,v as nt,y as rt}from"./index-CWTBzWuK.js";import{t as it}from"./FilterToggle-CbYR8o3t.js";import{t as at}from"./ProviderMark-C49bIWJW.js";import{n as ot,t as st}from"./provider-BZvt2HHB.js";import{a as ct,c as lt,d as ut,f as dt,h as ft,i as pt,l as mt,m as ht,n as gt,o as _t,p as vt,r as yt,s as bt,t as xt,u as q}from"./account-DCxVMo7p.js";import{t as J}from"./FormRow-CqpQhYrN.js";var Y=t(e(),1),St=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,28H188V24a12,12,0,0,0-24,0v4H92V24a12,12,0,0,0-24,0v4H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28ZM68,52a12,12,0,0,0,24,0h72a12,12,0,0,0,24,0h16V76H52V52ZM52,204V100H204V204Zm120.49-84.49a12,12,0,0,1,0,17l-48,48a12,12,0,0,1-17,0l-24-24a12,12,0,0,1,17-17L116,159l39.51-39.52A12,12,0,0,1,172.49,119.51Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V88H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Zm-38.34-85.66a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L116,164.69l42.34-42.35A8,8,0,0,1,169.66,122.34Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM169.66,133.66l-48,48a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L116,164.69l42.34-42.35a8,8,0,0,1,11.32,11.32ZM48,80V48H72v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,34H182V24a6,6,0,0,0-12,0V34H86V24a6,6,0,0,0-12,0V34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H74V56a6,6,0,0,0,12,0V46h84V56a6,6,0,0,0,12,0V46h26a2,2,0,0,1,2,2V82H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V94H210V208A2,2,0,0,1,208,210Zm-39.76-86.24a6,6,0,0,1,0,8.48l-48,48a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L116,167.51l43.76-43.75A6,6,0,0,1,168.24,123.76Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Zm-38.34-85.66a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L116,164.69l42.34-42.35A8,8,0,0,1,169.66,122.34Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,36H180V24a4,4,0,0,0-8,0V36H84V24a4,4,0,0,0-8,0V36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H76V56a4,4,0,0,0,8,0V44h88V56a4,4,0,0,0,8,0V44h28a4,4,0,0,1,4,4V84H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V92H212V208A4,4,0,0,1,208,212Zm-41.17-86.83a4,4,0,0,1,0,5.66l-48,48a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L116,170.34l45.17-45.17A4,4,0,0,1,166.83,125.17Z`}))]]),Ct=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),X=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,160H48l80-80Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z`}))]]),wt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M176,32V224a16,16,0,0,1-16,16H96a16,16,0,0,1-16-16V32A16,16,0,0,1,96,16h64A16,16,0,0,1,176,32Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM128,72a12,12,0,1,0-12-12A12,12,0,0,0,128,72Zm0,112a12,12,0,1,0,12,12A12,12,0,0,0,128,184Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M160,16H96A16,16,0,0,0,80,32V224a16,16,0,0,0,16,16h64a16,16,0,0,0,16-16V32A16,16,0,0,0,160,16ZM128,208a12,12,0,1,1,12-12A12,12,0,0,1,128,208Zm0-68a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm0-68a12,12,0,1,1,12-12A12,12,0,0,1,128,72Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M118,60a10,10,0,1,1,10,10A10,10,0,0,1,118,60Zm10,58a10,10,0,1,0,10,10A10,10,0,0,0,128,118Zm0,68a10,10,0,1,0,10,10A10,10,0,0,0,128,186Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128ZM128,72a12,12,0,1,0-12-12A12,12,0,0,0,128,72Zm0,112a12,12,0,1,0,12,12A12,12,0,0,0,128,184Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M120,60a8,8,0,1,1,8,8A8,8,0,0,1,120,60Zm8,60a8,8,0,1,0,8,8A8,8,0,0,0,128,120Zm0,68a8,8,0,1,0,8,8A8,8,0,0,0,128,188Z`}))]]),Tt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M228,144v64a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V144a12,12,0,0,1,24,0v52H204V144a12,12,0,0,1,24,0Zm-108.49,8.49a12,12,0,0,0,17,0l40-40a12,12,0,0,0-17-17L140,115V32a12,12,0,0,0-24,0v83L96.49,95.51a12,12,0,0,0-17,17Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V208H40V48A16,16,0,0,1,56,32H200A16,16,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40A8,8,0,0,0,168,96H136V32a8,8,0,0,0-16,0V96H88a8,8,0,0,0-5.66,13.66Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M222,144v64a6,6,0,0,1-6,6H40a6,6,0,0,1-6-6V144a6,6,0,0,1,12,0v58H210V144a6,6,0,0,1,12,0Zm-98.24,4.24a6,6,0,0,0,8.48,0l40-40a6,6,0,0,0-8.48-8.48L134,129.51V32a6,6,0,0,0-12,0v97.51L92.24,99.76a6,6,0,0,0-8.48,8.48Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M220,144v64a4,4,0,0,1-4,4H40a4,4,0,0,1-4-4V144a4,4,0,0,1,8,0v60H212V144a4,4,0,0,1,8,0Zm-94.83,2.83a4,4,0,0,0,5.66,0l40-40a4,4,0,1,0-5.66-5.66L132,134.34V32a4,4,0,0,0-8,0V134.34L90.83,101.17a4,4,0,0,0-5.66,5.66Z`}))]]),Et=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M180.49,143.51a12,12,0,0,1,0,17l-24,24a12,12,0,0,1-17-17L155,152l-15.52-15.51a12,12,0,1,1,17-17Zm-64-24a12,12,0,0,0-17,0l-24,24a12,12,0,0,0,0,17l24,24a12,12,0,0,0,17-17L101,152l15.52-15.51A12,12,0,0,0,116.49,119.51ZM220,88V216a20,20,0,0,1-20,20H56a20,20,0,0,1-20-20V40A20,20,0,0,1,56,20h96a12,12,0,0,1,8.49,3.52l56,56A12,12,0,0,1,220,88ZM160,57V80h23Zm36,155V104H148a12,12,0,0,1-12-12V44H60V212Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M208,88H152V32Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M181.66,146.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32Zm-72-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L91.31,152l18.35-18.34A8,8,0,0,0,109.66,122.34ZM216,88V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm40,136V96H152a8,8,0,0,1-8-8V40H56V216H200Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34Zm-104,88a8,8,0,0,1-11.32,11.32l-24-24a8,8,0,0,1,0-11.32l24-24a8,8,0,0,1,11.32,11.32L91.31,152Zm72-12.68-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32l24,24A8,8,0,0,1,181.66,157.66ZM152,88V44l44,44Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M180.24,147.76a6,6,0,0,1,0,8.48l-24,24a6,6,0,0,1-8.48-8.48L167.51,152l-19.75-19.76a6,6,0,1,1,8.48-8.48Zm-72-24a6,6,0,0,0-8.48,0l-24,24a6,6,0,0,0,0,8.48l24,24a6,6,0,1,0,8.48-8.48L88.49,152l19.75-19.76A6,6,0,0,0,108.24,123.76ZM214,88V216a14,14,0,0,1-14,14H56a14,14,0,0,1-14-14V40A14,14,0,0,1,56,26h96a6,6,0,0,1,4.25,1.76l56,56A6,6,0,0,1,214,88Zm-56-6h35.52L158,46.48Zm44,134V94H152a6,6,0,0,1-6-6V38H56a2,2,0,0,0-2,2V216a2,2,0,0,0,2,2H200A2,2,0,0,0,202,216Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M181.66,146.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L164.69,152l-18.35-18.34a8,8,0,0,1,11.32-11.32Zm-72-24a8,8,0,0,0-11.32,0l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L91.31,152l18.35-18.34A8,8,0,0,0,109.66,122.34ZM216,88V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31Zm40,136V96H152a8,8,0,0,1-8-8V40H56V216H200Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M178.83,149.17a4,4,0,0,1,0,5.66l-24,24a4,4,0,0,1-5.66-5.66L170.34,152l-21.17-21.17a4,4,0,1,1,5.66-5.66Zm-72-24a4,4,0,0,0-5.66,0l-24,24a4,4,0,0,0,0,5.66l24,24a4,4,0,1,0,5.66-5.66L85.66,152l21.17-21.17A4,4,0,0,0,106.83,125.17ZM212,88V216a12,12,0,0,1-12,12H56a12,12,0,0,1-12-12V40A12,12,0,0,1,56,28h96a4,4,0,0,1,2.83,1.17l56,56A4,4,0,0,1,212,88Zm-56-4h42.34L156,41.65Zm48,132V92H152a4,4,0,0,1-4-4V36H56a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H200A4,4,0,0,0,204,216Z`}))]]),Dt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M249.8,85.49l-116-64a12,12,0,0,0-11.6,0l-116,64a12,12,0,0,0,0,21l21.8,12v47.76a19.89,19.89,0,0,0,5.09,13.32C46.63,194.7,77,220,128,220a136.88,136.88,0,0,0,40-5.75V240a12,12,0,0,0,24,0V204.12a119.53,119.53,0,0,0,30.91-24.51A19.89,19.89,0,0,0,228,166.29V118.53l21.8-12a12,12,0,0,0,0-21ZM128,45.71,219.16,96,186,114.3a1.88,1.88,0,0,1-.18-.12l-52-28.69a12,12,0,0,0-11.6,21l39,21.49L128,146.3,36.84,96ZM128,196c-40.42,0-64.65-19.07-76-31.27v-33l70.2,38.74a12,12,0,0,0,11.6,0L168,151.64v37.23A110.46,110.46,0,0,1,128,196Zm76-31.27a93.21,93.21,0,0,1-12,10.81V138.39l12-6.62Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,113.07v53.22a8,8,0,0,1-2,5.31c-11.3,12.59-38.9,36.4-86,36.4s-74.68-23.81-86-36.4a8,8,0,0,1-2-5.31V113.07L128,160Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M251.76,88.94l-120-64a8,8,0,0,0-7.52,0l-120,64a8,8,0,0,0,0,14.12L32,117.87v48.42a15.91,15.91,0,0,0,4.06,10.65C49.16,191.53,78.51,216,128,216a130,130,0,0,0,48-8.76V240a8,8,0,0,0,16,0V199.51a115.63,115.63,0,0,0,27.94-22.57A15.91,15.91,0,0,0,224,166.29V117.87l27.76-14.81a8,8,0,0,0,0-14.12ZM128,200c-43.27,0-68.72-21.14-80-33.71V126.4l76.24,40.66a8,8,0,0,0,7.52,0L176,143.47v46.34C163.4,195.69,147.52,200,128,200Zm80-33.75a97.83,97.83,0,0,1-16,14.25V134.93l16-8.53ZM188,118.94l-.22-.13-56-29.87a8,8,0,0,0-7.52,14.12L171,128l-43,22.93L25,96,128,41.07,231,96Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M176,207.24a119,119,0,0,0,16-7.73V240a8,8,0,0,1-16,0Zm11.76-88.43-56-29.87a8,8,0,0,0-7.52,14.12L171,128l17-9.06Zm64-29.87-120-64a8,8,0,0,0-7.52,0l-120,64a8,8,0,0,0,0,14.12L32,117.87v48.42a15.91,15.91,0,0,0,4.06,10.65C49.16,191.53,78.51,216,128,216a130,130,0,0,0,48-8.76V130.67L171,128l-43,22.93L43.83,106l0,0L25,96,128,41.07,231,96l-18.78,10-.06,0L188,118.94a8,8,0,0,1,4,6.93v73.64a115.63,115.63,0,0,0,27.94-22.57A15.91,15.91,0,0,0,224,166.29V117.87l27.76-14.81a8,8,0,0,0,0-14.12Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M250.82,90.71l-120-64a5.94,5.94,0,0,0-5.64,0l-120,64a6,6,0,0,0,0,10.58L34,116.67v49.62a14,14,0,0,0,3.55,9.32C50.42,189.94,79.29,214,128,214a127.21,127.21,0,0,0,50-9.73V240a6,6,0,0,0,12,0V198.35a113.18,113.18,0,0,0,28.45-22.75,13.91,13.91,0,0,0,3.55-9.31V116.67l28.82-15.38a6,6,0,0,0,0-10.58ZM128,202c-44,0-70-21.56-81.52-34.41a2,2,0,0,1-.48-1.3V123.07l79.18,42.22a6,6,0,0,0,5.64,0L178,140.13v51C165,197.35,148.45,202,128,202Zm82-35.71a2,2,0,0,1-.48,1.3A100.25,100.25,0,0,1,190,184.3V133.73l20-10.66Zm-22.15-45a6.27,6.27,0,0,0-1-.71l-56-29.86a6,6,0,0,0-5.64,10.58L175.25,128,128,153.2,20.75,96,128,38.8,235.25,96Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M251.76,88.94l-120-64a8,8,0,0,0-7.52,0l-120,64a8,8,0,0,0,0,14.12L32,117.87v48.42a15.91,15.91,0,0,0,4.06,10.65C49.16,191.53,78.51,216,128,216a130,130,0,0,0,48-8.76V240a8,8,0,0,0,16,0V199.51a115.63,115.63,0,0,0,27.94-22.57A15.91,15.91,0,0,0,224,166.29V117.87l27.76-14.81a8,8,0,0,0,0-14.12ZM128,200c-43.27,0-68.72-21.14-80-33.71V126.4l76.24,40.66a8,8,0,0,0,7.52,0L176,143.47v46.34C163.4,195.69,147.52,200,128,200Zm80-33.75a97.83,97.83,0,0,1-16,14.25V134.93l16-8.53ZM188,118.94l-.22-.13-56-29.87a8,8,0,0,0-7.52,14.12L171,128l-43,22.93L25,96,128,41.07,231,96Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M249.88,92.47l-120-64a4,4,0,0,0-3.76,0l-120,64a4,4,0,0,0,0,7.06L36,115.47v50.82a11.92,11.92,0,0,0,3,8c12.65,14.09,41,37.73,89,37.73,21,0,38.2-4.52,52-10.79V240a4,4,0,0,0,8,0V197.18a111.64,111.64,0,0,0,29-22.91,11.94,11.94,0,0,0,3-8V115.47l29.88-15.94a4,4,0,0,0,0-7.06ZM128,204c-44.83,0-71.25-22-83-35.08a3.92,3.92,0,0,1-1-2.63V119.73l82.12,43.8a4,4,0,0,0,3.76,0L180,136.8v55.53C166.58,199,149.39,204,128,204Zm84-37.71a4,4,0,0,1-1,2.64,103.32,103.32,0,0,1-23,19v-55.4l24-12.8Zm-24.59-42.51a4,4,0,0,0-1.53-1.44l-56-29.87a4,4,0,0,0-3.76,7.06L179.5,128,128,155.47,16.5,96,128,36.53,239.5,96Z`}))]]),Ot=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),kt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,44a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,44Zm0,168a72,72,0,1,1,72-72A72.08,72.08,0,0,1,128,212ZM164.49,99.51a12,12,0,0,1,0,17l-28,28a12,12,0,0,1-17-17l28-28A12,12,0,0,1,164.49,99.51ZM92,16A12,12,0,0,1,104,4h48a12,12,0,0,1,0,24H104A12,12,0,0,1,92,16Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,136a88,88,0,1,1-88-88A88,88,0,0,1,216,136Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,216ZM173.66,90.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32l40-40A8,8,0,0,1,173.66,90.34ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm45.66,61.66-40,40a8,8,0,0,1-11.32-11.32l40-40a8,8,0,0,1,11.32,11.32ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,42a94,94,0,1,0,94,94A94.11,94.11,0,0,0,128,42Zm0,176a82,82,0,1,1,82-82A82.1,82.1,0,0,1,128,218ZM172.24,91.76a6,6,0,0,1,0,8.48l-40,40a6,6,0,1,1-8.48-8.48l40-40A6,6,0,0,1,172.24,91.76ZM98,16a6,6,0,0,1,6-6h48a6,6,0,0,1,0,12H104A6,6,0,0,1,98,16Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,216ZM173.66,90.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32l40-40A8,8,0,0,1,173.66,90.34ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,44a92,92,0,1,0,92,92A92.1,92.1,0,0,0,128,44Zm0,176a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,220ZM170.83,93.17a4,4,0,0,1,0,5.66l-40,40a4,4,0,1,1-5.66-5.66l40-40A4,4,0,0,1,170.83,93.17ZM100,16a4,4,0,0,1,4-4h48a4,4,0,0,1,0,8H104A4,4,0,0,1,100,16Z`}))]]),At=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M228,144v64a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V144a12,12,0,0,1,24,0v52H204V144a12,12,0,0,1,24,0ZM96.49,80.49,116,61v83a12,12,0,0,0,24,0V61l19.51,19.52a12,12,0,1,0,17-17l-40-40a12,12,0,0,0-17,0l-40,40a12,12,0,1,0,17,17Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M216,48V208H40V48A16,16,0,0,1,56,32H200A16,16,0,0,1,216,48Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM88,80h32v64a8,8,0,0,0,16,0V80h32a8,8,0,0,0,5.66-13.66l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,88,80Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M222,144v64a6,6,0,0,1-6,6H40a6,6,0,0,1-6-6V144a6,6,0,0,1,12,0v58H210V144a6,6,0,0,1,12,0ZM92.24,76.24,122,46.49V144a6,6,0,0,0,12,0V46.49l29.76,29.75a6,6,0,0,0,8.48-8.48l-40-40a6,6,0,0,0-8.48,0l-40,40a6,6,0,0,0,8.48,8.48Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M220,144v64a4,4,0,0,1-4,4H40a4,4,0,0,1-4-4V144a4,4,0,0,1,8,0v60H212V144a4,4,0,0,1,8,0ZM90.83,74.83,124,41.66V144a4,4,0,0,0,8,0V41.66l33.17,33.17a4,4,0,1,0,5.66-5.66l-40-40a4,4,0,0,0-5.66,0l-40,40a4,4,0,0,0,5.66,5.66Z`}))]]),jt=new Map([[`bold`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M168.49,104.49,145,128l23.52,23.51a12,12,0,0,1-17,17L128,145l-23.51,23.52a12,12,0,0,1-17-17L111,128,87.51,104.49a12,12,0,0,1,17-17L128,111l23.51-23.52a12,12,0,0,1,17,17ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z`}))],[`duotone`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),Y.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`fill`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,130.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32L139.31,128Z`}))],[`light`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M164.24,100.24,136.48,128l27.76,27.76a6,6,0,1,1-8.48,8.48L128,136.48l-27.76,27.76a6,6,0,0,1-8.48-8.48L119.52,128,91.76,100.24a6,6,0,0,1,8.48-8.48L128,119.52l27.76-27.76a6,6,0,0,1,8.48,8.48ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z`}))],[`thin`,Y.createElement(Y.Fragment,null,Y.createElement(`path`,{d:`M162.83,98.83,133.66,128l29.17,29.17a4,4,0,0,1-5.66,5.66L128,133.66,98.83,162.83a4,4,0,0,1-5.66-5.66L122.34,128,93.17,98.83a4,4,0,0,1,5.66-5.66L128,122.34l29.17-29.17a4,4,0,1,1,5.66,5.66ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),Mt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:St}));Mt.displayName=`CalendarCheckIcon`;var Nt=Mt,Pt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:Ct}));Pt.displayName=`CaretDownIcon`;var Ft=Pt,It=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:X}));It.displayName=`CaretUpIcon`;var Lt=It,Rt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:wt}));Rt.displayName=`DotsThreeVerticalIcon`;var zt=Rt,Bt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:Tt}));Bt.displayName=`DownloadSimpleIcon`;var Vt=Bt,Ht=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:Et}));Ht.displayName=`FileCodeIcon`;var Ut=Ht,Wt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:Dt}));Wt.displayName=`GraduationCapIcon`;var Gt=Wt,Kt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:Ot}));Kt.displayName=`PencilSimpleIcon`;var qt=Kt,Jt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:kt}));Jt.displayName=`TimerIcon`;var Yt=Jt,Xt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:At}));Xt.displayName=`UploadSimpleIcon`;var Zt=Xt,Qt=Y.forwardRef((e,t)=>Y.createElement(x,{ref:t,...e,weights:jt}));Qt.displayName=`XCircleIcon`;var $t=Qt,en=E({slots:{menu:`dropdown__menu`,popover:`dropdown__popover`,root:`dropdown`,trigger:`dropdown__trigger`}}),tn=E({defaultVariants:{color:`accent`,size:`md`},slots:{base:`meter`,fill:`meter__fill`,output:`meter__output`,track:`meter__track`},variants:{color:{accent:{base:`meter--accent`},danger:{base:`meter--danger`},default:{base:`meter--default`},success:{base:`meter--success`},warning:{base:`meter--warning`}},size:{lg:{base:`meter--lg`},md:{base:`meter--md`},sm:{base:`meter--sm`}}}}),nn=E({defaultVariants:{variant:`default`},slots:{indicator:`menu-item__indicator`,item:`menu-item`,submenuIndicator:`menu-item__indicator menu-item__indicator--submenu`},variants:{variant:{danger:{item:`menu-item--danger`},default:{item:`menu-item--default`}}}}),rn=E({base:`menu-section`});function an(e){let{value:t=0,minValue:n=0,maxValue:r=100,valueLabel:i,isIndeterminate:a,formatOptions:o={style:`percent`}}=e,s=ce(e,{labelable:!0}),{labelProps:c,fieldProps:l}=N({...e,labelElementType:`span`});t=b(t,n,r);let u=r-n,d=u===0?0:(t-n)/u,f=ye(o);if(!a&&!i){let e=o.style===`percent`?d:t;i=f.format(e)}return{progressBarProps:w(s,{...l,"aria-valuenow":a?void 0:t,"aria-valuemin":n,"aria-valuemax":r,"aria-valuetext":a?void 0:i,role:`progressbar`}),labelProps:c}}function on(e){let{progressBarProps:t,labelProps:n}=an(e);return{meterProps:{...t,role:`meter progressbar`},labelProps:n}}var sn=(0,Y.createContext)(null),cn=(0,Y.forwardRef)(function(e,t){[e,t]=se(e,t,sn);let{value:n=0,minValue:r=0,maxValue:i=100}=e;n=b(n,r,i);let a=i-r,[o,s]=oe(!e[`aria-label`]&&!e[`aria-labelledby`]),{meterProps:c,labelProps:l}=on({...e,label:s}),u=a===0?0:(n-r)/a*100,d=ae({...e,defaultClassName:`react-aria-Meter`,values:{percentage:u,valueText:c[`aria-valuetext`]}}),f=ce(e,{global:!0});return Y.createElement(ie.div,{...w(f,d,c),ref:t,slot:e.slot||void 0},Y.createElement(ue.Provider,{value:{...l,ref:o,elementType:`span`}},d.children))}),Z=n(),ln=(0,Y.createContext)({}),un=({children:e,className:t,variant:n,...r})=>{let i=Y.useMemo(()=>nn({variant:n}),[n]);return(0,Z.jsx)(tt,{className:T(t,i.item()),"data-slot":`menu-item`,...r,children:t=>(0,Z.jsx)(ln,{value:{slots:i,state:t},children:typeof e==`function`?e(t):e})})},dn=({children:e,className:t,type:n=`checkmark`,...r})=>{let{slots:i,state:a}=(0,Y.use)(ln),o=a?.isSelected,s=typeof e==`function`?e(a??{}):e||(n===`dot`?(0,Z.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`menu-item-indicator--dot`,fill:`currentColor`,fillRule:`evenodd`,role:`presentation`,viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,children:(0,Z.jsx)(`path`,{clipRule:`evenodd`,d:`M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14`,fillRule:`evenodd`})}):(0,Z.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`menu-item-indicator--checkmark`,fill:`none`,role:`presentation`,stroke:`currentColor`,strokeDasharray:22,strokeDashoffset:o?44:66,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 17 18`,children:(0,Z.jsx)(`polyline`,{points:`1 9 7 14 15 4`})}));return(0,Z.jsx)(C.span,{"aria-hidden":`true`,className:le(i?.indicator,t),"data-slot":`menu-item-indicator`,"data-type":n,"data-visible":o||void 0,...r,children:s})},fn=({children:e,className:t,...n})=>{let{slots:r,state:i}=(0,Y.use)(ln);if(!i?.hasSubmenu)return null;let a=e??(0,Z.jsx)(_,{});return(0,Z.jsx)(C.span,{"aria-hidden":`true`,className:le(r?.submenuIndicator,t),"data-slot":`submenu-indicator`,...n,children:a})},pn=({children:e,className:t,...n})=>{let r=Y.useMemo(()=>rn({class:typeof t==`string`?t:void 0}),[t]);return(0,Z.jsx)(Ue,{className:r,...n,children:e})},mn=(0,Y.createContext)({}),hn=({children:e,...t})=>{let n=Y.useMemo(()=>en(),[]);return(0,Z.jsx)(mn,{value:{slots:n},children:(0,Z.jsx)(We,{...t,children:e})})},gn=({children:e,className:t,...n})=>{let{slots:r}=(0,Y.use)(mn);return(0,Z.jsx)(y,{className:T(t,r?.trigger()),"data-slot":`dropdown-trigger`,...n,children:t=>(0,Z.jsx)(Z.Fragment,{children:typeof e==`function`?e(t):e})})},_n=({children:e,className:t,placement:n,...r})=>{let{slots:i}=(0,Y.use)(mn);return(0,Z.jsx)(v,{value:{variant:`default`},children:(0,Z.jsx)(W,{...r,className:T(t,i?.popover()),"data-slot":`dropdown-popover`,placement:n,children:e})})};function vn({className:e,...t}){let{slots:n}=(0,Y.use)(mn);return(0,Z.jsx)(Ye,{className:T(e,n?.menu()),"data-selection-mode":t.selectionMode,"data-slot":`dropdown-menu`,...t})}var yn=Object.assign(hn,{Root:hn,Trigger:gn,Popover:_n,Menu:vn,Section:e=>(0,Z.jsx)(pn,{...e}),Item:e=>(0,Z.jsx)(un,{...e}),ItemIndicator:e=>(0,Z.jsx)(dn,{...e}),SubmenuIndicator:e=>(0,Z.jsx)(fn,{...e}),SubmenuTrigger:({children:e,...t})=>(0,Z.jsx)(U,{"data-slot":`dropdown-submenu-trigger`,...t,children:e})}),bn=(0,Y.createContext)({}),xn=({children:e,className:t,color:n,size:r,...i})=>{let a=Y.useMemo(()=>tn({color:n,size:r}),[n,r]);return(0,Z.jsx)(cn,{"data-slot":`meter`,...i,className:T(t,a.base()),children:t=>(0,Z.jsx)(bn,{value:{slots:a,state:t},children:typeof e==`function`?e(t):e})})};xn.displayName=`HeroUI.Meter`;var Sn=({children:e,className:t,...n})=>{let{slots:r,state:i}=(0,Y.use)(bn);return(0,Z.jsx)(C.span,{className:le(r?.output,t),"data-slot":`meter-output`,...n,children:e??i?.valueText})};Sn.displayName=`HeroUI.Meter.Output`;var Cn=({children:e,className:t,...n})=>{let{slots:r}=(0,Y.use)(bn);return(0,Z.jsx)(C.div,{className:le(r?.track,t),"data-slot":`meter-track`,...n,children:e})};Cn.displayName=`HeroUI.Meter.Track`;var wn=({className:e,style:t,...n})=>{let{slots:r,state:i}=(0,Y.use)(bn);return(0,Z.jsx)(C.div,{className:le(r?.fill,e),"data-slot":`meter-fill`,style:{...t,width:`${i?.percentage??0}%`},...n})};wn.displayName=`HeroUI.Meter.Fill`;var Tn=Object.assign(xn,{Root:xn,Output:Sn,Track:Cn,Fill:wn}),En=()=>()=>{},Dn=new Set,On=Date.now(),kn=null;function An(){On=Date.now();for(let e of Dn)e()}function jn(e){return Dn.size===0&&(On=Date.now()),Dn.add(e),kn===null&&(kn=window.setInterval(An,1e3)),()=>{Dn.delete(e),Dn.size===0&&kn!==null&&(window.clearInterval(kn),kn=null)}}function Mn(){return On}function Nn(e=!0){return(0,Y.useSyncExternalStore)(e?jn:En,Mn,Mn)}function Pn(e,t){let n=e??0;return Number.isFinite(n)?`$${n.toFixed(t)}`:`—`}function Fn(e){let t=e?.overage_capability?.trim().toUpperCase()??``;return t===``||t===`OVERAGE_CAPABLE`}function In({quota:e,writable:t,pulling:n,switching:r,t:i,onPull:a,onToggle:o}){let s=e?.overage_status?.trim().toUpperCase()??``,c=Fn(e),l=s===`ENABLED`,u=i(s===`ENABLED`?`overageEnabled`:s===`DISABLED`?`overageDisabled`:`overageUnknown`),d=(e?.overage_cap??0)>0||(e?.overage_rate??0)>0||(e?.overage_current??0)>0,f=n||r;return(0,Z.jsxs)(`section`,{className:`mt-1.5 rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-caption font-medium text-foreground/80`,children:i(`overageTitle`)}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(S,{size:`sm`,variant:`secondary`,isPending:n,isDisabled:r,onPress:a,children:i(`overagePull`)}),(0,Z.jsx)(A,{isSelected:l,isDisabled:!c||!t||f,ariaLabel:i(`overageTitle`),onChange:o})]})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-caption leading-4 text-muted`,children:u}),d?(0,Z.jsx)(`p`,{className:`mono mt-1 text-caption leading-4 text-foreground/70`,children:i(`overageFigures`,{cap:Pn(e?.overage_cap,2),rate:Pn(e?.overage_rate,4),current:Pn(e?.overage_current,4)})}):null,c?t?(0,Z.jsx)(`p`,{className:`mt-1 text-caption leading-4 text-muted`,children:i(`overageHint`)}):(0,Z.jsx)(`p`,{className:`mt-1 text-caption leading-4 text-muted`,children:i(`overageReadOnly`)}):(0,Z.jsx)(`p`,{className:`mt-1 text-caption leading-4 text-danger`,children:i(`overageNotCapable`)})]})}function Ln(e){(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=z.context(()=>{z.matchMedia().add(`(prefers-reduced-motion: no-preference)`,()=>{let e=z.utils.toArray(`.meter__fill`);e.length&&z.from(e,{scaleX:0,transformOrigin:`left center`,duration:nt.calm,ease:rt.emphasized,stagger:qe.base,clearProps:`transform,transformOrigin`})})},t);return()=>n.revert()},[e])}var Rn=4;function zn(e,t,n,r,i,a){return[e.has_add_on&&e.add_on_available!==!1?`${n} ${ct(e.add_on_used)} / ${ct(e.add_on_total)} ${e.add_on_unit||`credits`}`:``,e.has_resource_package&&e.resource_package_available!==!1?`${r} ${t} ${ct(e.resource_package_remaining)} ${e.resource_package_unit||`credits`}`:``,a===`workbuddy`?bt(e,i):``].filter(Boolean)}function Bn(e,t,n){let r=e.total??0;if(!Number.isFinite(r)||r<=0)return``;let i=e.used??0,a=e.remaining??Math.max(0,r-i),o=e.unit||`credits`;return`${n} ${ct(a)} · ${t} ${ct(i)} / ${ct(r)} ${o}`}function Vn({window:e,t,extra:n,amountLine:r,resetAt:i}){let a=Math.round(e.percentage??0),o=dt(e,t),s=t(`quotaUsedPercent`,{n:a}),c=mt(i,t),l=`${o} · ${s}${r?` · ${r}`:``}${c?` · ${c}`:``}`,u=ut(e),d=q(e),f=d===`danger`?`danger`:d===`warn`?`warning`:`success`;return(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{className:`block w-full min-w-0`,children:(0,Z.jsxs)(`div`,{className:`w-full min-w-0 cursor-help`,children:[(0,Z.jsxs)(Tn,{className:`account-meter account-meter--window w-full`,color:f,size:`md`,minValue:0,maxValue:100,value:Math.round(u*100),"aria-label":o,valueLabel:l,children:[(0,Z.jsxs)(Tn.Output,{className:`flex w-full items-baseline justify-between gap-3 text-caption`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:o}),(0,Z.jsx)(`span`,{className:`mono shrink-0 text-foreground/70`,children:s})]}),(0,Z.jsx)(Tn.Track,{children:(0,Z.jsx)(Tn.Fill,{})})]}),r?(0,Z.jsx)(`div`,{className:`mono mt-1 truncate text-caption leading-4 text-foreground/70 tabular-nums`,children:r}):null,c?(0,Z.jsx)(`div`,{className:`mt-1 text-caption leading-4 text-muted`,children:c}):null]})}),(0,Z.jsx)(G.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(`div`,{children:l}),n?.map(e=>(0,Z.jsx)(`div`,{children:e},e))]})})]})}function Hn({quota:e,t,label:n,usedLabel:r,remainingLabel:i,addOnLabel:a,resourcePackageLabel:o,exceededLabel:s,provider:c}){let l=e.unit||`credits`,u=`${ct(e.used)} / ${ct(e.total)}`,d=`${ct(e.remaining)}`,f=zn(e,i,a,o,t,c),p=vt(e),m=c===`codearts`,ee=e.period_end_date||(m?p.find(e=>/^\d{4}-\d{2}-\d{2}$/.test(e.reset_at??``))?.reset_at:void 0),[h,te]=(0,Y.useState)(!1),ne=h?p:p.slice(0,Rn),g=Math.max(0,p.length-Rn),_=c===`codex`||c===`kiro`?yt(e.plan):``,v=ut(e),y=q(e),re=y===`danger`?`danger`:y===`warn`?`warning`:`success`,b=(0,Y.useRef)(null);Ln(b);let x=`${r} ${u} ${l} · ${i} ${d} ${l}${f.length?` · ${f.join(` · `)}`:``}`;return p.length>0?(0,Z.jsxs)(`div`,{ref:b,className:`account-quota-windows flex w-full min-w-0 flex-col gap-3`,children:[m&&(ee||e.expiring_soon_credits!=null)&&(0,Z.jsxs)(`div`,{className:`text-caption text-muted`,children:[ee&&(0,Z.jsx)(`div`,{children:t(`quotaPeriodEndDate`,{date:ee})}),e.expiring_soon_credits!=null&&(0,Z.jsx)(`div`,{className:`tabular-nums`,children:t(`quotaExpiringSoonCredits`,{amount:e.expiring_soon_credits})})]}),_?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-caption`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:t(`quotaPlan`)}),(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:_})]}):null,ne.map((e,n)=>(0,Z.jsx)(`div`,{className:`w-full min-w-0`,children:(0,Z.jsx)(Vn,{window:e,t,resetAt:m?void 0:e.reset_at,extra:n===0?f:void 0,amountLine:c===`kiro`?Bn(e,r,i):void 0})},e.id||String(n))),g>0?(0,Z.jsxs)(S,{size:`sm`,variant:`ghost`,className:`mx-auto -my-1 min-w-0 px-2 text-caption text-muted`,"aria-expanded":h,onPress:()=>te(e=>!e),children:[h?(0,Z.jsx)(Lt,{size:13}):(0,Z.jsx)(Ft,{size:13}),t(h?`quotaWindowsCollapse`:`quotaWindowsExpand`,{count:g})]}):null]}):(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(`div`,{ref:b,className:`w-full cursor-help`,children:(0,Z.jsxs)(Tn,{className:`account-meter w-full`,color:re,size:`md`,minValue:0,maxValue:100,value:Math.round(v*100),"aria-label":n,valueLabel:x,children:[(0,Z.jsxs)(Tn.Output,{className:`flex w-full items-baseline justify-between text-caption`,children:[(0,Z.jsxs)(`span`,{className:`text-body font-semibold leading-5 text-foreground tabular-nums`,children:[e.exceeded?(0,Z.jsx)(`span`,{className:`mr-1.5 text-danger`,children:s}):(0,Z.jsx)(`span`,{className:`mr-1.5 text-caption font-normal text-muted`,children:i}),d,(0,Z.jsx)(`span`,{className:`ml-1 text-caption font-normal text-foreground/60`,children:l})]}),(0,Z.jsxs)(`span`,{className:`mono text-foreground/55`,children:[u,` · `,Math.round(v*100),`%`]})]}),(0,Z.jsx)(Tn.Track,{children:(0,Z.jsx)(Tn.Fill,{})})]})})}),(0,Z.jsx)(G.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsxs)(`div`,{children:[r,` `,u,` `,l]}),(0,Z.jsxs)(`div`,{children:[i,` `,d,` `,l]}),f.map(e=>(0,Z.jsx)(`div`,{children:e},e))]})})]})}function Un({state:e,stateCopy:t,t:n}){let r=(0,Y.useRef)(null),i=ht(e),a=ft(e);return(0,Y.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=z.context(()=>{let e=z.utils.toArray(`[data-runtime-seg]`),t=e.filter((e,t)=>tt>=i),r=z.matchMedia();r.add(`(prefers-reduced-motion: reduce)`,()=>{z.set(t,{scaleY:1,autoAlpha:1}),z.set(n,{scaleY:.32,autoAlpha:.45})}),r.add(`(prefers-reduced-motion: no-preference)`,()=>{z.set(e,{transformOrigin:`center bottom`}),z.to(n,{scaleY:.32,autoAlpha:.45,duration:nt.fast,ease:rt.out,overwrite:!0}),z.to(t,{scaleY:1,autoAlpha:1,duration:nt.base,ease:rt.out,stagger:{amount:.08,from:`start`},overwrite:!0})})},e);return()=>t.revert()},[i,e]),(0,Z.jsx)(`div`,{ref:r,className:`flex items-center`,children:(0,Z.jsx)(`div`,{className:`runtime-meter min-w-[80px] flex-1`,"data-quiet":a===`ok`?`true`:void 0,role:`meter`,"aria-label":n(`runtimeState`),"aria-valuemin":0,"aria-valuemax":12,"aria-valuenow":i,"aria-valuetext":t,children:Array.from({length:12},(e,t)=>(0,Z.jsx)(`span`,{"data-runtime-seg":!0,"data-on":t{if(T)return Te.current&&window.clearTimeout(Te.current),Te.current=window.setTimeout(()=>Se(T),3e3),()=>{Te.current&&window.clearTimeout(Te.current)}},[T]);let De=Kn(j,j===`dead`?N:M,u),Oe=j===`hot`||j===`ready`?`success`:j===`cooling`?`warning`:j===`quota_exhausted`||j===`login`||j===`unavailable`||j===`dead`||j===`auth_failed`?`danger`:void 0,ke=e.last_error||e.lastError,Ae=e.last_error_kind||e.kind,I=ot(e.provider,e.region,u),je=String(e.region||``).toLowerCase(),Me=je===`cn`?u(`regionCN`):je===`global`?u(`regionGlobal`):je===`go`?`Go`:je===`zen`?`Zen`:``,Ne=e.remote_uid||e.id,Pe=Ne.length>12?Ne.slice(0,8):Ne,Fe=e.last_checkin_status,Ie=Fe===`success`?`checkinRecordSuccess`:Fe===`already`?`checkinRecordAlready`:Fe===`pending`?`checkinStatusPending`:Fe===`unknown`?`checkinStatusUnknown`:Fe===`skipped`?`checkinRecordSkipped`:Fe===`error`?`checkinRecordFailed`:`lastCheckinNone`,Le=gt(e,C),L=e.checkin_time||e.checkin_auto_time||x,Re=C&&C!==`Local`?C:`Asia/Shanghai`,ze=e.last_checkin_synced_at?Wn(e.last_checkin_synced_at,Re):``;return(0,Y.useLayoutEffect)(()=>{let e=pe.current;if(!e)return;let t=be.current;if(be.current=j,!t||t===j)return;let n=z.context(()=>{let t=z.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{z.set(e,{scale:1,autoAlpha:1})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{z.fromTo(e,{scale:.94,autoAlpha:.65},{scale:1,autoAlpha:1,duration:.2,ease:`power2.out`,overwrite:!0})})},e);return()=>n.revert()},[j]),(0,Y.useLayoutEffect)(()=>{let e=me.current;if(!e||!n)return;let t=z.context(()=>{let t=z.matchMedia();t.add(`(prefers-reduced-motion: reduce)`,()=>{z.set(e,{autoAlpha:1,y:0})}),t.add(`(prefers-reduced-motion: no-preference)`,()=>{z.fromTo(e,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:.2,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[n]),(0,Z.jsxs)(he,{"data-gsap-reveal":!0,"data-state":j,className:`account-card overflow-hidden p-0`,children:[(0,Z.jsxs)(he.Header,{className:`flex-row items-start justify-between gap-2.5 px-4 pt-3.5 pb-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Z.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-tertiary`,title:I,children:(0,Z.jsx)(at,{provider:e.provider,size:20})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(he.Title,{className:`truncate text-body leading-5`,children:e.name||e.id}),Me?(0,Z.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-secondary px-1.5 py-px text-caption text-muted`,title:I,children:Me}):null]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Z.jsx)(he.Description,{className:`mono truncate text-caption leading-4 text-foreground/60`,title:`${e.id}${e.remote_uid?` · UID ${e.remote_uid}`:``}`,children:Pe}),(0,Z.jsx)(S,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`size-5 min-w-0 shrink-0 text-muted`,"aria-label":u(ve?`copied`:`copy`),onPress:()=>{f(Ne).then(e=>{e&&(O(!0),window.setTimeout(()=>O(!1),1100))})},children:(0,Z.jsx)(a,{copied:ve,size:12})})]})]})]}),(0,Z.jsxs)(`div`,{className:`flex max-w-[48%] shrink-0 flex-wrap justify-end gap-1.5`,children:[(0,Z.jsx)(`span`,{ref:pe,children:P.length&&j===`cooling`?(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,Z.jsx)(V,{size:`sm`,variant:`soft`,color:Oe,children:De})})}),(0,Z.jsx)(G.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:u(`partialCooling`)}),P.map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`span`,{className:`mono text-foreground/65`,children:pt(t)})]},e))]})})]}):(0,Z.jsx)(V,{size:`sm`,variant:`soft`,color:Oe,children:De})}),P.length&&j!==`cooling`?(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(`span`,{className:`inline-flex cursor-help`,children:(0,Z.jsx)(V,{size:`sm`,variant:`soft`,color:`warning`,children:u(`partialCooling`)})})}),(0,Z.jsx)(G.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:u(`partialCooling`)}),P.map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-caption`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`span`,{className:`mono text-foreground/65`,children:pt(t)})]},e))]})})]}):null]})]}),(0,Z.jsxs)(he.Content,{className:`gap-1.5 px-4 pb-3`,children:[(0,Z.jsx)(Un,{state:j,stateCopy:De,t:u}),lt(e.quota)&&e.quota?(0,Z.jsx)(Hn,{quota:e.quota,t:u,label:u(`quota`),usedLabel:u(`quotaUsed`),remainingLabel:u(`quotaRemaining`),addOnLabel:u(`quotaAddOn`),resourcePackageLabel:u(`quotaResourcePackage`),exceededLabel:u(`quotaExceeded`),provider:e.provider}):(0,Z.jsx)(`span`,{className:`text-caption text-foreground/65`,children:Gn(j,e.provider||``,je,u)}),e.provider===`kiro`&&E&&ue?(0,Z.jsx)(In,{quota:e.quota,writable:fe,pulling:t===`overage-pull`,switching:t===`overage-switch`,t:u,onPull:E,onToggle:ue}):null,ke?(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsxs)(`div`,{className:`flex w-full cursor-help gap-2 rounded-lg bg-surface-secondary p-2 text-left text-caption leading-5 text-foreground`,children:[(0,Z.jsx)($e,{size:14,className:`mt-0.5 shrink-0 text-danger`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Ae?(0,Z.jsx)(`div`,{className:`mono mb-0.5 truncate text-caption opacity-75`,children:Ae}):null,(0,Z.jsx)(`p`,{className:`break-words line-clamp-3`,children:ke})]})]})}),(0,Z.jsx)(G.Content,{children:(0,Z.jsxs)(`div`,{className:`max-w-md whitespace-pre-wrap break-words`,children:[Ae?(0,Z.jsx)(`div`,{className:`mono mb-1 text-caption opacity-75`,children:Ae}):null,ke]})})]}):null,F?(0,Z.jsxs)(`div`,{className:`flex w-full items-start gap-2 rounded-lg bg-surface-secondary p-2 text-caption leading-5`,children:[F.kind===`success`?(0,Z.jsx)(B,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-success`}):F.kind===`error`?(0,Z.jsx)($t,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-danger`}):(0,Z.jsx)($e,{size:14,weight:`fill`,className:`mt-0.5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[F.kind===`success`?(0,Z.jsx)(`span`,{className:`font-medium text-success`,children:u(`checkinRecordSuccess`)}):F.kind===`already`?(0,Z.jsx)(`span`,{className:`font-medium text-warning`,children:u(`checkinRecordAlready`)}):F.kind===`skipped`?(0,Z.jsx)(`span`,{className:`font-medium text-warning`,children:u(`checkinRecordSkipped`)}):(0,Z.jsx)(`span`,{className:`font-medium text-danger`,children:u(`checkinRecordFailed`)}),F.message?(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[(0,Z.jsx)(`p`,{className:`break-words line-clamp-2 text-foreground/80`,children:F.message}),(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-caption text-muted`,children:u(`checkinTruncated`)}),(0,Z.jsxs)(S,{size:`sm`,variant:`ghost`,className:`h-6 min-w-0 gap-1 px-1.5 text-caption`,onPress:()=>{f(F.message||``).then(e=>{!e||!F||(we(F),window.setTimeout(()=>we(null),1100))})},children:[(0,Z.jsx)(a,{copied:Ee,size:13}),u(Ee?`copied`:`checkinCopyError`)]})]})]}):null]})]}):null]}),n&&e.enabled?(0,Z.jsx)(`section`,{ref:me,className:`grid gap-3 bg-surface-secondary/55 px-3 py-3`,children:e.provider===`doubaowork`?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:u(`doubaoCookieLabel`)}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-caption leading-5 text-muted`,children:u(`doubaoCookieLead`)}),(0,Z.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsxs)(Ve,{className:`flex-1`,type:`password`,value:l,onChange:p,children:[(0,Z.jsx)(de,{className:`sr-only`,children:u(`doubaoCookieLabel`)}),(0,Z.jsx)(D,{placeholder:u(`doubaoCookiePh`),"aria-label":u(`doubaoCookieLabel`)})]}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:t===`pat`,onPress:ee,children:[(0,Z.jsx)(Ge,{size:14}),u(`doubaoSaveCookie`)]})]}),o?(0,Z.jsx)(`p`,{className:`mt-1 text-caption text-muted`,children:o}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:u(`oauthDeviceFlow`)}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-caption leading-5 text-muted`,children:e.provider===`codex`?u(`wizardCodexBrowserLead`):u(`qoderLoginHint`)}),(0,Z.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:e.provider===`codex`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(S,{size:`sm`,isPending:t===`device`,onPress:()=>m(`cli`),children:[(0,Z.jsx)(ne,{size:14}),u(`startCodexCliLogin`)]}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`chatgpt`),children:[(0,Z.jsx)(ne,{size:14}),u(`startCodexChatGPTLogin`)]})]}):e.provider===`kiro`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(S,{size:`sm`,isPending:t===`device`,onPress:()=>m(`builder_id`),children:[(0,Z.jsx)(ne,{size:14}),u(`kiroLoginBuilder`)]}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`idc`),children:[(0,Z.jsx)(ne,{size:14}),u(`kiroLoginIDC`)]}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`microsoft`),children:[(0,Z.jsx)(ne,{size:14}),u(`kiroLoginMicrosoft`)]}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:t===`device`,onPress:()=>m(`sso`),children:[(0,Z.jsx)(ne,{size:14}),u(`kiroLoginSSO`)]})]}):(0,Z.jsxs)(S,{size:`sm`,isPending:t===`device`,onPress:()=>m(),children:[(0,Z.jsx)(ne,{size:14}),u(`startBrowserLogin`)]})}),(e.provider===`trae`||e.provider===`codex`||e.provider===`devin`||e.provider===`kiro`)&&_&&te?(0,Z.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:u(`wizardCallbackLead`)}),(0,Z.jsx)(s,{className:`h-24 w-full resize-none font-mono text-caption leading-5`,value:h||``,onChange:e=>te(e.target.value),placeholder:u(`wizardCallbackPh`),"aria-label":u(`wizardCallbackPh`)}),(0,Z.jsx)(S,{size:`sm`,variant:`secondary`,isPending:t===`callback`,onPress:_,children:u(`wizardSubmitCallback`)})]}):null]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:u(`patFallback`)}),(0,Z.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsxs)(Ve,{className:`flex-1`,type:`password`,value:l,onChange:p,children:[(0,Z.jsx)(de,{className:`sr-only`,children:u(`pat`)}),(0,Z.jsx)(D,{placeholder:u(`pasteToken`),"aria-label":u(`pat`)})]}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:t===`pat`,onPress:ee,children:[(0,Z.jsx)(Ge,{size:14}),u(`usePat`)]})]})]}),r||o?(0,Z.jsxs)(`div`,{className:`text-caption`,children:[r?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:u(`authUrl`)}),(0,Z.jsx)(`code`,{className:`mono block break-all text-foreground`,children:r}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,onPress:()=>window.open(r,`_blank`,`noopener,noreferrer`),children:[(0,Z.jsx)(c,{size:14}),u(`openAuthUrl`)]}),(0,Z.jsxs)(S,{size:`sm`,variant:`ghost`,onPress:()=>{f(r).then(e=>{e&&(_e(!0),window.setTimeout(()=>_e(!1),1100))})},children:[(0,Z.jsx)(a,{copied:ge}),u(ge?`copied`:`copy`)]})]})]}):null,o?(0,Z.jsx)(`p`,{className:`mt-1 text-muted`,children:o}):null]}):null]})}):null,w?(0,Z.jsxs)(`div`,{className:`mt-auto flex items-center justify-between gap-2 px-4 pb-2.5 text-caption text-muted`,children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 cursor-help flex-wrap items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-foreground/75`,children:u(`checkinStatus`)}),(0,Z.jsx)(`span`,{className:Fe===`error`?`text-danger`:``,children:u(Ie)}),!Le&&Fe===`pending`?(0,Z.jsx)(`span`,{className:`whitespace-nowrap rounded-full bg-warning/15 px-1.5 py-px font-medium text-warning`,children:u(`checkinPending`)}):null]})}),(0,Z.jsxs)(G.Content,{children:[e.last_checkin_at?u(`checkinServerTime`,{time:Wn(e.last_checkin_at,Re)}):u(`lastCheckinNone`),e.last_checkin_msg?` · ${e.last_checkin_msg}`:``,ze?` · ${u(`checkinUpstreamSynced`,{time:ze})}`:``]})]}),(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsxs)(`span`,{className:`flex shrink-0 cursor-help items-center gap-1.5 whitespace-nowrap`,children:[(0,Z.jsx)(`span`,{children:u(`checkinDaily`)}),(0,Z.jsx)(`span`,{className:`mono text-caption text-foreground/55`,children:L}),(0,Z.jsx)(A,{isSelected:!!e.auto_checkin,isDisabled:!!t,ariaLabel:u(`autoCheckin`),onChange:e=>ie?.(e)})]})}),(0,Z.jsxs)(G.Content,{children:[u(`checkinAutoScheduleHint`,{time:L??``}),` · ${u(`checkinServerClock`,{timezone:Re})}`]})]})]}):null,(0,Z.jsxs)(he.Footer,{className:`flex flex-nowrap items-center gap-1 bg-surface-secondary px-2 py-2${w?``:` mt-auto`}`,children:[y?(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(S,{isIconOnly:!0,size:`sm`,variant:`ghost`,isPending:t===`refresh`,onPress:y,"aria-label":u(`refreshAccount`),children:(0,Z.jsx)(He,{size:15})})}),(0,Z.jsx)(G.Content,{children:u(`refreshAccount`)})]}):null,(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(S,{isIconOnly:!0,size:`sm`,variant:n?`secondary`:`ghost`,isDisabled:!e.enabled,onPress:ce,"aria-label":u(`authentication`),children:(0,Z.jsx)(Ge,{size:15})})}),(0,Z.jsx)(G.Content,{children:u(`authentication`)})]}),(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(S,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:se,"aria-label":u(`editAccount`),children:(0,Z.jsx)(qt,{size:15})})}),(0,Z.jsx)(G.Content,{children:u(`editAccount`)})]}),ae?(0,Z.jsxs)(G,{children:[(0,Z.jsx)(G.Trigger,{children:(0,Z.jsx)(S,{isIconOnly:!0,size:`sm`,variant:`ghost`,isPending:t===`student-credit`,isDisabled:!e.enabled,onPress:ae,"aria-label":u(`claimStudentCredit`),children:(0,Z.jsx)(Gt,{size:15})})}),(0,Z.jsx)(G.Content,{children:u(`claimStudentCredit`)})]}):null,(0,Z.jsxs)(yn,{children:[(0,Z.jsx)(yn.Trigger,{children:(0,Z.jsxs)(S,{isIconOnly:!0,size:`sm`,variant:ye?`secondary`:`ghost`,isPending:t===`checkin`,"aria-label":u(`more`),className:`relative`,children:[(0,Z.jsx)(zt,{size:16}),P.length?(0,Z.jsx)(`span`,{className:`absolute top-1 right-1 size-1.5 rounded-full bg-warning`,"aria-hidden":!0}):null]})}),(0,Z.jsx)(yn.Popover,{placement:`bottom start`,children:(0,Z.jsxs)(yn.Menu,{"aria-label":u(`more`),disabledKeys:!e.enabled||t?[`checkin`]:[],onAction:e=>{e===`models`&&le(),e===`cooldowns`&&k(e=>!e),e===`checkin`&&w?.(),e===`checkin-records`&&oe?.(),e===`export`&&v(),e===`delete`&&re()},children:[(0,Z.jsxs)(yn.Item,{id:`models`,textValue:u(`accountModels`),children:[(0,Z.jsx)(Je,{size:15}),u(`accountModels`)]}),(0,Z.jsxs)(yn.Item,{id:`cooldowns`,textValue:u(`modelCooldowns`),children:[(0,Z.jsx)(Yt,{size:15,className:P.length?`text-warning`:void 0}),u(`modelCooldowns`),P.length?(0,Z.jsx)(`span`,{className:`mono ml-auto text-caption text-warning`,children:P.length}):null]}),w?(0,Z.jsxs)(yn.Item,{id:`checkin`,textValue:u(`checkinNow`),children:[(0,Z.jsx)(Nt,{size:15}),u(`checkinNow`)]}):null,oe?(0,Z.jsxs)(yn.Item,{id:`checkin-records`,textValue:u(`checkinRecords`),children:[(0,Z.jsx)(i,{size:15}),u(`checkinRecords`)]}):null,e.auth_type===`none`?null:(0,Z.jsxs)(yn.Item,{id:`export`,textValue:u(`export`),children:[(0,Z.jsx)(d,{size:15}),u(`export`)]}),(0,Z.jsxs)(yn.Item,{id:`delete`,textValue:u(`delete`),className:`text-danger`,children:[(0,Z.jsx)(g,{size:15}),u(`delete`)]})]})})]}),(0,Z.jsx)(`div`,{className:`ml-auto flex shrink-0 flex-nowrap items-center whitespace-nowrap`,children:(0,Z.jsx)(A,{isSelected:!!e.enabled,isDisabled:t===`toggle`,ariaLabel:e.enabled?u(`disable`):u(`enable`),label:e.enabled?u(`enabledState`):u(`disabled`),onChange:b})})]}),ye?(0,Z.jsxs)(`section`,{className:`border-t border-separator bg-surface-secondary/55 px-4 py-2.5`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:u(`modelCooldownsTitle`)}),(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:P.length})]}),P.length?(0,Z.jsx)(`div`,{className:`space-y-1`,children:P.map(([e,t])=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-surface px-2 py-1.5 text-caption`,children:[(0,Z.jsx)(`span`,{className:`mono min-w-0 truncate`,title:e,children:e}),(0,Z.jsx)(`span`,{className:`mono shrink-0 text-warning`,children:pt(t)})]},e))}):(0,Z.jsx)(`p`,{className:`text-caption text-muted`,children:u(`modelCooldownsEmpty`)})]}):null]})}function Jn(e,t){return e.status===`success`?{label:t(`checkinRecordSuccess`),color:`success`}:e.status===`already`?{label:t(`checkinRecordAlready`),color:`warning`}:e.status===`skipped`?{label:t(`checkinRecordSkipped`),color:`default`}:{label:t(`checkinRecordFailed`),color:`danger`}}function Yn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Xn({account:e,t,onClose:n}){let[r,i]=(0,Y.useState)([]),[a,o]=(0,Y.useState)(!!e?.id),[s,c]=(0,Y.useState)(``),l=e?.id||``,u=t(`checkinRecordsTitle`,{name:e?.name||e?.id||``});async function d(){if(l){o(!0),c(``);try{let e=await ke(l);i(e.data||[])}catch(e){i([]),c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}return(0,Y.useEffect)(()=>{l&&d()},[l]),(0,Z.jsx)(O.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,Z.jsx)(O.Backdrop,{variant:`blur`,children:(0,Z.jsx)(O.Container,{size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(O.Dialog,{children:[(0,Z.jsxs)(O.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(O.Heading,{className:`text-section font-semibold`,children:u}),(0,Z.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:t(`checkinRecordsHint`)})]}),(0,Z.jsx)(O.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ke,{size:16})})]}),(0,Z.jsxs)(O.Body,{className:`px-5 pb-2`,children:[s?(0,Z.jsx)(`div`,{className:`mb-3`,children:(0,Z.jsx)(pe,{title:s})}):null,a?(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,Z.jsx)(et,{className:`h-16 w-full`}),(0,Z.jsx)(et,{className:`h-16 w-full`}),(0,Z.jsx)(et,{className:`h-16 w-full`})]}):r.length?(0,Z.jsx)(`div`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(e=>{let n=Jn(e,t);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 px-3 py-3`,children:[(0,Z.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0`,"data-state":e.status===`error`?`warn`:`ok`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{size:`sm`,variant:`soft`,color:n.color,children:n.label}),(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:Yn(e.created_at)})]}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-caption leading-5 text-foreground/75`,children:e.message||`—`})]})]},e.id)})}):(0,Z.jsx)(_e,{className:`min-h-44 rounded-3xl bg-surface-secondary`,title:t(`checkinRecordsEmpty`),hint:t(`checkinRecordsHint`)})]}),(0,Z.jsxs)(O.Footer,{className:`justify-between px-5 pb-5`,children:[(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:t(`checkinRecordsCount`,{count:r.length})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(S,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:a,onPress:()=>void d(),children:[(0,Z.jsx)(He,{size:14}),t(`refresh`)]})]})]})]})})})})}function Zn(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function Qn({account:e,t,onClose:n}){let[r,i]=(0,Y.useState)([]),[a,o]=(0,Y.useState)(!!e?.id),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(1),[p,m]=(0,Y.useState)(20),[h,te]=(0,Y.useState)(0),[ne,g]=(0,Y.useState)(1),_=(0,Y.useRef)(0),v=e?.id||``,y=t(`accountModelsTitle`,{name:e?.name||e?.id||``}),re=e?ot(e.provider,e.region,t):``;async function b(e=1,t=p,n=!1){if(!v)return;let r=++_.current;n?c(!0):o(!0),u(``);try{let a=await(n?P(v,void 0,{page:e,pageSize:t}):Ne(v,!1,void 0,{page:e,pageSize:t})),o=a.data||[],s=a.pagination,c=s?.total??o.length,l=s?.total_pages??Math.max(1,Math.ceil(c/t)),u=Math.min(Math.max(1,s?.page??e),l);if(r!==_.current)return;i(s?o:o.slice((u-1)*t,u*t)),te(c),g(l),f(u)}catch(e){if(r!==_.current)return;i([]),te(0),g(1),u(e instanceof Error?e.message:String(e))}finally{r===_.current&&(o(!1),c(!1))}}(0,Y.useEffect)(()=>{v&&(f(1),b(1,p))},[v]);let x=h===0?0:(d-1)*p+1,C=h===0?0:Math.min(h,x+r.length-1);return(0,Z.jsx)(O.Root,{isOpen:!!e,onOpenChange:e=>{e||n()},children:(0,Z.jsx)(O.Backdrop,{variant:`blur`,children:(0,Z.jsx)(O.Container,{size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(O.Dialog,{children:[(0,Z.jsxs)(O.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(O.Heading,{className:`text-section font-semibold`,children:y}),(0,Z.jsx)(`p`,{className:`mt-1 text-caption font-normal leading-5 text-muted`,children:t(`accountModelsHint`)}),e?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-caption text-muted`,children:[(0,Z.jsx)(at,{provider:e.provider,size:14}),(0,Z.jsx)(`span`,{children:re}),(0,Z.jsx)(`span`,{className:`text-border`,children:`·`}),(0,Z.jsx)(`span`,{className:`mono`,children:e.id})]}):null]}),(0,Z.jsx)(O.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ke,{size:16})})]}),(0,Z.jsxs)(O.Body,{className:`px-5 pb-2`,children:[l?(0,Z.jsx)(`div`,{className:`mb-3`,children:(0,Z.jsx)(pe,{title:t(`accountModelsError`,{msg:l})})}):null,a||s?(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,Z.jsx)(et,{className:`h-14 w-full`}),(0,Z.jsx)(et,{className:`h-14 w-full`}),(0,Z.jsx)(et,{className:`h-14 w-full`})]}):r.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:r.map(n=>{let r=n.provider||n.owned_by||e?.provider||`qoder`,i=Zn(n),a=j(n),o=M(n);return(0,Z.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2.5`,children:[(0,Z.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":n.stale?void 0:`ok`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body font-medium`,children:n.display_name||n.id}),o?(0,Z.jsx)(V,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null,a?(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:a}):null,n.stale?(0,Z.jsx)(V,{size:`sm`,variant:`soft`,color:`warning`,children:t(`fallback`)}):null]}),(0,Z.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:n.id}),i?(0,Z.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:t(`routedTo`,{model:i})}):null]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 pt-0.5 text-caption text-muted`,children:[(0,Z.jsx)(at,{provider:r,size:12}),(0,Z.jsx)(`span`,{children:r})]})]},n.id)})}):(0,Z.jsx)(_e,{className:`min-h-48 rounded-3xl bg-surface-secondary`,icon:(0,Z.jsx)(Je,{size:22}),title:t(`accountModelsEmpty`),hint:t(`noModelsYet`)})]}),(0,Z.jsxs)(O.Footer,{className:`flex-col items-stretch gap-3 px-5 pb-5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:a?t(`refreshing`):t(`shownTotal`,{shown:h?`${x}–${C}`:0,total:h})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(S,{size:`sm`,variant:`ghost`,onPress:n,children:t(`close`)}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,isPending:s,onPress:()=>void b(1,p,!0),children:[(0,Z.jsx)(He,{size:14}),t(s?`refreshing`:`refresh`)]})]})]}),h>0?(0,Z.jsx)(ee,{total:h,page:d,pageCount:ne,pageSize:p,loading:a||s,pageSizeLabel:t(`logsPageSize`),pageLabel:t(`logsPage`,{page:d,pages:ne}),prevLabel:t(`logsPrevPage`),nextLabel:t(`logsNextPage`),onPage:e=>void b(e,p),onPageSize:e=>{m(e),b(1,e)}}):null]})]})})})})}function $n({account:e,busy:t,t:n,onClose:r,onSave:i}){let[a,o]=(0,Y.useState)(e?.name||``),[s,c]=(0,Y.useState)(e?.max_inflight??4),[l,u]=(0,Y.useState)(e?.priority??50),[d,f]=(0,Y.useState)(``),p=n(`editAccountTitle`,{name:e?.name||e?.id||``}),m=e?ot(e.provider,e.region,n):``;async function ee(e){e?.preventDefault();let t=a.trim();if(!t){f(n(`accountNameRequired`));return}if(!Number.isInteger(s)||s<1||s>32){f(n(`maxInflightInvalid`));return}if(!Number.isInteger(l)||l<1||l>100){f(n(`priorityInvalid`));return}f(``);try{await i({name:t,max_inflight:s,priority:l}),r()}catch(e){f(e instanceof Error?e.message:String(e))}}return(0,Z.jsx)(O.Root,{isOpen:!!e,onOpenChange:e=>{!e&&!t&&r()},children:(0,Z.jsx)(O.Backdrop,{variant:`blur`,children:(0,Z.jsx)(O.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(O.Dialog,{className:`w-full sm:w-[42rem] sm:max-w-[calc(100vw-2rem)]`,children:[(0,Z.jsxs)(O.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(O.Heading,{className:`text-section font-semibold`,children:p}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-body font-normal leading-6 text-muted`,children:n(`editAccountHint`)}),e?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{size:`sm`,variant:`soft`,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(at,{provider:e.provider,size:14}),(0,Z.jsx)(`span`,{children:m})]})}),(0,Z.jsx)(`span`,{className:`mono text-caption text-muted`,children:e.id})]}):null]}),(0,Z.jsx)(O.CloseTrigger,{isDisabled:t,"aria-label":n(`close`),className:`grid size-9 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,Z.jsx)(Ke,{size:18})})]}),(0,Z.jsxs)(O.Body,{className:`px-6 pb-2 pt-1`,children:[d?(0,Z.jsxs)(fe,{status:`danger`,className:`mb-4`,children:[(0,Z.jsx)(fe.Indicator,{}),(0,Z.jsx)(fe.Content,{children:(0,Z.jsx)(fe.Title,{children:d})})]}):null,(0,Z.jsxs)(R,{className:`space-y-4`,onSubmit:e=>void ee(e),children:[(0,Z.jsx)(J,{label:n(`accountName`),children:(0,Z.jsx)(D,{value:a,onChange:e=>o(e.target.value),placeholder:n(`wizardNamePh`),"aria-label":n(`accountName`),disabled:t,autoFocus:!0})}),(0,Z.jsx)(J,{label:n(`maxInflight`),hint:n(`maxInflightHint`),children:(0,Z.jsx)(k,{value:s,onChange:e=>c(e??4),minValue:1,maxValue:32,isDisabled:t,isRequired:!0,children:(0,Z.jsxs)(k.Group,{children:[(0,Z.jsx)(k.DecrementButton,{}),(0,Z.jsx)(k.Input,{"aria-label":n(`maxInflight`)}),(0,Z.jsx)(k.IncrementButton,{})]})})}),(0,Z.jsx)(J,{label:n(`priority`),hint:n(`priorityHint`),children:(0,Z.jsx)(k,{value:l,onChange:e=>u(e??50),minValue:1,maxValue:100,isDisabled:t,isRequired:!0,children:(0,Z.jsxs)(k.Group,{children:[(0,Z.jsx)(k.DecrementButton,{}),(0,Z.jsx)(k.Input,{"aria-label":n(`priority`)}),(0,Z.jsx)(k.IncrementButton,{})]})})})]})]}),(0,Z.jsxs)(O.Footer,{className:`justify-end gap-2 px-6 pb-6`,children:[(0,Z.jsx)(S,{variant:`ghost`,isDisabled:t,onPress:r,children:n(`cancel`)}),(0,Z.jsx)(S,{isPending:t,onPress:()=>void ee(),children:n(`save`)})]})]})})})})}var er={1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-3`};function tr({options:e,value:t,onChange:n,ariaLabel:r,columns:i=2,className:a=``}){let o=(0,Y.useRef)(null);return(0,Y.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=z.context(()=>{let e=z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{z.set(`[data-option-tile]`,{autoAlpha:1,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{z.fromTo(`[data-option-tile]`,{autoAlpha:0,y:8},{autoAlpha:1,y:0,duration:.32,stagger:.035,ease:`power3.out`,overwrite:!0})})},e);return()=>t.revert()},[e.length]),(0,Z.jsx)(`div`,{ref:o,role:`radiogroup`,"aria-label":r,className:`grid gap-3 ${er[i]} ${a}`.trim(),children:e.map(e=>{let r=e.value===t;return(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-option-tile":``,"data-selected":r||void 0,disabled:e.disabled,title:e.hint,onClick:()=>n(e.value),className:`flex h-16 min-w-0 items-center gap-3 rounded-xl bg-surface shadow-surface px-4 text-left transition-colors hover:bg-surface-secondary disabled:cursor-not-allowed disabled:opacity-50 data-selected:border-accent data-selected:bg-accent-soft`,children:[e.icon?(0,Z.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground [&_svg]:size-[18px]`,children:e.icon}):null,(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body font-medium leading-5 text-foreground`,children:e.label})]},e.value)})})}var nr=new Set([`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`]),rr=[`qoder-global`,`qoder-cn`,`workbuddy-global`,`workbuddy-cn`,`trae-cn`];function ir(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>{let r=n.get(e.id)??2**53-1,i=n.get(t.id)??2**53-1;return r===i?e.label.localeCompare(t.label):r-i})}function ar(e,t){return!t||`${e.label} ${e.subtitle||``} ${e.hint||``} ${e.provider} ${e.id}`.toLowerCase().includes(t)}function or({ariaLabel:e}){return(0,Z.jsx)(`div`,{className:`space-y-8`,"aria-busy":`true`,"aria-label":e,children:Array.from({length:2},(e,t)=>(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(Qe,{className:`h-3 w-24 rounded-lg`}),(0,Z.jsx)(Qe,{className:`h-3 w-40 rounded-lg`})]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:Array.from({length:t===0?5:6},(e,t)=>(0,Z.jsxs)(`div`,{className:`card flex flex-row items-center gap-3.5 rounded-xl bg-surface px-4 py-3.5`,children:[(0,Z.jsx)(Qe,{className:`size-10 shrink-0 rounded-lg`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,Z.jsx)(Qe,{className:`h-3.5 w-28 rounded-lg`}),(0,Z.jsx)(Qe,{className:`h-3 w-36 rounded-lg`})]})]},t))})]},t))})}function sr({tile:e,disabled:t,onSelect:n}){return(0,Z.jsxs)(`button`,{type:`button`,disabled:t,title:e.hint||e.subtitle||e.label,onClick:()=>n(e.id),className:`card flex min-w-0 flex-row items-center gap-3 rounded-xl bg-surface px-3.5 py-3 text-left transition-[transform,opacity,background-color] duration-200 ease-out hover:bg-surface-secondary active:translate-y-px active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:translate-y-0 motion-reduce:active:scale-100 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:translate-y-0 disabled:active:scale-100`,children:[(0,Z.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg text-foreground [&_svg]:size-[18px]`,children:(0,Z.jsx)(at,{provider:e.provider,size:18})}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block truncate text-body font-medium leading-5 text-foreground`,children:e.label}),e.subtitle?(0,Z.jsx)(`span`,{className:`mt-0.5 block truncate text-caption leading-4 text-muted`,children:e.subtitle}):null]})]})}function cr({title:e,subtitle:t,tiles:n,disabled:r,onSelect:i}){return n.length?(0,Z.jsxs)(`section`,{className:`space-y-3.5`,children:[(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(`h3`,{className:`text-[10px] font-semibold tracking-[0.12em] uppercase text-muted`,children:e}),t?(0,Z.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:n.map(e=>(0,Z.jsx)(sr,{tile:e,disabled:r,onSelect:i},e.id))})]}):null}function lr({options:e,onSelect:t,disabled:n,empty:r,ariaLabel:i}){let{t:a}=re(),[o,s]=(0,Y.useState)(``),c=o.trim().toLowerCase(),l=(0,Y.useMemo)(()=>{let t=ir(e.filter(e=>nr.has(e.id)),rr),n=e.filter(e=>!nr.has(e.id)).sort((e,t)=>e.label.localeCompare(t.label));return[{id:`subscriptions`,titleKey:`providerGroupSubscriptions`,subtitleKey:`providerGroupSubscriptionsHint`,tiles:t.filter(e=>ar(e,c))},{id:`experimental`,titleKey:`providerGroupExperimental`,subtitleKey:`providerGroupExperimentalHint`,tiles:n.filter(e=>ar(e,c))}]},[c,e]),u=l.reduce((e,t)=>e+t.tiles.length,0);return(0,Z.jsxs)(`div`,{className:`space-y-8`,role:`listbox`,"aria-label":i,children:[(0,Z.jsx)(h,{value:o,onChange:s,placeholder:a(`providerFindPlaceholder`),ariaLabel:a(`providerFindPlaceholder`),className:`max-w-sm`}),u===0?r||(0,Z.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:a(`providerFindEmpty`)}):l.map(e=>(0,Z.jsx)(cr,{title:a(e.titleKey),subtitle:a(e.subtitleKey),tiles:e.tiles,disabled:n,onSelect:t},e.id))]})}var ur={"workbuddy-accounts":`workbuddy`,"workbuddy-oauth-v1":`workbuddy`,"qoder-native-v1":`qoder`,"trae-oauth-v1":`trae`,"devin-session-v1":`devin`,"command-key-v1":`command`,"opencode-key-v1":`opencode`,"codex-oauth-v1":`codex`,"zhipu-key-v1":`zhipu`,"qwenwork-oauth-v1":`qwenwork`,"meta-oauth-v1":`meta`,"meta-key-v1":`meta`,"kiro-oauth-v1":`kiro`,"doubaowork-cookie-v1":`doubaowork`},dr=[`codebuddy.cn`,`workbuddy.cn`],fr=[`workbuddy.ai`,`workbuddy.com`],pr=new Set([`us-east-1`,`eu-central-1`]),mr=/arn:aws:codewhisperer:([a-z0-9-]+):/;function Q(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function $(e){return typeof e==`string`?e.trim():``}function hr(e){let t=e.trim();if(!t)return``;let n=t.toLowerCase();return n===`workbuddy-accounts`?`workbuddy-accounts`:n}function gr(e){return typeof e.format==`string`&&e.format.trim()?hr(e.format):typeof e.exportType==`string`&&e.exportType.trim()?hr(e.exportType):``}function _r(e){let t=[],n=e=>{typeof e==`string`&&e.trim()&&t.push(e.trim().toLowerCase())};if(n(e.domain),Q(e.account)&&n(e.account.domain),Q(e.auth)&&n(e.auth.domain),Array.isArray(e.accounts))for(let t of e.accounts)Q(t)&&(n(t.domain),Q(t.account)&&n(t.account.domain),Q(t.auth)&&n(t.auth.domain));return t}function vr(e){return dr.some(t=>e.includes(t))}function yr(e){return fr.some(t=>e.includes(t))}function br(e){return typeof e.accessToken==`string`||typeof e.access_token==`string`||typeof e.refreshToken==`string`||typeof e.refresh_token==`string`}function xr(e){if(!Q(e))return!1;if(br(e)||typeof e.domain==`string`||typeof e.uid==`string`)return!0;if(Q(e.account)||Q(e.auth)){let t=Q(e.account)?e.account:null,n=Q(e.auth)?e.auth:null;if(n&&(br(n)||typeof n.domain==`string`)||t&&(typeof t.uid==`string`||typeof t.domain==`string`))return!0}return!1}function Sr(e){let t=_r(e);if(t.length===0)return{region:`cn`,ambiguous:!0,warning:`region_unknown`};let n=t.some(vr),r=t.some(yr);return n&&r?{region:null,ambiguous:!0,warning:`region_mixed`}:n?{region:`cn`,ambiguous:!1}:r?{region:`global`,ambiguous:!1}:{region:`cn`,ambiguous:!0,warning:`region_unknown`}}function Cr(e){let t=$(e.region).toLowerCase();if(pr.has(t))return t;if(t===`eu`||t===`europe`)return`eu-central-1`;let n=$(e.profileArn)||$(e.profile_arn),r=mr.exec(n);if(r&&pr.has(r[1]))return r[1];for(let t of[`kiroApiKey`,`apiKey`,`api_key`,`accessToken`,`access_token`]){let n=$(e[t]),r=n.split(`|`);if(n.startsWith(`ksk_`)&&r.length===2&&pr.has(r[1].trim().toLowerCase()))return r[1].trim().toLowerCase()}return null}function wr(e){if(gr(e)===`kiro-oauth-v1`||Cr(e))return!0;let t=($(e.authMethod)||$(e.auth_method)).toLowerCase();if([`builder_id`,`builderid`,`external_idp`,`idc`,`social`].includes(t))return!0;let n=$(e.provider).toLowerCase();if([`builderid`,`kiro`,`apikey`,`github`,`google`,`social`].includes(n))return!0;for(let t of[`kiroApiKey`,`apiKey`,`api_key`,`accessToken`,`access_token`])if($(e[t]).startsWith(`ksk_`))return!0;let r=$(e.clientId)||$(e.client_id),i=$(e.clientSecret)||$(e.client_secret),a=$(e.refreshToken)||$(e.refresh_token),o=$(e.startUrl)||$(e.start_url);if(r&&i&&a||o.includes(`awsapps.com`)&&a||($(e.profileArn)||$(e.profile_arn)).includes(`codewhisperer`)&&(a||$(e.accessToken)||$(e.access_token)))return!0;let s=$(e.tokenEndpoint)||$(e.token_endpoint),c=$(e.issuerUrl)||$(e.issuer_url);return!!((s.includes(`microsoftonline`)||c.includes(`microsoftonline`))&&a)}function Tr(e){return Array.isArray(e.accounts)?e.accounts.filter(e=>Q(e)&&wr(e)):[]}function Er(e){return wr(e)||Tr(e).length>0?{format:`kiro-oauth-v1`,provider:`kiro`,confidence:`medium`}:Array.isArray(e.accounts)&&e.accounts.some(xr)?{format:`workbuddy-accounts`,provider:`workbuddy`,confidence:`medium`}:(typeof e.user_blob==`string`||typeof e.userBlob==`string`)&&(typeof e.machine_id==`string`||typeof e.machineId==`string`)?{format:`qoder-native-v1`,provider:`qoder`,confidence:`medium`}:typeof e.session_token==`string`||typeof e.sessionToken==`string`?{format:`devin-session-v1`,provider:`devin`,confidence:`low`}:br(e)||Q(e.account)&&br(e.account)||Q(e.auth)?{format:`workbuddy-oauth-v1`,provider:`workbuddy`,confidence:`low`}:typeof e.dca_token==`string`||typeof e.dcaToken==`string`||typeof e.access_token==`string`&&String(e.access_token).startsWith(`dca:`)||typeof e.accessToken==`string`&&String(e.accessToken).startsWith(`dca:`)?{format:`meta-oauth-v1`,provider:`meta`,confidence:`medium`}:typeof e.api_key==`string`||typeof e.apiKey==`string`?typeof e.organization==`string`||typeof e.project==`string`?{format:`zhipu-key-v1`,provider:`zhipu`,confidence:`low`}:typeof e.base_url==`string`&&String(e.base_url).includes(`meta.ai`)||typeof e.baseUrl==`string`&&String(e.baseUrl).includes(`meta.ai`)||typeof e.email==`string`?{format:`meta-key-v1`,provider:`meta`,confidence:`low`}:{format:`command-key-v1`,provider:`command`,confidence:`low`}:{format:null,provider:null,confidence:`low`}}function Dr(e){let t=Tr(e),n=t.length>0?t:[e],r=new Set(n.map(Cr).filter(e=>e!=null));return r.size===1?{region:[...r][0],ambiguous:!1}:(r.size,{region:null,ambiguous:!0})}function Or(e){if(!Q(e))return{format:null,provider:null,region:null,regionAmbiguous:!0,confidence:`low`,warnings:[`not_object`],batchImportSupported:!1};let t=[],n=gr(e),r=typeof e.format==`string`?e.format.trim():``,i=typeof e.exportType==`string`?e.exportType.trim():``,a=r||i,o=n||null,s=o?ur[o]??null:null,c=o&&s?`high`:`low`;if(!s){let r=Er(e);o||=r.format,s=r.provider,c=n&&!ur[n]?`low`:r.confidence,a&&!ur[n]&&t.push(`unknown_format`)}s!==`kiro`&&(wr(e)||Tr(e).length>0)&&(s=`kiro`,o=`kiro-oauth-v1`,c=n===`kiro-oauth-v1`?`high`:`medium`),s===`workbuddy`&&Array.isArray(e.accounts)&&(o=`workbuddy-accounts`);let l=null,u=!1;if(s===`workbuddy`){let n=Sr(e);l=n.region,u=n.ambiguous,n.warning&&t.push(n.warning)}if(s===`kiro`){let n=Dr(e);l=n.region,u=n.ambiguous,u&&t.push(Tr(e).length>1?`region_mixed`:`region_unknown`)}return{format:o,provider:s,region:l,regionAmbiguous:u,confidence:c,warnings:t,batchImportSupported:s===`workbuddy`||s===`kiro`}}function kr(e){let t;try{t=JSON.parse(e)}catch{throw Error(`bad_json`)}if(Array.isArray(t)){if(t.length===0||!t.every(Q))throw Error(`bad_json`);return{accounts:t}}if(!Q(t))throw Error(`bad_json`);return t}function Ar(e,t){let n={...e},r=n.format===`workbuddy-accounts`||Array.isArray(n.accounts);return n.format?r&&(n.format=`workbuddy-accounts`):n.format=r?`workbuddy-accounts`:`workbuddy-oauth-v1`,{...n,name:t.name?.trim()||n.name,enabled:t.enabled??!0,provider:`workbuddy`,region:t.region,max_inflight:t.max_inflight??4,priority:t.priority??50,drop_system_prompt:t.drop_system_prompt??!0,...t.proxy_url!=null&&t.proxy_url!==``?{proxy_url:t.proxy_url}:{}}}function jr(e,t){let n=typeof e?.succeeded==`number`?e.succeeded:e?.id||e?1:0,r=typeof e?.failed==`number`?e.failed:0,i=(e?.errors||[]).slice(0,3).map(e=>e.message||`index ${e.index}`).filter(Boolean).join(`; `),a;return a=r>0?t(`accountImportPartial`).replace(`{ok}`,String(n)).replace(`{fail}`,String(r))+(i?` — ${i}`:``):n>1?t(`accountImportBatch`).replace(`{n}`,String(n)):t(`accountImported`),{succeeded:n,failed:r,message:a}}async function Mr(e,t){let n=Ar(e,t);return Re(n)}var Nr={global:`Global`,cn:`CN`},Pr={"qoder-global":`accountTypeQoderGlobal`,"qoder-cn":`accountTypeQoderCN`,"workbuddy-cn":`accountTypeWorkBuddyCN`,"workbuddy-global":`accountTypeWorkBuddyGlobal`,"trae-cn":`accountTypeTraeCN`,"devin-global":`accountTypeDevinGlobal`,"command-global":`accountTypeCommandGlobal`,"codex-global":`accountTypeCodexGlobal`,"zhipu-cn":`accountTypeZhipuCN`,"qwenwork-global":`accountTypeQwenworkGlobal`,"qwenwork-cn":`accountTypeQwenworkCN`,"kimi-cn":`accountTypeKimiCN`,"codearts-cn-north-4":`accountTypeCodeArtsCN`,"doubaowork-cn":`accountTypeDoubaoworkCN`,"kiro-us-east-1":`accountTypeKiroUS`,"kiro-eu-central-1":`accountTypeKiroEU`,"meta-global":`accountTypeMetaGlobal`,"minimaxcode-cn":`accountTypeMiniMaxCodeCN`,"minimaxcode-global":`accountTypeMiniMaxCodeGlobal`,"opencode-go":`accountTypeOpenCode`,"opencode-zen":`accountTypeOpenCode`},Fr={"qoder-global":`accountTypeQoderGlobalHint`,"qoder-cn":`accountTypeQoderCNHint`,"workbuddy-cn":`accountTypeWorkBuddyCNHint`,"workbuddy-global":`accountTypeWorkBuddyGlobalHint`,"trae-cn":`accountTypeTraeCNHint`,"devin-global":`accountTypeDevinGlobalHint`,"command-global":`accountTypeCommandGlobalHint`,"codex-global":`accountTypeCodexGlobalHint`,"zhipu-cn":`accountTypeZhipuCNHint`,"qwenwork-global":`accountTypeQwenworkGlobalHint`,"qwenwork-cn":`accountTypeQwenworkCNHint`,"kimi-cn":`accountTypeKimiCNHint`,"codearts-cn-north-4":`accountTypeCodeArtsCNHint`,"doubaowork-cn":`accountTypeDoubaoworkCNHint`,"kiro-us-east-1":`accountTypeKiroUSHint`,"kiro-eu-central-1":`accountTypeKiroEUHint`,"meta-global":`accountTypeMetaGlobalHint`,"minimaxcode-cn":`accountTypeMiniMaxCodeCNHint`,"minimaxcode-global":`accountTypeMiniMaxCodeGlobalHint`,"opencode-go":`accountTypeOpenCodeGoHint`,"opencode-zen":`accountTypeOpenCodeZenHint`};async function Ir(){let e=(await Te().catch(()=>null))?.data||[],t=[];for(let n of e)for(let e of n.regions)t.push({id:`${n.id}-${e.id}`,provider:n.id,region:e.id,descriptor:n});return t}function Lr(e,t){let n=Pr[e.id];if(n){let e=t(n);if(e!==n)return e}let r=e.descriptor.regions.find(t=>t.id===e.region)?.label||Nr[e.region]||``,i=e.descriptor.regions.length>1&&r?` ${r}`:``;return`${e.descriptor.label}${i}`.trim()}function Rr(e,t){if(!e)return``;let n=Fr[e.id];if(!n)return``;let r=t(n);return r===n?``:r}function zr({phase:e,busy:t,tab:n,forTab:r}){return e===`done`?(0,Z.jsx)(B,{size:16,className:`text-success`}):t&&n===r?(0,Z.jsx)(Xe,{size:16,loading:!0}):null}var Br=90,Vr=2e3;function Hr({isOpen:e,onClose:t,onAdded:n}){let{t:i}=re(),[o,d]=(0,Y.useState)(`method`),[p,m]=(0,Y.useState)(`browser`),[ee,h]=(0,Y.useState)(``),[te,g]=(0,Y.useState)([]),[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(!1),[x,C]=(0,Y.useState)(``),[ie,w]=(0,Y.useState)(4),[ae,oe]=(0,Y.useState)(50),[T,se]=(0,Y.useState)(``),[ce,le]=(0,Y.useState)(``),[E,ue]=(0,Y.useState)(`payg`),[fe,pe]=(0,Y.useState)(``),[me,he]=(0,Y.useState)(``),[_e,ve]=(0,Y.useState)(``),[ye,be]=(0,Y.useState)(``),[A,j]=(0,Y.useState)(`idle`),[M,N]=(0,Y.useState)(``),[P,Se]=(0,Y.useState)(``),[Ce,we]=(0,Y.useState)(!1),[Te,F]=(0,Y.useState)(``),[De,Oe]=(0,Y.useState)(`cli`),[ke,Ae]=(0,Y.useState)(`builder_id`),[I,je]=(0,Y.useState)(``),Me=(0,Y.useRef)(null),Ne=(0,Y.useRef)(null),Ie=(0,Y.useRef)(null),L=(0,Y.useRef)(``),ze=(0,Y.useRef)(null),Be=(0,Y.useRef)(null);function Ve(){ze.current!==null&&(window.clearTimeout(ze.current),ze.current=null)}(0,Y.useEffect)(()=>()=>Ve(),[]),(0,Y.useEffect)(()=>{if(!e)return;let t=!1;return v(!0),g([]),h(``),Ir().then(e=>{t||(g(e),h(``),m(`browser`))}).finally(()=>{t||v(!1)}),()=>{t=!0}},[e]);let R=te.find(e=>e.id===ee),He=!_&&te.length>0,Ue=R?.descriptor.capabilities?.pat_login!==!1,We=R?.descriptor.capabilities?.import_export!==!1,V=R?.descriptor.capabilities?.browser_login!==!1,qe=R?.provider===`trae`||R?.provider===`devin`||R?.provider===`codex`||R?.provider===`codearts`,H=A===`busy`||A===`polling`,Je=!!L.current||H,U=A===`done`,Ye=Rr(R,i);(0,Y.useEffect)(()=>{p===`pat`&&!Ue&&m(`browser`),p===`import`&&!We&&m(`browser`)},[We,Ue,p]),(0,Y.useEffect)(()=>{V||(Ue?m(`pat`):We&&m(`import`))},[V,We,Ue]);function Xe(){return!Number.isInteger(ie)||ie<1||ie>32?4:ie}function Ze(){return!Number.isInteger(ae)||ae<1||ae>100?50:ae}function W(){return{max_inflight:Xe(),priority:Ze()}}function Qe(){Ve(),d(`method`),m(`browser`),h(``),g([]),v(!1),C(``),w(4),oe(50),se(``),le(``),ue(`payg`),pe(``),he(``),ve(``),be(``),b(!1),j(`idle`),N(``),Se(``),we(!1),F(``),Oe(`cli`),L.current=``}function G(){H||(Qe(),t())}function $e(){Qe(),t()}(0,Y.useLayoutEffect)(()=>{let t=Me.current;if(e||(Ie.current=null),!t||!e)return;let n=z.context(()=>{let e=z.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{z.set(t,{autoAlpha:1,x:0,y:0})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Ie.current,n=e&&e!==o?o===`login`?1:-1:0;z.fromTo(t,{autoAlpha:0,x:20*n,y:n?0:12},{autoAlpha:1,x:0,y:0,duration:nt.slow,ease:rt.out,overwrite:!0}),n&&Ne.current&&z.fromTo(Ne.current,{autoAlpha:0,y:6},{autoAlpha:1,y:0,duration:nt.base,ease:rt.out,overwrite:!0})})},t);return Ie.current=o,()=>n.revert()},[e,o]);function et(e){if(H||!He)return;let t=te.find(t=>t.id===e);h(e),m(t?.provider===`zhipu`||t?.provider===`doubaowork`?`pat`:`browser`),N(``),d(`login`)}async function tt(){if(L.current)return L.current;if(!R)throw Error(i(`accountTypeHint`));let e=W(),t=await Le(x.trim()||i(`account`),R.provider,R.region,e),n=t?.id||t?.data?.id;if(!n)throw Error(`create account returned no id`);return L.current=n,n}async function K(){N(``),Se(``);try{j(`busy`);let e=await tt();N(i(`wizardStartingSession`)),j(`polling`);let t=R?.provider===`codex`?De:R?.provider===`kiro`?ke:void 0,r=await xe(e,t,ke===`idc`?I.trim():void 0);r.authUrl&&Se(r.authUrl),N(i(`wizardWaitingBrowser`));for(let t=0;t{ze.current=window.setTimeout(e,Vr)});let n=(await Fe(e)).login||{};if(n.message&&N(n.message),n.status===`ok`)break;if(n.status===`error`)throw Error(n.message||`login failed`);if(t===89)throw Error(i(`wizardLoginTimeout`))}j(`done`),N(i(`wizardAccountReady`)),n(),window.setTimeout($e,900)}catch(e){j(`idle`),N(e instanceof Error?e.message:String(e))}}async function ot(){let e=Te.trim();if(!e){N(i(`wizardCallbackPh`));return}try{j(`busy`);let t=await tt();Ve(),await Pe(t,e),j(`done`),N(i(`wizardAccountReady`)),n(),window.setTimeout($e,900)}catch(e){j(`polling`),N(e instanceof Error?e.message:String(e))}}async function st(){let e=fe.trim();if(!e){N(i(`zhipuKeyRequired`));return}if(!R){N(i(`accountTypeHint`));return}N(``);try{j(`busy`);let t=W();await Re({format:`zhipu-key-v1`,api_key:e,mode:E,organization:E===`coding`?me.trim():``,project:E===`coding`?_e.trim():``,name:x.trim()||i(`accountTypeZhipuCN`),enabled:!0,provider:R.provider,region:R.region,max_inflight:t.max_inflight,priority:t.priority}),j(`done`),N(i(`wizardAccountReady`)),n(),window.setTimeout($e,700)}catch(e){j(`idle`),N(e instanceof Error?e.message:String(e))}}async function ct(){let e=T.trim();if(!e){N(i(`pastePatFirst`));return}N(``);try{j(`busy`);let t=await tt();N(i(`wizardStartingSession`)),await Ee(e,t),j(`done`),N(i(`patDone`)),n(),window.setTimeout($e,700)}catch(e){j(`idle`),N(e instanceof Error?e.message:String(e))}}async function lt(){let e=ye.trim();if(!e){N(i(`doubaoCookieRequired`));return}if(!R){N(i(`accountTypeHint`));return}N(``);try{j(`busy`);let t=W();await Re({format:`doubaowork-cookie-v1`,cookie:e,name:x.trim()||i(`accountTypeDoubaoworkCN`),enabled:!0,provider:R.provider,region:R.region,max_inflight:t.max_inflight,priority:t.priority}),j(`done`),N(i(`wizardAccountReady`)),n(),window.setTimeout($e,900)}catch(e){j(`idle`),N(e instanceof Error?e.message:String(e))}}async function ut(){N(``);let e;try{e=JSON.parse(ce)}catch{N(i(`wizardBadJson`));return}if(Array.isArray(e)){if(!e.every(e=>e&&typeof e==`object`&&!Array.isArray(e))){N(i(`wizardBadJson`));return}e={accounts:e}}if(!e||typeof e!=`object`){N(i(`wizardBadJson`));return}if(!R){N(i(`accountTypeHint`));return}let t=Or(e),r=t.provider||R.provider;if(r===`qoder`&&(typeof e.user_blob!=`string`||typeof e.machine_id!=`string`)){N(i(`wizardBadJson`));return}let a=W(),o;if(r===`kiro`){let t=typeof e.email==`string`?e.email.trim():``,n=typeof e.nickname==`string`?e.nickname.trim():``,r=Cr(e),{provider:i,accounts:s,...c}=e,l=Array.isArray(s)?s:[{...c,...i?{provider:i}:{}}];o={format:`kiro-oauth-v1`,provider:`kiro`,region:r||(R.provider===`kiro`?R.region:`us-east-1`),name:x.trim()||n||t||void 0,enabled:!0,accounts:l,max_inflight:a.max_inflight,priority:a.priority}}else if(r===`workbuddy`)o=Ar(e,{region:R.region===`global`?`global`:`cn`,name:x.trim()||void 0,enabled:!0,max_inflight:a.max_inflight,priority:a.priority});else{if(!e.format){let t=r;t===`trae`?e.format=`trae-oauth-v1`:t===`devin`?e.format=`devin-session-v1`:t===`command`?e.format=`command-key-v1`:t===`opencode`?e.format=`opencode-key-v1`:t===`qwenwork`?e.format=`qwenwork-oauth-v1`:t===`kimi`?e.format=`kimi-oauth-v1`:t===`codearts`?e.format=`codearts-oauth-v1`:t===`codex`?e.format=`codex-oauth-v1`:t===`meta`?e.format=`meta-oauth-v1`:e.format=`qoder-native-v1`}o={...e,name:x.trim()||e.name,enabled:!0,provider:r,region:t.region||R.region,max_inflight:a.max_inflight,priority:a.priority}}try{j(`busy`);let{failed:e,message:t}=jr(await Re(o),i);j(`done`),N(t),n(),window.setTimeout($e,e>0?1600:700)}catch(e){j(`idle`),N(e instanceof Error?e.message:String(e))}}function dt(){Be.current?.click()}function ft(e){let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>le(String(n.result||``)),n.readAsText(t),e.target.value=``}let pt=e=>H&&p===e,mt=R?.provider===`zhipu`,ht=R?.provider===`doubaowork`,gt=[R?.descriptor.capabilities?.browser_login===!1?null:{value:`browser`,label:i(`tabBrowser`)},Ue?{value:`pat`,label:i(`tabPat`)}:null,We?{value:`import`,label:i(`tabImport`)}:null].filter(Boolean),_t=i(p===`browser`?R?.provider===`codex`?`wizardCodexBrowserLead`:`wizardBrowserLead`:p===`pat`?R?.provider===`command`?`wizardPatLeadCommand`:R?.provider===`opencode`?`wizardPatLeadOpenCode`:R?.region===`cn`&&R?.provider===`qoder`?`wizardPatLeadCN`:`wizardPatLead`:`wizardImportLead`);return(0,Z.jsx)(O.Root,{isOpen:e,onOpenChange:e=>{e||G()},children:(0,Z.jsx)(O.Backdrop,{variant:`blur`,isDismissable:!H,children:(0,Z.jsx)(O.Container,{size:`lg`,scroll:`inside`,children:(0,Z.jsxs)(O.Dialog,{className:`w-full sm:w-[36rem] sm:max-w-[calc(100vw-2rem)] sm:min-h-[36rem]`,children:[(0,Z.jsxs)(O.Header,{className:`relative items-center justify-center px-12 pt-5 text-center`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(O.Heading,{className:`text-section font-semibold`,children:i(`addAccountTitle`)}),(0,Z.jsx)(`p`,{ref:Ne,className:`mt-1 text-caption font-normal leading-5 text-muted`,children:o===`method`?i(`addAccountDesc`):Ye||i(`addAccountDesc`)})]}),(0,Z.jsx)(O.CloseTrigger,{"aria-label":i(`close`),className:`absolute right-4 top-4 grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Z.jsx)(Ke,{size:16})})]}),(0,Z.jsx)(O.Body,{className:o===`method`?`px-8 pb-5 sm:px-10`:`px-6 pb-2`,children:(0,Z.jsx)(`div`,{ref:Me,children:o===`method`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`section`,{className:`space-y-2.5`,children:_?(0,Z.jsx)(or,{ariaLabel:i(`accountType`)}):He?(0,Z.jsx)(lr,{ariaLabel:i(`accountType`),options:te.map(e=>{let t=e.descriptor.regions.find(t=>t.id===e.region)?.label||Nr[e.region]||``;return{id:e.id,provider:e.provider,label:Lr(e,i),subtitle:t,hint:Rr(e,i)}}),onSelect:et,disabled:Je}):(0,Z.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:i(`accountTypeHint`)})}),(0,Z.jsx)(`div`,{className:`mt-4 text-center`,children:(0,Z.jsx)(l,{className:`text-xs`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`card flex flex-row items-center gap-3 rounded-xl bg-surface px-3 py-2.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:(0,Z.jsx)(at,{provider:R?.provider,size:18})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-body font-medium text-foreground`,children:R?Lr(R,i):i(`accountType`)}),(0,Z.jsx)(`div`,{className:`truncate text-caption text-muted`,children:Ye})]}),(0,Z.jsxs)(S,{size:`sm`,variant:`ghost`,onPress:()=>d(`method`),isDisabled:H||!!L.current,children:[(0,Z.jsx)(r,{size:12}),i(`wizardBack`)]})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(de,{className:`text-body font-medium text-muted`,children:i(`accountName`)}),(0,Z.jsx)(D,{fullWidth:!0,value:x,onChange:e=>C(e.target.value),"aria-label":i(`accountName`),disabled:Je,autoFocus:!0})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>b(e=>!e),"aria-expanded":y,className:`inline-flex items-center gap-1 text-caption font-medium text-muted transition-colors hover:text-foreground`,children:[(0,Z.jsx)(u,{size:12,className:`transition-transform duration-200 ${y?`rotate-90`:``}`}),i(`wizardAdvanced`)]}),y?(0,Z.jsx)(`div`,{className:`card gap-3 rounded-xl bg-surface px-3.5 py-3.5`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(de,{className:`text-body font-medium text-muted`,children:i(`maxInflight`)}),(0,Z.jsx)(k,{value:ie,onChange:e=>w(e??4),minValue:1,maxValue:32,isDisabled:Je,isRequired:!0,children:(0,Z.jsxs)(k.Group,{className:`w-full`,children:[(0,Z.jsx)(k.DecrementButton,{}),(0,Z.jsx)(k.Input,{"aria-label":i(`maxInflight`)}),(0,Z.jsx)(k.IncrementButton,{})]})}),(0,Z.jsx)(ge,{className:`text-caption leading-5 text-muted`,children:i(`maxInflightHint`)})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(de,{className:`text-body font-medium text-muted`,children:i(`priority`)}),(0,Z.jsx)(k,{value:ae,onChange:e=>oe(e??50),minValue:1,maxValue:100,isDisabled:Je,isRequired:!0,children:(0,Z.jsxs)(k.Group,{className:`w-full`,children:[(0,Z.jsx)(k.DecrementButton,{}),(0,Z.jsx)(k.Input,{"aria-label":i(`priority`)}),(0,Z.jsx)(k.IncrementButton,{})]})}),(0,Z.jsx)(ge,{className:`text-caption leading-5 text-muted`,children:i(`priorityHint`)})]})]})}):null]}),mt?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`span`,{className:`text-body font-medium text-muted`,children:i(`zhipuAccountMode`)}),(0,Z.jsx)(tr,{ariaLabel:i(`zhipuAccountMode`),columns:2,value:E,onChange:e=>{H||ue(e)},options:[{value:`payg`,label:i(`zhipuModePayg`),hint:i(`zhipuModePaygHint`),disabled:H},{value:`coding`,label:i(`zhipuModeCoding`),hint:i(`zhipuModeCodingHint`),disabled:H}]})]}),(0,Z.jsx)(J,{label:i(`zhipuApiKey`),children:(0,Z.jsx)(D,{type:`password`,value:fe,onChange:e=>pe(e.target.value),placeholder:i(`zhipuApiKeyPh`),"aria-label":i(`zhipuApiKey`),disabled:H})}),E===`coding`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(J,{label:i(`zhipuOrganization`),children:(0,Z.jsx)(D,{value:me,onChange:e=>he(e.target.value),placeholder:i(`zhipuOrganizationPh`),"aria-label":i(`zhipuOrganization`),disabled:H})}),(0,Z.jsx)(J,{label:i(`zhipuProject`),children:(0,Z.jsx)(D,{value:_e,onChange:e=>ve(e.target.value),placeholder:i(`zhipuProjectPh`),"aria-label":i(`zhipuProject`),disabled:H})})]}):null,M?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[U?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:U?`font-medium text-foreground`:`text-muted`,children:M})]}):null]}):null,ht?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[(0,Z.jsx)(`p`,{className:`rounded-lg bg-surface-secondary/45 px-3.5 py-3 text-caption leading-5 text-muted`,children:i(`doubaoCookieLead`)}),(0,Z.jsx)(J,{label:i(`doubaoCookieLabel`),children:(0,Z.jsx)(s,{className:`min-h-28 font-mono text-caption leading-5`,value:ye,onChange:e=>be(e.target.value),placeholder:i(`doubaoCookiePh`),"aria-label":i(`doubaoCookieLabel`),disabled:H})}),M?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[U?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:U?`font-medium text-foreground`:`text-muted`,children:M})]}):null]}):null,mt||ht?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(it,{className:`mt-3`,value:p,onChange:e=>{!H&&e!==p&&(m(e),N(``),Se(``),we(!1))},ariaLabel:i(`authentication`),options:gt.map(e=>({id:e.value,label:e.label}))}),(0,Z.jsx)(`p`,{className:`mt-2 min-h-5 text-caption leading-5 text-muted`,children:_t}),(0,Z.jsx)(`div`,{className:`mt-3 flex flex-col gap-4`,children:p===`browser`?(0,Z.jsxs)(Z.Fragment,{children:[R?.provider===`codex`?(0,Z.jsx)(tr,{ariaLabel:i(`codexLoginMethod`),columns:2,value:De,onChange:e=>{H||Oe(e)},options:[{value:`cli`,label:i(`codexLoginCli`),hint:i(`codexLoginCliHint`),disabled:H||!!L.current},{value:`chatgpt`,label:i(`codexLoginChatGPT`),hint:i(`codexLoginChatGPTHint`),disabled:H||!!L.current}]}):null,R?.provider===`kiro`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(tr,{ariaLabel:i(`kiroLoginMethod`),columns:2,value:ke,onChange:e=>{H||Ae(e)},options:[{value:`builder_id`,label:i(`kiroLoginBuilder`),hint:i(`kiroLoginBuilderHint`),disabled:H||!!L.current},{value:`idc`,label:i(`kiroLoginIDC`),hint:i(`kiroLoginIDCHint`),disabled:H||!!L.current},{value:`sso`,label:i(`kiroLoginSSO`),hint:i(`kiroLoginSSOHint`),disabled:H||!!L.current},{value:`microsoft`,label:i(`kiroLoginMicrosoft`),hint:i(`kiroLoginMicrosoftHint`),disabled:H||!!L.current}]}),ke===`idc`?(0,Z.jsx)(J,{label:i(`kiroIDCStartURL`),children:(0,Z.jsx)(D,{value:I,onChange:e=>je(e.target.value),placeholder:i(`kiroIDCStartURLPh`),"aria-label":i(`kiroIDCStartURL`),disabled:H})}):null]}):null,P?(0,Z.jsxs)(`div`,{className:`card rounded-xl bg-surface px-3 py-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,Z.jsx)(zr,{phase:A,busy:H,tab:p,forTab:`browser`}),(0,Z.jsx)(`span`,{className:`text-muted`,children:M||i(`loginOpenMsg`)})]}),(0,Z.jsx)(`code`,{className:`mono mt-2 block break-all text-caption leading-5 text-foreground`,children:P}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,onPress:()=>window.open(P,`_blank`,`noopener,noreferrer`),children:[(0,Z.jsx)(c,{size:14}),i(`openAuthUrl`)]}),(0,Z.jsxs)(S,{size:`sm`,variant:`ghost`,onPress:()=>{f(P).then(e=>{e&&(we(!0),window.setTimeout(()=>we(!1),1100))})},children:[(0,Z.jsx)(a,{copied:Ce}),i(Ce?`copied`:`copy`)]})]})]}):null,M&&!P?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[U?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:U?`font-medium text-foreground`:`text-muted`,children:M})]}):null,qe?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-caption leading-4 text-muted`,children:i(`wizardCallbackLead`)}),(0,Z.jsx)(s,{className:`h-28 w-full resize-none font-mono text-caption leading-5`,value:Te,onChange:e=>F(e.target.value),placeholder:i(`wizardCallbackPh`),"aria-label":i(`wizardCallbackPh`),disabled:U}),(0,Z.jsx)(S,{size:`sm`,variant:`secondary`,isPending:A===`busy`&&!!Te.trim(),onPress:()=>void ot(),isDisabled:U,children:i(`wizardSubmitCallback`)})]}):null]}):p===`pat`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(J,{label:i(`tabPat`),children:(0,Z.jsx)(D,{type:`password`,value:T,onChange:e=>se(e.target.value),placeholder:i(`wizardPatPh`),"aria-label":i(`wizardPatPh`),disabled:H})}),M?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[U?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:U?`font-medium text-foreground`:`text-muted`,children:M})]}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:`JSON`}),(0,Z.jsxs)(S,{size:`sm`,variant:`secondary`,onPress:dt,isDisabled:H,children:[(0,Z.jsx)(Ut,{size:13}),i(`wizardChooseFile`)]}),(0,Z.jsx)(`input`,{ref:Be,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:ft})]}),(0,Z.jsx)(s,{className:`min-h-32 font-mono text-caption`,value:ce,onChange:e=>le(e.target.value),placeholder:i(`wizardImportPh`),"aria-label":i(`tabImport`),disabled:H}),M?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-surface-secondary px-3 py-2 text-caption`,children:[U?(0,Z.jsx)(B,{size:14,className:`shrink-0 text-success`}):null,(0,Z.jsx)(`span`,{className:U?`font-medium text-foreground`:`text-muted`,children:M})]}):null]})})]})]})})}),(0,Z.jsxs)(O.Footer,{className:`justify-end gap-2 px-5 pb-5`,children:[(0,Z.jsx)(S,{variant:`ghost`,onPress:G,isDisabled:H,children:i(`cancel`)}),o===`login`&&mt?(0,Z.jsx)(S,{isPending:A===`busy`,onPress:()=>void st(),isDisabled:U,children:U?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`wizardAccountReady`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ge,{size:15}),i(`zhipuCreate`)]})}):null,o===`login`&&ht?(0,Z.jsx)(S,{isPending:A===`busy`,onPress:()=>void lt(),isDisabled:U,children:U?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`wizardAccountReady`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ge,{size:15}),i(`doubaoImport`)]})}):null,o===`login`&&!mt&&!ht&&p===`browser`?(0,Z.jsx)(S,{isPending:pt(`browser`),onPress:()=>void K(),isDisabled:U,children:U?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`wizardAccountReady`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ne,{size:15}),i(`wizardStartBrowser`)]})}):null,o===`login`&&!mt&&!ht&&p===`pat`?(0,Z.jsx)(S,{isPending:pt(`pat`),onPress:()=>void ct(),isDisabled:U,children:U?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`patDone`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ge,{size:15}),i(`wizardCreateAndLogin`)]})}):null,o===`login`&&!mt&&!ht&&p===`import`?(0,Z.jsx)(S,{isPending:pt(`import`),onPress:()=>void ut(),isDisabled:U,children:U?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{size:15}),i(`accountImported`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ut,{size:15}),i(`importCredential`)]})}):null]})]})})})})}var Ur=2e4,Wr=45e3,Gr=1e4;function Kr(e){let t=[],n=e.replace(/\r\n/g,` `),r=n.indexOf(` `);for(;r!==-1;)t.push(n.slice(0,r)),n=n.slice(r+2),r=n.indexOf(` diff --git a/internal/webui/static/assets/ArrowUp.es-C5DPjo_d.js b/internal/webui/static/assets/ArrowUp.es-4Hv09PbZ.js similarity index 96% rename from internal/webui/static/assets/ArrowUp.es-C5DPjo_d.js rename to internal/webui/static/assets/ArrowUp.es-4Hv09PbZ.js index 2067dcc9b..e1f7746ec 100644 --- a/internal/webui/static/assets/ArrowUp.es-C5DPjo_d.js +++ b/internal/webui/static/assets/ArrowUp.es-4Hv09PbZ.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-XrvNxGvP.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208.49,120.49a12,12,0,0,1-17,0L140,69V216a12,12,0,0,1-24,0V69L64.49,120.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0l72,72A12,12,0,0,1,208.49,120.49Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M200,112H56l72-72Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M205.66,106.34l-72-72a8,8,0,0,0-11.32,0l-72,72A8,8,0,0,0,56,120h64v96a8,8,0,0,0,16,0V120h64a8,8,0,0,0,5.66-13.66ZM75.31,104,128,51.31,180.69,104Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M207.39,115.06A8,8,0,0,1,200,120H136v96a8,8,0,0,1-16,0V120H56a8,8,0,0,1-5.66-13.66l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,207.39,115.06Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M204.24,116.24a6,6,0,0,1-8.48,0L134,54.49V216a6,6,0,0,1-12,0V54.49L60.24,116.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0l72,72A6,6,0,0,1,204.24,116.24Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M202.83,114.83a4,4,0,0,1-5.66,0L132,49.66V216a4,4,0,0,1-8,0V49.66L58.83,114.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0l72,72A4,4,0,0,1,202.83,114.83Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`ArrowUpIcon`;var o=a;export{o as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-BAo1UrJW.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208.49,120.49a12,12,0,0,1-17,0L140,69V216a12,12,0,0,1-24,0V69L64.49,120.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0l72,72A12,12,0,0,1,208.49,120.49Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M200,112H56l72-72Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M205.66,106.34l-72-72a8,8,0,0,0-11.32,0l-72,72A8,8,0,0,0,56,120h64v96a8,8,0,0,0,16,0V120h64a8,8,0,0,0,5.66-13.66ZM75.31,104,128,51.31,180.69,104Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M207.39,115.06A8,8,0,0,1,200,120H136v96a8,8,0,0,1-16,0V120H56a8,8,0,0,1-5.66-13.66l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,207.39,115.06Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M204.24,116.24a6,6,0,0,1-8.48,0L134,54.49V216a6,6,0,0,1-12,0V54.49L60.24,116.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0l72,72A6,6,0,0,1,204.24,116.24Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M202.83,114.83a4,4,0,0,1-5.66,0L132,49.66V216a4,4,0,0,1-8,0V49.66L58.83,114.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0l72,72A4,4,0,0,1,202.83,114.83Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`ArrowUpIcon`;var o=a;export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/CaiaiSoftLink-CsNrM_a1.js b/internal/webui/static/assets/CaiaiSoftLink-c1QhARkW.js similarity index 97% rename from internal/webui/static/assets/CaiaiSoftLink-CsNrM_a1.js rename to internal/webui/static/assets/CaiaiSoftLink-c1QhARkW.js index bfe7bc2eb..1266892ba 100644 --- a/internal/webui/static/assets/CaiaiSoftLink-CsNrM_a1.js +++ b/internal/webui/static/assets/CaiaiSoftLink-c1QhARkW.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./Check.es-DRxeSSF6.js";import{n as i}from"./clipboard-CWhuA-N0.js";import{n as a,pt as o}from"./useI18n-XrvNxGvP.js";import{c as s,z as c}from"./SharedElementTransition-BlCsXfb1.js";import{r as l,t as u}from"./textfield-BGZ3lXZC.js";import{t as d}from"./gsap-DWxn8li7.js";import{v as f,x as p,y as m}from"./index-CAlyInAP.js";var h=t(e(),1),g=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z`}))]]),_=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),v=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M160,48V208L80,128Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z`}))]]),y=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M216,64V192H88V64Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM68,188a12,12,0,1,1,12-12A12,12,0,0,1,68,188Zm0-48a12,12,0,1,1,12-12A12,12,0,0,1,68,140Zm0-48A12,12,0,1,1,80,80,12,12,0,0,1,68,92Zm124,92H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M82,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H88A6,6,0,0,1,82,64Zm134,58H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Zm0,64H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12ZM44,54A10,10,0,1,0,54,64,10,10,0,0,0,44,54Zm0,128a10,10,0,1,0,10,10A10,10,0,0,0,44,182Zm0-64a10,10,0,1,0,10,10A10,10,0,0,0,44,118Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M84,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H88A4,4,0,0,1,84,64Zm132,60H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Zm0,64H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8ZM44,120a8,8,0,1,0,8,8A8,8,0,0,0,44,120Zm0-64a8,8,0,1,0,8,8A8,8,0,0,0,44,56Zm0,128a8,8,0,1,0,8,8A8,8,0,0,0,44,184Z`}))]]),b=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:g}));b.displayName=`ArrowSquareOutIcon`;var x=b,S=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:_}));S.displayName=`ArrowsClockwiseIcon`;var C=S,w=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:v}));w.displayName=`CaretLeftIcon`;var T=w,E=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:y}));E.displayName=`ListBulletsIcon`;var D=E,O=c({base:`textarea`,defaultVariants:{fullWidth:!1,variant:`primary`},variants:{fullWidth:{false:``,true:`textarea--full-width`},variant:{primary:`textarea--primary`,secondary:`textarea--secondary`}}}),k=n(),A=({className:e,fullWidth:t,variant:n,...r})=>{let i=(0,h.use)(u),a=n??i?.variant;return(0,k.jsx)(l,{"data-slot":`textarea`,className:s(e,O({fullWidth:t,variant:a})),...r})},j=Object.assign(A,{Root:A});function M({copied:e,size:t=14,className:n}){let a=(0,h.useRef)(null),o=(0,h.useRef)(null),s=(0,h.useRef)(!0);return(0,h.useLayoutEffect)(()=>{let t=e?o.current:a.current,n=e?a.current:o.current;if(!t||!n)return;let r={autoAlpha:1,scale:1,filter:`blur(0px)`},i={autoAlpha:0,scale:.5,filter:`blur(4px)`};if(s.current||p()){s.current=!1,d.set(t,r),d.set(n,i);return}d.to(n,{...i,duration:f.fast,ease:m.out,overwrite:!0}),d.fromTo(t,i,{...r,duration:f.base,ease:m.soft,delay:f.instant/2,overwrite:!0})},[e]),(0,k.jsxs)(`span`,{className:`relative inline-grid place-items-center ${n??``}`,style:{width:t,height:t},children:[(0,k.jsx)(`span`,{ref:a,className:`col-start-1 row-start-1 inline-flex`,children:(0,k.jsx)(i,{size:t})}),(0,k.jsx)(`span`,{ref:o,className:`col-start-1 row-start-1 inline-flex text-success`,children:(0,k.jsx)(r,{size:t})})]})}var N=`https://caiaiu.com`;function P({className:e=``}){let{t}=a();return(0,k.jsx)(`p`,{className:`text-caption leading-5 text-muted ${e}`.trim(),children:(0,k.jsx)(`a`,{href:N,target:`_blank`,rel:`noopener noreferrer`,className:`underline-offset-2 transition-colors hover:text-foreground hover:underline`,children:t(`caiaiSoftLink`)})})}export{T as a,D as i,M as n,C as o,j as r,x as s,P as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./Check.es-D8gUNq6Q.js";import{n as i}from"./clipboard-ADnALjHx.js";import{n as a,pt as o}from"./useI18n-BAo1UrJW.js";import{c as s,z as c}from"./SharedElementTransition-BlCsXfb1.js";import{r as l,t as u}from"./textfield-BRcQ6Tsg.js";import{t as d}from"./gsap-DWxn8li7.js";import{v as f,x as p,y as m}from"./index-CWTBzWuK.js";var h=t(e(),1),g=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z`}))]]),_=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),v=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M160,48V208L80,128Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61ZM152,188.69,91.31,128,152,67.31Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M168,48V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,168,48Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M164.24,203.76a6,6,0,1,1-8.48,8.48l-80-80a6,6,0,0,1,0-8.48l80-80a6,6,0,0,1,8.48,8.48L88.49,128Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M162.83,205.17a4,4,0,0,1-5.66,5.66l-80-80a4,4,0,0,1,0-5.66l80-80a4,4,0,1,1,5.66,5.66L85.66,128Z`}))]]),y=new Map([[`bold`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z`}))],[`duotone`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M216,64V192H88V64Z`,opacity:`0.2`}),h.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`fill`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM68,188a12,12,0,1,1,12-12A12,12,0,0,1,68,188Zm0-48a12,12,0,1,1,12-12A12,12,0,0,1,68,140Zm0-48A12,12,0,1,1,80,80,12,12,0,0,1,68,92Zm124,92H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Z`}))],[`light`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M82,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H88A6,6,0,0,1,82,64Zm134,58H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Zm0,64H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12ZM44,54A10,10,0,1,0,54,64,10,10,0,0,0,44,54Zm0,128a10,10,0,1,0,10,10A10,10,0,0,0,44,182Zm0-64a10,10,0,1,0,10,10A10,10,0,0,0,44,118Z`}))],[`regular`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`thin`,h.createElement(h.Fragment,null,h.createElement(`path`,{d:`M84,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H88A4,4,0,0,1,84,64Zm132,60H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Zm0,64H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8ZM44,120a8,8,0,1,0,8,8A8,8,0,0,0,44,120Zm0-64a8,8,0,1,0,8,8A8,8,0,0,0,44,56Zm0,128a8,8,0,1,0,8,8A8,8,0,0,0,44,184Z`}))]]),b=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:g}));b.displayName=`ArrowSquareOutIcon`;var x=b,S=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:_}));S.displayName=`ArrowsClockwiseIcon`;var C=S,w=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:v}));w.displayName=`CaretLeftIcon`;var T=w,E=h.forwardRef((e,t)=>h.createElement(o,{ref:t,...e,weights:y}));E.displayName=`ListBulletsIcon`;var D=E,O=c({base:`textarea`,defaultVariants:{fullWidth:!1,variant:`primary`},variants:{fullWidth:{false:``,true:`textarea--full-width`},variant:{primary:`textarea--primary`,secondary:`textarea--secondary`}}}),k=n(),A=({className:e,fullWidth:t,variant:n,...r})=>{let i=(0,h.use)(u),a=n??i?.variant;return(0,k.jsx)(l,{"data-slot":`textarea`,className:s(e,O({fullWidth:t,variant:a})),...r})},j=Object.assign(A,{Root:A});function M({copied:e,size:t=14,className:n}){let a=(0,h.useRef)(null),o=(0,h.useRef)(null),s=(0,h.useRef)(!0);return(0,h.useLayoutEffect)(()=>{let t=e?o.current:a.current,n=e?a.current:o.current;if(!t||!n)return;let r={autoAlpha:1,scale:1,filter:`blur(0px)`},i={autoAlpha:0,scale:.5,filter:`blur(4px)`};if(s.current||p()){s.current=!1,d.set(t,r),d.set(n,i);return}d.to(n,{...i,duration:f.fast,ease:m.out,overwrite:!0}),d.fromTo(t,i,{...r,duration:f.base,ease:m.soft,delay:f.instant/2,overwrite:!0})},[e]),(0,k.jsxs)(`span`,{className:`relative inline-grid place-items-center ${n??``}`,style:{width:t,height:t},children:[(0,k.jsx)(`span`,{ref:a,className:`col-start-1 row-start-1 inline-flex`,children:(0,k.jsx)(i,{size:t})}),(0,k.jsx)(`span`,{ref:o,className:`col-start-1 row-start-1 inline-flex text-success`,children:(0,k.jsx)(r,{size:t})})]})}var N=`https://caiaiu.com`;function P({className:e=``}){let{t}=a();return(0,k.jsx)(`p`,{className:`text-caption leading-5 text-muted ${e}`.trim(),children:(0,k.jsx)(`a`,{href:N,target:`_blank`,rel:`noopener noreferrer`,className:`underline-offset-2 transition-colors hover:text-foreground hover:underline`,children:t(`caiaiSoftLink`)})})}export{T as a,D as i,M as n,C as o,j as r,x as s,P as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/CaretRight.es-CeI6iKxy.js b/internal/webui/static/assets/CaretRight.es-DLLkzlqU.js similarity index 95% rename from internal/webui/static/assets/CaretRight.es-CeI6iKxy.js rename to internal/webui/static/assets/CaretRight.es-DLLkzlqU.js index e5ccfab32..500b779ed 100644 --- a/internal/webui/static/assets/CaretRight.es-CeI6iKxy.js +++ b/internal/webui/static/assets/CaretRight.es-DLLkzlqU.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-XrvNxGvP.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`CaretRightIcon`;var o=a;export{o as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-BAo1UrJW.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`CaretRightIcon`;var o=a;export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/Check.es-DRxeSSF6.js b/internal/webui/static/assets/Check.es-D8gUNq6Q.js similarity index 95% rename from internal/webui/static/assets/Check.es-DRxeSSF6.js rename to internal/webui/static/assets/Check.es-D8gUNq6Q.js index f5d07311b..334d953c1 100644 --- a/internal/webui/static/assets/Check.es-DRxeSSF6.js +++ b/internal/webui/static/assets/Check.es-D8gUNq6Q.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-XrvNxGvP.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`CheckIcon`;var o=a;export{o as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-BAo1UrJW.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`CheckIcon`;var o=a;export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/Checkbox-Dk73RtP8.js b/internal/webui/static/assets/Checkbox-x9lhPT2J.js similarity index 95% rename from internal/webui/static/assets/Checkbox-Dk73RtP8.js rename to internal/webui/static/assets/Checkbox-x9lhPT2J.js index 1c4171a89..558cc26f2 100644 --- a/internal/webui/static/assets/Checkbox-Dk73RtP8.js +++ b/internal/webui/static/assets/Checkbox-x9lhPT2J.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{E as n,a as r}from"./useI18n-XrvNxGvP.js";import{A as i,F as a,G as o,I as s,J as c,L as l,M as u,Y as d,d as f,j as p,q as m,u as h}from"./SharedElementTransition-BlCsXfb1.js";import{a as g,d as _,l as v,n as y,s as b,u as x}from"./label-B8hTan2F.js";import{t as S}from"./useToggle-55_Qx9vA.js";var C=t(e(),1),w=new WeakMap;function T(e,t,n){let{labelProps:r,inputProps:i,descriptionProps:a,errorMessageProps:o,isSelected:s,isPressed:l,isDisabled:u,isReadOnly:d,isInvalid:f,validationErrors:p,validationDetails:m}=S(e,t,n),{isIndeterminate:h}=e;return(0,C.useEffect)(()=>{n.current&&(n.current.indeterminate=!!h)}),{labelProps:c(r,(0,C.useMemo)(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:i,descriptionProps:a,errorMessageProps:o,isSelected:s,isPressed:l,isDisabled:u,isReadOnly:d,isInvalid:f,validationErrors:p,validationDetails:m}}function E(e,t,n){let r=y({isReadOnly:e.isReadOnly||t.isReadOnly,isSelected:t.isSelected(e.value),defaultSelected:t.defaultValue.includes(e.value),onChange(n){n?t.addValue(e.value):t.removeValue(e.value),e.onChange&&e.onChange(n)}}),{name:i,form:a,descriptionId:o,errorMessageId:s,validationBehavior:c}=w.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=x({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=(0,C.useRef)(v),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};(0,C.useEffect)(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=T({...e,isReadOnly:e.isReadOnly||t.isReadOnly,isDisabled:e.isDisabled||t.isDisabled,name:e.name||i,form:e.form||a,isRequired:e.isRequired??t.isRequired,validationBehavior:c,[b]:{realtimeValidation:f,displayValidation:p,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){u.current=e,d()}}},r,n);return{...m,inputProps:{...m.inputProps,"aria-describedby":[m.inputProps[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}var D=(0,C.createContext)(null),O=(0,C.createContext)(null),k=(0,C.createContext)(null),A=(0,C.createContext)(null),j=(0,C.forwardRef)(function(e,t){let{inputRef:n=null,...o}=e;[e,t]=p(o,t,O);let s=(0,C.useContext)(k),[l,d]=M(e,n),{descriptionProps:f,errorMessageProps:h,isSelected:g,isDisabled:v,isReadOnly:y,isInvalid:b,validationDetails:x,validationErrors:S}=l,w=u({...e,defaultClassName:`react-aria-CheckboxField`,values:{isSelected:g,isIndeterminate:e.isIndeterminate||!1,isDisabled:v,isReadOnly:y,isInvalid:b,isRequired:e.isRequired||!1}}),T=m(e,{global:!0});return delete T.id,delete T.onClick,C.createElement(a.div,{...c(T,w),ref:t,slot:e.slot||void 0,"data-selected":g||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-disabled":v||void 0,"data-readonly":y||void 0,"data-invalid":b||void 0,"data-required":e.isRequired||void 0},C.createElement(i,{values:[[A,{...l,inputRef:d,defaultClassName:`react-aria-CheckboxButton`,isIndeterminate:e.isIndeterminate,isRequired:e.isRequired}],[r,{slots:{description:f,errorMessage:h}}],[_,s?null:{isInvalid:b,validationDetails:x,validationErrors:S}]]},w.children))});function M(e,t){let{validationBehavior:n}=l(g)||{},r=e.validationBehavior??n??`native`,i=(0,C.useContext)(k),a=o((0,C.useMemo)(()=>d(t,e.inputRef===void 0?null:e.inputRef),[t,e.inputRef])),c={...s(e),children:typeof e.children==`function`||e.children,value:e.value,validationBehavior:r};return[i?E(c,i,a):T(c,y(e),a),a]}var N=(0,C.forwardRef)(function(e,t){let{labelProps:r,inputProps:i,isSelected:o,isDisabled:s,isReadOnly:l,isPressed:d,isInvalid:p,inputRef:g,defaultClassName:_,isIndeterminate:v,isRequired:y}=(0,C.useContext)(A),{isFocused:b,isFocusVisible:x,focusProps:S}=f(),w=s||l,{hoverProps:T,isHovered:E}=h({...e,isDisabled:w}),D=u({...e,defaultClassName:_,values:{isSelected:o,isIndeterminate:v||!1,isPressed:d,isHovered:E,isFocused:b,isFocusVisible:x,isDisabled:s,isReadOnly:l,isInvalid:p,isRequired:y||!1}}),O=m(e,{global:!0});return delete O.id,delete O.onClick,C.createElement(a.label,{...c(O,r,T,D),ref:t,slot:e.slot||void 0,"data-selected":o||void 0,"data-indeterminate":v||void 0,"data-pressed":d||void 0,"data-hovered":E||void 0,"data-focused":b||void 0,"data-focus-visible":x||void 0,"data-disabled":s||void 0,"data-readonly":l||void 0,"data-invalid":p||void 0,"data-required":y||void 0},C.createElement(n,{elementType:`span`},C.createElement(`input`,{...c(i,S),ref:g})),D.children)});export{O as i,j as n,D as r,N as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{E as n,a as r}from"./useI18n-BAo1UrJW.js";import{A as i,F as a,G as o,I as s,J as c,L as l,M as u,Y as d,d as f,j as p,q as m,u as h}from"./SharedElementTransition-BlCsXfb1.js";import{a as g,d as _,l as v,n as y,s as b,u as x}from"./label-DYYRLGoV.js";import{t as S}from"./useToggle-DpH7h_oD.js";var C=t(e(),1),w=new WeakMap;function T(e,t,n){let{labelProps:r,inputProps:i,descriptionProps:a,errorMessageProps:o,isSelected:s,isPressed:l,isDisabled:u,isReadOnly:d,isInvalid:f,validationErrors:p,validationDetails:m}=S(e,t,n),{isIndeterminate:h}=e;return(0,C.useEffect)(()=>{n.current&&(n.current.indeterminate=!!h)}),{labelProps:c(r,(0,C.useMemo)(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:i,descriptionProps:a,errorMessageProps:o,isSelected:s,isPressed:l,isDisabled:u,isReadOnly:d,isInvalid:f,validationErrors:p,validationDetails:m}}function E(e,t,n){let r=y({isReadOnly:e.isReadOnly||t.isReadOnly,isSelected:t.isSelected(e.value),defaultSelected:t.defaultValue.includes(e.value),onChange(n){n?t.addValue(e.value):t.removeValue(e.value),e.onChange&&e.onChange(n)}}),{name:i,form:a,descriptionId:o,errorMessageId:s,validationBehavior:c}=w.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=x({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=(0,C.useRef)(v),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};(0,C.useEffect)(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=T({...e,isReadOnly:e.isReadOnly||t.isReadOnly,isDisabled:e.isDisabled||t.isDisabled,name:e.name||i,form:e.form||a,isRequired:e.isRequired??t.isRequired,validationBehavior:c,[b]:{realtimeValidation:f,displayValidation:p,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){u.current=e,d()}}},r,n);return{...m,inputProps:{...m.inputProps,"aria-describedby":[m.inputProps[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}var D=(0,C.createContext)(null),O=(0,C.createContext)(null),k=(0,C.createContext)(null),A=(0,C.createContext)(null),j=(0,C.forwardRef)(function(e,t){let{inputRef:n=null,...o}=e;[e,t]=p(o,t,O);let s=(0,C.useContext)(k),[l,d]=M(e,n),{descriptionProps:f,errorMessageProps:h,isSelected:g,isDisabled:v,isReadOnly:y,isInvalid:b,validationDetails:x,validationErrors:S}=l,w=u({...e,defaultClassName:`react-aria-CheckboxField`,values:{isSelected:g,isIndeterminate:e.isIndeterminate||!1,isDisabled:v,isReadOnly:y,isInvalid:b,isRequired:e.isRequired||!1}}),T=m(e,{global:!0});return delete T.id,delete T.onClick,C.createElement(a.div,{...c(T,w),ref:t,slot:e.slot||void 0,"data-selected":g||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-disabled":v||void 0,"data-readonly":y||void 0,"data-invalid":b||void 0,"data-required":e.isRequired||void 0},C.createElement(i,{values:[[A,{...l,inputRef:d,defaultClassName:`react-aria-CheckboxButton`,isIndeterminate:e.isIndeterminate,isRequired:e.isRequired}],[r,{slots:{description:f,errorMessage:h}}],[_,s?null:{isInvalid:b,validationDetails:x,validationErrors:S}]]},w.children))});function M(e,t){let{validationBehavior:n}=l(g)||{},r=e.validationBehavior??n??`native`,i=(0,C.useContext)(k),a=o((0,C.useMemo)(()=>d(t,e.inputRef===void 0?null:e.inputRef),[t,e.inputRef])),c={...s(e),children:typeof e.children==`function`||e.children,value:e.value,validationBehavior:r};return[i?E(c,i,a):T(c,y(e),a),a]}var N=(0,C.forwardRef)(function(e,t){let{labelProps:r,inputProps:i,isSelected:o,isDisabled:s,isReadOnly:l,isPressed:d,isInvalid:p,inputRef:g,defaultClassName:_,isIndeterminate:v,isRequired:y}=(0,C.useContext)(A),{isFocused:b,isFocusVisible:x,focusProps:S}=f(),w=s||l,{hoverProps:T,isHovered:E}=h({...e,isDisabled:w}),D=u({...e,defaultClassName:_,values:{isSelected:o,isIndeterminate:v||!1,isPressed:d,isHovered:E,isFocused:b,isFocusVisible:x,isDisabled:s,isReadOnly:l,isInvalid:p,isRequired:y||!1}}),O=m(e,{global:!0});return delete O.id,delete O.onClick,C.createElement(a.label,{...c(O,r,T,D),ref:t,slot:e.slot||void 0,"data-selected":o||void 0,"data-indeterminate":v||void 0,"data-pressed":d||void 0,"data-hovered":E||void 0,"data-focused":b||void 0,"data-focus-visible":x||void 0,"data-disabled":s||void 0,"data-readonly":l||void 0,"data-invalid":p||void 0,"data-required":y||void 0},C.createElement(n,{elementType:`span`},C.createElement(`input`,{...c(i,S),ref:g})),D.children)});export{O as i,j as n,D as r,N as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/CompactSwitch-Dd3U4EbK.js b/internal/webui/static/assets/CompactSwitch-D0aW-Phm.js similarity index 95% rename from internal/webui/static/assets/CompactSwitch-Dd3U4EbK.js rename to internal/webui/static/assets/CompactSwitch-D0aW-Phm.js index f37dec946..da41fe8fb 100644 --- a/internal/webui/static/assets/CompactSwitch-Dd3U4EbK.js +++ b/internal/webui/static/assets/CompactSwitch-D0aW-Phm.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{E as r,a as i}from"./useI18n-XrvNxGvP.js";import{A as a,B as o,F as s,G as c,I as l,J as u,L as d,M as f,Y as p,c as m,d as h,j as g,q as _,s as v,u as y,z as b}from"./SharedElementTransition-BlCsXfb1.js";import{a as x,d as S,n as C,t as w}from"./label-B8hTan2F.js";import{t as T}from"./useToggle-55_Qx9vA.js";var E=b({defaultVariants:{size:`md`},slots:{base:`switch`,content:`switch__content`,control:`switch__control`,icon:`switch__icon`,thumb:`switch__thumb`},variants:{size:{lg:{base:`switch--lg`},md:{base:`switch--md`},sm:{base:`switch--sm`}}}});function D(e,t,n){let{labelProps:r,inputProps:i,isSelected:a,...o}=T(e,t,n);return{labelProps:r,inputProps:{...i,role:`switch`,checked:a},isSelected:a,...o}}var O=t(e(),1),k=(0,O.createContext)(null),A=(0,O.createContext)(null),j=(0,O.createContext)(null),M=(0,O.forwardRef)(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=g(r,t,k);let{validationBehavior:o}=d(x)||{},m=e.validationBehavior??o??`native`,h=c(p(n,e.inputRef===void 0?null:e.inputRef)),v=C(e),y=D({...l(e),children:typeof e.children==`function`||e.children,validationBehavior:m},v,h),{descriptionProps:b,errorMessageProps:w,isSelected:T,isDisabled:E,isReadOnly:M,isInvalid:N,validationDetails:P,validationErrors:F}=y,I=f({...e,defaultClassName:`react-aria-SwitchField`,values:{isSelected:T,isDisabled:E,isReadOnly:M,isInvalid:N,isRequired:e.isRequired||!1,state:v}}),L=_(e,{global:!0});return delete L.id,delete L.onClick,O.createElement(s.div,{...u(L,I),ref:t,slot:e.slot||void 0,"data-selected":T||void 0,"data-disabled":E||void 0,"data-readonly":M||void 0,"data-invalid":N||void 0,"data-required":e.isRequired||void 0},O.createElement(a,{values:[[A,v],[j,{...y,inputRef:h,defaultClassName:`react-aria-SwitchButton`,isRequired:e.isRequired}],[i,{slots:{description:b,errorMessage:w}}],[S,{isInvalid:N,validationDetails:P,validationErrors:F}]]},I.children))}),N=(0,O.forwardRef)(function(e,t){let{labelProps:n,inputProps:i,isSelected:a,isDisabled:o,isReadOnly:c,isPressed:l,isInvalid:d,inputRef:p,defaultClassName:m,isRequired:g}=(0,O.useContext)(j),{isFocused:v,isFocusVisible:b,focusProps:x}=h(),S=o||c,C=(0,O.useContext)(A),{hoverProps:w,isHovered:T}=y({...e,isDisabled:S}),E=f({...e,defaultClassName:m,values:{isSelected:a,isPressed:l,isHovered:T,isFocused:v,isFocusVisible:b,isDisabled:o,isReadOnly:c,isInvalid:d,isRequired:g||!1,state:C}}),D=_(e,{global:!0});return delete D.id,delete D.onClick,O.createElement(s.label,{...u(D,n,w,E),ref:t,slot:e.slot||void 0,"data-selected":a||void 0,"data-pressed":l||void 0,"data-hovered":T||void 0,"data-focused":v||void 0,"data-focus-visible":b||void 0,"data-disabled":o||void 0,"data-readonly":c||void 0,"data-invalid":d||void 0,"data-required":g||void 0},O.createElement(r,{elementType:`span`},O.createElement(`input`,{...u(i,x),ref:p})),E.children)}),P=n(),F=(0,O.createContext)({}),I=({children:e,className:t,size:n,...r})=>{let i=O.useMemo(()=>E({size:n}),[n]);return(0,P.jsx)(M,{"data-slot":`switch`,...r,className:m(t,i.base()),children:t=>(0,P.jsx)(F,{value:{slots:i,state:t},children:typeof e==`function`?e(t):e})})};I.displayName=`HeroUI.Switch`;var L=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(N,{"data-slot":`switch-content`,...n,className:m(t,r?.content()),children:e})};L.displayName=`HeroUI.Switch.Content`;var R=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(o.span,{className:v(r?.control,t),"data-slot":`switch-control`,...n,children:e})};R.displayName=`HeroUI.Switch.Control`;var z=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(o.span,{className:v(r?.thumb,t),"data-slot":`switch-thumb`,...n,children:e})};z.displayName=`HeroUI.Switch.Thumb`;var B=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(o.span,{className:v(r?.icon,t),"data-slot":`switch-icon`,...n,children:e})};B.displayName=`HeroUI.Switch.Icon`;var V=Object.assign(I,{Root:I,Content:L,Control:R,Thumb:z,Icon:B});function H({isSelected:e,isDisabled:t,ariaLabel:n,label:r,size:i=`sm`,onChange:a}){return(0,P.jsx)(V,{size:i,isSelected:e,isDisabled:t,onChange:a,children:(0,P.jsxs)(V.Content,{children:[(0,P.jsx)(V.Control,{children:(0,P.jsx)(V.Thumb,{})}),r?(0,P.jsx)(w,{children:r}):(0,P.jsx)(`span`,{className:`sr-only`,children:n})]})})}export{H as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{E as r,a as i}from"./useI18n-BAo1UrJW.js";import{A as a,B as o,F as s,G as c,I as l,J as u,L as d,M as f,Y as p,c as m,d as h,j as g,q as _,s as v,u as y,z as b}from"./SharedElementTransition-BlCsXfb1.js";import{a as x,d as S,n as C,t as w}from"./label-DYYRLGoV.js";import{t as T}from"./useToggle-DpH7h_oD.js";var E=b({defaultVariants:{size:`md`},slots:{base:`switch`,content:`switch__content`,control:`switch__control`,icon:`switch__icon`,thumb:`switch__thumb`},variants:{size:{lg:{base:`switch--lg`},md:{base:`switch--md`},sm:{base:`switch--sm`}}}});function D(e,t,n){let{labelProps:r,inputProps:i,isSelected:a,...o}=T(e,t,n);return{labelProps:r,inputProps:{...i,role:`switch`,checked:a},isSelected:a,...o}}var O=t(e(),1),k=(0,O.createContext)(null),A=(0,O.createContext)(null),j=(0,O.createContext)(null),M=(0,O.forwardRef)(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=g(r,t,k);let{validationBehavior:o}=d(x)||{},m=e.validationBehavior??o??`native`,h=c(p(n,e.inputRef===void 0?null:e.inputRef)),v=C(e),y=D({...l(e),children:typeof e.children==`function`||e.children,validationBehavior:m},v,h),{descriptionProps:b,errorMessageProps:w,isSelected:T,isDisabled:E,isReadOnly:M,isInvalid:N,validationDetails:P,validationErrors:F}=y,I=f({...e,defaultClassName:`react-aria-SwitchField`,values:{isSelected:T,isDisabled:E,isReadOnly:M,isInvalid:N,isRequired:e.isRequired||!1,state:v}}),L=_(e,{global:!0});return delete L.id,delete L.onClick,O.createElement(s.div,{...u(L,I),ref:t,slot:e.slot||void 0,"data-selected":T||void 0,"data-disabled":E||void 0,"data-readonly":M||void 0,"data-invalid":N||void 0,"data-required":e.isRequired||void 0},O.createElement(a,{values:[[A,v],[j,{...y,inputRef:h,defaultClassName:`react-aria-SwitchButton`,isRequired:e.isRequired}],[i,{slots:{description:b,errorMessage:w}}],[S,{isInvalid:N,validationDetails:P,validationErrors:F}]]},I.children))}),N=(0,O.forwardRef)(function(e,t){let{labelProps:n,inputProps:i,isSelected:a,isDisabled:o,isReadOnly:c,isPressed:l,isInvalid:d,inputRef:p,defaultClassName:m,isRequired:g}=(0,O.useContext)(j),{isFocused:v,isFocusVisible:b,focusProps:x}=h(),S=o||c,C=(0,O.useContext)(A),{hoverProps:w,isHovered:T}=y({...e,isDisabled:S}),E=f({...e,defaultClassName:m,values:{isSelected:a,isPressed:l,isHovered:T,isFocused:v,isFocusVisible:b,isDisabled:o,isReadOnly:c,isInvalid:d,isRequired:g||!1,state:C}}),D=_(e,{global:!0});return delete D.id,delete D.onClick,O.createElement(s.label,{...u(D,n,w,E),ref:t,slot:e.slot||void 0,"data-selected":a||void 0,"data-pressed":l||void 0,"data-hovered":T||void 0,"data-focused":v||void 0,"data-focus-visible":b||void 0,"data-disabled":o||void 0,"data-readonly":c||void 0,"data-invalid":d||void 0,"data-required":g||void 0},O.createElement(r,{elementType:`span`},O.createElement(`input`,{...u(i,x),ref:p})),E.children)}),P=n(),F=(0,O.createContext)({}),I=({children:e,className:t,size:n,...r})=>{let i=O.useMemo(()=>E({size:n}),[n]);return(0,P.jsx)(M,{"data-slot":`switch`,...r,className:m(t,i.base()),children:t=>(0,P.jsx)(F,{value:{slots:i,state:t},children:typeof e==`function`?e(t):e})})};I.displayName=`HeroUI.Switch`;var L=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(N,{"data-slot":`switch-content`,...n,className:m(t,r?.content()),children:e})};L.displayName=`HeroUI.Switch.Content`;var R=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(o.span,{className:v(r?.control,t),"data-slot":`switch-control`,...n,children:e})};R.displayName=`HeroUI.Switch.Control`;var z=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(o.span,{className:v(r?.thumb,t),"data-slot":`switch-thumb`,...n,children:e})};z.displayName=`HeroUI.Switch.Thumb`;var B=({children:e,className:t,...n})=>{let{slots:r}=(0,O.use)(F);return(0,P.jsx)(o.span,{className:v(r?.icon,t),"data-slot":`switch-icon`,...n,children:e})};B.displayName=`HeroUI.Switch.Icon`;var V=Object.assign(I,{Root:I,Content:L,Control:R,Thumb:z,Icon:B});function H({isSelected:e,isDisabled:t,ariaLabel:n,label:r,size:i=`sm`,onChange:a}){return(0,P.jsx)(V,{size:i,isSelected:e,isDisabled:t,onChange:a,children:(0,P.jsxs)(V.Content,{children:[(0,P.jsx)(V.Control,{children:(0,P.jsx)(V.Thumb,{})}),r?(0,P.jsx)(w,{children:r}):(0,P.jsx)(`span`,{className:`sr-only`,children:n})]})})}export{H as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/ConfirmDialog-DCaOykOx.js b/internal/webui/static/assets/ConfirmDialog-BzgkrQpc.js similarity index 97% rename from internal/webui/static/assets/ConfirmDialog-DCaOykOx.js rename to internal/webui/static/assets/ConfirmDialog-BzgkrQpc.js index 2d426d83a..2c4136fa9 100644 --- a/internal/webui/static/assets/ConfirmDialog-DCaOykOx.js +++ b/internal/webui/static/assets/ConfirmDialog-BzgkrQpc.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{J as r,R as i,Y as a,q as o,r as s}from"./useI18n-XrvNxGvP.js";import{B as c,c as l,s as u,z as d}from"./SharedElementTransition-BlCsXfb1.js";import{t as f}from"./Pressable-cqucQpxg.js";import{B as p,H as m,St as h,U as g,V as _,z as v}from"./index-CAlyInAP.js";var y=d({defaultVariants:{size:`md`,status:`danger`,variant:`opaque`},slots:{backdrop:`alert-dialog__backdrop`,body:`alert-dialog__body`,closeTrigger:`alert-dialog__close-trigger`,container:`alert-dialog__container`,dialog:`alert-dialog__dialog`,footer:`alert-dialog__footer`,header:`alert-dialog__header`,heading:`alert-dialog__heading`,icon:`alert-dialog__icon`,trigger:`alert-dialog__trigger`},variants:{size:{cover:{dialog:`alert-dialog__dialog--cover`},lg:{dialog:`alert-dialog__dialog--lg`},md:{dialog:`alert-dialog__dialog--md`},sm:{dialog:`alert-dialog__dialog--sm`},xs:{dialog:`alert-dialog__dialog--xs`}},status:{accent:{icon:`alert-dialog__icon--accent`},danger:{icon:`alert-dialog__icon--danger`},default:{icon:`alert-dialog__icon--default`},success:{icon:`alert-dialog__icon--success`},warning:{icon:`alert-dialog__icon--warning`}},variant:{blur:{backdrop:`alert-dialog__backdrop--blur`},opaque:{backdrop:`alert-dialog__backdrop--opaque`},transparent:{backdrop:`alert-dialog__backdrop--transparent`}}}}),b=t(e(),1),x=n(),S=(0,b.createContext)({}),C=({children:e,...t})=>{let n=(0,b.useMemo)(()=>({slots:y(),placement:void 0}),[]);return(0,x.jsx)(S,{value:n,children:(0,x.jsx)(m,{"data-slot":`alert-dialog-root`,...t,children:e})})},w=Object.assign(C,{Root:C,Trigger:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(f,{children:(0,x.jsx)(`div`,{className:u(r?.trigger,t),"data-slot":`alert-dialog-trigger`,role:`button`,...n,children:e})})},Backdrop:({children:e,className:t,isDismissable:n=!1,isKeyboardDismissDisabled:r=!0,onClick:i,variant:a,...o})=>{let{slots:s}=(0,b.use)(S),c=(0,b.useMemo)(()=>y({variant:a}),[a]),u=(0,b.useMemo)(()=>({slots:{...s,...c}}),[s,c]);return(0,x.jsx)(_,{className:l(t,c?.backdrop()),"data-slot":`alert-dialog-backdrop`,isDismissable:n,isKeyboardDismissDisabled:r,onClick:e=>{e.stopPropagation(),i?.(e)},...o,children:t=>(0,x.jsxs)(S,{value:u,children:[typeof e==`function`?e(t):e,` `]})})},Container:({children:e,className:t,placement:n=`auto`,size:r,...i})=>{let{slots:a}=(0,b.use)(S),o=(0,b.useMemo)(()=>y({size:r}),[r]),s=(0,b.useMemo)(()=>({placement:n,slots:{...a,...o}}),[n,a,o]);return(0,x.jsx)(p,{className:l(t,o?.container()),"data-placement":n,"data-slot":`alert-dialog-container`,...i,children:t=>(0,x.jsx)(S,{value:s,children:typeof e==`function`?e(t):e})})},Dialog:({children:e,className:t,...n})=>{let{placement:r,slots:i}=(0,b.use)(S);return(0,x.jsx)(g,{className:u(i?.dialog,t),"data-placement":r,"data-slot":`alert-dialog-dialog`,role:`alertdialog`,...n,children:e})},Header:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(`div`,{className:u(r?.header,t),"data-slot":`alert-dialog-header`,...n,children:e})},Heading:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(h,{className:u(r?.heading,t),"data-slot":`alert-dialog-heading`,slot:`title`,...n,children:e})},Body:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(`div`,{className:u(r?.body,t),"data-slot":`alert-dialog-body`,...n,children:e})},Footer:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(`div`,{className:u(r?.footer,t),"data-slot":`alert-dialog-footer`,...n,children:e})},Icon:({children:e,className:t,status:n=`danger`,...s})=>{let l=(0,b.useMemo)(()=>y({status:n}),[n]),u=()=>{switch(n){case`default`:return(0,x.jsx)(o,{"data-slot":`alert-dialog-default-icon`});case`accent`:return(0,x.jsx)(o,{"data-slot":`alert-dialog-default-icon`});case`success`:return(0,x.jsx)(r,{"data-slot":`alert-dialog-default-icon`});case`warning`:return(0,x.jsx)(a,{"data-slot":`alert-dialog-default-icon`});case`danger`:return(0,x.jsx)(i,{"data-slot":`alert-dialog-default-icon`});default:return(0,x.jsx)(i,{"data-slot":`alert-dialog-default-icon`})}};return(0,x.jsx)(c.div,{className:l?.icon({className:t}),"data-slot":`alert-dialog-icon`,...s,children:e??u()})},CloseTrigger:({className:e,...t})=>{let{slots:n}=(0,b.use)(S);return(0,x.jsx)(v,{className:l(e,n?.closeTrigger()),"data-slot":`alert-dialog-close-trigger`,slot:`close`,...t})}});function T({isOpen:e,title:t,description:n,confirmLabel:r,cancelLabel:i,closeLabel:a,isPending:o,status:c=`danger`,confirmVariant:l=`danger`,onClose:u,onConfirm:d}){return(0,x.jsx)(w.Root,{isOpen:e,onOpenChange:e=>{!e&&!o&&u()},children:(0,x.jsx)(w.Backdrop,{variant:`blur`,isDismissable:!o,children:(0,x.jsx)(w.Container,{placement:`center`,size:`sm`,children:(0,x.jsxs)(w.Dialog,{children:[(0,x.jsxs)(w.Header,{className:`items-start justify-between gap-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,x.jsx)(w.Icon,{status:c}),(0,x.jsx)(`div`,{children:(0,x.jsx)(w.Heading,{children:t})})]}),(0,x.jsx)(w.CloseTrigger,{isDisabled:o,"aria-label":a})]}),(0,x.jsx)(w.Body,{children:(0,x.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:n})}),(0,x.jsxs)(w.Footer,{children:[(0,x.jsx)(s,{size:`sm`,variant:`ghost`,isDisabled:o,onPress:u,children:i}),(0,x.jsx)(s,{size:`sm`,variant:l,isPending:o,onPress:d,children:r})]})]})})})})}export{T as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{J as r,R as i,Y as a,q as o,r as s}from"./useI18n-BAo1UrJW.js";import{B as c,c as l,s as u,z as d}from"./SharedElementTransition-BlCsXfb1.js";import{t as f}from"./Pressable-cqucQpxg.js";import{B as p,H as m,St as h,U as g,V as _,z as v}from"./index-CWTBzWuK.js";var y=d({defaultVariants:{size:`md`,status:`danger`,variant:`opaque`},slots:{backdrop:`alert-dialog__backdrop`,body:`alert-dialog__body`,closeTrigger:`alert-dialog__close-trigger`,container:`alert-dialog__container`,dialog:`alert-dialog__dialog`,footer:`alert-dialog__footer`,header:`alert-dialog__header`,heading:`alert-dialog__heading`,icon:`alert-dialog__icon`,trigger:`alert-dialog__trigger`},variants:{size:{cover:{dialog:`alert-dialog__dialog--cover`},lg:{dialog:`alert-dialog__dialog--lg`},md:{dialog:`alert-dialog__dialog--md`},sm:{dialog:`alert-dialog__dialog--sm`},xs:{dialog:`alert-dialog__dialog--xs`}},status:{accent:{icon:`alert-dialog__icon--accent`},danger:{icon:`alert-dialog__icon--danger`},default:{icon:`alert-dialog__icon--default`},success:{icon:`alert-dialog__icon--success`},warning:{icon:`alert-dialog__icon--warning`}},variant:{blur:{backdrop:`alert-dialog__backdrop--blur`},opaque:{backdrop:`alert-dialog__backdrop--opaque`},transparent:{backdrop:`alert-dialog__backdrop--transparent`}}}}),b=t(e(),1),x=n(),S=(0,b.createContext)({}),C=({children:e,...t})=>{let n=(0,b.useMemo)(()=>({slots:y(),placement:void 0}),[]);return(0,x.jsx)(S,{value:n,children:(0,x.jsx)(m,{"data-slot":`alert-dialog-root`,...t,children:e})})},w=Object.assign(C,{Root:C,Trigger:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(f,{children:(0,x.jsx)(`div`,{className:u(r?.trigger,t),"data-slot":`alert-dialog-trigger`,role:`button`,...n,children:e})})},Backdrop:({children:e,className:t,isDismissable:n=!1,isKeyboardDismissDisabled:r=!0,onClick:i,variant:a,...o})=>{let{slots:s}=(0,b.use)(S),c=(0,b.useMemo)(()=>y({variant:a}),[a]),u=(0,b.useMemo)(()=>({slots:{...s,...c}}),[s,c]);return(0,x.jsx)(_,{className:l(t,c?.backdrop()),"data-slot":`alert-dialog-backdrop`,isDismissable:n,isKeyboardDismissDisabled:r,onClick:e=>{e.stopPropagation(),i?.(e)},...o,children:t=>(0,x.jsxs)(S,{value:u,children:[typeof e==`function`?e(t):e,` `]})})},Container:({children:e,className:t,placement:n=`auto`,size:r,...i})=>{let{slots:a}=(0,b.use)(S),o=(0,b.useMemo)(()=>y({size:r}),[r]),s=(0,b.useMemo)(()=>({placement:n,slots:{...a,...o}}),[n,a,o]);return(0,x.jsx)(p,{className:l(t,o?.container()),"data-placement":n,"data-slot":`alert-dialog-container`,...i,children:t=>(0,x.jsx)(S,{value:s,children:typeof e==`function`?e(t):e})})},Dialog:({children:e,className:t,...n})=>{let{placement:r,slots:i}=(0,b.use)(S);return(0,x.jsx)(g,{className:u(i?.dialog,t),"data-placement":r,"data-slot":`alert-dialog-dialog`,role:`alertdialog`,...n,children:e})},Header:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(`div`,{className:u(r?.header,t),"data-slot":`alert-dialog-header`,...n,children:e})},Heading:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(h,{className:u(r?.heading,t),"data-slot":`alert-dialog-heading`,slot:`title`,...n,children:e})},Body:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(`div`,{className:u(r?.body,t),"data-slot":`alert-dialog-body`,...n,children:e})},Footer:({children:e,className:t,...n})=>{let{slots:r}=(0,b.use)(S);return(0,x.jsx)(`div`,{className:u(r?.footer,t),"data-slot":`alert-dialog-footer`,...n,children:e})},Icon:({children:e,className:t,status:n=`danger`,...s})=>{let l=(0,b.useMemo)(()=>y({status:n}),[n]),u=()=>{switch(n){case`default`:return(0,x.jsx)(o,{"data-slot":`alert-dialog-default-icon`});case`accent`:return(0,x.jsx)(o,{"data-slot":`alert-dialog-default-icon`});case`success`:return(0,x.jsx)(r,{"data-slot":`alert-dialog-default-icon`});case`warning`:return(0,x.jsx)(a,{"data-slot":`alert-dialog-default-icon`});case`danger`:return(0,x.jsx)(i,{"data-slot":`alert-dialog-default-icon`});default:return(0,x.jsx)(i,{"data-slot":`alert-dialog-default-icon`})}};return(0,x.jsx)(c.div,{className:l?.icon({className:t}),"data-slot":`alert-dialog-icon`,...s,children:e??u()})},CloseTrigger:({className:e,...t})=>{let{slots:n}=(0,b.use)(S);return(0,x.jsx)(v,{className:l(e,n?.closeTrigger()),"data-slot":`alert-dialog-close-trigger`,slot:`close`,...t})}});function T({isOpen:e,title:t,description:n,confirmLabel:r,cancelLabel:i,closeLabel:a,isPending:o,status:c=`danger`,confirmVariant:l=`danger`,onClose:u,onConfirm:d}){return(0,x.jsx)(w.Root,{isOpen:e,onOpenChange:e=>{!e&&!o&&u()},children:(0,x.jsx)(w.Backdrop,{variant:`blur`,isDismissable:!o,children:(0,x.jsx)(w.Container,{placement:`center`,size:`sm`,children:(0,x.jsxs)(w.Dialog,{children:[(0,x.jsxs)(w.Header,{className:`items-start justify-between gap-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,x.jsx)(w.Icon,{status:c}),(0,x.jsx)(`div`,{children:(0,x.jsx)(w.Heading,{children:t})})]}),(0,x.jsx)(w.CloseTrigger,{isDisabled:o,"aria-label":a})]}),(0,x.jsx)(w.Body,{children:(0,x.jsx)(`p`,{className:`text-body leading-6 text-muted`,children:n})}),(0,x.jsxs)(w.Footer,{children:[(0,x.jsx)(s,{size:`sm`,variant:`ghost`,isDisabled:o,onPress:u,children:i}),(0,x.jsx)(s,{size:`sm`,variant:l,isPending:o,onPress:d,children:r})]})]})})})})}export{T as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/CostChart-CU1OvAf-.js b/internal/webui/static/assets/CostChart-CuE2RBUk.js similarity index 98% rename from internal/webui/static/assets/CostChart-CU1OvAf-.js rename to internal/webui/static/assets/CostChart-CuE2RBUk.js index 3902a47fc..a5ba06407 100644 --- a/internal/webui/static/assets/CostChart-CU1OvAf-.js +++ b/internal/webui/static/assets/CostChart-CuE2RBUk.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{i as r,o as i,r as a}from"./format-FfdyoNtB.js";import{Tt as o,a as s,r as c,t as l}from"./AreaChart-BDsZfavt.js";import{n as u,r as d,t as f}from"./XAxis-D-mwlVQJ.js";var p=t(e(),1),m=n(),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`?a(e):t===`tokens`?r(e):i(e)}function y(e,t){return t===`cost`?`¥${e>=10?Math.round(e):Number(e.toFixed(1))}`:t===`tokens`?r(e):i(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: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)(o,{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-${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)(u,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,m.jsx)(f,{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)(c,{width:52,tickLine:!1,axisLine:!1,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>y(e,a)}),(0,m.jsx)(d,{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)(s,{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 +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{i as r,o as i,r as a}from"./format-BAkFbjAh.js";import{Tt as o,a as s,r as c,t as l}from"./AreaChart-BDsZfavt.js";import{n as u,r as d,t as f}from"./XAxis-D-mwlVQJ.js";var p=t(e(),1),m=n(),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`?a(e):t===`tokens`?r(e):i(e)}function y(e,t){return t===`cost`?`¥${e>=10?Math.round(e):Number(e.toFixed(1))}`:t===`tokens`?r(e):i(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: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)(o,{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-${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)(u,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,m.jsx)(f,{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)(c,{width:52,tickLine:!1,axisLine:!1,tick:{fill:`var(--muted)`,fontSize:10,fontFamily:`var(--font-mono)`},tickFormatter:e=>y(e,a)}),(0,m.jsx)(d,{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)(s,{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/DragAndDrop-DdMlSxLf.js b/internal/webui/static/assets/DragAndDrop-QLaADEWb.js similarity index 99% rename from internal/webui/static/assets/DragAndDrop-DdMlSxLf.js rename to internal/webui/static/assets/DragAndDrop-QLaADEWb.js index ed44359a2..d808f41a4 100644 --- a/internal/webui/static/assets/DragAndDrop-DdMlSxLf.js +++ b/internal/webui/static/assets/DragAndDrop-QLaADEWb.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{W as n,dt as r}from"./SharedElementTransition-BlCsXfb1.js";import{Et as i}from"./index-CAlyInAP.js";var a=t(e(),1);function o(e,t){let{collection:o,onLoadMore:s,scrollOffset:c=1,direction:l=`end`}=e,u=(0,a.useRef)(null),d=n(e=>{for(let t of e)t.isIntersecting&&s&&s()});r(()=>{if(t.current){let e=100*c,n=l===`start`?`${e}% 0px 0px 0px`:`0px ${e}% ${e}% ${e}%`;u.current=new IntersectionObserver(d,{root:i(t?.current),rootMargin:n}),u.current.observe(t.current)}return()=>{u.current&&u.current.disconnect()}},[o,t,c,l])}function s(e){let t=a.version.split(`.`);return parseInt(t[0],10)>=19?e:e?`true`:void 0}var c={};c={colorSwatchPicker:`تغييرات الألوان`,dropzoneLabel:`DropZone`,selectPlaceholder:`حدد عنصرًا`,tableResizer:`أداة تغيير الحجم`};var l={};l={colorSwatchPicker:`Цветови мостри`,dropzoneLabel:`DropZone`,selectPlaceholder:`Изберете предмет`,tableResizer:`Преоразмерител`};var u={};u={colorSwatchPicker:`Vzorky barev`,dropzoneLabel:`Místo pro přetažení`,selectPlaceholder:`Vyberte položku`,tableResizer:`Změna velikosti`};var d={};d={colorSwatchPicker:`Farveprøver`,dropzoneLabel:`DropZone`,selectPlaceholder:`Vælg et element`,tableResizer:`Størrelsesændring`};var f={};f={colorSwatchPicker:`Farbfelder`,dropzoneLabel:`Ablegebereich`,selectPlaceholder:`Element wählen`,tableResizer:`Größenanpassung`};var p={};p={colorSwatchPicker:`Χρωματικά δείγματα`,dropzoneLabel:`DropZone`,selectPlaceholder:`Επιλέξτε ένα αντικείμενο`,tableResizer:`Αλλαγή μεγέθους`};var m={};m={selectPlaceholder:`Select an item`,tableResizer:`Resizer`,dropzoneLabel:`DropZone`,colorSwatchPicker:`Color swatches`};var h={};h={colorSwatchPicker:`Muestras de colores`,dropzoneLabel:`DropZone`,selectPlaceholder:`Seleccionar un artículo`,tableResizer:`Cambiador de tamaño`};var g={};g={colorSwatchPicker:`Värvinäidised`,dropzoneLabel:`DropZone`,selectPlaceholder:`Valige üksus`,tableResizer:`Suuruse muutja`};var _={};_={colorSwatchPicker:`Värimallit`,dropzoneLabel:`DropZone`,selectPlaceholder:`Valitse kohde`,tableResizer:`Koon muuttaja`};var v={};v={colorSwatchPicker:`Échantillons de couleurs`,dropzoneLabel:`DropZone`,selectPlaceholder:`Sélectionner un élément`,tableResizer:`Redimensionneur`};var y={};y={colorSwatchPicker:`דוגמיות צבע`,dropzoneLabel:`DropZone`,selectPlaceholder:`בחר פריט`,tableResizer:`שינוי גודל`};var b={};b={colorSwatchPicker:`Uzorci boja`,dropzoneLabel:`Zona spuštanja`,selectPlaceholder:`Odaberite stavku`,tableResizer:`Promjena veličine`};var x={};x={colorSwatchPicker:`Színtárak`,dropzoneLabel:`DropZone`,selectPlaceholder:`Válasszon ki egy elemet`,tableResizer:`Átméretező`};var S={};S={colorSwatchPicker:`Campioni di colore`,dropzoneLabel:`Zona di rilascio`,selectPlaceholder:`Seleziona un elemento`,tableResizer:`Ridimensionamento`};var C={};C={colorSwatchPicker:`カラースウォッチ`,dropzoneLabel:`ドロップゾーン`,selectPlaceholder:`項目を選択`,tableResizer:`サイズ変更ツール`};var w={};w={colorSwatchPicker:`색상 견본`,dropzoneLabel:`드롭 영역`,selectPlaceholder:`항목 선택`,tableResizer:`크기 조정기`};var T={};T={colorSwatchPicker:`Spalvų pavyzdžiai`,dropzoneLabel:`„DropZone“`,selectPlaceholder:`Pasirinkite elementą`,tableResizer:`Dydžio keitiklis`};var E={};E={colorSwatchPicker:`Krāsu paraugi`,dropzoneLabel:`DropZone`,selectPlaceholder:`Izvēlēties vienumu`,tableResizer:`Izmēra mainītājs`};var D={};D={colorSwatchPicker:`Fargekart`,dropzoneLabel:`Droppsone`,selectPlaceholder:`Velg et element`,tableResizer:`Størrelsesendrer`};var O={};O={colorSwatchPicker:`kleurstalen`,dropzoneLabel:`DropZone`,selectPlaceholder:`Selecteer een item`,tableResizer:`Resizer`};var k={};k={colorSwatchPicker:`Próbki kolorów`,dropzoneLabel:`Strefa upuszczania`,selectPlaceholder:`Wybierz element`,tableResizer:`Zmiana rozmiaru`};var A={};A={colorSwatchPicker:`Amostras de cores`,dropzoneLabel:`DropZone`,selectPlaceholder:`Selecione um item`,tableResizer:`Redimensionador`};var j={};j={colorSwatchPicker:`Amostras de cores`,dropzoneLabel:`DropZone`,selectPlaceholder:`Selecione um item`,tableResizer:`Redimensionador`};var M={};M={colorSwatchPicker:`Specimene de culoare`,dropzoneLabel:`Zonă de plasare`,selectPlaceholder:`Selectați un element`,tableResizer:`Instrument de redimensionare`};var N={};N={colorSwatchPicker:`Цветовые образцы`,dropzoneLabel:`DropZone`,selectPlaceholder:`Выберите элемент`,tableResizer:`Средство изменения размера`};var P={};P={colorSwatchPicker:`Vzorkovníky farieb`,dropzoneLabel:`DropZone`,selectPlaceholder:`Vyberte položku`,tableResizer:`Nástroj na zmenu veľkosti`};var F={};F={colorSwatchPicker:`Barvne palete`,dropzoneLabel:`DropZone`,selectPlaceholder:`Izberite element`,tableResizer:`Spreminjanje velikosti`};var I={};I={colorSwatchPicker:`Uzorci boje`,dropzoneLabel:`DropZone`,selectPlaceholder:`Izaberite stavku`,tableResizer:`Promena veličine`};var L={};L={colorSwatchPicker:`Färgrutor`,dropzoneLabel:`DropZone`,selectPlaceholder:`Välj en artikel`,tableResizer:`Storleksändrare`};var R={};R={colorSwatchPicker:`Renk örnekleri`,dropzoneLabel:`Bırakma Bölgesi`,selectPlaceholder:`Bir öğe seçin`,tableResizer:`Yeniden boyutlandırıcı`};var z={};z={colorSwatchPicker:`Зразки кольорів`,dropzoneLabel:`DropZone`,selectPlaceholder:`Виберіть елемент`,tableResizer:`Засіб змінення розміру`};var B={};B={colorSwatchPicker:`颜色色板`,dropzoneLabel:`放置区域`,selectPlaceholder:`选择一个项目`,tableResizer:`尺寸调整器`};var V={};V={colorSwatchPicker:`色票`,dropzoneLabel:`放置區`,selectPlaceholder:`選取項目`,tableResizer:`大小調整器`};var H={};H={"ar-AE":c,"bg-BG":l,"cs-CZ":u,"da-DK":d,"de-DE":f,"el-GR":p,"en-US":m,"es-ES":h,"et-EE":g,"fi-FI":_,"fr-FR":v,"he-IL":y,"hr-HR":b,"hu-HU":x,"it-IT":S,"ja-JP":C,"ko-KR":w,"lt-LT":T,"lv-LV":E,"nb-NO":D,"nl-NL":O,"pl-PL":k,"pt-BR":A,"pt-PT":j,"ro-RO":M,"ru-RU":N,"sk-SK":P,"sl-SI":F,"sr-SP":I,"sv-SE":L,"tr-TR":R,"uk-UA":z,"zh-CN":B,"zh-TW":V};var U=(0,a.createContext)({}),W=(0,a.createContext)(null),G=(0,a.forwardRef)(function(e,t){let{render:n}=(0,a.useContext)(W);return a.createElement(a.Fragment,null,n(e,t))});function K(e,t){let n=e?.renderDropIndicator,r=e?.isVirtualDragging?.(),i=(0,a.useCallback)(e=>{if(r||t?.isDropTarget(e))return n?n(e):a.createElement(G,{target:e})},[t?.target,r,n]);return e?.useDropIndicator?i:void 0}function q(e,t,n){let r=e.focusedKey,i=null;if(t?.isVirtualDragging?.()&&n?.target?.type===`item`&&(i=n.target.key,n.target.dropPosition===`after`)){let e=n.collection.getKeyAfter(i),t=null;if(e!=null){let r=n.collection.getItem(i)?.level??0;for(;e!=null;){let i=n.collection.getItem(e);if(!i)break;if(i.type!==`item`){e=n.collection.getKeyAfter(e);continue}if((i.level??0)<=r)break;t=e,e=n.collection.getKeyAfter(e)}}i=e??t??i}return(0,a.useMemo)(()=>new Set([r,i].filter(e=>e!=null)),[r,i])}export{H as a,W as i,U as n,s as o,q as r,o as s,K as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{W as n,dt as r}from"./SharedElementTransition-BlCsXfb1.js";import{Et as i}from"./index-CWTBzWuK.js";var a=t(e(),1);function o(e,t){let{collection:o,onLoadMore:s,scrollOffset:c=1,direction:l=`end`}=e,u=(0,a.useRef)(null),d=n(e=>{for(let t of e)t.isIntersecting&&s&&s()});r(()=>{if(t.current){let e=100*c,n=l===`start`?`${e}% 0px 0px 0px`:`0px ${e}% ${e}% ${e}%`;u.current=new IntersectionObserver(d,{root:i(t?.current),rootMargin:n}),u.current.observe(t.current)}return()=>{u.current&&u.current.disconnect()}},[o,t,c,l])}function s(e){let t=a.version.split(`.`);return parseInt(t[0],10)>=19?e:e?`true`:void 0}var c={};c={colorSwatchPicker:`تغييرات الألوان`,dropzoneLabel:`DropZone`,selectPlaceholder:`حدد عنصرًا`,tableResizer:`أداة تغيير الحجم`};var l={};l={colorSwatchPicker:`Цветови мостри`,dropzoneLabel:`DropZone`,selectPlaceholder:`Изберете предмет`,tableResizer:`Преоразмерител`};var u={};u={colorSwatchPicker:`Vzorky barev`,dropzoneLabel:`Místo pro přetažení`,selectPlaceholder:`Vyberte položku`,tableResizer:`Změna velikosti`};var d={};d={colorSwatchPicker:`Farveprøver`,dropzoneLabel:`DropZone`,selectPlaceholder:`Vælg et element`,tableResizer:`Størrelsesændring`};var f={};f={colorSwatchPicker:`Farbfelder`,dropzoneLabel:`Ablegebereich`,selectPlaceholder:`Element wählen`,tableResizer:`Größenanpassung`};var p={};p={colorSwatchPicker:`Χρωματικά δείγματα`,dropzoneLabel:`DropZone`,selectPlaceholder:`Επιλέξτε ένα αντικείμενο`,tableResizer:`Αλλαγή μεγέθους`};var m={};m={selectPlaceholder:`Select an item`,tableResizer:`Resizer`,dropzoneLabel:`DropZone`,colorSwatchPicker:`Color swatches`};var h={};h={colorSwatchPicker:`Muestras de colores`,dropzoneLabel:`DropZone`,selectPlaceholder:`Seleccionar un artículo`,tableResizer:`Cambiador de tamaño`};var g={};g={colorSwatchPicker:`Värvinäidised`,dropzoneLabel:`DropZone`,selectPlaceholder:`Valige üksus`,tableResizer:`Suuruse muutja`};var _={};_={colorSwatchPicker:`Värimallit`,dropzoneLabel:`DropZone`,selectPlaceholder:`Valitse kohde`,tableResizer:`Koon muuttaja`};var v={};v={colorSwatchPicker:`Échantillons de couleurs`,dropzoneLabel:`DropZone`,selectPlaceholder:`Sélectionner un élément`,tableResizer:`Redimensionneur`};var y={};y={colorSwatchPicker:`דוגמיות צבע`,dropzoneLabel:`DropZone`,selectPlaceholder:`בחר פריט`,tableResizer:`שינוי גודל`};var b={};b={colorSwatchPicker:`Uzorci boja`,dropzoneLabel:`Zona spuštanja`,selectPlaceholder:`Odaberite stavku`,tableResizer:`Promjena veličine`};var x={};x={colorSwatchPicker:`Színtárak`,dropzoneLabel:`DropZone`,selectPlaceholder:`Válasszon ki egy elemet`,tableResizer:`Átméretező`};var S={};S={colorSwatchPicker:`Campioni di colore`,dropzoneLabel:`Zona di rilascio`,selectPlaceholder:`Seleziona un elemento`,tableResizer:`Ridimensionamento`};var C={};C={colorSwatchPicker:`カラースウォッチ`,dropzoneLabel:`ドロップゾーン`,selectPlaceholder:`項目を選択`,tableResizer:`サイズ変更ツール`};var w={};w={colorSwatchPicker:`색상 견본`,dropzoneLabel:`드롭 영역`,selectPlaceholder:`항목 선택`,tableResizer:`크기 조정기`};var T={};T={colorSwatchPicker:`Spalvų pavyzdžiai`,dropzoneLabel:`„DropZone“`,selectPlaceholder:`Pasirinkite elementą`,tableResizer:`Dydžio keitiklis`};var E={};E={colorSwatchPicker:`Krāsu paraugi`,dropzoneLabel:`DropZone`,selectPlaceholder:`Izvēlēties vienumu`,tableResizer:`Izmēra mainītājs`};var D={};D={colorSwatchPicker:`Fargekart`,dropzoneLabel:`Droppsone`,selectPlaceholder:`Velg et element`,tableResizer:`Størrelsesendrer`};var O={};O={colorSwatchPicker:`kleurstalen`,dropzoneLabel:`DropZone`,selectPlaceholder:`Selecteer een item`,tableResizer:`Resizer`};var k={};k={colorSwatchPicker:`Próbki kolorów`,dropzoneLabel:`Strefa upuszczania`,selectPlaceholder:`Wybierz element`,tableResizer:`Zmiana rozmiaru`};var A={};A={colorSwatchPicker:`Amostras de cores`,dropzoneLabel:`DropZone`,selectPlaceholder:`Selecione um item`,tableResizer:`Redimensionador`};var j={};j={colorSwatchPicker:`Amostras de cores`,dropzoneLabel:`DropZone`,selectPlaceholder:`Selecione um item`,tableResizer:`Redimensionador`};var M={};M={colorSwatchPicker:`Specimene de culoare`,dropzoneLabel:`Zonă de plasare`,selectPlaceholder:`Selectați un element`,tableResizer:`Instrument de redimensionare`};var N={};N={colorSwatchPicker:`Цветовые образцы`,dropzoneLabel:`DropZone`,selectPlaceholder:`Выберите элемент`,tableResizer:`Средство изменения размера`};var P={};P={colorSwatchPicker:`Vzorkovníky farieb`,dropzoneLabel:`DropZone`,selectPlaceholder:`Vyberte položku`,tableResizer:`Nástroj na zmenu veľkosti`};var F={};F={colorSwatchPicker:`Barvne palete`,dropzoneLabel:`DropZone`,selectPlaceholder:`Izberite element`,tableResizer:`Spreminjanje velikosti`};var I={};I={colorSwatchPicker:`Uzorci boje`,dropzoneLabel:`DropZone`,selectPlaceholder:`Izaberite stavku`,tableResizer:`Promena veličine`};var L={};L={colorSwatchPicker:`Färgrutor`,dropzoneLabel:`DropZone`,selectPlaceholder:`Välj en artikel`,tableResizer:`Storleksändrare`};var R={};R={colorSwatchPicker:`Renk örnekleri`,dropzoneLabel:`Bırakma Bölgesi`,selectPlaceholder:`Bir öğe seçin`,tableResizer:`Yeniden boyutlandırıcı`};var z={};z={colorSwatchPicker:`Зразки кольорів`,dropzoneLabel:`DropZone`,selectPlaceholder:`Виберіть елемент`,tableResizer:`Засіб змінення розміру`};var B={};B={colorSwatchPicker:`颜色色板`,dropzoneLabel:`放置区域`,selectPlaceholder:`选择一个项目`,tableResizer:`尺寸调整器`};var V={};V={colorSwatchPicker:`色票`,dropzoneLabel:`放置區`,selectPlaceholder:`選取項目`,tableResizer:`大小調整器`};var H={};H={"ar-AE":c,"bg-BG":l,"cs-CZ":u,"da-DK":d,"de-DE":f,"el-GR":p,"en-US":m,"es-ES":h,"et-EE":g,"fi-FI":_,"fr-FR":v,"he-IL":y,"hr-HR":b,"hu-HU":x,"it-IT":S,"ja-JP":C,"ko-KR":w,"lt-LT":T,"lv-LV":E,"nb-NO":D,"nl-NL":O,"pl-PL":k,"pt-BR":A,"pt-PT":j,"ro-RO":M,"ru-RU":N,"sk-SK":P,"sl-SI":F,"sr-SP":I,"sv-SE":L,"tr-TR":R,"uk-UA":z,"zh-CN":B,"zh-TW":V};var U=(0,a.createContext)({}),W=(0,a.createContext)(null),G=(0,a.forwardRef)(function(e,t){let{render:n}=(0,a.useContext)(W);return a.createElement(a.Fragment,null,n(e,t))});function K(e,t){let n=e?.renderDropIndicator,r=e?.isVirtualDragging?.(),i=(0,a.useCallback)(e=>{if(r||t?.isDropTarget(e))return n?n(e):a.createElement(G,{target:e})},[t?.target,r,n]);return e?.useDropIndicator?i:void 0}function q(e,t,n){let r=e.focusedKey,i=null;if(t?.isVirtualDragging?.()&&n?.target?.type===`item`&&(i=n.target.key,n.target.dropPosition===`after`)){let e=n.collection.getKeyAfter(i),t=null;if(e!=null){let r=n.collection.getItem(i)?.level??0;for(;e!=null;){let i=n.collection.getItem(e);if(!i)break;if(i.type!==`item`){e=n.collection.getKeyAfter(e);continue}if((i.level??0)<=r)break;t=e,e=n.collection.getKeyAfter(e)}}i=e??t??i}return(0,a.useMemo)(()=>new Set([r,i].filter(e=>e!=null)),[r,i])}export{H as a,W as i,U as n,s as o,q as r,o as s,K as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/FilterSelect-CW3ACxo1.js b/internal/webui/static/assets/FilterSelect-qchbu2Tk.js similarity index 81% rename from internal/webui/static/assets/FilterSelect-CW3ACxo1.js rename to internal/webui/static/assets/FilterSelect-qchbu2Tk.js index c41b9ee3f..9efdcd863 100644 --- a/internal/webui/static/assets/FilterSelect-CW3ACxo1.js +++ b/internal/webui/static/assets/FilterSelect-qchbu2Tk.js @@ -1 +1 @@ -import{n as e}from"./shim-mfK0Rmj6.js";import{t}from"./label-B8hTan2F.js";import{t as n}from"./list-box-BtjELxmv.js";import{t as r}from"./select-DSzMi7kM.js";var i=e(),a=`__all__`;function o({value:e,onChange:o,ariaLabel:s,options:c,className:l,isDisabled:u=!1}){let d=c.map(e=>({id:e.id||a,label:e.label})),f=e||a,p=d.find(e=>e.id===f);return(0,i.jsxs)(r,{className:l??`w-fit min-w-36`,"aria-label":s,value:f,isDisabled:u,onChange:e=>{typeof e==`string`&&o(e===a?``:e)},children:[(0,i.jsxs)(r.Trigger,{className:`min-w-0 w-full items-center`,children:[(0,i.jsx)(r.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t||!p?e:(0,i.jsx)(`span`,{className:`truncate`,children:p.label})}),(0,i.jsx)(r.Indicator,{})]}),(0,i.jsx)(r.Popover,{className:`max-h-72 min-w-36`,children:(0,i.jsx)(n,{children:d.map(e=>(0,i.jsxs)(n.Item,{id:e.id,textValue:e.label,children:[(0,i.jsx)(t,{className:`block truncate`,children:e.label}),(0,i.jsx)(n.ItemIndicator,{})]},e.id))})})]})}export{o as t}; \ No newline at end of file +import{n as e}from"./shim-mfK0Rmj6.js";import{t}from"./label-DYYRLGoV.js";import{t as n}from"./list-box-DbrQLYNo.js";import{t as r}from"./select-DnqAZzCR.js";var i=e(),a=`__all__`;function o({value:e,onChange:o,ariaLabel:s,options:c,className:l,isDisabled:u=!1}){let d=c.map(e=>({id:e.id||a,label:e.label})),f=e||a,p=d.find(e=>e.id===f);return(0,i.jsxs)(r,{className:l??`w-fit min-w-36`,"aria-label":s,value:f,isDisabled:u,onChange:e=>{typeof e==`string`&&o(e===a?``:e)},children:[(0,i.jsxs)(r.Trigger,{className:`min-w-0 w-full items-center`,children:[(0,i.jsx)(r.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t||!p?e:(0,i.jsx)(`span`,{className:`truncate`,children:p.label})}),(0,i.jsx)(r.Indicator,{})]}),(0,i.jsx)(r.Popover,{className:`max-h-72 min-w-36`,children:(0,i.jsx)(n,{children:d.map(e=>(0,i.jsxs)(n.Item,{id:e.id,textValue:e.label,children:[(0,i.jsx)(t,{className:`block truncate`,children:e.label}),(0,i.jsx)(n.ItemIndicator,{})]},e.id))})})]})}export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/FilterToggle-BoD7X2r2.js b/internal/webui/static/assets/FilterToggle-CbYR8o3t.js similarity index 91% rename from internal/webui/static/assets/FilterToggle-BoD7X2r2.js rename to internal/webui/static/assets/FilterToggle-CbYR8o3t.js index 9f02233d2..8e012bf0a 100644 --- a/internal/webui/static/assets/FilterToggle-BoD7X2r2.js +++ b/internal/webui/static/assets/FilterToggle-CbYR8o3t.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{m as r,p as i}from"./format-FfdyoNtB.js";import{t as a}from"./gsap-DWxn8li7.js";import{b as o,v as s,y as c}from"./index-CAlyInAP.js";var l=t(e(),1),u=n(),d={"--toggle-button-bg-selected":`transparent`,"--toggle-button-bg-selected-hover":`transparent`,"--toggle-button-bg-selected-pressed":`transparent`};function f({value:e,onChange:t,options:n,ariaLabel:f,className:p}){let m=(0,l.useRef)(null),h=(0,l.useRef)(null),g=(0,l.useRef)(!1);return(0,l.useLayoutEffect)(()=>{let e=m.current,t=h.current;if(!e||!t)return;let n=n=>{let r=e.querySelector(`[data-selected="true"]`);if(!r){a.set(t,{autoAlpha:0});return}let i=e.getBoundingClientRect(),l=r.getBoundingClientRect();a.to(t,{x:l.left-i.left,y:l.top-i.top,width:l.width,height:l.height,autoAlpha:1,duration:n?o(s.base):0,ease:c.out,overwrite:!0})};n(g.current),g.current=!0;let r=new ResizeObserver(()=>n(!1));return r.observe(e),()=>{r.disconnect(),a.killTweensOf(t)}},[e,n]),(0,u.jsxs)(`div`,{ref:m,className:`filter-toggle relative inline-flex ${p??``}`,children:[(0,u.jsx)(`span`,{ref:h,"aria-hidden":!0,className:`filter-toggle__pill pointer-events-none absolute left-0 top-0 opacity-0`}),(0,u.jsx)(i,{"aria-label":f,size:`sm`,selectionMode:`single`,disallowEmptySelection:!0,selectedKeys:new Set([e]),onSelectionChange:n=>{let r=[...n][0];typeof r==`string`&&r!==e&&t(r)},children:n.map(e=>(0,u.jsxs)(r,{id:e.id,className:`relative z-[1]`,style:d,children:[e.icon,e.label]},e.id))})]})}export{f as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{m as r,p as i}from"./format-BAkFbjAh.js";import{t as a}from"./gsap-DWxn8li7.js";import{b as o,v as s,y as c}from"./index-CWTBzWuK.js";var l=t(e(),1),u=n(),d={"--toggle-button-bg-selected":`transparent`,"--toggle-button-bg-selected-hover":`transparent`,"--toggle-button-bg-selected-pressed":`transparent`};function f({value:e,onChange:t,options:n,ariaLabel:f,className:p}){let m=(0,l.useRef)(null),h=(0,l.useRef)(null),g=(0,l.useRef)(!1);return(0,l.useLayoutEffect)(()=>{let e=m.current,t=h.current;if(!e||!t)return;let n=n=>{let r=e.querySelector(`[data-selected="true"]`);if(!r){a.set(t,{autoAlpha:0});return}let i=e.getBoundingClientRect(),l=r.getBoundingClientRect();a.to(t,{x:l.left-i.left,y:l.top-i.top,width:l.width,height:l.height,autoAlpha:1,duration:n?o(s.base):0,ease:c.out,overwrite:!0})};n(g.current),g.current=!0;let r=new ResizeObserver(()=>n(!1));return r.observe(e),()=>{r.disconnect(),a.killTweensOf(t)}},[e,n]),(0,u.jsxs)(`div`,{ref:m,className:`filter-toggle relative inline-flex ${p??``}`,children:[(0,u.jsx)(`span`,{ref:h,"aria-hidden":!0,className:`filter-toggle__pill pointer-events-none absolute left-0 top-0 opacity-0`}),(0,u.jsx)(i,{"aria-label":f,size:`sm`,selectionMode:`single`,disallowEmptySelection:!0,selectedKeys:new Set([e]),onSelectionChange:n=>{let r=[...n][0];typeof r==`string`&&r!==e&&t(r)},children:n.map(e=>(0,u.jsxs)(r,{id:e.id,className:`relative z-[1]`,style:d,children:[e.icon,e.label]},e.id))})]})}export{f as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/FormRow-CL_rVm7f.js b/internal/webui/static/assets/FormRow-CqpQhYrN.js similarity index 81% rename from internal/webui/static/assets/FormRow-CL_rVm7f.js rename to internal/webui/static/assets/FormRow-CqpQhYrN.js index b37f71ff2..7b187ae30 100644 --- a/internal/webui/static/assets/FormRow-CL_rVm7f.js +++ b/internal/webui/static/assets/FormRow-CqpQhYrN.js @@ -1 +1 @@ -import{n as e}from"./shim-mfK0Rmj6.js";import{t}from"./label-B8hTan2F.js";var n=e(),r=`w-28`;function i({label:e,hint:i,labelWidthClass:a=r,htmlFor:o,align:s=`center`,children:c}){return(0,n.jsxs)(`div`,{children:[(0,n.jsxs)(`div`,{className:`flex gap-3 ${s===`start`?`items-start`:`items-center`}`,children:[(0,n.jsx)(t,{htmlFor:o,className:`${a} shrink-0 ${s===`start`?`pt-2`:``} text-body font-medium text-foreground`,children:e}),(0,n.jsx)(`div`,{className:`min-w-0 flex-1 [&_[data-slot=input]]:w-full [&_[data-slot=textarea]]:w-full`,children:c})]}),i?(0,n.jsx)(`p`,{className:`mt-1.5 pl-[7.75rem] text-caption leading-5 text-muted`,children:i}):null]})}export{i as t}; \ No newline at end of file +import{n as e}from"./shim-mfK0Rmj6.js";import{t}from"./label-DYYRLGoV.js";var n=e(),r=`w-28`;function i({label:e,hint:i,labelWidthClass:a=r,htmlFor:o,align:s=`center`,children:c}){return(0,n.jsxs)(`div`,{children:[(0,n.jsxs)(`div`,{className:`flex gap-3 ${s===`start`?`items-start`:`items-center`}`,children:[(0,n.jsx)(t,{htmlFor:o,className:`${a} shrink-0 ${s===`start`?`pt-2`:``} text-body font-medium text-foreground`,children:e}),(0,n.jsx)(`div`,{className:`min-w-0 flex-1 [&_[data-slot=input]]:w-full [&_[data-slot=textarea]]:w-full`,children:c})]}),i?(0,n.jsx)(`p`,{className:`mt-1.5 pl-[7.75rem] text-caption leading-5 text-muted`,children:i}):null]})}export{i as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/InflightLiveCard-BN45lDqh.js b/internal/webui/static/assets/InflightLiveCard-Cy8JjSn4.js similarity index 99% rename from internal/webui/static/assets/InflightLiveCard-BN45lDqh.js rename to internal/webui/static/assets/InflightLiveCard-Cy8JjSn4.js index 96c3b2f02..93ed26758 100644 --- a/internal/webui/static/assets/InflightLiveCard-BN45lDqh.js +++ b/internal/webui/static/assets/InflightLiveCard-Cy8JjSn4.js @@ -1,4 +1,4 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./ArrowUp.es-C5DPjo_d.js";import{t as i}from"./CaretRight.es-CeI6iKxy.js";import{t as a}from"./Check.es-DRxeSSF6.js";import{t as o}from"./Plus.es-BPfWzgUg.js";import{t as s}from"./Stack.es-B6AMU1oV.js";import{t as c}from"./User.es-DHjz-Tbh.js";import{pt as l}from"./useI18n-XrvNxGvP.js";import{n as u}from"./useToggle-55_Qx9vA.js";import{t as d}from"./CompactSwitch-Dd3U4EbK.js";import{M as f}from"./overview-ARhe2pSk.js";import{Gt as p,Ot as m,Vt as h,qt as g,x as _}from"./index-CAlyInAP.js";import{t as v}from"./ProviderMark-C49bIWJW.js";var y=t(e(),1),b=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M204,64V168a12,12,0,0,1-24,0V93L72.49,200.49a12,12,0,0,1-17-17L163,76H88a12,12,0,0,1,0-24H192A12,12,0,0,1,204,64Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M192,64V168L88,64Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M192,56H88a8,8,0,0,0-5.66,13.66L128.69,116,58.34,186.34a8,8,0,0,0,11.32,11.32L140,127.31l46.34,46.35A8,8,0,0,0,200,168V64A8,8,0,0,0,192,56Zm-8,92.69-38.34-38.34h0L107.31,72H184Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-13.66,5.66L140,127.31,69.66,197.66a8,8,0,0,1-11.32-11.32L128.69,116,82.34,69.66A8,8,0,0,1,88,56H192A8,8,0,0,1,200,64Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M198,64V168a6,6,0,0,1-12,0V78.48L68.24,196.24a6,6,0,0,1-8.48-8.48L177.52,70H88a6,6,0,0,1,0-12H192A6,6,0,0,1,198,64Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-16,0V83.31L69.66,197.66a8,8,0,0,1-11.32-11.32L172.69,72H88a8,8,0,0,1,0-16H192A8,8,0,0,1,200,64Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M196,64V168a4,4,0,0,1-8,0V73.66L66.83,194.83a4,4,0,0,1-5.66-5.66L182.34,68H88a4,4,0,0,1,0-8H192A4,4,0,0,1,196,64Z`}))]]),x=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H72a8,8,0,0,1,0-16H184a8,8,0,0,1,0,16Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H40a6,6,0,0,1,0-12H216A6,6,0,0,1,222,128Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H40a4,4,0,0,1,0-8H216A4,4,0,0,1,220,128Z`}))]]),S=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M200,28H160a20,20,0,0,0-20,20V208a20,20,0,0,0,20,20h40a20,20,0,0,0,20-20V48A20,20,0,0,0,200,28Zm-4,176H164V52h32ZM96,28H56A20,20,0,0,0,36,48V208a20,20,0,0,0,20,20H96a20,20,0,0,0,20-20V48A20,20,0,0,0,96,28ZM92,204H60V52H92Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M208,48V208a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8h40A8,8,0,0,1,208,48ZM96,40H56a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M200,34H160a14,14,0,0,0-14,14V208a14,14,0,0,0,14,14h40a14,14,0,0,0,14-14V48A14,14,0,0,0,200,34Zm2,174a2,2,0,0,1-2,2H160a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2h40a2,2,0,0,1,2,2ZM96,34H56A14,14,0,0,0,42,48V208a14,14,0,0,0,14,14H96a14,14,0,0,0,14-14V48A14,14,0,0,0,96,34Zm2,174a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2H96a2,2,0,0,1,2,2Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M200,36H160a12,12,0,0,0-12,12V208a12,12,0,0,0,12,12h40a12,12,0,0,0,12-12V48A12,12,0,0,0,200,36Zm4,172a4,4,0,0,1-4,4H160a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4h40a4,4,0,0,1,4,4ZM96,36H56A12,12,0,0,0,44,48V208a12,12,0,0,0,12,12H96a12,12,0,0,0,12-12V48A12,12,0,0,0,96,36Zm4,172a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H96a4,4,0,0,1,4,4Z`}))]]),C=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M234.49,111.07,90.41,22.94A20,20,0,0,0,60,39.87V216.13a20,20,0,0,0,30.41,16.93l144.08-88.13a19.82,19.82,0,0,0,0-33.86ZM84,208.85V47.15L216.16,128Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M228.23,134.69,84.15,222.81A8,8,0,0,1,72,216.12V39.88a8,8,0,0,1,12.15-6.69l144.08,88.12A7.82,7.82,0,0,1,228.23,134.69Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M231.36,116.19,87.28,28.06a14,14,0,0,0-14.18-.27A13.69,13.69,0,0,0,66,39.87V216.13a13.69,13.69,0,0,0,7.1,12.08,14,14,0,0,0,14.18-.27l144.08-88.13a13.82,13.82,0,0,0,0-23.62Zm-6.26,13.38L81,217.7a2,2,0,0,1-2.06,0,1.78,1.78,0,0,1-1-1.61V39.87a1.78,1.78,0,0,1,1-1.61A2.06,2.06,0,0,1,80,38a2,2,0,0,1,1,.31L225.1,126.43a1.82,1.82,0,0,1,0,3.14Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M230.32,117.9,86.24,29.79a11.91,11.91,0,0,0-12.17-.23A11.71,11.71,0,0,0,68,39.89V216.11a11.71,11.71,0,0,0,6.07,10.33,11.91,11.91,0,0,0,12.17-.23L230.32,138.1a11.82,11.82,0,0,0,0-20.2Zm-4.18,13.37L82.06,219.39a4,4,0,0,1-4.07.07,3.77,3.77,0,0,1-2-3.35V39.89a3.77,3.77,0,0,1,2-3.35,4,4,0,0,1,4.07.07l144.08,88.12a3.8,3.8,0,0,1,0,6.54Z`}))]]),w=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z`}))]]),T=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z`}))]]),E=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M230.47,67.5a12,12,0,0,0-19.26-4.32L172.43,99l-12.68-2.72L157,83.57l35.79-38.78a12,12,0,0,0-4.32-19.26A76.07,76.07,0,0,0,88.41,121.64L30.92,174.18a4.68,4.68,0,0,0-.39.38,36,36,0,0,0,50.91,50.91l.38-.39,52.54-57.49A76.05,76.05,0,0,0,230.47,67.5ZM160,148a51.5,51.5,0,0,1-23.35-5.52,12,12,0,0,0-14.26,2.62L64.31,208.66a12,12,0,0,1-17-17l63.55-58.07a12,12,0,0,0,2.62-14.26A51.5,51.5,0,0,1,108,96a52.06,52.06,0,0,1,52-52h.89L135.17,71.87a12,12,0,0,0-2.91,10.65l5.66,26.35a12,12,0,0,0,9.21,9.21l26.35,5.66a12,12,0,0,0,10.65-2.91L212,95.12c0,.3,0,.59,0,.89A52.06,52.06,0,0,1,160,148Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M224,96a64,64,0,0,1-94.94,56L73,217A24,24,0,0,1,39,183L104,126.94a64,64,0,0,1,80-90.29L144,80l5.66,26.34L176,112l43.35-40A63.8,63.8,0,0,1,224,96Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M232,96a72,72,0,0,1-100.94,66L79,222.22c-.12.14-.26.29-.39.42a32,32,0,0,1-45.26-45.26c.14-.13.28-.27.43-.39L94,124.94a72.07,72.07,0,0,1,83.54-98.78,8,8,0,0,1,3.93,13.19L144,80l5.66,26.35L176,112l40.65-37.52a8,8,0,0,1,13.19,3.93A72.6,72.6,0,0,1,232,96Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M224.91,69.75a6,6,0,0,0-9.63-2.16l-41.07,37.9L154.7,101.3l-4.19-19.51,37.9-41.07a6,6,0,0,0-2.16-9.63,70,70,0,0,0-89.77,94.39l-61.39,53c-.11.09-.21.19-.32.3A30,30,0,0,0,77.2,221.23c.11-.11.21-.21.3-.32l53-61.39a70,70,0,0,0,94.39-89.77ZM160,154a58,58,0,0,1-28-7.22,6,6,0,0,0-7.45,1.33L68.57,212.88a18,18,0,0,1-25.45-25.45l64.76-55.94A6,6,0,0,0,109.2,124a58,58,0,0,1,64-84.53L139.58,75.93a6,6,0,0,0-1.45,5.33l5.65,26.35a6,6,0,0,0,4.61,4.61l26.35,5.65a6,6,0,0,0,5.33-1.45L216.49,82.8A58.06,58.06,0,0,1,160,154Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M223.05,70.5a4,4,0,0,0-6.42-1.44l-41.82,38.6L153,103l-4.68-21.79,38.6-41.82a4,4,0,0,0-1.44-6.43A68,68,0,0,0,98.94,126L36.4,180l-.21.2a28,28,0,0,0,39.6,39.6l.2-.21,54-62.54A68,68,0,0,0,228,96,67.51,67.51,0,0,0,223.05,70.5ZM160,156a60,60,0,0,1-29-7.47,4,4,0,0,0-5,.89L70,214.25A20,20,0,0,1,41.75,186l64.82-56a4,4,0,0,0,.89-5,60,60,0,0,1,69.46-86.59L141.05,77.29a4,4,0,0,0-1,3.55l5.66,26.35a4,4,0,0,0,3.07,3.07l26.35,5.66a4,4,0,0,0,3.55-1l38.87-35.87A60.05,60.05,0,0,1,160,156Z`}))]]),ee=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:b}));ee.displayName=`ArrowUpRightIcon`;var te=ee,D=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:x}));D.displayName=`MinusIcon`;var ne=D,O=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:S}));O.displayName=`PauseIcon`;var re=O,k=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:C}));k.displayName=`PlayIcon`;var ie=k,ae=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:w}));ae.displayName=`SparkleIcon`;var A=ae,oe=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:T}));oe.displayName=`WarningIcon`;var se=oe,ce=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:E}));ce.displayName=`WrenchIcon`;var le=ce;function ue(){return f(`/api/live`)}function de(e){return e?`1`:`0`}function fe(e){let t=e.workers.map(e=>[e.id,e.name,e.provider,e.in_flight,e.max_inflight,de(e.busy),de(e.rate_limited),de(e.enabled)].join(`:`)).join(`,`),n=(e.queue??[]).map(e=>[e.id,e.account_id??``,e.name,e.status,e.started_at??``].join(`:`)).join(`,`),r=(e.occupancy??[]).map(e=>[e.id,e.account_id??``,e.name,e.status,e.started_at??``].join(`:`)).join(`,`),i=(e.recent_completions??[]).map(e=>[e.request_id??``,e.account_id,e.status].join(`:`)).join(`,`),a=e.rate_limits.map(e=>e.id).join(`,`),o=e.sticky;return[t,n,r,i,a,o.bindings,o.hits,o.misses].join(`|`)}function j(e){let t=e.accounts.map(e=>[e.id,e.in_flight,e.max_inflight,de(e.enabled)].join(`:`)).join(`,`);return[e.in_flight,e.capacity,e.rpm,t,fe(e)].join(`|`)}var M={generatedAt:0,backpressure:6,throughputPerMin:42,waitP95Ms:2800,totals:{done:186,failed:4},workers:[{id:`acc-wb-a1`,name:`WorkBuddy`,provider:`workbuddy`,busy:!0,progress:.72,jobId:`j1`,concurrency:4,inFlight:3,cells:[{id:`j1`,name:`glm-5.2`,startedAtMs:0,elapsedMs:11200},{id:`j1b`,name:`kimi-k2.7-code`,startedAtMs:0,elapsedMs:8400},{id:`j1c`,name:`qwen3-embedding`,startedAtMs:0,elapsedMs:4100}]},{id:`acc-wb-a2`,name:`Zhipu`,provider:`zhipu`,busy:!0,progress:.41,jobId:`j2`,rateLimited:!0,concurrency:2,inFlight:1,cells:[{id:`j2`,name:`deepseek-v4-pro`,startedAtMs:0,elapsedMs:9400}]},{id:`acc-qd-b1`,name:`Qoder`,provider:`qoder`,busy:!0,progress:.88,jobId:`j3`,concurrency:1,inFlight:1,cells:[{id:`j3`,name:`glm-5.3`,startedAtMs:0,elapsedMs:6200}]},{id:`acc-qd-b2`,name:`Kimi`,provider:`kimi`,busy:!1,progress:0,concurrency:4,inFlight:0,cells:[]},{id:`acc-trae-c1`,name:`Trae`,provider:`trae`,busy:!0,progress:.23,jobId:`j4`,concurrency:3,inFlight:2,cells:[{id:`j4`,name:`qwen3-coder`,startedAtMs:0,elapsedMs:3100},{id:`j4b`,name:`glm-5.3-flash`,startedAtMs:0,elapsedMs:1800}]},{id:`acc-codex-d1`,name:`Codex`,provider:`codex`,busy:!1,progress:0,rateLimited:!0,concurrency:2,inFlight:0,cells:[]}],jobs:[{id:`j1`,name:`glm-5.2`,kind:`chat`,status:`running`,accountId:`acc-wb-a1`,progress:.72,elapsedMs:11200,sticky:!0},{id:`j1b`,name:`kimi-k2.7-code`,kind:`chat`,status:`running`,accountId:`acc-wb-a1`,progress:.55,elapsedMs:8400},{id:`j1c`,name:`qwen3-embedding`,kind:`embed`,status:`running`,accountId:`acc-wb-a1`,progress:.3,elapsedMs:4100},{id:`j2`,name:`deepseek-v4-pro`,kind:`embed`,status:`running`,accountId:`acc-wb-a2`,progress:.41,elapsedMs:9400},{id:`j3`,name:`glm-5.3`,kind:`chat`,status:`running`,accountId:`acc-qd-b1`,progress:.88,elapsedMs:6200},{id:`j4`,name:`qwen3-coder`,kind:`tools`,status:`running`,accountId:`acc-trae-c1`,progress:.23,elapsedMs:3100},{id:`j4b`,name:`glm-5.3-flash`,kind:`chat`,status:`running`,accountId:`acc-trae-c1`,progress:.15,elapsedMs:1800},{id:`j5`,name:`deepseek-v4.1-flash`,kind:`chat`,status:`queued`,progress:0,elapsedMs:7200},{id:`j6`,name:`glm-5.2`,kind:`chat`,status:`queued`,progress:0,elapsedMs:5100},{id:`j7`,name:`kimi-k2.7-code`,kind:`chat`,status:`queued`,progress:0,elapsedMs:2800,sticky:!0,priority:`high`},{id:`j8`,name:`qwen3-embedding`,kind:`embed`,status:`queued`,progress:0,elapsedMs:1400},{id:`j9`,name:`qwen3-coder`,kind:`tools`,status:`queued`,progress:0,elapsedMs:900},{id:`j10`,name:`glm-5.3-flash`,kind:`chat`,status:`queued`,progress:0,elapsedMs:600},{id:`j11`,name:`deepseek-v4-pro`,kind:`embed`,status:`queued`,progress:0,elapsedMs:400},{id:`j12`,name:`glm-5.3`,kind:`chat`,status:`queued`,progress:0,elapsedMs:200,priority:`high`}],rateLimits:[{id:`rl1`,label:`Zhipu 限流`,remainingMs:97e3,from:.55,until:.72},{id:`rl2`,label:`Codex 冷却`,remainingMs:41e3,from:.82,until:1}],depthSeries:[1,1,2,2,3,4,5,6,7,6,5,4,3,4,5,6,5,4,3,3,2,3,4,3]},N=[{name:`glm-5.3`,kind:`chat`},{name:`qwen3-embedding`,kind:`embed`},{name:`qwen3-coder`,kind:`tools`},{name:`glm-5.3-flash`,kind:`chat`,sticky:!0},{name:`deepseek-v4.1-flash`,kind:`chat`},{name:`deepseek-v4-pro`,kind:`embed`},{name:`kimi-k2.7-code`,kind:`chat`}],P=100;function F(e=M){return{...e,workers:e.workers.map(e=>({...e,cells:e.cells?.map(e=>({...e}))})),jobs:e.jobs.map(e=>({...e})),rateLimits:e.rateLimits.map(e=>({...e})),depthSeries:[...e.depthSeries],totals:{...e.totals},completions:void 0}}function I(){return F()}function pe(){let e=Math.max(1,M.depthSeries.length);return{generatedAt:Date.now(),backpressure:M.backpressure,throughputPerMin:0,waitP95Ms:0,totals:{done:0,failed:0},workers:[],jobs:[],rateLimits:[],depthSeries:Array.from({length:e},()=>0)}}function L(e){return e.jobs.length===0&&e.workers.length===0&&e.throughputPerMin===0&&(e.totals?.done??0)===0&&(e.totals?.failed??0)===0}function R(e,t){let n=Math.max(16,Math.min(500,t)),r=F(e);r.generatedAt=(e.generatedAt||0)+n,r.rateLimits=r.rateLimits.map(e=>({...e,remainingMs:Math.max(0,e.remainingMs-n)})).filter(e=>e.remainingMs>0);for(let e of r.workers)e.id===`acc-wb-a2`?e.rateLimited=r.rateLimits.some(e=>e.label.includes(`Zhipu`)):e.id===`acc-codex-d1`&&(e.rateLimited=r.rateLimits.some(e=>e.label.includes(`Codex`)));let i=new Map(r.jobs.map(e=>[e.id,e]));for(let e of r.workers){if(e.cells?.length)for(let t of e.cells)t.elapsedMs+=n;if(e.rateLimited)continue;let t=0;for(let r of e.cells??[]){let e=i.get(r.id);if(!e||e.status!==`running`)continue;e.elapsedMs=r.elapsedMs;let a=.045+r.id.charCodeAt(r.id.length-1)%5*.008;e.progress=Math.min(1,e.progress+n/1e3*a),t=Math.max(t,e.progress)}(e.cells?.length??0)>0&&(e.progress=t,e.busy=!0,e.jobId=e.cells[0].id,e.inFlight=e.cells.length)}let a=[];for(let e of r.workers){if(e.rateLimited||!e.cells?.length)continue;let t=e.cells.find(e=>{let t=i.get(e.id);return!!(t&&t.status===`running`&&t.progress>=.995)});if(!t)continue;let n=(t.id.charCodeAt(1)+Math.floor(r.generatedAt/1e3))%9!=0;a.push({jobId:t.id,workerId:e.id,ok:n})}for(let e of a){let t=i.get(e.jobId),n=r.workers.find(t=>t.id===e.workerId);if(!t||!n)continue;if(n.cells=(n.cells??[]).filter(t=>t.id!==e.jobId),n.inFlight=n.cells.length,n.jobId=n.cells[0]?.id,n.busy=n.cells.length>0,n.progress=n.busy?Math.max(.04,...n.cells.map(e=>i.get(e.id)?.progress??.04)):0,t.accountId=void 0,e.ok){t.status=`done`,t.progress=1,r.totals.done+=1;continue}let a=(t.attempt??1)+1;if(a<=3&&(e.jobId.charCodeAt(0)+Math.floor(r.generatedAt/900))%2==0){t.status=`queued`,t.progress=0,t.elapsedMs=80,t.attempt=a,t.priority=`high`;continue}t.status=`failed`,t.progress=1,r.totals.failed+=1}let o=[];for(let e of a){let t=i.get(e.jobId);t&&(t.status===`done`||t.status===`failed`)&&o.push({id:t.id,name:t.name,kind:t.kind,ok:t.status===`done`})}r.completions=o.length>0?o:void 0,r.jobs=r.jobs.filter(e=>e.status===`queued`||e.status===`running`);for(let e of r.jobs)e.status===`queued`&&(e.elapsedMs+=n);let s=r.jobs.filter(e=>e.status===`queued`);for(let e of r.workers){if(e.rateLimited)continue;let t=me(e.concurrency??1);for(e.cells=e.cells??[];e.cells.lengthe.id!==n.id),r].slice(0,t),e.busy=!0,e.progress=Math.max(e.progress,.04),e.jobId=e.cells[0]?.id,e.inFlight=e.cells.length}}if(r.jobs.filter(e=>e.status===`queued`).length<10&&r.generatedAt%1600e.status===`running`),t=r.jobs.filter(e=>e.status===`queued`),n=t.filter(e=>e.priority===`high`&&e.elapsedMs>=400),i=t.filter(e=>!(e.priority===`high`&&e.elapsedMs>=400)),a=n;r.jobs=[...e,...a,...i]}let c=r.workers.filter(e=>e.busy).length,l=r.jobs.filter(e=>e.status===`queued`).length,u=Math.max(1,l+Math.max(0,c-2)),d=r.depthSeries.slice(1);return d.push(u),r.depthSeries=d,r.throughputPerMin=Math.max(28,Math.min(58,r.throughputPerMin+(P%3-1))),r.waitP95Ms=Math.max(900,Math.min(5200,r.waitP95Ms+(l>4?40:-20))),r}function me(e){return e==null||!Number.isFinite(e)?1:Math.max(1,Math.min(16,Math.floor(e)))}function he(e,t){let n=Date.now(),r=new Map(e.jobs.map(e=>[e.id,e])),i=Math.max(1,M.depthSeries.length),a=t.rate_limits.map((e,t)=>{let n=Math.min(.86,t*.22%.86);return{id:e.id,label:e.label,remainingMs:Math.max(0,e.remaining_ms),from:n,until:Math.min(1,n+.14)}}),o=(t.queue??[]).map(e=>{let t=(e.id||``).trim(),i=r.get(t),a,o=e.started_at?.trim();if(o){let e=Date.parse(o);Number.isNaN(e)||(a=e)}return a==null&&i?.startedAtMs!=null&&(a=i.startedAtMs),a??=n,{id:t,name:(e.name||``).trim()||t,kind:`chat`,status:`queued`,accountId:(e.account_id||``).trim()||void 0,progress:0,startedAtMs:a,elapsedMs:Math.max(0,n-a)}}),s=new Set(o.map(e=>e.id)),c=new Map;for(let e of o){let t=(e.accountId||``).trim();t&&e.name&&!c.has(t)&&c.set(t,e.name)}let l=new Map;for(let e of t.occupancy??[]){let t=(e.account_id||``).trim(),n=(e.id||``).trim();if(!t||!n)continue;let r=l.get(t)??[];r.push(e),l.set(t,r)}let u=new Map;for(let t of e.workers)t.cells?.length&&u.set(t.id,t.cells);let d=(e,t,n)=>{let r=e?.trim();if(r){let e=Date.parse(r);if(!Number.isNaN(e))return e}return t??n},f=t.workers.map(e=>{let i=me(e.max_inflight??4),a=e.in_flight!=null&&Number.isFinite(e.in_flight)?Math.max(0,Math.floor(e.in_flight)):+!!e.busy,o=Math.min(i,a),f=u.get(e.id)??[],p=new Map(f.map(e=>[e.id,e])),m=l.get(e.id)??[],h=[];for(let e of m){if(h.length>=o)break;let t=(e.id||``).trim();if(!t)continue;let i=p.get(t),a=r.get(t),c=d(e.started_at,i?.startedAtMs??a?.startedAtMs,n),l=(e.name||``).trim()||t;h.push({id:t,name:l,startedAtMs:c,elapsedMs:Math.max(0,n-c),pendingInbound:s.has(t)})}let g=t.workers.find(t=>t.id===e.id),_=d(g?.started_at,void 0,n);for(;h.length0;return{id:e.id,name:e.name,provider:e.provider,busy:v,progress:v?Math.max(.04,Math.min(1,e.progress||0)):0,rateLimited:e.rate_limited,jobId:h[0]?.id,concurrency:i,inFlight:o,cells:h}}),p=[];for(let e of f)for(let t of e.cells??[]){if(s.has(t.id))continue;let n=r.get(t.id);p.push({id:t.id,name:t.name,kind:n?.kind??`chat`,status:`running`,accountId:e.id,progress:e.progress,startedAtMs:t.startedAtMs,elapsedMs:t.elapsedMs})}let m=[...p,...o],h=e.waitP95Ms===0,g=h?e.depthSeries.slice(1):Array.from({length:Math.max(0,i-1)},()=>0);for(g.push(Math.max(0,t.in_flight));g.lengthe.id)),b=[];for(let n of e.jobs){if(n.status!==`running`||y.has(n.id))continue;let e=(n.accountId||n.id.replace(/^live-/,``)).trim(),r=!0;if(_.has(n.id))r=_.get(n.id),_.delete(n.id);else{let n=v.get(e);if(n&&n.length>0)r=n.shift();else{let n=t.workers.find(t=>t.id===e);n?.last_error_kind&&n.last_error_kind.trim()!==``&&(r=!1)}}b.push({id:n.id,name:n.name,kind:n.kind,ok:r})}let x=0,S=0;if(h){x=e.totals.done,S=e.totals.failed;let n=t.recent_completions??[];if(n.length>0)for(let e of n)(e.status||``).trim()===`ok`?x+=1:S+=1;else for(let e of b)e.ok?x+=1:S+=1}return{generatedAt:n,backpressure:e.backpressure,throughputPerMin:Math.max(0,t.rpm),waitP95Ms:0,totals:{done:x,failed:S},workers:f,rateLimits:a,jobs:m,depthSeries:g.slice(-i),completions:b.length>0?b:void 0}}var z=n(),B={waiting:`Waiting`,running:`Running`,throughput:`Throughput`,waitP95:`Wait p95`,queue:`Queue`,workers:`Workers`,nothingWaiting:`Nothing waiting`,done:`Done`,failed:`Failed`,depth:`Queue depth`,idle:`Idle`,paused:`Paused`,live:`Live`,rateLimited:`Rate limited`,now:`now`,ago:`ago`,more:`more`,high:`High`,low:`Low`,normal:`Normal`,priority:`Priority`,attempt:`Attempt`,position:`Position`,waited:`Waited`,worker:`Worker`,close:`Close details`,kind:{llm:`LLM call`,tool:`Tool call`,agent:`Sub-agent`,human:`Human review`},status:{queued:`Waiting`,running:`Running`,done:`Done`,failed:`Failed`},formatPosition:(e,t)=>`${e} of ${t}`,formatAttempt:(e,t)=>`${e}${t?` of ${t}`:``}`,announceFailed:(e,t)=>t?`${e} failed: ${t}`:`${e} failed`,announceRetry:(e,t,n)=>`${e} failed – retrying, attempt ${t}${n?` of ${n}`:``}`,announceLimited:e=>`Rate limited – workers paused for ${e} seconds`,announceResumed:`Rate limit lifted – workers resumed`,announcePressure:(e,t)=>`${e} jobs waiting – above the backpressure line of ${t}`};function ge(e){return{...B,...e,kind:{...B.kind,...e?.kind},status:{...B.status,...e?.status}}}var _e={high:0,normal:1,low:2},V=560,ve=1100,ye=1500,be=520,xe=200,Se=520,Ce=6e4,we=[4,6,8,10,12,16,20,24,30,40,50,60,80,100,120,160,200,300,400,500,600,800,1e3,1500,2e3],H=e=>{let t=Math.max(0,e);if(t<1e4)return`${(t/1e3).toFixed(1)}s`;let n=Math.round(t/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60);if(r<60)return`${r}m ${String(n%60).padStart(2,`0`)}s`;let i=Math.floor(r/60);return i<24?`${i}h ${String(r%60).padStart(2,`0`)}m`:`${Math.floor(i/24)}d ${i%24}h`};function Te(e,t,n){for(let r of e.querySelectorAll(`.ui-agqc__job`)){let e=r.dataset.status;if(e!==`queued`&&e!==`running`)continue;let i=Number(r.dataset.enqueued),a=Number(r.dataset.started),o=r.querySelector(`.ui-agqc__job-meta`);if(o){let s=r.hasAttribute(`data-halted`),c=e===`queued`?H(t-i):s?n:H(t-(Number.isFinite(a)?a:t));o.textContent!==c&&(o.textContent=c)}if(e===`running`&&r.dataset.estimate){let e=Number(r.dataset.estimate);if(e>0&&Number.isFinite(a)){let n=String(Oe((t-a)/e,.015,1));r.style.getPropertyValue(`--p`)!==n&&r.style.setProperty(`--p`,n)}}}for(let n of e.querySelectorAll(`[data-live-clock]`)){let e=Number(n.dataset.enqueued),r=Number(n.dataset.started),i=n.dataset.liveClock===`queue`?H(t-e):H(t-(Number.isFinite(r)?r:t));n.textContent!==i&&(n.textContent=i)}let r=e.querySelector(`[data-limit-until]`);if(!r)return;let i=Number(r.dataset.limitUntil);if(!Number.isFinite(i))return;let a=Math.max(0,Math.ceil((i-t)/1e3)),o=a<100?`${a}s`:H(a*1e3);r.textContent!==o&&(r.textContent=o)}var U=e=>Math.round(e).toLocaleString(`en-US`),W=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),Ee=e=>Math.round(e)<1e5?U(e):W.format(Math.round(e)),De=(e,t)=>{if(!e.length)return 0;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.floor(t*n.length))]},Oe=(e,t,n)=>Math.max(t,Math.min(n,e)),ke=e=>{let t=e.trim().split(/\s+/).filter(e=>/^[\p{L}\p{N}]/u.test(e)).slice(0,2).map(e=>Array.from(e)[0]);return(t.length?t.join(``):Array.from(e.trim())[0]??``).toUpperCase()},Ae=()=>typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,G=e=>Math.round(e*100)/100,je=e=>{let t=e.length;if(t<2)return``;let n=[],r=[];for(let i=0;i{let n=Math.max(2,Math.floor((e.w-20+Ne-Me)/Ne)),r=t*Ne-4;return{x:e.x+Fe,y:e.y+(e.h-r)/2,cols:n,rows:t,step:(e.w-20-Me)/(n-1)}},Re=(e,t)=>{let n=e<600,r=Math.max(1,t),i=r*q+(r-1)*Pe;if(!n){let r=Oe(Math.round(e*.26),188,236),a=Math.max(i,178),o=16+r+24,s=e-32-r-92-48,c=e-16-92,l=[0,1,2].map(e=>({x:16,y:40+e*32,w:r,h:K})),u=Math.max(1,Math.floor((40+a-138-20+Ne-Me)/Ne)),d={x:16,y:138,w:r,h:40+a-138},f=Oe(Math.round(s*.4),112,164),p=(Math.min(a,178)-8)/2;return{narrow:n,height:40+a+18,pad:16,heads:{queue:{x:16,y:14,w:r,h:16},workers:{x:o,y:14,w:s,h:16}},chips:l,well:d,grid:Le(d,u),slots:Array.from({length:t},(e,t)=>({x:o,y:40+t*46,w:s,h:q})),rail:{x:f,y:6,w:s-f-6,h:K},done:{x:c,y:40,w:92,h:p},failed:{x:c,y:40+p+8,w:92,h:p}}}let a=e-24,o=12,s={x:12,y:o,w:a,h:16};o+=24;let c=[0,1].map(e=>({x:12,y:o+e*32,w:a,h:K})),l=o+64+2,u={x:12,y:l,w:a,h:48};o=l+u.h,o+=18;let d={x:12,y:o,w:a,h:16};o+=24;let f=o;o+=i,o+=12;let p=(a-8)/2;return{narrow:n,height:o+40+12,pad:12,heads:{queue:s,workers:d},chips:c,well:u,grid:Le(u,2),slots:Array.from({length:t},(e,t)=>({x:12,y:f+t*46,w:a,h:q})),rail:{x:40,y:6,w:a-40-6,h:K},done:{x:12,y:o,w:p,h:40},failed:{x:12+p+8,y:o,w:p,h:40}}},ze=({kind:e})=>{let t={size:12,weight:`regular`};return e===`llm`?(0,z.jsx)(A,{...t}):e===`tool`?(0,z.jsx)(le,{...t}):e===`agent`?(0,z.jsx)(h,{...t}):(0,z.jsx)(c,{...t})};function Be({jobs:e,workers:t,now:n,rateLimits:i=[],paused:c=!1,onPausedChange:l,onConcurrencyChange:u,minConcurrency:d=1,maxConcurrency:f=8,backpressure:h,window:g=2*Ce,totals:_,openId:v,defaultOpenId:b=null,onOpenChange:x,onPromote:S,onCancel:C,title:w=`Queue`,name:T,className:E,embedded:ee=!1,labels:te}){let D=ge(te),O=(0,y.useRef)(null),k=(0,y.useRef)(null),ae=(0,y.useRef)(null),A=(0,y.useRef)(new Map),oe=`ui-agqc-`+(0,y.useId)().replace(/[^a-zA-Z0-9_-]/g,``),[ce,le]=(0,y.useState)(0);(0,y.useLayoutEffect)(()=>{let e=k.current;if(!e)return;le(e.clientWidth);let t=new ResizeObserver(()=>le(e.clientWidth));return t.observe(e),()=>t.disconnect()},[]);let ue=ce||812,[de,fe]=(0,y.useState)(()=>Date.now()),j=n??de,M=i.find(e=>!e.workerId&&!e.bandOnly&&e.from<=j&&jN||t.some(t=>t.id===e&&t.rateLimited)?!0:i.some(t=>t.workerId===e&&!t.bandOnly&&t.from<=j&&je.status===`queued`),I=e.filter(e=>e.status===`running`),pe=n===void 0&&(F.length>0||I.length>0||N),L=(0,y.useRef)({seen:new Map,gone:new Map,flash:new Map,limited:!1,over:!1,msg:``,msgAt:0,mounted:!1}),R=typeof performance<`u`?performance.now():0;{let t=L.current,n=e=>{t.msg=e,t.msgAt=R};for(let r of e){let e=r.attempt??1,i=t.seen.get(r.id);if(!i){t.seen.set(r.id,{status:r.status,attempt:e,first:R,fresh:t.mounted,worker:r.worker});continue}if(r.status===`running`&&r.worker&&(i.worker=r.worker),i.status===r.status&&i.attempt===e)continue;let a=i.status===`running`||i.status===`queued`;(r.status===`done`||r.status===`failed`)&&a&&t.gone.set(r.id,R),r.status===`failed`&&a&&n(D.announceFailed(r.name,r.error)),r.status===`queued`&&i.status===`running`&&(t.flash.set(r.id,R),e>i.attempt&&n(D.announceRetry(r.name,e,r.maxAttempts))),i.status=r.status,i.attempt=e}N!==t.limited&&(t.mounted&&n(N?D.announceLimited(Math.ceil((M.until-j)/1e3)):D.announceResumed),t.limited=N);let r=h!==void 0&&F.length>h;r!==t.over&&(r&&t.mounted&&h!==void 0&&n(D.announcePressure(U(F.length),h)),t.over=r);for(let[e,n]of t.gone)R-n>ve&&t.gone.delete(e);for(let[e,n]of t.flash)R-n>ye&&t.flash.delete(e);if(t.seen.size>e.length+64){let n=new Set(e.map(e=>e.id));for(let e of t.seen.keys())n.has(e)||t.seen.delete(e)}}let[me,he]=(0,y.useState)(``);(0,y.useEffect)(()=>{L.current.mounted=!0,L.current.msg&&L.current.msg!==me&&he(L.current.msg)});let B=Re(ue,t.length),V=e=>{let t=_e[e.priority??`normal`],n=L.current.seen.get(e.id);return t===0&&n?.fresh&&R-n.firstV(e)-V(t)||e.enqueuedAt-t.enqueuedAt||(e.idK+q,Fe=Pe?q-3:q,Le=Math.max(0,W.length-K-Fe),Be=new Map(t.map((e,t)=>[e.id,t])),J=[],He=e=>({x:e.x+B.rail.x,y:e.y+B.rail.y,w:B.rail.w,h:B.rail.h}),Y=(e,t,n)=>{if(t===void 0||R-t>=n)return;let r=L.current.seen.get(e.id)?.worker??e.worker,i=r===void 0?void 0:Be.get(r);return i===void 0?void 0:B.slots[i]},Ue=0;W.forEach(e=>{let t=L.current.flash.has(e.id),n=Y(e,L.current.flash.get(e.id),Se);if(n){J.push({job:e,shape:`bar`,box:He(n),flash:!0,p:1});return}let r=Ue++;if(re.job.ide.status===`done`).length,Ge=_?.failed??e.filter(e=>e.status===`failed`).length,Ke=e.filter(e=>e.status===`done`&&e.endedAt!==void 0&&e.endedAt>j-Ce&&e.endedAt<=j).length,qe=De([...e.filter(e=>e.startedAt!==void 0&&e.status!==`queued`&&e.startedAt>j-Ce).map(e=>e.startedAt-e.enqueuedAt),...F.map(e=>j-e.enqueuedAt)],.95),Je=h!==void 0&&F.length>h,X=N?`limited`:c?`paused`:F.length||I.length?`live`:`idle`,Ye=j-g,Xe=g/96,{starts:Ze,ends:Qe}=(0,y.useMemo)(()=>{let t=[],n=[];for(let r of e){let e=r.status===`queued`?1/0:r.startedAt??r.endedAt??1/0;t.push(r.enqueuedAt),n.push(Math.max(r.enqueuedAt,e))}return t.sort((e,t)=>e-t),n.sort((e,t)=>e-t),{starts:t,ends:n}},[e]),$e=0,et=0,tt=e=>{for(;$ee[1])),it=Math.max(rt*1.15,(h??0)*1.2,4),at=we.find(e=>e>=it)??Math.ceil(it/500)*500,ot=Math.max(Ie,10+U(at).length*7),st=Math.max(40,ue-2*B.pad-ot),ct=B.narrow?88:112,lt=e=>(e-Ye)/g*st,ut=je(nt.map(([e,t])=>[lt(e),t])),dt=ut?`${ut}L${G(st)},0L0,0Z`:``,ft=nt.reduce((e,t)=>e+t[1],0)/nt.length,pt=i.filter(e=>e.until>Ye&&e.from({l:e,x1:lt(Math.max(e.from,Ye)),x2:lt(Math.min(e.until,j))})),mt=g/Ce,ht=mt>=2880?`${+(mt/1440).toFixed(1)} days`:mt>=120?`${+(mt/60).toFixed(1)} h`:mt>=2?`${+mt.toFixed(1)} min`:`${Math.round(g/1e3)}s`,gt=`${D.depth}, ${ht}: ${F.length}, peak ${rt}, average ${ft.toFixed(1)}${h===void 0?``:`, ${h}`}.`,_t=(0,y.useRef)(new Map),vt=(e,t,n)=>{let r=_t.current.get(e);r||(r={el:null,shown:t,target:t,fmt:n},_t.current.set(e,r)),r.target=t,r.fmt=n;let i=r;return(0,z.jsx)(`span`,{className:`ui-agqc__num`,ref:e=>{i.el=e,e&&!e.textContent&&(e.textContent=i.fmt(i.shown))}})},yt=(0,y.useRef)({now:j,at:typeof performance<`u`?performance.now():0});yt.current.now!==j&&(yt.current={now:j,at:typeof performance<`u`?performance.now():0});let Z=(0,y.useRef)({needClock:pe,needPaint:!1,ymax:at,pausedLabel:D.paused});Z.current={needClock:pe,needPaint:F.length>0||I.length>0||N,ymax:at,pausedLabel:D.paused};let bt=(0,y.useRef)(()=>{});(0,y.useEffect)(()=>{let e=0,t=0,n=!0,r=performance.now(),i=0,a=0,o=Z.current.ymax;O.current?.style.setProperty(`--ui-agqc-ymax`,String(o));let s=()=>{cancelAnimationFrame(e),window.clearTimeout(t),e=0,t=0},c=r=>{if(!(!n||document.hidden)){if(r){window.clearTimeout(t),t=0,e||=requestAnimationFrame(l);return}e||t||(t=window.setTimeout(()=>{t=0,e=requestAnimationFrame(l)},100))}},l=t=>{e=0;let n=Math.min(64,t-r);r=t;let s=Ae(),l=1-Math.exp(-n/110),u=!1;for(let e of _t.current.values()){if(e.shown===e.target)continue;let t=e.target-e.shown;e.shown=s||Math.abs(t)<.02*Math.max(1,Math.abs(e.target))*.05+.004?e.target:e.shown+t*l,e.el&&(e.el.textContent=e.fmt(e.shown)),u=!0}let d=Z.current.ymax;if(o!==d){let e=d-o;o=s||Math.abs(e)<.01?d:o+e*(1-Math.exp(-n/160)),O.current?.style.setProperty(`--ui-agqc-ymax`,String(o)),u=!0}if(Z.current.needPaint&&t-i>100){i=t;let e=O.current;if(e){let t=yt.current;Te(e,t.at?t.now+(performance.now()-t.at):t.now,Z.current.pausedLabel)}}Z.current.needClock&&t-a>1e3&&(a=t,fe(Date.now())),u||Z.current.needClock?c(!0):Z.current.needPaint&&c(!1)},u=()=>{!n||document.hidden||(r=performance.now(),s(),e=requestAnimationFrame(l))};bt.current=u;let d=new IntersectionObserver(([e])=>{n=e.isIntersecting,n?u():s()});O.current&&d.observe(O.current);let f=()=>document.hidden?s():u();return document.addEventListener(`visibilitychange`,f),u(),()=>{s(),d.disconnect(),document.removeEventListener(`visibilitychange`,f)}},[]),(0,y.useEffect)(()=>bt.current()),(0,y.useLayoutEffect)(()=>{O.current?.style.setProperty(`--ui-agqc-ymax`,String(Z.current.ymax))},[]);let[,xt]=(0,y.useState)(0),St=L.current.gone.size>0||L.current.flash.size>0||F.some(e=>e.priority===`high`&&R-(L.current.seen.get(e.id)?.first??0){if(!St)return;let e=window.setTimeout(()=>xt(e=>e+1),120);return()=>window.clearTimeout(e)});let[Ct,wt]=(0,y.useState)(b),Tt=v===void 0?Ct:v,Et=t=>{wt(t),x?.(t,t?e.find(e=>e.id===t):void 0)},[Dt,Ot]=(0,y.useState)(null),kt=J.filter(e=>e.shape!==`gone`),At=Tt?kt.find(e=>e.job.id===Tt):void 0,jt=!At&&Dt?kt.find(e=>e.job.id===Dt):void 0,Mt=At??jt;(0,y.useEffect)(()=>{Tt&&!At&&Et(null)}),(0,y.useEffect)(()=>{if(!At)return;let e=e=>{let t=e.target;ae.current?.contains(t)||[...A.current.values()].some(e=>e.contains(t))||Et(null)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)});let[Nt,Pt]=(0,y.useState)(120);(0,y.useLayoutEffect)(()=>{let e=ae.current?.offsetHeight;e&&Math.abs(e-Nt)>1&&Pt(e)});let Q=[...I.filter(e=>e.worker!==void 0&&Be.has(e.worker)).sort((e,t)=>Be.get(e.worker)-Be.get(t.worker)),...W.slice(0,K+Fe)],[Ft,It]=(0,y.useState)(null),Lt=Ft&&Q.some(e=>e.id===Ft)?Ft:Q[0]?.id,Rt=e=>{e&&(It(e.id),A.current.get(e.id)?.focus())},zt=(e,t)=>{let n=Q.findIndex(e=>e.id===t.id),r={ArrowDown:()=>Rt(Q[n+1]),ArrowRight:()=>Rt(Q[n+1]),ArrowUp:()=>Rt(Q[n-1]),ArrowLeft:()=>Rt(Q[n-1]),Home:()=>Rt(Q[0]),End:()=>Rt(Q[Q.length-1]),Escape:()=>Tt&&Et(null)};r[e.key]&&(e.preventDefault(),r[e.key]())},Bt=e=>e.status===`done`||e.status===`failed`?1:e.status===`running`?Oe(e.progress??(e.startedAt!==void 0&&e.estimate?(j-e.startedAt)/e.estimate:.5),.015,1):0,Vt=e=>{let t=e.job,n=[t.name,D.kind[t.kind]];if(t.status===`queued`&&n.push(`${D.waiting} ${H(j-t.enqueuedAt)}`,D.formatPosition((e.index??0)+1,W.length)),t.status===`running`){let e=t.worker?P(t.worker):N;n.push(e?D.paused:`${D.running} ${H(j-(t.startedAt??j))}, ${Math.round(Bt(t)*100)}%`)}return t.priority===`high`&&n.push(D.high),t.priority===`low`&&n.push(D.low),(t.attempt??1)>1&&n.push(D.formatAttempt(t.attempt??1,t.maxAttempts)),n.join(`, `)},Ht=e=>{let t=e.job,n=e.shape===`gone`,i=t.attempt??1,a=t.status===`running`&&(t.worker?P(t.worker):N),o=t.status===`queued`?H(j-t.enqueuedAt):t.status===`running`?a?D.paused:H(j-(t.startedAt??j)):t.status===`done`?D.done:D.failed,s=L.current.seen.get(t.id),c=s&&!s.fresh?Math.min(420,(e.index??0)*22):0;return(0,z.jsxs)(`button`,{ref:e=>{e?A.current.set(t.id,e):A.current.delete(t.id)},type:`button`,className:`ui-agqc__job`,"data-shape":e.shape,"data-kind":t.kind,"data-status":t.status,"data-flash":e.flash?``:void 0,"data-halted":a?``:void 0,"data-priority":t.priority&&t.priority!==`normal`?t.priority:void 0,"data-open":Tt===t.id?``:void 0,"data-enqueued":t.enqueuedAt,"data-started":t.startedAt,"data-estimate":t.status===`running`&&t.progress==null?t.estimate:void 0,tabIndex:!n&&Lt===t.id?0:-1,"aria-hidden":n||void 0,"aria-label":Vt(e),"aria-haspopup":`dialog`,"aria-expanded":Tt===t.id,style:{translate:`${e.box.x}px ${e.box.y}px`,width:e.box.w,height:e.box.h,"--p":e.p??Bt(t),animationDelay:`${c}ms`},onPointerEnter:()=>!n&&Ot(t.id),onPointerLeave:()=>Ot(e=>e===t.id?null:e),onFocus:()=>It(t.id),onClick:()=>{n||(It(t.id),Et(Tt===t.id?null:t.id))},onKeyDown:e=>zt(e,t),children:[(0,z.jsx)(`span`,{className:`ui-agqc__fill`,"aria-hidden":`true`}),(0,z.jsxs)(`span`,{className:`ui-agqc__job-in`,"aria-hidden":`true`,children:[(0,z.jsx)(`span`,{className:`ui-agqc__job-icon`,"data-logo":t.icon?``:void 0,children:t.icon??(0,z.jsx)(ze,{kind:t.kind})}),(0,z.jsx)(`span`,{className:`ui-agqc__job-name`,dir:`auto`,children:t.name}),t.priority===`high`&&(0,z.jsx)(`span`,{className:`ui-agqc__badge`,"data-kind":`high`,title:D.high,children:(0,z.jsx)(r,{size:10,weight:`bold`})}),i>1&&(0,z.jsxs)(`span`,{className:`ui-agqc__badge`,"data-kind":`retry`,title:D.formatAttempt(i,t.maxAttempts),children:[(0,z.jsx)(p,{size:10,weight:`bold`}),i]}),(0,z.jsx)(`span`,{className:`ui-agqc__job-meta`,children:o})]})]},t.id)},Ut=e=>{let n=e.job,i=!!At,a=n.attempt??1,o=n.worker?t.find(e=>e.id===n.worker):void 0,s=[n.status===`queued`?{k:D.waiting,v:H(j-n.enqueuedAt),clock:`queue`,enqueued:n.enqueuedAt}:{k:D.waited,v:H((n.startedAt??j)-n.enqueuedAt)},...n.status===`running`?[{k:D.running,v:H(j-(n.startedAt??j)),clock:`run`,started:n.startedAt}]:[],...n.status===`queued`?[{k:D.position,v:D.formatPosition((e.index??0)+1,W.length)}]:[],...n.status===`running`&&o?[{k:D.worker,v:o.name}]:[],{k:D.priority,v:n.priority===`high`?D.high:n.priority===`low`?D.low:D.normal},{k:D.attempt,v:D.formatAttempt(a,n.maxAttempts)}],c=Math.min(B.narrow?ue-2*B.pad:280,ue-16),l=e.box.y+e.box.h+6,u=l+Nt>B.height+120&&e.box.y-Nt-6>0?e.box.y-Nt-6:l,d=Oe(e.box.x,8,ue-c-8),f=n.status===`running`&&(n.worker?P(n.worker):N),p=f?D.paused:D.status[n.status];return(0,z.jsxs)(`div`,{ref:ae,className:`ui-agqc__pop`,role:i?`dialog`:`tooltip`,"aria-label":n.name,"data-pinned":i?``:void 0,"data-kind":n.kind,"data-status":f?`halted`:n.status,style:{translate:`${d}px ${u}px`,width:c},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),Et(null),A.current.get(n.id)?.focus())},children:[(0,z.jsxs)(`div`,{className:`ui-agqc__pop-head`,children:[(0,z.jsx)(`span`,{className:`ui-agqc__pop-icon`,"data-logo":n.icon?``:void 0,children:n.icon??(0,z.jsx)(ze,{kind:n.kind})}),(0,z.jsxs)(`span`,{className:`ui-agqc__pop-who`,children:[(0,z.jsx)(`span`,{className:`ui-agqc__pop-name`,dir:`auto`,children:n.name}),(0,z.jsxs)(`span`,{className:`ui-agqc__pop-kind`,dir:`auto`,children:[D.kind[n.kind],n.detail?` · ${n.detail}`:``]})]}),(0,z.jsx)(`span`,{className:`ui-agqc__pill`,"data-status":f?`halted`:n.status,children:p}),i&&(0,z.jsx)(`button`,{type:`button`,className:`ui-agqc__close`,"aria-label":D.close,onClick:()=>{Et(null),A.current.get(n.id)?.focus()},children:(0,z.jsx)(m,{size:14})})]}),(0,z.jsx)(`dl`,{className:`ui-agqc__pop-stats`,children:s.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.k}),(0,z.jsx)(`dd`,{"data-live-clock":e.clock,"data-enqueued":e.enqueued,"data-started":e.started,children:e.v})]},e.k))}),n.error&&(0,z.jsxs)(`p`,{className:`ui-agqc__pop-error`,children:[(0,z.jsx)(se,{size:12}),(0,z.jsx)(`span`,{dir:`auto`,children:n.error})]}),i&&(S||C)&&(n.status===`queued`||n.status===`running`)&&(0,z.jsxs)(`div`,{className:`ui-agqc__pop-actions`,children:[S&&n.status===`queued`&&(e.index??0)>0&&(0,z.jsxs)(`button`,{type:`button`,className:`ui-agqc__btn`,onClick:()=>S(n),children:[(0,z.jsx)(r,{size:12,weight:`bold`}),D.high]}),C&&(0,z.jsxs)(`button`,{type:`button`,className:`ui-agqc__btn`,"data-kind":`danger`,onClick:()=>{C(n),Et(null)},children:[(0,z.jsx)(m,{size:10}),D.failed]})]})]},n.id)},$=e=>({translate:`${e.x}px ${e.y}px`,width:e.w,height:e.h}),Wt=I.filter(e=>e.worker!==void 0&&Be.has(e.worker)).length,Gt=[{label:D.waiting,value:vt(`waiting`,F.length,U),kind:Je?`warn`:void 0},{label:D.running,value:(0,z.jsxs)(z.Fragment,{children:[vt(`running`,Wt,U),(0,z.jsxs)(`span`,{className:`ui-agqc__of`,children:[`/`,t.length]})]})},{label:D.throughput,value:(0,z.jsxs)(z.Fragment,{children:[vt(`rate`,Ke,U),(0,z.jsx)(`span`,{className:`ui-agqc__of`,children:`/min`})]})},{label:D.waitP95,value:vt(`p95`,qe,H)}],Kt=M?Math.max(0,Math.ceil((M.until-j)/1e3)):0,qt=X===`paused`?D.paused:X===`live`?D.live:D.idle,Jt=t.length>d,Yt=t.lengthl(!c),children:[c?(0,z.jsx)(ie,{size:14}):(0,z.jsx)(re,{size:14}),(0,z.jsx)(`span`,{className:`ui-agqc__btn-text`,children:c?D.live:D.paused})]}),u&&(0,z.jsxs)(`span`,{className:`ui-agqc__stepper`,role:`group`,"aria-label":D.workers,children:[(0,z.jsx)(`button`,{type:`button`,"aria-label":D.workers,disabled:!Jt,onClick:()=>Jt&&u(t.length-1),children:(0,z.jsx)(ne,{size:14})}),(0,z.jsx)(`output`,{className:`ui-agqc__stepper-value`,"aria-live":`polite`,children:t.length}),(0,z.jsx)(`button`,{type:`button`,"aria-label":D.workers,disabled:!Yt,onClick:()=>Yt&&u(t.length+1),children:(0,z.jsx)(o,{size:14})})]})]})]}),(0,z.jsxs)(`div`,{ref:k,className:`ui-agqc__card`,children:[(0,z.jsx)(`dl`,{className:`ui-agqc__stats`,children:Gt.map(e=>(0,z.jsxs)(`div`,{className:`ui-agqc__stat`,"data-kind":e.kind,children:[(0,z.jsx)(`dt`,{children:e.label}),(0,z.jsx)(`dd`,{children:e.value})]},e.label))}),(0,z.jsxs)(`div`,{className:`ui-agqc__flow`,style:{height:B.height},"data-narrow":B.narrow?``:void 0,children:[(0,z.jsxs)(`span`,{className:`ui-agqc__col-head`,style:$(B.heads.queue),children:[(0,z.jsx)(`span`,{children:D.queue}),(0,z.jsx)(`b`,{children:vt(`depth`,F.length,U)}),Le>0&&B.narrow&&(0,z.jsxs)(`span`,{className:`ui-agqc__col-more`,children:[`+`,U(Le),` `,D.more]})]}),(0,z.jsxs)(`span`,{className:`ui-agqc__col-head`,style:$(B.heads.workers),children:[(0,z.jsx)(`span`,{children:D.workers}),(0,z.jsxs)(`b`,{children:[Wt,`/`,t.length]})]}),(0,z.jsx)(`span`,{className:`ui-agqc__well`,"aria-hidden":`true`,"data-empty":W.length<=K?``:void 0,style:$(B.well)}),W.length===0&&(0,z.jsx)(`span`,{className:`ui-agqc__empty`,style:$({x:B.chips[0].x,y:B.chips[0].y,w:B.chips[0].w,h:B.well.y+B.well.h-B.chips[0].y}),children:D.nothingWaiting}),Pe&&(0,z.jsxs)(`span`,{className:`ui-agqc__more`,"aria-hidden":`true`,style:$({x:B.grid.x+(q-3)%B.grid.cols*B.grid.step,y:B.grid.y+Math.floor((q-3)/B.grid.cols)*Ne,w:2*B.grid.step+Me,h:Me}),children:[`+`,Ee(Le)]}),t.map((e,t)=>{let n=B.slots[t],r=I.some(t=>t.worker===e.id),i=P(e.id);return(0,z.jsxs)(`div`,{className:`ui-agqc__slot`,"data-busy":r?``:void 0,"data-limited":i?``:void 0,style:$(n),children:[(0,z.jsxs)(`span`,{className:`ui-agqc__who`,style:{width:B.rail.x-16},children:[(0,z.jsx)(`span`,{className:`ui-agqc__logo`,"data-logo":e.icon?``:void 0,children:e.icon??ke(e.name)}),(0,z.jsxs)(`span`,{className:`ui-agqc__who-text`,children:[(0,z.jsx)(`span`,{className:`ui-agqc__who-name`,children:e.name}),e.detail&&(0,z.jsx)(`span`,{className:`ui-agqc__who-detail`,children:e.detail})]})]}),(0,z.jsx)(`span`,{className:`ui-agqc__rail`,style:{left:B.rail.x,top:B.rail.y,width:B.rail.w,height:B.rail.h},children:!r&&(0,z.jsx)(`span`,{children:i||c?D.paused:D.idle})})]},e.id)}),[`done`,`failed`].map(e=>{let t=e===`done`?We:Ge;return(0,z.jsxs)(`div`,{className:`ui-agqc__bin`,"data-kind":e,style:$(e===`done`?B.done:B.failed),children:[(0,z.jsx)(`span`,{className:`ui-agqc__bin-icon`,children:e===`done`?(0,z.jsx)(a,{size:12,weight:`bold`}):(0,z.jsx)(m,{size:12,weight:`bold`})}),(0,z.jsx)(`span`,{className:`ui-agqc__bin-label`,children:e===`done`?D.done:D.failed}),(0,z.jsx)(`span`,{className:`ui-agqc__bin-count`,title:U(t),children:vt(`bin-${e}`,t,Ee)}),(0,z.jsx)(`span`,{className:`ui-agqc__bin-hit`,"aria-hidden":`true`},t)]},e)}),(0,z.jsx)(`div`,{className:`ui-agqc__jobs`,role:`group`,"aria-label":`${D.running} ${Wt}, ${D.waiting} ${W.length}`,children:J.map(Ht)}),Mt&&Ut(Mt)]}),(0,z.jsxs)(`div`,{className:`ui-agqc__chart`,style:{"--ui-agqc-gutter":`${ot}px`},children:[(0,z.jsx)(`div`,{className:`ui-agqc__chart-head`,children:(0,z.jsx)(`span`,{className:`ui-agqc__chart-title`,children:D.depth})}),(0,z.jsxs)(`div`,{className:`ui-agqc__plot`,role:`img`,"aria-label":gt,style:{height:ct},children:[[0,at].map(e=>(0,z.jsx)(`span`,{className:`ui-agqc__grid`,"data-zero":e===0?``:void 0,style:{"--v":e},"aria-hidden":`true`,children:(h===void 0||Math.abs(e-h)>at*.1)&&(0,z.jsx)(`span`,{children:U(e)})},e)),(0,z.jsxs)(`svg`,{className:`ui-agqc__svg`,width:st,height:ct,viewBox:`0 0 ${st} ${ct}`,"aria-hidden":`true`,children:[(0,z.jsx)(`defs`,{children:(0,z.jsxs)(`linearGradient`,{id:oe,x1:`0`,y1:`1`,x2:`0`,y2:`0`,children:[(0,z.jsx)(`stop`,{offset:`0`,className:`ui-agqc__stop`,"data-at":`top`}),(0,z.jsx)(`stop`,{offset:`1`,className:`ui-agqc__stop`,"data-at":`bottom`})]})}),pt.map(({l:e,x1:t,x2:n})=>(0,z.jsx)(`g`,{className:`ui-agqc__band`,children:(0,z.jsx)(`rect`,{x:t,y:0,width:Math.max(1,n-t),height:ct})},`${e.from}-${e.label??``}`)),(0,z.jsxs)(`g`,{className:`ui-agqc__scaled`,style:{"--h":ct},children:[(0,z.jsx)(`path`,{className:`ui-agqc__area`,d:dt,fill:`url(#${oe})`}),(0,z.jsx)(`path`,{className:`ui-agqc__line`,d:ut}),h!==void 0&&(0,z.jsx)(`line`,{className:`ui-agqc__bp`,x1:0,x2:st,y1:h,y2:h})]})]}),h!==void 0&&(0,z.jsx)(`span`,{className:`ui-agqc__bp-label`,style:{"--v":h},"aria-hidden":`true`,children:h}),(0,z.jsx)(`span`,{className:`ui-agqc__dot`,style:{"--v":F.length},"aria-hidden":`true`})]}),(0,z.jsxs)(`div`,{className:`ui-agqc__axis`,"aria-hidden":`true`,children:[(0,z.jsxs)(`span`,{children:[ht,` `,D.ago]}),(0,z.jsx)(`span`,{children:D.now})]})]})]}),(0,z.jsx)(`div`,{className:`ui-agqc__sr`,"aria-live":`polite`,children:me})]})}var Ve=` +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./ArrowUp.es-4Hv09PbZ.js";import{t as i}from"./CaretRight.es-DLLkzlqU.js";import{t as a}from"./Check.es-D8gUNq6Q.js";import{t as o}from"./Plus.es-DsoFTrCh.js";import{t as s}from"./Stack.es-BNgbK5ij.js";import{t as c}from"./User.es-DHwtE-a6.js";import{pt as l}from"./useI18n-BAo1UrJW.js";import{n as u}from"./useToggle-DpH7h_oD.js";import{t as d}from"./CompactSwitch-D0aW-Phm.js";import{M as f}from"./overview-ARhe2pSk.js";import{Gt as p,Ot as m,Vt as h,qt as g,x as _}from"./index-CWTBzWuK.js";import{t as v}from"./ProviderMark-C49bIWJW.js";var y=t(e(),1),b=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M204,64V168a12,12,0,0,1-24,0V93L72.49,200.49a12,12,0,0,1-17-17L163,76H88a12,12,0,0,1,0-24H192A12,12,0,0,1,204,64Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M192,64V168L88,64Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M192,56H88a8,8,0,0,0-5.66,13.66L128.69,116,58.34,186.34a8,8,0,0,0,11.32,11.32L140,127.31l46.34,46.35A8,8,0,0,0,200,168V64A8,8,0,0,0,192,56Zm-8,92.69-38.34-38.34h0L107.31,72H184Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-13.66,5.66L140,127.31,69.66,197.66a8,8,0,0,1-11.32-11.32L128.69,116,82.34,69.66A8,8,0,0,1,88,56H192A8,8,0,0,1,200,64Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M198,64V168a6,6,0,0,1-12,0V78.48L68.24,196.24a6,6,0,0,1-8.48-8.48L177.52,70H88a6,6,0,0,1,0-12H192A6,6,0,0,1,198,64Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M200,64V168a8,8,0,0,1-16,0V83.31L69.66,197.66a8,8,0,0,1-11.32-11.32L172.69,72H88a8,8,0,0,1,0-16H192A8,8,0,0,1,200,64Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M196,64V168a4,4,0,0,1-8,0V73.66L66.83,194.83a4,4,0,0,1-5.66-5.66L182.34,68H88a4,4,0,0,1,0-8H192A4,4,0,0,1,196,64Z`}))]]),x=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H72a8,8,0,0,1,0-16H184a8,8,0,0,1,0,16Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H40a6,6,0,0,1,0-12H216A6,6,0,0,1,222,128Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H40a4,4,0,0,1,0-8H216A4,4,0,0,1,220,128Z`}))]]),S=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M200,28H160a20,20,0,0,0-20,20V208a20,20,0,0,0,20,20h40a20,20,0,0,0,20-20V48A20,20,0,0,0,200,28Zm-4,176H164V52h32ZM96,28H56A20,20,0,0,0,36,48V208a20,20,0,0,0,20,20H96a20,20,0,0,0,20-20V48A20,20,0,0,0,96,28ZM92,204H60V52H92Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M208,48V208a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8h40A8,8,0,0,1,208,48ZM96,40H56a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M200,34H160a14,14,0,0,0-14,14V208a14,14,0,0,0,14,14h40a14,14,0,0,0,14-14V48A14,14,0,0,0,200,34Zm2,174a2,2,0,0,1-2,2H160a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2h40a2,2,0,0,1,2,2ZM96,34H56A14,14,0,0,0,42,48V208a14,14,0,0,0,14,14H96a14,14,0,0,0,14-14V48A14,14,0,0,0,96,34Zm2,174a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2H96a2,2,0,0,1,2,2Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M200,36H160a12,12,0,0,0-12,12V208a12,12,0,0,0,12,12h40a12,12,0,0,0,12-12V48A12,12,0,0,0,200,36Zm4,172a4,4,0,0,1-4,4H160a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4h40a4,4,0,0,1,4,4ZM96,36H56A12,12,0,0,0,44,48V208a12,12,0,0,0,12,12H96a12,12,0,0,0,12-12V48A12,12,0,0,0,96,36Zm4,172a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H96a4,4,0,0,1,4,4Z`}))]]),C=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M234.49,111.07,90.41,22.94A20,20,0,0,0,60,39.87V216.13a20,20,0,0,0,30.41,16.93l144.08-88.13a19.82,19.82,0,0,0,0-33.86ZM84,208.85V47.15L216.16,128Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M228.23,134.69,84.15,222.81A8,8,0,0,1,72,216.12V39.88a8,8,0,0,1,12.15-6.69l144.08,88.12A7.82,7.82,0,0,1,228.23,134.69Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M231.36,116.19,87.28,28.06a14,14,0,0,0-14.18-.27A13.69,13.69,0,0,0,66,39.87V216.13a13.69,13.69,0,0,0,7.1,12.08,14,14,0,0,0,14.18-.27l144.08-88.13a13.82,13.82,0,0,0,0-23.62Zm-6.26,13.38L81,217.7a2,2,0,0,1-2.06,0,1.78,1.78,0,0,1-1-1.61V39.87a1.78,1.78,0,0,1,1-1.61A2.06,2.06,0,0,1,80,38a2,2,0,0,1,1,.31L225.1,126.43a1.82,1.82,0,0,1,0,3.14Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M230.32,117.9,86.24,29.79a11.91,11.91,0,0,0-12.17-.23A11.71,11.71,0,0,0,68,39.89V216.11a11.71,11.71,0,0,0,6.07,10.33,11.91,11.91,0,0,0,12.17-.23L230.32,138.1a11.82,11.82,0,0,0,0-20.2Zm-4.18,13.37L82.06,219.39a4,4,0,0,1-4.07.07,3.77,3.77,0,0,1-2-3.35V39.89a3.77,3.77,0,0,1,2-3.35,4,4,0,0,1,4.07.07l144.08,88.12a3.8,3.8,0,0,1,0,6.54Z`}))]]),w=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z`}))]]),T=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z`}))]]),E=new Map([[`bold`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M230.47,67.5a12,12,0,0,0-19.26-4.32L172.43,99l-12.68-2.72L157,83.57l35.79-38.78a12,12,0,0,0-4.32-19.26A76.07,76.07,0,0,0,88.41,121.64L30.92,174.18a4.68,4.68,0,0,0-.39.38,36,36,0,0,0,50.91,50.91l.38-.39,52.54-57.49A76.05,76.05,0,0,0,230.47,67.5ZM160,148a51.5,51.5,0,0,1-23.35-5.52,12,12,0,0,0-14.26,2.62L64.31,208.66a12,12,0,0,1-17-17l63.55-58.07a12,12,0,0,0,2.62-14.26A51.5,51.5,0,0,1,108,96a52.06,52.06,0,0,1,52-52h.89L135.17,71.87a12,12,0,0,0-2.91,10.65l5.66,26.35a12,12,0,0,0,9.21,9.21l26.35,5.66a12,12,0,0,0,10.65-2.91L212,95.12c0,.3,0,.59,0,.89A52.06,52.06,0,0,1,160,148Z`}))],[`duotone`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M224,96a64,64,0,0,1-94.94,56L73,217A24,24,0,0,1,39,183L104,126.94a64,64,0,0,1,80-90.29L144,80l5.66,26.34L176,112l43.35-40A63.8,63.8,0,0,1,224,96Z`,opacity:`0.2`}),y.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`fill`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M232,96a72,72,0,0,1-100.94,66L79,222.22c-.12.14-.26.29-.39.42a32,32,0,0,1-45.26-45.26c.14-.13.28-.27.43-.39L94,124.94a72.07,72.07,0,0,1,83.54-98.78,8,8,0,0,1,3.93,13.19L144,80l5.66,26.35L176,112l40.65-37.52a8,8,0,0,1,13.19,3.93A72.6,72.6,0,0,1,232,96Z`}))],[`light`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M224.91,69.75a6,6,0,0,0-9.63-2.16l-41.07,37.9L154.7,101.3l-4.19-19.51,37.9-41.07a6,6,0,0,0-2.16-9.63,70,70,0,0,0-89.77,94.39l-61.39,53c-.11.09-.21.19-.32.3A30,30,0,0,0,77.2,221.23c.11-.11.21-.21.3-.32l53-61.39a70,70,0,0,0,94.39-89.77ZM160,154a58,58,0,0,1-28-7.22,6,6,0,0,0-7.45,1.33L68.57,212.88a18,18,0,0,1-25.45-25.45l64.76-55.94A6,6,0,0,0,109.2,124a58,58,0,0,1,64-84.53L139.58,75.93a6,6,0,0,0-1.45,5.33l5.65,26.35a6,6,0,0,0,4.61,4.61l26.35,5.65a6,6,0,0,0,5.33-1.45L216.49,82.8A58.06,58.06,0,0,1,160,154Z`}))],[`regular`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`thin`,y.createElement(y.Fragment,null,y.createElement(`path`,{d:`M223.05,70.5a4,4,0,0,0-6.42-1.44l-41.82,38.6L153,103l-4.68-21.79,38.6-41.82a4,4,0,0,0-1.44-6.43A68,68,0,0,0,98.94,126L36.4,180l-.21.2a28,28,0,0,0,39.6,39.6l.2-.21,54-62.54A68,68,0,0,0,228,96,67.51,67.51,0,0,0,223.05,70.5ZM160,156a60,60,0,0,1-29-7.47,4,4,0,0,0-5,.89L70,214.25A20,20,0,0,1,41.75,186l64.82-56a4,4,0,0,0,.89-5,60,60,0,0,1,69.46-86.59L141.05,77.29a4,4,0,0,0-1,3.55l5.66,26.35a4,4,0,0,0,3.07,3.07l26.35,5.66a4,4,0,0,0,3.55-1l38.87-35.87A60.05,60.05,0,0,1,160,156Z`}))]]),ee=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:b}));ee.displayName=`ArrowUpRightIcon`;var te=ee,D=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:x}));D.displayName=`MinusIcon`;var ne=D,O=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:S}));O.displayName=`PauseIcon`;var re=O,k=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:C}));k.displayName=`PlayIcon`;var ie=k,ae=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:w}));ae.displayName=`SparkleIcon`;var A=ae,oe=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:T}));oe.displayName=`WarningIcon`;var se=oe,ce=y.forwardRef((e,t)=>y.createElement(l,{ref:t,...e,weights:E}));ce.displayName=`WrenchIcon`;var le=ce;function ue(){return f(`/api/live`)}function de(e){return e?`1`:`0`}function fe(e){let t=e.workers.map(e=>[e.id,e.name,e.provider,e.in_flight,e.max_inflight,de(e.busy),de(e.rate_limited),de(e.enabled)].join(`:`)).join(`,`),n=(e.queue??[]).map(e=>[e.id,e.account_id??``,e.name,e.status,e.started_at??``].join(`:`)).join(`,`),r=(e.occupancy??[]).map(e=>[e.id,e.account_id??``,e.name,e.status,e.started_at??``].join(`:`)).join(`,`),i=(e.recent_completions??[]).map(e=>[e.request_id??``,e.account_id,e.status].join(`:`)).join(`,`),a=e.rate_limits.map(e=>e.id).join(`,`),o=e.sticky;return[t,n,r,i,a,o.bindings,o.hits,o.misses].join(`|`)}function j(e){let t=e.accounts.map(e=>[e.id,e.in_flight,e.max_inflight,de(e.enabled)].join(`:`)).join(`,`);return[e.in_flight,e.capacity,e.rpm,t,fe(e)].join(`|`)}var M={generatedAt:0,backpressure:6,throughputPerMin:42,waitP95Ms:2800,totals:{done:186,failed:4},workers:[{id:`acc-wb-a1`,name:`WorkBuddy`,provider:`workbuddy`,busy:!0,progress:.72,jobId:`j1`,concurrency:4,inFlight:3,cells:[{id:`j1`,name:`glm-5.2`,startedAtMs:0,elapsedMs:11200},{id:`j1b`,name:`kimi-k2.7-code`,startedAtMs:0,elapsedMs:8400},{id:`j1c`,name:`qwen3-embedding`,startedAtMs:0,elapsedMs:4100}]},{id:`acc-wb-a2`,name:`Zhipu`,provider:`zhipu`,busy:!0,progress:.41,jobId:`j2`,rateLimited:!0,concurrency:2,inFlight:1,cells:[{id:`j2`,name:`deepseek-v4-pro`,startedAtMs:0,elapsedMs:9400}]},{id:`acc-qd-b1`,name:`Qoder`,provider:`qoder`,busy:!0,progress:.88,jobId:`j3`,concurrency:1,inFlight:1,cells:[{id:`j3`,name:`glm-5.3`,startedAtMs:0,elapsedMs:6200}]},{id:`acc-qd-b2`,name:`Kimi`,provider:`kimi`,busy:!1,progress:0,concurrency:4,inFlight:0,cells:[]},{id:`acc-trae-c1`,name:`Trae`,provider:`trae`,busy:!0,progress:.23,jobId:`j4`,concurrency:3,inFlight:2,cells:[{id:`j4`,name:`qwen3-coder`,startedAtMs:0,elapsedMs:3100},{id:`j4b`,name:`glm-5.3-flash`,startedAtMs:0,elapsedMs:1800}]},{id:`acc-codex-d1`,name:`Codex`,provider:`codex`,busy:!1,progress:0,rateLimited:!0,concurrency:2,inFlight:0,cells:[]}],jobs:[{id:`j1`,name:`glm-5.2`,kind:`chat`,status:`running`,accountId:`acc-wb-a1`,progress:.72,elapsedMs:11200,sticky:!0},{id:`j1b`,name:`kimi-k2.7-code`,kind:`chat`,status:`running`,accountId:`acc-wb-a1`,progress:.55,elapsedMs:8400},{id:`j1c`,name:`qwen3-embedding`,kind:`embed`,status:`running`,accountId:`acc-wb-a1`,progress:.3,elapsedMs:4100},{id:`j2`,name:`deepseek-v4-pro`,kind:`embed`,status:`running`,accountId:`acc-wb-a2`,progress:.41,elapsedMs:9400},{id:`j3`,name:`glm-5.3`,kind:`chat`,status:`running`,accountId:`acc-qd-b1`,progress:.88,elapsedMs:6200},{id:`j4`,name:`qwen3-coder`,kind:`tools`,status:`running`,accountId:`acc-trae-c1`,progress:.23,elapsedMs:3100},{id:`j4b`,name:`glm-5.3-flash`,kind:`chat`,status:`running`,accountId:`acc-trae-c1`,progress:.15,elapsedMs:1800},{id:`j5`,name:`deepseek-v4.1-flash`,kind:`chat`,status:`queued`,progress:0,elapsedMs:7200},{id:`j6`,name:`glm-5.2`,kind:`chat`,status:`queued`,progress:0,elapsedMs:5100},{id:`j7`,name:`kimi-k2.7-code`,kind:`chat`,status:`queued`,progress:0,elapsedMs:2800,sticky:!0,priority:`high`},{id:`j8`,name:`qwen3-embedding`,kind:`embed`,status:`queued`,progress:0,elapsedMs:1400},{id:`j9`,name:`qwen3-coder`,kind:`tools`,status:`queued`,progress:0,elapsedMs:900},{id:`j10`,name:`glm-5.3-flash`,kind:`chat`,status:`queued`,progress:0,elapsedMs:600},{id:`j11`,name:`deepseek-v4-pro`,kind:`embed`,status:`queued`,progress:0,elapsedMs:400},{id:`j12`,name:`glm-5.3`,kind:`chat`,status:`queued`,progress:0,elapsedMs:200,priority:`high`}],rateLimits:[{id:`rl1`,label:`Zhipu 限流`,remainingMs:97e3,from:.55,until:.72},{id:`rl2`,label:`Codex 冷却`,remainingMs:41e3,from:.82,until:1}],depthSeries:[1,1,2,2,3,4,5,6,7,6,5,4,3,4,5,6,5,4,3,3,2,3,4,3]},N=[{name:`glm-5.3`,kind:`chat`},{name:`qwen3-embedding`,kind:`embed`},{name:`qwen3-coder`,kind:`tools`},{name:`glm-5.3-flash`,kind:`chat`,sticky:!0},{name:`deepseek-v4.1-flash`,kind:`chat`},{name:`deepseek-v4-pro`,kind:`embed`},{name:`kimi-k2.7-code`,kind:`chat`}],P=100;function F(e=M){return{...e,workers:e.workers.map(e=>({...e,cells:e.cells?.map(e=>({...e}))})),jobs:e.jobs.map(e=>({...e})),rateLimits:e.rateLimits.map(e=>({...e})),depthSeries:[...e.depthSeries],totals:{...e.totals},completions:void 0}}function I(){return F()}function pe(){let e=Math.max(1,M.depthSeries.length);return{generatedAt:Date.now(),backpressure:M.backpressure,throughputPerMin:0,waitP95Ms:0,totals:{done:0,failed:0},workers:[],jobs:[],rateLimits:[],depthSeries:Array.from({length:e},()=>0)}}function L(e){return e.jobs.length===0&&e.workers.length===0&&e.throughputPerMin===0&&(e.totals?.done??0)===0&&(e.totals?.failed??0)===0}function R(e,t){let n=Math.max(16,Math.min(500,t)),r=F(e);r.generatedAt=(e.generatedAt||0)+n,r.rateLimits=r.rateLimits.map(e=>({...e,remainingMs:Math.max(0,e.remainingMs-n)})).filter(e=>e.remainingMs>0);for(let e of r.workers)e.id===`acc-wb-a2`?e.rateLimited=r.rateLimits.some(e=>e.label.includes(`Zhipu`)):e.id===`acc-codex-d1`&&(e.rateLimited=r.rateLimits.some(e=>e.label.includes(`Codex`)));let i=new Map(r.jobs.map(e=>[e.id,e]));for(let e of r.workers){if(e.cells?.length)for(let t of e.cells)t.elapsedMs+=n;if(e.rateLimited)continue;let t=0;for(let r of e.cells??[]){let e=i.get(r.id);if(!e||e.status!==`running`)continue;e.elapsedMs=r.elapsedMs;let a=.045+r.id.charCodeAt(r.id.length-1)%5*.008;e.progress=Math.min(1,e.progress+n/1e3*a),t=Math.max(t,e.progress)}(e.cells?.length??0)>0&&(e.progress=t,e.busy=!0,e.jobId=e.cells[0].id,e.inFlight=e.cells.length)}let a=[];for(let e of r.workers){if(e.rateLimited||!e.cells?.length)continue;let t=e.cells.find(e=>{let t=i.get(e.id);return!!(t&&t.status===`running`&&t.progress>=.995)});if(!t)continue;let n=(t.id.charCodeAt(1)+Math.floor(r.generatedAt/1e3))%9!=0;a.push({jobId:t.id,workerId:e.id,ok:n})}for(let e of a){let t=i.get(e.jobId),n=r.workers.find(t=>t.id===e.workerId);if(!t||!n)continue;if(n.cells=(n.cells??[]).filter(t=>t.id!==e.jobId),n.inFlight=n.cells.length,n.jobId=n.cells[0]?.id,n.busy=n.cells.length>0,n.progress=n.busy?Math.max(.04,...n.cells.map(e=>i.get(e.id)?.progress??.04)):0,t.accountId=void 0,e.ok){t.status=`done`,t.progress=1,r.totals.done+=1;continue}let a=(t.attempt??1)+1;if(a<=3&&(e.jobId.charCodeAt(0)+Math.floor(r.generatedAt/900))%2==0){t.status=`queued`,t.progress=0,t.elapsedMs=80,t.attempt=a,t.priority=`high`;continue}t.status=`failed`,t.progress=1,r.totals.failed+=1}let o=[];for(let e of a){let t=i.get(e.jobId);t&&(t.status===`done`||t.status===`failed`)&&o.push({id:t.id,name:t.name,kind:t.kind,ok:t.status===`done`})}r.completions=o.length>0?o:void 0,r.jobs=r.jobs.filter(e=>e.status===`queued`||e.status===`running`);for(let e of r.jobs)e.status===`queued`&&(e.elapsedMs+=n);let s=r.jobs.filter(e=>e.status===`queued`);for(let e of r.workers){if(e.rateLimited)continue;let t=me(e.concurrency??1);for(e.cells=e.cells??[];e.cells.lengthe.id!==n.id),r].slice(0,t),e.busy=!0,e.progress=Math.max(e.progress,.04),e.jobId=e.cells[0]?.id,e.inFlight=e.cells.length}}if(r.jobs.filter(e=>e.status===`queued`).length<10&&r.generatedAt%1600e.status===`running`),t=r.jobs.filter(e=>e.status===`queued`),n=t.filter(e=>e.priority===`high`&&e.elapsedMs>=400),i=t.filter(e=>!(e.priority===`high`&&e.elapsedMs>=400)),a=n;r.jobs=[...e,...a,...i]}let c=r.workers.filter(e=>e.busy).length,l=r.jobs.filter(e=>e.status===`queued`).length,u=Math.max(1,l+Math.max(0,c-2)),d=r.depthSeries.slice(1);return d.push(u),r.depthSeries=d,r.throughputPerMin=Math.max(28,Math.min(58,r.throughputPerMin+(P%3-1))),r.waitP95Ms=Math.max(900,Math.min(5200,r.waitP95Ms+(l>4?40:-20))),r}function me(e){return e==null||!Number.isFinite(e)?1:Math.max(1,Math.min(16,Math.floor(e)))}function he(e,t){let n=Date.now(),r=new Map(e.jobs.map(e=>[e.id,e])),i=Math.max(1,M.depthSeries.length),a=t.rate_limits.map((e,t)=>{let n=Math.min(.86,t*.22%.86);return{id:e.id,label:e.label,remainingMs:Math.max(0,e.remaining_ms),from:n,until:Math.min(1,n+.14)}}),o=(t.queue??[]).map(e=>{let t=(e.id||``).trim(),i=r.get(t),a,o=e.started_at?.trim();if(o){let e=Date.parse(o);Number.isNaN(e)||(a=e)}return a==null&&i?.startedAtMs!=null&&(a=i.startedAtMs),a??=n,{id:t,name:(e.name||``).trim()||t,kind:`chat`,status:`queued`,accountId:(e.account_id||``).trim()||void 0,progress:0,startedAtMs:a,elapsedMs:Math.max(0,n-a)}}),s=new Set(o.map(e=>e.id)),c=new Map;for(let e of o){let t=(e.accountId||``).trim();t&&e.name&&!c.has(t)&&c.set(t,e.name)}let l=new Map;for(let e of t.occupancy??[]){let t=(e.account_id||``).trim(),n=(e.id||``).trim();if(!t||!n)continue;let r=l.get(t)??[];r.push(e),l.set(t,r)}let u=new Map;for(let t of e.workers)t.cells?.length&&u.set(t.id,t.cells);let d=(e,t,n)=>{let r=e?.trim();if(r){let e=Date.parse(r);if(!Number.isNaN(e))return e}return t??n},f=t.workers.map(e=>{let i=me(e.max_inflight??4),a=e.in_flight!=null&&Number.isFinite(e.in_flight)?Math.max(0,Math.floor(e.in_flight)):+!!e.busy,o=Math.min(i,a),f=u.get(e.id)??[],p=new Map(f.map(e=>[e.id,e])),m=l.get(e.id)??[],h=[];for(let e of m){if(h.length>=o)break;let t=(e.id||``).trim();if(!t)continue;let i=p.get(t),a=r.get(t),c=d(e.started_at,i?.startedAtMs??a?.startedAtMs,n),l=(e.name||``).trim()||t;h.push({id:t,name:l,startedAtMs:c,elapsedMs:Math.max(0,n-c),pendingInbound:s.has(t)})}let g=t.workers.find(t=>t.id===e.id),_=d(g?.started_at,void 0,n);for(;h.length0;return{id:e.id,name:e.name,provider:e.provider,busy:v,progress:v?Math.max(.04,Math.min(1,e.progress||0)):0,rateLimited:e.rate_limited,jobId:h[0]?.id,concurrency:i,inFlight:o,cells:h}}),p=[];for(let e of f)for(let t of e.cells??[]){if(s.has(t.id))continue;let n=r.get(t.id);p.push({id:t.id,name:t.name,kind:n?.kind??`chat`,status:`running`,accountId:e.id,progress:e.progress,startedAtMs:t.startedAtMs,elapsedMs:t.elapsedMs})}let m=[...p,...o],h=e.waitP95Ms===0,g=h?e.depthSeries.slice(1):Array.from({length:Math.max(0,i-1)},()=>0);for(g.push(Math.max(0,t.in_flight));g.lengthe.id)),b=[];for(let n of e.jobs){if(n.status!==`running`||y.has(n.id))continue;let e=(n.accountId||n.id.replace(/^live-/,``)).trim(),r=!0;if(_.has(n.id))r=_.get(n.id),_.delete(n.id);else{let n=v.get(e);if(n&&n.length>0)r=n.shift();else{let n=t.workers.find(t=>t.id===e);n?.last_error_kind&&n.last_error_kind.trim()!==``&&(r=!1)}}b.push({id:n.id,name:n.name,kind:n.kind,ok:r})}let x=0,S=0;if(h){x=e.totals.done,S=e.totals.failed;let n=t.recent_completions??[];if(n.length>0)for(let e of n)(e.status||``).trim()===`ok`?x+=1:S+=1;else for(let e of b)e.ok?x+=1:S+=1}return{generatedAt:n,backpressure:e.backpressure,throughputPerMin:Math.max(0,t.rpm),waitP95Ms:0,totals:{done:x,failed:S},workers:f,rateLimits:a,jobs:m,depthSeries:g.slice(-i),completions:b.length>0?b:void 0}}var z=n(),B={waiting:`Waiting`,running:`Running`,throughput:`Throughput`,waitP95:`Wait p95`,queue:`Queue`,workers:`Workers`,nothingWaiting:`Nothing waiting`,done:`Done`,failed:`Failed`,depth:`Queue depth`,idle:`Idle`,paused:`Paused`,live:`Live`,rateLimited:`Rate limited`,now:`now`,ago:`ago`,more:`more`,high:`High`,low:`Low`,normal:`Normal`,priority:`Priority`,attempt:`Attempt`,position:`Position`,waited:`Waited`,worker:`Worker`,close:`Close details`,kind:{llm:`LLM call`,tool:`Tool call`,agent:`Sub-agent`,human:`Human review`},status:{queued:`Waiting`,running:`Running`,done:`Done`,failed:`Failed`},formatPosition:(e,t)=>`${e} of ${t}`,formatAttempt:(e,t)=>`${e}${t?` of ${t}`:``}`,announceFailed:(e,t)=>t?`${e} failed: ${t}`:`${e} failed`,announceRetry:(e,t,n)=>`${e} failed – retrying, attempt ${t}${n?` of ${n}`:``}`,announceLimited:e=>`Rate limited – workers paused for ${e} seconds`,announceResumed:`Rate limit lifted – workers resumed`,announcePressure:(e,t)=>`${e} jobs waiting – above the backpressure line of ${t}`};function ge(e){return{...B,...e,kind:{...B.kind,...e?.kind},status:{...B.status,...e?.status}}}var _e={high:0,normal:1,low:2},V=560,ve=1100,ye=1500,be=520,xe=200,Se=520,Ce=6e4,we=[4,6,8,10,12,16,20,24,30,40,50,60,80,100,120,160,200,300,400,500,600,800,1e3,1500,2e3],H=e=>{let t=Math.max(0,e);if(t<1e4)return`${(t/1e3).toFixed(1)}s`;let n=Math.round(t/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60);if(r<60)return`${r}m ${String(n%60).padStart(2,`0`)}s`;let i=Math.floor(r/60);return i<24?`${i}h ${String(r%60).padStart(2,`0`)}m`:`${Math.floor(i/24)}d ${i%24}h`};function Te(e,t,n){for(let r of e.querySelectorAll(`.ui-agqc__job`)){let e=r.dataset.status;if(e!==`queued`&&e!==`running`)continue;let i=Number(r.dataset.enqueued),a=Number(r.dataset.started),o=r.querySelector(`.ui-agqc__job-meta`);if(o){let s=r.hasAttribute(`data-halted`),c=e===`queued`?H(t-i):s?n:H(t-(Number.isFinite(a)?a:t));o.textContent!==c&&(o.textContent=c)}if(e===`running`&&r.dataset.estimate){let e=Number(r.dataset.estimate);if(e>0&&Number.isFinite(a)){let n=String(Oe((t-a)/e,.015,1));r.style.getPropertyValue(`--p`)!==n&&r.style.setProperty(`--p`,n)}}}for(let n of e.querySelectorAll(`[data-live-clock]`)){let e=Number(n.dataset.enqueued),r=Number(n.dataset.started),i=n.dataset.liveClock===`queue`?H(t-e):H(t-(Number.isFinite(r)?r:t));n.textContent!==i&&(n.textContent=i)}let r=e.querySelector(`[data-limit-until]`);if(!r)return;let i=Number(r.dataset.limitUntil);if(!Number.isFinite(i))return;let a=Math.max(0,Math.ceil((i-t)/1e3)),o=a<100?`${a}s`:H(a*1e3);r.textContent!==o&&(r.textContent=o)}var U=e=>Math.round(e).toLocaleString(`en-US`),W=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),Ee=e=>Math.round(e)<1e5?U(e):W.format(Math.round(e)),De=(e,t)=>{if(!e.length)return 0;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.floor(t*n.length))]},Oe=(e,t,n)=>Math.max(t,Math.min(n,e)),ke=e=>{let t=e.trim().split(/\s+/).filter(e=>/^[\p{L}\p{N}]/u.test(e)).slice(0,2).map(e=>Array.from(e)[0]);return(t.length?t.join(``):Array.from(e.trim())[0]??``).toUpperCase()},Ae=()=>typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,G=e=>Math.round(e*100)/100,je=e=>{let t=e.length;if(t<2)return``;let n=[],r=[];for(let i=0;i{let n=Math.max(2,Math.floor((e.w-20+Ne-Me)/Ne)),r=t*Ne-4;return{x:e.x+Fe,y:e.y+(e.h-r)/2,cols:n,rows:t,step:(e.w-20-Me)/(n-1)}},Re=(e,t)=>{let n=e<600,r=Math.max(1,t),i=r*q+(r-1)*Pe;if(!n){let r=Oe(Math.round(e*.26),188,236),a=Math.max(i,178),o=16+r+24,s=e-32-r-92-48,c=e-16-92,l=[0,1,2].map(e=>({x:16,y:40+e*32,w:r,h:K})),u=Math.max(1,Math.floor((40+a-138-20+Ne-Me)/Ne)),d={x:16,y:138,w:r,h:40+a-138},f=Oe(Math.round(s*.4),112,164),p=(Math.min(a,178)-8)/2;return{narrow:n,height:40+a+18,pad:16,heads:{queue:{x:16,y:14,w:r,h:16},workers:{x:o,y:14,w:s,h:16}},chips:l,well:d,grid:Le(d,u),slots:Array.from({length:t},(e,t)=>({x:o,y:40+t*46,w:s,h:q})),rail:{x:f,y:6,w:s-f-6,h:K},done:{x:c,y:40,w:92,h:p},failed:{x:c,y:40+p+8,w:92,h:p}}}let a=e-24,o=12,s={x:12,y:o,w:a,h:16};o+=24;let c=[0,1].map(e=>({x:12,y:o+e*32,w:a,h:K})),l=o+64+2,u={x:12,y:l,w:a,h:48};o=l+u.h,o+=18;let d={x:12,y:o,w:a,h:16};o+=24;let f=o;o+=i,o+=12;let p=(a-8)/2;return{narrow:n,height:o+40+12,pad:12,heads:{queue:s,workers:d},chips:c,well:u,grid:Le(u,2),slots:Array.from({length:t},(e,t)=>({x:12,y:f+t*46,w:a,h:q})),rail:{x:40,y:6,w:a-40-6,h:K},done:{x:12,y:o,w:p,h:40},failed:{x:12+p+8,y:o,w:p,h:40}}},ze=({kind:e})=>{let t={size:12,weight:`regular`};return e===`llm`?(0,z.jsx)(A,{...t}):e===`tool`?(0,z.jsx)(le,{...t}):e===`agent`?(0,z.jsx)(h,{...t}):(0,z.jsx)(c,{...t})};function Be({jobs:e,workers:t,now:n,rateLimits:i=[],paused:c=!1,onPausedChange:l,onConcurrencyChange:u,minConcurrency:d=1,maxConcurrency:f=8,backpressure:h,window:g=2*Ce,totals:_,openId:v,defaultOpenId:b=null,onOpenChange:x,onPromote:S,onCancel:C,title:w=`Queue`,name:T,className:E,embedded:ee=!1,labels:te}){let D=ge(te),O=(0,y.useRef)(null),k=(0,y.useRef)(null),ae=(0,y.useRef)(null),A=(0,y.useRef)(new Map),oe=`ui-agqc-`+(0,y.useId)().replace(/[^a-zA-Z0-9_-]/g,``),[ce,le]=(0,y.useState)(0);(0,y.useLayoutEffect)(()=>{let e=k.current;if(!e)return;le(e.clientWidth);let t=new ResizeObserver(()=>le(e.clientWidth));return t.observe(e),()=>t.disconnect()},[]);let ue=ce||812,[de,fe]=(0,y.useState)(()=>Date.now()),j=n??de,M=i.find(e=>!e.workerId&&!e.bandOnly&&e.from<=j&&jN||t.some(t=>t.id===e&&t.rateLimited)?!0:i.some(t=>t.workerId===e&&!t.bandOnly&&t.from<=j&&je.status===`queued`),I=e.filter(e=>e.status===`running`),pe=n===void 0&&(F.length>0||I.length>0||N),L=(0,y.useRef)({seen:new Map,gone:new Map,flash:new Map,limited:!1,over:!1,msg:``,msgAt:0,mounted:!1}),R=typeof performance<`u`?performance.now():0;{let t=L.current,n=e=>{t.msg=e,t.msgAt=R};for(let r of e){let e=r.attempt??1,i=t.seen.get(r.id);if(!i){t.seen.set(r.id,{status:r.status,attempt:e,first:R,fresh:t.mounted,worker:r.worker});continue}if(r.status===`running`&&r.worker&&(i.worker=r.worker),i.status===r.status&&i.attempt===e)continue;let a=i.status===`running`||i.status===`queued`;(r.status===`done`||r.status===`failed`)&&a&&t.gone.set(r.id,R),r.status===`failed`&&a&&n(D.announceFailed(r.name,r.error)),r.status===`queued`&&i.status===`running`&&(t.flash.set(r.id,R),e>i.attempt&&n(D.announceRetry(r.name,e,r.maxAttempts))),i.status=r.status,i.attempt=e}N!==t.limited&&(t.mounted&&n(N?D.announceLimited(Math.ceil((M.until-j)/1e3)):D.announceResumed),t.limited=N);let r=h!==void 0&&F.length>h;r!==t.over&&(r&&t.mounted&&h!==void 0&&n(D.announcePressure(U(F.length),h)),t.over=r);for(let[e,n]of t.gone)R-n>ve&&t.gone.delete(e);for(let[e,n]of t.flash)R-n>ye&&t.flash.delete(e);if(t.seen.size>e.length+64){let n=new Set(e.map(e=>e.id));for(let e of t.seen.keys())n.has(e)||t.seen.delete(e)}}let[me,he]=(0,y.useState)(``);(0,y.useEffect)(()=>{L.current.mounted=!0,L.current.msg&&L.current.msg!==me&&he(L.current.msg)});let B=Re(ue,t.length),V=e=>{let t=_e[e.priority??`normal`],n=L.current.seen.get(e.id);return t===0&&n?.fresh&&R-n.firstV(e)-V(t)||e.enqueuedAt-t.enqueuedAt||(e.idK+q,Fe=Pe?q-3:q,Le=Math.max(0,W.length-K-Fe),Be=new Map(t.map((e,t)=>[e.id,t])),J=[],He=e=>({x:e.x+B.rail.x,y:e.y+B.rail.y,w:B.rail.w,h:B.rail.h}),Y=(e,t,n)=>{if(t===void 0||R-t>=n)return;let r=L.current.seen.get(e.id)?.worker??e.worker,i=r===void 0?void 0:Be.get(r);return i===void 0?void 0:B.slots[i]},Ue=0;W.forEach(e=>{let t=L.current.flash.has(e.id),n=Y(e,L.current.flash.get(e.id),Se);if(n){J.push({job:e,shape:`bar`,box:He(n),flash:!0,p:1});return}let r=Ue++;if(re.job.ide.status===`done`).length,Ge=_?.failed??e.filter(e=>e.status===`failed`).length,Ke=e.filter(e=>e.status===`done`&&e.endedAt!==void 0&&e.endedAt>j-Ce&&e.endedAt<=j).length,qe=De([...e.filter(e=>e.startedAt!==void 0&&e.status!==`queued`&&e.startedAt>j-Ce).map(e=>e.startedAt-e.enqueuedAt),...F.map(e=>j-e.enqueuedAt)],.95),Je=h!==void 0&&F.length>h,X=N?`limited`:c?`paused`:F.length||I.length?`live`:`idle`,Ye=j-g,Xe=g/96,{starts:Ze,ends:Qe}=(0,y.useMemo)(()=>{let t=[],n=[];for(let r of e){let e=r.status===`queued`?1/0:r.startedAt??r.endedAt??1/0;t.push(r.enqueuedAt),n.push(Math.max(r.enqueuedAt,e))}return t.sort((e,t)=>e-t),n.sort((e,t)=>e-t),{starts:t,ends:n}},[e]),$e=0,et=0,tt=e=>{for(;$ee[1])),it=Math.max(rt*1.15,(h??0)*1.2,4),at=we.find(e=>e>=it)??Math.ceil(it/500)*500,ot=Math.max(Ie,10+U(at).length*7),st=Math.max(40,ue-2*B.pad-ot),ct=B.narrow?88:112,lt=e=>(e-Ye)/g*st,ut=je(nt.map(([e,t])=>[lt(e),t])),dt=ut?`${ut}L${G(st)},0L0,0Z`:``,ft=nt.reduce((e,t)=>e+t[1],0)/nt.length,pt=i.filter(e=>e.until>Ye&&e.from({l:e,x1:lt(Math.max(e.from,Ye)),x2:lt(Math.min(e.until,j))})),mt=g/Ce,ht=mt>=2880?`${+(mt/1440).toFixed(1)} days`:mt>=120?`${+(mt/60).toFixed(1)} h`:mt>=2?`${+mt.toFixed(1)} min`:`${Math.round(g/1e3)}s`,gt=`${D.depth}, ${ht}: ${F.length}, peak ${rt}, average ${ft.toFixed(1)}${h===void 0?``:`, ${h}`}.`,_t=(0,y.useRef)(new Map),vt=(e,t,n)=>{let r=_t.current.get(e);r||(r={el:null,shown:t,target:t,fmt:n},_t.current.set(e,r)),r.target=t,r.fmt=n;let i=r;return(0,z.jsx)(`span`,{className:`ui-agqc__num`,ref:e=>{i.el=e,e&&!e.textContent&&(e.textContent=i.fmt(i.shown))}})},yt=(0,y.useRef)({now:j,at:typeof performance<`u`?performance.now():0});yt.current.now!==j&&(yt.current={now:j,at:typeof performance<`u`?performance.now():0});let Z=(0,y.useRef)({needClock:pe,needPaint:!1,ymax:at,pausedLabel:D.paused});Z.current={needClock:pe,needPaint:F.length>0||I.length>0||N,ymax:at,pausedLabel:D.paused};let bt=(0,y.useRef)(()=>{});(0,y.useEffect)(()=>{let e=0,t=0,n=!0,r=performance.now(),i=0,a=0,o=Z.current.ymax;O.current?.style.setProperty(`--ui-agqc-ymax`,String(o));let s=()=>{cancelAnimationFrame(e),window.clearTimeout(t),e=0,t=0},c=r=>{if(!(!n||document.hidden)){if(r){window.clearTimeout(t),t=0,e||=requestAnimationFrame(l);return}e||t||(t=window.setTimeout(()=>{t=0,e=requestAnimationFrame(l)},100))}},l=t=>{e=0;let n=Math.min(64,t-r);r=t;let s=Ae(),l=1-Math.exp(-n/110),u=!1;for(let e of _t.current.values()){if(e.shown===e.target)continue;let t=e.target-e.shown;e.shown=s||Math.abs(t)<.02*Math.max(1,Math.abs(e.target))*.05+.004?e.target:e.shown+t*l,e.el&&(e.el.textContent=e.fmt(e.shown)),u=!0}let d=Z.current.ymax;if(o!==d){let e=d-o;o=s||Math.abs(e)<.01?d:o+e*(1-Math.exp(-n/160)),O.current?.style.setProperty(`--ui-agqc-ymax`,String(o)),u=!0}if(Z.current.needPaint&&t-i>100){i=t;let e=O.current;if(e){let t=yt.current;Te(e,t.at?t.now+(performance.now()-t.at):t.now,Z.current.pausedLabel)}}Z.current.needClock&&t-a>1e3&&(a=t,fe(Date.now())),u||Z.current.needClock?c(!0):Z.current.needPaint&&c(!1)},u=()=>{!n||document.hidden||(r=performance.now(),s(),e=requestAnimationFrame(l))};bt.current=u;let d=new IntersectionObserver(([e])=>{n=e.isIntersecting,n?u():s()});O.current&&d.observe(O.current);let f=()=>document.hidden?s():u();return document.addEventListener(`visibilitychange`,f),u(),()=>{s(),d.disconnect(),document.removeEventListener(`visibilitychange`,f)}},[]),(0,y.useEffect)(()=>bt.current()),(0,y.useLayoutEffect)(()=>{O.current?.style.setProperty(`--ui-agqc-ymax`,String(Z.current.ymax))},[]);let[,xt]=(0,y.useState)(0),St=L.current.gone.size>0||L.current.flash.size>0||F.some(e=>e.priority===`high`&&R-(L.current.seen.get(e.id)?.first??0){if(!St)return;let e=window.setTimeout(()=>xt(e=>e+1),120);return()=>window.clearTimeout(e)});let[Ct,wt]=(0,y.useState)(b),Tt=v===void 0?Ct:v,Et=t=>{wt(t),x?.(t,t?e.find(e=>e.id===t):void 0)},[Dt,Ot]=(0,y.useState)(null),kt=J.filter(e=>e.shape!==`gone`),At=Tt?kt.find(e=>e.job.id===Tt):void 0,jt=!At&&Dt?kt.find(e=>e.job.id===Dt):void 0,Mt=At??jt;(0,y.useEffect)(()=>{Tt&&!At&&Et(null)}),(0,y.useEffect)(()=>{if(!At)return;let e=e=>{let t=e.target;ae.current?.contains(t)||[...A.current.values()].some(e=>e.contains(t))||Et(null)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)});let[Nt,Pt]=(0,y.useState)(120);(0,y.useLayoutEffect)(()=>{let e=ae.current?.offsetHeight;e&&Math.abs(e-Nt)>1&&Pt(e)});let Q=[...I.filter(e=>e.worker!==void 0&&Be.has(e.worker)).sort((e,t)=>Be.get(e.worker)-Be.get(t.worker)),...W.slice(0,K+Fe)],[Ft,It]=(0,y.useState)(null),Lt=Ft&&Q.some(e=>e.id===Ft)?Ft:Q[0]?.id,Rt=e=>{e&&(It(e.id),A.current.get(e.id)?.focus())},zt=(e,t)=>{let n=Q.findIndex(e=>e.id===t.id),r={ArrowDown:()=>Rt(Q[n+1]),ArrowRight:()=>Rt(Q[n+1]),ArrowUp:()=>Rt(Q[n-1]),ArrowLeft:()=>Rt(Q[n-1]),Home:()=>Rt(Q[0]),End:()=>Rt(Q[Q.length-1]),Escape:()=>Tt&&Et(null)};r[e.key]&&(e.preventDefault(),r[e.key]())},Bt=e=>e.status===`done`||e.status===`failed`?1:e.status===`running`?Oe(e.progress??(e.startedAt!==void 0&&e.estimate?(j-e.startedAt)/e.estimate:.5),.015,1):0,Vt=e=>{let t=e.job,n=[t.name,D.kind[t.kind]];if(t.status===`queued`&&n.push(`${D.waiting} ${H(j-t.enqueuedAt)}`,D.formatPosition((e.index??0)+1,W.length)),t.status===`running`){let e=t.worker?P(t.worker):N;n.push(e?D.paused:`${D.running} ${H(j-(t.startedAt??j))}, ${Math.round(Bt(t)*100)}%`)}return t.priority===`high`&&n.push(D.high),t.priority===`low`&&n.push(D.low),(t.attempt??1)>1&&n.push(D.formatAttempt(t.attempt??1,t.maxAttempts)),n.join(`, `)},Ht=e=>{let t=e.job,n=e.shape===`gone`,i=t.attempt??1,a=t.status===`running`&&(t.worker?P(t.worker):N),o=t.status===`queued`?H(j-t.enqueuedAt):t.status===`running`?a?D.paused:H(j-(t.startedAt??j)):t.status===`done`?D.done:D.failed,s=L.current.seen.get(t.id),c=s&&!s.fresh?Math.min(420,(e.index??0)*22):0;return(0,z.jsxs)(`button`,{ref:e=>{e?A.current.set(t.id,e):A.current.delete(t.id)},type:`button`,className:`ui-agqc__job`,"data-shape":e.shape,"data-kind":t.kind,"data-status":t.status,"data-flash":e.flash?``:void 0,"data-halted":a?``:void 0,"data-priority":t.priority&&t.priority!==`normal`?t.priority:void 0,"data-open":Tt===t.id?``:void 0,"data-enqueued":t.enqueuedAt,"data-started":t.startedAt,"data-estimate":t.status===`running`&&t.progress==null?t.estimate:void 0,tabIndex:!n&&Lt===t.id?0:-1,"aria-hidden":n||void 0,"aria-label":Vt(e),"aria-haspopup":`dialog`,"aria-expanded":Tt===t.id,style:{translate:`${e.box.x}px ${e.box.y}px`,width:e.box.w,height:e.box.h,"--p":e.p??Bt(t),animationDelay:`${c}ms`},onPointerEnter:()=>!n&&Ot(t.id),onPointerLeave:()=>Ot(e=>e===t.id?null:e),onFocus:()=>It(t.id),onClick:()=>{n||(It(t.id),Et(Tt===t.id?null:t.id))},onKeyDown:e=>zt(e,t),children:[(0,z.jsx)(`span`,{className:`ui-agqc__fill`,"aria-hidden":`true`}),(0,z.jsxs)(`span`,{className:`ui-agqc__job-in`,"aria-hidden":`true`,children:[(0,z.jsx)(`span`,{className:`ui-agqc__job-icon`,"data-logo":t.icon?``:void 0,children:t.icon??(0,z.jsx)(ze,{kind:t.kind})}),(0,z.jsx)(`span`,{className:`ui-agqc__job-name`,dir:`auto`,children:t.name}),t.priority===`high`&&(0,z.jsx)(`span`,{className:`ui-agqc__badge`,"data-kind":`high`,title:D.high,children:(0,z.jsx)(r,{size:10,weight:`bold`})}),i>1&&(0,z.jsxs)(`span`,{className:`ui-agqc__badge`,"data-kind":`retry`,title:D.formatAttempt(i,t.maxAttempts),children:[(0,z.jsx)(p,{size:10,weight:`bold`}),i]}),(0,z.jsx)(`span`,{className:`ui-agqc__job-meta`,children:o})]})]},t.id)},Ut=e=>{let n=e.job,i=!!At,a=n.attempt??1,o=n.worker?t.find(e=>e.id===n.worker):void 0,s=[n.status===`queued`?{k:D.waiting,v:H(j-n.enqueuedAt),clock:`queue`,enqueued:n.enqueuedAt}:{k:D.waited,v:H((n.startedAt??j)-n.enqueuedAt)},...n.status===`running`?[{k:D.running,v:H(j-(n.startedAt??j)),clock:`run`,started:n.startedAt}]:[],...n.status===`queued`?[{k:D.position,v:D.formatPosition((e.index??0)+1,W.length)}]:[],...n.status===`running`&&o?[{k:D.worker,v:o.name}]:[],{k:D.priority,v:n.priority===`high`?D.high:n.priority===`low`?D.low:D.normal},{k:D.attempt,v:D.formatAttempt(a,n.maxAttempts)}],c=Math.min(B.narrow?ue-2*B.pad:280,ue-16),l=e.box.y+e.box.h+6,u=l+Nt>B.height+120&&e.box.y-Nt-6>0?e.box.y-Nt-6:l,d=Oe(e.box.x,8,ue-c-8),f=n.status===`running`&&(n.worker?P(n.worker):N),p=f?D.paused:D.status[n.status];return(0,z.jsxs)(`div`,{ref:ae,className:`ui-agqc__pop`,role:i?`dialog`:`tooltip`,"aria-label":n.name,"data-pinned":i?``:void 0,"data-kind":n.kind,"data-status":f?`halted`:n.status,style:{translate:`${d}px ${u}px`,width:c},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),Et(null),A.current.get(n.id)?.focus())},children:[(0,z.jsxs)(`div`,{className:`ui-agqc__pop-head`,children:[(0,z.jsx)(`span`,{className:`ui-agqc__pop-icon`,"data-logo":n.icon?``:void 0,children:n.icon??(0,z.jsx)(ze,{kind:n.kind})}),(0,z.jsxs)(`span`,{className:`ui-agqc__pop-who`,children:[(0,z.jsx)(`span`,{className:`ui-agqc__pop-name`,dir:`auto`,children:n.name}),(0,z.jsxs)(`span`,{className:`ui-agqc__pop-kind`,dir:`auto`,children:[D.kind[n.kind],n.detail?` · ${n.detail}`:``]})]}),(0,z.jsx)(`span`,{className:`ui-agqc__pill`,"data-status":f?`halted`:n.status,children:p}),i&&(0,z.jsx)(`button`,{type:`button`,className:`ui-agqc__close`,"aria-label":D.close,onClick:()=>{Et(null),A.current.get(n.id)?.focus()},children:(0,z.jsx)(m,{size:14})})]}),(0,z.jsx)(`dl`,{className:`ui-agqc__pop-stats`,children:s.map(e=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{children:e.k}),(0,z.jsx)(`dd`,{"data-live-clock":e.clock,"data-enqueued":e.enqueued,"data-started":e.started,children:e.v})]},e.k))}),n.error&&(0,z.jsxs)(`p`,{className:`ui-agqc__pop-error`,children:[(0,z.jsx)(se,{size:12}),(0,z.jsx)(`span`,{dir:`auto`,children:n.error})]}),i&&(S||C)&&(n.status===`queued`||n.status===`running`)&&(0,z.jsxs)(`div`,{className:`ui-agqc__pop-actions`,children:[S&&n.status===`queued`&&(e.index??0)>0&&(0,z.jsxs)(`button`,{type:`button`,className:`ui-agqc__btn`,onClick:()=>S(n),children:[(0,z.jsx)(r,{size:12,weight:`bold`}),D.high]}),C&&(0,z.jsxs)(`button`,{type:`button`,className:`ui-agqc__btn`,"data-kind":`danger`,onClick:()=>{C(n),Et(null)},children:[(0,z.jsx)(m,{size:10}),D.failed]})]})]},n.id)},$=e=>({translate:`${e.x}px ${e.y}px`,width:e.w,height:e.h}),Wt=I.filter(e=>e.worker!==void 0&&Be.has(e.worker)).length,Gt=[{label:D.waiting,value:vt(`waiting`,F.length,U),kind:Je?`warn`:void 0},{label:D.running,value:(0,z.jsxs)(z.Fragment,{children:[vt(`running`,Wt,U),(0,z.jsxs)(`span`,{className:`ui-agqc__of`,children:[`/`,t.length]})]})},{label:D.throughput,value:(0,z.jsxs)(z.Fragment,{children:[vt(`rate`,Ke,U),(0,z.jsx)(`span`,{className:`ui-agqc__of`,children:`/min`})]})},{label:D.waitP95,value:vt(`p95`,qe,H)}],Kt=M?Math.max(0,Math.ceil((M.until-j)/1e3)):0,qt=X===`paused`?D.paused:X===`live`?D.live:D.idle,Jt=t.length>d,Yt=t.lengthl(!c),children:[c?(0,z.jsx)(ie,{size:14}):(0,z.jsx)(re,{size:14}),(0,z.jsx)(`span`,{className:`ui-agqc__btn-text`,children:c?D.live:D.paused})]}),u&&(0,z.jsxs)(`span`,{className:`ui-agqc__stepper`,role:`group`,"aria-label":D.workers,children:[(0,z.jsx)(`button`,{type:`button`,"aria-label":D.workers,disabled:!Jt,onClick:()=>Jt&&u(t.length-1),children:(0,z.jsx)(ne,{size:14})}),(0,z.jsx)(`output`,{className:`ui-agqc__stepper-value`,"aria-live":`polite`,children:t.length}),(0,z.jsx)(`button`,{type:`button`,"aria-label":D.workers,disabled:!Yt,onClick:()=>Yt&&u(t.length+1),children:(0,z.jsx)(o,{size:14})})]})]})]}),(0,z.jsxs)(`div`,{ref:k,className:`ui-agqc__card`,children:[(0,z.jsx)(`dl`,{className:`ui-agqc__stats`,children:Gt.map(e=>(0,z.jsxs)(`div`,{className:`ui-agqc__stat`,"data-kind":e.kind,children:[(0,z.jsx)(`dt`,{children:e.label}),(0,z.jsx)(`dd`,{children:e.value})]},e.label))}),(0,z.jsxs)(`div`,{className:`ui-agqc__flow`,style:{height:B.height},"data-narrow":B.narrow?``:void 0,children:[(0,z.jsxs)(`span`,{className:`ui-agqc__col-head`,style:$(B.heads.queue),children:[(0,z.jsx)(`span`,{children:D.queue}),(0,z.jsx)(`b`,{children:vt(`depth`,F.length,U)}),Le>0&&B.narrow&&(0,z.jsxs)(`span`,{className:`ui-agqc__col-more`,children:[`+`,U(Le),` `,D.more]})]}),(0,z.jsxs)(`span`,{className:`ui-agqc__col-head`,style:$(B.heads.workers),children:[(0,z.jsx)(`span`,{children:D.workers}),(0,z.jsxs)(`b`,{children:[Wt,`/`,t.length]})]}),(0,z.jsx)(`span`,{className:`ui-agqc__well`,"aria-hidden":`true`,"data-empty":W.length<=K?``:void 0,style:$(B.well)}),W.length===0&&(0,z.jsx)(`span`,{className:`ui-agqc__empty`,style:$({x:B.chips[0].x,y:B.chips[0].y,w:B.chips[0].w,h:B.well.y+B.well.h-B.chips[0].y}),children:D.nothingWaiting}),Pe&&(0,z.jsxs)(`span`,{className:`ui-agqc__more`,"aria-hidden":`true`,style:$({x:B.grid.x+(q-3)%B.grid.cols*B.grid.step,y:B.grid.y+Math.floor((q-3)/B.grid.cols)*Ne,w:2*B.grid.step+Me,h:Me}),children:[`+`,Ee(Le)]}),t.map((e,t)=>{let n=B.slots[t],r=I.some(t=>t.worker===e.id),i=P(e.id);return(0,z.jsxs)(`div`,{className:`ui-agqc__slot`,"data-busy":r?``:void 0,"data-limited":i?``:void 0,style:$(n),children:[(0,z.jsxs)(`span`,{className:`ui-agqc__who`,style:{width:B.rail.x-16},children:[(0,z.jsx)(`span`,{className:`ui-agqc__logo`,"data-logo":e.icon?``:void 0,children:e.icon??ke(e.name)}),(0,z.jsxs)(`span`,{className:`ui-agqc__who-text`,children:[(0,z.jsx)(`span`,{className:`ui-agqc__who-name`,children:e.name}),e.detail&&(0,z.jsx)(`span`,{className:`ui-agqc__who-detail`,children:e.detail})]})]}),(0,z.jsx)(`span`,{className:`ui-agqc__rail`,style:{left:B.rail.x,top:B.rail.y,width:B.rail.w,height:B.rail.h},children:!r&&(0,z.jsx)(`span`,{children:i||c?D.paused:D.idle})})]},e.id)}),[`done`,`failed`].map(e=>{let t=e===`done`?We:Ge;return(0,z.jsxs)(`div`,{className:`ui-agqc__bin`,"data-kind":e,style:$(e===`done`?B.done:B.failed),children:[(0,z.jsx)(`span`,{className:`ui-agqc__bin-icon`,children:e===`done`?(0,z.jsx)(a,{size:12,weight:`bold`}):(0,z.jsx)(m,{size:12,weight:`bold`})}),(0,z.jsx)(`span`,{className:`ui-agqc__bin-label`,children:e===`done`?D.done:D.failed}),(0,z.jsx)(`span`,{className:`ui-agqc__bin-count`,title:U(t),children:vt(`bin-${e}`,t,Ee)}),(0,z.jsx)(`span`,{className:`ui-agqc__bin-hit`,"aria-hidden":`true`},t)]},e)}),(0,z.jsx)(`div`,{className:`ui-agqc__jobs`,role:`group`,"aria-label":`${D.running} ${Wt}, ${D.waiting} ${W.length}`,children:J.map(Ht)}),Mt&&Ut(Mt)]}),(0,z.jsxs)(`div`,{className:`ui-agqc__chart`,style:{"--ui-agqc-gutter":`${ot}px`},children:[(0,z.jsx)(`div`,{className:`ui-agqc__chart-head`,children:(0,z.jsx)(`span`,{className:`ui-agqc__chart-title`,children:D.depth})}),(0,z.jsxs)(`div`,{className:`ui-agqc__plot`,role:`img`,"aria-label":gt,style:{height:ct},children:[[0,at].map(e=>(0,z.jsx)(`span`,{className:`ui-agqc__grid`,"data-zero":e===0?``:void 0,style:{"--v":e},"aria-hidden":`true`,children:(h===void 0||Math.abs(e-h)>at*.1)&&(0,z.jsx)(`span`,{children:U(e)})},e)),(0,z.jsxs)(`svg`,{className:`ui-agqc__svg`,width:st,height:ct,viewBox:`0 0 ${st} ${ct}`,"aria-hidden":`true`,children:[(0,z.jsx)(`defs`,{children:(0,z.jsxs)(`linearGradient`,{id:oe,x1:`0`,y1:`1`,x2:`0`,y2:`0`,children:[(0,z.jsx)(`stop`,{offset:`0`,className:`ui-agqc__stop`,"data-at":`top`}),(0,z.jsx)(`stop`,{offset:`1`,className:`ui-agqc__stop`,"data-at":`bottom`})]})}),pt.map(({l:e,x1:t,x2:n})=>(0,z.jsx)(`g`,{className:`ui-agqc__band`,children:(0,z.jsx)(`rect`,{x:t,y:0,width:Math.max(1,n-t),height:ct})},`${e.from}-${e.label??``}`)),(0,z.jsxs)(`g`,{className:`ui-agqc__scaled`,style:{"--h":ct},children:[(0,z.jsx)(`path`,{className:`ui-agqc__area`,d:dt,fill:`url(#${oe})`}),(0,z.jsx)(`path`,{className:`ui-agqc__line`,d:ut}),h!==void 0&&(0,z.jsx)(`line`,{className:`ui-agqc__bp`,x1:0,x2:st,y1:h,y2:h})]})]}),h!==void 0&&(0,z.jsx)(`span`,{className:`ui-agqc__bp-label`,style:{"--v":h},"aria-hidden":`true`,children:h}),(0,z.jsx)(`span`,{className:`ui-agqc__dot`,style:{"--v":F.length},"aria-hidden":`true`})]}),(0,z.jsxs)(`div`,{className:`ui-agqc__axis`,"aria-hidden":`true`,children:[(0,z.jsxs)(`span`,{children:[ht,` `,D.ago]}),(0,z.jsx)(`span`,{children:D.now})]})]})]}),(0,z.jsx)(`div`,{className:`ui-agqc__sr`,"aria-live":`polite`,children:me})]})}var Ve=` @property --ui-agqc-ymax { syntax: ""; inherits: true; initial-value: 10; } .ui-agqc { --aui-radius: var(--radius, 8px); diff --git a/internal/webui/static/assets/Input-CyXcxaPW.js b/internal/webui/static/assets/Input-C__Dw9HK.js similarity index 97% rename from internal/webui/static/assets/Input-CyXcxaPW.js rename to internal/webui/static/assets/Input-C__Dw9HK.js index 40d34257a..9e6b05075 100644 --- a/internal/webui/static/assets/Input-CyXcxaPW.js +++ b/internal/webui/static/assets/Input-C__Dw9HK.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{et as n,ut as r}from"./useI18n-XrvNxGvP.js";import{F as i,J as a,M as o,ct as s,d as c,j as l,lt as u,u as d}from"./SharedElementTransition-BlCsXfb1.js";var f=t(e(),1);function p(e){let{id:t,label:n,"aria-labelledby":i,"aria-label":a,labelElementType:o=`label`}=e;t=u(t);let s=u(),c={};n&&(i=i?`${s} ${i}`:s,c={id:s,htmlFor:o===`label`?t:void 0});let l=r({id:t,"aria-label":a,"aria-labelledby":i});return{labelProps:c,fieldProps:l}}var m=(0,f.createContext)({}),h=(0,f.forwardRef)(function(e,t){[e,t]=l(e,t,m);let{isDisabled:n,isInvalid:r,isReadOnly:s,onHoverStart:u,onHoverChange:p,onHoverEnd:h,...g}=e;n??=!!e[`aria-disabled`]&&e[`aria-disabled`]!==`false`,r??=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`;let{hoverProps:_,isHovered:v}=d({onHoverStart:u,onHoverChange:p,onHoverEnd:h,isDisabled:n}),{isFocused:y,isFocusVisible:b,focusProps:x}=c({within:!0}),S=o({...e,values:{isHovered:v,isFocusWithin:y,isFocusVisible:b,isDisabled:n,isInvalid:r},defaultClassName:`react-aria-Group`});return f.createElement(i.div,{...a(g,x,_),...S,ref:t,role:e.role??`group`,slot:e.slot??void 0,"data-focus-within":y||void 0,"data-hovered":v||void 0,"data-focus-visible":b||void 0,"data-disabled":n||void 0,"data-invalid":r||void 0,"data-readonly":s||void 0},S.children)});function g(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:o,fieldProps:c}=p(e),l=s([!!t,!!n,r,i]),u=s([!!t,!!n,r,i]);return c=a(c,{"aria-describedby":[l,u,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:o,fieldProps:c,descriptionProps:{id:l},errorMessageProps:{id:u}}}var _=(0,f.createContext)({}),v=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i},y=n(function(e,t){[e,t]=l(e,t,_);let{hoverProps:n,isHovered:r}=d({...e,isDisabled:e.disabled}),{isFocused:s,isFocusVisible:u,focusProps:p}=c({isTextInput:!0,autoFocus:e.autoFocus}),m=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,h=o({...e,values:{isHovered:r,isFocused:s,isFocusVisible:u,isDisabled:e.disabled||!1,isInvalid:m},defaultClassName:`react-aria-Input`});return f.createElement(i.input,{...a(v(e),p,n),...h,ref:t,"data-focused":s||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":u||void 0,"data-invalid":m||void 0})});export{m as a,h as i,y as n,p as o,g as r,_ as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{et as n,ut as r}from"./useI18n-BAo1UrJW.js";import{F as i,J as a,M as o,ct as s,d as c,j as l,lt as u,u as d}from"./SharedElementTransition-BlCsXfb1.js";var f=t(e(),1);function p(e){let{id:t,label:n,"aria-labelledby":i,"aria-label":a,labelElementType:o=`label`}=e;t=u(t);let s=u(),c={};n&&(i=i?`${s} ${i}`:s,c={id:s,htmlFor:o===`label`?t:void 0});let l=r({id:t,"aria-label":a,"aria-labelledby":i});return{labelProps:c,fieldProps:l}}var m=(0,f.createContext)({}),h=(0,f.forwardRef)(function(e,t){[e,t]=l(e,t,m);let{isDisabled:n,isInvalid:r,isReadOnly:s,onHoverStart:u,onHoverChange:p,onHoverEnd:h,...g}=e;n??=!!e[`aria-disabled`]&&e[`aria-disabled`]!==`false`,r??=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`;let{hoverProps:_,isHovered:v}=d({onHoverStart:u,onHoverChange:p,onHoverEnd:h,isDisabled:n}),{isFocused:y,isFocusVisible:b,focusProps:x}=c({within:!0}),S=o({...e,values:{isHovered:v,isFocusWithin:y,isFocusVisible:b,isDisabled:n,isInvalid:r},defaultClassName:`react-aria-Group`});return f.createElement(i.div,{...a(g,x,_),...S,ref:t,role:e.role??`group`,slot:e.slot??void 0,"data-focus-within":y||void 0,"data-hovered":v||void 0,"data-focus-visible":b||void 0,"data-disabled":n||void 0,"data-invalid":r||void 0,"data-readonly":s||void 0},S.children)});function g(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:o,fieldProps:c}=p(e),l=s([!!t,!!n,r,i]),u=s([!!t,!!n,r,i]);return c=a(c,{"aria-describedby":[l,u,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:o,fieldProps:c,descriptionProps:{id:l},errorMessageProps:{id:u}}}var _=(0,f.createContext)({}),v=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i},y=n(function(e,t){[e,t]=l(e,t,_);let{hoverProps:n,isHovered:r}=d({...e,isDisabled:e.disabled}),{isFocused:s,isFocusVisible:u,focusProps:p}=c({isTextInput:!0,autoFocus:e.autoFocus}),m=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,h=o({...e,values:{isHovered:r,isFocused:s,isFocusVisible:u,isDisabled:e.disabled||!1,isInvalid:m},defaultClassName:`react-aria-Input`});return f.createElement(i.input,{...a(v(e),p,n),...h,ref:t,"data-focused":s||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":u||void 0,"data-invalid":m||void 0})});export{m as a,h as i,y as n,p as o,g as r,_ as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/KeysPage-VmzvWLOM.js b/internal/webui/static/assets/KeysPage-spcjl-Xu.js similarity index 93% rename from internal/webui/static/assets/KeysPage-VmzvWLOM.js rename to internal/webui/static/assets/KeysPage-spcjl-Xu.js index 5e3ba258d..8c774d31d 100644 --- a/internal/webui/static/assets/KeysPage-VmzvWLOM.js +++ b/internal/webui/static/assets/KeysPage-spcjl-Xu.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./clipboard-CWhuA-N0.js";import{t as a}from"./Plus.es-BPfWzgUg.js";import{t as o}from"./TrashSimple.es-CiBYahWn.js";import{n as s,r as c}from"./useI18n-XrvNxGvP.js";import{t as l}from"./label-B8hTan2F.js";import{n as u,t as d}from"./PageAlert-BbN7e2aZ.js";import{n as f}from"./useToggle-55_Qx9vA.js";import{t as p}from"./checkbox-CUZk1qce.js";import{t as m}from"./description-Du44nrYx.js";import{t as h}from"./EmptyPanel-Bs-jQMvG.js";import{t as g}from"./input-CYN6ajmO.js";import{t as _}from"./modal-CQ6c3Rhf.js";import{t as v}from"./number-field-BUGr_bpm.js";import{t as y}from"./CompactSwitch-Dd3U4EbK.js";import{_ as b}from"./overview-ARhe2pSk.js";import{t as x}from"./form-qle3Iim5.js";import{t as S}from"./gsap-DWxn8li7.js";import{Lt as C,N as w,Ot as T,_ as E,k as D,m as O,o as k,t as A,v as j,x as M,y as N}from"./index-CAlyInAP.js";import{t as P}from"./ProviderMark-C49bIWJW.js";import{n as F,t as I}from"./provider-BZvt2HHB.js";import{t as L}from"./FormRow-CL_rVm7f.js";import{n as R,o as z,r as ee,t as B}from"./keys-DEnJc6b-.js";var V=t(e(),1),H=n(),U=1.1;function W({label:e,onConfirm:t,isPending:n,children:r}){let i=(0,V.useRef)(null),a=(0,V.useRef)(null);return(0,V.useEffect)(()=>()=>{a.current?.kill()},[]),(0,H.jsxs)(D,{delay:300,children:[(0,H.jsx)(D.Trigger,{children:(0,H.jsxs)(c,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e,isPending:n,className:`relative overflow-hidden`,onPressStart:()=>{let e=i.current;!e||n||(a.current?.kill(),a.current=S.to(e,{scaleX:1,duration:U*(1-Number(S.getProperty(e,`scaleX`))),ease:N.linear,onComplete:()=>{a.current=null,S.to(e,{scaleX:0,duration:M()?0:j.base,ease:N.out,delay:j.fast}),t()}}))},onPressEnd:()=>{let e=i.current;!e||!a.current||(a.current.kill(),a.current=null,S.to(e,{scaleX:0,duration:M()?0:j.base,ease:N.soft}))},children:[(0,H.jsx)(`span`,{ref:i,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 origin-left scale-x-0 bg-danger/20`}),(0,H.jsx)(`span`,{className:`relative inline-flex`,children:r})]})}),(0,H.jsx)(D.Content,{children:e})]})}function G(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function K(e,t){let n=e.indexOf(`:`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n+1);return i?F(r,i,t):I(r,t)}function q(e){let t=e.indexOf(`:`);return t===-1?e:e.slice(0,t)}function J(e,t){let n=[],r=new Set(e.filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));for(let t of e)t.includes(`:`)&&n.push(t);for(let e of t)r.has(e.provider)&&!n.includes(e.value)&&n.push(e.value);return n}function Y(e,t){return e.length?e.map(e=>K(e,t)).join(` · `):t(`keysAllProviders`)}function te(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function X(){let{t:e}=s(),[t,n]=(0,V.useState)([]),[l,p]=(0,V.useState)(!1),[m,g]=(0,V.useState)(``),[v,x]=(0,V.useState)([]),[S,D]=(0,V.useState)(!0),[j,M]=(0,V.useState)(``),[N,F]=(0,V.useState)(``),[I,L]=(0,V.useState)(!1),[U,J]=(0,V.useState)(null),[Y,X]=(0,V.useState)(null),[ne,Q]=(0,V.useState)(!1);(0,V.useEffect)(()=>{b().then(e=>{let t=G(e.data||[]);n(t),p(t.length>0),g(``)}).catch(e=>{g(e instanceof Error?e.message:String(e))})},[]);async function $(){D(!0);try{let e=await ee();x(e.data||[]),F(``)}catch(e){F(e instanceof Error?e.message:String(e))}finally{D(!1)}}(0,V.useEffect)(()=>{let e=window.setTimeout(()=>void $(),0);return()=>window.clearTimeout(e)},[]);async function re(e){await i(e),Q(!0),window.setTimeout(()=>Q(!1),1200)}async function ie(e,t){M(e.id),x(n=>n.map(n=>n.id===e.id?{...n,enabled:t}:n));try{let n=await z(e.id,{enabled:t});x(t=>t.map(t=>t.id===e.id?{...t,...n,secret:void 0}:t))}catch(e){F(e instanceof Error?e.message:String(e)),await $()}finally{M(``)}}async function ae(t){M(t.id);try{await R(t.id),x(e=>e.filter(e=>e.id!==t.id)),A({type:`success`,title:e(`toastKeyDeleted`)})}catch(e){F(e instanceof Error?e.message:String(e))}finally{M(``)}}return S&&!v.length?(0,H.jsx)(k,{}):(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-4 pb-4`,children:(0,H.jsxs)(c,{size:`sm`,isDisabled:!l,onPress:()=>L(!0),children:[(0,H.jsx)(a,{size:14}),e(`keysCreate`)]})}),N?(0,H.jsx)(d,{title:N}):null,m?(0,H.jsx)(d,{title:e(`keysProvidersLoadFailed`,{message:m})}):null,S?(0,H.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:Math.max(3,v.length)},(e,t)=>(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-3`,children:[(0,H.jsx)(O,{className:`h-4 w-28`}),(0,H.jsx)(O,{className:`mt-2 h-3 w-40`}),(0,H.jsx)(O,{className:`mt-4 h-6 w-24`}),(0,H.jsx)(O,{className:`mt-6 h-8 w-full`})]},t))}):v.length?(0,H.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,children:v.map(t=>(0,H.jsxs)(f,{className:`overflow-hidden p-0`,children:[(0,H.jsxs)(f.Header,{className:`flex-row items-start justify-between gap-3 px-3 pt-3 pb-2.5`,children:[(0,H.jsx)(`div`,{className:`min-w-0`,children:(0,H.jsx)(f.Title,{className:`truncate text-body`,children:t.name})}),(0,H.jsx)(w,{size:`sm`,variant:`soft`,color:t.enabled?`success`:`default`,children:t.enabled?e(`enabled`):e(`disabled`)})]}),(0,H.jsxs)(f.Content,{className:`space-y-2.5 px-3 pb-2.5`,children:[(0,H.jsx)(`div`,{className:`mono w-full rounded-lg bg-surface-secondary px-3 py-2 text-body text-foreground`,title:t.prefix,children:t.prefix}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(t.providers.length?t.providers:[`all`]).map(t=>(0,H.jsx)(w,{size:`sm`,variant:`soft`,children:(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t===`all`?(0,H.jsx)(C,{size:12}):(0,H.jsx)(P,{provider:q(t),size:12}),(0,H.jsx)(`span`,{children:t===`all`?e(`keysAllProviders`):K(t,e)})]})},t)),t.model_aggregation?(0,H.jsx)(w,{size:`sm`,variant:`soft`,children:e(`keysModelAggregationBadge`)}):null]}),(0,H.jsxs)(`p`,{className:`text-caption leading-5 text-muted`,children:[t.max_inflight>0?e(`keysMaxInflightValue`,{count:t.max_inflight}):e(`keysMaxInflightUnlimited`),` · `,t.last_used_at?e(`keysLastUsed`,{time:te(t.last_used_at)}):e(`keysNeverUsed`)]})]}),(0,H.jsxs)(f.Footer,{className:`gap-1.5 bg-surface-secondary px-3 py-2`,children:[(0,H.jsx)(c,{size:`sm`,variant:`ghost`,isDisabled:!l,onPress:()=>J(t),children:e(`edit`)}),(0,H.jsx)(W,{label:e(`holdToDelete`),isPending:j===t.id,onConfirm:()=>void ae(t),children:(0,H.jsx)(o,{size:14})}),(0,H.jsx)(`div`,{className:`ml-auto`,children:(0,H.jsx)(y,{isSelected:t.enabled,isDisabled:j===t.id,ariaLabel:e(`enable`),onChange:e=>void ie(t,e)})})]})]},t.id))}):(0,H.jsx)(h,{className:`rounded-3xl bg-surface-secondary`,icon:(0,H.jsx)(E,{size:28}),title:e(`keysEmpty`),hint:e(`keysEmptyHint`),action:(0,H.jsxs)(c,{size:`sm`,isDisabled:!l,onPress:()=>L(!0),children:[(0,H.jsx)(a,{size:14}),e(`keysCreate`)]})}),(0,H.jsx)(Z,{isOpen:I,title:e(`keysCreateTitle`),hint:e(`keysCreateHint`),options:t,t:e,onClose:()=>L(!1),onSave:async e=>{let t=await B(e);x(e=>[t,...e.map(e=>({...e,secret:void 0}))]),L(!1),X(t)}}),(0,H.jsx)(Z,{isOpen:!!U,title:e(`keysEditTitle`),hint:e(`keysEditHint`),initial:U,options:t,t:e,onClose:()=>J(null),onSave:async e=>{if(!U)return;let t=await z(U.id,e);x(e=>e.map(e=>e.id===U.id?{...e,...t,secret:void 0}:e)),J(null)}}),(0,H.jsx)(_.Root,{isOpen:!!Y?.secret,onOpenChange:e=>{e||X(null)},children:(0,H.jsx)(_.Backdrop,{variant:`blur`,children:(0,H.jsx)(_.Container,{placement:`center`,size:`lg`,children:(0,H.jsxs)(_.Dialog,{children:[(0,H.jsxs)(_.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(_.Heading,{className:`text-section font-semibold`,children:e(`keysSecretTitle`)}),(0,H.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`keysSecretHint`)})]}),(0,H.jsx)(_.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,H.jsx)(T,{size:18})})]}),(0,H.jsxs)(_.Body,{className:`px-6 pb-2`,children:[(0,H.jsxs)(u,{status:`warning`,className:`mb-4`,children:[(0,H.jsx)(u.Indicator,{}),(0,H.jsx)(u.Content,{children:(0,H.jsx)(u.Title,{children:e(`keysSecretOnce`)})})]}),(0,H.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:Y?.secret})]}),(0,H.jsxs)(_.Footer,{className:`justify-end`,children:[(0,H.jsx)(c,{variant:`ghost`,onPress:()=>X(null),children:e(`close`)}),(0,H.jsxs)(c,{onPress:()=>{Y?.secret&&re(Y.secret)},children:[(0,H.jsx)(r,{size:14}),e(ne?`copied`:`copy`)]})]})]})})})})]})}function Z({isOpen:e,title:t,hint:n,initial:r,options:i,t:a,onClose:o,onSave:s}){let[d,f]=(0,V.useState)(r?.name||``),[h,b]=(0,V.useState)(r?.max_inflight||0),[S,C]=(0,V.useState)(r?.model_aggregation||!1),[w,E]=(0,V.useState)([]),[D,O]=(0,V.useState)(new Set),[k,A]=(0,V.useState)(!0),[j,M]=(0,V.useState)(``),[N,I]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!e)return;f(r?.name||``),b(r?.max_inflight||0),C(!!r?.model_aggregation),E(J(r?.providers||[],i));let t=new Set((r?.providers||[]).filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));O(t),A(!0),M(``)},[r,e,i]);function R(e){let t=i.find(t=>t.value===e);A(!1),E(n=>n.includes(e)?(t&&O(e=>{let n=new Set(e);return n.delete(t.provider),n}),n.filter(t=>t!==e)):[...n,e])}async function z(e){e?.preventDefault();let t=d.trim();if(!t){M(a(`keysNameRequired`));return}if(!Number.isInteger(h)||h<0||h>256){M(a(`keysMaxInflightInvalid`));return}if(!i.length){M(a(`keysProvidersNotLoaded`));return}I(!0),M(``);try{await s({name:t,providers:k?r?.providers||[]:w,max_inflight:h,model_aggregation:S})}catch(e){M(e instanceof Error?e.message:String(e))}finally{I(!1)}}return(0,H.jsx)(_.Root,{isOpen:e,onOpenChange:e=>{!e&&!N&&o()},children:(0,H.jsx)(_.Backdrop,{variant:`blur`,children:(0,H.jsx)(_.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,H.jsx)(_.Dialog,{className:`sm:min-w-[32rem]`,children:(0,H.jsxs)(x,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:z,children:[(0,H.jsxs)(_.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(_.Heading,{className:`text-section font-semibold`,children:t}),(0,H.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:n})]}),(0,H.jsx)(_.CloseTrigger,{isDisabled:N,"aria-label":a(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,H.jsx)(T,{size:18})})]}),(0,H.jsxs)(_.Body,{className:`space-y-5 px-6 pb-2 pt-1`,children:[j?(0,H.jsxs)(u,{status:`danger`,children:[(0,H.jsx)(u.Indicator,{}),(0,H.jsx)(u.Content,{children:(0,H.jsx)(u.Title,{children:j})})]}):null,(0,H.jsx)(L,{label:a(`keysName`),children:(0,H.jsx)(g,{value:d,onChange:e=>f(e.target.value),placeholder:a(`keysNamePh`),"aria-label":a(`keysName`)})}),(0,H.jsx)(L,{label:a(`keysMaxInflight`),hint:a(`keysMaxInflightHint`),children:(0,H.jsx)(v,{value:h,onChange:e=>b(e??0),minValue:0,maxValue:256,isDisabled:N,children:(0,H.jsxs)(v.Group,{children:[(0,H.jsx)(v.DecrementButton,{}),(0,H.jsx)(v.Input,{"aria-label":a(`keysMaxInflight`)}),(0,H.jsx)(v.IncrementButton,{})]})})}),(0,H.jsx)(L,{label:a(`keysModelAggregation`),hint:a(`keysModelAggregationHint`),children:(0,H.jsx)(y,{isSelected:S,isDisabled:N,ariaLabel:a(`keysModelAggregation`),onChange:C})}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(l,{className:`text-body font-medium text-muted`,children:a(`keysProviders`)}),(0,H.jsx)(m,{className:`text-caption leading-5 text-muted`,children:a(`keysProvidersHint`)}),i.length?(0,H.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=w.includes(e.value),n=D.has(e.provider),r=N||S;return(0,H.jsx)(p,{isSelected:t,isDisabled:r,onChange:()=>R(e.value),className:`rounded-xl bg-surface-secondary px-3 py-2.5 data-selected:border-accent data-selected:bg-accent-soft ${r?`cursor-not-allowed opacity-50 grayscale`:``}`,children:(0,H.jsxs)(p.Content,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(p.Control,{children:(0,H.jsx)(p.Indicator,{})}),(0,H.jsx)(P,{provider:e.provider,size:16}),(0,H.jsx)(`span`,{className:`text-body font-medium`,children:F(e.provider,e.region,a)}),n?(0,H.jsx)(`span`,{className:`rounded-lg bg-surface-secondary px-1.5 py-0.5 text-caption font-medium text-muted`,children:a(`keysAllRegions`)}):null]})},e.value)})}):(0,H.jsx)(`p`,{className:`rounded-lg bg-surface-secondary px-3 py-2.5 text-caption leading-5 text-muted`,children:a(`keysProvidersNotLoaded`)}),(0,H.jsx)(`p`,{className:`text-caption text-muted`,children:Y(w,a)})]})]}),(0,H.jsxs)(_.Footer,{className:`justify-end`,children:[(0,H.jsx)(c,{variant:`ghost`,isDisabled:N,onPress:o,children:a(`cancel`)}),(0,H.jsx)(c,{type:`submit`,isPending:N,isDisabled:!i.length,children:a(r?`save`:`create`)})]})]})})})})})}export{X as KeysPage}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./clipboard-ADnALjHx.js";import{t as a}from"./Plus.es-DsoFTrCh.js";import{t as o}from"./TrashSimple.es-KG9lGXYp.js";import{n as s,r as c}from"./useI18n-BAo1UrJW.js";import{t as l}from"./label-DYYRLGoV.js";import{n as u,t as d}from"./PageAlert-4fxVtrfI.js";import{n as f}from"./useToggle-DpH7h_oD.js";import{t as p}from"./checkbox-BfdndRMW.js";import{t as m}from"./description-CmJDGGCw.js";import{t as h}from"./EmptyPanel-Bs-jQMvG.js";import{t as g}from"./input-BwBv1RBO.js";import{t as _}from"./modal-6BQxrL1y.js";import{t as v}from"./number-field-BQgq-gwR.js";import{t as y}from"./CompactSwitch-D0aW-Phm.js";import{_ as b}from"./overview-ARhe2pSk.js";import{t as x}from"./form-D5ELq0ds.js";import{t as S}from"./gsap-DWxn8li7.js";import{Lt as C,N as w,Ot as T,_ as E,k as D,m as O,o as k,t as A,v as j,x as M,y as N}from"./index-CWTBzWuK.js";import{t as P}from"./ProviderMark-C49bIWJW.js";import{n as F,t as I}from"./provider-BZvt2HHB.js";import{t as L}from"./FormRow-CqpQhYrN.js";import{n as R,o as z,r as ee,t as B}from"./keys-DEnJc6b-.js";var V=t(e(),1),H=n(),U=1.1;function W({label:e,onConfirm:t,isPending:n,children:r}){let i=(0,V.useRef)(null),a=(0,V.useRef)(null);return(0,V.useEffect)(()=>()=>{a.current?.kill()},[]),(0,H.jsxs)(D,{delay:300,children:[(0,H.jsx)(D.Trigger,{children:(0,H.jsxs)(c,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e,isPending:n,className:`relative overflow-hidden`,onPressStart:()=>{let e=i.current;!e||n||(a.current?.kill(),a.current=S.to(e,{scaleX:1,duration:U*(1-Number(S.getProperty(e,`scaleX`))),ease:N.linear,onComplete:()=>{a.current=null,S.to(e,{scaleX:0,duration:M()?0:j.base,ease:N.out,delay:j.fast}),t()}}))},onPressEnd:()=>{let e=i.current;!e||!a.current||(a.current.kill(),a.current=null,S.to(e,{scaleX:0,duration:M()?0:j.base,ease:N.soft}))},children:[(0,H.jsx)(`span`,{ref:i,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 origin-left scale-x-0 bg-danger/20`}),(0,H.jsx)(`span`,{className:`relative inline-flex`,children:r})]})}),(0,H.jsx)(D.Content,{children:e})]})}function G(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id});return t}function K(e,t){let n=e.indexOf(`:`),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n+1);return i?F(r,i,t):I(r,t)}function q(e){let t=e.indexOf(`:`);return t===-1?e:e.slice(0,t)}function J(e,t){let n=[],r=new Set(e.filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));for(let t of e)t.includes(`:`)&&n.push(t);for(let e of t)r.has(e.provider)&&!n.includes(e.value)&&n.push(e.value);return n}function Y(e,t){return e.length?e.map(e=>K(e,t)).join(` · `):t(`keysAllProviders`)}function te(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function X(){let{t:e}=s(),[t,n]=(0,V.useState)([]),[l,p]=(0,V.useState)(!1),[m,g]=(0,V.useState)(``),[v,x]=(0,V.useState)([]),[S,D]=(0,V.useState)(!0),[j,M]=(0,V.useState)(``),[N,F]=(0,V.useState)(``),[I,L]=(0,V.useState)(!1),[U,J]=(0,V.useState)(null),[Y,X]=(0,V.useState)(null),[ne,Q]=(0,V.useState)(!1);(0,V.useEffect)(()=>{b().then(e=>{let t=G(e.data||[]);n(t),p(t.length>0),g(``)}).catch(e=>{g(e instanceof Error?e.message:String(e))})},[]);async function $(){D(!0);try{let e=await ee();x(e.data||[]),F(``)}catch(e){F(e instanceof Error?e.message:String(e))}finally{D(!1)}}(0,V.useEffect)(()=>{let e=window.setTimeout(()=>void $(),0);return()=>window.clearTimeout(e)},[]);async function re(e){await i(e),Q(!0),window.setTimeout(()=>Q(!1),1200)}async function ie(e,t){M(e.id),x(n=>n.map(n=>n.id===e.id?{...n,enabled:t}:n));try{let n=await z(e.id,{enabled:t});x(t=>t.map(t=>t.id===e.id?{...t,...n,secret:void 0}:t))}catch(e){F(e instanceof Error?e.message:String(e)),await $()}finally{M(``)}}async function ae(t){M(t.id);try{await R(t.id),x(e=>e.filter(e=>e.id!==t.id)),A({type:`success`,title:e(`toastKeyDeleted`)})}catch(e){F(e instanceof Error?e.message:String(e))}finally{M(``)}}return S&&!v.length?(0,H.jsx)(k,{}):(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-4 pb-4`,children:(0,H.jsxs)(c,{size:`sm`,isDisabled:!l,onPress:()=>L(!0),children:[(0,H.jsx)(a,{size:14}),e(`keysCreate`)]})}),N?(0,H.jsx)(d,{title:N}):null,m?(0,H.jsx)(d,{title:e(`keysProvidersLoadFailed`,{message:m})}):null,S?(0,H.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:Math.max(3,v.length)},(e,t)=>(0,H.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-3`,children:[(0,H.jsx)(O,{className:`h-4 w-28`}),(0,H.jsx)(O,{className:`mt-2 h-3 w-40`}),(0,H.jsx)(O,{className:`mt-4 h-6 w-24`}),(0,H.jsx)(O,{className:`mt-6 h-8 w-full`})]},t))}):v.length?(0,H.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,children:v.map(t=>(0,H.jsxs)(f,{className:`overflow-hidden p-0`,children:[(0,H.jsxs)(f.Header,{className:`flex-row items-start justify-between gap-3 px-3 pt-3 pb-2.5`,children:[(0,H.jsx)(`div`,{className:`min-w-0`,children:(0,H.jsx)(f.Title,{className:`truncate text-body`,children:t.name})}),(0,H.jsx)(w,{size:`sm`,variant:`soft`,color:t.enabled?`success`:`default`,children:t.enabled?e(`enabled`):e(`disabled`)})]}),(0,H.jsxs)(f.Content,{className:`space-y-2.5 px-3 pb-2.5`,children:[(0,H.jsx)(`div`,{className:`mono w-full rounded-lg bg-surface-secondary px-3 py-2 text-body text-foreground`,title:t.prefix,children:t.prefix}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(t.providers.length?t.providers:[`all`]).map(t=>(0,H.jsx)(w,{size:`sm`,variant:`soft`,children:(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t===`all`?(0,H.jsx)(C,{size:12}):(0,H.jsx)(P,{provider:q(t),size:12}),(0,H.jsx)(`span`,{children:t===`all`?e(`keysAllProviders`):K(t,e)})]})},t)),t.model_aggregation?(0,H.jsx)(w,{size:`sm`,variant:`soft`,children:e(`keysModelAggregationBadge`)}):null]}),(0,H.jsxs)(`p`,{className:`text-caption leading-5 text-muted`,children:[t.max_inflight>0?e(`keysMaxInflightValue`,{count:t.max_inflight}):e(`keysMaxInflightUnlimited`),` · `,t.last_used_at?e(`keysLastUsed`,{time:te(t.last_used_at)}):e(`keysNeverUsed`)]})]}),(0,H.jsxs)(f.Footer,{className:`gap-1.5 bg-surface-secondary px-3 py-2`,children:[(0,H.jsx)(c,{size:`sm`,variant:`ghost`,isDisabled:!l,onPress:()=>J(t),children:e(`edit`)}),(0,H.jsx)(W,{label:e(`holdToDelete`),isPending:j===t.id,onConfirm:()=>void ae(t),children:(0,H.jsx)(o,{size:14})}),(0,H.jsx)(`div`,{className:`ml-auto`,children:(0,H.jsx)(y,{isSelected:t.enabled,isDisabled:j===t.id,ariaLabel:e(`enable`),onChange:e=>void ie(t,e)})})]})]},t.id))}):(0,H.jsx)(h,{className:`rounded-3xl bg-surface-secondary`,icon:(0,H.jsx)(E,{size:28}),title:e(`keysEmpty`),hint:e(`keysEmptyHint`),action:(0,H.jsxs)(c,{size:`sm`,isDisabled:!l,onPress:()=>L(!0),children:[(0,H.jsx)(a,{size:14}),e(`keysCreate`)]})}),(0,H.jsx)(Z,{isOpen:I,title:e(`keysCreateTitle`),hint:e(`keysCreateHint`),options:t,t:e,onClose:()=>L(!1),onSave:async e=>{let t=await B(e);x(e=>[t,...e.map(e=>({...e,secret:void 0}))]),L(!1),X(t)}}),(0,H.jsx)(Z,{isOpen:!!U,title:e(`keysEditTitle`),hint:e(`keysEditHint`),initial:U,options:t,t:e,onClose:()=>J(null),onSave:async e=>{if(!U)return;let t=await z(U.id,e);x(e=>e.map(e=>e.id===U.id?{...e,...t,secret:void 0}:e)),J(null)}}),(0,H.jsx)(_.Root,{isOpen:!!Y?.secret,onOpenChange:e=>{e||X(null)},children:(0,H.jsx)(_.Backdrop,{variant:`blur`,children:(0,H.jsx)(_.Container,{placement:`center`,size:`lg`,children:(0,H.jsxs)(_.Dialog,{children:[(0,H.jsxs)(_.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(_.Heading,{className:`text-section font-semibold`,children:e(`keysSecretTitle`)}),(0,H.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`keysSecretHint`)})]}),(0,H.jsx)(_.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,H.jsx)(T,{size:18})})]}),(0,H.jsxs)(_.Body,{className:`px-6 pb-2`,children:[(0,H.jsxs)(u,{status:`warning`,className:`mb-4`,children:[(0,H.jsx)(u.Indicator,{}),(0,H.jsx)(u.Content,{children:(0,H.jsx)(u.Title,{children:e(`keysSecretOnce`)})})]}),(0,H.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:Y?.secret})]}),(0,H.jsxs)(_.Footer,{className:`justify-end`,children:[(0,H.jsx)(c,{variant:`ghost`,onPress:()=>X(null),children:e(`close`)}),(0,H.jsxs)(c,{onPress:()=>{Y?.secret&&re(Y.secret)},children:[(0,H.jsx)(r,{size:14}),e(ne?`copied`:`copy`)]})]})]})})})})]})}function Z({isOpen:e,title:t,hint:n,initial:r,options:i,t:a,onClose:o,onSave:s}){let[d,f]=(0,V.useState)(r?.name||``),[h,b]=(0,V.useState)(r?.max_inflight||0),[S,C]=(0,V.useState)(r?.model_aggregation||!1),[w,E]=(0,V.useState)([]),[D,O]=(0,V.useState)(new Set),[k,A]=(0,V.useState)(!0),[j,M]=(0,V.useState)(``),[N,I]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!e)return;f(r?.name||``),b(r?.max_inflight||0),C(!!r?.model_aggregation),E(J(r?.providers||[],i));let t=new Set((r?.providers||[]).filter(e=>!e.includes(`:`)).map(e=>e.toLowerCase()));O(t),A(!0),M(``)},[r,e,i]);function R(e){let t=i.find(t=>t.value===e);A(!1),E(n=>n.includes(e)?(t&&O(e=>{let n=new Set(e);return n.delete(t.provider),n}),n.filter(t=>t!==e)):[...n,e])}async function z(e){e?.preventDefault();let t=d.trim();if(!t){M(a(`keysNameRequired`));return}if(!Number.isInteger(h)||h<0||h>256){M(a(`keysMaxInflightInvalid`));return}if(!i.length){M(a(`keysProvidersNotLoaded`));return}I(!0),M(``);try{await s({name:t,providers:k?r?.providers||[]:w,max_inflight:h,model_aggregation:S})}catch(e){M(e instanceof Error?e.message:String(e))}finally{I(!1)}}return(0,H.jsx)(_.Root,{isOpen:e,onOpenChange:e=>{!e&&!N&&o()},children:(0,H.jsx)(_.Backdrop,{variant:`blur`,children:(0,H.jsx)(_.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,H.jsx)(_.Dialog,{className:`sm:min-w-[32rem]`,children:(0,H.jsxs)(x,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:z,children:[(0,H.jsxs)(_.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(_.Heading,{className:`text-section font-semibold`,children:t}),(0,H.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:n})]}),(0,H.jsx)(_.CloseTrigger,{isDisabled:N,"aria-label":a(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,H.jsx)(T,{size:18})})]}),(0,H.jsxs)(_.Body,{className:`space-y-5 px-6 pb-2 pt-1`,children:[j?(0,H.jsxs)(u,{status:`danger`,children:[(0,H.jsx)(u.Indicator,{}),(0,H.jsx)(u.Content,{children:(0,H.jsx)(u.Title,{children:j})})]}):null,(0,H.jsx)(L,{label:a(`keysName`),children:(0,H.jsx)(g,{value:d,onChange:e=>f(e.target.value),placeholder:a(`keysNamePh`),"aria-label":a(`keysName`)})}),(0,H.jsx)(L,{label:a(`keysMaxInflight`),hint:a(`keysMaxInflightHint`),children:(0,H.jsx)(v,{value:h,onChange:e=>b(e??0),minValue:0,maxValue:256,isDisabled:N,children:(0,H.jsxs)(v.Group,{children:[(0,H.jsx)(v.DecrementButton,{}),(0,H.jsx)(v.Input,{"aria-label":a(`keysMaxInflight`)}),(0,H.jsx)(v.IncrementButton,{})]})})}),(0,H.jsx)(L,{label:a(`keysModelAggregation`),hint:a(`keysModelAggregationHint`),children:(0,H.jsx)(y,{isSelected:S,isDisabled:N,ariaLabel:a(`keysModelAggregation`),onChange:C})}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(l,{className:`text-body font-medium text-muted`,children:a(`keysProviders`)}),(0,H.jsx)(m,{className:`text-caption leading-5 text-muted`,children:a(`keysProvidersHint`)}),i.length?(0,H.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:i.map(e=>{let t=w.includes(e.value),n=D.has(e.provider),r=N||S;return(0,H.jsx)(p,{isSelected:t,isDisabled:r,onChange:()=>R(e.value),className:`rounded-xl bg-surface-secondary px-3 py-2.5 data-selected:border-accent data-selected:bg-accent-soft ${r?`cursor-not-allowed opacity-50 grayscale`:``}`,children:(0,H.jsxs)(p.Content,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(p.Control,{children:(0,H.jsx)(p.Indicator,{})}),(0,H.jsx)(P,{provider:e.provider,size:16}),(0,H.jsx)(`span`,{className:`text-body font-medium`,children:F(e.provider,e.region,a)}),n?(0,H.jsx)(`span`,{className:`rounded-lg bg-surface-secondary px-1.5 py-0.5 text-caption font-medium text-muted`,children:a(`keysAllRegions`)}):null]})},e.value)})}):(0,H.jsx)(`p`,{className:`rounded-lg bg-surface-secondary px-3 py-2.5 text-caption leading-5 text-muted`,children:a(`keysProvidersNotLoaded`)}),(0,H.jsx)(`p`,{className:`text-caption text-muted`,children:Y(w,a)})]})]}),(0,H.jsxs)(_.Footer,{className:`justify-end`,children:[(0,H.jsx)(c,{variant:`ghost`,isDisabled:N,onPress:o,children:a(`cancel`)}),(0,H.jsx)(c,{type:`submit`,isPending:N,isDisabled:!i.length,children:a(r?`save`:`create`)})]})]})})})})})}export{X as KeysPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/LatencyStats-4FIN19Dh.js b/internal/webui/static/assets/LatencyStats-CPcR-mdd.js similarity index 94% rename from internal/webui/static/assets/LatencyStats-4FIN19Dh.js rename to internal/webui/static/assets/LatencyStats-CPcR-mdd.js index 50104b35f..0598a11bd 100644 --- a/internal/webui/static/assets/LatencyStats-4FIN19Dh.js +++ b/internal/webui/static/assets/LatencyStats-CPcR-mdd.js @@ -1 +1 @@ -import{n as e}from"./shim-mfK0Rmj6.js";import{l as t,s as n,t as r}from"./format-FfdyoNtB.js";var i=e();function a({latencyMs:e,ttfbMs:a,completionTokens:o,stream:s,labels:c,className:l=``,variant:u=`block`}){let d=t(r({completionTokens:o,latencyMs:e,ttfbMs:a,stream:s})),f=n(a),p=n(e);if(u===`inline`)return(0,i.jsxs)(`div`,{className:`mono text-caption leading-4 text-muted ${l}`.trim(),children:[(0,i.jsxs)(`span`,{children:[c.ttft,` `,f]}),(0,i.jsx)(`span`,{className:`mx-1.5 text-separator`,children:`·`}),(0,i.jsxs)(`span`,{children:[c.total,` `,p]}),(0,i.jsx)(`span`,{className:`mx-1.5 text-separator`,children:`·`}),(0,i.jsx)(`span`,{children:d})]});let m=[[c.ttft,f],[c.total,p],[c.tps,d]];return(0,i.jsxs)(`div`,{className:l,children:[c.heading?(0,i.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:c.heading}):null,(0,i.jsx)(`div`,{className:`border-l border-separator pl-2 leading-4`,children:m.map(([e,t])=>(0,i.jsxs)(`div`,{className:`flex items-baseline gap-2 py-px`,children:[(0,i.jsx)(`span`,{className:`shrink-0 text-caption text-muted`,children:e}),(0,i.jsx)(`span`,{className:`mono text-xs text-foreground`,children:t})]},e))})]})}export{a as t}; \ No newline at end of file +import{n as e}from"./shim-mfK0Rmj6.js";import{l as t,s as n,t as r}from"./format-BAkFbjAh.js";var i=e();function a({latencyMs:e,ttfbMs:a,completionTokens:o,stream:s,labels:c,className:l=``,variant:u=`block`}){let d=t(r({completionTokens:o,latencyMs:e,ttfbMs:a,stream:s})),f=n(a),p=n(e);if(u===`inline`)return(0,i.jsxs)(`div`,{className:`mono text-caption leading-4 text-muted ${l}`.trim(),children:[(0,i.jsxs)(`span`,{children:[c.ttft,` `,f]}),(0,i.jsx)(`span`,{className:`mx-1.5 text-separator`,children:`·`}),(0,i.jsxs)(`span`,{children:[c.total,` `,p]}),(0,i.jsx)(`span`,{className:`mx-1.5 text-separator`,children:`·`}),(0,i.jsx)(`span`,{children:d})]});let m=[[c.ttft,f],[c.total,p],[c.tps,d]];return(0,i.jsxs)(`div`,{className:l,children:[c.heading?(0,i.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:c.heading}):null,(0,i.jsx)(`div`,{className:`border-l border-separator pl-2 leading-4`,children:m.map(([e,t])=>(0,i.jsxs)(`div`,{className:`flex items-baseline gap-2 py-px`,children:[(0,i.jsx)(`span`,{className:`shrink-0 text-caption text-muted`,children:e}),(0,i.jsx)(`span`,{className:`mono text-xs text-foreground`,children:t})]},e))})]})}export{a as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/LoginPage-Bkx6s23i.js b/internal/webui/static/assets/LoginPage-D55m1Iq6.js similarity index 97% rename from internal/webui/static/assets/LoginPage-Bkx6s23i.js rename to internal/webui/static/assets/LoginPage-D55m1Iq6.js index 950d01281..9aef50c22 100644 --- a/internal/webui/static/assets/LoginPage-Bkx6s23i.js +++ b/internal/webui/static/assets/LoginPage-D55m1Iq6.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./InflightLiveCard-BN45lDqh.js";import{n as i,pt as a,r as o}from"./useI18n-XrvNxGvP.js";import{t as s}from"./label-B8hTan2F.js";import{t as c}from"./PageAlert-BbN7e2aZ.js";import{n as l}from"./useToggle-55_Qx9vA.js";import{t as u}from"./input-group-CQ3ozQVp.js";import{I as d,N as f}from"./overview-ARhe2pSk.js";import{t as p}from"./textfield-DAL_YlVh.js";import{A as m,D as h,Ft as g,Jt as _,O as v,Xt as y,Yt as b,_ as x,jt as S,k as C,r as w,zt as T}from"./index-CAlyInAP.js";var E=t(e(),1),D=new Map([[`bold`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z`}))],[`duotone`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),E.createElement(`path`,{d:`M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z`}))],[`fill`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`light`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z`}))],[`regular`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`thin`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z`}))]]),O=new Map([[`bold`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M251,123.13c-.37-.81-9.13-20.26-28.48-39.61C196.63,57.67,164,44,128,44S59.37,57.67,33.51,83.52C14.16,102.87,5.4,122.32,5,123.13a12.08,12.08,0,0,0,0,9.75c.37.82,9.13,20.26,28.49,39.61C59.37,198.34,92,212,128,212s68.63-13.66,94.48-39.51c19.36-19.35,28.12-38.79,28.49-39.61A12.08,12.08,0,0,0,251,123.13Zm-46.06,33C183.47,177.27,157.59,188,128,188s-55.47-10.73-76.91-31.88A130.36,130.36,0,0,1,29.52,128,130.45,130.45,0,0,1,51.09,99.89C72.54,78.73,98.41,68,128,68s55.46,10.73,76.91,31.89A130.36,130.36,0,0,1,226.48,128,130.45,130.45,0,0,1,204.91,156.12ZM128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,64a20,20,0,1,1,20-20A20,20,0,0,1,128,148Z`}))],[`duotone`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Zm0,112a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`,opacity:`0.2`}),E.createElement(`path`,{d:`M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z`}))],[`fill`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`}))],[`light`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M245.48,125.57c-.34-.78-8.66-19.23-27.24-37.81C201,70.54,171.38,50,128,50S55,70.54,37.76,87.76c-18.58,18.58-26.9,37-27.24,37.81a6,6,0,0,0,0,4.88c.34.77,8.66,19.22,27.24,37.8C55,185.47,84.62,206,128,206s73-20.53,90.24-37.75c18.58-18.58,26.9-37,27.24-37.8A6,6,0,0,0,245.48,125.57ZM128,194c-31.38,0-58.78-11.42-81.45-33.93A134.77,134.77,0,0,1,22.69,128,134.56,134.56,0,0,1,46.55,95.94C69.22,73.42,96.62,62,128,62s58.78,11.42,81.45,33.94A134.56,134.56,0,0,1,233.31,128C226.94,140.21,195,194,128,194Zm0-112a46,46,0,1,0,46,46A46.06,46.06,0,0,0,128,82Zm0,80a34,34,0,1,1,34-34A34,34,0,0,1,128,162Z`}))],[`regular`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z`}))],[`thin`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M243.66,126.38c-.34-.76-8.52-18.89-26.83-37.2C199.87,72.22,170.7,52,128,52S56.13,72.22,39.17,89.18c-18.31,18.31-26.49,36.44-26.83,37.2a4.08,4.08,0,0,0,0,3.25c.34.77,8.52,18.89,26.83,37.2,17,17,46.14,37.17,88.83,37.17s71.87-20.21,88.83-37.17c18.31-18.31,26.49-36.43,26.83-37.2A4.08,4.08,0,0,0,243.66,126.38Zm-32.7,35c-23.07,23-51,34.62-83,34.62s-59.89-11.65-83-34.62A135.71,135.71,0,0,1,20.44,128,135.69,135.69,0,0,1,45,94.62C68.11,71.65,96,60,128,60s59.89,11.65,83,34.62A135.79,135.79,0,0,1,235.56,128,135.71,135.71,0,0,1,211,161.38ZM128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,80a36,36,0,1,1,36-36A36,36,0,0,1,128,164Z`}))]]),k=new Map([[`bold`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M56.88,31.93A12,12,0,1,0,39.12,48.07l16,17.65C20.67,88.66,5.72,121.58,5,123.13a12.08,12.08,0,0,0,0,9.75c.37.82,9.13,20.26,28.49,39.61C59.37,198.34,92,212,128,212a131.34,131.34,0,0,0,51-10l20.09,22.1a12,12,0,0,0,17.76-16.14ZM128,188c-29.59,0-55.47-10.73-76.91-31.88A130.69,130.69,0,0,1,29.52,128c5.27-9.31,18.79-29.9,42-44.29l90.09,99.11A109.33,109.33,0,0,1,128,188Zm123-55.12c-.36.81-9,20-28,39.16a12,12,0,1,1-17-16.9A130.48,130.48,0,0,0,226.48,128a130.36,130.36,0,0,0-21.57-28.12C183.46,78.73,157.59,68,128,68c-3.35,0-6.7.14-10,.42a12,12,0,1,1-2-23.91c3.93-.34,8-.51,12-.51,36,0,68.63,13.67,94.49,39.52,19.35,19.35,28.11,38.8,28.48,39.61A12.08,12.08,0,0,1,251,132.88Z`}))],[`duotone`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Zm0,112a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`,opacity:`0.2`}),E.createElement(`path`,{d:`M53.92,34.62A8,8,0,1,0,42.08,45.38L61.32,66.55C25,88.84,9.38,123.2,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208a127.11,127.11,0,0,0,52.07-10.83l22,24.21a8,8,0,1,0,11.84-10.76Zm47.33,75.84,41.67,45.85a32,32,0,0,1-41.67-45.85ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.16,133.16,0,0,1,25,128c4.69-8.79,19.66-33.39,47.35-49.38l18,19.75a48,48,0,0,0,63.66,70l14.73,16.2A112,112,0,0,1,128,192Zm6-95.43a8,8,0,0,1,3-15.72,48.16,48.16,0,0,1,38.77,42.64,8,8,0,0,1-7.22,8.71,6.39,6.39,0,0,1-.75,0,8,8,0,0,1-8-7.26A32.09,32.09,0,0,0,134,96.57Zm113.28,34.69c-.42.94-10.55,23.37-33.36,43.8a8,8,0,1,1-10.67-11.92A132.77,132.77,0,0,0,231.05,128a133.15,133.15,0,0,0-23.12-30.77C185.67,75.19,158.78,64,128,64a118.37,118.37,0,0,0-19.36,1.57A8,8,0,1,1,106,49.79,134,134,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41A8,8,0,0,1,247.31,131.26Z`}))],[`fill`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M96.68,57.87a4,4,0,0,1,2.08-6.6A130.13,130.13,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41a8,8,0,0,1,0,6.5c-.35.79-8.82,19.57-27.65,38.4q-4.28,4.26-8.79,8.07a4,4,0,0,1-5.55-.36ZM213.92,210.62a8,8,0,1,1-11.84,10.76L180,197.13A127.21,127.21,0,0,1,128,208c-34.88,0-66.57-13.26-91.66-38.34C17.51,150.83,9,132.05,8.69,131.26a8,8,0,0,1,0-6.5C9,124,17.51,105.18,36.34,86.35a135,135,0,0,1,25-19.78L42.08,45.38A8,8,0,1,1,53.92,34.62Zm-65.49-48.25-52.69-58a40,40,0,0,0,52.69,58Z`}))],[`light`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M52.44,36A6,6,0,0,0,43.56,44L64.44,67c-37.28,21.9-53.23,57-53.92,58.57a6,6,0,0,0,0,4.88c.34.77,8.66,19.22,27.24,37.8C55,185.47,84.62,206,128,206a124.91,124.91,0,0,0,52.57-11.25l23,25.29a6,6,0,0,0,8.88-8.08Zm48.62,71.32,45,49.52a34,34,0,0,1-45-49.52ZM128,194c-31.38,0-58.78-11.42-81.45-33.93A134.57,134.57,0,0,1,22.69,128c4.29-8.2,20.1-35.18,50-51.91L92.89,98.3a46,46,0,0,0,61.35,67.48l17.81,19.6A113.47,113.47,0,0,1,128,194Zm6.4-99.4a6,6,0,0,1,2.25-11.79,46.17,46.17,0,0,1,37.15,40.87,6,6,0,0,1-5.42,6.53l-.56,0a6,6,0,0,1-6-5.45A34.1,34.1,0,0,0,134.4,94.6Zm111.08,35.85c-.41.92-10.37,23-32.86,43.12a6,6,0,1,1-8-8.94A134.07,134.07,0,0,0,233.31,128a134.67,134.67,0,0,0-23.86-32.07C186.78,73.42,159.38,62,128,62a120.19,120.19,0,0,0-19.69,1.6,6,6,0,1,1-2-11.83A131.12,131.12,0,0,1,128,50c43.38,0,73,20.54,90.24,37.76,18.58,18.58,26.9,37,27.24,37.81A6,6,0,0,1,245.48,130.45Z`}))],[`regular`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M53.92,34.62A8,8,0,1,0,42.08,45.38L61.32,66.55C25,88.84,9.38,123.2,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208a127.11,127.11,0,0,0,52.07-10.83l22,24.21a8,8,0,1,0,11.84-10.76Zm47.33,75.84,41.67,45.85a32,32,0,0,1-41.67-45.85ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.16,133.16,0,0,1,25,128c4.69-8.79,19.66-33.39,47.35-49.38l18,19.75a48,48,0,0,0,63.66,70l14.73,16.2A112,112,0,0,1,128,192Zm6-95.43a8,8,0,0,1,3-15.72,48.16,48.16,0,0,1,38.77,42.64,8,8,0,0,1-7.22,8.71,6.39,6.39,0,0,1-.75,0,8,8,0,0,1-8-7.26A32.09,32.09,0,0,0,134,96.57Zm113.28,34.69c-.42.94-10.55,23.37-33.36,43.8a8,8,0,1,1-10.67-11.92A132.77,132.77,0,0,0,231.05,128a133.15,133.15,0,0,0-23.12-30.77C185.67,75.19,158.78,64,128,64a118.37,118.37,0,0,0-19.36,1.57A8,8,0,1,1,106,49.79,134,134,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41A8,8,0,0,1,247.31,131.26Z`}))],[`thin`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M51,37.31A4,4,0,0,0,45,42.69L67.59,67.5C29.34,89,13,124.81,12.34,126.38a4.08,4.08,0,0,0,0,3.25c.34.77,8.52,18.89,26.83,37.2,17,17,46.14,37.17,88.83,37.17a122.59,122.59,0,0,0,53.06-11.69l24,26.38a4,4,0,1,0,5.92-5.38ZM149.1,157.16A36,36,0,0,1,101,104.22ZM128,196c-32,0-59.89-11.65-83-34.62A135.81,135.81,0,0,1,20.44,128c3.65-7.23,20.09-36.81,52.68-54.43l22.45,24.7a44,44,0,0,0,59,64.83l20.89,23A114.94,114.94,0,0,1,128,196Zm6.78-103.36a4,4,0,0,1,1.49-7.86,44.15,44.15,0,0,1,35.54,39.09,4,4,0,0,1-3.61,4.35l-.38,0a4,4,0,0,1-4-3.63A36.1,36.1,0,0,0,134.78,92.64Zm108.88,37c-.41.91-10.2,22.58-32.38,42.45a4,4,0,0,1-2.67,1,4,4,0,0,1-2.67-7A136.71,136.71,0,0,0,235.56,128,136.07,136.07,0,0,0,211,94.62C187.89,71.65,160,60,128,60a122,122,0,0,0-20,1.63,4,4,0,0,1-1.32-7.89A129.3,129.3,0,0,1,128,52c42.7,0,71.87,20.22,88.83,37.18,18.31,18.31,26.49,36.44,26.83,37.2A4.08,4.08,0,0,1,243.66,129.63Z`}))]]),A=E.forwardRef((e,t)=>E.createElement(a,{ref:t,...e,weights:D}));A.displayName=`ArrowRightIcon`;var j=A,M=E.forwardRef((e,t)=>E.createElement(a,{ref:t,...e,weights:O}));M.displayName=`EyeIcon`;var N=M,P=E.forwardRef((e,t)=>E.createElement(a,{ref:t,...e,weights:k}));P.displayName=`EyeSlashIcon`;var F=P,I=n();function L(){let{t:e,lang:t,setLang:n}=i(),{setApiKey:a}=d(),{overview:D,refresh:O}=v(),{theme:k,toggleTheme:A}=h(),[M,P]=(0,E.useState)(``),[L,R]=(0,E.useState)(!1),[z,B]=(0,E.useState)(!1),[V,H]=(0,E.useState)(``),U=y(),W=b().state?.from||`/`,G=(0,E.useRef)(null);if(w(G,`login`),D)return(0,I.jsx)(_,{to:W===`/login`?`/`:W,replace:!0});async function K(t){t.preventDefault();let n=M.trim();if(!n){H(e(`loginNeedKey`));return}B(!0),H(``);try{a(n),await O(n),U(W===`/login`?`/`:W,{replace:!0})}catch(t){H(f(t)?e(`loginBadKey`):t instanceof Error?t.message:String(t))}finally{B(!1)}}return(0,I.jsxs)(`div`,{className:`relative min-h-dvh overflow-hidden bg-background text-foreground`,children:[(0,I.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-border`}),(0,I.jsxs)(`main`,{ref:G,className:`relative z-10 mx-auto grid min-h-dvh w-full max-w-[1480px] lg:grid-cols-[minmax(0,1fr)_minmax(380px,30rem)]`,children:[(0,I.jsxs)(`section`,{className:`flex min-h-[52vh] flex-col px-5 py-6 sm:px-8 sm:py-8 lg:min-h-dvh lg:px-8 lg:py-10 xl:px-10`,children:[(0,I.jsxs)(`header`,{className:`flex items-center justify-between gap-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(x,{size:36}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`font-semibold`,children:`CLI2API`}),(0,I.jsx)(`div`,{className:`text-caption text-muted`,children:e(`controlPlane`)})]})]}),(0,I.jsxs)(m,{isAttached:!0,children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(C.Trigger,{children:(0,I.jsx)(o,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:()=>n(t===`zh`?`en`:`zh`),"aria-label":t===`zh`?`English`:`中文`,children:(0,I.jsx)(T,{size:15})})}),(0,I.jsx)(C.Content,{children:t===`zh`?`English`:`中文`})]}),(0,I.jsxs)(C,{children:[(0,I.jsx)(C.Trigger,{children:(0,I.jsx)(o,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:A,"aria-label":k===`dark`?`Light mode`:`Dark mode`,children:k===`dark`?(0,I.jsx)(S,{size:15}):(0,I.jsx)(g,{size:15})})}),(0,I.jsx)(C.Content,{children:k===`dark`?`Light mode`:`Dark mode`})]})]})]}),(0,I.jsx)(`div`,{className:`my-auto w-full py-8 lg:py-10`,children:(0,I.jsx)(r,{t:e,defaultExpanded:!0,forceMockDemo:!0,bare:!0,live:null,mockPace:.45})}),(0,I.jsxs)(`footer`,{className:`hidden items-center justify-between text-caption text-muted lg:flex`,children:[(0,I.jsx)(`span`,{children:e(`loginHint`)}),(0,I.jsx)(`span`,{children:e(`routesHint`)})]})]}),(0,I.jsx)(`section`,{className:`flex items-center px-5 py-10 sm:px-8 lg:px-8 xl:px-10`,children:(0,I.jsx)(l,{"data-gsap-reveal":!0,variant:`transparent`,className:`w-full bg-transparent p-0 shadow-none`,children:(0,I.jsxs)(`form`,{onSubmit:e=>void K(e),children:[(0,I.jsx)(l.Header,{className:`px-2 py-6 sm:px-4`,children:(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,I.jsx)(x,{size:28,loading:z}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(l.Title,{className:`text-title`,children:e(`loginFormTitle`)}),(0,I.jsx)(l.Description,{className:`mt-1`,children:e(`loginDesc`)})]})]})}),(0,I.jsxs)(l.Content,{className:`space-y-5 px-6 py-7 sm:px-8 sm:py-8`,children:[(0,I.jsxs)(p,{name:`console-password`,className:`w-full`,isInvalid:!!V,children:[(0,I.jsx)(s,{children:e(`loginPassword`)}),(0,I.jsxs)(u,{children:[(0,I.jsx)(u.Input,{id:`console-password`,type:L?`text`:`password`,value:M,onChange:e=>P(e.target.value),placeholder:e(`loginPasswordPh`),autoComplete:`current-password`,autoFocus:!0,"aria-label":e(`loginPassword`),spellCheck:!1}),(0,I.jsx)(u.Suffix,{children:(0,I.jsx)(o,{isIconOnly:!0,size:`sm`,variant:`ghost`,type:`button`,"aria-label":e(L?`hidePassword`:`showPassword`),onPress:()=>R(e=>!e),children:L?(0,I.jsx)(F,{size:16}):(0,I.jsx)(N,{size:16})})})]})]}),V?(0,I.jsx)(c,{title:V}):(0,I.jsx)(`p`,{className:`text-caption text-muted`,children:e(`loginHint`)}),(0,I.jsxs)(o,{type:`submit`,fullWidth:!0,size:`lg`,isPending:z,children:[e(z?`loggingInConsole`:`loginSubmit`),z?null:(0,I.jsx)(j,{size:17})]})]})]})})})]})]})}export{L as LoginPage}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./InflightLiveCard-Cy8JjSn4.js";import{n as i,pt as a,r as o}from"./useI18n-BAo1UrJW.js";import{t as s}from"./label-DYYRLGoV.js";import{t as c}from"./PageAlert-4fxVtrfI.js";import{n as l}from"./useToggle-DpH7h_oD.js";import{t as u}from"./input-group-DuDWER0-.js";import{I as d,N as f}from"./overview-ARhe2pSk.js";import{t as p}from"./textfield-CjoS-G9O.js";import{A as m,D as h,Ft as g,Jt as _,O as v,Xt as y,Yt as b,_ as x,jt as S,k as C,r as w,zt as T}from"./index-CWTBzWuK.js";var E=t(e(),1),D=new Map([[`bold`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z`}))],[`duotone`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),E.createElement(`path`,{d:`M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z`}))],[`fill`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`light`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z`}))],[`regular`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`thin`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z`}))]]),O=new Map([[`bold`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M251,123.13c-.37-.81-9.13-20.26-28.48-39.61C196.63,57.67,164,44,128,44S59.37,57.67,33.51,83.52C14.16,102.87,5.4,122.32,5,123.13a12.08,12.08,0,0,0,0,9.75c.37.82,9.13,20.26,28.49,39.61C59.37,198.34,92,212,128,212s68.63-13.66,94.48-39.51c19.36-19.35,28.12-38.79,28.49-39.61A12.08,12.08,0,0,0,251,123.13Zm-46.06,33C183.47,177.27,157.59,188,128,188s-55.47-10.73-76.91-31.88A130.36,130.36,0,0,1,29.52,128,130.45,130.45,0,0,1,51.09,99.89C72.54,78.73,98.41,68,128,68s55.46,10.73,76.91,31.89A130.36,130.36,0,0,1,226.48,128,130.45,130.45,0,0,1,204.91,156.12ZM128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,64a20,20,0,1,1,20-20A20,20,0,0,1,128,148Z`}))],[`duotone`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Zm0,112a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`,opacity:`0.2`}),E.createElement(`path`,{d:`M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z`}))],[`fill`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,168a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`}))],[`light`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M245.48,125.57c-.34-.78-8.66-19.23-27.24-37.81C201,70.54,171.38,50,128,50S55,70.54,37.76,87.76c-18.58,18.58-26.9,37-27.24,37.81a6,6,0,0,0,0,4.88c.34.77,8.66,19.22,27.24,37.8C55,185.47,84.62,206,128,206s73-20.53,90.24-37.75c18.58-18.58,26.9-37,27.24-37.8A6,6,0,0,0,245.48,125.57ZM128,194c-31.38,0-58.78-11.42-81.45-33.93A134.77,134.77,0,0,1,22.69,128,134.56,134.56,0,0,1,46.55,95.94C69.22,73.42,96.62,62,128,62s58.78,11.42,81.45,33.94A134.56,134.56,0,0,1,233.31,128C226.94,140.21,195,194,128,194Zm0-112a46,46,0,1,0,46,46A46.06,46.06,0,0,0,128,82Zm0,80a34,34,0,1,1,34-34A34,34,0,0,1,128,162Z`}))],[`regular`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z`}))],[`thin`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M243.66,126.38c-.34-.76-8.52-18.89-26.83-37.2C199.87,72.22,170.7,52,128,52S56.13,72.22,39.17,89.18c-18.31,18.31-26.49,36.44-26.83,37.2a4.08,4.08,0,0,0,0,3.25c.34.77,8.52,18.89,26.83,37.2,17,17,46.14,37.17,88.83,37.17s71.87-20.21,88.83-37.17c18.31-18.31,26.49-36.43,26.83-37.2A4.08,4.08,0,0,0,243.66,126.38Zm-32.7,35c-23.07,23-51,34.62-83,34.62s-59.89-11.65-83-34.62A135.71,135.71,0,0,1,20.44,128,135.69,135.69,0,0,1,45,94.62C68.11,71.65,96,60,128,60s59.89,11.65,83,34.62A135.79,135.79,0,0,1,235.56,128,135.71,135.71,0,0,1,211,161.38ZM128,84a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,84Zm0,80a36,36,0,1,1,36-36A36,36,0,0,1,128,164Z`}))]]),k=new Map([[`bold`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M56.88,31.93A12,12,0,1,0,39.12,48.07l16,17.65C20.67,88.66,5.72,121.58,5,123.13a12.08,12.08,0,0,0,0,9.75c.37.82,9.13,20.26,28.49,39.61C59.37,198.34,92,212,128,212a131.34,131.34,0,0,0,51-10l20.09,22.1a12,12,0,0,0,17.76-16.14ZM128,188c-29.59,0-55.47-10.73-76.91-31.88A130.69,130.69,0,0,1,29.52,128c5.27-9.31,18.79-29.9,42-44.29l90.09,99.11A109.33,109.33,0,0,1,128,188Zm123-55.12c-.36.81-9,20-28,39.16a12,12,0,1,1-17-16.9A130.48,130.48,0,0,0,226.48,128a130.36,130.36,0,0,0-21.57-28.12C183.46,78.73,157.59,68,128,68c-3.35,0-6.7.14-10,.42a12,12,0,1,1-2-23.91c3.93-.34,8-.51,12-.51,36,0,68.63,13.67,94.49,39.52,19.35,19.35,28.11,38.8,28.48,39.61A12.08,12.08,0,0,1,251,132.88Z`}))],[`duotone`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Zm0,112a40,40,0,1,1,40-40A40,40,0,0,1,128,168Z`,opacity:`0.2`}),E.createElement(`path`,{d:`M53.92,34.62A8,8,0,1,0,42.08,45.38L61.32,66.55C25,88.84,9.38,123.2,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208a127.11,127.11,0,0,0,52.07-10.83l22,24.21a8,8,0,1,0,11.84-10.76Zm47.33,75.84,41.67,45.85a32,32,0,0,1-41.67-45.85ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.16,133.16,0,0,1,25,128c4.69-8.79,19.66-33.39,47.35-49.38l18,19.75a48,48,0,0,0,63.66,70l14.73,16.2A112,112,0,0,1,128,192Zm6-95.43a8,8,0,0,1,3-15.72,48.16,48.16,0,0,1,38.77,42.64,8,8,0,0,1-7.22,8.71,6.39,6.39,0,0,1-.75,0,8,8,0,0,1-8-7.26A32.09,32.09,0,0,0,134,96.57Zm113.28,34.69c-.42.94-10.55,23.37-33.36,43.8a8,8,0,1,1-10.67-11.92A132.77,132.77,0,0,0,231.05,128a133.15,133.15,0,0,0-23.12-30.77C185.67,75.19,158.78,64,128,64a118.37,118.37,0,0,0-19.36,1.57A8,8,0,1,1,106,49.79,134,134,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41A8,8,0,0,1,247.31,131.26Z`}))],[`fill`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M96.68,57.87a4,4,0,0,1,2.08-6.6A130.13,130.13,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41a8,8,0,0,1,0,6.5c-.35.79-8.82,19.57-27.65,38.4q-4.28,4.26-8.79,8.07a4,4,0,0,1-5.55-.36ZM213.92,210.62a8,8,0,1,1-11.84,10.76L180,197.13A127.21,127.21,0,0,1,128,208c-34.88,0-66.57-13.26-91.66-38.34C17.51,150.83,9,132.05,8.69,131.26a8,8,0,0,1,0-6.5C9,124,17.51,105.18,36.34,86.35a135,135,0,0,1,25-19.78L42.08,45.38A8,8,0,1,1,53.92,34.62Zm-65.49-48.25-52.69-58a40,40,0,0,0,52.69,58Z`}))],[`light`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M52.44,36A6,6,0,0,0,43.56,44L64.44,67c-37.28,21.9-53.23,57-53.92,58.57a6,6,0,0,0,0,4.88c.34.77,8.66,19.22,27.24,37.8C55,185.47,84.62,206,128,206a124.91,124.91,0,0,0,52.57-11.25l23,25.29a6,6,0,0,0,8.88-8.08Zm48.62,71.32,45,49.52a34,34,0,0,1-45-49.52ZM128,194c-31.38,0-58.78-11.42-81.45-33.93A134.57,134.57,0,0,1,22.69,128c4.29-8.2,20.1-35.18,50-51.91L92.89,98.3a46,46,0,0,0,61.35,67.48l17.81,19.6A113.47,113.47,0,0,1,128,194Zm6.4-99.4a6,6,0,0,1,2.25-11.79,46.17,46.17,0,0,1,37.15,40.87,6,6,0,0,1-5.42,6.53l-.56,0a6,6,0,0,1-6-5.45A34.1,34.1,0,0,0,134.4,94.6Zm111.08,35.85c-.41.92-10.37,23-32.86,43.12a6,6,0,1,1-8-8.94A134.07,134.07,0,0,0,233.31,128a134.67,134.67,0,0,0-23.86-32.07C186.78,73.42,159.38,62,128,62a120.19,120.19,0,0,0-19.69,1.6,6,6,0,1,1-2-11.83A131.12,131.12,0,0,1,128,50c43.38,0,73,20.54,90.24,37.76,18.58,18.58,26.9,37,27.24,37.81A6,6,0,0,1,245.48,130.45Z`}))],[`regular`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M53.92,34.62A8,8,0,1,0,42.08,45.38L61.32,66.55C25,88.84,9.38,123.2,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208a127.11,127.11,0,0,0,52.07-10.83l22,24.21a8,8,0,1,0,11.84-10.76Zm47.33,75.84,41.67,45.85a32,32,0,0,1-41.67-45.85ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.16,133.16,0,0,1,25,128c4.69-8.79,19.66-33.39,47.35-49.38l18,19.75a48,48,0,0,0,63.66,70l14.73,16.2A112,112,0,0,1,128,192Zm6-95.43a8,8,0,0,1,3-15.72,48.16,48.16,0,0,1,38.77,42.64,8,8,0,0,1-7.22,8.71,6.39,6.39,0,0,1-.75,0,8,8,0,0,1-8-7.26A32.09,32.09,0,0,0,134,96.57Zm113.28,34.69c-.42.94-10.55,23.37-33.36,43.8a8,8,0,1,1-10.67-11.92A132.77,132.77,0,0,0,231.05,128a133.15,133.15,0,0,0-23.12-30.77C185.67,75.19,158.78,64,128,64a118.37,118.37,0,0,0-19.36,1.57A8,8,0,1,1,106,49.79,134,134,0,0,1,128,48c34.88,0,66.57,13.26,91.66,38.35,18.83,18.83,27.3,37.62,27.65,38.41A8,8,0,0,1,247.31,131.26Z`}))],[`thin`,E.createElement(E.Fragment,null,E.createElement(`path`,{d:`M51,37.31A4,4,0,0,0,45,42.69L67.59,67.5C29.34,89,13,124.81,12.34,126.38a4.08,4.08,0,0,0,0,3.25c.34.77,8.52,18.89,26.83,37.2,17,17,46.14,37.17,88.83,37.17a122.59,122.59,0,0,0,53.06-11.69l24,26.38a4,4,0,1,0,5.92-5.38ZM149.1,157.16A36,36,0,0,1,101,104.22ZM128,196c-32,0-59.89-11.65-83-34.62A135.81,135.81,0,0,1,20.44,128c3.65-7.23,20.09-36.81,52.68-54.43l22.45,24.7a44,44,0,0,0,59,64.83l20.89,23A114.94,114.94,0,0,1,128,196Zm6.78-103.36a4,4,0,0,1,1.49-7.86,44.15,44.15,0,0,1,35.54,39.09,4,4,0,0,1-3.61,4.35l-.38,0a4,4,0,0,1-4-3.63A36.1,36.1,0,0,0,134.78,92.64Zm108.88,37c-.41.91-10.2,22.58-32.38,42.45a4,4,0,0,1-2.67,1,4,4,0,0,1-2.67-7A136.71,136.71,0,0,0,235.56,128,136.07,136.07,0,0,0,211,94.62C187.89,71.65,160,60,128,60a122,122,0,0,0-20,1.63,4,4,0,0,1-1.32-7.89A129.3,129.3,0,0,1,128,52c42.7,0,71.87,20.22,88.83,37.18,18.31,18.31,26.49,36.44,26.83,37.2A4.08,4.08,0,0,1,243.66,129.63Z`}))]]),A=E.forwardRef((e,t)=>E.createElement(a,{ref:t,...e,weights:D}));A.displayName=`ArrowRightIcon`;var j=A,M=E.forwardRef((e,t)=>E.createElement(a,{ref:t,...e,weights:O}));M.displayName=`EyeIcon`;var N=M,P=E.forwardRef((e,t)=>E.createElement(a,{ref:t,...e,weights:k}));P.displayName=`EyeSlashIcon`;var F=P,I=n();function L(){let{t:e,lang:t,setLang:n}=i(),{setApiKey:a}=d(),{overview:D,refresh:O}=v(),{theme:k,toggleTheme:A}=h(),[M,P]=(0,E.useState)(``),[L,R]=(0,E.useState)(!1),[z,B]=(0,E.useState)(!1),[V,H]=(0,E.useState)(``),U=y(),W=b().state?.from||`/`,G=(0,E.useRef)(null);if(w(G,`login`),D)return(0,I.jsx)(_,{to:W===`/login`?`/`:W,replace:!0});async function K(t){t.preventDefault();let n=M.trim();if(!n){H(e(`loginNeedKey`));return}B(!0),H(``);try{a(n),await O(n),U(W===`/login`?`/`:W,{replace:!0})}catch(t){H(f(t)?e(`loginBadKey`):t instanceof Error?t.message:String(t))}finally{B(!1)}}return(0,I.jsxs)(`div`,{className:`relative min-h-dvh overflow-hidden bg-background text-foreground`,children:[(0,I.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-border`}),(0,I.jsxs)(`main`,{ref:G,className:`relative z-10 mx-auto grid min-h-dvh w-full max-w-[1480px] lg:grid-cols-[minmax(0,1fr)_minmax(380px,30rem)]`,children:[(0,I.jsxs)(`section`,{className:`flex min-h-[52vh] flex-col px-5 py-6 sm:px-8 sm:py-8 lg:min-h-dvh lg:px-8 lg:py-10 xl:px-10`,children:[(0,I.jsxs)(`header`,{className:`flex items-center justify-between gap-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(x,{size:36}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`div`,{className:`font-semibold`,children:`CLI2API`}),(0,I.jsx)(`div`,{className:`text-caption text-muted`,children:e(`controlPlane`)})]})]}),(0,I.jsxs)(m,{isAttached:!0,children:[(0,I.jsxs)(C,{children:[(0,I.jsx)(C.Trigger,{children:(0,I.jsx)(o,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:()=>n(t===`zh`?`en`:`zh`),"aria-label":t===`zh`?`English`:`中文`,children:(0,I.jsx)(T,{size:15})})}),(0,I.jsx)(C.Content,{children:t===`zh`?`English`:`中文`})]}),(0,I.jsxs)(C,{children:[(0,I.jsx)(C.Trigger,{children:(0,I.jsx)(o,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:A,"aria-label":k===`dark`?`Light mode`:`Dark mode`,children:k===`dark`?(0,I.jsx)(S,{size:15}):(0,I.jsx)(g,{size:15})})}),(0,I.jsx)(C.Content,{children:k===`dark`?`Light mode`:`Dark mode`})]})]})]}),(0,I.jsx)(`div`,{className:`my-auto w-full py-8 lg:py-10`,children:(0,I.jsx)(r,{t:e,defaultExpanded:!0,forceMockDemo:!0,bare:!0,live:null,mockPace:.45})}),(0,I.jsxs)(`footer`,{className:`hidden items-center justify-between text-caption text-muted lg:flex`,children:[(0,I.jsx)(`span`,{children:e(`loginHint`)}),(0,I.jsx)(`span`,{children:e(`routesHint`)})]})]}),(0,I.jsx)(`section`,{className:`flex items-center px-5 py-10 sm:px-8 lg:px-8 xl:px-10`,children:(0,I.jsx)(l,{"data-gsap-reveal":!0,variant:`transparent`,className:`w-full bg-transparent p-0 shadow-none`,children:(0,I.jsxs)(`form`,{onSubmit:e=>void K(e),children:[(0,I.jsx)(l.Header,{className:`px-2 py-6 sm:px-4`,children:(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,I.jsx)(x,{size:28,loading:z}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(l.Title,{className:`text-title`,children:e(`loginFormTitle`)}),(0,I.jsx)(l.Description,{className:`mt-1`,children:e(`loginDesc`)})]})]})}),(0,I.jsxs)(l.Content,{className:`space-y-5 px-6 py-7 sm:px-8 sm:py-8`,children:[(0,I.jsxs)(p,{name:`console-password`,className:`w-full`,isInvalid:!!V,children:[(0,I.jsx)(s,{children:e(`loginPassword`)}),(0,I.jsxs)(u,{children:[(0,I.jsx)(u.Input,{id:`console-password`,type:L?`text`:`password`,value:M,onChange:e=>P(e.target.value),placeholder:e(`loginPasswordPh`),autoComplete:`current-password`,autoFocus:!0,"aria-label":e(`loginPassword`),spellCheck:!1}),(0,I.jsx)(u.Suffix,{children:(0,I.jsx)(o,{isIconOnly:!0,size:`sm`,variant:`ghost`,type:`button`,"aria-label":e(L?`hidePassword`:`showPassword`),onPress:()=>R(e=>!e),children:L?(0,I.jsx)(F,{size:16}):(0,I.jsx)(N,{size:16})})})]})]}),V?(0,I.jsx)(c,{title:V}):(0,I.jsx)(`p`,{className:`text-caption text-muted`,children:e(`loginHint`)}),(0,I.jsxs)(o,{type:`submit`,fullWidth:!0,size:`lg`,isPending:z,children:[e(z?`loggingInConsole`:`loginSubmit`),z?null:(0,I.jsx)(j,{size:17})]})]})]})})})]})]})}export{L as LoginPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/LogsPage-m7D0s5US.js b/internal/webui/static/assets/LogsPage-AzM3SIPE.js similarity index 97% rename from internal/webui/static/assets/LogsPage-m7D0s5US.js rename to internal/webui/static/assets/LogsPage-AzM3SIPE.js index 8f106383d..f0af86225 100644 --- a/internal/webui/static/assets/LogsPage-m7D0s5US.js +++ b/internal/webui/static/assets/LogsPage-AzM3SIPE.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{i as r,r as i,t as a}from"./SearchBar-C0n-Lr5s.js";import{t as o}from"./TrashSimple.es-CiBYahWn.js";import{n as s,pt as ee,r as te}from"./useI18n-XrvNxGvP.js";import{a as ne,c as re,i as ie,n as c,o as ae,r as l,t as oe}from"./TimeRangePicker-BqQpwy0D.js";import{t as se}from"./PageAlert-BbN7e2aZ.js";import{t as ce}from"./ConfirmDialog-DCaOykOx.js";import{n as u,t as le}from"./useApiKeyOptions-CX9uTy6L.js";import{n as ue}from"./useToggle-55_Qx9vA.js";import{t as de}from"./EmptyPanel-Bs-jQMvG.js";import{t as d}from"./modal-CQ6c3Rhf.js";import{n as fe,t as f}from"./tabs-DrJPw_Nc.js";import{t as p}from"./table-iJwxYVe4.js";import{l as pe,n as me,s as he,t as ge}from"./format-FfdyoNtB.js";import{d as _e,m as ve}from"./overview-ARhe2pSk.js";import{Gt as ye,N as be,Ot as xe,Pt as Se,Qt as Ce,c as we,l as Te,m,s as Ee,t as De}from"./index-CAlyInAP.js";import{t as h}from"./FilterToggle-BoD7X2r2.js";import{n as Oe,t as ke}from"./provider-BZvt2HHB.js";import{t as Ae}from"./LatencyStats-4FIN19Dh.js";import{t as je}from"./FilterSelect-CW3ACxo1.js";var g=t(e(),1),Me=new Map([[`bold`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M72.5,150.63,100.79,128,72.5,105.37a12,12,0,1,1,15-18.74l40,32a12,12,0,0,1,0,18.74l-40,32a12,12,0,0,1-15-18.74ZM144,172h32a12,12,0,0,0,0-24H144a12,12,0,0,0,0,24ZM236,56V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56Zm-24,4H44V196H212Z`}))],[`duotone`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M224,56V200a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z`,opacity:`0.2`}),g.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`fill`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm-91,94.25-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32a8,8,0,0,1,0,12.5ZM176,168H136a8,8,0,0,1,0-16h40a8,8,0,0,1,0,16Z`}))],[`light`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M126,128a6,6,0,0,1-2.25,4.69l-40,32a6,6,0,0,1-7.5-9.38L110.4,128,76.25,100.69a6,6,0,1,1,7.5-9.38l40,32A6,6,0,0,1,126,128Zm50,26H136a6,6,0,0,0,0,12h40a6,6,0,0,0,0-12Zm54-98V200a14,14,0,0,1-14,14H40a14,14,0,0,1-14-14V56A14,14,0,0,1,40,42H216A14,14,0,0,1,230,56Zm-12,0a2,2,0,0,0-2-2H40a2,2,0,0,0-2,2V200a2,2,0,0,0,2,2H216a2,2,0,0,0,2-2Z`}))],[`regular`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`thin`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M122.5,124.88a4,4,0,0,1,0,6.24l-40,32a4,4,0,0,1-5-6.24L113.6,128,77.5,99.12a4,4,0,0,1,5-6.24ZM176,156H136a4,4,0,0,0,0,8h40a4,4,0,0,0,0-8ZM228,56V200a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V56A12,12,0,0,1,40,44H216A12,12,0,0,1,228,56Zm-8,0a4,4,0,0,0-4-4H40a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H216a4,4,0,0,0,4-4Z`}))]]),_=g.forwardRef((e,t)=>g.createElement(ee,{ref:t,...e,weights:Me}));_.displayName=`TerminalWindowIcon`;var Ne=_,v=n();function Pe(e){return e===`ok`?`success`:e===`streaming`||e===`started`||e===`incomplete`?`warning`:e===`error`||e===`canceled`?`danger`:`default`}function Fe(e){if(e===`error`)return`danger`;if(e!==`warn`)return`ok`}function Ie(e){return e===`error`?`danger`:e===`warn`?`warning`:e===`info`?`success`:`default`}function y(e,t=`zh`){if(!e)return`—`;let n=new Date(e);return Number.isFinite(n.getTime())?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(n):e}function Le(e){let t=e.requested_reasoning?.trim()||``,n=e.resolved_reasoning?.trim()||``;return!t&&!n?``:t&&n&&t!==n?`${t} → ${n}`:n||t}function Re({log:e,inLabel:t,outLabel:n,pointsLabel:r}){let i=e.prompt_tokens,a=e.completion_tokens,o=e.credits??e.usage_detail?.credit,s=o!=null&&Number.isFinite(o)?Ve(o):null;return i==null&&a==null&&s==null?(0,v.jsx)(`span`,{className:`mono text-xs text-muted`,children:`—`}):(0,v.jsxs)(`div`,{className:`leading-4`,children:[i!=null||a!=null?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`mono text-xs`,children:[i??0,` / `,a??0]}),(0,v.jsxs)(`div`,{className:`mt-0.5 text-caption text-muted`,children:[t,` / `,n]})]}):null,s==null?null:(0,v.jsx)(`div`,{className:`mono text-caption text-success ${i!=null||a!=null?`mt-0.5`:``}`,children:r?r(s):s})]})}function ze(){return(0,v.jsxs)(`div`,{className:`space-y-5`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,v.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-secondary px-4 py-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(m,{className:`h-5 w-14`}),(0,v.jsx)(m,{className:`h-5 w-48 max-w-full`})]}),(0,v.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(m,{className:`h-3 w-16`}),(0,v.jsx)(m,{className:`h-4 w-20`})]},t))})]}),(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(m,{className:`h-3 w-20`}),(0,v.jsx)(`div`,{className:`grid gap-x-4 gap-y-3 sm:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(m,{className:`h-3 w-16`}),(0,v.jsx)(m,{className:`h-4 w-28 max-w-full`})]},t))})]}),(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(m,{className:`h-3 w-20`}),(0,v.jsx)(m,{className:`h-14 w-full`})]})]})}function Be({title:e,aside:t,children:n}){return(0,v.jsxs)(`section`,{className:`space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,v.jsx)(`h3`,{className:`text-xs font-medium text-muted`,children:e}),t]}),n]})}function b({label:e,value:t,mono:n=!1,wide:r=!1}){return(0,v.jsxs)(`div`,{className:`min-w-0 ${r?`col-span-full`:``}`,children:[(0,v.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,v.jsx)(`dd`,{className:`mt-0.5 break-all text-body ${n?`mono`:`font-medium`}`,children:t})]})}function Ve(e){return e==null||!Number.isFinite(e)?`—`:String(Math.round(e*1e4)/1e4)}var He=[`all`,`ok`,`incomplete`,`error`,`canceled`],x=[`all`,`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`],Ue=[`all`,`1h`,`24h`,`7d`,`custom`];function We(e){let t=(e,t,n)=>t.includes(e??``)?e:n,n=l(e.get(`from`)),r=l(e.get(`to`)),i=n&&r?{start:n,end:r}:null,a=e.get(`stream`);return{requestFilter:t(e.get(`status`),He,`all`),requestId:e.get(`id`)??``,accountFilter:e.get(`account`)??``,apiKeyFilter:e.get(`api_key`)??``,modelFilter:e.get(`model`)??``,providerFilter:e.get(`provider`)??``,streamFilter:a===`stream`||a===`true`?`stream`:a===`sync`||a===`false`?`sync`:`all`,errorKind:t(e.get(`error_kind`),x,`all`),timeRange:i?`custom`:t(e.get(`range`),Ue,`1h`),customRange:i}}function Ge(e){let t=new URLSearchParams;e.requestFilter!==`all`&&t.set(`status`,e.requestFilter),e.requestId&&t.set(`id`,e.requestId),e.accountFilter&&t.set(`account`,e.accountFilter),e.apiKeyFilter&&t.set(`api_key`,e.apiKeyFilter),e.modelFilter&&t.set(`model`,e.modelFilter),e.providerFilter&&t.set(`provider`,e.providerFilter),e.streamFilter!==`all`&&t.set(`stream`,e.streamFilter),e.errorKind!==`all`&&t.set(`error_kind`,e.errorKind);let n=e.timeRange===`custom`?c(e.customRange?.start):void 0,r=e.timeRange===`custom`?c(e.customRange?.end,!0):void 0;return n&&r?(t.set(`from`,n),t.set(`to`,r)):e.timeRange!==`1h`&&t.set(`range`,e.timeRange),t.toString()}function Ke(e){if(e===`all`||e===`custom`)return{from:void 0,to:void 0};let t=new Date,n=new Date(t);return e===`1h`&&n.setHours(n.getHours()-1),e===`24h`&&n.setHours(n.getHours()-24),e===`7d`&&n.setDate(n.getDate()-7),{from:n.toISOString(),to:t.toISOString()}}function S(){let{t:e,lang:t}=s(),[n,ee]=Ce(),[l]=(0,g.useState)(()=>We(new URLSearchParams(window.location.search))),[m,Me]=(0,g.useState)([]),[_,He]=(0,g.useState)([]),[x,Ue]=(0,g.useState)(`requests`),[S,C]=(0,g.useState)(!0),[qe,Je]=(0,g.useState)(!1),[Ye,w]=(0,g.useState)(``),[T,Xe]=(0,g.useState)(l.requestFilter),[E,Ze]=(0,g.useState)(`all`),[D,Qe]=(0,g.useState)(l.requestId),[O,$e]=(0,g.useState)(``),[k,et]=(0,g.useState)(l.accountFilter),[A,tt]=(0,g.useState)(l.apiKeyFilter),[j,nt]=(0,g.useState)(``),[M,rt]=(0,g.useState)(l.modelFilter),[N,it]=(0,g.useState)(l.providerFilter),[P,at]=(0,g.useState)(l.streamFilter),[F,ot]=(0,g.useState)(l.errorKind),[I,st]=(0,g.useState)(l.timeRange),[L,ct]=(0,g.useState)(l.customRange),[lt,R]=(0,g.useState)(1),[z,ut]=(0,g.useState)(50),[dt,ft]=(0,g.useState)(1),[B,pt]=(0,g.useState)(50),[V,mt]=(0,g.useState)([]),[H,ht]=(0,g.useState)(0),[U,gt]=(0,g.useState)([]),[W,_t]=(0,g.useState)(0),[G,vt]=(0,g.useState)(null),[yt,bt]=(0,g.useState)(!1),[K,xt]=(0,g.useState)(null),[St,Ct]=(0,g.useState)(!1),[wt,Tt]=(0,g.useState)(!1),[Et,Dt]=(0,g.useState)(``),q=(0,g.useRef)(0),[Ot,kt]=(0,g.useState)(!1),[At,jt]=(0,g.useState)(!1),J=n.toString(),Y=Ge({requestFilter:T,requestId:D,accountFilter:k,apiKeyFilter:A,modelFilter:M,providerFilter:N,streamFilter:P,errorKind:F,timeRange:I,customRange:L}),X=(0,g.useRef)(J);(0,g.useEffect)(()=>{if(J===X.current)return;X.current=J;let e=We(new URLSearchParams(J));Xe(e.requestFilter),Qe(e.requestId),et(e.accountFilter),tt(e.apiKeyFilter),rt(e.modelFilter),it(e.providerFilter),at(e.streamFilter),ot(e.errorKind),st(e.timeRange),ct(e.customRange)},[J]),(0,g.useEffect)(()=>{Y!==X.current&&(X.current=Y,ee(Y,{replace:!0}))},[Y,ee]),(0,g.useEffect)(()=>{let e=!1;return Promise.allSettled([_e(!1),ve()]).then(([t,n])=>{e||(t.status===`fulfilled`&&Me(t.value.data||[]),n.status===`fulfilled`&&He(n.value.data||[]))}),()=>{e=!0}},[]);let Z=(0,g.useMemo)(()=>{let e=new Map;for(let t of m||[])e.set(t.id,t.name||t.id);return e},[m]),Mt=(0,g.useMemo)(()=>{let e=new Map;for(let t of m||[])e.set(t.id,{provider:t.provider,region:t.region});return e},[m]);function Nt(t){let n=t.account_id?Mt.get(t.account_id):void 0,r=t.provider||n?.provider;return r?Oe(r,n?.region,e):`—`}function Pt(t){switch(t){case`pin`:return e(`logsRouting_pin`);case`sticky`:return e(`logsRouting_sticky`);case`sticky_escape`:return e(`logsRouting_sticky_escape`);default:return e(`logsRouting_pool`)}}let Ft=(0,g.useMemo)(()=>(m||[]).map(e=>({id:e.id,label:e.name||e.id})),[m]),{nameById:It,options:Lt}=le();function Rt(e){let t=e.api_key_id?.trim();return t?It.get(t)||t:`—`}let zt=(0,g.useMemo)(()=>{let t=new Set;for(let e of m||[])e.provider&&t.add(e.provider);return N&&t.add(N),[{id:``,label:e(`logsFilterProviderAll`)},...[...t].sort().map(t=>({id:t,label:ke(t,e)}))]},[m,N,e]),Bt=(0,g.useMemo)(()=>{let e=new Map;for(let t of _||[])e.has(t.id)||e.set(t.id,{id:t.id,label:t.display_name||t.id});return[...e.values()]},[_]),Vt=(0,g.useCallback)(async e=>((await ae({q:e||void 0,limit:20,offset:0})).items||[]).map(e=>({id:e.id,label:e.id})),[]),Ht=!!(D||T!==`all`||k||A||M||N||P!==`all`||F!==`all`||I!==`1h`),Ut=[T,D,k,A,M,N,P,F,I,L?.start?.toString()??``,L?.end?.toString()??``,z].join(`\0`),Wt=[E,O,j,B].join(`\0`),[Gt,Kt]=(0,g.useState)(Ut),[qt,Jt]=(0,g.useState)(Wt);Gt!==Ut&&(Kt(Ut),R(1)),qt!==Wt&&(Jt(Wt),ft(1));let Yt=Math.max(1,Math.ceil(H/z)),Q=Math.min(Gt===Ut?Math.max(1,lt):1,Yt);lt!==Q&&R(Q);let Xt=Math.max(1,Math.ceil(W/B)),$=Math.min(qt===Wt?Math.max(1,dt):1,Xt);dt!==$&&ft($);let Zt=(0,g.useCallback)(async(e=!1)=>{e||C(!0);try{let e=D?{from:void 0,to:void 0}:I===`custom`?{from:c(L?.start),to:c(L?.end,!0)}:Ke(I),t=await ae({status:T===`all`?void 0:T,id:D||void 0,account:k||void 0,api_key:A||void 0,model:M||void 0,provider:N||void 0,stream:P===`all`?void 0:P===`stream`,error_kind:F===`all`?void 0:F,from:e.from,to:e.to,limit:z,offset:(Q-1)*z});mt(t.items||[]),ht(t.total||0),w(``)}catch(t){e||w(t instanceof Error?t.message:String(t))}finally{e||(C(!1),Je(!0))}},[T,D,k,A,M,N,P,F,I,L,Q,z]),Qt=(0,g.useCallback)(async(e=!1)=>{e||C(!0);try{let e=await re({level:E===`all`?void 0:E,q:O.trim()||void 0,account:j||void 0,limit:B,offset:($-1)*B});gt(e.items||[]),_t(e.total??0),w(``)}catch(t){e||w(t instanceof Error?t.message:String(t))}finally{e||(C(!1),Je(!0))}},[E,O,j,$,B]),$t=(0,g.useCallback)(async(e=!1)=>{x===`requests`?await Zt(e):await Qt(e)},[x,Zt,Qt]);(0,g.useEffect)(()=>{C(!0);let e=x===`runtime`&&O.trim()?280:0,t=window.setTimeout(()=>void $t(!1),e);return()=>window.clearTimeout(t)},[$t,x,O]),(0,g.useEffect)(()=>{if(x!==`runtime`||$!==1)return;let e=window.setInterval(()=>{document.hidden||Qt(!0)},3e3);return()=>window.clearInterval(e)},[x,$,Qt]);let en=H===0?0:(Q-1)*z+1,tn=Math.min(H,Q*z),nn=W===0?0:($-1)*B+1,rn=Math.min(W,$*B),an=(0,g.useMemo)(()=>x===`requests`?e(`logsShownTotal`,{shown:V.length?`${en}–${tn}`:0,total:H}):e(`logsShownTotal`,{shown:U.length?`${nn}–${rn}`:0,total:W}),[x,V.length,U.length,en,tn,H,nn,rn,W,e]);function on(){Qe(``),Xe(`all`),et(``),tt(``),rt(``),it(``),at(`all`),ot(`all`),st(`1h`),ct(null),R(1)}async function sn(e){let t=++q.current;xt(e),Dt(``),Tt(!0),Ct(!0);try{let n=await ne(e.id);if(q.current!==t)return;xt(n)}catch(e){if(q.current!==t)return;Dt(e instanceof Error?e.message:String(e))}finally{q.current===t&&Tt(!1)}}function cn(e){vt(e),bt(!0)}async function ln(){jt(!0),De({id:`logs-clear`,type:`loading`,title:e(`toastClearingLogs`)});try{await ie(),kt(!1),await Zt(!1),De({id:`logs-clear`,type:`success`,title:e(`toastLogsCleared`)})}catch(t){w(t instanceof Error?t.message:String(t)),De({id:`logs-clear`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{jt(!1)}}let un=S&&(x===`requests`?V.length===0:U.length===0);return S&&!qe?(0,v.jsx)(Ee,{}):(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-4 pb-4`,children:(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x===`requests`?(0,v.jsxs)(te,{size:`sm`,variant:`ghost`,onPress:()=>kt(!0),isDisabled:At||H===0,children:[(0,v.jsx)(o,{size:14}),e(`logsClear`)]}):null,(0,v.jsxs)(te,{size:`sm`,variant:`secondary`,isPending:S,onPress:()=>void $t(!1),children:[(0,v.jsx)(ye,{size:15}),e(`refresh`)]})]})}),Ye?(0,v.jsx)(se,{title:e(`failedLogs`,{msg:Ye})}):null,(0,v.jsxs)(f,{selectedKey:x,onSelectionChange:e=>Ue(String(e)),children:[(0,v.jsx)(f.ListContainer,{className:`w-fit`,children:(0,v.jsxs)(f.List,{children:[(0,v.jsxs)(fe,{id:`requests`,className:`gap-1.5`,children:[(0,v.jsx)(f.Indicator,{className:`transition-none`}),(0,v.jsx)(Se,{size:13}),e(`logsRequests`)]}),(0,v.jsxs)(fe,{id:`runtime`,className:`gap-1.5`,children:[(0,v.jsx)(f.Indicator,{className:`transition-none`}),(0,v.jsx)(Ne,{size:13}),e(`logsRuntime`)]})]})}),(0,v.jsxs)(f.Panel,{id:`requests`,"data-tab-panel":`requests`,className:`space-y-4 pt-5`,children:[(0,v.jsxs)(`div`,{className:`data-toolbar flex flex-col gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,v.jsx)(h,{value:T,onChange:e=>Xe(e),ariaLabel:e(`logsFilterAll`),options:[{id:`all`,label:e(`logsFilterAll`)},{id:`ok`,label:e(`logsFilterOk`)},{id:`incomplete`,label:e(`logsFilterIncomplete`)},{id:`error`,label:e(`logsFilterError`)},{id:`canceled`,label:e(`logsFilterCanceled`)}]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Ht?(0,v.jsx)(te,{size:`sm`,variant:`ghost`,onPress:on,children:e(`clearFilters`)}):null,(0,v.jsx)(`div`,{className:`mono text-caption text-muted`,children:an})]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(u,{ariaLabel:e(`logsColAccount`),value:k,onChange:et,options:Ft,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(u,{ariaLabel:e(`logsColApiKey`),value:A,onChange:tt,options:Lt,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(u,{ariaLabel:e(`logsColModel`),value:M,onChange:rt,options:Bt,allLabel:e(`logsFilterModelAll`),searchPlaceholder:e(`logsSearchModel`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(je,{ariaLabel:e(`logsColProvider`),value:N,onChange:it,options:zt}),(0,v.jsx)(u,{ariaLabel:e(`logsSearchRequestId`),value:D,onChange:Qe,options:D?[{id:D,label:D}]:[],allLabel:e(`logsFilterIdAll`),searchPlaceholder:e(`logsSearchRequestId`),emptyLabel:e(`logsNoFilterOptions`),loadOptions:Vt,className:`min-w-56`}),(0,v.jsx)(h,{value:P,onChange:e=>at(e),ariaLabel:e(`logsFilterStreamAll`),options:[{id:`all`,label:e(`logsFilterStreamAll`)},{id:`stream`,label:e(`logsStreamYes`)},{id:`sync`,label:e(`logsStreamNo`)}]}),(0,v.jsx)(je,{ariaLabel:e(`errorKind`),value:F===`all`?``:F,onChange:e=>ot(e||`all`),options:[{id:``,label:e(`logsFilterKindAll`)},{id:`quota`,label:e(`logsKindQuota`)},{id:`rate_limit`,label:e(`logsKindRateLimit`)},{id:`auth`,label:e(`logsKindAuth`)},{id:`not_ready`,label:e(`logsKindNotReady`)},{id:`unavailable`,label:e(`logsKindUnavailable`)},{id:`invalid_request`,label:e(`logsKindInvalidRequest`)},{id:`model_not_available`,label:e(`logsKindModelNotAvailable`)}]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e(`logsTimeRange`)}),(0,v.jsx)(h,{value:I,onChange:e=>st(e),ariaLabel:e(`logsTimeRange`),options:[{id:`all`,label:e(`logsTimeAll`)},{id:`1h`,label:e(`logsTime1h`)},{id:`24h`,label:e(`logsTime24h`)},{id:`7d`,label:e(`logsTime7d`)},{id:`custom`,label:e(`logsTimeCustom`)}]}),I===`custom`?(0,v.jsx)(oe,{className:`w-[min(100%,42rem)]`,value:L,onChange:ct,ariaLabel:e(`logsTimeRange`),fromLabel:e(`logsTimeFrom`),toLabel:e(`logsTimeTo`)}):null]})]}),(0,v.jsx)(ue,{className:`overflow-hidden p-0`,"aria-busy":S,children:un?(0,v.jsx)(we,{}):V.length===0?(0,v.jsx)(de,{icon:(0,v.jsx)(r,{size:22}),title:e(Ht?`logsNoMatch`:`logsEmptyRequests`),action:Ht?(0,v.jsx)(te,{size:`sm`,variant:`ghost`,onPress:on,children:e(`clearFilters`)}):null}):(0,v.jsx)(p,{children:(0,v.jsx)(p.ScrollContainer,{children:(0,v.jsxs)(p.Content,{"aria-label":e(`logsRequests`),children:[(0,v.jsxs)(p.Header,{children:[(0,v.jsx)(p.Column,{isRowHeader:!0,children:e(`logsColTime`)}),(0,v.jsx)(p.Column,{children:e(`logsColModel`)}),(0,v.jsx)(p.Column,{children:e(`logsColReasoning`)}),(0,v.jsx)(p.Column,{children:e(`logsColProvider`)}),(0,v.jsx)(p.Column,{children:e(`logsColAccount`)}),(0,v.jsx)(p.Column,{children:e(`logsColApiKey`)}),(0,v.jsx)(p.Column,{children:e(`logsColStatus`)}),(0,v.jsx)(p.Column,{children:e(`logsColStream`)}),(0,v.jsx)(p.Column,{children:e(`logsColLatency`)}),(0,v.jsx)(p.Column,{children:e(`logsColTokens`)})]}),(0,v.jsx)(p.Body,{children:V.map(n=>(0,v.jsxs)(p.Row,{className:`cursor-pointer`,onAction:()=>void sn(n),children:[(0,v.jsx)(p.Cell,{children:(0,v.jsxs)(`div`,{className:`py-1`,children:[(0,v.jsx)(`div`,{className:`mono text-xs`,children:y(n.created_at,t)}),(0,v.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.id})]})}),(0,v.jsxs)(p.Cell,{children:[(0,v.jsx)(`div`,{className:`text-body font-medium`,children:n.requested_model||`—`}),n.mapped_model&&n.mapped_model!==n.requested_model?(0,v.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.mapped_model}):null]}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`mono text-xs`,children:Le(n)||`—`})}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`text-xs`,children:Nt(n)})}),(0,v.jsxs)(p.Cell,{children:[(0,v.jsx)(`span`,{className:`text-xs`,children:n.account_id?Z.get(n.account_id)||n.account_id:`—`}),n.account_id&&Z.get(n.account_id)&&Z.get(n.account_id)!==n.account_id?(0,v.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.account_id}):null]}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`text-xs`,children:Rt(n)})}),(0,v.jsxs)(p.Cell,{children:[(0,v.jsx)(be,{size:`sm`,variant:`soft`,color:Pe(n.status),children:n.status}),n.error_kind?(0,v.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:n.error_kind}):null]}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`text-xs text-muted`,children:n.stream?e(`logsStreamYes`):e(`logsStreamNo`)})}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(Ae,{latencyMs:n.latency_ms,ttfbMs:n.ttfb_ms,completionTokens:n.completion_tokens,stream:n.stream,labels:{ttft:e(`logsColTTFT`),total:e(`logsLatencyTotal`),tps:e(`logsOutputTPS`)}})}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(Re,{log:n,inLabel:e(`logsTokensIn`),outLabel:e(`logsTokensOut`),pointsLabel:t=>e(`logsTokensPoints`,{value:t})})})]},n.id))})]})})})}),(0,v.jsx)(i,{total:H,page:Q,pageCount:Yt,pageSize:z,loading:S,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:Q,pages:Yt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:R,onPageSize:ut})]}),(0,v.jsxs)(f.Panel,{id:`runtime`,"data-tab-panel":`runtime`,className:`space-y-4 pt-5`,children:[(0,v.jsxs)(`div`,{className:`data-toolbar flex flex-wrap items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(a,{className:`sm:w-72`,value:O,onChange:$e,placeholder:e(`logsSearchRuntime`),ariaLabel:e(`logsSearchRuntime`)}),(0,v.jsx)(u,{ariaLabel:e(`logsColAccount`),value:j,onChange:nt,options:Ft,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(h,{value:E,onChange:e=>Ze(e),ariaLabel:e(`logsLevelAll`),options:[{id:`all`,label:e(`logsLevelAll`)},{id:`info`,label:e(`logsLevelInfo`)},{id:`warn`,label:e(`logsLevelWarn`)},{id:`error`,label:e(`logsLevelError`)}]})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted`,children:[$===1?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`status-dot`,"data-state":`ok`}),e(`logsAutoRefresh`)]}):null,(0,v.jsx)(`span`,{className:`mono`,children:an})]})]}),(0,v.jsx)(ue,{className:`overflow-hidden p-0`,"aria-busy":S,children:un?(0,v.jsx)(Te,{}):U.length===0?(0,v.jsx)(de,{icon:(0,v.jsx)(Ne,{size:22}),title:e(`logsEmptyRuntime`)}):(0,v.jsx)(`div`,{className:`divide-y divide-separator`,children:U.map(e=>(0,v.jsxs)(`div`,{className:`grid cursor-pointer gap-2 px-5 py-3 transition-colors hover:bg-surface-secondary/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:grid-cols-[150px_72px_minmax(0,1fr)] sm:items-start`,role:`button`,tabIndex:0,onClick:()=>cn(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),cn(e))},children:[(0,v.jsx)(`div`,{className:`mono text-caption text-muted`,children:y(e.time,t)}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`status-dot`,"data-state":Fe(e.level)}),(0,v.jsx)(`span`,{className:`font-medium text-muted`,children:e.level})]}),(0,v.jsxs)(`div`,{className:`min-w-0`,children:[e.account_id?(0,v.jsx)(`div`,{className:`mono mb-1 text-caption text-muted`,children:e.account_id}):null,(0,v.jsx)(`div`,{className:`mono break-all text-xs leading-5 text-foreground`,children:e.message})]})]},e.id))})}),(0,v.jsx)(i,{total:W,page:$,pageCount:Xt,pageSize:B,loading:S,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:$,pages:Xt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:ft,onPageSize:pt})]})]}),(0,v.jsx)(d.Root,{isOpen:yt,onOpenChange:e=>{bt(e),e||vt(null)},children:(0,v.jsx)(d.Backdrop,{variant:`blur`,children:(0,v.jsx)(d.Container,{size:`lg`,scroll:`inside`,children:(0,v.jsxs)(d.Dialog,{className:`w-full max-w-4xl`,children:[(0,v.jsxs)(d.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(d.Heading,{className:`text-section font-semibold`,children:e(`logsRuntimeDetailTitle`)}),(0,v.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:G?`#${G.id}`:`—`})]}),(0,v.jsx)(d.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,v.jsx)(xe,{size:16})})]}),(0,v.jsxs)(d.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,v.jsx)(`dl`,{className:`grid gap-3 sm:grid-cols-2`,children:[[e(`logsColTime`),G?y(G.time,t):`—`],[e(`logsRuntimeLevel`),G?.level||`—`],[e(`logsRuntimeSource`),G?.source||`—`],[e(`logsColAccount`),G?.account_id||`—`]].map(([t,n])=>(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`dt`,{className:`text-caption text-muted`,children:t}),(0,v.jsx)(`dd`,{className:`mt-1 break-all text-body font-medium`,children:t===e(`logsRuntimeLevel`)&&G?(0,v.jsx)(be,{size:`sm`,variant:`soft`,color:Ie(G.level),children:G.level}):n})]},String(t)))}),(0,v.jsxs)(`section`,{className:`space-y-2`,children:[(0,v.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e(`logsRuntimeMessage`)}),(0,v.jsx)(`pre`,{className:`mono max-h-[min(38rem,60vh)] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary px-4 py-3 text-xs leading-6 text-foreground`,children:G?.message||`—`})]})]})]})})})}),(0,v.jsx)(d.Root,{isOpen:St,onOpenChange:e=>{Ct(e),e||(q.current+=1,Tt(!1),Dt(``),xt(null))},children:(0,v.jsx)(d.Backdrop,{variant:`blur`,children:(0,v.jsx)(d.Container,{size:`lg`,scroll:`inside`,children:(0,v.jsxs)(d.Dialog,{className:`w-full max-w-4xl`,children:[(0,v.jsxs)(d.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(d.Heading,{className:`text-section font-semibold`,children:e(`logsDetailTitle`)}),(0,v.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:K?.id})]}),(0,v.jsx)(d.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,v.jsx)(xe,{size:16})})]}),(0,v.jsx)(d.Body,{className:`space-y-5 px-5 pb-5`,children:wt?(0,v.jsx)(ze,{}):Et?(0,v.jsx)(se,{title:e(`requestFailed`),description:Et}):K?(0,v.jsxs)(v.Fragment,{children:[K.error_message?(0,v.jsx)(se,{title:K.error_kind||e(`requestFailed`),description:K.error_message}):null,(0,v.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-secondary px-4 py-4`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,v.jsx)(be,{size:`sm`,variant:`soft`,color:Pe(K.status),children:K.status||`—`}),(0,v.jsx)(`span`,{className:`mono min-w-0 break-all text-body font-medium`,children:K.requested_model||`—`}),K.mapped_model&&K.mapped_model!==K.requested_model?(0,v.jsxs)(`span`,{className:`mono break-all text-caption text-muted`,children:[`→ `,K.mapped_model]}):null,Le(K)?(0,v.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`· `,Le(K)]}):null,(0,v.jsx)(`span`,{className:`mono ml-auto text-caption text-muted`,children:y(K.created_at,t)})]}),(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{mono:!0,label:`${e(`logsColTokens`)} · ${e(`logsTokensIn`)} / ${e(`logsTokensOut`)}`,value:K.prompt_tokens==null&&K.completion_tokens==null?`—`:`${K.prompt_tokens??0} / ${K.completion_tokens??0}`}),(K.credits??K.usage_detail?.credit)==null?null:(0,v.jsx)(b,{mono:!0,label:e(`logsCreditConsumed`),value:`${Ve(K.credits??K.usage_detail?.credit)}${K.usage_detail?.unit?` ${K.usage_detail.unit}`:``}`}),(0,v.jsx)(b,{mono:!0,label:e(`logsColTTFT`),value:he(K.ttfb_ms)}),(0,v.jsx)(b,{mono:!0,label:e(`logsLatencyTotal`),value:he(K.latency_ms)}),(0,v.jsx)(b,{mono:!0,label:e(`logsOutputTPS`),value:pe(ge({completionTokens:K.completion_tokens,latencyMs:K.latency_ms,ttfbMs:K.ttfb_ms,stream:K.stream}))})]})]}),(0,v.jsx)(Be,{title:e(`logsSectionCall`),children:(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{label:e(`logsColProvider`),value:Nt(K)}),(0,v.jsx)(b,{label:e(`logsColAccount`),value:K.account_id?Z.get(K.account_id)||K.account_id:`—`}),(0,v.jsx)(b,{label:e(`logsColApiKey`),value:Rt(K)}),(0,v.jsx)(b,{label:e(`logsColStream`),value:K.stream?e(`logsStreamYes`):e(`logsStreamNo`)}),(0,v.jsx)(b,{label:e(`logsRouting`),value:Pt(K.routing)})]})}),(0,v.jsx)(Be,{title:e(`logsAttempts`),aside:K.attempts?.length?(0,v.jsx)(`span`,{className:`mono text-caption text-muted`,children:K.attempts.length}):null,children:K.attempts?.length?(0,v.jsx)(`div`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:K.attempts.map(e=>(0,v.jsxs)(`div`,{className:`grid grid-cols-[32px_minmax(0,1fr)_auto] items-start gap-x-3 px-3 py-2.5`,children:[(0,v.jsxs)(`div`,{className:`mono pt-0.5 text-caption text-muted`,children:[`#`,e.attempt_index]}),(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.account_id?Z.get(e.account_id)||e.account_id:`—`}),e.error_message?(0,v.jsxs)(`div`,{className:`mt-0.5 break-all text-caption text-muted`,children:[e.error_kind?(0,v.jsx)(`span`,{className:`mono mr-1.5`,children:e.error_kind}):null,e.error_message]}):null]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.latency_ms==null?null:(0,v.jsx)(`span`,{className:`mono text-caption text-muted`,children:he(e.latency_ms)}),(0,v.jsx)(be,{size:`sm`,variant:`soft`,color:Pe(e.status===`failover`?`canceled`:e.status),children:e.status})]})]},e.id))}):(0,v.jsx)(`p`,{className:`text-caption text-muted`,children:e(`logsNoAttempts`)})}),K.message_count||K.stream_diagnostic?(0,v.jsx)(Be,{title:e(`logsSectionDiagnostics`),children:(0,v.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-secondary px-4 py-3`,children:[K.message_count?(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:e(`logsMessageShape`)}),(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{mono:!0,label:e(`logsMessageCount`),value:K.message_count}),(0,v.jsx)(b,{mono:!0,label:e(`logsEmptyMessageIndexes`),value:K.empty_message_indexes?.length?K.empty_message_indexes.join(`, `):`—`}),(0,v.jsx)(b,{mono:!0,wide:!0,label:e(`logsMessageRoles`),value:K.message_roles?.join(` → `)||`—`})]})]}):null,K.message_count&&K.stream_diagnostic?(0,v.jsx)(`div`,{className:`border-t border-separator`}):null,K.stream_diagnostic?(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:e(`logsStreamDiagnostics`)}),(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{mono:!0,label:e(`logsUpstreamStatus`),value:K.stream_diagnostic.upstream_status??`—`}),(0,v.jsx)(b,{mono:!0,label:e(`logsStreamComplete`),value:K.stream_diagnostic.saw_done?e(`yes`):e(`no`)}),(0,v.jsx)(b,{mono:!0,label:e(`logsCancellationSource`),value:K.stream_diagnostic.cancellation_source||`—`}),(0,v.jsx)(b,{mono:!0,label:e(`logsSSEEvents`),value:K.stream_diagnostic.sse_event_count}),(0,v.jsx)(b,{mono:!0,label:e(`logsBytesRead`),value:me(K.stream_diagnostic.bytes_read)}),(0,v.jsx)(b,{mono:!0,label:e(`logsLastEvent`),value:K.stream_diagnostic.last_event||`—`}),K.stream_diagnostic.context_err?(0,v.jsx)(b,{mono:!0,wide:!0,label:`context`,value:K.stream_diagnostic.context_err}):null,K.stream_diagnostic.relay_error?(0,v.jsx)(b,{mono:!0,wide:!0,label:`relay`,value:K.stream_diagnostic.relay_error}):null]})]}):null]})}):null]}):null})]})})})}),(0,v.jsx)(ce,{isOpen:Ot,title:e(`logsClear`),description:e(`logsClearConfirm`),confirmLabel:e(`logsClear`),cancelLabel:e(`close`),closeLabel:e(`close`),isPending:At,onClose:()=>kt(!1),onConfirm:()=>void ln()})]})}export{S as LogsPage}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{i as r,r as i,t as a}from"./SearchBar-7OerD-fU.js";import{t as o}from"./TrashSimple.es-KG9lGXYp.js";import{n as s,pt as ee,r as te}from"./useI18n-BAo1UrJW.js";import{a as ne,c as re,i as ie,n as c,o as ae,r as l,t as oe}from"./TimeRangePicker-C8MnQbdC.js";import{t as se}from"./PageAlert-4fxVtrfI.js";import{t as ce}from"./ConfirmDialog-BzgkrQpc.js";import{n as u,t as le}from"./useApiKeyOptions-Pz-FFnim.js";import{n as ue}from"./useToggle-DpH7h_oD.js";import{t as de}from"./EmptyPanel-Bs-jQMvG.js";import{t as d}from"./modal-6BQxrL1y.js";import{n as fe,t as f}from"./tabs-WTDlSXp1.js";import{t as p}from"./table-B2nk0cjc.js";import{l as pe,n as me,s as he,t as ge}from"./format-BAkFbjAh.js";import{d as _e,m as ve}from"./overview-ARhe2pSk.js";import{Gt as ye,N as be,Ot as xe,Pt as Se,Qt as Ce,c as we,l as Te,m,s as Ee,t as De}from"./index-CWTBzWuK.js";import{t as h}from"./FilterToggle-CbYR8o3t.js";import{n as Oe,t as ke}from"./provider-BZvt2HHB.js";import{t as Ae}from"./LatencyStats-CPcR-mdd.js";import{t as je}from"./FilterSelect-qchbu2Tk.js";var g=t(e(),1),Me=new Map([[`bold`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M72.5,150.63,100.79,128,72.5,105.37a12,12,0,1,1,15-18.74l40,32a12,12,0,0,1,0,18.74l-40,32a12,12,0,0,1-15-18.74ZM144,172h32a12,12,0,0,0,0-24H144a12,12,0,0,0,0,24ZM236,56V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56Zm-24,4H44V196H212Z`}))],[`duotone`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M224,56V200a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z`,opacity:`0.2`}),g.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`fill`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm-91,94.25-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32a8,8,0,0,1,0,12.5ZM176,168H136a8,8,0,0,1,0-16h40a8,8,0,0,1,0,16Z`}))],[`light`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M126,128a6,6,0,0,1-2.25,4.69l-40,32a6,6,0,0,1-7.5-9.38L110.4,128,76.25,100.69a6,6,0,1,1,7.5-9.38l40,32A6,6,0,0,1,126,128Zm50,26H136a6,6,0,0,0,0,12h40a6,6,0,0,0,0-12Zm54-98V200a14,14,0,0,1-14,14H40a14,14,0,0,1-14-14V56A14,14,0,0,1,40,42H216A14,14,0,0,1,230,56Zm-12,0a2,2,0,0,0-2-2H40a2,2,0,0,0-2,2V200a2,2,0,0,0,2,2H216a2,2,0,0,0,2-2Z`}))],[`regular`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`thin`,g.createElement(g.Fragment,null,g.createElement(`path`,{d:`M122.5,124.88a4,4,0,0,1,0,6.24l-40,32a4,4,0,0,1-5-6.24L113.6,128,77.5,99.12a4,4,0,0,1,5-6.24ZM176,156H136a4,4,0,0,0,0,8h40a4,4,0,0,0,0-8ZM228,56V200a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V56A12,12,0,0,1,40,44H216A12,12,0,0,1,228,56Zm-8,0a4,4,0,0,0-4-4H40a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H216a4,4,0,0,0,4-4Z`}))]]),_=g.forwardRef((e,t)=>g.createElement(ee,{ref:t,...e,weights:Me}));_.displayName=`TerminalWindowIcon`;var Ne=_,v=n();function Pe(e){return e===`ok`?`success`:e===`streaming`||e===`started`||e===`incomplete`?`warning`:e===`error`||e===`canceled`?`danger`:`default`}function Fe(e){if(e===`error`)return`danger`;if(e!==`warn`)return`ok`}function Ie(e){return e===`error`?`danger`:e===`warn`?`warning`:e===`info`?`success`:`default`}function y(e,t=`zh`){if(!e)return`—`;let n=new Date(e);return Number.isFinite(n.getTime())?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(n):e}function Le(e){let t=e.requested_reasoning?.trim()||``,n=e.resolved_reasoning?.trim()||``;return!t&&!n?``:t&&n&&t!==n?`${t} → ${n}`:n||t}function Re({log:e,inLabel:t,outLabel:n,pointsLabel:r}){let i=e.prompt_tokens,a=e.completion_tokens,o=e.credits??e.usage_detail?.credit,s=o!=null&&Number.isFinite(o)?Ve(o):null;return i==null&&a==null&&s==null?(0,v.jsx)(`span`,{className:`mono text-xs text-muted`,children:`—`}):(0,v.jsxs)(`div`,{className:`leading-4`,children:[i!=null||a!=null?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`mono text-xs`,children:[i??0,` / `,a??0]}),(0,v.jsxs)(`div`,{className:`mt-0.5 text-caption text-muted`,children:[t,` / `,n]})]}):null,s==null?null:(0,v.jsx)(`div`,{className:`mono text-caption text-success ${i!=null||a!=null?`mt-0.5`:``}`,children:r?r(s):s})]})}function ze(){return(0,v.jsxs)(`div`,{className:`space-y-5`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,v.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-secondary px-4 py-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(m,{className:`h-5 w-14`}),(0,v.jsx)(m,{className:`h-5 w-48 max-w-full`})]}),(0,v.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(m,{className:`h-3 w-16`}),(0,v.jsx)(m,{className:`h-4 w-20`})]},t))})]}),(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(m,{className:`h-3 w-20`}),(0,v.jsx)(`div`,{className:`grid gap-x-4 gap-y-3 sm:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,v.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,v.jsx)(m,{className:`h-3 w-16`}),(0,v.jsx)(m,{className:`h-4 w-28 max-w-full`})]},t))})]}),(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(m,{className:`h-3 w-20`}),(0,v.jsx)(m,{className:`h-14 w-full`})]})]})}function Be({title:e,aside:t,children:n}){return(0,v.jsxs)(`section`,{className:`space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,v.jsx)(`h3`,{className:`text-xs font-medium text-muted`,children:e}),t]}),n]})}function b({label:e,value:t,mono:n=!1,wide:r=!1}){return(0,v.jsxs)(`div`,{className:`min-w-0 ${r?`col-span-full`:``}`,children:[(0,v.jsx)(`dt`,{className:`text-caption text-muted`,children:e}),(0,v.jsx)(`dd`,{className:`mt-0.5 break-all text-body ${n?`mono`:`font-medium`}`,children:t})]})}function Ve(e){return e==null||!Number.isFinite(e)?`—`:String(Math.round(e*1e4)/1e4)}var He=[`all`,`ok`,`incomplete`,`error`,`canceled`],x=[`all`,`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`],Ue=[`all`,`1h`,`24h`,`7d`,`custom`];function We(e){let t=(e,t,n)=>t.includes(e??``)?e:n,n=l(e.get(`from`)),r=l(e.get(`to`)),i=n&&r?{start:n,end:r}:null,a=e.get(`stream`);return{requestFilter:t(e.get(`status`),He,`all`),requestId:e.get(`id`)??``,accountFilter:e.get(`account`)??``,apiKeyFilter:e.get(`api_key`)??``,modelFilter:e.get(`model`)??``,providerFilter:e.get(`provider`)??``,streamFilter:a===`stream`||a===`true`?`stream`:a===`sync`||a===`false`?`sync`:`all`,errorKind:t(e.get(`error_kind`),x,`all`),timeRange:i?`custom`:t(e.get(`range`),Ue,`1h`),customRange:i}}function Ge(e){let t=new URLSearchParams;e.requestFilter!==`all`&&t.set(`status`,e.requestFilter),e.requestId&&t.set(`id`,e.requestId),e.accountFilter&&t.set(`account`,e.accountFilter),e.apiKeyFilter&&t.set(`api_key`,e.apiKeyFilter),e.modelFilter&&t.set(`model`,e.modelFilter),e.providerFilter&&t.set(`provider`,e.providerFilter),e.streamFilter!==`all`&&t.set(`stream`,e.streamFilter),e.errorKind!==`all`&&t.set(`error_kind`,e.errorKind);let n=e.timeRange===`custom`?c(e.customRange?.start):void 0,r=e.timeRange===`custom`?c(e.customRange?.end,!0):void 0;return n&&r?(t.set(`from`,n),t.set(`to`,r)):e.timeRange!==`1h`&&t.set(`range`,e.timeRange),t.toString()}function Ke(e){if(e===`all`||e===`custom`)return{from:void 0,to:void 0};let t=new Date,n=new Date(t);return e===`1h`&&n.setHours(n.getHours()-1),e===`24h`&&n.setHours(n.getHours()-24),e===`7d`&&n.setDate(n.getDate()-7),{from:n.toISOString(),to:t.toISOString()}}function S(){let{t:e,lang:t}=s(),[n,ee]=Ce(),[l]=(0,g.useState)(()=>We(new URLSearchParams(window.location.search))),[m,Me]=(0,g.useState)([]),[_,He]=(0,g.useState)([]),[x,Ue]=(0,g.useState)(`requests`),[S,C]=(0,g.useState)(!0),[qe,Je]=(0,g.useState)(!1),[Ye,w]=(0,g.useState)(``),[T,Xe]=(0,g.useState)(l.requestFilter),[E,Ze]=(0,g.useState)(`all`),[D,Qe]=(0,g.useState)(l.requestId),[O,$e]=(0,g.useState)(``),[k,et]=(0,g.useState)(l.accountFilter),[A,tt]=(0,g.useState)(l.apiKeyFilter),[j,nt]=(0,g.useState)(``),[M,rt]=(0,g.useState)(l.modelFilter),[N,it]=(0,g.useState)(l.providerFilter),[P,at]=(0,g.useState)(l.streamFilter),[F,ot]=(0,g.useState)(l.errorKind),[I,st]=(0,g.useState)(l.timeRange),[L,ct]=(0,g.useState)(l.customRange),[lt,R]=(0,g.useState)(1),[z,ut]=(0,g.useState)(50),[dt,ft]=(0,g.useState)(1),[B,pt]=(0,g.useState)(50),[V,mt]=(0,g.useState)([]),[H,ht]=(0,g.useState)(0),[U,gt]=(0,g.useState)([]),[W,_t]=(0,g.useState)(0),[G,vt]=(0,g.useState)(null),[yt,bt]=(0,g.useState)(!1),[K,xt]=(0,g.useState)(null),[St,Ct]=(0,g.useState)(!1),[wt,Tt]=(0,g.useState)(!1),[Et,Dt]=(0,g.useState)(``),q=(0,g.useRef)(0),[Ot,kt]=(0,g.useState)(!1),[At,jt]=(0,g.useState)(!1),J=n.toString(),Y=Ge({requestFilter:T,requestId:D,accountFilter:k,apiKeyFilter:A,modelFilter:M,providerFilter:N,streamFilter:P,errorKind:F,timeRange:I,customRange:L}),X=(0,g.useRef)(J);(0,g.useEffect)(()=>{if(J===X.current)return;X.current=J;let e=We(new URLSearchParams(J));Xe(e.requestFilter),Qe(e.requestId),et(e.accountFilter),tt(e.apiKeyFilter),rt(e.modelFilter),it(e.providerFilter),at(e.streamFilter),ot(e.errorKind),st(e.timeRange),ct(e.customRange)},[J]),(0,g.useEffect)(()=>{Y!==X.current&&(X.current=Y,ee(Y,{replace:!0}))},[Y,ee]),(0,g.useEffect)(()=>{let e=!1;return Promise.allSettled([_e(!1),ve()]).then(([t,n])=>{e||(t.status===`fulfilled`&&Me(t.value.data||[]),n.status===`fulfilled`&&He(n.value.data||[]))}),()=>{e=!0}},[]);let Z=(0,g.useMemo)(()=>{let e=new Map;for(let t of m||[])e.set(t.id,t.name||t.id);return e},[m]),Mt=(0,g.useMemo)(()=>{let e=new Map;for(let t of m||[])e.set(t.id,{provider:t.provider,region:t.region});return e},[m]);function Nt(t){let n=t.account_id?Mt.get(t.account_id):void 0,r=t.provider||n?.provider;return r?Oe(r,n?.region,e):`—`}function Pt(t){switch(t){case`pin`:return e(`logsRouting_pin`);case`sticky`:return e(`logsRouting_sticky`);case`sticky_escape`:return e(`logsRouting_sticky_escape`);default:return e(`logsRouting_pool`)}}let Ft=(0,g.useMemo)(()=>(m||[]).map(e=>({id:e.id,label:e.name||e.id})),[m]),{nameById:It,options:Lt}=le();function Rt(e){let t=e.api_key_id?.trim();return t?It.get(t)||t:`—`}let zt=(0,g.useMemo)(()=>{let t=new Set;for(let e of m||[])e.provider&&t.add(e.provider);return N&&t.add(N),[{id:``,label:e(`logsFilterProviderAll`)},...[...t].sort().map(t=>({id:t,label:ke(t,e)}))]},[m,N,e]),Bt=(0,g.useMemo)(()=>{let e=new Map;for(let t of _||[])e.has(t.id)||e.set(t.id,{id:t.id,label:t.display_name||t.id});return[...e.values()]},[_]),Vt=(0,g.useCallback)(async e=>((await ae({q:e||void 0,limit:20,offset:0})).items||[]).map(e=>({id:e.id,label:e.id})),[]),Ht=!!(D||T!==`all`||k||A||M||N||P!==`all`||F!==`all`||I!==`1h`),Ut=[T,D,k,A,M,N,P,F,I,L?.start?.toString()??``,L?.end?.toString()??``,z].join(`\0`),Wt=[E,O,j,B].join(`\0`),[Gt,Kt]=(0,g.useState)(Ut),[qt,Jt]=(0,g.useState)(Wt);Gt!==Ut&&(Kt(Ut),R(1)),qt!==Wt&&(Jt(Wt),ft(1));let Yt=Math.max(1,Math.ceil(H/z)),Q=Math.min(Gt===Ut?Math.max(1,lt):1,Yt);lt!==Q&&R(Q);let Xt=Math.max(1,Math.ceil(W/B)),$=Math.min(qt===Wt?Math.max(1,dt):1,Xt);dt!==$&&ft($);let Zt=(0,g.useCallback)(async(e=!1)=>{e||C(!0);try{let e=D?{from:void 0,to:void 0}:I===`custom`?{from:c(L?.start),to:c(L?.end,!0)}:Ke(I),t=await ae({status:T===`all`?void 0:T,id:D||void 0,account:k||void 0,api_key:A||void 0,model:M||void 0,provider:N||void 0,stream:P===`all`?void 0:P===`stream`,error_kind:F===`all`?void 0:F,from:e.from,to:e.to,limit:z,offset:(Q-1)*z});mt(t.items||[]),ht(t.total||0),w(``)}catch(t){e||w(t instanceof Error?t.message:String(t))}finally{e||(C(!1),Je(!0))}},[T,D,k,A,M,N,P,F,I,L,Q,z]),Qt=(0,g.useCallback)(async(e=!1)=>{e||C(!0);try{let e=await re({level:E===`all`?void 0:E,q:O.trim()||void 0,account:j||void 0,limit:B,offset:($-1)*B});gt(e.items||[]),_t(e.total??0),w(``)}catch(t){e||w(t instanceof Error?t.message:String(t))}finally{e||(C(!1),Je(!0))}},[E,O,j,$,B]),$t=(0,g.useCallback)(async(e=!1)=>{x===`requests`?await Zt(e):await Qt(e)},[x,Zt,Qt]);(0,g.useEffect)(()=>{C(!0);let e=x===`runtime`&&O.trim()?280:0,t=window.setTimeout(()=>void $t(!1),e);return()=>window.clearTimeout(t)},[$t,x,O]),(0,g.useEffect)(()=>{if(x!==`runtime`||$!==1)return;let e=window.setInterval(()=>{document.hidden||Qt(!0)},3e3);return()=>window.clearInterval(e)},[x,$,Qt]);let en=H===0?0:(Q-1)*z+1,tn=Math.min(H,Q*z),nn=W===0?0:($-1)*B+1,rn=Math.min(W,$*B),an=(0,g.useMemo)(()=>x===`requests`?e(`logsShownTotal`,{shown:V.length?`${en}–${tn}`:0,total:H}):e(`logsShownTotal`,{shown:U.length?`${nn}–${rn}`:0,total:W}),[x,V.length,U.length,en,tn,H,nn,rn,W,e]);function on(){Qe(``),Xe(`all`),et(``),tt(``),rt(``),it(``),at(`all`),ot(`all`),st(`1h`),ct(null),R(1)}async function sn(e){let t=++q.current;xt(e),Dt(``),Tt(!0),Ct(!0);try{let n=await ne(e.id);if(q.current!==t)return;xt(n)}catch(e){if(q.current!==t)return;Dt(e instanceof Error?e.message:String(e))}finally{q.current===t&&Tt(!1)}}function cn(e){vt(e),bt(!0)}async function ln(){jt(!0),De({id:`logs-clear`,type:`loading`,title:e(`toastClearingLogs`)});try{await ie(),kt(!1),await Zt(!1),De({id:`logs-clear`,type:`success`,title:e(`toastLogsCleared`)})}catch(t){w(t instanceof Error?t.message:String(t)),De({id:`logs-clear`,type:`error`,title:e(`toastFailed`),description:t instanceof Error?t.message:String(t)})}finally{jt(!1)}}let un=S&&(x===`requests`?V.length===0:U.length===0);return S&&!qe?(0,v.jsx)(Ee,{}):(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-4 pb-4`,children:(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x===`requests`?(0,v.jsxs)(te,{size:`sm`,variant:`ghost`,onPress:()=>kt(!0),isDisabled:At||H===0,children:[(0,v.jsx)(o,{size:14}),e(`logsClear`)]}):null,(0,v.jsxs)(te,{size:`sm`,variant:`secondary`,isPending:S,onPress:()=>void $t(!1),children:[(0,v.jsx)(ye,{size:15}),e(`refresh`)]})]})}),Ye?(0,v.jsx)(se,{title:e(`failedLogs`,{msg:Ye})}):null,(0,v.jsxs)(f,{selectedKey:x,onSelectionChange:e=>Ue(String(e)),children:[(0,v.jsx)(f.ListContainer,{className:`w-fit`,children:(0,v.jsxs)(f.List,{children:[(0,v.jsxs)(fe,{id:`requests`,className:`gap-1.5`,children:[(0,v.jsx)(f.Indicator,{className:`transition-none`}),(0,v.jsx)(Se,{size:13}),e(`logsRequests`)]}),(0,v.jsxs)(fe,{id:`runtime`,className:`gap-1.5`,children:[(0,v.jsx)(f.Indicator,{className:`transition-none`}),(0,v.jsx)(Ne,{size:13}),e(`logsRuntime`)]})]})}),(0,v.jsxs)(f.Panel,{id:`requests`,"data-tab-panel":`requests`,className:`space-y-4 pt-5`,children:[(0,v.jsxs)(`div`,{className:`data-toolbar flex flex-col gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,v.jsx)(h,{value:T,onChange:e=>Xe(e),ariaLabel:e(`logsFilterAll`),options:[{id:`all`,label:e(`logsFilterAll`)},{id:`ok`,label:e(`logsFilterOk`)},{id:`incomplete`,label:e(`logsFilterIncomplete`)},{id:`error`,label:e(`logsFilterError`)},{id:`canceled`,label:e(`logsFilterCanceled`)}]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Ht?(0,v.jsx)(te,{size:`sm`,variant:`ghost`,onPress:on,children:e(`clearFilters`)}):null,(0,v.jsx)(`div`,{className:`mono text-caption text-muted`,children:an})]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(u,{ariaLabel:e(`logsColAccount`),value:k,onChange:et,options:Ft,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(u,{ariaLabel:e(`logsColApiKey`),value:A,onChange:tt,options:Lt,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(u,{ariaLabel:e(`logsColModel`),value:M,onChange:rt,options:Bt,allLabel:e(`logsFilterModelAll`),searchPlaceholder:e(`logsSearchModel`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(je,{ariaLabel:e(`logsColProvider`),value:N,onChange:it,options:zt}),(0,v.jsx)(u,{ariaLabel:e(`logsSearchRequestId`),value:D,onChange:Qe,options:D?[{id:D,label:D}]:[],allLabel:e(`logsFilterIdAll`),searchPlaceholder:e(`logsSearchRequestId`),emptyLabel:e(`logsNoFilterOptions`),loadOptions:Vt,className:`min-w-56`}),(0,v.jsx)(h,{value:P,onChange:e=>at(e),ariaLabel:e(`logsFilterStreamAll`),options:[{id:`all`,label:e(`logsFilterStreamAll`)},{id:`stream`,label:e(`logsStreamYes`)},{id:`sync`,label:e(`logsStreamNo`)}]}),(0,v.jsx)(je,{ariaLabel:e(`errorKind`),value:F===`all`?``:F,onChange:e=>ot(e||`all`),options:[{id:``,label:e(`logsFilterKindAll`)},{id:`quota`,label:e(`logsKindQuota`)},{id:`rate_limit`,label:e(`logsKindRateLimit`)},{id:`auth`,label:e(`logsKindAuth`)},{id:`not_ready`,label:e(`logsKindNotReady`)},{id:`unavailable`,label:e(`logsKindUnavailable`)},{id:`invalid_request`,label:e(`logsKindInvalidRequest`)},{id:`model_not_available`,label:e(`logsKindModelNotAvailable`)}]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:e(`logsTimeRange`)}),(0,v.jsx)(h,{value:I,onChange:e=>st(e),ariaLabel:e(`logsTimeRange`),options:[{id:`all`,label:e(`logsTimeAll`)},{id:`1h`,label:e(`logsTime1h`)},{id:`24h`,label:e(`logsTime24h`)},{id:`7d`,label:e(`logsTime7d`)},{id:`custom`,label:e(`logsTimeCustom`)}]}),I===`custom`?(0,v.jsx)(oe,{className:`w-[min(100%,42rem)]`,value:L,onChange:ct,ariaLabel:e(`logsTimeRange`),fromLabel:e(`logsTimeFrom`),toLabel:e(`logsTimeTo`)}):null]})]}),(0,v.jsx)(ue,{className:`overflow-hidden p-0`,"aria-busy":S,children:un?(0,v.jsx)(we,{}):V.length===0?(0,v.jsx)(de,{icon:(0,v.jsx)(r,{size:22}),title:e(Ht?`logsNoMatch`:`logsEmptyRequests`),action:Ht?(0,v.jsx)(te,{size:`sm`,variant:`ghost`,onPress:on,children:e(`clearFilters`)}):null}):(0,v.jsx)(p,{children:(0,v.jsx)(p.ScrollContainer,{children:(0,v.jsxs)(p.Content,{"aria-label":e(`logsRequests`),children:[(0,v.jsxs)(p.Header,{children:[(0,v.jsx)(p.Column,{isRowHeader:!0,children:e(`logsColTime`)}),(0,v.jsx)(p.Column,{children:e(`logsColModel`)}),(0,v.jsx)(p.Column,{children:e(`logsColReasoning`)}),(0,v.jsx)(p.Column,{children:e(`logsColProvider`)}),(0,v.jsx)(p.Column,{children:e(`logsColAccount`)}),(0,v.jsx)(p.Column,{children:e(`logsColApiKey`)}),(0,v.jsx)(p.Column,{children:e(`logsColStatus`)}),(0,v.jsx)(p.Column,{children:e(`logsColStream`)}),(0,v.jsx)(p.Column,{children:e(`logsColLatency`)}),(0,v.jsx)(p.Column,{children:e(`logsColTokens`)})]}),(0,v.jsx)(p.Body,{children:V.map(n=>(0,v.jsxs)(p.Row,{className:`cursor-pointer`,onAction:()=>void sn(n),children:[(0,v.jsx)(p.Cell,{children:(0,v.jsxs)(`div`,{className:`py-1`,children:[(0,v.jsx)(`div`,{className:`mono text-xs`,children:y(n.created_at,t)}),(0,v.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.id})]})}),(0,v.jsxs)(p.Cell,{children:[(0,v.jsx)(`div`,{className:`text-body font-medium`,children:n.requested_model||`—`}),n.mapped_model&&n.mapped_model!==n.requested_model?(0,v.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.mapped_model}):null]}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`mono text-xs`,children:Le(n)||`—`})}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`text-xs`,children:Nt(n)})}),(0,v.jsxs)(p.Cell,{children:[(0,v.jsx)(`span`,{className:`text-xs`,children:n.account_id?Z.get(n.account_id)||n.account_id:`—`}),n.account_id&&Z.get(n.account_id)&&Z.get(n.account_id)!==n.account_id?(0,v.jsx)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:n.account_id}):null]}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`text-xs`,children:Rt(n)})}),(0,v.jsxs)(p.Cell,{children:[(0,v.jsx)(be,{size:`sm`,variant:`soft`,color:Pe(n.status),children:n.status}),n.error_kind?(0,v.jsx)(`div`,{className:`mono mt-1 text-caption text-muted`,children:n.error_kind}):null]}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(`span`,{className:`text-xs text-muted`,children:n.stream?e(`logsStreamYes`):e(`logsStreamNo`)})}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(Ae,{latencyMs:n.latency_ms,ttfbMs:n.ttfb_ms,completionTokens:n.completion_tokens,stream:n.stream,labels:{ttft:e(`logsColTTFT`),total:e(`logsLatencyTotal`),tps:e(`logsOutputTPS`)}})}),(0,v.jsx)(p.Cell,{children:(0,v.jsx)(Re,{log:n,inLabel:e(`logsTokensIn`),outLabel:e(`logsTokensOut`),pointsLabel:t=>e(`logsTokensPoints`,{value:t})})})]},n.id))})]})})})}),(0,v.jsx)(i,{total:H,page:Q,pageCount:Yt,pageSize:z,loading:S,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:Q,pages:Yt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:R,onPageSize:ut})]}),(0,v.jsxs)(f.Panel,{id:`runtime`,"data-tab-panel":`runtime`,className:`space-y-4 pt-5`,children:[(0,v.jsxs)(`div`,{className:`data-toolbar flex flex-wrap items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(a,{className:`sm:w-72`,value:O,onChange:$e,placeholder:e(`logsSearchRuntime`),ariaLabel:e(`logsSearchRuntime`)}),(0,v.jsx)(u,{ariaLabel:e(`logsColAccount`),value:j,onChange:nt,options:Ft,allLabel:e(`logsFilterAccountAll`),searchPlaceholder:e(`logsSearchAccount`),emptyLabel:e(`logsNoFilterOptions`)}),(0,v.jsx)(h,{value:E,onChange:e=>Ze(e),ariaLabel:e(`logsLevelAll`),options:[{id:`all`,label:e(`logsLevelAll`)},{id:`info`,label:e(`logsLevelInfo`)},{id:`warn`,label:e(`logsLevelWarn`)},{id:`error`,label:e(`logsLevelError`)}]})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted`,children:[$===1?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`status-dot`,"data-state":`ok`}),e(`logsAutoRefresh`)]}):null,(0,v.jsx)(`span`,{className:`mono`,children:an})]})]}),(0,v.jsx)(ue,{className:`overflow-hidden p-0`,"aria-busy":S,children:un?(0,v.jsx)(Te,{}):U.length===0?(0,v.jsx)(de,{icon:(0,v.jsx)(Ne,{size:22}),title:e(`logsEmptyRuntime`)}):(0,v.jsx)(`div`,{className:`divide-y divide-separator`,children:U.map(e=>(0,v.jsxs)(`div`,{className:`grid cursor-pointer gap-2 px-5 py-3 transition-colors hover:bg-surface-secondary/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:grid-cols-[150px_72px_minmax(0,1fr)] sm:items-start`,role:`button`,tabIndex:0,onClick:()=>cn(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),cn(e))},children:[(0,v.jsx)(`div`,{className:`mono text-caption text-muted`,children:y(e.time,t)}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,v.jsx)(`span`,{className:`status-dot`,"data-state":Fe(e.level)}),(0,v.jsx)(`span`,{className:`font-medium text-muted`,children:e.level})]}),(0,v.jsxs)(`div`,{className:`min-w-0`,children:[e.account_id?(0,v.jsx)(`div`,{className:`mono mb-1 text-caption text-muted`,children:e.account_id}):null,(0,v.jsx)(`div`,{className:`mono break-all text-xs leading-5 text-foreground`,children:e.message})]})]},e.id))})}),(0,v.jsx)(i,{total:W,page:$,pageCount:Xt,pageSize:B,loading:S,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:$,pages:Xt}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:ft,onPageSize:pt})]})]}),(0,v.jsx)(d.Root,{isOpen:yt,onOpenChange:e=>{bt(e),e||vt(null)},children:(0,v.jsx)(d.Backdrop,{variant:`blur`,children:(0,v.jsx)(d.Container,{size:`lg`,scroll:`inside`,children:(0,v.jsxs)(d.Dialog,{className:`w-full max-w-4xl`,children:[(0,v.jsxs)(d.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(d.Heading,{className:`text-section font-semibold`,children:e(`logsRuntimeDetailTitle`)}),(0,v.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:G?`#${G.id}`:`—`})]}),(0,v.jsx)(d.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,v.jsx)(xe,{size:16})})]}),(0,v.jsxs)(d.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,v.jsx)(`dl`,{className:`grid gap-3 sm:grid-cols-2`,children:[[e(`logsColTime`),G?y(G.time,t):`—`],[e(`logsRuntimeLevel`),G?.level||`—`],[e(`logsRuntimeSource`),G?.source||`—`],[e(`logsColAccount`),G?.account_id||`—`]].map(([t,n])=>(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`dt`,{className:`text-caption text-muted`,children:t}),(0,v.jsx)(`dd`,{className:`mt-1 break-all text-body font-medium`,children:t===e(`logsRuntimeLevel`)&&G?(0,v.jsx)(be,{size:`sm`,variant:`soft`,color:Ie(G.level),children:G.level}):n})]},String(t)))}),(0,v.jsxs)(`section`,{className:`space-y-2`,children:[(0,v.jsx)(`div`,{className:`text-xs font-medium text-muted`,children:e(`logsRuntimeMessage`)}),(0,v.jsx)(`pre`,{className:`mono max-h-[min(38rem,60vh)] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-secondary px-4 py-3 text-xs leading-6 text-foreground`,children:G?.message||`—`})]})]})]})})})}),(0,v.jsx)(d.Root,{isOpen:St,onOpenChange:e=>{Ct(e),e||(q.current+=1,Tt(!1),Dt(``),xt(null))},children:(0,v.jsx)(d.Backdrop,{variant:`blur`,children:(0,v.jsx)(d.Container,{size:`lg`,scroll:`inside`,children:(0,v.jsxs)(d.Dialog,{className:`w-full max-w-4xl`,children:[(0,v.jsxs)(d.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(d.Heading,{className:`text-section font-semibold`,children:e(`logsDetailTitle`)}),(0,v.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:K?.id})]}),(0,v.jsx)(d.CloseTrigger,{"aria-label":e(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,v.jsx)(xe,{size:16})})]}),(0,v.jsx)(d.Body,{className:`space-y-5 px-5 pb-5`,children:wt?(0,v.jsx)(ze,{}):Et?(0,v.jsx)(se,{title:e(`requestFailed`),description:Et}):K?(0,v.jsxs)(v.Fragment,{children:[K.error_message?(0,v.jsx)(se,{title:K.error_kind||e(`requestFailed`),description:K.error_message}):null,(0,v.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-secondary px-4 py-4`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,v.jsx)(be,{size:`sm`,variant:`soft`,color:Pe(K.status),children:K.status||`—`}),(0,v.jsx)(`span`,{className:`mono min-w-0 break-all text-body font-medium`,children:K.requested_model||`—`}),K.mapped_model&&K.mapped_model!==K.requested_model?(0,v.jsxs)(`span`,{className:`mono break-all text-caption text-muted`,children:[`→ `,K.mapped_model]}):null,Le(K)?(0,v.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`· `,Le(K)]}):null,(0,v.jsx)(`span`,{className:`mono ml-auto text-caption text-muted`,children:y(K.created_at,t)})]}),(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{mono:!0,label:`${e(`logsColTokens`)} · ${e(`logsTokensIn`)} / ${e(`logsTokensOut`)}`,value:K.prompt_tokens==null&&K.completion_tokens==null?`—`:`${K.prompt_tokens??0} / ${K.completion_tokens??0}`}),(K.credits??K.usage_detail?.credit)==null?null:(0,v.jsx)(b,{mono:!0,label:e(`logsCreditConsumed`),value:`${Ve(K.credits??K.usage_detail?.credit)}${K.usage_detail?.unit?` ${K.usage_detail.unit}`:``}`}),(0,v.jsx)(b,{mono:!0,label:e(`logsColTTFT`),value:he(K.ttfb_ms)}),(0,v.jsx)(b,{mono:!0,label:e(`logsLatencyTotal`),value:he(K.latency_ms)}),(0,v.jsx)(b,{mono:!0,label:e(`logsOutputTPS`),value:pe(ge({completionTokens:K.completion_tokens,latencyMs:K.latency_ms,ttfbMs:K.ttfb_ms,stream:K.stream}))})]})]}),(0,v.jsx)(Be,{title:e(`logsSectionCall`),children:(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{label:e(`logsColProvider`),value:Nt(K)}),(0,v.jsx)(b,{label:e(`logsColAccount`),value:K.account_id?Z.get(K.account_id)||K.account_id:`—`}),(0,v.jsx)(b,{label:e(`logsColApiKey`),value:Rt(K)}),(0,v.jsx)(b,{label:e(`logsColStream`),value:K.stream?e(`logsStreamYes`):e(`logsStreamNo`)}),(0,v.jsx)(b,{label:e(`logsRouting`),value:Pt(K.routing)})]})}),(0,v.jsx)(Be,{title:e(`logsAttempts`),aside:K.attempts?.length?(0,v.jsx)(`span`,{className:`mono text-caption text-muted`,children:K.attempts.length}):null,children:K.attempts?.length?(0,v.jsx)(`div`,{className:`divide-y divide-separator overflow-hidden rounded-lg bg-surface-secondary`,children:K.attempts.map(e=>(0,v.jsxs)(`div`,{className:`grid grid-cols-[32px_minmax(0,1fr)_auto] items-start gap-x-3 px-3 py-2.5`,children:[(0,v.jsxs)(`div`,{className:`mono pt-0.5 text-caption text-muted`,children:[`#`,e.attempt_index]}),(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.account_id?Z.get(e.account_id)||e.account_id:`—`}),e.error_message?(0,v.jsxs)(`div`,{className:`mt-0.5 break-all text-caption text-muted`,children:[e.error_kind?(0,v.jsx)(`span`,{className:`mono mr-1.5`,children:e.error_kind}):null,e.error_message]}):null]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.latency_ms==null?null:(0,v.jsx)(`span`,{className:`mono text-caption text-muted`,children:he(e.latency_ms)}),(0,v.jsx)(be,{size:`sm`,variant:`soft`,color:Pe(e.status===`failover`?`canceled`:e.status),children:e.status})]})]},e.id))}):(0,v.jsx)(`p`,{className:`text-caption text-muted`,children:e(`logsNoAttempts`)})}),K.message_count||K.stream_diagnostic?(0,v.jsx)(Be,{title:e(`logsSectionDiagnostics`),children:(0,v.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-secondary px-4 py-3`,children:[K.message_count?(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:e(`logsMessageShape`)}),(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{mono:!0,label:e(`logsMessageCount`),value:K.message_count}),(0,v.jsx)(b,{mono:!0,label:e(`logsEmptyMessageIndexes`),value:K.empty_message_indexes?.length?K.empty_message_indexes.join(`, `):`—`}),(0,v.jsx)(b,{mono:!0,wide:!0,label:e(`logsMessageRoles`),value:K.message_roles?.join(` → `)||`—`})]})]}):null,K.message_count&&K.stream_diagnostic?(0,v.jsx)(`div`,{className:`border-t border-separator`}):null,K.stream_diagnostic?(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:e(`logsStreamDiagnostics`)}),(0,v.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-3`,children:[(0,v.jsx)(b,{mono:!0,label:e(`logsUpstreamStatus`),value:K.stream_diagnostic.upstream_status??`—`}),(0,v.jsx)(b,{mono:!0,label:e(`logsStreamComplete`),value:K.stream_diagnostic.saw_done?e(`yes`):e(`no`)}),(0,v.jsx)(b,{mono:!0,label:e(`logsCancellationSource`),value:K.stream_diagnostic.cancellation_source||`—`}),(0,v.jsx)(b,{mono:!0,label:e(`logsSSEEvents`),value:K.stream_diagnostic.sse_event_count}),(0,v.jsx)(b,{mono:!0,label:e(`logsBytesRead`),value:me(K.stream_diagnostic.bytes_read)}),(0,v.jsx)(b,{mono:!0,label:e(`logsLastEvent`),value:K.stream_diagnostic.last_event||`—`}),K.stream_diagnostic.context_err?(0,v.jsx)(b,{mono:!0,wide:!0,label:`context`,value:K.stream_diagnostic.context_err}):null,K.stream_diagnostic.relay_error?(0,v.jsx)(b,{mono:!0,wide:!0,label:`relay`,value:K.stream_diagnostic.relay_error}):null]})]}):null]})}):null]}):null})]})})})}),(0,v.jsx)(ce,{isOpen:Ot,title:e(`logsClear`),description:e(`logsClearConfirm`),confirmLabel:e(`logsClear`),cancelLabel:e(`close`),closeLabel:e(`close`),isPending:At,onClose:()=>kt(!1),onConfirm:()=>void ln()})]})}export{S as LogsPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/ModelPoolEditorPage-BncyTHAE.js b/internal/webui/static/assets/ModelPoolEditorPage-BvCs5yNq.js similarity index 73% rename from internal/webui/static/assets/ModelPoolEditorPage-BncyTHAE.js rename to internal/webui/static/assets/ModelPoolEditorPage-BvCs5yNq.js index 19d51685f..7b5d23e61 100644 --- a/internal/webui/static/assets/ModelPoolEditorPage-BncyTHAE.js +++ b/internal/webui/static/assets/ModelPoolEditorPage-BvCs5yNq.js @@ -1,4 +1,4 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./Check.es-DRxeSSF6.js";import{t as i}from"./Plus.es-BPfWzgUg.js";import{t as a}from"./Stack.es-B6AMU1oV.js";import{t as o}from"./TrashSimple.es-CiBYahWn.js";import{t as s}from"./User.es-DHjz-Tbh.js";import{n as c,pt as l,r as u}from"./useI18n-XrvNxGvP.js";import{t as d}from"./label-B8hTan2F.js";import{t as f}from"./PageAlert-BbN7e2aZ.js";import{n as p}from"./useToggle-55_Qx9vA.js";import{t as m}from"./checkbox-CUZk1qce.js";import{t as h}from"./input-CYN6ajmO.js";import{t as g}from"./input-group-CQ3ozQVp.js";import{t as _}from"./number-field-BUGr_bpm.js";import{t as v}from"./search-field-DB17IAvK.js";import{t as y}from"./CompactSwitch-Dd3U4EbK.js";import{_ as b,d as x,m as ee}from"./overview-ARhe2pSk.js";import{t as te}from"./textfield-DAL_YlVh.js";import{It as S,Jt as C,M as ne,Ot as re,Vt as ie,Xt as ae,Yt as w,Zt as oe,m as T,n as se,t as E}from"./index-CAlyInAP.js";import{t as ce}from"./ProviderMark-C49bIWJW.js";import{n as D}from"./provider-BZvt2HHB.js";import{t as O}from"./FilterSelect-CW3ACxo1.js";import{a as le,i as ue,n as de,o as fe,t as pe}from"./modelPools-B7KkTfYF.js";var k=t(e(),1),me=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M112,56V200L40,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z`}))]]),A=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M140,104V64a12,12,0,0,1,24,0V75l35.51-35.52a12,12,0,0,1,17,17L181,92h11a12,12,0,0,1,0,24H152A12,12,0,0,1,140,104Zm-36,36H64a12,12,0,0,0,0,24H75L39.51,199.51a12,12,0,0,0,17,17L92,181v11a12,12,0,0,0,24,0V152A12,12,0,0,0,104,140Zm77,24h11a12,12,0,0,0,0-24H152a12,12,0,0,0-12,12v40a12,12,0,0,0,24,0V181l35.51,35.52a12,12,0,0,0,17-17ZM104,52A12,12,0,0,0,92,64V75L56.49,39.51a12,12,0,0,0-17,17L75,92H64a12,12,0,0,0,0,24h40a12,12,0,0,0,12-12V64A12,12,0,0,0,104,52Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M144,104V64a8,8,0,0,1,16,0V84.69l42.34-42.35a8,8,0,0,1,11.32,11.32L171.31,96H192a8,8,0,0,1,0,16H152A8,8,0,0,1,144,104Zm-40,40H64a8,8,0,0,0,0,16H84.69L42.34,202.34a8,8,0,0,0,11.32,11.32L96,171.31V192a8,8,0,0,0,16,0V152A8,8,0,0,0,104,144Zm67.31,16H192a8,8,0,0,0,0-16H152a8,8,0,0,0-8,8v40a8,8,0,0,0,16,0V171.31l42.34,42.35a8,8,0,0,0,11.32-11.32ZM104,56a8,8,0,0,0-8,8V84.69L53.66,42.34A8,8,0,0,0,42.34,53.66L84.69,96H64a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V64A8,8,0,0,0,104,56Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M144,104V64a8,8,0,0,1,13.66-5.66L172,72.69l30.34-30.35a8,8,0,0,1,11.32,11.32L183.31,84l14.35,14.34A8,8,0,0,1,192,112H152A8,8,0,0,1,144,104Zm-40,40H64a8,8,0,0,0-5.66,13.66L72.69,172,42.34,202.34a8,8,0,0,0,11.32,11.32L84,183.31l14.34,14.35A8,8,0,0,0,112,192V152A8,8,0,0,0,104,144Zm3.06-87.39a8,8,0,0,0-8.72,1.73L84,72.69,53.66,42.34A8,8,0,0,0,42.34,53.66L72.69,84,58.34,98.34A8,8,0,0,0,64,112h40a8,8,0,0,0,8-8V64A8,8,0,0,0,107.06,56.61ZM183.31,172l14.35-14.34A8,8,0,0,0,192,144H152a8,8,0,0,0-8,8v40a8,8,0,0,0,13.66,5.66L172,183.31l30.34,30.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M146,104V64a6,6,0,0,1,12,0V89.51l45.76-45.75a6,6,0,0,1,8.48,8.48L166.48,98H192a6,6,0,0,1,0,12H152A6,6,0,0,1,146,104Zm-42,42H64a6,6,0,0,0,0,12H89.52L43.76,203.76a6,6,0,1,0,8.48,8.48L98,166.48V192a6,6,0,0,0,12,0V152A6,6,0,0,0,104,146Zm62.48,12H192a6,6,0,0,0,0-12H152a6,6,0,0,0-6,6v40a6,6,0,0,0,12,0V166.48l45.76,45.76a6,6,0,0,0,8.48-8.48ZM104,58a6,6,0,0,0-6,6V89.51L52.24,43.76a6,6,0,0,0-8.48,8.48L89.52,98H64a6,6,0,0,0,0,12h40a6,6,0,0,0,6-6V64A6,6,0,0,0,104,58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M144,104V64a8,8,0,0,1,16,0V84.69l42.34-42.35a8,8,0,0,1,11.32,11.32L171.31,96H192a8,8,0,0,1,0,16H152A8,8,0,0,1,144,104Zm-40,40H64a8,8,0,0,0,0,16H84.69L42.34,202.34a8,8,0,0,0,11.32,11.32L96,171.31V192a8,8,0,0,0,16,0V152A8,8,0,0,0,104,144Zm67.31,16H192a8,8,0,0,0,0-16H152a8,8,0,0,0-8,8v40a8,8,0,0,0,16,0V171.31l42.34,42.35a8,8,0,0,0,11.32-11.32ZM104,56a8,8,0,0,0-8,8V84.69L53.66,42.34A8,8,0,0,0,42.34,53.66L84.69,96H64a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V64A8,8,0,0,0,104,56Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M148,104V64a4,4,0,0,1,8,0V94.34l49.17-49.17a4,4,0,1,1,5.66,5.66L161.66,100H192a4,4,0,0,1,0,8H152A4,4,0,0,1,148,104Zm-44,44H64a4,4,0,0,0,0,8H94.34L45.17,205.17a4,4,0,0,0,5.66,5.66L100,161.66V192a4,4,0,0,0,8,0V152A4,4,0,0,0,104,148Zm57.66,8H192a4,4,0,0,0,0-8H152a4,4,0,0,0-4,4v40a4,4,0,0,0,8,0V161.66l49.17,49.17a4,4,0,0,0,5.66-5.66ZM104,60a4,4,0,0,0-4,4V94.34L50.83,45.17a4,4,0,0,0-5.66,5.66L94.34,100H64a4,4,0,0,0,0,8h40a4,4,0,0,0,4-4V64A4,4,0,0,0,104,60Z`}))]]),he=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M236,64a36,36,0,1,0-48,33.94V112a4,4,0,0,1-4,4H96a27.8,27.8,0,0,0-4,.29V97.94a36,36,0,1,0-24,0v60.12a36,36,0,1,0,24,0V144a4,4,0,0,1,4-4h88a28,28,0,0,0,28-28V97.94A36.07,36.07,0,0,0,236,64ZM80,52A12,12,0,1,1,68,64,12,12,0,0,1,80,52Zm0,152a12,12,0,1,1,12-12A12,12,0,0,1,80,204ZM200,76a12,12,0,1,1,12-12A12,12,0,0,1,200,76Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,64a24,24,0,1,1-24-24A24,24,0,0,1,224,64Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192ZM200,80a16,16,0,1,1,16-16A16,16,0,0,1,200,80Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M230,64a30,30,0,1,0-36,29.4V112a10,10,0,0,1-10,10H96a21.84,21.84,0,0,0-10,2.42v-31a30,30,0,1,0-12,0v69.2a30,30,0,1,0,12,0V144a10,10,0,0,1,10-10h88a22,22,0,0,0,22-22V93.4A30.05,30.05,0,0,0,230,64ZM62,64A18,18,0,1,1,80,82,18,18,0,0,1,62,64ZM98,192a18,18,0,1,1-18-18A18,18,0,0,1,98,192ZM200,82a18,18,0,1,1,18-18A18,18,0,0,1,200,82Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192ZM200,80a16,16,0,1,1,16-16A16,16,0,0,1,200,80Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,64a28,28,0,1,0-32,27.71V112a12,12,0,0,1-12,12H96a19.91,19.91,0,0,0-12,4V91.71a28,28,0,1,0-8,0v72.58a28,28,0,1,0,8,0V144a12,12,0,0,1,12-12h88a20,20,0,0,0,20-20V91.71A28,28,0,0,0,228,64ZM60,64A20,20,0,1,1,80,84,20,20,0,0,1,60,64Zm40,128a20,20,0,1,1-20-20A20,20,0,0,1,100,192ZM200,84a20,20,0,1,1,20-20A20,20,0,0,1,200,84Z`}))]]),j=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M156,112a12,12,0,0,1-12,12H80a12,12,0,0,1,0-24h64A12,12,0,0,1,156,112Zm76.49,120.49a12,12,0,0,1-17,0L168,185a92.12,92.12,0,1,1,17-17l47.54,47.53A12,12,0,0,1,232.49,232.49ZM112,180a68,68,0,1,0-68-68A68.08,68.08,0,0,0,112,180Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Zm112,0a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM144,120H80a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M150,112a6,6,0,0,1-6,6H80a6,6,0,0,1,0-12h64A6,6,0,0,1,150,112Zm78.24,116.24a6,6,0,0,1-8.48,0l-51.38-51.38a86.15,86.15,0,1,1,8.48-8.48l51.38,51.38A6,6,0,0,1,228.24,228.24ZM112,186a74,74,0,1,0-74-74A74.09,74.09,0,0,0,112,186Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M148,112a4,4,0,0,1-4,4H80a4,4,0,0,1,0-8h64A4,4,0,0,1,148,112Zm78.83,114.83a4,4,0,0,1-5.66,0l-52.7-52.7a84.1,84.1,0,1,1,5.66-5.66l52.7,52.7A4,4,0,0,1,226.83,226.83ZM112,188a76,76,0,1,0-76-76A76.08,76.08,0,0,0,112,188Z`}))]]),ge=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M156,112a12,12,0,0,1-12,12H124v20a12,12,0,0,1-24,0V124H80a12,12,0,0,1,0-24h20V80a12,12,0,0,1,24,0v20h20A12,12,0,0,1,156,112Zm76.49,120.49a12,12,0,0,1-17,0L168,185a92.12,92.12,0,1,1,17-17l47.54,47.53A12,12,0,0,1,232.49,232.49ZM112,180a68,68,0,1,0-68-68A68.08,68.08,0,0,0,112,180Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Zm112,0a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM144,120H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24a8,8,0,0,1,0,16Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M150,112a6,6,0,0,1-6,6H118v26a6,6,0,0,1-12,0V118H80a6,6,0,0,1,0-12h26V80a6,6,0,0,1,12,0v26h26A6,6,0,0,1,150,112Zm78.24,116.24a6,6,0,0,1-8.48,0l-51.38-51.38a86.15,86.15,0,1,1,8.48-8.48l51.38,51.38A6,6,0,0,1,228.24,228.24ZM112,186a74,74,0,1,0-74-74A74.09,74.09,0,0,0,112,186Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M152,112a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M148,112a4,4,0,0,1-4,4H116v28a4,4,0,0,1-8,0V116H80a4,4,0,0,1,0-8h28V80a4,4,0,0,1,8,0v28h28A4,4,0,0,1,148,112Zm78.83,114.83a4,4,0,0,1-5.66,0l-52.7-52.7a84.1,84.1,0,1,1,5.66-5.66l52.7,52.7A4,4,0,0,1,226.83,226.83ZM112,188a76,76,0,1,0-76-76A76.08,76.08,0,0,0,112,188Z`}))]]),_e=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M208,28H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28Zm-4,24v92H179.31a19.86,19.86,0,0,0-14.14,5.86L147,168H109L90.83,149.86A19.86,19.86,0,0,0,76.69,144H52V52ZM52,204V168H75l18.14,18.14A19.86,19.86,0,0,0,107.31,192h41.38a19.86,19.86,0,0,0,14.14-5.86L181,168h23v36Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,48V160H179.31a8,8,0,0,0-5.66,2.34l-19.31,19.32a8,8,0,0,1-5.66,2.34H107.31a8,8,0,0,1-5.66-2.34L82.34,162.34A8,8,0,0,0,76.68,160H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,16V152h-28.7A15.86,15.86,0,0,0,168,156.69L148.69,176H107.31L88,156.68A15.89,15.89,0,0,0,76.69,152H48V48Zm0,160H48V168H76.69L96,187.32A15.89,15.89,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V168H76.69L96,187.32A15.89,15.89,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M208,34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H208a2,2,0,0,1,2,2V154H179.31a13.94,13.94,0,0,0-9.9,4.1L150.1,177.41a2,2,0,0,1-1.41.59H107.31a2,2,0,0,1-1.41-.58L86.59,158.1a13.94,13.94,0,0,0-9.9-4.1H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V166H76.69a2,2,0,0,1,1.41.58L97.41,185.9a13.94,13.94,0,0,0,9.9,4.1h41.38a13.94,13.94,0,0,0,9.9-4.1l19.31-19.31a2,2,0,0,1,1.41-.59H210v42A2,2,0,0,1,208,210Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,16V152h-28.7A15.86,15.86,0,0,0,168,156.69L148.69,176H107.31L88,156.69A15.86,15.86,0,0,0,76.69,152H48V48Zm0,160H48V168H76.69L96,187.31A15.86,15.86,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M208,36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H208a4,4,0,0,1,4,4V156H179.31a12,12,0,0,0-8.48,3.51l-19.32,19.32a4,4,0,0,1-2.82,1.17H107.31a4,4,0,0,1-2.82-1.17L85.17,159.51A12,12,0,0,0,76.69,156H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V164H76.69a4,4,0,0,1,2.82,1.17l19.32,19.32a12,12,0,0,0,8.48,3.51h41.38a12,12,0,0,0,8.48-3.51l19.32-19.32a4,4,0,0,1,2.82-1.17H212v44A4,4,0,0,1,208,212Z`}))]]),ve=k.forwardRef((e,t)=>k.createElement(l,{ref:t,...e,weights:me}));ve.displayName=`ArrowLeftIcon`;var ye=ve,be=k.forwardRef((e,t)=>k.createElement(l,{ref:t,...e,weights:A}));be.displayName=`ArrowsInIcon`;var xe=be,Se=k.forwardRef((e,t)=>k.createElement(l,{ref:t,...e,weights:he}));Se.displayName=`GitBranchIcon`;var Ce=Se,we=k.forwardRef((e,t)=>k.createElement(l,{ref:t,...e,weights:j}));we.displayName=`MagnifyingGlassMinusIcon`;var Te=we,M=k.forwardRef((e,t)=>k.createElement(l,{ref:t,...e,weights:ge}));M.displayName=`MagnifyingGlassPlusIcon`;var Ee=M,N=k.forwardRef((e,t)=>k.createElement(l,{ref:t,...e,weights:_e}));N.displayName=`TrayIcon`;var De=N,P=n();function F({accounts:e,selected:t,busy:n,t:r,onChange:i}){let[a,o]=(0,k.useState)(``),s=(0,k.useMemo)(()=>new Map(e.map(e=>[e.id,e])),[e]),c=(0,k.useMemo)(()=>new Set(t),[t]),l=(0,k.useMemo)(()=>{let t=a.trim().toLowerCase();return e.filter(e=>!t||`${e.name||``} ${e.id} ${e.region||``}`.toLowerCase().includes(t))},[e,a]),d=t.filter(e=>!s.has(e));function f(e,n){i(n?[...t,e]:t.filter(t=>t!==e))}return(0,P.jsxs)(`div`,{className:`space-y-2`,children:[t.length>0?(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>(0,P.jsxs)(u,{size:`sm`,variant:`secondary`,isDisabled:n,onPress:()=>f(e,!1),children:[(0,P.jsx)(`span`,{className:`max-w-40 truncate`,children:s.get(e)?.name||e}),(0,P.jsx)(re,{size:12})]},e))}):(0,P.jsx)(`p`,{className:`text-caption text-muted`,children:r(`modelPoolAccountsAll`)}),e.length>6?(0,P.jsx)(v,{"aria-label":r(`modelPoolAccountsSearch`),value:a,onChange:o,isDisabled:n,children:(0,P.jsxs)(v.Group,{children:[(0,P.jsx)(v.SearchIcon,{}),(0,P.jsx)(v.Input,{placeholder:r(`modelPoolAccountsSearch`)}),(0,P.jsx)(v.ClearButton,{})]})}):null,(0,P.jsxs)(`div`,{className:`max-h-56 overflow-y-auto overscroll-contain rounded-lg bg-surface-secondary p-1`,children:[d.map(e=>(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-1.5`,children:[(0,P.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-caption text-muted`,children:e}),(0,P.jsx)(u,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:n,"aria-label":r(`modelPoolRemoveSeat`),onPress:()=>f(e,!1),children:(0,P.jsx)(re,{size:14})})]},`missing-${e}`)),l.map(e=>(0,P.jsx)(m,{isSelected:c.has(e.id),isDisabled:n,onChange:t=>f(e.id,t),className:`flex w-full cursor-pointer rounded-md px-2.5 py-1.5 hover:bg-default`,children:(0,P.jsxs)(m.Content,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,P.jsx)(m.Control,{children:(0,P.jsx)(m.Indicator,{})}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`block truncate text-body`,children:e.name||e.id}),(0,P.jsx)(`span`,{className:`mono block truncate text-caption text-muted`,children:e.region||e.id})]})]})},e.id)),e.length===0?(0,P.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:r(`modelPoolNoAccounts`)}):null,e.length>0&&l.length===0?(0,P.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:r(`modelPoolAccountsNoMatch`)}):null]})]})}var I=276,L=128,Oe=64,R=96,ke=.4,Ae=1.7;function je({steps:e,selected:t,strategyTitle:n,strategyLine:r,strategyChips:a,requestTitle:c,requestToken:l,skipped:u,labels:d,describe:f,busy:p,onSelect:m,onSelectStrategy:h,onInsert:g,onMove:_,onRemove:v}){let y=(0,k.useRef)(null),b=(0,k.useRef)({x:220,y:36,k:1}),[x,ee]=(0,k.useState)(b.current),[te,S]=(0,k.useState)(null),[C,ne]=(0,k.useState)(null),[re,ae]=(0,k.useState)(!1),[w,oe]=(0,k.useState)(null),T=(0,k.useRef)(null),se=(0,k.useRef)(C);se.current=C;let E=(0,k.useMemo)(()=>Ie(e,f,u,{requestTitle:c,requestToken:l,strategyTitle:n,strategyLine:r,strategyChips:a,labels:d}),[e,f,u,c,l,n,r,a,d]),D=(0,k.useRef)(E);D.current=E;let O=E.items.map(e=>C?.id===e.id?{...e,x:C.x,y:C.y}:e),le=new Map(O.map(e=>[e.id,e])),ue=E.edges.map(e=>{let[t,n]=e.id.split(`>`),r=le.get(t),i=le.get(n);if(!r||!i)return e;let a=Fe(r,i);return{...e,d:a.d,tagX:a.x,tagY:a.y}}),de=C?.moved?z(E.items,C.id,C.x):w?.over?w.drop:null;function fe(e){b.current=e,ee(e)}function pe(){let e=y.current;if(!e||D.current.items.length===0)return;let t=D.current.items,n=Math.min(...t.map(e=>e.x)),r=Math.min(...t.map(e=>e.y))-28,i=Math.max(...t.map(e=>e.x+I)),a=Math.max(...t.map(e=>e.y+L)),o=e.getBoundingClientRect(),s=Math.max(160,o.width-248-36),c=Math.max(160,o.height-88),l=G(Math.min(s/Math.max(1,i-n),c/Math.max(1,a-r),1),ke,Ae);fe({k:l,x:248+(s-(i-n)*l)/2-n*l,y:28+(c-(a-r)*l)/2-r*l})}let me=(0,k.useRef)(!1),A=(0,k.useRef)(!1),he=(0,k.useRef)(pe);he.current=pe,(0,k.useLayoutEffect)(()=>{me.current||(me.current=!0,pe())}),(0,k.useEffect)(()=>{let e=y.current;if(!e||typeof ResizeObserver>`u`)return;let t=e.clientHeight,n=new ResizeObserver(()=>{A.current||Math.abs(e.clientHeight-t)<8||(t=e.clientHeight,he.current())});return n.observe(e),()=>n.disconnect()},[]),(0,k.useEffect)(()=>{let e=y.current;if(!e)return;let t=t=>{t.preventDefault(),A.current=!0;let n=e.getBoundingClientRect();j(t.deltaY<0?1.08:1/1.08,t.clientX-n.left,t.clientY-n.top)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]),(0,k.useEffect)(()=>{let e=e=>{if(e.target?.closest(`input, textarea, select, [contenteditable="true"]`)||!y.current?.contains(document.activeElement)&&document.activeElement!==document.body)return;let n=D.current.items.find(e=>e.id===t);if(!(!n||n.kind===`request`||n.kind===`strategy`)){if(e.key===`Backspace`||e.key===`Delete`){e.preventDefault(),v(n.id);return}(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),_(n.parentPathId,n.index,n.index+(e.key===`ArrowLeft`?-1:1)))}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_,v,t]);function j(e,t,n){let r=b.current,i=G(r.k*e,ke,Ae),a=(t-r.x)/r.k,o=(n-r.y)/r.k;fe({k:i,x:t-a*i,y:n-o*i})}function ge(e,t){let n=y.current?.getBoundingClientRect(),r=b.current;return{x:(e-(n?.left??0)-r.x)/r.k,y:(t-(n?.top??0)-r.y)/r.k}}function _e(e,t){let n=t.getBoundingClientRect(),r=y.current?.getBoundingClientRect(),i=r?.width??0,a=r?.height??0,o=n.left-(r?.left??0),s=n.bottom-(r?.top??0)+8;s+150>a&&(s=n.top-(r?.top??0)-150),o+188>i&&(o=i-196),S({parentPathId:e,x:Math.max(8,o),y:Math.max(8,s)})}function ve(e){if(e.button!==0)return;let t=e.target;if(t.closest(`button, a, input, textarea`))return;let n=t.closest(`[data-node]`),r=n?le.get(n.dataset.node||``):void 0;if(y.current?.focus({preventScroll:!0}),e.currentTarget.setPointerCapture(e.pointerId),r&&r.kind!==`request`&&r.kind!==`strategy`){T.current={type:`node`,sx:e.clientX,sy:e.clientY,ox:r.x,oy:r.y,id:r.id,moved:!1};return}if(r){T.current={type:`pan`,sx:e.clientX,sy:e.clientY,ox:b.current.x,oy:b.current.y,id:r.id,moved:!1};return}T.current={type:`pan`,sx:e.clientX,sy:e.clientY,ox:b.current.x,oy:b.current.y,moved:!1},S(null)}function ye(e){let t=T.current;if(!t)return;let n=e.clientX-t.sx,r=e.clientY-t.sy;if(!(!t.moved&&Math.hypot(n,r)<4)){if(t.moved=!0,t.type===`pan`){A.current=!0,ae(!0),fe({...b.current,x:t.ox+n,y:t.oy+r});return}if(t.id){let e=b.current.k||1,i={id:t.id,x:t.ox+n/e,y:t.oy+r/e,moved:!0};se.current=i,ne(i)}}}function be(){let e=T.current;if(T.current=null,ae(!1),e){if(e.type===`node`&&e.id){let t=E.items.find(t=>t.id===e.id),n=se.current;if(t&&e.moved&&n){let e=z(E.items,t.id,n.x);e&&e.index!==t.index&&_(t.parentPathId,t.index,e.index)}else t&&!e.moved&&m(t.id)}else!e.moved&&e.id&&(e.id===`strategy`||e.id===`request`)&&h();se.current=null,ne(null)}}function Se(e,n){if(n.button!==0||p)return;n.stopPropagation();let r={kind:e,sx:n.clientX,sy:n.clientY,id:n.pointerId,started:!1},i=(t,n,r)=>{let i=y.current?.getBoundingClientRect(),a=ge(t,n),o=r?Ne(D.current.items,a.x,a.y):null;oe({kind:e,x:t-(i?.left??0),y:n-(i?.top??0),over:r,drop:o})},a=e=>{if(e.pointerId!==r.id||!r.started&&Math.hypot(e.clientX-r.sx,e.clientY-r.sy)<5)return;r.started=!0;let t=y.current?.getBoundingClientRect(),n=y.current?.querySelector(`.dg-pal`)?.getBoundingClientRect(),a=!!t&&e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom,o=!!n&&e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom;i(e.clientX,e.clientY,a&&!o)},o=n=>{if(n.pointerId!==r.id)return;window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o);let i=y.current?.getBoundingClientRect(),s=y.current?.querySelector(`.dg-pal`)?.getBoundingClientRect(),c=!!i&&n.clientX>=i.left&&n.clientX<=i.right&&n.clientY>=i.top&&n.clientY<=i.bottom,l=!!s&&n.clientX>=s.left&&n.clientX<=s.right&&n.clientY>=s.top&&n.clientY<=s.bottom;if(!r.started)g(Me(D.current.items,t),e);else if(n.type!==`pointercancel`&&c&&!l){let t=ge(n.clientX,n.clientY),r=Ne(D.current.items,t.x,t.y);g(r.parentPathId,e,r.index)}oe(null)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,o)}let Ce=22*x.k;return(0,P.jsxs)(`div`,{className:`dg-wf`,children:[(0,P.jsx)(`style`,{children:ze}),(0,P.jsxs)(`div`,{ref:y,className:`dg-vp`,tabIndex:0,"data-panning":re?``:void 0,onPointerDown:ve,onPointerMove:ye,onPointerUp:be,onPointerCancel:be,style:{backgroundPosition:`${x.x}px ${x.y}px`,backgroundSize:`${Ce}px ${Ce}px`},children:[(0,P.jsxs)(`div`,{className:`dg-world`,style:{transform:`translate(${x.x}px, ${x.y}px) scale(${x.k})`},children:[(0,P.jsx)(`svg`,{className:`dg-edges`,"aria-hidden":`true`,children:ue.map(e=>(0,P.jsx)(`path`,{className:`dg-edge`,d:e.d},e.id))}),ue.map(e=>e.tag?(0,P.jsx)(`span`,{className:`dg-tag`,style:{left:e.tagX,top:e.tagY},children:e.tag},`${e.id}-tag`):null),de?(0,P.jsx)(`span`,{className:`dg-slot`,style:{left:de.x,top:de.y}}):null,O.map(e=>(0,P.jsxs)(`article`,{"data-node":e.id,"data-kind":e.kind,"data-selected":t===e.id||e.kind===`strategy`&&t===`strategy`?``:void 0,"data-fixed":e.kind===`request`||e.kind===`strategy`?``:void 0,className:`dg-node`,style:{left:e.x,top:e.y,width:I,height:L},title:e.kind===`request`||e.kind===`strategy`?e.title:d.drag,children:[(0,P.jsx)(`span`,{className:`dg-kind`,children:Pe(e.kind,d)}),(0,P.jsxs)(`span`,{className:`dg-head`,children:[(0,P.jsx)(`span`,{className:`dg-tile`,children:e.kind===`member`&&e.provider?(0,P.jsx)(ce,{provider:e.provider,size:14}):V(e.kind)}),(0,P.jsx)(`b`,{children:e.title}),e.chip?(0,P.jsx)(`span`,{className:`dg-chip`,"data-tone":e.tone,children:e.chip}):null]}),e.facts.length>0?(0,P.jsx)(`span`,{className:`dg-facts`,title:e.facts.join(` · `),children:e.facts.map((e,t)=>(0,P.jsx)(`span`,{className:`dg-fact`,children:e},`${t}-${e}`))}):(0,P.jsx)(`span`,{className:`dg-line`,title:e.line,children:e.line}),(0,P.jsx)(`span`,{className:`dg-well`,title:e.chips.length>1?e.chips.map(e=>e.text).join(` · `):void 0,children:e.chips.length>0?(0,P.jsx)(`span`,{className:`dg-chips`,children:H(e.chips).map((e,t)=>(0,P.jsxs)(`span`,{className:`dg-tagchip`,"data-tone":e.tone,title:e.title||e.text,children:[e.tone===`model`?(0,P.jsx)(ie,{size:10}):e.tone===`account`?(0,P.jsx)(s,{size:10}):null,(0,P.jsx)(`span`,{children:e.text})]},`${e.tone}-${t}`))}):(0,P.jsx)(`span`,{className:`dg-mono`,children:e.well||`—`})}),e.kind===`request`?null:(0,P.jsx)(`span`,{className:`dg-port dg-port-in`}),e.ports.map(e=>(0,P.jsx)(`span`,{className:`dg-port dg-port-out`,style:{left:`${e*100}%`}},e)),e.kind!==`request`&&e.kind!==`strategy`?(0,P.jsx)(`button`,{type:`button`,className:`dg-x`,"aria-label":d.remove,disabled:p,onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),v(e.id)},children:(0,P.jsx)(o,{size:12})}):null]},e.id)),E.adds.map(e=>(0,P.jsx)(`button`,{type:`button`,className:`dg-add`,"data-place":e.place,style:{left:e.x-11,top:e.y-11},"aria-label":d.add,disabled:p,onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),_e(e.parentPathId,t.currentTarget)},children:(0,P.jsx)(i,{size:12,weight:`bold`})},e.key))]}),(0,P.jsxs)(`aside`,{className:`dg-pal`,onPointerDown:e=>e.stopPropagation(),children:[(0,P.jsx)(`p`,{className:`dg-pal-title`,children:d.palette}),(0,P.jsx)(`p`,{className:`dg-pal-hint`,children:d.hint}),[[`member`,d.model,d.modelLine],[`group`,d.group,d.groupLine],[`branch`,d.intent,d.intentLine]].map(([e,t,n])=>(0,P.jsxs)(`button`,{type:`button`,className:`dg-pal-item`,disabled:p,onPointerDown:t=>Se(e,t),children:[(0,P.jsx)(`span`,{className:`dg-tile`,"data-kind":e,children:V(e)}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`b`,{children:t}),(0,P.jsx)(`small`,{children:n})]})]},e))]}),te?(0,P.jsx)(`div`,{className:`dg-menu`,style:{left:te.x,top:te.y},onPointerDown:e=>e.stopPropagation(),children:[[`member`,d.model],[`group`,d.group],[`branch`,d.intent]].map(([e,t])=>(0,P.jsxs)(`button`,{type:`button`,disabled:p,onClick:()=>{g(te.parentPathId,e),S(null)},children:[(0,P.jsx)(`span`,{className:`dg-tile`,"data-kind":e,children:V(e)}),t]},e))}):null,w?(0,P.jsxs)(`div`,{className:`dg-ghost`,"data-over":w.over?``:void 0,style:{left:w.x,top:w.y},children:[(0,P.jsx)(`span`,{className:`dg-kind`,children:Pe(w.kind,d)}),(0,P.jsxs)(`span`,{className:`dg-head`,children:[(0,P.jsx)(`span`,{className:`dg-tile`,"data-kind":w.kind,children:V(w.kind)}),(0,P.jsx)(`b`,{children:Pe(w.kind,d)})]})]}):null,(0,P.jsxs)(`div`,{className:`dg-tb`,onPointerDown:e=>e.stopPropagation(),children:[(0,P.jsx)(`button`,{type:`button`,"aria-label":d.zoomOut,onClick:()=>{A.current=!0;let e=y.current?.getBoundingClientRect();j(1/1.12,(e?.width??0)/2,(e?.height??0)/2)},children:(0,P.jsx)(Te,{size:15})}),(0,P.jsxs)(`button`,{type:`button`,className:`dg-zoom`,onClick:()=>{A.current=!0,j(1/b.current.k,(y.current?.clientWidth??0)/2,(y.current?.clientHeight??0)/2)},children:[Math.round(x.k*100),`%`]}),(0,P.jsx)(`button`,{type:`button`,"aria-label":d.zoomIn,onClick:()=>{A.current=!0;let e=y.current?.getBoundingClientRect();j(1.12,(e?.width??0)/2,(e?.height??0)/2)},children:(0,P.jsx)(Ee,{size:15})}),(0,P.jsx)(`i`,{}),(0,P.jsx)(`button`,{type:`button`,"aria-label":d.fit,onClick:pe,children:(0,P.jsx)(xe,{size:15})})]})]})]})}function Me(e,t){let n=e.find(e=>e.id===t);return!n||n.kind===`request`||n.kind===`strategy`?null:n.parentPathId}function z(e,t,n){let r=e.find(e=>e.id===t);if(!r)return null;let i=e.filter(e=>e.id!==t&&e.parentPathId===r.parentPathId&&e.from===r.from).sort((e,t)=>e.x-t.x),a=i.filter(e=>e.x+I/2e.kind!==`request`&&e.kind!==`strategy`),i=new Map;for(let e of r){let t=e.parentPathId??`*`,n=i.get(t)??[];n.push(e),i.set(t,n)}let a=null;for(let[e,t]of i){let r=t[0]?.y??0,i=Math.abs(n-(r+L/2));i>L||(!a||ie.x+I/2e.x-t.x),i=r[0]?.y??0;return r.length===0?{x:n,y:i}:t<=0?{x:r[0].x-18,y:i}:t>=r.length?{x:r[r.length-1].x+I+18,y:i}:{x:(r[t-1].x+I+r[t].x)/2,y:i}}function Pe(e,t){return e===`request`?t.request:e===`strategy`?t.strategyKind:e===`group`?t.group:e===`branch`?t.intent:t.model}function V(e){return e===`strategy`?(0,P.jsx)(S,{size:14}):e===`group`?(0,P.jsx)(a,{size:14}):e===`branch`?(0,P.jsx)(Ce,{size:14}):e===`request`?(0,P.jsx)(De,{size:14}):(0,P.jsx)(ie,{size:14})}function Fe(e,t){let n=e.x+I*(t.port||.5),r=e.y+L,i=t.x+I/2,a=t.y,o=Math.max(32,Math.abs(a-r)*.45),s=r+o,c=a-o,l=.42,u=.5800000000000001,d=u**3*n+3*u**2*l*n+3*u*l**2*i+l**3*i,f=u**3*r+3*u**2*l*s+3*u*l**2*c+l**3*a;return{d:`M ${n} ${r} C ${n} ${s}, ${i} ${c}, ${i} ${a}`,x:d,y:f}}function H(e){return e.length<=3?e:[e[0],e[1],{text:`+${e.length-2}`,tone:`more`,title:e.slice(2).map(e=>e.text).join(`, `)}]}function Ie(e,t,n,r){let i=W(e,0,448,`strategy`,.5,null,t,n,r.labels),a=Math.max(I,i.width),o=Math.max(0,(a-I)/2),s=[{id:`request`,kind:`request`,title:r.requestTitle,line:r.labels.requestLine,well:r.labels.request,chip:``,tone:`index`,chips:r.requestToken?[{text:r.requestToken,tone:`plain`}]:[],facts:[],x:o,y:0,parentPathId:null,index:0,from:null,port:.5,ports:[.5]},{id:`strategy`,kind:`strategy`,title:r.strategyTitle,line:r.strategyLine,well:r.labels.strategyKind,chip:``,tone:`index`,chips:r.strategyChips??[],facts:[],x:o,y:224,parentPathId:null,index:0,from:`request`,port:.5,ports:[.5]},...i.items],c=i.width>0?{key:`root`,parentPathId:null,x:i.width+36,y:512,place:`end`}:{key:`root`,parentPathId:null,x:o+I/2,y:380,place:`under`},l=s.flatMap(t=>{if(!t.from)return[];let n=s.find(e=>e.id===t.from);if(!n)return[];let r=Fe(n,t),i=U(e,t);return[{id:`${n.id}>${t.id}`,d:r.d,tag:i,tagX:r.x,tagY:r.y}]});return{items:s,adds:[c,...i.adds],edges:l,width:a,height:i.height}}function U(e,t){if(!t.parentPathId)return;let n=Le(e,t.parentPathId);if(n)return n.steps[0]?.id===t.id?n.label:void 0}function Le(e,t){for(let n of e)for(let e of n.paths??[]){if(e.id===t)return e;let n=Le(e.steps,t);if(n)return n}return null}function W(e,t,n,r,i,a,o,s,c){let l=t,u=n+L,d=[],f=[];return e.forEach((e,t)=>{let p=o(e),m=e.kind,h=I,g=[];if(e.kind===`branch`){let t=e.paths??[],r=l,i=n+L+R;t.forEach((n,a)=>{let l=(a+1)/(t.length+1),d=W(n.steps,r,i,e.id,l,n.id,o,s,c);g.push(...d.items),f.push(...d.adds);let p=Math.max(d.width,I);d.items.some(t=>t.parentPathId===n.id&&t.from===e.id)&&f.push({key:n.id,parentPathId:n.id,x:r+p+36,y:i+L/2,place:`end`}),r+=p+Oe,u=Math.max(u,d.height)}),h=Math.max(I,r-l-Oe)}let _=l+(h-I)/2;if(d.push({id:e.id,kind:m,title:p.title,line:p.detail,well:p.note,chips:p.chips??[],facts:p.facts??[],...Re(e,t,s,c),provider:e.provider,x:_,y:n,parentPathId:a,index:t,from:r,port:i,ports:e.kind===`branch`?(e.paths??[]).map((e,t,n)=>(t+1)/(n.length+1)):[]}),e.kind===`branch`){let t=e.paths??[];t.forEach((r,i)=>{if(g.some(t=>t.parentPathId===r.id&&t.from===e.id))return;let a=(i+1)/(t.length+1);f.push({key:r.id,parentPathId:r.id,x:_+I*a,y:n+L+28,place:`under`})})}d.push(...g),l+=h+Oe}),{items:d,width:Math.max(0,l-t-(e.length?Oe:0)),height:u,adds:f}}function Re(e,t,n,r){return n?.[e.id]?{chip:r.skipped,tone:`skip`}:(e.kind===`member`?!e.provider||!e.model:e.kind===`group`&&!e.aggregation_id)?{chip:r.incomplete,tone:`warn`}:{chip:String(t+1).padStart(2,`0`),tone:`index`}}function G(e,t,n){return Math.min(n,Math.max(t,e))}var ze=` +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./Check.es-D8gUNq6Q.js";import{t as i}from"./Plus.es-DsoFTrCh.js";import{t as a}from"./Stack.es-BNgbK5ij.js";import{t as o}from"./TrashSimple.es-KG9lGXYp.js";import{t as s}from"./User.es-DHwtE-a6.js";import{n as c,pt as l,r as u}from"./useI18n-BAo1UrJW.js";import{t as d}from"./label-DYYRLGoV.js";import{t as f}from"./PageAlert-4fxVtrfI.js";import{n as p}from"./useToggle-DpH7h_oD.js";import{t as m}from"./checkbox-BfdndRMW.js";import{t as h}from"./input-BwBv1RBO.js";import{t as g}from"./input-group-DuDWER0-.js";import{t as _}from"./number-field-BQgq-gwR.js";import{t as v}from"./search-field-DRk4_q5c.js";import{t as y}from"./CompactSwitch-D0aW-Phm.js";import{_ as b,d as x,m as ee}from"./overview-ARhe2pSk.js";import{t as te}from"./textfield-CjoS-G9O.js";import{It as S,Jt as C,M as ne,Ot as re,Vt as ie,Xt as ae,Yt as w,Zt as oe,m as T,n as se,t as E}from"./index-CWTBzWuK.js";import{t as ce}from"./ProviderMark-C49bIWJW.js";import{n as D}from"./provider-BZvt2HHB.js";import{t as O}from"./FilterSelect-qchbu2Tk.js";import{a as le,i as ue,n as de,o as fe,t as pe}from"./modelPools-B7KkTfYF.js";var k=t(e(),1),me=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M112,56V200L40,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z`}))]]),A=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M140,104V64a12,12,0,0,1,24,0V75l35.51-35.52a12,12,0,0,1,17,17L181,92h11a12,12,0,0,1,0,24H152A12,12,0,0,1,140,104Zm-36,36H64a12,12,0,0,0,0,24H75L39.51,199.51a12,12,0,0,0,17,17L92,181v11a12,12,0,0,0,24,0V152A12,12,0,0,0,104,140Zm77,24h11a12,12,0,0,0,0-24H152a12,12,0,0,0-12,12v40a12,12,0,0,0,24,0V181l35.51,35.52a12,12,0,0,0,17-17ZM104,52A12,12,0,0,0,92,64V75L56.49,39.51a12,12,0,0,0-17,17L75,92H64a12,12,0,0,0,0,24h40a12,12,0,0,0,12-12V64A12,12,0,0,0,104,52Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M144,104V64a8,8,0,0,1,16,0V84.69l42.34-42.35a8,8,0,0,1,11.32,11.32L171.31,96H192a8,8,0,0,1,0,16H152A8,8,0,0,1,144,104Zm-40,40H64a8,8,0,0,0,0,16H84.69L42.34,202.34a8,8,0,0,0,11.32,11.32L96,171.31V192a8,8,0,0,0,16,0V152A8,8,0,0,0,104,144Zm67.31,16H192a8,8,0,0,0,0-16H152a8,8,0,0,0-8,8v40a8,8,0,0,0,16,0V171.31l42.34,42.35a8,8,0,0,0,11.32-11.32ZM104,56a8,8,0,0,0-8,8V84.69L53.66,42.34A8,8,0,0,0,42.34,53.66L84.69,96H64a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V64A8,8,0,0,0,104,56Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M144,104V64a8,8,0,0,1,13.66-5.66L172,72.69l30.34-30.35a8,8,0,0,1,11.32,11.32L183.31,84l14.35,14.34A8,8,0,0,1,192,112H152A8,8,0,0,1,144,104Zm-40,40H64a8,8,0,0,0-5.66,13.66L72.69,172,42.34,202.34a8,8,0,0,0,11.32,11.32L84,183.31l14.34,14.35A8,8,0,0,0,112,192V152A8,8,0,0,0,104,144Zm3.06-87.39a8,8,0,0,0-8.72,1.73L84,72.69,53.66,42.34A8,8,0,0,0,42.34,53.66L72.69,84,58.34,98.34A8,8,0,0,0,64,112h40a8,8,0,0,0,8-8V64A8,8,0,0,0,107.06,56.61ZM183.31,172l14.35-14.34A8,8,0,0,0,192,144H152a8,8,0,0,0-8,8v40a8,8,0,0,0,13.66,5.66L172,183.31l30.34,30.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M146,104V64a6,6,0,0,1,12,0V89.51l45.76-45.75a6,6,0,0,1,8.48,8.48L166.48,98H192a6,6,0,0,1,0,12H152A6,6,0,0,1,146,104Zm-42,42H64a6,6,0,0,0,0,12H89.52L43.76,203.76a6,6,0,1,0,8.48,8.48L98,166.48V192a6,6,0,0,0,12,0V152A6,6,0,0,0,104,146Zm62.48,12H192a6,6,0,0,0,0-12H152a6,6,0,0,0-6,6v40a6,6,0,0,0,12,0V166.48l45.76,45.76a6,6,0,0,0,8.48-8.48ZM104,58a6,6,0,0,0-6,6V89.51L52.24,43.76a6,6,0,0,0-8.48,8.48L89.52,98H64a6,6,0,0,0,0,12h40a6,6,0,0,0,6-6V64A6,6,0,0,0,104,58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M144,104V64a8,8,0,0,1,16,0V84.69l42.34-42.35a8,8,0,0,1,11.32,11.32L171.31,96H192a8,8,0,0,1,0,16H152A8,8,0,0,1,144,104Zm-40,40H64a8,8,0,0,0,0,16H84.69L42.34,202.34a8,8,0,0,0,11.32,11.32L96,171.31V192a8,8,0,0,0,16,0V152A8,8,0,0,0,104,144Zm67.31,16H192a8,8,0,0,0,0-16H152a8,8,0,0,0-8,8v40a8,8,0,0,0,16,0V171.31l42.34,42.35a8,8,0,0,0,11.32-11.32ZM104,56a8,8,0,0,0-8,8V84.69L53.66,42.34A8,8,0,0,0,42.34,53.66L84.69,96H64a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V64A8,8,0,0,0,104,56Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M148,104V64a4,4,0,0,1,8,0V94.34l49.17-49.17a4,4,0,1,1,5.66,5.66L161.66,100H192a4,4,0,0,1,0,8H152A4,4,0,0,1,148,104Zm-44,44H64a4,4,0,0,0,0,8H94.34L45.17,205.17a4,4,0,0,0,5.66,5.66L100,161.66V192a4,4,0,0,0,8,0V152A4,4,0,0,0,104,148Zm57.66,8H192a4,4,0,0,0,0-8H152a4,4,0,0,0-4,4v40a4,4,0,0,0,8,0V161.66l49.17,49.17a4,4,0,0,0,5.66-5.66ZM104,60a4,4,0,0,0-4,4V94.34L50.83,45.17a4,4,0,0,0-5.66,5.66L94.34,100H64a4,4,0,0,0,0,8h40a4,4,0,0,0,4-4V64A4,4,0,0,0,104,60Z`}))]]),he=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M236,64a36,36,0,1,0-48,33.94V112a4,4,0,0,1-4,4H96a27.8,27.8,0,0,0-4,.29V97.94a36,36,0,1,0-24,0v60.12a36,36,0,1,0,24,0V144a4,4,0,0,1,4-4h88a28,28,0,0,0,28-28V97.94A36.07,36.07,0,0,0,236,64ZM80,52A12,12,0,1,1,68,64,12,12,0,0,1,80,52Zm0,152a12,12,0,1,1,12-12A12,12,0,0,1,80,204ZM200,76a12,12,0,1,1,12-12A12,12,0,0,1,200,76Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,64a24,24,0,1,1-24-24A24,24,0,0,1,224,64Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192ZM200,80a16,16,0,1,1,16-16A16,16,0,0,1,200,80Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M230,64a30,30,0,1,0-36,29.4V112a10,10,0,0,1-10,10H96a21.84,21.84,0,0,0-10,2.42v-31a30,30,0,1,0-12,0v69.2a30,30,0,1,0,12,0V144a10,10,0,0,1,10-10h88a22,22,0,0,0,22-22V93.4A30.05,30.05,0,0,0,230,64ZM62,64A18,18,0,1,1,80,82,18,18,0,0,1,62,64ZM98,192a18,18,0,1,1-18-18A18,18,0,0,1,98,192ZM200,82a18,18,0,1,1,18-18A18,18,0,0,1,200,82Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M232,64a32,32,0,1,0-40,31v17a8,8,0,0,1-8,8H96a23.84,23.84,0,0,0-8,1.38V95a32,32,0,1,0-16,0v66a32,32,0,1,0,16,0V144a8,8,0,0,1,8-8h88a24,24,0,0,0,24-24V95A32.06,32.06,0,0,0,232,64ZM64,64A16,16,0,1,1,80,80,16,16,0,0,1,64,64ZM96,192a16,16,0,1,1-16-16A16,16,0,0,1,96,192ZM200,80a16,16,0,1,1,16-16A16,16,0,0,1,200,80Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,64a28,28,0,1,0-32,27.71V112a12,12,0,0,1-12,12H96a19.91,19.91,0,0,0-12,4V91.71a28,28,0,1,0-8,0v72.58a28,28,0,1,0,8,0V144a12,12,0,0,1,12-12h88a20,20,0,0,0,20-20V91.71A28,28,0,0,0,228,64ZM60,64A20,20,0,1,1,80,84,20,20,0,0,1,60,64Zm40,128a20,20,0,1,1-20-20A20,20,0,0,1,100,192ZM200,84a20,20,0,1,1,20-20A20,20,0,0,1,200,84Z`}))]]),j=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M156,112a12,12,0,0,1-12,12H80a12,12,0,0,1,0-24h64A12,12,0,0,1,156,112Zm76.49,120.49a12,12,0,0,1-17,0L168,185a92.12,92.12,0,1,1,17-17l47.54,47.53A12,12,0,0,1,232.49,232.49ZM112,180a68,68,0,1,0-68-68A68.08,68.08,0,0,0,112,180Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Zm112,0a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM144,120H80a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M150,112a6,6,0,0,1-6,6H80a6,6,0,0,1,0-12h64A6,6,0,0,1,150,112Zm78.24,116.24a6,6,0,0,1-8.48,0l-51.38-51.38a86.15,86.15,0,1,1,8.48-8.48l51.38,51.38A6,6,0,0,1,228.24,228.24ZM112,186a74,74,0,1,0-74-74A74.09,74.09,0,0,0,112,186Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M148,112a4,4,0,0,1-4,4H80a4,4,0,0,1,0-8h64A4,4,0,0,1,148,112Zm78.83,114.83a4,4,0,0,1-5.66,0l-52.7-52.7a84.1,84.1,0,1,1,5.66-5.66l52.7,52.7A4,4,0,0,1,226.83,226.83ZM112,188a76,76,0,1,0-76-76A76.08,76.08,0,0,0,112,188Z`}))]]),ge=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M156,112a12,12,0,0,1-12,12H124v20a12,12,0,0,1-24,0V124H80a12,12,0,0,1,0-24h20V80a12,12,0,0,1,24,0v20h20A12,12,0,0,1,156,112Zm76.49,120.49a12,12,0,0,1-17,0L168,185a92.12,92.12,0,1,1,17-17l47.54,47.53A12,12,0,0,1,232.49,232.49ZM112,180a68,68,0,1,0-68-68A68.08,68.08,0,0,0,112,180Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Zm112,0a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM144,120H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24a8,8,0,0,1,0,16Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M150,112a6,6,0,0,1-6,6H118v26a6,6,0,0,1-12,0V118H80a6,6,0,0,1,0-12h26V80a6,6,0,0,1,12,0v26h26A6,6,0,0,1,150,112Zm78.24,116.24a6,6,0,0,1-8.48,0l-51.38-51.38a86.15,86.15,0,1,1,8.48-8.48l51.38,51.38A6,6,0,0,1,228.24,228.24ZM112,186a74,74,0,1,0-74-74A74.09,74.09,0,0,0,112,186Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M152,112a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M148,112a4,4,0,0,1-4,4H116v28a4,4,0,0,1-8,0V116H80a4,4,0,0,1,0-8h28V80a4,4,0,0,1,8,0v28h28A4,4,0,0,1,148,112Zm78.83,114.83a4,4,0,0,1-5.66,0l-52.7-52.7a84.1,84.1,0,1,1,5.66-5.66l52.7,52.7A4,4,0,0,1,226.83,226.83ZM112,188a76,76,0,1,0-76-76A76.08,76.08,0,0,0,112,188Z`}))]]),_e=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M208,28H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28Zm-4,24v92H179.31a19.86,19.86,0,0,0-14.14,5.86L147,168H109L90.83,149.86A19.86,19.86,0,0,0,76.69,144H52V52ZM52,204V168H75l18.14,18.14A19.86,19.86,0,0,0,107.31,192h41.38a19.86,19.86,0,0,0,14.14-5.86L181,168h23v36Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,48V160H179.31a8,8,0,0,0-5.66,2.34l-19.31,19.32a8,8,0,0,1-5.66,2.34H107.31a8,8,0,0,1-5.66-2.34L82.34,162.34A8,8,0,0,0,76.68,160H40V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,16V152h-28.7A15.86,15.86,0,0,0,168,156.69L148.69,176H107.31L88,156.68A15.89,15.89,0,0,0,76.69,152H48V48Zm0,160H48V168H76.69L96,187.32A15.89,15.89,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V168H76.69L96,187.32A15.89,15.89,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M208,34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34ZM48,46H208a2,2,0,0,1,2,2V154H179.31a13.94,13.94,0,0,0-9.9,4.1L150.1,177.41a2,2,0,0,1-1.41.59H107.31a2,2,0,0,1-1.41-.58L86.59,158.1a13.94,13.94,0,0,0-9.9-4.1H46V48A2,2,0,0,1,48,46ZM208,210H48a2,2,0,0,1-2-2V166H76.69a2,2,0,0,1,1.41.58L97.41,185.9a13.94,13.94,0,0,0,9.9,4.1h41.38a13.94,13.94,0,0,0,9.9-4.1l19.31-19.31a2,2,0,0,1,1.41-.59H210v42A2,2,0,0,1,208,210Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,16V152h-28.7A15.86,15.86,0,0,0,168,156.69L148.69,176H107.31L88,156.69A15.86,15.86,0,0,0,76.69,152H48V48Zm0,160H48V168H76.69L96,187.31A15.86,15.86,0,0,0,107.31,192h41.38A15.86,15.86,0,0,0,160,187.31L179.31,168H208v40Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M208,36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36ZM48,44H208a4,4,0,0,1,4,4V156H179.31a12,12,0,0,0-8.48,3.51l-19.32,19.32a4,4,0,0,1-2.82,1.17H107.31a4,4,0,0,1-2.82-1.17L85.17,159.51A12,12,0,0,0,76.69,156H44V48A4,4,0,0,1,48,44ZM208,212H48a4,4,0,0,1-4-4V164H76.69a4,4,0,0,1,2.82,1.17l19.32,19.32a12,12,0,0,0,8.48,3.51h41.38a12,12,0,0,0,8.48-3.51l19.32-19.32a4,4,0,0,1,2.82-1.17H212v44A4,4,0,0,1,208,212Z`}))]]),ve=k.forwardRef((e,t)=>k.createElement(l,{ref:t,...e,weights:me}));ve.displayName=`ArrowLeftIcon`;var ye=ve,be=k.forwardRef((e,t)=>k.createElement(l,{ref:t,...e,weights:A}));be.displayName=`ArrowsInIcon`;var xe=be,Se=k.forwardRef((e,t)=>k.createElement(l,{ref:t,...e,weights:he}));Se.displayName=`GitBranchIcon`;var Ce=Se,we=k.forwardRef((e,t)=>k.createElement(l,{ref:t,...e,weights:j}));we.displayName=`MagnifyingGlassMinusIcon`;var Te=we,M=k.forwardRef((e,t)=>k.createElement(l,{ref:t,...e,weights:ge}));M.displayName=`MagnifyingGlassPlusIcon`;var Ee=M,N=k.forwardRef((e,t)=>k.createElement(l,{ref:t,...e,weights:_e}));N.displayName=`TrayIcon`;var De=N,P=n();function F({accounts:e,selected:t,busy:n,t:r,onChange:i}){let[a,o]=(0,k.useState)(``),s=(0,k.useMemo)(()=>new Map(e.map(e=>[e.id,e])),[e]),c=(0,k.useMemo)(()=>new Set(t),[t]),l=(0,k.useMemo)(()=>{let t=a.trim().toLowerCase();return e.filter(e=>!t||`${e.name||``} ${e.id} ${e.region||``}`.toLowerCase().includes(t))},[e,a]),d=t.filter(e=>!s.has(e));function f(e,n){i(n?[...t,e]:t.filter(t=>t!==e))}return(0,P.jsxs)(`div`,{className:`space-y-2`,children:[t.length>0?(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(e=>(0,P.jsxs)(u,{size:`sm`,variant:`secondary`,isDisabled:n,onPress:()=>f(e,!1),children:[(0,P.jsx)(`span`,{className:`max-w-40 truncate`,children:s.get(e)?.name||e}),(0,P.jsx)(re,{size:12})]},e))}):(0,P.jsx)(`p`,{className:`text-caption text-muted`,children:r(`modelPoolAccountsAll`)}),e.length>6?(0,P.jsx)(v,{"aria-label":r(`modelPoolAccountsSearch`),value:a,onChange:o,isDisabled:n,children:(0,P.jsxs)(v.Group,{children:[(0,P.jsx)(v.SearchIcon,{}),(0,P.jsx)(v.Input,{placeholder:r(`modelPoolAccountsSearch`)}),(0,P.jsx)(v.ClearButton,{})]})}):null,(0,P.jsxs)(`div`,{className:`max-h-56 overflow-y-auto overscroll-contain rounded-lg bg-surface-secondary p-1`,children:[d.map(e=>(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-1.5`,children:[(0,P.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-caption text-muted`,children:e}),(0,P.jsx)(u,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:n,"aria-label":r(`modelPoolRemoveSeat`),onPress:()=>f(e,!1),children:(0,P.jsx)(re,{size:14})})]},`missing-${e}`)),l.map(e=>(0,P.jsx)(m,{isSelected:c.has(e.id),isDisabled:n,onChange:t=>f(e.id,t),className:`flex w-full cursor-pointer rounded-md px-2.5 py-1.5 hover:bg-default`,children:(0,P.jsxs)(m.Content,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,P.jsx)(m.Control,{children:(0,P.jsx)(m.Indicator,{})}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`span`,{className:`block truncate text-body`,children:e.name||e.id}),(0,P.jsx)(`span`,{className:`mono block truncate text-caption text-muted`,children:e.region||e.id})]})]})},e.id)),e.length===0?(0,P.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:r(`modelPoolNoAccounts`)}):null,e.length>0&&l.length===0?(0,P.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:r(`modelPoolAccountsNoMatch`)}):null]})]})}var I=276,L=128,Oe=64,R=96,ke=.4,Ae=1.7;function je({steps:e,selected:t,strategyTitle:n,strategyLine:r,strategyChips:a,requestTitle:c,requestToken:l,skipped:u,labels:d,describe:f,busy:p,onSelect:m,onSelectStrategy:h,onInsert:g,onMove:_,onRemove:v}){let y=(0,k.useRef)(null),b=(0,k.useRef)({x:220,y:36,k:1}),[x,ee]=(0,k.useState)(b.current),[te,S]=(0,k.useState)(null),[C,ne]=(0,k.useState)(null),[re,ae]=(0,k.useState)(!1),[w,oe]=(0,k.useState)(null),T=(0,k.useRef)(null),se=(0,k.useRef)(C);se.current=C;let E=(0,k.useMemo)(()=>Ie(e,f,u,{requestTitle:c,requestToken:l,strategyTitle:n,strategyLine:r,strategyChips:a,labels:d}),[e,f,u,c,l,n,r,a,d]),D=(0,k.useRef)(E);D.current=E;let O=E.items.map(e=>C?.id===e.id?{...e,x:C.x,y:C.y}:e),le=new Map(O.map(e=>[e.id,e])),ue=E.edges.map(e=>{let[t,n]=e.id.split(`>`),r=le.get(t),i=le.get(n);if(!r||!i)return e;let a=Fe(r,i);return{...e,d:a.d,tagX:a.x,tagY:a.y}}),de=C?.moved?z(E.items,C.id,C.x):w?.over?w.drop:null;function fe(e){b.current=e,ee(e)}function pe(){let e=y.current;if(!e||D.current.items.length===0)return;let t=D.current.items,n=Math.min(...t.map(e=>e.x)),r=Math.min(...t.map(e=>e.y))-28,i=Math.max(...t.map(e=>e.x+I)),a=Math.max(...t.map(e=>e.y+L)),o=e.getBoundingClientRect(),s=Math.max(160,o.width-248-36),c=Math.max(160,o.height-88),l=G(Math.min(s/Math.max(1,i-n),c/Math.max(1,a-r),1),ke,Ae);fe({k:l,x:248+(s-(i-n)*l)/2-n*l,y:28+(c-(a-r)*l)/2-r*l})}let me=(0,k.useRef)(!1),A=(0,k.useRef)(!1),he=(0,k.useRef)(pe);he.current=pe,(0,k.useLayoutEffect)(()=>{me.current||(me.current=!0,pe())}),(0,k.useEffect)(()=>{let e=y.current;if(!e||typeof ResizeObserver>`u`)return;let t=e.clientHeight,n=new ResizeObserver(()=>{A.current||Math.abs(e.clientHeight-t)<8||(t=e.clientHeight,he.current())});return n.observe(e),()=>n.disconnect()},[]),(0,k.useEffect)(()=>{let e=y.current;if(!e)return;let t=t=>{t.preventDefault(),A.current=!0;let n=e.getBoundingClientRect();j(t.deltaY<0?1.08:1/1.08,t.clientX-n.left,t.clientY-n.top)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]),(0,k.useEffect)(()=>{let e=e=>{if(e.target?.closest(`input, textarea, select, [contenteditable="true"]`)||!y.current?.contains(document.activeElement)&&document.activeElement!==document.body)return;let n=D.current.items.find(e=>e.id===t);if(!(!n||n.kind===`request`||n.kind===`strategy`)){if(e.key===`Backspace`||e.key===`Delete`){e.preventDefault(),v(n.id);return}(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),_(n.parentPathId,n.index,n.index+(e.key===`ArrowLeft`?-1:1)))}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_,v,t]);function j(e,t,n){let r=b.current,i=G(r.k*e,ke,Ae),a=(t-r.x)/r.k,o=(n-r.y)/r.k;fe({k:i,x:t-a*i,y:n-o*i})}function ge(e,t){let n=y.current?.getBoundingClientRect(),r=b.current;return{x:(e-(n?.left??0)-r.x)/r.k,y:(t-(n?.top??0)-r.y)/r.k}}function _e(e,t){let n=t.getBoundingClientRect(),r=y.current?.getBoundingClientRect(),i=r?.width??0,a=r?.height??0,o=n.left-(r?.left??0),s=n.bottom-(r?.top??0)+8;s+150>a&&(s=n.top-(r?.top??0)-150),o+188>i&&(o=i-196),S({parentPathId:e,x:Math.max(8,o),y:Math.max(8,s)})}function ve(e){if(e.button!==0)return;let t=e.target;if(t.closest(`button, a, input, textarea`))return;let n=t.closest(`[data-node]`),r=n?le.get(n.dataset.node||``):void 0;if(y.current?.focus({preventScroll:!0}),e.currentTarget.setPointerCapture(e.pointerId),r&&r.kind!==`request`&&r.kind!==`strategy`){T.current={type:`node`,sx:e.clientX,sy:e.clientY,ox:r.x,oy:r.y,id:r.id,moved:!1};return}if(r){T.current={type:`pan`,sx:e.clientX,sy:e.clientY,ox:b.current.x,oy:b.current.y,id:r.id,moved:!1};return}T.current={type:`pan`,sx:e.clientX,sy:e.clientY,ox:b.current.x,oy:b.current.y,moved:!1},S(null)}function ye(e){let t=T.current;if(!t)return;let n=e.clientX-t.sx,r=e.clientY-t.sy;if(!(!t.moved&&Math.hypot(n,r)<4)){if(t.moved=!0,t.type===`pan`){A.current=!0,ae(!0),fe({...b.current,x:t.ox+n,y:t.oy+r});return}if(t.id){let e=b.current.k||1,i={id:t.id,x:t.ox+n/e,y:t.oy+r/e,moved:!0};se.current=i,ne(i)}}}function be(){let e=T.current;if(T.current=null,ae(!1),e){if(e.type===`node`&&e.id){let t=E.items.find(t=>t.id===e.id),n=se.current;if(t&&e.moved&&n){let e=z(E.items,t.id,n.x);e&&e.index!==t.index&&_(t.parentPathId,t.index,e.index)}else t&&!e.moved&&m(t.id)}else!e.moved&&e.id&&(e.id===`strategy`||e.id===`request`)&&h();se.current=null,ne(null)}}function Se(e,n){if(n.button!==0||p)return;n.stopPropagation();let r={kind:e,sx:n.clientX,sy:n.clientY,id:n.pointerId,started:!1},i=(t,n,r)=>{let i=y.current?.getBoundingClientRect(),a=ge(t,n),o=r?Ne(D.current.items,a.x,a.y):null;oe({kind:e,x:t-(i?.left??0),y:n-(i?.top??0),over:r,drop:o})},a=e=>{if(e.pointerId!==r.id||!r.started&&Math.hypot(e.clientX-r.sx,e.clientY-r.sy)<5)return;r.started=!0;let t=y.current?.getBoundingClientRect(),n=y.current?.querySelector(`.dg-pal`)?.getBoundingClientRect(),a=!!t&&e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom,o=!!n&&e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom;i(e.clientX,e.clientY,a&&!o)},o=n=>{if(n.pointerId!==r.id)return;window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o);let i=y.current?.getBoundingClientRect(),s=y.current?.querySelector(`.dg-pal`)?.getBoundingClientRect(),c=!!i&&n.clientX>=i.left&&n.clientX<=i.right&&n.clientY>=i.top&&n.clientY<=i.bottom,l=!!s&&n.clientX>=s.left&&n.clientX<=s.right&&n.clientY>=s.top&&n.clientY<=s.bottom;if(!r.started)g(Me(D.current.items,t),e);else if(n.type!==`pointercancel`&&c&&!l){let t=ge(n.clientX,n.clientY),r=Ne(D.current.items,t.x,t.y);g(r.parentPathId,e,r.index)}oe(null)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,o)}let Ce=22*x.k;return(0,P.jsxs)(`div`,{className:`dg-wf`,children:[(0,P.jsx)(`style`,{children:ze}),(0,P.jsxs)(`div`,{ref:y,className:`dg-vp`,tabIndex:0,"data-panning":re?``:void 0,onPointerDown:ve,onPointerMove:ye,onPointerUp:be,onPointerCancel:be,style:{backgroundPosition:`${x.x}px ${x.y}px`,backgroundSize:`${Ce}px ${Ce}px`},children:[(0,P.jsxs)(`div`,{className:`dg-world`,style:{transform:`translate(${x.x}px, ${x.y}px) scale(${x.k})`},children:[(0,P.jsx)(`svg`,{className:`dg-edges`,"aria-hidden":`true`,children:ue.map(e=>(0,P.jsx)(`path`,{className:`dg-edge`,d:e.d},e.id))}),ue.map(e=>e.tag?(0,P.jsx)(`span`,{className:`dg-tag`,style:{left:e.tagX,top:e.tagY},children:e.tag},`${e.id}-tag`):null),de?(0,P.jsx)(`span`,{className:`dg-slot`,style:{left:de.x,top:de.y}}):null,O.map(e=>(0,P.jsxs)(`article`,{"data-node":e.id,"data-kind":e.kind,"data-selected":t===e.id||e.kind===`strategy`&&t===`strategy`?``:void 0,"data-fixed":e.kind===`request`||e.kind===`strategy`?``:void 0,className:`dg-node`,style:{left:e.x,top:e.y,width:I,height:L},title:e.kind===`request`||e.kind===`strategy`?e.title:d.drag,children:[(0,P.jsx)(`span`,{className:`dg-kind`,children:Pe(e.kind,d)}),(0,P.jsxs)(`span`,{className:`dg-head`,children:[(0,P.jsx)(`span`,{className:`dg-tile`,children:e.kind===`member`&&e.provider?(0,P.jsx)(ce,{provider:e.provider,size:14}):V(e.kind)}),(0,P.jsx)(`b`,{children:e.title}),e.chip?(0,P.jsx)(`span`,{className:`dg-chip`,"data-tone":e.tone,children:e.chip}):null]}),e.facts.length>0?(0,P.jsx)(`span`,{className:`dg-facts`,title:e.facts.join(` · `),children:e.facts.map((e,t)=>(0,P.jsx)(`span`,{className:`dg-fact`,children:e},`${t}-${e}`))}):(0,P.jsx)(`span`,{className:`dg-line`,title:e.line,children:e.line}),(0,P.jsx)(`span`,{className:`dg-well`,title:e.chips.length>1?e.chips.map(e=>e.text).join(` · `):void 0,children:e.chips.length>0?(0,P.jsx)(`span`,{className:`dg-chips`,children:H(e.chips).map((e,t)=>(0,P.jsxs)(`span`,{className:`dg-tagchip`,"data-tone":e.tone,title:e.title||e.text,children:[e.tone===`model`?(0,P.jsx)(ie,{size:10}):e.tone===`account`?(0,P.jsx)(s,{size:10}):null,(0,P.jsx)(`span`,{children:e.text})]},`${e.tone}-${t}`))}):(0,P.jsx)(`span`,{className:`dg-mono`,children:e.well||`—`})}),e.kind===`request`?null:(0,P.jsx)(`span`,{className:`dg-port dg-port-in`}),e.ports.map(e=>(0,P.jsx)(`span`,{className:`dg-port dg-port-out`,style:{left:`${e*100}%`}},e)),e.kind!==`request`&&e.kind!==`strategy`?(0,P.jsx)(`button`,{type:`button`,className:`dg-x`,"aria-label":d.remove,disabled:p,onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),v(e.id)},children:(0,P.jsx)(o,{size:12})}):null]},e.id)),E.adds.map(e=>(0,P.jsx)(`button`,{type:`button`,className:`dg-add`,"data-place":e.place,style:{left:e.x-11,top:e.y-11},"aria-label":d.add,disabled:p,onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),_e(e.parentPathId,t.currentTarget)},children:(0,P.jsx)(i,{size:12,weight:`bold`})},e.key))]}),(0,P.jsxs)(`aside`,{className:`dg-pal`,onPointerDown:e=>e.stopPropagation(),children:[(0,P.jsx)(`p`,{className:`dg-pal-title`,children:d.palette}),(0,P.jsx)(`p`,{className:`dg-pal-hint`,children:d.hint}),[[`member`,d.model,d.modelLine],[`group`,d.group,d.groupLine],[`branch`,d.intent,d.intentLine]].map(([e,t,n])=>(0,P.jsxs)(`button`,{type:`button`,className:`dg-pal-item`,disabled:p,onPointerDown:t=>Se(e,t),children:[(0,P.jsx)(`span`,{className:`dg-tile`,"data-kind":e,children:V(e)}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`b`,{children:t}),(0,P.jsx)(`small`,{children:n})]})]},e))]}),te?(0,P.jsx)(`div`,{className:`dg-menu`,style:{left:te.x,top:te.y},onPointerDown:e=>e.stopPropagation(),children:[[`member`,d.model],[`group`,d.group],[`branch`,d.intent]].map(([e,t])=>(0,P.jsxs)(`button`,{type:`button`,disabled:p,onClick:()=>{g(te.parentPathId,e),S(null)},children:[(0,P.jsx)(`span`,{className:`dg-tile`,"data-kind":e,children:V(e)}),t]},e))}):null,w?(0,P.jsxs)(`div`,{className:`dg-ghost`,"data-over":w.over?``:void 0,style:{left:w.x,top:w.y},children:[(0,P.jsx)(`span`,{className:`dg-kind`,children:Pe(w.kind,d)}),(0,P.jsxs)(`span`,{className:`dg-head`,children:[(0,P.jsx)(`span`,{className:`dg-tile`,"data-kind":w.kind,children:V(w.kind)}),(0,P.jsx)(`b`,{children:Pe(w.kind,d)})]})]}):null,(0,P.jsxs)(`div`,{className:`dg-tb`,onPointerDown:e=>e.stopPropagation(),children:[(0,P.jsx)(`button`,{type:`button`,"aria-label":d.zoomOut,onClick:()=>{A.current=!0;let e=y.current?.getBoundingClientRect();j(1/1.12,(e?.width??0)/2,(e?.height??0)/2)},children:(0,P.jsx)(Te,{size:15})}),(0,P.jsxs)(`button`,{type:`button`,className:`dg-zoom`,onClick:()=>{A.current=!0,j(1/b.current.k,(y.current?.clientWidth??0)/2,(y.current?.clientHeight??0)/2)},children:[Math.round(x.k*100),`%`]}),(0,P.jsx)(`button`,{type:`button`,"aria-label":d.zoomIn,onClick:()=>{A.current=!0;let e=y.current?.getBoundingClientRect();j(1.12,(e?.width??0)/2,(e?.height??0)/2)},children:(0,P.jsx)(Ee,{size:15})}),(0,P.jsx)(`i`,{}),(0,P.jsx)(`button`,{type:`button`,"aria-label":d.fit,onClick:pe,children:(0,P.jsx)(xe,{size:15})})]})]})]})}function Me(e,t){let n=e.find(e=>e.id===t);return!n||n.kind===`request`||n.kind===`strategy`?null:n.parentPathId}function z(e,t,n){let r=e.find(e=>e.id===t);if(!r)return null;let i=e.filter(e=>e.id!==t&&e.parentPathId===r.parentPathId&&e.from===r.from).sort((e,t)=>e.x-t.x),a=i.filter(e=>e.x+I/2e.kind!==`request`&&e.kind!==`strategy`),i=new Map;for(let e of r){let t=e.parentPathId??`*`,n=i.get(t)??[];n.push(e),i.set(t,n)}let a=null;for(let[e,t]of i){let r=t[0]?.y??0,i=Math.abs(n-(r+L/2));i>L||(!a||ie.x+I/2e.x-t.x),i=r[0]?.y??0;return r.length===0?{x:n,y:i}:t<=0?{x:r[0].x-18,y:i}:t>=r.length?{x:r[r.length-1].x+I+18,y:i}:{x:(r[t-1].x+I+r[t].x)/2,y:i}}function Pe(e,t){return e===`request`?t.request:e===`strategy`?t.strategyKind:e===`group`?t.group:e===`branch`?t.intent:t.model}function V(e){return e===`strategy`?(0,P.jsx)(S,{size:14}):e===`group`?(0,P.jsx)(a,{size:14}):e===`branch`?(0,P.jsx)(Ce,{size:14}):e===`request`?(0,P.jsx)(De,{size:14}):(0,P.jsx)(ie,{size:14})}function Fe(e,t){let n=e.x+I*(t.port||.5),r=e.y+L,i=t.x+I/2,a=t.y,o=Math.max(32,Math.abs(a-r)*.45),s=r+o,c=a-o,l=.42,u=.5800000000000001,d=u**3*n+3*u**2*l*n+3*u*l**2*i+l**3*i,f=u**3*r+3*u**2*l*s+3*u*l**2*c+l**3*a;return{d:`M ${n} ${r} C ${n} ${s}, ${i} ${c}, ${i} ${a}`,x:d,y:f}}function H(e){return e.length<=3?e:[e[0],e[1],{text:`+${e.length-2}`,tone:`more`,title:e.slice(2).map(e=>e.text).join(`, `)}]}function Ie(e,t,n,r){let i=W(e,0,448,`strategy`,.5,null,t,n,r.labels),a=Math.max(I,i.width),o=Math.max(0,(a-I)/2),s=[{id:`request`,kind:`request`,title:r.requestTitle,line:r.labels.requestLine,well:r.labels.request,chip:``,tone:`index`,chips:r.requestToken?[{text:r.requestToken,tone:`plain`}]:[],facts:[],x:o,y:0,parentPathId:null,index:0,from:null,port:.5,ports:[.5]},{id:`strategy`,kind:`strategy`,title:r.strategyTitle,line:r.strategyLine,well:r.labels.strategyKind,chip:``,tone:`index`,chips:r.strategyChips??[],facts:[],x:o,y:224,parentPathId:null,index:0,from:`request`,port:.5,ports:[.5]},...i.items],c=i.width>0?{key:`root`,parentPathId:null,x:i.width+36,y:512,place:`end`}:{key:`root`,parentPathId:null,x:o+I/2,y:380,place:`under`},l=s.flatMap(t=>{if(!t.from)return[];let n=s.find(e=>e.id===t.from);if(!n)return[];let r=Fe(n,t),i=U(e,t);return[{id:`${n.id}>${t.id}`,d:r.d,tag:i,tagX:r.x,tagY:r.y}]});return{items:s,adds:[c,...i.adds],edges:l,width:a,height:i.height}}function U(e,t){if(!t.parentPathId)return;let n=Le(e,t.parentPathId);if(n)return n.steps[0]?.id===t.id?n.label:void 0}function Le(e,t){for(let n of e)for(let e of n.paths??[]){if(e.id===t)return e;let n=Le(e.steps,t);if(n)return n}return null}function W(e,t,n,r,i,a,o,s,c){let l=t,u=n+L,d=[],f=[];return e.forEach((e,t)=>{let p=o(e),m=e.kind,h=I,g=[];if(e.kind===`branch`){let t=e.paths??[],r=l,i=n+L+R;t.forEach((n,a)=>{let l=(a+1)/(t.length+1),d=W(n.steps,r,i,e.id,l,n.id,o,s,c);g.push(...d.items),f.push(...d.adds);let p=Math.max(d.width,I);d.items.some(t=>t.parentPathId===n.id&&t.from===e.id)&&f.push({key:n.id,parentPathId:n.id,x:r+p+36,y:i+L/2,place:`end`}),r+=p+Oe,u=Math.max(u,d.height)}),h=Math.max(I,r-l-Oe)}let _=l+(h-I)/2;if(d.push({id:e.id,kind:m,title:p.title,line:p.detail,well:p.note,chips:p.chips??[],facts:p.facts??[],...Re(e,t,s,c),provider:e.provider,x:_,y:n,parentPathId:a,index:t,from:r,port:i,ports:e.kind===`branch`?(e.paths??[]).map((e,t,n)=>(t+1)/(n.length+1)):[]}),e.kind===`branch`){let t=e.paths??[];t.forEach((r,i)=>{if(g.some(t=>t.parentPathId===r.id&&t.from===e.id))return;let a=(i+1)/(t.length+1);f.push({key:r.id,parentPathId:r.id,x:_+I*a,y:n+L+28,place:`under`})})}d.push(...g),l+=h+Oe}),{items:d,width:Math.max(0,l-t-(e.length?Oe:0)),height:u,adds:f}}function Re(e,t,n,r){return n?.[e.id]?{chip:r.skipped,tone:`skip`}:(e.kind===`member`?!e.provider||!e.model:e.kind===`group`&&!e.aggregation_id)?{chip:r.incomplete,tone:`warn`}:{chip:String(t+1).padStart(2,`0`),tone:`index`}}function G(e,t,n){return Math.min(n,Math.max(t,e))}var ze=` .dg-wf { position: relative; height: clamp(360px, calc(100dvh - 16rem), 640px); min-height: 360px; overflow: hidden; border-radius: var(--radius-3xl, 24px); background: var(--surface-secondary); box-shadow: inset 0 0 0 1px var(--border); } .dg-vp { position: absolute; inset: 0; overflow: hidden; outline: none; touch-action: none; user-select: none; cursor: grab; background-image: radial-gradient(circle at 1px 1px, color-mix(in oklch, var(--foreground) 16%, transparent) 0.7px, transparent 1.05px); } @@ -74,4 +74,4 @@ import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./Check.es-DR @media (min-width: 80rem) { .dg-wf { height: 100%; min-height: 0; } } -`,Be=`entry`,Ve=`strategy`,He=new Set([Be,Ve]);function Ue(){return{version:1,steps:[]}}function We(e,t){let n=String(e||``).trim();if(n)try{let e=JSON.parse(n);if(e&&e.version===1&&Array.isArray(e.steps)&&e.steps.length>0)return{version:1,steps:e.steps.map(K)}}catch{}return Ge(t)}function Ge(e){return{version:1,steps:[...e].sort((e,t)=>e.priority-t.priority||e.model.localeCompare(t.model)).map((e,t)=>({id:`member-${t+1}`,kind:`member`,provider:e.provider,region:e.region||``,model:e.model,...e.account_id?{account_id:e.account_id,account_ids:[e.account_id]}:{},weight:e.weight>0?e.weight:100}))}}var Ke=0;function qe(e,t){Ke+=1;let n=`${e}-${Date.now().toString(36)}${Ke.toString(36)}`;return e===`branch`?{id:n,kind:e,paths:[{id:`${n}-match`,label:t.match,keywords:[],intent:``,steps:[]},{id:`${n}-default`,label:t.fallback,fallback:!0,steps:[]}]}:e===`group`?{id:n,kind:e,aggregation_id:``,weight:100}:{id:n,kind:e,provider:``,region:``,model:``,weight:100}}function Je(e,t,n,r){return{version:1,steps:J(e.steps,t,e=>{let t=[...e],i=Math.max(0,Math.min(n,t.length));return t.splice(i,0,r),t})}}function Ye(e,t,n,r){return{version:1,steps:J(e.steps,t,e=>{if(n===r||n<0||r<0||n>=e.length||r>=e.length)return e;let t=[...e],[i]=t.splice(n,1);return t.splice(r,0,i),t})}}function Xe(e,t){return{version:1,steps:lt(e.steps,t)}}function Ze(e,t,n){return{version:1,steps:q(e.steps,t,e=>({...e,...n,id:e.id,kind:e.kind}))}}function Qe(e,t,n){let r=e=>e.map(e=>e.kind!==`branch`||!e.paths?e:{...e,paths:e.paths.map(e=>e.id===t?{...e,...n,id:e.id,steps:e.steps}:{...e,steps:r(e.steps)})});return{version:1,steps:r(e.steps)}}function $e(e,t){let n=e=>e.map(e=>{if(e.kind!==`branch`||!e.paths)return e;let r=e.paths.some(e=>e.id===t);return{...e,paths:e.paths.map(e=>({...e,fallback:r?e.id===t:e.fallback,steps:n(e.steps)}))}});return{version:1,steps:n(e.steps)}}function et(e,t,n){return{version:1,steps:q(e.steps,t,e=>{if(e.kind!==`branch`)return e;let r=e.paths??[],i=`${t}-p${r.length}-${Date.now().toString(36)}`;return{...e,paths:[...r,{id:i,label:n,keywords:[],intent:``,fallback:!1,steps:[]}]}})}}function tt(e,t){let n=e=>e.map(e=>{if(e.kind!==`branch`||!e.paths)return e;let r=e.paths.some(e=>e.id===t),i=e.paths.filter(e=>e.id!==t).map(e=>({...e,steps:n(e.steps)}));return r&&i.length>0&&!i.some(e=>e.fallback)&&(i=i.map((e,t)=>({...e,fallback:t===i.length-1}))),{...e,paths:i}});return{version:1,steps:n(e.steps)}}function nt(e,t){for(let n of e){if(n.id===t)return n;for(let e of n.paths??[]){let n=nt(e.steps,t);if(n)return n}}return null}function rt(e,t){let n=0,r=null,i=e=>{for(let a of e)if(a.kind===`member`)!a.provider||!a.model?r??=`incomplete`:n+=1;else if(a.kind===`group`)a.aggregation_id?t&&a.aggregation_id===t?r??=`self`:n+=1:r??=`group`;else if(a.kind===`branch`){let e=a.classifier;e&&!!e.provider!=!!e.model&&(r??=`classifier`);for(let e of a.paths??[])i(e.steps)}};return i(e.steps),!e.steps.length||n===0?r??`empty`:r}function it(e){let t=(e.account_ids??[]).map(e=>e.trim()).filter(Boolean);if(t.length)return[...new Set(t)];let n=e.account_id?.trim();return n?[n]:[]}function at(e){return{version:1,steps:ot(e.steps)}}function ot(e){return e.flatMap(st)}function st(e){if(e.kind===`member`){let t=Y(e),n=it(e);return n.length<=1?[t]:n.map((e,n)=>({...t,id:`${t.id||`member`}-acct${n+1}`,account_id:e}))}if(e.kind===`branch`){let t=Y(e);return[{...t,paths:(e.paths??[]).map((e,n)=>({...t.paths?.[n]??{id:e.id,label:e.label,steps:[]},steps:ot(e.steps)}))}]}return[Y(e)]}function ct(e,t){if(!t)return{};let n={},r=e=>{for(let i of e){if(i.kind!==`branch`||!i.paths?.length)continue;let e=i.paths.find(e=>e.label===t);if(e)for(let t of i.paths)t.id!==e.id&&(n[t.id]=`skipped`);for(let e of i.paths)r(e.steps)}};return r(e.steps),n}function K(e){let t=He.has(e.id)?`step-${e.id}`:e.id;return{...e,id:t,paths:e.paths?.map(e=>({...e,steps:e.steps.map(K)}))}}function q(e,t,n){return e.map(e=>e.id===t?n(e):e.kind!==`branch`||!e.paths?e:{...e,paths:e.paths.map(e=>({...e,steps:q(e.steps,t,n)}))})}function J(e,t,n){return t?e.map(e=>e.kind!==`branch`||!e.paths?e:{...e,paths:e.paths.map(e=>e.id===t?{...e,steps:n(e.steps)}:{...e,steps:J(e.steps,t,n)})}):n(e)}function lt(e,t){return e.filter(e=>e.id!==t).map(e=>e.kind!==`branch`||!e.paths?e:{...e,paths:e.paths.map(e=>({...e,steps:lt(e.steps,t)}))})}function Y(e){if(e.kind===`group`)return{id:e.id,kind:`group`,aggregation_id:e.aggregation_id||``,weight:ut(e.weight)};if(e.kind===`branch`){let t=e.classifier;return{id:e.id,kind:`branch`,...t?.provider&&t.model?{classifier:{provider:t.provider,...t.region?{region:t.region}:{},model:t.model}}:{},paths:(e.paths??[]).map(e=>{let t=(e.keywords??[]).map(e=>e.trim()).filter(Boolean),n=(e.intent??``).trim();return{id:e.id,label:e.label.trim()||e.id,...t.length?{keywords:t}:{},...n?{intent:n}:{},...e.fallback?{fallback:!0}:{},steps:e.steps.map(Y)}})}}return{id:e.id,kind:`member`,provider:e.provider||``,...e.region?{region:e.region}:{},model:e.model||``,...it(e).length===1?{account_id:it(e)[0]}:{},weight:ut(e.weight)}}function ut(e){return!e||e<1?100:e>1e6?1e6:Math.round(e)}function X(e){return String(e||`qoder`).trim().toLowerCase()}function Z(e){let t=String(e||``).trim().toLowerCase();return t===``||t===`gl`?`global`:t}function dt(e,t){let n=new Set(t.map(e=>X(e.provider)));return e.filter(e=>n.has(X(e.id))).map(e=>({id:e.id,label:e.label}))}function ft(e,t,n){let r=e.find(e=>e.id===n);if(!r)return[];let i=new Set(t.filter(e=>X(e.provider)===X(n)).map(e=>Z(e.region)));return(r.regions||[]).filter(e=>i.has(Z(e.id))).map(e=>({id:e.id,label:e.label}))}function pt(e,t,n,r){let i=new Set,a=[],o=String(t||``).trim().toLowerCase(),s=String(n||``).trim()?Z(n):``;for(let t of e){let e=String(t.provider||t.owned_by||``).trim().toLowerCase();if(e&&e!==o)continue;if(s){let e=[t.region,...t.regions||[]].map(e=>Z(e)).filter(Boolean);if(e.length&&!e.includes(s))continue}let n=t.id;if(!n||i.has(n))continue;i.add(n);let r=t.display_name||t.route_display_name||n;a.push({id:n,label:`${r} (${n})`})}return a.length||a.push({id:``,label:r(`modelPoolNoModels`)}),a}function mt(e,t){let n=e.find(e=>e.id===t);return n?.display_name||n?.route_display_name||t}var ht=[`none`,`low`,`medium`,`high`,`xhigh`,`max`],gt=/^[a-z0-9/-]+$/,_t={empty:`modelPoolMembersRequired`,incomplete:`modelPoolMemberIncomplete`,group:`modelPoolGroupRequired`,self:`modelPoolSelfGroup`,classifier:`modelPoolClassifierIncomplete`};function vt(){let{t:e}=c(),t=ae(),n=w(),r=oe()[`*`]??``,a=n.pathname===`/model-pool/new`,s=a?``:r,{enabled:l,loading:m}=se(),v=(0,k.useRef)(null),[S,re]=(0,k.useState)([]),[ie,me]=(0,k.useState)([]),[A,he]=(0,k.useState)([]),[j,ge]=(0,k.useState)([]),[_e,ve]=(0,k.useState)(!0),[be,xe]=(0,k.useState)(!1),[Se,Ce]=(0,k.useState)(!1),[we,Te]=(0,k.useState)(``),[M,Ee]=(0,k.useState)(!1),[N,De]=(0,k.useState)(``),[F,I]=(0,k.useState)(``),[L,Oe]=(0,k.useState)(!0),[R,ke]=(0,k.useState)(`priority`),[Ae,Me]=(0,k.useState)(!0),[z,Ne]=(0,k.useState)(3),[B,Pe]=(0,k.useState)(0),[V,Fe]=(0,k.useState)(0),[H,Ie]=(0,k.useState)([]),[U,Le]=(0,k.useState)(``),[W,Re]=(0,k.useState)(Ue),[G,ze]=(0,k.useState)(Ve),[Be,He]=(0,k.useState)({}),[Ge,Ke]=(0,k.useState)(``),[it,ot]=(0,k.useState)(!1),[st,K]=(0,k.useState)(``),[q,J]=(0,k.useState)(null),lt=(0,k.useRef)(0),Y=(0,k.useCallback)(e=>{Re(e)},[]),ut=(0,k.useCallback)(e=>{let t=We(e?.document,e?.members||[]);Re(t),De(e?.name||``),I(e?.id||``),Oe(e?.enabled??!0),ke(e?.strategy||`priority`),Me(e?.allow_fallbacks??!0),Ne(e?.max_attempts||3),Pe(e?.context_length??0),Fe(e?.max_output_tokens??0),Ie(e?.reasoning_options??[]),Le(e?.reasoning_effort??``),ze(Ve),He({}),J(null),K(``),Ce(!1),Te(``)},[]);(0,k.useEffect)(()=>{if(!l||m)return;let e=a?`new`:s;if(v.current===e)return;let t=!1;return ve(!0),(async()=>{try{let[n,r,i,o]=await Promise.all([ue(),b(),ee(void 0,!1,`regional`),x()]);if(t)return;let c=n.data||[];if(re(c),me(r.data||[]),he(i.data||[]),ge(o.data||[]),a)ut(null);else{let e=c.find(e=>e.id===s);e?ut(e):Ce(!0)}t||(v.current=e),xe(!0)}catch(e){t||(xe(!1),Te(e instanceof Error?e.message:String(e)))}finally{t||ve(!1)}})(),()=>{t=!0}},[l,m,a,s,ut]);let X=a?F.trim().toLowerCase():s,Z=(0,k.useMemo)(()=>dt(ie,j),[ie,j]),ht=(0,k.useMemo)(()=>pe.map(t=>({id:t,label:e(`modelPoolStrategy_${t}`)})),[e]),vt=(0,k.useMemo)(()=>{let t=S.filter(e=>e.id!==X&&e.enabled).map(e=>({id:e.id,label:`${e.name} (${e.id})`}));return[{id:``,label:t.length?e(`modelPoolNestedPoolPick`):e(`modelPoolNestedPoolEmpty`)},...t]},[S,X,e]),Ct=(0,k.useMemo)(()=>q?.path?ct(W,q.path):{},[W,q]),$=G?nt(W.steps,G):null;(0,k.useEffect)(()=>{!G||G===`strategy`||nt(W.steps,G)||ze(Ve)},[W,G]);function Et(t,n,r=2**53-1){let i=qe(n,{match:e(`modelPoolPathMatch`),fallback:e(`modelPoolPathDefault`)});Y(e=>Je(e,t,r,i)),ze(i.id)}function Dt(e,t,n){Y(r=>Ye(r,e,t,n))}function Ot(e){Ie(e),U&&!e.includes(U)&&Le(``)}function kt(e){Ot(H.includes(e)?H.filter(t=>t!==e):[...H,e])}function At(){if(a){let t=F.trim().toLowerCase();if(!t||t.length>128||!gt.test(t))return e(`modelPoolIdInvalid`)}if(!N.trim())return e(`modelPoolNameRequired`);let t=rt(W,X);return t?e(_t[t]):!Number.isInteger(z)||z<1||z>64?e(`modelPoolAttemptsInvalid`):!Number.isInteger(B)||B<0||B>0&&B<1024||!Number.isInteger(V)||V<0||V>0&&V<1024||B>0&&V>B?e(`modelPoolCapabilitiesInvalid`):U&&!H.includes(U)?e(`modelPoolReasoningInvalid`):``}function jt(){return{name:N.trim(),enabled:L,strategy:R,allow_fallbacks:Ae,max_attempts:z,context_length:B,max_output_tokens:V,reasoning_options:H,reasoning_effort:U,document:at(W),members:[]}}async function Mt(){let n=At();if(n){Te(n);return}Ee(!0),Te(``);try{let n=jt();if(a){let r=await de({...n,id:F.trim().toLowerCase()});E({type:`success`,title:e(`modelPoolSaved`)}),t(`/model-pool/${r.id}`,{replace:!0})}else{let t=await fe(s,n);ut(t),E({type:`success`,title:e(`modelPoolSaved`)})}}catch(e){Te(e instanceof Error?e.message:String(e))}finally{Ee(!1)}}let Nt=(0,k.useCallback)(async()=>{let t=rt(W,X);if(t){J(null),K(e(_t[t]));return}let n=++lt.current;ot(!0),K(``);try{let e=await le({id:X||`preview`,strategy:R,document:at(W),message:Ge.trim()});if(lt.current!==n)return;J(e),K(``)}catch(e){if(lt.current!==n)return;J(null),K(e instanceof Error?e.message:String(e))}finally{lt.current===n&&ot(!1)}},[W,Ge,X,R,e]);(0,k.useEffect)(()=>{lt.current+=1,J(null),K(``),ot(!1)},[W,R,Ge]);let Pt=(0,k.useMemo)(()=>St(W,Ge,A,S,e),[S,W,Ge,A,e]),Ft=(0,k.useMemo)(()=>q?.attempts.length?q.attempts.map((t,n)=>({id:t.id||`${t.provider}-${t.model}-${n}`,title:D(t.provider,t.region||``,e),detail:t.model?mt(A,t.model):``,note:t.status===`skipped`?t.reason===`no ready account`?e(`modelPoolNoReady`):t.reason||e(`modelPoolCanvasSkip`):``,provider:t.provider})):Pt.rows,[Pt.rows,A,q,e]),It=q?.path||Pt.path;return m?(0,P.jsx)(T,{className:`h-64 w-full rounded-xl`}):l?(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,P.jsxs)(`div`,{className:`sticky top-0 z-20 -mx-3 flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-separator bg-background px-3 py-2 sm:-mx-4 sm:px-4 lg:-mx-5 lg:px-5 xl:static xl:mx-0 xl:px-0`,children:[(0,P.jsxs)(u,{variant:`ghost`,onPress:()=>t(`/model-pool`),children:[(0,P.jsx)(ye,{size:16}),e(`modelPoolBack`)]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(y,{isSelected:L,ariaLabel:e(`modelPoolEnabled`),label:e(`modelPoolEnabled`),onChange:Oe,isDisabled:M}),(0,P.jsx)(u,{onPress:()=>void Mt(),isPending:M,children:e(`save`)})]})]}),(0,P.jsxs)(`div`,{className:`grid shrink-0 gap-4 sm:grid-cols-2 sm:max-w-3xl`,children:[a?(0,P.jsx)(Q,{label:e(`modelPoolId`),hint:e(`modelPoolIdHint`),children:(0,P.jsx)(h,{className:`mono`,value:F,onChange:e=>I(e.target.value),placeholder:`my-claude`,"aria-label":e(`modelPoolId`),disabled:M,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})}):(0,P.jsx)(Q,{label:e(`modelPoolId`),hint:e(`modelPoolIdLocked`),children:(0,P.jsx)(`p`,{className:`mono truncate pt-2 text-body text-foreground`,children:s})}),(0,P.jsx)(Q,{label:e(`modelPoolName`),hint:e(`modelPoolNameHint`),children:(0,P.jsx)(h,{value:N,onChange:e=>De(e.target.value),placeholder:e(`modelPoolNamePh`),"aria-label":e(`modelPoolName`),disabled:M})})]}),we?(0,P.jsx)(f,{status:`danger`,title:we}):null,Se?(0,P.jsx)(f,{status:`danger`,title:e(`modelPoolMissing`)}):null,_e?(0,P.jsx)(T,{className:`min-h-[420px] w-full flex-1 rounded-xl`}):Se||!be?null:(0,P.jsxs)(`div`,{className:`grid items-start gap-4 xl:min-h-0 xl:flex-1 xl:grid-cols-[minmax(0,1fr)_22rem] xl:items-stretch`,children:[(0,P.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-2`,children:[(0,P.jsx)(`div`,{className:`relative min-h-[360px] xl:min-h-0 xl:flex-1`,children:(0,P.jsx)(`div`,{className:`xl:absolute xl:inset-0`,children:(0,P.jsx)(je,{steps:W.steps,selected:G,strategyTitle:e(`modelPoolStrategy_${R}`),strategyLine:e(`modelPoolStrategyNote`),strategyChips:[{text:Ae?e(`modelPoolFailoverOn`,{count:z}):e(`modelPoolFailoverOff`),tone:`plain`},{text:e(`modelPoolSeatCount`,{count:W.steps.length}),tone:`plain`}],requestTitle:N.trim()||(a?F.trim()||e(`modelPoolEntryDetail`):s),requestToken:wt(N,a?F:s),skipped:Ct,busy:M,labels:{request:e(`modelPoolEntryTitle`),requestLine:e(`modelPoolEntryNote`),strategyKind:e(`modelPoolStrategyNode`),model:e(`modelPoolStepProvider`),modelLine:e(`modelPoolStepProviderDetail`),group:e(`modelPoolStepGroup`),groupLine:e(`modelPoolStepGroupDetail`),intent:e(`modelPoolStepIntent`),intentLine:e(`modelPoolStepIntentDetail`),add:e(`modelPoolAddSeat`),remove:e(`modelPoolRemoveSeat`),hint:e(`modelPoolEntryHint`),palette:e(`modelPoolCanvasPalette`),incomplete:e(`modelPoolCanvasIncomplete`),skipped:e(`modelPoolCanvasSkip`),fit:e(`modelPoolCanvasFit`),zoomIn:e(`modelPoolCanvasZoomIn`),zoomOut:e(`modelPoolCanvasZoomOut`),drag:e(`modelPoolDragSeat`)},describe:t=>Tt(t,R===`fill-first`,e,A,S,j),onSelectStrategy:()=>ze(Ve),onSelect:ze,onInsert:Et,onMove:Dt,onRemove:e=>{Y(t=>Xe(t,e)),ze(Ve)}})})}),(0,P.jsxs)(`section`,{className:`shrink-0 rounded-xl bg-surface-secondary p-1.5`,children:[(0,P.jsx)(te,{"aria-label":e(`modelPoolPreview`),className:`w-full`,children:(0,P.jsxs)(g,{className:`w-full`,fullWidth:!0,children:[(0,P.jsx)(g.Input,{value:Ge,onChange:e=>Ke(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Nt()},placeholder:e(`modelPoolPreviewPh`),"aria-label":e(`modelPoolPreview`),title:e(`modelPoolPreviewHint`)}),(0,P.jsx)(g.Suffix,{children:(0,P.jsx)(u,{size:`sm`,variant:`secondary`,onPress:()=>void Nt(),isPending:it,children:e(`modelPoolPreviewRun`)})})]})}),It?(0,P.jsxs)(`p`,{className:`mt-1.5 px-1.5 text-caption text-muted`,children:[e(`modelPoolPreviewPath`),` · `,It]}):null,st?(0,P.jsx)(`div`,{className:`mt-1.5`,children:(0,P.jsx)(f,{status:`danger`,title:st})}):null,Ft.length?(0,P.jsx)(`ol`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:Ft.map((e,t)=>(0,P.jsxs)(`li`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-lg bg-surface px-2 py-1 text-caption`,children:[(0,P.jsx)(`span`,{className:`mono text-muted`,children:String(t+1).padStart(2,`0`)}),e.provider?(0,P.jsx)(ce,{provider:e.provider,size:14}):null,(0,P.jsx)(`span`,{className:`truncate`,children:e.title}),e.detail?(0,P.jsx)(`span`,{className:`truncate text-muted`,children:e.detail}):null,e.note?(0,P.jsx)(`span`,{className:`truncate text-muted`,children:e.note}):null]},e.id))}):null]})]}),(0,P.jsx)(p,{className:`min-h-0 p-4 xl:overflow-y-auto`,children:(0,P.jsxs)(`div`,{className:`space-y-4`,children:[G===`strategy`||G==null?(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(`h2`,{className:`text-body font-semibold`,children:e(`modelPoolStrategyNode`)}),(0,P.jsx)(Q,{label:e(`modelPoolStrategy`),hint:e(`modelPoolStrategyHint`),children:(0,P.jsx)(O,{value:R,onChange:ke,ariaLabel:e(`modelPoolStrategy`),options:ht,className:`w-full`})}),(0,P.jsxs)(Q,{label:e(`modelPoolFailover`),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(y,{isSelected:Ae,ariaLabel:e(`modelPoolFailover`),onChange:Me,isDisabled:M}),(0,P.jsx)(_,{value:z,onChange:e=>Ne(e??3),minValue:1,maxValue:64,isDisabled:M||!Ae,children:(0,P.jsxs)(_.Group,{children:[(0,P.jsx)(_.DecrementButton,{}),(0,P.jsx)(_.Input,{"aria-label":e(`modelPoolMaxAttempts`)}),(0,P.jsx)(_.IncrementButton,{})]})})]}),(0,P.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:e(`modelPoolMaxAttemptsHint`)})]})]}):null,$?.kind===`member`?(0,P.jsx)(bt,{step:$,t:e,busy:M,showWeight:R===`fill-first`,providers:Z,regions:ft(ie,j,$.provider||``),models:pt(A,$.provider||``,$.region||``,e),accounts:j,onChange:e=>Y(t=>Ze(t,$.id,e))}):null,$?.kind===`group`?(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(`h2`,{className:`text-body font-semibold`,children:e(`modelPoolStepGroup`)}),(0,P.jsx)(Q,{label:e(`modelPoolNestedPool`),hint:e(`modelPoolStepGroupDetail`),children:(0,P.jsx)(O,{value:$.aggregation_id||``,onChange:e=>Y(t=>Ze(t,$.id,{aggregation_id:e})),ariaLabel:e(`modelPoolNestedPool`),options:vt,className:`w-full`})}),R===`fill-first`?(0,P.jsx)(yt,{t:e,busy:M,value:$.weight||100,onChange:e=>Y(t=>Ze(t,$.id,{weight:e}))}):null]}):null,$?.kind===`branch`?(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,P.jsx)(`h2`,{className:`text-body font-semibold`,children:e(`modelPoolStepIntent`)}),(0,P.jsxs)(u,{size:`sm`,variant:`ghost`,onPress:()=>Y(t=>et(t,$.id,e(`modelPoolPathMatch`))),children:[(0,P.jsx)(i,{size:14}),e(`modelPoolAddPath`)]})]}),(0,P.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:e(`modelPoolStepIntentDetail`)}),(0,P.jsx)(Q,{label:e(`modelPoolClassifier`),hint:e(`modelPoolClassifierHint`),children:(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(O,{value:$.classifier?.provider||``,onChange:e=>Y(t=>Ze(t,$.id,{classifier:e?{provider:e,region:``,model:``}:void 0})),ariaLabel:e(`modelPoolProvider`),options:[{id:``,label:e(`modelPoolClassifierOff`)},...Z],className:`w-full`}),(0,P.jsx)(O,{value:$.classifier?.region||``,onChange:e=>Y(t=>Ze(t,$.id,{classifier:{provider:$.classifier?.provider||``,region:e,model:``}})),ariaLabel:e(`modelPoolRegion`),options:[{id:``,label:e(`modelPoolAnyRegion`)},...ft(ie,j,$.classifier?.provider||``)],className:`w-full`}),(0,P.jsx)(O,{value:$.classifier?.model||``,onChange:e=>Y(t=>Ze(t,$.id,{classifier:{provider:$.classifier?.provider||``,region:$.classifier?.region||``,model:e}})),ariaLabel:e(`modelPoolModel`),options:pt(A,$.classifier?.provider||``,$.classifier?.region||``,e),className:`w-full`})]})}),($.paths??[]).map(t=>(0,P.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-surface-secondary p-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,P.jsx)(d,{className:`text-caption text-muted`,children:e(`modelPoolPathLabel`)}),(0,P.jsx)(u,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e(`modelPoolRemovePath`),isDisabled:($.paths?.length??0)<=2,onPress:()=>Y(e=>tt(e,t.id)),children:(0,P.jsx)(o,{size:14})})]}),(0,P.jsx)(h,{value:t.label,"aria-label":e(`modelPoolPathLabel`),onChange:e=>Y(n=>Qe(n,t.id,{label:e.target.value}))}),(0,P.jsx)(Q,{label:e(`modelPoolKeywords`),hint:e(`modelPoolKeywordsHint`),children:(0,P.jsx)(h,{value:Be[t.id]??(t.keywords||[]).join(`, `),"aria-label":e(`modelPoolKeywords`),onChange:e=>{let n=e.target.value;He(e=>({...e,[t.id]:n}));let r=n.split(`,`).map(e=>e.trim()).filter(Boolean);Y(e=>Qe(e,t.id,{keywords:r}))}})}),(0,P.jsx)(Q,{label:e(`modelPoolIntentLabel`),hint:e(`modelPoolIntentHint`),children:(0,P.jsx)(h,{value:t.intent||``,"aria-label":e(`modelPoolIntentLabel`),onChange:e=>Y(n=>Qe(n,t.id,{intent:e.target.value}))})}),(0,P.jsx)(y,{isSelected:!!t.fallback,ariaLabel:e(`modelPoolPathFallback`),label:e(`modelPoolPathFallback`),onChange:e=>{e&&Y(e=>$e(e,t.id))}})]},t.id))]}):null,(0,P.jsx)(ne,{}),(0,P.jsx)(xt,{t:e,busy:M,contextLength:B,maxOutput:V,reasoningOptions:H,reasoningEffort:U,onContext:Pe,onOutput:Fe,onToggle:kt,onOptions:Ot,onEffort:Le})]})})]})]}):(0,P.jsx)(C,{to:`/`,replace:!0})}function Q({label:e,hint:t,children:n}){return(0,P.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,P.jsx)(d,{className:`text-caption text-muted`,children:e}),n,t?(0,P.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t}):null]})}function yt({t:e,busy:t,value:n,onChange:r}){return(0,P.jsx)(Q,{label:e(`modelPoolWeight`),hint:e(`modelPoolWeightHint`),children:(0,P.jsx)(_,{value:n,onChange:e=>r(e??100),minValue:1,maxValue:1e6,isDisabled:t,children:(0,P.jsxs)(_.Group,{children:[(0,P.jsx)(_.DecrementButton,{}),(0,P.jsx)(_.Input,{"aria-label":e(`modelPoolWeight`)}),(0,P.jsx)(_.IncrementButton,{})]})})})}function bt({step:e,t,busy:n,showWeight:r,providers:i,regions:a,models:o,accounts:s,onChange:c}){let l=it(e),u=$(s,e.provider||``,e.region||``),d=o.filter(e=>e.id);function f(e){c({account_ids:e,account_id:e.length===1?e[0]:void 0})}return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(`h2`,{className:`text-body font-semibold`,children:t(`modelPoolStepProvider`)}),(0,P.jsx)(Q,{label:t(`modelPoolProvider`),children:(0,P.jsx)(O,{value:e.provider||``,onChange:e=>c({provider:e,region:``,model:``,account_id:void 0,account_ids:[]}),ariaLabel:t(`modelPoolProvider`),options:i,className:`w-full`})}),a.length>1?(0,P.jsx)(Q,{label:t(`modelPoolRegion`),children:(0,P.jsx)(O,{value:e.region||``,onChange:t=>{let n=new Set($(s,e.provider||``,t).map(e=>e.id)),r=l.filter(e=>n.has(e));c({region:t,model:``,account_ids:r,account_id:r.length===1?r[0]:void 0})},ariaLabel:t(`modelPoolRegion`),options:[{id:``,label:t(`modelPoolAnyRegion`)},...a],className:`w-full`})}):null,e.provider?(0,P.jsx)(Q,{label:t(`modelPoolAccounts`),hint:t(`modelPoolAccountsHint`),children:(0,P.jsx)(F,{accounts:u,selected:l,busy:n,t,onChange:f})}):null,(0,P.jsx)(Q,{label:t(`modelPoolModel`),children:(0,P.jsx)(O,{value:e.model||``,onChange:e=>c({model:e}),ariaLabel:t(`modelPoolModel`),options:d.length?d:[{id:``,label:t(`modelPoolNoModels`)}],className:`w-full`,isDisabled:!e.provider||d.length===0})}),r?(0,P.jsx)(yt,{t,busy:n,value:e.weight||100,onChange:e=>c({weight:e})}):null]})}function xt({t:e,busy:t,contextLength:n,maxOutput:i,reasoningOptions:a,reasoningEffort:o,onContext:s,onOutput:c,onToggle:l,onOptions:u,onEffort:d}){return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:`text-body font-semibold`,children:e(`modelPoolCapabilities`)}),(0,P.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`modelPoolCapabilitiesHint`)})]}),(0,P.jsx)(Q,{label:e(`modelPoolContextLength`),hint:e(`modelPoolContextLengthHint`),children:(0,P.jsx)(_,{value:n,onChange:e=>s(e??0),minValue:0,maxValue:4e6,isDisabled:t,children:(0,P.jsxs)(_.Group,{children:[(0,P.jsx)(_.DecrementButton,{}),(0,P.jsx)(_.Input,{"aria-label":e(`modelPoolContextLength`)}),(0,P.jsx)(_.IncrementButton,{})]})})}),(0,P.jsx)(Q,{label:e(`modelPoolMaxOutput`),hint:e(`modelPoolMaxOutputHint`),children:(0,P.jsx)(_,{value:i,onChange:e=>c(e??0),minValue:0,maxValue:4e6,isDisabled:t,children:(0,P.jsxs)(_.Group,{children:[(0,P.jsx)(_.DecrementButton,{}),(0,P.jsx)(_.Input,{"aria-label":e(`modelPoolMaxOutput`)}),(0,P.jsx)(_.IncrementButton,{})]})})}),(0,P.jsx)(Q,{label:e(`modelPoolReasoningLevels`),hint:e(`modelPoolReasoningLevelsHint`),children:(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsxs)(`div`,{className:`flex min-h-5 items-center justify-between gap-3`,children:[(0,P.jsx)(`span`,{className:`text-caption text-muted`,children:a.length?e(`modelPoolReasoningSelected`,{n:a.length,total:ht.length}):e(`modelPoolReasoningEmpty`)}),(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[(0,P.jsx)(`button`,{type:`button`,className:`text-caption text-muted underline-offset-2 transition-colors hover:text-foreground hover:underline disabled:cursor-not-allowed disabled:opacity-40`,disabled:t,onClick:()=>u([...ht]),children:e(`modelPoolReasoningSelectAll`)}),(0,P.jsx)(`button`,{type:`button`,className:`text-caption text-muted underline-offset-2 transition-colors hover:text-foreground hover:underline disabled:cursor-not-allowed disabled:opacity-40`,disabled:t||a.length===0,onClick:()=>u([]),children:e(`modelPoolReasoningClear`)})]})]}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":e(`modelPoolReasoningLevels`),children:ht.map(n=>{let i=a.includes(n);return(0,P.jsxs)(`label`,{className:`inline-flex select-none items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-caption transition-colors ${i?`border-accent/50 bg-accent-soft text-foreground`:`border-foreground/15 bg-surface-secondary/40 text-muted hover:bg-surface-secondary`} ${t?`cursor-not-allowed opacity-50`:`cursor-pointer`}`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`sr-only`,checked:i,disabled:t,"aria-label":`${e(`modelPoolReasoningLevels`)} ${n}`,onChange:()=>l(n)}),(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-3.5 shrink-0 place-items-center rounded border ${i?`border-accent bg-accent text-accent-foreground`:`border-foreground/25 bg-transparent`}`,children:i?(0,P.jsx)(r,{size:10,weight:`bold`}):null}),(0,P.jsx)(`span`,{className:`mono`,children:n})]},n)})})]})}),(0,P.jsx)(Q,{label:e(`modelPoolReasoningDefault`),hint:e(`modelPoolReasoningDefaultHint`),children:(0,P.jsx)(O,{value:o,onChange:d,ariaLabel:e(`modelPoolReasoningDefault`),options:[{id:``,label:e(`modelPoolReasoningAuto`)},...a.map(e=>({id:e,label:e}))],className:`w-full`,isDisabled:t||a.length===0})})]})}function St(e,t,n,r,i){let a=[],o=``,s=e=>{for(let c of e)if(c.kind===`member`)a.push({id:c.id,title:c.provider?D(c.provider,c.region||``,i):i(`modelPoolStepProvider`),detail:c.model?mt(n,c.model):i(`modelPoolCanvasIncomplete`),note:``,provider:c.provider||void 0});else if(c.kind===`group`){let e=r.find(e=>e.id===c.aggregation_id);a.push({id:c.id,title:e?.name||c.aggregation_id||i(`modelPoolStepGroup`),detail:c.aggregation_id?``:i(`modelPoolCanvasIncomplete`),note:``})}else if(c.kind===`branch`){let e=Ct(c,t);!o&&e.label&&(o=e.label),s(e.steps)}};return s(e.steps),{rows:a,path:o}}function Ct(e,t){let n=e.paths??[],r=t.toLowerCase();for(let e of n)if(!e.fallback)for(let t of e.keywords??[]){let n=t.trim().toLowerCase();if(n&&r.includes(n))return{steps:e.steps,label:e.label}}let i=n.find(e=>e.fallback);if(i)return{steps:i.steps,label:i.label};let a=n[n.length-1];return{steps:a?.steps??[],label:a?.label??``}}function wt(e,t){let n=t.trim();if(!(!n||n===e.trim()))return n}function Tt(e,t,n,r,i,a){let o=t?n(`modelPoolWeightNote`,{weight:e.weight||100}):``;if(e.kind===`group`){let t=i.find(t=>t.id===e.aggregation_id),r=!!e.aggregation_id;return{title:t?.name||e.aggregation_id||n(`modelPoolStepGroup`),detail:n(r?`modelPoolStepGroupNote`:`modelPoolStepGroupDetail`),note:r?``:n(`modelPoolStepGroupNote`),facts:r?[n(`modelPoolSeatCount`,{count:t?.members.length??0}),o].filter(Boolean):[],chips:r?[{text:e.aggregation_id||``,tone:`plain`}]:[]}}if(e.kind===`branch`){let t=(e.paths??[]).map(e=>e.label).filter(Boolean);return{title:n(`modelPoolStepIntent`),detail:n(`modelPoolStepIntentNote`),note:``,facts:[n(`modelPoolPathCount`,{count:t.length})],chips:[...e.classifier?.model?[{text:mt(r,e.classifier.model),tone:`model`}]:[],...t.map(e=>({text:e,tone:`plain`}))]}}let s=it(e),c=$(a,e.provider||``,e.region||``),l=s.map(e=>a.find(t=>t.id===e)?.name||e);return e.provider?{title:D(e.provider,e.region||``,n),detail:``,note:``,facts:[s.length===0?n(`modelPoolSeatOrderAll`):n(`modelPoolSeatOrderPicked`),s.length===0?``:n(`modelPoolAccountsCount`,{count:s.length}),o].filter(Boolean),chips:[...e.model?[{text:mt(r,e.model),tone:`model`}]:[],...l.length===0?[{text:c.length?n(`modelPoolAccountsAllCount`,{count:c.length}):n(`modelPoolAccountsAll`),tone:`account`}]:l.map(e=>({text:e,tone:`account`}))]}:{title:n(`modelPoolStepProvider`),detail:n(`modelPoolStepProviderDetail`),note:n(`modelPoolStepProviderDetail`),facts:[],chips:[]}}function $(e,t,n){if(!t)return[];let r=X(t),i=n?Z(n):``;return e.filter(e=>e.enabled!==!1&&X(e.provider)===r).filter(e=>!i||Z(e.region)===i).sort((e,t)=>(e.priority??0)-(t.priority??0)||(e.name||e.id).localeCompare(t.name||t.id))}export{vt as ModelPoolEditorPage}; \ No newline at end of file +`,Be=`entry`,Ve=`strategy`,He=new Set([Be,Ve]);function Ue(){return{version:1,steps:[]}}function We(e,t){let n=String(e||``).trim();if(n)try{let e=JSON.parse(n);if(e&&e.version===1&&Array.isArray(e.steps)&&e.steps.length>0)return{version:1,steps:e.steps.map(K)}}catch{}return Ge(t)}function Ge(e){return{version:1,steps:[...e].sort((e,t)=>e.priority-t.priority||e.model.localeCompare(t.model)).map((e,t)=>({id:`member-${t+1}`,kind:`member`,provider:e.provider,region:e.region||``,model:e.model,...e.account_id?{account_id:e.account_id,account_ids:[e.account_id]}:{},weight:e.weight>0?e.weight:100}))}}var Ke=0;function qe(e,t){Ke+=1;let n=`${e}-${Date.now().toString(36)}${Ke.toString(36)}`;return e===`branch`?{id:n,kind:e,paths:[{id:`${n}-match`,label:t.match,keywords:[],intent:``,steps:[]},{id:`${n}-default`,label:t.fallback,fallback:!0,steps:[]}]}:e===`group`?{id:n,kind:e,aggregation_id:``,weight:100}:{id:n,kind:e,provider:``,region:``,model:``,weight:100}}function Je(e,t,n,r){return{version:1,steps:J(e.steps,t,e=>{let t=[...e],i=Math.max(0,Math.min(n,t.length));return t.splice(i,0,r),t})}}function Ye(e,t,n,r){return{version:1,steps:J(e.steps,t,e=>{if(n===r||n<0||r<0||n>=e.length||r>=e.length)return e;let t=[...e],[i]=t.splice(n,1);return t.splice(r,0,i),t})}}function Xe(e,t){return{version:1,steps:lt(e.steps,t)}}function Ze(e,t,n){return{version:1,steps:q(e.steps,t,e=>({...e,...n,id:e.id,kind:e.kind}))}}function Qe(e,t,n){let r=e=>e.map(e=>e.kind!==`branch`||!e.paths?e:{...e,paths:e.paths.map(e=>e.id===t?{...e,...n,id:e.id,steps:e.steps}:{...e,steps:r(e.steps)})});return{version:1,steps:r(e.steps)}}function $e(e,t){let n=e=>e.map(e=>{if(e.kind!==`branch`||!e.paths)return e;let r=e.paths.some(e=>e.id===t);return{...e,paths:e.paths.map(e=>({...e,fallback:r?e.id===t:e.fallback,steps:n(e.steps)}))}});return{version:1,steps:n(e.steps)}}function et(e,t,n){return{version:1,steps:q(e.steps,t,e=>{if(e.kind!==`branch`)return e;let r=e.paths??[],i=`${t}-p${r.length}-${Date.now().toString(36)}`;return{...e,paths:[...r,{id:i,label:n,keywords:[],intent:``,fallback:!1,steps:[]}]}})}}function tt(e,t){let n=e=>e.map(e=>{if(e.kind!==`branch`||!e.paths)return e;let r=e.paths.some(e=>e.id===t),i=e.paths.filter(e=>e.id!==t).map(e=>({...e,steps:n(e.steps)}));return r&&i.length>0&&!i.some(e=>e.fallback)&&(i=i.map((e,t)=>({...e,fallback:t===i.length-1}))),{...e,paths:i}});return{version:1,steps:n(e.steps)}}function nt(e,t){for(let n of e){if(n.id===t)return n;for(let e of n.paths??[]){let n=nt(e.steps,t);if(n)return n}}return null}function rt(e,t){let n=0,r=null,i=e=>{for(let a of e)if(a.kind===`member`)!a.provider||!a.model?r??=`incomplete`:n+=1;else if(a.kind===`group`)a.aggregation_id?t&&a.aggregation_id===t?r??=`self`:n+=1:r??=`group`;else if(a.kind===`branch`){let e=a.classifier;e&&!!e.provider!=!!e.model&&(r??=`classifier`);for(let e of a.paths??[])i(e.steps)}};return i(e.steps),!e.steps.length||n===0?r??`empty`:r}function it(e){let t=(e.account_ids??[]).map(e=>e.trim()).filter(Boolean);if(t.length)return[...new Set(t)];let n=e.account_id?.trim();return n?[n]:[]}function at(e){return{version:1,steps:ot(e.steps)}}function ot(e){return e.flatMap(st)}function st(e){if(e.kind===`member`){let t=Y(e),n=it(e);return n.length<=1?[t]:n.map((e,n)=>({...t,id:`${t.id||`member`}-acct${n+1}`,account_id:e}))}if(e.kind===`branch`){let t=Y(e);return[{...t,paths:(e.paths??[]).map((e,n)=>({...t.paths?.[n]??{id:e.id,label:e.label,steps:[]},steps:ot(e.steps)}))}]}return[Y(e)]}function ct(e,t){if(!t)return{};let n={},r=e=>{for(let i of e){if(i.kind!==`branch`||!i.paths?.length)continue;let e=i.paths.find(e=>e.label===t);if(e)for(let t of i.paths)t.id!==e.id&&(n[t.id]=`skipped`);for(let e of i.paths)r(e.steps)}};return r(e.steps),n}function K(e){let t=He.has(e.id)?`step-${e.id}`:e.id;return{...e,id:t,paths:e.paths?.map(e=>({...e,steps:e.steps.map(K)}))}}function q(e,t,n){return e.map(e=>e.id===t?n(e):e.kind!==`branch`||!e.paths?e:{...e,paths:e.paths.map(e=>({...e,steps:q(e.steps,t,n)}))})}function J(e,t,n){return t?e.map(e=>e.kind!==`branch`||!e.paths?e:{...e,paths:e.paths.map(e=>e.id===t?{...e,steps:n(e.steps)}:{...e,steps:J(e.steps,t,n)})}):n(e)}function lt(e,t){return e.filter(e=>e.id!==t).map(e=>e.kind!==`branch`||!e.paths?e:{...e,paths:e.paths.map(e=>({...e,steps:lt(e.steps,t)}))})}function Y(e){if(e.kind===`group`)return{id:e.id,kind:`group`,aggregation_id:e.aggregation_id||``,weight:ut(e.weight)};if(e.kind===`branch`){let t=e.classifier;return{id:e.id,kind:`branch`,...t?.provider&&t.model?{classifier:{provider:t.provider,...t.region?{region:t.region}:{},model:t.model}}:{},paths:(e.paths??[]).map(e=>{let t=(e.keywords??[]).map(e=>e.trim()).filter(Boolean),n=(e.intent??``).trim();return{id:e.id,label:e.label.trim()||e.id,...t.length?{keywords:t}:{},...n?{intent:n}:{},...e.fallback?{fallback:!0}:{},steps:e.steps.map(Y)}})}}return{id:e.id,kind:`member`,provider:e.provider||``,...e.region?{region:e.region}:{},model:e.model||``,...it(e).length===1?{account_id:it(e)[0]}:{},weight:ut(e.weight)}}function ut(e){return!e||e<1?100:e>1e6?1e6:Math.round(e)}function X(e){return String(e||`qoder`).trim().toLowerCase()}function Z(e){let t=String(e||``).trim().toLowerCase();return t===``||t===`gl`?`global`:t}function dt(e,t){let n=new Set(t.map(e=>X(e.provider)));return e.filter(e=>n.has(X(e.id))).map(e=>({id:e.id,label:e.label}))}function ft(e,t,n){let r=e.find(e=>e.id===n);if(!r)return[];let i=new Set(t.filter(e=>X(e.provider)===X(n)).map(e=>Z(e.region)));return(r.regions||[]).filter(e=>i.has(Z(e.id))).map(e=>({id:e.id,label:e.label}))}function pt(e,t,n,r){let i=new Set,a=[],o=String(t||``).trim().toLowerCase(),s=String(n||``).trim()?Z(n):``;for(let t of e){let e=String(t.provider||t.owned_by||``).trim().toLowerCase();if(e&&e!==o)continue;if(s){let e=[t.region,...t.regions||[]].map(e=>Z(e)).filter(Boolean);if(e.length&&!e.includes(s))continue}let n=t.id;if(!n||i.has(n))continue;i.add(n);let r=t.display_name||t.route_display_name||n;a.push({id:n,label:`${r} (${n})`})}return a.length||a.push({id:``,label:r(`modelPoolNoModels`)}),a}function mt(e,t){let n=e.find(e=>e.id===t);return n?.display_name||n?.route_display_name||t}var ht=[`none`,`low`,`medium`,`high`,`xhigh`,`max`],gt=/^[a-z0-9/-]+$/,_t={empty:`modelPoolMembersRequired`,incomplete:`modelPoolMemberIncomplete`,group:`modelPoolGroupRequired`,self:`modelPoolSelfGroup`,classifier:`modelPoolClassifierIncomplete`};function vt(){let{t:e}=c(),t=ae(),n=w(),r=oe()[`*`]??``,a=n.pathname===`/model-pool/new`,s=a?``:r,{enabled:l,loading:m}=se(),v=(0,k.useRef)(null),[S,re]=(0,k.useState)([]),[ie,me]=(0,k.useState)([]),[A,he]=(0,k.useState)([]),[j,ge]=(0,k.useState)([]),[_e,ve]=(0,k.useState)(!0),[be,xe]=(0,k.useState)(!1),[Se,Ce]=(0,k.useState)(!1),[we,Te]=(0,k.useState)(``),[M,Ee]=(0,k.useState)(!1),[N,De]=(0,k.useState)(``),[F,I]=(0,k.useState)(``),[L,Oe]=(0,k.useState)(!0),[R,ke]=(0,k.useState)(`priority`),[Ae,Me]=(0,k.useState)(!0),[z,Ne]=(0,k.useState)(3),[B,Pe]=(0,k.useState)(0),[V,Fe]=(0,k.useState)(0),[H,Ie]=(0,k.useState)([]),[U,Le]=(0,k.useState)(``),[W,Re]=(0,k.useState)(Ue),[G,ze]=(0,k.useState)(Ve),[Be,He]=(0,k.useState)({}),[Ge,Ke]=(0,k.useState)(``),[it,ot]=(0,k.useState)(!1),[st,K]=(0,k.useState)(``),[q,J]=(0,k.useState)(null),lt=(0,k.useRef)(0),Y=(0,k.useCallback)(e=>{Re(e)},[]),ut=(0,k.useCallback)(e=>{let t=We(e?.document,e?.members||[]);Re(t),De(e?.name||``),I(e?.id||``),Oe(e?.enabled??!0),ke(e?.strategy||`priority`),Me(e?.allow_fallbacks??!0),Ne(e?.max_attempts||3),Pe(e?.context_length??0),Fe(e?.max_output_tokens??0),Ie(e?.reasoning_options??[]),Le(e?.reasoning_effort??``),ze(Ve),He({}),J(null),K(``),Ce(!1),Te(``)},[]);(0,k.useEffect)(()=>{if(!l||m)return;let e=a?`new`:s;if(v.current===e)return;let t=!1;return ve(!0),(async()=>{try{let[n,r,i,o]=await Promise.all([ue(),b(),ee(void 0,!1,`regional`),x()]);if(t)return;let c=n.data||[];if(re(c),me(r.data||[]),he(i.data||[]),ge(o.data||[]),a)ut(null);else{let e=c.find(e=>e.id===s);e?ut(e):Ce(!0)}t||(v.current=e),xe(!0)}catch(e){t||(xe(!1),Te(e instanceof Error?e.message:String(e)))}finally{t||ve(!1)}})(),()=>{t=!0}},[l,m,a,s,ut]);let X=a?F.trim().toLowerCase():s,Z=(0,k.useMemo)(()=>dt(ie,j),[ie,j]),ht=(0,k.useMemo)(()=>pe.map(t=>({id:t,label:e(`modelPoolStrategy_${t}`)})),[e]),vt=(0,k.useMemo)(()=>{let t=S.filter(e=>e.id!==X&&e.enabled).map(e=>({id:e.id,label:`${e.name} (${e.id})`}));return[{id:``,label:t.length?e(`modelPoolNestedPoolPick`):e(`modelPoolNestedPoolEmpty`)},...t]},[S,X,e]),Ct=(0,k.useMemo)(()=>q?.path?ct(W,q.path):{},[W,q]),$=G?nt(W.steps,G):null;(0,k.useEffect)(()=>{!G||G===`strategy`||nt(W.steps,G)||ze(Ve)},[W,G]);function Et(t,n,r=2**53-1){let i=qe(n,{match:e(`modelPoolPathMatch`),fallback:e(`modelPoolPathDefault`)});Y(e=>Je(e,t,r,i)),ze(i.id)}function Dt(e,t,n){Y(r=>Ye(r,e,t,n))}function Ot(e){Ie(e),U&&!e.includes(U)&&Le(``)}function kt(e){Ot(H.includes(e)?H.filter(t=>t!==e):[...H,e])}function At(){if(a){let t=F.trim().toLowerCase();if(!t||t.length>128||!gt.test(t))return e(`modelPoolIdInvalid`)}if(!N.trim())return e(`modelPoolNameRequired`);let t=rt(W,X);return t?e(_t[t]):!Number.isInteger(z)||z<1||z>64?e(`modelPoolAttemptsInvalid`):!Number.isInteger(B)||B<0||B>0&&B<1024||!Number.isInteger(V)||V<0||V>0&&V<1024||B>0&&V>B?e(`modelPoolCapabilitiesInvalid`):U&&!H.includes(U)?e(`modelPoolReasoningInvalid`):``}function jt(){return{name:N.trim(),enabled:L,strategy:R,allow_fallbacks:Ae,max_attempts:z,context_length:B,max_output_tokens:V,reasoning_options:H,reasoning_effort:U,document:at(W),members:[]}}async function Mt(){let n=At();if(n){Te(n);return}Ee(!0),Te(``);try{let n=jt();if(a){let r=await de({...n,id:F.trim().toLowerCase()});E({type:`success`,title:e(`modelPoolSaved`)}),t(`/model-pool/${r.id}`,{replace:!0})}else{let t=await fe(s,n);ut(t),E({type:`success`,title:e(`modelPoolSaved`)})}}catch(e){Te(e instanceof Error?e.message:String(e))}finally{Ee(!1)}}let Nt=(0,k.useCallback)(async()=>{let t=rt(W,X);if(t){J(null),K(e(_t[t]));return}let n=++lt.current;ot(!0),K(``);try{let e=await le({id:X||`preview`,strategy:R,document:at(W),message:Ge.trim()});if(lt.current!==n)return;J(e),K(``)}catch(e){if(lt.current!==n)return;J(null),K(e instanceof Error?e.message:String(e))}finally{lt.current===n&&ot(!1)}},[W,Ge,X,R,e]);(0,k.useEffect)(()=>{lt.current+=1,J(null),K(``),ot(!1)},[W,R,Ge]);let Pt=(0,k.useMemo)(()=>St(W,Ge,A,S,e),[S,W,Ge,A,e]),Ft=(0,k.useMemo)(()=>q?q.attempts.map((t,n)=>({id:t.id||`${t.provider}-${t.model}-${n}`,title:D(t.provider,t.region||``,e),detail:t.model?mt(A,t.model):``,note:t.status===`skipped`?t.reason===`no ready account`?e(`modelPoolNoReady`):t.reason||e(`modelPoolCanvasSkip`):``,provider:t.provider})):st?[]:Pt.rows,[Pt.rows,A,q,st,e]),It=q?q.path:st?``:Pt.path;return m?(0,P.jsx)(T,{className:`h-64 w-full rounded-xl`}):l?(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,P.jsxs)(`div`,{className:`sticky top-0 z-20 -mx-3 flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-separator bg-background px-3 py-2 sm:-mx-4 sm:px-4 lg:-mx-5 lg:px-5 xl:static xl:mx-0 xl:px-0`,children:[(0,P.jsxs)(u,{variant:`ghost`,onPress:()=>t(`/model-pool`),children:[(0,P.jsx)(ye,{size:16}),e(`modelPoolBack`)]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(y,{isSelected:L,ariaLabel:e(`modelPoolEnabled`),label:e(`modelPoolEnabled`),onChange:Oe,isDisabled:M}),(0,P.jsx)(u,{onPress:()=>void Mt(),isPending:M,children:e(`save`)})]})]}),(0,P.jsxs)(`div`,{className:`grid shrink-0 gap-4 sm:grid-cols-2 sm:max-w-3xl`,children:[a?(0,P.jsx)(Q,{label:e(`modelPoolId`),hint:e(`modelPoolIdHint`),children:(0,P.jsx)(h,{className:`mono`,value:F,onChange:e=>I(e.target.value),placeholder:`my-claude`,"aria-label":e(`modelPoolId`),disabled:M,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})}):(0,P.jsx)(Q,{label:e(`modelPoolId`),hint:e(`modelPoolIdLocked`),children:(0,P.jsx)(`p`,{className:`mono truncate pt-2 text-body text-foreground`,children:s})}),(0,P.jsx)(Q,{label:e(`modelPoolName`),hint:e(`modelPoolNameHint`),children:(0,P.jsx)(h,{value:N,onChange:e=>De(e.target.value),placeholder:e(`modelPoolNamePh`),"aria-label":e(`modelPoolName`),disabled:M})})]}),we?(0,P.jsx)(f,{status:`danger`,title:we}):null,Se?(0,P.jsx)(f,{status:`danger`,title:e(`modelPoolMissing`)}):null,_e?(0,P.jsx)(T,{className:`min-h-[420px] w-full flex-1 rounded-xl`}):Se||!be?null:(0,P.jsxs)(`div`,{className:`grid items-start gap-4 xl:min-h-0 xl:flex-1 xl:grid-cols-[minmax(0,1fr)_22rem] xl:items-stretch`,children:[(0,P.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-2`,children:[(0,P.jsx)(`div`,{className:`relative min-h-[360px] xl:min-h-0 xl:flex-1`,children:(0,P.jsx)(`div`,{className:`xl:absolute xl:inset-0`,children:(0,P.jsx)(je,{steps:W.steps,selected:G,strategyTitle:e(`modelPoolStrategy_${R}`),strategyLine:e(`modelPoolStrategyNote`),strategyChips:[{text:Ae?e(`modelPoolFailoverOn`,{count:z}):e(`modelPoolFailoverOff`),tone:`plain`},{text:e(`modelPoolSeatCount`,{count:W.steps.length}),tone:`plain`}],requestTitle:N.trim()||(a?F.trim()||e(`modelPoolEntryDetail`):s),requestToken:wt(N,a?F:s),skipped:Ct,busy:M,labels:{request:e(`modelPoolEntryTitle`),requestLine:e(`modelPoolEntryNote`),strategyKind:e(`modelPoolStrategyNode`),model:e(`modelPoolStepProvider`),modelLine:e(`modelPoolStepProviderDetail`),group:e(`modelPoolStepGroup`),groupLine:e(`modelPoolStepGroupDetail`),intent:e(`modelPoolStepIntent`),intentLine:e(`modelPoolStepIntentDetail`),add:e(`modelPoolAddSeat`),remove:e(`modelPoolRemoveSeat`),hint:e(`modelPoolEntryHint`),palette:e(`modelPoolCanvasPalette`),incomplete:e(`modelPoolCanvasIncomplete`),skipped:e(`modelPoolCanvasSkip`),fit:e(`modelPoolCanvasFit`),zoomIn:e(`modelPoolCanvasZoomIn`),zoomOut:e(`modelPoolCanvasZoomOut`),drag:e(`modelPoolDragSeat`)},describe:t=>Tt(t,R===`fill-first`,e,A,S,j),onSelectStrategy:()=>ze(Ve),onSelect:ze,onInsert:Et,onMove:Dt,onRemove:e=>{Y(t=>Xe(t,e)),ze(Ve)}})})}),(0,P.jsxs)(`section`,{className:`shrink-0 rounded-xl bg-surface-secondary p-1.5`,children:[(0,P.jsx)(te,{"aria-label":e(`modelPoolPreview`),className:`w-full`,children:(0,P.jsxs)(g,{className:`w-full`,fullWidth:!0,children:[(0,P.jsx)(g.Input,{value:Ge,onChange:e=>Ke(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Nt()},placeholder:e(`modelPoolPreviewPh`),"aria-label":e(`modelPoolPreview`),title:e(`modelPoolPreviewHint`)}),(0,P.jsx)(g.Suffix,{children:(0,P.jsx)(u,{size:`sm`,variant:`secondary`,onPress:()=>void Nt(),isPending:it,children:e(`modelPoolPreviewRun`)})})]})}),It?(0,P.jsxs)(`p`,{className:`mt-1.5 px-1.5 text-caption text-muted`,children:[e(`modelPoolPreviewPath`),` · `,It]}):null,q&&q.attempts.length===0?(0,P.jsx)(`p`,{className:`mt-1.5 px-1.5 text-caption text-muted`,children:e(`modelPoolPreviewNoCandidate`)}):null,st?(0,P.jsx)(`div`,{className:`mt-1.5`,children:(0,P.jsx)(f,{status:`danger`,title:st})}):null,Ft.length?(0,P.jsx)(`ol`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:Ft.map((e,t)=>(0,P.jsxs)(`li`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-lg bg-surface px-2 py-1 text-caption`,children:[(0,P.jsx)(`span`,{className:`mono text-muted`,children:String(t+1).padStart(2,`0`)}),e.provider?(0,P.jsx)(ce,{provider:e.provider,size:14}):null,(0,P.jsx)(`span`,{className:`truncate`,children:e.title}),e.detail?(0,P.jsx)(`span`,{className:`truncate text-muted`,children:e.detail}):null,e.note?(0,P.jsx)(`span`,{className:`truncate text-muted`,children:e.note}):null]},e.id))}):null]})]}),(0,P.jsx)(p,{className:`min-h-0 p-4 xl:overflow-y-auto`,children:(0,P.jsxs)(`div`,{className:`space-y-4`,children:[G===`strategy`||G==null?(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(`h2`,{className:`text-body font-semibold`,children:e(`modelPoolStrategyNode`)}),(0,P.jsx)(Q,{label:e(`modelPoolStrategy`),hint:e(`modelPoolStrategyHint`),children:(0,P.jsx)(O,{value:R,onChange:ke,ariaLabel:e(`modelPoolStrategy`),options:ht,className:`w-full`})}),(0,P.jsxs)(Q,{label:e(`modelPoolFailover`),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(y,{isSelected:Ae,ariaLabel:e(`modelPoolFailover`),onChange:Me,isDisabled:M}),(0,P.jsx)(_,{value:z,onChange:e=>Ne(e??3),minValue:1,maxValue:64,isDisabled:M||!Ae,children:(0,P.jsxs)(_.Group,{children:[(0,P.jsx)(_.DecrementButton,{}),(0,P.jsx)(_.Input,{"aria-label":e(`modelPoolMaxAttempts`)}),(0,P.jsx)(_.IncrementButton,{})]})})]}),(0,P.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:e(`modelPoolMaxAttemptsHint`)})]})]}):null,$?.kind===`member`?(0,P.jsx)(bt,{step:$,t:e,busy:M,showWeight:R===`fill-first`,providers:Z,regions:ft(ie,j,$.provider||``),models:pt(A,$.provider||``,$.region||``,e),accounts:j,onChange:e=>Y(t=>Ze(t,$.id,e))}):null,$?.kind===`group`?(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(`h2`,{className:`text-body font-semibold`,children:e(`modelPoolStepGroup`)}),(0,P.jsx)(Q,{label:e(`modelPoolNestedPool`),hint:e(`modelPoolStepGroupDetail`),children:(0,P.jsx)(O,{value:$.aggregation_id||``,onChange:e=>Y(t=>Ze(t,$.id,{aggregation_id:e})),ariaLabel:e(`modelPoolNestedPool`),options:vt,className:`w-full`})}),R===`fill-first`?(0,P.jsx)(yt,{t:e,busy:M,value:$.weight||100,onChange:e=>Y(t=>Ze(t,$.id,{weight:e}))}):null]}):null,$?.kind===`branch`?(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,P.jsx)(`h2`,{className:`text-body font-semibold`,children:e(`modelPoolStepIntent`)}),(0,P.jsxs)(u,{size:`sm`,variant:`ghost`,onPress:()=>Y(t=>et(t,$.id,e(`modelPoolPathMatch`))),children:[(0,P.jsx)(i,{size:14}),e(`modelPoolAddPath`)]})]}),(0,P.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:e(`modelPoolStepIntentDetail`)}),(0,P.jsx)(Q,{label:e(`modelPoolClassifier`),hint:e(`modelPoolClassifierHint`),children:(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(O,{value:$.classifier?.provider||``,onChange:e=>Y(t=>Ze(t,$.id,{classifier:e?{provider:e,region:``,model:``}:void 0})),ariaLabel:e(`modelPoolProvider`),options:[{id:``,label:e(`modelPoolClassifierOff`)},...Z],className:`w-full`}),(0,P.jsx)(O,{value:$.classifier?.region||``,onChange:e=>Y(t=>Ze(t,$.id,{classifier:{provider:$.classifier?.provider||``,region:e,model:``}})),ariaLabel:e(`modelPoolRegion`),options:[{id:``,label:e(`modelPoolAnyRegion`)},...ft(ie,j,$.classifier?.provider||``)],className:`w-full`}),(0,P.jsx)(O,{value:$.classifier?.model||``,onChange:e=>Y(t=>Ze(t,$.id,{classifier:{provider:$.classifier?.provider||``,region:$.classifier?.region||``,model:e}})),ariaLabel:e(`modelPoolModel`),options:pt(A,$.classifier?.provider||``,$.classifier?.region||``,e),className:`w-full`})]})}),($.paths??[]).map(t=>(0,P.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-surface-secondary p-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,P.jsx)(d,{className:`text-caption text-muted`,children:e(`modelPoolPathLabel`)}),(0,P.jsx)(u,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e(`modelPoolRemovePath`),isDisabled:($.paths?.length??0)<=2,onPress:()=>Y(e=>tt(e,t.id)),children:(0,P.jsx)(o,{size:14})})]}),(0,P.jsx)(h,{value:t.label,"aria-label":e(`modelPoolPathLabel`),onChange:e=>Y(n=>Qe(n,t.id,{label:e.target.value}))}),(0,P.jsx)(Q,{label:e(`modelPoolKeywords`),hint:e(`modelPoolKeywordsHint`),children:(0,P.jsx)(h,{value:Be[t.id]??(t.keywords||[]).join(`, `),"aria-label":e(`modelPoolKeywords`),onChange:e=>{let n=e.target.value;He(e=>({...e,[t.id]:n}));let r=n.split(`,`).map(e=>e.trim()).filter(Boolean);Y(e=>Qe(e,t.id,{keywords:r}))}})}),(0,P.jsx)(Q,{label:e(`modelPoolIntentLabel`),hint:e(`modelPoolIntentHint`),children:(0,P.jsx)(h,{value:t.intent||``,"aria-label":e(`modelPoolIntentLabel`),onChange:e=>Y(n=>Qe(n,t.id,{intent:e.target.value}))})}),(0,P.jsx)(y,{isSelected:!!t.fallback,ariaLabel:e(`modelPoolPathFallback`),label:e(`modelPoolPathFallback`),onChange:e=>{e&&Y(e=>$e(e,t.id))}})]},t.id))]}):null,(0,P.jsx)(ne,{}),(0,P.jsx)(xt,{t:e,busy:M,contextLength:B,maxOutput:V,reasoningOptions:H,reasoningEffort:U,onContext:Pe,onOutput:Fe,onToggle:kt,onOptions:Ot,onEffort:Le})]})})]})]}):(0,P.jsx)(C,{to:`/`,replace:!0})}function Q({label:e,hint:t,children:n}){return(0,P.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,P.jsx)(d,{className:`text-caption text-muted`,children:e}),n,t?(0,P.jsx)(`p`,{className:`text-caption leading-5 text-muted`,children:t}):null]})}function yt({t:e,busy:t,value:n,onChange:r}){return(0,P.jsx)(Q,{label:e(`modelPoolWeight`),hint:e(`modelPoolWeightHint`),children:(0,P.jsx)(_,{value:n,onChange:e=>r(e??100),minValue:1,maxValue:1e6,isDisabled:t,children:(0,P.jsxs)(_.Group,{children:[(0,P.jsx)(_.DecrementButton,{}),(0,P.jsx)(_.Input,{"aria-label":e(`modelPoolWeight`)}),(0,P.jsx)(_.IncrementButton,{})]})})})}function bt({step:e,t,busy:n,showWeight:r,providers:i,regions:a,models:o,accounts:s,onChange:c}){let l=it(e),u=$(s,e.provider||``,e.region||``),d=o.filter(e=>e.id);function f(e){c({account_ids:e,account_id:e.length===1?e[0]:void 0})}return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsx)(`h2`,{className:`text-body font-semibold`,children:t(`modelPoolStepProvider`)}),(0,P.jsx)(Q,{label:t(`modelPoolProvider`),children:(0,P.jsx)(O,{value:e.provider||``,onChange:e=>c({provider:e,region:``,model:``,account_id:void 0,account_ids:[]}),ariaLabel:t(`modelPoolProvider`),options:i,className:`w-full`})}),a.length>1?(0,P.jsx)(Q,{label:t(`modelPoolRegion`),children:(0,P.jsx)(O,{value:e.region||``,onChange:t=>{let n=new Set($(s,e.provider||``,t).map(e=>e.id)),r=l.filter(e=>n.has(e));c({region:t,model:``,account_ids:r,account_id:r.length===1?r[0]:void 0})},ariaLabel:t(`modelPoolRegion`),options:[{id:``,label:t(`modelPoolAnyRegion`)},...a],className:`w-full`})}):null,e.provider?(0,P.jsx)(Q,{label:t(`modelPoolAccounts`),hint:t(`modelPoolAccountsHint`),children:(0,P.jsx)(F,{accounts:u,selected:l,busy:n,t,onChange:f})}):null,(0,P.jsx)(Q,{label:t(`modelPoolModel`),children:(0,P.jsx)(O,{value:e.model||``,onChange:e=>c({model:e}),ariaLabel:t(`modelPoolModel`),options:d.length?d:[{id:``,label:t(`modelPoolNoModels`)}],className:`w-full`,isDisabled:!e.provider||d.length===0})}),r?(0,P.jsx)(yt,{t,busy:n,value:e.weight||100,onChange:e=>c({weight:e})}):null]})}function xt({t:e,busy:t,contextLength:n,maxOutput:i,reasoningOptions:a,reasoningEffort:o,onContext:s,onOutput:c,onToggle:l,onOptions:u,onEffort:d}){return(0,P.jsxs)(`div`,{className:`space-y-4`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:`text-body font-semibold`,children:e(`modelPoolCapabilities`)}),(0,P.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`modelPoolCapabilitiesHint`)})]}),(0,P.jsx)(Q,{label:e(`modelPoolContextLength`),hint:e(`modelPoolContextLengthHint`),children:(0,P.jsx)(_,{value:n,onChange:e=>s(e??0),minValue:0,maxValue:4e6,isDisabled:t,children:(0,P.jsxs)(_.Group,{children:[(0,P.jsx)(_.DecrementButton,{}),(0,P.jsx)(_.Input,{"aria-label":e(`modelPoolContextLength`)}),(0,P.jsx)(_.IncrementButton,{})]})})}),(0,P.jsx)(Q,{label:e(`modelPoolMaxOutput`),hint:e(`modelPoolMaxOutputHint`),children:(0,P.jsx)(_,{value:i,onChange:e=>c(e??0),minValue:0,maxValue:4e6,isDisabled:t,children:(0,P.jsxs)(_.Group,{children:[(0,P.jsx)(_.DecrementButton,{}),(0,P.jsx)(_.Input,{"aria-label":e(`modelPoolMaxOutput`)}),(0,P.jsx)(_.IncrementButton,{})]})})}),(0,P.jsx)(Q,{label:e(`modelPoolReasoningLevels`),hint:e(`modelPoolReasoningLevelsHint`),children:(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsxs)(`div`,{className:`flex min-h-5 items-center justify-between gap-3`,children:[(0,P.jsx)(`span`,{className:`text-caption text-muted`,children:a.length?e(`modelPoolReasoningSelected`,{n:a.length,total:ht.length}):e(`modelPoolReasoningEmpty`)}),(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[(0,P.jsx)(`button`,{type:`button`,className:`text-caption text-muted underline-offset-2 transition-colors hover:text-foreground hover:underline disabled:cursor-not-allowed disabled:opacity-40`,disabled:t,onClick:()=>u([...ht]),children:e(`modelPoolReasoningSelectAll`)}),(0,P.jsx)(`button`,{type:`button`,className:`text-caption text-muted underline-offset-2 transition-colors hover:text-foreground hover:underline disabled:cursor-not-allowed disabled:opacity-40`,disabled:t||a.length===0,onClick:()=>u([]),children:e(`modelPoolReasoningClear`)})]})]}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":e(`modelPoolReasoningLevels`),children:ht.map(n=>{let i=a.includes(n);return(0,P.jsxs)(`label`,{className:`inline-flex select-none items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-caption transition-colors ${i?`border-accent/50 bg-accent-soft text-foreground`:`border-foreground/15 bg-surface-secondary/40 text-muted hover:bg-surface-secondary`} ${t?`cursor-not-allowed opacity-50`:`cursor-pointer`}`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`sr-only`,checked:i,disabled:t,"aria-label":`${e(`modelPoolReasoningLevels`)} ${n}`,onChange:()=>l(n)}),(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-3.5 shrink-0 place-items-center rounded border ${i?`border-accent bg-accent text-accent-foreground`:`border-foreground/25 bg-transparent`}`,children:i?(0,P.jsx)(r,{size:10,weight:`bold`}):null}),(0,P.jsx)(`span`,{className:`mono`,children:n})]},n)})})]})}),(0,P.jsx)(Q,{label:e(`modelPoolReasoningDefault`),hint:e(`modelPoolReasoningDefaultHint`),children:(0,P.jsx)(O,{value:o,onChange:d,ariaLabel:e(`modelPoolReasoningDefault`),options:[{id:``,label:e(`modelPoolReasoningAuto`)},...a.map(e=>({id:e,label:e}))],className:`w-full`,isDisabled:t||a.length===0})})]})}function St(e,t,n,r,i){let a=[],o=``,s=e=>{for(let c of e)if(c.kind===`member`)a.push({id:c.id,title:c.provider?D(c.provider,c.region||``,i):i(`modelPoolStepProvider`),detail:c.model?mt(n,c.model):i(`modelPoolCanvasIncomplete`),note:``,provider:c.provider||void 0});else if(c.kind===`group`){let e=r.find(e=>e.id===c.aggregation_id);a.push({id:c.id,title:e?.name||c.aggregation_id||i(`modelPoolStepGroup`),detail:c.aggregation_id?``:i(`modelPoolCanvasIncomplete`),note:``})}else if(c.kind===`branch`){let e=Ct(c,t);!o&&e.label&&(o=e.label),s(e.steps)}};return s(e.steps),{rows:a,path:o}}function Ct(e,t){let n=e.paths??[],r=t.toLowerCase();for(let e of n)if(!e.fallback)for(let t of e.keywords??[]){let n=t.trim().toLowerCase();if(n&&r.includes(n))return{steps:e.steps,label:e.label}}let i=n.find(e=>e.fallback);if(i)return{steps:i.steps,label:i.label};let a=n[n.length-1];return{steps:a?.steps??[],label:a?.label??``}}function wt(e,t){let n=t.trim();if(!(!n||n===e.trim()))return n}function Tt(e,t,n,r,i,a){let o=t?n(`modelPoolWeightNote`,{weight:e.weight||100}):``;if(e.kind===`group`){let t=i.find(t=>t.id===e.aggregation_id),r=!!e.aggregation_id;return{title:t?.name||e.aggregation_id||n(`modelPoolStepGroup`),detail:n(r?`modelPoolStepGroupNote`:`modelPoolStepGroupDetail`),note:r?``:n(`modelPoolStepGroupNote`),facts:r?[n(`modelPoolSeatCount`,{count:t?.members.length??0}),o].filter(Boolean):[],chips:r?[{text:e.aggregation_id||``,tone:`plain`}]:[]}}if(e.kind===`branch`){let t=(e.paths??[]).map(e=>e.label).filter(Boolean);return{title:n(`modelPoolStepIntent`),detail:n(`modelPoolStepIntentNote`),note:``,facts:[n(`modelPoolPathCount`,{count:t.length})],chips:[...e.classifier?.model?[{text:mt(r,e.classifier.model),tone:`model`}]:[],...t.map(e=>({text:e,tone:`plain`}))]}}let s=it(e),c=$(a,e.provider||``,e.region||``),l=s.map(e=>a.find(t=>t.id===e)?.name||e);return e.provider?{title:D(e.provider,e.region||``,n),detail:``,note:``,facts:[s.length===0?n(`modelPoolSeatOrderAll`):n(`modelPoolSeatOrderPicked`),s.length===0?``:n(`modelPoolAccountsCount`,{count:s.length}),o].filter(Boolean),chips:[...e.model?[{text:mt(r,e.model),tone:`model`}]:[],...l.length===0?[{text:c.length?n(`modelPoolAccountsAllCount`,{count:c.length}):n(`modelPoolAccountsAll`),tone:`account`}]:l.map(e=>({text:e,tone:`account`}))]}:{title:n(`modelPoolStepProvider`),detail:n(`modelPoolStepProviderDetail`),note:n(`modelPoolStepProviderDetail`),facts:[],chips:[]}}function $(e,t,n){if(!t)return[];let r=X(t),i=n?Z(n):``;return e.filter(e=>e.enabled!==!1&&X(e.provider)===r).filter(e=>!i||Z(e.region)===i).sort((e,t)=>(e.priority??0)-(t.priority??0)||(e.name||e.id).localeCompare(t.name||t.id))}export{vt as ModelPoolEditorPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/ModelPoolPage-B2h7PTH3.js b/internal/webui/static/assets/ModelPoolPage-lIQOHGTF.js similarity index 89% rename from internal/webui/static/assets/ModelPoolPage-B2h7PTH3.js rename to internal/webui/static/assets/ModelPoolPage-lIQOHGTF.js index 75d3f63ab..3df25d58c 100644 --- a/internal/webui/static/assets/ModelPoolPage-B2h7PTH3.js +++ b/internal/webui/static/assets/ModelPoolPage-lIQOHGTF.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./ArrowUp.es-C5DPjo_d.js";import{t as i}from"./Plus.es-BPfWzgUg.js";import{t as a}from"./TrashSimple.es-CiBYahWn.js";import{n as o,r as s}from"./useI18n-XrvNxGvP.js";import{t as c}from"./PageAlert-BbN7e2aZ.js";import{t as l}from"./ConfirmDialog-DCaOykOx.js";import{n as u}from"./useToggle-55_Qx9vA.js";import{t as d}from"./EmptyPanel-Bs-jQMvG.js";import{t as f}from"./CompactSwitch-Dd3U4EbK.js";import{t as p}from"./table-iJwxYVe4.js";import{Jt as m,N as h,Xt as g,m as _,n as v,t as y}from"./index-CAlyInAP.js";import{i as b,o as x,r as S}from"./modelPools-B7KkTfYF.js";var C=t(e(),1),w=n();function T(e,t){return t(`modelPoolStrategy_${e}`)}function E(){let{t:e}=o(),t=g(),{enabled:n,loading:E}=v(),[D,O]=(0,C.useState)([]),[k,A]=(0,C.useState)(!0),[j,M]=(0,C.useState)(``),[N,P]=(0,C.useState)(null),[F,I]=(0,C.useState)(!1),L=(0,C.useCallback)(async()=>{A(!0);try{let e=await b();O(e.data||[]),M(``)}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}},[]);(0,C.useEffect)(()=>{!n||E||L()},[n,E,L]);async function R(t,n){let r=t.enabled;O(e=>e.map(e=>e.id===t.id?{...e,enabled:n}:e));try{let r=await x(t.id,{enabled:n});O(e=>e.map(e=>e.id===t.id?r:e)),y({type:`success`,title:e(`modelPoolSaved`)})}catch(e){O(e=>e.map(e=>e.id===t.id?{...e,enabled:r}:e)),y({type:`error`,title:e instanceof Error?e.message:String(e)})}}async function z(){if(N){I(!0);try{await S(N.id),O(e=>e.filter(e=>e.id!==N.id)),y({type:`success`,title:e(`modelPoolDeleted`)}),P(null)}catch(e){y({type:`error`,title:e instanceof Error?e.message:String(e)})}finally{I(!1)}}}return E?(0,w.jsx)(_,{className:`h-64 w-full rounded-xl`}):n?(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-4 pb-4`,children:(0,w.jsxs)(s,{onPress:()=>t(`/model-pool/new`),children:[(0,w.jsx)(i,{size:16}),e(`modelPoolCreate`)]})}),j?(0,w.jsx)(c,{status:`danger`,title:j}):null,(0,w.jsx)(u,{className:`overflow-hidden`,children:k?(0,w.jsxs)(`div`,{className:`space-y-3 p-5`,children:[(0,w.jsx)(_,{className:`h-10 w-full`}),(0,w.jsx)(_,{className:`h-10 w-full`}),(0,w.jsx)(_,{className:`h-10 w-full`})]}):D.length===0?(0,w.jsx)(d,{title:e(`modelPoolEmpty`),hint:e(`modelPoolEmptyHint`),icon:(0,w.jsx)(r,{size:28})}):(0,w.jsx)(p,{children:(0,w.jsx)(p.ScrollContainer,{children:(0,w.jsxs)(p.Content,{"aria-label":e(`modelPoolTitle`),children:[(0,w.jsxs)(p.Header,{children:[(0,w.jsx)(p.Column,{children:e(`modelPoolColName`)}),(0,w.jsx)(p.Column,{children:e(`modelPoolColStrategy`)}),(0,w.jsx)(p.Column,{children:e(`modelPoolColMembers`)}),(0,w.jsx)(p.Column,{children:e(`modelPoolColFailover`)}),(0,w.jsx)(p.Column,{children:e(`modelPoolColEnabled`)}),(0,w.jsx)(p.Column,{children:e(`modelPoolColActions`)})]}),(0,w.jsx)(p.Body,{children:D.map(n=>(0,w.jsxs)(p.Row,{children:[(0,w.jsx)(p.Cell,{children:(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`div`,{className:`mono font-medium`,children:n.id}),(0,w.jsx)(`div`,{className:`truncate text-caption text-muted`,children:n.name})]})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(h,{size:`sm`,variant:`soft`,children:T(n.strategy,e)})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(`span`,{className:`mono text-caption`,children:n.members.length})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(`span`,{className:`text-caption text-muted`,children:n.allow_fallbacks?e(`modelPoolFailoverOn`,{count:n.max_attempts}):e(`modelPoolFailoverOff`)})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(f,{isSelected:n.enabled,ariaLabel:`${e(`modelPoolColEnabled`)} ${n.id}`,onChange:e=>void R(n,e)})}),(0,w.jsx)(p.Cell,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(s,{size:`sm`,variant:`ghost`,onPress:()=>t(`/model-pool/${n.id}`),children:e(`edit`)}),(0,w.jsx)(s,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e(`delete`),onPress:()=>P(n),children:(0,w.jsx)(a,{size:16})})]})})]},n.id))})]})})})}),(0,w.jsx)(l,{isOpen:!!N,title:e(`modelPoolDeleteTitle`),description:N?e(`modelPoolDeleteDesc`,{name:N.name}):``,confirmLabel:e(`delete`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:F,onClose:()=>P(null),onConfirm:()=>void z()})]}):(0,w.jsx)(m,{to:`/`,replace:!0})}export{E as ModelPoolPage}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./ArrowUp.es-4Hv09PbZ.js";import{t as i}from"./Plus.es-DsoFTrCh.js";import{t as a}from"./TrashSimple.es-KG9lGXYp.js";import{n as o,r as s}from"./useI18n-BAo1UrJW.js";import{t as c}from"./PageAlert-4fxVtrfI.js";import{t as l}from"./ConfirmDialog-BzgkrQpc.js";import{n as u}from"./useToggle-DpH7h_oD.js";import{t as d}from"./EmptyPanel-Bs-jQMvG.js";import{t as f}from"./CompactSwitch-D0aW-Phm.js";import{t as p}from"./table-B2nk0cjc.js";import{Jt as m,N as h,Xt as g,m as _,n as v,t as y}from"./index-CWTBzWuK.js";import{i as b,o as x,r as S}from"./modelPools-B7KkTfYF.js";var C=t(e(),1),w=n();function T(e,t){return t(`modelPoolStrategy_${e}`)}function E(){let{t:e}=o(),t=g(),{enabled:n,loading:E}=v(),[D,O]=(0,C.useState)([]),[k,A]=(0,C.useState)(!0),[j,M]=(0,C.useState)(``),[N,P]=(0,C.useState)(null),[F,I]=(0,C.useState)(!1),L=(0,C.useCallback)(async()=>{A(!0);try{let e=await b();O(e.data||[]),M(``)}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}},[]);(0,C.useEffect)(()=>{!n||E||L()},[n,E,L]);async function R(t,n){let r=t.enabled;O(e=>e.map(e=>e.id===t.id?{...e,enabled:n}:e));try{let r=await x(t.id,{enabled:n});O(e=>e.map(e=>e.id===t.id?r:e)),y({type:`success`,title:e(`modelPoolSaved`)})}catch(e){O(e=>e.map(e=>e.id===t.id?{...e,enabled:r}:e)),y({type:`error`,title:e instanceof Error?e.message:String(e)})}}async function z(){if(N){I(!0);try{await S(N.id),O(e=>e.filter(e=>e.id!==N.id)),y({type:`success`,title:e(`modelPoolDeleted`)}),P(null)}catch(e){y({type:`error`,title:e instanceof Error?e.message:String(e)})}finally{I(!1)}}}return E?(0,w.jsx)(_,{className:`h-64 w-full rounded-xl`}):n?(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-4 pb-4`,children:(0,w.jsxs)(s,{onPress:()=>t(`/model-pool/new`),children:[(0,w.jsx)(i,{size:16}),e(`modelPoolCreate`)]})}),j?(0,w.jsx)(c,{status:`danger`,title:j}):null,(0,w.jsx)(u,{className:`overflow-hidden`,children:k?(0,w.jsxs)(`div`,{className:`space-y-3 p-5`,children:[(0,w.jsx)(_,{className:`h-10 w-full`}),(0,w.jsx)(_,{className:`h-10 w-full`}),(0,w.jsx)(_,{className:`h-10 w-full`})]}):D.length===0?(0,w.jsx)(d,{title:e(`modelPoolEmpty`),hint:e(`modelPoolEmptyHint`),icon:(0,w.jsx)(r,{size:28})}):(0,w.jsx)(p,{children:(0,w.jsx)(p.ScrollContainer,{children:(0,w.jsxs)(p.Content,{"aria-label":e(`modelPoolTitle`),children:[(0,w.jsxs)(p.Header,{children:[(0,w.jsx)(p.Column,{children:e(`modelPoolColName`)}),(0,w.jsx)(p.Column,{children:e(`modelPoolColStrategy`)}),(0,w.jsx)(p.Column,{children:e(`modelPoolColMembers`)}),(0,w.jsx)(p.Column,{children:e(`modelPoolColFailover`)}),(0,w.jsx)(p.Column,{children:e(`modelPoolColEnabled`)}),(0,w.jsx)(p.Column,{children:e(`modelPoolColActions`)})]}),(0,w.jsx)(p.Body,{children:D.map(n=>(0,w.jsxs)(p.Row,{children:[(0,w.jsx)(p.Cell,{children:(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`div`,{className:`mono font-medium`,children:n.id}),(0,w.jsx)(`div`,{className:`truncate text-caption text-muted`,children:n.name})]})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(h,{size:`sm`,variant:`soft`,children:T(n.strategy,e)})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(`span`,{className:`mono text-caption`,children:n.members.length})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(`span`,{className:`text-caption text-muted`,children:n.allow_fallbacks?e(`modelPoolFailoverOn`,{count:n.max_attempts}):e(`modelPoolFailoverOff`)})}),(0,w.jsx)(p.Cell,{children:(0,w.jsx)(f,{isSelected:n.enabled,ariaLabel:`${e(`modelPoolColEnabled`)} ${n.id}`,onChange:e=>void R(n,e)})}),(0,w.jsx)(p.Cell,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(s,{size:`sm`,variant:`ghost`,onPress:()=>t(`/model-pool/${n.id}`),children:e(`edit`)}),(0,w.jsx)(s,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":e(`delete`),onPress:()=>P(n),children:(0,w.jsx)(a,{size:16})})]})})]},n.id))})]})})})}),(0,w.jsx)(l,{isOpen:!!N,title:e(`modelPoolDeleteTitle`),description:N?e(`modelPoolDeleteDesc`,{name:N.name}):``,confirmLabel:e(`delete`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:F,onClose:()=>P(null),onConfirm:()=>void z()})]}):(0,w.jsx)(m,{to:`/`,replace:!0})}export{E as ModelPoolPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/OverviewPage-Bx7MkU6l.js b/internal/webui/static/assets/OverviewPage-DuUzTTx-.js similarity index 97% rename from internal/webui/static/assets/OverviewPage-Bx7MkU6l.js rename to internal/webui/static/assets/OverviewPage-DuUzTTx-.js index dcb00b903..f7ddb0d07 100644 --- a/internal/webui/static/assets/OverviewPage-Bx7MkU6l.js +++ b/internal/webui/static/assets/OverviewPage-DuUzTTx-.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TrafficChart-JowzXflw.js","assets/shim-mfK0Rmj6.js","assets/format-FfdyoNtB.js","assets/SharedElementTransition-BlCsXfb1.js","assets/label-B8hTan2F.js","assets/useI18n-XrvNxGvP.js","assets/index-CAlyInAP.js","assets/overview-ARhe2pSk.js","assets/gsap-DWxn8li7.js","assets/index-ORXBmquE.css","assets/AreaChart-BDsZfavt.js","assets/XAxis-D-mwlVQJ.js","assets/FilterToggle-BoD7X2r2.js"])))=>i.map(i=>d[i]); -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r,i,n as a,o,r as s,t as c}from"./InflightLiveCard-BN45lDqh.js";import{t as ee}from"./CaretRight.es-CeI6iKxy.js";import{n as te,pt as l,r as ne}from"./useI18n-XrvNxGvP.js";import{s as re}from"./TimeRangePicker-BqQpwy0D.js";import{t as ie}from"./PageAlert-BbN7e2aZ.js";import{n as u}from"./useToggle-55_Qx9vA.js";import{c as d,i as f,n as p,s as m}from"./format-FfdyoNtB.js";import{d as ae,m as oe}from"./overview-ARhe2pSk.js";import{t as h}from"./gsap-DWxn8li7.js";import{$t as g,N as se,O as ce,Xt as le,g as ue,k as de,m as _,p as v,qt as fe,u as pe,w as me}from"./index-CAlyInAP.js";import{Tt as he,a as y,r as b,t as x}from"./AreaChart-BDsZfavt.js";import{t as S}from"./ProviderMark-C49bIWJW.js";import{n as ge,t as C}from"./provider-BZvt2HHB.js";import{a as _e,i as ve,n as ye,o as be,r as xe,t as Se}from"./logsLink-CBayP8Zl.js";var w=t(e(),1),T=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236,208a12,12,0,0,1-12,12H32a12,12,0,0,1-12-12V48a12,12,0,0,1,24,0v99l43.51-43.52a12,12,0,0,1,17,0L128,127l43-43H160a12,12,0,0,1,0-24h40a12,12,0,0,1,12,12v40a12,12,0,0,1-24,0V101l-51.51,51.52a12,12,0,0,1-17,0L96,129,44,181v15H224A12,12,0,0,1,236,208Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224,64V208H32V48H208A16,16,0,0,1,224,64Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M232,208a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V48a8,8,0,0,1,16,0V156.69l50.34-50.35a8,8,0,0,1,11.32,0L128,132.69,180.69,80H160a8,8,0,0,1,0-16h40a8,8,0,0,1,8,8v40a8,8,0,0,1-16,0V91.31l-58.34,58.35a8,8,0,0,1-11.32,0L96,123.31l-56,56V200H224A8,8,0,0,1,232,208Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM200,192H56a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v76.69l34.34-34.35a8,8,0,0,1,11.32,0L128,132.69,172.69,88H144a8,8,0,0,1,0-16h48a8,8,0,0,1,8,8v48a8,8,0,0,1-16,0V99.31l-50.34,50.35a8,8,0,0,1-11.32,0L104,131.31l-40,40V176H200a8,8,0,0,1,0,16Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230,208a6,6,0,0,1-6,6H32a6,6,0,0,1-6-6V48a6,6,0,0,1,12,0V161.52l53.76-53.76a6,6,0,0,1,8.48,0L128,135.51,185.52,78H160a6,6,0,0,1,0-12h40a6,6,0,0,1,6,6v40a6,6,0,0,1-12,0V86.48l-61.76,61.76a6,6,0,0,1-8.48,0L96,120.49l-58,58V202H224A6,6,0,0,1,230,208Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,208a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V48a8,8,0,0,1,16,0V156.69l50.34-50.35a8,8,0,0,1,11.32,0L128,132.69,180.69,80H160a8,8,0,0,1,0-16h40a8,8,0,0,1,8,8v40a8,8,0,0,1-16,0V91.31l-58.34,58.35a8,8,0,0,1-11.32,0L96,123.31l-56,56V200H224A8,8,0,0,1,232,208Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M228,208a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V48a4,4,0,0,1,8,0V166.34l57.17-57.17a4,4,0,0,1,5.66,0L128,138.34,190.34,76H160a4,4,0,0,1,0-8h40a4,4,0,0,1,4,4v40a4,4,0,0,1-8,0V81.66l-65.17,65.17a4,4,0,0,1-5.66,0L96,117.66l-60,60V204H224A4,4,0,0,1,228,208Z`}))]]),Ce=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M244,128v64a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h35l-67-67-31.51,31.52a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L96,119l31.51-31.52a12,12,0,0,1,17,0L220,163V128a12,12,0,0,1,24,0Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,128v64H168Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M235.06,120.61a8,8,0,0,0-8.72,1.73L200,148.69,141.66,90.34a8,8,0,0,0-11.32,0L96,124.69,29.66,58.34A8,8,0,0,0,18.34,69.66l72,72a8,8,0,0,0,11.32,0L136,107.31,188.69,160l-26.35,26.34A8,8,0,0,0,168,200h64a8,8,0,0,0,8-8V128A8,8,0,0,0,235.06,120.61ZM224,184H187.31L224,147.31Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,128v64a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L188.69,160,136,107.31l-34.34,34.35a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,29.66,58.34L96,124.69l34.34-34.35a8,8,0,0,1,11.32,0L200,148.69l26.34-26.35A8,8,0,0,1,240,128Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M238,128v64a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h49.52L136,104.49l-35.76,35.75a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L96,127.51l35.76-35.75a6,6,0,0,1,8.48,0L226,177.52V128a6,6,0,0,1,12,0Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,128v64a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h44.69L136,107.31l-34.34,34.35a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,29.66,58.34L96,124.69l34.34-34.35a8,8,0,0,1,11.32,0L224,172.69V128a8,8,0,0,1,16,0Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236,128v64a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h54.34L136,101.66,98.83,138.83a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L96,130.34l37.17-37.17a4,4,0,0,1,5.66,0L228,182.34V128a4,4,0,0,1,8,0Z`}))]]),E=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M244,56v64a12,12,0,0,1-24,0V85l-75.51,75.52a12,12,0,0,1-17,0L96,129,32.49,192.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0L136,135l67-67H168a12,12,0,0,1,0-24h64A12,12,0,0,1,244,56Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,56v64L168,56Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M232,48H168a8,8,0,0,0-5.66,13.66L188.69,88,136,140.69l-34.34-34.35a8,8,0,0,0-11.32,0l-72,72a8,8,0,0,0,11.32,11.32L96,123.31l34.34,34.35a8,8,0,0,0,11.32,0L200,99.31l26.34,26.35A8,8,0,0,0,240,120V56A8,8,0,0,0,232,48Zm-8,52.69L187.31,64H224Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,56v64a8,8,0,0,1-13.66,5.66L200,99.31l-58.34,58.35a8,8,0,0,1-11.32,0L96,123.31,29.66,189.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0L136,140.69,188.69,88,162.34,61.66A8,8,0,0,1,168,48h64A8,8,0,0,1,240,56Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M238,56v64a6,6,0,0,1-12,0V70.48l-85.76,85.76a6,6,0,0,1-8.48,0L96,120.49,28.24,188.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0L136,143.51,217.52,62H168a6,6,0,0,1,0-12h64A6,6,0,0,1,238,56Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,56v64a8,8,0,0,1-16,0V75.31l-82.34,82.35a8,8,0,0,1-11.32,0L96,123.31,29.66,189.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0L136,140.69,212.69,64H168a8,8,0,0,1,0-16h64A8,8,0,0,1,240,56Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236,56v64a4,4,0,0,1-8,0V65.66l-89.17,89.17a4,4,0,0,1-5.66,0L96,117.66,26.83,186.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0L136,146.34,222.34,60H168a4,4,0,0,1,0-8h64A4,4,0,0,1,236,56Z`}))]]),D=w.forwardRef((e,t)=>w.createElement(l,{ref:t,...e,weights:T}));D.displayName=`ChartLineUpIcon`;var we=D,O=w.forwardRef((e,t)=>w.createElement(l,{ref:t,...e,weights:Ce}));O.displayName=`TrendDownIcon`;var Te=O,k=w.forwardRef((e,t)=>w.createElement(l,{ref:t,...e,weights:E}));k.displayName=`TrendUpIcon`;var Ee=k,A=n();function De({emptyLabel:e}){return(0,A.jsx)(`div`,{className:`grid min-h-56 place-items-center rounded-lg bg-surface-secondary px-4 text-body text-muted`,children:e})}var j=2500,Oe=Math.round(6e4/j),M=null,N=``,P=[],F=new Set,I=new Set;function L(e){return F.add(e),()=>{F.delete(e)}}function R(e){return I.add(e),()=>{I.delete(e)}}function z(){return M}function B(){return P}function V(e){let t=s(e);t===N&&M||(M=e,N=t,F.forEach(e=>e()))}function ke(e,t){P=[...P,{at:Date.now(),value:e}].slice(-t),I.forEach(e=>e())}function H(){return(0,w.useSyncExternalStore)(L,z,z)}function U(e){let t=e?.intervalMs??2500,n=(0,w.useSyncExternalStore)(L,z,z),r=(0,w.useSyncExternalStore)(R,B,B);return(0,w.useEffect)(()=>{let e=!1,n=null,r=Math.max(Oe,Math.round(6e4/t)),i=()=>{document.hidden||a().then(t=>{e||(V(t),ke(t.in_flight,r))}).catch(()=>{})},o=()=>{n||document.hidden||(i(),n=setInterval(i,t))},s=()=>{n&&clearInterval(n),n=null},c=()=>document.hidden?s():o();return o(),document.addEventListener(`visibilitychange`,c),()=>{e=!0,s(),document.removeEventListener(`visibilitychange`,c)}},[t]),{live:n,samples:r}}function Ae({samples:e,capacity:t,label:n}){let r=e.length?e:[{at:0,value:0}],i=Math.max(1,t,...r.map(e=>e.value));return(0,A.jsx)(`div`,{className:`h-6 w-[120px] shrink-0`,role:`img`,"aria-label":n,children:(0,A.jsx)(he,{width:`100%`,height:`100%`,children:(0,A.jsxs)(x,{data:r,margin:{top:1,right:0,bottom:1,left:0},children:[(0,A.jsx)(b,{hide:!0,domain:[0,i]}),(0,A.jsx)(y,{type:`monotone`,dataKey:`value`,stroke:`var(--foreground)`,strokeOpacity:.7,strokeWidth:1.25,fill:`var(--foreground)`,fillOpacity:.08,isAnimationActive:!1,dot:!1})]})})})}function je({live:e,samples:t,t:n,onConcurrencyClick:r}){let i=e?.in_flight??null,a=e?.capacity??0,o=i!=null&&a>0?i/a:0,s=a>0&&i!=null&&i>=a,c=(0,A.jsxs)(A.Fragment,{children:[n(`liveConcurrency`),(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,A.jsxs)(`span`,{className:`mono tabular text-body font-semibold ${s?`text-warning`:`text-foreground`}`,children:[i??`—`,(0,A.jsxs)(`span`,{className:`font-normal text-muted`,children:[`/`,e?a:`—`]})]}),(0,A.jsx)(`span`,{className:`inline-block h-[3px] w-12 overflow-hidden rounded-[2px] bg-separator`,children:(0,A.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/60`}`,style:{width:`${Math.min(100,o*100)}%`}})})]})]});return(0,A.jsxs)(`div`,{"data-testid":`live-strip`,className:`flex min-h-11 flex-wrap items-center gap-x-5 gap-y-2 overflow-hidden rounded-lg bg-surface-secondary px-4 py-2.5 text-caption text-muted sm:h-11 sm:gap-x-6 sm:gap-y-1 sm:py-0`,children:[(0,A.jsx)(`span`,{className:`inline-flex items-center`,children:(0,A.jsx)(`span`,{className:`status-dot`,"data-state":i==null?``:s?`warn`:i>0?`ok`:``})}),r?(0,A.jsx)(`button`,{type:`button`,"data-testid":`live-strip-concurrency`,onClick:r,className:`inline-flex flex-col gap-1 rounded-lg text-left outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-focus sm:flex-row sm:items-center sm:gap-2`,"aria-label":n(`inflightExpandFromConcurrency`),children:c}):(0,A.jsx)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:c}),(0,A.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveRpm`),(0,A.jsx)(`span`,{className:`mono tabular text-body font-semibold text-foreground`,children:e?.rpm??`—`})]}),(0,A.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveTrace`),(0,A.jsx)(Ae,{samples:t,capacity:a,label:n(`liveTrace`)})]})]})}function Me({fallback:e}){let t=H()?.in_flight??e;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`mono text-section font-semibold`,children:t}),t?(0,A.jsx)(`span`,{className:`status-dot`,"data-state":`ok`}):null]})}function Ne({id:e,fallbackInFlight:t,fallbackMax:n,label:r,saturatedLabel:i}){let a=H()?.accounts.find(t=>t.id===e),o=a?.in_flight??t,s=a?.max_inflight||n||4,c=o>=s;return(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:c?i:r,"data-testid":`account-inflight`,children:[(0,A.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:r}),(0,A.jsxs)(`span`,{className:`mono text-caption tabular ${c?`text-warning`:`text-muted`}`,children:[o,`/`,s]}),(0,A.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,A.jsx)(`span`,{className:`block h-full ${c?`bg-warning`:`bg-foreground/50`}`,style:{width:`${Math.min(100,s>0?o/s*100:0)}%`}})})]})}var Pe=(0,w.lazy)(()=>g(()=>import(`./TrafficChart-JowzXflw.js`).then(e=>({default:e.TrafficChart})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),Fe=3e4,Ie=3e4,Le={window:{from:``,to:``,hours:24},totals:{requests:0,ok:0,incomplete:0,error:0,canceled:0,streaming:0,success_rate:0},latency:{},tokens:{prompt:0,completion:0,cache_read:0,total:0},status:[],errors:[],models:[],accounts:[],providers:[],series:[]};function Re(e,t){return!e||e===`(unknown)`?t(`statsUnknown`):C(e,t)}function ze(e,t,n){return!t||t===`(unassigned)`?n:e.find(e=>e.id===t)?.name||t}var Be=new Set([`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`]);function Ve(e,t){let n={quota:`logsKindQuota`,rate_limit:`logsKindRateLimit`,auth:`logsKindAuth`,not_ready:`logsKindNotReady`,unavailable:`logsKindUnavailable`,invalid_request:`logsKindInvalidRequest`,model_not_available:`logsKindModelNotAvailable`};return n[e]?t(n[e]):e}var He=[`ok`,`incomplete`,`error`,`canceled`],W={ok:`bg-success`,incomplete:`bg-warning`,error:`bg-danger`,canceled:`bg-muted`},Ue={ok:`logsFilterOk`,incomplete:`logsFilterIncomplete`,error:`logsFilterError`,canceled:`logsFilterCanceled`};function G(e,t){return t>0?e/t:null}function We(e,t){if(!e)return null;let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.max(0,Math.round((n-t)/1e3));if(r<=0)return null;let i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60;return i?`${i}h ${a}m`:a?`${a}m ${String(o).padStart(2,`0`)}s`:`${o}s`}function Ge(e,t){let n=[e.down_until,e.cooldown_until].filter(e=>!!e).filter(e=>Date.parse(e)>t);return n.length?n.reduce((e,t)=>Date.parse(e)>=Date.parse(t)?e:t):null}function Ke(e,t){return t?`danger`:(e??0)>=80?`warning`:`ok`}function qe({t:e,expanded:t,onExpandedChange:n}){let{live:r,samples:i}=U({intervalMs:t?800:j});return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(je,{live:r,samples:i,t:e,onConcurrencyClick:()=>n(!0)}),(0,A.jsx)(c,{t:e,expanded:t,onExpandedChange:n,live:t?r:null})]})}function Je(){let{lang:e,t}=te(),{overview:n,loading:a,error:s}=ce(),[c,l]=(0,w.useState)(`today`),[p,h]=(0,w.useState)(null),[g,he]=(0,w.useState)(!1),y=le(),[b,x]=(0,w.useState)(null),[C,T]=(0,w.useState)(``),[Ce,E]=(0,w.useState)(!0),[D,we]=(0,w.useState)(`loading`),[O,Te]=(0,w.useState)([]),[k,Ee]=(0,w.useState)(!0),[j,Oe]=(0,w.useState)(0),[M,N]=(0,w.useState)(null),[P,F]=(0,w.useState)(()=>Date.now()),[I,L]=(0,w.useState)(!1),[R,z]=(0,w.useState)(!1),B=!!n?.proxy?.ok,V=!!n?.worker?.ok,ke=n?.worker?.ready_count??0,H=n?.worker?.hot_count??0,U=b??Le,Ae=(0,w.useMemo)(()=>({requests:t(`chartMetricRequests`),tokens:t(`chartMetricTokens`),latency:t(`chartMetricLatency`),input:t(`chartInput`),output:t(`chartOutput`),cacheRead:t(`chartCacheRead`),p50:t(`statsLatencyP50`),p95:t(`statsLatencyP95`),total:t(`chartTotal`)}),[t]),je=(0,w.useCallback)((e,t)=>y(Se({},e,t)),[y]),W=n?.routing?.session_affinity,Ue=(W?.hits??0)+(W?.misses??0),Je=G(W?.hits??0,Ue),K=O.map(e=>({account:e,until:Ge(e,P)})).filter(e=>e.until!=null),Qe=K.length>0,$e=new Set(K.map(e=>e.account.id)),et=[...O.filter(e=>e.ready&&!$e.has(e.id)),...O.filter(e=>!e.ready&&!$e.has(e.id))].slice(0,6);(0,w.useEffect)(()=>{if(!Qe)return;let e=setInterval(()=>F(Date.now()),1e3);return()=>clearInterval(e)},[Qe]),(0,w.useEffect)(()=>{let e=!1;return Promise.allSettled([ae(!1),oe()]).then(([t,n])=>{e||(t.status===`fulfilled`&&Te(t.value.data||[]),n.status===`fulfilled`&&Oe((n.value.data||[]).length))}).finally(()=>{e||Ee(!1)}),()=>{e=!0}},[]);let tt=p?.start?.toString()??``,nt=p?.end?.toString()??``,J=(0,w.useRef)(0),Y=(0,w.useCallback)(e=>{let t=ve(c,p);if(!t){E(!1);return}e||E(!0);let n=++J.current,r=`${c}|${tt}|${nt}`;re(t).then(e=>{n===J.current&&(x(e),T(``),we(r))}).catch(t=>{n!==J.current||e||(x(null),T(t instanceof Error?t.message:String(t)))}).finally(()=>{n===J.current&&E(!1)})},[c,tt,nt]);(0,w.useEffect)(()=>(Y(!1),()=>{J.current++}),[Y]),(0,w.useEffect)(()=>{if(g)return;let e=Date.now(),t=()=>{document.hidden||(e=Date.now(),Y(!0))},n=setInterval(t,Fe),r=()=>{!document.hidden&&Date.now()-e>=Fe&&t()};return document.addEventListener(`visibilitychange`,r),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,r)}},[g,Y]),(0,w.useEffect)(()=>{let e=!1,t=Date.now(),n=()=>{document.hidden||(t=Date.now(),me().then(t=>{e||N(t)}).catch(()=>{}))};n();let r=setInterval(n,Ie),i=()=>{!document.hidden&&Date.now()-t>=Ie&&n()};return document.addEventListener(`visibilitychange`,i),()=>{e=!0,clearInterval(r),document.removeEventListener(`visibilitychange`,i)}},[]);let rt=Math.floor(U.series.length/2),X=(e,t)=>e.reduce((e,n)=>e+n[t],0),Z=U.series.slice(0,rt),Q=U.series.slice(rt),it=((e,t)=>e>0?(t-e)/e:null)(X(Z,`requests`),X(Q,`requests`)),at=X(Z,`requests`)?X(Z,`ok`)/X(Z,`requests`):null,ot=X(Q,`requests`)?X(Q,`ok`)/X(Q,`requests`):null,st=at!=null&&ot!=null?ot-at:null,ct=[{label:t(`metricRequests`),value:U.totals.requests,kind:`compact`,detail:t(`statsWindowHint`,{window:t(xe[c])}),ok:U.totals.requests>0,trend:it},{label:t(`metricSuccess`),value:U.totals.success_rate,kind:`percent`,detail:`${U.totals.ok} ${t(`logsFilterOk`)} · ${U.totals.incomplete} ${t(`logsFilterIncomplete`)} · ${U.totals.error} ${t(`logsFilterError`)}`,ok:U.totals.requests===0||U.totals.success_rate>=.9,trend:st},{label:t(`metricLatency`),value:U.latency.p95_ms??U.latency.avg_ms,kind:`ms`,detail:`p50 ${m(U.latency.p50_ms)} · avg ${m(U.latency.avg_ms)}`,ok:U.latency.p95_ms==null||U.latency.p95_ms<8e3,trend:null},{label:t(`metricTokens`),value:U.tokens.total,kind:`compact`,detail:`${f(U.tokens.prompt)} / ${f(U.tokens.completion)}`,ok:!0,trend:null}],lt=G(U.tokens.cache_read,U.tokens.prompt),ut=G(U.totals.streaming,U.totals.requests),dt=[{label:t(`metricCacheHit`),value:lt,kind:`percent`,detail:t(`metricCacheHitDetail`,{read:f(U.tokens.cache_read),prompt:f(U.tokens.prompt)})},{label:t(`metricStreaming`),value:ut,kind:`percent`,detail:t(`metricStreamingDetail`,{count:U.totals.streaming,total:U.totals.requests})},{label:t(`metricCanceled`),value:U.totals.canceled,kind:`int`,detail:t(`metricCanceledDetail`,{rate:d(G(U.totals.canceled,U.totals.requests)??0)})}],ft=He.map(e=>({key:e,count:U.status.find(t=>t.key===e)?.count??U.totals[e]??0})),$=e=>Se(e,U.window.from,U.window.to);return a&&!n?(0,A.jsx)(pe,{}):(0,A.jsxs)(`div`,{className:`space-y-5 sm:space-y-4`,children:[(0,A.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-1`,children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,A.jsx)(ye,{value:c,onChange:l,custom:p,onCustomChange:h,onBusy:()=>E(!0),t}),(0,A.jsxs)(de,{delay:300,children:[(0,A.jsx)(ne,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(g?`statsRefreshResume`:`statsRefreshPause`),"aria-pressed":g,onPress:()=>he(e=>!e),children:g?(0,A.jsx)(i,{size:14}):(0,A.jsx)(r,{size:14})}),(0,A.jsx)(de.Content,{children:t(g?`statsRefreshPaused`:`statsRefreshAuto`)})]}),(0,A.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,A.jsx)(`div`,{className:`mono text-caption text-muted`,children:n?.time||`—`}),(0,A.jsxs)(`div`,{className:`mt-1 inline-flex items-center gap-2 text-body font-medium`,children:[(0,A.jsx)(`span`,{className:`status-dot`,"data-state":B&&V?`ok`:`danger`}),t(B&&V?`running`:`degraded`)]})]})]})}),s?(0,A.jsx)(ie,{title:t(`failedOverview`,{msg:s})}):null,(0,A.jsx)(qe,{t,expanded:I,onExpandedChange:L}),(0,A.jsx)(_e,{id:b?D:`loading`,busy:Ce,children:(0,A.jsxs)(`div`,{className:`space-y-5 sm:space-y-4`,children:[(0,A.jsx)(`section`,{"data-gsap-reveal":!0,className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:ct.map(e=>(0,A.jsxs)(u,{className:`gap-0 p-3.5`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,A.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,A.jsx)(`span`,{className:`status-dot`,"data-state":e.ok?`ok`:`danger`})]}),(0,A.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`div`,{className:`tabular text-metric font-medium leading-none`,children:b?e.value==null?`—`:(0,A.jsx)(be,{value:e.value,kind:e.kind}):(0,A.jsx)(_,{className:`h-7 w-24`})}),b&&e.trend!=null?(0,A.jsx)(Xe,{value:e.trend,hint:t(`trendHalfHint`)}):null]}),(0,A.jsx)(`div`,{className:`mono mt-2 truncate text-caption text-muted`,children:b?e.detail:(0,A.jsx)(_,{className:`h-3 w-28`})})]},e.label))}),(0,A.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-3`,children:dt.map(e=>(0,A.jsx)(u,{className:`gap-0 p-3.5`,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,A.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:b?e.detail:(0,A.jsx)(_,{className:`h-3 w-28`})})]}),(0,A.jsx)(`div`,{className:`tabular text-section font-semibold sm:shrink-0`,children:b?e.value==null?`—`:(0,A.jsx)(be,{value:e.value,kind:e.kind}):(0,A.jsx)(_,{className:`h-5 w-12`})})]})},e.label))}),(0,A.jsx)(`section`,{className:`grid gap-3`,children:(0,A.jsxs)(u,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTraffic`)}),(0,A.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTrafficHint`)})]}),(0,A.jsx)(se,{size:`sm`,variant:`soft`,color:U.totals.error?`warning`:`success`,children:d(U.totals.success_rate)})]}),(0,A.jsxs)(`div`,{className:`space-y-4 p-4`,children:[C?(0,A.jsx)(`div`,{className:`text-body text-danger`,children:t(`failedStats`,{msg:C})}):b?U.series.some(e=>e.requests>0)?(0,A.jsx)(w.Suspense,{fallback:(0,A.jsx)(ue,{}),children:(0,A.jsx)(Pe,{series:U.series,lang:e,emptyLabel:t(`statsEmptyTraffic`),okLabel:t(`logsFilterOk`),errorLabel:t(`logsFilterError`),selectHint:t(`statsDragHint`),labels:Ae,onSelectRange:je})}):(0,A.jsx)(De,{emptyLabel:t(`statsEmptyTraffic`)}):(0,A.jsx)(ue,{}),(0,A.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-4 pt-3 sm:grid-cols-4 sm:gap-3`,children:[[t(`statsLatencyP50`),m(U.latency.p50_ms)],[t(`statsLatencyP95`),m(U.latency.p95_ms)],[t(`statsLatencyAvg`),m(U.latency.avg_ms)],[t(`statsTTFB`),m(U.latency.ttfb_avg_ms)]].map(([e,t])=>(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,A.jsx)(`div`,{className:`mono mt-1 text-body font-medium`,children:b?t:(0,A.jsx)(_,{className:`h-4 w-16`})})]},String(e)))})]})]})})]})}),(0,A.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,.85fr)]`,children:[(0,A.jsxs)(u,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:t(`statsPool`)}),(0,A.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsPoolHint`)})]}),(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[!k&&K.length?(0,A.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-2xl bg-surface-secondary px-2 py-0.5 text-caption text-muted transition-colors hover:text-foreground`,"aria-expanded":R,"aria-label":t(`statsCoolingChip`,{count:K.length}),onClick:()=>z(e=>!e),children:[(0,A.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":`warn`}),(0,A.jsx)(`span`,{className:`mono tabular`,children:t(`statsCoolingChip`,{count:K.length})}),(0,A.jsx)(ee,{size:10,className:`transition-transform duration-200 ${R?`rotate-90`:``}`,"aria-hidden":!0})]}):null,(0,A.jsxs)(fe,{to:`/accounts`,className:`inline-flex items-center gap-1 text-caption font-medium text-muted hover:text-foreground`,children:[t(`navAccounts`),(0,A.jsx)(o,{size:12})]})]})]}),(0,A.jsx)(`div`,{className:`grid grid-cols-2 gap-y-1 border-b border-separator sm:grid-cols-4 sm:gap-y-0`,children:[[t(`ready`),ke,`ok`],[t(`hot`),H,H?`ok`:``],[t(`inFlight`),`live`,``],[t(`statsAffinityHit`),Je==null?`—`:d(Je),``,W?t(`statsAffinityHint`,{hits:W.hits??0,misses:W.misses??0,bindings:W.bindings??0}):``]].map(([e,t,r,i])=>(0,A.jsxs)(`div`,{className:`px-4 py-3 sm:py-2.5`,title:i?String(i):void 0,children:[(0,A.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,A.jsx)(`div`,{className:`mt-1.5 flex items-center gap-2 sm:mt-1`,children:t===`live`?(0,A.jsx)(Me,{fallback:n?.worker?.in_flight??0}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`mono text-section font-semibold`,children:t}),r?(0,A.jsx)(`span`,{className:`status-dot`,"data-state":r}):null]})})]},String(e)))}),R&&K.length?(0,A.jsxs)(`div`,{className:`border-b border-separator bg-surface-secondary/50 px-4 py-2`,children:[(0,A.jsx)(`div`,{className:`text-caption text-muted`,children:t(`statsCoolingDetails`)}),(0,A.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:K.map(({account:e,until:n})=>(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-caption`,children:[(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground/80`,children:e.name||e.id}),(0,A.jsx)(`span`,{className:`mono shrink-0 text-muted`,children:e.last_error_kind?Ve(e.last_error_kind,t):t(`statsUnknown`)}),(0,A.jsx)(`span`,{className:`mono shrink-0 tabular text-muted sm:w-16 sm:text-right`,children:We(n,P)??`—`}),(0,A.jsx)(`span`,{className:`mono hidden shrink-0 text-muted sm:inline sm:w-10 sm:text-right`,title:t(`statsBackoffLevel`),children:e.restart_backoff_level?`L${e.restart_backoff_level}`:`—`})]},e.id))})]}):null,(0,A.jsx)(`div`,{className:`divide-y divide-separator`,children:k?(0,A.jsx)(v,{}):O.length===0?(0,A.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`noAccounts`)}):et.length===0?(0,A.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`statsPoolReadyEmpty`)}):et.map(e=>{let n=e.quota,r=Ke(n?.percentage,n?.exceeded);return(0,A.jsxs)(`div`,{className:`flex flex-col gap-2.5 px-4 py-3 sm:flex-row sm:items-center sm:gap-3 sm:py-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3 sm:items-center`,children:[(0,A.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0 sm:mt-0`,"data-state":e.ready?`ok`:`danger`}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(S,{provider:e.provider,size:14}),(0,A.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.name||e.id})]}),(0,A.jsxs)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:[ge(e.provider,e.region,t),` · `,e.hot?t(`hot`):e.ready?t(`ready`):t(`degraded`)]})]})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 pl-6 sm:shrink-0 sm:pl-0`,children:[(0,A.jsx)(Ne,{id:e.id,fallbackInFlight:e.in_flight??e.inFlight??0,fallbackMax:e.max_inflight||4,label:t(`inFlight`),saturatedLabel:t(`liveSaturated`)}),n?(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(`quota`),children:[(0,A.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`quota`)}),(0,A.jsxs)(`span`,{className:`mono text-caption tabular text-muted`,children:[Math.round(n.percentage??0),`%`]}),(0,A.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,A.jsx)(`span`,{className:`block h-full ${r===`danger`?`bg-danger`:r===`warning`?`bg-warning`:`bg-success`}`,style:{width:`${Math.min(100,Math.max(0,n.percentage??0))}%`}})})]}):null]})]},e.id)})}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,A.jsxs)(`span`,{children:[t(`metricModels`),` `,j]}),(0,A.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[[`qoder`,`workbuddy`,`trae`].map(e=>{let t=O.filter(t=>String(t.provider||`qoder`).toLowerCase()===e).length;return t?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,A.jsx)(S,{provider:e,size:11}),t]},e):null}),(0,A.jsxs)(`span`,{children:[O.length,` `,t(`accountCount`)]})]})]})]}),(0,A.jsx)(Ye,{resources:M,t})]}),(0,A.jsx)(_e,{id:b?D:`loading`,busy:Ce,children:(0,A.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-2 2xl:grid-cols-3`,children:[(0,A.jsxs)(u,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,A.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopProviders`)}),(0,A.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTopProvidersHint`)})]})}),b?(0,A.jsx)(q,{empty:t(`statsNoProviders`),items:(U.providers||[]).map(e=>({key:e.key,label:Re(e.key,t),count:e.count,meta:`${e.ok}/${e.count}`,mark:e.key===`(unknown)`?void 0:e.key,href:e.key===`(unknown)`?void 0:$({provider:e.key})}))}):(0,A.jsx)(v,{})]}),(0,A.jsxs)(u,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,A.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopModels`)}),(0,A.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`providerCatalog`)})]})}),b?(0,A.jsx)(q,{empty:t(`statsNoModels`),items:U.models.map(e=>({key:e.key,label:e.key===`(unknown)`?t(`statsUnknown`):e.key,count:e.count,href:e.key===`(unknown)`?void 0:$({model:e.key}),meta:e.latency_avg_ms==null?`${e.ok}/${e.count}`:m(e.latency_avg_ms)}))}):(0,A.jsx)(v,{rows:4})]}),(0,A.jsxs)(u,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,A.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:t(`statsStatusMix`)}),(0,A.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsStatusMixHint`)})]})}),b?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Ze,{items:ft,t}),(0,A.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsErrorMix`)}),(0,A.jsx)(q,{empty:t(`statsNoErrors`),danger:!0,items:U.errors.map(e=>({key:e.key,label:Ve(e.key,t),count:e.count,href:Be.has(e.key)?$({error_kind:e.key}):void 0}))}),(0,A.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsTopAccounts`)}),(0,A.jsx)(q,{empty:t(`statsNoAccounts`),items:U.accounts.slice(0,5).map(e=>({key:e.key,label:ze(O,e.key,t(`statsUnassigned`)),count:e.count,href:!e.key||e.key===`(unassigned)`?void 0:$({account:e.key}),meta:`${e.ok}/${e.count}`}))})]}):(0,A.jsx)(v,{rows:4})]})]})})]})}function K(e,t){return e>=2147483648||t>=200?`danger`:e>=1073741824||t>=100?`warning`:`ok`}function Ye({resources:e,t}){let n=[...e?.workers??[]].sort((e,t)=>t.rss_bytes-e.rss_bytes),r=e?.server;return(0,A.jsxs)(u,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:t(`resTitle`)}),(0,A.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`resHint`)})]}),(0,A.jsx)(se,{size:`sm`,variant:`soft`,color:e?`success`:`default`,children:e?p(e.total_rss_bytes):`—`})]}),(0,A.jsx)(`div`,{className:`divide-y divide-separator`,children:e?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,A.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":K(r?.rss_bytes??0,r?.cpu_percent??0)}),(0,A.jsx)(`div`,{className:`truncate text-body font-medium`,children:t(`resServer`)}),(0,A.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,r?.pid]})]}),(0,A.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[p(r?.rss_bytes),` · `,(r?.cpu_percent??0).toFixed(1),`%`]})]})}),n.length===0?(0,A.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`resEmpty`)}):n.map(e=>(0,A.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,A.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":K(e.rss_bytes,e.cpu_percent)}),(0,A.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label||e.account_id}),(0,A.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,e.pid]})]}),(0,A.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[p(e.rss_bytes),` · `,e.cpu_percent.toFixed(1),`%`]})]})},e.pid))]}):(0,A.jsx)(v,{rows:3})}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,A.jsxs)(`span`,{className:`mono`,children:[r?.goroutines??0,` `,t(`resGoroutines`)]}),(0,A.jsx)(`span`,{className:`mono`,children:e?.sampled_at?new Date(e.sampled_at).toLocaleTimeString():`—`})]})]})}function q({items:e,empty:t,danger:n}){let r=(0,w.useRef)(null),i=Math.max(1,...e.map(e=>e.count)),a=e.map(e=>`${e.key}:${e.count}`).join(`|`);return(0,w.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=h.context(()=>{let e=h.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{h.set(`[data-rank-fill]`,{clearProps:`transform`})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=h.utils.toArray(`[data-rank-fill]`);e.length&&h.fromTo(e,{scaleX:0},{scaleX:1,duration:.38,ease:`power2.out`,stagger:.05,transformOrigin:`0% 50%`})})},e);return()=>t.revert()},[a]),e.length?(0,A.jsx)(`div`,{ref:r,className:`divide-y divide-separator`,children:e.map(e=>{let t=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.mark?(0,A.jsx)(S,{provider:e.mark,size:14}):null,(0,A.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label})]}),(0,A.jsx)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:e.meta?`${e.count} · ${e.meta}`:e.count})]}),(0,A.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-[2px] bg-separator`,children:(0,A.jsx)(`div`,{"data-rank-fill":!0,className:`h-full origin-left rounded-[2px] ${n?`bg-danger`:`bg-success`}`,style:{width:`${Math.max(6,e.count/i*100)}%`}})})]});return e.href?(0,A.jsx)(fe,{to:e.href,className:`rank-row block px-4 py-2.5`,title:e.label,children:t},e.key):(0,A.jsx)(`div`,{className:`px-4 py-2.5`,children:t},e.key)})}):(0,A.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t})}function Xe({value:e,hint:t}){let n=Math.abs(e)<.005?`flat`:e>0?`up`:`down`;return(0,A.jsxs)(`span`,{className:`trend-chip`,"data-tone":n,title:t,children:[(0,A.jsx)(n===`down`?Te:n===`up`?Ee:we,{size:12,weight:`bold`}),e>0?`+`:``,(e*100).toFixed(1),`%`]})}function Ze({items:e,t}){let n=e.reduce((e,t)=>e+t.count,0);return n?(0,A.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,A.jsx)(`div`,{className:`flex h-2 gap-px overflow-hidden rounded-[3px] bg-separator`,role:`img`,"aria-label":e.map(e=>`${t(Ue[e.key])} ${e.count}`).join(`, `),children:e.filter(e=>e.count>0).map(e=>(0,A.jsx)(`div`,{className:W[e.key],style:{width:`${e.count/n*100}%`,minWidth:2}},e.key))}),(0,A.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-x-4 gap-y-1.5`,children:e.map(e=>(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,A.jsx)(`span`,{className:`inline-block size-2 shrink-0 rounded-[2px] ${W[e.key]}`}),(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted`,children:t(Ue[e.key])}),(0,A.jsx)(`span`,{className:`mono tabular`,children:e.count}),(0,A.jsx)(`span`,{className:`mono w-10 text-right tabular text-muted`,children:d(e.count/n)})]},e.key))})]}):(0,A.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`statsEmptyTraffic`)})}export{Je as OverviewPage,De as t}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TrafficChart-CkXe7Bus.js","assets/shim-mfK0Rmj6.js","assets/format-BAkFbjAh.js","assets/SharedElementTransition-BlCsXfb1.js","assets/label-DYYRLGoV.js","assets/useI18n-BAo1UrJW.js","assets/index-CWTBzWuK.js","assets/overview-ARhe2pSk.js","assets/gsap-DWxn8li7.js","assets/index-ORXBmquE.css","assets/AreaChart-BDsZfavt.js","assets/XAxis-D-mwlVQJ.js","assets/FilterToggle-CbYR8o3t.js"])))=>i.map(i=>d[i]); +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r,i,n as a,o,r as s,t as c}from"./InflightLiveCard-Cy8JjSn4.js";import{t as ee}from"./CaretRight.es-DLLkzlqU.js";import{n as te,pt as l,r as ne}from"./useI18n-BAo1UrJW.js";import{s as re}from"./TimeRangePicker-C8MnQbdC.js";import{t as ie}from"./PageAlert-4fxVtrfI.js";import{n as u}from"./useToggle-DpH7h_oD.js";import{c as d,i as f,n as p,s as m}from"./format-BAkFbjAh.js";import{d as ae,m as oe}from"./overview-ARhe2pSk.js";import{t as h}from"./gsap-DWxn8li7.js";import{$t as g,N as se,O as ce,Xt as le,g as ue,k as de,m as _,p as v,qt as fe,u as pe,w as me}from"./index-CWTBzWuK.js";import{Tt as he,a as y,r as b,t as x}from"./AreaChart-BDsZfavt.js";import{t as S}from"./ProviderMark-C49bIWJW.js";import{n as ge,t as C}from"./provider-BZvt2HHB.js";import{a as _e,i as ve,n as ye,o as be,r as xe,t as Se}from"./logsLink-D4LXHY_f.js";var w=t(e(),1),T=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236,208a12,12,0,0,1-12,12H32a12,12,0,0,1-12-12V48a12,12,0,0,1,24,0v99l43.51-43.52a12,12,0,0,1,17,0L128,127l43-43H160a12,12,0,0,1,0-24h40a12,12,0,0,1,12,12v40a12,12,0,0,1-24,0V101l-51.51,51.52a12,12,0,0,1-17,0L96,129,44,181v15H224A12,12,0,0,1,236,208Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M224,64V208H32V48H208A16,16,0,0,1,224,64Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M232,208a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V48a8,8,0,0,1,16,0V156.69l50.34-50.35a8,8,0,0,1,11.32,0L128,132.69,180.69,80H160a8,8,0,0,1,0-16h40a8,8,0,0,1,8,8v40a8,8,0,0,1-16,0V91.31l-58.34,58.35a8,8,0,0,1-11.32,0L96,123.31l-56,56V200H224A8,8,0,0,1,232,208Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM200,192H56a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v76.69l34.34-34.35a8,8,0,0,1,11.32,0L128,132.69,172.69,88H144a8,8,0,0,1,0-16h48a8,8,0,0,1,8,8v48a8,8,0,0,1-16,0V99.31l-50.34,50.35a8,8,0,0,1-11.32,0L104,131.31l-40,40V176H200a8,8,0,0,1,0,16Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M230,208a6,6,0,0,1-6,6H32a6,6,0,0,1-6-6V48a6,6,0,0,1,12,0V161.52l53.76-53.76a6,6,0,0,1,8.48,0L128,135.51,185.52,78H160a6,6,0,0,1,0-12h40a6,6,0,0,1,6,6v40a6,6,0,0,1-12,0V86.48l-61.76,61.76a6,6,0,0,1-8.48,0L96,120.49l-58,58V202H224A6,6,0,0,1,230,208Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,208a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V48a8,8,0,0,1,16,0V156.69l50.34-50.35a8,8,0,0,1,11.32,0L128,132.69,180.69,80H160a8,8,0,0,1,0-16h40a8,8,0,0,1,8,8v40a8,8,0,0,1-16,0V91.31l-58.34,58.35a8,8,0,0,1-11.32,0L96,123.31l-56,56V200H224A8,8,0,0,1,232,208Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M228,208a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V48a4,4,0,0,1,8,0V166.34l57.17-57.17a4,4,0,0,1,5.66,0L128,138.34,190.34,76H160a4,4,0,0,1,0-8h40a4,4,0,0,1,4,4v40a4,4,0,0,1-8,0V81.66l-65.17,65.17a4,4,0,0,1-5.66,0L96,117.66l-60,60V204H224A4,4,0,0,1,228,208Z`}))]]),Ce=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M244,128v64a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h35l-67-67-31.51,31.52a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L96,119l31.51-31.52a12,12,0,0,1,17,0L220,163V128a12,12,0,0,1,24,0Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,128v64H168Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M235.06,120.61a8,8,0,0,0-8.72,1.73L200,148.69,141.66,90.34a8,8,0,0,0-11.32,0L96,124.69,29.66,58.34A8,8,0,0,0,18.34,69.66l72,72a8,8,0,0,0,11.32,0L136,107.31,188.69,160l-26.35,26.34A8,8,0,0,0,168,200h64a8,8,0,0,0,8-8V128A8,8,0,0,0,235.06,120.61ZM224,184H187.31L224,147.31Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,128v64a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L188.69,160,136,107.31l-34.34,34.35a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,29.66,58.34L96,124.69l34.34-34.35a8,8,0,0,1,11.32,0L200,148.69l26.34-26.35A8,8,0,0,1,240,128Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M238,128v64a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h49.52L136,104.49l-35.76,35.75a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L96,127.51l35.76-35.75a6,6,0,0,1,8.48,0L226,177.52V128a6,6,0,0,1,12,0Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,128v64a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h44.69L136,107.31l-34.34,34.35a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,29.66,58.34L96,124.69l34.34-34.35a8,8,0,0,1,11.32,0L224,172.69V128a8,8,0,0,1,16,0Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236,128v64a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h54.34L136,101.66,98.83,138.83a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L96,130.34l37.17-37.17a4,4,0,0,1,5.66,0L228,182.34V128a4,4,0,0,1,8,0Z`}))]]),E=new Map([[`bold`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M244,56v64a12,12,0,0,1-24,0V85l-75.51,75.52a12,12,0,0,1-17,0L96,129,32.49,192.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0L136,135l67-67H168a12,12,0,0,1,0-24h64A12,12,0,0,1,244,56Z`}))],[`duotone`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M232,56v64L168,56Z`,opacity:`0.2`}),w.createElement(`path`,{d:`M232,48H168a8,8,0,0,0-5.66,13.66L188.69,88,136,140.69l-34.34-34.35a8,8,0,0,0-11.32,0l-72,72a8,8,0,0,0,11.32,11.32L96,123.31l34.34,34.35a8,8,0,0,0,11.32,0L200,99.31l26.34,26.35A8,8,0,0,0,240,120V56A8,8,0,0,0,232,48Zm-8,52.69L187.31,64H224Z`}))],[`fill`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,56v64a8,8,0,0,1-13.66,5.66L200,99.31l-58.34,58.35a8,8,0,0,1-11.32,0L96,123.31,29.66,189.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0L136,140.69,188.69,88,162.34,61.66A8,8,0,0,1,168,48h64A8,8,0,0,1,240,56Z`}))],[`light`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M238,56v64a6,6,0,0,1-12,0V70.48l-85.76,85.76a6,6,0,0,1-8.48,0L96,120.49,28.24,188.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0L136,143.51,217.52,62H168a6,6,0,0,1,0-12h64A6,6,0,0,1,238,56Z`}))],[`regular`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M240,56v64a8,8,0,0,1-16,0V75.31l-82.34,82.35a8,8,0,0,1-11.32,0L96,123.31,29.66,189.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0L136,140.69,212.69,64H168a8,8,0,0,1,0-16h64A8,8,0,0,1,240,56Z`}))],[`thin`,w.createElement(w.Fragment,null,w.createElement(`path`,{d:`M236,56v64a4,4,0,0,1-8,0V65.66l-89.17,89.17a4,4,0,0,1-5.66,0L96,117.66,26.83,186.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0L136,146.34,222.34,60H168a4,4,0,0,1,0-8h64A4,4,0,0,1,236,56Z`}))]]),D=w.forwardRef((e,t)=>w.createElement(l,{ref:t,...e,weights:T}));D.displayName=`ChartLineUpIcon`;var we=D,O=w.forwardRef((e,t)=>w.createElement(l,{ref:t,...e,weights:Ce}));O.displayName=`TrendDownIcon`;var Te=O,k=w.forwardRef((e,t)=>w.createElement(l,{ref:t,...e,weights:E}));k.displayName=`TrendUpIcon`;var Ee=k,A=n();function De({emptyLabel:e}){return(0,A.jsx)(`div`,{className:`grid min-h-56 place-items-center rounded-lg bg-surface-secondary px-4 text-body text-muted`,children:e})}var j=2500,Oe=Math.round(6e4/j),M=null,N=``,P=[],F=new Set,I=new Set;function L(e){return F.add(e),()=>{F.delete(e)}}function R(e){return I.add(e),()=>{I.delete(e)}}function z(){return M}function B(){return P}function V(e){let t=s(e);t===N&&M||(M=e,N=t,F.forEach(e=>e()))}function ke(e,t){P=[...P,{at:Date.now(),value:e}].slice(-t),I.forEach(e=>e())}function H(){return(0,w.useSyncExternalStore)(L,z,z)}function U(e){let t=e?.intervalMs??2500,n=(0,w.useSyncExternalStore)(L,z,z),r=(0,w.useSyncExternalStore)(R,B,B);return(0,w.useEffect)(()=>{let e=!1,n=null,r=Math.max(Oe,Math.round(6e4/t)),i=()=>{document.hidden||a().then(t=>{e||(V(t),ke(t.in_flight,r))}).catch(()=>{})},o=()=>{n||document.hidden||(i(),n=setInterval(i,t))},s=()=>{n&&clearInterval(n),n=null},c=()=>document.hidden?s():o();return o(),document.addEventListener(`visibilitychange`,c),()=>{e=!0,s(),document.removeEventListener(`visibilitychange`,c)}},[t]),{live:n,samples:r}}function Ae({samples:e,capacity:t,label:n}){let r=e.length?e:[{at:0,value:0}],i=Math.max(1,t,...r.map(e=>e.value));return(0,A.jsx)(`div`,{className:`h-6 w-[120px] shrink-0`,role:`img`,"aria-label":n,children:(0,A.jsx)(he,{width:`100%`,height:`100%`,children:(0,A.jsxs)(x,{data:r,margin:{top:1,right:0,bottom:1,left:0},children:[(0,A.jsx)(b,{hide:!0,domain:[0,i]}),(0,A.jsx)(y,{type:`monotone`,dataKey:`value`,stroke:`var(--foreground)`,strokeOpacity:.7,strokeWidth:1.25,fill:`var(--foreground)`,fillOpacity:.08,isAnimationActive:!1,dot:!1})]})})})}function je({live:e,samples:t,t:n,onConcurrencyClick:r}){let i=e?.in_flight??null,a=e?.capacity??0,o=i!=null&&a>0?i/a:0,s=a>0&&i!=null&&i>=a,c=(0,A.jsxs)(A.Fragment,{children:[n(`liveConcurrency`),(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,A.jsxs)(`span`,{className:`mono tabular text-body font-semibold ${s?`text-warning`:`text-foreground`}`,children:[i??`—`,(0,A.jsxs)(`span`,{className:`font-normal text-muted`,children:[`/`,e?a:`—`]})]}),(0,A.jsx)(`span`,{className:`inline-block h-[3px] w-12 overflow-hidden rounded-[2px] bg-separator`,children:(0,A.jsx)(`span`,{className:`block h-full ${s?`bg-warning`:`bg-foreground/60`}`,style:{width:`${Math.min(100,o*100)}%`}})})]})]});return(0,A.jsxs)(`div`,{"data-testid":`live-strip`,className:`flex min-h-11 flex-wrap items-center gap-x-5 gap-y-2 overflow-hidden rounded-lg bg-surface-secondary px-4 py-2.5 text-caption text-muted sm:h-11 sm:gap-x-6 sm:gap-y-1 sm:py-0`,children:[(0,A.jsx)(`span`,{className:`inline-flex items-center`,children:(0,A.jsx)(`span`,{className:`status-dot`,"data-state":i==null?``:s?`warn`:i>0?`ok`:``})}),r?(0,A.jsx)(`button`,{type:`button`,"data-testid":`live-strip-concurrency`,onClick:r,className:`inline-flex flex-col gap-1 rounded-lg text-left outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-focus sm:flex-row sm:items-center sm:gap-2`,"aria-label":n(`inflightExpandFromConcurrency`),children:c}):(0,A.jsx)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:c}),(0,A.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveRpm`),(0,A.jsx)(`span`,{className:`mono tabular text-body font-semibold text-foreground`,children:e?.rpm??`—`})]}),(0,A.jsxs)(`span`,{className:`inline-flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[n(`liveTrace`),(0,A.jsx)(Ae,{samples:t,capacity:a,label:n(`liveTrace`)})]})]})}function Me({fallback:e}){let t=H()?.in_flight??e;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`mono text-section font-semibold`,children:t}),t?(0,A.jsx)(`span`,{className:`status-dot`,"data-state":`ok`}):null]})}function Ne({id:e,fallbackInFlight:t,fallbackMax:n,label:r,saturatedLabel:i}){let a=H()?.accounts.find(t=>t.id===e),o=a?.in_flight??t,s=a?.max_inflight||n||4,c=o>=s;return(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:c?i:r,"data-testid":`account-inflight`,children:[(0,A.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:r}),(0,A.jsxs)(`span`,{className:`mono text-caption tabular ${c?`text-warning`:`text-muted`}`,children:[o,`/`,s]}),(0,A.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,A.jsx)(`span`,{className:`block h-full ${c?`bg-warning`:`bg-foreground/50`}`,style:{width:`${Math.min(100,s>0?o/s*100:0)}%`}})})]})}var Pe=(0,w.lazy)(()=>g(()=>import(`./TrafficChart-CkXe7Bus.js`).then(e=>({default:e.TrafficChart})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),Fe=3e4,Ie=3e4,Le={window:{from:``,to:``,hours:24},totals:{requests:0,ok:0,incomplete:0,error:0,canceled:0,streaming:0,success_rate:0},latency:{},tokens:{prompt:0,completion:0,cache_read:0,total:0},status:[],errors:[],models:[],accounts:[],providers:[],series:[]};function Re(e,t){return!e||e===`(unknown)`?t(`statsUnknown`):C(e,t)}function ze(e,t,n){return!t||t===`(unassigned)`?n:e.find(e=>e.id===t)?.name||t}var Be=new Set([`quota`,`rate_limit`,`auth`,`not_ready`,`unavailable`,`invalid_request`,`model_not_available`]);function Ve(e,t){let n={quota:`logsKindQuota`,rate_limit:`logsKindRateLimit`,auth:`logsKindAuth`,not_ready:`logsKindNotReady`,unavailable:`logsKindUnavailable`,invalid_request:`logsKindInvalidRequest`,model_not_available:`logsKindModelNotAvailable`};return n[e]?t(n[e]):e}var He=[`ok`,`incomplete`,`error`,`canceled`],W={ok:`bg-success`,incomplete:`bg-warning`,error:`bg-danger`,canceled:`bg-muted`},Ue={ok:`logsFilterOk`,incomplete:`logsFilterIncomplete`,error:`logsFilterError`,canceled:`logsFilterCanceled`};function G(e,t){return t>0?e/t:null}function We(e,t){if(!e)return null;let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=Math.max(0,Math.round((n-t)/1e3));if(r<=0)return null;let i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60;return i?`${i}h ${a}m`:a?`${a}m ${String(o).padStart(2,`0`)}s`:`${o}s`}function Ge(e,t){let n=[e.down_until,e.cooldown_until].filter(e=>!!e).filter(e=>Date.parse(e)>t);return n.length?n.reduce((e,t)=>Date.parse(e)>=Date.parse(t)?e:t):null}function Ke(e,t){return t?`danger`:(e??0)>=80?`warning`:`ok`}function qe({t:e,expanded:t,onExpandedChange:n}){let{live:r,samples:i}=U({intervalMs:t?800:j});return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(je,{live:r,samples:i,t:e,onConcurrencyClick:()=>n(!0)}),(0,A.jsx)(c,{t:e,expanded:t,onExpandedChange:n,live:t?r:null})]})}function Je(){let{lang:e,t}=te(),{overview:n,loading:a,error:s}=ce(),[c,l]=(0,w.useState)(`today`),[p,h]=(0,w.useState)(null),[g,he]=(0,w.useState)(!1),y=le(),[b,x]=(0,w.useState)(null),[C,T]=(0,w.useState)(``),[Ce,E]=(0,w.useState)(!0),[D,we]=(0,w.useState)(`loading`),[O,Te]=(0,w.useState)([]),[k,Ee]=(0,w.useState)(!0),[j,Oe]=(0,w.useState)(0),[M,N]=(0,w.useState)(null),[P,F]=(0,w.useState)(()=>Date.now()),[I,L]=(0,w.useState)(!1),[R,z]=(0,w.useState)(!1),B=!!n?.proxy?.ok,V=!!n?.worker?.ok,ke=n?.worker?.ready_count??0,H=n?.worker?.hot_count??0,U=b??Le,Ae=(0,w.useMemo)(()=>({requests:t(`chartMetricRequests`),tokens:t(`chartMetricTokens`),latency:t(`chartMetricLatency`),input:t(`chartInput`),output:t(`chartOutput`),cacheRead:t(`chartCacheRead`),p50:t(`statsLatencyP50`),p95:t(`statsLatencyP95`),total:t(`chartTotal`)}),[t]),je=(0,w.useCallback)((e,t)=>y(Se({},e,t)),[y]),W=n?.routing?.session_affinity,Ue=(W?.hits??0)+(W?.misses??0),Je=G(W?.hits??0,Ue),K=O.map(e=>({account:e,until:Ge(e,P)})).filter(e=>e.until!=null),Qe=K.length>0,$e=new Set(K.map(e=>e.account.id)),et=[...O.filter(e=>e.ready&&!$e.has(e.id)),...O.filter(e=>!e.ready&&!$e.has(e.id))].slice(0,6);(0,w.useEffect)(()=>{if(!Qe)return;let e=setInterval(()=>F(Date.now()),1e3);return()=>clearInterval(e)},[Qe]),(0,w.useEffect)(()=>{let e=!1;return Promise.allSettled([ae(!1),oe()]).then(([t,n])=>{e||(t.status===`fulfilled`&&Te(t.value.data||[]),n.status===`fulfilled`&&Oe((n.value.data||[]).length))}).finally(()=>{e||Ee(!1)}),()=>{e=!0}},[]);let tt=p?.start?.toString()??``,nt=p?.end?.toString()??``,J=(0,w.useRef)(0),Y=(0,w.useCallback)(e=>{let t=ve(c,p);if(!t){E(!1);return}e||E(!0);let n=++J.current,r=`${c}|${tt}|${nt}`;re(t).then(e=>{n===J.current&&(x(e),T(``),we(r))}).catch(t=>{n!==J.current||e||(x(null),T(t instanceof Error?t.message:String(t)))}).finally(()=>{n===J.current&&E(!1)})},[c,tt,nt]);(0,w.useEffect)(()=>(Y(!1),()=>{J.current++}),[Y]),(0,w.useEffect)(()=>{if(g)return;let e=Date.now(),t=()=>{document.hidden||(e=Date.now(),Y(!0))},n=setInterval(t,Fe),r=()=>{!document.hidden&&Date.now()-e>=Fe&&t()};return document.addEventListener(`visibilitychange`,r),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,r)}},[g,Y]),(0,w.useEffect)(()=>{let e=!1,t=Date.now(),n=()=>{document.hidden||(t=Date.now(),me().then(t=>{e||N(t)}).catch(()=>{}))};n();let r=setInterval(n,Ie),i=()=>{!document.hidden&&Date.now()-t>=Ie&&n()};return document.addEventListener(`visibilitychange`,i),()=>{e=!0,clearInterval(r),document.removeEventListener(`visibilitychange`,i)}},[]);let rt=Math.floor(U.series.length/2),X=(e,t)=>e.reduce((e,n)=>e+n[t],0),Z=U.series.slice(0,rt),Q=U.series.slice(rt),it=((e,t)=>e>0?(t-e)/e:null)(X(Z,`requests`),X(Q,`requests`)),at=X(Z,`requests`)?X(Z,`ok`)/X(Z,`requests`):null,ot=X(Q,`requests`)?X(Q,`ok`)/X(Q,`requests`):null,st=at!=null&&ot!=null?ot-at:null,ct=[{label:t(`metricRequests`),value:U.totals.requests,kind:`compact`,detail:t(`statsWindowHint`,{window:t(xe[c])}),ok:U.totals.requests>0,trend:it},{label:t(`metricSuccess`),value:U.totals.success_rate,kind:`percent`,detail:`${U.totals.ok} ${t(`logsFilterOk`)} · ${U.totals.incomplete} ${t(`logsFilterIncomplete`)} · ${U.totals.error} ${t(`logsFilterError`)}`,ok:U.totals.requests===0||U.totals.success_rate>=.9,trend:st},{label:t(`metricLatency`),value:U.latency.p95_ms??U.latency.avg_ms,kind:`ms`,detail:`p50 ${m(U.latency.p50_ms)} · avg ${m(U.latency.avg_ms)}`,ok:U.latency.p95_ms==null||U.latency.p95_ms<8e3,trend:null},{label:t(`metricTokens`),value:U.tokens.total,kind:`compact`,detail:`${f(U.tokens.prompt)} / ${f(U.tokens.completion)}`,ok:!0,trend:null}],lt=G(U.tokens.cache_read,U.tokens.prompt),ut=G(U.totals.streaming,U.totals.requests),dt=[{label:t(`metricCacheHit`),value:lt,kind:`percent`,detail:t(`metricCacheHitDetail`,{read:f(U.tokens.cache_read),prompt:f(U.tokens.prompt)})},{label:t(`metricStreaming`),value:ut,kind:`percent`,detail:t(`metricStreamingDetail`,{count:U.totals.streaming,total:U.totals.requests})},{label:t(`metricCanceled`),value:U.totals.canceled,kind:`int`,detail:t(`metricCanceledDetail`,{rate:d(G(U.totals.canceled,U.totals.requests)??0)})}],ft=He.map(e=>({key:e,count:U.status.find(t=>t.key===e)?.count??U.totals[e]??0})),$=e=>Se(e,U.window.from,U.window.to);return a&&!n?(0,A.jsx)(pe,{}):(0,A.jsxs)(`div`,{className:`space-y-5 sm:space-y-4`,children:[(0,A.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-1`,children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,A.jsx)(ye,{value:c,onChange:l,custom:p,onCustomChange:h,onBusy:()=>E(!0),t}),(0,A.jsxs)(de,{delay:300,children:[(0,A.jsx)(ne,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":t(g?`statsRefreshResume`:`statsRefreshPause`),"aria-pressed":g,onPress:()=>he(e=>!e),children:g?(0,A.jsx)(i,{size:14}):(0,A.jsx)(r,{size:14})}),(0,A.jsx)(de.Content,{children:t(g?`statsRefreshPaused`:`statsRefreshAuto`)})]}),(0,A.jsxs)(`div`,{className:`text-left sm:text-right`,children:[(0,A.jsx)(`div`,{className:`mono text-caption text-muted`,children:n?.time||`—`}),(0,A.jsxs)(`div`,{className:`mt-1 inline-flex items-center gap-2 text-body font-medium`,children:[(0,A.jsx)(`span`,{className:`status-dot`,"data-state":B&&V?`ok`:`danger`}),t(B&&V?`running`:`degraded`)]})]})]})}),s?(0,A.jsx)(ie,{title:t(`failedOverview`,{msg:s})}):null,(0,A.jsx)(qe,{t,expanded:I,onExpandedChange:L}),(0,A.jsx)(_e,{id:b?D:`loading`,busy:Ce,children:(0,A.jsxs)(`div`,{className:`space-y-5 sm:space-y-4`,children:[(0,A.jsx)(`section`,{"data-gsap-reveal":!0,className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:ct.map(e=>(0,A.jsxs)(u,{className:`gap-0 p-3.5`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,A.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,A.jsx)(`span`,{className:`status-dot`,"data-state":e.ok?`ok`:`danger`})]}),(0,A.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`div`,{className:`tabular text-metric font-medium leading-none`,children:b?e.value==null?`—`:(0,A.jsx)(be,{value:e.value,kind:e.kind}):(0,A.jsx)(_,{className:`h-7 w-24`})}),b&&e.trend!=null?(0,A.jsx)(Xe,{value:e.trend,hint:t(`trendHalfHint`)}):null]}),(0,A.jsx)(`div`,{className:`mono mt-2 truncate text-caption text-muted`,children:b?e.detail:(0,A.jsx)(_,{className:`h-3 w-28`})})]},e.label))}),(0,A.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-3`,children:dt.map(e=>(0,A.jsx)(u,{className:`gap-0 p-3.5`,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,A.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:b?e.detail:(0,A.jsx)(_,{className:`h-3 w-28`})})]}),(0,A.jsx)(`div`,{className:`tabular text-section font-semibold sm:shrink-0`,children:b?e.value==null?`—`:(0,A.jsx)(be,{value:e.value,kind:e.kind}):(0,A.jsx)(_,{className:`h-5 w-12`})})]})},e.label))}),(0,A.jsx)(`section`,{className:`grid gap-3`,children:(0,A.jsxs)(u,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTraffic`)}),(0,A.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTrafficHint`)})]}),(0,A.jsx)(se,{size:`sm`,variant:`soft`,color:U.totals.error?`warning`:`success`,children:d(U.totals.success_rate)})]}),(0,A.jsxs)(`div`,{className:`space-y-4 p-4`,children:[C?(0,A.jsx)(`div`,{className:`text-body text-danger`,children:t(`failedStats`,{msg:C})}):b?U.series.some(e=>e.requests>0)?(0,A.jsx)(w.Suspense,{fallback:(0,A.jsx)(ue,{}),children:(0,A.jsx)(Pe,{series:U.series,lang:e,emptyLabel:t(`statsEmptyTraffic`),okLabel:t(`logsFilterOk`),errorLabel:t(`logsFilterError`),selectHint:t(`statsDragHint`),labels:Ae,onSelectRange:je})}):(0,A.jsx)(De,{emptyLabel:t(`statsEmptyTraffic`)}):(0,A.jsx)(ue,{}),(0,A.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-4 pt-3 sm:grid-cols-4 sm:gap-3`,children:[[t(`statsLatencyP50`),m(U.latency.p50_ms)],[t(`statsLatencyP95`),m(U.latency.p95_ms)],[t(`statsLatencyAvg`),m(U.latency.avg_ms)],[t(`statsTTFB`),m(U.latency.ttfb_avg_ms)]].map(([e,t])=>(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,A.jsx)(`div`,{className:`mono mt-1 text-body font-medium`,children:b?t:(0,A.jsx)(_,{className:`h-4 w-16`})})]},String(e)))})]})]})})]})}),(0,A.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,.85fr)]`,children:[(0,A.jsxs)(u,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:t(`statsPool`)}),(0,A.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsPoolHint`)})]}),(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[!k&&K.length?(0,A.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-2xl bg-surface-secondary px-2 py-0.5 text-caption text-muted transition-colors hover:text-foreground`,"aria-expanded":R,"aria-label":t(`statsCoolingChip`,{count:K.length}),onClick:()=>z(e=>!e),children:[(0,A.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":`warn`}),(0,A.jsx)(`span`,{className:`mono tabular`,children:t(`statsCoolingChip`,{count:K.length})}),(0,A.jsx)(ee,{size:10,className:`transition-transform duration-200 ${R?`rotate-90`:``}`,"aria-hidden":!0})]}):null,(0,A.jsxs)(fe,{to:`/accounts`,className:`inline-flex items-center gap-1 text-caption font-medium text-muted hover:text-foreground`,children:[t(`navAccounts`),(0,A.jsx)(o,{size:12})]})]})]}),(0,A.jsx)(`div`,{className:`grid grid-cols-2 gap-y-1 border-b border-separator sm:grid-cols-4 sm:gap-y-0`,children:[[t(`ready`),ke,`ok`],[t(`hot`),H,H?`ok`:``],[t(`inFlight`),`live`,``],[t(`statsAffinityHit`),Je==null?`—`:d(Je),``,W?t(`statsAffinityHint`,{hits:W.hits??0,misses:W.misses??0,bindings:W.bindings??0}):``]].map(([e,t,r,i])=>(0,A.jsxs)(`div`,{className:`px-4 py-3 sm:py-2.5`,title:i?String(i):void 0,children:[(0,A.jsx)(`div`,{className:`text-caption text-muted`,children:e}),(0,A.jsx)(`div`,{className:`mt-1.5 flex items-center gap-2 sm:mt-1`,children:t===`live`?(0,A.jsx)(Me,{fallback:n?.worker?.in_flight??0}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`mono text-section font-semibold`,children:t}),r?(0,A.jsx)(`span`,{className:`status-dot`,"data-state":r}):null]})})]},String(e)))}),R&&K.length?(0,A.jsxs)(`div`,{className:`border-b border-separator bg-surface-secondary/50 px-4 py-2`,children:[(0,A.jsx)(`div`,{className:`text-caption text-muted`,children:t(`statsCoolingDetails`)}),(0,A.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:K.map(({account:e,until:n})=>(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-caption`,children:[(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground/80`,children:e.name||e.id}),(0,A.jsx)(`span`,{className:`mono shrink-0 text-muted`,children:e.last_error_kind?Ve(e.last_error_kind,t):t(`statsUnknown`)}),(0,A.jsx)(`span`,{className:`mono shrink-0 tabular text-muted sm:w-16 sm:text-right`,children:We(n,P)??`—`}),(0,A.jsx)(`span`,{className:`mono hidden shrink-0 text-muted sm:inline sm:w-10 sm:text-right`,title:t(`statsBackoffLevel`),children:e.restart_backoff_level?`L${e.restart_backoff_level}`:`—`})]},e.id))})]}):null,(0,A.jsx)(`div`,{className:`divide-y divide-separator`,children:k?(0,A.jsx)(v,{}):O.length===0?(0,A.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`noAccounts`)}):et.length===0?(0,A.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t(`statsPoolReadyEmpty`)}):et.map(e=>{let n=e.quota,r=Ke(n?.percentage,n?.exceeded);return(0,A.jsxs)(`div`,{className:`flex flex-col gap-2.5 px-4 py-3 sm:flex-row sm:items-center sm:gap-3 sm:py-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3 sm:items-center`,children:[(0,A.jsx)(`span`,{className:`status-dot mt-1.5 shrink-0 sm:mt-0`,"data-state":e.ready?`ok`:`danger`}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(S,{provider:e.provider,size:14}),(0,A.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.name||e.id})]}),(0,A.jsxs)(`div`,{className:`mono mt-0.5 text-caption text-muted`,children:[ge(e.provider,e.region,t),` · `,e.hot?t(`hot`):e.ready?t(`ready`):t(`degraded`)]})]})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 pl-6 sm:shrink-0 sm:pl-0`,children:[(0,A.jsx)(Ne,{id:e.id,fallbackInFlight:e.in_flight??e.inFlight??0,fallbackMax:e.max_inflight||4,label:t(`inFlight`),saturatedLabel:t(`liveSaturated`)}),n?(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:t(`quota`),children:[(0,A.jsx)(`span`,{className:`text-caption text-muted sm:hidden`,children:t(`quota`)}),(0,A.jsxs)(`span`,{className:`mono text-caption tabular text-muted`,children:[Math.round(n.percentage??0),`%`]}),(0,A.jsx)(`span`,{className:`inline-block h-[2px] w-10 overflow-hidden rounded-[1px] bg-separator`,children:(0,A.jsx)(`span`,{className:`block h-full ${r===`danger`?`bg-danger`:r===`warning`?`bg-warning`:`bg-success`}`,style:{width:`${Math.min(100,Math.max(0,n.percentage??0))}%`}})})]}):null]})]},e.id)})}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,A.jsxs)(`span`,{children:[t(`metricModels`),` `,j]}),(0,A.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[[`qoder`,`workbuddy`,`trae`].map(e=>{let t=O.filter(t=>String(t.provider||`qoder`).toLowerCase()===e).length;return t?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,A.jsx)(S,{provider:e,size:11}),t]},e):null}),(0,A.jsxs)(`span`,{children:[O.length,` `,t(`accountCount`)]})]})]})]}),(0,A.jsx)(Ye,{resources:M,t})]}),(0,A.jsx)(_e,{id:b?D:`loading`,busy:Ce,children:(0,A.jsxs)(`section`,{className:`grid gap-3 xl:grid-cols-2 2xl:grid-cols-3`,children:[(0,A.jsxs)(u,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,A.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopProviders`)}),(0,A.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsTopProvidersHint`)})]})}),b?(0,A.jsx)(q,{empty:t(`statsNoProviders`),items:(U.providers||[]).map(e=>({key:e.key,label:Re(e.key,t),count:e.count,meta:`${e.ok}/${e.count}`,mark:e.key===`(unknown)`?void 0:e.key,href:e.key===`(unknown)`?void 0:$({provider:e.key})}))}):(0,A.jsx)(v,{})]}),(0,A.jsxs)(u,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,A.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:t(`statsTopModels`)}),(0,A.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`providerCatalog`)})]})}),b?(0,A.jsx)(q,{empty:t(`statsNoModels`),items:U.models.map(e=>({key:e.key,label:e.key===`(unknown)`?t(`statsUnknown`):e.key,count:e.count,href:e.key===`(unknown)`?void 0:$({model:e.key}),meta:e.latency_avg_ms==null?`${e.ok}/${e.count}`:m(e.latency_avg_ms)}))}):(0,A.jsx)(v,{rows:4})]}),(0,A.jsxs)(u,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,A.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:t(`statsStatusMix`)}),(0,A.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`statsStatusMixHint`)})]})}),b?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Ze,{items:ft,t}),(0,A.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsErrorMix`)}),(0,A.jsx)(q,{empty:t(`statsNoErrors`),danger:!0,items:U.errors.map(e=>({key:e.key,label:Ve(e.key,t),count:e.count,href:Be.has(e.key)?$({error_kind:e.key}):void 0}))}),(0,A.jsx)(`div`,{className:`border-t border-separator px-4 pt-2.5 text-caption font-medium text-muted`,children:t(`statsTopAccounts`)}),(0,A.jsx)(q,{empty:t(`statsNoAccounts`),items:U.accounts.slice(0,5).map(e=>({key:e.key,label:ze(O,e.key,t(`statsUnassigned`)),count:e.count,href:!e.key||e.key===`(unassigned)`?void 0:$({account:e.key}),meta:`${e.ok}/${e.count}`}))})]}):(0,A.jsx)(v,{rows:4})]})]})})]})}function K(e,t){return e>=2147483648||t>=200?`danger`:e>=1073741824||t>=100?`warning`:`ok`}function Ye({resources:e,t}){let n=[...e?.workers??[]].sort((e,t)=>t.rss_bytes-e.rss_bytes),r=e?.server;return(0,A.jsxs)(u,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-4 py-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:t(`resTitle`)}),(0,A.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:t(`resHint`)})]}),(0,A.jsx)(se,{size:`sm`,variant:`soft`,color:e?`success`:`default`,children:e?p(e.total_rss_bytes):`—`})]}),(0,A.jsx)(`div`,{className:`divide-y divide-separator`,children:e?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,A.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":K(r?.rss_bytes??0,r?.cpu_percent??0)}),(0,A.jsx)(`div`,{className:`truncate text-body font-medium`,children:t(`resServer`)}),(0,A.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,r?.pid]})]}),(0,A.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[p(r?.rss_bytes),` · `,(r?.cpu_percent??0).toFixed(1),`%`]})]})}),n.length===0?(0,A.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`resEmpty`)}):n.map(e=>(0,A.jsx)(`div`,{className:`px-4 py-2.5`,children:(0,A.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`status-dot shrink-0`,"data-state":K(e.rss_bytes,e.cpu_percent)}),(0,A.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label||e.account_id}),(0,A.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[`pid `,e.pid]})]}),(0,A.jsxs)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:[p(e.rss_bytes),` · `,e.cpu_percent.toFixed(1),`%`]})]})},e.pid))]}):(0,A.jsx)(v,{rows:3})}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-t border-separator px-4 py-2.5 text-caption text-muted`,children:[(0,A.jsxs)(`span`,{className:`mono`,children:[r?.goroutines??0,` `,t(`resGoroutines`)]}),(0,A.jsx)(`span`,{className:`mono`,children:e?.sampled_at?new Date(e.sampled_at).toLocaleTimeString():`—`})]})]})}function q({items:e,empty:t,danger:n}){let r=(0,w.useRef)(null),i=Math.max(1,...e.map(e=>e.count)),a=e.map(e=>`${e.key}:${e.count}`).join(`|`);return(0,w.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=h.context(()=>{let e=h.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{h.set(`[data-rank-fill]`,{clearProps:`transform`})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=h.utils.toArray(`[data-rank-fill]`);e.length&&h.fromTo(e,{scaleX:0},{scaleX:1,duration:.38,ease:`power2.out`,stagger:.05,transformOrigin:`0% 50%`})})},e);return()=>t.revert()},[a]),e.length?(0,A.jsx)(`div`,{ref:r,className:`divide-y divide-separator`,children:e.map(e=>{let t=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.mark?(0,A.jsx)(S,{provider:e.mark,size:14}):null,(0,A.jsx)(`div`,{className:`truncate text-body font-medium`,children:e.label})]}),(0,A.jsx)(`div`,{className:`mono shrink-0 text-caption text-muted`,children:e.meta?`${e.count} · ${e.meta}`:e.count})]}),(0,A.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-[2px] bg-separator`,children:(0,A.jsx)(`div`,{"data-rank-fill":!0,className:`h-full origin-left rounded-[2px] ${n?`bg-danger`:`bg-success`}`,style:{width:`${Math.max(6,e.count/i*100)}%`}})})]});return e.href?(0,A.jsx)(fe,{to:e.href,className:`rank-row block px-4 py-2.5`,title:e.label,children:t},e.key):(0,A.jsx)(`div`,{className:`px-4 py-2.5`,children:t},e.key)})}):(0,A.jsx)(`div`,{className:`px-4 py-6 text-body text-muted`,children:t})}function Xe({value:e,hint:t}){let n=Math.abs(e)<.005?`flat`:e>0?`up`:`down`;return(0,A.jsxs)(`span`,{className:`trend-chip`,"data-tone":n,title:t,children:[(0,A.jsx)(n===`down`?Te:n===`up`?Ee:we,{size:12,weight:`bold`}),e>0?`+`:``,(e*100).toFixed(1),`%`]})}function Ze({items:e,t}){let n=e.reduce((e,t)=>e+t.count,0);return n?(0,A.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,A.jsx)(`div`,{className:`flex h-2 gap-px overflow-hidden rounded-[3px] bg-separator`,role:`img`,"aria-label":e.map(e=>`${t(Ue[e.key])} ${e.count}`).join(`, `),children:e.filter(e=>e.count>0).map(e=>(0,A.jsx)(`div`,{className:W[e.key],style:{width:`${e.count/n*100}%`,minWidth:2}},e.key))}),(0,A.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-x-4 gap-y-1.5`,children:e.map(e=>(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-caption`,children:[(0,A.jsx)(`span`,{className:`inline-block size-2 shrink-0 rounded-[2px] ${W[e.key]}`}),(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted`,children:t(Ue[e.key])}),(0,A.jsx)(`span`,{className:`mono tabular`,children:e.count}),(0,A.jsx)(`span`,{className:`mono w-10 text-right tabular text-muted`,children:d(e.count/n)})]},e.key))})]}):(0,A.jsx)(`div`,{className:`px-4 py-3 text-body text-muted`,children:t(`statsEmptyTraffic`)})}export{Je as OverviewPage,De as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/PageAlert-BbN7e2aZ.js b/internal/webui/static/assets/PageAlert-4fxVtrfI.js similarity index 97% rename from internal/webui/static/assets/PageAlert-BbN7e2aZ.js rename to internal/webui/static/assets/PageAlert-4fxVtrfI.js index 737050c89..e8b0123f2 100644 --- a/internal/webui/static/assets/PageAlert-BbN7e2aZ.js +++ b/internal/webui/static/assets/PageAlert-4fxVtrfI.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{I as r,J as i,R as a,Y as o,q as s}from"./useI18n-XrvNxGvP.js";import{B as c,s as l,z as u}from"./SharedElementTransition-BlCsXfb1.js";var d=u({defaultVariants:{status:`default`},slots:{base:`alert`,content:`alert__content`,description:`alert__description`,indicator:`alert__indicator`,title:`alert__title`},variants:{status:{accent:{base:`alert--accent`},danger:{base:`alert--danger`},default:{base:`alert--default`},success:{base:`alert--success`},warning:{base:`alert--warning`}}}}),f=t(e(),1),p=n(),m=(0,f.createContext)({}),h=({children:e,className:t,status:n,...i})=>{let a=f.useMemo(()=>d({status:n}),[n]);return(0,p.jsx)(m,{value:{slots:a,status:n},children:(0,p.jsx)(r,{value:{variant:`default`},children:(0,p.jsx)(c.div,{className:a?.base({className:t}),"data-slot":`alert-root`,...i,children:e})})})},g=Object.assign(h,{Root:h,Indicator:({children:e,className:t,...n})=>{let{slots:r,status:u}=(0,f.use)(m),d=()=>{switch(u){case`accent`:return(0,p.jsx)(s,{"data-slot":`alert-default-icon`});case`success`:return(0,p.jsx)(i,{"data-slot":`alert-default-icon`});case`warning`:return(0,p.jsx)(o,{"data-slot":`alert-default-icon`});case`danger`:return(0,p.jsx)(a,{"data-slot":`alert-default-icon`});default:return(0,p.jsx)(s,{"data-slot":`alert-default-icon`})}};return(0,p.jsx)(c.div,{className:l(r?.indicator,t),"data-slot":`alert-indicator`,...n,children:e??d()})},Content:({children:e,className:t,...n})=>{let{slots:r}=(0,f.use)(m);return(0,p.jsx)(c.div,{className:l(r?.content,t),"data-slot":`alert-content`,...n,children:e})},Title:({children:e,className:t,...n})=>{let{slots:r}=(0,f.use)(m);return(0,p.jsx)(c.p,{className:l(r?.title,t),"data-slot":`alert-title`,...n,children:e})},Description:({children:e,className:t,...n})=>{let{slots:r}=(0,f.use)(m);return(0,p.jsx)(c.span,{className:l(r?.description,t),"data-slot":`alert-description`,...n,children:e})}});function _({status:e=`danger`,title:t,description:n}){return(0,p.jsxs)(g,{status:e,children:[(0,p.jsx)(g.Indicator,{}),(0,p.jsxs)(g.Content,{children:[(0,p.jsx)(g.Title,{children:t}),n?(0,p.jsx)(g.Description,{children:n}):null]})]})}export{g as n,_ as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{I as r,J as i,R as a,Y as o,q as s}from"./useI18n-BAo1UrJW.js";import{B as c,s as l,z as u}from"./SharedElementTransition-BlCsXfb1.js";var d=u({defaultVariants:{status:`default`},slots:{base:`alert`,content:`alert__content`,description:`alert__description`,indicator:`alert__indicator`,title:`alert__title`},variants:{status:{accent:{base:`alert--accent`},danger:{base:`alert--danger`},default:{base:`alert--default`},success:{base:`alert--success`},warning:{base:`alert--warning`}}}}),f=t(e(),1),p=n(),m=(0,f.createContext)({}),h=({children:e,className:t,status:n,...i})=>{let a=f.useMemo(()=>d({status:n}),[n]);return(0,p.jsx)(m,{value:{slots:a,status:n},children:(0,p.jsx)(r,{value:{variant:`default`},children:(0,p.jsx)(c.div,{className:a?.base({className:t}),"data-slot":`alert-root`,...i,children:e})})})},g=Object.assign(h,{Root:h,Indicator:({children:e,className:t,...n})=>{let{slots:r,status:u}=(0,f.use)(m),d=()=>{switch(u){case`accent`:return(0,p.jsx)(s,{"data-slot":`alert-default-icon`});case`success`:return(0,p.jsx)(i,{"data-slot":`alert-default-icon`});case`warning`:return(0,p.jsx)(o,{"data-slot":`alert-default-icon`});case`danger`:return(0,p.jsx)(a,{"data-slot":`alert-default-icon`});default:return(0,p.jsx)(s,{"data-slot":`alert-default-icon`})}};return(0,p.jsx)(c.div,{className:l(r?.indicator,t),"data-slot":`alert-indicator`,...n,children:e??d()})},Content:({children:e,className:t,...n})=>{let{slots:r}=(0,f.use)(m);return(0,p.jsx)(c.div,{className:l(r?.content,t),"data-slot":`alert-content`,...n,children:e})},Title:({children:e,className:t,...n})=>{let{slots:r}=(0,f.use)(m);return(0,p.jsx)(c.p,{className:l(r?.title,t),"data-slot":`alert-title`,...n,children:e})},Description:({children:e,className:t,...n})=>{let{slots:r}=(0,f.use)(m);return(0,p.jsx)(c.span,{className:l(r?.description,t),"data-slot":`alert-description`,...n,children:e})}});function _({status:e=`danger`,title:t,description:n}){return(0,p.jsxs)(g,{status:e,children:[(0,p.jsx)(g.Indicator,{}),(0,p.jsxs)(g.Content,{children:[(0,p.jsx)(g.Title,{children:t}),n?(0,p.jsx)(g.Description,{children:n}):null]})]})}export{g as n,_ as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/Plus.es-BPfWzgUg.js b/internal/webui/static/assets/Plus.es-DsoFTrCh.js similarity index 95% rename from internal/webui/static/assets/Plus.es-BPfWzgUg.js rename to internal/webui/static/assets/Plus.es-DsoFTrCh.js index e8988349d..ee9270f8b 100644 --- a/internal/webui/static/assets/Plus.es-BPfWzgUg.js +++ b/internal/webui/static/assets/Plus.es-DsoFTrCh.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-XrvNxGvP.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`PlusIcon`;var o=a;export{o as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-BAo1UrJW.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`PlusIcon`;var o=a;export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/ProvidersPage-QdKnZCML.js b/internal/webui/static/assets/ProvidersPage-BvznkMq_.js similarity index 97% rename from internal/webui/static/assets/ProvidersPage-QdKnZCML.js rename to internal/webui/static/assets/ProvidersPage-BvznkMq_.js index ea4c90608..4cef50e20 100644 --- a/internal/webui/static/assets/ProvidersPage-QdKnZCML.js +++ b/internal/webui/static/assets/ProvidersPage-BvznkMq_.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./CaretRight.es-CeI6iKxy.js";import{i,r as a,t as o}from"./SearchBar-C0n-Lr5s.js";import{n as s,pt as c,r as l}from"./useI18n-XrvNxGvP.js";import{n as u,t as d}from"./PageAlert-BbN7e2aZ.js";import{n as f}from"./useToggle-55_Qx9vA.js";import{t as p}from"./checkbox-CUZk1qce.js";import{t as m}from"./EmptyPanel-Bs-jQMvG.js";import{t as h}from"./input-CYN6ajmO.js";import{t as g}from"./modal-CQ6c3Rhf.js";import{t as _}from"./number-field-BUGr_bpm.js";import{t as v}from"./search-field-DB17IAvK.js";import{t as y}from"./CompactSwitch-Dd3U4EbK.js";import{t as b}from"./table-iJwxYVe4.js";import{d as x,f as S}from"./format-FfdyoNtB.js";import{A as ee,C as te,M as C,_ as ne,d as re,h as ie,n as w,w as ae}from"./overview-ARhe2pSk.js";import{t as oe}from"./form-qle3Iim5.js";import{t as T}from"./gsap-DWxn8li7.js";import{Bt as se,Gt as ce,It as le,N as E,O as ue,Ot as de,Rt as D,b as O,d as fe,f as pe,k as me,v as k,y as A}from"./index-CAlyInAP.js";import{t as he}from"./ProviderMark-C49bIWJW.js";import{n as j,r as M}from"./provider-BZvt2HHB.js";import{t as N}from"./FormRow-CL_rVm7f.js";import{t as ge}from"./FilterSelect-CW3ACxo1.js";var P=t(e(),1),F=new Map([[`bold`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M79.51,144.49a12,12,0,1,1,17-17L112,143l47.51-47.52a12,12,0,0,1,17,17l-56,56a12,12,0,0,1-17,0ZM228,48V208a20,20,0,0,1-20,20H48a20,20,0,0,1-20-20V48A20,20,0,0,1,48,28H208A20,20,0,0,1,228,48Zm-24,4H52V204H204Z`}))],[`duotone`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M216,48V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),P.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48ZM208,208V48H48V208H208Z`}))],[`fill`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm-34.34,77.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM222,48V208a14,14,0,0,1-14,14H48a14,14,0,0,1-14-14V48A14,14,0,0,1,48,34H208A14,14,0,0,1,222,48Zm-12,0a2,2,0,0,0-2-2H48a2,2,0,0,0-2,2V208a2,2,0,0,0,2,2H208a2,2,0,0,0,2-2Z`}))],[`regular`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48ZM208,208V48H48V208H208Z`}))],[`thin`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM220,48V208a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V48A12,12,0,0,1,48,36H208A12,12,0,0,1,220,48Zm-8,0a4,4,0,0,0-4-4H48a4,4,0,0,0-4,4V208a4,4,0,0,0,4,4H208a4,4,0,0,0,4-4Z`}))]]),I=new Map([[`bold`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M208,28H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28Zm-4,176H52V52H204Z`}))],[`duotone`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M216,48V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),P.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V48H208V208Z`}))],[`fill`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48Z`}))],[`light`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M208,34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34Zm2,174a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2Z`}))],[`regular`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V48H208V208Z`}))],[`thin`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M208,36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36Zm4,172a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Z`}))]]),L=P.forwardRef((e,t)=>P.createElement(c,{ref:t,...e,weights:F}));L.displayName=`CheckSquareIcon`;var R=L,z=P.forwardRef((e,t)=>P.createElement(c,{ref:t,...e,weights:I}));z.displayName=`SquareIcon`;var _e=z;function ve(e){let[t,n]=(0,P.useState)(e);e&&!t&&n(!0);let r=(0,P.useRef)(null),i=(0,P.useRef)(null),a=(0,P.useRef)(e);return(0,P.useLayoutEffect)(()=>{let t=r.current,o=i.current;if(!t||!o)return;if(a.current){a.current=!1;return}T.killTweensOf([t,o]);let s=t.getBoundingClientRect().height;if(e){T.set(t,{overflow:`hidden`});let e=t.scrollHeight;T.fromTo(t,{height:s===e?0:s},{height:e,duration:O(k.base),ease:A.out,onComplete:()=>T.set(t,{clearProps:`height,overflow`})}),T.fromTo(o,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:O(k.base),ease:A.out})}else T.set(t,{overflow:`hidden`,height:s}),T.to(o,{autoAlpha:0,y:-4,duration:O(k.fast),ease:A.inOut}),T.to(t,{height:0,duration:O(k.fast+.04),ease:A.inOut,onComplete:()=>n(!1)});return()=>{T.killTweensOf([t,o])}},[e,t]),{mounted:t,outerRef:r,innerRef:i}}function ye(){return C(`/api/provider-settings`)}function be(e){return C(`/api/provider-settings`,{method:`PATCH`,body:JSON.stringify(e)})}function B(e,t){let n=new URLSearchParams({provider:e,region:t});return C(`/api/provider-settings/catalog?${n.toString()}`)}var V=n();function H(e){return e?e>=1e6?`${(e/1e6).toString().replace(/\.0$/,``)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e):`—`}function U({label:e,value:t}){return(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-1.5`,children:[(0,V.jsx)(`span`,{className:`text-caption text-muted`,children:e}),(0,V.jsx)(`span`,{className:`min-w-0 text-right text-caption font-medium`,children:t})]})}function xe({model:e,t,onClose:n}){if(!e)return null;let r=e.reasoning_options||[],i=e.catalog_context_length||e.default_context_length||e.context_length,a=e.catalog_context_length_max,o=S(e),s=String(e.provider||e.owned_by||`qoder`).trim().toLowerCase(),c=String(e.region||e.regions?.[0]||``).trim().toLowerCase(),l=j(s,c||void 0,t),u=s===`trae`?M(e):void 0,d=e.supports_images===!0?t(`imageInputDeclared`):e.supports_images===!1?t(`imageInputUnsupported`):t(`imageInputNotDeclared`),f=u?.prompt_max_tokens||e.prompt_max_tokens,p=u?.max_output_tokens||e.max_output_tokens;return(0,V.jsx)(g.Root,{isOpen:!0,onOpenChange:e=>{e||n()},children:(0,V.jsx)(g.Backdrop,{variant:`blur`,children:(0,V.jsx)(g.Container,{size:`md`,scroll:`inside`,children:(0,V.jsxs)(g.Dialog,{children:[(0,V.jsxs)(g.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`truncate text-section`,children:e.display_name||e.id}),o?(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null]}),(0,V.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:e.id})]}),(0,V.jsx)(g.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,V.jsx)(de,{size:16})})]}),(0,V.jsxs)(g.Body,{className:`space-y-3 px-5 pb-5`,children:[(0,V.jsxs)(`section`,{className:`divide-y divide-separator rounded-lg border border-separator px-3 py-1`,children:[(0,V.jsx)(U,{label:t(`providerCol`),value:l}),(0,V.jsx)(U,{label:t(`contextWindowCol`),value:(0,V.jsxs)(`span`,{className:`mono`,children:[H(i),a&&a!==i?` → ${H(a)}`:``]})}),f?(0,V.jsx)(U,{label:t(`promptMaxTokens`),value:(0,V.jsx)(`span`,{className:`mono`,children:H(f)})}):null,p?(0,V.jsx)(U,{label:t(`maxOutputTokens`),value:(0,V.jsx)(`span`,{className:`mono`,children:H(p)})}):null,(0,V.jsx)(U,{label:t(`imageInput`),value:d})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:t(`reasoningLevels`)}),r.length?(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(e=>(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:`default`,children:(0,V.jsx)(`span`,{className:`mono`,children:e})},e))}):(0,V.jsx)(`div`,{className:`text-caption text-muted`,children:e.reasoning_type?t(`reasoningFixed`,{type:e.reasoning_type}):t(`noReasoningLevels`)})]})]})]})})})})}function Se({catalog:e,selected:t,onChange:n,isDisabled:r,t:i}){let[a,o]=(0,P.useState)(``),[s,c]=(0,P.useState)(t),u=(0,P.useMemo)(()=>new Set(t),[t]),d=(0,P.useMemo)(()=>{let t=new Set(s),n=a.trim().toLowerCase(),r=(e||[]).filter(e=>!n||e.toLowerCase().includes(n));return[...r.filter(e=>t.has(e)),...r.filter(e=>!t.has(e))]},[e,a,s]),f=(0,P.useMemo)(()=>{if(!e)return[];let n=new Set(e);return t.filter(e=>!n.has(e))},[e,t]),m=e?.length??0,h=t.filter(e=>!f.includes(e)).length;function g(e){o(e),c(t)}function _(e,r){n(r?[...t,e]:t.filter(t=>t!==e))}function y(){let e=new Set(t);d.forEach(t=>e.add(t)),n([...e])}function b(){let e=new Set(d);n(t.filter(t=>!e.has(t)))}return(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(v,{"aria-label":i(`modelPickerSearch`),value:a,onChange:g,isDisabled:r,className:`min-w-0 flex-1 basis-48`,children:(0,V.jsxs)(v.Group,{children:[(0,V.jsx)(v.SearchIcon,{}),(0,V.jsx)(v.Input,{placeholder:i(`modelPickerSearch`)}),(0,V.jsx)(v.ClearButton,{})]})}),(0,V.jsx)(`span`,{className:`mono shrink-0 text-caption text-muted`,children:i(`modelPickerCount`,{selected:h,total:m})}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,V.jsxs)(l,{size:`sm`,variant:`ghost`,isDisabled:r||d.length===0,onPress:y,children:[(0,V.jsx)(R,{size:14}),i(`modelPickerSelectAll`)]}),(0,V.jsxs)(l,{size:`sm`,variant:`ghost`,isDisabled:r||t.length===0,onPress:b,children:[(0,V.jsx)(_e,{size:14}),i(`modelPickerClear`)]})]})]}),(0,V.jsxs)(`div`,{className:`max-h-[300px] overflow-y-auto overscroll-contain rounded-lg bg-surface-secondary p-1`,children:[e===null?(0,V.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(`refreshing`)}):null,f.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md px-2.5 py-1.5`,children:[(0,V.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-body text-muted line-through`,children:e}),(0,V.jsx)(`span`,{className:`shrink-0 text-caption text-warning`,children:i(`modelPickerOffline`)}),(0,V.jsx)(l,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:r,"aria-label":i(`modelPickerRemove`,{model:e}),onPress:()=>_(e,!1),children:(0,V.jsx)(de,{size:14})})]},`offline-${e}`)),d.map(e=>(0,V.jsx)(p,{isSelected:u.has(e),isDisabled:r,onChange:t=>_(e,t),className:`flex w-full cursor-pointer rounded-md px-2.5 py-1.5 transition-colors hover:bg-default`,children:(0,V.jsxs)(p.Content,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,V.jsx)(p.Control,{children:(0,V.jsx)(p.Indicator,{})}),(0,V.jsx)(`span`,{className:`mono min-w-0 truncate text-body text-foreground`,children:e})]})},e)),e!==null&&d.length===0?(0,V.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(m===0?`noAccountModels`:`modelPickerNoMatch`)}):null]})]})}function Ce(e){let t=e.toLowerCase();return![`trae`,`kimi`,`codearts`,`minimaxcode`,`opencode`].includes(t)}function W(e){let t=e.toLowerCase();return t===`workbuddy`||t===`trae`}function G(e){return e.toLowerCase()===`qoder`?`11:00`:`01:00`}function we({provider:e,region:t,label:n,policy:r,checkinSupported:i,checkinTimezone:a,t:o,onClose:s,onSaved:c}){let[d,f]=(0,P.useState)(r.credit_floor==null?`inherit`:`custom`),[p,m]=(0,P.useState)(r.credit_floor??0),[v,b]=(0,P.useState)(r.percent_floor==null?`inherit`:`custom`),[x,S]=(0,P.useState)(r.percent_floor??0),[ee,te]=(0,P.useState)(r.proxy_url||``),[C,ne]=(0,P.useState)(r.drop_system_prompt??Ce(e)),[re,ie]=(0,P.useState)(Object.entries(r.model_aliases||{}).map(([e,t])=>({alias:e,model:t}))),[w,ae]=(0,P.useState)({alias:``,model:``}),[T,se]=(0,P.useState)(!!r.models_restricted||!!(r.enabled_models||[]).length),[ce,le]=(0,P.useState)(r.enabled_models||[]),{mounted:ue,outerRef:D,innerRef:O}=ve(T),[fe,pe]=(0,P.useState)(null),[me,k]=(0,P.useState)(``),[A,j]=(0,P.useState)(r.checkin_time||(e.toLowerCase()===`qoder`?`11:00`:`01:00`)),[M,ge]=(0,P.useState)(r.checkin_auto!==!1),[F,I]=(0,P.useState)(!1),[L,R]=(0,P.useState)(``);(0,P.useEffect)(()=>{let n=!1;return B(e,t).then(e=>{n||(pe((e.data||[]).map(e=>e.id)),k(``))}).catch(e=>{n||(pe([]),k(e instanceof Error?e.message:String(e)))}),()=>{n=!0}},[e,t]);async function z(n){if(n?.preventDefault(),d===`custom`&&(!Number.isFinite(p)||p<0)){R(o(`creditFloorInvalid`));return}if(v===`custom`&&(!Number.isFinite(x)||x<0||x>100)){R(o(`percentFloorInvalid`));return}if(i&&!M&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(A)){R(o(`checkinTimeInvalid`));return}if(T&&ce.length===0){R(o(`providerModelsEmpty`));return}R(``),I(!0);try{let n={provider:e,region:t,credit_floor:d===`custom`?p:null,percent_floor:v===`custom`?x:null,proxy_url:ee.trim(),drop_system_prompt:C,model_aliases:Object.fromEntries(re.filter(e=>e.alias.trim()&&e.model.trim()).map(e=>[e.alias.trim(),e.model.trim()])),enabled_models:T?ce:[],models_restricted:T,checkin_time:i?A:``,checkin_auto:i?M:!1};c((await be(n)).data||n),s()}catch(e){R(e instanceof Error?e.message:String(e))}finally{I(!1)}}return(0,V.jsx)(g.Root,{isOpen:!0,onOpenChange:e=>{!e&&!F&&s()},children:(0,V.jsx)(g.Backdrop,{variant:`blur`,children:(0,V.jsx)(g.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,V.jsxs)(g.Dialog,{className:`w-full sm:w-[42rem] sm:max-w-[calc(100vw-2rem)]`,children:[(0,V.jsxs)(g.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(g.Heading,{className:`text-section font-semibold`,children:o(`providerSettingsTitle`)}),(0,V.jsx)(`p`,{className:`mt-1.5 text-body font-normal leading-6 text-muted`,children:o(`providerSettingsHint`)}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(E,{size:`sm`,variant:`soft`,children:(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,V.jsx)(he,{provider:e,size:14}),(0,V.jsx)(`span`,{children:n})]})}),(0,V.jsx)(`span`,{className:`mono text-caption text-muted`,children:t||`any`})]})]}),(0,V.jsx)(g.CloseTrigger,{isDisabled:F,"aria-label":o(`close`),className:`grid size-9 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,V.jsx)(de,{size:18})})]}),(0,V.jsxs)(g.Body,{className:`px-6 pb-2 pt-1`,children:[L?(0,V.jsxs)(u,{status:`danger`,className:`mb-4`,children:[(0,V.jsx)(u.Indicator,{}),(0,V.jsx)(u.Content,{children:(0,V.jsx)(u.Title,{children:L})})]}):null,me?(0,V.jsxs)(u,{status:`warning`,className:`mb-4`,children:[(0,V.jsx)(u.Indicator,{}),(0,V.jsx)(u.Content,{children:(0,V.jsx)(u.Title,{children:me})})]}):null,(0,V.jsxs)(oe,{className:`space-y-4`,onSubmit:e=>void z(e),children:[(0,V.jsx)(N,{label:o(`creditFloor`),hint:o(`creditFloorHint`),align:`start`,children:(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(y,{isSelected:d===`custom`,isDisabled:F,ariaLabel:o(`creditFloorCustom`),label:o(`creditFloorCustom`),onChange:e=>f(e?`custom`:`inherit`)}),d===`custom`?(0,V.jsx)(_,{value:p,onChange:e=>m(e??0),minValue:0,step:1,isDisabled:F,isRequired:!0,children:(0,V.jsxs)(_.Group,{children:[(0,V.jsx)(_.DecrementButton,{}),(0,V.jsx)(_.Input,{"aria-label":o(`creditFloor`)}),(0,V.jsx)(_.IncrementButton,{})]})}):(0,V.jsx)(`p`,{className:`text-caption text-muted`,children:o(`creditFloorInheritHint`)})]})}),(0,V.jsx)(N,{label:o(`percentFloor`),hint:o(`percentFloorHint`),align:`start`,children:(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(y,{isSelected:v===`custom`,isDisabled:F,ariaLabel:o(`percentFloorCustom`),label:o(`percentFloorCustom`),onChange:e=>b(e?`custom`:`inherit`)}),v===`custom`?(0,V.jsx)(_,{value:x,onChange:e=>S(e??0),minValue:0,maxValue:100,step:1,isDisabled:F,isRequired:!0,children:(0,V.jsxs)(_.Group,{children:[(0,V.jsx)(_.DecrementButton,{}),(0,V.jsx)(_.Input,{"aria-label":o(`percentFloor`)}),(0,V.jsx)(_.IncrementButton,{})]})}):(0,V.jsx)(`p`,{className:`text-caption text-muted`,children:o(`percentFloorInheritHint`)})]})}),(0,V.jsx)(N,{label:o(`proxyUrl`),hint:o(`proxyUrlHint`),children:(0,V.jsx)(h,{value:ee,onChange:e=>te(e.target.value),placeholder:o(`proxyUrlPlaceholder`),"aria-label":o(`proxyUrl`),disabled:F})}),W(e)?(0,V.jsx)(N,{label:o(`dropSystemPrompt`),hint:o(e===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptHint`),children:(0,V.jsx)(y,{isSelected:C,isDisabled:F,ariaLabel:o(`dropSystemPrompt`),onChange:ne})}):null,(0,V.jsx)(N,{align:`start`,label:o(`accountModelAliases`),hint:o(`accountModelAliasesHint`),children:(0,V.jsxs)(`div`,{className:`space-y-2`,children:[re.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,V.jsxs)(`span`,{className:`mono min-w-0 truncate text-body`,children:[e.alias,` → `,e.model]}),(0,V.jsx)(l,{size:`sm`,variant:`ghost`,isDisabled:F,onPress:()=>ie(t=>t.filter(t=>t.alias!==e.alias)),children:o(`modelAliasRemove`)})]},e.alias)),(0,V.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr_auto]`,children:[(0,V.jsx)(h,{"aria-label":o(`modelAliasName`),value:w.alias,onChange:e=>ae(t=>({...t,alias:e.target.value})),placeholder:o(`modelAliasPlaceholder`),disabled:F}),(0,V.jsx)(h,{"aria-label":o(`modelAliasTarget`),value:w.model,onChange:e=>ae(t=>({...t,model:e.target.value})),placeholder:o(`accountModelAliasTargetPlaceholder`),disabled:F}),(0,V.jsx)(l,{size:`sm`,variant:`secondary`,isDisabled:F||!w.alias.trim()||!w.model.trim(),onPress:()=>{ie(e=>[...e.filter(e=>e.alias!==w.alias.trim()),{alias:w.alias.trim(),model:w.model.trim()}]),ae({alias:``,model:``})},children:o(`modelAliasAdd`)})]})]})}),(0,V.jsxs)(`section`,{className:`space-y-3 pt-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:o(`enabledModels`)}),(0,V.jsx)(`p`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:o(`enabledModelsHint`)})]}),(0,V.jsx)(y,{isSelected:T,isDisabled:F,ariaLabel:o(`restrictModels`),label:o(T?`restrictModels`:`allModels`),onChange:se})]}),ue?(0,V.jsx)(`div`,{ref:D,children:(0,V.jsx)(`div`,{ref:O,children:(0,V.jsx)(Se,{catalog:fe,selected:ce,onChange:le,isDisabled:F,t:o})})}):null]}),i?(0,V.jsx)(N,{label:o(`autoCheckinTime`),hint:o(`checkinScheduleHint`),children:(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`span`,{className:`text-caption text-muted`,children:o(`checkinAutoMode`)}),(0,V.jsx)(y,{isSelected:M,isDisabled:F,ariaLabel:o(`checkinAutoMode`),onChange:ge})]}),(0,V.jsx)(h,{type:`time`,value:M?G(e):A,onChange:e=>j(e.target.value),"aria-label":o(`autoCheckinTime`),disabled:F||M,required:!M}),a?(0,V.jsx)(`p`,{className:`text-caption text-muted`,children:o(`checkinServerClock`,{timezone:a})}):null,M?(0,V.jsx)(`p`,{className:`text-caption text-muted`,children:o(`checkinAutoFallbackHint`)}):null]})}):null]})]}),(0,V.jsxs)(g.Footer,{className:`justify-end gap-2 px-6 pb-6`,children:[(0,V.jsx)(l,{variant:`ghost`,isDisabled:F,onPress:s,children:o(`cancel`)}),(0,V.jsx)(l,{isPending:F,onPress:()=>void z(),children:o(`save`)})]})]})})})})}function Te(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id,checkin:!!e.checkin,checkinTimezone:e.checkin?.timezone===`Local`?`Asia/Shanghai`:e.checkin?.timezone});return t}function Ee(e,t){let n=new Set;for(let r of e){let e=String(r.provider||`qoder`).trim().toLowerCase(),i=String(r.region||``).trim().toLowerCase(),a=t.find(t=>t.provider===e&&t.region===i)||t.find(t=>t.provider===e);a&&n.add(a.value)}return Array.from(n)}function K(e){return e.settings_key||e.id}function q(e){return String(e.provider||e.owned_by||`qoder`).trim().toLowerCase()}function De(e){let t=String(e.region||``).trim().toLowerCase();if(t)return t;let n=e.regions||[];return String(n[0]||``).trim().toLowerCase()}function Oe(e){return`${q(e)}:${De(e)||`any`}:${e.settings_key||e.id}:${e.native_model||e.mapped_key||``}`}function J(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function ke(e,t){let n=new Map;for(let r of e){let e=q(r),i=De(r),a=`${e}:${i||`any`}`,o=n.get(a);o||(o={key:a,provider:e,region:i,label:j(e,i||void 0,t),models:[]},n.set(a,o)),o.models.push(r)}return Array.from(n.values())}function Ae(e){let t=e.toLowerCase();return![`trae`,`kimi`,`codearts`,`minimaxcode`,`opencode`].includes(t)}function je(e,t){return e.region&&e.region!==`any`?e.region:t.find(t=>t.provider===e.provider)?.region||``}function Me(e,t){let n=new Map(t.map((e,t)=>[`${e.provider}:${e.region||`any`}`,t]));return[...e].sort((e,t)=>{let r=n.get(e.key),i=n.get(t.key);return r!=null&&i!=null?r-i:r==null?i==null?0:1:-1})}function Ne(e,t,n){return e.find(e=>e.provider===t&&(e.region||`any`)===n)||{provider:t,region:n,credit_floor:null,percent_floor:null,proxy_url:``,drop_system_prompt:Ae(t),model_aliases:{},enabled_models:[],models_restricted:!1,checkin_time:`09:00`,checkin_auto:!0}}function Pe({model:e,saving:t,t:n,variant:r=`table`,onToggleTraeMax:i}){let a=q(e),o=r===`card`,s=e.catalog_context_length||e.context_length,c=e.catalog_context_length_max,l=!!(c&&c!==s),u=e.reasoning_options||[],d=(a===`trae`||a===`qoder`)&&e.supports_max_mode,f=u.length?u.join(` / `):e.reasoning_type?n(`reasoningFixed`,{type:e.reasoning_type}):`—`;return(0,V.jsxs)(`div`,{className:o?`flex min-w-0 flex-col gap-2`:`flex min-w-0 flex-col gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsxs)(`span`,{className:`mono text-caption font-medium`,children:[H(s),l?` → ${H(c)}`:``]}),d?(0,V.jsx)(y,{isSelected:!!e.max_mode,isDisabled:t,ariaLabel:`${e.id} ${n(`maxMode`)}`,onChange:t=>i(e,t)}):null]}),(0,V.jsx)(`div`,{className:`min-w-0 truncate text-caption text-muted`,title:f,children:f})]})}function Fe({model:e,t,onDetails:n}){return(0,V.jsxs)(l,{size:`sm`,variant:`ghost`,onPress:()=>n(e),children:[(0,V.jsx)(D,{size:14}),t(`modelDetails`)]})}function Y({group:e,t}){return(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface text-foreground`,children:(0,V.jsx)(he,{provider:e.provider,size:16})}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`truncate text-body font-semibold`,children:e.label}),(0,V.jsx)(`div`,{className:`text-caption text-muted`,children:t(`usageModelCount`,{count:e.models.length})})]})]})}function Ie({group:e,t,collapsible:n,collapsed:i,onToggle:a,onSettings:o,settingsDisabled:s,savingKey:c,modelCheckChip:u,onToggleTraeMax:d,onDetails:p}){let m=(0,P.useId)(),{mounted:h,outerRef:g,innerRef:_}=ve(!n||!i);return(0,V.jsxs)(f,{className:`overflow-hidden p-0`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 bg-surface-secondary px-4 py-3 ${h?`border-b border-separator`:``}`,children:[n?(0,V.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center justify-between gap-3 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-focus`,"aria-expanded":!i,"aria-controls":m,"aria-label":`${t(i?`providerExpand`:`providerCollapse`)} ${e.label}`,onClick:a,children:[(0,V.jsx)(Y,{group:e,t}),(0,V.jsx)(r,{size:16,className:`shrink-0 text-muted transition-transform ${i?``:`rotate-90`}`,"aria-hidden":!0})]}):(0,V.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:(0,V.jsx)(Y,{group:e,t})}),(0,V.jsxs)(l,{className:`shrink-0`,size:`sm`,variant:`ghost`,isDisabled:s,onPress:o,children:[(0,V.jsx)(se,{size:14}),t(`providerSettingsOpen`)]})]}),h?(0,V.jsx)(`div`,{id:m,ref:g,className:`min-w-0`,children:(0,V.jsx)(`div`,{ref:_,children:e.models.length===0?(0,V.jsx)(`div`,{className:`px-4 py-8 text-center text-caption text-muted`,children:t(`noModelsYet`)}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:e.models.map(e=>{let n=c===K(e),r=x(e),i=S(e);return(0,V.jsxs)(`article`,{className:`space-y-3 px-4 py-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":e.stale?void 0:`ok`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`truncate font-medium`,children:e.display_name||e.id}),i?(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null,r?(0,V.jsx)(`span`,{className:`mono text-caption text-muted`,children:r}):null]}),(0,V.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:e.id}),J(e)?(0,V.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:t(`routedTo`,{model:J(e)})}):null]})]}),u(e)]}),(0,V.jsx)(`div`,{className:`mono break-all text-caption text-muted`,children:e.mapped_key||e.native_model||e.id}),(0,V.jsx)(Pe,{model:e,saving:n,t,variant:`card`,onToggleTraeMax:d}),(0,V.jsx)(Fe,{model:e,t,onDetails:p})]},Oe(e))})}),(0,V.jsx)(b,{className:`hidden min-w-0 lg:block`,children:(0,V.jsx)(b.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,V.jsxs)(b.Content,{"aria-label":`${e.label} ${t(`availableModels`)}`,className:`min-w-[58rem]`,children:[(0,V.jsxs)(b.Header,{children:[(0,V.jsx)(b.Column,{isRowHeader:!0,children:t(`modelCol`)}),(0,V.jsx)(b.Column,{children:t(`requestIdCol`)}),(0,V.jsx)(b.Column,{children:t(`qoderKeyCol`)}),(0,V.jsx)(b.Column,{children:t(`modelDefaultsCol`)}),(0,V.jsx)(b.Column,{children:t(`stateCol`)}),(0,V.jsx)(b.Column,{children:t(`modelDetailsCol`)})]}),(0,V.jsx)(b.Body,{children:e.models.map(e=>{let n=c===K(e),r=x(e),i=S(e);return(0,V.jsxs)(b.Row,{children:[(0,V.jsx)(b.Cell,{children:(0,V.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,V.jsx)(`span`,{className:`status-dot`,"data-state":e.stale?void 0:`ok`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`font-medium`,children:e.display_name||e.id}),i?(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null,r?(0,V.jsx)(`span`,{className:`mono text-caption text-muted`,children:r}):null]}),J(e)?(0,V.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:t(`routedTo`,{model:J(e)})}):null]})]})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`span`,{className:`mono text-caption font-medium`,children:e.id})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`span`,{className:`mono text-caption text-muted`,children:e.mapped_key||e.native_model||e.id})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(Pe,{model:e,saving:n,t,variant:`table`,onToggleTraeMax:d})}),(0,V.jsx)(b.Cell,{children:u(e)}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(Fe,{model:e,t,onDetails:p})})]},Oe(e))})})]})})})]})})}):null]})}function Le(){let{t:e}=s(),{overview:t,loading:n}=ue(),[r,c]=(0,P.useState)(``),[u,p]=(0,P.useState)(``),[h,g]=(0,P.useState)([]),[_,v]=(0,P.useState)(!0),[y,x]=(0,P.useState)(null),[S,C]=(0,P.useState)(!0),[oe,T]=(0,P.useState)([]),[se,de]=(0,P.useState)(!0),[D,O]=(0,P.useState)(!1),[k,A]=(0,P.useState)(null),[he,M]=(0,P.useState)(new Set),[N,F]=(0,P.useState)(1),[I,L]=(0,P.useState)(50),[R,z]=(0,P.useState)(!1),[_e,ve]=(0,P.useState)(``),[be,B]=(0,P.useState)(``),[H,U]=(0,P.useState)(!1),[Se,Ce]=(0,P.useState)(null),[W,G]=(0,P.useState)([]),[J,Ae]=(0,P.useState)(!0),[Pe,Fe]=(0,P.useState)(!1),[Y,Le]=(0,P.useState)(null);(0,P.useEffect)(()=>{let e=!1;return ie(void 0,`regional`).then(t=>{e||G(t.data||[])}).catch(()=>void 0).finally(()=>{e||Ae(!1)}),ne().then(t=>{e||g(Te(t.data||[]))}).catch(()=>void 0).finally(()=>{e||v(!1)}),re(!1).then(t=>{e||x(t.data||[])}).catch(()=>{e||x(null)}).finally(()=>{e||C(!1)}),ye().then(t=>{e||T(t.data||[])}).catch(t=>{e||(O(!0),U(!0),B(t instanceof Error?t.message:String(t)))}).finally(()=>{e||de(!1)}),()=>{e=!0}},[]);let Re=(0,P.useMemo)(()=>y?Ee(y,h):null,[y,h]),ze=(0,P.useMemo)(()=>{let e=new Set;for(let t of W){let n=q(t),r=De(t),i=h.find(e=>e.provider===n&&e.region===r)||h.find(e=>e.provider===n);i&&e.add(i.value)}return Array.from(e)},[W,h]),X=(0,P.useMemo)(()=>{let e=Re&&Re.length?Re:ze;return e.length?h.filter(t=>e.includes(t.value)):[]},[Re,ze,h]),Z=u===``||X.some(e=>e.value===u)?u:X[0]?.value||``,Be=Z===``,Q=(0,P.useMemo)(()=>{let t=r.trim().toLowerCase(),[n,i]=Z.includes(`:`)?Z.split(`:`,2):[Z,``];return W.filter(r=>{let a=q(r),o=De(r);if(n&&a!==n||i&&o!==i)return!1;if(!t)return!0;let s=j(a,o||void 0,e);return`${r.display_name||``} ${r.id} ${r.mapped_key||``} ${a} ${s} ${r.owned_by||``} ${o} ${r.credits||``} ${r.free?`free`:``}`.toLowerCase().includes(t)})},[r,W,Z,e]),Ve=[r,Z,I].join(`\0`),[He,Ue]=(0,P.useState)(Ve);He!==Ve&&(Ue(Ve),F(1));let We=(0,P.useMemo)(()=>{let t=ke(Q,e);if(r.trim())return Me(t,X);let n=new Set(t.map(e=>e.key)),i=r=>{let i=`${r.provider}:${r.region||`any`}`;n.has(i)||(n.add(i),t.push({key:i,provider:r.provider,region:r.region,label:j(r.provider,r.region,e),models:[]}))};if(Z){let e=X.find(e=>e.value===Z);e&&i(e)}else for(let e of X)i(e);for(let r of oe){if(!r.models_restricted||!r.provider||!r.region||r.region===`any`)continue;if(Z){let[e,t]=Z.includes(`:`)?Z.split(`:`,2):[Z,``];if(e&&e!==r.provider||t&&t!==r.region)continue}let i=`${r.provider}:${r.region}`;n.has(i)||(n.add(i),t.push({key:i,provider:r.provider,region:r.region,label:j(r.provider,r.region,e),models:[]}))}return Me(t,X)},[Q,r,Z,X,oe,e]),Ge=(0,P.useMemo)(()=>{let e=[],t=[],n=0;for(let r of We)t.length>0&&n+r.models.length>I&&(e.push(t),t=[],n=0),t.push(r),n+=r.models.length;return t.length>0&&e.push(t),e.length>0?e:[[]]},[We,I]),Ke=Math.max(1,Ge.length),$=Math.min(He===Ve?Math.max(1,N):1,Ke);N!==$&&F($);let qe=Ge[$-1]??[],Je=Ge.slice(0,$-1).reduce((e,t)=>e+t.reduce((e,t)=>e+t.models.length,0),0),Ye=qe.reduce((e,t)=>e+t.models.length,0),Xe=Q.length===0?0:Je+1,Ze=Q.length===0?0:Je+Ye,Qe=Q.length?e(`logsShownTotal`,{shown:`${Xe}–${Ze}`,total:Q.length}):e(`shownTotal`,{shown:0,total:W.length}),$e=k?h.find(e=>e.provider===k.provider&&e.region===k.region):void 0,et=k?Ne(oe,k.provider,k.region):null;if(n&&!t||J||S||_)return(0,V.jsx)(fe,{});function tt(e,t){let n=K(e),r=q(e),i=W.map(e=>{if(K(e)!==n||q(e)!==r)return e;let i=e.reasoning_effort||e.reasoning_default||``,a=e.catalog_context_length||e.default_context_length||e.context_length||0,o=e.catalog_context_length_max||0;return{...e,max_mode:t,context_length:t&&o?o:a,default_context_length:a,context_custom:r===`qoder`?t:t||!!(i&&i!==e.reasoning_default)}});G(i)}function nt(e){M(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function rt(){z(!0),B(``),U(!1);try{let e=await te(void 0,`regional`);G(e.data||[])}catch(e){U(!0),B(e instanceof Error?e.message:String(e))}finally{z(!1)}}function it(e){return Y?.results.find(t=>t.model===e.id)}function at(t){let n=it(t);if(!n)return(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:`default`,children:e(`checkNotRun`)});let r=n.accounts||[],i=r.length?r.filter(e=>e.ok).length:+!!n.ok,a=r.length||n.attempt_count||+!!n.ok;return(0,V.jsxs)(E,{size:`sm`,variant:`soft`,color:n.ok?`success`:`danger`,children:[n.ok?e(`checkResultOK`):e(`checkResultFailed`),a?` · ${e(`checkPassedAccounts`,{passed:i,total:a})}`:``]})}async function ot(){if(!W.length){B(e(`checkModelsEmpty`)),U(!1);return}Fe(!0),Le(null),B(``),U(!1);try{let t=await w(W.map(e=>e.id));Le(t),B(e(`checkModelsSummary`,{passed:t.summary.passed,failed:t.summary.failed,total:t.summary.total,elapsed:t.elapsed_ms}))}catch(e){U(!0),B(e instanceof Error?e.message:String(e))}finally{Fe(!1)}}async function st(t,n){if(!t.supports_max_mode){U(!0),B(e(`contextMaxUnavailable`));return}let r=K(t),i=q(t);ve(r),B(``),U(!1);try{await ee(i,r,n,t.catalog_context_length_max),tt(t,n),B(e(n?`contextMaxOn`:`contextMaxOff`,{model:t.id}))}catch(e){U(!0),B(e instanceof Error?e.message:String(e))}finally{ve(``)}}function ct(t){if(se||D){U(!0),B(e(D?`providerSettingsLoadFailed`:`refreshing`));return}let n=je(t,h);if(!n&&h.some(e=>e.provider===t.provider)){U(!0),B(e(`providerSettingsRegionMissing`));return}A({provider:t.provider,region:n,label:t.label})}function lt(t){T(e=>[...e.filter(e=>e.provider!==t.provider||(e.region||`any`)!==(t.region||`any`)),t]),U(!1),B(e(`providerSettingsSaved`)),ae(void 0,`regional`).then(e=>G(e.data||[])).catch(t=>{U(!0),B(e(`providerSettingsSavedRefreshFailed`,{message:t instanceof Error?t.message:String(t)}))})}return(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-6`,children:[(0,V.jsx)(`p`,{"data-gsap-reveal":!0,className:`mr-auto text-body text-muted`,children:W.length?Qe:e(`noModelsYet`)}),(0,V.jsxs)(`div`,{"data-gsap-reveal":!0,className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[(0,V.jsx)(o,{className:`w-full min-w-0 sm:w-72`,value:r,onChange:c,placeholder:e(`filterPh`),ariaLabel:e(`filter`)}),(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[X.length?(0,V.jsx)(ge,{ariaLabel:e(`providerCol`),value:Z,onChange:p,options:[{id:``,label:e(`providerFilterAll`)},...X.map(t=>({id:t.value,label:j(t.provider,t.region,e)}))]}):null,(0,V.jsxs)(l,{size:`sm`,variant:`secondary`,isPending:R||Pe,onPress:()=>void rt(),children:[(0,V.jsx)(ce,{size:14}),e(R?`refreshing`:`refresh`)]}),(0,V.jsxs)(me,{children:[(0,V.jsx)(me.Trigger,{children:(0,V.jsxs)(l,{size:`sm`,variant:`secondary`,isPending:Pe,isDisabled:R||W.length===0,onPress:()=>void ot(),children:[(0,V.jsx)(le,{size:14}),e(Pe?`checkingModels`:`checkAllModels`)]})}),(0,V.jsx)(me.Content,{children:(0,V.jsx)(`p`,{className:`max-w-xs text-caption leading-5`,children:e(`checkModelsHint`)})})]})]})]})]}),be?(0,V.jsx)(d,{status:H?`danger`:`success`,title:be}):null,Y?(0,V.jsxs)(f,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-separator px-4 py-4 sm:items-center sm:px-5`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-body font-semibold`,children:e(`checkAllModels`)}),(0,V.jsx)(`div`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:e(`checkModelsSummary`,{passed:Y.summary.passed,failed:Y.summary.failed,total:Y.summary.total,elapsed:Y.elapsed_ms})})]}),(0,V.jsxs)(E,{size:`sm`,variant:`soft`,color:Y.summary.failed?`warning`:`success`,className:`shrink-0`,children:[Y.summary.passed,`/`,Y.summary.total]})]}),(0,V.jsx)(b,{className:`hidden min-w-0 lg:block`,children:(0,V.jsx)(b.ScrollContainer,{className:`max-h-[24rem] min-w-0 overflow-auto`,children:(0,V.jsxs)(b.Content,{"aria-label":e(`checkAllModels`),className:`min-w-[52rem]`,children:[(0,V.jsxs)(b.Header,{children:[(0,V.jsx)(b.Column,{isRowHeader:!0,children:e(`modelCol`)}),(0,V.jsx)(b.Column,{children:e(`stateCol`)}),(0,V.jsx)(b.Column,{children:e(`account`)}),(0,V.jsx)(b.Column,{children:e(`providerCol`)}),(0,V.jsx)(b.Column,{children:e(`logsColLatency`)}),(0,V.jsx)(b.Column,{children:e(`checkAccountResults`)}),(0,V.jsx)(b.Column,{children:e(`response`)})]}),(0,V.jsx)(b.Body,{children:Y.results.map(t=>(0,V.jsxs)(b.Row,{children:[(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`span`,{className:`mono text-caption font-medium`,children:t.model})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:t.ok?`success`:t.code===`no_models`||t.message===`model required`?`warning`:`danger`,children:t.ok?e(`checkResultOK`):t.code===`no_models`||t.message===`model required`?e(`checkResultSkipped`):e(`checkResultFailed`)})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`span`,{className:`mono text-caption text-muted`,children:t.account_id||`—`})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`span`,{className:`text-caption`,children:t.provider||`—`})}),(0,V.jsx)(b.Cell,{children:(0,V.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[t.latency_ms,`ms`]})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`div`,{className:`space-y-1`,children:(t.accounts||[]).length?t.accounts.map(n=>(0,V.jsxs)(`div`,{className:`text-caption leading-4`,children:[(0,V.jsx)(`span`,{className:`mono font-medium`,children:n.account_id}),(0,V.jsxs)(`span`,{className:n.ok?`text-success`:`text-danger`,children:[` `,n.ok?e(`checkResultOK`):e(`checkResultFailed`)]}),(0,V.jsxs)(`span`,{className:`text-muted`,children:[` · `,n.latency_ms,`ms`]}),n.message?(0,V.jsx)(`span`,{className:`block break-all text-muted`,children:n.message}):null]},`${t.model}:${n.account_id}`)):(0,V.jsx)(`span`,{className:`text-caption text-muted`,children:`—`})})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`span`,{className:`break-all text-caption text-muted`,children:t.message||(t.ok?e(`checkResultOK`):``)})})]},t.model))})]})})}),(0,V.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:Y.results.map(t=>(0,V.jsxs)(`div`,{className:`space-y-1 px-4 py-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`span`,{className:`mono min-w-0 truncate text-caption font-medium`,children:t.model}),(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:t.ok?`success`:`danger`,children:t.ok?e(`checkResultOK`):e(`checkResultFailed`)})]}),(0,V.jsxs)(`div`,{className:`text-caption text-muted`,children:[t.account_id||t.provider||`—`,` · `,t.latency_ms,`ms`]}),(t.accounts||[]).length?(0,V.jsx)(`div`,{className:`space-y-0.5`,children:t.accounts.map(n=>(0,V.jsxs)(`div`,{className:`text-caption leading-4`,children:[(0,V.jsx)(`span`,{className:`mono font-medium`,children:n.account_id}),(0,V.jsxs)(`span`,{className:n.ok?`text-success`:`text-danger`,children:[` `,n.ok?e(`checkResultOK`):e(`checkResultFailed`)]}),(0,V.jsxs)(`span`,{className:`text-muted`,children:[` · `,n.latency_ms,`ms`]}),n.message?(0,V.jsx)(`span`,{className:`block break-all text-muted`,children:n.message}):null]},`${t.model}:${n.account_id}`))}):null,t.message?(0,V.jsx)(`div`,{className:`break-all text-caption text-muted`,children:t.message}):null]},t.model))})]}):null,R||n?(0,V.jsx)(f,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:(0,V.jsx)(pe,{})}):We.length===0?(0,V.jsx)(f,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:(0,V.jsx)(m,{icon:(0,V.jsx)(i,{size:22}),title:W.length?e(`noModelsMatch`):e(`noProviders`),hint:W.length?e(`noModelsMatch`):e(`noModelsYet`)})}):(0,V.jsx)(`div`,{"data-gsap-reveal":!0,className:`space-y-4`,children:qe.map(t=>(0,V.jsx)(Ie,{group:t,t:e,collapsible:Be,collapsed:Be&&he.has(t.key),onToggle:()=>nt(t.key),onSettings:()=>ct(t),settingsDisabled:se||D,savingKey:_e,modelCheckChip:at,onToggleTraeMax:(e,t)=>void st(e,t),onDetails:Ce},t.key))}),(0,V.jsx)(xe,{model:Se?W.find(e=>Oe(e)===Oe(Se))||Se:null,t:e,onClose:()=>Ce(null)}),k&&et?(0,V.jsx)(we,{provider:k.provider,region:k.region,label:k.label,policy:et,checkinSupported:!!$e?.checkin,checkinTimezone:$e?.checkinTimezone,t:e,onClose:()=>A(null),onSaved:e=>lt(e)},`${k.provider}:${k.region}`):null,(0,V.jsx)(a,{total:Q.length,page:$,pageCount:Ke,pageSize:I,loading:R,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:$,pages:Ke}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:F,onPageSize:L})]})}export{Le as ProvidersPage}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./CaretRight.es-DLLkzlqU.js";import{i,r as a,t as o}from"./SearchBar-7OerD-fU.js";import{n as s,pt as c,r as l}from"./useI18n-BAo1UrJW.js";import{n as u,t as d}from"./PageAlert-4fxVtrfI.js";import{n as f}from"./useToggle-DpH7h_oD.js";import{t as p}from"./checkbox-BfdndRMW.js";import{t as m}from"./EmptyPanel-Bs-jQMvG.js";import{t as h}from"./input-BwBv1RBO.js";import{t as g}from"./modal-6BQxrL1y.js";import{t as _}from"./number-field-BQgq-gwR.js";import{t as v}from"./search-field-DRk4_q5c.js";import{t as y}from"./CompactSwitch-D0aW-Phm.js";import{t as b}from"./table-B2nk0cjc.js";import{d as x,f as S}from"./format-BAkFbjAh.js";import{A as ee,C as te,M as C,_ as ne,d as re,h as ie,n as w,w as ae}from"./overview-ARhe2pSk.js";import{t as oe}from"./form-D5ELq0ds.js";import{t as T}from"./gsap-DWxn8li7.js";import{Bt as se,Gt as ce,It as le,N as E,O as ue,Ot as de,Rt as D,b as O,d as fe,f as pe,k as me,v as k,y as A}from"./index-CWTBzWuK.js";import{t as he}from"./ProviderMark-C49bIWJW.js";import{n as j,r as M}from"./provider-BZvt2HHB.js";import{t as N}from"./FormRow-CqpQhYrN.js";import{t as ge}from"./FilterSelect-qchbu2Tk.js";var P=t(e(),1),F=new Map([[`bold`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M79.51,144.49a12,12,0,1,1,17-17L112,143l47.51-47.52a12,12,0,0,1,17,17l-56,56a12,12,0,0,1-17,0ZM228,48V208a20,20,0,0,1-20,20H48a20,20,0,0,1-20-20V48A20,20,0,0,1,48,28H208A20,20,0,0,1,228,48Zm-24,4H52V204H204Z`}))],[`duotone`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M216,48V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),P.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48ZM208,208V48H48V208H208Z`}))],[`fill`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm-34.34,77.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM222,48V208a14,14,0,0,1-14,14H48a14,14,0,0,1-14-14V48A14,14,0,0,1,48,34H208A14,14,0,0,1,222,48Zm-12,0a2,2,0,0,0-2-2H48a2,2,0,0,0-2,2V208a2,2,0,0,0,2,2H208a2,2,0,0,0,2-2Z`}))],[`regular`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48ZM208,208V48H48V208H208Z`}))],[`thin`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM220,48V208a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V48A12,12,0,0,1,48,36H208A12,12,0,0,1,220,48Zm-8,0a4,4,0,0,0-4-4H48a4,4,0,0,0-4,4V208a4,4,0,0,0,4,4H208a4,4,0,0,0,4-4Z`}))]]),I=new Map([[`bold`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M208,28H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V48A20,20,0,0,0,208,28Zm-4,176H52V52H204Z`}))],[`duotone`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M216,48V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8H208A8,8,0,0,1,216,48Z`,opacity:`0.2`}),P.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V48H208V208Z`}))],[`fill`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M224,48V208a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48Z`}))],[`light`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M208,34H48A14,14,0,0,0,34,48V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V48A14,14,0,0,0,208,34Zm2,174a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2Z`}))],[`regular`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32Zm0,176H48V48H208V208Z`}))],[`thin`,P.createElement(P.Fragment,null,P.createElement(`path`,{d:`M208,36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36Zm4,172a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Z`}))]]),L=P.forwardRef((e,t)=>P.createElement(c,{ref:t,...e,weights:F}));L.displayName=`CheckSquareIcon`;var R=L,z=P.forwardRef((e,t)=>P.createElement(c,{ref:t,...e,weights:I}));z.displayName=`SquareIcon`;var _e=z;function ve(e){let[t,n]=(0,P.useState)(e);e&&!t&&n(!0);let r=(0,P.useRef)(null),i=(0,P.useRef)(null),a=(0,P.useRef)(e);return(0,P.useLayoutEffect)(()=>{let t=r.current,o=i.current;if(!t||!o)return;if(a.current){a.current=!1;return}T.killTweensOf([t,o]);let s=t.getBoundingClientRect().height;if(e){T.set(t,{overflow:`hidden`});let e=t.scrollHeight;T.fromTo(t,{height:s===e?0:s},{height:e,duration:O(k.base),ease:A.out,onComplete:()=>T.set(t,{clearProps:`height,overflow`})}),T.fromTo(o,{autoAlpha:0,y:-6},{autoAlpha:1,y:0,duration:O(k.base),ease:A.out})}else T.set(t,{overflow:`hidden`,height:s}),T.to(o,{autoAlpha:0,y:-4,duration:O(k.fast),ease:A.inOut}),T.to(t,{height:0,duration:O(k.fast+.04),ease:A.inOut,onComplete:()=>n(!1)});return()=>{T.killTweensOf([t,o])}},[e,t]),{mounted:t,outerRef:r,innerRef:i}}function ye(){return C(`/api/provider-settings`)}function be(e){return C(`/api/provider-settings`,{method:`PATCH`,body:JSON.stringify(e)})}function B(e,t){let n=new URLSearchParams({provider:e,region:t});return C(`/api/provider-settings/catalog?${n.toString()}`)}var V=n();function H(e){return e?e>=1e6?`${(e/1e6).toString().replace(/\.0$/,``)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e):`—`}function U({label:e,value:t}){return(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-1.5`,children:[(0,V.jsx)(`span`,{className:`text-caption text-muted`,children:e}),(0,V.jsx)(`span`,{className:`min-w-0 text-right text-caption font-medium`,children:t})]})}function xe({model:e,t,onClose:n}){if(!e)return null;let r=e.reasoning_options||[],i=e.catalog_context_length||e.default_context_length||e.context_length,a=e.catalog_context_length_max,o=S(e),s=String(e.provider||e.owned_by||`qoder`).trim().toLowerCase(),c=String(e.region||e.regions?.[0]||``).trim().toLowerCase(),l=j(s,c||void 0,t),u=s===`trae`?M(e):void 0,d=e.supports_images===!0?t(`imageInputDeclared`):e.supports_images===!1?t(`imageInputUnsupported`):t(`imageInputNotDeclared`),f=u?.prompt_max_tokens||e.prompt_max_tokens,p=u?.max_output_tokens||e.max_output_tokens;return(0,V.jsx)(g.Root,{isOpen:!0,onOpenChange:e=>{e||n()},children:(0,V.jsx)(g.Backdrop,{variant:`blur`,children:(0,V.jsx)(g.Container,{size:`md`,scroll:`inside`,children:(0,V.jsxs)(g.Dialog,{children:[(0,V.jsxs)(g.Header,{className:`items-start justify-between gap-4 px-5 pt-5`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`truncate text-section`,children:e.display_name||e.id}),o?(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null]}),(0,V.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:e.id})]}),(0,V.jsx)(g.CloseTrigger,{"aria-label":t(`close`),className:`grid size-8 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,V.jsx)(de,{size:16})})]}),(0,V.jsxs)(g.Body,{className:`space-y-3 px-5 pb-5`,children:[(0,V.jsxs)(`section`,{className:`divide-y divide-separator rounded-lg border border-separator px-3 py-1`,children:[(0,V.jsx)(U,{label:t(`providerCol`),value:l}),(0,V.jsx)(U,{label:t(`contextWindowCol`),value:(0,V.jsxs)(`span`,{className:`mono`,children:[H(i),a&&a!==i?` → ${H(a)}`:``]})}),f?(0,V.jsx)(U,{label:t(`promptMaxTokens`),value:(0,V.jsx)(`span`,{className:`mono`,children:H(f)})}):null,p?(0,V.jsx)(U,{label:t(`maxOutputTokens`),value:(0,V.jsx)(`span`,{className:`mono`,children:H(p)})}):null,(0,V.jsx)(U,{label:t(`imageInput`),value:d})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`div`,{className:`mb-1 text-caption font-medium text-muted`,children:t(`reasoningLevels`)}),r.length?(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(e=>(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:`default`,children:(0,V.jsx)(`span`,{className:`mono`,children:e})},e))}):(0,V.jsx)(`div`,{className:`text-caption text-muted`,children:e.reasoning_type?t(`reasoningFixed`,{type:e.reasoning_type}):t(`noReasoningLevels`)})]})]})]})})})})}function Se({catalog:e,selected:t,onChange:n,isDisabled:r,t:i}){let[a,o]=(0,P.useState)(``),[s,c]=(0,P.useState)(t),u=(0,P.useMemo)(()=>new Set(t),[t]),d=(0,P.useMemo)(()=>{let t=new Set(s),n=a.trim().toLowerCase(),r=(e||[]).filter(e=>!n||e.toLowerCase().includes(n));return[...r.filter(e=>t.has(e)),...r.filter(e=>!t.has(e))]},[e,a,s]),f=(0,P.useMemo)(()=>{if(!e)return[];let n=new Set(e);return t.filter(e=>!n.has(e))},[e,t]),m=e?.length??0,h=t.filter(e=>!f.includes(e)).length;function g(e){o(e),c(t)}function _(e,r){n(r?[...t,e]:t.filter(t=>t!==e))}function y(){let e=new Set(t);d.forEach(t=>e.add(t)),n([...e])}function b(){let e=new Set(d);n(t.filter(t=>!e.has(t)))}return(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(v,{"aria-label":i(`modelPickerSearch`),value:a,onChange:g,isDisabled:r,className:`min-w-0 flex-1 basis-48`,children:(0,V.jsxs)(v.Group,{children:[(0,V.jsx)(v.SearchIcon,{}),(0,V.jsx)(v.Input,{placeholder:i(`modelPickerSearch`)}),(0,V.jsx)(v.ClearButton,{})]})}),(0,V.jsx)(`span`,{className:`mono shrink-0 text-caption text-muted`,children:i(`modelPickerCount`,{selected:h,total:m})}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,V.jsxs)(l,{size:`sm`,variant:`ghost`,isDisabled:r||d.length===0,onPress:y,children:[(0,V.jsx)(R,{size:14}),i(`modelPickerSelectAll`)]}),(0,V.jsxs)(l,{size:`sm`,variant:`ghost`,isDisabled:r||t.length===0,onPress:b,children:[(0,V.jsx)(_e,{size:14}),i(`modelPickerClear`)]})]})]}),(0,V.jsxs)(`div`,{className:`max-h-[300px] overflow-y-auto overscroll-contain rounded-lg bg-surface-secondary p-1`,children:[e===null?(0,V.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(`refreshing`)}):null,f.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md px-2.5 py-1.5`,children:[(0,V.jsx)(`span`,{className:`mono min-w-0 flex-1 truncate text-body text-muted line-through`,children:e}),(0,V.jsx)(`span`,{className:`shrink-0 text-caption text-warning`,children:i(`modelPickerOffline`)}),(0,V.jsx)(l,{isIconOnly:!0,size:`sm`,variant:`ghost`,isDisabled:r,"aria-label":i(`modelPickerRemove`,{model:e}),onPress:()=>_(e,!1),children:(0,V.jsx)(de,{size:14})})]},`offline-${e}`)),d.map(e=>(0,V.jsx)(p,{isSelected:u.has(e),isDisabled:r,onChange:t=>_(e,t),className:`flex w-full cursor-pointer rounded-md px-2.5 py-1.5 transition-colors hover:bg-default`,children:(0,V.jsxs)(p.Content,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,V.jsx)(p.Control,{children:(0,V.jsx)(p.Indicator,{})}),(0,V.jsx)(`span`,{className:`mono min-w-0 truncate text-body text-foreground`,children:e})]})},e)),e!==null&&d.length===0?(0,V.jsx)(`p`,{className:`px-2.5 py-2 text-caption text-muted`,children:i(m===0?`noAccountModels`:`modelPickerNoMatch`)}):null]})]})}function Ce(e){let t=e.toLowerCase();return![`trae`,`kimi`,`codearts`,`minimaxcode`,`opencode`].includes(t)}function W(e){let t=e.toLowerCase();return t===`workbuddy`||t===`trae`}function G(e){return e.toLowerCase()===`qoder`?`11:00`:`01:00`}function we({provider:e,region:t,label:n,policy:r,checkinSupported:i,checkinTimezone:a,t:o,onClose:s,onSaved:c}){let[d,f]=(0,P.useState)(r.credit_floor==null?`inherit`:`custom`),[p,m]=(0,P.useState)(r.credit_floor??0),[v,b]=(0,P.useState)(r.percent_floor==null?`inherit`:`custom`),[x,S]=(0,P.useState)(r.percent_floor??0),[ee,te]=(0,P.useState)(r.proxy_url||``),[C,ne]=(0,P.useState)(r.drop_system_prompt??Ce(e)),[re,ie]=(0,P.useState)(Object.entries(r.model_aliases||{}).map(([e,t])=>({alias:e,model:t}))),[w,ae]=(0,P.useState)({alias:``,model:``}),[T,se]=(0,P.useState)(!!r.models_restricted||!!(r.enabled_models||[]).length),[ce,le]=(0,P.useState)(r.enabled_models||[]),{mounted:ue,outerRef:D,innerRef:O}=ve(T),[fe,pe]=(0,P.useState)(null),[me,k]=(0,P.useState)(``),[A,j]=(0,P.useState)(r.checkin_time||(e.toLowerCase()===`qoder`?`11:00`:`01:00`)),[M,ge]=(0,P.useState)(r.checkin_auto!==!1),[F,I]=(0,P.useState)(!1),[L,R]=(0,P.useState)(``);(0,P.useEffect)(()=>{let n=!1;return B(e,t).then(e=>{n||(pe((e.data||[]).map(e=>e.id)),k(``))}).catch(e=>{n||(pe([]),k(e instanceof Error?e.message:String(e)))}),()=>{n=!0}},[e,t]);async function z(n){if(n?.preventDefault(),d===`custom`&&(!Number.isFinite(p)||p<0)){R(o(`creditFloorInvalid`));return}if(v===`custom`&&(!Number.isFinite(x)||x<0||x>100)){R(o(`percentFloorInvalid`));return}if(i&&!M&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(A)){R(o(`checkinTimeInvalid`));return}if(T&&ce.length===0){R(o(`providerModelsEmpty`));return}R(``),I(!0);try{let n={provider:e,region:t,credit_floor:d===`custom`?p:null,percent_floor:v===`custom`?x:null,proxy_url:ee.trim(),drop_system_prompt:C,model_aliases:Object.fromEntries(re.filter(e=>e.alias.trim()&&e.model.trim()).map(e=>[e.alias.trim(),e.model.trim()])),enabled_models:T?ce:[],models_restricted:T,checkin_time:i?A:``,checkin_auto:i?M:!1};c((await be(n)).data||n),s()}catch(e){R(e instanceof Error?e.message:String(e))}finally{I(!1)}}return(0,V.jsx)(g.Root,{isOpen:!0,onOpenChange:e=>{!e&&!F&&s()},children:(0,V.jsx)(g.Backdrop,{variant:`blur`,children:(0,V.jsx)(g.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,V.jsxs)(g.Dialog,{className:`w-full sm:w-[42rem] sm:max-w-[calc(100vw-2rem)]`,children:[(0,V.jsxs)(g.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(g.Heading,{className:`text-section font-semibold`,children:o(`providerSettingsTitle`)}),(0,V.jsx)(`p`,{className:`mt-1.5 text-body font-normal leading-6 text-muted`,children:o(`providerSettingsHint`)}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(E,{size:`sm`,variant:`soft`,children:(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,V.jsx)(he,{provider:e,size:14}),(0,V.jsx)(`span`,{children:n})]})}),(0,V.jsx)(`span`,{className:`mono text-caption text-muted`,children:t||`any`})]})]}),(0,V.jsx)(g.CloseTrigger,{isDisabled:F,"aria-label":o(`close`),className:`grid size-9 shrink-0 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,V.jsx)(de,{size:18})})]}),(0,V.jsxs)(g.Body,{className:`px-6 pb-2 pt-1`,children:[L?(0,V.jsxs)(u,{status:`danger`,className:`mb-4`,children:[(0,V.jsx)(u.Indicator,{}),(0,V.jsx)(u.Content,{children:(0,V.jsx)(u.Title,{children:L})})]}):null,me?(0,V.jsxs)(u,{status:`warning`,className:`mb-4`,children:[(0,V.jsx)(u.Indicator,{}),(0,V.jsx)(u.Content,{children:(0,V.jsx)(u.Title,{children:me})})]}):null,(0,V.jsxs)(oe,{className:`space-y-4`,onSubmit:e=>void z(e),children:[(0,V.jsx)(N,{label:o(`creditFloor`),hint:o(`creditFloorHint`),align:`start`,children:(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(y,{isSelected:d===`custom`,isDisabled:F,ariaLabel:o(`creditFloorCustom`),label:o(`creditFloorCustom`),onChange:e=>f(e?`custom`:`inherit`)}),d===`custom`?(0,V.jsx)(_,{value:p,onChange:e=>m(e??0),minValue:0,step:1,isDisabled:F,isRequired:!0,children:(0,V.jsxs)(_.Group,{children:[(0,V.jsx)(_.DecrementButton,{}),(0,V.jsx)(_.Input,{"aria-label":o(`creditFloor`)}),(0,V.jsx)(_.IncrementButton,{})]})}):(0,V.jsx)(`p`,{className:`text-caption text-muted`,children:o(`creditFloorInheritHint`)})]})}),(0,V.jsx)(N,{label:o(`percentFloor`),hint:o(`percentFloorHint`),align:`start`,children:(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(y,{isSelected:v===`custom`,isDisabled:F,ariaLabel:o(`percentFloorCustom`),label:o(`percentFloorCustom`),onChange:e=>b(e?`custom`:`inherit`)}),v===`custom`?(0,V.jsx)(_,{value:x,onChange:e=>S(e??0),minValue:0,maxValue:100,step:1,isDisabled:F,isRequired:!0,children:(0,V.jsxs)(_.Group,{children:[(0,V.jsx)(_.DecrementButton,{}),(0,V.jsx)(_.Input,{"aria-label":o(`percentFloor`)}),(0,V.jsx)(_.IncrementButton,{})]})}):(0,V.jsx)(`p`,{className:`text-caption text-muted`,children:o(`percentFloorInheritHint`)})]})}),(0,V.jsx)(N,{label:o(`proxyUrl`),hint:o(`proxyUrlHint`),children:(0,V.jsx)(h,{value:ee,onChange:e=>te(e.target.value),placeholder:o(`proxyUrlPlaceholder`),"aria-label":o(`proxyUrl`),disabled:F})}),W(e)?(0,V.jsx)(N,{label:o(`dropSystemPrompt`),hint:o(e===`trae`?`dropSystemPromptTraeHint`:`dropSystemPromptHint`),children:(0,V.jsx)(y,{isSelected:C,isDisabled:F,ariaLabel:o(`dropSystemPrompt`),onChange:ne})}):null,(0,V.jsx)(N,{align:`start`,label:o(`accountModelAliases`),hint:o(`accountModelAliasesHint`),children:(0,V.jsxs)(`div`,{className:`space-y-2`,children:[re.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,V.jsxs)(`span`,{className:`mono min-w-0 truncate text-body`,children:[e.alias,` → `,e.model]}),(0,V.jsx)(l,{size:`sm`,variant:`ghost`,isDisabled:F,onPress:()=>ie(t=>t.filter(t=>t.alias!==e.alias)),children:o(`modelAliasRemove`)})]},e.alias)),(0,V.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_1fr_auto]`,children:[(0,V.jsx)(h,{"aria-label":o(`modelAliasName`),value:w.alias,onChange:e=>ae(t=>({...t,alias:e.target.value})),placeholder:o(`modelAliasPlaceholder`),disabled:F}),(0,V.jsx)(h,{"aria-label":o(`modelAliasTarget`),value:w.model,onChange:e=>ae(t=>({...t,model:e.target.value})),placeholder:o(`accountModelAliasTargetPlaceholder`),disabled:F}),(0,V.jsx)(l,{size:`sm`,variant:`secondary`,isDisabled:F||!w.alias.trim()||!w.model.trim(),onPress:()=>{ie(e=>[...e.filter(e=>e.alias!==w.alias.trim()),{alias:w.alias.trim(),model:w.model.trim()}]),ae({alias:``,model:``})},children:o(`modelAliasAdd`)})]})]})}),(0,V.jsxs)(`section`,{className:`space-y-3 pt-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-body font-medium text-foreground`,children:o(`enabledModels`)}),(0,V.jsx)(`p`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:o(`enabledModelsHint`)})]}),(0,V.jsx)(y,{isSelected:T,isDisabled:F,ariaLabel:o(`restrictModels`),label:o(T?`restrictModels`:`allModels`),onChange:se})]}),ue?(0,V.jsx)(`div`,{ref:D,children:(0,V.jsx)(`div`,{ref:O,children:(0,V.jsx)(Se,{catalog:fe,selected:ce,onChange:le,isDisabled:F,t:o})})}):null]}),i?(0,V.jsx)(N,{label:o(`autoCheckinTime`),hint:o(`checkinScheduleHint`),children:(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`span`,{className:`text-caption text-muted`,children:o(`checkinAutoMode`)}),(0,V.jsx)(y,{isSelected:M,isDisabled:F,ariaLabel:o(`checkinAutoMode`),onChange:ge})]}),(0,V.jsx)(h,{type:`time`,value:M?G(e):A,onChange:e=>j(e.target.value),"aria-label":o(`autoCheckinTime`),disabled:F||M,required:!M}),a?(0,V.jsx)(`p`,{className:`text-caption text-muted`,children:o(`checkinServerClock`,{timezone:a})}):null,M?(0,V.jsx)(`p`,{className:`text-caption text-muted`,children:o(`checkinAutoFallbackHint`)}):null]})}):null]})]}),(0,V.jsxs)(g.Footer,{className:`justify-end gap-2 px-6 pb-6`,children:[(0,V.jsx)(l,{variant:`ghost`,isDisabled:F,onPress:s,children:o(`cancel`)}),(0,V.jsx)(l,{isPending:F,onPress:()=>void z(),children:o(`save`)})]})]})})})})}function Te(e){let t=[];for(let n of e)for(let e of n.regions||[])e?.id&&t.push({value:`${n.id}:${e.id}`,provider:n.id,region:e.id,checkin:!!e.checkin,checkinTimezone:e.checkin?.timezone===`Local`?`Asia/Shanghai`:e.checkin?.timezone});return t}function Ee(e,t){let n=new Set;for(let r of e){let e=String(r.provider||`qoder`).trim().toLowerCase(),i=String(r.region||``).trim().toLowerCase(),a=t.find(t=>t.provider===e&&t.region===i)||t.find(t=>t.provider===e);a&&n.add(a.value)}return Array.from(n)}function K(e){return e.settings_key||e.id}function q(e){return String(e.provider||e.owned_by||`qoder`).trim().toLowerCase()}function De(e){let t=String(e.region||``).trim().toLowerCase();if(t)return t;let n=e.regions||[];return String(n[0]||``).trim().toLowerCase()}function Oe(e){return`${q(e)}:${De(e)||`any`}:${e.settings_key||e.id}:${e.native_model||e.mapped_key||``}`}function J(e){let t=e.route_display_name||``;return t&&t!==(e.display_name||e.id)?t:``}function ke(e,t){let n=new Map;for(let r of e){let e=q(r),i=De(r),a=`${e}:${i||`any`}`,o=n.get(a);o||(o={key:a,provider:e,region:i,label:j(e,i||void 0,t),models:[]},n.set(a,o)),o.models.push(r)}return Array.from(n.values())}function Ae(e){let t=e.toLowerCase();return![`trae`,`kimi`,`codearts`,`minimaxcode`,`opencode`].includes(t)}function je(e,t){return e.region&&e.region!==`any`?e.region:t.find(t=>t.provider===e.provider)?.region||``}function Me(e,t){let n=new Map(t.map((e,t)=>[`${e.provider}:${e.region||`any`}`,t]));return[...e].sort((e,t)=>{let r=n.get(e.key),i=n.get(t.key);return r!=null&&i!=null?r-i:r==null?i==null?0:1:-1})}function Ne(e,t,n){return e.find(e=>e.provider===t&&(e.region||`any`)===n)||{provider:t,region:n,credit_floor:null,percent_floor:null,proxy_url:``,drop_system_prompt:Ae(t),model_aliases:{},enabled_models:[],models_restricted:!1,checkin_time:`09:00`,checkin_auto:!0}}function Pe({model:e,saving:t,t:n,variant:r=`table`,onToggleTraeMax:i}){let a=q(e),o=r===`card`,s=e.catalog_context_length||e.context_length,c=e.catalog_context_length_max,l=!!(c&&c!==s),u=e.reasoning_options||[],d=(a===`trae`||a===`qoder`)&&e.supports_max_mode,f=u.length?u.join(` / `):e.reasoning_type?n(`reasoningFixed`,{type:e.reasoning_type}):`—`;return(0,V.jsxs)(`div`,{className:o?`flex min-w-0 flex-col gap-2`:`flex min-w-0 flex-col gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsxs)(`span`,{className:`mono text-caption font-medium`,children:[H(s),l?` → ${H(c)}`:``]}),d?(0,V.jsx)(y,{isSelected:!!e.max_mode,isDisabled:t,ariaLabel:`${e.id} ${n(`maxMode`)}`,onChange:t=>i(e,t)}):null]}),(0,V.jsx)(`div`,{className:`min-w-0 truncate text-caption text-muted`,title:f,children:f})]})}function Fe({model:e,t,onDetails:n}){return(0,V.jsxs)(l,{size:`sm`,variant:`ghost`,onPress:()=>n(e),children:[(0,V.jsx)(D,{size:14}),t(`modelDetails`)]})}function Y({group:e,t}){return(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface text-foreground`,children:(0,V.jsx)(he,{provider:e.provider,size:16})}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`truncate text-body font-semibold`,children:e.label}),(0,V.jsx)(`div`,{className:`text-caption text-muted`,children:t(`usageModelCount`,{count:e.models.length})})]})]})}function Ie({group:e,t,collapsible:n,collapsed:i,onToggle:a,onSettings:o,settingsDisabled:s,savingKey:c,modelCheckChip:u,onToggleTraeMax:d,onDetails:p}){let m=(0,P.useId)(),{mounted:h,outerRef:g,innerRef:_}=ve(!n||!i);return(0,V.jsxs)(f,{className:`overflow-hidden p-0`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 bg-surface-secondary px-4 py-3 ${h?`border-b border-separator`:``}`,children:[n?(0,V.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center justify-between gap-3 rounded-lg text-left outline-none focus-visible:ring-2 focus-visible:ring-focus`,"aria-expanded":!i,"aria-controls":m,"aria-label":`${t(i?`providerExpand`:`providerCollapse`)} ${e.label}`,onClick:a,children:[(0,V.jsx)(Y,{group:e,t}),(0,V.jsx)(r,{size:16,className:`shrink-0 text-muted transition-transform ${i?``:`rotate-90`}`,"aria-hidden":!0})]}):(0,V.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:(0,V.jsx)(Y,{group:e,t})}),(0,V.jsxs)(l,{className:`shrink-0`,size:`sm`,variant:`ghost`,isDisabled:s,onPress:o,children:[(0,V.jsx)(se,{size:14}),t(`providerSettingsOpen`)]})]}),h?(0,V.jsx)(`div`,{id:m,ref:g,className:`min-w-0`,children:(0,V.jsx)(`div`,{ref:_,children:e.models.length===0?(0,V.jsx)(`div`,{className:`px-4 py-8 text-center text-caption text-muted`,children:t(`noModelsYet`)}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:e.models.map(e=>{let n=c===K(e),r=x(e),i=S(e);return(0,V.jsxs)(`article`,{className:`space-y-3 px-4 py-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`status-dot mt-1.5`,"data-state":e.stale?void 0:`ok`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`truncate font-medium`,children:e.display_name||e.id}),i?(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null,r?(0,V.jsx)(`span`,{className:`mono text-caption text-muted`,children:r}):null]}),(0,V.jsx)(`div`,{className:`mono mt-0.5 truncate text-caption text-muted`,children:e.id}),J(e)?(0,V.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:t(`routedTo`,{model:J(e)})}):null]})]}),u(e)]}),(0,V.jsx)(`div`,{className:`mono break-all text-caption text-muted`,children:e.mapped_key||e.native_model||e.id}),(0,V.jsx)(Pe,{model:e,saving:n,t,variant:`card`,onToggleTraeMax:d}),(0,V.jsx)(Fe,{model:e,t,onDetails:p})]},Oe(e))})}),(0,V.jsx)(b,{className:`hidden min-w-0 lg:block`,children:(0,V.jsx)(b.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,V.jsxs)(b.Content,{"aria-label":`${e.label} ${t(`availableModels`)}`,className:`min-w-[58rem]`,children:[(0,V.jsxs)(b.Header,{children:[(0,V.jsx)(b.Column,{isRowHeader:!0,children:t(`modelCol`)}),(0,V.jsx)(b.Column,{children:t(`requestIdCol`)}),(0,V.jsx)(b.Column,{children:t(`qoderKeyCol`)}),(0,V.jsx)(b.Column,{children:t(`modelDefaultsCol`)}),(0,V.jsx)(b.Column,{children:t(`stateCol`)}),(0,V.jsx)(b.Column,{children:t(`modelDetailsCol`)})]}),(0,V.jsx)(b.Body,{children:e.models.map(e=>{let n=c===K(e),r=x(e),i=S(e);return(0,V.jsxs)(b.Row,{children:[(0,V.jsx)(b.Cell,{children:(0,V.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,V.jsx)(`span`,{className:`status-dot`,"data-state":e.stale?void 0:`ok`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`font-medium`,children:e.display_name||e.id}),i?(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:`success`,children:t(`modelFree`)}):null,r?(0,V.jsx)(`span`,{className:`mono text-caption text-muted`,children:r}):null]}),J(e)?(0,V.jsx)(`div`,{className:`mt-0.5 text-caption text-muted`,children:t(`routedTo`,{model:J(e)})}):null]})]})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`span`,{className:`mono text-caption font-medium`,children:e.id})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`span`,{className:`mono text-caption text-muted`,children:e.mapped_key||e.native_model||e.id})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(Pe,{model:e,saving:n,t,variant:`table`,onToggleTraeMax:d})}),(0,V.jsx)(b.Cell,{children:u(e)}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(Fe,{model:e,t,onDetails:p})})]},Oe(e))})})]})})})]})})}):null]})}function Le(){let{t:e}=s(),{overview:t,loading:n}=ue(),[r,c]=(0,P.useState)(``),[u,p]=(0,P.useState)(``),[h,g]=(0,P.useState)([]),[_,v]=(0,P.useState)(!0),[y,x]=(0,P.useState)(null),[S,C]=(0,P.useState)(!0),[oe,T]=(0,P.useState)([]),[se,de]=(0,P.useState)(!0),[D,O]=(0,P.useState)(!1),[k,A]=(0,P.useState)(null),[he,M]=(0,P.useState)(new Set),[N,F]=(0,P.useState)(1),[I,L]=(0,P.useState)(50),[R,z]=(0,P.useState)(!1),[_e,ve]=(0,P.useState)(``),[be,B]=(0,P.useState)(``),[H,U]=(0,P.useState)(!1),[Se,Ce]=(0,P.useState)(null),[W,G]=(0,P.useState)([]),[J,Ae]=(0,P.useState)(!0),[Pe,Fe]=(0,P.useState)(!1),[Y,Le]=(0,P.useState)(null);(0,P.useEffect)(()=>{let e=!1;return ie(void 0,`regional`).then(t=>{e||G(t.data||[])}).catch(()=>void 0).finally(()=>{e||Ae(!1)}),ne().then(t=>{e||g(Te(t.data||[]))}).catch(()=>void 0).finally(()=>{e||v(!1)}),re(!1).then(t=>{e||x(t.data||[])}).catch(()=>{e||x(null)}).finally(()=>{e||C(!1)}),ye().then(t=>{e||T(t.data||[])}).catch(t=>{e||(O(!0),U(!0),B(t instanceof Error?t.message:String(t)))}).finally(()=>{e||de(!1)}),()=>{e=!0}},[]);let Re=(0,P.useMemo)(()=>y?Ee(y,h):null,[y,h]),ze=(0,P.useMemo)(()=>{let e=new Set;for(let t of W){let n=q(t),r=De(t),i=h.find(e=>e.provider===n&&e.region===r)||h.find(e=>e.provider===n);i&&e.add(i.value)}return Array.from(e)},[W,h]),X=(0,P.useMemo)(()=>{let e=Re&&Re.length?Re:ze;return e.length?h.filter(t=>e.includes(t.value)):[]},[Re,ze,h]),Z=u===``||X.some(e=>e.value===u)?u:X[0]?.value||``,Be=Z===``,Q=(0,P.useMemo)(()=>{let t=r.trim().toLowerCase(),[n,i]=Z.includes(`:`)?Z.split(`:`,2):[Z,``];return W.filter(r=>{let a=q(r),o=De(r);if(n&&a!==n||i&&o!==i)return!1;if(!t)return!0;let s=j(a,o||void 0,e);return`${r.display_name||``} ${r.id} ${r.mapped_key||``} ${a} ${s} ${r.owned_by||``} ${o} ${r.credits||``} ${r.free?`free`:``}`.toLowerCase().includes(t)})},[r,W,Z,e]),Ve=[r,Z,I].join(`\0`),[He,Ue]=(0,P.useState)(Ve);He!==Ve&&(Ue(Ve),F(1));let We=(0,P.useMemo)(()=>{let t=ke(Q,e);if(r.trim())return Me(t,X);let n=new Set(t.map(e=>e.key)),i=r=>{let i=`${r.provider}:${r.region||`any`}`;n.has(i)||(n.add(i),t.push({key:i,provider:r.provider,region:r.region,label:j(r.provider,r.region,e),models:[]}))};if(Z){let e=X.find(e=>e.value===Z);e&&i(e)}else for(let e of X)i(e);for(let r of oe){if(!r.models_restricted||!r.provider||!r.region||r.region===`any`)continue;if(Z){let[e,t]=Z.includes(`:`)?Z.split(`:`,2):[Z,``];if(e&&e!==r.provider||t&&t!==r.region)continue}let i=`${r.provider}:${r.region}`;n.has(i)||(n.add(i),t.push({key:i,provider:r.provider,region:r.region,label:j(r.provider,r.region,e),models:[]}))}return Me(t,X)},[Q,r,Z,X,oe,e]),Ge=(0,P.useMemo)(()=>{let e=[],t=[],n=0;for(let r of We)t.length>0&&n+r.models.length>I&&(e.push(t),t=[],n=0),t.push(r),n+=r.models.length;return t.length>0&&e.push(t),e.length>0?e:[[]]},[We,I]),Ke=Math.max(1,Ge.length),$=Math.min(He===Ve?Math.max(1,N):1,Ke);N!==$&&F($);let qe=Ge[$-1]??[],Je=Ge.slice(0,$-1).reduce((e,t)=>e+t.reduce((e,t)=>e+t.models.length,0),0),Ye=qe.reduce((e,t)=>e+t.models.length,0),Xe=Q.length===0?0:Je+1,Ze=Q.length===0?0:Je+Ye,Qe=Q.length?e(`logsShownTotal`,{shown:`${Xe}–${Ze}`,total:Q.length}):e(`shownTotal`,{shown:0,total:W.length}),$e=k?h.find(e=>e.provider===k.provider&&e.region===k.region):void 0,et=k?Ne(oe,k.provider,k.region):null;if(n&&!t||J||S||_)return(0,V.jsx)(fe,{});function tt(e,t){let n=K(e),r=q(e),i=W.map(e=>{if(K(e)!==n||q(e)!==r)return e;let i=e.reasoning_effort||e.reasoning_default||``,a=e.catalog_context_length||e.default_context_length||e.context_length||0,o=e.catalog_context_length_max||0;return{...e,max_mode:t,context_length:t&&o?o:a,default_context_length:a,context_custom:r===`qoder`?t:t||!!(i&&i!==e.reasoning_default)}});G(i)}function nt(e){M(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function rt(){z(!0),B(``),U(!1);try{let e=await te(void 0,`regional`);G(e.data||[])}catch(e){U(!0),B(e instanceof Error?e.message:String(e))}finally{z(!1)}}function it(e){return Y?.results.find(t=>t.model===e.id)}function at(t){let n=it(t);if(!n)return(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:`default`,children:e(`checkNotRun`)});let r=n.accounts||[],i=r.length?r.filter(e=>e.ok).length:+!!n.ok,a=r.length||n.attempt_count||+!!n.ok;return(0,V.jsxs)(E,{size:`sm`,variant:`soft`,color:n.ok?`success`:`danger`,children:[n.ok?e(`checkResultOK`):e(`checkResultFailed`),a?` · ${e(`checkPassedAccounts`,{passed:i,total:a})}`:``]})}async function ot(){if(!W.length){B(e(`checkModelsEmpty`)),U(!1);return}Fe(!0),Le(null),B(``),U(!1);try{let t=await w(W.map(e=>e.id));Le(t),B(e(`checkModelsSummary`,{passed:t.summary.passed,failed:t.summary.failed,total:t.summary.total,elapsed:t.elapsed_ms}))}catch(e){U(!0),B(e instanceof Error?e.message:String(e))}finally{Fe(!1)}}async function st(t,n){if(!t.supports_max_mode){U(!0),B(e(`contextMaxUnavailable`));return}let r=K(t),i=q(t);ve(r),B(``),U(!1);try{await ee(i,r,n,t.catalog_context_length_max),tt(t,n),B(e(n?`contextMaxOn`:`contextMaxOff`,{model:t.id}))}catch(e){U(!0),B(e instanceof Error?e.message:String(e))}finally{ve(``)}}function ct(t){if(se||D){U(!0),B(e(D?`providerSettingsLoadFailed`:`refreshing`));return}let n=je(t,h);if(!n&&h.some(e=>e.provider===t.provider)){U(!0),B(e(`providerSettingsRegionMissing`));return}A({provider:t.provider,region:n,label:t.label})}function lt(t){T(e=>[...e.filter(e=>e.provider!==t.provider||(e.region||`any`)!==(t.region||`any`)),t]),U(!1),B(e(`providerSettingsSaved`)),ae(void 0,`regional`).then(e=>G(e.data||[])).catch(t=>{U(!0),B(e(`providerSettingsSavedRefreshFailed`,{message:t instanceof Error?t.message:String(t)}))})}return(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-6`,children:[(0,V.jsx)(`p`,{"data-gsap-reveal":!0,className:`mr-auto text-body text-muted`,children:W.length?Qe:e(`noModelsYet`)}),(0,V.jsxs)(`div`,{"data-gsap-reveal":!0,className:`flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`,children:[(0,V.jsx)(o,{className:`w-full min-w-0 sm:w-72`,value:r,onChange:c,placeholder:e(`filterPh`),ariaLabel:e(`filter`)}),(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[X.length?(0,V.jsx)(ge,{ariaLabel:e(`providerCol`),value:Z,onChange:p,options:[{id:``,label:e(`providerFilterAll`)},...X.map(t=>({id:t.value,label:j(t.provider,t.region,e)}))]}):null,(0,V.jsxs)(l,{size:`sm`,variant:`secondary`,isPending:R||Pe,onPress:()=>void rt(),children:[(0,V.jsx)(ce,{size:14}),e(R?`refreshing`:`refresh`)]}),(0,V.jsxs)(me,{children:[(0,V.jsx)(me.Trigger,{children:(0,V.jsxs)(l,{size:`sm`,variant:`secondary`,isPending:Pe,isDisabled:R||W.length===0,onPress:()=>void ot(),children:[(0,V.jsx)(le,{size:14}),e(Pe?`checkingModels`:`checkAllModels`)]})}),(0,V.jsx)(me.Content,{children:(0,V.jsx)(`p`,{className:`max-w-xs text-caption leading-5`,children:e(`checkModelsHint`)})})]})]})]})]}),be?(0,V.jsx)(d,{status:H?`danger`:`success`,title:be}):null,Y?(0,V.jsxs)(f,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-separator px-4 py-4 sm:items-center sm:px-5`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-body font-semibold`,children:e(`checkAllModels`)}),(0,V.jsx)(`div`,{className:`mt-0.5 text-caption leading-5 text-muted`,children:e(`checkModelsSummary`,{passed:Y.summary.passed,failed:Y.summary.failed,total:Y.summary.total,elapsed:Y.elapsed_ms})})]}),(0,V.jsxs)(E,{size:`sm`,variant:`soft`,color:Y.summary.failed?`warning`:`success`,className:`shrink-0`,children:[Y.summary.passed,`/`,Y.summary.total]})]}),(0,V.jsx)(b,{className:`hidden min-w-0 lg:block`,children:(0,V.jsx)(b.ScrollContainer,{className:`max-h-[24rem] min-w-0 overflow-auto`,children:(0,V.jsxs)(b.Content,{"aria-label":e(`checkAllModels`),className:`min-w-[52rem]`,children:[(0,V.jsxs)(b.Header,{children:[(0,V.jsx)(b.Column,{isRowHeader:!0,children:e(`modelCol`)}),(0,V.jsx)(b.Column,{children:e(`stateCol`)}),(0,V.jsx)(b.Column,{children:e(`account`)}),(0,V.jsx)(b.Column,{children:e(`providerCol`)}),(0,V.jsx)(b.Column,{children:e(`logsColLatency`)}),(0,V.jsx)(b.Column,{children:e(`checkAccountResults`)}),(0,V.jsx)(b.Column,{children:e(`response`)})]}),(0,V.jsx)(b.Body,{children:Y.results.map(t=>(0,V.jsxs)(b.Row,{children:[(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`span`,{className:`mono text-caption font-medium`,children:t.model})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:t.ok?`success`:t.code===`no_models`||t.message===`model required`?`warning`:`danger`,children:t.ok?e(`checkResultOK`):t.code===`no_models`||t.message===`model required`?e(`checkResultSkipped`):e(`checkResultFailed`)})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`span`,{className:`mono text-caption text-muted`,children:t.account_id||`—`})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`span`,{className:`text-caption`,children:t.provider||`—`})}),(0,V.jsx)(b.Cell,{children:(0,V.jsxs)(`span`,{className:`mono text-caption text-muted`,children:[t.latency_ms,`ms`]})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`div`,{className:`space-y-1`,children:(t.accounts||[]).length?t.accounts.map(n=>(0,V.jsxs)(`div`,{className:`text-caption leading-4`,children:[(0,V.jsx)(`span`,{className:`mono font-medium`,children:n.account_id}),(0,V.jsxs)(`span`,{className:n.ok?`text-success`:`text-danger`,children:[` `,n.ok?e(`checkResultOK`):e(`checkResultFailed`)]}),(0,V.jsxs)(`span`,{className:`text-muted`,children:[` · `,n.latency_ms,`ms`]}),n.message?(0,V.jsx)(`span`,{className:`block break-all text-muted`,children:n.message}):null]},`${t.model}:${n.account_id}`)):(0,V.jsx)(`span`,{className:`text-caption text-muted`,children:`—`})})}),(0,V.jsx)(b.Cell,{children:(0,V.jsx)(`span`,{className:`break-all text-caption text-muted`,children:t.message||(t.ok?e(`checkResultOK`):``)})})]},t.model))})]})})}),(0,V.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:Y.results.map(t=>(0,V.jsxs)(`div`,{className:`space-y-1 px-4 py-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`span`,{className:`mono min-w-0 truncate text-caption font-medium`,children:t.model}),(0,V.jsx)(E,{size:`sm`,variant:`soft`,color:t.ok?`success`:`danger`,children:t.ok?e(`checkResultOK`):e(`checkResultFailed`)})]}),(0,V.jsxs)(`div`,{className:`text-caption text-muted`,children:[t.account_id||t.provider||`—`,` · `,t.latency_ms,`ms`]}),(t.accounts||[]).length?(0,V.jsx)(`div`,{className:`space-y-0.5`,children:t.accounts.map(n=>(0,V.jsxs)(`div`,{className:`text-caption leading-4`,children:[(0,V.jsx)(`span`,{className:`mono font-medium`,children:n.account_id}),(0,V.jsxs)(`span`,{className:n.ok?`text-success`:`text-danger`,children:[` `,n.ok?e(`checkResultOK`):e(`checkResultFailed`)]}),(0,V.jsxs)(`span`,{className:`text-muted`,children:[` · `,n.latency_ms,`ms`]}),n.message?(0,V.jsx)(`span`,{className:`block break-all text-muted`,children:n.message}):null]},`${t.model}:${n.account_id}`))}):null,t.message?(0,V.jsx)(`div`,{className:`break-all text-caption text-muted`,children:t.message}):null]},t.model))})]}):null,R||n?(0,V.jsx)(f,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:(0,V.jsx)(pe,{})}):We.length===0?(0,V.jsx)(f,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:(0,V.jsx)(m,{icon:(0,V.jsx)(i,{size:22}),title:W.length?e(`noModelsMatch`):e(`noProviders`),hint:W.length?e(`noModelsMatch`):e(`noModelsYet`)})}):(0,V.jsx)(`div`,{"data-gsap-reveal":!0,className:`space-y-4`,children:qe.map(t=>(0,V.jsx)(Ie,{group:t,t:e,collapsible:Be,collapsed:Be&&he.has(t.key),onToggle:()=>nt(t.key),onSettings:()=>ct(t),settingsDisabled:se||D,savingKey:_e,modelCheckChip:at,onToggleTraeMax:(e,t)=>void st(e,t),onDetails:Ce},t.key))}),(0,V.jsx)(xe,{model:Se?W.find(e=>Oe(e)===Oe(Se))||Se:null,t:e,onClose:()=>Ce(null)}),k&&et?(0,V.jsx)(we,{provider:k.provider,region:k.region,label:k.label,policy:et,checkinSupported:!!$e?.checkin,checkinTimezone:$e?.checkinTimezone,t:e,onClose:()=>A(null),onSaved:e=>lt(e)},`${k.provider}:${k.region}`):null,(0,V.jsx)(a,{total:Q.length,page:$,pageCount:Ke,pageSize:I,loading:R,pageSizeLabel:e(`logsPageSize`),pageLabel:e(`logsPage`,{page:$,pages:Ke}),prevLabel:e(`logsPrevPage`),nextLabel:e(`logsNextPage`),onPage:F,onPageSize:L})]})}export{Le as ProvidersPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/SearchBar-C0n-Lr5s.js b/internal/webui/static/assets/SearchBar-7OerD-fU.js similarity index 97% rename from internal/webui/static/assets/SearchBar-C0n-Lr5s.js rename to internal/webui/static/assets/SearchBar-7OerD-fU.js index dc150e4d0..80ab23cd1 100644 --- a/internal/webui/static/assets/SearchBar-C0n-Lr5s.js +++ b/internal/webui/static/assets/SearchBar-7OerD-fU.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{H as r,V as i,Z as a,pt as o}from"./useI18n-XrvNxGvP.js";import{B as s,c,s as l,z as u}from"./SharedElementTransition-BlCsXfb1.js";import{t as d}from"./search-field-DB17IAvK.js";import{m as f,p}from"./format-FfdyoNtB.js";var m=t(e(),1),h=new Map([[`bold`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),m.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),g=m.forwardRef((e,t)=>m.createElement(o,{ref:t,...e,weights:h}));g.displayName=`MagnifyingGlassIcon`;var _=g,v=u({defaultVariants:{size:`md`},slots:{base:`pagination`,content:`pagination__content`,ellipsis:`pagination__ellipsis`,item:`pagination__item`,link:`pagination__link`,summary:`pagination__summary`},variants:{size:{lg:{base:`pagination--lg`},md:{base:`pagination--md`},sm:{base:`pagination--sm`}}}}),y=n(),b=(0,m.createContext)({}),x=({children:e,className:t,size:n,...r})=>{let i=m.useMemo(()=>v({size:n}),[n]);return(0,y.jsx)(b,{value:{slots:i},children:(0,y.jsx)(s.nav,{"aria-label":`pagination`,"data-slot":`pagination`,role:`navigation`,...r,className:l(i.base,t),children:e})})};x.displayName=`HeroUI.Pagination`;var S=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b);return(0,y.jsx)(s.div,{className:l(r?.summary,t),"data-slot":`pagination-summary`,dir:`auto`,...n,children:e})};S.displayName=`HeroUI.Pagination.Summary`;var C=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b);return(0,y.jsx)(s.ul,{className:l(r?.content,t),"data-slot":`pagination-content`,...n,children:e})};C.displayName=`HeroUI.Pagination.Content`;var w=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b);return(0,y.jsx)(s.li,{className:l(r?.item,t),"data-slot":`pagination-item`,...n,children:e})};w.displayName=`HeroUI.Pagination.Item`;var T=({children:e,className:t,isActive:n,...r})=>{let{slots:i}=(0,m.use)(b);return(0,y.jsx)(a,{"aria-current":n?`page`:void 0,className:c(t,i?.link()),"data-active":n?`true`:void 0,"data-slot":`pagination-link`,...r,children:e})};T.displayName=`HeroUI.Pagination.Link`;var E=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b),i=`${r?.link()??``} pagination__link--nav`.trim();return(0,y.jsx)(a,{className:c(t,i),"data-slot":`pagination-previous`,...n,children:e})};E.displayName=`HeroUI.Pagination.Previous`;var D=({children:e,className:t,...n})=>(0,y.jsx)(s.span,{"aria-hidden":`true`,className:t,"data-slot":`pagination-previous-icon`,...n,children:e??(0,y.jsx)(i,{})});D.displayName=`HeroUI.Pagination.PreviousIcon`;var O=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b),i=`${r?.link()??``} pagination__link--nav`.trim();return(0,y.jsx)(a,{className:c(t,i),"data-slot":`pagination-next`,...n,children:e})};O.displayName=`HeroUI.Pagination.Next`;var k=({children:e,className:t,...n})=>(0,y.jsx)(s.span,{"aria-hidden":`true`,className:t,"data-slot":`pagination-next-icon`,...n,children:e??(0,y.jsx)(r,{})});k.displayName=`HeroUI.Pagination.NextIcon`;var A=({className:e,...t})=>{let{slots:n}=(0,m.use)(b);return(0,y.jsx)(s.span,{"aria-hidden":`true`,className:l(n?.ellipsis,e),"data-slot":`pagination-ellipsis`,...t,children:`…`})};A.displayName=`HeroUI.Pagination.Ellipsis`;var j=Object.assign(x,{Content:C,Ellipsis:A,Item:w,Link:T,Next:O,NextIcon:k,Previous:E,PreviousIcon:D,Root:x,Summary:S}),M=[20,50,100],N=[20,50,100];function P(e,t){if(t<=7)return Array.from({length:t},(e,t)=>t+1);let n=[1];e>3&&n.push(`gap`);let r=Math.max(2,e-1),i=Math.min(t-1,e+1);for(let e=r;e<=i;e++)n.push(e);return e{let t=Number([...e][0]);d.includes(t)&&u(t)},"aria-label":a,children:d.map(e=>(0,y.jsx)(f,{id:String(e),children:e},e))})]}),(0,y.jsxs)(j,{size:`sm`,className:`w-fit`,children:[(0,y.jsx)(j.Summary,{className:`mono text-caption`,children:o}),(0,y.jsxs)(j.Content,{children:[(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Previous,{isDisabled:i||t<=1,onPress:()=>l(Math.max(1,t-1)),"aria-label":s,children:(0,y.jsx)(j.PreviousIcon,{})})}),m.map((e,n)=>e===`gap`?(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Ellipsis,{})},`gap-${n}`):(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Link,{isActive:e===t,isDisabled:i,onPress:()=>l(e),children:e})},e)),(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Next,{isDisabled:i||t>=n,onPress:()=>l(Math.min(n,t+1)),"aria-label":c,children:(0,y.jsx)(j.NextIcon,{})})})]})]})]})}function I({value:e,onChange:t,placeholder:n,ariaLabel:r,className:i}){return(0,y.jsx)(d,{"aria-label":r,value:e,onChange:t,className:i,children:(0,y.jsxs)(d.Group,{children:[(0,y.jsx)(d.SearchIcon,{}),(0,y.jsx)(d.Input,{placeholder:n}),(0,y.jsx)(d.ClearButton,{})]})})}export{_ as i,N as n,F as r,I as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{H as r,V as i,Z as a,pt as o}from"./useI18n-BAo1UrJW.js";import{B as s,c,s as l,z as u}from"./SharedElementTransition-BlCsXfb1.js";import{t as d}from"./search-field-DRk4_q5c.js";import{m as f,p}from"./format-BAkFbjAh.js";var m=t(e(),1),h=new Map([[`bold`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),m.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),g=m.forwardRef((e,t)=>m.createElement(o,{ref:t,...e,weights:h}));g.displayName=`MagnifyingGlassIcon`;var _=g,v=u({defaultVariants:{size:`md`},slots:{base:`pagination`,content:`pagination__content`,ellipsis:`pagination__ellipsis`,item:`pagination__item`,link:`pagination__link`,summary:`pagination__summary`},variants:{size:{lg:{base:`pagination--lg`},md:{base:`pagination--md`},sm:{base:`pagination--sm`}}}}),y=n(),b=(0,m.createContext)({}),x=({children:e,className:t,size:n,...r})=>{let i=m.useMemo(()=>v({size:n}),[n]);return(0,y.jsx)(b,{value:{slots:i},children:(0,y.jsx)(s.nav,{"aria-label":`pagination`,"data-slot":`pagination`,role:`navigation`,...r,className:l(i.base,t),children:e})})};x.displayName=`HeroUI.Pagination`;var S=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b);return(0,y.jsx)(s.div,{className:l(r?.summary,t),"data-slot":`pagination-summary`,dir:`auto`,...n,children:e})};S.displayName=`HeroUI.Pagination.Summary`;var C=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b);return(0,y.jsx)(s.ul,{className:l(r?.content,t),"data-slot":`pagination-content`,...n,children:e})};C.displayName=`HeroUI.Pagination.Content`;var w=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b);return(0,y.jsx)(s.li,{className:l(r?.item,t),"data-slot":`pagination-item`,...n,children:e})};w.displayName=`HeroUI.Pagination.Item`;var T=({children:e,className:t,isActive:n,...r})=>{let{slots:i}=(0,m.use)(b);return(0,y.jsx)(a,{"aria-current":n?`page`:void 0,className:c(t,i?.link()),"data-active":n?`true`:void 0,"data-slot":`pagination-link`,...r,children:e})};T.displayName=`HeroUI.Pagination.Link`;var E=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b),i=`${r?.link()??``} pagination__link--nav`.trim();return(0,y.jsx)(a,{className:c(t,i),"data-slot":`pagination-previous`,...n,children:e})};E.displayName=`HeroUI.Pagination.Previous`;var D=({children:e,className:t,...n})=>(0,y.jsx)(s.span,{"aria-hidden":`true`,className:t,"data-slot":`pagination-previous-icon`,...n,children:e??(0,y.jsx)(i,{})});D.displayName=`HeroUI.Pagination.PreviousIcon`;var O=({children:e,className:t,...n})=>{let{slots:r}=(0,m.use)(b),i=`${r?.link()??``} pagination__link--nav`.trim();return(0,y.jsx)(a,{className:c(t,i),"data-slot":`pagination-next`,...n,children:e})};O.displayName=`HeroUI.Pagination.Next`;var k=({children:e,className:t,...n})=>(0,y.jsx)(s.span,{"aria-hidden":`true`,className:t,"data-slot":`pagination-next-icon`,...n,children:e??(0,y.jsx)(r,{})});k.displayName=`HeroUI.Pagination.NextIcon`;var A=({className:e,...t})=>{let{slots:n}=(0,m.use)(b);return(0,y.jsx)(s.span,{"aria-hidden":`true`,className:l(n?.ellipsis,e),"data-slot":`pagination-ellipsis`,...t,children:`…`})};A.displayName=`HeroUI.Pagination.Ellipsis`;var j=Object.assign(x,{Content:C,Ellipsis:A,Item:w,Link:T,Next:O,NextIcon:k,Previous:E,PreviousIcon:D,Root:x,Summary:S}),M=[20,50,100],N=[20,50,100];function P(e,t){if(t<=7)return Array.from({length:t},(e,t)=>t+1);let n=[1];e>3&&n.push(`gap`);let r=Math.max(2,e-1),i=Math.min(t-1,e+1);for(let e=r;e<=i;e++)n.push(e);return e{let t=Number([...e][0]);d.includes(t)&&u(t)},"aria-label":a,children:d.map(e=>(0,y.jsx)(f,{id:String(e),children:e},e))})]}),(0,y.jsxs)(j,{size:`sm`,className:`w-fit`,children:[(0,y.jsx)(j.Summary,{className:`mono text-caption`,children:o}),(0,y.jsxs)(j.Content,{children:[(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Previous,{isDisabled:i||t<=1,onPress:()=>l(Math.max(1,t-1)),"aria-label":s,children:(0,y.jsx)(j.PreviousIcon,{})})}),m.map((e,n)=>e===`gap`?(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Ellipsis,{})},`gap-${n}`):(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Link,{isActive:e===t,isDisabled:i,onPress:()=>l(e),children:e})},e)),(0,y.jsx)(j.Item,{children:(0,y.jsx)(j.Next,{isDisabled:i||t>=n,onPress:()=>l(Math.min(n,t+1)),"aria-label":c,children:(0,y.jsx)(j.NextIcon,{})})})]})]})]})}function I({value:e,onChange:t,placeholder:n,ariaLabel:r,className:i}){return(0,y.jsx)(d,{"aria-label":r,value:e,onChange:t,className:i,children:(0,y.jsxs)(d.Group,{children:[(0,y.jsx)(d.SearchIcon,{}),(0,y.jsx)(d.Input,{placeholder:n}),(0,y.jsx)(d.ClearButton,{})]})})}export{_ as i,N as n,F as r,I as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/ShieldCheck.es-CF5xuEi8.js b/internal/webui/static/assets/ShieldCheck.es-DUiHamsh.js similarity index 98% rename from internal/webui/static/assets/ShieldCheck.es-CF5xuEi8.js rename to internal/webui/static/assets/ShieldCheck.es-DUiHamsh.js index 1a9192e97..ce9afaf0d 100644 --- a/internal/webui/static/assets/ShieldCheck.es-CF5xuEi8.js +++ b/internal/webui/static/assets/ShieldCheck.es-DUiHamsh.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-XrvNxGvP.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,36H48A20,20,0,0,0,28,56v56c0,54.29,26.32,87.22,48.4,105.29,23.71,19.39,47.44,26,48.44,26.29a12.1,12.1,0,0,0,6.32,0c1-.28,24.73-6.9,48.44-26.29,22.08-18.07,48.4-51,48.4-105.29V56A20,20,0,0,0,208,36Zm-4,76c0,35.71-13.09,64.69-38.91,86.15A126.28,126.28,0,0,1,128,219.38a126.14,126.14,0,0,1-37.09-21.23C65.09,176.69,52,147.71,52,112V60H204ZM79.51,144.49a12,12,0,1,1,17-17L112,143l47.51-47.52a12,12,0,0,1,17,17l-56,56a12,12,0,0,1-17,0Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,56v56c0,96-88,120-88,120S40,208,40,112V56a8,8,0,0,1,8-8H208A8,8,0,0,1,216,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm-34.32,69.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,42H48A14,14,0,0,0,34,56v56c0,51.94,25.12,83.4,46.2,100.64,22.73,18.6,45.27,24.89,46.22,25.15a6,6,0,0,0,3.16,0c.95-.26,23.49-6.55,46.22-25.15C196.88,195.4,222,163.94,222,112V56A14,14,0,0,0,208,42Zm2,70c0,37.76-13.94,68.39-41.44,91.06A131.17,131.17,0,0,1,128,225.72a130.94,130.94,0,0,1-40.56-22.66C59.94,180.39,46,149.76,46,112V56a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2ZM172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,44H48A12,12,0,0,0,36,56v56c0,51.16,24.73,82.12,45.47,99.1,22.4,18.32,44.55,24.5,45.48,24.76a4,4,0,0,0,2.1,0c.93-.26,23.08-6.44,45.48-24.76,20.74-17,45.47-47.94,45.47-99.1V56A12,12,0,0,0,208,44Zm4,68c0,38.44-14.23,69.63-42.29,92.71A132.45,132.45,0,0,1,128,227.82a132.23,132.23,0,0,1-41.71-23.11C58.23,181.63,44,150.44,44,112V56a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-41.17-10.83a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`ShieldCheckIcon`;var o=a;export{o as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-BAo1UrJW.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,36H48A20,20,0,0,0,28,56v56c0,54.29,26.32,87.22,48.4,105.29,23.71,19.39,47.44,26,48.44,26.29a12.1,12.1,0,0,0,6.32,0c1-.28,24.73-6.9,48.44-26.29,22.08-18.07,48.4-51,48.4-105.29V56A20,20,0,0,0,208,36Zm-4,76c0,35.71-13.09,64.69-38.91,86.15A126.28,126.28,0,0,1,128,219.38a126.14,126.14,0,0,1-37.09-21.23C65.09,176.69,52,147.71,52,112V60H204ZM79.51,144.49a12,12,0,1,1,17-17L112,143l47.51-47.52a12,12,0,0,1,17,17l-56,56a12,12,0,0,1-17,0Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,56v56c0,96-88,120-88,120S40,208,40,112V56a8,8,0,0,1,8-8H208A8,8,0,0,1,216,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm-34.32,69.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,42H48A14,14,0,0,0,34,56v56c0,51.94,25.12,83.4,46.2,100.64,22.73,18.6,45.27,24.89,46.22,25.15a6,6,0,0,0,3.16,0c.95-.26,23.49-6.55,46.22-25.15C196.88,195.4,222,163.94,222,112V56A14,14,0,0,0,208,42Zm2,70c0,37.76-13.94,68.39-41.44,91.06A131.17,131.17,0,0,1,128,225.72a130.94,130.94,0,0,1-40.56-22.66C59.94,180.39,46,149.76,46,112V56a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2ZM172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.26,47,25.53a8,8,0,0,0,4.2,0c1-.27,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm0,72c0,37.07-13.66,67.16-40.6,89.42A129.3,129.3,0,0,1,128,223.62a128.25,128.25,0,0,1-38.92-21.81C61.82,179.51,48,149.3,48,112l0-56,160,0ZM82.34,141.66a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32l-56,56a8,8,0,0,1-11.32,0Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M208,44H48A12,12,0,0,0,36,56v56c0,51.16,24.73,82.12,45.47,99.1,22.4,18.32,44.55,24.5,45.48,24.76a4,4,0,0,0,2.1,0c.93-.26,23.08-6.44,45.48-24.76,20.74-17,45.47-47.94,45.47-99.1V56A12,12,0,0,0,208,44Zm4,68c0,38.44-14.23,69.63-42.29,92.71A132.45,132.45,0,0,1,128,227.82a132.23,132.23,0,0,1-41.71-23.11C58.23,181.63,44,150.44,44,112V56a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-41.17-10.83a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`ShieldCheckIcon`;var o=a;export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/SidebarUpdateDialog-BLCxAyNr.js b/internal/webui/static/assets/SidebarUpdateDialog-Dmu4v5_v.js similarity index 83% rename from internal/webui/static/assets/SidebarUpdateDialog-BLCxAyNr.js rename to internal/webui/static/assets/SidebarUpdateDialog-Dmu4v5_v.js index 126210fa8..3da0d2091 100644 --- a/internal/webui/static/assets/SidebarUpdateDialog-BLCxAyNr.js +++ b/internal/webui/static/assets/SidebarUpdateDialog-Dmu4v5_v.js @@ -1 +1 @@ -import{n as e}from"./shim-mfK0Rmj6.js";import{r as t}from"./useI18n-XrvNxGvP.js";import{t as n}from"./PageAlert-BbN7e2aZ.js";import{t as r}from"./modal-CQ6c3Rhf.js";import{Ot as i}from"./index-CAlyInAP.js";import{n as a,r as o,t as s}from"./UpdateControls-DvS7Rp4P.js";var c=e();function l({open:e,update:l,release:u,version:d,lang:f,labels:p,onClose:m,onGoToUpdate:h}){return(0,c.jsx)(r.Root,{isOpen:e,onOpenChange:e=>{e||m()},children:(0,c.jsx)(r.Backdrop,{variant:`blur`,children:(0,c.jsx)(r.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,c.jsxs)(r.Dialog,{children:[(0,c.jsxs)(r.Header,{className:`items-start justify-between gap-4`,children:[(0,c.jsxs)(`div`,{children:[(0,c.jsx)(r.Heading,{className:`text-section font-semibold`,children:p.versionUpdate}),(0,c.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:u?.tag_name||d})]}),(0,c.jsx)(r.CloseTrigger,{"aria-label":p.close,className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,c.jsx)(i,{size:16})})]}),(0,c.jsxs)(r.Body,{className:`space-y-4`,children:[l.error?(0,c.jsx)(n,{title:l.error}):null,(0,c.jsx)(s,{update:l}),(0,c.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:p.releaseNotes}),(0,c.jsx)(a,{markdown:o(u?.body,f),emptyLabel:p.emptyNotes})]}),(0,c.jsxs)(r.Footer,{className:`justify-end`,children:[(0,c.jsx)(t,{variant:`ghost`,className:`mr-auto`,onPress:h,children:p.goToUpdate}),(0,c.jsx)(t,{variant:`secondary`,onPress:m,children:p.close})]})]})})})})}export{l as SidebarUpdateDialog}; \ No newline at end of file +import{n as e}from"./shim-mfK0Rmj6.js";import{r as t}from"./useI18n-BAo1UrJW.js";import{t as n}from"./PageAlert-4fxVtrfI.js";import{t as r}from"./modal-6BQxrL1y.js";import{Ot as i}from"./index-CWTBzWuK.js";import{n as a,r as o,t as s}from"./UpdateControls-D6g_yL8s.js";var c=e();function l({open:e,update:l,release:u,version:d,lang:f,labels:p,onClose:m,onGoToUpdate:h}){return(0,c.jsx)(r.Root,{isOpen:e,onOpenChange:e=>{e||m()},children:(0,c.jsx)(r.Backdrop,{variant:`blur`,children:(0,c.jsx)(r.Container,{placement:`center`,size:`lg`,scroll:`inside`,children:(0,c.jsxs)(r.Dialog,{children:[(0,c.jsxs)(r.Header,{className:`items-start justify-between gap-4`,children:[(0,c.jsxs)(`div`,{children:[(0,c.jsx)(r.Heading,{className:`text-section font-semibold`,children:p.versionUpdate}),(0,c.jsx)(`p`,{className:`mono mt-1 text-caption text-muted`,children:u?.tag_name||d})]}),(0,c.jsx)(r.CloseTrigger,{"aria-label":p.close,className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,c.jsx)(i,{size:16})})]}),(0,c.jsxs)(r.Body,{className:`space-y-4`,children:[l.error?(0,c.jsx)(n,{title:l.error}):null,(0,c.jsx)(s,{update:l}),(0,c.jsx)(`div`,{className:`text-caption font-medium text-muted`,children:p.releaseNotes}),(0,c.jsx)(a,{markdown:o(u?.body,f),emptyLabel:p.emptyNotes})]}),(0,c.jsxs)(r.Footer,{className:`justify-end`,children:[(0,c.jsx)(t,{variant:`ghost`,className:`mr-auto`,onPress:h,children:p.goToUpdate}),(0,c.jsx)(t,{variant:`secondary`,onPress:m,children:p.close})]})]})})})})}export{l as SidebarUpdateDialog}; \ No newline at end of file diff --git a/internal/webui/static/assets/Stack.es-B6AMU1oV.js b/internal/webui/static/assets/Stack.es-BNgbK5ij.js similarity index 97% rename from internal/webui/static/assets/Stack.es-B6AMU1oV.js rename to internal/webui/static/assets/Stack.es-BNgbK5ij.js index 1355e832a..c7443322d 100644 --- a/internal/webui/static/assets/Stack.es-B6AMU1oV.js +++ b/internal/webui/static/assets/Stack.es-BNgbK5ij.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-XrvNxGvP.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M234.36,170A12,12,0,0,1,230,186.37l-96,56a12,12,0,0,1-12.1,0l-96-56a12,12,0,0,1,12.09-20.74l90,52.48L218,165.63A12,12,0,0,1,234.36,170ZM218,117.63,128,170.11,38.05,117.63A12,12,0,0,0,26,138.37l96,56a12,12,0,0,0,12.1,0l96-56A12,12,0,0,0,218,117.63ZM20,80a12,12,0,0,1,6-10.37l96-56a12.06,12.06,0,0,1,12.1,0l96,56a12,12,0,0,1,0,20.74l-96,56a12,12,0,0,1-12.1,0l-96-56A12,12,0,0,1,20,80Zm35.82,0L128,122.11,200.18,80,128,37.89Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,80l-96,56L32,80l96-56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M220,169.09l-92,53.65L36,169.09A8,8,0,0,0,28,182.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,169.09Z`}),r.createElement(`path`,{d:`M220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09Z`}),r.createElement(`path`,{d:`M28,86.91l96,56a8,8,0,0,0,8.06,0l96-56a8,8,0,0,0,0-13.82l-96-56a8,8,0,0,0-8.06,0l-96,56a8,8,0,0,0,0,13.82Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M229.18,173a6,6,0,0,1-2.16,8.2l-96,56a6,6,0,0,1-6,0l-96-56a6,6,0,0,1,6-10.36l93,54.23,93-54.23A6,6,0,0,1,229.18,173ZM221,122.82l-93,54.23L35,122.82a6,6,0,0,0-6,10.36l96,56a6,6,0,0,0,6,0l96-56a6,6,0,0,0-6-10.36ZM26,80a6,6,0,0,1,3-5.18l96-56a6,6,0,0,1,6,0l96,56a6,6,0,0,1,0,10.36l-96,56a6,6,0,0,1-6,0l-96-56A6,6,0,0,1,26,80Zm17.91,0L128,129.05,212.09,80,128,31Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M227.45,174a4,4,0,0,1-1.44,5.48l-96,56a4,4,0,0,1-4,0l-96-56a4,4,0,0,1,4-6.92l94,54.83,94-54.83A4,4,0,0,1,227.45,174ZM222,124.54l-94,54.83L34,124.54a4,4,0,0,0-4,6.92l96,56a4,4,0,0,0,4,0l96-56a4,4,0,0,0-4-6.92ZM28,80a4,4,0,0,1,2-3.46l96-56a4,4,0,0,1,4,0l96,56a4,4,0,0,1,0,6.92l-96,56a4,4,0,0,1-4,0l-96-56A4,4,0,0,1,28,80Zm11.94,0L128,131.37,216.06,80,128,28.63Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`StackIcon`;var o=a;export{o as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-BAo1UrJW.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M234.36,170A12,12,0,0,1,230,186.37l-96,56a12,12,0,0,1-12.1,0l-96-56a12,12,0,0,1,12.09-20.74l90,52.48L218,165.63A12,12,0,0,1,234.36,170ZM218,117.63,128,170.11,38.05,117.63A12,12,0,0,0,26,138.37l96,56a12,12,0,0,0,12.1,0l96-56A12,12,0,0,0,218,117.63ZM20,80a12,12,0,0,1,6-10.37l96-56a12.06,12.06,0,0,1,12.1,0l96,56a12,12,0,0,1,0,20.74l-96,56a12,12,0,0,1-12.1,0l-96-56A12,12,0,0,1,20,80Zm35.82,0L128,122.11,200.18,80,128,37.89Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,80l-96,56L32,80l96-56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M220,169.09l-92,53.65L36,169.09A8,8,0,0,0,28,182.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,169.09Z`}),r.createElement(`path`,{d:`M220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09Z`}),r.createElement(`path`,{d:`M28,86.91l96,56a8,8,0,0,0,8.06,0l96-56a8,8,0,0,0,0-13.82l-96-56a8,8,0,0,0-8.06,0l-96,56a8,8,0,0,0,0,13.82Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M229.18,173a6,6,0,0,1-2.16,8.2l-96,56a6,6,0,0,1-6,0l-96-56a6,6,0,0,1,6-10.36l93,54.23,93-54.23A6,6,0,0,1,229.18,173ZM221,122.82l-93,54.23L35,122.82a6,6,0,0,0-6,10.36l96,56a6,6,0,0,0,6,0l96-56a6,6,0,0,0-6-10.36ZM26,80a6,6,0,0,1,3-5.18l96-56a6,6,0,0,1,6,0l96,56a6,6,0,0,1,0,10.36l-96,56a6,6,0,0,1-6,0l-96-56A6,6,0,0,1,26,80Zm17.91,0L128,129.05,212.09,80,128,31Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M230.91,172A8,8,0,0,1,228,182.91l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,36,169.09l92,53.65,92-53.65A8,8,0,0,1,230.91,172ZM220,121.09l-92,53.65L36,121.09A8,8,0,0,0,28,134.91l96,56a8,8,0,0,0,8.06,0l96-56A8,8,0,1,0,220,121.09ZM24,80a8,8,0,0,1,4-6.91l96-56a8,8,0,0,1,8.06,0l96,56a8,8,0,0,1,0,13.82l-96,56a8,8,0,0,1-8.06,0l-96-56A8,8,0,0,1,24,80Zm23.88,0L128,126.74,208.12,80,128,33.26Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M227.45,174a4,4,0,0,1-1.44,5.48l-96,56a4,4,0,0,1-4,0l-96-56a4,4,0,0,1,4-6.92l94,54.83,94-54.83A4,4,0,0,1,227.45,174ZM222,124.54l-94,54.83L34,124.54a4,4,0,0,0-4,6.92l96,56a4,4,0,0,0,4,0l96-56a4,4,0,0,0-4-6.92ZM28,80a4,4,0,0,1,2-3.46l96-56a4,4,0,0,1,4,0l96,56a4,4,0,0,1,0,6.92l-96,56a4,4,0,0,1-4,0l-96-56A4,4,0,0,1,28,80Zm11.94,0L128,131.37,216.06,80,128,28.63Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`StackIcon`;var o=a;export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/SystemPage-CzaQG9BL.js b/internal/webui/static/assets/SystemPage-Cofpx5Eq.js similarity index 96% rename from internal/webui/static/assets/SystemPage-CzaQG9BL.js rename to internal/webui/static/assets/SystemPage-Cofpx5Eq.js index 6df65a8d6..d02ec451c 100644 --- a/internal/webui/static/assets/SystemPage-CzaQG9BL.js +++ b/internal/webui/static/assets/SystemPage-Cofpx5Eq.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./clipboard-CWhuA-N0.js";import{t as a}from"./ShieldCheck.es-CF5xuEi8.js";import{n as o,pt as s,r as c}from"./useI18n-XrvNxGvP.js";import{t as l}from"./label-B8hTan2F.js";import{t as u}from"./accordion-LzsgJWJ-.js";import{t as d}from"./PageAlert-BbN7e2aZ.js";import{t as f}from"./ConfirmDialog-DCaOykOx.js";import{n as p}from"./useToggle-55_Qx9vA.js";import{t as m}from"./description-Du44nrYx.js";import{t as h}from"./input-CYN6ajmO.js";import{t as g}from"./list-box-BtjELxmv.js";import{t as _}from"./modal-CQ6c3Rhf.js";import{n as v,t as y}from"./tabs-DrJPw_Nc.js";import{t as b}from"./select-DSzMi7kM.js";import{t as x}from"./CompactSwitch-Dd3U4EbK.js";import{I as ee}from"./overview-ARhe2pSk.js";import{Bt as S,C as te,E as C,Gt as ne,Ht as w,Kt as re,Lt as ie,N as T,O as ae,Ot as E,Qt as oe,T as se,Wt as ce,h as le}from"./index-CAlyInAP.js";import{n as D,r as O,t as ue}from"./UpdateControls-DvS7Rp4P.js";import{t as de}from"./FormRow-CL_rVm7f.js";import{a as fe,i as pe}from"./keys-DEnJc6b-.js";var k=t(e(),1),A=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M196,35.52C177.62,25.51,153.48,20,128,20S78.38,25.51,60,35.52C39.37,46.79,28,62.58,28,80v96c0,17.42,11.37,33.21,32,44.48,18.35,10,42.49,15.52,68,15.52s49.62-5.51,68-15.52c20.66-11.27,32-27.06,32-44.48V80C228,62.58,216.63,46.79,196,35.52ZM204,128c0,17-31.21,36-76,36s-76-19-76-36v-8.46a88.9,88.9,0,0,0,8,4.94c18.35,10,42.49,15.52,68,15.52s49.62-5.51,68-15.52a88.9,88.9,0,0,0,8-4.94ZM128,44c44.79,0,76,19,76,36s-31.21,36-76,36S52,97,52,80,83.21,44,128,44Zm0,168c-44.79,0-76-19-76-36v-8.46a88.9,88.9,0,0,0,8,4.94c18.35,10,42.49,15.52,68,15.52s49.62-5.51,68-15.52a88.9,88.9,0,0,0,8-4.94V176C204,193,172.79,212,128,212Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,80c0,26.51-39.4,48-88,48S40,106.51,40,80s39.4-48,88-48S216,53.49,216,80Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64ZM69.61,53.08C85.07,44.65,105.81,40,128,40s42.93,4.65,58.39,13.08C200.12,60.57,208,70.38,208,80s-7.88,19.43-21.61,26.92C170.93,115.35,150.19,120,128,120s-42.93-4.65-58.39-13.08C55.88,99.43,48,89.62,48,80S55.88,60.57,69.61,53.08ZM186.39,202.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64Zm-21.61,74.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,26C75.29,26,34,49.72,34,80v96c0,30.28,41.29,54,94,54s94-23.72,94-54V80C222,49.72,180.71,26,128,26Zm0,12c44.45,0,82,19.23,82,42s-37.55,42-82,42S46,102.77,46,80,83.55,38,128,38Zm82,138c0,22.77-37.55,42-82,42s-82-19.23-82-42V154.79C62,171.16,92.37,182,128,182s66-10.84,82-27.21Zm0-48c0,22.77-37.55,42-82,42s-82-19.23-82-42V106.79C62,123.16,92.37,134,128,134s66-10.84,82-27.21Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64ZM69.61,53.08C85.07,44.65,105.81,40,128,40s42.93,4.65,58.39,13.08C200.12,60.57,208,70.38,208,80s-7.88,19.43-21.61,26.92C170.93,115.35,150.19,120,128,120s-42.93-4.65-58.39-13.08C55.88,99.43,48,89.62,48,80S55.88,60.57,69.61,53.08ZM186.39,202.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M192.14,42.55C174.94,33.17,152.16,28,128,28S81.06,33.17,63.86,42.55C45.89,52.35,36,65.65,36,80v96c0,14.35,9.89,27.65,27.86,37.45,17.2,9.38,40,14.55,64.14,14.55s46.94-5.17,64.14-14.55c18-9.8,27.86-23.1,27.86-37.45V80C220,65.65,210.11,52.35,192.14,42.55ZM212,176c0,11.29-8.41,22.1-23.69,30.43C172.27,215.18,150.85,220,128,220s-44.27-4.82-60.31-13.57C52.41,198.1,44,187.29,44,176V149.48c4.69,5.93,11.37,11.34,19.86,16,17.2,9.38,40,14.55,64.14,14.55s46.94-5.17,64.14-14.55c8.49-4.63,15.17-10,19.86-16Zm0-48c0,11.29-8.41,22.1-23.69,30.43C172.27,167.18,150.85,172,128,172s-44.27-4.82-60.31-13.57C52.41,150.1,44,139.29,44,128V101.48c4.69,5.93,11.37,11.34,19.86,16,17.2,9.38,40,14.55,64.14,14.55s46.94-5.17,64.14-14.55c8.49-4.63,15.17-10,19.86-16Zm-23.69-17.57C172.27,119.18,150.85,124,128,124s-44.27-4.82-60.31-13.57C52.41,102.1,44,91.29,44,80s8.41-22.1,23.69-30.43C83.73,40.82,105.15,36,128,36s44.27,4.82,60.31,13.57C203.59,57.9,212,68.71,212,80S203.59,102.1,188.31,110.43Z`}))]]),j=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M40,92H70.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24H137.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24Zm64-24A12,12,0,1,1,92,80,12,12,0,0,1,104,68Zm112,96H201.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24h94.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24Zm-48,24a12,12,0,1,1,12-12A12,12,0,0,1,168,188Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,80a24,24,0,1,1-24-24A24,24,0,0,1,128,80Zm40,72a24,24,0,1,0,24,24A24,24,0,0,0,168,152Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M32,80a8,8,0,0,1,8-8H77.17a28,28,0,0,1,53.66,0H216a8,8,0,0,1,0,16H130.83a28,28,0,0,1-53.66,0H40A8,8,0,0,1,32,80Zm184,88H194.83a28,28,0,0,0-53.66,0H40a8,8,0,0,0,0,16H141.17a28,28,0,0,0,53.66,0H216a8,8,0,0,0,0-16Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M40,86H74.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12H133.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12Zm64-24A18,18,0,1,1,86,80,18,18,0,0,1,104,62ZM216,170H197.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12h98.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12Zm-48,24a18,18,0,1,1,18-18A18,18,0,0,1,168,194Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M40,84H76.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8H131.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8Zm64-24A20,20,0,1,1,84,80,20,20,0,0,1,104,60ZM216,172H195.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8H140.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8Zm-48,24a20,20,0,1,1,20-20A20,20,0,0,1,168,196Z`}))]]),M=k.forwardRef((e,t)=>k.createElement(s,{ref:t,...e,weights:A}));M.displayName=`DatabaseIcon`;var me=M,N=k.forwardRef((e,t)=>k.createElement(s,{ref:t,...e,weights:j}));N.displayName=`SlidersHorizontalIcon`;var P=N,F=n();function I(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleDateString(t===`zh`?`zh-CN`:`en-US`,{year:`numeric`,month:`short`,day:`numeric`})}function he({releases:e,currentVersion:t,nextVersion:n,rollbackTags:r,canRollback:i,submitting:a,onRestore:s}){let{t:l,lang:d}=o();if(!e.length)return null;let f=n&&n!==t?n:t,p=e.some(e=>e.tag_name===f)?f:e[0]?.tag_name,m=new Set(r);return(0,F.jsxs)(`div`,{className:`mt-5`,children:[(0,F.jsx)(`div`,{className:`mb-2`,children:(0,F.jsx)(`p`,{className:`text-caption font-medium text-foreground`,children:l(`versionHistory`)})}),(0,F.jsx)(u,{className:`rounded-lg bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:p?[p]:[],children:e.map(e=>{let r=e.tag_name,o=r===t,f=!!(n&&r===n&&n!==t),p=i&&m.has(r)&&!o,h=I(e.published_at,d);return(0,F.jsxs)(u.Item,{id:r,children:[(0,F.jsx)(u.Heading,{children:(0,F.jsxs)(u.Trigger,{className:`items-center gap-3 px-3 py-2.5 text-left`,children:[(0,F.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`mono text-body font-semibold`,children:r}),o?(0,F.jsx)(T,{size:`sm`,variant:`soft`,color:`success`,children:l(`versionCurrentBadge`)}):null,f?(0,F.jsx)(T,{size:`sm`,variant:`soft`,color:`warning`,children:l(`versionLatestBadge`)}):null,h?(0,F.jsx)(`span`,{className:`truncate text-caption text-muted`,children:h}):null]}),(0,F.jsx)(u.Indicator,{})]})}),(0,F.jsx)(u.Panel,{children:(0,F.jsxs)(u.Body,{className:`px-3 pb-3`,children:[(0,F.jsx)(`div`,{className:`release-notes-box release-notes-box--compact`,children:(0,F.jsx)(D,{markdown:O(e.body,d),emptyLabel:l(`updateNoNotes`)})}),p?(0,F.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,F.jsx)(c,{size:`sm`,variant:`ghost`,isDisabled:a,onPress:()=>s(r),children:l(`restoreThisVersion`)})}):null]})})]},r)})})]})}function L(e){let t=new Set,n=[];for(let r of e){let e=r.tag_name?.trim();!e||t.has(e)||(t.add(e),n.push({...r,tag_name:e}))}return n}function ge(e,t,n,r,i){return r?.length?L(r):L([...n?[n]:t?[{tag_name:t}]:[],...e?[{tag_name:e}]:[],...i||[]])}var _e=[`general`,`routing`,`security`,`updates`];function R(){let{t:e}=o(),[t,n]=oe(),s=t.get(`tab`),u=s&&_e.includes(s)?s:`general`,D=e=>n(e===`general`?{}:{tab:e},{replace:!0}),{setApiKey:O}=ee(),{refresh:A}=ae(),[j,M]=(0,k.useState)(null),[N,I]=(0,k.useState)(null),[L,R]=(0,k.useState)(``),[z,B]=(0,k.useState)(!1),[V,H]=(0,k.useState)(!1),[ve,U]=(0,k.useState)(!1),[W,G]=(0,k.useState)(``),[ye,K]=(0,k.useState)(!1),[q,J]=(0,k.useState)(``),Y=te(),{info:X,loading:be,checking:xe,submitting:Z,error:Q,setError:$,load:Se,canRollback:Ce,rollbackTo:we}=Y,Te=(0,k.useMemo)(()=>ge(X?.current_version||``,X?.next_version,X?.release,X?.recent_releases,X?.rollback_versions),[X?.current_version,X?.next_version,X?.release,X?.recent_releases,X?.rollback_versions]),Ee=(0,k.useMemo)(()=>(X?.rollback_versions||[]).map(e=>e.tag_name),[X?.rollback_versions]);(0,k.useEffect)(()=>{let e=window.setTimeout(()=>{pe().then(M).catch(()=>void 0),se().then(e=>{I(e),R(e.proxy_url||``)}).catch(e=>$(e instanceof Error?e.message:String(e)))},0);return()=>window.clearTimeout(e)},[$]);async function De(e){let t=N?.cross_provider_model_pool??!0;I(t=>t&&{...t,cross_provider_model_pool:e}),B(!0),$(``);try{I(await C({cross_provider_model_pool:e})),A(void 0,{silent:!0}).catch(()=>void 0)}catch(e){I(e=>e&&{...e,cross_provider_model_pool:t}),$(e instanceof Error?e.message:String(e))}finally{B(!1)}}async function Oe(e){let t=N?.checkin_disabled_accounts??!1;I(t=>t&&{...t,checkin_disabled_accounts:e}),B(!0),$(``);try{I(await C({checkin_disabled_accounts:e}))}catch(e){I(e=>e&&{...e,checkin_disabled_accounts:t}),$(e instanceof Error?e.message:String(e))}finally{B(!1)}}async function ke(e){let t=N?.proxy_url||``;if(e===t){R(t);return}let n=L;R(e),I(t=>t&&{...t,proxy_url:e}),B(!0),$(``);try{let t=await C({proxy_url:e});I(t),R(t.proxy_url||``)}catch(e){R(n),I(e=>e&&{...e,proxy_url:t}),$(e instanceof Error?e.message:String(e))}finally{B(!1)}}async function Ae(e){let t=N?.routing_strategy||`round-robin`;I(t=>t&&{...t,routing_strategy:e}),B(!0),$(``);try{I(await C({routing_strategy:e}))}catch(e){I(e=>e&&{...e,routing_strategy:t}),$(e instanceof Error?e.message:String(e))}finally{B(!1)}}return be&&!X?(0,F.jsx)(le,{}):(0,F.jsxs)(`div`,{className:`space-y-6`,children:[(0,F.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-4 pb-4`,children:(0,F.jsxs)(c,{size:`sm`,variant:`secondary`,isPending:xe,onPress:()=>void Se(!0),children:[(0,F.jsx)(ne,{size:15}),e(`checkUpdates`)]})}),Q?(0,F.jsx)(d,{title:Q}):null,(0,F.jsxs)(y,{selectedKey:u,onSelectionChange:e=>D(String(e)),children:[(0,F.jsx)(y.ListContainer,{className:`w-fit max-w-full overflow-x-auto`,children:(0,F.jsxs)(y.List,{"aria-label":e(`systemSettingsTitle`),children:[(0,F.jsxs)(v,{id:`general`,className:`gap-1.5 whitespace-nowrap`,children:[(0,F.jsx)(y.Indicator,{}),(0,F.jsx)(S,{size:13}),e(`settingsTabGeneral`)]}),(0,F.jsxs)(v,{id:`routing`,className:`gap-1.5 whitespace-nowrap`,children:[(0,F.jsx)(y.Indicator,{}),(0,F.jsx)(ce,{size:13}),e(`settingsTabRouting`)]}),(0,F.jsxs)(v,{id:`security`,className:`gap-1.5 whitespace-nowrap`,children:[(0,F.jsx)(y.Indicator,{}),(0,F.jsx)(a,{size:13}),e(`settingsTabSecurity`)]}),(0,F.jsxs)(v,{id:`updates`,className:`gap-1.5 whitespace-nowrap`,children:[(0,F.jsx)(y.Indicator,{}),(0,F.jsx)(re,{size:13}),e(`settingsTabUpdates`)]})]})}),(0,F.jsx)(y.Panel,{id:`general`,className:`pt-5`,children:(0,F.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,F.jsxs)(p,{"data-gsap-reveal":!0,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,F.jsx)(P,{size:15})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`proxySettingsTitle`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`proxySettingsHint`)})]})]}),(0,F.jsxs)(`div`,{className:`mt-4 space-y-1.5`,children:[(0,F.jsx)(l,{className:`text-body font-medium text-muted`,children:e(`proxyUrl`)}),(0,F.jsx)(h,{value:L,onChange:e=>R(e.target.value),onBlur:e=>void ke(e.target.value.trim()),placeholder:e(`proxyUrlPlaceholder`),disabled:z||!N}),(0,F.jsx)(m,{className:`text-caption leading-5 text-muted`,children:e(`proxyUrlHint`)})]})]}),(0,F.jsxs)(p,{"data-gsap-reveal":!0,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,F.jsx)(w,{size:15})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`checkinDisabledAccountsTitle`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`checkinDisabledAccountsHint`)})]})]}),(0,F.jsx)(x,{isSelected:N?.checkin_disabled_accounts??!1,isDisabled:z||!N,ariaLabel:e(`checkinDisabledAccountsAriaLabel`),onChange:e=>void Oe(e)})]}),(0,F.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,F.jsx)(`span`,{children:e(`checkinDisabledAccountsStatus`)}),(0,F.jsx)(`span`,{className:`font-medium text-foreground`,children:N?.checkin_disabled_accounts?e(`enabled`):e(`disabled`)})]})]})]})}),(0,F.jsx)(y.Panel,{id:`routing`,className:`pt-5`,children:(0,F.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,F.jsxs)(p,{"data-gsap-reveal":!0,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,F.jsx)(P,{size:15})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`routingStrategyTitle`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`routingStrategyHint`)})]})]}),(0,F.jsx)(`div`,{className:`mt-4 pt-4`,children:(0,F.jsx)(de,{label:e(`routingStrategy`),children:(0,F.jsxs)(b,{fullWidth:!0,"aria-label":e(`routingStrategy`),value:N?.routing_strategy||`round-robin`,isDisabled:z||!N,onChange:e=>{typeof e==`string`&&e&&Ae(e)},children:[(0,F.jsxs)(b.Trigger,{className:`items-center`,children:[(0,F.jsx)(b.Value,{className:`min-w-0 truncate`}),(0,F.jsx)(b.Indicator,{})]}),(0,F.jsx)(b.Popover,{children:(0,F.jsxs)(g,{children:[(0,F.jsxs)(g.Item,{id:`round-robin`,textValue:`round-robin`,children:[(0,F.jsx)(l,{children:e(`routingRoundRobin`)}),(0,F.jsx)(g.ItemIndicator,{})]}),(0,F.jsxs)(g.Item,{id:`weighted-round-robin`,textValue:`weighted-round-robin`,children:[(0,F.jsx)(l,{children:e(`routingWeightedRoundRobin`)}),(0,F.jsx)(g.ItemIndicator,{})]}),(0,F.jsxs)(g.Item,{id:`fill-first`,textValue:`fill-first`,children:[(0,F.jsx)(l,{children:e(`routingFillFirst`)}),(0,F.jsx)(g.ItemIndicator,{})]}),(0,F.jsxs)(g.Item,{id:`fefo`,textValue:`fefo`,children:[(0,F.jsx)(l,{children:e(`routingFEFO`)}),(0,F.jsx)(g.ItemIndicator,{})]}),(0,F.jsxs)(g.Item,{id:`least-quota-first`,textValue:`least-quota-first`,children:[(0,F.jsx)(l,{children:e(`routingLeastQuotaFirst`)}),(0,F.jsx)(g.ItemIndicator,{})]}),(0,F.jsxs)(g.Item,{id:`most-quota-first`,textValue:`most-quota-first`,children:[(0,F.jsx)(l,{children:e(`routingMostQuotaFirst`)}),(0,F.jsx)(g.ItemIndicator,{})]})]})})]})})}),(0,F.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2 pt-3 text-caption text-muted sm:grid-cols-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:N?.session_affinity?.ttl_seconds?`${Math.round(N.session_affinity.ttl_seconds/60)}m`:`—`}),e(`sessionAffinityTTL`)]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:N?.session_affinity?.hits??0}),e(`sessionAffinityHits`)]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:N?.session_affinity?.misses??0}),e(`sessionAffinityMisses`)]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:N?.session_affinity?.escapes??0}),e(`sessionAffinityEscapes`)]})]}),N?.session_affinity?.last_escape_reason?(0,F.jsxs)(m,{className:`mt-3 text-caption`,children:[e(`lastSessionEscape`),`: `,N.session_affinity.last_escape_reason]}):null,N?.session_affinity?.last_miss_reason?(0,F.jsxs)(m,{className:`mt-1 text-caption`,children:[e(`lastSessionMiss`),`: `,N.session_affinity.last_miss_reason]}):null]}),(0,F.jsxs)(p,{"data-gsap-reveal":!0,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,F.jsx)(P,{size:15})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`crossProviderModelPoolTitle`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`crossProviderModelPoolHint`)})]})]}),(0,F.jsx)(x,{isSelected:N?.cross_provider_model_pool??!0,isDisabled:z||!N,ariaLabel:e(`crossProviderModelPoolAriaLabel`),onChange:e=>void De(e)})]}),(0,F.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,F.jsx)(`span`,{children:e(`crossProviderModelPoolStatus`)}),(0,F.jsx)(`span`,{className:`font-medium text-foreground`,children:N?.cross_provider_model_pool?e(`enabled`):e(`disabled`)})]})]})]})}),(0,F.jsx)(y.Panel,{id:`security`,className:`pt-5`,children:(0,F.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,F.jsxs)(p,{"data-gsap-reveal":!0,children:[(0,F.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,F.jsx)(ie,{size:15})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`consoleKeyTitle`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyHint`)})]})]})}),(0,F.jsx)(`code`,{className:`mono mt-4 block rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:j?.prefix||`—`}),(0,F.jsx)(`p`,{className:`mt-3 text-caption leading-5 text-muted`,children:e(`consoleKeyLead`)}),(0,F.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,F.jsx)(c,{size:`sm`,variant:`ghost`,isPending:V,onPress:()=>U(!0),children:e(`consoleKeyRotate`)})})]}),(0,F.jsxs)(p,{"data-gsap-reveal":!0,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,F.jsx)(me,{size:15})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`sqliteProtection`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`sqliteProtectionHint`)})]})]}),(0,F.jsx)(a,{size:18,className:`text-success`})]}),(0,F.jsx)(`div`,{className:`mono mt-4 rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:`/data`}),(0,F.jsxs)(`div`,{className:`mt-3 grid gap-2 text-caption text-muted`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(w,{size:14,className:`text-muted`}),e(`sqliteBackupBeforeUpdate`)]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(w,{size:14,className:`text-muted`}),e(`sqliteKeepFive`)]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(w,{size:14,className:`text-muted`}),e(`sqliteRollbackTogether`)]})]})]})]})}),(0,F.jsx)(y.Panel,{id:`updates`,className:`pt-5`,children:(0,F.jsx)(`div`,{className:`grid gap-5`,children:(0,F.jsxs)(p,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`versionUpdate`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`latestVersionHint`)})]}),(0,F.jsx)(T,{size:`sm`,variant:`soft`,color:X?.has_update?`warning`:`success`,children:X?.has_update?e(`updateAvailable`):e(`upToDate`)})]}),(0,F.jsxs)(`div`,{className:`px-5 py-5`,children:[(0,F.jsx)(ue,{update:Y}),(0,F.jsx)(he,{releases:Te,currentVersion:X?.current_version||``,nextVersion:X?.next_version,rollbackTags:Ee,canRollback:Ce,submitting:Z,onRestore:J})]})]})})})]}),(0,F.jsx)(f,{isOpen:!!q,title:e(`restoreVersionTitle`,{version:q}),description:e(`restoreVersionHint`),confirmLabel:e(`restoreThisVersion`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:Z,status:`warning`,confirmVariant:`primary`,onClose:()=>{Z||J(``)},onConfirm:()=>{let e=q;J(``),we(e)}}),(0,F.jsx)(_.Root,{isOpen:ve,onOpenChange:e=>{!e&&!V&&U(!1)},children:(0,F.jsx)(_.Backdrop,{variant:`blur`,isDismissable:!V,children:(0,F.jsx)(_.Container,{placement:`center`,size:`sm`,children:(0,F.jsxs)(_.Dialog,{children:[(0,F.jsxs)(_.Header,{className:`items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(_.Heading,{className:`text-section font-semibold`,children:e(`consoleKeyRotate`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyRotateHint`)})]}),(0,F.jsx)(_.CloseTrigger,{isDisabled:V,"aria-label":e(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,F.jsx)(E,{size:16})})]}),(0,F.jsxs)(_.Footer,{className:`justify-end`,children:[(0,F.jsx)(c,{variant:`ghost`,isDisabled:V,onPress:()=>U(!1),children:e(`cancel`)}),(0,F.jsx)(c,{variant:`danger`,isPending:V,onPress:()=>{H(!0),fe().then(e=>{M(e),G(e.secret||``),e.secret&&O(e.secret),U(!1)}).catch(e=>{$(e instanceof Error?e.message:String(e))}).finally(()=>H(!1))},children:e(`consoleKeyRotateNow`)})]})]})})})}),(0,F.jsx)(_.Root,{isOpen:!!W,onOpenChange:e=>{e||G(``)},children:(0,F.jsx)(_.Backdrop,{variant:`blur`,children:(0,F.jsx)(_.Container,{placement:`center`,size:`lg`,children:(0,F.jsxs)(_.Dialog,{children:[(0,F.jsxs)(_.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(_.Heading,{className:`text-section font-semibold`,children:e(`consoleKeySecretTitle`)}),(0,F.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`consoleKeySecretHint`)})]}),(0,F.jsx)(_.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,F.jsx)(E,{size:18})})]}),(0,F.jsx)(_.Body,{className:`px-6 pb-2`,children:(0,F.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:W})}),(0,F.jsxs)(_.Footer,{className:`justify-end`,children:[(0,F.jsx)(c,{variant:`ghost`,onPress:()=>G(``),children:e(`close`)}),(0,F.jsxs)(c,{onPress:()=>{i(W),K(!0),window.setTimeout(()=>K(!1),1200)},children:[(0,F.jsx)(r,{size:14}),e(ye?`copied`:`copy`)]})]})]})})})})]})}export{R as SystemPage}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./clipboard-ADnALjHx.js";import{t as a}from"./ShieldCheck.es-DUiHamsh.js";import{n as o,pt as s,r as c}from"./useI18n-BAo1UrJW.js";import{t as l}from"./label-DYYRLGoV.js";import{t as u}from"./accordion-DKpcSBXI.js";import{t as d}from"./PageAlert-4fxVtrfI.js";import{t as f}from"./ConfirmDialog-BzgkrQpc.js";import{n as p}from"./useToggle-DpH7h_oD.js";import{t as m}from"./description-CmJDGGCw.js";import{t as h}from"./input-BwBv1RBO.js";import{t as g}from"./list-box-DbrQLYNo.js";import{t as _}from"./modal-6BQxrL1y.js";import{n as v,t as y}from"./tabs-WTDlSXp1.js";import{t as b}from"./select-DnqAZzCR.js";import{t as x}from"./CompactSwitch-D0aW-Phm.js";import{I as ee}from"./overview-ARhe2pSk.js";import{Bt as S,C as te,E as C,Gt as ne,Ht as w,Kt as re,Lt as ie,N as T,O as ae,Ot as E,Qt as oe,T as se,Wt as ce,h as le}from"./index-CWTBzWuK.js";import{n as D,r as O,t as ue}from"./UpdateControls-D6g_yL8s.js";import{t as de}from"./FormRow-CqpQhYrN.js";import{a as fe,i as pe}from"./keys-DEnJc6b-.js";var k=t(e(),1),A=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M196,35.52C177.62,25.51,153.48,20,128,20S78.38,25.51,60,35.52C39.37,46.79,28,62.58,28,80v96c0,17.42,11.37,33.21,32,44.48,18.35,10,42.49,15.52,68,15.52s49.62-5.51,68-15.52c20.66-11.27,32-27.06,32-44.48V80C228,62.58,216.63,46.79,196,35.52ZM204,128c0,17-31.21,36-76,36s-76-19-76-36v-8.46a88.9,88.9,0,0,0,8,4.94c18.35,10,42.49,15.52,68,15.52s49.62-5.51,68-15.52a88.9,88.9,0,0,0,8-4.94ZM128,44c44.79,0,76,19,76,36s-31.21,36-76,36S52,97,52,80,83.21,44,128,44Zm0,168c-44.79,0-76-19-76-36v-8.46a88.9,88.9,0,0,0,8,4.94c18.35,10,42.49,15.52,68,15.52s49.62-5.51,68-15.52a88.9,88.9,0,0,0,8-4.94V176C204,193,172.79,212,128,212Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,80c0,26.51-39.4,48-88,48S40,106.51,40,80s39.4-48,88-48S216,53.49,216,80Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64ZM69.61,53.08C85.07,44.65,105.81,40,128,40s42.93,4.65,58.39,13.08C200.12,60.57,208,70.38,208,80s-7.88,19.43-21.61,26.92C170.93,115.35,150.19,120,128,120s-42.93-4.65-58.39-13.08C55.88,99.43,48,89.62,48,80S55.88,60.57,69.61,53.08ZM186.39,202.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64Zm-21.61,74.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,26C75.29,26,34,49.72,34,80v96c0,30.28,41.29,54,94,54s94-23.72,94-54V80C222,49.72,180.71,26,128,26Zm0,12c44.45,0,82,19.23,82,42s-37.55,42-82,42S46,102.77,46,80,83.55,38,128,38Zm82,138c0,22.77-37.55,42-82,42s-82-19.23-82-42V154.79C62,171.16,92.37,182,128,182s66-10.84,82-27.21Zm0-48c0,22.77-37.55,42-82,42s-82-19.23-82-42V106.79C62,123.16,92.37,134,128,134s66-10.84,82-27.21Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,24C74.17,24,32,48.6,32,80v96c0,31.4,42.17,56,96,56s96-24.6,96-56V80C224,48.6,181.83,24,128,24Zm80,104c0,9.62-7.88,19.43-21.61,26.92C170.93,163.35,150.19,168,128,168s-42.93-4.65-58.39-13.08C55.88,147.43,48,137.62,48,128V111.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64ZM69.61,53.08C85.07,44.65,105.81,40,128,40s42.93,4.65,58.39,13.08C200.12,60.57,208,70.38,208,80s-7.88,19.43-21.61,26.92C170.93,115.35,150.19,120,128,120s-42.93-4.65-58.39-13.08C55.88,99.43,48,89.62,48,80S55.88,60.57,69.61,53.08ZM186.39,202.92C170.93,211.35,150.19,216,128,216s-42.93-4.65-58.39-13.08C55.88,195.43,48,185.62,48,176V159.36c17.06,15,46.23,24.64,80,24.64s62.94-9.68,80-24.64V176C208,185.62,200.12,195.43,186.39,202.92Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M192.14,42.55C174.94,33.17,152.16,28,128,28S81.06,33.17,63.86,42.55C45.89,52.35,36,65.65,36,80v96c0,14.35,9.89,27.65,27.86,37.45,17.2,9.38,40,14.55,64.14,14.55s46.94-5.17,64.14-14.55c18-9.8,27.86-23.1,27.86-37.45V80C220,65.65,210.11,52.35,192.14,42.55ZM212,176c0,11.29-8.41,22.1-23.69,30.43C172.27,215.18,150.85,220,128,220s-44.27-4.82-60.31-13.57C52.41,198.1,44,187.29,44,176V149.48c4.69,5.93,11.37,11.34,19.86,16,17.2,9.38,40,14.55,64.14,14.55s46.94-5.17,64.14-14.55c8.49-4.63,15.17-10,19.86-16Zm0-48c0,11.29-8.41,22.1-23.69,30.43C172.27,167.18,150.85,172,128,172s-44.27-4.82-60.31-13.57C52.41,150.1,44,139.29,44,128V101.48c4.69,5.93,11.37,11.34,19.86,16,17.2,9.38,40,14.55,64.14,14.55s46.94-5.17,64.14-14.55c8.49-4.63,15.17-10,19.86-16Zm-23.69-17.57C172.27,119.18,150.85,124,128,124s-44.27-4.82-60.31-13.57C52.41,102.1,44,91.29,44,80s8.41-22.1,23.69-30.43C83.73,40.82,105.15,36,128,36s44.27,4.82,60.31,13.57C203.59,57.9,212,68.71,212,80S203.59,102.1,188.31,110.43Z`}))]]),j=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M40,92H70.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24H137.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24Zm64-24A12,12,0,1,1,92,80,12,12,0,0,1,104,68Zm112,96H201.94a36,36,0,0,0-67.88,0H40a12,12,0,0,0,0,24h94.06a36,36,0,0,0,67.88,0H216a12,12,0,0,0,0-24Zm-48,24a12,12,0,1,1,12-12A12,12,0,0,1,168,188Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,80a24,24,0,1,1-24-24A24,24,0,0,1,128,80Zm40,72a24,24,0,1,0,24,24A24,24,0,0,0,168,152Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M32,80a8,8,0,0,1,8-8H77.17a28,28,0,0,1,53.66,0H216a8,8,0,0,1,0,16H130.83a28,28,0,0,1-53.66,0H40A8,8,0,0,1,32,80Zm184,88H194.83a28,28,0,0,0-53.66,0H40a8,8,0,0,0,0,16H141.17a28,28,0,0,0,53.66,0H216a8,8,0,0,0,0-16Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M40,86H74.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12H133.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12Zm64-24A18,18,0,1,1,86,80,18,18,0,0,1,104,62ZM216,170H197.4a30,30,0,0,0-58.8,0H40a6,6,0,0,0,0,12h98.6a30,30,0,0,0,58.8,0H216a6,6,0,0,0,0-12Zm-48,24a18,18,0,1,1,18-18A18,18,0,0,1,168,194Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M40,88H73a32,32,0,0,0,62,0h81a8,8,0,0,0,0-16H135a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16Zm64-24A16,16,0,1,1,88,80,16,16,0,0,1,104,64ZM216,168H199a32,32,0,0,0-62,0H40a8,8,0,0,0,0,16h97a32,32,0,0,0,62,0h17a8,8,0,0,0,0-16Zm-48,24a16,16,0,1,1,16-16A16,16,0,0,1,168,192Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M40,84H76.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8H131.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8Zm64-24A20,20,0,1,1,84,80,20,20,0,0,1,104,60ZM216,172H195.71a28,28,0,0,0-55.42,0H40a4,4,0,0,0,0,8H140.29a28,28,0,0,0,55.42,0H216a4,4,0,0,0,0-8Zm-48,24a20,20,0,1,1,20-20A20,20,0,0,1,168,196Z`}))]]),M=k.forwardRef((e,t)=>k.createElement(s,{ref:t,...e,weights:A}));M.displayName=`DatabaseIcon`;var me=M,N=k.forwardRef((e,t)=>k.createElement(s,{ref:t,...e,weights:j}));N.displayName=`SlidersHorizontalIcon`;var P=N,F=n();function I(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleDateString(t===`zh`?`zh-CN`:`en-US`,{year:`numeric`,month:`short`,day:`numeric`})}function he({releases:e,currentVersion:t,nextVersion:n,rollbackTags:r,canRollback:i,submitting:a,onRestore:s}){let{t:l,lang:d}=o();if(!e.length)return null;let f=n&&n!==t?n:t,p=e.some(e=>e.tag_name===f)?f:e[0]?.tag_name,m=new Set(r);return(0,F.jsxs)(`div`,{className:`mt-5`,children:[(0,F.jsx)(`div`,{className:`mb-2`,children:(0,F.jsx)(`p`,{className:`text-caption font-medium text-foreground`,children:l(`versionHistory`)})}),(0,F.jsx)(u,{className:`rounded-lg bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:p?[p]:[],children:e.map(e=>{let r=e.tag_name,o=r===t,f=!!(n&&r===n&&n!==t),p=i&&m.has(r)&&!o,h=I(e.published_at,d);return(0,F.jsxs)(u.Item,{id:r,children:[(0,F.jsx)(u.Heading,{children:(0,F.jsxs)(u.Trigger,{className:`items-center gap-3 px-3 py-2.5 text-left`,children:[(0,F.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`mono text-body font-semibold`,children:r}),o?(0,F.jsx)(T,{size:`sm`,variant:`soft`,color:`success`,children:l(`versionCurrentBadge`)}):null,f?(0,F.jsx)(T,{size:`sm`,variant:`soft`,color:`warning`,children:l(`versionLatestBadge`)}):null,h?(0,F.jsx)(`span`,{className:`truncate text-caption text-muted`,children:h}):null]}),(0,F.jsx)(u.Indicator,{})]})}),(0,F.jsx)(u.Panel,{children:(0,F.jsxs)(u.Body,{className:`px-3 pb-3`,children:[(0,F.jsx)(`div`,{className:`release-notes-box release-notes-box--compact`,children:(0,F.jsx)(D,{markdown:O(e.body,d),emptyLabel:l(`updateNoNotes`)})}),p?(0,F.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,F.jsx)(c,{size:`sm`,variant:`ghost`,isDisabled:a,onPress:()=>s(r),children:l(`restoreThisVersion`)})}):null]})})]},r)})})]})}function L(e){let t=new Set,n=[];for(let r of e){let e=r.tag_name?.trim();!e||t.has(e)||(t.add(e),n.push({...r,tag_name:e}))}return n}function ge(e,t,n,r,i){return r?.length?L(r):L([...n?[n]:t?[{tag_name:t}]:[],...e?[{tag_name:e}]:[],...i||[]])}var _e=[`general`,`routing`,`security`,`updates`];function R(){let{t:e}=o(),[t,n]=oe(),s=t.get(`tab`),u=s&&_e.includes(s)?s:`general`,D=e=>n(e===`general`?{}:{tab:e},{replace:!0}),{setApiKey:O}=ee(),{refresh:A}=ae(),[j,M]=(0,k.useState)(null),[N,I]=(0,k.useState)(null),[L,R]=(0,k.useState)(``),[z,B]=(0,k.useState)(!1),[V,H]=(0,k.useState)(!1),[ve,U]=(0,k.useState)(!1),[W,G]=(0,k.useState)(``),[ye,K]=(0,k.useState)(!1),[q,J]=(0,k.useState)(``),Y=te(),{info:X,loading:be,checking:xe,submitting:Z,error:Q,setError:$,load:Se,canRollback:Ce,rollbackTo:we}=Y,Te=(0,k.useMemo)(()=>ge(X?.current_version||``,X?.next_version,X?.release,X?.recent_releases,X?.rollback_versions),[X?.current_version,X?.next_version,X?.release,X?.recent_releases,X?.rollback_versions]),Ee=(0,k.useMemo)(()=>(X?.rollback_versions||[]).map(e=>e.tag_name),[X?.rollback_versions]);(0,k.useEffect)(()=>{let e=window.setTimeout(()=>{pe().then(M).catch(()=>void 0),se().then(e=>{I(e),R(e.proxy_url||``)}).catch(e=>$(e instanceof Error?e.message:String(e)))},0);return()=>window.clearTimeout(e)},[$]);async function De(e){let t=N?.cross_provider_model_pool??!0;I(t=>t&&{...t,cross_provider_model_pool:e}),B(!0),$(``);try{I(await C({cross_provider_model_pool:e})),A(void 0,{silent:!0}).catch(()=>void 0)}catch(e){I(e=>e&&{...e,cross_provider_model_pool:t}),$(e instanceof Error?e.message:String(e))}finally{B(!1)}}async function Oe(e){let t=N?.checkin_disabled_accounts??!1;I(t=>t&&{...t,checkin_disabled_accounts:e}),B(!0),$(``);try{I(await C({checkin_disabled_accounts:e}))}catch(e){I(e=>e&&{...e,checkin_disabled_accounts:t}),$(e instanceof Error?e.message:String(e))}finally{B(!1)}}async function ke(e){let t=N?.proxy_url||``;if(e===t){R(t);return}let n=L;R(e),I(t=>t&&{...t,proxy_url:e}),B(!0),$(``);try{let t=await C({proxy_url:e});I(t),R(t.proxy_url||``)}catch(e){R(n),I(e=>e&&{...e,proxy_url:t}),$(e instanceof Error?e.message:String(e))}finally{B(!1)}}async function Ae(e){let t=N?.routing_strategy||`round-robin`;I(t=>t&&{...t,routing_strategy:e}),B(!0),$(``);try{I(await C({routing_strategy:e}))}catch(e){I(e=>e&&{...e,routing_strategy:t}),$(e instanceof Error?e.message:String(e))}finally{B(!1)}}return be&&!X?(0,F.jsx)(le,{}):(0,F.jsxs)(`div`,{className:`space-y-6`,children:[(0,F.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-4 pb-4`,children:(0,F.jsxs)(c,{size:`sm`,variant:`secondary`,isPending:xe,onPress:()=>void Se(!0),children:[(0,F.jsx)(ne,{size:15}),e(`checkUpdates`)]})}),Q?(0,F.jsx)(d,{title:Q}):null,(0,F.jsxs)(y,{selectedKey:u,onSelectionChange:e=>D(String(e)),children:[(0,F.jsx)(y.ListContainer,{className:`w-fit max-w-full overflow-x-auto`,children:(0,F.jsxs)(y.List,{"aria-label":e(`systemSettingsTitle`),children:[(0,F.jsxs)(v,{id:`general`,className:`gap-1.5 whitespace-nowrap`,children:[(0,F.jsx)(y.Indicator,{}),(0,F.jsx)(S,{size:13}),e(`settingsTabGeneral`)]}),(0,F.jsxs)(v,{id:`routing`,className:`gap-1.5 whitespace-nowrap`,children:[(0,F.jsx)(y.Indicator,{}),(0,F.jsx)(ce,{size:13}),e(`settingsTabRouting`)]}),(0,F.jsxs)(v,{id:`security`,className:`gap-1.5 whitespace-nowrap`,children:[(0,F.jsx)(y.Indicator,{}),(0,F.jsx)(a,{size:13}),e(`settingsTabSecurity`)]}),(0,F.jsxs)(v,{id:`updates`,className:`gap-1.5 whitespace-nowrap`,children:[(0,F.jsx)(y.Indicator,{}),(0,F.jsx)(re,{size:13}),e(`settingsTabUpdates`)]})]})}),(0,F.jsx)(y.Panel,{id:`general`,className:`pt-5`,children:(0,F.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,F.jsxs)(p,{"data-gsap-reveal":!0,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,F.jsx)(P,{size:15})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`proxySettingsTitle`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`proxySettingsHint`)})]})]}),(0,F.jsxs)(`div`,{className:`mt-4 space-y-1.5`,children:[(0,F.jsx)(l,{className:`text-body font-medium text-muted`,children:e(`proxyUrl`)}),(0,F.jsx)(h,{value:L,onChange:e=>R(e.target.value),onBlur:e=>void ke(e.target.value.trim()),placeholder:e(`proxyUrlPlaceholder`),disabled:z||!N}),(0,F.jsx)(m,{className:`text-caption leading-5 text-muted`,children:e(`proxyUrlHint`)})]})]}),(0,F.jsxs)(p,{"data-gsap-reveal":!0,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,F.jsx)(w,{size:15})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`checkinDisabledAccountsTitle`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`checkinDisabledAccountsHint`)})]})]}),(0,F.jsx)(x,{isSelected:N?.checkin_disabled_accounts??!1,isDisabled:z||!N,ariaLabel:e(`checkinDisabledAccountsAriaLabel`),onChange:e=>void Oe(e)})]}),(0,F.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,F.jsx)(`span`,{children:e(`checkinDisabledAccountsStatus`)}),(0,F.jsx)(`span`,{className:`font-medium text-foreground`,children:N?.checkin_disabled_accounts?e(`enabled`):e(`disabled`)})]})]})]})}),(0,F.jsx)(y.Panel,{id:`routing`,className:`pt-5`,children:(0,F.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,F.jsxs)(p,{"data-gsap-reveal":!0,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,F.jsx)(P,{size:15})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`routingStrategyTitle`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`routingStrategyHint`)})]})]}),(0,F.jsx)(`div`,{className:`mt-4 pt-4`,children:(0,F.jsx)(de,{label:e(`routingStrategy`),children:(0,F.jsxs)(b,{fullWidth:!0,"aria-label":e(`routingStrategy`),value:N?.routing_strategy||`round-robin`,isDisabled:z||!N,onChange:e=>{typeof e==`string`&&e&&Ae(e)},children:[(0,F.jsxs)(b.Trigger,{className:`items-center`,children:[(0,F.jsx)(b.Value,{className:`min-w-0 truncate`}),(0,F.jsx)(b.Indicator,{})]}),(0,F.jsx)(b.Popover,{children:(0,F.jsxs)(g,{children:[(0,F.jsxs)(g.Item,{id:`round-robin`,textValue:`round-robin`,children:[(0,F.jsx)(l,{children:e(`routingRoundRobin`)}),(0,F.jsx)(g.ItemIndicator,{})]}),(0,F.jsxs)(g.Item,{id:`weighted-round-robin`,textValue:`weighted-round-robin`,children:[(0,F.jsx)(l,{children:e(`routingWeightedRoundRobin`)}),(0,F.jsx)(g.ItemIndicator,{})]}),(0,F.jsxs)(g.Item,{id:`fill-first`,textValue:`fill-first`,children:[(0,F.jsx)(l,{children:e(`routingFillFirst`)}),(0,F.jsx)(g.ItemIndicator,{})]}),(0,F.jsxs)(g.Item,{id:`fefo`,textValue:`fefo`,children:[(0,F.jsx)(l,{children:e(`routingFEFO`)}),(0,F.jsx)(g.ItemIndicator,{})]}),(0,F.jsxs)(g.Item,{id:`least-quota-first`,textValue:`least-quota-first`,children:[(0,F.jsx)(l,{children:e(`routingLeastQuotaFirst`)}),(0,F.jsx)(g.ItemIndicator,{})]}),(0,F.jsxs)(g.Item,{id:`most-quota-first`,textValue:`most-quota-first`,children:[(0,F.jsx)(l,{children:e(`routingMostQuotaFirst`)}),(0,F.jsx)(g.ItemIndicator,{})]})]})})]})})}),(0,F.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2 pt-3 text-caption text-muted sm:grid-cols-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:N?.session_affinity?.ttl_seconds?`${Math.round(N.session_affinity.ttl_seconds/60)}m`:`—`}),e(`sessionAffinityTTL`)]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:N?.session_affinity?.hits??0}),e(`sessionAffinityHits`)]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:N?.session_affinity?.misses??0}),e(`sessionAffinityMisses`)]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`mono block text-body font-medium text-foreground`,children:N?.session_affinity?.escapes??0}),e(`sessionAffinityEscapes`)]})]}),N?.session_affinity?.last_escape_reason?(0,F.jsxs)(m,{className:`mt-3 text-caption`,children:[e(`lastSessionEscape`),`: `,N.session_affinity.last_escape_reason]}):null,N?.session_affinity?.last_miss_reason?(0,F.jsxs)(m,{className:`mt-1 text-caption`,children:[e(`lastSessionMiss`),`: `,N.session_affinity.last_miss_reason]}):null]}),(0,F.jsxs)(p,{"data-gsap-reveal":!0,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,F.jsx)(P,{size:15})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`crossProviderModelPoolTitle`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`crossProviderModelPoolHint`)})]})]}),(0,F.jsx)(x,{isSelected:N?.cross_provider_model_pool??!0,isDisabled:z||!N,ariaLabel:e(`crossProviderModelPoolAriaLabel`),onChange:e=>void De(e)})]}),(0,F.jsxs)(`div`,{className:`mt-4 flex items-center justify-between pt-3 text-caption text-muted`,children:[(0,F.jsx)(`span`,{children:e(`crossProviderModelPoolStatus`)}),(0,F.jsx)(`span`,{className:`font-medium text-foreground`,children:N?.cross_provider_model_pool?e(`enabled`):e(`disabled`)})]})]})]})}),(0,F.jsx)(y.Panel,{id:`security`,className:`pt-5`,children:(0,F.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-2 items-start`,children:[(0,F.jsxs)(p,{"data-gsap-reveal":!0,children:[(0,F.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,F.jsx)(ie,{size:15})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`consoleKeyTitle`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyHint`)})]})]})}),(0,F.jsx)(`code`,{className:`mono mt-4 block rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:j?.prefix||`—`}),(0,F.jsx)(`p`,{className:`mt-3 text-caption leading-5 text-muted`,children:e(`consoleKeyLead`)}),(0,F.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,F.jsx)(c,{size:`sm`,variant:`ghost`,isPending:V,onPress:()=>U(!0),children:e(`consoleKeyRotate`)})})]}),(0,F.jsxs)(p,{"data-gsap-reveal":!0,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`grid size-8 shrink-0 place-items-center rounded-lg bg-surface-secondary text-foreground`,children:(0,F.jsx)(me,{size:15})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`sqliteProtection`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`sqliteProtectionHint`)})]})]}),(0,F.jsx)(a,{size:18,className:`text-success`})]}),(0,F.jsx)(`div`,{className:`mono mt-4 rounded-lg bg-surface-secondary px-3 py-2 text-caption text-muted`,children:`/data`}),(0,F.jsxs)(`div`,{className:`mt-3 grid gap-2 text-caption text-muted`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(w,{size:14,className:`text-muted`}),e(`sqliteBackupBeforeUpdate`)]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(w,{size:14,className:`text-muted`}),e(`sqliteKeepFive`)]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(w,{size:14,className:`text-muted`}),e(`sqliteRollbackTogether`)]})]})]})]})}),(0,F.jsx)(y.Panel,{id:`updates`,className:`pt-5`,children:(0,F.jsx)(`div`,{className:`grid gap-5`,children:(0,F.jsxs)(p,{"data-gsap-reveal":!0,className:`overflow-hidden p-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`font-semibold`,children:e(`versionUpdate`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-caption text-muted`,children:e(`latestVersionHint`)})]}),(0,F.jsx)(T,{size:`sm`,variant:`soft`,color:X?.has_update?`warning`:`success`,children:X?.has_update?e(`updateAvailable`):e(`upToDate`)})]}),(0,F.jsxs)(`div`,{className:`px-5 py-5`,children:[(0,F.jsx)(ue,{update:Y}),(0,F.jsx)(he,{releases:Te,currentVersion:X?.current_version||``,nextVersion:X?.next_version,rollbackTags:Ee,canRollback:Ce,submitting:Z,onRestore:J})]})]})})})]}),(0,F.jsx)(f,{isOpen:!!q,title:e(`restoreVersionTitle`,{version:q}),description:e(`restoreVersionHint`),confirmLabel:e(`restoreThisVersion`),cancelLabel:e(`cancel`),closeLabel:e(`close`),isPending:Z,status:`warning`,confirmVariant:`primary`,onClose:()=>{Z||J(``)},onConfirm:()=>{let e=q;J(``),we(e)}}),(0,F.jsx)(_.Root,{isOpen:ve,onOpenChange:e=>{!e&&!V&&U(!1)},children:(0,F.jsx)(_.Backdrop,{variant:`blur`,isDismissable:!V,children:(0,F.jsx)(_.Container,{placement:`center`,size:`sm`,children:(0,F.jsxs)(_.Dialog,{children:[(0,F.jsxs)(_.Header,{className:`items-start justify-between gap-4`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(_.Heading,{className:`text-section font-semibold`,children:e(`consoleKeyRotate`)}),(0,F.jsx)(`p`,{className:`mt-1 text-caption leading-5 text-muted`,children:e(`consoleKeyRotateHint`)})]}),(0,F.jsx)(_.CloseTrigger,{isDisabled:V,"aria-label":e(`close`),className:`grid size-8 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,F.jsx)(E,{size:16})})]}),(0,F.jsxs)(_.Footer,{className:`justify-end`,children:[(0,F.jsx)(c,{variant:`ghost`,isDisabled:V,onPress:()=>U(!1),children:e(`cancel`)}),(0,F.jsx)(c,{variant:`danger`,isPending:V,onPress:()=>{H(!0),fe().then(e=>{M(e),G(e.secret||``),e.secret&&O(e.secret),U(!1)}).catch(e=>{$(e instanceof Error?e.message:String(e))}).finally(()=>H(!1))},children:e(`consoleKeyRotateNow`)})]})]})})})}),(0,F.jsx)(_.Root,{isOpen:!!W,onOpenChange:e=>{e||G(``)},children:(0,F.jsx)(_.Backdrop,{variant:`blur`,children:(0,F.jsx)(_.Container,{placement:`center`,size:`lg`,children:(0,F.jsxs)(_.Dialog,{children:[(0,F.jsxs)(_.Header,{className:`items-start justify-between gap-4 px-6 pt-6`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(_.Heading,{className:`text-section font-semibold`,children:e(`consoleKeySecretTitle`)}),(0,F.jsx)(`p`,{className:`mt-1.5 text-body leading-6 text-muted`,children:e(`consoleKeySecretHint`)})]}),(0,F.jsx)(_.CloseTrigger,{"aria-label":e(`close`),className:`grid size-9 place-items-center rounded-lg text-muted hover:bg-surface-secondary`,children:(0,F.jsx)(E,{size:18})})]}),(0,F.jsx)(_.Body,{className:`px-6 pb-2`,children:(0,F.jsx)(`code`,{className:`mono block break-all rounded-lg bg-surface-secondary px-3 py-3 text-body`,children:W})}),(0,F.jsxs)(_.Footer,{className:`justify-end`,children:[(0,F.jsx)(c,{variant:`ghost`,onPress:()=>G(``),children:e(`close`)}),(0,F.jsxs)(c,{onPress:()=>{i(W),K(!0),window.setTimeout(()=>K(!1),1200)},children:[(0,F.jsx)(r,{size:14}),e(ye?`copied`:`copy`)]})]})]})})})})]})}export{R as SystemPage}; \ No newline at end of file diff --git a/internal/webui/static/assets/TimeRangePicker-BqQpwy0D.js b/internal/webui/static/assets/TimeRangePicker-C8MnQbdC.js similarity index 99% rename from internal/webui/static/assets/TimeRangePicker-BqQpwy0D.js rename to internal/webui/static/assets/TimeRangePicker-C8MnQbdC.js index fd416b618..20ebdaf96 100644 --- a/internal/webui/static/assets/TimeRangePicker-BqQpwy0D.js +++ b/internal/webui/static/assets/TimeRangePicker-C8MnQbdC.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{A as r,D as i,E as a,H as o,I as s,O as c,Q as l,V as u,X as d,Z as f,a as p,j as m,k as h,ot as g,ut as _,w as v,z as y}from"./useI18n-XrvNxGvP.js";import{$ as b,A as x,B as S,Ct as C,F as w,G as T,I as E,J as D,L as O,M as k,N as A,Q as ee,R as te,Y as j,Z as ne,_t as M,a as re,c as N,ct as ie,d as P,dt as ae,f as oe,j as se,k as F,l as ce,lt as le,m as ue,o as de,q as I,s as L,tt as fe,u as pe,w as me,x as he,z as ge}from"./SharedElementTransition-BlCsXfb1.js";import{t as _e}from"./useUpdateEffect-DR9d7F-l.js";import{a as ve,c as ye,d as be,f as xe,l as Se,o as Ce,p as we,r as Te,s as Ee,t as De,u as Oe}from"./label-B8hTan2F.js";import{a as ke,i as Ae,n as je,r as Me,t as Ne}from"./Input-CyXcxaPW.js";import{n as Pe,r as Fe,t as Ie}from"./useSpinButton-B6uyFe9J.js";import{t as Le}from"./assertion-BLQtDfw6.js";import{M as Re}from"./overview-ARhe2pSk.js";import{Ct as ze,Et as Be,G as Ve,St as He,Tt as Ue,W as We,bt as Ge,st as Ke,wt as qe,xt as Je}from"./index-CAlyInAP.js";var R=t(e(),1);function Ye(e,t){let n=(0,R.useRef)(null);return e&&n.current&&t(e,n.current)&&(e=n.current),n.current=e,e}var Xe=ge({slots:{trigger:`calendar-year-picker__trigger`,triggerHeading:`calendar-year-picker__trigger-heading`,triggerIndicator:`calendar-year-picker__trigger-indicator`,yearCell:`calendar-year-picker__year-cell`,yearGrid:`calendar-year-picker__year-grid`}}),Ze=ge({defaultVariants:{},slots:{base:`range-calendar`,cell:`range-calendar__cell`,cellIndicator:`range-calendar__cell-indicator`,grid:`range-calendar__grid`,gridBody:`range-calendar__grid-body`,gridHeader:`range-calendar__grid-header`,gridRow:`range-calendar__grid-row`,header:`range-calendar__header`,headerCell:`range-calendar__header-cell`,heading:`range-calendar__heading`,navButton:`range-calendar__nav-button`,navButtonIcon:`range-calendar__nav-button-icon`},variants:{}}),Qe=ge({base:`date-field`,defaultVariants:{fullWidth:!1},variants:{fullWidth:{false:``,true:`date-field--full-width`}}}),$e=ge({slots:{base:`date-range-picker`,popover:`date-range-picker__popover`,rangeSeparator:`date-range-picker__range-separator`,trigger:`date-range-picker__trigger`,triggerIndicator:`date-range-picker__trigger-indicator`}}),et=ge({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`date-input-group`,input:`date-input-group__input`,inputContainer:`date-input-group__input-container`,prefix:`date-input-group__prefix`,segment:`date-input-group__segment`,suffix:`date-input-group__suffix`},variants:{fullWidth:{false:{},true:{base:`date-input-group--full-width`}},variant:{primary:{base:`date-input-group--primary`},secondary:{base:`date-input-group--secondary`}}}}),tt=ge({base:`time-field`,defaultVariants:{fullWidth:!1},variants:{fullWidth:{false:``,true:`time-field--full-width`}}});function nt(e){let t=Ke({usage:`search`,...e}),n=(0,R.useCallback)((e,n)=>n.length===0||(e=e.normalize(`NFC`),n=n.normalize(`NFC`),t.compare(e.slice(0,n.length),n)===0),[t]),r=(0,R.useCallback)((e,n)=>n.length===0||(e=e.normalize(`NFC`),n=n.normalize(`NFC`),t.compare(e.slice(-n.length),n)===0),[t]),i=(0,R.useCallback)((e,n)=>{if(n.length===0)return!0;e=e.normalize(`NFC`),n=n.normalize(`NFC`);let r=0,i=n.length;for(;r+i<=e.length;r++){let a=e.slice(r,r+i);if(t.compare(n,a)===0)return!0}return!1},[t]);return(0,R.useMemo)(()=>({startsWith:n,endsWith:r,contains:i}),[n,r,i])}function rt(e,t){return e-t*Math.floor(e/t)}var it=1721426;function at(e,t,n,r){t=st(e,t);let i=t-1,a=-2;return n<=2?a=0:ot(t)&&(a=-1),1721425+365*i+Math.floor(i/4)-Math.floor(i/100)+Math.floor(i/400)+Math.floor((367*n-362)/12+a+r)}function ot(e){return e%4==0&&(e%100!=0||e%400==0)}function st(e,t){return e===`BC`?1-t:t}function ct(e){let t=`AD`;return e<=0&&(t=`BC`,e=1-e),[t,e]}var lt={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]},z=class{fromJulianDay(e){let t=e,n=t-it,r=Math.floor(n/146097),i=rt(n,146097),a=Math.floor(i/36524),o=rt(i,36524),s=Math.floor(o/1461),c=rt(o,1461),l=Math.floor(c/365),[u,d]=ct(r*400+a*100+s*4+l+ +(a!==4&&l!==4)),f=t-at(u,d,1,1),p=2;t=0?e:t:e||t}function zt(e){return e=G(e,new z),Bt(st(e.era,e.year),e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Bt(e,t,n,r,i,a,o){let s=new Date;return s.setUTCHours(r,i,a,o),s.setUTCFullYear(e,t-1,n),s.getTime()}function Vt(e,t){if(t===`UTC`)return 0;if(e>0&&t===Tt()&&!Et())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:r,day:i,hour:a,minute:o,second:s}=Ut(e,t);return Bt(n,r,i,a,o,s,0)-Math.floor(e/1e3)*1e3}var Ht=new Map;function Ut(e,t){let n=Ht.get(t);n||(n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,hour12:!1,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}),Ht.set(t,n));let r=n.formatToParts(new Date(e)),i={};for(let e of r)e.type!==`literal`&&(i[e.type]=e.value);return{year:i.era===`BC`||i.era===`B`?-i.year+1:+i.year,month:+i.month,day:+i.day,hour:i.hour===`24`?0:+i.hour,minute:+i.minute,second:+i.second}}var Wt=864e5;function Gt(e,t,n,r){return(n===r?[n]:[n,r]).filter(n=>Kt(e,t,n))}function Kt(e,t,n){let r=Ut(n,t);return e.year===r.year&&e.month===r.month&&e.day===r.day&&e.hour===r.hour&&e.minute===r.minute&&e.second===r.second}function V(e,t,n=`compatible`){let r=W(e);if(t===`UTC`)return zt(r);if(t===Tt()&&n===`compatible`&&!Et()){r=G(r,new z);let e=new Date,t=st(r.era,r.year);return e.setFullYear(t,r.month-1,r.day),e.setHours(r.hour,r.minute,r.second,r.millisecond),e.getTime()}let i=zt(r),a=Vt(i-Wt,t),o=Vt(i+Wt,t),s=Gt(r,t,i-a,i-o);if(s.length===1)return s[0];if(s.length>1)switch(n){case`compatible`:case`earlier`:return s[0];case`later`:return s[s.length-1];case`reject`:throw RangeError(`Multiple possible absolute times found`)}switch(n){case`earlier`:return Math.min(i-a,i-o);case`compatible`:case`later`:return Math.max(i-a,i-o);case`reject`:throw RangeError(`No such absolute time found`)}}function qt(e,t,n=`compatible`){return new Date(V(e,t,n))}function H(e,t){let n=Vt(e,t),r=new Date(e+n),i=r.getUTCFullYear(),a=r.getUTCMonth()+1,o=r.getUTCDate(),s=r.getUTCHours(),c=r.getUTCMinutes(),l=r.getUTCSeconds(),u=r.getUTCMilliseconds();return new zn(i<1?`BC`:`AD`,i<1?-i+1:i,a,o,t,n,s,c,l,u)}function U(e){return new q(e.calendar,e.era,e.year,e.month,e.day)}function W(e,t){let n=0,r=0,i=0,a=0;if(`timeZone`in e)({hour:n,minute:r,second:i,millisecond:a}=e);else if(`hour`in e&&!t)return e;return t&&({hour:n,minute:r,second:i,millisecond:a}=t),new Rn(e.calendar,e.era,e.year,e.month,e.day,n,r,i,a)}function Jt(e){return new Ln(e.hour,e.minute,e.second,e.millisecond)}function G(e,t){if(mt(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),r=e.copy();return r.calendar=t,r.era=n.era,r.year=n.year,r.month=n.month,r.day=n.day,on(r),r}function Yt(e,t,n){return e instanceof zn?e.timeZone===t?e:Zt(e,t):H(V(e,t,n),t)}function Xt(e){let t=zt(e)-e.offset;return new Date(t)}function Zt(e,t){return G(H(zt(e)-e.offset,t),e.calendar)}function Qt(e){return Zt(e,Tt())}var $t=36e5;function en(e,t){let n=e.copy(),r=`hour`in n?mn(n,t):0;tn(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,nn(n),an(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=r,rn(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let i=n.calendar.getYearsInEra(n);if(n.year>i){let e=n.calendar.isInverseEra?.(n);n.year=i,n.month=e?1:n.calendar.getMonthsInYear(n),n.day=e?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let a=n.calendar.getMonthsInYear(n);return n.month>a&&(n.month=a,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function tn(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function nn(e){for(;e.month<1;)tn(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,tn(e,1)}function rn(e){for(;e.day<1;)e.month--,nn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,nn(e)}function an(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function on(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),an(e)}function sn(e){let t={};for(let n in e)typeof e[n]==`number`&&(t[n]=-e[n]);return t}function cn(e,t){return en(e,sn(t))}function ln(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),on(n),n}function un(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),fn(n),n}function dn(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=pn(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=pn(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=pn(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=pn(e.hour,24),t}function fn(e){e.millisecond=Math.max(0,Math.min(e.millisecond,999)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function pn(e,t){let n=e%t;return n<0&&(n+=t),n}function mn(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,dn(e)}function hn(e,t){let n=e.copy();return mn(n,t),n}function gn(e,t){return hn(e,sn(t))}function _n(e,t,n,r){let i=e.copy();switch(t){case`era`:{let t=e.calendar.getEras(),a=t.indexOf(e.era);if(a<0)throw Error(`Invalid era: `+e.era);a=yn(a,n,0,t.length-1,r?.round),i.era=t[a],on(i);break}case`year`:i.calendar.isInverseEra?.(i)&&(n=-n),i.year=yn(e.year,n,-1/0,9999,r?.round),i.year===-1/0&&(i.year=1),i.calendar.balanceYearMonth&&i.calendar.balanceYearMonth(i,e);break;case`month`:i.month=yn(e.month,n,1,e.calendar.getMonthsInYear(e),r?.round);break;case`day`:i.day=yn(e.day,n,1,e.calendar.getDaysInMonth(e),r?.round);break;default:throw Error(`Unsupported field `+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(i),on(i),i}function vn(e,t,n,r){let i=e.copy();switch(t){case`hour`:{let t=e.hour,a=0,o=23;if(r?.hourCycle===12){let e=t>=12;a=e?12:0,o=e?23:11}i.hour=yn(t,n,a,o,r?.round);break}case`minute`:i.minute=yn(e.minute,n,0,59,r?.round);break;case`second`:i.second=yn(e.second,n,0,59,r?.round);break;case`millisecond`:i.millisecond=yn(e.millisecond,n,0,999,r?.round);break;default:throw Error(`Unsupported field `+t)}return i}function yn(e,t,n,r,i=!1){if(i){e+=Math.sign(t),e0?Math.ceil(e/i)*i:Math.floor(e/i)*i,e>r&&(e=n)}else e+=t,er&&(e=n+(e-r-1));return e}function bn(e,t){let n;return n=t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0?V(en(W(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days}),e.timeZone):zt(e)-e.offset,n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5,G(H(n,e.timeZone),e.calendar)}function xn(e,t){return bn(e,sn(t))}function Sn(e,t,n,r){switch(t){case`hour`:{let t=0,i=23;if(r?.hourCycle===12){let n=e.hour>=12;t=n?12:0,i=n?23:11}let a=W(e),o=G(un(a,{hour:t}),new z),s=[V(o,e.timeZone,`earlier`),V(o,e.timeZone,`later`)].filter(t=>H(t,e.timeZone).day===o.day)[0],c=G(un(a,{hour:i}),new z),l=[V(c,e.timeZone,`earlier`),V(c,e.timeZone,`later`)].filter(t=>H(t,e.timeZone).day===c.day).pop(),u=zt(e)-e.offset,d=Math.floor(u/$t),f=u%$t;return u=yn(d,n,Math.floor(s/$t),Math.floor(l/$t),r?.round)*$t+f,G(H(u,e.timeZone),e.calendar)}case`minute`:case`second`:case`millisecond`:return vn(e,t,n,r);case`era`:case`year`:case`month`:case`day`:return G(H(V(_n(W(e),t,n,r),e.timeZone),e.timeZone),e.calendar);default:throw Error(`Unsupported field `+t)}}function Cn(e,t,n){let r=W(e),i=un(ln(r,t),t);return i.compare(r)===0?e:G(H(V(i,e.timeZone,n),e.timeZone),e.calendar)}var wn=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Tn=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/,En=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Dn(e){let t=e.match(wn);if(!t)throw En.test(e)?Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):Error(`Invalid ISO 8601 date string: `+e);let n=new q(K(t[1],0,9999),K(t[2],1,12),1);return n.day=K(t[3],1,n.calendar.getDaysInMonth(n)),n}function On(e){let t=e.match(Tn);if(!t)throw En.test(e)?Error(`Invalid ISO 8601 date time string: ${e}. Use parseAbsolute() instead.`):Error(`Invalid ISO 8601 date time string: `+e);let n=K(t[1],-9999,9999),r=new Rn(n<1?`BC`:`AD`,n<1?-n+1:n,K(t[2],1,12),1,t[4]?K(t[4],0,23):0,t[5]?K(t[5],0,59):0,t[6]?K(t[6],0,59):0,t[7]?K(t[7],0,1/0)*1e3:0);return r.day=K(t[3],0,r.calendar.getDaysInMonth(r)),r}function kn(e,t){let n=e.match(En);if(!n)throw Error(`Invalid ISO 8601 date time string: `+e);let r=K(n[1],-9999,9999),i=new zn(r<1?`BC`:`AD`,r<1?-r+1:r,K(n[2],1,12),1,t,0,n[4]?K(n[4],0,23):0,n[5]?K(n[5],0,59):0,n[6]?K(n[6],0,59):0,n[7]?K(n[7],0,1/0)*1e3:0);return i.day=K(n[3],0,i.calendar.getDaysInMonth(i)),n[8]&&(i.offset=K(n[8],-23,23)*36e5+K(n[9]??`0`,0,59)*6e4),Zt(i,t)}function An(e){return kn(e,Tt())}function K(e,t,n){let r=Number(e);if(rn)throw RangeError(`Value out of range: ${t} <= ${r} <= ${n}`);return r}function jn(e){return`${String(e.hour).padStart(2,`0`)}:${String(e.minute).padStart(2,`0`)}:${String(e.second).padStart(2,`0`)}${e.millisecond?String(e.millisecond/1e3).slice(1):``}`}function Mn(e){let t=G(e,new z),n;return n=t.era===`BC`?t.year===1?`0000`:`-`+String(Math.abs(1-t.year)).padStart(6,`00`):String(t.year).padStart(4,`0`),`${n}-${String(t.month).padStart(2,`0`)}-${String(t.day).padStart(2,`0`)}`}function Nn(e){return`${Mn(e)}T${jn(e)}`}function Pn(e){let t=Math.sign(e)<0?`-`:`+`;e=Math.abs(e);let n=Math.floor(e/36e5),r=Math.floor(e%36e5/6e4),i=Math.floor(e%36e5%6e4/1e3),a=`${t}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`;return i!==0&&(a+=`:${String(i).padStart(2,`0`)}`),a}function Fn(e){return`${Nn(e)}${Pn(e.offset)}[${e.timeZone}]`}function In(e){let t=typeof e[0]==`object`?e.shift():new z,n;if(typeof e[0]==`string`)n=e.shift();else{let e=t.getEras();n=e[e.length-1]}let r=e.shift(),i=e.shift(),a=e.shift();return[t,n,r,i,a]}var q=class e{constructor(...e){let[t,n,r,i,a]=In(e);this.calendar=t,this.era=n,this.year=r,this.month=i,this.day=a,on(this)}copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day):new e(this.calendar,this.year,this.month,this.day)}add(e){return en(this,e)}subtract(e){return cn(this,e)}set(e){return ln(this,e)}cycle(e,t,n){return _n(this,e,t,n)}toDate(e){return qt(this,e)}toString(){return Mn(this)}compare(e){return bt(this,e)}},Ln=class e{constructor(e=0,t=0,n=0,r=0){this.hour=e,this.minute=t,this.second=n,this.millisecond=r,fn(this)}copy(){return new e(this.hour,this.minute,this.second,this.millisecond)}add(e){return hn(this,e)}subtract(e){return gn(this,e)}set(e){return un(this,e)}cycle(e,t,n){return vn(this,e,t,n)}toString(){return jn(this)}compare(e){return xt(this,e)}},Rn=class e{constructor(...e){let[t,n,r,i,a]=In(e);this.calendar=t,this.era=n,this.year=r,this.month=i,this.day=a,this.hour=e.shift()||0,this.minute=e.shift()||0,this.second=e.shift()||0,this.millisecond=e.shift()||0,on(this)}copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new e(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(e){return en(this,e)}subtract(e){return cn(this,e)}set(e){return ln(un(this,e),e)}cycle(e,t,n){switch(e){case`era`:case`year`:case`month`:case`day`:return _n(this,e,t,n);default:return vn(this,e,t,n)}}toDate(e,t){return qt(this,e,t)}toString(){return Nn(this)}compare(e){let t=bt(this,e);return t===0?xt(this,W(e)):t}},zn=class e{constructor(...e){let[t,n,r,i,a]=In(e),o=e.shift(),s=e.shift();this.calendar=t,this.era=n,this.year=r,this.month=i,this.day=a,this.timeZone=o,this.offset=s,this.hour=e.shift()||0,this.minute=e.shift()||0,this.second=e.shift()||0,this.millisecond=e.shift()||0,on(this)}copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new e(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(e){return bn(this,e)}subtract(e){return xn(this,e)}set(e,t){return Cn(this,e,t)}cycle(e,t,n){return Sn(this,e,t,n)}toDate(){return Xt(this)}toString(){return Fn(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(e){return this.toDate().getTime()-Yt(e,this.timeZone).toDate().getTime()}},Bn=[[1868,9,8],[1912,7,30],[1926,12,25],[1989,1,8],[2019,5,1]],Vn=[[1912,7,29],[1926,12,24],[1989,1,7],[2019,4,30]],Hn=[1867,1911,1925,1988,2018],Un=[`meiji`,`taisho`,`showa`,`heisei`,`reiwa`];function Wn(e){let t=Bn.findIndex(([t,n,r])=>e.year=0){let[,n,r]=Bn[t];e.month=Math.max(n,e.month),e.month===n&&(e.day=Math.max(r,e.day))}}getEras(){return Un}getYearsInEra(e){let t=Un.indexOf(e.era),n=Bn[t],r=Bn[t+1];if(r==null)return 9999-n[0]+1;let i=r[0]-n[0];return(e.month0?[`minguo`,t]:[`before_minguo`,1-t]}var er=class extends z{fromJulianDay(e){let t=super.fromJulianDay(e),[n,r]=$n(st(t.era,t.year));return new q(this,n,r,t.month,t.day)}toJulianDay(e){return super.toJulianDay(tr(e))}getEras(){return[`before_minguo`,`minguo`]}balanceDate(e){let[t,n]=$n(Qn(e));e.era=t,e.year=n}isInverseEra(e){return e.era===`before_minguo`}getDaysInMonth(e){return super.getDaysInMonth(tr(e))}getYearsInEra(e){return e.era===`before_minguo`?9999:8088}constructor(...e){super(...e),this.identifier=`roc`}};function tr(e){let[t,n]=ct(Qn(e));return new q(t,n,e.month,e.day)}var nr=1948320,rr=[0,31,62,93,124,155,186,216,246,276,306,336],ir=class{fromJulianDay(e){let t=e-nr,n=1+Math.floor((33*t+3)/12053),r=t-(365*(n-1)+Math.floor((8*n+21)/33)),i=Math.floor(r<216?r/31:(r-6)/30),a=r-rr[i]+1;return new q(this,n,i+1,a)}toJulianDay(e){let t=1948319+365*(e.year-1)+Math.floor((8*e.year+21)/33);return t+=rr[e.month-1],t+=e.day,t}getMonthsInYear(){return 12}getDaysInMonth(e){return e.month<=6?31:e.month<=11||rt(25*e.year+11,33)<8?30:29}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getEras(){return[`AP`]}getYearsInEra(){return 9377}constructor(){this.identifier=`persian`}},ar=78,or=80,sr=class extends z{fromJulianDay(e){let t=super.fromJulianDay(e),n=t.year-ar,r=e-at(t.era,t.year,1,1),i;r=8&&(i+=(e.month-7)*30),i+=e.day-1,i)}getDaysInMonth(e){return e.month===1&&ot(e.year+ar)||e.month>=2&&e.month<=6?31:30}getYearsInEra(){return 9919}getEras(){return[`saka`]}balanceDate(){}constructor(...e){super(...e),this.identifier=`indian`}},cr=1948440,lr=1948439,J=1300,ur=1600,dr=460322;function fr(e,t,n,r){return r+Math.ceil(29.5*(n-1))+(t-1)*354+Math.floor((3+11*t)/30)+e-1}function pr(e,t,n){let r=Math.floor((30*(n-t)+10646)/10631),i=Math.min(12,Math.ceil((n-(29+fr(t,r,1,1)))/29.5)+1);return new q(e,r,i,n-fr(t,r,i,1)+1)}function mr(e){return(14+11*e)%30<11}var hr=class{fromJulianDay(e){return pr(this,cr,e)}toJulianDay(e){return fr(cr,e.year,e.month,e.day)}getDaysInMonth(e){let t=29+e.month%2;return e.month===12&&mr(e.year)&&t++,t}getMonthsInYear(){return 12}getDaysInYear(e){return mr(e.year)?355:354}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 30}getYearsInEra(){return 9665}getEras(){return[`AH`]}constructor(){this.identifier=`islamic-civil`}},gr=class extends hr{fromJulianDay(e){return pr(this,lr,e)}toJulianDay(e){return fr(lr,e.year,e.month,e.day)}constructor(...e){super(...e),this.identifier=`islamic-tbla`}},_r=`qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=`,vr,yr;function br(e){return dr+yr[e-J]}function xr(e,t){let n=e-J,r=1<<11-(t-1);return(vr[n]&r)===0?29:30}function Sr(e,t){let n=br(e);for(let r=1;re.charCodeAt(0)).buffer),!yr){yr=new Uint32Array(301);let e=0;for(let t=J;t<=ur;t++){yr[t-J]=e;for(let n=1;n<=12;n++)e+=xr(t,n)}}}fromJulianDay(e){let t=e-cr,n=br(J),r=br(ur);if(tr)return super.fromJulianDay(e);{let e=1299,n=1,r=1;for(;r>0;){e++,r=t-br(e)+1;let i=Cr(e);if(r===i){n=12;break}if(rt;)r-=t,n++,t=xr(e,n);break}}return new q(this,e,n,t-Sr(e,n)+1)}}toJulianDay(e){return e.yearur?super.toJulianDay(e):cr+Sr(e.year,e.month)+(e.day-1)}getDaysInMonth(e){return e.yearur?super.getDaysInMonth(e):xr(e.year,e.month)}getDaysInYear(e){return e.yearur?super.getDaysInYear(e):Cr(e.year)}},Tr=347997,Er=25920,Dr=765433;function Or(e){return rt(e*7+1,19)<7}function kr(e){let t=Math.floor((235*e-234)/19),n=12084+13753*t,r=t*29+Math.floor(n/25920);return rt(3*(r+1),7)<3&&(r+=1),r}function Ar(e){let t=kr(e-1),n=kr(e);return kr(e+1)-n===356?2:+(n-t===382)}function jr(e){return kr(e)+Ar(e)}function Mr(e){return jr(e+1)-jr(e)}function Nr(e){let t=Mr(e);switch(t>380&&(t-=30),t){case 353:return 0;case 354:return 1;case 355:return 2}}function Pr(e,t){if(t>=6&&!Or(e)&&t++,t===4||t===7||t===9||t===11||t===13)return 29;let n=Nr(e);return t===2?n===2?30:29:t===3?n===0?29:30:t===6?Or(e)?30:0:30}var Fr=class{fromJulianDay(e){let t=e-Tr,n=t*Er/Dr,r=Math.floor((19*n+234)/235)+1,i=jr(r),a=Math.floor(t-i);for(;a<1;)r--,i=jr(r),a=Math.floor(t-i);let o=1,s=0;for(;s6?e.month--:!Or(t.year)&&Or(e.year)&&t.month>6&&e.month++)}constructor(){this.identifier=`hebrew`}},Ir=1723856,Lr=1824665,Rr=5500;function zr(e,t,n,r){return e+365*t+Math.floor(t/4)+30*(n-1)+r-1}function Br(e,t){let n=Math.floor(4*(t-e)/1461),r=1+Math.floor((t-zr(e,n,1,1))/30);return[n,r,t+1-zr(e,n,r,1)]}function Vr(e){return Math.floor(e%4/3)}function Hr(e,t){return t%13==0?Vr(e)+5:30}var Ur=class{fromJulianDay(e){let[t,n,r]=Br(Ir,e),i=`AM`;return t<=0&&(i=`AA`,t+=Rr),new q(this,i,t,n,r)}toJulianDay(e){let t=e.year;return e.era===`AA`&&(t-=Rr),zr(Ir,t,e.month,e.day)}getDaysInMonth(e){return Hr(e.year,e.month)}getMonthsInYear(){return 13}getDaysInYear(e){return 365+Vr(e.year)}getMaximumMonthsInYear(){return 13}getMaximumDaysInMonth(){return 30}getYearsInEra(e){return e.era===`AA`?9999:9991}getEras(){return[`AA`,`AM`]}constructor(){this.identifier=`ethiopic`}},Wr=class extends Ur{fromJulianDay(e){let[t,n,r]=Br(Ir,e);return t+=Rr,new q(this,`AA`,t,n,r)}getEras(){return[`AA`]}getYearsInEra(){return 9999}constructor(...e){super(...e),this.identifier=`ethioaa`}},Gr=class extends Ur{fromJulianDay(e){let[t,n,r]=Br(Lr,e),i=`CE`;return t<=0&&(i=`BCE`,t=1-t),new q(this,i,t,n,r)}toJulianDay(e){let t=e.year;return e.era===`BCE`&&(t=1-t),zr(Lr,t,e.month,e.day)}getDaysInMonth(e){let t=e.year;return e.era===`BCE`&&(t=1-t),Hr(t,e.month)}isInverseEra(e){return e.era===`BCE`}balanceDate(e){e.year<=0&&(e.era=e.era===`BCE`?`CE`:`BCE`,e.year=1-e.year)}getEras(){return[`BCE`,`CE`]}getYearsInEra(e){return e.era===`BCE`?9999:9715}constructor(...e){super(...e),this.identifier=`coptic`}};function Kr(e){switch(e){case`buddhist`:return new Yn;case`ethiopic`:return new Ur;case`ethioaa`:return new Wr;case`coptic`:return new Gr;case`hebrew`:return new Fr;case`indian`:return new sr;case`islamic-civil`:return new hr;case`islamic-tbla`:return new gr;case`islamic-umalqura`:return new wr;case`japanese`:return new Kn;case`persian`:return new ir;case`roc`:return new er;default:return new z}}var qr=new Map,Y=class{constructor(e,t={}){this.formatter=Yr(e,t),this.options=t}format(e){return this.formatter.format(e)}formatToParts(e){return this.formatter.formatToParts(e)}formatRange(e,t){if(typeof this.formatter.formatRange==`function`)return this.formatter.formatRange(e,t);if(t= start date`);return`${this.formatter.format(e)} \u{2013} ${this.formatter.format(t)}`}formatRangeToParts(e,t){if(typeof this.formatter.formatRangeToParts==`function`)return this.formatter.formatRangeToParts(e,t);if(t= start date`);let n=this.formatter.formatToParts(e),r=this.formatter.formatToParts(t);return[...n.map(e=>({...e,source:`startRange`})),{type:`literal`,value:` – `,source:`shared`},...r.map(e=>({...e,source:`endRange`}))]}resolvedOptions(){let e=this.formatter.resolvedOptions();return $r()&&(this.resolvedHourCycle||=ei(e.locale,this.options),e.hourCycle=this.resolvedHourCycle,e.hour12=this.resolvedHourCycle===`h11`||this.resolvedHourCycle===`h12`),e.calendar===`ethiopic-amete-alem`&&(e.calendar=`ethioaa`),e}},Jr={true:{ja:`h11`},false:{}};function Yr(e,t={}){if(typeof t.hour12==`boolean`&&Zr()){t={...t};let n=Jr[String(t.hour12)][e.split(`-`)[0]],r=t.hour12?`h12`:`h23`;t.hourCycle=n??r,delete t.hour12}let n=e+(t?Object.entries(t).sort((e,t)=>e[0]e.type===`hour`).value,10),i=parseInt(n.formatToParts(new Date(2020,2,3,23)).find(e=>e.type===`hour`).value,10);if(r===0&&i===23)return`h23`;if(r===24&&i===23)return`h24`;if(r===0&&i===11)return`h11`;if(r===12&&i===11)return`h12`;throw Error(`Unexpected hour cycle result`)}var X=n(),ti=[`day`,`month`,`year`],ni={hour:1,minute:2,second:3};function ri(e,t){let{autoComplete:n,isDisabled:r,name:a}=e,{visuallyHiddenProps:o}=i({style:{position:`fixed`,top:0,left:0}}),s=60;t.granularity===`second`?s=1:t.granularity===`hour`&&(s=3600);let c=``;t.value&&(c=t.granularity===`day`?U(t.value).toString():W(`timeZone`in t.value?Qt(t.value):t.value).toString());let l=t.granularity===`day`?`date`:`datetime-local`,u=[`hour`,`minute`,`second`],d=0;return u.includes(t.granularity)&&(d=ni[t.granularity],u=u.slice(0,d)),{containerProps:{...o,"aria-hidden":!0,"data-react-aria-prevent-focus":!0,"data-a11y-ignore":`aria-hidden-focus`},inputProps:{tabIndex:-1,autoComplete:n,disabled:r,type:l,form:``,name:a,step:s,value:c,onChange:e=>{let n=fe(e).value.toString();if(n)try{let e=On(n);if(t.granularity===`day`&&(e=Dn(n)),`setSegment`in t)for(let n in e)ti.includes(n)&&t.setSegment(n,e[n]),u.includes(n)&&t.setSegment(n,e[n]);t.setValue(e)}catch{}}}}}function ii(e){let{state:t}=e,{containerProps:n,inputProps:r}=ri({...e},t);return R.createElement(`div`,{...n,"data-testid":`hidden-dateinput-container`},R.createElement(`input`,r))}var ai={};ai={calendar:`التقويم`,day:`يوم`,dayPeriod:`ص/م`,endDate:`تاريخ الانتهاء`,era:`العصر`,hour:`الساعات`,minute:`الدقائق`,month:`الشهر`,second:`الثواني`,selectedDateDescription:e=>`\u{62A}\u{627}\u{631}\u{64A}\u{62E} \u{645}\u{62D}\u{62F}\u{62F}: ${e.date}`,selectedRangeDescription:e=>`\u{627}\u{644}\u{645}\u{62F}\u{649} \u{627}\u{644}\u{632}\u{645}\u{646}\u{64A} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}: ${e.startDate} \u{625}\u{644}\u{649} ${e.endDate}`,selectedTimeDescription:e=>`\u{627}\u{644}\u{648}\u{642}\u{62A} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}: ${e.time}`,startDate:`تاريخ البدء`,timeZoneName:`التوقيت`,weekday:`اليوم`,year:`السنة`};var oi={};oi={calendar:`Календар`,day:`ден`,dayPeriod:`пр.об./сл.об.`,endDate:`Крайна дата`,era:`ера`,hour:`час`,minute:`минута`,month:`месец`,second:`секунда`,selectedDateDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.startDate} \u{434}\u{43E} ${e.endDate}`,selectedTimeDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{43E} \u{432}\u{440}\u{435}\u{43C}\u{435}: ${e.time}`,startDate:`Начална дата`,timeZoneName:`часова зона`,weekday:`ден от седмицата`,year:`година`};var si={};si={calendar:`Kalendář`,day:`den`,dayPeriod:`část dne`,endDate:`Konečné datum`,era:`letopočet`,hour:`hodina`,minute:`minuta`,month:`měsíc`,second:`sekunda`,selectedDateDescription:e=>`Vybran\xe9 datum: ${e.date}`,selectedRangeDescription:e=>`Vybran\xe9 obdob\xed: ${e.startDate} a\u{17E} ${e.endDate}`,selectedTimeDescription:e=>`Vybran\xfd \u{10D}as: ${e.time}`,startDate:`Počáteční datum`,timeZoneName:`časové pásmo`,weekday:`den v týdnu`,year:`rok`};var ci={};ci={calendar:`Kalender`,day:`dag`,dayPeriod:`AM/PM`,endDate:`Slutdato`,era:`æra`,hour:`time`,minute:`minut`,month:`måned`,second:`sekund`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt interval: ${e.startDate} til ${e.endDate}`,selectedTimeDescription:e=>`Valgt tidspunkt: ${e.time}`,startDate:`Startdato`,timeZoneName:`tidszone`,weekday:`ugedag`,year:`år`};var li={};li={calendar:`Kalender`,day:`Tag`,dayPeriod:`Tageshälfte`,endDate:`Enddatum`,era:`Epoche`,hour:`Stunde`,minute:`Minute`,month:`Monat`,second:`Sekunde`,selectedDateDescription:e=>`Ausgew\xe4hltes Datum: ${e.date}`,selectedRangeDescription:e=>`Ausgew\xe4hlter Bereich: ${e.startDate} bis ${e.endDate}`,selectedTimeDescription:e=>`Ausgew\xe4hlte Zeit: ${e.time}`,startDate:`Startdatum`,timeZoneName:`Zeitzone`,weekday:`Wochentag`,year:`Jahr`};var ui={};ui={calendar:`Ημερολόγιο`,day:`ημέρα`,dayPeriod:`π.μ./μ.μ.`,endDate:`Ημερομηνία λήξης`,era:`περίοδος`,hour:`ώρα`,minute:`λεπτό`,month:`μήνας`,second:`δευτερόλεπτο`,selectedDateDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3B7} \u{3B7}\u{3BC}\u{3B5}\u{3C1}\u{3BF}\u{3BC}\u{3B7}\u{3BD}\u{3AF}\u{3B1}: ${e.date}`,selectedRangeDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3BF} \u{3B5}\u{3CD}\u{3C1}\u{3BF}\u{3C2}: ${e.startDate} \u{3AD}\u{3C9}\u{3C2} ${e.endDate}`,selectedTimeDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3B7} \u{3CE}\u{3C1}\u{3B1}: ${e.time}`,startDate:`Ημερομηνία έναρξης`,timeZoneName:`ζώνη ώρας`,weekday:`καθημερινή`,year:`έτος`};var di={};di={era:`era`,year:`year`,month:`month`,day:`day`,hour:`hour`,minute:`minute`,second:`second`,dayPeriod:`AM/PM`,calendar:`Calendar`,startDate:`Start Date`,endDate:`End Date`,weekday:`day of the week`,timeZoneName:`time zone`,selectedDateDescription:e=>`Selected Date: ${e.date}`,selectedRangeDescription:e=>`Selected Range: ${e.startDate} to ${e.endDate}`,selectedTimeDescription:e=>`Selected Time: ${e.time}`};var fi={};fi={calendar:`Calendario`,day:`día`,dayPeriod:`a.\xA0m./p.\xA0m.`,endDate:`Fecha final`,era:`era`,hour:`hora`,minute:`minuto`,month:`mes`,second:`segundo`,selectedDateDescription:e=>`Fecha seleccionada: ${e.date}`,selectedRangeDescription:e=>`Rango seleccionado: ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Hora seleccionada: ${e.time}`,startDate:`Fecha de inicio`,timeZoneName:`zona horaria`,weekday:`día de la semana`,year:`año`};var pi={};pi={calendar:`Kalender`,day:`päev`,dayPeriod:`enne/pärast lõunat`,endDate:`Lõppkuupäev`,era:`ajastu`,hour:`tund`,minute:`minut`,month:`kuu`,second:`sekund`,selectedDateDescription:e=>`Valitud kuup\xe4ev: ${e.date}`,selectedRangeDescription:e=>`Valitud vahemik: ${e.startDate} kuni ${e.endDate}`,selectedTimeDescription:e=>`Valitud aeg: ${e.time}`,startDate:`Alguskuupäev`,timeZoneName:`ajavöönd`,weekday:`nädalapäev`,year:`aasta`};var mi={};mi={calendar:`Kalenteri`,day:`päivä`,dayPeriod:`vuorokaudenaika`,endDate:`Päättymispäivä`,era:`aikakausi`,hour:`tunti`,minute:`minuutti`,month:`kuukausi`,second:`sekunti`,selectedDateDescription:e=>`Valittu p\xe4iv\xe4m\xe4\xe4r\xe4: ${e.date}`,selectedRangeDescription:e=>`Valittu aikav\xe4li: ${e.startDate} \u{2013} ${e.endDate}`,selectedTimeDescription:e=>`Valittu aika: ${e.time}`,startDate:`Alkamispäivä`,timeZoneName:`aikavyöhyke`,weekday:`viikonpäivä`,year:`vuosi`};var hi={};hi={calendar:`Calendrier`,day:`jour`,dayPeriod:`cadran`,endDate:`Date de fin`,era:`ère`,hour:`heure`,minute:`minute`,month:`mois`,second:`seconde`,selectedDateDescription:e=>`Date s\xe9lectionn\xe9e\xa0: ${e.date}`,selectedRangeDescription:e=>`Plage s\xe9lectionn\xe9e\xa0: ${e.startDate} au ${e.endDate}`,selectedTimeDescription:e=>`Heure choisie\xa0: ${e.time}`,startDate:`Date de début`,timeZoneName:`fuseau horaire`,weekday:`jour de la semaine`,year:`année`};var gi={};gi={calendar:`לוח שנה`,day:`יום`,dayPeriod:`לפנה״צ/אחה״צ`,endDate:`תאריך סיום`,era:`תקופה`,hour:`שעה`,minute:`דקה`,month:`חודש`,second:`שנייה`,selectedDateDescription:e=>`\u{5EA}\u{5D0}\u{5E8}\u{5D9}\u{5DA} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.date}`,selectedRangeDescription:e=>`\u{5D8}\u{5D5}\u{5D5}\u{5D7} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.startDate} \u{5E2}\u{5D3} ${e.endDate}`,selectedTimeDescription:e=>`\u{5D6}\u{5DE}\u{5DF} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.time}`,startDate:`תאריך התחלה`,timeZoneName:`אזור זמן`,weekday:`יום בשבוע`,year:`שנה`};var _i={};_i={calendar:`Kalendar`,day:`dan`,dayPeriod:`AM/PM`,endDate:`Datum završetka`,era:`era`,hour:`sat`,minute:`minuta`,month:`mjesec`,second:`sekunda`,selectedDateDescription:e=>`Odabrani datum: ${e.date}`,selectedRangeDescription:e=>`Odabrani raspon: ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Odabrano vrijeme: ${e.time}`,startDate:`Datum početka`,timeZoneName:`vremenska zona`,weekday:`dan u tjednu`,year:`godina`};var vi={};vi={calendar:`Naptár`,day:`nap`,dayPeriod:`napszak`,endDate:`Befejező dátum`,era:`éra`,hour:`óra`,minute:`perc`,month:`hónap`,second:`másodperc`,selectedDateDescription:e=>`Kijel\xf6lt d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Kijel\xf6lt tartom\xe1ny: ${e.startDate}\u{2013}${e.endDate}`,selectedTimeDescription:e=>`Kijel\xf6lt id\u{151}: ${e.time}`,startDate:`Kezdő dátum`,timeZoneName:`időzóna`,weekday:`hét napja`,year:`év`};var yi={};yi={calendar:`Calendario`,day:`giorno`,dayPeriod:`AM/PM`,endDate:`Data finale`,era:`era`,hour:`ora`,minute:`minuto`,month:`mese`,second:`secondo`,selectedDateDescription:e=>`Data selezionata: ${e.date}`,selectedRangeDescription:e=>`Intervallo selezionato: da ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Ora selezionata: ${e.time}`,startDate:`Data iniziale`,timeZoneName:`fuso orario`,weekday:`giorno della settimana`,year:`anno`};var bi={};bi={calendar:`カレンダー`,day:`日`,dayPeriod:`午前/午後`,endDate:`終了日`,era:`時代`,hour:`時`,minute:`分`,month:`月`,second:`秒`,selectedDateDescription:e=>`\u{9078}\u{629E}\u{3057}\u{305F}\u{65E5}\u{4ED8} : ${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{629E}\u{7BC4}\u{56F2} : ${e.startDate} \u{304B}\u{3089} ${e.endDate}`,selectedTimeDescription:e=>`\u{9078}\u{629E}\u{3057}\u{305F}\u{6642}\u{9593} : ${e.time}`,startDate:`開始日`,timeZoneName:`タイムゾーン`,weekday:`曜日`,year:`年`};var xi={};xi={calendar:`달력`,day:`일`,dayPeriod:`오전/오후`,endDate:`종료일`,era:`연호`,hour:`시`,minute:`분`,month:`월`,second:`초`,selectedDateDescription:e=>`\u{C120}\u{D0DD} \u{C77C}\u{C790}: ${e.date}`,selectedRangeDescription:e=>`\u{C120}\u{D0DD} \u{BC94}\u{C704}: ${e.startDate} ~ ${e.endDate}`,selectedTimeDescription:e=>`\u{C120}\u{D0DD} \u{C2DC}\u{AC04}: ${e.time}`,startDate:`시작일`,timeZoneName:`시간대`,weekday:`요일`,year:`년`};var Si={};Si={calendar:`Kalendorius`,day:`diena`,dayPeriod:`iki pietų / po pietų`,endDate:`Pabaigos data`,era:`era`,hour:`valanda`,minute:`minutė`,month:`mėnuo`,second:`sekundė`,selectedDateDescription:e=>`Pasirinkta data: ${e.date}`,selectedRangeDescription:e=>`Pasirinktas intervalas: nuo ${e.startDate} iki ${e.endDate}`,selectedTimeDescription:e=>`Pasirinktas laikas: ${e.time}`,startDate:`Pradžios data`,timeZoneName:`laiko juosta`,weekday:`savaitės diena`,year:`metai`};var Ci={};Ci={calendar:`Kalendārs`,day:`diena`,dayPeriod:`priekšpusdienā/pēcpusdienā`,endDate:`Beigu datums`,era:`ēra`,hour:`stundas`,minute:`minūtes`,month:`mēnesis`,second:`sekundes`,selectedDateDescription:e=>`Atlas\u{12B}tais datums: ${e.date}`,selectedRangeDescription:e=>`Atlas\u{12B}tais diapazons: no ${e.startDate} l\u{12B}dz ${e.endDate}`,selectedTimeDescription:e=>`Atlas\u{12B}tais laiks: ${e.time}`,startDate:`Sākuma datums`,timeZoneName:`laika josla`,weekday:`nedēļas diena`,year:`gads`};var wi={};wi={calendar:`Kalender`,day:`dag`,dayPeriod:`a.m./p.m.`,endDate:`Sluttdato`,era:`tidsalder`,hour:`time`,minute:`minutt`,month:`måned`,second:`sekund`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt omr\xe5de: ${e.startDate} til ${e.endDate}`,selectedTimeDescription:e=>`Valgt tid: ${e.time}`,startDate:`Startdato`,timeZoneName:`tidssone`,weekday:`ukedag`,year:`år`};var Ti={};Ti={calendar:`Kalender`,day:`dag`,dayPeriod:`a.m./p.m.`,endDate:`Einddatum`,era:`tijdperk`,hour:`uur`,minute:`minuut`,month:`maand`,second:`seconde`,selectedDateDescription:e=>`Geselecteerde datum: ${e.date}`,selectedRangeDescription:e=>`Geselecteerd bereik: ${e.startDate} tot ${e.endDate}`,selectedTimeDescription:e=>`Geselecteerde tijd: ${e.time}`,startDate:`Startdatum`,timeZoneName:`tijdzone`,weekday:`dag van de week`,year:`jaar`};var Ei={};Ei={calendar:`Kalendarz`,day:`dzień`,dayPeriod:`rano / po południu / wieczorem`,endDate:`Data końcowa`,era:`era`,hour:`godzina`,minute:`minuta`,month:`miesiąc`,second:`sekunda`,selectedDateDescription:e=>`Wybrana data: ${e.date}`,selectedRangeDescription:e=>`Wybrany zakres: ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Wybrany czas: ${e.time}`,startDate:`Data początkowa`,timeZoneName:`strefa czasowa`,weekday:`dzień tygodnia`,year:`rok`};var Di={};Di={calendar:`Calendário`,day:`dia`,dayPeriod:`AM/PM`,endDate:`Data final`,era:`era`,hour:`hora`,minute:`minuto`,month:`mês`,second:`segundo`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Hora selecionada: ${e.time}`,startDate:`Data inicial`,timeZoneName:`fuso horário`,weekday:`dia da semana`,year:`ano`};var Oi={};Oi={calendar:`Calendário`,day:`dia`,dayPeriod:`am/pm`,endDate:`Data de Término`,era:`era`,hour:`hora`,minute:`minuto`,month:`mês`,second:`segundo`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Hora selecionada: ${e.time}`,startDate:`Data de Início`,timeZoneName:`fuso horário`,weekday:`dia da semana`,year:`ano`};var ki={};ki={calendar:`Calendar`,day:`zi`,dayPeriod:`a.m/p.m.`,endDate:`Dată final`,era:`eră`,hour:`oră`,minute:`minut`,month:`lună`,second:`secundă`,selectedDateDescription:e=>`Dat\u{103} selectat\u{103}: ${e.date}`,selectedRangeDescription:e=>`Interval selectat: de la ${e.startDate} p\xe2n\u{103} la ${e.endDate}`,selectedTimeDescription:e=>`Ora selectat\u{103}: ${e.time}`,startDate:`Dată început`,timeZoneName:`fus orar`,weekday:`ziua din săptămână`,year:`an`};var Ai={};Ai={calendar:`Календарь`,day:`день`,dayPeriod:`AM/PM`,endDate:`Дата окончания`,era:`эра`,hour:`час`,minute:`минута`,month:`месяц`,second:`секунда`,selectedDateDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{430}\u{44F} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{44B}\u{439} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: \u{441} ${e.startDate} \u{43F}\u{43E} ${e.endDate}`,selectedTimeDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{43E}\u{435} \u{432}\u{440}\u{435}\u{43C}\u{44F}: ${e.time}`,startDate:`Дата начала`,timeZoneName:`часовой пояс`,weekday:`день недели`,year:`год`};var ji={};ji={calendar:`Kalendár`,day:`deň`,dayPeriod:`AM/PM`,endDate:`Dátum ukončenia`,era:`letopočet`,hour:`hodina`,minute:`minúta`,month:`mesiac`,second:`sekunda`,selectedDateDescription:e=>`Vybrat\xfd d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Vybrat\xfd rozsah: od ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Vybrat\xfd \u{10D}as: ${e.time}`,startDate:`Dátum začatia`,timeZoneName:`časové pásmo`,weekday:`deň týždňa`,year:`rok`};var Mi={};Mi={calendar:`Koledar`,day:`dan`,dayPeriod:`dop/pop`,endDate:`Datum konca`,era:`doba`,hour:`ura`,minute:`minuta`,month:`mesec`,second:`sekunda`,selectedDateDescription:e=>`Izbrani datum: ${e.date}`,selectedRangeDescription:e=>`Izbrano obmo\u{10D}je: ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Izbrani \u{10D}as: ${e.time}`,startDate:`Datum začetka`,timeZoneName:`časovni pas`,weekday:`dan v tednu`,year:`leto`};var Ni={};Ni={calendar:`Kalendar`,day:`дан`,dayPeriod:`пре подне/по подне`,endDate:`Datum završetka`,era:`ера`,hour:`сат`,minute:`минут`,month:`месец`,second:`секунд`,selectedDateDescription:e=>`Izabrani datum: ${e.date}`,selectedRangeDescription:e=>`Izabrani opseg: od ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Izabrano vreme: ${e.time}`,startDate:`Datum početka`,timeZoneName:`временска зона`,weekday:`дан у недељи`,year:`година`};var Pi={};Pi={calendar:`Kalender`,day:`dag`,dayPeriod:`fm/em`,endDate:`Slutdatum`,era:`era`,hour:`timme`,minute:`minut`,month:`månad`,second:`sekund`,selectedDateDescription:e=>`Valt datum: ${e.date}`,selectedRangeDescription:e=>`Valt intervall: ${e.startDate} till ${e.endDate}`,selectedTimeDescription:e=>`Vald tid: ${e.time}`,startDate:`Startdatum`,timeZoneName:`tidszon`,weekday:`veckodag`,year:`år`};var Fi={};Fi={calendar:`Takvim`,day:`gün`,dayPeriod:`ÖÖ/ÖS`,endDate:`Bitiş Tarihi`,era:`çağ`,hour:`saat`,minute:`dakika`,month:`ay`,second:`saniye`,selectedDateDescription:e=>`Se\xe7ilen Tarih: ${e.date}`,selectedRangeDescription:e=>`Se\xe7ilen Aral\u{131}k: ${e.startDate} - ${e.endDate}`,selectedTimeDescription:e=>`Se\xe7ilen Zaman: ${e.time}`,startDate:`Başlangıç Tarihi`,timeZoneName:`saat dilimi`,weekday:`haftanın günü`,year:`yıl`};var Ii={};Ii={calendar:`Календар`,day:`день`,dayPeriod:`дп/пп`,endDate:`Дата завершення`,era:`ера`,hour:`година`,minute:`хвилина`,month:`місяць`,second:`секунда`,selectedDateDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{438}\u{439} \u{434}\u{456}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.startDate} \u{2014} ${e.endDate}`,selectedTimeDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{438}\u{439} \u{447}\u{430}\u{441}: ${e.time}`,startDate:`Дата початку`,timeZoneName:`часовий пояс`,weekday:`день тижня`,year:`рік`};var Li={};Li={calendar:`日历`,day:`日`,dayPeriod:`上午/下午`,endDate:`结束日期`,era:`纪元`,hour:`小时`,minute:`分钟`,month:`月`,second:`秒`,selectedDateDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{8303}\u{56F4}\u{FF1A}${e.startDate} \u{81F3} ${e.endDate}`,selectedTimeDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{65F6}\u{95F4}\u{FF1A}${e.time}`,startDate:`开始日期`,timeZoneName:`时区`,weekday:`工作日`,year:`年`};var Ri={};Ri={calendar:`日曆`,day:`日`,dayPeriod:`上午/下午`,endDate:`結束日期`,era:`纪元`,hour:`小时`,minute:`分钟`,month:`月`,second:`秒`,selectedDateDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{7BC4}\u{570D}\u{FF1A}${e.startDate} \u{81F3} ${e.endDate}`,selectedTimeDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{6642}\u{9593}\u{FF1A}${e.time}`,startDate:`開始日期`,timeZoneName:`时区`,weekday:`工作日`,year:`年`};var zi={};zi={"ar-AE":ai,"bg-BG":oi,"cs-CZ":si,"da-DK":ci,"de-DE":li,"el-GR":ui,"en-US":di,"es-ES":fi,"et-EE":pi,"fi-FI":mi,"fr-FR":hi,"he-IL":gi,"hr-HR":_i,"hu-HU":vi,"it-IT":yi,"ja-JP":bi,"ko-KR":xi,"lt-LT":Si,"lv-LV":Ci,"nb-NO":wi,"nl-NL":Ti,"pl-PL":Ei,"pt-BR":Di,"pt-PT":Oi,"ro-RO":ki,"ru-RU":Ai,"sk-SK":ji,"sl-SI":Mi,"sr-SP":Ni,"sv-SE":Pi,"tr-TR":Fi,"uk-UA":Ii,"zh-CN":Li,"zh-TW":Ri};function Bi(e,t,n){let{direction:r}=F(),i=(0,R.useMemo)(()=>de(t),[t]),{keyboardProps:a}=he({shortcuts:{"Alt+ArrowDown":()=>{if(`setOpen`in e){e.setOpen(!0);return}return!1},"Alt+ArrowUp":()=>{if(`setOpen`in e){e.setOpen(!0);return}return!1},ArrowLeft:e=>{if(n)return!1;if(r===`rtl`){if(t.current){let n=fe(e),r=Vi(t.current,n.getBoundingClientRect().left,-1);if(r){r.focus();return}}}else{i.focusPrevious();return}return!1},ArrowRight:e=>{if(n)return!1;if(r===`rtl`){if(t.current){let n=fe(e),r=Vi(t.current,n.getBoundingClientRect().left,1);if(r){r.focus();return}}}else{i.focusNext();return}return!1}},allowRepeats:!0}),o=()=>{if(!t.current)return;let e=window.event?fe(window.event):null,n=re(t.current,{tabbable:!0});if(e&&=(n.currentNode=e,n.previousNode()),!e){let t;do t=n.lastChild(),t&&(e=t);while(t)}for(;e?.hasAttribute(`data-placeholder`);){let t=n.previousNode();if(t&&t.hasAttribute(`data-placeholder`))e=t;else break}e&&e.focus()},{pressProps:s}=ue({preventFocusOnPress:!0,allowTextSelectionOnPress:!0,onPressStart(e){e.pointerType===`mouse`&&o()},onPress(e){(e.pointerType===`touch`||e.pointerType===`pen`)&&o()}});return D(s,a)}function Vi(e,t,n){let r=re(e,{tabbable:!0}),i=r.nextNode(),a=null,o=1/0;for(;i;){let e=i.getBoundingClientRect().left-t,s=Math.abs(e);Math.sign(e)===n&&s{t.confirmPlaceholder(),t.value!==u.current&&t.commitValidation(),e.onBlur?.(n)},onFocusWithinChange:e.onFocusChange}),f=h(Hi(zi),`@react-aria/datepicker`),p=t.maxGranularity===`hour`?`selectedTimeDescription`:`selectedDateDescription`,m=t.maxGranularity===`hour`?`time`:`date`,g=t.value?f.format(p,{[m]:t.formatValue({month:`long`})}):``,_=Ue(g),v=e.__reactAriaDateFieldRole===`presentation`?s[`aria-describedby`]:[_[`aria-describedby`],s[`aria-describedby`]].filter(Boolean).join(` `)||void 0,y=e[Gi],b=(0,R.useMemo)(()=>y||de(n),[y,n]),x=Bi(t,n,e[Wi]===`presentation`);Ui.set(t,{ariaLabel:e[`aria-label`],ariaLabelledBy:[o.id,e[`aria-labelledby`]].filter(Boolean).join(` `)||void 0,ariaDescribedBy:v,focusManager:b});let S=(0,R.useRef)(e.autoFocus),C;C=e.__reactAriaDateFieldRole===`presentation`?{role:`presentation`}:D(s,{role:`group`,"aria-disabled":e.isDisabled||void 0,"aria-describedby":v}),(0,R.useEffect)(()=>{S.current&&b.focusFirst(),S.current=!1},[b]),we(e.inputRef,t.defaultValue,t.setValue),Te({...e,focus(){b.focusFirst()}},t,e.inputRef);let w={type:`hidden`,name:e.name,form:e.form,value:t.value?.toString()||``,disabled:e.isDisabled};e.validationBehavior===`native`&&(w.type=`text`,w.hidden=!0,w.required=e.isRequired,w.onChange=()=>{});let T=I(e);return{labelProps:{...o,onClick:()=>{b.focusFirst()}},fieldProps:D(T,C,x,d,{onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,style:{unicodeBidi:`isolate`}}),inputProps:w,descriptionProps:c,errorMessageProps:l,isInvalid:r,validationErrors:i,validationDetails:a}}function qi(e,t,n){let r=Ki(e,t,n);return r.inputProps.value=t.timeValue?.toString()||``,r}function Z(e){e=Ye(e??{},Ji);let{locale:t}=F();return(0,R.useMemo)(()=>new Y(t,e),[t,e])}function Ji(e,t){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(t[r]!==e[r])return!1;return!0}function Yi(e){return e&&e.__esModule?e.default:e}function Xi(){let{locale:e}=F(),t=c(Yi(zi),`@react-aria/datepicker`);return(0,R.useMemo)(()=>{try{return new Intl.DisplayNames(e,{type:`dateTimeField`})}catch{return new Zi(e,t)}},[e,t])}var Zi=class{constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}};function Qi(e,t,n){let r=(0,R.useRef)(``),{locale:i,direction:a}=F(),o=Xi(),{ariaLabel:s,ariaLabelledBy:c,ariaDescribedBy:l,focusManager:u}=Ui.get(t),d=e.isPlaceholder?``:e.text,f=(0,R.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),p=Z({month:`long`,timeZone:f.timeZone}),m=Z({hour:`numeric`,hour12:f.hour12,timeZone:f.timeZone});if(e.type===`month`&&!e.isPlaceholder){let e=p.format(t.dateValue);d=e===d?e:`${d} \u{2013} ${e}`}else e.type===`hour`&&!e.isPlaceholder&&(d=m.format(t.dateValue));let{spinButtonProps:h}=Ie({value:e.value??void 0,textValue:d,minValue:e.minValue,maxValue:e.maxValue,isDisabled:t.isDisabled,isReadOnly:t.isReadOnly||!e.isEditable,isRequired:t.isRequired,onIncrement:()=>{r.current=``,t.increment(e.type)},onDecrement:()=>{r.current=``,t.decrement(e.type)},onIncrementPage:()=>{r.current=``,t.incrementPage(e.type)},onDecrementPage:()=>{r.current=``,t.decrementPage(e.type)},onIncrementToMax:()=>{r.current=``,t.incrementToMax(e.type)},onDecrementToMin:()=>{r.current=``,t.decrementToMin(e.type)}}),v=(0,R.useMemo)(()=>new Pe(i,{maximumFractionDigits:0}),[i]),y=()=>{if(e.text===e.placeholder&&u.focusPrevious(),v.isValidPartialNumber(e.text)&&!t.isReadOnly&&!e.isPlaceholder){let n=e.text.slice(0,-1),i=v.parse(n);n=i===0?``:n,n.length===0||i===0?t.clearSegment(e.type):t.setSegment(e.type,i),r.current=n}else(e.type===`dayPeriod`||e.type===`era`)&&t.clearSegment(e.type)},{keyboardProps:x}=he({shortcuts:{Backspace:()=>{y()},Delete:()=>{y()},"Mod+a":()=>{}},allowRepeats:!0}),{startsWith:S}=nt({sensitivity:`base`}),w=Z({hour:`numeric`,hour12:!0}),T=(0,R.useMemo)(()=>{let e=new Date;return e.setHours(0),w.formatToParts(e).find(e=>e.type===`dayPeriod`).value},[w]),E=(0,R.useMemo)(()=>{let e=new Date;return e.setHours(12),w.formatToParts(e).find(e=>e.type===`dayPeriod`).value},[w]),O=Z({year:`numeric`,era:`narrow`,timeZone:`UTC`}),k=(0,R.useMemo)(()=>{if(e.type!==`era`)return[];let n=G(new q(1,1,1),t.calendar),r=t.calendar.getEras().map(e=>{let t=n.set({year:1,month:1,day:1,era:e}).toDate(`UTC`);return{era:e,formatted:O.formatToParts(t).find(e=>e.type===`era`).value}}),i=$i(r.map(e=>e.formatted));if(i)for(let e of r)e.formatted=e.formatted.slice(i);return r},[O,t.calendar,e.type]),A=n=>{if(t.isDisabled||t.isReadOnly)return;let i=r.current+n;switch(e.type){case`dayPeriod`:if(S(T,n))t.setSegment(`dayPeriod`,0);else if(S(E,n))t.setSegment(`dayPeriod`,1);else break;u.focusNext();break;case`era`:{let e=k.find(e=>S(e.formatted,n));e&&(t.setSegment(`era`,e.era),u.focusNext());break}case`day`:case`hour`:case`minute`:case`second`:case`month`:case`year`:{if(!v.isValidPartialNumber(i))return;let a=v.parse(i),o=a;if(e.maxValue!==void 0&&a>e.maxValue&&(o=v.parse(n)),isNaN(a))return;t.setSegment(e.type,o),e.maxValue!==void 0&&(Number(a+`0`)>e.maxValue||i.length>=String(e.maxValue).length)?(r.current=``,u.focusNext()):r.current=i;break}}},ee=()=>{r.current=``,n.current&&qe(n.current,{containingElement:Be(n.current)}),window.getSelection()?.collapse(n.current)},te=(0,R.useRef)(typeof document<`u`?document:null);g(te,`selectionchange`,()=>{let e=window.getSelection();e?.anchorNode&&ne(n.current,e?.anchorNode)&&b()===n.current&&e.collapse(n.current)});let j=(0,R.useRef)(``);g(n,`beforeinput`,r=>{if(n.current)switch(r.preventDefault(),r.inputType){case`deleteContentBackward`:case`deleteContentForward`:v.isValidPartialNumber(e.text)&&!t.isReadOnly&&y();break;case`insertCompositionText`:j.current=n.current.textContent,n.current.textContent=n.current.textContent;break;default:r.data!=null&&A(r.data)}}),g(n,`input`,e=>{let{inputType:t,data:r}=e;t===`insertCompositionText`&&(n.current&&(n.current.textContent=j.current),r!=null&&(S(T,r)||S(E,r))&&A(r))}),ae(()=>{let e=n.current;return()=>{b()===e&&(u.focusPrevious()||u.focusNext())}},[n,u]);let M=C()||e.type===`timeZoneName`?{role:`textbox`,"aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e!==(0,R.useMemo)(()=>t.segments.find(e=>e.isEditable),[t.segments])&&!t.isInvalid&&(l=void 0);let re=le(),N=!t.isDisabled&&!t.isReadOnly&&e.isEditable,ie=e.type===`literal`?``:o.of(e.type),P=_({"aria-label":`${ie}${s?`, ${s}`:``}${c?`, `:``}`,"aria-labelledby":c});if(e.type===`literal`)return{segmentProps:{"aria-hidden":!0}};let oe={caretColor:`transparent`};if(a===`rtl`){oe.unicodeBidi=`embed`;let t=f[e.type];(t===`numeric`||t===`2-digit`)&&(oe.direction=`ltr`)}return{segmentProps:D(h,P,{id:re,...M,...x,"aria-invalid":t.isInvalid?`true`:void 0,"aria-describedby":l,"aria-readonly":t.isReadOnly||!e.isEditable?`true`:void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:N,suppressContentEditableWarning:N,spellCheck:N?`false`:void 0,autoCorrect:N?`off`:void 0,enterKeyHint:N?`next`:void 0,inputMode:t.isDisabled||e.type===`dayPeriod`||e.type===`era`||!N?void 0:`numeric`,tabIndex:t.isDisabled?void 0:0,onFocus:ee,style:oe,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}function $i(e){e.sort();let t=e[0],n=e[e.length-1];for(let e=0;e`\u{64A}\u{62C}\u{628} \u{623}\u{646} \u{62A}\u{643}\u{648}\u{646} \u{627}\u{644}\u{642}\u{64A}\u{645}\u{629} ${e.maxValue} \u{623}\u{648} \u{642}\u{628}\u{644} \u{630}\u{644}\u{643}.`,rangeReversed:`تاريخ البدء يجب أن يكون قبل تاريخ الانتهاء.`,rangeUnderflow:e=>`\u{64A}\u{62C}\u{628} \u{623}\u{646} \u{62A}\u{643}\u{648}\u{646} \u{627}\u{644}\u{642}\u{64A}\u{645}\u{629} ${e.minValue} \u{623}\u{648} \u{628}\u{639}\u{62F} \u{630}\u{644}\u{643}.`,unavailableDate:`البيانات المحددة غير متاحة.`};var ta={};ta={rangeOverflow:e=>`\u{421}\u{442}\u{43E}\u{439}\u{43D}\u{43E}\u{441}\u{442}\u{442}\u{430} \u{442}\u{440}\u{44F}\u{431}\u{432}\u{430} \u{434}\u{430} \u{435} ${e.maxValue} \u{438}\u{43B}\u{438} \u{43F}\u{43E}-\u{440}\u{430}\u{43D}\u{43D}\u{430}.`,rangeReversed:`Началната дата трябва да е преди крайната.`,rangeUnderflow:e=>`\u{421}\u{442}\u{43E}\u{439}\u{43D}\u{43E}\u{441}\u{442}\u{442}\u{430} \u{442}\u{440}\u{44F}\u{431}\u{432}\u{430} \u{434}\u{430} \u{435} ${e.minValue} \u{438}\u{43B}\u{438} \u{43F}\u{43E}-\u{43A}\u{44A}\u{441}\u{43D}\u{43E}.`,unavailableDate:`Избраната дата не е налична.`};var na={};na={rangeOverflow:e=>`Hodnota mus\xed b\xfdt ${e.maxValue} nebo d\u{159}\xedv\u{11B}j\u{161}\xed.`,rangeReversed:`Datum zahájení musí předcházet datu ukončení.`,rangeUnderflow:e=>`Hodnota mus\xed b\xfdt ${e.minValue} nebo pozd\u{11B}j\u{161}\xed.`,unavailableDate:`Vybrané datum není k dispozici.`};var ra={};ra={rangeOverflow:e=>`V\xe6rdien skal v\xe6re ${e.maxValue} eller tidligere.`,rangeReversed:`Startdatoen skal være før slutdatoen.`,rangeUnderflow:e=>`V\xe6rdien skal v\xe6re ${e.minValue} eller nyere.`,unavailableDate:`Den valgte dato er ikke tilgængelig.`};var ia={};ia={rangeOverflow:e=>`Der Wert muss ${e.maxValue} oder fr\xfcher sein.`,rangeReversed:`Das Startdatum muss vor dem Enddatum liegen.`,rangeUnderflow:e=>`Der Wert muss ${e.minValue} oder sp\xe4ter sein.`,unavailableDate:`Das ausgewählte Datum ist nicht verfügbar.`};var aa={};aa={rangeOverflow:e=>`\u{397} \u{3C4}\u{3B9}\u{3BC}\u{3AE} \u{3C0}\u{3C1}\u{3AD}\u{3C0}\u{3B5}\u{3B9} \u{3BD}\u{3B1} \u{3B5}\u{3AF}\u{3BD}\u{3B1}\u{3B9} ${e.maxValue} \u{3AE} \u{3C0}\u{3B1}\u{3BB}\u{3B1}\u{3B9}\u{3CC}\u{3C4}\u{3B5}\u{3C1}\u{3B7}.`,rangeReversed:`Η ημερομηνία έναρξης πρέπει να είναι πριν από την ημερομηνία λήξης.`,rangeUnderflow:e=>`\u{397} \u{3C4}\u{3B9}\u{3BC}\u{3AE} \u{3C0}\u{3C1}\u{3AD}\u{3C0}\u{3B5}\u{3B9} \u{3BD}\u{3B1} \u{3B5}\u{3AF}\u{3BD}\u{3B1}\u{3B9} ${e.minValue} \u{3AE} \u{3BC}\u{3B5}\u{3C4}\u{3B1}\u{3B3}\u{3B5}\u{3BD}\u{3AD}\u{3C3}\u{3C4}\u{3B5}\u{3C1}\u{3B7}.`,unavailableDate:`Η επιλεγμένη ημερομηνία δεν είναι διαθέσιμη.`};var oa={};oa={rangeUnderflow:e=>`Value must be ${e.minValue} or later.`,rangeOverflow:e=>`Value must be ${e.maxValue} or earlier.`,rangeReversed:`Start date must be before end date.`,unavailableDate:`Selected date unavailable.`};var sa={};sa={rangeOverflow:e=>`El valor debe ser ${e.maxValue} o anterior.`,rangeReversed:`La fecha de inicio debe ser anterior a la fecha de finalización.`,rangeUnderflow:e=>`El valor debe ser ${e.minValue} o posterior.`,unavailableDate:`Fecha seleccionada no disponible.`};var ca={};ca={rangeOverflow:e=>`V\xe4\xe4rtus peab olema ${e.maxValue} v\xf5i varasem.`,rangeReversed:`Alguskuupäev peab olema enne lõppkuupäeva.`,rangeUnderflow:e=>`V\xe4\xe4rtus peab olema ${e.minValue} v\xf5i hilisem.`,unavailableDate:`Valitud kuupäev pole saadaval.`};var la={};la={rangeOverflow:e=>`Arvon on oltava ${e.maxValue} tai sit\xe4 aikaisempi.`,rangeReversed:`Aloituspäivän on oltava ennen lopetuspäivää.`,rangeUnderflow:e=>`Arvon on oltava ${e.minValue} tai sit\xe4 my\xf6h\xe4isempi.`,unavailableDate:`Valittu päivämäärä ei ole käytettävissä.`};var ua={};ua={rangeOverflow:e=>`La valeur doit \xeatre ${e.maxValue} ou ant\xe9rieure.`,rangeReversed:`La date de début doit être antérieure à la date de fin.`,rangeUnderflow:e=>`La valeur doit \xeatre ${e.minValue} ou ult\xe9rieure.`,unavailableDate:`La date sélectionnée n’est pas disponible.`};var da={};da={rangeOverflow:e=>`\u{5D4}\u{5E2}\u{5E8}\u{5DA} \u{5D7}\u{5D9}\u{5D9}\u{5D1} \u{5DC}\u{5D4}\u{5D9}\u{5D5}\u{5EA} ${e.maxValue} \u{5D0}\u{5D5} \u{5DE}\u{5D5}\u{5E7}\u{5D3}\u{5DD} \u{5D9}\u{5D5}\u{5EA}\u{5E8}.`,rangeReversed:`תאריך ההתחלה חייב להיות לפני תאריך הסיום.`,rangeUnderflow:e=>`\u{5D4}\u{5E2}\u{5E8}\u{5DA} \u{5D7}\u{5D9}\u{5D9}\u{5D1} \u{5DC}\u{5D4}\u{5D9}\u{5D5}\u{5EA} ${e.minValue} \u{5D0}\u{5D5} \u{5DE}\u{5D0}\u{5D5}\u{5D7}\u{5E8} \u{5D9}\u{5D5}\u{5EA}\u{5E8}.`,unavailableDate:`התאריך הנבחר אינו זמין.`};var fa={};fa={rangeOverflow:e=>`Vrijednost mora biti ${e.maxValue} ili ranije.`,rangeReversed:`Datum početka mora biti prije datuma završetka.`,rangeUnderflow:e=>`Vrijednost mora biti ${e.minValue} ili kasnije.`,unavailableDate:`Odabrani datum nije dostupan.`};var pa={};pa={rangeOverflow:e=>`Az \xe9rt\xe9knek ${e.maxValue} vagy kor\xe1bbinak kell lennie.`,rangeReversed:`A kezdő dátumnak a befejező dátumnál korábbinak kell lennie.`,rangeUnderflow:e=>`Az \xe9rt\xe9knek ${e.minValue} vagy k\xe9s\u{151}bbinek kell lennie.`,unavailableDate:`A kiválasztott dátum nem érhető el.`};var ma={};ma={rangeOverflow:e=>`Il valore deve essere ${e.maxValue} o precedente.`,rangeReversed:`La data di inizio deve essere antecedente alla data di fine.`,rangeUnderflow:e=>`Il valore deve essere ${e.minValue} o successivo.`,unavailableDate:`Data selezionata non disponibile.`};var ha={};ha={rangeOverflow:e=>`\u{5024}\u{306F} ${e.maxValue} \u{4EE5}\u{4E0B}\u{306B}\u{3059}\u{308B}\u{5FC5}\u{8981}\u{304C}\u{3042}\u{308A}\u{307E}\u{3059}\u{3002}`,rangeReversed:`開始日は終了日より前にする必要があります。`,rangeUnderflow:e=>`\u{5024}\u{306F} ${e.minValue} \u{4EE5}\u{4E0A}\u{306B}\u{3059}\u{308B}\u{5FC5}\u{8981}\u{304C}\u{3042}\u{308A}\u{307E}\u{3059}\u{3002}`,unavailableDate:`選択した日付は使用できません。`};var ga={};ga={rangeOverflow:e=>`\u{AC12}\u{C740} ${e.maxValue} \u{C774}\u{C804}\u{C774}\u{C5B4}\u{C57C} \u{D569}\u{B2C8}\u{B2E4}.`,rangeReversed:`시작일은 종료일 이전이어야 합니다.`,rangeUnderflow:e=>`\u{AC12}\u{C740} ${e.minValue} \u{C774}\u{D6C4}\u{C5EC}\u{C57C} \u{D569}\u{B2C8}\u{B2E4}.`,unavailableDate:`선택한 날짜를 사용할 수 없습니다.`};var _a={};_a={rangeOverflow:e=>`Reik\u{161}m\u{117} turi b\u{16B}ti ${e.maxValue} arba ankstesn\u{117}.`,rangeReversed:`Pradžios data turi būti ankstesnė nei pabaigos data.`,rangeUnderflow:e=>`Reik\u{161}m\u{117} turi b\u{16B}ti ${e.minValue} arba naujesn\u{117}.`,unavailableDate:`Pasirinkta data nepasiekiama.`};var va={};va={rangeOverflow:e=>`V\u{113}rt\u{12B}bai ir j\u{101}b\u{16B}t ${e.maxValue} vai agr\u{101}kai.`,rangeReversed:`Sākuma datumam ir jābūt pirms beigu datuma.`,rangeUnderflow:e=>`V\u{113}rt\u{12B}bai ir j\u{101}b\u{16B}t ${e.minValue} vai v\u{113}l\u{101}kai.`,unavailableDate:`Atlasītais datums nav pieejams.`};var ya={};ya={rangeOverflow:e=>`Verdien m\xe5 v\xe6re ${e.maxValue} eller tidligere.`,rangeReversed:`Startdatoen må være før sluttdatoen.`,rangeUnderflow:e=>`Verdien m\xe5 v\xe6re ${e.minValue} eller senere.`,unavailableDate:`Valgt dato utilgjengelig.`};var ba={};ba={rangeOverflow:e=>`Waarde moet ${e.maxValue} of eerder zijn.`,rangeReversed:`De startdatum moet voor de einddatum liggen.`,rangeUnderflow:e=>`Waarde moet ${e.minValue} of later zijn.`,unavailableDate:`Geselecteerde datum niet beschikbaar.`};var xa={};xa={rangeOverflow:e=>`Warto\u{15B}\u{107} musi mie\u{107} warto\u{15B}\u{107} ${e.maxValue} lub wcze\u{15B}niejsz\u{105}.`,rangeReversed:`Data rozpoczęcia musi być wcześniejsza niż data zakończenia.`,rangeUnderflow:e=>`Warto\u{15B}\u{107} musi mie\u{107} warto\u{15B}\u{107} ${e.minValue} lub p\xf3\u{17A}niejsz\u{105}.`,unavailableDate:`Wybrana data jest niedostępna.`};var Sa={};Sa={rangeOverflow:e=>`O valor deve ser ${e.maxValue} ou anterior.`,rangeReversed:`A data inicial deve ser anterior à data final.`,rangeUnderflow:e=>`O valor deve ser ${e.minValue} ou posterior.`,unavailableDate:`Data selecionada indisponível.`};var Ca={};Ca={rangeOverflow:e=>`O valor tem de ser ${e.maxValue} ou anterior.`,rangeReversed:`A data de início deve ser anterior à data de fim.`,rangeUnderflow:e=>`O valor tem de ser ${e.minValue} ou posterior.`,unavailableDate:`Data selecionada indisponível.`};var wa={};wa={rangeOverflow:e=>`Valoarea trebuie s\u{103} fie ${e.maxValue} sau anterioar\u{103}.`,rangeReversed:`Data de început trebuie să fie anterioară datei de sfârșit.`,rangeUnderflow:e=>`Valoarea trebuie s\u{103} fie ${e.minValue} sau ulterioar\u{103}.`,unavailableDate:`Data selectată nu este disponibilă.`};var Ta={};Ta={rangeOverflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{438}\u{435} \u{434}\u{43E}\u{43B}\u{436}\u{43D}\u{43E} \u{431}\u{44B}\u{442}\u{44C} \u{43D}\u{435} \u{43F}\u{43E}\u{437}\u{436}\u{435} ${e.maxValue}.`,rangeReversed:`Дата начала должна предшествовать дате окончания.`,rangeUnderflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{438}\u{435} \u{434}\u{43E}\u{43B}\u{436}\u{43D}\u{43E} \u{431}\u{44B}\u{442}\u{44C} \u{43D}\u{435} \u{440}\u{430}\u{43D}\u{44C}\u{448}\u{435} ${e.minValue}.`,unavailableDate:`Выбранная дата недоступна.`};var Ea={};Ea={rangeOverflow:e=>`Hodnota mus\xed by\u{165} ${e.maxValue} alebo skor\u{161}ia.`,rangeReversed:`Dátum začiatku musí byť skorší ako dátum konca.`,rangeUnderflow:e=>`Hodnota mus\xed by\u{165} ${e.minValue} alebo neskor\u{161}ia.`,unavailableDate:`Vybratý dátum je nedostupný.`};var Da={};Da={rangeOverflow:e=>`Vrednost mora biti ${e.maxValue} ali starej\u{161}a.`,rangeReversed:`Začetni datum mora biti pred končnim datumom.`,rangeUnderflow:e=>`Vrednost mora biti ${e.minValue} ali novej\u{161}a.`,unavailableDate:`Izbrani datum ni na voljo.`};var Oa={};Oa={rangeOverflow:e=>`Vrednost mora da bude ${e.maxValue} ili starija.`,rangeReversed:`Datum početka mora biti pre datuma završetka.`,rangeUnderflow:e=>`Vrednost mora da bude ${e.minValue} ili novija.`,unavailableDate:`Izabrani datum nije dostupan.`};var ka={};ka={rangeOverflow:e=>`V\xe4rdet m\xe5ste vara ${e.maxValue} eller tidigare.`,rangeReversed:`Startdatumet måste vara före slutdatumet.`,rangeUnderflow:e=>`V\xe4rdet m\xe5ste vara ${e.minValue} eller senare.`,unavailableDate:`Det valda datumet är inte tillgängligt.`};var Aa={};Aa={rangeOverflow:e=>`De\u{11F}er, ${e.maxValue} veya \xf6ncesi olmal\u{131}d\u{131}r.`,rangeReversed:`Başlangıç tarihi bitiş tarihinden önce olmalıdır.`,rangeUnderflow:e=>`De\u{11F}er, ${e.minValue} veya sonras\u{131} olmal\u{131}d\u{131}r.`,unavailableDate:`Seçilen tarih kullanılamıyor.`};var ja={};ja={rangeOverflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{43D}\u{44F} \u{43C}\u{430}\u{454} \u{431}\u{443}\u{442}\u{438} \u{43D}\u{435} \u{43F}\u{456}\u{437}\u{43D}\u{456}\u{448}\u{435} ${e.maxValue}.`,rangeReversed:`Дата початку має передувати даті завершення.`,rangeUnderflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{43D}\u{44F} \u{43C}\u{430}\u{454} \u{431}\u{443}\u{442}\u{438} \u{43D}\u{435} \u{440}\u{430}\u{43D}\u{456}\u{448}\u{435} ${e.minValue}.`,unavailableDate:`Вибрана дата недоступна.`};var Ma={};Ma={rangeOverflow:e=>`\u{503C}\u{5FC5}\u{987B}\u{662F} ${e.maxValue} \u{6216}\u{66F4}\u{65E9}\u{65E5}\u{671F}\u{3002}`,rangeReversed:`开始日期必须早于结束日期。`,rangeUnderflow:e=>`\u{503C}\u{5FC5}\u{987B}\u{662F} ${e.minValue} \u{6216}\u{66F4}\u{665A}\u{65E5}\u{671F}\u{3002}`,unavailableDate:`所选日期不可用。`};var Na={};Na={rangeOverflow:e=>`\u{503C}\u{5FC5}\u{9808}\u{662F} ${e.maxValue} \u{6216}\u{66F4}\u{65E9}\u{3002}`,rangeReversed:`開始日期必須在結束日期之前。`,rangeUnderflow:e=>`\u{503C}\u{5FC5}\u{9808}\u{662F} ${e.minValue} \u{6216}\u{66F4}\u{665A}\u{3002}`,unavailableDate:`所選日期無法使用。`};var Pa={};Pa={"ar-AE":ea,"bg-BG":ta,"cs-CZ":na,"da-DK":ra,"de-DE":ia,"el-GR":aa,"en-US":oa,"es-ES":sa,"et-EE":ca,"fi-FI":la,"fr-FR":ua,"he-IL":da,"hr-HR":fa,"hu-HU":pa,"it-IT":ma,"ja-JP":ha,"ko-KR":ga,"lt-LT":_a,"lv-LV":va,"nb-NO":ya,"nl-NL":ba,"pl-PL":xa,"pt-BR":Sa,"pt-PT":Ca,"ro-RO":wa,"ru-RU":Ta,"sk-SK":Ea,"sl-SI":Da,"sr-SP":Oa,"sv-SE":ka,"tr-TR":Aa,"uk-UA":ja,"zh-CN":Ma,"zh-TW":Na};function Fa(e){return e&&e.__esModule?e.default:e}var Ia=new m(Fa(Pa));function La(){let e=typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return e}function Ra(e,t,n,i,a){let o=e!=null&&n!=null&&e.compare(n)>0,s=e!=null&&t!=null&&e.compare(t)<0,c=e!=null&&i?.(e)||!1,l=o||s||c,u=[];if(l){let e=La(),i=m.getGlobalDictionaryForPackage(`@react-stately/datepicker`)||Ia,l=new r(e,i),d=new Y(e,Ha({},a)),f=d.resolvedOptions().timeZone;s&&t!=null&&u.push(l.format(`rangeUnderflow`,{minValue:d.format(t.toDate(f))})),o&&n!=null&&u.push(l.format(`rangeOverflow`,{maxValue:d.format(n.toDate(f))})),c&&u.push(l.format(`unavailableDate`))}return{isInvalid:l,validationErrors:u,validationDetails:{badInput:c,customError:!1,patternMismatch:!1,rangeOverflow:o,rangeUnderflow:s,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!l}}}function za(e,t,n,r,i){let a=Ra(e?.start??null,t,n,r,i),o=Ra(e?.end??null,t,n,r,i),s=Ce(a,o);if(e?.end!=null&&e.start!=null&&e.end.compare(e.start)<0){let e=m.getGlobalDictionaryForPackage(`@react-stately/datepicker`)||Ia;s=Ce(s,{isInvalid:!0,validationErrors:[e.getStringForLocale(`rangeReversed`,La())],validationDetails:{...ye,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})}return s}var Ba={year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`},Va={year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`};function Ha(e,t){e={...t.shouldForceLeadingZeros?Va:Ba,...e};let n=t.granularity||`minute`,r=Object.keys(e),i=r.indexOf(t.maxGranularity??`year`);i<0&&(i=0);let a=r.indexOf(n);if(a<0&&(a=2),i>a)throw Error(`maxGranularity must be greater than granularity`);let o=r.slice(i,a+1).reduce((t,n)=>(t[n]=e[n],t),{});return t.hourCycle!=null&&(o.hour12=t.hourCycle===12),o.timeZone=t.timeZone||`UTC`,(n===`hour`||n===`minute`||n===`second`)&&t.timeZone&&!t.hideTimeZone&&(o.timeZoneName=`short`),t.showEra&&i===0&&(o.era=`short`),o}function Ua(e){return e&&`hour`in e?e:new Ln}function Wa(e,t){if(e===null)return null;if(e)return G(e,t)}function Ga(e,t,n,r){if(e)return Wa(e,n);let i=G(vt(r??Tt()).set({hour:0,minute:0,second:0,millisecond:0}),n);return t===`year`||t===`month`||t===`day`?U(i):r?i:W(i)}function Ka(e,t){let n=e&&`timeZone`in e?e.timeZone:void 0,r=e&&`minute`in e?`minute`:`day`;if(e&&t&&!(t in e))throw Error(`Invalid granularity `+t+` for value `+e.toString());let[i,a]=(0,R.useState)([r,n]);e&&(i[0]!==r||i[1]!==n)&&a([r,n]),t||=e?r:i[0];let o=e?n:i[1];return[t,o]}var qa=new m({ach:{year:`mwaka`,month:`dwe`,day:`nino`},af:{year:`jjjj`,month:`mm`,day:`dd`},am:{year:`ዓዓዓዓ`,month:`ሚሜ`,day:`ቀቀ`},an:{year:`aaaa`,month:`mm`,day:`dd`},ar:{year:`سنة`,month:`شهر`,day:`يوم`},ast:{year:`aaaa`,month:`mm`,day:`dd`},az:{year:`iiii`,month:`aa`,day:`gg`},be:{year:`гггг`,month:`мм`,day:`дд`},bg:{year:`гггг`,month:`мм`,day:`дд`},bn:{year:`yyyy`,month:`মিমি`,day:`dd`},br:{year:`bbbb`,month:`mm`,day:`dd`},bs:{year:`gggg`,month:`mm`,day:`dd`},ca:{year:`aaaa`,month:`mm`,day:`dd`},cak:{year:`jjjj`,month:`ii`,day:`q'q'`},ckb:{year:`ساڵ`,month:`مانگ`,day:`ڕۆژ`},cs:{year:`rrrr`,month:`mm`,day:`dd`},cy:{year:`bbbb`,month:`mm`,day:`dd`},da:{year:`åååå`,month:`mm`,day:`dd`},de:{year:`jjjj`,month:`mm`,day:`tt`},dsb:{year:`llll`,month:`mm`,day:`źź`},el:{year:`εεεε`,month:`μμ`,day:`ηη`},en:{year:`yyyy`,month:`mm`,day:`dd`},eo:{year:`jjjj`,month:`mm`,day:`tt`},es:{year:`aaaa`,month:`mm`,day:`dd`},et:{year:`aaaa`,month:`kk`,day:`pp`},eu:{year:`uuuu`,month:`hh`,day:`ee`},fa:{year:`سال`,month:`ماه`,day:`روز`},ff:{year:`hhhh`,month:`ll`,day:`ññ`},fi:{year:`vvvv`,month:`kk`,day:`pp`},fr:{year:`aaaa`,month:`mm`,day:`jj`},fy:{year:`jjjj`,month:`mm`,day:`dd`},ga:{year:`bbbb`,month:`mm`,day:`ll`},gd:{year:`bbbb`,month:`mm`,day:`ll`},gl:{year:`aaaa`,month:`mm`,day:`dd`},he:{year:`שנה`,month:`חודש`,day:`יום`},hr:{year:`gggg`,month:`mm`,day:`dd`},hsb:{year:`llll`,month:`mm`,day:`dd`},hu:{year:`éééé`,month:`hh`,day:`nn`},ia:{year:`aaaa`,month:`mm`,day:`dd`},id:{year:`tttt`,month:`bb`,day:`hh`},is:{year:`áááá`,month:`mm`,day:`dd`},it:{year:`aaaa`,month:`mm`,day:`gg`},ja:{year:`年`,month:`月`,day:`日`},ka:{year:`წწწწ`,month:`თთ`,day:`რრ`},kk:{year:`жжжж`,month:`аа`,day:`кк`},kn:{year:`ವವವವ`,month:`ಮಿಮೀ`,day:`ದಿದಿ`},ko:{year:`연도`,month:`월`,day:`일`},lb:{year:`jjjj`,month:`mm`,day:`dd`},lo:{year:`ປປປປ`,month:`ດດ`,day:`ວວ`},lt:{year:`mmmm`,month:`mm`,day:`dd`},lv:{year:`gggg`,month:`mm`,day:`dd`},meh:{year:`aaaa`,month:`mm`,day:`dd`},ml:{year:`വർഷം`,month:`മാസം`,day:`തീയതി`},ms:{year:`tttt`,month:`mm`,day:`hh`},nb:{year:`åååå`,month:`mm`,day:`dd`},nl:{year:`jjjj`,month:`mm`,day:`dd`},nn:{year:`åååå`,month:`mm`,day:`dd`},no:{year:`åååå`,month:`mm`,day:`dd`},oc:{year:`aaaa`,month:`mm`,day:`jj`},pl:{year:`rrrr`,month:`mm`,day:`dd`},pt:{year:`aaaa`,month:`mm`,day:`dd`},rm:{year:`oooo`,month:`mm`,day:`dd`},ro:{year:`aaaa`,month:`ll`,day:`zz`},ru:{year:`гггг`,month:`мм`,day:`дд`},sc:{year:`aaaa`,month:`mm`,day:`dd`},scn:{year:`aaaa`,month:`mm`,day:`jj`},sk:{year:`rrrr`,month:`mm`,day:`dd`},sl:{year:`llll`,month:`mm`,day:`dd`},sr:{year:`гггг`,month:`мм`,day:`дд`},"sr-Latn":{year:`gggg`,month:`mm`,day:`dd`},sv:{year:`åååå`,month:`mm`,day:`dd`},szl:{year:`rrrr`,month:`mm`,day:`dd`},tg:{year:`сссс`,month:`мм`,day:`рр`},th:{year:`ปปปป`,month:`ดด`,day:`วว`},tr:{year:`yyyy`,month:`aa`,day:`gg`},uk:{year:`рррр`,month:`мм`,day:`дд`},"zh-CN":{year:`年`,month:`月`,day:`日`},"zh-TW":{year:`年`,month:`月`,day:`日`}},`en`);function Ja(e,t,n){return e===`era`||e===`dayPeriod`?t:e===`year`||e===`month`||e===`day`?qa.getStringForLocale(e,n):`––`}var Ya=class e{constructor(e,t,n){if(this.era=n?.era??null,this.calendar=e,this.year=n?.year??null,this.month=n?.month??null,this.day=n?.day??null,this.hour=n?.hour??null,this.hourCycle=t,this.dayPeriod=null,this.minute=n?.minute??null,this.second=n?.second??null,this.millisecond=n?.millisecond??null,this.offset=`offset`in(n??{})?n.offset:null,this.hour!=null){let[e,n]=Za(this.hour,t);this.dayPeriod=e,this.hour=n}}copy(){let t=new e(this.calendar,this.hourCycle);return t.era=this.era,t.year=this.year,t.month=this.month,t.day=this.day,t.hour=this.hour,t.dayPeriod=this.dayPeriod,t.minute=this.minute,t.second=this.second,t.millisecond=this.millisecond,t.offset=this.offset,t}isComplete(e){return e.every(e=>this[e]!=null)}validate(e,t){return t.every(t=>{if((t===`hour`||t===`dayPeriod`)&&`hour`in e){let[t,n]=Za(e.hour,this.hourCycle);return this.dayPeriod===t&&this.hour===n}return this[t]===e[t]})}isCleared(e){return e.every(e=>this[e]===null)}set(e,t,n){let r=this.copy();return r[e]=t,e===`hour`&&r.dayPeriod==null&&`hour`in n&&(r.dayPeriod=Za(n.hour,this.hourCycle)[0]),e===`year`&&r.era==null&&(r.era=n.era),e!==`second`&&e!==`literal`&&e!==`timeZoneName`&&(r.offset=null),r}clear(e){let t=this.copy();return t[e]=null,e===`year`&&(t.era=null),t.offset=null,t}cycle(e,t,n,r){let i=this.copy();if(i[e]==null&&e!==`dayPeriod`&&e!==`era`){if(e===`hour`&&`hour`in n){let[e,t]=Za(n.hour,this.hourCycle);i.dayPeriod=e,i.hour=t}else i[e]=n[e];return e===`year`&&i.era==null&&(i.era=n.era),i}switch(e){case`era`:{let e=this.calendar.getEras(),n=e.indexOf(i.era);n=Xa(n,t,0,e.length-1),i.era=e[n];break}case`year`:{let r=new q(this.calendar,this.era??n.era,this.year??n.year,this.month??1,this.day??1);r=r.cycle(e,t,{round:e===`year`}),i.era=r.era,i.year=r.year;break}case`month`:i.month=Xa(i.month??1,t,1,this.calendar.getMaximumMonthsInYear());break;case`day`:i.day=Xa(i.day??1,t,1,this.calendar.getMaximumDaysInMonth());break;case`hour`:{let e=r.some(e=>[`year`,`month`,`day`].includes(e));if(`timeZone`in n&&(!e||i.year!=null&&i.month!=null&&i.day!=null)){let e=this.toValue(n);e=e.cycle(`hour`,t,{hourCycle:this.hourCycle===`h12`?12:24,round:!1});let[r,a]=Za(e.hour,this.hourCycle);i.hour=a,i.dayPeriod=r,i.offset=e.offset}else{let e=i.hour??0,r=this.getSegmentLimits(`hour`);i.hour=Xa(e,t,r.minValue,r.maxValue),i.dayPeriod==null&&`hour`in n&&(i.dayPeriod=Za(n.hour,this.hourCycle)[0])}break}case`dayPeriod`:i.dayPeriod=Xa(i.dayPeriod??0,t,0,1);break;case`minute`:i.minute=Xa(i.minute??0,t,0,59,!0);break;case`second`:i.second=Xa(i.second??0,t,0,59,!0)}return i}toValue(e){if(`hour`in e){let t=this.hour;t==null?(this.hourCycle===`h12`||this.hourCycle===`h11`)&&(t=this.dayPeriod===1?12:0):t=Qa(t,this.dayPeriod??0,this.hourCycle);let n=e.set({era:this.era??e.era,year:this.year??e.year,month:this.month??e.month,day:this.day??e.day,hour:t??e.hour,minute:this.minute??e.minute,second:this.second??e.second,millisecond:this.millisecond??e.millisecond});return`offset`in n&&this.offset!=null&&n.offset!==this.offset&&(n=n.add({milliseconds:n.offset-this.offset})),n}return e.set({era:this.era??e.era,year:this.year??e.year,month:this.month??e.month,day:this.day??e.day})}getSegmentLimits(e){switch(e){case`era`:{let e=this.calendar.getEras();return{value:this.era==null?e.length-1:e.indexOf(this.era),minValue:0,maxValue:e.length-1}}case`year`:return{value:this.year,minValue:1,maxValue:9999};case`month`:return{value:this.month,minValue:1,maxValue:this.calendar.getMaximumMonthsInYear()};case`day`:return{value:this.day,minValue:1,maxValue:this.calendar.getMaximumDaysInMonth()};case`dayPeriod`:return{value:this.dayPeriod,minValue:0,maxValue:1};case`hour`:{let e=0,t=23;return this.hourCycle===`h12`?(e=1,t=12):this.hourCycle===`h11`&&(e=0,t=11),{value:this.hour,minValue:e,maxValue:t}}case`minute`:return{value:this.minute,minValue:0,maxValue:59};case`second`:return{value:this.second,minValue:0,maxValue:59}}}};function Xa(e,t,n,r,i=!1){if(i){e+=Math.sign(t),e0?Math.ceil(e/i)*i:Math.floor(e/i)*i,e>r&&(e=n)}else e+=t,er&&(e=n+(e-r-1));return e}function Za(e,t){let n=+(e>=12);switch(t){case`h11`:e>=12&&(e-=12);break;case`h12`:e===0?e=12:e>12&&(e-=12);break;case`h23`:n=null;break;case`h24`:e+=1,n=null}return[n,e]}function Qa(e,t,n){switch(n){case`h11`:t===1&&(e+=12);break;case`h12`:e===12&&(e=0),t===1&&(e+=12);break;case`h24`:--e}return e}var $a={year:!0,month:!0,day:!0,hour:!0,minute:!0,second:!0,dayPeriod:!0,era:!0},eo={year:5,month:2,day:7,hour:2,minute:15,second:15},to={dayperiod:`dayPeriod`,relatedYear:`year`,yearName:`literal`,unknown:`literal`};function no(e){let{locale:t,createCalendar:n,hideTimeZone:r,isDisabled:i=!1,isReadOnly:a=!1,isRequired:o=!1,minValue:s,maxValue:c,isDateUnavailable:l}=e,u=e.value||e.defaultValue||e.placeholderValue||null,[d,f]=Ka(u,e.granularity),p=f||`UTC`;if(u&&!(d in u))throw Error(`Invalid granularity `+d+` for value `+u.toString());let[m,h]=(0,R.useMemo)(()=>{let r=new Y(t,{dateStyle:`short`,timeStyle:`short`,hour12:e.hourCycle==null?void 0:e.hourCycle===12}).resolvedOptions();return[n(r.calendar),r.hourCycle]},[t,e.hourCycle,n]),[g,_]=ce(e.value,e.defaultValue??null,e.onChange),[v]=(0,R.useState)(g),y=(0,R.useMemo)(()=>Wa(g,m)??null,[g,m]),[b,x]=(0,R.useState)(()=>new Ya(m,h,y)),S=m.identifier===`gregory`&&b.era===`BC`,C=(0,R.useMemo)(()=>({granularity:d,maxGranularity:e.maxGranularity??`year`,timeZone:f,hideTimeZone:r,hourCycle:e.hourCycle,showEra:S,shouldForceLeadingZeros:e.shouldForceLeadingZeros}),[e.maxGranularity,d,e.hourCycle,e.shouldForceLeadingZeros,f,r,S]),w=(0,R.useMemo)(()=>Ha({},C),[C]),T=(0,R.useMemo)(()=>new Y(t,w),[t,w]),E=(0,R.useMemo)(()=>T.resolvedOptions(),[T]),D=(0,R.useMemo)(()=>Ga(e.placeholderValue,d,m,f),[e.placeholderValue,d,m,f]),O=(0,R.useMemo)(()=>{let t=h===`h11`||h===`h12`,n=[`era`,`year`,`month`,`day`,`hour`,...t?[`dayPeriod`]:[],`minute`,`second`],r=n.indexOf(e.maxGranularity||`era`),i=n.indexOf(d===`hour`&&t?`dayPeriod`:d);return n.slice(r,i+1)},[e.maxGranularity,d,h]),[k,A]=(0,R.useState)(y),[ee,te]=(0,R.useState)(m),[j,ne]=(0,R.useState)(h);(y!==k||h!==j||!mt(m,ee))&&(b=new Ya(m,h,y),A(y),te(m),ne(h),x(b));let M=t=>{if(!(e.isDisabled||e.isReadOnly)){if(t==null||t instanceof Ya&&t.isCleared(O))x(new Ya(m,h,y)),_(null);else if(!(t instanceof Ya))t=G(t,u?.calendar||new z),x(new Ya(m,h,y)),_(t);else{if(t.isComplete(O)){let e=t.toValue(y??D);if(t.validate(e,O)){let t=G(e,u?.calendar||new z);if(!g||t.compare(g)!==0){x(new Ya(m,h,y)),_(t);return}}}x(t)}}},re=(0,R.useMemo)(()=>b.toValue(y??D).toDate(p),[b,p,y,D]),N=(0,R.useMemo)(()=>ro(re,b,T,E,m,t,d),[re,T,E,b,m,t,d]),ie=(e,t)=>{M(b.cycle(e,t,D,O))},P=(0,R.useMemo)(()=>Ra(g,s,c,l,C),[g,s,c,l,C]),ae=Oe({...e,value:g,builtinValidation:P}),oe=ae.displayValidation.isInvalid,se=e.validationState||(oe?`invalid`:null);return{...ae,value:y,defaultValue:e.defaultValue??v,dateValue:re,calendar:m,setValue:M,segments:N,dateFormatter:T,validationState:se,isInvalid:oe,granularity:d,maxGranularity:e.maxGranularity??`year`,isDisabled:i,isReadOnly:a,isRequired:o,increment(e){ie(e,1)},decrement(e){ie(e,-1)},incrementPage(e){ie(e,eo[e]||1)},decrementPage(e){ie(e,-(eo[e]||1))},incrementToMax(e){let t=e===`hour`&&h===`h12`?11:b.getSegmentLimits(e).maxValue;M(b.set(e,t,D))},decrementToMin(e){let t=e===`hour`&&h===`h12`?12:b.getSegmentLimits(e).minValue;M(b.set(e,t,D))},setSegment(e,t){M(b.set(e,t,D))},confirmPlaceholder(){if(!(e.isDisabled||e.isReadOnly)&&b.isComplete(O)){let e=G(b.toValue(y??D),u?.calendar||new z);(!g||e.compare(g)!==0)&&_(e),x(new Ya(m,h,y))}},clearSegment(e){let t=b;e!==`timeZoneName`&&e!==`literal`&&(t=b.clear(e)),M(t)},formatValue(e){if(!y)return``;let n=Ha(e,C);return new Y(t,n).format(re)},getDateFormatter(e,t){return new Y(e,Ha({},{...C,...t}))}}}function ro(e,t,n,r,i,a,o){let s=[`hour`,`minute`,`second`],c=n.formatToParts(e),l=new Fe(a,{useGrouping:!1}),u=new Fe(a,{useGrouping:!1,minimumIntegerDigits:2});for(let e of c)if(e.type===`year`||e.type===`month`||e.type===`day`||e.type===`hour`){let n=t[e.type]??0;e.value=r[e.type]===`2-digit`?u.format(n):l.format(n)}let d=[];for(let e of c){let n=to[e.type]||e.type,r=$a[n];n===`era`&&i.getEras().length===1&&(r=!1);let c=$a[n]&&t[e.type]==null,l=$a[n]?Ja(n,e.value,a):null,u={type:n,text:c?l:e.value,...t.getSegmentLimits(n),isPlaceholder:c,placeholder:l,isEditable:r};n===`hour`?(d.push({type:`literal`,text:`⁦`,isPlaceholder:!1,placeholder:``,isEditable:!1}),d.push(u),n===o&&d.push({type:`literal`,text:`⁩`,isPlaceholder:!1,placeholder:``,isEditable:!1})):s.includes(n)&&n===o?(d.push(u),d.push({type:`literal`,text:`⁩`,isPlaceholder:!1,placeholder:``,isEditable:!1})):d.push(u)}return d}function io(e){let{placeholderValue:t=new Ln,minValue:n,maxValue:r,defaultValue:i,granularity:a,validate:o}=e,[s,c]=ce(e.value,i??null,e.onChange),l=s||t,u=l&&`day`in l?l:void 0,d=i&&`timeZone`in i?i.timeZone:void 0,f=(0,R.useMemo)(()=>{let e=l&&`timeZone`in l?l.timeZone:void 0;return(e||d)&&t?Yt(ao(t),e||d):ao(t)},[t,l,d]),p=(0,R.useMemo)(()=>ao(n,u),[n,u]),m=(0,R.useMemo)(()=>ao(r,u),[r,u]),h=(0,R.useMemo)(()=>s&&`day`in s?Jt(s):s,[s]),g=(0,R.useMemo)(()=>s==null?null:ao(s),[s]),_=(0,R.useMemo)(()=>i==null?null:ao(i),[i]),v=e=>{c(u||d?e:e&&Jt(e))};return{...no({...e,value:g,defaultValue:_,minValue:p,maxValue:m,onChange:v,granularity:a||`minute`,maxGranularity:`hour`,placeholderValue:f??void 0,createCalendar:()=>new z,validate:(0,R.useCallback)(()=>o?.(s),[o,s])}),timeValue:h}}function ao(e,t=yt(Tt())){return e?`day`in e?e:W(t,e):null}var oo=(0,R.createContext)(null),so=(0,R.createContext)(null),co=(0,R.createContext)(null),lo=(0,R.createContext)(null),uo=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,oo);let{validationBehavior:n}=O(ve)||{},r=e.validationBehavior??n??`native`,{locale:i}=F(),a=no({...e,locale:i,createCalendar:Kr,validationBehavior:r}),o=(0,R.useRef)(null),[s,c]=A(!e[`aria-label`]&&!e[`aria-labelledby`]),l=(0,R.useRef)(null),{labelProps:u,fieldProps:d,inputProps:f,descriptionProps:m,errorMessageProps:h,...g}=Ki({...E(e),label:c,inputRef:l,validationBehavior:r},a,o),_=k({...E(e),values:{state:a,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1},defaultClassName:`react-aria-DateField`}),v=I(e,{global:!0});return delete v.id,R.createElement(x,{values:[[co,a],[ke,{...d,ref:o,isInvalid:a.isInvalid,isDisabled:a.isDisabled}],[Ne,{...f,ref:l}],[xe,{...u,ref:s,elementType:`span`}],[p,{slots:{description:m,errorMessage:h}}],[be,g]]},R.createElement(w.div,{...v,..._,ref:t,slot:e.slot||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0}),R.createElement(ii,{autoComplete:e.autoComplete,name:e.name,isDisabled:e.isDisabled,state:a}))}),fo=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,so);let{validationBehavior:n}=O(ve)||{},r=e.validationBehavior??n??`native`,{locale:i}=F(),a=io({...e,locale:i,validationBehavior:r}),o=(0,R.useRef)(null),[s,c]=A(!e[`aria-label`]&&!e[`aria-labelledby`]),l=(0,R.useRef)(null),{labelProps:u,fieldProps:d,inputProps:f,descriptionProps:m,errorMessageProps:h,...g}=qi({...E(e),label:c,inputRef:l,validationBehavior:r},a,o),_=k({...e,values:{state:a,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TimeField`}),v=I(e,{global:!0});return delete v.id,R.createElement(x,{values:[[lo,a],[ke,{...d,ref:o,isInvalid:a.isInvalid,isDisabled:a.isDisabled}],[Ne,{...f,ref:l}],[xe,{...u,ref:s,elementType:`span`}],[p,{slots:{description:m,errorMessage:h}}],[be,g]]},R.createElement(w.div,{...v,..._,ref:t,slot:e.slot||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0}))}),po=(0,R.forwardRef)(function(e,t){let n=(0,R.useContext)(co),r=(0,R.useContext)(lo);return n||r?R.createElement(ho,{...e,ref:t}):R.createElement(mo,{...e,ref:t})}),mo=(0,R.forwardRef)((e,t)=>{let[n,r]=se({slot:e.slot},t,oo),{locale:i}=F(),a=no({...n,locale:i,createCalendar:Kr}),o=(0,R.useRef)(null),{fieldProps:s,inputProps:c}=Ki({...n,inputRef:o},a,r);return R.createElement(x,{values:[[co,a],[Ne,{...c,ref:o}],[ke,{...s,ref:r,isInvalid:a.isInvalid,isDisabled:a.isDisabled}]]},R.createElement(ho,e))}),ho=(0,R.forwardRef)((e,t)=>{let{className:n,children:r}=e,i=(0,R.useContext)(co),a=(0,R.useContext)(lo),o=i??a;return R.createElement(R.Fragment,null,R.createElement(Ae,{...e,ref:t,slot:e.slot||void 0,className:n??`react-aria-DateInput`,isReadOnly:o.isReadOnly,isInvalid:o.isInvalid,isDisabled:o.isDisabled},o.segments.map((e,t)=>(0,R.cloneElement)(r(e),{key:t}))),R.createElement(je,{className:``}))}),go=(0,R.forwardRef)(function({segment:e,...t},n){let r=(0,R.useContext)(co),i=(0,R.useContext)(lo),a=r??i,o=T(n),{segmentProps:s}=Qi(e,a,o),{focusProps:c,isFocused:l,isFocusVisible:u}=P(),{hoverProps:d,isHovered:f}=pe({...t,isDisabled:a.isDisabled||e.type===`literal`}),p=k({...t,values:{...e,isReadOnly:a.isReadOnly,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isHovered:f,isFocused:l,isFocusVisible:u},defaultChildren:e.text,defaultClassName:`react-aria-DateSegment`});return R.createElement(w.span,{...D(I(t,{global:!0}),s,c,d),...p,style:s.style,ref:o,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":a.isInvalid||void 0,"data-readonly":a.isReadOnly||void 0,"data-disabled":a.isDisabled||void 0,"data-type":e.type,"data-hovered":f||void 0,"data-focused":l||void 0,"data-focus-visible":u||void 0})}),_o=(0,R.createContext)({}),vo=({children:e,className:t,fullWidth:n,variant:r,...i})=>{let a=R.useMemo(()=>et({fullWidth:n,variant:r}),[n,r]);return(0,X.jsx)(_o,{value:{slots:a},children:(0,X.jsx)(Ae,{className:N(t,a?.base()),"data-slot":`date-input-group`,...i,children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})})},yo=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(S.div,{className:L(r?.prefix,t),"data-slot":`date-input-group-prefix`,...n,children:e})},bo=({className:e,...t})=>{let{slots:n}=(0,R.use)(_o);return(0,X.jsx)(po,{className:N(e,n?.input()),"data-slot":`date-input-group-input`,...t})},xo=({className:e,segment:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(go,{className:L(r?.segment,e),"data-slot":`date-input-group-segment`,segment:t,...n})},So=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(S.div,{className:L(r?.inputContainer,t),"data-slot":`date-input-group-input-container`,...n,children:e})},Co=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(S.div,{className:L(r?.suffix,t),"data-slot":`date-input-group-suffix`,...n,children:e})};function wo({children:e,className:t,fullWidth:n,...r}){let i=R.useMemo(()=>Qe({fullWidth:n}),[n]);return(0,X.jsx)(uo,{"data-required":Le(r.isRequired),"data-slot":`date-field`,...r,className:N(t,i),children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})}var To=Object.assign(wo,{Root:wo,Group:vo,Input:bo,InputContainer:So,Segment:xo,Prefix:yo,Suffix:Co}),Eo={};Eo={dateRange:e=>`${e.startDate} \u{625}\u{644}\u{649} ${e.endDate}`,dateSelected:e=>`${e.date} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}`,finishRangeSelectionPrompt:`انقر لإنهاء عملية تحديد نطاق التاريخ`,maximumDate:`آخر تاريخ متاح`,minimumDate:`أول تاريخ متاح`,next:`التالي`,previous:`السابق`,selectedDateDescription:e=>`\u{62A}\u{627}\u{631}\u{64A}\u{62E} \u{645}\u{62D}\u{62F}\u{62F}: ${e.date}`,selectedRangeDescription:e=>`\u{627}\u{644}\u{645}\u{62F}\u{649} \u{627}\u{644}\u{632}\u{645}\u{646}\u{64A} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}: ${e.dateRange}`,startRangeSelectionPrompt:`انقر لبدء عملية تحديد نطاق التاريخ`,todayDate:e=>`\u{627}\u{644}\u{64A}\u{648}\u{645}\u{60C} ${e.date}`,todayDateSelected:e=>`\u{627}\u{644}\u{64A}\u{648}\u{645}\u{60C} ${e.date} \u{645}\u{62D}\u{62F}\u{62F}`};var Do={};Do={dateRange:e=>`${e.startDate} \u{434}\u{43E} ${e.endDate}`,dateSelected:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{43E} \u{435} ${e.date}`,finishRangeSelectionPrompt:`Натиснете, за да довършите избора на времеви интервал`,maximumDate:`Последна налична дата`,minimumDate:`Първа налична дата`,next:`Напред`,previous:`Назад`,selectedDateDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.dateRange}`,startRangeSelectionPrompt:`Натиснете, за да пристъпите към избора на времеви интервал`,todayDate:e=>`\u{414}\u{43D}\u{435}\u{441}, ${e.date}`,todayDateSelected:e=>`\u{414}\u{43D}\u{435}\u{441}, ${e.date} \u{441}\u{430} \u{438}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{438}`};var Oo={};Oo={dateRange:e=>`${e.startDate} a\u{17E} ${e.endDate}`,dateSelected:e=>`Vybr\xe1no ${e.date}`,finishRangeSelectionPrompt:`Kliknutím dokončíte výběr rozsahu dat`,maximumDate:`Poslední dostupné datum`,minimumDate:`První dostupné datum`,next:`Další`,previous:`Předchozí`,selectedDateDescription:e=>`Vybran\xe9 datum: ${e.date}`,selectedRangeDescription:e=>`Vybran\xe9 obdob\xed: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknutím zahájíte výběr rozsahu dat`,todayDate:e=>`Dnes, ${e.date}`,todayDateSelected:e=>`Dnes, vybr\xe1no ${e.date}`};var ko={};ko={dateRange:e=>`${e.startDate} til ${e.endDate}`,dateSelected:e=>`${e.date} valgt`,finishRangeSelectionPrompt:`Klik for at fuldføre valg af datoområde`,maximumDate:`Sidste ledige dato`,minimumDate:`Første ledige dato`,next:`Næste`,previous:`Forrige`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt interval: ${e.dateRange}`,startRangeSelectionPrompt:`Klik for at starte valg af datoområde`,todayDate:e=>`I dag, ${e.date}`,todayDateSelected:e=>`I dag, ${e.date} valgt`};var Ao={};Ao={dateRange:e=>`${e.startDate} bis ${e.endDate}`,dateSelected:e=>`${e.date} ausgew\xe4hlt`,finishRangeSelectionPrompt:`Klicken, um die Auswahl des Datumsbereichs zu beenden`,maximumDate:`Letztes verfügbares Datum`,minimumDate:`Erstes verfügbares Datum`,next:`Weiter`,previous:`Zurück`,selectedDateDescription:e=>`Ausgew\xe4hltes Datum: ${e.date}`,selectedRangeDescription:e=>`Ausgew\xe4hlter Bereich: ${e.dateRange}`,startRangeSelectionPrompt:`Klicken, um die Auswahl des Datumsbereichs zu beginnen`,todayDate:e=>`Heute, ${e.date}`,todayDateSelected:e=>`Heute, ${e.date} ausgew\xe4hlt`};var jo={};jo={dateRange:e=>`${e.startDate} \u{3AD}\u{3C9}\u{3C2} ${e.endDate}`,dateSelected:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3B8}\u{3B7}\u{3BA}\u{3B5} ${e.date}`,finishRangeSelectionPrompt:`Κάντε κλικ για να ολοκληρώσετε την επιλογή εύρους ημερομηνιών`,maximumDate:`Τελευταία διαθέσιμη ημερομηνία`,minimumDate:`Πρώτη διαθέσιμη ημερομηνία`,next:`Επόμενο`,previous:`Προηγούμενο`,selectedDateDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3B7} \u{3B7}\u{3BC}\u{3B5}\u{3C1}\u{3BF}\u{3BC}\u{3B7}\u{3BD}\u{3AF}\u{3B1}: ${e.date}`,selectedRangeDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3BF} \u{3B5}\u{3CD}\u{3C1}\u{3BF}\u{3C2}: ${e.dateRange}`,startRangeSelectionPrompt:`Κάντε κλικ για να ξεκινήσετε την επιλογή εύρους ημερομηνιών`,todayDate:e=>`\u{3A3}\u{3AE}\u{3BC}\u{3B5}\u{3C1}\u{3B1}, ${e.date}`,todayDateSelected:e=>`\u{3A3}\u{3AE}\u{3BC}\u{3B5}\u{3C1}\u{3B1}, \u{3B5}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3C4}\u{3B7}\u{3BA}\u{3B5} ${e.date}`};var Mo={};Mo={previous:`Previous`,next:`Next`,selectedDateDescription:e=>`Selected Date: ${e.date}`,selectedRangeDescription:e=>`Selected Range: ${e.dateRange}`,todayDate:e=>`Today, ${e.date}`,todayDateSelected:e=>`Today, ${e.date} selected`,dateSelected:e=>`${e.date} selected`,startRangeSelectionPrompt:`Click to start selecting date range`,finishRangeSelectionPrompt:`Click to finish selecting date range`,minimumDate:`First available date`,maximumDate:`Last available date`,dateRange:e=>`${e.startDate} to ${e.endDate}`};var No={};No={dateRange:e=>`${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} seleccionado`,finishRangeSelectionPrompt:`Haga clic para terminar de seleccionar rango de fechas`,maximumDate:`Última fecha disponible`,minimumDate:`Primera fecha disponible`,next:`Siguiente`,previous:`Anterior`,selectedDateDescription:e=>`Fecha seleccionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo seleccionado: ${e.dateRange}`,startRangeSelectionPrompt:`Haga clic para comenzar a seleccionar un rango de fechas`,todayDate:e=>`Hoy, ${e.date}`,todayDateSelected:e=>`Hoy, ${e.date} seleccionado`};var Po={};Po={dateRange:e=>`${e.startDate} kuni ${e.endDate}`,dateSelected:e=>`${e.date} valitud`,finishRangeSelectionPrompt:`Klõpsake kuupäevavahemiku valimise lõpetamiseks`,maximumDate:`Viimane saadaolev kuupäev`,minimumDate:`Esimene saadaolev kuupäev`,next:`Järgmine`,previous:`Eelmine`,selectedDateDescription:e=>`Valitud kuup\xe4ev: ${e.date}`,selectedRangeDescription:e=>`Valitud vahemik: ${e.dateRange}`,startRangeSelectionPrompt:`Klõpsake kuupäevavahemiku valimiseks`,todayDate:e=>`T\xe4na, ${e.date}`,todayDateSelected:e=>`T\xe4na, ${e.date} valitud`};var Fo={};Fo={dateRange:e=>`${e.startDate} \u{2013} ${e.endDate}`,dateSelected:e=>`${e.date} valittu`,finishRangeSelectionPrompt:`Lopeta päivämääräalueen valinta napsauttamalla tätä.`,maximumDate:`Viimeinen varattavissa oleva päivämäärä`,minimumDate:`Ensimmäinen varattavissa oleva päivämäärä`,next:`Seuraava`,previous:`Edellinen`,selectedDateDescription:e=>`Valittu p\xe4iv\xe4m\xe4\xe4r\xe4: ${e.date}`,selectedRangeDescription:e=>`Valittu aikav\xe4li: ${e.dateRange}`,startRangeSelectionPrompt:`Aloita päivämääräalueen valinta napsauttamalla tätä.`,todayDate:e=>`T\xe4n\xe4\xe4n, ${e.date}`,todayDateSelected:e=>`T\xe4n\xe4\xe4n, ${e.date} valittu`};var Io={};Io={dateRange:e=>`${e.startDate} \xe0 ${e.endDate}`,dateSelected:e=>`${e.date} s\xe9lectionn\xe9`,finishRangeSelectionPrompt:`Cliquer pour finir de sélectionner la plage de dates`,maximumDate:`Dernière date disponible`,minimumDate:`Première date disponible`,next:`Suivant`,previous:`Précédent`,selectedDateDescription:e=>`Date s\xe9lectionn\xe9e\xa0: ${e.date}`,selectedRangeDescription:e=>`Plage s\xe9lectionn\xe9e\xa0: ${e.dateRange}`,startRangeSelectionPrompt:`Cliquer pour commencer à sélectionner la plage de dates`,todayDate:e=>`Aujourd'hui, ${e.date}`,todayDateSelected:e=>`Aujourd\u{2019}hui, ${e.date} s\xe9lectionn\xe9`};var Lo={};Lo={dateRange:e=>`${e.startDate} \u{5E2}\u{5D3} ${e.endDate}`,dateSelected:e=>`${e.date} \u{5E0}\u{5D1}\u{5D7}\u{5E8}`,finishRangeSelectionPrompt:`חץ כדי לסיים את בחירת טווח התאריכים`,maximumDate:`תאריך פנוי אחרון`,minimumDate:`תאריך פנוי ראשון`,next:`הבא`,previous:`הקודם`,selectedDateDescription:e=>`\u{5EA}\u{5D0}\u{5E8}\u{5D9}\u{5DA} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.date}`,selectedRangeDescription:e=>`\u{5D8}\u{5D5}\u{5D5}\u{5D7} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.dateRange}`,startRangeSelectionPrompt:`לחץ כדי להתחיל בבחירת טווח התאריכים`,todayDate:e=>`\u{5D4}\u{5D9}\u{5D5}\u{5DD}, ${e.date}`,todayDateSelected:e=>`\u{5D4}\u{5D9}\u{5D5}\u{5DD}, ${e.date} \u{5E0}\u{5D1}\u{5D7}\u{5E8}`};var Ro={};Ro={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`${e.date} odabran`,finishRangeSelectionPrompt:`Kliknite da dovršite raspon odabranih datuma`,maximumDate:`Posljednji raspoloživi datum`,minimumDate:`Prvi raspoloživi datum`,next:`Sljedeći`,previous:`Prethodni`,selectedDateDescription:e=>`Odabrani datum: ${e.date}`,selectedRangeDescription:e=>`Odabrani raspon: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknite da započnete raspon odabranih datuma`,todayDate:e=>`Danas, ${e.date}`,todayDateSelected:e=>`Danas, odabran ${e.date}`};var zo={};zo={dateRange:e=>`${e.startDate}\u{2013}${e.endDate}`,dateSelected:e=>`${e.date} kiv\xe1lasztva`,finishRangeSelectionPrompt:`Kattintson a dátumtartomány kijelölésének befejezéséhez`,maximumDate:`Utolsó elérhető dátum`,minimumDate:`Az első elérhető dátum`,next:`Következő`,previous:`Előző`,selectedDateDescription:e=>`Kijel\xf6lt d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Kijel\xf6lt tartom\xe1ny: ${e.dateRange}`,startRangeSelectionPrompt:`Kattintson a dátumtartomány kijelölésének indításához`,todayDate:e=>`Ma, ${e.date}`,todayDateSelected:e=>`Ma, ${e.date} kijel\xf6lve`};var Bo={};Bo={dateRange:e=>`Da ${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} selezionata`,finishRangeSelectionPrompt:`Fai clic per completare la selezione dell’intervallo di date`,maximumDate:`Ultima data disponibile`,minimumDate:`Prima data disponibile`,next:`Successivo`,previous:`Precedente`,selectedDateDescription:e=>`Data selezionata: ${e.date}`,selectedRangeDescription:e=>`Intervallo selezionato: ${e.dateRange}`,startRangeSelectionPrompt:`Fai clic per selezionare l’intervallo di date`,todayDate:e=>`Oggi, ${e.date}`,todayDateSelected:e=>`Oggi, ${e.date} selezionata`};var Vo={};Vo={dateRange:e=>`${e.startDate} \u{304B}\u{3089} ${e.endDate}`,dateSelected:e=>`${e.date} \u{3092}\u{9078}\u{629E}`,finishRangeSelectionPrompt:`クリックして日付範囲の選択を終了`,maximumDate:`最終利用可能日`,minimumDate:`最初の利用可能日`,next:`次へ`,previous:`前へ`,selectedDateDescription:e=>`\u{9078}\u{629E}\u{3057}\u{305F}\u{65E5}\u{4ED8} : ${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{629E}\u{7BC4}\u{56F2} : ${e.dateRange}`,startRangeSelectionPrompt:`クリックして日付範囲の選択を開始`,todayDate:e=>`\u{672C}\u{65E5}\u{3001}${e.date}`,todayDateSelected:e=>`\u{672C}\u{65E5}\u{3001}${e.date} \u{3092}\u{9078}\u{629E}`};var Ho={};Ho={dateRange:e=>`${e.startDate} ~ ${e.endDate}`,dateSelected:e=>`${e.date} \u{C120}\u{D0DD}\u{B428}`,finishRangeSelectionPrompt:`날짜 범위 선택을 완료하려면 클릭하십시오.`,maximumDate:`마지막으로 사용 가능한 일자`,minimumDate:`처음으로 사용 가능한 일자`,next:`다음`,previous:`이전`,selectedDateDescription:e=>`\u{C120}\u{D0DD} \u{C77C}\u{C790}: ${e.date}`,selectedRangeDescription:e=>`\u{C120}\u{D0DD} \u{BC94}\u{C704}: ${e.dateRange}`,startRangeSelectionPrompt:`날짜 범위 선택을 시작하려면 클릭하십시오.`,todayDate:e=>`\u{C624}\u{B298}, ${e.date}`,todayDateSelected:e=>`\u{C624}\u{B298}, ${e.date} \u{C120}\u{D0DD}\u{B428}`};var Uo={};Uo={dateRange:e=>`Nuo ${e.startDate} iki ${e.endDate}`,dateSelected:e=>`Pasirinkta ${e.date}`,finishRangeSelectionPrompt:`Spustelėkite, kad baigtumėte pasirinkti datų intervalą`,maximumDate:`Paskutinė galima data`,minimumDate:`Pirmoji galima data`,next:`Paskesnis`,previous:`Ankstesnis`,selectedDateDescription:e=>`Pasirinkta data: ${e.date}`,selectedRangeDescription:e=>`Pasirinktas intervalas: ${e.dateRange}`,startRangeSelectionPrompt:`Spustelėkite, kad pradėtumėte pasirinkti datų intervalą`,todayDate:e=>`\u{160}iandien, ${e.date}`,todayDateSelected:e=>`\u{160}iandien, pasirinkta ${e.date}`};var Wo={};Wo={dateRange:e=>`No ${e.startDate} l\u{12B}dz ${e.endDate}`,dateSelected:e=>`Atlas\u{12B}ts: ${e.date}`,finishRangeSelectionPrompt:`Noklikšķiniet, lai pabeigtu datumu diapazona atlasi`,maximumDate:`Pēdējais pieejamais datums`,minimumDate:`Pirmais pieejamais datums`,next:`Tālāk`,previous:`Atpakaļ`,selectedDateDescription:e=>`Atlas\u{12B}tais datums: ${e.date}`,selectedRangeDescription:e=>`Atlas\u{12B}tais diapazons: ${e.dateRange}`,startRangeSelectionPrompt:`Noklikšķiniet, lai sāktu datumu diapazona atlasi`,todayDate:e=>`\u{160}odien, ${e.date}`,todayDateSelected:e=>`Atlas\u{12B}ta \u{161}odiena, ${e.date}`};var Go={};Go={dateRange:e=>`${e.startDate} til ${e.endDate}`,dateSelected:e=>`${e.date} valgt`,finishRangeSelectionPrompt:`Klikk for å fullføre valg av datoområde`,maximumDate:`Siste tilgjengelige dato`,minimumDate:`Første tilgjengelige dato`,next:`Neste`,previous:`Forrige`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt omr\xe5de: ${e.dateRange}`,startRangeSelectionPrompt:`Klikk for å starte valg av datoområde`,todayDate:e=>`I dag, ${e.date}`,todayDateSelected:e=>`I dag, ${e.date} valgt`};var Ko={};Ko={dateRange:e=>`${e.startDate} tot ${e.endDate}`,dateSelected:e=>`${e.date} geselecteerd`,finishRangeSelectionPrompt:`Klik om de selectie van het datumbereik te voltooien`,maximumDate:`Laatste beschikbare datum`,minimumDate:`Eerste beschikbare datum`,next:`Volgende`,previous:`Vorige`,selectedDateDescription:e=>`Geselecteerde datum: ${e.date}`,selectedRangeDescription:e=>`Geselecteerd bereik: ${e.dateRange}`,startRangeSelectionPrompt:`Klik om het datumbereik te selecteren`,todayDate:e=>`Vandaag, ${e.date}`,todayDateSelected:e=>`Vandaag, ${e.date} geselecteerd`};var qo={};qo={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`Wybrano ${e.date}`,finishRangeSelectionPrompt:`Kliknij, aby zakończyć wybór zakresu dat`,maximumDate:`Ostatnia dostępna data`,minimumDate:`Pierwsza dostępna data`,next:`Dalej`,previous:`Wstecz`,selectedDateDescription:e=>`Wybrana data: ${e.date}`,selectedRangeDescription:e=>`Wybrany zakres: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknij, aby rozpocząć wybór zakresu dat`,todayDate:e=>`Dzisiaj, ${e.date}`,todayDateSelected:e=>`Dzisiaj wybrano ${e.date}`};var Jo={};Jo={dateRange:e=>`${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} selecionado`,finishRangeSelectionPrompt:`Clique para concluir a seleção do intervalo de datas`,maximumDate:`Última data disponível`,minimumDate:`Primeira data disponível`,next:`Próximo`,previous:`Anterior`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.dateRange}`,startRangeSelectionPrompt:`Clique para iniciar a seleção do intervalo de datas`,todayDate:e=>`Hoje, ${e.date}`,todayDateSelected:e=>`Hoje, ${e.date} selecionado`};var Yo={};Yo={dateRange:e=>`${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} selecionado`,finishRangeSelectionPrompt:`Clique para terminar de selecionar o intervalo de datas`,maximumDate:`Última data disponível`,minimumDate:`Primeira data disponível`,next:`Próximo`,previous:`Anterior`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.dateRange}`,startRangeSelectionPrompt:`Clique para começar a selecionar o intervalo de datas`,todayDate:e=>`Hoje, ${e.date}`,todayDateSelected:e=>`Hoje, ${e.date} selecionado`};var Xo={};Xo={dateRange:e=>`De la ${e.startDate} p\xe2n\u{103} la ${e.endDate}`,dateSelected:e=>`${e.date} selectat\u{103}`,finishRangeSelectionPrompt:`Apăsaţi pentru a finaliza selecţia razei pentru dată`,maximumDate:`Ultima dată disponibilă`,minimumDate:`Prima dată disponibilă`,next:`Următorul`,previous:`Înainte`,selectedDateDescription:e=>`Dat\u{103} selectat\u{103}: ${e.date}`,selectedRangeDescription:e=>`Interval selectat: ${e.dateRange}`,startRangeSelectionPrompt:`Apăsaţi pentru a începe selecţia razei pentru dată`,todayDate:e=>`Ast\u{103}zi, ${e.date}`,todayDateSelected:e=>`Azi, ${e.date} selectat\u{103}`};var Zo={};Zo={dateRange:e=>`\u{421} ${e.startDate} \u{43F}\u{43E} ${e.endDate}`,dateSelected:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`,finishRangeSelectionPrompt:`Щелкните, чтобы завершить выбор диапазона дат`,maximumDate:`Последняя доступная дата`,minimumDate:`Первая доступная дата`,next:`Далее`,previous:`Назад`,selectedDateDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{430}\u{44F} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{44B}\u{439} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.dateRange}`,startRangeSelectionPrompt:`Щелкните, чтобы начать выбор диапазона дат`,todayDate:e=>`\u{421}\u{435}\u{433}\u{43E}\u{434}\u{43D}\u{44F}, ${e.date}`,todayDateSelected:e=>`\u{421}\u{435}\u{433}\u{43E}\u{434}\u{43D}\u{44F}, \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`};var Qo={};Qo={dateRange:e=>`Od ${e.startDate} do ${e.endDate}`,dateSelected:e=>`Vybrat\xfd d\xe1tum ${e.date}`,finishRangeSelectionPrompt:`Kliknutím dokončíte výber rozsahu dátumov`,maximumDate:`Posledný dostupný dátum`,minimumDate:`Prvý dostupný dátum`,next:`Nasledujúce`,previous:`Predchádzajúce`,selectedDateDescription:e=>`Vybrat\xfd d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Vybrat\xfd rozsah: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknutím spustíte výber rozsahu dátumov`,todayDate:e=>`Dnes ${e.date}`,todayDateSelected:e=>`Vybrat\xfd dne\u{161}n\xfd d\xe1tum ${e.date}`};var $o={};$o={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`${e.date} izbrano`,finishRangeSelectionPrompt:`Kliknite za dokončanje izbire datumskega obsega`,maximumDate:`Zadnji razpoložljivi datum`,minimumDate:`Prvi razpoložljivi datum`,next:`Naprej`,previous:`Nazaj`,selectedDateDescription:e=>`Izbrani datum: ${e.date}`,selectedRangeDescription:e=>`Izbrano obmo\u{10D}je: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknite za začetek izbire datumskega obsega`,todayDate:e=>`Danes, ${e.date}`,todayDateSelected:e=>`Danes, ${e.date} izbrano`};var es={};es={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`${e.date} izabran`,finishRangeSelectionPrompt:`Kliknite da dovršite opseg izabranih datuma`,maximumDate:`Zadnji raspoloživi datum`,minimumDate:`Prvi raspoloživi datum`,next:`Sledeći`,previous:`Prethodni`,selectedDateDescription:e=>`Izabrani datum: ${e.date}`,selectedRangeDescription:e=>`Izabrani period: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknite da započnete opseg izabranih datuma`,todayDate:e=>`Danas, ${e.date}`,todayDateSelected:e=>`Danas, izabran ${e.date}`};var ts={};ts={dateRange:e=>`${e.startDate} till ${e.endDate}`,dateSelected:e=>`${e.date} har valts`,finishRangeSelectionPrompt:`Klicka för att avsluta val av datumintervall`,maximumDate:`Sista tillgängliga datum`,minimumDate:`Första tillgängliga datum`,next:`Nästa`,previous:`Föregående`,selectedDateDescription:e=>`Valt datum: ${e.date}`,selectedRangeDescription:e=>`Valt intervall: ${e.dateRange}`,startRangeSelectionPrompt:`Klicka för att välja datumintervall`,todayDate:e=>`Idag, ${e.date}`,todayDateSelected:e=>`Idag, ${e.date} har valts`};var ns={};ns={dateRange:e=>`${e.startDate} - ${e.endDate}`,dateSelected:e=>`${e.date} se\xe7ildi`,finishRangeSelectionPrompt:`Tarih aralığı seçimini tamamlamak için tıklayın`,maximumDate:`Son müsait tarih`,minimumDate:`İlk müsait tarih`,next:`Sonraki`,previous:`Önceki`,selectedDateDescription:e=>`Se\xe7ilen Tarih: ${e.date}`,selectedRangeDescription:e=>`Se\xe7ilen Aral\u{131}k: ${e.dateRange}`,startRangeSelectionPrompt:`Tarih aralığı seçimini başlatmak için tıklayın`,todayDate:e=>`Bug\xfcn, ${e.date}`,todayDateSelected:e=>`Bug\xfcn, ${e.date} se\xe7ildi`};var rs={};rs={dateRange:e=>`${e.startDate} \u{2014} ${e.endDate}`,dateSelected:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`,finishRangeSelectionPrompt:`Натисніть, щоб завершити вибір діапазону дат`,maximumDate:`Остання доступна дата`,minimumDate:`Перша доступна дата`,next:`Наступний`,previous:`Попередній`,selectedDateDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{438}\u{439} \u{434}\u{456}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.dateRange}`,startRangeSelectionPrompt:`Натисніть, щоб почати вибір діапазону дат`,todayDate:e=>`\u{421}\u{44C}\u{43E}\u{433}\u{43E}\u{434}\u{43D}\u{456}, ${e.date}`,todayDateSelected:e=>`\u{421}\u{44C}\u{43E}\u{433}\u{43E}\u{434}\u{43D}\u{456}, \u{432}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`};var is={};is={dateRange:e=>`${e.startDate} \u{81F3} ${e.endDate}`,dateSelected:e=>`\u{5DF2}\u{9009}\u{62E9} ${e.date}`,finishRangeSelectionPrompt:`单击以完成选择日期范围`,maximumDate:`最后一个可用日期`,minimumDate:`第一个可用日期`,next:`下一页`,previous:`上一页`,selectedDateDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{8303}\u{56F4}\u{FF1A}${e.dateRange}`,startRangeSelectionPrompt:`单击以开始选择日期范围`,todayDate:e=>`\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${e.date}`,todayDateSelected:e=>`\u{5DF2}\u{9009}\u{62E9}\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${e.date}`};var as={};as={dateRange:e=>`${e.startDate} \u{81F3} ${e.endDate}`,dateSelected:e=>`\u{5DF2}\u{9078}\u{53D6} ${e.date}`,finishRangeSelectionPrompt:`按一下以完成選取日期範圍`,maximumDate:`最後一個可用日期`,minimumDate:`第一個可用日期`,next:`下一頁`,previous:`上一頁`,selectedDateDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{7BC4}\u{570D}\u{FF1A}${e.dateRange}`,startRangeSelectionPrompt:`按一下以開始選取日期範圍`,todayDate:e=>`\u{4ECA}\u{5929}\u{FF0C}${e.date}`,todayDateSelected:e=>`\u{5DF2}\u{9078}\u{53D6}\u{4ECA}\u{5929}\u{FF0C}${e.date}`};var os={};os={"ar-AE":Eo,"bg-BG":Do,"cs-CZ":Oo,"da-DK":ko,"de-DE":Ao,"el-GR":jo,"en-US":Mo,"es-ES":No,"et-EE":Po,"fi-FI":Fo,"fr-FR":Io,"he-IL":Lo,"hr-HR":Ro,"hu-HU":zo,"it-IT":Bo,"ja-JP":Vo,"ko-KR":Ho,"lt-LT":Uo,"lv-LV":Wo,"nb-NO":Go,"nl-NL":Ko,"pl-PL":qo,"pt-BR":Jo,"pt-PT":Yo,"ro-RO":Xo,"ru-RU":Zo,"sk-SK":Qo,"sl-SI":$o,"sr-SP":es,"sv-SE":ts,"tr-TR":ns,"uk-UA":rs,"zh-CN":is,"zh-TW":as};function ss(e){return e&&e.__esModule?e.default:e}var cs=new WeakMap;function ls(e){return e?.calendar.identifier===`gregory`&&e.era===`BC`?`short`:void 0}function us(e){let t=h(ss(os),`@react-aria/calendar`),n,r;`highlightedRange`in e?{start:n,end:r}=e.highlightedRange||{}:(n=Array.isArray(e.value)?e.value[0]:e.value??void 0,r=Array.isArray(e.value)?e.value.at(-1):e.value??void 0);let i=Z({weekday:`long`,month:`long`,year:`numeric`,day:`numeric`,era:ls(n)||ls(r),timeZone:e.timeZone}),{locale:a}=F(),o=(0,R.useMemo)(()=>new Intl.ListFormat(a),[a]),s=`anchorDate`in e?e.anchorDate:null;return(0,R.useMemo)(()=>{if(!s&&n&&r){if(B(n,r)){let r=i.format(n.toDate(e.timeZone));return t.format(`selectedDateDescription`,{date:r})}if(`highlightedRange`in e){let a=fs(i,t,n,r,e.timeZone);return t.format(`selectedRangeDescription`,{dateRange:a})}if(Array.isArray(e.value)){let n=e.value.map(t=>i.format(t.toDate(e.timeZone))),r=o.format(n);return t.format(`selectedDateDescription`,{date:r})}}return``},[n,r,s,e,t,i,o])}function ds(e,t,n,r){let i=h(ss(os),`@react-aria/calendar`),a=ls(e)||ls(t),o=Z({month:`long`,year:`numeric`,era:a,calendar:e.calendar.identifier,timeZone:n}),s=Z({month:`long`,year:`numeric`,day:`numeric`,era:a,calendar:e.calendar.identifier,timeZone:n});return(0,R.useMemo)(()=>{if(B(e,Dt(e))){let a=e,s=t;if(e.calendar.getFormattableMonth&&(a=e.calendar.getFormattableMonth(e)),t.calendar.getFormattableMonth&&(s=t.calendar.getFormattableMonth(t)),B(t,Ot(e)))return o.format(a.toDate(n));if(B(t,Ot(t)))return r?fs(o,i,a,s,n):o.formatRange(a.toDate(n),s.toDate(n))}return r?fs(s,i,e,t,n):s.formatRange(e.toDate(n),t.toDate(n))},[e,t,o,s,i,n,r])}function fs(e,t,n,r,i){let a=e.formatRangeToParts(n.toDate(i),r.toDate(i)),o=-1;for(let e=0;eo&&(c+=a[e].value);return t.format(`dateRange`,{startDate:s,endDate:c})}function ps(e){return e&&e.__esModule?e.default:e}function ms(e,t){let n=h(ps(os),`@react-aria/calendar`),r=I(e),i=ds(t.visibleRange.start,t.visibleRange.end,t.timeZone,!1),a=ds(t.visibleRange.start,t.visibleRange.end,t.timeZone,!0);_e(()=>{t.isFocused||l(a)},[a]);let o=us(t);_e(()=>{o&&l(o,`polite`,4e3)},[o]);let s=ie([!!e.errorMessage,e.isInvalid,e.validationState]);cs.set(t,{ariaLabel:e[`aria-label`],ariaLabelledBy:e[`aria-labelledby`],errorMessageId:s,selectedDateDescription:o});let[c,u]=(0,R.useState)(!1),d=e.isDisabled||t.isNextVisibleRangeInvalid();d&&c&&(u(!1),t.setFocused(!0));let[f,p]=(0,R.useState)(!1),m=e.isDisabled||t.isPreviousVisibleRangeInvalid();m&&f&&(p(!1),t.setFocused(!0));let g=_({id:e.id,"aria-label":[e[`aria-label`],a].filter(Boolean).join(`, `),"aria-labelledby":e[`aria-labelledby`]});return{calendarProps:D(r,g,{role:`application`,"aria-details":e[`aria-details`]||void 0,"aria-describedby":e[`aria-describedby`]||void 0}),nextButtonProps:{onPress:()=>t.focusNextPage(),"aria-label":n.format(`next`),isDisabled:d,onFocusChange:u},prevButtonProps:{onPress:()=>t.focusPreviousPage(),"aria-label":n.format(`previous`),isDisabled:m,onFocusChange:p},errorMessageProps:{id:s},title:i}}function hs(e,t){let{startDate:n=t.visibleRange.start,endDate:r=t.visibleRange.end,firstDayOfWeek:i}=e,{direction:a}=F(),{keyboardProps:o}=he({shortcuts:{End:()=>{t.focusSectionEnd()},Home:()=>{t.focusSectionStart()},Escape:()=>(`setAnchorDate`in t&&t.setAnchorDate(null),!1)}}),{keyboardProps:s}=he({shortcuts:{Enter:()=>{t.selectFocusedDate()}," ":()=>{t.selectFocusedDate()},PageUp:()=>{t.focusPreviousSection()},"Shift+PageUp":()=>{t.focusPreviousSection(!0)},PageDown:()=>{t.focusNextSection()},"Shift+PageDown":()=>{t.focusNextSection(!0)},ArrowLeft:()=>{a===`rtl`?t.focusNextDay():t.focusPreviousDay()},ArrowUp:()=>{t.focusPreviousRow()},ArrowRight:()=>{a===`rtl`?t.focusPreviousDay():t.focusNextDay()},ArrowDown:()=>{t.focusNextRow()}},allowRepeats:!0}),c=ds(n,r,t.timeZone,!0),{ariaLabel:l,ariaLabelledBy:u}=cs.get(t),d=_({"aria-label":[l,c].filter(Boolean).join(`, `),"aria-labelledby":u}),f=Z({weekday:e.weekdayStyle||`narrow`,timeZone:t.timeZone}),{locale:p}=F(),m=(0,R.useMemo)(()=>{let e=t.visibleDuration.days&&t.visibleDuration.days<7,r=e?n:At(yt(t.timeZone),p,i),a=e?t.visibleDuration.days:7;return[...Array(a).keys()].map(e=>{let n=r.add({days:e}).toDate(t.timeZone);return f.format(n)})},[p,t.timeZone,f,i,n,t.visibleDuration.days]),h=t.getWeeksInMonth(n);return{gridProps:D(d,{role:`grid`,"aria-readonly":t.isReadOnly||void 0,"aria-disabled":t.isDisabled||void 0,"aria-multiselectable":`highlightedRange`in t||t.selectionMode===`multiple`||void 0,onFocus:()=>t.setFocused(!0),onBlur:()=>t.setFocused(!1)},o,s),headerProps:{"aria-hidden":!0},weekDays:m,weeksInMonth:h}}function gs(e){return e&&e.__esModule?e.default:e}function _s(e,t,n){let{date:r,isDisabled:i}=e,{errorMessageId:a,selectedDateDescription:o}=cs.get(t),s=h(gs(os),`@react-aria/calendar`),c=Z({weekday:`long`,day:`numeric`,month:`long`,year:`numeric`,era:ls(r),timeZone:t.timeZone}),l=t.isCellFocused(r)&&!e.isOutsideMonth;i=i||t.isCellDisabled(r)||!!e.isOutsideMonth;let u=t.isCellUnavailable(r),d=!i&&!u,f=t.isSelected(r)&&d,p=!1;t.isValueInvalid&&(`highlightedRange`in t?p=!t.anchorDate&&t.highlightedRange!=null&&r.compare(t.highlightedRange.start)>=0&&r.compare(t.highlightedRange.end)<=0:Array.isArray(t.value)?p=t.value.some(e=>B(e,r)):t.value&&(p=B(t.value,r))),p&&!i&&(f=!0),r=Ye(r,pt);let m=(0,R.useMemo)(()=>r.toDate(t.timeZone),[r,t.timeZone]),g=ht(r,t.timeZone),_=(0,R.useMemo)(()=>{let e=``;return`highlightedRange`in t&&t.value&&!t.anchorDate&&(B(r,t.value.start)||B(r,t.value.end))&&(e=o+`, `),e+=c.format(m),g?e=s.format(f?`todayDateSelected`:`todayDate`,{date:e}):f&&(e=s.format(`dateSelected`,{date:e})),t.minValue&&B(r,t.minValue)?e+=`, `+s.format(`minimumDate`):t.maxValue&&B(r,t.maxValue)&&(e+=`, `+s.format(`maximumDate`)),e},[c,m,s,f,g,r,t,o]),v=``;`anchorDate`in t&&l&&!t.isReadOnly&&d&&(v=t.anchorDate?s.format(`finishRangeSelectionPrompt`):s.format(`startRangeSelectionPrompt`));let y=Ue(v),x=(0,R.useRef)(!1),S=(0,R.useRef)(!1),C=(0,R.useRef)(void 0),{pressProps:w,isPressed:T}=ue({shouldCancelOnPointerExit:`anchorDate`in t&&!!t.anchorDate,preventFocusOnPress:!0,isDisabled:!d||t.isReadOnly,onPressStart(e){if(t.isReadOnly){t.setFocusedDate(r),t.setFocused(!0);return}if(`highlightedRange`in t&&!t.anchorDate&&(e.pointerType===`mouse`||e.pointerType===`touch`)){if(t.highlightedRange&&!p){if(B(r,t.highlightedRange.start)){t.setAnchorDate(t.highlightedRange.end),t.setFocusedDate(r),t.setFocused(!0),t.setDragging(!0),S.current=!0;return}if(B(r,t.highlightedRange.end)){t.setAnchorDate(t.highlightedRange.start),t.setFocusedDate(r),t.setFocused(!0),t.setDragging(!0),S.current=!0;return}}let n=()=>{t.setDragging(!0),C.current=void 0,t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0),x.current=!0};e.pointerType===`touch`?C.current=setTimeout(n,200):n()}},onPressEnd(){S.current=!1,x.current=!1,clearTimeout(C.current),C.current=void 0},onPress(){!(`anchorDate`in t)&&!t.isReadOnly&&(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0))},onPressUp(e){t.isReadOnly||(`anchorDate`in t&&C.current&&(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0)),`anchorDate`in t&&(S.current?t.setAnchorDate(r):t.anchorDate&&!x.current?(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0)):e.pointerType===`keyboard`&&!t.anchorDate?(t.selectDate(r),t.focusNearestAvailableDate(r)):e.pointerType===`virtual`&&(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0))))}}),E;i||(E=B(r,t.focusedDate)?0:-1),(0,R.useEffect)(()=>{l&&n.current&&(M(n.current),me()!==`pointer`&&b()===n.current&&qe(n.current,{containingElement:Be(n.current)}))},[l,n]);let O=Z({day:`numeric`,timeZone:t.timeZone,calendar:r.calendar.identifier}),k=(0,R.useMemo)(()=>O.formatToParts(m).find(e=>e.type===`day`).value,[O,m]);return{cellProps:{role:`gridcell`,"aria-disabled":!d||void 0,"aria-selected":f||void 0,"aria-invalid":p||void 0},buttonProps:D(w,{onFocus(){i||(t.setFocusedDate(r),t.setFocused(!0))},tabIndex:E,role:`button`,"aria-disabled":!d||void 0,"aria-label":_,"aria-invalid":p||void 0,"aria-describedby":[p?a:void 0,y[`aria-describedby`]].filter(Boolean).join(` `)||void 0,onPointerEnter(e){`highlightDate`in t&&(e.pointerType!==`touch`||t.isDragging)&&d&&t.highlightDate(r)},onPointerDown(e){let t=fe(e);t instanceof HTMLElement&&`releasePointerCapture`in t&&(`hasPointerCapture`in t?t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId):t.releasePointerCapture(e.pointerId))},onContextMenu(e){e.preventDefault()}}),isPressed:T,isFocused:l,isSelected:f,isDisabled:i,isUnavailable:u,isOutsideVisibleRange:r.compare(t.visibleRange.start)<0||r.compare(t.visibleRange.end)>0,isInvalid:p,formattedDate:k}}function vs(e,t){let n=Z({year:e.format?.year||`numeric`,era:e.format?.era||(t.focusedDate.calendar.identifier===`gregory`&&t.focusedDate.era===`BC`?`short`:void 0),calendar:t.focusedDate.calendar.identifier,timeZone:t.timeZone}),r=e.visibleYears||20,i=t.focusedDate.subtract({years:Math.floor(r/2)}),a=t.focusedDate.add({years:Math.ceil(r/2)-1});t.maxValue&&a.compare(t.maxValue)>0&&(a=U(t.maxValue),i=a.subtract({years:r-1})),t.minValue&&i.compare(t.minValue)<0&&(i=U(t.minValue),a=i.add({years:r-1}),t.maxValue&&a.compare(t.maxValue)>0&&(a=U(t.maxValue)));let o=[],s=i,c=0;for(;s.compare(a)<=0;)ft(s,t.focusedDate)&&(c=o.length),o.push({id:o.length,date:s,formatted:n.format(s.toDate(t.timeZone))}),s=s.add({years:1});let{locale:l}=F();return{"aria-label":(0,R.useMemo)(()=>new Intl.DisplayNames(l,{type:`dateTimeField`}).of(`year`),[l]),value:c,onChange:e=>{e!=null&&t.setFocusedDate(o[e].date)},items:o}}function ys(e,t){let n=(0,R.useMemo)(()=>{let n=t.visibleRange.start;return e.offset&&(n=n.add(e.offset)),n},[t.visibleRange.start,e.offset]),r=t.visibleDuration.days||t.visibleDuration.weeks,i=Z({day:e.format?.day||(r?`numeric`:void 0),month:e.format?.month||`long`,year:e.format?.year||`numeric`,era:e.format?.era||n&&n.calendar.identifier===`gregory`&&n.era===`BC`?`short`:void 0,calendar:t.visibleRange?.start.calendar.identifier,timeZone:t.timeZone});return(0,R.useMemo)(()=>{if(r)return i.formatRange(n.toDate(t.timeZone),t.visibleRange.end.toDate(t.timeZone));let e=n.calendar.getFormattableMonth?n.calendar.getFormattableMonth(n):n;return i.format(e.toDate(t.timeZone))},[i,r,n,t.timeZone,t.visibleRange.end])}function bs(e,t,n){let{commitBehavior:r=`select`,...i}=e,a=ms(i,t),o=(0,R.useRef)(!1),s=(0,R.useRef)(typeof window<`u`?window:null);g(s,`pointerdown`,e=>{o.current=e.width===0&&e.height===0});let c={clear:()=>t.clearSelection(),reset:()=>t.setAnchorDate(null),select:()=>t.commitSelection()};return g(s,`pointerup`,e=>{if(o.current){o.current=!1;return}if(t.setDragging(!1),!t.anchorDate)return;let i=e.target;n.current&&ee(n.current)&&(!ne(n.current,i)||!i.closest(`button, [role="button"]`))&&c[r]()}),a.calendarProps.onBlur=e=>{n.current&&(!e.relatedTarget||!ne(n.current,e.relatedTarget))&&t.anchorDate&&c[r]()},g(n,`touchmove`,e=>{t.isDragging&&e.preventDefault()},{passive:!1,capture:!0}),a}function xs(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function Ss(e,t,n,r,i){let a={};for(let e in t)a[e]=Math.floor(t[e]/2),a[e]>0&&t[e]%2==0&&a[e]--;return Ts(e,Cs(e,t,n).subtract(a),t,n,r,i)}function Cs(e,t,n,r,i){let a=e;return t.years?a=kt(e):t.months?a=Dt(e):(t.weeks||t.days&&t.days>7)&&(a=At(e,n)),Ts(e,a,t,n,r,i)}function ws(e,t,n,r,i){let a={...t};return a.days?a.days--:a.weeks?a.weeks--:a.months?a.months--:a.years&&a.years--,Ts(e,Cs(e,t,n).subtract(a),t,n,r,i)}function Ts(e,t,n,r,i,a){if(i&&e.compare(i)>=0){let e=Rt(t,Cs(U(i),n,r));e&&(t=e)}if(a&&e.compare(a)<=0){let e=Lt(t,ws(U(a),n,r));e&&(t=e)}return t}function Es(e,t,n){if(t){let n=Rt(e,U(t));n&&(e=n)}if(n){let t=Lt(e,U(n));t&&(e=t)}return e}function Ds(e,t,n){if(!n)return e;for(;e.compare(t)>=0&&n(e);)e=e.subtract({days:1});return e.compare(t)>=0?e:null}function Os(e,t){return e===t||e.days===t.days&&e.weeks===t.weeks&&e.months===t.months&&e.years===t.years}function ks(e){let t=(0,R.useMemo)(()=>new Y(e.locale),[e.locale]),n=(0,R.useMemo)(()=>t.resolvedOptions(),[t]),{locale:r,createCalendar:i,visibleDuration:a={months:1},minValue:o,maxValue:s,selectionAlignment:c,isDateUnavailable:l,pageBehavior:u=`visible`,selectionMode:d=`single`,firstDayOfWeek:f,weeksInMonth:p}=e,m=(0,R.useMemo)(()=>i(n.calendar),[i,n.calendar]),[h,g]=ce(e.value,e.defaultValue??null,e.onChange),_=(0,R.useMemo)(()=>Array.isArray(h)?h.map(e=>G(U(e),m)):h?G(U(h),m):null,[h,m]),v=(0,R.useMemo)(()=>{let e=Array.isArray(h)?h[0]:h;return e&&`timeZone`in e?e.timeZone:n.timeZone},[h,n.timeZone]),y=(0,R.useMemo)(()=>e.focusedValue?Es(G(U(e.focusedValue),m),o,s):void 0,[e.focusedValue,m,o,s]),b=(0,R.useMemo)(()=>e.defaultFocusedValue?Es(G(U(e.defaultFocusedValue),m),o,s):Es(_?Array.isArray(_)?_[0]:_:G(yt(v),m),o,s),[e.defaultFocusedValue,_,v,m,o,s]),[x,S]=ce(y,b,e.onFocusChange),C=()=>{switch(c){case`start`:return Cs(x,a,r,o,s);case`end`:return ws(x,a,r,o,s);default:return Ss(x,a,r,o,s)}},[w,T]=(0,R.useState)(C),[E,D]=(0,R.useState)(e.autoFocus||!1),[O,k]=(0,R.useState)(a);Os(a,O)||(k(a),T(C()));let A=(0,R.useMemo)(()=>{let e={...a};return e.days?e.days--:e.days=-1,w.add(e)},[w,a]),[ee,te]=(0,R.useState)(m);if(!mt(m,ee)){let e=G(x,m);T(Ss(e,a,r,o,s)),S(e),te(m)}xs(x,o,s)?S(Es(x,o,s)):x.compare(w)<0?T(ws(x,a,r,o,s)):x.compare(A)>0&&T(Cs(x,a,r,o,s));function j(e){e=Es(e,o,s),S(e)}function ne(e){let t=Ds(Es(e,o,s),w,l);if(!t)return null;let n=Array.isArray(h)?h[0]:h,r=G(t,n?.calendar||new z);return n&&`hour`in n?n.set(r):r}function M(t){if(!e.isDisabled&&!e.isReadOnly){if(t===null){g(d===`multiple`?[]:null);return}if(Array.isArray(t))g(t.map(ne).filter(Boolean));else{let e=ne(t);e&&g(e)}}}let re=(0,R.useMemo)(()=>_?Array.isArray(_)?_.some(e=>l?.(e)||xs(e,o,s)):l?.(_)||xs(_,o,s):!1,[_,l,o,s]),N=e.isInvalid||e.validationState===`invalid`||re,ie=N?`invalid`:null,P=(0,R.useMemo)(()=>u===`visible`?a:As(a),[u,a]);return{isDisabled:e.isDisabled??!1,isReadOnly:e.isReadOnly??!1,value:_,setValue:M,selectionMode:d,visibleDuration:a,visibleRange:{start:w,end:A},minValue:o,maxValue:s,focusedDate:x,timeZone:v,validationState:ie,isValueInvalid:N,setFocusedDate(e){j(e)},focusNextDay(){j(x.add({days:1}))},focusPreviousDay(){j(x.subtract({days:1}))},focusNextRow(){a.days?this.focusNextPage():(a.weeks||a.months||a.years)&&j(x.add({weeks:1}))},focusPreviousRow(){a.days?this.focusPreviousPage():(a.weeks||a.months||a.years)&&j(x.subtract({weeks:1}))},focusNextPage(){let e=w.add(P);S(Es(x.add(P),o,s)),T(Cs(Ts(x,e,P,r,o,s),P,r))},focusPreviousPage(){let e=w.subtract(P);S(Es(x.subtract(P),o,s)),T(Cs(Ts(x,e,P,r,o,s),P,r))},focusSectionStart(){a.days?j(w):a.weeks?j(At(x,r)):(a.months||a.years)&&j(Dt(x))},focusSectionEnd(){a.days?j(A):a.weeks?j(jt(x,r)):(a.months||a.years)&&j(Ot(x))},focusNextSection(e){if(!e&&!a.days){j(x.add(As(a)));return}a.days?this.focusNextPage():a.weeks?j(x.add({months:1})):(a.months||a.years)&&j(x.add({years:1}))},focusPreviousSection(e){if(!e&&!a.days){j(x.subtract(As(a)));return}a.days?this.focusPreviousPage():a.weeks?j(x.subtract({months:1})):(a.months||a.years)&&j(x.subtract({years:1}))},selectFocusedDate(){l&&l(x)||this.selectDate(x)},selectDate(t){if(!(e.isDisabled||e.isReadOnly)){if(d===`multiple`&&t!=null){let e=ne(t);if(!e)return;let n=[];Array.isArray(h)?n=h:h!=null&&(n=[h]);let r=n.findIndex(t=>B(t,e)),i=r>=0?n.slice(0,r).concat(n.slice(r+1)):[...n,e];g(i)}else M(t)}},isFocused:E,setFocused:D,isInvalid(e){return xs(e,o,s)},isSelected(e){return!_||this.isCellDisabled(e)||this.isCellUnavailable(e)?!1:Array.isArray(_)?_.some(t=>B(t,e)):B(e,_)},isCellFocused(e){return E&&x&&B(e,x)},isCellDisabled(t){return e.isDisabled||t.compare(w)<0||t.compare(A)>0||this.isInvalid(t)},isCellUnavailable(t){return e.isDateUnavailable?e.isDateUnavailable(t):!1},isPreviousVisibleRangeInvalid(){let e=w.subtract({days:1});return B(e,w)||this.isInvalid(e)},isNextVisibleRangeInvalid(){let e=A.add({days:1});return B(e,A)||this.isInvalid(e)},getDatesInWeek(e,t=w){let n=t.add({weeks:e}),i=[],o=a.days&&a.days<7?a.days:7;if(o===7){n=At(n,r,f);let e=_t(n,r,f);for(let t=0;t0&&(m=`start`)}let h=(0,R.useMemo)(()=>{let t=e.isDateUnavailable;if(t)return e=>t(e,f)},[e.isDateUnavailable,f]),g=(0,R.useCallback)(t=>t&&h&&!e.allowsNonContiguousRanges?{start:Ps(t,h,o,-1),end:Ps(t,h,o,1)}:null,[h,o,e.allowsNonContiguousRanges]),_=(0,R.useMemo)(()=>g(f),[g,f]),v=(0,R.useMemo)(()=>Rt(s,_?.start),[s,_]),y=(0,R.useMemo)(()=>Lt(c,_?.end),[c,_]),b=ks({...l,value:u&&u.start,createCalendar:i,locale:a,visibleDuration:o,minValue:v,maxValue:y,selectionAlignment:e.selectionAlignment||m,isDateUnavailable:h}),x=f?Ms(f,b.focusedDate):u&&Ms(u.start,u.end),S=t=>{if(e.isReadOnly)return;let n=Ds(Es(t,v,y),b.visibleRange.start,h);if(n){if(!f)p(n);else{let e=Ms(f,n);e&&d({start:Ns(e.start,u?.start),end:Ns(e.end,u?.end)}),p(null)}}},[C,w]=(0,R.useState)(!1),T=(0,R.useMemo)(()=>!u||f?!1:h&&(h(u.start)||h(u.end))?!0:xs(u.start,s,c)||xs(u.end,s,c),[h,u,f,s,c]),E=e.isInvalid||e.validationState===`invalid`||T,D=E?`invalid`:null;return{...b,value:u,setValue:d,anchorDate:f,setAnchorDate:p,highlightedRange:x,validationState:D,isValueInvalid:E,selectFocusedDate(){b.isCellUnavailable(b.focusedDate)||S(b.focusedDate)},commitSelection(){S(b.focusedDate)},selectDate:S,highlightDate(e){f&&b.setFocusedDate(e)},isSelected(e){return!!(x&&e.compare(x.start)>=0&&e.compare(x.end)<=0&&!b.isCellDisabled(e)&&!b.isCellUnavailable(e))},isInvalid(e){return b.isInvalid(e)||xs(e,_?.start,_?.end)},isDragging:C,setDragging:w,clearSelection(){p(null),d(null)},focusNearestAvailableDate(e){let t=g(e),n=e=>this.isInvalid(e)||xs(e,t?.start,t?.end),r=e.add({days:1});n(r)&&(r=e.subtract({days:1})),n(r)||(this.setFocusedDate(r),this.setFocused(!0))}}}function Ms(e,t){return!e||!t?null:(t.compare(e)<0&&([e,t]=[t,e]),{start:U(e),end:U(t)})}function Ns(e,t){return e=G(e,t?.calendar||new z),t&&`hour`in t?t.set(e):e}function Ps(e,t,n,r){let i=e.add({days:r}),a=e.subtract(n),o=e.add(n);for(;(r<0?i.compare(a)>=0:i.compare(o)<=0)&&!t(i);)i=i.add({days:r});if(t(i))return i.add({days:-r})}var Fs=(0,R.createContext)(null),Is=(0,R.createContext)(null),Ls=(0,R.createContext)(null),Rs=(0,R.createContext)(null),zs=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,Is);let{locale:n}=F(),r=js({...e,locale:n,createCalendar:e.createCalendar||Kr}),{calendarProps:i,prevButtonProps:o,nextButtonProps:s,errorMessageProps:c,title:l}=bs(e,r,t),u=k({...e,values:{state:r,isDisabled:e.isDisabled||!1,isInvalid:r.isValueInvalid},defaultClassName:`react-aria-RangeCalendar`}),f=I(e,{global:!0});return R.createElement(w.div,{...D(u,f,i),ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":r.isValueInvalid||void 0},R.createElement(x,{values:[[d,{slots:{previous:o,next:s}}],[ze,{"aria-hidden":!0,level:2,children:l}],[Rs,r],[Is,e],[p,{slots:{errorMessage:c}}]]},R.createElement(a,null,R.createElement(`h2`,null,i[`aria-label`])),u.children,R.createElement(a,null,R.createElement(`button`,{"aria-label":s[`aria-label`],disabled:s.isDisabled,onClick:()=>r.focusNextPage(),tabIndex:-1}))))}),Bs=(0,R.createContext)(null),Vs=(0,R.forwardRef)(function(e,t){let n=(0,R.useContext)(Ls),r=(0,R.useContext)(Rs),i=O(Fs),a=O(Is),o=n??r,s=o.visibleRange.start;e.offset&&(s=s.add(e.offset));let c=i?.firstDayOfWeek??a?.firstDayOfWeek,{gridProps:l,headerProps:u,weekDays:d,weeksInMonth:f}=hs({startDate:s,endDate:Ot(s),weekdayStyle:e.weekdayStyle,firstDayOfWeek:c},o),p=I(e,{global:!0});return R.createElement(Bs.Provider,{value:{headerProps:u,weekDays:d,startDate:s,weeksInMonth:f}},R.createElement(w.table,{render:e.render,...D(p,l),ref:t,style:e.style,cellPadding:0,className:e.className??`react-aria-CalendarGrid`},typeof e.children==`function`?R.createElement(R.Fragment,null,R.createElement(Us,null,e=>R.createElement(Gs,null,e)),R.createElement(qs,null,e.children)):e.children))});function Hs(e,t){let{children:n,style:r,className:i}=e,{headerProps:a,weekDays:o}=(0,R.useContext)(Bs),s=I(e,{global:!0});return R.createElement(w.thead,{render:e.render,...D(s,a),ref:t,style:r,className:i??`react-aria-CalendarGridHeader`},R.createElement(`tr`,null,o.map((e,t)=>R.cloneElement(n(e),{key:t}))))}var Us=(0,R.forwardRef)(Hs);function Ws(e,t){let{children:n,style:r,className:i}=e,a=I(e,{global:!0});return R.createElement(w.th,{render:e.render,...a,ref:t,style:r,className:i||`react-aria-CalendarHeaderCell`},n)}var Gs=(0,R.forwardRef)(Ws);function Ks(e,t){let{children:n,style:r,className:i}=e,a=(0,R.useContext)(Ls),o=(0,R.useContext)(Rs),s=a??o,{startDate:c,weeksInMonth:l}=(0,R.useContext)(Bs),u=I(e,{global:!0});return R.createElement(w.tbody,{render:e.render,...u,ref:t,style:r,className:i??`react-aria-CalendarGridBody`},[...Array(l).keys()].map(e=>R.createElement(`tr`,{key:e},s.getDatesInWeek(e,c).map((e,t)=>e?R.cloneElement(n(e),{key:t}):R.createElement(`td`,{key:t})))))}var qs=(0,R.forwardRef)(Ks),Js=(0,R.forwardRef)(function({date:e,...t},n){let r=(0,R.useContext)(Ls),i=(0,R.useContext)(Rs),a=r??i,{startDate:o}=(0,R.useContext)(Bs)??{startDate:a.visibleRange.start},s=a.visibleDuration.days||a.visibleDuration.weeks?!1:!dt(o,e),c=ht(e,a.timeZone),l=(0,R.useRef)(null),{cellProps:u,buttonProps:d,...f}=_s({date:e,isOutsideMonth:s},a,l),{hoverProps:p,isHovered:m}=pe({...t,isDisabled:f.isDisabled||f.isUnavailable}),{focusProps:h,isFocusVisible:g}=P();g&&=f.isFocused;let _=!1,v=!1;`highlightedRange`in a&&a.highlightedRange&&(_=B(e,a.highlightedRange.start),v=B(e,a.highlightedRange.end));let y=k({...t,defaultChildren:f.formattedDate,defaultClassName:`react-aria-CalendarCell`,values:{date:e,isHovered:m,isOutsideMonth:s,isFocusVisible:g,isSelectionStart:_,isSelectionEnd:v,isToday:c,...f}}),b={"data-focused":f.isFocused||void 0,"data-hovered":m||void 0,"data-pressed":f.isPressed||void 0,"data-unavailable":f.isUnavailable||void 0,"data-disabled":f.isDisabled||void 0,"data-focus-visible":g||void 0,"data-outside-visible-range":f.isOutsideVisibleRange||void 0,"data-outside-month":s||void 0,"data-selected":f.isSelected||void 0,"data-selection-start":_||void 0,"data-selection-end":v||void 0,"data-invalid":f.isInvalid||void 0,"data-today":c||void 0},x=I(t,{global:!0});return R.createElement(`td`,{...u,ref:n},R.createElement(w.div,{...D(x,d,h,p,b,y),ref:l}))}),Ys=(0,R.forwardRef)(function(e,t){let{offset:n,format:r,className:i=`react-aria-CalendarHeading`,...a}=e,o=R.useContext(Ls),s=R.useContext(Rs),c=ys({offset:n,format:r},o||s);return R.createElement(He,{...a,className:i,ref:t},c)});function Xs(e){return e&&e.__esModule?e.default:e}function Zs(e,t,n){let r=h(Xs(zi),`@react-aria/datepicker`),{isInvalid:i,validationErrors:a,validationDetails:o}=t.displayValidation,{labelProps:s,fieldProps:c,descriptionProps:l,errorMessageProps:u}=Me({...e,labelElementType:`span`,isInvalid:i,errorMessage:e.errorMessage||a}),d=c[`aria-labelledby`]||c.id,{locale:f}=F(),p=t.formatValue(f,{month:`long`}),m=p?r.format(`selectedRangeDescription`,{startDate:p.start,endDate:p.end}):``,g=Ue(m),_={"aria-label":r.format(`startDate`),"aria-labelledby":d},v={"aria-label":r.format(`endDate`),"aria-labelledby":d},y=le(),b=le(),x=Bi(t,n),S=[g[`aria-describedby`],c[`aria-describedby`]].filter(Boolean).join(` `)||void 0,C=(0,R.useMemo)(()=>de(n,{accept:e=>e.id!==y}),[n,y]),w={[Gi]:C,[Wi]:`presentation`,"aria-describedby":S,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,granularity:e.granularity,shouldForceLeadingZeros:e.shouldForceLeadingZeros,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior},T=I(e),E=(0,R.useRef)(!1),{focusWithinProps:O}=oe({...e,isDisabled:t.isOpen,onBlurWithin:t=>{let n=document.getElementById(b);ne(n,t.relatedTarget)||(E.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{E.current||(E.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),k=(0,R.useRef)(Se),A=(0,R.useRef)(Se);return{groupProps:D(T,x,c,g,O,{role:`group`,"aria-disabled":e.isDisabled||null,"aria-describedby":S,onKeyDown(n){t.isOpen||e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){t.isOpen||e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...s,onClick:()=>{C.focusFirst()}},buttonProps:{...g,id:y,"aria-haspopup":`dialog`,"aria-label":r.format(`calendar`),"aria-labelledby":`${y} ${d}`,"aria-describedby":S,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:b,"aria-labelledby":`${y} ${d}`},startFieldProps:{..._,...w,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime(`start`,e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[Ee]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){k.current=e,t.updateValidation(Ce(e,A.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...v,...w,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime(`end`,e),name:e.endName,form:e.form,[Ee]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){A.current=e,t.updateValidation(Ce(k.current,e))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},descriptionProps:l,errorMessageProps:u,calendarProps:{autoFocus:!0,value:t.dateRange?.start&&t.dateRange.end?t.dateRange:null,onChange:t.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:t.dateRange?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:typeof e.errorMessage==`function`?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(` `),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:i,validationErrors:a,validationDetails:o}}function Qs(e){let t=v(e),[n,r]=ce(e.value,e.defaultValue||null,e.onChange),[i]=(0,R.useState)(n),[a,o]=(0,R.useState)(()=>n||{start:null,end:null});n==null&&a.start&&a.end&&(a={start:null,end:null},o(a));let s=n||a,c=e=>{s=e||{start:null,end:null},o(s),$s(s)?r(s):r(null)},[l,u]=Ka(s?.start||s?.end||e.placeholderValue||null,e.granularity),d=l===`hour`||l===`minute`||l===`second`,f=e.shouldCloseOnSelect??!0,[p,m]=(0,R.useState)(null),[h,g]=(0,R.useState)(null);s&&$s(s)&&(p=s,`hour`in s.start&&(h=s));let _=(e,t)=>{c({start:`timeZone`in t.start?t.start.set(U(e.start)):W(e.start,t.start),end:`timeZone`in t.end?t.end.set(U(e.end)):W(e.end,t.end)}),m(null),g(null),D.commitValidation()},y=n=>{let r=typeof f==`function`?f():f;d?$s(n)&&(r||h?.start&&h?.end)?_(n,{start:h?.start||Ua(e.placeholderValue),end:h?.end||Ua(e.placeholderValue)}):m(n):$s(n)?(c(n),D.commitValidation()):m(n),r&&t.setOpen(!1)},b=e=>{$s(p)&&$s(e)?_(p,e):g(e)},x=s?.start?.calendar.identifier===`gregory`&&s.start.era===`BC`||s?.end?.calendar.identifier===`gregory`&&s.end.era===`BC`,S=(0,R.useMemo)(()=>({granularity:l,timeZone:u,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:x}),[l,e.hourCycle,e.shouldForceLeadingZeros,u,e.hideTimeZone,x]),{minValue:C,maxValue:w,isDateUnavailable:T}=e,E=(0,R.useMemo)(()=>za(s,C,w,T?e=>T(e,null):void 0,S),[s,C,w,T,S]),D=Oe({...e,value:n,name:(0,R.useMemo)(()=>[e.startName,e.endName].filter(e=>e!=null),[e.startName,e.endName]),builtinValidation:E}),O=D.displayValidation.isInvalid,k=e.validationState||(O?`invalid`:null);return{...D,value:s,defaultValue:e.defaultValue??i,setValue:c,dateRange:p,timeRange:h,granularity:l,hasTime:d,setDate(e,t){y(e===`start`?{start:t,end:p?.end??null}:{start:p?.start??null,end:t})},setTime(e,t){b(e===`start`?{start:t,end:h?.end??null}:{start:h?.start??null,end:t})},setDateTime(e,t){c(e===`start`?{start:t,end:s?.end??null}:{start:s?.start??null,end:t})},setDateRange:y,setTimeRange:b,...t,setOpen(n){!n&&!(s?.start&&s?.end)&&$s(p)&&d&&_(p,{start:h?.start||Ua(e.placeholderValue),end:h?.end||Ua(e.placeholderValue)}),t.setOpen(n)},validationState:k,isInvalid:O,formatValue(t,n){if(!s||!s.start||!s.end)return null;let r=`timeZone`in s.start?s.start.timeZone:void 0,i=e.granularity||(s.start&&`minute`in s.start?`minute`:`day`),a=`timeZone`in s.end?s.end.timeZone:void 0,o=e.granularity||(s.end&&`minute`in s.end?`minute`:`day`),c=Ha(n,{granularity:i,timeZone:r,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,showEra:s.start.calendar.identifier===`gregory`&&s.start.era===`BC`||s.end.calendar.identifier===`gregory`&&s.end.era===`BC`}),l=s.start.toDate(r||`UTC`),u=s.end.toDate(a||`UTC`),d=new Y(t,c),f;if(r===a&&i===o&&s.start.compare(s.end)!==0){try{let e=d.formatRangeToParts(l,u),t=-1;for(let n=0;nt&&(r+=e[i].value);return{start:n,end:r}}catch{}f=d}else f=new Y(t,Ha(n,{granularity:o,timeZone:a,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:d.format(l),end:f.format(u)}},getDateFormatter(e,t){return new Y(e,Ha({},{...S,...t}))}}}function $s(e){return e?.start!=null&&e.end!=null}var ec=(0,R.createContext)(null),tc=(0,R.createContext)(null),nc=[ke,d,xe,p],rc=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,ec);let{validationBehavior:n}=O(ve)||{},r=e.validationBehavior??n??`native`,i=Qs({...e,validationBehavior:r}),a=(0,R.useRef)(null),[o,s]=A(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:l,startFieldProps:u,endFieldProps:f,buttonProps:m,dialogProps:h,calendarProps:g,descriptionProps:_,errorMessageProps:v,...y}=Zs({...E(e),label:s,validationBehavior:r},i,a),{focusProps:b,isFocused:S,isFocusVisible:C}=P({within:!0}),T=k({...e,values:{state:i,isFocusWithin:S,isFocusVisible:C,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-DateRangePicker`}),ee=I(e,{global:!0});return delete ee.id,R.createElement(x,{values:[[tc,i],[ke,{...c,ref:a,isInvalid:i.isInvalid}],[d,{...m,isPressed:i.isOpen}],[xe,{...l,ref:o,elementType:`span`}],[Is,g],[Ve,i],[Je,{trigger:`DateRangePicker`,triggerRef:a,placement:`bottom start`,clearContexts:nc}],[We,h],[oo,{slots:{start:u,end:f}}],[p,{slots:{description:_,errorMessage:v}}],[be,y]]},R.createElement(w.div,{...D(ee,T,b),ref:t,slot:e.slot||void 0,"data-focus-within":S||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":C||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-open":i.isOpen||void 0}))}),ic=(0,R.createContext)({triggerRef:{current:null}}),ac=({children:e,className:t,onOpenChange:n,...r})=>{let i=R.useMemo(()=>$e(),[]),a=(0,R.useRef)(null),[o,s]=R.useState(!1),c=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(!o)return;let e=e=>{!e.metaKey&&!e.ctrlKey&&!e.altKey&&(c.current=!0)};return window.addEventListener(`keydown`,e,!0),()=>{window.removeEventListener(`keydown`,e,!0)}},[o]);let l=e=>{s(e),!e&&c.current&&window.requestAnimationFrame(()=>{a.current?.focus()}),c.current=!1,n?.(e)};return(0,X.jsx)(ic,{value:{slots:i,triggerRef:a},children:(0,X.jsx)(rc,{"data-required":Le(r.isRequired),"data-slot":`date-range-picker`,...r,className:N(t,i?.base()),onOpenChange:l,children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})})};ac.displayName=`HeroUI.DateRangePicker`;var oc=({children:e,className:t,ref:n,...r})=>{let{slots:i,triggerRef:a}=(0,R.use)(ic),o=R.useCallback(e=>{a.current=e},[a]),s=j(o,n);return(0,X.jsx)(f,{ref:s,className:N(t,i?.trigger()),"data-slot":`date-range-picker-trigger`,...r,children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})};oc.displayName=`HeroUI.DateRangePicker.Trigger`;var sc=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(ic);return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(r?.triggerIndicator,t),"data-slot":`date-range-picker-trigger-indicator`,...n,children:e||(0,X.jsx)(y,{})})};sc.displayName=`HeroUI.DateRangePicker.TriggerIndicator`;var cc=({children:e=` - `,className:t,...n})=>{let{slots:r}=(0,R.use)(ic);return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(r?.rangeSeparator,t),"data-slot":`date-range-picker-range-separator`,...n,children:e})};cc.displayName=`HeroUI.DateRangePicker.RangeSeparator`;var lc=({children:e,className:t,placement:n=`bottom`,...r})=>{let{slots:i}=(0,R.use)(ic);return(0,X.jsx)(s,{value:{variant:`default`},children:(0,X.jsx)(Ge,{...r,className:N(t,i?.popover()),"data-slot":`date-range-picker-popover`,placement:n,children:e})})};lc.displayName=`HeroUI.DateRangePicker.Popover`;var uc=Object.assign(ac,{Root:ac,Trigger:oc,TriggerIndicator:sc,RangeSeparator:cc,Popover:lc});function dc({children:e,className:t,fullWidth:n,...r}){let i=R.useMemo(()=>tt({fullWidth:n}),[n]);return(0,X.jsx)(fo,{"data-required":Le(r.isRequired),"data-slot":`time-field`,...r,className:N(t,i),children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})}var fc=Object.assign(dc,{Root:dc,Group:vo,Input:bo,InputContainer:So,Segment:xo,Prefix:yo,Suffix:Co}),pc=(0,R.createContext)(null);function mc(){let e=(0,R.use)(pc);if(!e)throw Error(`useYearPicker must be used within a or component.`);return e}function hc(){let e=(0,R.use)(Ls),t=(0,R.use)(Rs),n=e??t;if(!n)throw Error(`useCalendarOrRangeState must be used within a or component.`);return n}function gc(e){switch(e){case`buddhist`:return 543;case`ethiopic`:case`ethioaa`:return-8;case`coptic`:return-284;case`hebrew`:return 3760;case`indian`:return-78;case`islamic-civil`:case`islamic-tbla`:case`islamic-umalqura`:return-579;case`persian`:return-600;default:return 0}}function _c(e,t){let n=[];if(!e||!t)return n;let r=kt(e);for(;r.compare(t)<=0;)n.push(r),r=kt(r.add({years:1}));return n}function vc(e,t,n,r=`short`,i=`UTC`){let a=new Intl.DateTimeFormat(t,{weekday:r,timeZone:i}),o=At(e,t,n),s=[],c=o;for(let e=0;e<7;e++){s.push(a.format(c.toDate(i)));let e=c.add({days:1});if(B(c,e))break;c=e}for(;s.length<7;)s.push(``);return s}function yc(e,t){let n=[],r=e;for(let e=0;e<7;e++){n.push(r.compare(t)>0?null:r);let e=r.add({days:1});if(B(r,e)){for(;n.length<7;)n.push(null);return n}r=e}return n}function bc(e,t,n,r){let i=[],a=At(e,n,r);for(i.push(yc(a,t)),a=a.add({weeks:1});a.compare(t)<=0;){i.push(yc(a,t));let e=a.add({weeks:1});if(B(a,e))break;a=e}return i}var xc=R.createContext(null);function Sc(){let e=R.use(xc);if(!e)throw Error(`CalendarYearPicker trigger components must be used within .`);return e}var Cc=({children:e,className:t,onKeyDown:n,onPress:r,...i})=>{let{isYearPickerOpen:a,setIsYearPickerOpen:o}=mc(),s=ys({},hc()),c=R.useMemo(()=>Xe(),[]),l=R.useCallback(()=>{o(!a)},[a,o]),u=e=>{n?.(e),!e.defaultPrevented&&e.key===`Escape`&&a&&(e.preventDefault(),o(!1))},d=R.useMemo(()=>({isOpen:a,monthYear:s,toggle:l}),[l,a,s]),p=R.useMemo(()=>({...d,slots:c}),[c,d]);return(0,X.jsx)(xc,{value:p,children:(0,X.jsx)(f,{"aria-expanded":a,"aria-label":`${s}, year selector`,className:N(t,c.trigger()),"data-open":a||void 0,"data-slot":`calendar-year-picker-trigger`,slot:null,onKeyDown:u,onPress:e=>{r?.(e),l()},...i,children:typeof e==`function`?e(d):e})})};Cc.displayName=`HeroUI.CalendarYearPicker.Trigger`;var wc=({children:e,className:t,format:n,offset:r,...i})=>{let{monthYear:a,slots:o,...s}=Sc(),c=hc(),l=ys({format:n,offset:r},c);return(0,X.jsx)(S.span,{className:L(o.triggerHeading,t),"data-slot":`calendar-year-picker-trigger-heading`,...i,children:typeof e==`function`?e({monthYear:a,...s}):e||l})};wc.displayName=`HeroUI.CalendarYearPicker.TriggerHeading`;var Tc=({children:e,className:t,...n})=>{let{monthYear:r,slots:i,...a}=Sc();return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(i.triggerIndicator,t),"data-slot":`calendar-year-picker-trigger-indicator`,...n,children:typeof e==`function`?e({monthYear:r,...a}):e||(0,X.jsx)(o,{height:`1em`,width:`1em`})})};Tc.displayName=`HeroUI.CalendarYearPicker.TriggerIndicator`;var Ec=R.createContext(null);function Dc(){let e=R.use(Ec);if(!e)throw Error(`CalendarYearPicker components must be used within .`);return e}var Oc=({children:e,className:t,format:n,onKeyDown:r,visibleYears:i,...a})=>{let{calendarGridSlot:o,calendarRef:s,isYearPickerOpen:c,setIsYearPickerOpen:l}=mc(),u=hc(),d=R.useRef(null),f=R.useMemo(()=>Xe(),[]),{"aria-label":p,items:m,onChange:h,value:g}=vs({format:n,visibleYears:R.useMemo(()=>i??(!u.minValue||!u.maxValue?20:_c(u.minValue,u.maxValue).length),[u.maxValue,u.minValue,i])},u),_=m.map(e=>`${e.id}:${e.date.year}`).join(`|`),v=m.map(e=>e.date.year),y=new Map(m.map(e=>[e.date.year,e])),b=m[g]?.date.year??u.focusedDate.year,x=R.useCallback(e=>y.get(e)?.formatted??String(e),[y]),[C,w]=R.useState(b),T=R.useRef(!1);R.useEffect(()=>{let e=d.current;if(!e)return;let t=s.current?.querySelector(`[data-slot='${o}']`);t&&(e.style.top=`${t.offsetTop}px`,e.style.height=`${t.offsetHeight}px`)},[o,s,u.focusedDate]);let E=R.useCallback(e=>{let t=d.current;if(!t)return;let n=t.querySelector(`[data-year='${e}']`);n&&n.focus()},[]);R.useEffect(()=>{let e=c&&!T.current;if(T.current=c,!e||v.length===0)return;let[t]=v;if(t==null)return;let n=v.includes(b)?b:t;w(n);let r=requestAnimationFrame(()=>{E(n)});return()=>{cancelAnimationFrame(r)}},[E,b,c,_,v.length]),R.useEffect(()=>{if(!c||v.length===0)return;let[e]=v;e!=null&&(v.includes(C)||w(e))},[C,c,_,v]);let D=R.useCallback(e=>{let t=y.get(e);t!=null&&(l(!1),h(t.id))},[y,h,l]),O=e=>{if(r?.(e),e.defaultPrevented)return;if(e.key===`Escape`&&c){e.preventDefault(),l(!1);return}if(!c||v.length===0)return;let t=v.indexOf(C);if(t===-1)return;let n=t;switch(e.key){case`ArrowRight`:n=Math.min(t+1,v.length-1);break;case`ArrowLeft`:n=Math.max(t-1,0);break;case`ArrowDown`:n=Math.min(t+3,v.length-1);break;case`ArrowUp`:n=Math.max(t-3,0);break;case`Home`:n=0;break;case`End`:n=v.length-1;break;default:return}if(n!==t){let t=v[n];if(t==null)return;e.preventDefault(),w(t),E(t)}},k=R.useMemo(()=>({activeYear:C,focusedYear:b,getFormattedYear:x,isYearPickerOpen:c,selectYear:D,setActiveYear:w,slots:f,years:v}),[C,b,x,D,c,f,v]);return(0,X.jsx)(Ec,{value:k,children:(0,X.jsx)(S.div,{ref:d,"aria-hidden":!c,"aria-label":p,className:L(f.yearGrid,t),"data-open":c||void 0,"data-slot":`calendar-year-picker-grid`,role:`listbox`,tabIndex:-1,onKeyDown:O,...a,children:e})})};Oc.displayName=`HeroUI.CalendarYearPicker.Grid`;var kc=({children:e})=>{let{focusedYear:t,getFormattedYear:n,isYearPickerOpen:r,selectYear:i,years:a}=Dc(),o=new Date().getFullYear();return(0,X.jsx)(X.Fragment,{children:a.map(a=>{let s=a===t,c={formattedYear:n(a),isCurrentYear:a===o,isOpen:r,isSelected:s,selectYear:()=>i(a),year:a};return(0,X.jsx)(R.Fragment,{children:typeof e==`function`?e(c):(0,X.jsx)(Ac,{year:a})},a)})})};kc.displayName=`HeroUI.CalendarYearPicker.GridBody`;var Ac=({children:e,className:t,excludeFromTabOrder:n,onFocus:r,onPress:i,year:a,...o})=>{let{activeYear:s,focusedYear:c,getFormattedYear:l,isYearPickerOpen:u,selectYear:d,setActiveYear:p,slots:m}=Dc(),h=a===c,g=a===s,_=l(a),v={formattedYear:_,isCurrentYear:a===new Date().getFullYear(),isOpen:u,isSelected:h,selectYear:()=>d(a),year:a};return(0,X.jsx)(f,{"aria-label":_,"aria-selected":h,className:N(t,m.yearCell()),"data-selected":h||void 0,"data-slot":`calendar-year-picker-year-cell`,"data-year":a,excludeFromTabOrder:n??!(u&&g),slot:null,onFocus:e=>{r?.(e),p(a)},onPress:e=>{i?.(e),d(a)},...o,children:typeof e==`function`?e(v):e||_})};Ac.displayName=`HeroUI.CalendarYearPicker.Cell`;function jc({children:e,className:t,"data-slot":n=`calendar-grid-body`,firstDayOfWeek:r,visibleRange:i}){let{locale:a}=F(),o=R.useMemo(()=>bc(i.start,i.end,a,r),[r,a,i.end,i.start]);return(0,X.jsx)(S.tbody,{className:t,"data-slot":n,children:o.map((t,n)=>(0,X.jsx)(`tr`,{children:t.map((t,n)=>t?R.cloneElement(e(t),{key:n}):(0,X.jsx)(`td`,{},n))},n))})}function Mc({children:e,className:t,"data-slot":n=`calendar-grid-header`,firstDayOfWeek:r,timeZone:i=`UTC`,visibleRange:a,weekdayStyle:o=`short`}){let{locale:s}=F(),c=R.useMemo(()=>vc(a.start,s,r,o,i),[r,s,i,a.start,o]);return(0,X.jsx)(S.thead,{"aria-hidden":!0,className:t,"data-slot":n,children:(0,X.jsx)(`tr`,{children:c.map((t,n)=>R.cloneElement(e(t),{key:n}))})})}var Q=(0,R.createContext)({});function Nc({children:e,className:t,defaultYearPickerOpen:n=!1,firstDayOfWeek:r,isYearPickerOpen:i,maxValue:a,minValue:o,onYearPickerOpenChange:s,visibleDuration:c,...l}){let u=c?.weeks!=null,d=c?.days!=null,f=c?.days,{locale:p}=F(),m=R.useMemo(()=>Ze(),[]),h=R.useRef(null),[g,_]=ce(i,n,s),v=R.useMemo(()=>{let e=new Y(p).resolvedOptions().calendar;return Kr(e)},[p]),y=R.useMemo(()=>gc(v.identifier),[v.identifier]),b=o??new q(v,1900+y,1,1),x=a??new q(v,2099+y,12,31);return(0,X.jsx)(pc,{value:{calendarGridSlot:`range-calendar-grid`,isYearPickerOpen:g,setIsYearPickerOpen:_,calendarRef:h},children:(0,X.jsx)(zs,{ref:h,"data-slot":`range-calendar`,firstDayOfWeek:r,maxValue:x,minValue:b,visibleDuration:c,...l,className:N(t,te(m.base(),u&&`range-calendar--week-view`,d&&`range-calendar--day-view`)),children:t=>(0,X.jsx)(Q,{value:{dayView:d&&f!=null?{days:f,firstDayOfWeek:r,timeZone:t.state.timeZone,visibleRange:t.state.visibleRange}:void 0,slots:m},children:typeof e==`function`?e(t):e})})})}Nc.displayName=`HeroUI.RangeCalendar`;var Pc=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(Q);return(0,X.jsx)(S.header,{className:L(r?.header,t),"data-slot":`range-calendar-header`,...n,children:e})};Pc.displayName=`HeroUI.RangeCalendar.Header`;var Fc=({className:e,...t})=>{let{slots:n}=(0,R.use)(Q);return(0,X.jsx)(Ys,{"data-slot":`range-calendar-heading`,...t,className:L(n?.heading,e)})};Fc.displayName=`HeroUI.RangeCalendar.Heading`;var Ic=({children:e,className:t,slot:n,...r})=>{let{slots:i}=(0,R.use)(Q);return(0,X.jsx)(f,{"data-slot":`range-calendar-nav-button`,slot:n,...r,className:N(t,i?.navButton()),children:e||(n===`previous`?(0,X.jsx)(u,{className:i?.navButtonIcon(),"data-slot":`range-calendar-nav-button-icon`}):(0,X.jsx)(o,{className:i?.navButtonIcon(),"data-slot":`range-calendar-nav-button-icon`}))})};Ic.displayName=`HeroUI.RangeCalendar.NavButton`;var Lc=({children:e,className:t,weekdayStyle:n=`short`,...r})=>{let i=(0,R.use)(Q),{dayView:a,slots:o}=i,s=R.useMemo(()=>({...i,dayView:a?{...a,weekdayStyle:n}:void 0}),[a,i,n]);return(0,X.jsx)(Q,{value:s,children:(0,X.jsx)(Vs,{"data-slot":`range-calendar-grid`,weekdayStyle:n,...r,className:L(o?.grid,t),children:e})})};Lc.displayName=`HeroUI.RangeCalendar.Grid`;var Rc=({children:e,className:t,...n})=>{let{dayView:r,slots:i}=(0,R.use)(Q);return r&&r.days>=7&&typeof e==`function`?(0,X.jsx)(Mc,{className:L(i?.gridHeader,t),"data-slot":`range-calendar-grid-header`,firstDayOfWeek:r.firstDayOfWeek,timeZone:r.timeZone,visibleRange:r.visibleRange,weekdayStyle:r.weekdayStyle,children:e}):(0,X.jsx)(Us,{"data-slot":`range-calendar-grid-header`,...n,className:L(i?.gridHeader,t),children:e})};Rc.displayName=`HeroUI.RangeCalendar.GridHeader`;var zc=({children:e,className:t,...n})=>{let{dayView:r,slots:i}=(0,R.use)(Q);return r&&r.days>=7&&typeof e==`function`?(0,X.jsx)(jc,{className:L(i?.gridBody,t),"data-slot":`range-calendar-grid-body`,firstDayOfWeek:r.firstDayOfWeek,visibleRange:r.visibleRange,children:e}):(0,X.jsx)(qs,{"data-slot":`range-calendar-grid-body`,...n,className:L(i?.gridBody,t),children:e})};zc.displayName=`HeroUI.RangeCalendar.GridBody`;var Bc=({className:e,...t})=>{let{slots:n}=(0,R.use)(Q);return(0,X.jsx)(Gs,{"data-slot":`range-calendar-header-cell`,...t,className:L(n?.headerCell,e)})};Bc.displayName=`HeroUI.RangeCalendar.HeaderCell`;var Vc=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(Q);return(0,X.jsx)(Js,{"data-slot":`range-calendar-cell`,...n,className:N(t,r?.cell()),children:t=>{let{formattedDate:n,isDisabled:r,isHovered:i,isPressed:a,isSelectionEnd:o,isSelectionStart:s}=t,c=typeof e==`function`?e(t):e||n;return(0,X.jsx)(`span`,{className:`range-calendar__cell-button`,"data-disabled":Le(r),"data-hovered":Le(i),"data-pressed":Le(a),"data-selected":Le(s||o),"data-slot":`range-calendar-cell-button`,children:c})}})};Vc.displayName=`HeroUI.RangeCalendar.Cell`;var Hc=({className:e,...t})=>{let{slots:n}=(0,R.use)(Q);return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(n?.cellIndicator,e),"data-slot":`range-calendar-cell-indicator`,...t})};Hc.displayName=`HeroUI.RangeCalendar.CellIndicator`;var $=Object.assign(Nc,{Root:Nc,Header:Pc,Heading:Fc,NavButton:Ic,Grid:Lc,GridHeader:Rc,GridBody:zc,HeaderCell:Bc,Cell:Vc,CellIndicator:Hc,YearPickerTrigger:Cc,YearPickerTriggerHeading:wc,YearPickerTriggerIndicator:Tc,YearPickerGrid:Oc,YearPickerGridBody:kc,YearPickerCell:Ac});function Uc(e={}){let t=new URLSearchParams;e.dim?.length&&t.set(`dim`,e.dim.join(`,`)),e.limit!=null&&t.set(`limit`,String(e.limit)),e.hours!=null&&t.set(`hours`,String(e.hours)),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.api_key&&t.set(`api_key`,e.api_key);let n=t.toString()?`?${t}`:``;return Re(`/api/logs/stats${n}`)}function Wc(e={}){let t=new URLSearchParams;e.account&&t.set(`account`,e.account),e.api_key&&t.set(`api_key`,e.api_key),e.status&&t.set(`status`,e.status),e.stream!=null&&t.set(`stream`,e.stream?`1`:`0`),e.error_kind&&t.set(`error_kind`,e.error_kind),e.model&&t.set(`model`,e.model),e.provider&&t.set(`provider`,e.provider),e.id&&t.set(`id`,e.id),e.q&&t.set(`q`,e.q),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString()?`?${t}`:``;return Re(`/api/logs/requests${n}`)}function Gc(e){return Re(`/api/logs/requests/${encodeURIComponent(e)}`)}function Kc(){return Re(`/api/logs/requests`,{method:`DELETE`})}function qc(e={}){let t=new URLSearchParams;e.after!=null&&t.set(`after`,String(e.after)),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset)),e.level&&t.set(`level`,e.level),e.q&&t.set(`q`,e.q),e.account&&t.set(`account`,e.account);let n=t.toString()?`?${t}`:``;return Re(`/api/logs/runtime${n}`)}function Jc(e,t=!1){if(!e)return;let n=e.toDate(Tt());if(Number.isFinite(n.getTime()))return t&&n.setSeconds(59,999),n.toISOString()}function Yc(e){if(!e)return null;let t=Date.parse(e);if(!Number.isFinite(t))return null;try{return W(An(new Date(t).toISOString()))}catch{return null}}function Xc({value:e,onChange:t,ariaLabel:n,fromLabel:r,toLabel:i,className:a}){return(0,X.jsx)(uc,{className:a,granularity:`minute`,hourCycle:24,shouldForceLeadingZeros:!0,value:e,onChange:e=>t(e),"aria-label":n,children:({state:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(To.Group,{className:`w-full min-w-0`,variant:`secondary`,children:[(0,X.jsx)(To.Input,{className:`min-w-0`,slot:`start`,"aria-label":r,children:e=>(0,X.jsx)(To.Segment,{segment:e})}),(0,X.jsx)(uc.RangeSeparator,{}),(0,X.jsx)(To.Input,{className:`min-w-0`,slot:`end`,"aria-label":i,children:e=>(0,X.jsx)(To.Segment,{segment:e})}),(0,X.jsx)(To.Suffix,{children:(0,X.jsx)(uc.Trigger,{children:(0,X.jsx)(uc.TriggerIndicator,{})})})]}),(0,X.jsxs)(uc.Popover,{className:`flex w-[20.5rem] max-w-[calc(100vw-2rem)] flex-col gap-3 p-3`,children:[(0,X.jsxs)($,{"aria-label":n,children:[(0,X.jsxs)($.Header,{children:[(0,X.jsxs)($.YearPickerTrigger,{children:[(0,X.jsx)($.YearPickerTriggerHeading,{}),(0,X.jsx)($.YearPickerTriggerIndicator,{})]}),(0,X.jsx)($.NavButton,{slot:`previous`}),(0,X.jsx)($.NavButton,{slot:`next`})]}),(0,X.jsxs)($.Grid,{children:[(0,X.jsx)($.GridHeader,{children:e=>(0,X.jsx)($.HeaderCell,{children:e})}),(0,X.jsx)($.GridBody,{children:e=>(0,X.jsx)($.Cell,{date:e})})]}),(0,X.jsx)($.YearPickerGrid,{children:(0,X.jsx)($.YearPickerGridBody,{children:({year:e})=>(0,X.jsx)($.YearPickerCell,{year:e})})})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(De,{className:`text-xs`,children:r}),(0,X.jsx)(fc,{"aria-label":r,granularity:`minute`,hourCycle:24,value:e.timeRange?.start??null,onChange:t=>e.setTimeRange({start:t,end:e.timeRange?.end}),children:(0,X.jsx)(fc.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,X.jsx)(fc.Input,{children:e=>(0,X.jsx)(fc.Segment,{segment:e})})})})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(De,{className:`text-xs`,children:i}),(0,X.jsx)(fc,{"aria-label":i,granularity:`minute`,hourCycle:24,value:e.timeRange?.end??null,onChange:t=>e.setTimeRange({start:e.timeRange?.start,end:t}),children:(0,X.jsx)(fc.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,X.jsx)(fc.Input,{children:e=>(0,X.jsx)(fc.Segment,{segment:e})})})})]})]})]})]})})}export{Gc as a,qc as c,Kc as i,Jc as n,Wc as o,Yc as r,Uc as s,Xc as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{A as r,D as i,E as a,H as o,I as s,O as c,Q as l,V as u,X as d,Z as f,a as p,j as m,k as h,ot as g,ut as _,w as v,z as y}from"./useI18n-BAo1UrJW.js";import{$ as b,A as x,B as S,Ct as C,F as w,G as T,I as E,J as D,L as O,M as k,N as A,Q as ee,R as te,Y as j,Z as ne,_t as M,a as re,c as N,ct as ie,d as P,dt as ae,f as oe,j as se,k as F,l as ce,lt as le,m as ue,o as de,q as I,s as L,tt as fe,u as pe,w as me,x as he,z as ge}from"./SharedElementTransition-BlCsXfb1.js";import{t as _e}from"./useUpdateEffect-DR9d7F-l.js";import{a as ve,c as ye,d as be,f as xe,l as Se,o as Ce,p as we,r as Te,s as Ee,t as De,u as Oe}from"./label-DYYRLGoV.js";import{a as ke,i as Ae,n as je,r as Me,t as Ne}from"./Input-C__Dw9HK.js";import{n as Pe,r as Fe,t as Ie}from"./useSpinButton-BHwCEdGb.js";import{t as Le}from"./assertion-BLQtDfw6.js";import{M as Re}from"./overview-ARhe2pSk.js";import{Ct as ze,Et as Be,G as Ve,St as He,Tt as Ue,W as We,bt as Ge,st as Ke,wt as qe,xt as Je}from"./index-CWTBzWuK.js";var R=t(e(),1);function Ye(e,t){let n=(0,R.useRef)(null);return e&&n.current&&t(e,n.current)&&(e=n.current),n.current=e,e}var Xe=ge({slots:{trigger:`calendar-year-picker__trigger`,triggerHeading:`calendar-year-picker__trigger-heading`,triggerIndicator:`calendar-year-picker__trigger-indicator`,yearCell:`calendar-year-picker__year-cell`,yearGrid:`calendar-year-picker__year-grid`}}),Ze=ge({defaultVariants:{},slots:{base:`range-calendar`,cell:`range-calendar__cell`,cellIndicator:`range-calendar__cell-indicator`,grid:`range-calendar__grid`,gridBody:`range-calendar__grid-body`,gridHeader:`range-calendar__grid-header`,gridRow:`range-calendar__grid-row`,header:`range-calendar__header`,headerCell:`range-calendar__header-cell`,heading:`range-calendar__heading`,navButton:`range-calendar__nav-button`,navButtonIcon:`range-calendar__nav-button-icon`},variants:{}}),Qe=ge({base:`date-field`,defaultVariants:{fullWidth:!1},variants:{fullWidth:{false:``,true:`date-field--full-width`}}}),$e=ge({slots:{base:`date-range-picker`,popover:`date-range-picker__popover`,rangeSeparator:`date-range-picker__range-separator`,trigger:`date-range-picker__trigger`,triggerIndicator:`date-range-picker__trigger-indicator`}}),et=ge({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`date-input-group`,input:`date-input-group__input`,inputContainer:`date-input-group__input-container`,prefix:`date-input-group__prefix`,segment:`date-input-group__segment`,suffix:`date-input-group__suffix`},variants:{fullWidth:{false:{},true:{base:`date-input-group--full-width`}},variant:{primary:{base:`date-input-group--primary`},secondary:{base:`date-input-group--secondary`}}}}),tt=ge({base:`time-field`,defaultVariants:{fullWidth:!1},variants:{fullWidth:{false:``,true:`time-field--full-width`}}});function nt(e){let t=Ke({usage:`search`,...e}),n=(0,R.useCallback)((e,n)=>n.length===0||(e=e.normalize(`NFC`),n=n.normalize(`NFC`),t.compare(e.slice(0,n.length),n)===0),[t]),r=(0,R.useCallback)((e,n)=>n.length===0||(e=e.normalize(`NFC`),n=n.normalize(`NFC`),t.compare(e.slice(-n.length),n)===0),[t]),i=(0,R.useCallback)((e,n)=>{if(n.length===0)return!0;e=e.normalize(`NFC`),n=n.normalize(`NFC`);let r=0,i=n.length;for(;r+i<=e.length;r++){let a=e.slice(r,r+i);if(t.compare(n,a)===0)return!0}return!1},[t]);return(0,R.useMemo)(()=>({startsWith:n,endsWith:r,contains:i}),[n,r,i])}function rt(e,t){return e-t*Math.floor(e/t)}var it=1721426;function at(e,t,n,r){t=st(e,t);let i=t-1,a=-2;return n<=2?a=0:ot(t)&&(a=-1),1721425+365*i+Math.floor(i/4)-Math.floor(i/100)+Math.floor(i/400)+Math.floor((367*n-362)/12+a+r)}function ot(e){return e%4==0&&(e%100!=0||e%400==0)}function st(e,t){return e===`BC`?1-t:t}function ct(e){let t=`AD`;return e<=0&&(t=`BC`,e=1-e),[t,e]}var lt={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]},z=class{fromJulianDay(e){let t=e,n=t-it,r=Math.floor(n/146097),i=rt(n,146097),a=Math.floor(i/36524),o=rt(i,36524),s=Math.floor(o/1461),c=rt(o,1461),l=Math.floor(c/365),[u,d]=ct(r*400+a*100+s*4+l+ +(a!==4&&l!==4)),f=t-at(u,d,1,1),p=2;t=0?e:t:e||t}function zt(e){return e=G(e,new z),Bt(st(e.era,e.year),e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Bt(e,t,n,r,i,a,o){let s=new Date;return s.setUTCHours(r,i,a,o),s.setUTCFullYear(e,t-1,n),s.getTime()}function Vt(e,t){if(t===`UTC`)return 0;if(e>0&&t===Tt()&&!Et())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:r,day:i,hour:a,minute:o,second:s}=Ut(e,t);return Bt(n,r,i,a,o,s,0)-Math.floor(e/1e3)*1e3}var Ht=new Map;function Ut(e,t){let n=Ht.get(t);n||(n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,hour12:!1,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`}),Ht.set(t,n));let r=n.formatToParts(new Date(e)),i={};for(let e of r)e.type!==`literal`&&(i[e.type]=e.value);return{year:i.era===`BC`||i.era===`B`?-i.year+1:+i.year,month:+i.month,day:+i.day,hour:i.hour===`24`?0:+i.hour,minute:+i.minute,second:+i.second}}var Wt=864e5;function Gt(e,t,n,r){return(n===r?[n]:[n,r]).filter(n=>Kt(e,t,n))}function Kt(e,t,n){let r=Ut(n,t);return e.year===r.year&&e.month===r.month&&e.day===r.day&&e.hour===r.hour&&e.minute===r.minute&&e.second===r.second}function V(e,t,n=`compatible`){let r=W(e);if(t===`UTC`)return zt(r);if(t===Tt()&&n===`compatible`&&!Et()){r=G(r,new z);let e=new Date,t=st(r.era,r.year);return e.setFullYear(t,r.month-1,r.day),e.setHours(r.hour,r.minute,r.second,r.millisecond),e.getTime()}let i=zt(r),a=Vt(i-Wt,t),o=Vt(i+Wt,t),s=Gt(r,t,i-a,i-o);if(s.length===1)return s[0];if(s.length>1)switch(n){case`compatible`:case`earlier`:return s[0];case`later`:return s[s.length-1];case`reject`:throw RangeError(`Multiple possible absolute times found`)}switch(n){case`earlier`:return Math.min(i-a,i-o);case`compatible`:case`later`:return Math.max(i-a,i-o);case`reject`:throw RangeError(`No such absolute time found`)}}function qt(e,t,n=`compatible`){return new Date(V(e,t,n))}function H(e,t){let n=Vt(e,t),r=new Date(e+n),i=r.getUTCFullYear(),a=r.getUTCMonth()+1,o=r.getUTCDate(),s=r.getUTCHours(),c=r.getUTCMinutes(),l=r.getUTCSeconds(),u=r.getUTCMilliseconds();return new zn(i<1?`BC`:`AD`,i<1?-i+1:i,a,o,t,n,s,c,l,u)}function U(e){return new q(e.calendar,e.era,e.year,e.month,e.day)}function W(e,t){let n=0,r=0,i=0,a=0;if(`timeZone`in e)({hour:n,minute:r,second:i,millisecond:a}=e);else if(`hour`in e&&!t)return e;return t&&({hour:n,minute:r,second:i,millisecond:a}=t),new Rn(e.calendar,e.era,e.year,e.month,e.day,n,r,i,a)}function Jt(e){return new Ln(e.hour,e.minute,e.second,e.millisecond)}function G(e,t){if(mt(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),r=e.copy();return r.calendar=t,r.era=n.era,r.year=n.year,r.month=n.month,r.day=n.day,on(r),r}function Yt(e,t,n){return e instanceof zn?e.timeZone===t?e:Zt(e,t):H(V(e,t,n),t)}function Xt(e){let t=zt(e)-e.offset;return new Date(t)}function Zt(e,t){return G(H(zt(e)-e.offset,t),e.calendar)}function Qt(e){return Zt(e,Tt())}var $t=36e5;function en(e,t){let n=e.copy(),r=`hour`in n?mn(n,t):0;tn(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,nn(n),an(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=r,rn(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let i=n.calendar.getYearsInEra(n);if(n.year>i){let e=n.calendar.isInverseEra?.(n);n.year=i,n.month=e?1:n.calendar.getMonthsInYear(n),n.day=e?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let a=n.calendar.getMonthsInYear(n);return n.month>a&&(n.month=a,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function tn(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function nn(e){for(;e.month<1;)tn(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,tn(e,1)}function rn(e){for(;e.day<1;)e.month--,nn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,nn(e)}function an(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function on(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),an(e)}function sn(e){let t={};for(let n in e)typeof e[n]==`number`&&(t[n]=-e[n]);return t}function cn(e,t){return en(e,sn(t))}function ln(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),on(n),n}function un(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),fn(n),n}function dn(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=pn(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=pn(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=pn(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=pn(e.hour,24),t}function fn(e){e.millisecond=Math.max(0,Math.min(e.millisecond,999)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function pn(e,t){let n=e%t;return n<0&&(n+=t),n}function mn(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,dn(e)}function hn(e,t){let n=e.copy();return mn(n,t),n}function gn(e,t){return hn(e,sn(t))}function _n(e,t,n,r){let i=e.copy();switch(t){case`era`:{let t=e.calendar.getEras(),a=t.indexOf(e.era);if(a<0)throw Error(`Invalid era: `+e.era);a=yn(a,n,0,t.length-1,r?.round),i.era=t[a],on(i);break}case`year`:i.calendar.isInverseEra?.(i)&&(n=-n),i.year=yn(e.year,n,-1/0,9999,r?.round),i.year===-1/0&&(i.year=1),i.calendar.balanceYearMonth&&i.calendar.balanceYearMonth(i,e);break;case`month`:i.month=yn(e.month,n,1,e.calendar.getMonthsInYear(e),r?.round);break;case`day`:i.day=yn(e.day,n,1,e.calendar.getDaysInMonth(e),r?.round);break;default:throw Error(`Unsupported field `+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(i),on(i),i}function vn(e,t,n,r){let i=e.copy();switch(t){case`hour`:{let t=e.hour,a=0,o=23;if(r?.hourCycle===12){let e=t>=12;a=e?12:0,o=e?23:11}i.hour=yn(t,n,a,o,r?.round);break}case`minute`:i.minute=yn(e.minute,n,0,59,r?.round);break;case`second`:i.second=yn(e.second,n,0,59,r?.round);break;case`millisecond`:i.millisecond=yn(e.millisecond,n,0,999,r?.round);break;default:throw Error(`Unsupported field `+t)}return i}function yn(e,t,n,r,i=!1){if(i){e+=Math.sign(t),e0?Math.ceil(e/i)*i:Math.floor(e/i)*i,e>r&&(e=n)}else e+=t,er&&(e=n+(e-r-1));return e}function bn(e,t){let n;return n=t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0?V(en(W(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days}),e.timeZone):zt(e)-e.offset,n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5,G(H(n,e.timeZone),e.calendar)}function xn(e,t){return bn(e,sn(t))}function Sn(e,t,n,r){switch(t){case`hour`:{let t=0,i=23;if(r?.hourCycle===12){let n=e.hour>=12;t=n?12:0,i=n?23:11}let a=W(e),o=G(un(a,{hour:t}),new z),s=[V(o,e.timeZone,`earlier`),V(o,e.timeZone,`later`)].filter(t=>H(t,e.timeZone).day===o.day)[0],c=G(un(a,{hour:i}),new z),l=[V(c,e.timeZone,`earlier`),V(c,e.timeZone,`later`)].filter(t=>H(t,e.timeZone).day===c.day).pop(),u=zt(e)-e.offset,d=Math.floor(u/$t),f=u%$t;return u=yn(d,n,Math.floor(s/$t),Math.floor(l/$t),r?.round)*$t+f,G(H(u,e.timeZone),e.calendar)}case`minute`:case`second`:case`millisecond`:return vn(e,t,n,r);case`era`:case`year`:case`month`:case`day`:return G(H(V(_n(W(e),t,n,r),e.timeZone),e.timeZone),e.calendar);default:throw Error(`Unsupported field `+t)}}function Cn(e,t,n){let r=W(e),i=un(ln(r,t),t);return i.compare(r)===0?e:G(H(V(i,e.timeZone,n),e.timeZone),e.calendar)}var wn=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Tn=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/,En=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Dn(e){let t=e.match(wn);if(!t)throw En.test(e)?Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):Error(`Invalid ISO 8601 date string: `+e);let n=new q(K(t[1],0,9999),K(t[2],1,12),1);return n.day=K(t[3],1,n.calendar.getDaysInMonth(n)),n}function On(e){let t=e.match(Tn);if(!t)throw En.test(e)?Error(`Invalid ISO 8601 date time string: ${e}. Use parseAbsolute() instead.`):Error(`Invalid ISO 8601 date time string: `+e);let n=K(t[1],-9999,9999),r=new Rn(n<1?`BC`:`AD`,n<1?-n+1:n,K(t[2],1,12),1,t[4]?K(t[4],0,23):0,t[5]?K(t[5],0,59):0,t[6]?K(t[6],0,59):0,t[7]?K(t[7],0,1/0)*1e3:0);return r.day=K(t[3],0,r.calendar.getDaysInMonth(r)),r}function kn(e,t){let n=e.match(En);if(!n)throw Error(`Invalid ISO 8601 date time string: `+e);let r=K(n[1],-9999,9999),i=new zn(r<1?`BC`:`AD`,r<1?-r+1:r,K(n[2],1,12),1,t,0,n[4]?K(n[4],0,23):0,n[5]?K(n[5],0,59):0,n[6]?K(n[6],0,59):0,n[7]?K(n[7],0,1/0)*1e3:0);return i.day=K(n[3],0,i.calendar.getDaysInMonth(i)),n[8]&&(i.offset=K(n[8],-23,23)*36e5+K(n[9]??`0`,0,59)*6e4),Zt(i,t)}function An(e){return kn(e,Tt())}function K(e,t,n){let r=Number(e);if(rn)throw RangeError(`Value out of range: ${t} <= ${r} <= ${n}`);return r}function jn(e){return`${String(e.hour).padStart(2,`0`)}:${String(e.minute).padStart(2,`0`)}:${String(e.second).padStart(2,`0`)}${e.millisecond?String(e.millisecond/1e3).slice(1):``}`}function Mn(e){let t=G(e,new z),n;return n=t.era===`BC`?t.year===1?`0000`:`-`+String(Math.abs(1-t.year)).padStart(6,`00`):String(t.year).padStart(4,`0`),`${n}-${String(t.month).padStart(2,`0`)}-${String(t.day).padStart(2,`0`)}`}function Nn(e){return`${Mn(e)}T${jn(e)}`}function Pn(e){let t=Math.sign(e)<0?`-`:`+`;e=Math.abs(e);let n=Math.floor(e/36e5),r=Math.floor(e%36e5/6e4),i=Math.floor(e%36e5%6e4/1e3),a=`${t}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`;return i!==0&&(a+=`:${String(i).padStart(2,`0`)}`),a}function Fn(e){return`${Nn(e)}${Pn(e.offset)}[${e.timeZone}]`}function In(e){let t=typeof e[0]==`object`?e.shift():new z,n;if(typeof e[0]==`string`)n=e.shift();else{let e=t.getEras();n=e[e.length-1]}let r=e.shift(),i=e.shift(),a=e.shift();return[t,n,r,i,a]}var q=class e{constructor(...e){let[t,n,r,i,a]=In(e);this.calendar=t,this.era=n,this.year=r,this.month=i,this.day=a,on(this)}copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day):new e(this.calendar,this.year,this.month,this.day)}add(e){return en(this,e)}subtract(e){return cn(this,e)}set(e){return ln(this,e)}cycle(e,t,n){return _n(this,e,t,n)}toDate(e){return qt(this,e)}toString(){return Mn(this)}compare(e){return bt(this,e)}},Ln=class e{constructor(e=0,t=0,n=0,r=0){this.hour=e,this.minute=t,this.second=n,this.millisecond=r,fn(this)}copy(){return new e(this.hour,this.minute,this.second,this.millisecond)}add(e){return hn(this,e)}subtract(e){return gn(this,e)}set(e){return un(this,e)}cycle(e,t,n){return vn(this,e,t,n)}toString(){return jn(this)}compare(e){return xt(this,e)}},Rn=class e{constructor(...e){let[t,n,r,i,a]=In(e);this.calendar=t,this.era=n,this.year=r,this.month=i,this.day=a,this.hour=e.shift()||0,this.minute=e.shift()||0,this.second=e.shift()||0,this.millisecond=e.shift()||0,on(this)}copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new e(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(e){return en(this,e)}subtract(e){return cn(this,e)}set(e){return ln(un(this,e),e)}cycle(e,t,n){switch(e){case`era`:case`year`:case`month`:case`day`:return _n(this,e,t,n);default:return vn(this,e,t,n)}}toDate(e,t){return qt(this,e,t)}toString(){return Nn(this)}compare(e){let t=bt(this,e);return t===0?xt(this,W(e)):t}},zn=class e{constructor(...e){let[t,n,r,i,a]=In(e),o=e.shift(),s=e.shift();this.calendar=t,this.era=n,this.year=r,this.month=i,this.day=a,this.timeZone=o,this.offset=s,this.hour=e.shift()||0,this.minute=e.shift()||0,this.second=e.shift()||0,this.millisecond=e.shift()||0,on(this)}copy(){return this.era?new e(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new e(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(e){return bn(this,e)}subtract(e){return xn(this,e)}set(e,t){return Cn(this,e,t)}cycle(e,t,n){return Sn(this,e,t,n)}toDate(){return Xt(this)}toString(){return Fn(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(e){return this.toDate().getTime()-Yt(e,this.timeZone).toDate().getTime()}},Bn=[[1868,9,8],[1912,7,30],[1926,12,25],[1989,1,8],[2019,5,1]],Vn=[[1912,7,29],[1926,12,24],[1989,1,7],[2019,4,30]],Hn=[1867,1911,1925,1988,2018],Un=[`meiji`,`taisho`,`showa`,`heisei`,`reiwa`];function Wn(e){let t=Bn.findIndex(([t,n,r])=>e.year=0){let[,n,r]=Bn[t];e.month=Math.max(n,e.month),e.month===n&&(e.day=Math.max(r,e.day))}}getEras(){return Un}getYearsInEra(e){let t=Un.indexOf(e.era),n=Bn[t],r=Bn[t+1];if(r==null)return 9999-n[0]+1;let i=r[0]-n[0];return(e.month0?[`minguo`,t]:[`before_minguo`,1-t]}var er=class extends z{fromJulianDay(e){let t=super.fromJulianDay(e),[n,r]=$n(st(t.era,t.year));return new q(this,n,r,t.month,t.day)}toJulianDay(e){return super.toJulianDay(tr(e))}getEras(){return[`before_minguo`,`minguo`]}balanceDate(e){let[t,n]=$n(Qn(e));e.era=t,e.year=n}isInverseEra(e){return e.era===`before_minguo`}getDaysInMonth(e){return super.getDaysInMonth(tr(e))}getYearsInEra(e){return e.era===`before_minguo`?9999:8088}constructor(...e){super(...e),this.identifier=`roc`}};function tr(e){let[t,n]=ct(Qn(e));return new q(t,n,e.month,e.day)}var nr=1948320,rr=[0,31,62,93,124,155,186,216,246,276,306,336],ir=class{fromJulianDay(e){let t=e-nr,n=1+Math.floor((33*t+3)/12053),r=t-(365*(n-1)+Math.floor((8*n+21)/33)),i=Math.floor(r<216?r/31:(r-6)/30),a=r-rr[i]+1;return new q(this,n,i+1,a)}toJulianDay(e){let t=1948319+365*(e.year-1)+Math.floor((8*e.year+21)/33);return t+=rr[e.month-1],t+=e.day,t}getMonthsInYear(){return 12}getDaysInMonth(e){return e.month<=6?31:e.month<=11||rt(25*e.year+11,33)<8?30:29}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getEras(){return[`AP`]}getYearsInEra(){return 9377}constructor(){this.identifier=`persian`}},ar=78,or=80,sr=class extends z{fromJulianDay(e){let t=super.fromJulianDay(e),n=t.year-ar,r=e-at(t.era,t.year,1,1),i;r=8&&(i+=(e.month-7)*30),i+=e.day-1,i)}getDaysInMonth(e){return e.month===1&&ot(e.year+ar)||e.month>=2&&e.month<=6?31:30}getYearsInEra(){return 9919}getEras(){return[`saka`]}balanceDate(){}constructor(...e){super(...e),this.identifier=`indian`}},cr=1948440,lr=1948439,J=1300,ur=1600,dr=460322;function fr(e,t,n,r){return r+Math.ceil(29.5*(n-1))+(t-1)*354+Math.floor((3+11*t)/30)+e-1}function pr(e,t,n){let r=Math.floor((30*(n-t)+10646)/10631),i=Math.min(12,Math.ceil((n-(29+fr(t,r,1,1)))/29.5)+1);return new q(e,r,i,n-fr(t,r,i,1)+1)}function mr(e){return(14+11*e)%30<11}var hr=class{fromJulianDay(e){return pr(this,cr,e)}toJulianDay(e){return fr(cr,e.year,e.month,e.day)}getDaysInMonth(e){let t=29+e.month%2;return e.month===12&&mr(e.year)&&t++,t}getMonthsInYear(){return 12}getDaysInYear(e){return mr(e.year)?355:354}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 30}getYearsInEra(){return 9665}getEras(){return[`AH`]}constructor(){this.identifier=`islamic-civil`}},gr=class extends hr{fromJulianDay(e){return pr(this,lr,e)}toJulianDay(e){return fr(lr,e.year,e.month,e.day)}constructor(...e){super(...e),this.identifier=`islamic-tbla`}},_r=`qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=`,vr,yr;function br(e){return dr+yr[e-J]}function xr(e,t){let n=e-J,r=1<<11-(t-1);return(vr[n]&r)===0?29:30}function Sr(e,t){let n=br(e);for(let r=1;re.charCodeAt(0)).buffer),!yr){yr=new Uint32Array(301);let e=0;for(let t=J;t<=ur;t++){yr[t-J]=e;for(let n=1;n<=12;n++)e+=xr(t,n)}}}fromJulianDay(e){let t=e-cr,n=br(J),r=br(ur);if(tr)return super.fromJulianDay(e);{let e=1299,n=1,r=1;for(;r>0;){e++,r=t-br(e)+1;let i=Cr(e);if(r===i){n=12;break}if(rt;)r-=t,n++,t=xr(e,n);break}}return new q(this,e,n,t-Sr(e,n)+1)}}toJulianDay(e){return e.yearur?super.toJulianDay(e):cr+Sr(e.year,e.month)+(e.day-1)}getDaysInMonth(e){return e.yearur?super.getDaysInMonth(e):xr(e.year,e.month)}getDaysInYear(e){return e.yearur?super.getDaysInYear(e):Cr(e.year)}},Tr=347997,Er=25920,Dr=765433;function Or(e){return rt(e*7+1,19)<7}function kr(e){let t=Math.floor((235*e-234)/19),n=12084+13753*t,r=t*29+Math.floor(n/25920);return rt(3*(r+1),7)<3&&(r+=1),r}function Ar(e){let t=kr(e-1),n=kr(e);return kr(e+1)-n===356?2:+(n-t===382)}function jr(e){return kr(e)+Ar(e)}function Mr(e){return jr(e+1)-jr(e)}function Nr(e){let t=Mr(e);switch(t>380&&(t-=30),t){case 353:return 0;case 354:return 1;case 355:return 2}}function Pr(e,t){if(t>=6&&!Or(e)&&t++,t===4||t===7||t===9||t===11||t===13)return 29;let n=Nr(e);return t===2?n===2?30:29:t===3?n===0?29:30:t===6?Or(e)?30:0:30}var Fr=class{fromJulianDay(e){let t=e-Tr,n=t*Er/Dr,r=Math.floor((19*n+234)/235)+1,i=jr(r),a=Math.floor(t-i);for(;a<1;)r--,i=jr(r),a=Math.floor(t-i);let o=1,s=0;for(;s6?e.month--:!Or(t.year)&&Or(e.year)&&t.month>6&&e.month++)}constructor(){this.identifier=`hebrew`}},Ir=1723856,Lr=1824665,Rr=5500;function zr(e,t,n,r){return e+365*t+Math.floor(t/4)+30*(n-1)+r-1}function Br(e,t){let n=Math.floor(4*(t-e)/1461),r=1+Math.floor((t-zr(e,n,1,1))/30);return[n,r,t+1-zr(e,n,r,1)]}function Vr(e){return Math.floor(e%4/3)}function Hr(e,t){return t%13==0?Vr(e)+5:30}var Ur=class{fromJulianDay(e){let[t,n,r]=Br(Ir,e),i=`AM`;return t<=0&&(i=`AA`,t+=Rr),new q(this,i,t,n,r)}toJulianDay(e){let t=e.year;return e.era===`AA`&&(t-=Rr),zr(Ir,t,e.month,e.day)}getDaysInMonth(e){return Hr(e.year,e.month)}getMonthsInYear(){return 13}getDaysInYear(e){return 365+Vr(e.year)}getMaximumMonthsInYear(){return 13}getMaximumDaysInMonth(){return 30}getYearsInEra(e){return e.era===`AA`?9999:9991}getEras(){return[`AA`,`AM`]}constructor(){this.identifier=`ethiopic`}},Wr=class extends Ur{fromJulianDay(e){let[t,n,r]=Br(Ir,e);return t+=Rr,new q(this,`AA`,t,n,r)}getEras(){return[`AA`]}getYearsInEra(){return 9999}constructor(...e){super(...e),this.identifier=`ethioaa`}},Gr=class extends Ur{fromJulianDay(e){let[t,n,r]=Br(Lr,e),i=`CE`;return t<=0&&(i=`BCE`,t=1-t),new q(this,i,t,n,r)}toJulianDay(e){let t=e.year;return e.era===`BCE`&&(t=1-t),zr(Lr,t,e.month,e.day)}getDaysInMonth(e){let t=e.year;return e.era===`BCE`&&(t=1-t),Hr(t,e.month)}isInverseEra(e){return e.era===`BCE`}balanceDate(e){e.year<=0&&(e.era=e.era===`BCE`?`CE`:`BCE`,e.year=1-e.year)}getEras(){return[`BCE`,`CE`]}getYearsInEra(e){return e.era===`BCE`?9999:9715}constructor(...e){super(...e),this.identifier=`coptic`}};function Kr(e){switch(e){case`buddhist`:return new Yn;case`ethiopic`:return new Ur;case`ethioaa`:return new Wr;case`coptic`:return new Gr;case`hebrew`:return new Fr;case`indian`:return new sr;case`islamic-civil`:return new hr;case`islamic-tbla`:return new gr;case`islamic-umalqura`:return new wr;case`japanese`:return new Kn;case`persian`:return new ir;case`roc`:return new er;default:return new z}}var qr=new Map,Y=class{constructor(e,t={}){this.formatter=Yr(e,t),this.options=t}format(e){return this.formatter.format(e)}formatToParts(e){return this.formatter.formatToParts(e)}formatRange(e,t){if(typeof this.formatter.formatRange==`function`)return this.formatter.formatRange(e,t);if(t= start date`);return`${this.formatter.format(e)} \u{2013} ${this.formatter.format(t)}`}formatRangeToParts(e,t){if(typeof this.formatter.formatRangeToParts==`function`)return this.formatter.formatRangeToParts(e,t);if(t= start date`);let n=this.formatter.formatToParts(e),r=this.formatter.formatToParts(t);return[...n.map(e=>({...e,source:`startRange`})),{type:`literal`,value:` – `,source:`shared`},...r.map(e=>({...e,source:`endRange`}))]}resolvedOptions(){let e=this.formatter.resolvedOptions();return $r()&&(this.resolvedHourCycle||=ei(e.locale,this.options),e.hourCycle=this.resolvedHourCycle,e.hour12=this.resolvedHourCycle===`h11`||this.resolvedHourCycle===`h12`),e.calendar===`ethiopic-amete-alem`&&(e.calendar=`ethioaa`),e}},Jr={true:{ja:`h11`},false:{}};function Yr(e,t={}){if(typeof t.hour12==`boolean`&&Zr()){t={...t};let n=Jr[String(t.hour12)][e.split(`-`)[0]],r=t.hour12?`h12`:`h23`;t.hourCycle=n??r,delete t.hour12}let n=e+(t?Object.entries(t).sort((e,t)=>e[0]e.type===`hour`).value,10),i=parseInt(n.formatToParts(new Date(2020,2,3,23)).find(e=>e.type===`hour`).value,10);if(r===0&&i===23)return`h23`;if(r===24&&i===23)return`h24`;if(r===0&&i===11)return`h11`;if(r===12&&i===11)return`h12`;throw Error(`Unexpected hour cycle result`)}var X=n(),ti=[`day`,`month`,`year`],ni={hour:1,minute:2,second:3};function ri(e,t){let{autoComplete:n,isDisabled:r,name:a}=e,{visuallyHiddenProps:o}=i({style:{position:`fixed`,top:0,left:0}}),s=60;t.granularity===`second`?s=1:t.granularity===`hour`&&(s=3600);let c=``;t.value&&(c=t.granularity===`day`?U(t.value).toString():W(`timeZone`in t.value?Qt(t.value):t.value).toString());let l=t.granularity===`day`?`date`:`datetime-local`,u=[`hour`,`minute`,`second`],d=0;return u.includes(t.granularity)&&(d=ni[t.granularity],u=u.slice(0,d)),{containerProps:{...o,"aria-hidden":!0,"data-react-aria-prevent-focus":!0,"data-a11y-ignore":`aria-hidden-focus`},inputProps:{tabIndex:-1,autoComplete:n,disabled:r,type:l,form:``,name:a,step:s,value:c,onChange:e=>{let n=fe(e).value.toString();if(n)try{let e=On(n);if(t.granularity===`day`&&(e=Dn(n)),`setSegment`in t)for(let n in e)ti.includes(n)&&t.setSegment(n,e[n]),u.includes(n)&&t.setSegment(n,e[n]);t.setValue(e)}catch{}}}}}function ii(e){let{state:t}=e,{containerProps:n,inputProps:r}=ri({...e},t);return R.createElement(`div`,{...n,"data-testid":`hidden-dateinput-container`},R.createElement(`input`,r))}var ai={};ai={calendar:`التقويم`,day:`يوم`,dayPeriod:`ص/م`,endDate:`تاريخ الانتهاء`,era:`العصر`,hour:`الساعات`,minute:`الدقائق`,month:`الشهر`,second:`الثواني`,selectedDateDescription:e=>`\u{62A}\u{627}\u{631}\u{64A}\u{62E} \u{645}\u{62D}\u{62F}\u{62F}: ${e.date}`,selectedRangeDescription:e=>`\u{627}\u{644}\u{645}\u{62F}\u{649} \u{627}\u{644}\u{632}\u{645}\u{646}\u{64A} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}: ${e.startDate} \u{625}\u{644}\u{649} ${e.endDate}`,selectedTimeDescription:e=>`\u{627}\u{644}\u{648}\u{642}\u{62A} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}: ${e.time}`,startDate:`تاريخ البدء`,timeZoneName:`التوقيت`,weekday:`اليوم`,year:`السنة`};var oi={};oi={calendar:`Календар`,day:`ден`,dayPeriod:`пр.об./сл.об.`,endDate:`Крайна дата`,era:`ера`,hour:`час`,minute:`минута`,month:`месец`,second:`секунда`,selectedDateDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.startDate} \u{434}\u{43E} ${e.endDate}`,selectedTimeDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{43E} \u{432}\u{440}\u{435}\u{43C}\u{435}: ${e.time}`,startDate:`Начална дата`,timeZoneName:`часова зона`,weekday:`ден от седмицата`,year:`година`};var si={};si={calendar:`Kalendář`,day:`den`,dayPeriod:`část dne`,endDate:`Konečné datum`,era:`letopočet`,hour:`hodina`,minute:`minuta`,month:`měsíc`,second:`sekunda`,selectedDateDescription:e=>`Vybran\xe9 datum: ${e.date}`,selectedRangeDescription:e=>`Vybran\xe9 obdob\xed: ${e.startDate} a\u{17E} ${e.endDate}`,selectedTimeDescription:e=>`Vybran\xfd \u{10D}as: ${e.time}`,startDate:`Počáteční datum`,timeZoneName:`časové pásmo`,weekday:`den v týdnu`,year:`rok`};var ci={};ci={calendar:`Kalender`,day:`dag`,dayPeriod:`AM/PM`,endDate:`Slutdato`,era:`æra`,hour:`time`,minute:`minut`,month:`måned`,second:`sekund`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt interval: ${e.startDate} til ${e.endDate}`,selectedTimeDescription:e=>`Valgt tidspunkt: ${e.time}`,startDate:`Startdato`,timeZoneName:`tidszone`,weekday:`ugedag`,year:`år`};var li={};li={calendar:`Kalender`,day:`Tag`,dayPeriod:`Tageshälfte`,endDate:`Enddatum`,era:`Epoche`,hour:`Stunde`,minute:`Minute`,month:`Monat`,second:`Sekunde`,selectedDateDescription:e=>`Ausgew\xe4hltes Datum: ${e.date}`,selectedRangeDescription:e=>`Ausgew\xe4hlter Bereich: ${e.startDate} bis ${e.endDate}`,selectedTimeDescription:e=>`Ausgew\xe4hlte Zeit: ${e.time}`,startDate:`Startdatum`,timeZoneName:`Zeitzone`,weekday:`Wochentag`,year:`Jahr`};var ui={};ui={calendar:`Ημερολόγιο`,day:`ημέρα`,dayPeriod:`π.μ./μ.μ.`,endDate:`Ημερομηνία λήξης`,era:`περίοδος`,hour:`ώρα`,minute:`λεπτό`,month:`μήνας`,second:`δευτερόλεπτο`,selectedDateDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3B7} \u{3B7}\u{3BC}\u{3B5}\u{3C1}\u{3BF}\u{3BC}\u{3B7}\u{3BD}\u{3AF}\u{3B1}: ${e.date}`,selectedRangeDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3BF} \u{3B5}\u{3CD}\u{3C1}\u{3BF}\u{3C2}: ${e.startDate} \u{3AD}\u{3C9}\u{3C2} ${e.endDate}`,selectedTimeDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3B7} \u{3CE}\u{3C1}\u{3B1}: ${e.time}`,startDate:`Ημερομηνία έναρξης`,timeZoneName:`ζώνη ώρας`,weekday:`καθημερινή`,year:`έτος`};var di={};di={era:`era`,year:`year`,month:`month`,day:`day`,hour:`hour`,minute:`minute`,second:`second`,dayPeriod:`AM/PM`,calendar:`Calendar`,startDate:`Start Date`,endDate:`End Date`,weekday:`day of the week`,timeZoneName:`time zone`,selectedDateDescription:e=>`Selected Date: ${e.date}`,selectedRangeDescription:e=>`Selected Range: ${e.startDate} to ${e.endDate}`,selectedTimeDescription:e=>`Selected Time: ${e.time}`};var fi={};fi={calendar:`Calendario`,day:`día`,dayPeriod:`a.\xA0m./p.\xA0m.`,endDate:`Fecha final`,era:`era`,hour:`hora`,minute:`minuto`,month:`mes`,second:`segundo`,selectedDateDescription:e=>`Fecha seleccionada: ${e.date}`,selectedRangeDescription:e=>`Rango seleccionado: ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Hora seleccionada: ${e.time}`,startDate:`Fecha de inicio`,timeZoneName:`zona horaria`,weekday:`día de la semana`,year:`año`};var pi={};pi={calendar:`Kalender`,day:`päev`,dayPeriod:`enne/pärast lõunat`,endDate:`Lõppkuupäev`,era:`ajastu`,hour:`tund`,minute:`minut`,month:`kuu`,second:`sekund`,selectedDateDescription:e=>`Valitud kuup\xe4ev: ${e.date}`,selectedRangeDescription:e=>`Valitud vahemik: ${e.startDate} kuni ${e.endDate}`,selectedTimeDescription:e=>`Valitud aeg: ${e.time}`,startDate:`Alguskuupäev`,timeZoneName:`ajavöönd`,weekday:`nädalapäev`,year:`aasta`};var mi={};mi={calendar:`Kalenteri`,day:`päivä`,dayPeriod:`vuorokaudenaika`,endDate:`Päättymispäivä`,era:`aikakausi`,hour:`tunti`,minute:`minuutti`,month:`kuukausi`,second:`sekunti`,selectedDateDescription:e=>`Valittu p\xe4iv\xe4m\xe4\xe4r\xe4: ${e.date}`,selectedRangeDescription:e=>`Valittu aikav\xe4li: ${e.startDate} \u{2013} ${e.endDate}`,selectedTimeDescription:e=>`Valittu aika: ${e.time}`,startDate:`Alkamispäivä`,timeZoneName:`aikavyöhyke`,weekday:`viikonpäivä`,year:`vuosi`};var hi={};hi={calendar:`Calendrier`,day:`jour`,dayPeriod:`cadran`,endDate:`Date de fin`,era:`ère`,hour:`heure`,minute:`minute`,month:`mois`,second:`seconde`,selectedDateDescription:e=>`Date s\xe9lectionn\xe9e\xa0: ${e.date}`,selectedRangeDescription:e=>`Plage s\xe9lectionn\xe9e\xa0: ${e.startDate} au ${e.endDate}`,selectedTimeDescription:e=>`Heure choisie\xa0: ${e.time}`,startDate:`Date de début`,timeZoneName:`fuseau horaire`,weekday:`jour de la semaine`,year:`année`};var gi={};gi={calendar:`לוח שנה`,day:`יום`,dayPeriod:`לפנה״צ/אחה״צ`,endDate:`תאריך סיום`,era:`תקופה`,hour:`שעה`,minute:`דקה`,month:`חודש`,second:`שנייה`,selectedDateDescription:e=>`\u{5EA}\u{5D0}\u{5E8}\u{5D9}\u{5DA} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.date}`,selectedRangeDescription:e=>`\u{5D8}\u{5D5}\u{5D5}\u{5D7} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.startDate} \u{5E2}\u{5D3} ${e.endDate}`,selectedTimeDescription:e=>`\u{5D6}\u{5DE}\u{5DF} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.time}`,startDate:`תאריך התחלה`,timeZoneName:`אזור זמן`,weekday:`יום בשבוע`,year:`שנה`};var _i={};_i={calendar:`Kalendar`,day:`dan`,dayPeriod:`AM/PM`,endDate:`Datum završetka`,era:`era`,hour:`sat`,minute:`minuta`,month:`mjesec`,second:`sekunda`,selectedDateDescription:e=>`Odabrani datum: ${e.date}`,selectedRangeDescription:e=>`Odabrani raspon: ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Odabrano vrijeme: ${e.time}`,startDate:`Datum početka`,timeZoneName:`vremenska zona`,weekday:`dan u tjednu`,year:`godina`};var vi={};vi={calendar:`Naptár`,day:`nap`,dayPeriod:`napszak`,endDate:`Befejező dátum`,era:`éra`,hour:`óra`,minute:`perc`,month:`hónap`,second:`másodperc`,selectedDateDescription:e=>`Kijel\xf6lt d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Kijel\xf6lt tartom\xe1ny: ${e.startDate}\u{2013}${e.endDate}`,selectedTimeDescription:e=>`Kijel\xf6lt id\u{151}: ${e.time}`,startDate:`Kezdő dátum`,timeZoneName:`időzóna`,weekday:`hét napja`,year:`év`};var yi={};yi={calendar:`Calendario`,day:`giorno`,dayPeriod:`AM/PM`,endDate:`Data finale`,era:`era`,hour:`ora`,minute:`minuto`,month:`mese`,second:`secondo`,selectedDateDescription:e=>`Data selezionata: ${e.date}`,selectedRangeDescription:e=>`Intervallo selezionato: da ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Ora selezionata: ${e.time}`,startDate:`Data iniziale`,timeZoneName:`fuso orario`,weekday:`giorno della settimana`,year:`anno`};var bi={};bi={calendar:`カレンダー`,day:`日`,dayPeriod:`午前/午後`,endDate:`終了日`,era:`時代`,hour:`時`,minute:`分`,month:`月`,second:`秒`,selectedDateDescription:e=>`\u{9078}\u{629E}\u{3057}\u{305F}\u{65E5}\u{4ED8} : ${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{629E}\u{7BC4}\u{56F2} : ${e.startDate} \u{304B}\u{3089} ${e.endDate}`,selectedTimeDescription:e=>`\u{9078}\u{629E}\u{3057}\u{305F}\u{6642}\u{9593} : ${e.time}`,startDate:`開始日`,timeZoneName:`タイムゾーン`,weekday:`曜日`,year:`年`};var xi={};xi={calendar:`달력`,day:`일`,dayPeriod:`오전/오후`,endDate:`종료일`,era:`연호`,hour:`시`,minute:`분`,month:`월`,second:`초`,selectedDateDescription:e=>`\u{C120}\u{D0DD} \u{C77C}\u{C790}: ${e.date}`,selectedRangeDescription:e=>`\u{C120}\u{D0DD} \u{BC94}\u{C704}: ${e.startDate} ~ ${e.endDate}`,selectedTimeDescription:e=>`\u{C120}\u{D0DD} \u{C2DC}\u{AC04}: ${e.time}`,startDate:`시작일`,timeZoneName:`시간대`,weekday:`요일`,year:`년`};var Si={};Si={calendar:`Kalendorius`,day:`diena`,dayPeriod:`iki pietų / po pietų`,endDate:`Pabaigos data`,era:`era`,hour:`valanda`,minute:`minutė`,month:`mėnuo`,second:`sekundė`,selectedDateDescription:e=>`Pasirinkta data: ${e.date}`,selectedRangeDescription:e=>`Pasirinktas intervalas: nuo ${e.startDate} iki ${e.endDate}`,selectedTimeDescription:e=>`Pasirinktas laikas: ${e.time}`,startDate:`Pradžios data`,timeZoneName:`laiko juosta`,weekday:`savaitės diena`,year:`metai`};var Ci={};Ci={calendar:`Kalendārs`,day:`diena`,dayPeriod:`priekšpusdienā/pēcpusdienā`,endDate:`Beigu datums`,era:`ēra`,hour:`stundas`,minute:`minūtes`,month:`mēnesis`,second:`sekundes`,selectedDateDescription:e=>`Atlas\u{12B}tais datums: ${e.date}`,selectedRangeDescription:e=>`Atlas\u{12B}tais diapazons: no ${e.startDate} l\u{12B}dz ${e.endDate}`,selectedTimeDescription:e=>`Atlas\u{12B}tais laiks: ${e.time}`,startDate:`Sākuma datums`,timeZoneName:`laika josla`,weekday:`nedēļas diena`,year:`gads`};var wi={};wi={calendar:`Kalender`,day:`dag`,dayPeriod:`a.m./p.m.`,endDate:`Sluttdato`,era:`tidsalder`,hour:`time`,minute:`minutt`,month:`måned`,second:`sekund`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt omr\xe5de: ${e.startDate} til ${e.endDate}`,selectedTimeDescription:e=>`Valgt tid: ${e.time}`,startDate:`Startdato`,timeZoneName:`tidssone`,weekday:`ukedag`,year:`år`};var Ti={};Ti={calendar:`Kalender`,day:`dag`,dayPeriod:`a.m./p.m.`,endDate:`Einddatum`,era:`tijdperk`,hour:`uur`,minute:`minuut`,month:`maand`,second:`seconde`,selectedDateDescription:e=>`Geselecteerde datum: ${e.date}`,selectedRangeDescription:e=>`Geselecteerd bereik: ${e.startDate} tot ${e.endDate}`,selectedTimeDescription:e=>`Geselecteerde tijd: ${e.time}`,startDate:`Startdatum`,timeZoneName:`tijdzone`,weekday:`dag van de week`,year:`jaar`};var Ei={};Ei={calendar:`Kalendarz`,day:`dzień`,dayPeriod:`rano / po południu / wieczorem`,endDate:`Data końcowa`,era:`era`,hour:`godzina`,minute:`minuta`,month:`miesiąc`,second:`sekunda`,selectedDateDescription:e=>`Wybrana data: ${e.date}`,selectedRangeDescription:e=>`Wybrany zakres: ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Wybrany czas: ${e.time}`,startDate:`Data początkowa`,timeZoneName:`strefa czasowa`,weekday:`dzień tygodnia`,year:`rok`};var Di={};Di={calendar:`Calendário`,day:`dia`,dayPeriod:`AM/PM`,endDate:`Data final`,era:`era`,hour:`hora`,minute:`minuto`,month:`mês`,second:`segundo`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Hora selecionada: ${e.time}`,startDate:`Data inicial`,timeZoneName:`fuso horário`,weekday:`dia da semana`,year:`ano`};var Oi={};Oi={calendar:`Calendário`,day:`dia`,dayPeriod:`am/pm`,endDate:`Data de Término`,era:`era`,hour:`hora`,minute:`minuto`,month:`mês`,second:`segundo`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.startDate} a ${e.endDate}`,selectedTimeDescription:e=>`Hora selecionada: ${e.time}`,startDate:`Data de Início`,timeZoneName:`fuso horário`,weekday:`dia da semana`,year:`ano`};var ki={};ki={calendar:`Calendar`,day:`zi`,dayPeriod:`a.m/p.m.`,endDate:`Dată final`,era:`eră`,hour:`oră`,minute:`minut`,month:`lună`,second:`secundă`,selectedDateDescription:e=>`Dat\u{103} selectat\u{103}: ${e.date}`,selectedRangeDescription:e=>`Interval selectat: de la ${e.startDate} p\xe2n\u{103} la ${e.endDate}`,selectedTimeDescription:e=>`Ora selectat\u{103}: ${e.time}`,startDate:`Dată început`,timeZoneName:`fus orar`,weekday:`ziua din săptămână`,year:`an`};var Ai={};Ai={calendar:`Календарь`,day:`день`,dayPeriod:`AM/PM`,endDate:`Дата окончания`,era:`эра`,hour:`час`,minute:`минута`,month:`месяц`,second:`секунда`,selectedDateDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{430}\u{44F} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{44B}\u{439} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: \u{441} ${e.startDate} \u{43F}\u{43E} ${e.endDate}`,selectedTimeDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{43E}\u{435} \u{432}\u{440}\u{435}\u{43C}\u{44F}: ${e.time}`,startDate:`Дата начала`,timeZoneName:`часовой пояс`,weekday:`день недели`,year:`год`};var ji={};ji={calendar:`Kalendár`,day:`deň`,dayPeriod:`AM/PM`,endDate:`Dátum ukončenia`,era:`letopočet`,hour:`hodina`,minute:`minúta`,month:`mesiac`,second:`sekunda`,selectedDateDescription:e=>`Vybrat\xfd d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Vybrat\xfd rozsah: od ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Vybrat\xfd \u{10D}as: ${e.time}`,startDate:`Dátum začatia`,timeZoneName:`časové pásmo`,weekday:`deň týždňa`,year:`rok`};var Mi={};Mi={calendar:`Koledar`,day:`dan`,dayPeriod:`dop/pop`,endDate:`Datum konca`,era:`doba`,hour:`ura`,minute:`minuta`,month:`mesec`,second:`sekunda`,selectedDateDescription:e=>`Izbrani datum: ${e.date}`,selectedRangeDescription:e=>`Izbrano obmo\u{10D}je: ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Izbrani \u{10D}as: ${e.time}`,startDate:`Datum začetka`,timeZoneName:`časovni pas`,weekday:`dan v tednu`,year:`leto`};var Ni={};Ni={calendar:`Kalendar`,day:`дан`,dayPeriod:`пре подне/по подне`,endDate:`Datum završetka`,era:`ера`,hour:`сат`,minute:`минут`,month:`месец`,second:`секунд`,selectedDateDescription:e=>`Izabrani datum: ${e.date}`,selectedRangeDescription:e=>`Izabrani opseg: od ${e.startDate} do ${e.endDate}`,selectedTimeDescription:e=>`Izabrano vreme: ${e.time}`,startDate:`Datum početka`,timeZoneName:`временска зона`,weekday:`дан у недељи`,year:`година`};var Pi={};Pi={calendar:`Kalender`,day:`dag`,dayPeriod:`fm/em`,endDate:`Slutdatum`,era:`era`,hour:`timme`,minute:`minut`,month:`månad`,second:`sekund`,selectedDateDescription:e=>`Valt datum: ${e.date}`,selectedRangeDescription:e=>`Valt intervall: ${e.startDate} till ${e.endDate}`,selectedTimeDescription:e=>`Vald tid: ${e.time}`,startDate:`Startdatum`,timeZoneName:`tidszon`,weekday:`veckodag`,year:`år`};var Fi={};Fi={calendar:`Takvim`,day:`gün`,dayPeriod:`ÖÖ/ÖS`,endDate:`Bitiş Tarihi`,era:`çağ`,hour:`saat`,minute:`dakika`,month:`ay`,second:`saniye`,selectedDateDescription:e=>`Se\xe7ilen Tarih: ${e.date}`,selectedRangeDescription:e=>`Se\xe7ilen Aral\u{131}k: ${e.startDate} - ${e.endDate}`,selectedTimeDescription:e=>`Se\xe7ilen Zaman: ${e.time}`,startDate:`Başlangıç Tarihi`,timeZoneName:`saat dilimi`,weekday:`haftanın günü`,year:`yıl`};var Ii={};Ii={calendar:`Календар`,day:`день`,dayPeriod:`дп/пп`,endDate:`Дата завершення`,era:`ера`,hour:`година`,minute:`хвилина`,month:`місяць`,second:`секунда`,selectedDateDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{438}\u{439} \u{434}\u{456}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.startDate} \u{2014} ${e.endDate}`,selectedTimeDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{438}\u{439} \u{447}\u{430}\u{441}: ${e.time}`,startDate:`Дата початку`,timeZoneName:`часовий пояс`,weekday:`день тижня`,year:`рік`};var Li={};Li={calendar:`日历`,day:`日`,dayPeriod:`上午/下午`,endDate:`结束日期`,era:`纪元`,hour:`小时`,minute:`分钟`,month:`月`,second:`秒`,selectedDateDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{8303}\u{56F4}\u{FF1A}${e.startDate} \u{81F3} ${e.endDate}`,selectedTimeDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{65F6}\u{95F4}\u{FF1A}${e.time}`,startDate:`开始日期`,timeZoneName:`时区`,weekday:`工作日`,year:`年`};var Ri={};Ri={calendar:`日曆`,day:`日`,dayPeriod:`上午/下午`,endDate:`結束日期`,era:`纪元`,hour:`小时`,minute:`分钟`,month:`月`,second:`秒`,selectedDateDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{7BC4}\u{570D}\u{FF1A}${e.startDate} \u{81F3} ${e.endDate}`,selectedTimeDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{6642}\u{9593}\u{FF1A}${e.time}`,startDate:`開始日期`,timeZoneName:`时区`,weekday:`工作日`,year:`年`};var zi={};zi={"ar-AE":ai,"bg-BG":oi,"cs-CZ":si,"da-DK":ci,"de-DE":li,"el-GR":ui,"en-US":di,"es-ES":fi,"et-EE":pi,"fi-FI":mi,"fr-FR":hi,"he-IL":gi,"hr-HR":_i,"hu-HU":vi,"it-IT":yi,"ja-JP":bi,"ko-KR":xi,"lt-LT":Si,"lv-LV":Ci,"nb-NO":wi,"nl-NL":Ti,"pl-PL":Ei,"pt-BR":Di,"pt-PT":Oi,"ro-RO":ki,"ru-RU":Ai,"sk-SK":ji,"sl-SI":Mi,"sr-SP":Ni,"sv-SE":Pi,"tr-TR":Fi,"uk-UA":Ii,"zh-CN":Li,"zh-TW":Ri};function Bi(e,t,n){let{direction:r}=F(),i=(0,R.useMemo)(()=>de(t),[t]),{keyboardProps:a}=he({shortcuts:{"Alt+ArrowDown":()=>{if(`setOpen`in e){e.setOpen(!0);return}return!1},"Alt+ArrowUp":()=>{if(`setOpen`in e){e.setOpen(!0);return}return!1},ArrowLeft:e=>{if(n)return!1;if(r===`rtl`){if(t.current){let n=fe(e),r=Vi(t.current,n.getBoundingClientRect().left,-1);if(r){r.focus();return}}}else{i.focusPrevious();return}return!1},ArrowRight:e=>{if(n)return!1;if(r===`rtl`){if(t.current){let n=fe(e),r=Vi(t.current,n.getBoundingClientRect().left,1);if(r){r.focus();return}}}else{i.focusNext();return}return!1}},allowRepeats:!0}),o=()=>{if(!t.current)return;let e=window.event?fe(window.event):null,n=re(t.current,{tabbable:!0});if(e&&=(n.currentNode=e,n.previousNode()),!e){let t;do t=n.lastChild(),t&&(e=t);while(t)}for(;e?.hasAttribute(`data-placeholder`);){let t=n.previousNode();if(t&&t.hasAttribute(`data-placeholder`))e=t;else break}e&&e.focus()},{pressProps:s}=ue({preventFocusOnPress:!0,allowTextSelectionOnPress:!0,onPressStart(e){e.pointerType===`mouse`&&o()},onPress(e){(e.pointerType===`touch`||e.pointerType===`pen`)&&o()}});return D(s,a)}function Vi(e,t,n){let r=re(e,{tabbable:!0}),i=r.nextNode(),a=null,o=1/0;for(;i;){let e=i.getBoundingClientRect().left-t,s=Math.abs(e);Math.sign(e)===n&&s{t.confirmPlaceholder(),t.value!==u.current&&t.commitValidation(),e.onBlur?.(n)},onFocusWithinChange:e.onFocusChange}),f=h(Hi(zi),`@react-aria/datepicker`),p=t.maxGranularity===`hour`?`selectedTimeDescription`:`selectedDateDescription`,m=t.maxGranularity===`hour`?`time`:`date`,g=t.value?f.format(p,{[m]:t.formatValue({month:`long`})}):``,_=Ue(g),v=e.__reactAriaDateFieldRole===`presentation`?s[`aria-describedby`]:[_[`aria-describedby`],s[`aria-describedby`]].filter(Boolean).join(` `)||void 0,y=e[Gi],b=(0,R.useMemo)(()=>y||de(n),[y,n]),x=Bi(t,n,e[Wi]===`presentation`);Ui.set(t,{ariaLabel:e[`aria-label`],ariaLabelledBy:[o.id,e[`aria-labelledby`]].filter(Boolean).join(` `)||void 0,ariaDescribedBy:v,focusManager:b});let S=(0,R.useRef)(e.autoFocus),C;C=e.__reactAriaDateFieldRole===`presentation`?{role:`presentation`}:D(s,{role:`group`,"aria-disabled":e.isDisabled||void 0,"aria-describedby":v}),(0,R.useEffect)(()=>{S.current&&b.focusFirst(),S.current=!1},[b]),we(e.inputRef,t.defaultValue,t.setValue),Te({...e,focus(){b.focusFirst()}},t,e.inputRef);let w={type:`hidden`,name:e.name,form:e.form,value:t.value?.toString()||``,disabled:e.isDisabled};e.validationBehavior===`native`&&(w.type=`text`,w.hidden=!0,w.required=e.isRequired,w.onChange=()=>{});let T=I(e);return{labelProps:{...o,onClick:()=>{b.focusFirst()}},fieldProps:D(T,C,x,d,{onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,style:{unicodeBidi:`isolate`}}),inputProps:w,descriptionProps:c,errorMessageProps:l,isInvalid:r,validationErrors:i,validationDetails:a}}function qi(e,t,n){let r=Ki(e,t,n);return r.inputProps.value=t.timeValue?.toString()||``,r}function Z(e){e=Ye(e??{},Ji);let{locale:t}=F();return(0,R.useMemo)(()=>new Y(t,e),[t,e])}function Ji(e,t){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(t[r]!==e[r])return!1;return!0}function Yi(e){return e&&e.__esModule?e.default:e}function Xi(){let{locale:e}=F(),t=c(Yi(zi),`@react-aria/datepicker`);return(0,R.useMemo)(()=>{try{return new Intl.DisplayNames(e,{type:`dateTimeField`})}catch{return new Zi(e,t)}},[e,t])}var Zi=class{constructor(e,t){this.locale=e,this.dictionary=t}of(e){return this.dictionary.getStringForLocale(e,this.locale)}};function Qi(e,t,n){let r=(0,R.useRef)(``),{locale:i,direction:a}=F(),o=Xi(),{ariaLabel:s,ariaLabelledBy:c,ariaDescribedBy:l,focusManager:u}=Ui.get(t),d=e.isPlaceholder?``:e.text,f=(0,R.useMemo)(()=>t.dateFormatter.resolvedOptions(),[t.dateFormatter]),p=Z({month:`long`,timeZone:f.timeZone}),m=Z({hour:`numeric`,hour12:f.hour12,timeZone:f.timeZone});if(e.type===`month`&&!e.isPlaceholder){let e=p.format(t.dateValue);d=e===d?e:`${d} \u{2013} ${e}`}else e.type===`hour`&&!e.isPlaceholder&&(d=m.format(t.dateValue));let{spinButtonProps:h}=Ie({value:e.value??void 0,textValue:d,minValue:e.minValue,maxValue:e.maxValue,isDisabled:t.isDisabled,isReadOnly:t.isReadOnly||!e.isEditable,isRequired:t.isRequired,onIncrement:()=>{r.current=``,t.increment(e.type)},onDecrement:()=>{r.current=``,t.decrement(e.type)},onIncrementPage:()=>{r.current=``,t.incrementPage(e.type)},onDecrementPage:()=>{r.current=``,t.decrementPage(e.type)},onIncrementToMax:()=>{r.current=``,t.incrementToMax(e.type)},onDecrementToMin:()=>{r.current=``,t.decrementToMin(e.type)}}),v=(0,R.useMemo)(()=>new Pe(i,{maximumFractionDigits:0}),[i]),y=()=>{if(e.text===e.placeholder&&u.focusPrevious(),v.isValidPartialNumber(e.text)&&!t.isReadOnly&&!e.isPlaceholder){let n=e.text.slice(0,-1),i=v.parse(n);n=i===0?``:n,n.length===0||i===0?t.clearSegment(e.type):t.setSegment(e.type,i),r.current=n}else(e.type===`dayPeriod`||e.type===`era`)&&t.clearSegment(e.type)},{keyboardProps:x}=he({shortcuts:{Backspace:()=>{y()},Delete:()=>{y()},"Mod+a":()=>{}},allowRepeats:!0}),{startsWith:S}=nt({sensitivity:`base`}),w=Z({hour:`numeric`,hour12:!0}),T=(0,R.useMemo)(()=>{let e=new Date;return e.setHours(0),w.formatToParts(e).find(e=>e.type===`dayPeriod`).value},[w]),E=(0,R.useMemo)(()=>{let e=new Date;return e.setHours(12),w.formatToParts(e).find(e=>e.type===`dayPeriod`).value},[w]),O=Z({year:`numeric`,era:`narrow`,timeZone:`UTC`}),k=(0,R.useMemo)(()=>{if(e.type!==`era`)return[];let n=G(new q(1,1,1),t.calendar),r=t.calendar.getEras().map(e=>{let t=n.set({year:1,month:1,day:1,era:e}).toDate(`UTC`);return{era:e,formatted:O.formatToParts(t).find(e=>e.type===`era`).value}}),i=$i(r.map(e=>e.formatted));if(i)for(let e of r)e.formatted=e.formatted.slice(i);return r},[O,t.calendar,e.type]),A=n=>{if(t.isDisabled||t.isReadOnly)return;let i=r.current+n;switch(e.type){case`dayPeriod`:if(S(T,n))t.setSegment(`dayPeriod`,0);else if(S(E,n))t.setSegment(`dayPeriod`,1);else break;u.focusNext();break;case`era`:{let e=k.find(e=>S(e.formatted,n));e&&(t.setSegment(`era`,e.era),u.focusNext());break}case`day`:case`hour`:case`minute`:case`second`:case`month`:case`year`:{if(!v.isValidPartialNumber(i))return;let a=v.parse(i),o=a;if(e.maxValue!==void 0&&a>e.maxValue&&(o=v.parse(n)),isNaN(a))return;t.setSegment(e.type,o),e.maxValue!==void 0&&(Number(a+`0`)>e.maxValue||i.length>=String(e.maxValue).length)?(r.current=``,u.focusNext()):r.current=i;break}}},ee=()=>{r.current=``,n.current&&qe(n.current,{containingElement:Be(n.current)}),window.getSelection()?.collapse(n.current)},te=(0,R.useRef)(typeof document<`u`?document:null);g(te,`selectionchange`,()=>{let e=window.getSelection();e?.anchorNode&&ne(n.current,e?.anchorNode)&&b()===n.current&&e.collapse(n.current)});let j=(0,R.useRef)(``);g(n,`beforeinput`,r=>{if(n.current)switch(r.preventDefault(),r.inputType){case`deleteContentBackward`:case`deleteContentForward`:v.isValidPartialNumber(e.text)&&!t.isReadOnly&&y();break;case`insertCompositionText`:j.current=n.current.textContent,n.current.textContent=n.current.textContent;break;default:r.data!=null&&A(r.data)}}),g(n,`input`,e=>{let{inputType:t,data:r}=e;t===`insertCompositionText`&&(n.current&&(n.current.textContent=j.current),r!=null&&(S(T,r)||S(E,r))&&A(r))}),ae(()=>{let e=n.current;return()=>{b()===e&&(u.focusPrevious()||u.focusNext())}},[n,u]);let M=C()||e.type===`timeZoneName`?{role:`textbox`,"aria-valuemax":null,"aria-valuemin":null,"aria-valuetext":null,"aria-valuenow":null}:{};e!==(0,R.useMemo)(()=>t.segments.find(e=>e.isEditable),[t.segments])&&!t.isInvalid&&(l=void 0);let re=le(),N=!t.isDisabled&&!t.isReadOnly&&e.isEditable,ie=e.type===`literal`?``:o.of(e.type),P=_({"aria-label":`${ie}${s?`, ${s}`:``}${c?`, `:``}`,"aria-labelledby":c});if(e.type===`literal`)return{segmentProps:{"aria-hidden":!0}};let oe={caretColor:`transparent`};if(a===`rtl`){oe.unicodeBidi=`embed`;let t=f[e.type];(t===`numeric`||t===`2-digit`)&&(oe.direction=`ltr`)}return{segmentProps:D(h,P,{id:re,...M,...x,"aria-invalid":t.isInvalid?`true`:void 0,"aria-describedby":l,"aria-readonly":t.isReadOnly||!e.isEditable?`true`:void 0,"data-placeholder":e.isPlaceholder||void 0,contentEditable:N,suppressContentEditableWarning:N,spellCheck:N?`false`:void 0,autoCorrect:N?`off`:void 0,enterKeyHint:N?`next`:void 0,inputMode:t.isDisabled||e.type===`dayPeriod`||e.type===`era`||!N?void 0:`numeric`,tabIndex:t.isDisabled?void 0:0,onFocus:ee,style:oe,onPointerDown(e){e.stopPropagation()},onMouseDown(e){e.stopPropagation()}})}}function $i(e){e.sort();let t=e[0],n=e[e.length-1];for(let e=0;e`\u{64A}\u{62C}\u{628} \u{623}\u{646} \u{62A}\u{643}\u{648}\u{646} \u{627}\u{644}\u{642}\u{64A}\u{645}\u{629} ${e.maxValue} \u{623}\u{648} \u{642}\u{628}\u{644} \u{630}\u{644}\u{643}.`,rangeReversed:`تاريخ البدء يجب أن يكون قبل تاريخ الانتهاء.`,rangeUnderflow:e=>`\u{64A}\u{62C}\u{628} \u{623}\u{646} \u{62A}\u{643}\u{648}\u{646} \u{627}\u{644}\u{642}\u{64A}\u{645}\u{629} ${e.minValue} \u{623}\u{648} \u{628}\u{639}\u{62F} \u{630}\u{644}\u{643}.`,unavailableDate:`البيانات المحددة غير متاحة.`};var ta={};ta={rangeOverflow:e=>`\u{421}\u{442}\u{43E}\u{439}\u{43D}\u{43E}\u{441}\u{442}\u{442}\u{430} \u{442}\u{440}\u{44F}\u{431}\u{432}\u{430} \u{434}\u{430} \u{435} ${e.maxValue} \u{438}\u{43B}\u{438} \u{43F}\u{43E}-\u{440}\u{430}\u{43D}\u{43D}\u{430}.`,rangeReversed:`Началната дата трябва да е преди крайната.`,rangeUnderflow:e=>`\u{421}\u{442}\u{43E}\u{439}\u{43D}\u{43E}\u{441}\u{442}\u{442}\u{430} \u{442}\u{440}\u{44F}\u{431}\u{432}\u{430} \u{434}\u{430} \u{435} ${e.minValue} \u{438}\u{43B}\u{438} \u{43F}\u{43E}-\u{43A}\u{44A}\u{441}\u{43D}\u{43E}.`,unavailableDate:`Избраната дата не е налична.`};var na={};na={rangeOverflow:e=>`Hodnota mus\xed b\xfdt ${e.maxValue} nebo d\u{159}\xedv\u{11B}j\u{161}\xed.`,rangeReversed:`Datum zahájení musí předcházet datu ukončení.`,rangeUnderflow:e=>`Hodnota mus\xed b\xfdt ${e.minValue} nebo pozd\u{11B}j\u{161}\xed.`,unavailableDate:`Vybrané datum není k dispozici.`};var ra={};ra={rangeOverflow:e=>`V\xe6rdien skal v\xe6re ${e.maxValue} eller tidligere.`,rangeReversed:`Startdatoen skal være før slutdatoen.`,rangeUnderflow:e=>`V\xe6rdien skal v\xe6re ${e.minValue} eller nyere.`,unavailableDate:`Den valgte dato er ikke tilgængelig.`};var ia={};ia={rangeOverflow:e=>`Der Wert muss ${e.maxValue} oder fr\xfcher sein.`,rangeReversed:`Das Startdatum muss vor dem Enddatum liegen.`,rangeUnderflow:e=>`Der Wert muss ${e.minValue} oder sp\xe4ter sein.`,unavailableDate:`Das ausgewählte Datum ist nicht verfügbar.`};var aa={};aa={rangeOverflow:e=>`\u{397} \u{3C4}\u{3B9}\u{3BC}\u{3AE} \u{3C0}\u{3C1}\u{3AD}\u{3C0}\u{3B5}\u{3B9} \u{3BD}\u{3B1} \u{3B5}\u{3AF}\u{3BD}\u{3B1}\u{3B9} ${e.maxValue} \u{3AE} \u{3C0}\u{3B1}\u{3BB}\u{3B1}\u{3B9}\u{3CC}\u{3C4}\u{3B5}\u{3C1}\u{3B7}.`,rangeReversed:`Η ημερομηνία έναρξης πρέπει να είναι πριν από την ημερομηνία λήξης.`,rangeUnderflow:e=>`\u{397} \u{3C4}\u{3B9}\u{3BC}\u{3AE} \u{3C0}\u{3C1}\u{3AD}\u{3C0}\u{3B5}\u{3B9} \u{3BD}\u{3B1} \u{3B5}\u{3AF}\u{3BD}\u{3B1}\u{3B9} ${e.minValue} \u{3AE} \u{3BC}\u{3B5}\u{3C4}\u{3B1}\u{3B3}\u{3B5}\u{3BD}\u{3AD}\u{3C3}\u{3C4}\u{3B5}\u{3C1}\u{3B7}.`,unavailableDate:`Η επιλεγμένη ημερομηνία δεν είναι διαθέσιμη.`};var oa={};oa={rangeUnderflow:e=>`Value must be ${e.minValue} or later.`,rangeOverflow:e=>`Value must be ${e.maxValue} or earlier.`,rangeReversed:`Start date must be before end date.`,unavailableDate:`Selected date unavailable.`};var sa={};sa={rangeOverflow:e=>`El valor debe ser ${e.maxValue} o anterior.`,rangeReversed:`La fecha de inicio debe ser anterior a la fecha de finalización.`,rangeUnderflow:e=>`El valor debe ser ${e.minValue} o posterior.`,unavailableDate:`Fecha seleccionada no disponible.`};var ca={};ca={rangeOverflow:e=>`V\xe4\xe4rtus peab olema ${e.maxValue} v\xf5i varasem.`,rangeReversed:`Alguskuupäev peab olema enne lõppkuupäeva.`,rangeUnderflow:e=>`V\xe4\xe4rtus peab olema ${e.minValue} v\xf5i hilisem.`,unavailableDate:`Valitud kuupäev pole saadaval.`};var la={};la={rangeOverflow:e=>`Arvon on oltava ${e.maxValue} tai sit\xe4 aikaisempi.`,rangeReversed:`Aloituspäivän on oltava ennen lopetuspäivää.`,rangeUnderflow:e=>`Arvon on oltava ${e.minValue} tai sit\xe4 my\xf6h\xe4isempi.`,unavailableDate:`Valittu päivämäärä ei ole käytettävissä.`};var ua={};ua={rangeOverflow:e=>`La valeur doit \xeatre ${e.maxValue} ou ant\xe9rieure.`,rangeReversed:`La date de début doit être antérieure à la date de fin.`,rangeUnderflow:e=>`La valeur doit \xeatre ${e.minValue} ou ult\xe9rieure.`,unavailableDate:`La date sélectionnée n’est pas disponible.`};var da={};da={rangeOverflow:e=>`\u{5D4}\u{5E2}\u{5E8}\u{5DA} \u{5D7}\u{5D9}\u{5D9}\u{5D1} \u{5DC}\u{5D4}\u{5D9}\u{5D5}\u{5EA} ${e.maxValue} \u{5D0}\u{5D5} \u{5DE}\u{5D5}\u{5E7}\u{5D3}\u{5DD} \u{5D9}\u{5D5}\u{5EA}\u{5E8}.`,rangeReversed:`תאריך ההתחלה חייב להיות לפני תאריך הסיום.`,rangeUnderflow:e=>`\u{5D4}\u{5E2}\u{5E8}\u{5DA} \u{5D7}\u{5D9}\u{5D9}\u{5D1} \u{5DC}\u{5D4}\u{5D9}\u{5D5}\u{5EA} ${e.minValue} \u{5D0}\u{5D5} \u{5DE}\u{5D0}\u{5D5}\u{5D7}\u{5E8} \u{5D9}\u{5D5}\u{5EA}\u{5E8}.`,unavailableDate:`התאריך הנבחר אינו זמין.`};var fa={};fa={rangeOverflow:e=>`Vrijednost mora biti ${e.maxValue} ili ranije.`,rangeReversed:`Datum početka mora biti prije datuma završetka.`,rangeUnderflow:e=>`Vrijednost mora biti ${e.minValue} ili kasnije.`,unavailableDate:`Odabrani datum nije dostupan.`};var pa={};pa={rangeOverflow:e=>`Az \xe9rt\xe9knek ${e.maxValue} vagy kor\xe1bbinak kell lennie.`,rangeReversed:`A kezdő dátumnak a befejező dátumnál korábbinak kell lennie.`,rangeUnderflow:e=>`Az \xe9rt\xe9knek ${e.minValue} vagy k\xe9s\u{151}bbinek kell lennie.`,unavailableDate:`A kiválasztott dátum nem érhető el.`};var ma={};ma={rangeOverflow:e=>`Il valore deve essere ${e.maxValue} o precedente.`,rangeReversed:`La data di inizio deve essere antecedente alla data di fine.`,rangeUnderflow:e=>`Il valore deve essere ${e.minValue} o successivo.`,unavailableDate:`Data selezionata non disponibile.`};var ha={};ha={rangeOverflow:e=>`\u{5024}\u{306F} ${e.maxValue} \u{4EE5}\u{4E0B}\u{306B}\u{3059}\u{308B}\u{5FC5}\u{8981}\u{304C}\u{3042}\u{308A}\u{307E}\u{3059}\u{3002}`,rangeReversed:`開始日は終了日より前にする必要があります。`,rangeUnderflow:e=>`\u{5024}\u{306F} ${e.minValue} \u{4EE5}\u{4E0A}\u{306B}\u{3059}\u{308B}\u{5FC5}\u{8981}\u{304C}\u{3042}\u{308A}\u{307E}\u{3059}\u{3002}`,unavailableDate:`選択した日付は使用できません。`};var ga={};ga={rangeOverflow:e=>`\u{AC12}\u{C740} ${e.maxValue} \u{C774}\u{C804}\u{C774}\u{C5B4}\u{C57C} \u{D569}\u{B2C8}\u{B2E4}.`,rangeReversed:`시작일은 종료일 이전이어야 합니다.`,rangeUnderflow:e=>`\u{AC12}\u{C740} ${e.minValue} \u{C774}\u{D6C4}\u{C5EC}\u{C57C} \u{D569}\u{B2C8}\u{B2E4}.`,unavailableDate:`선택한 날짜를 사용할 수 없습니다.`};var _a={};_a={rangeOverflow:e=>`Reik\u{161}m\u{117} turi b\u{16B}ti ${e.maxValue} arba ankstesn\u{117}.`,rangeReversed:`Pradžios data turi būti ankstesnė nei pabaigos data.`,rangeUnderflow:e=>`Reik\u{161}m\u{117} turi b\u{16B}ti ${e.minValue} arba naujesn\u{117}.`,unavailableDate:`Pasirinkta data nepasiekiama.`};var va={};va={rangeOverflow:e=>`V\u{113}rt\u{12B}bai ir j\u{101}b\u{16B}t ${e.maxValue} vai agr\u{101}kai.`,rangeReversed:`Sākuma datumam ir jābūt pirms beigu datuma.`,rangeUnderflow:e=>`V\u{113}rt\u{12B}bai ir j\u{101}b\u{16B}t ${e.minValue} vai v\u{113}l\u{101}kai.`,unavailableDate:`Atlasītais datums nav pieejams.`};var ya={};ya={rangeOverflow:e=>`Verdien m\xe5 v\xe6re ${e.maxValue} eller tidligere.`,rangeReversed:`Startdatoen må være før sluttdatoen.`,rangeUnderflow:e=>`Verdien m\xe5 v\xe6re ${e.minValue} eller senere.`,unavailableDate:`Valgt dato utilgjengelig.`};var ba={};ba={rangeOverflow:e=>`Waarde moet ${e.maxValue} of eerder zijn.`,rangeReversed:`De startdatum moet voor de einddatum liggen.`,rangeUnderflow:e=>`Waarde moet ${e.minValue} of later zijn.`,unavailableDate:`Geselecteerde datum niet beschikbaar.`};var xa={};xa={rangeOverflow:e=>`Warto\u{15B}\u{107} musi mie\u{107} warto\u{15B}\u{107} ${e.maxValue} lub wcze\u{15B}niejsz\u{105}.`,rangeReversed:`Data rozpoczęcia musi być wcześniejsza niż data zakończenia.`,rangeUnderflow:e=>`Warto\u{15B}\u{107} musi mie\u{107} warto\u{15B}\u{107} ${e.minValue} lub p\xf3\u{17A}niejsz\u{105}.`,unavailableDate:`Wybrana data jest niedostępna.`};var Sa={};Sa={rangeOverflow:e=>`O valor deve ser ${e.maxValue} ou anterior.`,rangeReversed:`A data inicial deve ser anterior à data final.`,rangeUnderflow:e=>`O valor deve ser ${e.minValue} ou posterior.`,unavailableDate:`Data selecionada indisponível.`};var Ca={};Ca={rangeOverflow:e=>`O valor tem de ser ${e.maxValue} ou anterior.`,rangeReversed:`A data de início deve ser anterior à data de fim.`,rangeUnderflow:e=>`O valor tem de ser ${e.minValue} ou posterior.`,unavailableDate:`Data selecionada indisponível.`};var wa={};wa={rangeOverflow:e=>`Valoarea trebuie s\u{103} fie ${e.maxValue} sau anterioar\u{103}.`,rangeReversed:`Data de început trebuie să fie anterioară datei de sfârșit.`,rangeUnderflow:e=>`Valoarea trebuie s\u{103} fie ${e.minValue} sau ulterioar\u{103}.`,unavailableDate:`Data selectată nu este disponibilă.`};var Ta={};Ta={rangeOverflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{438}\u{435} \u{434}\u{43E}\u{43B}\u{436}\u{43D}\u{43E} \u{431}\u{44B}\u{442}\u{44C} \u{43D}\u{435} \u{43F}\u{43E}\u{437}\u{436}\u{435} ${e.maxValue}.`,rangeReversed:`Дата начала должна предшествовать дате окончания.`,rangeUnderflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{438}\u{435} \u{434}\u{43E}\u{43B}\u{436}\u{43D}\u{43E} \u{431}\u{44B}\u{442}\u{44C} \u{43D}\u{435} \u{440}\u{430}\u{43D}\u{44C}\u{448}\u{435} ${e.minValue}.`,unavailableDate:`Выбранная дата недоступна.`};var Ea={};Ea={rangeOverflow:e=>`Hodnota mus\xed by\u{165} ${e.maxValue} alebo skor\u{161}ia.`,rangeReversed:`Dátum začiatku musí byť skorší ako dátum konca.`,rangeUnderflow:e=>`Hodnota mus\xed by\u{165} ${e.minValue} alebo neskor\u{161}ia.`,unavailableDate:`Vybratý dátum je nedostupný.`};var Da={};Da={rangeOverflow:e=>`Vrednost mora biti ${e.maxValue} ali starej\u{161}a.`,rangeReversed:`Začetni datum mora biti pred končnim datumom.`,rangeUnderflow:e=>`Vrednost mora biti ${e.minValue} ali novej\u{161}a.`,unavailableDate:`Izbrani datum ni na voljo.`};var Oa={};Oa={rangeOverflow:e=>`Vrednost mora da bude ${e.maxValue} ili starija.`,rangeReversed:`Datum početka mora biti pre datuma završetka.`,rangeUnderflow:e=>`Vrednost mora da bude ${e.minValue} ili novija.`,unavailableDate:`Izabrani datum nije dostupan.`};var ka={};ka={rangeOverflow:e=>`V\xe4rdet m\xe5ste vara ${e.maxValue} eller tidigare.`,rangeReversed:`Startdatumet måste vara före slutdatumet.`,rangeUnderflow:e=>`V\xe4rdet m\xe5ste vara ${e.minValue} eller senare.`,unavailableDate:`Det valda datumet är inte tillgängligt.`};var Aa={};Aa={rangeOverflow:e=>`De\u{11F}er, ${e.maxValue} veya \xf6ncesi olmal\u{131}d\u{131}r.`,rangeReversed:`Başlangıç tarihi bitiş tarihinden önce olmalıdır.`,rangeUnderflow:e=>`De\u{11F}er, ${e.minValue} veya sonras\u{131} olmal\u{131}d\u{131}r.`,unavailableDate:`Seçilen tarih kullanılamıyor.`};var ja={};ja={rangeOverflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{43D}\u{44F} \u{43C}\u{430}\u{454} \u{431}\u{443}\u{442}\u{438} \u{43D}\u{435} \u{43F}\u{456}\u{437}\u{43D}\u{456}\u{448}\u{435} ${e.maxValue}.`,rangeReversed:`Дата початку має передувати даті завершення.`,rangeUnderflow:e=>`\u{417}\u{43D}\u{430}\u{447}\u{435}\u{43D}\u{43D}\u{44F} \u{43C}\u{430}\u{454} \u{431}\u{443}\u{442}\u{438} \u{43D}\u{435} \u{440}\u{430}\u{43D}\u{456}\u{448}\u{435} ${e.minValue}.`,unavailableDate:`Вибрана дата недоступна.`};var Ma={};Ma={rangeOverflow:e=>`\u{503C}\u{5FC5}\u{987B}\u{662F} ${e.maxValue} \u{6216}\u{66F4}\u{65E9}\u{65E5}\u{671F}\u{3002}`,rangeReversed:`开始日期必须早于结束日期。`,rangeUnderflow:e=>`\u{503C}\u{5FC5}\u{987B}\u{662F} ${e.minValue} \u{6216}\u{66F4}\u{665A}\u{65E5}\u{671F}\u{3002}`,unavailableDate:`所选日期不可用。`};var Na={};Na={rangeOverflow:e=>`\u{503C}\u{5FC5}\u{9808}\u{662F} ${e.maxValue} \u{6216}\u{66F4}\u{65E9}\u{3002}`,rangeReversed:`開始日期必須在結束日期之前。`,rangeUnderflow:e=>`\u{503C}\u{5FC5}\u{9808}\u{662F} ${e.minValue} \u{6216}\u{66F4}\u{665A}\u{3002}`,unavailableDate:`所選日期無法使用。`};var Pa={};Pa={"ar-AE":ea,"bg-BG":ta,"cs-CZ":na,"da-DK":ra,"de-DE":ia,"el-GR":aa,"en-US":oa,"es-ES":sa,"et-EE":ca,"fi-FI":la,"fr-FR":ua,"he-IL":da,"hr-HR":fa,"hu-HU":pa,"it-IT":ma,"ja-JP":ha,"ko-KR":ga,"lt-LT":_a,"lv-LV":va,"nb-NO":ya,"nl-NL":ba,"pl-PL":xa,"pt-BR":Sa,"pt-PT":Ca,"ro-RO":wa,"ru-RU":Ta,"sk-SK":Ea,"sl-SI":Da,"sr-SP":Oa,"sv-SE":ka,"tr-TR":Aa,"uk-UA":ja,"zh-CN":Ma,"zh-TW":Na};function Fa(e){return e&&e.__esModule?e.default:e}var Ia=new m(Fa(Pa));function La(){let e=typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return e}function Ra(e,t,n,i,a){let o=e!=null&&n!=null&&e.compare(n)>0,s=e!=null&&t!=null&&e.compare(t)<0,c=e!=null&&i?.(e)||!1,l=o||s||c,u=[];if(l){let e=La(),i=m.getGlobalDictionaryForPackage(`@react-stately/datepicker`)||Ia,l=new r(e,i),d=new Y(e,Ha({},a)),f=d.resolvedOptions().timeZone;s&&t!=null&&u.push(l.format(`rangeUnderflow`,{minValue:d.format(t.toDate(f))})),o&&n!=null&&u.push(l.format(`rangeOverflow`,{maxValue:d.format(n.toDate(f))})),c&&u.push(l.format(`unavailableDate`))}return{isInvalid:l,validationErrors:u,validationDetails:{badInput:c,customError:!1,patternMismatch:!1,rangeOverflow:o,rangeUnderflow:s,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!l}}}function za(e,t,n,r,i){let a=Ra(e?.start??null,t,n,r,i),o=Ra(e?.end??null,t,n,r,i),s=Ce(a,o);if(e?.end!=null&&e.start!=null&&e.end.compare(e.start)<0){let e=m.getGlobalDictionaryForPackage(`@react-stately/datepicker`)||Ia;s=Ce(s,{isInvalid:!0,validationErrors:[e.getStringForLocale(`rangeReversed`,La())],validationDetails:{...ye,rangeUnderflow:!0,rangeOverflow:!0,valid:!1}})}return s}var Ba={year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`},Va={year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`};function Ha(e,t){e={...t.shouldForceLeadingZeros?Va:Ba,...e};let n=t.granularity||`minute`,r=Object.keys(e),i=r.indexOf(t.maxGranularity??`year`);i<0&&(i=0);let a=r.indexOf(n);if(a<0&&(a=2),i>a)throw Error(`maxGranularity must be greater than granularity`);let o=r.slice(i,a+1).reduce((t,n)=>(t[n]=e[n],t),{});return t.hourCycle!=null&&(o.hour12=t.hourCycle===12),o.timeZone=t.timeZone||`UTC`,(n===`hour`||n===`minute`||n===`second`)&&t.timeZone&&!t.hideTimeZone&&(o.timeZoneName=`short`),t.showEra&&i===0&&(o.era=`short`),o}function Ua(e){return e&&`hour`in e?e:new Ln}function Wa(e,t){if(e===null)return null;if(e)return G(e,t)}function Ga(e,t,n,r){if(e)return Wa(e,n);let i=G(vt(r??Tt()).set({hour:0,minute:0,second:0,millisecond:0}),n);return t===`year`||t===`month`||t===`day`?U(i):r?i:W(i)}function Ka(e,t){let n=e&&`timeZone`in e?e.timeZone:void 0,r=e&&`minute`in e?`minute`:`day`;if(e&&t&&!(t in e))throw Error(`Invalid granularity `+t+` for value `+e.toString());let[i,a]=(0,R.useState)([r,n]);e&&(i[0]!==r||i[1]!==n)&&a([r,n]),t||=e?r:i[0];let o=e?n:i[1];return[t,o]}var qa=new m({ach:{year:`mwaka`,month:`dwe`,day:`nino`},af:{year:`jjjj`,month:`mm`,day:`dd`},am:{year:`ዓዓዓዓ`,month:`ሚሜ`,day:`ቀቀ`},an:{year:`aaaa`,month:`mm`,day:`dd`},ar:{year:`سنة`,month:`شهر`,day:`يوم`},ast:{year:`aaaa`,month:`mm`,day:`dd`},az:{year:`iiii`,month:`aa`,day:`gg`},be:{year:`гггг`,month:`мм`,day:`дд`},bg:{year:`гггг`,month:`мм`,day:`дд`},bn:{year:`yyyy`,month:`মিমি`,day:`dd`},br:{year:`bbbb`,month:`mm`,day:`dd`},bs:{year:`gggg`,month:`mm`,day:`dd`},ca:{year:`aaaa`,month:`mm`,day:`dd`},cak:{year:`jjjj`,month:`ii`,day:`q'q'`},ckb:{year:`ساڵ`,month:`مانگ`,day:`ڕۆژ`},cs:{year:`rrrr`,month:`mm`,day:`dd`},cy:{year:`bbbb`,month:`mm`,day:`dd`},da:{year:`åååå`,month:`mm`,day:`dd`},de:{year:`jjjj`,month:`mm`,day:`tt`},dsb:{year:`llll`,month:`mm`,day:`źź`},el:{year:`εεεε`,month:`μμ`,day:`ηη`},en:{year:`yyyy`,month:`mm`,day:`dd`},eo:{year:`jjjj`,month:`mm`,day:`tt`},es:{year:`aaaa`,month:`mm`,day:`dd`},et:{year:`aaaa`,month:`kk`,day:`pp`},eu:{year:`uuuu`,month:`hh`,day:`ee`},fa:{year:`سال`,month:`ماه`,day:`روز`},ff:{year:`hhhh`,month:`ll`,day:`ññ`},fi:{year:`vvvv`,month:`kk`,day:`pp`},fr:{year:`aaaa`,month:`mm`,day:`jj`},fy:{year:`jjjj`,month:`mm`,day:`dd`},ga:{year:`bbbb`,month:`mm`,day:`ll`},gd:{year:`bbbb`,month:`mm`,day:`ll`},gl:{year:`aaaa`,month:`mm`,day:`dd`},he:{year:`שנה`,month:`חודש`,day:`יום`},hr:{year:`gggg`,month:`mm`,day:`dd`},hsb:{year:`llll`,month:`mm`,day:`dd`},hu:{year:`éééé`,month:`hh`,day:`nn`},ia:{year:`aaaa`,month:`mm`,day:`dd`},id:{year:`tttt`,month:`bb`,day:`hh`},is:{year:`áááá`,month:`mm`,day:`dd`},it:{year:`aaaa`,month:`mm`,day:`gg`},ja:{year:`年`,month:`月`,day:`日`},ka:{year:`წწწწ`,month:`თთ`,day:`რრ`},kk:{year:`жжжж`,month:`аа`,day:`кк`},kn:{year:`ವವವವ`,month:`ಮಿಮೀ`,day:`ದಿದಿ`},ko:{year:`연도`,month:`월`,day:`일`},lb:{year:`jjjj`,month:`mm`,day:`dd`},lo:{year:`ປປປປ`,month:`ດດ`,day:`ວວ`},lt:{year:`mmmm`,month:`mm`,day:`dd`},lv:{year:`gggg`,month:`mm`,day:`dd`},meh:{year:`aaaa`,month:`mm`,day:`dd`},ml:{year:`വർഷം`,month:`മാസം`,day:`തീയതി`},ms:{year:`tttt`,month:`mm`,day:`hh`},nb:{year:`åååå`,month:`mm`,day:`dd`},nl:{year:`jjjj`,month:`mm`,day:`dd`},nn:{year:`åååå`,month:`mm`,day:`dd`},no:{year:`åååå`,month:`mm`,day:`dd`},oc:{year:`aaaa`,month:`mm`,day:`jj`},pl:{year:`rrrr`,month:`mm`,day:`dd`},pt:{year:`aaaa`,month:`mm`,day:`dd`},rm:{year:`oooo`,month:`mm`,day:`dd`},ro:{year:`aaaa`,month:`ll`,day:`zz`},ru:{year:`гггг`,month:`мм`,day:`дд`},sc:{year:`aaaa`,month:`mm`,day:`dd`},scn:{year:`aaaa`,month:`mm`,day:`jj`},sk:{year:`rrrr`,month:`mm`,day:`dd`},sl:{year:`llll`,month:`mm`,day:`dd`},sr:{year:`гггг`,month:`мм`,day:`дд`},"sr-Latn":{year:`gggg`,month:`mm`,day:`dd`},sv:{year:`åååå`,month:`mm`,day:`dd`},szl:{year:`rrrr`,month:`mm`,day:`dd`},tg:{year:`сссс`,month:`мм`,day:`рр`},th:{year:`ปปปป`,month:`ดด`,day:`วว`},tr:{year:`yyyy`,month:`aa`,day:`gg`},uk:{year:`рррр`,month:`мм`,day:`дд`},"zh-CN":{year:`年`,month:`月`,day:`日`},"zh-TW":{year:`年`,month:`月`,day:`日`}},`en`);function Ja(e,t,n){return e===`era`||e===`dayPeriod`?t:e===`year`||e===`month`||e===`day`?qa.getStringForLocale(e,n):`––`}var Ya=class e{constructor(e,t,n){if(this.era=n?.era??null,this.calendar=e,this.year=n?.year??null,this.month=n?.month??null,this.day=n?.day??null,this.hour=n?.hour??null,this.hourCycle=t,this.dayPeriod=null,this.minute=n?.minute??null,this.second=n?.second??null,this.millisecond=n?.millisecond??null,this.offset=`offset`in(n??{})?n.offset:null,this.hour!=null){let[e,n]=Za(this.hour,t);this.dayPeriod=e,this.hour=n}}copy(){let t=new e(this.calendar,this.hourCycle);return t.era=this.era,t.year=this.year,t.month=this.month,t.day=this.day,t.hour=this.hour,t.dayPeriod=this.dayPeriod,t.minute=this.minute,t.second=this.second,t.millisecond=this.millisecond,t.offset=this.offset,t}isComplete(e){return e.every(e=>this[e]!=null)}validate(e,t){return t.every(t=>{if((t===`hour`||t===`dayPeriod`)&&`hour`in e){let[t,n]=Za(e.hour,this.hourCycle);return this.dayPeriod===t&&this.hour===n}return this[t]===e[t]})}isCleared(e){return e.every(e=>this[e]===null)}set(e,t,n){let r=this.copy();return r[e]=t,e===`hour`&&r.dayPeriod==null&&`hour`in n&&(r.dayPeriod=Za(n.hour,this.hourCycle)[0]),e===`year`&&r.era==null&&(r.era=n.era),e!==`second`&&e!==`literal`&&e!==`timeZoneName`&&(r.offset=null),r}clear(e){let t=this.copy();return t[e]=null,e===`year`&&(t.era=null),t.offset=null,t}cycle(e,t,n,r){let i=this.copy();if(i[e]==null&&e!==`dayPeriod`&&e!==`era`){if(e===`hour`&&`hour`in n){let[e,t]=Za(n.hour,this.hourCycle);i.dayPeriod=e,i.hour=t}else i[e]=n[e];return e===`year`&&i.era==null&&(i.era=n.era),i}switch(e){case`era`:{let e=this.calendar.getEras(),n=e.indexOf(i.era);n=Xa(n,t,0,e.length-1),i.era=e[n];break}case`year`:{let r=new q(this.calendar,this.era??n.era,this.year??n.year,this.month??1,this.day??1);r=r.cycle(e,t,{round:e===`year`}),i.era=r.era,i.year=r.year;break}case`month`:i.month=Xa(i.month??1,t,1,this.calendar.getMaximumMonthsInYear());break;case`day`:i.day=Xa(i.day??1,t,1,this.calendar.getMaximumDaysInMonth());break;case`hour`:{let e=r.some(e=>[`year`,`month`,`day`].includes(e));if(`timeZone`in n&&(!e||i.year!=null&&i.month!=null&&i.day!=null)){let e=this.toValue(n);e=e.cycle(`hour`,t,{hourCycle:this.hourCycle===`h12`?12:24,round:!1});let[r,a]=Za(e.hour,this.hourCycle);i.hour=a,i.dayPeriod=r,i.offset=e.offset}else{let e=i.hour??0,r=this.getSegmentLimits(`hour`);i.hour=Xa(e,t,r.minValue,r.maxValue),i.dayPeriod==null&&`hour`in n&&(i.dayPeriod=Za(n.hour,this.hourCycle)[0])}break}case`dayPeriod`:i.dayPeriod=Xa(i.dayPeriod??0,t,0,1);break;case`minute`:i.minute=Xa(i.minute??0,t,0,59,!0);break;case`second`:i.second=Xa(i.second??0,t,0,59,!0)}return i}toValue(e){if(`hour`in e){let t=this.hour;t==null?(this.hourCycle===`h12`||this.hourCycle===`h11`)&&(t=this.dayPeriod===1?12:0):t=Qa(t,this.dayPeriod??0,this.hourCycle);let n=e.set({era:this.era??e.era,year:this.year??e.year,month:this.month??e.month,day:this.day??e.day,hour:t??e.hour,minute:this.minute??e.minute,second:this.second??e.second,millisecond:this.millisecond??e.millisecond});return`offset`in n&&this.offset!=null&&n.offset!==this.offset&&(n=n.add({milliseconds:n.offset-this.offset})),n}return e.set({era:this.era??e.era,year:this.year??e.year,month:this.month??e.month,day:this.day??e.day})}getSegmentLimits(e){switch(e){case`era`:{let e=this.calendar.getEras();return{value:this.era==null?e.length-1:e.indexOf(this.era),minValue:0,maxValue:e.length-1}}case`year`:return{value:this.year,minValue:1,maxValue:9999};case`month`:return{value:this.month,minValue:1,maxValue:this.calendar.getMaximumMonthsInYear()};case`day`:return{value:this.day,minValue:1,maxValue:this.calendar.getMaximumDaysInMonth()};case`dayPeriod`:return{value:this.dayPeriod,minValue:0,maxValue:1};case`hour`:{let e=0,t=23;return this.hourCycle===`h12`?(e=1,t=12):this.hourCycle===`h11`&&(e=0,t=11),{value:this.hour,minValue:e,maxValue:t}}case`minute`:return{value:this.minute,minValue:0,maxValue:59};case`second`:return{value:this.second,minValue:0,maxValue:59}}}};function Xa(e,t,n,r,i=!1){if(i){e+=Math.sign(t),e0?Math.ceil(e/i)*i:Math.floor(e/i)*i,e>r&&(e=n)}else e+=t,er&&(e=n+(e-r-1));return e}function Za(e,t){let n=+(e>=12);switch(t){case`h11`:e>=12&&(e-=12);break;case`h12`:e===0?e=12:e>12&&(e-=12);break;case`h23`:n=null;break;case`h24`:e+=1,n=null}return[n,e]}function Qa(e,t,n){switch(n){case`h11`:t===1&&(e+=12);break;case`h12`:e===12&&(e=0),t===1&&(e+=12);break;case`h24`:--e}return e}var $a={year:!0,month:!0,day:!0,hour:!0,minute:!0,second:!0,dayPeriod:!0,era:!0},eo={year:5,month:2,day:7,hour:2,minute:15,second:15},to={dayperiod:`dayPeriod`,relatedYear:`year`,yearName:`literal`,unknown:`literal`};function no(e){let{locale:t,createCalendar:n,hideTimeZone:r,isDisabled:i=!1,isReadOnly:a=!1,isRequired:o=!1,minValue:s,maxValue:c,isDateUnavailable:l}=e,u=e.value||e.defaultValue||e.placeholderValue||null,[d,f]=Ka(u,e.granularity),p=f||`UTC`;if(u&&!(d in u))throw Error(`Invalid granularity `+d+` for value `+u.toString());let[m,h]=(0,R.useMemo)(()=>{let r=new Y(t,{dateStyle:`short`,timeStyle:`short`,hour12:e.hourCycle==null?void 0:e.hourCycle===12}).resolvedOptions();return[n(r.calendar),r.hourCycle]},[t,e.hourCycle,n]),[g,_]=ce(e.value,e.defaultValue??null,e.onChange),[v]=(0,R.useState)(g),y=(0,R.useMemo)(()=>Wa(g,m)??null,[g,m]),[b,x]=(0,R.useState)(()=>new Ya(m,h,y)),S=m.identifier===`gregory`&&b.era===`BC`,C=(0,R.useMemo)(()=>({granularity:d,maxGranularity:e.maxGranularity??`year`,timeZone:f,hideTimeZone:r,hourCycle:e.hourCycle,showEra:S,shouldForceLeadingZeros:e.shouldForceLeadingZeros}),[e.maxGranularity,d,e.hourCycle,e.shouldForceLeadingZeros,f,r,S]),w=(0,R.useMemo)(()=>Ha({},C),[C]),T=(0,R.useMemo)(()=>new Y(t,w),[t,w]),E=(0,R.useMemo)(()=>T.resolvedOptions(),[T]),D=(0,R.useMemo)(()=>Ga(e.placeholderValue,d,m,f),[e.placeholderValue,d,m,f]),O=(0,R.useMemo)(()=>{let t=h===`h11`||h===`h12`,n=[`era`,`year`,`month`,`day`,`hour`,...t?[`dayPeriod`]:[],`minute`,`second`],r=n.indexOf(e.maxGranularity||`era`),i=n.indexOf(d===`hour`&&t?`dayPeriod`:d);return n.slice(r,i+1)},[e.maxGranularity,d,h]),[k,A]=(0,R.useState)(y),[ee,te]=(0,R.useState)(m),[j,ne]=(0,R.useState)(h);(y!==k||h!==j||!mt(m,ee))&&(b=new Ya(m,h,y),A(y),te(m),ne(h),x(b));let M=t=>{if(!(e.isDisabled||e.isReadOnly)){if(t==null||t instanceof Ya&&t.isCleared(O))x(new Ya(m,h,y)),_(null);else if(!(t instanceof Ya))t=G(t,u?.calendar||new z),x(new Ya(m,h,y)),_(t);else{if(t.isComplete(O)){let e=t.toValue(y??D);if(t.validate(e,O)){let t=G(e,u?.calendar||new z);if(!g||t.compare(g)!==0){x(new Ya(m,h,y)),_(t);return}}}x(t)}}},re=(0,R.useMemo)(()=>b.toValue(y??D).toDate(p),[b,p,y,D]),N=(0,R.useMemo)(()=>ro(re,b,T,E,m,t,d),[re,T,E,b,m,t,d]),ie=(e,t)=>{M(b.cycle(e,t,D,O))},P=(0,R.useMemo)(()=>Ra(g,s,c,l,C),[g,s,c,l,C]),ae=Oe({...e,value:g,builtinValidation:P}),oe=ae.displayValidation.isInvalid,se=e.validationState||(oe?`invalid`:null);return{...ae,value:y,defaultValue:e.defaultValue??v,dateValue:re,calendar:m,setValue:M,segments:N,dateFormatter:T,validationState:se,isInvalid:oe,granularity:d,maxGranularity:e.maxGranularity??`year`,isDisabled:i,isReadOnly:a,isRequired:o,increment(e){ie(e,1)},decrement(e){ie(e,-1)},incrementPage(e){ie(e,eo[e]||1)},decrementPage(e){ie(e,-(eo[e]||1))},incrementToMax(e){let t=e===`hour`&&h===`h12`?11:b.getSegmentLimits(e).maxValue;M(b.set(e,t,D))},decrementToMin(e){let t=e===`hour`&&h===`h12`?12:b.getSegmentLimits(e).minValue;M(b.set(e,t,D))},setSegment(e,t){M(b.set(e,t,D))},confirmPlaceholder(){if(!(e.isDisabled||e.isReadOnly)&&b.isComplete(O)){let e=G(b.toValue(y??D),u?.calendar||new z);(!g||e.compare(g)!==0)&&_(e),x(new Ya(m,h,y))}},clearSegment(e){let t=b;e!==`timeZoneName`&&e!==`literal`&&(t=b.clear(e)),M(t)},formatValue(e){if(!y)return``;let n=Ha(e,C);return new Y(t,n).format(re)},getDateFormatter(e,t){return new Y(e,Ha({},{...C,...t}))}}}function ro(e,t,n,r,i,a,o){let s=[`hour`,`minute`,`second`],c=n.formatToParts(e),l=new Fe(a,{useGrouping:!1}),u=new Fe(a,{useGrouping:!1,minimumIntegerDigits:2});for(let e of c)if(e.type===`year`||e.type===`month`||e.type===`day`||e.type===`hour`){let n=t[e.type]??0;e.value=r[e.type]===`2-digit`?u.format(n):l.format(n)}let d=[];for(let e of c){let n=to[e.type]||e.type,r=$a[n];n===`era`&&i.getEras().length===1&&(r=!1);let c=$a[n]&&t[e.type]==null,l=$a[n]?Ja(n,e.value,a):null,u={type:n,text:c?l:e.value,...t.getSegmentLimits(n),isPlaceholder:c,placeholder:l,isEditable:r};n===`hour`?(d.push({type:`literal`,text:`⁦`,isPlaceholder:!1,placeholder:``,isEditable:!1}),d.push(u),n===o&&d.push({type:`literal`,text:`⁩`,isPlaceholder:!1,placeholder:``,isEditable:!1})):s.includes(n)&&n===o?(d.push(u),d.push({type:`literal`,text:`⁩`,isPlaceholder:!1,placeholder:``,isEditable:!1})):d.push(u)}return d}function io(e){let{placeholderValue:t=new Ln,minValue:n,maxValue:r,defaultValue:i,granularity:a,validate:o}=e,[s,c]=ce(e.value,i??null,e.onChange),l=s||t,u=l&&`day`in l?l:void 0,d=i&&`timeZone`in i?i.timeZone:void 0,f=(0,R.useMemo)(()=>{let e=l&&`timeZone`in l?l.timeZone:void 0;return(e||d)&&t?Yt(ao(t),e||d):ao(t)},[t,l,d]),p=(0,R.useMemo)(()=>ao(n,u),[n,u]),m=(0,R.useMemo)(()=>ao(r,u),[r,u]),h=(0,R.useMemo)(()=>s&&`day`in s?Jt(s):s,[s]),g=(0,R.useMemo)(()=>s==null?null:ao(s),[s]),_=(0,R.useMemo)(()=>i==null?null:ao(i),[i]),v=e=>{c(u||d?e:e&&Jt(e))};return{...no({...e,value:g,defaultValue:_,minValue:p,maxValue:m,onChange:v,granularity:a||`minute`,maxGranularity:`hour`,placeholderValue:f??void 0,createCalendar:()=>new z,validate:(0,R.useCallback)(()=>o?.(s),[o,s])}),timeValue:h}}function ao(e,t=yt(Tt())){return e?`day`in e?e:W(t,e):null}var oo=(0,R.createContext)(null),so=(0,R.createContext)(null),co=(0,R.createContext)(null),lo=(0,R.createContext)(null),uo=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,oo);let{validationBehavior:n}=O(ve)||{},r=e.validationBehavior??n??`native`,{locale:i}=F(),a=no({...e,locale:i,createCalendar:Kr,validationBehavior:r}),o=(0,R.useRef)(null),[s,c]=A(!e[`aria-label`]&&!e[`aria-labelledby`]),l=(0,R.useRef)(null),{labelProps:u,fieldProps:d,inputProps:f,descriptionProps:m,errorMessageProps:h,...g}=Ki({...E(e),label:c,inputRef:l,validationBehavior:r},a,o),_=k({...E(e),values:{state:a,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1},defaultClassName:`react-aria-DateField`}),v=I(e,{global:!0});return delete v.id,R.createElement(x,{values:[[co,a],[ke,{...d,ref:o,isInvalid:a.isInvalid,isDisabled:a.isDisabled}],[Ne,{...f,ref:l}],[xe,{...u,ref:s,elementType:`span`}],[p,{slots:{description:m,errorMessage:h}}],[be,g]]},R.createElement(w.div,{...v,..._,ref:t,slot:e.slot||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0}),R.createElement(ii,{autoComplete:e.autoComplete,name:e.name,isDisabled:e.isDisabled,state:a}))}),fo=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,so);let{validationBehavior:n}=O(ve)||{},r=e.validationBehavior??n??`native`,{locale:i}=F(),a=io({...e,locale:i,validationBehavior:r}),o=(0,R.useRef)(null),[s,c]=A(!e[`aria-label`]&&!e[`aria-labelledby`]),l=(0,R.useRef)(null),{labelProps:u,fieldProps:d,inputProps:f,descriptionProps:m,errorMessageProps:h,...g}=qi({...E(e),label:c,inputRef:l,validationBehavior:r},a,o),_=k({...e,values:{state:a,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TimeField`}),v=I(e,{global:!0});return delete v.id,R.createElement(x,{values:[[lo,a],[ke,{...d,ref:o,isInvalid:a.isInvalid,isDisabled:a.isDisabled}],[Ne,{...f,ref:l}],[xe,{...u,ref:s,elementType:`span`}],[p,{slots:{description:m,errorMessage:h}}],[be,g]]},R.createElement(w.div,{...v,..._,ref:t,slot:e.slot||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0}))}),po=(0,R.forwardRef)(function(e,t){let n=(0,R.useContext)(co),r=(0,R.useContext)(lo);return n||r?R.createElement(ho,{...e,ref:t}):R.createElement(mo,{...e,ref:t})}),mo=(0,R.forwardRef)((e,t)=>{let[n,r]=se({slot:e.slot},t,oo),{locale:i}=F(),a=no({...n,locale:i,createCalendar:Kr}),o=(0,R.useRef)(null),{fieldProps:s,inputProps:c}=Ki({...n,inputRef:o},a,r);return R.createElement(x,{values:[[co,a],[Ne,{...c,ref:o}],[ke,{...s,ref:r,isInvalid:a.isInvalid,isDisabled:a.isDisabled}]]},R.createElement(ho,e))}),ho=(0,R.forwardRef)((e,t)=>{let{className:n,children:r}=e,i=(0,R.useContext)(co),a=(0,R.useContext)(lo),o=i??a;return R.createElement(R.Fragment,null,R.createElement(Ae,{...e,ref:t,slot:e.slot||void 0,className:n??`react-aria-DateInput`,isReadOnly:o.isReadOnly,isInvalid:o.isInvalid,isDisabled:o.isDisabled},o.segments.map((e,t)=>(0,R.cloneElement)(r(e),{key:t}))),R.createElement(je,{className:``}))}),go=(0,R.forwardRef)(function({segment:e,...t},n){let r=(0,R.useContext)(co),i=(0,R.useContext)(lo),a=r??i,o=T(n),{segmentProps:s}=Qi(e,a,o),{focusProps:c,isFocused:l,isFocusVisible:u}=P(),{hoverProps:d,isHovered:f}=pe({...t,isDisabled:a.isDisabled||e.type===`literal`}),p=k({...t,values:{...e,isReadOnly:a.isReadOnly,isInvalid:a.isInvalid,isDisabled:a.isDisabled,isHovered:f,isFocused:l,isFocusVisible:u},defaultChildren:e.text,defaultClassName:`react-aria-DateSegment`});return R.createElement(w.span,{...D(I(t,{global:!0}),s,c,d),...p,style:s.style,ref:o,"data-placeholder":e.isPlaceholder||void 0,"data-invalid":a.isInvalid||void 0,"data-readonly":a.isReadOnly||void 0,"data-disabled":a.isDisabled||void 0,"data-type":e.type,"data-hovered":f||void 0,"data-focused":l||void 0,"data-focus-visible":u||void 0})}),_o=(0,R.createContext)({}),vo=({children:e,className:t,fullWidth:n,variant:r,...i})=>{let a=R.useMemo(()=>et({fullWidth:n,variant:r}),[n,r]);return(0,X.jsx)(_o,{value:{slots:a},children:(0,X.jsx)(Ae,{className:N(t,a?.base()),"data-slot":`date-input-group`,...i,children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})})},yo=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(S.div,{className:L(r?.prefix,t),"data-slot":`date-input-group-prefix`,...n,children:e})},bo=({className:e,...t})=>{let{slots:n}=(0,R.use)(_o);return(0,X.jsx)(po,{className:N(e,n?.input()),"data-slot":`date-input-group-input`,...t})},xo=({className:e,segment:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(go,{className:L(r?.segment,e),"data-slot":`date-input-group-segment`,segment:t,...n})},So=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(S.div,{className:L(r?.inputContainer,t),"data-slot":`date-input-group-input-container`,...n,children:e})},Co=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(_o);return(0,X.jsx)(S.div,{className:L(r?.suffix,t),"data-slot":`date-input-group-suffix`,...n,children:e})};function wo({children:e,className:t,fullWidth:n,...r}){let i=R.useMemo(()=>Qe({fullWidth:n}),[n]);return(0,X.jsx)(uo,{"data-required":Le(r.isRequired),"data-slot":`date-field`,...r,className:N(t,i),children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})}var To=Object.assign(wo,{Root:wo,Group:vo,Input:bo,InputContainer:So,Segment:xo,Prefix:yo,Suffix:Co}),Eo={};Eo={dateRange:e=>`${e.startDate} \u{625}\u{644}\u{649} ${e.endDate}`,dateSelected:e=>`${e.date} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}`,finishRangeSelectionPrompt:`انقر لإنهاء عملية تحديد نطاق التاريخ`,maximumDate:`آخر تاريخ متاح`,minimumDate:`أول تاريخ متاح`,next:`التالي`,previous:`السابق`,selectedDateDescription:e=>`\u{62A}\u{627}\u{631}\u{64A}\u{62E} \u{645}\u{62D}\u{62F}\u{62F}: ${e.date}`,selectedRangeDescription:e=>`\u{627}\u{644}\u{645}\u{62F}\u{649} \u{627}\u{644}\u{632}\u{645}\u{646}\u{64A} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}: ${e.dateRange}`,startRangeSelectionPrompt:`انقر لبدء عملية تحديد نطاق التاريخ`,todayDate:e=>`\u{627}\u{644}\u{64A}\u{648}\u{645}\u{60C} ${e.date}`,todayDateSelected:e=>`\u{627}\u{644}\u{64A}\u{648}\u{645}\u{60C} ${e.date} \u{645}\u{62D}\u{62F}\u{62F}`};var Do={};Do={dateRange:e=>`${e.startDate} \u{434}\u{43E} ${e.endDate}`,dateSelected:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{43E} \u{435} ${e.date}`,finishRangeSelectionPrompt:`Натиснете, за да довършите избора на времеви интервал`,maximumDate:`Последна налична дата`,minimumDate:`Първа налична дата`,next:`Напред`,previous:`Назад`,selectedDateDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{418}\u{437}\u{431}\u{440}\u{430}\u{43D} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.dateRange}`,startRangeSelectionPrompt:`Натиснете, за да пристъпите към избора на времеви интервал`,todayDate:e=>`\u{414}\u{43D}\u{435}\u{441}, ${e.date}`,todayDateSelected:e=>`\u{414}\u{43D}\u{435}\u{441}, ${e.date} \u{441}\u{430} \u{438}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{438}`};var Oo={};Oo={dateRange:e=>`${e.startDate} a\u{17E} ${e.endDate}`,dateSelected:e=>`Vybr\xe1no ${e.date}`,finishRangeSelectionPrompt:`Kliknutím dokončíte výběr rozsahu dat`,maximumDate:`Poslední dostupné datum`,minimumDate:`První dostupné datum`,next:`Další`,previous:`Předchozí`,selectedDateDescription:e=>`Vybran\xe9 datum: ${e.date}`,selectedRangeDescription:e=>`Vybran\xe9 obdob\xed: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknutím zahájíte výběr rozsahu dat`,todayDate:e=>`Dnes, ${e.date}`,todayDateSelected:e=>`Dnes, vybr\xe1no ${e.date}`};var ko={};ko={dateRange:e=>`${e.startDate} til ${e.endDate}`,dateSelected:e=>`${e.date} valgt`,finishRangeSelectionPrompt:`Klik for at fuldføre valg af datoområde`,maximumDate:`Sidste ledige dato`,minimumDate:`Første ledige dato`,next:`Næste`,previous:`Forrige`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt interval: ${e.dateRange}`,startRangeSelectionPrompt:`Klik for at starte valg af datoområde`,todayDate:e=>`I dag, ${e.date}`,todayDateSelected:e=>`I dag, ${e.date} valgt`};var Ao={};Ao={dateRange:e=>`${e.startDate} bis ${e.endDate}`,dateSelected:e=>`${e.date} ausgew\xe4hlt`,finishRangeSelectionPrompt:`Klicken, um die Auswahl des Datumsbereichs zu beenden`,maximumDate:`Letztes verfügbares Datum`,minimumDate:`Erstes verfügbares Datum`,next:`Weiter`,previous:`Zurück`,selectedDateDescription:e=>`Ausgew\xe4hltes Datum: ${e.date}`,selectedRangeDescription:e=>`Ausgew\xe4hlter Bereich: ${e.dateRange}`,startRangeSelectionPrompt:`Klicken, um die Auswahl des Datumsbereichs zu beginnen`,todayDate:e=>`Heute, ${e.date}`,todayDateSelected:e=>`Heute, ${e.date} ausgew\xe4hlt`};var jo={};jo={dateRange:e=>`${e.startDate} \u{3AD}\u{3C9}\u{3C2} ${e.endDate}`,dateSelected:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3B8}\u{3B7}\u{3BA}\u{3B5} ${e.date}`,finishRangeSelectionPrompt:`Κάντε κλικ για να ολοκληρώσετε την επιλογή εύρους ημερομηνιών`,maximumDate:`Τελευταία διαθέσιμη ημερομηνία`,minimumDate:`Πρώτη διαθέσιμη ημερομηνία`,next:`Επόμενο`,previous:`Προηγούμενο`,selectedDateDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3B7} \u{3B7}\u{3BC}\u{3B5}\u{3C1}\u{3BF}\u{3BC}\u{3B7}\u{3BD}\u{3AF}\u{3B1}: ${e.date}`,selectedRangeDescription:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3B5}\u{3B3}\u{3BC}\u{3AD}\u{3BD}\u{3BF} \u{3B5}\u{3CD}\u{3C1}\u{3BF}\u{3C2}: ${e.dateRange}`,startRangeSelectionPrompt:`Κάντε κλικ για να ξεκινήσετε την επιλογή εύρους ημερομηνιών`,todayDate:e=>`\u{3A3}\u{3AE}\u{3BC}\u{3B5}\u{3C1}\u{3B1}, ${e.date}`,todayDateSelected:e=>`\u{3A3}\u{3AE}\u{3BC}\u{3B5}\u{3C1}\u{3B1}, \u{3B5}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3C4}\u{3B7}\u{3BA}\u{3B5} ${e.date}`};var Mo={};Mo={previous:`Previous`,next:`Next`,selectedDateDescription:e=>`Selected Date: ${e.date}`,selectedRangeDescription:e=>`Selected Range: ${e.dateRange}`,todayDate:e=>`Today, ${e.date}`,todayDateSelected:e=>`Today, ${e.date} selected`,dateSelected:e=>`${e.date} selected`,startRangeSelectionPrompt:`Click to start selecting date range`,finishRangeSelectionPrompt:`Click to finish selecting date range`,minimumDate:`First available date`,maximumDate:`Last available date`,dateRange:e=>`${e.startDate} to ${e.endDate}`};var No={};No={dateRange:e=>`${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} seleccionado`,finishRangeSelectionPrompt:`Haga clic para terminar de seleccionar rango de fechas`,maximumDate:`Última fecha disponible`,minimumDate:`Primera fecha disponible`,next:`Siguiente`,previous:`Anterior`,selectedDateDescription:e=>`Fecha seleccionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo seleccionado: ${e.dateRange}`,startRangeSelectionPrompt:`Haga clic para comenzar a seleccionar un rango de fechas`,todayDate:e=>`Hoy, ${e.date}`,todayDateSelected:e=>`Hoy, ${e.date} seleccionado`};var Po={};Po={dateRange:e=>`${e.startDate} kuni ${e.endDate}`,dateSelected:e=>`${e.date} valitud`,finishRangeSelectionPrompt:`Klõpsake kuupäevavahemiku valimise lõpetamiseks`,maximumDate:`Viimane saadaolev kuupäev`,minimumDate:`Esimene saadaolev kuupäev`,next:`Järgmine`,previous:`Eelmine`,selectedDateDescription:e=>`Valitud kuup\xe4ev: ${e.date}`,selectedRangeDescription:e=>`Valitud vahemik: ${e.dateRange}`,startRangeSelectionPrompt:`Klõpsake kuupäevavahemiku valimiseks`,todayDate:e=>`T\xe4na, ${e.date}`,todayDateSelected:e=>`T\xe4na, ${e.date} valitud`};var Fo={};Fo={dateRange:e=>`${e.startDate} \u{2013} ${e.endDate}`,dateSelected:e=>`${e.date} valittu`,finishRangeSelectionPrompt:`Lopeta päivämääräalueen valinta napsauttamalla tätä.`,maximumDate:`Viimeinen varattavissa oleva päivämäärä`,minimumDate:`Ensimmäinen varattavissa oleva päivämäärä`,next:`Seuraava`,previous:`Edellinen`,selectedDateDescription:e=>`Valittu p\xe4iv\xe4m\xe4\xe4r\xe4: ${e.date}`,selectedRangeDescription:e=>`Valittu aikav\xe4li: ${e.dateRange}`,startRangeSelectionPrompt:`Aloita päivämääräalueen valinta napsauttamalla tätä.`,todayDate:e=>`T\xe4n\xe4\xe4n, ${e.date}`,todayDateSelected:e=>`T\xe4n\xe4\xe4n, ${e.date} valittu`};var Io={};Io={dateRange:e=>`${e.startDate} \xe0 ${e.endDate}`,dateSelected:e=>`${e.date} s\xe9lectionn\xe9`,finishRangeSelectionPrompt:`Cliquer pour finir de sélectionner la plage de dates`,maximumDate:`Dernière date disponible`,minimumDate:`Première date disponible`,next:`Suivant`,previous:`Précédent`,selectedDateDescription:e=>`Date s\xe9lectionn\xe9e\xa0: ${e.date}`,selectedRangeDescription:e=>`Plage s\xe9lectionn\xe9e\xa0: ${e.dateRange}`,startRangeSelectionPrompt:`Cliquer pour commencer à sélectionner la plage de dates`,todayDate:e=>`Aujourd'hui, ${e.date}`,todayDateSelected:e=>`Aujourd\u{2019}hui, ${e.date} s\xe9lectionn\xe9`};var Lo={};Lo={dateRange:e=>`${e.startDate} \u{5E2}\u{5D3} ${e.endDate}`,dateSelected:e=>`${e.date} \u{5E0}\u{5D1}\u{5D7}\u{5E8}`,finishRangeSelectionPrompt:`חץ כדי לסיים את בחירת טווח התאריכים`,maximumDate:`תאריך פנוי אחרון`,minimumDate:`תאריך פנוי ראשון`,next:`הבא`,previous:`הקודם`,selectedDateDescription:e=>`\u{5EA}\u{5D0}\u{5E8}\u{5D9}\u{5DA} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.date}`,selectedRangeDescription:e=>`\u{5D8}\u{5D5}\u{5D5}\u{5D7} \u{5E0}\u{5D1}\u{5D7}\u{5E8}: ${e.dateRange}`,startRangeSelectionPrompt:`לחץ כדי להתחיל בבחירת טווח התאריכים`,todayDate:e=>`\u{5D4}\u{5D9}\u{5D5}\u{5DD}, ${e.date}`,todayDateSelected:e=>`\u{5D4}\u{5D9}\u{5D5}\u{5DD}, ${e.date} \u{5E0}\u{5D1}\u{5D7}\u{5E8}`};var Ro={};Ro={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`${e.date} odabran`,finishRangeSelectionPrompt:`Kliknite da dovršite raspon odabranih datuma`,maximumDate:`Posljednji raspoloživi datum`,minimumDate:`Prvi raspoloživi datum`,next:`Sljedeći`,previous:`Prethodni`,selectedDateDescription:e=>`Odabrani datum: ${e.date}`,selectedRangeDescription:e=>`Odabrani raspon: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknite da započnete raspon odabranih datuma`,todayDate:e=>`Danas, ${e.date}`,todayDateSelected:e=>`Danas, odabran ${e.date}`};var zo={};zo={dateRange:e=>`${e.startDate}\u{2013}${e.endDate}`,dateSelected:e=>`${e.date} kiv\xe1lasztva`,finishRangeSelectionPrompt:`Kattintson a dátumtartomány kijelölésének befejezéséhez`,maximumDate:`Utolsó elérhető dátum`,minimumDate:`Az első elérhető dátum`,next:`Következő`,previous:`Előző`,selectedDateDescription:e=>`Kijel\xf6lt d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Kijel\xf6lt tartom\xe1ny: ${e.dateRange}`,startRangeSelectionPrompt:`Kattintson a dátumtartomány kijelölésének indításához`,todayDate:e=>`Ma, ${e.date}`,todayDateSelected:e=>`Ma, ${e.date} kijel\xf6lve`};var Bo={};Bo={dateRange:e=>`Da ${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} selezionata`,finishRangeSelectionPrompt:`Fai clic per completare la selezione dell’intervallo di date`,maximumDate:`Ultima data disponibile`,minimumDate:`Prima data disponibile`,next:`Successivo`,previous:`Precedente`,selectedDateDescription:e=>`Data selezionata: ${e.date}`,selectedRangeDescription:e=>`Intervallo selezionato: ${e.dateRange}`,startRangeSelectionPrompt:`Fai clic per selezionare l’intervallo di date`,todayDate:e=>`Oggi, ${e.date}`,todayDateSelected:e=>`Oggi, ${e.date} selezionata`};var Vo={};Vo={dateRange:e=>`${e.startDate} \u{304B}\u{3089} ${e.endDate}`,dateSelected:e=>`${e.date} \u{3092}\u{9078}\u{629E}`,finishRangeSelectionPrompt:`クリックして日付範囲の選択を終了`,maximumDate:`最終利用可能日`,minimumDate:`最初の利用可能日`,next:`次へ`,previous:`前へ`,selectedDateDescription:e=>`\u{9078}\u{629E}\u{3057}\u{305F}\u{65E5}\u{4ED8} : ${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{629E}\u{7BC4}\u{56F2} : ${e.dateRange}`,startRangeSelectionPrompt:`クリックして日付範囲の選択を開始`,todayDate:e=>`\u{672C}\u{65E5}\u{3001}${e.date}`,todayDateSelected:e=>`\u{672C}\u{65E5}\u{3001}${e.date} \u{3092}\u{9078}\u{629E}`};var Ho={};Ho={dateRange:e=>`${e.startDate} ~ ${e.endDate}`,dateSelected:e=>`${e.date} \u{C120}\u{D0DD}\u{B428}`,finishRangeSelectionPrompt:`날짜 범위 선택을 완료하려면 클릭하십시오.`,maximumDate:`마지막으로 사용 가능한 일자`,minimumDate:`처음으로 사용 가능한 일자`,next:`다음`,previous:`이전`,selectedDateDescription:e=>`\u{C120}\u{D0DD} \u{C77C}\u{C790}: ${e.date}`,selectedRangeDescription:e=>`\u{C120}\u{D0DD} \u{BC94}\u{C704}: ${e.dateRange}`,startRangeSelectionPrompt:`날짜 범위 선택을 시작하려면 클릭하십시오.`,todayDate:e=>`\u{C624}\u{B298}, ${e.date}`,todayDateSelected:e=>`\u{C624}\u{B298}, ${e.date} \u{C120}\u{D0DD}\u{B428}`};var Uo={};Uo={dateRange:e=>`Nuo ${e.startDate} iki ${e.endDate}`,dateSelected:e=>`Pasirinkta ${e.date}`,finishRangeSelectionPrompt:`Spustelėkite, kad baigtumėte pasirinkti datų intervalą`,maximumDate:`Paskutinė galima data`,minimumDate:`Pirmoji galima data`,next:`Paskesnis`,previous:`Ankstesnis`,selectedDateDescription:e=>`Pasirinkta data: ${e.date}`,selectedRangeDescription:e=>`Pasirinktas intervalas: ${e.dateRange}`,startRangeSelectionPrompt:`Spustelėkite, kad pradėtumėte pasirinkti datų intervalą`,todayDate:e=>`\u{160}iandien, ${e.date}`,todayDateSelected:e=>`\u{160}iandien, pasirinkta ${e.date}`};var Wo={};Wo={dateRange:e=>`No ${e.startDate} l\u{12B}dz ${e.endDate}`,dateSelected:e=>`Atlas\u{12B}ts: ${e.date}`,finishRangeSelectionPrompt:`Noklikšķiniet, lai pabeigtu datumu diapazona atlasi`,maximumDate:`Pēdējais pieejamais datums`,minimumDate:`Pirmais pieejamais datums`,next:`Tālāk`,previous:`Atpakaļ`,selectedDateDescription:e=>`Atlas\u{12B}tais datums: ${e.date}`,selectedRangeDescription:e=>`Atlas\u{12B}tais diapazons: ${e.dateRange}`,startRangeSelectionPrompt:`Noklikšķiniet, lai sāktu datumu diapazona atlasi`,todayDate:e=>`\u{160}odien, ${e.date}`,todayDateSelected:e=>`Atlas\u{12B}ta \u{161}odiena, ${e.date}`};var Go={};Go={dateRange:e=>`${e.startDate} til ${e.endDate}`,dateSelected:e=>`${e.date} valgt`,finishRangeSelectionPrompt:`Klikk for å fullføre valg av datoområde`,maximumDate:`Siste tilgjengelige dato`,minimumDate:`Første tilgjengelige dato`,next:`Neste`,previous:`Forrige`,selectedDateDescription:e=>`Valgt dato: ${e.date}`,selectedRangeDescription:e=>`Valgt omr\xe5de: ${e.dateRange}`,startRangeSelectionPrompt:`Klikk for å starte valg av datoområde`,todayDate:e=>`I dag, ${e.date}`,todayDateSelected:e=>`I dag, ${e.date} valgt`};var Ko={};Ko={dateRange:e=>`${e.startDate} tot ${e.endDate}`,dateSelected:e=>`${e.date} geselecteerd`,finishRangeSelectionPrompt:`Klik om de selectie van het datumbereik te voltooien`,maximumDate:`Laatste beschikbare datum`,minimumDate:`Eerste beschikbare datum`,next:`Volgende`,previous:`Vorige`,selectedDateDescription:e=>`Geselecteerde datum: ${e.date}`,selectedRangeDescription:e=>`Geselecteerd bereik: ${e.dateRange}`,startRangeSelectionPrompt:`Klik om het datumbereik te selecteren`,todayDate:e=>`Vandaag, ${e.date}`,todayDateSelected:e=>`Vandaag, ${e.date} geselecteerd`};var qo={};qo={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`Wybrano ${e.date}`,finishRangeSelectionPrompt:`Kliknij, aby zakończyć wybór zakresu dat`,maximumDate:`Ostatnia dostępna data`,minimumDate:`Pierwsza dostępna data`,next:`Dalej`,previous:`Wstecz`,selectedDateDescription:e=>`Wybrana data: ${e.date}`,selectedRangeDescription:e=>`Wybrany zakres: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknij, aby rozpocząć wybór zakresu dat`,todayDate:e=>`Dzisiaj, ${e.date}`,todayDateSelected:e=>`Dzisiaj wybrano ${e.date}`};var Jo={};Jo={dateRange:e=>`${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} selecionado`,finishRangeSelectionPrompt:`Clique para concluir a seleção do intervalo de datas`,maximumDate:`Última data disponível`,minimumDate:`Primeira data disponível`,next:`Próximo`,previous:`Anterior`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.dateRange}`,startRangeSelectionPrompt:`Clique para iniciar a seleção do intervalo de datas`,todayDate:e=>`Hoje, ${e.date}`,todayDateSelected:e=>`Hoje, ${e.date} selecionado`};var Yo={};Yo={dateRange:e=>`${e.startDate} a ${e.endDate}`,dateSelected:e=>`${e.date} selecionado`,finishRangeSelectionPrompt:`Clique para terminar de selecionar o intervalo de datas`,maximumDate:`Última data disponível`,minimumDate:`Primeira data disponível`,next:`Próximo`,previous:`Anterior`,selectedDateDescription:e=>`Data selecionada: ${e.date}`,selectedRangeDescription:e=>`Intervalo selecionado: ${e.dateRange}`,startRangeSelectionPrompt:`Clique para começar a selecionar o intervalo de datas`,todayDate:e=>`Hoje, ${e.date}`,todayDateSelected:e=>`Hoje, ${e.date} selecionado`};var Xo={};Xo={dateRange:e=>`De la ${e.startDate} p\xe2n\u{103} la ${e.endDate}`,dateSelected:e=>`${e.date} selectat\u{103}`,finishRangeSelectionPrompt:`Apăsaţi pentru a finaliza selecţia razei pentru dată`,maximumDate:`Ultima dată disponibilă`,minimumDate:`Prima dată disponibilă`,next:`Următorul`,previous:`Înainte`,selectedDateDescription:e=>`Dat\u{103} selectat\u{103}: ${e.date}`,selectedRangeDescription:e=>`Interval selectat: ${e.dateRange}`,startRangeSelectionPrompt:`Apăsaţi pentru a începe selecţia razei pentru dată`,todayDate:e=>`Ast\u{103}zi, ${e.date}`,todayDateSelected:e=>`Azi, ${e.date} selectat\u{103}`};var Zo={};Zo={dateRange:e=>`\u{421} ${e.startDate} \u{43F}\u{43E} ${e.endDate}`,dateSelected:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`,finishRangeSelectionPrompt:`Щелкните, чтобы завершить выбор диапазона дат`,maximumDate:`Последняя доступная дата`,minimumDate:`Первая доступная дата`,next:`Далее`,previous:`Назад`,selectedDateDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{430}\u{44F} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{44B}\u{439} \u{434}\u{438}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.dateRange}`,startRangeSelectionPrompt:`Щелкните, чтобы начать выбор диапазона дат`,todayDate:e=>`\u{421}\u{435}\u{433}\u{43E}\u{434}\u{43D}\u{44F}, ${e.date}`,todayDateSelected:e=>`\u{421}\u{435}\u{433}\u{43E}\u{434}\u{43D}\u{44F}, \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`};var Qo={};Qo={dateRange:e=>`Od ${e.startDate} do ${e.endDate}`,dateSelected:e=>`Vybrat\xfd d\xe1tum ${e.date}`,finishRangeSelectionPrompt:`Kliknutím dokončíte výber rozsahu dátumov`,maximumDate:`Posledný dostupný dátum`,minimumDate:`Prvý dostupný dátum`,next:`Nasledujúce`,previous:`Predchádzajúce`,selectedDateDescription:e=>`Vybrat\xfd d\xe1tum: ${e.date}`,selectedRangeDescription:e=>`Vybrat\xfd rozsah: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknutím spustíte výber rozsahu dátumov`,todayDate:e=>`Dnes ${e.date}`,todayDateSelected:e=>`Vybrat\xfd dne\u{161}n\xfd d\xe1tum ${e.date}`};var $o={};$o={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`${e.date} izbrano`,finishRangeSelectionPrompt:`Kliknite za dokončanje izbire datumskega obsega`,maximumDate:`Zadnji razpoložljivi datum`,minimumDate:`Prvi razpoložljivi datum`,next:`Naprej`,previous:`Nazaj`,selectedDateDescription:e=>`Izbrani datum: ${e.date}`,selectedRangeDescription:e=>`Izbrano obmo\u{10D}je: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknite za začetek izbire datumskega obsega`,todayDate:e=>`Danes, ${e.date}`,todayDateSelected:e=>`Danes, ${e.date} izbrano`};var es={};es={dateRange:e=>`${e.startDate} do ${e.endDate}`,dateSelected:e=>`${e.date} izabran`,finishRangeSelectionPrompt:`Kliknite da dovršite opseg izabranih datuma`,maximumDate:`Zadnji raspoloživi datum`,minimumDate:`Prvi raspoloživi datum`,next:`Sledeći`,previous:`Prethodni`,selectedDateDescription:e=>`Izabrani datum: ${e.date}`,selectedRangeDescription:e=>`Izabrani period: ${e.dateRange}`,startRangeSelectionPrompt:`Kliknite da započnete opseg izabranih datuma`,todayDate:e=>`Danas, ${e.date}`,todayDateSelected:e=>`Danas, izabran ${e.date}`};var ts={};ts={dateRange:e=>`${e.startDate} till ${e.endDate}`,dateSelected:e=>`${e.date} har valts`,finishRangeSelectionPrompt:`Klicka för att avsluta val av datumintervall`,maximumDate:`Sista tillgängliga datum`,minimumDate:`Första tillgängliga datum`,next:`Nästa`,previous:`Föregående`,selectedDateDescription:e=>`Valt datum: ${e.date}`,selectedRangeDescription:e=>`Valt intervall: ${e.dateRange}`,startRangeSelectionPrompt:`Klicka för att välja datumintervall`,todayDate:e=>`Idag, ${e.date}`,todayDateSelected:e=>`Idag, ${e.date} har valts`};var ns={};ns={dateRange:e=>`${e.startDate} - ${e.endDate}`,dateSelected:e=>`${e.date} se\xe7ildi`,finishRangeSelectionPrompt:`Tarih aralığı seçimini tamamlamak için tıklayın`,maximumDate:`Son müsait tarih`,minimumDate:`İlk müsait tarih`,next:`Sonraki`,previous:`Önceki`,selectedDateDescription:e=>`Se\xe7ilen Tarih: ${e.date}`,selectedRangeDescription:e=>`Se\xe7ilen Aral\u{131}k: ${e.dateRange}`,startRangeSelectionPrompt:`Tarih aralığı seçimini başlatmak için tıklayın`,todayDate:e=>`Bug\xfcn, ${e.date}`,todayDateSelected:e=>`Bug\xfcn, ${e.date} se\xe7ildi`};var rs={};rs={dateRange:e=>`${e.startDate} \u{2014} ${e.endDate}`,dateSelected:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`,finishRangeSelectionPrompt:`Натисніть, щоб завершити вибір діапазону дат`,maximumDate:`Остання доступна дата`,minimumDate:`Перша доступна дата`,next:`Наступний`,previous:`Попередній`,selectedDateDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{430} \u{434}\u{430}\u{442}\u{430}: ${e.date}`,selectedRangeDescription:e=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{438}\u{439} \u{434}\u{456}\u{430}\u{43F}\u{430}\u{437}\u{43E}\u{43D}: ${e.dateRange}`,startRangeSelectionPrompt:`Натисніть, щоб почати вибір діапазону дат`,todayDate:e=>`\u{421}\u{44C}\u{43E}\u{433}\u{43E}\u{434}\u{43D}\u{456}, ${e.date}`,todayDateSelected:e=>`\u{421}\u{44C}\u{43E}\u{433}\u{43E}\u{434}\u{43D}\u{456}, \u{432}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E} ${e.date}`};var is={};is={dateRange:e=>`${e.startDate} \u{81F3} ${e.endDate}`,dateSelected:e=>`\u{5DF2}\u{9009}\u{62E9} ${e.date}`,finishRangeSelectionPrompt:`单击以完成选择日期范围`,maximumDate:`最后一个可用日期`,minimumDate:`第一个可用日期`,next:`下一页`,previous:`上一页`,selectedDateDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9009}\u{5B9A}\u{7684}\u{8303}\u{56F4}\u{FF1A}${e.dateRange}`,startRangeSelectionPrompt:`单击以开始选择日期范围`,todayDate:e=>`\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${e.date}`,todayDateSelected:e=>`\u{5DF2}\u{9009}\u{62E9}\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${e.date}`};var as={};as={dateRange:e=>`${e.startDate} \u{81F3} ${e.endDate}`,dateSelected:e=>`\u{5DF2}\u{9078}\u{53D6} ${e.date}`,finishRangeSelectionPrompt:`按一下以完成選取日期範圍`,maximumDate:`最後一個可用日期`,minimumDate:`第一個可用日期`,next:`下一頁`,previous:`上一頁`,selectedDateDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${e.date}`,selectedRangeDescription:e=>`\u{9078}\u{5B9A}\u{7684}\u{7BC4}\u{570D}\u{FF1A}${e.dateRange}`,startRangeSelectionPrompt:`按一下以開始選取日期範圍`,todayDate:e=>`\u{4ECA}\u{5929}\u{FF0C}${e.date}`,todayDateSelected:e=>`\u{5DF2}\u{9078}\u{53D6}\u{4ECA}\u{5929}\u{FF0C}${e.date}`};var os={};os={"ar-AE":Eo,"bg-BG":Do,"cs-CZ":Oo,"da-DK":ko,"de-DE":Ao,"el-GR":jo,"en-US":Mo,"es-ES":No,"et-EE":Po,"fi-FI":Fo,"fr-FR":Io,"he-IL":Lo,"hr-HR":Ro,"hu-HU":zo,"it-IT":Bo,"ja-JP":Vo,"ko-KR":Ho,"lt-LT":Uo,"lv-LV":Wo,"nb-NO":Go,"nl-NL":Ko,"pl-PL":qo,"pt-BR":Jo,"pt-PT":Yo,"ro-RO":Xo,"ru-RU":Zo,"sk-SK":Qo,"sl-SI":$o,"sr-SP":es,"sv-SE":ts,"tr-TR":ns,"uk-UA":rs,"zh-CN":is,"zh-TW":as};function ss(e){return e&&e.__esModule?e.default:e}var cs=new WeakMap;function ls(e){return e?.calendar.identifier===`gregory`&&e.era===`BC`?`short`:void 0}function us(e){let t=h(ss(os),`@react-aria/calendar`),n,r;`highlightedRange`in e?{start:n,end:r}=e.highlightedRange||{}:(n=Array.isArray(e.value)?e.value[0]:e.value??void 0,r=Array.isArray(e.value)?e.value.at(-1):e.value??void 0);let i=Z({weekday:`long`,month:`long`,year:`numeric`,day:`numeric`,era:ls(n)||ls(r),timeZone:e.timeZone}),{locale:a}=F(),o=(0,R.useMemo)(()=>new Intl.ListFormat(a),[a]),s=`anchorDate`in e?e.anchorDate:null;return(0,R.useMemo)(()=>{if(!s&&n&&r){if(B(n,r)){let r=i.format(n.toDate(e.timeZone));return t.format(`selectedDateDescription`,{date:r})}if(`highlightedRange`in e){let a=fs(i,t,n,r,e.timeZone);return t.format(`selectedRangeDescription`,{dateRange:a})}if(Array.isArray(e.value)){let n=e.value.map(t=>i.format(t.toDate(e.timeZone))),r=o.format(n);return t.format(`selectedDateDescription`,{date:r})}}return``},[n,r,s,e,t,i,o])}function ds(e,t,n,r){let i=h(ss(os),`@react-aria/calendar`),a=ls(e)||ls(t),o=Z({month:`long`,year:`numeric`,era:a,calendar:e.calendar.identifier,timeZone:n}),s=Z({month:`long`,year:`numeric`,day:`numeric`,era:a,calendar:e.calendar.identifier,timeZone:n});return(0,R.useMemo)(()=>{if(B(e,Dt(e))){let a=e,s=t;if(e.calendar.getFormattableMonth&&(a=e.calendar.getFormattableMonth(e)),t.calendar.getFormattableMonth&&(s=t.calendar.getFormattableMonth(t)),B(t,Ot(e)))return o.format(a.toDate(n));if(B(t,Ot(t)))return r?fs(o,i,a,s,n):o.formatRange(a.toDate(n),s.toDate(n))}return r?fs(s,i,e,t,n):s.formatRange(e.toDate(n),t.toDate(n))},[e,t,o,s,i,n,r])}function fs(e,t,n,r,i){let a=e.formatRangeToParts(n.toDate(i),r.toDate(i)),o=-1;for(let e=0;eo&&(c+=a[e].value);return t.format(`dateRange`,{startDate:s,endDate:c})}function ps(e){return e&&e.__esModule?e.default:e}function ms(e,t){let n=h(ps(os),`@react-aria/calendar`),r=I(e),i=ds(t.visibleRange.start,t.visibleRange.end,t.timeZone,!1),a=ds(t.visibleRange.start,t.visibleRange.end,t.timeZone,!0);_e(()=>{t.isFocused||l(a)},[a]);let o=us(t);_e(()=>{o&&l(o,`polite`,4e3)},[o]);let s=ie([!!e.errorMessage,e.isInvalid,e.validationState]);cs.set(t,{ariaLabel:e[`aria-label`],ariaLabelledBy:e[`aria-labelledby`],errorMessageId:s,selectedDateDescription:o});let[c,u]=(0,R.useState)(!1),d=e.isDisabled||t.isNextVisibleRangeInvalid();d&&c&&(u(!1),t.setFocused(!0));let[f,p]=(0,R.useState)(!1),m=e.isDisabled||t.isPreviousVisibleRangeInvalid();m&&f&&(p(!1),t.setFocused(!0));let g=_({id:e.id,"aria-label":[e[`aria-label`],a].filter(Boolean).join(`, `),"aria-labelledby":e[`aria-labelledby`]});return{calendarProps:D(r,g,{role:`application`,"aria-details":e[`aria-details`]||void 0,"aria-describedby":e[`aria-describedby`]||void 0}),nextButtonProps:{onPress:()=>t.focusNextPage(),"aria-label":n.format(`next`),isDisabled:d,onFocusChange:u},prevButtonProps:{onPress:()=>t.focusPreviousPage(),"aria-label":n.format(`previous`),isDisabled:m,onFocusChange:p},errorMessageProps:{id:s},title:i}}function hs(e,t){let{startDate:n=t.visibleRange.start,endDate:r=t.visibleRange.end,firstDayOfWeek:i}=e,{direction:a}=F(),{keyboardProps:o}=he({shortcuts:{End:()=>{t.focusSectionEnd()},Home:()=>{t.focusSectionStart()},Escape:()=>(`setAnchorDate`in t&&t.setAnchorDate(null),!1)}}),{keyboardProps:s}=he({shortcuts:{Enter:()=>{t.selectFocusedDate()}," ":()=>{t.selectFocusedDate()},PageUp:()=>{t.focusPreviousSection()},"Shift+PageUp":()=>{t.focusPreviousSection(!0)},PageDown:()=>{t.focusNextSection()},"Shift+PageDown":()=>{t.focusNextSection(!0)},ArrowLeft:()=>{a===`rtl`?t.focusNextDay():t.focusPreviousDay()},ArrowUp:()=>{t.focusPreviousRow()},ArrowRight:()=>{a===`rtl`?t.focusPreviousDay():t.focusNextDay()},ArrowDown:()=>{t.focusNextRow()}},allowRepeats:!0}),c=ds(n,r,t.timeZone,!0),{ariaLabel:l,ariaLabelledBy:u}=cs.get(t),d=_({"aria-label":[l,c].filter(Boolean).join(`, `),"aria-labelledby":u}),f=Z({weekday:e.weekdayStyle||`narrow`,timeZone:t.timeZone}),{locale:p}=F(),m=(0,R.useMemo)(()=>{let e=t.visibleDuration.days&&t.visibleDuration.days<7,r=e?n:At(yt(t.timeZone),p,i),a=e?t.visibleDuration.days:7;return[...Array(a).keys()].map(e=>{let n=r.add({days:e}).toDate(t.timeZone);return f.format(n)})},[p,t.timeZone,f,i,n,t.visibleDuration.days]),h=t.getWeeksInMonth(n);return{gridProps:D(d,{role:`grid`,"aria-readonly":t.isReadOnly||void 0,"aria-disabled":t.isDisabled||void 0,"aria-multiselectable":`highlightedRange`in t||t.selectionMode===`multiple`||void 0,onFocus:()=>t.setFocused(!0),onBlur:()=>t.setFocused(!1)},o,s),headerProps:{"aria-hidden":!0},weekDays:m,weeksInMonth:h}}function gs(e){return e&&e.__esModule?e.default:e}function _s(e,t,n){let{date:r,isDisabled:i}=e,{errorMessageId:a,selectedDateDescription:o}=cs.get(t),s=h(gs(os),`@react-aria/calendar`),c=Z({weekday:`long`,day:`numeric`,month:`long`,year:`numeric`,era:ls(r),timeZone:t.timeZone}),l=t.isCellFocused(r)&&!e.isOutsideMonth;i=i||t.isCellDisabled(r)||!!e.isOutsideMonth;let u=t.isCellUnavailable(r),d=!i&&!u,f=t.isSelected(r)&&d,p=!1;t.isValueInvalid&&(`highlightedRange`in t?p=!t.anchorDate&&t.highlightedRange!=null&&r.compare(t.highlightedRange.start)>=0&&r.compare(t.highlightedRange.end)<=0:Array.isArray(t.value)?p=t.value.some(e=>B(e,r)):t.value&&(p=B(t.value,r))),p&&!i&&(f=!0),r=Ye(r,pt);let m=(0,R.useMemo)(()=>r.toDate(t.timeZone),[r,t.timeZone]),g=ht(r,t.timeZone),_=(0,R.useMemo)(()=>{let e=``;return`highlightedRange`in t&&t.value&&!t.anchorDate&&(B(r,t.value.start)||B(r,t.value.end))&&(e=o+`, `),e+=c.format(m),g?e=s.format(f?`todayDateSelected`:`todayDate`,{date:e}):f&&(e=s.format(`dateSelected`,{date:e})),t.minValue&&B(r,t.minValue)?e+=`, `+s.format(`minimumDate`):t.maxValue&&B(r,t.maxValue)&&(e+=`, `+s.format(`maximumDate`)),e},[c,m,s,f,g,r,t,o]),v=``;`anchorDate`in t&&l&&!t.isReadOnly&&d&&(v=t.anchorDate?s.format(`finishRangeSelectionPrompt`):s.format(`startRangeSelectionPrompt`));let y=Ue(v),x=(0,R.useRef)(!1),S=(0,R.useRef)(!1),C=(0,R.useRef)(void 0),{pressProps:w,isPressed:T}=ue({shouldCancelOnPointerExit:`anchorDate`in t&&!!t.anchorDate,preventFocusOnPress:!0,isDisabled:!d||t.isReadOnly,onPressStart(e){if(t.isReadOnly){t.setFocusedDate(r),t.setFocused(!0);return}if(`highlightedRange`in t&&!t.anchorDate&&(e.pointerType===`mouse`||e.pointerType===`touch`)){if(t.highlightedRange&&!p){if(B(r,t.highlightedRange.start)){t.setAnchorDate(t.highlightedRange.end),t.setFocusedDate(r),t.setFocused(!0),t.setDragging(!0),S.current=!0;return}if(B(r,t.highlightedRange.end)){t.setAnchorDate(t.highlightedRange.start),t.setFocusedDate(r),t.setFocused(!0),t.setDragging(!0),S.current=!0;return}}let n=()=>{t.setDragging(!0),C.current=void 0,t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0),x.current=!0};e.pointerType===`touch`?C.current=setTimeout(n,200):n()}},onPressEnd(){S.current=!1,x.current=!1,clearTimeout(C.current),C.current=void 0},onPress(){!(`anchorDate`in t)&&!t.isReadOnly&&(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0))},onPressUp(e){t.isReadOnly||(`anchorDate`in t&&C.current&&(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0)),`anchorDate`in t&&(S.current?t.setAnchorDate(r):t.anchorDate&&!x.current?(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0)):e.pointerType===`keyboard`&&!t.anchorDate?(t.selectDate(r),t.focusNearestAvailableDate(r)):e.pointerType===`virtual`&&(t.selectDate(r),t.setFocusedDate(r),t.setFocused(!0))))}}),E;i||(E=B(r,t.focusedDate)?0:-1),(0,R.useEffect)(()=>{l&&n.current&&(M(n.current),me()!==`pointer`&&b()===n.current&&qe(n.current,{containingElement:Be(n.current)}))},[l,n]);let O=Z({day:`numeric`,timeZone:t.timeZone,calendar:r.calendar.identifier}),k=(0,R.useMemo)(()=>O.formatToParts(m).find(e=>e.type===`day`).value,[O,m]);return{cellProps:{role:`gridcell`,"aria-disabled":!d||void 0,"aria-selected":f||void 0,"aria-invalid":p||void 0},buttonProps:D(w,{onFocus(){i||(t.setFocusedDate(r),t.setFocused(!0))},tabIndex:E,role:`button`,"aria-disabled":!d||void 0,"aria-label":_,"aria-invalid":p||void 0,"aria-describedby":[p?a:void 0,y[`aria-describedby`]].filter(Boolean).join(` `)||void 0,onPointerEnter(e){`highlightDate`in t&&(e.pointerType!==`touch`||t.isDragging)&&d&&t.highlightDate(r)},onPointerDown(e){let t=fe(e);t instanceof HTMLElement&&`releasePointerCapture`in t&&(`hasPointerCapture`in t?t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId):t.releasePointerCapture(e.pointerId))},onContextMenu(e){e.preventDefault()}}),isPressed:T,isFocused:l,isSelected:f,isDisabled:i,isUnavailable:u,isOutsideVisibleRange:r.compare(t.visibleRange.start)<0||r.compare(t.visibleRange.end)>0,isInvalid:p,formattedDate:k}}function vs(e,t){let n=Z({year:e.format?.year||`numeric`,era:e.format?.era||(t.focusedDate.calendar.identifier===`gregory`&&t.focusedDate.era===`BC`?`short`:void 0),calendar:t.focusedDate.calendar.identifier,timeZone:t.timeZone}),r=e.visibleYears||20,i=t.focusedDate.subtract({years:Math.floor(r/2)}),a=t.focusedDate.add({years:Math.ceil(r/2)-1});t.maxValue&&a.compare(t.maxValue)>0&&(a=U(t.maxValue),i=a.subtract({years:r-1})),t.minValue&&i.compare(t.minValue)<0&&(i=U(t.minValue),a=i.add({years:r-1}),t.maxValue&&a.compare(t.maxValue)>0&&(a=U(t.maxValue)));let o=[],s=i,c=0;for(;s.compare(a)<=0;)ft(s,t.focusedDate)&&(c=o.length),o.push({id:o.length,date:s,formatted:n.format(s.toDate(t.timeZone))}),s=s.add({years:1});let{locale:l}=F();return{"aria-label":(0,R.useMemo)(()=>new Intl.DisplayNames(l,{type:`dateTimeField`}).of(`year`),[l]),value:c,onChange:e=>{e!=null&&t.setFocusedDate(o[e].date)},items:o}}function ys(e,t){let n=(0,R.useMemo)(()=>{let n=t.visibleRange.start;return e.offset&&(n=n.add(e.offset)),n},[t.visibleRange.start,e.offset]),r=t.visibleDuration.days||t.visibleDuration.weeks,i=Z({day:e.format?.day||(r?`numeric`:void 0),month:e.format?.month||`long`,year:e.format?.year||`numeric`,era:e.format?.era||n&&n.calendar.identifier===`gregory`&&n.era===`BC`?`short`:void 0,calendar:t.visibleRange?.start.calendar.identifier,timeZone:t.timeZone});return(0,R.useMemo)(()=>{if(r)return i.formatRange(n.toDate(t.timeZone),t.visibleRange.end.toDate(t.timeZone));let e=n.calendar.getFormattableMonth?n.calendar.getFormattableMonth(n):n;return i.format(e.toDate(t.timeZone))},[i,r,n,t.timeZone,t.visibleRange.end])}function bs(e,t,n){let{commitBehavior:r=`select`,...i}=e,a=ms(i,t),o=(0,R.useRef)(!1),s=(0,R.useRef)(typeof window<`u`?window:null);g(s,`pointerdown`,e=>{o.current=e.width===0&&e.height===0});let c={clear:()=>t.clearSelection(),reset:()=>t.setAnchorDate(null),select:()=>t.commitSelection()};return g(s,`pointerup`,e=>{if(o.current){o.current=!1;return}if(t.setDragging(!1),!t.anchorDate)return;let i=e.target;n.current&&ee(n.current)&&(!ne(n.current,i)||!i.closest(`button, [role="button"]`))&&c[r]()}),a.calendarProps.onBlur=e=>{n.current&&(!e.relatedTarget||!ne(n.current,e.relatedTarget))&&t.anchorDate&&c[r]()},g(n,`touchmove`,e=>{t.isDragging&&e.preventDefault()},{passive:!1,capture:!0}),a}function xs(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function Ss(e,t,n,r,i){let a={};for(let e in t)a[e]=Math.floor(t[e]/2),a[e]>0&&t[e]%2==0&&a[e]--;return Ts(e,Cs(e,t,n).subtract(a),t,n,r,i)}function Cs(e,t,n,r,i){let a=e;return t.years?a=kt(e):t.months?a=Dt(e):(t.weeks||t.days&&t.days>7)&&(a=At(e,n)),Ts(e,a,t,n,r,i)}function ws(e,t,n,r,i){let a={...t};return a.days?a.days--:a.weeks?a.weeks--:a.months?a.months--:a.years&&a.years--,Ts(e,Cs(e,t,n).subtract(a),t,n,r,i)}function Ts(e,t,n,r,i,a){if(i&&e.compare(i)>=0){let e=Rt(t,Cs(U(i),n,r));e&&(t=e)}if(a&&e.compare(a)<=0){let e=Lt(t,ws(U(a),n,r));e&&(t=e)}return t}function Es(e,t,n){if(t){let n=Rt(e,U(t));n&&(e=n)}if(n){let t=Lt(e,U(n));t&&(e=t)}return e}function Ds(e,t,n){if(!n)return e;for(;e.compare(t)>=0&&n(e);)e=e.subtract({days:1});return e.compare(t)>=0?e:null}function Os(e,t){return e===t||e.days===t.days&&e.weeks===t.weeks&&e.months===t.months&&e.years===t.years}function ks(e){let t=(0,R.useMemo)(()=>new Y(e.locale),[e.locale]),n=(0,R.useMemo)(()=>t.resolvedOptions(),[t]),{locale:r,createCalendar:i,visibleDuration:a={months:1},minValue:o,maxValue:s,selectionAlignment:c,isDateUnavailable:l,pageBehavior:u=`visible`,selectionMode:d=`single`,firstDayOfWeek:f,weeksInMonth:p}=e,m=(0,R.useMemo)(()=>i(n.calendar),[i,n.calendar]),[h,g]=ce(e.value,e.defaultValue??null,e.onChange),_=(0,R.useMemo)(()=>Array.isArray(h)?h.map(e=>G(U(e),m)):h?G(U(h),m):null,[h,m]),v=(0,R.useMemo)(()=>{let e=Array.isArray(h)?h[0]:h;return e&&`timeZone`in e?e.timeZone:n.timeZone},[h,n.timeZone]),y=(0,R.useMemo)(()=>e.focusedValue?Es(G(U(e.focusedValue),m),o,s):void 0,[e.focusedValue,m,o,s]),b=(0,R.useMemo)(()=>e.defaultFocusedValue?Es(G(U(e.defaultFocusedValue),m),o,s):Es(_?Array.isArray(_)?_[0]:_:G(yt(v),m),o,s),[e.defaultFocusedValue,_,v,m,o,s]),[x,S]=ce(y,b,e.onFocusChange),C=()=>{switch(c){case`start`:return Cs(x,a,r,o,s);case`end`:return ws(x,a,r,o,s);default:return Ss(x,a,r,o,s)}},[w,T]=(0,R.useState)(C),[E,D]=(0,R.useState)(e.autoFocus||!1),[O,k]=(0,R.useState)(a);Os(a,O)||(k(a),T(C()));let A=(0,R.useMemo)(()=>{let e={...a};return e.days?e.days--:e.days=-1,w.add(e)},[w,a]),[ee,te]=(0,R.useState)(m);if(!mt(m,ee)){let e=G(x,m);T(Ss(e,a,r,o,s)),S(e),te(m)}xs(x,o,s)?S(Es(x,o,s)):x.compare(w)<0?T(ws(x,a,r,o,s)):x.compare(A)>0&&T(Cs(x,a,r,o,s));function j(e){e=Es(e,o,s),S(e)}function ne(e){let t=Ds(Es(e,o,s),w,l);if(!t)return null;let n=Array.isArray(h)?h[0]:h,r=G(t,n?.calendar||new z);return n&&`hour`in n?n.set(r):r}function M(t){if(!e.isDisabled&&!e.isReadOnly){if(t===null){g(d===`multiple`?[]:null);return}if(Array.isArray(t))g(t.map(ne).filter(Boolean));else{let e=ne(t);e&&g(e)}}}let re=(0,R.useMemo)(()=>_?Array.isArray(_)?_.some(e=>l?.(e)||xs(e,o,s)):l?.(_)||xs(_,o,s):!1,[_,l,o,s]),N=e.isInvalid||e.validationState===`invalid`||re,ie=N?`invalid`:null,P=(0,R.useMemo)(()=>u===`visible`?a:As(a),[u,a]);return{isDisabled:e.isDisabled??!1,isReadOnly:e.isReadOnly??!1,value:_,setValue:M,selectionMode:d,visibleDuration:a,visibleRange:{start:w,end:A},minValue:o,maxValue:s,focusedDate:x,timeZone:v,validationState:ie,isValueInvalid:N,setFocusedDate(e){j(e)},focusNextDay(){j(x.add({days:1}))},focusPreviousDay(){j(x.subtract({days:1}))},focusNextRow(){a.days?this.focusNextPage():(a.weeks||a.months||a.years)&&j(x.add({weeks:1}))},focusPreviousRow(){a.days?this.focusPreviousPage():(a.weeks||a.months||a.years)&&j(x.subtract({weeks:1}))},focusNextPage(){let e=w.add(P);S(Es(x.add(P),o,s)),T(Cs(Ts(x,e,P,r,o,s),P,r))},focusPreviousPage(){let e=w.subtract(P);S(Es(x.subtract(P),o,s)),T(Cs(Ts(x,e,P,r,o,s),P,r))},focusSectionStart(){a.days?j(w):a.weeks?j(At(x,r)):(a.months||a.years)&&j(Dt(x))},focusSectionEnd(){a.days?j(A):a.weeks?j(jt(x,r)):(a.months||a.years)&&j(Ot(x))},focusNextSection(e){if(!e&&!a.days){j(x.add(As(a)));return}a.days?this.focusNextPage():a.weeks?j(x.add({months:1})):(a.months||a.years)&&j(x.add({years:1}))},focusPreviousSection(e){if(!e&&!a.days){j(x.subtract(As(a)));return}a.days?this.focusPreviousPage():a.weeks?j(x.subtract({months:1})):(a.months||a.years)&&j(x.subtract({years:1}))},selectFocusedDate(){l&&l(x)||this.selectDate(x)},selectDate(t){if(!(e.isDisabled||e.isReadOnly)){if(d===`multiple`&&t!=null){let e=ne(t);if(!e)return;let n=[];Array.isArray(h)?n=h:h!=null&&(n=[h]);let r=n.findIndex(t=>B(t,e)),i=r>=0?n.slice(0,r).concat(n.slice(r+1)):[...n,e];g(i)}else M(t)}},isFocused:E,setFocused:D,isInvalid(e){return xs(e,o,s)},isSelected(e){return!_||this.isCellDisabled(e)||this.isCellUnavailable(e)?!1:Array.isArray(_)?_.some(t=>B(t,e)):B(e,_)},isCellFocused(e){return E&&x&&B(e,x)},isCellDisabled(t){return e.isDisabled||t.compare(w)<0||t.compare(A)>0||this.isInvalid(t)},isCellUnavailable(t){return e.isDateUnavailable?e.isDateUnavailable(t):!1},isPreviousVisibleRangeInvalid(){let e=w.subtract({days:1});return B(e,w)||this.isInvalid(e)},isNextVisibleRangeInvalid(){let e=A.add({days:1});return B(e,A)||this.isInvalid(e)},getDatesInWeek(e,t=w){let n=t.add({weeks:e}),i=[],o=a.days&&a.days<7?a.days:7;if(o===7){n=At(n,r,f);let e=_t(n,r,f);for(let t=0;t0&&(m=`start`)}let h=(0,R.useMemo)(()=>{let t=e.isDateUnavailable;if(t)return e=>t(e,f)},[e.isDateUnavailable,f]),g=(0,R.useCallback)(t=>t&&h&&!e.allowsNonContiguousRanges?{start:Ps(t,h,o,-1),end:Ps(t,h,o,1)}:null,[h,o,e.allowsNonContiguousRanges]),_=(0,R.useMemo)(()=>g(f),[g,f]),v=(0,R.useMemo)(()=>Rt(s,_?.start),[s,_]),y=(0,R.useMemo)(()=>Lt(c,_?.end),[c,_]),b=ks({...l,value:u&&u.start,createCalendar:i,locale:a,visibleDuration:o,minValue:v,maxValue:y,selectionAlignment:e.selectionAlignment||m,isDateUnavailable:h}),x=f?Ms(f,b.focusedDate):u&&Ms(u.start,u.end),S=t=>{if(e.isReadOnly)return;let n=Ds(Es(t,v,y),b.visibleRange.start,h);if(n){if(!f)p(n);else{let e=Ms(f,n);e&&d({start:Ns(e.start,u?.start),end:Ns(e.end,u?.end)}),p(null)}}},[C,w]=(0,R.useState)(!1),T=(0,R.useMemo)(()=>!u||f?!1:h&&(h(u.start)||h(u.end))?!0:xs(u.start,s,c)||xs(u.end,s,c),[h,u,f,s,c]),E=e.isInvalid||e.validationState===`invalid`||T,D=E?`invalid`:null;return{...b,value:u,setValue:d,anchorDate:f,setAnchorDate:p,highlightedRange:x,validationState:D,isValueInvalid:E,selectFocusedDate(){b.isCellUnavailable(b.focusedDate)||S(b.focusedDate)},commitSelection(){S(b.focusedDate)},selectDate:S,highlightDate(e){f&&b.setFocusedDate(e)},isSelected(e){return!!(x&&e.compare(x.start)>=0&&e.compare(x.end)<=0&&!b.isCellDisabled(e)&&!b.isCellUnavailable(e))},isInvalid(e){return b.isInvalid(e)||xs(e,_?.start,_?.end)},isDragging:C,setDragging:w,clearSelection(){p(null),d(null)},focusNearestAvailableDate(e){let t=g(e),n=e=>this.isInvalid(e)||xs(e,t?.start,t?.end),r=e.add({days:1});n(r)&&(r=e.subtract({days:1})),n(r)||(this.setFocusedDate(r),this.setFocused(!0))}}}function Ms(e,t){return!e||!t?null:(t.compare(e)<0&&([e,t]=[t,e]),{start:U(e),end:U(t)})}function Ns(e,t){return e=G(e,t?.calendar||new z),t&&`hour`in t?t.set(e):e}function Ps(e,t,n,r){let i=e.add({days:r}),a=e.subtract(n),o=e.add(n);for(;(r<0?i.compare(a)>=0:i.compare(o)<=0)&&!t(i);)i=i.add({days:r});if(t(i))return i.add({days:-r})}var Fs=(0,R.createContext)(null),Is=(0,R.createContext)(null),Ls=(0,R.createContext)(null),Rs=(0,R.createContext)(null),zs=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,Is);let{locale:n}=F(),r=js({...e,locale:n,createCalendar:e.createCalendar||Kr}),{calendarProps:i,prevButtonProps:o,nextButtonProps:s,errorMessageProps:c,title:l}=bs(e,r,t),u=k({...e,values:{state:r,isDisabled:e.isDisabled||!1,isInvalid:r.isValueInvalid},defaultClassName:`react-aria-RangeCalendar`}),f=I(e,{global:!0});return R.createElement(w.div,{...D(u,f,i),ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":r.isValueInvalid||void 0},R.createElement(x,{values:[[d,{slots:{previous:o,next:s}}],[ze,{"aria-hidden":!0,level:2,children:l}],[Rs,r],[Is,e],[p,{slots:{errorMessage:c}}]]},R.createElement(a,null,R.createElement(`h2`,null,i[`aria-label`])),u.children,R.createElement(a,null,R.createElement(`button`,{"aria-label":s[`aria-label`],disabled:s.isDisabled,onClick:()=>r.focusNextPage(),tabIndex:-1}))))}),Bs=(0,R.createContext)(null),Vs=(0,R.forwardRef)(function(e,t){let n=(0,R.useContext)(Ls),r=(0,R.useContext)(Rs),i=O(Fs),a=O(Is),o=n??r,s=o.visibleRange.start;e.offset&&(s=s.add(e.offset));let c=i?.firstDayOfWeek??a?.firstDayOfWeek,{gridProps:l,headerProps:u,weekDays:d,weeksInMonth:f}=hs({startDate:s,endDate:Ot(s),weekdayStyle:e.weekdayStyle,firstDayOfWeek:c},o),p=I(e,{global:!0});return R.createElement(Bs.Provider,{value:{headerProps:u,weekDays:d,startDate:s,weeksInMonth:f}},R.createElement(w.table,{render:e.render,...D(p,l),ref:t,style:e.style,cellPadding:0,className:e.className??`react-aria-CalendarGrid`},typeof e.children==`function`?R.createElement(R.Fragment,null,R.createElement(Us,null,e=>R.createElement(Gs,null,e)),R.createElement(qs,null,e.children)):e.children))});function Hs(e,t){let{children:n,style:r,className:i}=e,{headerProps:a,weekDays:o}=(0,R.useContext)(Bs),s=I(e,{global:!0});return R.createElement(w.thead,{render:e.render,...D(s,a),ref:t,style:r,className:i??`react-aria-CalendarGridHeader`},R.createElement(`tr`,null,o.map((e,t)=>R.cloneElement(n(e),{key:t}))))}var Us=(0,R.forwardRef)(Hs);function Ws(e,t){let{children:n,style:r,className:i}=e,a=I(e,{global:!0});return R.createElement(w.th,{render:e.render,...a,ref:t,style:r,className:i||`react-aria-CalendarHeaderCell`},n)}var Gs=(0,R.forwardRef)(Ws);function Ks(e,t){let{children:n,style:r,className:i}=e,a=(0,R.useContext)(Ls),o=(0,R.useContext)(Rs),s=a??o,{startDate:c,weeksInMonth:l}=(0,R.useContext)(Bs),u=I(e,{global:!0});return R.createElement(w.tbody,{render:e.render,...u,ref:t,style:r,className:i??`react-aria-CalendarGridBody`},[...Array(l).keys()].map(e=>R.createElement(`tr`,{key:e},s.getDatesInWeek(e,c).map((e,t)=>e?R.cloneElement(n(e),{key:t}):R.createElement(`td`,{key:t})))))}var qs=(0,R.forwardRef)(Ks),Js=(0,R.forwardRef)(function({date:e,...t},n){let r=(0,R.useContext)(Ls),i=(0,R.useContext)(Rs),a=r??i,{startDate:o}=(0,R.useContext)(Bs)??{startDate:a.visibleRange.start},s=a.visibleDuration.days||a.visibleDuration.weeks?!1:!dt(o,e),c=ht(e,a.timeZone),l=(0,R.useRef)(null),{cellProps:u,buttonProps:d,...f}=_s({date:e,isOutsideMonth:s},a,l),{hoverProps:p,isHovered:m}=pe({...t,isDisabled:f.isDisabled||f.isUnavailable}),{focusProps:h,isFocusVisible:g}=P();g&&=f.isFocused;let _=!1,v=!1;`highlightedRange`in a&&a.highlightedRange&&(_=B(e,a.highlightedRange.start),v=B(e,a.highlightedRange.end));let y=k({...t,defaultChildren:f.formattedDate,defaultClassName:`react-aria-CalendarCell`,values:{date:e,isHovered:m,isOutsideMonth:s,isFocusVisible:g,isSelectionStart:_,isSelectionEnd:v,isToday:c,...f}}),b={"data-focused":f.isFocused||void 0,"data-hovered":m||void 0,"data-pressed":f.isPressed||void 0,"data-unavailable":f.isUnavailable||void 0,"data-disabled":f.isDisabled||void 0,"data-focus-visible":g||void 0,"data-outside-visible-range":f.isOutsideVisibleRange||void 0,"data-outside-month":s||void 0,"data-selected":f.isSelected||void 0,"data-selection-start":_||void 0,"data-selection-end":v||void 0,"data-invalid":f.isInvalid||void 0,"data-today":c||void 0},x=I(t,{global:!0});return R.createElement(`td`,{...u,ref:n},R.createElement(w.div,{...D(x,d,h,p,b,y),ref:l}))}),Ys=(0,R.forwardRef)(function(e,t){let{offset:n,format:r,className:i=`react-aria-CalendarHeading`,...a}=e,o=R.useContext(Ls),s=R.useContext(Rs),c=ys({offset:n,format:r},o||s);return R.createElement(He,{...a,className:i,ref:t},c)});function Xs(e){return e&&e.__esModule?e.default:e}function Zs(e,t,n){let r=h(Xs(zi),`@react-aria/datepicker`),{isInvalid:i,validationErrors:a,validationDetails:o}=t.displayValidation,{labelProps:s,fieldProps:c,descriptionProps:l,errorMessageProps:u}=Me({...e,labelElementType:`span`,isInvalid:i,errorMessage:e.errorMessage||a}),d=c[`aria-labelledby`]||c.id,{locale:f}=F(),p=t.formatValue(f,{month:`long`}),m=p?r.format(`selectedRangeDescription`,{startDate:p.start,endDate:p.end}):``,g=Ue(m),_={"aria-label":r.format(`startDate`),"aria-labelledby":d},v={"aria-label":r.format(`endDate`),"aria-labelledby":d},y=le(),b=le(),x=Bi(t,n),S=[g[`aria-describedby`],c[`aria-describedby`]].filter(Boolean).join(` `)||void 0,C=(0,R.useMemo)(()=>de(n,{accept:e=>e.id!==y}),[n,y]),w={[Gi]:C,[Wi]:`presentation`,"aria-describedby":S,placeholderValue:e.placeholderValue,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,granularity:e.granularity,shouldForceLeadingZeros:e.shouldForceLeadingZeros,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isRequired:e.isRequired,validationBehavior:e.validationBehavior},T=I(e),E=(0,R.useRef)(!1),{focusWithinProps:O}=oe({...e,isDisabled:t.isOpen,onBlurWithin:t=>{let n=document.getElementById(b);ne(n,t.relatedTarget)||(E.current=!1,e.onBlur?.(t),e.onFocusChange?.(!1))},onFocusWithin:t=>{E.current||(E.current=!0,e.onFocus?.(t),e.onFocusChange?.(!0))}}),k=(0,R.useRef)(Se),A=(0,R.useRef)(Se);return{groupProps:D(T,x,c,g,O,{role:`group`,"aria-disabled":e.isDisabled||null,"aria-describedby":S,onKeyDown(n){t.isOpen||e.onKeyDown&&e.onKeyDown(n)},onKeyUp(n){t.isOpen||e.onKeyUp&&e.onKeyUp(n)}}),labelProps:{...s,onClick:()=>{C.focusFirst()}},buttonProps:{...g,id:y,"aria-haspopup":`dialog`,"aria-label":r.format(`calendar`),"aria-labelledby":`${y} ${d}`,"aria-describedby":S,"aria-expanded":t.isOpen,isDisabled:e.isDisabled||e.isReadOnly,onPress:()=>t.setOpen(!0)},dialogProps:{id:b,"aria-labelledby":`${y} ${d}`},startFieldProps:{..._,...w,value:t.value?.start??null,defaultValue:t.defaultValue?.start,onChange:e=>t.setDateTime(`start`,e),autoFocus:e.autoFocus,name:e.startName,form:e.form,[Ee]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){k.current=e,t.updateValidation(Ce(e,A.current))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},endFieldProps:{...v,...w,value:t.value?.end??null,defaultValue:t.defaultValue?.end,onChange:e=>t.setDateTime(`end`,e),name:e.endName,form:e.form,[Ee]:{realtimeValidation:t.realtimeValidation,displayValidation:t.displayValidation,updateValidation(e){A.current=e,t.updateValidation(Ce(k.current,e))},resetValidation:t.resetValidation,commitValidation:t.commitValidation}},descriptionProps:l,errorMessageProps:u,calendarProps:{autoFocus:!0,value:t.dateRange?.start&&t.dateRange.end?t.dateRange:null,onChange:t.setDateRange,minValue:e.minValue,maxValue:e.maxValue,isDisabled:e.isDisabled,isReadOnly:e.isReadOnly,isDateUnavailable:e.isDateUnavailable,allowsNonContiguousRanges:e.allowsNonContiguousRanges,defaultFocusedValue:t.dateRange?void 0:e.placeholderValue,isInvalid:t.isInvalid,errorMessage:typeof e.errorMessage==`function`?e.errorMessage(t.displayValidation):e.errorMessage||t.displayValidation.validationErrors.join(` `),firstDayOfWeek:e.firstDayOfWeek,pageBehavior:e.pageBehavior},isInvalid:i,validationErrors:a,validationDetails:o}}function Qs(e){let t=v(e),[n,r]=ce(e.value,e.defaultValue||null,e.onChange),[i]=(0,R.useState)(n),[a,o]=(0,R.useState)(()=>n||{start:null,end:null});n==null&&a.start&&a.end&&(a={start:null,end:null},o(a));let s=n||a,c=e=>{s=e||{start:null,end:null},o(s),$s(s)?r(s):r(null)},[l,u]=Ka(s?.start||s?.end||e.placeholderValue||null,e.granularity),d=l===`hour`||l===`minute`||l===`second`,f=e.shouldCloseOnSelect??!0,[p,m]=(0,R.useState)(null),[h,g]=(0,R.useState)(null);s&&$s(s)&&(p=s,`hour`in s.start&&(h=s));let _=(e,t)=>{c({start:`timeZone`in t.start?t.start.set(U(e.start)):W(e.start,t.start),end:`timeZone`in t.end?t.end.set(U(e.end)):W(e.end,t.end)}),m(null),g(null),D.commitValidation()},y=n=>{let r=typeof f==`function`?f():f;d?$s(n)&&(r||h?.start&&h?.end)?_(n,{start:h?.start||Ua(e.placeholderValue),end:h?.end||Ua(e.placeholderValue)}):m(n):$s(n)?(c(n),D.commitValidation()):m(n),r&&t.setOpen(!1)},b=e=>{$s(p)&&$s(e)?_(p,e):g(e)},x=s?.start?.calendar.identifier===`gregory`&&s.start.era===`BC`||s?.end?.calendar.identifier===`gregory`&&s.end.era===`BC`,S=(0,R.useMemo)(()=>({granularity:l,timeZone:u,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,shouldForceLeadingZeros:e.shouldForceLeadingZeros,showEra:x}),[l,e.hourCycle,e.shouldForceLeadingZeros,u,e.hideTimeZone,x]),{minValue:C,maxValue:w,isDateUnavailable:T}=e,E=(0,R.useMemo)(()=>za(s,C,w,T?e=>T(e,null):void 0,S),[s,C,w,T,S]),D=Oe({...e,value:n,name:(0,R.useMemo)(()=>[e.startName,e.endName].filter(e=>e!=null),[e.startName,e.endName]),builtinValidation:E}),O=D.displayValidation.isInvalid,k=e.validationState||(O?`invalid`:null);return{...D,value:s,defaultValue:e.defaultValue??i,setValue:c,dateRange:p,timeRange:h,granularity:l,hasTime:d,setDate(e,t){y(e===`start`?{start:t,end:p?.end??null}:{start:p?.start??null,end:t})},setTime(e,t){b(e===`start`?{start:t,end:h?.end??null}:{start:h?.start??null,end:t})},setDateTime(e,t){c(e===`start`?{start:t,end:s?.end??null}:{start:s?.start??null,end:t})},setDateRange:y,setTimeRange:b,...t,setOpen(n){!n&&!(s?.start&&s?.end)&&$s(p)&&d&&_(p,{start:h?.start||Ua(e.placeholderValue),end:h?.end||Ua(e.placeholderValue)}),t.setOpen(n)},validationState:k,isInvalid:O,formatValue(t,n){if(!s||!s.start||!s.end)return null;let r=`timeZone`in s.start?s.start.timeZone:void 0,i=e.granularity||(s.start&&`minute`in s.start?`minute`:`day`),a=`timeZone`in s.end?s.end.timeZone:void 0,o=e.granularity||(s.end&&`minute`in s.end?`minute`:`day`),c=Ha(n,{granularity:i,timeZone:r,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle,showEra:s.start.calendar.identifier===`gregory`&&s.start.era===`BC`||s.end.calendar.identifier===`gregory`&&s.end.era===`BC`}),l=s.start.toDate(r||`UTC`),u=s.end.toDate(a||`UTC`),d=new Y(t,c),f;if(r===a&&i===o&&s.start.compare(s.end)!==0){try{let e=d.formatRangeToParts(l,u),t=-1;for(let n=0;nt&&(r+=e[i].value);return{start:n,end:r}}catch{}f=d}else f=new Y(t,Ha(n,{granularity:o,timeZone:a,hideTimeZone:e.hideTimeZone,hourCycle:e.hourCycle}));return{start:d.format(l),end:f.format(u)}},getDateFormatter(e,t){return new Y(e,Ha({},{...S,...t}))}}}function $s(e){return e?.start!=null&&e.end!=null}var ec=(0,R.createContext)(null),tc=(0,R.createContext)(null),nc=[ke,d,xe,p],rc=(0,R.forwardRef)(function(e,t){[e,t]=se(e,t,ec);let{validationBehavior:n}=O(ve)||{},r=e.validationBehavior??n??`native`,i=Qs({...e,validationBehavior:r}),a=(0,R.useRef)(null),[o,s]=A(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:l,startFieldProps:u,endFieldProps:f,buttonProps:m,dialogProps:h,calendarProps:g,descriptionProps:_,errorMessageProps:v,...y}=Zs({...E(e),label:s,validationBehavior:r},i,a),{focusProps:b,isFocused:S,isFocusVisible:C}=P({within:!0}),T=k({...e,values:{state:i,isFocusWithin:S,isFocusVisible:C,isDisabled:e.isDisabled||!1,isInvalid:i.isInvalid,isOpen:i.isOpen,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-DateRangePicker`}),ee=I(e,{global:!0});return delete ee.id,R.createElement(x,{values:[[tc,i],[ke,{...c,ref:a,isInvalid:i.isInvalid}],[d,{...m,isPressed:i.isOpen}],[xe,{...l,ref:o,elementType:`span`}],[Is,g],[Ve,i],[Je,{trigger:`DateRangePicker`,triggerRef:a,placement:`bottom start`,clearContexts:nc}],[We,h],[oo,{slots:{start:u,end:f}}],[p,{slots:{description:_,errorMessage:v}}],[be,y]]},R.createElement(w.div,{...D(ee,T,b),ref:t,slot:e.slot||void 0,"data-focus-within":S||void 0,"data-invalid":i.isInvalid||void 0,"data-focus-visible":C||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-open":i.isOpen||void 0}))}),ic=(0,R.createContext)({triggerRef:{current:null}}),ac=({children:e,className:t,onOpenChange:n,...r})=>{let i=R.useMemo(()=>$e(),[]),a=(0,R.useRef)(null),[o,s]=R.useState(!1),c=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(!o)return;let e=e=>{!e.metaKey&&!e.ctrlKey&&!e.altKey&&(c.current=!0)};return window.addEventListener(`keydown`,e,!0),()=>{window.removeEventListener(`keydown`,e,!0)}},[o]);let l=e=>{s(e),!e&&c.current&&window.requestAnimationFrame(()=>{a.current?.focus()}),c.current=!1,n?.(e)};return(0,X.jsx)(ic,{value:{slots:i,triggerRef:a},children:(0,X.jsx)(rc,{"data-required":Le(r.isRequired),"data-slot":`date-range-picker`,...r,className:N(t,i?.base()),onOpenChange:l,children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})})};ac.displayName=`HeroUI.DateRangePicker`;var oc=({children:e,className:t,ref:n,...r})=>{let{slots:i,triggerRef:a}=(0,R.use)(ic),o=R.useCallback(e=>{a.current=e},[a]),s=j(o,n);return(0,X.jsx)(f,{ref:s,className:N(t,i?.trigger()),"data-slot":`date-range-picker-trigger`,...r,children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})};oc.displayName=`HeroUI.DateRangePicker.Trigger`;var sc=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(ic);return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(r?.triggerIndicator,t),"data-slot":`date-range-picker-trigger-indicator`,...n,children:e||(0,X.jsx)(y,{})})};sc.displayName=`HeroUI.DateRangePicker.TriggerIndicator`;var cc=({children:e=` - `,className:t,...n})=>{let{slots:r}=(0,R.use)(ic);return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(r?.rangeSeparator,t),"data-slot":`date-range-picker-range-separator`,...n,children:e})};cc.displayName=`HeroUI.DateRangePicker.RangeSeparator`;var lc=({children:e,className:t,placement:n=`bottom`,...r})=>{let{slots:i}=(0,R.use)(ic);return(0,X.jsx)(s,{value:{variant:`default`},children:(0,X.jsx)(Ge,{...r,className:N(t,i?.popover()),"data-slot":`date-range-picker-popover`,placement:n,children:e})})};lc.displayName=`HeroUI.DateRangePicker.Popover`;var uc=Object.assign(ac,{Root:ac,Trigger:oc,TriggerIndicator:sc,RangeSeparator:cc,Popover:lc});function dc({children:e,className:t,fullWidth:n,...r}){let i=R.useMemo(()=>tt({fullWidth:n}),[n]);return(0,X.jsx)(fo,{"data-required":Le(r.isRequired),"data-slot":`time-field`,...r,className:N(t,i),children:t=>(0,X.jsx)(X.Fragment,{children:typeof e==`function`?e(t):e})})}var fc=Object.assign(dc,{Root:dc,Group:vo,Input:bo,InputContainer:So,Segment:xo,Prefix:yo,Suffix:Co}),pc=(0,R.createContext)(null);function mc(){let e=(0,R.use)(pc);if(!e)throw Error(`useYearPicker must be used within a or component.`);return e}function hc(){let e=(0,R.use)(Ls),t=(0,R.use)(Rs),n=e??t;if(!n)throw Error(`useCalendarOrRangeState must be used within a or component.`);return n}function gc(e){switch(e){case`buddhist`:return 543;case`ethiopic`:case`ethioaa`:return-8;case`coptic`:return-284;case`hebrew`:return 3760;case`indian`:return-78;case`islamic-civil`:case`islamic-tbla`:case`islamic-umalqura`:return-579;case`persian`:return-600;default:return 0}}function _c(e,t){let n=[];if(!e||!t)return n;let r=kt(e);for(;r.compare(t)<=0;)n.push(r),r=kt(r.add({years:1}));return n}function vc(e,t,n,r=`short`,i=`UTC`){let a=new Intl.DateTimeFormat(t,{weekday:r,timeZone:i}),o=At(e,t,n),s=[],c=o;for(let e=0;e<7;e++){s.push(a.format(c.toDate(i)));let e=c.add({days:1});if(B(c,e))break;c=e}for(;s.length<7;)s.push(``);return s}function yc(e,t){let n=[],r=e;for(let e=0;e<7;e++){n.push(r.compare(t)>0?null:r);let e=r.add({days:1});if(B(r,e)){for(;n.length<7;)n.push(null);return n}r=e}return n}function bc(e,t,n,r){let i=[],a=At(e,n,r);for(i.push(yc(a,t)),a=a.add({weeks:1});a.compare(t)<=0;){i.push(yc(a,t));let e=a.add({weeks:1});if(B(a,e))break;a=e}return i}var xc=R.createContext(null);function Sc(){let e=R.use(xc);if(!e)throw Error(`CalendarYearPicker trigger components must be used within .`);return e}var Cc=({children:e,className:t,onKeyDown:n,onPress:r,...i})=>{let{isYearPickerOpen:a,setIsYearPickerOpen:o}=mc(),s=ys({},hc()),c=R.useMemo(()=>Xe(),[]),l=R.useCallback(()=>{o(!a)},[a,o]),u=e=>{n?.(e),!e.defaultPrevented&&e.key===`Escape`&&a&&(e.preventDefault(),o(!1))},d=R.useMemo(()=>({isOpen:a,monthYear:s,toggle:l}),[l,a,s]),p=R.useMemo(()=>({...d,slots:c}),[c,d]);return(0,X.jsx)(xc,{value:p,children:(0,X.jsx)(f,{"aria-expanded":a,"aria-label":`${s}, year selector`,className:N(t,c.trigger()),"data-open":a||void 0,"data-slot":`calendar-year-picker-trigger`,slot:null,onKeyDown:u,onPress:e=>{r?.(e),l()},...i,children:typeof e==`function`?e(d):e})})};Cc.displayName=`HeroUI.CalendarYearPicker.Trigger`;var wc=({children:e,className:t,format:n,offset:r,...i})=>{let{monthYear:a,slots:o,...s}=Sc(),c=hc(),l=ys({format:n,offset:r},c);return(0,X.jsx)(S.span,{className:L(o.triggerHeading,t),"data-slot":`calendar-year-picker-trigger-heading`,...i,children:typeof e==`function`?e({monthYear:a,...s}):e||l})};wc.displayName=`HeroUI.CalendarYearPicker.TriggerHeading`;var Tc=({children:e,className:t,...n})=>{let{monthYear:r,slots:i,...a}=Sc();return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(i.triggerIndicator,t),"data-slot":`calendar-year-picker-trigger-indicator`,...n,children:typeof e==`function`?e({monthYear:r,...a}):e||(0,X.jsx)(o,{height:`1em`,width:`1em`})})};Tc.displayName=`HeroUI.CalendarYearPicker.TriggerIndicator`;var Ec=R.createContext(null);function Dc(){let e=R.use(Ec);if(!e)throw Error(`CalendarYearPicker components must be used within .`);return e}var Oc=({children:e,className:t,format:n,onKeyDown:r,visibleYears:i,...a})=>{let{calendarGridSlot:o,calendarRef:s,isYearPickerOpen:c,setIsYearPickerOpen:l}=mc(),u=hc(),d=R.useRef(null),f=R.useMemo(()=>Xe(),[]),{"aria-label":p,items:m,onChange:h,value:g}=vs({format:n,visibleYears:R.useMemo(()=>i??(!u.minValue||!u.maxValue?20:_c(u.minValue,u.maxValue).length),[u.maxValue,u.minValue,i])},u),_=m.map(e=>`${e.id}:${e.date.year}`).join(`|`),v=m.map(e=>e.date.year),y=new Map(m.map(e=>[e.date.year,e])),b=m[g]?.date.year??u.focusedDate.year,x=R.useCallback(e=>y.get(e)?.formatted??String(e),[y]),[C,w]=R.useState(b),T=R.useRef(!1);R.useEffect(()=>{let e=d.current;if(!e)return;let t=s.current?.querySelector(`[data-slot='${o}']`);t&&(e.style.top=`${t.offsetTop}px`,e.style.height=`${t.offsetHeight}px`)},[o,s,u.focusedDate]);let E=R.useCallback(e=>{let t=d.current;if(!t)return;let n=t.querySelector(`[data-year='${e}']`);n&&n.focus()},[]);R.useEffect(()=>{let e=c&&!T.current;if(T.current=c,!e||v.length===0)return;let[t]=v;if(t==null)return;let n=v.includes(b)?b:t;w(n);let r=requestAnimationFrame(()=>{E(n)});return()=>{cancelAnimationFrame(r)}},[E,b,c,_,v.length]),R.useEffect(()=>{if(!c||v.length===0)return;let[e]=v;e!=null&&(v.includes(C)||w(e))},[C,c,_,v]);let D=R.useCallback(e=>{let t=y.get(e);t!=null&&(l(!1),h(t.id))},[y,h,l]),O=e=>{if(r?.(e),e.defaultPrevented)return;if(e.key===`Escape`&&c){e.preventDefault(),l(!1);return}if(!c||v.length===0)return;let t=v.indexOf(C);if(t===-1)return;let n=t;switch(e.key){case`ArrowRight`:n=Math.min(t+1,v.length-1);break;case`ArrowLeft`:n=Math.max(t-1,0);break;case`ArrowDown`:n=Math.min(t+3,v.length-1);break;case`ArrowUp`:n=Math.max(t-3,0);break;case`Home`:n=0;break;case`End`:n=v.length-1;break;default:return}if(n!==t){let t=v[n];if(t==null)return;e.preventDefault(),w(t),E(t)}},k=R.useMemo(()=>({activeYear:C,focusedYear:b,getFormattedYear:x,isYearPickerOpen:c,selectYear:D,setActiveYear:w,slots:f,years:v}),[C,b,x,D,c,f,v]);return(0,X.jsx)(Ec,{value:k,children:(0,X.jsx)(S.div,{ref:d,"aria-hidden":!c,"aria-label":p,className:L(f.yearGrid,t),"data-open":c||void 0,"data-slot":`calendar-year-picker-grid`,role:`listbox`,tabIndex:-1,onKeyDown:O,...a,children:e})})};Oc.displayName=`HeroUI.CalendarYearPicker.Grid`;var kc=({children:e})=>{let{focusedYear:t,getFormattedYear:n,isYearPickerOpen:r,selectYear:i,years:a}=Dc(),o=new Date().getFullYear();return(0,X.jsx)(X.Fragment,{children:a.map(a=>{let s=a===t,c={formattedYear:n(a),isCurrentYear:a===o,isOpen:r,isSelected:s,selectYear:()=>i(a),year:a};return(0,X.jsx)(R.Fragment,{children:typeof e==`function`?e(c):(0,X.jsx)(Ac,{year:a})},a)})})};kc.displayName=`HeroUI.CalendarYearPicker.GridBody`;var Ac=({children:e,className:t,excludeFromTabOrder:n,onFocus:r,onPress:i,year:a,...o})=>{let{activeYear:s,focusedYear:c,getFormattedYear:l,isYearPickerOpen:u,selectYear:d,setActiveYear:p,slots:m}=Dc(),h=a===c,g=a===s,_=l(a),v={formattedYear:_,isCurrentYear:a===new Date().getFullYear(),isOpen:u,isSelected:h,selectYear:()=>d(a),year:a};return(0,X.jsx)(f,{"aria-label":_,"aria-selected":h,className:N(t,m.yearCell()),"data-selected":h||void 0,"data-slot":`calendar-year-picker-year-cell`,"data-year":a,excludeFromTabOrder:n??!(u&&g),slot:null,onFocus:e=>{r?.(e),p(a)},onPress:e=>{i?.(e),d(a)},...o,children:typeof e==`function`?e(v):e||_})};Ac.displayName=`HeroUI.CalendarYearPicker.Cell`;function jc({children:e,className:t,"data-slot":n=`calendar-grid-body`,firstDayOfWeek:r,visibleRange:i}){let{locale:a}=F(),o=R.useMemo(()=>bc(i.start,i.end,a,r),[r,a,i.end,i.start]);return(0,X.jsx)(S.tbody,{className:t,"data-slot":n,children:o.map((t,n)=>(0,X.jsx)(`tr`,{children:t.map((t,n)=>t?R.cloneElement(e(t),{key:n}):(0,X.jsx)(`td`,{},n))},n))})}function Mc({children:e,className:t,"data-slot":n=`calendar-grid-header`,firstDayOfWeek:r,timeZone:i=`UTC`,visibleRange:a,weekdayStyle:o=`short`}){let{locale:s}=F(),c=R.useMemo(()=>vc(a.start,s,r,o,i),[r,s,i,a.start,o]);return(0,X.jsx)(S.thead,{"aria-hidden":!0,className:t,"data-slot":n,children:(0,X.jsx)(`tr`,{children:c.map((t,n)=>R.cloneElement(e(t),{key:n}))})})}var Q=(0,R.createContext)({});function Nc({children:e,className:t,defaultYearPickerOpen:n=!1,firstDayOfWeek:r,isYearPickerOpen:i,maxValue:a,minValue:o,onYearPickerOpenChange:s,visibleDuration:c,...l}){let u=c?.weeks!=null,d=c?.days!=null,f=c?.days,{locale:p}=F(),m=R.useMemo(()=>Ze(),[]),h=R.useRef(null),[g,_]=ce(i,n,s),v=R.useMemo(()=>{let e=new Y(p).resolvedOptions().calendar;return Kr(e)},[p]),y=R.useMemo(()=>gc(v.identifier),[v.identifier]),b=o??new q(v,1900+y,1,1),x=a??new q(v,2099+y,12,31);return(0,X.jsx)(pc,{value:{calendarGridSlot:`range-calendar-grid`,isYearPickerOpen:g,setIsYearPickerOpen:_,calendarRef:h},children:(0,X.jsx)(zs,{ref:h,"data-slot":`range-calendar`,firstDayOfWeek:r,maxValue:x,minValue:b,visibleDuration:c,...l,className:N(t,te(m.base(),u&&`range-calendar--week-view`,d&&`range-calendar--day-view`)),children:t=>(0,X.jsx)(Q,{value:{dayView:d&&f!=null?{days:f,firstDayOfWeek:r,timeZone:t.state.timeZone,visibleRange:t.state.visibleRange}:void 0,slots:m},children:typeof e==`function`?e(t):e})})})}Nc.displayName=`HeroUI.RangeCalendar`;var Pc=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(Q);return(0,X.jsx)(S.header,{className:L(r?.header,t),"data-slot":`range-calendar-header`,...n,children:e})};Pc.displayName=`HeroUI.RangeCalendar.Header`;var Fc=({className:e,...t})=>{let{slots:n}=(0,R.use)(Q);return(0,X.jsx)(Ys,{"data-slot":`range-calendar-heading`,...t,className:L(n?.heading,e)})};Fc.displayName=`HeroUI.RangeCalendar.Heading`;var Ic=({children:e,className:t,slot:n,...r})=>{let{slots:i}=(0,R.use)(Q);return(0,X.jsx)(f,{"data-slot":`range-calendar-nav-button`,slot:n,...r,className:N(t,i?.navButton()),children:e||(n===`previous`?(0,X.jsx)(u,{className:i?.navButtonIcon(),"data-slot":`range-calendar-nav-button-icon`}):(0,X.jsx)(o,{className:i?.navButtonIcon(),"data-slot":`range-calendar-nav-button-icon`}))})};Ic.displayName=`HeroUI.RangeCalendar.NavButton`;var Lc=({children:e,className:t,weekdayStyle:n=`short`,...r})=>{let i=(0,R.use)(Q),{dayView:a,slots:o}=i,s=R.useMemo(()=>({...i,dayView:a?{...a,weekdayStyle:n}:void 0}),[a,i,n]);return(0,X.jsx)(Q,{value:s,children:(0,X.jsx)(Vs,{"data-slot":`range-calendar-grid`,weekdayStyle:n,...r,className:L(o?.grid,t),children:e})})};Lc.displayName=`HeroUI.RangeCalendar.Grid`;var Rc=({children:e,className:t,...n})=>{let{dayView:r,slots:i}=(0,R.use)(Q);return r&&r.days>=7&&typeof e==`function`?(0,X.jsx)(Mc,{className:L(i?.gridHeader,t),"data-slot":`range-calendar-grid-header`,firstDayOfWeek:r.firstDayOfWeek,timeZone:r.timeZone,visibleRange:r.visibleRange,weekdayStyle:r.weekdayStyle,children:e}):(0,X.jsx)(Us,{"data-slot":`range-calendar-grid-header`,...n,className:L(i?.gridHeader,t),children:e})};Rc.displayName=`HeroUI.RangeCalendar.GridHeader`;var zc=({children:e,className:t,...n})=>{let{dayView:r,slots:i}=(0,R.use)(Q);return r&&r.days>=7&&typeof e==`function`?(0,X.jsx)(jc,{className:L(i?.gridBody,t),"data-slot":`range-calendar-grid-body`,firstDayOfWeek:r.firstDayOfWeek,visibleRange:r.visibleRange,children:e}):(0,X.jsx)(qs,{"data-slot":`range-calendar-grid-body`,...n,className:L(i?.gridBody,t),children:e})};zc.displayName=`HeroUI.RangeCalendar.GridBody`;var Bc=({className:e,...t})=>{let{slots:n}=(0,R.use)(Q);return(0,X.jsx)(Gs,{"data-slot":`range-calendar-header-cell`,...t,className:L(n?.headerCell,e)})};Bc.displayName=`HeroUI.RangeCalendar.HeaderCell`;var Vc=({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)(Q);return(0,X.jsx)(Js,{"data-slot":`range-calendar-cell`,...n,className:N(t,r?.cell()),children:t=>{let{formattedDate:n,isDisabled:r,isHovered:i,isPressed:a,isSelectionEnd:o,isSelectionStart:s}=t,c=typeof e==`function`?e(t):e||n;return(0,X.jsx)(`span`,{className:`range-calendar__cell-button`,"data-disabled":Le(r),"data-hovered":Le(i),"data-pressed":Le(a),"data-selected":Le(s||o),"data-slot":`range-calendar-cell-button`,children:c})}})};Vc.displayName=`HeroUI.RangeCalendar.Cell`;var Hc=({className:e,...t})=>{let{slots:n}=(0,R.use)(Q);return(0,X.jsx)(S.span,{"aria-hidden":`true`,className:L(n?.cellIndicator,e),"data-slot":`range-calendar-cell-indicator`,...t})};Hc.displayName=`HeroUI.RangeCalendar.CellIndicator`;var $=Object.assign(Nc,{Root:Nc,Header:Pc,Heading:Fc,NavButton:Ic,Grid:Lc,GridHeader:Rc,GridBody:zc,HeaderCell:Bc,Cell:Vc,CellIndicator:Hc,YearPickerTrigger:Cc,YearPickerTriggerHeading:wc,YearPickerTriggerIndicator:Tc,YearPickerGrid:Oc,YearPickerGridBody:kc,YearPickerCell:Ac});function Uc(e={}){let t=new URLSearchParams;e.dim?.length&&t.set(`dim`,e.dim.join(`,`)),e.limit!=null&&t.set(`limit`,String(e.limit)),e.hours!=null&&t.set(`hours`,String(e.hours)),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.api_key&&t.set(`api_key`,e.api_key);let n=t.toString()?`?${t}`:``;return Re(`/api/logs/stats${n}`)}function Wc(e={}){let t=new URLSearchParams;e.account&&t.set(`account`,e.account),e.api_key&&t.set(`api_key`,e.api_key),e.status&&t.set(`status`,e.status),e.stream!=null&&t.set(`stream`,e.stream?`1`:`0`),e.error_kind&&t.set(`error_kind`,e.error_kind),e.model&&t.set(`model`,e.model),e.provider&&t.set(`provider`,e.provider),e.id&&t.set(`id`,e.id),e.q&&t.set(`q`,e.q),e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString()?`?${t}`:``;return Re(`/api/logs/requests${n}`)}function Gc(e){return Re(`/api/logs/requests/${encodeURIComponent(e)}`)}function Kc(){return Re(`/api/logs/requests`,{method:`DELETE`})}function qc(e={}){let t=new URLSearchParams;e.after!=null&&t.set(`after`,String(e.after)),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset)),e.level&&t.set(`level`,e.level),e.q&&t.set(`q`,e.q),e.account&&t.set(`account`,e.account);let n=t.toString()?`?${t}`:``;return Re(`/api/logs/runtime${n}`)}function Jc(e,t=!1){if(!e)return;let n=e.toDate(Tt());if(Number.isFinite(n.getTime()))return t&&n.setSeconds(59,999),n.toISOString()}function Yc(e){if(!e)return null;let t=Date.parse(e);if(!Number.isFinite(t))return null;try{return W(An(new Date(t).toISOString()))}catch{return null}}function Xc({value:e,onChange:t,ariaLabel:n,fromLabel:r,toLabel:i,className:a}){return(0,X.jsx)(uc,{className:a,granularity:`minute`,hourCycle:24,shouldForceLeadingZeros:!0,value:e,onChange:e=>t(e),"aria-label":n,children:({state:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(To.Group,{className:`w-full min-w-0`,variant:`secondary`,children:[(0,X.jsx)(To.Input,{className:`min-w-0`,slot:`start`,"aria-label":r,children:e=>(0,X.jsx)(To.Segment,{segment:e})}),(0,X.jsx)(uc.RangeSeparator,{}),(0,X.jsx)(To.Input,{className:`min-w-0`,slot:`end`,"aria-label":i,children:e=>(0,X.jsx)(To.Segment,{segment:e})}),(0,X.jsx)(To.Suffix,{children:(0,X.jsx)(uc.Trigger,{children:(0,X.jsx)(uc.TriggerIndicator,{})})})]}),(0,X.jsxs)(uc.Popover,{className:`flex w-[20.5rem] max-w-[calc(100vw-2rem)] flex-col gap-3 p-3`,children:[(0,X.jsxs)($,{"aria-label":n,children:[(0,X.jsxs)($.Header,{children:[(0,X.jsxs)($.YearPickerTrigger,{children:[(0,X.jsx)($.YearPickerTriggerHeading,{}),(0,X.jsx)($.YearPickerTriggerIndicator,{})]}),(0,X.jsx)($.NavButton,{slot:`previous`}),(0,X.jsx)($.NavButton,{slot:`next`})]}),(0,X.jsxs)($.Grid,{children:[(0,X.jsx)($.GridHeader,{children:e=>(0,X.jsx)($.HeaderCell,{children:e})}),(0,X.jsx)($.GridBody,{children:e=>(0,X.jsx)($.Cell,{date:e})})]}),(0,X.jsx)($.YearPickerGrid,{children:(0,X.jsx)($.YearPickerGridBody,{children:({year:e})=>(0,X.jsx)($.YearPickerCell,{year:e})})})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(De,{className:`text-xs`,children:r}),(0,X.jsx)(fc,{"aria-label":r,granularity:`minute`,hourCycle:24,value:e.timeRange?.start??null,onChange:t=>e.setTimeRange({start:t,end:e.timeRange?.end}),children:(0,X.jsx)(fc.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,X.jsx)(fc.Input,{children:e=>(0,X.jsx)(fc.Segment,{segment:e})})})})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(De,{className:`text-xs`,children:i}),(0,X.jsx)(fc,{"aria-label":i,granularity:`minute`,hourCycle:24,value:e.timeRange?.end??null,onChange:t=>e.setTimeRange({start:e.timeRange?.start,end:t}),children:(0,X.jsx)(fc.Group,{className:`w-[7.5rem]`,variant:`secondary`,children:(0,X.jsx)(fc.Input,{children:e=>(0,X.jsx)(fc.Segment,{segment:e})})})})]})]})]})]})})}export{Gc as a,qc as c,Kc as i,Jc as n,Wc as o,Yc as r,Uc as s,Xc as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/TrafficChart-JowzXflw.js b/internal/webui/static/assets/TrafficChart-CkXe7Bus.js similarity index 99% rename from internal/webui/static/assets/TrafficChart-JowzXflw.js rename to internal/webui/static/assets/TrafficChart-CkXe7Bus.js index 52a55e8eb..1bf6b7e44 100644 --- a/internal/webui/static/assets/TrafficChart-JowzXflw.js +++ b/internal/webui/static/assets/TrafficChart-CkXe7Bus.js @@ -1 +1 @@ -import{a as e,c as t,n,r}from"./shim-mfK0Rmj6.js";import{i,s as a}from"./format-FfdyoNtB.js";import{t as o}from"./gsap-DWxn8li7.js";import{$ as s,A as c,At as l,B as u,Bt as d,C as f,D as p,Dt as m,E as h,F as g,Ft as _,M as v,Mn as y,N as b,Nn as x,Nt as S,O as C,P as w,Pt as T,Q as E,R as D,Rt as O,S as k,T as ee,Tn as A,Tt as te,_ as ne,_t as j,a as re,bn as M,c as N,ct as ie,f as ae,g as oe,gn as P,h as se,j as ce,jn as F,k as le,kt as ue,lt as de,m as fe,mt as pe,n as me,o as he,p as ge,r as _e,rt as ve,s as ye,tt as be,vt as xe,w as Se,wn as Ce,xn as I,xt as we,yn as L,zt as Te}from"./AreaChart-BDsZfavt.js";import{i as Ee,n as De,r as Oe,t as ke}from"./XAxis-D-mwlVQJ.js";import{t as Ae}from"./FilterToggle-BoD7X2r2.js";import{t as je}from"./OverviewPage-Bx7MkU6l.js";var Me=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}},R=t(e());function Ne(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 z(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 Me({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:se(f,p)},Re=(e,t)=>R.isValidElement(e)?R.cloneElement(e,t):typeof e==`function`?e(t):R.createElement(Ee,B({},t,{className:`recharts-reference-area-rect`}));function ze(e){var t=Te();return(0,R.useEffect)(()=>(t(ge(e)),()=>{t(fe(e))})),null}function Be(e){var t=e.x1,n=e.x2,i=e.y1,a=e.y2,o=e.className,s=e.shape,c=e.xAxisId,l=e.yAxisId,f=ae(),p=m(),h=d(e=>E(e,`xAxis`,c,p)),_=d(e=>E(e,`yAxis`,l,p));if(h==null||_==null)return null;var v=I(t),b=I(n),x=I(i),S=I(a);if(!v&&!b&&!x&&!S&&!s)return null;var C=Le(v,b,x,S,h,_,e);if(!C&&!s)return null;var T=e.ifOverflow===`hidden`?`url(#${f})`:void 0;return R.createElement(u,{zIndex:e.zIndex},R.createElement(F,{className:r(`recharts-reference-area`,o)},Re(s,z(z({clipPath:T},y(e)),C)),C!=null&&R.createElement(w,B({},C,{lowerWidth:C.width,upperWidth:C.width}),R.createElement(g,{label:e.label}),e.children)))}var Ve={ifOverflow:`discard`,xAxisId:0,yAxisId:0,radius:0,fill:`#ccc`,label:!1,fillOpacity:.5,stroke:`none`,strokeWidth:1,zIndex:ie.area};function V(e){var t=P(e,Ve);return R.createElement(R.Fragment,null,R.createElement(ze,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2}),R.createElement(Be,t))}V.displayName=`ReferenceArea`;var He=[`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[...qe(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function Ye(e,t,n){return e?Je(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):U(t,n)}function Xe(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=Ue(e,He),a=r??!1,o;if(t!=null){var s=i.pathRef;o=Ye(n,Ge(s?.current??null),t)}else n!=null&&(o=String(n));return R.createElement(pe,H({},i,{connectNulls:a,strokeDasharray:o}))}function Ze(e){var t=(0,R.useRef)(0),n=(0,R.useRef)(0),r=(0,R.useRef)(!1),i=(0,R.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,R.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(A(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 $e(e,t){if(e==null)return{};var n,r,i=et(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function nt(e){var t=e.children,n=$e(e,Qe);return R.createElement(tt.Provider,{value:n},t)}var W=(e,t,n,r)=>s(e,`xAxis`,t,r),G=(e,t,n,r)=>be(e,`xAxis`,t,r),K=(e,t,n,r)=>s(e,`yAxis`,n,r),q=(e,t,n,r)=>be(e,`yAxis`,n,r),rt=O([xe,W,K,G,q],(e,t,n,r,i)=>_(e,`xAxis`)?ue(t,r,!1):ue(n,i,!1)),it=(e,t,n,r,i)=>i;function at(e){return e.type===`line`}var ot=O([ve,it],(e,t)=>e.filter(at).find(e=>e.id===t)),st=O([xe,W,K,G,q,ot,rt,de],(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 Ot({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),ct=[`id`],lt=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],ut=[`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 Z={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=_t(e),r=[];for(var i of e)if(i.status===`matched`)r.push(X(X({},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(X(X({},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(X(X({},i.prev),{},{x:L(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:p,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:Xe,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:ie.line,type:`linear`},vt=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:S(n,t),payload:e}]},yt=R.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:Ce,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:S(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return R.createElement(le,{tooltipEntrySettings:f})});function bt(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,ct),c=x(s);return R.createElement(k,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function xt(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,R.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return X(X({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return R.createElement(v,{value:t?i:void 0},n)}function St(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,l=e.visibleLength,u=i.type,d=i.layout,f=i.connectNulls,p=i.needClip,m=i.shape,h=i.strokeDasharray,g=Y(i,lt),_=X(X({},y(g)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:p?`url(#clipPath-${t})`:void 0,points:r,type:u,layout:d,connectNulls:f,strokeDasharray:h??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:l});return R.createElement(R.Fragment,null,r?.length>1&&R.createElement(c,{option:m,DefaultShape:Z.shape,shapeProps:_}),R.createElement(bt,{points:r,clipPathId:t,props:i}))}function Ct(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=gt(r.current),m=h(n.onAnimationStart,n.onAnimationEnd),g=m.isAnimating,_=m.handleAnimationStart,v=m.handleAnimationEnd,y=!g,x=Ze(a),S=(0,R.useCallback)(e=>e>0&&p>0,[p]);return R.createElement(xt,{points:a,showLabels:y},n.children,R.createElement(ee,{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:f},(e,i,a)=>{var o=g||i<1,s=o?x(i,p):null;return R.createElement(St,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),R.createElement(b,{label:n.label}))}function wt(e){var t=e.clipPathId,n=e.props,r=(0,R.useRef)(null),i=(0,R.useRef)(null);return R.createElement(Ct,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var Tt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:T(e.payload,t)}),Et=class extends R.Component{render(){var e=this.props,t=e.hide,n=e.dot,i=e.points,a=e.className,o=e.xAxisId,s=e.yAxisId,c=e.top,l=e.left,d=e.width,f=e.height,p=e.id,m=e.needClip,h=e.zIndex;if(t)return null;var g=r(`recharts-line`,a),_=p,v=he(n),y=v.r,b=v.strokeWidth,x=ce(n),S=y*2+b,C=m?`url(#clipPath-${x?``:`dots-`}${_})`:void 0;return R.createElement(u,{zIndex:h},R.createElement(F,{className:g},m&&R.createElement(`defs`,null,R.createElement(ye,{clipPathId:_,xAxisId:o,yAxisId:s}),!x&&R.createElement(`clipPath`,{id:`clipPath-dots-${_}`},R.createElement(`rect`,{x:l-S/2,y:c-S/2,width:d+S,height:f+S}))),R.createElement(nt,{xAxisId:o,yAxisId:s,data:i,dataPointFormatter:Tt,errorBarOffset:0},R.createElement(wt,{props:this.props,clipPathId:_}))),R.createElement(oe,{activeDot:this.props.activeDot,points:i,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:C}))}};function Dt(e){var t=P(e,Z),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,f=t.label,p=t.legendType,h=t.xAxisId,g=t.yAxisId,_=t.id,v=Y(t,ut),y=N(h,g).needClip,b=ne(),x=we(),S=m(),C=d(e=>st(e,h,g,S,_));if(x!==`horizontal`&&x!==`vertical`||C==null||b==null)return null;var w=b.height,T=b.width,E=b.x,D=b.y;return R.createElement(Et,J({},v,{id:_,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:f,legendType:p,xAxisId:h,yAxisId:g,points:C,layout:x,height:w,width:T,left:E,top:D,needClip:y}))}function Ot(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 u=T(e,o);if(t===`horizontal`)return{x:l({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(M(u)?null:r.scale.map(u))??null,value:u,payload:e};var d=M(u)?null:n.scale.map(u),f=l({axis:r,ticks:a,bandSize:s,entry:e,index:c});return d==null||f==null?null:{x:d,y:f,value:u,payload:e}}).filter(Boolean)}function kt(e){var t=P(e,Z),n=m();return R.createElement(Se,{id:t.id,type:`line`},e=>R.createElement(R.Fragment,null,R.createElement(C,{legendPayload:vt(t)}),R.createElement(yt,{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}),R.createElement(f,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),R.createElement(Dt,J({},t,{id:e}))))}var Q=R.memo(kt,j);Q.displayName=`Line`;var At=[`axis`],jt=(0,R.forwardRef)((e,t)=>R.createElement(me,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:At,tooltipPayloadSearcher:D,categoricalChartProps:e,ref:t})),Mt={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=n();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]})]})}var Lt=(0,R.memo)(function({series:e,lang:t,emptyLabel:n,okLabel:r,errorLabel:s,onSelectRange:c,selectHint:l,labels:u,initialMetric:d=`requests`}){let[f,p]=(0,R.useState)(d),[m,h]=(0,R.useState)(null),[g,_]=(0,R.useState)(null),v=(0,R.useRef)(!1),y=(0,R.useRef)(null),b=(0,R.useMemo)(()=>e.map(Ft),[e]),x=b[0],S=b[b.length-1],C=(x&&S?Date.parse(S.at)-Date.parse(x.at):0)>1728e5,w=u??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},T=f===`tokens`?[{key:`inputTokens`,label:w.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:w.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:w.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:f===`latency`?[{key:`p95`,label:w.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:w.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:r,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:s,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],E=e=>e==null?`—`:f===`latency`?a(e):i(e),D=f===`requests`?e=>e.requests:f===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,O=b.flatMap(e=>T.map(t=>Number(e[t.key]??0))),k=f===`requests`?Math.max(0,...b.map(e=>e.requests)):Math.max(0,...O),ee=Pt(k),A=b.some(e=>e.requests>0),ne=b.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,R.useLayoutEffect)(()=>{let e=y.current;if(!e||!A||v.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,v.current=!0;return}n=new MutationObserver(()=>{t||i()&&(t=!0,v.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[A,ne]);let j=b.length>1?Date.parse(b[1].at)-Date.parse(b[0].at):36e5,M=()=>{if(m&&g&&c){let e=Date.parse(m),t=Date.parse(g);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+j;c(new Date(n).toISOString(),new Date(r).toISOString())}}h(null),_(null)},N=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!e.length||!A?(0,$.jsx)(je,{emptyLabel:n}):(0,$.jsxs)(`div`,{ref:y,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(Ae,{value:f,onChange:e=>p(e),ariaLabel:w.requests,options:[{id:`requests`,label:w.requests},{id:`tokens`,label:w.tokens},{id:`latency`,label:w.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(te,{width:`100%`,height:`100%`,children:(0,$.jsxs)(jt,{data:b,margin:{top:8,right:8,bottom:0,left:0},style:c?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:c?e=>{let t=N(e);t&&(h(t),_(t))}:void 0,onMouseMove:c?e=>{if(!m)return;let t=N(e);t&&_(t)}:void 0,onMouseUp:c?M:void 0,onMouseLeave:c?()=>{h(null),_(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:T.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)(De,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(ke,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:Mt.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>Nt(e,C,t)}),(0,$.jsx)(_e,{width:f===`latency`?44:36,domain:[0,ee],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:Mt.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>f===`latency`?a(e):i(e)}),(0,$.jsx)(Oe,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(It,{daily:C,lang:t,specs:T,format:E,totalLabel:w.total,total:D})}),T.filter(e=>e.area).map(e=>(0,$.jsx)(re,{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)}`)),T.map(e=>(0,$.jsx)(Q,{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)}`)),m&&g?(0,$.jsx)(V,{x1:m,x2:g,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:T.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:[c&&l?(0,$.jsx)(`span`,{children:l}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[E(k),` peak`]})]})]})]})});export{Lt as TrafficChart}; \ No newline at end of file +import{a as e,c as t,n,r}from"./shim-mfK0Rmj6.js";import{i,s as a}from"./format-BAkFbjAh.js";import{t as o}from"./gsap-DWxn8li7.js";import{$ as s,A as c,At as l,B as u,Bt as d,C as f,D as p,Dt as m,E as h,F as g,Ft as _,M as v,Mn as y,N as b,Nn as x,Nt as S,O as C,P as w,Pt as T,Q as E,R as D,Rt as O,S as k,T as ee,Tn as A,Tt as te,_ as ne,_t as j,a as re,bn as M,c as N,ct as ie,f as ae,g as oe,gn as P,h as se,j as ce,jn as F,k as le,kt as ue,lt as de,m as fe,mt as pe,n as me,o as he,p as ge,r as _e,rt as ve,s as ye,tt as be,vt as xe,w as Se,wn as Ce,xn as I,xt as we,yn as L,zt as Te}from"./AreaChart-BDsZfavt.js";import{i as Ee,n as De,r as Oe,t as ke}from"./XAxis-D-mwlVQJ.js";import{t as Ae}from"./FilterToggle-CbYR8o3t.js";import{t as je}from"./OverviewPage-DuUzTTx-.js";var Me=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}},R=t(e());function Ne(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 z(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 Me({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:se(f,p)},Re=(e,t)=>R.isValidElement(e)?R.cloneElement(e,t):typeof e==`function`?e(t):R.createElement(Ee,B({},t,{className:`recharts-reference-area-rect`}));function ze(e){var t=Te();return(0,R.useEffect)(()=>(t(ge(e)),()=>{t(fe(e))})),null}function Be(e){var t=e.x1,n=e.x2,i=e.y1,a=e.y2,o=e.className,s=e.shape,c=e.xAxisId,l=e.yAxisId,f=ae(),p=m(),h=d(e=>E(e,`xAxis`,c,p)),_=d(e=>E(e,`yAxis`,l,p));if(h==null||_==null)return null;var v=I(t),b=I(n),x=I(i),S=I(a);if(!v&&!b&&!x&&!S&&!s)return null;var C=Le(v,b,x,S,h,_,e);if(!C&&!s)return null;var T=e.ifOverflow===`hidden`?`url(#${f})`:void 0;return R.createElement(u,{zIndex:e.zIndex},R.createElement(F,{className:r(`recharts-reference-area`,o)},Re(s,z(z({clipPath:T},y(e)),C)),C!=null&&R.createElement(w,B({},C,{lowerWidth:C.width,upperWidth:C.width}),R.createElement(g,{label:e.label}),e.children)))}var Ve={ifOverflow:`discard`,xAxisId:0,yAxisId:0,radius:0,fill:`#ccc`,label:!1,fillOpacity:.5,stroke:`none`,strokeWidth:1,zIndex:ie.area};function V(e){var t=P(e,Ve);return R.createElement(R.Fragment,null,R.createElement(ze,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2}),R.createElement(Be,t))}V.displayName=`ReferenceArea`;var He=[`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[...qe(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function Ye(e,t,n){return e?Je(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):U(t,n)}function Xe(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=Ue(e,He),a=r??!1,o;if(t!=null){var s=i.pathRef;o=Ye(n,Ge(s?.current??null),t)}else n!=null&&(o=String(n));return R.createElement(pe,H({},i,{connectNulls:a,strokeDasharray:o}))}function Ze(e){var t=(0,R.useRef)(0),n=(0,R.useRef)(0),r=(0,R.useRef)(!1),i=(0,R.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,R.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(A(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 $e(e,t){if(e==null)return{};var n,r,i=et(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function nt(e){var t=e.children,n=$e(e,Qe);return R.createElement(tt.Provider,{value:n},t)}var W=(e,t,n,r)=>s(e,`xAxis`,t,r),G=(e,t,n,r)=>be(e,`xAxis`,t,r),K=(e,t,n,r)=>s(e,`yAxis`,n,r),q=(e,t,n,r)=>be(e,`yAxis`,n,r),rt=O([xe,W,K,G,q],(e,t,n,r,i)=>_(e,`xAxis`)?ue(t,r,!1):ue(n,i,!1)),it=(e,t,n,r,i)=>i;function at(e){return e.type===`line`}var ot=O([ve,it],(e,t)=>e.filter(at).find(e=>e.id===t)),st=O([xe,W,K,G,q,ot,rt,de],(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 Ot({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}}),ct=[`id`],lt=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],ut=[`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 Z={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=_t(e),r=[];for(var i of e)if(i.status===`matched`)r.push(X(X({},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(X(X({},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(X(X({},i.prev),{},{x:L(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:p,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:Xe,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:ie.line,type:`linear`},vt=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:S(n,t),payload:e}]},yt=R.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:Ce,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:S(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return R.createElement(le,{tooltipEntrySettings:f})});function bt(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,ct),c=x(s);return R.createElement(k,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function xt(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,R.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return X(X({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return R.createElement(v,{value:t?i:void 0},n)}function St(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,l=e.visibleLength,u=i.type,d=i.layout,f=i.connectNulls,p=i.needClip,m=i.shape,h=i.strokeDasharray,g=Y(i,lt),_=X(X({},y(g)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:p?`url(#clipPath-${t})`:void 0,points:r,type:u,layout:d,connectNulls:f,strokeDasharray:h??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:l});return R.createElement(R.Fragment,null,r?.length>1&&R.createElement(c,{option:m,DefaultShape:Z.shape,shapeProps:_}),R.createElement(bt,{points:r,clipPathId:t,props:i}))}function Ct(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=gt(r.current),m=h(n.onAnimationStart,n.onAnimationEnd),g=m.isAnimating,_=m.handleAnimationStart,v=m.handleAnimationEnd,y=!g,x=Ze(a),S=(0,R.useCallback)(e=>e>0&&p>0,[p]);return R.createElement(xt,{points:a,showLabels:y},n.children,R.createElement(ee,{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:f},(e,i,a)=>{var o=g||i<1,s=o?x(i,p):null;return R.createElement(St,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),R.createElement(b,{label:n.label}))}function wt(e){var t=e.clipPathId,n=e.props,r=(0,R.useRef)(null),i=(0,R.useRef)(null);return R.createElement(Ct,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var Tt=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:T(e.payload,t)}),Et=class extends R.Component{render(){var e=this.props,t=e.hide,n=e.dot,i=e.points,a=e.className,o=e.xAxisId,s=e.yAxisId,c=e.top,l=e.left,d=e.width,f=e.height,p=e.id,m=e.needClip,h=e.zIndex;if(t)return null;var g=r(`recharts-line`,a),_=p,v=he(n),y=v.r,b=v.strokeWidth,x=ce(n),S=y*2+b,C=m?`url(#clipPath-${x?``:`dots-`}${_})`:void 0;return R.createElement(u,{zIndex:h},R.createElement(F,{className:g},m&&R.createElement(`defs`,null,R.createElement(ye,{clipPathId:_,xAxisId:o,yAxisId:s}),!x&&R.createElement(`clipPath`,{id:`clipPath-dots-${_}`},R.createElement(`rect`,{x:l-S/2,y:c-S/2,width:d+S,height:f+S}))),R.createElement(nt,{xAxisId:o,yAxisId:s,data:i,dataPointFormatter:Tt,errorBarOffset:0},R.createElement(wt,{props:this.props,clipPathId:_}))),R.createElement(oe,{activeDot:this.props.activeDot,points:i,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:C}))}};function Dt(e){var t=P(e,Z),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,f=t.label,p=t.legendType,h=t.xAxisId,g=t.yAxisId,_=t.id,v=Y(t,ut),y=N(h,g).needClip,b=ne(),x=we(),S=m(),C=d(e=>st(e,h,g,S,_));if(x!==`horizontal`&&x!==`vertical`||C==null||b==null)return null;var w=b.height,T=b.width,E=b.x,D=b.y;return R.createElement(Et,J({},v,{id:_,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:f,legendType:p,xAxisId:h,yAxisId:g,points:C,layout:x,height:w,width:T,left:E,top:D,needClip:y}))}function Ot(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 u=T(e,o);if(t===`horizontal`)return{x:l({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(M(u)?null:r.scale.map(u))??null,value:u,payload:e};var d=M(u)?null:n.scale.map(u),f=l({axis:r,ticks:a,bandSize:s,entry:e,index:c});return d==null||f==null?null:{x:d,y:f,value:u,payload:e}}).filter(Boolean)}function kt(e){var t=P(e,Z),n=m();return R.createElement(Se,{id:t.id,type:`line`},e=>R.createElement(R.Fragment,null,R.createElement(C,{legendPayload:vt(t)}),R.createElement(yt,{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}),R.createElement(f,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),R.createElement(Dt,J({},t,{id:e}))))}var Q=R.memo(kt,j);Q.displayName=`Line`;var At=[`axis`],jt=(0,R.forwardRef)((e,t)=>R.createElement(me,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:At,tooltipPayloadSearcher:D,categoricalChartProps:e,ref:t})),Mt={metric:24,title:18,section:15,body:13,xs:12,caption:12},$=n();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]})]})}var Lt=(0,R.memo)(function({series:e,lang:t,emptyLabel:n,okLabel:r,errorLabel:s,onSelectRange:c,selectHint:l,labels:u,initialMetric:d=`requests`}){let[f,p]=(0,R.useState)(d),[m,h]=(0,R.useState)(null),[g,_]=(0,R.useState)(null),v=(0,R.useRef)(!1),y=(0,R.useRef)(null),b=(0,R.useMemo)(()=>e.map(Ft),[e]),x=b[0],S=b[b.length-1],C=(x&&S?Date.parse(S.at)-Date.parse(x.at):0)>1728e5,w=u??{requests:`Requests`,tokens:`Tokens`,latency:`p95 latency`,input:`input`,output:`output`,cacheRead:`cache read`,p50:`p50`,p95:`p95`,total:`total`},T=f===`tokens`?[{key:`inputTokens`,label:w.input,color:`var(--foreground)`,area:!0,width:1.5,opacity:.75},{key:`outputTokens`,label:w.output,color:`var(--success)`,area:!0,width:1.5},{key:`cacheTokens`,label:w.cacheRead,color:`var(--muted)`,width:1.25,opacity:.8}]:f===`latency`?[{key:`p95`,label:w.p95,color:`var(--warning)`,area:!0,width:1.75},{key:`p50`,label:w.p50,color:`var(--muted)`,width:1.25,opacity:.85}]:[{key:`okCount`,label:r,color:`var(--success)`,area:!0,width:1.75},{key:`errorCount`,label:s,color:`var(--danger)`,area:!0,width:1.25,opacity:.7}],E=e=>e==null?`—`:f===`latency`?a(e):i(e),D=f===`requests`?e=>e.requests:f===`tokens`?e=>e.inputTokens+e.outputTokens:void 0,O=b.flatMap(e=>T.map(t=>Number(e[t.key]??0))),k=f===`requests`?Math.max(0,...b.map(e=>e.requests)):Math.max(0,...O),ee=Pt(k),A=b.some(e=>e.requests>0),ne=b.map(e=>`${e.at}:${e.requests}:${e.error}`).join(`|`);(0,R.useLayoutEffect)(()=>{let e=y.current;if(!e||!A||v.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,v.current=!0;return}n=new MutationObserver(()=>{t||i()&&(t=!0,v.current=!0,n?.disconnect())}),n.observe(e,{childList:!0,subtree:!0})},e);return()=>{n?.disconnect(),r.revert()}},[A,ne]);let j=b.length>1?Date.parse(b[1].at)-Date.parse(b[0].at):36e5,M=()=>{if(m&&g&&c){let e=Date.parse(m),t=Date.parse(g);if(Number.isFinite(e)&&Number.isFinite(t)){let n=Math.min(e,t),r=Math.max(e,t)+j;c(new Date(n).toISOString(),new Date(r).toISOString())}}h(null),_(null)},N=e=>{let t=e?.activeLabel;return t==null?null:String(t)};return!e.length||!A?(0,$.jsx)(je,{emptyLabel:n}):(0,$.jsxs)(`div`,{ref:y,className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex justify-end`,children:(0,$.jsx)(Ae,{value:f,onChange:e=>p(e),ariaLabel:w.requests,options:[{id:`requests`,label:w.requests},{id:`tokens`,label:w.tokens},{id:`latency`,label:w.latency}]})}),(0,$.jsx)(`div`,{className:`h-56 w-full`,children:(0,$.jsx)(te,{width:`100%`,height:`100%`,children:(0,$.jsxs)(jt,{data:b,margin:{top:8,right:8,bottom:0,left:0},style:c?{cursor:`crosshair`,userSelect:`none`}:void 0,onMouseDown:c?e=>{let t=N(e);t&&(h(t),_(t))}:void 0,onMouseMove:c?e=>{if(!m)return;let t=N(e);t&&_(t)}:void 0,onMouseUp:c?M:void 0,onMouseLeave:c?()=>{h(null),_(null)}:void 0,children:[(0,$.jsx)(`defs`,{children:T.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)(De,{vertical:!1,stroke:`var(--separator)`,strokeDasharray:`3 6`}),(0,$.jsx)(ke,{dataKey:`at`,tickLine:!1,axisLine:!1,minTickGap:28,tick:{fill:`var(--muted)`,fontSize:Mt.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>Nt(e,C,t)}),(0,$.jsx)(_e,{width:f===`latency`?44:36,domain:[0,ee],tickLine:!1,axisLine:!1,allowDecimals:!1,tick:{fill:`var(--muted)`,fontSize:Mt.caption,fontFamily:`var(--font-mono)`},tickFormatter:e=>f===`latency`?a(e):i(e)}),(0,$.jsx)(Oe,{cursor:{stroke:`var(--border)`,strokeDasharray:`3 3`},content:(0,$.jsx)(It,{daily:C,lang:t,specs:T,format:E,totalLabel:w.total,total:D})}),T.filter(e=>e.area).map(e=>(0,$.jsx)(re,{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)}`)),T.map(e=>(0,$.jsx)(Q,{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)}`)),m&&g?(0,$.jsx)(V,{x1:m,x2:g,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:T.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:[c&&l?(0,$.jsx)(`span`,{children:l}):null,(0,$.jsxs)(`span`,{className:`mono`,children:[E(k),` peak`]})]})]})]})});export{Lt as TrafficChart}; \ No newline at end of file diff --git a/internal/webui/static/assets/TrashSimple.es-CiBYahWn.js b/internal/webui/static/assets/TrashSimple.es-KG9lGXYp.js similarity index 96% rename from internal/webui/static/assets/TrashSimple.es-CiBYahWn.js rename to internal/webui/static/assets/TrashSimple.es-KG9lGXYp.js index a48aef260..678a419cb 100644 --- a/internal/webui/static/assets/TrashSimple.es-CiBYahWn.js +++ b/internal/webui/static/assets/TrashSimple.es-KG9lGXYp.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-XrvNxGvP.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM188,204H68V72H188ZM76,20A12,12,0,0,1,88,8h80a12,12,0,0,1,0,24H88A12,12,0,0,1,76,20Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M216,48H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM192,208H64V64H192ZM80,24a8,8,0,0,1,8-8h80a8,8,0,0,1,0,16H88A8,8,0,0,1,80,24Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,56a8,8,0,0,1-8,8h-8V208a16,16,0,0,1-16,16H64a16,16,0,0,1-16-16V64H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,56ZM88,32h80a8,8,0,0,0,0-16H88a8,8,0,0,0,0,16Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM82,24a6,6,0,0,1,6-6h80a6,6,0,0,1,0,12H88A6,6,0,0,1,82,24Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,48H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM192,208H64V64H192ZM80,24a8,8,0,0,1,8-8h80a8,8,0,0,1,0,16H88A8,8,0,0,1,80,24Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM84,24a4,4,0,0,1,4-4h80a4,4,0,0,1,0,8H88A4,4,0,0,1,84,24Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`TrashSimpleIcon`;var o=a;export{o as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-BAo1UrJW.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM188,204H68V72H188ZM76,20A12,12,0,0,1,88,8h80a12,12,0,0,1,0,24H88A12,12,0,0,1,76,20Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M216,48H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM192,208H64V64H192ZM80,24a8,8,0,0,1,8-8h80a8,8,0,0,1,0,16H88A8,8,0,0,1,80,24Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M224,56a8,8,0,0,1-8,8h-8V208a16,16,0,0,1-16,16H64a16,16,0,0,1-16-16V64H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,56ZM88,32h80a8,8,0,0,0,0-16H88a8,8,0,0,0,0,16Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM82,24a6,6,0,0,1,6-6h80a6,6,0,0,1,0,12H88A6,6,0,0,1,82,24Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,48H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM192,208H64V64H192ZM80,24a8,8,0,0,1,8-8h80a8,8,0,0,1,0,16H88A8,8,0,0,1,80,24Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM84,24a4,4,0,0,1,4-4h80a4,4,0,0,1,0,8H88A4,4,0,0,1,84,24Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`TrashSimpleIcon`;var o=a;export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/UpdateControls-DvS7Rp4P.js b/internal/webui/static/assets/UpdateControls-D6g_yL8s.js similarity index 97% rename from internal/webui/static/assets/UpdateControls-DvS7Rp4P.js rename to internal/webui/static/assets/UpdateControls-D6g_yL8s.js index d2f3460f5..0d9ea8ae7 100644 --- a/internal/webui/static/assets/UpdateControls-DvS7Rp4P.js +++ b/internal/webui/static/assets/UpdateControls-D6g_yL8s.js @@ -1,4 +1,4 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,r as i}from"./useI18n-XrvNxGvP.js";import{Kt as a}from"./index-CAlyInAP.js";var o=t(e(),1),s=/^(#{1,3})\s+(english|en|中文|chinese|zh|zh-cn|zh-hans)\s*$/i,c=/`([^`]+)`|\*\*([^*]+)\*\*|(?{let r=s.exec(e.trim());r&&n.push({index:t,title:r[2]})}),n.length?n.map((e,r)=>{let i=e.index+1,a=r+1{let r=s.exec(e.trim());r&&n.push({index:t,title:r[2]})}),n.length?n.map((e,r)=>{let i=e.index+1,a=r+1f(e,t));return i?i[1].trim():r[0]?.[1]?.trim()||n}function h(e){let t=[],n=0;for(let r of e.matchAll(c)){let i=r.index??0;i>n&&t.push({type:`text`,value:e.slice(n,i)}),r[1]==null?r[2]==null?r[3]==null?r[4]!=null&&r[5]!=null&&t.push({type:`link`,value:r[4],href:r[5]}):t.push({type:`em`,value:r[3]}):t.push({type:`strong`,value:r[2]}):t.push({type:`code`,value:r[1]}),n=i+r[0].length}return ni.map(i=>d[i]); -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./Stack.es-B6AMU1oV.js";import{n as i,r as a}from"./useI18n-XrvNxGvP.js";import{s as o}from"./TimeRangePicker-BqQpwy0D.js";import{t as s}from"./accordion-LzsgJWJ-.js";import{t as c}from"./PageAlert-BbN7e2aZ.js";import{n as l,t as u}from"./useApiKeyOptions-CX9uTy6L.js";import{n as d}from"./useToggle-55_Qx9vA.js";import{t as f}from"./EmptyPanel-Bs-jQMvG.js";import{n as p,t as m}from"./tabs-DrJPw_Nc.js";import{t as h}from"./table-iJwxYVe4.js";import{c as g,i as _,o as v,r as y,s as b,u as x}from"./format-FfdyoNtB.js";import{M as S,d as ee}from"./overview-ARhe2pSk.js";import{$t as C,At as w,Gt as te,N as T,Qt as E,Ut as D,Vt as O,Xt as ne,m as k,v as A,x as j}from"./index-CAlyInAP.js";import{t as M}from"./FilterToggle-BoD7X2r2.js";import{t as re}from"./ProviderMark-C49bIWJW.js";import{t as ie}from"./provider-BZvt2HHB.js";import{a as N}from"./account-DCxVMo7p.js";import{a as ae,i as oe,n as se,o as P,r as ce,t as le}from"./logsLink-CBayP8Zl.js";var F=t(e(),1),I=n(),ue=8,L=`__other__`;function de(e){if(e===L)return`var(--muted)`;let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;return`var(--chart-${t%8+1})`}function fe({parts:e,totalLabel:t,otherLabel:n,format:r,onOpen:i,onActiveChange:a}){let[o,s]=(0,F.useState)(null),c=(0,F.useRef)(new Map),l=(0,F.useRef)(new Map),u=[...e].filter(e=>e.value>0&&e.id).sort((e,t)=>t.value-e.value||e.label.localeCompare(t.label)),d=u.length<=ue?u:[...u.slice(0,7),{id:L,label:n,value:u.slice(7).reduce((e,t)=>e+t.value,0)}],f=d.reduce((e,t)=>e+t.value,0),p=d.map(e=>e.id).join(`|`),m=d.find(e=>e.id===o)??null,h=m?.value??f,_=e=>{s(e),a?.(e)};return(0,F.useLayoutEffect)(()=>{let e=new Map;c.current.forEach((t,n)=>e.set(n,t.offsetTop)),j()||e.forEach((e,t)=>{let n=l.current.get(t),r=c.current.get(t);r&&n!==void 0&&n!==e&&r.animate([{transform:`translateY(${n-e}px)`},{transform:`none`}],{duration:A.calm*1e3,easing:`cubic-bezier(0.22, 1, 0.36, 1)`})}),l.current=e},[p]),f<=0?null:(0,I.jsxs)(`div`,{className:`usage-share`,"data-hover":o?``:void 0,onMouseLeave:()=>_(null),onBlur:e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&_(null)},children:[(0,I.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,I.jsx)(`div`,{className:`min-w-0 truncate text-caption text-muted`,children:m?.label??t}),(0,I.jsx)(P,{value:h,kind:`compact`,className:`text-section font-semibold`})]}),(0,I.jsx)(`div`,{className:`usage-share__bar`,children:d.map(e=>(0,I.jsx)(`button`,{type:`button`,className:`usage-share__seg`,style:{flexGrow:e.value,background:de(e.id)},"data-active":o===e.id?``:void 0,"aria-label":`${e.label} ${r(e.value)}`,onMouseEnter:()=>_(e.id),onFocus:()=>_(e.id),onClick:e.id===L||!i?void 0:()=>i(e.id)},e.id))}),(0,I.jsx)(`ol`,{className:`usage-share__rows`,children:d.map(e=>{let t=e.id!==L&&i?()=>i(e.id):void 0;return(0,I.jsx)(`li`,{ref:t=>{t?c.current.set(e.id,t):c.current.delete(e.id)},className:`usage-share__row`,"data-active":o===e.id?``:void 0,children:(0,I.jsxs)(`button`,{type:`button`,className:`usage-share__hit`,onMouseEnter:()=>_(e.id),onFocus:()=>_(e.id),onClick:t,children:[(0,I.jsx)(`span`,{className:`usage-share__swatch`,style:{background:de(e.id)}}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body`,children:e.label}),(0,I.jsx)(`span`,{className:`mono text-caption text-muted`,children:g(e.value/f)}),(0,I.jsx)(`span`,{className:`mono inline-flex w-16 justify-end text-body`,children:(0,I.jsx)(P,{value:e.value,kind:`compact`})})]})},e.id)})})]})}var R=864e5,pe=8;function z(e){return`var(--chart-${e%pe+1})`}function B(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function V(e){return e<10?`0${e}`:String(e)}function H(e){let t=new Date(e);return`${t.getFullYear()}-${V(t.getMonth()+1)}-${V(t.getDate())}`}function me({accounts:e,t}){let[n,r]=(0,F.useState)(!1),{buckets:i,rows:o,todayStart:s,maxTotal:c}=(0,F.useMemo)(()=>{let t=B(new Date),n=new Map;e.forEach((e,t)=>n.set(e.id,z(t)));let r=new Map,i=[];for(let a of e){let e=a.quota?.packages??[],o=n.get(a.id)||z(0),s=a.name||a.id,c=e.filter(e=>(e.remain??0)>0&&(e.ends_at??0)>0),l=0,u=0,d=0,f=0;for(let e of c){let n=e.ends_at*1e3,i=e.remain??0;d+=i;let c=B(new Date(n)),u=c{let e=new Date(c);return{day:p,label:`${e.getMonth()+1}/${e.getDate()}`,ts:c,segments:[],total:0}})(),r.set(p,m));let h=m.segments.find(e=>e.id===a.id);h?h.remain+=i:m.segments.push({id:a.id,name:s,color:o,remain:i}),m.total+=i}if(l){let e=H(B(new Date(l)));for(let t of c)H(B(new Date(t.ends_at*1e3)))===e&&(u+=t.remain??0)}let p=l?Math.max(0,Math.round((B(new Date(l))-t)/R)):-1;i.push({id:a.id,name:s,color:o,remain:d,expiredRemain:f,soonest:l?Math.floor(l/1e3):0,soonestRemain:u,daysLeft:p,dailyBurn:l?u/Math.max(p,1):0,packs:c.length})}i.sort((e,t)=>e.soonest&&t.soonest?e.soonest-t.soonest:e.soonest?-1:t.soonest?1:t.remain-e.remain);let a=[...r.values()].sort((e,t)=>e.ts-t.ts);return{buckets:a,rows:i,todayStart:t,maxTotal:a.reduce((e,t)=>Math.max(e,t.total),0)}},[e]);if(!o.some(e=>e.packs>0))return null;let l=n?i:i.slice(0,8);return(0,I.jsxs)(d,{className:`overflow-hidden p-0`,"data-gsap-reveal":!0,children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-4 py-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:px-5`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`h3`,{className:`font-semibold`,children:t(`expiryDistTitle`)}),(0,I.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`expiryDistHint`)})]}),i.length>8?(0,I.jsx)(a,{size:`sm`,variant:`ghost`,onPress:()=>r(e=>!e),children:n?t(`expiryDistCollapse`):t(`expiryDistExpand`,{n:i.length})}):null]}),(0,I.jsxs)(`div`,{className:`space-y-4 p-4 sm:space-y-3 sm:p-5`,children:[(0,I.jsx)(`div`,{className:`space-y-2.5 sm:space-y-1.5`,children:l.map(e=>{let n=e.ts===s,r=c>0?e.total/c*100:0;return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:grid sm:grid-cols-[52px_minmax(0,1fr)_auto] sm:items-center sm:gap-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 sm:contents`,children:[(0,I.jsx)(`span`,{className:`mono text-caption ${e.day===`__expired__`?`font-semibold text-danger`:n?`font-semibold text-foreground`:`text-muted`}`,children:e.day===`__expired__`?t(`expiryDistExpired`):e.label}),(0,I.jsx)(`span`,{className:`mono text-caption text-foreground sm:hidden`,children:N(e.total)})]}),(0,I.jsx)(`div`,{className:`h-2.5 w-full rounded-full bg-surface-tertiary`,role:`img`,"aria-label":`${e.day} ${t(`expiryDistDayTotal`,{n:N(e.total)})}`,title:e.day,children:(0,I.jsx)(`div`,{className:`flex h-full items-stretch overflow-hidden rounded-full`,style:{width:`${r}%`},children:e.segments.map(t=>(0,I.jsx)(`span`,{style:{width:`${t.remain/e.total*100}%`,backgroundColor:t.color},title:`${t.name} · ${N(t.remain)}`},t.id))})}),(0,I.jsx)(`span`,{className:`mono hidden text-caption text-foreground sm:inline`,children:N(e.total)})]},e.day)})}),(0,I.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1.5 pt-1`,children:o.filter(e=>e.remain>0).map(e=>(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-caption text-muted`,children:[(0,I.jsx)(`i`,{className:`size-2 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,I.jsx)(`span`,{className:`max-w-[120px] truncate`,children:e.name})]},e.id))}),(0,I.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:o.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null,a=e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`,o=e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`;return(0,I.jsxs)(`article`,{className:`space-y-3 py-3.5`,children:[(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,I.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,I.jsx)(`span`,{className:`truncate text-body font-medium text-foreground`,children:e.name})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColSoonest`)}),(0,I.jsx)(`div`,{className:`mono text-body text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})]}),(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaysLeft`)}),(0,I.jsx)(`div`,{className:`mono text-body ${a}`,children:o})]}),(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColBatch`)}),(0,I.jsx)(`div`,{className:`mono text-body text-foreground`,children:N(e.soonestRemain)})]}),(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaily`)}),(0,I.jsx)(`div`,{className:`mono text-body text-foreground`,children:e.soonest?N(e.dailyBurn):`—`})]})]})]},e.id)})}),(0,I.jsx)(h,{"aria-label":t(`expiryDistTitle`),className:`hidden md:block`,children:(0,I.jsx)(h.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,I.jsxs)(h.Content,{className:`min-w-[32rem]`,children:[(0,I.jsxs)(h.Header,{children:[(0,I.jsx)(h.Column,{isRowHeader:!0,children:t(`expiryDistColAccount`)}),(0,I.jsx)(h.Column,{children:(0,I.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColSoonest`)})}),(0,I.jsx)(h.Column,{children:(0,I.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaysLeft`)})}),(0,I.jsx)(h.Column,{children:(0,I.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColBatch`)})}),(0,I.jsx)(h.Column,{children:(0,I.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaily`)})})]}),(0,I.jsx)(h.Body,{children:o.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null;return(0,I.jsxs)(h.Row,{children:[(0,I.jsx)(h.Cell,{children:(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,I.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,I.jsx)(`span`,{className:`max-w-[150px] truncate text-foreground`,children:e.name})]})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`div`,{className:`mono text-center text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`div`,{className:`mono text-center ${e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`}`,children:e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`div`,{className:`mono text-center text-foreground`,children:N(e.soonestRemain)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`div`,{className:`mono text-center text-foreground`,children:e.soonest?N(e.dailyBurn):`—`})})]},e.id)})})]})})}),(0,I.jsx)(`p`,{className:`text-caption text-muted`,children:t(`expiryDistFoot`)})]})]})}function U(){return S(`/api/usage/pricing`)}function he(e={}){let t=new URLSearchParams;e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.api_key&&t.set(`api_key`,e.api_key);let n=t.toString()?`?${t}`:``;return S(`/api/usage/cost${n}`)}var W=(0,F.lazy)(()=>C(()=>import(`./CostChart-CU1OvAf-.js`).then(e=>({default:e.CostChart})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])));function ge(){let e=new Date;return e.setHours(0,0,0,0),e.toISOString()}var G={window:{from:``,to:``,hours:24},currency:`CNY`,models:[],totals:{id:`total`,label:``,vendor:``,currency:`CNY`,requests:0,cache_hit:0,cache_miss:0,output:0,total_tokens:0,cost:0,cost_off_peak:0,cost_peak:0,peak_requests:0,credits:0,priced:!1},series:[]};function _e(e,t){if(!t)return`0%`;let n=e/t*100;return`${n>=10?n.toFixed(0):n.toFixed(1)}%`}function ve({apiKeyFilter:e=``}){let{t,lang:n}=i(),[r,o]=(0,F.useState)(`today`),[l,u]=(0,F.useState)(`credits`),[p,m]=(0,F.useState)(null),[g,b]=(0,F.useState)(null),[S,ee]=(0,F.useState)(!0),[C,w]=(0,F.useState)(``);(0,F.useEffect)(()=>{let e=!1;return U().then(t=>{e||b(t)}).catch(()=>{}),()=>{e=!0}},[]);let E=(0,F.useCallback)(async()=>{ee(!0);try{let t=await he({...r===`all`?{}:r===`today`?{from:ge()}:{from:new Date(Date.now()-Number(r)*3600*1e3).toISOString(),to:new Date().toISOString()},api_key:e||void 0});m(t),w(``)}catch(e){m(null),w(e instanceof Error?e.message:String(e))}finally{ee(!1)}},[r,e]);(0,F.useEffect)(()=>{E()},[E]);let D=p??G,O=D.totals,ne=O.requests>0&&D.models.length>0,A=D.models.filter(e=>e.priced),j=O.cost>0,re=[{label:t(`usageCredits`),value:v(O.credits),detail:t(`usageCreditsHint`)},{label:t(`usageTotalTokens`),value:_(O.total_tokens),detail:`${_(O.cache_hit)} / ${_(O.cache_miss)} / ${_(O.output)} ${t(`usageTokenSplitNote`)}`},{label:t(`usageRequests`),value:String(O.requests),detail:t(`usageModelCount`,{count:D.models.length})},{label:t(`usageCacheHitRate`),value:_e(O.cache_hit,O.cache_hit+O.cache_miss),detail:_(O.cache_hit)}],ie=l===`credits`?v(O.credits):l===`tokens`?_(O.total_tokens):y(O.cost);return(0,I.jsxs)(`div`,{className:`space-y-6`,children:[(0,I.jsxs)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-2`,children:[(0,I.jsx)(M,{value:r,onChange:e=>o(e),ariaLabel:t(`usageWindow`),options:[{id:`today`,label:t(`statsWindowToday`)},{id:`24`,label:t(`usageWindow24h`)},{id:`168`,label:t(`usageWindow7d`)},{id:`all`,label:t(`usageWindowTotal`)}]}),(0,I.jsxs)(a,{size:`sm`,variant:`secondary`,onPress:()=>void E(),isDisabled:S,children:[(0,I.jsx)(te,{size:14}),t(`refresh`)]})]}),C?(0,I.jsx)(c,{title:t(`failedStats`,{msg:C})}):null,(0,I.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-4`,children:re.map(e=>(0,I.jsxs)(d,{className:`gap-0 p-4`,children:[(0,I.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,I.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:S?(0,I.jsx)(k,{className:`h-5 w-16`}):e.value}),(0,I.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:S?(0,I.jsx)(k,{className:`h-3 w-24`}):e.detail||`\xA0`})]},e.label))}),(0,I.jsxs)(d,{className:`overflow-hidden p-0`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageChartTitle`)}),(0,I.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageChartHint`)})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,I.jsx)(M,{value:l,onChange:e=>u(e),ariaLabel:t(`usageChartMetric`),options:[{id:`credits`,label:t(`usageColCredits`)},{id:`tokens`,label:t(`usageColTokens`)}]}),(0,I.jsx)(T,{size:`sm`,variant:`soft`,color:`default`,children:ie})]})]}),(0,I.jsx)(`div`,{className:`p-5`,children:S?(0,I.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,I.jsx)(k,{className:`h-56 w-full`})}):ne?(0,I.jsx)(F.Suspense,{fallback:(0,I.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,I.jsx)(k,{className:`h-56 w-full`})}),children:(0,I.jsx)(W,{series:D.series,models:D.models,lang:n,emptyLabel:t(`usageChartEmpty`),totalLabel:t(`usageTotals`),metric:l})}):(0,I.jsx)(f,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})})]}),(0,I.jsxs)(d,{className:`overflow-hidden p-0`,children:[(0,I.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageBreakdownTitle`)}),(0,I.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageBreakdownHint`)})]})}),S?(0,I.jsx)(`div`,{className:`space-y-3 p-5`,children:[0,1,2].map(e=>(0,I.jsx)(k,{className:`h-9 w-full`},e))}):ne?(0,I.jsx)(h,{children:(0,I.jsx)(h.ScrollContainer,{children:(0,I.jsxs)(h.Content,{"aria-label":t(`usageBreakdownTitle`),children:[(0,I.jsxs)(h.Header,{children:[(0,I.jsx)(h.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,I.jsx)(h.Column,{children:t(`usageColRequests`)}),(0,I.jsx)(h.Column,{children:t(`usageColInputHit`)}),(0,I.jsx)(h.Column,{children:t(`usageColInputMiss`)}),(0,I.jsx)(h.Column,{children:t(`usageColOutput`)}),(0,I.jsx)(h.Column,{children:t(`usageColTokens`)}),(0,I.jsx)(h.Column,{children:t(`usageColCredits`)})]}),(0,I.jsxs)(h.Body,{children:[D.models.map(e=>(0,I.jsxs)(h.Row,{children:[(0,I.jsxs)(h.Cell,{children:[(0,I.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,I.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs`,children:e.requests})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs`,children:_(e.cache_hit)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs`,children:_(e.cache_miss)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs`,children:_(e.output)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs`,children:_(e.total_tokens)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:v(e.credits)})})]},e.id)),(0,I.jsxs)(h.Row,{children:[(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:O.requests})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:_(O.cache_hit)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:_(O.cache_miss)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:_(O.output)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:_(O.total_tokens)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:v(O.credits)})})]})]})]})})}):(0,I.jsx)(f,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})]}),(0,I.jsx)(s,{className:`rounded-xl bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:[],children:(0,I.jsxs)(s.Item,{id:`deepseek-estimate`,children:[(0,I.jsx)(s.Heading,{children:(0,I.jsxs)(s.Trigger,{className:`items-center gap-3 px-5 py-4 text-left`,children:[(0,I.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`span`,{className:`block font-semibold tracking-[-0.015em]`,children:t(`usageEstimateTitle`)}),(0,I.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted`,children:t(`usageEstimateHint`)})]}),j?(0,I.jsx)(T,{size:`sm`,variant:`soft`,color:`default`,children:y(O.cost)}):null,(0,I.jsx)(s.Indicator,{})]})}),(0,I.jsx)(s.Panel,{children:(0,I.jsxs)(s.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,I.jsx)(`p`,{className:`text-xs leading-6 text-muted`,children:t(`usageRenderNote`)}),j?(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,I.jsx)(`h4`,{className:`text-sm font-medium`,children:t(`usageEstimateChartTitle`)}),(0,I.jsx)(T,{size:`sm`,variant:`soft`,color:`default`,children:y(O.cost)})]}),(0,I.jsx)(F.Suspense,{fallback:(0,I.jsx)(k,{className:`h-56 w-full`}),children:(0,I.jsx)(W,{series:D.series,models:A.length?A:D.models,lang:n,emptyLabel:t(`usageEstimateChartEmpty`),totalLabel:t(`usageTotals`),metric:`cost`})})]}):null,A.length?(0,I.jsx)(h,{children:(0,I.jsx)(h.ScrollContainer,{children:(0,I.jsxs)(h.Content,{"aria-label":t(`usageEstimateTitle`),children:[(0,I.jsxs)(h.Header,{children:[(0,I.jsx)(h.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,I.jsx)(h.Column,{children:t(`usageColSplit`)}),(0,I.jsx)(h.Column,{children:t(`usageColCost`)})]}),(0,I.jsxs)(h.Body,{children:[A.map(e=>(0,I.jsxs)(h.Row,{children:[(0,I.jsxs)(h.Cell,{children:[(0,I.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,I.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,I.jsx)(h.Cell,{children:(0,I.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[y(e.cost_peak),` / `,y(e.cost_off_peak)]})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-sm font-semibold`,children:y(e.cost)})})]},e.id)),(0,I.jsxs)(h.Row,{children:[(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[y(O.cost_peak),` / `,y(O.cost_off_peak)]})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-sm font-semibold`,children:y(O.cost)})})]})]})]})})}):(0,I.jsx)(`p`,{className:`text-xs text-muted`,children:t(`usageEstimateChartEmpty`)}),(0,I.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h4`,{className:`mb-2 text-sm font-medium`,children:t(`usagePriceTitle`)}),(0,I.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:t(`usagePeakNote`)}),(0,I.jsxs)(`div`,{className:`divide-y divide-separator rounded-lg bg-background`,children:[(g?.models??[]).map(e=>(0,I.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,I.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,I.jsx)(`span`,{className:`mono text-[10px] text-muted`,children:e.currency})]}),(0,I.jsx)(`div`,{className:`mono mt-1 text-[10px] text-muted`,children:e.id}),(0,I.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 text-[11px]`,children:[(0,I.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,I.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandOff`)}),(0,I.jsxs)(`div`,{className:`mono mt-0.5`,children:[x(e.off_peak.cache_hit),` · `,x(e.off_peak.cache_miss),` · `,x(e.off_peak.output)]}),(0,I.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]}),(0,I.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,I.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandPeak`)}),(0,I.jsxs)(`div`,{className:`mono mt-0.5`,children:[x(e.peak.cache_hit),` · `,x(e.peak.cache_miss),` · `,x(e.peak.output)]}),(0,I.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]})]})]},e.id)),g?.models?.length?null:(0,I.jsx)(`div`,{className:`px-4 py-6 text-sm text-muted`,children:t(`usageEmpty`)})]})]}),(0,I.jsxs)(`div`,{className:`space-y-3 text-xs leading-6 text-muted`,children:[(0,I.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:t(`usageNoteTitle`)}),(0,I.jsx)(`p`,{children:t(`usageRetentionHint`)}),(0,I.jsx)(`p`,{children:t(`usagePeakNote`)}),D.unpriced?.length?(0,I.jsx)(`p`,{children:t(`usageUnpricedHint`,{models:D.unpriced.join(`, `)})}):null,g?.note?(0,I.jsx)(`p`,{className:`mono text-[10px]`,children:g.note}):null]})]})]})})]})})]})}var ye=500,be={model:`model`,account:`account`,provider:`provider`};function xe(e,t,n){let r=e.prompt_tokens??0,i=e.completion_tokens??0,a=e.key===`(unknown)`||e.key===`(unassigned)`||!e.key;return{key:e.key,label:n,count:e.count,success:e.count?e.ok/e.count:0,p95:e.latency_p95_ms??null,tokens:r+i,prompt:r,completion:i,credits:e.credits??0,cache_write:e.cache_write_tokens??0,cache_read:e.cache_read_tokens??0,filter:a?void 0:{[be[t]]:e.key}}}function Se(e,t,n){let r=n===`ascending`?1:-1;return[...e].sort((e,n)=>{if(t===`label`)return r*e.label.localeCompare(n.label);let i=e[t],a=n[t];return i==null&&a==null?0:i==null?1:a==null?-1:r*(i-a)||e.label.localeCompare(n.label)})}function Ce(e){return e?e>=1e3?_(e):String(Math.round(e*100)/100):`0`}function K(){let{t:e}=i(),t=ne(),[n,a]=E(),[s,f]=(0,F.useState)(`stats`),[v,y]=(0,F.useState)(`model`),[x,S]=(0,F.useState)(`today`),[C,te]=(0,F.useState)(null),[T,A]=(0,F.useState)(null),[j,M]=(0,F.useState)(!0),[N,ue]=(0,F.useState)(`loading`),[L,de]=(0,F.useState)(`model`),[R,pe]=(0,F.useState)(null),[z,B]=(0,F.useState)(``),[V,H]=(0,F.useState)([]),[U,he]=(0,F.useState)(`count`),[W,ge]=(0,F.useState)(`descending`),[G,_e]=(0,F.useState)(()=>new URLSearchParams(window.location.search).get(`api_key`)??``),{options:be}=u(),K=(0,F.useRef)(0),q=n.toString(),J=(0,F.useRef)(q);(0,F.useEffect)(()=>{q!==J.current&&(J.current=q,_e(new URLSearchParams(q).get(`api_key`)??``))},[q]);let Y=G?`api_key=${encodeURIComponent(G)}`:``;(0,F.useEffect)(()=>{Y!==J.current&&(J.current=Y,a(Y,{replace:!0}))},[Y,a]),(0,F.useEffect)(()=>{let e=!1;return ee(!1).then(t=>{e||H(t.data||[])}).catch(()=>{}),()=>{e=!0}},[]);let we=C?.start?.toString()??``,Te=C?.end?.toString()??``;(0,F.useEffect)(()=>{let e=oe(x,C);if(!e){M(!1);return}let t=++K.current,n=`${x}|${we}|${Te}`,r=v;o({...e,dim:[v],limit:ye,api_key:G||void 0}).then(e=>{t===K.current&&(A(e),B(``),ue(n),de(r))}).catch(e=>{t===K.current&&(A(null),B(e instanceof Error?e.message:String(e)))}).finally(()=>{t===K.current&&M(!1)})},[v,x,we,Te,G]);let X=(0,F.useMemo)(()=>{let t=new Map(V.map(e=>[e.id,e.name||e.id]));return Se(((v===`model`?T?.models:v===`account`?T?.accounts:T?.providers)??[]).map(n=>{let r=n.key===`(unknown)`?e(`statsUnknown`):n.key===`(unassigned)`?e(`statsUnassigned`):v===`account`?t.get(n.key)||n.key:v===`provider`?ie(n.key,e):n.key;return xe(n,v,r)}),U,W)},[T,v,V,U,W,e]),Z=T?.totals,Q=T?.tokens;function $(e){if(!T||!e.filter)return;let n={...e.filter,api_key:G||void 0};t(le(n,T.window.from,T.window.to))}let Ee=[{id:`label`,label:e(v===`model`?`logsColModel`:v===`account`?`logsColAccount`:`logsColProvider`)},{id:`count`,label:e(`usageColRequests`),numeric:!0},{id:`success`,label:e(`usageColSuccess`),numeric:!0},{id:`p95`,label:e(`statsLatencyP95`),numeric:!0},{id:`tokens`,label:e(`usageColTokens`),numeric:!0},{id:`cache_write`,label:e(`usageColCacheWrite`),numeric:!0},{id:`credits`,label:e(`usageColCredits`),numeric:!0}],De=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-1`,children:(0,I.jsx)(se,{value:x,onChange:S,custom:C,onCustomChange:te,onBusy:()=>{T||M(!0)},t:e})}),z?(0,I.jsx)(c,{title:e(`failedStats`,{msg:z})}):null,(0,I.jsx)(ae,{id:T?N:`loading`,children:(0,I.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-5`,children:[{label:e(`usageColRequests`),text:Z?_(Z.requests):`—`,detail:e(`statsWindowHint`,{window:e(ce[x])}),roll:Z?{value:Z.requests,kind:`compact`}:null},{label:e(`usageColSuccess`),text:Z?g(Z.success_rate):`—`,detail:Z?`${Z.ok} / ${Z.requests}`:``,roll:Z?{value:Z.success_rate,kind:`percent`}:null},{label:e(`usageColTokens`),text:Q?_(Q.total):`—`,detail:Q?`${_(Q.prompt)} / ${_(Q.completion)}`:``,roll:Q?{value:Q.total,kind:`compact`}:null},{label:e(`usageColCacheWrite`),text:Q?_(Q.cache_write??0):`—`,detail:Q?`${e(`chartCacheRead`)} ${_(Q.cache_read)}`:``,roll:Q?{value:Q.cache_write??0,kind:`compact`}:null},{label:e(`usageColCredits`),text:Z?Ce(Z.credits??0):`—`,detail:``,roll:null}].map(e=>(0,I.jsxs)(d,{className:`gap-0 p-4`,children:[(0,I.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,I.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:T?e.roll?(0,I.jsx)(P,{value:e.roll.value,kind:e.roll.kind}):e.text:(0,I.jsx)(k,{className:`h-5 w-16`})}),(0,I.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:T?e.detail||`\xA0`:(0,I.jsx)(k,{className:`h-3 w-24`})})]},e.label))})}),(0,I.jsxs)(d,{className:`overflow-hidden p-0`,children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-5 py-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between`,children:[(0,I.jsx)(m,{selectedKey:v,onSelectionChange:e=>y(String(e)),children:(0,I.jsx)(m.ListContainer,{className:`w-fit`,children:(0,I.jsxs)(m.List,{"aria-label":e(`usageTitle`),children:[(0,I.jsxs)(p,{id:`model`,className:`gap-1.5 whitespace-nowrap`,children:[(0,I.jsx)(m.Indicator,{className:`transition-none`}),(0,I.jsx)(O,{size:14}),e(`usageByModel`)]}),(0,I.jsxs)(p,{id:`account`,className:`gap-1.5 whitespace-nowrap`,children:[(0,I.jsx)(m.Indicator,{className:`transition-none`}),(0,I.jsx)(w,{size:14}),e(`usageByAccount`)]}),(0,I.jsxs)(p,{id:`provider`,className:`gap-1.5 whitespace-nowrap`,children:[(0,I.jsx)(m.Indicator,{className:`transition-none`}),(0,I.jsx)(r,{size:14}),e(`usageByProvider`)]})]})})}),(0,I.jsx)(`span`,{className:`mono text-caption text-muted`,children:T?e(`usageRowCount`,{count:X.length}):``})]}),X.some(e=>e.count>0)?(0,I.jsx)(`div`,{className:`border-b border-separator`,children:(0,I.jsx)(ae,{id:L,children:(0,I.jsx)(fe,{parts:X.map(e=>({id:e.key,label:e.label,value:e.count})),totalLabel:e(`usageColRequests`),otherLabel:e(`usageShareOther`),format:_,onOpen:e=>{let t=X.find(t=>t.key===e);t&&$(t)},onActiveChange:pe})})}):null,j&&!T?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,"aria-busy":`true`,children:Array.from({length:4},(e,t)=>(0,I.jsxs)(`div`,{className:`space-y-3 px-5 py-4`,children:[(0,I.jsx)(k,{className:`h-4 w-40`}),(0,I.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:Array.from({length:4},(e,t)=>(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsx)(k,{className:`h-3 w-12`}),(0,I.jsx)(k,{className:`h-4 w-16`})]},t))})]},t))}),(0,I.jsx)(`div`,{className:`hidden divide-y divide-separator md:block`,"aria-busy":`true`,children:Array.from({length:6},(e,t)=>(0,I.jsxs)(`div`,{className:`flex items-center gap-6 px-5 py-3.5`,children:[(0,I.jsx)(k,{className:`h-4 w-40`}),(0,I.jsx)(`div`,{className:`flex-1`}),Array.from({length:6},(e,t)=>(0,I.jsx)(k,{className:`h-4 w-14`},t))]},t))})]}):X.length===0?(0,I.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-10 text-body text-muted`,children:[(0,I.jsx)(D,{size:16}),e(`usageEmpty`)]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:X.map(t=>{let n=!!(t.filter&&T),r=[{label:e(`usageColRequests`),value:String(t.count)},{label:e(`usageColSuccess`),value:g(t.success),tone:t.success<.9?`text-warning`:void 0},{label:e(`statsLatencyP95`),value:b(t.p95)},{label:e(`usageColTokens`),value:_(t.tokens),sub:`${_(t.prompt)} / ${_(t.completion)}`},{label:e(`usageColCacheWrite`),value:_(t.cache_write)},{label:e(`usageColCredits`),value:Ce(t.credits)}];return(0,I.jsxs)(`article`,{className:`space-y-3 px-5 py-4 ${n?`cursor-pointer`:``} ${R===t.key?`usage-row--hot`:``}`,onClick:n?()=>$(t):void 0,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),$(t))}:void 0,role:n?`button`:void 0,tabIndex:n?0:void 0,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[v===`provider`&&t.filter?(0,I.jsx)(re,{provider:t.key,size:14}):null,(0,I.jsx)(`span`,{className:`truncate text-body font-medium`,children:t.label})]}),v===`account`&&t.label!==t.key?(0,I.jsx)(`div`,{className:`mono truncate text-caption text-muted`,children:t.key}):null,(0,I.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:r.map(e=>(0,I.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-caption text-muted`,children:e.label}),(0,I.jsx)(`div`,{className:`mono text-body ${e.tone??`text-foreground`}`,children:e.value}),`sub`in e&&e.sub?(0,I.jsx)(`div`,{className:`mono text-caption text-muted`,children:e.sub}):null]},e.label))})]},t.key)})}),(0,I.jsx)(h,{className:`usage-table hidden md:block`,children:(0,I.jsx)(h.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,I.jsxs)(h.Content,{"aria-label":e(`usageTitle`),className:`min-w-[48rem]`,sortDescriptor:{column:U,direction:W},onSortChange:e=>{he(String(e.column)),ge(e.direction)},children:[(0,I.jsx)(h.Header,{children:Ee.map(e=>(0,I.jsx)(h.Column,{id:e.id,allowsSorting:!0,isRowHeader:e.id===`label`,className:e.numeric?`text-right`:void 0,children:({sortDirection:t})=>(0,I.jsx)(h.SortableColumnHeader,{sortDirection:t,className:e.numeric?`justify-end`:void 0,children:e.label})},e.id))}),(0,I.jsx)(h.Body,{children:X.map(e=>(0,I.jsxs)(h.Row,{id:e.key,className:[e.filter&&T?`cursor-pointer`:``,R===e.key?`usage-row--hot`:``].filter(Boolean).join(` `)||void 0,onAction:e.filter&&T?()=>$(e):void 0,children:[(0,I.jsx)(h.Cell,{children:(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[v===`provider`&&e.filter?(0,I.jsx)(re,{provider:e.key,size:14}):null,(0,I.jsx)(`span`,{className:`truncate text-body font-medium`,children:e.label}),v===`account`&&e.label!==e.key?(0,I.jsx)(`span`,{className:`mono truncate text-caption text-muted`,children:e.key}):null]})}),(0,I.jsx)(h.Cell,{className:`mono text-right text-body`,children:e.count}),(0,I.jsx)(h.Cell,{className:`mono text-right text-body`,children:(0,I.jsx)(`span`,{className:e.success<.9?`text-warning`:void 0,children:g(e.success)})}),(0,I.jsx)(h.Cell,{className:`mono text-right text-body`,children:b(e.p95)}),(0,I.jsxs)(h.Cell,{className:`text-right`,children:[(0,I.jsx)(`div`,{className:`mono text-body`,children:_(e.tokens)}),(0,I.jsxs)(`div`,{className:`mono text-caption text-muted`,children:[_(e.prompt),` / `,_(e.completion)]})]}),(0,I.jsx)(h.Cell,{className:`mono text-right text-body`,children:_(e.cache_write)}),(0,I.jsx)(h.Cell,{className:`mono text-right text-body`,children:Ce(e.credits)})]},e.key))})]})})})]})]}),(0,I.jsx)(me,{accounts:V,t:e})]});return(0,I.jsxs)(`div`,{className:`space-y-6 sm:space-y-6`,children:[(0,I.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-1`,children:(0,I.jsx)(l,{ariaLabel:e(`logsColApiKey`),value:G,onChange:_e,options:be,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)})}),(0,I.jsxs)(m,{selectedKey:s,onSelectionChange:e=>f(String(e)),children:[(0,I.jsx)(m.ListContainer,{className:`w-fit`,children:(0,I.jsxs)(m.List,{"aria-label":e(`usageTitle`),children:[(0,I.jsxs)(p,{id:`stats`,className:`gap-1.5 whitespace-nowrap`,children:[(0,I.jsx)(m.Indicator,{className:`transition-none`}),e(`usageStatsTab`)]}),(0,I.jsxs)(p,{id:`cost`,className:`gap-1.5 whitespace-nowrap`,children:[(0,I.jsx)(m.Indicator,{className:`transition-none`}),e(`usageCostTab`)]})]})}),(0,I.jsx)(m.Panel,{id:`stats`,className:`space-y-6 pt-5`,children:De}),(0,I.jsx)(m.Panel,{id:`cost`,className:`pt-5`,children:(0,I.jsx)(ve,{apiKeyFilter:G})})]})]})}export{K as UsagePage}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CostChart-CuE2RBUk.js","assets/shim-mfK0Rmj6.js","assets/format-BAkFbjAh.js","assets/SharedElementTransition-BlCsXfb1.js","assets/label-DYYRLGoV.js","assets/useI18n-BAo1UrJW.js","assets/index-CWTBzWuK.js","assets/overview-ARhe2pSk.js","assets/gsap-DWxn8li7.js","assets/index-ORXBmquE.css","assets/AreaChart-BDsZfavt.js","assets/XAxis-D-mwlVQJ.js"])))=>i.map(i=>d[i]); +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{t as r}from"./Stack.es-BNgbK5ij.js";import{n as i,r as a}from"./useI18n-BAo1UrJW.js";import{s as o}from"./TimeRangePicker-C8MnQbdC.js";import{t as s}from"./accordion-DKpcSBXI.js";import{t as c}from"./PageAlert-4fxVtrfI.js";import{n as l,t as u}from"./useApiKeyOptions-Pz-FFnim.js";import{n as d}from"./useToggle-DpH7h_oD.js";import{t as f}from"./EmptyPanel-Bs-jQMvG.js";import{n as p,t as m}from"./tabs-WTDlSXp1.js";import{t as h}from"./table-B2nk0cjc.js";import{c as g,i as _,o as v,r as y,s as b,u as x}from"./format-BAkFbjAh.js";import{M as S,d as ee}from"./overview-ARhe2pSk.js";import{$t as C,At as w,Gt as te,N as T,Qt as E,Ut as D,Vt as O,Xt as ne,m as k,v as A,x as j}from"./index-CWTBzWuK.js";import{t as M}from"./FilterToggle-CbYR8o3t.js";import{t as re}from"./ProviderMark-C49bIWJW.js";import{t as ie}from"./provider-BZvt2HHB.js";import{a as N}from"./account-DCxVMo7p.js";import{a as ae,i as oe,n as se,o as P,r as ce,t as le}from"./logsLink-D4LXHY_f.js";var F=t(e(),1),I=n(),ue=8,L=`__other__`;function de(e){if(e===L)return`var(--muted)`;let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;return`var(--chart-${t%8+1})`}function fe({parts:e,totalLabel:t,otherLabel:n,format:r,onOpen:i,onActiveChange:a}){let[o,s]=(0,F.useState)(null),c=(0,F.useRef)(new Map),l=(0,F.useRef)(new Map),u=[...e].filter(e=>e.value>0&&e.id).sort((e,t)=>t.value-e.value||e.label.localeCompare(t.label)),d=u.length<=ue?u:[...u.slice(0,7),{id:L,label:n,value:u.slice(7).reduce((e,t)=>e+t.value,0)}],f=d.reduce((e,t)=>e+t.value,0),p=d.map(e=>e.id).join(`|`),m=d.find(e=>e.id===o)??null,h=m?.value??f,_=e=>{s(e),a?.(e)};return(0,F.useLayoutEffect)(()=>{let e=new Map;c.current.forEach((t,n)=>e.set(n,t.offsetTop)),j()||e.forEach((e,t)=>{let n=l.current.get(t),r=c.current.get(t);r&&n!==void 0&&n!==e&&r.animate([{transform:`translateY(${n-e}px)`},{transform:`none`}],{duration:A.calm*1e3,easing:`cubic-bezier(0.22, 1, 0.36, 1)`})}),l.current=e},[p]),f<=0?null:(0,I.jsxs)(`div`,{className:`usage-share`,"data-hover":o?``:void 0,onMouseLeave:()=>_(null),onBlur:e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&_(null)},children:[(0,I.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,I.jsx)(`div`,{className:`min-w-0 truncate text-caption text-muted`,children:m?.label??t}),(0,I.jsx)(P,{value:h,kind:`compact`,className:`text-section font-semibold`})]}),(0,I.jsx)(`div`,{className:`usage-share__bar`,children:d.map(e=>(0,I.jsx)(`button`,{type:`button`,className:`usage-share__seg`,style:{flexGrow:e.value,background:de(e.id)},"data-active":o===e.id?``:void 0,"aria-label":`${e.label} ${r(e.value)}`,onMouseEnter:()=>_(e.id),onFocus:()=>_(e.id),onClick:e.id===L||!i?void 0:()=>i(e.id)},e.id))}),(0,I.jsx)(`ol`,{className:`usage-share__rows`,children:d.map(e=>{let t=e.id!==L&&i?()=>i(e.id):void 0;return(0,I.jsx)(`li`,{ref:t=>{t?c.current.set(e.id,t):c.current.delete(e.id)},className:`usage-share__row`,"data-active":o===e.id?``:void 0,children:(0,I.jsxs)(`button`,{type:`button`,className:`usage-share__hit`,onMouseEnter:()=>_(e.id),onFocus:()=>_(e.id),onClick:t,children:[(0,I.jsx)(`span`,{className:`usage-share__swatch`,style:{background:de(e.id)}}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body`,children:e.label}),(0,I.jsx)(`span`,{className:`mono text-caption text-muted`,children:g(e.value/f)}),(0,I.jsx)(`span`,{className:`mono inline-flex w-16 justify-end text-body`,children:(0,I.jsx)(P,{value:e.value,kind:`compact`})})]})},e.id)})})]})}var R=864e5,pe=8;function z(e){return`var(--chart-${e%pe+1})`}function B(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function V(e){return e<10?`0${e}`:String(e)}function H(e){let t=new Date(e);return`${t.getFullYear()}-${V(t.getMonth()+1)}-${V(t.getDate())}`}function me({accounts:e,t}){let[n,r]=(0,F.useState)(!1),{buckets:i,rows:o,todayStart:s,maxTotal:c}=(0,F.useMemo)(()=>{let t=B(new Date),n=new Map;e.forEach((e,t)=>n.set(e.id,z(t)));let r=new Map,i=[];for(let a of e){let e=a.quota?.packages??[],o=n.get(a.id)||z(0),s=a.name||a.id,c=e.filter(e=>(e.remain??0)>0&&(e.ends_at??0)>0),l=0,u=0,d=0,f=0;for(let e of c){let n=e.ends_at*1e3,i=e.remain??0;d+=i;let c=B(new Date(n)),u=c{let e=new Date(c);return{day:p,label:`${e.getMonth()+1}/${e.getDate()}`,ts:c,segments:[],total:0}})(),r.set(p,m));let h=m.segments.find(e=>e.id===a.id);h?h.remain+=i:m.segments.push({id:a.id,name:s,color:o,remain:i}),m.total+=i}if(l){let e=H(B(new Date(l)));for(let t of c)H(B(new Date(t.ends_at*1e3)))===e&&(u+=t.remain??0)}let p=l?Math.max(0,Math.round((B(new Date(l))-t)/R)):-1;i.push({id:a.id,name:s,color:o,remain:d,expiredRemain:f,soonest:l?Math.floor(l/1e3):0,soonestRemain:u,daysLeft:p,dailyBurn:l?u/Math.max(p,1):0,packs:c.length})}i.sort((e,t)=>e.soonest&&t.soonest?e.soonest-t.soonest:e.soonest?-1:t.soonest?1:t.remain-e.remain);let a=[...r.values()].sort((e,t)=>e.ts-t.ts);return{buckets:a,rows:i,todayStart:t,maxTotal:a.reduce((e,t)=>Math.max(e,t.total),0)}},[e]);if(!o.some(e=>e.packs>0))return null;let l=n?i:i.slice(0,8);return(0,I.jsxs)(d,{className:`overflow-hidden p-0`,"data-gsap-reveal":!0,children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-4 py-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:px-5`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`h3`,{className:`font-semibold`,children:t(`expiryDistTitle`)}),(0,I.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`expiryDistHint`)})]}),i.length>8?(0,I.jsx)(a,{size:`sm`,variant:`ghost`,onPress:()=>r(e=>!e),children:n?t(`expiryDistCollapse`):t(`expiryDistExpand`,{n:i.length})}):null]}),(0,I.jsxs)(`div`,{className:`space-y-4 p-4 sm:space-y-3 sm:p-5`,children:[(0,I.jsx)(`div`,{className:`space-y-2.5 sm:space-y-1.5`,children:l.map(e=>{let n=e.ts===s,r=c>0?e.total/c*100:0;return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:grid sm:grid-cols-[52px_minmax(0,1fr)_auto] sm:items-center sm:gap-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 sm:contents`,children:[(0,I.jsx)(`span`,{className:`mono text-caption ${e.day===`__expired__`?`font-semibold text-danger`:n?`font-semibold text-foreground`:`text-muted`}`,children:e.day===`__expired__`?t(`expiryDistExpired`):e.label}),(0,I.jsx)(`span`,{className:`mono text-caption text-foreground sm:hidden`,children:N(e.total)})]}),(0,I.jsx)(`div`,{className:`h-2.5 w-full rounded-full bg-surface-tertiary`,role:`img`,"aria-label":`${e.day} ${t(`expiryDistDayTotal`,{n:N(e.total)})}`,title:e.day,children:(0,I.jsx)(`div`,{className:`flex h-full items-stretch overflow-hidden rounded-full`,style:{width:`${r}%`},children:e.segments.map(t=>(0,I.jsx)(`span`,{style:{width:`${t.remain/e.total*100}%`,backgroundColor:t.color},title:`${t.name} · ${N(t.remain)}`},t.id))})}),(0,I.jsx)(`span`,{className:`mono hidden text-caption text-foreground sm:inline`,children:N(e.total)})]},e.day)})}),(0,I.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1.5 pt-1`,children:o.filter(e=>e.remain>0).map(e=>(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-caption text-muted`,children:[(0,I.jsx)(`i`,{className:`size-2 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,I.jsx)(`span`,{className:`max-w-[120px] truncate`,children:e.name})]},e.id))}),(0,I.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:o.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null,a=e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`,o=e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`;return(0,I.jsxs)(`article`,{className:`space-y-3 py-3.5`,children:[(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,I.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,I.jsx)(`span`,{className:`truncate text-body font-medium text-foreground`,children:e.name})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColSoonest`)}),(0,I.jsx)(`div`,{className:`mono text-body text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})]}),(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaysLeft`)}),(0,I.jsx)(`div`,{className:`mono text-body ${a}`,children:o})]}),(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColBatch`)}),(0,I.jsx)(`div`,{className:`mono text-body text-foreground`,children:N(e.soonestRemain)})]}),(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-caption text-muted`,children:t(`expiryDistColDaily`)}),(0,I.jsx)(`div`,{className:`mono text-body text-foreground`,children:e.soonest?N(e.dailyBurn):`—`})]})]})]},e.id)})}),(0,I.jsx)(h,{"aria-label":t(`expiryDistTitle`),className:`hidden md:block`,children:(0,I.jsx)(h.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,I.jsxs)(h.Content,{className:`min-w-[32rem]`,children:[(0,I.jsxs)(h.Header,{children:[(0,I.jsx)(h.Column,{isRowHeader:!0,children:t(`expiryDistColAccount`)}),(0,I.jsx)(h.Column,{children:(0,I.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColSoonest`)})}),(0,I.jsx)(h.Column,{children:(0,I.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaysLeft`)})}),(0,I.jsx)(h.Column,{children:(0,I.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColBatch`)})}),(0,I.jsx)(h.Column,{children:(0,I.jsx)(`div`,{className:`text-center`,children:t(`expiryDistColDaily`)})})]}),(0,I.jsx)(h.Body,{children:o.filter(e=>e.packs>0).map(e=>{let n=e.daysLeft>=0&&e.daysLeft<=2,r=e.daysLeft>=0&&e.daysLeft<=7,i=e.soonest?new Date(e.soonest*1e3):null;return(0,I.jsxs)(h.Row,{children:[(0,I.jsx)(h.Cell,{children:(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,I.jsx)(`i`,{className:`size-2 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color}}),(0,I.jsx)(`span`,{className:`max-w-[150px] truncate text-foreground`,children:e.name})]})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`div`,{className:`mono text-center text-muted`,children:i?`${i.getMonth()+1}/${i.getDate()}`:`—`})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`div`,{className:`mono text-center ${e.expiredRemain>0&&e.daysLeft<0||n?`font-semibold text-danger`:r?`text-warning`:`text-muted`}`,children:e.daysLeft>=0?t(`expiryDistDays`,{n:e.daysLeft}):e.expiredRemain>0?t(`expiryDistExpired`):`—`})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`div`,{className:`mono text-center text-foreground`,children:N(e.soonestRemain)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`div`,{className:`mono text-center text-foreground`,children:e.soonest?N(e.dailyBurn):`—`})})]},e.id)})})]})})}),(0,I.jsx)(`p`,{className:`text-caption text-muted`,children:t(`expiryDistFoot`)})]})]})}function U(){return S(`/api/usage/pricing`)}function he(e={}){let t=new URLSearchParams;e.from&&t.set(`from`,e.from),e.to&&t.set(`to`,e.to),e.api_key&&t.set(`api_key`,e.api_key);let n=t.toString()?`?${t}`:``;return S(`/api/usage/cost${n}`)}var W=(0,F.lazy)(()=>C(()=>import(`./CostChart-CuE2RBUk.js`).then(e=>({default:e.CostChart})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])));function ge(){let e=new Date;return e.setHours(0,0,0,0),e.toISOString()}var G={window:{from:``,to:``,hours:24},currency:`CNY`,models:[],totals:{id:`total`,label:``,vendor:``,currency:`CNY`,requests:0,cache_hit:0,cache_miss:0,output:0,total_tokens:0,cost:0,cost_off_peak:0,cost_peak:0,peak_requests:0,credits:0,priced:!1},series:[]};function _e(e,t){if(!t)return`0%`;let n=e/t*100;return`${n>=10?n.toFixed(0):n.toFixed(1)}%`}function ve({apiKeyFilter:e=``}){let{t,lang:n}=i(),[r,o]=(0,F.useState)(`today`),[l,u]=(0,F.useState)(`credits`),[p,m]=(0,F.useState)(null),[g,b]=(0,F.useState)(null),[S,ee]=(0,F.useState)(!0),[C,w]=(0,F.useState)(``);(0,F.useEffect)(()=>{let e=!1;return U().then(t=>{e||b(t)}).catch(()=>{}),()=>{e=!0}},[]);let E=(0,F.useCallback)(async()=>{ee(!0);try{let t=await he({...r===`all`?{}:r===`today`?{from:ge()}:{from:new Date(Date.now()-Number(r)*3600*1e3).toISOString(),to:new Date().toISOString()},api_key:e||void 0});m(t),w(``)}catch(e){m(null),w(e instanceof Error?e.message:String(e))}finally{ee(!1)}},[r,e]);(0,F.useEffect)(()=>{E()},[E]);let D=p??G,O=D.totals,ne=O.requests>0&&D.models.length>0,A=D.models.filter(e=>e.priced),j=O.cost>0,re=[{label:t(`usageCredits`),value:v(O.credits),detail:t(`usageCreditsHint`)},{label:t(`usageTotalTokens`),value:_(O.total_tokens),detail:`${_(O.cache_hit)} / ${_(O.cache_miss)} / ${_(O.output)} ${t(`usageTokenSplitNote`)}`},{label:t(`usageRequests`),value:String(O.requests),detail:t(`usageModelCount`,{count:D.models.length})},{label:t(`usageCacheHitRate`),value:_e(O.cache_hit,O.cache_hit+O.cache_miss),detail:_(O.cache_hit)}],ie=l===`credits`?v(O.credits):l===`tokens`?_(O.total_tokens):y(O.cost);return(0,I.jsxs)(`div`,{className:`space-y-6`,children:[(0,I.jsxs)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-2`,children:[(0,I.jsx)(M,{value:r,onChange:e=>o(e),ariaLabel:t(`usageWindow`),options:[{id:`today`,label:t(`statsWindowToday`)},{id:`24`,label:t(`usageWindow24h`)},{id:`168`,label:t(`usageWindow7d`)},{id:`all`,label:t(`usageWindowTotal`)}]}),(0,I.jsxs)(a,{size:`sm`,variant:`secondary`,onPress:()=>void E(),isDisabled:S,children:[(0,I.jsx)(te,{size:14}),t(`refresh`)]})]}),C?(0,I.jsx)(c,{title:t(`failedStats`,{msg:C})}):null,(0,I.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-4`,children:re.map(e=>(0,I.jsxs)(d,{className:`gap-0 p-4`,children:[(0,I.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,I.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:S?(0,I.jsx)(k,{className:`h-5 w-16`}):e.value}),(0,I.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:S?(0,I.jsx)(k,{className:`h-3 w-24`}):e.detail||`\xA0`})]},e.label))}),(0,I.jsxs)(d,{className:`overflow-hidden p-0`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageChartTitle`)}),(0,I.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageChartHint`)})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,I.jsx)(M,{value:l,onChange:e=>u(e),ariaLabel:t(`usageChartMetric`),options:[{id:`credits`,label:t(`usageColCredits`)},{id:`tokens`,label:t(`usageColTokens`)}]}),(0,I.jsx)(T,{size:`sm`,variant:`soft`,color:`default`,children:ie})]})]}),(0,I.jsx)(`div`,{className:`p-5`,children:S?(0,I.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,I.jsx)(k,{className:`h-56 w-full`})}):ne?(0,I.jsx)(F.Suspense,{fallback:(0,I.jsx)(`div`,{className:`grid h-72 place-items-center`,children:(0,I.jsx)(k,{className:`h-56 w-full`})}),children:(0,I.jsx)(W,{series:D.series,models:D.models,lang:n,emptyLabel:t(`usageChartEmpty`),totalLabel:t(`usageTotals`),metric:l})}):(0,I.jsx)(f,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})})]}),(0,I.jsxs)(d,{className:`overflow-hidden p-0`,children:[(0,I.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-separator px-5 py-4`,children:(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h3`,{className:`font-semibold tracking-[-0.015em]`,children:t(`usageBreakdownTitle`)}),(0,I.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t(`usageBreakdownHint`)})]})}),S?(0,I.jsx)(`div`,{className:`space-y-3 p-5`,children:[0,1,2].map(e=>(0,I.jsx)(k,{className:`h-9 w-full`},e))}):ne?(0,I.jsx)(h,{children:(0,I.jsx)(h.ScrollContainer,{children:(0,I.jsxs)(h.Content,{"aria-label":t(`usageBreakdownTitle`),children:[(0,I.jsxs)(h.Header,{children:[(0,I.jsx)(h.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,I.jsx)(h.Column,{children:t(`usageColRequests`)}),(0,I.jsx)(h.Column,{children:t(`usageColInputHit`)}),(0,I.jsx)(h.Column,{children:t(`usageColInputMiss`)}),(0,I.jsx)(h.Column,{children:t(`usageColOutput`)}),(0,I.jsx)(h.Column,{children:t(`usageColTokens`)}),(0,I.jsx)(h.Column,{children:t(`usageColCredits`)})]}),(0,I.jsxs)(h.Body,{children:[D.models.map(e=>(0,I.jsxs)(h.Row,{children:[(0,I.jsxs)(h.Cell,{children:[(0,I.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,I.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs`,children:e.requests})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs`,children:_(e.cache_hit)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs`,children:_(e.cache_miss)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs`,children:_(e.output)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs`,children:_(e.total_tokens)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:v(e.credits)})})]},e.id)),(0,I.jsxs)(h.Row,{children:[(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:O.requests})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:_(O.cache_hit)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:_(O.cache_miss)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:_(O.output)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:_(O.total_tokens)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-xs font-semibold`,children:v(O.credits)})})]})]})]})})}):(0,I.jsx)(f,{title:t(`usageEmpty`),hint:t(`usageRetentionHint`)})]}),(0,I.jsx)(s,{className:`rounded-xl bg-surface-secondary`,hideSeparator:!0,defaultExpandedKeys:[],children:(0,I.jsxs)(s.Item,{id:`deepseek-estimate`,children:[(0,I.jsx)(s.Heading,{children:(0,I.jsxs)(s.Trigger,{className:`items-center gap-3 px-5 py-4 text-left`,children:[(0,I.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`span`,{className:`block font-semibold tracking-[-0.015em]`,children:t(`usageEstimateTitle`)}),(0,I.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted`,children:t(`usageEstimateHint`)})]}),j?(0,I.jsx)(T,{size:`sm`,variant:`soft`,color:`default`,children:y(O.cost)}):null,(0,I.jsx)(s.Indicator,{})]})}),(0,I.jsx)(s.Panel,{children:(0,I.jsxs)(s.Body,{className:`space-y-5 px-5 pb-5`,children:[(0,I.jsx)(`p`,{className:`text-xs leading-6 text-muted`,children:t(`usageRenderNote`)}),j?(0,I.jsxs)(`div`,{children:[(0,I.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,I.jsx)(`h4`,{className:`text-sm font-medium`,children:t(`usageEstimateChartTitle`)}),(0,I.jsx)(T,{size:`sm`,variant:`soft`,color:`default`,children:y(O.cost)})]}),(0,I.jsx)(F.Suspense,{fallback:(0,I.jsx)(k,{className:`h-56 w-full`}),children:(0,I.jsx)(W,{series:D.series,models:A.length?A:D.models,lang:n,emptyLabel:t(`usageEstimateChartEmpty`),totalLabel:t(`usageTotals`),metric:`cost`})})]}):null,A.length?(0,I.jsx)(h,{children:(0,I.jsx)(h.ScrollContainer,{children:(0,I.jsxs)(h.Content,{"aria-label":t(`usageEstimateTitle`),children:[(0,I.jsxs)(h.Header,{children:[(0,I.jsx)(h.Column,{isRowHeader:!0,children:t(`usageColModel`)}),(0,I.jsx)(h.Column,{children:t(`usageColSplit`)}),(0,I.jsx)(h.Column,{children:t(`usageColCost`)})]}),(0,I.jsxs)(h.Body,{children:[A.map(e=>(0,I.jsxs)(h.Row,{children:[(0,I.jsxs)(h.Cell,{children:[(0,I.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,I.jsx)(`div`,{className:`mono mt-0.5 text-[10px] text-muted`,children:e.id})]}),(0,I.jsx)(h.Cell,{children:(0,I.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[y(e.cost_peak),` / `,y(e.cost_off_peak)]})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-sm font-semibold`,children:y(e.cost)})})]},e.id)),(0,I.jsxs)(h.Row,{children:[(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`text-sm font-semibold`,children:t(`usageTotals`)})}),(0,I.jsx)(h.Cell,{children:(0,I.jsxs)(`span`,{className:`mono text-xs text-muted`,children:[y(O.cost_peak),` / `,y(O.cost_off_peak)]})}),(0,I.jsx)(h.Cell,{children:(0,I.jsx)(`span`,{className:`mono text-sm font-semibold`,children:y(O.cost)})})]})]})]})})}):(0,I.jsx)(`p`,{className:`text-xs text-muted`,children:t(`usageEstimateChartEmpty`)}),(0,I.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h4`,{className:`mb-2 text-sm font-medium`,children:t(`usagePriceTitle`)}),(0,I.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:t(`usagePeakNote`)}),(0,I.jsxs)(`div`,{className:`divide-y divide-separator rounded-lg bg-background`,children:[(g?.models??[]).map(e=>(0,I.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,I.jsx)(`div`,{className:`text-sm font-medium`,children:e.label}),(0,I.jsx)(`span`,{className:`mono text-[10px] text-muted`,children:e.currency})]}),(0,I.jsx)(`div`,{className:`mono mt-1 text-[10px] text-muted`,children:e.id}),(0,I.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 text-[11px]`,children:[(0,I.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,I.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandOff`)}),(0,I.jsxs)(`div`,{className:`mono mt-0.5`,children:[x(e.off_peak.cache_hit),` · `,x(e.off_peak.cache_miss),` · `,x(e.off_peak.output)]}),(0,I.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]}),(0,I.jsxs)(`div`,{className:`rounded-lg bg-surface-secondary px-2.5 py-2`,children:[(0,I.jsx)(`div`,{className:`text-[10px] text-muted`,children:t(`usagePriceBandPeak`)}),(0,I.jsxs)(`div`,{className:`mono mt-0.5`,children:[x(e.peak.cache_hit),` · `,x(e.peak.cache_miss),` · `,x(e.peak.output)]}),(0,I.jsxs)(`div`,{className:`mt-1 text-[9px] text-muted`,children:[t(`usagePriceHit`),` · `,t(`usagePriceMiss`),` · `,t(`usagePriceOutput`)]})]})]})]},e.id)),g?.models?.length?null:(0,I.jsx)(`div`,{className:`px-4 py-6 text-sm text-muted`,children:t(`usageEmpty`)})]})]}),(0,I.jsxs)(`div`,{className:`space-y-3 text-xs leading-6 text-muted`,children:[(0,I.jsx)(`h4`,{className:`text-sm font-medium text-foreground`,children:t(`usageNoteTitle`)}),(0,I.jsx)(`p`,{children:t(`usageRetentionHint`)}),(0,I.jsx)(`p`,{children:t(`usagePeakNote`)}),D.unpriced?.length?(0,I.jsx)(`p`,{children:t(`usageUnpricedHint`,{models:D.unpriced.join(`, `)})}):null,g?.note?(0,I.jsx)(`p`,{className:`mono text-[10px]`,children:g.note}):null]})]})]})})]})})]})}var ye=500,be={model:`model`,account:`account`,provider:`provider`};function xe(e,t,n){let r=e.prompt_tokens??0,i=e.completion_tokens??0,a=e.key===`(unknown)`||e.key===`(unassigned)`||!e.key;return{key:e.key,label:n,count:e.count,success:e.count?e.ok/e.count:0,p95:e.latency_p95_ms??null,tokens:r+i,prompt:r,completion:i,credits:e.credits??0,cache_write:e.cache_write_tokens??0,cache_read:e.cache_read_tokens??0,filter:a?void 0:{[be[t]]:e.key}}}function Se(e,t,n){let r=n===`ascending`?1:-1;return[...e].sort((e,n)=>{if(t===`label`)return r*e.label.localeCompare(n.label);let i=e[t],a=n[t];return i==null&&a==null?0:i==null?1:a==null?-1:r*(i-a)||e.label.localeCompare(n.label)})}function Ce(e){return e?e>=1e3?_(e):String(Math.round(e*100)/100):`0`}function K(){let{t:e}=i(),t=ne(),[n,a]=E(),[s,f]=(0,F.useState)(`stats`),[v,y]=(0,F.useState)(`model`),[x,S]=(0,F.useState)(`today`),[C,te]=(0,F.useState)(null),[T,A]=(0,F.useState)(null),[j,M]=(0,F.useState)(!0),[N,ue]=(0,F.useState)(`loading`),[L,de]=(0,F.useState)(`model`),[R,pe]=(0,F.useState)(null),[z,B]=(0,F.useState)(``),[V,H]=(0,F.useState)([]),[U,he]=(0,F.useState)(`count`),[W,ge]=(0,F.useState)(`descending`),[G,_e]=(0,F.useState)(()=>new URLSearchParams(window.location.search).get(`api_key`)??``),{options:be}=u(),K=(0,F.useRef)(0),q=n.toString(),J=(0,F.useRef)(q);(0,F.useEffect)(()=>{q!==J.current&&(J.current=q,_e(new URLSearchParams(q).get(`api_key`)??``))},[q]);let Y=G?`api_key=${encodeURIComponent(G)}`:``;(0,F.useEffect)(()=>{Y!==J.current&&(J.current=Y,a(Y,{replace:!0}))},[Y,a]),(0,F.useEffect)(()=>{let e=!1;return ee(!1).then(t=>{e||H(t.data||[])}).catch(()=>{}),()=>{e=!0}},[]);let we=C?.start?.toString()??``,Te=C?.end?.toString()??``;(0,F.useEffect)(()=>{let e=oe(x,C);if(!e){M(!1);return}let t=++K.current,n=`${x}|${we}|${Te}`,r=v;o({...e,dim:[v],limit:ye,api_key:G||void 0}).then(e=>{t===K.current&&(A(e),B(``),ue(n),de(r))}).catch(e=>{t===K.current&&(A(null),B(e instanceof Error?e.message:String(e)))}).finally(()=>{t===K.current&&M(!1)})},[v,x,we,Te,G]);let X=(0,F.useMemo)(()=>{let t=new Map(V.map(e=>[e.id,e.name||e.id]));return Se(((v===`model`?T?.models:v===`account`?T?.accounts:T?.providers)??[]).map(n=>{let r=n.key===`(unknown)`?e(`statsUnknown`):n.key===`(unassigned)`?e(`statsUnassigned`):v===`account`?t.get(n.key)||n.key:v===`provider`?ie(n.key,e):n.key;return xe(n,v,r)}),U,W)},[T,v,V,U,W,e]),Z=T?.totals,Q=T?.tokens;function $(e){if(!T||!e.filter)return;let n={...e.filter,api_key:G||void 0};t(le(n,T.window.from,T.window.to))}let Ee=[{id:`label`,label:e(v===`model`?`logsColModel`:v===`account`?`logsColAccount`:`logsColProvider`)},{id:`count`,label:e(`usageColRequests`),numeric:!0},{id:`success`,label:e(`usageColSuccess`),numeric:!0},{id:`p95`,label:e(`statsLatencyP95`),numeric:!0},{id:`tokens`,label:e(`usageColTokens`),numeric:!0},{id:`cache_write`,label:e(`usageColCacheWrite`),numeric:!0},{id:`credits`,label:e(`usageColCredits`),numeric:!0}],De=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-1`,children:(0,I.jsx)(se,{value:x,onChange:S,custom:C,onCustomChange:te,onBusy:()=>{T||M(!0)},t:e})}),z?(0,I.jsx)(c,{title:e(`failedStats`,{msg:z})}):null,(0,I.jsx)(ae,{id:T?N:`loading`,children:(0,I.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-2 sm:gap-4 xl:grid-cols-5`,children:[{label:e(`usageColRequests`),text:Z?_(Z.requests):`—`,detail:e(`statsWindowHint`,{window:e(ce[x])}),roll:Z?{value:Z.requests,kind:`compact`}:null},{label:e(`usageColSuccess`),text:Z?g(Z.success_rate):`—`,detail:Z?`${Z.ok} / ${Z.requests}`:``,roll:Z?{value:Z.success_rate,kind:`percent`}:null},{label:e(`usageColTokens`),text:Q?_(Q.total):`—`,detail:Q?`${_(Q.prompt)} / ${_(Q.completion)}`:``,roll:Q?{value:Q.total,kind:`compact`}:null},{label:e(`usageColCacheWrite`),text:Q?_(Q.cache_write??0):`—`,detail:Q?`${e(`chartCacheRead`)} ${_(Q.cache_read)}`:``,roll:Q?{value:Q.cache_write??0,kind:`compact`}:null},{label:e(`usageColCredits`),text:Z?Ce(Z.credits??0):`—`,detail:``,roll:null}].map(e=>(0,I.jsxs)(d,{className:`gap-0 p-4`,children:[(0,I.jsx)(`div`,{className:`text-body text-muted`,children:e.label}),(0,I.jsx)(`div`,{className:`tabular mt-1.5 text-section font-semibold`,children:T?e.roll?(0,I.jsx)(P,{value:e.roll.value,kind:e.roll.kind}):e.text:(0,I.jsx)(k,{className:`h-5 w-16`})}),(0,I.jsx)(`div`,{className:`mono mt-1 truncate text-caption text-muted`,children:T?e.detail||`\xA0`:(0,I.jsx)(k,{className:`h-3 w-24`})})]},e.label))})}),(0,I.jsxs)(d,{className:`overflow-hidden p-0`,children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-separator px-5 py-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between`,children:[(0,I.jsx)(m,{selectedKey:v,onSelectionChange:e=>y(String(e)),children:(0,I.jsx)(m.ListContainer,{className:`w-fit`,children:(0,I.jsxs)(m.List,{"aria-label":e(`usageTitle`),children:[(0,I.jsxs)(p,{id:`model`,className:`gap-1.5 whitespace-nowrap`,children:[(0,I.jsx)(m.Indicator,{className:`transition-none`}),(0,I.jsx)(O,{size:14}),e(`usageByModel`)]}),(0,I.jsxs)(p,{id:`account`,className:`gap-1.5 whitespace-nowrap`,children:[(0,I.jsx)(m.Indicator,{className:`transition-none`}),(0,I.jsx)(w,{size:14}),e(`usageByAccount`)]}),(0,I.jsxs)(p,{id:`provider`,className:`gap-1.5 whitespace-nowrap`,children:[(0,I.jsx)(m.Indicator,{className:`transition-none`}),(0,I.jsx)(r,{size:14}),e(`usageByProvider`)]})]})})}),(0,I.jsx)(`span`,{className:`mono text-caption text-muted`,children:T?e(`usageRowCount`,{count:X.length}):``})]}),X.some(e=>e.count>0)?(0,I.jsx)(`div`,{className:`border-b border-separator`,children:(0,I.jsx)(ae,{id:L,children:(0,I.jsx)(fe,{parts:X.map(e=>({id:e.key,label:e.label,value:e.count})),totalLabel:e(`usageColRequests`),otherLabel:e(`usageShareOther`),format:_,onOpen:e=>{let t=X.find(t=>t.key===e);t&&$(t)},onActiveChange:pe})})}):null,j&&!T?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,"aria-busy":`true`,children:Array.from({length:4},(e,t)=>(0,I.jsxs)(`div`,{className:`space-y-3 px-5 py-4`,children:[(0,I.jsx)(k,{className:`h-4 w-40`}),(0,I.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:Array.from({length:4},(e,t)=>(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,I.jsx)(k,{className:`h-3 w-12`}),(0,I.jsx)(k,{className:`h-4 w-16`})]},t))})]},t))}),(0,I.jsx)(`div`,{className:`hidden divide-y divide-separator md:block`,"aria-busy":`true`,children:Array.from({length:6},(e,t)=>(0,I.jsxs)(`div`,{className:`flex items-center gap-6 px-5 py-3.5`,children:[(0,I.jsx)(k,{className:`h-4 w-40`}),(0,I.jsx)(`div`,{className:`flex-1`}),Array.from({length:6},(e,t)=>(0,I.jsx)(k,{className:`h-4 w-14`},t))]},t))})]}):X.length===0?(0,I.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-10 text-body text-muted`,children:[(0,I.jsx)(D,{size:16}),e(`usageEmpty`)]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`divide-y divide-separator md:hidden`,children:X.map(t=>{let n=!!(t.filter&&T),r=[{label:e(`usageColRequests`),value:String(t.count)},{label:e(`usageColSuccess`),value:g(t.success),tone:t.success<.9?`text-warning`:void 0},{label:e(`statsLatencyP95`),value:b(t.p95)},{label:e(`usageColTokens`),value:_(t.tokens),sub:`${_(t.prompt)} / ${_(t.completion)}`},{label:e(`usageColCacheWrite`),value:_(t.cache_write)},{label:e(`usageColCredits`),value:Ce(t.credits)}];return(0,I.jsxs)(`article`,{className:`space-y-3 px-5 py-4 ${n?`cursor-pointer`:``} ${R===t.key?`usage-row--hot`:``}`,onClick:n?()=>$(t):void 0,onKeyDown:n?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),$(t))}:void 0,role:n?`button`:void 0,tabIndex:n?0:void 0,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[v===`provider`&&t.filter?(0,I.jsx)(re,{provider:t.key,size:14}):null,(0,I.jsx)(`span`,{className:`truncate text-body font-medium`,children:t.label})]}),v===`account`&&t.label!==t.key?(0,I.jsx)(`div`,{className:`mono truncate text-caption text-muted`,children:t.key}):null,(0,I.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-3`,children:r.map(e=>(0,I.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-caption text-muted`,children:e.label}),(0,I.jsx)(`div`,{className:`mono text-body ${e.tone??`text-foreground`}`,children:e.value}),`sub`in e&&e.sub?(0,I.jsx)(`div`,{className:`mono text-caption text-muted`,children:e.sub}):null]},e.label))})]},t.key)})}),(0,I.jsx)(h,{className:`usage-table hidden md:block`,children:(0,I.jsx)(h.ScrollContainer,{className:`min-w-0 overflow-x-auto`,children:(0,I.jsxs)(h.Content,{"aria-label":e(`usageTitle`),className:`min-w-[48rem]`,sortDescriptor:{column:U,direction:W},onSortChange:e=>{he(String(e.column)),ge(e.direction)},children:[(0,I.jsx)(h.Header,{children:Ee.map(e=>(0,I.jsx)(h.Column,{id:e.id,allowsSorting:!0,isRowHeader:e.id===`label`,className:e.numeric?`text-right`:void 0,children:({sortDirection:t})=>(0,I.jsx)(h.SortableColumnHeader,{sortDirection:t,className:e.numeric?`justify-end`:void 0,children:e.label})},e.id))}),(0,I.jsx)(h.Body,{children:X.map(e=>(0,I.jsxs)(h.Row,{id:e.key,className:[e.filter&&T?`cursor-pointer`:``,R===e.key?`usage-row--hot`:``].filter(Boolean).join(` `)||void 0,onAction:e.filter&&T?()=>$(e):void 0,children:[(0,I.jsx)(h.Cell,{children:(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[v===`provider`&&e.filter?(0,I.jsx)(re,{provider:e.key,size:14}):null,(0,I.jsx)(`span`,{className:`truncate text-body font-medium`,children:e.label}),v===`account`&&e.label!==e.key?(0,I.jsx)(`span`,{className:`mono truncate text-caption text-muted`,children:e.key}):null]})}),(0,I.jsx)(h.Cell,{className:`mono text-right text-body`,children:e.count}),(0,I.jsx)(h.Cell,{className:`mono text-right text-body`,children:(0,I.jsx)(`span`,{className:e.success<.9?`text-warning`:void 0,children:g(e.success)})}),(0,I.jsx)(h.Cell,{className:`mono text-right text-body`,children:b(e.p95)}),(0,I.jsxs)(h.Cell,{className:`text-right`,children:[(0,I.jsx)(`div`,{className:`mono text-body`,children:_(e.tokens)}),(0,I.jsxs)(`div`,{className:`mono text-caption text-muted`,children:[_(e.prompt),` / `,_(e.completion)]})]}),(0,I.jsx)(h.Cell,{className:`mono text-right text-body`,children:_(e.cache_write)}),(0,I.jsx)(h.Cell,{className:`mono text-right text-body`,children:Ce(e.credits)})]},e.key))})]})})})]})]}),(0,I.jsx)(me,{accounts:V,t:e})]});return(0,I.jsxs)(`div`,{className:`space-y-6 sm:space-y-6`,children:[(0,I.jsx)(`section`,{className:`flex flex-wrap items-center justify-end gap-3 pb-1`,children:(0,I.jsx)(l,{ariaLabel:e(`logsColApiKey`),value:G,onChange:_e,options:be,allLabel:e(`logsFilterApiKeyAll`),searchPlaceholder:e(`logsSearchApiKey`),emptyLabel:e(`logsNoFilterOptions`)})}),(0,I.jsxs)(m,{selectedKey:s,onSelectionChange:e=>f(String(e)),children:[(0,I.jsx)(m.ListContainer,{className:`w-fit`,children:(0,I.jsxs)(m.List,{"aria-label":e(`usageTitle`),children:[(0,I.jsxs)(p,{id:`stats`,className:`gap-1.5 whitespace-nowrap`,children:[(0,I.jsx)(m.Indicator,{className:`transition-none`}),e(`usageStatsTab`)]}),(0,I.jsxs)(p,{id:`cost`,className:`gap-1.5 whitespace-nowrap`,children:[(0,I.jsx)(m.Indicator,{className:`transition-none`}),e(`usageCostTab`)]})]})}),(0,I.jsx)(m.Panel,{id:`stats`,className:`space-y-6 pt-5`,children:De}),(0,I.jsx)(m.Panel,{id:`cost`,className:`pt-5`,children:(0,I.jsx)(ve,{apiKeyFilter:G})})]})]})}export{K as UsagePage}; \ No newline at end of file diff --git a/internal/webui/static/assets/User.es-DHjz-Tbh.js b/internal/webui/static/assets/User.es-DHwtE-a6.js similarity index 97% rename from internal/webui/static/assets/User.es-DHjz-Tbh.js rename to internal/webui/static/assets/User.es-DHwtE-a6.js index 9002952b4..491479491 100644 --- a/internal/webui/static/assets/User.es-DHjz-Tbh.js +++ b/internal/webui/static/assets/User.es-DHwtE-a6.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-XrvNxGvP.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M234.38,210a123.36,123.36,0,0,0-60.78-53.23,76,76,0,1,0-91.2,0A123.36,123.36,0,0,0,21.62,210a12,12,0,1,0,20.77,12c18.12-31.32,50.12-50,85.61-50s67.49,18.69,85.61,50a12,12,0,0,0,20.77-12ZM76,96a52,52,0,1,1,52,52A52.06,52.06,0,0,1,76,96Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M192,96a64,64,0,1,1-64-64A64,64,0,0,1,192,96Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M230.93,220a8,8,0,0,1-6.93,4H32a8,8,0,0,1-6.92-12c15.23-26.33,38.7-45.21,66.09-54.16a72,72,0,1,1,73.66,0c27.39,8.95,50.86,27.83,66.09,54.16A8,8,0,0,1,230.93,220Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M229.19,213c-15.81-27.32-40.63-46.49-69.47-54.62a70,70,0,1,0-63.44,0C67.44,166.5,42.62,185.67,26.81,213a6,6,0,1,0,10.38,6C56.4,185.81,90.34,166,128,166s71.6,19.81,90.81,53a6,6,0,1,0,10.38-6ZM70,96a58,58,0,1,1,58,58A58.07,58.07,0,0,1,70,96Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M227.46,214c-16.52-28.56-43-48.06-73.68-55.09a68,68,0,1,0-51.56,0c-30.64,7-57.16,26.53-73.68,55.09a4,4,0,0,0,6.92,4C55,184.19,89.62,164,128,164s73,20.19,92.54,54a4,4,0,0,0,3.46,2,3.93,3.93,0,0,0,2-.54A4,4,0,0,0,227.46,214ZM68,96a60,60,0,1,1,60,60A60.07,60.07,0,0,1,68,96Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`UserIcon`;var o=a;export{o as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-BAo1UrJW.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M234.38,210a123.36,123.36,0,0,0-60.78-53.23,76,76,0,1,0-91.2,0A123.36,123.36,0,0,0,21.62,210a12,12,0,1,0,20.77,12c18.12-31.32,50.12-50,85.61-50s67.49,18.69,85.61,50a12,12,0,0,0,20.77-12ZM76,96a52,52,0,1,1,52,52A52.06,52.06,0,0,1,76,96Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M192,96a64,64,0,1,1-64-64A64,64,0,0,1,192,96Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M230.93,220a8,8,0,0,1-6.93,4H32a8,8,0,0,1-6.92-12c15.23-26.33,38.7-45.21,66.09-54.16a72,72,0,1,1,73.66,0c27.39,8.95,50.86,27.83,66.09,54.16A8,8,0,0,1,230.93,220Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M229.19,213c-15.81-27.32-40.63-46.49-69.47-54.62a70,70,0,1,0-63.44,0C67.44,166.5,42.62,185.67,26.81,213a6,6,0,1,0,10.38,6C56.4,185.81,90.34,166,128,166s71.6,19.81,90.81,53a6,6,0,1,0,10.38-6ZM70,96a58,58,0,1,1,58,58A58.07,58.07,0,0,1,70,96Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M227.46,214c-16.52-28.56-43-48.06-73.68-55.09a68,68,0,1,0-51.56,0c-30.64,7-57.16,26.53-73.68,55.09a4,4,0,0,0,6.92,4C55,184.19,89.62,164,128,164s73,20.19,92.54,54a4,4,0,0,0,3.46,2,3.93,3.93,0,0,0,2-.54A4,4,0,0,0,227.46,214ZM68,96a60,60,0,1,1,60,60A60.07,60.07,0,0,1,68,96Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`UserIcon`;var o=a;export{o as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/accordion-LzsgJWJ-.js b/internal/webui/static/assets/accordion-DKpcSBXI.js similarity index 98% rename from internal/webui/static/assets/accordion-LzsgJWJ-.js rename to internal/webui/static/assets/accordion-DKpcSBXI.js index f7939ca1e..e7e4a7526 100644 --- a/internal/webui/static/assets/accordion-LzsgJWJ-.js +++ b/internal/webui/static/assets/accordion-DKpcSBXI.js @@ -1 +1 @@ -import{a as e,c as t,i as n,n as r}from"./shim-mfK0Rmj6.js";import{B as i,I as a,X as o,Z as s,ot as c}from"./useI18n-XrvNxGvP.js";import{A as l,B as u,F as d,J as f,M as p,P as m,Y as h,c as g,d as _,dt as v,j as y,l as b,lt as x,q as S,s as C,ut as w,z as T}from"./SharedElementTransition-BlCsXfb1.js";import{t as E}from"./assertion-BLQtDfw6.js";import{St as D}from"./index-CAlyInAP.js";var O=T({slots:{base:`accordion`,body:`accordion__body`,bodyInner:`accordion__body-inner`,heading:`accordion__heading`,indicator:`accordion__indicator`,item:`accordion__item`,panel:`accordion__panel`,trigger:`accordion__trigger`},variants:{variant:{default:{},surface:{base:`accordion--surface`}}}}),k=t(n(),1),A=t(e(),1);function j(e,t,n){let{isDisabled:r}=e,i=x(),a=x(),o=w(),s=(0,A.useRef)(null),l=(0,A.useCallback)(()=>{s.current=requestAnimationFrame(()=>{n.current&&n.current.setAttribute(`hidden`,`until-found`)}),(0,k.flushSync)(()=>{t.toggle()})},[n,t]);c(n,`beforematch`,l);let u=(0,A.useRef)(null);return v(()=>{if(s.current&&cancelAnimationFrame(s.current),n.current&&!o){let e=n.current;u.current==null||typeof e.getAnimations!=`function`?t.isExpanded?(e.removeAttribute(`hidden`),e.style.setProperty(`--disclosure-panel-width`,`auto`),e.style.setProperty(`--disclosure-panel-height`,`auto`)):(e.setAttribute(`hidden`,`until-found`),e.style.setProperty(`--disclosure-panel-width`,`0px`),e.style.setProperty(`--disclosure-panel-height`,`0px`)):t.isExpanded!==u.current&&(t.isExpanded?(e.removeAttribute(`hidden`),e.style.setProperty(`--disclosure-panel-width`,e.scrollWidth+`px`),e.style.setProperty(`--disclosure-panel-height`,e.scrollHeight+`px`),Promise.all(e.getAnimations().map(e=>e.finished)).then(()=>{e.style.setProperty(`--disclosure-panel-width`,`auto`),e.style.setProperty(`--disclosure-panel-height`,`auto`)}).catch(()=>{})):(e.style.setProperty(`--disclosure-panel-width`,e.scrollWidth+`px`),e.style.setProperty(`--disclosure-panel-height`,e.scrollHeight+`px`),window.getComputedStyle(e).height,e.style.setProperty(`--disclosure-panel-width`,`0px`),e.style.setProperty(`--disclosure-panel-height`,`0px`),Promise.all(e.getAnimations().map(e=>e.finished)).then(()=>e.setAttribute(`hidden`,`until-found`)).catch(()=>{}))),u.current=t.isExpanded}},[r,n,t.isExpanded,o]),(0,A.useEffect)(()=>()=>{s.current&&cancelAnimationFrame(s.current)},[]),{buttonProps:{id:i,"aria-expanded":t.isExpanded,"aria-controls":a,onPress:e=>{!r&&e.pointerType!==`keyboard`&&t.toggle()},isDisabled:r,onPressStart(e){e.pointerType===`keyboard`&&!r&&t.toggle()}},panelProps:{id:a,role:`group`,"aria-labelledby":i,"aria-hidden":!t.isExpanded,hidden:o?!t.isExpanded:void 0}}}function M(e){let{allowsMultipleExpanded:t=!1,isDisabled:n=!1}=e,[r,i]=b((0,A.useMemo)(()=>e.expandedKeys?new Set(e.expandedKeys):void 0,[e.expandedKeys]),(0,A.useMemo)(()=>e.defaultExpandedKeys?new Set(e.defaultExpandedKeys):new Set,[e.defaultExpandedKeys]),e.onExpandedChange);return(0,A.useEffect)(()=>{if(!t&&r.size>1){let e=r.values().next().value;e!=null&&i(new Set([e]))}}),{allowsMultipleExpanded:t,isDisabled:n,expandedKeys:r,setExpandedKeys:i,toggleKey(e){let n;t?(n=new Set(r),n.has(e)?n.delete(e):n.add(e)):n=new Set(r.has(e)?[]:[e]),i(n)}}}function N(e){let[t,n]=b(e.isExpanded,e.defaultExpanded||!1,e.onExpandedChange);return{isExpanded:t,setExpanded:n,expand:(0,A.useCallback)(()=>{n(!0)},[n]),collapse:(0,A.useCallback)(()=>{n(!1)},[n]),toggle:(0,A.useCallback)(()=>{n(!t)},[n,t])}}var P=(0,A.createContext)(null),F=(0,A.forwardRef)(function(e,t){let n=M(e),r=p({...e,defaultClassName:`react-aria-DisclosureGroup`,values:{isDisabled:n.isDisabled,state:n}}),i=S(e,{global:!0});return A.createElement(d.div,{...i,...r,ref:t,"data-disabled":e.isDisabled||void 0},A.createElement(P.Provider,{value:n},r.children))}),I=(0,A.createContext)(null),L=(0,A.createContext)(null),R=(0,A.createContext)(null),z=(0,A.forwardRef)(function(e,t){[e,t]=y(e,t,I);let n=(0,A.useContext)(P),{id:r,...i}=e,a=x();r||=a;let s=n?n.expandedKeys.has(r):e.isExpanded,c=N({...e,isExpanded:s,onExpandedChange(t){n&&n.toggleKey(r),e.onExpandedChange?.(t)}}),u=A.useRef(null),h=e.isDisabled||n?.isDisabled||!1,{buttonProps:g,panelProps:v}=j({...e,isExpanded:s,isDisabled:h},c,u),{isFocusVisible:b,focusProps:C}=_({within:!0}),w=p({...e,id:void 0,defaultClassName:`react-aria-Disclosure`,values:{isExpanded:c.isExpanded,isDisabled:h,isFocusVisibleWithin:b,state:c}}),T=S(i,{global:!0});return A.createElement(l,{values:[[o,{slots:{[m]:{},trigger:g}}],[R,{panelProps:v,panelRef:u}],[L,c]]},A.createElement(d.div,{...f(T,w,C),ref:t,"data-expanded":c.isExpanded||void 0,"data-disabled":h||void 0,"data-focus-visible-within":b||void 0},w.children))}),B=(0,A.forwardRef)(function(e,t){let{role:n=`group`}=e,{panelProps:r,panelRef:i}=(0,A.useContext)(R),{isFocusVisible:a,focusProps:s}=_({within:!0}),c=p({...e,defaultClassName:`react-aria-DisclosurePanel`,values:{isFocusVisibleWithin:a}}),u=S(e,{global:!0,labelable:!0});return A.createElement(d.div,{...f(u,c,r,s),ref:h(t,i),role:n,"data-focus-visible-within":a||void 0},A.createElement(l,{values:[[o,null]]},e.children))}),V=r(),H=(0,A.createContext)({}),U=({children:e,className:t,hideSeparator:n=!1,variant:r,...i})=>{let o=A.useMemo(()=>O({variant:r}),[r]),s=(0,V.jsx)(F,{className:g(t,o.base()),"data-slot":`accordion`,...i,children:t=>(0,V.jsx)(V.Fragment,{children:typeof e==`function`?e(t):e})});return(0,V.jsx)(H,{value:{slots:o,hideSeparator:n},children:r===`surface`?(0,V.jsx)(a,{value:{variant:`default`},children:s}):s})},W=Object.assign(U,{Root:U,Item:({className:e,...t})=>{let{hideSeparator:n,slots:r}=(0,A.use)(H);return(0,V.jsx)(z,{className:g(e,r?.item()),"data-hide-separator":n?`true`:void 0,"data-slot":`accordion-item`,...t,children:t.children})},Heading:({className:e,...t})=>{let{slots:n}=(0,A.use)(H);return(0,V.jsx)(D,{className:C(n?.heading,e),"data-slot":`accordion-heading`,...t})},Trigger:({className:e,...t})=>{let{slots:n}=(0,A.use)(H);return(0,V.jsx)(s,{className:g(e,n?.trigger()),"data-slot":`accordion-trigger`,slot:`trigger`,...t,children:e=>(0,V.jsx)(V.Fragment,{children:typeof t.children==`function`?t.children(e):t.children})})},Panel:({children:e,className:t,...n})=>{let{slots:r}=(0,A.use)(H),{isExpanded:i}=(0,A.use)(L);return(0,V.jsx)(B,{className:g(t,r?.panel()),"data-expanded":E(i),"data-slot":`accordion-panel`,...n,children:e})},Indicator:({children:e,className:t,...n})=>{let{slots:r}=(0,A.use)(H),{isExpanded:a}=(0,A.use)(L);return e&&A.isValidElement(e)?A.cloneElement(e,{...n,"data-expanded":E(a),className:C(r?.indicator,t),"data-slot":`accordion-indicator`}):(0,V.jsx)(i,{className:C(r?.indicator,t),"data-expanded":E(a),"data-slot":`accordion-indicator`,...n})},Body:({children:e,className:t,...n})=>{let{slots:r}=(0,A.use)(H);return(0,V.jsx)(u.div,{className:r?.body({}),"data-slot":`accordion-body`,...n,children:(0,V.jsx)(`div`,{className:C(r?.bodyInner,t),children:e})})}});export{W as t}; \ No newline at end of file +import{a as e,c as t,i as n,n as r}from"./shim-mfK0Rmj6.js";import{B as i,I as a,X as o,Z as s,ot as c}from"./useI18n-BAo1UrJW.js";import{A as l,B as u,F as d,J as f,M as p,P as m,Y as h,c as g,d as _,dt as v,j as y,l as b,lt as x,q as S,s as C,ut as w,z as T}from"./SharedElementTransition-BlCsXfb1.js";import{t as E}from"./assertion-BLQtDfw6.js";import{St as D}from"./index-CWTBzWuK.js";var O=T({slots:{base:`accordion`,body:`accordion__body`,bodyInner:`accordion__body-inner`,heading:`accordion__heading`,indicator:`accordion__indicator`,item:`accordion__item`,panel:`accordion__panel`,trigger:`accordion__trigger`},variants:{variant:{default:{},surface:{base:`accordion--surface`}}}}),k=t(n(),1),A=t(e(),1);function j(e,t,n){let{isDisabled:r}=e,i=x(),a=x(),o=w(),s=(0,A.useRef)(null),l=(0,A.useCallback)(()=>{s.current=requestAnimationFrame(()=>{n.current&&n.current.setAttribute(`hidden`,`until-found`)}),(0,k.flushSync)(()=>{t.toggle()})},[n,t]);c(n,`beforematch`,l);let u=(0,A.useRef)(null);return v(()=>{if(s.current&&cancelAnimationFrame(s.current),n.current&&!o){let e=n.current;u.current==null||typeof e.getAnimations!=`function`?t.isExpanded?(e.removeAttribute(`hidden`),e.style.setProperty(`--disclosure-panel-width`,`auto`),e.style.setProperty(`--disclosure-panel-height`,`auto`)):(e.setAttribute(`hidden`,`until-found`),e.style.setProperty(`--disclosure-panel-width`,`0px`),e.style.setProperty(`--disclosure-panel-height`,`0px`)):t.isExpanded!==u.current&&(t.isExpanded?(e.removeAttribute(`hidden`),e.style.setProperty(`--disclosure-panel-width`,e.scrollWidth+`px`),e.style.setProperty(`--disclosure-panel-height`,e.scrollHeight+`px`),Promise.all(e.getAnimations().map(e=>e.finished)).then(()=>{e.style.setProperty(`--disclosure-panel-width`,`auto`),e.style.setProperty(`--disclosure-panel-height`,`auto`)}).catch(()=>{})):(e.style.setProperty(`--disclosure-panel-width`,e.scrollWidth+`px`),e.style.setProperty(`--disclosure-panel-height`,e.scrollHeight+`px`),window.getComputedStyle(e).height,e.style.setProperty(`--disclosure-panel-width`,`0px`),e.style.setProperty(`--disclosure-panel-height`,`0px`),Promise.all(e.getAnimations().map(e=>e.finished)).then(()=>e.setAttribute(`hidden`,`until-found`)).catch(()=>{}))),u.current=t.isExpanded}},[r,n,t.isExpanded,o]),(0,A.useEffect)(()=>()=>{s.current&&cancelAnimationFrame(s.current)},[]),{buttonProps:{id:i,"aria-expanded":t.isExpanded,"aria-controls":a,onPress:e=>{!r&&e.pointerType!==`keyboard`&&t.toggle()},isDisabled:r,onPressStart(e){e.pointerType===`keyboard`&&!r&&t.toggle()}},panelProps:{id:a,role:`group`,"aria-labelledby":i,"aria-hidden":!t.isExpanded,hidden:o?!t.isExpanded:void 0}}}function M(e){let{allowsMultipleExpanded:t=!1,isDisabled:n=!1}=e,[r,i]=b((0,A.useMemo)(()=>e.expandedKeys?new Set(e.expandedKeys):void 0,[e.expandedKeys]),(0,A.useMemo)(()=>e.defaultExpandedKeys?new Set(e.defaultExpandedKeys):new Set,[e.defaultExpandedKeys]),e.onExpandedChange);return(0,A.useEffect)(()=>{if(!t&&r.size>1){let e=r.values().next().value;e!=null&&i(new Set([e]))}}),{allowsMultipleExpanded:t,isDisabled:n,expandedKeys:r,setExpandedKeys:i,toggleKey(e){let n;t?(n=new Set(r),n.has(e)?n.delete(e):n.add(e)):n=new Set(r.has(e)?[]:[e]),i(n)}}}function N(e){let[t,n]=b(e.isExpanded,e.defaultExpanded||!1,e.onExpandedChange);return{isExpanded:t,setExpanded:n,expand:(0,A.useCallback)(()=>{n(!0)},[n]),collapse:(0,A.useCallback)(()=>{n(!1)},[n]),toggle:(0,A.useCallback)(()=>{n(!t)},[n,t])}}var P=(0,A.createContext)(null),F=(0,A.forwardRef)(function(e,t){let n=M(e),r=p({...e,defaultClassName:`react-aria-DisclosureGroup`,values:{isDisabled:n.isDisabled,state:n}}),i=S(e,{global:!0});return A.createElement(d.div,{...i,...r,ref:t,"data-disabled":e.isDisabled||void 0},A.createElement(P.Provider,{value:n},r.children))}),I=(0,A.createContext)(null),L=(0,A.createContext)(null),R=(0,A.createContext)(null),z=(0,A.forwardRef)(function(e,t){[e,t]=y(e,t,I);let n=(0,A.useContext)(P),{id:r,...i}=e,a=x();r||=a;let s=n?n.expandedKeys.has(r):e.isExpanded,c=N({...e,isExpanded:s,onExpandedChange(t){n&&n.toggleKey(r),e.onExpandedChange?.(t)}}),u=A.useRef(null),h=e.isDisabled||n?.isDisabled||!1,{buttonProps:g,panelProps:v}=j({...e,isExpanded:s,isDisabled:h},c,u),{isFocusVisible:b,focusProps:C}=_({within:!0}),w=p({...e,id:void 0,defaultClassName:`react-aria-Disclosure`,values:{isExpanded:c.isExpanded,isDisabled:h,isFocusVisibleWithin:b,state:c}}),T=S(i,{global:!0});return A.createElement(l,{values:[[o,{slots:{[m]:{},trigger:g}}],[R,{panelProps:v,panelRef:u}],[L,c]]},A.createElement(d.div,{...f(T,w,C),ref:t,"data-expanded":c.isExpanded||void 0,"data-disabled":h||void 0,"data-focus-visible-within":b||void 0},w.children))}),B=(0,A.forwardRef)(function(e,t){let{role:n=`group`}=e,{panelProps:r,panelRef:i}=(0,A.useContext)(R),{isFocusVisible:a,focusProps:s}=_({within:!0}),c=p({...e,defaultClassName:`react-aria-DisclosurePanel`,values:{isFocusVisibleWithin:a}}),u=S(e,{global:!0,labelable:!0});return A.createElement(d.div,{...f(u,c,r,s),ref:h(t,i),role:n,"data-focus-visible-within":a||void 0},A.createElement(l,{values:[[o,null]]},e.children))}),V=r(),H=(0,A.createContext)({}),U=({children:e,className:t,hideSeparator:n=!1,variant:r,...i})=>{let o=A.useMemo(()=>O({variant:r}),[r]),s=(0,V.jsx)(F,{className:g(t,o.base()),"data-slot":`accordion`,...i,children:t=>(0,V.jsx)(V.Fragment,{children:typeof e==`function`?e(t):e})});return(0,V.jsx)(H,{value:{slots:o,hideSeparator:n},children:r===`surface`?(0,V.jsx)(a,{value:{variant:`default`},children:s}):s})},W=Object.assign(U,{Root:U,Item:({className:e,...t})=>{let{hideSeparator:n,slots:r}=(0,A.use)(H);return(0,V.jsx)(z,{className:g(e,r?.item()),"data-hide-separator":n?`true`:void 0,"data-slot":`accordion-item`,...t,children:t.children})},Heading:({className:e,...t})=>{let{slots:n}=(0,A.use)(H);return(0,V.jsx)(D,{className:C(n?.heading,e),"data-slot":`accordion-heading`,...t})},Trigger:({className:e,...t})=>{let{slots:n}=(0,A.use)(H);return(0,V.jsx)(s,{className:g(e,n?.trigger()),"data-slot":`accordion-trigger`,slot:`trigger`,...t,children:e=>(0,V.jsx)(V.Fragment,{children:typeof t.children==`function`?t.children(e):t.children})})},Panel:({children:e,className:t,...n})=>{let{slots:r}=(0,A.use)(H),{isExpanded:i}=(0,A.use)(L);return(0,V.jsx)(B,{className:g(t,r?.panel()),"data-expanded":E(i),"data-slot":`accordion-panel`,...n,children:e})},Indicator:({children:e,className:t,...n})=>{let{slots:r}=(0,A.use)(H),{isExpanded:a}=(0,A.use)(L);return e&&A.isValidElement(e)?A.cloneElement(e,{...n,"data-expanded":E(a),className:C(r?.indicator,t),"data-slot":`accordion-indicator`}):(0,V.jsx)(i,{className:C(r?.indicator,t),"data-expanded":E(a),"data-slot":`accordion-indicator`,...n})},Body:({children:e,className:t,...n})=>{let{slots:r}=(0,A.use)(H);return(0,V.jsx)(u.div,{className:r?.body({}),"data-slot":`accordion-body`,...n,children:(0,V.jsx)(`div`,{className:C(r?.bodyInner,t),children:e})})}});export{W as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/checkbox-CUZk1qce.js b/internal/webui/static/assets/checkbox-BfdndRMW.js similarity index 97% rename from internal/webui/static/assets/checkbox-CUZk1qce.js rename to internal/webui/static/assets/checkbox-BfdndRMW.js index 536ad9ae5..acd698537 100644 --- a/internal/webui/static/assets/checkbox-CUZk1qce.js +++ b/internal/webui/static/assets/checkbox-BfdndRMW.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{B as r,c as i,s as a,z as o}from"./SharedElementTransition-BlCsXfb1.js";import{n as s,t as c}from"./Checkbox-Dk73RtP8.js";var l=o({defaultVariants:{variant:`primary`},slots:{base:`checkbox`,content:`checkbox__content`,control:`checkbox__control`,indicator:`checkbox__indicator`},variants:{variant:{primary:{base:`checkbox--primary`},secondary:{base:`checkbox--secondary`}}}}),u=t(e(),1),d=n(),f=(0,u.createContext)({}),p=(0,u.createContext)({}),m=({children:e,className:t,variant:n,...r})=>{let a=(0,u.use)(f),o=n??a.variant,c=u.useMemo(()=>l({variant:o}),[o]);return(0,d.jsx)(s,{"data-slot":`checkbox`,...r,className:i(t,c.base()),children:t=>(0,d.jsx)(p,{value:{slots:c,state:t},children:typeof e==`function`?e(t):e})})};m.displayName=`HeroUI.Checkbox`;var h=({children:e,className:t,...n})=>{let{slots:r}=(0,u.use)(p);return(0,d.jsx)(c,{"data-slot":`checkbox-content`,...n,className:i(t,r?.content()),children:e})};h.displayName=`HeroUI.Checkbox.Content`;var g=({children:e,className:t,...n})=>{let{slots:i}=(0,u.use)(p);return(0,d.jsx)(r.span,{className:a(i?.control,t),"data-slot":`checkbox-control`,...n,children:e})};g.displayName=`HeroUI.Checkbox.Control`;var _=({children:e,className:t,...n})=>{let{slots:i,state:o}=(0,u.use)(p),s=o?.isSelected,c=o?.isIndeterminate,l=typeof e==`function`?e(o??{}):e||(c?(0,d.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`checkbox-default-indicator--indeterminate`,fill:`none`,role:`presentation`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:3,viewBox:`0 0 24 24`,children:(0,d.jsx)(`line`,{x1:`21`,x2:`3`,y1:`12`,y2:`12`})}):(0,d.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`checkbox-default-indicator--checkmark`,fill:`none`,role:`presentation`,stroke:`currentColor`,strokeDasharray:22,strokeDashoffset:s?44:66,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 17 18`,children:(0,d.jsx)(`polyline`,{points:`1 9 7 14 15 4`})}));return(0,d.jsx)(r.span,{"aria-hidden":`true`,className:a(i?.indicator,t),"data-slot":`checkbox-indicator`,...n,children:l})};_.displayName=`HeroUI.Checkbox.Indicator`;var v=Object.assign(m,{Root:m,Content:h,Control:g,Indicator:_});export{v as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{B as r,c as i,s as a,z as o}from"./SharedElementTransition-BlCsXfb1.js";import{n as s,t as c}from"./Checkbox-x9lhPT2J.js";var l=o({defaultVariants:{variant:`primary`},slots:{base:`checkbox`,content:`checkbox__content`,control:`checkbox__control`,indicator:`checkbox__indicator`},variants:{variant:{primary:{base:`checkbox--primary`},secondary:{base:`checkbox--secondary`}}}}),u=t(e(),1),d=n(),f=(0,u.createContext)({}),p=(0,u.createContext)({}),m=({children:e,className:t,variant:n,...r})=>{let a=(0,u.use)(f),o=n??a.variant,c=u.useMemo(()=>l({variant:o}),[o]);return(0,d.jsx)(s,{"data-slot":`checkbox`,...r,className:i(t,c.base()),children:t=>(0,d.jsx)(p,{value:{slots:c,state:t},children:typeof e==`function`?e(t):e})})};m.displayName=`HeroUI.Checkbox`;var h=({children:e,className:t,...n})=>{let{slots:r}=(0,u.use)(p);return(0,d.jsx)(c,{"data-slot":`checkbox-content`,...n,className:i(t,r?.content()),children:e})};h.displayName=`HeroUI.Checkbox.Content`;var g=({children:e,className:t,...n})=>{let{slots:i}=(0,u.use)(p);return(0,d.jsx)(r.span,{className:a(i?.control,t),"data-slot":`checkbox-control`,...n,children:e})};g.displayName=`HeroUI.Checkbox.Control`;var _=({children:e,className:t,...n})=>{let{slots:i,state:o}=(0,u.use)(p),s=o?.isSelected,c=o?.isIndeterminate,l=typeof e==`function`?e(o??{}):e||(c?(0,d.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`checkbox-default-indicator--indeterminate`,fill:`none`,role:`presentation`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:3,viewBox:`0 0 24 24`,children:(0,d.jsx)(`line`,{x1:`21`,x2:`3`,y1:`12`,y2:`12`})}):(0,d.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`checkbox-default-indicator--checkmark`,fill:`none`,role:`presentation`,stroke:`currentColor`,strokeDasharray:22,strokeDashoffset:s?44:66,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 17 18`,children:(0,d.jsx)(`polyline`,{points:`1 9 7 14 15 4`})}));return(0,d.jsx)(r.span,{"aria-hidden":`true`,className:a(i?.indicator,t),"data-slot":`checkbox-indicator`,...n,children:l})};_.displayName=`HeroUI.Checkbox.Indicator`;var v=Object.assign(m,{Root:m,Content:h,Control:g,Indicator:_});export{v as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/clipboard-CWhuA-N0.js b/internal/webui/static/assets/clipboard-ADnALjHx.js similarity index 97% rename from internal/webui/static/assets/clipboard-CWhuA-N0.js rename to internal/webui/static/assets/clipboard-ADnALjHx.js index 026323c46..94ca60c74 100644 --- a/internal/webui/static/assets/clipboard-CWhuA-N0.js +++ b/internal/webui/static/assets/clipboard-ADnALjHx.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-XrvNxGvP.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,40V168H168V88H88V40Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32Zm-8,128H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,34H88a6,6,0,0,0-6,6V82H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H168a6,6,0,0,0,6-6V174h42a6,6,0,0,0,6-6V40A6,6,0,0,0,216,34ZM162,210H46V94H162Zm48-48H174V88a6,6,0,0,0-6-6H94V46H210Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,36H88a4,4,0,0,0-4,4V84H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H168a4,4,0,0,0,4-4V172h44a4,4,0,0,0,4-4V40A4,4,0,0,0,216,36ZM164,212H44V92H164Zm48-48H172V88a4,4,0,0,0-4-4H92V44H212Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`CopyIcon`;var o=a;async function s(e){if(!e)return!1;try{if(typeof navigator<`u`&&navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}export{o as n,s as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{pt as n}from"./useI18n-BAo1UrJW.js";var r=t(e(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,40V168H168V88H88V40Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32Zm-8,128H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,34H88a6,6,0,0,0-6,6V82H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H168a6,6,0,0,0,6-6V174h42a6,6,0,0,0,6-6V40A6,6,0,0,0,216,34ZM162,210H46V94H162Zm48-48H174V88a6,6,0,0,0-6-6H94V46H210Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,36H88a4,4,0,0,0-4,4V84H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H168a4,4,0,0,0,4-4V172h44a4,4,0,0,0,4-4V40A4,4,0,0,0,216,36ZM164,212H44V92H164Zm48-48H172V88a4,4,0,0,0-4-4H92V44H212Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`CopyIcon`;var o=a;async function s(e){if(!e)return!1;try{if(typeof navigator<`u`&&navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}export{o as n,s as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/collection-prop-injection-Csmjb87v.js b/internal/webui/static/assets/collection-prop-injection-B6_r67VF.js similarity index 97% rename from internal/webui/static/assets/collection-prop-injection-Csmjb87v.js rename to internal/webui/static/assets/collection-prop-injection-B6_r67VF.js index d3d4cf3fc..468105ac8 100644 --- a/internal/webui/static/assets/collection-prop-injection-Csmjb87v.js +++ b/internal/webui/static/assets/collection-prop-injection-B6_r67VF.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r}from"./useI18n-XrvNxGvP.js";var i=t(e(),1),a=(0,i.createContext)(!1),o=e=>{let t=(0,i.use)(a),n=(0,i.use)(r);return!t||n?.slots?.[e]!=null},s={blue:`\x1B[34m`,green:`\x1B[32m`,magenta:`\x1B[35m`,red:`\x1B[31m`,reset:`\x1B[0m`,yellow:`\x1B[33m`},c={debug:s.magenta,error:s.red,info:s.blue,success:s.green,warn:s.yellow},l={debug:`🔍`,error:`❌`,info:`ℹ️`,success:`✅`,warn:`⚠️`},u=class{constructor(e={}){this.enabled=e.enabled??!0,this.prefix=e.prefix??`HeroUI`}formatMessage(e,t){let n=c[e],r=l[e];return`${n}[${this.prefix}]${s.reset} ${r} ${t}`}log(e,t,...n){if(!this.enabled)return;let r=this.formatMessage(e,t);switch(e){case`error`:console.error(r,...n);break;case`warn`:console.warn(r,...n);break;default:console.log(r,...n)}}info(e,...t){this.log(`info`,e,...t)}success(e,...t){this.log(`success`,e,...t)}warn(e,...t){this.log(`warn`,e,...t)}error(e,...t){this.log(`error`,e,...t)}debug(e,...t){this.log(`debug`,e,...t)}divider(e=`=`,t=80){this.enabled&&console.log(e.repeat(t))}newline(){this.enabled&&console.log()}},d=n(),f=new u({prefix:`HeroUI`}),p,m=typeof process<`u`&&!1,h=e=>{m&&(p??=new Set,p.has(e)&&f.warn(`Duplicate collection slot "${e}". Use a unique, namespaced name (e.g. "tabs.listContainer", "menu.popover").`),p.add(e));let t=`$$heroui.collection.${e}`,n=(0,i.createContext)(void 0),r=(e,n)=>i.Children.map(e,e=>(0,i.isValidElement)(e)?i.cloneElement(e,{[t]:n}):e),a=e=>{let{[t]:n,...r}=e;return[n,r]},o=e=>{let[t,r]=a(e),o=(0,i.useContext)(n);return[t??o,r]},s=({children:e,...t})=>(0,d.jsx)(n.Provider,{value:t,children:r(e,t)});return s.displayName=`HeroUI.CollectionSlot(${e})`,{key:t,inject:r,consume:a,useSlot:o,Injector:s,withSlot:(t,n)=>{let r=(0,i.forwardRef)(function(r,i){let[a,s]=o(r),{children:c,...l}=s;if(!a)return(0,d.jsx)(t,{...l,ref:i,children:c});if(n)return n({...l,children:c},a,i);let{className:u,render:f,...p}=a;return(0,d.jsx)(t,{...l,ref:i,children:f?f({children:c,className:u,...p}):(0,d.jsx)(`div`,{className:u,"data-slot":`${e}-container`,...p,children:c})})});return r.displayName=`HeroUI.withCollectionSlot(${t.displayName||t.name||e})`,r},Context:n}};export{a as n,o as r,h as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r}from"./useI18n-BAo1UrJW.js";var i=t(e(),1),a=(0,i.createContext)(!1),o=e=>{let t=(0,i.use)(a),n=(0,i.use)(r);return!t||n?.slots?.[e]!=null},s={blue:`\x1B[34m`,green:`\x1B[32m`,magenta:`\x1B[35m`,red:`\x1B[31m`,reset:`\x1B[0m`,yellow:`\x1B[33m`},c={debug:s.magenta,error:s.red,info:s.blue,success:s.green,warn:s.yellow},l={debug:`🔍`,error:`❌`,info:`ℹ️`,success:`✅`,warn:`⚠️`},u=class{constructor(e={}){this.enabled=e.enabled??!0,this.prefix=e.prefix??`HeroUI`}formatMessage(e,t){let n=c[e],r=l[e];return`${n}[${this.prefix}]${s.reset} ${r} ${t}`}log(e,t,...n){if(!this.enabled)return;let r=this.formatMessage(e,t);switch(e){case`error`:console.error(r,...n);break;case`warn`:console.warn(r,...n);break;default:console.log(r,...n)}}info(e,...t){this.log(`info`,e,...t)}success(e,...t){this.log(`success`,e,...t)}warn(e,...t){this.log(`warn`,e,...t)}error(e,...t){this.log(`error`,e,...t)}debug(e,...t){this.log(`debug`,e,...t)}divider(e=`=`,t=80){this.enabled&&console.log(e.repeat(t))}newline(){this.enabled&&console.log()}},d=n(),f=new u({prefix:`HeroUI`}),p,m=typeof process<`u`&&!1,h=e=>{m&&(p??=new Set,p.has(e)&&f.warn(`Duplicate collection slot "${e}". Use a unique, namespaced name (e.g. "tabs.listContainer", "menu.popover").`),p.add(e));let t=`$$heroui.collection.${e}`,n=(0,i.createContext)(void 0),r=(e,n)=>i.Children.map(e,e=>(0,i.isValidElement)(e)?i.cloneElement(e,{[t]:n}):e),a=e=>{let{[t]:n,...r}=e;return[n,r]},o=e=>{let[t,r]=a(e),o=(0,i.useContext)(n);return[t??o,r]},s=({children:e,...t})=>(0,d.jsx)(n.Provider,{value:t,children:r(e,t)});return s.displayName=`HeroUI.CollectionSlot(${e})`,{key:t,inject:r,consume:a,useSlot:o,Injector:s,withSlot:(t,n)=>{let r=(0,i.forwardRef)(function(r,i){let[a,s]=o(r),{children:c,...l}=s;if(!a)return(0,d.jsx)(t,{...l,ref:i,children:c});if(n)return n({...l,children:c},a,i);let{className:u,render:f,...p}=a;return(0,d.jsx)(t,{...l,ref:i,children:f?f({children:c,className:u,...p}):(0,d.jsx)(`div`,{className:u,"data-slot":`${e}-container`,...p,children:c})})});return r.displayName=`HeroUI.withCollectionSlot(${t.displayName||t.name||e})`,r},Context:n}};export{a as n,o as r,h as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/description-Du44nrYx.js b/internal/webui/static/assets/description-CmJDGGCw.js similarity index 70% rename from internal/webui/static/assets/description-Du44nrYx.js rename to internal/webui/static/assets/description-CmJDGGCw.js index 6e50214b2..acce9f586 100644 --- a/internal/webui/static/assets/description-Du44nrYx.js +++ b/internal/webui/static/assets/description-CmJDGGCw.js @@ -1 +1 @@ -import{n as e}from"./shim-mfK0Rmj6.js";import{i as t}from"./useI18n-XrvNxGvP.js";import{z as n}from"./SharedElementTransition-BlCsXfb1.js";import{r}from"./collection-prop-injection-Csmjb87v.js";var i=n({base:`description`}),a=e(),o=({children:e,className:n,...o})=>r(`description`)?(0,a.jsx)(t,{className:i({className:n}),"data-slot":`description`,slot:`description`,...o,children:e}):null,s=Object.assign(o,{Root:o});export{s as t}; \ No newline at end of file +import{n as e}from"./shim-mfK0Rmj6.js";import{i as t}from"./useI18n-BAo1UrJW.js";import{z as n}from"./SharedElementTransition-BlCsXfb1.js";import{r}from"./collection-prop-injection-B6_r67VF.js";var i=n({base:`description`}),a=e(),o=({children:e,className:n,...o})=>r(`description`)?(0,a.jsx)(t,{className:i({className:n}),"data-slot":`description`,slot:`description`,...o,children:e}):null,s=Object.assign(o,{Root:o});export{s as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/form-qle3Iim5.js b/internal/webui/static/assets/form-D5ELq0ds.js similarity index 60% rename from internal/webui/static/assets/form-qle3Iim5.js rename to internal/webui/static/assets/form-D5ELq0ds.js index dec6b21b5..9dccd1c26 100644 --- a/internal/webui/static/assets/form-qle3Iim5.js +++ b/internal/webui/static/assets/form-D5ELq0ds.js @@ -1 +1 @@ -import{n as e}from"./shim-mfK0Rmj6.js";import{i as t}from"./label-B8hTan2F.js";var n=e(),r=({...e})=>(0,n.jsx)(t,{...e}),i=Object.assign(r,{Root:r});export{i as t}; \ No newline at end of file +import{n as e}from"./shim-mfK0Rmj6.js";import{i as t}from"./label-DYYRLGoV.js";var n=e(),r=({...e})=>(0,n.jsx)(t,{...e}),i=Object.assign(r,{Root:r});export{i as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/format-FfdyoNtB.js b/internal/webui/static/assets/format-BAkFbjAh.js similarity index 97% rename from internal/webui/static/assets/format-FfdyoNtB.js rename to internal/webui/static/assets/format-BAkFbjAh.js index d4d620c66..8ea36e71f 100644 --- a/internal/webui/static/assets/format-FfdyoNtB.js +++ b/internal/webui/static/assets/format-BAkFbjAh.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{B as r,F as i,J as a,L as o,M as s,c,d as l,j as u,q as d,s as f,u as p,z as m}from"./SharedElementTransition-BlCsXfb1.js";import{n as h}from"./label-B8hTan2F.js";import{F as g,I as _,L as v,P as y,R as b,mt as x}from"./index-CAlyInAP.js";var S=m({base:`toggle-button`,defaultVariants:{isIconOnly:!1,size:`md`,variant:`default`},variants:{isIconOnly:{true:`toggle-button--icon-only`},size:{lg:`toggle-button--lg`,md:`toggle-button--md`,sm:`toggle-button--sm`},variant:{default:`toggle-button--default`,ghost:`toggle-button--ghost`}}}),C=m({defaultVariants:{fullWidth:!1,isDetached:!1,orientation:`horizontal`},slots:{base:`toggle-button-group`,separator:`toggle-button-group__separator`},variants:{fullWidth:{false:{},true:{base:`toggle-button-group--full-width`}},isDetached:{false:{},true:{base:`toggle-button-group--detached`}},orientation:{horizontal:{base:`toggle-button-group--horizontal`},vertical:{base:`toggle-button-group--vertical`}}}}),w=t(e(),1),T=(0,w.createContext)({}),E=(0,w.forwardRef)(function(e,t){[e,t]=u(e,t,T);let n=(0,w.useContext)(_),r=h(n&&e.id!=null?{isSelected:n.selectedKeys.has(e.id),onChange(t){n.setSelected(e.id,t)}}:e),{buttonProps:o,isPressed:c,isSelected:f,isDisabled:m}=n&&e.id!=null?v({...e,id:e.id},n,t):b({...e,id:e.id==null?void 0:String(e.id)},r,t),{focusProps:g,isFocused:y,isFocusVisible:S}=l(e),{hoverProps:C,isHovered:E}=p({...e,isDisabled:m}),D=s({...e,id:void 0,values:{isHovered:E,isPressed:c,isFocused:y,isSelected:r.isSelected,isFocusVisible:S,isDisabled:m,state:r},defaultClassName:`react-aria-ToggleButton`}),O=d(e,{global:!0});return delete O.id,delete O.onClick,w.createElement(i.button,{...a(O,D,o,g,C),ref:t,slot:e.slot||void 0,"data-focused":y||void 0,"data-disabled":m||void 0,"data-pressed":c||void 0,"data-selected":f||void 0,"data-hovered":E||void 0,"data-focus-visible":S||void 0},w.createElement(x.Provider,{value:{isSelected:f}},D.children))}),D=n(),O=(0,w.createContext)({}),k=({children:e,className:t,fullWidth:n,isDetached:r=!1,isDisabled:i,orientation:a,size:s,...l})=>{let u=o(y),d=a??u?.orientation??`horizontal`,f=w.useMemo(()=>C({fullWidth:n,isDetached:r,orientation:d}),[n,r,d]);return(0,D.jsx)(O,{value:{slots:f,size:s,isDisabled:i},children:(0,D.jsx)(g,{className:c(t,f.base()),"data-slot":`toggle-button-group`,isDisabled:i,orientation:d,...l,children:e})})},A=({className:e,...t})=>{let{slots:n}=(0,w.use)(O);return(0,D.jsx)(r.span,{"aria-hidden":`true`,className:f(n?.separator,e),"data-slot":`toggle-button-group-separator`,...t})},j=({children:e,className:t,isIconOnly:n,size:r,style:i,variant:a,...o})=>{let s=(0,w.use)(O),l=S({isIconOnly:n,size:r??s?.size,variant:a});return(0,D.jsx)(E,{className:c(t,l),"data-slot":`toggle-button`,style:i,...o,children:t=>typeof e==`function`?e(t):e})},M=Object.assign(j,{Root:j}),N=Object.assign(k,{Root:k,Separator:A});function P(e){if(!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e6?`${V(e/1e6)}M`:t>=1e3?`${V(e/1e3)}k`:String(Math.round(e))}function F(e){return e==null||!Number.isFinite(e)?`—`:e>=1e3?`${V(e/1e3)}s`:`${Math.round(e)}ms`}function I(e){if(e==null||!Number.isFinite(e)||e<0)return`—`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r=10?t.toFixed(0):t.toFixed(1)}%`}function R(e,t){return t===`compact`?P(e):t===`percent`?L(e):t===`ms`?F(e):String(Math.round(e))}function z(e){return(e.credits||``).trim()||``}function B(e){if(e.free)return!0;let t=z(e).toLowerCase();if(!t)return!1;let n=t.match(/(\d+(?:\.\d+)?)/);return!!(n&&Number(n[1])===0)}function V(e){let t=Math.abs(e)>=10?0:1;return Number(e.toFixed(t)).toString()}function H(e){return e==null||!Number.isFinite(e)?`—`:`¥${e.toLocaleString(`zh-CN`,{minimumFractionDigits:2,maximumFractionDigits:2})}`}function U(e){return e==null||!Number.isFinite(e)?`—`:`¥${Number(e.toFixed(4))}`}function W(e){return e==null||!Number.isFinite(e)?`—`:e>=1e4?P(e):e.toLocaleString(`zh-CN`,{minimumFractionDigits:e<100?2:0,maximumFractionDigits:2})}function G(e){let t=e.completionTokens,n=e.latencyMs,r=e.ttfbMs;if(t==null||!Number.isFinite(t)||t<=0||n==null||!Number.isFinite(n)||n<=0)return null;let i=e.stream===!0&&r!=null&&Number.isFinite(r)&&r>=0&&n-r>0?(n-r)/1e3:n/1e3;if(!(i>0))return null;let a=t/i;return Number.isFinite(a)&&a>0?a:null}function K(e){return e==null||!Number.isFinite(e)||e<=0?`—`:`${e>=100?String(Math.round(e)):Number(e.toFixed(1)).toString()} tok/s`}export{R as a,L as c,z as d,B as f,P as i,K as l,M as m,I as n,W as o,N as p,H as r,F as s,G as t,U as u}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{B as r,F as i,J as a,L as o,M as s,c,d as l,j as u,q as d,s as f,u as p,z as m}from"./SharedElementTransition-BlCsXfb1.js";import{n as h}from"./label-DYYRLGoV.js";import{F as g,I as _,L as v,P as y,R as b,mt as x}from"./index-CWTBzWuK.js";var S=m({base:`toggle-button`,defaultVariants:{isIconOnly:!1,size:`md`,variant:`default`},variants:{isIconOnly:{true:`toggle-button--icon-only`},size:{lg:`toggle-button--lg`,md:`toggle-button--md`,sm:`toggle-button--sm`},variant:{default:`toggle-button--default`,ghost:`toggle-button--ghost`}}}),C=m({defaultVariants:{fullWidth:!1,isDetached:!1,orientation:`horizontal`},slots:{base:`toggle-button-group`,separator:`toggle-button-group__separator`},variants:{fullWidth:{false:{},true:{base:`toggle-button-group--full-width`}},isDetached:{false:{},true:{base:`toggle-button-group--detached`}},orientation:{horizontal:{base:`toggle-button-group--horizontal`},vertical:{base:`toggle-button-group--vertical`}}}}),w=t(e(),1),T=(0,w.createContext)({}),E=(0,w.forwardRef)(function(e,t){[e,t]=u(e,t,T);let n=(0,w.useContext)(_),r=h(n&&e.id!=null?{isSelected:n.selectedKeys.has(e.id),onChange(t){n.setSelected(e.id,t)}}:e),{buttonProps:o,isPressed:c,isSelected:f,isDisabled:m}=n&&e.id!=null?v({...e,id:e.id},n,t):b({...e,id:e.id==null?void 0:String(e.id)},r,t),{focusProps:g,isFocused:y,isFocusVisible:S}=l(e),{hoverProps:C,isHovered:E}=p({...e,isDisabled:m}),D=s({...e,id:void 0,values:{isHovered:E,isPressed:c,isFocused:y,isSelected:r.isSelected,isFocusVisible:S,isDisabled:m,state:r},defaultClassName:`react-aria-ToggleButton`}),O=d(e,{global:!0});return delete O.id,delete O.onClick,w.createElement(i.button,{...a(O,D,o,g,C),ref:t,slot:e.slot||void 0,"data-focused":y||void 0,"data-disabled":m||void 0,"data-pressed":c||void 0,"data-selected":f||void 0,"data-hovered":E||void 0,"data-focus-visible":S||void 0},w.createElement(x.Provider,{value:{isSelected:f}},D.children))}),D=n(),O=(0,w.createContext)({}),k=({children:e,className:t,fullWidth:n,isDetached:r=!1,isDisabled:i,orientation:a,size:s,...l})=>{let u=o(y),d=a??u?.orientation??`horizontal`,f=w.useMemo(()=>C({fullWidth:n,isDetached:r,orientation:d}),[n,r,d]);return(0,D.jsx)(O,{value:{slots:f,size:s,isDisabled:i},children:(0,D.jsx)(g,{className:c(t,f.base()),"data-slot":`toggle-button-group`,isDisabled:i,orientation:d,...l,children:e})})},A=({className:e,...t})=>{let{slots:n}=(0,w.use)(O);return(0,D.jsx)(r.span,{"aria-hidden":`true`,className:f(n?.separator,e),"data-slot":`toggle-button-group-separator`,...t})},j=({children:e,className:t,isIconOnly:n,size:r,style:i,variant:a,...o})=>{let s=(0,w.use)(O),l=S({isIconOnly:n,size:r??s?.size,variant:a});return(0,D.jsx)(E,{className:c(t,l),"data-slot":`toggle-button`,style:i,...o,children:t=>typeof e==`function`?e(t):e})},M=Object.assign(j,{Root:j}),N=Object.assign(k,{Root:k,Separator:A});function P(e){if(!Number.isFinite(e))return`—`;let t=Math.abs(e);return t>=1e6?`${V(e/1e6)}M`:t>=1e3?`${V(e/1e3)}k`:String(Math.round(e))}function F(e){return e==null||!Number.isFinite(e)?`—`:e>=1e3?`${V(e/1e3)}s`:`${Math.round(e)}ms`}function I(e){if(e==null||!Number.isFinite(e)||e<0)return`—`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r=10?t.toFixed(0):t.toFixed(1)}%`}function R(e,t){return t===`compact`?P(e):t===`percent`?L(e):t===`ms`?F(e):String(Math.round(e))}function z(e){return(e.credits||``).trim()||``}function B(e){if(e.free)return!0;let t=z(e).toLowerCase();if(!t)return!1;let n=t.match(/(\d+(?:\.\d+)?)/);return!!(n&&Number(n[1])===0)}function V(e){let t=Math.abs(e)>=10?0:1;return Number(e.toFixed(t)).toString()}function H(e){return e==null||!Number.isFinite(e)?`—`:`¥${e.toLocaleString(`zh-CN`,{minimumFractionDigits:2,maximumFractionDigits:2})}`}function U(e){return e==null||!Number.isFinite(e)?`—`:`¥${Number(e.toFixed(4))}`}function W(e){return e==null||!Number.isFinite(e)?`—`:e>=1e4?P(e):e.toLocaleString(`zh-CN`,{minimumFractionDigits:e<100?2:0,maximumFractionDigits:2})}function G(e){let t=e.completionTokens,n=e.latencyMs,r=e.ttfbMs;if(t==null||!Number.isFinite(t)||t<=0||n==null||!Number.isFinite(n)||n<=0)return null;let i=e.stream===!0&&r!=null&&Number.isFinite(r)&&r>=0&&n-r>0?(n-r)/1e3:n/1e3;if(!(i>0))return null;let a=t/i;return Number.isFinite(a)&&a>0?a:null}function K(e){return e==null||!Number.isFinite(e)||e<=0?`—`:`${e>=100?String(Math.round(e)):Number(e.toFixed(1)).toString()} tok/s`}export{R as a,L as c,z as d,B as f,P as i,K as l,M as m,I as n,W as o,N as p,H as r,F as s,G as t,U as u}; \ No newline at end of file diff --git a/internal/webui/static/assets/index-CAlyInAP.js b/internal/webui/static/assets/index-CWTBzWuK.js similarity index 99% rename from internal/webui/static/assets/index-CAlyInAP.js rename to internal/webui/static/assets/index-CWTBzWuK.js index 1f56dcdbc..164b2ba23 100644 --- a/internal/webui/static/assets/index-CAlyInAP.js +++ b/internal/webui/static/assets/index-CWTBzWuK.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SidebarUpdateDialog-BLCxAyNr.js","assets/shim-mfK0Rmj6.js","assets/useI18n-XrvNxGvP.js","assets/SharedElementTransition-BlCsXfb1.js","assets/PageAlert-BbN7e2aZ.js","assets/modal-CQ6c3Rhf.js","assets/Pressable-cqucQpxg.js","assets/UpdateControls-DvS7Rp4P.js","assets/LoginPage-Bkx6s23i.js","assets/InflightLiveCard-BN45lDqh.js","assets/ArrowUp.es-C5DPjo_d.js","assets/CaretRight.es-CeI6iKxy.js","assets/Check.es-DRxeSSF6.js","assets/Plus.es-BPfWzgUg.js","assets/Stack.es-B6AMU1oV.js","assets/User.es-DHjz-Tbh.js","assets/useToggle-55_Qx9vA.js","assets/label-B8hTan2F.js","assets/CompactSwitch-Dd3U4EbK.js","assets/overview-ARhe2pSk.js","assets/ProviderMark-C49bIWJW.js","assets/input-group-CQ3ozQVp.js","assets/textfield-BGZ3lXZC.js","assets/Input-CyXcxaPW.js","assets/useTextField-i0qH61mD.js","assets/textfield-DAL_YlVh.js","assets/OverviewPage-Bx7MkU6l.js","assets/TimeRangePicker-BqQpwy0D.js","assets/useUpdateEffect-DR9d7F-l.js","assets/useSpinButton-B6uyFe9J.js","assets/assertion-BLQtDfw6.js","assets/format-FfdyoNtB.js","assets/gsap-DWxn8li7.js","assets/AreaChart-BDsZfavt.js","assets/provider-BZvt2HHB.js","assets/logsLink-CBayP8Zl.js","assets/FilterToggle-BoD7X2r2.js","assets/ProvidersPage-QdKnZCML.js","assets/SearchBar-C0n-Lr5s.js","assets/search-field-DB17IAvK.js","assets/checkbox-CUZk1qce.js","assets/Checkbox-Dk73RtP8.js","assets/EmptyPanel-Bs-jQMvG.js","assets/input-CYN6ajmO.js","assets/collection-prop-injection-Csmjb87v.js","assets/number-field-BUGr_bpm.js","assets/table-iJwxYVe4.js","assets/DragAndDrop-DdMlSxLf.js","assets/useHasTabbableChild-8WJt7azf.js","assets/form-qle3Iim5.js","assets/FormRow-CL_rVm7f.js","assets/FilterSelect-CW3ACxo1.js","assets/list-box-BtjELxmv.js","assets/select-DSzMi7kM.js","assets/ModelPoolPage-B2h7PTH3.js","assets/TrashSimple.es-CiBYahWn.js","assets/ConfirmDialog-DCaOykOx.js","assets/modelPools-B7KkTfYF.js","assets/ModelPoolEditorPage-BncyTHAE.js","assets/AccessPage-DObXAGNo.js","assets/CaiaiSoftLink-CsNrM_a1.js","assets/clipboard-CWhuA-N0.js","assets/tabs-DrJPw_Nc.js","assets/LatencyStats-4FIN19Dh.js","assets/AccountsPage-DAwU5tJE.js","assets/ShieldCheck.es-CF5xuEi8.js","assets/description-Du44nrYx.js","assets/account-DCxVMo7p.js","assets/SystemPage-CzaQG9BL.js","assets/accordion-LzsgJWJ-.js","assets/keys-DEnJc6b-.js","assets/LogsPage-m7D0s5US.js","assets/useApiKeyOptions-CX9uTy6L.js","assets/UsagePage-BiZWMn4T.js","assets/KeysPage-VmzvWLOM.js"])))=>i.map(i=>d[i]); -import{a as e,c as t,i as n,n as r,o as i}from"./shim-mfK0Rmj6.js";import{C as a,E as o,F as s,I as c,L as l,M as u,N as d,P as f,S as p,T as m,X as h,Z as g,_,a as v,at as y,ct as b,d as x,dt as S,f as C,ft as ee,g as te,h as w,it as T,k as E,l as ne,lt as D,m as re,n as ie,o as ae,ot as oe,p as O,pt as k,r as A,s as se,st as ce,t as j,tt as M,u as N,ut as le,w as ue,y as de}from"./useI18n-XrvNxGvP.js";import{$ as fe,A as pe,B as me,C as he,Ct as ge,D as _e,F as ve,G as ye,H as be,J as P,K as xe,L as Se,M as Ce,N as we,O as Te,P as Ee,Q as De,St as Oe,T as ke,U as Ae,V as je,W as Me,X as Ne,Y as Pe,Z as Fe,_t as Ie,a as Le,at as Re,b as ze,bt as Be,c as Ve,ct as He,dt as Ue,f as We,ft as Ge,h as Ke,ht as qe,i as Je,it as Ye,j as Xe,k as Ze,l as Qe,lt as $e,m as et,mt as tt,n as nt,nt as rt,o as it,p as at,pt as ot,q as st,r as ct,rt as lt,s as ut,st as dt,t as ft,tt as F,u as pt,ut as mt,v as ht,w as gt,x as _t,y as vt,yt,z as bt}from"./SharedElementTransition-BlCsXfb1.js";import{I as xt,L as St,M as Ct,N as wt,P as Tt,g as Et}from"./overview-ARhe2pSk.js";import{t as Dt}from"./gsap-DWxn8li7.js";(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 Ot=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,E());else{var t=n(l);t!==null&&re(x,t.startTime-e)}}}var S=!1,C=-1,ee=5,te=-1;function w(){return g?!0:!(e.unstable_now()-tet&&w());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&re(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?E():S=!1}}}var E;if(typeof y==`function`)E=function(){y(T)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,D=ne.port2;ne.port1.onmessage=T,E=function(){D.postMessage(null)}}else E=function(){_(T,0)};function re(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,re(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,E()))),r},e.unstable_shouldYield=w,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),kt=i(((e,t)=>{t.exports=Ot()})),At=i((t=>{var r=kt(),i=e(),a=n();function o(e){var t=`https://react.dev/errors/`+e;if(1ce||(e.current=se[ce],se[ce]=null,ce--)}function N(e,t){ce++,se[ce]=e.current,e.current=t}var le=j(null),ue=j(null),de=j(null),fe=j(null);function pe(e,t){switch(N(de,t),N(ue,e),N(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}M(le),N(le,e)}function me(){M(le),M(ue),M(de)}function he(e){e.memoizedState!==null&&N(fe,e);var t=le.current,n=Hd(t,e.type);t!==n&&(N(ue,e),N(le,n))}function ge(e){ue.current===e&&(M(le),M(ue)),fe.current===e&&(M(fe),Qf._currentValue=A)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1i.map(i=>d[i]); +import{a as e,c as t,i as n,n as r,o as i}from"./shim-mfK0Rmj6.js";import{C as a,E as o,F as s,I as c,L as l,M as u,N as d,P as f,S as p,T as m,X as h,Z as g,_,a as v,at as y,ct as b,d as x,dt as S,f as C,ft as ee,g as te,h as w,it as T,k as E,l as ne,lt as D,m as re,n as ie,o as ae,ot as oe,p as O,pt as k,r as A,s as se,st as ce,t as j,tt as M,u as N,ut as le,w as ue,y as de}from"./useI18n-BAo1UrJW.js";import{$ as fe,A as pe,B as me,C as he,Ct as ge,D as _e,F as ve,G as ye,H as be,J as P,K as xe,L as Se,M as Ce,N as we,O as Te,P as Ee,Q as De,St as Oe,T as ke,U as Ae,V as je,W as Me,X as Ne,Y as Pe,Z as Fe,_t as Ie,a as Le,at as Re,b as ze,bt as Be,c as Ve,ct as He,dt as Ue,f as We,ft as Ge,h as Ke,ht as qe,i as Je,it as Ye,j as Xe,k as Ze,l as Qe,lt as $e,m as et,mt as tt,n as nt,nt as rt,o as it,p as at,pt as ot,q as st,r as ct,rt as lt,s as ut,st as dt,t as ft,tt as F,u as pt,ut as mt,v as ht,w as gt,x as _t,y as vt,yt,z as bt}from"./SharedElementTransition-BlCsXfb1.js";import{I as xt,L as St,M as Ct,N as wt,P as Tt,g as Et}from"./overview-ARhe2pSk.js";import{t as Dt}from"./gsap-DWxn8li7.js";(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 Ot=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,E());else{var t=n(l);t!==null&&re(x,t.startTime-e)}}}var S=!1,C=-1,ee=5,te=-1;function w(){return g?!0:!(e.unstable_now()-tet&&w());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&re(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?E():S=!1}}}var E;if(typeof y==`function`)E=function(){y(T)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,D=ne.port2;ne.port1.onmessage=T,E=function(){D.postMessage(null)}}else E=function(){_(T,0)};function re(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,re(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,E()))),r},e.unstable_shouldYield=w,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),kt=i(((e,t)=>{t.exports=Ot()})),At=i((t=>{var r=kt(),i=e(),a=n();function o(e){var t=`https://react.dev/errors/`+e;if(1ce||(e.current=se[ce],se[ce]=null,ce--)}function N(e,t){ce++,se[ce]=e.current,e.current=t}var le=j(null),ue=j(null),de=j(null),fe=j(null);function pe(e,t){switch(N(de,t),N(ue,e),N(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}M(le),N(le,e)}function me(){M(le),M(ue),M(de)}function he(e){e.memoizedState!==null&&N(fe,e);var t=le.current,n=Hd(t,e.type);t!==n&&(N(ue,e),N(le,n))}function ge(e){ue.current===e&&(M(le),M(ue)),fe.current===e&&(M(fe),Qf._currentValue=A)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1)`:-1 to {t&&t()};return I.createElement(o,null,I.createElement(`button`,{...i,tabIndex:-1,onClick:a,style:{width:1,height:1}}))}var ys=I.forwardRef(({children:e,...t},n)=>{let r=(0,I.useRef)(!1),i=(0,I.useContext)(Ke),a=P(i||{},{...t,register(){r.current=!0,i&&i.register()}});return a.ref=ye(n||i?.ref),Ae(i,a.ref),(0,I.useEffect)(()=>{r.current||=!0},[]),I.createElement(Ke.Provider,{value:a},e)});function bs({children:e}){let t=(0,I.useMemo)(()=>({register:()=>{}}),[]);return I.createElement(Ke.Provider,{value:t},e)}var xs=t(n(),1),Ss=I.createContext(null);function Cs(e){let t=mt(),{portalContainer:n=t?null:document.body,isExiting:r}=e,[i,a]=(0,I.useState)(!1),o=(0,I.useMemo)(()=>({contain:i,setContain:a}),[i,a]),{getContainer:s}=m();if(!e.portalContainer&&s&&(n=s()),!n)return null;let c=e.children;return e.disableFocusManagement||(c=I.createElement(Je,{restoreFocus:!0,contain:(e.shouldContainFocus||i)&&!r},c)),c=I.createElement(Ss.Provider,{value:o},I.createElement(bs,null,I.createElement(ze.Provider,{value:null},c))),xs.createPortal(c,n)}function ws(){let e=(0,I.useContext)(Ss)?.setContain;Ue(()=>{e?.(!0)},[e])}var Ts=(0,I.createContext)(null),Es=(0,I.createContext)(null),Ds=(0,I.forwardRef)(function(e,t){[e,t]=Xe(e,t,Ts);let n=(0,I.useContext)(Ll),r=ue(e),i=e.isOpen!=null||e.defaultOpen!=null||!n?r:n,a=T(t,i.isOpen),o=e.isExiting||!e.shouldSkipAnimation&&a||!1,s=M(),{direction:c}=Ze();if(s){let t=e.children;return typeof t==`function`&&(t=t({trigger:e.trigger||null,placement:`bottom`,isEntering:!1,isExiting:!1,defaultChildren:null})),I.createElement(I.Fragment,null,t)}return i&&!i.isOpen&&!o?null:I.createElement(Os,{...e,triggerRef:e.triggerRef,state:i,popoverRef:t,isExiting:o,dir:c})});function Os({state:e,isExiting:t,UNSTABLE_portalContainer:n,clearContexts:r,...i}){let a=(0,I.useRef)(null),o=(0,I.useRef)(null),s=(0,I.useContext)(Es),c=s&&i.trigger===`SubmenuTrigger`,{popoverProps:l,underlayProps:u,arrowProps:d,placement:p,triggerAnchorPoint:m}=Fo({...i,offset:i.offset??8,arrowRef:a,groupRef:c?s:o},e),h=i.popoverRef,g=y(h,!!p),_=i.isEntering||!i.shouldSkipAnimation&&g||!1,v=Ce({...i,defaultClassName:`react-aria-Popover`,values:{trigger:i.trigger||null,placement:p,isEntering:_,isExiting:t}}),b=!i.isNonModal||i.trigger===`SubmenuTrigger`||i.trigger===`PreviewTrigger`,[x,S]=(0,I.useState)(i.trigger===`PreviewTrigger`);Ue(()=>{h.current&&S(b&&!h.current.querySelector(`[role=dialog]`))},[h,b]),(0,I.useEffect)(()=>{x&&i.trigger!==`PreviewTrigger`&&(i.trigger!==`SubmenuTrigger`||gt()!==`pointer`)&&h.current&&!De(h.current)&&he(h.current)},[x,h,i.trigger]);let C=(0,I.useMemo)(()=>{let e=v.children;if(r)for(let t of r)e=I.createElement(t.Provider,{value:null},e);return e},[v.children,r]),[ee,te]=(0,I.useState)(null),w=(0,I.useCallback)(()=>{i.triggerRef.current&&te(i.triggerRef.current.getBoundingClientRect().width+`px`)},[i.triggerRef]);Ue(w,[w]),D({ref:v.style?.[`--trigger-width`]?void 0:i.triggerRef,onResize:w});let T={...l.style,"--trigger-anchor-point":m?`${m.x}px ${m.y}px`:void 0,...v.style,"--trigger-width":v.style?.[`--trigger-width`]||ee},E=I.createElement(ve.div,{...P(st(i,{global:!0}),l),...v,id:x?i.id:void 0,role:x?`dialog`:void 0,tabIndex:x?-1:void 0,"aria-label":i[`aria-label`],"aria-labelledby":i[`aria-labelledby`],ref:h,slot:i.slot||void 0,style:T,dir:i.dir,"data-trigger":i.trigger,"data-placement":p,"data-entering":_||void 0,"data-exiting":t||void 0},!i.isNonModal&&I.createElement(vs,{onDismiss:e.close}),I.createElement(f.Provider,{value:{...d,placement:p,ref:a}},C),I.createElement(vs,{onDismiss:e.close}));return c?I.createElement(Cs,{...i,shouldContainFocus:x&&i.trigger!==`PreviewTrigger`,isExiting:t,portalContainer:n??s?.current??void 0},E):I.createElement(Cs,{...i,shouldContainFocus:x&&i.trigger!==`PreviewTrigger`,isExiting:t,portalContainer:n},!i.isNonModal&&e.isOpen&&I.createElement(`div`,{"data-testid":`underlay`,...u,style:{position:`fixed`,inset:0}}),I.createElement(`div`,{ref:o,style:{display:`contents`}},I.createElement(Es.Provider,{value:o},E)))}var ks=(0,I.createContext)(null),As={CollectionRoot({collection:e,renderDropIndicator:t}){return js(e,null,t)},CollectionBranch({collection:e,parent:t,renderDropIndicator:n}){return js(e,t,n)}};function js(e,t,n){return _({items:t?e.getChildren(t.key):e,dependencies:[n],children(t){if(t.type===`content`)return I.createElement(I.Fragment,null);let r=t.render(t);return!n||t.type!==`item`?r:I.createElement(I.Fragment,null,n({type:`item`,key:t.key,dropPosition:`before`}),r,Ms(e,t,n))}})}function Ms(e,t,n){let r=t.key,i=e.getKeyAfter(r),a=i==null?null:e.getItem(i);for(;a!=null&&a.type!==`item`;)i=e.getKeyAfter(a.key),a=i==null?null:e.getItem(i);let o=t.nextKey==null?null:e.getItem(t.nextKey);for(;o!=null&&o.type!==`item`;)o=o.nextKey==null?null:e.getItem(o.nextKey);let s=[];if(o==null){let r=t;for(;r?.type===`item`&&(!a||r.parentKey!==a.parentKey&&a.levele==null?null:new Set([e]),[e])}var Fs=(0,I.createContext)({}),Is=(0,I.createContext)({}),Ls=(0,I.createContext)({isSelected:!1}),Rs=(0,I.forwardRef)(function(e,t){[e,t]=Xe(e,t,Ls);let{isSelected:n,...r}=e;return I.createElement(nt,{...r,ref:t,className:e.className||`react-aria-SelectionIndicator`,name:`SelectionIndicator`,isVisible:n})}),zs={};zs={longPressMessage:`اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة`};var Bs={};Bs={longPressMessage:`Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто`};var Vs={};Vs={longPressMessage:`Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku`};var Hs={};Hs={longPressMessage:`Langt tryk eller tryk på Alt + pil ned for at åbne menuen`};var Us={};Us={longPressMessage:`Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen`};var Ws={};Ws={longPressMessage:`Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού`};var Gs={};Gs={longPressMessage:`Long press or press Alt + ArrowDown to open menu`};var Ks={};Ks={longPressMessage:`Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú`};var qs={};qs={longPressMessage:`Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool`};var Js={};Js={longPressMessage:`Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli`};var Ys={};Ys={longPressMessage:`Appuyez de manière prolongée ou appuyez sur Alt\xA0+\xA0Flèche vers le bas pour ouvrir le menu.`};var Xs={};Xs={longPressMessage:`לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט`};var Zs={};Zs={longPressMessage:`Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika`};var Qs={};Qs={longPressMessage:`Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához`};var $s={};$s={longPressMessage:`Premi a lungo o premi Alt + Freccia giù per aprire il menu`};var ec={};ec={longPressMessage:`長押しまたは Alt+下矢印キーでメニューを開く`};var tc={};tc={longPressMessage:`길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기`};var nc={};nc={longPressMessage:`Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.`};var rc={};rc={longPressMessage:`Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa`};var ic={};ic={longPressMessage:`Langt trykk eller trykk Alt + PilNed for å åpne menyen`};var ac={};ac={longPressMessage:`Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen`};var oc={};oc={longPressMessage:`Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu`};var sc={};sc={longPressMessage:`Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu`};var cc={};cc={longPressMessage:`Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu`};var lc={};lc={longPressMessage:`Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul`};var uc={};uc={longPressMessage:`Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню`};var dc={};dc={longPressMessage:`Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol`};var fc={};fc={longPressMessage:`Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol`};var pc={};pc={longPressMessage:`Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni`};var mc={};mc={longPressMessage:`Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn`};var hc={};hc={longPressMessage:`Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın`};var gc={};gc={longPressMessage:`Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню`};var _c={};_c={longPressMessage:`长按或按 Alt + 向下方向键以打开菜单`};var vc={};vc={longPressMessage:`長按或按 Alt+向下鍵以開啟功能表`};var yc={};yc={"ar-AE":zs,"bg-BG":Bs,"cs-CZ":Vs,"da-DK":Hs,"de-DE":Us,"el-GR":Ws,"en-US":Gs,"es-ES":Ks,"et-EE":qs,"fi-FI":Js,"fr-FR":Ys,"he-IL":Xs,"hr-HR":Zs,"hu-HU":Qs,"it-IT":$s,"ja-JP":ec,"ko-KR":tc,"lt-LT":nc,"lv-LV":rc,"nb-NO":ic,"nl-NL":ac,"pl-PL":oc,"pt-BR":sc,"pt-PT":cc,"ro-RO":lc,"ru-RU":uc,"sk-SK":dc,"sl-SI":fc,"sr-SP":pc,"sv-SE":mc,"tr-TR":hc,"uk-UA":gc,"zh-CN":_c,"zh-TW":vc};var bc=500;function xc(e){let{isDisabled:t,pointerType:n,onLongPressStart:r,onLongPressEnd:i,onLongPress:a,threshold:o=bc,accessibilityDescription:s}=e,c=(0,I.useRef)(void 0),{addGlobalListener:l,removeAllGlobalListeners:u}=xe(),d=e=>n?e.pointerType===n:e.pointerType===`mouse`||e.pointerType===`touch`,{pressProps:f}=et({isDisabled:t,onPressStart(e){if(e.continuePropagation(),d(e)){r&&r({...e,type:`longpressstart`}),c.current=setTimeout(()=>{e.target.dispatchEvent(new PointerEvent(`pointercancel`,{bubbles:!0})),l(e.target,`click`,e=>e.preventDefault(),{once:!0}),Ye(e.target).activeElement!==e.target&&Ie(e.target),a&&a({...e,type:`longpress`}),c.current=void 0},o),e.pointerType===`touch`&&l(e.target,`contextmenu`,e=>e.preventDefault(),{once:!0});let t=Re(e.target);l(t,`pointerup`,()=>{setTimeout(()=>{u()},100)},{once:!0})}},onPressEnd(e){c.current&&clearTimeout(c.current),i&&d(e)&&i({...e,type:`longpressend`})}}),p=io(a&&!t?s:void 0);return{longPressProps:P(f,p)}}function Sc(e){let{onContextMenu:t}=e,n=(0,I.useRef)(!1),{longPressProps:r}=xc({onLongPressStart(){n.current=!1},onLongPress(e){n.current?n.current=!1:t?.({target:e.target,x:e.x,y:e.y})}});return t?{contextMenuProps:P(ge()?r:{},{onContextMenu(e){e.stopPropagation(),e.preventDefault(),n.current=!0;let r=e.currentTarget.getBoundingClientRect();t({target:e.currentTarget,x:e.clientX-r.x,y:e.clientY-r.y})},onKeyDown(e){if(Be()&&e.ctrlKey&&e.key===`Enter`){n.current=!1;let r=e.currentTarget;e.stopPropagation(),setTimeout(()=>{if(n.current)n.current=!1;else{let e=r.getBoundingClientRect();t({target:r,x:e.width/2,y:e.height/2})}},10)}}})}:{contextMenuProps:{}}}function Cc(e,t,n){let{type:r}=e,{isOpen:i}=t;(0,I.useEffect)(()=>{n&&n.current&&d.set(n.current,t.close)});let a;r===`menu`?a=!0:r===`listbox`&&(a=`listbox`);let o=$e();return{triggerProps:{"aria-haspopup":a,"aria-expanded":i,"aria-controls":i?o:void 0,onPress:t.toggle},overlayProps:{id:o}}}function wc(e){return e&&e.__esModule?e.default:e}function Tc(e,t,n){let{type:r=`menu`,isDisabled:i,trigger:a=`press`}=e,o=$e(),{triggerProps:s,overlayProps:c}=Cc({type:r},t,n),l=(e,n,r=`first`)=>{if(!e||n.isDefaultPrevented())return!1;t.toggle(r)},{keyboardProps:u}=_t({isDisabled:i,shortcuts:{Enter:e=>l(a!==`longPress`,e,`first`)," ":e=>l(a!==`longPress`,e,`first`),ArrowDown:e=>l(a!==`longPress`,e,`first`),ArrowUp:e=>l(a!==`longPress`,e,`last`),"Alt+Enter":e=>l(a===`longPress`,e,`first`),"Alt+ ":e=>l(a===`longPress`,e,`first`),"Alt+ArrowDown":e=>l(!0,e,`first`),"Alt+ArrowUp":e=>l(!0,e,`last`)}}),d=E(wc(yc),`@react-aria/menu`),{longPressProps:f}=xc({isDisabled:i||a!==`longPress`,accessibilityDescription:d.format(`longPressMessage`),onLongPressStart(){t.close()},onLongPress(){t.open(`first`)}}),p={preventFocusOnPress:!0,onPressStart(e){e.pointerType!==`touch`&&e.pointerType!==`keyboard`&&!i&&(Ie(e.target),t.open(e.pointerType===`virtual`?`first`:null))},onPress(e){e.pointerType===`touch`&&!i&&(Ie(e.target),t.toggle())}};delete s.onPress;let{contextMenuProps:m}=Sc({onContextMenu(e){let n=e.target.getBoundingClientRect();t.setPoint({x:n.x+e.x,y:n.y+e.y}),t.open()}});(0,I.useEffect)(()=>{if(t.isOpen&&a===`contextMenu`){let e=e=>{(e.button===2||e.button===0&&e.ctrlKey===!0)&&F(e)===document.body&&t.close()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)}},[t,a]);let h;if(a===`press`)h={...p,...u};else if(a===`longPress`)h={...f,...u};else if(a===`contextMenu`){h=m;let{"aria-haspopup":e,"aria-expanded":t,"aria-controls":n,...r}=s;s=r}return{menuTriggerProps:{...s,...h,id:o},menuProps:{...c,"aria-labelledby":o,autoFocus:t.focusStrategy||!0,onClose:t.close}}}var Ec=new WeakMap;function Dc(e){return Oe()?e.altKey:e.ctrlKey}function Oc(e,t){let n=`[data-key="${CSS.escape(String(t))}"]`,r=e.current?.dataset.collection;return r&&(n=`[data-collection="${CSS.escape(r)}"]${n}`),e.current?.querySelector(n)}var kc=new WeakMap;function Ac(e){let t=$e();return kc.set(e,t),t}function jc(e){return kc.get(e)}var Mc=1e3;function Nc(e){let{keyboardDelegate:t,selectionManager:n,onTypeSelect:r}=e,i=(0,I.useRef)({search:``,timeout:void 0});return(0,I.useEffect)(()=>{let e=i.current.timeout;return()=>{clearTimeout(e)}},[i]),{typeSelectProps:{onKeyDownCapture:t.getKeyForSearch?e=>{if(i.current.search.length>0&&e.key===` `){if(e.preventDefault(),(!(`continuePropagation`in e)||`continuePropagation`in e&&!e.isPropagationStopped())&&e.stopPropagation(),i.current.search+=` `,t.getKeyForSearch!=null){let e=t.getKeyForSearch(i.current.search,n.focusedKey);e??=t.getKeyForSearch(i.current.search),e!=null&&(n.setFocusedKey(e),r&&r(e))}clearTimeout(i.current.timeout),i.current.timeout=setTimeout(()=>{i.current.search=``},Mc)}}:void 0,onKeyDown:t.getKeyForSearch?e=>{let a=Pc(e.key);if(!(!a||e.ctrlKey||e.metaKey||e.altKey||!Fe(e.currentTarget,F(e))||i.current.search.length===0&&a===` `)){if(i.current.search+=a,t.getKeyForSearch!=null){let a=t.getKeyForSearch(i.current.search,n.focusedKey);if(a??=t.getKeyForSearch(i.current.search),a!=null)n.setFocusedKey(a),r&&r(a),e.preventDefault(),`continuePropagation`in e||e.stopPropagation();else{i.current.search=``,clearTimeout(i.current.timeout),i.current.timeout=void 0;return}}clearTimeout(i.current.timeout),i.current.timeout=setTimeout(()=>{i.current.search=``},Mc)}}:void 0}}}function Pc(e){return e.length===1||!/^[A-Z]/i.test(e)?e:``}function Fc(e){let{selectionManager:t,keyboardDelegate:n,ref:r,autoFocus:i=!1,shouldFocusWrap:a=!1,disallowEmptySelection:o=!1,disallowSelectAll:s=!1,escapeKeyBehavior:c=`clearSelection`,selectOnFocus:l=t.selectionBehavior===`replace`,disallowTypeAhead:u=!1,shouldUseVirtualFocus:d,allowsTabNavigation:f=!1,scrollRef:p=r,linkBehavior:m=`action`,UNSTABLE_focusOnEntry:h}=e,{direction:g}=Ze(),_=qe(),v=(e,n,i)=>{if(n!=null){if(t.isLink(n)&&m===`selection`&&l&&!Dc(e)){(0,xs.flushSync)(()=>{t.setFocusedKey(n,i)});let a=Oc(r,n),o=t.getItemProps(n);if(a){_.open(a,e,o.href,o.routerOptions);return}return!1}if(t.setFocusedKey(n,i),t.isLink(n)&&m===`override`)return!1;if(e.shiftKey&&t.selectionMode===`multiple`){t.extendSelection(n);return}if(l&&!Dc(e)){t.replaceSelection(n);return}}return!1},y=e=>{if(n.getKeyBelow){let r=t.focusedKey==null?n.getFirstKey?.():n.getKeyBelow?.(t.focusedKey);if(r==null&&a&&(r=n.getFirstKey?.(t.focusedKey)),r!=null){v(e,r);return}}return!1},b=e=>{if(n.getKeyAbove){let r=t.focusedKey==null?n.getLastKey?.():n.getKeyAbove?.(t.focusedKey);if(r==null&&a&&(r=n.getLastKey?.(t.focusedKey)),r!=null){v(e,r);return}}return!1},te=e=>{if(n.getFirstKey){if(t.focusedKey===null&&e.shiftKey)return!1;let r=n.getFirstKey(t.focusedKey,ce(e));if(t.setFocusedKey(r),r!=null){if(ce(e)&&e.shiftKey&&t.selectionMode===`multiple`){t.extendSelection(r);return}if(l){t.replaceSelection(r);return}}}return!1},w=e=>{if(n.getKeyLeftOf){let r=t.focusedKey==null?n.getFirstKey?.():n.getKeyLeftOf?.(t.focusedKey);if(r==null&&a&&(r=g===`rtl`?n.getFirstKey?.(t.focusedKey):n.getLastKey?.(t.focusedKey)),r!=null){v(e,r,g===`rtl`?`first`:`last`);return}}return!1},T=e=>{if(n.getKeyRightOf){let r=t.focusedKey==null?n.getFirstKey?.():n.getKeyRightOf?.(t.focusedKey);if(r==null&&a&&(r=g===`rtl`?n.getLastKey?.(t.focusedKey):n.getFirstKey?.(t.focusedKey)),r!=null){v(e,r,g===`rtl`?`last`:`first`);return}}return!1},E=e=>{if(n.getLastKey){if(t.focusedKey===null&&e.shiftKey)return!1;let r=n.getLastKey(t.focusedKey,ce(e));if(t.setFocusedKey(r),r!=null){if(ce(e)&&e.shiftKey&&t.selectionMode===`multiple`){t.extendSelection(r);return}if(l){t.replaceSelection(r);return}}}return!1},ne=e=>{if(n.getKeyPageBelow&&t.focusedKey!=null){let r=n.getKeyPageBelow(t.focusedKey);if(r!=null)return v(e,r)}return!1},D=e=>{if(n.getKeyPageAbove&&t.focusedKey!=null){let r=n.getKeyPageAbove(t.focusedKey);if(r!=null)return v(e,r)}return!1},re=()=>{if(t.selectionMode===`multiple`&&s!==!0){t.selectAll();return}return!1},ie=()=>{if(c===`clearSelection`&&!o&&t.selectedKeys.size!==0){t.clearSelection();return}return!1},ae=()=>{if(!f&&r.current){let e=Le(r.current,{tabbable:!0}),t,n;do n=e.lastChild(),n&&(t=n);while(n);let i=fe();t&&(!De(t)||i&&!be(i))&&Ie(t)}return{shouldContinuePropagation:!0,shouldPreventDefault:!1}},O=()=>(!f&&r.current&&r.current.focus(),{shouldContinuePropagation:!0,shouldPreventDefault:!1}),k=(e,t)=>({[Be()?e+`+Shift+Alt`:e+`+Shift+Control`]:t,[e+`+Shift`]:t,[Be()?e+`+Alt`:e+`+Control`]:t,[e]:t}),{keyboardProps:A}=_t({shortcuts:{...k(`ArrowDown`,y),...k(`ArrowUp`,b),...k(`ArrowLeft`,w),...k(`ArrowRight`,T),...k(`PageDown`,ne),...k(`PageUp`,D)},allowRepeats:!0}),{keyboardProps:se}=_t({shortcuts:{...k(`Home`,te),...k(`End`,E),"Mod+A":re,Escape:ie,Tab:ae,"Tab+Shift":O}}),j=(0,I.useRef)({top:0,left:0});oe(p,`scroll`,()=>{j.current={top:p.current?.scrollTop??0,left:p.current?.scrollLeft??0}});let M=e=>{if(t.isFocused){Fe(e.currentTarget,F(e))||t.setFocused(!1);return}if(!Fe(e.currentTarget,F(e)))return;let i=gt();t.setFocused(!0);let a=e=>{e!=null&&(t.setFocusedKey(e),l&&!t.isSelected(e)&&t.replaceSelection(e))};if(h&&(i===`keyboard`||i===`virtual`))a(h===`first`?n.getFirstKey?.():n.getLastKey?.());else if(t.focusedKey==null){let r=e.relatedTarget;r&&e.currentTarget.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING?a(t.lastSelectedKey??n.getLastKey?.()):a(t.firstSelectedKey??n.getFirstKey?.())}else p.current&&(p.current.scrollTop=j.current.top,p.current.scrollLeft=j.current.left);if(t.focusedKey!=null&&p.current){let e=Oc(r,t.focusedKey);e instanceof HTMLElement&&(!De(e)&&!d&&Ie(e),(i===`keyboard`||h&&i===`virtual`)&&oo(e,{containingElement:r.current}))}},N=e=>{Fe(e.currentTarget,e.relatedTarget)||t.setFocused(!1)},le=(0,I.useRef)(!1);oe(r,ee,d?e=>{let{detail:n}=e;e.stopPropagation(),t.setFocused(!0),n?.focusStrategy===`first`&&(le.current=!0)}:void 0);let ue=n.getFirstKey?.()??null;Ya(()=>{if(le.current){if(ue==null){let e=fe();C(r.current),x(e,null),t.collection.size>0&&(le.current=!1)}else t.setFocusedKey(ue),le.current=!1}},[ue,t.collection.size]),Ya(()=>{t.collection.size>0&&(le.current=!1)},[t.focusedKey]),oe(r,S,d?e=>{e.stopPropagation(),t.setFocused(!1),e.detail?.clearFocusKey&&t.setFocusedKey(null)}:void 0);let de=(0,I.useRef)(i),pe=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(de.current){let e=null;i===`first`&&(e=n.getFirstKey?.()??null),i===`last`&&(e=n.getLastKey?.()??null);let a=t.selectedKeys;if(a.size){for(let n of a)if(t.canSelectItem(n)){e=n;break}}t.setFocused(!0),t.setFocusedKey(e),e==null&&!d&&r.current&&he(r.current),t.collection.size>0&&(de.current=!1,pe.current=!0)}});let me=(0,I.useRef)(t.focusedKey),ge=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(t.isFocused&&t.focusedKey!=null&&(t.focusedKey!==me.current||pe.current)&&p.current&&r.current){let e=gt(),n=Oc(r,t.focusedKey);if(!(n instanceof HTMLElement))return;(e===`keyboard`||pe.current)&&(ge.current&&cancelAnimationFrame(ge.current),ge.current=requestAnimationFrame(()=>{p.current&&(ao(p.current,n),e!==`virtual`&&oo(n,{containingElement:r.current}))}))}!d&&t.isFocused&&t.focusedKey==null&&me.current!=null&&r.current&&he(r.current),me.current=t.focusedKey,pe.current=!1}),(0,I.useEffect)(()=>()=>{ge.current&&cancelAnimationFrame(ge.current)},[]),oe(r,`react-aria-focus-scope-restore`,e=>{e.preventDefault(),t.setFocused(!0)});let _e={...P(se,A),onFocus:M,onBlur:N,onMouseDown(e){p.current===F(e)&&e.preventDefault()}},{typeSelectProps:ve}=Nc({keyboardDelegate:n,selectionManager:t});u||(_e=P(ve,_e));let ye;d||(ye=t.focusedKey==null?0:-1);let xe=Ac(t.collection);return{collectionProps:P(_e,{tabIndex:ye,"data-collection":xe})}}var Ic=class{constructor(e){this.ref=e}getItemRect(e){let t=this.ref.current;if(!t)return null;let n=e==null?null:Oc(this.ref,e);if(!n)return null;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect();return{x:i.left-r.left-t.clientLeft+t.scrollLeft,y:i.top-r.top-t.clientTop+t.scrollTop,width:i.width,height:i.height}}getContentSize(){let e=this.ref.current;return{width:e?.scrollWidth??0,height:e?.scrollHeight??0}}getVisibleRect(){let e=this.ref.current;return{x:e?.scrollLeft??0,y:e?.scrollTop??0,width:e?.clientWidth??0,height:e?.clientHeight??0}}},Lc=class{constructor(...e){if(e.length===1){let t=e[0];this.collection=t.collection,this.ref=t.ref,this.collator=t.collator,this.disabledKeys=t.disabledKeys||new Set,this.disabledBehavior=t.disabledBehavior||`all`,this.orientation=t.orientation||`vertical`,this.direction=t.direction,this.layout=t.layout||`stack`,this.layoutDelegate=t.layoutDelegate||new Ic(t.ref)}else this.collection=e[0],this.disabledKeys=e[1],this.ref=e[2],this.collator=e[3],this.layout=`stack`,this.orientation=`vertical`,this.disabledBehavior=`all`,this.layoutDelegate=new Ic(this.ref);this.layout===`stack`&&this.orientation===`vertical`&&(this.getKeyLeftOf=void 0,this.getKeyRightOf=void 0)}isDisabled(e){return this.disabledBehavior===`all`&&(e.props?.isDisabled||this.disabledKeys.has(e.key))&&e.props?.disabledBehavior!==`selection`}findNextNonDisabled(e,t,n=!1){let r=e;for(;r!=null;){let e=this.collection.getItem(r);if(e?.type===`item`&&(n||!this.isDisabled(e)))return r;r=t(r)}return null}getNextKey(e,t){let n=e;return n=this.collection.getKeyAfter(n),this.findNextNonDisabled(n,e=>this.collection.getKeyAfter(e),t?.includeDisabled)}getPreviousKey(e,t){let n=e;return n=this.collection.getKeyBefore(n),this.findNextNonDisabled(n,e=>this.collection.getKeyBefore(e),t?.includeDisabled)}findKey(e,t,n){let r=e,i=this.layoutDelegate.getItemRect(r);if(!i||r==null)return null;let a=i;do{if(r=t(r),r==null)break;i=this.layoutDelegate.getItemRect(r)}while(i&&n(a,i)&&r!=null);return r}isSameRow(e,t){return e.y===t.y||e.x!==t.x}isSameColumn(e,t){return e.x===t.x||e.y!==t.y}isReversed(e){let t=this.getNextKey(e),n=Oc(this.ref,e);if(t!=null){let e=Oc(this.ref,t);return!n||!e?!1:n.getBoundingClientRect().top>e.getBoundingClientRect().top}let r=this.getPreviousKey(e);if(r!=null){let e=Oc(this.ref,r);return!n||!e?!1:e.getBoundingClientRect().top>n.getBoundingClientRect().top}return!1}getKeyBelow(e,t){return this.layout===`grid`&&this.orientation===`vertical`?this.findKey(e,e=>this.getNextKey(e,t),this.isSameRow):this.orientation===`vertical`&&this.isReversed(e)?this.getPreviousKey(e,t):this.getNextKey(e,t)}getKeyAbove(e,t){return this.layout===`grid`&&this.orientation===`vertical`?this.findKey(e,e=>this.getPreviousKey(e,t),this.isSameRow):this.orientation===`vertical`&&this.isReversed(e)?this.getNextKey(e,t):this.getPreviousKey(e,t)}getNextColumn(e,t,n){return t?this.getPreviousKey(e,n):this.getNextKey(e,n)}getKeyRightOf(e,t){let n=this.direction===`ltr`?`getKeyRightOf`:`getKeyLeftOf`;return this.layoutDelegate[n]?(e=this.layoutDelegate[n](e),this.findNextNonDisabled(e,e=>this.layoutDelegate[n](e),t?.includeDisabled)):this.layout===`grid`?this.orientation===`vertical`?this.getNextColumn(e,this.direction===`rtl`,t):this.findKey(e,e=>this.getNextColumn(e,this.direction===`rtl`,t),this.isSameColumn):this.orientation===`horizontal`?this.getNextColumn(e,this.direction===`rtl`,t):null}getKeyLeftOf(e,t){let n=this.direction===`ltr`?`getKeyLeftOf`:`getKeyRightOf`;return this.layoutDelegate[n]?(e=this.layoutDelegate[n](e),this.findNextNonDisabled(e,e=>this.layoutDelegate[n](e),t?.includeDisabled)):this.layout===`grid`?this.orientation===`vertical`?this.getNextColumn(e,this.direction===`ltr`,t):this.findKey(e,e=>this.getNextColumn(e,this.direction===`ltr`,t),this.isSameColumn):this.orientation===`horizontal`?this.getNextColumn(e,this.direction===`ltr`,t):null}getFirstKey(){let e=this.collection.getFirstKey();return this.findNextNonDisabled(e,e=>this.collection.getKeyAfter(e))}getLastKey(){let e=this.collection.getLastKey();return this.findNextNonDisabled(e,e=>this.collection.getKeyBefore(e))}getKeyPageAbove(e){let t=this.ref.current,n=this.layoutDelegate.getItemRect(e);if(!n)return null;let r=this.isReversed(e);if(t&&!Xa(t))return this.getFirstKey();let i=e;if(this.orientation===`horizontal`){let e=Math.max(0,n.x+n.width-this.layoutDelegate.getVisibleRect().width);for(;n&&n.x>e&&i!=null;)i=this.getKeyAbove(i),n=i==null?null:this.layoutDelegate.getItemRect(i)}else{let e=this.layoutDelegate.getVisibleRect(),t=r?n.y-e.height:Math.max(0,n.y+n.height-e.height);for(;n&&n.y>t&&i!=null;)i=this.getKeyAbove(i),n=i==null?null:this.layoutDelegate.getItemRect(i)}return i??(r?this.getLastKey():this.getFirstKey())}getKeyPageBelow(e){let t=this.ref.current,n=this.layoutDelegate.getItemRect(e);if(!n)return null;let r=this.isReversed(e);if(t&&!Xa(t))return this.getLastKey();let i=e;if(this.orientation===`horizontal`){let e=Math.min(this.layoutDelegate.getContentSize().width,n.x-n.width+this.layoutDelegate.getVisibleRect().width);for(;n&&n.xe[0]a||new Lc({collection:n,disabledKeys:r,disabledBehavior:l,ref:i,collator:c,layoutDelegate:o,orientation:s}),[a,o,n,r,i,c,l,s]),{collectionProps:d}=Fc({...e,ref:i,selectionManager:t,keyboardDelegate:u});return{listProps:d}}function Bc(e,t,n){let{shouldFocusWrap:r=!0,onKeyDown:i,onKeyUp:a,...o}=e;!e[`aria-label`]&&e[`aria-labelledby`];let s=st(e,{labelable:!0}),{listProps:c}=H({...o,ref:n,selectionManager:t.selectionManager,collection:t.collection,disabledKeys:t.disabledKeys,shouldFocusWrap:r,linkBehavior:`override`});return Ec.set(t,{onClose:e.onClose,onAction:e.onAction,shouldUseVirtualFocus:e.shouldUseVirtualFocus}),{menuProps:P(s,{onKeyDown:i,onKeyUp:a},{role:`menu`,...c,onKeyDown:t=>{(t.key!==`Escape`||e.shouldUseVirtualFocus)&&c.onKeyDown?.(t)}})}}function Vc(e){let{id:t,selectionManager:n,key:r,ref:i,shouldSelectOnPressUp:a,shouldUseVirtualFocus:o,focus:s,isDisabled:c,onAction:l,allowsDifferentPressOrigin:u,linkBehavior:d=`action`}=e,f=qe();t=$e(t);let p=e=>{if(e.pointerType===`keyboard`&&Dc(e))n.toggleSelection(r);else{if(n.selectionMode===`none`)return;if(n.isLink(r)){if(d===`selection`&&i.current){let t=n.getItemProps(r);f.open(i.current,e,t.href,t.routerOptions),n.setSelectedKeys(n.selectedKeys);return}if(d===`override`||d===`none`)return}n.selectionMode===`single`?n.isSelected(r)&&!n.disallowEmptySelection?n.toggleSelection(r):n.replaceSelection(r):e&&e.shiftKey?n.extendSelection(r):n.selectionBehavior===`toggle`||e&&(ce(e)||e.pointerType===`touch`||e.pointerType===`virtual`)?n.toggleSelection(r):n.replaceSelection(r)}};(0,I.useEffect)(()=>{r===n.focusedKey&&n.isFocused&&(o?C(i.current):s?s():fe()!==i.current&&i.current&&he(i.current))},[i,r,n.focusedKey,n.childFocusStrategy,n.isFocused,o]),c||=n.isDisabled(r);let m={};!o&&!c?m={tabIndex:r===n.focusedKey?0:-1,onFocus(e){F(e)===i.current&&n.setFocusedKey(r)}}:c&&(m.onMouseDown=e=>{e.preventDefault()}),(0,I.useEffect)(()=>{c&&n.focusedKey===r&&n.setFocusedKey(null)},[n,c,r]);let h=n.isLink(r)&&d===`override`,g=l&&e.UNSTABLE_itemBehavior===`action`,_=n.isLink(r)&&d!==`selection`&&d!==`none`,v=!c&&n.canSelectItem(r)&&!h&&!g,y=(l||_)&&!c,b=y&&(n.selectionBehavior===`replace`?!v:!v||n.isEmpty),x=y&&v&&n.selectionBehavior===`replace`,S=b||x,ee=(0,I.useRef)(null),te=S&&v,w=(0,I.useRef)(!1),T=(0,I.useRef)(!1),E=n.getItemProps(r),ne=e=>{l&&(l(),i.current?.dispatchEvent(new CustomEvent(`react-aria-item-action`,{bubbles:!0}))),_&&i.current&&f.open(i.current,e,E.href,E.routerOptions)},D={ref:i};a?(D.onPressStart=e=>{ee.current=e.pointerType,w.current=te,e.pointerType===`keyboard`&&(!S||Uc(e.key))&&p(e)},u?(D.onPressUp=b?void 0:e=>{e.pointerType===`mouse`&&v&&p(e)},D.onPress=b?ne:e=>{e.pointerType!==`keyboard`&&e.pointerType!==`mouse`&&v&&p(e)}):D.onPress=e=>{if(b||x&&e.pointerType!==`mouse`){if(e.pointerType===`keyboard`&&!Hc(e.key))return;ne(e)}else e.pointerType!==`keyboard`&&v&&p(e)}):(D.onPressStart=e=>{ee.current=e.pointerType,w.current=te,T.current=b,v&&(e.pointerType===`mouse`&&!b||e.pointerType===`keyboard`&&(!y||Uc(e.key)))&&p(e)},D.onPress=e=>{(e.pointerType===`touch`||e.pointerType===`pen`||e.pointerType===`virtual`||e.pointerType===`keyboard`&&S&&Hc(e.key)||e.pointerType===`mouse`&&T.current)&&(S?ne(e):v&&p(e))});let re=jc(n.collection);if(m[`data-collection`]=re,m[`data-key`]=r,D.preventFocusOnPress=o,o&&(D=P(D,{onPressStart(e){e.pointerType!==`touch`&&(n.setFocused(!0),n.setFocusedKey(r))},onPress(e){e.pointerType===`touch`&&(n.setFocused(!0),n.setFocusedKey(r))}})),E)for(let e of[`onPressStart`,`onPressEnd`,`onPressChange`,`onPress`,`onPressUp`,`onClick`])E[e]&&(D[e]=dt(D[e],E[e]));let{pressProps:ie,isPressed:ae}=et(D),oe=x?e=>{ee.current===`mouse`&&(e.stopPropagation(),e.preventDefault(),ne(e))}:void 0,{longPressProps:O}=xc({isDisabled:!te,onLongPress(e){e.pointerType===`touch`&&(p(e),n.setSelectionBehavior(`toggle`))}}),k=e=>{ee.current===`touch`&&w.current&&e.preventDefault()},A=d!==`none`&&n.isLink(r)?e=>{tt.isOpening||e.preventDefault()}:void 0,se=P(m,v||b||o&&!c?ie:{},te?O:{},{onDoubleClick:oe,onDragStartCapture:k,onClick:A,id:t},o?{onMouseDown:e=>e.preventDefault()}:void 0),j=e=>{let t=e;for(;t&&t!==i.current;){let e=t.getAttribute(`data-collection`);if(e!=null)return e!==re;t=t.parentElement}return be(e)},M=se.onPointerDown;se.onPointerDown=e=>{let t=F(e);if(t&&t!==i.current&&j(t)){e.stopPropagation();return}M?.(e)};let N=se.onMouseDown;return se.onMouseDown=e=>{let t=F(e);if(t&&t!==i.current&&j(t)){e.stopPropagation();return}N?.(e)},{itemProps:se,isPressed:ae,isSelected:n.isSelected(r),isFocused:n.isFocused&&n.focusedKey===r,isDisabled:c,allowsSelection:v,hasAction:S}}function Hc(e){return e===`Enter`}function Uc(e){return e===` `}function Wc(e,t){return typeof t.getChildren==`function`?t.getChildren(e.key):e.childNodes}function Gc(e){return Kc(e,0)}function Kc(e,t){if(t<0)return;let n=0;for(let r of e){if(n===t)return r;n++}}function qc(e){let t;for(let n of e)t=n;return t}function Jc(e,t,n){if(t.parentKey===n.parentKey)return t.index-n.index;let r=[...Yc(e,t),t],i=[...Yc(e,n),n],a=r.slice(0,i.length).findIndex((e,t)=>e!==i[t]);return a===-1?r.findIndex(e=>e===n)>=0?1:(i.findIndex(e=>e===t),-1):(t=r[a],n=i[a],t.index-n.index)}function Yc(e,t){let n=[],r=t;for(;r?.parentKey!=null;)r=e.getItem(r.parentKey),r&&n.unshift(r);return n}var Xc=new WeakMap;function Zc(e){let t=Xc.get(e);if(t!=null)return t;let n=0,r=t=>{for(let i of t)i.type===`section`?r(Wc(i,e)):i.type===`item`&&n++};return r(e),Xc.set(e,n),n}function Qc(e,t,n){let{id:r,key:i,closeOnSelect:a,shouldCloseOnSelect:o,isVirtualized:s,"aria-haspopup":c,onPressStart:l,onPressUp:u,onPress:d,onPressChange:f,onPressEnd:p,onClick:m,onHoverStart:h,onHoverChange:g,onHoverEnd:_,onKeyDown:v,onKeyUp:y,onFocus:b,onFocusChange:x,onBlur:S,selectionManager:C=t.selectionManager}=e,ee=!!c,te=ee&&e[`aria-expanded`]===`true`,w=e.isDisabled??C.isDisabled(i),T=e.isSelected??C.isSelected(i),E=Ec.get(t),ne=t.collection.getItem(i),D=e.onClose||E.onClose,re=qe(),ie=()=>{if(!ee&&(ne?.props?.onAction?ne.props.onAction():e.onAction&&e.onAction(i),E.onAction)){let e=E.onAction;e(i,ne?.value)}},ae=`menuitem`;ee||(C.selectionMode===`single`?ae=`menuitemradio`:C.selectionMode===`multiple`&&(ae=`menuitemcheckbox`));let oe=He(),O=He(),k=He(),A={id:r,"aria-disabled":w||void 0,role:ae,"aria-label":e[`aria-label`],"aria-labelledby":oe,"aria-describedby":[e[`aria-describedby`],O,k].filter(Boolean).join(` `)||void 0,"aria-controls":e[`aria-controls`],"aria-haspopup":c,"aria-expanded":e[`aria-expanded`]};if(C.selectionMode!==`none`&&!ee&&(A[`aria-checked`]=T),s){let e=Number(ne?.index);A[`aria-posinset`]=Number.isNaN(e)?void 0:e+1,A[`aria-setsize`]=Zc(t.collection)}let se=(0,I.useRef)(!1),ce=e=>{f?.(e),se.current=e},j=(0,I.useRef)(null),M=e=>{e.pointerType!==`keyboard`&&(j.current={pointerType:e.pointerType}),e.pointerType===`mouse`&&(se.current||e.target.click()),u?.(e)},N=e=>{m?.(e),ie(),Ge(e,re,ne.props.href,ne?.props.routerOptions);let t=j.current?.pointerType===`keyboard`?j.current?.key===`Enter`||C.selectionMode===`none`||C.isLink(i):C.selectionMode!==`multiple`||C.isLink(i);t=o??a??t,D&&!ee&&t&&D(),j.current=null},{itemProps:le,isFocused:ue}=Vc({id:r,selectionManager:C,key:i,ref:n,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,linkBehavior:`none`,shouldUseVirtualFocus:E.shouldUseVirtualFocus}),{pressProps:de,isPressed:fe}=et({onPressStart:l,onPress:d,onPressUp:M,onPressChange:ce,onPressEnd:p,isDisabled:w}),{hoverProps:pe}=pt({isDisabled:w,onHoverStart(e){!Te()&&!(te&&c)&&(C.setFocused(!0),C.setFocusedKey(i)),h?.(e)},onHoverChange:g,onHoverEnd:_}),{keyboardProps:me}=_t({shortcuts:{" ":e=>{j.current={pointerType:`keyboard`,key:` `},F(e).click(),ke(`keyboard`)},Enter:e=>{j.current={pointerType:`keyboard`,key:`Enter`};let t=F(e);if(t.tagName!==`A`){t.click(),ke(`keyboard`);return}return ke(`keyboard`),{shouldPreventDefault:!1,shouldContinuePropagation:!1}}},onKeyDown:v,onKeyUp:y}),{focusableProps:he}=vt({onBlur:S,onFocus:b,onFocusChange:x},n),ge=st(ne?.props);delete ge.id;let _e=ot(ne?.props);return{menuItemProps:{...A,...P(ge,_e,ee?{onFocus:le.onFocus,"data-collection":le[`data-collection`],"data-key":le[`data-key`]}:le,de,pe,me,he,E.shouldUseVirtualFocus||ee?{onMouseDown:e=>e.preventDefault()}:void 0,w?void 0:{onClick:N}),tabIndex:le.tabIndex!=null&&te&&!E.shouldUseVirtualFocus?-1:le.tabIndex},labelProps:{id:oe},descriptionProps:{id:O},keyboardShortcutProps:{id:k},isFocused:ue,isFocusVisible:ue&&C.isFocused&&Te()&&!te,isSelected:T,isPressed:fe,isDisabled:w}}function $c(e){let{heading:t,"aria-label":n}=e,r=$e();return{itemProps:{role:`presentation`},headingProps:t?{id:r,role:`presentation`}:{},groupProps:{role:`group`,"aria-label":n,"aria-labelledby":t?r:void 0}}}var el=2,tl=50,nl=1e3,rl=Math.PI/12;function il(e){let{menuRef:t,submenuRef:n,isOpen:r,isDisabled:i}=e,a=(0,I.useRef)(void 0),o=(0,I.useRef)(void 0),s=(0,I.useRef)(0),c=(0,I.useRef)(void 0),l=(0,I.useRef)(void 0),u=(0,I.useRef)(void 0),d=(0,I.useRef)(2),[f,p]=(0,I.useState)(!1);D({ref:r?n:void 0,onResize:()=>{n.current&&(o.current=n.current.getBoundingClientRect(),u.current=void 0)}});let m=()=>{p(!1),d.current=el,a.current=void 0},h=_e(),g=Me(e=>{f&&e.preventDefault()});(0,I.useEffect)(()=>{f&&t.current?t.current.style.pointerEvents=`none`:t.current.style.pointerEvents=``},[t,f]),Ue(()=>{let e=n.current,f=t.current;if(i||!e||!r||h!==`pointer`||!f){m();return}o.current=e.getBoundingClientRect();let _=e=>{if(e.pointerType===`touch`||e.pointerType===`pen`)return;let t=Date.now();if(t-s.currento.current.right?`left`:`right`,nf.getBoundingClientRect().right||rf.getBoundingClientRect().bottom){m();return}let i=a.current.x,h=a.current.y,g=u.current===`right`?o.current.left-i:i-o.current.right,_=Math.atan2(h-o.current.top,g)+rl,v=Math.atan2(h-o.current.bottom,g)-rl,y=Math.atan2(h-r,u.current===`left`?-(n-i):n-i),b=y<_&&y>v;d.current=b?Math.min(d.current+1,el):Math.max(d.current-1,0),d.current>=el?p(!0):p(!1),s.current=t,a.current={x:n,y:r},b&&(c.current=setTimeout(()=>{m(),l.current=setTimeout(()=>{let e=document.elementFromPoint(n,r);e&&Fe(f,e)&&e.dispatchEvent(new PointerEvent(`pointerover`,{bubbles:!0,cancelable:!0}))},100)},nl))};return window.addEventListener(`pointermove`,_),window.addEventListener(`pointerdown`,g,!0),()=>{window.removeEventListener(`pointermove`,_),window.removeEventListener(`pointerdown`,g,!0),clearTimeout(c.current),clearTimeout(l.current),d.current=el}},[i,r,t,h,p,n])}function al(e,t,n){let{parentMenuRef:r,submenuRef:i,type:a=`menu`,isDisabled:o,delay:s=200,shouldUseVirtualFocus:c}=e,l=$e(),u=$e(),{direction:d}=Ze(),f=(0,I.useRef)(void 0),p=(0,I.useCallback)(()=>{f.current&&=(clearTimeout(f.current),void 0)},[f]),m=(0,I.useCallback)(e=>{p(),t.open(e)},[t,p]),h=(0,I.useCallback)(()=>{p(),t.close()},[t,p]);Ue(()=>()=>{p()},[p]);let{keyboardProps:g}=_t({shortcuts:{ArrowLeft:e=>{if(!De(e.currentTarget))return!1;if(d===`ltr`&&Fe(e.currentTarget,F(e))){h(),!c&&n.current&&Ie(n.current);return}return!1},ArrowRight:e=>{if(!De(e.currentTarget))return!1;if(d===`rtl`&&Fe(e.currentTarget,F(e))){h(),!c&&n.current&&Ie(n.current);return}return!1},Escape:e=>{if(!De(e.currentTarget))return!1;if(Fe(i.current,F(e))){h(),!c&&n.current&&Ie(n.current);return}return!1}}}),_={id:u,"aria-labelledby":l,submenuLevel:t.submenuLevel,...a===`menu`&&{onClose:t.closeAll,autoFocus:t.focusStrategy??void 0,...g}},{keyboardProps:v}=_t({shortcuts:{ArrowRight:()=>{if(!o){if(d===`ltr`){t.isOpen||m(`first`),a===`menu`&&i?.current&&fe()===n?.current&&Ie(i.current);return}if(t.isOpen){h();return}return!1}return!1},ArrowLeft:()=>{if(!o){if(d===`rtl`){t.isOpen||m(`first`),a===`menu`&&i?.current&&fe()===n?.current&&Ie(i.current);return}if(t.isOpen){h();return}return!1}return!1}}});return oe(r,`focusin`,e=>{t.isOpen&&Fe(r.current,F(e))&&F(e)!==n.current&&h()}),il({menuRef:r,submenuRef:i,isOpen:t.isOpen,isDisabled:o}),{submenuTriggerProps:{onKeyDown:v.onKeyDown,onKeyUp:v.onKeyUp,id:l,"aria-controls":t.isOpen?u:void 0,"aria-haspopup":o?void 0:a,"aria-expanded":t.isOpen?`true`:`false`,onPressStart:e=>{!o&&(e.pointerType===`virtual`||e.pointerType===`keyboard`)&&m(`first`)},onPress:e=>{!o&&(e.pointerType===`touch`||e.pointerType===`mouse`)&&m()},onHoverChange:e=>{o||(e&&!t.isOpen?f.current||=setTimeout(()=>{m()},s):e||p())},isOpen:t.isOpen},submenuProps:_,popoverProps:{isNonModal:!0,shouldCloseOnInteractOutside:e=>e!==n.current}}}function ol(e){let t=ue(e),[n,r]=(0,I.useState)(null),[i,a]=(0,I.useState)([]),o=()=>{a([]),t.close()},s=(e,t)=>{a(n=>t>n.length?n:[...n.slice(0,t),e])},c=(e,t)=>{a(n=>n[t]===e?n.slice(0,t):n)};return{focusStrategy:n,...t,open(e=null){r(e),t.open()},toggle(e=null){r(e),t.toggle()},close(){o()},expandedKeysStack:i,openSubmenu:s,closeSubmenu:c}}function sl(e,t){let{triggerKey:n}=e,{expandedKeysStack:r,openSubmenu:i,closeSubmenu:a,close:o}=t,[s]=(0,I.useState)(r?.length),c=(0,I.useMemo)(()=>r[s]===n,[r,n,s]),[l,u]=(0,I.useState)(null),d=(0,I.useCallback)(e=>{u(e??null),i(n,s)},[i,s,n]),f=(0,I.useCallback)(()=>{u(null),a(n,s)},[a,s,n]),p=(0,I.useCallback)(e=>{u(e??null),c?f():d(e)},[f,d,c]);return(0,I.useMemo)(()=>({focusStrategy:l,isOpen:c,open:d,close:f,closeAll:o,submenuLevel:s,setOpen:()=>{},toggle:p,point:null,setPoint:()=>{}}),[c,d,f,o,l,p,s])}var cl=class e extends Set{constructor(t,n,r){super(t),t instanceof e?(this.anchorKey=n??t.anchorKey,this.currentKey=r??t.currentKey):(this.anchorKey=n??null,this.currentKey=r??null)}},ll=class e{constructor(e,t,n){this.collection=e,this.state=t,this.allowsCellSelection=n?.allowsCellSelection??!1,this._isSelectAll=null,this.layoutDelegate=n?.layoutDelegate||null,this.fullCollection=n?.fullCollection||null}get selectionMode(){return this.state.selectionMode}get disallowEmptySelection(){return this.state.disallowEmptySelection}get selectionBehavior(){return this.state.selectionBehavior}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}get isFocused(){return this.state.isFocused}setFocused(e){this.state.setFocused(e)}get focusedKey(){return this.state.focusedKey}get childFocusStrategy(){return this.state.childFocusStrategy}setFocusedKey(e,t){(e==null||this.collection.getItem(e))&&this.state.setFocusedKey(e,t)}get selectedKeys(){return this.state.selectedKeys===`all`?new Set(this.getSelectAllKeys()):this.state.selectedKeys}get rawSelection(){return this.state.selectedKeys}isSelected(e){if(this.state.selectionMode===`none`)return!1;let t=this.getKey(e);return t==null?!1:this.state.selectedKeys===`all`?this.canSelectItem(t):this.state.selectedKeys.has(t)}get isEmpty(){return this.state.selectedKeys!==`all`&&this.state.selectedKeys.size===0}get isSelectAll(){if(this.isEmpty)return!1;if(this.state.selectedKeys===`all`)return!0;if(this._isSelectAll!=null)return this._isSelectAll;let e=this.getSelectAllKeys(),t=this.state.selectedKeys;return this._isSelectAll=e.every(e=>t.has(e)),this._isSelectAll}get firstSelectedKey(){let e=null;for(let t of this.state.selectedKeys){let n=this.collection.getItem(t);(!e||n&&Jc(this.collection,n,e)<0)&&(e=n)}return e?.key??null}get lastSelectedKey(){let e=null;for(let t of this.state.selectedKeys){let n=this.collection.getItem(t);(!e||n&&Jc(this.collection,n,e)>0)&&(e=n)}return e?.key??null}get disabledKeys(){return this.state.disabledKeys}get disabledBehavior(){return this.state.disabledBehavior}extendSelection(e){if(this.selectionMode===`none`)return;if(this.selectionMode===`single`){this.replaceSelection(e);return}let t=this.getKey(e);if(t==null)return;let n;if(this.state.selectedKeys===`all`)n=new cl([t],t,t);else{let e=this.state.selectedKeys,r=e.anchorKey??t;n=new cl(e,r,t);for(let i of this.getKeyRange(r,e.currentKey??t))n.delete(i);for(let e of this.getKeyRange(t,r))this.canSelectItem(e)&&n.add(e)}this.state.setSelectedKeys(n)}getKeyRange(e,t){let n=this.collection.getItem(e),r=this.collection.getItem(t);return n&&r?Jc(this.collection,n,r)<=0?this.getKeyRangeInternal(e,t):this.getKeyRangeInternal(t,e):[]}getKeyRangeInternal(e,t){if(this.layoutDelegate?.getKeyRange)return this.layoutDelegate.getKeyRange(e,t);let n=[],r=e;for(;r!=null;){let e=this.collection.getItem(r);if(e&&(e.type===`item`||e.type===`cell`&&this.allowsCellSelection)&&n.push(r),r===t)return n;r=this.collection.getKeyAfter(r)}return[]}getKey(e){let t=this.collection.getItem(e);if(!t||t.type===`cell`&&this.allowsCellSelection)return e;for(;t&&t.type!==`item`&&t.parentKey!=null;)t=this.collection.getItem(t.parentKey);return!t||t.type!==`item`?null:t.key}toggleSelection(e){if(this.selectionMode===`none`)return;if(this.selectionMode===`single`&&!this.isSelected(e)){this.replaceSelection(e);return}let t=this.getKey(e);if(t==null)return;let n=new cl(this.state.selectedKeys===`all`?this.getSelectAllKeys():this.state.selectedKeys);n.has(t)?n.delete(t):this.canSelectItem(t)&&(n.add(t),n.anchorKey=t,n.currentKey=t),!(this.disallowEmptySelection&&n.size===0)&&this.state.setSelectedKeys(n)}replaceSelection(e){if(this.selectionMode===`none`)return;let t=this.getKey(e);if(t==null)return;let n=this.canSelectItem(t)?new cl([t],t,t):new cl;this.state.setSelectedKeys(n)}setSelectedKeys(e){if(this.selectionMode===`none`)return;let t=new cl;for(let n of e){let e=this.getKey(n);if(e!=null&&(t.add(e),this.selectionMode===`single`))break}this.state.setSelectedKeys(t)}getSelectAllKeys(){let e=this.fullCollection??this.collection,t=[],n=r=>{for(;r!=null;){if(this.canSelectItemIn(r,e)){let i=e.getItem(r);i?.type===`item`&&t.push(r),i?.hasChildNodes&&(this.allowsCellSelection||i.type!==`item`)&&n(Gc(Wc(i,e))?.key??null)}r=e.getKeyAfter(r)}};return n(e.getFirstKey()),t}selectAll(){!this.isSelectAll&&this.selectionMode===`multiple`&&this.state.setSelectedKeys(`all`)}clearSelection(){!this.disallowEmptySelection&&(this.state.selectedKeys===`all`||this.state.selectedKeys.size>0)&&this.state.setSelectedKeys(new cl)}toggleSelectAll(){this.isSelectAll?this.clearSelection():this.selectAll()}select(e,t){this.selectionMode!==`none`&&(this.selectionMode===`single`?this.isSelected(e)&&!this.disallowEmptySelection?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior===`toggle`||t&&(t.pointerType===`touch`||t.pointerType===`virtual`)?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys)return!0;let t=this.selectedKeys;if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;for(let n of t)if(!e.has(n))return!1;return!0}canSelectItem(e){return this.canSelectItemIn(e,this.collection)}canSelectItemIn(e,t){if(this.state.selectionMode===`none`||this.state.disabledKeys.has(e))return!1;let n=t.getItem(e);return!(!n||n?.props?.isDisabled||n.type===`cell`&&!this.allowsCellSelection)}isDisabled(e){let t=this.collection.getItem(e);return this.state.disabledBehavior===`all`&&(this.state.disabledKeys.has(e)||!!t?.props?.isDisabled)&&t?.props?.disabledBehavior!==`selection`}isLink(e){return!!this.collection.getItem(e)?.props?.href}getItemProps(e){return this.collection.getItem(e)?.props}withCollection(t){return new e(t,this.state,{allowsCellSelection:this.allowsCellSelection,layoutDelegate:this.layoutDelegate||void 0,fullCollection:this.fullCollection??this.collection})}},U=class{constructor(e,{expandedKeys:t}={}){this.keyMap=new Map,this.firstKey=null,this.lastKey=null,this.iterable=e,t||=new Set;let n=e=>{if(this.keyMap.set(e.key,e),e.childNodes&&(e.type===`section`||t.has(e.key)))for(let t of e.childNodes)n(t)};for(let t of e)n(t);let r=null,i=0;for(let[e,t]of this.keyMap)r?(r.nextKey=e,t.prevKey=r.key):(this.firstKey=e,t.prevKey=void 0),t.type===`item`&&(t.index=i++),r=t,r.nextKey=void 0;this.lastKey=r?.key??null}*[Symbol.iterator](){yield*this.iterable}get size(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let t=this.keyMap.get(e);return t?t.prevKey??null:null}getKeyAfter(e){let t=this.keyMap.get(e);return t?t.nextKey??null:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)??null}at(e){let t=[...this.getKeys()];return this.getItem(t[e])}},ul=class{build(e,t){return this.context=t,dl(()=>this.iterateCollection(e))}*iterateCollection(e){let{children:t,items:n}=e;if(I.isValidElement(t)&&t.type===I.Fragment)yield*this.iterateCollection({children:t.props.children,items:n});else if(typeof t==`function`){if(!n)throw Error(`props.children was a function but props.items is missing`);let e=0;for(let r of n)yield*this.getFullNode({value:r,index:e},{renderer:t}),e++}else{let e=[];I.Children.forEach(t,t=>{t&&e.push(t)});let n=0;for(let t of e){let e=this.getFullNode({element:t,index:n},{});for(let t of e)n++,yield t}}}getKey(e,t,n,r){if(e.key!=null)return e.key;if(t.type===`cell`&&t.key!=null)return`${r}${t.key}`;let i=t.value;if(i!=null){let e=i.key??i.id;if(e==null)throw Error(`No key found for item`);return e}return r?`${r}.${t.index}`:`$.${t.index}`}getChildState(e,t){return{renderer:t.renderer||e.renderer}}*getFullNode(e,t,n,r){if(I.isValidElement(e.element)&&e.element.type===I.Fragment){let i=[];I.Children.forEach(e.element.props.children,e=>{i.push(e)});let a=e.index??0;for(let e of i)yield*this.getFullNode({element:e,index:a++},t,n,r);return}let i=e.element;if(!i&&e.value&&t&&t.renderer){let n=this.cache.get(e.value);if(n&&(!n.shouldInvalidate||!n.shouldInvalidate(this.context))){n.index=e.index,n.parentKey=r?r.key:null,yield n;return}i=t.renderer(e.value)}if(I.isValidElement(i)){let a=i.type;if(typeof a!=`function`&&typeof a.getCollectionNode!=`function`){let e=i.type;throw Error(`Unknown element <${e}> in collection.`)}let o=a.getCollectionNode(i.props,this.context),s=e.index??0,c=o.next();for(;!c.done&&c.value;){let a=c.value;e.index=s;let l=a.key??null;l??=a.element?null:this.getKey(i,e,t,n);let u=[...this.getFullNode({...a,key:l,index:s,wrapper:fl(e.wrapper,a.wrapper)},this.getChildState(t,a),n?`${n}${i.key}`:i.key,r)];for(let t of u){if(t.value=a.value??e.value??null,t.value&&this.cache.set(t.value,t),e.type&&t.type!==e.type)throw Error(`Unsupported type <${pl(t.type)}> in <${pl(r?.type??`unknown parent type`)}>. Only <${pl(e.type)}> is supported.`);s++,yield t}c=o.next(u)}return}if(e.key==null||e.type==null)return;let a=this,o={type:e.type,props:e.props,key:e.key,parentKey:r?r.key:null,value:e.value??null,level:(r?.level??0)+ +(r?.type===`item`),index:e.index,rendered:e.rendered,textValue:e.textValue??``,"aria-label":e[`aria-label`],wrapper:e.wrapper,shouldInvalidate:e.shouldInvalidate,hasChildNodes:e.hasChildNodes||!1,childNodes:dl(function*(){if(!e.hasChildNodes||!e.childNodes)return;let n=0;for(let r of e.childNodes()){r.key!=null&&(r.key=`${o.key}${r.key}`);let e=a.getFullNode({...r,index:n},a.getChildState(t,r),o.key,o);for(let t of e)n++,yield t}})};yield o}constructor(){this.cache=new WeakMap}};function dl(e){let t=[],n=null;return{*[Symbol.iterator](){for(let e of t)yield e;n||=e();for(let e of n)t.push(e),yield e}}}function fl(e,t){if(e&&t)return n=>e(t(n));if(e)return e;if(t)return t}function pl(e){return e[0].toUpperCase()+e.slice(1)}function ml(e,t,n){let r=(0,I.useMemo)(()=>new ul,[]),{children:i,items:a,collection:o}=e;return(0,I.useMemo)(()=>o||t(r.build({children:i,items:a},n)),[r,i,a,o,n,t])}function hl(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function gl(e){let{selectionMode:t=`none`,disallowEmptySelection:n=!1,allowDuplicateSelectionEvents:r,selectionBehavior:i=`toggle`,disabledBehavior:a=`all`}=e,o=(0,I.useRef)(!1),[,s]=(0,I.useState)(!1),c=(0,I.useRef)(null),l=(0,I.useRef)(null),[,u]=(0,I.useState)(null),d=(0,I.useMemo)(()=>_l(e.selectedKeys),[e.selectedKeys]),f=(0,I.useMemo)(()=>_l(e.defaultSelectedKeys,new cl),[e.defaultSelectedKeys]),[p,m]=Qe(d,f,e.onSelectionChange),h=(0,I.useMemo)(()=>e.disabledKeys?new Set(e.disabledKeys):new Set,[e.disabledKeys]),[g,_]=(0,I.useState)(i);i===`replace`&&g===`toggle`&&typeof p==`object`&&p.size===0&&_(`replace`);let v=(0,I.useRef)(i);return(0,I.useEffect)(()=>{i!==v.current&&(_(i),v.current=i)},[i]),{selectionMode:t,disallowEmptySelection:n,selectionBehavior:g,setSelectionBehavior:_,get isFocused(){return o.current},setFocused(e){o.current=e,s(e)},get focusedKey(){return c.current},get childFocusStrategy(){return l.current},setFocusedKey(e,t=`first`){c.current=e,l.current=t,u(e)},selectedKeys:p,setSelectedKeys(e){(r||!hl(e,p))&&m(e)},disabledKeys:h,disabledBehavior:a}}function _l(e,t){return e?e===`all`?`all`:new cl(e):t}function vl(e){let{onExpandedChange:t}=e,[n,r]=Qe(e.expandedKeys?new Set(e.expandedKeys):void 0,e.defaultExpandedKeys?new Set(e.defaultExpandedKeys):new Set,t),i=gl(e),a=(0,I.useMemo)(()=>e.disabledKeys?new Set(e.disabledKeys):new Set,[e.disabledKeys]),o=ml(e,(0,I.useCallback)(e=>new U(e,{expandedKeys:n}),[n]),null);return(0,I.useEffect)(()=>{i.focusedKey!=null&&!o.getItem(i.focusedKey)&&i.setFocusedKey(null)},[o,i.focusedKey]),{collection:o,expandedKeys:n,disabledKeys:a,toggleKey:e=>{r(yl(n,e))},setExpandedKeys:r,selectionManager:new ll(o,i)}}function yl(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}var bl=(0,I.createContext)(null),xl=(0,I.createContext)(null),Sl=(0,I.createContext)(null),Cl=(0,I.createContext)(null);function wl(e){let t=ol(e),n=(0,I.useRef)(null),{menuTriggerProps:r,menuProps:i}=Tc({...e,type:`menu`},t,n),a=(0,I.useRef)(null);return M()?null:I.createElement(pe,{values:[[bl,{...i,ref:a}],[Ll,t],[Sl,t],[Ts,{trigger:`MenuTrigger`,triggerRef:n,scrollRef:a,placement:`bottom start`,"aria-labelledby":i[`aria-labelledby`],offset:e.trigger===`contextMenu`?0:void 0}]]},I.createElement(ys,{...r,ref:n,isPressed:t.isOpen},e.children))}var Tl=(0,I.createContext)(null),El=class extends p{static{this.type=`submenutrigger`}filter(e,t,n){let r=e.getItem(this.firstChildKey);if(r&&n(r.textValue,this)){let n=this.clone();return t.addDescendants(n,e),n}return null}},Dl=w(El,(e,t,n)=>{let{CollectionBranch:r}=(0,I.useContext)(Ns),i=(0,I.useContext)(xl),a=(0,I.useContext)(Sl),o=sl({triggerKey:n.key},a),s=(0,I.useRef)(null),c=ye(t),{parentMenuRef:l,shouldUseVirtualFocus:u}=(0,I.useContext)(Tl),{submenuTriggerProps:d,submenuProps:f,popoverProps:p}=al({parentMenuRef:l,submenuRef:s,delay:e.delay,shouldUseVirtualFocus:u},o,c);return I.createElement(pe,{values:[[Nl,{...d,onAction:void 0,ref:c}],[bl,{ref:s,...f}],[Ll,o],[Ts,{trigger:`SubmenuTrigger`,triggerRef:c,placement:`end top`,"aria-labelledby":f[`aria-labelledby`],...p}]]},I.createElement(r,{collection:i.collection,parent:n}),e.children[1])},e=>e.children[0]),Ol=(0,I.forwardRef)(function(e,t){return[e,t]=Xe(e,t,bl),I.createElement(re,{content:I.createElement(te,e)},n=>I.createElement(kl,{props:e,collection:n,menuRef:t}))});function kl({props:e,collection:t,menuRef:n}){[e,n]=Xe(e,n,N);let{filter:r,...i}=e,a=(0,I.useMemo)(()=>r?t.filter(r):t,[t,r]),o=vl({...e,collection:a,children:void 0}),s=(0,I.useContext)(Sl),{isVirtualized:c,CollectionRoot:l}=(0,I.useContext)(Ns),{menuProps:u}=Bc({...e,isVirtualized:c,onClose:e.onClose||s?.close},o,n),d=Ce({...e,children:void 0,defaultClassName:`react-aria-Menu`,values:{isEmpty:o.collection.size===0}}),f=null;o.collection.size===0&&e.renderEmptyState&&(f=I.createElement(`div`,{role:`menuitem`,style:{display:`contents`}},e.renderEmptyState()));let p=st(e,{global:!0});return I.createElement(Je,null,I.createElement(ve.div,{...P(p,d,u),ref:n,slot:e.slot||void 0,"data-empty":o.collection.size===0||void 0,onScroll:e.onScroll},I.createElement(pe,{values:[[xl,o],[se,{elementType:`div`}],[ks,{name:`MenuSection`,render:jl}],[Tl,{parentMenuRef:n,shouldUseVirtualFocus:i?.shouldUseVirtualFocus}],[Nl,{shouldCloseOnSelect:e.shouldCloseOnSelect}],[N,null],[ne,null],[Cl,o.selectionManager],[Sl,s??ol({})]]},I.createElement(ft,null,I.createElement(l,{collection:o.collection,persistedKeys:Ps(o.selectionManager.focusedKey),scrollRef:n}))),f))}var Al=class extends ll{constructor(e,t){super(e.collection,t),this.parent=e}get focusedKey(){return this.parent.focusedKey}get isFocused(){return this.parent.isFocused}setFocusedKey(e,t){return this.parent.setFocusedKey(e,t)}setFocused(e){this.parent.setFocused(e)}get childFocusStrategy(){return this.parent.childFocusStrategy}};function jl(e,t,n,r=`react-aria-MenuSection`){let i=(0,I.useContext)(xl),{CollectionBranch:a}=(0,I.useContext)(Ns),[o,s]=we(),{headingProps:c,groupProps:l}=$c({heading:s,"aria-label":n.props[`aria-label`]??void 0}),u=Ce({...e,id:void 0,children:void 0,defaultClassName:r,className:n.props?.className,style:n.props?.style,values:void 0}),d=(0,I.useContext)(Cl),f=gl(e),p=e.selectionMode==null?d:new Al(d,f),m=Se(Nl)?.shouldCloseOnSelect,h=st(e,{global:!0});return delete h.id,I.createElement(ve.section,{...P(h,u,l),ref:t},I.createElement(pe,{values:[[Fs,{...c,ref:o}],[Cl,p],[Nl,{shouldCloseOnSelect:e.shouldCloseOnSelect??m}]]},I.createElement(a,{collection:i.collection,parent:n})))}var Ml=w(de,jl),Nl=(0,I.createContext)(null),Pl=O(a,function(e,t,n){[e,t]=Xe(e,t,Nl);let r=Se(Nl)?.id,i=(0,I.useContext)(xl),a=ye(t),o=(0,I.useContext)(Cl),{isVirtualized:s}=(0,I.useContext)(Ns),{menuItemProps:c,labelProps:l,descriptionProps:u,keyboardShortcutProps:d,...f}=Qc({...e,id:r,key:n.key,selectionManager:o,isVirtualized:s},i,a),{hoverProps:p,isHovered:m}=pt({isDisabled:f.isDisabled}),h=Ce({...e,id:void 0,children:n.rendered,defaultClassName:`react-aria-MenuItem`,values:{...f,isHovered:m,isFocusVisible:f.isFocusVisible,selectionMode:o.selectionMode,selectionBehavior:o.selectionBehavior,hasSubmenu:!!e[`aria-haspopup`],isOpen:e[`aria-expanded`]===`true`}}),g=e.href?ve.a:ve.div,_=st(e,{global:!0});return delete _.id,delete _.onClick,I.createElement(g,{...P(_,h,c,p),ref:a,"data-disabled":f.isDisabled||void 0,"data-hovered":m||void 0,"data-focused":f.isFocused||void 0,"data-focus-visible":f.isFocusVisible||void 0,"data-pressed":f.isPressed||void 0,"data-selected":f.isSelected||void 0,"data-selection-mode":o.selectionMode===`none`?void 0:o.selectionMode,"data-has-submenu":!!e[`aria-haspopup`]||void 0,"data-open":e[`aria-expanded`]===`true`||void 0},I.createElement(pe,{values:[[v,{slots:{[Ee]:l,label:l,description:u}}],[Is,d],[Ls,{isSelected:f.isSelected}]]},h.children))});function Fl(e,t){let{role:n=`dialog`}=e,r=He();r=e[`aria-label`]?void 0:r;let i=He();i=n===`alertdialog`&&!e[`aria-describedby`]?i:void 0;let a=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(t.current&&!De(t.current)){he(t.current);let e=setTimeout(()=>{(fe()===t.current||fe()===document.body)&&(a.current=!0,t.current&&(t.current.blur(),he(t.current)),a.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),ws(),(0,I.useRef)(!1),(0,I.useEffect)(()=>{});let o=e[`aria-describedby`]??i;return{dialogProps:{...st(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]??r,"aria-describedby":o,onBlur:e=>{a.current&&e.stopPropagation()}},titleProps:{id:r},contentProps:{id:i}}}var Il=(0,I.createContext)(null),Ll=(0,I.createContext)(null);function Rl(e){let t=ol(e),n=(0,I.useRef)(null),{triggerProps:r,overlayProps:i}=Cc({type:`dialog`},t,n);return r.id=$e(),i[`aria-labelledby`]=r.id,I.createElement(pe,{values:[[Ll,t],[Sl,t],[Il,i],[Ts,{trigger:`DialogTrigger`,triggerRef:n,id:i.id,"aria-labelledby":i[`aria-labelledby`]}]]},I.createElement(ys,{...r,ref:n,isPressed:t.isOpen},e.children))}var zl=(0,I.forwardRef)(function(e,t){let n=e[`aria-labelledby`];[e,t]=Xe(e,t,Il);let{dialogProps:r,titleProps:i,contentProps:a}=Fl({...e,"aria-labelledby":n},t),o=(0,I.useContext)(Ll);!r[`aria-label`]&&!r[`aria-labelledby`]&&e[`aria-labelledby`]&&(r[`aria-labelledby`]=e[`aria-labelledby`]);let s=Ce({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),c=st(e,{global:!0});return I.createElement(ve.section,{...P(c,s,r),render:e.render,ref:t,slot:e.slot||void 0},I.createElement(pe,{values:[[V,{slots:{[Ee]:{},title:{...i,level:2}}}],[v,{slots:{[Ee]:{},description:a}}],[h,{slots:{[Ee]:{},close:{onPress:()=>o?.close()}}}]]},s.children))});function Bl(e,t,n){let{overlayProps:r,underlayProps:i}=wo({...e,isOpen:t.isOpen,onClose:t.close},n);return Oo({isDisabled:!t.isOpen}),ws(),(0,I.useEffect)(()=>{if(t.isOpen&&n.current)return yo([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:P(r),underlayProps:i}}var W=(0,I.createContext)(null),G=(0,I.createContext)(null),K=(0,I.forwardRef)(function(e,t){if((0,I.useContext)(G))return I.createElement(Hl,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,children:s,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d,...f}=e;return I.createElement(J,{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d},I.createElement(Hl,{...f,modalRef:t},s))});function q(e,t){[e,t]=Xe(e,t,W);let n=(0,I.useContext)(Ll),r=ue(e),i=e.isOpen!=null||e.defaultOpen!=null||!n?r:n,a=ye(t),o=(0,I.useRef)(null),s=T(a,i.isOpen),c=T(o,i.isOpen),l=s||c||e.isExiting||!1,u=mt();return!i.isOpen&&!l||u?null:I.createElement(Vl,{...e,state:i,isExiting:l,overlayRef:a,modalRef:o})}var J=(0,I.forwardRef)(q);function Vl({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:r}=t,{modalProps:i,underlayProps:a}=Bl(t,r,n),o=y(t.overlayRef)||t.isEntering||!1,s=Ce({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:o,isExiting:t.isExiting,state:r}}),c=eo(),l,u;if(typeof document<`u`){let e=Xa(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().width%1,n=e.getBoundingClientRect().height%1;l=e.scrollWidth-t,u=e.scrollHeight-n}let d={...s.style,"--visual-viewport-width":c.width+`px`,"--visual-viewport-height":c.height+`px`,"--page-width":l===void 0?void 0:l+`px`,"--page-height":u===void 0?void 0:u+`px`};return I.createElement(Cs,{isExiting:t.isExiting,portalContainer:e},I.createElement(ve.div,{...P(st(t,{global:!0}),a),...s,style:d,ref:t.overlayRef,"data-entering":o||void 0,"data-exiting":t.isExiting||void 0},I.createElement(pe,{values:[[G,{modalProps:i,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[Ll,r]]},s.children)))}function Hl(e){let{modalProps:t,modalRef:n,isExiting:r,isDismissable:i}=(0,I.useContext)(G),a=(0,I.useContext)(Ll),o=(0,I.useMemo)(()=>Pe(e.modalRef,n),[e.modalRef,n]),s=ye(o),c=y(s),l=Ce({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:c,isExiting:r,state:a}});return I.createElement(ve.div,{...P(st(e,{global:!0}),t),...l,ref:s,"data-entering":c||void 0,"data-exiting":r||void 0},i&&I.createElement(vs,{onDismiss:a.close}),l.children)}var Y=r(),Ul=({children:e,className:t,slot:n,style:r,variant:i,...a})=>{let o=(0,I.useMemo)(()=>co({variant:i}),[i]);return(0,Y.jsx)(g,{"aria-label":`Close`,className:Ve(t,o),"data-slot":`close-button`,slot:n,style:r,type:`button`,...a,children:t=>typeof e==`function`?e(t):e??(0,Y.jsx)(l,{"data-slot":`close-button-icon`})})},Wl=Object.assign(Ul,{Root:Ul});function Gl(e,t,n){let{isSelected:r}=t,{isPressed:i,buttonProps:a}=at({...e,onPress:dt(t.toggle,e.onPress)},n);return{isPressed:i,isSelected:r,isDisabled:e.isDisabled||!1,buttonProps:P(a,{"aria-pressed":r})}}function Kl(e,t){let{"aria-label":n,"aria-labelledby":r,orientation:i=`horizontal`}=e,[a,o]=(0,I.useState)(!1);Ue(()=>{o(!!(t.current&&t.current.parentElement?.closest(`[role="toolbar"]`)))});let{direction:s}=Ze(),c=s===`rtl`&&i===`horizontal`,l=it(t),u=e=>{if(Fe(e.currentTarget,F(e))){if(i===`horizontal`&&e.key===`ArrowRight`||i===`vertical`&&e.key===`ArrowDown`)c?l.focusPrevious():l.focusNext();else if(i===`horizontal`&&e.key===`ArrowLeft`||i===`vertical`&&e.key===`ArrowUp`)c?l.focusNext():l.focusPrevious();else if(e.key===`Tab`){d.current=fe(),e.shiftKey?l.focusFirst():l.focusLast();return}else return;e.stopPropagation(),e.preventDefault()}},d=(0,I.useRef)(null),f=e=>{!Fe(e.currentTarget,e.relatedTarget)&&!d.current&&(d.current=F(e))},p=e=>{d.current&&!Fe(e.currentTarget,e.relatedTarget)&&Fe(t.current,F(e))&&(d.current?.focus(),d.current=null)};return{toolbarProps:{...st(e,{labelable:!0}),role:a?`group`:`toolbar`,"aria-orientation":i,"aria-label":n,"aria-labelledby":n==null?r:void 0,onKeyDownCapture:a?void 0:u,onFocusCapture:a?void 0:p,onBlurCapture:a?void 0:f}}}function ql(e,t,n){let{isDisabled:r}=e,{toolbarProps:i}=Kl(e,n);return{groupProps:{...i,role:t.selectionMode===`single`?`radiogroup`:i.role,"aria-disabled":r}}}function Jl(e,t,n){let r={isSelected:t.selectedKeys.has(e.id),defaultSelected:!1,setSelected(n){t.setSelected(e.id,n)},toggle(){t.toggleKey(e.id)}},{isPressed:i,isSelected:a,isDisabled:o,buttonProps:s}=Gl({...e,id:void 0,isDisabled:e.isDisabled||t.isDisabled},r,n);return t.selectionMode===`single`&&(s.role=`radio`,s[`aria-checked`]=r.isSelected,delete s[`aria-pressed`]),{isPressed:i,isSelected:a,isDisabled:o,buttonProps:s}}function Yl(e){let{selectionMode:t=`single`,disallowEmptySelection:n,isDisabled:r=!1}=e,[i,a]=Qe((0,I.useMemo)(()=>e.selectedKeys?new Set(e.selectedKeys):void 0,[e.selectedKeys]),(0,I.useMemo)(()=>e.defaultSelectedKeys?new Set(e.defaultSelectedKeys):new Set,[e.defaultSelectedKeys]),e.onSelectionChange);return{selectionMode:t,isDisabled:r,selectedKeys:i,setSelectedKeys:a,toggleKey(e){let r;t===`multiple`?(r=new Set(i),r.has(e)&&(!n||r.size>1)?r.delete(e):r.add(e)):r=new Set(i.has(e)&&!n?[]:[e]),a(r)},setSelected(e,t){t!==i.has(e)&&this.toggleKey(e)}}}var Xl=(0,I.createContext)({}),Zl=(0,I.createContext)(null),Ql=(0,I.forwardRef)(function(e,t){[e,t]=Xe(e,t,Xl);let n=Yl(e),{groupProps:r}=ql(e,n,t),i=Ce({...e,values:{orientation:e.orientation||`horizontal`,isDisabled:n.isDisabled,state:n},defaultClassName:`react-aria-ToggleButtonGroup`}),a=st(e,{global:!0});return I.createElement(ve.div,{...P(a,i,r),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`horizontal`,"data-disabled":e.isDisabled||void 0},I.createElement(Zl.Provider,{value:n},I.createElement(ft,null,i.children)))}),$l=(0,I.createContext)({}),eu=({children:e,className:t,color:n,size:r,variant:i,...a})=>{let o=I.useMemo(()=>so({color:n,size:r,variant:i}),[n,r,i]),s=I.useMemo(()=>typeof e==`string`||typeof e==`number`?(0,Y.jsx)(tu,{children:e}):e,[e]);return(0,Y.jsx)($l,{value:{slots:o},children:(0,Y.jsx)(me.span,{...a,className:ut(o.base,t),"data-slot":`chip`,children:s})})},tu=({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)($l);return(0,Y.jsx)(me.span,{className:ut(r?.label,t),"data-slot":`chip-label`,...n,children:e})},nu=Object.assign(eu,{Root:eu,Label:tu}),ru=8,iu=.3,au=.5;function ou(e,t){let n=(0,I.use)(Ll),r=(0,I.useRef)(null),i=(0,I.useRef)(!1),a=(0,I.useRef)(!1),o=(0,I.useRef)(0),s=(0,I.useRef)(0),c=(0,I.useRef)(0),l=(0,I.useRef)(0),u=(0,I.useRef)(0),d=e===`top`||e===`bottom`,f=(0,I.useCallback)(e=>d?e.clientY:e.clientX,[d]),p=(0,I.useCallback)(t=>{switch(e){case`bottom`:return Math.max(0,t);case`top`:return Math.min(0,t);case`right`:return Math.max(0,t);case`left`:return Math.min(0,t);default:return t}},[e]),m=(0,I.useCallback)(e=>{t&&e.button===0&&(e.target.closest(`input, textarea, button, [role='button'], select, a, [data-slot='drawer-body']`)||(i.current=!0,a.current=!1,o.current=f(e),u.current=o.current,l.current=Date.now(),s.current=0,c.current=0))},[f,t]),h=(0,I.useCallback)(e=>{if(!i.current||!r.current)return;let t=f(e),n=t-o.current,m=p(n);if(!a.current){if(Math.abs(n)0&&(c.current=(t-u.current)/g,l.current=h,u.current=t);let _=d?`Y`:`X`;r.current.style.transform=`translate${_}(${m}px)`},[f,p,d]),g=(0,I.useCallback)(e=>{if(!i.current)return;i.current=!1;let t=r.current;if(!t||!a.current){a.current=!1;return}a.current=!1;try{t.releasePointerCapture(e.pointerId)}catch{}let o=d?t.offsetHeight:t.offsetWidth,l=Math.abs(s.current),u=Math.abs(c.current);(l>o*iu||u>au)&&n?n.close():(t.style.transition=`transform 300ms cubic-bezier(0.32, 0.72, 0, 1)`,t.style.transform=``,t.addEventListener(`transitionend`,()=>{t.style.transition=``},{once:!0})),s.current=0,c.current=0},[d,n]);return{dialogRef:r,dragHandlers:t?{onPointerDown:m,onPointerMove:h,onPointerUp:g}:{}}}var su=(0,I.createContext)({}),cu=({children:e,state:t,...n})=>{let r=(0,I.useMemo)(()=>({slots:lo(),placement:void 0,isDismissable:!0}),[]),i=(0,I.useMemo)(()=>t?{isOpen:t.isOpen,onOpenChange:t.setOpen}:{},[t]);return(0,Y.jsx)(su,{value:r,children:(0,Y.jsx)(Rl,{"data-slot":`drawer-root`,...P(n,i),children:e})})};cu.displayName=`HeroUI.Drawer`;var lu=({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)(su);return(0,Y.jsx)(g,{className:Ve(t,r?.trigger()),"data-slot":`drawer-trigger`,...n,children:e})};lu.displayName=`HeroUI.Drawer.Trigger`;var uu=({children:e,className:t,isDismissable:n=!0,variant:r,...i})=>{let{slots:a}=(0,I.use)(su),o=(0,I.useMemo)(()=>lo({variant:r}),[r]),s=(0,I.useMemo)(()=>({slots:{...a,...o},isDismissable:n}),[a,o,n]);return(0,Y.jsx)(J,{className:Ve(t,o?.backdrop()),"data-slot":`drawer-backdrop`,isDismissable:n,...i,children:t=>(0,Y.jsx)(su,{value:s,children:typeof e==`function`?e(t):e})})};uu.displayName=`HeroUI.Drawer.Backdrop`;var du=({children:e,className:t,placement:n=`bottom`,...r})=>{let{isDismissable:i,slots:a}=(0,I.use)(su),o=(0,I.useMemo)(()=>lo({placement:n}),[n]),s=(0,I.useMemo)(()=>({placement:n,isDismissable:i,slots:{...a,...o}}),[a,n,i,o]);return(0,Y.jsx)(K,{className:Ve(t,o?.content()),"data-placement":n,"data-slot":`drawer-content`,...r,children:t=>(0,Y.jsx)(su,{value:s,children:typeof e==`function`?e(t):e})})};du.displayName=`HeroUI.Drawer.Content`;var fu=({children:e,className:t,...n})=>{let{isDismissable:r=!0,placement:i,slots:a}=(0,I.use)(su),{dialogRef:o,dragHandlers:s}=ou(i,r);return(0,Y.jsx)(c,{value:{variant:`default`},children:(0,Y.jsx)(zl,{ref:o,className:ut(a?.dialog,t),"data-placement":i,"data-slot":`drawer-dialog`,style:r?{touchAction:`none`}:void 0,...s,...n,children:e})})};fu.displayName=`HeroUI.Drawer.Dialog`;var pu=({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)(su);return(0,Y.jsx)(me.div,{className:ut(r?.header,t),"data-slot":`drawer-header`,...n,children:e})};pu.displayName=`HeroUI.Drawer.Header`;var mu=({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)(su);return(0,Y.jsx)(me.div,{className:ut(r?.body,t),"data-slot":`drawer-body`,style:{touchAction:`pan-y`},...n,children:e})};mu.displayName=`HeroUI.Drawer.Body`;var hu=({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)(su);return(0,Y.jsx)(me.div,{className:ut(r?.footer,t),"data-slot":`drawer-footer`,...n,children:e})};hu.displayName=`HeroUI.Drawer.Footer`;var gu=({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)(su);return(0,Y.jsx)(mo,{className:ut(r?.heading,t),"data-slot":`drawer-heading`,slot:`title`,...n,children:e})};gu.displayName=`HeroUI.Drawer.Heading`;var _u=({className:e,...t})=>{let{slots:n}=(0,I.use)(su);return(0,Y.jsx)(me.div,{"aria-hidden":`true`,className:ut(n?.handle,e),"data-slot":`drawer-handle`,...t,children:(0,Y.jsx)(`div`,{"data-slot":`drawer-handle-bar`})})};_u.displayName=`HeroUI.Drawer.Handle`;var vu=({className:e,...t})=>{let{slots:n}=(0,I.use)(su);return(0,Y.jsx)(Wl,{className:Ve(e,n?.closeTrigger()),"data-slot":`drawer-close-trigger`,slot:`close`,...t})};vu.displayName=`HeroUI.Drawer.CloseTrigger`;var yu=Object.assign(cu,{Root:cu,Trigger:lu,Backdrop:uu,Content:du,Dialog:fu,Header:pu,Heading:gu,Body:mu,Footer:hu,Handle:_u,CloseTrigger:vu}),bu=({className:e,orientation:t,variant:n,...r})=>{let i=Se(se),a=t??i?.orientation??`horizontal`;return(0,Y.jsx)(ae,{"data-orientation":a,"data-slot":`separator`,orientation:a,className:uo({orientation:a,variant:n,className:e}),...r})},xu=Object.assign(bu,{Root:bu}),Su=({animationType:e,className:t,...n})=>{let r=St(`--skeleton-animation`,e),i=I.useMemo(()=>fo({animationType:r}),[r]);return(0,Y.jsx)(me.div,{className:i.base({className:t}),...n})},Cu=Object.assign(Su,{Root:Su}),wu=(0,I.createContext)({}),Tu=(0,I.forwardRef)(function(e,t){[e,t]=Xe(e,t,wu);let{toolbarProps:n}=Kl(e,t),r=Ce({...e,values:{orientation:e.orientation||`horizontal`},defaultClassName:`react-aria-Toolbar`}),i=st(e,{global:!0});return delete i.id,I.createElement(ve.div,{...P(i,r,n),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`horizontal`},r.children)}),Eu=({children:e,className:t,isAttached:n,orientation:r=`horizontal`,...i})=>{let a=I.useMemo(()=>po({isAttached:n,orientation:r}),[n,r]);return(0,Y.jsx)(Xl.Provider,{value:{orientation:r},children:(0,Y.jsx)(se.Provider,{value:{orientation:r===`horizontal`?`vertical`:`horizontal`},children:(0,Y.jsx)(Tu,{className:Ve(t,a),"data-slot":`toolbar`,orientation:r,...i,children:e})})})};Eu.displayName=`HeroUI.Toolbar`;var Du=Object.assign(Eu,{Root:Eu}),Ou=I.createContext(null);function ku(e){let{children:t}=e,n=(0,I.useContext)(Ou),[r,i]=(0,I.useState)(0),a=(0,I.useMemo)(()=>({parent:n,modalCount:r,addModal(){i(e=>e+1),n&&n.addModal()},removeModal(){i(e=>e-1),n&&n.removeModal()}}),[n,r]);return I.createElement(Ou.Provider,{value:a},t)}function Au(){let e=(0,I.useContext)(Ou);return{modalProviderProps:{"aria-hidden":e&&e.modalCount>0?!0:void 0}}}function ju(e){let{modalProviderProps:t}=Au();return I.createElement(`div`,{"data-overlay-container":!0,...e,...t})}function Mu(e){return I.createElement(ku,null,I.createElement(ju,e))}function Nu(e){let t=mt(),{portalContainer:n=t?null:document.body,...r}=e,{getContainer:i}=m();if(!e.portalContainer&&i&&(n=i()),I.useEffect(()=>{if(n?.closest(`[data-overlay-container]`))throw Error(`An OverlayContainer must not be inside another container. Please change the portalContainer prop.`)},[n]),!n)return null;let a=I.createElement(Mu,r);return xs.createPortal(a,n)}var Pu=1500,Fu=500,Iu={},Lu=0,Ru=!1,zu=null,Bu=null;function Vu(e={}){let{delay:t=Pu,closeDelay:n=Fu}=e,{isOpen:r,open:i,close:a}=ue(e),[o,s]=(0,I.useState)(!1),c=(0,I.useMemo)(()=>`${++Lu}`,[]),l=(0,I.useRef)(null),u=(0,I.useRef)(a),d=()=>{Iu[c]=m},f=()=>{for(let e in Iu)e!==c&&(Iu[e](!0,!0),delete Iu[e])},p=e=>{l.current&&clearTimeout(l.current),l.current=null,f(),d(),s(!!e),Ru=!0,i(),zu&&=(clearTimeout(zu),null),Bu&&=(clearTimeout(Bu),null)},m=(e,t)=>{s(!!t),e||n<=0?(l.current&&clearTimeout(l.current),l.current=null,u.current()):l.current||=setTimeout(()=>{l.current=null,u.current()},n),zu&&=(clearTimeout(zu),null),Ru&&(Bu&&clearTimeout(Bu),Bu=setTimeout(()=>{delete Iu[c],Bu=null,Ru=!1},Math.max(Fu,n)))},h=()=>{f(),d(),!r&&!Ru?(zu&&clearTimeout(zu),zu=setTimeout(()=>{zu=null,Ru=!0,p(!1)},t)):r||p(!0)};return(0,I.useEffect)(()=>{u.current=a},[a]),(0,I.useEffect)(()=>()=>{l.current&&clearTimeout(l.current),Iu[c]&&delete Iu[c]},[c]),{isOpen:r,shouldSkipAnimation:o,open:e=>{!e&&t>0&&!l.current?h():p(Ru)},close:m}}function Hu(e,t){let n=st(e,{labelable:!0}),{hoverProps:r}=pt({onHoverStart:()=>t?.open(!0),onHoverEnd:()=>t?.close()});return{tooltipProps:P(n,r,{role:`tooltip`})}}function Uu(e,t,n){let{isDisabled:r,trigger:i,shouldCloseOnPress:a=!0}=e,o=$e(),s=(0,I.useRef)(!1),c=(0,I.useRef)(!1),l=()=>{(s.current||c.current)&&t.open(c.current)},u=e=>{!s.current&&!c.current&&t.close(e)};(0,I.useEffect)(()=>{let e=e=>{n&&n.current&&e.key===`Escape`&&(e.stopPropagation(),t.close(!0))};if(t.isOpen)return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[n,t]);let d=()=>{i!==`focus`&&(gt()===`pointer`?s.current=!0:s.current=!1,l())},f=()=>{i!==`focus`&&(c.current=!1,s.current=!1,u())},p=()=>{a&&(c.current=!1,s.current=!1,u(!0))},m=()=>{Te()&&(c.current=!0,l())},h=()=>{c.current=!1,s.current=!1,u(!0)},{hoverProps:g}=pt({isDisabled:r,onHoverStart:d,onHoverEnd:f}),{focusableProps:_}=vt({isDisabled:r,onFocus:m,onBlur:h},n);return{triggerProps:{"aria-describedby":t.isOpen?o:void 0,...P(_,g,{onPointerDown:p,onKeyDown:p}),tabIndex:void 0},tooltipProps:{id:o}}}var Wu=(0,I.createContext)(null),Gu=(0,I.createContext)(null);function X(e){let t=Vu(e),n=(0,I.useRef)(null),{triggerProps:r,tooltipProps:i}=Uu(e,t,n);return I.createElement(pe,{values:[[Wu,t],[Gu,{...i,triggerRef:n}]]},I.createElement(ht,{...r,ref:n},e.children))}var Ku=(0,I.forwardRef)(function({UNSTABLE_portalContainer:e,...t},n){[t,n]=Xe(t,n,Gu);let r=(0,I.useContext)(Wu),i=Vu(t),a=t.isOpen!=null||t.defaultOpen!=null||!r?i:r,o=T(n,a.isOpen),s=t.isExiting||!a.shouldSkipAnimation&&o||!1;return!a.isOpen&&!s?null:I.createElement(Nu,{portalContainer:e},I.createElement(qu,{...t,tooltipRef:n,isExiting:s}))});function qu(e){let t=(0,I.useContext)(Wu),n=(0,I.useRef)(null),{overlayProps:r,arrowProps:i,placement:a,triggerAnchorPoint:o}=u({placement:e.placement||`top`,targetRef:e.triggerRef,overlayRef:e.tooltipRef,arrowRef:n,offset:e.offset,crossOffset:e.crossOffset,isOpen:t.isOpen,arrowBoundaryOffset:e.arrowBoundaryOffset,shouldFlip:e.shouldFlip,containerPadding:e.containerPadding,onClose:()=>t.close(!0)}),s=y(e.tooltipRef,!!a),c=e.isEntering||!t.shouldSkipAnimation&&s||!1,l=Ce({...e,defaultClassName:`react-aria-Tooltip`,values:{placement:a,isEntering:c,isExiting:e.isExiting,state:t}});e=P(e,r);let{tooltipProps:d}=Hu(e,t),p=st(e,{global:!0});return I.createElement(ve.div,{...P(p,l,d),ref:e.tooltipRef,style:{...r.style,"--trigger-anchor-point":o?`${o.x}px ${o.y}px`:void 0,...l.style},"data-placement":a??void 0,"data-entering":c||void 0,"data-exiting":e.isExiting||void 0},I.createElement(f.Provider,{value:{...i,placement:a,ref:n}},l.children))}var Ju=e=>{if(!e)return;let t=e.trim(),n=parseFloat(t);if(!Number.isNaN(n))return t.endsWith(`ms`)?n:t.endsWith(`s`)?n*1e3:n},Yu=(0,I.createContext)({}),Xu=({children:e,shouldSkipAnimation:t})=>{let n=(0,I.use)(Wu);return!n||t?e:(0,Y.jsx)(Wu,{value:{...n,shouldSkipAnimation:!1},children:e})},Zu=({children:e,closeDelay:t,delay:n,shouldSkipAnimation:r=!1,...i})=>{let a=I.useMemo(()=>B(),[]),o=St(`--tooltip-delay`),s=St(`--tooltip-close-delay`),c=n??Ju(o),l=t??Ju(s);return(0,Y.jsx)(Yu,{value:{slots:a},children:(0,Y.jsx)(X,{closeDelay:l,"data-slot":`tooltip-root`,delay:c,...i,children:(0,Y.jsx)(Xu,{shouldSkipAnimation:r,children:e})})})},Qu=Object.assign(Zu,{Root:Zu,Trigger:({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)(Yu),i=(0,I.useRef)(null),{focusableProps:a}=vt({},i);return(0,Y.jsx)(me.div,{ref:i,className:ut(r?.trigger,t),"data-slot":`tooltip-trigger`,role:`button`,...P(a,n),children:e})},Content:({children:e,className:t,offset:n,showArrow:r=!1,...i})=>{let{slots:a}=(0,I.use)(Yu),o=n||(r?7:3);return(0,Y.jsx)(Ku,{...i,className:Ve(t,a?.base()),offset:o,children:e})},Arrow:({children:e,className:t,...n})=>{let r=(0,Y.jsx)(`svg`,{"data-slot":`overlay-arrow`,fill:`none`,height:`12`,viewBox:`0 0 12 12`,width:`12`,xmlns:`http://www.w3.org/2000/svg`,children:(0,Y.jsx)(`path`,{d:`M0 0C5.48483 8 6.5 8 12 0Z`})}),i=I.isValidElement(e)?I.cloneElement(e,{"data-slot":`overlay-arrow`}):r;return(0,Y.jsx)(s,{"data-slot":`tooltip-arrow`,...n,className:t,children:i})}}),$u=(0,I.createContext)(null);function ed({children:e}){let{apiKey:t,signOut:n}=xt(),[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(!!t),[s,c]=(0,I.useState)(null),l=(0,I.useCallback)(async(e,r)=>{let a=e??t;if(!a)throw i(null),c(null),o(!1),Error(`missing_api_key`);let s=!!r?.silent;s||o(!0);try{let e=await Et(a);return i(e),c(null),e}catch(e){let t=e instanceof Error?e.message:String(e);throw s||i(null),c(t),wt(e)&&n(),e}finally{s||o(!1)}},[t,n]);(0,I.useEffect)(()=>{if(!t){i(null),o(!1),c(null);return}l(void 0,{refreshQuota:!1}).catch(()=>void 0)},[t,l]);let u=(0,I.useMemo)(()=>({overview:r,loading:a,error:s,refresh:l,setOverview:i}),[r,a,s,l]);return(0,Y.jsx)($u.Provider,{value:u,children:e})}function td(){let e=(0,I.useContext)($u);if(!e)throw Error(`useOverview must be used within OverviewProvider`);return e}var nd=`cli2api_theme`,rd=(0,I.createContext)(null);function id(){let e=localStorage.getItem(nd);return e===`light`||e===`dark`?e:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function ad({children:e}){let[t,n]=(0,I.useState)(id);(0,I.useEffect)(()=>{let e=document.documentElement;e.dataset.theme=t,e.classList.toggle(`dark`,t===`dark`),e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t;let n=sd()??(t===`dark`?`#0A0A0A`:`#FAFAFA`);document.querySelectorAll(`meta[name="theme-color"]`).forEach(e=>{e.setAttribute(`content`,n)})},[t]);let r=(0,I.useMemo)(()=>({theme:t,setTheme:e=>{localStorage.setItem(nd,e),n(e)},toggleTheme:()=>{n(e=>{let t=e===`dark`?`light`:`dark`;return localStorage.setItem(nd,t),t})}}),[t]);return(0,Y.jsx)(rd.Provider,{value:r,children:e})}function od(){let e=(0,I.useContext)(rd);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function sd(){let e=document.createElement(`div`);e.style.cssText=`position:absolute;visibility:hidden;background:var(--background)`,document.body.appendChild(e);let t=getComputedStyle(e).backgroundColor;return e.remove(),t&&t!==`rgba(0, 0, 0, 0)`?t:null}function cd({title:e,desc:t,wide:n,onMenu:r}){let{lang:i,setLang:a,t:o}=ie(),{loading:s,refresh:c,overview:l}=td(),{signOut:u}=xt(),{theme:d,toggleTheme:f}=od(),p=sr(),m=!!l?.worker?.ok;return(0,Y.jsx)(`header`,{className:`relative z-20 shrink-0 border-b border-separator bg-background`,children:(0,Y.jsxs)(`div`,{className:n?`flex w-full items-center gap-4 px-3 py-2 sm:px-4 lg:px-5`:`mx-auto flex w-full max-w-[1480px] items-center gap-4 px-4 py-2 sm:px-6 lg:px-8`,children:[(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`lg:hidden`,onPress:r,"aria-label":o(`menu`),children:(0,Y.jsx)(Oa,{size:17})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-3`,children:[(0,Y.jsx)(`span`,{className:`status-dot translate-y-[-1px]`,"data-state":m?`ok`:`danger`}),(0,Y.jsx)(`h1`,{className:`truncate text-title font-semibold`,children:e}),(0,Y.jsx)(`p`,{className:`hidden truncate text-body text-muted xl:block`,children:t})]})}),(0,Y.jsxs)(Du,{isAttached:!0,children:[(0,Y.jsxs)(Qu,{children:[(0,Y.jsx)(Qu.Trigger,{children:(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,isPending:s,onPress:()=>void c().catch(()=>void 0),"aria-label":o(`refresh`),children:(0,Y.jsx)(oa,{size:15})})}),(0,Y.jsx)(Qu.Content,{children:o(`refresh`)})]}),(0,Y.jsxs)(Qu,{children:[(0,Y.jsx)(Qu.Trigger,{children:(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:()=>a(i===`zh`?`en`:`zh`),"aria-label":i===`zh`?`English`:`中文`,children:(0,Y.jsx)(ba,{size:15})})}),(0,Y.jsx)(Qu.Content,{children:i===`zh`?`English`:`中文`})]}),(0,Y.jsxs)(Qu,{children:[(0,Y.jsx)(Qu.Trigger,{children:(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:f,"aria-label":d===`dark`?`Light mode`:`Dark mode`,children:d===`dark`?(0,Y.jsx)(Ha,{size:15}):(0,Y.jsx)(Aa,{size:15})})}),(0,Y.jsx)(Qu.Content,{children:d===`dark`?`Light mode`:`Dark mode`})]}),(0,Y.jsxs)(Qu,{children:[(0,Y.jsx)(Qu.Trigger,{children:(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:()=>{u(),p(`/login`,{replace:!0})},"aria-label":o(`signOut`),children:(0,Y.jsx)(Ra,{size:15})})}),(0,Y.jsx)(Qu.Content,{children:o(`signOut`)})]})]})]})})}function ld(e=!1){return Ct(`/api/system/update${e?`?force=1`:``}`)}function ud(){return Ct(`/api/system/settings`)}function dd(e){return Ct(`/api/system/settings`,{method:`PATCH`,body:JSON.stringify(e)})}function fd(){return Ct(`/api/system/update/prepare`,{method:`POST`,body:`{}`})}function pd(){return Ct(`/api/system/update/apply`,{method:`POST`,body:`{}`})}function md(){return Ct(`/api/system/update/cancel`,{method:`POST`,body:`{}`})}function hd(e){return Ct(`/api/system/update/rollback`,{method:`POST`,body:JSON.stringify({version:e})})}function gd(){return Ct(`/api/system/resources`)}var _d=new Set([`preparing`,`preparing_image`,`checking`,`backing_up`,`submitting`,`running`,`queued`,`pulling`,`host_binary`,`image_ready`,`recreating`,`rolling_back`]),vd=new Set([`backing_up`,`running`]),yd=new Set([`recreating`,`rolling_back`]),bd=new Set([`queued`,`pulling`,`host_binary`,`image_ready`,`preparing`,`recreating`,`checking`,`rolling_back`]);function Z(){let{t:e}=ie(),[t,n]=(0,I.useState)(null),[r,i]=(0,I.useState)(!0),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(``),[d,f]=(0,I.useState)(null),[p,m]=(0,I.useState)(null),[h,g]=(0,I.useState)(()=>Date.now()),[_,v]=(0,I.useState)(``),y=(0,I.useCallback)(async(t=!1,r=!1)=>{t&&!r&&o(!0);try{let i=await ld(t);n(i),v(e=>e||i.current_version||``),i.update?.state===`failed`||i.update?.state===`rolled_back`||i.agent?.state===`failed`||i.agent?.state===`rolled_back`?u(i.update?.error||i.agent?.error||e(`updateFailedHint`)):r||u(``)}catch(t){r||u(t instanceof Error?t.message:e(`updateCheckFailedHint`))}finally{i(!1),t&&!r&&o(!1)}},[e]);(0,I.useEffect)(()=>{let e=window.setTimeout(()=>void y(!1),0);return()=>window.clearTimeout(e)},[y]);let b=t?.agent?.state||`unavailable`,x=t?.update?.state||``,S=vd.has(x)||yd.has(b)||!!(t?.update?.backup_path&&_d.has(x)),C=!S&&(x===`ready_to_apply`||b===`ready_to_apply`),ee=!!d?.job_id&&t?.update?.job_id!==d?.job_id&&!C&&!S,te=!S&&!C&&(_d.has(x)||_d.has(b)||ee),w=te||S,T=!!((x===`succeeded`||b===`succeeded`)&&_&&t?.current_version&&t.current_version!==_);T&&p==null&&m(3);let E=t?.update?.target_version||t?.agent?.target_version||``,ne=!!(C&&t?.next_version&&E&&t.next_version!==E),D=t?.update?.started_at||t?.agent?.started_at,re=D&&w?Math.max(0,Math.round((h-Date.parse(D))/1e3)):0,ae=T?`succeeded`:C?`ready_to_apply`:w&&bd.has(b)?b:x||b,oe=ae?e(`updateState_${ae}`):``,O=oe.startsWith(`updateState_`)?ae:oe;(0,I.useEffect)(()=>{if(p!=null||!w&&!T)return;let e=window.setInterval(()=>void y(!1,!0),2e3);return()=>window.clearInterval(e)},[w,T,y,p]),(0,I.useEffect)(()=>{if(!w)return;let e=window.setInterval(()=>g(Date.now()),1e3);return()=>window.clearInterval(e)},[w]),(0,I.useEffect)(()=>{if(p==null)return;if(p<=0){window.location.reload();return}let e=window.setTimeout(()=>m(e=>e==null?e:e-1),1e3);return()=>window.clearTimeout(e)},[p]);let k=!!(t?.managed&&t?.has_update&&t?.next_version&&t?.agent?.available&&!C&&!w&&!s&&p==null),A=!!(C&&t?.agent?.available&&!S&&!s&&p==null),se=!!(t?.agent?.available&&(te||C)&&!S&&!s&&p==null),ce=!!(t?.managed&&t?.agent?.available&&(t.rollback_versions?.length??0)>0&&!C&&!w&&!s&&p==null),j=p==null?e(A?`applyUpdateNow`:S?`updateInProgress`:te||s?`updatePreparingImage`:`updateNow`):e(`updateReloadingIn`,{seconds:p}),M=p==null?C?e(`updateReadyTargetHint`,{version:E||t?.next_version||``}):e(S?`updateApplyingHint`:`updatePreparingImageHint`):e(`updateReloadingHint`);async function N(){c(!0),f(null),u(``);try{let e=await fd();f(e),await y(!1,!0)}catch(t){u(t instanceof Error?t.message:e(`updateFailedHint`)),await y(!1,!0)}finally{c(!1)}}async function le(){c(!0),u(``);try{let e=await pd();f(e),await y(!1,!0)}catch(t){u(t instanceof Error?t.message:e(`updateFailedHint`)),await y(!1,!0)}finally{c(!1)}}async function ue(t){c(!0),f(null),u(``);try{let e=await hd(t);f(e),await y(!1,!0)}catch(t){u(t instanceof Error?t.message:e(`updateFailedHint`)),await y(!1,!0)}finally{c(!1)}}async function de(){c(!0),u(``);try{await md(),f(null),await y(!0,!0)}catch(t){u(t instanceof Error?t.message:e(`updateFailedHint`)),await y(!1,!0)}finally{c(!1)}}return{info:t,loading:r,checking:a,submitting:s,error:l,setError:u,reloadIn:p,load:y,elapsed:re,readyToApply:C,busy:w,justUpdated:T,targetVersion:E,newerThanPrepared:ne,updateStateText:O,canPrepare:k,canApply:A,canCancel:se,canRollback:ce,primaryLabel:j,statusHint:M,prepareUpdate:N,confirmUpdate:le,cancelPreparedUpdate:de,rollbackTo:ue}}var xd={instant:.12,fast:.18,base:.28,slow:.42,calm:.6},Sd={out:`power3.out`,inOut:`power2.inOut`,emphasized:`expo.out`,soft:`back.out(1.2)`,linear:`none`},Cd={tight:.03,base:.045};function wd(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Td(e){return wd()?0:e}var Ed=(0,I.lazy)(()=>It(()=>import(`./SidebarUpdateDialog-BLCxAyNr.js`).then(e=>({default:e.SidebarUpdateDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7])));function Dd({collapsed:e,onNavigate:t}){let{t:n,lang:r}=ie(),i=sr(),a=Z(),{info:o}=a,[s,c]=(0,I.useState)(!1),l=(0,I.useRef)(null);if(!o)return null;let u=!!o.has_update,d=u?o.next_version||o.release?.tag_name||``:o.current_version,f=u?o.release:o.recent_releases?.find(e=>e.tag_name===o.current_version)??o.release,p=u?n(`sidebarNewVersion`,{version:d}):n(`versionUpdate`);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>c(!0),"aria-label":p,title:e?p:void 0,"data-sidebar-item":!0,className:`flex h-10 w-full items-center gap-3 rounded-[10px] text-nav transition-colors ${e?`mx-auto w-10 justify-center px-0`:`px-3`} ${u?`font-medium text-accent`:`text-muted hover:text-foreground`}`,children:[(0,Y.jsxs)(`span`,{ref:l,className:`relative inline-flex shrink-0 will-change-transform`,children:[(0,Y.jsx)(u?ia:Ma,{size:20,weight:u?`fill`:`regular`}),u&&e?(0,Y.jsx)(`span`,{className:`absolute -right-0.5 -top-0.5 size-1.5 rounded-full bg-accent`}):null]}),!e&&(0,Y.jsx)(`span`,{className:`truncate`,children:p}),!e&&!u&&d?(0,Y.jsx)(`span`,{className:`mono ml-auto text-caption`,children:d}):null]}),u?(0,Y.jsx)(Od,{targetRef:l}):null,s?(0,Y.jsx)(I.Suspense,{fallback:null,children:(0,Y.jsx)(Ed,{open:s,update:a,release:f,version:d,lang:r,labels:{versionUpdate:n(`versionUpdate`),close:n(`close`),releaseNotes:n(`sidebarReleaseNotes`),emptyNotes:n(`updateNoNotes`),goToUpdate:n(`sidebarGoToUpdate`)},onClose:()=>c(!1),onGoToUpdate:()=>{c(!1),t?.(),i(`/system?tab=updates`)}})}):null]})}function Od({targetRef:e}){return(0,I.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=Dt.context(()=>{let e=Dt.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Dt.set(t,{clearProps:`transform`})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Dt.timeline({repeat:-1,repeatDelay:4.5});return e.to(t,{x:3,duration:xd.fast,ease:Sd.inOut}).to(t,{x:-2.5,duration:xd.fast,ease:Sd.inOut}).to(t,{x:1.5,duration:xd.instant,ease:Sd.inOut}).to(t,{x:0,duration:xd.fast,ease:Sd.out}),()=>{e.kill()}})},t);return()=>n.revert()},[e]),null}var kd=`M 91.413 45.646 A 32.000 32.000 0 1 0 91.413 82.354`,Ad=`M 96.889 68.454 A 32.000 32.000 0 0 1 91.413 82.354`;function jd({size:e=24,className:t=``,loading:n=!1}){return(0,Y.jsxs)(`svg`,{width:e,height:e,viewBox:`22 22 84 84`,fill:`none`,"aria-hidden":`true`,className:`brand-mark block shrink-0 text-foreground ${n?`brand-mark--loading`:``} ${t}`.trim(),children:[(0,Y.jsx)(`path`,{className:`brand-mark__rail`,pathLength:100,d:kd,stroke:`currentColor`,strokeWidth:11.4,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{className:`brand-mark__tip`,pathLength:100,d:Ad,stroke:`#22D3EE`,strokeWidth:11.4,strokeLinecap:`round`,strokeLinejoin:`round`}),n?(0,Y.jsx)(`path`,{className:`brand-mark__scan`,pathLength:100,d:kd,stroke:`#22D3EE`,strokeWidth:11.4,strokeLinecap:`round`,strokeLinejoin:`round`}):null]})}function Q({className:e}){return(0,Y.jsx)(Cu,{className:`rounded-lg ${e}`})}function Md({rows:e=5}){return(0,Y.jsx)(`div`,{className:`divide-y divide-separator`,children:Array.from({length:e},(e,t)=>(0,Y.jsxs)(`div`,{className:`space-y-2 px-4 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(Q,{className:`h-4 w-28`}),(0,Y.jsx)(Q,{className:`h-3 w-12`})]}),(0,Y.jsx)(Q,{className:`h-1.5 w-full`})]},t))})}function $(){return(0,Y.jsx)(Q,{className:`h-56 w-full`})}function Nd({rows:e=6}){return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:Array.from({length:e},(e,t)=>(0,Y.jsxs)(`div`,{className:`space-y-3 px-4 py-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(Q,{className:`h-4 w-32`}),(0,Y.jsx)(Q,{className:`h-3 w-40`})]}),(0,Y.jsx)(Q,{className:`h-5 w-14`})]}),(0,Y.jsx)(Q,{className:`h-3 w-24`}),(0,Y.jsx)(Q,{className:`h-8 w-40`}),(0,Y.jsx)(Q,{className:`h-8 w-24`})]},`card-${t}`))}),(0,Y.jsxs)(`div`,{className:`hidden lg:block`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-7 gap-4 border-b border-separator px-5 py-4`,children:[(0,Y.jsx)(Q,{className:`h-3 w-20`}),(0,Y.jsx)(Q,{className:`h-3 w-24`}),(0,Y.jsx)(Q,{className:`h-3 w-24`}),(0,Y.jsx)(Q,{className:`h-3 w-20`}),(0,Y.jsx)(Q,{className:`h-3 w-24`}),(0,Y.jsx)(Q,{className:`h-3 w-16`}),(0,Y.jsx)(Q,{className:`h-3 w-16`})]}),Array.from({length:e},(e,t)=>(0,Y.jsxs)(`div`,{className:`grid grid-cols-7 items-center gap-4 border-b border-separator px-5 py-4 last:border-0`,children:[(0,Y.jsx)(Q,{className:`h-5 w-32`}),(0,Y.jsx)(Q,{className:`h-4 w-28`}),(0,Y.jsx)(Q,{className:`h-4 w-20`}),(0,Y.jsx)(Q,{className:`h-4 w-36`}),(0,Y.jsx)(Q,{className:`h-8 w-40`}),(0,Y.jsx)(Q,{className:`h-5 w-14`}),(0,Y.jsx)(Q,{className:`h-8 w-24`})]},`row-${t}`))]})]})}function Pd(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,"aria-label":`Loading overview`,children:[(0,Y.jsxs)(`section`,{className:`flex items-end justify-between gap-4 pb-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Q,{className:`h-8 w-40`}),(0,Y.jsx)(Q,{className:`h-4 w-80 max-w-[70vw]`})]}),(0,Y.jsxs)(`div`,{className:`hidden space-y-2 sm:block`,children:[(0,Y.jsx)(Q,{className:`ml-auto h-8 w-40`}),(0,Y.jsx)(Q,{className:`ml-auto h-4 w-20`})]})]}),(0,Y.jsx)(`section`,{className:`grid overflow-hidden rounded-3xl bg-surface shadow-surface sm:grid-cols-2 xl:grid-cols-4`,children:Array.from({length:4},(e,t)=>(0,Y.jsxs)(`div`,{className:`min-h-32 space-y-5 border-separator p-5 first:border-0 sm:border-l sm:first:border-0`,children:[(0,Y.jsx)(Q,{className:`h-4 w-24`}),(0,Y.jsx)(Q,{className:`h-8 w-28`}),(0,Y.jsx)(Q,{className:`h-3 w-36`})]},t))}),(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-5`,children:[(0,Y.jsx)(Q,{className:`h-5 w-24`}),(0,Y.jsx)(Q,{className:`mt-2 h-3 w-48`}),(0,Y.jsx)(Q,{className:`mt-6 h-56 w-full`}),(0,Y.jsx)(`div`,{className:`mt-5 grid grid-cols-4 gap-3`,children:Array.from({length:4},(e,t)=>(0,Y.jsx)(Q,{className:`h-10 w-full`},t))})]}),(0,Y.jsx)(`section`,{className:`grid gap-5 xl:grid-cols-2`,children:Array.from({length:2},(e,t)=>(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-separator px-5 py-4`,children:[(0,Y.jsx)(Q,{className:`h-5 w-28`}),(0,Y.jsx)(Q,{className:`mt-2 h-3 w-40`})]}),(0,Y.jsx)(Md,{})]},t))}),(0,Y.jsx)(`section`,{className:`grid gap-5 xl:grid-cols-2 2xl:grid-cols-3`,children:Array.from({length:3},(e,t)=>(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-separator px-5 py-4`,children:(0,Y.jsx)(Q,{className:`h-5 w-28`})}),(0,Y.jsx)(Md,{rows:4})]},t))})]})}function Fd(){return(0,Y.jsxs)(`article`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`space-y-2 px-3 pt-2.5 pb-1.5`,children:(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsx)(Q,{className:`size-8 rounded-xl`}),(0,Y.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Q,{className:`h-4 w-28`}),(0,Y.jsx)(Q,{className:`h-4 w-16`})]}),(0,Y.jsx)(Q,{className:`h-3 w-40`})]})]}),(0,Y.jsx)(Q,{className:`h-5 w-14`})]})}),(0,Y.jsxs)(`div`,{className:`space-y-2 px-3 pb-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[(0,Y.jsx)(Q,{className:`h-3 w-16`}),(0,Y.jsx)(Q,{className:`h-2 flex-1`}),(0,Y.jsx)(Q,{className:`h-3 w-14`})]}),(0,Y.jsxs)(`div`,{className:`space-y-1.5 py-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(Q,{className:`h-3 w-14`}),(0,Y.jsx)(Q,{className:`h-3 w-24`})]}),(0,Y.jsx)(Q,{className:`h-1.5 w-full rounded-[1px]`})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-t border-separator px-3 py-2`,children:[(0,Y.jsx)(Q,{className:`h-3 w-20`}),(0,Y.jsx)(Q,{className:`size-7`}),(0,Y.jsx)(Q,{className:`size-7`}),(0,Y.jsx)(Q,{className:`size-7`}),(0,Y.jsx)(Q,{className:`ml-auto h-[18px] w-[74px]`})]})]})}function Id({count:e=5}){return(0,Y.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,"aria-label":`Loading accounts`,children:Array.from({length:e},(e,t)=>(0,Y.jsx)(Fd,{},t))})}function Ld(){return(0,Y.jsxs)(`div`,{className:`space-y-4`,"aria-label":`Loading accounts`,children:[(0,Y.jsxs)(`section`,{className:`flex items-end justify-between gap-4 pb-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-5`,children:[(0,Y.jsx)(Q,{className:`h-4 w-20`}),(0,Y.jsx)(Q,{className:`h-4 w-24`}),(0,Y.jsx)(Q,{className:`h-4 w-24`}),(0,Y.jsx)(Q,{className:`h-4 w-20`})]}),(0,Y.jsx)(Q,{className:`h-8 w-28`})]}),(0,Y.jsxs)(`section`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsx)(Q,{className:`h-8 w-full max-w-md`}),(0,Y.jsx)(Q,{className:`h-8 w-72`})]}),(0,Y.jsx)(Id,{})]})}function Rd(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,"aria-label":`Loading models`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-5 pb-6 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Q,{className:`h-3 w-24`}),(0,Y.jsx)(Q,{className:`h-8 w-44`}),(0,Y.jsx)(Q,{className:`h-4 w-56`})]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 sm:flex-row`,children:[(0,Y.jsx)(Q,{className:`h-8 w-full sm:w-56`}),(0,Y.jsx)(Q,{className:`h-8 w-24`})]})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:(0,Y.jsx)(Nd,{})})]})}function zd(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,"aria-label":`Loading API keys`,children:[(0,Y.jsxs)(`section`,{className:`flex items-end justify-between gap-4 pb-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Q,{className:`h-8 w-40`}),(0,Y.jsx)(Q,{className:`h-4 w-80 max-w-[70vw]`})]}),(0,Y.jsx)(Q,{className:`h-8 w-28`})]}),(0,Y.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,children:Array.from({length:3},(e,t)=>(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-3`,children:[(0,Y.jsx)(Q,{className:`h-4 w-28`}),(0,Y.jsx)(Q,{className:`mt-2 h-3 w-40`}),(0,Y.jsx)(Q,{className:`mt-4 h-6 w-24`}),(0,Y.jsx)(Q,{className:`mt-6 h-8 w-full`})]},t))})]})}function Bd(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,"aria-label":`Loading access settings`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-5 pb-6 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Q,{className:`h-3 w-32`}),(0,Y.jsx)(Q,{className:`h-8 w-44`}),(0,Y.jsx)(Q,{className:`h-4 w-80 max-w-[70vw]`})]}),(0,Y.jsx)(Q,{className:`h-7 w-24`})]}),(0,Y.jsxs)(`section`,{className:`grid overflow-hidden rounded-3xl bg-surface shadow-surface sm:grid-cols-3`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3 border-b border-separator p-5 sm:col-span-2 sm:border-r sm:border-b-0`,children:[(0,Y.jsx)(Q,{className:`h-3 w-20`}),(0,Y.jsx)(Q,{className:`h-4 w-72 max-w-full`})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 p-5 sm:grid-cols-1`,children:[(0,Y.jsx)(Q,{className:`h-4 w-24`}),(0,Y.jsx)(Q,{className:`h-4 w-28`})]})]}),(0,Y.jsxs)(`section`,{className:`grid min-h-[620px] overflow-hidden rounded-3xl bg-surface shadow-surface xl:grid-cols-[minmax(440px,.92fr)_minmax(0,1.08fr)]`,children:[(0,Y.jsxs)(`div`,{className:`space-y-6 border-b border-separator p-7 xl:border-r xl:border-b-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(Q,{className:`size-9`}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(Q,{className:`h-4 w-32`}),(0,Y.jsx)(Q,{className:`h-3 w-28`})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(Q,{className:`h-4 w-16`}),(0,Y.jsx)(Q,{className:`h-10 w-full`})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(Q,{className:`h-4 w-16`}),(0,Y.jsx)(Q,{className:`h-10 w-full`})]})]}),(0,Y.jsx)(Q,{className:`h-56 w-full`}),(0,Y.jsx)(Q,{className:`h-12 w-full`})]}),(0,Y.jsxs)(`div`,{className:`space-y-4 bg-surface-secondary p-6`,children:[(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(Q,{className:`h-4 w-32`}),(0,Y.jsx)(Q,{className:`h-3 w-44`})]}),(0,Y.jsx)(Q,{className:`h-6 w-20`})]}),(0,Y.jsx)(Q,{className:`mt-10 h-3 w-32`}),(0,Y.jsx)(Q,{className:`h-3 w-full`}),(0,Y.jsx)(Q,{className:`h-3 w-[86%]`})]})]}),(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-5`,children:[(0,Y.jsx)(Q,{className:`h-4 w-36`}),(0,Y.jsx)(Q,{className:`mt-5 h-24 w-full`})]})]})}function Vd(){return(0,Y.jsxs)(`div`,{"aria-label":`Loading logs`,children:[(0,Y.jsx)(`div`,{className:`hidden grid-cols-10 gap-4 border-b border-separator px-5 py-3 md:grid`,children:Array.from({length:10},(e,t)=>(0,Y.jsx)(Q,{className:`h-3 w-16`},t))}),Array.from({length:8},(e,t)=>(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 items-center gap-4 border-b border-separator px-5 py-3.5 last:border-0 md:grid-cols-10`,children:[(0,Y.jsx)(Q,{className:`h-4 w-28`}),(0,Y.jsx)(Q,{className:`h-4 w-24`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-20 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-16 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-16 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-16 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-14 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-12 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-12 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-16 md:block`})]},t))]})}function Hd(){return(0,Y.jsx)(`div`,{className:`divide-y divide-separator`,"aria-label":`Loading logs`,children:Array.from({length:8},(e,t)=>(0,Y.jsxs)(`div`,{className:`grid gap-2 px-5 py-3 sm:grid-cols-[150px_72px_minmax(0,1fr)] sm:items-center`,children:[(0,Y.jsx)(Q,{className:`h-3 w-24`}),(0,Y.jsx)(Q,{className:`h-3 w-12`}),(0,Y.jsx)(Q,{className:`h-4 w-full`})]},t))})}function Ud(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,"aria-label":`Loading logs`,children:[(0,Y.jsxs)(`section`,{className:`flex items-end justify-between gap-4 pb-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Q,{className:`h-8 w-28`}),(0,Y.jsx)(Q,{className:`h-4 w-72 max-w-[70vw]`})]}),(0,Y.jsx)(Q,{className:`h-8 w-24`})]}),(0,Y.jsx)(Q,{className:`h-9 w-full max-w-md`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(Q,{className:`h-8 w-72`}),(0,Y.jsx)(Q,{className:`h-8 w-56`})]}),(0,Y.jsx)(Q,{className:`h-4 w-20`})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:(0,Y.jsx)(Vd,{})})]})}function Wd(){return(0,Y.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1.18fr)_minmax(360px,.82fr)]`,children:[(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-5`,children:[(0,Y.jsx)(Q,{className:`h-5 w-28`}),(0,Y.jsx)(Q,{className:`mt-2 h-3 w-48`}),(0,Y.jsx)(Q,{className:`mt-6 h-24 w-full`}),(0,Y.jsx)(Q,{className:`mt-5 h-48 w-full`})]}),(0,Y.jsxs)(`div`,{className:`space-y-5`,children:[(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-5`,children:[(0,Y.jsx)(Q,{className:`h-5 w-32`}),(0,Y.jsx)(Q,{className:`mt-4 h-10 w-full`}),(0,Y.jsx)(Q,{className:`mt-3 h-3 w-40`})]}),(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-5`,children:[(0,Y.jsx)(Q,{className:`h-5 w-28`}),(0,Y.jsx)(Q,{className:`mt-4 h-10 w-full`})]})]})]})}function Gd(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,"aria-label":`Loading system`,children:[(0,Y.jsxs)(`section`,{className:`flex items-end justify-between gap-4 pb-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Q,{className:`h-8 w-40`}),(0,Y.jsx)(Q,{className:`h-4 w-80 max-w-[70vw]`})]}),(0,Y.jsx)(Q,{className:`h-8 w-28`})]}),(0,Y.jsx)(Wd,{})]})}function Kd(e,t){(0,I.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=Dt.context(()=>{let e=Dt.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Dt.set(`[data-gsap-reveal]`,{clearProps:`all`})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Dt.utils.toArray(`[data-gsap-reveal]`);e.length&&Dt.from(e,{autoAlpha:0,y:10,duration:.42,ease:`power3.out`,stagger:.045,clearProps:`all`})})},t);return()=>n.revert()},[e,t])}function qd(e){window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||Dt.fromTo(e,{scale:.975},{scale:1,duration:.18,ease:`power2.out`,overwrite:!0})}function Jd(){let{overview:e,loading:t}=td();return{enabled:!!e?.proxy?.cross_provider_model_pool,loading:t}}var Yd=[{to:`/`,key:`navOverview`,icon:ga,section:`workspace`,end:!0},{to:`/usage`,key:`navUsage`,icon:ua,section:`workspace`},{to:`/accounts`,key:`navAccounts`,icon:Wa,section:`workspace`},{to:`/providers`,key:`navProviders`,icon:ma,section:`develop`},{to:`/model-pool`,key:`navModelPool`,icon:ca,section:`develop`,requiresPool:!0},{to:`/access`,key:`navAccess`,icon:Ea,section:`develop`},{to:`/logs`,key:`navLogs`,icon:Pa,section:`system`},{to:`/keys`,key:`navKeys`,icon:wa,section:`system`},{to:`/system`,key:`navSystem`,icon:va,section:`system`}],Xd=`cli2api:sidebar-collapsed`;function Zd({collapsed:e,onNavigate:t}){let{t:n}=ie(),{enabled:r,loading:i}=Jd(),a=[{key:`workspace`,label:n(`workspace`)},{key:`develop`,label:n(`develop`)},{key:`system`,label:n(`system`)}],o=Yd.filter(e=>!(`requiresPool`in e)||!e.requiresPool||!i&&r);return(0,Y.jsx)(`nav`,{className:`flex flex-col gap-6`,children:a.map(r=>(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e?(0,Y.jsx)(xu,{className:`mx-auto mb-1.5 w-6 opacity-60`}):(0,Y.jsx)(`span`,{className:`px-3 pb-1.5 text-caption font-medium text-muted`,children:r.label}),o.filter(e=>e.section===r.key).map(r=>{let i=r.icon;return(0,Y.jsx)(Ti,{to:r.to,end:`end`in r&&r.end,onClick:t,"aria-label":n(r.key),title:e?n(r.key):void 0,"data-sidebar-item":!0,className:({isActive:t})=>`group/navitem relative flex h-10 items-center gap-3 rounded-[10px] text-nav transition-colors will-change-transform ${e?`mx-auto w-10 justify-center px-0`:`px-3`} ${t?`sidebar-item-active font-medium text-foreground`:`font-normal text-muted hover:text-foreground`}`,onMouseDown:e=>qd(e.currentTarget),children:({isActive:t})=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`inline-flex shrink-0`,"data-nav-icon":!0,children:(0,Y.jsx)(i,{size:20,weight:t?`fill`:`regular`})}),!e&&(0,Y.jsx)(`span`,{className:`truncate`,"data-nav-label":!0,children:n(r.key)}),e&&(0,Y.jsx)(`span`,{className:`pointer-events-none absolute left-full z-50 ml-2 invisible whitespace-nowrap rounded-lg bg-foreground px-2 py-1 text-caption font-medium text-background opacity-0 shadow-overlay transition-opacity duration-150 group-hover/navitem:visible group-hover/navitem:opacity-100`,children:n(r.key)})]})},r.to)})]},r.key))})}function Qd({compact:e=!1}){let{t}=ie();return(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 ${e?`justify-center`:`px-1.5`}`,children:[(0,Y.jsx)(jd,{size:36}),!e&&(0,Y.jsxs)(`div`,{className:`min-w-0 leading-tight`,children:[(0,Y.jsx)(`div`,{className:`text-section font-semibold tracking-tight`,children:`CLI2API`}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-caption text-muted`,children:t(`controlPlane`)})]})]})}function $d({label:e}){return(0,Y.jsxs)(`div`,{className:`rounded-xl bg-surface shadow-surface p-3`,"aria-busy":`true`,"aria-label":e,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Q,{className:`size-2`}),(0,Y.jsx)(Q,{className:`h-4 w-12`})]}),(0,Y.jsx)(Q,{className:`h-5 w-10`})]}),(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3 pt-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(Q,{className:`h-3 w-10`}),(0,Y.jsx)(Q,{className:`mt-1.5 h-4 w-12`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(Q,{className:`h-3 w-8`}),(0,Y.jsx)(Q,{className:`mt-1.5 h-4 w-10`})]})]})]})}function ef({initial:e,collapsed:t}){let{t:n}=ie(),r=e,i=n(`sidebarInFlight`,{count:r});return(0,Y.jsxs)(Qu,{delay:200,children:[(0,Y.jsx)(Qu.Trigger,{children:(0,Y.jsxs)(`span`,{role:`status`,"aria-label":i,className:`inline-flex h-8 items-center gap-2 rounded-lg text-caption text-muted ${t?`w-10 justify-center`:`px-3`}`,children:[(0,Y.jsx)(`span`,{className:`status-dot`,"data-state":r>0?`ok`:void 0}),(0,Y.jsx)(`span`,{className:`mono tabular text-foreground`,children:r})]})}),(0,Y.jsx)(Qu.Content,{children:i})]})}function tf({mobileOpen:e,onClose:t}){let{t:n}=ie(),{overview:r,loading:i}=td(),[a,o]=(0,I.useState)(()=>localStorage.getItem(Xd)===`1`),s=!!r?.proxy?.ok,c=!!r?.worker?.ok,l=s&&c,u=r?.worker?.account_count??0,d=r?.worker?.hot_count??0,f=i;function p(){o(e=>{let t=!e;return localStorage.setItem(Xd,t?`1`:`0`),t})}let m=(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`text-muted`,onPress:p,"aria-label":n(`toggleSidebar`),children:(0,Y.jsx)(Ia,{size:18,className:a?`rotate-180`:``})}),h=(0,Y.jsxs)(`div`,{className:`mt-auto shrink-0 space-y-2 pt-6`,children:[!a&&(f?(0,Y.jsx)($d,{label:n(`refreshing`)}):(0,Y.jsxs)(`div`,{className:`sidebar-status rounded-xl px-3.5 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-nav font-medium`,children:[(0,Y.jsx)(`span`,{className:`status-dot`,"data-state":l?`ok`:`danger`}),n(l?`running`:`degraded`)]}),(0,Y.jsxs)(nu,{size:`sm`,variant:`soft`,color:l?`success`:`warning`,children:[d,`/`,u]})]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5 text-caption text-muted`,children:[(0,Y.jsx)(`span`,{children:`Proxy`}),(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:s?`online`:`down`}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`span`,{children:n(`accountCount`)}),(0,Y.jsxs)(`span`,{className:`mono font-medium text-foreground`,children:[d,`/`,u]})]})]})),a?(0,Y.jsx)(`div`,{className:`flex justify-center`,children:(0,Y.jsxs)(Qu,{children:[(0,Y.jsx)(Qu.Trigger,{children:(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":n(`runtimeSnapshot`),children:f?(0,Y.jsx)(Q,{className:`size-2`}):(0,Y.jsx)(`span`,{className:`status-dot`,"data-state":l?`ok`:`danger`})})}),(0,Y.jsx)(Qu.Content,{children:n(f?`refreshing`:l?`running`:`degraded`)})]})}):null,(0,Y.jsx)(Dd,{collapsed:a}),(0,Y.jsxs)(`div`,{className:`flex items-center ${a?`flex-col gap-1`:`justify-between gap-2`}`,children:[(0,Y.jsx)(ef,{initial:r?.worker?.in_flight??0,collapsed:a}),!a&&(0,Y.jsx)(`p`,{className:`min-w-0 truncate pr-3 text-caption text-muted`,title:n(`sidebarFoot`),children:n(`sidebarFoot`)})]})]});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`aside`,{className:`hidden h-dvh shrink-0 flex-col bg-surface-secondary text-foreground transition-[width] duration-300 ease-out md:flex ${a?`w-[76px] px-2.5 py-5`:`w-[260px] px-4 py-5`}`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 ${a?`flex-col items-center gap-3`:`h-12 items-center justify-between gap-2`}`,children:[(0,Y.jsx)(Qd,{compact:a}),m]}),(0,Y.jsx)(`div`,{className:`${a?`mt-5`:`mt-7`} min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Y.jsx)(Zd,{collapsed:a})}),h]}),(0,Y.jsx)(yu,{isOpen:e,onOpenChange:e=>{e||t()},children:(0,Y.jsx)(yu.Content,{placement:`left`,children:(0,Y.jsxs)(yu.Dialog,{className:`w-72 bg-surface-secondary px-4 py-5 text-foreground`,children:[(0,Y.jsxs)(`div`,{className:`flex h-12 items-center justify-between`,children:[(0,Y.jsx)(Qd,{}),(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:t,"aria-label":n(`close`),children:(0,Y.jsx)(Ja,{size:16})})]}),(0,Y.jsx)(yu.Body,{className:`mt-5 px-0`,children:(0,Y.jsx)(Zd,{collapsed:!1,onNavigate:t})})]})})})]})}function nf(){return(0,Y.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(Q,{className:`h-8 w-52 max-w-full`}),(0,Y.jsx)(Q,{className:`h-4 w-80 max-w-full`})]}),(0,Y.jsx)(`div`,{className:`grid gap-2.5 md:grid-cols-2 xl:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,Y.jsx)(Q,{className:`h-28`},t))})]})}var rf={loading:1/0,success:3200,error:6e3,info:4e3},af=4,of=[],sf=0,cf=new Set,lf=new Map;function uf(){for(let e of cf)e()}function df(e){return cf.add(e),()=>{cf.delete(e)}}function ff(){return of}function pf(e){let t=lf.get(e);t&&window.clearTimeout(t),lf.delete(e),of.some(t=>t.id===e&&!t.leaving)&&(of=of.map(t=>t.id===e?{...t,leaving:!0}:t),uf())}function mf(e){of=of.filter(t=>t.id!==e),uf()}function hf(e){let t=e.id??`toast-${++sf}`,n=e.type??`info`,r=of.find(e=>e.id===t),i={id:t,type:n,title:e.title,description:e.description,version:(r?.version??0)+1,leaving:!1};of=r?of.map(e=>e.id===t?i:e):[...of,i];let a=of.filter(e=>!e.leaving);a.length>af&&pf(a[0].id);let o=lf.get(t);o&&window.clearTimeout(o),lf.delete(t);let s=e.duration??rf[n];return Number.isFinite(s)&&lf.set(t,window.setTimeout(()=>pf(t),s)),uf(),t}var gf={loading:(0,Y.jsx)(Ba,{size:16,className:`animate-spin text-muted motion-reduce:animate-none`}),success:(0,Y.jsx)(fa,{size:16,weight:`fill`,className:`text-success`}),error:(0,Y.jsx)(Ka,{size:16,weight:`fill`,className:`text-danger`}),info:(0,Y.jsx)(Sa,{size:16,weight:`fill`,className:`text-accent`})};function _f({item:e}){let t=(0,I.useRef)(null),n=(0,I.useRef)(null),r=(0,I.useRef)(e.version);return(0,I.useLayoutEffect)(()=>{let e=t.current;if(!e||wd())return;let n=Dt.from(e,{autoAlpha:0,y:16,scale:.96,duration:xd.slow,ease:Sd.out,clearProps:`transform,opacity,visibility`});return()=>{n.kill()}},[]),(0,I.useLayoutEffect)(()=>{let t=n.current;if(!t||e.version===r.current||wd())return;let i=Dt.fromTo(t,{autoAlpha:0,y:4},{autoAlpha:1,y:0,duration:xd.base,ease:Sd.out});return()=>{i.kill()}},[e.version]),(0,I.useLayoutEffect)(()=>{let n=t.current;if(!e.leaving||!n)return;if(wd()){mf(e.id);return}let r=Dt.to(n,{autoAlpha:0,x:24,height:0,marginTop:0,paddingTop:0,paddingBottom:0,duration:xd.base,ease:Sd.inOut,onComplete:()=>mf(e.id)});return()=>{r.kill()}},[e.leaving,e.id]),(0,Y.jsxs)(`div`,{ref:t,role:e.type===`error`?`alert`:`status`,className:`pointer-events-auto mt-2 flex w-full items-start gap-2.5 overflow-hidden rounded-xl bg-overlay px-3.5 py-3 text-body text-foreground shadow-overlay`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 inline-flex shrink-0`,children:gf[e.type]}),(0,Y.jsxs)(`div`,{ref:n,className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`font-medium leading-5`,children:e.title}),e.description?(0,Y.jsx)(`div`,{className:`mt-0.5 break-words text-caption leading-5 text-muted`,children:e.description}):null]}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Close`,onClick:()=>pf(e.id),className:`grid size-6 shrink-0 place-items-center rounded-md text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Y.jsx)(Ja,{size:12})})]})}function vf(){let e=(0,I.useSyncExternalStore)(df,ff,ff);return(0,Y.jsx)(`div`,{"aria-live":`polite`,className:`pointer-events-none fixed bottom-4 right-4 z-[100] flex w-[min(360px,calc(100vw-2rem))] flex-col`,children:e.map(e=>(0,Y.jsx)(_f,{item:e},e.id))})}var yf={"/":`home`,"/auth":`auth`,"/providers":`providers`,"/model-pool":`modelPool`,"/access":`access`,"/accounts":`accounts`,"/usage":`usage`,"/logs":`logs`,"/keys":`keys`,"/system":`system`};function bf(){let[e,t]=(0,I.useState)(!1),n=(0,I.useCallback)(()=>t(!1),[]),r=ir(),{page:i}=ie(),a=i(r.pathname===`/model-pool`||r.pathname.startsWith(`/model-pool/`)?`modelPool`:yf[r.pathname]||`home`),o=r.pathname.startsWith(`/model-pool/`);return(0,Y.jsxs)(`div`,{className:`relative flex h-dvh overflow-hidden bg-background text-foreground`,children:[(0,Y.jsxs)(`div`,{className:`relative z-10 flex min-h-0 min-w-0 flex-1`,children:[(0,Y.jsx)(tf,{mobileOpen:e,onClose:n}),(0,Y.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Y.jsx)(cd,{title:a.title,desc:a.desc,wide:o,onMenu:()=>t(!0)}),(0,Y.jsx)(`main`,{className:o?`min-h-0 flex-1 overflow-y-auto xl:overflow-hidden`:`min-h-0 flex-1 overflow-y-auto`,children:(0,Y.jsx)(`div`,{className:o?`flex w-full flex-col px-3 pb-6 sm:px-4 lg:px-5 xl:h-full xl:min-h-0 xl:overflow-hidden xl:pb-3`:`mx-auto w-full max-w-[1480px] px-4 pb-12 pt-5 sm:px-6 lg:px-8 lg:pb-16 lg:pt-6`,children:(0,Y.jsx)(I.Suspense,{fallback:(0,Y.jsx)(nf,{}),children:(0,Y.jsx)(`div`,{className:o?`flex min-h-0 flex-1 flex-col`:void 0,children:(0,Y.jsx)(Pr,{})},r.pathname)})})})]})]}),(0,Y.jsx)(vf,{})]})}function xf(){let{overview:e,error:t}=td(),{apiKey:n}=xt(),r=ir();return!n||!e&&wt(t)?(0,Y.jsx)(Nr,{to:`/login`,replace:!0,state:{from:r.pathname}}):(0,Y.jsx)(Pr,{})}var Sf=(0,I.lazy)(()=>It(()=>import(`./LoginPage-Bkx6s23i.js`).then(e=>({default:e.LoginPage})),__vite__mapDeps([8,1,9,10,2,3,11,12,13,14,15,16,17,18,19,20,4,21,22,23,24,25]))),Cf=(0,I.lazy)(()=>It(()=>import(`./OverviewPage-Bx7MkU6l.js`).then(e=>({default:e.OverviewPage})),__vite__mapDeps([26,1,9,10,2,3,11,12,13,14,15,16,17,18,19,20,27,28,23,29,30,4,31,32,33,34,35,36]))),wf=(0,I.lazy)(()=>It(()=>import(`./ProvidersPage-QdKnZCML.js`).then(e=>({default:e.ProvidersPage})),__vite__mapDeps([37,1,11,2,3,38,39,17,23,24,31,4,16,40,41,42,43,22,44,5,6,45,29,18,46,28,47,48,19,49,32,20,34,50,51,52,53,30]))),Tf=(0,I.lazy)(()=>It(()=>import(`./ModelPoolPage-B2h7PTH3.js`).then(e=>({default:e.ModelPoolPage})),__vite__mapDeps([54,1,10,2,3,13,55,4,56,6,16,17,42,18,46,28,47,41,48,57,19]))),Ef=(0,I.lazy)(()=>It(()=>import(`./ModelPoolEditorPage-BncyTHAE.js`).then(e=>({default:e.ModelPoolEditorPage})),__vite__mapDeps([58,1,12,2,3,13,14,55,15,17,4,16,40,41,43,22,23,24,44,21,45,29,39,18,19,25,20,34,51,52,47,53,30,57]))),Df=(0,I.lazy)(()=>It(()=>import(`./AccessPage-DObXAGNo.js`).then(e=>({default:e.AccessPage})),__vite__mapDeps([59,1,60,12,2,3,61,22,17,23,24,32,11,13,4,42,52,47,44,62,48,53,30,31,19,36,20,34,63]))),Of=(0,I.lazy)(()=>It(()=>import(`./AccountsPage-DAwU5tJE.js`).then(e=>({default:e.AccountsPage})),__vite__mapDeps([64,1,60,12,2,3,61,22,17,23,24,32,11,38,39,31,13,65,55,4,56,6,16,66,44,42,43,52,47,5,45,29,53,30,18,19,25,49,36,20,34,67,50]))),kf=(0,I.lazy)(()=>It(()=>import(`./SystemPage-CzaQG9BL.js`).then(e=>({default:e.SystemPage})),__vite__mapDeps([68,1,61,2,3,65,17,69,30,4,56,6,16,66,44,43,22,23,24,52,47,5,62,48,53,18,19,7,50,70]))),Af=(0,I.lazy)(()=>It(()=>import(`./LogsPage-m7D0s5US.js`).then(e=>({default:e.LogsPage})),__vite__mapDeps([71,1,38,2,3,39,17,23,24,31,55,27,28,29,30,19,4,56,6,72,52,47,44,70,16,42,5,62,48,46,41,36,32,34,63,51,53]))),jf=(0,I.lazy)(()=>It(()=>import(`./UsagePage-BiZWMn4T.js`).then(e=>({default:e.UsagePage})),__vite__mapDeps([73,1,14,2,3,27,28,17,23,29,30,19,69,4,72,52,47,44,39,24,70,16,42,62,48,46,41,31,36,32,20,34,67,35]))),Mf=(0,I.lazy)(()=>It(()=>import(`./KeysPage-VmzvWLOM.js`).then(e=>({default:e.KeysPage})),__vite__mapDeps([74,1,61,2,3,13,55,17,4,16,40,41,66,44,42,43,22,23,24,5,6,45,29,18,19,49,32,20,34,50,70])));function Nf(){return(0,Y.jsx)(ad,{children:(0,Y.jsx)(j,{children:(0,Y.jsx)(Tt,{children:(0,Y.jsx)(ed,{children:(0,Y.jsx)(Ci,{children:(0,Y.jsx)(I.Suspense,{fallback:(0,Y.jsx)(nf,{}),children:(0,Y.jsxs)(Lr,{children:[(0,Y.jsx)(Fr,{path:`/login`,element:(0,Y.jsx)(Sf,{})}),(0,Y.jsx)(Fr,{element:(0,Y.jsx)(xf,{}),children:(0,Y.jsxs)(Fr,{element:(0,Y.jsx)(bf,{}),children:[(0,Y.jsx)(Fr,{path:`/`,element:(0,Y.jsx)(Cf,{})}),(0,Y.jsx)(Fr,{path:`/auth`,element:(0,Y.jsx)(Nr,{to:`/accounts`,replace:!0})}),(0,Y.jsx)(Fr,{path:`/providers`,element:(0,Y.jsx)(wf,{})}),(0,Y.jsx)(Fr,{path:`/model-pool`,element:(0,Y.jsx)(Tf,{})}),(0,Y.jsx)(Fr,{path:`/model-pool/new`,element:(0,Y.jsx)(Ef,{})}),(0,Y.jsx)(Fr,{path:`/model-pool/*`,element:(0,Y.jsx)(Ef,{})}),(0,Y.jsx)(Fr,{path:`/access`,element:(0,Y.jsx)(Df,{})}),(0,Y.jsx)(Fr,{path:`/accounts`,element:(0,Y.jsx)(Of,{})}),(0,Y.jsx)(Fr,{path:`/checkins`,element:(0,Y.jsx)(Nr,{to:`/accounts`,replace:!0})}),(0,Y.jsx)(Fr,{path:`/usage`,element:(0,Y.jsx)(jf,{})}),(0,Y.jsx)(Fr,{path:`/logs`,element:(0,Y.jsx)(Af,{})}),(0,Y.jsx)(Fr,{path:`/keys`,element:(0,Y.jsx)(Mf,{})}),(0,Y.jsx)(Fr,{path:`/system`,element:(0,Y.jsx)(kf,{})}),(0,Y.jsx)(Fr,{path:`*`,element:(0,Y.jsx)(Nr,{to:`/`,replace:!0})})]})})]})})})})})})})}(0,Mt.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(I.StrictMode,{children:(0,Y.jsx)(Nf,{})}));export{ll as $,It as $t,Du as A,Wa as At,K as B,va as Bt,Z as C,V as Ct,od as D,Xa as Dt,dd as E,Za as Et,Ql as F,Aa as Ft,Ll as G,oa as Gt,Rl as H,fa as Ht,Zl as I,Ea as It,Ml as J,Nr as Jt,wl as K,ia as Kt,Jl as L,wa as Lt,xu as M,Ba as Mt,nu as N,Ia as Nt,td as O,Ja as Ot,Xl as P,Pa as Pt,ml as Q,Ai as Qt,Gl as R,Sa as Rt,Cd as S,mo as St,ud as T,io as Tt,zl as U,ua as Ut,J as V,ma as Vt,Il as W,ca as Wt,Dl as X,sr as Xt,Ol as Y,ir as Yt,gl as Z,dr as Zt,jd as _,Ps as _t,Ld as a,Vc as at,Td as b,Ds as bt,Vd as c,Lc as ct,Rd as d,Nc as dt,Zc as et,Nd as f,Tc as ft,$ as g,Ns as gt,Gd as h,Fs as ht,Bd as i,Gc as it,Cu as j,Ha as jt,Qu as k,Ka as kt,Hd as l,Ic as lt,Q as m,Ls as mt,Jd as n,Kc as nt,zd as o,H as ot,Md as p,Rs as pt,Pl as q,wi as qt,Kd as r,qc as rt,Ud as s,zc as st,hf as t,Wc as tt,Pd as u,Fc as ut,xd as v,As as vt,gd as w,oo as wt,wd as x,Ts as xt,Sd as y,ks as yt,Wl as z,ba as zt}; \ No newline at end of file +}`,document.head.prepend(i);let o=e=>{if(!(e.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){e.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},s=e=>{let t=F(e),n=e.relatedTarget;n&&b(n)?(n.focus({preventScroll:!0}),No(n,b(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},c=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=fe(),n=t!=null&&b(t);c.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&No(this,n)};let l=dt(Mo(document,`touchstart`,r,{passive:!1,capture:!0}),Mo(document,`touchmove`,o,{passive:!1,capture:!0}),Mo(document,`blur`,s,!0));return()=>{e(),l(),i.remove(),HTMLElement.prototype.focus=c}}function jo(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Mo(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function No(e,t){t||!To?Po(e):To.addEventListener(`resize`,()=>Po(e),{once:!0})}function Po(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=Za(n);if(e!==document.documentElement&&e!==document.body&&e!==n){let t=e.getBoundingClientRect(),r=n.getBoundingClientRect();if(r.topt.top+n.clientHeight){let n=t.bottom;To&&(n=Math.min(n,To.offsetTop+To.height));let i=r.top-t.top-((n-t.top)/2-r.height/2);e.scrollTo({top:Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+i)),behavior:`smooth`})}}n=e.parentElement}}function Fo(e,t){let{triggerRef:n,popoverRef:r,groupRef:i,isNonModal:a,isKeyboardDismissDisabled:o,shouldCloseOnInteractOutside:s,...c}=e,l=c.trigger===`SubmenuTrigger`,{overlayProps:d,underlayProps:f}=wo({isOpen:t.isOpen,onClose:t.close,shouldCloseOnBlur:!0,isDismissable:!a||l,isKeyboardDismissDisabled:o,shouldCloseOnInteractOutside:s},i??r),{overlayProps:p,arrowProps:m,placement:h,triggerAnchorPoint:g}=u({...c,targetRef:n,overlayRef:r,isOpen:t.isOpen,onClose:a&&!l?t.close:null,getTargetRect:c.getTargetRect??(t.point?()=>new DOMRect(t.point.x,t.point.y,0,0):void 0)});Oo({isDisabled:a||!t.isOpen}),(0,I.useEffect)(()=>{if(t.isOpen&&r.current)return a?bo(i?.current??r.current):yo([i?.current??r.current],{shouldUseInert:!0})},[a,t.isOpen,r,i]);let{focusWithinProps:_}=We(e);return{popoverProps:P(d,p,_),arrowProps:m,underlayProps:f,placement:h,triggerAnchorPoint:g}}var Io={};Io={dismiss:`تجاهل`};var Lo={};Lo={dismiss:`Отхвърляне`};var Ro={};Ro={dismiss:`Odstranit`};var zo={};zo={dismiss:`Luk`};var Bo={};Bo={dismiss:`Schließen`};var Vo={};Vo={dismiss:`Απόρριψη`};var Ho={};Ho={dismiss:`Dismiss`};var Uo={};Uo={dismiss:`Descartar`};var Wo={};Wo={dismiss:`Lõpeta`};var Go={};Go={dismiss:`Hylkää`};var Ko={};Ko={dismiss:`Rejeter`};var qo={};qo={dismiss:`התעלם`};var Jo={};Jo={dismiss:`Odbaci`};var Yo={};Yo={dismiss:`Elutasítás`};var Xo={};Xo={dismiss:`Ignora`};var Zo={};Zo={dismiss:`閉じる`};var Qo={};Qo={dismiss:`무시`};var $o={};$o={dismiss:`Atmesti`};var es={};es={dismiss:`Nerādīt`};var ts={};ts={dismiss:`Lukk`};var ns={};ns={dismiss:`Negeren`};var rs={};rs={dismiss:`Zignoruj`};var is={};is={dismiss:`Descartar`};var as={};as={dismiss:`Dispensar`};var os={};os={dismiss:`Revocare`};var ss={};ss={dismiss:`Пропустить`};var cs={};cs={dismiss:`Zrušiť`};var ls={};ls={dismiss:`Opusti`};var us={};us={dismiss:`Odbaci`};var ds={};ds={dismiss:`Avvisa`};var fs={};fs={dismiss:`Kapat`};var ps={};ps={dismiss:`Скасувати`};var ms={};ms={dismiss:`取消`};var hs={};hs={dismiss:`關閉`};var gs={};gs={"ar-AE":Io,"bg-BG":Lo,"cs-CZ":Ro,"da-DK":zo,"de-DE":Bo,"el-GR":Vo,"en-US":Ho,"es-ES":Uo,"et-EE":Wo,"fi-FI":Go,"fr-FR":Ko,"he-IL":qo,"hr-HR":Jo,"hu-HU":Yo,"it-IT":Xo,"ja-JP":Zo,"ko-KR":Qo,"lt-LT":$o,"lv-LV":es,"nb-NO":ts,"nl-NL":ns,"pl-PL":rs,"pt-BR":is,"pt-PT":as,"ro-RO":os,"ru-RU":ss,"sk-SK":cs,"sl-SI":ls,"sr-SP":us,"sv-SE":ds,"tr-TR":fs,"uk-UA":ps,"zh-CN":ms,"zh-TW":hs};function _s(e){return e&&e.__esModule?e.default:e}function vs(e){let{onDismiss:t,...n}=e,r=E(_s(gs),`@react-aria/overlays`),i=le(n,r.format(`dismiss`)),a=()=>{t&&t()};return I.createElement(o,null,I.createElement(`button`,{...i,tabIndex:-1,onClick:a,style:{width:1,height:1}}))}var ys=I.forwardRef(({children:e,...t},n)=>{let r=(0,I.useRef)(!1),i=(0,I.useContext)(Ke),a=P(i||{},{...t,register(){r.current=!0,i&&i.register()}});return a.ref=ye(n||i?.ref),Ae(i,a.ref),(0,I.useEffect)(()=>{r.current||=!0},[]),I.createElement(Ke.Provider,{value:a},e)});function bs({children:e}){let t=(0,I.useMemo)(()=>({register:()=>{}}),[]);return I.createElement(Ke.Provider,{value:t},e)}var xs=t(n(),1),Ss=I.createContext(null);function Cs(e){let t=mt(),{portalContainer:n=t?null:document.body,isExiting:r}=e,[i,a]=(0,I.useState)(!1),o=(0,I.useMemo)(()=>({contain:i,setContain:a}),[i,a]),{getContainer:s}=m();if(!e.portalContainer&&s&&(n=s()),!n)return null;let c=e.children;return e.disableFocusManagement||(c=I.createElement(Je,{restoreFocus:!0,contain:(e.shouldContainFocus||i)&&!r},c)),c=I.createElement(Ss.Provider,{value:o},I.createElement(bs,null,I.createElement(ze.Provider,{value:null},c))),xs.createPortal(c,n)}function ws(){let e=(0,I.useContext)(Ss)?.setContain;Ue(()=>{e?.(!0)},[e])}var Ts=(0,I.createContext)(null),Es=(0,I.createContext)(null),Ds=(0,I.forwardRef)(function(e,t){[e,t]=Xe(e,t,Ts);let n=(0,I.useContext)(Ll),r=ue(e),i=e.isOpen!=null||e.defaultOpen!=null||!n?r:n,a=T(t,i.isOpen),o=e.isExiting||!e.shouldSkipAnimation&&a||!1,s=M(),{direction:c}=Ze();if(s){let t=e.children;return typeof t==`function`&&(t=t({trigger:e.trigger||null,placement:`bottom`,isEntering:!1,isExiting:!1,defaultChildren:null})),I.createElement(I.Fragment,null,t)}return i&&!i.isOpen&&!o?null:I.createElement(Os,{...e,triggerRef:e.triggerRef,state:i,popoverRef:t,isExiting:o,dir:c})});function Os({state:e,isExiting:t,UNSTABLE_portalContainer:n,clearContexts:r,...i}){let a=(0,I.useRef)(null),o=(0,I.useRef)(null),s=(0,I.useContext)(Es),c=s&&i.trigger===`SubmenuTrigger`,{popoverProps:l,underlayProps:u,arrowProps:d,placement:p,triggerAnchorPoint:m}=Fo({...i,offset:i.offset??8,arrowRef:a,groupRef:c?s:o},e),h=i.popoverRef,g=y(h,!!p),_=i.isEntering||!i.shouldSkipAnimation&&g||!1,v=Ce({...i,defaultClassName:`react-aria-Popover`,values:{trigger:i.trigger||null,placement:p,isEntering:_,isExiting:t}}),b=!i.isNonModal||i.trigger===`SubmenuTrigger`||i.trigger===`PreviewTrigger`,[x,S]=(0,I.useState)(i.trigger===`PreviewTrigger`);Ue(()=>{h.current&&S(b&&!h.current.querySelector(`[role=dialog]`))},[h,b]),(0,I.useEffect)(()=>{x&&i.trigger!==`PreviewTrigger`&&(i.trigger!==`SubmenuTrigger`||gt()!==`pointer`)&&h.current&&!De(h.current)&&he(h.current)},[x,h,i.trigger]);let C=(0,I.useMemo)(()=>{let e=v.children;if(r)for(let t of r)e=I.createElement(t.Provider,{value:null},e);return e},[v.children,r]),[ee,te]=(0,I.useState)(null),w=(0,I.useCallback)(()=>{i.triggerRef.current&&te(i.triggerRef.current.getBoundingClientRect().width+`px`)},[i.triggerRef]);Ue(w,[w]),D({ref:v.style?.[`--trigger-width`]?void 0:i.triggerRef,onResize:w});let T={...l.style,"--trigger-anchor-point":m?`${m.x}px ${m.y}px`:void 0,...v.style,"--trigger-width":v.style?.[`--trigger-width`]||ee},E=I.createElement(ve.div,{...P(st(i,{global:!0}),l),...v,id:x?i.id:void 0,role:x?`dialog`:void 0,tabIndex:x?-1:void 0,"aria-label":i[`aria-label`],"aria-labelledby":i[`aria-labelledby`],ref:h,slot:i.slot||void 0,style:T,dir:i.dir,"data-trigger":i.trigger,"data-placement":p,"data-entering":_||void 0,"data-exiting":t||void 0},!i.isNonModal&&I.createElement(vs,{onDismiss:e.close}),I.createElement(f.Provider,{value:{...d,placement:p,ref:a}},C),I.createElement(vs,{onDismiss:e.close}));return c?I.createElement(Cs,{...i,shouldContainFocus:x&&i.trigger!==`PreviewTrigger`,isExiting:t,portalContainer:n??s?.current??void 0},E):I.createElement(Cs,{...i,shouldContainFocus:x&&i.trigger!==`PreviewTrigger`,isExiting:t,portalContainer:n},!i.isNonModal&&e.isOpen&&I.createElement(`div`,{"data-testid":`underlay`,...u,style:{position:`fixed`,inset:0}}),I.createElement(`div`,{ref:o,style:{display:`contents`}},I.createElement(Es.Provider,{value:o},E)))}var ks=(0,I.createContext)(null),As={CollectionRoot({collection:e,renderDropIndicator:t}){return js(e,null,t)},CollectionBranch({collection:e,parent:t,renderDropIndicator:n}){return js(e,t,n)}};function js(e,t,n){return _({items:t?e.getChildren(t.key):e,dependencies:[n],children(t){if(t.type===`content`)return I.createElement(I.Fragment,null);let r=t.render(t);return!n||t.type!==`item`?r:I.createElement(I.Fragment,null,n({type:`item`,key:t.key,dropPosition:`before`}),r,Ms(e,t,n))}})}function Ms(e,t,n){let r=t.key,i=e.getKeyAfter(r),a=i==null?null:e.getItem(i);for(;a!=null&&a.type!==`item`;)i=e.getKeyAfter(a.key),a=i==null?null:e.getItem(i);let o=t.nextKey==null?null:e.getItem(t.nextKey);for(;o!=null&&o.type!==`item`;)o=o.nextKey==null?null:e.getItem(o.nextKey);let s=[];if(o==null){let r=t;for(;r?.type===`item`&&(!a||r.parentKey!==a.parentKey&&a.levele==null?null:new Set([e]),[e])}var Fs=(0,I.createContext)({}),Is=(0,I.createContext)({}),Ls=(0,I.createContext)({isSelected:!1}),Rs=(0,I.forwardRef)(function(e,t){[e,t]=Xe(e,t,Ls);let{isSelected:n,...r}=e;return I.createElement(nt,{...r,ref:t,className:e.className||`react-aria-SelectionIndicator`,name:`SelectionIndicator`,isVisible:n})}),zs={};zs={longPressMessage:`اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة`};var Bs={};Bs={longPressMessage:`Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто`};var Vs={};Vs={longPressMessage:`Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku`};var Hs={};Hs={longPressMessage:`Langt tryk eller tryk på Alt + pil ned for at åbne menuen`};var Us={};Us={longPressMessage:`Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen`};var Ws={};Ws={longPressMessage:`Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού`};var Gs={};Gs={longPressMessage:`Long press or press Alt + ArrowDown to open menu`};var Ks={};Ks={longPressMessage:`Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú`};var qs={};qs={longPressMessage:`Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool`};var Js={};Js={longPressMessage:`Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli`};var Ys={};Ys={longPressMessage:`Appuyez de manière prolongée ou appuyez sur Alt\xA0+\xA0Flèche vers le bas pour ouvrir le menu.`};var Xs={};Xs={longPressMessage:`לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט`};var Zs={};Zs={longPressMessage:`Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika`};var Qs={};Qs={longPressMessage:`Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához`};var $s={};$s={longPressMessage:`Premi a lungo o premi Alt + Freccia giù per aprire il menu`};var ec={};ec={longPressMessage:`長押しまたは Alt+下矢印キーでメニューを開く`};var tc={};tc={longPressMessage:`길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기`};var nc={};nc={longPressMessage:`Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.`};var rc={};rc={longPressMessage:`Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa`};var ic={};ic={longPressMessage:`Langt trykk eller trykk Alt + PilNed for å åpne menyen`};var ac={};ac={longPressMessage:`Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen`};var oc={};oc={longPressMessage:`Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu`};var sc={};sc={longPressMessage:`Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu`};var cc={};cc={longPressMessage:`Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu`};var lc={};lc={longPressMessage:`Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul`};var uc={};uc={longPressMessage:`Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню`};var dc={};dc={longPressMessage:`Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol`};var fc={};fc={longPressMessage:`Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol`};var pc={};pc={longPressMessage:`Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni`};var mc={};mc={longPressMessage:`Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn`};var hc={};hc={longPressMessage:`Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın`};var gc={};gc={longPressMessage:`Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню`};var _c={};_c={longPressMessage:`长按或按 Alt + 向下方向键以打开菜单`};var vc={};vc={longPressMessage:`長按或按 Alt+向下鍵以開啟功能表`};var yc={};yc={"ar-AE":zs,"bg-BG":Bs,"cs-CZ":Vs,"da-DK":Hs,"de-DE":Us,"el-GR":Ws,"en-US":Gs,"es-ES":Ks,"et-EE":qs,"fi-FI":Js,"fr-FR":Ys,"he-IL":Xs,"hr-HR":Zs,"hu-HU":Qs,"it-IT":$s,"ja-JP":ec,"ko-KR":tc,"lt-LT":nc,"lv-LV":rc,"nb-NO":ic,"nl-NL":ac,"pl-PL":oc,"pt-BR":sc,"pt-PT":cc,"ro-RO":lc,"ru-RU":uc,"sk-SK":dc,"sl-SI":fc,"sr-SP":pc,"sv-SE":mc,"tr-TR":hc,"uk-UA":gc,"zh-CN":_c,"zh-TW":vc};var bc=500;function xc(e){let{isDisabled:t,pointerType:n,onLongPressStart:r,onLongPressEnd:i,onLongPress:a,threshold:o=bc,accessibilityDescription:s}=e,c=(0,I.useRef)(void 0),{addGlobalListener:l,removeAllGlobalListeners:u}=xe(),d=e=>n?e.pointerType===n:e.pointerType===`mouse`||e.pointerType===`touch`,{pressProps:f}=et({isDisabled:t,onPressStart(e){if(e.continuePropagation(),d(e)){r&&r({...e,type:`longpressstart`}),c.current=setTimeout(()=>{e.target.dispatchEvent(new PointerEvent(`pointercancel`,{bubbles:!0})),l(e.target,`click`,e=>e.preventDefault(),{once:!0}),Ye(e.target).activeElement!==e.target&&Ie(e.target),a&&a({...e,type:`longpress`}),c.current=void 0},o),e.pointerType===`touch`&&l(e.target,`contextmenu`,e=>e.preventDefault(),{once:!0});let t=Re(e.target);l(t,`pointerup`,()=>{setTimeout(()=>{u()},100)},{once:!0})}},onPressEnd(e){c.current&&clearTimeout(c.current),i&&d(e)&&i({...e,type:`longpressend`})}}),p=io(a&&!t?s:void 0);return{longPressProps:P(f,p)}}function Sc(e){let{onContextMenu:t}=e,n=(0,I.useRef)(!1),{longPressProps:r}=xc({onLongPressStart(){n.current=!1},onLongPress(e){n.current?n.current=!1:t?.({target:e.target,x:e.x,y:e.y})}});return t?{contextMenuProps:P(ge()?r:{},{onContextMenu(e){e.stopPropagation(),e.preventDefault(),n.current=!0;let r=e.currentTarget.getBoundingClientRect();t({target:e.currentTarget,x:e.clientX-r.x,y:e.clientY-r.y})},onKeyDown(e){if(Be()&&e.ctrlKey&&e.key===`Enter`){n.current=!1;let r=e.currentTarget;e.stopPropagation(),setTimeout(()=>{if(n.current)n.current=!1;else{let e=r.getBoundingClientRect();t({target:r,x:e.width/2,y:e.height/2})}},10)}}})}:{contextMenuProps:{}}}function Cc(e,t,n){let{type:r}=e,{isOpen:i}=t;(0,I.useEffect)(()=>{n&&n.current&&d.set(n.current,t.close)});let a;r===`menu`?a=!0:r===`listbox`&&(a=`listbox`);let o=$e();return{triggerProps:{"aria-haspopup":a,"aria-expanded":i,"aria-controls":i?o:void 0,onPress:t.toggle},overlayProps:{id:o}}}function wc(e){return e&&e.__esModule?e.default:e}function Tc(e,t,n){let{type:r=`menu`,isDisabled:i,trigger:a=`press`}=e,o=$e(),{triggerProps:s,overlayProps:c}=Cc({type:r},t,n),l=(e,n,r=`first`)=>{if(!e||n.isDefaultPrevented())return!1;t.toggle(r)},{keyboardProps:u}=_t({isDisabled:i,shortcuts:{Enter:e=>l(a!==`longPress`,e,`first`)," ":e=>l(a!==`longPress`,e,`first`),ArrowDown:e=>l(a!==`longPress`,e,`first`),ArrowUp:e=>l(a!==`longPress`,e,`last`),"Alt+Enter":e=>l(a===`longPress`,e,`first`),"Alt+ ":e=>l(a===`longPress`,e,`first`),"Alt+ArrowDown":e=>l(!0,e,`first`),"Alt+ArrowUp":e=>l(!0,e,`last`)}}),d=E(wc(yc),`@react-aria/menu`),{longPressProps:f}=xc({isDisabled:i||a!==`longPress`,accessibilityDescription:d.format(`longPressMessage`),onLongPressStart(){t.close()},onLongPress(){t.open(`first`)}}),p={preventFocusOnPress:!0,onPressStart(e){e.pointerType!==`touch`&&e.pointerType!==`keyboard`&&!i&&(Ie(e.target),t.open(e.pointerType===`virtual`?`first`:null))},onPress(e){e.pointerType===`touch`&&!i&&(Ie(e.target),t.toggle())}};delete s.onPress;let{contextMenuProps:m}=Sc({onContextMenu(e){let n=e.target.getBoundingClientRect();t.setPoint({x:n.x+e.x,y:n.y+e.y}),t.open()}});(0,I.useEffect)(()=>{if(t.isOpen&&a===`contextMenu`){let e=e=>{(e.button===2||e.button===0&&e.ctrlKey===!0)&&F(e)===document.body&&t.close()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)}},[t,a]);let h;if(a===`press`)h={...p,...u};else if(a===`longPress`)h={...f,...u};else if(a===`contextMenu`){h=m;let{"aria-haspopup":e,"aria-expanded":t,"aria-controls":n,...r}=s;s=r}return{menuTriggerProps:{...s,...h,id:o},menuProps:{...c,"aria-labelledby":o,autoFocus:t.focusStrategy||!0,onClose:t.close}}}var Ec=new WeakMap;function Dc(e){return Oe()?e.altKey:e.ctrlKey}function Oc(e,t){let n=`[data-key="${CSS.escape(String(t))}"]`,r=e.current?.dataset.collection;return r&&(n=`[data-collection="${CSS.escape(r)}"]${n}`),e.current?.querySelector(n)}var kc=new WeakMap;function Ac(e){let t=$e();return kc.set(e,t),t}function jc(e){return kc.get(e)}var Mc=1e3;function Nc(e){let{keyboardDelegate:t,selectionManager:n,onTypeSelect:r}=e,i=(0,I.useRef)({search:``,timeout:void 0});return(0,I.useEffect)(()=>{let e=i.current.timeout;return()=>{clearTimeout(e)}},[i]),{typeSelectProps:{onKeyDownCapture:t.getKeyForSearch?e=>{if(i.current.search.length>0&&e.key===` `){if(e.preventDefault(),(!(`continuePropagation`in e)||`continuePropagation`in e&&!e.isPropagationStopped())&&e.stopPropagation(),i.current.search+=` `,t.getKeyForSearch!=null){let e=t.getKeyForSearch(i.current.search,n.focusedKey);e??=t.getKeyForSearch(i.current.search),e!=null&&(n.setFocusedKey(e),r&&r(e))}clearTimeout(i.current.timeout),i.current.timeout=setTimeout(()=>{i.current.search=``},Mc)}}:void 0,onKeyDown:t.getKeyForSearch?e=>{let a=Pc(e.key);if(!(!a||e.ctrlKey||e.metaKey||e.altKey||!Fe(e.currentTarget,F(e))||i.current.search.length===0&&a===` `)){if(i.current.search+=a,t.getKeyForSearch!=null){let a=t.getKeyForSearch(i.current.search,n.focusedKey);if(a??=t.getKeyForSearch(i.current.search),a!=null)n.setFocusedKey(a),r&&r(a),e.preventDefault(),`continuePropagation`in e||e.stopPropagation();else{i.current.search=``,clearTimeout(i.current.timeout),i.current.timeout=void 0;return}}clearTimeout(i.current.timeout),i.current.timeout=setTimeout(()=>{i.current.search=``},Mc)}}:void 0}}}function Pc(e){return e.length===1||!/^[A-Z]/i.test(e)?e:``}function Fc(e){let{selectionManager:t,keyboardDelegate:n,ref:r,autoFocus:i=!1,shouldFocusWrap:a=!1,disallowEmptySelection:o=!1,disallowSelectAll:s=!1,escapeKeyBehavior:c=`clearSelection`,selectOnFocus:l=t.selectionBehavior===`replace`,disallowTypeAhead:u=!1,shouldUseVirtualFocus:d,allowsTabNavigation:f=!1,scrollRef:p=r,linkBehavior:m=`action`,UNSTABLE_focusOnEntry:h}=e,{direction:g}=Ze(),_=qe(),v=(e,n,i)=>{if(n!=null){if(t.isLink(n)&&m===`selection`&&l&&!Dc(e)){(0,xs.flushSync)(()=>{t.setFocusedKey(n,i)});let a=Oc(r,n),o=t.getItemProps(n);if(a){_.open(a,e,o.href,o.routerOptions);return}return!1}if(t.setFocusedKey(n,i),t.isLink(n)&&m===`override`)return!1;if(e.shiftKey&&t.selectionMode===`multiple`){t.extendSelection(n);return}if(l&&!Dc(e)){t.replaceSelection(n);return}}return!1},y=e=>{if(n.getKeyBelow){let r=t.focusedKey==null?n.getFirstKey?.():n.getKeyBelow?.(t.focusedKey);if(r==null&&a&&(r=n.getFirstKey?.(t.focusedKey)),r!=null){v(e,r);return}}return!1},b=e=>{if(n.getKeyAbove){let r=t.focusedKey==null?n.getLastKey?.():n.getKeyAbove?.(t.focusedKey);if(r==null&&a&&(r=n.getLastKey?.(t.focusedKey)),r!=null){v(e,r);return}}return!1},te=e=>{if(n.getFirstKey){if(t.focusedKey===null&&e.shiftKey)return!1;let r=n.getFirstKey(t.focusedKey,ce(e));if(t.setFocusedKey(r),r!=null){if(ce(e)&&e.shiftKey&&t.selectionMode===`multiple`){t.extendSelection(r);return}if(l){t.replaceSelection(r);return}}}return!1},w=e=>{if(n.getKeyLeftOf){let r=t.focusedKey==null?n.getFirstKey?.():n.getKeyLeftOf?.(t.focusedKey);if(r==null&&a&&(r=g===`rtl`?n.getFirstKey?.(t.focusedKey):n.getLastKey?.(t.focusedKey)),r!=null){v(e,r,g===`rtl`?`first`:`last`);return}}return!1},T=e=>{if(n.getKeyRightOf){let r=t.focusedKey==null?n.getFirstKey?.():n.getKeyRightOf?.(t.focusedKey);if(r==null&&a&&(r=g===`rtl`?n.getLastKey?.(t.focusedKey):n.getFirstKey?.(t.focusedKey)),r!=null){v(e,r,g===`rtl`?`last`:`first`);return}}return!1},E=e=>{if(n.getLastKey){if(t.focusedKey===null&&e.shiftKey)return!1;let r=n.getLastKey(t.focusedKey,ce(e));if(t.setFocusedKey(r),r!=null){if(ce(e)&&e.shiftKey&&t.selectionMode===`multiple`){t.extendSelection(r);return}if(l){t.replaceSelection(r);return}}}return!1},ne=e=>{if(n.getKeyPageBelow&&t.focusedKey!=null){let r=n.getKeyPageBelow(t.focusedKey);if(r!=null)return v(e,r)}return!1},D=e=>{if(n.getKeyPageAbove&&t.focusedKey!=null){let r=n.getKeyPageAbove(t.focusedKey);if(r!=null)return v(e,r)}return!1},re=()=>{if(t.selectionMode===`multiple`&&s!==!0){t.selectAll();return}return!1},ie=()=>{if(c===`clearSelection`&&!o&&t.selectedKeys.size!==0){t.clearSelection();return}return!1},ae=()=>{if(!f&&r.current){let e=Le(r.current,{tabbable:!0}),t,n;do n=e.lastChild(),n&&(t=n);while(n);let i=fe();t&&(!De(t)||i&&!be(i))&&Ie(t)}return{shouldContinuePropagation:!0,shouldPreventDefault:!1}},O=()=>(!f&&r.current&&r.current.focus(),{shouldContinuePropagation:!0,shouldPreventDefault:!1}),k=(e,t)=>({[Be()?e+`+Shift+Alt`:e+`+Shift+Control`]:t,[e+`+Shift`]:t,[Be()?e+`+Alt`:e+`+Control`]:t,[e]:t}),{keyboardProps:A}=_t({shortcuts:{...k(`ArrowDown`,y),...k(`ArrowUp`,b),...k(`ArrowLeft`,w),...k(`ArrowRight`,T),...k(`PageDown`,ne),...k(`PageUp`,D)},allowRepeats:!0}),{keyboardProps:se}=_t({shortcuts:{...k(`Home`,te),...k(`End`,E),"Mod+A":re,Escape:ie,Tab:ae,"Tab+Shift":O}}),j=(0,I.useRef)({top:0,left:0});oe(p,`scroll`,()=>{j.current={top:p.current?.scrollTop??0,left:p.current?.scrollLeft??0}});let M=e=>{if(t.isFocused){Fe(e.currentTarget,F(e))||t.setFocused(!1);return}if(!Fe(e.currentTarget,F(e)))return;let i=gt();t.setFocused(!0);let a=e=>{e!=null&&(t.setFocusedKey(e),l&&!t.isSelected(e)&&t.replaceSelection(e))};if(h&&(i===`keyboard`||i===`virtual`))a(h===`first`?n.getFirstKey?.():n.getLastKey?.());else if(t.focusedKey==null){let r=e.relatedTarget;r&&e.currentTarget.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING?a(t.lastSelectedKey??n.getLastKey?.()):a(t.firstSelectedKey??n.getFirstKey?.())}else p.current&&(p.current.scrollTop=j.current.top,p.current.scrollLeft=j.current.left);if(t.focusedKey!=null&&p.current){let e=Oc(r,t.focusedKey);e instanceof HTMLElement&&(!De(e)&&!d&&Ie(e),(i===`keyboard`||h&&i===`virtual`)&&oo(e,{containingElement:r.current}))}},N=e=>{Fe(e.currentTarget,e.relatedTarget)||t.setFocused(!1)},le=(0,I.useRef)(!1);oe(r,ee,d?e=>{let{detail:n}=e;e.stopPropagation(),t.setFocused(!0),n?.focusStrategy===`first`&&(le.current=!0)}:void 0);let ue=n.getFirstKey?.()??null;Ya(()=>{if(le.current){if(ue==null){let e=fe();C(r.current),x(e,null),t.collection.size>0&&(le.current=!1)}else t.setFocusedKey(ue),le.current=!1}},[ue,t.collection.size]),Ya(()=>{t.collection.size>0&&(le.current=!1)},[t.focusedKey]),oe(r,S,d?e=>{e.stopPropagation(),t.setFocused(!1),e.detail?.clearFocusKey&&t.setFocusedKey(null)}:void 0);let de=(0,I.useRef)(i),pe=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(de.current){let e=null;i===`first`&&(e=n.getFirstKey?.()??null),i===`last`&&(e=n.getLastKey?.()??null);let a=t.selectedKeys;if(a.size){for(let n of a)if(t.canSelectItem(n)){e=n;break}}t.setFocused(!0),t.setFocusedKey(e),e==null&&!d&&r.current&&he(r.current),t.collection.size>0&&(de.current=!1,pe.current=!0)}});let me=(0,I.useRef)(t.focusedKey),ge=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(t.isFocused&&t.focusedKey!=null&&(t.focusedKey!==me.current||pe.current)&&p.current&&r.current){let e=gt(),n=Oc(r,t.focusedKey);if(!(n instanceof HTMLElement))return;(e===`keyboard`||pe.current)&&(ge.current&&cancelAnimationFrame(ge.current),ge.current=requestAnimationFrame(()=>{p.current&&(ao(p.current,n),e!==`virtual`&&oo(n,{containingElement:r.current}))}))}!d&&t.isFocused&&t.focusedKey==null&&me.current!=null&&r.current&&he(r.current),me.current=t.focusedKey,pe.current=!1}),(0,I.useEffect)(()=>()=>{ge.current&&cancelAnimationFrame(ge.current)},[]),oe(r,`react-aria-focus-scope-restore`,e=>{e.preventDefault(),t.setFocused(!0)});let _e={...P(se,A),onFocus:M,onBlur:N,onMouseDown(e){p.current===F(e)&&e.preventDefault()}},{typeSelectProps:ve}=Nc({keyboardDelegate:n,selectionManager:t});u||(_e=P(ve,_e));let ye;d||(ye=t.focusedKey==null?0:-1);let xe=Ac(t.collection);return{collectionProps:P(_e,{tabIndex:ye,"data-collection":xe})}}var Ic=class{constructor(e){this.ref=e}getItemRect(e){let t=this.ref.current;if(!t)return null;let n=e==null?null:Oc(this.ref,e);if(!n)return null;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect();return{x:i.left-r.left-t.clientLeft+t.scrollLeft,y:i.top-r.top-t.clientTop+t.scrollTop,width:i.width,height:i.height}}getContentSize(){let e=this.ref.current;return{width:e?.scrollWidth??0,height:e?.scrollHeight??0}}getVisibleRect(){let e=this.ref.current;return{x:e?.scrollLeft??0,y:e?.scrollTop??0,width:e?.clientWidth??0,height:e?.clientHeight??0}}},Lc=class{constructor(...e){if(e.length===1){let t=e[0];this.collection=t.collection,this.ref=t.ref,this.collator=t.collator,this.disabledKeys=t.disabledKeys||new Set,this.disabledBehavior=t.disabledBehavior||`all`,this.orientation=t.orientation||`vertical`,this.direction=t.direction,this.layout=t.layout||`stack`,this.layoutDelegate=t.layoutDelegate||new Ic(t.ref)}else this.collection=e[0],this.disabledKeys=e[1],this.ref=e[2],this.collator=e[3],this.layout=`stack`,this.orientation=`vertical`,this.disabledBehavior=`all`,this.layoutDelegate=new Ic(this.ref);this.layout===`stack`&&this.orientation===`vertical`&&(this.getKeyLeftOf=void 0,this.getKeyRightOf=void 0)}isDisabled(e){return this.disabledBehavior===`all`&&(e.props?.isDisabled||this.disabledKeys.has(e.key))&&e.props?.disabledBehavior!==`selection`}findNextNonDisabled(e,t,n=!1){let r=e;for(;r!=null;){let e=this.collection.getItem(r);if(e?.type===`item`&&(n||!this.isDisabled(e)))return r;r=t(r)}return null}getNextKey(e,t){let n=e;return n=this.collection.getKeyAfter(n),this.findNextNonDisabled(n,e=>this.collection.getKeyAfter(e),t?.includeDisabled)}getPreviousKey(e,t){let n=e;return n=this.collection.getKeyBefore(n),this.findNextNonDisabled(n,e=>this.collection.getKeyBefore(e),t?.includeDisabled)}findKey(e,t,n){let r=e,i=this.layoutDelegate.getItemRect(r);if(!i||r==null)return null;let a=i;do{if(r=t(r),r==null)break;i=this.layoutDelegate.getItemRect(r)}while(i&&n(a,i)&&r!=null);return r}isSameRow(e,t){return e.y===t.y||e.x!==t.x}isSameColumn(e,t){return e.x===t.x||e.y!==t.y}isReversed(e){let t=this.getNextKey(e),n=Oc(this.ref,e);if(t!=null){let e=Oc(this.ref,t);return!n||!e?!1:n.getBoundingClientRect().top>e.getBoundingClientRect().top}let r=this.getPreviousKey(e);if(r!=null){let e=Oc(this.ref,r);return!n||!e?!1:e.getBoundingClientRect().top>n.getBoundingClientRect().top}return!1}getKeyBelow(e,t){return this.layout===`grid`&&this.orientation===`vertical`?this.findKey(e,e=>this.getNextKey(e,t),this.isSameRow):this.orientation===`vertical`&&this.isReversed(e)?this.getPreviousKey(e,t):this.getNextKey(e,t)}getKeyAbove(e,t){return this.layout===`grid`&&this.orientation===`vertical`?this.findKey(e,e=>this.getPreviousKey(e,t),this.isSameRow):this.orientation===`vertical`&&this.isReversed(e)?this.getNextKey(e,t):this.getPreviousKey(e,t)}getNextColumn(e,t,n){return t?this.getPreviousKey(e,n):this.getNextKey(e,n)}getKeyRightOf(e,t){let n=this.direction===`ltr`?`getKeyRightOf`:`getKeyLeftOf`;return this.layoutDelegate[n]?(e=this.layoutDelegate[n](e),this.findNextNonDisabled(e,e=>this.layoutDelegate[n](e),t?.includeDisabled)):this.layout===`grid`?this.orientation===`vertical`?this.getNextColumn(e,this.direction===`rtl`,t):this.findKey(e,e=>this.getNextColumn(e,this.direction===`rtl`,t),this.isSameColumn):this.orientation===`horizontal`?this.getNextColumn(e,this.direction===`rtl`,t):null}getKeyLeftOf(e,t){let n=this.direction===`ltr`?`getKeyLeftOf`:`getKeyRightOf`;return this.layoutDelegate[n]?(e=this.layoutDelegate[n](e),this.findNextNonDisabled(e,e=>this.layoutDelegate[n](e),t?.includeDisabled)):this.layout===`grid`?this.orientation===`vertical`?this.getNextColumn(e,this.direction===`ltr`,t):this.findKey(e,e=>this.getNextColumn(e,this.direction===`ltr`,t),this.isSameColumn):this.orientation===`horizontal`?this.getNextColumn(e,this.direction===`ltr`,t):null}getFirstKey(){let e=this.collection.getFirstKey();return this.findNextNonDisabled(e,e=>this.collection.getKeyAfter(e))}getLastKey(){let e=this.collection.getLastKey();return this.findNextNonDisabled(e,e=>this.collection.getKeyBefore(e))}getKeyPageAbove(e){let t=this.ref.current,n=this.layoutDelegate.getItemRect(e);if(!n)return null;let r=this.isReversed(e);if(t&&!Xa(t))return this.getFirstKey();let i=e;if(this.orientation===`horizontal`){let e=Math.max(0,n.x+n.width-this.layoutDelegate.getVisibleRect().width);for(;n&&n.x>e&&i!=null;)i=this.getKeyAbove(i),n=i==null?null:this.layoutDelegate.getItemRect(i)}else{let e=this.layoutDelegate.getVisibleRect(),t=r?n.y-e.height:Math.max(0,n.y+n.height-e.height);for(;n&&n.y>t&&i!=null;)i=this.getKeyAbove(i),n=i==null?null:this.layoutDelegate.getItemRect(i)}return i??(r?this.getLastKey():this.getFirstKey())}getKeyPageBelow(e){let t=this.ref.current,n=this.layoutDelegate.getItemRect(e);if(!n)return null;let r=this.isReversed(e);if(t&&!Xa(t))return this.getLastKey();let i=e;if(this.orientation===`horizontal`){let e=Math.min(this.layoutDelegate.getContentSize().width,n.x-n.width+this.layoutDelegate.getVisibleRect().width);for(;n&&n.xe[0]a||new Lc({collection:n,disabledKeys:r,disabledBehavior:l,ref:i,collator:c,layoutDelegate:o,orientation:s}),[a,o,n,r,i,c,l,s]),{collectionProps:d}=Fc({...e,ref:i,selectionManager:t,keyboardDelegate:u});return{listProps:d}}function Bc(e,t,n){let{shouldFocusWrap:r=!0,onKeyDown:i,onKeyUp:a,...o}=e;!e[`aria-label`]&&e[`aria-labelledby`];let s=st(e,{labelable:!0}),{listProps:c}=H({...o,ref:n,selectionManager:t.selectionManager,collection:t.collection,disabledKeys:t.disabledKeys,shouldFocusWrap:r,linkBehavior:`override`});return Ec.set(t,{onClose:e.onClose,onAction:e.onAction,shouldUseVirtualFocus:e.shouldUseVirtualFocus}),{menuProps:P(s,{onKeyDown:i,onKeyUp:a},{role:`menu`,...c,onKeyDown:t=>{(t.key!==`Escape`||e.shouldUseVirtualFocus)&&c.onKeyDown?.(t)}})}}function Vc(e){let{id:t,selectionManager:n,key:r,ref:i,shouldSelectOnPressUp:a,shouldUseVirtualFocus:o,focus:s,isDisabled:c,onAction:l,allowsDifferentPressOrigin:u,linkBehavior:d=`action`}=e,f=qe();t=$e(t);let p=e=>{if(e.pointerType===`keyboard`&&Dc(e))n.toggleSelection(r);else{if(n.selectionMode===`none`)return;if(n.isLink(r)){if(d===`selection`&&i.current){let t=n.getItemProps(r);f.open(i.current,e,t.href,t.routerOptions),n.setSelectedKeys(n.selectedKeys);return}if(d===`override`||d===`none`)return}n.selectionMode===`single`?n.isSelected(r)&&!n.disallowEmptySelection?n.toggleSelection(r):n.replaceSelection(r):e&&e.shiftKey?n.extendSelection(r):n.selectionBehavior===`toggle`||e&&(ce(e)||e.pointerType===`touch`||e.pointerType===`virtual`)?n.toggleSelection(r):n.replaceSelection(r)}};(0,I.useEffect)(()=>{r===n.focusedKey&&n.isFocused&&(o?C(i.current):s?s():fe()!==i.current&&i.current&&he(i.current))},[i,r,n.focusedKey,n.childFocusStrategy,n.isFocused,o]),c||=n.isDisabled(r);let m={};!o&&!c?m={tabIndex:r===n.focusedKey?0:-1,onFocus(e){F(e)===i.current&&n.setFocusedKey(r)}}:c&&(m.onMouseDown=e=>{e.preventDefault()}),(0,I.useEffect)(()=>{c&&n.focusedKey===r&&n.setFocusedKey(null)},[n,c,r]);let h=n.isLink(r)&&d===`override`,g=l&&e.UNSTABLE_itemBehavior===`action`,_=n.isLink(r)&&d!==`selection`&&d!==`none`,v=!c&&n.canSelectItem(r)&&!h&&!g,y=(l||_)&&!c,b=y&&(n.selectionBehavior===`replace`?!v:!v||n.isEmpty),x=y&&v&&n.selectionBehavior===`replace`,S=b||x,ee=(0,I.useRef)(null),te=S&&v,w=(0,I.useRef)(!1),T=(0,I.useRef)(!1),E=n.getItemProps(r),ne=e=>{l&&(l(),i.current?.dispatchEvent(new CustomEvent(`react-aria-item-action`,{bubbles:!0}))),_&&i.current&&f.open(i.current,e,E.href,E.routerOptions)},D={ref:i};a?(D.onPressStart=e=>{ee.current=e.pointerType,w.current=te,e.pointerType===`keyboard`&&(!S||Uc(e.key))&&p(e)},u?(D.onPressUp=b?void 0:e=>{e.pointerType===`mouse`&&v&&p(e)},D.onPress=b?ne:e=>{e.pointerType!==`keyboard`&&e.pointerType!==`mouse`&&v&&p(e)}):D.onPress=e=>{if(b||x&&e.pointerType!==`mouse`){if(e.pointerType===`keyboard`&&!Hc(e.key))return;ne(e)}else e.pointerType!==`keyboard`&&v&&p(e)}):(D.onPressStart=e=>{ee.current=e.pointerType,w.current=te,T.current=b,v&&(e.pointerType===`mouse`&&!b||e.pointerType===`keyboard`&&(!y||Uc(e.key)))&&p(e)},D.onPress=e=>{(e.pointerType===`touch`||e.pointerType===`pen`||e.pointerType===`virtual`||e.pointerType===`keyboard`&&S&&Hc(e.key)||e.pointerType===`mouse`&&T.current)&&(S?ne(e):v&&p(e))});let re=jc(n.collection);if(m[`data-collection`]=re,m[`data-key`]=r,D.preventFocusOnPress=o,o&&(D=P(D,{onPressStart(e){e.pointerType!==`touch`&&(n.setFocused(!0),n.setFocusedKey(r))},onPress(e){e.pointerType===`touch`&&(n.setFocused(!0),n.setFocusedKey(r))}})),E)for(let e of[`onPressStart`,`onPressEnd`,`onPressChange`,`onPress`,`onPressUp`,`onClick`])E[e]&&(D[e]=dt(D[e],E[e]));let{pressProps:ie,isPressed:ae}=et(D),oe=x?e=>{ee.current===`mouse`&&(e.stopPropagation(),e.preventDefault(),ne(e))}:void 0,{longPressProps:O}=xc({isDisabled:!te,onLongPress(e){e.pointerType===`touch`&&(p(e),n.setSelectionBehavior(`toggle`))}}),k=e=>{ee.current===`touch`&&w.current&&e.preventDefault()},A=d!==`none`&&n.isLink(r)?e=>{tt.isOpening||e.preventDefault()}:void 0,se=P(m,v||b||o&&!c?ie:{},te?O:{},{onDoubleClick:oe,onDragStartCapture:k,onClick:A,id:t},o?{onMouseDown:e=>e.preventDefault()}:void 0),j=e=>{let t=e;for(;t&&t!==i.current;){let e=t.getAttribute(`data-collection`);if(e!=null)return e!==re;t=t.parentElement}return be(e)},M=se.onPointerDown;se.onPointerDown=e=>{let t=F(e);if(t&&t!==i.current&&j(t)){e.stopPropagation();return}M?.(e)};let N=se.onMouseDown;return se.onMouseDown=e=>{let t=F(e);if(t&&t!==i.current&&j(t)){e.stopPropagation();return}N?.(e)},{itemProps:se,isPressed:ae,isSelected:n.isSelected(r),isFocused:n.isFocused&&n.focusedKey===r,isDisabled:c,allowsSelection:v,hasAction:S}}function Hc(e){return e===`Enter`}function Uc(e){return e===` `}function Wc(e,t){return typeof t.getChildren==`function`?t.getChildren(e.key):e.childNodes}function Gc(e){return Kc(e,0)}function Kc(e,t){if(t<0)return;let n=0;for(let r of e){if(n===t)return r;n++}}function qc(e){let t;for(let n of e)t=n;return t}function Jc(e,t,n){if(t.parentKey===n.parentKey)return t.index-n.index;let r=[...Yc(e,t),t],i=[...Yc(e,n),n],a=r.slice(0,i.length).findIndex((e,t)=>e!==i[t]);return a===-1?r.findIndex(e=>e===n)>=0?1:(i.findIndex(e=>e===t),-1):(t=r[a],n=i[a],t.index-n.index)}function Yc(e,t){let n=[],r=t;for(;r?.parentKey!=null;)r=e.getItem(r.parentKey),r&&n.unshift(r);return n}var Xc=new WeakMap;function Zc(e){let t=Xc.get(e);if(t!=null)return t;let n=0,r=t=>{for(let i of t)i.type===`section`?r(Wc(i,e)):i.type===`item`&&n++};return r(e),Xc.set(e,n),n}function Qc(e,t,n){let{id:r,key:i,closeOnSelect:a,shouldCloseOnSelect:o,isVirtualized:s,"aria-haspopup":c,onPressStart:l,onPressUp:u,onPress:d,onPressChange:f,onPressEnd:p,onClick:m,onHoverStart:h,onHoverChange:g,onHoverEnd:_,onKeyDown:v,onKeyUp:y,onFocus:b,onFocusChange:x,onBlur:S,selectionManager:C=t.selectionManager}=e,ee=!!c,te=ee&&e[`aria-expanded`]===`true`,w=e.isDisabled??C.isDisabled(i),T=e.isSelected??C.isSelected(i),E=Ec.get(t),ne=t.collection.getItem(i),D=e.onClose||E.onClose,re=qe(),ie=()=>{if(!ee&&(ne?.props?.onAction?ne.props.onAction():e.onAction&&e.onAction(i),E.onAction)){let e=E.onAction;e(i,ne?.value)}},ae=`menuitem`;ee||(C.selectionMode===`single`?ae=`menuitemradio`:C.selectionMode===`multiple`&&(ae=`menuitemcheckbox`));let oe=He(),O=He(),k=He(),A={id:r,"aria-disabled":w||void 0,role:ae,"aria-label":e[`aria-label`],"aria-labelledby":oe,"aria-describedby":[e[`aria-describedby`],O,k].filter(Boolean).join(` `)||void 0,"aria-controls":e[`aria-controls`],"aria-haspopup":c,"aria-expanded":e[`aria-expanded`]};if(C.selectionMode!==`none`&&!ee&&(A[`aria-checked`]=T),s){let e=Number(ne?.index);A[`aria-posinset`]=Number.isNaN(e)?void 0:e+1,A[`aria-setsize`]=Zc(t.collection)}let se=(0,I.useRef)(!1),ce=e=>{f?.(e),se.current=e},j=(0,I.useRef)(null),M=e=>{e.pointerType!==`keyboard`&&(j.current={pointerType:e.pointerType}),e.pointerType===`mouse`&&(se.current||e.target.click()),u?.(e)},N=e=>{m?.(e),ie(),Ge(e,re,ne.props.href,ne?.props.routerOptions);let t=j.current?.pointerType===`keyboard`?j.current?.key===`Enter`||C.selectionMode===`none`||C.isLink(i):C.selectionMode!==`multiple`||C.isLink(i);t=o??a??t,D&&!ee&&t&&D(),j.current=null},{itemProps:le,isFocused:ue}=Vc({id:r,selectionManager:C,key:i,ref:n,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,linkBehavior:`none`,shouldUseVirtualFocus:E.shouldUseVirtualFocus}),{pressProps:de,isPressed:fe}=et({onPressStart:l,onPress:d,onPressUp:M,onPressChange:ce,onPressEnd:p,isDisabled:w}),{hoverProps:pe}=pt({isDisabled:w,onHoverStart(e){!Te()&&!(te&&c)&&(C.setFocused(!0),C.setFocusedKey(i)),h?.(e)},onHoverChange:g,onHoverEnd:_}),{keyboardProps:me}=_t({shortcuts:{" ":e=>{j.current={pointerType:`keyboard`,key:` `},F(e).click(),ke(`keyboard`)},Enter:e=>{j.current={pointerType:`keyboard`,key:`Enter`};let t=F(e);if(t.tagName!==`A`){t.click(),ke(`keyboard`);return}return ke(`keyboard`),{shouldPreventDefault:!1,shouldContinuePropagation:!1}}},onKeyDown:v,onKeyUp:y}),{focusableProps:he}=vt({onBlur:S,onFocus:b,onFocusChange:x},n),ge=st(ne?.props);delete ge.id;let _e=ot(ne?.props);return{menuItemProps:{...A,...P(ge,_e,ee?{onFocus:le.onFocus,"data-collection":le[`data-collection`],"data-key":le[`data-key`]}:le,de,pe,me,he,E.shouldUseVirtualFocus||ee?{onMouseDown:e=>e.preventDefault()}:void 0,w?void 0:{onClick:N}),tabIndex:le.tabIndex!=null&&te&&!E.shouldUseVirtualFocus?-1:le.tabIndex},labelProps:{id:oe},descriptionProps:{id:O},keyboardShortcutProps:{id:k},isFocused:ue,isFocusVisible:ue&&C.isFocused&&Te()&&!te,isSelected:T,isPressed:fe,isDisabled:w}}function $c(e){let{heading:t,"aria-label":n}=e,r=$e();return{itemProps:{role:`presentation`},headingProps:t?{id:r,role:`presentation`}:{},groupProps:{role:`group`,"aria-label":n,"aria-labelledby":t?r:void 0}}}var el=2,tl=50,nl=1e3,rl=Math.PI/12;function il(e){let{menuRef:t,submenuRef:n,isOpen:r,isDisabled:i}=e,a=(0,I.useRef)(void 0),o=(0,I.useRef)(void 0),s=(0,I.useRef)(0),c=(0,I.useRef)(void 0),l=(0,I.useRef)(void 0),u=(0,I.useRef)(void 0),d=(0,I.useRef)(2),[f,p]=(0,I.useState)(!1);D({ref:r?n:void 0,onResize:()=>{n.current&&(o.current=n.current.getBoundingClientRect(),u.current=void 0)}});let m=()=>{p(!1),d.current=el,a.current=void 0},h=_e(),g=Me(e=>{f&&e.preventDefault()});(0,I.useEffect)(()=>{f&&t.current?t.current.style.pointerEvents=`none`:t.current.style.pointerEvents=``},[t,f]),Ue(()=>{let e=n.current,f=t.current;if(i||!e||!r||h!==`pointer`||!f){m();return}o.current=e.getBoundingClientRect();let _=e=>{if(e.pointerType===`touch`||e.pointerType===`pen`)return;let t=Date.now();if(t-s.currento.current.right?`left`:`right`,nf.getBoundingClientRect().right||rf.getBoundingClientRect().bottom){m();return}let i=a.current.x,h=a.current.y,g=u.current===`right`?o.current.left-i:i-o.current.right,_=Math.atan2(h-o.current.top,g)+rl,v=Math.atan2(h-o.current.bottom,g)-rl,y=Math.atan2(h-r,u.current===`left`?-(n-i):n-i),b=y<_&&y>v;d.current=b?Math.min(d.current+1,el):Math.max(d.current-1,0),d.current>=el?p(!0):p(!1),s.current=t,a.current={x:n,y:r},b&&(c.current=setTimeout(()=>{m(),l.current=setTimeout(()=>{let e=document.elementFromPoint(n,r);e&&Fe(f,e)&&e.dispatchEvent(new PointerEvent(`pointerover`,{bubbles:!0,cancelable:!0}))},100)},nl))};return window.addEventListener(`pointermove`,_),window.addEventListener(`pointerdown`,g,!0),()=>{window.removeEventListener(`pointermove`,_),window.removeEventListener(`pointerdown`,g,!0),clearTimeout(c.current),clearTimeout(l.current),d.current=el}},[i,r,t,h,p,n])}function al(e,t,n){let{parentMenuRef:r,submenuRef:i,type:a=`menu`,isDisabled:o,delay:s=200,shouldUseVirtualFocus:c}=e,l=$e(),u=$e(),{direction:d}=Ze(),f=(0,I.useRef)(void 0),p=(0,I.useCallback)(()=>{f.current&&=(clearTimeout(f.current),void 0)},[f]),m=(0,I.useCallback)(e=>{p(),t.open(e)},[t,p]),h=(0,I.useCallback)(()=>{p(),t.close()},[t,p]);Ue(()=>()=>{p()},[p]);let{keyboardProps:g}=_t({shortcuts:{ArrowLeft:e=>{if(!De(e.currentTarget))return!1;if(d===`ltr`&&Fe(e.currentTarget,F(e))){h(),!c&&n.current&&Ie(n.current);return}return!1},ArrowRight:e=>{if(!De(e.currentTarget))return!1;if(d===`rtl`&&Fe(e.currentTarget,F(e))){h(),!c&&n.current&&Ie(n.current);return}return!1},Escape:e=>{if(!De(e.currentTarget))return!1;if(Fe(i.current,F(e))){h(),!c&&n.current&&Ie(n.current);return}return!1}}}),_={id:u,"aria-labelledby":l,submenuLevel:t.submenuLevel,...a===`menu`&&{onClose:t.closeAll,autoFocus:t.focusStrategy??void 0,...g}},{keyboardProps:v}=_t({shortcuts:{ArrowRight:()=>{if(!o){if(d===`ltr`){t.isOpen||m(`first`),a===`menu`&&i?.current&&fe()===n?.current&&Ie(i.current);return}if(t.isOpen){h();return}return!1}return!1},ArrowLeft:()=>{if(!o){if(d===`rtl`){t.isOpen||m(`first`),a===`menu`&&i?.current&&fe()===n?.current&&Ie(i.current);return}if(t.isOpen){h();return}return!1}return!1}}});return oe(r,`focusin`,e=>{t.isOpen&&Fe(r.current,F(e))&&F(e)!==n.current&&h()}),il({menuRef:r,submenuRef:i,isOpen:t.isOpen,isDisabled:o}),{submenuTriggerProps:{onKeyDown:v.onKeyDown,onKeyUp:v.onKeyUp,id:l,"aria-controls":t.isOpen?u:void 0,"aria-haspopup":o?void 0:a,"aria-expanded":t.isOpen?`true`:`false`,onPressStart:e=>{!o&&(e.pointerType===`virtual`||e.pointerType===`keyboard`)&&m(`first`)},onPress:e=>{!o&&(e.pointerType===`touch`||e.pointerType===`mouse`)&&m()},onHoverChange:e=>{o||(e&&!t.isOpen?f.current||=setTimeout(()=>{m()},s):e||p())},isOpen:t.isOpen},submenuProps:_,popoverProps:{isNonModal:!0,shouldCloseOnInteractOutside:e=>e!==n.current}}}function ol(e){let t=ue(e),[n,r]=(0,I.useState)(null),[i,a]=(0,I.useState)([]),o=()=>{a([]),t.close()},s=(e,t)=>{a(n=>t>n.length?n:[...n.slice(0,t),e])},c=(e,t)=>{a(n=>n[t]===e?n.slice(0,t):n)};return{focusStrategy:n,...t,open(e=null){r(e),t.open()},toggle(e=null){r(e),t.toggle()},close(){o()},expandedKeysStack:i,openSubmenu:s,closeSubmenu:c}}function sl(e,t){let{triggerKey:n}=e,{expandedKeysStack:r,openSubmenu:i,closeSubmenu:a,close:o}=t,[s]=(0,I.useState)(r?.length),c=(0,I.useMemo)(()=>r[s]===n,[r,n,s]),[l,u]=(0,I.useState)(null),d=(0,I.useCallback)(e=>{u(e??null),i(n,s)},[i,s,n]),f=(0,I.useCallback)(()=>{u(null),a(n,s)},[a,s,n]),p=(0,I.useCallback)(e=>{u(e??null),c?f():d(e)},[f,d,c]);return(0,I.useMemo)(()=>({focusStrategy:l,isOpen:c,open:d,close:f,closeAll:o,submenuLevel:s,setOpen:()=>{},toggle:p,point:null,setPoint:()=>{}}),[c,d,f,o,l,p,s])}var cl=class e extends Set{constructor(t,n,r){super(t),t instanceof e?(this.anchorKey=n??t.anchorKey,this.currentKey=r??t.currentKey):(this.anchorKey=n??null,this.currentKey=r??null)}},ll=class e{constructor(e,t,n){this.collection=e,this.state=t,this.allowsCellSelection=n?.allowsCellSelection??!1,this._isSelectAll=null,this.layoutDelegate=n?.layoutDelegate||null,this.fullCollection=n?.fullCollection||null}get selectionMode(){return this.state.selectionMode}get disallowEmptySelection(){return this.state.disallowEmptySelection}get selectionBehavior(){return this.state.selectionBehavior}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}get isFocused(){return this.state.isFocused}setFocused(e){this.state.setFocused(e)}get focusedKey(){return this.state.focusedKey}get childFocusStrategy(){return this.state.childFocusStrategy}setFocusedKey(e,t){(e==null||this.collection.getItem(e))&&this.state.setFocusedKey(e,t)}get selectedKeys(){return this.state.selectedKeys===`all`?new Set(this.getSelectAllKeys()):this.state.selectedKeys}get rawSelection(){return this.state.selectedKeys}isSelected(e){if(this.state.selectionMode===`none`)return!1;let t=this.getKey(e);return t==null?!1:this.state.selectedKeys===`all`?this.canSelectItem(t):this.state.selectedKeys.has(t)}get isEmpty(){return this.state.selectedKeys!==`all`&&this.state.selectedKeys.size===0}get isSelectAll(){if(this.isEmpty)return!1;if(this.state.selectedKeys===`all`)return!0;if(this._isSelectAll!=null)return this._isSelectAll;let e=this.getSelectAllKeys(),t=this.state.selectedKeys;return this._isSelectAll=e.every(e=>t.has(e)),this._isSelectAll}get firstSelectedKey(){let e=null;for(let t of this.state.selectedKeys){let n=this.collection.getItem(t);(!e||n&&Jc(this.collection,n,e)<0)&&(e=n)}return e?.key??null}get lastSelectedKey(){let e=null;for(let t of this.state.selectedKeys){let n=this.collection.getItem(t);(!e||n&&Jc(this.collection,n,e)>0)&&(e=n)}return e?.key??null}get disabledKeys(){return this.state.disabledKeys}get disabledBehavior(){return this.state.disabledBehavior}extendSelection(e){if(this.selectionMode===`none`)return;if(this.selectionMode===`single`){this.replaceSelection(e);return}let t=this.getKey(e);if(t==null)return;let n;if(this.state.selectedKeys===`all`)n=new cl([t],t,t);else{let e=this.state.selectedKeys,r=e.anchorKey??t;n=new cl(e,r,t);for(let i of this.getKeyRange(r,e.currentKey??t))n.delete(i);for(let e of this.getKeyRange(t,r))this.canSelectItem(e)&&n.add(e)}this.state.setSelectedKeys(n)}getKeyRange(e,t){let n=this.collection.getItem(e),r=this.collection.getItem(t);return n&&r?Jc(this.collection,n,r)<=0?this.getKeyRangeInternal(e,t):this.getKeyRangeInternal(t,e):[]}getKeyRangeInternal(e,t){if(this.layoutDelegate?.getKeyRange)return this.layoutDelegate.getKeyRange(e,t);let n=[],r=e;for(;r!=null;){let e=this.collection.getItem(r);if(e&&(e.type===`item`||e.type===`cell`&&this.allowsCellSelection)&&n.push(r),r===t)return n;r=this.collection.getKeyAfter(r)}return[]}getKey(e){let t=this.collection.getItem(e);if(!t||t.type===`cell`&&this.allowsCellSelection)return e;for(;t&&t.type!==`item`&&t.parentKey!=null;)t=this.collection.getItem(t.parentKey);return!t||t.type!==`item`?null:t.key}toggleSelection(e){if(this.selectionMode===`none`)return;if(this.selectionMode===`single`&&!this.isSelected(e)){this.replaceSelection(e);return}let t=this.getKey(e);if(t==null)return;let n=new cl(this.state.selectedKeys===`all`?this.getSelectAllKeys():this.state.selectedKeys);n.has(t)?n.delete(t):this.canSelectItem(t)&&(n.add(t),n.anchorKey=t,n.currentKey=t),!(this.disallowEmptySelection&&n.size===0)&&this.state.setSelectedKeys(n)}replaceSelection(e){if(this.selectionMode===`none`)return;let t=this.getKey(e);if(t==null)return;let n=this.canSelectItem(t)?new cl([t],t,t):new cl;this.state.setSelectedKeys(n)}setSelectedKeys(e){if(this.selectionMode===`none`)return;let t=new cl;for(let n of e){let e=this.getKey(n);if(e!=null&&(t.add(e),this.selectionMode===`single`))break}this.state.setSelectedKeys(t)}getSelectAllKeys(){let e=this.fullCollection??this.collection,t=[],n=r=>{for(;r!=null;){if(this.canSelectItemIn(r,e)){let i=e.getItem(r);i?.type===`item`&&t.push(r),i?.hasChildNodes&&(this.allowsCellSelection||i.type!==`item`)&&n(Gc(Wc(i,e))?.key??null)}r=e.getKeyAfter(r)}};return n(e.getFirstKey()),t}selectAll(){!this.isSelectAll&&this.selectionMode===`multiple`&&this.state.setSelectedKeys(`all`)}clearSelection(){!this.disallowEmptySelection&&(this.state.selectedKeys===`all`||this.state.selectedKeys.size>0)&&this.state.setSelectedKeys(new cl)}toggleSelectAll(){this.isSelectAll?this.clearSelection():this.selectAll()}select(e,t){this.selectionMode!==`none`&&(this.selectionMode===`single`?this.isSelected(e)&&!this.disallowEmptySelection?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior===`toggle`||t&&(t.pointerType===`touch`||t.pointerType===`virtual`)?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys)return!0;let t=this.selectedKeys;if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;for(let n of t)if(!e.has(n))return!1;return!0}canSelectItem(e){return this.canSelectItemIn(e,this.collection)}canSelectItemIn(e,t){if(this.state.selectionMode===`none`||this.state.disabledKeys.has(e))return!1;let n=t.getItem(e);return!(!n||n?.props?.isDisabled||n.type===`cell`&&!this.allowsCellSelection)}isDisabled(e){let t=this.collection.getItem(e);return this.state.disabledBehavior===`all`&&(this.state.disabledKeys.has(e)||!!t?.props?.isDisabled)&&t?.props?.disabledBehavior!==`selection`}isLink(e){return!!this.collection.getItem(e)?.props?.href}getItemProps(e){return this.collection.getItem(e)?.props}withCollection(t){return new e(t,this.state,{allowsCellSelection:this.allowsCellSelection,layoutDelegate:this.layoutDelegate||void 0,fullCollection:this.fullCollection??this.collection})}},U=class{constructor(e,{expandedKeys:t}={}){this.keyMap=new Map,this.firstKey=null,this.lastKey=null,this.iterable=e,t||=new Set;let n=e=>{if(this.keyMap.set(e.key,e),e.childNodes&&(e.type===`section`||t.has(e.key)))for(let t of e.childNodes)n(t)};for(let t of e)n(t);let r=null,i=0;for(let[e,t]of this.keyMap)r?(r.nextKey=e,t.prevKey=r.key):(this.firstKey=e,t.prevKey=void 0),t.type===`item`&&(t.index=i++),r=t,r.nextKey=void 0;this.lastKey=r?.key??null}*[Symbol.iterator](){yield*this.iterable}get size(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let t=this.keyMap.get(e);return t?t.prevKey??null:null}getKeyAfter(e){let t=this.keyMap.get(e);return t?t.nextKey??null:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)??null}at(e){let t=[...this.getKeys()];return this.getItem(t[e])}},ul=class{build(e,t){return this.context=t,dl(()=>this.iterateCollection(e))}*iterateCollection(e){let{children:t,items:n}=e;if(I.isValidElement(t)&&t.type===I.Fragment)yield*this.iterateCollection({children:t.props.children,items:n});else if(typeof t==`function`){if(!n)throw Error(`props.children was a function but props.items is missing`);let e=0;for(let r of n)yield*this.getFullNode({value:r,index:e},{renderer:t}),e++}else{let e=[];I.Children.forEach(t,t=>{t&&e.push(t)});let n=0;for(let t of e){let e=this.getFullNode({element:t,index:n},{});for(let t of e)n++,yield t}}}getKey(e,t,n,r){if(e.key!=null)return e.key;if(t.type===`cell`&&t.key!=null)return`${r}${t.key}`;let i=t.value;if(i!=null){let e=i.key??i.id;if(e==null)throw Error(`No key found for item`);return e}return r?`${r}.${t.index}`:`$.${t.index}`}getChildState(e,t){return{renderer:t.renderer||e.renderer}}*getFullNode(e,t,n,r){if(I.isValidElement(e.element)&&e.element.type===I.Fragment){let i=[];I.Children.forEach(e.element.props.children,e=>{i.push(e)});let a=e.index??0;for(let e of i)yield*this.getFullNode({element:e,index:a++},t,n,r);return}let i=e.element;if(!i&&e.value&&t&&t.renderer){let n=this.cache.get(e.value);if(n&&(!n.shouldInvalidate||!n.shouldInvalidate(this.context))){n.index=e.index,n.parentKey=r?r.key:null,yield n;return}i=t.renderer(e.value)}if(I.isValidElement(i)){let a=i.type;if(typeof a!=`function`&&typeof a.getCollectionNode!=`function`){let e=i.type;throw Error(`Unknown element <${e}> in collection.`)}let o=a.getCollectionNode(i.props,this.context),s=e.index??0,c=o.next();for(;!c.done&&c.value;){let a=c.value;e.index=s;let l=a.key??null;l??=a.element?null:this.getKey(i,e,t,n);let u=[...this.getFullNode({...a,key:l,index:s,wrapper:fl(e.wrapper,a.wrapper)},this.getChildState(t,a),n?`${n}${i.key}`:i.key,r)];for(let t of u){if(t.value=a.value??e.value??null,t.value&&this.cache.set(t.value,t),e.type&&t.type!==e.type)throw Error(`Unsupported type <${pl(t.type)}> in <${pl(r?.type??`unknown parent type`)}>. Only <${pl(e.type)}> is supported.`);s++,yield t}c=o.next(u)}return}if(e.key==null||e.type==null)return;let a=this,o={type:e.type,props:e.props,key:e.key,parentKey:r?r.key:null,value:e.value??null,level:(r?.level??0)+ +(r?.type===`item`),index:e.index,rendered:e.rendered,textValue:e.textValue??``,"aria-label":e[`aria-label`],wrapper:e.wrapper,shouldInvalidate:e.shouldInvalidate,hasChildNodes:e.hasChildNodes||!1,childNodes:dl(function*(){if(!e.hasChildNodes||!e.childNodes)return;let n=0;for(let r of e.childNodes()){r.key!=null&&(r.key=`${o.key}${r.key}`);let e=a.getFullNode({...r,index:n},a.getChildState(t,r),o.key,o);for(let t of e)n++,yield t}})};yield o}constructor(){this.cache=new WeakMap}};function dl(e){let t=[],n=null;return{*[Symbol.iterator](){for(let e of t)yield e;n||=e();for(let e of n)t.push(e),yield e}}}function fl(e,t){if(e&&t)return n=>e(t(n));if(e)return e;if(t)return t}function pl(e){return e[0].toUpperCase()+e.slice(1)}function ml(e,t,n){let r=(0,I.useMemo)(()=>new ul,[]),{children:i,items:a,collection:o}=e;return(0,I.useMemo)(()=>o||t(r.build({children:i,items:a},n)),[r,i,a,o,n,t])}function hl(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function gl(e){let{selectionMode:t=`none`,disallowEmptySelection:n=!1,allowDuplicateSelectionEvents:r,selectionBehavior:i=`toggle`,disabledBehavior:a=`all`}=e,o=(0,I.useRef)(!1),[,s]=(0,I.useState)(!1),c=(0,I.useRef)(null),l=(0,I.useRef)(null),[,u]=(0,I.useState)(null),d=(0,I.useMemo)(()=>_l(e.selectedKeys),[e.selectedKeys]),f=(0,I.useMemo)(()=>_l(e.defaultSelectedKeys,new cl),[e.defaultSelectedKeys]),[p,m]=Qe(d,f,e.onSelectionChange),h=(0,I.useMemo)(()=>e.disabledKeys?new Set(e.disabledKeys):new Set,[e.disabledKeys]),[g,_]=(0,I.useState)(i);i===`replace`&&g===`toggle`&&typeof p==`object`&&p.size===0&&_(`replace`);let v=(0,I.useRef)(i);return(0,I.useEffect)(()=>{i!==v.current&&(_(i),v.current=i)},[i]),{selectionMode:t,disallowEmptySelection:n,selectionBehavior:g,setSelectionBehavior:_,get isFocused(){return o.current},setFocused(e){o.current=e,s(e)},get focusedKey(){return c.current},get childFocusStrategy(){return l.current},setFocusedKey(e,t=`first`){c.current=e,l.current=t,u(e)},selectedKeys:p,setSelectedKeys(e){(r||!hl(e,p))&&m(e)},disabledKeys:h,disabledBehavior:a}}function _l(e,t){return e?e===`all`?`all`:new cl(e):t}function vl(e){let{onExpandedChange:t}=e,[n,r]=Qe(e.expandedKeys?new Set(e.expandedKeys):void 0,e.defaultExpandedKeys?new Set(e.defaultExpandedKeys):new Set,t),i=gl(e),a=(0,I.useMemo)(()=>e.disabledKeys?new Set(e.disabledKeys):new Set,[e.disabledKeys]),o=ml(e,(0,I.useCallback)(e=>new U(e,{expandedKeys:n}),[n]),null);return(0,I.useEffect)(()=>{i.focusedKey!=null&&!o.getItem(i.focusedKey)&&i.setFocusedKey(null)},[o,i.focusedKey]),{collection:o,expandedKeys:n,disabledKeys:a,toggleKey:e=>{r(yl(n,e))},setExpandedKeys:r,selectionManager:new ll(o,i)}}function yl(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}var bl=(0,I.createContext)(null),xl=(0,I.createContext)(null),Sl=(0,I.createContext)(null),Cl=(0,I.createContext)(null);function wl(e){let t=ol(e),n=(0,I.useRef)(null),{menuTriggerProps:r,menuProps:i}=Tc({...e,type:`menu`},t,n),a=(0,I.useRef)(null);return M()?null:I.createElement(pe,{values:[[bl,{...i,ref:a}],[Ll,t],[Sl,t],[Ts,{trigger:`MenuTrigger`,triggerRef:n,scrollRef:a,placement:`bottom start`,"aria-labelledby":i[`aria-labelledby`],offset:e.trigger===`contextMenu`?0:void 0}]]},I.createElement(ys,{...r,ref:n,isPressed:t.isOpen},e.children))}var Tl=(0,I.createContext)(null),El=class extends p{static{this.type=`submenutrigger`}filter(e,t,n){let r=e.getItem(this.firstChildKey);if(r&&n(r.textValue,this)){let n=this.clone();return t.addDescendants(n,e),n}return null}},Dl=w(El,(e,t,n)=>{let{CollectionBranch:r}=(0,I.useContext)(Ns),i=(0,I.useContext)(xl),a=(0,I.useContext)(Sl),o=sl({triggerKey:n.key},a),s=(0,I.useRef)(null),c=ye(t),{parentMenuRef:l,shouldUseVirtualFocus:u}=(0,I.useContext)(Tl),{submenuTriggerProps:d,submenuProps:f,popoverProps:p}=al({parentMenuRef:l,submenuRef:s,delay:e.delay,shouldUseVirtualFocus:u},o,c);return I.createElement(pe,{values:[[Nl,{...d,onAction:void 0,ref:c}],[bl,{ref:s,...f}],[Ll,o],[Ts,{trigger:`SubmenuTrigger`,triggerRef:c,placement:`end top`,"aria-labelledby":f[`aria-labelledby`],...p}]]},I.createElement(r,{collection:i.collection,parent:n}),e.children[1])},e=>e.children[0]),Ol=(0,I.forwardRef)(function(e,t){return[e,t]=Xe(e,t,bl),I.createElement(re,{content:I.createElement(te,e)},n=>I.createElement(kl,{props:e,collection:n,menuRef:t}))});function kl({props:e,collection:t,menuRef:n}){[e,n]=Xe(e,n,N);let{filter:r,...i}=e,a=(0,I.useMemo)(()=>r?t.filter(r):t,[t,r]),o=vl({...e,collection:a,children:void 0}),s=(0,I.useContext)(Sl),{isVirtualized:c,CollectionRoot:l}=(0,I.useContext)(Ns),{menuProps:u}=Bc({...e,isVirtualized:c,onClose:e.onClose||s?.close},o,n),d=Ce({...e,children:void 0,defaultClassName:`react-aria-Menu`,values:{isEmpty:o.collection.size===0}}),f=null;o.collection.size===0&&e.renderEmptyState&&(f=I.createElement(`div`,{role:`menuitem`,style:{display:`contents`}},e.renderEmptyState()));let p=st(e,{global:!0});return I.createElement(Je,null,I.createElement(ve.div,{...P(p,d,u),ref:n,slot:e.slot||void 0,"data-empty":o.collection.size===0||void 0,onScroll:e.onScroll},I.createElement(pe,{values:[[xl,o],[se,{elementType:`div`}],[ks,{name:`MenuSection`,render:jl}],[Tl,{parentMenuRef:n,shouldUseVirtualFocus:i?.shouldUseVirtualFocus}],[Nl,{shouldCloseOnSelect:e.shouldCloseOnSelect}],[N,null],[ne,null],[Cl,o.selectionManager],[Sl,s??ol({})]]},I.createElement(ft,null,I.createElement(l,{collection:o.collection,persistedKeys:Ps(o.selectionManager.focusedKey),scrollRef:n}))),f))}var Al=class extends ll{constructor(e,t){super(e.collection,t),this.parent=e}get focusedKey(){return this.parent.focusedKey}get isFocused(){return this.parent.isFocused}setFocusedKey(e,t){return this.parent.setFocusedKey(e,t)}setFocused(e){this.parent.setFocused(e)}get childFocusStrategy(){return this.parent.childFocusStrategy}};function jl(e,t,n,r=`react-aria-MenuSection`){let i=(0,I.useContext)(xl),{CollectionBranch:a}=(0,I.useContext)(Ns),[o,s]=we(),{headingProps:c,groupProps:l}=$c({heading:s,"aria-label":n.props[`aria-label`]??void 0}),u=Ce({...e,id:void 0,children:void 0,defaultClassName:r,className:n.props?.className,style:n.props?.style,values:void 0}),d=(0,I.useContext)(Cl),f=gl(e),p=e.selectionMode==null?d:new Al(d,f),m=Se(Nl)?.shouldCloseOnSelect,h=st(e,{global:!0});return delete h.id,I.createElement(ve.section,{...P(h,u,l),ref:t},I.createElement(pe,{values:[[Fs,{...c,ref:o}],[Cl,p],[Nl,{shouldCloseOnSelect:e.shouldCloseOnSelect??m}]]},I.createElement(a,{collection:i.collection,parent:n})))}var Ml=w(de,jl),Nl=(0,I.createContext)(null),Pl=O(a,function(e,t,n){[e,t]=Xe(e,t,Nl);let r=Se(Nl)?.id,i=(0,I.useContext)(xl),a=ye(t),o=(0,I.useContext)(Cl),{isVirtualized:s}=(0,I.useContext)(Ns),{menuItemProps:c,labelProps:l,descriptionProps:u,keyboardShortcutProps:d,...f}=Qc({...e,id:r,key:n.key,selectionManager:o,isVirtualized:s},i,a),{hoverProps:p,isHovered:m}=pt({isDisabled:f.isDisabled}),h=Ce({...e,id:void 0,children:n.rendered,defaultClassName:`react-aria-MenuItem`,values:{...f,isHovered:m,isFocusVisible:f.isFocusVisible,selectionMode:o.selectionMode,selectionBehavior:o.selectionBehavior,hasSubmenu:!!e[`aria-haspopup`],isOpen:e[`aria-expanded`]===`true`}}),g=e.href?ve.a:ve.div,_=st(e,{global:!0});return delete _.id,delete _.onClick,I.createElement(g,{...P(_,h,c,p),ref:a,"data-disabled":f.isDisabled||void 0,"data-hovered":m||void 0,"data-focused":f.isFocused||void 0,"data-focus-visible":f.isFocusVisible||void 0,"data-pressed":f.isPressed||void 0,"data-selected":f.isSelected||void 0,"data-selection-mode":o.selectionMode===`none`?void 0:o.selectionMode,"data-has-submenu":!!e[`aria-haspopup`]||void 0,"data-open":e[`aria-expanded`]===`true`||void 0},I.createElement(pe,{values:[[v,{slots:{[Ee]:l,label:l,description:u}}],[Is,d],[Ls,{isSelected:f.isSelected}]]},h.children))});function Fl(e,t){let{role:n=`dialog`}=e,r=He();r=e[`aria-label`]?void 0:r;let i=He();i=n===`alertdialog`&&!e[`aria-describedby`]?i:void 0;let a=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(t.current&&!De(t.current)){he(t.current);let e=setTimeout(()=>{(fe()===t.current||fe()===document.body)&&(a.current=!0,t.current&&(t.current.blur(),he(t.current)),a.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),ws(),(0,I.useRef)(!1),(0,I.useEffect)(()=>{});let o=e[`aria-describedby`]??i;return{dialogProps:{...st(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]??r,"aria-describedby":o,onBlur:e=>{a.current&&e.stopPropagation()}},titleProps:{id:r},contentProps:{id:i}}}var Il=(0,I.createContext)(null),Ll=(0,I.createContext)(null);function Rl(e){let t=ol(e),n=(0,I.useRef)(null),{triggerProps:r,overlayProps:i}=Cc({type:`dialog`},t,n);return r.id=$e(),i[`aria-labelledby`]=r.id,I.createElement(pe,{values:[[Ll,t],[Sl,t],[Il,i],[Ts,{trigger:`DialogTrigger`,triggerRef:n,id:i.id,"aria-labelledby":i[`aria-labelledby`]}]]},I.createElement(ys,{...r,ref:n,isPressed:t.isOpen},e.children))}var zl=(0,I.forwardRef)(function(e,t){let n=e[`aria-labelledby`];[e,t]=Xe(e,t,Il);let{dialogProps:r,titleProps:i,contentProps:a}=Fl({...e,"aria-labelledby":n},t),o=(0,I.useContext)(Ll);!r[`aria-label`]&&!r[`aria-labelledby`]&&e[`aria-labelledby`]&&(r[`aria-labelledby`]=e[`aria-labelledby`]);let s=Ce({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),c=st(e,{global:!0});return I.createElement(ve.section,{...P(c,s,r),render:e.render,ref:t,slot:e.slot||void 0},I.createElement(pe,{values:[[V,{slots:{[Ee]:{},title:{...i,level:2}}}],[v,{slots:{[Ee]:{},description:a}}],[h,{slots:{[Ee]:{},close:{onPress:()=>o?.close()}}}]]},s.children))});function Bl(e,t,n){let{overlayProps:r,underlayProps:i}=wo({...e,isOpen:t.isOpen,onClose:t.close},n);return Oo({isDisabled:!t.isOpen}),ws(),(0,I.useEffect)(()=>{if(t.isOpen&&n.current)return yo([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:P(r),underlayProps:i}}var W=(0,I.createContext)(null),G=(0,I.createContext)(null),K=(0,I.forwardRef)(function(e,t){if((0,I.useContext)(G))return I.createElement(Hl,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,children:s,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d,...f}=e;return I.createElement(J,{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d},I.createElement(Hl,{...f,modalRef:t},s))});function q(e,t){[e,t]=Xe(e,t,W);let n=(0,I.useContext)(Ll),r=ue(e),i=e.isOpen!=null||e.defaultOpen!=null||!n?r:n,a=ye(t),o=(0,I.useRef)(null),s=T(a,i.isOpen),c=T(o,i.isOpen),l=s||c||e.isExiting||!1,u=mt();return!i.isOpen&&!l||u?null:I.createElement(Vl,{...e,state:i,isExiting:l,overlayRef:a,modalRef:o})}var J=(0,I.forwardRef)(q);function Vl({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:r}=t,{modalProps:i,underlayProps:a}=Bl(t,r,n),o=y(t.overlayRef)||t.isEntering||!1,s=Ce({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:o,isExiting:t.isExiting,state:r}}),c=eo(),l,u;if(typeof document<`u`){let e=Xa(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().width%1,n=e.getBoundingClientRect().height%1;l=e.scrollWidth-t,u=e.scrollHeight-n}let d={...s.style,"--visual-viewport-width":c.width+`px`,"--visual-viewport-height":c.height+`px`,"--page-width":l===void 0?void 0:l+`px`,"--page-height":u===void 0?void 0:u+`px`};return I.createElement(Cs,{isExiting:t.isExiting,portalContainer:e},I.createElement(ve.div,{...P(st(t,{global:!0}),a),...s,style:d,ref:t.overlayRef,"data-entering":o||void 0,"data-exiting":t.isExiting||void 0},I.createElement(pe,{values:[[G,{modalProps:i,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[Ll,r]]},s.children)))}function Hl(e){let{modalProps:t,modalRef:n,isExiting:r,isDismissable:i}=(0,I.useContext)(G),a=(0,I.useContext)(Ll),o=(0,I.useMemo)(()=>Pe(e.modalRef,n),[e.modalRef,n]),s=ye(o),c=y(s),l=Ce({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:c,isExiting:r,state:a}});return I.createElement(ve.div,{...P(st(e,{global:!0}),t),...l,ref:s,"data-entering":c||void 0,"data-exiting":r||void 0},i&&I.createElement(vs,{onDismiss:a.close}),l.children)}var Y=r(),Ul=({children:e,className:t,slot:n,style:r,variant:i,...a})=>{let o=(0,I.useMemo)(()=>co({variant:i}),[i]);return(0,Y.jsx)(g,{"aria-label":`Close`,className:Ve(t,o),"data-slot":`close-button`,slot:n,style:r,type:`button`,...a,children:t=>typeof e==`function`?e(t):e??(0,Y.jsx)(l,{"data-slot":`close-button-icon`})})},Wl=Object.assign(Ul,{Root:Ul});function Gl(e,t,n){let{isSelected:r}=t,{isPressed:i,buttonProps:a}=at({...e,onPress:dt(t.toggle,e.onPress)},n);return{isPressed:i,isSelected:r,isDisabled:e.isDisabled||!1,buttonProps:P(a,{"aria-pressed":r})}}function Kl(e,t){let{"aria-label":n,"aria-labelledby":r,orientation:i=`horizontal`}=e,[a,o]=(0,I.useState)(!1);Ue(()=>{o(!!(t.current&&t.current.parentElement?.closest(`[role="toolbar"]`)))});let{direction:s}=Ze(),c=s===`rtl`&&i===`horizontal`,l=it(t),u=e=>{if(Fe(e.currentTarget,F(e))){if(i===`horizontal`&&e.key===`ArrowRight`||i===`vertical`&&e.key===`ArrowDown`)c?l.focusPrevious():l.focusNext();else if(i===`horizontal`&&e.key===`ArrowLeft`||i===`vertical`&&e.key===`ArrowUp`)c?l.focusNext():l.focusPrevious();else if(e.key===`Tab`){d.current=fe(),e.shiftKey?l.focusFirst():l.focusLast();return}else return;e.stopPropagation(),e.preventDefault()}},d=(0,I.useRef)(null),f=e=>{!Fe(e.currentTarget,e.relatedTarget)&&!d.current&&(d.current=F(e))},p=e=>{d.current&&!Fe(e.currentTarget,e.relatedTarget)&&Fe(t.current,F(e))&&(d.current?.focus(),d.current=null)};return{toolbarProps:{...st(e,{labelable:!0}),role:a?`group`:`toolbar`,"aria-orientation":i,"aria-label":n,"aria-labelledby":n==null?r:void 0,onKeyDownCapture:a?void 0:u,onFocusCapture:a?void 0:p,onBlurCapture:a?void 0:f}}}function ql(e,t,n){let{isDisabled:r}=e,{toolbarProps:i}=Kl(e,n);return{groupProps:{...i,role:t.selectionMode===`single`?`radiogroup`:i.role,"aria-disabled":r}}}function Jl(e,t,n){let r={isSelected:t.selectedKeys.has(e.id),defaultSelected:!1,setSelected(n){t.setSelected(e.id,n)},toggle(){t.toggleKey(e.id)}},{isPressed:i,isSelected:a,isDisabled:o,buttonProps:s}=Gl({...e,id:void 0,isDisabled:e.isDisabled||t.isDisabled},r,n);return t.selectionMode===`single`&&(s.role=`radio`,s[`aria-checked`]=r.isSelected,delete s[`aria-pressed`]),{isPressed:i,isSelected:a,isDisabled:o,buttonProps:s}}function Yl(e){let{selectionMode:t=`single`,disallowEmptySelection:n,isDisabled:r=!1}=e,[i,a]=Qe((0,I.useMemo)(()=>e.selectedKeys?new Set(e.selectedKeys):void 0,[e.selectedKeys]),(0,I.useMemo)(()=>e.defaultSelectedKeys?new Set(e.defaultSelectedKeys):new Set,[e.defaultSelectedKeys]),e.onSelectionChange);return{selectionMode:t,isDisabled:r,selectedKeys:i,setSelectedKeys:a,toggleKey(e){let r;t===`multiple`?(r=new Set(i),r.has(e)&&(!n||r.size>1)?r.delete(e):r.add(e)):r=new Set(i.has(e)&&!n?[]:[e]),a(r)},setSelected(e,t){t!==i.has(e)&&this.toggleKey(e)}}}var Xl=(0,I.createContext)({}),Zl=(0,I.createContext)(null),Ql=(0,I.forwardRef)(function(e,t){[e,t]=Xe(e,t,Xl);let n=Yl(e),{groupProps:r}=ql(e,n,t),i=Ce({...e,values:{orientation:e.orientation||`horizontal`,isDisabled:n.isDisabled,state:n},defaultClassName:`react-aria-ToggleButtonGroup`}),a=st(e,{global:!0});return I.createElement(ve.div,{...P(a,i,r),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`horizontal`,"data-disabled":e.isDisabled||void 0},I.createElement(Zl.Provider,{value:n},I.createElement(ft,null,i.children)))}),$l=(0,I.createContext)({}),eu=({children:e,className:t,color:n,size:r,variant:i,...a})=>{let o=I.useMemo(()=>so({color:n,size:r,variant:i}),[n,r,i]),s=I.useMemo(()=>typeof e==`string`||typeof e==`number`?(0,Y.jsx)(tu,{children:e}):e,[e]);return(0,Y.jsx)($l,{value:{slots:o},children:(0,Y.jsx)(me.span,{...a,className:ut(o.base,t),"data-slot":`chip`,children:s})})},tu=({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)($l);return(0,Y.jsx)(me.span,{className:ut(r?.label,t),"data-slot":`chip-label`,...n,children:e})},nu=Object.assign(eu,{Root:eu,Label:tu}),ru=8,iu=.3,au=.5;function ou(e,t){let n=(0,I.use)(Ll),r=(0,I.useRef)(null),i=(0,I.useRef)(!1),a=(0,I.useRef)(!1),o=(0,I.useRef)(0),s=(0,I.useRef)(0),c=(0,I.useRef)(0),l=(0,I.useRef)(0),u=(0,I.useRef)(0),d=e===`top`||e===`bottom`,f=(0,I.useCallback)(e=>d?e.clientY:e.clientX,[d]),p=(0,I.useCallback)(t=>{switch(e){case`bottom`:return Math.max(0,t);case`top`:return Math.min(0,t);case`right`:return Math.max(0,t);case`left`:return Math.min(0,t);default:return t}},[e]),m=(0,I.useCallback)(e=>{t&&e.button===0&&(e.target.closest(`input, textarea, button, [role='button'], select, a, [data-slot='drawer-body']`)||(i.current=!0,a.current=!1,o.current=f(e),u.current=o.current,l.current=Date.now(),s.current=0,c.current=0))},[f,t]),h=(0,I.useCallback)(e=>{if(!i.current||!r.current)return;let t=f(e),n=t-o.current,m=p(n);if(!a.current){if(Math.abs(n)0&&(c.current=(t-u.current)/g,l.current=h,u.current=t);let _=d?`Y`:`X`;r.current.style.transform=`translate${_}(${m}px)`},[f,p,d]),g=(0,I.useCallback)(e=>{if(!i.current)return;i.current=!1;let t=r.current;if(!t||!a.current){a.current=!1;return}a.current=!1;try{t.releasePointerCapture(e.pointerId)}catch{}let o=d?t.offsetHeight:t.offsetWidth,l=Math.abs(s.current),u=Math.abs(c.current);(l>o*iu||u>au)&&n?n.close():(t.style.transition=`transform 300ms cubic-bezier(0.32, 0.72, 0, 1)`,t.style.transform=``,t.addEventListener(`transitionend`,()=>{t.style.transition=``},{once:!0})),s.current=0,c.current=0},[d,n]);return{dialogRef:r,dragHandlers:t?{onPointerDown:m,onPointerMove:h,onPointerUp:g}:{}}}var su=(0,I.createContext)({}),cu=({children:e,state:t,...n})=>{let r=(0,I.useMemo)(()=>({slots:lo(),placement:void 0,isDismissable:!0}),[]),i=(0,I.useMemo)(()=>t?{isOpen:t.isOpen,onOpenChange:t.setOpen}:{},[t]);return(0,Y.jsx)(su,{value:r,children:(0,Y.jsx)(Rl,{"data-slot":`drawer-root`,...P(n,i),children:e})})};cu.displayName=`HeroUI.Drawer`;var lu=({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)(su);return(0,Y.jsx)(g,{className:Ve(t,r?.trigger()),"data-slot":`drawer-trigger`,...n,children:e})};lu.displayName=`HeroUI.Drawer.Trigger`;var uu=({children:e,className:t,isDismissable:n=!0,variant:r,...i})=>{let{slots:a}=(0,I.use)(su),o=(0,I.useMemo)(()=>lo({variant:r}),[r]),s=(0,I.useMemo)(()=>({slots:{...a,...o},isDismissable:n}),[a,o,n]);return(0,Y.jsx)(J,{className:Ve(t,o?.backdrop()),"data-slot":`drawer-backdrop`,isDismissable:n,...i,children:t=>(0,Y.jsx)(su,{value:s,children:typeof e==`function`?e(t):e})})};uu.displayName=`HeroUI.Drawer.Backdrop`;var du=({children:e,className:t,placement:n=`bottom`,...r})=>{let{isDismissable:i,slots:a}=(0,I.use)(su),o=(0,I.useMemo)(()=>lo({placement:n}),[n]),s=(0,I.useMemo)(()=>({placement:n,isDismissable:i,slots:{...a,...o}}),[a,n,i,o]);return(0,Y.jsx)(K,{className:Ve(t,o?.content()),"data-placement":n,"data-slot":`drawer-content`,...r,children:t=>(0,Y.jsx)(su,{value:s,children:typeof e==`function`?e(t):e})})};du.displayName=`HeroUI.Drawer.Content`;var fu=({children:e,className:t,...n})=>{let{isDismissable:r=!0,placement:i,slots:a}=(0,I.use)(su),{dialogRef:o,dragHandlers:s}=ou(i,r);return(0,Y.jsx)(c,{value:{variant:`default`},children:(0,Y.jsx)(zl,{ref:o,className:ut(a?.dialog,t),"data-placement":i,"data-slot":`drawer-dialog`,style:r?{touchAction:`none`}:void 0,...s,...n,children:e})})};fu.displayName=`HeroUI.Drawer.Dialog`;var pu=({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)(su);return(0,Y.jsx)(me.div,{className:ut(r?.header,t),"data-slot":`drawer-header`,...n,children:e})};pu.displayName=`HeroUI.Drawer.Header`;var mu=({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)(su);return(0,Y.jsx)(me.div,{className:ut(r?.body,t),"data-slot":`drawer-body`,style:{touchAction:`pan-y`},...n,children:e})};mu.displayName=`HeroUI.Drawer.Body`;var hu=({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)(su);return(0,Y.jsx)(me.div,{className:ut(r?.footer,t),"data-slot":`drawer-footer`,...n,children:e})};hu.displayName=`HeroUI.Drawer.Footer`;var gu=({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)(su);return(0,Y.jsx)(mo,{className:ut(r?.heading,t),"data-slot":`drawer-heading`,slot:`title`,...n,children:e})};gu.displayName=`HeroUI.Drawer.Heading`;var _u=({className:e,...t})=>{let{slots:n}=(0,I.use)(su);return(0,Y.jsx)(me.div,{"aria-hidden":`true`,className:ut(n?.handle,e),"data-slot":`drawer-handle`,...t,children:(0,Y.jsx)(`div`,{"data-slot":`drawer-handle-bar`})})};_u.displayName=`HeroUI.Drawer.Handle`;var vu=({className:e,...t})=>{let{slots:n}=(0,I.use)(su);return(0,Y.jsx)(Wl,{className:Ve(e,n?.closeTrigger()),"data-slot":`drawer-close-trigger`,slot:`close`,...t})};vu.displayName=`HeroUI.Drawer.CloseTrigger`;var yu=Object.assign(cu,{Root:cu,Trigger:lu,Backdrop:uu,Content:du,Dialog:fu,Header:pu,Heading:gu,Body:mu,Footer:hu,Handle:_u,CloseTrigger:vu}),bu=({className:e,orientation:t,variant:n,...r})=>{let i=Se(se),a=t??i?.orientation??`horizontal`;return(0,Y.jsx)(ae,{"data-orientation":a,"data-slot":`separator`,orientation:a,className:uo({orientation:a,variant:n,className:e}),...r})},xu=Object.assign(bu,{Root:bu}),Su=({animationType:e,className:t,...n})=>{let r=St(`--skeleton-animation`,e),i=I.useMemo(()=>fo({animationType:r}),[r]);return(0,Y.jsx)(me.div,{className:i.base({className:t}),...n})},Cu=Object.assign(Su,{Root:Su}),wu=(0,I.createContext)({}),Tu=(0,I.forwardRef)(function(e,t){[e,t]=Xe(e,t,wu);let{toolbarProps:n}=Kl(e,t),r=Ce({...e,values:{orientation:e.orientation||`horizontal`},defaultClassName:`react-aria-Toolbar`}),i=st(e,{global:!0});return delete i.id,I.createElement(ve.div,{...P(i,r,n),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`horizontal`},r.children)}),Eu=({children:e,className:t,isAttached:n,orientation:r=`horizontal`,...i})=>{let a=I.useMemo(()=>po({isAttached:n,orientation:r}),[n,r]);return(0,Y.jsx)(Xl.Provider,{value:{orientation:r},children:(0,Y.jsx)(se.Provider,{value:{orientation:r===`horizontal`?`vertical`:`horizontal`},children:(0,Y.jsx)(Tu,{className:Ve(t,a),"data-slot":`toolbar`,orientation:r,...i,children:e})})})};Eu.displayName=`HeroUI.Toolbar`;var Du=Object.assign(Eu,{Root:Eu}),Ou=I.createContext(null);function ku(e){let{children:t}=e,n=(0,I.useContext)(Ou),[r,i]=(0,I.useState)(0),a=(0,I.useMemo)(()=>({parent:n,modalCount:r,addModal(){i(e=>e+1),n&&n.addModal()},removeModal(){i(e=>e-1),n&&n.removeModal()}}),[n,r]);return I.createElement(Ou.Provider,{value:a},t)}function Au(){let e=(0,I.useContext)(Ou);return{modalProviderProps:{"aria-hidden":e&&e.modalCount>0?!0:void 0}}}function ju(e){let{modalProviderProps:t}=Au();return I.createElement(`div`,{"data-overlay-container":!0,...e,...t})}function Mu(e){return I.createElement(ku,null,I.createElement(ju,e))}function Nu(e){let t=mt(),{portalContainer:n=t?null:document.body,...r}=e,{getContainer:i}=m();if(!e.portalContainer&&i&&(n=i()),I.useEffect(()=>{if(n?.closest(`[data-overlay-container]`))throw Error(`An OverlayContainer must not be inside another container. Please change the portalContainer prop.`)},[n]),!n)return null;let a=I.createElement(Mu,r);return xs.createPortal(a,n)}var Pu=1500,Fu=500,Iu={},Lu=0,Ru=!1,zu=null,Bu=null;function Vu(e={}){let{delay:t=Pu,closeDelay:n=Fu}=e,{isOpen:r,open:i,close:a}=ue(e),[o,s]=(0,I.useState)(!1),c=(0,I.useMemo)(()=>`${++Lu}`,[]),l=(0,I.useRef)(null),u=(0,I.useRef)(a),d=()=>{Iu[c]=m},f=()=>{for(let e in Iu)e!==c&&(Iu[e](!0,!0),delete Iu[e])},p=e=>{l.current&&clearTimeout(l.current),l.current=null,f(),d(),s(!!e),Ru=!0,i(),zu&&=(clearTimeout(zu),null),Bu&&=(clearTimeout(Bu),null)},m=(e,t)=>{s(!!t),e||n<=0?(l.current&&clearTimeout(l.current),l.current=null,u.current()):l.current||=setTimeout(()=>{l.current=null,u.current()},n),zu&&=(clearTimeout(zu),null),Ru&&(Bu&&clearTimeout(Bu),Bu=setTimeout(()=>{delete Iu[c],Bu=null,Ru=!1},Math.max(Fu,n)))},h=()=>{f(),d(),!r&&!Ru?(zu&&clearTimeout(zu),zu=setTimeout(()=>{zu=null,Ru=!0,p(!1)},t)):r||p(!0)};return(0,I.useEffect)(()=>{u.current=a},[a]),(0,I.useEffect)(()=>()=>{l.current&&clearTimeout(l.current),Iu[c]&&delete Iu[c]},[c]),{isOpen:r,shouldSkipAnimation:o,open:e=>{!e&&t>0&&!l.current?h():p(Ru)},close:m}}function Hu(e,t){let n=st(e,{labelable:!0}),{hoverProps:r}=pt({onHoverStart:()=>t?.open(!0),onHoverEnd:()=>t?.close()});return{tooltipProps:P(n,r,{role:`tooltip`})}}function Uu(e,t,n){let{isDisabled:r,trigger:i,shouldCloseOnPress:a=!0}=e,o=$e(),s=(0,I.useRef)(!1),c=(0,I.useRef)(!1),l=()=>{(s.current||c.current)&&t.open(c.current)},u=e=>{!s.current&&!c.current&&t.close(e)};(0,I.useEffect)(()=>{let e=e=>{n&&n.current&&e.key===`Escape`&&(e.stopPropagation(),t.close(!0))};if(t.isOpen)return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[n,t]);let d=()=>{i!==`focus`&&(gt()===`pointer`?s.current=!0:s.current=!1,l())},f=()=>{i!==`focus`&&(c.current=!1,s.current=!1,u())},p=()=>{a&&(c.current=!1,s.current=!1,u(!0))},m=()=>{Te()&&(c.current=!0,l())},h=()=>{c.current=!1,s.current=!1,u(!0)},{hoverProps:g}=pt({isDisabled:r,onHoverStart:d,onHoverEnd:f}),{focusableProps:_}=vt({isDisabled:r,onFocus:m,onBlur:h},n);return{triggerProps:{"aria-describedby":t.isOpen?o:void 0,...P(_,g,{onPointerDown:p,onKeyDown:p}),tabIndex:void 0},tooltipProps:{id:o}}}var Wu=(0,I.createContext)(null),Gu=(0,I.createContext)(null);function X(e){let t=Vu(e),n=(0,I.useRef)(null),{triggerProps:r,tooltipProps:i}=Uu(e,t,n);return I.createElement(pe,{values:[[Wu,t],[Gu,{...i,triggerRef:n}]]},I.createElement(ht,{...r,ref:n},e.children))}var Ku=(0,I.forwardRef)(function({UNSTABLE_portalContainer:e,...t},n){[t,n]=Xe(t,n,Gu);let r=(0,I.useContext)(Wu),i=Vu(t),a=t.isOpen!=null||t.defaultOpen!=null||!r?i:r,o=T(n,a.isOpen),s=t.isExiting||!a.shouldSkipAnimation&&o||!1;return!a.isOpen&&!s?null:I.createElement(Nu,{portalContainer:e},I.createElement(qu,{...t,tooltipRef:n,isExiting:s}))});function qu(e){let t=(0,I.useContext)(Wu),n=(0,I.useRef)(null),{overlayProps:r,arrowProps:i,placement:a,triggerAnchorPoint:o}=u({placement:e.placement||`top`,targetRef:e.triggerRef,overlayRef:e.tooltipRef,arrowRef:n,offset:e.offset,crossOffset:e.crossOffset,isOpen:t.isOpen,arrowBoundaryOffset:e.arrowBoundaryOffset,shouldFlip:e.shouldFlip,containerPadding:e.containerPadding,onClose:()=>t.close(!0)}),s=y(e.tooltipRef,!!a),c=e.isEntering||!t.shouldSkipAnimation&&s||!1,l=Ce({...e,defaultClassName:`react-aria-Tooltip`,values:{placement:a,isEntering:c,isExiting:e.isExiting,state:t}});e=P(e,r);let{tooltipProps:d}=Hu(e,t),p=st(e,{global:!0});return I.createElement(ve.div,{...P(p,l,d),ref:e.tooltipRef,style:{...r.style,"--trigger-anchor-point":o?`${o.x}px ${o.y}px`:void 0,...l.style},"data-placement":a??void 0,"data-entering":c||void 0,"data-exiting":e.isExiting||void 0},I.createElement(f.Provider,{value:{...i,placement:a,ref:n}},l.children))}var Ju=e=>{if(!e)return;let t=e.trim(),n=parseFloat(t);if(!Number.isNaN(n))return t.endsWith(`ms`)?n:t.endsWith(`s`)?n*1e3:n},Yu=(0,I.createContext)({}),Xu=({children:e,shouldSkipAnimation:t})=>{let n=(0,I.use)(Wu);return!n||t?e:(0,Y.jsx)(Wu,{value:{...n,shouldSkipAnimation:!1},children:e})},Zu=({children:e,closeDelay:t,delay:n,shouldSkipAnimation:r=!1,...i})=>{let a=I.useMemo(()=>B(),[]),o=St(`--tooltip-delay`),s=St(`--tooltip-close-delay`),c=n??Ju(o),l=t??Ju(s);return(0,Y.jsx)(Yu,{value:{slots:a},children:(0,Y.jsx)(X,{closeDelay:l,"data-slot":`tooltip-root`,delay:c,...i,children:(0,Y.jsx)(Xu,{shouldSkipAnimation:r,children:e})})})},Qu=Object.assign(Zu,{Root:Zu,Trigger:({children:e,className:t,...n})=>{let{slots:r}=(0,I.use)(Yu),i=(0,I.useRef)(null),{focusableProps:a}=vt({},i);return(0,Y.jsx)(me.div,{ref:i,className:ut(r?.trigger,t),"data-slot":`tooltip-trigger`,role:`button`,...P(a,n),children:e})},Content:({children:e,className:t,offset:n,showArrow:r=!1,...i})=>{let{slots:a}=(0,I.use)(Yu),o=n||(r?7:3);return(0,Y.jsx)(Ku,{...i,className:Ve(t,a?.base()),offset:o,children:e})},Arrow:({children:e,className:t,...n})=>{let r=(0,Y.jsx)(`svg`,{"data-slot":`overlay-arrow`,fill:`none`,height:`12`,viewBox:`0 0 12 12`,width:`12`,xmlns:`http://www.w3.org/2000/svg`,children:(0,Y.jsx)(`path`,{d:`M0 0C5.48483 8 6.5 8 12 0Z`})}),i=I.isValidElement(e)?I.cloneElement(e,{"data-slot":`overlay-arrow`}):r;return(0,Y.jsx)(s,{"data-slot":`tooltip-arrow`,...n,className:t,children:i})}}),$u=(0,I.createContext)(null);function ed({children:e}){let{apiKey:t,signOut:n}=xt(),[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(!!t),[s,c]=(0,I.useState)(null),l=(0,I.useCallback)(async(e,r)=>{let a=e??t;if(!a)throw i(null),c(null),o(!1),Error(`missing_api_key`);let s=!!r?.silent;s||o(!0);try{let e=await Et(a);return i(e),c(null),e}catch(e){let t=e instanceof Error?e.message:String(e);throw s||i(null),c(t),wt(e)&&n(),e}finally{s||o(!1)}},[t,n]);(0,I.useEffect)(()=>{if(!t){i(null),o(!1),c(null);return}l(void 0,{refreshQuota:!1}).catch(()=>void 0)},[t,l]);let u=(0,I.useMemo)(()=>({overview:r,loading:a,error:s,refresh:l,setOverview:i}),[r,a,s,l]);return(0,Y.jsx)($u.Provider,{value:u,children:e})}function td(){let e=(0,I.useContext)($u);if(!e)throw Error(`useOverview must be used within OverviewProvider`);return e}var nd=`cli2api_theme`,rd=(0,I.createContext)(null);function id(){let e=localStorage.getItem(nd);return e===`light`||e===`dark`?e:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function ad({children:e}){let[t,n]=(0,I.useState)(id);(0,I.useEffect)(()=>{let e=document.documentElement;e.dataset.theme=t,e.classList.toggle(`dark`,t===`dark`),e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t;let n=sd()??(t===`dark`?`#0A0A0A`:`#FAFAFA`);document.querySelectorAll(`meta[name="theme-color"]`).forEach(e=>{e.setAttribute(`content`,n)})},[t]);let r=(0,I.useMemo)(()=>({theme:t,setTheme:e=>{localStorage.setItem(nd,e),n(e)},toggleTheme:()=>{n(e=>{let t=e===`dark`?`light`:`dark`;return localStorage.setItem(nd,t),t})}}),[t]);return(0,Y.jsx)(rd.Provider,{value:r,children:e})}function od(){let e=(0,I.useContext)(rd);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function sd(){let e=document.createElement(`div`);e.style.cssText=`position:absolute;visibility:hidden;background:var(--background)`,document.body.appendChild(e);let t=getComputedStyle(e).backgroundColor;return e.remove(),t&&t!==`rgba(0, 0, 0, 0)`?t:null}function cd({title:e,desc:t,wide:n,onMenu:r}){let{lang:i,setLang:a,t:o}=ie(),{loading:s,refresh:c,overview:l}=td(),{signOut:u}=xt(),{theme:d,toggleTheme:f}=od(),p=sr(),m=!!l?.worker?.ok;return(0,Y.jsx)(`header`,{className:`relative z-20 shrink-0 border-b border-separator bg-background`,children:(0,Y.jsxs)(`div`,{className:n?`flex w-full items-center gap-4 px-3 py-2 sm:px-4 lg:px-5`:`mx-auto flex w-full max-w-[1480px] items-center gap-4 px-4 py-2 sm:px-6 lg:px-8`,children:[(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`lg:hidden`,onPress:r,"aria-label":o(`menu`),children:(0,Y.jsx)(Oa,{size:17})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-3`,children:[(0,Y.jsx)(`span`,{className:`status-dot translate-y-[-1px]`,"data-state":m?`ok`:`danger`}),(0,Y.jsx)(`h1`,{className:`truncate text-title font-semibold`,children:e}),(0,Y.jsx)(`p`,{className:`hidden truncate text-body text-muted xl:block`,children:t})]})}),(0,Y.jsxs)(Du,{isAttached:!0,children:[(0,Y.jsxs)(Qu,{children:[(0,Y.jsx)(Qu.Trigger,{children:(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,isPending:s,onPress:()=>void c().catch(()=>void 0),"aria-label":o(`refresh`),children:(0,Y.jsx)(oa,{size:15})})}),(0,Y.jsx)(Qu.Content,{children:o(`refresh`)})]}),(0,Y.jsxs)(Qu,{children:[(0,Y.jsx)(Qu.Trigger,{children:(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:()=>a(i===`zh`?`en`:`zh`),"aria-label":i===`zh`?`English`:`中文`,children:(0,Y.jsx)(ba,{size:15})})}),(0,Y.jsx)(Qu.Content,{children:i===`zh`?`English`:`中文`})]}),(0,Y.jsxs)(Qu,{children:[(0,Y.jsx)(Qu.Trigger,{children:(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:f,"aria-label":d===`dark`?`Light mode`:`Dark mode`,children:d===`dark`?(0,Y.jsx)(Ha,{size:15}):(0,Y.jsx)(Aa,{size:15})})}),(0,Y.jsx)(Qu.Content,{children:d===`dark`?`Light mode`:`Dark mode`})]}),(0,Y.jsxs)(Qu,{children:[(0,Y.jsx)(Qu.Trigger,{children:(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:()=>{u(),p(`/login`,{replace:!0})},"aria-label":o(`signOut`),children:(0,Y.jsx)(Ra,{size:15})})}),(0,Y.jsx)(Qu.Content,{children:o(`signOut`)})]})]})]})})}function ld(e=!1){return Ct(`/api/system/update${e?`?force=1`:``}`)}function ud(){return Ct(`/api/system/settings`)}function dd(e){return Ct(`/api/system/settings`,{method:`PATCH`,body:JSON.stringify(e)})}function fd(){return Ct(`/api/system/update/prepare`,{method:`POST`,body:`{}`})}function pd(){return Ct(`/api/system/update/apply`,{method:`POST`,body:`{}`})}function md(){return Ct(`/api/system/update/cancel`,{method:`POST`,body:`{}`})}function hd(e){return Ct(`/api/system/update/rollback`,{method:`POST`,body:JSON.stringify({version:e})})}function gd(){return Ct(`/api/system/resources`)}var _d=new Set([`preparing`,`preparing_image`,`checking`,`backing_up`,`submitting`,`running`,`queued`,`pulling`,`host_binary`,`image_ready`,`recreating`,`rolling_back`]),vd=new Set([`backing_up`,`running`]),yd=new Set([`recreating`,`rolling_back`]),bd=new Set([`queued`,`pulling`,`host_binary`,`image_ready`,`preparing`,`recreating`,`checking`,`rolling_back`]);function Z(){let{t:e}=ie(),[t,n]=(0,I.useState)(null),[r,i]=(0,I.useState)(!0),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(``),[d,f]=(0,I.useState)(null),[p,m]=(0,I.useState)(null),[h,g]=(0,I.useState)(()=>Date.now()),[_,v]=(0,I.useState)(``),y=(0,I.useCallback)(async(t=!1,r=!1)=>{t&&!r&&o(!0);try{let i=await ld(t);n(i),v(e=>e||i.current_version||``),i.update?.state===`failed`||i.update?.state===`rolled_back`||i.agent?.state===`failed`||i.agent?.state===`rolled_back`?u(i.update?.error||i.agent?.error||e(`updateFailedHint`)):r||u(``)}catch(t){r||u(t instanceof Error?t.message:e(`updateCheckFailedHint`))}finally{i(!1),t&&!r&&o(!1)}},[e]);(0,I.useEffect)(()=>{let e=window.setTimeout(()=>void y(!1),0);return()=>window.clearTimeout(e)},[y]);let b=t?.agent?.state||`unavailable`,x=t?.update?.state||``,S=vd.has(x)||yd.has(b)||!!(t?.update?.backup_path&&_d.has(x)),C=!S&&(x===`ready_to_apply`||b===`ready_to_apply`),ee=!!d?.job_id&&t?.update?.job_id!==d?.job_id&&!C&&!S,te=!S&&!C&&(_d.has(x)||_d.has(b)||ee),w=te||S,T=!!((x===`succeeded`||b===`succeeded`)&&_&&t?.current_version&&t.current_version!==_);T&&p==null&&m(3);let E=t?.update?.target_version||t?.agent?.target_version||``,ne=!!(C&&t?.next_version&&E&&t.next_version!==E),D=t?.update?.started_at||t?.agent?.started_at,re=D&&w?Math.max(0,Math.round((h-Date.parse(D))/1e3)):0,ae=T?`succeeded`:C?`ready_to_apply`:w&&bd.has(b)?b:x||b,oe=ae?e(`updateState_${ae}`):``,O=oe.startsWith(`updateState_`)?ae:oe;(0,I.useEffect)(()=>{if(p!=null||!w&&!T)return;let e=window.setInterval(()=>void y(!1,!0),2e3);return()=>window.clearInterval(e)},[w,T,y,p]),(0,I.useEffect)(()=>{if(!w)return;let e=window.setInterval(()=>g(Date.now()),1e3);return()=>window.clearInterval(e)},[w]),(0,I.useEffect)(()=>{if(p==null)return;if(p<=0){window.location.reload();return}let e=window.setTimeout(()=>m(e=>e==null?e:e-1),1e3);return()=>window.clearTimeout(e)},[p]);let k=!!(t?.managed&&t?.has_update&&t?.next_version&&t?.agent?.available&&!C&&!w&&!s&&p==null),A=!!(C&&t?.agent?.available&&!S&&!s&&p==null),se=!!(t?.agent?.available&&(te||C)&&!S&&!s&&p==null),ce=!!(t?.managed&&t?.agent?.available&&(t.rollback_versions?.length??0)>0&&!C&&!w&&!s&&p==null),j=p==null?e(A?`applyUpdateNow`:S?`updateInProgress`:te||s?`updatePreparingImage`:`updateNow`):e(`updateReloadingIn`,{seconds:p}),M=p==null?C?e(`updateReadyTargetHint`,{version:E||t?.next_version||``}):e(S?`updateApplyingHint`:`updatePreparingImageHint`):e(`updateReloadingHint`);async function N(){c(!0),f(null),u(``);try{let e=await fd();f(e),await y(!1,!0)}catch(t){u(t instanceof Error?t.message:e(`updateFailedHint`)),await y(!1,!0)}finally{c(!1)}}async function le(){c(!0),u(``);try{let e=await pd();f(e),await y(!1,!0)}catch(t){u(t instanceof Error?t.message:e(`updateFailedHint`)),await y(!1,!0)}finally{c(!1)}}async function ue(t){c(!0),f(null),u(``);try{let e=await hd(t);f(e),await y(!1,!0)}catch(t){u(t instanceof Error?t.message:e(`updateFailedHint`)),await y(!1,!0)}finally{c(!1)}}async function de(){c(!0),u(``);try{await md(),f(null),await y(!0,!0)}catch(t){u(t instanceof Error?t.message:e(`updateFailedHint`)),await y(!1,!0)}finally{c(!1)}}return{info:t,loading:r,checking:a,submitting:s,error:l,setError:u,reloadIn:p,load:y,elapsed:re,readyToApply:C,busy:w,justUpdated:T,targetVersion:E,newerThanPrepared:ne,updateStateText:O,canPrepare:k,canApply:A,canCancel:se,canRollback:ce,primaryLabel:j,statusHint:M,prepareUpdate:N,confirmUpdate:le,cancelPreparedUpdate:de,rollbackTo:ue}}var xd={instant:.12,fast:.18,base:.28,slow:.42,calm:.6},Sd={out:`power3.out`,inOut:`power2.inOut`,emphasized:`expo.out`,soft:`back.out(1.2)`,linear:`none`},Cd={tight:.03,base:.045};function wd(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Td(e){return wd()?0:e}var Ed=(0,I.lazy)(()=>It(()=>import(`./SidebarUpdateDialog-Dmu4v5_v.js`).then(e=>({default:e.SidebarUpdateDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7])));function Dd({collapsed:e,onNavigate:t}){let{t:n,lang:r}=ie(),i=sr(),a=Z(),{info:o}=a,[s,c]=(0,I.useState)(!1),l=(0,I.useRef)(null);if(!o)return null;let u=!!o.has_update,d=u?o.next_version||o.release?.tag_name||``:o.current_version,f=u?o.release:o.recent_releases?.find(e=>e.tag_name===o.current_version)??o.release,p=u?n(`sidebarNewVersion`,{version:d}):n(`versionUpdate`);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>c(!0),"aria-label":p,title:e?p:void 0,"data-sidebar-item":!0,className:`flex h-10 w-full items-center gap-3 rounded-[10px] text-nav transition-colors ${e?`mx-auto w-10 justify-center px-0`:`px-3`} ${u?`font-medium text-accent`:`text-muted hover:text-foreground`}`,children:[(0,Y.jsxs)(`span`,{ref:l,className:`relative inline-flex shrink-0 will-change-transform`,children:[(0,Y.jsx)(u?ia:Ma,{size:20,weight:u?`fill`:`regular`}),u&&e?(0,Y.jsx)(`span`,{className:`absolute -right-0.5 -top-0.5 size-1.5 rounded-full bg-accent`}):null]}),!e&&(0,Y.jsx)(`span`,{className:`truncate`,children:p}),!e&&!u&&d?(0,Y.jsx)(`span`,{className:`mono ml-auto text-caption`,children:d}):null]}),u?(0,Y.jsx)(Od,{targetRef:l}):null,s?(0,Y.jsx)(I.Suspense,{fallback:null,children:(0,Y.jsx)(Ed,{open:s,update:a,release:f,version:d,lang:r,labels:{versionUpdate:n(`versionUpdate`),close:n(`close`),releaseNotes:n(`sidebarReleaseNotes`),emptyNotes:n(`updateNoNotes`),goToUpdate:n(`sidebarGoToUpdate`)},onClose:()=>c(!1),onGoToUpdate:()=>{c(!1),t?.(),i(`/system?tab=updates`)}})}):null]})}function Od({targetRef:e}){return(0,I.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=Dt.context(()=>{let e=Dt.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Dt.set(t,{clearProps:`transform`})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Dt.timeline({repeat:-1,repeatDelay:4.5});return e.to(t,{x:3,duration:xd.fast,ease:Sd.inOut}).to(t,{x:-2.5,duration:xd.fast,ease:Sd.inOut}).to(t,{x:1.5,duration:xd.instant,ease:Sd.inOut}).to(t,{x:0,duration:xd.fast,ease:Sd.out}),()=>{e.kill()}})},t);return()=>n.revert()},[e]),null}var kd=`M 91.413 45.646 A 32.000 32.000 0 1 0 91.413 82.354`,Ad=`M 96.889 68.454 A 32.000 32.000 0 0 1 91.413 82.354`;function jd({size:e=24,className:t=``,loading:n=!1}){return(0,Y.jsxs)(`svg`,{width:e,height:e,viewBox:`22 22 84 84`,fill:`none`,"aria-hidden":`true`,className:`brand-mark block shrink-0 text-foreground ${n?`brand-mark--loading`:``} ${t}`.trim(),children:[(0,Y.jsx)(`path`,{className:`brand-mark__rail`,pathLength:100,d:kd,stroke:`currentColor`,strokeWidth:11.4,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,Y.jsx)(`path`,{className:`brand-mark__tip`,pathLength:100,d:Ad,stroke:`#22D3EE`,strokeWidth:11.4,strokeLinecap:`round`,strokeLinejoin:`round`}),n?(0,Y.jsx)(`path`,{className:`brand-mark__scan`,pathLength:100,d:kd,stroke:`#22D3EE`,strokeWidth:11.4,strokeLinecap:`round`,strokeLinejoin:`round`}):null]})}function Q({className:e}){return(0,Y.jsx)(Cu,{className:`rounded-lg ${e}`})}function Md({rows:e=5}){return(0,Y.jsx)(`div`,{className:`divide-y divide-separator`,children:Array.from({length:e},(e,t)=>(0,Y.jsxs)(`div`,{className:`space-y-2 px-4 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(Q,{className:`h-4 w-28`}),(0,Y.jsx)(Q,{className:`h-3 w-12`})]}),(0,Y.jsx)(Q,{className:`h-1.5 w-full`})]},t))})}function $(){return(0,Y.jsx)(Q,{className:`h-56 w-full`})}function Nd({rows:e=6}){return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`divide-y divide-separator lg:hidden`,children:Array.from({length:e},(e,t)=>(0,Y.jsxs)(`div`,{className:`space-y-3 px-4 py-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(Q,{className:`h-4 w-32`}),(0,Y.jsx)(Q,{className:`h-3 w-40`})]}),(0,Y.jsx)(Q,{className:`h-5 w-14`})]}),(0,Y.jsx)(Q,{className:`h-3 w-24`}),(0,Y.jsx)(Q,{className:`h-8 w-40`}),(0,Y.jsx)(Q,{className:`h-8 w-24`})]},`card-${t}`))}),(0,Y.jsxs)(`div`,{className:`hidden lg:block`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-7 gap-4 border-b border-separator px-5 py-4`,children:[(0,Y.jsx)(Q,{className:`h-3 w-20`}),(0,Y.jsx)(Q,{className:`h-3 w-24`}),(0,Y.jsx)(Q,{className:`h-3 w-24`}),(0,Y.jsx)(Q,{className:`h-3 w-20`}),(0,Y.jsx)(Q,{className:`h-3 w-24`}),(0,Y.jsx)(Q,{className:`h-3 w-16`}),(0,Y.jsx)(Q,{className:`h-3 w-16`})]}),Array.from({length:e},(e,t)=>(0,Y.jsxs)(`div`,{className:`grid grid-cols-7 items-center gap-4 border-b border-separator px-5 py-4 last:border-0`,children:[(0,Y.jsx)(Q,{className:`h-5 w-32`}),(0,Y.jsx)(Q,{className:`h-4 w-28`}),(0,Y.jsx)(Q,{className:`h-4 w-20`}),(0,Y.jsx)(Q,{className:`h-4 w-36`}),(0,Y.jsx)(Q,{className:`h-8 w-40`}),(0,Y.jsx)(Q,{className:`h-5 w-14`}),(0,Y.jsx)(Q,{className:`h-8 w-24`})]},`row-${t}`))]})]})}function Pd(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,"aria-label":`Loading overview`,children:[(0,Y.jsxs)(`section`,{className:`flex items-end justify-between gap-4 pb-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Q,{className:`h-8 w-40`}),(0,Y.jsx)(Q,{className:`h-4 w-80 max-w-[70vw]`})]}),(0,Y.jsxs)(`div`,{className:`hidden space-y-2 sm:block`,children:[(0,Y.jsx)(Q,{className:`ml-auto h-8 w-40`}),(0,Y.jsx)(Q,{className:`ml-auto h-4 w-20`})]})]}),(0,Y.jsx)(`section`,{className:`grid overflow-hidden rounded-3xl bg-surface shadow-surface sm:grid-cols-2 xl:grid-cols-4`,children:Array.from({length:4},(e,t)=>(0,Y.jsxs)(`div`,{className:`min-h-32 space-y-5 border-separator p-5 first:border-0 sm:border-l sm:first:border-0`,children:[(0,Y.jsx)(Q,{className:`h-4 w-24`}),(0,Y.jsx)(Q,{className:`h-8 w-28`}),(0,Y.jsx)(Q,{className:`h-3 w-36`})]},t))}),(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-5`,children:[(0,Y.jsx)(Q,{className:`h-5 w-24`}),(0,Y.jsx)(Q,{className:`mt-2 h-3 w-48`}),(0,Y.jsx)(Q,{className:`mt-6 h-56 w-full`}),(0,Y.jsx)(`div`,{className:`mt-5 grid grid-cols-4 gap-3`,children:Array.from({length:4},(e,t)=>(0,Y.jsx)(Q,{className:`h-10 w-full`},t))})]}),(0,Y.jsx)(`section`,{className:`grid gap-5 xl:grid-cols-2`,children:Array.from({length:2},(e,t)=>(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-separator px-5 py-4`,children:[(0,Y.jsx)(Q,{className:`h-5 w-28`}),(0,Y.jsx)(Q,{className:`mt-2 h-3 w-40`})]}),(0,Y.jsx)(Md,{})]},t))}),(0,Y.jsx)(`section`,{className:`grid gap-5 xl:grid-cols-2 2xl:grid-cols-3`,children:Array.from({length:3},(e,t)=>(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`border-b border-separator px-5 py-4`,children:(0,Y.jsx)(Q,{className:`h-5 w-28`})}),(0,Y.jsx)(Md,{rows:4})]},t))})]})}function Fd(){return(0,Y.jsxs)(`article`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:[(0,Y.jsx)(`div`,{className:`space-y-2 px-3 pt-2.5 pb-1.5`,children:(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsx)(Q,{className:`size-8 rounded-xl`}),(0,Y.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Q,{className:`h-4 w-28`}),(0,Y.jsx)(Q,{className:`h-4 w-16`})]}),(0,Y.jsx)(Q,{className:`h-3 w-40`})]})]}),(0,Y.jsx)(Q,{className:`h-5 w-14`})]})}),(0,Y.jsxs)(`div`,{className:`space-y-2 px-3 pb-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[(0,Y.jsx)(Q,{className:`h-3 w-16`}),(0,Y.jsx)(Q,{className:`h-2 flex-1`}),(0,Y.jsx)(Q,{className:`h-3 w-14`})]}),(0,Y.jsxs)(`div`,{className:`space-y-1.5 py-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(Q,{className:`h-3 w-14`}),(0,Y.jsx)(Q,{className:`h-3 w-24`})]}),(0,Y.jsx)(Q,{className:`h-1.5 w-full rounded-[1px]`})]})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-t border-separator px-3 py-2`,children:[(0,Y.jsx)(Q,{className:`h-3 w-20`}),(0,Y.jsx)(Q,{className:`size-7`}),(0,Y.jsx)(Q,{className:`size-7`}),(0,Y.jsx)(Q,{className:`size-7`}),(0,Y.jsx)(Q,{className:`ml-auto h-[18px] w-[74px]`})]})]})}function Id({count:e=5}){return(0,Y.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,"aria-label":`Loading accounts`,children:Array.from({length:e},(e,t)=>(0,Y.jsx)(Fd,{},t))})}function Ld(){return(0,Y.jsxs)(`div`,{className:`space-y-4`,"aria-label":`Loading accounts`,children:[(0,Y.jsxs)(`section`,{className:`flex items-end justify-between gap-4 pb-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-5`,children:[(0,Y.jsx)(Q,{className:`h-4 w-20`}),(0,Y.jsx)(Q,{className:`h-4 w-24`}),(0,Y.jsx)(Q,{className:`h-4 w-24`}),(0,Y.jsx)(Q,{className:`h-4 w-20`})]}),(0,Y.jsx)(Q,{className:`h-8 w-28`})]}),(0,Y.jsxs)(`section`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsx)(Q,{className:`h-8 w-full max-w-md`}),(0,Y.jsx)(Q,{className:`h-8 w-72`})]}),(0,Y.jsx)(Id,{})]})}function Rd(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,"aria-label":`Loading models`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-5 pb-6 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Q,{className:`h-3 w-24`}),(0,Y.jsx)(Q,{className:`h-8 w-44`}),(0,Y.jsx)(Q,{className:`h-4 w-56`})]}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 sm:flex-row`,children:[(0,Y.jsx)(Q,{className:`h-8 w-full sm:w-56`}),(0,Y.jsx)(Q,{className:`h-8 w-24`})]})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:(0,Y.jsx)(Nd,{})})]})}function zd(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,"aria-label":`Loading API keys`,children:[(0,Y.jsxs)(`section`,{className:`flex items-end justify-between gap-4 pb-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Q,{className:`h-8 w-40`}),(0,Y.jsx)(Q,{className:`h-4 w-80 max-w-[70vw]`})]}),(0,Y.jsx)(Q,{className:`h-8 w-28`})]}),(0,Y.jsx)(`section`,{className:`grid gap-2.5 lg:grid-cols-2 xl:grid-cols-3`,children:Array.from({length:3},(e,t)=>(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-3`,children:[(0,Y.jsx)(Q,{className:`h-4 w-28`}),(0,Y.jsx)(Q,{className:`mt-2 h-3 w-40`}),(0,Y.jsx)(Q,{className:`mt-4 h-6 w-24`}),(0,Y.jsx)(Q,{className:`mt-6 h-8 w-full`})]},t))})]})}function Bd(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,"aria-label":`Loading access settings`,children:[(0,Y.jsxs)(`section`,{className:`grid gap-5 pb-6 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Q,{className:`h-3 w-32`}),(0,Y.jsx)(Q,{className:`h-8 w-44`}),(0,Y.jsx)(Q,{className:`h-4 w-80 max-w-[70vw]`})]}),(0,Y.jsx)(Q,{className:`h-7 w-24`})]}),(0,Y.jsxs)(`section`,{className:`grid overflow-hidden rounded-3xl bg-surface shadow-surface sm:grid-cols-3`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3 border-b border-separator p-5 sm:col-span-2 sm:border-r sm:border-b-0`,children:[(0,Y.jsx)(Q,{className:`h-3 w-20`}),(0,Y.jsx)(Q,{className:`h-4 w-72 max-w-full`})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 p-5 sm:grid-cols-1`,children:[(0,Y.jsx)(Q,{className:`h-4 w-24`}),(0,Y.jsx)(Q,{className:`h-4 w-28`})]})]}),(0,Y.jsxs)(`section`,{className:`grid min-h-[620px] overflow-hidden rounded-3xl bg-surface shadow-surface xl:grid-cols-[minmax(440px,.92fr)_minmax(0,1.08fr)]`,children:[(0,Y.jsxs)(`div`,{className:`space-y-6 border-b border-separator p-7 xl:border-r xl:border-b-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(Q,{className:`size-9`}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(Q,{className:`h-4 w-32`}),(0,Y.jsx)(Q,{className:`h-3 w-28`})]})]}),(0,Y.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(Q,{className:`h-4 w-16`}),(0,Y.jsx)(Q,{className:`h-10 w-full`})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(Q,{className:`h-4 w-16`}),(0,Y.jsx)(Q,{className:`h-10 w-full`})]})]}),(0,Y.jsx)(Q,{className:`h-56 w-full`}),(0,Y.jsx)(Q,{className:`h-12 w-full`})]}),(0,Y.jsxs)(`div`,{className:`space-y-4 bg-surface-secondary p-6`,children:[(0,Y.jsxs)(`div`,{className:`flex justify-between`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(Q,{className:`h-4 w-32`}),(0,Y.jsx)(Q,{className:`h-3 w-44`})]}),(0,Y.jsx)(Q,{className:`h-6 w-20`})]}),(0,Y.jsx)(Q,{className:`mt-10 h-3 w-32`}),(0,Y.jsx)(Q,{className:`h-3 w-full`}),(0,Y.jsx)(Q,{className:`h-3 w-[86%]`})]})]}),(0,Y.jsxs)(`section`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-5`,children:[(0,Y.jsx)(Q,{className:`h-4 w-36`}),(0,Y.jsx)(Q,{className:`mt-5 h-24 w-full`})]})]})}function Vd(){return(0,Y.jsxs)(`div`,{"aria-label":`Loading logs`,children:[(0,Y.jsx)(`div`,{className:`hidden grid-cols-10 gap-4 border-b border-separator px-5 py-3 md:grid`,children:Array.from({length:10},(e,t)=>(0,Y.jsx)(Q,{className:`h-3 w-16`},t))}),Array.from({length:8},(e,t)=>(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 items-center gap-4 border-b border-separator px-5 py-3.5 last:border-0 md:grid-cols-10`,children:[(0,Y.jsx)(Q,{className:`h-4 w-28`}),(0,Y.jsx)(Q,{className:`h-4 w-24`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-20 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-16 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-16 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-16 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-14 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-12 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-12 md:block`}),(0,Y.jsx)(Q,{className:`hidden h-4 w-16 md:block`})]},t))]})}function Hd(){return(0,Y.jsx)(`div`,{className:`divide-y divide-separator`,"aria-label":`Loading logs`,children:Array.from({length:8},(e,t)=>(0,Y.jsxs)(`div`,{className:`grid gap-2 px-5 py-3 sm:grid-cols-[150px_72px_minmax(0,1fr)] sm:items-center`,children:[(0,Y.jsx)(Q,{className:`h-3 w-24`}),(0,Y.jsx)(Q,{className:`h-3 w-12`}),(0,Y.jsx)(Q,{className:`h-4 w-full`})]},t))})}function Ud(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,"aria-label":`Loading logs`,children:[(0,Y.jsxs)(`section`,{className:`flex items-end justify-between gap-4 pb-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Q,{className:`h-8 w-28`}),(0,Y.jsx)(Q,{className:`h-4 w-72 max-w-[70vw]`})]}),(0,Y.jsx)(Q,{className:`h-8 w-24`})]}),(0,Y.jsx)(Q,{className:`h-9 w-full max-w-md`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(Q,{className:`h-8 w-72`}),(0,Y.jsx)(Q,{className:`h-8 w-56`})]}),(0,Y.jsx)(Q,{className:`h-4 w-20`})]}),(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface`,children:(0,Y.jsx)(Vd,{})})]})}function Wd(){return(0,Y.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1.18fr)_minmax(360px,.82fr)]`,children:[(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-5`,children:[(0,Y.jsx)(Q,{className:`h-5 w-28`}),(0,Y.jsx)(Q,{className:`mt-2 h-3 w-48`}),(0,Y.jsx)(Q,{className:`mt-6 h-24 w-full`}),(0,Y.jsx)(Q,{className:`mt-5 h-48 w-full`})]}),(0,Y.jsxs)(`div`,{className:`space-y-5`,children:[(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-5`,children:[(0,Y.jsx)(Q,{className:`h-5 w-32`}),(0,Y.jsx)(Q,{className:`mt-4 h-10 w-full`}),(0,Y.jsx)(Q,{className:`mt-3 h-3 w-40`})]}),(0,Y.jsxs)(`div`,{className:`overflow-hidden rounded-3xl bg-surface shadow-surface p-5`,children:[(0,Y.jsx)(Q,{className:`h-5 w-28`}),(0,Y.jsx)(Q,{className:`mt-4 h-10 w-full`})]})]})]})}function Gd(){return(0,Y.jsxs)(`div`,{className:`space-y-6`,"aria-label":`Loading system`,children:[(0,Y.jsxs)(`section`,{className:`flex items-end justify-between gap-4 pb-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Q,{className:`h-8 w-40`}),(0,Y.jsx)(Q,{className:`h-4 w-80 max-w-[70vw]`})]}),(0,Y.jsx)(Q,{className:`h-8 w-28`})]}),(0,Y.jsx)(Wd,{})]})}function Kd(e,t){(0,I.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=Dt.context(()=>{let e=Dt.matchMedia();e.add(`(prefers-reduced-motion: reduce)`,()=>{Dt.set(`[data-gsap-reveal]`,{clearProps:`all`})}),e.add(`(prefers-reduced-motion: no-preference)`,()=>{let e=Dt.utils.toArray(`[data-gsap-reveal]`);e.length&&Dt.from(e,{autoAlpha:0,y:10,duration:.42,ease:`power3.out`,stagger:.045,clearProps:`all`})})},t);return()=>n.revert()},[e,t])}function qd(e){window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||Dt.fromTo(e,{scale:.975},{scale:1,duration:.18,ease:`power2.out`,overwrite:!0})}function Jd(){let{overview:e,loading:t}=td();return{enabled:!!e?.proxy?.cross_provider_model_pool,loading:t}}var Yd=[{to:`/`,key:`navOverview`,icon:ga,section:`workspace`,end:!0},{to:`/usage`,key:`navUsage`,icon:ua,section:`workspace`},{to:`/accounts`,key:`navAccounts`,icon:Wa,section:`workspace`},{to:`/providers`,key:`navProviders`,icon:ma,section:`develop`},{to:`/model-pool`,key:`navModelPool`,icon:ca,section:`develop`,requiresPool:!0},{to:`/access`,key:`navAccess`,icon:Ea,section:`develop`},{to:`/logs`,key:`navLogs`,icon:Pa,section:`system`},{to:`/keys`,key:`navKeys`,icon:wa,section:`system`},{to:`/system`,key:`navSystem`,icon:va,section:`system`}],Xd=`cli2api:sidebar-collapsed`;function Zd({collapsed:e,onNavigate:t}){let{t:n}=ie(),{enabled:r,loading:i}=Jd(),a=[{key:`workspace`,label:n(`workspace`)},{key:`develop`,label:n(`develop`)},{key:`system`,label:n(`system`)}],o=Yd.filter(e=>!(`requiresPool`in e)||!e.requiresPool||!i&&r);return(0,Y.jsx)(`nav`,{className:`flex flex-col gap-6`,children:a.map(r=>(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e?(0,Y.jsx)(xu,{className:`mx-auto mb-1.5 w-6 opacity-60`}):(0,Y.jsx)(`span`,{className:`px-3 pb-1.5 text-caption font-medium text-muted`,children:r.label}),o.filter(e=>e.section===r.key).map(r=>{let i=r.icon;return(0,Y.jsx)(Ti,{to:r.to,end:`end`in r&&r.end,onClick:t,"aria-label":n(r.key),title:e?n(r.key):void 0,"data-sidebar-item":!0,className:({isActive:t})=>`group/navitem relative flex h-10 items-center gap-3 rounded-[10px] text-nav transition-colors will-change-transform ${e?`mx-auto w-10 justify-center px-0`:`px-3`} ${t?`sidebar-item-active font-medium text-foreground`:`font-normal text-muted hover:text-foreground`}`,onMouseDown:e=>qd(e.currentTarget),children:({isActive:t})=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`inline-flex shrink-0`,"data-nav-icon":!0,children:(0,Y.jsx)(i,{size:20,weight:t?`fill`:`regular`})}),!e&&(0,Y.jsx)(`span`,{className:`truncate`,"data-nav-label":!0,children:n(r.key)}),e&&(0,Y.jsx)(`span`,{className:`pointer-events-none absolute left-full z-50 ml-2 invisible whitespace-nowrap rounded-lg bg-foreground px-2 py-1 text-caption font-medium text-background opacity-0 shadow-overlay transition-opacity duration-150 group-hover/navitem:visible group-hover/navitem:opacity-100`,children:n(r.key)})]})},r.to)})]},r.key))})}function Qd({compact:e=!1}){let{t}=ie();return(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 ${e?`justify-center`:`px-1.5`}`,children:[(0,Y.jsx)(jd,{size:36}),!e&&(0,Y.jsxs)(`div`,{className:`min-w-0 leading-tight`,children:[(0,Y.jsx)(`div`,{className:`text-section font-semibold tracking-tight`,children:`CLI2API`}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-caption text-muted`,children:t(`controlPlane`)})]})]})}function $d({label:e}){return(0,Y.jsxs)(`div`,{className:`rounded-xl bg-surface shadow-surface p-3`,"aria-busy":`true`,"aria-label":e,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Q,{className:`size-2`}),(0,Y.jsx)(Q,{className:`h-4 w-12`})]}),(0,Y.jsx)(Q,{className:`h-5 w-10`})]}),(0,Y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3 pt-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(Q,{className:`h-3 w-10`}),(0,Y.jsx)(Q,{className:`mt-1.5 h-4 w-12`})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(Q,{className:`h-3 w-8`}),(0,Y.jsx)(Q,{className:`mt-1.5 h-4 w-10`})]})]})]})}function ef({initial:e,collapsed:t}){let{t:n}=ie(),r=e,i=n(`sidebarInFlight`,{count:r});return(0,Y.jsxs)(Qu,{delay:200,children:[(0,Y.jsx)(Qu.Trigger,{children:(0,Y.jsxs)(`span`,{role:`status`,"aria-label":i,className:`inline-flex h-8 items-center gap-2 rounded-lg text-caption text-muted ${t?`w-10 justify-center`:`px-3`}`,children:[(0,Y.jsx)(`span`,{className:`status-dot`,"data-state":r>0?`ok`:void 0}),(0,Y.jsx)(`span`,{className:`mono tabular text-foreground`,children:r})]})}),(0,Y.jsx)(Qu.Content,{children:i})]})}function tf({mobileOpen:e,onClose:t}){let{t:n}=ie(),{overview:r,loading:i}=td(),[a,o]=(0,I.useState)(()=>localStorage.getItem(Xd)===`1`),s=!!r?.proxy?.ok,c=!!r?.worker?.ok,l=s&&c,u=r?.worker?.account_count??0,d=r?.worker?.hot_count??0,f=i;function p(){o(e=>{let t=!e;return localStorage.setItem(Xd,t?`1`:`0`),t})}let m=(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,className:`text-muted`,onPress:p,"aria-label":n(`toggleSidebar`),children:(0,Y.jsx)(Ia,{size:18,className:a?`rotate-180`:``})}),h=(0,Y.jsxs)(`div`,{className:`mt-auto shrink-0 space-y-2 pt-6`,children:[!a&&(f?(0,Y.jsx)($d,{label:n(`refreshing`)}):(0,Y.jsxs)(`div`,{className:`sidebar-status rounded-xl px-3.5 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-nav font-medium`,children:[(0,Y.jsx)(`span`,{className:`status-dot`,"data-state":l?`ok`:`danger`}),n(l?`running`:`degraded`)]}),(0,Y.jsxs)(nu,{size:`sm`,variant:`soft`,color:l?`success`:`warning`,children:[d,`/`,u]})]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5 text-caption text-muted`,children:[(0,Y.jsx)(`span`,{children:`Proxy`}),(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:s?`online`:`down`}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`span`,{children:n(`accountCount`)}),(0,Y.jsxs)(`span`,{className:`mono font-medium text-foreground`,children:[d,`/`,u]})]})]})),a?(0,Y.jsx)(`div`,{className:`flex justify-center`,children:(0,Y.jsxs)(Qu,{children:[(0,Y.jsx)(Qu.Trigger,{children:(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,"aria-label":n(`runtimeSnapshot`),children:f?(0,Y.jsx)(Q,{className:`size-2`}):(0,Y.jsx)(`span`,{className:`status-dot`,"data-state":l?`ok`:`danger`})})}),(0,Y.jsx)(Qu.Content,{children:n(f?`refreshing`:l?`running`:`degraded`)})]})}):null,(0,Y.jsx)(Dd,{collapsed:a}),(0,Y.jsxs)(`div`,{className:`flex items-center ${a?`flex-col gap-1`:`justify-between gap-2`}`,children:[(0,Y.jsx)(ef,{initial:r?.worker?.in_flight??0,collapsed:a}),!a&&(0,Y.jsx)(`p`,{className:`min-w-0 truncate pr-3 text-caption text-muted`,title:n(`sidebarFoot`),children:n(`sidebarFoot`)})]})]});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`aside`,{className:`hidden h-dvh shrink-0 flex-col bg-surface-secondary text-foreground transition-[width] duration-300 ease-out md:flex ${a?`w-[76px] px-2.5 py-5`:`w-[260px] px-4 py-5`}`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 ${a?`flex-col items-center gap-3`:`h-12 items-center justify-between gap-2`}`,children:[(0,Y.jsx)(Qd,{compact:a}),m]}),(0,Y.jsx)(`div`,{className:`${a?`mt-5`:`mt-7`} min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Y.jsx)(Zd,{collapsed:a})}),h]}),(0,Y.jsx)(yu,{isOpen:e,onOpenChange:e=>{e||t()},children:(0,Y.jsx)(yu.Content,{placement:`left`,children:(0,Y.jsxs)(yu.Dialog,{className:`w-72 bg-surface-secondary px-4 py-5 text-foreground`,children:[(0,Y.jsxs)(`div`,{className:`flex h-12 items-center justify-between`,children:[(0,Y.jsx)(Qd,{}),(0,Y.jsx)(A,{isIconOnly:!0,size:`sm`,variant:`ghost`,onPress:t,"aria-label":n(`close`),children:(0,Y.jsx)(Ja,{size:16})})]}),(0,Y.jsx)(yu.Body,{className:`mt-5 px-0`,children:(0,Y.jsx)(Zd,{collapsed:!1,onNavigate:t})})]})})})]})}function nf(){return(0,Y.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(Q,{className:`h-8 w-52 max-w-full`}),(0,Y.jsx)(Q,{className:`h-4 w-80 max-w-full`})]}),(0,Y.jsx)(`div`,{className:`grid gap-2.5 md:grid-cols-2 xl:grid-cols-3`,children:Array.from({length:6},(e,t)=>(0,Y.jsx)(Q,{className:`h-28`},t))})]})}var rf={loading:1/0,success:3200,error:6e3,info:4e3},af=4,of=[],sf=0,cf=new Set,lf=new Map;function uf(){for(let e of cf)e()}function df(e){return cf.add(e),()=>{cf.delete(e)}}function ff(){return of}function pf(e){let t=lf.get(e);t&&window.clearTimeout(t),lf.delete(e),of.some(t=>t.id===e&&!t.leaving)&&(of=of.map(t=>t.id===e?{...t,leaving:!0}:t),uf())}function mf(e){of=of.filter(t=>t.id!==e),uf()}function hf(e){let t=e.id??`toast-${++sf}`,n=e.type??`info`,r=of.find(e=>e.id===t),i={id:t,type:n,title:e.title,description:e.description,version:(r?.version??0)+1,leaving:!1};of=r?of.map(e=>e.id===t?i:e):[...of,i];let a=of.filter(e=>!e.leaving);a.length>af&&pf(a[0].id);let o=lf.get(t);o&&window.clearTimeout(o),lf.delete(t);let s=e.duration??rf[n];return Number.isFinite(s)&&lf.set(t,window.setTimeout(()=>pf(t),s)),uf(),t}var gf={loading:(0,Y.jsx)(Ba,{size:16,className:`animate-spin text-muted motion-reduce:animate-none`}),success:(0,Y.jsx)(fa,{size:16,weight:`fill`,className:`text-success`}),error:(0,Y.jsx)(Ka,{size:16,weight:`fill`,className:`text-danger`}),info:(0,Y.jsx)(Sa,{size:16,weight:`fill`,className:`text-accent`})};function _f({item:e}){let t=(0,I.useRef)(null),n=(0,I.useRef)(null),r=(0,I.useRef)(e.version);return(0,I.useLayoutEffect)(()=>{let e=t.current;if(!e||wd())return;let n=Dt.from(e,{autoAlpha:0,y:16,scale:.96,duration:xd.slow,ease:Sd.out,clearProps:`transform,opacity,visibility`});return()=>{n.kill()}},[]),(0,I.useLayoutEffect)(()=>{let t=n.current;if(!t||e.version===r.current||wd())return;let i=Dt.fromTo(t,{autoAlpha:0,y:4},{autoAlpha:1,y:0,duration:xd.base,ease:Sd.out});return()=>{i.kill()}},[e.version]),(0,I.useLayoutEffect)(()=>{let n=t.current;if(!e.leaving||!n)return;if(wd()){mf(e.id);return}let r=Dt.to(n,{autoAlpha:0,x:24,height:0,marginTop:0,paddingTop:0,paddingBottom:0,duration:xd.base,ease:Sd.inOut,onComplete:()=>mf(e.id)});return()=>{r.kill()}},[e.leaving,e.id]),(0,Y.jsxs)(`div`,{ref:t,role:e.type===`error`?`alert`:`status`,className:`pointer-events-auto mt-2 flex w-full items-start gap-2.5 overflow-hidden rounded-xl bg-overlay px-3.5 py-3 text-body text-foreground shadow-overlay`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 inline-flex shrink-0`,children:gf[e.type]}),(0,Y.jsxs)(`div`,{ref:n,className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`font-medium leading-5`,children:e.title}),e.description?(0,Y.jsx)(`div`,{className:`mt-0.5 break-words text-caption leading-5 text-muted`,children:e.description}):null]}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Close`,onClick:()=>pf(e.id),className:`grid size-6 shrink-0 place-items-center rounded-md text-muted transition-colors hover:bg-surface-secondary hover:text-foreground`,children:(0,Y.jsx)(Ja,{size:12})})]})}function vf(){let e=(0,I.useSyncExternalStore)(df,ff,ff);return(0,Y.jsx)(`div`,{"aria-live":`polite`,className:`pointer-events-none fixed bottom-4 right-4 z-[100] flex w-[min(360px,calc(100vw-2rem))] flex-col`,children:e.map(e=>(0,Y.jsx)(_f,{item:e},e.id))})}var yf={"/":`home`,"/auth":`auth`,"/providers":`providers`,"/model-pool":`modelPool`,"/access":`access`,"/accounts":`accounts`,"/usage":`usage`,"/logs":`logs`,"/keys":`keys`,"/system":`system`};function bf(){let[e,t]=(0,I.useState)(!1),n=(0,I.useCallback)(()=>t(!1),[]),r=ir(),{page:i}=ie(),a=i(r.pathname===`/model-pool`||r.pathname.startsWith(`/model-pool/`)?`modelPool`:yf[r.pathname]||`home`),o=r.pathname.startsWith(`/model-pool/`);return(0,Y.jsxs)(`div`,{className:`relative flex h-dvh overflow-hidden bg-background text-foreground`,children:[(0,Y.jsxs)(`div`,{className:`relative z-10 flex min-h-0 min-w-0 flex-1`,children:[(0,Y.jsx)(tf,{mobileOpen:e,onClose:n}),(0,Y.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Y.jsx)(cd,{title:a.title,desc:a.desc,wide:o,onMenu:()=>t(!0)}),(0,Y.jsx)(`main`,{className:o?`min-h-0 flex-1 overflow-y-auto xl:overflow-hidden`:`min-h-0 flex-1 overflow-y-auto`,children:(0,Y.jsx)(`div`,{className:o?`flex w-full flex-col px-3 pb-6 sm:px-4 lg:px-5 xl:h-full xl:min-h-0 xl:overflow-hidden xl:pb-3`:`mx-auto w-full max-w-[1480px] px-4 pb-12 pt-5 sm:px-6 lg:px-8 lg:pb-16 lg:pt-6`,children:(0,Y.jsx)(I.Suspense,{fallback:(0,Y.jsx)(nf,{}),children:(0,Y.jsx)(`div`,{className:o?`flex min-h-0 flex-1 flex-col`:void 0,children:(0,Y.jsx)(Pr,{})},r.pathname)})})})]})]}),(0,Y.jsx)(vf,{})]})}function xf(){let{overview:e,error:t}=td(),{apiKey:n}=xt(),r=ir();return!n||!e&&wt(t)?(0,Y.jsx)(Nr,{to:`/login`,replace:!0,state:{from:r.pathname}}):(0,Y.jsx)(Pr,{})}var Sf=(0,I.lazy)(()=>It(()=>import(`./LoginPage-D55m1Iq6.js`).then(e=>({default:e.LoginPage})),__vite__mapDeps([8,1,9,10,2,3,11,12,13,14,15,16,17,18,19,20,4,21,22,23,24,25]))),Cf=(0,I.lazy)(()=>It(()=>import(`./OverviewPage-DuUzTTx-.js`).then(e=>({default:e.OverviewPage})),__vite__mapDeps([26,1,9,10,2,3,11,12,13,14,15,16,17,18,19,20,27,28,23,29,30,4,31,32,33,34,35,36]))),wf=(0,I.lazy)(()=>It(()=>import(`./ProvidersPage-BvznkMq_.js`).then(e=>({default:e.ProvidersPage})),__vite__mapDeps([37,1,11,2,3,38,39,17,23,24,31,4,16,40,41,42,43,22,44,5,6,45,29,18,46,28,47,48,19,49,32,20,34,50,51,52,53,30]))),Tf=(0,I.lazy)(()=>It(()=>import(`./ModelPoolPage-lIQOHGTF.js`).then(e=>({default:e.ModelPoolPage})),__vite__mapDeps([54,1,10,2,3,13,55,4,56,6,16,17,42,18,46,28,47,41,48,57,19]))),Ef=(0,I.lazy)(()=>It(()=>import(`./ModelPoolEditorPage-BvCs5yNq.js`).then(e=>({default:e.ModelPoolEditorPage})),__vite__mapDeps([58,1,12,2,3,13,14,55,15,17,4,16,40,41,43,22,23,24,44,21,45,29,39,18,19,25,20,34,51,52,47,53,30,57]))),Df=(0,I.lazy)(()=>It(()=>import(`./AccessPage-D_rNpM5b.js`).then(e=>({default:e.AccessPage})),__vite__mapDeps([59,1,60,12,2,3,61,22,17,23,24,32,11,13,4,42,52,47,44,62,48,53,30,31,19,36,20,34,63]))),Of=(0,I.lazy)(()=>It(()=>import(`./AccountsPage-P5RZ6rmI.js`).then(e=>({default:e.AccountsPage})),__vite__mapDeps([64,1,60,12,2,3,61,22,17,23,24,32,11,38,39,31,13,65,55,4,56,6,16,66,44,42,43,52,47,5,45,29,53,30,18,19,25,49,36,20,34,67,50]))),kf=(0,I.lazy)(()=>It(()=>import(`./SystemPage-Cofpx5Eq.js`).then(e=>({default:e.SystemPage})),__vite__mapDeps([68,1,61,2,3,65,17,69,30,4,56,6,16,66,44,43,22,23,24,52,47,5,62,48,53,18,19,7,50,70]))),Af=(0,I.lazy)(()=>It(()=>import(`./LogsPage-AzM3SIPE.js`).then(e=>({default:e.LogsPage})),__vite__mapDeps([71,1,38,2,3,39,17,23,24,31,55,27,28,29,30,19,4,56,6,72,52,47,44,70,16,42,5,62,48,46,41,36,32,34,63,51,53]))),jf=(0,I.lazy)(()=>It(()=>import(`./UsagePage-CnGXwRBw.js`).then(e=>({default:e.UsagePage})),__vite__mapDeps([73,1,14,2,3,27,28,17,23,29,30,19,69,4,72,52,47,44,39,24,70,16,42,62,48,46,41,31,36,32,20,34,67,35]))),Mf=(0,I.lazy)(()=>It(()=>import(`./KeysPage-spcjl-Xu.js`).then(e=>({default:e.KeysPage})),__vite__mapDeps([74,1,61,2,3,13,55,17,4,16,40,41,66,44,42,43,22,23,24,5,6,45,29,18,19,49,32,20,34,50,70])));function Nf(){return(0,Y.jsx)(ad,{children:(0,Y.jsx)(j,{children:(0,Y.jsx)(Tt,{children:(0,Y.jsx)(ed,{children:(0,Y.jsx)(Ci,{children:(0,Y.jsx)(I.Suspense,{fallback:(0,Y.jsx)(nf,{}),children:(0,Y.jsxs)(Lr,{children:[(0,Y.jsx)(Fr,{path:`/login`,element:(0,Y.jsx)(Sf,{})}),(0,Y.jsx)(Fr,{element:(0,Y.jsx)(xf,{}),children:(0,Y.jsxs)(Fr,{element:(0,Y.jsx)(bf,{}),children:[(0,Y.jsx)(Fr,{path:`/`,element:(0,Y.jsx)(Cf,{})}),(0,Y.jsx)(Fr,{path:`/auth`,element:(0,Y.jsx)(Nr,{to:`/accounts`,replace:!0})}),(0,Y.jsx)(Fr,{path:`/providers`,element:(0,Y.jsx)(wf,{})}),(0,Y.jsx)(Fr,{path:`/model-pool`,element:(0,Y.jsx)(Tf,{})}),(0,Y.jsx)(Fr,{path:`/model-pool/new`,element:(0,Y.jsx)(Ef,{})}),(0,Y.jsx)(Fr,{path:`/model-pool/*`,element:(0,Y.jsx)(Ef,{})}),(0,Y.jsx)(Fr,{path:`/access`,element:(0,Y.jsx)(Df,{})}),(0,Y.jsx)(Fr,{path:`/accounts`,element:(0,Y.jsx)(Of,{})}),(0,Y.jsx)(Fr,{path:`/checkins`,element:(0,Y.jsx)(Nr,{to:`/accounts`,replace:!0})}),(0,Y.jsx)(Fr,{path:`/usage`,element:(0,Y.jsx)(jf,{})}),(0,Y.jsx)(Fr,{path:`/logs`,element:(0,Y.jsx)(Af,{})}),(0,Y.jsx)(Fr,{path:`/keys`,element:(0,Y.jsx)(Mf,{})}),(0,Y.jsx)(Fr,{path:`/system`,element:(0,Y.jsx)(kf,{})}),(0,Y.jsx)(Fr,{path:`*`,element:(0,Y.jsx)(Nr,{to:`/`,replace:!0})})]})})]})})})})})})})}(0,Mt.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(I.StrictMode,{children:(0,Y.jsx)(Nf,{})}));export{ll as $,It as $t,Du as A,Wa as At,K as B,va as Bt,Z as C,V as Ct,od as D,Xa as Dt,dd as E,Za as Et,Ql as F,Aa as Ft,Ll as G,oa as Gt,Rl as H,fa as Ht,Zl as I,Ea as It,Ml as J,Nr as Jt,wl as K,ia as Kt,Jl as L,wa as Lt,xu as M,Ba as Mt,nu as N,Ia as Nt,td as O,Ja as Ot,Xl as P,Pa as Pt,ml as Q,Ai as Qt,Gl as R,Sa as Rt,Cd as S,mo as St,ud as T,io as Tt,zl as U,ua as Ut,J as V,ma as Vt,Il as W,ca as Wt,Dl as X,sr as Xt,Ol as Y,ir as Yt,gl as Z,dr as Zt,jd as _,Ps as _t,Ld as a,Vc as at,Td as b,Ds as bt,Vd as c,Lc as ct,Rd as d,Nc as dt,Zc as et,Nd as f,Tc as ft,$ as g,Ns as gt,Gd as h,Fs as ht,Bd as i,Gc as it,Cu as j,Ha as jt,Qu as k,Ka as kt,Hd as l,Ic as lt,Q as m,Ls as mt,Jd as n,Kc as nt,zd as o,H as ot,Md as p,Rs as pt,Pl as q,wi as qt,Kd as r,qc as rt,Ud as s,zc as st,hf as t,Wc as tt,Pd as u,Fc as ut,xd as v,As as vt,gd as w,oo as wt,wd as x,Ts as xt,Sd as y,ks as yt,Wl as z,ba as zt}; \ No newline at end of file diff --git a/internal/webui/static/assets/input-CYN6ajmO.js b/internal/webui/static/assets/input-BwBv1RBO.js similarity index 83% rename from internal/webui/static/assets/input-CYN6ajmO.js rename to internal/webui/static/assets/input-BwBv1RBO.js index c270e92b5..e033afbbe 100644 --- a/internal/webui/static/assets/input-CYN6ajmO.js +++ b/internal/webui/static/assets/input-BwBv1RBO.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{c as r,z as i}from"./SharedElementTransition-BlCsXfb1.js";import{t as a}from"./textfield-BGZ3lXZC.js";import{n as o}from"./Input-CyXcxaPW.js";import{t as s}from"./collection-prop-injection-Csmjb87v.js";var c=i({base:`input`,defaultVariants:{fullWidth:!1,variant:`primary`},variants:{fullWidth:{false:``,true:`input--full-width`},variant:{primary:`input--primary`,secondary:`input--secondary`}}}),l=t(e(),1),u=n(),d=(0,l.createContext)({});s(`combo-box.inputGroup`);var f=({className:e,fullWidth:t,variant:n,...i})=>{let s=(0,l.use)(a),f=(0,l.use)(d),p=n??s.variant??f.variant;return(0,u.jsx)(o,{className:r(e,c({fullWidth:t,variant:p})),"data-slot":`input`,...i})},p=Object.assign(f,{Root:f});export{p as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{c as r,z as i}from"./SharedElementTransition-BlCsXfb1.js";import{t as a}from"./textfield-BRcQ6Tsg.js";import{n as o}from"./Input-C__Dw9HK.js";import{t as s}from"./collection-prop-injection-B6_r67VF.js";var c=i({base:`input`,defaultVariants:{fullWidth:!1,variant:`primary`},variants:{fullWidth:{false:``,true:`input--full-width`},variant:{primary:`input--primary`,secondary:`input--secondary`}}}),l=t(e(),1),u=n(),d=(0,l.createContext)({});s(`combo-box.inputGroup`);var f=({className:e,fullWidth:t,variant:n,...i})=>{let s=(0,l.use)(a),f=(0,l.use)(d),p=n??s.variant??f.variant;return(0,u.jsx)(o,{className:r(e,c({fullWidth:t,variant:p})),"data-slot":`input`,...i})},p=Object.assign(f,{Root:f});export{p as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/input-group-CQ3ozQVp.js b/internal/webui/static/assets/input-group-DuDWER0-.js similarity index 92% rename from internal/webui/static/assets/input-group-CQ3ozQVp.js rename to internal/webui/static/assets/input-group-DuDWER0-.js index 465d458e9..f3f67a578 100644 --- a/internal/webui/static/assets/input-group-CQ3ozQVp.js +++ b/internal/webui/static/assets/input-group-DuDWER0-.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{c as r,s as i,z as a}from"./SharedElementTransition-BlCsXfb1.js";import{r as o,t as s}from"./textfield-BGZ3lXZC.js";import{i as c,n as l}from"./Input-CyXcxaPW.js";var u=a({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`input-group`,input:`input-group__input`,prefix:`input-group__prefix`,suffix:`input-group__suffix`},variants:{fullWidth:{false:{},true:{base:`input-group--full-width`}},variant:{primary:{base:`input-group--primary`},secondary:{base:`input-group--secondary`}}}}),d=t(e(),1),f=n(),p=(0,d.createContext)({}),m=({children:e,className:t,fullWidth:n,onClick:i,variant:a,...o})=>{let l=(0,d.use)(s),m=a??l?.variant,h=d.useRef(null),g=d.useMemo(()=>u({fullWidth:n,variant:m}),[n,m]),_=e=>{let t=e.target,n=h.current?.querySelector(`input`);n&&t!==n&&!n.contains(t)&&n.focus(),i?.(e)};return(0,f.jsx)(p,{value:{slots:g},children:(0,f.jsx)(c,{...o,ref:h,className:r(t,g?.base()),"data-slot":`input-group`,onClick:_,children:t=>typeof e==`function`?e(t):e})})},h=Object.assign(m,{Root:m,Input:({className:e,...t})=>{let{slots:n}=(0,d.use)(p);return(0,f.jsx)(l,{className:r(e,n?.input()),"data-slot":`input-group-input`,...t})},TextArea:({className:e,...t})=>{let{slots:n}=(0,d.use)(p);return(0,f.jsx)(o,{className:r(e,n?.input()),"data-slot":`input-group-textarea`,...t})},Prefix:({children:e,className:t,...n})=>{let{slots:r}=(0,d.use)(p);return(0,f.jsx)(`div`,{className:i(r?.prefix,t),"data-slot":`input-group-prefix`,...n,children:e})},Suffix:({children:e,className:t,...n})=>{let{slots:r}=(0,d.use)(p);return(0,f.jsx)(`div`,{className:i(r?.suffix,t),"data-slot":`input-group-suffix`,...n,children:e})}});export{h as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{c as r,s as i,z as a}from"./SharedElementTransition-BlCsXfb1.js";import{r as o,t as s}from"./textfield-BRcQ6Tsg.js";import{i as c,n as l}from"./Input-C__Dw9HK.js";var u=a({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`input-group`,input:`input-group__input`,prefix:`input-group__prefix`,suffix:`input-group__suffix`},variants:{fullWidth:{false:{},true:{base:`input-group--full-width`}},variant:{primary:{base:`input-group--primary`},secondary:{base:`input-group--secondary`}}}}),d=t(e(),1),f=n(),p=(0,d.createContext)({}),m=({children:e,className:t,fullWidth:n,onClick:i,variant:a,...o})=>{let l=(0,d.use)(s),m=a??l?.variant,h=d.useRef(null),g=d.useMemo(()=>u({fullWidth:n,variant:m}),[n,m]),_=e=>{let t=e.target,n=h.current?.querySelector(`input`);n&&t!==n&&!n.contains(t)&&n.focus(),i?.(e)};return(0,f.jsx)(p,{value:{slots:g},children:(0,f.jsx)(c,{...o,ref:h,className:r(t,g?.base()),"data-slot":`input-group`,onClick:_,children:t=>typeof e==`function`?e(t):e})})},h=Object.assign(m,{Root:m,Input:({className:e,...t})=>{let{slots:n}=(0,d.use)(p);return(0,f.jsx)(l,{className:r(e,n?.input()),"data-slot":`input-group-input`,...t})},TextArea:({className:e,...t})=>{let{slots:n}=(0,d.use)(p);return(0,f.jsx)(o,{className:r(e,n?.input()),"data-slot":`input-group-textarea`,...t})},Prefix:({children:e,className:t,...n})=>{let{slots:r}=(0,d.use)(p);return(0,f.jsx)(`div`,{className:i(r?.prefix,t),"data-slot":`input-group-prefix`,...n,children:e})},Suffix:({children:e,className:t,...n})=>{let{slots:r}=(0,d.use)(p);return(0,f.jsx)(`div`,{className:i(r?.suffix,t),"data-slot":`input-group-suffix`,...n,children:e})}});export{h as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/label-B8hTan2F.js b/internal/webui/static/assets/label-DYYRLGoV.js similarity index 98% rename from internal/webui/static/assets/label-B8hTan2F.js rename to internal/webui/static/assets/label-DYYRLGoV.js index e19bd51c6..b8e486c8d 100644 --- a/internal/webui/static/assets/label-B8hTan2F.js +++ b/internal/webui/static/assets/label-DYYRLGoV.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{et as r}from"./useI18n-XrvNxGvP.js";import{F as i,T as a,W as o,dt as s,j as c,l,tt as u,z as d}from"./SharedElementTransition-BlCsXfb1.js";var f=t(e(),1);function p(e,t,n){let r=o(e=>{n&&!e.defaultPrevented&&n(t)});(0,f.useEffect)(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}var m=d({base:`label`,defaultVariants:{isDisabled:!1,isInvalid:!1,isRequired:!1},variants:{isDisabled:{true:`label--disabled`},isInvalid:{true:`label--invalid`},isRequired:{true:`label--required`}}}),h=(0,f.createContext)({}),g=r(function(e,t){[e,t]=c(e,t,h);let{elementType:n=`label`,...r}=e,a=i[n];return f.createElement(a,{className:`react-aria-Label`,...r,ref:t})}),_=(0,f.createContext)(null),v={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},y={...v,customError:!0,valid:!1},b={isInvalid:!1,validationDetails:v,validationErrors:[]},x=(0,f.createContext)({}),S=`__reactAriaFormValidationState`;function C(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[S];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return w(e)}function w(e){let{isInvalid:t,validationState:n,name:r,value:i,builtinValidation:a,validate:o,validationBehavior:s=`aria`}=e;n&&(t||=n===`invalid`);let c=t===void 0?null:{isInvalid:t,validationErrors:[],validationDetails:y},l=(0,f.useMemo)(()=>!o||i==null?null:D(E(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=(0,f.useContext)(x),d=(0,f.useMemo)(()=>r?Array.isArray(r)?r.flatMap(e=>T(u[e])):T(u[r]):[],[u,r]),[p,m]=(0,f.useState)(u),[h,g]=(0,f.useState)(!1);u!==p&&(m(u),g(!1));let _=(0,f.useMemo)(()=>D(h?[]:d),[h,d]),v=(0,f.useRef)(b),[S,C]=(0,f.useState)(b),w=(0,f.useRef)(b),k=()=>{if(!A)return;j(!1);let e=l||a||v.current;O(e,w.current)||(w.current=e,C(e))},[A,j]=(0,f.useState)(!1);return(0,f.useEffect)(k),{realtimeValidation:c||_||l||a||b,displayValidation:s===`native`?c||_||S:c||_||l||a||S,updateValidation(e){s===`aria`&&!O(S,e)?C(e):v.current=e},resetValidation(){let e=b;O(e,w.current)||(w.current=e,C(e)),s===`native`&&j(!1),g(!0)},commitValidation(){s===`native`&&j(!0),g(!0)}}}function T(e){return e?Array.isArray(e)?e:[e]:[]}function E(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return T(n)}return[]}function D(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:y}:null}function O(e,t){return e===t||!!e&&!!t&&e.isInvalid===t.isInvalid&&e.validationErrors.length===t.validationErrors.length&&e.validationErrors.every((e,n)=>e===t.validationErrors[n])&&Object.entries(e.validationDetails).every(([e,n])=>t.validationDetails[e]===n)}function k(...e){let t=new Set,n=!1,r={...v};for(let i of e){for(let e of i.validationErrors)t.add(e);n||=i.isInvalid;for(let e in r)r[e]||=i.validationDetails[e]}return r.valid=!n,{isInvalid:n,validationErrors:[...t],validationDetails:r}}var A=(0,f.createContext)(null),j=(0,f.forwardRef)(function(e,t){[e,t]=c(e,t,A);let{validationErrors:n,validationBehavior:r=`native`,children:a,className:o,...s}=e;return f.createElement(i.form,{noValidate:r!==`native`,...s,ref:t,className:o||`react-aria-Form`},f.createElement(A.Provider,{value:{...e,validationBehavior:r}},f.createElement(x.Provider,{value:n??{}},a)))});function M(e,t,n){let{validationBehavior:r,focus:i}=e;s(()=>{if(r===`native`&&n?.current&&`setCustomValidity`in n.current&&!n.current.disabled){let e=t.realtimeValidation.isInvalid?t.realtimeValidation.validationErrors.join(` `)||`Invalid value.`:``;n.current.setCustomValidity(e),n.current.hasAttribute(`title`)||(n.current.title=``),t.realtimeValidation.isInvalid||t.updateValidation(P(n.current))}});let c=(0,f.useRef)(!1),l=o(()=>{c.current||t.resetValidation()}),d=o(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&F(r)===n.current&&(i?i():n.current?.focus(),a(`keyboard`)),e.preventDefault()}),p=o(()=>{t.commitValidation()});(0,f.useEffect)(()=>{let e=n?.current;if(!e)return;let t=e.form,r=t?.reset;return t&&(t.reset=()=>{c.current=!window.event||window.event.type===`message`&&u(window.event)instanceof MessagePort,r?.call(t),c.current=!1}),e.addEventListener(`invalid`,d),e.addEventListener(`change`,p),t?.addEventListener(`reset`,l),()=>{e.removeEventListener(`invalid`,d),e.removeEventListener(`change`,p),t?.removeEventListener(`reset`,l),t&&(t.reset=r)}},[n,r])}function N(e){let t=e.validity;return{badInput:t.badInput,customError:t.customError,patternMismatch:t.patternMismatch,rangeOverflow:t.rangeOverflow,rangeUnderflow:t.rangeUnderflow,stepMismatch:t.stepMismatch,tooLong:t.tooLong,tooShort:t.tooShort,typeMismatch:t.typeMismatch,valueMissing:t.valueMissing,valid:t.valid}}function P(e){return{isInvalid:!e.validity.valid,validationDetails:N(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function F(e){for(let t=0;t(0,L.jsx)(g,{className:m({isRequired:i,isDisabled:n,isInvalid:r,className:t}),"data-slot":`label`,...a,children:e}),z=Object.assign(R,{Root:R});export{A as a,v as c,_ as d,h as f,j as i,b as l,I as n,k as o,p,M as r,S as s,z as t,C as u}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{et as r}from"./useI18n-BAo1UrJW.js";import{F as i,T as a,W as o,dt as s,j as c,l,tt as u,z as d}from"./SharedElementTransition-BlCsXfb1.js";var f=t(e(),1);function p(e,t,n){let r=o(e=>{n&&!e.defaultPrevented&&n(t)});(0,f.useEffect)(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}var m=d({base:`label`,defaultVariants:{isDisabled:!1,isInvalid:!1,isRequired:!1},variants:{isDisabled:{true:`label--disabled`},isInvalid:{true:`label--invalid`},isRequired:{true:`label--required`}}}),h=(0,f.createContext)({}),g=r(function(e,t){[e,t]=c(e,t,h);let{elementType:n=`label`,...r}=e,a=i[n];return f.createElement(a,{className:`react-aria-Label`,...r,ref:t})}),_=(0,f.createContext)(null),v={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},y={...v,customError:!0,valid:!1},b={isInvalid:!1,validationDetails:v,validationErrors:[]},x=(0,f.createContext)({}),S=`__reactAriaFormValidationState`;function C(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[S];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return w(e)}function w(e){let{isInvalid:t,validationState:n,name:r,value:i,builtinValidation:a,validate:o,validationBehavior:s=`aria`}=e;n&&(t||=n===`invalid`);let c=t===void 0?null:{isInvalid:t,validationErrors:[],validationDetails:y},l=(0,f.useMemo)(()=>!o||i==null?null:D(E(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=(0,f.useContext)(x),d=(0,f.useMemo)(()=>r?Array.isArray(r)?r.flatMap(e=>T(u[e])):T(u[r]):[],[u,r]),[p,m]=(0,f.useState)(u),[h,g]=(0,f.useState)(!1);u!==p&&(m(u),g(!1));let _=(0,f.useMemo)(()=>D(h?[]:d),[h,d]),v=(0,f.useRef)(b),[S,C]=(0,f.useState)(b),w=(0,f.useRef)(b),k=()=>{if(!A)return;j(!1);let e=l||a||v.current;O(e,w.current)||(w.current=e,C(e))},[A,j]=(0,f.useState)(!1);return(0,f.useEffect)(k),{realtimeValidation:c||_||l||a||b,displayValidation:s===`native`?c||_||S:c||_||l||a||S,updateValidation(e){s===`aria`&&!O(S,e)?C(e):v.current=e},resetValidation(){let e=b;O(e,w.current)||(w.current=e,C(e)),s===`native`&&j(!1),g(!0)},commitValidation(){s===`native`&&j(!0),g(!0)}}}function T(e){return e?Array.isArray(e)?e:[e]:[]}function E(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return T(n)}return[]}function D(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:y}:null}function O(e,t){return e===t||!!e&&!!t&&e.isInvalid===t.isInvalid&&e.validationErrors.length===t.validationErrors.length&&e.validationErrors.every((e,n)=>e===t.validationErrors[n])&&Object.entries(e.validationDetails).every(([e,n])=>t.validationDetails[e]===n)}function k(...e){let t=new Set,n=!1,r={...v};for(let i of e){for(let e of i.validationErrors)t.add(e);n||=i.isInvalid;for(let e in r)r[e]||=i.validationDetails[e]}return r.valid=!n,{isInvalid:n,validationErrors:[...t],validationDetails:r}}var A=(0,f.createContext)(null),j=(0,f.forwardRef)(function(e,t){[e,t]=c(e,t,A);let{validationErrors:n,validationBehavior:r=`native`,children:a,className:o,...s}=e;return f.createElement(i.form,{noValidate:r!==`native`,...s,ref:t,className:o||`react-aria-Form`},f.createElement(A.Provider,{value:{...e,validationBehavior:r}},f.createElement(x.Provider,{value:n??{}},a)))});function M(e,t,n){let{validationBehavior:r,focus:i}=e;s(()=>{if(r===`native`&&n?.current&&`setCustomValidity`in n.current&&!n.current.disabled){let e=t.realtimeValidation.isInvalid?t.realtimeValidation.validationErrors.join(` `)||`Invalid value.`:``;n.current.setCustomValidity(e),n.current.hasAttribute(`title`)||(n.current.title=``),t.realtimeValidation.isInvalid||t.updateValidation(P(n.current))}});let c=(0,f.useRef)(!1),l=o(()=>{c.current||t.resetValidation()}),d=o(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&F(r)===n.current&&(i?i():n.current?.focus(),a(`keyboard`)),e.preventDefault()}),p=o(()=>{t.commitValidation()});(0,f.useEffect)(()=>{let e=n?.current;if(!e)return;let t=e.form,r=t?.reset;return t&&(t.reset=()=>{c.current=!window.event||window.event.type===`message`&&u(window.event)instanceof MessagePort,r?.call(t),c.current=!1}),e.addEventListener(`invalid`,d),e.addEventListener(`change`,p),t?.addEventListener(`reset`,l),()=>{e.removeEventListener(`invalid`,d),e.removeEventListener(`change`,p),t?.removeEventListener(`reset`,l),t&&(t.reset=r)}},[n,r])}function N(e){let t=e.validity;return{badInput:t.badInput,customError:t.customError,patternMismatch:t.patternMismatch,rangeOverflow:t.rangeOverflow,rangeUnderflow:t.rangeUnderflow,stepMismatch:t.stepMismatch,tooLong:t.tooLong,tooShort:t.tooShort,typeMismatch:t.typeMismatch,valueMissing:t.valueMissing,valid:t.valid}}function P(e){return{isInvalid:!e.validity.valid,validationDetails:N(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function F(e){for(let t=0;t(0,L.jsx)(g,{className:m({isRequired:i,isDisabled:n,isInvalid:r,className:t}),"data-slot":`label`,...a,children:e}),z=Object.assign(R,{Root:R});export{A as a,v as c,_ as d,h as f,j as i,b as l,I as n,k as o,p,M as r,S as s,z as t,C as u}; \ No newline at end of file diff --git a/internal/webui/static/assets/list-box-BtjELxmv.js b/internal/webui/static/assets/list-box-DbrQLYNo.js similarity index 98% rename from internal/webui/static/assets/list-box-BtjELxmv.js rename to internal/webui/static/assets/list-box-DbrQLYNo.js index f6bee623f..001d5bd91 100644 --- a/internal/webui/static/assets/list-box-BtjELxmv.js +++ b/internal/webui/static/assets/list-box-DbrQLYNo.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{C as r,D as i,X as a,a as o,b as s,et as c,g as l,h as u,k as d,m as f,p,s as m,u as h,w as g,y as _}from"./useI18n-XrvNxGvP.js";import{A as v,B as y,F as b,G as x,I as S,J as C,L as w,M as T,N as E,O as D,P as O,S as k,T as A,Z as j,c as M,ct as N,d as ee,f as te,i as ne,j as P,k as re,l as ie,lt as F,pt as I,q as L,s as R,st as z,t as ae,tt as B,u as V,x as oe,z as H}from"./SharedElementTransition-BlCsXfb1.js";import{a as se,d as ce,f as le,p as ue,r as de,u as fe}from"./label-B8hTan2F.js";import{a as pe,i as me,n as U,o as he,r as ge,s as _e,t as ve}from"./DragAndDrop-DdMlSxLf.js";import{o as ye,r as be}from"./Input-CyXcxaPW.js";import{n as xe}from"./collection-prop-injection-Csmjb87v.js";import{$ as Se,G as Ce,Q as we,Z as Te,at as Ee,ct as De,dt as Oe,et as ke,ft as Ae,gt as W,ht as je,mt as Me,ot as Ne,st as Pe,xt as Fe,yt as Ie}from"./index-CAlyInAP.js";var Le=H({base:`list-box`,defaultVariants:{variant:`default`},variants:{variant:{danger:`list-box--danger`,default:`list-box--default`}}}),Re=H({defaultVariants:{variant:`default`},slots:{indicator:`list-box-item__indicator`,item:`list-box-item`},variants:{variant:{danger:{item:`list-box-item--danger`},default:{item:`list-box-item--default`}}}}),ze=H({base:`list-box-section`}),G=new WeakMap;function Be(e){return typeof e==`string`?e.replace(/\s*/g,``):``+e}function Ve(e,t){let n=G.get(e);if(!n)throw Error(`Unknown list`);return`${n.id}-option-${Be(t)}`}function He(e,t,n){let r=L(e,{labelable:!0}),i=e.selectionBehavior||`toggle`,a=e.orientation||`vertical`,o=e.linkBehavior||(i===`replace`?`action`:`override`);i===`toggle`&&o===`action`&&(o=`override`);let{listProps:s}=Ne({...e,ref:n,selectionManager:t.selectionManager,collection:t.collection,disabledKeys:t.disabledKeys,linkBehavior:o}),{focusWithinProps:c}=te({onFocusWithin:e.onFocus,onBlurWithin:e.onBlur,onFocusWithinChange:e.onFocusChange}),l=F(e.id);G.set(t,{id:l,shouldUseVirtualFocus:e.shouldUseVirtualFocus,shouldSelectOnPressUp:e.shouldSelectOnPressUp,shouldFocusOnHover:e.shouldFocusOnHover,isVirtualized:e.isVirtualized,onAction:e.onAction,linkBehavior:o,UNSTABLE_itemBehavior:e.UNSTABLE_itemBehavior});let{labelProps:u,fieldProps:d}=ye({...e,id:l,labelElementType:`span`});return{labelProps:u,listBoxProps:C(r,c,t.selectionManager.selectionMode===`multiple`?{"aria-multiselectable":`true`}:{},{role:`listbox`,"aria-orientation":a,...C(d,s)})}}function Ue(e,t,n){let{key:r}=e,i=G.get(t),a=e.isDisabled??t.selectionManager.isDisabled(r),o=e.isSelected??t.selectionManager.isSelected(r),s=e.shouldSelectOnPressUp??i?.shouldSelectOnPressUp,c=e.shouldFocusOnHover??i?.shouldFocusOnHover,l=e.shouldUseVirtualFocus??i?.shouldUseVirtualFocus,u=e.isVirtualized??i?.isVirtualized,d=N(),f=N(),p={role:`option`,"aria-disabled":a||void 0,"aria-selected":t.selectionManager.selectionMode===`none`?void 0:o,"aria-label":e[`aria-label`],"aria-labelledby":d,"aria-describedby":f},m=t.collection.getItem(r);if(u){let e=Number(m?.index);p[`aria-posinset`]=Number.isNaN(e)?void 0:e+1,p[`aria-setsize`]=ke(t.collection)}let h=i?.onAction?()=>i?.onAction?.(r):void 0,g=Ve(t,r),{itemProps:_,isPressed:v,isFocused:y,hasAction:b,allowsSelection:x}=Ee({selectionManager:t.selectionManager,key:r,ref:n,shouldSelectOnPressUp:s,allowsDifferentPressOrigin:s&&c,isVirtualized:u,shouldUseVirtualFocus:l,isDisabled:a,onAction:h||m?.props?.onAction?z(m?.props?.onAction,h):void 0,linkBehavior:i?.linkBehavior,UNSTABLE_itemBehavior:i?.UNSTABLE_itemBehavior,id:g}),{hoverProps:S}=V({isDisabled:a||!c,onHoverStart(){D()||(t.selectionManager.setFocused(!0),t.selectionManager.setFocusedKey(r))}}),w=L(m?.props);delete w.id;let T=I(m?.props);return{optionProps:{...p,...C(w,_,S,T),id:g},labelProps:{id:d},descriptionProps:{id:f},isFocused:y,isFocusVisible:y&&t.selectionManager.isFocused&&D(),isSelected:o,isDisabled:a,isPressed:v,allowsSelection:x,hasAction:b}}function We(e){let{heading:t,"aria-label":n}=e,r=F();return{itemProps:{role:`presentation`},headingProps:t?{id:r,role:`presentation`,onMouseDown:e=>{e.preventDefault()}}:{},groupProps:{role:`group`,"aria-label":n,"aria-labelledby":t?r:void 0}}}var K=t(e(),1),Ge=class{constructor(e){this.keyMap=new Map,this.firstKey=null,this.lastKey=null,this.iterable=e;let t=e=>{if(this.keyMap.set(e.key,e),e.childNodes&&e.type===`section`)for(let n of e.childNodes)t(n)};for(let n of e)t(n);let n=null,r=0,i=0;for(let[e,t]of this.keyMap)n?(n.nextKey=e,t.prevKey=n.key):(this.firstKey=e,t.prevKey=void 0),t.type===`item`&&(t.index=r++),(t.type===`section`||t.type===`item`)&&i++,n=t,n.nextKey=void 0;this._size=i,this.lastKey=n?.key??null}*[Symbol.iterator](){yield*this.iterable}get size(){return this._size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let t=this.keyMap.get(e);return t?t.prevKey??null:null}getKeyAfter(e){let t=this.keyMap.get(e);return t?t.nextKey??null:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)??null}at(e){let t=[...this.getKeys()];return this.getItem(t[e])}getChildren(e){return this.keyMap.get(e)?.childNodes||[]}};function q(e){let{filter:t,layoutDelegate:n}=e,r=Te(e),i=(0,K.useMemo)(()=>e.disabledKeys?new Set(e.disabledKeys):new Set,[e.disabledKeys]),a=(0,K.useCallback)(e=>t?new Ge(t(e)):new Ge(e),[t]),o=(0,K.useMemo)(()=>({suppressTextValueWarning:e.suppressTextValueWarning}),[e.suppressTextValueWarning]),s=we(e,a,o),c=(0,K.useMemo)(()=>new Se(s,r,{layoutDelegate:n}),[s,r,n]);return qe(s,c),{collection:s,disabledKeys:i,selectionManager:c}}function Ke(e,t){let n=(0,K.useMemo)(()=>t?e.collection.filter(t):e.collection,[e.collection,t]),r=e.selectionManager.withCollection(n);return qe(n,r),{collection:n,selectionManager:r,disabledKeys:e.disabledKeys}}function qe(e,t){let n=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(t.focusedKey!=null&&!e.getItem(t.focusedKey)&&n.current){let r=n.current.getKeyAfter(t.focusedKey),i=null;for(;r!=null;){let a=e.getItem(r);if(a&&a.type===`item`&&!t.isDisabled(r)){i=r;break}r=n.current.getKeyAfter(r)}if(i==null)for(r=n.current.getKeyBefore(t.focusedKey);r!=null;){let a=e.getItem(r);if(a&&a.type===`item`&&!t.isDisabled(r)){i=r;break}r=n.current.getKeyBefore(r)}t.setFocusedKey(i)}n.current=e},[e,t])}var J=(0,K.createContext)(null),Y=(0,K.createContext)(null),Je=(0,K.forwardRef)(function(e,t){[e,t]=P(e,t,J);let n=(0,K.useContext)(Y);return n?K.createElement(Xe,{state:n,props:e,listBoxRef:t}):K.createElement(f,{content:K.createElement(l,e)},n=>K.createElement(Ye,{props:e,listBoxRef:t,collection:n}))});function Ye({props:e,listBoxRef:t,collection:n}){e={...e,collection:n,children:null,items:null};let{layoutDelegate:r}=(0,K.useContext)(W),i=q({...e,layoutDelegate:r});return K.createElement(Xe,{state:i,props:e,listBoxRef:t})}function Xe({state:e,props:t,listBoxRef:n}){[t,n]=P(t,n,h);let{dragAndDropHooks:r,layout:i=`stack`,orientation:a=`vertical`,filter:o}=t,s=Ke(e,o),{collection:c,selectionManager:l}=s,u=!!r?.useDraggableCollectionState,d=!!r?.useDroppableCollectionState,{direction:f}=re(),{disabledBehavior:p,disabledKeys:g}=l,_=Pe({usage:`search`,sensitivity:`base`}),{isVirtualized:y,layoutDelegate:x,dropTargetDelegate:S,CollectionRoot:w}=(0,K.useContext)(W),E=(0,K.useMemo)(()=>t.keyboardDelegate||new De({collection:c,collator:_,ref:n,disabledKeys:g,disabledBehavior:p,layout:i,orientation:a,direction:f,layoutDelegate:x}),[c,_,n,p,g,a,f,t.keyboardDelegate,i,x]),{listBoxProps:D}=He({...t,shouldSelectOnPressUp:u||t.shouldSelectOnPressUp,keyboardDelegate:E,isVirtualized:y},s,n);(0,K.useRef)(u),(0,K.useRef)(d),(0,K.useEffect)(()=>{},[u,d]);let O,k,A,j=!1,M=null,N=(0,K.useRef)(null);if(u&&r){O=r.useDraggableCollectionState({collection:c,selectionManager:l,preview:r.renderDragPreview?N:void 0}),r.useDraggableCollection({},O,n);let e=r.DragPreview;M=r.renderDragPreview?K.createElement(e,{ref:N},r.renderDragPreview):null}if(d&&r){k=r.useDroppableCollectionState({collection:c,selectionManager:l});let e=r.dropTargetDelegate||S||new r.ListDropTargetDelegate(c,n,{orientation:a,layout:i,direction:f});A=r.useDroppableCollection({keyboardDelegate:E,dropTargetDelegate:e},k,n),j=k.isDropTarget({type:`root`})}let{focusProps:te,isFocused:ie,isFocusVisible:F}=ee(),I=s.collection.size===0,R={isDropTarget:j,isEmpty:I,isFocused:ie,isFocusVisible:F,layout:t.layout||`stack`,orientation:a,state:s},z=T({...t,children:void 0,defaultClassName:`react-aria-ListBox`,values:R}),B=null;I&&t.renderEmptyState&&(B=K.createElement(`div`,{role:`option`,style:{display:`contents`}},t.renderEmptyState(R)));let V=L(t,{global:!0});return K.createElement(ne,null,K.createElement(b.div,{...C(V,z,D,te,A?.collectionProps),ref:n,slot:t.slot||void 0,onScroll:t.onScroll,"data-drop-target":j||void 0,"data-empty":I||void 0,"data-focused":ie||void 0,"data-focus-visible":F||void 0,"data-layout":t.layout||`stack`,"data-orientation":a},K.createElement(v,{values:[[J,t],[Y,s],[U,{dragAndDropHooks:r,dragState:O,dropState:k}],[m,{elementType:`div`}],[me,{render:et}],[Ie,{name:`ListBoxSection`,render:Ze}]]},K.createElement(ae,null,K.createElement(w,{collection:c,scrollRef:n,persistedKeys:ge(l,r,k),renderDropIndicator:ve(r,k)}))),B,M))}function Ze(e,t,n,r=`react-aria-ListBoxSection`){let i=(0,K.useContext)(Y),{dragAndDropHooks:a,dropState:o}=(0,K.useContext)(U),{CollectionBranch:s}=(0,K.useContext)(W),[c,l]=E(),{headingProps:u,groupProps:d}=We({heading:l,"aria-label":e[`aria-label`]??void 0}),f=T({...e,id:void 0,children:void 0,defaultClassName:r,values:void 0}),p=L(e,{global:!0});return delete p.id,K.createElement(b.section,{...C(p,f,d),ref:t},K.createElement(je.Provider,{value:{...u,ref:c}},K.createElement(s,{collection:i.collection,parent:n,renderDropIndicator:ve(a,o)})))}var Qe=u(_,Ze),$e=p(r,function(e,t,n){let r=x(t),i=(0,K.useContext)(Y),{dragAndDropHooks:a,dragState:s,dropState:c}=(0,K.useContext)(U),l=s&&!(s.isDisabled||s.selectionManager.isDisabled(n.key)),{optionProps:u,labelProps:d,descriptionProps:f,...p}=Ue({key:n.key,"aria-label":e?.[`aria-label`]},i,r),{hoverProps:m,isHovered:h}=V({isDisabled:!p.allowsSelection&&!p.hasAction&&!l,onHoverStart:n.props.onHoverStart,onHoverChange:n.props.onHoverChange,onHoverEnd:n.props.onHoverEnd}),{keyboardProps:g}=oe(e),{focusProps:_}=k(e),y=null;s&&a&&(y=a.useDraggableItem({key:n.key,hasAction:p.hasAction},s));let S=null;c&&a&&(S=a.useDroppableItem({target:{type:`item`,key:n.key,dropPosition:`on`}},c,r));let w=s&&s.isDragging(n.key),E=T({...e,id:void 0,children:e.children,defaultClassName:`react-aria-ListBoxItem`,values:{...p,isHovered:h,selectionMode:i.selectionManager.selectionMode,selectionBehavior:i.selectionManager.selectionBehavior,allowsDragging:!!s,isDragging:w,isDropTarget:S?.isDropTarget}});(0,K.useEffect)(()=>{n.textValue},[n.textValue]);let D=e.href?b.a:b.div,A=L(e,{global:!0});return delete A.id,delete A.onClick,e.href&&u.tabIndex==null&&(u.tabIndex=-1),K.createElement(D,{...C(A,E,u,m,g,_,y?.dragProps,S?.dropProps),ref:r,"data-allows-dragging":!!s||void 0,"data-selected":p.isSelected||void 0,"data-disabled":p.isDisabled||void 0,"data-hovered":h||void 0,"data-focused":p.isFocused||void 0,"data-focus-visible":p.isFocusVisible||void 0,"data-pressed":p.isPressed||void 0,"data-dragging":w||void 0,"data-drop-target":S?.isDropTarget||void 0,"data-selection-mode":i.selectionManager.selectionMode===`none`?void 0:i.selectionManager.selectionMode},K.createElement(v,{values:[[o,{slots:{[O]:d,label:d,description:f}}],[Me,{isSelected:p.isSelected}]]},E.children))});function et(e,t){t=x(t);let{dragAndDropHooks:n,dropState:r}=(0,K.useContext)(U),{dropIndicatorProps:i,isHidden:a,isDropTarget:o}=n.useDropIndicator(e,r,t);return a?null:K.createElement(nt,{...e,dropIndicatorProps:i,isDropTarget:o,ref:t})}function tt(e,t){let{dropIndicatorProps:n,isDropTarget:r,...i}=e,a=T({...i,defaultClassName:`react-aria-DropIndicator`,values:{isDropTarget:r}});return K.createElement(K.Fragment,null,K.createElement(b.div,{...n,...a,role:`option`,ref:t,"data-drop-target":r||void 0}))}var nt=(0,K.forwardRef)(tt);p(s,function(e,t,n){let r=(0,K.useContext)(Y),{isLoading:i,onLoadMore:a,scrollOffset:o,...s}=e,c=(0,K.useRef)(null),l=(0,K.useMemo)(()=>({onLoadMore:a,collection:r?.collection,sentinelRef:c,scrollOffset:o}),[a,o,r?.collection]);_e(l,c);let u=T({...s,id:void 0,children:n.rendered,defaultClassName:`react-aria-ListBoxLoadingIndicator`,values:void 0});return K.createElement(K.Fragment,null,K.createElement(`div`,{style:{position:`relative`,width:0,height:0},inert:he(!0)},K.createElement(`div`,{"data-testid":`loadMoreSentinel`,ref:c,style:{position:`absolute`,height:1,width:1}})),i&&u.children&&K.createElement(K.Fragment,null,K.createElement(b.div,{...C(L(e,{global:!0}),{tabIndex:-1}),...u,role:`option`,ref:t},u.children)))});var X=new WeakMap;function rt(e,t,n){let{keyboardDelegate:r,isDisabled:i,isRequired:a,name:o,form:s,validationBehavior:c=`aria`}=e,l=Pe({usage:`search`,sensitivity:`base`}),u=(0,K.useMemo)(()=>r||new De(t.collection,t.disabledKeys,n,l),[r,t.collection,t.disabledKeys,l,n]),{menuTriggerProps:d,menuProps:f}=Ae({isDisabled:i,type:`listbox`},t,n),{keyboardProps:p}=oe({shortcuts:{ArrowLeft:()=>{if(t.selectionManager.selectionMode===`multiple`)return!1;let e=t.selectedKey==null?u.getFirstKey?.():u.getKeyAbove?.(t.selectedKey);e!=null&&t.setSelectedKey(e)},ArrowRight:()=>{if(t.selectionManager.selectionMode===`multiple`)return!1;let e=t.selectedKey==null?u.getFirstKey?.():u.getKeyBelow?.(t.selectedKey);e!=null&&t.setSelectedKey(e)}},allowRepeats:!0,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp}),{typeSelectProps:m}=Oe({keyboardDelegate:u,selectionManager:t.selectionManager,onTypeSelect(e){t.setSelectedKey(e)}}),{isInvalid:h,validationErrors:g,validationDetails:_}=t.displayValidation,{labelProps:v,fieldProps:y,descriptionProps:b,errorMessageProps:x}=be({...e,labelElementType:`span`,isInvalid:h,errorMessage:e.errorMessage||g});t.selectionManager.selectionMode===`multiple`&&(m={});let S=L(e,{labelable:!0}),w=C(m,d,y),T=F();return X.set(t,{isDisabled:i,isRequired:a,name:o,form:s,validationBehavior:c}),{labelProps:{...v,onClick:()=>{e.isDisabled||(n.current?.focus(),A(`keyboard`))}},triggerProps:C(S,{...w,isDisabled:i,onKeyDown:z(w.onKeyDown,p.onKeyDown),onKeyUp:p.onKeyUp,"aria-labelledby":[T,w[`aria-labelledby`],w[`aria-label`]&&!w[`aria-labelledby`]?w.id:null].filter(Boolean).join(` `),onFocus(n){t.isFocused||(e.onFocus&&e.onFocus(n),e.onFocusChange&&e.onFocusChange(!0),t.setFocused(!0))},onBlur(n){t.isOpen||(e.onBlur&&e.onBlur(n),e.onFocusChange&&e.onFocusChange(!1),t.setFocused(!1))}}),valueProps:{id:T},menuProps:{...f,onAction:void 0,autoFocus:t.focusStrategy||!0,shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,disallowEmptySelection:!0,linkBehavior:`selection`,onBlur:n=>{j(n.currentTarget,n.relatedTarget)||(e.onBlur&&e.onBlur(n),e.onFocusChange&&e.onFocusChange(!1),t.setFocused(!1))},"aria-labelledby":[y[`aria-labelledby`],w[`aria-label`]&&!y[`aria-labelledby`]?w.id:null].filter(Boolean).join(` `)},descriptionProps:b,errorMessageProps:x,isInvalid:h,validationErrors:g,validationDetails:_,hiddenSelectProps:{isDisabled:i,name:o,label:e.label,state:t,triggerRef:n,form:s}}}function it(e,t,n){let r=X.get(t)||{},{autoComplete:a,name:o=r.name,form:s=r.form,isDisabled:c=r.isDisabled}=e,{validationBehavior:l,isRequired:u}=r,{visuallyHiddenProps:d}=i({style:{position:`fixed`,top:0,left:0}});ue(e.selectRef,t.defaultValue,t.setValue),de({validationBehavior:l,focus:()=>n.current?.focus()},t,e.selectRef);let f=t.setValue,p=(0,K.useCallback)(e=>{let t=B(e);t.multiple?f(Array.from(t.selectedOptions,e=>e.value)):f(e.currentTarget.value)},[f]);return{containerProps:{...d,"aria-hidden":!0,"data-react-aria-prevent-focus":!0,"data-a11y-ignore":`aria-hidden-focus`},inputProps:{style:{display:`none`}},selectProps:{tabIndex:-1,autoComplete:a,disabled:c,multiple:t.selectionManager.selectionMode===`multiple`,required:l===`native`&&u,name:o,form:s,value:t.value??``,onChange:p,onInput:p}}}function at(e){let{state:t,triggerRef:n,label:r,name:i,form:a,isDisabled:o}=e,s=(0,K.useRef)(null),c=(0,K.useRef)(null),{containerProps:l,selectProps:u}=it({...e,selectRef:t.collection.size<=300?s:c},t,n),d=Array.isArray(t.value)?t.value:[t.value];if(t.collection.size<=300)return K.createElement(`div`,{...l,"data-testid":`hidden-select-container`},K.createElement(`label`,null,r,K.createElement(`select`,{...u,ref:s},K.createElement(`option`,{value:``,label:`\xA0`},`\xA0`),[...t.collection.getKeys()].map(e=>{let n=t.collection.getItem(e);if(n&&n.type===`item`)return K.createElement(`option`,{key:n.key,value:n.key},n.textValue)}),t.collection.size===0&&i&&d.map((e,t)=>K.createElement(`option`,{key:t,value:e??``})))));if(i){let{validationBehavior:e}=X.get(t)||{};d.length===0&&(d=[null]);let n=d.map((t,n)=>{let r={type:`hidden`,autoComplete:u.autoComplete,name:i,form:a,disabled:o,value:t??``};return e===`native`?K.createElement(`input`,{key:n,...r,ref:n===0?c:null,style:{display:`none`},type:`text`,required:n===0&&u.required,onChange:()=>{}}):K.createElement(`input`,{key:n,...r,ref:n===0?c:null})});return K.createElement(K.Fragment,null,n)}return null}function ot(e){let{selectionMode:t=`single`,shouldCloseOnSelect:n=t===`single`}=e,r=g(e),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.defaultValue===void 0?t===`single`?e.defaultSelectedKey??null:[]:e.defaultValue,[e.defaultValue,e.defaultSelectedKey,t]),s=(0,K.useMemo)(()=>e.value===void 0?t===`single`?e.selectedKey:void 0:e.value,[e.value,e.selectedKey,t]),[c,l]=ie(s,o,e.onChange),u=t===`single`&&Array.isArray(c)?c[0]:c,d=n=>{if(t===`single`){let t=Array.isArray(n)?n[0]??null:n;l(t),t!==u&&e.onSelectionChange?.(t)}else{let e=[];Array.isArray(n)?e=n:n!=null&&(e=[n]),l(e)}},f=q({...e,selectionMode:t,disallowEmptySelection:t===`single`,allowDuplicateSelectionEvents:!0,selectedKeys:(0,K.useMemo)(()=>st(u),[u]),onSelectionChange:e=>{if(e!==`all`){if(t===`single`){let t=e.values().next().value??null;d(t)}else d([...e]);n&&r.close(),h.commitValidation()}}}),p=f.selectionManager.firstSelectedKey,m=(0,K.useMemo)(()=>[...f.selectionManager.selectedKeys].map(e=>f.collection.getItem(e)).filter(e=>e!=null),[f.selectionManager.selectedKeys,f.collection]),h=fe({...e,value:Array.isArray(u)&&u.length===0?null:u}),[_,v]=(0,K.useState)(!1),[y]=(0,K.useState)(u);return{...h,...f,...r,value:u,defaultValue:o??y,setValue:d,selectedKey:p,setSelectedKey:d,selectedItem:m[0]??null,selectedItems:m,defaultSelectedKey:e.defaultSelectedKey??(e.selectionMode===`single`?y:null),focusStrategy:i,open(t=null){(f.collection.size!==0||e.allowsEmptyCollection)&&(a(t),r.open())},toggle(t=null){(f.collection.size!==0||e.allowsEmptyCollection)&&(a(t),r.toggle())},isFocused:_,setFocused:v}}function st(e){if(e!==void 0)return e===null?[]:Array.isArray(e)?e:[e]}function ct(e={}){let{locale:t}=re();return(0,K.useMemo)(()=>new Intl.ListFormat(t,e),[t,e])}function lt(e){return e&&e.__esModule?e.default:e}var Z=(0,K.createContext)(null),Q=(0,K.createContext)(null),ut=c(function(e,t){[e,t]=P(e,t,Z);let{children:n,isDisabled:r=!1,isInvalid:i=!1,isRequired:a=!1}=e,o=(0,K.useMemo)(()=>typeof n==`function`?n({isOpen:!1,isDisabled:r,isInvalid:i,isRequired:a,isFocused:!1,isFocusVisible:!1,defaultChildren:null}):n,[n,r,i,a]);return K.createElement(f,{content:o},n=>K.createElement(ft,{props:e,collection:n,selectRef:t}))}),dt=[le,a,o];function ft({props:e,selectRef:t,collection:n}){let{validationBehavior:r}=w(se)||{},i=e.validationBehavior??r??`native`,s=ot({...e,collection:n,children:void 0,validationBehavior:i}),{isFocusVisible:c,focusProps:l}=ee({within:!0}),u=(0,K.useRef)(null),[d,f]=E(!e[`aria-label`]&&!e[`aria-labelledby`]),{labelProps:p,triggerProps:m,valueProps:h,menuProps:g,descriptionProps:_,errorMessageProps:y,hiddenSelectProps:x,...D}=rt({...S(e),label:f,validationBehavior:i},s,u),O=(0,K.useMemo)(()=>({isOpen:s.isOpen,isFocused:s.isFocused,isFocusVisible:c,isDisabled:e.isDisabled||!1,isInvalid:D.isInvalid||!1,isRequired:e.isRequired||!1}),[s.isOpen,s.isFocused,c,e.isDisabled,D.isInvalid,e.isRequired]),k=T({...e,values:O,defaultClassName:`react-aria-Select`}),A=L(e,{global:!0});delete A.id;let j=(0,K.useRef)(null);return K.createElement(v,{values:[[Z,e],[Q,s],[pt,h],[le,{...p,ref:d,elementType:`span`}],[a,{...m,ref:u,isPressed:s.isOpen,autoFocus:e.autoFocus}],[Ce,s],[Fe,{trigger:`Select`,triggerRef:u,scrollRef:j,placement:`bottom start`,"aria-labelledby":g[`aria-labelledby`],clearContexts:dt}],[J,{...g,ref:j}],[Y,s],[o,{slots:{description:_,errorMessage:y}}],[ce,D]]},K.createElement(b.div,{...C(A,k,l),ref:t,slot:e.slot||void 0,"data-focused":s.isFocused||void 0,"data-focus-visible":c||void 0,"data-open":s.isOpen||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":D.isInvalid||void 0,"data-required":e.isRequired||void 0},k.children,K.createElement(at,{...x,autoComplete:e.autoComplete})))}var pt=(0,K.createContext)(null),mt=c(function(e,t){[e,t]=P(e,t,pt);let n=(0,K.useContext)(Q),{placeholder:r}=w(Z),i=n.selectedItems.map(e=>{let t=e.props?.children;return typeof t==`function`&&(t=t({isHovered:!1,isPressed:!1,isSelected:!1,isFocused:!1,isFocusVisible:!1,isDisabled:!1,selectionMode:`single`,selectionBehavior:`toggle`})),t}),a=ct(),s=(0,K.useMemo)(()=>n.selectedItems.map(e=>e?.textValue),[n.selectedItems]),c=n.selectionManager.selectionMode,l=(0,K.useMemo)(()=>c===`single`?s[0]??``:a.format(s),[c,a,s]),u=(0,K.useMemo)(()=>{if(c===`single`)return i[0];let e=a.formatToParts(s);if(e.length===0)return null;let t=0;return e.map(e=>e.type===`element`?K.createElement(K.Fragment,{key:t},i[t++]):e.value)},[c,a,s,i]),f=d(lt(pe),`react-aria-components`),p=T({...e,defaultChildren:u??r??f.format(`selectPlaceholder`),defaultClassName:`react-aria-SelectValue`,values:{selectedItem:n.selectedItems[0]?.value??null,selectedItems:(0,K.useMemo)(()=>n.selectedItems.map(e=>e.value??null),[n.selectedItems]),selectedText:l,isPlaceholder:n.selectedItems.length===0,state:n}}),m=L(e,{global:!0});return K.createElement(b.span,{ref:t,...m,...p,"data-placeholder":n.selectedItems.length===0||void 0},K.createElement(o.Provider,{value:void 0},p.children))}),$=n(),ht=({children:e})=>(0,$.jsx)(xe,{value:!0,children:e}),gt=(0,K.createContext)({}),_t=({children:e,className:t,variant:n,...r})=>{let i=K.useMemo(()=>Re({variant:n}),[n]);return(0,$.jsx)($e,{className:M(t,i.item()),"data-slot":`list-box-item`,...r,children:t=>(0,$.jsx)(gt,{value:{slots:i,state:t},children:typeof e==`function`?e(t):e})})},vt=({children:e,className:t,...n})=>{let{slots:r,state:i}=(0,K.use)(gt),a=i?.isSelected,o=typeof e==`function`?e(i??{}):e||(0,$.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`list-box-item-indicator--checkmark`,fill:`none`,role:`presentation`,stroke:`currentColor`,strokeDasharray:22,strokeDashoffset:a?44:66,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 17 18`,children:(0,$.jsx)(`polyline`,{points:`1 9 7 14 15 4`})});return(0,$.jsx)(y.span,{"aria-hidden":`true`,className:R(r?.indicator,t),"data-slot":`list-box-item-indicator`,"data-visible":a||void 0,...n,children:o})},yt=Object.assign(_t,{Root:_t,Indicator:vt}),bt=({children:e,className:t,...n})=>{let r=K.useMemo(()=>ze({class:typeof t==`string`?t:void 0}),[t]);return(0,$.jsx)(Qe,{className:r,...n,children:e})};function xt({className:e,variant:t,...n}){let r=K.useMemo(()=>Le({variant:t}),[t]);return(0,$.jsx)(Je,{className:M(e,r),"data-slot":`list-box`,...n})}var St=Object.assign(xt,{Root:xt,Item:yt,ItemIndicator:vt,Section:bt});export{ut as a,Q as i,ht as n,q as o,mt as r,St as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{C as r,D as i,X as a,a as o,b as s,et as c,g as l,h as u,k as d,m as f,p,s as m,u as h,w as g,y as _}from"./useI18n-BAo1UrJW.js";import{A as v,B as y,F as b,G as x,I as S,J as C,L as w,M as T,N as E,O as D,P as O,S as k,T as A,Z as j,c as M,ct as N,d as ee,f as te,i as ne,j as P,k as re,l as ie,lt as F,pt as I,q as L,s as R,st as z,t as ae,tt as B,u as V,x as oe,z as H}from"./SharedElementTransition-BlCsXfb1.js";import{a as se,d as ce,f as le,p as ue,r as de,u as fe}from"./label-DYYRLGoV.js";import{a as pe,i as me,n as U,o as he,r as ge,s as _e,t as ve}from"./DragAndDrop-QLaADEWb.js";import{o as ye,r as be}from"./Input-C__Dw9HK.js";import{n as xe}from"./collection-prop-injection-B6_r67VF.js";import{$ as Se,G as Ce,Q as we,Z as Te,at as Ee,ct as De,dt as Oe,et as ke,ft as Ae,gt as W,ht as je,mt as Me,ot as Ne,st as Pe,xt as Fe,yt as Ie}from"./index-CWTBzWuK.js";var Le=H({base:`list-box`,defaultVariants:{variant:`default`},variants:{variant:{danger:`list-box--danger`,default:`list-box--default`}}}),Re=H({defaultVariants:{variant:`default`},slots:{indicator:`list-box-item__indicator`,item:`list-box-item`},variants:{variant:{danger:{item:`list-box-item--danger`},default:{item:`list-box-item--default`}}}}),ze=H({base:`list-box-section`}),G=new WeakMap;function Be(e){return typeof e==`string`?e.replace(/\s*/g,``):``+e}function Ve(e,t){let n=G.get(e);if(!n)throw Error(`Unknown list`);return`${n.id}-option-${Be(t)}`}function He(e,t,n){let r=L(e,{labelable:!0}),i=e.selectionBehavior||`toggle`,a=e.orientation||`vertical`,o=e.linkBehavior||(i===`replace`?`action`:`override`);i===`toggle`&&o===`action`&&(o=`override`);let{listProps:s}=Ne({...e,ref:n,selectionManager:t.selectionManager,collection:t.collection,disabledKeys:t.disabledKeys,linkBehavior:o}),{focusWithinProps:c}=te({onFocusWithin:e.onFocus,onBlurWithin:e.onBlur,onFocusWithinChange:e.onFocusChange}),l=F(e.id);G.set(t,{id:l,shouldUseVirtualFocus:e.shouldUseVirtualFocus,shouldSelectOnPressUp:e.shouldSelectOnPressUp,shouldFocusOnHover:e.shouldFocusOnHover,isVirtualized:e.isVirtualized,onAction:e.onAction,linkBehavior:o,UNSTABLE_itemBehavior:e.UNSTABLE_itemBehavior});let{labelProps:u,fieldProps:d}=ye({...e,id:l,labelElementType:`span`});return{labelProps:u,listBoxProps:C(r,c,t.selectionManager.selectionMode===`multiple`?{"aria-multiselectable":`true`}:{},{role:`listbox`,"aria-orientation":a,...C(d,s)})}}function Ue(e,t,n){let{key:r}=e,i=G.get(t),a=e.isDisabled??t.selectionManager.isDisabled(r),o=e.isSelected??t.selectionManager.isSelected(r),s=e.shouldSelectOnPressUp??i?.shouldSelectOnPressUp,c=e.shouldFocusOnHover??i?.shouldFocusOnHover,l=e.shouldUseVirtualFocus??i?.shouldUseVirtualFocus,u=e.isVirtualized??i?.isVirtualized,d=N(),f=N(),p={role:`option`,"aria-disabled":a||void 0,"aria-selected":t.selectionManager.selectionMode===`none`?void 0:o,"aria-label":e[`aria-label`],"aria-labelledby":d,"aria-describedby":f},m=t.collection.getItem(r);if(u){let e=Number(m?.index);p[`aria-posinset`]=Number.isNaN(e)?void 0:e+1,p[`aria-setsize`]=ke(t.collection)}let h=i?.onAction?()=>i?.onAction?.(r):void 0,g=Ve(t,r),{itemProps:_,isPressed:v,isFocused:y,hasAction:b,allowsSelection:x}=Ee({selectionManager:t.selectionManager,key:r,ref:n,shouldSelectOnPressUp:s,allowsDifferentPressOrigin:s&&c,isVirtualized:u,shouldUseVirtualFocus:l,isDisabled:a,onAction:h||m?.props?.onAction?z(m?.props?.onAction,h):void 0,linkBehavior:i?.linkBehavior,UNSTABLE_itemBehavior:i?.UNSTABLE_itemBehavior,id:g}),{hoverProps:S}=V({isDisabled:a||!c,onHoverStart(){D()||(t.selectionManager.setFocused(!0),t.selectionManager.setFocusedKey(r))}}),w=L(m?.props);delete w.id;let T=I(m?.props);return{optionProps:{...p,...C(w,_,S,T),id:g},labelProps:{id:d},descriptionProps:{id:f},isFocused:y,isFocusVisible:y&&t.selectionManager.isFocused&&D(),isSelected:o,isDisabled:a,isPressed:v,allowsSelection:x,hasAction:b}}function We(e){let{heading:t,"aria-label":n}=e,r=F();return{itemProps:{role:`presentation`},headingProps:t?{id:r,role:`presentation`,onMouseDown:e=>{e.preventDefault()}}:{},groupProps:{role:`group`,"aria-label":n,"aria-labelledby":t?r:void 0}}}var K=t(e(),1),Ge=class{constructor(e){this.keyMap=new Map,this.firstKey=null,this.lastKey=null,this.iterable=e;let t=e=>{if(this.keyMap.set(e.key,e),e.childNodes&&e.type===`section`)for(let n of e.childNodes)t(n)};for(let n of e)t(n);let n=null,r=0,i=0;for(let[e,t]of this.keyMap)n?(n.nextKey=e,t.prevKey=n.key):(this.firstKey=e,t.prevKey=void 0),t.type===`item`&&(t.index=r++),(t.type===`section`||t.type===`item`)&&i++,n=t,n.nextKey=void 0;this._size=i,this.lastKey=n?.key??null}*[Symbol.iterator](){yield*this.iterable}get size(){return this._size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let t=this.keyMap.get(e);return t?t.prevKey??null:null}getKeyAfter(e){let t=this.keyMap.get(e);return t?t.nextKey??null:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)??null}at(e){let t=[...this.getKeys()];return this.getItem(t[e])}getChildren(e){return this.keyMap.get(e)?.childNodes||[]}};function q(e){let{filter:t,layoutDelegate:n}=e,r=Te(e),i=(0,K.useMemo)(()=>e.disabledKeys?new Set(e.disabledKeys):new Set,[e.disabledKeys]),a=(0,K.useCallback)(e=>t?new Ge(t(e)):new Ge(e),[t]),o=(0,K.useMemo)(()=>({suppressTextValueWarning:e.suppressTextValueWarning}),[e.suppressTextValueWarning]),s=we(e,a,o),c=(0,K.useMemo)(()=>new Se(s,r,{layoutDelegate:n}),[s,r,n]);return qe(s,c),{collection:s,disabledKeys:i,selectionManager:c}}function Ke(e,t){let n=(0,K.useMemo)(()=>t?e.collection.filter(t):e.collection,[e.collection,t]),r=e.selectionManager.withCollection(n);return qe(n,r),{collection:n,selectionManager:r,disabledKeys:e.disabledKeys}}function qe(e,t){let n=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(t.focusedKey!=null&&!e.getItem(t.focusedKey)&&n.current){let r=n.current.getKeyAfter(t.focusedKey),i=null;for(;r!=null;){let a=e.getItem(r);if(a&&a.type===`item`&&!t.isDisabled(r)){i=r;break}r=n.current.getKeyAfter(r)}if(i==null)for(r=n.current.getKeyBefore(t.focusedKey);r!=null;){let a=e.getItem(r);if(a&&a.type===`item`&&!t.isDisabled(r)){i=r;break}r=n.current.getKeyBefore(r)}t.setFocusedKey(i)}n.current=e},[e,t])}var J=(0,K.createContext)(null),Y=(0,K.createContext)(null),Je=(0,K.forwardRef)(function(e,t){[e,t]=P(e,t,J);let n=(0,K.useContext)(Y);return n?K.createElement(Xe,{state:n,props:e,listBoxRef:t}):K.createElement(f,{content:K.createElement(l,e)},n=>K.createElement(Ye,{props:e,listBoxRef:t,collection:n}))});function Ye({props:e,listBoxRef:t,collection:n}){e={...e,collection:n,children:null,items:null};let{layoutDelegate:r}=(0,K.useContext)(W),i=q({...e,layoutDelegate:r});return K.createElement(Xe,{state:i,props:e,listBoxRef:t})}function Xe({state:e,props:t,listBoxRef:n}){[t,n]=P(t,n,h);let{dragAndDropHooks:r,layout:i=`stack`,orientation:a=`vertical`,filter:o}=t,s=Ke(e,o),{collection:c,selectionManager:l}=s,u=!!r?.useDraggableCollectionState,d=!!r?.useDroppableCollectionState,{direction:f}=re(),{disabledBehavior:p,disabledKeys:g}=l,_=Pe({usage:`search`,sensitivity:`base`}),{isVirtualized:y,layoutDelegate:x,dropTargetDelegate:S,CollectionRoot:w}=(0,K.useContext)(W),E=(0,K.useMemo)(()=>t.keyboardDelegate||new De({collection:c,collator:_,ref:n,disabledKeys:g,disabledBehavior:p,layout:i,orientation:a,direction:f,layoutDelegate:x}),[c,_,n,p,g,a,f,t.keyboardDelegate,i,x]),{listBoxProps:D}=He({...t,shouldSelectOnPressUp:u||t.shouldSelectOnPressUp,keyboardDelegate:E,isVirtualized:y},s,n);(0,K.useRef)(u),(0,K.useRef)(d),(0,K.useEffect)(()=>{},[u,d]);let O,k,A,j=!1,M=null,N=(0,K.useRef)(null);if(u&&r){O=r.useDraggableCollectionState({collection:c,selectionManager:l,preview:r.renderDragPreview?N:void 0}),r.useDraggableCollection({},O,n);let e=r.DragPreview;M=r.renderDragPreview?K.createElement(e,{ref:N},r.renderDragPreview):null}if(d&&r){k=r.useDroppableCollectionState({collection:c,selectionManager:l});let e=r.dropTargetDelegate||S||new r.ListDropTargetDelegate(c,n,{orientation:a,layout:i,direction:f});A=r.useDroppableCollection({keyboardDelegate:E,dropTargetDelegate:e},k,n),j=k.isDropTarget({type:`root`})}let{focusProps:te,isFocused:ie,isFocusVisible:F}=ee(),I=s.collection.size===0,R={isDropTarget:j,isEmpty:I,isFocused:ie,isFocusVisible:F,layout:t.layout||`stack`,orientation:a,state:s},z=T({...t,children:void 0,defaultClassName:`react-aria-ListBox`,values:R}),B=null;I&&t.renderEmptyState&&(B=K.createElement(`div`,{role:`option`,style:{display:`contents`}},t.renderEmptyState(R)));let V=L(t,{global:!0});return K.createElement(ne,null,K.createElement(b.div,{...C(V,z,D,te,A?.collectionProps),ref:n,slot:t.slot||void 0,onScroll:t.onScroll,"data-drop-target":j||void 0,"data-empty":I||void 0,"data-focused":ie||void 0,"data-focus-visible":F||void 0,"data-layout":t.layout||`stack`,"data-orientation":a},K.createElement(v,{values:[[J,t],[Y,s],[U,{dragAndDropHooks:r,dragState:O,dropState:k}],[m,{elementType:`div`}],[me,{render:et}],[Ie,{name:`ListBoxSection`,render:Ze}]]},K.createElement(ae,null,K.createElement(w,{collection:c,scrollRef:n,persistedKeys:ge(l,r,k),renderDropIndicator:ve(r,k)}))),B,M))}function Ze(e,t,n,r=`react-aria-ListBoxSection`){let i=(0,K.useContext)(Y),{dragAndDropHooks:a,dropState:o}=(0,K.useContext)(U),{CollectionBranch:s}=(0,K.useContext)(W),[c,l]=E(),{headingProps:u,groupProps:d}=We({heading:l,"aria-label":e[`aria-label`]??void 0}),f=T({...e,id:void 0,children:void 0,defaultClassName:r,values:void 0}),p=L(e,{global:!0});return delete p.id,K.createElement(b.section,{...C(p,f,d),ref:t},K.createElement(je.Provider,{value:{...u,ref:c}},K.createElement(s,{collection:i.collection,parent:n,renderDropIndicator:ve(a,o)})))}var Qe=u(_,Ze),$e=p(r,function(e,t,n){let r=x(t),i=(0,K.useContext)(Y),{dragAndDropHooks:a,dragState:s,dropState:c}=(0,K.useContext)(U),l=s&&!(s.isDisabled||s.selectionManager.isDisabled(n.key)),{optionProps:u,labelProps:d,descriptionProps:f,...p}=Ue({key:n.key,"aria-label":e?.[`aria-label`]},i,r),{hoverProps:m,isHovered:h}=V({isDisabled:!p.allowsSelection&&!p.hasAction&&!l,onHoverStart:n.props.onHoverStart,onHoverChange:n.props.onHoverChange,onHoverEnd:n.props.onHoverEnd}),{keyboardProps:g}=oe(e),{focusProps:_}=k(e),y=null;s&&a&&(y=a.useDraggableItem({key:n.key,hasAction:p.hasAction},s));let S=null;c&&a&&(S=a.useDroppableItem({target:{type:`item`,key:n.key,dropPosition:`on`}},c,r));let w=s&&s.isDragging(n.key),E=T({...e,id:void 0,children:e.children,defaultClassName:`react-aria-ListBoxItem`,values:{...p,isHovered:h,selectionMode:i.selectionManager.selectionMode,selectionBehavior:i.selectionManager.selectionBehavior,allowsDragging:!!s,isDragging:w,isDropTarget:S?.isDropTarget}});(0,K.useEffect)(()=>{n.textValue},[n.textValue]);let D=e.href?b.a:b.div,A=L(e,{global:!0});return delete A.id,delete A.onClick,e.href&&u.tabIndex==null&&(u.tabIndex=-1),K.createElement(D,{...C(A,E,u,m,g,_,y?.dragProps,S?.dropProps),ref:r,"data-allows-dragging":!!s||void 0,"data-selected":p.isSelected||void 0,"data-disabled":p.isDisabled||void 0,"data-hovered":h||void 0,"data-focused":p.isFocused||void 0,"data-focus-visible":p.isFocusVisible||void 0,"data-pressed":p.isPressed||void 0,"data-dragging":w||void 0,"data-drop-target":S?.isDropTarget||void 0,"data-selection-mode":i.selectionManager.selectionMode===`none`?void 0:i.selectionManager.selectionMode},K.createElement(v,{values:[[o,{slots:{[O]:d,label:d,description:f}}],[Me,{isSelected:p.isSelected}]]},E.children))});function et(e,t){t=x(t);let{dragAndDropHooks:n,dropState:r}=(0,K.useContext)(U),{dropIndicatorProps:i,isHidden:a,isDropTarget:o}=n.useDropIndicator(e,r,t);return a?null:K.createElement(nt,{...e,dropIndicatorProps:i,isDropTarget:o,ref:t})}function tt(e,t){let{dropIndicatorProps:n,isDropTarget:r,...i}=e,a=T({...i,defaultClassName:`react-aria-DropIndicator`,values:{isDropTarget:r}});return K.createElement(K.Fragment,null,K.createElement(b.div,{...n,...a,role:`option`,ref:t,"data-drop-target":r||void 0}))}var nt=(0,K.forwardRef)(tt);p(s,function(e,t,n){let r=(0,K.useContext)(Y),{isLoading:i,onLoadMore:a,scrollOffset:o,...s}=e,c=(0,K.useRef)(null),l=(0,K.useMemo)(()=>({onLoadMore:a,collection:r?.collection,sentinelRef:c,scrollOffset:o}),[a,o,r?.collection]);_e(l,c);let u=T({...s,id:void 0,children:n.rendered,defaultClassName:`react-aria-ListBoxLoadingIndicator`,values:void 0});return K.createElement(K.Fragment,null,K.createElement(`div`,{style:{position:`relative`,width:0,height:0},inert:he(!0)},K.createElement(`div`,{"data-testid":`loadMoreSentinel`,ref:c,style:{position:`absolute`,height:1,width:1}})),i&&u.children&&K.createElement(K.Fragment,null,K.createElement(b.div,{...C(L(e,{global:!0}),{tabIndex:-1}),...u,role:`option`,ref:t},u.children)))});var X=new WeakMap;function rt(e,t,n){let{keyboardDelegate:r,isDisabled:i,isRequired:a,name:o,form:s,validationBehavior:c=`aria`}=e,l=Pe({usage:`search`,sensitivity:`base`}),u=(0,K.useMemo)(()=>r||new De(t.collection,t.disabledKeys,n,l),[r,t.collection,t.disabledKeys,l,n]),{menuTriggerProps:d,menuProps:f}=Ae({isDisabled:i,type:`listbox`},t,n),{keyboardProps:p}=oe({shortcuts:{ArrowLeft:()=>{if(t.selectionManager.selectionMode===`multiple`)return!1;let e=t.selectedKey==null?u.getFirstKey?.():u.getKeyAbove?.(t.selectedKey);e!=null&&t.setSelectedKey(e)},ArrowRight:()=>{if(t.selectionManager.selectionMode===`multiple`)return!1;let e=t.selectedKey==null?u.getFirstKey?.():u.getKeyBelow?.(t.selectedKey);e!=null&&t.setSelectedKey(e)}},allowRepeats:!0,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp}),{typeSelectProps:m}=Oe({keyboardDelegate:u,selectionManager:t.selectionManager,onTypeSelect(e){t.setSelectedKey(e)}}),{isInvalid:h,validationErrors:g,validationDetails:_}=t.displayValidation,{labelProps:v,fieldProps:y,descriptionProps:b,errorMessageProps:x}=be({...e,labelElementType:`span`,isInvalid:h,errorMessage:e.errorMessage||g});t.selectionManager.selectionMode===`multiple`&&(m={});let S=L(e,{labelable:!0}),w=C(m,d,y),T=F();return X.set(t,{isDisabled:i,isRequired:a,name:o,form:s,validationBehavior:c}),{labelProps:{...v,onClick:()=>{e.isDisabled||(n.current?.focus(),A(`keyboard`))}},triggerProps:C(S,{...w,isDisabled:i,onKeyDown:z(w.onKeyDown,p.onKeyDown),onKeyUp:p.onKeyUp,"aria-labelledby":[T,w[`aria-labelledby`],w[`aria-label`]&&!w[`aria-labelledby`]?w.id:null].filter(Boolean).join(` `),onFocus(n){t.isFocused||(e.onFocus&&e.onFocus(n),e.onFocusChange&&e.onFocusChange(!0),t.setFocused(!0))},onBlur(n){t.isOpen||(e.onBlur&&e.onBlur(n),e.onFocusChange&&e.onFocusChange(!1),t.setFocused(!1))}}),valueProps:{id:T},menuProps:{...f,onAction:void 0,autoFocus:t.focusStrategy||!0,shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,disallowEmptySelection:!0,linkBehavior:`selection`,onBlur:n=>{j(n.currentTarget,n.relatedTarget)||(e.onBlur&&e.onBlur(n),e.onFocusChange&&e.onFocusChange(!1),t.setFocused(!1))},"aria-labelledby":[y[`aria-labelledby`],w[`aria-label`]&&!y[`aria-labelledby`]?w.id:null].filter(Boolean).join(` `)},descriptionProps:b,errorMessageProps:x,isInvalid:h,validationErrors:g,validationDetails:_,hiddenSelectProps:{isDisabled:i,name:o,label:e.label,state:t,triggerRef:n,form:s}}}function it(e,t,n){let r=X.get(t)||{},{autoComplete:a,name:o=r.name,form:s=r.form,isDisabled:c=r.isDisabled}=e,{validationBehavior:l,isRequired:u}=r,{visuallyHiddenProps:d}=i({style:{position:`fixed`,top:0,left:0}});ue(e.selectRef,t.defaultValue,t.setValue),de({validationBehavior:l,focus:()=>n.current?.focus()},t,e.selectRef);let f=t.setValue,p=(0,K.useCallback)(e=>{let t=B(e);t.multiple?f(Array.from(t.selectedOptions,e=>e.value)):f(e.currentTarget.value)},[f]);return{containerProps:{...d,"aria-hidden":!0,"data-react-aria-prevent-focus":!0,"data-a11y-ignore":`aria-hidden-focus`},inputProps:{style:{display:`none`}},selectProps:{tabIndex:-1,autoComplete:a,disabled:c,multiple:t.selectionManager.selectionMode===`multiple`,required:l===`native`&&u,name:o,form:s,value:t.value??``,onChange:p,onInput:p}}}function at(e){let{state:t,triggerRef:n,label:r,name:i,form:a,isDisabled:o}=e,s=(0,K.useRef)(null),c=(0,K.useRef)(null),{containerProps:l,selectProps:u}=it({...e,selectRef:t.collection.size<=300?s:c},t,n),d=Array.isArray(t.value)?t.value:[t.value];if(t.collection.size<=300)return K.createElement(`div`,{...l,"data-testid":`hidden-select-container`},K.createElement(`label`,null,r,K.createElement(`select`,{...u,ref:s},K.createElement(`option`,{value:``,label:`\xA0`},`\xA0`),[...t.collection.getKeys()].map(e=>{let n=t.collection.getItem(e);if(n&&n.type===`item`)return K.createElement(`option`,{key:n.key,value:n.key},n.textValue)}),t.collection.size===0&&i&&d.map((e,t)=>K.createElement(`option`,{key:t,value:e??``})))));if(i){let{validationBehavior:e}=X.get(t)||{};d.length===0&&(d=[null]);let n=d.map((t,n)=>{let r={type:`hidden`,autoComplete:u.autoComplete,name:i,form:a,disabled:o,value:t??``};return e===`native`?K.createElement(`input`,{key:n,...r,ref:n===0?c:null,style:{display:`none`},type:`text`,required:n===0&&u.required,onChange:()=>{}}):K.createElement(`input`,{key:n,...r,ref:n===0?c:null})});return K.createElement(K.Fragment,null,n)}return null}function ot(e){let{selectionMode:t=`single`,shouldCloseOnSelect:n=t===`single`}=e,r=g(e),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.defaultValue===void 0?t===`single`?e.defaultSelectedKey??null:[]:e.defaultValue,[e.defaultValue,e.defaultSelectedKey,t]),s=(0,K.useMemo)(()=>e.value===void 0?t===`single`?e.selectedKey:void 0:e.value,[e.value,e.selectedKey,t]),[c,l]=ie(s,o,e.onChange),u=t===`single`&&Array.isArray(c)?c[0]:c,d=n=>{if(t===`single`){let t=Array.isArray(n)?n[0]??null:n;l(t),t!==u&&e.onSelectionChange?.(t)}else{let e=[];Array.isArray(n)?e=n:n!=null&&(e=[n]),l(e)}},f=q({...e,selectionMode:t,disallowEmptySelection:t===`single`,allowDuplicateSelectionEvents:!0,selectedKeys:(0,K.useMemo)(()=>st(u),[u]),onSelectionChange:e=>{if(e!==`all`){if(t===`single`){let t=e.values().next().value??null;d(t)}else d([...e]);n&&r.close(),h.commitValidation()}}}),p=f.selectionManager.firstSelectedKey,m=(0,K.useMemo)(()=>[...f.selectionManager.selectedKeys].map(e=>f.collection.getItem(e)).filter(e=>e!=null),[f.selectionManager.selectedKeys,f.collection]),h=fe({...e,value:Array.isArray(u)&&u.length===0?null:u}),[_,v]=(0,K.useState)(!1),[y]=(0,K.useState)(u);return{...h,...f,...r,value:u,defaultValue:o??y,setValue:d,selectedKey:p,setSelectedKey:d,selectedItem:m[0]??null,selectedItems:m,defaultSelectedKey:e.defaultSelectedKey??(e.selectionMode===`single`?y:null),focusStrategy:i,open(t=null){(f.collection.size!==0||e.allowsEmptyCollection)&&(a(t),r.open())},toggle(t=null){(f.collection.size!==0||e.allowsEmptyCollection)&&(a(t),r.toggle())},isFocused:_,setFocused:v}}function st(e){if(e!==void 0)return e===null?[]:Array.isArray(e)?e:[e]}function ct(e={}){let{locale:t}=re();return(0,K.useMemo)(()=>new Intl.ListFormat(t,e),[t,e])}function lt(e){return e&&e.__esModule?e.default:e}var Z=(0,K.createContext)(null),Q=(0,K.createContext)(null),ut=c(function(e,t){[e,t]=P(e,t,Z);let{children:n,isDisabled:r=!1,isInvalid:i=!1,isRequired:a=!1}=e,o=(0,K.useMemo)(()=>typeof n==`function`?n({isOpen:!1,isDisabled:r,isInvalid:i,isRequired:a,isFocused:!1,isFocusVisible:!1,defaultChildren:null}):n,[n,r,i,a]);return K.createElement(f,{content:o},n=>K.createElement(ft,{props:e,collection:n,selectRef:t}))}),dt=[le,a,o];function ft({props:e,selectRef:t,collection:n}){let{validationBehavior:r}=w(se)||{},i=e.validationBehavior??r??`native`,s=ot({...e,collection:n,children:void 0,validationBehavior:i}),{isFocusVisible:c,focusProps:l}=ee({within:!0}),u=(0,K.useRef)(null),[d,f]=E(!e[`aria-label`]&&!e[`aria-labelledby`]),{labelProps:p,triggerProps:m,valueProps:h,menuProps:g,descriptionProps:_,errorMessageProps:y,hiddenSelectProps:x,...D}=rt({...S(e),label:f,validationBehavior:i},s,u),O=(0,K.useMemo)(()=>({isOpen:s.isOpen,isFocused:s.isFocused,isFocusVisible:c,isDisabled:e.isDisabled||!1,isInvalid:D.isInvalid||!1,isRequired:e.isRequired||!1}),[s.isOpen,s.isFocused,c,e.isDisabled,D.isInvalid,e.isRequired]),k=T({...e,values:O,defaultClassName:`react-aria-Select`}),A=L(e,{global:!0});delete A.id;let j=(0,K.useRef)(null);return K.createElement(v,{values:[[Z,e],[Q,s],[pt,h],[le,{...p,ref:d,elementType:`span`}],[a,{...m,ref:u,isPressed:s.isOpen,autoFocus:e.autoFocus}],[Ce,s],[Fe,{trigger:`Select`,triggerRef:u,scrollRef:j,placement:`bottom start`,"aria-labelledby":g[`aria-labelledby`],clearContexts:dt}],[J,{...g,ref:j}],[Y,s],[o,{slots:{description:_,errorMessage:y}}],[ce,D]]},K.createElement(b.div,{...C(A,k,l),ref:t,slot:e.slot||void 0,"data-focused":s.isFocused||void 0,"data-focus-visible":c||void 0,"data-open":s.isOpen||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":D.isInvalid||void 0,"data-required":e.isRequired||void 0},k.children,K.createElement(at,{...x,autoComplete:e.autoComplete})))}var pt=(0,K.createContext)(null),mt=c(function(e,t){[e,t]=P(e,t,pt);let n=(0,K.useContext)(Q),{placeholder:r}=w(Z),i=n.selectedItems.map(e=>{let t=e.props?.children;return typeof t==`function`&&(t=t({isHovered:!1,isPressed:!1,isSelected:!1,isFocused:!1,isFocusVisible:!1,isDisabled:!1,selectionMode:`single`,selectionBehavior:`toggle`})),t}),a=ct(),s=(0,K.useMemo)(()=>n.selectedItems.map(e=>e?.textValue),[n.selectedItems]),c=n.selectionManager.selectionMode,l=(0,K.useMemo)(()=>c===`single`?s[0]??``:a.format(s),[c,a,s]),u=(0,K.useMemo)(()=>{if(c===`single`)return i[0];let e=a.formatToParts(s);if(e.length===0)return null;let t=0;return e.map(e=>e.type===`element`?K.createElement(K.Fragment,{key:t},i[t++]):e.value)},[c,a,s,i]),f=d(lt(pe),`react-aria-components`),p=T({...e,defaultChildren:u??r??f.format(`selectPlaceholder`),defaultClassName:`react-aria-SelectValue`,values:{selectedItem:n.selectedItems[0]?.value??null,selectedItems:(0,K.useMemo)(()=>n.selectedItems.map(e=>e.value??null),[n.selectedItems]),selectedText:l,isPlaceholder:n.selectedItems.length===0,state:n}}),m=L(e,{global:!0});return K.createElement(b.span,{ref:t,...m,...p,"data-placeholder":n.selectedItems.length===0||void 0},K.createElement(o.Provider,{value:void 0},p.children))}),$=n(),ht=({children:e})=>(0,$.jsx)(xe,{value:!0,children:e}),gt=(0,K.createContext)({}),_t=({children:e,className:t,variant:n,...r})=>{let i=K.useMemo(()=>Re({variant:n}),[n]);return(0,$.jsx)($e,{className:M(t,i.item()),"data-slot":`list-box-item`,...r,children:t=>(0,$.jsx)(gt,{value:{slots:i,state:t},children:typeof e==`function`?e(t):e})})},vt=({children:e,className:t,...n})=>{let{slots:r,state:i}=(0,K.use)(gt),a=i?.isSelected,o=typeof e==`function`?e(i??{}):e||(0,$.jsx)(`svg`,{"aria-hidden":`true`,"data-slot":`list-box-item-indicator--checkmark`,fill:`none`,role:`presentation`,stroke:`currentColor`,strokeDasharray:22,strokeDashoffset:a?44:66,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 17 18`,children:(0,$.jsx)(`polyline`,{points:`1 9 7 14 15 4`})});return(0,$.jsx)(y.span,{"aria-hidden":`true`,className:R(r?.indicator,t),"data-slot":`list-box-item-indicator`,"data-visible":a||void 0,...n,children:o})},yt=Object.assign(_t,{Root:_t,Indicator:vt}),bt=({children:e,className:t,...n})=>{let r=K.useMemo(()=>ze({class:typeof t==`string`?t:void 0}),[t]);return(0,$.jsx)(Qe,{className:r,...n,children:e})};function xt({className:e,variant:t,...n}){let r=K.useMemo(()=>Le({variant:t}),[t]);return(0,$.jsx)(Je,{className:M(e,r),"data-slot":`list-box`,...n})}var St=Object.assign(xt,{Root:xt,Item:yt,ItemIndicator:vt,Section:bt});export{ut as a,Q as i,ht as n,q as o,mt as r,St as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/logsLink-CBayP8Zl.js b/internal/webui/static/assets/logsLink-D4LXHY_f.js similarity index 97% rename from internal/webui/static/assets/logsLink-CBayP8Zl.js rename to internal/webui/static/assets/logsLink-D4LXHY_f.js index 67ed62520..065a61eb4 100644 --- a/internal/webui/static/assets/logsLink-CBayP8Zl.js +++ b/internal/webui/static/assets/logsLink-D4LXHY_f.js @@ -1,4 +1,4 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./TimeRangePicker-BqQpwy0D.js";import{a}from"./format-FfdyoNtB.js";import{v as o,x as s}from"./index-CAlyInAP.js";import{t as c}from"./FilterToggle-BoD7X2r2.js";var l=t(e(),1),u=n();function d(e){let t=Array.from(e),n=[],r=0,i=0;for(let e=t.length-1;e>=0;e--){let a=t[e];a>=`0`&&a<=`9`?n.unshift({key:`d${r++}`,digit:a.charCodeAt(0)-48}):n.unshift({key:`s${i++}`,char:a})}return n}var f=e=>(e%10+10)%10,p=e=>1-(1-e)**4,m=(e,t)=>{e.style.transform=`translateY(${-f(t)/11*100}%)`};function h({value:e,kind:t=`int`,duration:n=900,className:r}){let i=(0,l.useMemo)(()=>a(e,t),[e,t]),o=(0,l.useMemo)(()=>d(i),[i]),s=(0,l.useRef)(null),c=(0,l.useRef)(new Map),h=(0,l.useRef)(new Map),_=(0,l.useRef)(0),v=(0,l.useRef)(!0),y=(0,l.useRef)(!1),b=(0,l.useRef)(new Set),x=(0,l.useRef)(new Set),S=new Set(o.filter(e=>`digit`in e).map(e=>e.key));for(let e of S)y.current&&!x.current.has(e)&&b.current.add(e);for(let e of b.current)S.has(e)||b.current.delete(e);return x.current=S,(0,l.useEffect)(()=>{y.current=!0},[]),(0,l.useEffect)(()=>{e!==_.current&&(v.current=e>_.current),_.current=e;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=new Set;for(let e of o){if(!(`digit`in e))continue;r.add(e.key);let n=c.current.get(e.key)??{pos:0,from:0,to:0},i=v.current?f(e.digit-n.pos):-f(n.pos-e.digit);n.from=n.pos,n.to=n.pos+i,t&&(n.pos=n.from=n.to),c.current.set(e.key,n)}for(let e of c.current.keys())r.has(e)||c.current.delete(e);let i=()=>{for(let[e,t]of c.current){let n=h.current.get(e);n&&m(n,t.pos)}};if(t)return i();let a=0,s=performance.now(),l=e=>{let t=Math.min(1,(e-s)/n),r=p(t);for(let e of c.current.values())e.pos=e.from+(e.to-e.from)*r;i(),t<1&&(a=requestAnimationFrame(l))};return a=requestAnimationFrame(l),()=>cancelAnimationFrame(a)},[o,e,n]),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`style`,{href:`ui-number-ticker`,precedence:`default`,children:g}),(0,u.jsxs)(`span`,{ref:s,className:[`ui-nt`,r].filter(Boolean).join(` `),"aria-live":`polite`,children:[(0,u.jsx)(`span`,{className:`ui-nt__sr`,children:i}),(0,u.jsx)(`span`,{className:`ui-nt__track`,"aria-hidden":`true`,children:o.map(e=>`digit`in e?(0,u.jsx)(`span`,{className:`ui-nt__col`,"data-enter":b.current.has(e.key)||void 0,children:(0,u.jsx)(`span`,{className:`ui-nt__stack`,ref:t=>{if(t)return h.current.set(e.key,t),m(t,c.current.get(e.key)?.pos??0),()=>{h.current.get(e.key)===t&&h.current.delete(e.key)}},children:[0,1,2,3,4,5,6,7,8,9,0].map((e,t)=>(0,u.jsx)(`span`,{className:`ui-nt__cell`,children:e},t))})},e.key):(0,u.jsx)(`span`,{className:`ui-nt__static`,children:e.char},e.key))})]})]})}var g=` +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{n as r,t as i}from"./TimeRangePicker-C8MnQbdC.js";import{a}from"./format-BAkFbjAh.js";import{v as o,x as s}from"./index-CWTBzWuK.js";import{t as c}from"./FilterToggle-CbYR8o3t.js";var l=t(e(),1),u=n();function d(e){let t=Array.from(e),n=[],r=0,i=0;for(let e=t.length-1;e>=0;e--){let a=t[e];a>=`0`&&a<=`9`?n.unshift({key:`d${r++}`,digit:a.charCodeAt(0)-48}):n.unshift({key:`s${i++}`,char:a})}return n}var f=e=>(e%10+10)%10,p=e=>1-(1-e)**4,m=(e,t)=>{e.style.transform=`translateY(${-f(t)/11*100}%)`};function h({value:e,kind:t=`int`,duration:n=900,className:r}){let i=(0,l.useMemo)(()=>a(e,t),[e,t]),o=(0,l.useMemo)(()=>d(i),[i]),s=(0,l.useRef)(null),c=(0,l.useRef)(new Map),h=(0,l.useRef)(new Map),_=(0,l.useRef)(0),v=(0,l.useRef)(!0),y=(0,l.useRef)(!1),b=(0,l.useRef)(new Set),x=(0,l.useRef)(new Set),S=new Set(o.filter(e=>`digit`in e).map(e=>e.key));for(let e of S)y.current&&!x.current.has(e)&&b.current.add(e);for(let e of b.current)S.has(e)||b.current.delete(e);return x.current=S,(0,l.useEffect)(()=>{y.current=!0},[]),(0,l.useEffect)(()=>{e!==_.current&&(v.current=e>_.current),_.current=e;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=new Set;for(let e of o){if(!(`digit`in e))continue;r.add(e.key);let n=c.current.get(e.key)??{pos:0,from:0,to:0},i=v.current?f(e.digit-n.pos):-f(n.pos-e.digit);n.from=n.pos,n.to=n.pos+i,t&&(n.pos=n.from=n.to),c.current.set(e.key,n)}for(let e of c.current.keys())r.has(e)||c.current.delete(e);let i=()=>{for(let[e,t]of c.current){let n=h.current.get(e);n&&m(n,t.pos)}};if(t)return i();let a=0,s=performance.now(),l=e=>{let t=Math.min(1,(e-s)/n),r=p(t);for(let e of c.current.values())e.pos=e.from+(e.to-e.from)*r;i(),t<1&&(a=requestAnimationFrame(l))};return a=requestAnimationFrame(l),()=>cancelAnimationFrame(a)},[o,e,n]),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`style`,{href:`ui-number-ticker`,precedence:`default`,children:g}),(0,u.jsxs)(`span`,{ref:s,className:[`ui-nt`,r].filter(Boolean).join(` `),"aria-live":`polite`,children:[(0,u.jsx)(`span`,{className:`ui-nt__sr`,children:i}),(0,u.jsx)(`span`,{className:`ui-nt__track`,"aria-hidden":`true`,children:o.map(e=>`digit`in e?(0,u.jsx)(`span`,{className:`ui-nt__col`,"data-enter":b.current.has(e.key)||void 0,children:(0,u.jsx)(`span`,{className:`ui-nt__stack`,ref:t=>{if(t)return h.current.set(e.key,t),m(t,c.current.get(e.key)?.pos??0),()=>{h.current.get(e.key)===t&&h.current.delete(e.key)}},children:[0,1,2,3,4,5,6,7,8,9,0].map((e,t)=>(0,u.jsx)(`span`,{className:`ui-nt__cell`,children:e},t))})},e.key):(0,u.jsx)(`span`,{className:`ui-nt__static`,children:e.char},e.key))})]})]})}var g=` .ui-nt { --ui-nt-lh: 1.15em; --ui-nt-ease: cubic-bezier(0.22, 1, 0.36, 1); diff --git a/internal/webui/static/assets/modal-CQ6c3Rhf.js b/internal/webui/static/assets/modal-6BQxrL1y.js similarity index 96% rename from internal/webui/static/assets/modal-CQ6c3Rhf.js rename to internal/webui/static/assets/modal-6BQxrL1y.js index 823c290ba..028f46aac 100644 --- a/internal/webui/static/assets/modal-CQ6c3Rhf.js +++ b/internal/webui/static/assets/modal-6BQxrL1y.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{I as r}from"./useI18n-XrvNxGvP.js";import{B as i,J as a,c as o,s,z as c}from"./SharedElementTransition-BlCsXfb1.js";import{t as l}from"./Pressable-cqucQpxg.js";import{B as u,H as d,St as f,U as p,V as m,z as h}from"./index-CAlyInAP.js";var g=c({defaultVariants:{scroll:`inside`,size:`md`,variant:`opaque`},slots:{backdrop:`modal__backdrop`,body:`modal__body`,closeTrigger:`modal__close-trigger`,container:`modal__container`,dialog:`modal__dialog`,footer:`modal__footer`,header:`modal__header`,heading:`modal__heading`,icon:`modal__icon`,trigger:`modal__trigger`},variants:{scroll:{inside:{body:`modal__body--scroll-inside`,dialog:`modal__dialog--scroll-inside`},outside:{body:`modal__body--scroll-outside`,container:`modal__container--scroll-outside`,dialog:`modal__dialog--scroll-outside`}},size:{cover:{dialog:`modal__dialog--cover`},full:{container:`modal__container--full`,dialog:`modal__dialog--full`},lg:{dialog:`modal__dialog--lg`},md:{dialog:`modal__dialog--md`},sm:{dialog:`modal__dialog--sm`},xs:{dialog:`modal__dialog--xs`}},variant:{blur:{backdrop:`modal__backdrop--blur`},opaque:{backdrop:`modal__backdrop--opaque`},transparent:{backdrop:`modal__backdrop--transparent`}}}}),_=t(e(),1),v=n(),y=(0,_.createContext)({}),b=({children:e,state:t,...n})=>{let r=(0,_.useMemo)(()=>({slots:g(),placement:void 0}),[]),i=(0,_.useMemo)(()=>t?{isOpen:t.isOpen,onOpenChange:t.setOpen}:{},[t]);return(0,v.jsx)(y,{value:r,children:(0,v.jsx)(d,{"data-slot":`modal-root`,...a(n,i),children:e})})},x=Object.assign(b,{Root:b,Trigger:({children:e,className:t,...n})=>{let{slots:r}=(0,_.use)(y);return(0,v.jsx)(l,{children:(0,v.jsx)(i.div,{className:s(r?.trigger,t),"data-slot":`modal-trigger`,role:`button`,...n,children:e})})},Backdrop:({children:e,className:t,isDismissable:n=!0,onClick:r,variant:i,...a})=>{let{slots:s}=(0,_.use)(y),c=(0,_.useMemo)(()=>g({variant:i}),[i]),l=(0,_.useMemo)(()=>({slots:{...s,...c}}),[s,c]);return(0,v.jsx)(m,{className:o(t,c?.backdrop()),"data-slot":`modal-backdrop`,isDismissable:n,onClick:e=>{e.stopPropagation(),r?.(e)},...a,children:t=>(0,v.jsxs)(y,{value:l,children:[typeof e==`function`?e(t):e,` `]})})},Container:({children:e,className:t,placement:n=`auto`,scroll:r,size:i,...a})=>{let{slots:s}=(0,_.use)(y),c=(0,_.useMemo)(()=>g({scroll:r,size:i}),[r,i]),l=(0,_.useMemo)(()=>({placement:n,slots:{...s,...c}}),[s,n,c]);return(0,v.jsx)(u,{className:o(t,c?.container()),"data-placement":n,"data-slot":`modal-container`,...a,children:t=>(0,v.jsx)(y,{value:l,children:typeof e==`function`?e(t):e})})},Dialog:({children:e,className:t,...n})=>{let{placement:i,slots:a}=(0,_.use)(y);return(0,v.jsx)(r,{value:{variant:`default`},children:(0,v.jsx)(p,{className:s(a?.dialog,t),"data-placement":i,"data-slot":`modal-dialog`,...n,children:e})})},Header:({children:e,className:t,...n})=>{let{slots:r}=(0,_.use)(y);return(0,v.jsx)(i.div,{className:s(r?.header,t),"data-slot":`modal-header`,...n,children:e})},Icon:({children:e,className:t,...n})=>{let{slots:r}=(0,_.use)(y);return(0,v.jsx)(i.div,{className:s(r?.icon,t),"data-slot":`modal-icon`,...n,children:e})},Heading:({children:e,className:t,...n})=>{let{slots:r}=(0,_.use)(y);return(0,v.jsx)(f,{className:s(r?.heading,t),"data-slot":`modal-heading`,slot:`title`,...n,children:e})},Body:({children:e,className:t,...n})=>{let{slots:r}=(0,_.use)(y);return(0,v.jsx)(i.div,{className:s(r?.body,t),"data-slot":`modal-body`,...n,children:e})},Footer:({children:e,className:t,...n})=>{let{slots:r}=(0,_.use)(y);return(0,v.jsx)(i.div,{className:s(r?.footer,t),"data-slot":`modal-footer`,...n,children:e})},CloseTrigger:({className:e,...t})=>{let{slots:n}=(0,_.use)(y);return(0,v.jsx)(h,{className:o(e,n?.closeTrigger()),"data-slot":`modal-close-trigger`,slot:`close`,...t})}});export{x as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{I as r}from"./useI18n-BAo1UrJW.js";import{B as i,J as a,c as o,s,z as c}from"./SharedElementTransition-BlCsXfb1.js";import{t as l}from"./Pressable-cqucQpxg.js";import{B as u,H as d,St as f,U as p,V as m,z as h}from"./index-CWTBzWuK.js";var g=c({defaultVariants:{scroll:`inside`,size:`md`,variant:`opaque`},slots:{backdrop:`modal__backdrop`,body:`modal__body`,closeTrigger:`modal__close-trigger`,container:`modal__container`,dialog:`modal__dialog`,footer:`modal__footer`,header:`modal__header`,heading:`modal__heading`,icon:`modal__icon`,trigger:`modal__trigger`},variants:{scroll:{inside:{body:`modal__body--scroll-inside`,dialog:`modal__dialog--scroll-inside`},outside:{body:`modal__body--scroll-outside`,container:`modal__container--scroll-outside`,dialog:`modal__dialog--scroll-outside`}},size:{cover:{dialog:`modal__dialog--cover`},full:{container:`modal__container--full`,dialog:`modal__dialog--full`},lg:{dialog:`modal__dialog--lg`},md:{dialog:`modal__dialog--md`},sm:{dialog:`modal__dialog--sm`},xs:{dialog:`modal__dialog--xs`}},variant:{blur:{backdrop:`modal__backdrop--blur`},opaque:{backdrop:`modal__backdrop--opaque`},transparent:{backdrop:`modal__backdrop--transparent`}}}}),_=t(e(),1),v=n(),y=(0,_.createContext)({}),b=({children:e,state:t,...n})=>{let r=(0,_.useMemo)(()=>({slots:g(),placement:void 0}),[]),i=(0,_.useMemo)(()=>t?{isOpen:t.isOpen,onOpenChange:t.setOpen}:{},[t]);return(0,v.jsx)(y,{value:r,children:(0,v.jsx)(d,{"data-slot":`modal-root`,...a(n,i),children:e})})},x=Object.assign(b,{Root:b,Trigger:({children:e,className:t,...n})=>{let{slots:r}=(0,_.use)(y);return(0,v.jsx)(l,{children:(0,v.jsx)(i.div,{className:s(r?.trigger,t),"data-slot":`modal-trigger`,role:`button`,...n,children:e})})},Backdrop:({children:e,className:t,isDismissable:n=!0,onClick:r,variant:i,...a})=>{let{slots:s}=(0,_.use)(y),c=(0,_.useMemo)(()=>g({variant:i}),[i]),l=(0,_.useMemo)(()=>({slots:{...s,...c}}),[s,c]);return(0,v.jsx)(m,{className:o(t,c?.backdrop()),"data-slot":`modal-backdrop`,isDismissable:n,onClick:e=>{e.stopPropagation(),r?.(e)},...a,children:t=>(0,v.jsxs)(y,{value:l,children:[typeof e==`function`?e(t):e,` `]})})},Container:({children:e,className:t,placement:n=`auto`,scroll:r,size:i,...a})=>{let{slots:s}=(0,_.use)(y),c=(0,_.useMemo)(()=>g({scroll:r,size:i}),[r,i]),l=(0,_.useMemo)(()=>({placement:n,slots:{...s,...c}}),[s,n,c]);return(0,v.jsx)(u,{className:o(t,c?.container()),"data-placement":n,"data-slot":`modal-container`,...a,children:t=>(0,v.jsx)(y,{value:l,children:typeof e==`function`?e(t):e})})},Dialog:({children:e,className:t,...n})=>{let{placement:i,slots:a}=(0,_.use)(y);return(0,v.jsx)(r,{value:{variant:`default`},children:(0,v.jsx)(p,{className:s(a?.dialog,t),"data-placement":i,"data-slot":`modal-dialog`,...n,children:e})})},Header:({children:e,className:t,...n})=>{let{slots:r}=(0,_.use)(y);return(0,v.jsx)(i.div,{className:s(r?.header,t),"data-slot":`modal-header`,...n,children:e})},Icon:({children:e,className:t,...n})=>{let{slots:r}=(0,_.use)(y);return(0,v.jsx)(i.div,{className:s(r?.icon,t),"data-slot":`modal-icon`,...n,children:e})},Heading:({children:e,className:t,...n})=>{let{slots:r}=(0,_.use)(y);return(0,v.jsx)(f,{className:s(r?.heading,t),"data-slot":`modal-heading`,slot:`title`,...n,children:e})},Body:({children:e,className:t,...n})=>{let{slots:r}=(0,_.use)(y);return(0,v.jsx)(i.div,{className:s(r?.body,t),"data-slot":`modal-body`,...n,children:e})},Footer:({children:e,className:t,...n})=>{let{slots:r}=(0,_.use)(y);return(0,v.jsx)(i.div,{className:s(r?.footer,t),"data-slot":`modal-footer`,...n,children:e})},CloseTrigger:({className:e,...t})=>{let{slots:n}=(0,_.use)(y);return(0,v.jsx)(h,{className:o(e,n?.closeTrigger()),"data-slot":`modal-close-trigger`,slot:`close`,...t})}});export{x as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/number-field-BUGr_bpm.js b/internal/webui/static/assets/number-field-BQgq-gwR.js similarity index 98% rename from internal/webui/static/assets/number-field-BUGr_bpm.js rename to internal/webui/static/assets/number-field-BQgq-gwR.js index 236872ee8..44a37e5de 100644 --- a/internal/webui/static/assets/number-field-BUGr_bpm.js +++ b/internal/webui/static/assets/number-field-BQgq-gwR.js @@ -1 +1 @@ -import{a as e,c as t,i as n,n as r}from"./shim-mfK0Rmj6.js";import{G as i,Q as a,W as o,X as s,Z as c,a as l,k as u,nt as d,ot as f,rt as p}from"./useI18n-XrvNxGvP.js";import{$ as m,A as h,Ct as g,F as _,I as v,J as y,L as b,M as x,N as S,S as ee,W as C,c as w,dt as T,f as te,j as ne,k as E,l as D,lt as O,q as k,tt as A,vt as j,x as re,xt as ie,z as ae}from"./SharedElementTransition-BlCsXfb1.js";import{a as M,d as oe,f as N,p as se,s as ce,u as le}from"./label-B8hTan2F.js";import{a as P,i as ue,n as F,t as de}from"./Input-CyXcxaPW.js";import{n as I,r as L,t as fe}from"./useSpinButton-B6uyFe9J.js";import{t as pe}from"./useTextField-i0qH61mD.js";var me=ae({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`number-field`,decrementButton:`number-field__decrement-button`,group:`number-field__group`,incrementButton:`number-field__increment-button`,input:`number-field__input`},variants:{fullWidth:{false:{},true:{base:`number-field--full-width`,group:`number-field__group--full-width`}},variant:{primary:{base:`number-field--primary`},secondary:{base:`number-field--secondary`}}}}),R=t(e(),1);function he(e={}){let{locale:t}=E();return(0,R.useMemo)(()=>new L(t,e),[t,e])}function z(){return typeof window<`u`&&window.InputEvent&&typeof InputEvent.prototype.getTargetRanges==`function`}function ge(e,t,n){let r=C(e=>{let r=n.current;if(!r)return;let i=null;switch(e.inputType){case`historyUndo`:case`historyRedo`:return;case`insertLineBreak`:return;case`deleteContent`:case`deleteByCut`:case`deleteByDrag`:i=r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case`deleteContentForward`:i=r.selectionEnd===r.selectionStart?r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd+1):r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case`deleteContentBackward`:i=r.selectionEnd===r.selectionStart?r.value.slice(0,r.selectionStart-1)+r.value.slice(r.selectionStart):r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case`deleteSoftLineBackward`:case`deleteHardLineBackward`:i=r.value.slice(r.selectionStart);break;default:e.data!=null&&(i=r.value.slice(0,r.selectionStart)+e.data+r.value.slice(r.selectionEnd))}(i==null||!t.validate(i))&&e.preventDefault()});(0,R.useEffect)(()=>{if(!z()||!n.current)return;let e=n.current;return e.addEventListener(`beforeinput`,r,!1),()=>{e.removeEventListener(`beforeinput`,r,!1)}},[n]);let i=z()?null:e=>{let n=A(e).value.slice(0,A(e).selectionStart)+e.data+A(e).value.slice(A(e).selectionEnd);t.validate(n)||e.preventDefault()},{labelProps:a,inputProps:o,descriptionProps:s,errorMessageProps:c,...l}=pe(e,n),u=(0,R.useRef)(null);return{inputProps:y(o,{onBeforeInput:i,onCompositionStart(){let{value:e,selectionStart:t,selectionEnd:r}=n.current;u.current={value:e,selectionStart:t,selectionEnd:r}},onCompositionEnd(){if(n.current&&!t.validate(n.current.value)){let{value:e,selectionStart:r,selectionEnd:i}=u.current;n.current.value=e,n.current.setSelectionRange(r,i),t.setInputValue(e)}}}),labelProps:a,descriptionProps:s,errorMessageProps:c,...l}}function _e(e,t){let{onScroll:n,isDisabled:r}=e,i=(0,R.useCallback)(e=>{e.ctrlKey||(e.preventDefault(),e.stopPropagation(),n&&n({deltaX:e.deltaX,deltaY:e.deltaY}))},[n]);f(t,`wheel`,r?void 0:i)}var ve={};ve={decrease:e=>`\u{62E}\u{641}\u{636} ${e.fieldLabel}`,increase:e=>`\u{632}\u{64A}\u{627}\u{62F}\u{629} ${e.fieldLabel}`,numberField:`حقل رقمي`};var ye={};ye={decrease:e=>`\u{41D}\u{430}\u{43C}\u{430}\u{43B}\u{44F}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{441}\u{438}\u{43B}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,numberField:`Номер на полето`};var be={};be={decrease:e=>`Sn\xed\u{17E}it ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}it ${e.fieldLabel}`,numberField:`Číselné pole`};var xe={};xe={decrease:e=>`Reducer ${e.fieldLabel}`,increase:e=>`\xd8g ${e.fieldLabel}`,numberField:`Talfelt`};var Se={};Se={decrease:e=>`${e.fieldLabel} verringern`,increase:e=>`${e.fieldLabel} erh\xf6hen`,numberField:`Nummernfeld`};var Ce={};Ce={decrease:e=>`\u{39C}\u{3B5}\u{3AF}\u{3C9}\u{3C3}\u{3B7} ${e.fieldLabel}`,increase:e=>`\u{391}\u{3CD}\u{3BE}\u{3B7}\u{3C3}\u{3B7} ${e.fieldLabel}`,numberField:`Πεδίο αριθμού`};var we={};we={decrease:e=>`Decrease ${e.fieldLabel}`,increase:e=>`Increase ${e.fieldLabel}`,numberField:`Number field`};var B={};B={decrease:e=>`Reducir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:`Campo de número`};var V={};V={decrease:e=>`V\xe4henda ${e.fieldLabel}`,increase:e=>`Suurenda ${e.fieldLabel}`,numberField:`Numbri väli`};var H={};H={decrease:e=>`V\xe4henn\xe4 ${e.fieldLabel}`,increase:e=>`Lis\xe4\xe4 ${e.fieldLabel}`,numberField:`Numerokenttä`};var Te={};Te={decrease:e=>`Diminuer ${e.fieldLabel}`,increase:e=>`Augmenter ${e.fieldLabel}`,numberField:`Champ de nombre`};var Ee={};Ee={decrease:e=>`\u{5D4}\u{5E7}\u{5D8}\u{5DF} ${e.fieldLabel}`,increase:e=>`\u{5D4}\u{5D2}\u{5D3}\u{5DC} ${e.fieldLabel}`,numberField:`שדה מספר`};var De={};De={decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:`Polje broja`};var Oe={};Oe={decrease:e=>`${e.fieldLabel} cs\xf6kkent\xe9se`,increase:e=>`${e.fieldLabel} n\xf6vel\xe9se`,numberField:`Számmező`};var U={};U={decrease:e=>`Riduci ${e.fieldLabel}`,increase:e=>`Aumenta ${e.fieldLabel}`,numberField:`Campo numero`};var ke={};ke={decrease:e=>`${e.fieldLabel}\u{3092}\u{7E2E}\u{5C0F}`,increase:e=>`${e.fieldLabel}\u{3092}\u{62E1}\u{5927}`,numberField:`数値フィールド`};var Ae={};Ae={decrease:e=>`${e.fieldLabel} \u{AC10}\u{C18C}`,increase:e=>`${e.fieldLabel} \u{C99D}\u{AC00}`,numberField:`번호 필드`};var W={};W={decrease:e=>`Suma\u{17E}inti ${e.fieldLabel}`,increase:e=>`Padidinti ${e.fieldLabel}`,numberField:`Numerio laukas`};var je={};je={decrease:e=>`Samazin\u{101}\u{161}ana ${e.fieldLabel}`,increase:e=>`Palielin\u{101}\u{161}ana ${e.fieldLabel}`,numberField:`Skaitļu lauks`};var Me={};Me={decrease:e=>`Reduser ${e.fieldLabel}`,increase:e=>`\xd8k ${e.fieldLabel}`,numberField:`Tallfelt`};var Ne={};Ne={decrease:e=>`${e.fieldLabel} verlagen`,increase:e=>`${e.fieldLabel} verhogen`,numberField:`Getalveld`};var Pe={};Pe={decrease:e=>`Zmniejsz ${e.fieldLabel}`,increase:e=>`Zwi\u{119}ksz ${e.fieldLabel}`,numberField:`Pole numeru`};var G={};G={decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:`Campo de número`};var K={};K={decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:`Campo numérico`};var q={};q={decrease:e=>`Sc\u{103}dere ${e.fieldLabel}`,increase:e=>`Cre\u{219}tere ${e.fieldLabel}`,numberField:`Câmp numeric`};var J={};J={decrease:e=>`\u{423}\u{43C}\u{435}\u{43D}\u{44C}\u{448}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{432}\u{435}\u{43B}\u{438}\u{447}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,numberField:`Числовое поле`};var Y={};Y={decrease:e=>`Zn\xed\u{17E}i\u{165} ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}i\u{165} ${e.fieldLabel}`,numberField:`Číselné pole`};var X={};X={decrease:e=>`Upadati ${e.fieldLabel}`,increase:e=>`Pove\u{10D}ajte ${e.fieldLabel}`,numberField:`Številčno polje`};var Fe={};Fe={decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:`Polje broja`};var Ie={};Ie={decrease:e=>`Minska ${e.fieldLabel}`,increase:e=>`\xd6ka ${e.fieldLabel}`,numberField:`Nummerfält`};var Le={};Le={decrease:e=>`${e.fieldLabel} azalt`,increase:e=>`${e.fieldLabel} artt\u{131}r`,numberField:`Sayı alanı`};var Re={};Re={decrease:e=>`\u{417}\u{43C}\u{435}\u{43D}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,increase:e=>`\u{417}\u{431}\u{456}\u{43B}\u{44C}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,numberField:`Поле номера`};var ze={};ze={decrease:e=>`\u{964D}\u{4F4E} ${e.fieldLabel}`,increase:e=>`\u{63D0}\u{9AD8} ${e.fieldLabel}`,numberField:`数字字段`};var Be={};Be={decrease:e=>`\u{7E2E}\u{5C0F} ${e.fieldLabel}`,increase:e=>`\u{653E}\u{5927} ${e.fieldLabel}`,numberField:`數字欄位`};var Ve={};Ve={"ar-AE":ve,"bg-BG":ye,"cs-CZ":be,"da-DK":xe,"de-DE":Se,"el-GR":Ce,"en-US":we,"es-ES":B,"et-EE":V,"fi-FI":H,"fr-FR":Te,"he-IL":Ee,"hr-HR":De,"hu-HU":Oe,"it-IT":U,"ja-JP":ke,"ko-KR":Ae,"lt-LT":W,"lv-LV":je,"nb-NO":Me,"nl-NL":Ne,"pl-PL":Pe,"pt-BR":G,"pt-PT":K,"ro-RO":q,"ru-RU":J,"sk-SK":Y,"sl-SI":X,"sr-SP":Fe,"sv-SE":Ie,"tr-TR":Le,"uk-UA":Re,"zh-CN":ze,"zh-TW":Be};var He=t(n(),1);function Ue(e){return e&&e.__esModule?e.default:e}function We(e,t,n){let{id:r,decrementAriaLabel:i,incrementAriaLabel:o,isDisabled:s,isReadOnly:c,isRequired:l,minValue:d,maxValue:f,autoFocus:p,label:h,formatOptions:_,onBlur:v=()=>{},onFocus:b,onFocusChange:x,onKeyDown:S,onKeyUp:C,description:w,errorMessage:T,isWheelDisabled:ne,...E}=e,{increment:D,incrementToMax:ae,decrement:M,decrementToMin:oe,numberValue:N,inputValue:le,commit:P,commitValidation:ue}=t,F=u(Ue(Ve),`@react-aria/numberfield`),de=(0,R.useCallback)(()=>{let e=n.current?.value??``;(0,He.flushSync)(()=>{P()}),n.current?.value!==e&&a(n.current?.value??``,`assertive`)},[P,n]),I=O(r),{focusProps:L}=ee({onBlur(){de()}}),pe=he(_),me=(0,R.useMemo)(()=>pe.resolvedOptions(),[pe]),z=he({..._,currencySign:void 0}),ve=(0,R.useMemo)(()=>isNaN(N)?``:z.format(N),[z,N]),{spinButtonProps:ye,incrementButtonProps:be,decrementButtonProps:xe}=fe({isDisabled:s,isReadOnly:c,isRequired:l,maxValue:f,minValue:d,onIncrement:D,onIncrementToMax:ae,onDecrement:M,onDecrementToMin:oe,value:N,textValue:ve}),[Se,Ce]=(0,R.useState)(!1),{focusWithinProps:we}=te({isDisabled:s,onFocusWithinChange:Ce});_e({onScroll:(0,R.useCallback)(e=>{Math.abs(e.deltaY)<=Math.abs(e.deltaX)||(e.deltaY>0?D():e.deltaY<0&&M())},[M,D]),isDisabled:ne||s||c||!Se},n);let B=(me.maximumFractionDigits??0)>0,V=t.minValue===void 0||isNaN(t.minValue)||t.minValue<0,H=`numeric`;j()?V?H=`text`:B&&(H=`decimal`):ie()&&(V?H=`numeric`:B&&(H=`decimal`));let Te=e=>{t.validate(e)&&t.setInputValue(e)},Ee=t=>{e.onPaste?.(t);let n=A(t);n&&(n.selectionEnd??-1)-(n.selectionStart??0)===n.value.length&&(t.preventDefault(),P(t.clipboardData?.getData?.(`text/plain`)?.trim()??``))},De=k(e),{keyboardProps:Oe}=re({isDisabled:s||c,shortcuts:{Enter:()=>((0,He.flushSync)(()=>{P()}),ue(),{shouldPreventDefault:!1})},onKeyDown:S,onKeyUp:C}),{isInvalid:U,validationErrors:ke,validationDetails:Ae}=t.displayValidation,{labelProps:W,inputProps:je,descriptionProps:Me,errorMessageProps:Ne}=ge({...E,...De,name:void 0,form:void 0,label:h,autoFocus:p,isDisabled:s,isReadOnly:c,isRequired:l,validate:void 0,[ce]:t,value:le,defaultValue:`!`,autoComplete:`off`,"aria-label":e[`aria-label`]||void 0,"aria-labelledby":e[`aria-labelledby`]||void 0,id:I,type:`text`,inputMode:H,onChange:Te,onBlur:v,onFocus:b,onFocusChange:x,onPaste:Ee,description:w,errorMessage:T},t,n),Pe=y(Oe,je);se(n,t.defaultNumberValue,t.setNumberValue),Ge(t,e.validationBehavior,e.commitBehavior,n,t.minValue,t.maxValue,e.step,t.numberValue);let G=y(ye,L,Pe,{role:null,"aria-roledescription":g()?null:F.format(`numberField`),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:`off`,spellCheck:`false`});e.validationBehavior===`native`&&(G[`aria-required`]=void 0);let K=e=>{m()!==n.current&&(e.pointerType===`mouse`?n.current?.focus():e.target.focus())},q=e[`aria-label`]||(typeof e.label==`string`?e.label:``),J;q||(J=e.label==null?e[`aria-labelledby`]:W.id);let Y=O(),X=O(),Fe=y(be,{"aria-label":o||F.format(`increase`,{fieldLabel:q}).trim(),id:J&&!o?Y:null,"aria-labelledby":J&&!o?`${Y} ${J}`:null,"aria-controls":I,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canIncrement,onPressStart:K}),Ie=y(xe,{"aria-label":i||F.format(`decrease`,{fieldLabel:q}).trim(),id:J&&!i?X:null,"aria-labelledby":J&&!i?`${X} ${J}`:null,"aria-controls":I,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canDecrement,onPressStart:K});return{groupProps:{...we,role:`group`,"aria-disabled":s,"aria-invalid":U?`true`:void 0},labelProps:W,inputProps:G,incrementButtonProps:Fe,decrementButtonProps:Ie,errorMessageProps:Ne,descriptionProps:Me,isInvalid:U,validationErrors:ke,validationDetails:Ae}}var Z=null;function Ge(e,t,n,r,i,a,o,s){T(()=>{let c=r.current;if(n!==`validate`||e.realtimeValidation.isInvalid||!c||c.disabled||(!Z&&typeof document<`u`&&(Z=document.createElement(`input`),Z.type=`number`),!Z))return;Z.min=i!=null&&!isNaN(i)?String(i):``,Z.max=a!=null&&!isNaN(a)?String(a):``,Z.step=o!=null&&!isNaN(o)?String(o):``,Z.value=s!=null&&!isNaN(s)?String(s):``;let l=c.validity.valid&&Z.validity.valid,u=c.validationMessage||Z.validationMessage,d={isInvalid:!l,validationErrors:u?[u]:[],validationDetails:{badInput:c.validity.badInput,customError:c.validity.customError,patternMismatch:c.validity.patternMismatch,rangeOverflow:Z.validity.rangeOverflow,rangeUnderflow:Z.validity.rangeUnderflow,stepMismatch:Z.validity.stepMismatch,tooLong:c.validity.tooLong,tooShort:c.validity.tooShort,typeMismatch:c.validity.typeMismatch,valueMissing:c.validity.valueMissing,valid:l}};e.updateValidation(d),t===`native`&&!Z.validity.valid&&c.setCustomValidity(Z.validationMessage)})}function Ke(e){let{minValue:t,maxValue:n,step:r,formatOptions:i,value:a,defaultValue:o=NaN,onChange:s,locale:c,isDisabled:l,isReadOnly:u,commitBehavior:f=`snap`}=e;a===null&&(a=NaN);let m=(0,R.useCallback)(e=>r===void 0||isNaN(r)?d(e,t,n):p(e,t,n,r),[r,t,n]);a!==void 0&&!isNaN(a)&&f===`snap`&&(a=m(a)),!isNaN(o)&&f===`snap`&&(o=m(o));let[h,g]=D(a,isNaN(o)?NaN:o,s),[_]=(0,R.useState)(h),[v,y]=(0,R.useState)(()=>isNaN(h)?``:new L(c,i).format(h)),b=(0,R.useMemo)(()=>new I(c,i),[c,i]),x=(0,R.useMemo)(()=>b.getNumberingSystem(v),[b,v]),S=(0,R.useMemo)(()=>new L(c,{...i,numberingSystem:x}),[c,i,x]),ee=(0,R.useMemo)(()=>S.resolvedOptions(),[S]),C=(0,R.useCallback)(e=>isNaN(e)||e===null?``:S.format(e),[S]),w=le({...e,value:h}),T=r!==void 0&&!isNaN(r)?r:1;ee.style===`percent`&&(r===void 0||isNaN(r))&&(T=.01);let[te,ne]=(0,R.useState)(h),[E,O]=(0,R.useState)(c),[k,A]=(0,R.useState)(i);(!Object.is(h,te)||c!==E||!qe(i,k))&&(y(C(h)),ne(h),O(c),A(i));let j=(0,R.useMemo)(()=>b.parse(v),[b,v]),re=e=>{let t=e===void 0?v:e,n=j;if(e!==void 0&&(n=b.parse(t)),!t.length){g(NaN),y(a===void 0?``:C(h));return}if(isNaN(n)){y(C(h));return}let r=f===`snap`?m(n):n;r=b.parse(C(r));let i=r!==h;g(r),y(C(a===void 0?r:h)),i&&w.commitValidation()},ie=(e,r=0)=>{let i=j;if(isNaN(i))return p(isNaN(r)?0:r,t,n,T);{let r=p(i,t,n,T);return e===`+`&&r>i||e===`-`&&r{let e=ie(`+`,t);e===h&&y(C(e)),g(e),w.commitValidation()},M=()=>{let e=ie(`-`,n);e===h&&y(C(e)),g(e),w.commitValidation()},oe=()=>{n!=null&&(g(p(n,t,n,T)),w.commitValidation())},N=()=>{t!=null&&(g(t),w.commitValidation())},se=(0,R.useMemo)(()=>!l&&!u&&(isNaN(j)||n===void 0||isNaN(n)||p(j,t,n,T)>j||Je(`+`,j,T)<=n),[l,u,t,n,T,j]),ce=(0,R.useMemo)(()=>!l&&!u&&(isNaN(j)||t===void 0||isNaN(t)||p(j,t,n,T)=t),[l,u,t,n,T,j]),P=e=>b.isValidPartialNumber(e,t,n);return{...w,validate:P,increment:ae,incrementToMax:oe,decrement:M,decrementToMin:N,canIncrement:se,canDecrement:ce,minValue:t,maxValue:n,numberValue:j,defaultNumberValue:isNaN(o)?_:o,setNumberValue:g,setInputValue:y,inputValue:v,commit:re}}function qe(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(t[r]!==e[r])return!1;return!0}function Je(e,t,n){let r=e===`+`?t+n:t-n;if(t%1!=0||n%1!=0){let i=t.toString().split(`.`),a=n.toString().split(`.`),o=i[1]&&i[1].length||0,s=a[1]&&a[1].length||0,c=10**Math.max(o,s);t=Math.round(t*c),n=Math.round(n*c),r=e===`+`?t+n:t-n,r/=c}return r}var Ye=(0,R.createContext)(null),Xe=(0,R.createContext)(null),Ze=(0,R.forwardRef)(function(e,t){[e,t]=ne(e,t,Ye);let{validationBehavior:n}=b(M)||{},r=e.validationBehavior??n??`native`,{locale:i}=E(),a=Ke({...e,locale:i,validationBehavior:r}),o=(0,R.useRef)(null),[c,u]=S(!e[`aria-label`]&&!e[`aria-labelledby`]),{labelProps:d,groupProps:f,inputProps:p,incrementButtonProps:m,decrementButtonProps:g,descriptionProps:y,errorMessageProps:ee,...C}=We({...v(e),label:u,validationBehavior:r},a,o),w=x({...e,values:{state:a,isDisabled:e.isDisabled||!1,isInvalid:C.isInvalid||!1,isRequired:e.isRequired||!1,isReadOnly:e.isReadOnly||!1},defaultClassName:`react-aria-NumberField`}),T=k(e,{global:!0});return delete T.id,R.createElement(h,{values:[[Xe,a],[P,f],[de,{...p,ref:o}],[N,{...d,ref:c}],[s,{slots:{increment:m,decrement:g}}],[l,{slots:{description:y,errorMessage:ee}}],[oe,C]]},R.createElement(_.div,{...T,...w,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":C.isInvalid||void 0}),e.name&&R.createElement(`input`,{type:`hidden`,name:e.name,form:e.form,value:isNaN(a.numberValue)?``:a.numberValue,disabled:e.isDisabled||void 0}))}),Q=r(),$=(0,R.createContext)({}),Qe=({children:e,className:t,fullWidth:n,variant:r,...i})=>{let a=R.useMemo(()=>me({fullWidth:n,variant:r}),[n,r]);return(0,Q.jsx)($,{value:{slots:a},children:(0,Q.jsx)(Ze,{"data-slot":`number-field`,...i,className:w(t,a?.base()),children:t=>(0,Q.jsx)(Q.Fragment,{children:typeof e==`function`?e(t):e})})})},$e=Object.assign(Qe,{Root:Qe,Group:({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)($);return(0,Q.jsx)(ue,{className:w(t,r?.group()),"data-slot":`number-field-group`,...n,children:t=>(0,Q.jsx)(Q.Fragment,{children:typeof e==`function`?e(t):e})})},Input:({className:e,...t})=>{let{slots:n}=(0,R.use)($);return(0,Q.jsx)(F,{className:w(e,n?.input()),"data-slot":`number-field-input`,...t})},IncrementButton:({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)($);return(0,Q.jsx)(c,{className:w(t,r?.incrementButton()),"data-slot":`number-field-increment-button`,slot:`increment`,...n,children:e&&R.isValidElement(e)?e:(0,Q.jsx)(i,{"data-slot":`number-field-increment-button-icon`})})},DecrementButton:({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)($);return(0,Q.jsx)(c,{className:w(t,r?.decrementButton()),"data-slot":`number-field-decrement-button`,slot:`decrement`,...n,children:e&&R.isValidElement(e)?e:(0,Q.jsx)(o,{"data-slot":`number-field-decrement-button-icon`})})}});export{he as n,$e as t}; \ No newline at end of file +import{a as e,c as t,i as n,n as r}from"./shim-mfK0Rmj6.js";import{G as i,Q as a,W as o,X as s,Z as c,a as l,k as u,nt as d,ot as f,rt as p}from"./useI18n-BAo1UrJW.js";import{$ as m,A as h,Ct as g,F as _,I as v,J as y,L as b,M as x,N as S,S as ee,W as C,c as w,dt as T,f as te,j as ne,k as E,l as D,lt as O,q as k,tt as A,vt as j,x as re,xt as ie,z as ae}from"./SharedElementTransition-BlCsXfb1.js";import{a as M,d as oe,f as N,p as se,s as ce,u as le}from"./label-DYYRLGoV.js";import{a as P,i as ue,n as F,t as de}from"./Input-C__Dw9HK.js";import{n as I,r as L,t as fe}from"./useSpinButton-BHwCEdGb.js";import{t as pe}from"./useTextField-h9qasHZP.js";var me=ae({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`number-field`,decrementButton:`number-field__decrement-button`,group:`number-field__group`,incrementButton:`number-field__increment-button`,input:`number-field__input`},variants:{fullWidth:{false:{},true:{base:`number-field--full-width`,group:`number-field__group--full-width`}},variant:{primary:{base:`number-field--primary`},secondary:{base:`number-field--secondary`}}}}),R=t(e(),1);function he(e={}){let{locale:t}=E();return(0,R.useMemo)(()=>new L(t,e),[t,e])}function z(){return typeof window<`u`&&window.InputEvent&&typeof InputEvent.prototype.getTargetRanges==`function`}function ge(e,t,n){let r=C(e=>{let r=n.current;if(!r)return;let i=null;switch(e.inputType){case`historyUndo`:case`historyRedo`:return;case`insertLineBreak`:return;case`deleteContent`:case`deleteByCut`:case`deleteByDrag`:i=r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case`deleteContentForward`:i=r.selectionEnd===r.selectionStart?r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd+1):r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case`deleteContentBackward`:i=r.selectionEnd===r.selectionStart?r.value.slice(0,r.selectionStart-1)+r.value.slice(r.selectionStart):r.value.slice(0,r.selectionStart)+r.value.slice(r.selectionEnd);break;case`deleteSoftLineBackward`:case`deleteHardLineBackward`:i=r.value.slice(r.selectionStart);break;default:e.data!=null&&(i=r.value.slice(0,r.selectionStart)+e.data+r.value.slice(r.selectionEnd))}(i==null||!t.validate(i))&&e.preventDefault()});(0,R.useEffect)(()=>{if(!z()||!n.current)return;let e=n.current;return e.addEventListener(`beforeinput`,r,!1),()=>{e.removeEventListener(`beforeinput`,r,!1)}},[n]);let i=z()?null:e=>{let n=A(e).value.slice(0,A(e).selectionStart)+e.data+A(e).value.slice(A(e).selectionEnd);t.validate(n)||e.preventDefault()},{labelProps:a,inputProps:o,descriptionProps:s,errorMessageProps:c,...l}=pe(e,n),u=(0,R.useRef)(null);return{inputProps:y(o,{onBeforeInput:i,onCompositionStart(){let{value:e,selectionStart:t,selectionEnd:r}=n.current;u.current={value:e,selectionStart:t,selectionEnd:r}},onCompositionEnd(){if(n.current&&!t.validate(n.current.value)){let{value:e,selectionStart:r,selectionEnd:i}=u.current;n.current.value=e,n.current.setSelectionRange(r,i),t.setInputValue(e)}}}),labelProps:a,descriptionProps:s,errorMessageProps:c,...l}}function _e(e,t){let{onScroll:n,isDisabled:r}=e,i=(0,R.useCallback)(e=>{e.ctrlKey||(e.preventDefault(),e.stopPropagation(),n&&n({deltaX:e.deltaX,deltaY:e.deltaY}))},[n]);f(t,`wheel`,r?void 0:i)}var ve={};ve={decrease:e=>`\u{62E}\u{641}\u{636} ${e.fieldLabel}`,increase:e=>`\u{632}\u{64A}\u{627}\u{62F}\u{629} ${e.fieldLabel}`,numberField:`حقل رقمي`};var ye={};ye={decrease:e=>`\u{41D}\u{430}\u{43C}\u{430}\u{43B}\u{44F}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{441}\u{438}\u{43B}\u{432}\u{430}\u{43D}\u{435} ${e.fieldLabel}`,numberField:`Номер на полето`};var be={};be={decrease:e=>`Sn\xed\u{17E}it ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}it ${e.fieldLabel}`,numberField:`Číselné pole`};var xe={};xe={decrease:e=>`Reducer ${e.fieldLabel}`,increase:e=>`\xd8g ${e.fieldLabel}`,numberField:`Talfelt`};var Se={};Se={decrease:e=>`${e.fieldLabel} verringern`,increase:e=>`${e.fieldLabel} erh\xf6hen`,numberField:`Nummernfeld`};var Ce={};Ce={decrease:e=>`\u{39C}\u{3B5}\u{3AF}\u{3C9}\u{3C3}\u{3B7} ${e.fieldLabel}`,increase:e=>`\u{391}\u{3CD}\u{3BE}\u{3B7}\u{3C3}\u{3B7} ${e.fieldLabel}`,numberField:`Πεδίο αριθμού`};var we={};we={decrease:e=>`Decrease ${e.fieldLabel}`,increase:e=>`Increase ${e.fieldLabel}`,numberField:`Number field`};var B={};B={decrease:e=>`Reducir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:`Campo de número`};var V={};V={decrease:e=>`V\xe4henda ${e.fieldLabel}`,increase:e=>`Suurenda ${e.fieldLabel}`,numberField:`Numbri väli`};var H={};H={decrease:e=>`V\xe4henn\xe4 ${e.fieldLabel}`,increase:e=>`Lis\xe4\xe4 ${e.fieldLabel}`,numberField:`Numerokenttä`};var Te={};Te={decrease:e=>`Diminuer ${e.fieldLabel}`,increase:e=>`Augmenter ${e.fieldLabel}`,numberField:`Champ de nombre`};var Ee={};Ee={decrease:e=>`\u{5D4}\u{5E7}\u{5D8}\u{5DF} ${e.fieldLabel}`,increase:e=>`\u{5D4}\u{5D2}\u{5D3}\u{5DC} ${e.fieldLabel}`,numberField:`שדה מספר`};var De={};De={decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:`Polje broja`};var Oe={};Oe={decrease:e=>`${e.fieldLabel} cs\xf6kkent\xe9se`,increase:e=>`${e.fieldLabel} n\xf6vel\xe9se`,numberField:`Számmező`};var U={};U={decrease:e=>`Riduci ${e.fieldLabel}`,increase:e=>`Aumenta ${e.fieldLabel}`,numberField:`Campo numero`};var ke={};ke={decrease:e=>`${e.fieldLabel}\u{3092}\u{7E2E}\u{5C0F}`,increase:e=>`${e.fieldLabel}\u{3092}\u{62E1}\u{5927}`,numberField:`数値フィールド`};var Ae={};Ae={decrease:e=>`${e.fieldLabel} \u{AC10}\u{C18C}`,increase:e=>`${e.fieldLabel} \u{C99D}\u{AC00}`,numberField:`번호 필드`};var W={};W={decrease:e=>`Suma\u{17E}inti ${e.fieldLabel}`,increase:e=>`Padidinti ${e.fieldLabel}`,numberField:`Numerio laukas`};var je={};je={decrease:e=>`Samazin\u{101}\u{161}ana ${e.fieldLabel}`,increase:e=>`Palielin\u{101}\u{161}ana ${e.fieldLabel}`,numberField:`Skaitļu lauks`};var Me={};Me={decrease:e=>`Reduser ${e.fieldLabel}`,increase:e=>`\xd8k ${e.fieldLabel}`,numberField:`Tallfelt`};var Ne={};Ne={decrease:e=>`${e.fieldLabel} verlagen`,increase:e=>`${e.fieldLabel} verhogen`,numberField:`Getalveld`};var Pe={};Pe={decrease:e=>`Zmniejsz ${e.fieldLabel}`,increase:e=>`Zwi\u{119}ksz ${e.fieldLabel}`,numberField:`Pole numeru`};var G={};G={decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:`Campo de número`};var K={};K={decrease:e=>`Diminuir ${e.fieldLabel}`,increase:e=>`Aumentar ${e.fieldLabel}`,numberField:`Campo numérico`};var q={};q={decrease:e=>`Sc\u{103}dere ${e.fieldLabel}`,increase:e=>`Cre\u{219}tere ${e.fieldLabel}`,numberField:`Câmp numeric`};var J={};J={decrease:e=>`\u{423}\u{43C}\u{435}\u{43D}\u{44C}\u{448}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,increase:e=>`\u{423}\u{432}\u{435}\u{43B}\u{438}\u{447}\u{435}\u{43D}\u{438}\u{435} ${e.fieldLabel}`,numberField:`Числовое поле`};var Y={};Y={decrease:e=>`Zn\xed\u{17E}i\u{165} ${e.fieldLabel}`,increase:e=>`Zv\xfd\u{161}i\u{165} ${e.fieldLabel}`,numberField:`Číselné pole`};var X={};X={decrease:e=>`Upadati ${e.fieldLabel}`,increase:e=>`Pove\u{10D}ajte ${e.fieldLabel}`,numberField:`Številčno polje`};var Fe={};Fe={decrease:e=>`Smanji ${e.fieldLabel}`,increase:e=>`Pove\u{107}aj ${e.fieldLabel}`,numberField:`Polje broja`};var Ie={};Ie={decrease:e=>`Minska ${e.fieldLabel}`,increase:e=>`\xd6ka ${e.fieldLabel}`,numberField:`Nummerfält`};var Le={};Le={decrease:e=>`${e.fieldLabel} azalt`,increase:e=>`${e.fieldLabel} artt\u{131}r`,numberField:`Sayı alanı`};var Re={};Re={decrease:e=>`\u{417}\u{43C}\u{435}\u{43D}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,increase:e=>`\u{417}\u{431}\u{456}\u{43B}\u{44C}\u{448}\u{438}\u{442}\u{438} ${e.fieldLabel}`,numberField:`Поле номера`};var ze={};ze={decrease:e=>`\u{964D}\u{4F4E} ${e.fieldLabel}`,increase:e=>`\u{63D0}\u{9AD8} ${e.fieldLabel}`,numberField:`数字字段`};var Be={};Be={decrease:e=>`\u{7E2E}\u{5C0F} ${e.fieldLabel}`,increase:e=>`\u{653E}\u{5927} ${e.fieldLabel}`,numberField:`數字欄位`};var Ve={};Ve={"ar-AE":ve,"bg-BG":ye,"cs-CZ":be,"da-DK":xe,"de-DE":Se,"el-GR":Ce,"en-US":we,"es-ES":B,"et-EE":V,"fi-FI":H,"fr-FR":Te,"he-IL":Ee,"hr-HR":De,"hu-HU":Oe,"it-IT":U,"ja-JP":ke,"ko-KR":Ae,"lt-LT":W,"lv-LV":je,"nb-NO":Me,"nl-NL":Ne,"pl-PL":Pe,"pt-BR":G,"pt-PT":K,"ro-RO":q,"ru-RU":J,"sk-SK":Y,"sl-SI":X,"sr-SP":Fe,"sv-SE":Ie,"tr-TR":Le,"uk-UA":Re,"zh-CN":ze,"zh-TW":Be};var He=t(n(),1);function Ue(e){return e&&e.__esModule?e.default:e}function We(e,t,n){let{id:r,decrementAriaLabel:i,incrementAriaLabel:o,isDisabled:s,isReadOnly:c,isRequired:l,minValue:d,maxValue:f,autoFocus:p,label:h,formatOptions:_,onBlur:v=()=>{},onFocus:b,onFocusChange:x,onKeyDown:S,onKeyUp:C,description:w,errorMessage:T,isWheelDisabled:ne,...E}=e,{increment:D,incrementToMax:ae,decrement:M,decrementToMin:oe,numberValue:N,inputValue:le,commit:P,commitValidation:ue}=t,F=u(Ue(Ve),`@react-aria/numberfield`),de=(0,R.useCallback)(()=>{let e=n.current?.value??``;(0,He.flushSync)(()=>{P()}),n.current?.value!==e&&a(n.current?.value??``,`assertive`)},[P,n]),I=O(r),{focusProps:L}=ee({onBlur(){de()}}),pe=he(_),me=(0,R.useMemo)(()=>pe.resolvedOptions(),[pe]),z=he({..._,currencySign:void 0}),ve=(0,R.useMemo)(()=>isNaN(N)?``:z.format(N),[z,N]),{spinButtonProps:ye,incrementButtonProps:be,decrementButtonProps:xe}=fe({isDisabled:s,isReadOnly:c,isRequired:l,maxValue:f,minValue:d,onIncrement:D,onIncrementToMax:ae,onDecrement:M,onDecrementToMin:oe,value:N,textValue:ve}),[Se,Ce]=(0,R.useState)(!1),{focusWithinProps:we}=te({isDisabled:s,onFocusWithinChange:Ce});_e({onScroll:(0,R.useCallback)(e=>{Math.abs(e.deltaY)<=Math.abs(e.deltaX)||(e.deltaY>0?D():e.deltaY<0&&M())},[M,D]),isDisabled:ne||s||c||!Se},n);let B=(me.maximumFractionDigits??0)>0,V=t.minValue===void 0||isNaN(t.minValue)||t.minValue<0,H=`numeric`;j()?V?H=`text`:B&&(H=`decimal`):ie()&&(V?H=`numeric`:B&&(H=`decimal`));let Te=e=>{t.validate(e)&&t.setInputValue(e)},Ee=t=>{e.onPaste?.(t);let n=A(t);n&&(n.selectionEnd??-1)-(n.selectionStart??0)===n.value.length&&(t.preventDefault(),P(t.clipboardData?.getData?.(`text/plain`)?.trim()??``))},De=k(e),{keyboardProps:Oe}=re({isDisabled:s||c,shortcuts:{Enter:()=>((0,He.flushSync)(()=>{P()}),ue(),{shouldPreventDefault:!1})},onKeyDown:S,onKeyUp:C}),{isInvalid:U,validationErrors:ke,validationDetails:Ae}=t.displayValidation,{labelProps:W,inputProps:je,descriptionProps:Me,errorMessageProps:Ne}=ge({...E,...De,name:void 0,form:void 0,label:h,autoFocus:p,isDisabled:s,isReadOnly:c,isRequired:l,validate:void 0,[ce]:t,value:le,defaultValue:`!`,autoComplete:`off`,"aria-label":e[`aria-label`]||void 0,"aria-labelledby":e[`aria-labelledby`]||void 0,id:I,type:`text`,inputMode:H,onChange:Te,onBlur:v,onFocus:b,onFocusChange:x,onPaste:Ee,description:w,errorMessage:T},t,n),Pe=y(Oe,je);se(n,t.defaultNumberValue,t.setNumberValue),Ge(t,e.validationBehavior,e.commitBehavior,n,t.minValue,t.maxValue,e.step,t.numberValue);let G=y(ye,L,Pe,{role:null,"aria-roledescription":g()?null:F.format(`numberField`),"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null,autoCorrect:`off`,spellCheck:`false`});e.validationBehavior===`native`&&(G[`aria-required`]=void 0);let K=e=>{m()!==n.current&&(e.pointerType===`mouse`?n.current?.focus():e.target.focus())},q=e[`aria-label`]||(typeof e.label==`string`?e.label:``),J;q||(J=e.label==null?e[`aria-labelledby`]:W.id);let Y=O(),X=O(),Fe=y(be,{"aria-label":o||F.format(`increase`,{fieldLabel:q}).trim(),id:J&&!o?Y:null,"aria-labelledby":J&&!o?`${Y} ${J}`:null,"aria-controls":I,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canIncrement,onPressStart:K}),Ie=y(xe,{"aria-label":i||F.format(`decrease`,{fieldLabel:q}).trim(),id:J&&!i?X:null,"aria-labelledby":J&&!i?`${X} ${J}`:null,"aria-controls":I,excludeFromTabOrder:!0,preventFocusOnPress:!0,allowFocusWhenDisabled:!0,isDisabled:!t.canDecrement,onPressStart:K});return{groupProps:{...we,role:`group`,"aria-disabled":s,"aria-invalid":U?`true`:void 0},labelProps:W,inputProps:G,incrementButtonProps:Fe,decrementButtonProps:Ie,errorMessageProps:Ne,descriptionProps:Me,isInvalid:U,validationErrors:ke,validationDetails:Ae}}var Z=null;function Ge(e,t,n,r,i,a,o,s){T(()=>{let c=r.current;if(n!==`validate`||e.realtimeValidation.isInvalid||!c||c.disabled||(!Z&&typeof document<`u`&&(Z=document.createElement(`input`),Z.type=`number`),!Z))return;Z.min=i!=null&&!isNaN(i)?String(i):``,Z.max=a!=null&&!isNaN(a)?String(a):``,Z.step=o!=null&&!isNaN(o)?String(o):``,Z.value=s!=null&&!isNaN(s)?String(s):``;let l=c.validity.valid&&Z.validity.valid,u=c.validationMessage||Z.validationMessage,d={isInvalid:!l,validationErrors:u?[u]:[],validationDetails:{badInput:c.validity.badInput,customError:c.validity.customError,patternMismatch:c.validity.patternMismatch,rangeOverflow:Z.validity.rangeOverflow,rangeUnderflow:Z.validity.rangeUnderflow,stepMismatch:Z.validity.stepMismatch,tooLong:c.validity.tooLong,tooShort:c.validity.tooShort,typeMismatch:c.validity.typeMismatch,valueMissing:c.validity.valueMissing,valid:l}};e.updateValidation(d),t===`native`&&!Z.validity.valid&&c.setCustomValidity(Z.validationMessage)})}function Ke(e){let{minValue:t,maxValue:n,step:r,formatOptions:i,value:a,defaultValue:o=NaN,onChange:s,locale:c,isDisabled:l,isReadOnly:u,commitBehavior:f=`snap`}=e;a===null&&(a=NaN);let m=(0,R.useCallback)(e=>r===void 0||isNaN(r)?d(e,t,n):p(e,t,n,r),[r,t,n]);a!==void 0&&!isNaN(a)&&f===`snap`&&(a=m(a)),!isNaN(o)&&f===`snap`&&(o=m(o));let[h,g]=D(a,isNaN(o)?NaN:o,s),[_]=(0,R.useState)(h),[v,y]=(0,R.useState)(()=>isNaN(h)?``:new L(c,i).format(h)),b=(0,R.useMemo)(()=>new I(c,i),[c,i]),x=(0,R.useMemo)(()=>b.getNumberingSystem(v),[b,v]),S=(0,R.useMemo)(()=>new L(c,{...i,numberingSystem:x}),[c,i,x]),ee=(0,R.useMemo)(()=>S.resolvedOptions(),[S]),C=(0,R.useCallback)(e=>isNaN(e)||e===null?``:S.format(e),[S]),w=le({...e,value:h}),T=r!==void 0&&!isNaN(r)?r:1;ee.style===`percent`&&(r===void 0||isNaN(r))&&(T=.01);let[te,ne]=(0,R.useState)(h),[E,O]=(0,R.useState)(c),[k,A]=(0,R.useState)(i);(!Object.is(h,te)||c!==E||!qe(i,k))&&(y(C(h)),ne(h),O(c),A(i));let j=(0,R.useMemo)(()=>b.parse(v),[b,v]),re=e=>{let t=e===void 0?v:e,n=j;if(e!==void 0&&(n=b.parse(t)),!t.length){g(NaN),y(a===void 0?``:C(h));return}if(isNaN(n)){y(C(h));return}let r=f===`snap`?m(n):n;r=b.parse(C(r));let i=r!==h;g(r),y(C(a===void 0?r:h)),i&&w.commitValidation()},ie=(e,r=0)=>{let i=j;if(isNaN(i))return p(isNaN(r)?0:r,t,n,T);{let r=p(i,t,n,T);return e===`+`&&r>i||e===`-`&&r{let e=ie(`+`,t);e===h&&y(C(e)),g(e),w.commitValidation()},M=()=>{let e=ie(`-`,n);e===h&&y(C(e)),g(e),w.commitValidation()},oe=()=>{n!=null&&(g(p(n,t,n,T)),w.commitValidation())},N=()=>{t!=null&&(g(t),w.commitValidation())},se=(0,R.useMemo)(()=>!l&&!u&&(isNaN(j)||n===void 0||isNaN(n)||p(j,t,n,T)>j||Je(`+`,j,T)<=n),[l,u,t,n,T,j]),ce=(0,R.useMemo)(()=>!l&&!u&&(isNaN(j)||t===void 0||isNaN(t)||p(j,t,n,T)=t),[l,u,t,n,T,j]),P=e=>b.isValidPartialNumber(e,t,n);return{...w,validate:P,increment:ae,incrementToMax:oe,decrement:M,decrementToMin:N,canIncrement:se,canDecrement:ce,minValue:t,maxValue:n,numberValue:j,defaultNumberValue:isNaN(o)?_:o,setNumberValue:g,setInputValue:y,inputValue:v,commit:re}}function qe(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(t[r]!==e[r])return!1;return!0}function Je(e,t,n){let r=e===`+`?t+n:t-n;if(t%1!=0||n%1!=0){let i=t.toString().split(`.`),a=n.toString().split(`.`),o=i[1]&&i[1].length||0,s=a[1]&&a[1].length||0,c=10**Math.max(o,s);t=Math.round(t*c),n=Math.round(n*c),r=e===`+`?t+n:t-n,r/=c}return r}var Ye=(0,R.createContext)(null),Xe=(0,R.createContext)(null),Ze=(0,R.forwardRef)(function(e,t){[e,t]=ne(e,t,Ye);let{validationBehavior:n}=b(M)||{},r=e.validationBehavior??n??`native`,{locale:i}=E(),a=Ke({...e,locale:i,validationBehavior:r}),o=(0,R.useRef)(null),[c,u]=S(!e[`aria-label`]&&!e[`aria-labelledby`]),{labelProps:d,groupProps:f,inputProps:p,incrementButtonProps:m,decrementButtonProps:g,descriptionProps:y,errorMessageProps:ee,...C}=We({...v(e),label:u,validationBehavior:r},a,o),w=x({...e,values:{state:a,isDisabled:e.isDisabled||!1,isInvalid:C.isInvalid||!1,isRequired:e.isRequired||!1,isReadOnly:e.isReadOnly||!1},defaultClassName:`react-aria-NumberField`}),T=k(e,{global:!0});return delete T.id,R.createElement(h,{values:[[Xe,a],[P,f],[de,{...p,ref:o}],[N,{...d,ref:c}],[s,{slots:{increment:m,decrement:g}}],[l,{slots:{description:y,errorMessage:ee}}],[oe,C]]},R.createElement(_.div,{...T,...w,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":C.isInvalid||void 0}),e.name&&R.createElement(`input`,{type:`hidden`,name:e.name,form:e.form,value:isNaN(a.numberValue)?``:a.numberValue,disabled:e.isDisabled||void 0}))}),Q=r(),$=(0,R.createContext)({}),Qe=({children:e,className:t,fullWidth:n,variant:r,...i})=>{let a=R.useMemo(()=>me({fullWidth:n,variant:r}),[n,r]);return(0,Q.jsx)($,{value:{slots:a},children:(0,Q.jsx)(Ze,{"data-slot":`number-field`,...i,className:w(t,a?.base()),children:t=>(0,Q.jsx)(Q.Fragment,{children:typeof e==`function`?e(t):e})})})},$e=Object.assign(Qe,{Root:Qe,Group:({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)($);return(0,Q.jsx)(ue,{className:w(t,r?.group()),"data-slot":`number-field-group`,...n,children:t=>(0,Q.jsx)(Q.Fragment,{children:typeof e==`function`?e(t):e})})},Input:({className:e,...t})=>{let{slots:n}=(0,R.use)($);return(0,Q.jsx)(F,{className:w(e,n?.input()),"data-slot":`number-field-input`,...t})},IncrementButton:({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)($);return(0,Q.jsx)(c,{className:w(t,r?.incrementButton()),"data-slot":`number-field-increment-button`,slot:`increment`,...n,children:e&&R.isValidElement(e)?e:(0,Q.jsx)(i,{"data-slot":`number-field-increment-button-icon`})})},DecrementButton:({children:e,className:t,...n})=>{let{slots:r}=(0,R.use)($);return(0,Q.jsx)(c,{className:w(t,r?.decrementButton()),"data-slot":`number-field-decrement-button`,slot:`decrement`,...n,children:e&&R.isValidElement(e)?e:(0,Q.jsx)(o,{"data-slot":`number-field-decrement-button-icon`})})}});export{he as n,$e as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/search-field-DB17IAvK.js b/internal/webui/static/assets/search-field-DRk4_q5c.js similarity index 94% rename from internal/webui/static/assets/search-field-DB17IAvK.js rename to internal/webui/static/assets/search-field-DRk4_q5c.js index 2630bcec7..c3e2d640d 100644 --- a/internal/webui/static/assets/search-field-DB17IAvK.js +++ b/internal/webui/static/assets/search-field-DRk4_q5c.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{K as r,X as i,a,et as o,k as ee,l as s}from"./useI18n-XrvNxGvP.js";import{A as te,F as ne,I as c,J as l,L as u,M as d,N as re,c as f,j as p,l as m,q as ie,s as h,x as g,z as _}from"./SharedElementTransition-BlCsXfb1.js";import{a as ae,d as oe,f as se}from"./label-B8hTan2F.js";import{a as ce,i as v,n as y,t as le}from"./Input-CyXcxaPW.js";import{t as b}from"./useTextField-i0qH61mD.js";import{z as x}from"./index-CAlyInAP.js";var ue=_({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`search-field`,clearButton:`search-field__clear-button`,group:`search-field__group`,input:`search-field__input`,searchIcon:`search-field__search-icon`},variants:{fullWidth:{false:{},true:{base:`search-field--full-width`,group:`search-field__group--full-width`}},variant:{primary:{base:`search-field--primary`},secondary:{base:`search-field--secondary`}}}}),S={};S={"Clear search":`مسح البحث`};var C={};C={"Clear search":`Изчистване на търсене`};var w={};w={"Clear search":`Vymazat hledání`};var T={};T={"Clear search":`Ryd søgning`};var E={};E={"Clear search":`Suche zurücksetzen`};var D={};D={"Clear search":`Απαλοιφή αναζήτησης`};var O={};O={"Clear search":`Clear search`};var k={};k={"Clear search":`Borrar búsqueda`};var A={};A={"Clear search":`Tühjenda otsing`};var j={};j={"Clear search":`Tyhjennä haku`};var M={};M={"Clear search":`Effacer la recherche`};var N={};N={"Clear search":`נקה חיפוש`};var P={};P={"Clear search":`Obriši pretragu`};var de={};de={"Clear search":`Keresés törlése`};var F={};F={"Clear search":`Cancella ricerca`};var I={};I={"Clear search":`検索をクリア`};var L={};L={"Clear search":`검색 지우기`};var R={};R={"Clear search":`Išvalyti iešką`};var z={};z={"Clear search":`Notīrīt meklēšanu`};var B={};B={"Clear search":`Tøm søk`};var V={};V={"Clear search":`Zoekactie wissen`};var H={};H={"Clear search":`Wyczyść zawartość wyszukiwania`};var U={};U={"Clear search":`Limpar pesquisa`};var W={};W={"Clear search":`Limpar pesquisa`};var G={};G={"Clear search":`Ştergeţi căutarea`};var K={};K={"Clear search":`Очистить поиск`};var q={};q={"Clear search":`Vymazať vyhľadávanie`};var J={};J={"Clear search":`Počisti iskanje`};var Y={};Y={"Clear search":`Obriši pretragu`};var fe={};fe={"Clear search":`Rensa sökning`};var X={};X={"Clear search":`Aramayı temizle`};var pe={};pe={"Clear search":`Очистити пошук`};var me={};me={"Clear search":`清除搜索`};var he={};he={"Clear search":`清除搜尋條件`};var ge={};ge={"ar-AE":S,"bg-BG":C,"cs-CZ":w,"da-DK":T,"de-DE":E,"el-GR":D,"en-US":O,"es-ES":k,"et-EE":A,"fi-FI":j,"fr-FR":M,"he-IL":N,"hr-HR":P,"hu-HU":de,"it-IT":F,"ja-JP":I,"ko-KR":L,"lt-LT":R,"lv-LV":z,"nb-NO":B,"nl-NL":V,"pl-PL":H,"pt-BR":U,"pt-PT":W,"ro-RO":G,"ru-RU":K,"sk-SK":q,"sl-SI":J,"sr-SP":Y,"sv-SE":fe,"tr-TR":X,"uk-UA":pe,"zh-CN":me,"zh-TW":he};function _e(e){return e&&e.__esModule?e.default:e}function ve(e,t,n){let r=ee(_e(ge),`@react-aria/searchfield`),{isDisabled:i,isReadOnly:a,onSubmit:o,onClear:s,type:te=`search`}=e,{keyboardProps:ne}=g({isDisabled:i||a,shortcuts:{Enter:()=>{if(o){o(t.value);return}return!1},Escape:()=>{if(t.value===``&&(!n.current||n.current.value===``))return!1;t.setValue(``),s?.()}}}),c=()=>{t.setValue(``),s&&s()},u=()=>{n.current?.focus()},{labelProps:d,inputProps:re,descriptionProps:f,errorMessageProps:p,...m}=b({...e,value:t.value,onChange:t.setValue,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,type:te},n);return{labelProps:d,inputProps:l(ne,{...re,defaultValue:void 0}),clearButtonProps:{"aria-label":r.format(`Clear search`),excludeFromTabOrder:!0,preventFocusOnPress:!0,isDisabled:i||a,onPress:c,onPressStart:u},descriptionProps:f,errorMessageProps:p,...m}}function ye(e){let[t,n]=m(be(e.value),be(e.defaultValue)||``,e.onChange);return{value:t,setValue:n}}function be(e){if(e!=null)return e.toString()}var Z=t(e(),1),xe=(0,Z.createContext)(null),Se=o(function(e,t){[e,t]=p(e,t,xe);let{validationBehavior:n}=u(ae)||{},r=e.validationBehavior??n??`native`,o=(0,Z.useRef)(null);[e,o]=p(e,o,s);let[ee,l]=re(!e[`aria-label`]&&!e[`aria-labelledby`]),f=ye({...e,validationBehavior:r}),{labelProps:m,inputProps:h,clearButtonProps:g,descriptionProps:_,errorMessageProps:v,...y}=ve({...c(e),label:l,validationBehavior:r},f,o),b=d({...e,values:{isEmpty:f.value===``,isDisabled:e.isDisabled||!1,isInvalid:y.isInvalid||!1,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1,state:f},defaultClassName:`react-aria-SearchField`}),x=ie(e,{global:!0});return delete x.id,Z.createElement(ne.div,{...x,...b,ref:t,slot:e.slot||void 0,"data-empty":f.value===``||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":y.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},Z.createElement(te,{values:[[se,{...m,ref:ee}],[le,{...h,ref:o}],[i,g],[a,{slots:{description:_,errorMessage:v}}],[ce,{isInvalid:y.isInvalid,isDisabled:e.isDisabled||!1}],[oe,y]]},b.children))}),Q=n(),$=(0,Z.createContext)({}),Ce=({children:e,className:t,fullWidth:n,variant:r,...i})=>{let a=Z.useMemo(()=>ue({fullWidth:n,variant:r}),[n,r]);return(0,Q.jsx)($,{value:{slots:a},children:(0,Q.jsx)(Se,{"data-slot":`search-field`,...i,className:f(t,a?.base()),children:t=>(0,Q.jsx)(Q.Fragment,{children:typeof e==`function`?e(t):e})})})},we=Object.assign(Ce,{Root:Ce,Group:({children:e,className:t,...n})=>{let{slots:r}=(0,Z.use)($);return(0,Q.jsx)(v,{className:f(t,r?.group()),"data-slot":`search-field-group`,...n,children:t=>(0,Q.jsx)(Q.Fragment,{children:typeof e==`function`?e(t):e})})},Input:({className:e,...t})=>{let{slots:n}=(0,Z.use)($);return(0,Q.jsx)(y,{className:f(e,n?.input()),"data-slot":`search-field-input`,...t})},SearchIcon:({children:e,className:t,...n})=>{let{slots:i}=(0,Z.use)($);return e&&Z.isValidElement(e)?Z.cloneElement(e,{...n,className:h(i?.searchIcon,t),"data-slot":`search-field-search-icon`}):(0,Q.jsx)(r,{className:h(i?.searchIcon,t),"data-slot":`search-field-search-icon`,...n})},ClearButton:({className:e,...t})=>{let{slots:n}=(0,Z.use)($);return(0,Q.jsx)(x,{className:f(e,n?.clearButton()),"data-slot":`search-field-clear-button`,slot:`clear`,...t})}});export{we as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{K as r,X as i,a,et as o,k as ee,l as s}from"./useI18n-BAo1UrJW.js";import{A as te,F as ne,I as c,J as l,L as u,M as d,N as re,c as f,j as p,l as m,q as ie,s as h,x as g,z as _}from"./SharedElementTransition-BlCsXfb1.js";import{a as ae,d as oe,f as se}from"./label-DYYRLGoV.js";import{a as ce,i as v,n as y,t as le}from"./Input-C__Dw9HK.js";import{t as b}from"./useTextField-h9qasHZP.js";import{z as x}from"./index-CWTBzWuK.js";var ue=_({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`search-field`,clearButton:`search-field__clear-button`,group:`search-field__group`,input:`search-field__input`,searchIcon:`search-field__search-icon`},variants:{fullWidth:{false:{},true:{base:`search-field--full-width`,group:`search-field__group--full-width`}},variant:{primary:{base:`search-field--primary`},secondary:{base:`search-field--secondary`}}}}),S={};S={"Clear search":`مسح البحث`};var C={};C={"Clear search":`Изчистване на търсене`};var w={};w={"Clear search":`Vymazat hledání`};var T={};T={"Clear search":`Ryd søgning`};var E={};E={"Clear search":`Suche zurücksetzen`};var D={};D={"Clear search":`Απαλοιφή αναζήτησης`};var O={};O={"Clear search":`Clear search`};var k={};k={"Clear search":`Borrar búsqueda`};var A={};A={"Clear search":`Tühjenda otsing`};var j={};j={"Clear search":`Tyhjennä haku`};var M={};M={"Clear search":`Effacer la recherche`};var N={};N={"Clear search":`נקה חיפוש`};var P={};P={"Clear search":`Obriši pretragu`};var de={};de={"Clear search":`Keresés törlése`};var F={};F={"Clear search":`Cancella ricerca`};var I={};I={"Clear search":`検索をクリア`};var L={};L={"Clear search":`검색 지우기`};var R={};R={"Clear search":`Išvalyti iešką`};var z={};z={"Clear search":`Notīrīt meklēšanu`};var B={};B={"Clear search":`Tøm søk`};var V={};V={"Clear search":`Zoekactie wissen`};var H={};H={"Clear search":`Wyczyść zawartość wyszukiwania`};var U={};U={"Clear search":`Limpar pesquisa`};var W={};W={"Clear search":`Limpar pesquisa`};var G={};G={"Clear search":`Ştergeţi căutarea`};var K={};K={"Clear search":`Очистить поиск`};var q={};q={"Clear search":`Vymazať vyhľadávanie`};var J={};J={"Clear search":`Počisti iskanje`};var Y={};Y={"Clear search":`Obriši pretragu`};var fe={};fe={"Clear search":`Rensa sökning`};var X={};X={"Clear search":`Aramayı temizle`};var pe={};pe={"Clear search":`Очистити пошук`};var me={};me={"Clear search":`清除搜索`};var he={};he={"Clear search":`清除搜尋條件`};var ge={};ge={"ar-AE":S,"bg-BG":C,"cs-CZ":w,"da-DK":T,"de-DE":E,"el-GR":D,"en-US":O,"es-ES":k,"et-EE":A,"fi-FI":j,"fr-FR":M,"he-IL":N,"hr-HR":P,"hu-HU":de,"it-IT":F,"ja-JP":I,"ko-KR":L,"lt-LT":R,"lv-LV":z,"nb-NO":B,"nl-NL":V,"pl-PL":H,"pt-BR":U,"pt-PT":W,"ro-RO":G,"ru-RU":K,"sk-SK":q,"sl-SI":J,"sr-SP":Y,"sv-SE":fe,"tr-TR":X,"uk-UA":pe,"zh-CN":me,"zh-TW":he};function _e(e){return e&&e.__esModule?e.default:e}function ve(e,t,n){let r=ee(_e(ge),`@react-aria/searchfield`),{isDisabled:i,isReadOnly:a,onSubmit:o,onClear:s,type:te=`search`}=e,{keyboardProps:ne}=g({isDisabled:i||a,shortcuts:{Enter:()=>{if(o){o(t.value);return}return!1},Escape:()=>{if(t.value===``&&(!n.current||n.current.value===``))return!1;t.setValue(``),s?.()}}}),c=()=>{t.setValue(``),s&&s()},u=()=>{n.current?.focus()},{labelProps:d,inputProps:re,descriptionProps:f,errorMessageProps:p,...m}=b({...e,value:t.value,onChange:t.setValue,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,type:te},n);return{labelProps:d,inputProps:l(ne,{...re,defaultValue:void 0}),clearButtonProps:{"aria-label":r.format(`Clear search`),excludeFromTabOrder:!0,preventFocusOnPress:!0,isDisabled:i||a,onPress:c,onPressStart:u},descriptionProps:f,errorMessageProps:p,...m}}function ye(e){let[t,n]=m(be(e.value),be(e.defaultValue)||``,e.onChange);return{value:t,setValue:n}}function be(e){if(e!=null)return e.toString()}var Z=t(e(),1),xe=(0,Z.createContext)(null),Se=o(function(e,t){[e,t]=p(e,t,xe);let{validationBehavior:n}=u(ae)||{},r=e.validationBehavior??n??`native`,o=(0,Z.useRef)(null);[e,o]=p(e,o,s);let[ee,l]=re(!e[`aria-label`]&&!e[`aria-labelledby`]),f=ye({...e,validationBehavior:r}),{labelProps:m,inputProps:h,clearButtonProps:g,descriptionProps:_,errorMessageProps:v,...y}=ve({...c(e),label:l,validationBehavior:r},f,o),b=d({...e,values:{isEmpty:f.value===``,isDisabled:e.isDisabled||!1,isInvalid:y.isInvalid||!1,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1,state:f},defaultClassName:`react-aria-SearchField`}),x=ie(e,{global:!0});return delete x.id,Z.createElement(ne.div,{...x,...b,ref:t,slot:e.slot||void 0,"data-empty":f.value===``||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":y.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},Z.createElement(te,{values:[[se,{...m,ref:ee}],[le,{...h,ref:o}],[i,g],[a,{slots:{description:_,errorMessage:v}}],[ce,{isInvalid:y.isInvalid,isDisabled:e.isDisabled||!1}],[oe,y]]},b.children))}),Q=n(),$=(0,Z.createContext)({}),Ce=({children:e,className:t,fullWidth:n,variant:r,...i})=>{let a=Z.useMemo(()=>ue({fullWidth:n,variant:r}),[n,r]);return(0,Q.jsx)($,{value:{slots:a},children:(0,Q.jsx)(Se,{"data-slot":`search-field`,...i,className:f(t,a?.base()),children:t=>(0,Q.jsx)(Q.Fragment,{children:typeof e==`function`?e(t):e})})})},we=Object.assign(Ce,{Root:Ce,Group:({children:e,className:t,...n})=>{let{slots:r}=(0,Z.use)($);return(0,Q.jsx)(v,{className:f(t,r?.group()),"data-slot":`search-field-group`,...n,children:t=>(0,Q.jsx)(Q.Fragment,{children:typeof e==`function`?e(t):e})})},Input:({className:e,...t})=>{let{slots:n}=(0,Z.use)($);return(0,Q.jsx)(y,{className:f(e,n?.input()),"data-slot":`search-field-input`,...t})},SearchIcon:({children:e,className:t,...n})=>{let{slots:i}=(0,Z.use)($);return e&&Z.isValidElement(e)?Z.cloneElement(e,{...n,className:h(i?.searchIcon,t),"data-slot":`search-field-search-icon`}):(0,Q.jsx)(r,{className:h(i?.searchIcon,t),"data-slot":`search-field-search-icon`,...n})},ClearButton:({className:e,...t})=>{let{slots:n}=(0,Z.use)($);return(0,Q.jsx)(x,{className:f(e,n?.clearButton()),"data-slot":`search-field-clear-button`,slot:`clear`,...t})}});export{we as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/select-DSzMi7kM.js b/internal/webui/static/assets/select-DnqAZzCR.js similarity index 90% rename from internal/webui/static/assets/select-DSzMi7kM.js rename to internal/webui/static/assets/select-DnqAZzCR.js index 03c607695..8ddf3ff76 100644 --- a/internal/webui/static/assets/select-DSzMi7kM.js +++ b/internal/webui/static/assets/select-DnqAZzCR.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{B as r,I as i,Z as a}from"./useI18n-XrvNxGvP.js";import{c as o,s,z as c}from"./SharedElementTransition-BlCsXfb1.js";import{a as l,i as u,n as d,r as f}from"./list-box-BtjELxmv.js";import{t as p}from"./assertion-BLQtDfw6.js";import{bt as m}from"./index-CAlyInAP.js";var h=c({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`select`,indicator:`select__indicator`,popover:`select__popover`,trigger:`select__trigger`,value:`select__value`},variants:{fullWidth:{false:{},true:{base:`select--full-width`,trigger:`select__trigger--full-width`}},variant:{primary:{base:`select--primary`},secondary:{base:`select--secondary`}}}}),g=t(e(),1),_=n(),v=(0,g.createContext)({}),y=({children:e,className:t,fullWidth:n,variant:r,...i})=>{let a=g.useMemo(()=>h({fullWidth:n,variant:r}),[n,r]);return(0,_.jsx)(d,{children:(0,_.jsx)(v,{value:{slots:a},children:(0,_.jsx)(l,{"data-slot":`select`,...i,className:o(t,a?.base()),children:t=>(0,_.jsx)(_.Fragment,{children:typeof e==`function`?e(t):e})})})})},b=Object.assign(y,{Root:y,Trigger:({children:e,className:t,...n})=>{let{slots:r}=(0,g.use)(v);return(0,_.jsx)(a,{className:o(t,r?.trigger()),"data-slot":`select-trigger`,...n,children:t=>(0,_.jsx)(_.Fragment,{children:typeof e==`function`?e(t):e})})},Value:({children:e,className:t,...n})=>{let{slots:r}=(0,g.use)(v);return(0,_.jsx)(f,{className:o(t,r?.value()),"data-slot":`select-value`,...n,children:e})},Indicator:({children:e,className:t,...n})=>{let{slots:i}=(0,g.use)(v),a=(0,g.use)(u);return e&&g.isValidElement(e)?g.cloneElement(e,{...n,className:s(i?.indicator,t),"data-slot":`select-indicator`,"data-open":p(a?.isOpen)}):(0,_.jsx)(r,{className:s(i?.indicator,t),"data-open":p(a?.isOpen),"data-slot":`select-default-indicator`,...n})},Popover:({children:e,className:t,placement:n=`bottom`,...r})=>{let{slots:a}=(0,g.use)(v);return(0,_.jsx)(i,{value:{variant:`default`},children:(0,_.jsx)(m,{...r,className:o(t,a?.popover()),"data-slot":`select-popover`,placement:n,children:e})})}});export{b as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{B as r,I as i,Z as a}from"./useI18n-BAo1UrJW.js";import{c as o,s,z as c}from"./SharedElementTransition-BlCsXfb1.js";import{a as l,i as u,n as d,r as f}from"./list-box-DbrQLYNo.js";import{t as p}from"./assertion-BLQtDfw6.js";import{bt as m}from"./index-CWTBzWuK.js";var h=c({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`select`,indicator:`select__indicator`,popover:`select__popover`,trigger:`select__trigger`,value:`select__value`},variants:{fullWidth:{false:{},true:{base:`select--full-width`,trigger:`select__trigger--full-width`}},variant:{primary:{base:`select--primary`},secondary:{base:`select--secondary`}}}}),g=t(e(),1),_=n(),v=(0,g.createContext)({}),y=({children:e,className:t,fullWidth:n,variant:r,...i})=>{let a=g.useMemo(()=>h({fullWidth:n,variant:r}),[n,r]);return(0,_.jsx)(d,{children:(0,_.jsx)(v,{value:{slots:a},children:(0,_.jsx)(l,{"data-slot":`select`,...i,className:o(t,a?.base()),children:t=>(0,_.jsx)(_.Fragment,{children:typeof e==`function`?e(t):e})})})})},b=Object.assign(y,{Root:y,Trigger:({children:e,className:t,...n})=>{let{slots:r}=(0,g.use)(v);return(0,_.jsx)(a,{className:o(t,r?.trigger()),"data-slot":`select-trigger`,...n,children:t=>(0,_.jsx)(_.Fragment,{children:typeof e==`function`?e(t):e})})},Value:({children:e,className:t,...n})=>{let{slots:r}=(0,g.use)(v);return(0,_.jsx)(f,{className:o(t,r?.value()),"data-slot":`select-value`,...n,children:e})},Indicator:({children:e,className:t,...n})=>{let{slots:i}=(0,g.use)(v),a=(0,g.use)(u);return e&&g.isValidElement(e)?g.cloneElement(e,{...n,className:s(i?.indicator,t),"data-slot":`select-indicator`,"data-open":p(a?.isOpen)}):(0,_.jsx)(r,{className:s(i?.indicator,t),"data-open":p(a?.isOpen),"data-slot":`select-default-indicator`,...n})},Popover:({children:e,className:t,placement:n=`bottom`,...r})=>{let{slots:a}=(0,g.use)(v);return(0,_.jsx)(i,{value:{variant:`default`},children:(0,_.jsx)(m,{...r,className:o(t,a?.popover()),"data-slot":`select-popover`,placement:n,children:e})})}});export{b as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/table-iJwxYVe4.js b/internal/webui/static/assets/table-B2nk0cjc.js similarity index 99% rename from internal/webui/static/assets/table-iJwxYVe4.js rename to internal/webui/static/assets/table-B2nk0cjc.js index 98f5a6503..c09ce2709 100644 --- a/internal/webui/static/assets/table-iJwxYVe4.js +++ b/internal/webui/static/assets/table-B2nk0cjc.js @@ -1 +1 @@ -import{a as e,c as t,i as n,n as r}from"./shim-mfK0Rmj6.js";import{D as i,Q as a,S as o,U as s,X as c,_ as l,b as u,g as d,h as f,k as p,l as m,lt as h,m as g,p as _,u as v,ut as y,v as b,x}from"./useI18n-XrvNxGvP.js";import{$ as S,A as C,B as w,C as T,D as E,F as D,G as O,J as k,K as A,M as j,O as M,P as ee,Q as N,R as P,W as te,Y as ne,Z as F,_ as re,a as I,at as ie,c as L,d as R,dt as ae,g as oe,gt as se,i as ce,it as le,j as ue,k as z,l as de,lt as fe,m as pe,q as B,s as V,st as me,t as he,tt as H,u as ge,x as _e,xt as ve,y as ye,z as be}from"./SharedElementTransition-BlCsXfb1.js";import{t as xe}from"./useUpdateEffect-DR9d7F-l.js";import{a as Se,i as Ce,n as U,o as we,r as Te,s as Ee,t as De}from"./DragAndDrop-DdMlSxLf.js";import{i as Oe,r as ke}from"./Checkbox-Dk73RtP8.js";import{t as Ae}from"./useHasTabbableChild-8WJt7azf.js";import{$ as je,Dt as Me,Et as W,Q as Ne,Tt as Pe,Z as Fe,at as Ie,ct as Le,gt as G,it as K,lt as Re,mt as ze,nt as Be,rt as q,st as Ve,tt as J,ut as He,vt as Ue,wt as We}from"./index-CAlyInAP.js";var Ge=be({defaultVariants:{variant:`primary`},slots:{base:`table-root`,body:`table__body`,cell:`table__cell`,column:`table__column`,columnResizer:`table__column-resizer`,content:`table__content`,footer:`table__footer`,header:`table__header`,loadMore:`table__load-more`,loadMoreContent:`table__load-more-content`,resizableContainer:`table__resizable-container`,row:`table__row`,scrollContainer:`table__scroll-container`,sortableColumnHeader:`table__sortable-column-header`,sortableColumnIndicator:`table__sortable-column-indicator`},variants:{variant:{primary:{base:`table-root--primary`},secondary:{base:`table-root--secondary`}}}}),Y=t(e(),1);function Ke(e){let{onMoveStart:t,onMove:n,onMoveEnd:r}=e,i=(0,Y.useRef)({didMove:!1,lastPosition:null,id:null}),{addGlobalListener:a,removeGlobalListener:o}=A(),s=(0,Y.useCallback)((e,r,a,o)=>{(a!==0||o!==0)&&(i.current.didMove||(i.current.didMove=!0,t?.({type:`movestart`,pointerType:r,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey})),n?.({type:`move`,pointerType:r,deltaX:a,deltaY:o,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey}))},[t,n,i]),c=te(s),l=(0,Y.useCallback)((e,t)=>{re(),i.current.didMove&&r?.({type:`moveend`,pointerType:t,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey})},[r,i]),u=te(l);return{moveProps:(0,Y.useMemo)(()=>{let e={},t=()=>{oe(),i.current.didMove=!1};{let n=e=>{if(e.pointerId===i.current.id){let t=e.pointerType||`mouse`;c(e,t,e.pageX-(i.current.lastPosition?.pageX??0),e.pageY-(i.current.lastPosition?.pageY??0)),i.current.lastPosition={pageX:e.pageX,pageY:e.pageY}}},r=e=>{if(e.pointerId===i.current.id){let t=e.pointerType||`mouse`;u(e,t),i.current.id=null;let a=ie(H(e));o(a,`pointermove`,n,!1),o(a,`pointerup`,r,!1),o(a,`pointercancel`,r,!1)}};e.onPointerDown=e=>{if(e.button===0&&i.current.id==null){t(),e.stopPropagation(),e.preventDefault(),i.current.lastPosition={pageX:e.pageX,pageY:e.pageY},i.current.id=e.pointerId;let o=ie(H(e));a(o,`pointermove`,n,!1),a(o,`pointerup`,r,!1),a(o,`pointercancel`,r,!1)}}}let n=(e,n,r)=>{t(),c(e,`keyboard`,n,r),u(e,`keyboard`)};return e.onKeyDown=e=>{switch(e.key){case`Left`:case`ArrowLeft`:e.preventDefault(),e.stopPropagation(),n(e,-1,0);break;case`Right`:case`ArrowRight`:e.preventDefault(),e.stopPropagation(),n(e,1,0);break;case`Up`:case`ArrowUp`:e.preventDefault(),e.stopPropagation(),n(e,0,-1);break;case`Down`:case`ArrowDown`:e.preventDefault(),e.stopPropagation(),n(e,0,1)}},e},[a,o,i])}}var qe={};qe={deselectedItem:e=>`${e.item} \u{63A}\u{64A}\u{631} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}`,longPressToSelect:`اضغط مطولًا للدخول إلى وضع التحديد.`,select:`تحديد`,selectedAll:`جميع العناصر المحددة.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`لم يتم تحديد عناصر`,one:()=>`${t.number(e.count)} \u{639}\u{646}\u{635}\u{631} \u{645}\u{62D}\u{62F}\u{62F}`,other:()=>`${t.number(e.count)} \u{639}\u{646}\u{635}\u{631} \u{645}\u{62D}\u{62F}\u{62F}`})}.`,selectedItem:e=>`${e.item} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}`};var Je={};Je={deselectedItem:e=>`${e.item} \u{43D}\u{435} \u{435} \u{438}\u{437}\u{431}\u{440}\u{430}\u{43D}.`,longPressToSelect:`Натиснете и задръжте за да влезете в избирателен режим.`,select:`Изберете`,selectedAll:`Всички елементи са избрани.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Няма избрани елементи`,one:()=>`${t.number(e.count)} \u{438}\u{437}\u{431}\u{440}\u{430}\u{43D} \u{435}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442}`,other:()=>`${t.number(e.count)} \u{438}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{438} \u{435}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442}\u{438}`})}.`,selectedItem:e=>`${e.item} \u{438}\u{437}\u{431}\u{440}\u{430}\u{43D}.`};var Ye={};Ye={deselectedItem:e=>`Polo\u{17E}ka ${e.item} nen\xed vybr\xe1na.`,longPressToSelect:`Dlouhým stisknutím přejdete do režimu výběru.`,select:`Vybrat`,selectedAll:`Vybrány všechny položky.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nevybrány žádné položky`,one:()=>`Vybr\xe1na ${t.number(e.count)} polo\u{17E}ka`,other:()=>`Vybr\xe1no ${t.number(e.count)} polo\u{17E}ek`})}.`,selectedItem:e=>`Vybr\xe1na polo\u{17E}ka ${e.item}.`};var Xe={};Xe={deselectedItem:e=>`${e.item} ikke valgt.`,longPressToSelect:`Lav et langt tryk for at aktivere valgtilstand.`,select:`Vælg`,selectedAll:`Alle elementer valgt.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Ingen elementer valgt`,one:()=>`${t.number(e.count)} element valgt`,other:()=>`${t.number(e.count)} elementer valgt`})}.`,selectedItem:e=>`${e.item} valgt.`};var Ze={};Ze={deselectedItem:e=>`${e.item} nicht ausgew\xe4hlt.`,longPressToSelect:`Gedrückt halten, um Auswahlmodus zu öffnen.`,select:`Auswählen`,selectedAll:`Alle Elemente ausgewählt.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Keine Elemente ausgewählt`,one:()=>`${t.number(e.count)} Element ausgew\xe4hlt`,other:()=>`${t.number(e.count)} Elemente ausgew\xe4hlt`})}.`,selectedItem:e=>`${e.item} ausgew\xe4hlt.`};var Qe={};Qe={deselectedItem:e=>`\u{394}\u{3B5}\u{3BD} \u{3B5}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3B8}\u{3B7}\u{3BA}\u{3B5} \u{3C4}\u{3BF} \u{3C3}\u{3C4}\u{3BF}\u{3B9}\u{3C7}\u{3B5}\u{3AF}\u{3BF} ${e.item}.`,longPressToSelect:`Πατήστε παρατεταμένα για να μπείτε σε λειτουργία επιλογής.`,select:`Επιλογή`,selectedAll:`Επιλέχθηκαν όλα τα στοιχεία.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Δεν επιλέχθηκαν στοιχεία`,one:()=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3B8}\u{3B7}\u{3BA}\u{3B5} ${t.number(e.count)} \u{3C3}\u{3C4}\u{3BF}\u{3B9}\u{3C7}\u{3B5}\u{3AF}\u{3BF}`,other:()=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3B8}\u{3B7}\u{3BA}\u{3B1}\u{3BD} ${t.number(e.count)} \u{3C3}\u{3C4}\u{3BF}\u{3B9}\u{3C7}\u{3B5}\u{3AF}\u{3B1}`})}.`,selectedItem:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3B8}\u{3B7}\u{3BA}\u{3B5} \u{3C4}\u{3BF} \u{3C3}\u{3C4}\u{3BF}\u{3B9}\u{3C7}\u{3B5}\u{3AF}\u{3BF} ${e.item}.`};var $e={};$e={deselectedItem:e=>`${e.item} not selected.`,select:`Select`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`No items selected`,one:()=>`${t.number(e.count)} item selected`,other:()=>`${t.number(e.count)} items selected`})}.`,selectedAll:`All items selected.`,selectedItem:e=>`${e.item} selected.`,longPressToSelect:`Long press to enter selection mode.`};var et={};et={deselectedItem:e=>`${e.item} no seleccionado.`,longPressToSelect:`Mantenga pulsado para abrir el modo de selección.`,select:`Seleccionar`,selectedAll:`Todos los elementos seleccionados.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Ningún elemento seleccionado`,one:()=>`${t.number(e.count)} elemento seleccionado`,other:()=>`${t.number(e.count)} elementos seleccionados`})}.`,selectedItem:e=>`${e.item} seleccionado.`};var tt={};tt={deselectedItem:e=>`${e.item} pole valitud.`,longPressToSelect:`Valikurežiimi sisenemiseks vajutage pikalt.`,select:`Vali`,selectedAll:`Kõik üksused valitud.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Üksusi pole valitud`,one:()=>`${t.number(e.count)} \xfcksus valitud`,other:()=>`${t.number(e.count)} \xfcksust valitud`})}.`,selectedItem:e=>`${e.item} valitud.`};var nt={};nt={deselectedItem:e=>`Kohdetta ${e.item} ei valittu.`,longPressToSelect:`Siirry valintatilaan painamalla pitkään.`,select:`Valitse`,selectedAll:`Kaikki kohteet valittu.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Ei yhtään kohdetta valittu`,one:()=>`${t.number(e.count)} kohde valittu`,other:()=>`${t.number(e.count)} kohdetta valittu`})}.`,selectedItem:e=>`${e.item} valittu.`};var rt={};rt={deselectedItem:e=>`${e.item} non s\xe9lectionn\xe9.`,longPressToSelect:`Appuyez de manière prolongée pour passer en mode de sélection.`,select:`Sélectionner`,selectedAll:`Tous les éléments sélectionnés.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Aucun élément sélectionné`,one:()=>`${t.number(e.count)} \xe9l\xe9ment s\xe9lectionn\xe9`,other:()=>`${t.number(e.count)} \xe9l\xe9ments s\xe9lectionn\xe9s`})}.`,selectedItem:e=>`${e.item} s\xe9lectionn\xe9.`};var it={};it={deselectedItem:e=>`${e.item} \u{5DC}\u{5D0} \u{5E0}\u{5D1}\u{5D7}\u{5E8}.`,longPressToSelect:`הקשה ארוכה לכניסה למצב בחירה.`,select:`בחר`,selectedAll:`כל הפריטים נבחרו.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`לא נבחרו פריטים`,one:()=>`\u{5E4}\u{5E8}\u{5D9}\u{5D8} ${t.number(e.count)} \u{5E0}\u{5D1}\u{5D7}\u{5E8}`,other:()=>`${t.number(e.count)} \u{5E4}\u{5E8}\u{5D9}\u{5D8}\u{5D9}\u{5DD} \u{5E0}\u{5D1}\u{5D7}\u{5E8}\u{5D5}`})}.`,selectedItem:e=>`${e.item} \u{5E0}\u{5D1}\u{5D7}\u{5E8}.`};var at={};at={deselectedItem:e=>`Stavka ${e.item} nije odabrana.`,longPressToSelect:`Dugo pritisnite za ulazak u način odabira.`,select:`Odaberite`,selectedAll:`Odabrane su sve stavke.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nije odabrana nijedna stavka`,one:()=>`Odabrana je ${t.number(e.count)} stavka`,other:()=>`Odabrano je ${t.number(e.count)} stavki`})}.`,selectedItem:e=>`Stavka ${e.item} je odabrana.`};var ot={};ot={deselectedItem:e=>`${e.item} nincs kijel\xf6lve.`,longPressToSelect:`Nyomja hosszan a kijelöléshez.`,select:`Kijelölés`,selectedAll:`Az összes elem kijelölve.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Egy elem sincs kijelölve`,one:()=>`${t.number(e.count)} elem kijel\xf6lve`,other:()=>`${t.number(e.count)} elem kijel\xf6lve`})}.`,selectedItem:e=>`${e.item} kijel\xf6lve.`};var st={};st={deselectedItem:e=>`${e.item} non selezionato.`,longPressToSelect:`Premi a lungo per passare alla modalità di selezione.`,select:`Seleziona`,selectedAll:`Tutti gli elementi selezionati.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nessun elemento selezionato`,one:()=>`${t.number(e.count)} elemento selezionato`,other:()=>`${t.number(e.count)} elementi selezionati`})}.`,selectedItem:e=>`${e.item} selezionato.`};var ct={};ct={deselectedItem:e=>`${e.item} \u{304C}\u{9078}\u{629E}\u{3055}\u{308C}\u{3066}\u{3044}\u{307E}\u{305B}\u{3093}\u{3002}`,longPressToSelect:`長押しして選択モードを開きます。`,select:`選択`,selectedAll:`すべての項目を選択しました。`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`項目が選択されていません`,one:()=>`${t.number(e.count)} \u{9805}\u{76EE}\u{3092}\u{9078}\u{629E}\u{3057}\u{307E}\u{3057}\u{305F}`,other:()=>`${t.number(e.count)} \u{9805}\u{76EE}\u{3092}\u{9078}\u{629E}\u{3057}\u{307E}\u{3057}\u{305F}`})}\u{3002}`,selectedItem:e=>`${e.item} \u{3092}\u{9078}\u{629E}\u{3057}\u{307E}\u{3057}\u{305F}\u{3002}`};var lt={};lt={deselectedItem:e=>`${e.item}\u{C774}(\u{AC00}) \u{C120}\u{D0DD}\u{B418}\u{C9C0} \u{C54A}\u{C558}\u{C2B5}\u{B2C8}\u{B2E4}.`,longPressToSelect:`선택 모드로 들어가려면 길게 누르십시오.`,select:`선택`,selectedAll:`모든 항목이 선택되었습니다.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`선택된 항목이 없습니다`,one:()=>`${t.number(e.count)}\u{AC1C} \u{D56D}\u{BAA9}\u{C774} \u{C120}\u{D0DD}\u{B418}\u{C5C8}\u{C2B5}\u{B2C8}\u{B2E4}`,other:()=>`${t.number(e.count)}\u{AC1C} \u{D56D}\u{BAA9}\u{C774} \u{C120}\u{D0DD}\u{B418}\u{C5C8}\u{C2B5}\u{B2C8}\u{B2E4}`})}.`,selectedItem:e=>`${e.item}\u{C774}(\u{AC00}) \u{C120}\u{D0DD}\u{B418}\u{C5C8}\u{C2B5}\u{B2C8}\u{B2E4}.`};var ut={};ut={deselectedItem:e=>`${e.item} nepasirinkta.`,longPressToSelect:`Norėdami įjungti pasirinkimo režimą, paspauskite ir palaikykite.`,select:`Pasirinkti`,selectedAll:`Pasirinkti visi elementai.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nepasirinktas nė vienas elementas`,one:()=>`Pasirinktas ${t.number(e.count)} elementas`,other:()=>`Pasirinkta element\u{173}: ${t.number(e.count)}`})}.`,selectedItem:e=>`Pasirinkta: ${e.item}.`};var dt={};dt={deselectedItem:e=>`Vienums ${e.item} nav atlas\u{12B}ts.`,longPressToSelect:`Ilgi turiet nospiestu. lai ieslēgtu atlases režīmu.`,select:`Atlasīt`,selectedAll:`Atlasīti visi vienumi.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nav atlasīts neviens vienums`,one:()=>`Atlas\u{12B}to vienumu skaits: ${t.number(e.count)}`,other:()=>`Atlas\u{12B}to vienumu skaits: ${t.number(e.count)}`})}.`,selectedItem:e=>`Atlas\u{12B}ts vienums ${e.item}.`};var ft={};ft={deselectedItem:e=>`${e.item} er ikke valgt.`,longPressToSelect:`Bruk et langt trykk for å gå inn i valgmodus.`,select:`Velg`,selectedAll:`Alle elementer er valgt.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Ingen elementer er valgt`,one:()=>`${t.number(e.count)} element er valgt`,other:()=>`${t.number(e.count)} elementer er valgt`})}.`,selectedItem:e=>`${e.item} er valgt.`};var pt={};pt={deselectedItem:e=>`${e.item} niet geselecteerd.`,longPressToSelect:`Druk lang om de selectiemodus te openen.`,select:`Selecteren`,selectedAll:`Alle items geselecteerd.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Geen items geselecteerd`,one:()=>`${t.number(e.count)} item geselecteerd`,other:()=>`${t.number(e.count)} items geselecteerd`})}.`,selectedItem:e=>`${e.item} geselecteerd.`};var mt={};mt={deselectedItem:e=>`Nie zaznaczono ${e.item}.`,longPressToSelect:`Naciśnij i przytrzymaj, aby wejść do trybu wyboru.`,select:`Zaznacz`,selectedAll:`Wszystkie zaznaczone elementy.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nie zaznaczono żadnych elementów`,one:()=>`${t.number(e.count)} zaznaczony element`,other:()=>`${t.number(e.count)} zaznaczonych element\xf3w`})}.`,selectedItem:e=>`Zaznaczono ${e.item}.`};var ht={};ht={deselectedItem:e=>`${e.item} n\xe3o selecionado.`,longPressToSelect:`Mantenha pressionado para entrar no modo de seleção.`,select:`Selecionar`,selectedAll:`Todos os itens selecionados.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nenhum item selecionado`,one:()=>`${t.number(e.count)} item selecionado`,other:()=>`${t.number(e.count)} itens selecionados`})}.`,selectedItem:e=>`${e.item} selecionado.`};var gt={};gt={deselectedItem:e=>`${e.item} n\xe3o selecionado.`,longPressToSelect:`Prima continuamente para entrar no modo de seleção.`,select:`Selecionar`,selectedAll:`Todos os itens selecionados.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nenhum item selecionado`,one:()=>`${t.number(e.count)} item selecionado`,other:()=>`${t.number(e.count)} itens selecionados`})}.`,selectedItem:e=>`${e.item} selecionado.`};var _t={};_t={deselectedItem:e=>`${e.item} neselectat.`,longPressToSelect:`Apăsați lung pentru a intra în modul de selectare.`,select:`Selectare`,selectedAll:`Toate elementele selectate.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Niciun element selectat`,one:()=>`${t.number(e.count)} element selectat`,other:()=>`${t.number(e.count)} elemente selectate`})}.`,selectedItem:e=>`${e.item} selectat.`};var vt={};vt={deselectedItem:e=>`${e.item} \u{43D}\u{435} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E}.`,longPressToSelect:`Нажмите и удерживайте для входа в режим выбора.`,select:`Выбрать`,selectedAll:`Выбраны все элементы.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Нет выбранных элементов`,one:()=>`${t.number(e.count)} \u{44D}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}`,other:()=>`${t.number(e.count)} \u{44D}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442}\u{43E}\u{432} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E}`})}.`,selectedItem:e=>`${e.item} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E}.`};var yt={};yt={deselectedItem:e=>`Nevybrat\xe9 polo\u{17E}ky: ${e.item}.`,longPressToSelect:`Dlhším stlačením prejdite do režimu výberu.`,select:`Vybrať`,selectedAll:`Všetky vybraté položky.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Žiadne vybraté položky`,one:()=>`${t.number(e.count)} vybrat\xe1 polo\u{17E}ka`,other:()=>`Po\u{10D}et vybrat\xfdch polo\u{17E}iek:${t.number(e.count)}`})}.`,selectedItem:e=>`Vybrat\xe9 polo\u{17E}ky: ${e.item}.`};var bt={};bt={deselectedItem:e=>`Element ${e.item} ni izbran.`,longPressToSelect:`Za izbirni način pritisnite in dlje časa držite.`,select:`Izberite`,selectedAll:`Vsi elementi so izbrani.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Noben element ni izbran`,one:()=>`${t.number(e.count)} element je izbran`,other:()=>`${t.number(e.count)} elementov je izbranih`})}.`,selectedItem:e=>`Element ${e.item} je izbran.`};var xt={};xt={deselectedItem:e=>`${e.item} nije izabrano.`,longPressToSelect:`Dugo pritisnite za ulazak u režim biranja.`,select:`Izaberite`,selectedAll:`Izabrane su sve stavke.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nije izabrana nijedna stavka`,one:()=>`Izabrana je ${t.number(e.count)} stavka`,other:()=>`Izabrano je ${t.number(e.count)} stavki`})}.`,selectedItem:e=>`${e.item} je izabrano.`};var St={};St={deselectedItem:e=>`${e.item} ej markerat.`,longPressToSelect:`Tryck länge när du vill öppna väljarläge.`,select:`Markera`,selectedAll:`Alla markerade objekt.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Inga markerade objekt`,one:()=>`${t.number(e.count)} markerat objekt`,other:()=>`${t.number(e.count)} markerade objekt`})}.`,selectedItem:e=>`${e.item} markerat.`};var Ct={};Ct={deselectedItem:e=>`${e.item} se\xe7ilmedi.`,longPressToSelect:`Seçim moduna girmek için uzun basın.`,select:`Seç`,selectedAll:`Tüm ögeler seçildi.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Hiçbir öge seçilmedi`,one:()=>`${t.number(e.count)} \xf6ge se\xe7ildi`,other:()=>`${t.number(e.count)} \xf6ge se\xe7ildi`})}.`,selectedItem:e=>`${e.item} se\xe7ildi.`};var wt={};wt={deselectedItem:e=>`${e.item} \u{43D}\u{435} \u{432}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E}.`,longPressToSelect:`Виконайте довге натиснення, щоб перейти в режим вибору.`,select:`Вибрати`,selectedAll:`Усі елементи вибрано.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Жодних елементів не вибрано`,one:()=>`${t.number(e.count)} \u{435}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442} \u{432}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E}`,other:()=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E} \u{435}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442}\u{456}\u{432}: ${t.number(e.count)}`})}.`,selectedItem:e=>`${e.item} \u{432}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E}.`};var Tt={};Tt={deselectedItem:e=>`\u{672A}\u{9009}\u{62E9} ${e.item}\u{3002}`,longPressToSelect:`长按以进入选择模式。`,select:`选择`,selectedAll:`已选择所有项目。`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`未选择项目`,one:()=>`\u{5DF2}\u{9009}\u{62E9} ${t.number(e.count)} \u{4E2A}\u{9879}\u{76EE}`,other:()=>`\u{5DF2}\u{9009}\u{62E9} ${t.number(e.count)} \u{4E2A}\u{9879}\u{76EE}`})}\u{3002}`,selectedItem:e=>`\u{5DF2}\u{9009}\u{62E9} ${e.item}\u{3002}`};var Et={};Et={deselectedItem:e=>`\u{672A}\u{9078}\u{53D6}\u{300C}${e.item}\u{300D}\u{3002}`,longPressToSelect:`長按以進入選擇模式。`,select:`選取`,selectedAll:`已選取所有項目。`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`未選取任何項目`,one:()=>`\u{5DF2}\u{9078}\u{53D6} ${t.number(e.count)} \u{500B}\u{9805}\u{76EE}`,other:()=>`\u{5DF2}\u{9078}\u{53D6} ${t.number(e.count)} \u{500B}\u{9805}\u{76EE}`})}\u{3002}`,selectedItem:e=>`\u{5DF2}\u{9078}\u{53D6}\u{300C}${e.item}\u{300D}\u{3002}`};var Dt={};Dt={"ar-AE":qe,"bg-BG":Je,"cs-CZ":Ye,"da-DK":Xe,"de-DE":Ze,"el-GR":Qe,"en-US":$e,"es-ES":et,"et-EE":tt,"fi-FI":nt,"fr-FR":rt,"he-IL":it,"hr-HR":at,"hu-HU":ot,"it-IT":st,"ja-JP":ct,"ko-KR":lt,"lt-LT":ut,"lv-LV":dt,"nb-NO":ft,"nl-NL":pt,"pl-PL":mt,"pt-BR":ht,"pt-PT":gt,"ro-RO":_t,"ru-RU":vt,"sk-SK":yt,"sl-SI":bt,"sr-SP":xt,"sv-SE":St,"tr-TR":Ct,"uk-UA":wt,"zh-CN":Tt,"zh-TW":Et};function Ot(e){return e&&e.__esModule?e.default:e}function kt(e,t){let{getRowText:n=e=>t.collection.getTextValue?.(e)??t.collection.getItem(e)?.textValue}=e,r=p(Ot(Dt),`@react-aria/grid`),i=t.selectionManager.rawSelection,o=(0,Y.useRef)(i),s=(0,Y.useCallback)(()=>{if(!t.selectionManager.isFocused||i===o.current){o.current=i;return}let e=At(i,o.current),s=At(o.current,i),c=t.selectionManager.selectionBehavior===`replace`,l=[];if(t.selectionManager.selectedKeys.size===1&&c){let e=t.selectionManager.selectedKeys.keys().next().value;if(e!=null&&t.collection.getItem(e)){let t=n(e);t&&l.push(r.format(`selectedItem`,{item:t}))}}else if(e.size===1&&s.size===0){let t=e.keys().next().value;if(t!=null){let e=n(t);e&&l.push(r.format(`selectedItem`,{item:e}))}}else if(s.size===1&&e.size===0){let e=s.keys().next().value;if(e!=null&&t.collection.getItem(e)){let t=n(e);t&&l.push(r.format(`deselectedItem`,{item:t}))}}t.selectionManager.selectionMode===`multiple`&&(l.length===0||i===`all`||i.size>1||o.current===`all`||o.current?.size>1)&&l.push(i===`all`?r.format(`selectedAll`):r.format(`selectedCount`,{count:i.size})),l.length>0&&a(l.join(` `)),o.current=i},[i,t.selectionManager.selectedKeys,t.selectionManager.isFocused,t.selectionManager.selectionBehavior,t.selectionManager.selectionMode,t.collection,n,r]);xe(()=>{if(t.selectionManager.isFocused)s();else{let e=requestAnimationFrame(s);return()=>cancelAnimationFrame(e)}},[i,t.selectionManager.isFocused])}function At(e,t){let n=new Set;if(e===`all`||t===`all`)return n;for(let r of e.keys())t.has(r)||n.add(r);return n}function jt(e){return e&&e.__esModule?e.default:e}function Mt(e){let t=p(jt(Dt),`@react-aria/grid`),n=E(),r=(n===`pointer`||n===`virtual`||n==null)&&typeof window<`u`&&`ontouchstart`in window,i=(0,Y.useMemo)(()=>{let n=e.selectionManager.selectionMode,i=e.selectionManager.selectionBehavior,a;return r&&(a=t.format(`longPressToSelect`)),i===`replace`&&n!==`none`&&e.hasItemActions?a:void 0},[e.selectionManager.selectionMode,e.selectionManager.selectionBehavior,e.hasItemActions,t,r]);return Pe(i)}function Nt(e){return e&&e.__esModule?e.default:e}function Pt(e,t){let{key:n}=e,r=t.selectionManager,i=fe(),a=!t.selectionManager.canSelectItem(n),o=t.selectionManager.isSelected(n);return{checkboxProps:{id:i,"aria-label":p(Nt(Dt),`@react-aria/grid`).format(`select`),isSelected:o,isDisabled:a,onChange:()=>r.toggleSelection(n)}}}for(var Ft=10,It=5,Lt=class{setup(e,t,n){this.delegate=e,this.state=t,this.direction=n}getDropTargetFromPoint(e,t,n){let r=this.delegate.getDropTargetFromPoint(e,t,n);return!r||r.type===`root`?r:this.resolveDropTarget(r,e,t,n)}resolveDropTarget(e,t,n,r){let i=this.pointerTracking,a=n-i.lastY,o=t-i.lastX,s=i.yDirection,c=i.xDirection;if(Math.abs(a)>It&&(s=a>0?`down`:`up`,i.yDirection=s,i.lastY=n),Math.abs(o)>Ft&&(c=o>0?`right`:`left`,i.xDirection=c,i.lastX=t),e.dropPosition===`before`){let t=this.state.collection.getKeyBefore(e.key);for(;t!=null;){let e=this.state.collection.getItem(t);if(e?.type===`item`)break;t=e?.parentKey??null}if(t!=null){let n={type:`item`,key:t,dropPosition:`after`};r(n)&&(e=n)}}let l=this.getPotentialTargets(e,r);if(l.length===0)return{type:`root`};let u;return l.length>1?u=this.selectTarget(l,e,t,n,s,c):(u=l[0],i.boundaryContext=null),u}getPotentialTargets(e,t){if(e.dropPosition===`on`)return[e];let n=e,r=this.state.collection,i=r.getItem(n.key);for(;i&&i?.type!==`item`&&i.nextKey!=null;)n.key=i.nextKey,i=r.getItem(i.nextKey);let a=[n];if(i&&i.hasChildNodes&&this.state.expandedKeys.has(i.key)&&r.getChildren&&n.dropPosition===`after`){let e=i.firstChildKey==null?null:r.getItem(i.firstChildKey);for(;e&&e.type!==`item`;)e=e.nextKey==null?null:r.getItem(e.nextKey);if(e?.type===`item`){let n={type:`item`,key:e.key,dropPosition:`before`};return t(n)?[n]:[]}}if(i?.nextKey!=null)return[e];let o=i?.parentKey,s=[];for(;o!=null;){let e=r.getItem(o),n=e?.nextKey==null?null:r.getItem(e.nextKey);if(!n||n.parentKey!==o){let e={type:`item`,key:o,dropPosition:`after`};if(t(e)&&s.push(e),n)break}o=e?.parentKey}if(s.length>0&&a.push(...s),a.length===1){let e=r.getKeyAfter(n.key),a=e==null?null:r.getItem(e);if(e!=null&&a&&i&&a.level!=null&&i.level!=null&&a.level>i.level){let n={type:`item`,key:e,dropPosition:`before`};if(t(n))return[n]}}return a.filter(t)}selectTarget(e,t,n,r,i,a){if(e.length<2)return e[0];let o=this.pointerTracking,s=this.state.collection.getItem(t.key)?.parentKey;if(s==null)return e[0];(!o.boundaryContext||o.boundaryContext.parentKey!==s)&&(o.boundaryContext={parentKey:s,preferredTargetIndex:o.yDirection===`up`?e.length-1:0,lastSwitchY:r,lastSwitchX:n});let c=o.boundaryContext,l=Math.abs(n-c.lastSwitchX);if(Math.abs(r-c.lastSwitchY)>It&&i){let t=c.preferredTargetIndex||0;i===`down`&&t===0?c.preferredTargetIndex=e.length-1:i===`up`&&t===e.length-1&&(c.preferredTargetIndex=0),o.xDirection=null}if(l>Ft&&a){let t=c.preferredTargetIndex||0;a===`left`?this.direction===`ltr`?t0&&(c.preferredTargetIndex=t-1,c.lastSwitchX=n):a===`right`&&(this.direction===`ltr`?t>0&&(c.preferredTargetIndex=t-1,c.lastSwitchX=n):t{let i=this.keyMap.get(r.key);e.visitNode&&(r=e.visitNode(r)),this.keyMap.set(r.key,r);let a=new Set,o=null,s=!1;if(r.type===`item`){for(let e of r.childNodes)if(e.props?.colSpan!==void 0){s=!0;break}}for(let e of r.childNodes)e.type===`cell`&&s&&(e.colspan=e.props?.colSpan,e.colSpan=e.props?.colSpan,e.colIndex=o?(o.colIndex??o.index)+(o.colSpan??1):e.index),e.type===`cell`&&e.parentKey==null&&(e.parentKey=r.key),a.add(e.key),o?(o.nextKey=e.key,e.prevKey=o.key):e.prevKey=null,t(e),o=e;if(o&&(o.nextKey=null),i)for(let e of i.childNodes)a.has(e.key)||n(e)},n=e=>{this.keyMap.delete(e.key);for(let t of e.childNodes)this.keyMap.get(t.key)===t&&n(t)},r=null;for(let[n,i]of e.items.entries()){let e={...i,level:i.level??0,key:i.key??`row-`+n,type:i.type??`row`,value:i.value??null,hasChildNodes:!0,childNodes:[...i.childNodes],rendered:i.rendered,textValue:i.textValue??``,index:i.index??n};r?(r.nextKey=e.key,e.prevKey=r.key):e.prevKey=null,this.rows.push(e),t(e),r=e}r&&(r.nextKey=null)}*[Symbol.iterator](){yield*[...this.rows]}get size(){return[...this.rows].length}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let t=this.keyMap.get(e);return t?t.prevKey??null:null}getKeyAfter(e){let t=this.keyMap.get(e);return t?t.nextKey??null:null}getFirstKey(){return[...this.rows][0]?.key}getLastKey(){let e=[...this.rows];return e[e.length-1]?.key}getItem(e){return this.keyMap.get(e)??null}at(e){let t=[...this.getKeys()];return this.getItem(t[e])}getChildren(e){return this.keyMap.get(e)?.childNodes||[]}},zt=`row-header-column-`+Math.random().toString(36).slice(2),Bt=`row-header-column-`+Math.random().toString(36).slice(2);zt===Bt;)Bt=`row-header-column-`+Math.random().toString(36).slice(2);function Vt(e,t){if(t.length===0)return[];let n=[],r=new Map;for(let i of t){let t=i.parentKey,a=[i];for(;t!=null;){let n=e.get(t);if(!n)break;if(r.has(n)){n.colSpan??=0,n.colSpan++,n.colspan=n.colSpan;let{column:e,index:t}=r.get(n);if(t>a.length)break;for(let n=t;ne.length)),a=Array(i).fill(0).map(()=>[]),o=0;for(let e of n){let t=i-1;for(let n of e){if(n){let e=a[t],r=e.reduce((e,t)=>e+(t.colSpan??1),0);if(r0&&(e[e.length-1].nextKey=i.key,i.prevKey=e[e.length-1].key),e.push(i)}e.length>0&&(e[e.length-1].nextKey=n.key,n.prevKey=e[e.length-1].key),n.level=t,n.colIndex=o,e.push(n)}t--}o++}let s=0;for(let e of a){let n=e.reduce((e,t)=>e+(t.colSpan??1),0);if(n({type:`headerrow`,key:`headerrow-`+t,index:t,value:null,rendered:null,level:0,hasChildNodes:!0,childNodes:e,textValue:``}))}var Ht=class extends Rt{constructor(e,t,n){let r=new Set,i=null,a=[];if(n?.showSelectionCheckboxes){let e={type:`column`,key:zt,value:null,textValue:``,level:0,index:+!!n?.showDragButtons,hasChildNodes:!1,rendered:null,childNodes:[],props:{isSelectionCell:!0}};a.unshift(e)}if(n?.showDragButtons){let e={type:`column`,key:Bt,value:null,textValue:``,level:0,index:0,hasChildNodes:!1,rendered:null,childNodes:[],props:{isDragButtonCell:!0}};a.unshift(e)}let o=[],s=new Map,c=e=>{switch(e.type){case`body`:i=e;break;case`column`:s.set(e.key,e),e.hasChildNodes||(a.push(e),e.props.isRowHeader&&r.add(e.key));break;case`item`:o.push(e);return}for(let t of e.childNodes)c(t)};for(let t of e)c(t);let l=Vt(s,a);if(l.forEach((e,t)=>o.splice(t,0,e)),super({columnCount:a.length,items:o,visitNode:e=>(e.column=a[e.index],e)}),this._size=0,this.columns=a,this.rowHeaderColumnKeys=r,this.body=i,this.headerRows=l,this._size=[...i.childNodes].length,this.rowHeaderColumnKeys.size===0){let e=this.columns.find(e=>!e.props?.isDragButtonCell&&!e.props?.isSelectionCell);e&&this.rowHeaderColumnKeys.add(e.key)}}*[Symbol.iterator](){yield*this.body.childNodes}get size(){return this._size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){return this.keyMap.get(e)?.prevKey??null}getKeyAfter(e){return this.keyMap.get(e)?.nextKey??null}getFirstKey(){return K(this.body.childNodes)?.key??null}getLastKey(){return q(this.body.childNodes)?.key??null}getItem(e){return e===this.body.key?this.body:this.keyMap.get(e)??null}at(e){let t=[...this.getKeys()];return this.getItem(t[e])}getChildren(e){if(e===this.body.key)return this.body.childNodes;let t=this.getItem(e);return t?.type===`item`?[...t.childNodes].filter(e=>e.type===`cell`):super.getChildren(e)}getTextValue(e){let t=this.getItem(e);if(!t)return``;if(t.textValue)return t.textValue;let n=this.rowHeaderColumnKeys;if(n){let e=[];for(let r of t.childNodes){let t=this.columns[r.index];if(n.has(t.key)&&r.textValue&&e.push(r.textValue),e.length===n.size)break}return e.join(` `)}return``}};function Ut(e){return e!=null&&(!isNaN(e)||String(e).match(/^(\d+)(?=%$)/)!==null)}function Wt(e){if(!e||typeof e==`number`)return 1;let t=e.match(/^(.+)(?=fr$)/);return t?parseFloat(t[0]):1}function Gt(e,t){if(typeof e==`string`){let n=e.match(/^(\d+)(?=%$)/);if(!n)throw Error(`Only percentages or numbers are supported for static column widths`);return t*(parseFloat(n[0])/100)}return e}function Kt(e,t){return e==null?2**53-1:Gt(e,t)}function qt(e,t){return e==null?0:Gt(e,t)}function Jt(e,t,n,r,i){let a=e,o=Math.floor(e),s=e-o>0;e=o;let c=!1,l=t.map((t,a)=>{let o=n.get(t.key)==null?t.width??t.defaultWidth??r?.(a)??`1fr`:n.get(t.key)??`1fr`,s=!1,l=0,u=0,d=0;Ut(o)?(l=Gt(o,e),s=!0):(u=Wt(o),u<=0&&(s=!0));let f=qt(t.minWidth??i?.(a)??0,e),p=Kt(t.maxWidth,e),m=Math.max(f,Math.min(l,p));return s?d=m:l>m&&(s=!0,d=m),s||(c=!0),{frozen:s,baseSize:l,hypotheticalMainSize:m,min:f,max:p,flex:u,targetMainSize:d,violation:0}});for(;c;){let t=0,n=0;l.forEach(e=>{e.frozen?t+=e.targetMainSize:(t+=e.baseSize,n+=e.flex)});let r=e-t;r>0&&l.forEach(e=>{if(!e.frozen){let t=e.flex/n;e.targetMainSize=e.baseSize+t*r}});let i=0;l.forEach(e=>{if(e.violation=0,!e.frozen){let{min:t,max:n,targetMainSize:r}=e;e.targetMainSize=Math.max(t,Math.min(r,n)),e.violation=e.targetMainSize-r,i+=e.violation}}),c=!1,l.forEach(e=>{i===0||Math.sign(i)===Math.sign(e.violation)?e.frozen=!0:e.frozen||(c=!0)})}let u=Yt(l);if(s&&u.length>0){let e=a.toString().split(`.`)[1],t=u[u.length-1].toString();u[u.length-1]=Number(t+`.`+e)}return u}function Yt(e){let t=0,n=0,r=[];return e.forEach(function(e){let i=e.targetMainSize,a=Math.round(i+t)-n;t+=i,n+=a,r.push(a)}),r}var Xt=class{constructor(e){this.columnWidths=new Map,this.columnMinWidths=new Map,this.columnMaxWidths=new Map,this.getDefaultWidth=e?.getDefaultWidth??(()=>`1fr`),this.getDefaultMinWidth=e?.getDefaultMinWidth??(()=>75)}splitColumnsIntoControlledAndUncontrolled(e){return e.reduce((e,t)=>(t.props.width==null?e[1].set(t.key,t):e[0].set(t.key,t),e),[new Map,new Map])}recombineColumns(e,t,n,r){return new Map(e.map(e=>n.has(e.key)?[e.key,t.get(e.key)]:[e.key,r.get(e.key).props.width]))}getInitialUncontrolledWidths(e){return new Map(Array.from(e).map(([e,t])=>[e,t.props.defaultWidth??this.getDefaultWidth?.(t)??`1fr`]))}getColumnWidth(e){return this.columnWidths.get(e)??0}getColumnMinWidth(e){return this.columnMinWidths.get(e)??0}getColumnMaxWidth(e){return this.columnMaxWidths.get(e)??0}resizeColumnWidth(e,t,n,r){let i=this.columnWidths,a=!0,o=new Map;return r=Math.max(this.getColumnMinWidth(n),Math.min(this.getColumnMaxWidth(n),Math.floor(r))),e.columns.forEach(e=>{e.key===n?(o.set(e.key,r),a=!1):a?o.set(e.key,i.get(e.key)??0):o.set(e.key,e.props.width??t.get(e.key))}),o}buildColumnWidths(e,t,n){return this.columnWidths=new Map,this.columnMinWidths=new Map,this.columnMaxWidths=new Map,Jt(e,t.columns.map(e=>({...e.props,key:e.key})),n,e=>this.getDefaultWidth(t.columns[e]),e=>this.getDefaultMinWidth(t.columns[e])).forEach((n,r)=>{let i=t.columns[r].key,a=t.columns[r];this.columnWidths.set(i,n),this.columnMinWidths.set(i,qt(a.props.minWidth??this.getDefaultMinWidth(a),e)),this.columnMaxWidths.set(i,Kt(a.props.maxWidth,e))}),this.columnWidths}};function Zt(e,t){let{getDefaultWidth:n,getDefaultMinWidth:r,tableWidth:i=0}=e,[a,o]=(0,Y.useState)(null),s=(0,Y.useMemo)(()=>new Xt({getDefaultWidth:n,getDefaultMinWidth:r}),[n,r]),[c,l]=(0,Y.useMemo)(()=>s.splitColumnsIntoControlledAndUncontrolled(t.collection.columns),[t.collection.columns,s]),[u,d]=(0,Y.useState)(()=>s.getInitialUncontrolledWidths(l)),[f,p]=(0,Y.useState)(t.collection.columns);t.collection.columns!==f&&((t.collection.columns.length!==f.length||t.collection.columns.some((e,t)=>e.key!==f[t].key))&&d(s.getInitialUncontrolledWidths(l)),p(t.collection.columns));let m=(0,Y.useMemo)(()=>s.recombineColumns(t.collection.columns,u,l,c),[t.collection.columns,u,l,c,s]),h=(0,Y.useCallback)(e=>{o(e)},[o]),g=(0,Y.useCallback)((e,n)=>{let r=s.resizeColumnWidth(t.collection,u,e,n),i=new Map(Array.from(l).map(([e])=>[e,r.get(e)]));return i.set(e,n),d(i),r},[l,d,s,t.collection,u]),_=(0,Y.useCallback)(()=>{o(null)},[o]),v=(0,Y.useMemo)(()=>s.buildColumnWidths(i,t.collection,m),[i,t.collection,m,s]);return(0,Y.useMemo)(()=>({resizingColumn:a,updateResizedColumns:g,startResize:h,endResize:_,getColumnWidth:e=>s.getColumnWidth(e),getColumnMinWidth:e=>s.getColumnMinWidth(e),getColumnMaxWidth:e=>s.getColumnMaxWidth(e),tableState:t,columnWidths:v}),[s,v,a,g,h,_,t])}function Qt(e){let{collection:t,focusMode:n}=e,r=e.UNSAFE_selectionState||Fe(e),i=(0,Y.useMemo)(()=>e.disabledKeys?new Set(e.disabledKeys):new Set,[e.disabledKeys]),a=r.setFocusedKey;r.setFocusedKey=(e,r)=>{if(n===`cell`&&e!=null){let n=t.getItem(e);if(n?.type===`item`){let i=J(n,t);e=r===`last`?q(i)?.key??null:K(i)?.key??null}}a(e,r)};let o=(0,Y.useMemo)(()=>new je(t,r),[t,r]),s=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{if(r.focusedKey!=null&&s.current&&!t.getItem(r.focusedKey)){let e=s.current.getItem(r.focusedKey),n=e?.parentKey!=null&&(e.type===`cell`||e.type===`rowheader`||e.type===`column`)?s.current.getItem(e.parentKey):e;if(!n){r.setFocusedKey(null);return}let i=s.current.rows,a=t.rows,c=i.length-a.length,l=Math.min(c>1?Math.max(n.index-c+1,0):n.index,a.length-1),u=null;for(let e=Math.max(0,l);e=0;e--)if(!o.isDisabled(a[e].key)&&a[e].type!==`headerrow`){u=a[e];break}}if(u){let i=u.hasChildNodes?[...J(u,t)]:[],a=u.hasChildNodes&&n!==e&&e&&e.index({showSelectionCheckboxes:i&&r!==`none`,showDragButtons:a,selectionMode:r,columns:[]}),[e.children,i,r,a]),c=Ne(e,(0,Y.useCallback)(e=>new Ht(e,null,s),[s]),s),{disabledKeys:l,selectionManager:u}=Qt({...e,collection:c,disabledBehavior:e.disabledBehavior||`selection`}),[d,f]=de(e.expandedKeys?new Set(e.expandedKeys):void 0,e.defaultExpandedKeys?new Set(e.defaultExpandedKeys):new Set,e.onExpandedChange);return{collection:c,disabledKeys:l,selectionManager:u,showSelectionCheckboxes:e.showSelectionCheckboxes||!1,sortDescriptor:e.sortDescriptor??null,isKeyboardNavigationDisabled:c.size===0||t,setKeyboardNavigationDisabled:n,sort(t,n){e.onSortChange?.({column:t,direction:n??(e.sortDescriptor?.column===t?$t[e.sortDescriptor.direction]:`ascending`)})},expandedKeys:d,toggleKey(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},treeColumn:o}}function tn(e,t){let n=(0,Y.useMemo)(()=>t?e.collection.filter(t):e.collection,[e.collection,t]),r=e.selectionManager.withCollection(n);return{...e,collection:n,selectionManager:r}}var nn=class{constructor(e){if(this.collection=e.collection,this.disabledKeys=e.disabledKeys,this.disabledBehavior=e.disabledBehavior||`all`,this.direction=e.direction,this.collator=e.collator,!e.layout&&!e.ref)throw Error(`Either a layout or a ref must be specified.`);this.layoutDelegate=e.layoutDelegate||(e.layout?new rn(e.layout):new Re(e.ref)),this.focusMode=e.focusMode??`row`}isCell(e){return e.type===`cell`}isRow(e){return e.type===`row`||e.type===`item`}isDisabled(e){return this.disabledBehavior===`all`&&(e.props?.isDisabled||this.disabledKeys.has(e.key))&&e.props?.disabledBehavior!==`selection`}findPreviousKey(e,t,n=!1){let r=e==null?this.collection.getLastKey():this.collection.getKeyBefore(e);for(;r!=null;){let e=this.collection.getItem(r);if(!e)return null;if((n||!this.isDisabled(e))&&(!t||t(e)))return r;r=this.collection.getKeyBefore(r)}return null}findNextKey(e,t,n=!1){let r=e==null?this.collection.getFirstKey():this.collection.getKeyAfter(e);for(;r!=null;){let e=this.collection.getItem(r);if(!e)return null;if((n||!this.isDisabled(e))&&(!t||t(e)))return r;if(r=this.collection.getKeyAfter(r),r==null)return null}return null}getKeyForItemInRowByIndex(e,t=0){if(t<0)return null;let n=this.collection.getItem(e);if(!n)return null;let r=0;for(let e of J(n,this.collection)){if(e.colSpan&&e.colSpan+r>t||(e.colSpan&&(r=r+e.colSpan-1),r===t))return e.key??null;r++}return null}getKeyBelow(e,t){let n=e,r=this.collection.getItem(n);if(!r||(this.isCell(r)&&(n=r.parentKey??null),n==null))return null;if(n=this.findNextKey(n,e=>e.type===`item`,t?.includeDisabled),n!=null){if(this.isCell(r)){let e=r.colIndex?r.colIndex:r.index;return this.getKeyForItemInRowByIndex(n,e)}if(this.focusMode===`row`)return n}return null}getKeyAbove(e,t){let n=e,r=this.collection.getItem(n);if(!r||(this.isCell(r)&&(n=r.parentKey??null),n==null))return null;if(n=this.findPreviousKey(n,e=>e.type===`item`,t?.includeDisabled),n!=null){if(this.isCell(r)){let e=r.colIndex?r.colIndex:r.index;return this.getKeyForItemInRowByIndex(n,e)}if(this.focusMode===`row`)return n}return null}getKeyRightOf(e){let t=this.collection.getItem(e);if(!t)return null;if(this.isRow(t)){let e=J(t,this.collection);return(this.direction===`rtl`?q(e)?.key:K(e)?.key)??null}if(this.isCell(t)&&t.parentKey!=null){let n=this.collection.getItem(t.parentKey);if(!n)return null;let r=J(n,this.collection),i=(this.direction===`rtl`?Be(r,t.index-1):Be(r,t.index+1))??null;return i?i.key??null:this.focusMode===`row`?t.parentKey??null:(this.direction===`rtl`?this.getFirstKey(e):this.getLastKey(e))??null}return null}getKeyLeftOf(e){let t=this.collection.getItem(e);if(!t)return null;if(this.isRow(t)){let e=J(t,this.collection);return(this.direction===`rtl`?K(e)?.key:q(e)?.key)??null}if(this.isCell(t)&&t.parentKey!=null){let n=this.collection.getItem(t.parentKey);if(!n)return null;let r=J(n,this.collection),i=(this.direction===`rtl`?Be(r,t.index+1):Be(r,t.index-1))??null;return i?i.key??null:this.focusMode===`row`?t.parentKey??null:(this.direction===`rtl`?this.getLastKey(e):this.getFirstKey(e))??null}return null}getFirstKey(e,t){let n=e??null,r;if(n!=null){if(r=this.collection.getItem(n),!r)return null;if(this.isCell(r)&&!t&&r.parentKey!=null){let e=this.collection.getItem(r.parentKey);return e?K(J(e,this.collection))?.key??null:null}}if(n=this.findNextKey(void 0,e=>e.type===`item`),n!=null&&(r&&this.isCell(r)&&t||this.focusMode===`cell`)){let e=this.collection.getItem(n);if(!e)return null;n=K(J(e,this.collection))?.key??null}return n}getLastKey(e,t){let n=e??null,r;if(n!=null){if(r=this.collection.getItem(n),!r)return null;if(this.isCell(r)&&!t&&r.parentKey!=null){let e=this.collection.getItem(r.parentKey);if(!e)return null;let t=J(e,this.collection);return q(t)?.key??null}}if(n=this.findPreviousKey(void 0,e=>e.type===`item`),n!=null&&(r&&this.isCell(r)&&t||this.focusMode===`cell`)){let e=this.collection.getItem(n);if(!e)return null;let t=J(e,this.collection);n=q(t)?.key??null}return n}getKeyPageAbove(e){let t=e,n=this.layoutDelegate.getItemRect(t);if(!n)return null;let r=Math.max(0,n.y+n.height-this.layoutDelegate.getVisibleRect().height);for(;n&&n.y>r&&t!=null&&(t=this.getKeyAbove(t)??null,t!=null);)n=this.layoutDelegate.getItemRect(t);return t}getKeyPageBelow(e){let t=e,n=this.layoutDelegate.getItemRect(t);if(!n)return null;let r=this.layoutDelegate.getVisibleRect().height,i=Math.min(this.layoutDelegate.getContentSize().height,n.y+r);for(;n&&n.y+n.heighte.type===`item`),n==null&&!a&&(n=this.getFirstKey(),a=!0)}return null}},rn=class{constructor(e){this.layout=e}getContentSize(){return this.layout.getContentSize()}getItemRect(e){return this.layout.getLayoutInfo(e)?.rect||null}getVisibleRect(){return this.layout.virtualizer.visibleRect}},an=new WeakMap;function on(e,t,n){let{isVirtualized:r,disallowTypeAhead:i,keyboardDelegate:a,focusMode:o,scrollRef:s,getRowText:c,onRowAction:l,onCellAction:u,escapeKeyBehavior:d=`clearSelection`,shouldSelectOnPressUp:f,keyboardNavigationBehavior:p=`arrow`}=e,{selectionManager:m}=t;!e[`aria-label`]&&!e[`aria-labelledby`]&&console.warn(`An aria-label or aria-labelledby prop is required for accessibility.`);let h=Ve({usage:`search`,sensitivity:`base`}),{direction:g}=z(),_=t.selectionManager.disabledBehavior,v=(0,Y.useMemo)(()=>a||new nn({collection:t.collection,disabledKeys:t.disabledKeys,disabledBehavior:_,ref:n,direction:g,collator:h,focusMode:o}),[a,t.collection,t.disabledKeys,_,n,g,h,o]),{collectionProps:y}=He({ref:n,selectionManager:m,keyboardDelegate:v,isVirtualized:r,scrollRef:s,disallowTypeAhead:i,escapeKeyBehavior:d}),b=fe(e.id);an.set(t,{keyboardDelegate:v,actions:{onRowAction:l,onCellAction:u},shouldSelectOnPressUp:f,keyboardNavigationBehavior:p});let x=Mt({selectionManager:m,hasItemActions:!!(l||u)}),S=B(e,{labelable:!0}),C=(0,Y.useCallback)(e=>{if(m.isFocused){F(e.currentTarget,H(e))||m.setFocused(!1);return}F(e.currentTarget,H(e))&&m.setFocused(!0)},[m]),w=(0,Y.useMemo)(()=>({onBlur:y.onBlur,onFocus:C}),[C,y.onBlur]),T=Ae(n,{isDisabled:t.collection.size!==0}),E=k(S,{role:`grid`,id:b,"aria-multiselectable":m.selectionMode===`multiple`?`true`:void 0},t.isKeyboardNavigationDisabled?w:y,t.collection.size===0&&{tabIndex:T?-1:0}||void 0,x);return r&&(E[`aria-rowcount`]=t.collection.size,E[`aria-colcount`]=t.collection.columnCount),kt({getRowText:c},t),{gridProps:E}}var sn=new WeakMap;function cn(e){return typeof e==`string`?e.replace(/\s*/g,``):``+e}function ln(e,t){let n=sn.get(e);if(!n)throw Error(`Unknown grid`);return`${n}-${cn(t)}`}function un(e,t,n){let r=sn.get(e);if(!r)throw Error(`Unknown grid`);return`${r}-${cn(t)}-${cn(n)}`}function dn(e,t){return[...e.collection.rowHeaderColumnKeys].map(n=>un(e,t,n)).join(` `)}var fn={};fn={ascending:`تصاعدي`,ascendingSort:e=>`\u{62A}\u{631}\u{62A}\u{64A}\u{628} \u{62D}\u{633}\u{628} \u{627}\u{644}\u{639}\u{645}\u{648}\u{62F} ${e.columnName} \u{628}\u{62A}\u{631}\u{62A}\u{64A}\u{628} \u{62A}\u{635}\u{627}\u{639}\u{62F}\u{64A}`,collapse:`طي`,columnSize:e=>`${e.value} \u{628}\u{627}\u{644}\u{628}\u{643}\u{633}\u{644}`,descending:`تنازلي`,descendingSort:e=>`\u{62A}\u{631}\u{62A}\u{64A}\u{628} \u{62D}\u{633}\u{628} \u{627}\u{644}\u{639}\u{645}\u{648}\u{62F} ${e.columnName} \u{628}\u{62A}\u{631}\u{62A}\u{64A}\u{628} \u{62A}\u{646}\u{627}\u{632}\u{644}\u{64A}`,expand:`تمديد`,resizerDescription:`اضغط على مفتاح Enter لبدء تغيير الحجم`,select:`تحديد`,selectAll:`تحديد الكل`,sortable:`عمود قابل للترتيب`};var pn={};pn={ascending:`възходящ`,ascendingSort:e=>`\u{441}\u{43E}\u{440}\u{442}\u{438}\u{440}\u{430}\u{43D}\u{43E} \u{43F}\u{43E} \u{43A}\u{43E}\u{43B}\u{43E}\u{43D}\u{430} ${e.columnName} \u{432}\u{44A}\u{432} \u{432}\u{44A}\u{437}\u{445}\u{43E}\u{434}\u{44F}\u{449} \u{440}\u{435}\u{434}`,collapse:`Свиване`,columnSize:e=>`${e.value} \u{43F}\u{438}\u{43A}\u{441}\u{435}\u{43B}\u{430}`,descending:`низходящ`,descendingSort:e=>`\u{441}\u{43E}\u{440}\u{442}\u{438}\u{440}\u{430}\u{43D}\u{43E} \u{43F}\u{43E} \u{43A}\u{43E}\u{43B}\u{43E}\u{43D}\u{430} ${e.columnName} \u{432} \u{43D}\u{438}\u{437}\u{445}\u{43E}\u{434}\u{44F}\u{449} \u{440}\u{435}\u{434}`,expand:`Разширяване`,resizerDescription:`Натиснете „Enter“, за да започнете да преоразмерявате`,select:`Изберете`,selectAll:`Изберете всичко`,sortable:`сортираща колона`};var mn={};mn={ascending:`vzestupně`,ascendingSort:e=>`\u{159}azeno vzestupn\u{11B} podle sloupce ${e.columnName}`,collapse:`Sbalit`,columnSize:e=>`${e.value} pixel\u{16F}`,descending:`sestupně`,descendingSort:e=>`\u{159}azeno sestupn\u{11B} podle sloupce ${e.columnName}`,expand:`Roztáhnout`,resizerDescription:`Stisknutím klávesy Enter začnete měnit velikost`,select:`Vybrat`,selectAll:`Vybrat vše`,sortable:`sloupec s možností řazení`};var hn={};hn={ascending:`stigende`,ascendingSort:e=>`sorteret efter kolonne ${e.columnName} i stigende r\xe6kkef\xf8lge`,collapse:`Skjul`,columnSize:e=>`${e.value} pixels`,descending:`faldende`,descendingSort:e=>`sorteret efter kolonne ${e.columnName} i faldende r\xe6kkef\xf8lge`,expand:`Udvid`,resizerDescription:`Tryk på Enter for at ændre størrelse`,select:`Vælg`,selectAll:`Vælg alle`,sortable:`sorterbar kolonne`};var gn={};gn={ascending:`aufsteigend`,ascendingSort:e=>`sortiert nach Spalte ${e.columnName} in aufsteigender Reihenfolge`,collapse:`Reduzieren`,columnSize:e=>`${e.value} Pixel`,descending:`absteigend`,descendingSort:e=>`sortiert nach Spalte ${e.columnName} in absteigender Reihenfolge`,expand:`Erweitern`,resizerDescription:`Eingabetaste zum Starten der Größenänderung drücken`,select:`Auswählen`,selectAll:`Alles auswählen`,sortable:`sortierbare Spalte`};var _n={};_n={ascending:`αύξουσα`,ascendingSort:e=>`\u{3B4}\u{3B9}\u{3B1}\u{3BB}\u{3BF}\u{3B3}\u{3AE} \u{3B1}\u{3BD}\u{3AC} \u{3C3}\u{3C4}\u{3AE}\u{3BB}\u{3B7} ${e.columnName} \u{3C3}\u{3B5} \u{3B1}\u{3CD}\u{3BE}\u{3BF}\u{3C5}\u{3C3}\u{3B1} \u{3C3}\u{3B5}\u{3B9}\u{3C1}\u{3AC}`,collapse:`Σύμπτυξη`,columnSize:e=>`${e.value} pixel`,descending:`φθίνουσα`,descendingSort:e=>`\u{3B4}\u{3B9}\u{3B1}\u{3BB}\u{3BF}\u{3B3}\u{3AE} \u{3B1}\u{3BD}\u{3AC} \u{3C3}\u{3C4}\u{3AE}\u{3BB}\u{3B7} ${e.columnName} \u{3C3}\u{3B5} \u{3C6}\u{3B8}\u{3AF}\u{3BD}\u{3BF}\u{3C5}\u{3C3}\u{3B1} \u{3C3}\u{3B5}\u{3B9}\u{3C1}\u{3AC}`,expand:`Ανάπτυξη`,resizerDescription:`Πατήστε Enter για έναρξη της αλλαγής μεγέθους`,select:`Επιλογή`,selectAll:`Επιλογή όλων`,sortable:`Στήλη διαλογής`};var vn={};vn={select:`Select`,selectAll:`Select All`,sortable:`sortable column`,ascending:`ascending`,descending:`descending`,ascendingSort:e=>`sorted by column ${e.columnName} in ascending order`,descendingSort:e=>`sorted by column ${e.columnName} in descending order`,columnSize:e=>`${e.value} pixels`,resizerDescription:`Press Enter to start resizing`,expand:`Expand`,collapse:`Collapse`};var yn={};yn={ascending:`ascendente`,ascendingSort:e=>`ordenado por columna ${e.columnName} en sentido ascendente`,collapse:`Contraer`,columnSize:e=>`${e.value} p\xedxeles`,descending:`descendente`,descendingSort:e=>`ordenado por columna ${e.columnName} en orden descendente`,expand:`Ampliar`,resizerDescription:`Pulse Intro para empezar a redimensionar`,select:`Seleccionar`,selectAll:`Seleccionar todos`,sortable:`columna ordenable`};var bn={};bn={ascending:`tõusev järjestus`,ascendingSort:e=>`sorditud veeru j\xe4rgi ${e.columnName} t\xf5usvas j\xe4rjestuses`,collapse:`Ahenda`,columnSize:e=>`${e.value} pikslit`,descending:`laskuv järjestus`,descendingSort:e=>`sorditud veeru j\xe4rgi ${e.columnName} laskuvas j\xe4rjestuses`,expand:`Laienda`,resizerDescription:`Suuruse muutmise alustamiseks vajutage klahvi Enter`,select:`Vali`,selectAll:`Vali kõik`,sortable:`sorditav veerg`};var xn={};xn={ascending:`nouseva`,ascendingSort:e=>`lajiteltu sarakkeen ${e.columnName} mukaan nousevassa j\xe4rjestyksess\xe4`,collapse:`Pienennä`,columnSize:e=>`${e.value} pikseli\xe4`,descending:`laskeva`,descendingSort:e=>`lajiteltu sarakkeen ${e.columnName} mukaan laskevassa j\xe4rjestyksess\xe4`,expand:`Laajenna`,resizerDescription:`Aloita koon muutos painamalla Enter-näppäintä`,select:`Valitse`,selectAll:`Valitse kaikki`,sortable:`lajiteltava sarake`};var Sn={};Sn={ascending:`croissant`,ascendingSort:e=>`tri\xe9 en fonction de la colonne\xa0${e.columnName} par ordre croissant`,collapse:`Réduire`,columnSize:e=>`${e.value}\xa0pixels`,descending:`décroissant`,descendingSort:e=>`tri\xe9 en fonction de la colonne\xa0${e.columnName} par ordre d\xe9croissant`,expand:`Développer`,resizerDescription:`Appuyez sur Entrée pour commencer le redimensionnement.`,select:`Sélectionner`,selectAll:`Sélectionner tout`,sortable:`colonne triable`};var Cn={};Cn={ascending:`עולה`,ascendingSort:e=>`\u{5DE}\u{5D5}\u{5D9}\u{5DF} \u{5DC}\u{5E4}\u{5D9} \u{5E2}\u{5DE}\u{5D5}\u{5D3}\u{5D4} ${e.columnName} \u{5D1}\u{5E1}\u{5D3}\u{5E8} \u{5E2}\u{5D5}\u{5DC}\u{5D4}`,collapse:`כווץ`,columnSize:e=>`${e.value} \u{5E4}\u{5D9}\u{5E7}\u{5E1}\u{5DC}\u{5D9}\u{5DD}`,descending:`יורד`,descendingSort:e=>`\u{5DE}\u{5D5}\u{5D9}\u{5DF} \u{5DC}\u{5E4}\u{5D9} \u{5E2}\u{5DE}\u{5D5}\u{5D3}\u{5D4} ${e.columnName} \u{5D1}\u{5E1}\u{5D3}\u{5E8} \u{5D9}\u{5D5}\u{5E8}\u{5D3}`,expand:`הרחב`,resizerDescription:`הקש Enter כדי לשנות את הגודל`,select:`בחר`,selectAll:`בחר הכול`,sortable:`עמודה שניתן למיין`};var wn={};wn={ascending:`rastući`,ascendingSort:e=>`razvrstano po stupcima ${e.columnName} rastu\u{107}em redoslijedom`,collapse:`Sažmi`,columnSize:e=>`${e.value} piksela`,descending:`padajući`,descendingSort:e=>`razvrstano po stupcima ${e.columnName} padaju\u{107}im redoslijedom`,expand:`Proširi`,resizerDescription:`Pritisnite Enter da biste započeli promenu veličine`,select:`Odaberite`,selectAll:`Odaberite sve`,sortable:`stupac koji se može razvrstati`};var Tn={};Tn={ascending:`növekvő`,ascendingSort:e=>`rendezve a(z) ${e.columnName} oszlop szerint, n\xf6vekv\u{151} sorrendben`,collapse:`Összecsukás`,columnSize:e=>`${e.value} k\xe9ppont`,descending:`csökkenő`,descendingSort:e=>`rendezve a(z) ${e.columnName} oszlop szerint, cs\xf6kken\u{151} sorrendben`,expand:`Kibontás`,resizerDescription:`Nyomja le az Enter billentyűt az átméretezés megkezdéséhez`,select:`Kijelölés`,selectAll:`Összes kijelölése`,sortable:`rendezendő oszlop`};var En={};En={ascending:`crescente`,ascendingSort:e=>`in ordine crescente in base alla colonna ${e.columnName}`,collapse:`Comprimi`,columnSize:e=>`${e.value} pixel`,descending:`decrescente`,descendingSort:e=>`in ordine decrescente in base alla colonna ${e.columnName}`,expand:`Espandi`,resizerDescription:`Premi Invio per iniziare a ridimensionare`,select:`Seleziona`,selectAll:`Seleziona tutto`,sortable:`colonna ordinabile`};var Dn={};Dn={ascending:`昇順`,ascendingSort:e=>`\u{5217} ${e.columnName} \u{3092}\u{6607}\u{9806}\u{3067}\u{4E26}\u{3079}\u{66FF}\u{3048}`,collapse:`折りたたむ`,columnSize:e=>`${e.value} \u{30D4}\u{30AF}\u{30BB}\u{30EB}`,descending:`降順`,descendingSort:e=>`\u{5217} ${e.columnName} \u{3092}\u{964D}\u{9806}\u{3067}\u{4E26}\u{3079}\u{66FF}\u{3048}`,expand:`展開`,resizerDescription:`Enter キーを押してサイズ変更を開始`,select:`選択`,selectAll:`すべて選択`,sortable:`並べ替え可能な列`};var On={};On={ascending:`오름차순`,ascendingSort:e=>`${e.columnName} \u{C5F4}\u{C744} \u{AE30}\u{C900}\u{C73C}\u{B85C} \u{C624}\u{B984}\u{CC28}\u{C21C}\u{C73C}\u{B85C} \u{C815}\u{B82C}\u{B428}`,collapse:`접기`,columnSize:e=>`${e.value} \u{D53D}\u{C140}`,descending:`내림차순`,descendingSort:e=>`${e.columnName} \u{C5F4}\u{C744} \u{AE30}\u{C900}\u{C73C}\u{B85C} \u{B0B4}\u{B9BC}\u{CC28}\u{C21C}\u{C73C}\u{B85C} \u{C815}\u{B82C}\u{B428}`,expand:`펼치기`,resizerDescription:`크기 조정을 시작하려면 Enter를 누르세요.`,select:`선택`,selectAll:`모두 선택`,sortable:`정렬 가능한 열`};var kn={};kn={ascending:`didėjančia tvarka`,ascendingSort:e=>`surikiuota pagal stulpel\u{12F} ${e.columnName} did\u{117}jan\u{10D}ia tvarka`,collapse:`Sutraukti`,columnSize:e=>`${e.value} piks.`,descending:`mažėjančia tvarka`,descendingSort:e=>`surikiuota pagal stulpel\u{12F} ${e.columnName} ma\u{17E}\u{117}jan\u{10D}ia tvarka`,expand:`Išskleisti`,resizerDescription:`Paspauskite „Enter“, kad pradėtumėte keisti dydį`,select:`Pasirinkti`,selectAll:`Pasirinkti viską`,sortable:`rikiuojamas stulpelis`};var An={};An={ascending:`augošā secībā`,ascendingSort:e=>`k\u{101}rtots p\u{113}c kolonnas ${e.columnName} augo\u{161}\u{101} sec\u{12B}b\u{101}`,collapse:`Sakļaut`,columnSize:e=>`${e.value} pikse\u{13C}i`,descending:`dilstošā secībā`,descendingSort:e=>`k\u{101}rtots p\u{113}c kolonnas ${e.columnName} dilsto\u{161}\u{101} sec\u{12B}b\u{101}`,expand:`Izvērst`,resizerDescription:`Nospiediet Enter, lai sāktu izmēru mainīšanu`,select:`Atlasīt`,selectAll:`Atlasīt visu`,sortable:`kārtojamā kolonna`};var jn={};jn={ascending:`stigende`,ascendingSort:e=>`sortert etter kolonne ${e.columnName} i stigende rekkef\xf8lge`,collapse:`Skjul`,columnSize:e=>`${e.value} piksler`,descending:`synkende`,descendingSort:e=>`sortert etter kolonne ${e.columnName} i synkende rekkef\xf8lge`,expand:`Utvid`,resizerDescription:`Trykk på Enter for å starte størrelsesendring`,select:`Velg`,selectAll:`Velg alle`,sortable:`kolonne som kan sorteres`};var Mn={};Mn={ascending:`oplopend`,ascendingSort:e=>`gesorteerd in oplopende volgorde in kolom ${e.columnName}`,collapse:`Samenvouwen`,columnSize:e=>`${e.value} pixels`,descending:`aflopend`,descendingSort:e=>`gesorteerd in aflopende volgorde in kolom ${e.columnName}`,expand:`Uitvouwen`,resizerDescription:`Druk op Enter om het formaat te wijzigen`,select:`Selecteren`,selectAll:`Alles selecteren`,sortable:`sorteerbare kolom`};var Nn={};Nn={ascending:`rosnąco`,ascendingSort:e=>`posortowano wed\u{142}ug kolumny ${e.columnName} w porz\u{105}dku rosn\u{105}cym`,collapse:`Zwiń`,columnSize:e=>`Liczba pikseli: ${e.value}`,descending:`malejąco`,descendingSort:e=>`posortowano wed\u{142}ug kolumny ${e.columnName} w porz\u{105}dku malej\u{105}cym`,expand:`Rozwiń`,resizerDescription:`Naciśnij Enter, aby rozpocząć zmienianie rozmiaru`,select:`Zaznacz`,selectAll:`Zaznacz wszystko`,sortable:`kolumna z możliwością sortowania`};var Pn={};Pn={ascending:`crescente`,ascendingSort:e=>`classificado pela coluna ${e.columnName} em ordem crescente`,collapse:`Recolher`,columnSize:e=>`${e.value} pixels`,descending:`decrescente`,descendingSort:e=>`classificado pela coluna ${e.columnName} em ordem decrescente`,expand:`Expandir`,resizerDescription:`Pressione Enter para começar a redimensionar`,select:`Selecionar`,selectAll:`Selecionar tudo`,sortable:`coluna classificável`};var Fn={};Fn={ascending:`ascendente`,ascendingSort:e=>`Ordenar por coluna ${e.columnName} em ordem ascendente`,collapse:`Colapsar`,columnSize:e=>`${e.value} pixels`,descending:`descendente`,descendingSort:e=>`Ordenar por coluna ${e.columnName} em ordem descendente`,expand:`Expandir`,resizerDescription:`Prima Enter para iniciar o redimensionamento`,select:`Selecionar`,selectAll:`Selecionar tudo`,sortable:`Coluna ordenável`};var In={};In={ascending:`crescătoare`,ascendingSort:e=>`sortate dup\u{103} coloana ${e.columnName} \xeen ordine cresc\u{103}toare`,collapse:`Restrângeți`,columnSize:e=>`${e.value} pixeli`,descending:`descrescătoare`,descendingSort:e=>`sortate dup\u{103} coloana ${e.columnName} \xeen ordine descresc\u{103}toare`,expand:`Extindeți`,resizerDescription:`Apăsați pe Enter pentru a începe redimensionarea`,select:`Selectare`,selectAll:`Selectare totală`,sortable:`coloană sortabilă`};var Ln={};Ln={ascending:`возрастание`,ascendingSort:e=>`\u{441}\u{43E}\u{440}\u{442}\u{438}\u{440}\u{43E}\u{432}\u{430}\u{442}\u{44C} \u{441}\u{442}\u{43E}\u{43B}\u{431}\u{435}\u{446} ${e.columnName} \u{432} \u{43F}\u{43E}\u{440}\u{44F}\u{434}\u{43A}\u{435} \u{432}\u{43E}\u{437}\u{440}\u{430}\u{441}\u{442}\u{430}\u{43D}\u{438}\u{44F}`,collapse:`Свернуть`,columnSize:e=>`${e.value} \u{43F}\u{438}\u{43A}\u{441}.`,descending:`убывание`,descendingSort:e=>`\u{441}\u{43E}\u{440}\u{442}\u{438}\u{440}\u{43E}\u{432}\u{430}\u{442}\u{44C} \u{441}\u{442}\u{43E}\u{43B}\u{431}\u{435}\u{446} ${e.columnName} \u{432} \u{43F}\u{43E}\u{440}\u{44F}\u{434}\u{43A}\u{435} \u{443}\u{431}\u{44B}\u{432}\u{430}\u{43D}\u{438}\u{44F}`,expand:`Развернуть`,resizerDescription:`Нажмите клавишу Enter для начала изменения размеров`,select:`Выбрать`,selectAll:`Выбрать все`,sortable:`сортируемый столбец`};var Rn={};Rn={ascending:`vzostupne`,ascendingSort:e=>`zoraden\xe9 zostupne pod\u{13E}a st\u{13A}pca ${e.columnName}`,collapse:`Zbaliť`,columnSize:e=>`Po\u{10D}et pixelov: ${e.value}`,descending:`zostupne`,descendingSort:e=>`zoraden\xe9 zostupne pod\u{13E}a st\u{13A}pca ${e.columnName}`,expand:`Rozbaliť`,resizerDescription:`Stlačením klávesu Enter začnete zmenu veľkosti`,select:`Vybrať`,selectAll:`Vybrať všetko`,sortable:`zoraditeľný stĺpec`};var zn={};zn={ascending:`naraščajoče`,ascendingSort:e=>`razvr\u{161}\u{10D}eno po stolpcu ${e.columnName} v nara\u{161}\u{10D}ajo\u{10D}em vrstnem redu`,collapse:`Strni`,columnSize:e=>`${e.value} slikovnih pik`,descending:`padajoče`,descendingSort:e=>`razvr\u{161}\u{10D}eno po stolpcu ${e.columnName} v padajo\u{10D}em vrstnem redu`,expand:`Razširi`,resizerDescription:`Pritisnite tipko Enter da začnete spreminjati velikost`,select:`Izberite`,selectAll:`Izberite vse`,sortable:`razvrstljivi stolpec`};var Bn={};Bn={ascending:`rastući`,ascendingSort:e=>`sortirano po kolonama ${e.columnName} rastu\u{107}im redosledom`,collapse:`Skupi`,columnSize:e=>`${e.value} piksela`,descending:`padajući`,descendingSort:e=>`sortirano po kolonama ${e.columnName} padaju\u{107}im redosledom`,expand:`Proširi`,resizerDescription:`Pritisnite Enter da biste započeli promenu veličine`,select:`Izaberite`,selectAll:`Izaberite sve`,sortable:`kolona koja se može sortirati`};var Vn={};Vn={ascending:`stigande`,ascendingSort:e=>`sorterat p\xe5 kolumn ${e.columnName} i stigande ordning`,collapse:`Dölj`,columnSize:e=>`${e.value} pixlar`,descending:`fallande`,descendingSort:e=>`sorterat p\xe5 kolumn ${e.columnName} i fallande ordning`,expand:`Expandera`,resizerDescription:`Tryck på Retur för att börja ändra storlek`,select:`Markera`,selectAll:`Markera allt`,sortable:`sorterbar kolumn`};var Hn={};Hn={ascending:`artan sırada`,ascendingSort:e=>`${e.columnName} s\xfctuna g\xf6re artan d\xfczende s\u{131}rala`,collapse:`Daralt`,columnSize:e=>`${e.value} piksel`,descending:`azalan sırada`,descendingSort:e=>`${e.columnName} s\xfctuna g\xf6re azalan d\xfczende s\u{131}rala`,expand:`Genişlet`,resizerDescription:`Yeniden boyutlandırmak için Enter'a basın`,select:`Seç`,selectAll:`Tümünü Seç`,sortable:`Sıralanabilir sütun`};var Un={};Un={ascending:`висхідний`,ascendingSort:e=>`\u{432}\u{456}\u{434}\u{441}\u{43E}\u{440}\u{442}\u{43E}\u{432}\u{430}\u{43D}\u{43E} \u{437}\u{430} \u{441}\u{442}\u{43E}\u{432}\u{43F}\u{446}\u{435}\u{43C} ${e.columnName} \u{443} \u{432}\u{438}\u{441}\u{445}\u{456}\u{434}\u{43D}\u{43E}\u{43C}\u{443} \u{43F}\u{43E}\u{440}\u{44F}\u{434}\u{43A}\u{443}`,collapse:`Згорнути`,columnSize:e=>`${e.value} \u{43F}\u{456}\u{43A}\u{441}.`,descending:`низхідний`,descendingSort:e=>`\u{432}\u{456}\u{434}\u{441}\u{43E}\u{440}\u{442}\u{43E}\u{432}\u{430}\u{43D}\u{43E} \u{437}\u{430} \u{441}\u{442}\u{43E}\u{432}\u{43F}\u{446}\u{435}\u{43C} ${e.columnName} \u{443} \u{43D}\u{438}\u{437}\u{445}\u{456}\u{434}\u{43D}\u{43E}\u{43C}\u{443} \u{43F}\u{43E}\u{440}\u{44F}\u{434}\u{43A}\u{443}`,expand:`Розгорнути`,resizerDescription:`Натисніть Enter, щоб почати зміну розміру`,select:`Вибрати`,selectAll:`Вибрати все`,sortable:`сортувальний стовпець`};var Wn={};Wn={ascending:`升序`,ascendingSort:e=>`\u{6309}\u{5217} ${e.columnName} \u{5347}\u{5E8F}\u{6392}\u{5E8F}`,collapse:`折叠`,columnSize:e=>`${e.value} \u{50CF}\u{7D20}`,descending:`降序`,descendingSort:e=>`\u{6309}\u{5217} ${e.columnName} \u{964D}\u{5E8F}\u{6392}\u{5E8F}`,expand:`扩展`,resizerDescription:`按 Enter 开始调整大小。`,select:`选择`,selectAll:`全选`,sortable:`可排序的列`};var Gn={};Gn={ascending:`遞增`,ascendingSort:e=>`\u{5DF2}\u{4F9D}\u{64DA}\u{300C}${e.columnName}\u{300D}\u{6B04}\u{905E}\u{589E}\u{6392}\u{5E8F}`,collapse:`收合`,columnSize:e=>`${e.value} \u{50CF}\u{7D20}`,descending:`遞減`,descendingSort:e=>`\u{5DF2}\u{4F9D}\u{64DA}\u{300C}${e.columnName}\u{300D}\u{6B04}\u{905E}\u{6E1B}\u{6392}\u{5E8F}`,expand:`展開`,resizerDescription:`按 Enter 鍵以開始調整大小`,select:`選取`,selectAll:`全選`,sortable:`可排序的欄`};var X={};X={"ar-AE":fn,"bg-BG":pn,"cs-CZ":mn,"da-DK":hn,"de-DE":gn,"el-GR":_n,"en-US":vn,"es-ES":yn,"et-EE":bn,"fi-FI":xn,"fr-FR":Sn,"he-IL":Cn,"hr-HR":wn,"hu-HU":Tn,"it-IT":En,"ja-JP":Dn,"ko-KR":On,"lt-LT":kn,"lv-LV":An,"nb-NO":jn,"nl-NL":Mn,"pl-PL":Nn,"pt-BR":Pn,"pt-PT":Fn,"ro-RO":In,"ru-RU":Ln,"sk-SK":Rn,"sl-SI":zn,"sr-SP":Bn,"sv-SE":Vn,"tr-TR":Hn,"uk-UA":Un,"zh-CN":Wn,"zh-TW":Gn};var Kn=class extends nn{isCell(e){return e.type===`cell`||e.type===`rowheader`||e.type===`column`}getKeyBelow(e,t){let n=this.collection.getItem(e);if(!n)return null;if(n.type===`column`){let e=K(J(n,this.collection));if(e)return e.key;let t=this.getFirstKey();return t==null||!this.collection.getItem(t)?null:super.getKeyForItemInRowByIndex(t,n.index)}return super.getKeyBelow(e,t)}getKeyAbove(e,t){let n=this.collection.getItem(e);if(!n)return null;if(n.type===`column`){let e=n.parentKey==null?null:this.collection.getItem(n.parentKey);return e&&e.type===`column`?e.key:null}let r=super.getKeyAbove(e,t),i=r==null?null:this.collection.getItem(r);return i&&i.type!==`headerrow`?r:this.isCell(n)?this.collection.columns[n.index].key:this.collection.columns[0].key}findNextColumnKey(e){let t=this.findNextKey(e.key,e=>e.type===`column`);if(t!=null)return t;let n=this.collection.headerRows[e.level];for(let e of J(n,this.collection))if(e.type===`column`)return e.key;return null}findPreviousColumnKey(e){let t=this.findPreviousKey(e.key,e=>e.type===`column`);if(t!=null)return t;let n=this.collection.headerRows[e.level],r=[...J(n,this.collection)];for(let e=r.length-1;e>=0;e--){let t=r[e];if(t.type===`column`)return t.key}return null}getKeyRightOf(e){let t=this.collection.getItem(e);return t?t.type===`column`?this.direction===`rtl`?this.findPreviousColumnKey(t):this.findNextColumnKey(t):super.getKeyRightOf(e):null}getKeyLeftOf(e){let t=this.collection.getItem(e);return t?t.type===`column`?this.direction===`rtl`?this.findNextColumnKey(t):this.findPreviousColumnKey(t):super.getKeyLeftOf(e):null}getKeyForSearch(e,t){if(!this.collator)return null;let n=this.collection,r=t??this.getFirstKey();if(r==null)return null;let i=n.getItem(r);i?.type===`cell`&&(r=i.parentKey??null);let a=!1;for(;r!=null;){let o=n.getItem(r);if(!o)return null;if(o.textValue){let t=o.textValue.slice(0,e.length);if(this.collator.compare(t,e)===0)return o.key}for(let r of J(o,this.collection)){let a=n.columns[r.index];if(n.rowHeaderColumnKeys.has(a.key)&&r.textValue){let a=r.textValue.slice(0,e.length);if(this.collator.compare(a,e)===0)return(t==null?i:n.getItem(t))?.type===`cell`?r.key:o.key}}r=this.getKeyBelow(r),r==null&&!a&&(r=this.getFirstKey(),a=!0)}return null}};function qn(e){return e&&e.__esModule?e.default:e}function Jn(e,t,n){let{keyboardDelegate:r,isVirtualized:i,layoutDelegate:o,layout:s}=e,c=Ve({usage:`search`,sensitivity:`base`}),{direction:l}=z(),u=t.selectionManager.disabledBehavior,d=(0,Y.useMemo)(()=>r||new Kn({collection:t.collection,disabledKeys:t.disabledKeys,disabledBehavior:u,ref:n,direction:l,collator:c,layoutDelegate:o,layout:s}),[r,t.collection,t.disabledKeys,u,n,l,c,o,s]),f=fe(e.id);sn.set(t,f);let{gridProps:m}=on({...e,id:f,keyboardDelegate:d},t,n);i&&(m[`aria-rowcount`]=t.collection.size+t.collection.headerRows.length),t.treeColumn!=null&&(m.role=`treegrid`);let{column:h,direction:g}=t.sortDescriptor||{},_=p(qn(X),`@react-aria/table`),v=(0,Y.useMemo)(()=>{let e=t.collection.columns.find(e=>e.key===h)?.textValue??``;return g&&h?_.format(`${g}Sort`,{columnName:e}):void 0},[g,h,t.collection.columns]),y=Pe(v);return xe(()=>{v&&a(v,`assertive`,500)},[v]),{gridProps:k(m,y,{"aria-describedby":[y[`aria-describedby`],m[`aria-describedby`]].filter(Boolean).join(` `)})}}function Yn(e,t,n){let{node:r,isVirtualized:i,focusMode:a,allowsArrowNavigation:o,shouldSelectOnPressUp:s,onAction:c}=e,{direction:l}=z(),{keyboardDelegate:u,actions:{onCellAction:d},keyboardNavigationBehavior:f}=an.get(t),p=a??(f===`tab`?`cell`:`child`),m=(0,Y.useRef)(null),h=()=>{if(n.current){let e=I(n.current);if(p===`child`){if(N(n.current)&&n.current!==S(le(n.current)))return;let r=t.selectionManager.childFocusStrategy===`last`?Xn(e):e.firstChild();if(r){T(r);return}}(m.current!=null&&r.key!==m.current||!N(n.current))&&T(n.current)}},{itemProps:g,isPressed:_}=Ie({selectionManager:t.selectionManager,key:r.key,ref:n,isVirtualized:i,focus:h,shouldSelectOnPressUp:s,onAction:d?()=>d(r.key):c,isDisabled:t.collection.size===0}),v=k(g,{role:`gridcell`,onKeyDownCapture:f!==`tab`||o?e=>{let i=S(le(n.current));if(!F(e.currentTarget,H(e))||t.isKeyboardNavigationDisabled||!n.current||!i)return;let a=I(n.current);switch(a.currentNode=i,e.key){case`ArrowLeft`:{let t=l===`rtl`?a.nextNode():a.previousNode();if(p===`child`&&t===n.current&&(t=null),e.preventDefault(),e.stopPropagation(),t)T(t),We(t,{containingElement:W(n.current)});else{if(u.getKeyLeftOf?.(r.key)!==r.key){n.current.parentElement?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type,e.nativeEvent));break}p===`cell`&&l===`rtl`?(T(n.current),We(n.current,{containingElement:W(n.current)})):(a.currentNode=n.current,t=l===`rtl`?a.firstChild():Xn(a),t&&(T(t),We(t,{containingElement:W(n.current)})))}break}case`ArrowRight`:{let t=l===`rtl`?a.previousNode():a.nextNode();if(p===`child`&&t===n.current&&(t=null),e.preventDefault(),e.stopPropagation(),t)T(t),We(t,{containingElement:W(n.current)});else{if(u.getKeyRightOf?.(r.key)!==r.key){n.current.parentElement?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type,e.nativeEvent));break}p===`cell`&&l===`ltr`?(T(n.current),We(n.current,{containingElement:W(n.current)})):(a.currentNode=n.current,t=l===`rtl`?Xn(a):a.firstChild(),t&&(T(t),We(t,{containingElement:W(n.current)})))}break}case`ArrowUp`:case`ArrowDown`:!e.altKey&&F(n.current,H(e))&&(e.stopPropagation(),e.preventDefault(),n.current.parentElement?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type,e.nativeEvent)))}}:void 0,onKeyDown:f===`tab`?e=>{let r=S(le(n.current));if(!(!F(e.currentTarget,H(e))||t.isKeyboardNavigationDisabled||!n.current||!r)){if(f===`tab`&&H(e)!==n.current&&e.key!==`Tab`){e.stopPropagation();return}if(e.key===`Tab`&&f===`tab`){let t=I(n.current,{tabbable:!0});t.currentNode=r,(e.shiftKey?t.previousNode():t.nextNode())&&e.stopPropagation()}}}:void 0,"aria-colspan":r.colSpan,"aria-colindex":r.colIndex==null?void 0:r.colIndex+1,colSpan:i?void 0:r.colSpan,onFocus:e=>{if(m.current=r.key,H(e)!==n.current){M()||t.selectionManager.setFocusedKey(r.key);return}p===`child`&&e.relatedTarget&&F(n.current,e.relatedTarget)||requestAnimationFrame(()=>{p===`child`&&S(le(n.current))===n.current&&h()})},...p===`child`&&f===`tab`?{tabIndex:-1}:{}});return i&&(v[`aria-colindex`]=(r.colIndex??r.index)+1),s&&v.tabIndex!=null&&v.onPointerDown==null&&(v.onPointerDown=e=>{let t=e.currentTarget,n=t.getAttribute(`tabindex`);t.removeAttribute(`tabindex`),requestAnimationFrame(()=>{n!=null&&t.setAttribute(`tabindex`,n)})}),{gridCellProps:v,isPressed:_}}function Xn(e){let t=null,n=null;do n=e.lastChild(),n&&(t=n);while(n);return t}function Zn(e){return e&&e.__esModule?e.default:e}function Qn(e,t,n){let{node:r}=e,i=r.props.allowsSorting,{gridCellProps:a}=Yn({focusMode:`child`,...e},t,n),o=r.props.isSelectionCell&&t.selectionManager.selectionMode===`single`,{pressProps:s,isPressed:c}=pe({isDisabled:!i||o,onPress(){t.sort(r.key)},ref:n}),{focusableProps:l}=ye({},n),u,d=t.sortDescriptor?.column===r.key,f=t.sortDescriptor?.direction;r.props.allowsSorting&&!ve()&&(u=d?f:`none`);let m=p(Zn(X),`@react-aria/table`),h;i&&(h=`${m.format(`sortable`)}`,d&&f&&ve()&&(h=`${h}, ${m.format(f)}`));let g=Pe(h),_=t.collection.size===0;return(0,Y.useEffect)(()=>{_&&t.selectionManager.focusedKey===r.key&&t.selectionManager.setFocusedKey(null)},[_,t.selectionManager,r.key]),{columnHeaderProps:{...k(l,a,s,g,_?{tabIndex:-1}:null),role:`columnheader`,id:ln(t,r.key),"aria-colspan":r.colSpan&&r.colSpan>1?r.colSpan:void 0,"aria-sort":u},isPressed:c}}function $n(e,t,n){let{node:r,isVirtualized:i,shouldSelectOnPressUp:a,onAction:o}=e,{actions:s,shouldSelectOnPressUp:c}=an.get(t),l=s.onRowAction?()=>s.onRowAction?.(r.key):o,{itemProps:u,...d}=Ie({selectionManager:t.selectionManager,key:r.key,ref:n,isVirtualized:i,shouldSelectOnPressUp:c||a,onAction:l||r?.props?.onAction?me(r?.props?.onAction,l):void 0,isDisabled:t.collection.size===0}),f=t.selectionManager.isSelected(r.key),p={role:`row`,"aria-selected":t.selectionManager.selectionMode===`none`?void 0:f,"aria-disabled":d.isDisabled||void 0,...u};return i&&(p[`aria-rowindex`]=r.index+1),{rowProps:p,...d}}function er(e){return e&&e.__esModule?e.default:e}var tr={expand:{ltr:`ArrowRight`,rtl:`ArrowLeft`},collapse:{ltr:`ArrowLeft`,rtl:`ArrowRight`}};function nr(e,t,n){let{node:r,isVirtualized:i}=e,{rowProps:a,...o}=$n(e,t,n),{direction:s}=z();i&&t.treeColumn==null?a[`aria-rowindex`]=r.index+1+t.collection.headerRows.length:delete a[`aria-rowindex`];let c=t.treeColumn!=null&&(t.expandedKeys===`all`||t.expandedKeys.has(r.key)),l=p(er(X),`@react-aria/table`),u=y({"aria-label":c?l.format(`collapse`):l.format(`expand`),"aria-labelledby":dn(t,r.key)}),d={},f={};if(t.treeColumn!=null){let e=t.collection.getItem(r.key);if(e!=null){let n=rr(t.collection,r),i=e.props?.hasChildRows||e.props?.UNSTABLE_childItems||n?.type!==`cell`,a=t.collection.getItem(r.parentKey),c=a.type===`tablebody`||a.type===`body`,l=rr(t.collection,a);for(;l&&l.type!==`item`&&l.prevKey!=null;)l=t.collection.getItem(l.prevKey);d={onKeyDown:n=>{n.key===tr.expand[s]&&t.selectionManager.focusedKey===e.key&&i&&t.expandedKeys!==`all`&&!t.expandedKeys.has(e.key)?(t.toggleKey(e.key),n.stopPropagation()):n.key===tr.collapse[s]&&t.selectionManager.focusedKey===e.key&&(t.expandedKeys===`all`?t.expandedKeys===`all`&&(t.toggleKey(e.key),n.stopPropagation()):i&&t.expandedKeys.has(e.key)?(t.toggleKey(e.key),n.stopPropagation()):!t.expandedKeys.has(e.key)&&e.parentKey!=null&&e.level>0&&(t.selectionManager.setFocusedKey(e.parentKey),n.stopPropagation()))},"aria-expanded":i?t.expandedKeys===`all`||t.expandedKeys.has(r.key):void 0,"aria-level":e.level+1,"aria-posinset":e.index-(c?0:t.collection.columnCount)+1,"aria-setsize":l.index-(c?0:t.collection.columnCount)+1},f={isDisabled:o.isDisabled,onPress:()=>{o.isDisabled||(t.toggleKey(r.key),t.selectionManager.setFocused(!0),t.selectionManager.setFocusedKey(r.key))},excludeFromTabOrder:!0,preventFocusOnPress:!0,"data-react-aria-prevent-focus":!0,...u}}}let m=se(r.props),h=o.hasAction?m:{};return{rowProps:{...k(a,d,h),"aria-labelledby":dn(t,r.key)},expandButtonProps:f,...o}}function rr(e,t){return`lastChildKey`in t?t.lastChildKey==null?null:e.getItem(t.lastChildKey):Array.from(t.childNodes).findLast(e=>e.parentKey===t.key)}function ir(e,t,n){let{node:r,isVirtualized:i}=e,a={role:`row`};return i&&t.treeColumn==null&&(a[`aria-rowindex`]=r.index+1),{rowProps:a}}function ar(e,t,n){let{gridCellProps:r,isPressed:i}=Yn(e,t,n),a=e.node.column?.key;return a!=null&&t.collection.rowHeaderColumnKeys.has(a)&&(r.role=`rowheader`,r.id=un(t,e.node.parentKey,a)),{gridCellProps:r,isPressed:i}}function or(e){return e&&e.__esModule?e.default:e}function sr(e,t){let{key:n}=e,{checkboxProps:r}=Pt(e,t);return{checkboxProps:{...r,"aria-labelledby":`${r.id} ${dn(t,n)}`}}}function cr(e){let{isEmpty:t,isSelectAll:n,selectionMode:r}=e.selectionManager;return{checkboxProps:{"aria-label":p(or(X),`@react-aria/table`).format(r===`single`?`select`:`selectAll`),isSelected:n,isDisabled:r!==`multiple`||e.collection.size===0||e.collection.rows.length===1&&e.collection.rows[0].type===`loader`,isIndeterminate:!t&&!n,onChange:()=>e.selectionManager.toggleSelectAll()}}}function lr(e){return e&&e.__esModule?e.default:e}function ur(e,t,n){let{column:r,triggerRef:a,isDisabled:o,onResizeStart:s,onResize:c,onResizeEnd:l,"aria-label":u}=e,d=p(lr(X),`@react-aria/table`),f=fe(),m=t.resizingColumn===r.key,h=(0,Y.useRef)(m),g=(0,Y.useRef)(null),_=(0,Y.useRef)(!1),v=t.tableState.isKeyboardNavigationDisabled,[y,b]=(0,Y.useState)(!1),{direction:x}=z(),C=(0,Y.useCallback)(e=>{h.current||(g.current=t.updateResizedColumns(e.key,t.getColumnWidth(e.key)),t.startResize(e.key),t.tableState.setKeyboardNavigationDisabled(!0),s?.(g.current)),h.current=!0},[t,s]),w=(0,Y.useCallback)((e,n)=>{let r=t.updateResizedColumns(e.key,n);c?.(r),g.current=r},[t,c]),D=(0,Y.useCallback)(e=>{h.current&&(g.current??=t.updateResizedColumns(e.key,t.getColumnWidth(e.key)),t.endResize(),t.tableState.setKeyboardNavigationDisabled(!1),l?.(g.current),h.current=!1,a?.current&&!_.current&&T(a.current)),g.current=null},[t,a,l]),O=()=>{if(v){D(r);return}return!1},{keyboardProps:A}=_e({shortcuts:{Escape:()=>O(),Enter:()=>{v?D(r):C(r)}," ":()=>O(),Tab:()=>O()}}),j=(0,Y.useRef)(0),{moveProps:M}=Ke({onMoveStart(e){j.current=t.getColumnWidth(r.key),e.pointerType===`mouse`&&b(!0),C(r)},onMove(e){let{deltaX:t,deltaY:n,pointerType:i}=e;x===`rtl`&&(t*=-1),i===`keyboard`&&(n!==0&&t===0&&(t=n*-1),t*=10),t!==0&&(j.current+=t,w(r,j.current))},onMoveEnd(e){let{pointerType:t}=e;j.current=0,b(!1),(t===`mouse`||t===`touch`&&_.current)&&D(r)}}),ee=(0,Y.useCallback)(e=>{v&&M.onKeyDown?.(e)},[v,M]),N=Math.floor(t.getColumnMinWidth(r.key)),P=Math.floor(t.getColumnMaxWidth(r.key));P===1/0&&(P=2**53-1);let ne=Math.floor(t.getColumnWidth(r.key)),F=E();F===`virtual`&&typeof window<`u`&&`ontouchstart`in window&&(F=`touch`);let re=a?.current==null&&(F===`keyboard`||F===`virtual`)&&!m?d.format(`resizerDescription`):void 0,I=Pe(re),ie={"aria-label":u,"aria-orientation":`horizontal`,"aria-labelledby":`${f} ${ln(t.tableState,r.key)}`,"aria-valuetext":d.format(`columnSize`,{value:ne}),type:`range`,min:N,max:P,value:ne,...I},L=(0,Y.useCallback)(()=>{n.current&&T(n.current)},[n]),R=t.resizingColumn,ae=(0,Y.useRef)(null),oe=te(C);(0,Y.useEffect)(()=>{if(ae.current!==R&&R!=null&&R===r.key){_.current=S()===n.current,oe(r);let e=setTimeout(()=>L(),0),t=setTimeout(L,400);return()=>{clearTimeout(e),clearTimeout(t)}}ae.current=R},[R,r,L,n]);let se=e=>{let n=t.getColumnWidth(r.key),i=parseFloat(H(e).value);i=i>n?n+10:n-10,w(r,i)},{pressProps:ce}=pe({preventFocusOnPress:!0,onPressStart:e=>{if(!(e.ctrlKey||e.altKey||e.metaKey||e.shiftKey||e.pointerType===`keyboard`)){if(e.pointerType===`virtual`&&t.resizingColumn!=null){D(r);return}L(),e.pointerType!==`virtual`&&C(r)}},onPress:e=>{(e.pointerType===`touch`&&_.current||e.pointerType===`mouse`)&&t.resizingColumn!=null&&D(r)}}),{visuallyHiddenProps:le}=i();return{resizerProps:k(A,{...M,onKeyDown:ee},ce,{style:{touchAction:`none`}}),inputProps:k(le,{id:f,onBlur:()=>{D(r)},onChange:se,disabled:o},ie),isResizing:m,isMouseResizing:y}}function dr(){return{rowGroupProps:{role:`rowgroup`}}}function fr(){return dr()}var pr=t(n(),1);function mr(e){return e&&e.__esModule?e.default:e}var hr=class extends b{withExpandedKeys(e){let t=this.clone();return t.expandedKeys=e,t.frozen=this.frozen,t.rows=Array.from(t.getRows()),t}addNode(e){super.addNode(e),this.columnsDirty||=e.type===`column`,e.type===`tableheader`&&(this.head=e)}getRows(){let e=[];for(let t of this)(t.type===`tablebody`||t.type===`tablefooter`)&&e.push(...this.getChildren(t.key));return e}get body(){for(let e of this)if(e.type===`tablebody`)return e;return new Fr(-2)}commit(e,t,n=!1){this.updateColumns(n),this.firstKey=e,this.lastKey=t,this.rows=[];for(let e of this.getRows()){let t=e.lastChildKey;if(t!=null){let e=this.getItem(t);for(;e&&e.type!==`cell`;)e=e.prevKey==null?null:this.getItem(e.prevKey);if(e){let t=(e.colIndex??e.index)+(e.colSpan??1);if(t!==this.columns.length&&!n)throw Error(`Cell count must match column count. Found ${t} cells and ${this.columns.length} columns.`)}}this.rows.push(e)}super.commit(e,t,n)}updateColumns(e){if(!this.columnsDirty)return;this.rowHeaderColumnKeys=new Set,this.columns=[];let t=new Map,n=e=>{e.type===`column`&&(t.set(e.key,e),e.hasChildNodes||(e.index=this.columns.length,this.columns.push(e),e.props.isRowHeader&&this.rowHeaderColumnKeys.add(e.key)));for(let t of this.getChildren(e.key))n(t)};for(let e of this.getChildren(this.head.key))n(e);if(this.headerRows=Vt(t,this.columns),this.columnsDirty=!1,this.rowHeaderColumnKeys.size===0&&this.columns.length>0&&!e)throw Error(`A table must have at least one Column with the isRowHeader prop set to true`)}get columnCount(){return this.columns.length}*[Symbol.iterator](){let e=this.firstKey;for(;e!=null;){let t=this.getItem(e);t&&(yield t),e=t?.nextKey??null}}getFirstKey(){for(let e of this)if(e.type===`tablebody`)return e.firstChildKey??null;return null}getLastKey(){let e=this.lastKey;if(e==null)return null;let t=this.getItem(e);for(;t?.lastChildKey!=null&&(t.type!==`item`||this.expandedKeys.has(t.key));)t=this.getItem(t.lastChildKey);return t?.key}getKeyAfter(e){let t=this.getItem(e);if(t?.type===`column`)return t.nextKey??null;if(!t)return null;if(t.type===`item`&&t.firstChildKey!=null&&this.expandedKeys.has(t.key)){let e=this.getItem(t.firstChildKey);for(;e;){if(e.type===`item`)return e.key;e=e.nextKey==null?null:this.getItem(e.nextKey)}}return super.getKeyAfter(e)}getKeyBefore(e){let t=this.getItem(e);if(t?.type===`column`)return t.prevKey??null;if(!t)return null;let n=null;if(t.prevKey!=null){for(t=this.getItem(t.prevKey);t&&(t.type!==`item`||this.expandedKeys.has(t.key))&&t.lastChildKey!=null;)t=this.getItem(t.lastChildKey);n=t?.key??null}return n??=t.parentKey,n!=null&&this.getItem(n)?.type===`tableheader`?null:n}getChildren(e){let t=this.getItem(e);if(!t){for(let t of this.headerRows)if(t.key===e)return t.childNodes}let n=this;return t?.type===`tablebody`||t?.type===`tablefooter`?{*[Symbol.iterator](){let e=t.firstChildKey,r=e==null?null:n.getItem(e);for(;r;){yield r;let e=n.getKeyAfter(r.key);if(r=e==null?null:n.getItem(e),r&&r.parentKey===t.parentKey)break}}}:{*[Symbol.iterator](){let t=n.getItem(e),r=t?.firstChildKey==null?null:n.getItem(t.firstChildKey);for(;r&&(yield r,r=r.nextKey==null?null:n.getItem(r.nextKey),t?.type!==`item`||r?.type===`cell`););}}}clone(){let e=super.clone();return e.headerRows=this.headerRows,e.columns=this.columns,e.rows=this.rows,e.rowHeaderColumnKeys=this.rowHeaderColumnKeys,e.head=this.head,e}getTextValue(e){let t=this.getItem(e);if(!t)return``;if(t.textValue)return t.textValue;let n=this.rowHeaderColumnKeys,r=[];for(let t of this.getChildren(e)){let e=this.columns[t.index];if(n.has(e.key)&&t.textValue&&r.push(t.textValue),r.length===n.size)break}return r.join(` `)}constructor(...e){super(...e),this.headerRows=[],this.columns=[],this.rows=[],this.rowHeaderColumnKeys=new Set,this.head=new Tr(-1),this.columnsDirty=!0,this.expandedKeys=new Set}},gr=(0,Y.createContext)(null),_r=(0,Y.forwardRef)(function(e,t){let n=O(t),r=(0,Y.useRef)(null),i=(0,Y.useRef)(null),[a,o]=(0,Y.useState)(0);ae(()=>{let e=r.current;for(;e&&e!==n.current&&!Me(e);)e=e.parentElement;i.current=e},[n]),h({ref:i,box:`border-box`,onResize(){o(i.current?.clientWidth??0)}}),ae(()=>{o(i.current?.clientWidth??0)},[]);let s=(0,Y.useMemo)(()=>({tableRef:r,scrollRef:i,tableWidth:a,useTableColumnResizeState:Zt,onResizeStart:e.onResizeStart,onResize:e.onResize,onResizeEnd:e.onResizeEnd}),[r,a,e.onResizeStart,e.onResize,e.onResizeEnd]);return Y.createElement(D.div,{render:e.render,...B(e,{global:!0}),ref:n,className:e.className||`react-aria-ResizableTableContainer`,style:e.style,onScroll:e.onScroll},Y.createElement(gr.Provider,{value:s},e.children))}),vr=(0,Y.createContext)(null),Z=(0,Y.createContext)(null),yr=(0,Y.createContext)(null),br=(0,Y.forwardRef)(function(e,t){[e,t]=ue(e,t,vr);let n=Fe(e),{selectionBehavior:r,selectionMode:i,disallowEmptySelection:a}=n,o=!!e.dragAndDropHooks?.useDraggableCollectionState,s=(0,Y.useMemo)(()=>({selectionBehavior:i===`none`?null:r,selectionMode:i,disallowEmptySelection:a,allowsDragging:o}),[r,i,a,o]),c=Y.createElement(wr.Provider,{value:s},Y.createElement(d,e));return Y.createElement(g,{content:c,createCollection:()=>new hr},r=>Y.createElement(Cr,{props:e,forwardedRef:t,selectionState:n,collection:r}))}),xr=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.table,{...e,ref:t})}),Sr={expand:{ltr:`ArrowRight`,rtl:`ArrowLeft`},collapse:{ltr:`ArrowLeft`,rtl:`ArrowRight`}};function Cr({props:e,forwardedRef:t,selectionState:n,collection:r}){[e,t]=ue(e,t,v);let{shouldUseVirtualFocus:i,disallowTypeAhead:a,filter:o,...s}=e,c=(0,Y.useContext)(gr);t=O((0,Y.useMemo)(()=>ne(t,c?.tableRef),[t,c?.tableRef]));let[l,u]=de(e.expandedKeys?new Set(e.expandedKeys):void 0,e.defaultExpandedKeys?new Set(e.defaultExpandedKeys):new Set,e.onExpandedChange);r=(0,Y.useMemo)(()=>r.withExpandedKeys(l),[r,l]);let d=en({...s,collection:r,children:void 0,UNSAFE_selectionState:n,expandedKeys:l,onExpandedChange:u}),f=tn(d,o),{isVirtualized:p,layoutDelegate:h,dropTargetDelegate:g,CollectionRoot:_}=(0,Y.useContext)(G),{dragAndDropHooks:y}=e,{gridProps:b}=Jn({...s,layoutDelegate:h,isVirtualized:p},f,t),x=f.selectionManager,S=!!y?.useDraggableCollectionState,w=!!y?.useDroppableCollectionState;(0,Y.useRef)(S),(0,Y.useRef)(w),(0,Y.useEffect)(()=>{},[S,w]);let T,E,D,A=!1,M=null,ee=(0,Y.useRef)(null),{direction:N}=z(),[P]=(0,Y.useState)(()=>new Lt);if(S&&y){T=y.useDraggableCollectionState({collection:f.collection,selectionManager:x,preview:y.renderDragPreview?ee:void 0}),y.useDraggableCollection({},T,t);let e=y.DragPreview;M=y.renderDragPreview?Y.createElement(e,{ref:ee},y.renderDragPreview):null}if(w&&y){E=y.useDroppableCollectionState({collection:f.collection,selectionManager:x});let e=new Le({collection:f.collection,disabledKeys:x.disabledKeys,disabledBehavior:x.disabledBehavior,ref:t,layoutDelegate:h}),n=y.dropTargetDelegate||g||new y.ListDropTargetDelegate(r.rows,t);P.setup(n,d,N),D=y.useDroppableCollection({keyboardDelegate:e,dropTargetDelegate:P,onDropActivate:e=>{if(e.target.type===`item`){let t=e.target.key,n=d.collection.getItem(t),r=l.has(t);n&&n.hasChildNodes&&(!r||y?.isVirtualDragging?.())&&d.toggleKey(t)}},onKeyDown:e=>{let t=E?.target;if(t&&t.type===`item`&&t.dropPosition===`on`){let n=d.collection.getItem(t.key);(e.key===Sr.expand[N]&&n?.hasChildNodes&&!d.expandedKeys.has(t.key)||e.key===Sr.collapse[N]&&n?.hasChildNodes&&d.expandedKeys.has(t.key))&&d.toggleKey(t.key)}}},E,t),A=E.isDropTarget({type:`root`})}let{focusProps:te,isFocused:F,isFocusVisible:re}=R(),I=j({...e,children:void 0,defaultClassName:`react-aria-Table`,values:{isDropTarget:A,isFocused:F,isFocusVisible:re,state:f}}),ie=!!(S&&!T?.isDisabled),L=I.style,ae=null;c&&(ae=c.useTableColumnResizeState({tableWidth:c.tableWidth},f),p||(L={...L,tableLayout:`fixed`,width:`min-content`}));let oe=B(e,{global:!0});return Y.createElement(C,{values:[[Z,f],[yr,ae],[U,{dragAndDropHooks:y,dragState:T,dropState:E}],[Ce,{render:Gr}],[v,null],[m,null]]},Y.createElement(ce,null,Y.createElement(xr,{...k(oe,I,b,te,D?.collectionProps),style:L,ref:t,slot:e.slot||void 0,onScroll:e.onScroll,"data-allows-dragging":ie||void 0,"data-drop-target":A||void 0,"data-focused":F||void 0,"data-focus-visible":re||void 0},Y.createElement(he,null,Y.createElement(_,{collection:f.collection,scrollRef:c?.scrollRef??t,persistedKeys:Te(x,y,E)})))),M)}var wr=(0,Y.createContext)(null),Tr=class extends o{static{this.type=`tableheader`}},Er=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.thead,{...e,ref:t})}),Dr=f(Tr,(e,t)=>{let n=(0,Y.useContext)(Z).collection,r=l({items:n.headerRows,children:(0,Y.useCallback)(e=>{switch(e.type){case`headerrow`:return Y.createElement(kr,{item:e});default:throw Error(`Unsupported node type in TableHeader: `+e.type)}},[])}),{rowGroupProps:i}=fr(),{hoverProps:a,isHovered:o}=ge({onHoverStart:e.onHoverStart,onHoverChange:e.onHoverChange,onHoverEnd:e.onHoverEnd}),s=j({...e,children:void 0,defaultClassName:`react-aria-TableHeader`,values:{isHovered:o}});return Y.createElement(Er,{...k(B(e,{global:!0}),i,a),...s,ref:t,"data-hovered":o||void 0},r)},e=>Y.createElement(d,{dependencies:e.dependencies,items:e.columns},e.children)),Or=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(`div`,{...e,ref:t}):Y.createElement(`tr`,{...e,ref:t})});function kr({item:e}){let t=(0,Y.useRef)(null),n=(0,Y.useContext)(Z),{isVirtualized:r,CollectionBranch:i}=(0,Y.useContext)(G),{rowProps:a}=ir({node:e,isVirtualized:r},n,t),{checkboxProps:o}=cr(n);return Y.createElement(Or,{...a,ref:t},Y.createElement(C,{values:[[ke,{slots:{selection:o}}],[Oe,{slots:{selection:o}}]]},Y.createElement(i,{collection:n.collection,parent:e})))}var Ar=class extends o{static{this.type=`column`}},jr=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.th,{...e,ref:t})}),Mr=_(Ar,(e,t,n)=>{let r=O(t),i=(0,Y.useContext)(Z),{isVirtualized:a}=(0,Y.useContext)(G),{columnHeaderProps:o,isPressed:s}=Qn({node:n,isVirtualized:a,focusMode:e.focusMode,allowsArrowNavigation:e.allowsArrowNavigation},i,r),{isFocused:c,isFocusVisible:l,focusProps:u}=R(),d=(0,Y.useContext)(yr),f=!1;d&&(f=d.resizingColumn===n.key);let{hoverProps:p,isHovered:m}=ge({isDisabled:!e.allowsSorting}),h=j({...e,id:void 0,children:n.rendered,defaultClassName:`react-aria-Column`,values:{isHovered:m,isPressed:s,isFocused:c,isFocusVisible:l,allowsSorting:n.props.allowsSorting,sortDirection:i.sortDescriptor?.column===n.key?i.sortDescriptor.direction:void 0,isResizing:f,startResize:()=>{if(d)d.startResize(n.key),i.setKeyboardNavigationDisabled(!0);else throw Error(`Wrap your in a to enable column resizing`)},sort:e=>{i.sort(n.key,e)}}}),g=h.style;d&&(g={...g,width:d.getColumnWidth(n.key)});let _=B(e,{global:!0});return delete _.id,Y.createElement(jr,{...k(_,o,u,p),...h,style:g,ref:r,"data-hovered":m||void 0,"data-pressed":s||void 0,"data-focused":c||void 0,"data-focus-visible":l||void 0,"data-resizing":f||void 0,"data-allows-sorting":n.props.allowsSorting||void 0,"data-sort-direction":i.sortDescriptor?.column===n.key?i.sortDescriptor.direction:void 0},Y.createElement(C,{values:[[Nr,{column:n,triggerRef:r}],[G,Ue]]},h.children))}),Nr=(0,Y.createContext)(null),Pr=(0,Y.forwardRef)(function(e,t){let n=(0,Y.useContext)(yr);if(!n)throw Error(`Wrap your
    in a to enable column resizing`);let r=p(mr(Se),`react-aria-components`),{onResizeStart:i,onResize:a,onResizeEnd:o}=(0,Y.useContext)(gr),{column:s,triggerRef:c}=(0,Y.useContext)(Nr),l=(0,Y.useRef)(null),{resizerProps:u,inputProps:d,isResizing:f,isMouseResizing:m}=ur({column:s,"aria-label":e[`aria-label`]||r.format(`tableResizer`),onResizeStart:i,onResize:a,onResizeEnd:o,triggerRef:c},n,l),{focusProps:h,isFocused:g,isFocusVisible:_}=R(),{hoverProps:v,isHovered:y}=ge(e),b=n.getColumnMinWidth(s.key)>=n.getColumnWidth(s.key),x=n.getColumnMaxWidth(s.key)<=n.getColumnWidth(s.key),{direction:S}=z(),C=`both`;C=b?S===`rtl`?`right`:`left`:x?S===`rtl`?`left`:`right`:`both`;let w=O(t),[T,E]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{if(!w.current)return;let e=window.getComputedStyle(w.current);E(e.cursor)},[w,C]);let A=j({...e,defaultClassName:`react-aria-ColumnResizer`,values:{isFocused:g,isFocusVisible:_,isResizing:f,isHovered:y,resizableDirection:C}}),M=B(e,{global:!0});return Y.createElement(D.div,{ref:w,role:`presentation`,...k(M,A,u,v),"data-hovered":y||void 0,"data-focused":g||void 0,"data-focus-visible":_||void 0,"data-resizing":f||void 0,"data-resizable-direction":C},A.children,Y.createElement(`input`,{ref:l,...k(d,h)}),f&&m&&pr.createPortal(Y.createElement(`div`,{style:{position:`fixed`,top:0,left:0,bottom:0,right:0,cursor:T},"data-testid":`cursor-overlay`}),document.body))}),Fr=class extends x{static{this.type=`tablebody`}},Ir=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.tbody,{...e,ref:t})}),Lr=f(Fr,(e,t,n)=>{let r=(0,Y.useContext)(Z),{isVirtualized:i}=(0,Y.useContext)(G),a=r.collection,{CollectionBranch:o}=(0,Y.useContext)(G),{dragAndDropHooks:s,dropState:c}=(0,Y.useContext)(U),l=!!s?.useDroppableCollectionState&&!c?.isDisabled,u=l&&!!c&&(c.isDropTarget({type:`root`})??!1),d=a.size===0,f={isDropTarget:u,isEmpty:d},p=j({...e,id:void 0,children:void 0,defaultClassName:`react-aria-TableBody`,values:f}),m,h=a.columnCount;if(d&&e.renderEmptyState&&r){let t={},n={},r={};i?(n[`aria-colspan`]=h,r={display:`contents`}):n.colSpan=h,m=Y.createElement(Br,{role:`row`,...t,style:r},Y.createElement(Ur,{role:`rowheader`,...n,style:r},e.renderEmptyState(f)))}let{rowGroupProps:g}=fr(),_=B(e,{global:!0});return Y.createElement(Ir,{...k(_,p,g),ref:t,"data-empty":d||void 0},l&&Y.createElement(Xr,null),Y.createElement(o,{collection:a,parent:n,renderDropIndicator:De(s,c)}),m)});(class extends x{static{this.type=`tablefooter`}});var Rr=(0,Y.createContext)({isFocusVisibleWithinRow:!1}),zr=class extends o{static{this.type=`item`}filter(e,t,n){let r=e.getChildren(this.key);for(let i of r)if(n(i.textValue,i)){let n=this.clone();return t.addDescendants(n,e),n}return null}},Br=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.tr,{...e,ref:t})}),Vr=f(zr,(e,t,n)=>{let r=O(t),a=(0,Y.useContext)(Z),{dragAndDropHooks:o,dragState:s,dropState:l}=(0,Y.useContext)(U),{isVirtualized:u,CollectionBranch:d}=(0,Y.useContext)(G),f=s&&!(s.isDisabled||s.selectionManager.isDisabled(n.key)),{rowProps:p,expandButtonProps:m,...h}=nr({node:n,shouldSelectOnPressUp:!!s,isVirtualized:u},a,r),{isFocused:g,isFocusVisible:_,focusProps:v}=R(),{isFocusVisible:y,focusProps:b}=R({within:!0}),{hoverProps:x,isHovered:S}=ge({isDisabled:!h.allowsSelection&&!h.hasAction&&!f,onHoverStart:e.onHoverStart,onHoverChange:e.onHoverChange,onHoverEnd:e.onHoverEnd}),{checkboxProps:w}=sr({key:n.key},a),T;s&&o&&(T=o.useDraggableItem({key:n.key,hasDragButton:!0},s));let E,D=(0,Y.useRef)(null),{visuallyHiddenProps:A}=i();l&&o&&(E=o.useDropIndicator({target:{type:`item`,key:n.key,dropPosition:`on`}},l,D));let M=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{s&&M.current},[]);let N=s&&s.isDragging(n.key),{children:P,...te}=e,ne=e.hasChildItems||a.collection.getItem(n.lastChildKey)?.type!==`cell`,F=ne&&a.expandedKeys.has(n.key),re=j({...te,id:void 0,defaultClassName:`react-aria-Row`,defaultStyle:{"--table-row-level":n.level+1},values:{...h,state:a,isHovered:S,isFocused:g,isFocusVisible:_,selectionMode:a.selectionManager.selectionMode,selectionBehavior:a.selectionManager.selectionBehavior,isDragging:N,isDropTarget:E?.isDropTarget,isFocusVisibleWithin:y,id:n.key,hasChildItems:ne,isExpanded:F,level:n.level+1}}),I=B(e,{global:!0});return delete I.id,delete I.onClick,Y.createElement(Y.Fragment,null,E&&!E.isHidden&&Y.createElement(Br,{role:`row`,style:{height:0}},Y.createElement(Ur,{role:`gridcell`,colSpan:a.collection.columnCount,style:{padding:0}},Y.createElement(`div`,{role:`button`,...A,...E.dropIndicatorProps,ref:D}))),Y.createElement(Br,{...k(I,re,p,v,x,T?.dragProps,b),ref:r,"data-disabled":h.isDisabled||void 0,"data-selected":h.isSelected||void 0,"data-hovered":S||void 0,"data-focused":h.isFocused||void 0,"data-focus-visible":_||void 0,"data-pressed":h.isPressed||void 0,"data-dragging":N||void 0,"data-drop-target":E?.isDropTarget||void 0,"data-selection-mode":a.selectionManager.selectionMode===`none`?void 0:a.selectionManager.selectionMode,"data-focus-visible-within":y||void 0,"data-expanded":F||void 0,"data-has-child-items":ne||void 0,"data-level":n.level+1},Y.createElement(C,{values:[[ke,{slots:{[ee]:{},selection:w}}],[Oe,{slots:{[ee]:{},selection:w}}],[c,{slots:{[ee]:{},chevron:m,drag:{...T?.dragButtonProps,ref:M,style:{pointerEvents:`none`}}}}],[ze,{isSelected:h.isSelected}],[Rr,{isFocusVisibleWithinRow:y}]]},Y.createElement(d,{collection:a.collection,parent:n}))))},e=>{if(e.id==null&&typeof e.children==`function`)throw Error(`No id detected for the Row element. The Row element requires a id to be provided to it when the cells are rendered dynamically.`);let t=[e.value].concat(e.dependencies);return Y.createElement(d,{dependencies:t,items:e.columns,idScope:e.id},e.children)}),Hr=class extends o{static{this.type=`cell`}},Ur=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.td,{...e,ref:t})}),Wr=_(Hr,(e,t,n)=>{let r=O(t),i=(0,Y.useContext)(Z),{dragState:a}=(0,Y.useContext)(U),{isVirtualized:o}=(0,Y.useContext)(G);n.column=i.collection.columns[n.index];let{gridCellProps:s,isPressed:c}=ar({node:n,shouldSelectOnPressUp:!!a,isVirtualized:o,focusMode:e.focusMode,allowsArrowNavigation:e.allowsArrowNavigation},i,r),{isFocused:l,isFocusVisible:u,focusProps:d}=R(),{hoverProps:f,isHovered:p}=ge({}),{isFocusVisibleWithinRow:m}=(0,Y.useContext)(Rr),h=n.parentKey!=null&&i.selectionManager.isSelected(n.parentKey),g=n.colIndex||n.index,_=i.collection.getItem(n.parentKey),v=_.props.hasChildItems||i.collection.getItem(_.lastChildKey)?.type!==`cell`,y=v&&i.expandedKeys.has(n.parentKey),b=i.selectionManager.isDisabled(n.parentKey),x=j({...e,id:void 0,defaultClassName:`react-aria-Cell`,values:{isFocused:l,isFocusVisible:u,isFocusVisibleWithinRow:m,isPressed:c,isHovered:p,isSelected:h,id:n.key,columnIndex:g,hasChildItems:v,isExpanded:y,isDisabled:b,level:_.level+1,isTreeColumn:n.column.key===i.treeColumn}}),S=B(e,{global:!0});return delete S.id,Y.createElement(Ur,{...k(S,x,s,d,f),ref:r,"data-focused":l||void 0,"data-focus-visible":u||void 0,"data-focus-visible-within-row":m||void 0,"data-pressed":c||void 0,"data-selected":h||void 0,"data-column-index":g,"data-expanded":y||void 0,"data-has-child-items":v||void 0,"data-level":_.level+1,"data-tree-column":n.column.key===i.treeColumn||void 0,"data-disabled":b||void 0},Y.createElement(G.Provider,{value:Ue},x.children))});function Gr(e,t){t=O(t);let{dragAndDropHooks:n,dropState:r}=(0,Y.useContext)(U),i=(0,Y.useRef)(null),{dropIndicatorProps:a,isHidden:o,isDropTarget:s}=n.useDropIndicator(e,r,i);if(o)return null;let c=r&&e.target.type===`item`?(r.collection.getItem(e.target.key)?.level||0)+1:1;return Y.createElement(Yr,{...e,dropIndicatorProps:a,isDropTarget:s,buttonRef:i,level:c,ref:t})}var Kr=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.tr,{...e,ref:t})}),qr=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.td,{...e,ref:t})});function Jr(e,t){let{dropIndicatorProps:n,isDropTarget:r,buttonRef:a,level:o,...s}=e,c=(0,Y.useContext)(Z),{visuallyHiddenProps:l}=i(),u=j({...s,defaultClassName:`react-aria-DropIndicator`,defaultStyle:{"--table-row-level":o+1},values:{isDropTarget:r}});return Y.createElement(Kr,{...B(e,{global:!0}),...u,role:`row`,ref:t,"data-drop-target":r||void 0,"aria-level":o},Y.createElement(qr,{role:`gridcell`,colSpan:c.collection.columnCount,style:{padding:0}},Y.createElement(`div`,{...l,role:`button`,...n,ref:a}),u.children))}var Yr=(0,Y.forwardRef)(Jr);function Xr(){let e=(0,Y.useContext)(Z),{dragAndDropHooks:t,dropState:n}=(0,Y.useContext)(U),r=(0,Y.useRef)(null),{dropIndicatorProps:a}=t.useDropIndicator({target:{type:`root`}},n,r),o=n.isDropTarget({type:`root`}),{visuallyHiddenProps:s}=i();return!o&&a[`aria-hidden`]?null:Y.createElement(Br,{role:`row`,"aria-hidden":a[`aria-hidden`],style:{height:0}},Y.createElement(Ur,{role:`gridcell`,colSpan:e.collection.columnCount,style:{padding:0}},Y.createElement(`div`,{role:`button`,...s,...a,ref:r})))}var Zr=_(u,function(e,t,n){let r=(0,Y.useContext)(Z),{isVirtualized:i}=(0,Y.useContext)(G),{isLoading:a,onLoadMore:o,scrollOffset:s,...c}=e,l=r.collection.columns.length,u=(0,Y.useRef)(null),d=(0,Y.useMemo)(()=>({onLoadMore:o,collection:r?.collection,sentinelRef:u,scrollOffset:s}),[o,s,r?.collection]);Ee(d,u);let f=j({...c,id:void 0,children:n.rendered,defaultClassName:`react-aria-TableLoadingIndicator`,defaultStyle:{"--table-row-level":n.level+1},values:void 0}),p={},m={},h={};return i?(m[`aria-colspan`]=l,h={display:`contents`}):m.colSpan=l,Y.createElement(Y.Fragment,null,Y.createElement(Br,{style:{height:0},inert:we(!0)},Y.createElement(Ur,{style:{padding:0,border:0}},Y.createElement(`div`,{"data-testid":`loadMoreSentinel`,ref:u,style:{position:`relative`,height:1,width:1}}))),a&&f.children&&Y.createElement(Br,{...k(B(e,{global:!0}),p),...f,role:`row`,ref:t,"aria-level":n.level+1,"data-level":n.level+1},Y.createElement(Ur,{role:`rowheader`,...m,style:h},f.children)))}),Q=r(),$=(0,Y.createContext)({}),Qr=({children:e,className:t,variant:n,...r})=>{let i=Y.useMemo(()=>Ge({variant:n}),[n]);return(0,Q.jsx)($,{value:{slots:i},children:(0,Q.jsx)(w.div,{className:i.base({className:t}),"data-slot":`table`,...r,children:e})})};Qr.displayName=`HeroUI.Table`;var $r=({className:e,...t})=>{let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(w.div,{className:V(n?.scrollContainer,e),"data-slot":`table-scroll-container`,...t})};$r.displayName=`HeroUI.Table.ScrollContainer`;function ei({className:e,...t}){let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(br,{className:L(e,n?.content()),"data-slot":`table-content`,...t})}ei.displayName=`HeroUI.Table.Content`;function ti({className:e,...t}){let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(Dr,{className:L(e,n?.header()),"data-slot":`table-header`,...t})}ti.displayName=`HeroUI.Table.Header`;var ni=({className:e,ref:t,...n})=>{let{slots:r}=(0,Y.use)($);return(0,Q.jsx)(Mr,{ref:t,className:L(e,r?.column()),"data-slot":`table-column`,...n})};ni.displayName=`HeroUI.Table.Column`;function ri({className:e,...t}){let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(Lr,{className:L(e,n?.body()),"data-slot":`table-body`,...t})}ri.displayName=`HeroUI.Table.Body`;function ii({className:e,...t}){let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(Vr,{className:L(e,n?.row()),"data-slot":`table-row`,...t})}ii.displayName=`HeroUI.Table.Row`;var ai=({className:e,ref:t,...n})=>{let{slots:r}=(0,Y.use)($);return(0,Q.jsx)(Wr,{ref:t,className:L(e,r?.cell()),"data-slot":`table-cell`,...n})};ai.displayName=`HeroUI.Table.Cell`;var oi=({className:e,...t})=>{let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(w.div,{className:V(n?.footer,e),"data-slot":`table-footer`,...t})};oi.displayName=`HeroUI.Table.Footer`;var si=({className:e,ref:t,...n})=>(0,Q.jsx)(_r,{ref:t,className:P(`table__resizable-container`,e),"data-slot":`table-resizable-container`,...n});si.displayName=`HeroUI.Table.ResizableContainer`;var ci=({className:e,ref:t,...n})=>{let{slots:r}=(0,Y.use)($);return(0,Q.jsx)(Pr,{ref:t,className:L(e,r?.columnResizer()),"data-slot":`table-column-resizer`,...n})};ci.displayName=`HeroUI.Table.ColumnResizer`;var li=({className:e,ref:t,...n})=>{let{slots:r}=(0,Y.use)($);return(0,Q.jsx)(Zr,{ref:t,className:V(r?.loadMore,e),"data-slot":`table-load-more`,...n})};li.displayName=`HeroUI.Table.LoadMore`;var ui=({className:e,...t})=>{let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(w.div,{className:V(n?.loadMoreContent,e),"data-slot":`table-load-more-content`,...t})};ui.displayName=`HeroUI.Table.LoadMoreContent`;var di=({children:e,className:t,indicator:n,ref:r,showIndicator:i=!0,sortDirection:a,...o})=>{let{slots:c}=(0,Y.use)($),l=i&&!!a,u=null;if(l){if(n===void 0)u=(0,Q.jsx)(s,{className:c?.sortableColumnIndicator(),"data-direction":a,"data-slot":`table-sortable-column-indicator`});else if(Y.isValidElement(n)){let e=n;u=Y.cloneElement(e,{className:V(c?.sortableColumnIndicator,e.props.className),"data-direction":a,"data-slot":`table-sortable-column-indicator`})}else u=n}return(0,Q.jsxs)(`span`,{ref:r,className:V(c?.sortableColumnHeader,t),"data-direction":a,"data-slot":`table-sortable-column-header`,...o,children:[e,u]})};di.displayName=`HeroUI.Table.SortableColumnHeader`;var fi=Object.assign(Qr,{Body:ri,Cell:ai,Collection:d,Column:ni,ColumnResizer:ci,Content:ei,Footer:oi,Header:ti,LoadMore:li,LoadMoreContent:ui,ResizableContainer:si,Root:Qr,Row:ii,ScrollContainer:$r,SortableColumnHeader:di});export{fi as t}; \ No newline at end of file +import{a as e,c as t,i as n,n as r}from"./shim-mfK0Rmj6.js";import{D as i,Q as a,S as o,U as s,X as c,_ as l,b as u,g as d,h as f,k as p,l as m,lt as h,m as g,p as _,u as v,ut as y,v as b,x}from"./useI18n-BAo1UrJW.js";import{$ as S,A as C,B as w,C as T,D as E,F as D,G as O,J as k,K as A,M as j,O as M,P as ee,Q as N,R as P,W as te,Y as ne,Z as F,_ as re,a as I,at as ie,c as L,d as R,dt as ae,g as oe,gt as se,i as ce,it as le,j as ue,k as z,l as de,lt as fe,m as pe,q as B,s as V,st as me,t as he,tt as H,u as ge,x as _e,xt as ve,y as ye,z as be}from"./SharedElementTransition-BlCsXfb1.js";import{t as xe}from"./useUpdateEffect-DR9d7F-l.js";import{a as Se,i as Ce,n as U,o as we,r as Te,s as Ee,t as De}from"./DragAndDrop-QLaADEWb.js";import{i as Oe,r as ke}from"./Checkbox-x9lhPT2J.js";import{t as Ae}from"./useHasTabbableChild-8WJt7azf.js";import{$ as je,Dt as Me,Et as W,Q as Ne,Tt as Pe,Z as Fe,at as Ie,ct as Le,gt as G,it as K,lt as Re,mt as ze,nt as Be,rt as q,st as Ve,tt as J,ut as He,vt as Ue,wt as We}from"./index-CWTBzWuK.js";var Ge=be({defaultVariants:{variant:`primary`},slots:{base:`table-root`,body:`table__body`,cell:`table__cell`,column:`table__column`,columnResizer:`table__column-resizer`,content:`table__content`,footer:`table__footer`,header:`table__header`,loadMore:`table__load-more`,loadMoreContent:`table__load-more-content`,resizableContainer:`table__resizable-container`,row:`table__row`,scrollContainer:`table__scroll-container`,sortableColumnHeader:`table__sortable-column-header`,sortableColumnIndicator:`table__sortable-column-indicator`},variants:{variant:{primary:{base:`table-root--primary`},secondary:{base:`table-root--secondary`}}}}),Y=t(e(),1);function Ke(e){let{onMoveStart:t,onMove:n,onMoveEnd:r}=e,i=(0,Y.useRef)({didMove:!1,lastPosition:null,id:null}),{addGlobalListener:a,removeGlobalListener:o}=A(),s=(0,Y.useCallback)((e,r,a,o)=>{(a!==0||o!==0)&&(i.current.didMove||(i.current.didMove=!0,t?.({type:`movestart`,pointerType:r,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey})),n?.({type:`move`,pointerType:r,deltaX:a,deltaY:o,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey}))},[t,n,i]),c=te(s),l=(0,Y.useCallback)((e,t)=>{re(),i.current.didMove&&r?.({type:`moveend`,pointerType:t,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey})},[r,i]),u=te(l);return{moveProps:(0,Y.useMemo)(()=>{let e={},t=()=>{oe(),i.current.didMove=!1};{let n=e=>{if(e.pointerId===i.current.id){let t=e.pointerType||`mouse`;c(e,t,e.pageX-(i.current.lastPosition?.pageX??0),e.pageY-(i.current.lastPosition?.pageY??0)),i.current.lastPosition={pageX:e.pageX,pageY:e.pageY}}},r=e=>{if(e.pointerId===i.current.id){let t=e.pointerType||`mouse`;u(e,t),i.current.id=null;let a=ie(H(e));o(a,`pointermove`,n,!1),o(a,`pointerup`,r,!1),o(a,`pointercancel`,r,!1)}};e.onPointerDown=e=>{if(e.button===0&&i.current.id==null){t(),e.stopPropagation(),e.preventDefault(),i.current.lastPosition={pageX:e.pageX,pageY:e.pageY},i.current.id=e.pointerId;let o=ie(H(e));a(o,`pointermove`,n,!1),a(o,`pointerup`,r,!1),a(o,`pointercancel`,r,!1)}}}let n=(e,n,r)=>{t(),c(e,`keyboard`,n,r),u(e,`keyboard`)};return e.onKeyDown=e=>{switch(e.key){case`Left`:case`ArrowLeft`:e.preventDefault(),e.stopPropagation(),n(e,-1,0);break;case`Right`:case`ArrowRight`:e.preventDefault(),e.stopPropagation(),n(e,1,0);break;case`Up`:case`ArrowUp`:e.preventDefault(),e.stopPropagation(),n(e,0,-1);break;case`Down`:case`ArrowDown`:e.preventDefault(),e.stopPropagation(),n(e,0,1)}},e},[a,o,i])}}var qe={};qe={deselectedItem:e=>`${e.item} \u{63A}\u{64A}\u{631} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}`,longPressToSelect:`اضغط مطولًا للدخول إلى وضع التحديد.`,select:`تحديد`,selectedAll:`جميع العناصر المحددة.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`لم يتم تحديد عناصر`,one:()=>`${t.number(e.count)} \u{639}\u{646}\u{635}\u{631} \u{645}\u{62D}\u{62F}\u{62F}`,other:()=>`${t.number(e.count)} \u{639}\u{646}\u{635}\u{631} \u{645}\u{62D}\u{62F}\u{62F}`})}.`,selectedItem:e=>`${e.item} \u{627}\u{644}\u{645}\u{62D}\u{62F}\u{62F}`};var Je={};Je={deselectedItem:e=>`${e.item} \u{43D}\u{435} \u{435} \u{438}\u{437}\u{431}\u{440}\u{430}\u{43D}.`,longPressToSelect:`Натиснете и задръжте за да влезете в избирателен режим.`,select:`Изберете`,selectedAll:`Всички елементи са избрани.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Няма избрани елементи`,one:()=>`${t.number(e.count)} \u{438}\u{437}\u{431}\u{440}\u{430}\u{43D} \u{435}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442}`,other:()=>`${t.number(e.count)} \u{438}\u{437}\u{431}\u{440}\u{430}\u{43D}\u{438} \u{435}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442}\u{438}`})}.`,selectedItem:e=>`${e.item} \u{438}\u{437}\u{431}\u{440}\u{430}\u{43D}.`};var Ye={};Ye={deselectedItem:e=>`Polo\u{17E}ka ${e.item} nen\xed vybr\xe1na.`,longPressToSelect:`Dlouhým stisknutím přejdete do režimu výběru.`,select:`Vybrat`,selectedAll:`Vybrány všechny položky.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nevybrány žádné položky`,one:()=>`Vybr\xe1na ${t.number(e.count)} polo\u{17E}ka`,other:()=>`Vybr\xe1no ${t.number(e.count)} polo\u{17E}ek`})}.`,selectedItem:e=>`Vybr\xe1na polo\u{17E}ka ${e.item}.`};var Xe={};Xe={deselectedItem:e=>`${e.item} ikke valgt.`,longPressToSelect:`Lav et langt tryk for at aktivere valgtilstand.`,select:`Vælg`,selectedAll:`Alle elementer valgt.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Ingen elementer valgt`,one:()=>`${t.number(e.count)} element valgt`,other:()=>`${t.number(e.count)} elementer valgt`})}.`,selectedItem:e=>`${e.item} valgt.`};var Ze={};Ze={deselectedItem:e=>`${e.item} nicht ausgew\xe4hlt.`,longPressToSelect:`Gedrückt halten, um Auswahlmodus zu öffnen.`,select:`Auswählen`,selectedAll:`Alle Elemente ausgewählt.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Keine Elemente ausgewählt`,one:()=>`${t.number(e.count)} Element ausgew\xe4hlt`,other:()=>`${t.number(e.count)} Elemente ausgew\xe4hlt`})}.`,selectedItem:e=>`${e.item} ausgew\xe4hlt.`};var Qe={};Qe={deselectedItem:e=>`\u{394}\u{3B5}\u{3BD} \u{3B5}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3B8}\u{3B7}\u{3BA}\u{3B5} \u{3C4}\u{3BF} \u{3C3}\u{3C4}\u{3BF}\u{3B9}\u{3C7}\u{3B5}\u{3AF}\u{3BF} ${e.item}.`,longPressToSelect:`Πατήστε παρατεταμένα για να μπείτε σε λειτουργία επιλογής.`,select:`Επιλογή`,selectedAll:`Επιλέχθηκαν όλα τα στοιχεία.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Δεν επιλέχθηκαν στοιχεία`,one:()=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3B8}\u{3B7}\u{3BA}\u{3B5} ${t.number(e.count)} \u{3C3}\u{3C4}\u{3BF}\u{3B9}\u{3C7}\u{3B5}\u{3AF}\u{3BF}`,other:()=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3B8}\u{3B7}\u{3BA}\u{3B1}\u{3BD} ${t.number(e.count)} \u{3C3}\u{3C4}\u{3BF}\u{3B9}\u{3C7}\u{3B5}\u{3AF}\u{3B1}`})}.`,selectedItem:e=>`\u{395}\u{3C0}\u{3B9}\u{3BB}\u{3AD}\u{3C7}\u{3B8}\u{3B7}\u{3BA}\u{3B5} \u{3C4}\u{3BF} \u{3C3}\u{3C4}\u{3BF}\u{3B9}\u{3C7}\u{3B5}\u{3AF}\u{3BF} ${e.item}.`};var $e={};$e={deselectedItem:e=>`${e.item} not selected.`,select:`Select`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`No items selected`,one:()=>`${t.number(e.count)} item selected`,other:()=>`${t.number(e.count)} items selected`})}.`,selectedAll:`All items selected.`,selectedItem:e=>`${e.item} selected.`,longPressToSelect:`Long press to enter selection mode.`};var et={};et={deselectedItem:e=>`${e.item} no seleccionado.`,longPressToSelect:`Mantenga pulsado para abrir el modo de selección.`,select:`Seleccionar`,selectedAll:`Todos los elementos seleccionados.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Ningún elemento seleccionado`,one:()=>`${t.number(e.count)} elemento seleccionado`,other:()=>`${t.number(e.count)} elementos seleccionados`})}.`,selectedItem:e=>`${e.item} seleccionado.`};var tt={};tt={deselectedItem:e=>`${e.item} pole valitud.`,longPressToSelect:`Valikurežiimi sisenemiseks vajutage pikalt.`,select:`Vali`,selectedAll:`Kõik üksused valitud.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Üksusi pole valitud`,one:()=>`${t.number(e.count)} \xfcksus valitud`,other:()=>`${t.number(e.count)} \xfcksust valitud`})}.`,selectedItem:e=>`${e.item} valitud.`};var nt={};nt={deselectedItem:e=>`Kohdetta ${e.item} ei valittu.`,longPressToSelect:`Siirry valintatilaan painamalla pitkään.`,select:`Valitse`,selectedAll:`Kaikki kohteet valittu.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Ei yhtään kohdetta valittu`,one:()=>`${t.number(e.count)} kohde valittu`,other:()=>`${t.number(e.count)} kohdetta valittu`})}.`,selectedItem:e=>`${e.item} valittu.`};var rt={};rt={deselectedItem:e=>`${e.item} non s\xe9lectionn\xe9.`,longPressToSelect:`Appuyez de manière prolongée pour passer en mode de sélection.`,select:`Sélectionner`,selectedAll:`Tous les éléments sélectionnés.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Aucun élément sélectionné`,one:()=>`${t.number(e.count)} \xe9l\xe9ment s\xe9lectionn\xe9`,other:()=>`${t.number(e.count)} \xe9l\xe9ments s\xe9lectionn\xe9s`})}.`,selectedItem:e=>`${e.item} s\xe9lectionn\xe9.`};var it={};it={deselectedItem:e=>`${e.item} \u{5DC}\u{5D0} \u{5E0}\u{5D1}\u{5D7}\u{5E8}.`,longPressToSelect:`הקשה ארוכה לכניסה למצב בחירה.`,select:`בחר`,selectedAll:`כל הפריטים נבחרו.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`לא נבחרו פריטים`,one:()=>`\u{5E4}\u{5E8}\u{5D9}\u{5D8} ${t.number(e.count)} \u{5E0}\u{5D1}\u{5D7}\u{5E8}`,other:()=>`${t.number(e.count)} \u{5E4}\u{5E8}\u{5D9}\u{5D8}\u{5D9}\u{5DD} \u{5E0}\u{5D1}\u{5D7}\u{5E8}\u{5D5}`})}.`,selectedItem:e=>`${e.item} \u{5E0}\u{5D1}\u{5D7}\u{5E8}.`};var at={};at={deselectedItem:e=>`Stavka ${e.item} nije odabrana.`,longPressToSelect:`Dugo pritisnite za ulazak u način odabira.`,select:`Odaberite`,selectedAll:`Odabrane su sve stavke.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nije odabrana nijedna stavka`,one:()=>`Odabrana je ${t.number(e.count)} stavka`,other:()=>`Odabrano je ${t.number(e.count)} stavki`})}.`,selectedItem:e=>`Stavka ${e.item} je odabrana.`};var ot={};ot={deselectedItem:e=>`${e.item} nincs kijel\xf6lve.`,longPressToSelect:`Nyomja hosszan a kijelöléshez.`,select:`Kijelölés`,selectedAll:`Az összes elem kijelölve.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Egy elem sincs kijelölve`,one:()=>`${t.number(e.count)} elem kijel\xf6lve`,other:()=>`${t.number(e.count)} elem kijel\xf6lve`})}.`,selectedItem:e=>`${e.item} kijel\xf6lve.`};var st={};st={deselectedItem:e=>`${e.item} non selezionato.`,longPressToSelect:`Premi a lungo per passare alla modalità di selezione.`,select:`Seleziona`,selectedAll:`Tutti gli elementi selezionati.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nessun elemento selezionato`,one:()=>`${t.number(e.count)} elemento selezionato`,other:()=>`${t.number(e.count)} elementi selezionati`})}.`,selectedItem:e=>`${e.item} selezionato.`};var ct={};ct={deselectedItem:e=>`${e.item} \u{304C}\u{9078}\u{629E}\u{3055}\u{308C}\u{3066}\u{3044}\u{307E}\u{305B}\u{3093}\u{3002}`,longPressToSelect:`長押しして選択モードを開きます。`,select:`選択`,selectedAll:`すべての項目を選択しました。`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`項目が選択されていません`,one:()=>`${t.number(e.count)} \u{9805}\u{76EE}\u{3092}\u{9078}\u{629E}\u{3057}\u{307E}\u{3057}\u{305F}`,other:()=>`${t.number(e.count)} \u{9805}\u{76EE}\u{3092}\u{9078}\u{629E}\u{3057}\u{307E}\u{3057}\u{305F}`})}\u{3002}`,selectedItem:e=>`${e.item} \u{3092}\u{9078}\u{629E}\u{3057}\u{307E}\u{3057}\u{305F}\u{3002}`};var lt={};lt={deselectedItem:e=>`${e.item}\u{C774}(\u{AC00}) \u{C120}\u{D0DD}\u{B418}\u{C9C0} \u{C54A}\u{C558}\u{C2B5}\u{B2C8}\u{B2E4}.`,longPressToSelect:`선택 모드로 들어가려면 길게 누르십시오.`,select:`선택`,selectedAll:`모든 항목이 선택되었습니다.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`선택된 항목이 없습니다`,one:()=>`${t.number(e.count)}\u{AC1C} \u{D56D}\u{BAA9}\u{C774} \u{C120}\u{D0DD}\u{B418}\u{C5C8}\u{C2B5}\u{B2C8}\u{B2E4}`,other:()=>`${t.number(e.count)}\u{AC1C} \u{D56D}\u{BAA9}\u{C774} \u{C120}\u{D0DD}\u{B418}\u{C5C8}\u{C2B5}\u{B2C8}\u{B2E4}`})}.`,selectedItem:e=>`${e.item}\u{C774}(\u{AC00}) \u{C120}\u{D0DD}\u{B418}\u{C5C8}\u{C2B5}\u{B2C8}\u{B2E4}.`};var ut={};ut={deselectedItem:e=>`${e.item} nepasirinkta.`,longPressToSelect:`Norėdami įjungti pasirinkimo režimą, paspauskite ir palaikykite.`,select:`Pasirinkti`,selectedAll:`Pasirinkti visi elementai.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nepasirinktas nė vienas elementas`,one:()=>`Pasirinktas ${t.number(e.count)} elementas`,other:()=>`Pasirinkta element\u{173}: ${t.number(e.count)}`})}.`,selectedItem:e=>`Pasirinkta: ${e.item}.`};var dt={};dt={deselectedItem:e=>`Vienums ${e.item} nav atlas\u{12B}ts.`,longPressToSelect:`Ilgi turiet nospiestu. lai ieslēgtu atlases režīmu.`,select:`Atlasīt`,selectedAll:`Atlasīti visi vienumi.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nav atlasīts neviens vienums`,one:()=>`Atlas\u{12B}to vienumu skaits: ${t.number(e.count)}`,other:()=>`Atlas\u{12B}to vienumu skaits: ${t.number(e.count)}`})}.`,selectedItem:e=>`Atlas\u{12B}ts vienums ${e.item}.`};var ft={};ft={deselectedItem:e=>`${e.item} er ikke valgt.`,longPressToSelect:`Bruk et langt trykk for å gå inn i valgmodus.`,select:`Velg`,selectedAll:`Alle elementer er valgt.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Ingen elementer er valgt`,one:()=>`${t.number(e.count)} element er valgt`,other:()=>`${t.number(e.count)} elementer er valgt`})}.`,selectedItem:e=>`${e.item} er valgt.`};var pt={};pt={deselectedItem:e=>`${e.item} niet geselecteerd.`,longPressToSelect:`Druk lang om de selectiemodus te openen.`,select:`Selecteren`,selectedAll:`Alle items geselecteerd.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Geen items geselecteerd`,one:()=>`${t.number(e.count)} item geselecteerd`,other:()=>`${t.number(e.count)} items geselecteerd`})}.`,selectedItem:e=>`${e.item} geselecteerd.`};var mt={};mt={deselectedItem:e=>`Nie zaznaczono ${e.item}.`,longPressToSelect:`Naciśnij i przytrzymaj, aby wejść do trybu wyboru.`,select:`Zaznacz`,selectedAll:`Wszystkie zaznaczone elementy.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nie zaznaczono żadnych elementów`,one:()=>`${t.number(e.count)} zaznaczony element`,other:()=>`${t.number(e.count)} zaznaczonych element\xf3w`})}.`,selectedItem:e=>`Zaznaczono ${e.item}.`};var ht={};ht={deselectedItem:e=>`${e.item} n\xe3o selecionado.`,longPressToSelect:`Mantenha pressionado para entrar no modo de seleção.`,select:`Selecionar`,selectedAll:`Todos os itens selecionados.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nenhum item selecionado`,one:()=>`${t.number(e.count)} item selecionado`,other:()=>`${t.number(e.count)} itens selecionados`})}.`,selectedItem:e=>`${e.item} selecionado.`};var gt={};gt={deselectedItem:e=>`${e.item} n\xe3o selecionado.`,longPressToSelect:`Prima continuamente para entrar no modo de seleção.`,select:`Selecionar`,selectedAll:`Todos os itens selecionados.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nenhum item selecionado`,one:()=>`${t.number(e.count)} item selecionado`,other:()=>`${t.number(e.count)} itens selecionados`})}.`,selectedItem:e=>`${e.item} selecionado.`};var _t={};_t={deselectedItem:e=>`${e.item} neselectat.`,longPressToSelect:`Apăsați lung pentru a intra în modul de selectare.`,select:`Selectare`,selectedAll:`Toate elementele selectate.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Niciun element selectat`,one:()=>`${t.number(e.count)} element selectat`,other:()=>`${t.number(e.count)} elemente selectate`})}.`,selectedItem:e=>`${e.item} selectat.`};var vt={};vt={deselectedItem:e=>`${e.item} \u{43D}\u{435} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E}.`,longPressToSelect:`Нажмите и удерживайте для входа в режим выбора.`,select:`Выбрать`,selectedAll:`Выбраны все элементы.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Нет выбранных элементов`,one:()=>`${t.number(e.count)} \u{44D}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}`,other:()=>`${t.number(e.count)} \u{44D}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442}\u{43E}\u{432} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E}`})}.`,selectedItem:e=>`${e.item} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E}.`};var yt={};yt={deselectedItem:e=>`Nevybrat\xe9 polo\u{17E}ky: ${e.item}.`,longPressToSelect:`Dlhším stlačením prejdite do režimu výberu.`,select:`Vybrať`,selectedAll:`Všetky vybraté položky.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Žiadne vybraté položky`,one:()=>`${t.number(e.count)} vybrat\xe1 polo\u{17E}ka`,other:()=>`Po\u{10D}et vybrat\xfdch polo\u{17E}iek:${t.number(e.count)}`})}.`,selectedItem:e=>`Vybrat\xe9 polo\u{17E}ky: ${e.item}.`};var bt={};bt={deselectedItem:e=>`Element ${e.item} ni izbran.`,longPressToSelect:`Za izbirni način pritisnite in dlje časa držite.`,select:`Izberite`,selectedAll:`Vsi elementi so izbrani.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Noben element ni izbran`,one:()=>`${t.number(e.count)} element je izbran`,other:()=>`${t.number(e.count)} elementov je izbranih`})}.`,selectedItem:e=>`Element ${e.item} je izbran.`};var xt={};xt={deselectedItem:e=>`${e.item} nije izabrano.`,longPressToSelect:`Dugo pritisnite za ulazak u režim biranja.`,select:`Izaberite`,selectedAll:`Izabrane su sve stavke.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Nije izabrana nijedna stavka`,one:()=>`Izabrana je ${t.number(e.count)} stavka`,other:()=>`Izabrano je ${t.number(e.count)} stavki`})}.`,selectedItem:e=>`${e.item} je izabrano.`};var St={};St={deselectedItem:e=>`${e.item} ej markerat.`,longPressToSelect:`Tryck länge när du vill öppna väljarläge.`,select:`Markera`,selectedAll:`Alla markerade objekt.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Inga markerade objekt`,one:()=>`${t.number(e.count)} markerat objekt`,other:()=>`${t.number(e.count)} markerade objekt`})}.`,selectedItem:e=>`${e.item} markerat.`};var Ct={};Ct={deselectedItem:e=>`${e.item} se\xe7ilmedi.`,longPressToSelect:`Seçim moduna girmek için uzun basın.`,select:`Seç`,selectedAll:`Tüm ögeler seçildi.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Hiçbir öge seçilmedi`,one:()=>`${t.number(e.count)} \xf6ge se\xe7ildi`,other:()=>`${t.number(e.count)} \xf6ge se\xe7ildi`})}.`,selectedItem:e=>`${e.item} se\xe7ildi.`};var wt={};wt={deselectedItem:e=>`${e.item} \u{43D}\u{435} \u{432}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E}.`,longPressToSelect:`Виконайте довге натиснення, щоб перейти в режим вибору.`,select:`Вибрати`,selectedAll:`Усі елементи вибрано.`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`Жодних елементів не вибрано`,one:()=>`${t.number(e.count)} \u{435}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442} \u{432}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E}`,other:()=>`\u{412}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E} \u{435}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442}\u{456}\u{432}: ${t.number(e.count)}`})}.`,selectedItem:e=>`${e.item} \u{432}\u{438}\u{431}\u{440}\u{430}\u{43D}\u{43E}.`};var Tt={};Tt={deselectedItem:e=>`\u{672A}\u{9009}\u{62E9} ${e.item}\u{3002}`,longPressToSelect:`长按以进入选择模式。`,select:`选择`,selectedAll:`已选择所有项目。`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`未选择项目`,one:()=>`\u{5DF2}\u{9009}\u{62E9} ${t.number(e.count)} \u{4E2A}\u{9879}\u{76EE}`,other:()=>`\u{5DF2}\u{9009}\u{62E9} ${t.number(e.count)} \u{4E2A}\u{9879}\u{76EE}`})}\u{3002}`,selectedItem:e=>`\u{5DF2}\u{9009}\u{62E9} ${e.item}\u{3002}`};var Et={};Et={deselectedItem:e=>`\u{672A}\u{9078}\u{53D6}\u{300C}${e.item}\u{300D}\u{3002}`,longPressToSelect:`長按以進入選擇模式。`,select:`選取`,selectedAll:`已選取所有項目。`,selectedCount:(e,t)=>`${t.plural(e.count,{"=0":`未選取任何項目`,one:()=>`\u{5DF2}\u{9078}\u{53D6} ${t.number(e.count)} \u{500B}\u{9805}\u{76EE}`,other:()=>`\u{5DF2}\u{9078}\u{53D6} ${t.number(e.count)} \u{500B}\u{9805}\u{76EE}`})}\u{3002}`,selectedItem:e=>`\u{5DF2}\u{9078}\u{53D6}\u{300C}${e.item}\u{300D}\u{3002}`};var Dt={};Dt={"ar-AE":qe,"bg-BG":Je,"cs-CZ":Ye,"da-DK":Xe,"de-DE":Ze,"el-GR":Qe,"en-US":$e,"es-ES":et,"et-EE":tt,"fi-FI":nt,"fr-FR":rt,"he-IL":it,"hr-HR":at,"hu-HU":ot,"it-IT":st,"ja-JP":ct,"ko-KR":lt,"lt-LT":ut,"lv-LV":dt,"nb-NO":ft,"nl-NL":pt,"pl-PL":mt,"pt-BR":ht,"pt-PT":gt,"ro-RO":_t,"ru-RU":vt,"sk-SK":yt,"sl-SI":bt,"sr-SP":xt,"sv-SE":St,"tr-TR":Ct,"uk-UA":wt,"zh-CN":Tt,"zh-TW":Et};function Ot(e){return e&&e.__esModule?e.default:e}function kt(e,t){let{getRowText:n=e=>t.collection.getTextValue?.(e)??t.collection.getItem(e)?.textValue}=e,r=p(Ot(Dt),`@react-aria/grid`),i=t.selectionManager.rawSelection,o=(0,Y.useRef)(i),s=(0,Y.useCallback)(()=>{if(!t.selectionManager.isFocused||i===o.current){o.current=i;return}let e=At(i,o.current),s=At(o.current,i),c=t.selectionManager.selectionBehavior===`replace`,l=[];if(t.selectionManager.selectedKeys.size===1&&c){let e=t.selectionManager.selectedKeys.keys().next().value;if(e!=null&&t.collection.getItem(e)){let t=n(e);t&&l.push(r.format(`selectedItem`,{item:t}))}}else if(e.size===1&&s.size===0){let t=e.keys().next().value;if(t!=null){let e=n(t);e&&l.push(r.format(`selectedItem`,{item:e}))}}else if(s.size===1&&e.size===0){let e=s.keys().next().value;if(e!=null&&t.collection.getItem(e)){let t=n(e);t&&l.push(r.format(`deselectedItem`,{item:t}))}}t.selectionManager.selectionMode===`multiple`&&(l.length===0||i===`all`||i.size>1||o.current===`all`||o.current?.size>1)&&l.push(i===`all`?r.format(`selectedAll`):r.format(`selectedCount`,{count:i.size})),l.length>0&&a(l.join(` `)),o.current=i},[i,t.selectionManager.selectedKeys,t.selectionManager.isFocused,t.selectionManager.selectionBehavior,t.selectionManager.selectionMode,t.collection,n,r]);xe(()=>{if(t.selectionManager.isFocused)s();else{let e=requestAnimationFrame(s);return()=>cancelAnimationFrame(e)}},[i,t.selectionManager.isFocused])}function At(e,t){let n=new Set;if(e===`all`||t===`all`)return n;for(let r of e.keys())t.has(r)||n.add(r);return n}function jt(e){return e&&e.__esModule?e.default:e}function Mt(e){let t=p(jt(Dt),`@react-aria/grid`),n=E(),r=(n===`pointer`||n===`virtual`||n==null)&&typeof window<`u`&&`ontouchstart`in window,i=(0,Y.useMemo)(()=>{let n=e.selectionManager.selectionMode,i=e.selectionManager.selectionBehavior,a;return r&&(a=t.format(`longPressToSelect`)),i===`replace`&&n!==`none`&&e.hasItemActions?a:void 0},[e.selectionManager.selectionMode,e.selectionManager.selectionBehavior,e.hasItemActions,t,r]);return Pe(i)}function Nt(e){return e&&e.__esModule?e.default:e}function Pt(e,t){let{key:n}=e,r=t.selectionManager,i=fe(),a=!t.selectionManager.canSelectItem(n),o=t.selectionManager.isSelected(n);return{checkboxProps:{id:i,"aria-label":p(Nt(Dt),`@react-aria/grid`).format(`select`),isSelected:o,isDisabled:a,onChange:()=>r.toggleSelection(n)}}}for(var Ft=10,It=5,Lt=class{setup(e,t,n){this.delegate=e,this.state=t,this.direction=n}getDropTargetFromPoint(e,t,n){let r=this.delegate.getDropTargetFromPoint(e,t,n);return!r||r.type===`root`?r:this.resolveDropTarget(r,e,t,n)}resolveDropTarget(e,t,n,r){let i=this.pointerTracking,a=n-i.lastY,o=t-i.lastX,s=i.yDirection,c=i.xDirection;if(Math.abs(a)>It&&(s=a>0?`down`:`up`,i.yDirection=s,i.lastY=n),Math.abs(o)>Ft&&(c=o>0?`right`:`left`,i.xDirection=c,i.lastX=t),e.dropPosition===`before`){let t=this.state.collection.getKeyBefore(e.key);for(;t!=null;){let e=this.state.collection.getItem(t);if(e?.type===`item`)break;t=e?.parentKey??null}if(t!=null){let n={type:`item`,key:t,dropPosition:`after`};r(n)&&(e=n)}}let l=this.getPotentialTargets(e,r);if(l.length===0)return{type:`root`};let u;return l.length>1?u=this.selectTarget(l,e,t,n,s,c):(u=l[0],i.boundaryContext=null),u}getPotentialTargets(e,t){if(e.dropPosition===`on`)return[e];let n=e,r=this.state.collection,i=r.getItem(n.key);for(;i&&i?.type!==`item`&&i.nextKey!=null;)n.key=i.nextKey,i=r.getItem(i.nextKey);let a=[n];if(i&&i.hasChildNodes&&this.state.expandedKeys.has(i.key)&&r.getChildren&&n.dropPosition===`after`){let e=i.firstChildKey==null?null:r.getItem(i.firstChildKey);for(;e&&e.type!==`item`;)e=e.nextKey==null?null:r.getItem(e.nextKey);if(e?.type===`item`){let n={type:`item`,key:e.key,dropPosition:`before`};return t(n)?[n]:[]}}if(i?.nextKey!=null)return[e];let o=i?.parentKey,s=[];for(;o!=null;){let e=r.getItem(o),n=e?.nextKey==null?null:r.getItem(e.nextKey);if(!n||n.parentKey!==o){let e={type:`item`,key:o,dropPosition:`after`};if(t(e)&&s.push(e),n)break}o=e?.parentKey}if(s.length>0&&a.push(...s),a.length===1){let e=r.getKeyAfter(n.key),a=e==null?null:r.getItem(e);if(e!=null&&a&&i&&a.level!=null&&i.level!=null&&a.level>i.level){let n={type:`item`,key:e,dropPosition:`before`};if(t(n))return[n]}}return a.filter(t)}selectTarget(e,t,n,r,i,a){if(e.length<2)return e[0];let o=this.pointerTracking,s=this.state.collection.getItem(t.key)?.parentKey;if(s==null)return e[0];(!o.boundaryContext||o.boundaryContext.parentKey!==s)&&(o.boundaryContext={parentKey:s,preferredTargetIndex:o.yDirection===`up`?e.length-1:0,lastSwitchY:r,lastSwitchX:n});let c=o.boundaryContext,l=Math.abs(n-c.lastSwitchX);if(Math.abs(r-c.lastSwitchY)>It&&i){let t=c.preferredTargetIndex||0;i===`down`&&t===0?c.preferredTargetIndex=e.length-1:i===`up`&&t===e.length-1&&(c.preferredTargetIndex=0),o.xDirection=null}if(l>Ft&&a){let t=c.preferredTargetIndex||0;a===`left`?this.direction===`ltr`?t0&&(c.preferredTargetIndex=t-1,c.lastSwitchX=n):a===`right`&&(this.direction===`ltr`?t>0&&(c.preferredTargetIndex=t-1,c.lastSwitchX=n):t{let i=this.keyMap.get(r.key);e.visitNode&&(r=e.visitNode(r)),this.keyMap.set(r.key,r);let a=new Set,o=null,s=!1;if(r.type===`item`){for(let e of r.childNodes)if(e.props?.colSpan!==void 0){s=!0;break}}for(let e of r.childNodes)e.type===`cell`&&s&&(e.colspan=e.props?.colSpan,e.colSpan=e.props?.colSpan,e.colIndex=o?(o.colIndex??o.index)+(o.colSpan??1):e.index),e.type===`cell`&&e.parentKey==null&&(e.parentKey=r.key),a.add(e.key),o?(o.nextKey=e.key,e.prevKey=o.key):e.prevKey=null,t(e),o=e;if(o&&(o.nextKey=null),i)for(let e of i.childNodes)a.has(e.key)||n(e)},n=e=>{this.keyMap.delete(e.key);for(let t of e.childNodes)this.keyMap.get(t.key)===t&&n(t)},r=null;for(let[n,i]of e.items.entries()){let e={...i,level:i.level??0,key:i.key??`row-`+n,type:i.type??`row`,value:i.value??null,hasChildNodes:!0,childNodes:[...i.childNodes],rendered:i.rendered,textValue:i.textValue??``,index:i.index??n};r?(r.nextKey=e.key,e.prevKey=r.key):e.prevKey=null,this.rows.push(e),t(e),r=e}r&&(r.nextKey=null)}*[Symbol.iterator](){yield*[...this.rows]}get size(){return[...this.rows].length}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let t=this.keyMap.get(e);return t?t.prevKey??null:null}getKeyAfter(e){let t=this.keyMap.get(e);return t?t.nextKey??null:null}getFirstKey(){return[...this.rows][0]?.key}getLastKey(){let e=[...this.rows];return e[e.length-1]?.key}getItem(e){return this.keyMap.get(e)??null}at(e){let t=[...this.getKeys()];return this.getItem(t[e])}getChildren(e){return this.keyMap.get(e)?.childNodes||[]}},zt=`row-header-column-`+Math.random().toString(36).slice(2),Bt=`row-header-column-`+Math.random().toString(36).slice(2);zt===Bt;)Bt=`row-header-column-`+Math.random().toString(36).slice(2);function Vt(e,t){if(t.length===0)return[];let n=[],r=new Map;for(let i of t){let t=i.parentKey,a=[i];for(;t!=null;){let n=e.get(t);if(!n)break;if(r.has(n)){n.colSpan??=0,n.colSpan++,n.colspan=n.colSpan;let{column:e,index:t}=r.get(n);if(t>a.length)break;for(let n=t;ne.length)),a=Array(i).fill(0).map(()=>[]),o=0;for(let e of n){let t=i-1;for(let n of e){if(n){let e=a[t],r=e.reduce((e,t)=>e+(t.colSpan??1),0);if(r0&&(e[e.length-1].nextKey=i.key,i.prevKey=e[e.length-1].key),e.push(i)}e.length>0&&(e[e.length-1].nextKey=n.key,n.prevKey=e[e.length-1].key),n.level=t,n.colIndex=o,e.push(n)}t--}o++}let s=0;for(let e of a){let n=e.reduce((e,t)=>e+(t.colSpan??1),0);if(n({type:`headerrow`,key:`headerrow-`+t,index:t,value:null,rendered:null,level:0,hasChildNodes:!0,childNodes:e,textValue:``}))}var Ht=class extends Rt{constructor(e,t,n){let r=new Set,i=null,a=[];if(n?.showSelectionCheckboxes){let e={type:`column`,key:zt,value:null,textValue:``,level:0,index:+!!n?.showDragButtons,hasChildNodes:!1,rendered:null,childNodes:[],props:{isSelectionCell:!0}};a.unshift(e)}if(n?.showDragButtons){let e={type:`column`,key:Bt,value:null,textValue:``,level:0,index:0,hasChildNodes:!1,rendered:null,childNodes:[],props:{isDragButtonCell:!0}};a.unshift(e)}let o=[],s=new Map,c=e=>{switch(e.type){case`body`:i=e;break;case`column`:s.set(e.key,e),e.hasChildNodes||(a.push(e),e.props.isRowHeader&&r.add(e.key));break;case`item`:o.push(e);return}for(let t of e.childNodes)c(t)};for(let t of e)c(t);let l=Vt(s,a);if(l.forEach((e,t)=>o.splice(t,0,e)),super({columnCount:a.length,items:o,visitNode:e=>(e.column=a[e.index],e)}),this._size=0,this.columns=a,this.rowHeaderColumnKeys=r,this.body=i,this.headerRows=l,this._size=[...i.childNodes].length,this.rowHeaderColumnKeys.size===0){let e=this.columns.find(e=>!e.props?.isDragButtonCell&&!e.props?.isSelectionCell);e&&this.rowHeaderColumnKeys.add(e.key)}}*[Symbol.iterator](){yield*this.body.childNodes}get size(){return this._size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){return this.keyMap.get(e)?.prevKey??null}getKeyAfter(e){return this.keyMap.get(e)?.nextKey??null}getFirstKey(){return K(this.body.childNodes)?.key??null}getLastKey(){return q(this.body.childNodes)?.key??null}getItem(e){return e===this.body.key?this.body:this.keyMap.get(e)??null}at(e){let t=[...this.getKeys()];return this.getItem(t[e])}getChildren(e){if(e===this.body.key)return this.body.childNodes;let t=this.getItem(e);return t?.type===`item`?[...t.childNodes].filter(e=>e.type===`cell`):super.getChildren(e)}getTextValue(e){let t=this.getItem(e);if(!t)return``;if(t.textValue)return t.textValue;let n=this.rowHeaderColumnKeys;if(n){let e=[];for(let r of t.childNodes){let t=this.columns[r.index];if(n.has(t.key)&&r.textValue&&e.push(r.textValue),e.length===n.size)break}return e.join(` `)}return``}};function Ut(e){return e!=null&&(!isNaN(e)||String(e).match(/^(\d+)(?=%$)/)!==null)}function Wt(e){if(!e||typeof e==`number`)return 1;let t=e.match(/^(.+)(?=fr$)/);return t?parseFloat(t[0]):1}function Gt(e,t){if(typeof e==`string`){let n=e.match(/^(\d+)(?=%$)/);if(!n)throw Error(`Only percentages or numbers are supported for static column widths`);return t*(parseFloat(n[0])/100)}return e}function Kt(e,t){return e==null?2**53-1:Gt(e,t)}function qt(e,t){return e==null?0:Gt(e,t)}function Jt(e,t,n,r,i){let a=e,o=Math.floor(e),s=e-o>0;e=o;let c=!1,l=t.map((t,a)=>{let o=n.get(t.key)==null?t.width??t.defaultWidth??r?.(a)??`1fr`:n.get(t.key)??`1fr`,s=!1,l=0,u=0,d=0;Ut(o)?(l=Gt(o,e),s=!0):(u=Wt(o),u<=0&&(s=!0));let f=qt(t.minWidth??i?.(a)??0,e),p=Kt(t.maxWidth,e),m=Math.max(f,Math.min(l,p));return s?d=m:l>m&&(s=!0,d=m),s||(c=!0),{frozen:s,baseSize:l,hypotheticalMainSize:m,min:f,max:p,flex:u,targetMainSize:d,violation:0}});for(;c;){let t=0,n=0;l.forEach(e=>{e.frozen?t+=e.targetMainSize:(t+=e.baseSize,n+=e.flex)});let r=e-t;r>0&&l.forEach(e=>{if(!e.frozen){let t=e.flex/n;e.targetMainSize=e.baseSize+t*r}});let i=0;l.forEach(e=>{if(e.violation=0,!e.frozen){let{min:t,max:n,targetMainSize:r}=e;e.targetMainSize=Math.max(t,Math.min(r,n)),e.violation=e.targetMainSize-r,i+=e.violation}}),c=!1,l.forEach(e=>{i===0||Math.sign(i)===Math.sign(e.violation)?e.frozen=!0:e.frozen||(c=!0)})}let u=Yt(l);if(s&&u.length>0){let e=a.toString().split(`.`)[1],t=u[u.length-1].toString();u[u.length-1]=Number(t+`.`+e)}return u}function Yt(e){let t=0,n=0,r=[];return e.forEach(function(e){let i=e.targetMainSize,a=Math.round(i+t)-n;t+=i,n+=a,r.push(a)}),r}var Xt=class{constructor(e){this.columnWidths=new Map,this.columnMinWidths=new Map,this.columnMaxWidths=new Map,this.getDefaultWidth=e?.getDefaultWidth??(()=>`1fr`),this.getDefaultMinWidth=e?.getDefaultMinWidth??(()=>75)}splitColumnsIntoControlledAndUncontrolled(e){return e.reduce((e,t)=>(t.props.width==null?e[1].set(t.key,t):e[0].set(t.key,t),e),[new Map,new Map])}recombineColumns(e,t,n,r){return new Map(e.map(e=>n.has(e.key)?[e.key,t.get(e.key)]:[e.key,r.get(e.key).props.width]))}getInitialUncontrolledWidths(e){return new Map(Array.from(e).map(([e,t])=>[e,t.props.defaultWidth??this.getDefaultWidth?.(t)??`1fr`]))}getColumnWidth(e){return this.columnWidths.get(e)??0}getColumnMinWidth(e){return this.columnMinWidths.get(e)??0}getColumnMaxWidth(e){return this.columnMaxWidths.get(e)??0}resizeColumnWidth(e,t,n,r){let i=this.columnWidths,a=!0,o=new Map;return r=Math.max(this.getColumnMinWidth(n),Math.min(this.getColumnMaxWidth(n),Math.floor(r))),e.columns.forEach(e=>{e.key===n?(o.set(e.key,r),a=!1):a?o.set(e.key,i.get(e.key)??0):o.set(e.key,e.props.width??t.get(e.key))}),o}buildColumnWidths(e,t,n){return this.columnWidths=new Map,this.columnMinWidths=new Map,this.columnMaxWidths=new Map,Jt(e,t.columns.map(e=>({...e.props,key:e.key})),n,e=>this.getDefaultWidth(t.columns[e]),e=>this.getDefaultMinWidth(t.columns[e])).forEach((n,r)=>{let i=t.columns[r].key,a=t.columns[r];this.columnWidths.set(i,n),this.columnMinWidths.set(i,qt(a.props.minWidth??this.getDefaultMinWidth(a),e)),this.columnMaxWidths.set(i,Kt(a.props.maxWidth,e))}),this.columnWidths}};function Zt(e,t){let{getDefaultWidth:n,getDefaultMinWidth:r,tableWidth:i=0}=e,[a,o]=(0,Y.useState)(null),s=(0,Y.useMemo)(()=>new Xt({getDefaultWidth:n,getDefaultMinWidth:r}),[n,r]),[c,l]=(0,Y.useMemo)(()=>s.splitColumnsIntoControlledAndUncontrolled(t.collection.columns),[t.collection.columns,s]),[u,d]=(0,Y.useState)(()=>s.getInitialUncontrolledWidths(l)),[f,p]=(0,Y.useState)(t.collection.columns);t.collection.columns!==f&&((t.collection.columns.length!==f.length||t.collection.columns.some((e,t)=>e.key!==f[t].key))&&d(s.getInitialUncontrolledWidths(l)),p(t.collection.columns));let m=(0,Y.useMemo)(()=>s.recombineColumns(t.collection.columns,u,l,c),[t.collection.columns,u,l,c,s]),h=(0,Y.useCallback)(e=>{o(e)},[o]),g=(0,Y.useCallback)((e,n)=>{let r=s.resizeColumnWidth(t.collection,u,e,n),i=new Map(Array.from(l).map(([e])=>[e,r.get(e)]));return i.set(e,n),d(i),r},[l,d,s,t.collection,u]),_=(0,Y.useCallback)(()=>{o(null)},[o]),v=(0,Y.useMemo)(()=>s.buildColumnWidths(i,t.collection,m),[i,t.collection,m,s]);return(0,Y.useMemo)(()=>({resizingColumn:a,updateResizedColumns:g,startResize:h,endResize:_,getColumnWidth:e=>s.getColumnWidth(e),getColumnMinWidth:e=>s.getColumnMinWidth(e),getColumnMaxWidth:e=>s.getColumnMaxWidth(e),tableState:t,columnWidths:v}),[s,v,a,g,h,_,t])}function Qt(e){let{collection:t,focusMode:n}=e,r=e.UNSAFE_selectionState||Fe(e),i=(0,Y.useMemo)(()=>e.disabledKeys?new Set(e.disabledKeys):new Set,[e.disabledKeys]),a=r.setFocusedKey;r.setFocusedKey=(e,r)=>{if(n===`cell`&&e!=null){let n=t.getItem(e);if(n?.type===`item`){let i=J(n,t);e=r===`last`?q(i)?.key??null:K(i)?.key??null}}a(e,r)};let o=(0,Y.useMemo)(()=>new je(t,r),[t,r]),s=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{if(r.focusedKey!=null&&s.current&&!t.getItem(r.focusedKey)){let e=s.current.getItem(r.focusedKey),n=e?.parentKey!=null&&(e.type===`cell`||e.type===`rowheader`||e.type===`column`)?s.current.getItem(e.parentKey):e;if(!n){r.setFocusedKey(null);return}let i=s.current.rows,a=t.rows,c=i.length-a.length,l=Math.min(c>1?Math.max(n.index-c+1,0):n.index,a.length-1),u=null;for(let e=Math.max(0,l);e=0;e--)if(!o.isDisabled(a[e].key)&&a[e].type!==`headerrow`){u=a[e];break}}if(u){let i=u.hasChildNodes?[...J(u,t)]:[],a=u.hasChildNodes&&n!==e&&e&&e.index({showSelectionCheckboxes:i&&r!==`none`,showDragButtons:a,selectionMode:r,columns:[]}),[e.children,i,r,a]),c=Ne(e,(0,Y.useCallback)(e=>new Ht(e,null,s),[s]),s),{disabledKeys:l,selectionManager:u}=Qt({...e,collection:c,disabledBehavior:e.disabledBehavior||`selection`}),[d,f]=de(e.expandedKeys?new Set(e.expandedKeys):void 0,e.defaultExpandedKeys?new Set(e.defaultExpandedKeys):new Set,e.onExpandedChange);return{collection:c,disabledKeys:l,selectionManager:u,showSelectionCheckboxes:e.showSelectionCheckboxes||!1,sortDescriptor:e.sortDescriptor??null,isKeyboardNavigationDisabled:c.size===0||t,setKeyboardNavigationDisabled:n,sort(t,n){e.onSortChange?.({column:t,direction:n??(e.sortDescriptor?.column===t?$t[e.sortDescriptor.direction]:`ascending`)})},expandedKeys:d,toggleKey(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},treeColumn:o}}function tn(e,t){let n=(0,Y.useMemo)(()=>t?e.collection.filter(t):e.collection,[e.collection,t]),r=e.selectionManager.withCollection(n);return{...e,collection:n,selectionManager:r}}var nn=class{constructor(e){if(this.collection=e.collection,this.disabledKeys=e.disabledKeys,this.disabledBehavior=e.disabledBehavior||`all`,this.direction=e.direction,this.collator=e.collator,!e.layout&&!e.ref)throw Error(`Either a layout or a ref must be specified.`);this.layoutDelegate=e.layoutDelegate||(e.layout?new rn(e.layout):new Re(e.ref)),this.focusMode=e.focusMode??`row`}isCell(e){return e.type===`cell`}isRow(e){return e.type===`row`||e.type===`item`}isDisabled(e){return this.disabledBehavior===`all`&&(e.props?.isDisabled||this.disabledKeys.has(e.key))&&e.props?.disabledBehavior!==`selection`}findPreviousKey(e,t,n=!1){let r=e==null?this.collection.getLastKey():this.collection.getKeyBefore(e);for(;r!=null;){let e=this.collection.getItem(r);if(!e)return null;if((n||!this.isDisabled(e))&&(!t||t(e)))return r;r=this.collection.getKeyBefore(r)}return null}findNextKey(e,t,n=!1){let r=e==null?this.collection.getFirstKey():this.collection.getKeyAfter(e);for(;r!=null;){let e=this.collection.getItem(r);if(!e)return null;if((n||!this.isDisabled(e))&&(!t||t(e)))return r;if(r=this.collection.getKeyAfter(r),r==null)return null}return null}getKeyForItemInRowByIndex(e,t=0){if(t<0)return null;let n=this.collection.getItem(e);if(!n)return null;let r=0;for(let e of J(n,this.collection)){if(e.colSpan&&e.colSpan+r>t||(e.colSpan&&(r=r+e.colSpan-1),r===t))return e.key??null;r++}return null}getKeyBelow(e,t){let n=e,r=this.collection.getItem(n);if(!r||(this.isCell(r)&&(n=r.parentKey??null),n==null))return null;if(n=this.findNextKey(n,e=>e.type===`item`,t?.includeDisabled),n!=null){if(this.isCell(r)){let e=r.colIndex?r.colIndex:r.index;return this.getKeyForItemInRowByIndex(n,e)}if(this.focusMode===`row`)return n}return null}getKeyAbove(e,t){let n=e,r=this.collection.getItem(n);if(!r||(this.isCell(r)&&(n=r.parentKey??null),n==null))return null;if(n=this.findPreviousKey(n,e=>e.type===`item`,t?.includeDisabled),n!=null){if(this.isCell(r)){let e=r.colIndex?r.colIndex:r.index;return this.getKeyForItemInRowByIndex(n,e)}if(this.focusMode===`row`)return n}return null}getKeyRightOf(e){let t=this.collection.getItem(e);if(!t)return null;if(this.isRow(t)){let e=J(t,this.collection);return(this.direction===`rtl`?q(e)?.key:K(e)?.key)??null}if(this.isCell(t)&&t.parentKey!=null){let n=this.collection.getItem(t.parentKey);if(!n)return null;let r=J(n,this.collection),i=(this.direction===`rtl`?Be(r,t.index-1):Be(r,t.index+1))??null;return i?i.key??null:this.focusMode===`row`?t.parentKey??null:(this.direction===`rtl`?this.getFirstKey(e):this.getLastKey(e))??null}return null}getKeyLeftOf(e){let t=this.collection.getItem(e);if(!t)return null;if(this.isRow(t)){let e=J(t,this.collection);return(this.direction===`rtl`?K(e)?.key:q(e)?.key)??null}if(this.isCell(t)&&t.parentKey!=null){let n=this.collection.getItem(t.parentKey);if(!n)return null;let r=J(n,this.collection),i=(this.direction===`rtl`?Be(r,t.index+1):Be(r,t.index-1))??null;return i?i.key??null:this.focusMode===`row`?t.parentKey??null:(this.direction===`rtl`?this.getLastKey(e):this.getFirstKey(e))??null}return null}getFirstKey(e,t){let n=e??null,r;if(n!=null){if(r=this.collection.getItem(n),!r)return null;if(this.isCell(r)&&!t&&r.parentKey!=null){let e=this.collection.getItem(r.parentKey);return e?K(J(e,this.collection))?.key??null:null}}if(n=this.findNextKey(void 0,e=>e.type===`item`),n!=null&&(r&&this.isCell(r)&&t||this.focusMode===`cell`)){let e=this.collection.getItem(n);if(!e)return null;n=K(J(e,this.collection))?.key??null}return n}getLastKey(e,t){let n=e??null,r;if(n!=null){if(r=this.collection.getItem(n),!r)return null;if(this.isCell(r)&&!t&&r.parentKey!=null){let e=this.collection.getItem(r.parentKey);if(!e)return null;let t=J(e,this.collection);return q(t)?.key??null}}if(n=this.findPreviousKey(void 0,e=>e.type===`item`),n!=null&&(r&&this.isCell(r)&&t||this.focusMode===`cell`)){let e=this.collection.getItem(n);if(!e)return null;let t=J(e,this.collection);n=q(t)?.key??null}return n}getKeyPageAbove(e){let t=e,n=this.layoutDelegate.getItemRect(t);if(!n)return null;let r=Math.max(0,n.y+n.height-this.layoutDelegate.getVisibleRect().height);for(;n&&n.y>r&&t!=null&&(t=this.getKeyAbove(t)??null,t!=null);)n=this.layoutDelegate.getItemRect(t);return t}getKeyPageBelow(e){let t=e,n=this.layoutDelegate.getItemRect(t);if(!n)return null;let r=this.layoutDelegate.getVisibleRect().height,i=Math.min(this.layoutDelegate.getContentSize().height,n.y+r);for(;n&&n.y+n.heighte.type===`item`),n==null&&!a&&(n=this.getFirstKey(),a=!0)}return null}},rn=class{constructor(e){this.layout=e}getContentSize(){return this.layout.getContentSize()}getItemRect(e){return this.layout.getLayoutInfo(e)?.rect||null}getVisibleRect(){return this.layout.virtualizer.visibleRect}},an=new WeakMap;function on(e,t,n){let{isVirtualized:r,disallowTypeAhead:i,keyboardDelegate:a,focusMode:o,scrollRef:s,getRowText:c,onRowAction:l,onCellAction:u,escapeKeyBehavior:d=`clearSelection`,shouldSelectOnPressUp:f,keyboardNavigationBehavior:p=`arrow`}=e,{selectionManager:m}=t;!e[`aria-label`]&&!e[`aria-labelledby`]&&console.warn(`An aria-label or aria-labelledby prop is required for accessibility.`);let h=Ve({usage:`search`,sensitivity:`base`}),{direction:g}=z(),_=t.selectionManager.disabledBehavior,v=(0,Y.useMemo)(()=>a||new nn({collection:t.collection,disabledKeys:t.disabledKeys,disabledBehavior:_,ref:n,direction:g,collator:h,focusMode:o}),[a,t.collection,t.disabledKeys,_,n,g,h,o]),{collectionProps:y}=He({ref:n,selectionManager:m,keyboardDelegate:v,isVirtualized:r,scrollRef:s,disallowTypeAhead:i,escapeKeyBehavior:d}),b=fe(e.id);an.set(t,{keyboardDelegate:v,actions:{onRowAction:l,onCellAction:u},shouldSelectOnPressUp:f,keyboardNavigationBehavior:p});let x=Mt({selectionManager:m,hasItemActions:!!(l||u)}),S=B(e,{labelable:!0}),C=(0,Y.useCallback)(e=>{if(m.isFocused){F(e.currentTarget,H(e))||m.setFocused(!1);return}F(e.currentTarget,H(e))&&m.setFocused(!0)},[m]),w=(0,Y.useMemo)(()=>({onBlur:y.onBlur,onFocus:C}),[C,y.onBlur]),T=Ae(n,{isDisabled:t.collection.size!==0}),E=k(S,{role:`grid`,id:b,"aria-multiselectable":m.selectionMode===`multiple`?`true`:void 0},t.isKeyboardNavigationDisabled?w:y,t.collection.size===0&&{tabIndex:T?-1:0}||void 0,x);return r&&(E[`aria-rowcount`]=t.collection.size,E[`aria-colcount`]=t.collection.columnCount),kt({getRowText:c},t),{gridProps:E}}var sn=new WeakMap;function cn(e){return typeof e==`string`?e.replace(/\s*/g,``):``+e}function ln(e,t){let n=sn.get(e);if(!n)throw Error(`Unknown grid`);return`${n}-${cn(t)}`}function un(e,t,n){let r=sn.get(e);if(!r)throw Error(`Unknown grid`);return`${r}-${cn(t)}-${cn(n)}`}function dn(e,t){return[...e.collection.rowHeaderColumnKeys].map(n=>un(e,t,n)).join(` `)}var fn={};fn={ascending:`تصاعدي`,ascendingSort:e=>`\u{62A}\u{631}\u{62A}\u{64A}\u{628} \u{62D}\u{633}\u{628} \u{627}\u{644}\u{639}\u{645}\u{648}\u{62F} ${e.columnName} \u{628}\u{62A}\u{631}\u{62A}\u{64A}\u{628} \u{62A}\u{635}\u{627}\u{639}\u{62F}\u{64A}`,collapse:`طي`,columnSize:e=>`${e.value} \u{628}\u{627}\u{644}\u{628}\u{643}\u{633}\u{644}`,descending:`تنازلي`,descendingSort:e=>`\u{62A}\u{631}\u{62A}\u{64A}\u{628} \u{62D}\u{633}\u{628} \u{627}\u{644}\u{639}\u{645}\u{648}\u{62F} ${e.columnName} \u{628}\u{62A}\u{631}\u{62A}\u{64A}\u{628} \u{62A}\u{646}\u{627}\u{632}\u{644}\u{64A}`,expand:`تمديد`,resizerDescription:`اضغط على مفتاح Enter لبدء تغيير الحجم`,select:`تحديد`,selectAll:`تحديد الكل`,sortable:`عمود قابل للترتيب`};var pn={};pn={ascending:`възходящ`,ascendingSort:e=>`\u{441}\u{43E}\u{440}\u{442}\u{438}\u{440}\u{430}\u{43D}\u{43E} \u{43F}\u{43E} \u{43A}\u{43E}\u{43B}\u{43E}\u{43D}\u{430} ${e.columnName} \u{432}\u{44A}\u{432} \u{432}\u{44A}\u{437}\u{445}\u{43E}\u{434}\u{44F}\u{449} \u{440}\u{435}\u{434}`,collapse:`Свиване`,columnSize:e=>`${e.value} \u{43F}\u{438}\u{43A}\u{441}\u{435}\u{43B}\u{430}`,descending:`низходящ`,descendingSort:e=>`\u{441}\u{43E}\u{440}\u{442}\u{438}\u{440}\u{430}\u{43D}\u{43E} \u{43F}\u{43E} \u{43A}\u{43E}\u{43B}\u{43E}\u{43D}\u{430} ${e.columnName} \u{432} \u{43D}\u{438}\u{437}\u{445}\u{43E}\u{434}\u{44F}\u{449} \u{440}\u{435}\u{434}`,expand:`Разширяване`,resizerDescription:`Натиснете „Enter“, за да започнете да преоразмерявате`,select:`Изберете`,selectAll:`Изберете всичко`,sortable:`сортираща колона`};var mn={};mn={ascending:`vzestupně`,ascendingSort:e=>`\u{159}azeno vzestupn\u{11B} podle sloupce ${e.columnName}`,collapse:`Sbalit`,columnSize:e=>`${e.value} pixel\u{16F}`,descending:`sestupně`,descendingSort:e=>`\u{159}azeno sestupn\u{11B} podle sloupce ${e.columnName}`,expand:`Roztáhnout`,resizerDescription:`Stisknutím klávesy Enter začnete měnit velikost`,select:`Vybrat`,selectAll:`Vybrat vše`,sortable:`sloupec s možností řazení`};var hn={};hn={ascending:`stigende`,ascendingSort:e=>`sorteret efter kolonne ${e.columnName} i stigende r\xe6kkef\xf8lge`,collapse:`Skjul`,columnSize:e=>`${e.value} pixels`,descending:`faldende`,descendingSort:e=>`sorteret efter kolonne ${e.columnName} i faldende r\xe6kkef\xf8lge`,expand:`Udvid`,resizerDescription:`Tryk på Enter for at ændre størrelse`,select:`Vælg`,selectAll:`Vælg alle`,sortable:`sorterbar kolonne`};var gn={};gn={ascending:`aufsteigend`,ascendingSort:e=>`sortiert nach Spalte ${e.columnName} in aufsteigender Reihenfolge`,collapse:`Reduzieren`,columnSize:e=>`${e.value} Pixel`,descending:`absteigend`,descendingSort:e=>`sortiert nach Spalte ${e.columnName} in absteigender Reihenfolge`,expand:`Erweitern`,resizerDescription:`Eingabetaste zum Starten der Größenänderung drücken`,select:`Auswählen`,selectAll:`Alles auswählen`,sortable:`sortierbare Spalte`};var _n={};_n={ascending:`αύξουσα`,ascendingSort:e=>`\u{3B4}\u{3B9}\u{3B1}\u{3BB}\u{3BF}\u{3B3}\u{3AE} \u{3B1}\u{3BD}\u{3AC} \u{3C3}\u{3C4}\u{3AE}\u{3BB}\u{3B7} ${e.columnName} \u{3C3}\u{3B5} \u{3B1}\u{3CD}\u{3BE}\u{3BF}\u{3C5}\u{3C3}\u{3B1} \u{3C3}\u{3B5}\u{3B9}\u{3C1}\u{3AC}`,collapse:`Σύμπτυξη`,columnSize:e=>`${e.value} pixel`,descending:`φθίνουσα`,descendingSort:e=>`\u{3B4}\u{3B9}\u{3B1}\u{3BB}\u{3BF}\u{3B3}\u{3AE} \u{3B1}\u{3BD}\u{3AC} \u{3C3}\u{3C4}\u{3AE}\u{3BB}\u{3B7} ${e.columnName} \u{3C3}\u{3B5} \u{3C6}\u{3B8}\u{3AF}\u{3BD}\u{3BF}\u{3C5}\u{3C3}\u{3B1} \u{3C3}\u{3B5}\u{3B9}\u{3C1}\u{3AC}`,expand:`Ανάπτυξη`,resizerDescription:`Πατήστε Enter για έναρξη της αλλαγής μεγέθους`,select:`Επιλογή`,selectAll:`Επιλογή όλων`,sortable:`Στήλη διαλογής`};var vn={};vn={select:`Select`,selectAll:`Select All`,sortable:`sortable column`,ascending:`ascending`,descending:`descending`,ascendingSort:e=>`sorted by column ${e.columnName} in ascending order`,descendingSort:e=>`sorted by column ${e.columnName} in descending order`,columnSize:e=>`${e.value} pixels`,resizerDescription:`Press Enter to start resizing`,expand:`Expand`,collapse:`Collapse`};var yn={};yn={ascending:`ascendente`,ascendingSort:e=>`ordenado por columna ${e.columnName} en sentido ascendente`,collapse:`Contraer`,columnSize:e=>`${e.value} p\xedxeles`,descending:`descendente`,descendingSort:e=>`ordenado por columna ${e.columnName} en orden descendente`,expand:`Ampliar`,resizerDescription:`Pulse Intro para empezar a redimensionar`,select:`Seleccionar`,selectAll:`Seleccionar todos`,sortable:`columna ordenable`};var bn={};bn={ascending:`tõusev järjestus`,ascendingSort:e=>`sorditud veeru j\xe4rgi ${e.columnName} t\xf5usvas j\xe4rjestuses`,collapse:`Ahenda`,columnSize:e=>`${e.value} pikslit`,descending:`laskuv järjestus`,descendingSort:e=>`sorditud veeru j\xe4rgi ${e.columnName} laskuvas j\xe4rjestuses`,expand:`Laienda`,resizerDescription:`Suuruse muutmise alustamiseks vajutage klahvi Enter`,select:`Vali`,selectAll:`Vali kõik`,sortable:`sorditav veerg`};var xn={};xn={ascending:`nouseva`,ascendingSort:e=>`lajiteltu sarakkeen ${e.columnName} mukaan nousevassa j\xe4rjestyksess\xe4`,collapse:`Pienennä`,columnSize:e=>`${e.value} pikseli\xe4`,descending:`laskeva`,descendingSort:e=>`lajiteltu sarakkeen ${e.columnName} mukaan laskevassa j\xe4rjestyksess\xe4`,expand:`Laajenna`,resizerDescription:`Aloita koon muutos painamalla Enter-näppäintä`,select:`Valitse`,selectAll:`Valitse kaikki`,sortable:`lajiteltava sarake`};var Sn={};Sn={ascending:`croissant`,ascendingSort:e=>`tri\xe9 en fonction de la colonne\xa0${e.columnName} par ordre croissant`,collapse:`Réduire`,columnSize:e=>`${e.value}\xa0pixels`,descending:`décroissant`,descendingSort:e=>`tri\xe9 en fonction de la colonne\xa0${e.columnName} par ordre d\xe9croissant`,expand:`Développer`,resizerDescription:`Appuyez sur Entrée pour commencer le redimensionnement.`,select:`Sélectionner`,selectAll:`Sélectionner tout`,sortable:`colonne triable`};var Cn={};Cn={ascending:`עולה`,ascendingSort:e=>`\u{5DE}\u{5D5}\u{5D9}\u{5DF} \u{5DC}\u{5E4}\u{5D9} \u{5E2}\u{5DE}\u{5D5}\u{5D3}\u{5D4} ${e.columnName} \u{5D1}\u{5E1}\u{5D3}\u{5E8} \u{5E2}\u{5D5}\u{5DC}\u{5D4}`,collapse:`כווץ`,columnSize:e=>`${e.value} \u{5E4}\u{5D9}\u{5E7}\u{5E1}\u{5DC}\u{5D9}\u{5DD}`,descending:`יורד`,descendingSort:e=>`\u{5DE}\u{5D5}\u{5D9}\u{5DF} \u{5DC}\u{5E4}\u{5D9} \u{5E2}\u{5DE}\u{5D5}\u{5D3}\u{5D4} ${e.columnName} \u{5D1}\u{5E1}\u{5D3}\u{5E8} \u{5D9}\u{5D5}\u{5E8}\u{5D3}`,expand:`הרחב`,resizerDescription:`הקש Enter כדי לשנות את הגודל`,select:`בחר`,selectAll:`בחר הכול`,sortable:`עמודה שניתן למיין`};var wn={};wn={ascending:`rastući`,ascendingSort:e=>`razvrstano po stupcima ${e.columnName} rastu\u{107}em redoslijedom`,collapse:`Sažmi`,columnSize:e=>`${e.value} piksela`,descending:`padajući`,descendingSort:e=>`razvrstano po stupcima ${e.columnName} padaju\u{107}im redoslijedom`,expand:`Proširi`,resizerDescription:`Pritisnite Enter da biste započeli promenu veličine`,select:`Odaberite`,selectAll:`Odaberite sve`,sortable:`stupac koji se može razvrstati`};var Tn={};Tn={ascending:`növekvő`,ascendingSort:e=>`rendezve a(z) ${e.columnName} oszlop szerint, n\xf6vekv\u{151} sorrendben`,collapse:`Összecsukás`,columnSize:e=>`${e.value} k\xe9ppont`,descending:`csökkenő`,descendingSort:e=>`rendezve a(z) ${e.columnName} oszlop szerint, cs\xf6kken\u{151} sorrendben`,expand:`Kibontás`,resizerDescription:`Nyomja le az Enter billentyűt az átméretezés megkezdéséhez`,select:`Kijelölés`,selectAll:`Összes kijelölése`,sortable:`rendezendő oszlop`};var En={};En={ascending:`crescente`,ascendingSort:e=>`in ordine crescente in base alla colonna ${e.columnName}`,collapse:`Comprimi`,columnSize:e=>`${e.value} pixel`,descending:`decrescente`,descendingSort:e=>`in ordine decrescente in base alla colonna ${e.columnName}`,expand:`Espandi`,resizerDescription:`Premi Invio per iniziare a ridimensionare`,select:`Seleziona`,selectAll:`Seleziona tutto`,sortable:`colonna ordinabile`};var Dn={};Dn={ascending:`昇順`,ascendingSort:e=>`\u{5217} ${e.columnName} \u{3092}\u{6607}\u{9806}\u{3067}\u{4E26}\u{3079}\u{66FF}\u{3048}`,collapse:`折りたたむ`,columnSize:e=>`${e.value} \u{30D4}\u{30AF}\u{30BB}\u{30EB}`,descending:`降順`,descendingSort:e=>`\u{5217} ${e.columnName} \u{3092}\u{964D}\u{9806}\u{3067}\u{4E26}\u{3079}\u{66FF}\u{3048}`,expand:`展開`,resizerDescription:`Enter キーを押してサイズ変更を開始`,select:`選択`,selectAll:`すべて選択`,sortable:`並べ替え可能な列`};var On={};On={ascending:`오름차순`,ascendingSort:e=>`${e.columnName} \u{C5F4}\u{C744} \u{AE30}\u{C900}\u{C73C}\u{B85C} \u{C624}\u{B984}\u{CC28}\u{C21C}\u{C73C}\u{B85C} \u{C815}\u{B82C}\u{B428}`,collapse:`접기`,columnSize:e=>`${e.value} \u{D53D}\u{C140}`,descending:`내림차순`,descendingSort:e=>`${e.columnName} \u{C5F4}\u{C744} \u{AE30}\u{C900}\u{C73C}\u{B85C} \u{B0B4}\u{B9BC}\u{CC28}\u{C21C}\u{C73C}\u{B85C} \u{C815}\u{B82C}\u{B428}`,expand:`펼치기`,resizerDescription:`크기 조정을 시작하려면 Enter를 누르세요.`,select:`선택`,selectAll:`모두 선택`,sortable:`정렬 가능한 열`};var kn={};kn={ascending:`didėjančia tvarka`,ascendingSort:e=>`surikiuota pagal stulpel\u{12F} ${e.columnName} did\u{117}jan\u{10D}ia tvarka`,collapse:`Sutraukti`,columnSize:e=>`${e.value} piks.`,descending:`mažėjančia tvarka`,descendingSort:e=>`surikiuota pagal stulpel\u{12F} ${e.columnName} ma\u{17E}\u{117}jan\u{10D}ia tvarka`,expand:`Išskleisti`,resizerDescription:`Paspauskite „Enter“, kad pradėtumėte keisti dydį`,select:`Pasirinkti`,selectAll:`Pasirinkti viską`,sortable:`rikiuojamas stulpelis`};var An={};An={ascending:`augošā secībā`,ascendingSort:e=>`k\u{101}rtots p\u{113}c kolonnas ${e.columnName} augo\u{161}\u{101} sec\u{12B}b\u{101}`,collapse:`Sakļaut`,columnSize:e=>`${e.value} pikse\u{13C}i`,descending:`dilstošā secībā`,descendingSort:e=>`k\u{101}rtots p\u{113}c kolonnas ${e.columnName} dilsto\u{161}\u{101} sec\u{12B}b\u{101}`,expand:`Izvērst`,resizerDescription:`Nospiediet Enter, lai sāktu izmēru mainīšanu`,select:`Atlasīt`,selectAll:`Atlasīt visu`,sortable:`kārtojamā kolonna`};var jn={};jn={ascending:`stigende`,ascendingSort:e=>`sortert etter kolonne ${e.columnName} i stigende rekkef\xf8lge`,collapse:`Skjul`,columnSize:e=>`${e.value} piksler`,descending:`synkende`,descendingSort:e=>`sortert etter kolonne ${e.columnName} i synkende rekkef\xf8lge`,expand:`Utvid`,resizerDescription:`Trykk på Enter for å starte størrelsesendring`,select:`Velg`,selectAll:`Velg alle`,sortable:`kolonne som kan sorteres`};var Mn={};Mn={ascending:`oplopend`,ascendingSort:e=>`gesorteerd in oplopende volgorde in kolom ${e.columnName}`,collapse:`Samenvouwen`,columnSize:e=>`${e.value} pixels`,descending:`aflopend`,descendingSort:e=>`gesorteerd in aflopende volgorde in kolom ${e.columnName}`,expand:`Uitvouwen`,resizerDescription:`Druk op Enter om het formaat te wijzigen`,select:`Selecteren`,selectAll:`Alles selecteren`,sortable:`sorteerbare kolom`};var Nn={};Nn={ascending:`rosnąco`,ascendingSort:e=>`posortowano wed\u{142}ug kolumny ${e.columnName} w porz\u{105}dku rosn\u{105}cym`,collapse:`Zwiń`,columnSize:e=>`Liczba pikseli: ${e.value}`,descending:`malejąco`,descendingSort:e=>`posortowano wed\u{142}ug kolumny ${e.columnName} w porz\u{105}dku malej\u{105}cym`,expand:`Rozwiń`,resizerDescription:`Naciśnij Enter, aby rozpocząć zmienianie rozmiaru`,select:`Zaznacz`,selectAll:`Zaznacz wszystko`,sortable:`kolumna z możliwością sortowania`};var Pn={};Pn={ascending:`crescente`,ascendingSort:e=>`classificado pela coluna ${e.columnName} em ordem crescente`,collapse:`Recolher`,columnSize:e=>`${e.value} pixels`,descending:`decrescente`,descendingSort:e=>`classificado pela coluna ${e.columnName} em ordem decrescente`,expand:`Expandir`,resizerDescription:`Pressione Enter para começar a redimensionar`,select:`Selecionar`,selectAll:`Selecionar tudo`,sortable:`coluna classificável`};var Fn={};Fn={ascending:`ascendente`,ascendingSort:e=>`Ordenar por coluna ${e.columnName} em ordem ascendente`,collapse:`Colapsar`,columnSize:e=>`${e.value} pixels`,descending:`descendente`,descendingSort:e=>`Ordenar por coluna ${e.columnName} em ordem descendente`,expand:`Expandir`,resizerDescription:`Prima Enter para iniciar o redimensionamento`,select:`Selecionar`,selectAll:`Selecionar tudo`,sortable:`Coluna ordenável`};var In={};In={ascending:`crescătoare`,ascendingSort:e=>`sortate dup\u{103} coloana ${e.columnName} \xeen ordine cresc\u{103}toare`,collapse:`Restrângeți`,columnSize:e=>`${e.value} pixeli`,descending:`descrescătoare`,descendingSort:e=>`sortate dup\u{103} coloana ${e.columnName} \xeen ordine descresc\u{103}toare`,expand:`Extindeți`,resizerDescription:`Apăsați pe Enter pentru a începe redimensionarea`,select:`Selectare`,selectAll:`Selectare totală`,sortable:`coloană sortabilă`};var Ln={};Ln={ascending:`возрастание`,ascendingSort:e=>`\u{441}\u{43E}\u{440}\u{442}\u{438}\u{440}\u{43E}\u{432}\u{430}\u{442}\u{44C} \u{441}\u{442}\u{43E}\u{43B}\u{431}\u{435}\u{446} ${e.columnName} \u{432} \u{43F}\u{43E}\u{440}\u{44F}\u{434}\u{43A}\u{435} \u{432}\u{43E}\u{437}\u{440}\u{430}\u{441}\u{442}\u{430}\u{43D}\u{438}\u{44F}`,collapse:`Свернуть`,columnSize:e=>`${e.value} \u{43F}\u{438}\u{43A}\u{441}.`,descending:`убывание`,descendingSort:e=>`\u{441}\u{43E}\u{440}\u{442}\u{438}\u{440}\u{43E}\u{432}\u{430}\u{442}\u{44C} \u{441}\u{442}\u{43E}\u{43B}\u{431}\u{435}\u{446} ${e.columnName} \u{432} \u{43F}\u{43E}\u{440}\u{44F}\u{434}\u{43A}\u{435} \u{443}\u{431}\u{44B}\u{432}\u{430}\u{43D}\u{438}\u{44F}`,expand:`Развернуть`,resizerDescription:`Нажмите клавишу Enter для начала изменения размеров`,select:`Выбрать`,selectAll:`Выбрать все`,sortable:`сортируемый столбец`};var Rn={};Rn={ascending:`vzostupne`,ascendingSort:e=>`zoraden\xe9 zostupne pod\u{13E}a st\u{13A}pca ${e.columnName}`,collapse:`Zbaliť`,columnSize:e=>`Po\u{10D}et pixelov: ${e.value}`,descending:`zostupne`,descendingSort:e=>`zoraden\xe9 zostupne pod\u{13E}a st\u{13A}pca ${e.columnName}`,expand:`Rozbaliť`,resizerDescription:`Stlačením klávesu Enter začnete zmenu veľkosti`,select:`Vybrať`,selectAll:`Vybrať všetko`,sortable:`zoraditeľný stĺpec`};var zn={};zn={ascending:`naraščajoče`,ascendingSort:e=>`razvr\u{161}\u{10D}eno po stolpcu ${e.columnName} v nara\u{161}\u{10D}ajo\u{10D}em vrstnem redu`,collapse:`Strni`,columnSize:e=>`${e.value} slikovnih pik`,descending:`padajoče`,descendingSort:e=>`razvr\u{161}\u{10D}eno po stolpcu ${e.columnName} v padajo\u{10D}em vrstnem redu`,expand:`Razširi`,resizerDescription:`Pritisnite tipko Enter da začnete spreminjati velikost`,select:`Izberite`,selectAll:`Izberite vse`,sortable:`razvrstljivi stolpec`};var Bn={};Bn={ascending:`rastući`,ascendingSort:e=>`sortirano po kolonama ${e.columnName} rastu\u{107}im redosledom`,collapse:`Skupi`,columnSize:e=>`${e.value} piksela`,descending:`padajući`,descendingSort:e=>`sortirano po kolonama ${e.columnName} padaju\u{107}im redosledom`,expand:`Proširi`,resizerDescription:`Pritisnite Enter da biste započeli promenu veličine`,select:`Izaberite`,selectAll:`Izaberite sve`,sortable:`kolona koja se može sortirati`};var Vn={};Vn={ascending:`stigande`,ascendingSort:e=>`sorterat p\xe5 kolumn ${e.columnName} i stigande ordning`,collapse:`Dölj`,columnSize:e=>`${e.value} pixlar`,descending:`fallande`,descendingSort:e=>`sorterat p\xe5 kolumn ${e.columnName} i fallande ordning`,expand:`Expandera`,resizerDescription:`Tryck på Retur för att börja ändra storlek`,select:`Markera`,selectAll:`Markera allt`,sortable:`sorterbar kolumn`};var Hn={};Hn={ascending:`artan sırada`,ascendingSort:e=>`${e.columnName} s\xfctuna g\xf6re artan d\xfczende s\u{131}rala`,collapse:`Daralt`,columnSize:e=>`${e.value} piksel`,descending:`azalan sırada`,descendingSort:e=>`${e.columnName} s\xfctuna g\xf6re azalan d\xfczende s\u{131}rala`,expand:`Genişlet`,resizerDescription:`Yeniden boyutlandırmak için Enter'a basın`,select:`Seç`,selectAll:`Tümünü Seç`,sortable:`Sıralanabilir sütun`};var Un={};Un={ascending:`висхідний`,ascendingSort:e=>`\u{432}\u{456}\u{434}\u{441}\u{43E}\u{440}\u{442}\u{43E}\u{432}\u{430}\u{43D}\u{43E} \u{437}\u{430} \u{441}\u{442}\u{43E}\u{432}\u{43F}\u{446}\u{435}\u{43C} ${e.columnName} \u{443} \u{432}\u{438}\u{441}\u{445}\u{456}\u{434}\u{43D}\u{43E}\u{43C}\u{443} \u{43F}\u{43E}\u{440}\u{44F}\u{434}\u{43A}\u{443}`,collapse:`Згорнути`,columnSize:e=>`${e.value} \u{43F}\u{456}\u{43A}\u{441}.`,descending:`низхідний`,descendingSort:e=>`\u{432}\u{456}\u{434}\u{441}\u{43E}\u{440}\u{442}\u{43E}\u{432}\u{430}\u{43D}\u{43E} \u{437}\u{430} \u{441}\u{442}\u{43E}\u{432}\u{43F}\u{446}\u{435}\u{43C} ${e.columnName} \u{443} \u{43D}\u{438}\u{437}\u{445}\u{456}\u{434}\u{43D}\u{43E}\u{43C}\u{443} \u{43F}\u{43E}\u{440}\u{44F}\u{434}\u{43A}\u{443}`,expand:`Розгорнути`,resizerDescription:`Натисніть Enter, щоб почати зміну розміру`,select:`Вибрати`,selectAll:`Вибрати все`,sortable:`сортувальний стовпець`};var Wn={};Wn={ascending:`升序`,ascendingSort:e=>`\u{6309}\u{5217} ${e.columnName} \u{5347}\u{5E8F}\u{6392}\u{5E8F}`,collapse:`折叠`,columnSize:e=>`${e.value} \u{50CF}\u{7D20}`,descending:`降序`,descendingSort:e=>`\u{6309}\u{5217} ${e.columnName} \u{964D}\u{5E8F}\u{6392}\u{5E8F}`,expand:`扩展`,resizerDescription:`按 Enter 开始调整大小。`,select:`选择`,selectAll:`全选`,sortable:`可排序的列`};var Gn={};Gn={ascending:`遞增`,ascendingSort:e=>`\u{5DF2}\u{4F9D}\u{64DA}\u{300C}${e.columnName}\u{300D}\u{6B04}\u{905E}\u{589E}\u{6392}\u{5E8F}`,collapse:`收合`,columnSize:e=>`${e.value} \u{50CF}\u{7D20}`,descending:`遞減`,descendingSort:e=>`\u{5DF2}\u{4F9D}\u{64DA}\u{300C}${e.columnName}\u{300D}\u{6B04}\u{905E}\u{6E1B}\u{6392}\u{5E8F}`,expand:`展開`,resizerDescription:`按 Enter 鍵以開始調整大小`,select:`選取`,selectAll:`全選`,sortable:`可排序的欄`};var X={};X={"ar-AE":fn,"bg-BG":pn,"cs-CZ":mn,"da-DK":hn,"de-DE":gn,"el-GR":_n,"en-US":vn,"es-ES":yn,"et-EE":bn,"fi-FI":xn,"fr-FR":Sn,"he-IL":Cn,"hr-HR":wn,"hu-HU":Tn,"it-IT":En,"ja-JP":Dn,"ko-KR":On,"lt-LT":kn,"lv-LV":An,"nb-NO":jn,"nl-NL":Mn,"pl-PL":Nn,"pt-BR":Pn,"pt-PT":Fn,"ro-RO":In,"ru-RU":Ln,"sk-SK":Rn,"sl-SI":zn,"sr-SP":Bn,"sv-SE":Vn,"tr-TR":Hn,"uk-UA":Un,"zh-CN":Wn,"zh-TW":Gn};var Kn=class extends nn{isCell(e){return e.type===`cell`||e.type===`rowheader`||e.type===`column`}getKeyBelow(e,t){let n=this.collection.getItem(e);if(!n)return null;if(n.type===`column`){let e=K(J(n,this.collection));if(e)return e.key;let t=this.getFirstKey();return t==null||!this.collection.getItem(t)?null:super.getKeyForItemInRowByIndex(t,n.index)}return super.getKeyBelow(e,t)}getKeyAbove(e,t){let n=this.collection.getItem(e);if(!n)return null;if(n.type===`column`){let e=n.parentKey==null?null:this.collection.getItem(n.parentKey);return e&&e.type===`column`?e.key:null}let r=super.getKeyAbove(e,t),i=r==null?null:this.collection.getItem(r);return i&&i.type!==`headerrow`?r:this.isCell(n)?this.collection.columns[n.index].key:this.collection.columns[0].key}findNextColumnKey(e){let t=this.findNextKey(e.key,e=>e.type===`column`);if(t!=null)return t;let n=this.collection.headerRows[e.level];for(let e of J(n,this.collection))if(e.type===`column`)return e.key;return null}findPreviousColumnKey(e){let t=this.findPreviousKey(e.key,e=>e.type===`column`);if(t!=null)return t;let n=this.collection.headerRows[e.level],r=[...J(n,this.collection)];for(let e=r.length-1;e>=0;e--){let t=r[e];if(t.type===`column`)return t.key}return null}getKeyRightOf(e){let t=this.collection.getItem(e);return t?t.type===`column`?this.direction===`rtl`?this.findPreviousColumnKey(t):this.findNextColumnKey(t):super.getKeyRightOf(e):null}getKeyLeftOf(e){let t=this.collection.getItem(e);return t?t.type===`column`?this.direction===`rtl`?this.findNextColumnKey(t):this.findPreviousColumnKey(t):super.getKeyLeftOf(e):null}getKeyForSearch(e,t){if(!this.collator)return null;let n=this.collection,r=t??this.getFirstKey();if(r==null)return null;let i=n.getItem(r);i?.type===`cell`&&(r=i.parentKey??null);let a=!1;for(;r!=null;){let o=n.getItem(r);if(!o)return null;if(o.textValue){let t=o.textValue.slice(0,e.length);if(this.collator.compare(t,e)===0)return o.key}for(let r of J(o,this.collection)){let a=n.columns[r.index];if(n.rowHeaderColumnKeys.has(a.key)&&r.textValue){let a=r.textValue.slice(0,e.length);if(this.collator.compare(a,e)===0)return(t==null?i:n.getItem(t))?.type===`cell`?r.key:o.key}}r=this.getKeyBelow(r),r==null&&!a&&(r=this.getFirstKey(),a=!0)}return null}};function qn(e){return e&&e.__esModule?e.default:e}function Jn(e,t,n){let{keyboardDelegate:r,isVirtualized:i,layoutDelegate:o,layout:s}=e,c=Ve({usage:`search`,sensitivity:`base`}),{direction:l}=z(),u=t.selectionManager.disabledBehavior,d=(0,Y.useMemo)(()=>r||new Kn({collection:t.collection,disabledKeys:t.disabledKeys,disabledBehavior:u,ref:n,direction:l,collator:c,layoutDelegate:o,layout:s}),[r,t.collection,t.disabledKeys,u,n,l,c,o,s]),f=fe(e.id);sn.set(t,f);let{gridProps:m}=on({...e,id:f,keyboardDelegate:d},t,n);i&&(m[`aria-rowcount`]=t.collection.size+t.collection.headerRows.length),t.treeColumn!=null&&(m.role=`treegrid`);let{column:h,direction:g}=t.sortDescriptor||{},_=p(qn(X),`@react-aria/table`),v=(0,Y.useMemo)(()=>{let e=t.collection.columns.find(e=>e.key===h)?.textValue??``;return g&&h?_.format(`${g}Sort`,{columnName:e}):void 0},[g,h,t.collection.columns]),y=Pe(v);return xe(()=>{v&&a(v,`assertive`,500)},[v]),{gridProps:k(m,y,{"aria-describedby":[y[`aria-describedby`],m[`aria-describedby`]].filter(Boolean).join(` `)})}}function Yn(e,t,n){let{node:r,isVirtualized:i,focusMode:a,allowsArrowNavigation:o,shouldSelectOnPressUp:s,onAction:c}=e,{direction:l}=z(),{keyboardDelegate:u,actions:{onCellAction:d},keyboardNavigationBehavior:f}=an.get(t),p=a??(f===`tab`?`cell`:`child`),m=(0,Y.useRef)(null),h=()=>{if(n.current){let e=I(n.current);if(p===`child`){if(N(n.current)&&n.current!==S(le(n.current)))return;let r=t.selectionManager.childFocusStrategy===`last`?Xn(e):e.firstChild();if(r){T(r);return}}(m.current!=null&&r.key!==m.current||!N(n.current))&&T(n.current)}},{itemProps:g,isPressed:_}=Ie({selectionManager:t.selectionManager,key:r.key,ref:n,isVirtualized:i,focus:h,shouldSelectOnPressUp:s,onAction:d?()=>d(r.key):c,isDisabled:t.collection.size===0}),v=k(g,{role:`gridcell`,onKeyDownCapture:f!==`tab`||o?e=>{let i=S(le(n.current));if(!F(e.currentTarget,H(e))||t.isKeyboardNavigationDisabled||!n.current||!i)return;let a=I(n.current);switch(a.currentNode=i,e.key){case`ArrowLeft`:{let t=l===`rtl`?a.nextNode():a.previousNode();if(p===`child`&&t===n.current&&(t=null),e.preventDefault(),e.stopPropagation(),t)T(t),We(t,{containingElement:W(n.current)});else{if(u.getKeyLeftOf?.(r.key)!==r.key){n.current.parentElement?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type,e.nativeEvent));break}p===`cell`&&l===`rtl`?(T(n.current),We(n.current,{containingElement:W(n.current)})):(a.currentNode=n.current,t=l===`rtl`?a.firstChild():Xn(a),t&&(T(t),We(t,{containingElement:W(n.current)})))}break}case`ArrowRight`:{let t=l===`rtl`?a.previousNode():a.nextNode();if(p===`child`&&t===n.current&&(t=null),e.preventDefault(),e.stopPropagation(),t)T(t),We(t,{containingElement:W(n.current)});else{if(u.getKeyRightOf?.(r.key)!==r.key){n.current.parentElement?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type,e.nativeEvent));break}p===`cell`&&l===`ltr`?(T(n.current),We(n.current,{containingElement:W(n.current)})):(a.currentNode=n.current,t=l===`rtl`?Xn(a):a.firstChild(),t&&(T(t),We(t,{containingElement:W(n.current)})))}break}case`ArrowUp`:case`ArrowDown`:!e.altKey&&F(n.current,H(e))&&(e.stopPropagation(),e.preventDefault(),n.current.parentElement?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type,e.nativeEvent)))}}:void 0,onKeyDown:f===`tab`?e=>{let r=S(le(n.current));if(!(!F(e.currentTarget,H(e))||t.isKeyboardNavigationDisabled||!n.current||!r)){if(f===`tab`&&H(e)!==n.current&&e.key!==`Tab`){e.stopPropagation();return}if(e.key===`Tab`&&f===`tab`){let t=I(n.current,{tabbable:!0});t.currentNode=r,(e.shiftKey?t.previousNode():t.nextNode())&&e.stopPropagation()}}}:void 0,"aria-colspan":r.colSpan,"aria-colindex":r.colIndex==null?void 0:r.colIndex+1,colSpan:i?void 0:r.colSpan,onFocus:e=>{if(m.current=r.key,H(e)!==n.current){M()||t.selectionManager.setFocusedKey(r.key);return}p===`child`&&e.relatedTarget&&F(n.current,e.relatedTarget)||requestAnimationFrame(()=>{p===`child`&&S(le(n.current))===n.current&&h()})},...p===`child`&&f===`tab`?{tabIndex:-1}:{}});return i&&(v[`aria-colindex`]=(r.colIndex??r.index)+1),s&&v.tabIndex!=null&&v.onPointerDown==null&&(v.onPointerDown=e=>{let t=e.currentTarget,n=t.getAttribute(`tabindex`);t.removeAttribute(`tabindex`),requestAnimationFrame(()=>{n!=null&&t.setAttribute(`tabindex`,n)})}),{gridCellProps:v,isPressed:_}}function Xn(e){let t=null,n=null;do n=e.lastChild(),n&&(t=n);while(n);return t}function Zn(e){return e&&e.__esModule?e.default:e}function Qn(e,t,n){let{node:r}=e,i=r.props.allowsSorting,{gridCellProps:a}=Yn({focusMode:`child`,...e},t,n),o=r.props.isSelectionCell&&t.selectionManager.selectionMode===`single`,{pressProps:s,isPressed:c}=pe({isDisabled:!i||o,onPress(){t.sort(r.key)},ref:n}),{focusableProps:l}=ye({},n),u,d=t.sortDescriptor?.column===r.key,f=t.sortDescriptor?.direction;r.props.allowsSorting&&!ve()&&(u=d?f:`none`);let m=p(Zn(X),`@react-aria/table`),h;i&&(h=`${m.format(`sortable`)}`,d&&f&&ve()&&(h=`${h}, ${m.format(f)}`));let g=Pe(h),_=t.collection.size===0;return(0,Y.useEffect)(()=>{_&&t.selectionManager.focusedKey===r.key&&t.selectionManager.setFocusedKey(null)},[_,t.selectionManager,r.key]),{columnHeaderProps:{...k(l,a,s,g,_?{tabIndex:-1}:null),role:`columnheader`,id:ln(t,r.key),"aria-colspan":r.colSpan&&r.colSpan>1?r.colSpan:void 0,"aria-sort":u},isPressed:c}}function $n(e,t,n){let{node:r,isVirtualized:i,shouldSelectOnPressUp:a,onAction:o}=e,{actions:s,shouldSelectOnPressUp:c}=an.get(t),l=s.onRowAction?()=>s.onRowAction?.(r.key):o,{itemProps:u,...d}=Ie({selectionManager:t.selectionManager,key:r.key,ref:n,isVirtualized:i,shouldSelectOnPressUp:c||a,onAction:l||r?.props?.onAction?me(r?.props?.onAction,l):void 0,isDisabled:t.collection.size===0}),f=t.selectionManager.isSelected(r.key),p={role:`row`,"aria-selected":t.selectionManager.selectionMode===`none`?void 0:f,"aria-disabled":d.isDisabled||void 0,...u};return i&&(p[`aria-rowindex`]=r.index+1),{rowProps:p,...d}}function er(e){return e&&e.__esModule?e.default:e}var tr={expand:{ltr:`ArrowRight`,rtl:`ArrowLeft`},collapse:{ltr:`ArrowLeft`,rtl:`ArrowRight`}};function nr(e,t,n){let{node:r,isVirtualized:i}=e,{rowProps:a,...o}=$n(e,t,n),{direction:s}=z();i&&t.treeColumn==null?a[`aria-rowindex`]=r.index+1+t.collection.headerRows.length:delete a[`aria-rowindex`];let c=t.treeColumn!=null&&(t.expandedKeys===`all`||t.expandedKeys.has(r.key)),l=p(er(X),`@react-aria/table`),u=y({"aria-label":c?l.format(`collapse`):l.format(`expand`),"aria-labelledby":dn(t,r.key)}),d={},f={};if(t.treeColumn!=null){let e=t.collection.getItem(r.key);if(e!=null){let n=rr(t.collection,r),i=e.props?.hasChildRows||e.props?.UNSTABLE_childItems||n?.type!==`cell`,a=t.collection.getItem(r.parentKey),c=a.type===`tablebody`||a.type===`body`,l=rr(t.collection,a);for(;l&&l.type!==`item`&&l.prevKey!=null;)l=t.collection.getItem(l.prevKey);d={onKeyDown:n=>{n.key===tr.expand[s]&&t.selectionManager.focusedKey===e.key&&i&&t.expandedKeys!==`all`&&!t.expandedKeys.has(e.key)?(t.toggleKey(e.key),n.stopPropagation()):n.key===tr.collapse[s]&&t.selectionManager.focusedKey===e.key&&(t.expandedKeys===`all`?t.expandedKeys===`all`&&(t.toggleKey(e.key),n.stopPropagation()):i&&t.expandedKeys.has(e.key)?(t.toggleKey(e.key),n.stopPropagation()):!t.expandedKeys.has(e.key)&&e.parentKey!=null&&e.level>0&&(t.selectionManager.setFocusedKey(e.parentKey),n.stopPropagation()))},"aria-expanded":i?t.expandedKeys===`all`||t.expandedKeys.has(r.key):void 0,"aria-level":e.level+1,"aria-posinset":e.index-(c?0:t.collection.columnCount)+1,"aria-setsize":l.index-(c?0:t.collection.columnCount)+1},f={isDisabled:o.isDisabled,onPress:()=>{o.isDisabled||(t.toggleKey(r.key),t.selectionManager.setFocused(!0),t.selectionManager.setFocusedKey(r.key))},excludeFromTabOrder:!0,preventFocusOnPress:!0,"data-react-aria-prevent-focus":!0,...u}}}let m=se(r.props),h=o.hasAction?m:{};return{rowProps:{...k(a,d,h),"aria-labelledby":dn(t,r.key)},expandButtonProps:f,...o}}function rr(e,t){return`lastChildKey`in t?t.lastChildKey==null?null:e.getItem(t.lastChildKey):Array.from(t.childNodes).findLast(e=>e.parentKey===t.key)}function ir(e,t,n){let{node:r,isVirtualized:i}=e,a={role:`row`};return i&&t.treeColumn==null&&(a[`aria-rowindex`]=r.index+1),{rowProps:a}}function ar(e,t,n){let{gridCellProps:r,isPressed:i}=Yn(e,t,n),a=e.node.column?.key;return a!=null&&t.collection.rowHeaderColumnKeys.has(a)&&(r.role=`rowheader`,r.id=un(t,e.node.parentKey,a)),{gridCellProps:r,isPressed:i}}function or(e){return e&&e.__esModule?e.default:e}function sr(e,t){let{key:n}=e,{checkboxProps:r}=Pt(e,t);return{checkboxProps:{...r,"aria-labelledby":`${r.id} ${dn(t,n)}`}}}function cr(e){let{isEmpty:t,isSelectAll:n,selectionMode:r}=e.selectionManager;return{checkboxProps:{"aria-label":p(or(X),`@react-aria/table`).format(r===`single`?`select`:`selectAll`),isSelected:n,isDisabled:r!==`multiple`||e.collection.size===0||e.collection.rows.length===1&&e.collection.rows[0].type===`loader`,isIndeterminate:!t&&!n,onChange:()=>e.selectionManager.toggleSelectAll()}}}function lr(e){return e&&e.__esModule?e.default:e}function ur(e,t,n){let{column:r,triggerRef:a,isDisabled:o,onResizeStart:s,onResize:c,onResizeEnd:l,"aria-label":u}=e,d=p(lr(X),`@react-aria/table`),f=fe(),m=t.resizingColumn===r.key,h=(0,Y.useRef)(m),g=(0,Y.useRef)(null),_=(0,Y.useRef)(!1),v=t.tableState.isKeyboardNavigationDisabled,[y,b]=(0,Y.useState)(!1),{direction:x}=z(),C=(0,Y.useCallback)(e=>{h.current||(g.current=t.updateResizedColumns(e.key,t.getColumnWidth(e.key)),t.startResize(e.key),t.tableState.setKeyboardNavigationDisabled(!0),s?.(g.current)),h.current=!0},[t,s]),w=(0,Y.useCallback)((e,n)=>{let r=t.updateResizedColumns(e.key,n);c?.(r),g.current=r},[t,c]),D=(0,Y.useCallback)(e=>{h.current&&(g.current??=t.updateResizedColumns(e.key,t.getColumnWidth(e.key)),t.endResize(),t.tableState.setKeyboardNavigationDisabled(!1),l?.(g.current),h.current=!1,a?.current&&!_.current&&T(a.current)),g.current=null},[t,a,l]),O=()=>{if(v){D(r);return}return!1},{keyboardProps:A}=_e({shortcuts:{Escape:()=>O(),Enter:()=>{v?D(r):C(r)}," ":()=>O(),Tab:()=>O()}}),j=(0,Y.useRef)(0),{moveProps:M}=Ke({onMoveStart(e){j.current=t.getColumnWidth(r.key),e.pointerType===`mouse`&&b(!0),C(r)},onMove(e){let{deltaX:t,deltaY:n,pointerType:i}=e;x===`rtl`&&(t*=-1),i===`keyboard`&&(n!==0&&t===0&&(t=n*-1),t*=10),t!==0&&(j.current+=t,w(r,j.current))},onMoveEnd(e){let{pointerType:t}=e;j.current=0,b(!1),(t===`mouse`||t===`touch`&&_.current)&&D(r)}}),ee=(0,Y.useCallback)(e=>{v&&M.onKeyDown?.(e)},[v,M]),N=Math.floor(t.getColumnMinWidth(r.key)),P=Math.floor(t.getColumnMaxWidth(r.key));P===1/0&&(P=2**53-1);let ne=Math.floor(t.getColumnWidth(r.key)),F=E();F===`virtual`&&typeof window<`u`&&`ontouchstart`in window&&(F=`touch`);let re=a?.current==null&&(F===`keyboard`||F===`virtual`)&&!m?d.format(`resizerDescription`):void 0,I=Pe(re),ie={"aria-label":u,"aria-orientation":`horizontal`,"aria-labelledby":`${f} ${ln(t.tableState,r.key)}`,"aria-valuetext":d.format(`columnSize`,{value:ne}),type:`range`,min:N,max:P,value:ne,...I},L=(0,Y.useCallback)(()=>{n.current&&T(n.current)},[n]),R=t.resizingColumn,ae=(0,Y.useRef)(null),oe=te(C);(0,Y.useEffect)(()=>{if(ae.current!==R&&R!=null&&R===r.key){_.current=S()===n.current,oe(r);let e=setTimeout(()=>L(),0),t=setTimeout(L,400);return()=>{clearTimeout(e),clearTimeout(t)}}ae.current=R},[R,r,L,n]);let se=e=>{let n=t.getColumnWidth(r.key),i=parseFloat(H(e).value);i=i>n?n+10:n-10,w(r,i)},{pressProps:ce}=pe({preventFocusOnPress:!0,onPressStart:e=>{if(!(e.ctrlKey||e.altKey||e.metaKey||e.shiftKey||e.pointerType===`keyboard`)){if(e.pointerType===`virtual`&&t.resizingColumn!=null){D(r);return}L(),e.pointerType!==`virtual`&&C(r)}},onPress:e=>{(e.pointerType===`touch`&&_.current||e.pointerType===`mouse`)&&t.resizingColumn!=null&&D(r)}}),{visuallyHiddenProps:le}=i();return{resizerProps:k(A,{...M,onKeyDown:ee},ce,{style:{touchAction:`none`}}),inputProps:k(le,{id:f,onBlur:()=>{D(r)},onChange:se,disabled:o},ie),isResizing:m,isMouseResizing:y}}function dr(){return{rowGroupProps:{role:`rowgroup`}}}function fr(){return dr()}var pr=t(n(),1);function mr(e){return e&&e.__esModule?e.default:e}var hr=class extends b{withExpandedKeys(e){let t=this.clone();return t.expandedKeys=e,t.frozen=this.frozen,t.rows=Array.from(t.getRows()),t}addNode(e){super.addNode(e),this.columnsDirty||=e.type===`column`,e.type===`tableheader`&&(this.head=e)}getRows(){let e=[];for(let t of this)(t.type===`tablebody`||t.type===`tablefooter`)&&e.push(...this.getChildren(t.key));return e}get body(){for(let e of this)if(e.type===`tablebody`)return e;return new Fr(-2)}commit(e,t,n=!1){this.updateColumns(n),this.firstKey=e,this.lastKey=t,this.rows=[];for(let e of this.getRows()){let t=e.lastChildKey;if(t!=null){let e=this.getItem(t);for(;e&&e.type!==`cell`;)e=e.prevKey==null?null:this.getItem(e.prevKey);if(e){let t=(e.colIndex??e.index)+(e.colSpan??1);if(t!==this.columns.length&&!n)throw Error(`Cell count must match column count. Found ${t} cells and ${this.columns.length} columns.`)}}this.rows.push(e)}super.commit(e,t,n)}updateColumns(e){if(!this.columnsDirty)return;this.rowHeaderColumnKeys=new Set,this.columns=[];let t=new Map,n=e=>{e.type===`column`&&(t.set(e.key,e),e.hasChildNodes||(e.index=this.columns.length,this.columns.push(e),e.props.isRowHeader&&this.rowHeaderColumnKeys.add(e.key)));for(let t of this.getChildren(e.key))n(t)};for(let e of this.getChildren(this.head.key))n(e);if(this.headerRows=Vt(t,this.columns),this.columnsDirty=!1,this.rowHeaderColumnKeys.size===0&&this.columns.length>0&&!e)throw Error(`A table must have at least one Column with the isRowHeader prop set to true`)}get columnCount(){return this.columns.length}*[Symbol.iterator](){let e=this.firstKey;for(;e!=null;){let t=this.getItem(e);t&&(yield t),e=t?.nextKey??null}}getFirstKey(){for(let e of this)if(e.type===`tablebody`)return e.firstChildKey??null;return null}getLastKey(){let e=this.lastKey;if(e==null)return null;let t=this.getItem(e);for(;t?.lastChildKey!=null&&(t.type!==`item`||this.expandedKeys.has(t.key));)t=this.getItem(t.lastChildKey);return t?.key}getKeyAfter(e){let t=this.getItem(e);if(t?.type===`column`)return t.nextKey??null;if(!t)return null;if(t.type===`item`&&t.firstChildKey!=null&&this.expandedKeys.has(t.key)){let e=this.getItem(t.firstChildKey);for(;e;){if(e.type===`item`)return e.key;e=e.nextKey==null?null:this.getItem(e.nextKey)}}return super.getKeyAfter(e)}getKeyBefore(e){let t=this.getItem(e);if(t?.type===`column`)return t.prevKey??null;if(!t)return null;let n=null;if(t.prevKey!=null){for(t=this.getItem(t.prevKey);t&&(t.type!==`item`||this.expandedKeys.has(t.key))&&t.lastChildKey!=null;)t=this.getItem(t.lastChildKey);n=t?.key??null}return n??=t.parentKey,n!=null&&this.getItem(n)?.type===`tableheader`?null:n}getChildren(e){let t=this.getItem(e);if(!t){for(let t of this.headerRows)if(t.key===e)return t.childNodes}let n=this;return t?.type===`tablebody`||t?.type===`tablefooter`?{*[Symbol.iterator](){let e=t.firstChildKey,r=e==null?null:n.getItem(e);for(;r;){yield r;let e=n.getKeyAfter(r.key);if(r=e==null?null:n.getItem(e),r&&r.parentKey===t.parentKey)break}}}:{*[Symbol.iterator](){let t=n.getItem(e),r=t?.firstChildKey==null?null:n.getItem(t.firstChildKey);for(;r&&(yield r,r=r.nextKey==null?null:n.getItem(r.nextKey),t?.type!==`item`||r?.type===`cell`););}}}clone(){let e=super.clone();return e.headerRows=this.headerRows,e.columns=this.columns,e.rows=this.rows,e.rowHeaderColumnKeys=this.rowHeaderColumnKeys,e.head=this.head,e}getTextValue(e){let t=this.getItem(e);if(!t)return``;if(t.textValue)return t.textValue;let n=this.rowHeaderColumnKeys,r=[];for(let t of this.getChildren(e)){let e=this.columns[t.index];if(n.has(e.key)&&t.textValue&&r.push(t.textValue),r.length===n.size)break}return r.join(` `)}constructor(...e){super(...e),this.headerRows=[],this.columns=[],this.rows=[],this.rowHeaderColumnKeys=new Set,this.head=new Tr(-1),this.columnsDirty=!0,this.expandedKeys=new Set}},gr=(0,Y.createContext)(null),_r=(0,Y.forwardRef)(function(e,t){let n=O(t),r=(0,Y.useRef)(null),i=(0,Y.useRef)(null),[a,o]=(0,Y.useState)(0);ae(()=>{let e=r.current;for(;e&&e!==n.current&&!Me(e);)e=e.parentElement;i.current=e},[n]),h({ref:i,box:`border-box`,onResize(){o(i.current?.clientWidth??0)}}),ae(()=>{o(i.current?.clientWidth??0)},[]);let s=(0,Y.useMemo)(()=>({tableRef:r,scrollRef:i,tableWidth:a,useTableColumnResizeState:Zt,onResizeStart:e.onResizeStart,onResize:e.onResize,onResizeEnd:e.onResizeEnd}),[r,a,e.onResizeStart,e.onResize,e.onResizeEnd]);return Y.createElement(D.div,{render:e.render,...B(e,{global:!0}),ref:n,className:e.className||`react-aria-ResizableTableContainer`,style:e.style,onScroll:e.onScroll},Y.createElement(gr.Provider,{value:s},e.children))}),vr=(0,Y.createContext)(null),Z=(0,Y.createContext)(null),yr=(0,Y.createContext)(null),br=(0,Y.forwardRef)(function(e,t){[e,t]=ue(e,t,vr);let n=Fe(e),{selectionBehavior:r,selectionMode:i,disallowEmptySelection:a}=n,o=!!e.dragAndDropHooks?.useDraggableCollectionState,s=(0,Y.useMemo)(()=>({selectionBehavior:i===`none`?null:r,selectionMode:i,disallowEmptySelection:a,allowsDragging:o}),[r,i,a,o]),c=Y.createElement(wr.Provider,{value:s},Y.createElement(d,e));return Y.createElement(g,{content:c,createCollection:()=>new hr},r=>Y.createElement(Cr,{props:e,forwardedRef:t,selectionState:n,collection:r}))}),xr=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.table,{...e,ref:t})}),Sr={expand:{ltr:`ArrowRight`,rtl:`ArrowLeft`},collapse:{ltr:`ArrowLeft`,rtl:`ArrowRight`}};function Cr({props:e,forwardedRef:t,selectionState:n,collection:r}){[e,t]=ue(e,t,v);let{shouldUseVirtualFocus:i,disallowTypeAhead:a,filter:o,...s}=e,c=(0,Y.useContext)(gr);t=O((0,Y.useMemo)(()=>ne(t,c?.tableRef),[t,c?.tableRef]));let[l,u]=de(e.expandedKeys?new Set(e.expandedKeys):void 0,e.defaultExpandedKeys?new Set(e.defaultExpandedKeys):new Set,e.onExpandedChange);r=(0,Y.useMemo)(()=>r.withExpandedKeys(l),[r,l]);let d=en({...s,collection:r,children:void 0,UNSAFE_selectionState:n,expandedKeys:l,onExpandedChange:u}),f=tn(d,o),{isVirtualized:p,layoutDelegate:h,dropTargetDelegate:g,CollectionRoot:_}=(0,Y.useContext)(G),{dragAndDropHooks:y}=e,{gridProps:b}=Jn({...s,layoutDelegate:h,isVirtualized:p},f,t),x=f.selectionManager,S=!!y?.useDraggableCollectionState,w=!!y?.useDroppableCollectionState;(0,Y.useRef)(S),(0,Y.useRef)(w),(0,Y.useEffect)(()=>{},[S,w]);let T,E,D,A=!1,M=null,ee=(0,Y.useRef)(null),{direction:N}=z(),[P]=(0,Y.useState)(()=>new Lt);if(S&&y){T=y.useDraggableCollectionState({collection:f.collection,selectionManager:x,preview:y.renderDragPreview?ee:void 0}),y.useDraggableCollection({},T,t);let e=y.DragPreview;M=y.renderDragPreview?Y.createElement(e,{ref:ee},y.renderDragPreview):null}if(w&&y){E=y.useDroppableCollectionState({collection:f.collection,selectionManager:x});let e=new Le({collection:f.collection,disabledKeys:x.disabledKeys,disabledBehavior:x.disabledBehavior,ref:t,layoutDelegate:h}),n=y.dropTargetDelegate||g||new y.ListDropTargetDelegate(r.rows,t);P.setup(n,d,N),D=y.useDroppableCollection({keyboardDelegate:e,dropTargetDelegate:P,onDropActivate:e=>{if(e.target.type===`item`){let t=e.target.key,n=d.collection.getItem(t),r=l.has(t);n&&n.hasChildNodes&&(!r||y?.isVirtualDragging?.())&&d.toggleKey(t)}},onKeyDown:e=>{let t=E?.target;if(t&&t.type===`item`&&t.dropPosition===`on`){let n=d.collection.getItem(t.key);(e.key===Sr.expand[N]&&n?.hasChildNodes&&!d.expandedKeys.has(t.key)||e.key===Sr.collapse[N]&&n?.hasChildNodes&&d.expandedKeys.has(t.key))&&d.toggleKey(t.key)}}},E,t),A=E.isDropTarget({type:`root`})}let{focusProps:te,isFocused:F,isFocusVisible:re}=R(),I=j({...e,children:void 0,defaultClassName:`react-aria-Table`,values:{isDropTarget:A,isFocused:F,isFocusVisible:re,state:f}}),ie=!!(S&&!T?.isDisabled),L=I.style,ae=null;c&&(ae=c.useTableColumnResizeState({tableWidth:c.tableWidth},f),p||(L={...L,tableLayout:`fixed`,width:`min-content`}));let oe=B(e,{global:!0});return Y.createElement(C,{values:[[Z,f],[yr,ae],[U,{dragAndDropHooks:y,dragState:T,dropState:E}],[Ce,{render:Gr}],[v,null],[m,null]]},Y.createElement(ce,null,Y.createElement(xr,{...k(oe,I,b,te,D?.collectionProps),style:L,ref:t,slot:e.slot||void 0,onScroll:e.onScroll,"data-allows-dragging":ie||void 0,"data-drop-target":A||void 0,"data-focused":F||void 0,"data-focus-visible":re||void 0},Y.createElement(he,null,Y.createElement(_,{collection:f.collection,scrollRef:c?.scrollRef??t,persistedKeys:Te(x,y,E)})))),M)}var wr=(0,Y.createContext)(null),Tr=class extends o{static{this.type=`tableheader`}},Er=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.thead,{...e,ref:t})}),Dr=f(Tr,(e,t)=>{let n=(0,Y.useContext)(Z).collection,r=l({items:n.headerRows,children:(0,Y.useCallback)(e=>{switch(e.type){case`headerrow`:return Y.createElement(kr,{item:e});default:throw Error(`Unsupported node type in TableHeader: `+e.type)}},[])}),{rowGroupProps:i}=fr(),{hoverProps:a,isHovered:o}=ge({onHoverStart:e.onHoverStart,onHoverChange:e.onHoverChange,onHoverEnd:e.onHoverEnd}),s=j({...e,children:void 0,defaultClassName:`react-aria-TableHeader`,values:{isHovered:o}});return Y.createElement(Er,{...k(B(e,{global:!0}),i,a),...s,ref:t,"data-hovered":o||void 0},r)},e=>Y.createElement(d,{dependencies:e.dependencies,items:e.columns},e.children)),Or=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(`div`,{...e,ref:t}):Y.createElement(`tr`,{...e,ref:t})});function kr({item:e}){let t=(0,Y.useRef)(null),n=(0,Y.useContext)(Z),{isVirtualized:r,CollectionBranch:i}=(0,Y.useContext)(G),{rowProps:a}=ir({node:e,isVirtualized:r},n,t),{checkboxProps:o}=cr(n);return Y.createElement(Or,{...a,ref:t},Y.createElement(C,{values:[[ke,{slots:{selection:o}}],[Oe,{slots:{selection:o}}]]},Y.createElement(i,{collection:n.collection,parent:e})))}var Ar=class extends o{static{this.type=`column`}},jr=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.th,{...e,ref:t})}),Mr=_(Ar,(e,t,n)=>{let r=O(t),i=(0,Y.useContext)(Z),{isVirtualized:a}=(0,Y.useContext)(G),{columnHeaderProps:o,isPressed:s}=Qn({node:n,isVirtualized:a,focusMode:e.focusMode,allowsArrowNavigation:e.allowsArrowNavigation},i,r),{isFocused:c,isFocusVisible:l,focusProps:u}=R(),d=(0,Y.useContext)(yr),f=!1;d&&(f=d.resizingColumn===n.key);let{hoverProps:p,isHovered:m}=ge({isDisabled:!e.allowsSorting}),h=j({...e,id:void 0,children:n.rendered,defaultClassName:`react-aria-Column`,values:{isHovered:m,isPressed:s,isFocused:c,isFocusVisible:l,allowsSorting:n.props.allowsSorting,sortDirection:i.sortDescriptor?.column===n.key?i.sortDescriptor.direction:void 0,isResizing:f,startResize:()=>{if(d)d.startResize(n.key),i.setKeyboardNavigationDisabled(!0);else throw Error(`Wrap your
    in a to enable column resizing`)},sort:e=>{i.sort(n.key,e)}}}),g=h.style;d&&(g={...g,width:d.getColumnWidth(n.key)});let _=B(e,{global:!0});return delete _.id,Y.createElement(jr,{...k(_,o,u,p),...h,style:g,ref:r,"data-hovered":m||void 0,"data-pressed":s||void 0,"data-focused":c||void 0,"data-focus-visible":l||void 0,"data-resizing":f||void 0,"data-allows-sorting":n.props.allowsSorting||void 0,"data-sort-direction":i.sortDescriptor?.column===n.key?i.sortDescriptor.direction:void 0},Y.createElement(C,{values:[[Nr,{column:n,triggerRef:r}],[G,Ue]]},h.children))}),Nr=(0,Y.createContext)(null),Pr=(0,Y.forwardRef)(function(e,t){let n=(0,Y.useContext)(yr);if(!n)throw Error(`Wrap your
    in a to enable column resizing`);let r=p(mr(Se),`react-aria-components`),{onResizeStart:i,onResize:a,onResizeEnd:o}=(0,Y.useContext)(gr),{column:s,triggerRef:c}=(0,Y.useContext)(Nr),l=(0,Y.useRef)(null),{resizerProps:u,inputProps:d,isResizing:f,isMouseResizing:m}=ur({column:s,"aria-label":e[`aria-label`]||r.format(`tableResizer`),onResizeStart:i,onResize:a,onResizeEnd:o,triggerRef:c},n,l),{focusProps:h,isFocused:g,isFocusVisible:_}=R(),{hoverProps:v,isHovered:y}=ge(e),b=n.getColumnMinWidth(s.key)>=n.getColumnWidth(s.key),x=n.getColumnMaxWidth(s.key)<=n.getColumnWidth(s.key),{direction:S}=z(),C=`both`;C=b?S===`rtl`?`right`:`left`:x?S===`rtl`?`left`:`right`:`both`;let w=O(t),[T,E]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{if(!w.current)return;let e=window.getComputedStyle(w.current);E(e.cursor)},[w,C]);let A=j({...e,defaultClassName:`react-aria-ColumnResizer`,values:{isFocused:g,isFocusVisible:_,isResizing:f,isHovered:y,resizableDirection:C}}),M=B(e,{global:!0});return Y.createElement(D.div,{ref:w,role:`presentation`,...k(M,A,u,v),"data-hovered":y||void 0,"data-focused":g||void 0,"data-focus-visible":_||void 0,"data-resizing":f||void 0,"data-resizable-direction":C},A.children,Y.createElement(`input`,{ref:l,...k(d,h)}),f&&m&&pr.createPortal(Y.createElement(`div`,{style:{position:`fixed`,top:0,left:0,bottom:0,right:0,cursor:T},"data-testid":`cursor-overlay`}),document.body))}),Fr=class extends x{static{this.type=`tablebody`}},Ir=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.tbody,{...e,ref:t})}),Lr=f(Fr,(e,t,n)=>{let r=(0,Y.useContext)(Z),{isVirtualized:i}=(0,Y.useContext)(G),a=r.collection,{CollectionBranch:o}=(0,Y.useContext)(G),{dragAndDropHooks:s,dropState:c}=(0,Y.useContext)(U),l=!!s?.useDroppableCollectionState&&!c?.isDisabled,u=l&&!!c&&(c.isDropTarget({type:`root`})??!1),d=a.size===0,f={isDropTarget:u,isEmpty:d},p=j({...e,id:void 0,children:void 0,defaultClassName:`react-aria-TableBody`,values:f}),m,h=a.columnCount;if(d&&e.renderEmptyState&&r){let t={},n={},r={};i?(n[`aria-colspan`]=h,r={display:`contents`}):n.colSpan=h,m=Y.createElement(Br,{role:`row`,...t,style:r},Y.createElement(Ur,{role:`rowheader`,...n,style:r},e.renderEmptyState(f)))}let{rowGroupProps:g}=fr(),_=B(e,{global:!0});return Y.createElement(Ir,{...k(_,p,g),ref:t,"data-empty":d||void 0},l&&Y.createElement(Xr,null),Y.createElement(o,{collection:a,parent:n,renderDropIndicator:De(s,c)}),m)});(class extends x{static{this.type=`tablefooter`}});var Rr=(0,Y.createContext)({isFocusVisibleWithinRow:!1}),zr=class extends o{static{this.type=`item`}filter(e,t,n){let r=e.getChildren(this.key);for(let i of r)if(n(i.textValue,i)){let n=this.clone();return t.addDescendants(n,e),n}return null}},Br=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.tr,{...e,ref:t})}),Vr=f(zr,(e,t,n)=>{let r=O(t),a=(0,Y.useContext)(Z),{dragAndDropHooks:o,dragState:s,dropState:l}=(0,Y.useContext)(U),{isVirtualized:u,CollectionBranch:d}=(0,Y.useContext)(G),f=s&&!(s.isDisabled||s.selectionManager.isDisabled(n.key)),{rowProps:p,expandButtonProps:m,...h}=nr({node:n,shouldSelectOnPressUp:!!s,isVirtualized:u},a,r),{isFocused:g,isFocusVisible:_,focusProps:v}=R(),{isFocusVisible:y,focusProps:b}=R({within:!0}),{hoverProps:x,isHovered:S}=ge({isDisabled:!h.allowsSelection&&!h.hasAction&&!f,onHoverStart:e.onHoverStart,onHoverChange:e.onHoverChange,onHoverEnd:e.onHoverEnd}),{checkboxProps:w}=sr({key:n.key},a),T;s&&o&&(T=o.useDraggableItem({key:n.key,hasDragButton:!0},s));let E,D=(0,Y.useRef)(null),{visuallyHiddenProps:A}=i();l&&o&&(E=o.useDropIndicator({target:{type:`item`,key:n.key,dropPosition:`on`}},l,D));let M=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{s&&M.current},[]);let N=s&&s.isDragging(n.key),{children:P,...te}=e,ne=e.hasChildItems||a.collection.getItem(n.lastChildKey)?.type!==`cell`,F=ne&&a.expandedKeys.has(n.key),re=j({...te,id:void 0,defaultClassName:`react-aria-Row`,defaultStyle:{"--table-row-level":n.level+1},values:{...h,state:a,isHovered:S,isFocused:g,isFocusVisible:_,selectionMode:a.selectionManager.selectionMode,selectionBehavior:a.selectionManager.selectionBehavior,isDragging:N,isDropTarget:E?.isDropTarget,isFocusVisibleWithin:y,id:n.key,hasChildItems:ne,isExpanded:F,level:n.level+1}}),I=B(e,{global:!0});return delete I.id,delete I.onClick,Y.createElement(Y.Fragment,null,E&&!E.isHidden&&Y.createElement(Br,{role:`row`,style:{height:0}},Y.createElement(Ur,{role:`gridcell`,colSpan:a.collection.columnCount,style:{padding:0}},Y.createElement(`div`,{role:`button`,...A,...E.dropIndicatorProps,ref:D}))),Y.createElement(Br,{...k(I,re,p,v,x,T?.dragProps,b),ref:r,"data-disabled":h.isDisabled||void 0,"data-selected":h.isSelected||void 0,"data-hovered":S||void 0,"data-focused":h.isFocused||void 0,"data-focus-visible":_||void 0,"data-pressed":h.isPressed||void 0,"data-dragging":N||void 0,"data-drop-target":E?.isDropTarget||void 0,"data-selection-mode":a.selectionManager.selectionMode===`none`?void 0:a.selectionManager.selectionMode,"data-focus-visible-within":y||void 0,"data-expanded":F||void 0,"data-has-child-items":ne||void 0,"data-level":n.level+1},Y.createElement(C,{values:[[ke,{slots:{[ee]:{},selection:w}}],[Oe,{slots:{[ee]:{},selection:w}}],[c,{slots:{[ee]:{},chevron:m,drag:{...T?.dragButtonProps,ref:M,style:{pointerEvents:`none`}}}}],[ze,{isSelected:h.isSelected}],[Rr,{isFocusVisibleWithinRow:y}]]},Y.createElement(d,{collection:a.collection,parent:n}))))},e=>{if(e.id==null&&typeof e.children==`function`)throw Error(`No id detected for the Row element. The Row element requires a id to be provided to it when the cells are rendered dynamically.`);let t=[e.value].concat(e.dependencies);return Y.createElement(d,{dependencies:t,items:e.columns,idScope:e.id},e.children)}),Hr=class extends o{static{this.type=`cell`}},Ur=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.td,{...e,ref:t})}),Wr=_(Hr,(e,t,n)=>{let r=O(t),i=(0,Y.useContext)(Z),{dragState:a}=(0,Y.useContext)(U),{isVirtualized:o}=(0,Y.useContext)(G);n.column=i.collection.columns[n.index];let{gridCellProps:s,isPressed:c}=ar({node:n,shouldSelectOnPressUp:!!a,isVirtualized:o,focusMode:e.focusMode,allowsArrowNavigation:e.allowsArrowNavigation},i,r),{isFocused:l,isFocusVisible:u,focusProps:d}=R(),{hoverProps:f,isHovered:p}=ge({}),{isFocusVisibleWithinRow:m}=(0,Y.useContext)(Rr),h=n.parentKey!=null&&i.selectionManager.isSelected(n.parentKey),g=n.colIndex||n.index,_=i.collection.getItem(n.parentKey),v=_.props.hasChildItems||i.collection.getItem(_.lastChildKey)?.type!==`cell`,y=v&&i.expandedKeys.has(n.parentKey),b=i.selectionManager.isDisabled(n.parentKey),x=j({...e,id:void 0,defaultClassName:`react-aria-Cell`,values:{isFocused:l,isFocusVisible:u,isFocusVisibleWithinRow:m,isPressed:c,isHovered:p,isSelected:h,id:n.key,columnIndex:g,hasChildItems:v,isExpanded:y,isDisabled:b,level:_.level+1,isTreeColumn:n.column.key===i.treeColumn}}),S=B(e,{global:!0});return delete S.id,Y.createElement(Ur,{...k(S,x,s,d,f),ref:r,"data-focused":l||void 0,"data-focus-visible":u||void 0,"data-focus-visible-within-row":m||void 0,"data-pressed":c||void 0,"data-selected":h||void 0,"data-column-index":g,"data-expanded":y||void 0,"data-has-child-items":v||void 0,"data-level":_.level+1,"data-tree-column":n.column.key===i.treeColumn||void 0,"data-disabled":b||void 0},Y.createElement(G.Provider,{value:Ue},x.children))});function Gr(e,t){t=O(t);let{dragAndDropHooks:n,dropState:r}=(0,Y.useContext)(U),i=(0,Y.useRef)(null),{dropIndicatorProps:a,isHidden:o,isDropTarget:s}=n.useDropIndicator(e,r,i);if(o)return null;let c=r&&e.target.type===`item`?(r.collection.getItem(e.target.key)?.level||0)+1:1;return Y.createElement(Yr,{...e,dropIndicatorProps:a,isDropTarget:s,buttonRef:i,level:c,ref:t})}var Kr=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.tr,{...e,ref:t})}),qr=(0,Y.forwardRef)(function(e,t){let{isVirtualized:n}=(0,Y.useContext)(G);return n?Y.createElement(D.div,{...e,ref:t}):Y.createElement(D.td,{...e,ref:t})});function Jr(e,t){let{dropIndicatorProps:n,isDropTarget:r,buttonRef:a,level:o,...s}=e,c=(0,Y.useContext)(Z),{visuallyHiddenProps:l}=i(),u=j({...s,defaultClassName:`react-aria-DropIndicator`,defaultStyle:{"--table-row-level":o+1},values:{isDropTarget:r}});return Y.createElement(Kr,{...B(e,{global:!0}),...u,role:`row`,ref:t,"data-drop-target":r||void 0,"aria-level":o},Y.createElement(qr,{role:`gridcell`,colSpan:c.collection.columnCount,style:{padding:0}},Y.createElement(`div`,{...l,role:`button`,...n,ref:a}),u.children))}var Yr=(0,Y.forwardRef)(Jr);function Xr(){let e=(0,Y.useContext)(Z),{dragAndDropHooks:t,dropState:n}=(0,Y.useContext)(U),r=(0,Y.useRef)(null),{dropIndicatorProps:a}=t.useDropIndicator({target:{type:`root`}},n,r),o=n.isDropTarget({type:`root`}),{visuallyHiddenProps:s}=i();return!o&&a[`aria-hidden`]?null:Y.createElement(Br,{role:`row`,"aria-hidden":a[`aria-hidden`],style:{height:0}},Y.createElement(Ur,{role:`gridcell`,colSpan:e.collection.columnCount,style:{padding:0}},Y.createElement(`div`,{role:`button`,...s,...a,ref:r})))}var Zr=_(u,function(e,t,n){let r=(0,Y.useContext)(Z),{isVirtualized:i}=(0,Y.useContext)(G),{isLoading:a,onLoadMore:o,scrollOffset:s,...c}=e,l=r.collection.columns.length,u=(0,Y.useRef)(null),d=(0,Y.useMemo)(()=>({onLoadMore:o,collection:r?.collection,sentinelRef:u,scrollOffset:s}),[o,s,r?.collection]);Ee(d,u);let f=j({...c,id:void 0,children:n.rendered,defaultClassName:`react-aria-TableLoadingIndicator`,defaultStyle:{"--table-row-level":n.level+1},values:void 0}),p={},m={},h={};return i?(m[`aria-colspan`]=l,h={display:`contents`}):m.colSpan=l,Y.createElement(Y.Fragment,null,Y.createElement(Br,{style:{height:0},inert:we(!0)},Y.createElement(Ur,{style:{padding:0,border:0}},Y.createElement(`div`,{"data-testid":`loadMoreSentinel`,ref:u,style:{position:`relative`,height:1,width:1}}))),a&&f.children&&Y.createElement(Br,{...k(B(e,{global:!0}),p),...f,role:`row`,ref:t,"aria-level":n.level+1,"data-level":n.level+1},Y.createElement(Ur,{role:`rowheader`,...m,style:h},f.children)))}),Q=r(),$=(0,Y.createContext)({}),Qr=({children:e,className:t,variant:n,...r})=>{let i=Y.useMemo(()=>Ge({variant:n}),[n]);return(0,Q.jsx)($,{value:{slots:i},children:(0,Q.jsx)(w.div,{className:i.base({className:t}),"data-slot":`table`,...r,children:e})})};Qr.displayName=`HeroUI.Table`;var $r=({className:e,...t})=>{let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(w.div,{className:V(n?.scrollContainer,e),"data-slot":`table-scroll-container`,...t})};$r.displayName=`HeroUI.Table.ScrollContainer`;function ei({className:e,...t}){let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(br,{className:L(e,n?.content()),"data-slot":`table-content`,...t})}ei.displayName=`HeroUI.Table.Content`;function ti({className:e,...t}){let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(Dr,{className:L(e,n?.header()),"data-slot":`table-header`,...t})}ti.displayName=`HeroUI.Table.Header`;var ni=({className:e,ref:t,...n})=>{let{slots:r}=(0,Y.use)($);return(0,Q.jsx)(Mr,{ref:t,className:L(e,r?.column()),"data-slot":`table-column`,...n})};ni.displayName=`HeroUI.Table.Column`;function ri({className:e,...t}){let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(Lr,{className:L(e,n?.body()),"data-slot":`table-body`,...t})}ri.displayName=`HeroUI.Table.Body`;function ii({className:e,...t}){let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(Vr,{className:L(e,n?.row()),"data-slot":`table-row`,...t})}ii.displayName=`HeroUI.Table.Row`;var ai=({className:e,ref:t,...n})=>{let{slots:r}=(0,Y.use)($);return(0,Q.jsx)(Wr,{ref:t,className:L(e,r?.cell()),"data-slot":`table-cell`,...n})};ai.displayName=`HeroUI.Table.Cell`;var oi=({className:e,...t})=>{let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(w.div,{className:V(n?.footer,e),"data-slot":`table-footer`,...t})};oi.displayName=`HeroUI.Table.Footer`;var si=({className:e,ref:t,...n})=>(0,Q.jsx)(_r,{ref:t,className:P(`table__resizable-container`,e),"data-slot":`table-resizable-container`,...n});si.displayName=`HeroUI.Table.ResizableContainer`;var ci=({className:e,ref:t,...n})=>{let{slots:r}=(0,Y.use)($);return(0,Q.jsx)(Pr,{ref:t,className:L(e,r?.columnResizer()),"data-slot":`table-column-resizer`,...n})};ci.displayName=`HeroUI.Table.ColumnResizer`;var li=({className:e,ref:t,...n})=>{let{slots:r}=(0,Y.use)($);return(0,Q.jsx)(Zr,{ref:t,className:V(r?.loadMore,e),"data-slot":`table-load-more`,...n})};li.displayName=`HeroUI.Table.LoadMore`;var ui=({className:e,...t})=>{let{slots:n}=(0,Y.use)($);return(0,Q.jsx)(w.div,{className:V(n?.loadMoreContent,e),"data-slot":`table-load-more-content`,...t})};ui.displayName=`HeroUI.Table.LoadMoreContent`;var di=({children:e,className:t,indicator:n,ref:r,showIndicator:i=!0,sortDirection:a,...o})=>{let{slots:c}=(0,Y.use)($),l=i&&!!a,u=null;if(l){if(n===void 0)u=(0,Q.jsx)(s,{className:c?.sortableColumnIndicator(),"data-direction":a,"data-slot":`table-sortable-column-indicator`});else if(Y.isValidElement(n)){let e=n;u=Y.cloneElement(e,{className:V(c?.sortableColumnIndicator,e.props.className),"data-direction":a,"data-slot":`table-sortable-column-indicator`})}else u=n}return(0,Q.jsxs)(`span`,{ref:r,className:V(c?.sortableColumnHeader,t),"data-direction":a,"data-slot":`table-sortable-column-header`,...o,children:[e,u]})};di.displayName=`HeroUI.Table.SortableColumnHeader`;var fi=Object.assign(Qr,{Body:ri,Cell:ai,Collection:d,Column:ni,ColumnResizer:ci,Content:ei,Footer:oi,Header:ti,LoadMore:li,LoadMoreContent:ui,ResizableContainer:si,Root:Qr,Row:ii,ScrollContainer:$r,SortableColumnHeader:di});export{fi as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/tabs-DrJPw_Nc.js b/internal/webui/static/assets/tabs-WTDlSXp1.js similarity index 97% rename from internal/webui/static/assets/tabs-DrJPw_Nc.js rename to internal/webui/static/assets/tabs-WTDlSXp1.js index 9d71d2af7..2068c993f 100644 --- a/internal/webui/static/assets/tabs-DrJPw_Nc.js +++ b/internal/webui/static/assets/tabs-WTDlSXp1.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{B as r,H as i,S as a,U as o,V as s,at as c,et as l,g as u,it as d,m as f,p,ut as m}from"./useI18n-XrvNxGvP.js";import{A as h,B as g,F as _,G as v,J as y,L as b,M as x,Y as ee,c as S,d as C,j as te,k as ne,l as re,lt as w,pt as T,q as E,s as D,t as ie,u as ae,y as oe,z as O}from"./SharedElementTransition-BlCsXfb1.js";import{o as k}from"./DragAndDrop-DdMlSxLf.js";import{o as se}from"./list-box-BtjELxmv.js";import{t as ce}from"./collection-prop-injection-Csmjb87v.js";import{t as le}from"./useHasTabbableChild-8WJt7azf.js";import{_t as ue,at as de,gt as A,mt as j,pt as M,ut as N,vt as P}from"./index-CAlyInAP.js";var F=O({defaultVariants:{hideScrollBar:!1,orientation:`vertical`,variant:`fade`},slots:{base:`scroll-shadow`},variants:{hideScrollBar:{false:{},true:{base:`scroll-shadow--hide-scrollbar`}},orientation:{horizontal:{base:`scroll-shadow--horizontal`},vertical:{base:`scroll-shadow--vertical`}},variant:{fade:{base:`scroll-shadow--fade`}}}}),I=O({defaultVariants:{variant:`primary`},slots:{base:`tabs`,scrollNext:`tabs__list-container__scroll-next`,scrollPrev:`tabs__list-container__scroll-prev`,scroller:`tabs__list-container__scroller`,separator:`tabs__separator`,tab:`tabs__tab`,tabIndicator:`tabs__indicator`,tabList:`tabs__list`,tabListContainer:`tabs__list-container`,tabPanel:`tabs__panel`},variants:{variant:{primary:{},secondary:{base:`tabs--secondary`}}}}),L=t(e(),1),R=e=>{let{containerRef:t,isEnabled:n,offset:r,onVisibilityChange:i,orientation:a,visibility:o}=e,s=(0,L.useRef)(null),c=(0,L.useRef)(null),l=(0,L.useCallback)(()=>{let e=t.current;if(!e)return;let n=a===`vertical`,o=n?e.scrollTop:Math.abs(e.scrollLeft),l=n?e.scrollHeight:e.scrollWidth,u=n?e.clientHeight:e.clientWidth,d=o>r,f=o+u+r{c.current=null,n?d&&f?(e.dataset.topBottomScroll=`true`,delete e.dataset.topScroll,delete e.dataset.bottomScroll,i?.(`both`)):(e.dataset.topScroll=String(d),e.dataset.bottomScroll=String(f),delete e.dataset.topBottomScroll,i&&i(d?`top`:f?`bottom`:`none`)):d&&f?(e.dataset.leftRightScroll=`true`,delete e.dataset.leftScroll,delete e.dataset.rightScroll,i?.(`both`)):(e.dataset.leftScroll=String(d),e.dataset.rightScroll=String(f),delete e.dataset.leftRightScroll,i&&i(d?`left`:f?`right`:`none`))}))},[t,a,r,i]);(0,L.useEffect)(()=>{let e=t.current;if(!e||!n||o!==`auto`)return;l(),e.addEventListener(`scroll`,l,{passive:!0});let r=new ResizeObserver(l);return r.observe(e),()=>{e.removeEventListener(`scroll`,l),r.disconnect(),c.current!==null&&(cancelAnimationFrame(c.current),c.current=null),s.current=null}},[t,o,n,l])},z=globalThis?.document?L.useLayoutEffect:L.useEffect,B=n(),V=({children:e,className:t,hideScrollBar:n=!1,isEnabled:r=!0,offset:i=0,onVisibilityChange:a,orientation:o=`vertical`,ref:s,size:c=40,variant:l=`fade`,visibility:u=`auto`,...d})=>{let f=(0,L.useRef)(null);R({containerRef:f,isEnabled:r,offset:i,onVisibilityChange:a,orientation:o,visibility:u}),z(()=>{let e=f.current;!e||u===`auto`||(delete e.dataset.topScroll,delete e.dataset.bottomScroll,delete e.dataset.topBottomScroll,delete e.dataset.leftScroll,delete e.dataset.rightScroll,delete e.dataset.leftRightScroll,u===`both`?e.dataset[o===`vertical`?`topBottomScroll`:`leftRightScroll`]=`true`:u!==`none`&&(e.dataset[`${u}Scroll`]=`true`))},[u,o]);let p=(0,L.useMemo)(()=>F({hideScrollBar:n,orientation:o,variant:l}),[o,n,l]),m={"--scroll-shadow-size":`${c}px`,...d.style};return(0,B.jsx)(`div`,{ref:ee(f,s),className:p.base({className:t}),"data-orientation":o,"data-scroll-shadow-size":c,"data-slot":`scroll-shadow`,style:m,...d,children:e})};V.displayName=`HeroUI.ScrollShadow`;var H=Object.assign(V,{Root:V}),U=new WeakMap;function W(e,t,n){return e?(typeof t==`string`&&(t=t.replace(/\s+/g,``)),`${U.get(e)}-${n}-${t}`):``}function fe(e,t,n){let{key:r,isDisabled:i,shouldSelectOnPressUp:a}=e,{selectionManager:o,selectedKey:s}=t,c=r===s,l=i||t.isDisabled||t.selectionManager.isDisabled(r),u=t.collection.getItem(r),{itemProps:d,isPressed:f}=de({selectionManager:o,key:r,ref:n,isDisabled:l,shouldSelectOnPressUp:a??u?.props.href!=null,linkBehavior:`selection`}),p=W(t,r,`tab`),m=W(t,r,`tabpanel`),{tabIndex:h}=d,g=E(u?.props,{labelable:!0});delete g.id;let _=T(u?.props),{focusableProps:v}=oe({...u?.props,isDisabled:l},n);return{tabProps:y(g,v,_,d,{id:p,"aria-selected":c,"aria-disabled":l||void 0,"aria-controls":c?m:void 0,tabIndex:l?void 0:h,role:`tab`}),isSelected:c,isDisabled:l,isPressed:f}}function pe(e,t,n){let r=le(n)?void 0:0,i=W(t,e.id??t?.selectedKey,`tabpanel`),a=m({...e,id:i,"aria-labelledby":W(t,t?.selectedKey,`tab`)});return{tabPanelProps:y(a,{tabIndex:r,role:`tabpanel`,"aria-describedby":e[`aria-describedby`],"aria-details":e[`aria-details`]})}}var me=class{constructor(e,t,n,r=new Set){this.collection=e,this.flipDirection=t===`rtl`&&n===`horizontal`,this.disabledKeys=r,this.tabDirection=n===`horizontal`}getKeyLeftOf(e){return this.flipDirection?this.getNextKey(e):this.getPreviousKey(e)}getKeyRightOf(e){return this.flipDirection?this.getPreviousKey(e):this.getNextKey(e)}isDisabled(e){return this.disabledKeys.has(e)||!!this.collection.getItem(e)?.props?.isDisabled}getFirstKey(){let e=this.collection.getFirstKey();return e!=null&&this.isDisabled(e)&&(e=this.getNextKey(e)),e}getLastKey(){let e=this.collection.getLastKey();return e!=null&&this.isDisabled(e)&&(e=this.getPreviousKey(e)),e}getKeyAbove(e){return this.tabDirection?null:this.getPreviousKey(e)}getKeyBelow(e){return this.tabDirection?null:this.getNextKey(e)}getNextKey(e){let t=e;do t=this.collection.getKeyAfter(t),t??=this.collection.getFirstKey();while(t!=null&&this.isDisabled(t)&&t!==e);return t}getPreviousKey(e){let t=e;do t=this.collection.getKeyBefore(t),t??=this.collection.getLastKey();while(t!=null&&this.isDisabled(t)&&t!==e);return t}};function he(e,t,n){let{orientation:r=`horizontal`,keyboardActivation:i=`automatic`}=e,{collection:a,selectionManager:o,disabledKeys:s}=t,{direction:c}=ne(),l=(0,L.useMemo)(()=>new me(a,c,r,s),[a,s,r,c]),{collectionProps:u}=N({ref:n,selectionManager:o,keyboardDelegate:l,selectOnFocus:i===`automatic`,disallowEmptySelection:!0,scrollRef:n,linkBehavior:`selection`}),d=w();U.set(t,d);let f=m({...e,id:d});return{tabListProps:{...y(u,f),role:`tablist`,"aria-orientation":r,tabIndex:void 0}}}function ge(e){let[t,n]=re(e.selectedKey,e.defaultSelectedKey??null,e.onSelectionChange),r=(0,L.useMemo)(()=>t==null?[]:[t],[t]),{collection:i,disabledKeys:a,selectionManager:o}=se({...e,selectionMode:`single`,disallowEmptySelection:!0,allowDuplicateSelectionEvents:!0,selectedKeys:r,onSelectionChange:r=>{if(r===`all`)return;let i=r.values().next().value??null;i===t&&e.onSelectionChange&&e.onSelectionChange(i),n(i)}});return{collection:i,disabledKeys:a,selectionManager:o,selectedKey:t,setSelectedKey:n,selectedItem:t==null?null:i.getItem(t)}}function _e(e){let t=ge({...e,onSelectionChange:e.onSelectionChange?t=>{t!=null&&e.onSelectionChange?.(t)}:void 0,suppressTextValueWarning:!0,defaultSelectedKey:e.defaultSelectedKey??G(e.collection,e.disabledKeys?new Set(e.disabledKeys):new Set)??void 0}),{selectionManager:n,collection:r,selectedKey:i}=t,a=(0,L.useRef)(i);return(0,L.useEffect)(()=>{let o=i;e.selectedKey==null&&(n.isEmpty||o==null||!r.getItem(o))&&(o=G(r,t.disabledKeys),o!=null&&n.setSelectedKeys([o])),(o!=null&&n.focusedKey==null||!n.isFocused&&o!==a.current)&&n.setFocusedKey(o),a.current=o}),{...t,isDisabled:e.isDisabled||!1}}function G(e,t){let n=null;if(e){for(n=e.getFirstKey();n!=null&&(t.has(n)||e.getItem(n)?.props?.isDisabled)&&n!==e.getLastKey();)n=e.getKeyAfter(n);n!=null&&(t.has(n)||e.getItem(n)?.props?.isDisabled)&&n===e.getLastKey()&&(n=e.getFirstKey())}return n}var K=(0,L.createContext)(null),q=(0,L.createContext)(null),ve=(0,L.forwardRef)(function(e,t){[e,t]=te(e,t,K);let{children:n,orientation:r=`horizontal`}=e;return n=(0,L.useMemo)(()=>typeof n==`function`?n({orientation:r,defaultChildren:null}):n,[n,r]),L.createElement(f,{content:n},n=>L.createElement(ye,{props:e,collection:n,tabsRef:t}))});function ye({props:e,tabsRef:t,collection:n}){let{orientation:r=`horizontal`}=e,i=_e({...e,collection:n,children:void 0}),{focusProps:a,isFocused:o,isFocusVisible:s}=C({within:!0}),c=(0,L.useMemo)(()=>({orientation:r,isFocusWithin:o,isFocusVisible:s}),[r,o,s]),l=x({...e,defaultClassName:`react-aria-Tabs`,values:c}),u=E(e,{global:!0});return L.createElement(_.div,{...y(u,l,a),ref:t,slot:e.slot||void 0,"data-focused":o||void 0,"data-orientation":r,"data-focus-visible":s||void 0,"data-disabled":i.isDisabled||void 0},L.createElement(h,{values:[[K,e],[q,i]]},l.children))}var J=(0,L.forwardRef)(function(e,t){return(0,L.useContext)(q)?L.createElement(be,{props:e,forwardedRef:t}):L.createElement(u,e)});function be({props:e,forwardedRef:t}){let n=(0,L.useContext)(q),{CollectionRoot:r}=(0,L.useContext)(A),{orientation:i=`horizontal`,keyboardActivation:a=`automatic`}=b(K),o=v(t),{tabListProps:s}=he({...e,orientation:i,keyboardActivation:a},n,o),c=x({...e,children:null,defaultClassName:`react-aria-TabList`,values:{orientation:i,state:n}}),l=E(e,{global:!0});return delete l.id,L.createElement(_.div,{...y(l,c,s),ref:o,"data-orientation":i||void 0},L.createElement(ie,null,L.createElement(r,{collection:n.collection,persistedKeys:ue(n.selectionManager.focusedKey)})))}var xe=class extends a{static{this.type=`item`}},Se=p(xe,(e,t,n)=>{let r=(0,L.useContext)(q),i=v(t),{tabProps:a,isSelected:o,isDisabled:s,isPressed:c}=fe({key:n.key,...e},r,i),{focusProps:l,isFocused:u,isFocusVisible:d}=C(),{hoverProps:f,isHovered:p}=ae({isDisabled:s,onHoverStart:e.onHoverStart,onHoverEnd:e.onHoverEnd,onHoverChange:e.onHoverChange}),m=x({...e,id:void 0,children:n.rendered,defaultClassName:`react-aria-Tab`,values:{isSelected:o,isDisabled:s,isFocused:u,isFocusVisible:d,isPressed:c,isHovered:p}}),h=n.props.href?_.a:_.div,g=E(e,{global:!0});return delete g.id,delete g.onClick,L.createElement(h,{...y(g,m,a,l,f),ref:i,"data-selected":o||void 0,"data-disabled":s||void 0,"data-focused":u||void 0,"data-focus-visible":d||void 0,"data-pressed":c||void 0,"data-hovered":p||void 0},L.createElement(j.Provider,{value:{isSelected:o}},m.children))}),Ce=l(function(e,t){let n=(0,L.useContext)(q),r=v(t),i=n.selectedKey===e.id,[a,o]=(0,L.useState)(n.selectedKey==null?null:i);a==null&&n.selectedKey!=null?o(i):!i&&a&&o(!1);let s=d(r,i);return!i&&!e.shouldForceMount&&!s?null:L.createElement(we,{...e,tabPanelRef:r,isInitiallySelected:a||!1,isExiting:s})});function we(e){let t=(0,L.useContext)(q),{id:n,tabPanelRef:r,isInitiallySelected:i,isExiting:a,...o}=e,{tabPanelProps:s}=pe(e,t,r),{focusProps:l,isFocused:u,isFocusVisible:d}=C(),f=t.selectedKey===e.id,p=c(r)&&!i,m=x({...e,defaultClassName:`react-aria-TabPanel`,values:{isFocused:u,isFocusVisible:d,isInert:k(!f),isEntering:p,isExiting:a,state:t}}),g=E(o,{global:!0});delete g.id;let v=f?y(g,s,l,m):y(g,m);return L.createElement(_.div,{...v,ref:r,"data-focused":u||void 0,"data-focus-visible":d||void 0,inert:k(!f||e.inert),"data-inert":f?void 0:`true`,"data-entering":p||void 0,"data-exiting":a||void 0},L.createElement(h,{values:[[K,null],[q,null]]},L.createElement(A.Provider,{value:P},m.children)))}var Y=(0,L.createContext)({}),X=ce(`tabs.listContainer`),Z=({children:e,className:t,orientation:n=`horizontal`,variant:r,...i})=>{let a=L.useMemo(()=>I({variant:r}),[r]);return(0,B.jsx)(Y,{value:{orientation:n,slots:a},children:(0,B.jsx)(ve,{...i,className:S(t,a.base()),"data-slot":`tabs`,orientation:n,children:e})})},Q=({children:e,className:t,render:n,...r})=>(0,B.jsx)(X.Injector,{...r,className:t,render:n,children:e}),Te=({children:e,className:t,...n})=>{let{orientation:a=`horizontal`,slots:c}=(0,L.use)(Y),l=(0,L.useRef)(null),u=a===`vertical`,[d,f]=X.useSlot(n),p=(0,L.useCallback)(e=>{let t=l.current;if(!t)return;let n=u?t.clientHeight:t.clientWidth,r=u?t.scrollHeight:t.scrollWidth,i=Math.max(0,r-n),a=!u&&getComputedStyle(t).direction===`rtl`,o=e*n*.8*(a?-1:1),s=u?t.scrollTop:t.scrollLeft,c=Math.min(a?0:i,Math.max(a?-i:0,s+o));c!==s&&t.scrollTo({behavior:`smooth`,[u?`top`:`left`]:c})},[u]);if(!d)return(0,B.jsx)(J,{...f,className:S(t,c?.tabList()),"data-slot":`tabs-list`,children:e});let{className:m,render:h,..._}=d;return(0,B.jsx)(J,{...f,className:S(t,c?.tabList()),"data-slot":`tabs-list`,render:e=>{let{children:t,className:n,ref:d,...f}=e;return(0,B.jsxs)(g.div,{className:D(c?.tabListContainer,m),"data-slot":`tabs-list-container`,render:h,..._,children:[(0,B.jsx)(H,{ref:l,hideScrollBar:!0,className:D(c?.scroller),orientation:a,size:64,children:(0,B.jsx)(`div`,{...f,ref:d,className:n,children:t})}),(0,B.jsx)(`button`,{"aria-label":u?`Scroll tabs up`:`Scroll tabs left`,className:D(c?.scrollPrev),tabIndex:-1,type:`button`,onClick:()=>p(-1),children:u?(0,B.jsx)(o,{}):(0,B.jsx)(s,{})}),(0,B.jsx)(`button`,{"aria-label":u?`Scroll tabs down`:`Scroll tabs right`,className:D(c?.scrollNext),tabIndex:-1,type:`button`,onClick:()=>p(1),children:u?(0,B.jsx)(r,{}):(0,B.jsx)(i,{})})]})},children:e})},$=({children:e,className:t,...n})=>{let{slots:r}=(0,L.use)(Y);return(0,B.jsx)(Se,{...n,className:S(t,r?.tab()),"data-slot":`tabs-tab`,children:e})},Ee=Object.assign(Z,{Root:Z,ListContainer:Q,List:Te,Tab:$,Indicator:({className:e,...t})=>{let{slots:n}=(0,L.use)(Y);return(0,B.jsx)(M,{className:D(n?.tabIndicator,e),"data-slot":`tabs-indicator`,...t})},Separator:({className:e,...t})=>{let{slots:n}=(0,L.use)(Y);return(0,B.jsx)(g.span,{"aria-hidden":`true`,className:D(n?.separator,e),"data-slot":`tabs-separator`,...t})},Panel:({children:e,className:t,...n})=>{let{slots:r}=(0,L.use)(Y);return(0,B.jsx)(Ce,{...n,className:S(t,r?.tabPanel()),"data-slot":`tabs-panel`,children:e})}});export{$ as n,Ee as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{B as r,H as i,S as a,U as o,V as s,at as c,et as l,g as u,it as d,m as f,p,ut as m}from"./useI18n-BAo1UrJW.js";import{A as h,B as g,F as _,G as v,J as y,L as b,M as x,Y as ee,c as S,d as C,j as te,k as ne,l as re,lt as w,pt as T,q as E,s as D,t as ie,u as ae,y as oe,z as O}from"./SharedElementTransition-BlCsXfb1.js";import{o as k}from"./DragAndDrop-QLaADEWb.js";import{o as se}from"./list-box-DbrQLYNo.js";import{t as ce}from"./collection-prop-injection-B6_r67VF.js";import{t as le}from"./useHasTabbableChild-8WJt7azf.js";import{_t as ue,at as de,gt as A,mt as j,pt as M,ut as N,vt as P}from"./index-CWTBzWuK.js";var F=O({defaultVariants:{hideScrollBar:!1,orientation:`vertical`,variant:`fade`},slots:{base:`scroll-shadow`},variants:{hideScrollBar:{false:{},true:{base:`scroll-shadow--hide-scrollbar`}},orientation:{horizontal:{base:`scroll-shadow--horizontal`},vertical:{base:`scroll-shadow--vertical`}},variant:{fade:{base:`scroll-shadow--fade`}}}}),I=O({defaultVariants:{variant:`primary`},slots:{base:`tabs`,scrollNext:`tabs__list-container__scroll-next`,scrollPrev:`tabs__list-container__scroll-prev`,scroller:`tabs__list-container__scroller`,separator:`tabs__separator`,tab:`tabs__tab`,tabIndicator:`tabs__indicator`,tabList:`tabs__list`,tabListContainer:`tabs__list-container`,tabPanel:`tabs__panel`},variants:{variant:{primary:{},secondary:{base:`tabs--secondary`}}}}),L=t(e(),1),R=e=>{let{containerRef:t,isEnabled:n,offset:r,onVisibilityChange:i,orientation:a,visibility:o}=e,s=(0,L.useRef)(null),c=(0,L.useRef)(null),l=(0,L.useCallback)(()=>{let e=t.current;if(!e)return;let n=a===`vertical`,o=n?e.scrollTop:Math.abs(e.scrollLeft),l=n?e.scrollHeight:e.scrollWidth,u=n?e.clientHeight:e.clientWidth,d=o>r,f=o+u+r{c.current=null,n?d&&f?(e.dataset.topBottomScroll=`true`,delete e.dataset.topScroll,delete e.dataset.bottomScroll,i?.(`both`)):(e.dataset.topScroll=String(d),e.dataset.bottomScroll=String(f),delete e.dataset.topBottomScroll,i&&i(d?`top`:f?`bottom`:`none`)):d&&f?(e.dataset.leftRightScroll=`true`,delete e.dataset.leftScroll,delete e.dataset.rightScroll,i?.(`both`)):(e.dataset.leftScroll=String(d),e.dataset.rightScroll=String(f),delete e.dataset.leftRightScroll,i&&i(d?`left`:f?`right`:`none`))}))},[t,a,r,i]);(0,L.useEffect)(()=>{let e=t.current;if(!e||!n||o!==`auto`)return;l(),e.addEventListener(`scroll`,l,{passive:!0});let r=new ResizeObserver(l);return r.observe(e),()=>{e.removeEventListener(`scroll`,l),r.disconnect(),c.current!==null&&(cancelAnimationFrame(c.current),c.current=null),s.current=null}},[t,o,n,l])},z=globalThis?.document?L.useLayoutEffect:L.useEffect,B=n(),V=({children:e,className:t,hideScrollBar:n=!1,isEnabled:r=!0,offset:i=0,onVisibilityChange:a,orientation:o=`vertical`,ref:s,size:c=40,variant:l=`fade`,visibility:u=`auto`,...d})=>{let f=(0,L.useRef)(null);R({containerRef:f,isEnabled:r,offset:i,onVisibilityChange:a,orientation:o,visibility:u}),z(()=>{let e=f.current;!e||u===`auto`||(delete e.dataset.topScroll,delete e.dataset.bottomScroll,delete e.dataset.topBottomScroll,delete e.dataset.leftScroll,delete e.dataset.rightScroll,delete e.dataset.leftRightScroll,u===`both`?e.dataset[o===`vertical`?`topBottomScroll`:`leftRightScroll`]=`true`:u!==`none`&&(e.dataset[`${u}Scroll`]=`true`))},[u,o]);let p=(0,L.useMemo)(()=>F({hideScrollBar:n,orientation:o,variant:l}),[o,n,l]),m={"--scroll-shadow-size":`${c}px`,...d.style};return(0,B.jsx)(`div`,{ref:ee(f,s),className:p.base({className:t}),"data-orientation":o,"data-scroll-shadow-size":c,"data-slot":`scroll-shadow`,style:m,...d,children:e})};V.displayName=`HeroUI.ScrollShadow`;var H=Object.assign(V,{Root:V}),U=new WeakMap;function W(e,t,n){return e?(typeof t==`string`&&(t=t.replace(/\s+/g,``)),`${U.get(e)}-${n}-${t}`):``}function fe(e,t,n){let{key:r,isDisabled:i,shouldSelectOnPressUp:a}=e,{selectionManager:o,selectedKey:s}=t,c=r===s,l=i||t.isDisabled||t.selectionManager.isDisabled(r),u=t.collection.getItem(r),{itemProps:d,isPressed:f}=de({selectionManager:o,key:r,ref:n,isDisabled:l,shouldSelectOnPressUp:a??u?.props.href!=null,linkBehavior:`selection`}),p=W(t,r,`tab`),m=W(t,r,`tabpanel`),{tabIndex:h}=d,g=E(u?.props,{labelable:!0});delete g.id;let _=T(u?.props),{focusableProps:v}=oe({...u?.props,isDisabled:l},n);return{tabProps:y(g,v,_,d,{id:p,"aria-selected":c,"aria-disabled":l||void 0,"aria-controls":c?m:void 0,tabIndex:l?void 0:h,role:`tab`}),isSelected:c,isDisabled:l,isPressed:f}}function pe(e,t,n){let r=le(n)?void 0:0,i=W(t,e.id??t?.selectedKey,`tabpanel`),a=m({...e,id:i,"aria-labelledby":W(t,t?.selectedKey,`tab`)});return{tabPanelProps:y(a,{tabIndex:r,role:`tabpanel`,"aria-describedby":e[`aria-describedby`],"aria-details":e[`aria-details`]})}}var me=class{constructor(e,t,n,r=new Set){this.collection=e,this.flipDirection=t===`rtl`&&n===`horizontal`,this.disabledKeys=r,this.tabDirection=n===`horizontal`}getKeyLeftOf(e){return this.flipDirection?this.getNextKey(e):this.getPreviousKey(e)}getKeyRightOf(e){return this.flipDirection?this.getPreviousKey(e):this.getNextKey(e)}isDisabled(e){return this.disabledKeys.has(e)||!!this.collection.getItem(e)?.props?.isDisabled}getFirstKey(){let e=this.collection.getFirstKey();return e!=null&&this.isDisabled(e)&&(e=this.getNextKey(e)),e}getLastKey(){let e=this.collection.getLastKey();return e!=null&&this.isDisabled(e)&&(e=this.getPreviousKey(e)),e}getKeyAbove(e){return this.tabDirection?null:this.getPreviousKey(e)}getKeyBelow(e){return this.tabDirection?null:this.getNextKey(e)}getNextKey(e){let t=e;do t=this.collection.getKeyAfter(t),t??=this.collection.getFirstKey();while(t!=null&&this.isDisabled(t)&&t!==e);return t}getPreviousKey(e){let t=e;do t=this.collection.getKeyBefore(t),t??=this.collection.getLastKey();while(t!=null&&this.isDisabled(t)&&t!==e);return t}};function he(e,t,n){let{orientation:r=`horizontal`,keyboardActivation:i=`automatic`}=e,{collection:a,selectionManager:o,disabledKeys:s}=t,{direction:c}=ne(),l=(0,L.useMemo)(()=>new me(a,c,r,s),[a,s,r,c]),{collectionProps:u}=N({ref:n,selectionManager:o,keyboardDelegate:l,selectOnFocus:i===`automatic`,disallowEmptySelection:!0,scrollRef:n,linkBehavior:`selection`}),d=w();U.set(t,d);let f=m({...e,id:d});return{tabListProps:{...y(u,f),role:`tablist`,"aria-orientation":r,tabIndex:void 0}}}function ge(e){let[t,n]=re(e.selectedKey,e.defaultSelectedKey??null,e.onSelectionChange),r=(0,L.useMemo)(()=>t==null?[]:[t],[t]),{collection:i,disabledKeys:a,selectionManager:o}=se({...e,selectionMode:`single`,disallowEmptySelection:!0,allowDuplicateSelectionEvents:!0,selectedKeys:r,onSelectionChange:r=>{if(r===`all`)return;let i=r.values().next().value??null;i===t&&e.onSelectionChange&&e.onSelectionChange(i),n(i)}});return{collection:i,disabledKeys:a,selectionManager:o,selectedKey:t,setSelectedKey:n,selectedItem:t==null?null:i.getItem(t)}}function _e(e){let t=ge({...e,onSelectionChange:e.onSelectionChange?t=>{t!=null&&e.onSelectionChange?.(t)}:void 0,suppressTextValueWarning:!0,defaultSelectedKey:e.defaultSelectedKey??G(e.collection,e.disabledKeys?new Set(e.disabledKeys):new Set)??void 0}),{selectionManager:n,collection:r,selectedKey:i}=t,a=(0,L.useRef)(i);return(0,L.useEffect)(()=>{let o=i;e.selectedKey==null&&(n.isEmpty||o==null||!r.getItem(o))&&(o=G(r,t.disabledKeys),o!=null&&n.setSelectedKeys([o])),(o!=null&&n.focusedKey==null||!n.isFocused&&o!==a.current)&&n.setFocusedKey(o),a.current=o}),{...t,isDisabled:e.isDisabled||!1}}function G(e,t){let n=null;if(e){for(n=e.getFirstKey();n!=null&&(t.has(n)||e.getItem(n)?.props?.isDisabled)&&n!==e.getLastKey();)n=e.getKeyAfter(n);n!=null&&(t.has(n)||e.getItem(n)?.props?.isDisabled)&&n===e.getLastKey()&&(n=e.getFirstKey())}return n}var K=(0,L.createContext)(null),q=(0,L.createContext)(null),ve=(0,L.forwardRef)(function(e,t){[e,t]=te(e,t,K);let{children:n,orientation:r=`horizontal`}=e;return n=(0,L.useMemo)(()=>typeof n==`function`?n({orientation:r,defaultChildren:null}):n,[n,r]),L.createElement(f,{content:n},n=>L.createElement(ye,{props:e,collection:n,tabsRef:t}))});function ye({props:e,tabsRef:t,collection:n}){let{orientation:r=`horizontal`}=e,i=_e({...e,collection:n,children:void 0}),{focusProps:a,isFocused:o,isFocusVisible:s}=C({within:!0}),c=(0,L.useMemo)(()=>({orientation:r,isFocusWithin:o,isFocusVisible:s}),[r,o,s]),l=x({...e,defaultClassName:`react-aria-Tabs`,values:c}),u=E(e,{global:!0});return L.createElement(_.div,{...y(u,l,a),ref:t,slot:e.slot||void 0,"data-focused":o||void 0,"data-orientation":r,"data-focus-visible":s||void 0,"data-disabled":i.isDisabled||void 0},L.createElement(h,{values:[[K,e],[q,i]]},l.children))}var J=(0,L.forwardRef)(function(e,t){return(0,L.useContext)(q)?L.createElement(be,{props:e,forwardedRef:t}):L.createElement(u,e)});function be({props:e,forwardedRef:t}){let n=(0,L.useContext)(q),{CollectionRoot:r}=(0,L.useContext)(A),{orientation:i=`horizontal`,keyboardActivation:a=`automatic`}=b(K),o=v(t),{tabListProps:s}=he({...e,orientation:i,keyboardActivation:a},n,o),c=x({...e,children:null,defaultClassName:`react-aria-TabList`,values:{orientation:i,state:n}}),l=E(e,{global:!0});return delete l.id,L.createElement(_.div,{...y(l,c,s),ref:o,"data-orientation":i||void 0},L.createElement(ie,null,L.createElement(r,{collection:n.collection,persistedKeys:ue(n.selectionManager.focusedKey)})))}var xe=class extends a{static{this.type=`item`}},Se=p(xe,(e,t,n)=>{let r=(0,L.useContext)(q),i=v(t),{tabProps:a,isSelected:o,isDisabled:s,isPressed:c}=fe({key:n.key,...e},r,i),{focusProps:l,isFocused:u,isFocusVisible:d}=C(),{hoverProps:f,isHovered:p}=ae({isDisabled:s,onHoverStart:e.onHoverStart,onHoverEnd:e.onHoverEnd,onHoverChange:e.onHoverChange}),m=x({...e,id:void 0,children:n.rendered,defaultClassName:`react-aria-Tab`,values:{isSelected:o,isDisabled:s,isFocused:u,isFocusVisible:d,isPressed:c,isHovered:p}}),h=n.props.href?_.a:_.div,g=E(e,{global:!0});return delete g.id,delete g.onClick,L.createElement(h,{...y(g,m,a,l,f),ref:i,"data-selected":o||void 0,"data-disabled":s||void 0,"data-focused":u||void 0,"data-focus-visible":d||void 0,"data-pressed":c||void 0,"data-hovered":p||void 0},L.createElement(j.Provider,{value:{isSelected:o}},m.children))}),Ce=l(function(e,t){let n=(0,L.useContext)(q),r=v(t),i=n.selectedKey===e.id,[a,o]=(0,L.useState)(n.selectedKey==null?null:i);a==null&&n.selectedKey!=null?o(i):!i&&a&&o(!1);let s=d(r,i);return!i&&!e.shouldForceMount&&!s?null:L.createElement(we,{...e,tabPanelRef:r,isInitiallySelected:a||!1,isExiting:s})});function we(e){let t=(0,L.useContext)(q),{id:n,tabPanelRef:r,isInitiallySelected:i,isExiting:a,...o}=e,{tabPanelProps:s}=pe(e,t,r),{focusProps:l,isFocused:u,isFocusVisible:d}=C(),f=t.selectedKey===e.id,p=c(r)&&!i,m=x({...e,defaultClassName:`react-aria-TabPanel`,values:{isFocused:u,isFocusVisible:d,isInert:k(!f),isEntering:p,isExiting:a,state:t}}),g=E(o,{global:!0});delete g.id;let v=f?y(g,s,l,m):y(g,m);return L.createElement(_.div,{...v,ref:r,"data-focused":u||void 0,"data-focus-visible":d||void 0,inert:k(!f||e.inert),"data-inert":f?void 0:`true`,"data-entering":p||void 0,"data-exiting":a||void 0},L.createElement(h,{values:[[K,null],[q,null]]},L.createElement(A.Provider,{value:P},m.children)))}var Y=(0,L.createContext)({}),X=ce(`tabs.listContainer`),Z=({children:e,className:t,orientation:n=`horizontal`,variant:r,...i})=>{let a=L.useMemo(()=>I({variant:r}),[r]);return(0,B.jsx)(Y,{value:{orientation:n,slots:a},children:(0,B.jsx)(ve,{...i,className:S(t,a.base()),"data-slot":`tabs`,orientation:n,children:e})})},Q=({children:e,className:t,render:n,...r})=>(0,B.jsx)(X.Injector,{...r,className:t,render:n,children:e}),Te=({children:e,className:t,...n})=>{let{orientation:a=`horizontal`,slots:c}=(0,L.use)(Y),l=(0,L.useRef)(null),u=a===`vertical`,[d,f]=X.useSlot(n),p=(0,L.useCallback)(e=>{let t=l.current;if(!t)return;let n=u?t.clientHeight:t.clientWidth,r=u?t.scrollHeight:t.scrollWidth,i=Math.max(0,r-n),a=!u&&getComputedStyle(t).direction===`rtl`,o=e*n*.8*(a?-1:1),s=u?t.scrollTop:t.scrollLeft,c=Math.min(a?0:i,Math.max(a?-i:0,s+o));c!==s&&t.scrollTo({behavior:`smooth`,[u?`top`:`left`]:c})},[u]);if(!d)return(0,B.jsx)(J,{...f,className:S(t,c?.tabList()),"data-slot":`tabs-list`,children:e});let{className:m,render:h,..._}=d;return(0,B.jsx)(J,{...f,className:S(t,c?.tabList()),"data-slot":`tabs-list`,render:e=>{let{children:t,className:n,ref:d,...f}=e;return(0,B.jsxs)(g.div,{className:D(c?.tabListContainer,m),"data-slot":`tabs-list-container`,render:h,..._,children:[(0,B.jsx)(H,{ref:l,hideScrollBar:!0,className:D(c?.scroller),orientation:a,size:64,children:(0,B.jsx)(`div`,{...f,ref:d,className:n,children:t})}),(0,B.jsx)(`button`,{"aria-label":u?`Scroll tabs up`:`Scroll tabs left`,className:D(c?.scrollPrev),tabIndex:-1,type:`button`,onClick:()=>p(-1),children:u?(0,B.jsx)(o,{}):(0,B.jsx)(s,{})}),(0,B.jsx)(`button`,{"aria-label":u?`Scroll tabs down`:`Scroll tabs right`,className:D(c?.scrollNext),tabIndex:-1,type:`button`,onClick:()=>p(1),children:u?(0,B.jsx)(r,{}):(0,B.jsx)(i,{})})]})},children:e})},$=({children:e,className:t,...n})=>{let{slots:r}=(0,L.use)(Y);return(0,B.jsx)(Se,{...n,className:S(t,r?.tab()),"data-slot":`tabs-tab`,children:e})},Ee=Object.assign(Z,{Root:Z,ListContainer:Q,List:Te,Tab:$,Indicator:({className:e,...t})=>{let{slots:n}=(0,L.use)(Y);return(0,B.jsx)(M,{className:D(n?.tabIndicator,e),"data-slot":`tabs-indicator`,...t})},Separator:({className:e,...t})=>{let{slots:n}=(0,L.use)(Y);return(0,B.jsx)(g.span,{"aria-hidden":`true`,className:D(n?.separator,e),"data-slot":`tabs-separator`,...t})},Panel:({children:e,className:t,...n})=>{let{slots:r}=(0,L.use)(Y);return(0,B.jsx)(Ce,{...n,className:S(t,r?.tabPanel()),"data-slot":`tabs-panel`,children:e})}});export{$ as n,Ee as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/textfield-BGZ3lXZC.js b/internal/webui/static/assets/textfield-BRcQ6Tsg.js similarity index 90% rename from internal/webui/static/assets/textfield-BGZ3lXZC.js rename to internal/webui/static/assets/textfield-BRcQ6Tsg.js index 37b0c4098..dcc8c0e9e 100644 --- a/internal/webui/static/assets/textfield-BGZ3lXZC.js +++ b/internal/webui/static/assets/textfield-BRcQ6Tsg.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r,et as i,l as a}from"./useI18n-XrvNxGvP.js";import{A as o,F as s,I as c,J as l,L as u,M as d,N as f,c as p,d as m,j as h,q as g,u as _,z as v}from"./SharedElementTransition-BlCsXfb1.js";import{a as y,d as b,f as x}from"./label-B8hTan2F.js";import{a as S,t as C}from"./Input-CyXcxaPW.js";import{t as w}from"./useTextField-i0qH61mD.js";var T=v({base:`textfield`,defaultVariants:{fullWidth:!1},variants:{fullWidth:{false:``,true:`textfield--full-width`}}}),E=t(e(),1),D=(0,E.createContext)({}),O=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i},k=(0,E.forwardRef)(function(e,t){[e,t]=h(e,t,D);let{hoverProps:n,isHovered:r}=_(e),{isFocused:i,isFocusVisible:a,focusProps:o}=m({isTextInput:!0,autoFocus:e.autoFocus}),c=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,u=d({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:c},defaultClassName:`react-aria-TextArea`});return E.createElement(s.textarea,{...l(O(e),o,n),...u,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":c||void 0})}),A=(0,E.createContext)(null),j=i(function(e,t){[e,t]=h(e,t,A);let{validationBehavior:n}=u(y)||{},i=e.validationBehavior??n??`native`,l=(0,E.useRef)(null);[e,l]=h(e,l,a);let[p,m]=f(!e[`aria-label`]&&!e[`aria-labelledby`]),[_,v]=(0,E.useState)(`input`),{labelProps:T,inputProps:O,descriptionProps:k,errorMessageProps:j,...M}=w({...c(e),inputElementType:_,label:m,validationBehavior:i},l),N=(0,E.useCallback)(e=>{l.current=e,e&&v(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[l]),P=d({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:M.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),F=g(e,{global:!0});return delete F.id,E.createElement(s.div,{...F,...P,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":M.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},E.createElement(o,{values:[[x,{...T,ref:p}],[C,{...O,ref:N}],[D,{...O,ref:N}],[S,{role:`presentation`,isInvalid:M.isInvalid,isDisabled:e.isDisabled||!1}],[r,{slots:{description:k,errorMessage:j}}],[b,M]]},P.children))}),M=n(),N=(0,E.createContext)({}),P=({children:e,className:t,fullWidth:n,variant:r,...i})=>{let a=E.useMemo(()=>T({fullWidth:n}),[n]);return(0,M.jsx)(j,{"data-slot":`textfield`,...i,className:p(t,a),children:t=>(0,M.jsx)(N,{value:{variant:r},children:(0,M.jsx)(M.Fragment,{children:typeof e==`function`?e(t):e})})})};export{P as n,k as r,N as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{a as r,et as i,l as a}from"./useI18n-BAo1UrJW.js";import{A as o,F as s,I as c,J as l,L as u,M as d,N as f,c as p,d as m,j as h,q as g,u as _,z as v}from"./SharedElementTransition-BlCsXfb1.js";import{a as y,d as b,f as x}from"./label-DYYRLGoV.js";import{a as S,t as C}from"./Input-C__Dw9HK.js";import{t as w}from"./useTextField-h9qasHZP.js";var T=v({base:`textfield`,defaultVariants:{fullWidth:!1},variants:{fullWidth:{false:``,true:`textfield--full-width`}}}),E=t(e(),1),D=(0,E.createContext)({}),O=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i},k=(0,E.forwardRef)(function(e,t){[e,t]=h(e,t,D);let{hoverProps:n,isHovered:r}=_(e),{isFocused:i,isFocusVisible:a,focusProps:o}=m({isTextInput:!0,autoFocus:e.autoFocus}),c=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,u=d({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:c},defaultClassName:`react-aria-TextArea`});return E.createElement(s.textarea,{...l(O(e),o,n),...u,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":c||void 0})}),A=(0,E.createContext)(null),j=i(function(e,t){[e,t]=h(e,t,A);let{validationBehavior:n}=u(y)||{},i=e.validationBehavior??n??`native`,l=(0,E.useRef)(null);[e,l]=h(e,l,a);let[p,m]=f(!e[`aria-label`]&&!e[`aria-labelledby`]),[_,v]=(0,E.useState)(`input`),{labelProps:T,inputProps:O,descriptionProps:k,errorMessageProps:j,...M}=w({...c(e),inputElementType:_,label:m,validationBehavior:i},l),N=(0,E.useCallback)(e=>{l.current=e,e&&v(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[l]),P=d({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:M.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),F=g(e,{global:!0});return delete F.id,E.createElement(s.div,{...F,...P,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":M.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},E.createElement(o,{values:[[x,{...T,ref:p}],[C,{...O,ref:N}],[D,{...O,ref:N}],[S,{role:`presentation`,isInvalid:M.isInvalid,isDisabled:e.isDisabled||!1}],[r,{slots:{description:k,errorMessage:j}}],[b,M]]},P.children))}),M=n(),N=(0,E.createContext)({}),P=({children:e,className:t,fullWidth:n,variant:r,...i})=>{let a=E.useMemo(()=>T({fullWidth:n}),[n]);return(0,M.jsx)(j,{"data-slot":`textfield`,...i,className:p(t,a),children:t=>(0,M.jsx)(N,{value:{variant:r},children:(0,M.jsx)(M.Fragment,{children:typeof e==`function`?e(t):e})})})};export{P as n,k as r,N as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/textfield-CjoS-G9O.js b/internal/webui/static/assets/textfield-CjoS-G9O.js new file mode 100644 index 000000000..3df78a789 --- /dev/null +++ b/internal/webui/static/assets/textfield-CjoS-G9O.js @@ -0,0 +1 @@ +import{n as e}from"./textfield-BRcQ6Tsg.js";var t=Object.assign(e,{Root:e});export{t}; \ No newline at end of file diff --git a/internal/webui/static/assets/textfield-DAL_YlVh.js b/internal/webui/static/assets/textfield-DAL_YlVh.js deleted file mode 100644 index 4122a7670..000000000 --- a/internal/webui/static/assets/textfield-DAL_YlVh.js +++ /dev/null @@ -1 +0,0 @@ -import{n as e}from"./textfield-BGZ3lXZC.js";var t=Object.assign(e,{Root:e});export{t}; \ No newline at end of file diff --git a/internal/webui/static/assets/useApiKeyOptions-CX9uTy6L.js b/internal/webui/static/assets/useApiKeyOptions-Pz-FFnim.js similarity index 92% rename from internal/webui/static/assets/useApiKeyOptions-CX9uTy6L.js rename to internal/webui/static/assets/useApiKeyOptions-Pz-FFnim.js index 56c05f2e7..c81ff4276 100644 --- a/internal/webui/static/assets/useApiKeyOptions-CX9uTy6L.js +++ b/internal/webui/static/assets/useApiKeyOptions-Pz-FFnim.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{B as r,I as i,L as a,Z as o,c as s,lt as c,tt as l}from"./useI18n-XrvNxGvP.js";import{B as u,Y as d,c as f,s as p,z as m}from"./SharedElementTransition-BlCsXfb1.js";import{t as h}from"./label-B8hTan2F.js";import{a as g,i as _,n as v,r as y,t as b}from"./list-box-BtjELxmv.js";import{t as x}from"./search-field-DB17IAvK.js";import{i as S}from"./Input-CyXcxaPW.js";import{t as C}from"./assertion-BLQtDfw6.js";import{bt as w}from"./index-CAlyInAP.js";import{r as T}from"./keys-DEnJc6b-.js";var E=m({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`autocomplete`,clearButton:`autocomplete__clear-button`,filter:`autocomplete__filter`,indicator:`autocomplete__indicator`,popover:`autocomplete__popover`,trigger:`autocomplete__trigger`,value:`autocomplete__value`},variants:{fullWidth:{false:{},true:{base:`autocomplete--full-width`,trigger:`autocomplete__trigger--full-width`}},variant:{primary:{base:`autocomplete--primary`},secondary:{base:`autocomplete--secondary`}}}}),D=t(e(),1),O=n(),k=(0,D.createContext)({triggerRef:{current:null},clearButtonRef:{current:null},isDisabled:!1}),A=({children:e,className:t,fullWidth:n,isDisabled:r,onClear:i,variant:a,...o})=>{let s=D.useMemo(()=>E({fullWidth:n,variant:a}),[n,a]),c=(0,D.useRef)(null),l=(0,D.useRef)(null);return(0,O.jsx)(v,{children:(0,O.jsx)(k,{value:{slots:s,triggerRef:c,clearButtonRef:l,onClear:i,isDisabled:r},children:(0,O.jsx)(g,{"data-slot":`autocomplete`,...o,className:f(t,s?.base()),isDisabled:r,children:t=>(0,O.jsx)(O.Fragment,{children:typeof e==`function`?e(t):e})})})})},j=({children:e,className:t,isDisabled:n,onClick:r,ref:i,...a})=>{let{clearButtonRef:o,isDisabled:s,slots:c,triggerRef:u}=(0,D.use)(k),p=(0,D.use)(_),m=n??s??!1,h=l(),g=D.useCallback(e=>{u.current=e},[u]),v=d(g,i);return h?null:(0,O.jsx)(S,{ref:v,className:f(t,c?.trigger()),"data-slot":`autocomplete-trigger`,isDisabled:m,onClick:e=>{o.current?.contains(e.target)||(r?.(e),p?.toggle())},...a,children:t=>(0,O.jsx)(O.Fragment,{children:typeof e==`function`?e(t):e})})};j.displayName=`AutocompleteTrigger`;var M=Object.assign(A,{Root:A,Trigger:j,Value:({children:e,className:t,...n})=>{let{slots:r}=(0,D.use)(k);return(0,O.jsx)(y,{className:f(t,r?.value()),"data-slot":`autocomplete-value`,...n,children:e})},Indicator:({children:e,className:t,...n})=>{let{slots:i}=(0,D.use)(k),a=(0,D.use)(_),s=e&&D.isValidElement(e)?D.cloneElement(e,{...n,className:p(i?.indicator,t),"data-slot":`autocomplete-indicator`,"data-open":C(a?.isOpen)}):(0,O.jsx)(r,{className:p(i?.indicator,t),"data-open":C(a?.isOpen),"data-slot":`autocomplete-default-indicator`,...n});return(0,O.jsx)(o,{children:s})},Popover:({children:e,className:t,placement:n=`bottom`,style:r,...a})=>{let{slots:o,triggerRef:s}=(0,D.use)(k),[l,u]=(0,D.useState)(null),d=(0,D.useCallback)(()=>{s.current&&u(s.current.offsetWidth+`px`)},[s]);return c({ref:s,onResize:d}),(0,O.jsx)(i,{value:{variant:`default`},children:(0,O.jsx)(w,{...a,className:f(t,o?.popover()),"data-slot":`autocomplete-popover`,placement:n,triggerRef:s,style:{"--trigger-width":l,...typeof r==`object`&&r?r:{}},children:e})})},Filter:({children:e,...t})=>(0,O.jsx)(s,{"data-slot":`autocomplete-filter`,...t,children:e}),ClearButton:({className:e,onClick:t,ref:n,...r})=>{let{clearButtonRef:i,isDisabled:o,onClear:s,slots:c}=(0,D.use)(k),l=(0,D.use)(_),f=D.useCallback(e=>{i.current=e},[i]),p=d(f,n),m=e=>{l?.selectionManager.setSelectedKeys(new Set),s?.(),t?.(e)},h=l?.selectionManager.selectedKeys.size===0;return(0,O.jsx)(u.button,{ref:p,"aria-hidden":h||void 0,"aria-label":`Clear selection`,className:c?.clearButton({className:e}),"data-empty":C(h),"data-slot":`autocomplete-clear-button`,disabled:o??!1,tabIndex:-1,type:`button`,onClick:m,...r,children:(0,O.jsx)(a,{"data-slot":`autocomplete-clear-button-icon`})})}}),N=`__all__`;function P(e,t){let n=t.trim().toLowerCase();return!n||e.label.toLowerCase().includes(n)||e.id.toLowerCase().includes(n)}function F({value:e,onChange:t,ariaLabel:n,options:r,allLabel:i,searchPlaceholder:a,emptyLabel:o,loadOptions:s,className:c}){let[l,u]=(0,D.useState)(``),[d,f]=(0,D.useState)([]),[p,m]=(0,D.useState)(!1);(0,D.useEffect)(()=>{if(!s)return;let e=!1,t=window.setTimeout(()=>{m(!0),s(l.trim()).then(t=>{e||f(t)}).catch(()=>{e||f([])}).finally(()=>{e||m(!1)})},l.trim()?280:0);return()=>{e=!0,window.clearTimeout(t)}},[s,l]);let g=e||N,_=(0,D.useMemo)(()=>{let t=s?d:r.filter(e=>P(e,l)),n=new Map;l.trim()||n.set(N,{id:N,label:i});for(let e of t)!e.id||e.id===N||n.set(e.id,e);if(e){let t=r.find(t=>t.id===e)||d.find(t=>t.id===e)||{id:e,label:e};n.set(e,t)}return[...n.values()]},[i,s,r,l,d,e]),v=_.find(e=>e.id===g)||(e?{id:e,label:e}:{id:N,label:i});return(0,O.jsxs)(M,{className:[`w-fit`,c].filter(Boolean).join(` `),"aria-label":n,value:g,onChange:e=>{typeof e==`string`&&(t(e===N?``:e),u(``))},onClear:()=>{t(``),u(``)},children:[(0,O.jsxs)(M.Trigger,{className:`min-w-44 items-center`,children:[(0,O.jsx)(M.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t?e:(0,O.jsx)(`span`,{className:`truncate`,children:v.label})}),e?(0,O.jsx)(M.ClearButton,{}):null,(0,O.jsx)(M.Indicator,{})]}),(0,O.jsx)(M.Popover,{className:`min-w-56`,children:(0,O.jsxs)(M.Filter,{inputValue:l,onInputChange:u,filter:()=>!0,children:[(0,O.jsx)(x,{"aria-label":a,className:`px-2 pt-2`,autoFocus:!0,children:(0,O.jsxs)(x.Group,{children:[(0,O.jsx)(x.SearchIcon,{}),(0,O.jsx)(x.Input,{placeholder:a}),(0,O.jsx)(x.ClearButton,{})]})}),(0,O.jsx)(b,{children:_.length===0?(0,O.jsx)(b.Item,{id:`__empty__`,textValue:o,isDisabled:!0,children:(0,O.jsx)(h,{className:`block truncate text-muted`,children:p?a:o})}):_.map(e=>(0,O.jsxs)(b.Item,{id:e.id,textValue:e.label,children:[(0,O.jsx)(h,{className:`block truncate`,children:e.label}),e.id!==N&&e.id!==e.label?(0,O.jsx)(`span`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.id}):null,(0,O.jsx)(b.ItemIndicator,{})]},e.id))})]})})]})}function I(){let[e,t]=(0,D.useState)([]);return(0,D.useEffect)(()=>{let e=!1;return T().then(n=>{e||t(n.data||[])}).catch(()=>{}),()=>{e=!0}},[]),{keys:e,nameById:(0,D.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n.name||n.id);return t},[e]),options:(0,D.useMemo)(()=>e.map(e=>({id:e.id,label:e.name||e.id})),[e])}}export{F as n,I as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{B as r,I as i,L as a,Z as o,c as s,lt as c,tt as l}from"./useI18n-BAo1UrJW.js";import{B as u,Y as d,c as f,s as p,z as m}from"./SharedElementTransition-BlCsXfb1.js";import{t as h}from"./label-DYYRLGoV.js";import{a as g,i as _,n as v,r as y,t as b}from"./list-box-DbrQLYNo.js";import{t as x}from"./search-field-DRk4_q5c.js";import{i as S}from"./Input-C__Dw9HK.js";import{t as C}from"./assertion-BLQtDfw6.js";import{bt as w}from"./index-CWTBzWuK.js";import{r as T}from"./keys-DEnJc6b-.js";var E=m({defaultVariants:{fullWidth:!1,variant:`primary`},slots:{base:`autocomplete`,clearButton:`autocomplete__clear-button`,filter:`autocomplete__filter`,indicator:`autocomplete__indicator`,popover:`autocomplete__popover`,trigger:`autocomplete__trigger`,value:`autocomplete__value`},variants:{fullWidth:{false:{},true:{base:`autocomplete--full-width`,trigger:`autocomplete__trigger--full-width`}},variant:{primary:{base:`autocomplete--primary`},secondary:{base:`autocomplete--secondary`}}}}),D=t(e(),1),O=n(),k=(0,D.createContext)({triggerRef:{current:null},clearButtonRef:{current:null},isDisabled:!1}),A=({children:e,className:t,fullWidth:n,isDisabled:r,onClear:i,variant:a,...o})=>{let s=D.useMemo(()=>E({fullWidth:n,variant:a}),[n,a]),c=(0,D.useRef)(null),l=(0,D.useRef)(null);return(0,O.jsx)(v,{children:(0,O.jsx)(k,{value:{slots:s,triggerRef:c,clearButtonRef:l,onClear:i,isDisabled:r},children:(0,O.jsx)(g,{"data-slot":`autocomplete`,...o,className:f(t,s?.base()),isDisabled:r,children:t=>(0,O.jsx)(O.Fragment,{children:typeof e==`function`?e(t):e})})})})},j=({children:e,className:t,isDisabled:n,onClick:r,ref:i,...a})=>{let{clearButtonRef:o,isDisabled:s,slots:c,triggerRef:u}=(0,D.use)(k),p=(0,D.use)(_),m=n??s??!1,h=l(),g=D.useCallback(e=>{u.current=e},[u]),v=d(g,i);return h?null:(0,O.jsx)(S,{ref:v,className:f(t,c?.trigger()),"data-slot":`autocomplete-trigger`,isDisabled:m,onClick:e=>{o.current?.contains(e.target)||(r?.(e),p?.toggle())},...a,children:t=>(0,O.jsx)(O.Fragment,{children:typeof e==`function`?e(t):e})})};j.displayName=`AutocompleteTrigger`;var M=Object.assign(A,{Root:A,Trigger:j,Value:({children:e,className:t,...n})=>{let{slots:r}=(0,D.use)(k);return(0,O.jsx)(y,{className:f(t,r?.value()),"data-slot":`autocomplete-value`,...n,children:e})},Indicator:({children:e,className:t,...n})=>{let{slots:i}=(0,D.use)(k),a=(0,D.use)(_),s=e&&D.isValidElement(e)?D.cloneElement(e,{...n,className:p(i?.indicator,t),"data-slot":`autocomplete-indicator`,"data-open":C(a?.isOpen)}):(0,O.jsx)(r,{className:p(i?.indicator,t),"data-open":C(a?.isOpen),"data-slot":`autocomplete-default-indicator`,...n});return(0,O.jsx)(o,{children:s})},Popover:({children:e,className:t,placement:n=`bottom`,style:r,...a})=>{let{slots:o,triggerRef:s}=(0,D.use)(k),[l,u]=(0,D.useState)(null),d=(0,D.useCallback)(()=>{s.current&&u(s.current.offsetWidth+`px`)},[s]);return c({ref:s,onResize:d}),(0,O.jsx)(i,{value:{variant:`default`},children:(0,O.jsx)(w,{...a,className:f(t,o?.popover()),"data-slot":`autocomplete-popover`,placement:n,triggerRef:s,style:{"--trigger-width":l,...typeof r==`object`&&r?r:{}},children:e})})},Filter:({children:e,...t})=>(0,O.jsx)(s,{"data-slot":`autocomplete-filter`,...t,children:e}),ClearButton:({className:e,onClick:t,ref:n,...r})=>{let{clearButtonRef:i,isDisabled:o,onClear:s,slots:c}=(0,D.use)(k),l=(0,D.use)(_),f=D.useCallback(e=>{i.current=e},[i]),p=d(f,n),m=e=>{l?.selectionManager.setSelectedKeys(new Set),s?.(),t?.(e)},h=l?.selectionManager.selectedKeys.size===0;return(0,O.jsx)(u.button,{ref:p,"aria-hidden":h||void 0,"aria-label":`Clear selection`,className:c?.clearButton({className:e}),"data-empty":C(h),"data-slot":`autocomplete-clear-button`,disabled:o??!1,tabIndex:-1,type:`button`,onClick:m,...r,children:(0,O.jsx)(a,{"data-slot":`autocomplete-clear-button-icon`})})}}),N=`__all__`;function P(e,t){let n=t.trim().toLowerCase();return!n||e.label.toLowerCase().includes(n)||e.id.toLowerCase().includes(n)}function F({value:e,onChange:t,ariaLabel:n,options:r,allLabel:i,searchPlaceholder:a,emptyLabel:o,loadOptions:s,className:c}){let[l,u]=(0,D.useState)(``),[d,f]=(0,D.useState)([]),[p,m]=(0,D.useState)(!1);(0,D.useEffect)(()=>{if(!s)return;let e=!1,t=window.setTimeout(()=>{m(!0),s(l.trim()).then(t=>{e||f(t)}).catch(()=>{e||f([])}).finally(()=>{e||m(!1)})},l.trim()?280:0);return()=>{e=!0,window.clearTimeout(t)}},[s,l]);let g=e||N,_=(0,D.useMemo)(()=>{let t=s?d:r.filter(e=>P(e,l)),n=new Map;l.trim()||n.set(N,{id:N,label:i});for(let e of t)!e.id||e.id===N||n.set(e.id,e);if(e){let t=r.find(t=>t.id===e)||d.find(t=>t.id===e)||{id:e,label:e};n.set(e,t)}return[...n.values()]},[i,s,r,l,d,e]),v=_.find(e=>e.id===g)||(e?{id:e,label:e}:{id:N,label:i});return(0,O.jsxs)(M,{className:[`w-fit`,c].filter(Boolean).join(` `),"aria-label":n,value:g,onChange:e=>{typeof e==`string`&&(t(e===N?``:e),u(``))},onClear:()=>{t(``),u(``)},children:[(0,O.jsxs)(M.Trigger,{className:`min-w-44 items-center`,children:[(0,O.jsx)(M.Value,{className:`min-w-0 truncate`,children:({defaultChildren:e,isPlaceholder:t})=>t?e:(0,O.jsx)(`span`,{className:`truncate`,children:v.label})}),e?(0,O.jsx)(M.ClearButton,{}):null,(0,O.jsx)(M.Indicator,{})]}),(0,O.jsx)(M.Popover,{className:`min-w-56`,children:(0,O.jsxs)(M.Filter,{inputValue:l,onInputChange:u,filter:()=>!0,children:[(0,O.jsx)(x,{"aria-label":a,className:`px-2 pt-2`,autoFocus:!0,children:(0,O.jsxs)(x.Group,{children:[(0,O.jsx)(x.SearchIcon,{}),(0,O.jsx)(x.Input,{placeholder:a}),(0,O.jsx)(x.ClearButton,{})]})}),(0,O.jsx)(b,{children:_.length===0?(0,O.jsx)(b.Item,{id:`__empty__`,textValue:o,isDisabled:!0,children:(0,O.jsx)(h,{className:`block truncate text-muted`,children:p?a:o})}):_.map(e=>(0,O.jsxs)(b.Item,{id:e.id,textValue:e.label,children:[(0,O.jsx)(h,{className:`block truncate`,children:e.label}),e.id!==N&&e.id!==e.label?(0,O.jsx)(`span`,{className:`mono mt-0.5 block truncate text-caption text-muted`,children:e.id}):null,(0,O.jsx)(b.ItemIndicator,{})]},e.id))})]})})]})}function I(){let[e,t]=(0,D.useState)([]);return(0,D.useEffect)(()=>{let e=!1;return T().then(n=>{e||t(n.data||[])}).catch(()=>{}),()=>{e=!0}},[]),{keys:e,nameById:(0,D.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n.name||n.id);return t},[e]),options:(0,D.useMemo)(()=>e.map(e=>({id:e.id,label:e.name||e.id})),[e])}}export{F as n,I as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/useI18n-BAo1UrJW.js b/internal/webui/static/assets/useI18n-BAo1UrJW.js new file mode 100644 index 000000000..fc43ac616 --- /dev/null +++ b/internal/webui/static/assets/useI18n-BAo1UrJW.js @@ -0,0 +1 @@ +import{a as e,c as t,i as n,n as r,t as i}from"./shim-mfK0Rmj6.js";import{$ as a,A as o,Ct as s,E as c,F as l,G as u,I as d,J as f,L as p,M as m,Q as h,W as g,Y as _,Z as v,b as y,bt as b,c as x,d as S,dt as C,et as w,f as T,it as E,j as D,k as O,l as k,lt as A,ot as j,p as ee,q as M,tt as N,u as P,ut as F,w as te,xt as ne,yt as re,z as ie}from"./SharedElementTransition-BlCsXfb1.js";var I=t(e(),1),ae=(0,I.createContext)({color:`currentColor`,size:`1em`,weight:`regular`,mirrored:!1}),L=I.forwardRef((e,t)=>{let{alt:n,color:r,size:i,weight:a,mirrored:o,children:s,weights:c,...l}=e,{color:u=`currentColor`,size:d,weight:f=`regular`,mirrored:p=!1,...m}=I.useContext(ae);return I.createElement(`svg`,{ref:t,xmlns:`http://www.w3.org/2000/svg`,width:i??d,height:i??d,fill:r??u,viewBox:`0 0 256 256`,transform:o||p?`scale(-1, 1)`:void 0,...m,...l},!!n&&I.createElement(`title`,null,n),s,c.get(a??f))});L.displayName=`IconBase`;var oe=t(n(),1),se=`react-aria-clear-focus`,ce=`react-aria-focus`;function le(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=A(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(` `):i&&=i.trim().split(/\s+/).join(` `),!r&&!i&&t&&(r=t),{id:n,"aria-label":r,"aria-labelledby":i}}function ue(){return window.ResizeObserver!==void 0}function R(e){let{ref:t,box:n,onResize:r}=e,i=g(r);(0,I.useEffect)(()=>{let e=t?.current;if(e){if(ue()){let t=new window.ResizeObserver(e=>{e.length&&i()});return t.observe(e,{box:n}),()=>{e&&t.unobserve(e)}}return window.addEventListener(`resize`,i,!1),()=>{window.removeEventListener(`resize`,i,!1)}}},[t,n])}function de(e){return b()?e.metaKey:e.ctrlKey}var fe=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function pe(e){return e instanceof HTMLInputElement&&!fe.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function me(e,t,n,r){let i=g(n),a=n==null;(0,I.useEffect)(()=>{if(a||!e.current)return;let n=e.current;return n.addEventListener(t,i,r),()=>{n.removeEventListener(t,i,r)}},[e,t,r,a])}function z(e,t=!0){let[n,r]=(0,I.useState)(!0),i=n&&t;return C(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),ge(e,i,(0,I.useCallback)(()=>r(!1),[])),i}function he(e,t){let[n,r]=(0,I.useState)(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`)}let i=n===`exiting`;return ge(e,i,(0,I.useCallback)(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function ge(e,t,n){C(()=>{if(t&&e.current){if(!(`getAnimations`in e.current)){n();return}let t=e.current.getAnimations();if(t.length===0){n();return}let r=!1;return Promise.allSettled(t.map(e=>e.finished)).then(()=>{r||(0,oe.flushSync)(()=>{n()})}),()=>{r=!0}}},[e,t,n])}function B(e,t=-1/0,n=1/0){return Math.min(Math.max(e,t),n)}function V(e,t){let n=e,r=0,i=t.toString(),a=i.toLowerCase().indexOf(`e-`);if(a>0)r=Math.abs(Math.floor(Math.log10(Math.abs(t))))+a;else{let e=i.indexOf(`.`);e>=0&&(r=i.length-e)}if(r>0){let e=10**r;n=Math.round(n*e)/e}return n}function _e(e,t,n,r){t=Number(t),n=Number(n);let i=(e-(isNaN(t)?0:t))%r,a=V(Math.abs(i)*2>=r?e+Math.sign(i)*(r-Math.abs(i)):e-i,r);return isNaN(t)?!isNaN(n)&&a>n&&(a=Math.floor(V(n/r,r))*r):an&&(a=t+Math.floor(V((n-t)/r,r))*r),a=V(a,r),a}var ve=ie({base:`button`,defaultVariants:{fullWidth:!1,isIconOnly:!1,size:`md`,variant:`primary`},variants:{fullWidth:{false:``,true:`button--full-width`},isIconOnly:{true:`button--icon-only`},size:{lg:`button--lg`,md:`button--md`,sm:`button--sm`},variant:{danger:`button--danger`,"danger-soft":`button--danger-soft`,ghost:`button--ghost`,outline:`button--outline`,primary:`button--primary`,secondary:`button--secondary`,tertiary:`button--tertiary`}}}),H=r();typeof HTMLTemplateElement<`u`&&(Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:!0,enumerable:!0,get:function(){return this.content.firstChild}}),Object.defineProperty(HTMLTemplateElement.prototype,"appendChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.appendChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"removeChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.removeChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"insertBefore",{configurable:!0,enumerable:!0,value:function(e,t){return this.content.insertBefore(e,t)}}));var U=(0,I.createContext)(!1);function ye(e){if((0,I.useContext)(U))return I.createElement(I.Fragment,null,e.children);let t=I.createElement(U.Provider,{value:!0},e.children);return I.createElement(`template`,null,t)}function be(e){let t=(t,n)=>(0,I.useContext)(U)?null:e(t,n);return t.displayName=e.displayName||e.name,(0,I.forwardRef)(t)}function xe(){return(0,I.useContext)(U)}var Se=(0,I.createContext)(null),Ce=7e3,W=null;function we(e,t=`assertive`,n=Ce){W?W.announce(e,t,n):(W=new Ee,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?W.announce(e,t,n):setTimeout(()=>{W?.isAttached()&&W?.announce(e,t,n)},100))}function Te(e){W&&W.clear(e)}var Ee=class{constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<`u`&&(this.node=document.createElement(`div`),this.node.dataset.liveAnnouncer=`true`,Object.assign(this.node.style,{border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`}),this.assertiveLog=this.createLog(`assertive`),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog(`polite`),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}isAttached(){return this.node?.isConnected}createLog(e){let t=document.createElement(`div`);return t.setAttribute(`role`,`log`),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-relevant`,`additions`),t}destroy(){this.node&&=(document.body.removeChild(this.node),null)}announce(e,t=`assertive`,n=Ce){if(!this.node)return;let r=document.createElement(`div`);typeof e==`object`?(r.setAttribute(`role`,`img`),r.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):r.textContent=e,t===`assertive`?this.assertiveLog?.appendChild(r):this.politeLog?.appendChild(r),e!==``&&setTimeout(()=>{r.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}},De=(0,I.createContext)({}),Oe=be(function(e,t){[e,t]=D(e,t,De);let n=e,{isPending:r}=n,{buttonProps:i,isPressed:a}=ee(e,t);i=Ae(i,r);let{focusProps:o,isFocused:s,isFocusVisible:c}=S(e),{hoverProps:u,isHovered:d}=P({...e,isDisabled:e.isDisabled||r}),p={isHovered:d,isPressed:(n.isPressed||a)&&!r,isFocused:s,isFocusVisible:c,isDisabled:e.isDisabled||!1,isPending:r??!1},h=m({...e,values:p,defaultClassName:`react-aria-Button`}),g=A(i.id),_=A(),v=i[`aria-labelledby`];r&&(v?v=`${v} ${_}`:i[`aria-label`]&&(v=`${g} ${_}`));let y=(0,I.useRef)(r);(0,I.useEffect)(()=>{let e={"aria-labelledby":v||g};(!y.current&&s&&r||y.current&&s&&!r)&&we(e,`assertive`),y.current=r},[r,s,v,g]);let b=M(e,{global:!0});return delete b.onClick,I.createElement(l.button,{...f(b,h,i,o,u),type:i.type===`submit`&&r?`button`:i.type,id:g,ref:t,"aria-labelledby":v,slot:e.slot||void 0,"aria-disabled":r?`true`:i[`aria-disabled`],"data-disabled":e.isDisabled||void 0,"data-pressed":p.isPressed||void 0,"data-hovered":d||void 0,"data-focused":s||void 0,"data-pending":r||void 0,"data-focus-visible":c||void 0},I.createElement(Se.Provider,{value:{id:_}},h.children))}),ke=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function Ae(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!ke.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}var je=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M2.97 5.47a.75.75 0 0 1 1.06 0L8 9.44l3.97-3.97a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 0 1 0-1.06`,fill:`currentColor`,fillRule:`evenodd`})}),Me=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M13.03 10.53a.75.75 0 0 1-1.06 0L8 6.56l-3.97 3.97a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1 0 1.06`,fill:`currentColor`,fillRule:`evenodd`})}),Ne=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M10.53 2.97a.75.75 0 0 1 0 1.06L6.56 8l3.97 3.97a.75.75 0 1 1-1.06 1.06l-4.5-4.5a.75.75 0 0 1 0-1.06l4.5-4.5a.75.75 0 0 1 1.06 0`,fill:`currentColor`,fillRule:`evenodd`})}),Pe=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M5.47 2.97a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 1 1-1.06-1.06L9.44 8 5.47 4.03a.75.75 0 0 1 0-1.06Z`,fill:`currentColor`,fillRule:`evenodd`})}),Fe=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M3.47 3.47a.75.75 0 0 1 1.06 0L8 6.94l3.47-3.47a.75.75 0 1 1 1.06 1.06L9.06 8l3.47 3.47a.75.75 0 1 1-1.06 1.06L8 9.06l-3.47 3.47a.75.75 0 0 1-1.06-1.06L6.94 8 3.47 4.53a.75.75 0 0 1 0-1.06Z`,fill:`currentColor`,fillRule:`evenodd`})}),Ie=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M8 13.5a5.5 5.5 0 1 0 0-11a5.5 5.5 0 0 0 0 11M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14m1-9.5a1 1 0 1 1-2 0a1 1 0 0 1 2 0m-.25 3a.75.75 0 0 0-1.5 0V11a.75.75 0 0 0 1.5 0z`,fill:`currentColor`,fillRule:`evenodd`})}),Le=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M7.134 2.994L2.217 11.5a1 1 0 0 0 .866 1.5h9.834a1 1 0 0 0 .866-1.5L8.866 2.993a1 1 0 0 0-1.732 0m3.03-.75c-.962-1.665-3.366-1.665-4.329 0L.918 10.749c-.963 1.666.24 3.751 2.165 3.751h9.834c1.925 0 3.128-2.085 2.164-3.751zM8 5a.75.75 0 0 1 .75.75v2a.75.75 0 0 1-1.5 0v-2A.75.75 0 0 1 8 5m1 5.75a1 1 0 1 1-2 0a1 1 0 0 1 2 0`,fill:`currentColor`,fillRule:`evenodd`})}),Re=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M8 13.5a5.5 5.5 0 1 0 0-11a5.5 5.5 0 0 0 0 11M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14m1-4.5a1 1 0 1 1-2 0a1 1 0 0 1 2 0M8.75 5a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0z`,fill:`currentColor`,fillRule:`evenodd`})}),ze=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8a5.5 5.5 0 1 1-11 0a5.5 5.5 0 0 1 11 0M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0m-3.9-1.55a.75.75 0 1 0-1.2-.9L7.419 8.858L6.03 7.47a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.13-.08z`,fill:`currentColor`,fillRule:`evenodd`})}),Be=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M1.75 8a.75.75 0 0 1 .75-.75h11a.75.75 0 0 1 0 1.5h-11A.75.75 0 0 1 1.75 8`,fill:`currentColor`,fillRule:`evenodd`})}),Ve=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M8 1.75a.75.75 0 0 1 .75.75v4.75h4.75a.75.75 0 0 1 0 1.5H8.75v4.75a.75.75 0 0 1-1.5 0V8.75H2.5a.75.75 0 0 1 0-1.5h4.75V2.5A.75.75 0 0 1 8 1.75`,fill:`currentColor`,fillRule:`evenodd`})}),He=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M11.5 7a4.5 4.5 0 1 1-9 0a4.5 4.5 0 0 1 9 0m-.82 4.74a6 6 0 1 1 1.06-1.06l2.79 2.79a.75.75 0 1 1-1.06 1.06z`,fill:`currentColor`,fillRule:`evenodd`})}),Ue=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:`1em`,role:`presentation`,viewBox:`0 0 13 14`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M3.75 4.5A.75.75 0 0 1 3 3.75v-.748a1.5 1.5 0 0 0-1.5 1.5v1h10v-1a1.5 1.5 0 0 0-1.5-1.5v.75a.75.75 0 1 1-1.5 0v-.75h-4v.747a.75.75 0 0 1-.75.75ZM8.5 1.501h-4V.75a.75.75 0 0 0-1.5 0v.752a3 3 0 0 0-3 3v6a3 3 0 0 0 3 3h7a3 3 0 0 0 3-3v-6a3 3 0 0 0-3-3v-.75a.75.75 0 0 0-1.5 0v.75Zm-7 5.5v3.5a1.5 1.5 0 0 0 1.5 1.5h7a1.5 1.5 0 0 0 1.5-1.5v-3.5h-10Z`,fill:`currentColor`,fillRule:`evenodd`})}),We=(0,I.createContext)({}),Ge=(0,I.createContext)({placement:`bottom`}),Ke=(0,I.forwardRef)(function(e,t){[e,t]=D(e,t,Ge);let n=e.placement,r={position:`absolute`,transform:n===`top`||n===`bottom`?`translateX(-50%)`:`translateY(-50%)`};n!=null&&(r[n]=`100%`);let i=m({...e,defaultClassName:`react-aria-OverlayArrow`,values:{placement:n}});i.style&&Object.keys(i.style).forEach(e=>i.style[e]===void 0&&delete i.style[e]);let a=M(e);return I.createElement(l.div,{...a,...i,style:{...r,...i.style},ref:t,"data-placement":n})}),G={top:`top`,bottom:`top`,left:`left`,right:`left`},K={top:`bottom`,bottom:`top`,left:`right`,right:`left`},qe={top:`left`,left:`top`},Je={top:`height`,left:`width`},Ye={width:`totalWidth`,height:`totalHeight`},q={},Xe=()=>typeof document<`u`?window.visualViewport:null;function Ze(e,t){let n=0,r=0,i=0,a=0,o=0,s=0,c={},l=(t?.scale??1)>1;if(e.tagName===`BODY`||e.tagName===`HTML`){let l=document.documentElement;i=l.clientWidth,a=l.clientHeight,n=t?.width??i,r=t?.height??a,c.top=l.scrollTop||e.scrollTop,c.left=l.scrollLeft||e.scrollLeft,t&&(o=t.offsetTop,s=t.offsetLeft)}else({width:n,height:r,top:o,left:s}=Y(e,!1)),c.top=e.scrollTop,c.left=e.scrollLeft,i=n,a=r;return re()&&(e.tagName===`BODY`||e.tagName===`HTML`)&&l&&(c.top=0,c.left=0,o=t?.pageTop??0,s=t?.pageLeft??0),{width:n,height:r,totalWidth:i,totalHeight:a,scroll:c,top:o,left:s}}function Qe(e){return{top:e.scrollTop,left:e.scrollLeft,width:e.scrollWidth,height:e.scrollHeight}}function $e(e,t,n,r,i,a,o){let s=i.scroll[e]??0,c=r[Je[e]],l=o[e]+r.scroll[G[e]]+a,u=o[e]+r.scroll[G[e]]+c-a,d=t-s+r.scroll[G[e]]+o[e]-r[G[e]],f=t-s+n+r.scroll[G[e]]+o[e]-r[G[e]];return du?Math.max(u-f,l-d):0}function et(e){let t=window.getComputedStyle(e);return{top:parseInt(t.marginTop,10)||0,bottom:parseInt(t.marginBottom,10)||0,left:parseInt(t.marginLeft,10)||0,right:parseInt(t.marginRight,10)||0}}function tt(e){if(q[e])return q[e];let[t,n]=e.split(` `),r=G[t]||`right`,i=qe[r];G[n]||(n=`center`);let a=Je[r],o=Je[i];return q[e]={placement:t,crossPlacement:n,axis:r,crossAxis:i,size:a,crossSize:o},q[e]}function nt(e,t,n,r,i,a,o,s,c,l,u){let{placement:d,crossPlacement:f,axis:p,crossAxis:m,size:h,crossSize:g}=r,_={};_[m]=e[m]??0,f===`center`?_[m]+=((e[g]??0)-(n[g]??0))/2:f!==m&&(_[m]+=(e[g]??0)-(n[g]??0)),_[m]+=a;let v=e[m]-n[g]+c+l,y=e[m]+e[g]-c-l;if(_[m]=B(_[m],v,y),d===p){let t=s?u[h]:u[Ye[h]];_[K[p]]=Math.floor(t-e[p]+i)}else _[p]=Math.floor(e[p]+e[h]+i);return _}function rt(e,t,n,r,i,a,o,s,c,l,u){let d=(e.top==null?c[Ye.height]-(e.bottom??0)-o:e.top)-(c.scroll.top??0),f=l?n.top:0,p={top:Math.max(t.top+f,(u?.offsetTop??t.top)+f),bottom:Math.min(t.top+t.height+f,(u?.offsetTop??0)+(u?.height??0))};return s===`top`?Math.max(0,d+o-p.top-((i.top??0)+(i.bottom??0)+a)):Math.max(0,p.bottom-d-((i.top??0)+(i.bottom??0)+a))}function it(e,t,n,r,i,a,o,s){let{placement:c,axis:l,size:u}=a;return c===l?Math.max(0,n[l]-(o.scroll[l]??0)-(e[l]+(s?t[l]:0))-(r[l]??0)-r[K[l]]-i):Math.max(0,e[u]+e[l]+(s?t[l]:0)-n[l]-n[u]+(o.scroll[l]??0)-(r[l]??0)-r[K[l]]-i)}function at(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=tt(e),{size:y,crossAxis:b,crossSize:x,placement:S,crossPlacement:C}=v,w=nt(t,s,n,v,u,d,l,f,m,h,c),T=u,E=it(s,l,t,i,a+u,v,c,g);if(o&&n[y]>E){let e=tt(`${K[S]} ${C}`),r=nt(t,s,n,e,u,d,l,f,m,h,c);it(s,l,t,i,a+u,e,c,g)>E&&(v=e,w=r,T=u)}let D=`bottom`;v.axis===`top`?v.placement===`top`?D=`top`:v.placement===`bottom`&&(D=`bottom`):v.crossAxis===`top`&&(v.crossPlacement===`top`?D=`bottom`:v.crossPlacement===`bottom`&&(D=`top`));let O=$e(b,w[b],n[x],s,c,a,l);w[b]+=O;let k=rt(w,s,l,f,i,a,n.height,D,c,g,_);p&&p!n||r===null?void 0:j(w(t.current),`scroll`,e=>{let n=N(e);if(!t.current||n instanceof Node&&!v(n,t.current)||n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement)return;let i=r||ut.get(t.current);i&&i()},!0),[n,r,t])}var X=typeof document<`u`?window.visualViewport:null;function ft(e){let{direction:t}=O(),{arrowSize:n,targetRef:r,overlayRef:i,arrowRef:o,scrollRef:s=i,placement:c=`bottom`,containerPadding:l=12,shouldFlip:u=!0,boundaryElement:d=typeof document<`u`?document.body:null,offset:f=0,crossOffset:p=0,shouldUpdatePosition:m=!0,isOpen:g=!0,onClose:_,maxHeight:v,arrowBoundaryOffset:y=0,getTargetRect:b}=e,[x,S]=(0,I.useState)(null),w=[m,c,i.current,r.current,o?.current,s.current,l,u,d,f,p,g,t,v,y,n],T=(0,I.useRef)(X?.scale);(0,I.useEffect)(()=>{g&&(T.current=X?.scale)},[g]);let E=(0,I.useCallback)(()=>{if(m===!1||!g||!i.current||!r.current||!d||X?.scale!==T.current)return;let e=null;if(s.current&&h(s.current)){let t=a()?.getBoundingClientRect(),n=s.current.getBoundingClientRect();e={type:`top`,offset:(t?.top??0)-n.top},e.offset>n.height/2&&(e.type=`bottom`,e.offset=(t?.bottom??0)-n.bottom)}let _=i.current;!v&&i.current&&(_.style.top=`0px`,_.style.bottom=``,_.style.maxHeight=(window.visualViewport?.height??window.innerHeight)+`px`);let x=ot({placement:mt(c,t),overlayNode:i.current,targetNode:r.current,scrollNode:s.current||i.current,padding:l,shouldFlip:u,boundaryElement:d,offset:f,crossOffset:p,maxHeight:v,arrowSize:n??(o?.current?J(o.current,!0).width:0),arrowBoundaryOffset:y,targetRect:b?.(r.current)});if(!x.position)return;_.style.top=``,_.style.bottom=``,_.style.left=``,_.style.right=``,Object.keys(x.position).forEach(e=>_.style[e]=x.position[e]+`px`),_.style.maxHeight=x.maxHeight==null?``:x.maxHeight+`px`;let C=a();if(e&&C&&s.current){let t=C.getBoundingClientRect(),n=s.current.getBoundingClientRect(),r=t[e.type]-n[e.type];s.current.scrollTop+=r-e.offset}S(x)},w);C(E,w),pt(E),R({ref:i,onResize:E}),R({ref:r,onResize:E});let D=(0,I.useRef)(!1);C(()=>{let e,t=()=>{D.current=!0,clearTimeout(e),e=setTimeout(()=>{D.current=!1},500),E()},n=()=>{D.current&&t()};return X?.addEventListener(`resize`,t),X?.addEventListener(`scroll`,n),()=>{X?.removeEventListener(`resize`,t),X?.removeEventListener(`scroll`,n)}},[E]);let k=(0,I.useCallback)(()=>{D.current||_?.()},[_,D]);return dt({triggerRef:r,isOpen:g,onClose:_&&k}),{overlayProps:{style:{position:x?`absolute`:`fixed`,top:x?void 0:0,left:x?void 0:0,zIndex:1e5,...x?.position,maxHeight:x?.maxHeight??`100vh`}},placement:x?.placement??null,triggerAnchorPoint:x?.triggerAnchorPoint??null,arrowProps:{"aria-hidden":`true`,role:`presentation`,style:{left:x?.arrowOffsetLeft,top:x?.arrowOffsetTop}},updatePosition:E}}function pt(e){C(()=>(window.addEventListener(`resize`,e,!1),()=>{window.removeEventListener(`resize`,e,!1)}),[e])}function mt(e,t){return t===`rtl`?e.replace(`start`,`right`).replace(`end`,`left`):e.replace(`start`,`left`).replace(`end`,`right`)}var ht=Symbol.for(`react-aria.i18n.locale`),gt=Symbol.for(`react-aria.i18n.strings`),_t=void 0,vt=class e{constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=yt(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[ht];if(_t===void 0){let t=window[gt];if(!t)return null;_t={};for(let r in t)_t[r]=new e({[n]:t[r]},n)}let r=_t?.[t];if(!r)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}};function yt(e,t,n=`en-US`){if(t[e])return t[e];let r=bt(e),i=xt(e);if(i&&t[`${r}-${i}`])return t[`${r}-${i}`];if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function bt(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}function xt(e){if(Intl.Locale)return new Intl.Locale(e).script}var St=new Map,Ct=new Map,wt=class{constructor(e,t){this.locale=e,this.strings=t}format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=St.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),St.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=Ct.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),Ct.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}},Tt=new WeakMap;function Et(e){let t=Tt.get(e);return t||(t=new vt(e),Tt.set(e,t)),t}function Dt(e,t){return t&&vt.getGlobalDictionaryForPackage(t)||Et(e)}function Ot(e,t){let{locale:n}=O(),r=Dt(e,t);return(0,I.useMemo)(()=>new wt(n,r),[n,r])}var kt={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function At(e={}){let{style:t,isFocusable:n}=e,[r,i]=(0,I.useState)(!1),{focusWithinProps:a}=T({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=(0,I.useMemo)(()=>r?t:t?{...kt,...t}:kt,[r]);return{visuallyHiddenProps:{...a,style:o}}}function jt(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=At(e);return I.createElement(n,f(a,o),t)}var Mt=(0,I.createContext)({});function Nt(){return(0,I.useContext)(Mt)??{}}function Pt(e){let[t,n]=k(e.isOpen,e.defaultOpen||!1,e.onOpenChange),[r,i]=(0,I.useState)(null);return{isOpen:t,setOpen:n,open:(0,I.useCallback)(()=>{n(!0)},[n]),close:(0,I.useCallback)(()=>{n(!1)},[n]),toggle:(0,I.useCallback)(()=>{n(!t)},[n,t]),point:r,setPoint:i}}var Z=class{constructor(e){this.value=null,this.level=0,this.hasChildNodes=!1,this.rendered=null,this.textValue=``,this[`aria-label`]=void 0,this.index=0,this.parentKey=null,this.prevKey=null,this.nextKey=null,this.firstChildKey=null,this.lastChildKey=null,this.props={},this.colSpan=null,this.colIndex=null,this.type=this.constructor.type,this.key=e}get childNodes(){throw Error(`childNodes is not supported`)}clone(){let e=new this.constructor(this.key);return e.value=this.value,e.level=this.level,e.hasChildNodes=this.hasChildNodes,e.rendered=this.rendered,e.textValue=this.textValue,e[`aria-label`]=this[`aria-label`],e.index=this.index,e.parentKey=this.parentKey,e.prevKey=this.prevKey,e.nextKey=this.nextKey,e.firstChildKey=this.firstChildKey,e.lastChildKey=this.lastChildKey,e.props=this.props,e.render=this.render,e.colSpan=this.colSpan,e.colIndex=this.colIndex,e}filter(e,t,n){let r=this.clone();return t.addDescendants(r,e),r}},Ft=class extends Z{filter(e,t,n){let[r,i]=Bt(e,t,this.firstChildKey,n),a=this.clone();return a.firstChildKey=r,a.lastChildKey=i,a}};(class extends Z{static{this.type=`header`}});var It=class extends Z{static{this.type=`loader`}},Lt=class extends Ft{static{this.type=`item`}filter(e,t,n){if(n(this.textValue,this)){let n=this.clone();return t.addDescendants(n,e),n}return null}},Rt=class extends Ft{static{this.type=`section`}filter(e,t,n){let r=super.filter(e,t,n);if(r&&r.lastChildKey!==null){let t=e.getItem(r.lastChildKey);if(t&&t.type!==`header`)return r}return null}},zt=class{get size(){return this.itemCount}getKeys(){return this.keyMap.keys()}*[Symbol.iterator](){let e=this.firstKey==null?void 0:this.keyMap.get(this.firstKey);for(;e;)yield e,e=e.nextKey==null?void 0:this.keyMap.get(e.nextKey)}getChildren(e){let t=this.keyMap;return{*[Symbol.iterator](){let n=t.get(e),r=n?.firstChildKey==null?null:t.get(n.firstChildKey);for(;r;)yield r,r=r.nextKey==null?void 0:t.get(r.nextKey)}}}getKeyBefore(e){let t=this.keyMap.get(e);if(!t)return null;if(t.prevKey!=null){for(t=this.keyMap.get(t.prevKey);t&&t.type!==`item`&&t.lastChildKey!=null;)t=this.keyMap.get(t.lastChildKey);return t?.key??null}return t.parentKey}getKeyAfter(e){let t=this.keyMap.get(e);if(!t)return null;if(t.type!==`item`&&t.firstChildKey!=null)return t.firstChildKey;for(;t;){if(t.nextKey!=null)return t.nextKey;if(t.parentKey!=null)t=this.keyMap.get(t.parentKey);else return null}return null}getFirstKey(){return this.firstKey}getLastKey(){let e=this.lastKey==null?null:this.keyMap.get(this.lastKey);for(;e?.lastChildKey!=null;)e=this.keyMap.get(e.lastChildKey);return e?.key??null}getItem(e){return this.keyMap.get(e)??null}at(){throw Error(`Not implemented`)}clone(){let e=this.constructor,t=new e;return t.keyMap=new Map(this.keyMap),t.firstKey=this.firstKey,t.lastKey=this.lastKey,t.itemCount=this.itemCount,t}addNode(e){if(this.frozen)throw Error(`Cannot add a node to a frozen collection`);e.type===`item`&&this.keyMap.get(e.key)==null&&this.itemCount++,this.keyMap.set(e.key,e)}addDescendants(e,t){this.addNode(e);let n=t.getChildren(e.key);for(let e of n)this.addDescendants(e,t)}removeNode(e){if(this.frozen)throw Error(`Cannot remove a node to a frozen collection`);let t=this.keyMap.get(e);t!=null&&t.type===`item`&&this.itemCount--,this.keyMap.delete(e)}commit(e,t,n=!1){if(this.frozen)throw Error(`Cannot commit a frozen collection`);this.firstKey=e,this.lastKey=t,this.frozen=!n}filter(e){let t=new this.constructor,[n,r]=Bt(this,t,this.firstKey,e);return t?.commit(n,r),t}constructor(){this.keyMap=new Map,this.firstKey=null,this.lastKey=null,this.frozen=!1,this.itemCount=0}};function Bt(e,t,n,r){if(n==null)return[null,null];let i=null,a=null,o=e.getItem(n);for(;o!=null;){let n=o.filter(e,t,r);n!=null&&(n.nextKey=null,a&&(n.prevKey=a.key,a.nextKey=n.key),i??=n,t.addNode(n),a=n),o=o.nextKey==null?null:e.getItem(o.nextKey)}if(a&&a.type===`separator`){let e=a.prevKey;t.removeNode(a.key),e==null?a=null:(a=t.getItem(e),a.nextKey=null)}return[i?.key??null,a?.key??null]}var Vt=class{constructor(e){this._firstChild=null,this._lastChild=null,this._previousSibling=null,this._nextSibling=null,this._parentNode=null,this._minInvalidChildIndex=null,this.ownerDocument=e}*[Symbol.iterator](){let e=this.firstChild;for(;e;)yield e,e=e.nextSibling}get firstChild(){return this._firstChild}set firstChild(e){this._firstChild=e,this.ownerDocument.markDirty(this)}get lastChild(){return this._lastChild}set lastChild(e){this._lastChild=e,this.ownerDocument.markDirty(this)}get previousSibling(){return this._previousSibling}set previousSibling(e){this._previousSibling=e,this.ownerDocument.markDirty(this)}get nextSibling(){return this._nextSibling}set nextSibling(e){this._nextSibling=e,this.ownerDocument.markDirty(this)}get parentNode(){return this._parentNode}set parentNode(e){this._parentNode=e,this.ownerDocument.markDirty(this)}get isConnected(){return this.parentNode?.isConnected||!1}invalidateChildIndices(e){(this._minInvalidChildIndex==null||!this._minInvalidChildIndex.isConnected||e.indexthis.subscriptions.delete(e)}resetAfterSSR(){this.isSSR&&(this.isSSR=!1,this.firstChild=null,this.lastChild=null,this.nodeId=0)}};function Wt(e){let{children:t,items:n,idScope:r,addIdAndValue:i,dependencies:a=[]}=e,o=(0,I.useMemo)(()=>void 0,[t]),s=(0,I.useMemo)(()=>new WeakMap,[...a,o]);return(0,I.useMemo)(()=>{if(n&&typeof t==`function`){let e=[];for(let a of n){let n=Gt(a)?a:null,o=n?s.get(n):null;if(!o){o=t(a);let c=o.props.id??a?.key??a?.id;r!=null&&o.props.id==null&&c!=null&&(c=r+`:`+c);let l=c??e.length;o=(0,I.cloneElement)(o,i?{key:l,id:c,value:a}:{key:l}),n&&s.set(n,o)}e.push(o)}return e}if(typeof t!=`function`)return t},[t,n,s,r,i])}function Gt(e){switch(typeof e){case`object`:return e!=null;case`function`:case`symbol`:return!0;default:return!1}}var Kt=i(),qt=(0,I.createContext)(!1),Q=(0,I.createContext)(null);function Jt(e){if((0,I.useContext)(Q))return e.content;let{collection:t,document:n}=Qt(e.createCollection);return I.createElement(I.Fragment,null,I.createElement(ye,null,I.createElement(Q.Provider,{value:n},e.content)),I.createElement(Yt,{render:e.children,collection:t}))}function Yt({collection:e,render:t}){return t(e)}function Xt(e,t,n){let r=F(),i=(0,I.useRef)(r);i.current=r;let a=(0,I.useCallback)(()=>i.current?n():t(),[t,n]);return(0,Kt.useSyncExternalStore)(e,a)}var Zt=typeof I.useSyncExternalStore==`function`?I.useSyncExternalStore:Xt;function Qt(e){let[t]=(0,I.useState)(()=>new Ut(e?.()||new zt));return{collection:Zt((0,I.useCallback)(e=>t.subscribe(e),[t]),(0,I.useCallback)(()=>{let e=t.getCollection();return t.isSSR&&t.resetAfterSSR(),e},[t]),(0,I.useCallback)(()=>(t.isSSR=!0,t.getCollection()),[t])),document:t}}var $t=(0,I.createContext)(null);function en(e){return class extends Z{static{this.type=e}}}function tn(e,t,n,r,i,a){typeof e==`string`&&(e=en(e));let o=(0,I.useCallback)(i=>{i?.setProps(t,n,e,r,a)},[t,n,r,a,e]),s=(0,I.useContext)($t);if(s){let o=s.ownerDocument.nodesByProps.get(t);return o||(o=s.ownerDocument.createElement(e.type),o.setProps(t,n,e,r,a),s.appendChild(o),s.ownerDocument.updateCollection(),s.ownerDocument.nodesByProps.set(t,o)),i?I.createElement($t.Provider,{value:o},i):null}return I.createElement(e.type,{ref:o},i)}function nn(e,t){let n=({node:e})=>t(e.props,e.props.ref,e),r=(0,I.forwardRef)((r,i)=>{let a=(0,I.useContext)(y);if(!(0,I.useContext)(qt)){if(t.length>=3)throw Error(t.name+` cannot be rendered outside a collection.`);return t(r,i)}return tn(e,r,i,`children`in r?r.children:null,null,e=>I.createElement(y.Provider,{value:a},I.createElement(n,{node:e})))});return r.displayName=t.name,r}function rn(e,t,n=an){let r=({node:e})=>t(e.props,e.props.ref,e),i=(0,I.forwardRef)((t,i)=>tn(e,t,i,null,n(t),e=>I.createElement(r,{node:e}))??I.createElement(I.Fragment,null));return i.displayName=t.name,i}function an(e){return Wt({...e,addIdAndValue:!0})}var on=(0,I.createContext)(null);function sn(e){let t=(0,I.useContext)(on),n=(t?.dependencies||[]).concat(e.dependencies),r=e.idScope??t?.idScope,i=an({...e,idScope:r,dependencies:n});return(0,I.useContext)(Q)&&(i=I.createElement(cn,null,i)),t=(0,I.useMemo)(()=>({dependencies:n,idScope:r}),[r,...n]),I.createElement(on.Provider,{value:t},i)}function cn({children:e}){let t=(0,I.useContext)(Q),n=(0,I.useMemo)(()=>I.createElement(Q.Provider,{value:null},I.createElement(qt.Provider,{value:!0},e)),[e]);return F()?I.createElement($t.Provider,{value:t},n):(0,oe.createPortal)(n,t)}function ln(e){let t=fn(E(e));t!==e&&(t&&un(t,e),e&&dn(e,t))}function un(e,t){e.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:t})),e.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:t}))}function dn(e,t){e.dispatchEvent(new FocusEvent(`focus`,{relatedTarget:t})),e.dispatchEvent(new FocusEvent(`focusin`,{bubbles:!0,relatedTarget:t}))}function fn(e){let t=a(e),n=t?.getAttribute(`aria-activedescendant`);return n&&e.getElementById(n)||t}var pn={};pn={collectionLabel:`مقترحات`};var mn={};mn={collectionLabel:`Предложения`};var hn={};hn={collectionLabel:`Návrhy`};var gn={};gn={collectionLabel:`Forslag`};var _n={};_n={collectionLabel:`Empfehlungen`};var vn={};vn={collectionLabel:`Προτάσεις`};var yn={};yn={collectionLabel:`Suggestions`};var bn={};bn={collectionLabel:`Sugerencias`};var xn={};xn={collectionLabel:`Soovitused`};var Sn={};Sn={collectionLabel:`Ehdotukset`};var Cn={};Cn={collectionLabel:`Suggestions`};var wn={};wn={collectionLabel:`הצעות`};var Tn={};Tn={collectionLabel:`Prijedlozi`};var En={};En={collectionLabel:`Javaslatok`};var Dn={};Dn={collectionLabel:`Suggerimenti`};var On={};On={collectionLabel:`候補`};var kn={};kn={collectionLabel:`제안`};var An={};An={collectionLabel:`Pasiūlymai`};var jn={};jn={collectionLabel:`Ieteikumi`};var Mn={};Mn={collectionLabel:`Forslag`};var Nn={};Nn={collectionLabel:`Suggesties`};var Pn={};Pn={collectionLabel:`Sugestie`};var Fn={};Fn={collectionLabel:`Sugestões`};var In={};In={collectionLabel:`Sugestões`};var Ln={};Ln={collectionLabel:`Sugestii`};var Rn={};Rn={collectionLabel:`Предложения`};var zn={};zn={collectionLabel:`Návrhy`};var Bn={};Bn={collectionLabel:`Predlogi`};var Vn={};Vn={collectionLabel:`Predlozi`};var Hn={};Hn={collectionLabel:`Förslag`};var Un={};Un={collectionLabel:`Öneriler`};var Wn={};Wn={collectionLabel:`Пропозиції`};var Gn={};Gn={collectionLabel:`建议`};var Kn={};Kn={collectionLabel:`建議`};var qn={};qn={"ar-AE":pn,"bg-BG":mn,"cs-CZ":hn,"da-DK":gn,"de-DE":_n,"el-GR":vn,"en-US":yn,"es-ES":bn,"et-EE":xn,"fi-FI":Sn,"fr-FR":Cn,"he-IL":wn,"hr-HR":Tn,"hu-HU":En,"it-IT":Dn,"ja-JP":On,"ko-KR":kn,"lt-LT":An,"lv-LV":jn,"nb-NO":Mn,"nl-NL":Nn,"pl-PL":Pn,"pt-BR":Fn,"pt-PT":In,"ro-RO":Ln,"ru-RU":Rn,"sk-SK":zn,"sl-SI":Bn,"sr-SP":Vn,"sv-SE":Hn,"tr-TR":Un,"uk-UA":Wn,"zh-CN":Gn,"zh-TW":Kn};function Jn(e){return e&&e.__esModule?e.default:e}function Yn(e,t){let{inputRef:n,collectionRef:r,filter:i,disableAutoFocusFirst:o=!1,disableVirtualFocus:l=!1}=e,d=A(),p=(0,I.useRef)(void 0),m=(0,I.useRef)(!1),h=(0,I.useRef)(null),v=te()===`virtual`&&(s()||ne()),[y,b]=(0,I.useState)(!v&&!l),[x,S]=(0,I.useState)(!1),[w,T]=(0,I.useState)(!1);(0,I.useEffect)(()=>()=>clearTimeout(p.current),[]);let D=g(e=>{!e.isTrusted&&y&&n.current&&a(E(n.current))!==n.current&&c()!==`touch`&&n.current.focus();let i=N(e);e.isTrusted||!i||h.current===i.id||(clearTimeout(p.current),i===r.current?h.current&&!document.getElementById(h.current)&&(h.current=null,t.setFocusedNodeId(null)):m.current?(h.current=i.id,p.current=setTimeout(()=>{t.setFocusedNodeId(i.id)},500)):(h.current=i.id,t.setFocusedNodeId(i.id)),m.current=!1)}),[O,k]=(0,I.useState)(null),j=(0,I.useCallback)(e=>{k(e),e==null?S(!1):(e.getAttribute(`tabindex`)!=null&&b(!1),S(!0))},[]);C(()=>(O?.addEventListener(`focusin`,D),()=>{O?.removeEventListener(`focusin`,D)}),[O]);let ee=u((0,I.useMemo)(()=>_(r,j),[r,j])),M=(0,I.useCallback)(()=>{if(!r.current){T(!0);return}m.current=!0,r.current?.dispatchEvent(new CustomEvent(ce,{cancelable:!0,bubbles:!0,detail:{focusStrategy:`first`}}))},[r]),P=(0,I.useCallback)(e=>{T(!1),ln(a()),h.current=null,t.setFocusedNodeId(null);let n=new CustomEvent(se,{cancelable:!0,bubbles:!0,detail:{clearFocusKey:e}});clearTimeout(p.current),m.current=!1,r.current?.dispatchEvent(n)},[r,t]),F=(0,I.useRef)(``);me(n,`beforeinput`,e=>{let{inputType:t}=e;F.current=t});let re=e=>{(F.current===`insertText`||F.current===`insertCompositionText`||F.current===`insertFromComposition`)&&!o?M():F.current&&(F.current.includes(`insert`)||F.current.includes(`delete`)||F.current.includes(`history`))&&(P(!0),fn(document)===n.current&&dn(n.current,null)),t.setInputValue(e)},ie=(0,I.useRef)(null),ae=e=>{if(ie.current=N(e),e.nativeEvent.isComposing)return;let t=h.current;switch(t!==null&&E(n.current).getElementById(t)==null&&(h.current=null,t=null),e.key){case`a`:if(de(e))return;break;case`Escape`:if(e.isDefaultPrevented())return;break;case` `:return;case`Tab`:`continuePropagation`in e&&e.continuePropagation();return;case`Home`:case`End`:case`PageDown`:case`PageUp`:case`ArrowUp`:case`ArrowDown`:case`ArrowRight`:case`ArrowLeft`:{if((e.key===`Home`||e.key===`End`)&&t==null&&e.shiftKey)return;if(e.key===`ArrowRight`||e.key===`ArrowLeft`){if(t==null){e.isPropagationStopped()||e.stopPropagation();return}break}e.preventDefault();let n=new CustomEvent(ce,{cancelable:!0,bubbles:!0});r.current?.dispatchEvent(n);break}}e.isPropagationStopped()||e.stopPropagation();let i=!0;if(r.current!==null){if(t==null)i=r.current?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type,e.nativeEvent))||!1;else{let n=document.getElementById(t);n&&(i=n?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type,e.nativeEvent))||!1)}}if(i)switch(e.key){case`ArrowLeft`:case`ArrowRight`:P();break;case`Enter`:t!=null&&document.getElementById(t)?.dispatchEvent(new PointerEvent(`click`,e.nativeEvent));break}else e.preventDefault()},L=g(e=>{if(N(e)===ie.current){e.stopImmediatePropagation();let t=h.current;t==null?r.current?.dispatchEvent(new KeyboardEvent(e.type,e)):document.getElementById(t)?.dispatchEvent(new KeyboardEvent(e.type,e))}});(0,I.useEffect)(()=>(document.addEventListener(`keyup`,L,!0),()=>{document.removeEventListener(`keyup`,L,!0)}),[]);let oe=le({id:d,"aria-label":Ot(Jn(qn),`@react-aria/autocomplete`).format(`collectionLabel`)}),ue=(0,I.useCallback)((e,n)=>!i||i(e,t.inputValue,n),[t.inputValue,i]),R=e=>{if(!e.isTrusted)return;let t=h.current?document.getElementById(h.current):null;t&&un(t,e.relatedTarget)},fe=e=>{if(e.isTrusted&&h.current&&document.getElementById(h.current)){let t=N(e);queueMicrotask(()=>{un(t,r.current),dn(r.current,t)})}},pe=e=>{e.button===0&&e.pointerType!==`touch`&&h.current!=null&&n.current!=null&&N(e)===n.current&&P()},z={value:t.inputValue,onChange:re},he={onKeyDown:ae,"aria-activedescendant":t.focusedNodeId??void 0,onBlur:R,onFocus:fe,onPointerDown:pe};return z={...z,...y&&x&&he,enterKeyHint:`go`,"aria-controls":x?d:void 0,"aria-autocomplete":`list`,autoCorrect:`off`,spellCheck:`false`,autoComplete:`off`},{inputProps:z,collectionProps:f(oe,{shouldUseVirtualFocus:y,disallowTypeAhead:y,autoFocus:w?`first`:!1}),collectionRef:ee,filter:i==null?void 0:ue}}function Xn(e){let{onInputChange:t,inputValue:n,defaultInputValue:r=``}=e,i=e=>{t&&t(e)},[a,o]=(0,I.useState)(null),[s,c]=k(n,r,i);return{inputValue:s,setInputValue:c,focusedNodeId:a,setFocusedNodeId:o}}var Zn=(0,I.createContext)(null),Qn=(0,I.createContext)(null),$n=(0,I.createContext)(null),er=(0,I.createContext)(null);function tr(e){let t=p(Zn,e.slot);e=f(t,e);let{filter:n,disableAutoFocusFirst:r}=e,i=Xn(e),a=(0,I.useRef)(null),s=(0,I.useRef)(null),{inputProps:c,collectionProps:l,collectionRef:u,filter:m}=Yn({...d(e),filter:n,disableAutoFocusFirst:r,inputRef:a,collectionRef:s},i);return I.createElement(o,{values:[[Qn,i],[er,{...c,ref:a}],[$n,{...l,filter:m,ref:u}]]},e.children)}function nr(e){let t=M(e,{labelable:!0}),n;return e.orientation===`vertical`&&(n=`vertical`),e.elementType===`hr`?{separatorProps:t}:{separatorProps:{...t,role:`separator`,"aria-orientation":n}}}var rr=(0,I.createContext)({}),ir=nn(class extends Z{static{this.type=`separator`}filter(e,t){let n=t.getItem(this.prevKey);if(n&&n.type!==`separator`){let n=this.clone();return t.addDescendants(n,e),n}return null}},function(e,t){[e,t]=D(e,t,rr);let{elementType:n,orientation:r,style:i,className:a,slot:o,...s}=e,c=n||`hr`;c===`hr`&&r===`vertical`&&(c=`div`);let u=l[c],{separatorProps:d}=nr({...s,elementType:n,orientation:r}),p=M(e,{global:!0});return I.createElement(u,{render:e.render,...f(p,d),style:i,className:a??`react-aria-Separator`,ref:t,slot:o||void 0})}),ar=(0,I.createContext)({}),or=(0,I.forwardRef)(function(e,t){[e,t]=D(e,t,ar);let{elementType:n=`span`,...r}=e,i=l[n];return I.createElement(i,{className:`react-aria-Text`,...r,ref:t})}),sr=(0,I.createContext)({}),cr=`__button_group_child`,lr=({children:e,className:t,fullWidth:n,isDisabled:r,isIconOnly:i,size:a,slot:o,style:s,variant:c,[cr]:l,...u})=>{let d=(0,I.use)(sr),f=l===!0,p=a??(f?d?.size:void 0),m=c??(f?d?.variant:void 0),h=r??(f?d?.isDisabled:void 0),g=ve({fullWidth:n??(f?d?.fullWidth:void 0),isIconOnly:i,size:p,variant:m});return(0,H.jsx)(Oe,{className:x(t,g),"data-slot":`button`,isDisabled:h,slot:o,style:s,...u,children:t=>typeof e==`function`?e(t):e})},ur=Object.assign(lr,{Root:lr}),$={en:{brandSub:`login state gateway`,controlPlane:`control plane`,workspace:`Workspace`,develop:`Develop`,system:`System`,runtimeSnapshot:`Runtime and scheduler snapshot`,routesHint:`OpenAI / Anthropic-compatible routes`,clientConfig:`Client configuration`,clientConfigHint:`Use the same console key as Bearer token`,providerPrefixHint:`Pin a provider with a qoder/, workbuddy/, trae/, devin/, command/, codex/, zhipu/, qwenwork/, kimi/, codearts/, kiro/, meta/, opencode/, or doubaowork/ model prefix. A named API key can also limit which providers are listed and routed. Bare IDs follow the cross-provider pool setting on System.`,authentication:`Authentication`,curlExample:`curl example`,quickTestHint:`Send a real request through the selected account`,response:`Response`,providerCatalog:`Model catalog`,providerCatalogMeta:`SIGNED-IN / LIVE`,checkAllModels:`Check all models`,checkingModels:`Checking…`,checkModelsHint:`Sends one 1-token, thinking-disabled live request per model per available account. Real usage is billed upstream but excluded from the Usage page totals.`,checkModelsSummary:`{passed} reachable · {failed} failed · {total} total · {elapsed}ms`,checkModelsEmpty:`No models to check.`,checkResultOK:`Reachable`,checkResultFailed:`Failed`,checkResultSkipped:`Skipped`,checkAccountResults:`Account results`,checkNotRun:`Not checked`,checkPassedAccounts:`{passed}/{total} accounts`,accountPool:`Account pool`,accountCreateHint:`Create an isolated runtime first, then sign in with browser or PAT.`,credentialImportHint:`Only credential bundles exported from this console, with matching user blob and machine ID.`,accountEmptyHint:`Create an account runtime to begin.`,oauthDeviceFlow:`OAuth device flow`,navOverview:`Overview`,navAuth:`Accounts`,navProviders:`Models`,navModelPool:`Dispatch groups`,navAccess:`Access & try`,navAccounts:`Accounts`,checkinDefaultsTitle:`Automatic check-in`,checkinDefaultsHint:`Set a default time for each provider. Accounts following the default pick up changes automatically; custom times stay unchanged.`,checkinDisabledAccountsTitle:`Check in disabled accounts`,checkinDisabledAccountsHint:`When enabled, accounts disabled for chat can still run their opted-in automatic check-in. Manual check-in remains unavailable for disabled accounts.`,checkinDisabledAccountsStatus:`Current status`,checkinDisabledAccountsAriaLabel:`Allow automatic check-in for disabled accounts`,checkinInherit:`Follow provider policy`,checkinDefaultValue:`Provider default: {time}`,checkinCustom:`Account override`,checkinConfigured:`Configured`,checkinScheduleHint:`Runs on the provider server clock shown below, normally within about 90 seconds of the chosen time; sequential account processing can take longer. Failed or provisional attempts retry around 02:05, 12:05 and 21:00. Chat is unaffected.`,checkinTimeInvalid:`Enter a valid check-in time (HH:mm).`,checkinRecordSkipped:`Activity unavailable`,checkinStatusPending:`Not checked in upstream`,checkinStatusUnknown:`Upstream status unknown`,checkinUpstreamSynced:`Upstream synced {time}`,checkinServerClock:`Server clock · {timezone}`,checkinServerTime:`Server time: {time}`,checkinAutoScheduleHint:`Automatic schedule: upstream earliest check-in window + 1 hour ({time}). Manual overrides still win.`,navUsage:`Usage`,usageTitle:`Usage`,usageByModel:`Models`,usageByAccount:`Accounts`,usageByProvider:`Providers`,usageColRequests:`Requests`,usageColSuccess:`Success`,usageColTokens:`Tokens`,usageColCacheWrite:`Cache write`,usageColCredits:`Credits`,usageRowCount:`{count} rows`,usageShareOther:`Other`,usageEmpty:`No requests in this window.`,usageStatsTab:`Stats`,usageCostTab:`Quota`,usageWindow:`Window`,usageWindow24h:`24h`,usageWindow7d:`7d`,usageWindowTotal:`All retained`,usageCredits:`Quota used`,usageCreditsHint:`Subscription credits across all providers`,usageEstCost:`Equivalent cost`,usageTotalTokens:`Total tokens`,usageRequests:`Requests`,usageModelCount:`{count} models`,usageCacheHitRate:`Cache hit`,usageTokenSplitNote:`hit / miss / output`,usageChartTitle:`Usage over time`,usageChartHint:`Stacked by model. Switch between quota and tokens.`,usageChartEmpty:`No usage in this window.`,usageBreakdownTitle:`By model`,usageBreakdownHint:`Tokens and subscription credits for every model.`,usageColInputHit:`Input · cache hit`,usageColInputMiss:`Input · cache miss`,usageColOutput:`Output`,usageColCost:`Equiv. cost`,usageUnpricedCost:`no list price`,usageColSplit:`Peak / off-peak`,usageTotals:`Total`,usageRetentionHint:`Request logs are pruned on a schedule, so “All retained” covers only what is still stored.`,usageRenderNote:`Optional DeepSeek official list-price estimate in CNY. Subscription accounts do not bill this way — for comparison only.`,usagePeakNote:`Peak = Beijing time Mon–Fri 09:00–12:00 & 14:00–18:00; off-peak is half. Holidays are not handled.`,usageUnpricedHint:`No list-price row (quota and tokens only): {models}`,usageNoteTitle:`How this is calculated`,usagePriceTitle:`DeepSeek official price table`,usagePriceHit:`Cache hit`,usagePriceMiss:`Cache miss`,usagePriceOutput:`Output`,usagePriceBandOff:`Off-peak`,usagePriceBandPeak:`Peak`,usageOffPeak:`Off-peak`,usagePeak:`Peak`,usageChartMetric:`Chart metric`,usageEstimateTitle:`DeepSeek list-price estimate`,usageEstimateHint:`Optional CNY comparison for priced models. Collapsed by default.`,usageEstimateChartTitle:`List-price trend`,usageEstimateChartEmpty:`No priced DeepSeek usage in this window.`,chartMetricRequests:`Requests`,chartMetricTokens:`Tokens`,chartMetricLatency:`p95 latency`,chartInput:`Input`,chartOutput:`Output`,chartCacheRead:`Cache read`,chartTotal:`Total`,navLogs:`Logs`,navKeys:`API keys`,navSystem:`System settings`,sidebarFoot:`Gateway for CLI logins`,sidebarInFlight:`In flight: {count}`,systemSettingsTitle:`System settings`,crossProviderModelPoolTitle:`Cross-provider model pool`,crossProviderModelPoolHint:`When enabled, bare model IDs can route across matching Qoder, WorkBuddy, and Trae accounts. When disabled, bare IDs are rejected and requests must use a provider-prefixed model ID.`,crossProviderModelPoolStatus:`Current status`,crossProviderModelPoolAriaLabel:`Enable cross-provider model pool`,modelPoolTitle:`Dispatch groups`,modelPoolCreate:`Add group`,modelPoolEdit:`Edit group`,modelPoolId:`Client model ID`,modelPoolIdHint:`The model field in a client request, for example my-claude. It cannot be changed after saving.`,modelPoolIdLocked:`Clients send this as the model field. It cannot be changed.`,modelPoolName:`Name`,modelPoolNameHint:`Shown only in this console list, so you can tell groups apart. Clients never see it.`,modelPoolNamePh:`My Claude`,modelPoolStrategy:`Routing strategy`,modelPoolStrategyHint:`Priority: order eligible members by priority; later members are not failure backups unless failover is enabled. Round robin: spread requests evenly. Fill first: favor the highest-weight member. FEFO: prefer the member whose quota expires soonest.`,modelPoolStrategy_priority:`Priority order`,"modelPoolStrategy_round-robin":`Round robin`,"modelPoolStrategy_fill-first":`Fill first`,modelPoolStrategy_fefo:`Expiry first (FEFO)`,"modelPoolStrategy_least-quota-first":`Least remaining quota first`,"modelPoolStrategy_most-quota-first":`Most remaining quota first`,modelPoolFailover:`Failover`,modelPoolMaxAttempts:`Max attempts`,modelPoolMaxAttemptsHint:`With failover enabled, this caps total dispatches for the requested logical model, counting the first dispatch and later attempts across members (1-64); it is not a provider count.`,modelPoolMembers:`Provider models`,modelPoolMembersHint:`Only connected providers and the models enabled in their provider settings are selectable. The provider account pool picks the serving account automatically; order sets priority.`,modelPoolAddMember:`Add provider model`,modelPoolMembersEmpty:`No members yet. Add at least one provider model.`,modelPoolMoveUp:`Move up`,modelPoolMoveDown:`Move down`,modelPoolProvider:`Provider`,modelPoolRegion:`Region`,modelPoolAnyRegion:`Any region`,modelPoolModel:`Model`,modelPoolWeight:`Weight`,modelPoolNoModels:`No models available`,modelPoolIdRequired:`Group ID is required.`,modelPoolNameRequired:`Display name is required.`,modelPoolMembersRequired:`Add at least one provider seat.`,modelPoolMemberIncomplete:`Each seat needs one provider and one model.`,modelPoolAttemptsInvalid:`Max attempts must be between 1 and 64.`,modelPoolColName:`Model`,modelPoolColStrategy:`Strategy`,modelPoolColMembers:`Members`,modelPoolColFailover:`Failover`,modelPoolColEnabled:`Enabled`,modelPoolColActions:`Actions`,modelPoolFailoverOn:`On · up to {count} dispatches`,modelPoolFailoverOff:`Off`,modelPoolEmpty:`No dispatch groups`,modelPoolEmptyHint:`Add a group and clients get another model they can call.`,modelPoolDeleteTitle:`Delete dispatch group`,modelPoolDeleteDesc:`Delete “{name}”? Clients using this group ID will stop reaching it.`,modelPoolSaved:`Saved`,modelPoolDeleted:`Deleted`,modelPoolBack:`All groups`,modelPoolEnabled:`Enabled`,modelPoolIdInvalid:`Group ID must be lowercase letters, digits, - and /, up to 128 characters.`,modelPoolMissing:`This dispatch group no longer exists.`,modelPoolEntryTitle:`Request`,modelPoolEntryDetail:`Client model id`,modelPoolEntryNote:`Starts when a client calls this id`,modelPoolEntryHint:`Each provider/model can expand into one seat per checked account, in check order. With no accounts checked, all matching connected accounts are eligible; otherwise only checked accounts are included. The row strategy controls how its seats are scheduled.`,modelPoolStepProvider:`Provider`,modelPoolStepProviderDetail:`One provider`,modelPoolAccounts:`Accounts`,modelPoolAccountsHint:`Leave accounts unchecked to include all matching connected accounts. Check one or more to include only those accounts; multiple picks expand into seats in check order.`,modelPoolAccountsAll:`All accounts`,modelPoolAccountsAllCount:`All {count} accounts`,modelPoolSeatOrderAll:`Account-pool selection`,modelPoolSeatOrderPicked:`Expanded in check order`,modelPoolSeatCount:`{count} seats`,modelPoolPathCount:`{count} paths`,modelPoolAccountsCount:`{count} accounts`,modelPoolAccountsSearch:`Find an account`,modelPoolAccountsNoMatch:`No account matches`,modelPoolNoAccounts:`This provider has no connected account`,modelPoolAccountsDraft:`Multiple selections include only the checked accounts; they expand into seats in check order.`,modelPoolClientModel:`Client model name`,modelPoolCanvasPalette:`Add a seat`,modelPoolCanvasIncomplete:`Set up`,modelPoolCanvasSkip:`Skipped`,modelPoolCanvasFit:`Fit view`,modelPoolCanvasZoomIn:`Zoom in`,modelPoolCanvasZoomOut:`Zoom out`,modelPoolStrategyNode:`Strategy`,modelPoolStrategyNote:`Orders this row of seats`,modelPoolAddSeat:`Add seat`,modelPoolDragSeat:`Drag to reorder`,modelPoolRemoveSeat:`Remove seat`,modelPoolPathEmpty:`No seats on this path yet.`,modelPoolStepModel:`Model`,modelPoolStepModelDetail:`One provider model`,modelPoolStepModelNote:`Choose a provider and a model`,modelPoolStepGroup:`Nested group`,modelPoolStepGroupDetail:`Another dispatch group`,modelPoolStepGroupNote:`Keeps that pool's own order`,modelPoolStepIntent:`Intent`,modelPoolStepIntentDetail:`Latest user message`,modelPoolStepIntentNote:`Keywords or classifier`,modelPoolPathMatch:`Match`,modelPoolPathDefault:`Default (unmatched)`,modelPoolPathLabel:`Path name`,modelPoolAddPath:`Add path`,modelPoolRemovePath:`Remove path`,modelPoolKeywords:`Keywords`,modelPoolKeywordsHint:`Comma-separated. Any case-insensitive hit on the latest user message selects this path.`,modelPoolIntentLabel:`Classifier label`,modelPoolIntentHint:`Matched against the classifier reply. The path name is also accepted.`,modelPoolPathFallback:`Default path (no match; not a failure backup)`,modelPoolClassifier:`Classifier`,modelPoolClassifierOff:`Keywords only`,modelPoolClassifierHint:`Optional. At a reached branch, a separate non-streaming request uses this concrete model to classify the message; other reached branches can trigger additional classifier requests.`,modelPoolNestedPool:`Group`,modelPoolNestedPoolPick:`Choose a group`,modelPoolNestedPoolEmpty:`No other groups yet`,modelPoolGroupRequired:`Choose a nested group.`,modelPoolSelfGroup:`A group cannot nest itself.`,modelPoolClassifierIncomplete:`The classifier needs a provider and a model.`,modelPoolPreview:`Try a message`,modelPoolPreviewHint:`Shows at most one next candidate or cooling hint from the current pool state, not a full failover sequence. An empty result means the current pool could not confirm a route. Candidate selection reserves no account and advances no rotation; reached branches may dispatch non-streaming classifier requests. API-key grants, request-specific account pins, session affinity, protocol-specific request context, and concurrent or later pool changes are not included, so a live request may differ.`,modelPoolPreviewNoCandidate:`No current candidate could be confirmed.`,modelPoolPreviewPh:`Plan the rollout`,modelPoolPreviewRun:`Preview`,modelPoolPreviewPath:`Path`,modelPoolNoReady:`No ready account`,modelPoolWeightHint:`Used by fill first. The saved weight stays when you switch strategy.`,modelPoolWeightNote:`Weight {weight}`,modelPoolCapabilities:`Advertised capabilities`,modelPoolCapabilitiesHint:`Leave a value at 0 to derive it from the members. These fields do not change routing.`,modelPoolContextLength:`Context window`,modelPoolContextLengthHint:`0, or at least 1024.`,modelPoolMaxOutput:`Max output`,modelPoolMaxOutputHint:`0, or at least 1024, and not above the context window.`,modelPoolReasoningLevels:`Reasoning levels`,modelPoolReasoningLevelsHint:`Empty keeps the levels shared by every member.`,modelPoolReasoningSelected:`{n}/{total} selected`,modelPoolReasoningSelectAll:`Select all`,modelPoolReasoningClear:`Clear`,modelPoolReasoningEmpty:`No level selected: only the levels every member shares are advertised.`,modelPoolReasoningDefault:`Default effort`,modelPoolReasoningDefaultHint:`Used when the client sends no reasoning intent.`,modelPoolReasoningAuto:`Derive`,modelPoolCapabilitiesInvalid:`Context and max output must be 0 or between 1024 and 4000000, and max output cannot exceed the context window.`,modelPoolReasoningInvalid:`The default effort must be one of the selected reasoning levels.`,keysAggregationMode:`Model aggregation mode`,keysAggregationModeHint:`When on, this key can only call aggregated logical models; provider selection below is ignored.`,workbuddyCheckinSettingsTitle:`WorkBuddy check-in`,workbuddyCheckinSettingsHint:`Default first daily check-in time for new WorkBuddy accounts. Existing accounts keep their own time until you edit them.`,workbuddyCheckinSettingsFieldHint:`Uses server local time. New WorkBuddy accounts inherit this unless you set a different time on the account.`,routingStrategyTitle:`Account routing strategy`,routingStrategyHint:`Choose how ready accounts share traffic. Fill-first keeps traffic on the highest-priority account until it is unavailable. Earliest-expiry-first only ranks accounts inside the same provider by their nearest credit-package expiry. Least/most quota first rank accounts by remaining quota ratio; accounts with unknown quota sort last.`,routingStrategy:`Strategy`,routingRoundRobin:`Round robin`,routingWeightedRoundRobin:`Weighted round robin`,routingFillFirst:`Fill first`,routingFEFO:`Earliest expiry first (FEFO)`,routingLeastQuotaFirst:`Least remaining quota first`,routingMostQuotaFirst:`Most remaining quota first`,routingWeight:`Routing weight`,sessionAffinityTTL:`Session TTL`,sessionAffinityHits:`Sticky hits`,sessionAffinityMisses:`Sticky misses`,sessionAffinityEscapes:`Sticky escapes`,lastSessionMiss:`Last miss`,lastSessionEscape:`Last escape`,checkUpdates:`Check updates`,versionUpdate:`Version update`,latestVersionHint:`Download the latest version first, then apply it when you are ready.`,updateAvailable:`Update available`,settingsTabGeneral:`General`,settingsTabRouting:`Routing`,settingsTabSecurity:`Security & data`,settingsTabUpdates:`Updates`,sidebarNewVersion:`New version {version}`,sidebarReleaseNotes:`Release notes`,sidebarGoToUpdate:`History & rollback`,upToDate:`Up to date`,currentVersion:`Current version`,latestVersion:`Latest version`,skippedBetweenLabel:`Versions in between`,releaseNotes:`What changed`,updateNoNotes:`No notes for this version.`,versionHistory:`Version history`,versionCurrentBadge:`Current`,versionLatestBadge:`Latest`,restoreThisVersion:`Restore this version`,restoreVersionTitle:`Restore {version}?`,restoreVersionHint:`The service will switch back to this version. New requests pause only while it restarts.`,updaterReady:`Updates are ready on this host`,updaterUnavailable:`Updates are not available on this host`,updaterNeedsHost:`This process cannot replace its own container`,updaterUnavailableHint:`This page can check for new versions, but this host cannot apply them until updates are set up.`,updaterNeedInstall:`Install the host updater from deploy/install-updater.sh or deploy/install-updater.ps1 so it can talk to Docker.`,updaterNeedCompose:`Linux needs the updater socket mounted into the container. Docker Desktop uses a loopback updater URL instead of a Unix socket.`,updaterNeedRelease:`The running build must be a published GitHub release, not a local or development image.`,updateNow:`Download update`,applyUpdateNow:`Update now`,cancelUpdate:`Cancel download`,discardPreparedImage:`Discard this update`,updateReadyHint:`The update is downloaded. Apply it when you want to restart; new requests pause only then.`,updateReadyTargetHint:`Ready to switch to {version}. New requests pause only during the restart.`,updateNewerReleaseHint:`A newer version is available ({latest}). Update now, or discard this download and start again.`,updateStagedUnavailableHint:`Update the host updater first to use the staged update flow.`,updateLegacyOneShotHint:`This host will download and apply the update in one step. Later versions can download first, then wait for Update now.`,rollbackToVersion:`Restore an older version`,rollbackToVersionHint:`You can restore one of the three most recent versions before the one running now.`,updateReloadingIn:`Refreshing in {seconds}s`,updateInProgress:`Updating…`,updatePreparingImage:`Downloading update…`,updatePreparingImageHint:`Downloading the update in the background. This host stays on the current version until you tap Update now. Cancel if the download hangs.`,updateApplyingHint:`Applying the update. This page will refresh when it is ready.`,updateInProgressHint:`The service is updating and will refresh automatically when it is ready.`,updateUnavailableHint:`Updates are temporarily unavailable. Please try again later.`,updateFailedHint:`The update could not be completed. Please try again.`,updateCheckFailedHint:`Unable to check for updates. Please try again later.`,updatePreparingHint:`Getting the update ready: checking the version and saving a backup. Existing connections may be interrupted; clients can retry.`,updateRunningHint:`The update is running. This page will refresh when it is ready.`,updateReloadingHint:`Update complete. Refreshing this page…`,updateElapsed:`{seconds}s elapsed`,sqliteProtection:`SQLite protection`,sqliteProtectionHint:`Your data stays in place, and a verified backup is created before the update.`,sqliteBackupBeforeUpdate:`Verified backup before the update`,sqliteKeepFive:`Keep the five most recent backups`,sqliteRollbackTogether:`Restore the database and previous version together if the update fails`,updateStatus:`Update status`,noUpdateJob:`No update job yet`,confirmUpdate:`Update now`,confirmUpdateHint:`New requests pause briefly while a backup is created. Existing connections may be interrupted; clients can retry them.`,updateState_idle:`Idle`,updateState_unavailable:`Unavailable`,updateState_queued:`Waiting to start`,updateState_preparing:`Getting ready`,updateState_preparing_image:`Downloading update`,updateState_checking:`Checking version`,updateState_backing_up:`Saving a backup`,updateState_submitting:`Starting update`,updateState_running:`Updating`,updateState_pulling:`Downloading update`,updateState_host_binary:`Downloading update helper`,updateState_image_ready:`Download complete`,updateState_ready_to_apply:`Ready to update`,updateState_recreating:`Restarting`,updateState_health_checking:`Checking that it started`,updateState_rolling_back:`Restoring previous version`,updateState_succeeded:`Updated`,updateState_rolled_back:`Restored previous version`,updateState_failed:`Update failed`,checking:`checking`,refresh:`Refresh`,apiKey:`API key`,apiKeyPh:`API key`,needApiKey:`Sign in with the console password to load data.`,loginTitle:`Enter the console`,loginLead:`This host already has a running CLI2API proxy. Use the same API key your clients send to /v1.`,loginDesc:`Same key as Authorization: Bearer on the API.`,loginFormTitle:`Continue`,loginPassword:`Console password`,loginPasswordPh:`API key`,loginNeedKey:`Password is empty.`,loginBadKey:`That key does not match this host.`,loginSubmit:`Continue`,loggingInConsole:`Checking…`,loginHint:`Self-hosted only. Account login happens after this, on Accounts.`,showPassword:`Show password`,hidePassword:`Hide password`,signOut:`Sign out`,checkingSession:`Checking session…`,refreshing:`Refreshing`,pages:{home:{title:`Overview`,desc:`Runtime health, request volume, and ready endpoints.`},auth:{title:`Auth`,desc:`Browser device-flow login, PAT login, and session rewarm.`},providers:{title:`Models`,desc:`Models from signed-in accounts, plus per-model defaults for context and reasoning.`},modelPool:{title:`Dispatch groups`,desc:`A group is one model clients call.`},access:{title:`Access & try`,desc:`Multi-turn chat in the main panel; expand Raw API below to debug.`},accounts:{title:`Accounts`,desc:`One login per account. Browser sign-in first; PAT only when needed.`},usage:{title:`Usage`,desc:`Usage by model, account and provider.`},logs:{title:`Logs`,desc:`Recent proxy requests and process output.`},keys:{title:`API keys`,desc:`Create client keys and limit their providers and concurrency.`},system:{title:`System settings`,desc:`Cross-provider routing, managed updates, SQLite protection, and the console API key.`},login:{title:`Enter the console`,desc:`Same API key as /v1.`}},logsRequests:`Request history`,logsRuntime:`Runtime logs`,logsEmptyRequests:`No requests recorded yet.`,logsEmptyRuntime:`No runtime lines captured yet.`,logsSearchRuntime:`Search runtime output…`,logsSearchRequestId:`Find a request id`,logsSearchModel:`Find a model`,logsSearchAccount:`Find an account`,logsFilterIdAll:`All request IDs`,logsNoFilterOptions:`No matching options`,logsClear:`Clear history`,logsClearConfirm:`Delete all request history on this host?`,logsColTime:`Time`,logsColAccount:`Account`,logsColApiKey:`API key`,logsColProvider:`Provider`,logsColModel:`Model`,logsColReasoning:`Reasoning`,logsColStatus:`Status`,logsColLatency:`Latency`,logsColTTFT:`First token`,logsLatencyTotal:`Total`,logsOutputTPS:`Output TPS`,logsColTokens:`Tokens`,logsTokensIn:`in`,logsTokensOut:`out`,logsTokensPoints:`{value} pts`,logsColStream:`Mode`,logsStreamYes:`stream`,logsStreamNo:`sync`,logsFilterAll:`All`,logsFilterOk:`OK`,logsFilterIncomplete:`Incomplete`,logsFilterError:`Error`,logsFilterCanceled:`Canceled`,logsFilterAccountAll:`All accounts`,logsFilterApiKeyAll:`All API keys`,logsSearchApiKey:`Find an API key`,logsFilterProviderAll:`All providers`,logsFilterModelAll:`All models`,logsFilterKindAll:`All errors`,logsFilterStreamAll:`All modes`,logsTimeRange:`Time`,logsTimeAll:`All time`,logsTime1h:`1 hour`,logsTime24h:`24 hours`,logsTime7d:`7 days`,logsTimeCustom:`Custom`,logsTimeFrom:`From`,logsTimeTo:`To`,logsKindQuota:`Quota`,logsKindRateLimit:`Rate limit`,logsKindAuth:`Auth`,logsKindNotReady:`Not ready`,logsKindUnavailable:`Unavailable`,logsKindInvalidRequest:`Invalid request`,logsKindModelNotAvailable:`Model missing`,logsPageSize:`Per page`,logsPage:`Page {page} / {pages}`,logsPrevPage:`Previous`,logsNextPage:`Next`,logsNoMatch:`No requests match these filters.`,logsLevelAll:`All`,logsLevelInfo:`Info`,logsLevelWarn:`Warn`,logsLevelError:`Error`,logsAttempts:`Attempts`,logsRouting:`Routing`,logsRouting_pool:`Pool`,logsRouting_pin:`Pinned`,logsRouting_sticky:`Session sticky`,logsRouting_sticky_escape:`Session escape`,logsNoAttempts:`No attempt details.`,logsStreamDiagnostics:`Stream diagnostics`,logsMessageShape:`Message shape`,logsMessageCount:`Messages`,logsEmptyMessageIndexes:`Empty indexes`,logsMessageRoles:`Roles`,logsCancellationSource:`Cancellation source`,logsUpstreamStatus:`Upstream status`,logsSSEEvents:`SSE events`,logsBytesRead:`Bytes read`,logsLastEvent:`Last event`,logsStreamComplete:`Completed with [DONE]`,logsUsageDetail:`Consumption`,logsCreditConsumed:`Points consumed`,logsDetailTitle:`Request detail`,logsSectionCall:`Call`,logsSectionDiagnostics:`Diagnostics`,logsRuntimeDetailTitle:`Runtime log detail`,logsRuntimeLevel:`Level`,logsRuntimeSource:`Source`,logsRuntimeMessage:`Message`,logsShownTotal:`{shown} / {total}`,logsAutoRefresh:`Live`,failedLogs:`Failed to load logs: {msg}`,homeEyebrow:`Runtime`,metricRequests:`Requests`,metricSuccess:`Success`,metricLatency:`p95`,metricTokens:`Tokens`,statsWindow1h:`1h`,statsWindow24h:`24h`,statsWindow7d:`7d`,statsWindow30d:`30d`,statsWindowCustom:`Custom`,statsWindowToday:`Today`,statsRefreshPause:`Pause auto-refresh`,statsRefreshResume:`Resume auto-refresh`,statsRefreshAuto:`Refreshing every 30s · click to pause`,statsRefreshPaused:`Auto-refresh paused · click to resume`,statsDragHint:`Drag to open logs for a range`,statsWindowHint:`{window} window`,statsTraffic:`Traffic`,statsTrafficHint:`Completed chat requests in the selected window`,statsEmptyTraffic:`No requests in this window yet.`,statsLatencyP50:`p50`,statsLatencyP95:`p95`,statsLatencyAvg:`avg`,statsTTFB:`TTFB`,statsPool:`Account pool`,statsPoolHint:`Ready workers and remaining quota`,statsCooling:`cooling`,statsCoolingChip:`{count} cooling`,statsPoolReadyEmpty:`No ready workers right now — check cooling above or Accounts.`,statsTopModels:`Top models`,statsTopAccounts:`Top accounts`,statsTopProviders:`Providers`,statsTopProvidersHint:`Request share by account family`,statsNoProviders:`No provider traffic yet.`,statsErrorMix:`Error mix`,statsStatusMix:`Outcomes & errors`,statsStatusMixHint:`Request status, failure kinds and busiest accounts`,statsCoolingDetails:`Cooling down · reason · remaining · backoff`,statsBackoffLevel:`Restart backoff level`,statsAffinityHit:`Affinity hit`,statsAffinityHint:`{hits} hits · {misses} misses · {bindings} bindings`,metricCacheHit:`Cache hit rate`,metricCacheHitDetail:`{read} cached / {prompt} prompt`,metricStreaming:`Streaming share`,metricStreamingDetail:`{count} of {total} requests`,metricCanceled:`Canceled`,metricCanceledDetail:`{rate} of requests`,statsErrorMixHint:`Classified failures in this window`,statsNoModels:`No model traffic yet.`,statsNoAccounts:`No account traffic yet.`,statsNoErrors:`No classified errors.`,statsUnknown:`unknown`,statsUnassigned:`unassigned`,resTitle:`Resources`,resHint:`Host process memory and CPU`,resServer:`Server`,resWorkers:`Workers`,resEmpty:`No worker processes yet.`,resGoroutines:`goroutines`,resCpuLifetime:`lifetime avg`,failedStats:`Failed to load stats: {msg}`,homeNote:`Signed into the local console. Account logins live on the Accounts page.`,metricRuntime:`Runtime`,metricAccounts:`Accounts`,metricModels:`Models`,metricAuth:`Auth`,metricPort:`Port`,serviceDetail:`Service detail`,endpoints:`Endpoints`,copyBaseUrl:`Copy Base URL`,copied:`Copied`,copy:`Copy`,open:`Open`,waitingOverview:`Waiting for overview…`,signIn:`Sign in`,connectQoder:`Connect account`,rewarm:`Rewarm`,rewarming:`Rewarming`,refreshAccount:`Refresh`,refreshingAccount:`Refreshing`,stepBrowserTitle:`Browser device flow`,stepBrowserDesc:`Opens account selection. Finish in the browser, then this page polls until the session is ready.`,startBrowserLogin:`Sign in with browser`,starting:`Starting…`,quotaLoading:`Getting quota…`,quotaUnavailable:`Quota unavailable`,authUrl:`Auth URL`,openAuthUrl:`Open link`,stepPatTitle:`Personal access token`,stepPatDesc:`Optional fallback when browser flow is inconvenient.`,pat:`PAT`,pasteToken:`paste token`,loginWithPat:`Login with PAT`,loggingIn:`Logging in…`,localState:`Local state`,raw:`Raw`,noAuthSnapshot:`No auth snapshot yet.`,catalog:`Catalog`,availableModels:`Available models`,modelsPulled:`Pulled from`,filter:`Filter`,filterPh:`glm / qwen / deepseek`,providerFilterAll:`All providers`,accountStatusFilter:`Account status`,connection:`Connection`,apiPlaygroundHint:`Pick an account and model. Switch Chat / Raw API at the top — Raw API has JSON and curl.`,readyAccounts:`{ready} of {total} accounts ready`,baseUrl:`Base URL`,externalClients:`External clients`,protocol:`Protocol`,quickTest:`Quick test`,requestBuilder:`Request builder`,responseInspector:`Response inspector`,responseInspectorHint:`Raw JSON from the local proxy`,requestIdle:`Idle`,requestComplete:`Complete`,requestFailed:`Request failed`,responseReceived:`Response received`,responseEmptyTitle:`No response yet`,responseEmptyHint:`Choose a route, write a prompt, and send the request. The raw response appears here.`,sendRequest:`Send request`,promptPlaceholder:`Write a message for the model`,promptHelper:`This test uses a non-streaming Chat Completions request.`,accessTabChat:`Chat`,accessTabApi:`Raw API`,accessTabsLabel:`Access modes`,chatTryEmptyTitle:`No reply yet`,chatTryEmptyHint:`Write a message below. Account and model live in the composer. Session clears when you leave.`,chatTryHelper:`Enter to send · Shift+Enter for a new line`,chatTrySend:`Send`,chatTryStop:`Stop`,chatTryStreaming:`Streaming…`,chatTryUserLabel:`You`,chatTryAssistantLabel:`Assistant`,chatTryCreditsUsed:`Used {amount} credits`,chatTryUsageTokens:`{prompt} → {completion}`,chatTryUsageFoot:`{tokens} · {amount} credits`,chatHistoryTitle:`History`,chatHistoryNew:`New chat`,chatHistoryEmpty:`No chats yet`,chatHistoryUntitled:`Untitled`,chatHistoryExpand:`Show history`,chatHistoryCollapse:`Hide history`,nativeApiHint:`Non-streaming request, raw JSON response, and a matching curl command.`,rawFormatLabel:`API format`,rawFormatChat:`Chat`,rawFormatMessages:`Messages`,rawFormatResponses:`Responses`,rawFormatHint:`Chat Completions, Anthropic Messages, and OpenAI Responses are all supported.`,rawApiShow:`Show raw API`,rawApiHide:`Hide raw API`,chatAttach:`Attach file`,chatAttachRemove:`Remove attachment`,chatAttachUnsupported:`Unsupported file type: {names}`,thinkingPhaseScan:`Scanning`,thinkingPhasePlan:`Planning`,thinkingPhaseDraft:`Drafting`,thinkingDone:`Thought`,thinkingElapsed:`{n}s`,toolCallGroup:`Used {n} tools`,chatDemoLoad:`Preview sample`,thinkingChars:`{count} chars`,thinkingWorking:`Thinking`,toolCallRunning:`Running`,toolCallSuccess:`Done`,toolCallError:`Error`,toolCallUntitled:`tool`,toolCallArgs:`Arguments`,toolCallArgsEmpty:`(empty)`,autoAccountHint:`The scheduler chooses an available account.`,fixedAccountHint:`This request is pinned to the selected account.`,modelRoutingHint:`Uses the public model ID exposed by this proxy.`,accountModelHint:`Only models this account currently serves. A pinned request fails if the ID is missing here.`,noAccountModels:`This account has no models to send.`,accountModels:`Available models`,accountModelsTitle:`Models on {name}`,accountModelsHint:`Live catalog from this account. Requests pinned here only use these IDs.`,accountModelsEmpty:`This account has not published a model catalog yet.`,accountModelsError:`Could not load models: {msg}`,noAccountsForTest:`No account runtime is available. Add and sign in to an account before testing.`,curlGeneratedHint:`Generated from the current account, model, and prompt`,prompt:`Prompt`,model:`Model`,send:`Send`,waitingRequest:`Waiting for a request…`,requesting:`Requesting…`,endpointOpenAI:`OpenAI Compatible`,endpointChat:`Chat Completions`,endpointBaseHint:`Use this path as the base URL in OpenAI-compatible clients.`,endpointChatHint:`OpenAI-compatible chat. Prefix the model ID to pin one provider, for example qoder/glm-5.2.`,endpointMessages:`Anthropic Messages`,endpointMessagesHint:`Stateless Anthropic Messages. Use a provider-prefixed model ID to pin one family.`,endpointResponses:`OpenAI Responses`,endpointResponsesHint:`Stateless OpenAI Responses. Use a provider-prefixed model ID to pin one family.`,endpointModels:`Models`,endpointModelsHint:`Public model IDs. Named API keys only see models from their allowed providers.`,endpointHealth:`Health`,endpointHealthHint:`Check whether the local proxy is responding.`,endpointCount:`{count} API routes`,endpointReady:`Available now`,endpointBaseLabel:`Client base URL`,endpointAuthLabel:`Bearer API key`,hasUserBlob:`Has user blob`,userBlobBytes:`User blob bytes`,machineId:`Machine ID`,sessionHot:`Session hot`,upstreamEndpoint:`Upstream endpoint`,rewarmCount:`Rewarm count`,proxy:`Proxy`,endpoint:`Endpoint`,lastError:`Last error`,running:`Running`,down:`Down`,hot:`Hot`,up:`Up`,ready:`Ready`,missing:`Missing`,degraded:`Degraded`,error:`Error`,yes:`yes`,no:`no`,modelCol:`Model`,mappedKeyCol:`Upstream key`,requestIdCol:`Request ID`,providerCol:`Provider`,qoderKeyCol:`Upstream key`,routedTo:`Upstream model {model}`,stateCol:`State`,contextWindowCol:`Maximum context window`,modelDefaultsCol:`Context and reasoning`,providerSettingsTitle:`Provider settings`,providerSettingsOpen:`Settings`,providerExpand:`Expand provider`,providerCollapse:`Collapse provider`,providerSettingsHint:`Applies to every account of this provider and region. The provider policy is the single source of truth for floors, proxy, system-prompt handling, aliases, model restrictions, and check-in time; account names, concurrency, and priority stay account-local.`,providerSettingsSaved:`Provider settings saved. Matching accounts now read this policy directly; no account rows were rewritten.`,providerSettingsLoadFailed:`Could not load provider settings. Refresh the page and try again.`,providerSettingsRegionMissing:`This provider group has no region yet. Refresh the model catalog and try again.`,providerSettingsSavedRefreshFailed:`Settings were saved, but the model list could not refresh: {message}`,providerModelsEmpty:`Select at least one model or turn off the model restriction.`,upstreamMaxContext:`Upstream max context`,imageInput:`Image input`,imageInputDeclared:`Declared by upstream`,imageInputNotDeclared:`Not declared`,imageInputUnsupported:`Not declared as supported`,qoderContextHint:`Default context window used when the request omits context length / max input tokens.`,contextInvalid:`Context window must be an integer between 1,024 and 4,000,000 tokens.`,contextSaved:`Saved context window for {model}.`,contextReset:`Restored the default context window for {model}.`,contextMaxOn:`Enabled Max context for {model}.`,contextMaxOff:`Disabled Max context for {model}.`,contextMaxUnavailable:`This model has no Max context switch.`,maxMode:`Max context`,maxModeHint:`Trae larger context window, often 200k to 1M. Not a plan or quota. Used only when the request omits is_max_mode; an explicit request still wins. Unsupported models never send this switch.`,qoderMaxModeHint:`Qoder larger context window. Not a plan or quota. When on, requests use the model’s largest window; when off (or when a request sets its own context) the default window applies.`,catalogWindow:`Catalog size`,catalogWindowHint:`This Trae model has no Max-context switch. The number is the catalog window.`,workbuddyContextHint:`WorkBuddy desktop default and optional context budgets from the catalog. This is a local compact budget, not Trae is_max_mode. Chat requests do not send a window switch.`,reasoningLevels:`Reasoning intensity`,reasoningHint:`Default thinking effort when the request omits reasoning_effort and related flags. This does not lock every call to that level, and it does not cap a higher client value. A level the model does not allow falls back to an allowed option.`,reasoningFixed:`Fixed thinking: {type}`,noReasoningLevels:`This model has no selectable reasoning levels.`,reasoningSaved:`Saved default reasoning for {model}: {level}.`,reasoningLevel_none:`Off`,reasoningLevel_low:`Low`,reasoningLevel_medium:`Medium`,reasoningLevel_high:`High`,reasoningLevel_xhigh:`Extra high`,reasoningLevel_max:`Max effort`,modelDetails:`Details`,modelDetailsCol:`Model details`,promptMaxTokens:`Prompt max`,maxOutputTokens:`Output max`,actions:`Actions`,save:`Save`,custom:`Custom`,defaultValue:`Default`,resetDefault:`Restore default`,fallback:`fallback`,modelFree:`(free)`,shownTotal:`{shown} shown / {total} total`,noModelsYet:`No models yet`,noModelsMatch:`No models match this filter.`,noProviders:`No providers loaded.`,failedOverview:`Failed to load overview: {msg}`,pastePatFirst:`Paste a PAT first`,patDone:`PAT login completed`,loginOpenMsg:`Open the auth URL to finish login`,idle:`idle`,menu:`Menu`,toggleSidebar:`Toggle sidebar`,accountsTitle:`Accounts`,accountsDesc:`One login per account. Chat round-robins and fails over.`,noAccounts:`No accounts yet. Add one to start serving chat.`,accountCount:`Accounts`,signedIn:`Signed in`,enabledAccounts:`Enabled`,availableAccounts:`Available`,needsAttention:`Needs attention`,searchAccounts:`Search name, ID, UID, provider, or auth type`,filterAll:`All`,shownAccounts:`{shown} / {total}`,noAccountsMatch:`No accounts match this filter.`,clearFilters:`Clear filters`,more:`More actions`,partialCooling:`Partial model cooldown`,modelCooldowns:`Model cooldowns`,modelCooldownsTitle:`Models in cooldown`,modelCooldownsEmpty:`No models are in cooldown.`,runtimeState:`Runtime state`,maxInflight:`Max concurrency`,priority:`Priority`,updatedAt:`Updated`,enabledState:`Enabled`,cooling:`Cooling down`,dead:`Recovering`,authFailed:`Auth failed`,patFallback:`PAT fallback`,usePat:`Use PAT`,account:`Account`,autoAccount:`Auto (round-robin)`,cooldown:`Cooldown`,inFlight:`In-flight`,liveConcurrency:`Concurrency`,liveRpm:`Last 60s`,liveRpmUnit:`req`,liveRpmHint:`started in the last minute`,liveTrace:`Trend`,livePeak:`peak {n}`,liveSaturated:`Saturated`,inflightTitle:`Live now`,inflightMockBadge:`mock`,inflightIdleBadge:`idle`,inflightMockToggle:`Demo`,inflightMockToggleAria:`Show mock demo when live is unavailable`,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`,inflightNow:`now`,inflightAgo:`ago`,inflightMore:`more`,inflightKindModel:`Model call`,inflightKindTool:`Tool call`,inflightKindEmbed:`Embedding`,inflightKindOther:`Other`,inflightPriority:`Priority`,inflightAttempt:`Attempt`,inflightPosition:`Position`,inflightWaited:`Waited`,inflightHigh:`High`,inflightLow:`Low`,inflightNormal:`Normal`,inflightPositionValue:`{n} of {total}`,inflightClose:`Close details`,inflightAttemptValue:`{n} of {max}`,inflightAnnounceFailed:`{name} failed`,inflightAnnounceFailedDetail:`{name} failed: {error}`,inflightAnnounceRetry:`{name} failed, retrying, attempt {attempt}`,inflightAnnounceLimited:`Rate limited, workers paused for {seconds} seconds`,inflightAnnounceResumed:`Rate limit lifted, workers resumed`,inflightAnnouncePressure:`{n} jobs waiting, above the backpressure line of {line}`,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`,dropSystemPromptTraeHint:`Keep caller system prompts. Clients such as MiMo Code put JSON instructions there; turn this on only if Trae rejects the request.`,autoCheckin:`Daily check-in`,autoCheckinHint:`Run the daily WorkBuddy credit check-in at the configured local time. Failed attempts retry around 21:00. Off by default.`,autoCheckinCreateHint:`WorkBuddy only. Enable automatic daily credit check-ins. The first attempt uses this account time, or the system default if left unchanged.`,autoCheckinTime:`Check-in time`,checkinAutoMode:`Auto (upstream window + 1 hour)`,checkinAutoFallbackHint:`The value above is the provider fallback. After the first upstream sync, each account stores its own exact time in its card.`,autoCheckinTimeHint:`Uses server local time and runs within about 14 minutes after the selected time. Failed attempts retry around 21:00. New accounts follow this provider policy.`,checkinNow:`Check in now`,quotaWindowsExpand:`Show more quota rows ({count})`,quotaWindowsCollapse:`Show fewer quota rows`,claimStudentCredit:`Claim monthly student benefit`,studentCreditClaimed:`Monthly student benefit claimed`,studentCreditAlready:`Monthly student benefit already claimed`,studentCreditFailed:`Monthly student benefit claim failed`,studentCreditUnavailable:`Monthly student benefit unavailable`,checkinAll:`Check in all`,checkinAllEmpty:`No enabled accounts support check-in`,checkinAllDone:`All {count} accounts are already checked in today`,toastCheckingInAll:`Checking in {done} of {total}…`,toastCheckedInAll:`Checked in {checked}, skipped {skipped}`,toastCheckedInAllFailed:`Checked in {checked}, skipped {skipped}, failed {failed}`,lastCheckin:`Last check-in`,lastCheckinNone:`No check-in yet`,checkinStatus:`Check-in`,checkinDaily:`Daily`,regionCN:`CN`,regionGlobal:`Global`,checkinToday:`Checked in today`,checkinPending:`Not checked in today`,checkinFailed:`Check-in failed`,checkinRecords:`Check-in records`,checkinRecordsTitle:`Check-in records · {name}`,checkinRecordsHint:`The latest 20 check-in attempts for this account.`,checkinRecordsEmpty:`No check-in records yet`,checkinRecordsCount:`{count} records`,checkinRecordSuccess:`Success`,checkinRecordAlready:`Already checked in`,checkinRecordFailed:`Failed`,checkinRewardSuffix:` · +{credits} credits`,checkinTruncated:`Message truncated · use copy for the full error`,checkinCopyError:`Copy full error`,refreshCredits:`Refresh credits`,expiryDistTitle:`Credit expiry distribution`,expiryDistHint:`Grouped by calendar day · colour marks the account · FEFO: upstream burns the soonest-expiring credits first`,expiryDistExpand:`Show all {n} days`,expiryDistCollapse:`Show less`,expiryDistDayTotal:`{n} credits expire`,expiryDistColAccount:`Account`,expiryDistColSoonest:`Soonest`,expiryDistColDaysLeft:`Days left`,expiryDistColBatch:`Expiring`,expiryDistColDaily:`Daily burn`,expiryDistDays:`{n}d`,expiryDistFoot:`"Daily burn" = credits expiring on the soonest day ÷ days until then — the pace needed to use them before they lapse.`,expiryDistExpired:`Expired`,usageColModel:`Model`,quota:`Quota`,quotaUsed:`Used`,quotaRemaining:`Remaining`,quotaDaily:`Daily quota`,quotaWeekly:`Weekly quota`,quotaMonthly:`Monthly quota`,quotaFiveHour:`5-Hour Limit`,quotaWeeklyLimit:`Weekly Limit`,quotaPlan:`Plan`,quotaPeriodEndDate:`Plan period ends {date}`,quotaExpiringSoonCredits:`{amount} credits expire within 7 days`,quotaMonthlyLimit:`Monthly Limit`,quotaUsedPercent:`{n}% used`,quotaResetsSoon:`Resets soon`,quotaResetsInMinutes:`Resets in {n} minutes`,quotaResetsInHours:`Resets in {n} hours`,quotaExpiresOn:`{amount}{unit} expire on {date}`,quotaAddOn:`Add-on`,quotaResourcePackage:`Resource package`,quotaExceeded:`Quota exceeded`,quotaOverageWindow:`Overage`,overageTitle:`Overages`,overagePull:`Pull from AWS`,overageEnabled:`On. After plan credits run out, extra use is billed at the overage rate.`,overageDisabled:`Off. Requests stop when plan credits run out.`,overageUnknown:`Unknown. Pull from AWS to read the switch.`,overageNotCapable:`This subscription does not support overages.`,overageReadOnly:`This login has no AWS profile, so the switch cannot be changed.`,overageHint:`The switch calls AWS and turns Kiro overages on or off immediately.`,overageFigures:`Cap {cap} · Rate {rate} · Billed {current}`,toastOveragePulled:`Overage status updated from AWS`,toastOverageOn:`Overages enabled`,toastOverageOff:`Overages disabled`,errorKind:`Error kind`,qoderLoginHint:`This signs in the upstream account only. It does not change the console password.`,needQoderLogin:`Needs account login`,waitingQoderLogin:`Waiting for account login…`,qoderLoginDone:`Account login completed`,rewarmDone:`Rewarm completed`,accountsSigned:`{n} / {total} accounts ready`,addAccount:`Add account`,exportAll:`Export all accounts`,importAll:`Import all accounts`,bundleExportHint:`Keep this file private — it contains sign-in credentials.`,toastAccountsExporting:`Preparing account export…`,toastAccountsExported:`Exported {n} accounts to a file.`,batchImport:`Batch import`,batchImportLoading:`Importing WorkBuddy accounts…`,batchImportUnrecognized:`Could not recognize this credential file format.`,batchImportConfirmTitle:`Confirm batch import`,batchImportConfirmHint:`Detected from {file}. Review and confirm before importing.`,batchImportConfirmHintNoFile:`Review the detected format, then confirm to import.`,batchImportRegion:`WorkBuddy region`,batchImportRegionPickHint:`Region was unclear — pick CN or Global before importing.`,batchImportRegionMixed:`This pack mixes CN and Global domains. Split it, or pick one region to force.`,batchImportRegionUnknown:`Region not detected from domains — please confirm.`,batchImportUnknownFormat:`Unknown format field; guessed from shape.`,batchImportProviderUnsupported:`Batch import for this provider is not supported yet. Detection is ready for a future release.`,batchImportConfirmAction:`Import`,batchImportFormatUnknown:`Unknown format`,batchImportProviderUnknown:`Unknown provider`,bundleImportConfirmTitle:`Import all accounts?`,bundleImportConfirmHint:`From {file}. This restores the accounts stored in the file.`,bundleImportConfirmHintNoFile:`This restores the accounts stored in the selected file.`,bundleImportConfirmAction:`Import all`,bundleImportAccountCount:`accounts in this file`,bundleImportCountDetail:`{credentials} of them include a stored sign-in credential.`,bundleImportAdditiveHint:`Import adds new accounts with fresh IDs. Existing accounts are not changed.`,bundleImportLoading:`Importing accounts…`,bundleImportUnrecognized:`This is not a valid full account export file.`,accountName:`Account name`,accountNameRequired:`Enter an account name.`,accountCreated:`Account created. Session is starting.`,importCredential:`Import native credential`,accountImported:`Credential imported and runtime started.`,accountImportBatch:`Imported {n} accounts.`,accountImportPartial:`Imported {ok}, failed {fail}.`,credentialCopied:`Credential bundle copied.`,addAccountTitle:`Add account`,accountType:`Account type`,loginMethod:`Login method`,accountTypeHint:`Choose the upstream login family for this isolated runtime.`,accountTypeQoderGlobal:`Qoder Global`,accountTypeQoderGlobalHint:`Qoder Global via browser, PAT, or imported credential`,accountTypeQoderCN:`Qoder CN`,accountTypeQoderCNHint:`Qoder China via browser, PAT, or imported credential`,accountTypeWorkBuddyCN:`WorkBuddy CN`,accountTypeWorkBuddyCNHint:`CodeBuddy CN via browser login or imported credential`,accountTypeWorkBuddyGlobal:`WorkBuddy Global`,accountTypeWorkBuddyGlobalHint:`WorkBuddy Global via browser login or imported credential`,accountTypeTraeCN:`Trae CN Solo`,accountTypeTraeCNHint:`Trae China Solo via browser login or imported credential`,accountTypeDevinGlobal:`Devin (experimental)`,accountTypeDevinGlobalHint:`Experimental Devin Global via browser OAuth or session token import`,accountTypeCommandGlobal:`Command Code`,accountTypeCommandGlobalHint:`Command Code via a pasted user_… key. Speaks the CLI /alpha/generate protocol, so every plan works, including the $1 Go plan.`,accountTypeOpenCode:`OpenCode`,accountTypeOpenCodeGo:`OpenCode Go`,accountTypeOpenCodeGoHint:`Experimental. Paste an OpenCode API key. This account calls the Go subscription gateway.`,accountTypeOpenCodeZen:`OpenCode Zen`,accountTypeOpenCodeZenHint:`Experimental. Paste an OpenCode API key. This account calls the Zen pay-as-you-go gateway.`,accountTypeCodexGlobal:`Codex`,accountTypeCodexGlobalHint:`OpenAI Codex via Codex CLI OAuth, Sign in with ChatGPT, or an imported credential`,accountTypeZhipuCN:`Zhipu GLM`,accountTypeZhipuCNHint:`Zhipu GLM with an API key. Choose pay-as-you-go or Coding Plan, the same way the upstream account is billed.`,accountTypeQwenworkGlobal:`QwenWork International`,accountTypeQwenworkGlobalHint:`QwenWork international (qwenwork.ai) via browser OAuth or imported credential. The authorization link is single-use: open it directly in a browser already signed in to the target account, and do not send it through chat tools.`,accountTypeQwenworkCN:`QwenWork CN`,accountTypeQwenworkCNHint:`千问办公 China (qwenwork.cn) via browser OAuth or imported credential. The authorization link is single-use: open it directly in a browser already signed in to the target account, and do not send it through chat tools. The CN region has not yet been verified with a real account.`,accountTypeKimiCN:`Kimi Code CN`,accountTypeKimiCNHint:`Kimi Code China subscription via device-code sign-in against auth.kimi.com. Uses the same OAuth client as the official CLI, so the login you already completed with Kimi Code can be pasted in as its credential JSON.`,accountTypeCodeArtsCN:`CodeArts (码道)`,accountTypeCodeArtsCNHint:`Huawei Cloud CodeArts Agent via OAuth PKCE against codearts.huaweicloud.com. The console opens the authorization page; a pasted 127.0.0.1 callback URL also completes the login when the browser cannot reach this host.`,accountTypeDoubaoworkCN:`Doubao Work (豆包工作)`,accountTypeDoubaoworkCNHint:`Doubao Work subscription via a pasted web-session Cookie. Copy the Cookie from a logged-in doubao.com session in your own browser; the server validates it on import. There is no browser or client auto-login because the gateway runs headless.`,doubaoCookieLead:`Log in to www.doubao.com in your browser, open developer tools → Network, refresh, open any doubao.com request, and copy the full Cookie request header. Paste it below; the account is validated and created immediately.`,doubaoCookieLabel:`Cookie`,doubaoCookiePh:`sessionid=...; sessionid_ss=...`,doubaoCookieRequired:`Paste the Doubao Work Cookie first.`,doubaoImport:`Add Doubao Work account`,doubaoSaveCookie:`Save Cookie`,accountTypeKiroUS:`Kiro (US East)`,accountTypeKiroUSHint:`Personal Kiro login. Paste a Builder ID, Identity Center, or social credential JSON, or a ksk_ key. Chat goes to the Kiro runtime in us-east-1. Experimental.`,accountTypeKiroEU:`Kiro (EU Central)`,accountTypeKiroEUHint:`Personal Kiro login for the eu-central-1 runtime. Same credential shapes as US East. Experimental.`,accountTypeMetaGlobal:`Muse (Meta)`,accountTypeMetaGlobalHint:`Meta Muse Code subscription via device-code sign-in against auth.meta.com. After approval the console mints an LLM API key at api.meta.ai. You can also paste a Meta Model API key on the PAT tab.`,accountTypeMiniMaxCodeCN:`MiniMax Code (CN)`,accountTypeMiniMaxCodeCNHint:`MiniMax Code subscription via its official device-code sign-in. Routes through the CN agent gateway and consumes your MiniMax Code credits.`,accountTypeMiniMaxCodeGlobal:`MiniMax Code (Global)`,accountTypeMiniMaxCodeGlobalHint:`MiniMax Code subscription via its official device-code sign-in. Routes through the global agent gateway and consumes your MiniMax Code credits.`,providerGroupSubscriptions:`Subscriptions`,providerGroupSubscriptionsHint:`stable account logins`,providerGroupExperimental:`Experimental`,providerGroupExperimentalHint:`early adapters`,providerFindPlaceholder:`Find a provider...`,providerFindEmpty:`No providers match this search.`,caiaiSoftLink:`Prefer hosted? Try CaiAI`,addAccountDesc:`Create an isolated account session. Each account keeps its own runtime home.`,tabBrowser:`Browser login`,tabPat:`PAT`,tabImport:`Import credential`,recommended:`Recommended`,wizardSettings:`Account settings`,wizardAdvanced:`Advanced options`,wizardContinue:`Continue`,wizardBack:`Back`,wizardSettingsHint:`Set these before login. You can still change them later from Edit on the account card.`,editAccount:`Edit`,editAccountTitle:`Edit {name}`,editAccountHint:`Change the display name, concurrency, and routing priority. Provider-level settings on the Models page control proxy, aliases, model restrictions, floors, and check-in time.`,accountModelAliases:`Aliases`,accountModelAliasesHint:`A name this provider answers as. The request is rewritten to an account's real model after an account is picked.`,accountModelAliasTargetPlaceholder:`real model on this provider`,modelAliasName:`Alias`,modelAliasTarget:`Real model`,modelAliasAdd:`Add`,modelAliasRemove:`Remove`,modelAliasPlaceholder:`kimi-k3`,enabledModels:`Models`,enabledModelsHint:`Leave unrestricted to serve the whole catalog. Restrict to choose which models this provider may serve.`,restrictModels:`Only selected models`,allModels:`All models`,modelPickerSearch:`Search models`,modelPickerCount:`{selected} / {total} selected`,modelPickerSelectAll:`Select all`,modelPickerClear:`Clear`,modelPickerOffline:`Offline`,modelPickerRemove:`Remove {model}`,modelPickerNoMatch:`No matching models.`,maxInflightInvalid:`Concurrency must be an integer from 1 to 32.`,priorityInvalid:`Priority must be an integer from 1 to 100.`,wizardNamePh:`Account name`,maxInflightHint:`How many chats this account may run at once. Changing it later restarts the worker.`,priorityHint:`Higher numbers are preferred when routing later uses this field. Default 50.`,creditFloor:`Credit floor`,creditFloorHint:`When enabled, paid models are skipped once the sampled credit balance reaches this value; free models still work. Only accounts reporting credits are affected.`,creditFloorCustom:`Override the global floor for this provider`,creditFloorInheritHint:`Inherits CLI2API_CREDIT_FLOOR. Set 0 to explicitly disable the floor for this provider.`,creditFloorInvalid:`Credit floor must be zero or a positive number.`,percentFloor:`Percent floor`,percentFloorHint:`For accounts reporting remaining percentage (Devin, Kimi, Zhipu): skip paid models once remaining percent reaches this value. Independent of the credit floor; free models still work.`,percentFloorCustom:`Override the global percent floor for this provider`,percentFloorInheritHint:`Inherits CLI2API_PERCENT_FLOOR. Set 0 to explicitly disable the floor for this provider.`,percentFloorInvalid:`Percent floor must be a number between 0 and 100.`,proxyUrl:`Proxy URL`,proxyUrlPlaceholder:`http://127.0.0.1:7890, direct`,proxyUrlHint:`Blank inherits the global proxy. Use direct or none to bypass proxies for this provider. Qoder supports HTTP(S) only; WorkBuddy/Trae also support SOCKS5.`,proxySettingsTitle:`Outbound proxy`,proxySettingsHint:`Set the default proxy for upstream requests. Global proxies support HTTP(S) only. SOCKS5 is available for WorkBuddy/Trae provider-level proxies. Provider settings override it.`,dropSystemPromptCreateHint:`WorkBuddy only. Strip caller system prompts, then send an empty leading system slot so Global still accepts the request.`,wizardBrowserLead:`Shows the authorization URL. Open or copy it, finish in the browser, and this wizard continues automatically.`,wizardCodexBrowserLead:`Choose Codex CLI or Sign in with ChatGPT, then open the authorization URL. ChatGPT website logins need Sign in with ChatGPT; the CLI flow cannot refresh those tokens.`,codexLoginMethod:`Codex login`,codexLoginCli:`Codex CLI`,codexLoginCliHint:`Official Codex CLI OAuth. Use this for CLI-issued credentials.`,codexLoginChatGPT:`Sign in with ChatGPT`,codexLoginChatGPTHint:`ChatGPT website login. Stores a separate token that refreshes at a different endpoint.`,kiroLoginMethod:`Kiro sign-in`,kiroLoginBuilder:`Builder ID`,kiroLoginBuilderHint:`Device code. Open the link and approve it; this page finishes on its own.`,kiroLoginIDC:`Identity Center`,kiroLoginIDCHint:`Your organization portal. Paste its start URL, then approve in the browser.`,kiroLoginSSO:`SSO token`,kiroLoginSSOHint:`Paste a portal SSO bearer. It is exchanged once and not stored.`,kiroLoginMicrosoft:`Microsoft`,kiroLoginMicrosoftHint:`Enterprise SSO. Paste each localhost callback as the browser shows it.`,kiroIDCStartURL:`Identity Center start URL`,kiroIDCStartURLPh:`https://example.awsapps.com/start`,startCodexCliLogin:`Start Codex CLI login`,startCodexChatGPTLogin:`Sign in with ChatGPT`,wizardStartBrowser:`Start browser login`,wizardStartingSession:`Starting the account session…`,wizardWaitingBrowser:`Waiting for authorization in the browser…`,wizardCallbackLead:`If the browser stays on 127.0.0.1 and this console never finishes, copy the full address-bar URL here.`,wizardCallbackPh:`Paste the full http://127.0.0.1…/authorize?… URL`,wizardSubmitCallback:`Submit callback URL`,wizardStartingWorker:`Authorization received. Starting account session…`,wizardAccountReady:`Account is ready.`,wizardLoginTimeout:`Timed out waiting for browser login. You can retry from the account card.`,wizardPatLead:`Use a personal access token when the browser flow is inconvenient.`,wizardPatLeadCN:`Create a PAT at qoder.com.cn/account/integrations, then paste it here.`,wizardPatLeadCommand:`Paste your Command Code key (it looks like user_…, from commandcode.ai/settings).`,wizardPatLeadOpenCode:`Paste an OpenCode API key. The account type chooses Go or Zen.`,zhipuApiKey:`API key`,zhipuApiKeyPh:`Paste the key from open.bigmodel.cn`,zhipuAccountMode:`Account mode`,zhipuModePayg:`Pay as you go`,zhipuModePaygHint:`Billed by token. Uses the standard GLM endpoint.`,zhipuModeCoding:`Coding Plan`,zhipuModeCodingHint:`Subscription plan. Uses the Coding Plan endpoint and shows its quota.`,zhipuOrganization:`Organization ID`,zhipuOrganizationPh:`Optional, for a team Coding Plan`,zhipuProject:`Project ID`,zhipuProjectPh:`Optional`,zhipuCreate:`Add Zhipu account`,zhipuKeyRequired:`Paste the Zhipu API key first.`,wizardPatPh:`Paste personal access token`,wizardCreateAndLogin:`Create and sign in`,wizardImportLead:`Paste a credential JSON export. WorkBuddy hub packages import every account in the file.`,wizardImportPh:`Paste credential JSON`,wizardChooseFile:`Choose file`,wizardBadJson:`That does not look like a valid credential bundle.`,reLogin:`Sign in`,cancel:`Cancel`,close:`Close`,create:`Create`,import:`Import`,export:`Export`,enable:`Enable`,disable:`Disable`,disabled:`Disabled`,delete:`Delete`,holdToDelete:`Hold to delete`,trendHalfHint:`Second half of the window vs the first half`,toastRefreshingAccount:`Refreshing account…`,toastAccountRefreshed:`Account refreshed`,toastRefreshingCredits:`Refreshing credits…`,toastCreditsRefreshed:`Credits refreshed`,toastCreditsPartiallyRefreshed:`{failed} of {total} accounts failed to refresh`,toastAccountAdded:`Account added`,toastAccountDeleted:`Account deleted`,toastClearingLogs:`Clearing request logs…`,toastLogsCleared:`Request logs cleared`,toastKeyDeleted:`API key deleted`,toastFailed:`Operation failed`,deleteAccountConfirm:`Delete account {name}? This removes its local runtime and stored credential.`,edit:`Edit`,enabled:`Enabled`,keysCreate:`Create key`,keysEmpty:`No client keys yet`,keysEmptyHint:`Create a named key for OpenAI-compatible clients. It cannot sign in to this console.`,keysCreateTitle:`Create API key`,keysCreateHint:`The secret is shown once. Store it in the client that will call /v1.`,keysEditTitle:`Edit API key`,keysEditHint:`Rename the key, change which providers it may route to, or cap how many chats it may run at once.`,keysName:`Name`,keysNamePh:`CI bot`,keysNameRequired:`Name is required.`,keysProviders:`Providers`,keysProvidersHint:`Restrict this key to specific provider regions. Leave all unchecked to allow every provider.`,keysAllProviders:`All providers`,keysAllRegions:`All regions`,keysProvidersNotLoaded:`Provider list is still loading. Saving is disabled so the key permissions stay unchanged.`,keysProvidersLoadFailed:`Failed to load provider list: {message}`,keysMaxInflight:`Max concurrency`,keysMaxInflightHint:`How many /v1 chats this key may run at once. 0 means no limit. Extra requests get HTTP 429.`,keysMaxInflightInvalid:`Concurrency must be an integer from 0 to 256.`,keysMaxInflightValue:`Up to {count} at once`,keysMaxInflightUnlimited:`No concurrency limit`,keysModelAggregation:`Cross-provider aggregation`,keysModelAggregationHint:`When on, /v1/models lists the enabled models from the cross-provider model pool plus the public aliases this key can reach, merged into one provider-neutral name. Requests still route through the account pool. Provider selection is locked while this stays on.`,keysModelAggregationBadge:`Aggregated`,keysLastUsed:`Last used {time}`,keysNeverUsed:`Not used yet`,keysSecretTitle:`Store this secret now`,keysSecretHint:`This value is not stored in plaintext. It will not be shown again.`,keysSecretOnce:`Copy the key before closing this dialog.`,keysDeleteConfirm:`Delete API key {name}? Clients using it will fail immediately.`,consoleKeyTitle:`Console API key`,consoleKeyHint:`This is the administrator key used to sign in here.`,consoleKeyLead:`It can call every provider and manage accounts, keys, and updates. Client keys live on the API keys page.`,consoleKeyRotate:`Rotate key`,consoleKeyRotateHint:`Rotating signs you out of other sessions and restarts Qoder workers so they pick up the new secret.`,consoleKeyRotateNow:`Rotate now`,consoleKeySecretTitle:`New console key`,consoleKeySecretHint:`This browser session is already updated. Copy the key for any other clients that used the old console secret.`},zh:{brandSub:`登录态网关`,controlPlane:`控制平面`,workspace:`工作区`,develop:`开发`,system:`系统`,runtimeSnapshot:`运行时与调度器快照`,routesHint:`OpenAI / Anthropic 兼容端点`,clientConfig:`客户端配置`,clientConfigHint:`使用与控制台相同的密钥作为 Bearer Token`,providerPrefixHint:`用 qoder/、workbuddy/、trae/、devin/、command/、codex/、zhipu/、qwenwork/、kimi/、codearts/、kiro/、meta/、opencode/ 或 doubaowork/ 前缀指定供应商。客户端 API 密钥也可以限制可见和可调度的供应商。不带前缀时是否跨供应商,由系统设置里的模型池决定。`,authentication:`认证方式`,curlExample:`curl 示例`,quickTestHint:`通过所选账号发送一条真实请求`,response:`响应`,providerCatalog:`模型目录`,providerCatalogMeta:`已登录 / 实时`,checkAllModels:`检查所有模型`,checkingModels:`检查中…`,checkModelsHint:`每个模型对每个可用账号发送一次仅 1 token、关闭思考的真实请求。会真实消耗供应商额度,但不计入用量页统计。`,checkModelsSummary:`{passed} 可通 · {failed} 失败 · {total} 总计 · {elapsed}ms`,checkModelsEmpty:`没有可检查的模型。`,checkResultOK:`可通`,checkResultFailed:`失败`,checkResultSkipped:`跳过`,checkAccountResults:`账号结果`,checkNotRun:`未检查`,checkPassedAccounts:`{passed}/{total} 个账号`,accountPool:`账号池`,accountCreateHint:`先创建隔离运行时,再通过浏览器或 PAT 登录。`,credentialImportHint:`仅支持从本控制台导出、且 user blob 与 machine ID 匹配的凭证包。`,accountEmptyHint:`创建一个账号运行时后即可开始。`,oauthDeviceFlow:`OAuth 浏览器登录`,navOverview:`概览`,navAuth:`账号`,navProviders:`模型`,navModelPool:`调度组`,navAccess:`接入与调试`,navAccounts:`账号`,checkinDefaultsTitle:`自动签到`,checkinDefaultsHint:`按供应商设置默认时间。跟随默认的账号会立即采用新时间,账号自定义时间不受影响。`,checkinDisabledAccountsTitle:`停用账号也自动签到`,checkinDisabledAccountsHint:`开启后,停用聊天功能的账号仍可执行已开启的自动签到;停用账号仍不可手动签到。`,checkinDisabledAccountsStatus:`当前状态`,checkinDisabledAccountsAriaLabel:`允许停用账号自动签到`,checkinInherit:`跟随供应商策略`,checkinDefaultValue:`供应商默认:{time}`,checkinCustom:`账号自定义`,checkinConfigured:`已配置`,checkinScheduleHint:`按下方显示的服务器时钟执行,通常在设定时间后的约 90 秒内开始,多账号顺序处理可能延后;失败或日界未确认的尝试会在约 02:05、12:05 和 21:00 重试。签到不影响聊天。`,checkinTimeInvalid:`请输入有效的签到时间(HH:mm)。`,checkinRecordSkipped:`活动未开放`,checkinStatusPending:`上游显示未签到`,checkinStatusUnknown:`上游状态未知`,checkinUpstreamSynced:`上游同步于 {time}`,checkinServerClock:`服务器时钟 · {timezone}`,checkinServerTime:`服务器时间:{time}`,checkinAutoScheduleHint:`自动排期:上游最早可签到时间 + 1 小时({time});手动设置的时间仍然优先。`,navUsage:`用量`,usageTitle:`用量`,usageByModel:`模型`,usageByAccount:`账号`,usageByProvider:`供应商`,usageColRequests:`请求`,usageColSuccess:`成功率`,usageColTokens:`Tokens`,usageColCacheWrite:`缓存写入`,usageColCredits:`积分`,usageRowCount:`{count} 行`,usageShareOther:`其他`,usageEmpty:`该时间窗口内没有请求。`,usageStatsTab:`统计`,usageCostTab:`额度`,usageWindow:`时间范围`,usageWindow24h:`24 小时`,usageWindow7d:`7 天`,usageWindowTotal:`全部留存`,usageCredits:`已用额度`,usageCreditsHint:`所有 provider 合计消耗的订阅额度`,usageEstCost:`折合费用`,usageTotalTokens:`Token 总量`,usageRequests:`请求数`,usageModelCount:`{count} 个模型`,usageCacheHitRate:`缓存命中`,usageTokenSplitNote:`命中 / 未命中 / 输出`,usageChartTitle:`用量趋势`,usageChartHint:`按模型堆叠。可在额度与 token 之间切换。`,usageChartEmpty:`该时间范围内暂无用量。`,usageBreakdownTitle:`按模型明细`,usageBreakdownHint:`每个模型的 token 与订阅额度。`,usageColInputHit:`输入·缓存命中`,usageColInputMiss:`输入·缓存未命中`,usageColOutput:`输出`,usageColCost:`折合费用`,usageUnpricedCost:`无官方价`,usageColSplit:`高峰 / 闲时`,usageTotals:`合计`,usageRetentionHint:`请求日志按计划清理,因此「全部留存」只覆盖仍在库内的部分。`,usageRenderNote:`可选的 DeepSeek 官方列表价人民币折算。订阅账号并不按此计费——仅供对比。`,usagePeakNote:`高峰按北京时间周一至周五 09:00-12:00、14:00-18:00 估算;闲时为高峰一半。未处理法定节假日及调休。`,usageUnpricedHint:`以下模型没有列表价行,只计入额度与 token:{models}`,usageNoteTitle:`计算说明`,usagePriceTitle:`DeepSeek 官方价格表`,usagePriceHit:`缓存命中`,usagePriceMiss:`缓存未命中`,usagePriceOutput:`输出`,usagePriceBandOff:`闲时`,usagePriceBandPeak:`高峰`,usageOffPeak:`闲时`,usagePeak:`高峰`,usageChartMetric:`图表指标`,usageEstimateTitle:`DeepSeek 官方列表价折算`,usageEstimateHint:`有官方价的模型可查看人民币对比;默认折叠。`,usageEstimateChartTitle:`列表价趋势`,usageEstimateChartEmpty:`该时间范围内暂无 DeepSeek 计价用量。`,chartMetricRequests:`请求`,chartMetricTokens:`Tokens`,chartMetricLatency:`p95 延迟`,chartInput:`输入`,chartOutput:`输出`,chartCacheRead:`缓存读取`,chartTotal:`合计`,navLogs:`日志`,navKeys:`API 密钥`,navSystem:`系统设置`,sidebarFoot:`CLI 登录态网关`,sidebarInFlight:`当前并发 {count}`,systemSettingsTitle:`系统设置`,crossProviderModelPoolTitle:`跨 Provider 模型池`,crossProviderModelPoolHint:`开启后,不带 Provider 前缀的模型 ID 可以在匹配的 Qoder、WorkBuddy 和 Trae 账号之间调度;关闭后 bare ID 会被拒绝,必须使用带 Provider 前缀的模型 ID。`,crossProviderModelPoolStatus:`当前状态`,crossProviderModelPoolAriaLabel:`开启跨 Provider 模型池`,modelPoolTitle:`调度组`,modelPoolCreate:`添加调度组`,modelPoolEdit:`编辑调度组`,modelPoolId:`客户端模型 ID`,modelPoolIdHint:`客户端请求里的 model,例如 my-claude。保存后不能改。`,modelPoolIdLocked:`客户端请求的 model 就是这个,不能改。`,modelPoolName:`名称`,modelPoolNameHint:`只出现在这个控制台的列表里,用来辨认。客户端看不到。`,modelPoolNamePh:`我的 Claude`,modelPoolStrategy:`路由策略`,modelPoolStrategyHint:`优先级顺序:按优先级排列符合条件的成员;除非开启故障转移,后续成员不等于故障备份。轮询:均匀分摊请求。优先填满:偏向权重最高的成员。最先过期优先:优先选择额度最早到期的成员。`,modelPoolStrategy_priority:`优先级顺序`,"modelPoolStrategy_round-robin":`轮询`,"modelPoolStrategy_fill-first":`优先填满`,modelPoolStrategy_fefo:`最先过期优先(FEFO)`,"modelPoolStrategy_least-quota-first":`剩余额度最少优先`,"modelPoolStrategy_most-quota-first":`剩余额度最多优先`,modelPoolFailover:`故障转移`,modelPoolMaxAttempts:`最大尝试次数`,modelPoolMaxAttemptsHint:`开启故障转移时,此项限制主请求逻辑模型的总派发次数,包含首次派发和跨成员的后续尝试(1-64),不是供应商数量。`,modelPoolMembers:`供应商模型`,modelPoolMembersHint:`仅可选出已接入的供应商,以及对应供应商设置中启用的模型。账号由供应商账号池自动选择,顺序即优先级。`,modelPoolAddMember:`添加供应商模型`,modelPoolMembersEmpty:`暂无成员,请至少添加一个供应商模型。`,modelPoolMoveUp:`上移`,modelPoolMoveDown:`下移`,modelPoolProvider:`供应商`,modelPoolRegion:`区域`,modelPoolAnyRegion:`不限区域`,modelPoolModel:`模型`,modelPoolWeight:`权重`,modelPoolNoModels:`暂无可用模型`,modelPoolIdRequired:`请填写调度组 ID。`,modelPoolNameRequired:`请填写显示名称。`,modelPoolMembersRequired:`请至少添加一个供应商座位。`,modelPoolMemberIncomplete:`每个座位要选一个供应商和一个模型。`,modelPoolAttemptsInvalid:`最大尝试次数需在 1 到 64 之间。`,modelPoolColName:`模型`,modelPoolColStrategy:`策略`,modelPoolColMembers:`成员`,modelPoolColFailover:`故障转移`,modelPoolColEnabled:`启用`,modelPoolColActions:`操作`,modelPoolFailoverOn:`开启 · 最多 {count} 次派发`,modelPoolFailoverOff:`关闭`,modelPoolEmpty:`还没有调度组`,modelPoolEmptyHint:`添加一组,就会多一个客户端能调用的模型。`,modelPoolDeleteTitle:`删除调度组`,modelPoolDeleteDesc:`确定删除“{name}”?正在使用这个调度组 ID 的客户端将无法调用。`,modelPoolSaved:`已保存`,modelPoolDeleted:`已删除`,modelPoolBack:`全部调度组`,modelPoolEnabled:`启用`,modelPoolIdInvalid:`调度组 ID 只能使用小写字母、数字、- 和 /,最长 128 个字符。`,modelPoolMissing:`这个调度组已经不存在。`,modelPoolEntryTitle:`请求`,modelPoolEntryDetail:`客户端模型 ID`,modelPoolEntryNote:`客户端调用这个 ID 时开始`,modelPoolEntryHint:`每个供应商/模型可按所勾账号展开成多个座位,顺序跟勾选顺序一致。不勾账号时,符合条件的全部已接入账号都可参与;有勾选时只包含所选账号。行内策略决定这些座位的调度方式。`,modelPoolStepProvider:`供应商`,modelPoolStepProviderDetail:`一个供应商`,modelPoolAccounts:`账号`,modelPoolAccountsHint:`账号全不勾选时,纳入符合条件的全部已接入账号。勾选一个或多个后,仅纳入所选账号;多选会按勾选顺序展开为座位。`,modelPoolAccountsAll:`全部账号`,modelPoolAccountsAllCount:`全部 {count} 个账号`,modelPoolSeatOrderAll:`由账号池选择`,modelPoolSeatOrderPicked:`按勾选顺序展开`,modelPoolSeatCount:`{count} 个座位`,modelPoolPathCount:`{count} 条路径`,modelPoolAccountsCount:`{count} 个账号`,modelPoolAccountsSearch:`查找账号`,modelPoolAccountsNoMatch:`没有匹配的账号`,modelPoolNoAccounts:`这个供应商还没有接入账号`,modelPoolAccountsDraft:`多选时仅包含所勾账号,并按勾选顺序展开为座位。`,modelPoolClientModel:`客户端传来的模型名`,modelPoolCanvasPalette:`添加座位`,modelPoolCanvasIncomplete:`待设置`,modelPoolCanvasSkip:`跳过`,modelPoolCanvasFit:`适应画布`,modelPoolCanvasZoomIn:`放大`,modelPoolCanvasZoomOut:`缩小`,modelPoolStrategyNode:`策略`,modelPoolStrategyNote:`决定这一排座位的尝试顺序`,modelPoolAddSeat:`添加同级`,modelPoolDragSeat:`拖动换序`,modelPoolRemoveSeat:`移除座位`,modelPoolPathEmpty:`这条路径还没有座位。`,modelPoolStepModel:`模型`,modelPoolStepModelDetail:`一个供应商模型`,modelPoolStepModelNote:`选择供应商和模型`,modelPoolStepGroup:`嵌套调度组`,modelPoolStepGroupDetail:`另一组调度`,modelPoolStepGroupNote:`内层保持自己的顺序`,modelPoolStepIntent:`意图`,modelPoolStepIntentDetail:`最新一条用户消息`,modelPoolStepIntentNote:`关键词或分类模型`,modelPoolPathMatch:`匹配`,modelPoolPathDefault:`默认(无匹配)`,modelPoolPathLabel:`路径名称`,modelPoolAddPath:`添加路径`,modelPoolRemovePath:`移除路径`,modelPoolKeywords:`关键词`,modelPoolKeywordsHint:`用逗号分隔。最新一条用户消息里任意一个关键词命中(忽略大小写)即走这条路径。`,modelPoolIntentLabel:`分类标签`,modelPoolIntentHint:`与分类模型的回复比较。路径名称同样可以命中。`,modelPoolPathFallback:`默认路径(无匹配时使用,不是故障备份)`,modelPoolClassifier:`分类模型`,modelPoolClassifierOff:`只用关键词`,modelPoolClassifierHint:`可选。到达这条分支时,会用所选具体模型另发非流式请求来分类消息;同一次路由中其他实际到达的分支也可能触发额外分类请求。`,modelPoolNestedPool:`调度组`,modelPoolNestedPoolPick:`选择调度组`,modelPoolNestedPoolEmpty:`还没有其他调度组`,modelPoolGroupRequired:`请选择一个嵌套调度组。`,modelPoolSelfGroup:`调度组不能嵌套自己。`,modelPoolClassifierIncomplete:`分类模型需要同时选择供应商和模型。`,modelPoolPreview:`试一句消息`,modelPoolPreviewHint:`按当前账号池状态显示至多一个下一候选或冷却提示,不是完整故障转移序列。结果为空表示当前账号池无法确认路由。候选选择不预占账号、不推进轮转;实际到达的分支可能发起非流式分类请求。预览不包含 API 密钥授权、请求级账号指定、会话粘性、协议请求上下文及并发或后续池状态变化,因此真实请求可能不同。`,modelPoolPreviewNoCandidate:`当前无法确认可用候选。`,modelPoolPreviewPh:`帮我规划上线步骤`,modelPoolPreviewRun:`预览`,modelPoolPreviewPath:`路径`,modelPoolNoReady:`没有就绪账号`,modelPoolWeightHint:`优先填满时使用。换成其他策略后,已保存的权重仍会保留。`,modelPoolWeightNote:`权重 {weight}`,modelPoolCapabilities:`对外声明的能力`,modelPoolCapabilitiesHint:`填 0 表示按成员推导。这些字段不参与路由。`,modelPoolContextLength:`上下文窗口`,modelPoolContextLengthHint:`0,或至少 1024。`,modelPoolMaxOutput:`最大输出`,modelPoolMaxOutputHint:`0,或至少 1024,且不能大于上下文窗口。`,modelPoolReasoningLevels:`思考档位`,modelPoolReasoningLevelsHint:`留空则使用所有成员共同支持的档位。`,modelPoolReasoningSelected:`已选 {n}/{total} 档`,modelPoolReasoningSelectAll:`全选`,modelPoolReasoningClear:`清空`,modelPoolReasoningEmpty:`未选择档位:对外只声明所有成员共有的档位。`,modelPoolReasoningDefault:`默认思考强度`,modelPoolReasoningDefaultHint:`客户端没有携带思考意图时使用。`,modelPoolReasoningAuto:`按成员推导`,modelPoolCapabilitiesInvalid:`上下文和最大输出必须为 0,或介于 1024 和 4000000 之间,且最大输出不能大于上下文窗口。`,modelPoolReasoningInvalid:`默认思考强度必须是已选档位之一。`,keysAggregationMode:`模型聚合模式`,keysAggregationModeHint:`开启后此密钥只能调用聚合逻辑模型,下方的供应商选择将被忽略。`,workbuddyCheckinSettingsTitle:`WorkBuddy 签到`,workbuddyCheckinSettingsHint:`新建 WorkBuddy 账号时使用的默认首次签到时间。已有账号会保留各自的时间,直到你单独修改。`,workbuddyCheckinSettingsFieldHint:`使用服务器本地时间。新建 WorkBuddy 账号会继承这里的时间,账号编辑页仍可单独覆盖。`,routingStrategyTitle:`账号调度策略`,routingStrategyHint:`选择就绪账号如何分担流量。填满优先会持续使用最高优先级账号,直到它不可用。最早到期优先只在同一供应商内部按最近的积分包到期日排序。剩余额度最少/最多优先按剩余百分比排序;额度未知的账号排最后。`,routingStrategy:`策略`,routingRoundRobin:`轮询`,routingWeightedRoundRobin:`加权轮询`,routingFillFirst:`填满优先`,routingFEFO:`最早到期优先(FEFO)`,routingLeastQuotaFirst:`剩余额度最少优先`,routingMostQuotaFirst:`剩余额度最多优先`,routingWeight:`调度权重`,sessionAffinityTTL:`会话 TTL`,sessionAffinityHits:`粘性命中`,sessionAffinityMisses:`粘性未命中`,sessionAffinityEscapes:`粘性逃逸`,lastSessionMiss:`最近未命中`,lastSessionEscape:`最近逃逸`,checkUpdates:`检查更新`,versionUpdate:`版本更新`,latestVersionHint:`先下载最新版本,准备好后再点立即更新。`,updateAvailable:`有可用更新`,settingsTabGeneral:`常规`,settingsTabRouting:`路由调度`,settingsTabSecurity:`安全与数据`,settingsTabUpdates:`版本更新`,sidebarNewVersion:`新版本 {version}`,sidebarReleaseNotes:`更新日志`,sidebarGoToUpdate:`历史版本与回滚`,upToDate:`已是最新版本`,currentVersion:`当前版本`,latestVersion:`最新版本`,skippedBetweenLabel:`中间经过的版本`,releaseNotes:`更新内容`,updateNoNotes:`这个版本还没有说明。`,versionHistory:`历史版本`,versionCurrentBadge:`当前`,versionLatestBadge:`最新`,restoreThisVersion:`恢复此版本`,restoreVersionTitle:`恢复到 {version}?`,restoreVersionHint:`服务会切回这个版本。只有重启时才会暂停新请求。`,updaterReady:`这台机器可以更新`,updaterUnavailable:`这台机器暂时不能更新`,updaterNeedsHost:`当前进程不能替换自己的容器`,updaterUnavailableHint:`这一页可以检查新版本,但还不能在这台机器上安装更新。`,updaterNeedInstall:`用 deploy/install-updater.sh 或 deploy/install-updater.ps1 安装宿主机更新器,让它能调用 Docker。`,updaterNeedCompose:`Linux 需要把更新器 socket 挂进容器。Docker Desktop 用本机回环地址,而不是 Unix socket。`,updaterNeedRelease:`当前运行的必须是已发布的 GitHub Release,不能是本地或开发镜像。`,updateNow:`下载更新`,applyUpdateNow:`立即更新`,cancelUpdate:`取消下载`,discardPreparedImage:`放弃这次更新`,updateReadyHint:`更新已经下载好。点立即更新才会重启;在此之前不会暂停新请求。`,updateReadyTargetHint:`可以切换到 {version}。只有重启时才会暂停新请求。`,updateNewerReleaseHint:`又有更新的版本({latest})。可以先立即更新,或放弃这次下载后重新开始。`,updateStagedUnavailableHint:`请先更新宿主机更新器,才能使用分阶段更新。`,updateLegacyOneShotHint:`这台机器会一次下载并完成更新。之后的版本可以先下载,再点立即更新。`,rollbackToVersion:`恢复旧版本`,rollbackToVersionHint:`可以恢复到当前版本之前最近的三个版本。`,updateReloadingIn:`{seconds}s 后刷新`,updateInProgress:`更新中…`,updatePreparingImage:`正在下载更新…`,updatePreparingImageHint:`正在后台下载更新。当前版本会继续运行,下载完成后点立即更新才会切换。下载卡住时可以取消。`,updateApplyingHint:`正在安装更新。完成后会自动刷新这个页面。`,updateInProgressHint:`系统正在更新,准备就绪后会自动刷新页面。`,updateUnavailableHint:`暂时无法更新,请稍后重试。`,updateFailedHint:`更新未完成,请重试。`,updateCheckFailedHint:`暂时无法检查更新,请稍后重试。`,updatePreparingHint:`正在准备更新:检查版本并保存备份。现有连接可能会被中断,客户端可自行重试。`,updateRunningHint:`正在更新。完成后会自动刷新这个页面。`,updateReloadingHint:`更新完成,正在刷新页面…`,updateElapsed:`已用时 {seconds}s`,sqliteProtection:`SQLite 保护`,sqliteProtectionHint:`数据会留在原处,并在更新前创建经过校验的备份。`,sqliteBackupBeforeUpdate:`更新前创建并校验备份`,sqliteKeepFive:`保留最近 5 份备份`,sqliteRollbackTogether:`失败时同时恢复数据库和上一版本`,updateStatus:`更新状态`,noUpdateJob:`暂无更新任务`,confirmUpdate:`立即更新`,confirmUpdateHint:`系统会短暂停止接收新请求并保存备份。现有连接可能会被中断,客户端可自行重试。`,updateState_idle:`空闲`,updateState_unavailable:`不可用`,updateState_queued:`等待开始`,updateState_preparing:`准备中`,updateState_preparing_image:`正在下载更新`,updateState_checking:`正在检查版本`,updateState_backing_up:`正在保存备份`,updateState_submitting:`正在开始更新`,updateState_running:`正在更新`,updateState_pulling:`正在下载更新`,updateState_host_binary:`正在下载更新程序`,updateState_image_ready:`下载完成`,updateState_ready_to_apply:`可以立即更新`,updateState_recreating:`正在重启`,updateState_health_checking:`正在确认启动`,updateState_rolling_back:`正在恢复上一版本`,updateState_succeeded:`更新完成`,updateState_rolled_back:`已恢复上一版本`,updateState_failed:`更新失败`,checking:`检查中`,refresh:`刷新`,apiKey:`API Key`,apiKeyPh:`API Key`,needApiKey:`先用控制台密码登录才能加载数据。`,loginTitle:`进入控制台`,loginLead:`这台机器上的 CLI2API 代理已经在运行。请输入客户端访问 /v1 时使用的 API Key。`,loginDesc:`和接口 Authorization: Bearer 是同一把钥匙。`,loginFormTitle:`继续`,loginPassword:`控制台密码`,loginPasswordPh:`API Key`,loginNeedKey:`密码是空的。`,loginBadKey:`这把钥匙对不上这台机器。`,loginSubmit:`进入`,loggingInConsole:`核对中…`,loginHint:`只解锁本机控制台。账号登录在进入后的「账号」页。`,showPassword:`显示密码`,hidePassword:`隐藏密码`,signOut:`退出`,checkingSession:`正在检查登录态…`,refreshing:`刷新中`,pages:{home:{title:`概览`,desc:`查看运行状态、请求量与可用端点。`},auth:{title:`授权`,desc:`浏览器 device-flow 登录、PAT 登录,以及会话 rewarm。`},providers:{title:`模型`,desc:`已登录账号可用的模型,以及每个模型的上下文和推理默认值。`},modelPool:{title:`调度组`,desc:`一组对应客户端里的一个模型。`},access:{title:`接入与调试`,desc:`主区多轮对话试玩;下方可展开原始 API 调试。`},accounts:{title:`账号`,desc:`一个账号一个登录态。先走浏览器登录;浏览器不方便再用 PAT。`},usage:{title:`用量`,desc:`按模型、账号与供应商统计用量。`},logs:{title:`日志`,desc:`查看近期代理请求和进程输出。`},keys:{title:`API 密钥`,desc:`创建客户端密钥,并限制可用的供应商和并发。`},system:{title:`系统设置`,desc:`管理跨 Provider 路由、系统更新、SQLite 保护和控制台管理员密钥。`},login:{title:`进入控制台`,desc:`和 /v1 使用同一把 API Key。`}},logsRequests:`请求历史`,logsRuntime:`运行日志`,logsEmptyRequests:`还没有请求记录。`,logsEmptyRuntime:`还没有捕获到运行输出。`,logsSearchRuntime:`搜索运行输出…`,logsSearchRequestId:`搜索请求 ID`,logsSearchModel:`搜索模型`,logsSearchAccount:`搜索账号`,logsFilterIdAll:`全部请求 ID`,logsNoFilterOptions:`没有匹配项`,logsClear:`清空历史`,logsClearConfirm:`删除本机全部请求历史?`,logsColTime:`时间`,logsColAccount:`账号`,logsColApiKey:`密钥`,logsColProvider:`供应商`,logsColModel:`模型`,logsColReasoning:`推理`,logsColStatus:`状态`,logsColLatency:`延迟`,logsColTTFT:`首字`,logsLatencyTotal:`总耗时`,logsOutputTPS:`输出 TPS`,logsColTokens:`Tokens`,logsTokensIn:`输入`,logsTokensOut:`输出`,logsTokensPoints:`{value} 点`,logsColStream:`模式`,logsStreamYes:`流式`,logsStreamNo:`同步`,logsFilterAll:`全部`,logsFilterOk:`成功`,logsFilterIncomplete:`未完成`,logsFilterError:`失败`,logsFilterCanceled:`取消`,logsFilterAccountAll:`全部账号`,logsFilterApiKeyAll:`全部密钥`,logsSearchApiKey:`搜索密钥`,logsFilterProviderAll:`全部供应商`,logsFilterModelAll:`全部模型`,logsFilterKindAll:`全部错误`,logsFilterStreamAll:`全部模式`,logsTimeRange:`时间`,logsTimeAll:`全部时间`,logsTime1h:`1 小时`,logsTime24h:`24 小时`,logsTime7d:`7 天`,logsTimeCustom:`自定义`,logsTimeFrom:`开始`,logsTimeTo:`结束`,logsKindQuota:`额度`,logsKindRateLimit:`限流`,logsKindAuth:`鉴权`,logsKindNotReady:`未就绪`,logsKindUnavailable:`不可用`,logsKindInvalidRequest:`非法请求`,logsKindModelNotAvailable:`模型不可用`,logsPageSize:`每页`,logsPage:`第 {page} / {pages} 页`,logsPrevPage:`上一页`,logsNextPage:`下一页`,logsNoMatch:`没有符合当前筛选的请求。`,logsLevelAll:`全部`,logsLevelInfo:`信息`,logsLevelWarn:`警告`,logsLevelError:`错误`,logsAttempts:`尝试记录`,logsRouting:`路由方式`,logsRouting_pool:`常规池`,logsRouting_pin:`显式指定`,logsRouting_sticky:`会话粘性`,logsRouting_sticky_escape:`粘性逃逸`,logsNoAttempts:`没有尝试详情。`,logsStreamDiagnostics:`流诊断`,logsMessageShape:`消息结构`,logsMessageCount:`消息数`,logsEmptyMessageIndexes:`空内容下标`,logsMessageRoles:`角色顺序`,logsCancellationSource:`取消来源`,logsUpstreamStatus:`上游状态`,logsSSEEvents:`SSE 事件数`,logsBytesRead:`读取字节数`,logsLastEvent:`最后事件`,logsStreamComplete:`已收到 [DONE]`,logsUsageDetail:`本次消耗`,logsCreditConsumed:`消耗点数`,logsDetailTitle:`请求详情`,logsSectionCall:`调用信息`,logsSectionDiagnostics:`诊断`,logsRuntimeDetailTitle:`运行日志详情`,logsRuntimeLevel:`级别`,logsRuntimeSource:`来源`,logsRuntimeMessage:`日志内容`,logsShownTotal:`{shown} / {total}`,logsAutoRefresh:`实时`,failedLogs:`加载日志失败:{msg}`,homeEyebrow:`运行时`,metricRequests:`请求`,metricSuccess:`成功率`,metricLatency:`p95`,metricTokens:`Tokens`,statsWindow1h:`1小时`,statsWindow24h:`24小时`,statsWindow7d:`7天`,statsWindow30d:`30天`,statsWindowCustom:`自定义`,statsWindowToday:`今天`,statsRefreshPause:`暂停自动刷新`,statsRefreshResume:`恢复自动刷新`,statsRefreshAuto:`每 30 秒刷新 · 点击暂停`,statsRefreshPaused:`自动刷新已暂停 · 点击恢复`,statsDragHint:`拖选时间段查看日志`,statsWindowHint:`{window}窗口`,statsTraffic:`流量`,statsTrafficHint:`所选时间窗口内的已完成聊天请求`,statsEmptyTraffic:`这个时间窗口还没有请求。`,statsLatencyP50:`p50`,statsLatencyP95:`p95`,statsLatencyAvg:`平均`,statsTTFB:`TTFB`,statsPool:`账号池`,statsPoolHint:`就绪 worker 与剩余额度`,statsCooling:`冷却中`,statsCoolingChip:`{count} 冷却`,statsPoolReadyEmpty:`暂无就绪 worker — 可展开上方冷却或前往账号页。`,statsTopModels:`热门模型`,statsTopAccounts:`热门账号`,statsTopProviders:`供应商`,statsTopProvidersHint:`按账号类型统计请求量`,statsNoProviders:`还没有供应商流量。`,statsErrorMix:`错误构成`,statsStatusMix:`结果与错误`,statsStatusMixHint:`请求状态、失败类型与热门账号`,statsCoolingDetails:`冷却中 · 原因 · 剩余 · 退避`,statsBackoffLevel:`重启退避等级`,statsAffinityHit:`会话亲和命中`,statsAffinityHint:`命中 {hits} · 未命中 {misses} · 绑定 {bindings}`,metricCacheHit:`缓存命中率`,metricCacheHitDetail:`缓存 {read} / 输入 {prompt}`,metricStreaming:`流式占比`,metricStreamingDetail:`{total} 次请求中 {count} 次`,metricCanceled:`已取消`,metricCanceledDetail:`占请求 {rate}`,statsErrorMixHint:`该窗口内已分类的失败`,statsNoModels:`还没有模型流量。`,statsNoAccounts:`还没有账号流量。`,statsNoErrors:`没有分类错误。`,statsUnknown:`未知`,statsUnassigned:`未分配`,resTitle:`资源占用`,resHint:`主机进程内存与 CPU`,resServer:`主进程`,resWorkers:`Worker`,resEmpty:`还没有 worker 进程。`,resGoroutines:`个协程`,resCpuLifetime:`生命周期均值`,failedStats:`加载统计失败:{msg}`,homeNote:`已登录本机控制台。账号登录在「账号」页。`,metricRuntime:`运行状态`,metricAccounts:`账号`,metricModels:`模型`,metricAuth:`登录态`,metricPort:`端口`,serviceDetail:`服务详情`,endpoints:`可用端点`,copyBaseUrl:`复制 Base URL`,copied:`已复制`,copy:`复制`,open:`打开`,waitingOverview:`等待概览数据…`,signIn:`登录`,connectQoder:`连接账号`,rewarm:`Rewarm`,rewarming:`Rewarm 中`,refreshAccount:`刷新`,refreshingAccount:`刷新中`,stepBrowserTitle:`浏览器 Device Flow`,stepBrowserDesc:`打开账号选择页。浏览器完成授权后,本页会轮询直到会话就绪。`,startBrowserLogin:`用浏览器登录`,starting:`启动中…`,quotaLoading:`额度获取中…`,quotaUnavailable:`额度不可用`,authUrl:`授权链接`,openAuthUrl:`打开链接`,stepPatTitle:`个人访问令牌`,stepPatDesc:`浏览器流程不方便时,可用 PAT 作为备选。`,pat:`PAT`,pasteToken:`粘贴 token`,loginWithPat:`使用 PAT 登录`,loggingIn:`登录中…`,localState:`本地状态`,raw:`原始数据`,noAuthSnapshot:`暂无授权快照。`,catalog:`目录`,availableModels:`可用模型`,modelsPulled:`来源`,filter:`筛选`,filterPh:`glm / qwen / deepseek`,providerFilterAll:`全部供应商`,accountStatusFilter:`账号状态`,connection:`连接信息`,apiPlaygroundHint:`选择账号与模型。顶部切换「聊天 / 原始 API」;原始 API 含 JSON 与 curl。`,readyAccounts:`{ready} / {total} 个账号就绪`,baseUrl:`Base URL`,externalClients:`外部客户端`,protocol:`协议`,quickTest:`快速测试`,requestBuilder:`请求编排`,responseInspector:`响应检查`,responseInspectorHint:`本地代理返回的原始 JSON`,requestIdle:`等待请求`,requestComplete:`请求完成`,requestFailed:`请求失败`,responseReceived:`已收到响应`,responseEmptyTitle:`还没有响应`,responseEmptyHint:`选择路由、填写提示词并发送请求,原始响应会显示在这里。`,sendRequest:`发送请求`,promptPlaceholder:`输入要发送给模型的内容`,promptHelper:`测试请求使用非流式 Chat Completions。`,accessTabChat:`聊天`,accessTabApi:`原始 API`,accessTabsLabel:`接入方式`,chatTryEmptyTitle:`还没有回复`,chatTryEmptyHint:`在下方输入消息。账号与模型在输入框底栏。离开页面后会话清空。`,chatTryHelper:`Enter 发送 · Shift+Enter 换行`,chatTrySend:`发送`,chatTryStop:`停止`,chatTryStreaming:`生成中…`,chatTryUserLabel:`你`,chatTryAssistantLabel:`助手`,chatTryCreditsUsed:`消耗 {amount} credits`,chatTryUsageTokens:`{prompt} → {completion}`,chatTryUsageFoot:`{tokens} · {amount} credits`,chatHistoryTitle:`历史`,chatHistoryNew:`新对话`,chatHistoryEmpty:`还没有对话`,chatHistoryUntitled:`未命名`,chatHistoryExpand:`展开历史`,chatHistoryCollapse:`收起历史`,nativeApiHint:`非流式请求、原始 JSON 响应,以及对应的 curl 命令。`,rawFormatLabel:`API 格式`,rawFormatChat:`Chat`,rawFormatMessages:`Messages`,rawFormatResponses:`Responses`,rawFormatHint:`支持 Chat Completions、Anthropic Messages 与 OpenAI Responses 三种格式。`,rawApiShow:`展开原始 API`,rawApiHide:`收起原始 API`,chatAttach:`添加附件`,chatAttachRemove:`移除附件`,chatAttachUnsupported:`不支持的文件类型:{names}`,thinkingPhaseScan:`检索中`,thinkingPhasePlan:`规划中`,thinkingPhaseDraft:`起草中`,thinkingDone:`已思考`,thinkingElapsed:`{n}s`,toolCallGroup:`用了 {n} 个工具`,chatDemoLoad:`预览样例`,thinkingChars:`{count} 字`,thinkingWorking:`思考中`,toolCallRunning:`进行中`,toolCallSuccess:`完成`,toolCallError:`失败`,toolCallUntitled:`工具`,toolCallArgs:`参数`,toolCallArgsEmpty:`(空)`,autoAccountHint:`由调度器选择一个可用账号。`,fixedAccountHint:`本次请求固定发送到所选账号。`,modelRoutingHint:`使用当前代理暴露的公开模型 ID。`,accountModelHint:`只列出该账号当前能提供的模型。钉死账号后,目录里没有的 ID 会请求失败。`,noAccountModels:`这个账号目前没有可发送的模型。`,accountModels:`可用模型`,accountModelsTitle:`{name} 的模型`,accountModelsHint:`该账号的实时目录。钉到此账号的请求只会使用这些 ID。`,accountModelsEmpty:`这个账号还没有公布模型目录。`,accountModelsError:`无法加载模型:{msg}`,noAccountsForTest:`暂无可用账号运行时,请先添加账号并完成登录。`,curlGeneratedHint:`根据当前账号、模型和提示词实时生成`,prompt:`提示词`,model:`模型`,send:`发送`,waitingRequest:`等待请求…`,requesting:`请求中…`,endpointOpenAI:`OpenAI 兼容`,endpointChat:`Chat Completions`,endpointBaseHint:`在 OpenAI 兼容客户端中,将此地址作为 Base URL。`,endpointChatHint:`OpenAI 兼容对话。模型 ID 加前缀即可指定供应商,例如 qoder/glm-5.2。`,endpointMessages:`Anthropic Messages`,endpointMessagesHint:`无状态 Anthropic Messages。使用带供应商前缀的模型 ID 即可钉死一家。`,endpointResponses:`OpenAI Responses`,endpointResponsesHint:`无状态 OpenAI Responses。使用带供应商前缀的模型 ID 即可钉死一家。`,endpointModels:`模型列表`,endpointModelsHint:`公开模型 ID。客户端 API 密钥只会看到其允许供应商的模型。`,endpointHealth:`健康检查`,endpointHealthHint:`检查本地代理是否正在响应。`,endpointCount:`{count} 个 API 端点`,endpointReady:`当前可用`,endpointBaseLabel:`客户端 Base URL`,endpointAuthLabel:`Bearer API Key`,hasUserBlob:`已有 user blob`,userBlobBytes:`user blob 大小`,machineId:`Machine ID`,sessionHot:`会话热状态`,upstreamEndpoint:`上游端点`,rewarmCount:`Rewarm 次数`,proxy:`Proxy`,endpoint:`端点`,lastError:`最近错误`,running:`运行中`,down:`离线`,hot:`热就绪`,up:`在线`,ready:`就绪`,missing:`缺失`,degraded:`降级`,error:`错误`,yes:`是`,no:`否`,modelCol:`模型`,mappedKeyCol:`上游 Key`,requestIdCol:`请求 ID`,providerCol:`供应商`,qoderKeyCol:`上游 Key`,routedTo:`上游模型 {model}`,stateCol:`状态`,contextWindowCol:`最大上下文窗口`,modelDefaultsCol:`上下文与推理`,providerSettingsTitle:`供应商设置`,providerSettingsOpen:`设置`,providerExpand:`展开供应商`,providerCollapse:`折叠供应商`,providerSettingsHint:`对该供应商和区域下的所有账号生效。积分/百分比保底、代理、系统提示词处理、别名、可用模型和签到时间统一由供应商策略管理;账号名、并发和优先级仍由账号自己管理。`,providerSettingsSaved:`供应商设置已保存。匹配账号直接读取该策略,不再改写账号数据。`,providerSettingsLoadFailed:`无法加载供应商设置,请刷新页面后重试。`,providerSettingsRegionMissing:`这个供应商分组还没有确定区域,请刷新模型目录后重试。`,providerSettingsSavedRefreshFailed:`设置已保存,但模型列表刷新失败:{message}`,providerModelsEmpty:`至少选择一个模型,或关闭模型限制。`,upstreamMaxContext:`上游最大上下文`,imageInput:`图片输入`,imageInputDeclared:`上游已声明支持`,imageInputNotDeclared:`上游未声明`,imageInputUnsupported:`上游未声明支持`,qoderContextHint:`请求没写上下文长度时使用的默认窗口。`,contextInvalid:`上下文窗口必须是 1,024 到 4,000,000 之间的整数。`,contextSaved:`已保存 {model} 的上下文窗口。`,contextReset:`已恢复 {model} 的默认上下文窗口。`,contextMaxOn:`已开启 {model} 的更大上下文。`,contextMaxOff:`已关闭 {model} 的更大上下文。`,contextMaxUnavailable:`这个模型没有更大上下文开关。`,maxMode:`更大上下文`,maxModeHint:`Trae 的更大上下文窗口,常见是 200k 提到 1M,不是套餐也不是额度。只在请求没带 is_max_mode 时使用;请求里写了仍以请求为准。模型不支持时不会发送这个开关。`,qoderMaxModeHint:`Qoder 的更大上下文窗口,不是套餐也不是额度。开启时请求使用该模型的最大窗口;关闭时(或请求自带上下文窗口时)使用默认窗口。`,catalogWindow:`目录默认窗口`,catalogWindowHint:`这个 Trae 模型没有更大上下文开关,数字是目录里的默认窗口。`,workbuddyContextHint:`WorkBuddy 桌面端目录里的默认窗口和可选窗口,用于本地压缩预算,不是 Trae 的 is_max_mode。聊天请求不会发送窗口开关。`,reasoningLevels:`推理强度`,reasoningHint:`请求没指定推理强度时使用的默认档位。选了不会强制每次都走这一档,也不会限制客户端改用其他允许档位。不在列表里的值会回退到可用档位,而不是锁死。`,reasoningFixed:`固定思考:{type}`,noReasoningLevels:`这个模型没有可选的推理档位。`,reasoningSaved:`已保存 {model} 的默认推理强度:{level}。`,reasoningLevel_none:`关闭`,reasoningLevel_low:`低`,reasoningLevel_medium:`中`,reasoningLevel_high:`高`,reasoningLevel_xhigh:`极高`,reasoningLevel_max:`最强推理`,modelDetails:`详情`,modelDetailsCol:`模型详情`,promptMaxTokens:`输入上限`,maxOutputTokens:`输出上限`,actions:`操作`,save:`保存`,custom:`自定义`,defaultValue:`默认`,resetDefault:`恢复默认`,fallback:`回退`,modelFree:`免费`,shownTotal:`显示 {shown} / 共 {total}`,noModelsYet:`暂无模型`,noModelsMatch:`没有匹配的模型。`,noProviders:`尚未加载供应商。`,failedOverview:`概览加载失败:{msg}`,pastePatFirst:`请先粘贴 PAT`,patDone:`PAT 登录完成`,loginOpenMsg:`请在浏览器打开授权链接完成登录`,idle:`空闲`,menu:`菜单`,toggleSidebar:`收起侧栏`,accountsTitle:`账号`,accountsDesc:`一个账号一个登录态。Chat 会 round-robin,失败切下一个。`,noAccounts:`还没有账号,添加一个即可开始服务。`,accountCount:`账号`,signedIn:`已登录`,enabledAccounts:`已启用`,availableAccounts:`可用`,needsAttention:`需处理`,searchAccounts:`搜索名称、账号 ID、UID、提供方或认证类型`,filterAll:`全部`,shownAccounts:`{shown} / {total}`,noAccountsMatch:`没有符合当前条件的账号。`,clearFilters:`清除筛选`,more:`更多操作`,partialCooling:`部分模型冷却`,modelCooldowns:`模型冷却`,modelCooldownsTitle:`冷却中的模型`,modelCooldownsEmpty:`当前没有模型在冷却。`,runtimeState:`运行状态`,maxInflight:`最大并发`,priority:`优先级`,updatedAt:`更新于`,enabledState:`已启用`,cooling:`冷却中`,dead:`恢复中`,authFailed:`登录失败`,patFallback:`PAT 备选`,usePat:`用 PAT`,account:`账号`,autoAccount:`自动(轮询)`,cooldown:`冷却`,inFlight:`进行中`,liveConcurrency:`当前并发`,liveRpm:`近 60 秒`,liveRpmUnit:`次`,liveRpmHint:`最近一分钟发起`,liveTrace:`走势`,livePeak:`峰值 {n}`,liveSaturated:`已满载`,inflightTitle:`实时进行中`,inflightMockBadge:`示意`,inflightIdleBadge:`空闲`,inflightMockToggle:`示意`,inflightMockToggleAria:`无实时数据时显示示意动画`,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:`冷却`,inflightNow:`现在`,inflightAgo:`前`,inflightMore:`还有`,inflightKindModel:`模型调用`,inflightKindTool:`工具调用`,inflightKindEmbed:`向量`,inflightKindOther:`其他`,inflightPriority:`优先级`,inflightAttempt:`尝试`,inflightPosition:`位置`,inflightWaited:`已等`,inflightHigh:`高`,inflightLow:`低`,inflightNormal:`普通`,inflightPositionValue:`{n} / {total}`,inflightClose:`关闭详情`,inflightAttemptValue:`{n} / {max}`,inflightAnnounceFailed:`{name} 失败`,inflightAnnounceFailedDetail:`{name} 失败:{error}`,inflightAnnounceRetry:`{name} 失败,正在重试,第 {attempt} 次`,inflightAnnounceLimited:`触发限流,工人暂停 {seconds} 秒`,inflightAnnounceResumed:`限流结束,工人继续`,inflightAnnouncePressure:`{n} 个任务在等待,超过背压线 {line}`,restarts:`重启次数`,dropSystemPrompt:`丢弃系统提示词`,dropSystemPromptHint:`发送前剥离调用方的系统提示词;仍会补一条空的 system,避免国际版要求第一条必须是系统提示词`,dropSystemPromptTraeHint:`默认保留调用方系统提示词。MiMo Code 等客户端会把 JSON 指令放在那里;仅在 Trae 因此拒请求时再打开。`,autoCheckin:`每日签到`,autoCheckinHint:`按账号配置的本地时间自动领取 WorkBuddy 积分;失败会在约 21:00 重试。默认关闭。`,autoCheckinCreateHint:`仅 WorkBuddy。开启后按该账号的签到时间自动领取积分;未改时间时使用系统默认。`,autoCheckinTime:`签到时间`,checkinAutoMode:`自动(上游窗口 + 1 小时)`,checkinAutoFallbackHint:`上方是供应商兜底时间;首次上游同步后,每个账号会在自己的卡片上保存实际时间。`,autoCheckinTimeHint:`使用服务器本地时间,并在所选时间后的约 14 分钟内执行;首次失败会在约 21:00 重试。新建账号自动继承此供应商策略。`,checkinNow:`立即签到`,quotaWindowsExpand:`展开其余 {count} 条额度`,quotaWindowsCollapse:`收起额外额度`,claimStudentCredit:`领取每月学生福利`,studentCreditClaimed:`每月学生福利领取成功`,studentCreditAlready:`每月学生福利已领取`,studentCreditFailed:`每月学生福利领取失败`,studentCreditUnavailable:`每月学生福利暂不可领取`,checkinAll:`一键签到`,checkinAllEmpty:`没有已启用且支持签到的账号`,checkinAllDone:`{count} 个账号今天都已签到`,toastCheckingInAll:`正在签到 {done}/{total}…`,toastCheckedInAll:`已签到 {checked} 个,跳过 {skipped} 个`,toastCheckedInAllFailed:`已签到 {checked} 个,跳过 {skipped} 个,失败 {failed} 个`,lastCheckin:`最近签到`,lastCheckinNone:`还没有签到记录`,checkinStatus:`签到`,checkinDaily:`每日`,regionCN:`国内版`,regionGlobal:`国际版`,checkinToday:`今日已签到`,checkinPending:`今日未签到`,checkinFailed:`签到异常`,checkinRecords:`签到记录`,checkinRecordsTitle:`签到记录 · {name}`,checkinRecordsHint:`显示该账号最近 20 次签到结果。`,checkinRecordsEmpty:`还没有签到记录`,checkinRecordsCount:`{count} 条记录`,checkinRecordSuccess:`成功`,checkinRecordAlready:`已签到`,checkinRecordFailed:`失败`,checkinRewardSuffix:` · +{credits} 积分`,checkinTruncated:`信息已截断 · 点复制查看完整错误`,checkinCopyError:`复制完整错误`,refreshCredits:`刷新积分`,expiryDistTitle:`积分到期分布`,expiryDistHint:`按自然日聚合 · 颜色区分账号 · FEFO:上游按失效时刻先后优先扣减`,expiryDistExpand:`展开全部 {n} 天`,expiryDistCollapse:`收起`,expiryDistDayTotal:`到期 {n} 积分`,expiryDistColAccount:`账号`,expiryDistColSoonest:`最近到期`,expiryDistColDaysLeft:`距到期`,expiryDistColBatch:`该日到期`,expiryDistColDaily:`日均需耗`,expiryDistDays:`{n} 天`,expiryDistFoot:`「日均需耗」= 最近到期那天的积分 ÷ 距该日天数,即到期前需要消耗的速度。`,expiryDistExpired:`已过期`,usageColModel:`模型`,quota:`额度`,quotaUsed:`已用`,quotaRemaining:`剩余`,quotaDaily:`日额度`,quotaWeekly:`周额度`,quotaMonthly:`月额度`,quotaFiveHour:`5 小时额度`,quotaWeeklyLimit:`周额度`,quotaPlan:`订阅`,quotaPeriodEndDate:`套餐周期截止日 {date}`,quotaExpiringSoonCredits:`7 天内到期 {amount} 积分`,quotaMonthlyLimit:`月额度`,quotaUsedPercent:`{n}%`,quotaResetsSoon:`即将重置`,quotaResetsInMinutes:`{n} 分钟后重置`,quotaResetsInHours:`{n} 小时后重置`,quotaExpiresOn:`{amount}{unit} 将于 {date} 到期`,quotaAddOn:`附加包`,quotaResourcePackage:`资源包`,quotaExceeded:`额度已用尽`,quotaOverageWindow:`超额`,overageTitle:`超额调用`,overagePull:`从 AWS 拉取`,overageEnabled:`已开启(额度耗尽后按超额单价继续计费)`,overageDisabled:`已关闭(额度耗尽即停止)`,overageUnknown:`未知(请从 AWS 拉取)`,overageNotCapable:`该订阅当前不支持超额调用`,overageReadOnly:`这个登录没有 AWS profile,不能修改开关。`,overageHint:`开关会调用 AWS,立即在 Kiro 侧打开或关闭超额调用。`,overageFigures:`上限 {cap} · 单价 {rate} · 已产生 {current}`,toastOveragePulled:`已从 AWS 更新超额状态`,toastOverageOn:`已开启超额调用`,toastOverageOff:`已关闭超额调用`,errorKind:`错误类型`,qoderLoginHint:`这里登录的是该账号的上游登录态,不会改控制台密码。`,needQoderLogin:`需要账号登录`,waitingQoderLogin:`等待账号登录完成…`,qoderLoginDone:`账号登录完成`,rewarmDone:`Rewarm 完成`,accountsSigned:`{n} / {total} 个账号就绪`,addAccount:`添加账号`,exportAll:`导出全部账号`,importAll:`导入全部账号`,bundleExportHint:`请妥善保管此文件——其中包含登录凭证。`,toastAccountsExporting:`正在准备账号导出…`,toastAccountsExported:`已将 {n} 个账号导出到文件。`,batchImport:`批量导入`,batchImportLoading:`正在导入 WorkBuddy 账号…`,batchImportUnrecognized:`无法识别此凭证文件格式。`,batchImportConfirmTitle:`确认批量导入`,batchImportConfirmHint:`已从 {file} 识别。请核对后再导入。`,batchImportConfirmHintNoFile:`请核对识别结果,确认后再导入。`,batchImportRegion:`WorkBuddy 区`,batchImportRegionPickHint:`未能明确识别区,请先选择国内版或国际版。`,batchImportRegionMixed:`此包同时含国内与国际域名。请拆分后导入,或强制选择一个区。`,batchImportRegionUnknown:`未从域名识别出区,请确认。`,batchImportUnknownFormat:`未知 format 字段,已按形状猜测。`,batchImportProviderUnsupported:`该供应商暂不支持批量导入。识别结果已保留,便于后续扩展。`,batchImportConfirmAction:`导入`,batchImportFormatUnknown:`未知格式`,batchImportProviderUnknown:`未知供应商`,bundleImportConfirmTitle:`导入全部账号?`,bundleImportConfirmHint:`来自 {file}。将恢复文件中保存的账号。`,bundleImportConfirmHintNoFile:`将恢复所选文件中保存的账号。`,bundleImportConfirmAction:`全部导入`,bundleImportAccountCount:`个账号(此文件中)`,bundleImportCountDetail:`其中 {credentials} 个包含已保存的登录凭证。`,bundleImportAdditiveHint:`导入会创建新账号并分配新 ID,不会修改已有账号。`,bundleImportLoading:`正在导入账号…`,bundleImportUnrecognized:`这不是有效的全量账号导出文件。`,accountName:`账号名称`,accountNameRequired:`请输入账号名称。`,accountCreated:`账号已创建,会话正在启动。`,importCredential:`导入原生凭证`,accountImported:`凭证已导入,运行时已启动。`,accountImportBatch:`已导入 {n} 个账号。`,accountImportPartial:`成功 {ok},失败 {fail}。`,credentialCopied:`凭证包已复制。`,addAccountTitle:`添加账号`,accountType:`账号类型`,loginMethod:`登录方式`,accountTypeHint:`选择这个隔离运行时使用的上游登录类型。`,accountTypeQoderGlobal:`Qoder 国际版`,accountTypeQoderGlobalHint:`Qoder 国际版:浏览器、PAT 或导入凭证`,accountTypeQoderCN:`Qoder 国内版`,accountTypeQoderCNHint:`Qoder 中国大陆版:浏览器、PAT 或导入凭证`,accountTypeWorkBuddyCN:`WorkBuddy 国内版`,accountTypeWorkBuddyCNHint:`CodeBuddy 国内版:浏览器登录或导入凭证`,accountTypeWorkBuddyGlobal:`WorkBuddy 国际版`,accountTypeWorkBuddyGlobalHint:`WorkBuddy 国际版:浏览器登录或导入凭证`,accountTypeTraeCN:`Trae 国内版(Solo)`,accountTypeTraeCNHint:`Trae 国内 Solo:浏览器登录或导入凭证`,accountTypeDevinGlobal:`Devin(实验性)`,accountTypeDevinGlobalHint:`实验性 Devin 国际版:浏览器 OAuth 或导入 session token`,accountTypeCommandGlobal:`Command Code`,accountTypeCommandGlobalHint:`粘贴 user_… 密钥接入。走 CLI 的 /alpha/generate 协议,所有档位均可用(含 $1 Go 套餐)。`,accountTypeOpenCode:`OpenCode`,accountTypeOpenCodeGo:`OpenCode Go`,accountTypeOpenCodeGoHint:`实验性。粘贴 OpenCode API Key。此账号走 Go 订阅网关。`,accountTypeOpenCodeZen:`OpenCode Zen`,accountTypeOpenCodeZenHint:`实验性。粘贴 OpenCode API Key。此账号走 Zen 按量网关。`,accountTypeCodexGlobal:`Codex`,accountTypeCodexGlobalHint:`OpenAI Codex:Codex CLI OAuth、Sign in with ChatGPT,或导入凭证`,accountTypeZhipuCN:`智谱 GLM`,accountTypeZhipuCNHint:`填写智谱 API Key。按量付费或 Coding Plan 与上游账号的计费方式一致。`,accountTypeQwenworkGlobal:`QwenWork 国际版`,accountTypeQwenworkGlobalHint:`QwenWork 国际版(qwenwork.ai),浏览器授权或导入凭证。授权链接只能使用一次:请在已登录目标账号的浏览器窗口里直接打开,不要经聊天工具发送。`,accountTypeQwenworkCN:`千问办公 国内版`,accountTypeQwenworkCNHint:`千问办公国内版(qwenwork.cn),浏览器授权或导入凭证。授权链接只能使用一次:请在已登录目标账号的浏览器窗口里直接打开,不要经聊天工具发送。国内版尚未经真实账号验收。`,accountTypeKimiCN:`Kimi Code 国内版`,accountTypeKimiCNHint:`Kimi Code 中国区订阅,走 auth.kimi.com 的设备码授权,与官方 CLI 使用同一个 OAuth 客户端。已在本机登录 Kimi Code 的,可直接粘贴它的凭证 JSON 导入。`,accountTypeCodeArtsCN:`CodeArts(码道)`,accountTypeCodeArtsCNHint:`华为云码道,走 codearts.huaweicloud.com 的 OAuth PKCE 授权。控制台打开授权页;浏览器回不到本机时,也可以粘贴 127.0.0.1 回调地址完成登录。`,accountTypeDoubaoworkCN:`豆包工作(Doubao Work)`,accountTypeDoubaoworkCNHint:`豆包工作订阅,通过粘贴网页会话 Cookie 接入。在你自己的浏览器登录 www.doubao.com 后复制 Cookie,服务端在导入时验证。网关跑在无头环境,没有浏览器或客户端自动登录。`,doubaoCookieLead:`在你自己的浏览器登录 www.doubao.com,打开开发者工具 → Network,刷新页面,点开任意 doubao.com 请求,复制完整的 Cookie 请求头粘贴到下面。导入时会即时校验并创建账号。`,doubaoCookieLabel:`Cookie`,doubaoCookiePh:`sessionid=...; sessionid_ss=...`,doubaoCookieRequired:`请先粘贴豆包工作的 Cookie。`,doubaoImport:`添加豆包工作账号`,doubaoSaveCookie:`保存 Cookie`,accountTypeKiroUS:`Kiro(美东)`,accountTypeKiroUSHint:`个人 Kiro 登录。粘贴 Builder ID、Identity Center 或社交登录的凭证 JSON,也可以粘贴 ksk_ 密钥。聊天走 us-east-1 的 Kiro 运行时。实验性接入。`,accountTypeKiroEU:`Kiro(欧洲中部)`,accountTypeKiroEUHint:`个人 Kiro 登录,走 eu-central-1 运行时。凭证格式与美东相同。实验性接入。`,accountTypeMetaGlobal:`Muse (Meta)`,accountTypeMetaGlobalHint:`Meta Muse Code 订阅,走 auth.meta.com 的设备码授权;批准后控制台会在 api.meta.ai 兑换 LLM API Key。也可在 PAT 页粘贴 Meta Model API Key。`,accountTypeMiniMaxCodeCN:`MiniMax Code(国内)`,accountTypeMiniMaxCodeCNHint:`通过 MiniMax Code 官方设备码登录,走国内 agent 网关,消耗你的 MiniMax Code 额度。`,accountTypeMiniMaxCodeGlobal:`MiniMax Code(国际)`,accountTypeMiniMaxCodeGlobalHint:`通过 MiniMax Code 官方设备码登录,走国际 agent 网关,消耗你的 MiniMax Code 额度。`,providerGroupSubscriptions:`稳定订阅`,providerGroupSubscriptionsHint:`稳定的账号登录源`,providerGroupExperimental:`实验性`,providerGroupExperimentalHint:`早期适配器`,providerFindPlaceholder:`查找登录源...`,providerFindEmpty:`没有符合搜索的登录源。`,caiaiSoftLink:`不想自托管?用托管 Gateway → CaiAI`,addAccountDesc:`创建一个隔离会话并登录。每个账号使用独立的运行时目录。`,tabBrowser:`浏览器登录`,tabPat:`PAT`,tabImport:`导入凭证`,recommended:`推荐`,wizardSettings:`账号设置`,wizardAdvanced:`高级选项`,wizardContinue:`继续`,wizardBack:`返回`,wizardSettingsHint:`登录前先设好这些选项,之后仍可在账号卡片上点编辑修改。`,editAccount:`编辑`,editAccountTitle:`编辑 {name}`,editAccountHint:`修改显示名称、并发和调度优先级。代理、别名、可用模型、保底和签到时间等供应商级设置已移到模型页的供应商分组。`,accountModelAliases:`别名`,accountModelAliasesHint:`这个供应商对外应答的名字。选中账号后,请求会换成该账号自己的真实模型。`,accountModelAliasTargetPlaceholder:`这个供应商上的真实模型`,modelAliasName:`外号`,modelAliasTarget:`真实模型`,modelAliasAdd:`添加`,modelAliasRemove:`移除`,modelAliasPlaceholder:`kimi-k3`,enabledModels:`可用模型`,enabledModelsHint:`不限制时使用整个目录。限制后,这个供应商只接选中的模型。`,restrictModels:`仅选中`,allModels:`全部模型`,modelPickerSearch:`搜索模型`,modelPickerCount:`已选 {selected} / 共 {total}`,modelPickerSelectAll:`全选`,modelPickerClear:`清空`,modelPickerOffline:`已下线`,modelPickerRemove:`移除 {model}`,modelPickerNoMatch:`没有匹配的模型。`,maxInflightInvalid:`并发必须是 1 到 32 之间的整数。`,priorityInvalid:`优先级必须是 1 到 100 之间的整数。`,wizardNamePh:`账号名称`,maxInflightHint:`这个账号同时能跑多少条对话。之后改并发会重启该账号的 worker。`,priorityHint:`数字越大,之后调度会越优先选这个账号。默认 50。`,creditFloor:`积分保底`,creditFloorHint:`开启后,采样到的积分余额降到该值时跳过计费模型,免费模型仍可用;只影响以积分为单位上报余额的账号。`,creditFloorCustom:`为该供应商覆盖全局阈值`,creditFloorInheritHint:`继承 CLI2API_CREDIT_FLOOR;填 0 表示显式关闭该供应商的保底。`,creditFloorInvalid:`积分保底必须是不小于 0 的数字。`,percentFloor:`百分比保底`,percentFloorHint:`对以剩余百分比上报余额的账号(Devin、Kimi、智谱):剩余百分比降到该值时跳过计费模型;与积分保底互不影响,免费模型仍可用。`,percentFloorCustom:`为该供应商覆盖全局百分比阈值`,percentFloorInheritHint:`继承 CLI2API_PERCENT_FLOOR;填 0 表示显式关闭该供应商的保底。`,percentFloorInvalid:`百分比保底必须是 0 到 100 之间的数字。`,proxyUrl:`代理地址`,proxyUrlPlaceholder:`http://127.0.0.1:7890、direct`,proxyUrlHint:`留空继承全局代理;填写 direct 或 none 可让此供应商直连。Qoder 仅支持 HTTP(S),WorkBuddy/Trae 额外支持 SOCKS5。`,proxySettingsTitle:`统一代理出口`,proxySettingsHint:`设置所有上游请求的默认代理;全局代理支持 HTTP(S),SOCKS5 仅支持 WorkBuddy/Trae 的供应商级代理;供应商设置优先于全局代理。`,dropSystemPromptCreateHint:`仅 WorkBuddy。剥离调用方系统提示词后仍补一条空的 system,避免国际版拒绝请求。`,wizardBrowserLead:`会展示授权地址。打开或复制后在浏览器完成授权,向导会自动继续。`,wizardCodexBrowserLead:`先选 Codex CLI 或 Sign in with ChatGPT,再打开授权地址。ChatGPT 网页登录必须走后者,CLI 流刷新不了那种 token。`,codexLoginMethod:`Codex 登录方式`,codexLoginCli:`Codex CLI`,codexLoginCliHint:`官方 Codex CLI OAuth,适合 CLI 签发的凭证。`,codexLoginChatGPT:`Sign in with ChatGPT`,codexLoginChatGPTHint:`ChatGPT 网页登录。凭证单独存储,刷新走另一套 token 端点。`,kiroLoginMethod:`Kiro 登录方式`,kiroLoginBuilder:`Builder ID`,kiroLoginBuilderHint:`设备码。打开链接并确认,这个页面会自己完成。`,kiroLoginIDC:`Identity Center`,kiroLoginIDCHint:`组织门户。先粘贴 start URL,再在浏览器里确认。`,kiroLoginSSO:`SSO 令牌`,kiroLoginSSOHint:`粘贴门户的 SSO bearer。只用来换凭证,不会保存。`,kiroLoginMicrosoft:`Microsoft`,kiroLoginMicrosoftHint:`企业 SSO。浏览器每次跳到 localhost 时,把回调地址粘过来。`,kiroIDCStartURL:`Identity Center start URL`,kiroIDCStartURLPh:`https://example.awsapps.com/start`,startCodexCliLogin:`开始 Codex CLI 登录`,startCodexChatGPTLogin:`Sign in with ChatGPT`,wizardStartBrowser:`开始浏览器登录`,wizardStartingSession:`正在启动账号会话…`,wizardWaitingBrowser:`正在等待浏览器完成授权…`,wizardCallbackLead:`如果浏览器停在 127.0.0.1,而控制台一直没有完成,把地址栏完整 URL 粘贴到这里。`,wizardCallbackPh:`粘贴完整的 http://127.0.0.1…/authorize?… 地址`,wizardSubmitCallback:`提交回调地址`,wizardStartingWorker:`已收到授权,正在启动账号会话…`,wizardAccountReady:`账号已就绪。`,wizardLoginTimeout:`等待浏览器登录超时,可在账号卡片重试。`,wizardPatLead:`浏览器流程不方便时,可用个人访问令牌登录。`,wizardPatLeadCN:`在 qoder.com.cn/account/integrations 创建 PAT,然后粘贴到这里。`,wizardPatLeadCommand:`粘贴你的 Command Code 密钥(形如 user_…,来自 commandcode.ai/settings)。`,wizardPatLeadOpenCode:`粘贴 OpenCode API Key。账号类型决定走 Go 还是 Zen。`,zhipuApiKey:`API Key`,zhipuApiKeyPh:`粘贴 open.bigmodel.cn 的密钥`,zhipuAccountMode:`账号类型`,zhipuModePayg:`按量付费`,zhipuModePaygHint:`按 token 计费,走标准 GLM 端点。`,zhipuModeCoding:`Coding Plan`,zhipuModeCodingHint:`编程套餐。走 Coding Plan 端点,并显示套餐额度。`,zhipuOrganization:`组织 ID`,zhipuOrganizationPh:`可选,团队版 Coding Plan 才需要`,zhipuProject:`项目 ID`,zhipuProjectPh:`可选`,zhipuCreate:`添加智谱账号`,zhipuKeyRequired:`请先粘贴智谱 API Key。`,wizardPatPh:`粘贴个人访问令牌`,wizardCreateAndLogin:`创建并登录`,wizardImportLead:`粘贴凭证 JSON。WorkBuddy hub 导出包会一次性导入其中全部账号。`,wizardImportPh:`粘贴凭证 JSON`,wizardChooseFile:`选择文件`,wizardBadJson:`这看起来不是有效的凭证包。`,reLogin:`登录`,cancel:`取消`,close:`关闭`,create:`创建`,import:`导入`,export:`导出`,enable:`启用`,disable:`停用`,disabled:`已停用`,delete:`删除`,holdToDelete:`按住删除`,trendHalfHint:`所选时间窗口后半段对比前半段`,toastRefreshingAccount:`正在刷新账号…`,toastAccountRefreshed:`账号已刷新`,toastRefreshingCredits:`正在刷新积分…`,toastCreditsRefreshed:`积分已刷新`,toastCreditsPartiallyRefreshed:`{total} 个账号中有 {failed} 个刷新失败`,toastAccountAdded:`账号已添加`,toastAccountDeleted:`账号已删除`,toastClearingLogs:`正在清空请求日志…`,toastLogsCleared:`请求日志已清空`,toastKeyDeleted:`API Key 已删除`,toastFailed:`操作失败`,deleteAccountConfirm:`确定删除账号 {name} 吗?这会移除它的本地运行时和已保存凭据。`,edit:`编辑`,enabled:`已启用`,keysCreate:`创建密钥`,keysEmpty:`还没有客户端密钥`,keysEmptyHint:`为 OpenAI 兼容客户端创建命名密钥。它不能登录这个控制台。`,keysCreateTitle:`创建 API 密钥`,keysCreateHint:`明文密钥只显示一次,请保存在会调用 /v1 的客户端里。`,keysEditTitle:`编辑 API 密钥`,keysEditHint:`可以改名称、限制它能调度到哪些供应商,或限制它同时能跑多少条对话。`,keysName:`名称`,keysNamePh:`CI 机器人`,keysNameRequired:`请填写名称。`,keysProviders:`供应商`,keysProvidersHint:`可将 Key 限制到特定供应商区域(如国内版 / 国际版)。全部不勾选表示允许所有供应商。`,keysAllProviders:`全部供应商`,keysAllRegions:`全区域`,keysProvidersNotLoaded:`供应商列表仍在加载中。已禁用保存,以保证 Key 权限不会被意外更改。`,keysProvidersLoadFailed:`供应商列表加载失败:{message}`,keysMaxInflight:`最大并发`,keysMaxInflightHint:`这把密钥同时能跑多少条 /v1 对话。0 表示不限制。超出的请求返回 HTTP 429。`,keysMaxInflightInvalid:`并发必须是 0 到 256 之间的整数。`,keysMaxInflightValue:`同时最多 {count} 条`,keysMaxInflightUnlimited:`不限制并发`,keysModelAggregation:`跨供应商模型聚合`,keysModelAggregationHint:`开启后,/v1/models 返回模型池里已启用的跨供应商聚合模型,以及这把密钥可访问账号上配置的公共别名,并按名称合并成一条、不显示供应商;请求仍按账号池路由。开启期间供应商选项锁定。`,keysModelAggregationBadge:`聚合`,keysLastUsed:`最近使用 {time}`,keysNeverUsed:`尚未使用`,keysSecretTitle:`请立刻保存这把密钥`,keysSecretHint:`服务端只存哈希,关闭后无法再查看明文。`,keysSecretOnce:`关闭弹窗前请先复制。`,keysDeleteConfirm:`确定删除 API 密钥 {name} 吗?正在使用它的客户端会立刻失败。`,consoleKeyTitle:`控制台 API 密钥`,consoleKeyHint:`这是登录本控制台的管理员密钥。`,consoleKeyLead:`它可以调用全部供应商,并管理账号、密钥和更新。客户端密钥在「API 密钥」页。`,consoleKeyRotate:`轮换密钥`,consoleKeyRotateHint:`轮换后其他会话会失效,并重启 Qoder worker 以使用新密钥。`,consoleKeyRotateNow:`立即轮换`,consoleKeySecretTitle:`新的控制台密钥`,consoleKeySecretHint:`当前浏览器会话已更新。如果还有客户端在用旧的控制台密钥,请把新值复制过去。`}};function dr(e,t,n={}){let r=$[e]||$.en,i=$.en,a=r[t];return a??=i[t],typeof a==`string`?a.replace(/\{(\w+)\}/g,(e,t)=>n[t]==null?`{${t}}`:String(n[t])):t}function fr(e,t){return(($[e]||$.en).pages||$.en.pages)[t]||{title:t,desc:``}}var pr=(0,I.createContext)(null);function mr({children:e}){let[t,n]=(0,I.useState)(()=>localStorage.getItem(`cli2api_lang`)===`en`?`en`:`zh`),r=(0,I.useMemo)(()=>({lang:t,setLang:e=>{let t=e===`en`?`en`:`zh`;localStorage.setItem(`cli2api_lang`,t),document.documentElement.lang=t===`zh`?`zh-CN`:`en`,n(t)},t:(e,n)=>dr(t,e,n),page:e=>fr(t,e)}),[t]);return(0,H.jsx)(pr.Provider,{value:r,children:e})}function hr(){let e=(0,I.useContext)(pr);if(!e)throw Error(`useI18n must be used within I18nProvider`);return e}export{Te as $,wt as A,je as B,Lt as C,At as D,jt as E,Ke as F,Ve as G,Pe as H,We as I,ze as J,He as K,Fe as L,ft as M,ut as N,Dt as O,Ge as P,we as Q,Re as R,Z as S,Nt as T,Me as U,Ne as V,Be as W,De as X,Le as Y,Oe as Z,Wt as _,ar as a,z as at,It as b,tr as c,pe as ct,dn as d,se as dt,be as et,ln as f,ce as ft,sn as g,rn as h,or as i,he as it,vt as j,Ot as k,er as l,R as lt,Jt as m,hr as n,B as nt,ir as o,me as ot,nn as p,L as pt,Ie as q,ur as r,_e as rt,rr as s,de as st,mr as t,xe as tt,$n as u,le as ut,zt as v,Pt as w,Ft as x,Rt as y,Ue as z}; \ No newline at end of file diff --git a/internal/webui/static/assets/useI18n-XrvNxGvP.js b/internal/webui/static/assets/useI18n-XrvNxGvP.js deleted file mode 100644 index 52c6d2bf7..000000000 --- a/internal/webui/static/assets/useI18n-XrvNxGvP.js +++ /dev/null @@ -1 +0,0 @@ -import{a as e,c as t,i as n,n as r,t as i}from"./shim-mfK0Rmj6.js";import{$ as a,A as o,Ct as s,E as c,F as l,G as u,I as d,J as f,L as p,M as m,Q as h,W as g,Y as _,Z as v,b as y,bt as b,c as x,d as S,dt as C,et as w,f as T,it as E,j as D,k as O,l as k,lt as A,ot as j,p as ee,q as M,tt as N,u as P,ut as F,w as te,xt as ne,yt as re,z as ie}from"./SharedElementTransition-BlCsXfb1.js";var I=t(e(),1),ae=(0,I.createContext)({color:`currentColor`,size:`1em`,weight:`regular`,mirrored:!1}),L=I.forwardRef((e,t)=>{let{alt:n,color:r,size:i,weight:a,mirrored:o,children:s,weights:c,...l}=e,{color:u=`currentColor`,size:d,weight:f=`regular`,mirrored:p=!1,...m}=I.useContext(ae);return I.createElement(`svg`,{ref:t,xmlns:`http://www.w3.org/2000/svg`,width:i??d,height:i??d,fill:r??u,viewBox:`0 0 256 256`,transform:o||p?`scale(-1, 1)`:void 0,...m,...l},!!n&&I.createElement(`title`,null,n),s,c.get(a??f))});L.displayName=`IconBase`;var oe=t(n(),1),se=`react-aria-clear-focus`,ce=`react-aria-focus`;function le(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=A(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(` `):i&&=i.trim().split(/\s+/).join(` `),!r&&!i&&t&&(r=t),{id:n,"aria-label":r,"aria-labelledby":i}}function ue(){return window.ResizeObserver!==void 0}function R(e){let{ref:t,box:n,onResize:r}=e,i=g(r);(0,I.useEffect)(()=>{let e=t?.current;if(e){if(ue()){let t=new window.ResizeObserver(e=>{e.length&&i()});return t.observe(e,{box:n}),()=>{e&&t.unobserve(e)}}return window.addEventListener(`resize`,i,!1),()=>{window.removeEventListener(`resize`,i,!1)}}},[t,n])}function de(e){return b()?e.metaKey:e.ctrlKey}var fe=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function pe(e){return e instanceof HTMLInputElement&&!fe.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function me(e,t,n,r){let i=g(n),a=n==null;(0,I.useEffect)(()=>{if(a||!e.current)return;let n=e.current;return n.addEventListener(t,i,r),()=>{n.removeEventListener(t,i,r)}},[e,t,r,a])}function z(e,t=!0){let[n,r]=(0,I.useState)(!0),i=n&&t;return C(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),ge(e,i,(0,I.useCallback)(()=>r(!1),[])),i}function he(e,t){let[n,r]=(0,I.useState)(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`)}let i=n===`exiting`;return ge(e,i,(0,I.useCallback)(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function ge(e,t,n){C(()=>{if(t&&e.current){if(!(`getAnimations`in e.current)){n();return}let t=e.current.getAnimations();if(t.length===0){n();return}let r=!1;return Promise.allSettled(t.map(e=>e.finished)).then(()=>{r||(0,oe.flushSync)(()=>{n()})}),()=>{r=!0}}},[e,t,n])}function B(e,t=-1/0,n=1/0){return Math.min(Math.max(e,t),n)}function V(e,t){let n=e,r=0,i=t.toString(),a=i.toLowerCase().indexOf(`e-`);if(a>0)r=Math.abs(Math.floor(Math.log10(Math.abs(t))))+a;else{let e=i.indexOf(`.`);e>=0&&(r=i.length-e)}if(r>0){let e=10**r;n=Math.round(n*e)/e}return n}function _e(e,t,n,r){t=Number(t),n=Number(n);let i=(e-(isNaN(t)?0:t))%r,a=V(Math.abs(i)*2>=r?e+Math.sign(i)*(r-Math.abs(i)):e-i,r);return isNaN(t)?!isNaN(n)&&a>n&&(a=Math.floor(V(n/r,r))*r):an&&(a=t+Math.floor(V((n-t)/r,r))*r),a=V(a,r),a}var ve=ie({base:`button`,defaultVariants:{fullWidth:!1,isIconOnly:!1,size:`md`,variant:`primary`},variants:{fullWidth:{false:``,true:`button--full-width`},isIconOnly:{true:`button--icon-only`},size:{lg:`button--lg`,md:`button--md`,sm:`button--sm`},variant:{danger:`button--danger`,"danger-soft":`button--danger-soft`,ghost:`button--ghost`,outline:`button--outline`,primary:`button--primary`,secondary:`button--secondary`,tertiary:`button--tertiary`}}}),H=r();typeof HTMLTemplateElement<`u`&&(Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:!0,enumerable:!0,get:function(){return this.content.firstChild}}),Object.defineProperty(HTMLTemplateElement.prototype,"appendChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.appendChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"removeChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.removeChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"insertBefore",{configurable:!0,enumerable:!0,value:function(e,t){return this.content.insertBefore(e,t)}}));var U=(0,I.createContext)(!1);function ye(e){if((0,I.useContext)(U))return I.createElement(I.Fragment,null,e.children);let t=I.createElement(U.Provider,{value:!0},e.children);return I.createElement(`template`,null,t)}function be(e){let t=(t,n)=>(0,I.useContext)(U)?null:e(t,n);return t.displayName=e.displayName||e.name,(0,I.forwardRef)(t)}function xe(){return(0,I.useContext)(U)}var Se=(0,I.createContext)(null),Ce=7e3,W=null;function we(e,t=`assertive`,n=Ce){W?W.announce(e,t,n):(W=new Ee,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?W.announce(e,t,n):setTimeout(()=>{W?.isAttached()&&W?.announce(e,t,n)},100))}function Te(e){W&&W.clear(e)}var Ee=class{constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<`u`&&(this.node=document.createElement(`div`),this.node.dataset.liveAnnouncer=`true`,Object.assign(this.node.style,{border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`}),this.assertiveLog=this.createLog(`assertive`),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog(`polite`),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}isAttached(){return this.node?.isConnected}createLog(e){let t=document.createElement(`div`);return t.setAttribute(`role`,`log`),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-relevant`,`additions`),t}destroy(){this.node&&=(document.body.removeChild(this.node),null)}announce(e,t=`assertive`,n=Ce){if(!this.node)return;let r=document.createElement(`div`);typeof e==`object`?(r.setAttribute(`role`,`img`),r.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):r.textContent=e,t===`assertive`?this.assertiveLog?.appendChild(r):this.politeLog?.appendChild(r),e!==``&&setTimeout(()=>{r.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}},De=(0,I.createContext)({}),Oe=be(function(e,t){[e,t]=D(e,t,De);let n=e,{isPending:r}=n,{buttonProps:i,isPressed:a}=ee(e,t);i=Ae(i,r);let{focusProps:o,isFocused:s,isFocusVisible:c}=S(e),{hoverProps:u,isHovered:d}=P({...e,isDisabled:e.isDisabled||r}),p={isHovered:d,isPressed:(n.isPressed||a)&&!r,isFocused:s,isFocusVisible:c,isDisabled:e.isDisabled||!1,isPending:r??!1},h=m({...e,values:p,defaultClassName:`react-aria-Button`}),g=A(i.id),_=A(),v=i[`aria-labelledby`];r&&(v?v=`${v} ${_}`:i[`aria-label`]&&(v=`${g} ${_}`));let y=(0,I.useRef)(r);(0,I.useEffect)(()=>{let e={"aria-labelledby":v||g};(!y.current&&s&&r||y.current&&s&&!r)&&we(e,`assertive`),y.current=r},[r,s,v,g]);let b=M(e,{global:!0});return delete b.onClick,I.createElement(l.button,{...f(b,h,i,o,u),type:i.type===`submit`&&r?`button`:i.type,id:g,ref:t,"aria-labelledby":v,slot:e.slot||void 0,"aria-disabled":r?`true`:i[`aria-disabled`],"data-disabled":e.isDisabled||void 0,"data-pressed":p.isPressed||void 0,"data-hovered":d||void 0,"data-focused":s||void 0,"data-pending":r||void 0,"data-focus-visible":c||void 0},I.createElement(Se.Provider,{value:{id:_}},h.children))}),ke=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function Ae(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!ke.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}var je=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M2.97 5.47a.75.75 0 0 1 1.06 0L8 9.44l3.97-3.97a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 0 1 0-1.06`,fill:`currentColor`,fillRule:`evenodd`})}),Me=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M13.03 10.53a.75.75 0 0 1-1.06 0L8 6.56l-3.97 3.97a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1 0 1.06`,fill:`currentColor`,fillRule:`evenodd`})}),Ne=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M10.53 2.97a.75.75 0 0 1 0 1.06L6.56 8l3.97 3.97a.75.75 0 1 1-1.06 1.06l-4.5-4.5a.75.75 0 0 1 0-1.06l4.5-4.5a.75.75 0 0 1 1.06 0`,fill:`currentColor`,fillRule:`evenodd`})}),Pe=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M5.47 2.97a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 1 1-1.06-1.06L9.44 8 5.47 4.03a.75.75 0 0 1 0-1.06Z`,fill:`currentColor`,fillRule:`evenodd`})}),Fe=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M3.47 3.47a.75.75 0 0 1 1.06 0L8 6.94l3.47-3.47a.75.75 0 1 1 1.06 1.06L9.06 8l3.47 3.47a.75.75 0 1 1-1.06 1.06L8 9.06l-3.47 3.47a.75.75 0 0 1-1.06-1.06L6.94 8 3.47 4.53a.75.75 0 0 1 0-1.06Z`,fill:`currentColor`,fillRule:`evenodd`})}),Ie=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M8 13.5a5.5 5.5 0 1 0 0-11a5.5 5.5 0 0 0 0 11M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14m1-9.5a1 1 0 1 1-2 0a1 1 0 0 1 2 0m-.25 3a.75.75 0 0 0-1.5 0V11a.75.75 0 0 0 1.5 0z`,fill:`currentColor`,fillRule:`evenodd`})}),Le=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M7.134 2.994L2.217 11.5a1 1 0 0 0 .866 1.5h9.834a1 1 0 0 0 .866-1.5L8.866 2.993a1 1 0 0 0-1.732 0m3.03-.75c-.962-1.665-3.366-1.665-4.329 0L.918 10.749c-.963 1.666.24 3.751 2.165 3.751h9.834c1.925 0 3.128-2.085 2.164-3.751zM8 5a.75.75 0 0 1 .75.75v2a.75.75 0 0 1-1.5 0v-2A.75.75 0 0 1 8 5m1 5.75a1 1 0 1 1-2 0a1 1 0 0 1 2 0`,fill:`currentColor`,fillRule:`evenodd`})}),Re=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M8 13.5a5.5 5.5 0 1 0 0-11a5.5 5.5 0 0 0 0 11M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14m1-4.5a1 1 0 1 1-2 0a1 1 0 0 1 2 0M8.75 5a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0z`,fill:`currentColor`,fillRule:`evenodd`})}),ze=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8a5.5 5.5 0 1 1-11 0a5.5 5.5 0 0 1 11 0M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0m-3.9-1.55a.75.75 0 1 0-1.2-.9L7.419 8.858L6.03 7.47a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.13-.08z`,fill:`currentColor`,fillRule:`evenodd`})}),Be=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M1.75 8a.75.75 0 0 1 .75-.75h11a.75.75 0 0 1 0 1.5h-11A.75.75 0 0 1 1.75 8`,fill:`currentColor`,fillRule:`evenodd`})}),Ve=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M8 1.75a.75.75 0 0 1 .75.75v4.75h4.75a.75.75 0 0 1 0 1.5H8.75v4.75a.75.75 0 0 1-1.5 0V8.75H2.5a.75.75 0 0 1 0-1.5h4.75V2.5A.75.75 0 0 1 8 1.75`,fill:`currentColor`,fillRule:`evenodd`})}),He=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:16,role:`presentation`,viewBox:`0 0 16 16`,width:16,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M11.5 7a4.5 4.5 0 1 1-9 0a4.5 4.5 0 0 1 9 0m-.82 4.74a6 6 0 1 1 1.06-1.06l2.79 2.79a.75.75 0 1 1-1.06 1.06z`,fill:`currentColor`,fillRule:`evenodd`})}),Ue=e=>(0,H.jsx)(`svg`,{"aria-hidden":`true`,fill:`none`,height:`1em`,role:`presentation`,viewBox:`0 0 13 14`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,H.jsx)(`path`,{clipRule:`evenodd`,d:`M3.75 4.5A.75.75 0 0 1 3 3.75v-.748a1.5 1.5 0 0 0-1.5 1.5v1h10v-1a1.5 1.5 0 0 0-1.5-1.5v.75a.75.75 0 1 1-1.5 0v-.75h-4v.747a.75.75 0 0 1-.75.75ZM8.5 1.501h-4V.75a.75.75 0 0 0-1.5 0v.752a3 3 0 0 0-3 3v6a3 3 0 0 0 3 3h7a3 3 0 0 0 3-3v-6a3 3 0 0 0-3-3v-.75a.75.75 0 0 0-1.5 0v.75Zm-7 5.5v3.5a1.5 1.5 0 0 0 1.5 1.5h7a1.5 1.5 0 0 0 1.5-1.5v-3.5h-10Z`,fill:`currentColor`,fillRule:`evenodd`})}),We=(0,I.createContext)({}),Ge=(0,I.createContext)({placement:`bottom`}),Ke=(0,I.forwardRef)(function(e,t){[e,t]=D(e,t,Ge);let n=e.placement,r={position:`absolute`,transform:n===`top`||n===`bottom`?`translateX(-50%)`:`translateY(-50%)`};n!=null&&(r[n]=`100%`);let i=m({...e,defaultClassName:`react-aria-OverlayArrow`,values:{placement:n}});i.style&&Object.keys(i.style).forEach(e=>i.style[e]===void 0&&delete i.style[e]);let a=M(e);return I.createElement(l.div,{...a,...i,style:{...r,...i.style},ref:t,"data-placement":n})}),G={top:`top`,bottom:`top`,left:`left`,right:`left`},K={top:`bottom`,bottom:`top`,left:`right`,right:`left`},qe={top:`left`,left:`top`},Je={top:`height`,left:`width`},Ye={width:`totalWidth`,height:`totalHeight`},q={},Xe=()=>typeof document<`u`?window.visualViewport:null;function Ze(e,t){let n=0,r=0,i=0,a=0,o=0,s=0,c={},l=(t?.scale??1)>1;if(e.tagName===`BODY`||e.tagName===`HTML`){let l=document.documentElement;i=l.clientWidth,a=l.clientHeight,n=t?.width??i,r=t?.height??a,c.top=l.scrollTop||e.scrollTop,c.left=l.scrollLeft||e.scrollLeft,t&&(o=t.offsetTop,s=t.offsetLeft)}else({width:n,height:r,top:o,left:s}=Y(e,!1)),c.top=e.scrollTop,c.left=e.scrollLeft,i=n,a=r;return re()&&(e.tagName===`BODY`||e.tagName===`HTML`)&&l&&(c.top=0,c.left=0,o=t?.pageTop??0,s=t?.pageLeft??0),{width:n,height:r,totalWidth:i,totalHeight:a,scroll:c,top:o,left:s}}function Qe(e){return{top:e.scrollTop,left:e.scrollLeft,width:e.scrollWidth,height:e.scrollHeight}}function $e(e,t,n,r,i,a,o){let s=i.scroll[e]??0,c=r[Je[e]],l=o[e]+r.scroll[G[e]]+a,u=o[e]+r.scroll[G[e]]+c-a,d=t-s+r.scroll[G[e]]+o[e]-r[G[e]],f=t-s+n+r.scroll[G[e]]+o[e]-r[G[e]];return du?Math.max(u-f,l-d):0}function et(e){let t=window.getComputedStyle(e);return{top:parseInt(t.marginTop,10)||0,bottom:parseInt(t.marginBottom,10)||0,left:parseInt(t.marginLeft,10)||0,right:parseInt(t.marginRight,10)||0}}function tt(e){if(q[e])return q[e];let[t,n]=e.split(` `),r=G[t]||`right`,i=qe[r];G[n]||(n=`center`);let a=Je[r],o=Je[i];return q[e]={placement:t,crossPlacement:n,axis:r,crossAxis:i,size:a,crossSize:o},q[e]}function nt(e,t,n,r,i,a,o,s,c,l,u){let{placement:d,crossPlacement:f,axis:p,crossAxis:m,size:h,crossSize:g}=r,_={};_[m]=e[m]??0,f===`center`?_[m]+=((e[g]??0)-(n[g]??0))/2:f!==m&&(_[m]+=(e[g]??0)-(n[g]??0)),_[m]+=a;let v=e[m]-n[g]+c+l,y=e[m]+e[g]-c-l;if(_[m]=B(_[m],v,y),d===p){let t=s?u[h]:u[Ye[h]];_[K[p]]=Math.floor(t-e[p]+i)}else _[p]=Math.floor(e[p]+e[h]+i);return _}function rt(e,t,n,r,i,a,o,s,c,l,u){let d=(e.top==null?c[Ye.height]-(e.bottom??0)-o:e.top)-(c.scroll.top??0),f=l?n.top:0,p={top:Math.max(t.top+f,(u?.offsetTop??t.top)+f),bottom:Math.min(t.top+t.height+f,(u?.offsetTop??0)+(u?.height??0))};return s===`top`?Math.max(0,d+o-p.top-((i.top??0)+(i.bottom??0)+a)):Math.max(0,p.bottom-d-((i.top??0)+(i.bottom??0)+a))}function it(e,t,n,r,i,a,o,s){let{placement:c,axis:l,size:u}=a;return c===l?Math.max(0,n[l]-(o.scroll[l]??0)-(e[l]+(s?t[l]:0))-(r[l]??0)-r[K[l]]-i):Math.max(0,e[u]+e[l]+(s?t[l]:0)-n[l]-n[u]+(o.scroll[l]??0)-(r[l]??0)-r[K[l]]-i)}function at(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=tt(e),{size:y,crossAxis:b,crossSize:x,placement:S,crossPlacement:C}=v,w=nt(t,s,n,v,u,d,l,f,m,h,c),T=u,E=it(s,l,t,i,a+u,v,c,g);if(o&&n[y]>E){let e=tt(`${K[S]} ${C}`),r=nt(t,s,n,e,u,d,l,f,m,h,c);it(s,l,t,i,a+u,e,c,g)>E&&(v=e,w=r,T=u)}let D=`bottom`;v.axis===`top`?v.placement===`top`?D=`top`:v.placement===`bottom`&&(D=`bottom`):v.crossAxis===`top`&&(v.crossPlacement===`top`?D=`bottom`:v.crossPlacement===`bottom`&&(D=`top`));let O=$e(b,w[b],n[x],s,c,a,l);w[b]+=O;let k=rt(w,s,l,f,i,a,n.height,D,c,g,_);p&&p!n||r===null?void 0:j(w(t.current),`scroll`,e=>{let n=N(e);if(!t.current||n instanceof Node&&!v(n,t.current)||n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement)return;let i=r||ut.get(t.current);i&&i()},!0),[n,r,t])}var X=typeof document<`u`?window.visualViewport:null;function ft(e){let{direction:t}=O(),{arrowSize:n,targetRef:r,overlayRef:i,arrowRef:o,scrollRef:s=i,placement:c=`bottom`,containerPadding:l=12,shouldFlip:u=!0,boundaryElement:d=typeof document<`u`?document.body:null,offset:f=0,crossOffset:p=0,shouldUpdatePosition:m=!0,isOpen:g=!0,onClose:_,maxHeight:v,arrowBoundaryOffset:y=0,getTargetRect:b}=e,[x,S]=(0,I.useState)(null),w=[m,c,i.current,r.current,o?.current,s.current,l,u,d,f,p,g,t,v,y,n],T=(0,I.useRef)(X?.scale);(0,I.useEffect)(()=>{g&&(T.current=X?.scale)},[g]);let E=(0,I.useCallback)(()=>{if(m===!1||!g||!i.current||!r.current||!d||X?.scale!==T.current)return;let e=null;if(s.current&&h(s.current)){let t=a()?.getBoundingClientRect(),n=s.current.getBoundingClientRect();e={type:`top`,offset:(t?.top??0)-n.top},e.offset>n.height/2&&(e.type=`bottom`,e.offset=(t?.bottom??0)-n.bottom)}let _=i.current;!v&&i.current&&(_.style.top=`0px`,_.style.bottom=``,_.style.maxHeight=(window.visualViewport?.height??window.innerHeight)+`px`);let x=ot({placement:mt(c,t),overlayNode:i.current,targetNode:r.current,scrollNode:s.current||i.current,padding:l,shouldFlip:u,boundaryElement:d,offset:f,crossOffset:p,maxHeight:v,arrowSize:n??(o?.current?J(o.current,!0).width:0),arrowBoundaryOffset:y,targetRect:b?.(r.current)});if(!x.position)return;_.style.top=``,_.style.bottom=``,_.style.left=``,_.style.right=``,Object.keys(x.position).forEach(e=>_.style[e]=x.position[e]+`px`),_.style.maxHeight=x.maxHeight==null?``:x.maxHeight+`px`;let C=a();if(e&&C&&s.current){let t=C.getBoundingClientRect(),n=s.current.getBoundingClientRect(),r=t[e.type]-n[e.type];s.current.scrollTop+=r-e.offset}S(x)},w);C(E,w),pt(E),R({ref:i,onResize:E}),R({ref:r,onResize:E});let D=(0,I.useRef)(!1);C(()=>{let e,t=()=>{D.current=!0,clearTimeout(e),e=setTimeout(()=>{D.current=!1},500),E()},n=()=>{D.current&&t()};return X?.addEventListener(`resize`,t),X?.addEventListener(`scroll`,n),()=>{X?.removeEventListener(`resize`,t),X?.removeEventListener(`scroll`,n)}},[E]);let k=(0,I.useCallback)(()=>{D.current||_?.()},[_,D]);return dt({triggerRef:r,isOpen:g,onClose:_&&k}),{overlayProps:{style:{position:x?`absolute`:`fixed`,top:x?void 0:0,left:x?void 0:0,zIndex:1e5,...x?.position,maxHeight:x?.maxHeight??`100vh`}},placement:x?.placement??null,triggerAnchorPoint:x?.triggerAnchorPoint??null,arrowProps:{"aria-hidden":`true`,role:`presentation`,style:{left:x?.arrowOffsetLeft,top:x?.arrowOffsetTop}},updatePosition:E}}function pt(e){C(()=>(window.addEventListener(`resize`,e,!1),()=>{window.removeEventListener(`resize`,e,!1)}),[e])}function mt(e,t){return t===`rtl`?e.replace(`start`,`right`).replace(`end`,`left`):e.replace(`start`,`left`).replace(`end`,`right`)}var ht=Symbol.for(`react-aria.i18n.locale`),gt=Symbol.for(`react-aria.i18n.strings`),_t=void 0,vt=class e{constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=yt(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[ht];if(_t===void 0){let t=window[gt];if(!t)return null;_t={};for(let r in t)_t[r]=new e({[n]:t[r]},n)}let r=_t?.[t];if(!r)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}};function yt(e,t,n=`en-US`){if(t[e])return t[e];let r=bt(e),i=xt(e);if(i&&t[`${r}-${i}`])return t[`${r}-${i}`];if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function bt(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}function xt(e){if(Intl.Locale)return new Intl.Locale(e).script}var St=new Map,Ct=new Map,wt=class{constructor(e,t){this.locale=e,this.strings=t}format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=St.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),St.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=Ct.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),Ct.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}},Tt=new WeakMap;function Et(e){let t=Tt.get(e);return t||(t=new vt(e),Tt.set(e,t)),t}function Dt(e,t){return t&&vt.getGlobalDictionaryForPackage(t)||Et(e)}function Ot(e,t){let{locale:n}=O(),r=Dt(e,t);return(0,I.useMemo)(()=>new wt(n,r),[n,r])}var kt={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function At(e={}){let{style:t,isFocusable:n}=e,[r,i]=(0,I.useState)(!1),{focusWithinProps:a}=T({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=(0,I.useMemo)(()=>r?t:t?{...kt,...t}:kt,[r]);return{visuallyHiddenProps:{...a,style:o}}}function jt(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=At(e);return I.createElement(n,f(a,o),t)}var Mt=(0,I.createContext)({});function Nt(){return(0,I.useContext)(Mt)??{}}function Pt(e){let[t,n]=k(e.isOpen,e.defaultOpen||!1,e.onOpenChange),[r,i]=(0,I.useState)(null);return{isOpen:t,setOpen:n,open:(0,I.useCallback)(()=>{n(!0)},[n]),close:(0,I.useCallback)(()=>{n(!1)},[n]),toggle:(0,I.useCallback)(()=>{n(!t)},[n,t]),point:r,setPoint:i}}var Z=class{constructor(e){this.value=null,this.level=0,this.hasChildNodes=!1,this.rendered=null,this.textValue=``,this[`aria-label`]=void 0,this.index=0,this.parentKey=null,this.prevKey=null,this.nextKey=null,this.firstChildKey=null,this.lastChildKey=null,this.props={},this.colSpan=null,this.colIndex=null,this.type=this.constructor.type,this.key=e}get childNodes(){throw Error(`childNodes is not supported`)}clone(){let e=new this.constructor(this.key);return e.value=this.value,e.level=this.level,e.hasChildNodes=this.hasChildNodes,e.rendered=this.rendered,e.textValue=this.textValue,e[`aria-label`]=this[`aria-label`],e.index=this.index,e.parentKey=this.parentKey,e.prevKey=this.prevKey,e.nextKey=this.nextKey,e.firstChildKey=this.firstChildKey,e.lastChildKey=this.lastChildKey,e.props=this.props,e.render=this.render,e.colSpan=this.colSpan,e.colIndex=this.colIndex,e}filter(e,t,n){let r=this.clone();return t.addDescendants(r,e),r}},Ft=class extends Z{filter(e,t,n){let[r,i]=Bt(e,t,this.firstChildKey,n),a=this.clone();return a.firstChildKey=r,a.lastChildKey=i,a}};(class extends Z{static{this.type=`header`}});var It=class extends Z{static{this.type=`loader`}},Lt=class extends Ft{static{this.type=`item`}filter(e,t,n){if(n(this.textValue,this)){let n=this.clone();return t.addDescendants(n,e),n}return null}},Rt=class extends Ft{static{this.type=`section`}filter(e,t,n){let r=super.filter(e,t,n);if(r&&r.lastChildKey!==null){let t=e.getItem(r.lastChildKey);if(t&&t.type!==`header`)return r}return null}},zt=class{get size(){return this.itemCount}getKeys(){return this.keyMap.keys()}*[Symbol.iterator](){let e=this.firstKey==null?void 0:this.keyMap.get(this.firstKey);for(;e;)yield e,e=e.nextKey==null?void 0:this.keyMap.get(e.nextKey)}getChildren(e){let t=this.keyMap;return{*[Symbol.iterator](){let n=t.get(e),r=n?.firstChildKey==null?null:t.get(n.firstChildKey);for(;r;)yield r,r=r.nextKey==null?void 0:t.get(r.nextKey)}}}getKeyBefore(e){let t=this.keyMap.get(e);if(!t)return null;if(t.prevKey!=null){for(t=this.keyMap.get(t.prevKey);t&&t.type!==`item`&&t.lastChildKey!=null;)t=this.keyMap.get(t.lastChildKey);return t?.key??null}return t.parentKey}getKeyAfter(e){let t=this.keyMap.get(e);if(!t)return null;if(t.type!==`item`&&t.firstChildKey!=null)return t.firstChildKey;for(;t;){if(t.nextKey!=null)return t.nextKey;if(t.parentKey!=null)t=this.keyMap.get(t.parentKey);else return null}return null}getFirstKey(){return this.firstKey}getLastKey(){let e=this.lastKey==null?null:this.keyMap.get(this.lastKey);for(;e?.lastChildKey!=null;)e=this.keyMap.get(e.lastChildKey);return e?.key??null}getItem(e){return this.keyMap.get(e)??null}at(){throw Error(`Not implemented`)}clone(){let e=this.constructor,t=new e;return t.keyMap=new Map(this.keyMap),t.firstKey=this.firstKey,t.lastKey=this.lastKey,t.itemCount=this.itemCount,t}addNode(e){if(this.frozen)throw Error(`Cannot add a node to a frozen collection`);e.type===`item`&&this.keyMap.get(e.key)==null&&this.itemCount++,this.keyMap.set(e.key,e)}addDescendants(e,t){this.addNode(e);let n=t.getChildren(e.key);for(let e of n)this.addDescendants(e,t)}removeNode(e){if(this.frozen)throw Error(`Cannot remove a node to a frozen collection`);let t=this.keyMap.get(e);t!=null&&t.type===`item`&&this.itemCount--,this.keyMap.delete(e)}commit(e,t,n=!1){if(this.frozen)throw Error(`Cannot commit a frozen collection`);this.firstKey=e,this.lastKey=t,this.frozen=!n}filter(e){let t=new this.constructor,[n,r]=Bt(this,t,this.firstKey,e);return t?.commit(n,r),t}constructor(){this.keyMap=new Map,this.firstKey=null,this.lastKey=null,this.frozen=!1,this.itemCount=0}};function Bt(e,t,n,r){if(n==null)return[null,null];let i=null,a=null,o=e.getItem(n);for(;o!=null;){let n=o.filter(e,t,r);n!=null&&(n.nextKey=null,a&&(n.prevKey=a.key,a.nextKey=n.key),i??=n,t.addNode(n),a=n),o=o.nextKey==null?null:e.getItem(o.nextKey)}if(a&&a.type===`separator`){let e=a.prevKey;t.removeNode(a.key),e==null?a=null:(a=t.getItem(e),a.nextKey=null)}return[i?.key??null,a?.key??null]}var Vt=class{constructor(e){this._firstChild=null,this._lastChild=null,this._previousSibling=null,this._nextSibling=null,this._parentNode=null,this._minInvalidChildIndex=null,this.ownerDocument=e}*[Symbol.iterator](){let e=this.firstChild;for(;e;)yield e,e=e.nextSibling}get firstChild(){return this._firstChild}set firstChild(e){this._firstChild=e,this.ownerDocument.markDirty(this)}get lastChild(){return this._lastChild}set lastChild(e){this._lastChild=e,this.ownerDocument.markDirty(this)}get previousSibling(){return this._previousSibling}set previousSibling(e){this._previousSibling=e,this.ownerDocument.markDirty(this)}get nextSibling(){return this._nextSibling}set nextSibling(e){this._nextSibling=e,this.ownerDocument.markDirty(this)}get parentNode(){return this._parentNode}set parentNode(e){this._parentNode=e,this.ownerDocument.markDirty(this)}get isConnected(){return this.parentNode?.isConnected||!1}invalidateChildIndices(e){(this._minInvalidChildIndex==null||!this._minInvalidChildIndex.isConnected||e.indexthis.subscriptions.delete(e)}resetAfterSSR(){this.isSSR&&(this.isSSR=!1,this.firstChild=null,this.lastChild=null,this.nodeId=0)}};function Wt(e){let{children:t,items:n,idScope:r,addIdAndValue:i,dependencies:a=[]}=e,o=(0,I.useMemo)(()=>void 0,[t]),s=(0,I.useMemo)(()=>new WeakMap,[...a,o]);return(0,I.useMemo)(()=>{if(n&&typeof t==`function`){let e=[];for(let a of n){let n=Gt(a)?a:null,o=n?s.get(n):null;if(!o){o=t(a);let c=o.props.id??a?.key??a?.id;r!=null&&o.props.id==null&&c!=null&&(c=r+`:`+c);let l=c??e.length;o=(0,I.cloneElement)(o,i?{key:l,id:c,value:a}:{key:l}),n&&s.set(n,o)}e.push(o)}return e}if(typeof t!=`function`)return t},[t,n,s,r,i])}function Gt(e){switch(typeof e){case`object`:return e!=null;case`function`:case`symbol`:return!0;default:return!1}}var Kt=i(),qt=(0,I.createContext)(!1),Q=(0,I.createContext)(null);function Jt(e){if((0,I.useContext)(Q))return e.content;let{collection:t,document:n}=Qt(e.createCollection);return I.createElement(I.Fragment,null,I.createElement(ye,null,I.createElement(Q.Provider,{value:n},e.content)),I.createElement(Yt,{render:e.children,collection:t}))}function Yt({collection:e,render:t}){return t(e)}function Xt(e,t,n){let r=F(),i=(0,I.useRef)(r);i.current=r;let a=(0,I.useCallback)(()=>i.current?n():t(),[t,n]);return(0,Kt.useSyncExternalStore)(e,a)}var Zt=typeof I.useSyncExternalStore==`function`?I.useSyncExternalStore:Xt;function Qt(e){let[t]=(0,I.useState)(()=>new Ut(e?.()||new zt));return{collection:Zt((0,I.useCallback)(e=>t.subscribe(e),[t]),(0,I.useCallback)(()=>{let e=t.getCollection();return t.isSSR&&t.resetAfterSSR(),e},[t]),(0,I.useCallback)(()=>(t.isSSR=!0,t.getCollection()),[t])),document:t}}var $t=(0,I.createContext)(null);function en(e){return class extends Z{static{this.type=e}}}function tn(e,t,n,r,i,a){typeof e==`string`&&(e=en(e));let o=(0,I.useCallback)(i=>{i?.setProps(t,n,e,r,a)},[t,n,r,a,e]),s=(0,I.useContext)($t);if(s){let o=s.ownerDocument.nodesByProps.get(t);return o||(o=s.ownerDocument.createElement(e.type),o.setProps(t,n,e,r,a),s.appendChild(o),s.ownerDocument.updateCollection(),s.ownerDocument.nodesByProps.set(t,o)),i?I.createElement($t.Provider,{value:o},i):null}return I.createElement(e.type,{ref:o},i)}function nn(e,t){let n=({node:e})=>t(e.props,e.props.ref,e),r=(0,I.forwardRef)((r,i)=>{let a=(0,I.useContext)(y);if(!(0,I.useContext)(qt)){if(t.length>=3)throw Error(t.name+` cannot be rendered outside a collection.`);return t(r,i)}return tn(e,r,i,`children`in r?r.children:null,null,e=>I.createElement(y.Provider,{value:a},I.createElement(n,{node:e})))});return r.displayName=t.name,r}function rn(e,t,n=an){let r=({node:e})=>t(e.props,e.props.ref,e),i=(0,I.forwardRef)((t,i)=>tn(e,t,i,null,n(t),e=>I.createElement(r,{node:e}))??I.createElement(I.Fragment,null));return i.displayName=t.name,i}function an(e){return Wt({...e,addIdAndValue:!0})}var on=(0,I.createContext)(null);function sn(e){let t=(0,I.useContext)(on),n=(t?.dependencies||[]).concat(e.dependencies),r=e.idScope??t?.idScope,i=an({...e,idScope:r,dependencies:n});return(0,I.useContext)(Q)&&(i=I.createElement(cn,null,i)),t=(0,I.useMemo)(()=>({dependencies:n,idScope:r}),[r,...n]),I.createElement(on.Provider,{value:t},i)}function cn({children:e}){let t=(0,I.useContext)(Q),n=(0,I.useMemo)(()=>I.createElement(Q.Provider,{value:null},I.createElement(qt.Provider,{value:!0},e)),[e]);return F()?I.createElement($t.Provider,{value:t},n):(0,oe.createPortal)(n,t)}function ln(e){let t=fn(E(e));t!==e&&(t&&un(t,e),e&&dn(e,t))}function un(e,t){e.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:t})),e.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:t}))}function dn(e,t){e.dispatchEvent(new FocusEvent(`focus`,{relatedTarget:t})),e.dispatchEvent(new FocusEvent(`focusin`,{bubbles:!0,relatedTarget:t}))}function fn(e){let t=a(e),n=t?.getAttribute(`aria-activedescendant`);return n&&e.getElementById(n)||t}var pn={};pn={collectionLabel:`مقترحات`};var mn={};mn={collectionLabel:`Предложения`};var hn={};hn={collectionLabel:`Návrhy`};var gn={};gn={collectionLabel:`Forslag`};var _n={};_n={collectionLabel:`Empfehlungen`};var vn={};vn={collectionLabel:`Προτάσεις`};var yn={};yn={collectionLabel:`Suggestions`};var bn={};bn={collectionLabel:`Sugerencias`};var xn={};xn={collectionLabel:`Soovitused`};var Sn={};Sn={collectionLabel:`Ehdotukset`};var Cn={};Cn={collectionLabel:`Suggestions`};var wn={};wn={collectionLabel:`הצעות`};var Tn={};Tn={collectionLabel:`Prijedlozi`};var En={};En={collectionLabel:`Javaslatok`};var Dn={};Dn={collectionLabel:`Suggerimenti`};var On={};On={collectionLabel:`候補`};var kn={};kn={collectionLabel:`제안`};var An={};An={collectionLabel:`Pasiūlymai`};var jn={};jn={collectionLabel:`Ieteikumi`};var Mn={};Mn={collectionLabel:`Forslag`};var Nn={};Nn={collectionLabel:`Suggesties`};var Pn={};Pn={collectionLabel:`Sugestie`};var Fn={};Fn={collectionLabel:`Sugestões`};var In={};In={collectionLabel:`Sugestões`};var Ln={};Ln={collectionLabel:`Sugestii`};var Rn={};Rn={collectionLabel:`Предложения`};var zn={};zn={collectionLabel:`Návrhy`};var Bn={};Bn={collectionLabel:`Predlogi`};var Vn={};Vn={collectionLabel:`Predlozi`};var Hn={};Hn={collectionLabel:`Förslag`};var Un={};Un={collectionLabel:`Öneriler`};var Wn={};Wn={collectionLabel:`Пропозиції`};var Gn={};Gn={collectionLabel:`建议`};var Kn={};Kn={collectionLabel:`建議`};var qn={};qn={"ar-AE":pn,"bg-BG":mn,"cs-CZ":hn,"da-DK":gn,"de-DE":_n,"el-GR":vn,"en-US":yn,"es-ES":bn,"et-EE":xn,"fi-FI":Sn,"fr-FR":Cn,"he-IL":wn,"hr-HR":Tn,"hu-HU":En,"it-IT":Dn,"ja-JP":On,"ko-KR":kn,"lt-LT":An,"lv-LV":jn,"nb-NO":Mn,"nl-NL":Nn,"pl-PL":Pn,"pt-BR":Fn,"pt-PT":In,"ro-RO":Ln,"ru-RU":Rn,"sk-SK":zn,"sl-SI":Bn,"sr-SP":Vn,"sv-SE":Hn,"tr-TR":Un,"uk-UA":Wn,"zh-CN":Gn,"zh-TW":Kn};function Jn(e){return e&&e.__esModule?e.default:e}function Yn(e,t){let{inputRef:n,collectionRef:r,filter:i,disableAutoFocusFirst:o=!1,disableVirtualFocus:l=!1}=e,d=A(),p=(0,I.useRef)(void 0),m=(0,I.useRef)(!1),h=(0,I.useRef)(null),v=te()===`virtual`&&(s()||ne()),[y,b]=(0,I.useState)(!v&&!l),[x,S]=(0,I.useState)(!1),[w,T]=(0,I.useState)(!1);(0,I.useEffect)(()=>()=>clearTimeout(p.current),[]);let D=g(e=>{!e.isTrusted&&y&&n.current&&a(E(n.current))!==n.current&&c()!==`touch`&&n.current.focus();let i=N(e);e.isTrusted||!i||h.current===i.id||(clearTimeout(p.current),i===r.current?h.current&&!document.getElementById(h.current)&&(h.current=null,t.setFocusedNodeId(null)):m.current?(h.current=i.id,p.current=setTimeout(()=>{t.setFocusedNodeId(i.id)},500)):(h.current=i.id,t.setFocusedNodeId(i.id)),m.current=!1)}),[O,k]=(0,I.useState)(null),j=(0,I.useCallback)(e=>{k(e),e==null?S(!1):(e.getAttribute(`tabindex`)!=null&&b(!1),S(!0))},[]);C(()=>(O?.addEventListener(`focusin`,D),()=>{O?.removeEventListener(`focusin`,D)}),[O]);let ee=u((0,I.useMemo)(()=>_(r,j),[r,j])),M=(0,I.useCallback)(()=>{if(!r.current){T(!0);return}m.current=!0,r.current?.dispatchEvent(new CustomEvent(ce,{cancelable:!0,bubbles:!0,detail:{focusStrategy:`first`}}))},[r]),P=(0,I.useCallback)(e=>{T(!1),ln(a()),h.current=null,t.setFocusedNodeId(null);let n=new CustomEvent(se,{cancelable:!0,bubbles:!0,detail:{clearFocusKey:e}});clearTimeout(p.current),m.current=!1,r.current?.dispatchEvent(n)},[r,t]),F=(0,I.useRef)(``);me(n,`beforeinput`,e=>{let{inputType:t}=e;F.current=t});let re=e=>{(F.current===`insertText`||F.current===`insertCompositionText`||F.current===`insertFromComposition`)&&!o?M():F.current&&(F.current.includes(`insert`)||F.current.includes(`delete`)||F.current.includes(`history`))&&(P(!0),fn(document)===n.current&&dn(n.current,null)),t.setInputValue(e)},ie=(0,I.useRef)(null),ae=e=>{if(ie.current=N(e),e.nativeEvent.isComposing)return;let t=h.current;switch(t!==null&&E(n.current).getElementById(t)==null&&(h.current=null,t=null),e.key){case`a`:if(de(e))return;break;case`Escape`:if(e.isDefaultPrevented())return;break;case` `:return;case`Tab`:`continuePropagation`in e&&e.continuePropagation();return;case`Home`:case`End`:case`PageDown`:case`PageUp`:case`ArrowUp`:case`ArrowDown`:case`ArrowRight`:case`ArrowLeft`:{if((e.key===`Home`||e.key===`End`)&&t==null&&e.shiftKey)return;if(e.key===`ArrowRight`||e.key===`ArrowLeft`){if(t==null){e.isPropagationStopped()||e.stopPropagation();return}break}e.preventDefault();let n=new CustomEvent(ce,{cancelable:!0,bubbles:!0});r.current?.dispatchEvent(n);break}}e.isPropagationStopped()||e.stopPropagation();let i=!0;if(r.current!==null){if(t==null)i=r.current?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type,e.nativeEvent))||!1;else{let n=document.getElementById(t);n&&(i=n?.dispatchEvent(new KeyboardEvent(e.nativeEvent.type,e.nativeEvent))||!1)}}if(i)switch(e.key){case`ArrowLeft`:case`ArrowRight`:P();break;case`Enter`:t!=null&&document.getElementById(t)?.dispatchEvent(new PointerEvent(`click`,e.nativeEvent));break}else e.preventDefault()},L=g(e=>{if(N(e)===ie.current){e.stopImmediatePropagation();let t=h.current;t==null?r.current?.dispatchEvent(new KeyboardEvent(e.type,e)):document.getElementById(t)?.dispatchEvent(new KeyboardEvent(e.type,e))}});(0,I.useEffect)(()=>(document.addEventListener(`keyup`,L,!0),()=>{document.removeEventListener(`keyup`,L,!0)}),[]);let oe=le({id:d,"aria-label":Ot(Jn(qn),`@react-aria/autocomplete`).format(`collectionLabel`)}),ue=(0,I.useCallback)((e,n)=>!i||i(e,t.inputValue,n),[t.inputValue,i]),R=e=>{if(!e.isTrusted)return;let t=h.current?document.getElementById(h.current):null;t&&un(t,e.relatedTarget)},fe=e=>{if(e.isTrusted&&h.current&&document.getElementById(h.current)){let t=N(e);queueMicrotask(()=>{un(t,r.current),dn(r.current,t)})}},pe=e=>{e.button===0&&e.pointerType!==`touch`&&h.current!=null&&n.current!=null&&N(e)===n.current&&P()},z={value:t.inputValue,onChange:re},he={onKeyDown:ae,"aria-activedescendant":t.focusedNodeId??void 0,onBlur:R,onFocus:fe,onPointerDown:pe};return z={...z,...y&&x&&he,enterKeyHint:`go`,"aria-controls":x?d:void 0,"aria-autocomplete":`list`,autoCorrect:`off`,spellCheck:`false`,autoComplete:`off`},{inputProps:z,collectionProps:f(oe,{shouldUseVirtualFocus:y,disallowTypeAhead:y,autoFocus:w?`first`:!1}),collectionRef:ee,filter:i==null?void 0:ue}}function Xn(e){let{onInputChange:t,inputValue:n,defaultInputValue:r=``}=e,i=e=>{t&&t(e)},[a,o]=(0,I.useState)(null),[s,c]=k(n,r,i);return{inputValue:s,setInputValue:c,focusedNodeId:a,setFocusedNodeId:o}}var Zn=(0,I.createContext)(null),Qn=(0,I.createContext)(null),$n=(0,I.createContext)(null),er=(0,I.createContext)(null);function tr(e){let t=p(Zn,e.slot);e=f(t,e);let{filter:n,disableAutoFocusFirst:r}=e,i=Xn(e),a=(0,I.useRef)(null),s=(0,I.useRef)(null),{inputProps:c,collectionProps:l,collectionRef:u,filter:m}=Yn({...d(e),filter:n,disableAutoFocusFirst:r,inputRef:a,collectionRef:s},i);return I.createElement(o,{values:[[Qn,i],[er,{...c,ref:a}],[$n,{...l,filter:m,ref:u}]]},e.children)}function nr(e){let t=M(e,{labelable:!0}),n;return e.orientation===`vertical`&&(n=`vertical`),e.elementType===`hr`?{separatorProps:t}:{separatorProps:{...t,role:`separator`,"aria-orientation":n}}}var rr=(0,I.createContext)({}),ir=nn(class extends Z{static{this.type=`separator`}filter(e,t){let n=t.getItem(this.prevKey);if(n&&n.type!==`separator`){let n=this.clone();return t.addDescendants(n,e),n}return null}},function(e,t){[e,t]=D(e,t,rr);let{elementType:n,orientation:r,style:i,className:a,slot:o,...s}=e,c=n||`hr`;c===`hr`&&r===`vertical`&&(c=`div`);let u=l[c],{separatorProps:d}=nr({...s,elementType:n,orientation:r}),p=M(e,{global:!0});return I.createElement(u,{render:e.render,...f(p,d),style:i,className:a??`react-aria-Separator`,ref:t,slot:o||void 0})}),ar=(0,I.createContext)({}),or=(0,I.forwardRef)(function(e,t){[e,t]=D(e,t,ar);let{elementType:n=`span`,...r}=e,i=l[n];return I.createElement(i,{className:`react-aria-Text`,...r,ref:t})}),sr=(0,I.createContext)({}),cr=`__button_group_child`,lr=({children:e,className:t,fullWidth:n,isDisabled:r,isIconOnly:i,size:a,slot:o,style:s,variant:c,[cr]:l,...u})=>{let d=(0,I.use)(sr),f=l===!0,p=a??(f?d?.size:void 0),m=c??(f?d?.variant:void 0),h=r??(f?d?.isDisabled:void 0),g=ve({fullWidth:n??(f?d?.fullWidth:void 0),isIconOnly:i,size:p,variant:m});return(0,H.jsx)(Oe,{className:x(t,g),"data-slot":`button`,isDisabled:h,slot:o,style:s,...u,children:t=>typeof e==`function`?e(t):e})},ur=Object.assign(lr,{Root:lr}),$={en:{brandSub:`login state gateway`,controlPlane:`control plane`,workspace:`Workspace`,develop:`Develop`,system:`System`,runtimeSnapshot:`Runtime and scheduler snapshot`,routesHint:`OpenAI / Anthropic-compatible routes`,clientConfig:`Client configuration`,clientConfigHint:`Use the same console key as Bearer token`,providerPrefixHint:`Pin a provider with a qoder/, workbuddy/, trae/, devin/, command/, codex/, zhipu/, qwenwork/, kimi/, codearts/, kiro/, meta/, opencode/, or doubaowork/ model prefix. A named API key can also limit which providers are listed and routed. Bare IDs follow the cross-provider pool setting on System.`,authentication:`Authentication`,curlExample:`curl example`,quickTestHint:`Send a real request through the selected account`,response:`Response`,providerCatalog:`Model catalog`,providerCatalogMeta:`SIGNED-IN / LIVE`,checkAllModels:`Check all models`,checkingModels:`Checking…`,checkModelsHint:`Sends one 1-token, thinking-disabled live request per model per available account. Real usage is billed upstream but excluded from the Usage page totals.`,checkModelsSummary:`{passed} reachable · {failed} failed · {total} total · {elapsed}ms`,checkModelsEmpty:`No models to check.`,checkResultOK:`Reachable`,checkResultFailed:`Failed`,checkResultSkipped:`Skipped`,checkAccountResults:`Account results`,checkNotRun:`Not checked`,checkPassedAccounts:`{passed}/{total} accounts`,accountPool:`Account pool`,accountCreateHint:`Create an isolated runtime first, then sign in with browser or PAT.`,credentialImportHint:`Only credential bundles exported from this console, with matching user blob and machine ID.`,accountEmptyHint:`Create an account runtime to begin.`,oauthDeviceFlow:`OAuth device flow`,navOverview:`Overview`,navAuth:`Accounts`,navProviders:`Models`,navModelPool:`Dispatch groups`,navAccess:`Access & try`,navAccounts:`Accounts`,checkinDefaultsTitle:`Automatic check-in`,checkinDefaultsHint:`Set a default time for each provider. Accounts following the default pick up changes automatically; custom times stay unchanged.`,checkinDisabledAccountsTitle:`Check in disabled accounts`,checkinDisabledAccountsHint:`When enabled, accounts disabled for chat can still run their opted-in automatic check-in. Manual check-in remains unavailable for disabled accounts.`,checkinDisabledAccountsStatus:`Current status`,checkinDisabledAccountsAriaLabel:`Allow automatic check-in for disabled accounts`,checkinInherit:`Follow provider policy`,checkinDefaultValue:`Provider default: {time}`,checkinCustom:`Account override`,checkinConfigured:`Configured`,checkinScheduleHint:`Runs on the provider server clock shown below, normally within about 90 seconds of the chosen time; sequential account processing can take longer. Failed or provisional attempts retry around 02:05, 12:05 and 21:00. Chat is unaffected.`,checkinTimeInvalid:`Enter a valid check-in time (HH:mm).`,checkinRecordSkipped:`Activity unavailable`,checkinStatusPending:`Not checked in upstream`,checkinStatusUnknown:`Upstream status unknown`,checkinUpstreamSynced:`Upstream synced {time}`,checkinServerClock:`Server clock · {timezone}`,checkinServerTime:`Server time: {time}`,checkinAutoScheduleHint:`Automatic schedule: upstream earliest check-in window + 1 hour ({time}). Manual overrides still win.`,navUsage:`Usage`,usageTitle:`Usage`,usageByModel:`Models`,usageByAccount:`Accounts`,usageByProvider:`Providers`,usageColRequests:`Requests`,usageColSuccess:`Success`,usageColTokens:`Tokens`,usageColCacheWrite:`Cache write`,usageColCredits:`Credits`,usageRowCount:`{count} rows`,usageShareOther:`Other`,usageEmpty:`No requests in this window.`,usageStatsTab:`Stats`,usageCostTab:`Quota`,usageWindow:`Window`,usageWindow24h:`24h`,usageWindow7d:`7d`,usageWindowTotal:`All retained`,usageCredits:`Quota used`,usageCreditsHint:`Subscription credits across all providers`,usageEstCost:`Equivalent cost`,usageTotalTokens:`Total tokens`,usageRequests:`Requests`,usageModelCount:`{count} models`,usageCacheHitRate:`Cache hit`,usageTokenSplitNote:`hit / miss / output`,usageChartTitle:`Usage over time`,usageChartHint:`Stacked by model. Switch between quota and tokens.`,usageChartEmpty:`No usage in this window.`,usageBreakdownTitle:`By model`,usageBreakdownHint:`Tokens and subscription credits for every model.`,usageColInputHit:`Input · cache hit`,usageColInputMiss:`Input · cache miss`,usageColOutput:`Output`,usageColCost:`Equiv. cost`,usageUnpricedCost:`no list price`,usageColSplit:`Peak / off-peak`,usageTotals:`Total`,usageRetentionHint:`Request logs are pruned on a schedule, so “All retained” covers only what is still stored.`,usageRenderNote:`Optional DeepSeek official list-price estimate in CNY. Subscription accounts do not bill this way — for comparison only.`,usagePeakNote:`Peak = Beijing time Mon–Fri 09:00–12:00 & 14:00–18:00; off-peak is half. Holidays are not handled.`,usageUnpricedHint:`No list-price row (quota and tokens only): {models}`,usageNoteTitle:`How this is calculated`,usagePriceTitle:`DeepSeek official price table`,usagePriceHit:`Cache hit`,usagePriceMiss:`Cache miss`,usagePriceOutput:`Output`,usagePriceBandOff:`Off-peak`,usagePriceBandPeak:`Peak`,usageOffPeak:`Off-peak`,usagePeak:`Peak`,usageChartMetric:`Chart metric`,usageEstimateTitle:`DeepSeek list-price estimate`,usageEstimateHint:`Optional CNY comparison for priced models. Collapsed by default.`,usageEstimateChartTitle:`List-price trend`,usageEstimateChartEmpty:`No priced DeepSeek usage in this window.`,chartMetricRequests:`Requests`,chartMetricTokens:`Tokens`,chartMetricLatency:`p95 latency`,chartInput:`Input`,chartOutput:`Output`,chartCacheRead:`Cache read`,chartTotal:`Total`,navLogs:`Logs`,navKeys:`API keys`,navSystem:`System settings`,sidebarFoot:`Gateway for CLI logins`,sidebarInFlight:`In flight: {count}`,systemSettingsTitle:`System settings`,crossProviderModelPoolTitle:`Cross-provider model pool`,crossProviderModelPoolHint:`When enabled, bare model IDs can route across matching Qoder, WorkBuddy, and Trae accounts. When disabled, bare IDs are rejected and requests must use a provider-prefixed model ID.`,crossProviderModelPoolStatus:`Current status`,crossProviderModelPoolAriaLabel:`Enable cross-provider model pool`,modelPoolTitle:`Dispatch groups`,modelPoolCreate:`Add group`,modelPoolEdit:`Edit group`,modelPoolId:`Client model ID`,modelPoolIdHint:`The model field in a client request, for example my-claude. It cannot be changed after saving.`,modelPoolIdLocked:`Clients send this as the model field. It cannot be changed.`,modelPoolName:`Name`,modelPoolNameHint:`Shown only in this console list, so you can tell groups apart. Clients never see it.`,modelPoolNamePh:`My Claude`,modelPoolStrategy:`Routing strategy`,modelPoolStrategyHint:`Priority: always use the first working member (primary/backup). Round robin: spread requests evenly. Fill first: favor the highest-weight member. FEFO: prefer the member whose quota expires soonest.`,modelPoolStrategy_priority:`Priority order`,"modelPoolStrategy_round-robin":`Round robin`,"modelPoolStrategy_fill-first":`Fill first`,modelPoolStrategy_fefo:`Expiry first (FEFO)`,"modelPoolStrategy_least-quota-first":`Least remaining quota first`,"modelPoolStrategy_most-quota-first":`Most remaining quota first`,modelPoolFailover:`Failover`,modelPoolMaxAttempts:`Max attempts`,modelPoolMaxAttemptsHint:`Maximum providers tried before the request fails (1-64).`,modelPoolMembers:`Provider models`,modelPoolMembersHint:`Only connected providers and the models enabled in their provider settings are selectable. The provider account pool picks the serving account automatically; order sets priority.`,modelPoolAddMember:`Add provider model`,modelPoolMembersEmpty:`No members yet. Add at least one provider model.`,modelPoolMoveUp:`Move up`,modelPoolMoveDown:`Move down`,modelPoolProvider:`Provider`,modelPoolRegion:`Region`,modelPoolAnyRegion:`Any region`,modelPoolModel:`Model`,modelPoolWeight:`Weight`,modelPoolNoModels:`No models available`,modelPoolIdRequired:`Group ID is required.`,modelPoolNameRequired:`Display name is required.`,modelPoolMembersRequired:`Add at least one provider seat.`,modelPoolMemberIncomplete:`Each seat needs one provider and one model.`,modelPoolAttemptsInvalid:`Max attempts must be between 1 and 64.`,modelPoolColName:`Model`,modelPoolColStrategy:`Strategy`,modelPoolColMembers:`Members`,modelPoolColFailover:`Failover`,modelPoolColEnabled:`Enabled`,modelPoolColActions:`Actions`,modelPoolFailoverOn:`On · {count} attempts`,modelPoolFailoverOff:`Off`,modelPoolEmpty:`No dispatch groups`,modelPoolEmptyHint:`Add a group and clients get another model they can call.`,modelPoolDeleteTitle:`Delete dispatch group`,modelPoolDeleteDesc:`Delete “{name}”? Clients using this group ID will stop reaching it.`,modelPoolSaved:`Saved`,modelPoolDeleted:`Deleted`,modelPoolBack:`All groups`,modelPoolEnabled:`Enabled`,modelPoolIdInvalid:`Group ID must be lowercase letters, digits, - and /, up to 128 characters.`,modelPoolMissing:`This dispatch group no longer exists.`,modelPoolEntryTitle:`Request`,modelPoolEntryDetail:`Client model id`,modelPoolEntryNote:`Starts when a client calls this id`,modelPoolEntryHint:`Each seat is one provider. Leave accounts empty to use all of them, or check several. Left to right is the try order.`,modelPoolStepProvider:`Provider`,modelPoolStepProviderDetail:`One provider`,modelPoolAccounts:`Accounts`,modelPoolAccountsHint:`Leave this empty, or check several: saving uses every connected account of the provider. Check exactly one to use only that account.`,modelPoolAccountsAll:`All accounts`,modelPoolAccountsAllCount:`All {count} accounts`,modelPoolSeatOrderAll:`Provider order`,modelPoolSeatOrderPicked:`Check order`,modelPoolSeatCount:`{count} seats`,modelPoolPathCount:`{count} paths`,modelPoolAccountsCount:`{count} accounts`,modelPoolAccountsSearch:`Find an account`,modelPoolAccountsNoMatch:`No account matches`,modelPoolNoAccounts:`This provider has no connected account`,modelPoolAccountsDraft:`Checking several accounts still saves as every account of the provider. Check exactly one to keep a single account.`,modelPoolClientModel:`Client model name`,modelPoolCanvasPalette:`Add a seat`,modelPoolCanvasIncomplete:`Set up`,modelPoolCanvasSkip:`Skipped`,modelPoolCanvasFit:`Fit view`,modelPoolCanvasZoomIn:`Zoom in`,modelPoolCanvasZoomOut:`Zoom out`,modelPoolStrategyNode:`Strategy`,modelPoolStrategyNote:`Orders this row of seats`,modelPoolAddSeat:`Add seat`,modelPoolDragSeat:`Drag to reorder`,modelPoolRemoveSeat:`Remove seat`,modelPoolPathEmpty:`No seats on this path yet.`,modelPoolStepModel:`Model`,modelPoolStepModelDetail:`One provider model`,modelPoolStepModelNote:`Choose a provider and a model`,modelPoolStepGroup:`Nested group`,modelPoolStepGroupDetail:`Another dispatch group`,modelPoolStepGroupNote:`Keeps that pool's own order`,modelPoolStepIntent:`Intent`,modelPoolStepIntentDetail:`Latest user message`,modelPoolStepIntentNote:`Keywords, or one classifier call`,modelPoolPathMatch:`Match`,modelPoolPathDefault:`Default`,modelPoolPathLabel:`Path name`,modelPoolAddPath:`Add path`,modelPoolRemovePath:`Remove path`,modelPoolKeywords:`Keywords`,modelPoolKeywordsHint:`Comma-separated. Any case-insensitive hit on the latest user message selects this path.`,modelPoolIntentLabel:`Classifier label`,modelPoolIntentHint:`Matched against the classifier reply. The path name is also accepted.`,modelPoolPathFallback:`Default path`,modelPoolClassifier:`Classifier`,modelPoolClassifierOff:`Keywords only`,modelPoolClassifierHint:`Optional. One non-streaming call before routing. It must be a concrete model.`,modelPoolNestedPool:`Group`,modelPoolNestedPoolPick:`Choose a group`,modelPoolNestedPoolEmpty:`No other groups yet`,modelPoolGroupRequired:`Choose a nested group.`,modelPoolSelfGroup:`A group cannot nest itself.`,modelPoolClassifierIncomplete:`The classifier needs a provider and a model.`,modelPoolPreview:`Try a message`,modelPoolPreviewHint:`Shows the path and the attempt order for this draft. A classifier is called once when the draft has one.`,modelPoolPreviewPh:`Plan the rollout`,modelPoolPreviewRun:`Preview`,modelPoolPreviewPath:`Path`,modelPoolNoReady:`No ready account`,modelPoolWeightHint:`Used by fill first. The saved weight stays when you switch strategy.`,modelPoolWeightNote:`Weight {weight}`,modelPoolCapabilities:`Advertised capabilities`,modelPoolCapabilitiesHint:`Leave a value at 0 to derive it from the members. These fields do not change routing.`,modelPoolContextLength:`Context window`,modelPoolContextLengthHint:`0, or at least 1024.`,modelPoolMaxOutput:`Max output`,modelPoolMaxOutputHint:`0, or at least 1024, and not above the context window.`,modelPoolReasoningLevels:`Reasoning levels`,modelPoolReasoningLevelsHint:`Empty keeps the levels shared by every member.`,modelPoolReasoningSelected:`{n}/{total} selected`,modelPoolReasoningSelectAll:`Select all`,modelPoolReasoningClear:`Clear`,modelPoolReasoningEmpty:`No level selected: only the levels every member shares are advertised.`,modelPoolReasoningDefault:`Default effort`,modelPoolReasoningDefaultHint:`Used when the client sends no reasoning intent.`,modelPoolReasoningAuto:`Derive`,modelPoolCapabilitiesInvalid:`Context and max output must be 0 or between 1024 and 4000000, and max output cannot exceed the context window.`,modelPoolReasoningInvalid:`The default effort must be one of the selected reasoning levels.`,keysAggregationMode:`Model aggregation mode`,keysAggregationModeHint:`When on, this key can only call aggregated logical models; provider selection below is ignored.`,workbuddyCheckinSettingsTitle:`WorkBuddy check-in`,workbuddyCheckinSettingsHint:`Default first daily check-in time for new WorkBuddy accounts. Existing accounts keep their own time until you edit them.`,workbuddyCheckinSettingsFieldHint:`Uses server local time. New WorkBuddy accounts inherit this unless you set a different time on the account.`,routingStrategyTitle:`Account routing strategy`,routingStrategyHint:`Choose how ready accounts share traffic. Fill-first keeps traffic on the highest-priority account until it is unavailable. Earliest-expiry-first only ranks accounts inside the same provider by their nearest credit-package expiry. Least/most quota first rank accounts by remaining quota ratio; accounts with unknown quota sort last.`,routingStrategy:`Strategy`,routingRoundRobin:`Round robin`,routingWeightedRoundRobin:`Weighted round robin`,routingFillFirst:`Fill first`,routingFEFO:`Earliest expiry first (FEFO)`,routingLeastQuotaFirst:`Least remaining quota first`,routingMostQuotaFirst:`Most remaining quota first`,routingWeight:`Routing weight`,sessionAffinityTTL:`Session TTL`,sessionAffinityHits:`Sticky hits`,sessionAffinityMisses:`Sticky misses`,sessionAffinityEscapes:`Sticky escapes`,lastSessionMiss:`Last miss`,lastSessionEscape:`Last escape`,checkUpdates:`Check updates`,versionUpdate:`Version update`,latestVersionHint:`Download the latest version first, then apply it when you are ready.`,updateAvailable:`Update available`,settingsTabGeneral:`General`,settingsTabRouting:`Routing`,settingsTabSecurity:`Security & data`,settingsTabUpdates:`Updates`,sidebarNewVersion:`New version {version}`,sidebarReleaseNotes:`Release notes`,sidebarGoToUpdate:`History & rollback`,upToDate:`Up to date`,currentVersion:`Current version`,latestVersion:`Latest version`,skippedBetweenLabel:`Versions in between`,releaseNotes:`What changed`,updateNoNotes:`No notes for this version.`,versionHistory:`Version history`,versionCurrentBadge:`Current`,versionLatestBadge:`Latest`,restoreThisVersion:`Restore this version`,restoreVersionTitle:`Restore {version}?`,restoreVersionHint:`The service will switch back to this version. New requests pause only while it restarts.`,updaterReady:`Updates are ready on this host`,updaterUnavailable:`Updates are not available on this host`,updaterNeedsHost:`This process cannot replace its own container`,updaterUnavailableHint:`This page can check for new versions, but this host cannot apply them until updates are set up.`,updaterNeedInstall:`Install the host updater from deploy/install-updater.sh or deploy/install-updater.ps1 so it can talk to Docker.`,updaterNeedCompose:`Linux needs the updater socket mounted into the container. Docker Desktop uses a loopback updater URL instead of a Unix socket.`,updaterNeedRelease:`The running build must be a published GitHub release, not a local or development image.`,updateNow:`Download update`,applyUpdateNow:`Update now`,cancelUpdate:`Cancel download`,discardPreparedImage:`Discard this update`,updateReadyHint:`The update is downloaded. Apply it when you want to restart; new requests pause only then.`,updateReadyTargetHint:`Ready to switch to {version}. New requests pause only during the restart.`,updateNewerReleaseHint:`A newer version is available ({latest}). Update now, or discard this download and start again.`,updateStagedUnavailableHint:`Update the host updater first to use the staged update flow.`,updateLegacyOneShotHint:`This host will download and apply the update in one step. Later versions can download first, then wait for Update now.`,rollbackToVersion:`Restore an older version`,rollbackToVersionHint:`You can restore one of the three most recent versions before the one running now.`,updateReloadingIn:`Refreshing in {seconds}s`,updateInProgress:`Updating…`,updatePreparingImage:`Downloading update…`,updatePreparingImageHint:`Downloading the update in the background. This host stays on the current version until you tap Update now. Cancel if the download hangs.`,updateApplyingHint:`Applying the update. This page will refresh when it is ready.`,updateInProgressHint:`The service is updating and will refresh automatically when it is ready.`,updateUnavailableHint:`Updates are temporarily unavailable. Please try again later.`,updateFailedHint:`The update could not be completed. Please try again.`,updateCheckFailedHint:`Unable to check for updates. Please try again later.`,updatePreparingHint:`Getting the update ready: checking the version and saving a backup. Existing connections may be interrupted; clients can retry.`,updateRunningHint:`The update is running. This page will refresh when it is ready.`,updateReloadingHint:`Update complete. Refreshing this page…`,updateElapsed:`{seconds}s elapsed`,sqliteProtection:`SQLite protection`,sqliteProtectionHint:`Your data stays in place, and a verified backup is created before the update.`,sqliteBackupBeforeUpdate:`Verified backup before the update`,sqliteKeepFive:`Keep the five most recent backups`,sqliteRollbackTogether:`Restore the database and previous version together if the update fails`,updateStatus:`Update status`,noUpdateJob:`No update job yet`,confirmUpdate:`Update now`,confirmUpdateHint:`New requests pause briefly while a backup is created. Existing connections may be interrupted; clients can retry them.`,updateState_idle:`Idle`,updateState_unavailable:`Unavailable`,updateState_queued:`Waiting to start`,updateState_preparing:`Getting ready`,updateState_preparing_image:`Downloading update`,updateState_checking:`Checking version`,updateState_backing_up:`Saving a backup`,updateState_submitting:`Starting update`,updateState_running:`Updating`,updateState_pulling:`Downloading update`,updateState_host_binary:`Downloading update helper`,updateState_image_ready:`Download complete`,updateState_ready_to_apply:`Ready to update`,updateState_recreating:`Restarting`,updateState_health_checking:`Checking that it started`,updateState_rolling_back:`Restoring previous version`,updateState_succeeded:`Updated`,updateState_rolled_back:`Restored previous version`,updateState_failed:`Update failed`,checking:`checking`,refresh:`Refresh`,apiKey:`API key`,apiKeyPh:`API key`,needApiKey:`Sign in with the console password to load data.`,loginTitle:`Enter the console`,loginLead:`This host already has a running CLI2API proxy. Use the same API key your clients send to /v1.`,loginDesc:`Same key as Authorization: Bearer on the API.`,loginFormTitle:`Continue`,loginPassword:`Console password`,loginPasswordPh:`API key`,loginNeedKey:`Password is empty.`,loginBadKey:`That key does not match this host.`,loginSubmit:`Continue`,loggingInConsole:`Checking…`,loginHint:`Self-hosted only. Account login happens after this, on Accounts.`,showPassword:`Show password`,hidePassword:`Hide password`,signOut:`Sign out`,checkingSession:`Checking session…`,refreshing:`Refreshing`,pages:{home:{title:`Overview`,desc:`Runtime health, request volume, and ready endpoints.`},auth:{title:`Auth`,desc:`Browser device-flow login, PAT login, and session rewarm.`},providers:{title:`Models`,desc:`Models from signed-in accounts, plus per-model defaults for context and reasoning.`},modelPool:{title:`Dispatch groups`,desc:`A group is one model clients call.`},access:{title:`Access & try`,desc:`Multi-turn chat in the main panel; expand Raw API below to debug.`},accounts:{title:`Accounts`,desc:`One login per account. Browser sign-in first; PAT only when needed.`},usage:{title:`Usage`,desc:`Usage by model, account and provider.`},logs:{title:`Logs`,desc:`Recent proxy requests and process output.`},keys:{title:`API keys`,desc:`Create client keys and limit their providers and concurrency.`},system:{title:`System settings`,desc:`Cross-provider routing, managed updates, SQLite protection, and the console API key.`},login:{title:`Enter the console`,desc:`Same API key as /v1.`}},logsRequests:`Request history`,logsRuntime:`Runtime logs`,logsEmptyRequests:`No requests recorded yet.`,logsEmptyRuntime:`No runtime lines captured yet.`,logsSearchRuntime:`Search runtime output…`,logsSearchRequestId:`Find a request id`,logsSearchModel:`Find a model`,logsSearchAccount:`Find an account`,logsFilterIdAll:`All request IDs`,logsNoFilterOptions:`No matching options`,logsClear:`Clear history`,logsClearConfirm:`Delete all request history on this host?`,logsColTime:`Time`,logsColAccount:`Account`,logsColApiKey:`API key`,logsColProvider:`Provider`,logsColModel:`Model`,logsColReasoning:`Reasoning`,logsColStatus:`Status`,logsColLatency:`Latency`,logsColTTFT:`First token`,logsLatencyTotal:`Total`,logsOutputTPS:`Output TPS`,logsColTokens:`Tokens`,logsTokensIn:`in`,logsTokensOut:`out`,logsTokensPoints:`{value} pts`,logsColStream:`Mode`,logsStreamYes:`stream`,logsStreamNo:`sync`,logsFilterAll:`All`,logsFilterOk:`OK`,logsFilterIncomplete:`Incomplete`,logsFilterError:`Error`,logsFilterCanceled:`Canceled`,logsFilterAccountAll:`All accounts`,logsFilterApiKeyAll:`All API keys`,logsSearchApiKey:`Find an API key`,logsFilterProviderAll:`All providers`,logsFilterModelAll:`All models`,logsFilterKindAll:`All errors`,logsFilterStreamAll:`All modes`,logsTimeRange:`Time`,logsTimeAll:`All time`,logsTime1h:`1 hour`,logsTime24h:`24 hours`,logsTime7d:`7 days`,logsTimeCustom:`Custom`,logsTimeFrom:`From`,logsTimeTo:`To`,logsKindQuota:`Quota`,logsKindRateLimit:`Rate limit`,logsKindAuth:`Auth`,logsKindNotReady:`Not ready`,logsKindUnavailable:`Unavailable`,logsKindInvalidRequest:`Invalid request`,logsKindModelNotAvailable:`Model missing`,logsPageSize:`Per page`,logsPage:`Page {page} / {pages}`,logsPrevPage:`Previous`,logsNextPage:`Next`,logsNoMatch:`No requests match these filters.`,logsLevelAll:`All`,logsLevelInfo:`Info`,logsLevelWarn:`Warn`,logsLevelError:`Error`,logsAttempts:`Attempts`,logsRouting:`Routing`,logsRouting_pool:`Pool`,logsRouting_pin:`Pinned`,logsRouting_sticky:`Session sticky`,logsRouting_sticky_escape:`Session escape`,logsNoAttempts:`No attempt details.`,logsStreamDiagnostics:`Stream diagnostics`,logsMessageShape:`Message shape`,logsMessageCount:`Messages`,logsEmptyMessageIndexes:`Empty indexes`,logsMessageRoles:`Roles`,logsCancellationSource:`Cancellation source`,logsUpstreamStatus:`Upstream status`,logsSSEEvents:`SSE events`,logsBytesRead:`Bytes read`,logsLastEvent:`Last event`,logsStreamComplete:`Completed with [DONE]`,logsUsageDetail:`Consumption`,logsCreditConsumed:`Points consumed`,logsDetailTitle:`Request detail`,logsSectionCall:`Call`,logsSectionDiagnostics:`Diagnostics`,logsRuntimeDetailTitle:`Runtime log detail`,logsRuntimeLevel:`Level`,logsRuntimeSource:`Source`,logsRuntimeMessage:`Message`,logsShownTotal:`{shown} / {total}`,logsAutoRefresh:`Live`,failedLogs:`Failed to load logs: {msg}`,homeEyebrow:`Runtime`,metricRequests:`Requests`,metricSuccess:`Success`,metricLatency:`p95`,metricTokens:`Tokens`,statsWindow1h:`1h`,statsWindow24h:`24h`,statsWindow7d:`7d`,statsWindow30d:`30d`,statsWindowCustom:`Custom`,statsWindowToday:`Today`,statsRefreshPause:`Pause auto-refresh`,statsRefreshResume:`Resume auto-refresh`,statsRefreshAuto:`Refreshing every 30s · click to pause`,statsRefreshPaused:`Auto-refresh paused · click to resume`,statsDragHint:`Drag to open logs for a range`,statsWindowHint:`{window} window`,statsTraffic:`Traffic`,statsTrafficHint:`Completed chat requests in the selected window`,statsEmptyTraffic:`No requests in this window yet.`,statsLatencyP50:`p50`,statsLatencyP95:`p95`,statsLatencyAvg:`avg`,statsTTFB:`TTFB`,statsPool:`Account pool`,statsPoolHint:`Ready workers and remaining quota`,statsCooling:`cooling`,statsCoolingChip:`{count} cooling`,statsPoolReadyEmpty:`No ready workers right now — check cooling above or Accounts.`,statsTopModels:`Top models`,statsTopAccounts:`Top accounts`,statsTopProviders:`Providers`,statsTopProvidersHint:`Request share by account family`,statsNoProviders:`No provider traffic yet.`,statsErrorMix:`Error mix`,statsStatusMix:`Outcomes & errors`,statsStatusMixHint:`Request status, failure kinds and busiest accounts`,statsCoolingDetails:`Cooling down · reason · remaining · backoff`,statsBackoffLevel:`Restart backoff level`,statsAffinityHit:`Affinity hit`,statsAffinityHint:`{hits} hits · {misses} misses · {bindings} bindings`,metricCacheHit:`Cache hit rate`,metricCacheHitDetail:`{read} cached / {prompt} prompt`,metricStreaming:`Streaming share`,metricStreamingDetail:`{count} of {total} requests`,metricCanceled:`Canceled`,metricCanceledDetail:`{rate} of requests`,statsErrorMixHint:`Classified failures in this window`,statsNoModels:`No model traffic yet.`,statsNoAccounts:`No account traffic yet.`,statsNoErrors:`No classified errors.`,statsUnknown:`unknown`,statsUnassigned:`unassigned`,resTitle:`Resources`,resHint:`Host process memory and CPU`,resServer:`Server`,resWorkers:`Workers`,resEmpty:`No worker processes yet.`,resGoroutines:`goroutines`,resCpuLifetime:`lifetime avg`,failedStats:`Failed to load stats: {msg}`,homeNote:`Signed into the local console. Account logins live on the Accounts page.`,metricRuntime:`Runtime`,metricAccounts:`Accounts`,metricModels:`Models`,metricAuth:`Auth`,metricPort:`Port`,serviceDetail:`Service detail`,endpoints:`Endpoints`,copyBaseUrl:`Copy Base URL`,copied:`Copied`,copy:`Copy`,open:`Open`,waitingOverview:`Waiting for overview…`,signIn:`Sign in`,connectQoder:`Connect account`,rewarm:`Rewarm`,rewarming:`Rewarming`,refreshAccount:`Refresh`,refreshingAccount:`Refreshing`,stepBrowserTitle:`Browser device flow`,stepBrowserDesc:`Opens account selection. Finish in the browser, then this page polls until the session is ready.`,startBrowserLogin:`Sign in with browser`,starting:`Starting…`,quotaLoading:`Getting quota…`,quotaUnavailable:`Quota unavailable`,authUrl:`Auth URL`,openAuthUrl:`Open link`,stepPatTitle:`Personal access token`,stepPatDesc:`Optional fallback when browser flow is inconvenient.`,pat:`PAT`,pasteToken:`paste token`,loginWithPat:`Login with PAT`,loggingIn:`Logging in…`,localState:`Local state`,raw:`Raw`,noAuthSnapshot:`No auth snapshot yet.`,catalog:`Catalog`,availableModels:`Available models`,modelsPulled:`Pulled from`,filter:`Filter`,filterPh:`glm / qwen / deepseek`,providerFilterAll:`All providers`,accountStatusFilter:`Account status`,connection:`Connection`,apiPlaygroundHint:`Pick an account and model. Switch Chat / Raw API at the top — Raw API has JSON and curl.`,readyAccounts:`{ready} of {total} accounts ready`,baseUrl:`Base URL`,externalClients:`External clients`,protocol:`Protocol`,quickTest:`Quick test`,requestBuilder:`Request builder`,responseInspector:`Response inspector`,responseInspectorHint:`Raw JSON from the local proxy`,requestIdle:`Idle`,requestComplete:`Complete`,requestFailed:`Request failed`,responseReceived:`Response received`,responseEmptyTitle:`No response yet`,responseEmptyHint:`Choose a route, write a prompt, and send the request. The raw response appears here.`,sendRequest:`Send request`,promptPlaceholder:`Write a message for the model`,promptHelper:`This test uses a non-streaming Chat Completions request.`,accessTabChat:`Chat`,accessTabApi:`Raw API`,accessTabsLabel:`Access modes`,chatTryEmptyTitle:`No reply yet`,chatTryEmptyHint:`Write a message below. Account and model live in the composer. Session clears when you leave.`,chatTryHelper:`Enter to send · Shift+Enter for a new line`,chatTrySend:`Send`,chatTryStop:`Stop`,chatTryStreaming:`Streaming…`,chatTryUserLabel:`You`,chatTryAssistantLabel:`Assistant`,chatTryCreditsUsed:`Used {amount} credits`,chatTryUsageTokens:`{prompt} → {completion}`,chatTryUsageFoot:`{tokens} · {amount} credits`,chatHistoryTitle:`History`,chatHistoryNew:`New chat`,chatHistoryEmpty:`No chats yet`,chatHistoryUntitled:`Untitled`,chatHistoryExpand:`Show history`,chatHistoryCollapse:`Hide history`,nativeApiHint:`Non-streaming request, raw JSON response, and a matching curl command.`,rawFormatLabel:`API format`,rawFormatChat:`Chat`,rawFormatMessages:`Messages`,rawFormatResponses:`Responses`,rawFormatHint:`Chat Completions, Anthropic Messages, and OpenAI Responses are all supported.`,rawApiShow:`Show raw API`,rawApiHide:`Hide raw API`,chatAttach:`Attach file`,chatAttachRemove:`Remove attachment`,chatAttachUnsupported:`Unsupported file type: {names}`,thinkingPhaseScan:`Scanning`,thinkingPhasePlan:`Planning`,thinkingPhaseDraft:`Drafting`,thinkingDone:`Thought`,thinkingElapsed:`{n}s`,toolCallGroup:`Used {n} tools`,chatDemoLoad:`Preview sample`,thinkingChars:`{count} chars`,thinkingWorking:`Thinking`,toolCallRunning:`Running`,toolCallSuccess:`Done`,toolCallError:`Error`,toolCallUntitled:`tool`,toolCallArgs:`Arguments`,toolCallArgsEmpty:`(empty)`,autoAccountHint:`The scheduler chooses an available account.`,fixedAccountHint:`This request is pinned to the selected account.`,modelRoutingHint:`Uses the public model ID exposed by this proxy.`,accountModelHint:`Only models this account currently serves. A pinned request fails if the ID is missing here.`,noAccountModels:`This account has no models to send.`,accountModels:`Available models`,accountModelsTitle:`Models on {name}`,accountModelsHint:`Live catalog from this account. Requests pinned here only use these IDs.`,accountModelsEmpty:`This account has not published a model catalog yet.`,accountModelsError:`Could not load models: {msg}`,noAccountsForTest:`No account runtime is available. Add and sign in to an account before testing.`,curlGeneratedHint:`Generated from the current account, model, and prompt`,prompt:`Prompt`,model:`Model`,send:`Send`,waitingRequest:`Waiting for a request…`,requesting:`Requesting…`,endpointOpenAI:`OpenAI Compatible`,endpointChat:`Chat Completions`,endpointBaseHint:`Use this path as the base URL in OpenAI-compatible clients.`,endpointChatHint:`OpenAI-compatible chat. Prefix the model ID to pin one provider, for example qoder/glm-5.2.`,endpointMessages:`Anthropic Messages`,endpointMessagesHint:`Stateless Anthropic Messages. Use a provider-prefixed model ID to pin one family.`,endpointResponses:`OpenAI Responses`,endpointResponsesHint:`Stateless OpenAI Responses. Use a provider-prefixed model ID to pin one family.`,endpointModels:`Models`,endpointModelsHint:`Public model IDs. Named API keys only see models from their allowed providers.`,endpointHealth:`Health`,endpointHealthHint:`Check whether the local proxy is responding.`,endpointCount:`{count} API routes`,endpointReady:`Available now`,endpointBaseLabel:`Client base URL`,endpointAuthLabel:`Bearer API key`,hasUserBlob:`Has user blob`,userBlobBytes:`User blob bytes`,machineId:`Machine ID`,sessionHot:`Session hot`,upstreamEndpoint:`Upstream endpoint`,rewarmCount:`Rewarm count`,proxy:`Proxy`,endpoint:`Endpoint`,lastError:`Last error`,running:`Running`,down:`Down`,hot:`Hot`,up:`Up`,ready:`Ready`,missing:`Missing`,degraded:`Degraded`,error:`Error`,yes:`yes`,no:`no`,modelCol:`Model`,mappedKeyCol:`Upstream key`,requestIdCol:`Request ID`,providerCol:`Provider`,qoderKeyCol:`Upstream key`,routedTo:`Upstream model {model}`,stateCol:`State`,contextWindowCol:`Maximum context window`,modelDefaultsCol:`Context and reasoning`,providerSettingsTitle:`Provider settings`,providerSettingsOpen:`Settings`,providerExpand:`Expand provider`,providerCollapse:`Collapse provider`,providerSettingsHint:`Applies to every account of this provider and region. The provider policy is the single source of truth for floors, proxy, system-prompt handling, aliases, model restrictions, and check-in time; account names, concurrency, and priority stay account-local.`,providerSettingsSaved:`Provider settings saved. Matching accounts now read this policy directly; no account rows were rewritten.`,providerSettingsLoadFailed:`Could not load provider settings. Refresh the page and try again.`,providerSettingsRegionMissing:`This provider group has no region yet. Refresh the model catalog and try again.`,providerSettingsSavedRefreshFailed:`Settings were saved, but the model list could not refresh: {message}`,providerModelsEmpty:`Select at least one model or turn off the model restriction.`,upstreamMaxContext:`Upstream max context`,imageInput:`Image input`,imageInputDeclared:`Declared by upstream`,imageInputNotDeclared:`Not declared`,imageInputUnsupported:`Not declared as supported`,qoderContextHint:`Default context window used when the request omits context length / max input tokens.`,contextInvalid:`Context window must be an integer between 1,024 and 4,000,000 tokens.`,contextSaved:`Saved context window for {model}.`,contextReset:`Restored the default context window for {model}.`,contextMaxOn:`Enabled Max context for {model}.`,contextMaxOff:`Disabled Max context for {model}.`,contextMaxUnavailable:`This model has no Max context switch.`,maxMode:`Max context`,maxModeHint:`Trae larger context window, often 200k to 1M. Not a plan or quota. Used only when the request omits is_max_mode; an explicit request still wins. Unsupported models never send this switch.`,qoderMaxModeHint:`Qoder larger context window. Not a plan or quota. When on, requests use the model’s largest window; when off (or when a request sets its own context) the default window applies.`,catalogWindow:`Catalog size`,catalogWindowHint:`This Trae model has no Max-context switch. The number is the catalog window.`,workbuddyContextHint:`WorkBuddy desktop default and optional context budgets from the catalog. This is a local compact budget, not Trae is_max_mode. Chat requests do not send a window switch.`,reasoningLevels:`Reasoning intensity`,reasoningHint:`Default thinking effort when the request omits reasoning_effort and related flags. This does not lock every call to that level, and it does not cap a higher client value. A level the model does not allow falls back to an allowed option.`,reasoningFixed:`Fixed thinking: {type}`,noReasoningLevels:`This model has no selectable reasoning levels.`,reasoningSaved:`Saved default reasoning for {model}: {level}.`,reasoningLevel_none:`Off`,reasoningLevel_low:`Low`,reasoningLevel_medium:`Medium`,reasoningLevel_high:`High`,reasoningLevel_xhigh:`Extra high`,reasoningLevel_max:`Max effort`,modelDetails:`Details`,modelDetailsCol:`Model details`,promptMaxTokens:`Prompt max`,maxOutputTokens:`Output max`,actions:`Actions`,save:`Save`,custom:`Custom`,defaultValue:`Default`,resetDefault:`Restore default`,fallback:`fallback`,modelFree:`(free)`,shownTotal:`{shown} shown / {total} total`,noModelsYet:`No models yet`,noModelsMatch:`No models match this filter.`,noProviders:`No providers loaded.`,failedOverview:`Failed to load overview: {msg}`,pastePatFirst:`Paste a PAT first`,patDone:`PAT login completed`,loginOpenMsg:`Open the auth URL to finish login`,idle:`idle`,menu:`Menu`,toggleSidebar:`Toggle sidebar`,accountsTitle:`Accounts`,accountsDesc:`One login per account. Chat round-robins and fails over.`,noAccounts:`No accounts yet. Add one to start serving chat.`,accountCount:`Accounts`,signedIn:`Signed in`,enabledAccounts:`Enabled`,availableAccounts:`Available`,needsAttention:`Needs attention`,searchAccounts:`Search name, ID, UID, provider, or auth type`,filterAll:`All`,shownAccounts:`{shown} / {total}`,noAccountsMatch:`No accounts match this filter.`,clearFilters:`Clear filters`,more:`More actions`,partialCooling:`Partial model cooldown`,modelCooldowns:`Model cooldowns`,modelCooldownsTitle:`Models in cooldown`,modelCooldownsEmpty:`No models are in cooldown.`,runtimeState:`Runtime state`,maxInflight:`Max concurrency`,priority:`Priority`,updatedAt:`Updated`,enabledState:`Enabled`,cooling:`Cooling down`,dead:`Recovering`,authFailed:`Auth failed`,patFallback:`PAT fallback`,usePat:`Use PAT`,account:`Account`,autoAccount:`Auto (round-robin)`,cooldown:`Cooldown`,inFlight:`In-flight`,liveConcurrency:`Concurrency`,liveRpm:`Last 60s`,liveRpmUnit:`req`,liveRpmHint:`started in the last minute`,liveTrace:`Trend`,livePeak:`peak {n}`,liveSaturated:`Saturated`,inflightTitle:`Live now`,inflightMockBadge:`mock`,inflightIdleBadge:`idle`,inflightMockToggle:`Demo`,inflightMockToggleAria:`Show mock demo when live is unavailable`,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`,inflightNow:`now`,inflightAgo:`ago`,inflightMore:`more`,inflightKindModel:`Model call`,inflightKindTool:`Tool call`,inflightKindEmbed:`Embedding`,inflightKindOther:`Other`,inflightPriority:`Priority`,inflightAttempt:`Attempt`,inflightPosition:`Position`,inflightWaited:`Waited`,inflightHigh:`High`,inflightLow:`Low`,inflightNormal:`Normal`,inflightPositionValue:`{n} of {total}`,inflightClose:`Close details`,inflightAttemptValue:`{n} of {max}`,inflightAnnounceFailed:`{name} failed`,inflightAnnounceFailedDetail:`{name} failed: {error}`,inflightAnnounceRetry:`{name} failed, retrying, attempt {attempt}`,inflightAnnounceLimited:`Rate limited, workers paused for {seconds} seconds`,inflightAnnounceResumed:`Rate limit lifted, workers resumed`,inflightAnnouncePressure:`{n} jobs waiting, above the backpressure line of {line}`,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`,dropSystemPromptTraeHint:`Keep caller system prompts. Clients such as MiMo Code put JSON instructions there; turn this on only if Trae rejects the request.`,autoCheckin:`Daily check-in`,autoCheckinHint:`Run the daily WorkBuddy credit check-in at the configured local time. Failed attempts retry around 21:00. Off by default.`,autoCheckinCreateHint:`WorkBuddy only. Enable automatic daily credit check-ins. The first attempt uses this account time, or the system default if left unchanged.`,autoCheckinTime:`Check-in time`,checkinAutoMode:`Auto (upstream window + 1 hour)`,checkinAutoFallbackHint:`The value above is the provider fallback. After the first upstream sync, each account stores its own exact time in its card.`,autoCheckinTimeHint:`Uses server local time and runs within about 14 minutes after the selected time. Failed attempts retry around 21:00. New accounts follow this provider policy.`,checkinNow:`Check in now`,quotaWindowsExpand:`Show more quota rows ({count})`,quotaWindowsCollapse:`Show fewer quota rows`,claimStudentCredit:`Claim monthly student benefit`,studentCreditClaimed:`Monthly student benefit claimed`,studentCreditAlready:`Monthly student benefit already claimed`,studentCreditFailed:`Monthly student benefit claim failed`,studentCreditUnavailable:`Monthly student benefit unavailable`,checkinAll:`Check in all`,checkinAllEmpty:`No enabled accounts support check-in`,checkinAllDone:`All {count} accounts are already checked in today`,toastCheckingInAll:`Checking in {done} of {total}…`,toastCheckedInAll:`Checked in {checked}, skipped {skipped}`,toastCheckedInAllFailed:`Checked in {checked}, skipped {skipped}, failed {failed}`,lastCheckin:`Last check-in`,lastCheckinNone:`No check-in yet`,checkinStatus:`Check-in`,checkinDaily:`Daily`,regionCN:`CN`,regionGlobal:`Global`,checkinToday:`Checked in today`,checkinPending:`Not checked in today`,checkinFailed:`Check-in failed`,checkinRecords:`Check-in records`,checkinRecordsTitle:`Check-in records · {name}`,checkinRecordsHint:`The latest 20 check-in attempts for this account.`,checkinRecordsEmpty:`No check-in records yet`,checkinRecordsCount:`{count} records`,checkinRecordSuccess:`Success`,checkinRecordAlready:`Already checked in`,checkinRecordFailed:`Failed`,checkinRewardSuffix:` · +{credits} credits`,checkinTruncated:`Message truncated · use copy for the full error`,checkinCopyError:`Copy full error`,refreshCredits:`Refresh credits`,expiryDistTitle:`Credit expiry distribution`,expiryDistHint:`Grouped by calendar day · colour marks the account · FEFO: upstream burns the soonest-expiring credits first`,expiryDistExpand:`Show all {n} days`,expiryDistCollapse:`Show less`,expiryDistDayTotal:`{n} credits expire`,expiryDistColAccount:`Account`,expiryDistColSoonest:`Soonest`,expiryDistColDaysLeft:`Days left`,expiryDistColBatch:`Expiring`,expiryDistColDaily:`Daily burn`,expiryDistDays:`{n}d`,expiryDistFoot:`"Daily burn" = credits expiring on the soonest day ÷ days until then — the pace needed to use them before they lapse.`,expiryDistExpired:`Expired`,usageColModel:`Model`,quota:`Quota`,quotaUsed:`Used`,quotaRemaining:`Remaining`,quotaDaily:`Daily quota`,quotaWeekly:`Weekly quota`,quotaMonthly:`Monthly quota`,quotaFiveHour:`5-Hour Limit`,quotaWeeklyLimit:`Weekly Limit`,quotaPlan:`Plan`,quotaPeriodEndDate:`Plan period ends {date}`,quotaExpiringSoonCredits:`{amount} credits expire within 7 days`,quotaMonthlyLimit:`Monthly Limit`,quotaUsedPercent:`{n}% used`,quotaResetsSoon:`Resets soon`,quotaResetsInMinutes:`Resets in {n} minutes`,quotaResetsInHours:`Resets in {n} hours`,quotaExpiresOn:`{amount}{unit} expire on {date}`,quotaAddOn:`Add-on`,quotaResourcePackage:`Resource package`,quotaExceeded:`Quota exceeded`,quotaOverageWindow:`Overage`,overageTitle:`Overages`,overagePull:`Pull from AWS`,overageEnabled:`On. After plan credits run out, extra use is billed at the overage rate.`,overageDisabled:`Off. Requests stop when plan credits run out.`,overageUnknown:`Unknown. Pull from AWS to read the switch.`,overageNotCapable:`This subscription does not support overages.`,overageReadOnly:`This login has no AWS profile, so the switch cannot be changed.`,overageHint:`The switch calls AWS and turns Kiro overages on or off immediately.`,overageFigures:`Cap {cap} · Rate {rate} · Billed {current}`,toastOveragePulled:`Overage status updated from AWS`,toastOverageOn:`Overages enabled`,toastOverageOff:`Overages disabled`,errorKind:`Error kind`,qoderLoginHint:`This signs in the upstream account only. It does not change the console password.`,needQoderLogin:`Needs account login`,waitingQoderLogin:`Waiting for account login…`,qoderLoginDone:`Account login completed`,rewarmDone:`Rewarm completed`,accountsSigned:`{n} / {total} accounts ready`,addAccount:`Add account`,exportAll:`Export all accounts`,importAll:`Import all accounts`,bundleExportHint:`Keep this file private — it contains sign-in credentials.`,toastAccountsExporting:`Preparing account export…`,toastAccountsExported:`Exported {n} accounts to a file.`,batchImport:`Batch import`,batchImportLoading:`Importing WorkBuddy accounts…`,batchImportUnrecognized:`Could not recognize this credential file format.`,batchImportConfirmTitle:`Confirm batch import`,batchImportConfirmHint:`Detected from {file}. Review and confirm before importing.`,batchImportConfirmHintNoFile:`Review the detected format, then confirm to import.`,batchImportRegion:`WorkBuddy region`,batchImportRegionPickHint:`Region was unclear — pick CN or Global before importing.`,batchImportRegionMixed:`This pack mixes CN and Global domains. Split it, or pick one region to force.`,batchImportRegionUnknown:`Region not detected from domains — please confirm.`,batchImportUnknownFormat:`Unknown format field; guessed from shape.`,batchImportProviderUnsupported:`Batch import for this provider is not supported yet. Detection is ready for a future release.`,batchImportConfirmAction:`Import`,batchImportFormatUnknown:`Unknown format`,batchImportProviderUnknown:`Unknown provider`,bundleImportConfirmTitle:`Import all accounts?`,bundleImportConfirmHint:`From {file}. This restores the accounts stored in the file.`,bundleImportConfirmHintNoFile:`This restores the accounts stored in the selected file.`,bundleImportConfirmAction:`Import all`,bundleImportAccountCount:`accounts in this file`,bundleImportCountDetail:`{credentials} of them include a stored sign-in credential.`,bundleImportAdditiveHint:`Import adds new accounts with fresh IDs. Existing accounts are not changed.`,bundleImportLoading:`Importing accounts…`,bundleImportUnrecognized:`This is not a valid full account export file.`,accountName:`Account name`,accountNameRequired:`Enter an account name.`,accountCreated:`Account created. Session is starting.`,importCredential:`Import native credential`,accountImported:`Credential imported and runtime started.`,accountImportBatch:`Imported {n} accounts.`,accountImportPartial:`Imported {ok}, failed {fail}.`,credentialCopied:`Credential bundle copied.`,addAccountTitle:`Add account`,accountType:`Account type`,loginMethod:`Login method`,accountTypeHint:`Choose the upstream login family for this isolated runtime.`,accountTypeQoderGlobal:`Qoder Global`,accountTypeQoderGlobalHint:`Qoder Global via browser, PAT, or imported credential`,accountTypeQoderCN:`Qoder CN`,accountTypeQoderCNHint:`Qoder China via browser, PAT, or imported credential`,accountTypeWorkBuddyCN:`WorkBuddy CN`,accountTypeWorkBuddyCNHint:`CodeBuddy CN via browser login or imported credential`,accountTypeWorkBuddyGlobal:`WorkBuddy Global`,accountTypeWorkBuddyGlobalHint:`WorkBuddy Global via browser login or imported credential`,accountTypeTraeCN:`Trae CN Solo`,accountTypeTraeCNHint:`Trae China Solo via browser login or imported credential`,accountTypeDevinGlobal:`Devin (experimental)`,accountTypeDevinGlobalHint:`Experimental Devin Global via browser OAuth or session token import`,accountTypeCommandGlobal:`Command Code`,accountTypeCommandGlobalHint:`Command Code via a pasted user_… key. Speaks the CLI /alpha/generate protocol, so every plan works, including the $1 Go plan.`,accountTypeOpenCode:`OpenCode`,accountTypeOpenCodeGo:`OpenCode Go`,accountTypeOpenCodeGoHint:`Experimental. Paste an OpenCode API key. This account calls the Go subscription gateway.`,accountTypeOpenCodeZen:`OpenCode Zen`,accountTypeOpenCodeZenHint:`Experimental. Paste an OpenCode API key. This account calls the Zen pay-as-you-go gateway.`,accountTypeCodexGlobal:`Codex`,accountTypeCodexGlobalHint:`OpenAI Codex via Codex CLI OAuth, Sign in with ChatGPT, or an imported credential`,accountTypeZhipuCN:`Zhipu GLM`,accountTypeZhipuCNHint:`Zhipu GLM with an API key. Choose pay-as-you-go or Coding Plan, the same way the upstream account is billed.`,accountTypeQwenworkGlobal:`QwenWork International`,accountTypeQwenworkGlobalHint:`QwenWork international (qwenwork.ai) via browser OAuth or imported credential. The authorization link is single-use: open it directly in a browser already signed in to the target account, and do not send it through chat tools.`,accountTypeQwenworkCN:`QwenWork CN`,accountTypeQwenworkCNHint:`千问办公 China (qwenwork.cn) via browser OAuth or imported credential. The authorization link is single-use: open it directly in a browser already signed in to the target account, and do not send it through chat tools. The CN region has not yet been verified with a real account.`,accountTypeKimiCN:`Kimi Code CN`,accountTypeKimiCNHint:`Kimi Code China subscription via device-code sign-in against auth.kimi.com. Uses the same OAuth client as the official CLI, so the login you already completed with Kimi Code can be pasted in as its credential JSON.`,accountTypeCodeArtsCN:`CodeArts (码道)`,accountTypeCodeArtsCNHint:`Huawei Cloud CodeArts Agent via OAuth PKCE against codearts.huaweicloud.com. The console opens the authorization page; a pasted 127.0.0.1 callback URL also completes the login when the browser cannot reach this host.`,accountTypeDoubaoworkCN:`Doubao Work (豆包工作)`,accountTypeDoubaoworkCNHint:`Doubao Work subscription via a pasted web-session Cookie. Copy the Cookie from a logged-in doubao.com session in your own browser; the server validates it on import. There is no browser or client auto-login because the gateway runs headless.`,doubaoCookieLead:`Log in to www.doubao.com in your browser, open developer tools → Network, refresh, open any doubao.com request, and copy the full Cookie request header. Paste it below; the account is validated and created immediately.`,doubaoCookieLabel:`Cookie`,doubaoCookiePh:`sessionid=...; sessionid_ss=...`,doubaoCookieRequired:`Paste the Doubao Work Cookie first.`,doubaoImport:`Add Doubao Work account`,doubaoSaveCookie:`Save Cookie`,accountTypeKiroUS:`Kiro (US East)`,accountTypeKiroUSHint:`Personal Kiro login. Paste a Builder ID, Identity Center, or social credential JSON, or a ksk_ key. Chat goes to the Kiro runtime in us-east-1. Experimental.`,accountTypeKiroEU:`Kiro (EU Central)`,accountTypeKiroEUHint:`Personal Kiro login for the eu-central-1 runtime. Same credential shapes as US East. Experimental.`,accountTypeMetaGlobal:`Muse (Meta)`,accountTypeMetaGlobalHint:`Meta Muse Code subscription via device-code sign-in against auth.meta.com. After approval the console mints an LLM API key at api.meta.ai. You can also paste a Meta Model API key on the PAT tab.`,accountTypeMiniMaxCodeCN:`MiniMax Code (CN)`,accountTypeMiniMaxCodeCNHint:`MiniMax Code subscription via its official device-code sign-in. Routes through the CN agent gateway and consumes your MiniMax Code credits.`,accountTypeMiniMaxCodeGlobal:`MiniMax Code (Global)`,accountTypeMiniMaxCodeGlobalHint:`MiniMax Code subscription via its official device-code sign-in. Routes through the global agent gateway and consumes your MiniMax Code credits.`,providerGroupSubscriptions:`Subscriptions`,providerGroupSubscriptionsHint:`stable account logins`,providerGroupExperimental:`Experimental`,providerGroupExperimentalHint:`early adapters`,providerFindPlaceholder:`Find a provider...`,providerFindEmpty:`No providers match this search.`,caiaiSoftLink:`Prefer hosted? Try CaiAI`,addAccountDesc:`Create an isolated account session. Each account keeps its own runtime home.`,tabBrowser:`Browser login`,tabPat:`PAT`,tabImport:`Import credential`,recommended:`Recommended`,wizardSettings:`Account settings`,wizardAdvanced:`Advanced options`,wizardContinue:`Continue`,wizardBack:`Back`,wizardSettingsHint:`Set these before login. You can still change them later from Edit on the account card.`,editAccount:`Edit`,editAccountTitle:`Edit {name}`,editAccountHint:`Change the display name, concurrency, and routing priority. Provider-level settings on the Models page control proxy, aliases, model restrictions, floors, and check-in time.`,accountModelAliases:`Aliases`,accountModelAliasesHint:`A name this provider answers as. The request is rewritten to an account's real model after an account is picked.`,accountModelAliasTargetPlaceholder:`real model on this provider`,modelAliasName:`Alias`,modelAliasTarget:`Real model`,modelAliasAdd:`Add`,modelAliasRemove:`Remove`,modelAliasPlaceholder:`kimi-k3`,enabledModels:`Models`,enabledModelsHint:`Leave unrestricted to serve the whole catalog. Restrict to choose which models this provider may serve.`,restrictModels:`Only selected models`,allModels:`All models`,modelPickerSearch:`Search models`,modelPickerCount:`{selected} / {total} selected`,modelPickerSelectAll:`Select all`,modelPickerClear:`Clear`,modelPickerOffline:`Offline`,modelPickerRemove:`Remove {model}`,modelPickerNoMatch:`No matching models.`,maxInflightInvalid:`Concurrency must be an integer from 1 to 32.`,priorityInvalid:`Priority must be an integer from 1 to 100.`,wizardNamePh:`Account name`,maxInflightHint:`How many chats this account may run at once. Changing it later restarts the worker.`,priorityHint:`Higher numbers are preferred when routing later uses this field. Default 50.`,creditFloor:`Credit floor`,creditFloorHint:`When enabled, paid models are skipped once the sampled credit balance reaches this value; free models still work. Only accounts reporting credits are affected.`,creditFloorCustom:`Override the global floor for this provider`,creditFloorInheritHint:`Inherits CLI2API_CREDIT_FLOOR. Set 0 to explicitly disable the floor for this provider.`,creditFloorInvalid:`Credit floor must be zero or a positive number.`,percentFloor:`Percent floor`,percentFloorHint:`For accounts reporting remaining percentage (Devin, Kimi, Zhipu): skip paid models once remaining percent reaches this value. Independent of the credit floor; free models still work.`,percentFloorCustom:`Override the global percent floor for this provider`,percentFloorInheritHint:`Inherits CLI2API_PERCENT_FLOOR. Set 0 to explicitly disable the floor for this provider.`,percentFloorInvalid:`Percent floor must be a number between 0 and 100.`,proxyUrl:`Proxy URL`,proxyUrlPlaceholder:`http://127.0.0.1:7890, direct`,proxyUrlHint:`Blank inherits the global proxy. Use direct or none to bypass proxies for this provider. Qoder supports HTTP(S) only; WorkBuddy/Trae also support SOCKS5.`,proxySettingsTitle:`Outbound proxy`,proxySettingsHint:`Set the default proxy for upstream requests. Global proxies support HTTP(S) only. SOCKS5 is available for WorkBuddy/Trae provider-level proxies. Provider settings override it.`,dropSystemPromptCreateHint:`WorkBuddy only. Strip caller system prompts, then send an empty leading system slot so Global still accepts the request.`,wizardBrowserLead:`Shows the authorization URL. Open or copy it, finish in the browser, and this wizard continues automatically.`,wizardCodexBrowserLead:`Choose Codex CLI or Sign in with ChatGPT, then open the authorization URL. ChatGPT website logins need Sign in with ChatGPT; the CLI flow cannot refresh those tokens.`,codexLoginMethod:`Codex login`,codexLoginCli:`Codex CLI`,codexLoginCliHint:`Official Codex CLI OAuth. Use this for CLI-issued credentials.`,codexLoginChatGPT:`Sign in with ChatGPT`,codexLoginChatGPTHint:`ChatGPT website login. Stores a separate token that refreshes at a different endpoint.`,kiroLoginMethod:`Kiro sign-in`,kiroLoginBuilder:`Builder ID`,kiroLoginBuilderHint:`Device code. Open the link and approve it; this page finishes on its own.`,kiroLoginIDC:`Identity Center`,kiroLoginIDCHint:`Your organization portal. Paste its start URL, then approve in the browser.`,kiroLoginSSO:`SSO token`,kiroLoginSSOHint:`Paste a portal SSO bearer. It is exchanged once and not stored.`,kiroLoginMicrosoft:`Microsoft`,kiroLoginMicrosoftHint:`Enterprise SSO. Paste each localhost callback as the browser shows it.`,kiroIDCStartURL:`Identity Center start URL`,kiroIDCStartURLPh:`https://example.awsapps.com/start`,startCodexCliLogin:`Start Codex CLI login`,startCodexChatGPTLogin:`Sign in with ChatGPT`,wizardStartBrowser:`Start browser login`,wizardStartingSession:`Starting the account session…`,wizardWaitingBrowser:`Waiting for authorization in the browser…`,wizardCallbackLead:`If the browser stays on 127.0.0.1 and this console never finishes, copy the full address-bar URL here.`,wizardCallbackPh:`Paste the full http://127.0.0.1…/authorize?… URL`,wizardSubmitCallback:`Submit callback URL`,wizardStartingWorker:`Authorization received. Starting account session…`,wizardAccountReady:`Account is ready.`,wizardLoginTimeout:`Timed out waiting for browser login. You can retry from the account card.`,wizardPatLead:`Use a personal access token when the browser flow is inconvenient.`,wizardPatLeadCN:`Create a PAT at qoder.com.cn/account/integrations, then paste it here.`,wizardPatLeadCommand:`Paste your Command Code key (it looks like user_…, from commandcode.ai/settings).`,wizardPatLeadOpenCode:`Paste an OpenCode API key. The account type chooses Go or Zen.`,zhipuApiKey:`API key`,zhipuApiKeyPh:`Paste the key from open.bigmodel.cn`,zhipuAccountMode:`Account mode`,zhipuModePayg:`Pay as you go`,zhipuModePaygHint:`Billed by token. Uses the standard GLM endpoint.`,zhipuModeCoding:`Coding Plan`,zhipuModeCodingHint:`Subscription plan. Uses the Coding Plan endpoint and shows its quota.`,zhipuOrganization:`Organization ID`,zhipuOrganizationPh:`Optional, for a team Coding Plan`,zhipuProject:`Project ID`,zhipuProjectPh:`Optional`,zhipuCreate:`Add Zhipu account`,zhipuKeyRequired:`Paste the Zhipu API key first.`,wizardPatPh:`Paste personal access token`,wizardCreateAndLogin:`Create and sign in`,wizardImportLead:`Paste a credential JSON export. WorkBuddy hub packages import every account in the file.`,wizardImportPh:`Paste credential JSON`,wizardChooseFile:`Choose file`,wizardBadJson:`That does not look like a valid credential bundle.`,reLogin:`Sign in`,cancel:`Cancel`,close:`Close`,create:`Create`,import:`Import`,export:`Export`,enable:`Enable`,disable:`Disable`,disabled:`Disabled`,delete:`Delete`,holdToDelete:`Hold to delete`,trendHalfHint:`Second half of the window vs the first half`,toastRefreshingAccount:`Refreshing account…`,toastAccountRefreshed:`Account refreshed`,toastRefreshingCredits:`Refreshing credits…`,toastCreditsRefreshed:`Credits refreshed`,toastCreditsPartiallyRefreshed:`{failed} of {total} accounts failed to refresh`,toastAccountAdded:`Account added`,toastAccountDeleted:`Account deleted`,toastClearingLogs:`Clearing request logs…`,toastLogsCleared:`Request logs cleared`,toastKeyDeleted:`API key deleted`,toastFailed:`Operation failed`,deleteAccountConfirm:`Delete account {name}? This removes its local runtime and stored credential.`,edit:`Edit`,enabled:`Enabled`,keysCreate:`Create key`,keysEmpty:`No client keys yet`,keysEmptyHint:`Create a named key for OpenAI-compatible clients. It cannot sign in to this console.`,keysCreateTitle:`Create API key`,keysCreateHint:`The secret is shown once. Store it in the client that will call /v1.`,keysEditTitle:`Edit API key`,keysEditHint:`Rename the key, change which providers it may route to, or cap how many chats it may run at once.`,keysName:`Name`,keysNamePh:`CI bot`,keysNameRequired:`Name is required.`,keysProviders:`Providers`,keysProvidersHint:`Restrict this key to specific provider regions. Leave all unchecked to allow every provider.`,keysAllProviders:`All providers`,keysAllRegions:`All regions`,keysProvidersNotLoaded:`Provider list is still loading. Saving is disabled so the key permissions stay unchanged.`,keysProvidersLoadFailed:`Failed to load provider list: {message}`,keysMaxInflight:`Max concurrency`,keysMaxInflightHint:`How many /v1 chats this key may run at once. 0 means no limit. Extra requests get HTTP 429.`,keysMaxInflightInvalid:`Concurrency must be an integer from 0 to 256.`,keysMaxInflightValue:`Up to {count} at once`,keysMaxInflightUnlimited:`No concurrency limit`,keysModelAggregation:`Cross-provider aggregation`,keysModelAggregationHint:`When on, /v1/models lists the enabled models from the cross-provider model pool plus the public aliases this key can reach, merged into one provider-neutral name. Requests still route through the account pool. Provider selection is locked while this stays on.`,keysModelAggregationBadge:`Aggregated`,keysLastUsed:`Last used {time}`,keysNeverUsed:`Not used yet`,keysSecretTitle:`Store this secret now`,keysSecretHint:`This value is not stored in plaintext. It will not be shown again.`,keysSecretOnce:`Copy the key before closing this dialog.`,keysDeleteConfirm:`Delete API key {name}? Clients using it will fail immediately.`,consoleKeyTitle:`Console API key`,consoleKeyHint:`This is the administrator key used to sign in here.`,consoleKeyLead:`It can call every provider and manage accounts, keys, and updates. Client keys live on the API keys page.`,consoleKeyRotate:`Rotate key`,consoleKeyRotateHint:`Rotating signs you out of other sessions and restarts Qoder workers so they pick up the new secret.`,consoleKeyRotateNow:`Rotate now`,consoleKeySecretTitle:`New console key`,consoleKeySecretHint:`This browser session is already updated. Copy the key for any other clients that used the old console secret.`},zh:{brandSub:`登录态网关`,controlPlane:`控制平面`,workspace:`工作区`,develop:`开发`,system:`系统`,runtimeSnapshot:`运行时与调度器快照`,routesHint:`OpenAI / Anthropic 兼容端点`,clientConfig:`客户端配置`,clientConfigHint:`使用与控制台相同的密钥作为 Bearer Token`,providerPrefixHint:`用 qoder/、workbuddy/、trae/、devin/、command/、codex/、zhipu/、qwenwork/、kimi/、codearts/、kiro/、meta/、opencode/ 或 doubaowork/ 前缀指定供应商。客户端 API 密钥也可以限制可见和可调度的供应商。不带前缀时是否跨供应商,由系统设置里的模型池决定。`,authentication:`认证方式`,curlExample:`curl 示例`,quickTestHint:`通过所选账号发送一条真实请求`,response:`响应`,providerCatalog:`模型目录`,providerCatalogMeta:`已登录 / 实时`,checkAllModels:`检查所有模型`,checkingModels:`检查中…`,checkModelsHint:`每个模型对每个可用账号发送一次仅 1 token、关闭思考的真实请求。会真实消耗供应商额度,但不计入用量页统计。`,checkModelsSummary:`{passed} 可通 · {failed} 失败 · {total} 总计 · {elapsed}ms`,checkModelsEmpty:`没有可检查的模型。`,checkResultOK:`可通`,checkResultFailed:`失败`,checkResultSkipped:`跳过`,checkAccountResults:`账号结果`,checkNotRun:`未检查`,checkPassedAccounts:`{passed}/{total} 个账号`,accountPool:`账号池`,accountCreateHint:`先创建隔离运行时,再通过浏览器或 PAT 登录。`,credentialImportHint:`仅支持从本控制台导出、且 user blob 与 machine ID 匹配的凭证包。`,accountEmptyHint:`创建一个账号运行时后即可开始。`,oauthDeviceFlow:`OAuth 浏览器登录`,navOverview:`概览`,navAuth:`账号`,navProviders:`模型`,navModelPool:`调度组`,navAccess:`接入与调试`,navAccounts:`账号`,checkinDefaultsTitle:`自动签到`,checkinDefaultsHint:`按供应商设置默认时间。跟随默认的账号会立即采用新时间,账号自定义时间不受影响。`,checkinDisabledAccountsTitle:`停用账号也自动签到`,checkinDisabledAccountsHint:`开启后,停用聊天功能的账号仍可执行已开启的自动签到;停用账号仍不可手动签到。`,checkinDisabledAccountsStatus:`当前状态`,checkinDisabledAccountsAriaLabel:`允许停用账号自动签到`,checkinInherit:`跟随供应商策略`,checkinDefaultValue:`供应商默认:{time}`,checkinCustom:`账号自定义`,checkinConfigured:`已配置`,checkinScheduleHint:`按下方显示的服务器时钟执行,通常在设定时间后的约 90 秒内开始,多账号顺序处理可能延后;失败或日界未确认的尝试会在约 02:05、12:05 和 21:00 重试。签到不影响聊天。`,checkinTimeInvalid:`请输入有效的签到时间(HH:mm)。`,checkinRecordSkipped:`活动未开放`,checkinStatusPending:`上游显示未签到`,checkinStatusUnknown:`上游状态未知`,checkinUpstreamSynced:`上游同步于 {time}`,checkinServerClock:`服务器时钟 · {timezone}`,checkinServerTime:`服务器时间:{time}`,checkinAutoScheduleHint:`自动排期:上游最早可签到时间 + 1 小时({time});手动设置的时间仍然优先。`,navUsage:`用量`,usageTitle:`用量`,usageByModel:`模型`,usageByAccount:`账号`,usageByProvider:`供应商`,usageColRequests:`请求`,usageColSuccess:`成功率`,usageColTokens:`Tokens`,usageColCacheWrite:`缓存写入`,usageColCredits:`积分`,usageRowCount:`{count} 行`,usageShareOther:`其他`,usageEmpty:`该时间窗口内没有请求。`,usageStatsTab:`统计`,usageCostTab:`额度`,usageWindow:`时间范围`,usageWindow24h:`24 小时`,usageWindow7d:`7 天`,usageWindowTotal:`全部留存`,usageCredits:`已用额度`,usageCreditsHint:`所有 provider 合计消耗的订阅额度`,usageEstCost:`折合费用`,usageTotalTokens:`Token 总量`,usageRequests:`请求数`,usageModelCount:`{count} 个模型`,usageCacheHitRate:`缓存命中`,usageTokenSplitNote:`命中 / 未命中 / 输出`,usageChartTitle:`用量趋势`,usageChartHint:`按模型堆叠。可在额度与 token 之间切换。`,usageChartEmpty:`该时间范围内暂无用量。`,usageBreakdownTitle:`按模型明细`,usageBreakdownHint:`每个模型的 token 与订阅额度。`,usageColInputHit:`输入·缓存命中`,usageColInputMiss:`输入·缓存未命中`,usageColOutput:`输出`,usageColCost:`折合费用`,usageUnpricedCost:`无官方价`,usageColSplit:`高峰 / 闲时`,usageTotals:`合计`,usageRetentionHint:`请求日志按计划清理,因此「全部留存」只覆盖仍在库内的部分。`,usageRenderNote:`可选的 DeepSeek 官方列表价人民币折算。订阅账号并不按此计费——仅供对比。`,usagePeakNote:`高峰按北京时间周一至周五 09:00-12:00、14:00-18:00 估算;闲时为高峰一半。未处理法定节假日及调休。`,usageUnpricedHint:`以下模型没有列表价行,只计入额度与 token:{models}`,usageNoteTitle:`计算说明`,usagePriceTitle:`DeepSeek 官方价格表`,usagePriceHit:`缓存命中`,usagePriceMiss:`缓存未命中`,usagePriceOutput:`输出`,usagePriceBandOff:`闲时`,usagePriceBandPeak:`高峰`,usageOffPeak:`闲时`,usagePeak:`高峰`,usageChartMetric:`图表指标`,usageEstimateTitle:`DeepSeek 官方列表价折算`,usageEstimateHint:`有官方价的模型可查看人民币对比;默认折叠。`,usageEstimateChartTitle:`列表价趋势`,usageEstimateChartEmpty:`该时间范围内暂无 DeepSeek 计价用量。`,chartMetricRequests:`请求`,chartMetricTokens:`Tokens`,chartMetricLatency:`p95 延迟`,chartInput:`输入`,chartOutput:`输出`,chartCacheRead:`缓存读取`,chartTotal:`合计`,navLogs:`日志`,navKeys:`API 密钥`,navSystem:`系统设置`,sidebarFoot:`CLI 登录态网关`,sidebarInFlight:`当前并发 {count}`,systemSettingsTitle:`系统设置`,crossProviderModelPoolTitle:`跨 Provider 模型池`,crossProviderModelPoolHint:`开启后,不带 Provider 前缀的模型 ID 可以在匹配的 Qoder、WorkBuddy 和 Trae 账号之间调度;关闭后 bare ID 会被拒绝,必须使用带 Provider 前缀的模型 ID。`,crossProviderModelPoolStatus:`当前状态`,crossProviderModelPoolAriaLabel:`开启跨 Provider 模型池`,modelPoolTitle:`调度组`,modelPoolCreate:`添加调度组`,modelPoolEdit:`编辑调度组`,modelPoolId:`客户端模型 ID`,modelPoolIdHint:`客户端请求里的 model,例如 my-claude。保存后不能改。`,modelPoolIdLocked:`客户端请求的 model 就是这个,不能改。`,modelPoolName:`名称`,modelPoolNameHint:`只出现在这个控制台的列表里,用来辨认。客户端看不到。`,modelPoolNamePh:`我的 Claude`,modelPoolStrategy:`路由策略`,modelPoolStrategyHint:`优先级顺序:始终使用第一个可用成员(主备)。轮询:均匀分摊请求。优先填满:偏向权重最高的成员。最先过期优先:优先使用额度最快到期的成员。`,modelPoolStrategy_priority:`优先级顺序`,"modelPoolStrategy_round-robin":`轮询`,"modelPoolStrategy_fill-first":`优先填满`,modelPoolStrategy_fefo:`最先过期优先(FEFO)`,"modelPoolStrategy_least-quota-first":`剩余额度最少优先`,"modelPoolStrategy_most-quota-first":`剩余额度最多优先`,modelPoolFailover:`故障转移`,modelPoolMaxAttempts:`最大尝试次数`,modelPoolMaxAttemptsHint:`请求失败前最多尝试的供应商数量(1-64)。`,modelPoolMembers:`供应商模型`,modelPoolMembersHint:`仅可选出已接入的供应商,以及对应供应商设置中启用的模型。账号由供应商账号池自动选择,顺序即优先级。`,modelPoolAddMember:`添加供应商模型`,modelPoolMembersEmpty:`暂无成员,请至少添加一个供应商模型。`,modelPoolMoveUp:`上移`,modelPoolMoveDown:`下移`,modelPoolProvider:`供应商`,modelPoolRegion:`区域`,modelPoolAnyRegion:`不限区域`,modelPoolModel:`模型`,modelPoolWeight:`权重`,modelPoolNoModels:`暂无可用模型`,modelPoolIdRequired:`请填写调度组 ID。`,modelPoolNameRequired:`请填写显示名称。`,modelPoolMembersRequired:`请至少添加一个供应商座位。`,modelPoolMemberIncomplete:`每个座位要选一个供应商和一个模型。`,modelPoolAttemptsInvalid:`最大尝试次数需在 1 到 64 之间。`,modelPoolColName:`模型`,modelPoolColStrategy:`策略`,modelPoolColMembers:`成员`,modelPoolColFailover:`故障转移`,modelPoolColEnabled:`启用`,modelPoolColActions:`操作`,modelPoolFailoverOn:`开启 · {count} 次尝试`,modelPoolFailoverOff:`关闭`,modelPoolEmpty:`还没有调度组`,modelPoolEmptyHint:`添加一组,就会多一个客户端能调用的模型。`,modelPoolDeleteTitle:`删除调度组`,modelPoolDeleteDesc:`确定删除“{name}”?正在使用这个调度组 ID 的客户端将无法调用。`,modelPoolSaved:`已保存`,modelPoolDeleted:`已删除`,modelPoolBack:`全部调度组`,modelPoolEnabled:`启用`,modelPoolIdInvalid:`调度组 ID 只能使用小写字母、数字、- 和 /,最长 128 个字符。`,modelPoolMissing:`这个调度组已经不存在。`,modelPoolEntryTitle:`请求`,modelPoolEntryDetail:`客户端模型 ID`,modelPoolEntryNote:`客户端调用这个 ID 时开始`,modelPoolEntryHint:`一个座位是一个供应商。不选账号就用它的全部账号,也可以勾上多个。从左到右是尝试顺序。`,modelPoolStepProvider:`供应商`,modelPoolStepProviderDetail:`一个供应商`,modelPoolAccounts:`账号`,modelPoolAccountsHint:`不选,或者勾多个,保存都是这个供应商已接入的全部账号。只勾一个,才只走那个账号。`,modelPoolAccountsAll:`全部账号`,modelPoolAccountsAllCount:`全部 {count} 个账号`,modelPoolSeatOrderAll:`供应商顺序`,modelPoolSeatOrderPicked:`勾选顺序`,modelPoolSeatCount:`{count} 个座位`,modelPoolPathCount:`{count} 条路径`,modelPoolAccountsCount:`{count} 个账号`,modelPoolAccountsSearch:`查找账号`,modelPoolAccountsNoMatch:`没有匹配的账号`,modelPoolNoAccounts:`这个供应商还没有接入账号`,modelPoolAccountsDraft:`勾了多个账号时,保存仍是这个供应商的全部账号。只勾一个,才会只记那一个。`,modelPoolClientModel:`客户端传来的模型名`,modelPoolCanvasPalette:`添加座位`,modelPoolCanvasIncomplete:`待设置`,modelPoolCanvasSkip:`跳过`,modelPoolCanvasFit:`适应画布`,modelPoolCanvasZoomIn:`放大`,modelPoolCanvasZoomOut:`缩小`,modelPoolStrategyNode:`策略`,modelPoolStrategyNote:`决定这一排座位的尝试顺序`,modelPoolAddSeat:`添加同级`,modelPoolDragSeat:`拖动换序`,modelPoolRemoveSeat:`移除座位`,modelPoolPathEmpty:`这条路径还没有座位。`,modelPoolStepModel:`模型`,modelPoolStepModelDetail:`一个供应商模型`,modelPoolStepModelNote:`选择供应商和模型`,modelPoolStepGroup:`嵌套调度组`,modelPoolStepGroupDetail:`另一组调度`,modelPoolStepGroupNote:`内层保持自己的顺序`,modelPoolStepIntent:`意图`,modelPoolStepIntentDetail:`最新一条用户消息`,modelPoolStepIntentNote:`关键词,或一次分类调用`,modelPoolPathMatch:`匹配`,modelPoolPathDefault:`默认`,modelPoolPathLabel:`路径名称`,modelPoolAddPath:`添加路径`,modelPoolRemovePath:`移除路径`,modelPoolKeywords:`关键词`,modelPoolKeywordsHint:`用逗号分隔。最新一条用户消息里任意一个关键词命中(忽略大小写)即走这条路径。`,modelPoolIntentLabel:`分类标签`,modelPoolIntentHint:`与分类模型的回复比较。路径名称同样可以命中。`,modelPoolPathFallback:`默认路径`,modelPoolClassifier:`分类模型`,modelPoolClassifierOff:`只用关键词`,modelPoolClassifierHint:`可选。路由前做一次非流式调用,并且必须是具体模型。`,modelPoolNestedPool:`调度组`,modelPoolNestedPoolPick:`选择调度组`,modelPoolNestedPoolEmpty:`还没有其他调度组`,modelPoolGroupRequired:`请选择一个嵌套调度组。`,modelPoolSelfGroup:`调度组不能嵌套自己。`,modelPoolClassifierIncomplete:`分类模型需要同时选择供应商和模型。`,modelPoolPreview:`试一句消息`,modelPoolPreviewHint:`按当前草稿显示路径和尝试顺序。草稿里有分类模型时会调用它一次。`,modelPoolPreviewPh:`帮我规划上线步骤`,modelPoolPreviewRun:`预览`,modelPoolPreviewPath:`路径`,modelPoolNoReady:`没有就绪账号`,modelPoolWeightHint:`优先填满时使用。换成其他策略后,已保存的权重仍会保留。`,modelPoolWeightNote:`权重 {weight}`,modelPoolCapabilities:`对外声明的能力`,modelPoolCapabilitiesHint:`填 0 表示按成员推导。这些字段不参与路由。`,modelPoolContextLength:`上下文窗口`,modelPoolContextLengthHint:`0,或至少 1024。`,modelPoolMaxOutput:`最大输出`,modelPoolMaxOutputHint:`0,或至少 1024,且不能大于上下文窗口。`,modelPoolReasoningLevels:`思考档位`,modelPoolReasoningLevelsHint:`留空则使用所有成员共同支持的档位。`,modelPoolReasoningSelected:`已选 {n}/{total} 档`,modelPoolReasoningSelectAll:`全选`,modelPoolReasoningClear:`清空`,modelPoolReasoningEmpty:`未选择档位:对外只声明所有成员共有的档位。`,modelPoolReasoningDefault:`默认思考强度`,modelPoolReasoningDefaultHint:`客户端没有携带思考意图时使用。`,modelPoolReasoningAuto:`按成员推导`,modelPoolCapabilitiesInvalid:`上下文和最大输出必须为 0,或介于 1024 和 4000000 之间,且最大输出不能大于上下文窗口。`,modelPoolReasoningInvalid:`默认思考强度必须是已选档位之一。`,keysAggregationMode:`模型聚合模式`,keysAggregationModeHint:`开启后此密钥只能调用聚合逻辑模型,下方的供应商选择将被忽略。`,workbuddyCheckinSettingsTitle:`WorkBuddy 签到`,workbuddyCheckinSettingsHint:`新建 WorkBuddy 账号时使用的默认首次签到时间。已有账号会保留各自的时间,直到你单独修改。`,workbuddyCheckinSettingsFieldHint:`使用服务器本地时间。新建 WorkBuddy 账号会继承这里的时间,账号编辑页仍可单独覆盖。`,routingStrategyTitle:`账号调度策略`,routingStrategyHint:`选择就绪账号如何分担流量。填满优先会持续使用最高优先级账号,直到它不可用。最早到期优先只在同一供应商内部按最近的积分包到期日排序。剩余额度最少/最多优先按剩余百分比排序;额度未知的账号排最后。`,routingStrategy:`策略`,routingRoundRobin:`轮询`,routingWeightedRoundRobin:`加权轮询`,routingFillFirst:`填满优先`,routingFEFO:`最早到期优先(FEFO)`,routingLeastQuotaFirst:`剩余额度最少优先`,routingMostQuotaFirst:`剩余额度最多优先`,routingWeight:`调度权重`,sessionAffinityTTL:`会话 TTL`,sessionAffinityHits:`粘性命中`,sessionAffinityMisses:`粘性未命中`,sessionAffinityEscapes:`粘性逃逸`,lastSessionMiss:`最近未命中`,lastSessionEscape:`最近逃逸`,checkUpdates:`检查更新`,versionUpdate:`版本更新`,latestVersionHint:`先下载最新版本,准备好后再点立即更新。`,updateAvailable:`有可用更新`,settingsTabGeneral:`常规`,settingsTabRouting:`路由调度`,settingsTabSecurity:`安全与数据`,settingsTabUpdates:`版本更新`,sidebarNewVersion:`新版本 {version}`,sidebarReleaseNotes:`更新日志`,sidebarGoToUpdate:`历史版本与回滚`,upToDate:`已是最新版本`,currentVersion:`当前版本`,latestVersion:`最新版本`,skippedBetweenLabel:`中间经过的版本`,releaseNotes:`更新内容`,updateNoNotes:`这个版本还没有说明。`,versionHistory:`历史版本`,versionCurrentBadge:`当前`,versionLatestBadge:`最新`,restoreThisVersion:`恢复此版本`,restoreVersionTitle:`恢复到 {version}?`,restoreVersionHint:`服务会切回这个版本。只有重启时才会暂停新请求。`,updaterReady:`这台机器可以更新`,updaterUnavailable:`这台机器暂时不能更新`,updaterNeedsHost:`当前进程不能替换自己的容器`,updaterUnavailableHint:`这一页可以检查新版本,但还不能在这台机器上安装更新。`,updaterNeedInstall:`用 deploy/install-updater.sh 或 deploy/install-updater.ps1 安装宿主机更新器,让它能调用 Docker。`,updaterNeedCompose:`Linux 需要把更新器 socket 挂进容器。Docker Desktop 用本机回环地址,而不是 Unix socket。`,updaterNeedRelease:`当前运行的必须是已发布的 GitHub Release,不能是本地或开发镜像。`,updateNow:`下载更新`,applyUpdateNow:`立即更新`,cancelUpdate:`取消下载`,discardPreparedImage:`放弃这次更新`,updateReadyHint:`更新已经下载好。点立即更新才会重启;在此之前不会暂停新请求。`,updateReadyTargetHint:`可以切换到 {version}。只有重启时才会暂停新请求。`,updateNewerReleaseHint:`又有更新的版本({latest})。可以先立即更新,或放弃这次下载后重新开始。`,updateStagedUnavailableHint:`请先更新宿主机更新器,才能使用分阶段更新。`,updateLegacyOneShotHint:`这台机器会一次下载并完成更新。之后的版本可以先下载,再点立即更新。`,rollbackToVersion:`恢复旧版本`,rollbackToVersionHint:`可以恢复到当前版本之前最近的三个版本。`,updateReloadingIn:`{seconds}s 后刷新`,updateInProgress:`更新中…`,updatePreparingImage:`正在下载更新…`,updatePreparingImageHint:`正在后台下载更新。当前版本会继续运行,下载完成后点立即更新才会切换。下载卡住时可以取消。`,updateApplyingHint:`正在安装更新。完成后会自动刷新这个页面。`,updateInProgressHint:`系统正在更新,准备就绪后会自动刷新页面。`,updateUnavailableHint:`暂时无法更新,请稍后重试。`,updateFailedHint:`更新未完成,请重试。`,updateCheckFailedHint:`暂时无法检查更新,请稍后重试。`,updatePreparingHint:`正在准备更新:检查版本并保存备份。现有连接可能会被中断,客户端可自行重试。`,updateRunningHint:`正在更新。完成后会自动刷新这个页面。`,updateReloadingHint:`更新完成,正在刷新页面…`,updateElapsed:`已用时 {seconds}s`,sqliteProtection:`SQLite 保护`,sqliteProtectionHint:`数据会留在原处,并在更新前创建经过校验的备份。`,sqliteBackupBeforeUpdate:`更新前创建并校验备份`,sqliteKeepFive:`保留最近 5 份备份`,sqliteRollbackTogether:`失败时同时恢复数据库和上一版本`,updateStatus:`更新状态`,noUpdateJob:`暂无更新任务`,confirmUpdate:`立即更新`,confirmUpdateHint:`系统会短暂停止接收新请求并保存备份。现有连接可能会被中断,客户端可自行重试。`,updateState_idle:`空闲`,updateState_unavailable:`不可用`,updateState_queued:`等待开始`,updateState_preparing:`准备中`,updateState_preparing_image:`正在下载更新`,updateState_checking:`正在检查版本`,updateState_backing_up:`正在保存备份`,updateState_submitting:`正在开始更新`,updateState_running:`正在更新`,updateState_pulling:`正在下载更新`,updateState_host_binary:`正在下载更新程序`,updateState_image_ready:`下载完成`,updateState_ready_to_apply:`可以立即更新`,updateState_recreating:`正在重启`,updateState_health_checking:`正在确认启动`,updateState_rolling_back:`正在恢复上一版本`,updateState_succeeded:`更新完成`,updateState_rolled_back:`已恢复上一版本`,updateState_failed:`更新失败`,checking:`检查中`,refresh:`刷新`,apiKey:`API Key`,apiKeyPh:`API Key`,needApiKey:`先用控制台密码登录才能加载数据。`,loginTitle:`进入控制台`,loginLead:`这台机器上的 CLI2API 代理已经在运行。请输入客户端访问 /v1 时使用的 API Key。`,loginDesc:`和接口 Authorization: Bearer 是同一把钥匙。`,loginFormTitle:`继续`,loginPassword:`控制台密码`,loginPasswordPh:`API Key`,loginNeedKey:`密码是空的。`,loginBadKey:`这把钥匙对不上这台机器。`,loginSubmit:`进入`,loggingInConsole:`核对中…`,loginHint:`只解锁本机控制台。账号登录在进入后的「账号」页。`,showPassword:`显示密码`,hidePassword:`隐藏密码`,signOut:`退出`,checkingSession:`正在检查登录态…`,refreshing:`刷新中`,pages:{home:{title:`概览`,desc:`查看运行状态、请求量与可用端点。`},auth:{title:`授权`,desc:`浏览器 device-flow 登录、PAT 登录,以及会话 rewarm。`},providers:{title:`模型`,desc:`已登录账号可用的模型,以及每个模型的上下文和推理默认值。`},modelPool:{title:`调度组`,desc:`一组对应客户端里的一个模型。`},access:{title:`接入与调试`,desc:`主区多轮对话试玩;下方可展开原始 API 调试。`},accounts:{title:`账号`,desc:`一个账号一个登录态。先走浏览器登录;浏览器不方便再用 PAT。`},usage:{title:`用量`,desc:`按模型、账号与供应商统计用量。`},logs:{title:`日志`,desc:`查看近期代理请求和进程输出。`},keys:{title:`API 密钥`,desc:`创建客户端密钥,并限制可用的供应商和并发。`},system:{title:`系统设置`,desc:`管理跨 Provider 路由、系统更新、SQLite 保护和控制台管理员密钥。`},login:{title:`进入控制台`,desc:`和 /v1 使用同一把 API Key。`}},logsRequests:`请求历史`,logsRuntime:`运行日志`,logsEmptyRequests:`还没有请求记录。`,logsEmptyRuntime:`还没有捕获到运行输出。`,logsSearchRuntime:`搜索运行输出…`,logsSearchRequestId:`搜索请求 ID`,logsSearchModel:`搜索模型`,logsSearchAccount:`搜索账号`,logsFilterIdAll:`全部请求 ID`,logsNoFilterOptions:`没有匹配项`,logsClear:`清空历史`,logsClearConfirm:`删除本机全部请求历史?`,logsColTime:`时间`,logsColAccount:`账号`,logsColApiKey:`密钥`,logsColProvider:`供应商`,logsColModel:`模型`,logsColReasoning:`推理`,logsColStatus:`状态`,logsColLatency:`延迟`,logsColTTFT:`首字`,logsLatencyTotal:`总耗时`,logsOutputTPS:`输出 TPS`,logsColTokens:`Tokens`,logsTokensIn:`输入`,logsTokensOut:`输出`,logsTokensPoints:`{value} 点`,logsColStream:`模式`,logsStreamYes:`流式`,logsStreamNo:`同步`,logsFilterAll:`全部`,logsFilterOk:`成功`,logsFilterIncomplete:`未完成`,logsFilterError:`失败`,logsFilterCanceled:`取消`,logsFilterAccountAll:`全部账号`,logsFilterApiKeyAll:`全部密钥`,logsSearchApiKey:`搜索密钥`,logsFilterProviderAll:`全部供应商`,logsFilterModelAll:`全部模型`,logsFilterKindAll:`全部错误`,logsFilterStreamAll:`全部模式`,logsTimeRange:`时间`,logsTimeAll:`全部时间`,logsTime1h:`1 小时`,logsTime24h:`24 小时`,logsTime7d:`7 天`,logsTimeCustom:`自定义`,logsTimeFrom:`开始`,logsTimeTo:`结束`,logsKindQuota:`额度`,logsKindRateLimit:`限流`,logsKindAuth:`鉴权`,logsKindNotReady:`未就绪`,logsKindUnavailable:`不可用`,logsKindInvalidRequest:`非法请求`,logsKindModelNotAvailable:`模型不可用`,logsPageSize:`每页`,logsPage:`第 {page} / {pages} 页`,logsPrevPage:`上一页`,logsNextPage:`下一页`,logsNoMatch:`没有符合当前筛选的请求。`,logsLevelAll:`全部`,logsLevelInfo:`信息`,logsLevelWarn:`警告`,logsLevelError:`错误`,logsAttempts:`尝试记录`,logsRouting:`路由方式`,logsRouting_pool:`常规池`,logsRouting_pin:`显式指定`,logsRouting_sticky:`会话粘性`,logsRouting_sticky_escape:`粘性逃逸`,logsNoAttempts:`没有尝试详情。`,logsStreamDiagnostics:`流诊断`,logsMessageShape:`消息结构`,logsMessageCount:`消息数`,logsEmptyMessageIndexes:`空内容下标`,logsMessageRoles:`角色顺序`,logsCancellationSource:`取消来源`,logsUpstreamStatus:`上游状态`,logsSSEEvents:`SSE 事件数`,logsBytesRead:`读取字节数`,logsLastEvent:`最后事件`,logsStreamComplete:`已收到 [DONE]`,logsUsageDetail:`本次消耗`,logsCreditConsumed:`消耗点数`,logsDetailTitle:`请求详情`,logsSectionCall:`调用信息`,logsSectionDiagnostics:`诊断`,logsRuntimeDetailTitle:`运行日志详情`,logsRuntimeLevel:`级别`,logsRuntimeSource:`来源`,logsRuntimeMessage:`日志内容`,logsShownTotal:`{shown} / {total}`,logsAutoRefresh:`实时`,failedLogs:`加载日志失败:{msg}`,homeEyebrow:`运行时`,metricRequests:`请求`,metricSuccess:`成功率`,metricLatency:`p95`,metricTokens:`Tokens`,statsWindow1h:`1小时`,statsWindow24h:`24小时`,statsWindow7d:`7天`,statsWindow30d:`30天`,statsWindowCustom:`自定义`,statsWindowToday:`今天`,statsRefreshPause:`暂停自动刷新`,statsRefreshResume:`恢复自动刷新`,statsRefreshAuto:`每 30 秒刷新 · 点击暂停`,statsRefreshPaused:`自动刷新已暂停 · 点击恢复`,statsDragHint:`拖选时间段查看日志`,statsWindowHint:`{window}窗口`,statsTraffic:`流量`,statsTrafficHint:`所选时间窗口内的已完成聊天请求`,statsEmptyTraffic:`这个时间窗口还没有请求。`,statsLatencyP50:`p50`,statsLatencyP95:`p95`,statsLatencyAvg:`平均`,statsTTFB:`TTFB`,statsPool:`账号池`,statsPoolHint:`就绪 worker 与剩余额度`,statsCooling:`冷却中`,statsCoolingChip:`{count} 冷却`,statsPoolReadyEmpty:`暂无就绪 worker — 可展开上方冷却或前往账号页。`,statsTopModels:`热门模型`,statsTopAccounts:`热门账号`,statsTopProviders:`供应商`,statsTopProvidersHint:`按账号类型统计请求量`,statsNoProviders:`还没有供应商流量。`,statsErrorMix:`错误构成`,statsStatusMix:`结果与错误`,statsStatusMixHint:`请求状态、失败类型与热门账号`,statsCoolingDetails:`冷却中 · 原因 · 剩余 · 退避`,statsBackoffLevel:`重启退避等级`,statsAffinityHit:`会话亲和命中`,statsAffinityHint:`命中 {hits} · 未命中 {misses} · 绑定 {bindings}`,metricCacheHit:`缓存命中率`,metricCacheHitDetail:`缓存 {read} / 输入 {prompt}`,metricStreaming:`流式占比`,metricStreamingDetail:`{total} 次请求中 {count} 次`,metricCanceled:`已取消`,metricCanceledDetail:`占请求 {rate}`,statsErrorMixHint:`该窗口内已分类的失败`,statsNoModels:`还没有模型流量。`,statsNoAccounts:`还没有账号流量。`,statsNoErrors:`没有分类错误。`,statsUnknown:`未知`,statsUnassigned:`未分配`,resTitle:`资源占用`,resHint:`主机进程内存与 CPU`,resServer:`主进程`,resWorkers:`Worker`,resEmpty:`还没有 worker 进程。`,resGoroutines:`个协程`,resCpuLifetime:`生命周期均值`,failedStats:`加载统计失败:{msg}`,homeNote:`已登录本机控制台。账号登录在「账号」页。`,metricRuntime:`运行状态`,metricAccounts:`账号`,metricModels:`模型`,metricAuth:`登录态`,metricPort:`端口`,serviceDetail:`服务详情`,endpoints:`可用端点`,copyBaseUrl:`复制 Base URL`,copied:`已复制`,copy:`复制`,open:`打开`,waitingOverview:`等待概览数据…`,signIn:`登录`,connectQoder:`连接账号`,rewarm:`Rewarm`,rewarming:`Rewarm 中`,refreshAccount:`刷新`,refreshingAccount:`刷新中`,stepBrowserTitle:`浏览器 Device Flow`,stepBrowserDesc:`打开账号选择页。浏览器完成授权后,本页会轮询直到会话就绪。`,startBrowserLogin:`用浏览器登录`,starting:`启动中…`,quotaLoading:`额度获取中…`,quotaUnavailable:`额度不可用`,authUrl:`授权链接`,openAuthUrl:`打开链接`,stepPatTitle:`个人访问令牌`,stepPatDesc:`浏览器流程不方便时,可用 PAT 作为备选。`,pat:`PAT`,pasteToken:`粘贴 token`,loginWithPat:`使用 PAT 登录`,loggingIn:`登录中…`,localState:`本地状态`,raw:`原始数据`,noAuthSnapshot:`暂无授权快照。`,catalog:`目录`,availableModels:`可用模型`,modelsPulled:`来源`,filter:`筛选`,filterPh:`glm / qwen / deepseek`,providerFilterAll:`全部供应商`,accountStatusFilter:`账号状态`,connection:`连接信息`,apiPlaygroundHint:`选择账号与模型。顶部切换「聊天 / 原始 API」;原始 API 含 JSON 与 curl。`,readyAccounts:`{ready} / {total} 个账号就绪`,baseUrl:`Base URL`,externalClients:`外部客户端`,protocol:`协议`,quickTest:`快速测试`,requestBuilder:`请求编排`,responseInspector:`响应检查`,responseInspectorHint:`本地代理返回的原始 JSON`,requestIdle:`等待请求`,requestComplete:`请求完成`,requestFailed:`请求失败`,responseReceived:`已收到响应`,responseEmptyTitle:`还没有响应`,responseEmptyHint:`选择路由、填写提示词并发送请求,原始响应会显示在这里。`,sendRequest:`发送请求`,promptPlaceholder:`输入要发送给模型的内容`,promptHelper:`测试请求使用非流式 Chat Completions。`,accessTabChat:`聊天`,accessTabApi:`原始 API`,accessTabsLabel:`接入方式`,chatTryEmptyTitle:`还没有回复`,chatTryEmptyHint:`在下方输入消息。账号与模型在输入框底栏。离开页面后会话清空。`,chatTryHelper:`Enter 发送 · Shift+Enter 换行`,chatTrySend:`发送`,chatTryStop:`停止`,chatTryStreaming:`生成中…`,chatTryUserLabel:`你`,chatTryAssistantLabel:`助手`,chatTryCreditsUsed:`消耗 {amount} credits`,chatTryUsageTokens:`{prompt} → {completion}`,chatTryUsageFoot:`{tokens} · {amount} credits`,chatHistoryTitle:`历史`,chatHistoryNew:`新对话`,chatHistoryEmpty:`还没有对话`,chatHistoryUntitled:`未命名`,chatHistoryExpand:`展开历史`,chatHistoryCollapse:`收起历史`,nativeApiHint:`非流式请求、原始 JSON 响应,以及对应的 curl 命令。`,rawFormatLabel:`API 格式`,rawFormatChat:`Chat`,rawFormatMessages:`Messages`,rawFormatResponses:`Responses`,rawFormatHint:`支持 Chat Completions、Anthropic Messages 与 OpenAI Responses 三种格式。`,rawApiShow:`展开原始 API`,rawApiHide:`收起原始 API`,chatAttach:`添加附件`,chatAttachRemove:`移除附件`,chatAttachUnsupported:`不支持的文件类型:{names}`,thinkingPhaseScan:`检索中`,thinkingPhasePlan:`规划中`,thinkingPhaseDraft:`起草中`,thinkingDone:`已思考`,thinkingElapsed:`{n}s`,toolCallGroup:`用了 {n} 个工具`,chatDemoLoad:`预览样例`,thinkingChars:`{count} 字`,thinkingWorking:`思考中`,toolCallRunning:`进行中`,toolCallSuccess:`完成`,toolCallError:`失败`,toolCallUntitled:`工具`,toolCallArgs:`参数`,toolCallArgsEmpty:`(空)`,autoAccountHint:`由调度器选择一个可用账号。`,fixedAccountHint:`本次请求固定发送到所选账号。`,modelRoutingHint:`使用当前代理暴露的公开模型 ID。`,accountModelHint:`只列出该账号当前能提供的模型。钉死账号后,目录里没有的 ID 会请求失败。`,noAccountModels:`这个账号目前没有可发送的模型。`,accountModels:`可用模型`,accountModelsTitle:`{name} 的模型`,accountModelsHint:`该账号的实时目录。钉到此账号的请求只会使用这些 ID。`,accountModelsEmpty:`这个账号还没有公布模型目录。`,accountModelsError:`无法加载模型:{msg}`,noAccountsForTest:`暂无可用账号运行时,请先添加账号并完成登录。`,curlGeneratedHint:`根据当前账号、模型和提示词实时生成`,prompt:`提示词`,model:`模型`,send:`发送`,waitingRequest:`等待请求…`,requesting:`请求中…`,endpointOpenAI:`OpenAI 兼容`,endpointChat:`Chat Completions`,endpointBaseHint:`在 OpenAI 兼容客户端中,将此地址作为 Base URL。`,endpointChatHint:`OpenAI 兼容对话。模型 ID 加前缀即可指定供应商,例如 qoder/glm-5.2。`,endpointMessages:`Anthropic Messages`,endpointMessagesHint:`无状态 Anthropic Messages。使用带供应商前缀的模型 ID 即可钉死一家。`,endpointResponses:`OpenAI Responses`,endpointResponsesHint:`无状态 OpenAI Responses。使用带供应商前缀的模型 ID 即可钉死一家。`,endpointModels:`模型列表`,endpointModelsHint:`公开模型 ID。客户端 API 密钥只会看到其允许供应商的模型。`,endpointHealth:`健康检查`,endpointHealthHint:`检查本地代理是否正在响应。`,endpointCount:`{count} 个 API 端点`,endpointReady:`当前可用`,endpointBaseLabel:`客户端 Base URL`,endpointAuthLabel:`Bearer API Key`,hasUserBlob:`已有 user blob`,userBlobBytes:`user blob 大小`,machineId:`Machine ID`,sessionHot:`会话热状态`,upstreamEndpoint:`上游端点`,rewarmCount:`Rewarm 次数`,proxy:`Proxy`,endpoint:`端点`,lastError:`最近错误`,running:`运行中`,down:`离线`,hot:`热就绪`,up:`在线`,ready:`就绪`,missing:`缺失`,degraded:`降级`,error:`错误`,yes:`是`,no:`否`,modelCol:`模型`,mappedKeyCol:`上游 Key`,requestIdCol:`请求 ID`,providerCol:`供应商`,qoderKeyCol:`上游 Key`,routedTo:`上游模型 {model}`,stateCol:`状态`,contextWindowCol:`最大上下文窗口`,modelDefaultsCol:`上下文与推理`,providerSettingsTitle:`供应商设置`,providerSettingsOpen:`设置`,providerExpand:`展开供应商`,providerCollapse:`折叠供应商`,providerSettingsHint:`对该供应商和区域下的所有账号生效。积分/百分比保底、代理、系统提示词处理、别名、可用模型和签到时间统一由供应商策略管理;账号名、并发和优先级仍由账号自己管理。`,providerSettingsSaved:`供应商设置已保存。匹配账号直接读取该策略,不再改写账号数据。`,providerSettingsLoadFailed:`无法加载供应商设置,请刷新页面后重试。`,providerSettingsRegionMissing:`这个供应商分组还没有确定区域,请刷新模型目录后重试。`,providerSettingsSavedRefreshFailed:`设置已保存,但模型列表刷新失败:{message}`,providerModelsEmpty:`至少选择一个模型,或关闭模型限制。`,upstreamMaxContext:`上游最大上下文`,imageInput:`图片输入`,imageInputDeclared:`上游已声明支持`,imageInputNotDeclared:`上游未声明`,imageInputUnsupported:`上游未声明支持`,qoderContextHint:`请求没写上下文长度时使用的默认窗口。`,contextInvalid:`上下文窗口必须是 1,024 到 4,000,000 之间的整数。`,contextSaved:`已保存 {model} 的上下文窗口。`,contextReset:`已恢复 {model} 的默认上下文窗口。`,contextMaxOn:`已开启 {model} 的更大上下文。`,contextMaxOff:`已关闭 {model} 的更大上下文。`,contextMaxUnavailable:`这个模型没有更大上下文开关。`,maxMode:`更大上下文`,maxModeHint:`Trae 的更大上下文窗口,常见是 200k 提到 1M,不是套餐也不是额度。只在请求没带 is_max_mode 时使用;请求里写了仍以请求为准。模型不支持时不会发送这个开关。`,qoderMaxModeHint:`Qoder 的更大上下文窗口,不是套餐也不是额度。开启时请求使用该模型的最大窗口;关闭时(或请求自带上下文窗口时)使用默认窗口。`,catalogWindow:`目录默认窗口`,catalogWindowHint:`这个 Trae 模型没有更大上下文开关,数字是目录里的默认窗口。`,workbuddyContextHint:`WorkBuddy 桌面端目录里的默认窗口和可选窗口,用于本地压缩预算,不是 Trae 的 is_max_mode。聊天请求不会发送窗口开关。`,reasoningLevels:`推理强度`,reasoningHint:`请求没指定推理强度时使用的默认档位。选了不会强制每次都走这一档,也不会限制客户端改用其他允许档位。不在列表里的值会回退到可用档位,而不是锁死。`,reasoningFixed:`固定思考:{type}`,noReasoningLevels:`这个模型没有可选的推理档位。`,reasoningSaved:`已保存 {model} 的默认推理强度:{level}。`,reasoningLevel_none:`关闭`,reasoningLevel_low:`低`,reasoningLevel_medium:`中`,reasoningLevel_high:`高`,reasoningLevel_xhigh:`极高`,reasoningLevel_max:`最强推理`,modelDetails:`详情`,modelDetailsCol:`模型详情`,promptMaxTokens:`输入上限`,maxOutputTokens:`输出上限`,actions:`操作`,save:`保存`,custom:`自定义`,defaultValue:`默认`,resetDefault:`恢复默认`,fallback:`回退`,modelFree:`免费`,shownTotal:`显示 {shown} / 共 {total}`,noModelsYet:`暂无模型`,noModelsMatch:`没有匹配的模型。`,noProviders:`尚未加载供应商。`,failedOverview:`概览加载失败:{msg}`,pastePatFirst:`请先粘贴 PAT`,patDone:`PAT 登录完成`,loginOpenMsg:`请在浏览器打开授权链接完成登录`,idle:`空闲`,menu:`菜单`,toggleSidebar:`收起侧栏`,accountsTitle:`账号`,accountsDesc:`一个账号一个登录态。Chat 会 round-robin,失败切下一个。`,noAccounts:`还没有账号,添加一个即可开始服务。`,accountCount:`账号`,signedIn:`已登录`,enabledAccounts:`已启用`,availableAccounts:`可用`,needsAttention:`需处理`,searchAccounts:`搜索名称、账号 ID、UID、提供方或认证类型`,filterAll:`全部`,shownAccounts:`{shown} / {total}`,noAccountsMatch:`没有符合当前条件的账号。`,clearFilters:`清除筛选`,more:`更多操作`,partialCooling:`部分模型冷却`,modelCooldowns:`模型冷却`,modelCooldownsTitle:`冷却中的模型`,modelCooldownsEmpty:`当前没有模型在冷却。`,runtimeState:`运行状态`,maxInflight:`最大并发`,priority:`优先级`,updatedAt:`更新于`,enabledState:`已启用`,cooling:`冷却中`,dead:`恢复中`,authFailed:`登录失败`,patFallback:`PAT 备选`,usePat:`用 PAT`,account:`账号`,autoAccount:`自动(轮询)`,cooldown:`冷却`,inFlight:`进行中`,liveConcurrency:`当前并发`,liveRpm:`近 60 秒`,liveRpmUnit:`次`,liveRpmHint:`最近一分钟发起`,liveTrace:`走势`,livePeak:`峰值 {n}`,liveSaturated:`已满载`,inflightTitle:`实时进行中`,inflightMockBadge:`示意`,inflightIdleBadge:`空闲`,inflightMockToggle:`示意`,inflightMockToggleAria:`无实时数据时显示示意动画`,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:`冷却`,inflightNow:`现在`,inflightAgo:`前`,inflightMore:`还有`,inflightKindModel:`模型调用`,inflightKindTool:`工具调用`,inflightKindEmbed:`向量`,inflightKindOther:`其他`,inflightPriority:`优先级`,inflightAttempt:`尝试`,inflightPosition:`位置`,inflightWaited:`已等`,inflightHigh:`高`,inflightLow:`低`,inflightNormal:`普通`,inflightPositionValue:`{n} / {total}`,inflightClose:`关闭详情`,inflightAttemptValue:`{n} / {max}`,inflightAnnounceFailed:`{name} 失败`,inflightAnnounceFailedDetail:`{name} 失败:{error}`,inflightAnnounceRetry:`{name} 失败,正在重试,第 {attempt} 次`,inflightAnnounceLimited:`触发限流,工人暂停 {seconds} 秒`,inflightAnnounceResumed:`限流结束,工人继续`,inflightAnnouncePressure:`{n} 个任务在等待,超过背压线 {line}`,restarts:`重启次数`,dropSystemPrompt:`丢弃系统提示词`,dropSystemPromptHint:`发送前剥离调用方的系统提示词;仍会补一条空的 system,避免国际版要求第一条必须是系统提示词`,dropSystemPromptTraeHint:`默认保留调用方系统提示词。MiMo Code 等客户端会把 JSON 指令放在那里;仅在 Trae 因此拒请求时再打开。`,autoCheckin:`每日签到`,autoCheckinHint:`按账号配置的本地时间自动领取 WorkBuddy 积分;失败会在约 21:00 重试。默认关闭。`,autoCheckinCreateHint:`仅 WorkBuddy。开启后按该账号的签到时间自动领取积分;未改时间时使用系统默认。`,autoCheckinTime:`签到时间`,checkinAutoMode:`自动(上游窗口 + 1 小时)`,checkinAutoFallbackHint:`上方是供应商兜底时间;首次上游同步后,每个账号会在自己的卡片上保存实际时间。`,autoCheckinTimeHint:`使用服务器本地时间,并在所选时间后的约 14 分钟内执行;首次失败会在约 21:00 重试。新建账号自动继承此供应商策略。`,checkinNow:`立即签到`,quotaWindowsExpand:`展开其余 {count} 条额度`,quotaWindowsCollapse:`收起额外额度`,claimStudentCredit:`领取每月学生福利`,studentCreditClaimed:`每月学生福利领取成功`,studentCreditAlready:`每月学生福利已领取`,studentCreditFailed:`每月学生福利领取失败`,studentCreditUnavailable:`每月学生福利暂不可领取`,checkinAll:`一键签到`,checkinAllEmpty:`没有已启用且支持签到的账号`,checkinAllDone:`{count} 个账号今天都已签到`,toastCheckingInAll:`正在签到 {done}/{total}…`,toastCheckedInAll:`已签到 {checked} 个,跳过 {skipped} 个`,toastCheckedInAllFailed:`已签到 {checked} 个,跳过 {skipped} 个,失败 {failed} 个`,lastCheckin:`最近签到`,lastCheckinNone:`还没有签到记录`,checkinStatus:`签到`,checkinDaily:`每日`,regionCN:`国内版`,regionGlobal:`国际版`,checkinToday:`今日已签到`,checkinPending:`今日未签到`,checkinFailed:`签到异常`,checkinRecords:`签到记录`,checkinRecordsTitle:`签到记录 · {name}`,checkinRecordsHint:`显示该账号最近 20 次签到结果。`,checkinRecordsEmpty:`还没有签到记录`,checkinRecordsCount:`{count} 条记录`,checkinRecordSuccess:`成功`,checkinRecordAlready:`已签到`,checkinRecordFailed:`失败`,checkinRewardSuffix:` · +{credits} 积分`,checkinTruncated:`信息已截断 · 点复制查看完整错误`,checkinCopyError:`复制完整错误`,refreshCredits:`刷新积分`,expiryDistTitle:`积分到期分布`,expiryDistHint:`按自然日聚合 · 颜色区分账号 · FEFO:上游按失效时刻先后优先扣减`,expiryDistExpand:`展开全部 {n} 天`,expiryDistCollapse:`收起`,expiryDistDayTotal:`到期 {n} 积分`,expiryDistColAccount:`账号`,expiryDistColSoonest:`最近到期`,expiryDistColDaysLeft:`距到期`,expiryDistColBatch:`该日到期`,expiryDistColDaily:`日均需耗`,expiryDistDays:`{n} 天`,expiryDistFoot:`「日均需耗」= 最近到期那天的积分 ÷ 距该日天数,即到期前需要消耗的速度。`,expiryDistExpired:`已过期`,usageColModel:`模型`,quota:`额度`,quotaUsed:`已用`,quotaRemaining:`剩余`,quotaDaily:`日额度`,quotaWeekly:`周额度`,quotaMonthly:`月额度`,quotaFiveHour:`5 小时额度`,quotaWeeklyLimit:`周额度`,quotaPlan:`订阅`,quotaPeriodEndDate:`套餐周期截止日 {date}`,quotaExpiringSoonCredits:`7 天内到期 {amount} 积分`,quotaMonthlyLimit:`月额度`,quotaUsedPercent:`{n}%`,quotaResetsSoon:`即将重置`,quotaResetsInMinutes:`{n} 分钟后重置`,quotaResetsInHours:`{n} 小时后重置`,quotaExpiresOn:`{amount}{unit} 将于 {date} 到期`,quotaAddOn:`附加包`,quotaResourcePackage:`资源包`,quotaExceeded:`额度已用尽`,quotaOverageWindow:`超额`,overageTitle:`超额调用`,overagePull:`从 AWS 拉取`,overageEnabled:`已开启(额度耗尽后按超额单价继续计费)`,overageDisabled:`已关闭(额度耗尽即停止)`,overageUnknown:`未知(请从 AWS 拉取)`,overageNotCapable:`该订阅当前不支持超额调用`,overageReadOnly:`这个登录没有 AWS profile,不能修改开关。`,overageHint:`开关会调用 AWS,立即在 Kiro 侧打开或关闭超额调用。`,overageFigures:`上限 {cap} · 单价 {rate} · 已产生 {current}`,toastOveragePulled:`已从 AWS 更新超额状态`,toastOverageOn:`已开启超额调用`,toastOverageOff:`已关闭超额调用`,errorKind:`错误类型`,qoderLoginHint:`这里登录的是该账号的上游登录态,不会改控制台密码。`,needQoderLogin:`需要账号登录`,waitingQoderLogin:`等待账号登录完成…`,qoderLoginDone:`账号登录完成`,rewarmDone:`Rewarm 完成`,accountsSigned:`{n} / {total} 个账号就绪`,addAccount:`添加账号`,exportAll:`导出全部账号`,importAll:`导入全部账号`,bundleExportHint:`请妥善保管此文件——其中包含登录凭证。`,toastAccountsExporting:`正在准备账号导出…`,toastAccountsExported:`已将 {n} 个账号导出到文件。`,batchImport:`批量导入`,batchImportLoading:`正在导入 WorkBuddy 账号…`,batchImportUnrecognized:`无法识别此凭证文件格式。`,batchImportConfirmTitle:`确认批量导入`,batchImportConfirmHint:`已从 {file} 识别。请核对后再导入。`,batchImportConfirmHintNoFile:`请核对识别结果,确认后再导入。`,batchImportRegion:`WorkBuddy 区`,batchImportRegionPickHint:`未能明确识别区,请先选择国内版或国际版。`,batchImportRegionMixed:`此包同时含国内与国际域名。请拆分后导入,或强制选择一个区。`,batchImportRegionUnknown:`未从域名识别出区,请确认。`,batchImportUnknownFormat:`未知 format 字段,已按形状猜测。`,batchImportProviderUnsupported:`该供应商暂不支持批量导入。识别结果已保留,便于后续扩展。`,batchImportConfirmAction:`导入`,batchImportFormatUnknown:`未知格式`,batchImportProviderUnknown:`未知供应商`,bundleImportConfirmTitle:`导入全部账号?`,bundleImportConfirmHint:`来自 {file}。将恢复文件中保存的账号。`,bundleImportConfirmHintNoFile:`将恢复所选文件中保存的账号。`,bundleImportConfirmAction:`全部导入`,bundleImportAccountCount:`个账号(此文件中)`,bundleImportCountDetail:`其中 {credentials} 个包含已保存的登录凭证。`,bundleImportAdditiveHint:`导入会创建新账号并分配新 ID,不会修改已有账号。`,bundleImportLoading:`正在导入账号…`,bundleImportUnrecognized:`这不是有效的全量账号导出文件。`,accountName:`账号名称`,accountNameRequired:`请输入账号名称。`,accountCreated:`账号已创建,会话正在启动。`,importCredential:`导入原生凭证`,accountImported:`凭证已导入,运行时已启动。`,accountImportBatch:`已导入 {n} 个账号。`,accountImportPartial:`成功 {ok},失败 {fail}。`,credentialCopied:`凭证包已复制。`,addAccountTitle:`添加账号`,accountType:`账号类型`,loginMethod:`登录方式`,accountTypeHint:`选择这个隔离运行时使用的上游登录类型。`,accountTypeQoderGlobal:`Qoder 国际版`,accountTypeQoderGlobalHint:`Qoder 国际版:浏览器、PAT 或导入凭证`,accountTypeQoderCN:`Qoder 国内版`,accountTypeQoderCNHint:`Qoder 中国大陆版:浏览器、PAT 或导入凭证`,accountTypeWorkBuddyCN:`WorkBuddy 国内版`,accountTypeWorkBuddyCNHint:`CodeBuddy 国内版:浏览器登录或导入凭证`,accountTypeWorkBuddyGlobal:`WorkBuddy 国际版`,accountTypeWorkBuddyGlobalHint:`WorkBuddy 国际版:浏览器登录或导入凭证`,accountTypeTraeCN:`Trae 国内版(Solo)`,accountTypeTraeCNHint:`Trae 国内 Solo:浏览器登录或导入凭证`,accountTypeDevinGlobal:`Devin(实验性)`,accountTypeDevinGlobalHint:`实验性 Devin 国际版:浏览器 OAuth 或导入 session token`,accountTypeCommandGlobal:`Command Code`,accountTypeCommandGlobalHint:`粘贴 user_… 密钥接入。走 CLI 的 /alpha/generate 协议,所有档位均可用(含 $1 Go 套餐)。`,accountTypeOpenCode:`OpenCode`,accountTypeOpenCodeGo:`OpenCode Go`,accountTypeOpenCodeGoHint:`实验性。粘贴 OpenCode API Key。此账号走 Go 订阅网关。`,accountTypeOpenCodeZen:`OpenCode Zen`,accountTypeOpenCodeZenHint:`实验性。粘贴 OpenCode API Key。此账号走 Zen 按量网关。`,accountTypeCodexGlobal:`Codex`,accountTypeCodexGlobalHint:`OpenAI Codex:Codex CLI OAuth、Sign in with ChatGPT,或导入凭证`,accountTypeZhipuCN:`智谱 GLM`,accountTypeZhipuCNHint:`填写智谱 API Key。按量付费或 Coding Plan 与上游账号的计费方式一致。`,accountTypeQwenworkGlobal:`QwenWork 国际版`,accountTypeQwenworkGlobalHint:`QwenWork 国际版(qwenwork.ai),浏览器授权或导入凭证。授权链接只能使用一次:请在已登录目标账号的浏览器窗口里直接打开,不要经聊天工具发送。`,accountTypeQwenworkCN:`千问办公 国内版`,accountTypeQwenworkCNHint:`千问办公国内版(qwenwork.cn),浏览器授权或导入凭证。授权链接只能使用一次:请在已登录目标账号的浏览器窗口里直接打开,不要经聊天工具发送。国内版尚未经真实账号验收。`,accountTypeKimiCN:`Kimi Code 国内版`,accountTypeKimiCNHint:`Kimi Code 中国区订阅,走 auth.kimi.com 的设备码授权,与官方 CLI 使用同一个 OAuth 客户端。已在本机登录 Kimi Code 的,可直接粘贴它的凭证 JSON 导入。`,accountTypeCodeArtsCN:`CodeArts(码道)`,accountTypeCodeArtsCNHint:`华为云码道,走 codearts.huaweicloud.com 的 OAuth PKCE 授权。控制台打开授权页;浏览器回不到本机时,也可以粘贴 127.0.0.1 回调地址完成登录。`,accountTypeDoubaoworkCN:`豆包工作(Doubao Work)`,accountTypeDoubaoworkCNHint:`豆包工作订阅,通过粘贴网页会话 Cookie 接入。在你自己的浏览器登录 www.doubao.com 后复制 Cookie,服务端在导入时验证。网关跑在无头环境,没有浏览器或客户端自动登录。`,doubaoCookieLead:`在你自己的浏览器登录 www.doubao.com,打开开发者工具 → Network,刷新页面,点开任意 doubao.com 请求,复制完整的 Cookie 请求头粘贴到下面。导入时会即时校验并创建账号。`,doubaoCookieLabel:`Cookie`,doubaoCookiePh:`sessionid=...; sessionid_ss=...`,doubaoCookieRequired:`请先粘贴豆包工作的 Cookie。`,doubaoImport:`添加豆包工作账号`,doubaoSaveCookie:`保存 Cookie`,accountTypeKiroUS:`Kiro(美东)`,accountTypeKiroUSHint:`个人 Kiro 登录。粘贴 Builder ID、Identity Center 或社交登录的凭证 JSON,也可以粘贴 ksk_ 密钥。聊天走 us-east-1 的 Kiro 运行时。实验性接入。`,accountTypeKiroEU:`Kiro(欧洲中部)`,accountTypeKiroEUHint:`个人 Kiro 登录,走 eu-central-1 运行时。凭证格式与美东相同。实验性接入。`,accountTypeMetaGlobal:`Muse (Meta)`,accountTypeMetaGlobalHint:`Meta Muse Code 订阅,走 auth.meta.com 的设备码授权;批准后控制台会在 api.meta.ai 兑换 LLM API Key。也可在 PAT 页粘贴 Meta Model API Key。`,accountTypeMiniMaxCodeCN:`MiniMax Code(国内)`,accountTypeMiniMaxCodeCNHint:`通过 MiniMax Code 官方设备码登录,走国内 agent 网关,消耗你的 MiniMax Code 额度。`,accountTypeMiniMaxCodeGlobal:`MiniMax Code(国际)`,accountTypeMiniMaxCodeGlobalHint:`通过 MiniMax Code 官方设备码登录,走国际 agent 网关,消耗你的 MiniMax Code 额度。`,providerGroupSubscriptions:`稳定订阅`,providerGroupSubscriptionsHint:`稳定的账号登录源`,providerGroupExperimental:`实验性`,providerGroupExperimentalHint:`早期适配器`,providerFindPlaceholder:`查找登录源...`,providerFindEmpty:`没有符合搜索的登录源。`,caiaiSoftLink:`不想自托管?用托管 Gateway → CaiAI`,addAccountDesc:`创建一个隔离会话并登录。每个账号使用独立的运行时目录。`,tabBrowser:`浏览器登录`,tabPat:`PAT`,tabImport:`导入凭证`,recommended:`推荐`,wizardSettings:`账号设置`,wizardAdvanced:`高级选项`,wizardContinue:`继续`,wizardBack:`返回`,wizardSettingsHint:`登录前先设好这些选项,之后仍可在账号卡片上点编辑修改。`,editAccount:`编辑`,editAccountTitle:`编辑 {name}`,editAccountHint:`修改显示名称、并发和调度优先级。代理、别名、可用模型、保底和签到时间等供应商级设置已移到模型页的供应商分组。`,accountModelAliases:`别名`,accountModelAliasesHint:`这个供应商对外应答的名字。选中账号后,请求会换成该账号自己的真实模型。`,accountModelAliasTargetPlaceholder:`这个供应商上的真实模型`,modelAliasName:`外号`,modelAliasTarget:`真实模型`,modelAliasAdd:`添加`,modelAliasRemove:`移除`,modelAliasPlaceholder:`kimi-k3`,enabledModels:`可用模型`,enabledModelsHint:`不限制时使用整个目录。限制后,这个供应商只接选中的模型。`,restrictModels:`仅选中`,allModels:`全部模型`,modelPickerSearch:`搜索模型`,modelPickerCount:`已选 {selected} / 共 {total}`,modelPickerSelectAll:`全选`,modelPickerClear:`清空`,modelPickerOffline:`已下线`,modelPickerRemove:`移除 {model}`,modelPickerNoMatch:`没有匹配的模型。`,maxInflightInvalid:`并发必须是 1 到 32 之间的整数。`,priorityInvalid:`优先级必须是 1 到 100 之间的整数。`,wizardNamePh:`账号名称`,maxInflightHint:`这个账号同时能跑多少条对话。之后改并发会重启该账号的 worker。`,priorityHint:`数字越大,之后调度会越优先选这个账号。默认 50。`,creditFloor:`积分保底`,creditFloorHint:`开启后,采样到的积分余额降到该值时跳过计费模型,免费模型仍可用;只影响以积分为单位上报余额的账号。`,creditFloorCustom:`为该供应商覆盖全局阈值`,creditFloorInheritHint:`继承 CLI2API_CREDIT_FLOOR;填 0 表示显式关闭该供应商的保底。`,creditFloorInvalid:`积分保底必须是不小于 0 的数字。`,percentFloor:`百分比保底`,percentFloorHint:`对以剩余百分比上报余额的账号(Devin、Kimi、智谱):剩余百分比降到该值时跳过计费模型;与积分保底互不影响,免费模型仍可用。`,percentFloorCustom:`为该供应商覆盖全局百分比阈值`,percentFloorInheritHint:`继承 CLI2API_PERCENT_FLOOR;填 0 表示显式关闭该供应商的保底。`,percentFloorInvalid:`百分比保底必须是 0 到 100 之间的数字。`,proxyUrl:`代理地址`,proxyUrlPlaceholder:`http://127.0.0.1:7890、direct`,proxyUrlHint:`留空继承全局代理;填写 direct 或 none 可让此供应商直连。Qoder 仅支持 HTTP(S),WorkBuddy/Trae 额外支持 SOCKS5。`,proxySettingsTitle:`统一代理出口`,proxySettingsHint:`设置所有上游请求的默认代理;全局代理支持 HTTP(S),SOCKS5 仅支持 WorkBuddy/Trae 的供应商级代理;供应商设置优先于全局代理。`,dropSystemPromptCreateHint:`仅 WorkBuddy。剥离调用方系统提示词后仍补一条空的 system,避免国际版拒绝请求。`,wizardBrowserLead:`会展示授权地址。打开或复制后在浏览器完成授权,向导会自动继续。`,wizardCodexBrowserLead:`先选 Codex CLI 或 Sign in with ChatGPT,再打开授权地址。ChatGPT 网页登录必须走后者,CLI 流刷新不了那种 token。`,codexLoginMethod:`Codex 登录方式`,codexLoginCli:`Codex CLI`,codexLoginCliHint:`官方 Codex CLI OAuth,适合 CLI 签发的凭证。`,codexLoginChatGPT:`Sign in with ChatGPT`,codexLoginChatGPTHint:`ChatGPT 网页登录。凭证单独存储,刷新走另一套 token 端点。`,kiroLoginMethod:`Kiro 登录方式`,kiroLoginBuilder:`Builder ID`,kiroLoginBuilderHint:`设备码。打开链接并确认,这个页面会自己完成。`,kiroLoginIDC:`Identity Center`,kiroLoginIDCHint:`组织门户。先粘贴 start URL,再在浏览器里确认。`,kiroLoginSSO:`SSO 令牌`,kiroLoginSSOHint:`粘贴门户的 SSO bearer。只用来换凭证,不会保存。`,kiroLoginMicrosoft:`Microsoft`,kiroLoginMicrosoftHint:`企业 SSO。浏览器每次跳到 localhost 时,把回调地址粘过来。`,kiroIDCStartURL:`Identity Center start URL`,kiroIDCStartURLPh:`https://example.awsapps.com/start`,startCodexCliLogin:`开始 Codex CLI 登录`,startCodexChatGPTLogin:`Sign in with ChatGPT`,wizardStartBrowser:`开始浏览器登录`,wizardStartingSession:`正在启动账号会话…`,wizardWaitingBrowser:`正在等待浏览器完成授权…`,wizardCallbackLead:`如果浏览器停在 127.0.0.1,而控制台一直没有完成,把地址栏完整 URL 粘贴到这里。`,wizardCallbackPh:`粘贴完整的 http://127.0.0.1…/authorize?… 地址`,wizardSubmitCallback:`提交回调地址`,wizardStartingWorker:`已收到授权,正在启动账号会话…`,wizardAccountReady:`账号已就绪。`,wizardLoginTimeout:`等待浏览器登录超时,可在账号卡片重试。`,wizardPatLead:`浏览器流程不方便时,可用个人访问令牌登录。`,wizardPatLeadCN:`在 qoder.com.cn/account/integrations 创建 PAT,然后粘贴到这里。`,wizardPatLeadCommand:`粘贴你的 Command Code 密钥(形如 user_…,来自 commandcode.ai/settings)。`,wizardPatLeadOpenCode:`粘贴 OpenCode API Key。账号类型决定走 Go 还是 Zen。`,zhipuApiKey:`API Key`,zhipuApiKeyPh:`粘贴 open.bigmodel.cn 的密钥`,zhipuAccountMode:`账号类型`,zhipuModePayg:`按量付费`,zhipuModePaygHint:`按 token 计费,走标准 GLM 端点。`,zhipuModeCoding:`Coding Plan`,zhipuModeCodingHint:`编程套餐。走 Coding Plan 端点,并显示套餐额度。`,zhipuOrganization:`组织 ID`,zhipuOrganizationPh:`可选,团队版 Coding Plan 才需要`,zhipuProject:`项目 ID`,zhipuProjectPh:`可选`,zhipuCreate:`添加智谱账号`,zhipuKeyRequired:`请先粘贴智谱 API Key。`,wizardPatPh:`粘贴个人访问令牌`,wizardCreateAndLogin:`创建并登录`,wizardImportLead:`粘贴凭证 JSON。WorkBuddy hub 导出包会一次性导入其中全部账号。`,wizardImportPh:`粘贴凭证 JSON`,wizardChooseFile:`选择文件`,wizardBadJson:`这看起来不是有效的凭证包。`,reLogin:`登录`,cancel:`取消`,close:`关闭`,create:`创建`,import:`导入`,export:`导出`,enable:`启用`,disable:`停用`,disabled:`已停用`,delete:`删除`,holdToDelete:`按住删除`,trendHalfHint:`所选时间窗口后半段对比前半段`,toastRefreshingAccount:`正在刷新账号…`,toastAccountRefreshed:`账号已刷新`,toastRefreshingCredits:`正在刷新积分…`,toastCreditsRefreshed:`积分已刷新`,toastCreditsPartiallyRefreshed:`{total} 个账号中有 {failed} 个刷新失败`,toastAccountAdded:`账号已添加`,toastAccountDeleted:`账号已删除`,toastClearingLogs:`正在清空请求日志…`,toastLogsCleared:`请求日志已清空`,toastKeyDeleted:`API Key 已删除`,toastFailed:`操作失败`,deleteAccountConfirm:`确定删除账号 {name} 吗?这会移除它的本地运行时和已保存凭据。`,edit:`编辑`,enabled:`已启用`,keysCreate:`创建密钥`,keysEmpty:`还没有客户端密钥`,keysEmptyHint:`为 OpenAI 兼容客户端创建命名密钥。它不能登录这个控制台。`,keysCreateTitle:`创建 API 密钥`,keysCreateHint:`明文密钥只显示一次,请保存在会调用 /v1 的客户端里。`,keysEditTitle:`编辑 API 密钥`,keysEditHint:`可以改名称、限制它能调度到哪些供应商,或限制它同时能跑多少条对话。`,keysName:`名称`,keysNamePh:`CI 机器人`,keysNameRequired:`请填写名称。`,keysProviders:`供应商`,keysProvidersHint:`可将 Key 限制到特定供应商区域(如国内版 / 国际版)。全部不勾选表示允许所有供应商。`,keysAllProviders:`全部供应商`,keysAllRegions:`全区域`,keysProvidersNotLoaded:`供应商列表仍在加载中。已禁用保存,以保证 Key 权限不会被意外更改。`,keysProvidersLoadFailed:`供应商列表加载失败:{message}`,keysMaxInflight:`最大并发`,keysMaxInflightHint:`这把密钥同时能跑多少条 /v1 对话。0 表示不限制。超出的请求返回 HTTP 429。`,keysMaxInflightInvalid:`并发必须是 0 到 256 之间的整数。`,keysMaxInflightValue:`同时最多 {count} 条`,keysMaxInflightUnlimited:`不限制并发`,keysModelAggregation:`跨供应商模型聚合`,keysModelAggregationHint:`开启后,/v1/models 返回模型池里已启用的跨供应商聚合模型,以及这把密钥可访问账号上配置的公共别名,并按名称合并成一条、不显示供应商;请求仍按账号池路由。开启期间供应商选项锁定。`,keysModelAggregationBadge:`聚合`,keysLastUsed:`最近使用 {time}`,keysNeverUsed:`尚未使用`,keysSecretTitle:`请立刻保存这把密钥`,keysSecretHint:`服务端只存哈希,关闭后无法再查看明文。`,keysSecretOnce:`关闭弹窗前请先复制。`,keysDeleteConfirm:`确定删除 API 密钥 {name} 吗?正在使用它的客户端会立刻失败。`,consoleKeyTitle:`控制台 API 密钥`,consoleKeyHint:`这是登录本控制台的管理员密钥。`,consoleKeyLead:`它可以调用全部供应商,并管理账号、密钥和更新。客户端密钥在「API 密钥」页。`,consoleKeyRotate:`轮换密钥`,consoleKeyRotateHint:`轮换后其他会话会失效,并重启 Qoder worker 以使用新密钥。`,consoleKeyRotateNow:`立即轮换`,consoleKeySecretTitle:`新的控制台密钥`,consoleKeySecretHint:`当前浏览器会话已更新。如果还有客户端在用旧的控制台密钥,请把新值复制过去。`}};function dr(e,t,n={}){let r=$[e]||$.en,i=$.en,a=r[t];return a??=i[t],typeof a==`string`?a.replace(/\{(\w+)\}/g,(e,t)=>n[t]==null?`{${t}}`:String(n[t])):t}function fr(e,t){return(($[e]||$.en).pages||$.en.pages)[t]||{title:t,desc:``}}var pr=(0,I.createContext)(null);function mr({children:e}){let[t,n]=(0,I.useState)(()=>localStorage.getItem(`cli2api_lang`)===`en`?`en`:`zh`),r=(0,I.useMemo)(()=>({lang:t,setLang:e=>{let t=e===`en`?`en`:`zh`;localStorage.setItem(`cli2api_lang`,t),document.documentElement.lang=t===`zh`?`zh-CN`:`en`,n(t)},t:(e,n)=>dr(t,e,n),page:e=>fr(t,e)}),[t]);return(0,H.jsx)(pr.Provider,{value:r,children:e})}function hr(){let e=(0,I.useContext)(pr);if(!e)throw Error(`useI18n must be used within I18nProvider`);return e}export{Te as $,wt as A,je as B,Lt as C,At as D,jt as E,Ke as F,Ve as G,Pe as H,We as I,ze as J,He as K,Fe as L,ft as M,ut as N,Dt as O,Ge as P,we as Q,Re as R,Z as S,Nt as T,Me as U,Ne as V,Be as W,De as X,Le as Y,Oe as Z,Wt as _,ar as a,z as at,It as b,tr as c,pe as ct,dn as d,se as dt,be as et,ln as f,ce as ft,sn as g,rn as h,or as i,he as it,vt as j,Ot as k,er as l,R as lt,Jt as m,hr as n,B as nt,ir as o,me as ot,nn as p,L as pt,Ie as q,ur as r,_e as rt,rr as s,de as st,mr as t,xe as tt,$n as u,le as ut,zt as v,Pt as w,Ft as x,Rt as y,Ue as z}; \ No newline at end of file diff --git a/internal/webui/static/assets/useSpinButton-B6uyFe9J.js b/internal/webui/static/assets/useSpinButton-BHwCEdGb.js similarity index 99% rename from internal/webui/static/assets/useSpinButton-B6uyFe9J.js rename to internal/webui/static/assets/useSpinButton-BHwCEdGb.js index 6309f8008..8345c65d5 100644 --- a/internal/webui/static/assets/useSpinButton-B6uyFe9J.js +++ b/internal/webui/static/assets/useSpinButton-BHwCEdGb.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{$ as n,Q as r,k as i}from"./useI18n-XrvNxGvP.js";import{K as a,W as o,x as s}from"./SharedElementTransition-BlCsXfb1.js";var c=new Map,l=!1;try{l=new Intl.NumberFormat(`de-DE`,{signDisplay:`exceptZero`}).resolvedOptions().signDisplay===`exceptZero`}catch{}var u=!1;try{u=new Intl.NumberFormat(`de-DE`,{style:`unit`,unit:`degree`}).resolvedOptions().style===`unit`}catch{}var d={degree:{narrow:{default:`°`,"ja-JP":` 度`,"zh-TW":`度`,"sl-SI":` °`}}},f=class{constructor(e,t={}){this.numberFormatter=p(e,t),this.options=t}format(e){let t=``;if(t=!l&&this.options.signDisplay!=null?m(this.numberFormatter,this.options.signDisplay,e):this.numberFormatter.format(e),this.options.style===`unit`&&!u){let{unit:e,unitDisplay:n=`short`,locale:r}=this.resolvedOptions();if(!e)return t;let i=d[e]?.[n];t+=i[r]||i.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange==`function`)return this.numberFormatter.formatRange(e,t);if(t= start date`);return`${this.format(e)} \u{2013} ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts==`function`)return this.numberFormatter.formatRangeToParts(e,t);if(t= start date`);let n=this.numberFormatter.formatToParts(e),r=this.numberFormatter.formatToParts(t);return[...n.map(e=>({...e,source:`startRange`})),{type:`literal`,value:` – `,source:`shared`},...r.map(e=>({...e,source:`endRange`}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!l&&this.options.signDisplay!=null&&(e={...e,signDisplay:this.options.signDisplay}),!u&&this.options.style===`unit`&&(e={...e,style:`unit`,unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}};function p(e,t={}){let{numberingSystem:n}=t;if(n&&e.includes(`-nu-`)&&(e.includes(`-u-`)||(e+=`-u-`),e+=`-nu-${n}`),t.style===`unit`&&!u){let{unit:e,unitDisplay:n=`short`}=t;if(!e)throw Error(`unit option must be provided with style: "unit"`);if(!d[e]?.[n])throw Error(`Unsupported unit ${e} with unitDisplay = ${n}`);t={...t,style:`decimal`}}let r=e+(t?Object.entries(t).sort((e,t)=>e[0]0||Object.is(n,0):t===`exceptZero`&&(Object.is(n,-0)||Object.is(n,0)?n=Math.abs(n):r=n>0),r){let t=e.format(-n),r=e.format(n),i=t.replace(r,``).replace(/\u200e|\u061C/,``);return[...i].length!==1&&console.warn(`@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case`),t.replace(r,`!!!`).replace(i,`+`).replace(`!!!`,r)}return e.format(n)}}var h=RegExp(`^.*\\(.*\\).*$`),g=[`latn`,`arab`,`hanidec`,`deva`,`beng`,`fullwide`],_=class{constructor(e,t={}){this.locale=e,this.options=t}parse(e){return y(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,t,n){return y(this.locale,this.options,e).isValidPartialNumber(e,t,n)}getNumberingSystem(e){return y(this.locale,this.options,e).options.numberingSystem}},v=new Map;function y(e,t,n){let r=b(e,t);if(!e.includes(`-nu-`)&&!r.isValidPartialNumber(n)){for(let i of g)if(i!==r.options.numberingSystem){let r=b(e+(e.includes(`-u-`)?`-nu-`:`-u-nu-`)+i,t);if(r.isValidPartialNumber(n))return r}}return r}function b(e,t){let n=e+(t?Object.entries(t).sort((e,t)=>e[0]18||(this.options.maximumFractionDigits??0)>18)&&console.warn(`NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.`)}parse(e){let t=this.formatter.resolvedOptions().useGrouping,n=this.sanitize(e);if(!t&&this.symbols.group&&n.includes(this.symbols.group))return NaN;if(this.symbols.group&&(n=n.replaceAll(this.symbols.group,``)),this.symbols.decimal&&(n=n.replace(this.symbols.decimal,`.`)),this.symbols.minusSign&&(n=n.replace(this.symbols.minusSign,`-`)),n=n.replace(this.symbols.numeral,this.symbols.index),this.options.style===`percent`){let e=n.indexOf(`-`);n=n.replace(`-`,``),n=n.replace(`+`,``);let t=n.indexOf(`.`);t===-1&&(t=n.length),n=n.replace(`.`,``),n=t-2==0?`0.${n}`:t-2==-1?`0.0${n}`:t-2==-2?`0.00`:`${n.slice(0,t-2)}.${n.slice(t-2)}`,e>-1&&(n=`-${n}`)}let r=n?+n:NaN;if(isNaN(r))return NaN;if(this.options.style===`percent`){let e={...this.options,style:`decimal`,minimumFractionDigits:Math.min((this.options.minimumFractionDigits??0)+2,20),maximumFractionDigits:Math.min((this.options.maximumFractionDigits??0)+2,20)};return new _(this.locale,e).parse(new f(this.locale,e).format(r))}return this.options.currencySign===`accounting`&&h.test(e)&&(r=-1*r),r}sanitize(e){let t=this.formatter.resolvedOptions().useGrouping;return this.symbols.noNumeralUnits.length>0&&this.symbols.noNumeralUnits.find(t=>t.unit===e)?this.symbols.noNumeralUnits.find(t=>t.unit===e).value.toString():(e=e.replace(this.symbols.literals,``),this.symbols.minusSign&&(e=e.replace(`-`,this.symbols.minusSign)),this.options.numberingSystem===`arab`&&(this.symbols.decimal&&(e=w(e,`,`,this.symbols.decimal),e=w(e,`،`,this.symbols.decimal)),this.symbols.group&&t&&(e=w(e,`.`,this.symbols.group))),this.symbols.group===`’`&&e.includes(`'`)&&t&&(e=w(e,`'`,this.symbols.group)),this.symbols.group===`'`&&e.includes(`’`)&&t&&(e=w(e,`’`,this.symbols.group)),this.options.locale===`fr-FR`&&this.symbols.group&&t&&(e=w(e,` `,this.symbols.group),e=w(e,/\u00A0/g,this.symbols.group)),e)}isValidPartialNumber(e,t=-1/0,n=1/0){let r=this.formatter.resolvedOptions().useGrouping;return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&t<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&n>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&r&&(e=w(e,this.symbols.group,``)),e=e.replace(this.symbols.numeral,``),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,``)),e.length===0)}},x=new Set([`decimal`,`fraction`,`integer`,`minusSign`,`plusSign`,`group`]),S=[0,4,2,1,11,20,3,7,100,21,.1,1.1];function C(e,t,n,r){let i=new Intl.NumberFormat(e,{...n,minimumSignificantDigits:1,maximumSignificantDigits:21,roundingIncrement:1,roundingPriority:`auto`,roundingMode:`halfExpand`,useGrouping:!0}),a=i.formatToParts(-10000.111),o=i.formatToParts(10000.111),s=S.map(e=>i.formatToParts(e)),c=s.map((e,t)=>{let n=e.find(e=>e.type===`unit`);return n&&!e.some(e=>e.type===`integer`||e.type===`fraction`)?{unit:n.value,value:S[t]}:null}).filter(e=>!!e),l=a.find(e=>e.type===`minusSign`)?.value??`-`,u=o.find(e=>e.type===`plusSign`)?.value;!u&&(r?.signDisplay===`exceptZero`||r?.signDisplay===`always`)&&(u=`+`);let d=new Intl.NumberFormat(e,{...n,minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(.001).find(e=>e.type===`decimal`)?.value,f=a.find(e=>e.type===`group`)?.value,p=a.filter(e=>!x.has(e.type)).map(e=>T(e.value)),m=s.flatMap(e=>e.filter(e=>!x.has(e.type)).map(e=>T(e.value))),h=[...new Set([...p,...m])].sort((e,t)=>t.length-e.length),g=h.length===0?RegExp(`\\p{White_Space}|\\p{Cf}`,`gu`):RegExp(`${h.join(`|`)}|\\p{White_Space}|\\p{Cf}`,`gu`),_=[...new Intl.NumberFormat(n.locale,{useGrouping:!1}).format(9876543210)].reverse(),v=new Map(_.map((e,t)=>[e,t])),y=RegExp(`[${_.join(``)}]`,`g`);return{minusSign:l,plusSign:u,decimal:d,group:f,literals:g,numeral:y,numerals:_,index:e=>String(v.get(e)),noNumeralUnits:c}}function w(e,t,n){return e.replaceAll?e.replaceAll(t,n):e.split(t).join(n)}function T(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var E={};E={Empty:`فارغ`};var D={};D={Empty:`Изпразни`};var O={};O={Empty:`Prázdné`};var k={};k={Empty:`Tom`};var A={};A={Empty:`Leer`};var j={};j={Empty:`Άδειο`};var M={};M={Empty:`Empty`};var N={};N={Empty:`Vacío`};var P={};P={Empty:`Tühjenda`};var F={};F={Empty:`Tyhjä`};var I={};I={Empty:`Vide`};var L={};L={Empty:`ריק`};var R={};R={Empty:`Prazno`};var z={};z={Empty:`Üres`};var B={};B={Empty:`Vuoto`};var V={};V={Empty:`空`};var H={};H={Empty:`비어 있음`};var U={};U={Empty:`Tuščias`};var te={};te={Empty:`Tukšs`};var W={};W={Empty:`Tom`};var G={};G={Empty:`Leeg`};var K={};K={Empty:`Pusty`};var q={};q={Empty:`Vazio`};var J={};J={Empty:`Vazio`};var Y={};Y={Empty:`Gol`};var X={};X={Empty:`Не заполнено`};var Z={};Z={Empty:`Prázdne`};var ne={};ne={Empty:`Prazen`};var re={};re={Empty:`Prazno`};var ie={};ie={Empty:`Tomt`};var ae={};ae={Empty:`Boş`};var oe={};oe={Empty:`Пусто`};var se={};se={Empty:`空`};var ce={};ce={Empty:`空白`};var Q={};Q={"ar-AE":E,"bg-BG":D,"cs-CZ":O,"da-DK":k,"de-DE":A,"el-GR":j,"en-US":M,"es-ES":N,"et-EE":P,"fi-FI":F,"fr-FR":I,"he-IL":L,"hr-HR":R,"hu-HU":z,"it-IT":B,"ja-JP":V,"ko-KR":H,"lt-LT":U,"lv-LV":te,"nb-NO":W,"nl-NL":G,"pl-PL":K,"pt-BR":q,"pt-PT":J,"ro-RO":Y,"ru-RU":X,"sk-SK":Z,"sl-SI":ne,"sr-SP":re,"sv-SE":ie,"tr-TR":ae,"uk-UA":oe,"zh-CN":se,"zh-TW":ce};var $=t(e(),1);function le(e){return e&&e.__esModule?e.default:e}var ue=()=>{};function de(e){let t=(0,$.useRef)(void 0),{value:c,textValue:l,minValue:u,maxValue:d,isDisabled:f,isReadOnly:p,isRequired:m,onIncrement:h,onIncrementPage:g,onDecrement:_,onDecrementPage:v,onDecrementToMin:y,onIncrementToMax:b}=e,ee=i(le(Q),`@react-aria/spinbutton`),x=(0,$.useRef)(!1),S=(0,$.useCallback)(()=>{clearTimeout(t.current),x.current=!1},[]),C=o(()=>{S()});(0,$.useEffect)(()=>()=>C(),[]);let{keyboardProps:w}=s({isDisabled:f||p,shortcuts:{PageUp:()=>{if(g){g();return}if(h){h();return}return!1},ArrowUp:()=>{if(h){h();return}return!1},PageDown:()=>{if(v){v();return}if(_){_();return}return!1},ArrowDown:()=>{if(_){_();return}return!1},Home:()=>{if(y){y();return}return!1},End:()=>{if(b){b();return}return!1}},allowRepeats:!0}),T=(0,$.useRef)(!1),E=()=>{T.current=!0},D=()=>{T.current=!1},O=l===``?ee.format(`Empty`):(l||`${c}`).replace(`-`,`−`);(0,$.useEffect)(()=>{T.current&&(n(`assertive`),r(O,`assertive`))},[O]);let k=(0,$.useCallback)(()=>{S()},[S]),A=o(h??ue),j=o(_??ue),M=o(()=>{(d===void 0||isNaN(d)||c===void 0||isNaN(c)||c{C(),x.current=!0,t.current=window.setTimeout(M,e)}),P=o(()=>{(u===void 0||isNaN(u)||c===void 0||isNaN(c)||c>u)&&(j(),F(60))}),F=o(e=>{C(),x.current=!0,t.current=window.setTimeout(P,e)}),I=e=>{e.preventDefault()},{addGlobalListener:L,removeAllGlobalListeners:R}=a(),z=(0,$.useRef)(!1),[B,V]=(0,$.useState)(null);(0,$.useEffect)(()=>{B===`touch`?N(600):B?N(400):B||C()},[B]);let[H,U]=(0,$.useState)(null);return(0,$.useEffect)(()=>{H===`touch`?F(600):H?F(400):H||C()},[H]),{spinButtonProps:{role:`spinbutton`,"aria-valuenow":c!==void 0&&!isNaN(c)?c:void 0,"aria-valuetext":O,"aria-valuemin":u,"aria-valuemax":d,"aria-disabled":f||void 0,"aria-readonly":p||void 0,"aria-required":m||void 0,...w,onFocus:E,onBlur:D},incrementButtonProps:{onPressStart:e=>{S(),e.pointerType===`touch`?(L(window,`pointercancel`,k,{capture:!0}),z.current=!1,V(`touch`)):(h?.(),V(`mouse`)),L(window,`contextmenu`,I)},onPressUp:e=>{S(),e.pointerType===`touch`&&(z.current=!0),R(),V(null)},onPressEnd:e=>{S(),e.pointerType===`touch`&&!x.current&&z.current&&h?.(),z.current=!1,V(null)},onFocus:E,onBlur:D},decrementButtonProps:{onPressStart:e=>{S(),e.pointerType===`touch`?(L(window,`pointercancel`,k,{capture:!0}),z.current=!1,U(`touch`)):(_?.(),U(`mouse`))},onPressUp:e=>{S(),e.pointerType===`touch`&&(z.current=!0),R(),U(null)},onPressEnd:e=>{S(),e.pointerType===`touch`&&!x.current&&z.current&&_?.(),z.current=!1,U(null)},onFocus:E,onBlur:D}}}export{_ as n,f as r,de as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{$ as n,Q as r,k as i}from"./useI18n-BAo1UrJW.js";import{K as a,W as o,x as s}from"./SharedElementTransition-BlCsXfb1.js";var c=new Map,l=!1;try{l=new Intl.NumberFormat(`de-DE`,{signDisplay:`exceptZero`}).resolvedOptions().signDisplay===`exceptZero`}catch{}var u=!1;try{u=new Intl.NumberFormat(`de-DE`,{style:`unit`,unit:`degree`}).resolvedOptions().style===`unit`}catch{}var d={degree:{narrow:{default:`°`,"ja-JP":` 度`,"zh-TW":`度`,"sl-SI":` °`}}},f=class{constructor(e,t={}){this.numberFormatter=p(e,t),this.options=t}format(e){let t=``;if(t=!l&&this.options.signDisplay!=null?m(this.numberFormatter,this.options.signDisplay,e):this.numberFormatter.format(e),this.options.style===`unit`&&!u){let{unit:e,unitDisplay:n=`short`,locale:r}=this.resolvedOptions();if(!e)return t;let i=d[e]?.[n];t+=i[r]||i.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange==`function`)return this.numberFormatter.formatRange(e,t);if(t= start date`);return`${this.format(e)} \u{2013} ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts==`function`)return this.numberFormatter.formatRangeToParts(e,t);if(t= start date`);let n=this.numberFormatter.formatToParts(e),r=this.numberFormatter.formatToParts(t);return[...n.map(e=>({...e,source:`startRange`})),{type:`literal`,value:` – `,source:`shared`},...r.map(e=>({...e,source:`endRange`}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!l&&this.options.signDisplay!=null&&(e={...e,signDisplay:this.options.signDisplay}),!u&&this.options.style===`unit`&&(e={...e,style:`unit`,unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}};function p(e,t={}){let{numberingSystem:n}=t;if(n&&e.includes(`-nu-`)&&(e.includes(`-u-`)||(e+=`-u-`),e+=`-nu-${n}`),t.style===`unit`&&!u){let{unit:e,unitDisplay:n=`short`}=t;if(!e)throw Error(`unit option must be provided with style: "unit"`);if(!d[e]?.[n])throw Error(`Unsupported unit ${e} with unitDisplay = ${n}`);t={...t,style:`decimal`}}let r=e+(t?Object.entries(t).sort((e,t)=>e[0]0||Object.is(n,0):t===`exceptZero`&&(Object.is(n,-0)||Object.is(n,0)?n=Math.abs(n):r=n>0),r){let t=e.format(-n),r=e.format(n),i=t.replace(r,``).replace(/\u200e|\u061C/,``);return[...i].length!==1&&console.warn(`@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case`),t.replace(r,`!!!`).replace(i,`+`).replace(`!!!`,r)}return e.format(n)}}var h=RegExp(`^.*\\(.*\\).*$`),g=[`latn`,`arab`,`hanidec`,`deva`,`beng`,`fullwide`],_=class{constructor(e,t={}){this.locale=e,this.options=t}parse(e){return y(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,t,n){return y(this.locale,this.options,e).isValidPartialNumber(e,t,n)}getNumberingSystem(e){return y(this.locale,this.options,e).options.numberingSystem}},v=new Map;function y(e,t,n){let r=b(e,t);if(!e.includes(`-nu-`)&&!r.isValidPartialNumber(n)){for(let i of g)if(i!==r.options.numberingSystem){let r=b(e+(e.includes(`-u-`)?`-nu-`:`-u-nu-`)+i,t);if(r.isValidPartialNumber(n))return r}}return r}function b(e,t){let n=e+(t?Object.entries(t).sort((e,t)=>e[0]18||(this.options.maximumFractionDigits??0)>18)&&console.warn(`NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.`)}parse(e){let t=this.formatter.resolvedOptions().useGrouping,n=this.sanitize(e);if(!t&&this.symbols.group&&n.includes(this.symbols.group))return NaN;if(this.symbols.group&&(n=n.replaceAll(this.symbols.group,``)),this.symbols.decimal&&(n=n.replace(this.symbols.decimal,`.`)),this.symbols.minusSign&&(n=n.replace(this.symbols.minusSign,`-`)),n=n.replace(this.symbols.numeral,this.symbols.index),this.options.style===`percent`){let e=n.indexOf(`-`);n=n.replace(`-`,``),n=n.replace(`+`,``);let t=n.indexOf(`.`);t===-1&&(t=n.length),n=n.replace(`.`,``),n=t-2==0?`0.${n}`:t-2==-1?`0.0${n}`:t-2==-2?`0.00`:`${n.slice(0,t-2)}.${n.slice(t-2)}`,e>-1&&(n=`-${n}`)}let r=n?+n:NaN;if(isNaN(r))return NaN;if(this.options.style===`percent`){let e={...this.options,style:`decimal`,minimumFractionDigits:Math.min((this.options.minimumFractionDigits??0)+2,20),maximumFractionDigits:Math.min((this.options.maximumFractionDigits??0)+2,20)};return new _(this.locale,e).parse(new f(this.locale,e).format(r))}return this.options.currencySign===`accounting`&&h.test(e)&&(r=-1*r),r}sanitize(e){let t=this.formatter.resolvedOptions().useGrouping;return this.symbols.noNumeralUnits.length>0&&this.symbols.noNumeralUnits.find(t=>t.unit===e)?this.symbols.noNumeralUnits.find(t=>t.unit===e).value.toString():(e=e.replace(this.symbols.literals,``),this.symbols.minusSign&&(e=e.replace(`-`,this.symbols.minusSign)),this.options.numberingSystem===`arab`&&(this.symbols.decimal&&(e=w(e,`,`,this.symbols.decimal),e=w(e,`،`,this.symbols.decimal)),this.symbols.group&&t&&(e=w(e,`.`,this.symbols.group))),this.symbols.group===`’`&&e.includes(`'`)&&t&&(e=w(e,`'`,this.symbols.group)),this.symbols.group===`'`&&e.includes(`’`)&&t&&(e=w(e,`’`,this.symbols.group)),this.options.locale===`fr-FR`&&this.symbols.group&&t&&(e=w(e,` `,this.symbols.group),e=w(e,/\u00A0/g,this.symbols.group)),e)}isValidPartialNumber(e,t=-1/0,n=1/0){let r=this.formatter.resolvedOptions().useGrouping;return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&t<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&n>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&r&&(e=w(e,this.symbols.group,``)),e=e.replace(this.symbols.numeral,``),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,``)),e.length===0)}},x=new Set([`decimal`,`fraction`,`integer`,`minusSign`,`plusSign`,`group`]),S=[0,4,2,1,11,20,3,7,100,21,.1,1.1];function C(e,t,n,r){let i=new Intl.NumberFormat(e,{...n,minimumSignificantDigits:1,maximumSignificantDigits:21,roundingIncrement:1,roundingPriority:`auto`,roundingMode:`halfExpand`,useGrouping:!0}),a=i.formatToParts(-10000.111),o=i.formatToParts(10000.111),s=S.map(e=>i.formatToParts(e)),c=s.map((e,t)=>{let n=e.find(e=>e.type===`unit`);return n&&!e.some(e=>e.type===`integer`||e.type===`fraction`)?{unit:n.value,value:S[t]}:null}).filter(e=>!!e),l=a.find(e=>e.type===`minusSign`)?.value??`-`,u=o.find(e=>e.type===`plusSign`)?.value;!u&&(r?.signDisplay===`exceptZero`||r?.signDisplay===`always`)&&(u=`+`);let d=new Intl.NumberFormat(e,{...n,minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(.001).find(e=>e.type===`decimal`)?.value,f=a.find(e=>e.type===`group`)?.value,p=a.filter(e=>!x.has(e.type)).map(e=>T(e.value)),m=s.flatMap(e=>e.filter(e=>!x.has(e.type)).map(e=>T(e.value))),h=[...new Set([...p,...m])].sort((e,t)=>t.length-e.length),g=h.length===0?RegExp(`\\p{White_Space}|\\p{Cf}`,`gu`):RegExp(`${h.join(`|`)}|\\p{White_Space}|\\p{Cf}`,`gu`),_=[...new Intl.NumberFormat(n.locale,{useGrouping:!1}).format(9876543210)].reverse(),v=new Map(_.map((e,t)=>[e,t])),y=RegExp(`[${_.join(``)}]`,`g`);return{minusSign:l,plusSign:u,decimal:d,group:f,literals:g,numeral:y,numerals:_,index:e=>String(v.get(e)),noNumeralUnits:c}}function w(e,t,n){return e.replaceAll?e.replaceAll(t,n):e.split(t).join(n)}function T(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var E={};E={Empty:`فارغ`};var D={};D={Empty:`Изпразни`};var O={};O={Empty:`Prázdné`};var k={};k={Empty:`Tom`};var A={};A={Empty:`Leer`};var j={};j={Empty:`Άδειο`};var M={};M={Empty:`Empty`};var N={};N={Empty:`Vacío`};var P={};P={Empty:`Tühjenda`};var F={};F={Empty:`Tyhjä`};var I={};I={Empty:`Vide`};var L={};L={Empty:`ריק`};var R={};R={Empty:`Prazno`};var z={};z={Empty:`Üres`};var B={};B={Empty:`Vuoto`};var V={};V={Empty:`空`};var H={};H={Empty:`비어 있음`};var U={};U={Empty:`Tuščias`};var te={};te={Empty:`Tukšs`};var W={};W={Empty:`Tom`};var G={};G={Empty:`Leeg`};var K={};K={Empty:`Pusty`};var q={};q={Empty:`Vazio`};var J={};J={Empty:`Vazio`};var Y={};Y={Empty:`Gol`};var X={};X={Empty:`Не заполнено`};var Z={};Z={Empty:`Prázdne`};var ne={};ne={Empty:`Prazen`};var re={};re={Empty:`Prazno`};var ie={};ie={Empty:`Tomt`};var ae={};ae={Empty:`Boş`};var oe={};oe={Empty:`Пусто`};var se={};se={Empty:`空`};var ce={};ce={Empty:`空白`};var Q={};Q={"ar-AE":E,"bg-BG":D,"cs-CZ":O,"da-DK":k,"de-DE":A,"el-GR":j,"en-US":M,"es-ES":N,"et-EE":P,"fi-FI":F,"fr-FR":I,"he-IL":L,"hr-HR":R,"hu-HU":z,"it-IT":B,"ja-JP":V,"ko-KR":H,"lt-LT":U,"lv-LV":te,"nb-NO":W,"nl-NL":G,"pl-PL":K,"pt-BR":q,"pt-PT":J,"ro-RO":Y,"ru-RU":X,"sk-SK":Z,"sl-SI":ne,"sr-SP":re,"sv-SE":ie,"tr-TR":ae,"uk-UA":oe,"zh-CN":se,"zh-TW":ce};var $=t(e(),1);function le(e){return e&&e.__esModule?e.default:e}var ue=()=>{};function de(e){let t=(0,$.useRef)(void 0),{value:c,textValue:l,minValue:u,maxValue:d,isDisabled:f,isReadOnly:p,isRequired:m,onIncrement:h,onIncrementPage:g,onDecrement:_,onDecrementPage:v,onDecrementToMin:y,onIncrementToMax:b}=e,ee=i(le(Q),`@react-aria/spinbutton`),x=(0,$.useRef)(!1),S=(0,$.useCallback)(()=>{clearTimeout(t.current),x.current=!1},[]),C=o(()=>{S()});(0,$.useEffect)(()=>()=>C(),[]);let{keyboardProps:w}=s({isDisabled:f||p,shortcuts:{PageUp:()=>{if(g){g();return}if(h){h();return}return!1},ArrowUp:()=>{if(h){h();return}return!1},PageDown:()=>{if(v){v();return}if(_){_();return}return!1},ArrowDown:()=>{if(_){_();return}return!1},Home:()=>{if(y){y();return}return!1},End:()=>{if(b){b();return}return!1}},allowRepeats:!0}),T=(0,$.useRef)(!1),E=()=>{T.current=!0},D=()=>{T.current=!1},O=l===``?ee.format(`Empty`):(l||`${c}`).replace(`-`,`−`);(0,$.useEffect)(()=>{T.current&&(n(`assertive`),r(O,`assertive`))},[O]);let k=(0,$.useCallback)(()=>{S()},[S]),A=o(h??ue),j=o(_??ue),M=o(()=>{(d===void 0||isNaN(d)||c===void 0||isNaN(c)||c{C(),x.current=!0,t.current=window.setTimeout(M,e)}),P=o(()=>{(u===void 0||isNaN(u)||c===void 0||isNaN(c)||c>u)&&(j(),F(60))}),F=o(e=>{C(),x.current=!0,t.current=window.setTimeout(P,e)}),I=e=>{e.preventDefault()},{addGlobalListener:L,removeAllGlobalListeners:R}=a(),z=(0,$.useRef)(!1),[B,V]=(0,$.useState)(null);(0,$.useEffect)(()=>{B===`touch`?N(600):B?N(400):B||C()},[B]);let[H,U]=(0,$.useState)(null);return(0,$.useEffect)(()=>{H===`touch`?F(600):H?F(400):H||C()},[H]),{spinButtonProps:{role:`spinbutton`,"aria-valuenow":c!==void 0&&!isNaN(c)?c:void 0,"aria-valuetext":O,"aria-valuemin":u,"aria-valuemax":d,"aria-disabled":f||void 0,"aria-readonly":p||void 0,"aria-required":m||void 0,...w,onFocus:E,onBlur:D},incrementButtonProps:{onPressStart:e=>{S(),e.pointerType===`touch`?(L(window,`pointercancel`,k,{capture:!0}),z.current=!1,V(`touch`)):(h?.(),V(`mouse`)),L(window,`contextmenu`,I)},onPressUp:e=>{S(),e.pointerType===`touch`&&(z.current=!0),R(),V(null)},onPressEnd:e=>{S(),e.pointerType===`touch`&&!x.current&&z.current&&h?.(),z.current=!1,V(null)},onFocus:E,onBlur:D},decrementButtonProps:{onPressStart:e=>{S(),e.pointerType===`touch`?(L(window,`pointercancel`,k,{capture:!0}),z.current=!1,U(`touch`)):(_?.(),U(`mouse`))},onPressUp:e=>{S(),e.pointerType===`touch`&&(z.current=!0),R(),U(null)},onPressEnd:e=>{S(),e.pointerType===`touch`&&!x.current&&z.current&&_?.(),z.current=!1,U(null)},onFocus:E,onBlur:D}}}export{_ as n,f as r,de as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/useTextField-i0qH61mD.js b/internal/webui/static/assets/useTextField-h9qasHZP.js similarity index 92% rename from internal/webui/static/assets/useTextField-i0qH61mD.js rename to internal/webui/static/assets/useTextField-h9qasHZP.js index f31ab516b..b1713cc2e 100644 --- a/internal/webui/static/assets/useTextField-i0qH61mD.js +++ b/internal/webui/static/assets/useTextField-h9qasHZP.js @@ -1 +1 @@ -import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{J as n,l as r,q as i,tt as a,y as o}from"./SharedElementTransition-BlCsXfb1.js";import{p as s,r as c,u as l}from"./label-B8hTan2F.js";import{r as u}from"./Input-CyXcxaPW.js";var d=t(e(),1);function f(e,t){let{inputElementType:f=`input`,isDisabled:p=!1,isRequired:m=!1,isReadOnly:h=!1,type:g=`text`,validationBehavior:_=`aria`}=e,[v,y]=r(e.value,e.defaultValue||``,e.onChange),{focusableProps:b}=o(e,t),x=l({...e,value:v}),{isInvalid:S,validationErrors:C,validationDetails:w}=x.displayValidation,{labelProps:T,fieldProps:E,descriptionProps:D,errorMessageProps:O}=u({...e,isInvalid:S,errorMessage:e.errorMessage||C}),k=i(e,{labelable:!0}),A={type:g,pattern:e.pattern},[j]=(0,d.useState)(v);return s(t,e.defaultValue??j,y),c(e,x,t),{labelProps:T,inputProps:n(k,f===`input`?A:void 0,{disabled:p,readOnly:h,required:m&&_===`native`,"aria-required":m&&_===`aria`||void 0,"aria-invalid":S||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:v,onChange:e=>y(a(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,enterKeyHint:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...b,...E}),descriptionProps:D,errorMessageProps:O,isInvalid:S,validationErrors:C,validationDetails:w}}export{f as t}; \ No newline at end of file +import{a as e,c as t}from"./shim-mfK0Rmj6.js";import{J as n,l as r,q as i,tt as a,y as o}from"./SharedElementTransition-BlCsXfb1.js";import{p as s,r as c,u as l}from"./label-DYYRLGoV.js";import{r as u}from"./Input-C__Dw9HK.js";var d=t(e(),1);function f(e,t){let{inputElementType:f=`input`,isDisabled:p=!1,isRequired:m=!1,isReadOnly:h=!1,type:g=`text`,validationBehavior:_=`aria`}=e,[v,y]=r(e.value,e.defaultValue||``,e.onChange),{focusableProps:b}=o(e,t),x=l({...e,value:v}),{isInvalid:S,validationErrors:C,validationDetails:w}=x.displayValidation,{labelProps:T,fieldProps:E,descriptionProps:D,errorMessageProps:O}=u({...e,isInvalid:S,errorMessage:e.errorMessage||C}),k=i(e,{labelable:!0}),A={type:g,pattern:e.pattern},[j]=(0,d.useState)(v);return s(t,e.defaultValue??j,y),c(e,x,t),{labelProps:T,inputProps:n(k,f===`input`?A:void 0,{disabled:p,readOnly:h,required:m&&_===`native`,"aria-required":m&&_===`aria`||void 0,"aria-invalid":S||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:v,onChange:e=>y(a(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,enterKeyHint:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...b,...E}),descriptionProps:D,errorMessageProps:O,isInvalid:S,validationErrors:C,validationDetails:w}}export{f as t}; \ No newline at end of file diff --git a/internal/webui/static/assets/useToggle-55_Qx9vA.js b/internal/webui/static/assets/useToggle-DpH7h_oD.js similarity index 96% rename from internal/webui/static/assets/useToggle-55_Qx9vA.js rename to internal/webui/static/assets/useToggle-DpH7h_oD.js index c29fdd919..e568c5bb1 100644 --- a/internal/webui/static/assets/useToggle-55_Qx9vA.js +++ b/internal/webui/static/assets/useToggle-DpH7h_oD.js @@ -1 +1 @@ -import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{I as r}from"./useI18n-XrvNxGvP.js";import{B as i,J as a,dt as o,lt as s,m as c,q as l,s as u,tt as d,y as f,z as p}from"./SharedElementTransition-BlCsXfb1.js";import{p as m,r as h,s as g,u as _}from"./label-B8hTan2F.js";var v=p({defaultVariants:{variant:`default`},slots:{base:`card`,content:`card__content`,description:`card__description`,footer:`card__footer`,header:`card__header`,title:`card__title`},variants:{variant:{default:{base:`card--default`},secondary:{base:`card--secondary`},tertiary:{base:`card--tertiary`},transparent:{base:`card--transparent`}}}}),y=t(e(),1),b=n(),x=(0,y.createContext)({}),S=({children:e,className:t,variant:n=`default`,...a})=>{let o=y.useMemo(()=>v({variant:n}),[n]),s=(0,b.jsx)(i.div,{className:o.base({className:t}),"data-slot":`card`,...a,children:e});return(0,b.jsx)(x,{value:{slots:o},children:n===`transparent`?s:(0,b.jsx)(r,{value:{variant:n},children:s})})},C=Object.assign(S,{Root:S,Header:({className:e,...t})=>{let{slots:n}=(0,y.use)(x);return(0,b.jsx)(i.div,{className:u(n?.header,e),"data-slot":`card-header`,...t})},Title:({children:e,className:t,...n})=>{let{slots:r}=(0,y.use)(x);return(0,b.jsx)(i.h3,{className:u(r?.title,t),"data-slot":`card-title`,...n,children:e})},Description:({children:e,className:t,...n})=>{let{slots:r}=(0,y.use)(x);return(0,b.jsx)(i.p,{className:u(r?.description,t),"data-slot":`card-description`,...n,children:e})},Content:({className:e,...t})=>{let{slots:n}=(0,y.use)(x);return(0,b.jsx)(i.div,{className:u(n?.content,e),"data-slot":`card-content`,...t})},Footer:({className:e,...t})=>{let{slots:n}=(0,y.use)(x);return(0,b.jsx)(i.div,{className:u(n?.footer,e),"data-slot":`card-footer`,...t})}});function w(e=!0){let[t,n]=(0,y.useState)(e),r=(0,y.useRef)(!1),i=(0,y.useCallback)(e=>{r.current=!0,n(!!e)},[]);return o(()=>{r.current||n(!1)},[]),[i,t]}function T(e=!0){let t=s(),[n,r]=w(e);return{id:r?t:void 0,ref:n}}function E(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:o,name:s,form:u,children:p,isRequired:v,validationBehavior:b=`aria`,"aria-label":x,"aria-labelledby":S,"aria-describedby":C,onPressStart:w,onPressEnd:E,onPressChange:D,onPress:O,onPressUp:k,onClick:A}=e,j=_({...e,value:t.isSelected}),{isInvalid:M,validationErrors:N,validationDetails:P}=j.displayValidation;h(e,j,n);let F=e=>{e.stopPropagation(),t.setSelected(d(e).checked)},{pressProps:I,isPressed:L}=c({onPressStart:w,onPressEnd:E,onPressChange:D,onPress:O,onPressUp:k,onClick:A,isDisabled:r}),[R,z]=(0,y.useState)(!1),{pressProps:B}=c({onPressStart(e){if(e.pointerType===`keyboard`||e.pointerType===`virtual`){e.continuePropagation();return}w?.(e),D?.(!0),z(!0)},onPressEnd(e){if(e.pointerType===`keyboard`||e.pointerType===`virtual`){e.continuePropagation();return}E?.(e),D?.(!1),z(!1)},onPressUp(e){if(e.pointerType===`keyboard`||e.pointerType===`virtual`){e.continuePropagation();return}k?.(e)},onClick:A,onPress(r){if(r.pointerType===`keyboard`||r.pointerType===`virtual`){r.continuePropagation();return}O?.(r),t.toggle(),n.current?.focus();let{[g]:i}=e,{commitValidation:a}=i||j;a()},isDisabled:r||i}),{focusableProps:V}=f(e,n),H=a(I,V),U=l(e,{labelable:!0});m(n,t.defaultSelected,t.setSelected);let W=T(),G=T();return{labelProps:a(B,{onClick:e=>e.preventDefault()}),inputProps:a(U,{checked:t.isSelected,"aria-required":v&&b===`aria`||void 0,required:v&&b===`native`,"aria-invalid":M||e.validationState===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,"aria-describedby":[W.id,G.id,C].filter(Boolean).join(` `)||void 0,onChange:F,disabled:r,...o==null?{}:{value:o},name:s,form:u,type:`checkbox`,...H}),descriptionProps:W,errorMessageProps:G,isSelected:t.isSelected,isPressed:L||R,isDisabled:r,isReadOnly:i,isInvalid:M||e.validationState===`invalid`,validationErrors:N,validationDetails:P}}export{C as n,E as t}; \ No newline at end of file +import{a as e,c as t,n}from"./shim-mfK0Rmj6.js";import{I as r}from"./useI18n-BAo1UrJW.js";import{B as i,J as a,dt as o,lt as s,m as c,q as l,s as u,tt as d,y as f,z as p}from"./SharedElementTransition-BlCsXfb1.js";import{p as m,r as h,s as g,u as _}from"./label-DYYRLGoV.js";var v=p({defaultVariants:{variant:`default`},slots:{base:`card`,content:`card__content`,description:`card__description`,footer:`card__footer`,header:`card__header`,title:`card__title`},variants:{variant:{default:{base:`card--default`},secondary:{base:`card--secondary`},tertiary:{base:`card--tertiary`},transparent:{base:`card--transparent`}}}}),y=t(e(),1),b=n(),x=(0,y.createContext)({}),S=({children:e,className:t,variant:n=`default`,...a})=>{let o=y.useMemo(()=>v({variant:n}),[n]),s=(0,b.jsx)(i.div,{className:o.base({className:t}),"data-slot":`card`,...a,children:e});return(0,b.jsx)(x,{value:{slots:o},children:n===`transparent`?s:(0,b.jsx)(r,{value:{variant:n},children:s})})},C=Object.assign(S,{Root:S,Header:({className:e,...t})=>{let{slots:n}=(0,y.use)(x);return(0,b.jsx)(i.div,{className:u(n?.header,e),"data-slot":`card-header`,...t})},Title:({children:e,className:t,...n})=>{let{slots:r}=(0,y.use)(x);return(0,b.jsx)(i.h3,{className:u(r?.title,t),"data-slot":`card-title`,...n,children:e})},Description:({children:e,className:t,...n})=>{let{slots:r}=(0,y.use)(x);return(0,b.jsx)(i.p,{className:u(r?.description,t),"data-slot":`card-description`,...n,children:e})},Content:({className:e,...t})=>{let{slots:n}=(0,y.use)(x);return(0,b.jsx)(i.div,{className:u(n?.content,e),"data-slot":`card-content`,...t})},Footer:({className:e,...t})=>{let{slots:n}=(0,y.use)(x);return(0,b.jsx)(i.div,{className:u(n?.footer,e),"data-slot":`card-footer`,...t})}});function w(e=!0){let[t,n]=(0,y.useState)(e),r=(0,y.useRef)(!1),i=(0,y.useCallback)(e=>{r.current=!0,n(!!e)},[]);return o(()=>{r.current||n(!1)},[]),[i,t]}function T(e=!0){let t=s(),[n,r]=w(e);return{id:r?t:void 0,ref:n}}function E(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:o,name:s,form:u,children:p,isRequired:v,validationBehavior:b=`aria`,"aria-label":x,"aria-labelledby":S,"aria-describedby":C,onPressStart:w,onPressEnd:E,onPressChange:D,onPress:O,onPressUp:k,onClick:A}=e,j=_({...e,value:t.isSelected}),{isInvalid:M,validationErrors:N,validationDetails:P}=j.displayValidation;h(e,j,n);let F=e=>{e.stopPropagation(),t.setSelected(d(e).checked)},{pressProps:I,isPressed:L}=c({onPressStart:w,onPressEnd:E,onPressChange:D,onPress:O,onPressUp:k,onClick:A,isDisabled:r}),[R,z]=(0,y.useState)(!1),{pressProps:B}=c({onPressStart(e){if(e.pointerType===`keyboard`||e.pointerType===`virtual`){e.continuePropagation();return}w?.(e),D?.(!0),z(!0)},onPressEnd(e){if(e.pointerType===`keyboard`||e.pointerType===`virtual`){e.continuePropagation();return}E?.(e),D?.(!1),z(!1)},onPressUp(e){if(e.pointerType===`keyboard`||e.pointerType===`virtual`){e.continuePropagation();return}k?.(e)},onClick:A,onPress(r){if(r.pointerType===`keyboard`||r.pointerType===`virtual`){r.continuePropagation();return}O?.(r),t.toggle(),n.current?.focus();let{[g]:i}=e,{commitValidation:a}=i||j;a()},isDisabled:r||i}),{focusableProps:V}=f(e,n),H=a(I,V),U=l(e,{labelable:!0});m(n,t.defaultSelected,t.setSelected);let W=T(),G=T();return{labelProps:a(B,{onClick:e=>e.preventDefault()}),inputProps:a(U,{checked:t.isSelected,"aria-required":v&&b===`aria`||void 0,required:v&&b===`native`,"aria-invalid":M||e.validationState===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,"aria-describedby":[W.id,G.id,C].filter(Boolean).join(` `)||void 0,onChange:F,disabled:r,...o==null?{}:{value:o},name:s,form:u,type:`checkbox`,...H}),descriptionProps:W,errorMessageProps:G,isSelected:t.isSelected,isPressed:L||R,isDisabled:r,isReadOnly:i,isInvalid:M||e.validationState===`invalid`,validationErrors:N,validationDetails:P}}export{C as n,E as t}; \ No newline at end of file diff --git a/internal/webui/static/index.html b/internal/webui/static/index.html index 8673576e1..96f04d185 100644 --- a/internal/webui/static/index.html +++ b/internal/webui/static/index.html @@ -19,10 +19,10 @@ - + - +