@wrongstack/webui 0.302.2 → 0.303.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 (106) hide show
  1. package/dist/assets/AgentRosterView-BnnhSRau.js +9 -0
  2. package/dist/assets/{AnalyticsDashboard-C9aPEyov.js → AnalyticsDashboard-CMs176Dp.js} +1 -1
  3. package/dist/assets/{AudienceMemoryPanel-Bciki41o.js → AudienceMemoryPanel-BRXM47H1.js} +2 -2
  4. package/dist/assets/{ChangesView-DumffowD.js → ChangesView-DxAQY4v4.js} +1 -1
  5. package/dist/assets/ChronicleDashboard-DPI_5S2R.js +1 -0
  6. package/dist/assets/CodeEditor-9Fu9hRrw.js +1 -0
  7. package/dist/assets/CodeMap-B7YGx2G0.js +1 -0
  8. package/dist/assets/{ConfirmModal-CdKg3EOQ.js → ConfirmModal-DXy17_uy.js} +1 -1
  9. package/dist/assets/{CronJobsPanel-CJ7Vc1Am.js → CronJobsPanel-C_bGieGQ.js} +1 -1
  10. package/dist/assets/{DeadCodeScanPanel-DaeHUzc5.js → DeadCodeScanPanel-hkBvamWn.js} +2 -2
  11. package/dist/assets/{DebugDashboard-BI3EmXrM.js → DebugDashboard-CDWJ9nLR.js} +1 -1
  12. package/dist/assets/{DesignGalleryView-DMW6Ab__.js → DesignGalleryView-BG-p6kFX.js} +1 -1
  13. package/dist/assets/GoalView-CCklBpTx.js +1 -0
  14. package/dist/assets/KanbanView-Dzvn9y79.js +3 -0
  15. package/dist/assets/MailboxDetailView-7dtt5joR.js +1 -0
  16. package/dist/assets/MemoryDrawer-D2Yq9oba.js +1 -0
  17. package/dist/assets/MemoryManager-CL5AiyKr.js +1 -0
  18. package/dist/assets/{ModelPicker-IOZSUnqM.js → ModelPicker-BazB-GbH.js} +1 -1
  19. package/dist/assets/OfficeMapPanel-Dtb75DlY.js +4 -0
  20. package/dist/assets/{ProcessMonitor-TGqyXxmB.js → ProcessMonitor-BTjaxnO-.js} +1 -1
  21. package/dist/assets/{QueuePanel-5aMgQbHv.js → QueuePanel-BOD9qtHp.js} +1 -1
  22. package/dist/assets/{RefreshDebugView-DfBYFPEF.js → RefreshDebugView-DfbZ-vgF.js} +1 -1
  23. package/dist/assets/{RequirementIntakeView-CNAFKiQ3.js → RequirementIntakeView-CeZFJlrn.js} +1 -1
  24. package/dist/assets/SageTabs-BlK58zgb.js +2 -0
  25. package/dist/assets/SddFlowGraph-DWphr6Tr.js +1 -0
  26. package/dist/assets/SddHub-ZRkMmA7e.js +2 -0
  27. package/dist/assets/{SessionInspectView-CytBw7Y9.js → SessionInspectView-DqrSHseG.js} +1 -1
  28. package/dist/assets/SessionList-DLoIKc1b.js +1 -0
  29. package/dist/assets/{SessionsDashboard-CridPbkX.js → SessionsDashboard-CUj2WSYM.js} +1 -1
  30. package/dist/assets/SetupScreen-B_2CuLeR.js +1 -0
  31. package/dist/assets/SkillDetailView-ChspOaAw.js +3 -0
  32. package/dist/assets/{SpecsView-DUx1sgtH.js → SpecsView-Cl4vpAoL.js} +1 -1
  33. package/dist/assets/{TechStackView-CvUiAISX.js → TechStackView-DsFV85XT.js} +1 -1
  34. package/dist/assets/{TerminalPanel-Dg5hqYTA.js → TerminalPanel-GraS3zw1.js} +1 -1
  35. package/dist/assets/{Toaster-BgN2bRJx.js → Toaster-D76T-Ld4.js} +1 -1
  36. package/dist/assets/{button-Dcy288Mc.js → button-ELs5xgtQ.js} +1 -1
  37. package/dist/assets/{chat-store-DbxFVDwi.js → chat-store-CBJ1gc8n.js} +1 -1
  38. package/dist/assets/{codemap-activity-store-DQfjo7-j.js → codemap-activity-store-D67-genN.js} +1 -1
  39. package/dist/assets/codemap-index-store-ByAYIzQA.js +1 -0
  40. package/dist/assets/{dialog-ftgTihmF.js → dialog-CfAoIH8P.js} +1 -1
  41. package/dist/assets/{empty-state-RRSqQaCk.js → empty-state-BDwjdvMh.js} +1 -1
  42. package/dist/assets/{i18n-9T7iGYgW.js → i18n-BvFgJYE2.js} +2 -2
  43. package/dist/assets/index-BTRQG7C5.js +132 -0
  44. package/dist/assets/index-DHsJniTZ.css +1 -0
  45. package/dist/assets/{input-fo9-BPBC.js → input-DSTQkMEh.js} +1 -1
  46. package/dist/assets/{mailbox-store-C1mzoSqJ.js → mailbox-store-CKpkM0H1.js} +1 -1
  47. package/dist/assets/{roster-ws-Da57e_sI.js → roster-ws-a3-SO1Yb.js} +1 -1
  48. package/dist/assets/{session-store-Df7_hhe9.js → session-store-Ce4Dck2K.js} +1 -1
  49. package/dist/assets/settings-BUtmAZBV.js +1 -0
  50. package/dist/assets/settings-BlMNd_AC.js +1 -0
  51. package/dist/assets/settings-ClpzPWKE.js +1 -0
  52. package/dist/assets/settings-CyYYbmdR.js +1 -0
  53. package/dist/assets/settings-DyIEVRJT.js +1 -0
  54. package/dist/assets/settings-Orwkg3lH.js +1 -0
  55. package/dist/assets/settings-XRC0dC9D.js +1 -0
  56. package/dist/assets/{shared-KAzksK0C.js → shared-D368RBth.js} +1 -1
  57. package/dist/assets/stores-BATHCuMN.js +7 -0
  58. package/dist/assets/{ui-store-CE4-TlwB.js → ui-store-BGNdg1e4.js} +1 -1
  59. package/dist/assets/{useWebSocket-CZSpbA3M.js → useWebSocket-B2opfRwA.js} +3 -3
  60. package/dist/assets/utils-CUCQrODG.js +1 -0
  61. package/dist/assets/{vendor-BuarzSSb.js → vendor-GiKfK4Iw.js} +30 -30
  62. package/dist/assets/{view-navigation-DIDEcp4V.js → view-navigation-FdnvQSOv.js} +1 -1
  63. package/dist/assets/{ws-client-TTMa0XaT.js → ws-client-CGEB75Dy.js} +1 -1
  64. package/dist/components/KanbanContractGraphDashboard.d.ts +7 -0
  65. package/dist/components/KanbanContractGraphPanel.d.ts +7 -0
  66. package/dist/components/KanbanContractGraphView.d.ts +40 -0
  67. package/dist/components/KanbanViewModeTabs.d.ts +1 -1
  68. package/dist/components/KanbanWorkbench.d.ts +9 -0
  69. package/dist/components/TaskVerificationSection.d.ts +3 -3
  70. package/dist/components/agent-roster-data.d.ts +9 -0
  71. package/dist/index.html +22 -22
  72. package/dist/index.js +5260 -3984
  73. package/dist/lib/palettes.d.ts +1 -1
  74. package/dist/stores/kanban-store.d.ts +2 -1
  75. package/dist/stores/session-store.d.ts +2 -0
  76. package/dist/types/sage.d.ts +5 -13
  77. package/dist/types/system.d.ts +2 -0
  78. package/package.json +8 -8
  79. package/dist/assets/AgentRosterView-BwukmHoA.js +0 -9
  80. package/dist/assets/ChronicleDashboard-BYGV5twz.js +0 -1
  81. package/dist/assets/CodeEditor-D2Dnax7e.js +0 -1
  82. package/dist/assets/CodeMap-DIKKs3Ux.js +0 -1
  83. package/dist/assets/GoalView-3291Hxnb.js +0 -1
  84. package/dist/assets/KanbanView-CFE63A4a.js +0 -3
  85. package/dist/assets/MailboxDetailView-CUTWkSyK.js +0 -1
  86. package/dist/assets/MemoryDrawer-Dsy0AX6f.js +0 -1
  87. package/dist/assets/MemoryManager-D1kXeVE3.js +0 -1
  88. package/dist/assets/OfficeMapPanel-Q81eioDB.js +0 -4
  89. package/dist/assets/SageTabs-olgLJfg_.js +0 -2
  90. package/dist/assets/SddHub-7Z55QY-M.js +0 -2
  91. package/dist/assets/SessionList-C3ygQN8A.js +0 -1
  92. package/dist/assets/SetupScreen-BkVjdky4.js +0 -1
  93. package/dist/assets/SkillDetailView-Cp-xEHww.js +0 -3
  94. package/dist/assets/codemap-index-store-COStDU-8.js +0 -1
  95. package/dist/assets/index-Cw20Xg0d.css +0 -1
  96. package/dist/assets/index-FHt-sKVF.js +0 -132
  97. package/dist/assets/progress-ring-B9pqitSa.js +0 -1
  98. package/dist/assets/settings-Bb7_utQE.js +0 -1
  99. package/dist/assets/settings-Bd8zMwvC.js +0 -1
  100. package/dist/assets/settings-DdFgBMAw.js +0 -1
  101. package/dist/assets/settings-De6sXIFO.js +0 -1
  102. package/dist/assets/settings-E8SKMLxq.js +0 -1
  103. package/dist/assets/settings-zIY9-ivF.js +0 -1
  104. package/dist/assets/settings-zKBcRjqE.js +0 -1
  105. package/dist/assets/stores-vuG0AaKy.js +0 -7
  106. package/dist/assets/utils-B-9lSDIn.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Dn as t,Er as n,La as r,Oa as i,Ot as a,Pa as o,Ri as s,Wi as c,an as l,dt as u,ft as d,ir as f,ji as p,jt as m,lt as ee,oi as h,on as te,vn as ne,wn as re,za as g,zt as _}from"./vendor-BuarzSSb.js";import"./i18n-9T7iGYgW.js";import{t as v}from"./utils-B-9lSDIn.js";import"./stores-vuG0AaKy.js";import{n as y}from"./ui-store-CE4-TlwB.js";import{r as b}from"./ConfirmModal-CdKg3EOQ.js";import{b as ie}from"./index-FHt-sKVF.js";var x=e(g(),1),S=ee(),ae=10,oe=20,C=e=>{if(!e)return 0;let t=Date.parse(e);return Number.isNaN(t)?0:t},w=e=>(e.iterationCount??0)+(e.toolCallCount??0)+(e.fileChangeCount??0),T=e=>{let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Math.max(0,Date.now()-t);if(n<6e4)return r.t(`common:time.justNow`);if(n<36e5)return r.t(`common:time.minutesAgo`,{count:Math.floor(n/6e4)});if(n<864e5)return r.t(`common:time.hoursAgo`,{count:Math.floor(n/36e5)});let i=Math.floor(n/864e5);return i<7?r.t(`common:time.daysAgo`,{count:i}):new Date(t).toLocaleDateString()},E=e=>e.lastActivityAt??e.endedAt??e.startedAt;function D(e){let t=C(e.startedAt);if(!t)return``;let n=e.isCurrent?Date.now():C(e.endedAt)||t,r=Math.max(0,Math.floor((n-t)/6e4));if(r<1)return`<1m`;if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h ${r%60}m`:`${Math.floor(i/24)}d ${i%24}h`}function O(e){return new Intl.NumberFormat(void 0,{notation:e>=1e3?`compact`:`standard`,maximumFractionDigits:1}).format(e)}function se(e){return e.filter(e=>e.tokenTotal===0&&!e.isCurrent).map(e=>e.id)}function ce(e,t){let n=t.query.trim().toLocaleLowerCase(),r=new Set(t.favoriteIds);return[...e.filter(e=>{if(!(!n||[e.name,e.title,e.lastUserMessage,e.model,e.provider,e.id,...Object.keys(e.toolBreakdown??{})].some(e=>e?.toLocaleLowerCase().includes(n))))return!1;switch(t.filter){case`favorites`:return r.has(e.id);case`active`:return e.isCurrent;case`completed`:return!e.isCurrent&&(e.outcome===`completed`||e.outcome===void 0&&!!e.endedAt);case`issues`:return e.outcome===`error`||e.outcome===`timeout`||e.outcome===`aborted`||(e.toolErrorCount??0)>0;default:return!0}})].sort((e,n)=>{if(t.sort===`tokens`&&n.tokenTotal!==e.tokenTotal)return n.tokenTotal-e.tokenTotal;if(t.sort===`activity`){let t=w(n)-w(e);if(t!==0)return t}return C(E(n))-C(E(e))})}function le(e,t,n=Date.now()){let r=new Date(n);r.setHours(0,0,0,0);let i=r.getTime(),a=i-864e5,o=i-6*864e5,s=new Set(t),c=e.filter(e=>s.has(e.id)),l={today:[],yesterday:[],thisWeek:[],earlier:[]};for(let t of e){if(s.has(t.id))continue;let e=C(E(t));e>=i?l.today.push(t):e>=a?l.yesterday.push(t):e>=o?l.thisWeek.push(t):l.earlier.push(t)}let u=[];c.length>0&&u.push({label:`favorites`,rows:c,favorite:!0});for(let e of[`today`,`yesterday`,`thisWeek`,`earlier`])l[e].length>0&&u.push({label:e,rows:l[e]});return u}function ue(e){return e.reduce((e,t)=>({sessions:e.sessions+1,active:e.active+ +!!t.isCurrent,tokens:e.tokens+t.tokenTotal,tools:e.tools+(t.toolCallCount??0),files:e.files+(t.fileChangeCount??0),errors:e.errors+(t.toolErrorCount??0)+ +(t.outcome===`error`)}),{sessions:0,active:0,tokens:0,tools:0,files:0,errors:0})}function de(e){if(e.isCurrent)return{icon:i,label:`active`,defaultLabel:`Active`,className:`text-primary`};switch(e.outcome){case`completed`:return{icon:c,label:`completed`,defaultLabel:`Completed`,className:`text-success`};case`error`:return{icon:a,label:`error`,defaultLabel:`Error`,className:`text-destructive`};case`timeout`:return{icon:p,label:`timeout`,defaultLabel:`Timed out`,className:`text-warning`};case`aborted`:return{icon:s,label:`aborted`,defaultLabel:`Aborted`,className:`text-muted-foreground`};default:return e.endedAt?{icon:c,label:`completed`,defaultLabel:`Completed`,className:`text-success`}:{icon:n,label:`saved`,defaultLabel:`Saved session`,className:`text-muted-foreground`}}}function fe({stats:e}){let{t}=o();return(0,S.jsx)(`div`,{className:`grid grid-cols-2 border-b border-border/75 bg-card md:grid-cols-5`,children:[{label:t(`activity:sessions.stats.sessions`,{defaultValue:`Sessions`}),value:e.sessions,icon:n},{label:t(`activity:sessions.stats.tokens`,{defaultValue:`Tokens`}),value:e.tokens,icon:i},{label:t(`activity:sessions.stats.tools`,{defaultValue:`Tool calls`}),value:e.tools,icon:d},{label:t(`activity:sessions.stats.files`,{defaultValue:`Files changed`}),value:e.files,icon:h},{label:t(`activity:sessions.stats.errors`,{defaultValue:`Errors`}),value:e.errors,icon:a}].map(e=>{let t=e.icon;return(0,S.jsxs)(`div`,{className:`border-b border-r border-border/75 px-4 py-3 md:border-b-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,S.jsx)(t,{className:`h-3 w-3`}),e.label]}),(0,S.jsx)(`div`,{className:`mt-1 font-mono text-xl font-semibold tabular-nums`,children:O(e.value)})]},e.label)})})}function k({historyQuery:e,setHistoryQuery:r,historyEntries:i,historyLoading:s,historyError:c,wsConnected:p,listSessions:ee,resumeSession:g,deleteSession:C,renameSession:w,variant:k=`sidebar`}){let{t:A}=o(),j=y(e=>e.favoriteSessionIds),pe=y(e=>e.toggleFavoriteSession),M=y(e=>e.sessionNicknames),N=y(e=>e.setSessionNickname),me=y(e=>e.setInspectSession),[P,he]=(0,x.useState)(`all`),[F,ge]=(0,x.useState)(`recent`),[I,L]=(0,x.useState)(null),[R,z]=(0,x.useState)(``),[B,V]=(0,x.useState)(null),[H,U]=(0,x.useState)(1),W=(0,x.useRef)(null),G=(0,x.useRef)(null),K=k===`workspace`,q=(0,x.useCallback)(e=>e.name||M[e.id]||e.title||A(`activity:sessions.empty`),[M,A]),J=(0,x.useCallback)(e=>{L(e.id),z(e.name??M[e.id]??e.title??``)},[M]),Y=(0,x.useCallback)(e=>{L(null),N(e,R),w(e,R)},[R,w,N]);(0,x.useEffect)(()=>{B&&i.some(e=>e.id===B&&e.isCurrent)&&(V(null),W.current&&clearTimeout(W.current))},[i,B]),(0,x.useEffect)(()=>{I&&(G.current?.focus(),G.current?.select())},[I]),(0,x.useEffect)(()=>()=>{W.current&&clearTimeout(W.current)},[]);let X=(0,x.useCallback)(e=>{V(e),g(e),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>V(null),1e4)},[g]),Z=(0,x.useMemo)(()=>se(i),[i]),Q=(0,x.useMemo)(()=>ce(i,{query:e,filter:P,sort:F,favoriteIds:j}),[j,P,i,e,F]),$=K?oe:ae,_e=(0,x.useMemo)(()=>Q.slice((H-1)*$,H*$),[H,$,Q]),ve=(0,x.useMemo)(()=>le(_e,j),[j,_e]),ye=(0,x.useMemo)(()=>ue(i),[i]);(0,x.useEffect)(()=>{U(1)},[P,e,F]),(0,x.useEffect)(()=>{let e=Math.max(1,Math.ceil(Q.length/$));H>e&&U(e)},[H,$,Q.length]);let be=(0,x.useCallback)(async()=>{if(Z.length!==0&&await b({title:A(`activity:sessions.deleteEmptyTitle`,{count:Z.length}),message:A(`activity:sessions.deleteEmptyConfirmBody`),confirmLabel:A(`common:action.delete`),danger:!0}))for(let e of Z)C(e)},[C,Z,A]),xe=[{id:`all`,label:A(`activity:sessions.filters.all`,{defaultValue:`All`})},{id:`favorites`,label:A(`activity:sessions.filters.favorites`,{defaultValue:`Pinned`})},{id:`active`,label:A(`activity:sessions.filters.active`,{defaultValue:`Active`})},{id:`completed`,label:A(`activity:sessions.filters.completed`,{defaultValue:`Completed`})},{id:`issues`,label:A(`activity:sessions.filters.issues`,{defaultValue:`Issues`})}];return(0,S.jsxs)(`div`,{className:v(`flex min-h-0 min-w-0 flex-1 flex-col bg-background`,K&&`h-full`),"data-history-variant":k,children:[K?(0,S.jsx)(fe,{stats:ye}):null,(0,S.jsxs)(`div`,{className:v(`border-b border-border/75 bg-card`,K?`px-4 py-3`:`px-3 py-2`),children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:A(`activity:sessions.recentSessions`)}),K?(0,S.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:A(`activity:sessions.workspaceHint`,{defaultValue:`Search, inspect, pin and resume every project conversation.`})}):null]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center border border-border/75`,children:[Z.length>0?(0,S.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 items-center justify-center gap-1 border-r border-border/75 px-2 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive disabled:opacity-40`,onClick:be,disabled:!p,title:A(`activity:sessions.deleteEmptyTitle`,{count:Z.length}),children:[(0,S.jsx)(m,{className:`h-3.5 w-3.5`}),K?(0,S.jsx)(`span`,{className:`text-[10px]`,children:Z.length}):null]}):null,(0,S.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-8 items-center justify-center text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40`,onClick:()=>ee(200),disabled:!p,title:A(`common:action.refresh`),children:s?(0,S.jsx)(f,{className:`h-3.5 w-3.5 animate-spin`}):(0,S.jsx)(ne,{className:`h-3.5 w-3.5`})})]})]}),(0,S.jsxs)(`div`,{className:v(`grid gap-2`,K?`mt-3 lg:grid-cols-[minmax(18rem,1fr)_auto_auto]`:`mt-2`),children:[(0,S.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,S.jsx)(l,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,S.jsx)(`input`,{type:`search`,value:e,onChange:e=>r(e.target.value),placeholder:A(`activity:sessions.filterPlaceholder`),"aria-label":A(`activity:sessions.filterPlaceholder`),className:`h-9 w-full border border-border/75 bg-background pl-8 pr-8 text-xs outline-none transition-colors placeholder:text-muted-foreground/70 focus:border-primary focus:ring-1 focus:ring-primary`}),e?(0,S.jsx)(`button`,{type:`button`,onClick:()=>r(``),className:`absolute right-0 top-0 inline-flex h-9 w-8 items-center justify-center text-muted-foreground hover:text-foreground`,title:A(`activity:sessions.clearFilter`),children:(0,S.jsx)(u,{className:`h-3.5 w-3.5`})}):null]}),(0,S.jsxs)(`fieldset`,{className:`flex min-w-0 overflow-x-auto border border-border/75`,children:[(0,S.jsx)(`legend`,{className:`sr-only`,children:A(`activity:sessionList.historyFilters`)}),xe.map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>he(e.id),"aria-pressed":P===e.id,className:v(`h-9 shrink-0 border-r border-border/75 px-2.5 text-[10px] font-semibold uppercase tracking-[0.08em] transition-colors last:border-r-0`,P===e.id?`bg-foreground text-background`:`bg-background text-muted-foreground hover:bg-muted hover:text-foreground`),children:e.label},e.id))]}),(0,S.jsxs)(`select`,{value:F,onChange:e=>ge(e.target.value),"aria-label":A(`activity:sessions.sort.label`,{defaultValue:`Sort sessions`}),className:`h-9 border border-border/75 bg-background px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground outline-none focus:border-primary`,children:[(0,S.jsx)(`option`,{value:`recent`,children:A(`activity:sessions.sort.recent`,{defaultValue:`Recent`})}),(0,S.jsx)(`option`,{value:`tokens`,children:A(`activity:sessions.sort.tokens`,{defaultValue:`Most tokens`})}),(0,S.jsx)(`option`,{value:`activity`,children:A(`activity:sessions.sort.activity`,{defaultValue:`Most activity`})})]})]})]}),c?(0,S.jsx)(`div`,{className:`border-b border-destructive/30 bg-destructive/5 px-4 py-2 text-xs text-destructive`,children:c}):null,(0,S.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain overflow-x-hidden [scrollbar-gutter:stable]`,children:i.length===0&&!s?(0,S.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,S.jsx)(n,{className:`h-9 w-9 opacity-25`}),(0,S.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:A(`activity:sessions.noHistory`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs`,children:A(`activity:sessions.noHistoryHint`)})]}):ve.length===0?(0,S.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,S.jsx)(l,{className:`h-9 w-9 opacity-25`}),(0,S.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:A(`activity:sessions.noMatches`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs`,children:A(`activity:sessions.noMatchesHint`)})]}):(0,S.jsxs)(`div`,{className:v(K?`mx-auto w-full max-w-7xl p-4 lg:p-6`:`p-2`),children:[(0,S.jsx)(`div`,{className:v(`space-y-5`,K&&`grid gap-x-5 space-y-0 xl:grid-cols-2`),children:ve.map(e=>(0,S.jsxs)(`section`,{className:`min-w-0`,children:[(0,S.jsxs)(`div`,{className:v(`sticky top-0 z-[1] flex items-center gap-1 border-b border-border/75 bg-background/95 px-1 py-2 text-[10px] font-semibold uppercase tracking-[0.14em] backdrop-blur-sm`,e.favorite?`text-warning`:`text-muted-foreground`),children:[e.favorite?(0,S.jsx)(_,{className:`h-3 w-3 fill-current`}):null,A(`activity:sessions.group.${e.label}`),(0,S.jsx)(`span`,{className:`ml-1 font-mono font-normal text-muted-foreground`,children:e.rows.length})]}),(0,S.jsx)(`div`,{className:`divide-y divide-border/75 border-x border-b border-border/75`,children:e.rows.map(e=>{let n=j.includes(e.id),r=de(e),i=r.icon,o=I===e.id,s=B===e.id;return(0,S.jsxs)(`article`,{className:v(`group grid min-w-0 grid-cols-[minmax(0,1fr)_auto] bg-card transition-colors`,e.isCurrent?`border-l-2 border-l-primary bg-primary/5`:`border-l-2 border-l-transparent hover:bg-muted/45`),"data-session-id":e.id,children:[o?(0,S.jsxs)(`div`,{className:`min-w-0 px-3 py-3`,children:[(0,S.jsx)(`label`,{className:`block text-[10px] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,htmlFor:`session-name-${e.id}`,children:A(`activity:sessions.rename`,{defaultValue:`Session name`})}),(0,S.jsx)(`input`,{ref:G,id:`session-name-${e.id}`,value:R,onChange:e=>z(e.target.value),onBlur:()=>Y(e.id),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),Y(e.id)):t.key===`Escape`&&(t.preventDefault(),L(null))},placeholder:e.title||A(`activity:sessions.nicknamePlaceholder`),className:`mt-1 h-8 w-full border border-primary bg-background px-2 text-sm outline-none ring-1 ring-primary`})]}):(0,S.jsx)(`button`,{type:`button`,disabled:e.isCurrent||B!==null,onClick:()=>X(e.id),onDoubleClick:()=>J(e),"aria-current":e.isCurrent?`page`:void 0,className:`min-w-0 px-3 py-3 text-left outline-none focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary disabled:cursor-default`,children:(0,S.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,S.jsx)(`span`,{className:v(`mt-0.5 shrink-0`,r.className),title:A(`activity:sessions.status.${r.label}`,{defaultValue:r.defaultLabel}),children:(0,S.jsx)(i,{className:v(`h-3.5 w-3.5`,e.isCurrent&&`animate-pulse`)})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,title:q(e),children:q(e)}),(0,S.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:[e.provider,`/`,e.model]}),e.lastUserMessage?(0,S.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted-foreground`,title:e.lastUserMessage,children:e.lastUserMessage}):null,(0,S.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 font-mono text-[10px] text-muted-foreground`,children:[s?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-sans font-semibold text-primary`,children:[(0,S.jsx)(f,{className:`h-3 w-3 animate-spin`}),A(`activity:sessions.resuming`)]}):(0,S.jsx)(`span`,{title:new Date(E(e)).toLocaleString(),children:T(E(e))}),(0,S.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,S.jsx)(`span`,{children:D(e)}),e.tokenTotal>0?(0,S.jsxs)(`span`,{children:[O(e.tokenTotal),` tok`]}):null,(e.messageCount??0)>0?(0,S.jsxs)(`span`,{children:[O(e.messageCount??0),` msg`]}):null,(e.toolCallCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,S.jsx)(d,{className:`h-3 w-3`}),e.toolCallCount]}):null,(e.fileChangeCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,S.jsx)(h,{className:`h-3 w-3`}),e.fileChangeCount]}):null,(e.toolErrorCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-destructive`,children:[(0,S.jsx)(a,{className:`h-3 w-3`}),e.toolErrorCount]}):null]})]})]})}),(0,S.jsxs)(`div`,{className:`flex items-start gap-0.5 p-2`,children:[!e.isCurrent&&K&&!o?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>X(e.id),disabled:B!==null,className:`inline-flex h-7 items-center gap-1 border border-border/75 px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:border-primary hover:text-primary disabled:opacity-40`,title:A(`activity:sessions.resume`,{defaultValue:`Resume session`}),children:[(0,S.jsx)(re,{className:`h-3 w-3`}),A(`activity:sessions.resumeShort`,{defaultValue:`Resume`})]}):null,o?null:(0,S.jsx)(`button`,{type:`button`,onClick:()=>me(e.id),className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-primary/10 hover:text-primary`,title:A(`activity:sessions.inspect`,{defaultValue:`Inspect session`}),children:(0,S.jsx)(te,{className:`h-3.5 w-3.5`})}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>pe(e.id),"aria-pressed":n,className:v(`inline-flex h-7 w-7 items-center justify-center transition-colors hover:bg-warning/10 hover:text-warning`,n?`text-warning`:`text-muted-foreground`),title:A(n?`activity:sessions.unfavorite`:`activity:sessions.markFavorite`),children:(0,S.jsx)(_,{className:v(`h-3.5 w-3.5`,n&&`fill-current`)})}),o?null:(0,S.jsx)(`button`,{type:`button`,onClick:()=>J(e),className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-primary/10 hover:text-primary`,title:A(`activity:sessions.renameAction`,{defaultValue:`Rename`}),children:(0,S.jsx)(t,{className:`h-3.5 w-3.5`})}),e.isCurrent?null:(0,S.jsx)(`button`,{type:`button`,onClick:async()=>{await b({title:A(`activity:sessions.deleteSessionConfirmTitle`),message:A(`activity:sessions.deleteSessionConfirmBody`,{name:q(e)}),confirmLabel:A(`common:action.delete`),danger:!0})&&C(e.id)},className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,title:A(`activity:sessions.deleteSessionTitle`),children:(0,S.jsx)(m,{className:`h-3.5 w-3.5`})})]})]},e.id)})})]},e.label))}),(0,S.jsx)(ie,{page:H,pageSize:$,totalItems:Q.length,onPageChange:U,compact:!K,itemLabel:`sessions`})]})})]})}export{D as i,O as n,T as r,k as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Ar as n,Cn as r,Jt as i,La as a,Pa as o,Pr as s,Qi as c,Si as l,Wt as u,Xi as d,di as f,en as p,ir as m,ja as h,la as g,lt as _,t as v,vn as y,ya as b,yr as x,za as S}from"./vendor-BuarzSSb.js";import"./i18n-9T7iGYgW.js";import{t as ee}from"./useWebSocket-CZSpbA3M.js";import{t as C}from"./ws-client-TTMa0XaT.js";import{t as w}from"./utils-B-9lSDIn.js";import{I as te}from"./stores-vuG0AaKy.js";import{o as T}from"./view-navigation-DIDEcp4V.js";import{n as E}from"./Toaster-BgN2bRJx.js";import{a as D,n as ne,o as re,r as O,t as k}from"./dialog-ftgTihmF.js";import{t as A}from"./button-Dcy288Mc.js";import{t as j}from"./input-fo9-BPBC.js";import{D as M,a as N,b as P,i as F,r as I,t as L,x as R}from"./index-FHt-sKVF.js";var z=e(S(),1);function B(e,t=8e3){return new Promise((n,r)=>{let i=setTimeout(()=>{a(),r(Error(`timeout`))},t),a=e.on(`key.operation_result`,e=>{clearTimeout(i),a(),n(e.payload)})})}var V=_();function ie({onKeySaved:e}){let{t}=o(),[n,i]=(0,z.useState)(!1),[a,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(`openai-compatible`),[u,f]=(0,z.useState)(``),[p,h]=(0,z.useState)(``),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)([]),{setFieldRef:b,handleKeyDown:x}=N(),S=async()=>{if(a.trim()){_(!0);try{let n=C(te.getState().wsUrl),r=B(n);n.send({type:`provider.add`,payload:{id:a.trim(),family:c,baseUrl:u.trim()||void 0,apiKey:p.trim()||void 0,models:v.length>0?v.map(e=>e.id):void 0,customModels:v.length>0?Object.fromEntries(v.filter(e=>e.name||e.maxOutput||e.capabilities).map(e=>[e.id,{...e.name&&e.name!==e.id?{name:e.name}:{},...e.maxOutput?{maxOutput:e.maxOutput}:{},...e.capabilities&&Object.values(e.capabilities).some(Boolean)?{capabilities:e.capabilities}:{}}])):void 0}});let o=await r;if(!o.success)throw Error(o.message);E.success(t(`setup:screen.toasts.providerAdded`,{id:a.trim()})),e(a.trim()),n.listSavedProviders(),n.probeProvider(a.trim()),s(``),f(``),h(``),y([]),i(!1)}catch(e){let n=e instanceof Error&&e.message&&e.message!==`timeout`?e.message:null;E.error(n??t(`setup:screen.toasts.providerAddFailed`))}finally{_(!1)}}};return(0,V.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/60 overflow-hidden`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>i(!n),className:`w-full flex items-center gap-3 p-4 text-left hover:bg-muted/30 transition-colors`,children:[(0,V.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center`,children:(0,V.jsx)(r,{className:`h-5 w-5 text-muted-foreground`})}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium`,children:t(`setup:screen.custom.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`setup:screen.custom.description`)})]}),(0,V.jsx)(d,{className:w(`h-4 w-4 text-muted-foreground transition-transform`,n&&`rotate-90`)})]}),n&&(0,V.jsxs)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/40`,children:[(0,V.jsxs)(`div`,{className:`space-y-1.5 pt-3`,children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground block`,children:t(`setup:screen.custom.localServers`)}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:I.map(e=>(0,V.jsx)(A,{type:`button`,size:`sm`,variant:a===e.id?`default`:`outline`,onClick:()=>{s(e.id),l(`openai-compatible`),f(e.defaultBaseUrl),e.noAuth&&h(``),y([])},title:e.hint,children:e.label},e.id))})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.providerId`)}),(0,V.jsx)(j,{placeholder:t(`activity:customProviderSection.eGMyLlm`),value:a,onChange:e=>s(e.target.value),className:`text-sm`,ref:b(0),onKeyDown:e=>x(e,0)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.family`)}),(0,V.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm`,ref:b(1),onKeyDown:e=>x(e,1),children:[(0,V.jsx)(`option`,{value:`openai-compatible`,children:t(`setup:screen.custom.familyOpenAiCompatible`)}),(0,V.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,V.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,V.jsx)(`option`,{value:`google`,children:`Google`})]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.baseUrl`)}),(0,V.jsx)(j,{placeholder:t(`activity:customProviderSection.eGHttpLocalhost11434V1`),value:u,onChange:e=>f(e.target.value),className:`text-sm font-mono`,ref:b(2),onKeyDown:e=>x(e,2)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.apiKey`)}),(0,V.jsx)(j,{type:`password`,placeholder:t(`setup:screen.custom.apiKeyPlaceholder`),value:p,onChange:e=>h(e.target.value),className:`text-sm font-mono`,ref:b(3),onKeyDown:e=>x(e,3)})]}),(0,V.jsx)(L,{models:v,onChange:y}),(0,V.jsxs)(A,{onClick:S,disabled:!a.trim()||g,size:`sm`,ref:b(4),onKeyDown:e=>x(e,4,S),children:[g?(0,V.jsx)(m,{className:`h-4 w-4 animate-spin mr-2`}):null,t(`setup:screen.custom.add`)]})]})]})}var H=F();async function ae(e,t){try{let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(!Array.isArray(r))throw Error(`Expected JSON array`);let i=r.filter(e=>typeof e.id==`string`&&typeof e.name==`string`&&typeof e.family==`string`);return i.length>0?i:H}catch{return H}}function oe(e,t){let n=new Date().getTime()-e.getTime(),r=Math.floor(n/1e3);if(r<10)return t(`setup:screen.time.justNow`);if(r<60)return t(`setup:screen.time.secondsAgo`,{count:r});let i=Math.floor(r/60);if(i<60)return t(`setup:screen.time.minutesAgo`,{count:i});let a=Math.floor(i/60);return a<24?t(`setup:screen.time.hoursAgo`,{count:a}):t(`setup:screen.time.daysAgo`,{count:Math.floor(a/24)})}var se=e(v(),1);function ce({popular:e,catalogProvider:n,savedProvider:r,onKeySaved:i,probeResult:a}){let{t:u}=o(),[h,g]=(0,z.useState)(``),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(!!r?.apiKeys.some(e=>e.isActive)),[x,S]=(0,z.useState)(!1),[ee,T]=(0,z.useState)(!1),[M,N]=(0,z.useState)(!1),[P,F]=(0,z.useState)(null);(0,z.useEffect)(()=>{M&&e.referral&&se.toDataURL(e.referral.url,{width:200,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).then(e=>F(e)).catch(()=>F(null))},[M,e.referral]);let I=async()=>{if(h.trim()){v(!0);try{let t=C(te.getState().wsUrl),r=B(t);n?t.addKey(e.id,`default`,h.trim()):t.send({type:`provider.add`,payload:{id:e.id,family:e.family,apiKey:h.trim()}});let a=await r;if(!a.success)throw Error(a.message);b(!0),g(``),E.success(u(`setup:screen.toasts.keySaved`,{name:e.name})),i(e.id),t.listSavedProviders(),t.probeProvider(e.id)}catch(t){let n=t instanceof Error&&t.message&&t.message!==`timeout`?t.message:null;E.error(n??u(`setup:screen.toasts.keySaveFailed`,{name:e.name}))}finally{v(!1)}}},L=e=>{e.key===`Enter`&&h.trim()&&I()},R=async()=>{if(e.referral)try{await navigator.clipboard.writeText(e.referral.url),T(!0),E.success(u(`setup:screen.toasts.referralCopied`)),setTimeout(()=>T(!1),2e3)}catch{E.error(u(`setup:screen.toasts.referralCopyFailed`))}},ie=n&&n.modelCount>0;return(0,V.jsxs)(`div`,{className:w(`rounded-xl border p-4 transition-all`,y?`border-success/30 bg-success/5`:`bg-gradient-to-br ${e.color}`),children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`text-2xl shrink-0 mt-0.5`,children:e.icon}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),y&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-success/10 text-success border border-success/20`,children:[(0,V.jsx)(t,{className:`h-2.5 w-2.5`}),u(`setup:screen.card.keySaved`)]}),e.referral&&!y&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-warning/10 text-warning border border-warning/20`,children:[(0,V.jsx)(s,{className:`h-2.5 w-2.5`}),u(`setup:screen.card.referral`)]})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),e.referral&&!y&&(0,V.jsxs)(`p`,{className:`text-[11px] text-warning/80 mt-1`,children:[`🎁 `,e.referral.reward]}),y?y?(0,V.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[r?.baseUrl&&(0,V.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70 font-mono truncate`,title:r.baseUrl,children:[(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[u(`activity:providerKey.url`),` `]}),r.baseUrl]}),r?.models&&r.models.length>0&&(0,V.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70`,children:[(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[u(`activity:providerKey.models`),` `]}),r.pickedModelId??r.models[0],(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[` (+`,r.models.length-1,` more)`]})]}),a===`probing`?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mt-1`,children:[(0,V.jsx)(m,{className:`h-3 w-3 animate-spin`}),u(`setup:screen.probe.checking`,`Checking connection…`)]}):a?.ok?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-success mt-1`,children:[(0,V.jsx)(t,{className:`h-3 w-3`}),(0,V.jsxs)(`span`,{children:[u(`setup:screen.probe.connected`,`Connected`),a.modelCount!=null&&` · ${a.modelCount} ${u(`setup:screen.probe.models`,`models`)}`,a.elapsedMs!=null&&` · ${a.elapsedMs}ms`]})]}):a&&!a.ok?(0,V.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-destructive mt-1`,children:[(0,V.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:`✕`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:u(`setup:screen.probe.failed`,`Probe failed`)}),a.status===`no_base_url`&&(0,V.jsx)(`span`,{className:`block text-destructive/70`,children:u(`setup:screen.probe.noBaseUrl`,`No base URL configured`)}),a.status===`unreachable`&&(0,V.jsxs)(`span`,{className:`block text-destructive/70`,children:[u(`setup:screen.probe.unreachable`,`Could not connect`),a.detail?`: ${a.detail}`:``]}),a.status!==`no_base_url`&&a.status!==`unreachable`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`block text-destructive/70`,children:a.httpStatus==null?a.status:`${u(`setup:screen.probe.httpStatus`,`Status`)} ${a.httpStatus}`}),a.detail&&(0,V.jsx)(`span`,{className:`block text-destructive/70 truncate max-w-[250px]`,title:a.detail,children:a.detail})]})]})]}):null,ie&&(0,V.jsxs)(`button`,{type:`button`,onClick:()=>S(!x),className:`text-[11px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[u(`setup:screen.providers.modelsAvailable`,{count:n?.modelCount??0}),x?(0,V.jsx)(c,{className:`h-3 w-3`}):(0,V.jsx)(d,{className:`h-3 w-3`})]})]}):null:(0,V.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(j,{type:`password`,placeholder:e.keyPlaceholder,value:h,onChange:e=>g(e.target.value),onKeyDown:L,className:`font-mono text-sm`}),(0,V.jsx)(A,{onClick:I,disabled:!h.trim()||_,size:`sm`,className:`shrink-0`,children:_?(0,V.jsx)(m,{className:`h-4 w-4 animate-spin`}):u(`setup:screen.card.save`)})]}),e.docsUrl&&(0,V.jsxs)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors`,children:[u(`setup:screen.card.getKey`),` `,(0,V.jsx)(f,{className:`h-3 w-3`})]}),e.referral&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:R,className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:ee?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(t,{className:`h-3 w-3`}),` `,u(`setup:screen.card.copied`)]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(l,{className:`h-3 w-3`}),` `,u(`setup:screen.card.copyReferral`)]})}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>N(!0),className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:[(0,V.jsx)(p,{className:`h-3 w-3`}),` `,u(`setup:screen.card.share`)]})]})]})]})]}),(0,V.jsx)(k,{open:M,onOpenChange:N,children:(0,V.jsxs)(ne,{className:`sm:max-w-md`,children:[(0,V.jsxs)(D,{children:[(0,V.jsxs)(re,{className:`flex items-center gap-2`,children:[(0,V.jsx)(s,{className:`h-4 w-4 text-warning`}),u(`setup:screen.share.title`,{name:e.name})]}),(0,V.jsx)(O,{children:u(`setup:screen.share.description`)})]}),(0,V.jsx)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:e.referral&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`text-sm text-center`,children:(0,V.jsxs)(`p`,{className:`font-medium text-warning`,children:[`🎁 `,e.referral.reward]})}),P?(0,V.jsx)(`div`,{className:`rounded-lg border border-border p-2 bg-white`,children:(0,V.jsx)(`img`,{src:P,alt:u(`setup:screen.card.qrAlt`,{name:e.name}),className:`w-[200px] h-[200px]`})}):(0,V.jsx)(`div`,{className:`w-[200px] h-[200px] rounded-lg border border-border flex items-center justify-center bg-muted`,children:(0,V.jsx)(m,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),(0,V.jsxs)(`div`,{className:`w-full space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://twitter.com/intent/tweet?text=${t}&url=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:u(`setup:screen.share.twitter`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z`})}),`X`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`Check out ${e.name}! ${e.referral.reward}`);window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${t}&summary=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:u(`setup:screen.share.linkedin`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`})}),u(`activity:providerKey.linkedin`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward} ${e.referral.url}`);window.open(`https://t.me/share/url?url=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:u(`setup:screen.share.telegram`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z`})}),u(`activity:providerKey.telegram`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://wa.me/?text=${t}%20${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:u(`setup:screen.share.whatsapp`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.134 1.585 5.934L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z`})}),u(`activity:providerKey.whatsapp`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`${e.name} - ${e.referral.reward}`);window.open(`https://www.reddit.com/submit?url=${t}&title=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:u(`setup:screen.share.reddit`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 0 1.108-.701 1.25 1.25 0 0 1 2.144.33zm-8.811 8.748c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754zm7.944 0c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754z`})}),u(`activity:providerKey.reddit`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://www.facebook.com/sharer/sharer.php?u=${n}&quote=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:u(`setup:screen.share.facebook`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z`})}),u(`activity:providerKey.facebook`)]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`mailto:?subject=${t}&body=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs hover:bg-muted/80 transition-colors`,title:u(`setup:screen.share.email`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25H4.5a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75`})}),u(`activity:providerKey.email`)]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(j,{value:e.referral.url,readOnly:!0,className:`font-mono text-xs flex-1`}),(0,V.jsx)(A,{size:`sm`,variant:`outline`,onClick:R,className:`shrink-0`,children:ee?(0,V.jsx)(t,{className:`h-4 w-4`}):(0,V.jsx)(l,{className:`h-4 w-4`})})]}),(0,V.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:u(`setup:screen.share.hint`)})]})]})})]})})]})}function U(){let{t:e}=o(),{model:r,setProvider:s,setModel:c,wsConnected:l,wsUrl:f}=te(h(e=>({model:e.model,setProvider:e.setProvider,setModel:e.setModel,wsConnected:e.wsConnected,wsUrl:e.wsUrl})));ee();let[p,_]=(0,z.useState)([]),[v,S]=(0,z.useState)({}),[D,ne]=(0,z.useState)([]),[re,O]=(0,z.useState)(!1),[k,j]=(0,z.useState)(null),[N,F]=(0,z.useState)(0),[I,L]=(0,z.useState)(new Set),[B,se]=(0,z.useState)({}),[U,le]=(0,z.useState)(H),[W,G]=(0,z.useState)(!1),[ue,de]=(0,z.useState)(0),[fe,pe]=(0,z.useState)(0),[K,me]=(0,z.useState)(null),q=(0,z.useRef)(!0);(0,z.useEffect)(()=>{let e=new AbortController,t=`${window.location.origin}/providers.json`;return G(!0),ae(t,e.signal).then(t=>{if(t!==H){if(le(t),G(!1),!q.current){let e=t.length-fe;e>0?E.success(a.t(`setup:screen.toasts.providersLoadedNew`,{count:t.length,diff:e})):e<0?E.success(a.t(`setup:screen.toasts.providersLoadedRemoved`,{count:t.length,diff:Math.abs(e)})):E.success(a.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:t.length})),pe(t.length)}me(new Date);return}return ae(`https://raw.githubusercontent.com/WrongStack/WrongStack/main/packages/webui/public/providers.json`,e.signal)}).then(e=>{if(e){if(le(e),!q.current){let t=e.length-fe;t>0?E.success(a.t(`setup:screen.toasts.providersLoadedNew`,{count:e.length,diff:t})):t<0?E.success(a.t(`setup:screen.toasts.providersLoadedRemoved`,{count:e.length,diff:Math.abs(t)})):E.success(a.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:e.length})),pe(e.length)}me(new Date)}}).catch(()=>{q.current||E.error(a.t(`setup:screen.toasts.providersRefreshFailed`))}).finally(()=>{G(!1),q.current=!1}),()=>e.abort()},[ue]);let[J,he]=(0,z.useState)(null),[Y,X]=(0,z.useState)(null),[ge,_e]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!l)return;let e=C(f),t=setTimeout(()=>{t=null,O(!1),j(a.t(`setup:screen.errors.backendNotResponding`))},8e3),n=()=>{t&&=(clearTimeout(t),null)},i=e.on(`provider.catalog`,e=>{if(e.type===`provider.catalog`){n(),j(null);let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));_(t),O(!1)}}),o=e.on(`provider.models`,e=>{if(e.type===`provider.models`){let t=e.payload;if(t.provider!==J)return;S(e=>({...e,[t.provider]:t.models})),_e(!1),t.models.length===1?X(t.models[0].id):r&&t.models.some(e=>e.id===r)&&X(r)}}),s=e.on(`providers.saved`,e=>{if(e.type===`providers.saved`){let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));ne(t);let n=new Set(t.filter(e=>e.apiKeys.some(e=>e.isActive)).map(e=>e.id));L(n)}}),c=e.on(`provider.probe`,e=>{if(e.type!==`provider.probe`)return;let t=e.payload;se(e=>({...e,[t.providerId]:t}))});return j(null),O(!0),e.listProviders(),()=>{n(),i?.(),o?.(),s?.(),c?.()}},[l,f,r,N,J]);let ve=(0,z.useCallback)(()=>{j(null),F(e=>e+1)},[]),ye=(0,z.useCallback)(()=>{de(e=>e+1)},[]),be=(0,z.useCallback)(t=>oe(t,e),[e]),Z=(0,z.useCallback)(e=>{L(t=>new Set([...t,e])),he(e),X(null)},[]),xe=I.size>0;(0,z.useEffect)(()=>{if(!J||!l)return;let e=C(f);v[J]||(_e(!0),e.listProviderModels(J))},[J,l,f,v]);let Se=J?v[J]??[]:[],Ce=(0,z.useCallback)(async()=>{if(!J||!Y)return;if(!I.has(J)){E.error(`Please save the provider configuration before starting a session.`);return}s(J),c(Y);let e=C(f),t=await e.switchModel(J,Y,5e3);t.success?(e.newSession(),T(`chat`)):E.error(t.message||a.t(`setup:screen.errors.modelSwitchTimeout`))},[J,Y,s,c,f]),we=(0,z.useCallback)(async()=>{if(!J||!Y)return;s(J),c(Y);let e=await C(f).switchModel(J,Y,5e3);e.success?T(`chat`):E.error(e.message||a.t(`setup:screen.errors.modelSwitchTimeout`))},[J,Y,s,c,f]),Te=new Set(U.map(e=>e.id)),Ee=p.filter(e=>!Te.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id)),Q=R(Ee,10);R(D,9);let $=R(Se,12,J);return(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,V.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b bg-card px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.jsx)(`img`,{src:`/wrongstack.svg`,alt:`WrongStack`,draggable:!1,className:`ws-brand-logo h-10 w-10 shrink-0 border border-border/70 shadow-sm`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:e(`setup:screen.header.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground sm:truncate`,children:e(`setup:screen.header.subtitle`)})]})]}),xe&&J?(0,V.jsxs)(`span`,{className:`text-xs text-success/80`,children:[(0,V.jsx)(t,{className:`h-3 w-3 inline-block mr-1`}),e(`setup:screen.header.continue`)]}):null]}),(0,V.jsx)(M,{className:`min-h-0 flex-1`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-4 pb-4 sm:p-6`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,xe?`text-success`:`text-primary font-medium`),children:[(0,V.jsx)(x,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.addKeys`)})]}),(0,V.jsx)(d,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,J?`text-primary font-medium`:`text-muted-foreground`),children:[(0,V.jsx)(g,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,V.jsx)(d,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,J&&Y?`text-primary font-medium`:`text-muted-foreground`),children:[(0,V.jsx)(u,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,V.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-primary/20 bg-primary/5 p-4`,children:[(0,V.jsx)(i,{className:`h-5 w-5 text-primary shrink-0 mt-0.5`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium`,children:e(`setup:screen.security.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`setup:screen.security.body`)})]})]}),k?(0,V.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 py-12 rounded-xl border border-destructive/30 bg-destructive/5 px-6`,children:[(0,V.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-destructive/10 border border-destructive/30 flex items-center justify-center`,children:(0,V.jsx)(n,{className:`h-6 w-6 text-destructive`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e(`setup:screen.errors.backendUnreachable`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 max-w-sm`,children:k})]}),(0,V.jsxs)(A,{onClick:ve,size:`sm`,variant:`outline`,children:[(0,V.jsx)(m,{className:`h-4 w-4 mr-2`}),e(`setup:screen.errors.retry`)]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.popular`)}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[W&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,V.jsx)(m,{className:`h-3 w-3 animate-spin`}),e(`setup:screen.providers.updating`)]}),K&&!W&&(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,title:K.toLocaleString(),children:be(K)}),(0,V.jsxs)(`button`,{type:`button`,onClick:ye,disabled:W,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,title:e(`setup:screen.providers.refreshTitle`),children:[(0,V.jsx)(y,{className:w(`h-3 w-3`,W&&`animate-spin`)}),e(`setup:screen.providers.refresh`)]})]})]}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:U.map(e=>(0,V.jsx)(ce,{popular:e,catalogProvider:p.find(t=>t.id===e.id),savedProvider:D.find(t=>t.id===e.id),onKeySaved:Z,probeResult:B[e.id]},e.id))})]}),Ee.length>0&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.more`)}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Q.pageItems.map(t=>(0,V.jsx)(ce,{popular:{id:t.id,name:t.name,description:e(`setup:screen.providers.catalogDescription`,{family:t.family,count:t.modelCount}),icon:`🔗`,color:`from-muted/60 to-muted/20 border-border hover:border-primary/40`,keyPlaceholder:`API key`,family:t.family},catalogProvider:t,savedProvider:D.find(e=>e.id===t.id),onKeySaved:Z,probeResult:B[t.id]},t.id))}),(0,V.jsx)(P,{page:Q.page,pageSize:Q.pageSize,totalItems:Q.totalItems,onPageChange:Q.setPage,itemLabel:`providers`})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.selfHosted`)}),(0,V.jsx)(ie,{onKeySaved:Z})]})]}),re&&(0,V.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,V.jsx)(m,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),J&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,V.jsx)(u,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseModel`)]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>{he(null),X(null)},className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:e(`setup:screen.start.addMoreKeys`)})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`setup:screen.start.modelsFor`,{provider:J})}),ge?(0,V.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,V.jsx)(m,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):Se.length>0?(0,V.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:$.pageItems.map(e=>{let n=e.contextWindow?`${(e.contextWindow/1e6).toFixed(0)}M ctx`:null;return(0,V.jsx)(`button`,{type:`button`,onClick:()=>X(e.id),className:w(`w-full text-left rounded-xl border p-3 transition-all`,`hover:border-primary/40 hover:bg-primary/5`,Y===e.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border bg-card`),children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[n&&(0,V.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:n}),e.capabilities.slice(0,3).map(e=>(0,V.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:e},e))]})]}),Y===e.id&&(0,V.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary`,children:(0,V.jsx)(t,{className:`h-3 w-3 text-primary-foreground`})})]})},e.id)})}):(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground py-8 text-center`,children:e(`setup:screen.errors.noModels`)}),(0,V.jsx)(P,{page:$.page,pageSize:$.pageSize,totalItems:$.totalItems,onPageChange:$.setPage,itemLabel:`models`})]}),J&&Y&&(0,V.jsxs)(`div`,{className:`sticky bottom-0 -mx-4 border-t bg-background/80 px-4 py-4 backdrop-blur-sm sm:-mx-6 sm:px-6`,children:[(0,V.jsx)(`div`,{className:`mb-3 flex min-w-0 items-center justify-between gap-2 text-sm text-muted-foreground`,children:(0,V.jsxs)(`span`,{className:`min-w-0 truncate`,children:[J,` / `,Y]})}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,V.jsxs)(A,{onClick:Ce,className:`flex-1`,size:`lg`,children:[(0,V.jsx)(g,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.startSession`),(0,V.jsx)(b,{className:`h-4 w-4 ml-2`})]}),(0,V.jsxs)(A,{onClick:we,variant:`outline`,className:`flex-1`,size:`lg`,children:[(0,V.jsx)(t,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.saveConfig`)]})]}),(0,V.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60 text-center mt-2`,children:e(`setup:screen.start.saveConfigHint`)})]})]})})]})}export{U as SetupScreen};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-BuarzSSb.js","assets/rolldown-runtime-QTnfLwEv.js","assets/monaco-BLUV5g0U.js","assets/monaco-Bowa0-zp.css","assets/markdown-sSmz-Ua_.js","assets/vendor-BMdWcCR4.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Ar as n,Dn as r,La as i,Pa as ee,Si as te,Wr as ne,Wt as re,Xi as ie,Xr as ae,Zi as oe,da as se,dt as a,ga as o,gi as ce,ir as s,jn as le,jt as c,lt as l,vn as ue,za as u}from"./vendor-BuarzSSb.js";import"./i18n-9T7iGYgW.js";import{s as d}from"./monaco-BLUV5g0U.js";import{t as de}from"./useWebSocket-CZSpbA3M.js";import{t as f}from"./utils-B-9lSDIn.js";import{n as fe}from"./ui-store-CE4-TlwB.js";import{o as pe}from"./view-navigation-DIDEcp4V.js";import{a as me,n as he,o as ge,t as _e}from"./dialog-ftgTihmF.js";import{p}from"./markdown-sSmz-Ua_.js";import{c as ve,g as m,u as h}from"./index-FHt-sKVF.js";import{t as ye}from"./empty-state-RRSqQaCk.js";var g=e(u(),1),_=l(),be=(0,g.lazy)(()=>d(()=>import(`./vendor-BuarzSSb.js`).then(e=>e.S),__vite__mapDeps([0,1,2,3,4,5])));function v(e){return e===`project`||e===`user`}function xe(e){let t=e.match(/^(.+?)\/SKILL(?:\.save)?\.md$/);return t?t[1]:null}function Se({source:e}){let{t}=ee(),n=e===`project`?`project`:e===`user`?`user`:`bundled`;return(0,_.jsx)(`span`,{className:f(`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide`,n===`project`&&`border-success/25 bg-success/8 text-success`,n===`user`&&`border-primary/25 bg-primary/10 text-primary`,n===`bundled`&&`border-border/70 bg-muted/60 text-muted-foreground`),children:t(`activity:skillDetail.${{project:`scopeProject`,user:`scopeGlobal`,bundled:`scopeBundled`}[n]}`)})}function y({className:e}){let{t:l}=ee(),{client:u}=de(),d=fe(e=>e.skillsState),y=fe(e=>e.setSkillsState),b=d.selectedSkill,x=d.navHistory,S=d.historyIndex,[C,w]=(0,g.useState)(null),[Ce,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)(null),we=ve(`skill-detail`,!!C),[O,k]=(0,g.useState)(!1),[A,j]=(0,g.useState)(``),[M,N]=(0,g.useState)(!1),[P,F]=(0,g.useState)(null),[I,L]=(0,g.useState)(!1),[R,z]=(0,g.useState)(null),[Te,B]=(0,g.useState)(!1),V=(0,g.useRef)(``),[Ee,De]=(0,g.useState)(!1),[H,U]=(0,g.useState)(null),[Oe,ke]=(0,g.useState)(!1),[W,G]=(0,g.useState)(null),[K,Ae]=(0,g.useState)(!1),[je,Me]=(0,g.useState)([]),q=(0,g.useRef)(d);q.current=d;let J=(0,g.useRef)(!1),Y=(0,g.useMemo)(()=>A?{lines:A.split(`
