@kaitranntt/ccs 7.58.0-dev.1 → 7.58.0-dev.2

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 (45) hide show
  1. package/dist/cliproxy/account-stats-key.d.ts +2 -0
  2. package/dist/cliproxy/account-stats-key.d.ts.map +1 -0
  3. package/dist/cliproxy/account-stats-key.js +8 -0
  4. package/dist/cliproxy/account-stats-key.js.map +1 -0
  5. package/dist/cliproxy/stats-fetcher.d.ts +5 -1
  6. package/dist/cliproxy/stats-fetcher.d.ts.map +1 -1
  7. package/dist/cliproxy/stats-fetcher.js +2 -66
  8. package/dist/cliproxy/stats-fetcher.js.map +1 -1
  9. package/dist/cliproxy/stats-transformer.d.ts +3 -0
  10. package/dist/cliproxy/stats-transformer.d.ts.map +1 -0
  11. package/dist/cliproxy/stats-transformer.js +73 -0
  12. package/dist/cliproxy/stats-transformer.js.map +1 -0
  13. package/dist/ui/assets/{accounts-Bi7XUDHo.js → accounts-CYJwzq9g.js} +1 -1
  14. package/dist/ui/assets/{alert-dialog-Bskv1UqD.js → alert-dialog-B8EI9gra.js} +1 -1
  15. package/dist/ui/assets/{api-BFfNiWU_.js → api-DxUnme4s.js} +2 -2
  16. package/dist/ui/assets/{auth-section-CkwkOd8Q.js → auth-section-D7PsPGEM.js} +1 -1
  17. package/dist/ui/assets/{backups-section-CDkFAktJ.js → backups-section-Cm3lyE9d.js} +1 -1
  18. package/dist/ui/assets/{channels-D9vRjf9H.js → channels-H6YmNNxH.js} +1 -1
  19. package/dist/ui/assets/{checkbox-rsq1JHt2.js → checkbox-DYYN1zJe.js} +1 -1
  20. package/dist/ui/assets/{claude-extension-BfwJj618.js → claude-extension-Ct-Dcf-x.js} +1 -1
  21. package/dist/ui/assets/cliproxy-D6WqAVUH.js +3 -0
  22. package/dist/ui/assets/{cliproxy-ai-providers-DixxeJfQ.js → cliproxy-ai-providers-Bq3gW2E-.js} +2 -2
  23. package/dist/ui/assets/{cliproxy-control-panel-CdCsaRq4.js → cliproxy-control-panel-CzFcUx6s.js} +1 -1
  24. package/dist/ui/assets/{confirm-dialog-B4WlF7tC.js → confirm-dialog-DalRN9Os.js} +1 -1
  25. package/dist/ui/assets/{copilot-CuFOx9Kk.js → copilot-C9tvzWpP.js} +1 -1
  26. package/dist/ui/assets/{cursor-B64u82go.js → cursor-7X2jg5OU.js} +1 -1
  27. package/dist/ui/assets/droid-CaVvAGBz.js +2 -0
  28. package/dist/ui/assets/{globalenv-section-ISO8VWcQ.js → globalenv-section-rmwn4gBY.js} +1 -1
  29. package/dist/ui/assets/{health-D-5UfvHV.js → health-YNma3ZU3.js} +1 -1
  30. package/dist/ui/assets/{index-CBHMywxl.js → index-Cg7_zIGP.js} +1 -1
  31. package/dist/ui/assets/{index-D4gDsKGX.js → index-CtdI-JEv.js} +1 -1
  32. package/dist/ui/assets/{index-CzllrOuG.css → index-DQUOlpg2.css} +1 -1
  33. package/dist/ui/assets/{index-0mbI0zkd.js → index-D_BsksCe.js} +21 -21
  34. package/dist/ui/assets/{index-Lw9RiYua.js → index-DwrnTADJ.js} +1 -1
  35. package/dist/ui/assets/{index-DgO9oAtH.js → index-pvMXDZd2.js} +1 -1
  36. package/dist/ui/assets/{proxy-status-widget-DBQNYwwE.js → proxy-status-widget-D34hsuNr.js} +1 -1
  37. package/dist/ui/assets/{searchable-select-BBmIBbiR.js → searchable-select-BPNTu-Xv.js} +1 -1
  38. package/dist/ui/assets/{separator-BVx8r-KC.js → separator-BAO8KZ_a.js} +1 -1
  39. package/dist/ui/assets/{shared-BM5hXjzm.js → shared-Cz0YP1E_.js} +1 -1
  40. package/dist/ui/assets/{switch-Db2HZGHS.js → switch-DRdXtKAG.js} +1 -1
  41. package/dist/ui/assets/{updates-DTXYBnlZ.js → updates-DvZUO3G1.js} +1 -1
  42. package/dist/ui/index.html +2 -2
  43. package/package.json +1 -1
  44. package/dist/ui/assets/cliproxy-xutd0LaH.js +0 -3
  45. package/dist/ui/assets/droid-DwscDHGF.js +0 -2
@@ -0,0 +1,2 @@
1
+ export declare function buildQualifiedAccountStatsKey(provider: string, source: string): string;
2
+ //# sourceMappingURL=account-stats-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-stats-key.d.ts","sourceRoot":"","sources":["../../src/cliproxy/account-stats-key.ts"],"names":[],"mappings":"AAAA,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtF"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildQualifiedAccountStatsKey = void 0;
4
+ function buildQualifiedAccountStatsKey(provider, source) {
5
+ return `${provider.trim().toLowerCase()}:${source.trim()}`;
6
+ }
7
+ exports.buildQualifiedAccountStatsKey = buildQualifiedAccountStatsKey;
8
+ //# sourceMappingURL=account-stats-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-stats-key.js","sourceRoot":"","sources":["../../src/cliproxy/account-stats-key.ts"],"names":[],"mappings":";;;AAAA,SAAgB,6BAA6B,CAAC,QAAgB,EAAE,MAAc;IAC5E,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;AAC7D,CAAC;AAFD,sEAEC"}
@@ -6,7 +6,11 @@
6
6
  */
7
7
  /** Per-account usage statistics */
