dsh-free-model 0.0.0-stage → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js ADDED
@@ -0,0 +1,2531 @@
1
+ /**
2
+ * 模型接入 — browser half, channels-only fork.
3
+ *
4
+ * Contributes one surface: a settings section (`settings.section`, id
5
+ * `our-free-model`) holding the four pages this fork kept — the fourteen
6
+ * account channels and their logins, the token dashboard and the request log
7
+ * (both reading the pack's own ledger over the shell's `connection` RPC), and
8
+ * the gateway page (the pack's local OpenAI gateway, this plugin's LAN relay,
9
+ * and the egress outlet).
10
+ *
11
+ * The model roster, the free-lane dashboard, the EAC authorization panel, the
12
+ * aggregate/routing/saver pages, the first-run announcement and the update
13
+ * panels are gone with the lanes they described; nothing here shadows the stock
14
+ * model picker, whose grouping by provider route is the tag this plugin uses.
15
+ *
16
+ * Data that is this plugin's own (outlet state, relay status, relay keys) is
17
+ * read over the same-origin `/api/our-free-model/*` routes, because those are
18
+ * served by the same host process on every kernel line this plugin targets.
19
+ *
20
+ * Hand-written ModuleLoader bundle: no build step, no dependency beyond the
21
+ * `react` the shell already provides. All colour comes from theme variables so
22
+ * the page survives a scheme switch.
23
+ */
24
+ window.__ModuleLoader__.load({
25
+ id: 'dsh-free-model',
26
+ factory: require => {
27
+ const module = { exports: {} }
28
+ const exports = module.exports
29
+ const React = require('react')
30
+ const { createElement: h, Fragment, useState, useEffect, useMemo, useRef, useCallback } = React
31
+
32
+ const NS = 'settings.ourFreeModel'
33
+ const inject = ['slots', 'locale']
34
+
35
+ // ── copy ──────────────────────────────────────────────────────────────────
36
+ const DICT = {
37
+ zh: {
38
+ nav: '模型接入',
39
+ title: '模型接入',
40
+ loading: '正在加载…',
41
+ loadFailed: '无法连接插件后端',
42
+ retry: '重试',
43
+ 'eac.copy': '复制链接',
44
+ 'section.egress': '出口代理(订阅分流)',
45
+ 'section.egressHint': '把推理与探测请求从代理出口发出,缓解按 IP 的频率限制。',
46
+ 'egress.enabled': '启用出口',
47
+ 'egress.modeSubscription': '订阅模式(本地 mihomo 自动测速分流)',
48
+ 'egress.url': '订阅 / 代理 URL',
49
+ 'egress.urlNew': '替换订阅地址',
50
+ 'egress.urlPlaceholder': '粘贴新的订阅 / 代理地址(留空则保持当前不变)',
51
+ 'egress.urlNone': '未设置',
52
+ 'egress.urlClear': '清除',
53
+ 'egress.urlClearWarn': '清除本机保存的订阅 / 代理地址,并关闭出口',
54
+ 'egress.mihomoPath': 'mihomo 路径',
55
+ 'egress.mihomoHint': '订阅模式留空则自动查找本机 mihomo(如 Clash Verge)。',
56
+ 'egress.apply': '应用',
57
+ 'egress.active': '出口生效中',
58
+ 'egress.inactive': '未启用',
59
+ 'egress.outlet': '当前出口',
60
+ 'egress.node': '当前最佳节点',
61
+ 'egress.measuring': '测量中…',
62
+ 'egress.direct': '关闭时请求直连发出;订阅地址按密钥对待——只存在本机设置里,不随常规接口数据下发,仅点「显示」时读取,面板默认打码。',
63
+ 'egress.error': '出口启动失败:{message}',
64
+ 'settings.failed': '设置未保存',
65
+ 'forward.show': '显示',
66
+ 'forward.hide': '隐藏',
67
+ 'forward.copy': '复制',
68
+ 'forward.copied': '已复制',
69
+ 'nav.tab.channels': '白嫖模型接入',
70
+ 'chan.title': '白嫖模型接入',
71
+ 'chan.sub': '把各家的免费额度接进来:登录一次,模型就出现在对话框的模型选择器里。凭据只写入本机凭据库,页面永远拿不到明文。',
72
+ 'chan.pack.failed': '渠道包未挂载:{reason}(免费车道与 EAC 不受影响)',
73
+ 'chan.pack.hint': '渠道包由本插件内置(vendor/channel-pack),随插件一起升级。',
74
+ 'chan.state.on': '已接入',
75
+ 'chan.state.off': '未接入',
76
+ 'chan.state.closed': '已关闭',
77
+ 'chan.meta.accounts': '账号',
78
+ 'chan.meta.models': '模型',
79
+ 'chan.act.add': '添加账号',
80
+ 'chan.act.refresh': '续期',
81
+ 'chan.act.test': '测试',
82
+ 'chan.act.delete': '移除',
83
+ 'chan.act.claim': '一键领取',
84
+ 'chan.fold.accounts': '账号',
85
+ 'chan.fold.models': '模型',
86
+ 'chan.noAccount': '还没有账号——点「添加账号」开始登录。',
87
+ 'chan.enabled': '启用',
88
+ 'chan.expires.never': '长效',
89
+ 'chan.disabled': '已关闭',
90
+ 'chan.login.title': '登录 {name}',
91
+ 'chan.login.step1': '在浏览器中完成登录(若没有自动打开,点下面的按钮)。',
92
+ 'chan.login.step2': '登录成功后本页会自动完成,无需复制任何东西。',
93
+ 'chan.login.open': '打开登录页',
94
+ 'chan.login.cancel': '取消',
95
+ 'chan.login.waiting': '已打开登录页,等待授权…(最长等待 10 分钟)',
96
+ 'chan.login.expired': '等待超时,请重新发起登录。',
97
+ 'chan.login.done': '已接入:{login}',
98
+ 'chan.login.failed': '登录未完成:{reason}',
99
+ 'chan.test.ok': '连接正常({ms} ms)',
100
+ 'chan.test.failed': '测试失败:{reason}',
101
+ 'chan.claim.result': '已领取 {count} 个账号,共 {credit} 积分。',
102
+ 'chan.claim.none': '今天没有可领取的积分。',
103
+ 'chan.credit.today': '今日已领 {credit}',
104
+ 'chan.model.free': '免费额度',
105
+ 'chan.model.dead': '已下架',
106
+ 'chan.model.off': '关闭',
107
+ 'chan.model.on': '开启',
108
+ 'chan.model.enableAll': '全部开启',
109
+ 'chan.model.disableAll': '全部关闭',
110
+ 'chan.model.enabledCount': '已开启 {enabled}/{total}',
111
+ 'chan.model.allScope': '仅操作当前渠道的全部模型',
112
+ 'chan.error': '操作失败:{reason}',
113
+ 'chan.confirm.delete': '移除账号 {name}?该账号的凭据会一并删除。',
114
+ 'chan.rpc.unavailable': '宿主未提供 connection 服务,渠道操作暂不可用。',
115
+ 'nav.tab.ledger': '数据看板',
116
+ 'nav.tab.logs': '运行日志',
117
+ 'nav.tab.gateway': '网关设置',
118
+ 'chan.titleSingle': '渠道',
119
+ 'dash.title': '数据看板',
120
+ 'dash.sub': '渠道模型的 Token 消耗与推理指标:输入/输出/思考/缓存逐项统计,账号与模型双维度透视。',
121
+ 'dash.today': '今日数据',
122
+ 'dash.all': '全部历史',
123
+ 'dash.refresh': '刷新',
124
+ 'dash.kpiToday': '今日消耗 Token',
125
+ 'dash.kpiScopeAll': '范围内消耗 Token',
126
+ 'dash.kpiCumulative': '累计消耗 Token',
127
+ 'dash.kpiSpeed': '平均生成速度',
128
+ 'dash.kpiCache': '上下文缓存命中率',
129
+ 'dash.kpiRequests': '请求数 & 成功率',
130
+ 'dash.input': '输入',
131
+ 'dash.output': '输出',
132
+ 'dash.reasoning': '思考',
133
+ 'dash.ttft': '首字',
134
+ 'dash.cacheTokens': '缓存命中',
135
+ 'dash.successRate': '成功率',
136
+ 'dash.failed': '失败',
137
+ 'dash.recentTitle': '总览 · 最近请求',
138
+ 'dash.recentHint': '来自渠道包的逐请求账本:时间、账号、首字延迟、生成速度与 Token 细分。',
139
+ 'dash.empty': '暂无数据——通过渠道模型发起一次对话后,这里就会开始记录。',
140
+ 'dash.accountsTitle': '各账号用量透视与模型消耗分布',
141
+ 'dash.accountsHint': '按账号汇总请求数与 Token 细分,附调用量最高的模型。',
142
+ 'dash.modelsTitle': '模型性能指标与用量一览',
143
+ 'dash.modelsHint': '融合首字延迟、生成速度与 Token 统计 · 用量占比按消耗 Token 计算。',
144
+ 'log.time': '时间',
145
+ 'log.model': '模型',
146
+ 'log.account': '账号',
147
+ 'log.via': '通道',
148
+ 'log.viaDirect': '对话',
149
+ 'log.viaGateway': '网关',
150
+ 'log.result': '结果',
151
+ 'log.ok': '成功',
152
+ 'log.failed': '失败',
153
+ 'log.duration': '耗时',
154
+ 'log.ttft': '首字',
155
+ 'log.speed': '速度',
156
+ 'log.input': '输入',
157
+ 'log.output': '输出',
158
+ 'log.reasoning': '思考',
159
+ 'log.cache': '缓存',
160
+ 'log.total': '总 token',
161
+ 'log.requests': '请求数',
162
+ 'log.inputSlash': '输入 / 输出 / 思考',
163
+ 'log.cacheHit': '缓存命中率',
164
+ 'log.share': '用量占比',
165
+ 'log.modelMix': '调用的模型分布',
166
+ 'log.unattributed': '未归属',
167
+ 'logs.title': '运行日志',
168
+ 'logs.sub': '逐条请求明细:结果、耗时、首字、速度与 Token 细分;悬停失败行可看原因。',
169
+ 'logs.auto': '每 10 秒自动刷新',
170
+ 'logs.count': '共 {total} 条 · 本页 {shown} 条',
171
+ 'logs.empty': '还没有请求记录。',
172
+ 'logs.page': '第 {page} 页 / 共 {pages} 页',
173
+ 'logs.windowNote': '逐条日志保留最近窗口;历史只保留按日聚合(约 90 天),数据看板的「全部历史」即来源于此。',
174
+ 'gw.title': '网关设置',
175
+ 'gw.sub': '把渠道模型以 OpenAI 兼容接口发给本机与局域网工具:端点、密钥与转发端口都在这里。',
176
+ 'gw.gatewayTitle': '渠道模型网关(OpenAI 兼容)',
177
+ 'gw.gatewayHint': '覆盖全部已接入渠道;Chat Completions 与 Responses 两套接口同时可用。',
178
+ 'gw.running': '运行中',
179
+ 'gw.stopped': '未运行',
180
+ 'gw.envBlocked': '已被环境变量停用',
181
+ 'gw.switch': '启用网关',
182
+ 'gw.endpoint': '端点',
183
+ 'gw.key': 'API Key',
184
+ 'gw.show': '显示',
185
+ 'gw.hide': '隐藏',
186
+ 'gw.keyNote': '明文凭据:只用于客户端配置,请勿外发。',
187
+ 'gw.keyNone': '尚未生成',
188
+ 'gw.keyNoneHint': '启用一次网关即会自动生成密钥。',
189
+ 'gw.models': '可转发模型',
190
+ 'gw.portNote': '端口可用环境变量 DSH_OPENAI_GATEWAY_PORT 调整。',
191
+ 'gw.relayTitle': '局域网转发(本插件中继)',
192
+ 'gw.relayHint': '把网关再暴露到一个可选的地址与端口:调用方用下面的中继密钥,网关自身只监听本机。',
193
+ 'gw.relaySwitch': '启用局域网转发',
194
+ 'gw.relayBind': '监听地址',
195
+ 'gw.bindLocal': '仅本机(127.0.0.1)',
196
+ 'gw.bindLan': '局域网(0.0.0.0)',
197
+ 'gw.relayPort': '端口',
198
+ 'gw.relayUrl': 'Base URL',
199
+ 'gw.relayKey': '中继密钥',
200
+ 'gw.rotate': '轮换',
201
+ 'gw.relayNote': '中继只放行模型接口(/v1/*),并要求携带中继密钥;局域网绑定意味着同网段的设备都能访问到这个端口。',
202
+ 'chan.credits.left': '剩余积分',
203
+ 'chan.credits.tokens': '剩余 Token',
204
+ 'chan.credits.dollars': '剩余余额(USD)',
205
+ 'chan.credits.quota': '剩余配额',
206
+ 'chan.credits.loaded': '已查询 {count} 个账号',
207
+ 'chan.credits.refresh': '刷新余额',
208
+ 'chan.credits.loading': '余额查询中…',
209
+ 'chan.credits.failed': '余额查询失败:{reason}',
210
+ 'chan.credits.partial': '{count} 个账号未能查询余额,请展开账号查看原因并重试。',
211
+ 'chan.credits.unavailable': '未返回余额数据',
212
+ 'chan.claim.failed': '领取失败:{reason}',
213
+ 'chan.auto.title': '每日自动签到',
214
+ 'chan.auto.running': '签到进行中…',
215
+ 'chan.auto.ran': '今日已自动签到',
216
+ 'chan.auto.off': '今日尚未签到',
217
+ 'chan.auto.last': '上次结果:{result}',
218
+ },
219
+ en: {
220
+ nav: 'Model Access',
221
+ title: 'Model Access',
222
+ loading: 'Loading…',
223
+ loadFailed: 'Cannot reach the plugin backend',
224
+ retry: 'Retry',
225
+ 'section.egress': 'Egress outlet (subscription routing)',
226
+ 'section.egressHint': 'Send inference and probe traffic through a proxy outlet to ease per-IP rate limits.',
227
+ 'egress.enabled': 'Enable outlet',
228
+ 'egress.modeSubscription': 'Subscription mode (local mihomo picks the fastest node)',
229
+ 'egress.url': 'Subscription / proxy URL',
230
+ 'egress.urlNew': 'Replace the address',
231
+ 'egress.urlPlaceholder': 'Paste a new subscription / proxy URL (leave empty to keep the current one)',
232
+ 'egress.urlNone': 'not set',
233
+ 'egress.urlClear': 'Clear',
234
+ 'egress.urlClearWarn': 'Clear the stored subscription / proxy address and turn the outlet off',
235
+ 'egress.mihomoPath': 'mihomo path',
236
+ 'egress.mihomoHint': 'Leave empty in subscription mode to auto-locate a local mihomo (e.g. Clash Verge).',
237
+ 'egress.apply': 'Apply',
238
+ 'egress.active': 'Outlet active',
239
+ 'egress.inactive': 'Not enabled',
240
+ 'egress.outlet': 'Current outlet',
241
+ 'egress.node': 'Best node',
242
+ 'egress.measuring': 'measuring…',
243
+ 'egress.direct': 'While off, requests go direct; the address is treated as a credential — kept in this machine\'s settings only, never sent down with the regular API payloads, readable only through the reveal button, masked here by default.',
244
+ 'egress.error': 'The outlet failed to start: {message}',
245
+ 'eac.copy': 'Copy link',
246
+ 'settings.failed': 'Settings not saved',
247
+ 'forward.show': 'Show',
248
+ 'forward.hide': 'Hide',
249
+ 'forward.copy': 'Copy',
250
+ 'forward.copied': 'Copied',
251
+ 'nav.tab.channels': 'Free channels',
252
+ 'chan.title': 'Free channel access',
253
+ 'chan.sub': 'Bring each vendor\'s free quota in: sign in once and its models appear in the composer\'s model picker. Credentials are written to the local credential store only — this page never sees them.',
254
+ 'chan.pack.failed': 'Channel pack not mounted: {reason} (the free and EAC lanes are unaffected)',
255
+ 'chan.pack.hint': 'The pack ships inside this plugin (vendor/channel-pack) and upgrades with it.',
256
+ 'chan.state.on': 'Connected',
257
+ 'chan.state.off': 'Not connected',
258
+ 'chan.state.closed': 'Turned off',
259
+ 'chan.meta.accounts': 'Accounts',
260
+ 'chan.meta.models': 'Models',
261
+ 'chan.act.add': 'Add account',
262
+ 'chan.act.refresh': 'Refresh',
263
+ 'chan.act.test': 'Test',
264
+ 'chan.act.delete': 'Remove',
265
+ 'chan.act.claim': 'Claim daily',
266
+ 'chan.fold.accounts': 'Accounts',
267
+ 'chan.fold.models': 'Models',
268
+ 'chan.noAccount': 'No account yet — press “Add account” to sign in.',
269
+ 'chan.enabled': 'Enabled',
270
+ 'chan.expires.never': 'Long-lived',
271
+ 'chan.disabled': 'Disabled',
272
+ 'chan.login.title': 'Sign in to {name}',
273
+ 'chan.login.step1': 'Finish the sign-in in your browser (if it did not open, use the button below).',
274
+ 'chan.login.step2': 'This page completes by itself once the browser flow does — nothing to copy.',
275
+ 'chan.login.open': 'Open sign-in page',
276
+ 'chan.login.cancel': 'Cancel',
277
+ 'chan.login.waiting': 'Sign-in page opened; waiting for authorization… (up to 10 minutes)',
278
+ 'chan.login.expired': 'Timed out — please start the sign-in again.',
279
+ 'chan.login.done': 'Connected: {login}',
280
+ 'chan.login.failed': 'Sign-in did not complete: {reason}',
281
+ 'chan.test.ok': 'Connection healthy ({ms} ms)',
282
+ 'chan.test.failed': 'Test failed: {reason}',
283
+ 'chan.claim.result': 'Claimed for {count} account(s), {credit} credits in total.',
284
+ 'chan.claim.none': 'Nothing to claim today.',
285
+ 'chan.credit.today': '{credit} claimed today',
286
+ 'chan.model.free': 'Free quota',
287
+ 'chan.model.dead': 'Retired',
288
+ 'chan.model.off': 'Hide',
289
+ 'chan.model.on': 'Show',
290
+ 'chan.model.enableAll': 'Show all',
291
+ 'chan.model.disableAll': 'Hide all',
292
+ 'chan.model.enabledCount': 'Shown {enabled}/{total}',
293
+ 'chan.model.allScope': 'Apply to all models in this channel only',
294
+ 'chan.error': 'Action failed: {reason}',
295
+ 'chan.confirm.delete': 'Remove account {name}? Its credential is deleted with it.',
296
+ 'chan.rpc.unavailable': 'This host exposes no connection service, so channel actions are unavailable.',
297
+ 'nav.tab.ledger': 'Dashboard',
298
+ 'nav.tab.logs': 'Request log',
299
+ 'nav.tab.gateway': 'Gateway',
300
+ 'chan.titleSingle': 'Channel',
301
+ 'dash.title': 'Usage dashboard',
302
+ 'dash.sub': 'Token spend and inference metrics for the channel models: input/output/reasoning/cache, pivoted by account and by model.',
303
+ 'dash.today': 'Today',
304
+ 'dash.all': 'All time',
305
+ 'dash.refresh': 'Refresh',
306
+ 'dash.kpiToday': 'Tokens today',
307
+ 'dash.kpiScopeAll': 'Tokens in scope',
308
+ 'dash.kpiCumulative': 'Tokens all time',
309
+ 'dash.kpiSpeed': 'Average speed',
310
+ 'dash.kpiCache': 'Context cache hit rate',
311
+ 'dash.kpiRequests': 'Requests & success rate',
312
+ 'dash.input': 'Input',
313
+ 'dash.output': 'Output',
314
+ 'dash.reasoning': 'Reasoning',
315
+ 'dash.ttft': 'TTFT',
316
+ 'dash.cacheTokens': 'Cache hits',
317
+ 'dash.successRate': 'Success',
318
+ 'dash.failed': 'Failed',
319
+ 'dash.recentTitle': 'Overview · Recent requests',
320
+ 'dash.recentHint': 'From the pack\'s per-request ledger: time, account, TTFT, speed and the token breakdown.',
321
+ 'dash.empty': 'Nothing yet — one conversation through a channel model starts the record.',
322
+ 'dash.accountsTitle': 'Per-account usage & model mix',
323
+ 'dash.accountsHint': 'Requests and token breakdown per account, with the most-used models.',
324
+ 'dash.modelsTitle': 'Model performance & usage',
325
+ 'dash.modelsHint': 'TTFT, speed and token statistics per model · usage share is by tokens spent.',
326
+ 'log.time': 'Time',
327
+ 'log.model': 'Model',
328
+ 'log.account': 'Account',
329
+ 'log.via': 'Via',
330
+ 'log.viaDirect': 'Chat',
331
+ 'log.viaGateway': 'Gateway',
332
+ 'log.result': 'Result',
333
+ 'log.ok': 'OK',
334
+ 'log.failed': 'Failed',
335
+ 'log.duration': 'Duration',
336
+ 'log.ttft': 'TTFT',
337
+ 'log.speed': 'Speed',
338
+ 'log.input': 'Input',
339
+ 'log.output': 'Output',
340
+ 'log.reasoning': 'Reasoning',
341
+ 'log.cache': 'Cache',
342
+ 'log.total': 'Total tok',
343
+ 'log.requests': 'Requests',
344
+ 'log.inputSlash': 'Input / Output / Reasoning',
345
+ 'log.cacheHit': 'Cache hit',
346
+ 'log.share': 'Share',
347
+ 'log.modelMix': 'Model mix',
348
+ 'log.unattributed': 'Unattributed',
349
+ 'logs.title': 'Request log',
350
+ 'logs.sub': 'Every request in detail: result, duration, TTFT, speed and the token breakdown; hover a failed row for the reason.',
351
+ 'logs.auto': 'Refresh every 10 s',
352
+ 'logs.count': '{total} entries · {shown} on this page',
353
+ 'logs.empty': 'No requests recorded yet.',
354
+ 'logs.page': 'Page {page} of {pages}',
355
+ 'logs.windowNote': 'Per-request rows cover a recent window only; history is kept as daily aggregates (~90 days) — the dashboard\'s "All time" reads those.',
356
+ 'gw.title': 'Gateway settings',
357
+ 'gw.sub': 'Serve the channel models over an OpenAI-compatible API to this machine and the LAN: endpoint, key and relay port live here.',
358
+ 'gw.gatewayTitle': 'Channel gateway (OpenAI compatible)',
359
+ 'gw.gatewayHint': 'Covers every connected channel; Chat Completions and Responses are both served.',
360
+ 'gw.running': 'Running',
361
+ 'gw.stopped': 'Not running',
362
+ 'gw.envBlocked': 'Disabled by environment',
363
+ 'gw.switch': 'Enable gateway',
364
+ 'gw.endpoint': 'Endpoint',
365
+ 'gw.key': 'API Key',
366
+ 'gw.show': 'Show',
367
+ 'gw.hide': 'Hide',
368
+ 'gw.keyNote': 'A plaintext credential for client configuration — handle with care.',
369
+ 'gw.keyNone': 'Not generated yet',
370
+ 'gw.keyNoneHint': 'Enabling the gateway once mints a key automatically.',
371
+ 'gw.models': 'Servable models',
372
+ 'gw.portNote': 'The port can be moved with the DSH_OPENAI_GATEWAY_PORT environment variable.',
373
+ 'gw.relayTitle': 'LAN relay (this plugin\'s)',
374
+ 'gw.relayHint': 'Re-expose the gateway on an address and port you choose: callers use the relay key below, and the gateway itself stays on the loopback.',
375
+ 'gw.relaySwitch': 'Enable LAN relay',
376
+ 'gw.relayBind': 'Bind address',
377
+ 'gw.bindLocal': 'This machine only (127.0.0.1)',
378
+ 'gw.bindLan': 'LAN (0.0.0.0)',
379
+ 'gw.relayPort': 'Port',
380
+ 'gw.relayUrl': 'Base URL',
381
+ 'gw.relayKey': 'Relay key',
382
+ 'gw.rotate': 'Rotate',
383
+ 'gw.relayNote': 'The relay forwards only the model routes (/v1/*) and demands the relay key; binding to the LAN means every device on the network can reach that port.',
384
+ 'chan.credits.left': 'Credits left',
385
+ 'chan.credits.tokens': 'Tokens left',
386
+ 'chan.credits.dollars': 'Balance left (USD)',
387
+ 'chan.credits.quota': 'Quota left',
388
+ 'chan.credits.loaded': '{count} accounts queried',
389
+ 'chan.credits.refresh': 'Refresh balance',
390
+ 'chan.credits.loading': 'Querying balance…',
391
+ 'chan.credits.failed': 'Balance query failed: {reason}',
392
+ 'chan.credits.partial': 'Could not query {count} accounts. Expand accounts to see the reasons and retry.',
393
+ 'chan.credits.unavailable': 'No balance data returned',
394
+ 'chan.claim.failed': 'Claim failed: {reason}',
395
+ 'chan.auto.title': 'Daily auto check-in',
396
+ 'chan.auto.running': 'Check-in running…',
397
+ 'chan.auto.ran': 'Checked in today',
398
+ 'chan.auto.off': 'Not checked in today',
399
+ 'chan.auto.last': 'Last result: {result}',
400
+ },
401
+ }
402
+
403
+ // ── styles ────────────────────────────────────────────────────────────────
404
+ // Two theme variables are not defined by every shell — measured in the web
405
+ // shell this plugin ships against, `--dsw-alias-state-warning-primary` and
406
+ // `--dsw-alias-label-on-accent` resolve to nothing. A declaration whose
407
+ // var() is invalid at computed-value time is dropped *whole*, so without a
408
+ // fallback every warning-coloured surface disappears: the pool tank's water
409
+ // (level "busy") rendered as an empty box, the region-limited badge lost its
410
+ // colour, callouts lost their border. Every use of those two names carries a
411
+ // fallback for exactly that reason.
412
+ const CSS = `
413
+ /* ═══════════════════════════════════════════════════════════════════════
414
+ 模型接入 — visual system
415
+ 统一令牌:所有色值取自宿主 --dsw-alias-* 变量,昼夜由宿主切换。
416
+ 层级约定:layer-3 凹槽/页面底 · layer-2 面板 · layer-1 浮起元素。
417
+ 动效约定:transform/opacity 优先;常规 150–300ms、覆盖层 300–400ms。
418
+ ═══════════════════════════════════════════════════════════════════════ */
419
+ .ofm_root{--ease-instrument:cubic-bezier(.16,1,.3,1);--ease-settle:cubic-bezier(.34,1.4,.4,1);--gap:14px;display:flex;flex-direction:column;gap:calc(var(--gap)*1.4);max-width:1080px;font-size:13px;line-height:1.55;color:var(--dsw-alias-label-primary);-webkit-font-smoothing:antialiased}
420
+ .ofm_root::before{content:"";position:fixed;inset:0;z-index:0;pointer-events:none;opacity:.022;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E")}
421
+ .ofm_root>*{position:relative;z-index:1}
422
+ .ofm_root *{box-sizing:border-box}
423
+ .ofm_root ::-webkit-scrollbar{width:10px;height:10px}
424
+ .ofm_root ::-webkit-scrollbar-track{background:transparent}
425
+ .ofm_root ::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--dsw-alias-label-tertiary) 32%,transparent);border-radius:99px;border:2.5px solid transparent;background-clip:padding-box}
426
+ .ofm_root ::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--dsw-alias-label-tertiary) 52%,transparent);background-clip:padding-box;border:2.5px solid transparent}
427
+ .ofm_root{scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--dsw-alias-label-tertiary) 32%,transparent) transparent}
428
+
429
+ .ofm_root ::selection{background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 24%,transparent)}
430
+ /* ── 键盘可达性:只给键盘聚焦画聚焦环,鼠标点击不出现 ─────────────────── */
431
+ .ofm_root :focus-visible{outline:2px solid color-mix(in srgb,var(--dsw-alias-state-business-primary) 78%,transparent);outline-offset:2px;box-shadow:0 0 0 4px color-mix(in srgb,var(--dsw-alias-state-business-primary) 13%,transparent)}
432
+ /* ══ 页头 hero ═════════════════════════════════════════════════════════ */
433
+ .ofm_hero{position:relative;display:flex;flex-direction:column;gap:14px;padding:22px 24px;border-radius:20px;border:1px solid color-mix(in srgb,var(--dsw-alias-border-l2) 78%,transparent);background:linear-gradient(165deg,color-mix(in srgb,var(--dsw-alias-bg-layer-3) 88%,transparent),color-mix(in srgb,var(--dsw-alias-bg-layer-1) 82%,transparent));overflow:hidden}
434
+ .ofm_hero::before{content:"";position:absolute;inset:0;pointer-events:none;background:radial-gradient(120% 150% at 12% -20%,color-mix(in srgb,var(--dsw-alias-state-business-primary) 13%,transparent),transparent 58%),radial-gradient(90% 120% at 88% 130%,color-mix(in srgb,var(--dsw-alias-state-success-primary) 7%,transparent),transparent 60%)}
435
+ .ofm_hero>*{position:relative}
436
+ .ofm_pagehead{display:flex;align-items:flex-end;gap:14px;flex-wrap:wrap}
437
+ .ofm_pagetitle{display:flex;flex-direction:column;gap:6px;min-width:0}
438
+ .ofm_pagetitle h2{margin:0;font-size:23px;font-weight:760;letter-spacing:-.6px;line-height:1.2;background:linear-gradient(120deg,var(--dsw-alias-label-primary) 20%,color-mix(in srgb,var(--dsw-alias-label-primary) 55%,var(--dsw-alias-state-business-primary)));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}
439
+ .ofm_pagesub{margin:0;font-size:12.5px;color:var(--dsw-alias-label-secondary);max-width:70ch}
440
+ .ofm_pagehead .ofm_pills{margin-left:auto}
441
+ .ofm_pills{display:flex;gap:6px;flex-wrap:wrap;margin-left:auto}
442
+ .ofm_pill{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:999px;border:1px solid var(--dsw-alias-border-l1);background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 78%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 4%);font-size:11.5px;color:var(--dsw-alias-label-secondary);white-space:nowrap;transition:border-color .16s ease,color .16s ease}
443
+ .ofm_pill.strong{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2)}
444
+ .ofm_dot{width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-label-tertiary);flex:none}
445
+
446
+ .ofm_dot.ok{background:var(--dsw-alias-state-success-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--dsw-alias-state-success-primary) 18%,transparent);}
447
+ .ofm_dot.warn{background:var(--dsw-alias-state-warning-primary,#f0a441);box-shadow:0 0 0 3px color-mix(in srgb,var(--dsw-alias-state-warning-primary,#f0a441) 18%,transparent)}
448
+ .ofm_dot.err{background:var(--dsw-alias-state-error-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--dsw-alias-state-error-primary) 18%,transparent)}
449
+ /* ══ 区块与分节 ════════════════════════════════════════════════════════ */
450
+ .ofm_sec{display:flex;flex-direction:column;gap:10px}
451
+ .ofm_sechead{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;padding-bottom:6px;border-bottom:1px solid var(--dsw-alias-border-l1)}
452
+ .ofm_sec_title{font-size:14px;font-weight:680;letter-spacing:-.2px}
453
+ .ofm_sec_hint{font-size:11.5px;color:var(--dsw-alias-label-tertiary);margin-left:auto}
454
+ .ofm_badge{margin-left:auto;font-size:10.5px;font-weight:600;padding:2px 8px;border-radius:999px;border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);background:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 60%,transparent);white-space:nowrap}
455
+ .ofm_badge.available{color:var(--dsw-alias-state-success-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-success-primary) 45%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 10%,transparent)}
456
+ .ofm_badge.region-blocked{color:var(--dsw-alias-state-warning-primary,#f0a441);border-color:color-mix(in srgb,var(--dsw-alias-state-warning-primary,#f0a441) 45%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-warning-primary,#f0a441) 10%,transparent)}
457
+ .ofm_badge.throttled,.ofm_badge.unavailable{color:var(--dsw-alias-state-error-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary) 45%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 10%,transparent)}
458
+ .ofm_badge.unknown{color:var(--dsw-alias-label-tertiary)}
459
+ .ofm_id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;color:var(--dsw-alias-label-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
460
+ .ofm_note{font-size:11px;color:var(--dsw-alias-label-tertiary);line-height:1.5}
461
+ /* ══ 面板 ══════════════════════════════════════════════════════════════ */
462
+ .ofm_panel{padding:16px;border-radius:16px;border:1px solid var(--dsw-alias-border-l2);background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 82%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 5%),0 2px 6px rgb(0 0 0 / 4%);display:flex;flex-direction:column;gap:12px}
463
+ .ofm_paneltitle{font-size:12px;font-weight:680;letter-spacing:.2px;color:var(--dsw-alias-label-secondary);display:flex;align-items:center;gap:8px}
464
+ .ofm_paneltitle .ofm_sec_hint{font-weight:400;letter-spacing:0}
465
+ .ofm_row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
466
+ /* ══ 分段选择器 ════════════════════════════════════════════════════════ */
467
+ .ofm_seg{display:inline-flex;padding:3px;border-radius:10px;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);gap:2px;box-shadow:inset 0 1px 2px rgb(0 0 0 / 5%)}
468
+ .ofm_seg button{border:0;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11.5px;font-weight:550;padding:3px 11px;border-radius:8px;cursor:pointer;transition:color .16s ease,background .16s ease,box-shadow .16s ease}
469
+ .ofm_seg button:hover{color:var(--dsw-alias-label-primary)}
470
+ .ofm_seg button[aria-pressed="true"]{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);box-shadow:0 1px 3px rgb(0 0 0 / 12%),inset 0 1px 0 rgb(255 255 255 / 6%)}
471
+ /* ══ 数据表格 ══════════════════════════════════════════════════════════ */
472
+ .ofm_table{width:100%;min-width:760px;border-collapse:collapse;font-size:11.5px}
473
+ .ofm_tablewrap{overflow-x:auto;max-width:100%}
474
+ .ofm_table th{text-align:left;font-weight:560;font-size:10.5px;letter-spacing:.4px;text-transform:uppercase;color:var(--dsw-alias-label-tertiary);padding:0 10px 8px;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap}
475
+ .ofm_table td{padding:7px 10px;border-bottom:1px solid color-mix(in srgb,var(--dsw-alias-border-l1) 62%,transparent);font-variant-numeric:tabular-nums}
476
+ .ofm_table td:first-child{font-weight:600}
477
+ .ofm_table tbody tr{transition:background .15s ease}
478
+ .ofm_table tbody tr:hover td{background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 5%,transparent)}
479
+ .ofm_table tr:last-child td{border-bottom:0}
480
+ .ofm_num{text-align:right}
481
+ /* ══ 按钮(分层状态) ══════════════════════════════════════════════════ */
482
+ .ofm_btn{font:inherit;font-size:12px;font-weight:580;padding:6px 14px;border-radius:9px;border:1px solid var(--dsw-alias-border-l2);background:color-mix(in srgb,var(--dsw-alias-bg-layer-3) 84%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 5%),0 1px 2px rgb(0 0 0 / 6%);color:var(--dsw-alias-label-primary);cursor:pointer;transition:transform .18s var(--ease-instrument),border-color .2s var(--ease-instrument),background .2s var(--ease-instrument),box-shadow .22s var(--ease-instrument),opacity .16s ease}
483
+ .ofm_btn:hover:not(:disabled){border-color:color-mix(in srgb,var(--dsw-alias-state-business-primary) 62%,var(--dsw-alias-border-l2));background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 7%,var(--dsw-alias-bg-layer-3));transform:translateY(-1px);box-shadow:inset 0 1px 0 rgb(255 255 255 / 7%),0 3px 8px rgb(0 0 0 / 9%)}
484
+ .ofm_btn:active:not(:disabled){transform:scale(.985);transition-duration:.1s;box-shadow:inset 0 1px 0 rgb(255 255 255 / 4%)}
485
+ .ofm_btn:disabled{opacity:.45;cursor:default;box-shadow:none;transform:none}
486
+ .ofm_btn.primary{background:linear-gradient(180deg,color-mix(in srgb,var(--dsw-alias-state-business-primary) 88%,#fff),var(--dsw-alias-state-business-primary));border-color:color-mix(in srgb,var(--dsw-alias-state-business-primary) 82%,#000);color:var(--dsw-alias-label-on-accent,#fff);box-shadow:inset 0 1px 0 rgb(255 255 255 / 18%),0 2px 8px color-mix(in srgb,var(--dsw-alias-state-business-primary) 32%,transparent)}
487
+ .ofm_btn.primary:hover:not(:disabled){background:linear-gradient(180deg,var(--dsw-alias-state-business-primary),color-mix(in srgb,var(--dsw-alias-state-business-primary) 88%,#000));border-color:var(--dsw-alias-state-business-primary);box-shadow:inset 0 1px 0 rgb(255 255 255 / 20%),0 4px 14px color-mix(in srgb,var(--dsw-alias-state-business-primary) 42%,transparent)}
488
+ .ofm_btn.ghost{background:transparent;box-shadow:none;border-color:transparent;color:var(--dsw-alias-label-secondary)}
489
+ .ofm_btn.ghost:hover:not(:disabled){background:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 80%,transparent);border-color:var(--dsw-alias-border-l1);color:var(--dsw-alias-label-primary)}
490
+ .ofm_minibtn{font:inherit;font-size:11px;font-weight:540;padding:3px 9px;border-radius:8px;border:1px solid color-mix(in srgb,var(--dsw-alias-border-l2) 85%,transparent);background:color-mix(in srgb,var(--dsw-alias-bg-layer-3) 70%,transparent);color:var(--dsw-alias-label-secondary);cursor:pointer;transition:transform .12s ease,border-color .16s ease,color .16s ease,background .16s ease,opacity .16s ease}
491
+ .ofm_minibtn:hover:not(:disabled){border-color:color-mix(in srgb,var(--dsw-alias-state-business-primary) 60%,transparent);color:var(--dsw-alias-label-primary);background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 7%,transparent);transform:translateY(-1px)}
492
+ .ofm_minibtn:active:not(:disabled){transform:scale(.96)}
493
+ .ofm_minibtn:disabled{opacity:.45;cursor:default;transform:none}
494
+ .ofm_minibtn.danger:hover:not(:disabled){border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary) 60%,transparent);color:var(--dsw-alias-state-error-primary);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 7%,transparent)}
495
+ /* ══ 表单 ══════════════════════════════════════════════════════════════ */
496
+ .ofm_field{display:flex;flex-direction:column;gap:4px;min-width:120px}
497
+ .ofm_field>span{font-size:11px;color:var(--dsw-alias-label-tertiary)}
498
+ .ofm_input{font:inherit;font-size:12px;padding:6px 10px;border-radius:9px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);box-shadow:inset 0 1px 2px rgb(0 0 0 / 5%);color:var(--dsw-alias-label-primary);min-width:0;width:100%;transition:border-color .16s ease,box-shadow .16s ease}
499
+ .ofm_input::placeholder{color:var(--dsw-alias-label-tertiary)}
500
+ .ofm_input:hover{border-color:color-mix(in srgb,var(--dsw-alias-border-l2) 60%,var(--dsw-alias-label-tertiary))}
501
+ .ofm_input:focus{outline:none;border-color:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--dsw-alias-state-business-primary) 20%,transparent)}
502
+ /* ══ 开关(spring 滑块) ═══════════════════════════════════════════════ */
503
+ .ofm_switch{display:inline-flex;align-items:center;gap:9px;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent}
504
+ .ofm_switch i{width:36px;height:20px;border-radius:999px;background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);box-shadow:inset 0 1px 3px rgb(0 0 0 / 8%);position:relative;transition:background .2s ease,border-color .2s ease,box-shadow .2s ease;flex:none}
505
+ .ofm_switch:hover i{filter:brightness(1.05)}
506
+ .ofm_switch[aria-checked="true"]:hover i{filter:brightness(1.08)}
507
+ .ofm_switch i::after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:var(--dsw-alias-label-secondary);box-shadow:0 1px 3px rgb(0 0 0 / 22%);transition:transform .26s cubic-bezier(.34,1.3,.64,1),background .2s ease,width .16s ease}
508
+ .ofm_switch:active i::after{width:17px}
509
+ .ofm_switch[aria-checked="true"] i{background:var(--dsw-alias-state-business-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-business-primary) 85%,#000);box-shadow:inset 0 1px 3px rgb(0 0 0 / 12%)}
510
+ .ofm_switch[aria-checked="true"] i::after{transform:translateX(16px);background:#fff}
511
+ .ofm_switch[aria-checked="true"]:active i::after{transform:translateX(13px)}
512
+ .ofm_switch:focus-visible i{box-shadow:0 0 0 3px color-mix(in srgb,var(--dsw-alias-state-business-primary) 22%,transparent)}
513
+ .ofm_mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;padding:7px 10px;border-radius:9px;background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l1);overflow-x:auto;white-space:pre;color:var(--dsw-alias-label-secondary)}
514
+ /* ══ 提示条 ════════════════════════════════════════════════════════════ */
515
+ .ofm_callout{display:flex;gap:9px;padding:10px 12px;border-radius:11px;border:1px solid color-mix(in srgb,var(--dsw-alias-state-warning-primary,#f0a441) 45%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-warning-primary,#f0a441) 9%,transparent);font-size:11.5px;line-height:1.5;color:var(--dsw-alias-label-primary)}
516
+ .ofm_error{border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary) 45%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 9%,transparent)}
517
+ /* ══ 公告(首次引导) ══════════════════════════════════════════════════ */
518
+ /* The onboarding slot is mounted inside the collapsed sidebar foot of the shell,
519
+ so a card that stays in flow inherits a 55 px-wide, overflow-hidden column. The
520
+ scrim is therefore fixed to the viewport; the shell sets no transform, filter
521
+ or contain on any ancestor, so nothing re-anchors it. Mask colour, blur and
522
+ z-index mirror the Modal layer of the shell so this reads as first-party. */
523
+ .ofm_scrim{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;padding:24px;box-sizing:border-box;background:var(--dsw-alias-bg-mask-1, rgb(0 0 0 / 32%));}
524
+
525
+ /* ══ Toast(fixed 到视口,浮在所有层之上) ════════════════════════════ */
526
+ .ofm_toasts{position:fixed;right:18px;bottom:18px;z-index:1200;display:flex;flex-direction:column;gap:10px;max-width:min(380px,calc(100vw - 36px));font-family:inherit}
527
+ .ofm_toast{position:relative;display:flex;flex-direction:column;gap:6px;padding:12px 14px 12px 16px;border-radius:13px;border:1px solid var(--dsw-alias-border-l2);background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 94%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 7%),0 14px 40px rgb(0 0 0 / 26%);font-size:12.5px;line-height:1.5;color:var(--dsw-alias-label-primary);overflow:hidden}
528
+ .ofm_toast{transform-origin:bottom right;will-change:transform}
529
+ .ofm_toast::before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--dsw-alias-state-business-primary)}
530
+ .ofm_toast.warn::before{background:var(--dsw-alias-state-warning-primary,#f0a441)}
531
+ .ofm_toast.urgent::before{background:var(--dsw-alias-state-error-primary)}
532
+ .ofm_toast.warn{border-color:color-mix(in srgb,var(--dsw-alias-state-warning-primary,#f0a441) 42%,var(--dsw-alias-border-l2))}
533
+ .ofm_toast.urgent{border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary) 42%,var(--dsw-alias-border-l2))}
534
+ .ofm_toast .ofm_toasttitle{font-weight:660;font-size:12.5px;display:flex;align-items:center;gap:7px}
535
+ .ofm_toast .ofm_toastbody{color:var(--dsw-alias-label-secondary);max-height:180px;overflow:auto;overflow-wrap:anywhere}
536
+ .ofm_toast .ofm_toastbody p{margin:0 0 5px}
537
+ .ofm_toast .ofm_toastbody p:last-child{margin-bottom:0}
538
+ .ofm_toast .ofm_toastbody img{max-width:100%}
539
+ .ofm_toastactions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
540
+ .ofm_toastclose{margin-left:auto;background:transparent;border:0;color:var(--dsw-alias-label-tertiary);cursor:pointer;font:inherit;font-size:13px;padding:0 2px;transition:color .14s ease}
541
+ .ofm_toastclose:hover{color:var(--dsw-alias-label-primary)}
542
+ /* ══ 模态 ══════════════════════════════════════════════════════════════ */
543
+ .ofm_modal{width:min(520px,92vw);max-height:min(80vh,600px);border-radius:18px;border:1px solid var(--dsw-alias-border-l2);background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 95%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 8%),0 28px 80px rgb(0 0 0 / 42%);display:flex;flex-direction:column;overflow:hidden;}
544
+ .ofm_modalhead{padding:17px 20px 11px;display:flex;align-items:center;gap:10px;font-size:15px;font-weight:720;letter-spacing:-.2px}
545
+ .ofm_modalbody{padding:4px 20px 16px;overflow:auto;font-size:12.5px;line-height:1.7;color:var(--dsw-alias-label-secondary)}
546
+ .ofm_modalbody p{margin:0 0 6px}
547
+ .ofm_modalfoot{display:flex;justify-content:flex-end;gap:8px;padding:12px 20px;border-top:1px solid var(--dsw-alias-border-l1);background:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 72%,transparent)}
548
+ @media (max-width:720px){.ofm_sec_hint{margin-left:0;width:100%}.ofm_pills{margin-left:0;width:100%}}
549
+
550
+ /* ══ 四页外壳:导航 · 页过渡 ═══════════════════════════════════════════ */
551
+ .ofm_shell{position:relative;display:flex;flex-direction:column;gap:18px;max-width:1120px;isolation:isolate}
552
+
553
+ .ofm_nav{position:sticky;top:0;z-index:30;display:grid;grid-template-columns:1fr auto;align-items:center;gap:8px 12px;padding:10px 12px;border-radius:16px;border:1px solid color-mix(in srgb,var(--dsw-alias-border-l2) 82%,transparent);background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 62%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 7%),0 8px 26px rgb(0 0 0 / 10%)}
554
+ .ofm_navbrand{display:flex;align-items:center;gap:9px;font-weight:700;font-size:14px;letter-spacing:-.2px;white-space:nowrap}
555
+ .ofm_navmark{width:26px;height:26px;border-radius:9px;display:grid;place-items:center;flex:none;background:linear-gradient(145deg,var(--dsw-alias-state-business-primary),color-mix(in srgb,var(--dsw-alias-state-business-primary) 42%,#3ECFA0));box-shadow:0 4px 12px color-mix(in srgb,var(--dsw-alias-state-business-primary) 40%,transparent),inset 0 1px 0 rgb(255 255 255 / 22%)}
556
+ .ofm_navmark svg{width:16px;height:16px;fill:#fff}
557
+ .ofm_tabs{position:relative;grid-column:1 / -1;display:flex;flex-wrap:wrap;gap:2px;padding:3px;border-radius:13px;border:1px solid color-mix(in srgb,var(--dsw-alias-border-l1) 80%,transparent);background:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 62%,transparent);box-shadow:inset 0 1px 2px rgb(0 0 0 / 4%)}
558
+ .ofm_tabglider{position:absolute;top:0;left:0;border-radius:10px;background:linear-gradient(150deg,color-mix(in srgb,var(--dsw-alias-bg-layer-3) 92%,transparent),color-mix(in srgb,var(--dsw-alias-bg-layer-2) 88%,transparent));box-shadow:0 3px 10px rgb(0 0 0 / 14%),inset 0 1px 0 rgb(255 255 255 / 9%);transition:transform .34s cubic-bezier(.22,.61,.36,1),width .34s cubic-bezier(.22,.61,.36,1),height .34s cubic-bezier(.22,.61,.36,1);pointer-events:none}
559
+ .ofm_tab{position:relative;z-index:1;font:inherit;font-size:12px;font-weight:600;padding:6px 13px;border-radius:10px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;white-space:nowrap;transition:color .2s ease}
560
+ .ofm_tab[data-on="true"]{color:var(--dsw-alias-label-primary)}
561
+ .ofm_tab:hover{color:var(--dsw-alias-label-primary)}
562
+ .ofm_tab .ofm_tabnum{font-variant-numeric:tabular-nums;font-weight:600;color:var(--dsw-alias-label-tertiary);margin-left:6px;font-size:11px}
563
+ .ofm_navspacer{display:none}
564
+ .ofm_page{display:flex;flex-direction:column;gap:20px;}
565
+ /* ── 玻璃表面:半透明叠层,大块面与小卡片共用一套底色 ─────────────── */
566
+ .ofm_glass{background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 68%,transparent);border:1px solid color-mix(in srgb,var(--dsw-alias-border-l2) 78%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 6%),0 12px 34px rgb(0 0 0 / 9%)}.ofm_root .ofm_hero,.ofm_root .ofm_panel,.ofm_root .ofm_modal{background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 70%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 7%),0 14px 40px rgb(0 0 0 / 10%)}
567
+ /* ══ 渠道接入页 ════════════════════════════════════════════════════════ */
568
+ .ofm_chanwrap{display:grid;grid-template-columns:repeat(auto-fill,minmax(330px,1fr));gap:14px}
569
+ .ofm_chan{position:relative;display:flex;flex-direction:column;gap:12px;padding:16px 17px 15px;border-radius:16px;border:1px solid var(--dsw-alias-border-l2);background:color-mix(in srgb,var(--dsw-alias-bg-layer-3) 78%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 5%),0 1px 2px rgb(0 0 0 / 5%);overflow:hidden;transition:transform .22s cubic-bezier(.32,.72,0,1),box-shadow .24s ease,border-color .2s ease}
570
+ .ofm_chan::before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:linear-gradient(90deg,var(--chan-accent,var(--dsw-alias-state-business-primary)),transparent 78%);opacity:.95}
571
+ .ofm_chan:hover{transform:translateY(-3px);box-shadow:inset 0 1px 0 rgb(255 255 255 / 8%),0 18px 40px rgb(0 0 0 / 15%);border-color:color-mix(in srgb,var(--chan-accent,var(--dsw-alias-state-business-primary)) 55%,transparent)}
572
+ .ofm_chan.off{opacity:.62}
573
+ .ofm_chanhead{display:flex;align-items:center;gap:11px}
574
+ .ofm_chanlogo{width:38px;height:38px;border-radius:12px;display:grid;place-items:center;flex:none;font-weight:800;font-size:13px;color:#fff;letter-spacing:-.3px;background:linear-gradient(150deg,var(--chan-accent,var(--dsw-alias-state-business-primary)),color-mix(in srgb,var(--chan-accent,var(--dsw-alias-state-business-primary)) 45%,#101828));box-shadow:0 6px 16px color-mix(in srgb,var(--chan-accent,var(--dsw-alias-state-business-primary)) 34%,transparent),inset 0 1px 0 rgb(255 255 255 / 22%)}
575
+ .ofm_chan:hover .ofm_chanlogo{transform:scale(1.06) rotate(-3deg);transition:transform .35s cubic-bezier(.34,1.56,.64,1)}
576
+ .ofm_chanlogo{transition:transform .35s cubic-bezier(.34,1.56,.64,1)}
577
+ .ofm_chanid{display:flex;flex-direction:column;gap:2px;min-width:0}
578
+ .ofm_chanid b{font-size:14px;font-weight:700;letter-spacing:-.2px}
579
+ .ofm_chanid span{font-size:11px;color:var(--dsw-alias-label-tertiary)}
580
+ .ofm_chanstate{margin-left:auto;display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--dsw-alias-label-secondary);padding:3px 10px;border-radius:999px;border:1px solid color-mix(in srgb,var(--dsw-alias-border-l1) 90%,transparent);background:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 70%,transparent);white-space:nowrap}
581
+ .ofm_chanmeta{display:flex;gap:14px;flex-wrap:wrap;font-size:11.5px;color:var(--dsw-alias-label-tertiary)}
582
+ .ofm_chanmeta b{color:var(--dsw-alias-label-secondary);font-weight:650;font-variant-numeric:tabular-nums}
583
+ .ofm_chanacts{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
584
+ .ofm_acctlist{display:flex;flex-direction:column;gap:6px}
585
+ .ofm_acct{display:flex;align-items:center;flex-wrap:wrap;gap:9px;padding:7px 10px;border-radius:11px;border:1px solid color-mix(in srgb,var(--dsw-alias-border-l1) 82%,transparent);background:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 62%,transparent);font-size:12px;transition:border-color .16s ease,background .16s ease}
586
+ .ofm_acct:hover{border-color:var(--dsw-alias-border-l2);background:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 88%,transparent)}
587
+ .ofm_acct.pending{border-style:dashed}
588
+ .ofm_acctname{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px}
589
+ .ofm_acctmeta{font-size:10.5px;color:var(--dsw-alias-label-tertiary);white-space:nowrap}
590
+ .ofm_balanceerror{flex-basis:100%;overflow-wrap:anywhere;color:var(--dsw-alias-state-error-primary);font-size:11px}
591
+ .ofm_acctacts{margin-left:auto;display:flex;gap:5px;flex-wrap:wrap}
592
+ .ofm_modellist{display:flex;flex-direction:column;gap:4px;max-height:238px;overflow:auto;padding-right:2px}
593
+ .ofm_modelrow{display:flex;align-items:center;gap:8px;padding:5px 8px;border-radius:9px;background:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 55%,transparent);font-size:11.5px;transition:background .15s ease}
594
+ .ofm_modelrow:hover{background:color-mix(in srgb,var(--dsw-alias-bg-layer-1) 85%,transparent)}
595
+ .ofm_modelrow.off{opacity:.5}
596
+ .ofm_modelrow .ofm_id{flex:1;min-width:0}
597
+ .ofm_tagpill{font-size:10px;font-weight:560;padding:1px 8px;border-radius:999px;border:1px solid color-mix(in srgb,var(--dsw-alias-border-l1) 90%,transparent);color:var(--dsw-alias-label-tertiary);white-space:nowrap}
598
+ .ofm_tagpill.free{color:var(--dsw-alias-state-success-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-success-primary) 55%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 8%,transparent)}
599
+ .ofm_tagpill.dead{color:var(--dsw-alias-state-error-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary) 55%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 8%,transparent)}
600
+ .ofm_chanfold{border-top:1px dashed color-mix(in srgb,var(--dsw-alias-border-l1) 85%,transparent);padding-top:10px;display:flex;flex-direction:column;gap:8px}
601
+ .ofm_foldtoggle{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:var(--dsw-alias-label-secondary);background:transparent;border:0;cursor:pointer;font-family:inherit;padding:0;transition:color .15s ease}
602
+ .ofm_foldtoggle svg{transition:transform .3s cubic-bezier(.32,.72,0,1)}
603
+ .ofm_foldtoggle:hover svg{transform:translateY(1px)}
604
+ .ofm_foldtoggle:hover{color:var(--dsw-alias-label-primary)}
605
+ .ofm_foldtoggle svg{width:10px;height:10px;fill:currentColor;transition:transform .22s ease}
606
+ .ofm_foldtoggle[data-open="true"] svg{transform:rotate(90deg)}
607
+ /* ══ 骨架屏 ════════════════════════════════════════════════════════════ */
608
+ .ofm_skel{position:relative;overflow:hidden;border-radius:12px;background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 60%,transparent);border:1px solid color-mix(in srgb,var(--dsw-alias-border-l1) 60%,transparent);min-height:96px;}
609
+ .ofm_skel::after{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(100deg,transparent 30%,color-mix(in srgb,var(--dsw-alias-bg-layer-1) 55%,transparent) 50%,transparent 70%);transform:translateX(-100%);}
610
+
611
+ .ofm_skel::after{content:"";position:absolute;inset:0;background:linear-gradient(100deg,transparent,rgb(255 255 255 / 8%) 42%,transparent 74%);}
612
+
613
+ /* ══ 登录引导 ══════════════════════════════════════════════════════════ */
614
+ .ofm_loginbody{display:flex;flex-direction:column;gap:14px}
615
+ .ofm_loginstep{display:flex;gap:11px;align-items:flex-start;font-size:12.5px;line-height:1.6;color:var(--dsw-alias-label-secondary)}
616
+ .ofm_loginstep b{flex:none;width:21px;height:21px;border-radius:50%;display:grid;place-items:center;font-size:11px;font-weight:650;background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 14%,transparent);border:1px solid color-mix(in srgb,var(--dsw-alias-state-business-primary) 35%,transparent);color:var(--dsw-alias-state-business-primary)}
617
+ .ofm_scanline{}
618
+
619
+ /* ══ 数据看板 KPI ══════════════════════════════════════════════════════ */
620
+ .ofm_kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}
621
+ .ofm_kpi{display:flex;flex-direction:column;gap:6px;padding:15px 17px;border-radius:16px;border:1px solid var(--dsw-alias-border-l2);background:color-mix(in srgb,var(--dsw-alias-bg-layer-3) 78%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 5%),0 1px 2px rgb(0 0 0 / 5%);transition:transform .22s cubic-bezier(.32,.72,0,1),box-shadow .24s ease,border-color .2s ease}
622
+ .ofm_kpi:hover{transform:translateY(-2px);border-color:color-mix(in srgb,var(--dsw-alias-state-business-primary) 45%,var(--dsw-alias-border-l2));box-shadow:inset 0 1px 0 rgb(255 255 255 / 8%),0 16px 36px rgb(0 0 0 / 13%)}
623
+ .ofm_kpilabel{font-size:11px;font-weight:560;letter-spacing:.4px;text-transform:uppercase;color:var(--dsw-alias-label-tertiary)}
624
+ .ofm_kpivalue{font-size:25px;font-weight:760;letter-spacing:-.7px;line-height:1.15;font-variant-numeric:tabular-nums;background:linear-gradient(120deg,var(--dsw-alias-label-primary),color-mix(in srgb,var(--dsw-alias-state-business-primary) 55%,var(--dsw-alias-label-primary)));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}
625
+ .ofm_kpi:hover .ofm_kpivalue{transform:translateY(-1px);transition:transform .3s cubic-bezier(.34,1.56,.64,1)}
626
+ .ofm_kpivalue{transition:transform .3s cubic-bezier(.34,1.56,.64,1);display:inline-block}
627
+ .ofm_kpisub{font-size:11px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}
628
+ .ofm_kpi.warn .ofm_kpivalue{-webkit-text-fill-color:var(--dsw-alias-state-warning-primary,#f0a441);background:none}
629
+ .ofm_logfailed td{background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 5%,transparent)}
630
+ /* ══ 真实图标与积分展示 ════════════════════════════════════════════════ */
631
+ .ofm_navmark img,.ofm_chanlogo img{width:100%;height:100%;object-fit:cover;border-radius:inherit;display:block}
632
+ .ofm_chanlogo{padding:0;overflow:hidden}
633
+ .ofm_credittotal b{color:var(--dsw-alias-state-success-primary);font-variant-numeric:tabular-nums}
634
+ .ofm_creditbadge{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;font-weight:600;padding:2px 9px;border-radius:999px;border:1px solid color-mix(in srgb,var(--dsw-alias-state-warning-primary,#f0a441) 50%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-warning-primary,#f0a441) 9%,transparent);color:var(--dsw-alias-state-warning-primary,#f0a441);white-space:nowrap}
635
+ .ofm_creditbadge.strong{max-width:100%;white-space:normal;overflow-wrap:anywhere;color:var(--dsw-alias-state-success-primary);border-color:color-mix(in srgb,var(--dsw-alias-state-success-primary) 50%,transparent);background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 9%,transparent)}
636
+ @media (max-width:760px){.ofm_tab{flex:1 1 auto;text-align:center}}
637
+ /* ══ 动效降级:用户系统开启"减少动态效果"时全部收敛 ═══════════════════ */
638
+ /* —— 交互锚点增强:激活态 / 状态色 / 加载态(additive,不改既有规则) —— */
639
+ /* tab:激活项在滑块底衬之上再补一道品牌下划线,选中更明确 */
640
+ .ofm_tab[aria-selected="true"]{color:var(--dsw-alias-label-primary)}
641
+ .ofm_tab[aria-selected="true"]::after{content:"";position:absolute;left:12px;right:12px;bottom:3px;height:2px;border-radius:2px;background:var(--dsw-alias-state-business-primary);opacity:.85;transition:opacity .18s cubic-bezier(.32,.72,0,1)}
642
+ /* 渠道卡:随接入状态着色顶部 hairline 与外发光(已接入=品牌色、关闭=灰、待接入=琥珀弱化) */
643
+ .ofm_chan[data-state="on"]::before{background:linear-gradient(90deg,var(--chan-accent,var(--dsw-alias-state-business-primary)),color-mix(in srgb,var(--chan-accent,var(--dsw-alias-state-business-primary)) 30%,transparent));opacity:1}
644
+ .ofm_chan[data-state="on"]{border-color:color-mix(in srgb,var(--chan-accent,var(--dsw-alias-state-business-primary)) 34%,var(--dsw-alias-border-l2))}
645
+ .ofm_chan[data-state="idle"]::before{background:linear-gradient(90deg,var(--dsw-alias-state-warning-primary,#f0a441),transparent);opacity:.6}
646
+ .ofm_chan[data-state="off"]::before{background:linear-gradient(90deg,var(--dsw-alias-label-tertiary),transparent);opacity:.5}
647
+ /* 按钮:异步进行中显示内联 spinner(aria-busy 锚点,文字仍保留占位避免布局跳动) */
648
+ .ofm_btn[aria-busy="true"]{position:relative;color:transparent !important;pointer-events:none}
649
+ .ofm_btn[aria-busy="true"]::after{content:"";position:absolute;left:50%;top:50%;width:13px;height:13px;margin:-6.5px 0 0 -6.5px;border-radius:50%;border:2px solid color-mix(in srgb,currentColor 30%,var(--dsw-alias-label-secondary));border-top-color:var(--dsw-alias-label-primary);}
650
+
651
+ @media (prefers-reduced-motion:reduce){.ofm_root *,.ofm_root *::before,.ofm_root *::after{transition-duration:.01ms !important}}
652
+ /* ═══ 精密仪器精修层(世界观:原厂仪器手感):颜色听宿主,质感在阻尼。曲线 --ease-instrument 冲得快落得稳,--ease-settle 极轻过冲。退场比进场快。 ═══ */
653
+ .ofm_glass{transition:border-color .22s var(--ease-instrument),box-shadow .26s var(--ease-instrument),transform .22s var(--ease-instrument),background .22s var(--ease-instrument)}
654
+ .ofm_glass:hover{border-color:color-mix(in srgb,var(--dsw-alias-border-l2) 92%,var(--dsw-alias-state-business-primary));box-shadow:0 1px 2px rgb(0 0 0 / 5%),0 10px 28px -14px color-mix(in srgb,var(--dsw-alias-state-business-primary) 18%,transparent)}
655
+ .ofm_kpi{transition:border-color .22s var(--ease-instrument),transform .22s var(--ease-instrument),box-shadow .26s var(--ease-instrument)}
656
+ .ofm_kpi:hover{transform:translateY(-1px)}
657
+ .ofm_kpivalue{transition:transform .3s var(--ease-settle),color .2s var(--ease-instrument);display:inline-block}
658
+ .ofm_kpi:hover .ofm_kpivalue{transform:translateY(-1px) scale(1.015);color:var(--dsw-alias-label-primary)}
659
+ .ofm_table tbody tr{transition:background .14s var(--ease-instrument)}.ofm_seg button{transition:background .2s var(--ease-instrument),color .2s var(--ease-instrument),border-color .2s var(--ease-instrument),box-shadow .22s var(--ease-settle)}
660
+ .ofm_minibtn{transition:transform .14s var(--ease-instrument),border-color .18s var(--ease-instrument),color .18s var(--ease-instrument),background .18s var(--ease-instrument)}
661
+ .ofm_minibtn:active:not(:disabled){transform:scale(.98);transition-duration:.09s}
662
+ .ofm_root input,.ofm_root select,.ofm_root textarea{transition:border-color .18s var(--ease-instrument),box-shadow .2s var(--ease-instrument),background .18s var(--ease-instrument)}
663
+ @media (prefers-reduced-motion:reduce){.ofm_glass,.ofm_kpi,.ofm_kpivalue,.ofm_minibtn{transition:none!important}.ofm_kpi:hover,.ofm_kpi:hover .ofm_kpivalue{transform:none}}
664
+
665
+ /* ==== V5 INSTRUMENT START ==== */
666
+ /* 精密仪器·样板间覆盖层:1px细边+内高光,无外投影;颜色全部听宿主 var(--dsw-alias-*)。
667
+ 夜(暗)高光更刃、纹理更显;昼(亮)高光收敛、纹理近乎哑。reduced-motion 去位移留状态。 */
668
+
669
+ /* ── ① 面板卡片 .ofm_panel ─────────────────────────────────────── */
670
+ /* 双基底:拉丝细纹(repeating-linear-gradient)垫底,实体色覆盖在上,从边缘隐约透出拉丝感 */
671
+ .ofm_root .ofm_panel{
672
+ background:
673
+ repeating-linear-gradient(115deg, rgb(255 255 255 / 4.5%) 0 1px, transparent 1px 2.5px) padding-box,
674
+ color-mix(in srgb, var(--dsw-alias-bg-layer-2) 86%, transparent) !important;
675
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 7%), inset 0 -14px 28px -18px rgb(0 0 0 / 16%) !important;
676
+ transition: border-color .22s var(--ease-instrument), box-shadow .26s var(--ease-instrument), transform .22s var(--ease-instrument) !important;
677
+ }
678
+
679
+ /* ── ② 按钮 .ofm_btn ─────────────────────────── */
680
+ /* kinetic tension:外壳 active 陷落(scale .985),内部 ::after 扫光条反向滑过形成"外陷内顶" */
681
+ .ofm_root .ofm_btn{
682
+ position: relative !important;
683
+ overflow: hidden !important;
684
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 7%) !important;
685
+ transition: transform .16s var(--ease-settle), border-color .2s var(--ease-instrument), background .2s var(--ease-instrument), box-shadow .2s var(--ease-instrument), opacity .16s var(--ease-instrument) !important;
686
+ }
687
+ .ofm_root .ofm_btn::after{
688
+ content: "" !important;
689
+ position: absolute !important;
690
+ top: 0 !important; bottom: 0 !important;
691
+ left: -60% !important; width: 42% !important;
692
+ background: linear-gradient(100deg, transparent, rgb(255 255 255 / 14%), transparent) !important;
693
+ transform: skewX(-18deg) !important;
694
+ transition: left .5s var(--ease-instrument) !important;
695
+ pointer-events: none !important;
696
+ }
697
+ /* hover:扫光滑过(exit slower than press);去掉原外投影,仅留顶部高光 */
698
+ .ofm_root .ofm_btn:hover:not(:disabled){
699
+ transform: translateY(-1px) !important;
700
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 10%) !important;
701
+ }
702
+ .ofm_root .ofm_btn:hover:not(:disabled)::after{
703
+ left: 118% !important;
704
+ }
705
+ /* active:快速陷落(.09s) + 内阴影加深=物理按压;松开靠 --ease-settle 回弹 */
706
+ .ofm_root .ofm_btn:active:not(:disabled){
707
+ transform: scale(.985) !important;
708
+ transition-duration: .09s !important;
709
+ box-shadow: inset 0 2px 5px rgb(0 0 0 / 14%), inset 0 1px 0 rgb(255 255 255 / 3%) !important;
710
+ }
711
+ /* primary 按钮保留主色渐变,仅把外投影换成更克制的内高光+轻凹槽 */
712
+ .ofm_root .ofm_btn.primary{
713
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 22%), inset 0 -10px 18px -12px rgb(0 0 0 / 24%) !important;
714
+ }
715
+ .ofm_root .ofm_btn.primary:hover:not(:disabled){
716
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 26%), inset 0 -10px 18px -12px rgb(0 0 0 / 18%) !important;
717
+ }
718
+
719
+ /* ── ③ 表格行 hover .ofm_table tbody tr ─────────────────────────── */
720
+ /* 行首 2px 主色竖条用 transform:scaleY 展开(不触发布局);exit(.12s) 比 entrance(.16s) 快 */
721
+ .ofm_root .ofm_table tbody tr{
722
+ transition: background .16s var(--ease-instrument) !important;
723
+ }
724
+ .ofm_root .ofm_table tbody tr td:first-child{
725
+ position: relative !important;
726
+ }
727
+ .ofm_root .ofm_table tbody tr td:first-child::before{
728
+ content: "" !important;
729
+ position: absolute !important;
730
+ left: 0 !important; top: 6px !important; bottom: 6px !important;
731
+ width: 2px !important; border-radius: 2px !important;
732
+ background: var(--dsw-alias-state-business-primary) !important;
733
+ transform: scaleY(0) !important;
734
+ transform-origin: center !important;
735
+ opacity: 0 !important;
736
+ transition: transform .16s var(--ease-instrument), opacity .12s var(--ease-instrument) !important;
737
+ pointer-events: none !important;
738
+ }
739
+ .ofm_root .ofm_table tbody tr:hover td:first-child::before{
740
+ transform: scaleY(1) !important;
741
+ opacity: 1 !important;
742
+ }
743
+ /* 数字列表针走格感:tabular-nums + pl5-tick 机械顿挫(steps) */
744
+ .ofm_root .ofm_table td{
745
+ font-variant-numeric: tabular-nums !important;
746
+ }
747
+ /* ── 昼(not-dark)收敛:高光更哑、拉丝更隐、回弹更小 ─────────────── */
748
+ @media not (prefers-color-scheme: dark){.ofm_root .ofm_panel{
749
+ background:
750
+ repeating-linear-gradient(115deg, rgb(255 255 255 / 4%) 0 1px, transparent 1px 2.5px) padding-box,
751
+ color-mix(in srgb, var(--dsw-alias-bg-layer-2) 90%, transparent) !important;
752
+ }
753
+ .ofm_root .ofm_panel{
754
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 45%), inset 0 -14px 28px -18px rgb(0 0 0 / 7%) !important;
755
+ }
756
+ .ofm_root .ofm_btn{
757
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 50%) !important;
758
+ }
759
+ .ofm_root .ofm_btn:hover:not(:disabled){
760
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 62%) !important;
761
+ }
762
+ }
763
+
764
+ /* ── reduced-motion 降级:去位移/回弹/扫光/顿挫,保留颜色与不透明度反馈 ── */
765
+ @media (prefers-reduced-motion: reduce){.ofm_root .ofm_panel,.ofm_root .ofm_btn,.ofm_root .ofm_table tbody tr,.ofm_root .ofm_table tbody tr td:first-child::before,.ofm_root .ofm_switch i,.ofm_root .ofm_switch i::after,.ofm_root .ofm_seg button,.ofm_root .ofm_input,.ofm_root .ofm_chanlogo{
766
+ transition: border-color .12s ease, background .12s ease, box-shadow .12s ease, opacity .12s ease, color .12s ease !important;
767
+ }.ofm_root .ofm_btn:hover:not(:disabled),.ofm_root .ofm_btn:active:not(:disabled),.ofm_root .ofm_seg button:active:not([aria-pressed="true"]),.ofm_root .ofm_chan:hover .ofm_chanlogo{
768
+ transform: none !important;
769
+ }
770
+ /* 开关捏扁还原 */
771
+ .ofm_root .ofm_switch:active i::after{
772
+ width: 14px !important;
773
+ }.ofm_root .ofm_btn::after{
774
+ content: none !important;
775
+ }
776
+ /* 呼吸灯停跳,但保留颜色状态 */
777
+ .ofm_root .ofm_dot.ok{
778
+
779
+ opacity: 1 !important;
780
+ }.ofm_root .ofm_kpi:hover .ofm_kpivalue{
781
+
782
+ }
783
+ }
784
+
785
+ /* ── ④ 输入框 .ofm_input:仪器凹槽手感 ─────────────────────────── */
786
+ /* 常态凹槽(inset 顶高光+底内阴影);focus 时凹槽不动,只换边色+外发光,像仪器被点亮 */
787
+ .ofm_root .ofm_input{
788
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 6%), inset 0 2px 6px -2px rgb(0 0 0 / 10%) !important;
789
+ transition: border-color .18s var(--ease-instrument), box-shadow .2s var(--ease-instrument), background .18s var(--ease-instrument) !important;
790
+ }
791
+ .ofm_root .ofm_input:hover{
792
+ border-color: color-mix(in srgb, var(--dsw-alias-border-l2) 55%, var(--dsw-alias-state-business-primary)) !important;
793
+ }
794
+ .ofm_root .ofm_input:focus{
795
+ border-color: var(--dsw-alias-state-business-primary) !important;
796
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 6%), inset 0 2px 6px -2px rgb(0 0 0 / 8%), 0 0 0 3px color-mix(in srgb, var(--dsw-alias-state-business-primary) 16%, transparent) !important;
797
+ }
798
+
799
+ /* ── ⑤ 开关 .ofm_switch:spring 滑块阻尼 ─────────────────────────── */
800
+ /* 滑块用 --ease-settle 带回弹;按下时滑块变宽=被"捏扁",松开回弹归位 */
801
+ .ofm_root .ofm_switch i{
802
+ box-shadow: inset 0 1px 3px rgb(0 0 0 / 10%), inset 0 -1px 0 rgb(255 255 255 / 4%) !important;
803
+ transition: background .22s var(--ease-instrument), border-color .22s var(--ease-instrument), box-shadow .22s var(--ease-instrument) !important;
804
+ }
805
+ .ofm_root .ofm_switch i::after{
806
+ background: var(--dsw-alias-label-primary) !important;
807
+ box-shadow: 0 1px 3px rgb(0 0 0 / 28%), inset 0 1px 0 rgb(255 255 255 / 20%) !important;
808
+ transition: transform .28s var(--ease-settle), background .2s var(--ease-instrument), width .14s var(--ease-instrument) !important;
809
+ }
810
+ .ofm_root .ofm_switch[aria-checked="true"] i{
811
+ box-shadow: inset 0 1px 3px rgb(0 0 0 / 14%), inset 0 -1px 0 rgb(255 255 255 / 8%) !important;
812
+ }
813
+ .ofm_root .ofm_switch[aria-checked="true"] i::after{
814
+ background: var(--dsw-alias-label-on-accent, #fff) !important;
815
+ }
816
+ .ofm_root .ofm_switch:active i::after{
817
+ width: 17px !important;
818
+ }.ofm_root .ofm_pill{
819
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%) !important;
820
+ transition: border-color .2s var(--ease-instrument), color .2s var(--ease-instrument), background .2s var(--ease-instrument), transform .18s var(--ease-settle) !important;
821
+ }
822
+ .ofm_root .ofm_badge{
823
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 6%) !important;
824
+ transition: border-color .2s var(--ease-instrument), color .2s var(--ease-instrument), background .2s var(--ease-instrument) !important;
825
+ }
826
+ /* 状态点呼吸灯保留,但改成 pl5- 前缀、机械顿挫更明显的两拍节奏 */
827
+
828
+ .ofm_root .ofm_dot.ok{
829
+
830
+ }
831
+ /* 分段控件选中块:加顶部高光,按下时微微陷落 */
832
+ .ofm_root .ofm_seg button[aria-pressed="true"]{
833
+ box-shadow: 0 1px 3px rgb(0 0 0 / 10%), inset 0 1px 0 rgb(255 255 255 / 8%) !important;
834
+ transition: color .18s var(--ease-instrument), background .18s var(--ease-instrument), box-shadow .2s var(--ease-settle) !important;
835
+ }
836
+ .ofm_root .ofm_seg button:active:not([aria-pressed="true"]){
837
+ transform: scale(.97) !important;
838
+ }
839
+
840
+ /* ── ⑦ 原生件接管:滚动条 / selection / caret / 聚焦环 ─────────────── */
841
+ /* 滚动条:仪器滑轨——thumb 加顶部高光与底部凹槽,hover 时轻微增亮 */
842
+ .ofm_root ::-webkit-scrollbar-thumb{
843
+ background: color-mix(in srgb, var(--dsw-alias-label-tertiary) 30%, transparent) !important;
844
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%), inset 0 -1px 0 rgb(0 0 0 / 10%) !important;
845
+ transition: background .2s var(--ease-instrument) !important;
846
+ }
847
+ .ofm_root ::-webkit-scrollbar-thumb:hover{
848
+ background: color-mix(in srgb, var(--dsw-alias-label-tertiary) 48%, transparent) !important;
849
+ }
850
+ /* 文本选择:主色薄涂,昼模式再淡一点避免刺眼 */
851
+ .ofm_root ::selection{
852
+ background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 20%, transparent) !important;
853
+ }
854
+ /* 光标:跟随主色 */
855
+ .ofm_root input, .ofm_root textarea{
856
+ caret-color: var(--dsw-alias-state-business-primary) !important;
857
+ }
858
+ /* 聚焦环:仪器刻度环——细环+外晕,用 --ease-instrument 淡入 */
859
+ .ofm_root :focus-visible{
860
+ outline: 2px solid color-mix(in srgb, var(--dsw-alias-state-business-primary) 72%, transparent) !important;
861
+ outline-offset: 2px !important;
862
+ box-shadow: 0 0 0 4px color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent) !important;
863
+ transition: box-shadow .18s var(--ease-instrument), outline-color .18s var(--ease-instrument) !important;
864
+ }
865
+
866
+ /* ── ⑧【师傅批改①】拉丝纹理增强:金属感要真的能摸到 ─────────────── */
867
+ /* 夜模式 3% → 4.5%,昼模式 1.5% → 2.8%,纹理间隔收紧让拉丝更密 */
868
+ .ofm_root .ofm_panel{
869
+ background:
870
+ repeating-linear-gradient(115deg, rgb(255 255 255 / 4.5%) 0 1px, transparent 1px 2.5px) padding-box,
871
+ color-mix(in srgb, var(--dsw-alias-bg-layer-2) 86%, transparent) !important;
872
+ }
873
+ @media not (prefers-color-scheme: dark){.ofm_root .ofm_panel{
874
+ background:
875
+ repeating-linear-gradient(115deg, rgb(255 255 255 / 4%) 0 1px, transparent 1px 2.5px) padding-box,
876
+ color-mix(in srgb, var(--dsw-alias-bg-layer-2) 90%, transparent) !important;
877
+ }
878
+ }
879
+
880
+ /* ── ⑧【师傅批改②】昼模式高光压暗:45-62% → 30-38%,更克制 ─────────── */
881
+ @media not (prefers-color-scheme: dark){
882
+ .ofm_root .ofm_panel{
883
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 34%), inset 0 -14px 28px -18px rgb(0 0 0 / 6%) !important;
884
+ }
885
+ .ofm_root .ofm_btn{
886
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 36%) !important;
887
+ }
888
+ .ofm_root .ofm_btn:hover:not(:disabled){
889
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 44%) !important;
890
+ }.ofm_root .ofm_pill,.ofm_root .ofm_badge{
891
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 30%) !important;
892
+ }
893
+ .ofm_root .ofm_input{
894
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 34%), inset 0 2px 6px -2px rgb(0 0 0 / 6%) !important;
895
+ }
896
+ }
897
+ /* 导航标:去掉 #3ECFA0 混色,改混 label-primary;外投影换成内高光+轻凹槽 */
898
+ .ofm_root .ofm_navmark{
899
+ background: linear-gradient(145deg, var(--dsw-alias-state-business-primary), color-mix(in srgb, var(--dsw-alias-state-business-primary) 58%, var(--dsw-alias-label-primary))) !important;
900
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 26%), inset 0 -6px 12px -8px rgb(0 0 0 / 20%) !important;
901
+ }
902
+ .ofm_root .ofm_navmark svg{
903
+ fill: var(--dsw-alias-label-on-accent, #fff) !important;
904
+ }
905
+ /* 渠道标:--chan-accent 兜底本来就是宿主变量,收编写死的 #fff / #101828,外投影换内高光 */
906
+ .ofm_root .ofm_chanlogo{
907
+ color: var(--dsw-alias-label-on-accent, #fff) !important;
908
+ background: linear-gradient(150deg, var(--chan-accent, var(--dsw-alias-state-business-primary)), color-mix(in srgb, var(--chan-accent, var(--dsw-alias-state-business-primary)) 52%, var(--dsw-alias-bg-layer-3))) !important;
909
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 24%), inset 0 -8px 14px -10px rgb(0 0 0 / 22%) !important;
910
+ transition: transform .3s var(--ease-settle) !important;
911
+ }
912
+ .ofm_root .ofm_chan:hover .ofm_chanlogo{
913
+ transform: scale(1.05) rotate(-2deg) !important;
914
+ }
915
+ /* 渠道卡顶条(::before 用 --chan-accent):收敛高度与发光,听宿主凹槽语言 */
916
+ .ofm_root .ofm_chan::before{
917
+ height: 2px !important;
918
+ box-shadow: 0 1px 0 rgb(255 255 255 / 6%) !important;
919
+ }
920
+ .ofm_root .ofm_chan[data-state="on"]{
921
+ border-color: color-mix(in srgb, var(--chan-accent, var(--dsw-alias-state-business-primary)) 30%, var(--dsw-alias-border-l2)) !important;
922
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 7%) !important;
923
+ }.ofm_root .ofm_kpivalue{
924
+ display: inline-block !important;
925
+ }.ofm_root .ofm_kpi:hover .ofm_kpivalue{
926
+
927
+ }
928
+
929
+ @media (prefers-reduced-motion:reduce){.ofm_kpi,.ofm_chan{transition:none}}
930
+ `
931
+
932
+ // ── helpers ───────────────────────────────────────────────────────────────
933
+ // 用页面 base 解析,而不是 origin-absolute 的「/api/...」:DSH 挂在反向代理
934
+ // 子路径下(https://<host>/<prefix>/)时,前导斜杠会把 <prefix> 丢掉,请求
935
+ // 直接打到站点根被前置网关 404,设置面板报「无法连接插件后端」(#54)。
936
+ // 相对路径随页面 base 走,根路径部署下与原值完全一致。解析不了(无 document
937
+ // 的宿主、非常规 base)就退回根路径原值——行为不比修复前差。
938
+ const API = (() => {
939
+ try { return new URL('api/our-free-model', document.baseURI).pathname } catch { return '/api/our-free-model' }
940
+ })()
941
+
942
+ async function api(path, options) {
943
+ // 8 秒超时兜底:后端路由未注册/挂起时 fetch 不再永久挂起——一个不响应的
944
+ // 端点否则会长期占用同源连接池。超时按 AbortError 抛给调用方,走各自
945
+ // .catch 降级路径;确实要等宿主跑完的慢路由可传 options.timeout 放宽。
946
+ const { timeout = 8000, ...fetchOptions } = options ?? {}
947
+ const ctrl = new AbortController()
948
+ const timer = setTimeout(() => ctrl.abort(), timeout)
949
+ try {
950
+ const response = await fetch(`${API}${path}`, { ...fetchOptions, redirect: 'error', signal: ctrl.signal })
951
+ const text = await response.text()
952
+ let payload
953
+ try { payload = text === '' ? {} : JSON.parse(text) } catch { payload = { error: text.slice(0, 200) } }
954
+ if (!response.ok) throw new Error(payload?.error ?? `HTTP ${response.status}`)
955
+ return payload
956
+ } finally {
957
+ clearTimeout(timer)
958
+ }
959
+ }
960
+
961
+ const post = (path, body, timeout) => api(path, {
962
+ method: 'POST',
963
+ headers: { 'content-type': 'application/json' },
964
+ ...body === undefined ? {} : { body: JSON.stringify(body) },
965
+ ...timeout === undefined ? {} : { timeout },
966
+ })
967
+
968
+ function useAsync(loader, deps) {
969
+ const [state, setState] = useState({ status: 'loading', data: undefined, error: '' })
970
+ const run = useCallback(() => {
971
+ let alive = true
972
+ setState(current => ({ ...current, status: 'loading' }))
973
+ loader().then(data => { if (alive) setState({ status: 'ready', data, error: '' }) })
974
+ .catch(error => { if (alive) setState({ status: 'error', data: undefined, error: String(error?.message ?? error) }) })
975
+ return () => { alive = false }
976
+ }, deps)
977
+ useEffect(() => run(), [run])
978
+ return { ...state, reload: run }
979
+ }
980
+
981
+ function kilo(value) {
982
+ const n = Math.round(Number(value) || 0)
983
+ if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(n >= 10_000_000 ? 0 : 1)}M`
984
+ if (n >= 1000) return `${(n / 1000).toFixed(n >= 10_000 ? 0 : 1)}K`
985
+ return String(n)
986
+ }
987
+
988
+ function ago(ts, locale) {
989
+ if (!ts) return '—'
990
+ const seconds = Math.max(1, Math.round((Date.now() - ts) / 1000))
991
+ const zh = String(locale ?? '').toLowerCase().startsWith('zh')
992
+ if (seconds < 60) return zh ? `${seconds} 秒前` : `${seconds}s ago`
993
+ const minutes = Math.round(seconds / 60)
994
+ if (minutes < 60) return zh ? `${minutes} 分钟前` : `${minutes}m ago`
995
+ const hours = Math.round(minutes / 60)
996
+ if (hours < 24) return zh ? `${hours} 小时前` : `${hours}h ago`
997
+ return zh ? `${Math.round(hours / 24)} 天前` : `${Math.round(hours / 24)}d ago`
998
+ }
999
+
1000
+ function copy(text, done) {
1001
+ const finish = ok => done(ok)
1002
+ if (navigator?.clipboard?.writeText !== undefined) {
1003
+ navigator.clipboard.writeText(text).then(() => finish(true), () => finish(legacy(text)))
1004
+ return
1005
+ }
1006
+ finish(legacy(text))
1007
+ }
1008
+ function legacy(text) {
1009
+ try {
1010
+ const area = document.createElement('textarea')
1011
+ area.value = text
1012
+ area.style.position = 'fixed'
1013
+ area.style.opacity = '0'
1014
+ document.body.appendChild(area)
1015
+ area.select()
1016
+ const ok = document.execCommand('copy')
1017
+ document.body.removeChild(area)
1018
+ return ok
1019
+ } catch { return false }
1020
+ }
1021
+
1022
+ // ── announcement HTML: strict allowlist, no innerHTML sink ───────────────
1023
+ // The feed is authored by the repository owner, but rendering is a trust
1024
+ // boundary of its own: the feed URL can be pointed anywhere, and a
1025
+ // compromised repository must never become script execution. Nothing here
1026
+ // hands a string to the HTML engine — the tokenizer walks the text, drops
1027
+ // everything off the allowlist, and builds a virtual tree that both React
1028
+ // and plain DOM can materialize. The same parser is exercised headlessly
1029
+ // by scripts/sanitize-test.mjs.
1030
+ const ALLOWED_TAGS = new Set(['a', 'abbr', 'b', 'blockquote', 'br', 'caption', 'code', 'dd', 'del', 'details', 'div', 'dl', 'dt', 'em', 'figcaption', 'figure', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'ins', 'kbd', 'li', 'mark', 'ol', 'p', 'pre', 'q', 's', 'small', 'span', 'strong', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'u', 'ul'])
1031
+ /** Everything these elements contain is dropped, closing tag included. */
1032
+ const DROP_CONTENT_TAGS = new Set(['script', 'style', 'iframe', 'object', 'embed', 'noscript', 'template', 'textarea', 'title', 'svg', 'math', 'form', 'input', 'button', 'select', 'option', 'video', 'audio', 'canvas', 'link', 'meta', 'base'])
1033
+ const VOID_TAGS = new Set(['br', 'hr', 'img'])
1034
+ const MAX_HTML_NODES = 4000
1035
+ const ALLOWED_STYLE_PROPS = new Set(['color', 'background-color', 'text-align', 'font-weight', 'font-style', 'text-decoration'])
1036
+ const STYLE_CAMEL = { 'background-color': 'backgroundColor', 'text-align': 'textAlign', 'font-weight': 'fontWeight', 'font-style': 'fontStyle', 'text-decoration': 'textDecoration', color: 'color' }
1037
+
1038
+ /** http(s), mailto and in-page fragments only; images additionally accept inline PNG/JPEG/GIF/WebP. */
1039
+ function safeUrl(raw, isImage) {
1040
+ const value = String(raw ?? '').trim()
1041
+ if (value === '' || value.length > 2000) return undefined
1042
+ const lower = value.toLowerCase()
1043
+ if (/^https?:\/\//.test(lower)) return value
1044
+ if (lower.startsWith('mailto:') && /^[^@\s]+@[^@\s]+$/.test(value.slice(7))) return value
1045
+ if (lower.startsWith('#')) return value
1046
+ if (isImage && /^data:image\/(png|jpe?g|gif|webp);base64,[a-z0-9+/=]+$/i.test(value)) return value
1047
+ return undefined
1048
+ }
1049
+
1050
+ function sanitizeStyle(raw) {
1051
+ const out = {}
1052
+ for (const decl of String(raw ?? '').split(';')) {
1053
+ const idx = decl.indexOf(':')
1054
+ if (idx === -1) continue
1055
+ const prop = decl.slice(0, idx).trim().toLowerCase()
1056
+ const value = decl.slice(idx + 1).trim()
1057
+ if (!ALLOWED_STYLE_PROPS.has(prop) || value === '' || value.length > 120) continue
1058
+ if (/url\(|expression|javascript:|@|<|>/.test(value.toLowerCase())) continue
1059
+ out[STYLE_CAMEL[prop]] = value
1060
+ }
1061
+ return out
1062
+ }
1063
+
1064
+ function sanitizeAttrs(tag, attrText) {
1065
+ const props = {}
1066
+ const attrRe = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*("([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g
1067
+ let match
1068
+ while ((match = attrRe.exec(attrText ?? '')) !== null) {
1069
+ const key = match[1].toLowerCase()
1070
+ const value = match[3] ?? match[4] ?? match[5] ?? ''
1071
+ if (key === 'style') {
1072
+ const style = sanitizeStyle(value)
1073
+ if (Object.keys(style).length > 0) props.style = style
1074
+ continue
1075
+ }
1076
+ if (tag === 'a' && key === 'href') {
1077
+ const url = safeUrl(value)
1078
+ if (url !== undefined) {
1079
+ props.href = url
1080
+ props.target = '_blank'
1081
+ props.rel = 'noopener noreferrer'
1082
+ }
1083
+ continue
1084
+ }
1085
+ if (tag === 'img' && key === 'src') {
1086
+ const url = safeUrl(value, true)
1087
+ if (url !== undefined) props.src = url
1088
+ continue
1089
+ }
1090
+ if ((tag === 'img' || tag === 'a') && key === 'title') { props.title = value.slice(0, 300); continue }
1091
+ if (tag === 'img' && key === 'alt') { props.alt = value.slice(0, 300); continue }
1092
+ if ((key === 'width' || key === 'height') && /^\d{1,4}$/.test(value)) { props[key] = Number(value); continue }
1093
+ }
1094
+ return props
1095
+ }
1096
+
1097
+ /**
1098
+ * Tokenize announcement HTML into a virtual tree of
1099
+ * `{type:'el', tag, props, children}` and `{type:'text', text}` nodes.
1100
+ * Disallowed elements are unwrapped (their children survive); the content
1101
+ * of raw-text elements such as `<script>` is dropped entirely.
1102
+ */
1103
+ function parseSafeHtml(html) {
1104
+ if (typeof html !== 'string' || html.trim() === '') return []
1105
+ const root = { type: 'root', children: [] }
1106
+ const stack = [root]
1107
+ const top = () => stack[stack.length - 1]
1108
+ let nodes = 0
1109
+ let skipUntil = null
1110
+ const tokenRe = /<!--[\s\S]*?-->|<\/\s*([a-zA-Z][a-zA-Z0-9-]*)\s*>|<\s*([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>|([^<]+)/g
1111
+ let match
1112
+ while ((match = tokenRe.exec(html)) !== null) {
1113
+ if (nodes >= MAX_HTML_NODES) break
1114
+ if (match[0].startsWith('<!--')) continue
1115
+ if (match[4] !== undefined) {
1116
+ if (skipUntil === null) {
1117
+ const text = match[4]
1118
+ if (text.trim() !== '' || (top().children.length > 0 && typeof top().children[top().children.length - 1] !== 'string')) {
1119
+ top().children.push(text)
1120
+ }
1121
+ }
1122
+ continue
1123
+ }
1124
+ const name = (match[1] ?? match[2] ?? '').toLowerCase()
1125
+ if (name === '') continue
1126
+ if (match[1] !== undefined) {
1127
+ // closing tag
1128
+ if (skipUntil !== null) {
1129
+ if (name === skipUntil) skipUntil = null
1130
+ continue
1131
+ }
1132
+ if (!ALLOWED_TAGS.has(name)) continue
1133
+ let depth = stack.length - 1
1134
+ while (depth > 0 && stack[depth].tag !== name) depth -= 1
1135
+ if (depth === 0) continue
1136
+ while (stack.length - 1 > depth) {
1137
+ const dropped = stack.pop()
1138
+ top().children.push(...dropped.children)
1139
+ }
1140
+ const frame = stack.pop()
1141
+ top().children.push({ type: 'el', tag: frame.tag, props: frame.props, children: frame.children })
1142
+ nodes += 1
1143
+ continue
1144
+ }
1145
+ // opening tag
1146
+ if (skipUntil !== null) continue
1147
+ if (DROP_CONTENT_TAGS.has(name)) { skipUntil = name; continue }
1148
+ if (!ALLOWED_TAGS.has(name)) continue
1149
+ const props = sanitizeAttrs(name, match[3])
1150
+ if (name === 'img' && props.src === undefined) continue
1151
+ if (VOID_TAGS.has(name)) {
1152
+ top().children.push({ type: 'el', tag: name, props, children: [] })
1153
+ nodes += 1
1154
+ continue
1155
+ }
1156
+ stack.push({ tag: name, props, children: [] })
1157
+ }
1158
+ while (stack.length > 1) {
1159
+ const frame = stack.pop()
1160
+ top().children.push(...frame.children)
1161
+ }
1162
+ return root.children
1163
+ }
1164
+
1165
+ /** Materialize the virtual tree as DOM nodes (for toasts and modals). */
1166
+ function htmlToDom(nodes) {
1167
+ return nodes.map(node => {
1168
+ if (typeof node === 'string') return document.createTextNode(node)
1169
+ const el = document.createElement(node.tag)
1170
+ for (const [key, value] of Object.entries(node.props ?? {})) {
1171
+ if (key === 'style') { Object.assign(el.style, value); continue }
1172
+ el.setAttribute(key, String(value))
1173
+ }
1174
+ for (const child of htmlToDom(node.children ?? [])) el.appendChild(child)
1175
+ return el
1176
+ })
1177
+ }
1178
+
1179
+ // ── toasts: a vanilla-DOM host so pushes surface on every page ───────────
1180
+ // Slot content only exists where the shell mounts it; a toast that lived
1181
+ // inside the settings section would be invisible everywhere else. This
1182
+ // host attaches to document.body, outside the app root, and needs no
1183
+ // react-dom — the body renders through the same allowlist parser.
1184
+ function toastHost() {
1185
+ let host = document.querySelector('.ofm_toasts')
1186
+ if (host === null) {
1187
+ host = document.createElement('div')
1188
+ host.className = 'ofm_toasts'
1189
+ document.body.appendChild(host)
1190
+ }
1191
+ return host
1192
+ }
1193
+
1194
+ function showToast({ title, body, html, tone, actions = [], holdMs = 10000 }) {
1195
+ try {
1196
+ const host = toastHost()
1197
+ const card = document.createElement('div')
1198
+ card.className = 'ofm_toast' + (tone === undefined ? '' : ` ${tone}`)
1199
+ const head = document.createElement('div')
1200
+ head.className = 'ofm_toasttitle'
1201
+ head.appendChild(document.createTextNode(title ?? ''))
1202
+ const close = document.createElement('button')
1203
+ close.type = 'button'
1204
+ close.className = 'ofm_toastclose'
1205
+ // No locale lookup in here on purpose: showToast also runs from the
1206
+ // push subscription before any `t` binding is in scope, and a throw
1207
+ // inside this try/catch would silently swallow the whole toast.
1208
+ close.setAttribute('aria-label', 'close')
1209
+ close.title = '✕'
1210
+ close.textContent = '✕'
1211
+ close.addEventListener('click', () => card.remove())
1212
+ head.appendChild(close)
1213
+ card.appendChild(head)
1214
+ if (body !== undefined && body !== '') {
1215
+ const area = document.createElement('div')
1216
+ area.className = 'ofm_toastbody'
1217
+ area.textContent = String(body)
1218
+ card.appendChild(area)
1219
+ } else if (html !== undefined) {
1220
+ const area = document.createElement('div')
1221
+ area.className = 'ofm_toastbody'
1222
+ for (const node of htmlToDom(parseSafeHtml(html))) area.appendChild(node)
1223
+ card.appendChild(area)
1224
+ }
1225
+ if (actions.length > 0) {
1226
+ const row = document.createElement('div')
1227
+ row.className = 'ofm_toastactions'
1228
+ for (const action of actions) {
1229
+ const btn = document.createElement('button')
1230
+ btn.type = 'button'
1231
+ btn.className = 'ofm_btn'
1232
+ btn.textContent = action.label
1233
+ btn.addEventListener('click', () => { card.remove(); action.onClick?.() })
1234
+ row.appendChild(btn)
1235
+ }
1236
+ card.appendChild(row)
1237
+ }
1238
+ host.appendChild(card)
1239
+ while (host.children.length > 4) host.firstElementChild?.remove()
1240
+ if (holdMs > 0) {
1241
+ const timer = setTimeout(() => card.remove(), holdMs)
1242
+ timer.unref?.()
1243
+ }
1244
+ return card
1245
+ } catch { /* a toast must never break its caller */ }
1246
+ return undefined
1247
+ }
1248
+
1249
+ const Switch = (props) => h('button', {
1250
+ type: 'button',
1251
+ className: 'ofm_switch',
1252
+ role: 'switch',
1253
+ 'aria-checked': props.checked ? 'true' : 'false',
1254
+ // Several call sites already pass `disabled` (the gateway switch does, while
1255
+ // its RPC is in flight) and it was silently dropped, so a switch stayed
1256
+ // clickable through a write it could not survive. Passing it through is what
1257
+ // those call sites meant.
1258
+ disabled: props.disabled === true,
1259
+ onClick: props.onChange,
1260
+ }, h('i'), props.label === undefined ? null : h('span', null, props.label))
1261
+
1262
+ const Pill = (props) => h('span', { className: `ofm_pill${props.strong ? ' strong' : ''}` },
1263
+ props.tone === undefined ? null : h('span', { className: `ofm_dot ${props.tone}` }),
1264
+ props.children)
1265
+
1266
+ const Button = props => h('button', {
1267
+ type: 'button',
1268
+ className: 'ofm_btn' + (props.kind === undefined ? '' : ' ' + props.kind),
1269
+ disabled: props.disabled,
1270
+ onClick: props.onClick,
1271
+ title: props.title,
1272
+ }, props.children)
1273
+
1274
+ function Section(props) {
1275
+ return h('section', { className: 'ofm_sec' },
1276
+ h('div', { className: 'ofm_sechead' },
1277
+ h('span', { className: 'ofm_sec_title' }, props.title),
1278
+ props.hint === undefined ? null : h('span', { className: 'ofm_sec_hint' }, props.hint)),
1279
+ props.children)
1280
+ }
1281
+
1282
+ function Panel(props) {
1283
+ return h('div', { className: 'ofm_panel' },
1284
+ props.title === undefined ? null : h('div', { className: 'ofm_paneltitle' }, props.title, props.hint === undefined ? null : h('span', { className: 'ofm_sec_hint' }, props.hint)),
1285
+ props.children)
1286
+ }
1287
+
1288
+ // ── egress outlet ─────────────────────────────────────────────────────────
1289
+ // Two ways out: a Clash subscription load-balanced by a spawned mihomo, or
1290
+ // one hand-written http/https/socks5 URL. Until this is on AND started,
1291
+ // egressFetch sends every request direct — nothing here is load-bearing for
1292
+ // plain use. The address is a credential, so it never rides along in the
1293
+ // settings payload: this panel shows the masked host and pulls the value
1294
+ // itself (`/egress/url`) only when the owner asks to see or copy it.
1295
+ function Egress(props) {
1296
+ const { settings, t, onApply, busy } = props
1297
+ const [draft, setDraft] = useState(settings.egress ?? {})
1298
+ useEffect(() => setDraft(settings.egress ?? {}), [settings.egress?.enabled, settings.egress?.mode, settings.egress?.urlLabel, settings.egress?.hasUrl, settings.egress?.active, settings.egress?.error])
1299
+ const [urlShown, setUrlShown] = useState(false)
1300
+ const [urlValue, setUrlValue] = useState('')
1301
+ const [copied, setCopied] = useState('')
1302
+ const readUrl = () => api('/egress/url').then(payload => String(payload?.url ?? '')).catch(() => '')
1303
+ // Which node url-test is carrying traffic on, and what the last gateway
1304
+ // round trip cost. mihomo re-ranks on its own schedule, so while the outlet
1305
+ // is on this polls instead of trusting the snapshot that shipped with the
1306
+ // settings. `/outlet` reads the controller, so it is only worth calling
1307
+ // when an outlet is actually running.
1308
+ const live = useAsync(() => api('/outlet'), [settings.egress?.enabled, settings.egress?.active])
1309
+ const reloadOutlet = live.reload
1310
+ const running = settings.egress?.active === true
1311
+ useEffect(() => {
1312
+ if (!running) return undefined
1313
+ const timer = setInterval(() => reloadOutlet(), 15_000)
1314
+ return () => clearInterval(timer)
1315
+ }, [running, reloadOutlet])
1316
+ const status = running && live.data ? live.data : draft
1317
+ const node = typeof status?.node === 'string' ? status.node : ''
1318
+ const nodeDelayMs = Number(status?.nodeDelayMs ?? 0)
1319
+ const subscription = draft?.mode !== 'client'
1320
+ const statusLine = text => h('code', { className: 'ofm_mono', style: { padding: '4px 8px', flex: 1, minWidth: 200 } }, text)
1321
+ // The stored address is never in the payload this panel was rendered
1322
+ // from, so "see it" and "copy it" both cost one on-demand fetch, and the
1323
+ // masked form is all this page holds the rest of the time.
1324
+ const revealUrl = async () => {
1325
+ if (urlShown) { setUrlShown(false); return }
1326
+ setUrlValue(await readUrl())
1327
+ setUrlShown(true)
1328
+ }
1329
+ const copyUrl = async () => {
1330
+ const value = await readUrl()
1331
+ if (value === '') return
1332
+ copy(value, ok => {
1333
+ if (!ok) return
1334
+ setCopied('egressUrl')
1335
+ setTimeout(() => setCopied(''), 1600)
1336
+ })
1337
+ }
1338
+ const urlMask = draft?.hasUrl === true ? `${draft?.urlLabel ?? ''}/…` : t('egress.urlNone')
1339
+ const apply = () => {
1340
+ const patch = { enabled: draft?.enabled === true, mode: subscription ? 'subscription' : 'client', mihomoPath: String(draft?.mihomoPath ?? '') }
1341
+ // Empty means "keep the stored address": this panel never received it,
1342
+ // so it has nothing to send back, and an empty string would read as
1343
+ // "clear it" on the receiving end.
1344
+ if (String(draft?.url ?? '') !== '') patch.url = String(draft.url)
1345
+ onApply({ egress: patch })
1346
+ }
1347
+ return h(Panel, null,
1348
+ h('div', { className: 'ofm_row' },
1349
+ h(Switch, { checked: draft?.enabled === true, label: t('egress.enabled'), onChange: () => setDraft(c => ({ ...c, enabled: !(c?.enabled === true) })) }),
1350
+ h('span', { className: 'ofm_pill' }, h('span', { className: `ofm_dot ${draft?.active === true ? 'ok' : draft?.error ? 'err' : ''}` }), draft?.active === true ? t('egress.active') : t('egress.inactive'))),
1351
+ h('div', { className: 'ofm_row' },
1352
+ h(Switch, { checked: subscription, label: t('egress.modeSubscription'), onChange: () => setDraft(c => ({ ...c, mode: subscription ? 'client' : 'subscription' })) })),
1353
+ h('div', { className: 'ofm_row' },
1354
+ h('span', { className: 'ofm_note' }, t('egress.url')),
1355
+ h('code', { className: 'ofm_mono', style: { padding: '4px 8px', flex: 1, minWidth: 200, letterSpacing: urlShown ? 0 : 1 } },
1356
+ urlShown ? (urlValue === '' ? t('egress.urlNone') : urlValue) : urlMask),
1357
+ h(Button, { kind: 'ghost', onClick: revealUrl }, urlShown ? t('forward.hide') : t('forward.show')),
1358
+ h(Button, { kind: 'ghost', onClick: copyUrl }, copied === 'egressUrl' ? t('forward.copied') : t('forward.copy')),
1359
+ // Deleting the address is still a thing the owner may want, and the
1360
+ // panel cannot express it by sending back a field it never held — so
1361
+ // it says so outright, and the outlet goes down with the credential.
1362
+ h(Button, { kind: 'ghost', title: t('egress.urlClearWarn'), disabled: draft?.hasUrl !== true || busy, onClick: () => {
1363
+ setUrlShown(false)
1364
+ setUrlValue('')
1365
+ onApply({ egress: { enabled: false, mode: subscription ? 'subscription' : 'client', mihomoPath: String(draft?.mihomoPath ?? ''), url: '' } })
1366
+ } }, t('egress.urlClear'))),
1367
+ h('div', { className: 'ofm_row' },
1368
+ field(t('egress.urlNew'), h('input', { className: 'ofm_input', style: { flex: 1, minWidth: 260 }, value: draft?.url ?? '', placeholder: t('egress.urlPlaceholder'), onChange: e => setDraft(c => ({ ...c, url: e.target.value })) })),
1369
+ h(Button, { kind: 'primary', disabled: busy, onClick: apply }, t('egress.apply'))),
1370
+ subscription ? h('div', { className: 'ofm_row' },
1371
+ field(t('egress.mihomoPath'), h('input', { className: 'ofm_input', style: { flex: 1, minWidth: 260 }, value: draft?.mihomoPath ?? '', placeholder: 'auto', onChange: e => setDraft(c => ({ ...c, mihomoPath: e.target.value })) })),
1372
+ h('span', { className: 'ofm_note' }, t('egress.mihomoHint'))) : null,
1373
+ draft?.error ? h('div', { className: 'ofm_callout ofm_error' }, t('egress.error').replace('{message}', draft.error)) : null,
1374
+ h('div', { className: 'ofm_note' }, t('egress.direct')),
1375
+ running ? h('div', { className: 'ofm_row' },
1376
+ h('span', { className: 'ofm_note' }, t('egress.outlet')),
1377
+ statusLine(`${draft.outlet ?? ''} · ${draft.mode ?? ''}`)) : null,
1378
+ running ? h('div', { className: 'ofm_row' },
1379
+ h('span', { className: 'ofm_note' }, t('egress.node')),
1380
+ statusLine(node === '' ? t('egress.measuring') : nodeDelayMs > 0 ? `${node} · ${nodeDelayMs}ms` : node)) : null)
1381
+ }
1382
+
1383
+ const field = (label, control) => h('label', { className: 'ofm_field' }, h('span', null, label), control)
1384
+
1385
+ // ── 白嫖模型接入页 ────────────────────────────────────────────────────────
1386
+ // Real channel logos carried over from the upstream Channel Pack client (see
1387
+ // vendor/channel-pack/NOTICE.md) — the same artwork users know from those
1388
+ // products, embedded so no network fetch is involved. Channels without an
1389
+ // entry fall back to their two-letter tile.
1390
+ const CHANNEL_ICONS = {
1391
+ 'codearts': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAcgUlEQVR4nNV7eZBd1Znf7/vOufe+93pvtYQkJNQWYEALAjeYzSCBM7IAY1xOmj8ydpzMTHDFSVUmU5VKKjU1rU5VJqmKKy6XZ6rG2PGEOJmZSBlj4w0DtiQb8ILbIEDLaBegBbT09vot995zvtR37nutRkIbeKYmR7r93r33vHPPt6+XcHmDBKAxwJQAOgHwYLi87F2mDl7w/NCyi8955/nZ94pxZZTJPuzDgp4F/sDYkB8GPIVt/oaHAKQIwP8HQyCXvE++tAVBWwEjgMHf87EFYh8bGrOXigS6FOApfMye847u7l5K0y7nbVkkivR6DiGLuDWvExE6RdAl+l2SRIAEQNxaJUYad7bOW0esn52znym6Wt+Le86XmITJkpVc8rBvISsSUWbYN5MZmbk53jdJOx9J23sdwQiPYtRfCD57MeDHijlZ+9rLuOKqpNG4GbCr4OkqsO8WEBkxJCTCYXq4kgPkvYjAidfbgIcgAtiARJmP4NkD5CCeC/7yBmACGweICBmCd8zMiDzrol5IJwQEcM5iJsTJ2/VIDoy5JS+D8GqbXIuHNpqRMeBCSLCXQPlsBODhyvwFLnWDhOzDAhkSYBVIlgCuGzAMEp3vFXRVQgJRCDwoLKXgeRDrn7CyXi5wwK2jzYzt+wpg+LGeM8ARg7hQcMreBBZxID8BmLeF+MC0XbDsiVXHFzRq3XsW7i8fu3eMAuFUHM6nGO35gEdBj1y/PdyxcB43848TsF7gV5NgHghdQj5Ruoetk05XPFgQjH4LwBgmCHPYghKOyMCTgSGC120F2EyYEwirn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2tnM2Cbi6uVKhS1gOAvawup+A7wCwzM3NjdqlRnkVf0UQhN8AyDU6B+urxtLmIp7nv+iVnOY47oAoii3fZc59TAH3EXimImM4jvvY3hWZ+f5LWVdX10hCyGoA0Y8xvTK9kk8pTVOpVPW2Tj6sH42oVPWU0nitVrua53l28DGK6S35/Ip/yGMoc73FwoR5+x6AvwuC8IWjo6PW3qMb24dUOm+wDi9QSi/AzsNru9nodzrkRQzP2z/ten0O9v/4fwfTTYPe9d+fDvIeqj3xBP4HAD1EgYsmCAMAAAAASUVORK5CYII=',
1398
+ 'zcode': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAgklEQVR42u3XsRGAIAyF4UxgYe0g7j+FpZtgRwN36stLAhruqP+v4ICIdNaybsViy92yCj+CeMW7CO94gwgFRMUrIgFTAPbzgPe/Aa5nAInTAGicAtDE1QBtXAVgxGEAeuIpAFYYArDj81xEoQDLd+A1ID8k3wTkXDDEaDbEcBo1nl/XXoK4yMqvMgAAAABJRU5ErkJggg==',
1399
+ }
1400
+
1401
+ /** The plugin's own brand mark (user-supplied artwork, 128px JPEG). */
1402
+ const BRAND_ICON = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQUFBAYFBQUHBgYHCQ8KCQgICRMNDgsPFhMXFxYTFRUYGyMeGBohGhUVHikfISQlJygnGB0rLismLiMmJyb/2wBDAQYHBwkICRIKChImGRUZJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJib/wAARCACAAIADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4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+ubfyNL5pp9wQbaY/8ATNv/AEE0tGaXktz5O0iCSa1s4o8ZaFOvQDaMk1Mkko1q1mtbR7thJ5FtAvDSSP8AKpGfc4z75q5o9mbfR4J7rbg26MI1ORjaMZPf6VJoOoW+m+KNG1i/OLS0vUlmcjhV5Ut9Buz+FfW6wpXXY+ZTU6lnseuWfww0ySxH/CQ3tzd3RG5/s87QwxH0UD7wHq2c+gryn4q+ArLw1dJe2aLLp8xDSAddrHAYHnBB4OOOVOByK+lpDE1qZDIpgdMiUHKlSOoPcV4D8XfE1ldWFvpVtNbzOpWNA33ZNrBnP5qq/ViOxr5729SU05Ns9uNGCg0lY8TvojY374bIQ4BHRlPIP4git6Xxrcv4JTwrc72t4LhHtGzwq7izIw9MnII+lYmtXMUl5LhlZEVYw46NtUAn6ZBro4Phzq9x4cj1Zj5d5LIgtdPaMl5VYgAkj7h6nngDk13yacU2caT5mkew/CX4maLaeEtO0W9ktoLi0zEyyTiIspYkEZ4PXqDXf3fjjw5J58f9pwLuhVgVlRiAG+bkNxjIxXy1qXgLxfp1w9vcaDdSMmMmBfNBBGQeOcEdOKfq2l3MFlp2+x2uI3V0SykR0IbjeSMEntis5Qi2mnuXGTtqtj3PwzrPhyy8Nm0/tC9ht4wMRa1OrXK/vXO5jnoTjb2q/wCDdathNJEkyMjMdu2QNu/KvmqG3zMrG2yNwzuiJHXvxXS2N3faZrU72Me+33bg1pA4iP0yOK5sRStZJ3OnD1Frc+r7dkf5gRg9Knyc15X4I8YG7byZSQygBlbg5r0uzuUnj3A8964L20O2UOvQnlXK571X5zipmIC465qDI3be9JhFaDqJCPs0y/8ATNv5GkzTZzi3m/65t/I0hn//2Q=='
1403
+
1404
+ /**
1405
+ * The fourteen account channels enabled by OFM. Identity is static (it is
1406
+ * the product, not a reading), so the grid renders instantly and only the
1407
+ * *state* comes from the pack over RPC. `accent` drives each card's stripe
1408
+ * and logo tile; `login` picks the flow the card offers.
1409
+ */
1410
+ const CHANNEL_PROVIDERS = [
1411
+ { id: 'codearts', name: 'CodeArts', org: '华为云', accent: '#C7000B', note: 'DeepSeek · GLM · openPangu,每日免费额度', login: 'browser' },
1412
+ { id: 'buddy', name: 'WorkBuddy 国内版', org: '腾讯 · copilot.tencent.com', accent: '#0A7AFF', note: 'CodeBuddy 同一端点:DeepSeek · Kimi · GLM 免费线,每日积分', login: 'browser' },
1413
+ { id: 'workbuddy', name: 'WorkBuddy 国际版', org: '腾讯 · workbuddy.ai', accent: '#0B63CE', note: '国际版端点:独立账号与积分体系', login: 'browser' },
1414
+ { id: 'lobsterai', name: 'LobsterAI', org: '有道', accent: '#FF6A00', note: '龙虾 · 每日签到积分', login: 'browser' },
1415
+ { id: 'qoder', name: 'Qoder', org: '阿里系', accent: '#615CED', note: '每日 100 Credits,加密推理端点', login: 'browser' },
1416
+ { id: 'qodercn', name: 'Qoder 中国版', org: '阿里系', accent: '#7A6CF0', note: '中国版端点与模型池', login: 'browser' },
1417
+ { id: 'trae', name: 'TRAE', org: '字节', accent: '#00BFA6', note: '手机号登录', login: 'browser' },
1418
+ { id: 'cline', name: 'Cline', org: 'Cline', accent: '#5B5BD6', note: 'Cline 账号免费额度', login: 'browser' },
1419
+ { id: 'loomy', name: 'Loomy', org: '讯飞', accent: '#2F6BFF', note: '微信扫码,或短信验证码备用', login: 'browser+sms' },
1420
+ { id: 'raccoon', name: 'Raccoon', org: '商汤', accent: '#00A6A6', note: '手机号登录', login: 'browser' },
1421
+ { id: 'minimax', name: 'MiniMax Code', org: 'MiniMax', accent: '#E4007F', note: '设备码 + PKCE,每日签到', login: 'browser' },
1422
+ { id: 'zcode', name: 'ZCode', org: '智谱', accent: '#3B6EF6', note: '浏览器登录(需本机可开浏览器)', login: 'browser' },
1423
+ { id: 'gemini', name: 'Gemini', org: 'Google Code Assist', accent: '#4285F4', note: '本地回调 OAuth 免费线', login: 'browser' },
1424
+ { id: 'officeace', name: 'OfficeAce', org: '华为云 ModelArts MaaS', accent: '#C7000B', note: '华为云 OAuth(PKCE + DPoP),云端直连、无需装客户端', login: 'browser' },
1425
+ { id: 'accio', name: 'Accio Work', org: '阿里', accent: '#FF6A00', note: '标准 OAuth + PKCE(公开客户端),可脱离 IDE 使用', login: 'browser' },
1426
+ ]
1427
+
1428
+ /** 与现有 RPC 的能力对应:余额、每日领取及独立签到状态分别判断。 */
1429
+ const CHANNEL_CREDITS = {
1430
+ codearts: { claim: true },
1431
+ buddy: { claim: true, status: true },
1432
+ workbuddy: {},
1433
+ lobsterai: { claim: true },
1434
+ qoder: { claim: true },
1435
+ qodercn: { claim: true },
1436
+ trae: { claim: true },
1437
+ cline: { unit: 'dollars' },
1438
+ loomy: { claim: true },
1439
+ raccoon: {},
1440
+ minimax: { claim: true, status: true },
1441
+ zcode: { claim: true, unit: 'tokens' },
1442
+ gemini: { unit: 'quota', quota: true },
1443
+ // ⚠️ `claim` **刻意不登记**:OfficeAce 的签到走云侧自动领取
1444
+ //(拉余额时完成),手动领取 RPC 对它没有意义 —— 登记了会渲染一个无效按钮。
1445
+ officeace: {},
1446
+ // ⚠️ 只有余额可查:上游 registry 登记 `dailyCheckin: false`(无手动签到端点),
1447
+ // 且不参与限流按钮与永久积分锁定 ⇒ 与 raccoon / officeace 同形(空对象 = 仅余额)。
1448
+ accio: {},
1449
+ }
1450
+
1451
+ /**
1452
+ * The host RPC the pack registered at `/api/channel-pack`.
1453
+ *
1454
+ * The pack's own browser half used the shell's connection service; this page
1455
+ * does the same instead of proxying through our JSON API, so channel traffic
1456
+ * keeps the connection's admission and the credential store stays the only
1457
+ * place a token exists. `connection` is read opportunistically: a shell that
1458
+ * does not offer it still renders the free and EAC pages, with this one
1459
+ * explaining itself instead of breaking.
1460
+ */
1461
+ function useChannelRpc(ctx) {
1462
+ return useMemo(() => {
1463
+ let connection
1464
+ try { connection = ctx?.connection } catch { connection = undefined }
1465
+ if (connection === undefined && typeof ctx?.get === 'function') {
1466
+ try { connection = ctx.get('connection') } catch { connection = undefined }
1467
+ }
1468
+ const rpc = async (method, payload, timeoutMs = 60_000) => {
1469
+ if (connection?.rpc?.call === undefined) throw new Error('no-connection')
1470
+ const controller = new AbortController()
1471
+ const timer = setTimeout(() => controller.abort(), timeoutMs)
1472
+ try {
1473
+ const result = await connection.rpc.call('/api', 'channel-pack', { method, payload }, controller.signal)
1474
+ if (result?.ok === true) return result.value
1475
+ if (result?.ok === false) throw new Error(result.error?.message ?? result.error?.code ?? 'rpc-failed')
1476
+ return result
1477
+ } finally { clearTimeout(timer) }
1478
+ }
1479
+ return { available: connection?.rpc?.call !== undefined, rpc }
1480
+ }, [ctx])
1481
+ }
1482
+
1483
+ /** Human text for a millisecond timestamp, or the long-lived marker. */
1484
+ function expiryText(entry, t) {
1485
+ if (!Number.isFinite(entry?.expiresAt) || entry.expiresAt <= 0) return t('chan.expires.never')
1486
+ return ago(entry.expiresAt, t.locale)
1487
+ }
1488
+
1489
+ function ChannelCard(props) {
1490
+ const { channel, status, rpc, t, onError, onChanged } = props
1491
+ const [open, setOpen] = useState(null)
1492
+ const [accounts, setAccounts] = useState(undefined)
1493
+ const [models, setModels] = useState(undefined)
1494
+ const [credits, setCredits] = useState(undefined)
1495
+ // 实时积分:每个账号的剩余余额(credits.balances),卡片汇总 + 账号行
1496
+ // 逐条展示;随账号列表与领积分动作刷新,另有一个慢轮询兜底。
1497
+ const [balances, setBalances] = useState(undefined)
1498
+ const [busy, setBusy] = useState('')
1499
+ const [notice, setNotice] = useState('')
1500
+ const [login, setLogin] = useState(null)
1501
+ const modelBatchPending = useRef(false)
1502
+ const [balanceError, setBalanceError] = useState('')
1503
+ const [balanceLoading, setBalanceLoading] = useState(false)
1504
+ const balancePending = useRef(null)
1505
+ const balanceGeneration = useRef(0)
1506
+ const claimPending = useRef(false)
1507
+ const creditCapability = CHANNEL_CREDITS[channel.id]
1508
+ const balanceLabel = creditCapability?.unit === 'tokens' ? t('chan.credits.tokens')
1509
+ : creditCapability?.unit === 'dollars' ? t('chan.credits.dollars')
1510
+ : creditCapability?.quota ? t('chan.credits.quota') : t('chan.credits.left')
1511
+
1512
+ const accountsCount = status?.accounts?.total ?? 0
1513
+ const enabledCount = status?.accounts?.enabled ?? 0
1514
+ const modelsTotal = status?.models?.total ?? 0
1515
+ const modelsOff = status?.models?.disabled ?? 0
1516
+ const connected = enabledCount > 0
1517
+ const chanState = status?.closed === true ? 'off' : connected ? 'on' : 'idle'
1518
+ const stateText = status?.closed === true ? t('chan.state.closed') : connected ? t('chan.state.on') : t('chan.state.off')
1519
+
1520
+ const loadAccounts = useCallback(async () => {
1521
+ try {
1522
+ const value = await rpc('account.list', { provider: channel.id })
1523
+ setAccounts(value?.accounts ?? [])
1524
+ } catch (error) { setAccounts([]); onError(channel, error) }
1525
+ }, [rpc, channel.id, onError])
1526
+ const loadModels = useCallback(async () => {
1527
+ try {
1528
+ const value = await rpc('model.list', { provider: channel.id })
1529
+ setModels(value?.models ?? [])
1530
+ } catch (error) { setModels([]); onError(channel, error) }
1531
+ }, [rpc, channel.id, onError])
1532
+ const loadCredits = useCallback(async () => {
1533
+ if (!CHANNEL_CREDITS[channel.id]?.status) return
1534
+ try {
1535
+ const value = await rpc('credits.status', { provider: channel.id })
1536
+ setCredits(value?.accounts ?? [])
1537
+ } catch { setCredits([]) }
1538
+ }, [rpc, channel.id])
1539
+ const loadBalances = useCallback((afterWrite = false) => {
1540
+ if (!CHANNEL_CREDITS[channel.id] || !rpc) return Promise.resolve()
1541
+ const pending = balancePending.current
1542
+ if (!afterWrite && pending?.provider === channel.id && pending.rpc === rpc) return pending.promise
1543
+ const generation = ++balanceGeneration.current
1544
+ const request = { provider: channel.id, rpc }
1545
+ balancePending.current = request
1546
+ setBalanceLoading(true); setBalanceError('')
1547
+ request.promise = (async () => {
1548
+ try {
1549
+ const value = await rpc('credits.balances', { provider: channel.id, ...afterWrite ? { force: true } : {} }, 90_000)
1550
+ if (generation === balanceGeneration.current) setBalances(value?.accounts ?? [])
1551
+ } catch (error) {
1552
+ if (generation === balanceGeneration.current) {
1553
+ setBalances([])
1554
+ setBalanceError(String(error?.message ?? error))
1555
+ }
1556
+ } finally {
1557
+ if (generation === balanceGeneration.current) setBalanceLoading(false)
1558
+ if (balancePending.current === request) balancePending.current = null
1559
+ }
1560
+ })()
1561
+ return request.promise
1562
+ }, [rpc, channel.id])
1563
+ useEffect(() => {
1564
+ setBalances(undefined); setBalanceError('')
1565
+ void loadBalances()
1566
+ return () => { balanceGeneration.current++; balancePending.current = null }
1567
+ }, [loadBalances])
1568
+ // A slow heartbeat keeps the numbers honest while the page sits open:
1569
+ // balances move whenever a model is used elsewhere, and a stale credit
1570
+ // count reads as "I have more quota than I do".
1571
+ useEffect(() => {
1572
+ if (!CHANNEL_CREDITS[channel.id]) return undefined
1573
+ const timer = setInterval(() => { void loadBalances() }, 90_000)
1574
+ return () => clearInterval(timer)
1575
+ }, [channel.id, loadBalances])
1576
+ const balanceOf = accountId => {
1577
+ const row = (balances ?? []).find(entry => entry.accountId === accountId)
1578
+ return row?.balance === null || row?.balance === undefined ? null : row.balance
1579
+ }
1580
+ const balancesTotal = (balances ?? []).reduce((sum, row) => sum + (Number.isFinite(row.balance?.total) ? row.balance.total : 0), 0)
1581
+ const balancesKnown = (balances ?? []).some(row => Number.isFinite(row.balance?.total))
1582
+ const balanceFailures = (balances ?? []).filter(row => row.error || !Number.isFinite(row.balance?.total)).length
1583
+
1584
+ // Refetch what is on screen whenever the pack reports a change for this
1585
+ // channel: an account added in another tab, a completed background login,
1586
+ // a claim that moved the numbers.
1587
+ useEffect(() => {
1588
+ const onEvent = () => {
1589
+ if (open === 'accounts') { void loadAccounts(); void loadCredits() }
1590
+ if (open === 'models') void loadModels()
1591
+ void loadBalances()
1592
+ }
1593
+ window.addEventListener('ofm:channels', onEvent)
1594
+ return () => window.removeEventListener('ofm:channels', onEvent)
1595
+ }, [open, loadAccounts, loadModels, loadCredits, loadBalances])
1596
+
1597
+ const toggle = async fold => {
1598
+ if (open === fold) { setOpen(null); return }
1599
+ setOpen(fold)
1600
+ if (fold === 'accounts') { setAccounts(undefined); await loadAccounts(); void loadCredits(); void loadBalances() }
1601
+ if (fold === 'models') { setModels(undefined); await loadModels() }
1602
+ }
1603
+
1604
+ // The pack's login is two-phase: `account.create` returns the URL to open
1605
+ // *immediately* (a popup opened after a 30-second await is blocked), then
1606
+ // the browser flow finishes in the background and `login.poll` sees the
1607
+ // credential appear. The placeholder account is real from the first
1608
+ // moment, so the card can poll against it.
1609
+ const startLogin = async () => {
1610
+ setBusy('add'); setNotice('')
1611
+ try {
1612
+ const value = await rpc('account.create', { provider: channel.id }, 90_000)
1613
+ const accountId = value?.accountId
1614
+ const url = value?.loginUrl
1615
+ if (typeof accountId !== 'string' || accountId === '') throw new Error('bad-answer')
1616
+ if (typeof url === 'string' && url !== '') {
1617
+ try { window.open(url, '_blank', 'noopener') } catch { /* the modal offers the link too */ }
1618
+ }
1619
+ setLogin({ accountId, url: typeof url === 'string' ? url : '', startedAt: Date.now() })
1620
+ setOpen('accounts')
1621
+ } catch (error) { onError(channel, error) } finally { setBusy('') }
1622
+ }
1623
+
1624
+ // Poll the placeholder until its credential lands. Ten minutes matches the
1625
+ // window the pack keeps a pending login link alive for.
1626
+ useEffect(() => {
1627
+ if (login === null) return undefined
1628
+ let alive = true
1629
+ const timer = setInterval(async () => {
1630
+ if (Date.now() - login.startedAt > 10 * 60_000) {
1631
+ if (alive) { setLogin(null); setNotice(t('chan.login.expired')) }
1632
+ return
1633
+ }
1634
+ try {
1635
+ const value = await rpc('login.poll', { accountId: login.accountId, provider: channel.id })
1636
+ if (!alive) return
1637
+ if (value?.done === true) {
1638
+ setLogin(null)
1639
+ if (value.success === false) {
1640
+ setNotice(t('chan.login.failed').replace('{reason}', value.error ?? '未知原因'))
1641
+ } else {
1642
+ setNotice(t('chan.login.done').replace('{login}', value.login ?? ''))
1643
+ onChanged()
1644
+ void loadAccounts()
1645
+ void loadCredits()
1646
+ void loadBalances(true)
1647
+ }
1648
+ } else if (typeof value?.error === 'string' && value.error !== '') {
1649
+ setLogin(null)
1650
+ setNotice(t('chan.login.failed').replace('{reason}', value.error))
1651
+ }
1652
+ } catch { /* the link may still complete; keep polling */ }
1653
+ }, 3000)
1654
+ return () => { alive = false; clearInterval(timer) }
1655
+ }, [login, rpc, channel.id, t, onChanged, loadAccounts, loadCredits, loadBalances])
1656
+
1657
+ const accountAction = async (key, accountId, fn) => {
1658
+ setBusy(key); setNotice('')
1659
+ try { await fn() } catch (error) { onError(channel, error) } finally { setBusy('') }
1660
+ }
1661
+
1662
+ const setAllModels = async disabled => {
1663
+ if (busy !== '' || modelBatchPending.current || !rpc || !models?.length) return
1664
+ modelBatchPending.current = true
1665
+ try {
1666
+ await accountAction(disabled ? 'models:hide' : 'models:show', '', async () => {
1667
+ await rpc('model.setAllDisabled', { provider: channel.id, disabled })
1668
+ await loadModels()
1669
+ onChanged()
1670
+ })
1671
+ } finally { modelBatchPending.current = false }
1672
+ }
1673
+
1674
+ const removeAccount = async accountId => {
1675
+ const entry = (accounts ?? []).find(row => row.id === accountId)
1676
+ if (typeof window !== 'undefined' && typeof window.confirm === 'function'
1677
+ && !window.confirm(t('chan.confirm.delete').replace('{name}', entry?.nickname ?? accountId))) return
1678
+ await accountAction('del:' + accountId, accountId, async () => {
1679
+ await rpc('account.delete', { accountId })
1680
+ onChanged(); await loadAccounts(); void loadBalances(true)
1681
+ })
1682
+ }
1683
+
1684
+ const claim = async () => {
1685
+ if (!creditCapability?.claim || busy !== '' || claimPending.current) return
1686
+ claimPending.current = true
1687
+ setBusy('claim'); setNotice('')
1688
+ try {
1689
+ const value = await rpc('credits.claimAll', { provider: channel.id }, 180_000)
1690
+ const summary = value?.summary ?? value
1691
+ const claimed = Number(summary?.claimed ?? 0)
1692
+ const credit = Number(summary?.totalCredit ?? 0)
1693
+ const failed = (value?.results ?? []).filter(row => row.outcome?.kind === 'failed')
1694
+ const successText = t('chan.claim.result').replace('{count}', String(claimed)).replace('{credit}', String(credit))
1695
+ const failureText = t('chan.claim.failed').replace('{reason}', failed.map(row => row.outcome.message).join(';'))
1696
+ setNotice(failed.length > 0 ? claimed > 0 ? `${successText};${failureText}` : failureText
1697
+ : claimed > 0 ? successText : t('chan.claim.none'))
1698
+ void loadCredits(); void loadBalances(true)
1699
+ } catch (error) { onError(channel, error) } finally { claimPending.current = false; setBusy('') }
1700
+ }
1701
+
1702
+ const creditFor = accountId => (credits ?? []).find(row => row.accountId === accountId)?.status ?? null
1703
+
1704
+ const card = h('article', {
1705
+ className: `ofm_chan ofm_glass${status?.closed === true ? ' off' : ''}`,
1706
+ 'data-state': chanState,
1707
+ style: { '--chan-accent': channel.accent },
1708
+ },
1709
+ h('div', { className: 'ofm_chanhead' },
1710
+ h('span', { className: 'ofm_chanlogo', 'aria-hidden': 'true' },
1711
+ CHANNEL_ICONS[channel.id] !== undefined
1712
+ ? h('img', { src: CHANNEL_ICONS[channel.id], alt: '' })
1713
+ : channel.name.slice(0, 2).toUpperCase()),
1714
+ h('span', { className: 'ofm_chanid' },
1715
+ h('b', null, channel.name),
1716
+ h('span', null, channel.org)),
1717
+ h('span', { className: 'ofm_chanstate' },
1718
+ h('span', { className: `ofm_dot ${connected ? 'ok' : status?.closed === true ? 'err' : ''}` }),
1719
+ stateText)),
1720
+ h('p', { className: 'ofm_note' }, channel.note),
1721
+ h('div', { className: 'ofm_chanmeta' },
1722
+ h('span', null, `${t('chan.meta.accounts')} `, h('b', null, `${enabledCount}/${accountsCount}`)),
1723
+ h('span', null, `${t('chan.meta.models')} `, h('b', null, modelsTotal === 0 ? '—' : `${modelsTotal - modelsOff}/${modelsTotal}`)),
1724
+ creditCapability ? h('span', { className: 'ofm_credittotal' },
1725
+ `${balanceLabel} `,
1726
+ h('b', null, balanceLoading ? '…' : balancesKnown
1727
+ ? creditCapability.quota ? t('chan.credits.loaded').replace('{count}', String((balances ?? []).filter(row => Number.isFinite(row.balance?.total)).length)) : kilo(balancesTotal)
1728
+ : balances === undefined ? '…' : '—')) : null),
1729
+ h('div', { className: 'ofm_chanacts' },
1730
+ h('button', { type: 'button', className: 'ofm_btn', disabled: busy !== '' || !rpc, 'aria-busy': busy === 'add' ? 'true' : undefined, onClick: startLogin }, busy === 'add' ? '…' : t('chan.act.add')),
1731
+ accountsCount > 0 ? h('button', {
1732
+ type: 'button', className: 'ofm_btn ghost', disabled: busy !== '' || !rpc, 'aria-busy': busy === 'refreshAll' ? 'true' : undefined,
1733
+ onClick: () => accountAction('refreshAll', '', async () => {
1734
+ for (const row of accounts ?? await rpc('account.list', { provider: channel.id }).then(v => v?.accounts ?? [])) {
1735
+ try { await rpc('account.refresh', { accountId: row.id }, 90_000) } catch (error) { onError(channel, error) }
1736
+ }
1737
+ onChanged(); await loadAccounts(); void loadBalances(true)
1738
+ }),
1739
+ }, busy === 'refreshAll' ? '…' : t('chan.act.refresh')) : null,
1740
+ creditCapability ? h('button', {
1741
+ type: 'button', className: 'ofm_btn ghost', disabled: balanceLoading || busy !== '' || !rpc,
1742
+ 'aria-busy': balanceLoading ? 'true' : undefined, onClick: () => void loadBalances(true),
1743
+ }, balanceLoading ? t('chan.credits.loading') : t('chan.credits.refresh')) : null,
1744
+ creditCapability?.claim ? h('button', {
1745
+ type: 'button', className: 'ofm_btn ghost', disabled: busy !== '' || !rpc, 'aria-busy': busy === 'claim' ? 'true' : undefined,
1746
+ onClick: claim,
1747
+ }, busy === 'claim' ? '…' : t('chan.act.claim')) : null,
1748
+ h('button', { type: 'button', className: 'ofm_foldtoggle', 'data-open': open === 'accounts' ? 'true' : 'false', onClick: () => void toggle('accounts') },
1749
+ h('svg', { viewBox: '0 0 12 12', 'aria-hidden': 'true' }, h('path', { d: 'M3 1.5l6 4.5-6 4.5z' })),
1750
+ t('chan.fold.accounts'), accounts === undefined ? null : ` (${accounts.length})`),
1751
+ h('button', { type: 'button', className: 'ofm_foldtoggle', 'data-open': open === 'models' ? 'true' : 'false', onClick: () => void toggle('models') },
1752
+ h('svg', { viewBox: '0 0 12 12', 'aria-hidden': 'true' }, h('path', { d: 'M3 1.5l6 4.5-6 4.5z' })),
1753
+ t('chan.fold.models'), models === undefined ? null : ` (${models.length})`)),
1754
+ notice !== '' ? h('p', { className: 'ofm_note' }, notice) : null,
1755
+ balanceError !== '' ? h('p', { className: 'ofm_balanceerror', role: 'alert' },
1756
+ t('chan.credits.failed').replace('{reason}', balanceError))
1757
+ : balanceFailures > 0 ? h('p', { className: 'ofm_balanceerror', role: 'status' },
1758
+ t('chan.credits.partial').replace('{count}', String(balanceFailures))) : null,
1759
+ open === 'accounts' ? h('div', { className: 'ofm_chanfold' },
1760
+ accounts === undefined ? h('div', { className: 'ofm_skel', style: { minHeight: 44 } })
1761
+ : accounts.length === 0 ? h('p', { className: 'ofm_note' }, t('chan.noAccount'))
1762
+ : h('div', { className: 'ofm_acctlist' }, accounts.map(row => {
1763
+ const credit = creditFor(row.id)
1764
+ const pending = row.refreshable !== true && !Number.isFinite(row.expiresAt)
1765
+ return h('div', { className: 'ofm_acct' + (pending ? ' pending' : ''), key: row.id },
1766
+ h('span', { className: 'ofm_acctname', title: row.nickname ?? row.id }, row.nickname ?? row.id),
1767
+ h('span', { className: 'ofm_acctmeta' }, row.enabled === false ? t('chan.disabled') : t('chan.enabled'), ' · ', expiryText(row, t)),
1768
+ credit?.todayCheckedIn === true && Number.isFinite(credit.todayCredit) ? h('span', { className: 'ofm_creditbadge' },
1769
+ t('chan.credit.today').replace('{credit}', String(credit.todayCredit))) : null,
1770
+ (() => {
1771
+ const balance = balanceOf(row.id)
1772
+ if (!creditCapability) return null
1773
+ if (balanceLoading) return h('span', { className: 'ofm_note' }, t('chan.credits.loading'))
1774
+ const result = (balances ?? []).find(entry => entry.accountId === row.id)
1775
+ if (balance === null || !Number.isFinite(balance.total)) return h('span', { className: 'ofm_balanceerror' },
1776
+ balanceError ? t('chan.credits.failed').replace('{reason}', balanceError)
1777
+ : result?.error || t('chan.credits.unavailable'))
1778
+ const reading = creditCapability.quota
1779
+ ? (balance.packages ?? []).map(pkg => `${pkg.name} ${pkg.remaining}%`).join(' · ') || '—'
1780
+ : kilo(balance.total)
1781
+ return h('span', { className: 'ofm_creditbadge strong', title: balanceLabel },
1782
+ `${balanceLabel} ${reading}`)
1783
+ })(),
1784
+ h('span', { className: 'ofm_acctacts' },
1785
+ h('button', {
1786
+ type: 'button', className: 'ofm_minibtn', disabled: busy !== '' || !rpc,
1787
+ onClick: () => accountAction('test:' + row.id, row.id, async () => {
1788
+ const value = await rpc('account.test', { accountId: row.id }, 90_000)
1789
+ setNotice(value?.ok === false
1790
+ ? t('chan.test.failed').replace('{reason}', value?.error ?? '')
1791
+ : t('chan.test.ok').replace('{ms}', String(value?.ms ?? value?.latencyMs ?? '—')))
1792
+ }),
1793
+ }, t('chan.act.test')),
1794
+ h('button', {
1795
+ type: 'button', className: 'ofm_minibtn', disabled: busy !== '' || !rpc,
1796
+ onClick: () => accountAction('refresh:' + row.id, row.id, async () => {
1797
+ await rpc('account.refresh', { accountId: row.id }, 90_000)
1798
+ onChanged(); await loadAccounts(); void loadBalances(true)
1799
+ }),
1800
+ }, t('chan.act.refresh')),
1801
+ h('button', {
1802
+ type: 'button', className: 'ofm_minibtn', disabled: busy !== '' || !rpc,
1803
+ onClick: () => accountAction('toggle:' + row.id, row.id, async () => {
1804
+ await rpc('account.update', { accountId: row.id, patch: { enabled: row.enabled === false } })
1805
+ onChanged(); await loadAccounts()
1806
+ }),
1807
+ }, row.enabled === false ? t('chan.enabled') : t('chan.disabled')),
1808
+ h('button', {
1809
+ type: 'button', className: 'ofm_minibtn danger', disabled: busy !== '' || !rpc,
1810
+ onClick: () => void removeAccount(row.id),
1811
+ }, t('chan.act.delete'))))
1812
+ }))) : null,
1813
+ open === 'models' ? h('div', { className: 'ofm_chanfold' },
1814
+ models === undefined ? h('div', { className: 'ofm_skel', style: { minHeight: 44 } })
1815
+ : models.length === 0 ? h('p', { className: 'ofm_note' }, '—')
1816
+ : h(Fragment, null,
1817
+ h('div', { className: 'ofm_row' },
1818
+ h('span', { className: 'ofm_note' }, t('chan.model.enabledCount')
1819
+ .replace('{enabled}', String(models.filter(model => model.disabled !== true).length))
1820
+ .replace('{total}', String(models.length))),
1821
+ h('button', {
1822
+ type: 'button', className: 'ofm_btn ghost', disabled: busy !== '' || !rpc,
1823
+ title: t('chan.model.allScope'), 'aria-busy': busy === 'models:show' ? 'true' : undefined,
1824
+ onClick: () => void setAllModels(false),
1825
+ }, t('chan.model.enableAll')),
1826
+ h('button', {
1827
+ type: 'button', className: 'ofm_btn ghost', disabled: busy !== '' || !rpc,
1828
+ title: t('chan.model.allScope'), 'aria-busy': busy === 'models:hide' ? 'true' : undefined,
1829
+ onClick: () => void setAllModels(true),
1830
+ }, t('chan.model.disableAll'))),
1831
+ h('div', { className: 'ofm_modellist' }, models.map(model => h('div', {
1832
+ className: 'ofm_modelrow' + (model.disabled === true ? ' off' : ''),
1833
+ key: model.id,
1834
+ },
1835
+ h('span', { className: 'ofm_id', title: model.id }, model.name ?? model.id),
1836
+ model.isFree === true ? h('span', { className: 'ofm_tagpill free' }, t('chan.model.free')) : null,
1837
+ model.dead === true ? h('span', { className: 'ofm_tagpill dead' }, t('chan.model.dead')) : null,
1838
+ h('button', {
1839
+ type: 'button', className: 'ofm_minibtn', disabled: busy !== '' || !rpc,
1840
+ onClick: () => accountAction('model:' + model.id, '', async () => {
1841
+ await rpc('model.setDisabled', { provider: channel.id, modelId: model.id, disabled: model.disabled !== true })
1842
+ await loadModels(); onChanged()
1843
+ }),
1844
+ }, model.disabled === true ? t('chan.model.on') : t('chan.model.off'))))))) : null)
1845
+
1846
+ const modal = login === null ? null : h('div', { className: 'ofm_scrim' },
1847
+ h('div', { className: 'ofm_modal', role: 'dialog', 'aria-modal': 'true', 'aria-label': t('chan.login.title').replace('{name}', channel.name) },
1848
+ h('div', { className: 'ofm_modalhead' }, t('chan.login.title').replace('{name}', channel.name)),
1849
+ h('div', { className: 'ofm_modalbody ofm_loginbody' },
1850
+ h('div', { className: 'ofm_loginstep' }, h('b', null, '1'), h('span', null, t('chan.login.step1'))),
1851
+ h('div', { className: 'ofm_loginstep' }, h('b', null, '2'), h('span', null, t('chan.login.step2'))),
1852
+ login.url === '' ? null : h('code', { className: 'ofm_mono', style: { wordBreak: 'break-all', whiteSpace: 'pre-wrap' } }, login.url),
1853
+ h('p', { className: 'ofm_note ofm_scanline' }, t('chan.login.waiting'))),
1854
+ h('div', { className: 'ofm_modalfoot' },
1855
+ login.url === '' ? null : h('a', { className: 'ofm_btn primary', href: login.url, target: '_blank', rel: 'noreferrer noopener' }, t('chan.login.open')),
1856
+ h('button', { type: 'button', className: 'ofm_btn ghost', onClick: () => setLogin(null) }, t('chan.login.cancel')))))
1857
+
1858
+ return h(Fragment, null, card, modal)
1859
+ }
1860
+
1861
+ function ChannelsPage(props) {
1862
+ const { t, ctx, summary } = props
1863
+ const { available, rpc } = useChannelRpc(ctx)
1864
+ // The pack runs a daily auto check-in engine across the credit channels;
1865
+ // this page is where it is switched and watched (usage.autoCheckin).
1866
+ const [auto, setAuto] = useState(undefined)
1867
+ const loadAuto = useCallback(async () => {
1868
+ if (!available) return
1869
+ try { const value = await rpc('usage.autoCheckin', {}, 30_000); setAuto(value?.autoCheckin ?? null) } catch { setAuto(null) }
1870
+ }, [available, rpc])
1871
+ useEffect(() => { void loadAuto() }, [loadAuto])
1872
+ const toggleAuto = async () => {
1873
+ try { const value = await rpc('usage.autoCheckin', { enabled: auto?.enabled !== true }, 60_000); setAuto(value?.autoCheckin ?? null) } catch { /* the status refresh tells */ }
1874
+ }
1875
+ const [statuses, setStatuses] = useState(undefined)
1876
+ const [error, setError] = useState('')
1877
+ const pack = summary?.channels ?? { state: 'pending', error: '' }
1878
+ // The pack is what answers this page's RPC, so *the RPC answering* is the
1879
+ // readiness signal — the summary's `channels` bit can be a step behind:
1880
+ // it is read when the page mounts, while the pack's dynamic import may
1881
+ // still be in flight, and a page that trusted it would show an empty grid
1882
+ // for as long as that stale read lasted. The summary state is then only
1883
+ // the failure *reason* when the probes never come back.
1884
+ const [ready, setReady] = useState(pack.state === 'ready')
1885
+
1886
+ const loadStatus = useCallback(async (attempt = 0) => {
1887
+ if (!available) return
1888
+ try {
1889
+ const value = await rpc('provider.status', { providers: CHANNEL_PROVIDERS.map(row => row.id) })
1890
+ setStatuses(value?.statuses ?? {})
1891
+ setReady(true)
1892
+ setError('')
1893
+ } catch (err) {
1894
+ // The pack imports asynchronously on a cold start; retry a bounded
1895
+ // few times before believing the failure and surfacing the reason.
1896
+ if (attempt < 4) { setTimeout(() => { void loadStatus(attempt + 1) }, 4000); return }
1897
+ setError(String(err?.message ?? err))
1898
+ }
1899
+ }, [available, rpc])
1900
+
1901
+ useEffect(() => { void loadStatus() }, [loadStatus])
1902
+ // A second poll loop, slow: the pack pushes nothing for accounts changed
1903
+ // in another window, and a stale count on this page is the kind of quiet
1904
+ // wrongness that reads as a bug. Local actions refresh immediately.
1905
+ useEffect(() => {
1906
+ if (!available) return undefined
1907
+ const timer = setInterval(() => { void loadStatus() }, 45_000)
1908
+ return () => clearInterval(timer)
1909
+ }, [available, loadStatus])
1910
+
1911
+ const onChanged = useCallback(() => {
1912
+ void loadStatus()
1913
+ try { window.dispatchEvent(new CustomEvent('ofm:channels')) } catch { /* no window */ }
1914
+ }, [loadStatus])
1915
+
1916
+ const onError = useCallback((channel, err) => {
1917
+ const reason = String(err?.message ?? err)
1918
+ showToast({ title: t('chan.error').replace('{reason}', reason).slice(0, 120), body: channel.name, tone: 'warn' })
1919
+ }, [t])
1920
+
1921
+ const connected = statuses === undefined ? 0 : CHANNEL_PROVIDERS.filter(row => (statuses[row.id]?.accounts?.enabled ?? 0) > 0).length
1922
+ const failed = !ready && pack.state === 'failed'
1923
+
1924
+ return h('div', { className: 'ofm_page' },
1925
+ h('header', { className: 'ofm_hero ofm_glass' },
1926
+ h('div', { className: 'ofm_pagehead' },
1927
+ h('div', { className: 'ofm_pagetitle' },
1928
+ h('h2', null, t('chan.title')),
1929
+ h('p', { className: 'ofm_pagesub' }, t('chan.sub'))),
1930
+ h('div', { className: 'ofm_pills' },
1931
+ h(Pill, { strong: true, tone: ready ? 'ok' : failed ? 'err' : 'warn' },
1932
+ ready ? `${connected}/${CHANNEL_PROVIDERS.length} ${t('chan.state.on')}` : t('chan.state.off')),
1933
+ h(Pill, null, `${t('chan.meta.accounts')} ${statuses === undefined ? '—' : CHANNEL_PROVIDERS.reduce((sum, row) => sum + (statuses[row.id]?.accounts?.enabled ?? 0), 0)}`))),
1934
+ auto == null ? null : h('div', { className: 'ofm_row' },
1935
+ h(Switch, { checked: auto.enabled === true, label: t('chan.auto.title'), onChange: () => void toggleAuto() }),
1936
+ h(Pill, { tone: auto.running === true ? 'warn' : auto.ranToday === true ? 'ok' : '' },
1937
+ auto.running === true ? t('chan.auto.running') : auto.ranToday === true ? t('chan.auto.ran') : t('chan.auto.off')),
1938
+ typeof auto.lastResult === 'string' && auto.lastResult !== '' ? h('span', { className: 'ofm_note', title: auto.lastResult }, t('chan.auto.last').replace('{result}', auto.lastResult.length > 60 ? `${auto.lastResult.slice(0, 60)}…` : auto.lastResult)) : null)),
1939
+ failed ? h('div', { className: 'ofm_callout ofm_error' },
1940
+ h('div', null, t('chan.pack.failed').replace('{reason}', pack.error ?? ''), h('div', { className: 'ofm_note' }, t('chan.pack.hint')))) : null,
1941
+ !available ? h('div', { className: 'ofm_callout' }, h('div', null, t('chan.rpc.unavailable'))) : null,
1942
+ !ready ? h('div', { className: 'ofm_chanwrap' },
1943
+ [0, 1, 2].map(index => h('div', { className: 'ofm_skel', key: index, style: { minHeight: 168 } }))) : null,
1944
+ ready ? h('div', { className: 'ofm_chanwrap' }, CHANNEL_PROVIDERS.map(channel => h(ChannelCard, {
1945
+ key: channel.id,
1946
+ channel,
1947
+ status: statuses?.[channel.id],
1948
+ rpc: available ? rpc : null,
1949
+ t,
1950
+ onError,
1951
+ onChanged,
1952
+ }))) : null,
1953
+ error !== '' && !failed ? h('p', { className: 'ofm_note' }, `${t('chan.error').replace('{reason}', error)}`) : null)
1954
+ }
1955
+
1956
+ // ── 数据看板 / 运行日志 / 网关设置 ────────────────────────────────────────
1957
+ // The absorbed pack keeps a per-request token ledger (channel → provider →
1958
+ // account → model trees, plus a ring of individual requests). These three
1959
+ // pages are its reading surface, modelled on the standalone gateway
1960
+ // consoles users already know: KPI cards, an account pivot, a model
1961
+ // performance table, a paginated request log and the gateway's switches.
1962
+ const LEDGER_EMPTY = () => ({ requests: 0, reportedRequests: 0, inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0, reasoningTokens: 0, errors: 0 })
1963
+
1964
+ /** Weighted merge of tree rows: averages are re-weighted by request count
1965
+ * so a cross-day or cross-account merge never pretends a heavy day and a
1966
+ * light day average to their mean. */
1967
+ function mergeLedgerRows(rows) {
1968
+ const out = LEDGER_EMPTY()
1969
+ let ttftSum = 0; let ttftN = 0; let tpsSum = 0; let tpsN = 0
1970
+ for (const row of rows) {
1971
+ out.requests += row.requests ?? 0
1972
+ out.reportedRequests += row.reportedRequests ?? 0
1973
+ out.inputTokens += row.inputTokens ?? 0
1974
+ out.outputTokens += row.outputTokens ?? 0
1975
+ out.cacheReadTokens += row.cacheReadTokens ?? 0
1976
+ out.cacheWriteTokens += row.cacheWriteTokens ?? 0
1977
+ out.reasoningTokens += row.reasoningTokens ?? 0
1978
+ out.errors += row.errors ?? 0
1979
+ if (Number.isFinite(row.avgTtftMs) && (row.requests ?? 0) > 0) { ttftSum += row.avgTtftMs * row.requests; ttftN += row.requests }
1980
+ if (Number.isFinite(row.avgTps) && (row.requests ?? 0) > 0) { tpsSum += row.avgTps * row.requests; tpsN += row.requests }
1981
+ }
1982
+ out.avgTtftMs = ttftN > 0 ? Math.round(ttftSum / ttftN) : null
1983
+ out.avgTps = tpsN > 0 ? Math.round((tpsSum / tpsN) * 10) / 10 : null
1984
+ return out
1985
+ }
1986
+
1987
+ /** Flatten the channel→provider→account tree into account rows. */
1988
+ function ledgerAccountRows(channels) {
1989
+ const rows = []
1990
+ for (const ch of channels ?? []) {
1991
+ for (const provider of ch.providers ?? []) {
1992
+ for (const account of provider.accounts ?? []) {
1993
+ rows.push({ channel: ch.channel, provider: provider.provider, accountId: account.accountId, ...mergeLedgerRows([account.totals ?? {}]), models: account.models ?? [] })
1994
+ }
1995
+ }
1996
+ }
1997
+ return rows
1998
+ }
1999
+
2000
+ /** Aggregate the same tree into per-model rows (across accounts). */
2001
+ function ledgerModelRows(channels) {
2002
+ const map = new Map()
2003
+ for (const ch of channels ?? []) {
2004
+ for (const provider of ch.providers ?? []) {
2005
+ for (const account of provider.accounts ?? []) {
2006
+ for (const model of account.models ?? []) {
2007
+ const key = model.model
2008
+ const row = map.get(key) ?? { model: key, providers: new Set(), rows: [] }
2009
+ row.providers.add(provider.provider)
2010
+ row.rows.push(model)
2011
+ map.set(key, row)
2012
+ }
2013
+ }
2014
+ }
2015
+ }
2016
+ return [...map.values()].map(row => ({ model: row.model, providers: [...row.providers], ...mergeLedgerRows(row.rows) }))
2017
+ }
2018
+
2019
+ /** Flatten history days into one merged tree (the 全部历史 view). */
2020
+ function mergedHistoryChannels(days) {
2021
+ const map = new Map()
2022
+ for (const day of days ?? []) {
2023
+ for (const ch of day.channels ?? []) {
2024
+ const slot = map.get(ch.channel) ?? { channel: ch.channel, providers: [] }
2025
+ for (const provider of ch.providers ?? []) {
2026
+ let pslot = slot.providers.find(row => row.provider === provider.provider)
2027
+ if (pslot === undefined) { pslot = { provider: provider.provider, accounts: [] }; slot.providers.push(pslot) }
2028
+ for (const account of provider.accounts ?? []) {
2029
+ let aslot = pslot.accounts.find(row => row.accountId === account.accountId)
2030
+ if (aslot === undefined) { aslot = { accountId: account.accountId, models: [] }; pslot.accounts.push(aslot) }
2031
+ aslot.models.push(...(account.models ?? []))
2032
+ }
2033
+ }
2034
+ map.set(ch.channel, slot)
2035
+ }
2036
+ }
2037
+ // Re-aggregate the piled-up model lists into proper totals per account.
2038
+ for (const ch of map.values()) {
2039
+ for (const provider of ch.providers) {
2040
+ for (const account of provider.accounts) {
2041
+ const byModel = new Map()
2042
+ for (const model of account.models) {
2043
+ const row = byModel.get(model.model) ?? { model: model.model, rows: [] }
2044
+ row.rows.push(model); byModel.set(model.model, row)
2045
+ }
2046
+ account.models = [...byModel.values()].map(row => ({ model: row.model, ...mergeLedgerRows(row.rows) }))
2047
+ account.totals = mergeLedgerRows(account.models)
2048
+ }
2049
+ }
2050
+ }
2051
+ return [...map.values()]
2052
+ }
2053
+
2054
+ const fmtInt = value => Number.isFinite(value) ? value.toLocaleString() : '—'
2055
+ const fmtPct = (part, whole) => whole > 0 ? `${Math.round(100 * part / whole)}%` : '—'
2056
+ const fmtMs = value => Number.isFinite(value) && value > 0 ? `${value >= 1000 ? `${(value / 1000).toFixed(2)} s` : `${Math.round(value)} ms`}` : '—'
2057
+ const fmtTps = value => Number.isFinite(value) && value > 0 ? `${value.toFixed(1)} tok/s` : '—'
2058
+
2059
+ function useLedger(props) {
2060
+ const { available, rpc } = useChannelRpc(props.ctx)
2061
+ const [state, setState] = useState({ status: 'loading', history: [], snapshot: null, error: '' })
2062
+ const load = useCallback(async () => {
2063
+ if (!available) { setState(current => ({ ...current, status: 'unavailable', error: 'no-connection' })); return }
2064
+ try {
2065
+ const [ledger, history] = await Promise.all([
2066
+ rpc('usage.tokenLedger', { limit: 400 }, 60_000),
2067
+ rpc('usage.tokenLedgerHistory', { sinceDays: 90 }, 60_000),
2068
+ ])
2069
+ setState({ status: 'ready', snapshot: ledger?.snapshot ?? null, history: history?.history ?? [], totals: history?.totals ?? null, error: '' })
2070
+ } catch (error) { setState(current => ({ ...current, status: 'error', error: String(error?.message ?? error) })) }
2071
+ }, [available, rpc])
2072
+ useEffect(() => { void load() }, [load])
2073
+ return { ...state, reload: load }
2074
+ }
2075
+
2076
+ /** KPI cards: one reading per card, exactly like the gateway consoles. */
2077
+ function KpiCard(props) {
2078
+ const { label, value, sub, tone } = props
2079
+ return h('div', { className: `ofm_kpi ofm_glass${tone ? ` ${tone}` : ''}` },
2080
+ h('span', { className: 'ofm_kpilabel' }, label),
2081
+ h('b', { className: 'ofm_kpivalue' }, value),
2082
+ sub === undefined ? null : h('span', { className: 'ofm_kpisub' }, sub))
2083
+ }
2084
+
2085
+ function LedgerPage(props) {
2086
+ const { t, ctx } = props
2087
+ const ledger = useLedger(props)
2088
+ const [scope, setScope] = useState('today')
2089
+ const loaded = ledger.status === 'ready'
2090
+ // 今日 = the pack's live snapshot (its in-memory day tree); 全部 = the
2091
+ // persisted day aggregation, merged back into one tree. The grand
2092
+ // cumulative number always reads the history total — even on 今日 —
2093
+ // because "累计" that resets at midnight is a lie.
2094
+ const channels = scope === 'today'
2095
+ ? (ledger.snapshot?.channels ?? [])
2096
+ : mergedHistoryChannels(ledger.history)
2097
+ const totals = scope === 'today'
2098
+ ? mergeLedgerRows([ledger.snapshot?.totals ?? {}])
2099
+ : mergeLedgerRows((ledger.history ?? []).map(day => day.totals ?? {}))
2100
+ const cumulative = ledger.totals ?? ledger.snapshot?.totals ?? {}
2101
+ const accounts = ledgerAccountRows(channels)
2102
+ const models = ledgerModelRows(channels).sort((a, b) => (b.inputTokens + b.outputTokens) - (a.inputTokens + a.outputTokens))
2103
+ // The pack's ring is already newest-first (`token-ledger.ts`: "最近明细
2104
+ // (最新在前)", built with `unshift`), so it is used as served. Reversing it
2105
+ // here put the oldest request at the top of the table — and, behind the log
2106
+ // page's pagination, the request the user just made on the last page.
2107
+ const entries = ledger.snapshot?.entries ?? []
2108
+ const tokenTotal = totals.inputTokens + totals.outputTokens
2109
+ const cacheBase = totals.inputTokens + totals.cacheReadTokens
2110
+
2111
+ if (ledger.status === 'unavailable') {
2112
+ return h('div', { className: 'ofm_page' },
2113
+ h(PageHero, { title: t('dash.title'), sub: t('dash.sub') }),
2114
+ h('div', { className: 'ofm_callout' }, h('div', null, t('chan.rpc.unavailable'))))
2115
+ }
2116
+ return h('div', { className: 'ofm_page' },
2117
+ h(PageHero, { t, titleKey: 'dash.title', subKey: 'dash.sub' },
2118
+ h('div', { className: 'ofm_seg', role: 'tablist' },
2119
+ ['today', 'all'].map(key => h('button', {
2120
+ key, type: 'button', 'aria-pressed': scope === key ? 'true' : 'false',
2121
+ onClick: () => setScope(key),
2122
+ }, key === 'today' ? t('dash.today') : t('dash.all')))),
2123
+ h(Button, { onClick: () => void ledger.reload() }, t('dash.refresh'))),
2124
+ !loaded ? h('div', { className: 'ofm_chanwrap' }, [0, 1, 2].map(i => h('div', { className: 'ofm_skel', key: i, style: { minHeight: 120 } }))) : null,
2125
+ loaded ? h('div', { className: 'ofm_kpis' },
2126
+ h(KpiCard, { label: scope === 'today' ? t('dash.kpiToday') : t('dash.kpiScopeAll'), value: fmtInt(tokenTotal), sub: `${t('dash.input')} ${fmtInt(totals.inputTokens)} · ${t('dash.output')} ${fmtInt(totals.outputTokens)} · ${t('dash.reasoning')} ${fmtInt(totals.reasoningTokens)}` }),
2127
+ h(KpiCard, { label: t('dash.kpiCumulative'), value: fmtInt((cumulative.inputTokens ?? 0) + (cumulative.outputTokens ?? 0)), sub: `${t('dash.input')} ${fmtInt(cumulative.inputTokens)} · ${t('dash.output')} ${fmtInt(cumulative.outputTokens)} · ${t('dash.reasoning')} ${fmtInt(cumulative.reasoningTokens)}` }),
2128
+ h(KpiCard, { label: t('dash.kpiSpeed'), value: fmtTps(totals.avgTps), sub: `${t('dash.ttft')} ${fmtMs(totals.avgTtftMs)}` }),
2129
+ h(KpiCard, { label: t('dash.kpiCache'), value: fmtPct(totals.cacheReadTokens, cacheBase), sub: `${t('dash.cacheTokens')} ${fmtInt(totals.cacheReadTokens)}` }),
2130
+ h(KpiCard, { label: t('dash.kpiRequests'), value: fmtInt(totals.requests), sub: `${t('dash.successRate')} ${fmtPct(totals.requests - totals.errors, totals.requests)} · ${t('dash.failed')} ${fmtInt(totals.errors)}`, tone: totals.errors > 0 ? 'warn' : '' })) : null,
2131
+ loaded ? h(Section, { title: t('dash.recentTitle'), hint: t('dash.recentHint') },
2132
+ entries.length === 0 ? h('p', { className: 'ofm_note' }, t('dash.empty'))
2133
+ : h('div', { className: 'ofm_tablewrap' }, h('table', { className: 'ofm_table' },
2134
+ h('thead', null, h('tr', null,
2135
+ h('th', { key: 'time' }, t('log.time')),
2136
+ h('th', { key: 'chan' }, t('chan.titleSingle')),
2137
+ h('th', { key: 'model' }, t('log.model')),
2138
+ h('th', { key: 'account' }, t('log.account')),
2139
+ h('th', { key: 'via' }, t('log.via')),
2140
+ h('th', { key: 'result' }, t('log.result')),
2141
+ h('th', { key: 'duration' }, t('log.duration')),
2142
+ h('th', { key: 'ttft' }, t('log.ttft')),
2143
+ h('th', { key: 'speed' }, t('log.speed')),
2144
+ h('th', { key: 'input' }, t('log.input')),
2145
+ h('th', { key: 'output' }, t('log.output')),
2146
+ h('th', { key: 'reasoning' }, t('log.reasoning')),
2147
+ h('th', { key: 'cache' }, t('log.cache')),
2148
+ h('th', { key: 'total' }, t('log.total')))),
2149
+ h('tbody', null, entries.slice(0, 12).map((entry, index) => h('tr', { key: index },
2150
+ h('td', null, new Date(entry.ts).toLocaleString()),
2151
+ h('td', null, entry.provider),
2152
+ h('td', null, entry.model),
2153
+ h('td', null, entry.accountId || '—'),
2154
+ h('td', null, entry.channel === 'gateway' ? t('log.viaGateway') : t('log.viaDirect')),
2155
+ h('td', null, entry.error ? h('span', { className: 'ofm_badge unavailable', title: entry.error }, t('log.failed')) : h('span', { className: 'ofm_badge available' }, t('log.ok'))),
2156
+ h('td', { className: 'ofm_num' }, fmtMs(entry.durationMs)),
2157
+ h('td', { className: 'ofm_num' }, fmtMs(entry.ttftMs)),
2158
+ h('td', { className: 'ofm_num' }, fmtTps(entry.tps)),
2159
+ h('td', { className: 'ofm_num' }, fmtInt(entry.inputTokens)),
2160
+ h('td', { className: 'ofm_num' }, fmtInt(entry.outputTokens)),
2161
+ h('td', { className: 'ofm_num' }, Number.isFinite(entry.reasoningTokens) ? fmtInt(entry.reasoningTokens) : '—'),
2162
+ h('td', { className: 'ofm_num' }, Number.isFinite(entry.cacheReadTokens) ? fmtInt(entry.cacheReadTokens) : '—'),
2163
+ h('td', { className: 'ofm_num' }, h('b', null, fmtInt(entry.inputTokens + entry.outputTokens))))))))) : null,
2164
+ loaded ? h(Section, { title: t('dash.accountsTitle'), hint: t('dash.accountsHint') },
2165
+ accounts.length === 0 ? h('p', { className: 'ofm_note' }, t('dash.empty'))
2166
+ : h('div', { className: 'ofm_tablewrap' }, h('table', { className: 'ofm_table' },
2167
+ h('thead', null, h('tr', null,
2168
+ h('th', { key: 'account' }, t('log.account')),
2169
+ h('th', { key: 'chan' }, t('chan.titleSingle')),
2170
+ h('th', { key: 'requests' }, t('log.requests')),
2171
+ h('th', { key: 'total' }, t('log.total')),
2172
+ h('th', { key: 'input' }, t('log.input')),
2173
+ h('th', { key: 'output' }, t('log.output')),
2174
+ h('th', { key: 'reasoning' }, t('log.reasoning')),
2175
+ h('th', { key: 'cache' }, t('log.cache')),
2176
+ h('th', { key: 'mix' }, t('log.modelMix')))),
2177
+ h('tbody', null, accounts.sort((a, b) => b.requests - a.requests).map((row, index) => h('tr', { key: index },
2178
+ h('td', null, h('b', null, row.accountId || t('log.unattributed'))),
2179
+ h('td', null, row.provider),
2180
+ h('td', { className: 'ofm_num' }, fmtInt(row.requests)),
2181
+ h('td', { className: 'ofm_num' }, fmtInt(row.inputTokens + row.outputTokens)),
2182
+ h('td', { className: 'ofm_num' }, fmtInt(row.inputTokens)),
2183
+ h('td', { className: 'ofm_num' }, fmtInt(row.outputTokens)),
2184
+ h('td', { className: 'ofm_num' }, fmtInt(row.reasoningTokens)),
2185
+ h('td', { className: 'ofm_num' }, fmtInt(row.cacheReadTokens)),
2186
+ h('td', null, (row.models ?? []).slice().sort((a, b) => ((b.inputTokens ?? 0) + (b.outputTokens ?? 0)) - ((a.inputTokens ?? 0) + (a.outputTokens ?? 0))).slice(0, 2).map(model => `${model.model} · ${fmtInt((model.inputTokens ?? 0) + (model.outputTokens ?? 0))}`).join(',') || '—'))))))) : null,
2187
+ loaded ? h(Section, { title: t('dash.modelsTitle'), hint: t('dash.modelsHint') },
2188
+ models.length === 0 ? h('p', { className: 'ofm_note' }, t('dash.empty'))
2189
+ : h('div', { className: 'ofm_tablewrap' }, h('table', { className: 'ofm_table' },
2190
+ h('thead', null, h('tr', null,
2191
+ h('th', { key: 'model' }, t('log.model')),
2192
+ h('th', { key: 'chan' }, t('chan.titleSingle')),
2193
+ h('th', { key: 'requests' }, t('log.requests')),
2194
+ h('th', { key: 'failed' }, t('log.failed')),
2195
+ h('th', { key: 'total' }, t('log.total')),
2196
+ h('th', { key: 'slash' }, t('log.inputSlash')),
2197
+ h('th', { key: 'ttft' }, t('log.ttft')),
2198
+ h('th', { key: 'speed' }, t('log.speed')),
2199
+ h('th', { key: 'hit' }, t('log.cacheHit')),
2200
+ h('th', { key: 'share' }, t('log.share')))),
2201
+ h('tbody', null, models.map(row => h('tr', { key: row.model },
2202
+ h('td', null, h('b', null, row.model)),
2203
+ h('td', null, row.providers.join(',')),
2204
+ h('td', { className: 'ofm_num' }, fmtInt(row.requests)),
2205
+ h('td', { className: 'ofm_num' }, row.errors > 0 ? h('span', { className: 'ofm_badge unavailable' }, fmtInt(row.errors)) : fmtInt(0)),
2206
+ h('td', { className: 'ofm_num' }, fmtInt(row.inputTokens + row.outputTokens)),
2207
+ h('td', { className: 'ofm_num' }, `${fmtInt(row.inputTokens)} / ${fmtInt(row.outputTokens)} / ${fmtInt(row.reasoningTokens)}`),
2208
+ h('td', { className: 'ofm_num' }, fmtMs(row.avgTtftMs)),
2209
+ h('td', { className: 'ofm_num' }, fmtTps(row.avgTps)),
2210
+ h('td', { className: 'ofm_num' }, fmtPct(row.cacheReadTokens, row.inputTokens + row.cacheReadTokens)),
2211
+ h('td', { className: 'ofm_num' }, `${fmtPct(row.inputTokens + row.outputTokens, tokenTotal)}`))))))) : null)
2212
+ }
2213
+
2214
+ /** The log page: the same request ring, at full width and full detail. */
2215
+ function LogsPage(props) {
2216
+ const { t, ctx } = props
2217
+ const ledger = useLedger(props)
2218
+ const [pageSize, setPageSize] = useState(20)
2219
+ const [auto, setAuto] = useState(false)
2220
+ const reload = ledger.reload
2221
+ useEffect(() => {
2222
+ if (auto !== true) return undefined
2223
+ const timer = setInterval(() => { void reload() }, 10_000)
2224
+ return () => clearInterval(timer)
2225
+ }, [auto, reload])
2226
+ // Newest first, as the pack serves it — see the note in LedgerPage.
2227
+ const entries = ledger.snapshot?.entries ?? []
2228
+ const pages = Math.max(1, Math.ceil(entries.length / pageSize))
2229
+ const [page, setPage] = useState(1)
2230
+ const safePage = Math.min(page, pages)
2231
+ const rows = entries.slice((safePage - 1) * pageSize, safePage * pageSize)
2232
+ return h('div', { className: 'ofm_page' },
2233
+ h(PageHero, { title: t('logs.title'), sub: t('logs.sub') },
2234
+ h('div', { className: 'ofm_seg' }, [10, 20, 50, 100].map(size => h('button', {
2235
+ key: size, type: 'button', 'aria-pressed': pageSize === size ? 'true' : 'false',
2236
+ onClick: () => { setPageSize(size); setPage(1) },
2237
+ }, String(size)))),
2238
+ h(Switch, { checked: auto, label: t('logs.auto'), onChange: () => setAuto(value => !value) }),
2239
+ h(Button, { onClick: () => void reload() }, t('dash.refresh'))),
2240
+ ledger.status === 'unavailable' ? h('div', { className: 'ofm_callout' }, h('div', null, t('chan.rpc.unavailable'))) : null,
2241
+ ledger.status === 'loading' ? h('div', { className: 'ofm_skel', style: { minHeight: 200 } }) : null,
2242
+ ledger.status === 'ready' ? h(Section, {
2243
+ title: t('logs.title'),
2244
+ hint: t('logs.count').replace('{shown}', String(rows.length)).replace('{total}', String(entries.length)),
2245
+ },
2246
+ entries.length === 0 ? h('p', { className: 'ofm_note' }, t('logs.empty'))
2247
+ : h('div', { className: 'ofm_tablewrap' }, h('table', { className: 'ofm_table' },
2248
+ h('thead', null, h('tr', null,
2249
+ h('th', { key: 'time' }, t('log.time')),
2250
+ h('th', { key: 'chan' }, t('chan.titleSingle')),
2251
+ h('th', { key: 'model' }, t('log.model')),
2252
+ h('th', { key: 'account' }, t('log.account')),
2253
+ h('th', { key: 'via' }, t('log.via')),
2254
+ h('th', { key: 'result' }, t('log.result')),
2255
+ h('th', { key: 'duration' }, t('log.duration')),
2256
+ h('th', { key: 'ttft' }, t('log.ttft')),
2257
+ h('th', { key: 'speed' }, t('log.speed')),
2258
+ h('th', { key: 'input' }, t('log.input')),
2259
+ h('th', { key: 'output' }, t('log.output')),
2260
+ h('th', { key: 'reasoning' }, t('log.reasoning')),
2261
+ h('th', { key: 'cache' }, t('log.cache')),
2262
+ h('th', { key: 'total' }, t('log.total')))),
2263
+ h('tbody', null, rows.map((entry, index) => h('tr', { key: index, className: entry.error ? 'ofm_logfailed' : '' },
2264
+ h('td', null, new Date(entry.ts).toLocaleString()),
2265
+ h('td', null, entry.provider),
2266
+ h('td', null, entry.model),
2267
+ h('td', null, entry.accountId || '—'),
2268
+ h('td', null, entry.channel === 'gateway' ? t('log.viaGateway') : t('log.viaDirect')),
2269
+ h('td', null, entry.error ? h('span', { className: 'ofm_badge unavailable', title: entry.error }, t('log.failed')) : h('span', { className: 'ofm_badge available' }, t('log.ok'))),
2270
+ h('td', { className: 'ofm_num' }, fmtMs(entry.durationMs)),
2271
+ h('td', { className: 'ofm_num' }, fmtMs(entry.ttftMs)),
2272
+ h('td', { className: 'ofm_num' }, fmtTps(entry.tps)),
2273
+ h('td', { className: 'ofm_num' }, fmtInt(entry.inputTokens)),
2274
+ h('td', { className: 'ofm_num' }, fmtInt(entry.outputTokens)),
2275
+ h('td', { className: 'ofm_num' }, Number.isFinite(entry.reasoningTokens) ? fmtInt(entry.reasoningTokens) : '—'),
2276
+ h('td', { className: 'ofm_num' }, Number.isFinite(entry.cacheReadTokens) ? fmtInt(entry.cacheReadTokens) : '—'),
2277
+ h('td', { className: 'ofm_num' }, h('b', null, fmtInt(entry.inputTokens + entry.outputTokens)))))))),
2278
+ pages > 1 ? h('div', { className: 'ofm_row' },
2279
+ h(Button, { kind: 'ghost', disabled: safePage <= 1, onClick: () => setPage(value => Math.max(1, value - 1)) }, '‹'),
2280
+ h('span', { className: 'ofm_note' }, t('logs.page').replace('{page}', String(safePage)).replace('{pages}', String(pages))),
2281
+ h(Button, { kind: 'ghost', disabled: safePage >= pages, onClick: () => setPage(value => Math.min(pages, value + 1)) }, '›')) : null,
2282
+ h('p', { className: 'ofm_note' }, t('logs.windowNote'))) : null)
2283
+ }
2284
+
2285
+ /** The gateway page: the pack's OpenAI endpoint plus this plugin's relay. */
2286
+ function GatewayPage(props) {
2287
+ const { t, ctx, settings, apply, busy } = props
2288
+ const { available, rpc } = useChannelRpc(ctx)
2289
+ const [status, setStatus] = useState(undefined)
2290
+ const [gwBusy, setGwBusy] = useState(false)
2291
+ const [notice, setNotice] = useState('')
2292
+ const [keyShown, setKeyShown] = useState(false)
2293
+ const [relay, setRelay] = useState(undefined)
2294
+ const [relayKey, setRelayKey] = useState('')
2295
+ const [relayBusy, setRelayBusy] = useState(false)
2296
+ const loadGateway = useCallback(async () => {
2297
+ if (!available) return
2298
+ try { setStatus(await rpc('gateway.getEnabled', {}, 30_000)) } catch (error) { setNotice(String(error?.message ?? error)) }
2299
+ }, [available, rpc])
2300
+ const loadRelay = useCallback(async () => {
2301
+ try { setRelay(await api('/chan-gateway')) } catch { setRelay(null) }
2302
+ }, [])
2303
+ useEffect(() => { void loadGateway(); void loadRelay() }, [loadGateway, loadRelay])
2304
+
2305
+ const toggleGateway = async enabled => {
2306
+ setGwBusy(true); setNotice('')
2307
+ try { setStatus(await rpc('gateway.setEnabled', { enabled }, 60_000)) } catch (error) { setNotice(String(error?.message ?? error)) } finally { setGwBusy(false) }
2308
+ }
2309
+ const applyRelay = async patch => {
2310
+ setRelayBusy(true); setNotice('')
2311
+ try { setRelay(await post('/chan-gateway/apply', patch)) } catch (error) { setNotice(String(error?.message ?? error)) } finally { setRelayBusy(false) }
2312
+ }
2313
+ const showRelayKey = async () => {
2314
+ try { setRelayKey((await api('/chan-gateway/key')).key ?? '') } catch { setRelayKey('') }
2315
+ }
2316
+
2317
+ // The RPC returns structured values, not strings: `address` is
2318
+ // { host, port } and `apiKey` is { value, fromEnv, path } — rendering
2319
+ // either directly hands React an object, which is a crash (#31), not a
2320
+ // wrong sentence.
2321
+ const address = status?.address ?? null
2322
+ const gatewayUrl = address !== null && typeof address === 'object'
2323
+ ? `http://${address.host}:${address.port}/v1`
2324
+ : ''
2325
+ const apiKeyInfo = typeof status?.apiKey === 'object' && status?.apiKey !== null ? status.apiKey : null
2326
+ const apiKeyValue = apiKeyInfo?.value ?? ''
2327
+ const models = status?.models ?? []
2328
+ return h('div', { className: 'ofm_page' },
2329
+ h(PageHero, { title: t('gw.title'), sub: t('gw.sub') },
2330
+ h(Button, { onClick: () => { void loadGateway(); void loadRelay() } }, t('dash.refresh'))),
2331
+ notice !== '' ? h('div', { className: 'ofm_callout ofm_error' }, h('div', null, notice)) : null,
2332
+ h(Section, { title: t('gw.gatewayTitle'), hint: t('gw.gatewayHint') },
2333
+ status === undefined ? h('div', { className: 'ofm_skel', style: { minHeight: 96 } })
2334
+ : h('div', { className: 'ofm_panel' },
2335
+ h('div', { className: 'ofm_row' },
2336
+ h(Pill, { strong: true, tone: status.running === true ? 'ok' : 'warn' }, status.running === true ? t('gw.running') : t('gw.stopped')),
2337
+ status.blockedByEnv === true ? h(Pill, { tone: 'err' }, t('gw.envBlocked')) : null,
2338
+ h(Switch, { checked: status.enabled === true, label: t('gw.switch'), onChange: () => void toggleGateway(status.enabled !== true), disabled: gwBusy })),
2339
+ h('div', { className: 'ofm_row' },
2340
+ h('span', { className: 'ofm_note' }, t('gw.endpoint')),
2341
+ gatewayUrl === '' ? h('span', { className: 'ofm_note' }, '—')
2342
+ : h(Fragment, null, h('code', { className: 'ofm_mono' }, gatewayUrl), h(Button, { kind: 'ghost', onClick: () => copy(gatewayUrl, () => {}) }, t('eac.copy')))),
2343
+ h('div', { className: 'ofm_row' },
2344
+ h('span', { className: 'ofm_note' }, t('gw.key')),
2345
+ apiKeyValue === '' ? h('span', { className: 'ofm_note' }, t('gw.keyNone'))
2346
+ : h(Fragment, null,
2347
+ h('code', { className: 'ofm_mono' }, keyShown ? apiKeyValue : '••••••••••••••••'),
2348
+ h(Button, { kind: 'ghost', onClick: () => setKeyShown(value => !value) }, keyShown ? t('gw.hide') : t('gw.show')),
2349
+ h(Button, { kind: 'ghost', onClick: () => copy(apiKeyValue, () => {}) }, t('eac.copy'))),
2350
+ h('span', { className: 'ofm_note' }, apiKeyInfo === null ? t('gw.keyNoneHint') : t('gw.keyNote'))),
2351
+ h('div', { className: 'ofm_row' },
2352
+ h('span', { className: 'ofm_note' }, `${t('gw.models')} ${models.length}`),
2353
+ h('span', { className: 'ofm_note' }, t('gw.portNote'))))),
2354
+ h(Section, { title: t('gw.relayTitle'), hint: t('gw.relayHint') },
2355
+ relay === undefined ? h('div', { className: 'ofm_skel', style: { minHeight: 96 } })
2356
+ : h('div', { className: 'ofm_panel' },
2357
+ h('div', { className: 'ofm_row' },
2358
+ h(Pill, { strong: true, tone: relay.relay?.running === true ? 'ok' : 'warn' }, relay.relay?.running === true ? t('gw.running') : t('gw.stopped')),
2359
+ h(Switch, {
2360
+ checked: relay.relay?.enabled === true, label: t('gw.relaySwitch'), disabled: relayBusy,
2361
+ onChange: () => void applyRelay({ enabled: relay.relay?.enabled !== true }),
2362
+ })),
2363
+ relay.relay?.error ? h('div', { className: 'ofm_callout ofm_error' }, h('div', null, relay.relay.error)) : null,
2364
+ h('div', { className: 'ofm_row' },
2365
+ h('div', { className: 'ofm_field' }, h('span', null, t('gw.relayBind')),
2366
+ h('select', {
2367
+ className: 'ofm_input', value: relay.relay?.host ?? '127.0.0.1',
2368
+ onChange: event => void applyRelay({ host: event.target.value }),
2369
+ },
2370
+ h('option', { value: '127.0.0.1' }, t('gw.bindLocal')),
2371
+ h('option', { value: '0.0.0.0' }, t('gw.bindLan')))),
2372
+ h('div', { className: 'ofm_field' }, h('span', null, t('gw.relayPort')),
2373
+ h('input', {
2374
+ className: 'ofm_input', type: 'number', min: 0, max: 65535, style: { width: 120 },
2375
+ defaultValue: relay.relay?.port ?? 18326,
2376
+ onBlur: event => { const port = Number(event.target.value); if (Number.isInteger(port) && port >= 0 && port <= 65535 && port !== (relay.relay?.port ?? 0)) void applyRelay({ port }) },
2377
+ }))),
2378
+ relay.relay?.running === true ? h('div', { className: 'ofm_row' },
2379
+ h('span', { className: 'ofm_note' }, t('gw.relayUrl')),
2380
+ h('code', { className: 'ofm_mono' }, `http://${relay.relay.host === '0.0.0.0' || relay.relay.host === '::' ? '<lan-ip>' : relay.relay.host}:${relay.relay.port}/v1`),
2381
+ h(Button, { kind: 'ghost', onClick: () => copy(`http://${relay.relay.host}:${relay.relay.port}/v1`, () => {}) }, t('eac.copy'))) : null,
2382
+ h('div', { className: 'ofm_row' },
2383
+ h('span', { className: 'ofm_note' }, t('gw.relayKey')),
2384
+ h('code', { className: 'ofm_mono' }, relayKey === '' ? '••••••••••••••••' : relayKey),
2385
+ h(Button, { kind: 'ghost', onClick: () => void showRelayKey() }, t('gw.show')),
2386
+ relayKey === '' ? null : h(Button, { kind: 'ghost', onClick: () => copy(relayKey, () => {}) }, t('eac.copy')),
2387
+ h(Button, {
2388
+ kind: 'ghost', disabled: relayBusy,
2389
+ onClick: async () => { try { setRelayKey((await post('/chan-gateway/rotate')).key ?? '') } catch (error) { setNotice(String(error?.message ?? error)) } },
2390
+ }, t('gw.rotate'))),
2391
+ h('p', { className: 'ofm_note' }, t('gw.relayNote')))),
2392
+ h(Section, { title: t('section.egress'), hint: t('section.egressHint') }, h(Egress, { settings, t, onApply: apply, busy })))
2393
+ }
2394
+
2395
+ /** Shared page hero for the three gateway-console pages. The caller
2396
+ * renders the copy: literal t() calls stay visible to the copy lint. */
2397
+ function PageHero(props) {
2398
+ const { title, sub, children } = props
2399
+ return h('header', { className: 'ofm_hero ofm_glass' },
2400
+ h('div', { className: 'ofm_pagehead' },
2401
+ h('div', { className: 'ofm_pagetitle' },
2402
+ h('h2', null, title),
2403
+ h('p', { className: 'ofm_pagesub' }, sub)),
2404
+ children))
2405
+ }
2406
+
2407
+ // ── settings page ─────────────────────────────────────────────────────────
2408
+ function SettingsPage(props) {
2409
+ const tagged = props.locale === undefined ? props.t : Object.assign(x => props.t(x), { locale: props.locale })
2410
+ const t = tagged
2411
+ const [busy, setBusy] = useState(false)
2412
+ const summary = useAsync(() => api('/summary'), [])
2413
+
2414
+ const apply = async patch => {
2415
+ setBusy(true)
2416
+ try {
2417
+ await post('/settings', patch)
2418
+ summary.reload()
2419
+ } catch (error) {
2420
+ // The route can refuse a patch — a routable forward bind, for one — and a
2421
+ // rejection nobody shows is a button that appears to do nothing.
2422
+ showToast({ title: t('settings.failed'), body: String(error?.message ?? error), tone: 'warn' })
2423
+ } finally { setBusy(false) }
2424
+ }
2425
+
2426
+ if (summary.status === 'loading' && summary.data === undefined) return h('div', { className: 'ofm_root' }, h('p', { className: 'ofm_note' }, t('loading')))
2427
+ if (summary.status === 'error') {
2428
+ return h('div', { className: 'ofm_root' },
2429
+ h('div', { className: 'ofm_callout ofm_error' }, h('div', null, h('b', null, t('loadFailed')), h('div', null, summary.error))),
2430
+ h('div', null, h(Button, { onClick: () => summary.reload() }, t('retry'))))
2431
+ }
2432
+ return h(Shell, { t: tagged, data: summary.data, summary, busy, apply, ctx: props.ctx })
2433
+ }
2434
+
2435
+ // ── the four-page shell ───────────────────────────────────────────────────
2436
+ // The settings section is four pages behind one glass navigation bar: the
2437
+ // channel logins, the token ledger, the request log and the gateway. The
2438
+ // active page lives in localStorage so a reload comes back to the page the
2439
+ // user was reading.
2440
+ const TAB_KEY = 'ofm.tab'
2441
+ const TABS = ['channels', 'ledger', 'logs', 'gateway']
2442
+
2443
+ function Shell(props) {
2444
+ const { t, data, summary, busy, apply, ctx } = props
2445
+ const [tab, setTab] = useState(() => {
2446
+ try {
2447
+ const saved = window.localStorage?.getItem(TAB_KEY)
2448
+ return TABS.includes(saved) ? saved : 'channels'
2449
+ } catch { return 'channels' }
2450
+ })
2451
+ const tabRefs = useRef({})
2452
+ const [glider, setGlider] = useState({ left: 0, top: 0, width: 0, height: 0 })
2453
+ useEffect(() => {
2454
+ try { window.localStorage?.setItem(TAB_KEY, tab) } catch { /* storage unavailable */ }
2455
+ const node = tabRefs.current[tab]
2456
+ // Tabs may wrap onto a second row inside the group, so the glider is
2457
+ // placed on both axes: translate alone would put it at the right
2458
+ // height and the wrong row.
2459
+ if (node !== undefined && node !== null) setGlider({ left: node.offsetLeft, top: node.offsetTop, width: node.offsetWidth, height: node.offsetHeight })
2460
+ }, [tab, t.locale])
2461
+
2462
+ const tabs = [
2463
+ ['channels', t('nav.tab.channels'), CHANNEL_PROVIDERS.length],
2464
+ ['ledger', t('nav.tab.ledger'), null],
2465
+ ['logs', t('nav.tab.logs'), null],
2466
+ ['gateway', t('nav.tab.gateway'), null],
2467
+ ]
2468
+ const nav = h('nav', { className: 'ofm_nav' },
2469
+ h('span', { className: 'ofm_navbrand' },
2470
+ h('span', { className: 'ofm_navmark', 'aria-hidden': 'true' },
2471
+ h('img', { src: BRAND_ICON, alt: '' })),
2472
+ t('title')),
2473
+ h('div', { className: 'ofm_tabs', role: 'tablist' },
2474
+ h('span', { className: 'ofm_tabglider', style: { transform: `translate(${glider.left}px, ${glider.top}px)`, width: `${glider.width}px`, height: `${glider.height}px` } }),
2475
+ tabs.map(([id, label, num]) => h('button', {
2476
+ key: id, type: 'button', role: 'tab', 'aria-selected': tab === id ? 'true' : 'false', className: 'ofm_tab', 'data-on': tab === id ? 'true' : 'false',
2477
+ ref: node => { tabRefs.current[id] = node },
2478
+ onClick: () => setTab(id),
2479
+ }, label, num === null ? null : h('span', { className: 'ofm_tabnum' }, String(num))))),
2480
+ h('span', { className: 'ofm_navspacer' }))
2481
+
2482
+ const page = tab === 'ledger'
2483
+ ? h(LedgerPage, { t, ctx })
2484
+ : tab === 'logs'
2485
+ ? h(LogsPage, { t, ctx })
2486
+ : tab === 'gateway'
2487
+ ? h(GatewayPage, { t, ctx, settings: data.settings, apply, busy })
2488
+ : h(ChannelsPage, { t, ctx, summary: data })
2489
+
2490
+ return h('div', { className: 'ofm_root ofm_shell' }, nav, page)
2491
+ }
2492
+
2493
+ // ── registration ──────────────────────────────────────────────────────────
2494
+ // The shell mirrors the active language onto <html lang>, so a render-time
2495
+ // read survives a language switch without owning a subscription.
2496
+ function localeTag(ctx) {
2497
+ try {
2498
+ const snapshot = typeof ctx.locale?.getLocale === 'function' ? ctx.locale.getLocale() : ctx.locale?.getSnapshot?.()
2499
+ const value = snapshot?.active ?? ctx.locale?.locale
2500
+ return typeof value === 'string' ? value : document.documentElement.lang || 'en'
2501
+ } catch { return 'en' }
2502
+ }
2503
+
2504
+ function apply(ctx) {
2505
+ const t = ctx.locale.bind(NS)
2506
+ ctx.effect(() => ctx.locale.register(NS, { zh: DICT.zh, en: DICT.en }), 'our-free-model: dictionaries')
2507
+
2508
+ ctx.effect(() => {
2509
+ const style = document.createElement('style')
2510
+ style.setAttribute('data-plugin', 'dsh-free-model')
2511
+ style.textContent = CSS
2512
+ document.head.appendChild(style)
2513
+ return () => style.remove()
2514
+ }, 'our-free-model: styles')
2515
+
2516
+ ctx.slots.inject('settings.section', () => ctx.slots.register({
2517
+ name: 'settings.section',
2518
+ id: 'our-free-model',
2519
+ order: 35,
2520
+ label: () => t('nav'),
2521
+ locale: NS,
2522
+ }, props => h(SettingsPage, { ...props, locale: localeTag(ctx), ctx })))
2523
+ }
2524
+ exports.apply = apply
2525
+ exports.inject = inject
2526
+ exports.name = 'our-free-model'
2527
+ // Headless test seams use the same stub React as scripts/client-lint.mjs.
2528
+ exports.__test = { parseSafeHtml, safeUrl, sanitizeStyle, htmlToDom, ChannelsPage }
2529
+ return module.exports
2530
+ },
2531
+ })