3
- `).length,words:A.trim()?A.trim().split(/\s+/).length:0,chars:A.length}:{lines:0,words:0,chars:0},[A]),X=(0,g.useMemo)(()=>{if(!A)return null;let e=5*1024*1024,t=new Blob([A]).size;return t>=e?{level:`critical`,used:t,limit:e}:t>=4194304?{level:`warn`,used:t,limit:e}:null},[A]);(0,g.useEffect)(()=>{if(!R)return;let e=setTimeout(()=>z(null),2e3);return()=>clearTimeout(e)},[R]),(0,g.useEffect)(()=>{if(!O||!b)return;let e=setInterval(()=>{A&&A!==V.current&&(V.current=A,localStorage.setItem(`skills_draft_${b.name}`,JSON.stringify({content:A,savedAt:Date.now()})),z(Date.now()))},5e3);return()=>clearInterval(e)},[O,A,b]),(0,g.useEffect)(()=>{if(!b||!O)return;let e=localStorage.getItem(`skills_draft_${b.name}`);if(e)try{let{content:t}=JSON.parse(e);t&&t!==A&&t!==V.current&&(j(t),V.current=t,B(!0))}catch{}},[b?.name,O]),(0,g.useEffect)(()=>{if(!u||!b)return;T(!0),w(null),D(null);let e=setTimeout(()=>{T(!1),D(i.t(`activity:skillDetail.timeoutError`))},1e4),t=t=>{clearTimeout(e);let n=t;n.payload.error?D(n.payload.error):n.payload.name&&w(n.payload),T(!1)},n=e=>{let t=e;De(!1);let n=q.current;if(t.payload.success){let e={...n.knownRefs};for(let n of t.payload.updated??[])e[n.name]=n.newRef;y({...n,knownRefs:e,updateAvailableCount:0}),U({updated:t.payload.updated??[],unchanged:t.payload.unchanged??[],errors:t.payload.errors??[]}),u.send({type:`skills.list`},{echoToChat:!1})}else U({updated:[],unchanged:[],errors:[{name:``,error:t.payload.error??i.t(`activity:skillDetail.updateFailed`)}]})},r=e=>{let t=e;t.payload.skills&&Me(t.payload.skills)};return u.on(`skills.content`,t),u.on(`skills.updated`,n),u.on(`skills.list`,r),u.send({type:`skills.content`,payload:{name:b.name,source:b.source}}),()=>{clearTimeout(e),u.off(`skills.content`,t),u.off(`skills.updated`,n),u.off(`skills.list`,r)}},[u,b?.name,b?.source]),(0,g.useEffect)(()=>{O&&(k(!1),j(``),F(null))},[b?.name]);let Z=(0,g.useCallback)(e=>je.find(t=>t.name.toLowerCase()===e.toLowerCase()),[je]),Q=(0,g.useCallback)(e=>{let t=Z(e);if(t){J.current=!1;let e=x.slice(0,S+1);e.push(t),y({...q.current,selectedSkill:t,navHistory:e,historyIndex:e.length-1}),k(!1),j(``),U(null)}},[Z,x,S,y]),Ne=(0,g.useCallback)(()=>{if(S<=0)return;J.current=!0;let e=S-1,t=x[e];y({...q.current,selectedSkill:t,historyIndex:e}),k(!1),j(``),U(null)},[S,x,y]),Pe=(0,g.useCallback)(()=>{if(S>=x.length-1)return;J.current=!0;let e=S+1,t=x[e];y({...q.current,selectedSkill:t,historyIndex:e}),k(!1),j(``),U(null)},[S,x,y]),$=(0,g.useCallback)(()=>{pe(`chat`)},[]),Fe=(0,g.useCallback)(()=>{C&&(j(C.body),V.current=C.body,B(!1),F(null),k(!0),L(!1))},[C]),Ie=(0,g.useCallback)(()=>{k(!1),j(``),F(null),L(!1),B(!1),b&&localStorage.removeItem(`skills_draft_${b.name}`)},[b]),Le=(0,g.useCallback)(()=>{!b||!C||(B(!1),j(C.body),V.current=C.body,b&&localStorage.removeItem(`skills_draft_${b.name}`))},[b,C]),Re=(0,g.useCallback)(()=>{if(!u||!b||!A.trim())return;N(!0),F(null);let e=t=>{let n=t;N(!1),n.payload.success?(V.current=``,localStorage.removeItem(`skills_draft_${b.name}`),B(!1),k(!1),u.send({type:`skills.content`,payload:{name:b.name,source:b.source}}),u.send({type:`skills.list`},{echoToChat:!1})):F(n.payload.error??i.t(`activity:skillDetail.saveFailed`)),u.off(`skills.edited`,e)};u.on(`skills.edited`,e),u.editSkill(b.name,A)},[u,b,A]),ze=(0,g.useCallback)(()=>{!u||!b||(De(!0),U(null),u.checkForUpdates(b.name,b.source===`user`))},[u,b]),Be=(0,g.useCallback)(()=>{b?.sourceUrl&&navigator.clipboard.writeText(b.sourceUrl).then(()=>{ke(!0),setTimeout(()=>ke(!1),2e3)})},[b]),Ve=(0,g.useCallback)(()=>{if(!C?.body)return;let e=new Blob([C.body],{type:`text/markdown`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${C.name.replace(/\//g,`_`)}-SKILL.md`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},[C]),He=(0,g.useCallback)(async e=>{if(!u||!e)return;Ae(!0);let t=e=>{let n=e;Ae(!1),n.payload.success?(G(null),u.send({type:`skills.list`},{echoToChat:!1}),$()):F(n.payload.error??i.t(`activity:skillDetail.uninstallFailed`)),u.off(`skills.uninstalled`,t)};u.on(`skills.uninstalled`,t),u.uninstallSkill(e.name,e.source===`user`)},[u,$]);return b?(0,_.jsxs)(`div`,{className:f(`flex h-full min-h-0 min-w-0 flex-col gap-3 overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:[(0,_.jsxs)(`div`,{className:`shrink-0 rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,_.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,_.jsx)(re,{className:`h-4 w-4`})}),(0,_.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold`,children:b.name}),b.version&&(0,_.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,b.version]}),(0,_.jsx)(Se,{source:b.source})]}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:b.description||b.trigger}),b.sourceUrl&&(0,_.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1`,children:[(0,_.jsxs)(`a`,{href:`https://${b.sourceUrl.replace(`github:`,``)}`,target:`_blank`,rel:`noopener noreferrer`,className:`flex min-w-0 items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,title:l(`activity:skillDetail.openSourceRepo`),children:[(0,_.jsx)(n,{className:`h-3 w-3 shrink-0`}),(0,_.jsx)(`span`,{className:`truncate font-mono`,children:b.sourceUrl})]}),(0,_.jsx)(`button`,{type:`button`,onClick:Be,className:`flex shrink-0 items-center text-muted-foreground transition-colors hover:text-foreground`,title:l(`activity:skillDetail.copySourceUrl`),children:Oe?(0,_.jsx)(t,{className:`h-3 w-3 text-success`}):(0,_.jsx)(te,{className:`h-3 w-3`})})]}),b.scope.length>0&&(0,_.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:b.scope.map(e=>(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 text-[10px] rounded bg-muted text-muted-foreground`,children:e},e))}),H&&(0,_.jsxs)(`div`,{className:`mt-2 text-xs space-y-1`,children:[H.updated.length>0&&(0,_.jsx)(`div`,{className:`text-success`,children:l(`activity:skillDetail.updatedLabel`,{list:H.updated.map(e=>`${e.name} (${e.oldRef} → ${e.newRef})`).join(`, `)})}),H.unchanged.length>0&&(0,_.jsx)(`div`,{className:`text-muted-foreground`,children:l(`activity:skillDetail.upToDateLabel`,{list:H.unchanged.join(`, `)})}),H.errors.length>0&&(0,_.jsx)(`div`,{className:`text-destructive`,children:l(`activity:skillDetail.errorsLabel`,{list:H.errors.map(e=>`${e.name?`${e.name}: `:``}${e.error}`).join(`; `)})})]})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 lg:ml-auto lg:shrink-0 lg:justify-end`,children:[v(b.source)&&b.sourceUrl&&(0,_.jsx)(`button`,{type:`button`,onClick:ze,disabled:Ee,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50`,title:l(`activity:skillDetail.checkUpdatesTitle`),children:Ee?(0,_.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,_.jsx)(ue,{className:`h-3.5 w-3.5`})}),b.source!==`bundled`&&!O&&(0,_.jsx)(`button`,{type:`button`,onClick:Ve,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:l(`activity:skillDetail.exportTitle`),children:(0,_.jsx)(ce,{className:`h-3.5 w-3.5`})}),v(b.source)&&!O&&(0,_.jsx)(`button`,{type:`button`,onClick:Fe,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:l(`activity:skillDetail.editTitle`),children:(0,_.jsx)(r,{className:`h-3.5 w-3.5`})}),v(b.source)&&(0,_.jsx)(`button`,{type:`button`,onClick:()=>G(b),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,title:l(`activity:skillDetail.uninstallTitle`),children:(0,_.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,_.jsx)(`button`,{type:`button`,onClick:$,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:l(`activity:skillDetail.closeTitle`),children:(0,_.jsx)(a,{className:`h-4 w-4`})})]})]}),x.length>1&&(0,_.jsxs)(`div`,{className:`mt-3 flex min-w-0 items-center gap-1 rounded-lg border border-border/60 bg-muted/35 px-2 py-1`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:Ne,disabled:S<=0,className:f(`rounded p-1 transition-colors`,S<=0?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:l(`activity:skillDetail.backTitle`),children:(0,_.jsx)(oe,{className:`h-4 w-4`})}),(0,_.jsx)(`button`,{type:`button`,onClick:Pe,disabled:S>=x.length-1,className:f(`rounded p-1 transition-colors`,S>=x.length-1?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:l(`activity:skillDetail.forwardTitle`),children:(0,_.jsx)(ie,{className:`h-4 w-4`})}),(0,_.jsx)(`div`,{className:`flex items-center gap-0.5 overflow-x-auto text-xs`,children:x.map((e,t)=>(0,_.jsxs)(`span`,{className:`flex items-center shrink-0`,children:[t>0&&(0,_.jsx)(ie,{className:`h-3 w-3 text-muted-foreground/65 mx-0.5 shrink-0`}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{t<S&&(J.current=!0,y({...q.current,selectedSkill:e,historyIndex:t}),k(!1),j(``),U(null))},className:f(`hover:text-primary cursor-pointer transition-colors`,t===S?`text-primary font-medium`:`text-muted-foreground`),children:e.name})]},e.name+t))})]})]}),C&&(C.relatedFiles.length>0||C.references.length>0)&&(0,_.jsxs)(`div`,{className:`shrink-0 space-y-2 rounded-xl border border-border/70 bg-card/70 px-4 py-3 shadow-sm`,children:[C.relatedFiles.length>0&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,_.jsx)(ne,{className:`h-3 w-3`}),(0,_.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:l(`activity:skillDetail.relatedFiles`)})]}),C.relatedFiles.map(e=>{let t=xe(e);return t&&Z(t)?(0,_.jsxs)(`button`,{type:`button`,onClick:()=>Q(t),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] transition-colors hover:border-primary/40 hover:text-primary`,title:l(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,_.jsx)(o,{className:`h-2.5 w-2.5`}),e]},e):(0,_.jsx)(`span`,{className:`rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:e},e)})]}),C.references.length>0&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,_.jsx)(ae,{className:`h-3 w-3`}),(0,_.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:l(`activity:skillDetail.references`)})]}),C.references.map(e=>{let t=xe(e)??e.replace(/\.md$/,``);return Z(t)?(0,_.jsxs)(`button`,{type:`button`,onClick:()=>Q(t),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-primary/20 bg-primary/5 px-1.5 py-0.5 text-[10px] text-primary transition-colors hover:border-primary/30 hover:bg-primary/10`,title:l(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,_.jsx)(o,{className:`h-2.5 w-2.5`}),t]},e):(0,_.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:t},e)})]})]}),(0,_.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden rounded-xl border border-border/70 bg-card/70 shadow-sm`,children:Ce?(0,_.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center text-muted-foreground`,children:[(0,_.jsx)(s,{className:`mx-auto mb-2 h-6 w-6 animate-spin text-primary`}),(0,_.jsx)(`p`,{children:l(`activity:skillDetail.loadingContent`)})]}):O?(0,_.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,_.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-border/70 bg-muted/30 px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l(`activity:skillDetail.editingLabel`,{name:b.name})}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:l(`activity:skillDetail.editStats`,{lines:Y.lines,words:Y.words,chars:Y.chars})}),X&&(0,_.jsx)(`span`,{className:`text-xs tabular-nums ${X.level===`critical`?`font-medium text-destructive`:`text-warning`}`,children:l(`activity:skillDetail.charsWarningFmt`,{used:(X.used/(1024*1024)).toFixed(1),limit:(X.limit/(1024*1024)).toFixed(0)})}),R&&(0,_.jsx)(`span`,{className:`text-xs text-success animate-pulse`,children:l(`activity:skillDetail.draftSaved`)}),Te&&(0,_.jsx)(`span`,{className:`animate-pulse text-xs text-warning`,children:l(`activity:skillDetail.draftRestored`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[P&&(0,_.jsx)(`span`,{className:`text-xs text-destructive`,children:P}),Te&&(0,_.jsx)(`button`,{type:`button`,onClick:Le,className:`rounded-md border border-warning/35 px-2 py-1 text-[10px] text-warning transition-colors hover:bg-warning/10`,children:l(`activity:skillDetail.discardDraft`)}),(0,_.jsx)(`button`,{type:`button`,onClick:Ie,className:`rounded-md border border-border/70 px-2 py-1 text-xs transition-colors hover:bg-accent`,children:l(`common:action.cancel`)}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>L(e=>!e),title:l(I?`activity:skillDetail.hidePreviewTitle`:`activity:skillDetail.splitViewTitle`),className:`rounded-md border px-2 py-1 text-xs transition-colors ${I?`border-primary/40 bg-primary/10 text-primary`:`border-border/70 text-muted-foreground hover:bg-accent`}`,children:(0,_.jsx)(le,{className:`h-3 w-3 inline`})}),(0,_.jsx)(`button`,{type:`button`,onClick:Re,disabled:M||!A.trim(),className:`rounded-md bg-primary px-3 py-1 text-xs text-primary-foreground shadow-sm shadow-primary/15 transition-colors hover:bg-primary/90 disabled:opacity-50`,children:M?(0,_.jsx)(s,{className:`h-3 w-3 animate-spin inline`}):l(`common:action.save`)})]})]}),I?(0,_.jsxs)(`div`,{className:`flex flex-1 min-h-0 gap-0.5`,children:[(0,_.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0`,children:(0,_.jsx)(g.Suspense,{fallback:null,children:(0,_.jsx)(be,{value:A,onChange:e=>j(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:l(`activity:skillDetail.contentPlaceholder`)})})}),(0,_.jsx)(`div`,{className:`w-px bg-border flex-shrink-0`}),(0,_.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-background/45 p-4 prose prose-sm dark:prose-invert max-w-none`,children:(0,_.jsx)(h,{rehypePlugins:[p],components:m,children:A})})]}):(0,_.jsx)(g.Suspense,{fallback:null,children:(0,_.jsx)(be,{value:A,onChange:e=>j(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:l(`activity:skillDetail.contentPlaceholder`)})})]}):C?(0,_.jsx)(`div`,{ref:we,className:`h-full min-h-0 overflow-y-auto overscroll-contain p-5 sm:p-6 prose prose-sm dark:prose-invert max-w-none`,children:(0,_.jsx)(h,{rehypePlugins:[p],components:m,children:C.body})}):E?(0,_.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center`,children:[(0,_.jsx)(`p`,{className:`text-destructive mb-2`,children:l(`activity:skillDetail.loadFailed`)}),(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:E}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{u&&b&&(T(!0),D(null),u.send({type:`skills.content`,payload:{name:b.name,source:b.source}}))},className:`mt-4 rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent`,children:l(`common:action.retry`)})]}):(0,_.jsx)(`div`,{className:`flex h-full min-h-[16rem] items-center justify-center p-8 text-center text-muted-foreground`,children:l(`activity:skillDetail.noContent`)})}),(0,_.jsx)(_e,{open:!!W,onOpenChange:e=>{e||G(null)},children:(0,_.jsxs)(he,{className:`flex max-h-[calc(100dvh-2rem)] w-[380px] max-w-[90vw] flex-col gap-0 overflow-hidden p-0`,showCloseButton:!1,children:[(0,_.jsxs)(me,{className:`flex shrink-0 items-center justify-between border-b border-border/70 p-4 sm:flex-row sm:justify-between sm:space-y-0`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(c,{className:`h-4 w-4 text-destructive`}),(0,_.jsx)(ge,{className:`font-semibold text-sm`,children:l(`activity:skillDetail.uninstallSkillHeading`)})]}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>G(null),"aria-label":l(`common:action.close`),className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,_.jsx)(a,{className:`h-4 w-4`})})]}),(0,_.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-4`,children:[(0,_.jsx)(`p`,{className:`text-sm`,children:W&&l(`activity:skillDetail.uninstallConfirm`,{name:W.name})}),(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:W&&l(`activity:skillDetail.uninstallRemovePath`,{path:W.path})})]}),(0,_.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-border/70 bg-muted/20 p-4`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:()=>G(null),disabled:K,className:`rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent disabled:opacity-50`,children:l(`common:action.cancel`)}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>W&&He(W),disabled:K,className:`flex items-center gap-1.5 rounded-md bg-destructive px-3 py-1.5 text-xs text-destructive-foreground transition-colors hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[K&&(0,_.jsx)(s,{className:`h-3 w-3 animate-spin`}),l(`activity:skillDetail.uninstallAction`)]})]})]})})]}):(0,_.jsx)(ye,{icon:(0,_.jsx)(se,{className:`h-6 w-6`}),title:l(`activity:skillDetail.noSkillSelected`),description:l(`activity:skillDetail.selectSkillHint`),action:{label:l(`activity:skillDetail.goToChat`),onClick:$},className:e})}export{y as SkillDetailView};
@@ -1 +0,0 @@
1
- import{Na as e}from"./vendor-BuarzSSb.js";var t=e(e=>({generation:0,lastUpdatedAt:null,notifyIndexUpdated(t=Date.now()){e(e=>({generation:e.generation+1,lastUpdatedAt:t}))}}));export{t};