8
8
  export interface AccountUsageStats {
9
- /** Account email or identifier */
9
+ /** Provider-qualified lookup key (for example: "codex:user@example.com") */
10
+ accountKey: string;
11
+ /** Canonical provider name reported by CLIProxyAPI */
12
+ provider: string;
13
+ /** Raw account email or identifier */
10
14
  source: string;
11
15
  /** Number of successful requests */
12
16
  successCount: number;
@@ -1 +1 @@
1
- {"version":3,"file":"stats-fetcher.d.ts","sourceRoot":"","sources":["../../src/cliproxy/stats-fetcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,m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/C,MAAM,WAAW,gBAAgB;IAC/B,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAOD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,CAkC9F;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoCxB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAuBvE"}
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.isCliproxyRunning = exports.fetchCliproxyErrorLogContent = exports.fetchCliproxyErrorLogs = exports.fetchCliproxyModels = exports.fetchCliproxyUsageRaw = exports.fetchCliproxyStats = void 0;
10
10
  const auth_token_manager_1 = require("./auth-token-manager");
11
11
  const proxy_target_resolver_1 = require("./proxy-target-resolver");
12
+ const stats_transformer_1 = require("./stats-transformer");
12
13
  /**
13
14
  * Fetch usage statistics from CLIProxyAPI management API
14
15
  * @param port CLIProxyAPI port (default: 8317)
@@ -38,72 +39,7 @@ async function fetchCliproxyStats(port) {
38
39
  return null;
39
40
  }
40
41
  const data = (await response.json());
41
- const usage = data.usage;
42
- // Extract models, providers, and per-account stats from the nested API structure
43
- const requestsByModel = {};
44
- const requestsByProvider = {};
45
- const accountStats = {};
46
- let totalSuccessCount = 0;
47
- let totalFailureCount = 0;
48
- let totalInputTokens = 0;
49
- let totalOutputTokens = 0;
50
- if (usage?.apis) {
51
- for (const [provider, providerData] of Object.entries(usage.apis)) {
52
- requestsByProvider[provider] = providerData.total_requests ?? 0;
53
- if (providerData.models) {
54
- for (const [model, modelData] of Object.entries(providerData.models)) {
55
- requestsByModel[model] = modelData.total_requests ?? 0;
56
- // Aggregate per-account stats from request details
57
- if (modelData.details) {
58
- for (const detail of modelData.details) {
59
- const source = detail.source || 'unknown';
60
- // Initialize account stats if not exists
61
- if (!accountStats[source]) {
62
- accountStats[source] = {
63
- source,
64
- successCount: 0,
65
- failureCount: 0,
66
- totalTokens: 0,
67
- };
68
- }
69
- // Update account stats
70
- if (detail.failed) {
71
- accountStats[source].failureCount++;
72
- totalFailureCount++;
73
- }
74
- else {
75
- accountStats[source].successCount++;
76
- totalSuccessCount++;
77
- }
78
- const tokens = detail.tokens?.total_tokens ?? 0;
79
- accountStats[source].totalTokens += tokens;
80
- accountStats[source].lastUsedAt = detail.timestamp;
81
- // Aggregate token breakdowns
82
- totalInputTokens += detail.tokens?.input_tokens ?? 0;
83
- totalOutputTokens += detail.tokens?.output_tokens ?? 0;
84
- }
85
- }
86
- }
87
- }
88
- }
89
- }
90
- // Normalize the response to our interface
91
- return {
92
- totalRequests: usage?.total_requests ?? 0,
93
- successCount: totalSuccessCount,
94
- failureCount: totalFailureCount,
95
- tokens: {
96
- input: totalInputTokens,
97
- output: totalOutputTokens,
98
- total: usage?.total_tokens ?? 0,
99
- },
100
- requestsByModel,
101
- requestsByProvider,
102
- accountStats,
103
- quotaExceededCount: usage?.failure_count ?? data.failed_requests ?? 0,
104
- retryCount: 0, // API doesn't track retries separately
105
- collectedAt: new Date().toISOString(),
106
- };
42
+ return (0, stats_transformer_1.buildCliproxyStatsFromUsageResponse)(data);
107
43
  }
108
44
  catch {
109
45
  // CLIProxyAPI not running or stats endpoint not available
@@ -1 +1 @@
1
- {"version":3,"file":"stats-fet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ChC,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,OAAO;SACR,CAAC,CAAC;QAEH,YAAY,CAAC,SAAS,CAAC,CAAC;QAExB,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAvCD,oEAuCC;AAED;;;;GAIG;AACI,KAAK,UAAU,iBAAiB,CAAC,IAAa;IACnD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa;QAE3E,4BAA4B;QAC5B,MAAM,MAAM,GAAG,IAAA,sCAAc,GAAE,CAAC;QAChC,6CAA6C;QAC7C,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC3C,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QACrB,CAAC;QACD,MAAM,GAAG,GAAG,IAAA,qCAAa,EAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAEvC,kDAAkD;QAClD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAChC,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;QAEH,YAAY,CAAC,SAAS,CAAC,CAAC;QACxB,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAvBD,8CAuBC"}
@@ -0,0 +1,3 @@
1
+ import type { CliproxyStats, CliproxyUsageApiResponse } from './stats-fetcher';
2
+ export declare function buildCliproxyStatsFromUsageResponse(data: CliproxyUsageApiResponse): CliproxyStats;
3
+ //# sourceMappingURL=stats-transformer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats-transformer.d.ts","sourceRoot":"","sources":["../../src/cliproxy/stats-transformer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,aAAa,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAElG,wBAAgB,mCAAmC,CAAC,IAAI,EAAE,wBAAwB,GAAG,aAAa,CAwEjG"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildCliproxyStatsFromUsageResponse = void 0;
4
+ const account_stats_key_1 = require("./account-stats-key");
5
+ function buildCliproxyStatsFromUsageResponse(data) {
6
+ const usage = data.usage;
7
+ const requestsByModel = {};
8
+ const requestsByProvider = {};
9
+ const accountStats = {};
10
+ let totalSuccessCount = 0;
11
+ let totalFailureCount = 0;
12
+ let totalInputTokens = 0;
13
+ let totalOutputTokens = 0;
14
+ if (usage?.apis) {
15
+ for (const [provider, providerData] of Object.entries(usage.apis)) {
16
+ requestsByProvider[provider] = providerData.total_requests ?? 0;
17
+ if (!providerData.models) {
18
+ continue;
19
+ }
20
+ for (const [model, modelData] of Object.entries(providerData.models)) {
21
+ requestsByModel[model] = modelData.total_requests ?? 0;
22
+ if (!modelData.details) {
23
+ continue;
24
+ }
25
+ for (const detail of modelData.details) {
26
+ const source = detail.source || 'unknown';
27
+ const accountKey = (0, account_stats_key_1.buildQualifiedAccountStatsKey)(provider, source);
28
+ if (!accountStats[accountKey]) {
29
+ accountStats[accountKey] = {
30
+ accountKey,
31
+ provider,
32
+ source,
33
+ successCount: 0,
34
+ failureCount: 0,
35
+ totalTokens: 0,
36
+ };
37
+ }
38
+ if (detail.failed) {
39
+ accountStats[accountKey].failureCount++;
40
+ totalFailureCount++;
41
+ }
42
+ else {
43
+ accountStats[accountKey].successCount++;
44
+ totalSuccessCount++;
45
+ }
46
+ const tokens = detail.tokens?.total_tokens ?? 0;
47
+ accountStats[accountKey].totalTokens += tokens;
48
+ accountStats[accountKey].lastUsedAt = detail.timestamp;
49
+ totalInputTokens += detail.tokens?.input_tokens ?? 0;
50
+ totalOutputTokens += detail.tokens?.output_tokens ?? 0;
51
+ }
52
+ }
53
+ }
54
+ }
55
+ return {
56
+ totalRequests: usage?.total_requests ?? 0,
57
+ successCount: totalSuccessCount,
58
+ failureCount: totalFailureCount,
59
+ tokens: {
60
+ input: totalInputTokens,
61
+ output: totalOutputTokens,
62
+ total: usage?.total_tokens ?? 0,
63
+ },
64
+ requestsByModel,
65
+ requestsByProvider,
66
+ accountStats,
67
+ quotaExceededCount: usage?.failure_count ?? data.failed_requests ?? 0,
68
+ retryCount: 0,
69
+ collectedAt: new Date().toISOString(),
70
+ };
71
+ }
72
+ exports.buildCliproxyStatsFromUsageResponse = buildCliproxyStatsFromUsageResponse;
73
+ //# sourceMappingURL=stats-transformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats-transformer.js","sourceRoot":"","sources":["../../src/cliproxy/stats-transformer.ts"],"names":[],"mappings":";;;AAAA,2DAAoE;AAGpE,SAAgB,mCAAmC,CAAC,IAA8B;IAChF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACzB,MAAM,eAAe,GAA2B,EAAE,CAAC;IACnD,MAAM,kBAAkB,GAA2B,EAAE,CAAC;IACtD,MAAM,YAAY,GAAsC,EAAE,CAAC;IAC3D,IAAI,iBAAiB,GAAG,CAAC,CAAC;IAC1B,IAAI,iBAAiB,GAAG,CAAC,CAAC;IAC1B,IAAI,gBAAgB,GAAG,CAAC,CAAC;IACzB,IAAI,iBAAiB,GAAG,CAAC,CAAC;IAE1B,IAAI,KAAK,EAAE,IAAI,EAAE,CAAC;QAChB,KAAK,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YAClE,kBA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AAU,CAAC,CAAC,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC;oBACvD,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,IAAI,CAAC,CAAC;oBACrD,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,aAAa,IAAI,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,aAAa,EAAE,KAAK,EAAE,cAAc,IAAI,CAAC;QACzC,YAAY,EAAE,iBAAiB;QAC/B,YAAY,EAAE,iBAAiB;QAC/B,MAAM,EAAE;YACN,KAAK,EAAE,gBAAgB;YACvB,MAAM,EAAE,iBAAiB;YACzB,KAAK,EAAE,KAAK,EAAE,YAAY,IAAI,CAAC;SAChC;QACD,eAAe;QACf,kBAAkB;QAClB,YAAY;QACZ,kBAAkB,EAAE,KAAK,EAAE,aAAa,IAAI,IAAI,CAAC,eAAe,IAAI,CAAC;QACrE,UAAU,EAAE,CAAC;QACb,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACtC,CAAC;AACJ,CAAC;AAxED,kFAwEC"}
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as f,h as je}from"./react-vendor-CNOkPC89.js";import{u as ye,a as L,b as z,d as be,f as B,g as Ne}from"./tanstack-B8i0evp-.js";import{c as y,Y as T,a as O,ad as oe,ae as re,af as le,ag as ie,ah as de,L as P,r as Q,s as I,t as Z,v as V,w as G,I as q,as as Ce,d as u,C as S,j as D,k,_ as M,B as F,b as w,M as ue,N as xe,O as me,n as ve,x as X}from"./index-0mbI0zkd.js";import{A as Pe,a as Ae,b as Se,c as De,d as ke,e as we,f as Te,g as _e}from"./alert-dialog-Bskv1UqD.js";import{t as b}from"./notifications-B2HqRBj7.js";import{aN as Me,aO as Le,l as $,aj as ze,I as Oe,Q as Ge,n as W,aP as Fe,aq as R,aQ as Re,aR as He,r as he,aS as qe,aT as $e,U as Ee,a3 as Y,Z as J,T as Ke}from"./icons-EbXCUruD.js";import{C as ee}from"./checkbox-rsq1JHt2.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Ue({className:s,...a}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:y("w-full caption-bottom text-sm",s),...a})})}function Be({className:s,...a}){return e.jsx("thead",{"data-slot":"table-header",className:y("[&_tr]:border-b",s),...a})}function Qe({className:s,...a}){return e.jsx("tbody",{"data-slot":"table-body",className:y("[&_tr:last-child]:border-0",s),...a})}function te({className:s,...a}){return e.jsx("tr",{"data-slot":"table-row",className:y("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",s),...a})}function Ie({className:s,...a}){return e.jsx("th",{"data-slot":"table-head",className:y("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a})}function Ze({className:s,...a}){return e.jsx("td",{"data-slot":"table-cell",className:y("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a})}function Ve(){return ye({queryKey:["accounts"],queryFn:()=>T.accounts.list(),select:s=>{const a=s.accounts.filter(l=>l.type!=="cliproxy"),t=s.accounts.length-a.length,c=a.filter(l=>l.context_mode==="shared").length,o=a.filter(l=>l.context_mode==="shared"&&l.continuity_mode==="deeper").length,x=Math.max(c-o,0),i=a.length-c,m=a.filter(l=>l.context_inferred).length,g=a.filter(l=>l.context_mode==="shared"&&l.continuity_mode!=="deeper"&&l.continuity_inferred).length,p=a.some(l=>l.name===s.default)?s.default:null;return{accounts:a,default:p,cliproxyCount:t,legacyContextCount:m,legacyContinuityCount:g,sharedCount:c,sharedStandardCount:x,deeperSharedCount:o,isolatedCount:i}}})}function Xe(){const s=L();return z({mutationFn:a=>T.accounts.setDefault(a),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]}),b.success(`Default account set to "${t}"`)},onError:a=>{b.error(a.message)}})}function We(){const s=L();return z({mutationFn:()=>T.accounts.resetDefault(),onSuccess:()=>{s.invalidateQueries({queryKey:["accounts"]}),b.success("Default account reset to CCS")},onError:a=>{b.error(a.message)}})}function Ye(){const s=L();return z({mutationFn:a=>T.accounts.delete(a),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]}),b.success(`Account "${t}" deleted`)},onError:a=>{b.error(a.message)}})}function ge(){const s=L();return z({mutationFn:({name:a,context_mode:t,context_group:c,continuity_mode:o})=>T.accounts.updateContext(a,{context_mode:t,context_group:c,continuity_mode:o}),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]});const c=t.context_mode==="shared"?t.continuity_mode==="deeper"?`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, deeper continuity)`:`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, standard)`:"isolated";b.success(`Updated "${t.name}" context to ${c}`)},onError:a=>{b.error(a.message)}})}function Je(){const s=L();return z({mutationFn:async a=>{const t=a.filter(c=>c.context_inferred||c.continuity_inferred);for(const c of t){const o=c.context_mode==="shared";await T.accounts.updateContext(c.name,{context_mode:o?"shared":"isolated",context_group:o?c.context_group||"default":void 0,continuity_mode:o?c.continuity_mode==="deeper"?"deeper":"standard":void 0})}return{updatedCount:t.length}},onSuccess:({updatedCount:a})=>{if(s.invalidateQueries({queryKey:["accounts"]}),a>0){b.success(`Confirmed explicit sync mode for ${a} legacy account${a>1?"s":""}`);return}b.info("No legacy accounts need confirmation")},onError:a=>{b.error(a.message)}})}const se=64,et=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function tt({account:s,onClose:a}){const{t}=O(),c=ge(),[o,x]=f.useState(s.context_mode==="shared"?"shared":"isolated"),[i,m]=f.useState(s.context_group||"default"),[g,p]=f.useState(s.continuity_mode==="deeper"?"deeper":"standard"),l=f.useMemo(()=>i.trim().toLowerCase().replace(/\s+/g,"-"),[i]),N=l.length>0&&l.length<=se&&et.test(l),j=o==="isolated"||N,n=()=>{j&&c.mutate({name:s.name,context_mode:o,context_group:o==="shared"?l:void 0,continuity_mode:o==="shared"?g:void 0},{onSuccess:()=>{a()}})},r=d=>{d||a()};return e.jsx(oe,{open:!0,onOpenChange:r,children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(ie,{children:t("editAccountContext.title")}),e.jsx(de,{children:t("editAccountContext.description",{name:s.name})})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"context-mode",children:t("editAccountContext.syncMode")}),e.jsxs(Q,{value:o,onValueChange:d=>x(d),children:[e.jsx(I,{id:"context-mode",children:e.jsx(Z,{placeholder:t("editAccountContext.selectContextMode")})}),e.jsxs(V,{children:[e.jsx(G,{value:"isolated",children:t("editAccountContext.isolatedOption")}),e.jsx(G,{value:"shared",children:t("editAccountContext.sharedOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(o==="shared"?"editAccountContext.sharedModeHint":"editAccountContext.isolatedModeHint")})]}),o==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"context-group",children:t("editAccountContext.historySyncGroup")}),e.jsx(q,{id:"context-group",value:i,onChange:d=>m(d.target.value),placeholder:t("editAccountContext.groupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("editAccountContext.groupHint",{max:se})}),!N&&e.jsx("p",{className:"text-xs text-destructive",children:t("editAccountContext.invalidGroup")})]}),o==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"continuity-mode",children:t("editAccountContext.continuityDepth")}),e.jsxs(Q,{value:g,onValueChange:d=>p(d),children:[e.jsx(I,{id:"continuity-mode",children:e.jsx(Z,{placeholder:t("editAccountContext.selectContinuityDepth")})}),e.jsxs(V,{children:[e.jsx(G,{value:"standard",children:t("editAccountContext.standardOption")}),e.jsx(G,{value:"deeper",children:t("editAccountContext.deeperOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(g==="deeper"?"editAccountContext.deeperHint":"editAccountContext.standardHint")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("editAccountContext.credentialsIsolated")})]}),e.jsxs(Ce,{children:[e.jsx(u,{variant:"outline",onClick:a,disabled:c.isPending,children:t("editAccountContext.cancel")}),e.jsx(u,{onClick:n,disabled:!j||c.isPending,children:c.isPending?t("editAccountContext.saving"):t("editAccountContext.save")})]})]})})}function ae({data:s,defaultAccount:a}){const{t}=O(),c=Xe(),o=Ye(),x=We(),i=ge(),[m,g]=f.useState(null),[p,l]=f.useState(null),N=[{accessorKey:"name",header:t("accountsTable.name"),size:200,cell:({row:n})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n.original.name}),n.original.name===a&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:t("accountsTable.defaultBadge")})]})},{accessorKey:"type",header:t("accountsTable.type"),size:100,cell:({row:n})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:n.original.type||"oauth"})},{accessorKey:"created",header:t("accountsTable.created"),size:150,cell:({row:n})=>{const r=new Date(n.original.created);return e.jsx("span",{className:"text-muted-foreground",children:r.toLocaleDateString()})}},{accessorKey:"last_used",header:t("accountsTable.lastUsed"),size:150,cell:({row:n})=>{if(!n.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const r=new Date(n.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:r.toLocaleDateString()})}},{id:"context",header:t("accountsTable.historySync"),size:170,cell:({row:n})=>{if(n.original.type==="cliproxy")return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});if((n.original.context_mode||"isolated")==="shared"){const d=n.original.context_group||"default";return n.original.continuity_mode==="deeper"?e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.sharedGroupDeeper",{group:d})}):n.original.continuity_inferred?e.jsx("span",{className:"text-amber-700 dark:text-amber-400",children:t("accountsTable.sharedGroupLegacy",{group:d})}):e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.sharedGroupStandard",{group:d})})}return n.original.context_inferred?e.jsx("span",{className:"text-amber-700 dark:text-amber-400",children:t("accountsTable.isolatedLegacy")}):e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.isolated")})}},{id:"actions",header:t("accountsTable.actions"),size:220,cell:({row:n})=>{const r=n.original.name===a,d=c.isPending||o.isPending||i.isPending,C=n.original.type==="cliproxy",A=n.original.context_inferred||n.original.continuity_inferred;return e.jsxs("div",{className:"flex items-center gap-1",children:[!C&&e.jsxs(u,{variant:"outline",size:"sm",className:"h-8 px-2",disabled:d,onClick:()=>l(n.original),title:t("accountsTable.syncTitle"),children:[e.jsx(Me,{className:"w-3.5 h-3.5 mr-1"}),t("accountsTable.sync")]}),!C&&A&&e.jsxs(u,{variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-700 hover:text-amber-700 hover:bg-amber-500/10 dark:text-amber-400 dark:hover:text-amber-400",disabled:d,onClick:()=>i.mutate({name:n.original.name,context_mode:n.original.context_mode==="shared"?"shared":"isolated",context_group:n.original.context_mode==="shared"?n.original.context_group||"default":void 0,continuity_mode:n.original.context_mode==="shared"?n.original.continuity_mode==="deeper"?"deeper":"standard":void 0}),title:t("accountsTable.confirmLegacyTitle"),children:[e.jsx(Le,{className:"w-3 h-3 mr-1"}),t("accountsTable.confirm")]}),e.jsxs(u,{variant:r?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:r||d,onClick:()=>c.mutate(n.original.name),children:[e.jsx($,{className:`w-3 h-3 mr-1 ${r?"opacity-50":""}`}),t(r?"accountsTable.active":"accountsTable.setDefault")]}),e.jsx(u,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:r||d,onClick:()=>g(n.original.name),title:t(r?"accountsTable.cannotDeleteDefault":"accountsTable.deleteAccount"),children:e.jsx(ze,{className:"w-4 h-4"})})]})}}],j=be({data:s,columns:N,getCoreRowModel:Ne()});return s.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:t("accountsTable.noAccounts")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border rounded-md",children:e.jsxs(Ue,{children:[e.jsx(Be,{children:j.getHeaderGroups().map(n=>e.jsx(te,{children:n.headers.map(r=>{const d={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",context:"w-[170px]",actions:"w-[290px]"}[r.id]||"w-auto";return e.jsx(Ie,{className:d,children:r.isPlaceholder?null:B(r.column.columnDef.header,r.getContext())},r.id)})},n.id))}),e.jsx(Qe,{children:j.getRowModel().rows.map(n=>e.jsx(te,{children:n.getVisibleCells().map(r=>e.jsx(Ze,{children:B(r.column.columnDef.cell,r.getContext())},r.id))},n.id))})]})}),a&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(u,{variant:"outline",size:"sm",onClick:()=>x.mutate(),disabled:x.isPending,children:[e.jsx(Oe,{className:"w-4 h-4 mr-2"}),t("accountsTable.resetToDefault")]})})]}),p&&e.jsx(tt,{account:p,onClose:()=>l(null)}),e.jsx(Pe,{open:!!m,onOpenChange:n=>!n&&g(null),children:e.jsxs(Ae,{children:[e.jsxs(Se,{children:[e.jsx(De,{children:t("accountsTable.deleteDialogTitle")}),e.jsx(ke,{children:t("accountsTable.deleteDialogDesc",{name:m??""})})]}),e.jsxs(we,{children:[e.jsx(Te,{children:t("accountsTable.cancel")}),e.jsx(_e,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{m&&(o.mutate(m),g(null))},children:t("accountsTable.delete")})]})]})})]})}const ne=64;function st({open:s,onClose:a}){const{t}=O(),[c,o]=f.useState(""),[x,i]=f.useState(!1),[m,g]=f.useState(""),[p,l]=f.useState(!1),[N,j]=f.useState(!1),n=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(c),r=m.trim().toLowerCase().replace(/\s+/g,"-"),d=r.length===0||r.length<=ne&&/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(r),C=c&&n?[`ccs auth create ${c}`,x?r.length>0?`--context-group ${r}`:"--share-context":"",x&&p?"--deeper-continuity":""].filter(Boolean).join(" "):t("createAuthProfileDialog.commandFallback"),A=async()=>{!n||x&&!d||(await navigator.clipboard.writeText(C),j(!0),setTimeout(()=>j(!1),2e3))},_=()=>{o(""),i(!1),g(""),l(!1),j(!1),a()};return e.jsx(oe,{open:s,onOpenChange:h=>!h&&_(),children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(ie,{children:t("createAuthProfileDialog.title")}),e.jsx(de,{children:t("createAuthProfileDialog.description")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"profile-name",children:t("createAuthProfileDialog.profileName")}),e.jsx(q,{id:"profile-name",value:c,onChange:h=>o(h.target.value),placeholder:t("createAuthProfileDialog.profileNamePlaceholder"),autoComplete:"off"}),c&&!n&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidProfileName")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{id:"share-context",checked:x,onCheckedChange:h=>i(h===!0)}),e.jsx(P,{htmlFor:"share-context",className:"cursor-pointer",children:t("createAuthProfileDialog.enableSharedHistory")})]}),x&&e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx(P,{htmlFor:"context-group",children:t("createAuthProfileDialog.historySyncGroupOptional")}),e.jsx(q,{id:"context-group",value:m,onChange:h=>g(h.target.value),placeholder:t("createAuthProfileDialog.historySyncGroupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.historySyncGroupHint")}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx(ee,{id:"deeper-continuity",checked:p,onCheckedChange:h=>l(h===!0)}),e.jsx(P,{htmlFor:"deeper-continuity",className:"cursor-pointer",children:t("createAuthProfileDialog.deeperContinuity")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.deeperContinuityHint")}),m.trim().length>0&&!d&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidContextGroup",{max:ne})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{children:t("createAuthProfileDialog.command")}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(Ge,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:C}),e.jsx(u,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:A,disabled:!n||x&&!d,children:N?e.jsx($,{className:"w-4 h-4 text-green-500"}):e.jsx(W,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:t("createAuthProfileDialog.afterRunPrefix")}),e.jsxs("ol",{className:"list-decimal list-inside pl-2 space-y-0.5",children:[e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep1")}),e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep2")})]}),e.jsx("p",{className:"pt-1",children:t("createAuthProfileDialog.poolingHint")})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{variant:"ghost",onClick:_,children:t("createAuthProfileDialog.close")}),e.jsx(u,{onClick:A,disabled:!n||x&&!d,children:N?e.jsxs(e.Fragment,{children:[e.jsx($,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copyCommand")]})})]})]})]})})}function H({title:s,count:a,icon:t,tone:c}){const o={isolated:{border:"border-blue-300/60 bg-blue-50/40 dark:border-blue-900/40 dark:bg-blue-900/10",icon:"text-blue-700 dark:text-blue-400",count:"text-blue-700 dark:text-blue-400"},shared:{border:"border-emerald-300/60 bg-emerald-50/40 dark:border-emerald-900/40 dark:bg-emerald-900/10",icon:"text-emerald-700 dark:text-emerald-400",count:"text-emerald-700 dark:text-emerald-400"},deeper:{border:"border-indigo-300/60 bg-indigo-50/40 dark:border-indigo-900/40 dark:bg-indigo-900/10",icon:"text-indigo-700 dark:text-indigo-400",count:"text-indigo-700 dark:text-indigo-400"}};return e.jsxs("div",{className:y("rounded-md border p-2.5",o[c].border),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs font-semibold",children:s}),e.jsx(t,{className:y("h-3.5 w-3.5",o[c].icon)})]}),e.jsx("p",{className:y("mt-1 text-lg font-mono font-semibold",o[c].count),children:a})]})}function ce({isolatedCount:s,sharedStandardCount:a,deeperSharedCount:t,sharedGroups:c,legacyTargetCount:o,cliproxyCount:x}){const{t:i}=O(),[m,g]=f.useState(!1),p=c.length>0?c:["default"];return e.jsxs(S,{className:"border-dashed",children:[e.jsx(D,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-base",children:i("historySyncLearningMap.title")}),e.jsx(M,{className:"mt-1",children:i("historySyncLearningMap.description")})]}),e.jsx(F,{variant:"outline",children:i("historySyncLearningMap.learningMap")})]})}),e.jsxs(w,{className:"space-y-3",children:[x>0&&e.jsx("div",{className:"rounded-md border border-blue-300/60 bg-blue-50/40 px-3 py-2 text-xs text-blue-800 dark:border-blue-900/40 dark:bg-blue-900/10 dark:text-blue-300",children:i("historySyncLearningMap.cliproxyManaged",{count:x})}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto_1fr_auto_1fr] sm:items-center",children:[e.jsx(H,{title:i("historySyncLearningMap.isolated"),count:s,icon:Fe,tone:"isolated"}),e.jsx("div",{className:"hidden sm:flex justify-center text-muted-foreground",children:e.jsx(R,{className:"h-4 w-4"})}),e.jsx(H,{title:i("historySyncLearningMap.shared"),count:a,icon:Re,tone:"shared"}),e.jsx("div",{className:"hidden sm:flex justify-center text-muted-foreground",children:e.jsx(R,{className:"h-4 w-4"})}),e.jsx(H,{title:i("historySyncLearningMap.deeper"),count:t,icon:He,tone:"deeper"})]}),e.jsxs(ue,{open:m,onOpenChange:g,children:[e.jsx(xe,{asChild:!0,children:e.jsxs(u,{variant:"ghost",className:"h-8 w-full justify-between rounded-md px-2 text-xs text-muted-foreground hover:bg-muted/40 hover:text-foreground",children:[e.jsx("span",{children:i("historySyncLearningMap.showDetails")}),e.jsx(he,{className:y("h-4 w-4 transition-transform",m&&"rotate-180")})]})}),e.jsxs(me,{className:"pt-2",children:[e.jsxs("div",{className:"grid gap-2 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:i("historySyncLearningMap.modeSwitch")})]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:i("historySyncLearningMap.modeSwitchDesc")})]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:i("historySyncLearningMap.historySyncGroup")})]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:i("historySyncLearningMap.historySyncGroupDesc")}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:p.map(l=>e.jsx(F,{variant:"outline",className:"font-mono text-[10px]",children:l},l))})]})]}),o>0&&e.jsx("div",{className:"mt-2 rounded-md border border-amber-500/50 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-300",children:i("historySyncLearningMap.legacyConfirmation",{count:o})})]})]})]})]})}function ht(){const{t:s}=O(),a=je(),{data:t,isLoading:c}=Ve(),o=Je(),[x,i]=f.useState(!1),[m,g]=f.useState(!1),p=t?.accounts||[],l=t?.cliproxyCount||0,N=t?.legacyContextCount||0,j=t?.legacyContinuityCount||0,n=t?.sharedCount||0,r=t?.sharedStandardCount||0,d=t?.deeperSharedCount||0,C=t?.isolatedCount||0,A=Array.from(new Set(p.filter(v=>v.context_mode==="shared").map(v=>v.context_group||"default"))).sort((v,fe)=>v.localeCompare(fe)),_=p.filter(v=>v.context_inferred||v.continuity_inferred),h=_.length,pe=h>0,E=()=>a("/cliproxy?provider=claude"),K=()=>a("/cliproxy?provider=claude&action=auth"),U=()=>o.mutate(_);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden h-full min-h-0 lg:flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/20 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("accountsPage.title")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.manageSuffix")]})]}),e.jsx(ve,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.primaryActions")}),e.jsxs(u,{size:"sm",className:"w-full justify-start",onClick:()=>i(!0),children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(u,{size:"sm",className:"w-full justify-start",onClick:K,children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),s("accountsPage.authClaudeInPool")]}),e.jsxs(u,{variant:"outline",size:"sm",className:"w-full justify-start",onClick:E,children:[s("accountsPage.openClaudePoolSettings"),e.jsx(R,{className:"w-4 h-4 ml-auto"})]})]}),pe?e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.migrationFollowup")}),e.jsxs("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ke,{className:"h-4 w-4 mt-0.5 text-amber-700 dark:text-amber-400 shrink-0"}),e.jsxs("div",{className:"space-y-1 text-xs",children:[N>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContextPending",{count:N})}),j>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContinuityPending",{count:j})})]})]}),e.jsx(u,{variant:"secondary",size:"sm",className:"w-full justify-start",onClick:U,disabled:o.isPending||h===0,children:o.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:h})})]})]}):e.jsx("div",{className:"rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground",children:s("accountsPage.noLegacyFollowup")}),e.jsx(ue,{open:m,onOpenChange:g,children:e.jsxs(S,{children:[e.jsx(D,{className:"pb-2",children:e.jsx(xe,{asChild:!0,children:e.jsxs(u,{variant:"ghost",className:"h-auto w-full justify-between px-0 py-0",children:[e.jsxs("div",{className:"text-left",children:[e.jsx(k,{className:"text-sm",children:s("accountsPage.continuityGuide")}),e.jsx(M,{className:"mt-1",children:s("accountsPage.expandWhenNeeded")})]}),e.jsx(he,{className:y("h-4 w-4 transition-transform",m&&"rotate-180")})]})})}),e.jsx(me,{children:e.jsxs(w,{className:"space-y-3 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.sharedStandard")}),e.jsx("p",{className:"mt-1",children:s("accountsPage.sharedStandardDesc")})]}),e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.sharedDeeper")}),e.jsxs("p",{className:"mt-1",children:[s("accountsPage.sharedDeeperPrefix")," ",e.jsx("code",{children:"session-env"}),","," ",e.jsx("code",{children:"file-history"}),", ",e.jsx("code",{children:"shell-snapshots"}),","," ",e.jsx("code",{children:"todos"}),"."]})]}),e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.isolated")}),e.jsx("p",{className:"mt-1",children:s("accountsPage.isolatedDesc")})]})]})})]})}),e.jsxs(S,{children:[e.jsxs(D,{className:"pb-2",children:[e.jsx(k,{className:"text-sm",children:s("accountsPage.quickCommands")}),e.jsx(M,{children:s("accountsPage.quickCommandsDesc")})]}),e.jsxs(w,{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth create work --context-group sprint-a --deeper-continuity"}),e.jsx(X,{value:"ccs auth create work --context-group sprint-a --deeper-continuity",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs cliproxy auth claude"}),e.jsx(X,{value:"ccs cliproxy auth claude",size:"icon"})]})]})]})]})})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col bg-background",children:[e.jsxs("div",{className:"px-5 py-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{variant:"outline",children:s("accountsPage.workspaceBadge")}),e.jsx(F,{variant:"secondary",children:s("accountsPage.historySyncBadge")})]}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:s("accountsPage.authAccounts")}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[s("accountsPage.tableScopePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.tableScopeMiddle"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:s("accountsTable.sync")}),s("accountsPage.tableScopeSuffix")]})]}),e.jsxs("div",{className:"flex-1 min-h-0 p-5 space-y-4 overflow-y-auto",children:[e.jsx(ce,{isolatedCount:C,sharedStandardCount:r,deeperSharedCount:d,sharedGroups:A,legacyTargetCount:h,cliproxyCount:l}),e.jsxs(S,{className:"flex flex-col",children:[e.jsxs(D,{className:"pb-3",children:[e.jsx(k,{className:"text-lg",children:s("accountsPage.accountMatrix")}),e.jsx(M,{children:s("accountsPage.sharedTotalDesc",{count:n})})]}),e.jsx(w,{children:c?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ae,{data:p,defaultAccount:t?.default??null})})]})]})]})]}),e.jsxs("div",{className:"p-4 space-y-4 lg:hidden",children:[e.jsxs(S,{children:[e.jsxs(D,{children:[e.jsx(k,{className:"text-lg",children:s("accountsPage.title")}),e.jsxs(M,{children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.mobileManageSuffix")]})]}),e.jsxs(w,{className:"space-y-2",children:[e.jsxs(u,{className:"w-full",onClick:()=>i(!0),children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(u,{variant:"outline",className:"w-full",onClick:E,children:[s("accountsPage.openCliProxyClaudePool"),e.jsx(R,{className:"w-4 h-4 ml-2"})]}),e.jsxs(u,{variant:"outline",className:"w-full",onClick:K,children:[s("accountsPage.authClaudeInPool"),e.jsx(J,{className:"w-4 h-4 ml-2"})]}),e.jsx(u,{variant:"outline",className:"w-full",onClick:U,disabled:o.isPending||h===0,children:o.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:h})})]})]}),e.jsx(ce,{isolatedCount:C,sharedStandardCount:r,deeperSharedCount:d,sharedGroups:A,legacyTargetCount:h,cliproxyCount:l}),e.jsxs(S,{children:[e.jsx(D,{className:"pb-3",children:e.jsx(k,{className:"text-base",children:s("accountsPage.accountMatrix")})}),e.jsx(w,{children:c?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ae,{data:p,defaultAccount:t?.default??null})})]})]}),e.jsx(st,{open:x,onClose:()=>i(!1)})]})}export{ht as AccountsPage};
1
+ import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as f,h as je}from"./react-vendor-CNOkPC89.js";import{u as ye,a as L,b as z,d as be,f as B,g as Ne}from"./tanstack-B8i0evp-.js";import{c as y,Y as T,a as O,ad as oe,ae as re,af as le,ag as ie,ah as de,L as P,r as Q,s as I,t as Z,v as V,w as G,I as q,as as Ce,d as u,C as S,j as D,k,_ as M,B as F,b as w,M as ue,N as xe,O as me,n as ve,x as X}from"./index-D_BsksCe.js";import{A as Pe,a as Ae,b as Se,c as De,d as ke,e as we,f as Te,g as _e}from"./alert-dialog-B8EI9gra.js";import{t as b}from"./notifications-B2HqRBj7.js";import{aN as Me,aO as Le,l as $,aj as ze,I as Oe,Q as Ge,n as W,aP as Fe,aq as R,aQ as Re,aR as He,r as he,aS as qe,aT as $e,U as Ee,a3 as Y,Z as J,T as Ke}from"./icons-EbXCUruD.js";import{C as ee}from"./checkbox-DYYN1zJe.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Ue({className:s,...a}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:y("w-full caption-bottom text-sm",s),...a})})}function Be({className:s,...a}){return e.jsx("thead",{"data-slot":"table-header",className:y("[&_tr]:border-b",s),...a})}function Qe({className:s,...a}){return e.jsx("tbody",{"data-slot":"table-body",className:y("[&_tr:last-child]:border-0",s),...a})}function te({className:s,...a}){return e.jsx("tr",{"data-slot":"table-row",className:y("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",s),...a})}function Ie({className:s,...a}){return e.jsx("th",{"data-slot":"table-head",className:y("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a})}function Ze({className:s,...a}){return e.jsx("td",{"data-slot":"table-cell",className:y("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a})}function Ve(){return ye({queryKey:["accounts"],queryFn:()=>T.accounts.list(),select:s=>{const a=s.accounts.filter(l=>l.type!=="cliproxy"),t=s.accounts.length-a.length,c=a.filter(l=>l.context_mode==="shared").length,o=a.filter(l=>l.context_mode==="shared"&&l.continuity_mode==="deeper").length,x=Math.max(c-o,0),i=a.length-c,m=a.filter(l=>l.context_inferred).length,g=a.filter(l=>l.context_mode==="shared"&&l.continuity_mode!=="deeper"&&l.continuity_inferred).length,p=a.some(l=>l.name===s.default)?s.default:null;return{accounts:a,default:p,cliproxyCount:t,legacyContextCount:m,legacyContinuityCount:g,sharedCount:c,sharedStandardCount:x,deeperSharedCount:o,isolatedCount:i}}})}function Xe(){const s=L();return z({mutationFn:a=>T.accounts.setDefault(a),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]}),b.success(`Default account set to "${t}"`)},onError:a=>{b.error(a.message)}})}function We(){const s=L();return z({mutationFn:()=>T.accounts.resetDefault(),onSuccess:()=>{s.invalidateQueries({queryKey:["accounts"]}),b.success("Default account reset to CCS")},onError:a=>{b.error(a.message)}})}function Ye(){const s=L();return z({mutationFn:a=>T.accounts.delete(a),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]}),b.success(`Account "${t}" deleted`)},onError:a=>{b.error(a.message)}})}function ge(){const s=L();return z({mutationFn:({name:a,context_mode:t,context_group:c,continuity_mode:o})=>T.accounts.updateContext(a,{context_mode:t,context_group:c,continuity_mode:o}),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]});const c=t.context_mode==="shared"?t.continuity_mode==="deeper"?`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, deeper continuity)`:`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, standard)`:"isolated";b.success(`Updated "${t.name}" context to ${c}`)},onError:a=>{b.error(a.message)}})}function Je(){const s=L();return z({mutationFn:async a=>{const t=a.filter(c=>c.context_inferred||c.continuity_inferred);for(const c of t){const o=c.context_mode==="shared";await T.accounts.updateContext(c.name,{context_mode:o?"shared":"isolated",context_group:o?c.context_group||"default":void 0,continuity_mode:o?c.continuity_mode==="deeper"?"deeper":"standard":void 0})}return{updatedCount:t.length}},onSuccess:({updatedCount:a})=>{if(s.invalidateQueries({queryKey:["accounts"]}),a>0){b.success(`Confirmed explicit sync mode for ${a} legacy account${a>1?"s":""}`);return}b.info("No legacy accounts need confirmation")},onError:a=>{b.error(a.message)}})}const se=64,et=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function tt({account:s,onClose:a}){const{t}=O(),c=ge(),[o,x]=f.useState(s.context_mode==="shared"?"shared":"isolated"),[i,m]=f.useState(s.context_group||"default"),[g,p]=f.useState(s.continuity_mode==="deeper"?"deeper":"standard"),l=f.useMemo(()=>i.trim().toLowerCase().replace(/\s+/g,"-"),[i]),N=l.length>0&&l.length<=se&&et.test(l),j=o==="isolated"||N,n=()=>{j&&c.mutate({name:s.name,context_mode:o,context_group:o==="shared"?l:void 0,continuity_mode:o==="shared"?g:void 0},{onSuccess:()=>{a()}})},r=d=>{d||a()};return e.jsx(oe,{open:!0,onOpenChange:r,children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(ie,{children:t("editAccountContext.title")}),e.jsx(de,{children:t("editAccountContext.description",{name:s.name})})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"context-mode",children:t("editAccountContext.syncMode")}),e.jsxs(Q,{value:o,onValueChange:d=>x(d),children:[e.jsx(I,{id:"context-mode",children:e.jsx(Z,{placeholder:t("editAccountContext.selectContextMode")})}),e.jsxs(V,{children:[e.jsx(G,{value:"isolated",children:t("editAccountContext.isolatedOption")}),e.jsx(G,{value:"shared",children:t("editAccountContext.sharedOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(o==="shared"?"editAccountContext.sharedModeHint":"editAccountContext.isolatedModeHint")})]}),o==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"context-group",children:t("editAccountContext.historySyncGroup")}),e.jsx(q,{id:"context-group",value:i,onChange:d=>m(d.target.value),placeholder:t("editAccountContext.groupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("editAccountContext.groupHint",{max:se})}),!N&&e.jsx("p",{className:"text-xs text-destructive",children:t("editAccountContext.invalidGroup")})]}),o==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"continuity-mode",children:t("editAccountContext.continuityDepth")}),e.jsxs(Q,{value:g,onValueChange:d=>p(d),children:[e.jsx(I,{id:"continuity-mode",children:e.jsx(Z,{placeholder:t("editAccountContext.selectContinuityDepth")})}),e.jsxs(V,{children:[e.jsx(G,{value:"standard",children:t("editAccountContext.standardOption")}),e.jsx(G,{value:"deeper",children:t("editAccountContext.deeperOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(g==="deeper"?"editAccountContext.deeperHint":"editAccountContext.standardHint")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("editAccountContext.credentialsIsolated")})]}),e.jsxs(Ce,{children:[e.jsx(u,{variant:"outline",onClick:a,disabled:c.isPending,children:t("editAccountContext.cancel")}),e.jsx(u,{onClick:n,disabled:!j||c.isPending,children:c.isPending?t("editAccountContext.saving"):t("editAccountContext.save")})]})]})})}function ae({data:s,defaultAccount:a}){const{t}=O(),c=Xe(),o=Ye(),x=We(),i=ge(),[m,g]=f.useState(null),[p,l]=f.useState(null),N=[{accessorKey:"name",header:t("accountsTable.name"),size:200,cell:({row:n})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n.original.name}),n.original.name===a&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:t("accountsTable.defaultBadge")})]})},{accessorKey:"type",header:t("accountsTable.type"),size:100,cell:({row:n})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:n.original.type||"oauth"})},{accessorKey:"created",header:t("accountsTable.created"),size:150,cell:({row:n})=>{const r=new Date(n.original.created);return e.jsx("span",{className:"text-muted-foreground",children:r.toLocaleDateString()})}},{accessorKey:"last_used",header:t("accountsTable.lastUsed"),size:150,cell:({row:n})=>{if(!n.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const r=new Date(n.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:r.toLocaleDateString()})}},{id:"context",header:t("accountsTable.historySync"),size:170,cell:({row:n})=>{if(n.original.type==="cliproxy")return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});if((n.original.context_mode||"isolated")==="shared"){const d=n.original.context_group||"default";return n.original.continuity_mode==="deeper"?e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.sharedGroupDeeper",{group:d})}):n.original.continuity_inferred?e.jsx("span",{className:"text-amber-700 dark:text-amber-400",children:t("accountsTable.sharedGroupLegacy",{group:d})}):e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.sharedGroupStandard",{group:d})})}return n.original.context_inferred?e.jsx("span",{className:"text-amber-700 dark:text-amber-400",children:t("accountsTable.isolatedLegacy")}):e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.isolated")})}},{id:"actions",header:t("accountsTable.actions"),size:220,cell:({row:n})=>{const r=n.original.name===a,d=c.isPending||o.isPending||i.isPending,C=n.original.type==="cliproxy",A=n.original.context_inferred||n.original.continuity_inferred;return e.jsxs("div",{className:"flex items-center gap-1",children:[!C&&e.jsxs(u,{variant:"outline",size:"sm",className:"h-8 px-2",disabled:d,onClick:()=>l(n.original),title:t("accountsTable.syncTitle"),children:[e.jsx(Me,{className:"w-3.5 h-3.5 mr-1"}),t("accountsTable.sync")]}),!C&&A&&e.jsxs(u,{variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-700 hover:text-amber-700 hover:bg-amber-500/10 dark:text-amber-400 dark:hover:text-amber-400",disabled:d,onClick:()=>i.mutate({name:n.original.name,context_mode:n.original.context_mode==="shared"?"shared":"isolated",context_group:n.original.context_mode==="shared"?n.original.context_group||"default":void 0,continuity_mode:n.original.context_mode==="shared"?n.original.continuity_mode==="deeper"?"deeper":"standard":void 0}),title:t("accountsTable.confirmLegacyTitle"),children:[e.jsx(Le,{className:"w-3 h-3 mr-1"}),t("accountsTable.confirm")]}),e.jsxs(u,{variant:r?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:r||d,onClick:()=>c.mutate(n.original.name),children:[e.jsx($,{className:`w-3 h-3 mr-1 ${r?"opacity-50":""}`}),t(r?"accountsTable.active":"accountsTable.setDefault")]}),e.jsx(u,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:r||d,onClick:()=>g(n.original.name),title:t(r?"accountsTable.cannotDeleteDefault":"accountsTable.deleteAccount"),children:e.jsx(ze,{className:"w-4 h-4"})})]})}}],j=be({data:s,columns:N,getCoreRowModel:Ne()});return s.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:t("accountsTable.noAccounts")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border rounded-md",children:e.jsxs(Ue,{children:[e.jsx(Be,{children:j.getHeaderGroups().map(n=>e.jsx(te,{children:n.headers.map(r=>{const d={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",context:"w-[170px]",actions:"w-[290px]"}[r.id]||"w-auto";return e.jsx(Ie,{className:d,children:r.isPlaceholder?null:B(r.column.columnDef.header,r.getContext())},r.id)})},n.id))}),e.jsx(Qe,{children:j.getRowModel().rows.map(n=>e.jsx(te,{children:n.getVisibleCells().map(r=>e.jsx(Ze,{children:B(r.column.columnDef.cell,r.getContext())},r.id))},n.id))})]})}),a&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(u,{variant:"outline",size:"sm",onClick:()=>x.mutate(),disabled:x.isPending,children:[e.jsx(Oe,{className:"w-4 h-4 mr-2"}),t("accountsTable.resetToDefault")]})})]}),p&&e.jsx(tt,{account:p,onClose:()=>l(null)}),e.jsx(Pe,{open:!!m,onOpenChange:n=>!n&&g(null),children:e.jsxs(Ae,{children:[e.jsxs(Se,{children:[e.jsx(De,{children:t("accountsTable.deleteDialogTitle")}),e.jsx(ke,{children:t("accountsTable.deleteDialogDesc",{name:m??""})})]}),e.jsxs(we,{children:[e.jsx(Te,{children:t("accountsTable.cancel")}),e.jsx(_e,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{m&&(o.mutate(m),g(null))},children:t("accountsTable.delete")})]})]})})]})}const ne=64;function st({open:s,onClose:a}){const{t}=O(),[c,o]=f.useState(""),[x,i]=f.useState(!1),[m,g]=f.useState(""),[p,l]=f.useState(!1),[N,j]=f.useState(!1),n=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(c),r=m.trim().toLowerCase().replace(/\s+/g,"-"),d=r.length===0||r.length<=ne&&/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(r),C=c&&n?[`ccs auth create ${c}`,x?r.length>0?`--context-group ${r}`:"--share-context":"",x&&p?"--deeper-continuity":""].filter(Boolean).join(" "):t("createAuthProfileDialog.commandFallback"),A=async()=>{!n||x&&!d||(await navigator.clipboard.writeText(C),j(!0),setTimeout(()=>j(!1),2e3))},_=()=>{o(""),i(!1),g(""),l(!1),j(!1),a()};return e.jsx(oe,{open:s,onOpenChange:h=>!h&&_(),children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(ie,{children:t("createAuthProfileDialog.title")}),e.jsx(de,{children:t("createAuthProfileDialog.description")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"profile-name",children:t("createAuthProfileDialog.profileName")}),e.jsx(q,{id:"profile-name",value:c,onChange:h=>o(h.target.value),placeholder:t("createAuthProfileDialog.profileNamePlaceholder"),autoComplete:"off"}),c&&!n&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidProfileName")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{id:"share-context",checked:x,onCheckedChange:h=>i(h===!0)}),e.jsx(P,{htmlFor:"share-context",className:"cursor-pointer",children:t("createAuthProfileDialog.enableSharedHistory")})]}),x&&e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx(P,{htmlFor:"context-group",children:t("createAuthProfileDialog.historySyncGroupOptional")}),e.jsx(q,{id:"context-group",value:m,onChange:h=>g(h.target.value),placeholder:t("createAuthProfileDialog.historySyncGroupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.historySyncGroupHint")}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx(ee,{id:"deeper-continuity",checked:p,onCheckedChange:h=>l(h===!0)}),e.jsx(P,{htmlFor:"deeper-continuity",className:"cursor-pointer",children:t("createAuthProfileDialog.deeperContinuity")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.deeperContinuityHint")}),m.trim().length>0&&!d&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidContextGroup",{max:ne})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{children:t("createAuthProfileDialog.command")}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(Ge,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:C}),e.jsx(u,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:A,disabled:!n||x&&!d,children:N?e.jsx($,{className:"w-4 h-4 text-green-500"}):e.jsx(W,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:t("createAuthProfileDialog.afterRunPrefix")}),e.jsxs("ol",{className:"list-decimal list-inside pl-2 space-y-0.5",children:[e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep1")}),e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep2")})]}),e.jsx("p",{className:"pt-1",children:t("createAuthProfileDialog.poolingHint")})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{variant:"ghost",onClick:_,children:t("createAuthProfileDialog.close")}),e.jsx(u,{onClick:A,disabled:!n||x&&!d,children:N?e.jsxs(e.Fragment,{children:[e.jsx($,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copyCommand")]})})]})]})]})})}function H({title:s,count:a,icon:t,tone:c}){const o={isolated:{border:"border-blue-300/60 bg-blue-50/40 dark:border-blue-900/40 dark:bg-blue-900/10",icon:"text-blue-700 dark:text-blue-400",count:"text-blue-700 dark:text-blue-400"},shared:{border:"border-emerald-300/60 bg-emerald-50/40 dark:border-emerald-900/40 dark:bg-emerald-900/10",icon:"text-emerald-700 dark:text-emerald-400",count:"text-emerald-700 dark:text-emerald-400"},deeper:{border:"border-indigo-300/60 bg-indigo-50/40 dark:border-indigo-900/40 dark:bg-indigo-900/10",icon:"text-indigo-700 dark:text-indigo-400",count:"text-indigo-700 dark:text-indigo-400"}};return e.jsxs("div",{className:y("rounded-md border p-2.5",o[c].border),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs font-semibold",children:s}),e.jsx(t,{className:y("h-3.5 w-3.5",o[c].icon)})]}),e.jsx("p",{className:y("mt-1 text-lg font-mono font-semibold",o[c].count),children:a})]})}function ce({isolatedCount:s,sharedStandardCount:a,deeperSharedCount:t,sharedGroups:c,legacyTargetCount:o,cliproxyCount:x}){const{t:i}=O(),[m,g]=f.useState(!1),p=c.length>0?c:["default"];return e.jsxs(S,{className:"border-dashed",children:[e.jsx(D,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-base",children:i("historySyncLearningMap.title")}),e.jsx(M,{className:"mt-1",children:i("historySyncLearningMap.description")})]}),e.jsx(F,{variant:"outline",children:i("historySyncLearningMap.learningMap")})]})}),e.jsxs(w,{className:"space-y-3",children:[x>0&&e.jsx("div",{className:"rounded-md border border-blue-300/60 bg-blue-50/40 px-3 py-2 text-xs text-blue-800 dark:border-blue-900/40 dark:bg-blue-900/10 dark:text-blue-300",children:i("historySyncLearningMap.cliproxyManaged",{count:x})}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto_1fr_auto_1fr] sm:items-center",children:[e.jsx(H,{title:i("historySyncLearningMap.isolated"),count:s,icon:Fe,tone:"isolated"}),e.jsx("div",{className:"hidden sm:flex justify-center text-muted-foreground",children:e.jsx(R,{className:"h-4 w-4"})}),e.jsx(H,{title:i("historySyncLearningMap.shared"),count:a,icon:Re,tone:"shared"}),e.jsx("div",{className:"hidden sm:flex justify-center text-muted-foreground",children:e.jsx(R,{className:"h-4 w-4"})}),e.jsx(H,{title:i("historySyncLearningMap.deeper"),count:t,icon:He,tone:"deeper"})]}),e.jsxs(ue,{open:m,onOpenChange:g,children:[e.jsx(xe,{asChild:!0,children:e.jsxs(u,{variant:"ghost",className:"h-8 w-full justify-between rounded-md px-2 text-xs text-muted-foreground hover:bg-muted/40 hover:text-foreground",children:[e.jsx("span",{children:i("historySyncLearningMap.showDetails")}),e.jsx(he,{className:y("h-4 w-4 transition-transform",m&&"rotate-180")})]})}),e.jsxs(me,{className:"pt-2",children:[e.jsxs("div",{className:"grid gap-2 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:i("historySyncLearningMap.modeSwitch")})]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:i("historySyncLearningMap.modeSwitchDesc")})]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:i("historySyncLearningMap.historySyncGroup")})]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:i("historySyncLearningMap.historySyncGroupDesc")}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:p.map(l=>e.jsx(F,{variant:"outline",className:"font-mono text-[10px]",children:l},l))})]})]}),o>0&&e.jsx("div",{className:"mt-2 rounded-md border border-amber-500/50 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-300",children:i("historySyncLearningMap.legacyConfirmation",{count:o})})]})]})]})]})}function ht(){const{t:s}=O(),a=je(),{data:t,isLoading:c}=Ve(),o=Je(),[x,i]=f.useState(!1),[m,g]=f.useState(!1),p=t?.accounts||[],l=t?.cliproxyCount||0,N=t?.legacyContextCount||0,j=t?.legacyContinuityCount||0,n=t?.sharedCount||0,r=t?.sharedStandardCount||0,d=t?.deeperSharedCount||0,C=t?.isolatedCount||0,A=Array.from(new Set(p.filter(v=>v.context_mode==="shared").map(v=>v.context_group||"default"))).sort((v,fe)=>v.localeCompare(fe)),_=p.filter(v=>v.context_inferred||v.continuity_inferred),h=_.length,pe=h>0,E=()=>a("/cliproxy?provider=claude"),K=()=>a("/cliproxy?provider=claude&action=auth"),U=()=>o.mutate(_);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden h-full min-h-0 lg:flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/20 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("accountsPage.title")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.manageSuffix")]})]}),e.jsx(ve,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.primaryActions")}),e.jsxs(u,{size:"sm",className:"w-full justify-start",onClick:()=>i(!0),children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(u,{size:"sm",className:"w-full justify-start",onClick:K,children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),s("accountsPage.authClaudeInPool")]}),e.jsxs(u,{variant:"outline",size:"sm",className:"w-full justify-start",onClick:E,children:[s("accountsPage.openClaudePoolSettings"),e.jsx(R,{className:"w-4 h-4 ml-auto"})]})]}),pe?e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.migrationFollowup")}),e.jsxs("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ke,{className:"h-4 w-4 mt-0.5 text-amber-700 dark:text-amber-400 shrink-0"}),e.jsxs("div",{className:"space-y-1 text-xs",children:[N>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContextPending",{count:N})}),j>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContinuityPending",{count:j})})]})]}),e.jsx(u,{variant:"secondary",size:"sm",className:"w-full justify-start",onClick:U,disabled:o.isPending||h===0,children:o.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:h})})]})]}):e.jsx("div",{className:"rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground",children:s("accountsPage.noLegacyFollowup")}),e.jsx(ue,{open:m,onOpenChange:g,children:e.jsxs(S,{children:[e.jsx(D,{className:"pb-2",children:e.jsx(xe,{asChild:!0,children:e.jsxs(u,{variant:"ghost",className:"h-auto w-full justify-between px-0 py-0",children:[e.jsxs("div",{className:"text-left",children:[e.jsx(k,{className:"text-sm",children:s("accountsPage.continuityGuide")}),e.jsx(M,{className:"mt-1",children:s("accountsPage.expandWhenNeeded")})]}),e.jsx(he,{className:y("h-4 w-4 transition-transform",m&&"rotate-180")})]})})}),e.jsx(me,{children:e.jsxs(w,{className:"space-y-3 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.sharedStandard")}),e.jsx("p",{className:"mt-1",children:s("accountsPage.sharedStandardDesc")})]}),e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.sharedDeeper")}),e.jsxs("p",{className:"mt-1",children:[s("accountsPage.sharedDeeperPrefix")," ",e.jsx("code",{children:"session-env"}),","," ",e.jsx("code",{children:"file-history"}),", ",e.jsx("code",{children:"shell-snapshots"}),","," ",e.jsx("code",{children:"todos"}),"."]})]}),e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.isolated")}),e.jsx("p",{className:"mt-1",children:s("accountsPage.isolatedDesc")})]})]})})]})}),e.jsxs(S,{children:[e.jsxs(D,{className:"pb-2",children:[e.jsx(k,{className:"text-sm",children:s("accountsPage.quickCommands")}),e.jsx(M,{children:s("accountsPage.quickCommandsDesc")})]}),e.jsxs(w,{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth create work --context-group sprint-a --deeper-continuity"}),e.jsx(X,{value:"ccs auth create work --context-group sprint-a --deeper-continuity",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs cliproxy auth claude"}),e.jsx(X,{value:"ccs cliproxy auth claude",size:"icon"})]})]})]})]})})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col bg-background",children:[e.jsxs("div",{className:"px-5 py-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{variant:"outline",children:s("accountsPage.workspaceBadge")}),e.jsx(F,{variant:"secondary",children:s("accountsPage.historySyncBadge")})]}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:s("accountsPage.authAccounts")}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[s("accountsPage.tableScopePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.tableScopeMiddle"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:s("accountsTable.sync")}),s("accountsPage.tableScopeSuffix")]})]}),e.jsxs("div",{className:"flex-1 min-h-0 p-5 space-y-4 overflow-y-auto",children:[e.jsx(ce,{isolatedCount:C,sharedStandardCount:r,deeperSharedCount:d,sharedGroups:A,legacyTargetCount:h,cliproxyCount:l}),e.jsxs(S,{className:"flex flex-col",children:[e.jsxs(D,{className:"pb-3",children:[e.jsx(k,{className:"text-lg",children:s("accountsPage.accountMatrix")}),e.jsx(M,{children:s("accountsPage.sharedTotalDesc",{count:n})})]}),e.jsx(w,{children:c?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ae,{data:p,defaultAccount:t?.default??null})})]})]})]})]}),e.jsxs("div",{className:"p-4 space-y-4 lg:hidden",children:[e.jsxs(S,{children:[e.jsxs(D,{children:[e.jsx(k,{className:"text-lg",children:s("accountsPage.title")}),e.jsxs(M,{children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.mobileManageSuffix")]})]}),e.jsxs(w,{className:"space-y-2",children:[e.jsxs(u,{className:"w-full",onClick:()=>i(!0),children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(u,{variant:"outline",className:"w-full",onClick:E,children:[s("accountsPage.openCliProxyClaudePool"),e.jsx(R,{className:"w-4 h-4 ml-2"})]}),e.jsxs(u,{variant:"outline",className:"w-full",onClick:K,children:[s("accountsPage.authClaudeInPool"),e.jsx(J,{className:"w-4 h-4 ml-2"})]}),e.jsx(u,{variant:"outline",className:"w-full",onClick:U,disabled:o.isPending||h===0,children:o.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:h})})]})]}),e.jsx(ce,{isolatedCount:C,sharedStandardCount:r,deeperSharedCount:d,sharedGroups:A,legacyTargetCount:h,cliproxyCount:l}),e.jsxs(S,{children:[e.jsx(D,{className:"pb-3",children:e.jsx(k,{className:"text-base",children:s("accountsPage.accountMatrix")})}),e.jsx(w,{children:c?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ae,{data:p,defaultAccount:t?.default??null})})]})]}),e.jsx(st,{open:x,onClose:()=>i(!1)})]})}export{ht as AccountsPage};
@@ -1 +1 @@
1
- import{j as e,a3 as s,a4 as r,a5 as n,a6 as i,a7 as d,a8 as c,a9 as u,aa as f}from"./radix-ui-Dt3edmE5.js";import"./react-vendor-CNOkPC89.js";import{c as o,bA as l}from"./index-0mbI0zkd.js";function A({...a}){return e.jsx(s,{"data-slot":"alert-dialog",...a})}function g({...a}){return e.jsx(u,{"data-slot":"alert-dialog-portal",...a})}function m({className:a,...t}){return e.jsx(f,{"data-slot":"alert-dialog-overlay",className:o("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",a),...t})}function D({className:a,...t}){return e.jsxs(g,{children:[e.jsx(m,{}),e.jsx(r,{"data-slot":"alert-dialog-content",className:o("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",a),...t})]})}function b({className:a,...t}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:o("flex flex-col gap-2 text-center sm:text-left",a),...t})}function N({className:a,...t}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:o("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...t})}function v({className:a,...t}){return e.jsx(n,{"data-slot":"alert-dialog-title",className:o("text-lg font-semibold",a),...t})}function w({className:a,...t}){return e.jsx(i,{"data-slot":"alert-dialog-description",className:o("text-muted-foreground text-sm",a),...t})}function y({className:a,...t}){return e.jsx(c,{className:o(l(),a),...t})}function z({className:a,...t}){return e.jsx(d,{className:o(l({variant:"outline"}),a),...t})}export{A,D as a,b,v as c,w as d,N as e,z as f,y as g};
1
+ import{j as e,a3 as s,a4 as r,a5 as n,a6 as i,a7 as d,a8 as c,a9 as u,aa as f}from"./radix-ui-Dt3edmE5.js";import"./react-vendor-CNOkPC89.js";import{c as o,bB as l}from"./index-D_BsksCe.js";function A({...a}){return e.jsx(s,{"data-slot":"alert-dialog",...a})}function g({...a}){return e.jsx(u,{"data-slot":"alert-dialog-portal",...a})}function m({className:a,...t}){return e.jsx(f,{"data-slot":"alert-dialog-overlay",className:o("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",a),...t})}function D({className:a,...t}){return e.jsxs(g,{children:[e.jsx(m,{}),e.jsx(r,{"data-slot":"alert-dialog-content",className:o("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",a),...t})]})}function b({className:a,...t}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:o("flex flex-col gap-2 text-center sm:text-left",a),...t})}function N({className:a,...t}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:o("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...t})}function v({className:a,...t}){return e.jsx(n,{"data-slot":"alert-dialog-title",className:o("text-lg font-semibold",a),...t})}function w({className:a,...t}){return e.jsx(i,{"data-slot":"alert-dialog-description",className:o("text-muted-foreground text-sm",a),...t})}function y({className:a,...t}){return e.jsx(c,{className:o(l(),a),...t})}function z({className:a,...t}){return e.jsx(d,{className:o(l({variant:"outline"}),a),...t})}export{A,D as a,b,v as c,w as d,N as e,z as f,y as g};