@refeain/dsh-xdpool 3.1.1 → 3.3.0

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.
Files changed (4) hide show
  1. package/lib/bin.js +48 -0
  2. package/lib/client.js +1106 -259
  3. package/lib/index.js +592 -76
  4. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -40,6 +40,7 @@ window.__ModuleLoader__.load({
40
40
  //#endregion
41
41
  //#region src/status-paths.ts
42
42
  const POOL_STATUS_PATH = "/plugins/dsh-xdpool/status";
43
+ const POOL_RESCAN_PATH = "/plugins/dsh-xdpool/accounts/rescan";
43
44
  const POOL_CATALOG_REFRESH_PATH = "/plugins/dsh-xdpool/models/refresh";
44
45
  const POOL_CHECKIN_PATH = "/plugins/dsh-xdpool/checkin";
45
46
  const POOL_ACCOUNT_IGNORE_PATH = "/plugins/dsh-xdpool/accounts/ignored";
@@ -116,136 +117,6 @@ window.__ModuleLoader__.load({
116
117
  //#endregion
117
118
  //#region src/client/avatar.ts
118
119
  const POOL_CARD_AVATAR = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAQDAwQDAwQEAwQFBAQFBgoHBgYGBg0JCggKDw0QEA8NDw4RExgUERIXEg4PFRwVFxkZGxsbEBQdHx0aHxgaGxr/2wBDAQQFBQYFBgwHBwwaEQ8RGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhr/wAARCACAAIADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxM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qNtrdHGT/A3I/Q4/CsrxXZ22r6dIssavHIuGUgEEGrP7QsTafpZ16Cf7KbTDTPzt2Z7+3+NcJ4e8Uvq9pCJI0y6gqwckEeopSfNFMuK5ZNHzp8avg3f+EJ5td0S3Nx4eugJHMS/8echHzKwHRCc4bpzg9OfFYWOGVVznv6V9j+PPj1o/h/T7zTNKlTVtXIaNoUGYkJBGGboR6gZ9K+Tl8mJSsmCzHLkDqa6qLk4+8ctVRUtCpbxNNOAAyqBhWHYVoLC8Y43/APAjmqht13s0B/dkdFPQ0ixsHwXlwfRjxXQYt6GrEVwMqRjrxUcsgKk9F7E1UCOBjzXx9eaJEDEb2J2njJ60EMrXV0BwB1rO6mprly0nzLtx0FQ0FpWCtDRtGudcvUtrNev33b7qD1NZ9ejfDDT/ADZJ5jJksdqpngf7R96Bnq/wu00+G0FpE7TW6yZLtwd5xu4HavpvwvrsjKkCMFOBjdXzr4VkNje/ZpkUsTu3lsd+v8q9i0d3jmiNvKuwkZye9Te4juPHUhm8J6mkoIk8gsDnOCvI/lVr4a+IFutLs5CeSgVhmom2anp8ltdsGSRChOR3H/1682+F+qPZ+dYSPh7eVosZ7q2D/KuOuup1UHuj2f4i6JF4o8N6jptygkhvLZ4WB9GUivzCude8R6cJ9Fn1i4S2sXe22RvjIVsY3DnHHrX6hx3w1CzaJpArMpUNnpnjNflXrdnPpWs6np96Ct1a3UsMobqGVyD/ACqcPrJplYh2s0VbgCQl4vvKMDHYjtShxOik8kiqkshjl3Rn7w5HaliuVACsu0e3Negcdkwkja2O+JsrViOdnjVgx3d+aaJVOMEGoARFJlHAB6igltFovLj79QF8ACRufU01rkYOOarFi3Uk0xctx0r72z6cCmUUUjQ//9k=";
119
- //#endregion
120
- //#region src/client/account-card.tsx
121
- const CREDITS = new Intl.NumberFormat();
122
- function formatExpiry(value) {
123
- if (value === void 0) return void 0;
124
- const at = Date.parse(value);
125
- if (!Number.isFinite(at)) return void 0;
126
- return new Intl.DateTimeFormat(void 0, {
127
- month: "2-digit",
128
- day: "2-digit",
129
- hour: "2-digit",
130
- minute: "2-digit",
131
- hour12: false
132
- }).format(new Date(at));
133
- }
134
- function AccountCard({ account, serving = false, busy = false, claiming = false, t, onClaim, onToggle, onPrefer, onIgnore }) {
135
- const total = account.credits?.total;
136
- const expiry = formatExpiry(account.expiresAt);
137
- const checkin = account.checkin;
138
- const claimed = checkin?.todayCheckedIn === true;
139
- return (0, react_jsx_runtime.jsxs)("article", {
140
- className: "xdp-acct",
141
- "data-serving": serving ? "true" : void 0,
142
- children: [
143
- (0, react_jsx_runtime.jsx)("header", {
144
- className: "xdp-acct-head",
145
- children: (0, react_jsx_runtime.jsx)("span", {
146
- className: "xdp-acct-name",
147
- title: account.nickname ?? account.label,
148
- children: account.nickname ?? account.label
149
- })
150
- }),
151
- !serving && !account.disabled && !account.cooling ? null : (0, react_jsx_runtime.jsxs)("div", {
152
- className: "xdp-acct-badges",
153
- children: [
154
- serving ? (0, react_jsx_runtime.jsx)("span", {
155
- className: "xdp-acct-badge",
156
- children: t?.("row.currentAccount") ?? "当前使用"
157
- }) : null,
158
- account.disabled ? (0, react_jsx_runtime.jsx)("span", {
159
- className: "xdp-acct-badge is-off",
160
- children: "已停用"
161
- }) : null,
162
- account.cooling ? (0, react_jsx_runtime.jsx)("span", {
163
- className: "xdp-acct-badge is-warn",
164
- children: "冷却中"
165
- }) : null
166
- ]
167
- }),
168
- (0, react_jsx_runtime.jsxs)("p", {
169
- className: "xdp-acct-meta",
170
- children: [expiry === void 0 ? "令牌有效期未知" : `令牌到期 ${expiry}`, account.lastUsedAt === void 0 ? "" : ` · 上次使用 ${formatExpiry(account.lastUsedAt) ?? ""}`]
171
- }),
172
- (0, react_jsx_runtime.jsxs)("div", {
173
- className: "xdp-acct-credits",
174
- children: [
175
- (0, react_jsx_runtime.jsx)("strong", { children: total === void 0 ? "—" : CREDITS.format(total) }),
176
- (0, react_jsx_runtime.jsx)("span", { children: t?.("row.creditsTotal") ?? "积分" }),
177
- checkinError(account)
178
- ]
179
- }),
180
- (0, react_jsx_runtime.jsxs)("footer", {
181
- className: "xdp-acct-actions",
182
- children: [
183
- (0, react_jsx_runtime.jsx)("button", {
184
- type: "button",
185
- className: account.preferred ? "tiny is-on" : "tiny",
186
- "aria-pressed": account.preferred,
187
- disabled: busy,
188
- title: account.preferred ? t?.("row.accountPreferClearHint") ?? "取消优先,交回按使用方式选号" : t?.("row.accountPreferHint") ?? "让它排在前面,仍然健康时才用",
189
- onClick: () => {
190
- onPrefer(account.preferred ? null : account.id);
191
- },
192
- children: account.preferred ? t?.("row.accountPreferOn") ?? "优先" : t?.("row.accountPrefer") ?? "优先"
193
- }),
194
- (0, react_jsx_runtime.jsx)("button", {
195
- type: "button",
196
- className: "tiny",
197
- disabled: busy,
198
- onClick: () => {
199
- onToggle(!account.disabled);
200
- },
201
- children: account.disabled ? "启用" : "停用"
202
- }),
203
- checkin === void 0 ? null : (0, react_jsx_runtime.jsx)("button", {
204
- type: "button",
205
- className: "tiny",
206
- disabled: claiming || claimed || checkin.active !== true,
207
- title: checkin.active === true ? void 0 : "这个账号当前没有签到活动",
208
- onClick: onClaim,
209
- children: claimed ? t?.("row.checkinClaimed") ?? "今日已签" : claiming ? t?.("row.checkinClaiming") ?? "签到中…" : t?.("row.checkinClaim") ?? "签到"
210
- }),
211
- (0, react_jsx_runtime.jsx)("button", {
212
- type: "button",
213
- className: "tiny",
214
- disabled: busy,
215
- title: "把这个账号从池子里永久移除(可在「已忽略」里恢复)",
216
- onClick: onIgnore,
217
- children: "移出池子"
218
- })
219
- ]
220
- })
221
- ]
222
- });
223
- }
224
- function checkinError(account) {
225
- if (account.checkinError === void 0) return null;
226
- return (0, react_jsx_runtime.jsx)("span", {
227
- className: "xdp-acct-warn",
228
- title: account.checkinError,
229
- children: "签到不可用"
230
- });
231
- }
232
- const ACCOUNT_CARD_CSS = `
233
- .xdp-accts{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:var(--s3)}
234
- .xdp-acct{display:flex;flex-direction:column;gap:var(--s2);min-width:0;padding:var(--s3);border:1px solid var(--line);border-radius:var(--r-lg);background:var(--surface)}
235
- .xdp-acct[data-serving="true"]{border-color:var(--accent-line)}
236
- .xdp-acct .xdp-acct-head{display:block;min-width:0}
237
- .xdp-acct .xdp-acct-name{display:block;max-width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--fs-sm);font-weight:600;color:var(--text)}
238
- .xdp-acct .xdp-acct-badges{display:flex;flex-wrap:wrap;gap:var(--s1)}
239
- .xdp-acct .xdp-acct-badge{flex:0 0 auto;padding:0 6px;border:1px solid var(--accent-line);border-radius:var(--r-pill);background:var(--accent-dim);color:var(--accent);font-size:var(--fs-xs);line-height:16px;white-space:nowrap}
240
- .xdp-acct-badge.is-off{border-color:var(--line-2);background:transparent;color:var(--faint)}
241
- .xdp-acct-badge.is-warn{border-color:color-mix(in oklch, var(--warn) 40%, transparent);background:color-mix(in oklch, var(--warn) 10%, transparent);color:var(--warn)}
242
- .xdp-acct-meta{margin:0;font-size:var(--fs-xs);line-height:1.5;color:var(--faint);font-variant-numeric:tabular-nums;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
243
- .xdp-acct-credits{display:flex;align-items:baseline;gap:var(--s2);min-width:0;flex-wrap:wrap}
244
- .xdp-acct-credits strong{font-size:var(--fs-lg);font-weight:600;color:var(--text);font-variant-numeric:tabular-nums}
245
- .xdp-acct-credits > span{font-size:var(--fs-xs);color:var(--faint)}
246
- .xdp-acct-warn{font-size:var(--fs-xs);color:var(--warn)}
247
- .xdp-acct-actions{display:flex;flex-wrap:wrap;gap:var(--s1);padding-top:2px}
248
- `;
249
120
  //#endregion
250
121
  //#region src/client/nav-icon.ts
251
122
  const POOL_NAV_ICON_PATHS = [{
@@ -269,7 +140,7 @@ window.__ModuleLoader__.load({
269
140
  const POOL_NAV_ICON_MASK_URL = `data:image/svg+xml;utf8,${encodeURIComponent(POOL_NAV_ICON_SVG)}`;
270
141
  //#endregion
271
142
  //#region src/version.ts
272
- const POOL_VERSION = "3.1.1";
143
+ const POOL_VERSION = "3.3.0";
273
144
  function compareVersions(left, right) {
274
145
  const parse = (value) => {
275
146
  const [core, ...rest] = value.trim().replace(/^v/u, "").split("-");
@@ -9545,6 +9416,30 @@ window.__ModuleLoader__.load({
9545
9416
  }
9546
9417
  return rows;
9547
9418
  }
9419
+ function creditStatusesFrom(envelope) {
9420
+ const value = envelope.value;
9421
+ if (value === null || typeof value !== "object") return [];
9422
+ const accounts = value.accounts;
9423
+ if (!Array.isArray(accounts)) return [];
9424
+ const rows = [];
9425
+ for (const entry of accounts) {
9426
+ if (entry === null || typeof entry !== "object") continue;
9427
+ const accountId = entry.accountId;
9428
+ if (typeof accountId !== "string" || accountId === "") continue;
9429
+ const nickname = entry.nickname;
9430
+ const status = entry.status;
9431
+ const statusRow = status !== null && typeof status === "object" ? status : void 0;
9432
+ const todayCredit = statusRow?.["todayCredit"];
9433
+ const checkedIn = statusRow?.["todayCheckedIn"];
9434
+ rows.push({
9435
+ accountId,
9436
+ ...typeof nickname === "string" && nickname !== "" ? { nickname } : {},
9437
+ ...typeof checkedIn === "boolean" ? { todayCheckedIn: checkedIn } : {},
9438
+ ...typeof todayCredit === "number" && Number.isFinite(todayCredit) ? { todayCredit } : {}
9439
+ });
9440
+ }
9441
+ return rows;
9442
+ }
9548
9443
  async function fetchChannels() {
9549
9444
  const response = await fetch(POOL_CHANNELS_PATH, {
9550
9445
  headers: { accept: "application/json" },
@@ -9764,6 +9659,402 @@ window.__ModuleLoader__.load({
9764
9659
  });
9765
9660
  }
9766
9661
  //#endregion
9662
+ //#region src/client/account-view.ts
9663
+ const REGION_OF_CHANNEL = Object.freeze({
9664
+ buddy: "cn",
9665
+ workbuddy: "global"
9666
+ });
9667
+ function poolRegionOf(channelId) {
9668
+ return REGION_OF_CHANNEL[channelId];
9669
+ }
9670
+ function resolveAccountSource(channel) {
9671
+ const owned = channel.ownedByPool === true;
9672
+ const region = poolRegionOf(channel.id);
9673
+ if (!owned && region === void 0) return {
9674
+ ok: true,
9675
+ source: {
9676
+ kind: "channel",
9677
+ channelId: channel.id
9678
+ }
9679
+ };
9680
+ if (region === void 0) return {
9681
+ ok: false,
9682
+ problem: `渠道 ${channel.id} 归账号池管,但界面不认识它的区域,账号统计已停用`
9683
+ };
9684
+ return {
9685
+ ok: true,
9686
+ source: {
9687
+ kind: "pool",
9688
+ region,
9689
+ channelId: channel.id
9690
+ }
9691
+ };
9692
+ }
9693
+ function usableAmount(value) {
9694
+ return value !== void 0 && Number.isFinite(value) ? value : void 0;
9695
+ }
9696
+ function rowsFromPool(accounts) {
9697
+ return accounts.map((account) => {
9698
+ const total = usableAmount(account.credits?.total);
9699
+ const packages = account.credits?.packages ?? [];
9700
+ let fromPackages;
9701
+ for (const entry of packages) {
9702
+ const remain = usableAmount(entry.remain);
9703
+ if (remain === void 0) continue;
9704
+ fromPackages = (fromPackages ?? 0) + remain;
9705
+ }
9706
+ const balance = account.creditsError !== void 0 ? void 0 : total ?? fromPackages;
9707
+ const checkinError = account.checkinError;
9708
+ const checkin = checkinError !== void 0 || account.checkin === void 0 ? "unknown" : account.checkin.todayCheckedIn ? "checked" : "unchecked";
9709
+ const todayCredit = checkin === "checked" ? usableAmount(account.checkin?.todayCredit) : void 0;
9710
+ return {
9711
+ id: account.id,
9712
+ label: account.label,
9713
+ enabled: account.disabled !== true,
9714
+ balance,
9715
+ checkin,
9716
+ todayCredit,
9717
+ balanceError: account.creditsError,
9718
+ checkinError,
9719
+ activityActive: account.checkin === void 0 ? void 0 : account.checkin.active
9720
+ };
9721
+ });
9722
+ }
9723
+ function rowsFromChannel(snapshot) {
9724
+ const balanceOf = new Map();
9725
+ for (const row of snapshot.balances) balanceOf.set(row.accountId, row);
9726
+ const statusOf = new Map();
9727
+ for (const row of snapshot.statuses) statusOf.set(row.accountId, row);
9728
+ return snapshot.accounts.map((account) => {
9729
+ const balanceRow = balanceOf.get(account.id);
9730
+ const statusRow = statusOf.get(account.id);
9731
+ const balance = balanceRow?.error === void 0 ? usableAmount(balanceRow?.balance) : void 0;
9732
+ const checkin = statusRow?.todayCheckedIn === true ? "checked" : statusRow?.todayCheckedIn === false ? "unchecked" : "unknown";
9733
+ const todayCredit = checkin === "checked" ? usableAmount(statusRow?.todayCredit) : void 0;
9734
+ const enabled = account.disabled === true ? false : account.enabled !== false;
9735
+ const checkinError = snapshot.statusError;
9736
+ return {
9737
+ id: account.id,
9738
+ label: account.nickname ?? account.name ?? account.id,
9739
+ enabled,
9740
+ balance,
9741
+ checkin: checkinError === void 0 ? checkin : "unknown",
9742
+ todayCredit: checkinError === void 0 ? todayCredit : void 0,
9743
+ balanceError: balanceRow?.error,
9744
+ checkinError,
9745
+ activityActive: void 0
9746
+ };
9747
+ });
9748
+ }
9749
+ function buildAccountView(input) {
9750
+ const { rows } = input;
9751
+ let known = 0;
9752
+ let measured = 0;
9753
+ let enabled = 0;
9754
+ let checked = 0;
9755
+ let unchecked = 0;
9756
+ let unknown = 0;
9757
+ let todayCredit = 0;
9758
+ for (const row of rows) {
9759
+ if (row.balance !== void 0) {
9760
+ known += row.balance;
9761
+ measured += 1;
9762
+ }
9763
+ if (!row.enabled) continue;
9764
+ enabled += 1;
9765
+ if (row.checkin === "checked") {
9766
+ checked += 1;
9767
+ todayCredit += row.todayCredit ?? 0;
9768
+ } else if (row.checkin === "unchecked") unchecked += 1;
9769
+ else unknown += 1;
9770
+ }
9771
+ return {
9772
+ source: input.source,
9773
+ state: input.state,
9774
+ stale: input.stale === true,
9775
+ error: input.error,
9776
+ rows,
9777
+ total: rows.length,
9778
+ enabled,
9779
+ balance: {
9780
+ known,
9781
+ measured,
9782
+ total: rows.length,
9783
+ complete: rows.length > 0 && measured === rows.length
9784
+ },
9785
+ checkin: {
9786
+ checked,
9787
+ unchecked,
9788
+ unknown,
9789
+ denominator: enabled,
9790
+ todayCredit,
9791
+ allDone: enabled > 0 && checked === enabled
9792
+ }
9793
+ };
9794
+ }
9795
+ function buildPoolView(input) {
9796
+ const rows = input.status === void 0 ? [] : rowsFromPool(input.status.accounts);
9797
+ return buildAccountView({
9798
+ source: {
9799
+ kind: "pool",
9800
+ region: input.region,
9801
+ channelId: input.channelId
9802
+ },
9803
+ state: input.state,
9804
+ stale: input.stale,
9805
+ error: input.error,
9806
+ rows
9807
+ });
9808
+ }
9809
+ function buildChannelView(input) {
9810
+ const rows = input.snapshot === void 0 ? [] : rowsFromChannel(input.snapshot);
9811
+ return buildAccountView({
9812
+ source: {
9813
+ kind: "channel",
9814
+ channelId: input.channelId
9815
+ },
9816
+ state: input.state,
9817
+ stale: input.stale,
9818
+ error: input.error,
9819
+ rows
9820
+ });
9821
+ }
9822
+ function buildPageView(inputs) {
9823
+ const resolved = resolveAccountSource(inputs.channel);
9824
+ if (!resolved.ok) return buildAccountView({
9825
+ source: {
9826
+ kind: "channel",
9827
+ channelId: inputs.channel.id
9828
+ },
9829
+ state: "error",
9830
+ error: resolved.problem,
9831
+ rows: []
9832
+ });
9833
+ if (resolved.source.kind === "pool") return buildPoolView({
9834
+ channelId: inputs.channel.id,
9835
+ region: resolved.source.region,
9836
+ status: inputs.laneAccounts === void 0 ? void 0 : { accounts: inputs.laneAccounts },
9837
+ state: inputs.laneAccounts === void 0 ? "loading" : inputs.state,
9838
+ error: inputs.error
9839
+ });
9840
+ return buildChannelView({
9841
+ channelId: inputs.channel.id,
9842
+ snapshot: inputs.pack,
9843
+ state: inputs.state,
9844
+ error: inputs.error ?? inputs.packError
9845
+ });
9846
+ }
9847
+ function balanceDisplay(summary) {
9848
+ if (summary.total === 0 || summary.measured === 0) return { kind: "unknown" };
9849
+ if (summary.complete) return {
9850
+ kind: "complete",
9851
+ known: summary.known
9852
+ };
9853
+ return {
9854
+ kind: "partial",
9855
+ known: summary.known,
9856
+ measured: summary.measured,
9857
+ total: summary.total
9858
+ };
9859
+ }
9860
+ function createRegionGate() {
9861
+ const latest = new Map();
9862
+ let counter = 0;
9863
+ return {
9864
+ issue(region) {
9865
+ counter += 1;
9866
+ return counter;
9867
+ },
9868
+ accept(region, ticket) {
9869
+ const current = latest.get(region);
9870
+ if (current !== void 0 && ticket < current) return false;
9871
+ latest.set(region, ticket);
9872
+ return true;
9873
+ }
9874
+ };
9875
+ }
9876
+ //#endregion
9877
+ //#region src/client/pool-actions.ts
9878
+ const SKIP_REASON_TEXT = Object.freeze({
9879
+ disabled: "账号已停用",
9880
+ activityClosed: "签到活动未开启",
9881
+ unknownStatus: "签到状态未知,跳过(可先「重新检测」再试)",
9882
+ alreadyChecked: "今天已经签到"
9883
+ });
9884
+ function batchEligibility(row) {
9885
+ if (!row.enabled) return {
9886
+ ok: false,
9887
+ reason: "disabled"
9888
+ };
9889
+ if (row.activityActive === false) return {
9890
+ ok: false,
9891
+ reason: "activityClosed"
9892
+ };
9893
+ if (row.checkin === "unknown") return {
9894
+ ok: false,
9895
+ reason: "unknownStatus"
9896
+ };
9897
+ if (row.checkin === "checked") return {
9898
+ ok: false,
9899
+ reason: "alreadyChecked"
9900
+ };
9901
+ return { ok: true };
9902
+ }
9903
+ function planBatch(rows) {
9904
+ const ready = [];
9905
+ const recheck = [];
9906
+ const skipped = [];
9907
+ for (const row of rows) {
9908
+ const verdict = batchEligibility(row);
9909
+ if (verdict.ok) {
9910
+ ready.push(row);
9911
+ continue;
9912
+ }
9913
+ if (verdict.reason === "unknownStatus") {
9914
+ recheck.push(row);
9915
+ continue;
9916
+ }
9917
+ skipped.push({
9918
+ row,
9919
+ reason: verdict.reason
9920
+ });
9921
+ }
9922
+ return {
9923
+ ready,
9924
+ recheck,
9925
+ skipped
9926
+ };
9927
+ }
9928
+ async function runBatch(targets, options) {
9929
+ const results = [];
9930
+ for (const row of targets) {
9931
+ if (options.signal?.aborted === true) break;
9932
+ let result;
9933
+ try {
9934
+ const said = await options.run(row.id);
9935
+ result = {
9936
+ accountId: row.id,
9937
+ label: row.label,
9938
+ ...said
9939
+ };
9940
+ } catch (cause) {
9941
+ result = {
9942
+ accountId: row.id,
9943
+ label: row.label,
9944
+ outcome: "failed",
9945
+ error: cause instanceof Error ? cause.message : String(cause)
9946
+ };
9947
+ }
9948
+ results.push(result);
9949
+ options.onResult?.(result);
9950
+ }
9951
+ return results;
9952
+ }
9953
+ function claimedCount(results) {
9954
+ return results.filter((result) => result.outcome === "claimed" || result.outcome === "alreadyClaimed").length;
9955
+ }
9956
+ function failedCount(results) {
9957
+ return results.filter((result) => result.outcome === "failed").length;
9958
+ }
9959
+ async function claimAll(options) {
9960
+ const skip = options.skipIds;
9961
+ const plan = planBatch(skip === void 0 || skip.size === 0 ? options.rows : options.rows.filter((row) => !skip.has(row.id)));
9962
+ const skipped = plan.skipped.map(({ row, reason }) => ({
9963
+ accountId: row.id,
9964
+ label: row.label,
9965
+ outcome: "skipped",
9966
+ error: SKIP_REASON_TEXT[reason]
9967
+ }));
9968
+ const recovered = [];
9969
+ for (const row of plan.recheck) try {
9970
+ const fresh = await options.recheck(row.id);
9971
+ const verdict = fresh === void 0 ? void 0 : batchEligibility(fresh);
9972
+ if (fresh !== void 0 && verdict?.ok === true) recovered.push(fresh);
9973
+ else skipped.push({
9974
+ accountId: row.id,
9975
+ label: row.label,
9976
+ outcome: "skipped",
9977
+ error: fresh === void 0 ? "签到状态复查失败,跳过(可稍后重试)" : SKIP_REASON_TEXT[verdict !== void 0 && !verdict.ok ? verdict.reason : "unknownStatus"]
9978
+ });
9979
+ } catch (cause) {
9980
+ skipped.push({
9981
+ accountId: row.id,
9982
+ label: row.label,
9983
+ outcome: "skipped",
9984
+ error: `签到状态复查失败(${cause instanceof Error ? cause.message : String(cause)}),跳过`
9985
+ });
9986
+ }
9987
+ const results = await runBatch([...plan.ready, ...recovered], {
9988
+ run: options.claim,
9989
+ signal: options.signal,
9990
+ ...options.onResult === void 0 ? {} : { onResult: options.onResult }
9991
+ });
9992
+ let refresh;
9993
+ try {
9994
+ refresh = await options.refresh();
9995
+ } catch (cause) {
9996
+ refresh = {
9997
+ ok: false,
9998
+ error: cause instanceof Error ? cause.message : String(cause)
9999
+ };
10000
+ }
10001
+ return {
10002
+ results,
10003
+ skipped,
10004
+ refresh
10005
+ };
10006
+ }
10007
+ function summarizeBatch(report, labels) {
10008
+ const claimed = claimedCount(report.results);
10009
+ const failed = failedCount(report.results);
10010
+ const parts = [];
10011
+ if (claimed > 0) parts.push(labels.claimed(claimed));
10012
+ if (failed > 0) parts.push(labels.failed(failed));
10013
+ if (report.skipped.length > 0) parts.push(`跳过 ${String(report.skipped.length)} 个`);
10014
+ if (!report.refresh.ok) parts.push(`状态待刷新(${report.refresh.error ?? "回读失败"})`);
10015
+ return {
10016
+ text: parts.length === 0 ? "没有可领取的账号" : parts.join(","),
10017
+ tone: report.results.length === 0 ? "warn" : failed > 0 || !report.refresh.ok ? "warn" : "ok"
10018
+ };
10019
+ }
10020
+ function outcomeFromClaim(body, ok) {
10021
+ if (!ok) {
10022
+ const message = body?.error;
10023
+ return {
10024
+ outcome: "failed",
10025
+ error: typeof message === "string" ? message : "签到请求被拒绝"
10026
+ };
10027
+ }
10028
+ const typed = body;
10029
+ if (typed?.alreadyCheckedIn === true) return {
10030
+ outcome: "alreadyClaimed",
10031
+ credit: 0
10032
+ };
10033
+ const credit = typed?.claim?.credit;
10034
+ return {
10035
+ outcome: "claimed",
10036
+ ...typeof credit === "number" && Number.isFinite(credit) ? { credit } : {}
10037
+ };
10038
+ }
10039
+ async function rescanRegions(options) {
10040
+ const total = await options.rescan();
10041
+ const settled = await Promise.allSettled(options.regions.map((region) => options.refresh(region)));
10042
+ const byRegion = {};
10043
+ options.regions.forEach((region, index) => {
10044
+ const outcome = settled[index];
10045
+ byRegion[region] = outcome?.status === "fulfilled" ? outcome.value : void 0;
10046
+ });
10047
+ return {
10048
+ total,
10049
+ byRegion
10050
+ };
10051
+ }
10052
+ function claimRouteFor(input) {
10053
+ if (input.hasPoolLane) return "pool";
10054
+ if (input.hasOwnCheckinRoute) return "own";
10055
+ return "pack";
10056
+ }
10057
+ //#endregion
9767
10058
  //#region src/client/ChannelPoolSection.tsx
9768
10059
  let poolSnapshot;
9769
10060
  const COUNTS_STORE_KEY = "dsh-xdpool.channel-counts.v1";
@@ -10314,7 +10605,7 @@ window.__ModuleLoader__.load({
10314
10605
  return "签到失败";
10315
10606
  }
10316
10607
  }
10317
- function ChannelPoolSection({ t, active, onAddAccount, autoClaim, autoClaimBusy, onAutoClaim, autoClaimRunning, onAutoClaimRun, autoClaimReport, autoClaimFailing, autoClaimEarned, banner, regionCards }) {
10608
+ function ChannelPoolSection({ t, active, onAddAccount, autoClaim, autoClaimBusy, onAutoClaim, autoClaimRunning, onAutoClaimRun, autoClaimReport, autoClaimFailing, autoClaimEarned, banner, poolLanes }) {
10318
10609
  const [ownActive, setOwnActive] = (0, react.useState)("");
10319
10610
  const [loginState, setLoginState] = (0, react.useState)(void 0);
10320
10611
  const loginAbort = (0, react.useRef)(void 0);
@@ -10459,6 +10750,7 @@ window.__ModuleLoader__.load({
10459
10750
  facts: new Map(),
10460
10751
  balances: [],
10461
10752
  statuses: [],
10753
+ statusError: void 0,
10462
10754
  balancePending: wantBalances,
10463
10755
  balanceError: void 0,
10464
10756
  modelError: modelEmptyBecauseRefused ? models.error?.message ?? "model.list refused" : void 0
@@ -10471,6 +10763,7 @@ window.__ModuleLoader__.load({
10471
10763
  facts: new Map(),
10472
10764
  balances: [],
10473
10765
  statuses: [],
10766
+ statusError: void 0,
10474
10767
  balancePending: false,
10475
10768
  balanceError: void 0,
10476
10769
  modelError: void 0
@@ -10548,6 +10841,7 @@ window.__ModuleLoader__.load({
10548
10841
  for (const entry of next) {
10549
10842
  if (entry.channel.credits === void 0) continue;
10550
10843
  refreshBalances(entry.channel.id, false, true, seq);
10844
+ refreshStatuses(entry.channel.id, true);
10551
10845
  }
10552
10846
  const idsByProvider = {};
10553
10847
  for (const [provider, entry] of perProvider) if (entry.models.length > 0) idsByProvider[provider] = entry.models.map((model) => model.id);
@@ -10712,6 +11006,30 @@ window.__ModuleLoader__.load({
10712
11006
  await load();
10713
11007
  }
10714
11008
  };
11009
+ const refreshStatuses = async (provider, quiet = false) => {
11010
+ if ((entriesRef.current.find((entry) => entry.channel.id === provider)?.channel.credits)?.status !== true) return;
11011
+ if (!quiet) markBusy(provider, true);
11012
+ try {
11013
+ const envelope = await callPack("credits.status", { provider });
11014
+ if (!mountedRef.current) return;
11015
+ if (!envelope.ok) {
11016
+ const message = envelope.error?.message ?? "credits.status refused";
11017
+ setEntries((previous) => previous.map((entry) => entry.channel.id === provider ? {
11018
+ ...entry,
11019
+ statusError: message
11020
+ } : entry));
11021
+ return;
11022
+ }
11023
+ const rows = creditStatusesFrom(envelope);
11024
+ setEntries((previous) => previous.map((entry) => entry.channel.id === provider ? {
11025
+ ...entry,
11026
+ statuses: rows,
11027
+ statusError: void 0
11028
+ } : entry));
11029
+ } finally {
11030
+ if (mountedRef.current && !quiet) markBusy(provider, false);
11031
+ }
11032
+ };
10715
11033
  const refreshBalances = async (provider, force, quiet = false, seq) => {
10716
11034
  if (!quiet) markBusy(provider, true);
10717
11035
  setEntries((previous) => previous.map((entry) => entry.channel.id === provider ? {
@@ -10815,6 +11133,7 @@ window.__ModuleLoader__.load({
10815
11133
  }) ?? "Nothing to claim today.");
10816
11134
  if (result?.failed !== void 0 && result.failed > 0) setNotice(t?.("channelpool.claimFailed", { failed: result.failed }) ?? `${result.failed} failed.`);
10817
11135
  await refreshBalances(provider, true);
11136
+ await refreshStatuses(provider);
10818
11137
  } finally {
10819
11138
  if (mountedRef.current) markBusy(provider, false);
10820
11139
  }
@@ -11083,31 +11402,53 @@ window.__ModuleLoader__.load({
11083
11402
  }
11084
11403
  };
11085
11404
  if (entries.length === 0 && error === void 0) {
11086
- if (!(regionCards !== void 0 && !loading)) {
11087
- if (!loading) return (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
11088
- return (0, react_jsx_runtime.jsx)("section", {
11089
- className: "dsm-xdpool-cpool",
11090
- "aria-label": t?.("channelpool.title") ?? "Channels",
11091
- children: (0, react_jsx_runtime.jsx)("p", {
11092
- className: "note",
11093
- role: "status",
11094
- children: t?.("channelpool.loading") ?? "Reading scan channels…"
11095
- })
11096
- });
11097
- }
11405
+ if (!loading) return (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
11406
+ return (0, react_jsx_runtime.jsx)("section", {
11407
+ className: "dsm-xdpool-cpool",
11408
+ "aria-label": t?.("channelpool.title") ?? "Channels",
11409
+ children: (0, react_jsx_runtime.jsx)("p", {
11410
+ className: "note",
11411
+ role: "status",
11412
+ children: t?.("channelpool.loading") ?? "Reading scan channels…"
11413
+ })
11414
+ });
11098
11415
  }
11099
11416
  const chosenEntry = entries.find((entry) => entry.channel.id === chosen) ?? entries[0];
11100
- const totalAccounts = entries.reduce((sum, entry) => sum + entry.accounts.length, 0);
11101
- const liveAccounts = entries.reduce((sum, entry) => sum + entry.accounts.filter((account) => account.enabled !== false).length, 0);
11102
- const totalCredits = entries.reduce((sum, entry) => {
11417
+ const laneOf = (channelId) => poolLanes?.[channelId];
11418
+ const rowView = (entry) => buildPageView({
11419
+ channel: entry.channel,
11420
+ laneAccounts: laneOf(entry.channel.id)?.accounts,
11421
+ pack: {
11422
+ accounts: entry.accounts,
11423
+ balances: entry.balances.map((row) => ({
11424
+ accountId: row.accountId,
11425
+ balance: balanceAmount(row.balance),
11426
+ error: row.error
11427
+ })),
11428
+ statuses: entry.statuses,
11429
+ statusError: entry.statusError
11430
+ },
11431
+ state: "ready"
11432
+ });
11433
+ const rowAccountCount = (entry) => rowView(entry).total;
11434
+ const rowEnabledCount = (entry) => rowView(entry).enabled;
11435
+ const totalAccounts = entries.reduce((sum, entry) => sum + rowAccountCount(entry), 0);
11436
+ const liveAccounts = entries.reduce((sum, entry) => sum + rowEnabledCount(entry), 0);
11437
+ const creditTotalOf = (entry) => {
11103
11438
  const credits = entry.channel.credits;
11104
- if (credits === void 0 || credits.unit !== void 0 || credits.quota === true) return sum;
11105
- const value = balancesTotal(entry.balances);
11439
+ if (credits !== void 0 && (credits.unit !== void 0 || credits.quota === true)) return void 0;
11440
+ const view = rowView(entry);
11441
+ if (view.source.kind === "pool") return view.balance.measured === 0 ? void 0 : view.balance.known;
11442
+ if (credits === void 0) return void 0;
11443
+ return balancesTotal(entry.balances);
11444
+ };
11445
+ const totalCredits = entries.reduce((sum, entry) => {
11446
+ const value = creditTotalOf(entry);
11106
11447
  return value === void 0 ? sum : sum + value;
11107
11448
  }, 0);
11108
- const anyCredits = entries.some((entry) => entry.channel.credits !== void 0 && entry.channel.credits.unit === void 0 && entry.channel.credits.quota !== true && balancesTotal(entry.balances) !== void 0);
11109
- const bound = entries.filter((entry) => entry.accounts.length > 0);
11110
- const unbound = entries.filter((entry) => entry.accounts.length === 0);
11449
+ const anyCredits = entries.some((entry) => creditTotalOf(entry) !== void 0);
11450
+ const bound = entries.filter((entry) => rowAccountCount(entry) > 0);
11451
+ const unbound = entries.filter((entry) => rowAccountCount(entry) === 0);
11111
11452
  const channelRow = (entry, isBound) => {
11112
11453
  const icon = channelIcon(entry.channel.id);
11113
11454
  const isOn = chosenEntry !== void 0 && entry.channel.id === chosenEntry.channel.id;
@@ -11139,7 +11480,7 @@ window.__ModuleLoader__.load({
11139
11480
  }),
11140
11481
  isBound ? (0, react_jsx_runtime.jsx)("span", {
11141
11482
  className: "ch-n num",
11142
- children: String(entry.accounts.length)
11483
+ children: String(rowAccountCount(entry))
11143
11484
  }) : null
11144
11485
  ]
11145
11486
  }, entry.channel.id);
@@ -11226,42 +11567,70 @@ window.__ModuleLoader__.load({
11226
11567
  children: (0, react_jsx_runtime.jsxs)("div", {
11227
11568
  className: "mbody",
11228
11569
  style: { paddingTop: "var(--s5)" },
11229
- children: [
11230
- banner,
11231
- regionCards,
11232
- error === void 0 ? null : (0, react_jsx_runtime.jsxs)("p", {
11233
- className: "hint",
11234
- children: [t?.("channelpool.loadError", { message: error }) ?? `Could not load channels: ${error}`, (0, react_jsx_runtime.jsx)("button", {
11235
- type: "button",
11236
- className: "tiny",
11237
- style: { marginLeft: "auto" },
11238
- onClick: () => {
11239
- setEnabled(new Map());
11240
- load();
11241
- },
11242
- children: t?.("channelpool.retry") ?? "重试"
11243
- })]
11244
- })
11245
- ]
11570
+ children: [banner, error === void 0 ? null : (0, react_jsx_runtime.jsxs)("p", {
11571
+ className: "hint",
11572
+ children: [t?.("channelpool.loadError", { message: error }) ?? `Could not load channels: ${error}`, (0, react_jsx_runtime.jsx)("button", {
11573
+ type: "button",
11574
+ className: "tiny",
11575
+ style: { marginLeft: "auto" },
11576
+ onClick: () => {
11577
+ setEnabled(new Map());
11578
+ load();
11579
+ },
11580
+ children: t?.("channelpool.retry") ?? "重试"
11581
+ })]
11582
+ })]
11246
11583
  })
11247
11584
  })] });
11248
11585
  const { channel, accounts, models, facts, balances, statuses, status } = chosenEntry;
11249
11586
  const enabledIds = enabledFor(channel.id, models);
11250
- const isBusy = busy.has(channel.id);
11587
+ const isBusy = busy.has(channel.id) || laneOf(channel.id)?.batchBusy === true;
11251
11588
  const unit = creditUnitLabel(channel, t);
11252
- const chosenBalanceTotal = channel.credits === void 0 ? void 0 : balancesTotal(balances);
11253
- const chosenCredit = chosenEntry.balancePending && chosenBalanceTotal === void 0 ? t?.("channelpool.balanceLoading") ?? "…" : chosenBalanceTotal === void 0 ? "—" : amount(chosenBalanceTotal);
11254
11589
  const modelsEnabled = models.filter((model) => enabledIds.has(model.id)).length;
11255
11590
  const statusOf = (accountId) => statuses.find((row) => row.accountId === accountId);
11256
11591
  const balanceOf = (accountId) => balances.find((row) => row.accountId === accountId);
11257
11592
  const enabledAccounts = accounts.filter((account) => account.enabled !== false);
11258
- const allClaimedToday = enabledAccounts.length > 0 && enabledAccounts.every((account) => statusOf(account.id)?.todayCheckedIn === true);
11259
- const claimedToday = enabledAccounts.filter((account) => statusOf(account.id)?.todayCheckedIn === true).length;
11593
+ const lane = laneOf(channel.id);
11594
+ const view = buildPageView({
11595
+ channel,
11596
+ laneAccounts: lane?.accounts,
11597
+ pack: {
11598
+ accounts,
11599
+ balances: balances.map((row) => ({
11600
+ accountId: row.accountId,
11601
+ balance: balanceAmount(row.balance),
11602
+ error: row.error
11603
+ })),
11604
+ statuses,
11605
+ statusError: chosenEntry.statusError
11606
+ },
11607
+ packError: chosenEntry.balanceError,
11608
+ state: "ready"
11609
+ });
11610
+ const poolExpiry = (iso) => {
11611
+ if (iso === void 0) return void 0;
11612
+ const at = Date.parse(iso);
11613
+ return Number.isFinite(at) ? expiryText(at, t) : void 0;
11614
+ };
11615
+ lane === void 0 || lane.accounts.filter((account) => account.disabled !== true);
11616
+ const shownAccounts = view.total;
11617
+ const shownEnabled = view.enabled;
11618
+ const showCredit = channel.credits === void 0 ? view.source.kind === "pool" && view.balance.measured > 0 : true;
11619
+ const balanceLabel = (() => {
11620
+ const shown = balanceDisplay(view.balance);
11621
+ if (shown.kind === "unknown") return view.state === "loading" ? t?.("channelpool.balanceLoading") ?? "…" : "—";
11622
+ if (shown.kind === "complete") return amount(shown.known);
11623
+ return amount(shown.known);
11624
+ })();
11625
+ const balanceCoverage = view.balance.complete || view.balance.measured === 0 ? void 0 : `${String(view.balance.measured)}/${String(view.balance.total)}`;
11626
+ const checkedInToday = view.checkin.checked;
11627
+ const allClaimedToday = view.checkin.allDone;
11628
+ const claimedToday = checkedInToday;
11260
11629
  const canClaim = channel.credits?.claim === true || OWN_CHECKIN_CHANNELS[channel.id] !== void 0;
11261
11630
  const query = queryFor(channel.id);
11262
11631
  const visibleModels = modelsMatching(chosenEntry, query);
11263
11632
  const mode = modeOf(channel.id);
11264
- const showAutomation = canClaim && onAutoClaim !== void 0;
11633
+ const showAutomation = channel.ownedByPool === true && poolRegionOf(channel.id) === "cn" && onAutoClaim !== void 0;
11265
11634
  const isMarvis = channel.id === "marvis";
11266
11635
  const quotaOf = (accountId) => marvisQuotas?.find((row) => row.openid === accountId);
11267
11636
  const marvisRows = accounts.map((account) => quotaOf(account.id)).filter((row) => row !== void 0 && row.error === void 0);
@@ -11284,21 +11653,60 @@ window.__ModuleLoader__.load({
11284
11653
  }
11285
11654
  };
11286
11655
  const claimAllFor = async (provider) => {
11287
- if (OWN_CHECKIN_CHANNELS[provider] === void 0) {
11288
- await claim(provider);
11289
- return;
11290
- }
11656
+ const lane = laneOf(provider);
11657
+ const route = claimRouteFor({
11658
+ hasPoolLane: lane?.actions !== void 0,
11659
+ hasOwnCheckinRoute: OWN_CHECKIN_CHANNELS[provider] !== void 0
11660
+ });
11661
+ if (route === "pool" && lane?.actions !== void 0) {
11662
+ markBusy(provider, true);
11663
+ try {
11664
+ const report = await lane.actions.claimAll();
11665
+ if (!mountedRef.current) return;
11666
+ const summary = summarizeBatch(report, {
11667
+ claimed: (n) => `已领取 ${String(n)} 个账号`,
11668
+ failed: (n) => `${String(n)} 个失败`
11669
+ });
11670
+ const detail = [...report.results.filter((row) => row.outcome === "failed"), ...report.skipped].map((row) => `${row.label}:${row.error ?? "失败"}`).join(";");
11671
+ setNotice(detail === "" ? summary.text : `${summary.text}(${detail})`);
11672
+ await refreshBalances(provider, true);
11673
+ } finally {
11674
+ if (mountedRef.current) markBusy(provider, false);
11675
+ }
11676
+ return;
11677
+ }
11678
+ if (route === "pack") {
11679
+ await claim(provider);
11680
+ return;
11681
+ }
11291
11682
  markBusy(provider, true);
11292
11683
  try {
11293
11684
  const said = await ownCheckin(provider);
11294
11685
  if (!mountedRef.current) return;
11295
11686
  if (said !== void 0) setNotice(said);
11296
11687
  await refreshBalances(provider, true);
11688
+ await refreshStatuses(provider);
11297
11689
  } finally {
11298
11690
  if (mountedRef.current) markBusy(provider, false);
11299
11691
  }
11300
11692
  };
11301
11693
  const recheck = async (provider) => {
11694
+ const lane = laneOf(provider);
11695
+ if (lane?.actions !== void 0) {
11696
+ markBusy(provider, true);
11697
+ try {
11698
+ const outcome = await lane.actions.rescan();
11699
+ const region = poolRegionOf(channel.id);
11700
+ const here = region === void 0 ? void 0 : outcome.byRegion[region];
11701
+ if (mountedRef.current) setNotice(here === void 0 ? `已重新检测,全池 ${String(outcome.total)} 个账号(本区数量待刷新)` : `已重新检测,本区 ${String(here)} 个账号(全池 ${String(outcome.total)} 个)`);
11702
+ await refreshBalances(provider, true);
11703
+ } catch (cause) {
11704
+ if (mountedRef.current) setNotice(`重新检测失败:${cause instanceof Error ? cause.message : String(cause)}`);
11705
+ } finally {
11706
+ if (mountedRef.current) markBusy(provider, false);
11707
+ }
11708
+ return;
11709
+ }
11302
11710
  invalidatePoolSnapshot();
11303
11711
  setEnabled(new Map());
11304
11712
  await load();
@@ -11320,7 +11728,7 @@ window.__ModuleLoader__.load({
11320
11728
  className: "mhead-org",
11321
11729
  children: channel.domain === void 0 || channel.domain === "" ? channel.org : `${channel.org} · ${channel.domain}`
11322
11730
  }),
11323
- accounts.length > 0 ? (0, react_jsx_runtime.jsx)("span", {
11731
+ shownAccounts > 0 ? (0, react_jsx_runtime.jsx)("span", {
11324
11732
  className: "pill",
11325
11733
  "data-tone": "ok",
11326
11734
  children: t?.("channelpool.stateReady") ?? "已连接"
@@ -11349,7 +11757,6 @@ window.__ModuleLoader__.load({
11349
11757
  className: "mbody",
11350
11758
  children: [
11351
11759
  banner,
11352
- regionCards,
11353
11760
  loginState !== void 0 && loginState.channelId === channel.id && (loginState.phase === "paste" ? (0, react_jsx_runtime.jsxs)("div", {
11354
11761
  className: "banner",
11355
11762
  children: [
@@ -11537,17 +11944,24 @@ window.__ModuleLoader__.load({
11537
11944
  ]
11538
11945
  }) : (0, react_jsx_runtime.jsxs)("div", {
11539
11946
  className: "kpis",
11540
- style: { gridTemplateColumns: `repeat(${channel.credits === void 0 ? "2" : "3"},minmax(0,1fr))` },
11947
+ style: { gridTemplateColumns: `repeat(${showCredit ? "3" : "2"},minmax(0,1fr))` },
11541
11948
  children: [
11542
11949
  (0, react_jsx_runtime.jsxs)("div", {
11543
11950
  className: "kpi",
11544
- children: [(0, react_jsx_runtime.jsx)("span", {
11545
- className: "kpi-k",
11546
- children: t?.("channelpool.statAccounts") ?? "账号"
11547
- }), (0, react_jsx_runtime.jsx)("span", {
11548
- className: "kpi-v num",
11549
- children: String(enabledAccounts.length)
11550
- })]
11951
+ children: [
11952
+ (0, react_jsx_runtime.jsx)("span", {
11953
+ className: "kpi-k",
11954
+ children: t?.("channelpool.statAccounts") ?? "账号"
11955
+ }),
11956
+ (0, react_jsx_runtime.jsx)("span", {
11957
+ className: "kpi-v num",
11958
+ children: String(shownAccounts)
11959
+ }),
11960
+ shownAccounts === shownEnabled ? null : (0, react_jsx_runtime.jsx)("span", {
11961
+ className: "kpi-sub",
11962
+ children: `${String(shownEnabled)} ${t?.("channelpool.statEnabled") ?? "启用"}`
11963
+ })
11964
+ ]
11551
11965
  }),
11552
11966
  (0, react_jsx_runtime.jsxs)("div", {
11553
11967
  className: "kpi",
@@ -11562,19 +11976,26 @@ window.__ModuleLoader__.load({
11562
11976
  })]
11563
11977
  })]
11564
11978
  }),
11565
- channel.credits === void 0 ? null : (0, react_jsx_runtime.jsxs)("div", {
11979
+ showCredit ? (0, react_jsx_runtime.jsxs)("div", {
11566
11980
  className: "kpi",
11567
- children: [(0, react_jsx_runtime.jsx)("span", {
11568
- className: "kpi-k",
11569
- children: t?.("channelpool.statCredit") ?? "剩余积分"
11570
- }), (0, react_jsx_runtime.jsxs)("span", {
11571
- className: "kpi-v num",
11572
- children: [chosenCredit, (0, react_jsx_runtime.jsx)("span", {
11573
- className: "kpi-u",
11574
- children: unit
11575
- })]
11576
- })]
11577
- })
11981
+ children: [
11982
+ (0, react_jsx_runtime.jsx)("span", {
11983
+ className: "kpi-k",
11984
+ children: t?.("channelpool.statCredit") ?? "剩余积分"
11985
+ }),
11986
+ (0, react_jsx_runtime.jsxs)("span", {
11987
+ className: "kpi-v num",
11988
+ children: [balanceLabel, (0, react_jsx_runtime.jsx)("span", {
11989
+ className: "kpi-u",
11990
+ children: unit
11991
+ })]
11992
+ }),
11993
+ balanceCoverage === void 0 ? null : (0, react_jsx_runtime.jsx)("span", {
11994
+ className: "kpi-sub",
11995
+ children: `${t?.("channelpool.knownOnly") ?? "已知"} ${balanceCoverage}`
11996
+ })
11997
+ ]
11998
+ }) : null
11578
11999
  ]
11579
12000
  }),
11580
12001
  isMarvis ? null : (0, react_jsx_runtime.jsxs)("div", {
@@ -11600,7 +12021,7 @@ window.__ModuleLoader__.load({
11600
12021
  }),
11601
12022
  (0, react_jsx_runtime.jsx)("span", {
11602
12023
  className: "policy-hint",
11603
- children: accounts.length <= 1 ? "这个渠道只有一个账号,使用方式不影响选号。" : modeHint(t, mode)
12024
+ children: shownAccounts <= 1 ? "这个渠道只有一个账号,使用方式不影响选号。" : modeHint(t, mode)
11604
12025
  })
11605
12026
  ]
11606
12027
  }), !showAutomation ? null : (0, react_jsx_runtime.jsxs)("div", {
@@ -11608,7 +12029,7 @@ window.__ModuleLoader__.load({
11608
12029
  children: [
11609
12030
  (0, react_jsx_runtime.jsx)("span", {
11610
12031
  className: "policy-k",
11611
- children: t?.("channelpool.autoClaim") ?? "积分自动化"
12032
+ children: t?.("channelpool.poolAutomation") ?? "WorkBuddy 账号池自动化"
11612
12033
  }),
11613
12034
  (0, react_jsx_runtime.jsxs)("div", {
11614
12035
  className: "policy-v",
@@ -11618,13 +12039,13 @@ window.__ModuleLoader__.load({
11618
12039
  role: "switch",
11619
12040
  className: "sw",
11620
12041
  "aria-checked": autoClaim === true,
11621
- "aria-label": t?.("channelpool.autoClaim") ?? "积分自动化",
12042
+ "aria-label": t?.("channelpool.poolAutomation") ?? "WorkBuddy 账号池自动化",
11622
12043
  disabled: autoClaimBusy === true,
11623
12044
  onClick: () => {
11624
12045
  onAutoClaim?.(autoClaim !== true);
11625
12046
  }
11626
12047
  }),
11627
- (0, react_jsx_runtime.jsx)("span", { children: `${t?.("channelpool.claimedToday") ?? "今日已领"} ${String(claimedToday)}/${String(enabledAccounts.length)}` }),
12048
+ (0, react_jsx_runtime.jsx)("span", { children: `${t?.("channelpool.claimedToday") ?? "今日已领"} ${String(claimedToday)}/${String(shownEnabled)}` }),
11628
12049
  (0, react_jsx_runtime.jsx)("button", {
11629
12050
  type: "button",
11630
12051
  className: "tiny",
@@ -11639,7 +12060,7 @@ window.__ModuleLoader__.load({
11639
12060
  }),
11640
12061
  (0, react_jsx_runtime.jsx)("span", {
11641
12062
  className: "policy-hint",
11642
- children: t?.("channelpool.autoClaimHint") ?? "开着就会在后台领每天的积分,不用手动点。"
12063
+ children: t?.("channelpool.poolAutomationHint") ?? "只管 WorkBuddy 账号池:签到覆盖国内与国际,任务、活动、连续奖励、出行与补偿只跑国内。其他渠道的自动领取由各自的渠道卡控制。"
11643
12064
  }),
11644
12065
  autoClaimReport === void 0 ? null : (0, react_jsx_runtime.jsx)("span", {
11645
12066
  className: "sum-sub",
@@ -11803,7 +12224,7 @@ window.__ModuleLoader__.load({
11803
12224
  }),
11804
12225
  (0, react_jsx_runtime.jsx)("span", {
11805
12226
  className: "sec-n num",
11806
- children: String(accounts.length)
12227
+ children: String(shownAccounts)
11807
12228
  }),
11808
12229
  (0, react_jsx_runtime.jsxs)("span", {
11809
12230
  className: "sec-actions",
@@ -11845,7 +12266,199 @@ window.__ModuleLoader__.load({
11845
12266
  role: "status",
11846
12267
  children: chosenEntry.balanceError
11847
12268
  }),
11848
- accounts.length === 0 ? (0, react_jsx_runtime.jsx)("p", {
12269
+ lane === void 0 ? null : (0, react_jsx_runtime.jsx)("div", {
12270
+ className: "accts",
12271
+ children: lane.accounts.map((account) => {
12272
+ const credits = account.credits;
12273
+ const checkin = account.checkin;
12274
+ const claimed = checkin?.todayCheckedIn === true;
12275
+ const claiming = lane.claimingId === account.id;
12276
+ const busy = lane.busyId === account.id;
12277
+ const soon = poolExpiry(account.expiresAt);
12278
+ const packages = credits?.packages ?? [];
12279
+ return (0, react_jsx_runtime.jsxs)("article", {
12280
+ className: "acct",
12281
+ "data-off": account.disabled,
12282
+ children: [
12283
+ (0, react_jsx_runtime.jsxs)("div", {
12284
+ className: "acct-head",
12285
+ children: [
12286
+ (0, react_jsx_runtime.jsx)("span", {
12287
+ className: "acct-dot",
12288
+ "aria-hidden": "true",
12289
+ style: account.disabled ? { background: "var(--line-3)" } : void 0
12290
+ }),
12291
+ (0, react_jsx_runtime.jsx)("span", {
12292
+ className: "acct-name",
12293
+ title: account.nickname === void 0 ? account.label : `${account.label}(${account.nickname})`,
12294
+ children: account.label
12295
+ }),
12296
+ lane.activeAccountId === account.id ? (0, react_jsx_runtime.jsx)("span", {
12297
+ className: "pill",
12298
+ "data-tone": "ok",
12299
+ children: t?.("row.currentAccount") ?? "当前使用"
12300
+ }) : null,
12301
+ account.disabled ? (0, react_jsx_runtime.jsx)("span", {
12302
+ className: "pill",
12303
+ children: "已停用"
12304
+ }) : null,
12305
+ account.cooling ? (0, react_jsx_runtime.jsx)("span", {
12306
+ className: "pill",
12307
+ "data-tone": "warn",
12308
+ children: "冷却中"
12309
+ }) : null,
12310
+ (0, react_jsx_runtime.jsx)("button", {
12311
+ type: "button",
12312
+ role: "switch",
12313
+ className: "sw",
12314
+ "aria-checked": !account.disabled,
12315
+ "aria-label": account.label,
12316
+ disabled: busy,
12317
+ onClick: () => {
12318
+ lane.onToggle(account.id, !account.disabled);
12319
+ }
12320
+ })
12321
+ ]
12322
+ }),
12323
+ (0, react_jsx_runtime.jsxs)("div", {
12324
+ className: "acct-total",
12325
+ style: account.creditsError !== void 0 ? {
12326
+ flexWrap: "wrap",
12327
+ alignItems: "flex-start"
12328
+ } : void 0,
12329
+ children: [account.creditsError !== void 0 ? (0, react_jsx_runtime.jsx)("span", {
12330
+ className: "acct-k",
12331
+ "data-tone": "err",
12332
+ title: account.creditsError,
12333
+ style: {
12334
+ display: "-webkit-box",
12335
+ WebkitLineClamp: 2,
12336
+ WebkitBoxOrient: "vertical",
12337
+ overflow: "hidden",
12338
+ color: "var(--warn)",
12339
+ lineHeight: 1.5,
12340
+ minWidth: 0,
12341
+ flex: "1 1 auto"
12342
+ },
12343
+ children: "积分读取失败"
12344
+ }) : credits?.total !== void 0 ? (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("span", {
12345
+ className: "acct-total-v num",
12346
+ children: amount(credits.total)
12347
+ }), (0, react_jsx_runtime.jsx)("span", {
12348
+ className: "acct-total-u",
12349
+ children: unit
12350
+ })] }) : (0, react_jsx_runtime.jsx)("span", {
12351
+ className: "acct-total-v",
12352
+ children: "…"
12353
+ }), soon === void 0 ? null : (0, react_jsx_runtime.jsx)("span", {
12354
+ className: "acct-soon",
12355
+ children: soon
12356
+ })]
12357
+ }),
12358
+ (0, react_jsx_runtime.jsxs)("details", {
12359
+ className: "acct-detail",
12360
+ children: [
12361
+ (0, react_jsx_runtime.jsx)("summary", { children: t?.("channelpool.accountDetail") ?? "积分明细" }),
12362
+ (0, react_jsx_runtime.jsxs)("dl", {
12363
+ className: "facts",
12364
+ children: [
12365
+ packages.length === 0 ? null : packages.map((pkg, index) => (0, react_jsx_runtime.jsxs)("div", {
12366
+ className: "fact",
12367
+ children: [(0, react_jsx_runtime.jsx)("dt", { children: pkg.packageName }), (0, react_jsx_runtime.jsx)("dd", { children: pkg.size === void 0 ? pkg.remain === void 0 ? "—" : amount(pkg.remain) : `${amount(pkg.remain ?? 0)} / ${amount(pkg.size)}` })]
12368
+ }, `${pkg.packageName}-${String(index)}`)),
12369
+ checkin === void 0 ? null : (0, react_jsx_runtime.jsxs)("div", {
12370
+ className: "fact",
12371
+ children: [(0, react_jsx_runtime.jsx)("dt", { children: t?.("channelpool.todayClaimed") ?? "今日签到" }), claimed ? (0, react_jsx_runtime.jsxs)("dd", {
12372
+ style: { color: "var(--accent)" },
12373
+ children: ["已领", typeof checkin?.todayCredit === "number" ? ` +${amount(checkin.todayCredit)}` : ""]
12374
+ }) : (0, react_jsx_runtime.jsx)("dd", { children: t?.("channelpool.notClaimed") ?? "未领" })]
12375
+ }),
12376
+ checkin === void 0 || checkin.streakDays <= 0 ? null : (0, react_jsx_runtime.jsxs)("div", {
12377
+ className: "fact",
12378
+ children: [(0, react_jsx_runtime.jsx)("dt", { children: "连续签到" }), (0, react_jsx_runtime.jsx)("dd", { children: `${String(checkin.streakDays)} 天` })]
12379
+ })
12380
+ ]
12381
+ }),
12382
+ (0, react_jsx_runtime.jsxs)("div", {
12383
+ className: "acct-more",
12384
+ children: [
12385
+ checkin === void 0 ? null : (0, react_jsx_runtime.jsx)("button", {
12386
+ type: "button",
12387
+ className: "tiny",
12388
+ disabled: busy || claiming || claimed || checkin.active !== true,
12389
+ title: checkin.active === true ? void 0 : "这个账号当前没有签到活动",
12390
+ onClick: () => {
12391
+ lane.onClaim(account.id);
12392
+ },
12393
+ children: claimed ? t?.("channelpool.claimClaimed") ?? "今日已领取" : claiming ? t?.("channelpool.claiming") ?? "领取中…" : "签到"
12394
+ }),
12395
+ (0, react_jsx_runtime.jsx)("button", {
12396
+ type: "button",
12397
+ className: account.preferred ? "tiny is-on" : "tiny",
12398
+ "aria-pressed": account.preferred === true,
12399
+ disabled: busy,
12400
+ title: account.preferred ? t?.("row.accountPreferClearHint") ?? "取消首选,交回按使用方式选号" : t?.("channelpool.preferHint") ?? "优先用这个账号接下一次请求",
12401
+ onClick: () => {
12402
+ lane.onPrefer(account.preferred ? null : account.id);
12403
+ },
12404
+ children: account.preferred ? t?.("channelpool.preferred") ?? "首选" : t?.("channelpool.prefer") ?? "设为首选"
12405
+ }),
12406
+ (0, react_jsx_runtime.jsx)("button", {
12407
+ type: "button",
12408
+ className: "tiny",
12409
+ disabled: busy,
12410
+ style: { color: "var(--danger)" },
12411
+ title: "把这个账号从池子里永久移除(可在「已忽略」里恢复)",
12412
+ onClick: () => {
12413
+ lane.onIgnore(account.id);
12414
+ },
12415
+ children: "移出池子"
12416
+ })
12417
+ ]
12418
+ })
12419
+ ]
12420
+ })
12421
+ ]
12422
+ }, account.id);
12423
+ })
12424
+ }),
12425
+ lane?.ignored === void 0 || lane.ignored.length === 0 ? null : (0, react_jsx_runtime.jsxs)("div", {
12426
+ className: "sec",
12427
+ children: [(0, react_jsx_runtime.jsxs)("div", {
12428
+ className: "sec-head",
12429
+ children: [(0, react_jsx_runtime.jsx)("span", {
12430
+ className: "sec-title",
12431
+ children: t?.("row.ignoredTitle") ?? "已移出的账号"
12432
+ }), (0, react_jsx_runtime.jsx)("span", {
12433
+ className: "sec-n num",
12434
+ children: String(lane.ignored.length)
12435
+ })]
12436
+ }), lane.ignored.map((entry) => (0, react_jsx_runtime.jsxs)("div", {
12437
+ className: "row",
12438
+ children: [
12439
+ (0, react_jsx_runtime.jsx)("span", {
12440
+ className: "ch-title",
12441
+ title: entry.id,
12442
+ children: entry.label
12443
+ }),
12444
+ (0, react_jsx_runtime.jsx)("span", {
12445
+ className: "hint",
12446
+ children: t?.("row.ignoredSummary", { count: 1 }) ?? "这个账号已不在池中"
12447
+ }),
12448
+ (0, react_jsx_runtime.jsx)("button", {
12449
+ type: "button",
12450
+ className: "tiny",
12451
+ disabled: isBusy || lane.busyId === entry.id,
12452
+ title: t?.("row.ignoredRestoreHint") ?? "把这个账号放回池子",
12453
+ onClick: () => {
12454
+ lane.onRestore?.(entry);
12455
+ },
12456
+ children: t?.("row.ignoredRestore") ?? "恢复"
12457
+ })
12458
+ ]
12459
+ }, entry.id))]
12460
+ }),
12461
+ lane !== void 0 ? null : accounts.length === 0 ? (0, react_jsx_runtime.jsx)("p", {
11849
12462
  className: "hint",
11850
12463
  children: t?.("channelpool.accountsEmpty") ?? "这个渠道还没有登录的账号。"
11851
12464
  }) : (0, react_jsx_runtime.jsx)("div", {
@@ -11956,7 +12569,12 @@ window.__ModuleLoader__.load({
11956
12569
  children: [(0, react_jsx_runtime.jsx)("dt", { children: t?.("channelpool.todayClaimed") ?? "今日签到" }), checkin?.todayCheckedIn === true ? (0, react_jsx_runtime.jsxs)("dd", {
11957
12570
  style: { color: "var(--accent)" },
11958
12571
  children: ["已领", typeof checkin.todayCredit === "number" ? ` +${amount(checkin.todayCredit)}` : ""]
11959
- }) : (0, react_jsx_runtime.jsx)("dd", { children: t?.("channelpool.notClaimed") ?? "未领" })]
12572
+ }) : checkin?.todayCheckedIn === false ? (0, react_jsx_runtime.jsx)("dd", { children: t?.("channelpool.notClaimed") ?? "未领" }) : (0, react_jsx_runtime.jsx)("dd", {
12573
+ "data-tone": chosenEntry.statusError === void 0 ? void 0 : "err",
12574
+ title: chosenEntry.statusError,
12575
+ style: chosenEntry.statusError === void 0 ? { color: "var(--faint)" } : { color: "var(--warn)" },
12576
+ children: chosenEntry.statusError === void 0 ? t?.("channelpool.checkinUnknown") ?? "状态未知" : t?.("channelpool.checkinUnreadable") ?? "状态读不到"
12577
+ })]
11960
12578
  })]
11961
12579
  }),
11962
12580
  (0, react_jsx_runtime.jsxs)("div", {
@@ -15318,6 +15936,59 @@ window.__ModuleLoader__.load({
15318
15936
  })
15319
15937
  });
15320
15938
  //#endregion
15939
+ //#region src/client/ignored-restore.ts
15940
+ function ignoredFrom(status) {
15941
+ if (status === null || typeof status !== "object") return [];
15942
+ const list = status.ignored;
15943
+ if (!Array.isArray(list)) return [];
15944
+ const rows = [];
15945
+ for (const raw of list) {
15946
+ if (raw === null || typeof raw !== "object") continue;
15947
+ const id = raw.id;
15948
+ if (typeof id !== "string" || id === "") continue;
15949
+ const label = raw.label;
15950
+ const ignoredAt = raw.ignoredAt;
15951
+ rows.push({
15952
+ id,
15953
+ label: typeof label === "string" && label !== "" ? label : id,
15954
+ ignoredAt: typeof ignoredAt === "string" ? ignoredAt : ""
15955
+ });
15956
+ }
15957
+ return rows;
15958
+ }
15959
+ function classifyRestore(input) {
15960
+ const { label, response, present } = input;
15961
+ if (!response.ok) return {
15962
+ kind: "failed",
15963
+ label,
15964
+ error: response.error ?? "恢复请求被拒绝"
15965
+ };
15966
+ if (present === void 0) return {
15967
+ kind: "scanFailed",
15968
+ label,
15969
+ error: input.refreshError ?? "状态回读失败"
15970
+ };
15971
+ if (!present) return {
15972
+ kind: "missingCredential",
15973
+ label
15974
+ };
15975
+ return {
15976
+ kind: "restored",
15977
+ label
15978
+ };
15979
+ }
15980
+ function restoreMessage(outcome) {
15981
+ switch (outcome.kind) {
15982
+ case "restored": return `已把 ${outcome.label} 放回池子`;
15983
+ case "missingCredential": return `已解除对 ${outcome.label} 的忽略,但没有找到它的凭据 —— 请重新登录这个账号,或点「重新检测」确认本机还有哪些账号`;
15984
+ case "scanFailed": return `${outcome.label} 的忽略已解除,但状态没能读回来(${outcome.error})。刷新后确认它是否已经回到池子`;
15985
+ case "failed": return `解除 ${outcome.label} 的忽略失败:${outcome.error}`;
15986
+ }
15987
+ }
15988
+ function restoreSucceeded(outcome) {
15989
+ return outcome.kind === "restored";
15990
+ }
15991
+ //#endregion
15321
15992
  //#region src/client/backup-crypto.ts
15322
15993
  const ENCRYPTED_FORMAT = "dsh-xdpool/backup-encrypted";
15323
15994
  const ITERATIONS = 31e4;
@@ -16259,7 +16930,6 @@ window.__ModuleLoader__.load({
16259
16930
  label: t?.("shell.tabBackup") ?? "Backup"
16260
16931
  }
16261
16932
  ];
16262
- const [selectedChannel, setSelectedChannel] = (0, react.useState)("");
16263
16933
  const [page, setPage] = (0, react.useState)(() => initialShellTab(rememberedShellTab(), shellTabs) ?? "pool");
16264
16934
  const [busyRegion, setBusyRegion] = (0, react.useState)(void 0);
16265
16935
  const [catalogBusyRegion, setCatalogBusyRegion] = (0, react.useState)(void 0);
@@ -16270,6 +16940,8 @@ window.__ModuleLoader__.load({
16270
16940
  const [reserveBusy, setReserveBusy] = (0, react.useState)(void 0);
16271
16941
  const [flash, setFlash] = (0, react.useState)(void 0);
16272
16942
  const [checkinBusyId, setCheckinBusyId] = (0, react.useState)(void 0);
16943
+ const claimedIds = (0, react.useRef)(new Set());
16944
+ const [batchRegion, setBatchRegion] = (0, react.useState)(void 0);
16273
16945
  const [accountBusyId, setAccountBusyId] = (0, react.useState)(void 0);
16274
16946
  const [usage, setUsage] = (0, react.useState)(void 0);
16275
16947
  const [draftByRegion, setDraftByRegion] = (0, react.useState)({});
@@ -16281,6 +16953,7 @@ window.__ModuleLoader__.load({
16281
16953
  mounted.current = false;
16282
16954
  };
16283
16955
  }, []);
16956
+ const regionGate = (0, react.useRef)(createRegionGate());
16284
16957
  const [probes, setProbes] = (0, react.useState)({});
16285
16958
  const [probingModel, setProbingModel] = (0, react.useState)(void 0);
16286
16959
  (0, react.useCallback)(async (provider, model) => {
@@ -16325,6 +16998,7 @@ window.__ModuleLoader__.load({
16325
16998
  }
16326
16999
  }, [probingModel]);
16327
17000
  const refresh = (0, react.useCallback)(async (region, signal) => {
17001
+ const ticket = regionGate.current.issue(region);
16328
17002
  try {
16329
17003
  const response = await fetch(`${POOL_STATUS_PATH}?region=${region}`, {
16330
17004
  headers: { accept: "application/json" },
@@ -16333,7 +17007,7 @@ window.__ModuleLoader__.load({
16333
17007
  });
16334
17008
  const value = await response.json().catch(() => void 0);
16335
17009
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
16336
- if (mounted.current && signal?.aborted !== true) {
17010
+ if (mounted.current && signal?.aborted !== true && regionGate.current.accept(region, ticket)) {
16337
17011
  setStatusByRegion((prev) => ({
16338
17012
  ...prev,
16339
17013
  [region]: value
@@ -16401,9 +17075,8 @@ window.__ModuleLoader__.load({
16401
17075
  controller.abort();
16402
17076
  };
16403
17077
  }, [refreshUsage]);
16404
- const claimCheckin = async (region, accountId) => {
16405
- setCheckinBusyId(accountId);
16406
- setFlash(void 0);
17078
+ const claimOne = (0, react.useCallback)(async (region, accountId) => {
17079
+ const label = statusByRegion[region]?.accounts.find((account) => account.id === accountId)?.label ?? accountId;
16407
17080
  try {
16408
17081
  const response = await fetch(POOL_CHECKIN_PATH, {
16409
17082
  method: "POST",
@@ -16414,18 +17087,95 @@ window.__ModuleLoader__.load({
16414
17087
  credentials: "same-origin",
16415
17088
  body: JSON.stringify({ accountId })
16416
17089
  });
16417
- const body = await response.json().catch(() => void 0);
16418
- if (!response.ok) throw new Error(body?.error ?? `HTTP ${response.status}`);
17090
+ return {
17091
+ accountId,
17092
+ label,
17093
+ ...outcomeFromClaim(await response.json().catch(() => void 0), response.ok)
17094
+ };
17095
+ } catch (cause) {
17096
+ return {
17097
+ accountId,
17098
+ label,
17099
+ outcome: "failed",
17100
+ error: cause instanceof Error ? cause.message : String(cause)
17101
+ };
17102
+ }
17103
+ }, [statusByRegion]);
17104
+ const claimCheckin = async (region, accountId) => {
17105
+ setCheckinBusyId(accountId);
17106
+ setFlash(void 0);
17107
+ try {
17108
+ const result = await claimOne(region, accountId);
17109
+ if (result.outcome === "failed") throw new Error(result.error ?? "签到失败");
16419
17110
  await refresh(region);
16420
- const credit = body?.claim?.credit ?? 0;
16421
- if (mounted.current) setFlash(t?.("row.checkinClaimedReward", { credit: formatNumber(credit) }) ?? `Claimed +${formatNumber(credit)} credits`);
17111
+ if (!mounted.current) return;
17112
+ if (result.outcome === "alreadyClaimed") {
17113
+ claimedIds.current.add(accountId);
17114
+ setFlash(t?.("row.checkinAlready") ?? "今天已经签到过了");
17115
+ return;
17116
+ }
17117
+ claimedIds.current.add(accountId);
17118
+ const credit = result.credit ?? 0;
17119
+ setFlash(t?.("row.checkinClaimedReward", { credit: formatNumber(credit) }) ?? `Claimed +${formatNumber(credit)} credits`);
16422
17120
  } catch (cause) {
16423
17121
  if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
16424
17122
  } finally {
16425
17123
  if (mounted.current) setCheckinBusyId(void 0);
16426
17124
  }
16427
17125
  };
17126
+ const rowsOf = (0, react.useCallback)((region) => {
17127
+ const here = statusByRegion[region];
17128
+ if (here === void 0) return [];
17129
+ return buildPoolView({
17130
+ channelId: REGION_CHANNEL_BY_REGION[region],
17131
+ region,
17132
+ status: here,
17133
+ state: "ready"
17134
+ }).rows;
17135
+ }, [statusByRegion]);
17136
+ const refreshRegion = (0, react.useCallback)(async (region) => {
17137
+ return await refresh(region) === void 0 ? {
17138
+ ok: false,
17139
+ error: "状态回读失败"
17140
+ } : { ok: true };
17141
+ }, [refresh]);
17142
+ const runClaimAll = async (region) => {
17143
+ setBatchRegion(region);
17144
+ try {
17145
+ const report = await claimAll({
17146
+ rows: rowsOf(region),
17147
+ skipIds: claimedIds.current,
17148
+ claim: (accountId) => claimOne(region, accountId),
17149
+ recheck: (accountId) => recheckAccount(region, accountId),
17150
+ refresh: () => refreshRegion(region)
17151
+ });
17152
+ for (const result of report.results) if (result.outcome === "claimed" || result.outcome === "alreadyClaimed") claimedIds.current.add(result.accountId);
17153
+ if (report.refresh.ok) claimedIds.current.clear();
17154
+ return report;
17155
+ } finally {
17156
+ if (mounted.current) setBatchRegion(void 0);
17157
+ }
17158
+ };
17159
+ const recheckAccount = async (region, accountId) => {
17160
+ if (await refresh(region) === void 0) return void 0;
17161
+ return rowsOf(region).find((row) => row.id === accountId);
17162
+ };
17163
+ const rescanAll = async () => rescanRegions({
17164
+ rescan: async () => {
17165
+ const response = await fetch(POOL_RESCAN_PATH, {
17166
+ method: "POST",
17167
+ headers: { accept: "application/json" },
17168
+ credentials: "same-origin"
17169
+ });
17170
+ const body = await response.json();
17171
+ if (!response.ok) throw new Error(body.error ?? `HTTP ${response.status}`);
17172
+ return body.accounts ?? 0;
17173
+ },
17174
+ refresh: async (region) => (await refresh(region))?.accounts.length,
17175
+ regions: REGION_CARDS
17176
+ });
16428
17177
  const statusOf = (region) => statusByRegion[region];
17178
+ const ignoredOf = (region) => ignoredFrom(statusOf(region));
16429
17179
  const toggleAccountDisabled = async (region, accountId, disabled) => {
16430
17180
  const write = settingsScope?.set;
16431
17181
  if (write === void 0) {
@@ -16470,6 +17220,62 @@ window.__ModuleLoader__.load({
16470
17220
  if (mounted.current) setAccountBusyId(void 0);
16471
17221
  }
16472
17222
  };
17223
+ const restoreIgnored = async (entry) => {
17224
+ setAccountBusyId(entry.id);
17225
+ setFlash(void 0);
17226
+ try {
17227
+ let response;
17228
+ try {
17229
+ const answer = await fetch(POOL_ACCOUNT_IGNORE_PATH, {
17230
+ method: "POST",
17231
+ headers: { "Content-Type": "application/json" },
17232
+ body: JSON.stringify({
17233
+ accountId: entry.id,
17234
+ ignored: false
17235
+ })
17236
+ });
17237
+ if (!answer.ok) response = {
17238
+ ok: false,
17239
+ error: (await answer.json().catch(() => ({}))).error ?? `HTTP ${answer.status}`
17240
+ };
17241
+ else response = { ok: true };
17242
+ } catch (cause) {
17243
+ response = {
17244
+ ok: false,
17245
+ error: cause instanceof Error ? cause.message : String(cause)
17246
+ };
17247
+ }
17248
+ if (!response.ok) return {
17249
+ kind: "failed",
17250
+ label: entry.label,
17251
+ error: response.error ?? "恢复请求被拒绝"
17252
+ };
17253
+ const refreshed = (await Promise.all(REGION_CARDS.map(async (region) => ({
17254
+ ok: true,
17255
+ status: await refresh(region)
17256
+ })))).filter((read) => read.status !== void 0);
17257
+ if (refreshed.length === 0) return {
17258
+ kind: "scanFailed",
17259
+ label: entry.label,
17260
+ error: "两个区的状态都没能读回来"
17261
+ };
17262
+ const back = refreshed.some((read) => (read.status?.accounts ?? []).some((account) => account.id === entry.id));
17263
+ return classifyRestore({
17264
+ label: entry.label,
17265
+ response,
17266
+ present: back
17267
+ });
17268
+ } finally {
17269
+ if (mounted.current) setAccountBusyId(void 0);
17270
+ }
17271
+ };
17272
+ const restoreAccount = async (entry) => {
17273
+ const outcome = await restoreIgnored(entry);
17274
+ if (!mounted.current) return;
17275
+ const message = restoreMessage(outcome);
17276
+ if (restoreSucceeded(outcome)) setFlash(message);
17277
+ else setError(message);
17278
+ };
16473
17279
  const setPreferredAccount = async (region, accountId) => {
16474
17280
  setAccountBusyId(accountId ?? "none");
16475
17281
  setFlash(void 0);
@@ -16578,7 +17384,44 @@ window.__ModuleLoader__.load({
16578
17384
  };
16579
17385
  t?.("row.title");
16580
17386
  t?.("row.desc");
16581
- const showPoolAccounts = selectedChannel === REGION_CHANNEL_BY_REGION.cn || selectedChannel === REGION_CHANNEL_BY_REGION.global;
17387
+ const laneFor = (region) => {
17388
+ const here = statusOf(region);
17389
+ return {
17390
+ accounts: here?.accounts ?? [],
17391
+ activeAccountId: here?.activeAccountId,
17392
+ claimingId: checkinBusyId,
17393
+ busyId: accountBusyId,
17394
+ batchBusy: batchRegion === region,
17395
+ onClaim: (accountId) => {
17396
+ claimCheckin(region, accountId);
17397
+ },
17398
+ onToggle: (accountId, disabled) => {
17399
+ toggleAccountDisabled(region, accountId, disabled);
17400
+ },
17401
+ onPrefer: (accountId) => {
17402
+ setPreferredAccount(region, accountId);
17403
+ },
17404
+ onIgnore: (accountId) => {
17405
+ setAccountIgnored(region, accountId, true);
17406
+ },
17407
+ ignored: ignoredOf(region),
17408
+ onRestore: (entry) => {
17409
+ restoreAccount(entry);
17410
+ },
17411
+ actions: {
17412
+ claim: (accountId) => claimOne(region, accountId),
17413
+ claimAll: () => runClaimAll(region),
17414
+ recheckAccount: (accountId) => recheckAccount(region, accountId),
17415
+ rescan: () => rescanAll(),
17416
+ rows: () => rowsOf(region),
17417
+ refresh: () => refreshRegion(region)
17418
+ }
17419
+ };
17420
+ };
17421
+ const poolLanes = {
17422
+ [REGION_CHANNEL_BY_REGION.cn]: laneFor("cn"),
17423
+ [REGION_CHANNEL_BY_REGION.global]: laneFor("global")
17424
+ };
16582
17425
  return (0, react_jsx_runtime.jsx)(PoolShell, {
16583
17426
  t,
16584
17427
  version: POOL_VERSION,
@@ -16619,43 +17462,7 @@ window.__ModuleLoader__.load({
16619
17462
  style: { display: "contents" },
16620
17463
  children: (0, react_jsx_runtime.jsx)(ChannelPoolSection, {
16621
17464
  t,
16622
- regionCards: showPoolAccounts ? ["cn", "global"].map((region) => {
16623
- const here = statusOf(region);
16624
- const rows = here?.accounts ?? [];
16625
- if (rows.length === 0) return null;
16626
- return (0, react_jsx_runtime.jsxs)("section", {
16627
- className: "sec",
16628
- children: [(0, react_jsx_runtime.jsx)("div", {
16629
- className: "sec-head",
16630
- children: (0, react_jsx_runtime.jsxs)("span", {
16631
- className: "sec-title",
16632
- children: [region === "cn" ? t?.("row.tabCn") ?? "CN" : t?.("row.tabGlobal") ?? "Global", ` · ${String(rows.length)}`]
16633
- })
16634
- }), (0, react_jsx_runtime.jsx)("div", {
16635
- className: "accts",
16636
- children: rows.map((account) => (0, react_jsx_runtime.jsx)(AccountCard, {
16637
- account,
16638
- t,
16639
- serving: here?.activeAccountId === account.id,
16640
- ...checkinBusyId === account.id ? { claiming: true } : {},
16641
- ...accountBusyId === account.id ? { busy: true } : {},
16642
- onClaim: () => {
16643
- claimCheckin(region, account.id);
16644
- },
16645
- onToggle: (disabled) => {
16646
- toggleAccountDisabled(region, account.id, disabled);
16647
- },
16648
- onPrefer: (id) => {
16649
- setPreferredAccount(region, id);
16650
- },
16651
- onIgnore: () => {
16652
- setAccountIgnored(region, account.id, true);
16653
- }
16654
- }, account.id))
16655
- })]
16656
- }, region);
16657
- }) : void 0,
16658
- active: selectedChannel,
17465
+ poolLanes,
16659
17466
  onAddAccount: () => {
16660
17467
  setPage("channels");
16661
17468
  },
@@ -19607,7 +20414,10 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
19607
20414
  .app[data-w="narrow"] .ls{padding:3px var(--s2)}
19608
20415
  .app[data-w="narrow"] .ls-v{font-size:13px}
19609
20416
  .app[data-w="narrow"] .list-scroll{display:flex;flex-direction:row;align-items:center;gap:6px;padding:0 var(--s3) var(--s2);overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}
19610
- .app[data-w="narrow"] .list-scroll>div{display:contents}
20417
+ /* 横滑条里要扁平化的是真正的包裹层;分组标题本身就是 div,必须排除,否则
20418
+ .list-scroll>div 的权重(0,3,1)压过下面 .list-group 的 display:none(0,3,0),
20419
+ 标题反而被拆成一个个 flex 项,"已登录"竖排成一列单字(390 实测到)。 */
20420
+ .app[data-w="narrow"] .list-scroll>div:not(.list-group){display:contents}
19611
20421
  .app[data-w="narrow"] .list-group{display:none}
19612
20422
  .app[data-w="narrow"] .ch{flex:0 0 auto;width:auto;max-width:180px;padding:4px 10px;min-height:28px;border:1px solid var(--line-2);border-radius:var(--r-pill);display:inline-flex;align-items:center;gap:6px}
19613
20423
  .app[data-w="narrow"] .ch[aria-current="true"]{border-color:transparent;background:var(--accent);color:var(--accent-ink)}
@@ -19706,7 +20516,8 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
19706
20516
  .app[data-w="phone"] .list{grid-row:1;grid-column:1;min-width:0}
19707
20517
  .app[data-w="phone"] .main{grid-row:2;grid-column:1}
19708
20518
  .app-wide[data-w="phone"] .main{grid-row:1}
19709
- .app[data-w="phone"] .list-scroll>div{display:contents}
20519
+ /* 理由同 narrow:分组标题也是 div,那个后代选择器会把它的 display:none 压掉。 */
20520
+ .app[data-w="phone"] .list-scroll>div:not(.list-group){display:contents}
19710
20521
  .app[data-w="phone"] .list-stats{flex:0 0 auto;min-width:180px}
19711
20522
  .app[data-w="phone"] .rail-item>span.sw{display:none}
19712
20523
  .app[data-w="phone"] .sec-actions{margin-left:0;width:100%}
@@ -19910,6 +20721,24 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
19910
20721
  .app[data-theme="light"] .col:hover .col-bar {
19911
20722
  background: oklch(64% .13 152);
19912
20723
  }
20724
+ `;
20725
+ new Intl.NumberFormat();
20726
+ const ACCOUNT_CARD_CSS = `
20727
+ .xdp-accts{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:var(--s3)}
20728
+ .xdp-acct{display:flex;flex-direction:column;gap:var(--s2);min-width:0;padding:var(--s3);border:1px solid var(--line);border-radius:var(--r-lg);background:var(--surface)}
20729
+ .xdp-acct[data-serving="true"]{border-color:var(--accent-line)}
20730
+ .xdp-acct .xdp-acct-head{display:block;min-width:0}
20731
+ .xdp-acct .xdp-acct-name{display:block;max-width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--fs-sm);font-weight:600;color:var(--text)}
20732
+ .xdp-acct .xdp-acct-badges{display:flex;flex-wrap:wrap;gap:var(--s1)}
20733
+ .xdp-acct .xdp-acct-badge{flex:0 0 auto;padding:0 6px;border:1px solid var(--accent-line);border-radius:var(--r-pill);background:var(--accent-dim);color:var(--accent);font-size:var(--fs-xs);line-height:16px;white-space:nowrap}
20734
+ .xdp-acct-badge.is-off{border-color:var(--line-2);background:transparent;color:var(--faint)}
20735
+ .xdp-acct-badge.is-warn{border-color:color-mix(in oklch, var(--warn) 40%, transparent);background:color-mix(in oklch, var(--warn) 10%, transparent);color:var(--warn)}
20736
+ .xdp-acct-meta{margin:0;font-size:var(--fs-xs);line-height:1.5;color:var(--faint);font-variant-numeric:tabular-nums;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
20737
+ .xdp-acct-credits{display:flex;align-items:baseline;gap:var(--s2);min-width:0;flex-wrap:wrap}
20738
+ .xdp-acct-credits strong{font-size:var(--fs-lg);font-weight:600;color:var(--text);font-variant-numeric:tabular-nums}
20739
+ .xdp-acct-credits > span{font-size:var(--fs-xs);color:var(--faint)}
20740
+ .xdp-acct-warn{font-size:var(--fs-xs);color:var(--warn)}
20741
+ .xdp-acct-actions{display:flex;flex-wrap:wrap;gap:var(--s1);padding-top:2px}
19913
20742
  `;
19914
20743
  //#endregion
19915
20744
  //#region src/client/design-style.ts
@@ -19957,6 +20786,8 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
19957
20786
  "channelpool.statAccounts": "accounts",
19958
20787
  "channelpool.statModels": "models",
19959
20788
  "channelpool.statCredit": "credit left",
20789
+ "channelpool.statEnabled": "enabled",
20790
+ "channelpool.knownOnly": "known",
19960
20791
  "channelpool.autoOn": "Turn automation on",
19961
20792
  "channelpool.autoOff": "Turn automation off",
19962
20793
  "channelpool.claimCredits": "Claim credits",
@@ -20033,6 +20864,9 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20033
20864
  "row.checkinDaily": "+{credit} credits/day",
20034
20865
  "row.checkinStreakBonus": "day {days} bonus +{credit}",
20035
20866
  "row.checkinClaimedReward": "Claimed +{credit} credits",
20867
+ "row.checkinAlready": "Already checked in today",
20868
+ "row.checkinBatchClaimed": "Claimed for {count} accounts",
20869
+ "row.checkinBatchFailed": "{count} failed",
20036
20870
  "row.checkinError": "Check-in failed: {message}",
20037
20871
  "row.checkinUnavailable": "check-in unavailable",
20038
20872
  "row.checkinAllHint": "Collect every account’s daily reward here — no need to switch accounts first.",
@@ -20603,6 +21437,10 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20603
21437
  "channelpool.autoClaimRun": "Run now",
20604
21438
  "channelpool.autoClaimRunning": "Running…",
20605
21439
  "channelpool.autoClaimRunHint": "Run one collection pass now instead of waiting for the scheduled hour",
21440
+ "channelpool.checkinUnknown": "unknown",
21441
+ "channelpool.checkinUnreadable": "unreadable",
21442
+ "channelpool.poolAutomation": "WorkBuddy pool automation",
21443
+ "channelpool.poolAutomationHint": "Governs the WorkBuddy pool only: check-in covers both regions, while tasks, activities, streaks, travel and compensation run in CN only. Other channels have their own switch on their card.",
20606
21444
  "channelpool.autoEarned": "{credit} credits · {energy} energy · {count} task(s)",
20607
21445
  "channelpool.autoEarnedCredits": "{credit} credits",
20608
21446
  "channelpool.modePrefer": "Priority",
@@ -20682,6 +21520,8 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20682
21520
  "channelpool.statAccounts": "账号",
20683
21521
  "channelpool.statModels": "模型",
20684
21522
  "channelpool.statCredit": "剩余积分",
21523
+ "channelpool.statEnabled": "启用",
21524
+ "channelpool.knownOnly": "已知",
20685
21525
  "channelpool.autoOn": "开启自动化",
20686
21526
  "channelpool.autoOff": "关闭自动化",
20687
21527
  "channelpool.claimCredits": "领取积分",
@@ -20758,6 +21598,9 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20758
21598
  "row.checkinDaily": "每日 +{credit} 积分",
20759
21599
  "row.checkinStreakBonus": "第 {days} 天额外 +{credit}",
20760
21600
  "row.checkinClaimedReward": "已领取 +{credit} 积分",
21601
+ "row.checkinAlready": "今天已经签到过了",
21602
+ "row.checkinBatchClaimed": "已领取 {count} 个账号",
21603
+ "row.checkinBatchFailed": "{count} 个失败",
20761
21604
  "row.checkinError": "签到失败:{message}",
20762
21605
  "row.checkinUnavailable": "签到不可用",
20763
21606
  "row.checkinAllHint": "这里可以为每个账号分别领取每日签到奖励,无需先切换账号。",
@@ -21369,6 +22212,10 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
21369
22212
  "channelpool.autoClaimRun": "立即执行",
21370
22213
  "channelpool.autoClaimRunning": "领取中…",
21371
22214
  "channelpool.autoClaimRunHint": "马上跑一轮领取,不用等到预定时间",
22215
+ "channelpool.checkinUnknown": "状态未知",
22216
+ "channelpool.checkinUnreadable": "状态读不到",
22217
+ "channelpool.poolAutomation": "WorkBuddy 账号池自动化",
22218
+ "channelpool.poolAutomationHint": "只管 WorkBuddy 账号池:签到覆盖国内与国际,任务、活动、连续奖励、出行与补偿只跑国内。其他渠道的自动领取由各自的渠道卡控制。",
21372
22219
  "channelpool.autoEarned": "{credit} 积分 · {energy} 能量 · {count} 个任务",
21373
22220
  "channelpool.autoEarnedCredits": "{credit} 积分",
21374
22221
  "channelpool.modePrefer": "优先",