@kaitranntt/ccs 7.77.1-dev.9 → 7.78.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 (207) hide show
  1. package/dist/auth/auth-commands.d.ts +2 -1
  2. package/dist/auth/auth-commands.d.ts.map +1 -1
  3. package/dist/auth/auth-commands.js +18 -4
  4. package/dist/auth/auth-commands.js.map +1 -1
  5. package/dist/auth/commands/backup-command.d.ts.map +1 -1
  6. package/dist/auth/commands/backup-command.js +7 -2
  7. package/dist/auth/commands/backup-command.js.map +1 -1
  8. package/dist/auth/commands/create-command.d.ts.map +1 -1
  9. package/dist/auth/commands/create-command.js +14 -16
  10. package/dist/auth/commands/create-command.js.map +1 -1
  11. package/dist/auth/commands/default-command.d.ts +1 -1
  12. package/dist/auth/commands/default-command.d.ts.map +1 -1
  13. package/dist/auth/commands/default-command.js +10 -2
  14. package/dist/auth/commands/default-command.js.map +1 -1
  15. package/dist/auth/commands/index.d.ts +1 -0
  16. package/dist/auth/commands/index.d.ts.map +1 -1
  17. package/dist/auth/commands/index.js +3 -1
  18. package/dist/auth/commands/index.js.map +1 -1
  19. package/dist/auth/commands/list-command.d.ts.map +1 -1
  20. package/dist/auth/commands/list-command.js +16 -3
  21. package/dist/auth/commands/list-command.js.map +1 -1
  22. package/dist/auth/commands/remove-command.d.ts.map +1 -1
  23. package/dist/auth/commands/remove-command.js +5 -1
  24. package/dist/auth/commands/remove-command.js.map +1 -1
  25. package/dist/auth/commands/resources-command.d.ts +3 -0
  26. package/dist/auth/commands/resources-command.d.ts.map +1 -0
  27. package/dist/auth/commands/resources-command.js +115 -0
  28. package/dist/auth/commands/resources-command.js.map +1 -0
  29. package/dist/auth/commands/show-command.d.ts.map +1 -1
  30. package/dist/auth/commands/show-command.js +13 -4
  31. package/dist/auth/commands/show-command.js.map +1 -1
  32. package/dist/auth/commands/types.d.ts +11 -1
  33. package/dist/auth/commands/types.d.ts.map +1 -1
  34. package/dist/auth/commands/types.js +41 -2
  35. package/dist/auth/commands/types.js.map +1 -1
  36. package/dist/auth/profile-continuity-inheritance.d.ts.map +1 -1
  37. package/dist/auth/profile-continuity-inheritance.js +2 -1
  38. package/dist/auth/profile-continuity-inheritance.js.map +1 -1
  39. package/dist/auth/profile-detector.d.ts.map +1 -1
  40. package/dist/auth/profile-detector.js +1 -0
  41. package/dist/auth/profile-detector.js.map +1 -1
  42. package/dist/auth/profile-registry.d.ts +2 -0
  43. package/dist/auth/profile-registry.d.ts.map +1 -1
  44. package/dist/auth/profile-registry.js +6 -2
  45. package/dist/auth/profile-registry.js.map +1 -1
  46. package/dist/auth/shared-resource-policy.d.ts +20 -0
  47. package/dist/auth/shared-resource-policy.d.ts.map +1 -0
  48. package/dist/auth/shared-resource-policy.js +69 -0
  49. package/dist/auth/shared-resource-policy.js.map +1 -0
  50. package/dist/cliproxy/auth/oauth-handler.d.ts +34 -0
  51. package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
  52. package/dist/cliproxy/auth/oauth-handler.js +85 -13
  53. package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
  54. package/dist/cliproxy/auth/oauth-process.d.ts.map +1 -1
  55. package/dist/cliproxy/auth/oauth-process.js +94 -3
  56. package/dist/cliproxy/auth/oauth-process.js.map +1 -1
  57. package/dist/cliproxy/auth/oauth-trace/diagnose-failure.d.ts +24 -0
  58. package/dist/cliproxy/auth/oauth-trace/diagnose-failure.d.ts.map +1 -0
  59. package/dist/cliproxy/auth/oauth-trace/diagnose-failure.js +159 -0
  60. package/dist/cliproxy/auth/oauth-trace/diagnose-failure.js.map +1 -0
  61. package/dist/cliproxy/auth/oauth-trace/index.d.ts +4 -0
  62. package/dist/cliproxy/auth/oauth-trace/index.d.ts.map +1 -0
  63. package/dist/cliproxy/auth/oauth-trace/index.js +14 -0
  64. package/dist/cliproxy/auth/oauth-trace/index.js.map +1 -0
  65. package/dist/cliproxy/auth/oauth-trace/redactor.d.ts +22 -0
  66. package/dist/cliproxy/auth/oauth-trace/redactor.d.ts.map +1 -0
  67. package/dist/cliproxy/auth/oauth-trace/redactor.js +112 -0
  68. package/dist/cliproxy/auth/oauth-trace/redactor.js.map +1 -0
  69. package/dist/cliproxy/auth/oauth-trace/sink-file.d.ts +18 -0
  70. package/dist/cliproxy/auth/oauth-trace/sink-file.d.ts.map +1 -0
  71. package/dist/cliproxy/auth/oauth-trace/sink-file.js +90 -0
  72. package/dist/cliproxy/auth/oauth-trace/sink-file.js.map +1 -0
  73. package/dist/cliproxy/auth/oauth-trace/sink-memory.d.ts +13 -0
  74. package/dist/cliproxy/auth/oauth-trace/sink-memory.d.ts.map +1 -0
  75. package/dist/cliproxy/auth/oauth-trace/sink-memory.js +31 -0
  76. package/dist/cliproxy/auth/oauth-trace/sink-memory.js.map +1 -0
  77. package/dist/cliproxy/auth/oauth-trace/sink-verbose-stdout.d.ts +11 -0
  78. package/dist/cliproxy/auth/oauth-trace/sink-verbose-stdout.d.ts.map +1 -0
  79. package/dist/cliproxy/auth/oauth-trace/sink-verbose-stdout.js +47 -0
  80. package/dist/cliproxy/auth/oauth-trace/sink-verbose-stdout.js.map +1 -0
  81. package/dist/cliproxy/auth/oauth-trace/trace-events.d.ts +51 -0
  82. package/dist/cliproxy/auth/oauth-trace/trace-events.d.ts.map +1 -0
  83. package/dist/cliproxy/auth/oauth-trace/trace-events.js +44 -0
  84. package/dist/cliproxy/auth/oauth-trace/trace-events.js.map +1 -0
  85. package/dist/cliproxy/auth/oauth-trace/trace-recorder.d.ts +34 -0
  86. package/dist/cliproxy/auth/oauth-trace/trace-recorder.d.ts.map +1 -0
  87. package/dist/cliproxy/auth/oauth-trace/trace-recorder.js +83 -0
  88. package/dist/cliproxy/auth/oauth-trace/trace-recorder.js.map +1 -0
  89. package/dist/commands/command-catalog.d.ts +1 -1
  90. package/dist/commands/command-catalog.d.ts.map +1 -1
  91. package/dist/commands/command-catalog.js +1 -0
  92. package/dist/commands/command-catalog.js.map +1 -1
  93. package/dist/commands/completion-backend.d.ts.map +1 -1
  94. package/dist/commands/completion-backend.js +7 -0
  95. package/dist/commands/completion-backend.js.map +1 -1
  96. package/dist/commands/help-command.d.ts.map +1 -1
  97. package/dist/commands/help-command.js +1 -0
  98. package/dist/commands/help-command.js.map +1 -1
  99. package/dist/commands/sync-command.d.ts.map +1 -1
  100. package/dist/commands/sync-command.js +3 -2
  101. package/dist/commands/sync-command.js.map +1 -1
  102. package/dist/config/migration-manager.d.ts.map +1 -1
  103. package/dist/config/migration-manager.js +12 -0
  104. package/dist/config/migration-manager.js.map +1 -1
  105. package/dist/config/schemas/auth.d.ts +2 -0
  106. package/dist/config/schemas/auth.d.ts.map +1 -1
  107. package/dist/config/schemas/auth.js.map +1 -1
  108. package/dist/dispatcher/flows/account-flow.d.ts.map +1 -1
  109. package/dist/dispatcher/flows/account-flow.js +4 -3
  110. package/dist/dispatcher/flows/account-flow.js.map +1 -1
  111. package/dist/shared/claude-extension-setup.d.ts.map +1 -1
  112. package/dist/shared/claude-extension-setup.js +5 -1
  113. package/dist/shared/claude-extension-setup.js.map +1 -1
  114. package/dist/types/config.d.ts +2 -0
  115. package/dist/types/config.d.ts.map +1 -1
  116. package/dist/types/config.js.map +1 -1
  117. package/dist/ui/assets/accounts-CW9bbE4S.js +1 -0
  118. package/dist/ui/assets/{alert-dialog-BM9gIsRp.js → alert-dialog-ClPYGzV3.js} +1 -1
  119. package/dist/ui/assets/{api-0YJdilQb.js → api-BjpAFHdA.js} +1 -1
  120. package/dist/ui/assets/{auth-section-C1ljCo7W.js → auth-section-wl4-fzwD.js} +1 -1
  121. package/dist/ui/assets/{backups-section-C-iLf1kg.js → backups-section-CRfyOhtX.js} +1 -1
  122. package/dist/ui/assets/{channels-DDSqllsQ.js → channels-DH0HkSGX.js} +1 -1
  123. package/dist/ui/assets/{checkbox-5R1YTubE.js → checkbox-CTpEjpTH.js} +1 -1
  124. package/dist/ui/assets/{claude-extension-CEGefl3-.js → claude-extension-BQOBO5Au.js} +1 -1
  125. package/dist/ui/assets/{cliproxy-ai-providers-DVF3FnXM.js → cliproxy-ai-providers-DoUPKyI5.js} +1 -1
  126. package/dist/ui/assets/{cliproxy-control-panel-CIsKyGK6.js → cliproxy-control-panel-CvjXdHw9.js} +1 -1
  127. package/dist/ui/assets/{cliproxy-R4kPUeL-.js → cliproxy-qUbiZjec.js} +2 -2
  128. package/dist/ui/assets/{codex-BiEEUC4Y.js → codex-BeeazJpw.js} +1 -1
  129. package/dist/ui/assets/{confirm-dialog-BhJV4F_d.js → confirm-dialog-CYj_LLWN.js} +1 -1
  130. package/dist/ui/assets/{copilot-DgRLuQfV.js → copilot-ZCJeM_Zk.js} +1 -1
  131. package/dist/ui/assets/{cursor-BuOjfajj.js → cursor-CtBjQ1_j.js} +1 -1
  132. package/dist/ui/assets/{droid-BPiviAW2.js → droid-BLmzMBtN.js} +1 -1
  133. package/dist/ui/assets/{globalenv-section-DAqbiNI1.js → globalenv-section-0ENDeVbM.js} +1 -1
  134. package/dist/ui/assets/{health-B_CfF7J0.js → health-BEnDHk-j.js} +1 -1
  135. package/dist/ui/assets/{icons-DIVjDO-z.js → icons-DzKUh8vG.js} +1 -1
  136. package/dist/ui/assets/{index-CzKdWNe5.js → index-B3xma6R0.js} +1 -1
  137. package/dist/ui/assets/{index-BJl0cazY.js → index-Bs28kNJN.js} +27 -27
  138. package/dist/ui/assets/{index-BqR6NZDE.js → index-C04Kst21.js} +1 -1
  139. package/dist/ui/assets/{index-Cj4mWFVK.js → index-Cip18A41.js} +1 -1
  140. package/dist/ui/assets/{index-Bc-AbZRU.js → index-ClMz157R.js} +1 -1
  141. package/dist/ui/assets/index-D2_yb3d2.css +1 -0
  142. package/dist/ui/assets/{index-BEGD-4HR.js → index-DrCrZ7r1.js} +1 -1
  143. package/dist/ui/assets/{index-LJitUhfE.js → index-O9Qq-UJq.js} +1 -1
  144. package/dist/ui/assets/{logs-Lqv-I3_T.js → logs-DQxVdsHm.js} +1 -1
  145. package/dist/ui/assets/{masked-input-CgCDYXYf.js → masked-input-eN6tFUjN.js} +1 -1
  146. package/dist/ui/assets/{proxy-status-widget-Df-4cfdm.js → proxy-status-widget-50UIM6S8.js} +1 -1
  147. package/dist/ui/assets/{raw-json-settings-editor-panel-BpXdUisD.js → raw-json-settings-editor-panel-DqKmVWL-.js} +1 -1
  148. package/dist/ui/assets/{searchable-select-DCOfw3f0.js → searchable-select-JO0gngYE.js} +1 -1
  149. package/dist/ui/assets/{separator-Ct6a34bG.js → separator-AoncAA6l.js} +1 -1
  150. package/dist/ui/assets/shared-BTv96-3y.js +8 -0
  151. package/dist/ui/assets/{table-DsU2UX-e.js → table-BM_YK49c.js} +1 -1
  152. package/dist/ui/assets/{updates-D-0gOqSU.js → updates-eo4H4NOg.js} +1 -1
  153. package/dist/ui/assets/use-accounts-ELLatpzU.js +1 -0
  154. package/dist/ui/index.html +3 -3
  155. package/dist/web-server/routes/account-route-helpers.d.ts +3 -0
  156. package/dist/web-server/routes/account-route-helpers.d.ts.map +1 -1
  157. package/dist/web-server/routes/account-route-helpers.js.map +1 -1
  158. package/dist/web-server/routes/account-routes.d.ts.map +1 -1
  159. package/dist/web-server/routes/account-routes.js +97 -4
  160. package/dist/web-server/routes/account-routes.js.map +1 -1
  161. package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
  162. package/dist/web-server/routes/cliproxy-auth-routes.js +29 -0
  163. package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
  164. package/dist/web-server/shared-routes-collections.d.ts +13 -0
  165. package/dist/web-server/shared-routes-collections.d.ts.map +1 -0
  166. package/dist/web-server/shared-routes-collections.js +170 -0
  167. package/dist/web-server/shared-routes-collections.js.map +1 -0
  168. package/dist/web-server/shared-routes-content.d.ts +16 -0
  169. package/dist/web-server/shared-routes-content.d.ts.map +1 -0
  170. package/dist/web-server/shared-routes-content.js +152 -0
  171. package/dist/web-server/shared-routes-content.js.map +1 -0
  172. package/dist/web-server/shared-routes-markdown-walker.d.ts +12 -0
  173. package/dist/web-server/shared-routes-markdown-walker.d.ts.map +1 -0
  174. package/dist/web-server/shared-routes-markdown-walker.js +97 -0
  175. package/dist/web-server/shared-routes-markdown-walker.js.map +1 -0
  176. package/dist/web-server/shared-routes-markdown.d.ts +18 -0
  177. package/dist/web-server/shared-routes-markdown.d.ts.map +1 -0
  178. package/dist/web-server/shared-routes-markdown.js +167 -0
  179. package/dist/web-server/shared-routes-markdown.js.map +1 -0
  180. package/dist/web-server/shared-routes-path-guards.d.ts +16 -0
  181. package/dist/web-server/shared-routes-path-guards.d.ts.map +1 -0
  182. package/dist/web-server/shared-routes-path-guards.js +93 -0
  183. package/dist/web-server/shared-routes-path-guards.js.map +1 -0
  184. package/dist/web-server/shared-routes-plugin-registry-content.d.ts +12 -0
  185. package/dist/web-server/shared-routes-plugin-registry-content.d.ts.map +1 -0
  186. package/dist/web-server/shared-routes-plugin-registry-content.js +93 -0
  187. package/dist/web-server/shared-routes-plugin-registry-content.js.map +1 -0
  188. package/dist/web-server/shared-routes-plugins.d.ts +21 -0
  189. package/dist/web-server/shared-routes-plugins.d.ts.map +1 -0
  190. package/dist/web-server/shared-routes-plugins.js +197 -0
  191. package/dist/web-server/shared-routes-plugins.js.map +1 -0
  192. package/dist/web-server/shared-routes-symlink-status.d.ts +27 -0
  193. package/dist/web-server/shared-routes-symlink-status.d.ts.map +1 -0
  194. package/dist/web-server/shared-routes-symlink-status.js +135 -0
  195. package/dist/web-server/shared-routes-symlink-status.js.map +1 -0
  196. package/dist/web-server/shared-routes-types.d.ts +23 -0
  197. package/dist/web-server/shared-routes-types.d.ts.map +1 -0
  198. package/dist/web-server/shared-routes-types.js +15 -0
  199. package/dist/web-server/shared-routes-types.js.map +1 -0
  200. package/dist/web-server/shared-routes.d.ts +2 -1
  201. package/dist/web-server/shared-routes.d.ts.map +1 -1
  202. package/dist/web-server/shared-routes.js +49 -455
  203. package/dist/web-server/shared-routes.js.map +1 -1
  204. package/package.json +1 -1
  205. package/dist/ui/assets/accounts-DkID6f81.js +0 -1
  206. package/dist/ui/assets/index-Cm0qoAXb.css +0 -1
  207. package/dist/ui/assets/shared-D-JFc_Cw.js +0 -8
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{r as C,e as ke}from"./react-vendor-Bjx91N7w.js";import{u as we,a as K,b as H,e as Pe,f as te,g as Ae}from"./tanstack-bhJxV1h8.js";import{T as De,a as _e,b as se,c as Se,d as Te,e as Ge}from"./table-DsU2UX-e.js";import{a as P,Y as O,ah as xe,ai as me,aj as he,ak as ge,al as pe,L as T,I as V,x as D,aD as Re,d as j,B as A,C as M,j as $,k as F,_ as E,b as z,e as Me,f as ze,g as Oe,n as $e}from"./index-BJl0cazY.js";import{A as Fe,a as Le,b as Ke,c as He,d as Ie,e as qe,f as Ue,g as Ee}from"./alert-dialog-BM9gIsRp.js";import{t as k}from"./notifications-B4_o8bcr.js";import{b1 as W,b2 as L,b3 as ee,aH as fe,_ as be,b4 as Be,b5 as Qe,m as Y,at as Ze,Q as Xe,ai as Ve,b6 as We,a7 as Ye,$ as je,a6 as B,T as J,x as Je,o as ae,U as et,a9 as ne,Z as re}from"./icons-DIVjDO-z.js";import{C as oe}from"./checkbox-5R1YTubE.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./code-highlight-D4E79GKQ.js";function Z(a){return Array.from(a).sort((c,t)=>c.localeCompare(t))}function tt(a){const c=new Map;for(const n of a){if(n.context_mode!=="shared")continue;const g=n.context_group||"default",h=c.get(g)??{group:g,sharedCount:0,deeperCount:0,accountNames:[]};h.sharedCount+=1,h.accountNames.push(n.name),n.continuity_mode==="deeper"&&(h.deeperCount+=1),c.set(g,h)}const t=Array.from(c.values()).sort((n,g)=>n.group.localeCompare(g.group)),o=a.map(n=>{if(n.context_mode!=="shared")return{...n,sameGroupPeerCount:0,sameGroupDeeperPeerCount:0};const g=n.context_group||"default",h=c.get(g),N=Math.max((h?.sharedCount??1)-1,0),m=Math.max((h?.deeperCount??0)-(n.continuity_mode==="deeper"?1:0),0);return{...n,sameGroupPeerCount:N,sameGroupDeeperPeerCount:m}}),s=o.filter(n=>n.context_mode==="shared").length,l=o.filter(n=>n.context_mode==="shared"&&n.continuity_mode==="deeper").length,d=o.filter(n=>n.context_inferred).length,x=o.filter(n=>n.context_mode==="shared"&&n.continuity_mode!=="deeper"&&n.continuity_inferred).length;return{accounts:o,sharedCount:s,sharedStandardCount:Math.max(s-l,0),deeperSharedCount:l,isolatedCount:o.length-s,legacyContextCount:d,legacyContinuityCount:x,sharedAloneCount:o.filter(n=>n.context_mode==="shared"&&n.sameGroupPeerCount===0).length,sharedPeerAccountCount:o.filter(n=>n.sameGroupPeerCount>0).length,deeperReadyAccountCount:o.filter(n=>n.continuity_mode==="deeper"&&n.sameGroupDeeperPeerCount>0).length,sharedPeerGroups:Z(t.filter(n=>n.sharedCount>=2).map(n=>n.group)),deeperReadyGroups:Z(t.filter(n=>n.deeperCount>=2).map(n=>n.group)),sharedGroups:Z(t.map(n=>n.group)),groupSummaries:t}}function st(){return we({queryKey:["accounts"],queryFn:()=>O.accounts.list(),select:a=>{const c=a.accounts.filter(l=>l.type!=="cliproxy"),t=tt(c),o=a.accounts.length-c.length,s=t.accounts.some(l=>l.name===a.default)?a.default:null;return{accounts:t.accounts,default:s,cliproxyCount:o,legacyContextCount:t.legacyContextCount,legacyContinuityCount:t.legacyContinuityCount,sharedCount:t.sharedCount,sharedStandardCount:t.sharedStandardCount,deeperSharedCount:t.deeperSharedCount,isolatedCount:t.isolatedCount,sharedAloneCount:t.sharedAloneCount,sharedPeerAccountCount:t.sharedPeerAccountCount,deeperReadyAccountCount:t.deeperReadyAccountCount,sharedPeerGroups:t.sharedPeerGroups,deeperReadyGroups:t.deeperReadyGroups,sharedGroups:t.sharedGroups,groupSummaries:t.groupSummaries,plainCcsLane:a.plain_ccs_lane??null}}})}function at(){const a=K(),{t:c}=P();return H({mutationFn:t=>O.accounts.setDefault(t),onSuccess:(t,o)=>{a.invalidateQueries({queryKey:["accounts"]}),k.success(c("toasts.defaultAccountSet",{name:o}))},onError:t=>{k.error(t.message)}})}function nt(){const a=K(),{t:c}=P();return H({mutationFn:()=>O.accounts.resetDefault(),onSuccess:()=>{a.invalidateQueries({queryKey:["accounts"]}),k.success(c("toasts.defaultAccountReset"))},onError:t=>{k.error(t.message)}})}function rt(){const a=K(),{t:c}=P();return H({mutationFn:t=>O.accounts.delete(t),onSuccess:(t,o)=>{a.invalidateQueries({queryKey:["accounts"]}),k.success(c("toasts.accountDeleted",{name:o}))},onError:t=>{k.error(t.message)}})}function ye(){const a=K(),{t:c}=P();return H({mutationFn:({name:t,context_mode:o,context_group:s,continuity_mode:l})=>O.accounts.updateContext(t,{context_mode:o,context_group:s,continuity_mode:l}),onSuccess:(t,o)=>{a.invalidateQueries({queryKey:["accounts"]});const s=(o.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-"),l=o.context_mode==="shared"?o.continuity_mode==="deeper"?`${c("accountsPage.sharedDeeper")} (${s})`:`${c("accountsPage.sharedStandard")} (${s})`:c("accountsPage.isolated");k.success(c("toasts.contextUpdated",{name:o.name,summary:l}))},onError:t=>{k.error(t.message)}})}function ot(){const a=K(),{t:c}=P();return H({mutationFn:async t=>{const o=t.filter(d=>d.context_inferred||d.continuity_inferred),l=(await Promise.allSettled(o.map(d=>{const x=d.context_mode==="shared";return O.accounts.updateContext(d.name,{context_mode:x?"shared":"isolated",context_group:x?d.context_group||"default":void 0,continuity_mode:x?d.continuity_mode==="deeper"?"deeper":"standard":void 0})}))).filter(d=>d.status==="rejected").length;return{updatedCount:o.length-l,failedCount:l}},onSuccess:({updatedCount:t,failedCount:o})=>{if(a.invalidateQueries({queryKey:["accounts"]}),o>0&&t>0){k.error(c("toasts.legacyConfirmPartial",{updated:t,failed:o}));return}if(o>0){k.error(c("toasts.legacyConfirmAllFailed",{failed:o}));return}if(t>0){k.success(c("toasts.legacyConfirmSuccess",{count:t}));return}k.info(c("toasts.noLegacyAccounts"))},onError:t=>{a.invalidateQueries({queryKey:["accounts"]}),k.error(t.message)}})}const ce=64,ct=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function dt({account:a,groupSummaries:c,plainCcsLane:t,onClose:o}){const{t:s}=P(),l=ye(),[d,x]=C.useState(a.context_mode==="shared"?"shared":"isolated"),[n,g]=C.useState(a.context_group||"default"),[h,N]=C.useState(a.continuity_mode==="deeper"?"deeper":"standard"),m=C.useMemo(()=>n.trim().toLowerCase().replace(/\s+/g,"-"),[n]),i=C.useMemo(()=>c.find(p=>p.group===m),[c,m]),y=m.length>0&&m.length<=ce&&ct.test(m),r=d==="isolated"||y,u=d==="shared"?Math.max((i?.sharedCount??0)-(a.context_mode==="shared"&&a.context_group===m?1:0),0):0,b=d==="shared"?Math.max((i?.deeperCount??0)-(a.continuity_mode==="deeper"&&a.context_group===m?1:0),0):0,v=t?.account_name===a.name,f=!!t&&!v,G=`ccs auth default ${a.name}`,S=`ccs auth backup ${a.name}`,w=(p,q,R,U)=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(p.key))return;p.preventDefault();const Ne=R.indexOf(q),ve=p.key==="ArrowLeft"||p.key==="ArrowUp"?-1:1,Ce=(Ne+ve+R.length)%R.length;U(R[Ce])},I=t?t.kind==="native"?s("continuityOverview.lane.native"):t.kind==="account-default"?s("continuityOverview.lane.accountDefault",{name:t.account_name||""}):t.kind==="account-inherited"?s("continuityOverview.lane.accountInherited",{name:t.account_name||""}):t.kind==="profile-default"?s("continuityOverview.lane.profileDefault",{name:t.profile_name||"default"}):t.label:"",_=()=>{r&&l.mutate({name:a.name,context_mode:d,context_group:d==="shared"?m:void 0,continuity_mode:d==="shared"?h:void 0},{onSuccess:()=>{o()}})},Q=p=>{p||o()};return e.jsx(xe,{open:!0,onOpenChange:Q,children:e.jsxs(me,{className:"sm:max-w-md",children:[e.jsxs(he,{children:[e.jsx(ge,{children:s("editAccountContext.title")}),e.jsx(pe,{children:s("editAccountContext.description",{name:a.name})})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(T,{className:"text-sm font-semibold",children:s("editAccountContext.syncMode")})}),e.jsxs("div",{className:"flex p-0.5 bg-muted/60 hover:bg-muted/80 transition-colors rounded-xl border border-border/40 w-full",role:"radiogroup","aria-label":s("editAccountContext.syncMode"),children:[e.jsxs("button",{type:"button",role:"radio","aria-checked":d==="isolated",tabIndex:d==="isolated"?0:-1,onClick:()=>x("isolated"),onKeyDown:p=>w(p,d,["isolated","shared"],x),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${d==="isolated"?"bg-background text-blue-600 dark:text-blue-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(W,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:s("editAccountContext.isolatedOption")})]}),e.jsxs("button",{type:"button",role:"radio","aria-checked":d==="shared",tabIndex:d==="shared"?0:-1,onClick:()=>x("shared"),onKeyDown:p=>w(p,d,["isolated","shared"],x),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${d==="shared"?"bg-background text-emerald-600 dark:text-emerald-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(L,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:s("editAccountContext.sharedOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground pt-1 px-1",children:s(d==="isolated"?"editAccountContext.isolatedModeHint":"editAccountContext.sharedModeHint")})]}),d==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"context-group",children:s("editAccountContext.historySyncGroup")}),e.jsx(V,{id:"context-group",value:n,onChange:p=>g(p.target.value),placeholder:s("editAccountContext.groupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("editAccountContext.groupHint",{max:ce})}),!y&&e.jsx("p",{className:"text-xs text-destructive",children:s("editAccountContext.invalidGroup")})]}),d==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(T,{className:"text-sm font-semibold",children:s("editAccountContext.continuityDepth")})}),e.jsxs("div",{className:"flex p-0.5 bg-muted/60 hover:bg-muted/80 transition-colors rounded-xl border border-border/40 w-full",role:"radiogroup","aria-label":s("editAccountContext.continuityDepth"),children:[e.jsxs("button",{type:"button",role:"radio","aria-checked":h==="standard",tabIndex:h==="standard"?0:-1,onClick:()=>N("standard"),onKeyDown:p=>w(p,h,["standard","deeper"],N),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${h==="standard"?"bg-background text-emerald-600 dark:text-emerald-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(L,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:s("editAccountContext.standardOption")})]}),e.jsxs("button",{type:"button",role:"radio","aria-checked":h==="deeper",tabIndex:h==="deeper"?0:-1,onClick:()=>N("deeper"),onKeyDown:p=>w(p,h,["standard","deeper"],N),className:`flex-1 flex justify-center items-center gap-2 px-3 py-1.5 rounded-[10px] text-sm font-medium transition-all duration-200 overflow-hidden ${h==="deeper"?"bg-background text-indigo-600 dark:text-indigo-400 shadow-sm ring-1 ring-border/50":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.jsx(ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:s("editAccountContext.deeperOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground pt-1 px-1",children:s(h==="standard"?"editAccountContext.standardHint":"editAccountContext.deeperHint")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("editAccountContext.credentialsIsolated")}),f&&e.jsx("div",{className:"rounded-[14px] border border-amber-200 bg-amber-50/50 p-4 text-xs shadow-sm dark:border-amber-900/40 dark:bg-amber-900/10",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium text-foreground",children:s("continuityOverview.plainLaneTitle")}),e.jsx("p",{className:"text-muted-foreground leading-relaxed",children:s("continuityOverview.plainLaneDescription",{lane:I||"plain ccs",name:a.name})}),e.jsxs("div",{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 -r"}),e.jsx(D,{value:"ccs -r",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 auth backup default"}),e.jsx(D,{value:"ccs auth backup default",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:S}),e.jsx(D,{value:S,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:G}),e.jsx(D,{value:G,size:"icon"})]})]})]})}),e.jsx("div",{className:`rounded-[14px] border p-4 text-xs shadow-sm transition-colors ${d==="isolated"?"bg-blue-50/50 border-blue-200 dark:bg-blue-900/10 dark:border-blue-800/40":"bg-muted/40 border-border/60"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[d==="isolated"?e.jsx(fe,{className:"h-4 w-4 text-blue-500 mt-0.5 shrink-0"}):e.jsx(be,{className:"h-4 w-4 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{className:"space-y-1.5 flex-1 text-muted-foreground leading-relaxed",children:[d==="isolated"?e.jsx("p",{className:"text-foreground font-medium selection:bg-blue-200",children:s("editAccountContext.isolatedImplication")}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-foreground font-medium",children:s("editAccountContext.sameGroupRule",{group:m})})," ",u>0?s("editAccountContext.sameGroupPeerCount",{count:u}):s("editAccountContext.noSameGroupPeer")]}),h==="deeper"&&e.jsx("p",{children:b>0?s("editAccountContext.deeperReady",{count:b}):e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:s("editAccountContext.deeperNeedsPeers")})})]}),e.jsx("p",{className:`pt-1.5 text-[11px] ${d==="isolated"?"text-blue-700/70 dark:text-blue-300/60":"text-muted-foreground/70"}`,children:s("editAccountContext.resumeOriginalWarning")})]})]})})]}),e.jsxs(Re,{children:[e.jsx(j,{variant:"outline",onClick:o,disabled:l.isPending,children:s("editAccountContext.cancel")}),e.jsx(j,{onClick:_,disabled:!r||l.isPending,children:l.isPending?s("editAccountContext.saving"):s("editAccountContext.save")})]})]})})}function de({data:a,defaultAccount:c,groupSummaries:t,plainCcsLane:o}){const{t:s}=P(),l=at(),d=rt(),x=nt(),n=ye(),[g,h]=C.useState(null),[N,m]=C.useState(null),i=[{accessorKey:"name",header:s("accountsTable.name"),size:200,cell:({row:r})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:r.original.name}),r.original.name===c&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:s("accountsTable.defaultBadge")})]})},{accessorKey:"type",header:s("accountsTable.type"),size:100,cell:({row:r})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:r.original.type||"oauth"})},{accessorKey:"created",header:s("accountsTable.created"),size:150,cell:({row:r})=>{const u=new Date(r.original.created);return e.jsx("span",{className:"text-muted-foreground",children:u.toLocaleDateString()})}},{accessorKey:"last_used",header:s("accountsTable.lastUsed"),size:150,cell:({row:r})=>{if(!r.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const u=new Date(r.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:u.toLocaleDateString()})}},{id:"context",header:s("accountsTable.historySync"),size:170,cell:({row:r})=>{if(r.original.type==="cliproxy")return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});if((r.original.context_mode||"isolated")==="shared"){const b=r.original.context_group||"default",v=r.original.continuity_mode==="deeper";return e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx(A,{variant:"outline",className:`font-mono text-[10px] uppercase px-1.5 py-0 border ${v?"text-indigo-700 border-indigo-300/60 bg-indigo-50/50 dark:text-indigo-300 dark:border-indigo-900/40 dark:bg-indigo-900/20":"text-emerald-700 border-emerald-300/60 bg-emerald-50/50 dark:text-emerald-300 dark:border-emerald-900/40 dark:bg-emerald-900/20"}`,children:s(v?"accountsTable.badges.deeper":"accountsTable.badges.shared")}),e.jsx("span",{className:"text-xs font-semibold text-foreground/80",children:b})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground whitespace-nowrap",children:r.original.sameGroupPeerCount>0?s("accountsTable.sameGroupPeerCount",{count:r.original.sameGroupPeerCount}):s("accountsTable.noSameGroupPeer")})]})}return r.original.context_inferred?e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsx(A,{variant:"outline",className:"text-amber-700 border-amber-300/60 bg-amber-50/50 dark:text-amber-400 dark:border-amber-900/40 dark:bg-amber-900/20 font-mono text-[10px] uppercase px-1.5 py-0",children:s("accountsTable.badges.legacy")}),e.jsx("p",{className:"text-[10px] text-amber-700/80 dark:text-amber-400/80 whitespace-nowrap",children:s("accountsTable.legacyReview")})]}):e.jsx("div",{className:"flex flex-col items-start gap-1.5",children:e.jsx(A,{variant:"secondary",className:"font-mono text-[10px] uppercase px-1.5 py-0 text-muted-foreground bg-muted/60 border-transparent shadow-none",children:s("accountsTable.badges.isolated")})})}},{id:"actions",header:s("accountsTable.actions"),size:220,cell:({row:r})=>{const u=r.original.name===c,b=l.isPending||d.isPending||n.isPending,v=r.original.type==="cliproxy",f=r.original.context_inferred||r.original.continuity_inferred;return e.jsxs("div",{className:"flex items-center gap-1",children:[!v&&e.jsxs(j,{variant:"outline",size:"sm",className:"h-8 px-2",disabled:b,onClick:()=>m(r.original),title:s("accountsTable.syncTitle"),children:[e.jsx(Be,{className:"w-3.5 h-3.5 mr-1"}),s("accountsTable.sync")]}),!v&&f&&e.jsxs(j,{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:b,onClick:()=>n.mutate({name:r.original.name,context_mode:r.original.context_mode==="shared"?"shared":"isolated",context_group:r.original.context_mode==="shared"?r.original.context_group||"default":void 0,continuity_mode:r.original.context_mode==="shared"?r.original.continuity_mode==="deeper"?"deeper":"standard":void 0}),title:s("accountsTable.confirmLegacyTitle"),children:[e.jsx(Qe,{className:"w-3 h-3 mr-1"}),s("accountsTable.confirm")]}),e.jsxs(j,{variant:u?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:u||b,onClick:()=>l.mutate(r.original.name),children:[e.jsx(Y,{className:`w-3 h-3 mr-1 ${u?"opacity-50":""}`}),s(u?"accountsTable.active":"accountsTable.setDefault")]}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:u||b,onClick:()=>h(r.original.name),title:s(u?"accountsTable.cannotDeleteDefault":"accountsTable.deleteAccount"),children:e.jsx(Ze,{className:"w-4 h-4"})})]})}}],y=Pe({data:a,columns:i,getCoreRowModel:Ae()});return a.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:s("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(De,{children:[e.jsx(_e,{children:y.getHeaderGroups().map(r=>e.jsx(se,{children:r.headers.map(u=>{const b={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",context:"w-[170px]",actions:"w-[290px]"}[u.id]||"w-auto";return e.jsx(Se,{className:b,children:u.isPlaceholder?null:te(u.column.columnDef.header,u.getContext())},u.id)})},r.id))}),e.jsx(Te,{children:y.getRowModel().rows.map(r=>e.jsx(se,{children:r.getVisibleCells().map(u=>e.jsx(Ge,{children:te(u.column.columnDef.cell,u.getContext())},u.id))},r.id))})]})}),c&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>x.mutate(),disabled:x.isPending,children:[e.jsx(Xe,{className:"w-4 h-4 mr-2"}),s("accountsTable.resetToDefault")]})})]}),N&&e.jsx(dt,{account:N,groupSummaries:t,plainCcsLane:o,onClose:()=>m(null)}),e.jsx(Fe,{open:!!g,onOpenChange:r=>!r&&h(null),children:e.jsxs(Le,{children:[e.jsxs(Ke,{children:[e.jsx(He,{children:s("accountsTable.deleteDialogTitle")}),e.jsx(Ie,{children:s("accountsTable.deleteDialogDesc",{name:g??""})})]}),e.jsxs(qe,{children:[e.jsx(Ue,{children:s("accountsTable.cancel")}),e.jsx(Ee,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{g&&(d.mutate(g),h(null))},children:s("accountsTable.delete")})]})]})})]})}function le({totalAccounts:a,isolatedCount:c,sharedPeerGroups:t,deeperReadyGroups:o}){const{t:s}=P(),l=o[0]||t[0]||"daily",d=a<2?"empty":o.length>0?"deeper":t.length>0?"shared":a>=2&&c===a?"isolated":a===0?"empty":"mixed",x=`ccs auth create work2 --share-context --context-group ${l} --deeper-continuity`;return e.jsxs(M,{className:"overflow-hidden",children:[e.jsx($,{className:"pb-3",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(F,{className:"text-lg",children:s("accountRouteGuide.title")}),e.jsx(E,{children:s("accountRouteGuide.description")})]}),e.jsx(A,{variant:d==="deeper"?"default":"secondary",children:s(`accountRouteGuide.status.${d}`)})]})}),e.jsxs(z,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[e.jsxs("section",{className:"rounded-md border bg-blue-50/50 p-3 text-sm dark:bg-blue-900/10",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[e.jsx(Ve,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}),s("accountRouteGuide.cards.isolated.title")]}),e.jsx("p",{className:"mt-1.5 text-xs leading-relaxed text-muted-foreground",children:s("accountRouteGuide.cards.isolated.desc")})]}),e.jsxs("section",{className:"rounded-md border bg-emerald-50/50 p-3 text-sm dark:bg-emerald-900/10",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[e.jsx(We,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}),s("accountRouteGuide.cards.select.title")]}),e.jsx("p",{className:"mt-1.5 text-xs leading-relaxed text-muted-foreground",children:s("accountRouteGuide.cards.select.desc")})]}),e.jsxs("section",{className:"rounded-md border bg-sky-50/50 p-3 text-sm dark:bg-sky-900/10",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[e.jsx(Ye,{className:"h-4 w-4 text-sky-600 dark:text-sky-400"}),s("accountRouteGuide.cards.settings.title")]}),e.jsx("p",{className:"mt-1.5 text-xs leading-relaxed text-muted-foreground",children:s("accountRouteGuide.cards.settings.desc")})]}),e.jsxs("section",{className:"rounded-md border bg-indigo-50/50 p-3 text-sm dark:bg-indigo-900/10",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[e.jsx(L,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400"}),s("accountRouteGuide.cards.sync.title")]}),e.jsx("p",{className:"mt-1.5 text-xs leading-relaxed text-muted-foreground",children:s("accountRouteGuide.cards.sync.desc")})]})]}),e.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border bg-background p-3",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[e.jsx(je,{className:"h-3.5 w-3.5"}),s("accountRouteGuide.commands.isolated")]}),["ccs auth create work","ccs auth create personal","ccs work","ccs personal"].map(n=>e.jsxs("div",{className:"mt-2 flex items-start gap-2 rounded-md bg-muted px-2 py-2 font-mono text-[11px]",children:[e.jsx("span",{className:"flex-1 break-all",children:n}),e.jsx(D,{value:n,size:"icon"})]},n))]}),e.jsxs("div",{className:"rounded-md border bg-background p-3",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[e.jsx(ee,{className:"h-3.5 w-3.5"}),s("accountRouteGuide.commands.sync")]}),e.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-muted px-2 py-2 font-mono text-[11px]",children:[e.jsx("span",{className:"flex-1 break-all",children:x}),e.jsx(D,{value:x,size:"icon"})]}),e.jsx("p",{className:"mt-2 text-xs leading-relaxed text-muted-foreground",children:s("accountRouteGuide.commands.syncDesc",{group:l})})]})]})]})]})}const X=({titleKey:a,descKey:c})=>{const{t}=P();return e.jsxs(Me,{children:[e.jsx(ze,{asChild:!0,children:e.jsx(j,{variant:"ghost",size:"icon","aria-label":t(a),className:"h-5 w-5 rounded-full hover:bg-muted text-muted-foreground/70 transition-colors",children:e.jsx(be,{className:"h-3 w-3"})})}),e.jsxs(Oe,{className:"w-72 p-4 rounded-xl shadow-lg border-border/50 text-sm",side:"top",align:"center",children:[e.jsx("p",{className:"font-semibold tracking-tight",children:t(a)}),e.jsx("p",{className:"mt-1.5 text-muted-foreground leading-relaxed",children:t(c)})]})]})};function ie({totalAccounts:a,primaryAccountName:c,isolatedCount:t,sharedStandardCount:o,deeperSharedCount:s,sharedAloneCount:l,sharedPeerAccountCount:d,deeperReadyAccountCount:x,sharedPeerGroups:n,deeperReadyGroups:g,legacyTargetCount:h,cliproxyCount:N,plainCcsLane:m}){const{t:i}=P(),y=m?m.kind==="native"?i("continuityOverview.lane.native"):m.kind==="account-default"?i("continuityOverview.lane.accountDefault",{name:m.account_name||""}):m.kind==="account-inherited"?i("continuityOverview.lane.accountInherited",{name:m.account_name||""}):m.kind==="profile-default"?i("continuityOverview.lane.profileDefault",{name:m.profile_name||"default"}):m.label:"",r=a<2?"single":n.length===0?t===a?"isolated":"shared-alone":g.length===0?"shared-standard":t>0||l>0||x<d||g.length<n.length?"partial":"ready",u=g[0]||n[0]||"default",b=g.length>0&&(t>0||o>0||n.length>g.length),f={ready:e.jsx(Je,{className:"h-6 w-6 text-emerald-600 dark:text-emerald-400"}),"shared-standard":e.jsx(L,{className:"h-6 w-6 text-blue-600 dark:text-blue-400"}),single:e.jsx(fe,{className:"h-6 w-6 text-stone-400"}),isolated:e.jsx(W,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"}),"shared-alone":e.jsx(J,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"}),partial:e.jsx(J,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"})}[r],G=!!c&&m?.account_name===c,S=a>0&&!!m&&(!c||!G),w=a>1&&r!=="ready";return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(M,{className:"flex flex-col justify-between overflow-hidden relative group p-0 border-border bg-card shadow-sm hover:shadow-md transition-shadow duration-300",children:e.jsxs(z,{className:"p-6 flex flex-col h-full bg-gradient-to-br from-card to-muted/20 space-y-4",children:[e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start gap-4",children:[e.jsx("div",{className:"rounded-2xl bg-background p-3 shadow-sm ring-1 ring-border/50 self-start shrink-0",children:f}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h3",{className:"text-lg font-semibold tracking-tight",children:i(`continuityReadiness.messages.${r}.title`,{group:u})}),e.jsx(A,{variant:r==="ready"?"default":"secondary",className:"rounded-full px-2.5 py-0.5 font-medium shadow-sm",children:i(`continuityReadiness.state.${r}`)})]}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-lg leading-relaxed",children:i(`continuityReadiness.messages.${r}.description`,{group:u,count:l})})]})]})}),e.jsxs("div",{className:"mt-auto pt-4 flex flex-wrap items-center gap-2",children:[N>0&&e.jsx(A,{variant:"outline",className:"text-blue-700 bg-blue-50/50 border-blue-200/60 dark:border-blue-900/40 dark:bg-blue-900/20 dark:text-blue-300",children:i("historySyncLearningMap.cliproxyManaged",{count:N})}),h>0&&e.jsx(A,{variant:"outline",className:"text-amber-700 bg-amber-50/50 border-amber-200/60 dark:border-amber-900/40 dark:bg-amber-900/20 dark:text-amber-300",children:i("historySyncLearningMap.legacyConfirmation",{count:h})}),n.length>0&&g.length===0&&e.jsx(A,{variant:"secondary",className:"font-mono text-[11px] px-2 bg-muted/50 text-muted-foreground border-transparent",children:i("continuityOverview.recommendBadge",{group:u})}),b&&e.jsx(A,{variant:"secondary",className:"font-mono text-[11px] px-2 bg-muted/50 text-muted-foreground border-transparent",children:i("continuityOverview.partialBadge",{group:u})})]})]})}),(S||w)&&e.jsx(M,{className:"border-dashed",children:e.jsxs(z,{className:"p-5 space-y-4",children:[S&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:i("continuityOverview.plainLaneTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i("continuityOverview.plainLaneDescription",{lane:y||"plain ccs"})})]}),e.jsxs("div",{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 -r"}),e.jsx(D,{value:"ccs -r",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 auth backup default"}),e.jsx(D,{value:"ccs auth backup default",size:"icon"})]}),c?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 default ${c}`}),e.jsx(D,{value:`ccs auth default ${c}`,size:"icon"})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:i("continuityOverview.setDefaultHint")})]})]}),w&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:i("continuityReadiness.stepsTitle")}),e.jsxs("ol",{className:"space-y-1 pl-5 text-sm text-muted-foreground",children:[e.jsx("li",{children:i("continuityReadiness.steps.syncBoth")}),e.jsx("li",{children:i("continuityReadiness.steps.sameGroup",{group:u})}),e.jsx("li",{children:i("continuityReadiness.steps.enableDeeper")}),e.jsx("li",{children:i("continuityReadiness.steps.resumeOriginal")})]})]})]})}),e.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-3",children:[e.jsxs("div",{className:"flex-1 w-full flex items-center justify-between p-3.5 rounded-xl border border-blue-300/40 bg-blue-50/50 dark:border-blue-900/30 dark:bg-blue-900/10 shadow-sm transition-colors hover:bg-blue-100/40 dark:hover:bg-blue-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{className:"h-4 w-4 text-blue-700/80 dark:text-blue-400/80"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-blue-900 dark:text-blue-200",children:i("historySyncLearningMap.isolated")}),e.jsx(X,{titleKey:"accountsPage.isolated",descKey:"accountsPage.isolatedDesc"})]}),e.jsx("span",{className:"text-lg font-mono font-bold text-blue-900 dark:text-blue-200",children:t})]}),e.jsx(B,{className:"hidden md:block h-4 w-4 text-muted-foreground/40 shrink-0"}),e.jsxs("div",{className:"flex-1 w-full flex items-center justify-between p-3.5 rounded-xl border border-emerald-300/40 bg-emerald-50/50 dark:border-emerald-900/30 dark:bg-emerald-900/10 shadow-sm transition-colors hover:bg-emerald-100/40 dark:hover:bg-emerald-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-4 w-4 text-emerald-700/80 dark:text-emerald-400/80"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-emerald-900 dark:text-emerald-200",children:i("historySyncLearningMap.shared")}),e.jsx(X,{titleKey:"accountsPage.sharedStandard",descKey:"accountsPage.sharedStandardDesc"})]}),e.jsx("span",{className:"text-lg font-mono font-bold text-emerald-900 dark:text-emerald-200",children:o})]}),e.jsx(B,{className:"hidden md:block h-4 w-4 text-muted-foreground/40 shrink-0"}),e.jsxs("div",{className:"flex-1 w-full flex items-center justify-between p-3.5 rounded-xl border border-indigo-300/40 bg-indigo-50/50 dark:border-indigo-900/30 dark:bg-indigo-900/10 shadow-sm transition-colors hover:bg-indigo-100/40 dark:hover:bg-indigo-900/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"h-4 w-4 text-indigo-700/80 dark:text-indigo-400/80"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-indigo-900 dark:text-indigo-200",children:i("historySyncLearningMap.deeper")}),e.jsx(X,{titleKey:"accountsPage.sharedDeeper",descKey:"accountsPage.sharedDeeperDesc"})]}),e.jsx("span",{className:"text-lg font-mono font-bold text-indigo-900 dark:text-indigo-200",children:s})]})]})]})}const ue=64;function lt({open:a,onClose:c}){const{t}=P(),[o,s]=C.useState(""),[l,d]=C.useState(!1),[x,n]=C.useState(""),[g,h]=C.useState(!1),[N,m]=C.useState(!1),i=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(o),y=x.trim().toLowerCase().replace(/\s+/g,"-"),r=y.length===0||y.length<=ue&&/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(y),u=o&&i?[`ccs auth create ${o}`,l?y.length>0?`--context-group ${y}`:"--share-context":"",l&&g?"--deeper-continuity":""].filter(Boolean).join(" "):t("createAuthProfileDialog.commandFallback"),b=async()=>{!i||l&&!r||(await navigator.clipboard.writeText(u),m(!0),setTimeout(()=>m(!1),2e3))},v=()=>{s(""),d(!1),n(""),h(!1),m(!1),c()};return e.jsx(xe,{open:a,onOpenChange:f=>!f&&v(),children:e.jsxs(me,{className:"sm:max-w-md",children:[e.jsxs(he,{children:[e.jsx(ge,{children:t("createAuthProfileDialog.title")}),e.jsx(pe,{children:t("createAuthProfileDialog.description")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"profile-name",children:t("createAuthProfileDialog.profileName")}),e.jsx(V,{id:"profile-name",value:o,onChange:f=>s(f.target.value),placeholder:t("createAuthProfileDialog.profileNamePlaceholder"),autoComplete:"off"}),o&&!i&&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(oe,{id:"share-context",checked:l,onCheckedChange:f=>d(f===!0)}),e.jsx(T,{htmlFor:"share-context",className:"cursor-pointer",children:t("createAuthProfileDialog.enableSharedHistory")})]}),l&&e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx(T,{htmlFor:"context-group",children:t("createAuthProfileDialog.historySyncGroupOptional")}),e.jsx(V,{id:"context-group",value:x,onChange:f=>n(f.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(oe,{id:"deeper-continuity",checked:g,onCheckedChange:f=>h(f===!0)}),e.jsx(T,{htmlFor:"deeper-continuity",className:"cursor-pointer",children:t("createAuthProfileDialog.deeperContinuity")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.deeperContinuityHint")}),x.trim().length>0&&!r&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidContextGroup",{max:ue})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{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(je,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:u}),e.jsx(j,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:b,disabled:!i||l&&!r,children:N?e.jsx(Y,{className:"w-4 h-4 text-green-500"}):e.jsx(ae,{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(j,{variant:"ghost",onClick:v,children:t("createAuthProfileDialog.close")}),e.jsx(j,{onClick:b,disabled:!i||l&&!r,children:N?e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copyCommand")]})})]})]})]})})}function vt(){const{t:a}=P(),c=ke(),{data:t,isLoading:o}=st(),s=ot(),[l,d]=C.useState(!1),x=t?.accounts||[],n=t?.cliproxyCount||0,g=t?.legacyContextCount||0,h=t?.legacyContinuityCount||0,N=t?.sharedCount||0,m=t?.sharedStandardCount||0,i=t?.deeperSharedCount||0,y=t?.isolatedCount||0,r=t?.sharedAloneCount||0,u=t?.sharedPeerAccountCount||0,b=t?.deeperReadyAccountCount||0,v=t?.sharedPeerGroups||[],f=t?.deeperReadyGroups||[],G=t?.sharedGroups||[],S=t?.groupSummaries||[],w=t?.plainCcsLane||null,I=x.filter(U=>U.context_inferred||U.continuity_inferred),_=I.length,Q=_>0,p=()=>c("/cliproxy?provider=claude"),q=()=>c("/cliproxy?provider=claude&action=auth"),R=()=>s.mutate(I);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(et,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:a("accountsPage.title")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[a("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),a("accountsPage.manageSuffix")]})]}),e.jsx($e,{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:a("accountsPage.primaryActions")}),e.jsxs(j,{size:"sm",className:"w-full justify-start",onClick:()=>d(!0),children:[e.jsx(ne,{className:"w-4 h-4 mr-2"}),a("accountsPage.createAccount")]}),e.jsxs(j,{size:"sm",className:"w-full justify-start",onClick:q,children:[e.jsx(re,{className:"w-4 h-4 mr-2"}),a("accountsPage.authClaudeInPool")]}),e.jsxs(j,{variant:"outline",size:"sm",className:"w-full justify-start",onClick:p,children:[a("accountsPage.openClaudePoolSettings"),e.jsx(B,{className:"w-4 h-4 ml-auto"})]})]}),Q?e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:a("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(J,{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:[g>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:a("accountsPage.legacyContextPending",{count:g})}),h>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:a("accountsPage.legacyContinuityPending",{count:h})})]})]}),e.jsx(j,{variant:"secondary",size:"sm",className:"w-full justify-start",onClick:R,disabled:s.isPending||_===0,children:s.isPending?a("accountsPage.confirmingLegacy"):a("accountsPage.confirmLegacy",{count:_})})]})]}):e.jsx("div",{className:"rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground",children:a("accountsPage.noLegacyFollowup")}),e.jsxs(M,{children:[e.jsxs($,{className:"pb-2",children:[e.jsx(F,{className:"text-sm",children:a("accountsPage.quickCommands")}),e.jsx(E,{children:a("accountsPage.quickCommandsDesc")})]}),e.jsxs(z,{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 --share-context --context-group sprint-a --deeper-continuity"}),e.jsx(D,{value:"ccs auth create work --share-context --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(D,{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(A,{variant:"outline",children:a("accountsPage.workspaceBadge")}),e.jsx(A,{variant:"secondary",children:a("accountsPage.historySyncBadge")})]}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:a("accountsPage.authAccounts")}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[a("accountsPage.tableScopePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),a("accountsPage.tableScopeMiddle"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:a("accountsTable.sync")}),a("accountsPage.tableScopeSuffix")]})]}),e.jsxs("div",{className:"flex-1 min-h-0 p-5 space-y-4 overflow-y-auto",children:[e.jsx(ie,{totalAccounts:x.length,primaryAccountName:x.length===1?x[0]?.name:null,isolatedCount:y,sharedStandardCount:m,deeperSharedCount:i,sharedAloneCount:r,sharedPeerAccountCount:u,deeperReadyAccountCount:b,sharedGroups:G,sharedPeerGroups:v,deeperReadyGroups:f,legacyTargetCount:_,cliproxyCount:n,plainCcsLane:w}),e.jsx(le,{totalAccounts:x.length,isolatedCount:y,sharedPeerGroups:v,deeperReadyGroups:f}),e.jsxs(M,{className:"flex flex-col",children:[e.jsxs($,{className:"pb-3",children:[e.jsx(F,{className:"text-lg",children:a("accountsPage.accountMatrix")}),e.jsx(E,{children:a("accountsPage.sharedTotalDesc",{count:N})})]}),e.jsx(z,{children:o?e.jsx("div",{className:"text-muted-foreground",children:a("accountsPage.loadingAccounts")}):e.jsx(de,{data:x,defaultAccount:t?.default??null,groupSummaries:S,plainCcsLane:w})})]})]})]})]}),e.jsxs("div",{className:"p-4 space-y-4 lg:hidden",children:[e.jsxs(M,{children:[e.jsxs($,{children:[e.jsx(F,{className:"text-lg",children:a("accountsPage.title")}),e.jsxs(E,{children:[a("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),a("accountsPage.mobileManageSuffix")]})]}),e.jsxs(z,{className:"space-y-2",children:[e.jsxs(j,{className:"w-full",onClick:()=>d(!0),children:[e.jsx(ne,{className:"w-4 h-4 mr-2"}),a("accountsPage.createAccount")]}),e.jsxs(j,{variant:"outline",className:"w-full",onClick:p,children:[a("accountsPage.openCliProxyClaudePool"),e.jsx(B,{className:"w-4 h-4 ml-2"})]}),e.jsxs(j,{variant:"outline",className:"w-full",onClick:q,children:[a("accountsPage.authClaudeInPool"),e.jsx(re,{className:"w-4 h-4 ml-2"})]}),e.jsx(j,{variant:"outline",className:"w-full",onClick:R,disabled:s.isPending||_===0,children:s.isPending?a("accountsPage.confirmingLegacy"):a("accountsPage.confirmLegacy",{count:_})})]})]}),e.jsx(ie,{totalAccounts:x.length,primaryAccountName:x.length===1?x[0]?.name:null,isolatedCount:y,sharedStandardCount:m,deeperSharedCount:i,sharedAloneCount:r,sharedPeerAccountCount:u,deeperReadyAccountCount:b,sharedGroups:G,sharedPeerGroups:v,deeperReadyGroups:f,legacyTargetCount:_,cliproxyCount:n,plainCcsLane:w}),e.jsx(le,{totalAccounts:x.length,isolatedCount:y,sharedPeerGroups:v,deeperReadyGroups:f}),e.jsxs(M,{children:[e.jsx($,{className:"pb-3",children:e.jsx(F,{className:"text-base",children:a("accountsPage.accountMatrix")})}),e.jsx(z,{children:o?e.jsx("div",{className:"text-muted-foreground",children:a("accountsPage.loadingAccounts")}):e.jsx(de,{data:x,defaultAccount:t?.default??null,groupSummaries:S,plainCcsLane:w})})]})]}),e.jsx(lt,{open:l,onClose:()=>d(!1)})]})}export{vt as AccountsPage};