(function (root) { const WORDS = { zh: { title: "账号用量", subtitle: "先看账号,再展开查看它使用的模型", periods: { today: "今天", "7d": "7 天", "30d": "30 天", all: "全部" }, refresh: "刷新用量", period: "统计周期", summary: "用量汇总", accounts: "账号", providers: "供应商", calls: "调用", tokens: "输入 + 输出 Token", tokensWithCache: "输入 + 输出 + 缓存 Token", tokensWithoutCache: "输入 + 输出 Token", includeCache: "Token 含缓存", includeCacheHint: "切换是否把缓存 Token 计入总量、排序和占比", cost: "估算费用", models: "模型", detail: "账号明细", search: "搜索账号、供应商或模型", sort: "排序", sortBy: { tokens: "按 Token", cost: "按费用", calls: "按调用", name: "按名称" }, expand: "展开全部", collapse: "收起全部", columns: { identity: "供应商 / 账号", calls: "调用", tokens: "Token", share: "占比", cost: "费用", status: "状态", }, model: "模型", token: "Token", modelTokensWithCache: "Token + 缓存", modelTokensWithoutCache: "Token", allOk: "正常", failed: "失败", unpriced: "次未定价", noCalls: "这个周期还没有账号用量", noMatch: "没有匹配的账号", noCallsHint: "通过 Magpie 网关产生调用后,这里会按账号汇总。", noMatchHint: "试试搜索其他账号、供应商或模型。", noData: "没有读到用量数据", reload: "重新加载", firstRead: "首次读取约需数秒", source: "只读聚合", updated: "更新于", input: "入", output: "出", cache: "缓存", cacheHit: "缓存命中率", cacheUnknown: (calls) => `${calls} 次未统计缓存`, share: { tokens: "Token 占比", cost: "费用占比", calls: "调用占比", name: "Token 占比" }, unpricedOnly: "未定价", unpricedCalls: (n) => `${n} 次未定价`, noTime: "无时间", justUsed: "刚刚使用", usedRecently: "最近使用", minutesAgo: (n) => `${n} 分钟前`, hoursAgo: (n) => `${n} 小时前`, readFailed: "无法读取用量数据", refreshFailed: "刷新失败,仍显示上次数据", apiKeyNote: "API key 调用,不计入账号", accountsAndModels: (a, m) => `${a} 个账号 · ${m} 个模型`, modelsOnly: (m) => `${m} 个模型`, providerModels: (p, m) => `${p} 个供应商 · ${m} 个模型`, hostNotes: (items) => `含 ${items}`, noUsage: "这个周期还没有用量:Magpie 网关记录第一次调用后会显示在这里。", modelDetails: (count) => `${count} 个账号的模型明细暂时无法读取,账号汇总仍完整。`, serviceTimeout: "数据请求超过 30 秒。请检查 Magpie 网关是否可访问。", localService: (port) => `本地用量服务没有在运行(127.0.0.1:${port})`, }, en: { title: "Account usage", subtitle: "Start with each account, then expand it to see the models it used", periods: { today: "Today", "7d": "7 days", "30d": "30 days", all: "All" }, refresh: "Refresh usage", period: "Period", summary: "Usage summary", accounts: "Accounts", providers: "providers", calls: "Calls", tokens: "Input + output tokens", tokensWithCache: "Input + output + cache tokens", tokensWithoutCache: "Input + output tokens", includeCache: "Tokens include cache", includeCacheHint: "Include cache tokens in totals, sorting and shares", cost: "Estimated cost", models: "models", detail: "Account details", search: "Search accounts, providers or models", sort: "Sort", sortBy: { tokens: "By tokens", cost: "By cost", calls: "By calls", name: "By name" }, expand: "Expand all", collapse: "Collapse all", columns: { identity: "Provider / account", calls: "Calls", tokens: "Tokens", share: "Share", cost: "Cost", status: "Status", }, model: "Model", token: "Token", modelTokensWithCache: "Token + cache", modelTokensWithoutCache: "Token", allOk: "OK", failed: "failed", unpriced: "unpriced", noCalls: "No account usage in this period", noMatch: "No matching account", noCallsHint: "Usage will be grouped by account after calls pass through the Magpie gateway.", noMatchHint: "Try another account, provider or model.", noData: "Could not read usage data", reload: "Reload", firstRead: "The first read may take a few seconds", source: "Read-only aggregate", updated: "Updated at", input: "In", output: "Out", cache: "Cache", cacheHit: "Cache hit", cacheUnknown: (calls) => `${calls} cache-uncounted call${calls === 1 ? "" : "s"}`, share: { tokens: "Token share", cost: "Cost share", calls: "Call share", name: "Token share" }, unpricedOnly: "Not priced", unpricedCalls: (n) => `${n} unpriced`, noTime: "no time", justUsed: "used just now", usedRecently: "used recently", minutesAgo: (n) => `${n} min ago`, hoursAgo: (n) => `${n} hr ago`, readFailed: "Could not read usage data", refreshFailed: "Refresh failed; showing the previous data", apiKeyNote: "API key calls, not counted as accounts", accountsAndModels: (a, m) => `${a} ${a === 1 ? "account" : "accounts"} · ${m} ${m === 1 ? "model" : "models"}`, modelsOnly: (m) => `${m} ${m === 1 ? "model" : "models"}`, providerModels: (p, m) => `${p} ${p === 1 ? "provider" : "providers"} · ${m} ${m === 1 ? "model" : "models"}`, hostNotes: (items) => `Includes ${items}`, noUsage: "No usage in this period yet: Magpie shows it after the gateway records its first call.", modelDetails: (count) => `Model details for ${count} ${count === 1 ? "account is" : "accounts are"} temporarily unavailable; account totals are complete.`, serviceTimeout: "The data request took more than 30 seconds. Check the Magpie gateway.", localService: (port) => `The local usage service is not running (127.0.0.1:${port})`, }, }; root.UsageI18n = { get(lang) { return String(lang || "").toLowerCase().startsWith("zh") ? WORDS.zh : WORDS.en; }, }; })(globalThis);