@wrongstack/webui 1.0.0 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/assets/AgentRosterView-BVjk_vTm.js +12 -0
  2. package/dist/assets/AnalyticsDashboard-cR9JJBI8.js +1 -0
  3. package/dist/assets/AudienceMemoryPanel-DyP-vZA-.js +3 -0
  4. package/dist/assets/ChangesView-DY2KWV9y.js +1 -0
  5. package/dist/assets/{ChimeraReviewsView-CpfSkgQ2.js → ChimeraReviewsView-nLzoGYHL.js} +1 -1
  6. package/dist/assets/ChronicleDashboard-D4O8L9vh.js +1 -0
  7. package/dist/assets/CodeEditor-BZCXLxnq.js +2 -0
  8. package/dist/assets/CodeMap-CBAbAWkc.js +1 -0
  9. package/dist/assets/CronJobsPanel-xM7j0r4p.js +1 -0
  10. package/dist/assets/{DeadCodeScanPanel-Cn5bSfLv.js → DeadCodeScanPanel-DWsSzjSp.js} +1 -1
  11. package/dist/assets/{DebugDashboard-Uh9QLbEk.js → DebugDashboard-D9DoHsUb.js} +1 -1
  12. package/dist/assets/DesignGalleryView-C2SBhANT.js +1 -0
  13. package/dist/assets/{GoalView-BgVxzzzS.js → GoalView-u24_HH2B.js} +1 -1
  14. package/dist/assets/KanbanView-BfrSarZw.js +3 -0
  15. package/dist/assets/MailboxDetailView-POq0LIQF.js +1 -0
  16. package/dist/assets/{MemoryDrawer-C5sEdVvj.js → MemoryDrawer-B4aW4mVs.js} +1 -1
  17. package/dist/assets/MemoryManager-BAe2zkyG.js +1 -0
  18. package/dist/assets/ProcessMonitor-9clcCd5a.js +1 -0
  19. package/dist/assets/{PromptJournalView-B65KxlYi.js → PromptJournalView-DiinN7LV.js} +1 -1
  20. package/dist/assets/QueuePanel-DxHkfNun.js +1 -0
  21. package/dist/assets/RefreshDebugView-DuRu5_AZ.js +1 -0
  22. package/dist/assets/{RequirementIntakeView-BnrQSVE_.js → RequirementIntakeView-BE1ZpNh1.js} +1 -1
  23. package/dist/assets/SageTabs-DdwqvEQL.js +2 -0
  24. package/dist/assets/{SddFlowGraph-CNOyn5N9.js → SddFlowGraph-DcUtqxxR.js} +1 -1
  25. package/dist/assets/SddHub-DYCzKYUr.js +2 -0
  26. package/dist/assets/SessionInspectView-d9NH-E5d.js +1 -0
  27. package/dist/assets/SessionList-DP_TUCns.js +1 -0
  28. package/dist/assets/SessionsDashboard-CvlpSVyY.js +1 -0
  29. package/dist/assets/SetupScreen-3_DYzzKv.js +1 -0
  30. package/dist/assets/SkillDetailView-BTuq1wJm.js +3 -0
  31. package/dist/assets/TechStackView-CQHW3en0.js +2 -0
  32. package/dist/assets/TerminalPanel-BWr1bOrP.js +1 -0
  33. package/dist/assets/{activity-Dt348P4m.js → activity-C-Y-_UKp.js} +1 -1
  34. package/dist/assets/{activity-CCW2-qSA.js → activity-CwnkusGI.js} +1 -1
  35. package/dist/assets/{activity-CXLMCm4J.js → activity-D4XDbREq.js} +1 -1
  36. package/dist/assets/{activity-CmzV075e.js → activity-DSr_k7lf.js} +1 -1
  37. package/dist/assets/{activity-D2D6_ljD.js → activity-IxF62i-n.js} +1 -1
  38. package/dist/assets/{activity-FxWZooaS.js → activity-NKeG9bGy.js} +1 -1
  39. package/dist/assets/{activity-87Kr1xrI.js → activity-sgjix1RN.js} +1 -1
  40. package/dist/assets/{button-rqi3MczV.js → button-BIFXNDDY.js} +1 -1
  41. package/dist/assets/{css.worker-DRH2OcAG.js → css.worker-NNelxtRr.js} +6 -6
  42. package/dist/assets/{dialog-xJxaQi60.js → dialog-DT8I6gze.js} +1 -1
  43. package/dist/assets/{empty-state-BxilAuC3.js → empty-state-DtseAzny.js} +1 -1
  44. package/dist/assets/{html.worker-DQLddT9h.js → html.worker-B4rXkk6r.js} +6 -6
  45. package/dist/assets/i18n-Dq2jJcme.js +2 -0
  46. package/dist/assets/index-CbwgQF8l.js +176 -0
  47. package/dist/assets/index-Cg_zbV9k.css +1 -0
  48. package/dist/assets/{input-ClZR-odw.js → input-DE1O73TJ.js} +1 -1
  49. package/dist/assets/{json.worker-D_Dqrls5.js → json.worker-izi4BK3w.js} +4 -4
  50. package/dist/assets/{markdown-BP6Z3HKc.js → markdown-BzXmcdZg.js} +15 -15
  51. package/dist/assets/{monaco-_kWjHrlo.js → monaco-LhToOuuW.js} +59 -59
  52. package/dist/assets/{monaco-theme-Dmx6JuoU.js → monaco-theme-BOzs6u2L.js} +1 -1
  53. package/dist/assets/{react-core-BNmTiJ-I.js → react-core-D0Ec-185.js} +1 -1
  54. package/dist/assets/{roster-ws-n_N7K9tX.js → roster-ws--cUKX8Eo.js} +1 -1
  55. package/dist/assets/{shared-D8dubdNH.js → shared-k2sZgl6A.js} +1 -1
  56. package/dist/assets/{ts.worker-DkYoA6bF.js → ts.worker-Dj4vg72D.js} +114 -114
  57. package/dist/assets/{ui-store-CLXDcLPI.js → ui-store-BPQ-dcnY.js} +1 -1
  58. package/dist/assets/{utils-BpBOwXlT.js → utils-CmY0Pw1m.js} +1 -1
  59. package/dist/assets/{vector-memory-panel-BwPPCCbh.js → vector-memory-panel-UsWhpyqi.js} +1 -1
  60. package/dist/assets/vendor-DcnGbJ82.js +125 -0
  61. package/dist/assets/ws-client-DitX7fid.js +22 -0
  62. package/dist/assets/xterm-DA3G7037.js +16 -0
  63. package/dist/assets/xyflow-BlkaZTzI.js +7 -0
  64. package/dist/components/CodeMapVisuals.d.ts +10 -0
  65. package/dist/components/CustomRosterPanel.d.ts +1 -0
  66. package/dist/components/QuotaChip.d.ts +21 -0
  67. package/dist/components/SettingsPanel/OAuthLoginSection.d.ts +4 -5
  68. package/dist/components/codemap-model.d.ts +21 -1
  69. package/dist/hooks/ws-handlers/session-execution-handlers.d.ts +8 -0
  70. package/dist/hooks/ws-handlers/session-handlers.d.ts +1 -1
  71. package/dist/index.html +13 -22
  72. package/dist/index.js +2127 -1665
  73. package/dist/lib/bug-hunt-message.d.ts +3 -0
  74. package/dist/lib/ws-client-domain-methods.d.ts +14 -3
  75. package/dist/stores/bug-hunt-run-store.d.ts +44 -0
  76. package/dist/stores/index.d.ts +3 -0
  77. package/dist/stores/provider-quota-store.d.ts +69 -0
  78. package/dist/stores/types.d.ts +1 -0
  79. package/dist/types/client-message.d.ts +4 -0
  80. package/dist/types/protocol-core.d.ts +13 -0
  81. package/dist/types/server-message.d.ts +4 -4
  82. package/dist/types/system.d.ts +18 -1
  83. package/package.json +9 -9
  84. package/dist/assets/AgentRosterView-B_J6SvVF.js +0 -12
  85. package/dist/assets/AnalyticsDashboard-BgZiiiDb.js +0 -1
  86. package/dist/assets/AudienceMemoryPanel-CPuksIMN.js +0 -3
  87. package/dist/assets/ChangesView-CmZeNwbw.js +0 -1
  88. package/dist/assets/ChronicleDashboard-B6lhZGjz.js +0 -1
  89. package/dist/assets/CodeEditor-Daz1yqjF.js +0 -2
  90. package/dist/assets/CodeMap-D-H9FNUJ.js +0 -1
  91. package/dist/assets/ConfirmModal-CjsZbvo3.js +0 -1
  92. package/dist/assets/CronJobsPanel-DGKW_zwc.js +0 -1
  93. package/dist/assets/DesignGalleryView-Da1QtI5b.js +0 -1
  94. package/dist/assets/KanbanView-_JvZKFyI.js +0 -3
  95. package/dist/assets/MailboxDetailView-26bVSSbU.js +0 -1
  96. package/dist/assets/MemoryManager-BqWzNt8w.js +0 -1
  97. package/dist/assets/ModelPicker-DqRzzv5J.js +0 -1
  98. package/dist/assets/ProcessMonitor-ygFLD5zk.js +0 -1
  99. package/dist/assets/QueuePanel-CJlIV0pX.js +0 -1
  100. package/dist/assets/RefreshDebugView-CNovrSAn.js +0 -1
  101. package/dist/assets/SageTabs-CJqOqiY7.js +0 -2
  102. package/dist/assets/SddHub-mFjsa_Zl.js +0 -2
  103. package/dist/assets/SessionInspectView-MEmxIEzB.js +0 -1
  104. package/dist/assets/SessionList-DmcQJmzw.js +0 -1
  105. package/dist/assets/SessionsDashboard-BCYViJlx.js +0 -1
  106. package/dist/assets/SetupScreen-BwnSJt7v.js +0 -1
  107. package/dist/assets/SkillDetailView-ebz2dRUQ.js +0 -3
  108. package/dist/assets/TechStackView-DESDpUDA.js +0 -2
  109. package/dist/assets/TerminalPanel-BiWnldbB.js +0 -1
  110. package/dist/assets/chat-store-BcfvHUUj.js +0 -1
  111. package/dist/assets/codemap-activity-store-CWi-Yd9Z.js +0 -1
  112. package/dist/assets/codemap-index-store-3M7F08K_.js +0 -1
  113. package/dist/assets/i18n-DBqM1FUM.js +0 -2
  114. package/dist/assets/index-CWYymMpa.css +0 -1
  115. package/dist/assets/index-TDhvFXb0.js +0 -144
  116. package/dist/assets/mailbox-store-yydAVjyj.js +0 -1
  117. package/dist/assets/stores-Cfei1ViB.js +0 -7
  118. package/dist/assets/useWebSocket-AYEcpb1U.js +0 -27
  119. package/dist/assets/vendor-BshlG0z-.js +0 -125
  120. package/dist/assets/view-navigation-CvWJeGMc.js +0 -1
  121. package/dist/assets/ws-client-C_IqS0t4.js +0 -22
  122. package/dist/assets/xterm-BWzBEEhg.js +0 -18
  123. package/dist/assets/xyflow-BNn76cbK.js +0 -7
  124. /package/dist/assets/{settings-D9AQ5wLT2.js → settings-D9AQ5wLT.js} +0 -0
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{S as t,et as n,q as r,t as i}from"./ws-client-C_IqS0t4.js";import{i as a,t as o}from"./react-core-BNmTiJ-I.js";import{Aa as s,Et as c,Fa as l,Gi as u,It as d,Ki as f,Kn as p,Ra as m,Sr as h,_a as g,_r as _,ei as v,ia as y,kt as b,pi as x,qi as S,sn as C,sr as w,t as T,tn as E}from"./vendor-BshlG0z-.js";import"./i18n-DBqM1FUM.js";import{t as ee}from"./useWebSocket-AYEcpb1U.js";import{t as D}from"./utils-BpBOwXlT.js";import"./stores-Cfei1ViB.js";import{o as O}from"./view-navigation-CvWJeGMc.js";import{a as k,n as te,o as ne,r as A,t as j}from"./dialog-xJxaQi60.js";import{t as M}from"./button-rqi3MczV.js";import{t as N}from"./input-ClZR-odw.js";import{D as re,b as P,d as F,f as I,p as L,u as R,x as z}from"./index-TDhvFXb0.js";var B=e(a(),1);function V(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 H=o();function ie({onKeySaved:e}){let{t}=l(),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(``),[d,f]=(0,B.useState)(`openai-compatible`),[m,h]=(0,B.useState)(``),[g,_]=(0,B.useState)(``),[v,y]=(0,B.useState)(!1),[b,x]=(0,B.useState)([]),{setFieldRef:S,handleKeyDown:w}=L(),T=async()=>{if(s.trim()){y(!0);try{let a=i(n.getState().wsUrl),l=V(a);a.send({type:`provider.add`,payload:{id:s.trim(),family:d,baseUrl:m.trim()||void 0,apiKey:g.trim()||void 0,models:b.length>0?b.map(e=>e.id):void 0,customModels:b.length>0?Object.fromEntries(b.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 u=await l;if(!u.success)throw Error(u.message);r.success(t(`setup:screen.toasts.providerAdded`,{id:s.trim()})),e(s.trim()),a.listSavedProviders(),a.probeProvider(s.trim()),c(``),h(``),_(``),x([]),o(!1)}catch(e){let n=e instanceof Error&&e.message&&e.message!==`timeout`?e.message:null;r.error(n??t(`setup:screen.toasts.providerAddFailed`))}finally{y(!1)}}};return(0,H.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/60 overflow-hidden`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>o(!a),className:`w-full flex items-center gap-3 p-4 text-left hover:bg-muted/30 transition-colors`,children:[(0,H.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center`,children:(0,H.jsx)(C,{className:`h-5 w-5 text-muted-foreground`})}),(0,H.jsxs)(`div`,{className:`flex-1`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-medium`,children:t(`setup:screen.custom.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`setup:screen.custom.description`)})]}),(0,H.jsx)(u,{className:D(`h-4 w-4 text-muted-foreground transition-transform`,a&&`rotate-90`)})]}),a&&(0,H.jsxs)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/40`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5 pt-3`,children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground block`,children:t(`setup:screen.custom.localServers`)}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:R.map(e=>(0,H.jsx)(M,{type:`button`,size:`sm`,variant:s===e.id?`default`:`outline`,onClick:()=>{c(e.id),f(`openai-compatible`),h(e.defaultBaseUrl),e.noAuth&&_(``),x([])},title:e.hint,children:e.label},e.id))})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.providerId`)}),(0,H.jsx)(N,{placeholder:t(`activity:customProviderSection.eGMyLlm`),value:s,onChange:e=>c(e.target.value),className:`text-sm`,ref:S(0),onKeyDown:e=>w(e,0)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.family`)}),(0,H.jsxs)(`select`,{value:d,onChange:e=>f(e.target.value),className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm`,ref:S(1),onKeyDown:e=>w(e,1),children:[(0,H.jsx)(`option`,{value:`openai-compatible`,children:t(`setup:screen.custom.familyOpenAiCompatible`)}),(0,H.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,H.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,H.jsx)(`option`,{value:`google`,children:`Google`})]})]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.baseUrl`)}),(0,H.jsx)(N,{placeholder:t(`activity:customProviderSection.eGHttpLocalhost11434V1`),value:m,onChange:e=>h(e.target.value),className:`text-sm font-mono`,ref:S(2),onKeyDown:e=>w(e,2)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.apiKey`)}),(0,H.jsx)(N,{type:`password`,placeholder:t(`setup:screen.custom.apiKeyPlaceholder`),value:g,onChange:e=>_(e.target.value),className:`text-sm font-mono`,ref:S(3),onKeyDown:e=>w(e,3)})]}),(0,H.jsx)(I,{models:b,onChange:x}),(0,H.jsxs)(M,{onClick:T,disabled:!s.trim()||v,size:`sm`,ref:S(4),onKeyDown:e=>w(e,4,T),children:[v?(0,H.jsx)(p,{className:`h-4 w-4 animate-spin mr-2`}):null,t(`setup:screen.custom.add`)]})]})]})}var U=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:U}catch{return U}}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(T(),1);function ce({popular:e,catalogProvider:t,savedProvider:a,onKeySaved:o,probeResult:s}){let{t:c}=l(),[m,g]=(0,B.useState)(``),[_,y]=(0,B.useState)(!1),[b,C]=(0,B.useState)(!!a?.apiKeys.some(e=>e.isActive)),[w,T]=(0,B.useState)(!1),[E,ee]=(0,B.useState)(!1),[O,re]=(0,B.useState)(!1),[P,F]=(0,B.useState)(null);(0,B.useEffect)(()=>{O&&e.referral&&se.toDataURL(e.referral.url,{width:200,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).then(e=>F(e)).catch(()=>F(null))},[O,e.referral]);let I=async()=>{if(m.trim()){y(!0);try{let a=i(n.getState().wsUrl),s=V(a);t?a.addKey(e.id,`default`,m.trim()):a.send({type:`provider.add`,payload:{id:e.id,family:e.family,apiKey:m.trim()}});let l=await s;if(!l.success)throw Error(l.message);C(!0),g(``),r.success(c(`setup:screen.toasts.keySaved`,{name:e.name})),o(e.id),a.listSavedProviders(),a.probeProvider(e.id)}catch(t){let n=t instanceof Error&&t.message&&t.message!==`timeout`?t.message:null;r.error(n??c(`setup:screen.toasts.keySaveFailed`,{name:e.name}))}finally{y(!1)}}},L=e=>{e.key===`Enter`&&m.trim()&&I()},R=async()=>{if(e.referral)try{await navigator.clipboard.writeText(e.referral.url),ee(!0),r.success(c(`setup:screen.toasts.referralCopied`)),setTimeout(()=>ee(!1),2e3)}catch{r.error(c(`setup:screen.toasts.referralCopyFailed`))}},z=t&&t.modelCount>0;return(0,H.jsxs)(`div`,{className:D(`rounded-xl border p-4 transition-all`,b?`border-success/30 bg-success/5`:`bg-gradient-to-br ${e.color}`),children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(`span`,{className:`text-2xl shrink-0 mt-0.5`,children:e.icon}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),b&&(0,H.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,H.jsx)(S,{className:`h-2.5 w-2.5`}),c(`setup:screen.card.keySaved`)]}),e.referral&&!b&&(0,H.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,H.jsx)(h,{className:`h-2.5 w-2.5`}),c(`setup:screen.card.referral`)]})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),e.referral&&!b&&(0,H.jsxs)(`p`,{className:`text-[11px] text-warning/80 mt-1`,children:[`🎁 `,e.referral.reward]}),b?b?(0,H.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[a?.baseUrl&&(0,H.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70 font-mono truncate`,title:a.baseUrl,children:[(0,H.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[c(`activity:providerKey.url`),` `]}),a.baseUrl]}),a?.models&&a.models.length>0&&(0,H.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70`,children:[(0,H.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[c(`activity:providerKey.models`),` `]}),a.pickedModelId??a.models[0],(0,H.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[` `,`(+`,a.models.length-1,` more)`]})]}),s===`probing`?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mt-1`,children:[(0,H.jsx)(p,{className:`h-3 w-3 animate-spin`}),c(`setup:screen.probe.checking`,`Checking connection…`)]}):s?.ok?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-success mt-1`,children:[(0,H.jsx)(S,{className:`h-3 w-3`}),(0,H.jsxs)(`span`,{children:[c(`setup:screen.probe.connected`,`Connected`),s.modelCount!=null&&` · ${s.modelCount} ${c(`setup:screen.probe.models`,`models`)}`,s.elapsedMs!=null&&` · ${s.elapsedMs}ms`]})]}):s&&!s.ok?(0,H.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-destructive mt-1`,children:[(0,H.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:`✕`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:c(`setup:screen.probe.failed`,`Probe failed`)}),s.status===`no_base_url`&&(0,H.jsx)(`span`,{className:`block text-destructive/70`,children:c(`setup:screen.probe.noBaseUrl`,`No base URL configured`)}),s.status===`unreachable`&&(0,H.jsxs)(`span`,{className:`block text-destructive/70`,children:[c(`setup:screen.probe.unreachable`,`Could not connect`),s.detail?`: ${s.detail}`:``]}),s.status!==`no_base_url`&&s.status!==`unreachable`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`block text-destructive/70`,children:s.httpStatus==null?s.status:`${c(`setup:screen.probe.httpStatus`,`Status`)} ${s.httpStatus}`}),s.detail&&(0,H.jsx)(`span`,{className:`block text-destructive/70 truncate max-w-[250px]`,title:s.detail,children:s.detail})]})]})]}):null,z&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>T(!w),className:`text-[11px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[c(`setup:screen.providers.modelsAvailable`,{count:t?.modelCount??0}),w?(0,H.jsx)(f,{className:`h-3 w-3`}):(0,H.jsx)(u,{className:`h-3 w-3`})]})]}):null:(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(N,{type:`password`,placeholder:e.keyPlaceholder,value:m,onChange:e=>g(e.target.value),onKeyDown:L,className:`font-mono text-sm`}),(0,H.jsx)(M,{onClick:I,disabled:!m.trim()||_,size:`sm`,className:`shrink-0`,children:_?(0,H.jsx)(p,{className:`h-4 w-4 animate-spin`}):c(`setup:screen.card.save`)})]}),e.docsUrl&&(0,H.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:[c(`setup:screen.card.getKey`),` `,(0,H.jsx)(v,{className:`h-3 w-3`})]}),e.referral&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:R,className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:E?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S,{className:`h-3 w-3`}),` `,c(`setup:screen.card.copied`)]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(x,{className:`h-3 w-3`}),` `,c(`setup:screen.card.copyReferral`)]})}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>re(!0),className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:[(0,H.jsx)(d,{className:`h-3 w-3`}),` `,c(`setup:screen.card.share`)]})]})]})]})]}),(0,H.jsx)(j,{open:O,onOpenChange:re,children:(0,H.jsxs)(te,{className:`sm:max-w-md`,children:[(0,H.jsxs)(k,{children:[(0,H.jsxs)(ne,{className:`flex items-center gap-2`,children:[(0,H.jsx)(h,{className:`h-4 w-4 text-warning`}),c(`setup:screen.share.title`,{name:e.name})]}),(0,H.jsx)(A,{children:c(`setup:screen.share.description`)})]}),(0,H.jsx)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:e.referral&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`text-sm text-center`,children:(0,H.jsxs)(`p`,{className:`font-medium text-warning`,children:[`🎁 `,e.referral.reward]})}),P?(0,H.jsx)(`div`,{className:`rounded-lg border border-border p-2 bg-white`,children:(0,H.jsx)(`img`,{src:P,alt:c(`setup:screen.card.qrAlt`,{name:e.name}),className:`w-[200px] h-[200px]`})}):(0,H.jsx)(`div`,{className:`w-[200px] h-[200px] rounded-lg border border-border flex items-center justify-center bg-muted`,children:(0,H.jsx)(p,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),(0,H.jsxs)(`div`,{className:`w-full space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,H.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:c(`setup:screen.share.twitter`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.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,H.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:c(`setup:screen.share.linkedin`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.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`})}),c(`activity:providerKey.linkedin`)]}),(0,H.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:c(`setup:screen.share.telegram`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.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`})}),c(`activity:providerKey.telegram`)]}),(0,H.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:c(`setup:screen.share.whatsapp`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.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`})}),c(`activity:providerKey.whatsapp`)]}),(0,H.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:c(`setup:screen.share.reddit`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.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`})}),c(`activity:providerKey.reddit`)]}),(0,H.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:c(`setup:screen.share.facebook`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.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`})}),c(`activity:providerKey.facebook`)]}),(0,H.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:c(`setup:screen.share.email`),children:[(0,H.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,H.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`})}),c(`activity:providerKey.email`)]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(N,{value:e.referral.url,readOnly:!0,className:`font-mono text-xs flex-1`}),(0,H.jsx)(M,{size:`sm`,variant:`outline`,onClick:R,className:`shrink-0`,children:E?(0,H.jsx)(S,{className:`h-4 w-4`}):(0,H.jsx)(x,{className:`h-4 w-4`})})]}),(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:c(`setup:screen.share.hint`)})]})]})})]})})]})}function W(){let{t:e}=l(),{model:a,setProvider:o,setModel:d,wsConnected:f,wsUrl:h}=n(s(e=>({model:e.model,setProvider:e.setProvider,setModel:e.setModel,wsConnected:e.wsConnected,wsUrl:e.wsUrl})));ee();let[v,x]=(0,B.useState)([]),[C,T]=(0,B.useState)({}),[k,te]=(0,B.useState)([]),[ne,A]=(0,B.useState)(!1),[j,N]=(0,B.useState)(null),[F,I]=(0,B.useState)(0),[L,R]=(0,B.useState)(new Set),[V,se]=(0,B.useState)({}),[W,le]=(0,B.useState)(U),[G,K]=(0,B.useState)(!1),[ue,de]=(0,B.useState)(0),[fe,pe]=(0,B.useState)(0),[q,me]=(0,B.useState)(null),J=(0,B.useRef)(!0);(0,B.useEffect)(()=>{let e=new AbortController,t=`${window.location.origin}/providers.json`;return K(!0),ae(t,e.signal).then(t=>{if(t!==U){if(le(t),K(!1),!J.current){let e=t.length-fe;e>0?r.success(m.t(`setup:screen.toasts.providersLoadedNew`,{count:t.length,diff:e})):e<0?r.success(m.t(`setup:screen.toasts.providersLoadedRemoved`,{count:t.length,diff:Math.abs(e)})):r.success(m.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),!J.current){let t=e.length-fe;t>0?r.success(m.t(`setup:screen.toasts.providersLoadedNew`,{count:e.length,diff:t})):t<0?r.success(m.t(`setup:screen.toasts.providersLoadedRemoved`,{count:e.length,diff:Math.abs(t)})):r.success(m.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:e.length})),pe(e.length)}me(new Date)}}).catch(()=>{J.current||r.error(m.t(`setup:screen.toasts.providersRefreshFailed`))}).finally(()=>{K(!1),J.current=!1}),()=>e.abort()},[ue]);let[Y,he]=(0,B.useState)(null),[X,Z]=(0,B.useState)(null),[ge,_e]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(!f)return;let e=i(h),t=setTimeout(()=>{t=null,A(!1),N(m.t(`setup:screen.errors.backendNotResponding`))},8e3),n=()=>{t&&=(clearTimeout(t),null)},r=e.on(`provider.catalog`,e=>{if(e.type===`provider.catalog`){n(),N(null);let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));x(t),A(!1)}}),o=e.on(`provider.models`,e=>{if(e.type===`provider.models`){let t=e.payload;if(t.provider!==Y)return;T(e=>({...e,[t.provider]:t.models})),_e(!1),t.models.length===1?Z(t.models[0].id):a&&t.models.some(e=>e.id===a)&&Z(a)}}),s=e.on(`providers.saved`,e=>{if(e.type===`providers.saved`){let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));te(t);let n=new Set(t.filter(e=>e.apiKeys.some(e=>e.isActive)).map(e=>e.id));R(n)}}),c=e.on(`provider.probe`,e=>{if(e.type!==`provider.probe`)return;let t=e.payload;se(e=>({...e,[t.providerId]:t}))});return N(null),A(!0),e.listProviders(),()=>{n(),r?.(),o?.(),s?.(),c?.()}},[f,h,a,F,Y]);let ve=(0,B.useCallback)(()=>{N(null),I(e=>e+1)},[]),ye=(0,B.useCallback)(()=>{de(e=>e+1)},[]),be=(0,B.useCallback)(t=>oe(t,e),[e]),xe=(0,B.useCallback)(e=>{R(t=>new Set([...t,e])),he(e),Z(null)},[]),Se=L.size>0;(0,B.useEffect)(()=>{if(!Y||!f)return;let e=i(h);C[Y]||(_e(!0),e.listProviderModels(Y))},[Y,f,h,C]);let Ce=Y?C[Y]??[]:[],we=(0,B.useCallback)(async()=>{if(!Y||!X)return;if(!L.has(Y)){r.error(`Please save the provider configuration before starting a session.`);return}o(Y),d(X);let e=await i(h).switchModel(Y,X,5e3);e.success?(t.getState().openPicker({startsSession:!0}),O(`chat`)):r.error(e.message||m.t(`setup:screen.errors.modelSwitchTimeout`))},[Y,X,o,d,h]),Te=(0,B.useCallback)(async()=>{if(!Y||!X)return;o(Y),d(X);let e=await i(h).switchModel(Y,X,5e3);e.success?O(`chat`):r.error(e.message||m.t(`setup:screen.errors.modelSwitchTimeout`))},[Y,X,o,d,h]),Ee=new Set(W.map(e=>e.id)),De=v.filter(e=>!Ee.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id)),Q=z(De,10);z(k,9);let $=z(Ce,12,Y);return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,H.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,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,H.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,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:e(`setup:screen.header.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground sm:truncate`,children:e(`setup:screen.header.subtitle`)})]})]}),Se&&Y?(0,H.jsxs)(`span`,{className:`text-xs text-success/80`,children:[(0,H.jsx)(S,{className:`h-3 w-3 inline-block mr-1`}),e(`setup:screen.header.continue`)]}):null]}),(0,H.jsx)(re,{className:`min-h-0 flex-1`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-4 pb-4 sm:p-6`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,H.jsxs)(`div`,{className:D(`flex min-w-0 items-center gap-1.5`,Se?`text-success`:`text-primary font-medium`),children:[(0,H.jsx)(w,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:e(`setup:screen.steps.addKeys`)})]}),(0,H.jsx)(u,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:D(`flex min-w-0 items-center gap-1.5`,Y?`text-primary font-medium`:`text-muted-foreground`),children:[(0,H.jsx)(y,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,H.jsx)(u,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:D(`flex min-w-0 items-center gap-1.5`,Y&&X?`text-primary font-medium`:`text-muted-foreground`),children:[(0,H.jsx)(c,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-primary/20 bg-primary/5 p-4`,children:[(0,H.jsx)(b,{className:`h-5 w-5 text-primary shrink-0 mt-0.5`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:e(`setup:screen.security.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`setup:screen.security.body`)})]})]}),j?(0,H.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,H.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-destructive/10 border border-destructive/30 flex items-center justify-center`,children:(0,H.jsx)(_,{className:`h-6 w-6 text-destructive`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e(`setup:screen.errors.backendUnreachable`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 max-w-sm`,children:j})]}),(0,H.jsxs)(M,{onClick:ve,size:`sm`,variant:`outline`,children:[(0,H.jsx)(p,{className:`h-4 w-4 mr-2`}),e(`setup:screen.errors.retry`)]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.popular`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[G&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(p,{className:`h-3 w-3 animate-spin`}),e(`setup:screen.providers.updating`)]}),q&&!G&&(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,title:q.toLocaleString(),children:be(q)}),(0,H.jsxs)(`button`,{type:`button`,onClick:ye,disabled:G,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,H.jsx)(E,{className:D(`h-3 w-3`,G&&`animate-spin`)}),e(`setup:screen.providers.refresh`)]})]})]}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:W.map(e=>(0,H.jsx)(ce,{popular:e,catalogProvider:v.find(t=>t.id===e.id),savedProvider:k.find(t=>t.id===e.id),onKeySaved:xe,probeResult:V[e.id]},e.id))})]}),De.length>0&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.more`)}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Q.pageItems.map(t=>(0,H.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:k.find(e=>e.id===t.id),onKeySaved:xe,probeResult:V[t.id]},t.id))}),(0,H.jsx)(P,{page:Q.page,pageSize:Q.pageSize,totalItems:Q.totalItems,onPageChange:Q.setPage,itemLabel:`providers`})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.selfHosted`)}),(0,H.jsx)(ie,{onKeySaved:xe})]})]}),ne&&(0,H.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,H.jsx)(p,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),Y&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,H.jsx)(c,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseModel`)]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{he(null),Z(null)},className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:e(`setup:screen.start.addMoreKeys`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`setup:screen.start.modelsFor`,{provider:Y})}),ge?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,H.jsx)(p,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):Ce.length>0?(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:$.pageItems.map(e=>{let t=e.contextWindow?`${(e.contextWindow/1e6).toFixed(0)}M ctx`:null;return(0,H.jsx)(`button`,{type:`button`,onClick:()=>Z(e.id),className:D(`w-full text-left rounded-xl border p-3 transition-all`,`hover:border-primary/40 hover:bg-primary/5`,X===e.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border bg-card`),children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[t&&(0,H.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:t}),e.capabilities.slice(0,3).map(e=>(0,H.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:e},e))]})]}),X===e.id&&(0,H.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary`,children:(0,H.jsx)(S,{className:`h-3 w-3 text-primary-foreground`})})]})},e.id)})}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground py-8 text-center`,children:e(`setup:screen.errors.noModels`)}),(0,H.jsx)(P,{page:$.page,pageSize:$.pageSize,totalItems:$.totalItems,onPageChange:$.setPage,itemLabel:`models`})]}),Y&&X&&(0,H.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,H.jsx)(`div`,{className:`mb-3 flex min-w-0 items-center justify-between gap-2 text-sm text-muted-foreground`,children:(0,H.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Y,` / `,X]})}),(0,H.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,H.jsxs)(M,{onClick:we,className:`flex-1`,size:`lg`,children:[(0,H.jsx)(y,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.startSession`),(0,H.jsx)(g,{className:`h-4 w-4 ml-2`})]}),(0,H.jsxs)(M,{onClick:Te,variant:`outline`,className:`flex-1`,size:`lg`,children:[(0,H.jsx)(S,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.saveConfig`)]})]}),(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60 text-center mt-2`,children:e(`setup:screen.start.saveConfigHint`)})]})]})})]})}export{W as SetupScreen};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-BshlG0z-.js","assets/rolldown-runtime-hePW80VL.js","assets/react-core-BNmTiJ-I.js","assets/xyflow-BNn76cbK.js","assets/xyflow-DLioOiRN.css","assets/markdown-BP6Z3HKc.js","assets/vendor-BShi5_Dg.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-BNmTiJ-I.js";import{Et as r,Fa as i,Gi as a,K as ee,Kn as o,Nr as te,Ra as s,Rr as ne,Wi as re,_r as ie,dn as ae,ft as c,hn as oe,ma as l,oa as se,oi as ce,pi as le,qi as ue,tn as de}from"./vendor-BshlG0z-.js";import"./i18n-DBqM1FUM.js";import{t as u}from"./vite-preload-Czpn1I53.js";import{t as fe}from"./useWebSocket-AYEcpb1U.js";import{t as d}from"./utils-BpBOwXlT.js";import{n as pe}from"./ui-store-CLXDcLPI.js";import{o as me}from"./view-navigation-CvWJeGMc.js";import{a as he,n as ge,o as _e,t as ve}from"./dialog-xJxaQi60.js";import{u as f}from"./markdown-BP6Z3HKc.js";import{g as ye,o as p,v as be}from"./index-TDhvFXb0.js";import{t as xe}from"./empty-state-BxilAuC3.js";var m=e(t(),1),h=n(),g=(0,m.lazy)(()=>u(()=>import(`./vendor-BshlG0z-.js`).then(e=>e.r),__vite__mapDeps([0,1,2,3,4,5,6])));function _(e){return e===`project`||e===`user`}function Se(e){let t=e.match(/^(.+?)\/SKILL(?:\.save)?\.md$/);return t?t[1]:null}function Ce({source:e}){let{t}=i(),n=e===`project`?`project`:e===`user`?`user`:`bundled`;return(0,h.jsx)(`span`,{className:d(`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 v({className:e}){let{t}=i(),{client:n}=fe(),u=pe(e=>e.skillsState),v=pe(e=>e.setSkillsState),y=u.selectedSkill,b=u.navHistory,x=u.historyIndex,[S,we]=(0,m.useState)(null),[Te,C]=(0,m.useState)(!1),[w,T]=(0,m.useState)(null),Ee=ye(`skill-detail`,!!S),[E,D]=(0,m.useState)(!1),[O,k]=(0,m.useState)(``),[A,j]=(0,m.useState)(!1),[M,N]=(0,m.useState)(null),[P,F]=(0,m.useState)(!1),[I,L]=(0,m.useState)(null),[R,z]=(0,m.useState)(!1),B=(0,m.useRef)(``),[V,H]=(0,m.useState)(!1),[U,W]=(0,m.useState)(null),[De,Oe]=(0,m.useState)(!1),[G,K]=(0,m.useState)(null),[q,ke]=(0,m.useState)(!1),[Ae,je]=(0,m.useState)([]),J=(0,m.useRef)(u);J.current=u;let Y=(0,m.useRef)(!1),X=(0,m.useMemo)(()=>O?{lines:O.split(`
3
- `).length,words:O.trim()?O.trim().split(/\s+/).length:0,chars:O.length}:{lines:0,words:0,chars:0},[O]),Z=(0,m.useMemo)(()=>{if(!O)return null;let e=5242880,t=new Blob([O]).size;return t>=e?{level:`critical`,used:t,limit:e}:t>=4194304?{level:`warn`,used:t,limit:e}:null},[O]);(0,m.useEffect)(()=>{if(!I)return;let e=setTimeout(()=>L(null),2e3);return()=>clearTimeout(e)},[I]),(0,m.useEffect)(()=>{if(!E||!y)return;let e=setInterval(()=>{O&&O!==B.current&&(B.current=O,localStorage.setItem(`skills_draft_${y.name}`,JSON.stringify({content:O,savedAt:Date.now()})),L(Date.now()))},5e3);return()=>clearInterval(e)},[E,O,y]),(0,m.useEffect)(()=>{if(!y||!E)return;let e=localStorage.getItem(`skills_draft_${y.name}`);if(e)try{let{content:t}=JSON.parse(e);t&&t!==O&&t!==B.current&&(k(t),B.current=t,z(!0))}catch{}},[y?.name,E]),(0,m.useEffect)(()=>{if(!n||!y)return;C(!0),we(null),T(null);let e=setTimeout(()=>{C(!1),T(s.t(`activity:skillDetail.timeoutError`))},1e4),t=t=>{clearTimeout(e);let n=t;n.payload.error?T(n.payload.error):n.payload.name&&we(n.payload),C(!1)},r=e=>{let t=e;H(!1);let r=J.current;if(t.payload.success){let e={...r.knownRefs};for(let n of t.payload.updated??[])e[n.name]=n.newRef;v({...r,knownRefs:e,updateAvailableCount:0}),W({updated:t.payload.updated??[],unchanged:t.payload.unchanged??[],errors:t.payload.errors??[]}),n.send({type:`skills.list`},{echoToChat:!1})}else W({updated:[],unchanged:[],errors:[{name:``,error:t.payload.error??s.t(`activity:skillDetail.updateFailed`)}]})},i=e=>{let t=e;t.payload.skills&&je(t.payload.skills)};return n.on(`skills.content`,t),n.on(`skills.updated`,r),n.on(`skills.list`,i),n.send({type:`skills.content`,payload:{name:y.name,source:y.source}}),()=>{clearTimeout(e),n.off(`skills.content`,t),n.off(`skills.updated`,r),n.off(`skills.list`,i)}},[n,y?.name,y?.source]),(0,m.useEffect)(()=>{E&&(D(!1),k(``),N(null))},[y?.name]);let Q=(0,m.useCallback)(e=>Ae.find(t=>t.name.toLowerCase()===e.toLowerCase()),[Ae]),Me=(0,m.useCallback)(e=>{let t=Q(e);if(t){Y.current=!1;let e=b.slice(0,x+1);e.push(t),v({...J.current,selectedSkill:t,navHistory:e,historyIndex:e.length-1}),D(!1),k(``),W(null)}},[Q,b,x,v]),Ne=(0,m.useCallback)(()=>{if(x<=0)return;Y.current=!0;let e=x-1,t=b[e];v({...J.current,selectedSkill:t,historyIndex:e}),D(!1),k(``),W(null)},[x,b,v]),Pe=(0,m.useCallback)(()=>{if(x>=b.length-1)return;Y.current=!0;let e=x+1,t=b[e];v({...J.current,selectedSkill:t,historyIndex:e}),D(!1),k(``),W(null)},[x,b,v]),$=(0,m.useCallback)(()=>{me(`chat`)},[]),Fe=(0,m.useCallback)(()=>{S&&(k(S.body),B.current=S.body,z(!1),N(null),D(!0),F(!1))},[S]),Ie=(0,m.useCallback)(()=>{D(!1),k(``),N(null),F(!1),z(!1),y&&localStorage.removeItem(`skills_draft_${y.name}`)},[y]),Le=(0,m.useCallback)(()=>{!y||!S||(z(!1),k(S.body),B.current=S.body,y&&localStorage.removeItem(`skills_draft_${y.name}`))},[y,S]),Re=(0,m.useCallback)(()=>{if(!n||!y||!O.trim())return;j(!0),N(null);let e=t=>{let r=t;j(!1),r.payload.success?(B.current=``,localStorage.removeItem(`skills_draft_${y.name}`),z(!1),D(!1),n.send({type:`skills.content`,payload:{name:y.name,source:y.source}}),n.send({type:`skills.list`},{echoToChat:!1})):N(r.payload.error??s.t(`activity:skillDetail.saveFailed`)),n.off(`skills.edited`,e)};n.on(`skills.edited`,e),n.editSkill(y.name,O)},[n,y,O]),ze=(0,m.useCallback)(()=>{!n||!y||(H(!0),W(null),n.checkForUpdates(y.name,y.source===`user`))},[n,y]),Be=(0,m.useCallback)(()=>{y?.sourceUrl&&navigator.clipboard.writeText(y.sourceUrl).then(()=>{Oe(!0),setTimeout(()=>Oe(!1),2e3)})},[y]),Ve=(0,m.useCallback)(()=>{if(!S?.body)return;let e=new Blob([S.body],{type:`text/markdown`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${S.name.replace(/\//g,`_`)}-SKILL.md`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},[S]),He=(0,m.useCallback)(async e=>{if(!n||!e)return;ke(!0);let t=e=>{let r=e;ke(!1),r.payload.success?(K(null),n.send({type:`skills.list`},{echoToChat:!1}),$()):N(r.payload.error??s.t(`activity:skillDetail.uninstallFailed`)),n.off(`skills.uninstalled`,t)};n.on(`skills.uninstalled`,t),n.uninstallSkill(e.name,e.source===`user`)},[n,$]);return y?(0,h.jsxs)(`div`,{className:d(`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,h.jsxs)(`div`,{className:`shrink-0 rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,h.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,h.jsx)(r,{className:`h-4 w-4`})}),(0,h.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold`,children:y.name}),y.version&&(0,h.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,y.version]}),(0,h.jsx)(Ce,{source:y.source})]}),(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:y.description||y.trigger}),y.sourceUrl&&(0,h.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1`,children:[(0,h.jsxs)(`a`,{href:`https://${y.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:t(`activity:skillDetail.openSourceRepo`),children:[(0,h.jsx)(ie,{className:`h-3 w-3 shrink-0`}),(0,h.jsx)(`span`,{className:`truncate font-mono`,children:y.sourceUrl})]}),(0,h.jsx)(`button`,{type:`button`,onClick:Be,className:`flex shrink-0 items-center text-muted-foreground transition-colors hover:text-foreground`,title:t(`activity:skillDetail.copySourceUrl`),children:De?(0,h.jsx)(ue,{className:`h-3 w-3 text-success`}):(0,h.jsx)(le,{className:`h-3 w-3`})})]}),y.scope.length>0&&(0,h.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:y.scope.map(e=>(0,h.jsx)(`span`,{className:`px-1.5 py-0.5 text-[10px] rounded bg-muted text-muted-foreground`,children:e},e))}),U&&(0,h.jsxs)(`div`,{className:`mt-2 text-xs space-y-1`,children:[U.updated.length>0&&(0,h.jsx)(`div`,{className:`text-success`,children:t(`activity:skillDetail.updatedLabel`,{list:U.updated.map(e=>`${e.name} (${e.oldRef} → ${e.newRef})`).join(`, `)})}),U.unchanged.length>0&&(0,h.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:skillDetail.upToDateLabel`,{list:U.unchanged.join(`, `)})}),U.errors.length>0&&(0,h.jsx)(`div`,{className:`text-destructive`,children:t(`activity:skillDetail.errorsLabel`,{list:U.errors.map(e=>`${e.name?`${e.name}: `:``}${e.error}`).join(`; `)})})]})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 lg:ml-auto lg:shrink-0 lg:justify-end`,children:[_(y.source)&&y.sourceUrl&&(0,h.jsx)(`button`,{type:`button`,onClick:ze,disabled:V,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:t(`activity:skillDetail.checkUpdatesTitle`),children:V?(0,h.jsx)(o,{className:`h-3.5 w-3.5 animate-spin`}):(0,h.jsx)(de,{className:`h-3.5 w-3.5`})}),y.source!==`bundled`&&!E&&(0,h.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:t(`activity:skillDetail.exportTitle`),children:(0,h.jsx)(ce,{className:`h-3.5 w-3.5`})}),_(y.source)&&!E&&(0,h.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:t(`activity:skillDetail.editTitle`),children:(0,h.jsx)(ae,{className:`h-3.5 w-3.5`})}),_(y.source)&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>K(y),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:t(`activity:skillDetail.uninstallTitle`),children:(0,h.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,h.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:t(`activity:skillDetail.closeTitle`),children:(0,h.jsx)(ee,{className:`h-4 w-4`})})]})]}),b.length>1&&(0,h.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,h.jsx)(`button`,{type:`button`,onClick:Ne,disabled:x<=0,className:d(`rounded p-1 transition-colors`,x<=0?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:t(`activity:skillDetail.backTitle`),children:(0,h.jsx)(re,{className:`h-4 w-4`})}),(0,h.jsx)(`button`,{type:`button`,onClick:Pe,disabled:x>=b.length-1,className:d(`rounded p-1 transition-colors`,x>=b.length-1?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:t(`activity:skillDetail.forwardTitle`),children:(0,h.jsx)(a,{className:`h-4 w-4`})}),(0,h.jsx)(`div`,{className:`flex items-center gap-0.5 overflow-x-auto text-xs`,children:b.map((e,t)=>(0,h.jsxs)(`span`,{className:`flex items-center shrink-0`,children:[t>0&&(0,h.jsx)(a,{className:`h-3 w-3 text-muted-foreground/65 mx-0.5 shrink-0`}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{t<x&&(Y.current=!0,v({...J.current,selectedSkill:e,historyIndex:t}),D(!1),k(``),W(null))},className:d(`hover:text-primary cursor-pointer transition-colors`,t===x?`text-primary font-medium`:`text-muted-foreground`),children:e.name})]},e.name+t))})]})]}),S&&(S.relatedFiles.length>0||S.references.length>0)&&(0,h.jsxs)(`div`,{className:`shrink-0 space-y-2 rounded-xl border border-border/70 bg-card/70 px-4 py-3 shadow-sm`,children:[S.relatedFiles.length>0&&(0,h.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,h.jsx)(te,{className:`h-3 w-3`}),(0,h.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:t(`activity:skillDetail.relatedFiles`)})]}),S.relatedFiles.map(e=>{let n=Se(e);return n&&Q(n)?(0,h.jsxs)(`button`,{type:`button`,onClick:()=>Me(n),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:t(`activity:skillDetail.goToSkillTitle`,{name:n}),children:[(0,h.jsx)(l,{className:`h-2.5 w-2.5`}),e]},e):(0,h.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)})]}),S.references.length>0&&(0,h.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,h.jsx)(ne,{className:`h-3 w-3`}),(0,h.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:t(`activity:skillDetail.references`)})]}),S.references.map(e=>{let n=Se(e)??e.replace(/\.md$/,``);return Q(n)?(0,h.jsxs)(`button`,{type:`button`,onClick:()=>Me(n),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:t(`activity:skillDetail.goToSkillTitle`,{name:n}),children:[(0,h.jsx)(l,{className:`h-2.5 w-2.5`}),n]},e):(0,h.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:n},e)})]})]}),(0,h.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:Te?(0,h.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center text-muted-foreground`,children:[(0,h.jsx)(o,{className:`mx-auto mb-2 h-6 w-6 animate-spin text-primary`}),(0,h.jsx)(`p`,{children:t(`activity:skillDetail.loadingContent`)})]}):E?(0,h.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,h.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,h.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`activity:skillDetail.editingLabel`,{name:y.name})}),(0,h.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:t(`activity:skillDetail.editStats`,{lines:X.lines,words:X.words,chars:X.chars})}),Z&&(0,h.jsx)(`span`,{className:`text-xs tabular-nums ${Z.level===`critical`?`font-medium text-destructive`:`text-warning`}`,children:t(`activity:skillDetail.charsWarningFmt`,{used:(Z.used/1048576).toFixed(1),limit:(Z.limit/1048576).toFixed(0)})}),I&&(0,h.jsx)(`span`,{className:`text-xs text-success animate-pulse`,children:t(`activity:skillDetail.draftSaved`)}),R&&(0,h.jsx)(`span`,{className:`animate-pulse text-xs text-warning`,children:t(`activity:skillDetail.draftRestored`)})]}),(0,h.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[M&&(0,h.jsx)(`span`,{className:`text-xs text-destructive`,children:M}),R&&(0,h.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:t(`activity:skillDetail.discardDraft`)}),(0,h.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:t(`common:action.cancel`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>F(e=>!e),title:t(P?`activity:skillDetail.hidePreviewTitle`:`activity:skillDetail.splitViewTitle`),className:`rounded-md border px-2 py-1 text-xs transition-colors ${P?`border-primary/40 bg-primary/10 text-primary`:`border-border/70 text-muted-foreground hover:bg-accent`}`,children:(0,h.jsx)(oe,{className:`h-3 w-3 inline`})}),(0,h.jsx)(`button`,{type:`button`,onClick:Re,disabled:A||!O.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:A?(0,h.jsx)(o,{className:`h-3 w-3 animate-spin inline`}):t(`common:action.save`)})]})]}),P?(0,h.jsxs)(`div`,{className:`flex flex-1 min-h-0 gap-0.5`,children:[(0,h.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0`,children:(0,h.jsx)(m.Suspense,{fallback:null,children:(0,h.jsx)(g,{value:O,onChange:e=>k(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:t(`activity:skillDetail.contentPlaceholder`)})})}),(0,h.jsx)(`div`,{className:`w-px bg-border flex-shrink-0`}),(0,h.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,h.jsx)(p,{rehypePlugins:[f],components:be,children:O})})]}):(0,h.jsx)(m.Suspense,{fallback:null,children:(0,h.jsx)(g,{value:O,onChange:e=>k(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:t(`activity:skillDetail.contentPlaceholder`)})})]}):S?(0,h.jsx)(`div`,{ref:Ee,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,h.jsx)(p,{rehypePlugins:[f],components:be,children:S.body})}):w?(0,h.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center`,children:[(0,h.jsx)(`p`,{className:`text-destructive mb-2`,children:t(`activity:skillDetail.loadFailed`)}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:w}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{n&&y&&(C(!0),T(null),n.send({type:`skills.content`,payload:{name:y.name,source:y.source}}))},className:`mt-4 rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent`,children:t(`common:action.retry`)})]}):(0,h.jsx)(`div`,{className:`flex h-full min-h-[16rem] items-center justify-center p-8 text-center text-muted-foreground`,children:t(`activity:skillDetail.noContent`)})}),(0,h.jsx)(ve,{open:!!G,onOpenChange:e=>{e||K(null)},children:(0,h.jsxs)(ge,{className:`flex max-h-[calc(100dvh-2rem)] w-[380px] max-w-[90vw] flex-col gap-0 overflow-hidden p-0`,showCloseButton:!1,children:[(0,h.jsxs)(he,{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,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(c,{className:`h-4 w-4 text-destructive`}),(0,h.jsx)(_e,{className:`font-semibold text-sm`,children:t(`activity:skillDetail.uninstallSkillHeading`)})]}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>K(null),"aria-label":t(`common:action.close`),className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,h.jsx)(ee,{className:`h-4 w-4`})})]}),(0,h.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-4`,children:[(0,h.jsx)(`p`,{className:`text-sm`,children:G&&t(`activity:skillDetail.uninstallConfirm`,{name:G.name})}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:G&&t(`activity:skillDetail.uninstallRemovePath`,{path:G.path})})]}),(0,h.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-border/70 bg-muted/20 p-4`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:()=>K(null),disabled:q,className:`rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent disabled:opacity-50`,children:t(`common:action.cancel`)}),(0,h.jsxs)(`button`,{type:`button`,onClick:()=>G&&He(G),disabled:q,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:[q&&(0,h.jsx)(o,{className:`h-3 w-3 animate-spin`}),t(`activity:skillDetail.uninstallAction`)]})]})]})})]}):(0,h.jsx)(xe,{icon:(0,h.jsx)(se,{className:`h-6 w-6`}),title:t(`activity:skillDetail.noSkillSelected`),description:t(`activity:skillDetail.selectSkillHint`),action:{label:t(`activity:skillDetail.goToChat`),onClick:$},className:e})}export{v as SkillDetailView};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-BNmTiJ-I.js";import{Cr as r,Dr as i,Et as a,Fa as o,G as s,K as c,Kn as l,Nt as u,On as d,Qt as f,Rr as p,Si as m,Ta as h,Vt as g,Yr as ee,ei as _,ht as v,kt as y,m as b,mi as x,na as te,oi as ne,ra as S,tn as re,xi as ie,xn as C,ya as w}from"./vendor-BshlG0z-.js";import"./i18n-DBqM1FUM.js";import{t as T}from"./utils-BpBOwXlT.js";import{n as E}from"./stores-Cfei1ViB.js";import{t as D}from"./button-rqi3MczV.js";import{t as O}from"./input-ClZR-odw.js";import{A as ae,M as k,N as oe,b as A,j as se,x as j}from"./index-TDhvFXb0.js";var M=e(t(),1),N=n(),P={current:{labelKey:`activity:techStackStatus.current`,badge:`border-success/35 bg-success/10 text-success`,dot:`bg-success`,weight:0},update_available_safe:{labelKey:`activity:techStackStatus.update_available_safe`,badge:`border-info/35 bg-info/10 text-info`,dot:`bg-info`,weight:30},update_available_breaking:{labelKey:`activity:techStackStatus.update_available_breaking`,badge:`border-warning/35 bg-warning/10 text-warning`,dot:`bg-warning`,weight:50},vulnerable:{labelKey:`activity:techStackStatus.vulnerable`,badge:`border-destructive/45 bg-destructive/15 text-destructive`,dot:`bg-destructive`,weight:100},deprecated:{labelKey:`activity:techStackStatus.deprecated`,badge:`border-destructive/35 bg-destructive/10 text-destructive`,dot:`bg-destructive`,weight:70},yanked:{labelKey:`activity:techStackStatus.yanked`,badge:`border-destructive/45 bg-destructive/15 text-destructive`,dot:`bg-destructive`,weight:80},unmaintained_suspected:{labelKey:`activity:techStackStatus.unmaintained_suspected`,badge:`border-warning/35 bg-warning/10 text-warning`,dot:`bg-warning`,weight:60},blocked_by_constraints:{labelKey:`activity:techStackStatus.blocked_by_constraints`,badge:`border-warning/30 bg-warning/5 text-warning`,dot:`bg-warning`,weight:40},private_or_unresolved:{labelKey:`activity:techStackStatus.private_or_unresolved`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:10},local_path:{labelKey:`activity:techStackStatus.local_path`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},git_dependency:{labelKey:`activity:techStackStatus.git_dependency`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},unsupported:{labelKey:`activity:techStackStatus.unsupported`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},unknown:{labelKey:`activity:techStackStatus.unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:20}},ce={labelKey:`activity:techStackStatus.unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:0};function F(e){return P[e]??ce}var I={npm:{label:`npm / Node.js`,icon:C},python:{label:`Python`,icon:m},rust:{label:`Rust`,icon:y},go:{label:`Go`,icon:f},dotnet:{label:`.NET`,icon:d},php:{label:`PHP`,icon:v},dart:{label:`Dart / Flutter`,icon:x},maven:{label:`Maven`,icon:h},gradle:{label:`Gradle`,icon:S},ruby:{label:`Ruby`,icon:r},swift:{label:`Swift`,icon:s},elixir:{label:`Elixir`,icon:v},cpp:{label:`C / C++`,icon:ie}},le={labelKey:`activity:techStackStatus.unknown`};function L(e,t){let n=R(e);return n.labelKey?t(n.labelKey):n.label??e}function R(e){return I[e]??le}function z({ecosystem:e,className:t=`size-3.5 shrink-0`}){let n=R(e);if(!n.icon)return null;let r=n.icon;return(0,N.jsx)(r,{className:t})}function ue(e){return F(e.status).weight>=50}var de=[`critical`,`high`,`medium`,`low`,`info`],B={critical:{labelKey:`activity:techStackSeverity.critical`,badge:`border-destructive/45 bg-destructive/15 text-destructive`},high:{labelKey:`activity:techStackSeverity.high`,badge:`border-destructive/35 bg-destructive/10 text-destructive`},medium:{labelKey:`activity:techStackSeverity.medium`,badge:`border-warning/35 bg-warning/10 text-warning`},low:{labelKey:`activity:techStackSeverity.low`,badge:`border-info/35 bg-info/10 text-info`},info:{labelKey:`activity:techStackSeverity.info`,badge:`border-border/70 bg-muted text-muted-foreground`}},V={none:`activity:techStackAction.none`,upgrade_patch:`activity:techStackAction.upgrade_patch`,upgrade_minor:`activity:techStackAction.upgrade_minor`,upgrade_major:`activity:techStackAction.upgrade_major`,replace:`activity:techStackAction.replace`,remove:`activity:techStackAction.remove`,investigate:`activity:techStackAction.investigate`},H={full:{labelKey:`activity:techStackCoverage.full`,badge:`border-success/35 bg-success/10 text-success`,noteKey:void 0},partial:{labelKey:`activity:techStackCoverage.partial`,badge:`border-warning/35 bg-warning/10 text-warning`,noteKey:`activity:techStackCoverage.partialNote`},unsupported:{labelKey:`activity:techStackCoverage.unsupported`,badge:`border-border/70 bg-muted text-muted-foreground`,noteKey:`activity:techStackCoverage.unsupportedNote`}};function U(e){return H[e]??H.unsupported}function W(e){if(!e)return null;let t=/^\D*(\d+)/.exec(e);if(!t?.[1])return null;let n=Number(t[1]);return Number.isFinite(n)?n:null}function G(e){let t=W(e.locked??e.installed??e.requested),n=W(e.latestStable);if(t===null||n===null||n<=t)return{majorsBehind:0,label:null};let r=n-t;return{majorsBehind:r,label:`${r} major${r===1?``:`s`} behind`}}function fe(e){return e.locked??e.installed??e.requested??null}function K(e){return e.confidence<1}function q({className:e,children:t}){return(0,N.jsx)(`span`,{className:T(`inline-flex shrink-0 items-center gap-1 border px-1.5 py-0.5 text-[10px] font-medium`,e),children:t})}function J({label:e,value:t,hint:n,tone:r=`default`}){let i={default:`text-foreground`,success:`text-success`,warning:`text-warning`,info:`text-info`,destructive:`text-destructive`}[r];return(0,N.jsxs)(`div`,{className:`border border-border/70 bg-card/55 px-3 py-2.5 shadow-[inset_0_1px_0_hsl(var(--foreground)/0.035)]`,children:[(0,N.jsx)(`p`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:e}),(0,N.jsxs)(`div`,{className:`mt-1 flex items-end justify-between gap-2`,children:[(0,N.jsx)(`p`,{className:T(`font-mono text-xl font-bold tabular-nums`,i),children:t}),(0,N.jsx)(`p`,{className:`truncate text-[9px] text-muted-foreground`,children:n})]})]})}function Y(e,t){let n,r,i;if(t===`json`)n=JSON.stringify(e,null,2),r=`techstack.json`,i=`application/json`;else if(t===`spdx`){let t={spdxVersion:`SPDX-2.3`,dataLicense:`CC0-1.0`,SPDXID:`SPDXRef-DOCUMENT`,name:`TechStack-SBOM-${e.projectId}`,documentNamespace:`https://wrongstack.dev/spdx/${e.id}`,creationInfo:{created:e.createdAt,creators:[`Tool: WrongStack TechStack Engine`]},packages:e.dependencies.map((e,t)=>({name:e.name,SPDXID:`SPDXRef-Package-${t}`,versionInfo:e.locked??e.requested,downloadLocation:e.purl?`https://purl.io/${e.purl}`:`NOASSERTION`,licenseConcluded:e.license??`NOASSERTION`}))};n=JSON.stringify(t,null,2),r=`techstack-sbom-spdx.json`,i=`application/json`}else if(t===`cyclonedx`){let t={bomFormat:`CycloneDX`,specVersion:`1.5`,version:1,metadata:{timestamp:e.createdAt,tools:[{name:`WrongStack TechStack Engine`,version:e.adapterVersion}]},components:e.dependencies.map(e=>({type:`library`,name:e.name,version:e.locked??e.requested,...e.purl?{purl:e.purl}:{},...e.license?{licenses:[{license:{id:e.license}}]}:{}}))};n=JSON.stringify(t,null,2),r=`techstack-sbom-cyclonedx.json`,i=`application/json`}else{let t=[`# TechStack Report`,``,`**Generated:** ${e.createdAt}`,`**Target:** ${e.targetRoot}`,`**Fingerprint:** ${e.fingerprint}`,`**Workspaces:** ${e.workspaces.length}`,`**Dependencies:** ${e.dependencies.length}`,`**Findings:** ${e.findings.length}`,`**Coverage:** ${e.coverage}`,``];if(e.workspaces.length>0){t.push(`## Workspaces`,``,`| Workspace | Ecosystem | Coverage | Deps |`,`|---|---|---|---|`);for(let n of e.workspaces){let r=e.dependencies.filter(e=>e.workspaceId===n.id).length;t.push(`| ${n.relativeRoot} | ${n.ecosystem} | ${n.coverage} | ${r} |`)}t.push(``)}if(e.findings.length>0){t.push(`## Findings`,``);let n=new Map;for(let t of e.findings)n.set(t.severity,[...n.get(t.severity)??[],t]);for(let r of[`critical`,`high`,`medium`,`low`,`info`]){let i=n.get(r);if(i?.length){t.push(`### ${r.charAt(0).toUpperCase()+r.slice(1)} (${i.length})`,``);for(let n of i){let r=e.dependencies.find(e=>e.id===n.dependencyId);t.push(`- **${r?.name??n.dependencyId}** — ${n.type} — ${n.rationale}`)}t.push(``)}}}if(e.dependencies.length>0){t.push(`## Dependencies`,``,`| Name | Ecosystem | Status | Locked | Latest |`,`|---|---|---|---|---|`);for(let n of e.dependencies)t.push(`| ${n.name} | ${n.ecosystem} | ${n.status} | ${n.locked??`—`} | ${n.latestStable??`—`} |`)}n=t.join(`
2
- `),r=`techstack-report.md`,i=`text/markdown`}let a=new Blob([n],{type:i}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=r,s.click(),URL.revokeObjectURL(o)}function pe({dependency:e,findings:t,deepDive:n,onDeepDive:r,onBack:i,coverage:s}){let{t:c}=o(),u=F(e.status),d=fe(e),f=G(e),p=s?U(s).noteKey:void 0;return(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,N.jsxs)(`header`,{className:`shrink-0 border-b border-border/70 bg-card/45 p-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,N.jsx)(D,{variant:`ghost`,size:`icon`,onClick:i,"aria-label":c(`activity:techStack.backToDependencyList`),className:`shrink-0 md:hidden`,children:(0,N.jsx)(w,{className:`size-4`})}),(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(`h2`,{className:`min-w-0 truncate font-mono text-sm font-bold text-foreground`,children:e.name}),(0,N.jsx)(q,{className:u.badge,children:c(u.labelKey)})]}),(0,N.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[L(e.ecosystem,c),` ·`,` `,e.direct?`direct`:`transitive`,` · `,e.scope,` ·`,` `,e.sourceType,p&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,N.jsx)(`span`,{className:`text-warning`,children:c(p)})]})]})]})]}),(0,N.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-baseline gap-2 font-mono text-xs`,children:[(0,N.jsx)(`span`,{className:`text-foreground`,children:d??`—`}),e.latestStable&&e.latestStable!==d&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,N.jsx)(`span`,{className:`text-info`,children:e.latestStable})]}),f.label&&(0,N.jsxs)(`span`,{className:`text-[10px] text-warning`,children:[`(`,f.label,`)`]})]})]}),(0,N.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,N.jsxs)(`dl`,{className:`grid grid-cols-2 gap-px border border-border/70 bg-border/60`,children:[(0,N.jsx)(X,{label:c(`activity:techStack.constraint`),value:e.requested??`—`,mono:!0}),(0,N.jsx)(X,{label:c(`activity:techStack.locked`),value:e.locked??`—`,mono:!0}),(0,N.jsx)(X,{label:c(`activity:techStack.latestStable`),value:e.latestStable??`—`,mono:!0}),(0,N.jsx)(X,{label:c(`activity:techStack.license`),value:e.license??`—`}),e.wanted&&(0,N.jsx)(X,{label:c(`activity:techStack.wanted`),value:e.wanted,mono:!0}),e.resolvable&&(0,N.jsx)(X,{label:c(`activity:techStack.resolvable`),value:e.resolvable,mono:!0}),e.purl&&(0,N.jsx)(X,{label:c(`activity:techStack.purl`),value:e.purl,mono:!0}),(0,N.jsx)(X,{label:c(`activity:techStack.registryFlags`),value:[e.deprecated&&`deprecated`,e.yanked&&`yanked`].filter(Boolean).join(`, `)||`none`})]}),(0,N.jsxs)(`section`,{className:`mt-4`,children:[(0,N.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-center justify-between gap-2`,children:[(0,N.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:c(`activity:techStack.findings`)}),(0,N.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>r(e),disabled:n.status===`loading`,className:`h-7 text-[10px]`,children:[n.status===`loading`?(0,N.jsx)(l,{className:`size-3 animate-spin`}):(0,N.jsx)(a,{className:`size-3`}),n.status===`loading`?`Researching…`:`Deep dive`]})]}),n.status===`error`&&n.error&&(0,N.jsx)(`p`,{role:`alert`,className:`mb-1.5 text-[10px] text-destructive`,children:n.error}),t.length===0?(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:c(`activity:techStack.nothingFlaggedRunADeepDive`)}):(0,N.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,N.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(q,{className:B[e.severity].badge,children:c(B[e.severity].labelKey)}),(0,N.jsx)(q,{className:`border-border/70 bg-muted text-muted-foreground`,children:V[e.action]?c(V[e.action]):e.action}),K(e)&&(0,N.jsxs)(q,{className:`border-info/35 bg-info/10 text-info`,children:[(0,N.jsx)(a,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,N.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,N.jsx)(`p`,{className:`mt-1 border-l-2 border-warning/40 pl-2 text-[10px] leading-relaxed text-warning`,children:e.breakingRisk})]},e.id))})]}),(0,N.jsxs)(`section`,{className:`mt-4`,children:[(0,N.jsx)(`h3`,{className:`mb-1.5 text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:c(`activity:techStack.evidence`)}),e.evidence.length===0?(0,N.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:c(`activity:techStack.noEvidenceRecorded`)}):(0,N.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.evidence.map((t,n)=>(0,N.jsxs)(`li`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(q,{className:`border-border/70 bg-muted text-muted-foreground`,children:t.kind}),(0,N.jsx)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(t.retrievedAt).toLocaleString()})]}),t.source.startsWith(`http`)?(0,N.jsxs)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`mt-1 flex min-w-0 items-center gap-1 truncate text-[10px] text-info underline-offset-2 hover:underline`,children:[(0,N.jsx)(`span`,{className:`truncate`,children:t.source}),(0,N.jsx)(_,{className:`size-2.5 shrink-0`})]}):(0,N.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-muted-foreground`,children:t.source}),t.detail&&(0,N.jsx)(`p`,{className:`mt-0.5 text-[10px] leading-relaxed text-muted-foreground`,children:t.detail})]},`${e.id}-evidence-${n}`))})]})]})]})}function X({label:e,value:t,mono:n}){return(0,N.jsxs)(`div`,{className:`bg-card/55 px-2.5 py-1.5`,children:[(0,N.jsx)(`dt`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:e}),(0,N.jsx)(`dd`,{className:T(`mt-0.5 truncate text-[11px] text-foreground`,n&&`font-mono`),children:t})]})}var me=`grid grid-cols-[minmax(0,2.2fr)_minmax(0,1.6fr)_minmax(0,1.1fr)] gap-2`;function he({dependencies:e,selectedId:t,hasDependencies:n,coverageByWorkspaceId:r,onSelect:i}){let{t:a}=o(),s=j(e,30);return e.length===0?(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,N.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:n?`No dependencies match the current filters.`:`No dependencies inventoried yet. Run a scan to populate the inventory.`})}):(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,N.jsxs)(`div`,{className:T(me,`shrink-0 border-b border-border/70 bg-card/45 px-3 py-1.5 text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`),children:[(0,N.jsx)(`span`,{children:a(`activity:techStack.package`)}),(0,N.jsx)(`span`,{children:a(`activity:techStack.installedLatest`)}),(0,N.jsx)(`span`,{children:a(`activity:techStack.status`)})]}),(0,N.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,N.jsx)(b,{className:`h-full`,"aria-label":a(`activity:techStack.dependencies`),children:s.pageItems.map(e=>(0,N.jsx)(ge,{dependency:e,selected:e.id===t,coverage:r?.get(e.workspaceId),onSelect:i},e.id))})}),(0,N.jsx)(A,{page:s.page,pageSize:s.pageSize,totalItems:s.totalItems,onPageChange:s.setPage,itemLabel:`dependencies`})]})}function ge({dependency:e,selected:t,coverage:n,onSelect:r}){let{t:i}=o(),a=F(e.status),s=fe(e),c=G(e),l=n?U(n).noteKey:void 0;return(0,N.jsxs)(`button`,{type:`button`,onClick:()=>r(e),"aria-current":t,className:T(me,`w-full items-center border-b border-border/40 px-3 py-2 text-left transition-colors hover:bg-accent/40`,t&&`bg-accent/60`),children:[(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:T(`size-1.5 shrink-0`,a.dot),"aria-hidden":`true`}),(0,N.jsx)(`span`,{className:`truncate font-mono text-xs text-foreground`,children:e.name})]}),(0,N.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[(0,N.jsx)(z,{ecosystem:e.ecosystem,className:`mr-0.5 inline-block size-3 align-text-bottom`}),L(e.ecosystem,i),` · `,e.direct?`direct`:`transitive`,` · `,e.scope,l&&(0,N.jsxs)(N.Fragment,{children:[` · `,(0,N.jsx)(`span`,{className:`text-warning`,children:i(l)})]})]})]}),(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-1.5 font-mono text-[11px]`,children:[(0,N.jsx)(`span`,{className:`truncate text-foreground`,children:s??`—`}),e.latestStable&&e.latestStable!==s&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`→`}),(0,N.jsx)(`span`,{className:`truncate text-info`,children:e.latestStable})]})]}),c.label?(0,N.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-warning`,children:c.label}):e.requested&&(0,N.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:e.requested})]}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,N.jsx)(q,{className:a.badge,children:i(a.labelKey)}),e.deprecated&&(0,N.jsx)(q,{className:`border-destructive/35 bg-destructive/10 text-destructive`,children:`dep`}),e.yanked&&(0,N.jsx)(q,{className:`border-destructive/45 bg-destructive/15 text-destructive`,children:`yank`})]})]})}function _e({findings:e,dependenciesById:t,onSelectDependency:n}){let{t:r}=o(),i=j(e,20);if(e.length===0)return(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,N.jsxs)(`p`,{className:`max-w-sm text-xs text-muted-foreground`,children:[r(`activity:techStack.noFindingsRun`),` `,(0,N.jsx)(`span`,{className:`font-mono text-foreground`,children:r(`activity:techStack.analyze`)}),` `,r(`activity:techStack.toCheckVersionsAndAdvisoriesAgainst`)]})});let a=de.map(e=>[e,i.pageItems.filter(t=>t.severity===e)]).filter(([,e])=>e.length>0);return(0,N.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,N.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,N.jsx)(`div`,{className:`flex flex-col gap-4`,children:a.map(([e,i])=>(0,N.jsxs)(`section`,{children:[(0,N.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:[(0,N.jsx)(q,{className:B[e].badge,children:r(B[e].labelKey)}),(0,N.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-muted-foreground`,children:i.length})]}),(0,N.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:i.map(e=>(0,N.jsx)(ve,{finding:e,dependency:t.get(e.dependencyId),onSelectDependency:n},e.id))})]},e))})}),(0,N.jsx)(A,{page:i.page,pageSize:i.pageSize,totalItems:i.totalItems,onPageChange:i.setPage,itemLabel:`findings`})]})}function ve({finding:e,dependency:t,onSelectDependency:n}){let{t:r}=o(),i=K(e);return(0,N.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>n(e.dependencyId),className:`min-w-0 truncate font-mono text-xs text-foreground underline-offset-2 hover:underline`,children:t?.name??e.dependencyId}),(0,N.jsx)(q,{className:`border-border/70 bg-muted text-muted-foreground`,children:V[e.action]?r(V[e.action]):e.action}),i&&(0,N.jsxs)(q,{className:`border-info/35 bg-info/10 text-info`,children:[(0,N.jsx)(a,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,N.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,N.jsx)(`p`,{className:`mt-1 border-l-2 border-warning/40 pl-2 text-[10px] leading-relaxed text-warning`,children:e.breakingRisk}),e.evidence.length>0&&(0,N.jsx)(`ul`,{className:T(`mt-1.5 flex flex-col gap-0.5`),children:e.evidence.slice(0,4).map((t,n)=>(0,N.jsx)(`li`,{className:`min-w-0 truncate text-[10px]`,children:t.source.startsWith(`http`)?(0,N.jsx)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`text-info underline-offset-2 hover:underline`,children:t.detail??t.source}):(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:t.detail??t.source})},`${e.id}-${n}`))})]})}function ye({searchQuery:e,ecosystemFilter:t,statusFilter:n,directOnly:r,sort:a,hasFilters:s,ecosystems:l,statuses:u,visibleCount:d,totalCount:f,onSearchChange:p,onEcosystemFilterChange:m,onStatusFilterChange:h,onToggleDirectOnly:ee,onSortChange:_,onClearFilters:v}){let{t:y}=o();return(0,N.jsxs)(`div`,{className:`shrink-0 space-y-2 border-b border-border/70 bg-card/45 p-3`,children:[(0,N.jsxs)(`div`,{className:`flex gap-2`,children:[(0,N.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,N.jsx)(g,{className:`pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,N.jsx)(O,{"aria-label":y(`activity:techStack.searchDependencies`),value:e,onChange:e=>p(e.target.value),placeholder:y(`activity:techStack.searchByPackageName`),className:`h-10 min-w-0 bg-background pl-9 pr-8 text-xs`}),e&&(0,N.jsx)(`button`,{type:`button`,"aria-label":y(`activity:techStack.clearSearch`),onClick:()=>p(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground`,children:(0,N.jsx)(c,{className:`size-3.5`})})]}),(0,N.jsx)(D,{variant:r?`default`:`outline`,size:`sm`,onClick:ee,"aria-pressed":r,title:y(`activity:techStack.showOnlyDependenciesThisProjectDeclaresItself`),className:`shrink-0`,children:y(`activity:techStack.directOnly`)}),s&&(0,N.jsx)(D,{variant:`ghost`,size:`icon`,onClick:v,"aria-label":y(`activity:techStack.clearAllFilters`),title:y(`activity:techStack.clearAllFilters`),className:`shrink-0`,children:(0,N.jsx)(i,{className:`size-4`})})]}),(0,N.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-ecosystem-filter`,children:y(`activity:techStack.filterByEcosystem`)}),(0,N.jsxs)(`select`,{id:`techstack-ecosystem-filter`,value:t,onChange:e=>m(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,N.jsx)(`option`,{value:`all`,children:y(`activity:techStack.allEcosystems`)}),l.map(([e,t])=>(0,N.jsxs)(`option`,{value:e,children:[L(e,y),` · `,t]},e))]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-status-filter`,children:y(`activity:techStack.filterByStatus`)}),(0,N.jsxs)(`select`,{id:`techstack-status-filter`,value:n,onChange:e=>h(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,N.jsx)(`option`,{value:`all`,children:y(`activity:techStack.allStatuses`)}),u.map(([e,t])=>(0,N.jsxs)(`option`,{value:e,children:[y(F(e).labelKey),` · `,t]},e))]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-sort`,children:y(`activity:techStack.sortDependencies`)}),(0,N.jsxs)(`select`,{id:`techstack-sort`,value:a,onChange:e=>_(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,N.jsx)(`option`,{value:`attention`,children:y(`activity:techStack.sortNeedsAttention`)}),(0,N.jsx)(`option`,{value:`drift`,children:y(`activity:techStack.sortMostOutOfDate`)}),(0,N.jsx)(`option`,{value:`name`,children:y(`activity:techStack.sortName`)})]})]})]}),(0,N.jsx)(`p`,{className:T(`text-[10px] text-muted-foreground`,s&&`text-info`),children:d===f?`${f} dependencies`:`${d} of ${f} dependencies`})]})}var be=[{id:`dependencies`,labelKey:`activity:techStack.tabDependencies`},{id:`findings`,labelKey:`activity:techStack.tabFindings`},{id:`workspaces`,labelKey:`activity:techStack.tabWorkspaces`},{id:`trends`,labelKey:`activity:techStack.tabTrends`},{id:`remediation`,labelKey:`activity:techStack.tabRemediation`}],Z=new Set([`npm`,`python`,`rust`,`go`,`php`,`dotnet`]);function Q(){let{t:e}=o(),t=E(e=>e.snapshot),n=E(e=>e.stale),r=E(e=>e.loading),i=E(e=>e.error),s=E(e=>e.activeJob),[d,f]=(0,M.useState)(`dependencies`),[m,h]=(0,M.useState)(``),[g,_]=(0,M.useState)(`all`),[v,b]=(0,M.useState)(`all`),[x,te]=(0,M.useState)(!1),[S,ie]=(0,M.useState)(`attention`),[C,w]=(0,M.useState)(null),[O,A]=(0,M.useState)([]),[j,P]=(0,M.useState)({status:`idle`,error:null}),[ce,I]=(0,M.useState)(null),[le,L]=(0,M.useState)(null),[R,z]=(0,M.useState)(new Set),[de,B]=(0,M.useState)(!1),V=(0,M.useCallback)(async()=>{let e=E.getState();e.setLoading(!0),e.setError(null);try{let t=await fetch(`/api/techstack/snapshot`);if(t.status===404){e.setSnapshot(null,!1);return}if(!t.ok)throw Error(`HTTP ${t.status}: ${t.statusText}`);let n=await t.json();e.setSnapshot(n.snapshot,n.stale)}catch(t){e.setError(t instanceof Error?t.message:String(t))}},[]),H=(0,M.useCallback)(async e=>{let t=E.getState();t.setLoading(!0),t.setError(null);try{let n=await fetch(`/api/techstack/${e}`,{method:`POST`}),r=await n.json();if(!n.ok||!r.jobId)throw Error(r.error??`HTTP ${n.status}: ${n.statusText}`);t.jobStarted(r.jobId,e)}catch(e){t.setError(e instanceof Error?e.message:String(e))}},[]),U=(0,M.useCallback)(async()=>{let e=E.getState().activeJob;if(e)try{let t=await fetch(`/api/techstack/jobs/${encodeURIComponent(e.id)}/cancel`,{method:`POST`});if(!t.ok)throw Error(`HTTP ${t.status}: ${t.statusText}`);E.getState().jobCancelled(e.id)}catch(e){E.getState().setError(e instanceof Error?e.message:String(e))}},[]),W=(0,M.useCallback)(async e=>{P({status:`loading`,error:null});try{let t=await fetch(`/api/techstack/deps/${encodeURIComponent(e.id)}/research`,{method:`POST`}),n=await t.json();if(!t.ok)throw Error(n.error??`HTTP ${t.status}`);A(n.findings??[]),P({status:`idle`,error:null})}catch(e){P({status:`error`,error:e instanceof Error?e.message:String(e)})}},[]);(0,M.useEffect)(()=>{V()},[V]),(0,M.useEffect)(()=>{(d===`trends`||d===`remediation`)&&fetch(`/api/techstack/${d===`trends`?`trends`:`remediation`}`).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);t.trend&&I(t.trend),t.plan&&L(t.plan)}).catch(e=>E.getState().setError(e instanceof Error?e.message:String(e)))},[d,t?.id]);let fe=(0,M.useCallback)(async()=>{if(R.size!==0){B(!0);try{let e=await fetch(`/api/techstack/remediation/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approvedItems:[...R]})}),t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);z(new Set),await H(`inventory`)}catch(e){E.getState().setError(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[R,H]);(0,M.useEffect)(()=>{A([]),P({status:`idle`,error:null})},[t?.id]);let K=(0,M.useMemo)(()=>t?.dependencies??[],[t]),q=(0,M.useMemo)(()=>t?.findings??[],[t]),X=(0,M.useMemo)(()=>new Map(K.map(e=>[e.id,e])),[K]),me=(0,M.useMemo)(()=>Ee(K.map(e=>e.ecosystem)),[K]),ge=(0,M.useMemo)(()=>Ee(K.map(e=>e.status)),[K]),ve=(0,M.useMemo)(()=>new Map(t?.workspaces.map(e=>[e.id,e.coverage])??[]),[t]),Z=(0,M.useMemo)(()=>{let e=m.trim().toLowerCase(),t=[...K.filter(t=>!(e&&!t.name.toLowerCase().includes(e)||g!==`all`&&t.ecosystem!==g||v!==`all`&&t.status!==v||x&&!t.direct))];return S===`name`?t.sort((e,t)=>e.name.localeCompare(t.name)):S===`drift`?t.sort((e,t)=>G(t).majorsBehind-G(e).majorsBehind||e.name.localeCompare(t.name)):t.sort((e,t)=>F(t.status).weight-F(e.status).weight||Number(t.direct)-Number(e.direct)||e.name.localeCompare(t.name)),t},[K,m,g,v,x,S]),Q=C?X.get(C):void 0,De=(0,M.useMemo)(()=>Q?[...q.filter(e=>e.dependencyId===Q.id),...O.filter(e=>e.dependencyId===Q.id)]:[],[q,O,Q]),Oe=(0,M.useMemo)(()=>K.filter(ue).length,[K]),ke=(0,M.useMemo)(()=>K.filter(e=>G(e).majorsBehind>0).length,[K]),Ae=(0,M.useMemo)(()=>K.filter(e=>e.status===`vulnerable`).length,[K]),je=m.trim()!==``||g!==`all`||v!==`all`||x,Me=(0,M.useCallback)(()=>{h(``),_(`all`),b(`all`),te(!1)},[]),$=!!(s&&![`completed`,`failed`,`cancelled`].includes(s.status)),Ne=(0,M.useCallback)(e=>{w(e),f(`dependencies`)},[]);return(0,N.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,N.jsx)(`header`,{className:`shrink-0 border-b border-border/70 px-4 py-3`,children:(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(`h1`,{className:`text-base font-bold sm:text-lg`,children:e(`activity:techStack.techstack`)}),(0,N.jsx)(`span`,{className:`border border-info/35 bg-info/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-info`,children:t?`${t.workspaces.length} workspaces`:`no scan yet`}),n&&(0,N.jsx)(`span`,{className:`border border-warning/35 bg-warning/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-warning`,children:e(`activity:techStack.staleGt24h`)})]}),(0,N.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground sm:text-xs`,children:t?`${t.targetRoot} · scanned ${new Date(t.createdAt).toLocaleString()}`:`Scan the open project to inventory its dependencies.`})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>void H(`inventory`),disabled:$,title:e(`activity:techStack.offlineReReadManifestsAndLockfiles`),children:[(0,N.jsx)(re,{className:T(`size-3.5`,$&&`animate-spin`)}),(0,N.jsx)(`span`,{className:`hidden sm:inline`,children:e(`activity:techStack.refresh`)})]}),(0,N.jsxs)(D,{size:`sm`,onClick:()=>void H(`analyze`),disabled:$,title:e(`activity:techStack.checkRegistriesAndAdvisoriesThenInterpretTheResultsWithTheModel`),children:[(0,N.jsx)(a,{className:`size-3.5`}),e(`activity:techStack.analyze`)]}),$&&(0,N.jsx)(D,{variant:`ghost`,size:`icon`,onClick:()=>void U(),"aria-label":e(`activity:techStack.cancelJob`),children:(0,N.jsx)(c,{className:`size-4`})}),(0,N.jsxs)(ae,{children:[(0,N.jsx)(oe,{asChild:!0,children:(0,N.jsx)(D,{variant:`ghost`,size:`icon`,disabled:!t,"aria-label":e(`activity:techStack.exportOptions`),title:e(`activity:techStack.exportOptions`),children:(0,N.jsx)(ne,{className:`size-4`})})}),(0,N.jsxs)(se,{align:`end`,className:`w-60`,children:[(0,N.jsxs)(k,{onClick:()=>t&&Y(t,`json`),children:[(0,N.jsx)(ee,{className:`mr-2 size-4`}),e(`activity:techStack.exportSnapshotAsJson`)]}),(0,N.jsxs)(k,{onClick:()=>t&&Y(t,`spdx`),children:[(0,N.jsx)(y,{className:`mr-2 size-4`}),e(`activity:techStack.exportSbomSpdx`)]}),(0,N.jsxs)(k,{onClick:()=>t&&Y(t,`cyclonedx`),children:[(0,N.jsx)(u,{className:`mr-2 size-4`}),e(`activity:techStack.exportSbomCycloneDx`)]}),(0,N.jsxs)(k,{onClick:()=>t&&Y(t,`md`),children:[(0,N.jsx)(p,{className:`mr-2 size-4`}),e(`activity:techStack.exportReportMd`)]})]})]})]})]})}),t&&(0,N.jsxs)(`div`,{className:`grid shrink-0 grid-cols-2 gap-px border-b border-border/70 bg-border/60 sm:grid-cols-4`,children:[(0,N.jsx)(J,{label:e(`activity:techStack.dependencies`),value:K.length,hint:`${Z.length} visible`}),(0,N.jsx)(J,{label:e(`activity:techStack.outdated`),value:ke,hint:e(`activity:techStack.majorsBehind`),tone:ke>0?`warning`:`success`}),(0,N.jsx)(J,{label:e(`activity:techStack.vulnerable`),value:Ae,hint:e(`activity:techStack.knownAdvisories`),tone:Ae>0?`destructive`:`success`}),(0,N.jsx)(J,{label:e(`activity:techStack.findings`),value:q.length,hint:`${Oe} need attention`,tone:q.length>0?`info`:`default`})]}),($||i)&&(0,N.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-2`,"aria-live":`polite`,children:[$&&s&&(0,N.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 text-xs text-info`,children:[(0,N.jsx)(l,{className:`size-3.5 animate-spin`}),(0,N.jsx)(`span`,{className:`font-mono`,children:s.status}),s.progress&&(0,N.jsxs)(`span`,{className:`text-muted-foreground`,children:[s.progress.completed,`/`,s.progress.total]})]}),i&&(0,N.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 text-xs text-destructive`,children:[(0,N.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:i}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>void V(),className:`underline`,children:e(`activity:techStack.retry`)})]})]}),r&&!t?(0,N.jsx)(we,{}):t?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`nav`,{className:`flex shrink-0 gap-1 border-b border-border/70 px-2`,children:be.map(t=>(0,N.jsxs)(`button`,{type:`button`,onClick:()=>f(t.id),"aria-current":d===t.id,className:T(`border-b-2 px-3 py-2 text-xs font-medium transition-colors`,d===t.id?`border-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e(t.labelKey),t.id===`findings`&&q.length>0&&(0,N.jsx)(`span`,{className:`ml-1.5 font-mono text-[10px] tabular-nums text-muted-foreground`,children:q.length})]},t.id))}),d===`dependencies`&&(0,N.jsxs)(`div`,{className:`grid min-h-0 flex-1 md:grid-cols-[minmax(340px,1fr)_minmax(0,1.15fr)]`,children:[(0,N.jsxs)(`section`,{className:T(`min-h-0 border-r border-border/70`,Q?`hidden md:flex md:flex-col`:`flex flex-col`),"aria-label":e(`activity:techStack.dependencyList`),children:[(0,N.jsx)(ye,{searchQuery:m,ecosystemFilter:g,statusFilter:v,directOnly:x,sort:S,hasFilters:je,ecosystems:me,statuses:ge,visibleCount:Z.length,totalCount:K.length,onSearchChange:h,onEcosystemFilterChange:_,onStatusFilterChange:b,onToggleDirectOnly:()=>te(e=>!e),onSortChange:ie,onClearFilters:Me}),(0,N.jsx)(he,{dependencies:Z,selectedId:C,hasDependencies:K.length>0,coverageByWorkspaceId:ve,onSelect:e=>w(e.id)})]}),(0,N.jsx)(`section`,{className:T(`min-h-0`,Q?`flex flex-col`:`hidden md:flex md:flex-col`),"aria-label":e(`activity:techStack.dependencyDetail`),children:Q?(0,N.jsx)(pe,{dependency:Q,findings:De,deepDive:j,onDeepDive:W,onBack:()=>w(null),coverage:ve.get(Q.workspaceId)}):(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,N.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:e(`activity:techStack.selectADependencyToSeeIts`)})})})]}),d===`findings`&&(0,N.jsx)(_e,{findings:q,dependenciesById:X,onSelectDependency:Ne}),d===`workspaces`&&(0,N.jsx)(Ce,{snapshot:t}),d===`trends`&&(0,N.jsx)(xe,{trend:ce}),d===`remediation`&&(0,N.jsx)(Se,{plan:le,approved:R,applying:de,onToggle:e=>z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onApply:()=>void fe()})]}):(0,N.jsx)(Te,{onScan:()=>void H(`inventory`),disabled:$})]})}function xe({trend:e}){return e?(0,N.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,N.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[e.snapshots,` snapshots`,e.vulnerabilityHalfLifeMs===void 0?``:` · vulnerability half-life ${(e.vulnerabilityHalfLifeMs/864e5).toFixed(1)} days`]}),(0,N.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.points.map(e=>(0,N.jsxs)(`div`,{className:`grid grid-cols-4 border border-border/70 bg-card/40 p-2 text-xs`,children:[(0,N.jsx)(`span`,{children:new Date(e.createdAt).toLocaleDateString()}),(0,N.jsxs)(`span`,{children:[e.dependencies,` deps`]}),(0,N.jsxs)(`span`,{className:`text-warning`,children:[e.outdated,` outdated`]}),(0,N.jsxs)(`span`,{className:`text-destructive`,children:[e.vulnerable,` vulnerable`]})]},e.snapshotId))})]}):(0,N.jsx)(we,{})}function Se({plan:e,approved:t,applying:n,onToggle:r,onApply:i}){let{t:a}=o();return e?(0,N.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,N.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.warning}),(0,N.jsxs)(D,{size:`sm`,disabled:t.size===0||n,onClick:i,children:[n&&(0,N.jsx)(l,{className:`size-3.5 animate-spin`}),`Apply `,t.size>0?t.size:``]})]}),(0,N.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e.items.map(e=>{let n=`${e.workspaceId}:${e.ecosystem}:${e.dependencyName}:${e.action}`,i=e.action===`replace`||e.action===`investigate`||!Z.has(e.ecosystem);return(0,N.jsxs)(`label`,{className:T(`flex gap-3 border border-border/70 bg-card/40 p-2.5`,i?`cursor-not-allowed opacity-65`:`cursor-pointer`),children:[(0,N.jsx)(`input`,{type:`checkbox`,disabled:i,checked:t.has(n),onChange:()=>r(n)}),(0,N.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`span`,{className:`block font-mono text-xs`,children:[e.dependencyName,` · `,e.action]}),(0,N.jsxs)(`span`,{className:`block text-[10px] text-muted-foreground`,children:[e.currentVersion??`?`,` → `,e.targetVersion??`latest`,` · `,e.rationale]}),i&&(0,N.jsx)(`span`,{className:`block text-[10px] text-warning`,children:a(`activity:techStack.requiresAManualPackageChoice`)})]})]},n)}),e.items.length===0&&(0,N.jsx)(`p`,{className:`p-8 text-center text-xs text-muted-foreground`,children:a(`activity:techStack.noRemediationNeeded`)})]})]}):(0,N.jsx)(we,{})}function Ce({snapshot:e}){let{t}=o(),n=(0,M.useMemo)(()=>{let t=new Map;for(let n of e.dependencies)t.set(n.workspaceId,(t.get(n.workspaceId)??0)+1);return t},[e]);return e.workspaces.length===0?(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`activity:techStack.noWorkspacesDetected`)})}):(0,N.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,N.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.workspaces.map(e=>{let r=H[e.coverage];return(0,N.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`p`,{className:`truncate font-mono text-xs text-foreground`,children:e.relativeRoot}),(0,N.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1 truncate text-[10px] text-muted-foreground`,children:[(0,N.jsx)(z,{ecosystem:e.ecosystem}),(0,N.jsx)(`span`,{children:L(e.ecosystem,t)}),e.packageManager?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,N.jsx)(`span`,{children:e.packageManager})]}):null,(0,N.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,N.jsxs)(`span`,{children:[n.get(e.id)??0,` deps`]})]})]}),(0,N.jsx)(`span`,{className:T(`shrink-0 border px-1.5 py-0.5 text-[10px] font-medium`,r.badge),children:t(r.labelKey)})]}),e.manifests.length>0&&(0,N.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:e.manifests.map(e=>(0,N.jsx)(`span`,{className:`border border-border/70 bg-background/45 px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:e.split(/[/\\]/).pop()},e))})]},e.id)})})})}function we(){let{t:e}=o();return(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,N.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,N.jsx)(l,{className:`size-5 animate-spin text-muted-foreground`}),(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`activity:techStack.loadingSnapshot`)})]})})}function Te({onScan:e,disabled:t}){let{t:n}=o(),r=(0,M.useMemo)(()=>Object.values(I).map(e=>e.label??``).filter(Boolean).join(`, `),[]);return(0,N.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,N.jsxs)(`div`,{className:`flex max-w-md flex-col items-center gap-3 text-center`,children:[(0,N.jsx)(`div`,{className:`flex size-14 items-center justify-center border border-info/25 bg-info/5 text-info`,children:(0,N.jsx)(te,{className:`size-6`})}),(0,N.jsx)(`h2`,{className:`text-sm font-semibold`,children:n(`activity:techStack.noInventoryYet`)}),(0,N.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`TechStack reads every manifest and lockfile in the open project — `,r,` — and compares what you have against the upstream registries.`]}),(0,N.jsxs)(D,{size:`sm`,onClick:e,disabled:t,children:[(0,N.jsx)(re,{className:T(`size-3.5`,t&&`animate-spin`)}),n(`activity:techStack.scanThisProject`)]})]})})}function Ee(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return[...t.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))}export{Q as TechStackView};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Z as t,et as n,t as r}from"./ws-client-C_IqS0t4.js";import{i,t as a}from"./react-core-BNmTiJ-I.js";import{Ct as o,Fa as s,K as c,Ra as l,Xt as u,ft as d,sn as f}from"./vendor-BshlG0z-.js";import"./i18n-DBqM1FUM.js";import{n as p,t as m}from"./utils-BpBOwXlT.js";import{n as h}from"./ui-store-CLXDcLPI.js";import"./stores-Cfei1ViB.js";import{n as g,t as _}from"./xterm-BWzBEEhg.js";var v=e(i(),1),y=`wrongstack.terminalDockHeight`,b=260;function x(e){let t=typeof window>`u`?640:Math.max(140,Math.min(640,Math.floor(window.innerHeight*.55),window.innerHeight-b));return Math.min(Math.max(Math.round(e),140),t)}var S=a(),C={background:`#1e1e2e`,foreground:`#cdd6f4`,cursor:`#f5e0dc`,selectionBackground:`#585b70`,black:`#45475a`,red:`#f38ba8`,green:`#a6e3a1`,yellow:`#f9e2af`,blue:`#89b4fa`,magenta:`#f5c2e7`,cyan:`#94e2d5`,white:`#bac2de`,brightBlack:`#585b70`,brightRed:`#f38ba8`,brightGreen:`#a6e3a1`,brightYellow:`#f9e2af`,brightBlue:`#89b4fa`,brightMagenta:`#f5c2e7`,brightCyan:`#94e2d5`,brightWhite:`#a6adc8`},w=8;function T(e=!1){return typeof window>`u`?300:x(window.innerHeight*(e?.32:.4))}function E(e=!1){if(typeof window>`u`)return T(e);try{let t=window.localStorage.getItem(y),n=t?Number.parseInt(t,10):NaN;return Number.isFinite(n)?x(n):T(e)}catch{return T(e)}}function D(e){try{window.localStorage.setItem(y,String(x(e)))}catch{}}function O(){return p()}function k(e){return{id:O(),name:`Terminal ${e}`,status:`starting`}}function A({desktopShell:e=!1,onClose:n}){let r=(0,v.useRef)(null),{t:i}=s(),a=(0,v.useRef)(1),[l,p]=(0,v.useState)(()=>E(e)),[g,_]=(0,v.useState)(()=>[k(1)]),[y,b]=(0,v.useState)(()=>g[0]?.id??``),C=h(e=>e.terminalCreateNonce),T=(0,v.useRef)(C),A=t(e=>e.projectName),M=t(e=>e.cwd);(0,v.useEffect)(()=>{let e=()=>{p(e=>{let t=x(e);return D(t),t})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let N=e=>{e.preventDefault(),r.current?.();let t=e.clientY,n=l,i=document.body.style.cursor,a=document.body.style.userSelect;document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`;let o=e=>{let r=x(n+t-e.clientY);p(r),D(r)},s=()=>{document.body.style.cursor=i,document.body.style.userSelect=a,window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s),r.current===s&&(r.current=null)};r.current=s,window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s,{once:!0}),window.addEventListener(`pointercancel`,s,{once:!0})};(0,v.useEffect)(()=>()=>r.current?.(),[]);let P=()=>{if(g.length>=w)return;a.current+=1;let e=k(a.current);_([...g,e]),b(e.id)};(0,v.useEffect)(()=>{C!==T.current&&(T.current=C,P())},[C]);let F=e=>{let t=g.findIndex(t=>t.id===e);if(t===-1)return;let r=g.filter(t=>t.id!==e);if(_(r),r.length===0){queueMicrotask(n);return}y===e&&b(r[Math.max(0,t-1)]?.id??r[0]?.id??``)},I=e=>{let t=O();g.some(t=>t.id===e)&&(_(g.map(n=>n.id===e?{...n,id:t,status:`starting`,exitCode:void 0}:n)),b(t))},L=()=>{_([]),b(``),queueMicrotask(n)},R=(e,t)=>{_(n=>n.map(n=>n.id===e?{...n,...t}:n))},z=g.find(e=>e.id===y)??g[0]??null;return(0,S.jsxs)(`div`,{"data-terminal-dock":!0,style:{height:l},"data-shell":e?`desktop`:`browser`,className:m(`z-30 flex min-h-0 shrink-0 flex-col border-t border-border/70 bg-card shadow-2xl`,e&&`ws-terminal-desktop`),children:[(0,S.jsx)(`hr`,{"aria-orientation":`horizontal`,tabIndex:0,title:i(`activity:terminal.resize`),onPointerDown:N,className:`h-1.5 cursor-ns-resize bg-muted/70 transition-colors hover:bg-primary/35 border-0`}),(0,S.jsxs)(`div`,{className:m(`flex min-w-0 items-center justify-between gap-3 border-b border-border/70 bg-card/85`,e?`px-2 py-1`:`px-3 py-1.5`),children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-foreground`,children:[(0,S.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,S.jsx)(`span`,{className:`font-medium`,children:i(e?`activity:terminal.labelSingular`:`activity:terminal.labelPlural`)}),(0,S.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:A||M||i(`activity:terminal.projectShell`)})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:P,disabled:g.length>=w,title:g.length>=w?i(`activity:terminal.maxTerminals`,{count:w}):i(`activity:terminal.newTerminal`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,S.jsx)(f,{className:`h-4 w-4`})}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>z&&I(z.id),disabled:!z,title:i(`activity:terminal.restart`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,S.jsx)(u,{className:`h-3.5 w-3.5`})}),(0,S.jsx)(`button`,{type:`button`,onClick:L,disabled:g.length===0,title:i(`activity:terminal.closeAll`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,S.jsx)(d,{className:`h-3.5 w-3.5`})}),(0,S.jsx)(`button`,{type:`button`,onClick:n,title:i(`activity:terminal.closeDock`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,S.jsx)(c,{className:`h-4 w-4`})})]})]}),(0,S.jsx)(`div`,{className:m(`flex min-w-0 items-center gap-1 overflow-x-auto border-b border-border/70 bg-[hsl(var(--surface-2)/0.45)]`,e?`px-1.5 py-0.5`:`px-2 py-1`),children:g.map(t=>(0,S.jsxs)(`div`,{className:m(`group inline-flex items-center rounded border text-xs transition-colors`,e?`h-6 min-w-[92px] max-w-[148px]`:`h-7 min-w-[112px] max-w-[180px]`,y===t.id?`border-primary/35 bg-primary/10 text-primary`:`border-transparent bg-transparent text-muted-foreground hover:bg-accent hover:text-foreground`),children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>b(t.id),title:t.status===`exited`?`${t.name} exited`:t.name,className:`inline-flex min-w-0 flex-1 items-center gap-2 px-2 text-left`,children:[(0,S.jsx)(`span`,{className:m(`h-1.5 w-1.5 shrink-0 rounded-full`,t.status===`running`&&`bg-success`,t.status===`starting`&&`bg-primary`,t.status===`exited`&&`bg-destructive`)}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[t.name,t.status===`exited`&&typeof t.exitCode==`number`?` (${t.exitCode})`:``]})]}),(0,S.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),F(t.id)},className:`mr-1 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground opacity-70 hover:bg-accent hover:text-foreground hover:opacity-100`,title:i(`activity:terminal.closeTab`,{name:t.name}),children:(0,S.jsx)(c,{className:`h-3 w-3`})})]},t.id))}),M&&!e&&(0,S.jsx)(`div`,{className:`min-w-0 truncate border-b border-border/60 bg-muted/30 px-3 py-1 text-[11px] font-mono text-muted-foreground`,children:M}),(0,S.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:g.map(e=>(0,S.jsx)(j,{id:e.id,active:e.id===y,onRunning:()=>R(e.id,{status:`running`}),onExit:t=>R(e.id,{status:`exited`,exitCode:t})},e.id))})]})}function j({id:e,active:t,onRunning:i,onExit:a}){let o=(0,v.useRef)(null),s=(0,v.useRef)(null),c=(0,v.useRef)(null),u=(0,v.useRef)(i),d=(0,v.useRef)(a),f=n(e=>e.wsConnected);return(0,v.useEffect)(()=>{u.current=i,d.current=a},[a,i]),(0,v.useEffect)(()=>{let t=o.current;if(!t)return;let i=new _({fontFamily:`"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:13,cursorBlink:!0,theme:C,scrollback:5e3}),a=new g;s.current=i,c.current=a,i.loadAddon(a),i.open(t);try{a.fit()}catch{}let f=r(n.getState().wsUrl);f.send({type:`terminal.create`,payload:{id:e,cols:i.cols,rows:i.rows}});let p=!1,m=f.on(`terminal.output`,t=>{t.type===`terminal.output`&&t.payload.id===e&&(p||(p=!0,u.current()),i.write(t.payload.data))}),h=f.on(`terminal.exit`,t=>{t.type===`terminal.exit`&&t.payload.id===e&&(i.write(`\r\n\x1b[2m${l.t(`activity:terminal.processExited`,{code:t.payload.exitCode})}\x1b[0m\r\n`),d.current(t.payload.exitCode))}),v=i.onData(t=>{f.send({type:`terminal.input`,payload:{id:e,data:t}})}),y=new ResizeObserver(()=>{if(t.offsetParent)try{a.fit(),f.send({type:`terminal.resize`,payload:{id:e,cols:i.cols,rows:i.rows}})}catch{}});return y.observe(t),()=>{m(),h(),v.dispose(),y.disconnect(),f.send({type:`terminal.close`,payload:{id:e}}),i.dispose(),s.current=null,c.current=null}},[e,f]),(0,v.useEffect)(()=>{t&&window.requestAnimationFrame(()=>{try{c.current?.fit();let t=s.current;t&&(r(n.getState().wsUrl).send({type:`terminal.resize`,payload:{id:e,cols:t.cols,rows:t.rows}}),t.focus())}catch{}})},[t,e]),(0,S.jsx)(`div`,{ref:o,className:m(`absolute inset-0 min-h-0 min-w-0 overflow-hidden px-2 py-1`,t?`block`:`hidden`)})}export{A as TerminalPanel};
@@ -1 +0,0 @@
1
- import{At as e,Ct as t,Ft as n,Pt as r,St as i,Tt as a,xt as o}from"./ws-client-C_IqS0t4.js";import{Na as s}from"./vendor-BshlG0z-.js";var c=new WeakMap;function l(e){let t=c.get(e);if(t)return t;let n=e.activeSessionId,r=e.lanes[n]??o,i=a(n),s={messages:r.messages,currentAssistantMessageId:r.currentAssistantMessageId,currentToolId:r.currentToolId,isLoading:r.isLoading,abortController:r.abortController,executions:r.executions,toolMessageIdsByUseId:r.toolMessageIdsByUseId,queue:r.queue,runStart:r.runStart,refining:r.refining,pendingRefinement:r.pendingRefinement,thinkingBuffer:r.thinkingBuffer,thinkingStartedAt:r.thinkingStartedAt,thinkingLogBuffer:r.thinkingLogBuffer,thinkingLogStartedAt:r.thinkingLogStartedAt,boundSessionId:n===`__unbound__`?null:n,addMessage:i.addMessage,setMessages:i.setMessages,updateMessage:i.updateMessage,appendToMessage:i.appendToMessage,finalizeMessage:i.finalizeMessage,setToolResult:i.setToolResult,appendToolProgress:i.appendToolProgress,appendToolProgressLines:i.appendToolProgressLines,getToolMessageId:i.getToolMessageId,setToolResultByUseId:i.setToolResultByUseId,appendToolProgressLinesByUseId:i.appendToolProgressLinesByUseId,setLoading:i.setLoading,setAbortController:i.setAbortController,clearMessages:i.clearMessages,setBoundSessionId:u,setCurrentAssistantMessage:i.setCurrentAssistantMessage,setCurrentToolId:i.setCurrentToolId,truncateAfter:i.truncateAfter,addExecution:i.addExecution,updateExecution:i.updateExecution,enqueue:i.enqueue,dequeue:i.dequeue,dequeueDrainable:i.dequeueDrainable,removeQueued:i.removeQueued,clearQueue:i.clearQueue,setRefining:i.setRefining,setPendingRefinement:i.setPendingRefinement,removeMessage:i.removeMessage,updateLastUserMessage:i.updateLastUserMessage,setRunStart:i.setRunStart,appendThinking:i.appendThinking,clearThinking:i.clearThinking,flushThinkingLog:i.flushThinkingLog,clearThinkingLog:i.clearThinkingLog,switchSession:u};return c.set(e,s),s}function u(e){r(e)}function d(){return l(n.getState())}function f(n){let r=typeof n==`function`?n(d()):n;if(!r)return;let{boundSessionId:a,...o}=r;a!==void 0&&u(a);let s={},c={};for(let[e,t]of Object.entries(o))typeof t==`function`?c[e]=t:s[e]=t;Object.keys(s).length>0&&i().patch(s),Object.keys(c).length>0&&e(t(),c)}function p(e){return n.subscribe((t,n)=>e(l(t),l(n)))}var m=Object.assign(function(e){return s(n,t=>e(l(t)))},{getState:d,getInitialState:d,setState:f,subscribe:p,persist:n.persist});export{m as t};
@@ -1 +0,0 @@
1
- import{Ma as e}from"./vendor-BshlG0z-.js";var t=8e3,n=2500,r=18e5,i=200,a=500,o={read:`read`,read_file:`read`,write:`write`,write_file:`write`,edit:`edit`,patch:`edit`,apply_patch:`edit`,replace:`edit`,delete:`delete`,delete_file:`delete`,remove:`delete`,grep:`search`,glob:`search`,search:`search`,"codebase-search":`search`,"codebase-index":`index`,remember:`memory`,forget:`memory`,memory_search:`memory`,memory_update:`memory`,memory_delete:`memory`};function s(e,t=``){return e===`rename`?`edit`:e in{read:1,write:1,edit:1,delete:1,search:1}?e:o[t]}function c(e){let t=[];for(let n of[`path`,`file`,`filePath`,`target`]){let r=e[n];typeof r==`string`&&t.push(r)}let n=e.files;if(typeof n==`string`&&t.push(n),Array.isArray(n))for(let e of n)typeof e==`string`&&t.push(e);return[...new Set(t)]}function l(e,t){let n=typeof t.old_string==`string`?t.old_string.trim():``,r=typeof t.new_string==`string`?t.new_string.trim():``;if(n||r)return`${n.replace(/\s+/g,` `).slice(0,42)||`∅`} → ${r.replace(/\s+/g,` `).slice(0,42)||`∅`}`;if(typeof t.patch==`string`){let n=d(t);return`${e} +${n?.added??0} −${n?.removed??0}`}let i=typeof t.content==`string`?t.content:void 0;if(i!==void 0){let t=i.length===0?0:i.split(/\r?\n/).length;return`${e} ${t} line${t===1?``:`s`}`}for(let e of[`query`,`pattern`,`old_string`,`new_string`,`text`,`command`]){let n=t[e];if(typeof n==`string`&&n.trim()){let t=n.trim().replace(/\s+/g,` `).slice(0,96);return e===`query`?`"${t}"`:e===`pattern`?`/${t}/`:e===`command`?`$ ${t}`:t}}return e}function u(e){return e.trim().replace(/\s+/g,` `).slice(0,72)}function d(e){let t=typeof e.old_string==`string`?e.old_string:void 0,n=typeof e.new_string==`string`?e.new_string:void 0;if(t!==void 0||n!==void 0){let e=t?t.split(/\r?\n/).length:0;return{added:n?n.split(/\r?\n/).length:0,removed:e,...t?{before:u(t)}:{},...n?{after:u(n)}:{}}}let r=typeof e.patch==`string`?e.patch:void 0;if(r){let e=r.split(/\r?\n/),t=e.filter(e=>e.startsWith(`+`)&&!e.startsWith(`+++`)),n=e.filter(e=>e.startsWith(`-`)&&!e.startsWith(`---`));return{added:t.length,removed:n.length,...n[0]?{before:u(n[0].slice(1))}:{},...t[0]?{after:u(t[0].slice(1))}:{}}}let i=typeof e.content==`string`?e.content:void 0;if(i!==void 0)return{added:i.length===0?0:i.split(/\r?\n/).length,removed:0,...i?{after:u(i)}:{}}}function f(e){let t=e.status??`observed`;return{...e,id:e.id??`${e.toolUseId??`event`}:${e.filePath}:${e.timestamp}`,status:t,source:e.source??`legacy`,agentName:e.agentName??e.agent,agent:e.agent??e.agentName}}function p(e,t){let n=e.get(t.filePath)??[];if(e.set(t.filePath,[t,...n].slice(0,i)),e.size<=a)return;let r=[...e.entries()].sort((e,t)=>(e[1][0]?.timestamp??0)-(t[1][0]?.timestamp??0))[0]?.[0];r&&e.delete(r)}function m(e){return`${e.sessionId??`unscoped`}:${e.agentId??e.agentName??e.agent??`external`}`}function h(e){let t=new Map;for(let n of e){let e=n.agentId??`external`,r=n.agentName??n.agent??`External process`,i=n.sessionId??`unscoped`,a=m(n),o=t.get(a);o?(o.operations.push(n),o.startedAt=Math.min(o.startedAt,n.timestamp)):t.set(a,{key:a,agentId:e,agentName:r,sessionId:i,operations:[n],startedAt:n.timestamp})}return[...t.values()].sort((e,t)=>e.startedAt-t.startedAt)}function g(e,t,n){let r=String(e.name??`unknown`),i=e.input&&typeof e.input==`object`?e.input:{},a=Date.now(),o=String(e.id??`${r}:${a}`),c=d(i);return(t.length>0?t:[{filePath:`(tool:${r})`,operation:`execute`}]).map((u,d)=>({id:`${o}:${d}`,toolUseId:o,filePath:u.filePath,type:u.operation===`execute`?`execute`:s(u.operation,r)??`edit`,toolName:r,summary:l(r,i),timestamp:a,status:n,source:`tool`,attribution:t.length>0?`exact`:`correlated`,...c?{change:c}:{},sessionId:typeof e.sessionId==`string`?e.sessionId:void 0,traceId:typeof e.traceId==`string`?e.traceId:void 0,agentId:typeof e.agentId==`string`?e.agentId:`leader`,agentName:typeof e.agentName==`string`?e.agentName:`LEADER`,...u.line?{line:u.line}:{},...u.endLine?{endLine:u.endLine}:{}}))}function _(e){let t=e.payload??{};if(e.type===`tool.started`||e.type===`tool.executed`||e.type===`codemap.tool_started`||e.type===`codemap.tool_executed`)return g(t,Array.isArray(t.fileTargets)?t.fileTargets:c(t.input&&typeof t.input==`object`?t.input:{}).map(e=>({filePath:e,operation:o[String(t.name??``)]??`edit`})),e.type===`tool.started`||e.type===`codemap.tool_started`?`active`:`completed`);if(e.type===`provider.response`){let e=t.blocks;if(!Array.isArray(e))return[];let n=[];for(let t of e){if(!t||typeof t!=`object`)continue;let e=t;if(e.type!==`tool_use`)continue;let r=String(e.name??``),i=o[r];if(!i)continue;let a=e.input&&typeof e.input==`object`?e.input:{},s=c(a),u=Date.now();s.length===0&&(i===`memory`||i===`search`||i===`index`)&&s.push(`(global)`);for(let e of s)n.push({filePath:e,type:i,toolName:r,summary:l(r,a),timestamp:u})}return n}if(e.type===`tool.progress`){let e=t.event&&typeof t.event==`object`?t.event:void 0;if(e?.type!==`file_changed`||typeof e.path!=`string`)return[];let n=String(e.operation??`edit`);return[{id:`${String(t.id??`progress`)}:${e.path}:${Date.now()}`,toolUseId:typeof t.id==`string`?t.id:void 0,filePath:e.path,type:s(n)??`edit`,toolName:String(t.name??`deterministic-tool`),summary:String(e.text??`tool reported file change`),timestamp:Date.now(),status:`active`,source:`deterministic`,sessionId:typeof t.sessionId==`string`?t.sessionId:void 0,traceId:typeof t.traceId==`string`?t.traceId:void 0,agentId:typeof t.agentId==`string`?t.agentId:void 0,agentName:typeof t.agentName==`string`?t.agentName:void 0,line:typeof e.line==`number`?e.line:void 0,endLine:typeof e.endLine==`number`?e.endLine:void 0,attribution:`exact`}]}if(e.type===`codemap.file_event`){let e=s(String(t.operation??`edit`))??`edit`;return typeof t.filePath==`string`?[{filePath:t.filePath,type:e,toolName:typeof t.toolName==`string`?t.toolName:String(t.source??`watcher`),summary:`${String(t.source??`external`)} ${String(t.operation??`changed`)}`,timestamp:typeof t.at==`number`?t.at:Date.now(),status:t.phase===`started`?`active`:`observed`,source:t.source??`external`,sessionId:typeof t.sessionId==`string`?t.sessionId:void 0,traceId:typeof t.traceId==`string`?t.traceId:void 0,agentId:typeof t.agentId==`string`?t.agentId:void 0,agentName:typeof t.agentName==`string`?t.agentName:void 0,toolUseId:typeof t.toolUseId==`string`?t.toolUseId:void 0,line:typeof t.line==`number`?t.line:void 0,endLine:typeof t.endLine==`number`?t.endLine:void 0}]:[]}return e.type===`file.saved`&&typeof t.filePath==`string`?[{filePath:t.filePath,type:`write`,toolName:`save`,summary:``,timestamp:Date.now(),source:`editor`}]:e.type===`memory.event`&&typeof t.event==`string`?[{filePath:`(memory)`,type:`memory`,toolName:`memory.${t.event}`,summary:String(t.memoryId??``),timestamp:Date.now()}]:[]}var v=e((e,i)=>({history:new Map,pulses:new Map,activeOperations:new Map,totalCount:0,recordActivity(n){let r=f(n);e(e=>{let n=new Map(e.history),i=new Map(e.pulses);return p(n,r),i.set(r.filePath,Date.now()+t),{history:n,pulses:i,totalCount:e.totalCount+1}})},startActivities(n){if(n.length===0)return;let r=n.map(e=>f({...e,status:`active`}));e(e=>{let n=new Map(e.history),i=new Map(e.pulses),a=new Map(e.activeOperations);for(let e of r)if(p(n,e),i.set(e.filePath,Date.now()+t),e.toolUseId){let t=a.get(e.toolUseId)??[];a.set(e.toolUseId,[...t,e])}return{history:n,pulses:i,activeOperations:a,totalCount:e.totalCount+r.length}})},finishTool(n,r){let i=r.timestamp??Date.now();e(e=>{let a=e.activeOperations.get(n)??[];if(a.length===0)return e;let o=new Map(e.history),s=new Map(e.pulses);for(let e of a){let a=o.get(e.filePath)??[];o.set(e.filePath,a.map(e=>e.toolUseId===n?{...e,status:r.ok?`completed`:`failed`,ok:r.ok,completedAt:i,durationMs:r.durationMs??i-e.timestamp}:e)),s.set(e.filePath,Date.now()+t)}let c=new Map(e.activeOperations);return c.delete(n),{history:o,pulses:s,activeOperations:c}})},recordFileEvent(r){let i=f({...r,attribution:r.attribution??(r.agentId?`exact`:`external`)});e(e=>{let r=(e.history.get(i.filePath)??[]).find(e=>e.source!==`watcher`&&e.source!==`external`&&Math.abs(i.timestamp-e.timestamp)<=n);if(r){let n=new Map(e.history);n.set(i.filePath,(n.get(i.filePath)??[]).map(e=>e.id===r.id?{...e,watcherConfirmed:e.watcherConfirmed||i.source===`watcher`||i.source===`editor`}:e));let a=new Map(e.pulses);return a.set(i.filePath,Date.now()+t),{history:n,pulses:a}}let a=i.toolUseId?e.activeOperations.get(i.toolUseId):void 0;if(a&&a.length>0){let n=a[0],r=f({...i,status:`active`,source:i.source??`deterministic`,sessionId:i.sessionId??n.sessionId,traceId:i.traceId??n.traceId,agentId:i.agentId??n.agentId,agentName:i.agentName??n.agentName,agent:i.agent??n.agent,attribution:`exact`}),o=new Map(e.history),s=new Map(e.pulses),c=new Map(e.activeOperations);return p(o,r),s.set(r.filePath,Date.now()+t),c.set(i.toolUseId,[...a,r]),{history:o,pulses:s,activeOperations:c,totalCount:e.totalCount+1}}let o=[...e.activeOperations.values()].flat().filter(e=>e.filePath.startsWith(`(tool:`)&&Math.abs(i.timestamp-e.timestamp)<=3e5);if(o.length===1){let n=o[0],r=f({...i,id:`${n.toolUseId}:${i.filePath}:${i.timestamp}`,toolUseId:n.toolUseId,toolName:n.toolName,summary:`${n.toolName} → filesystem ${i.type}`,status:`active`,source:`deterministic`,sessionId:n.sessionId,traceId:n.traceId,agentId:n.agentId,agentName:n.agentName,agent:n.agent,watcherConfirmed:!0,attribution:`correlated`}),a=new Map(e.history),s=new Map(e.pulses),c=new Map(e.activeOperations);if(p(a,r),s.set(r.filePath,Date.now()+t),r.toolUseId){let e=c.get(r.toolUseId)??[];c.set(r.toolUseId,[...e,r])}return{history:a,pulses:s,activeOperations:c,totalCount:e.totalCount+1}}let s=new Map(e.history),c=new Map(e.pulses);return p(s,i),c.set(i.filePath,Date.now()+t),{history:s,pulses:c,totalCount:e.totalCount+1}})},resolveActivitySymbol(t,n,r){e(e=>{let i=new Map(e.history);i.set(n,(i.get(n)??[]).map(e=>e.toolUseId===t?{...e,symbol:r}:e));let a=new Map(e.activeOperations),o=a.get(t);return o&&a.set(t,o.map(e=>e.filePath===n?{...e,symbol:r}:e)),{history:i,activeOperations:a}})},getActivityForFile(e){return i().history.get(e)??[]},getActiveForFile(e){return[...i().activeOperations.values()].flat().filter(t=>t.filePath===e)},getActiveOperations(){return[...i().activeOperations.values()].flat()},getAgentPresences(){return h(i().getActiveOperations())},getPulsingFiles(){return i()._sweep(),new Set(i().pulses.keys())},getPulseType(e){if(i()._sweep(),i().pulses.has(e))return i().history.get(e)?.[0]?.type},clear(){e({history:new Map,pulses:new Map,activeOperations:new Map,totalCount:0})},_sweep(){let t=Date.now(),n=[...i().pulses].filter(([,e])=>e<t).map(([e])=>e),a=[...i().activeOperations].filter(([,e])=>e.every(e=>t-e.timestamp>r)).map(([e])=>e);(n.length!==0||a.length!==0)&&e(e=>{let r=new Map(e.pulses);for(let e of n)r.delete(e);if(a.length===0)return{pulses:r};let i=new Map(e.history),o=new Map(e.activeOperations);for(let e of a){for(let n of o.get(e)??[])i.set(n.filePath,(i.get(n.filePath)??[]).map(n=>n.toolUseId===e?{...n,status:`failed`,ok:!1,completedAt:t,durationMs:t-n.timestamp,summary:`${n.summary||n.toolName} · telemetry timeout`}:n));o.delete(e)}return{pulses:r,history:i,activeOperations:o}})}}));export{v as i,_ as n,h as r,m as t};
@@ -1 +0,0 @@
1
- import{Ma as e}from"./vendor-BshlG0z-.js";var t=e(e=>({generation:0,lastUpdatedAt:null,notifyIndexUpdated(t=Date.now()){e(e=>({generation:e.generation+1,lastUpdatedAt:t}))}}));export{t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chat-BITJe8-v.js","assets/rolldown-runtime-hePW80VL.js","assets/commandPalette-BovBiPec.js","assets/common-BBHmIHQW.js","assets/setup-qooXjj4V.js","assets/toasts-DZ6HdKgG.js"])))=>i.map(i=>d[i]);
2
- import{Ia as e,La as t,Ma as n,Ra as r,ja as i}from"./vendor-BshlG0z-.js";import{t as a}from"./chat-BITJe8-v.js";import{t as o}from"./commandPalette-BovBiPec.js";import{t as s}from"./common-BBHmIHQW.js";import{t as c}from"./setup-qooXjj4V.js";import{t as l}from"./toasts-DZ6HdKgG.js";import{t as u}from"./vite-preload-Czpn1I53.js";var d=(e,t,n)=>{let r=t.lastIndexOf(`?`),i=e[r===-1||r<t.lastIndexOf(`/`)?t:t.slice(0,r)];return i?typeof i==`function`?i():Promise.resolve(i):new Promise((e,r)=>{(typeof queueMicrotask==`function`?queueMicrotask:setTimeout)(r.bind(null,Error(`Unknown variable dynamic import: `+t+(t.split(`/`).length===n?``:`. Note that variables only represent file names one level deep.`))))})};function f(e){return e instanceof Error?e.message:String(e)}var p=[`en`,`tr`,`de`,`fr`,`it`,`es`,`pt-BR`],m=[{code:`en`,name:`English`},{code:`tr`,name:`Türkçe`},{code:`de`,name:`Deutsch`},{code:`fr`,name:`Français`},{code:`it`,name:`Italiano`},{code:`es`,name:`Español`},{code:`pt-BR`,name:`Português (Brasil)`}],h=new Set(p);function g(){return typeof navigator>`u`||!navigator.language?`en`:v(navigator.language)}function _(e){return!e||typeof e!=`string`?g():v(e)}function v(e){let t=e.trim().toLowerCase();if(!t)return`en`;if(h.has(t))return t;let n=t.split(`-`)[0];return n&&h.has(n)?n:n===`pt`?`pt-BR`:`en`}var y=[`subagentsAllowed`,`subagentsPolicyLocked`,`autonomy`,`autonomyDelayMs`,`autoProceedMaxIterations`,`yolo`,`maxIterations`,`contextStrategy`,`contextMode`,`contextAutoCompact`,`tokenSavingTier`,`systemPromptVariant`,`reasoningMode`,`reasoningEffort`,`reasoningPreserve`,`nextPrediction`,`nextStepsTool`],b=new Set(y);function x(e,t){let n=w.getState();if(!e||e===n.activeSessionId)return n[t];let r=n.bySession[e]?.[t];if(r!==void 0)return r;let i=n.sessionDefaults[t];return i===void 0?n[t]:i}function S(e){let t={},n={};for(let[r,i]of Object.entries(e))b.has(r)&&typeof i!=`function`?t[r]=i:n[r]=i;return{scoped:t,shared:n}}var C={subagentsAllowed:!0,subagentsPolicyLocked:!1,autonomy:`auto`,autonomyDelayMs:45e3,autoProceedMaxIterations:50,yolo:!0,maxIterations:500,chime:!1,confirmExit:!0,fleetChatVerbosity:`off`,nextPrediction:!1,nextStepsTool:!1,fallbackModels:[],fallbackProfiles:{},favoriteModels:[],favoriteModelsOnly:!1,modelMatrix:{},modelTiers:{},fallbackAuto:!0,modelAvailabilitySchedule:[],featureMcp:!0,featurePlugins:!0,featureMemory:!0,featureSkills:!0,featureModelsRegistry:!0,indexOnStart:!0,contextAutoCompact:!0,contextStrategy:`hybrid`,contextMode:`balanced`,tokenSavingTier:`auto`,maxConcurrent:10,titleAnimation:!0,logLevel:`info`,auditLevel:`standard`,enhanceEnabled:!0,enhanceDelayMs:6e4,enhanceCountdownMs:3e3,enhanceLanguage:`original`,refinerProvider:``,refinerModel:``,refinerFallbackProfile:``,thinkingWord:`thinking`,statuslineMode:`minimum`,animationStyle:`rainbow`,showThinkingLogs:!0,groupToolCalls:!0,autoCollapseInput:!1,showModelReasoning:!0,showAgentSwarmPanel:`bottom`,allowOutsideProjectRoot:!0,reasoningMode:`auto`,reasoningEffort:`high`,reasoningPreserve:!1,cacheTtl:`default`,breakerEnabled:!1,breakerAutoKillResetMs:6e4,fsAccess:`unrestricted`,debugStream:!1,hqEnabled:!1,hqUrl:``,hqToken:``,hqRawContent:!1,tgConfigured:!1,tgSessionEnd:!1,tgDelegate:!0,tgLongToolMs:3e4,uiLocale:g(),chimeraAutoFix:`off`,readSymbols:!1,showSageMemoryInject:!1,sageMemoryInjectThreshold:.85,preRefineSeconds:3,multiDiffSummaryThreshold:5,chimeraEnabled:!0,chimeraProvider:``,chimeraModel:``,chimeraMaxFiles:15,autoReviewEnabled:!1,autoReviewProvider:``,autoReviewModel:``,autoReviewFallbackProfile:``,autoReviewModelSelection:`round-robin`,autoReviewFallbackModels:[],autoReviewDebounceMs:15e3,autoReviewMaxFilesPerBatch:15,autoReviewMaxConcurrentReviews:2,autoReviewCascadeOn:`off`,pluginsEnabled:{},wrongProxyEnabled:!1,wrongProxyUrl:`http://localhost:3444`,keyboardShortcuts:!1,bySession:{},sessionDefaults:{},activeSessionId:null},w=n()(i(e=>({...C,set:t=>e(e=>{let{scoped:n,shared:r}=S(t);if(Object.keys(n).length===0)return{...r};let i=e.activeSessionId;return{...r,...n,sessionDefaults:{...e.sessionDefaults,...n},...i?{bySession:{...e.bySession,[i]:{...e.bySession[i]??{},...n}}}:{}}}),bindSession:t=>e(e=>{if(e.activeSessionId===t)return{};let n={...e.bySession};if(e.activeSessionId){let t={};for(let n of y)t[n]=e[n];n[e.activeSessionId]={...n[e.activeSessionId]??{},...t}}return{...t?{...e.sessionDefaults,...n[t]??{}}:e.sessionDefaults,bySession:n,activeSessionId:t}}),applyRemote:(t,n)=>e(e=>{let{scoped:r,shared:i}=S(t);if(!n||n===e.activeSessionId){let t=n??e.activeSessionId;return{...i,...r,...t&&Object.keys(r).length>0?{bySession:{...e.bySession,[t]:{...e.bySession[t]??{},...r}}}:{}}}return Object.keys(r).length===0?{...i}:{...i,bySession:{...e.bySession,[n]:{...e.bySession[n]??{},...r}}}}),forgetSession:t=>e(e=>{let n=t in e.bySession,r=e.activeSessionId===t;if(!n&&!r)return{};let i={...e.bySession};return delete i[t],{bySession:i,...r?{activeSessionId:null}:{}}}),reset:()=>e(C)}),{name:`wrongstack-local-prefs`,version:17,migrate:(e,t)=>{let n=e??{};return t<12&&n.autoReviewDebounceMs===5e3&&(n.autoReviewDebounceMs=15e3),typeof n.fleetChatVerbosity!=`string`&&(n.fleetChatVerbosity=n.streamFleet===!0?`full`:(n.streamFleet,`off`),delete n.streamFleet),n.fleetChatVerbosity!==`off`&&n.fleetChatVerbosity!==`full`&&(n.fleetChatVerbosity=`off`),[`hybrid`,`intelligent`,`selective`].includes(n.contextStrategy)||(n.contextStrategy=`hybrid`),n.auditLevel===`verbose`&&(n.auditLevel=`full`),[`minimal`,`standard`,`full`].includes(n.auditLevel)||(n.auditLevel=`standard`),typeof n.autoProceedMaxIterations!=`number`&&(n.autoProceedMaxIterations=50),(!n.fallbackProfiles||typeof n.fallbackProfiles!=`object`||Array.isArray(n.fallbackProfiles))&&(n.fallbackProfiles={}),Array.isArray(n.favoriteModels)||(n.favoriteModels=[]),typeof n.favoriteModelsOnly!=`boolean`&&(n.favoriteModelsOnly=!1),Array.isArray(n.modelAvailabilitySchedule)||(n.modelAvailabilitySchedule=[]),(!n.modelMatrix||typeof n.modelMatrix!=`object`||Array.isArray(n.modelMatrix))&&(n.modelMatrix={}),(typeof n.uiLocale!=`string`||!n.uiLocale)&&(n.uiLocale=g()),typeof n.breakerEnabled!=`boolean`&&(n.breakerEnabled=!1),typeof n.breakerAutoKillResetMs!=`number`&&(n.breakerAutoKillResetMs=6e4),n.fsAccess!==`unrestricted`&&n.fsAccess!==`project`&&(n.fsAccess=`unrestricted`),typeof n.debugStream!=`boolean`&&(n.debugStream=!1),typeof n.wrongProxyEnabled!=`boolean`&&(n.wrongProxyEnabled=!1),(typeof n.wrongProxyUrl!=`string`||n.wrongProxyUrl.trim().length===0)&&(n.wrongProxyUrl=`http://localhost:3444`),typeof n.chimeraEnabled!=`boolean`&&(n.chimeraEnabled=!0),typeof n.chimeraProvider!=`string`&&(n.chimeraProvider=``),typeof n.chimeraModel!=`string`&&(n.chimeraModel=``),n.chimeraAutoFix!==`off`&&n.chimeraAutoFix!==`ask`&&n.chimeraAutoFix!==`auto`&&(n.chimeraAutoFix=`off`),(typeof n.chimeraMaxFiles!=`number`||!Number.isFinite(n.chimeraMaxFiles)||n.chimeraMaxFiles<1)&&(n.chimeraMaxFiles=15),typeof n.autoReviewEnabled!=`boolean`&&(n.autoReviewEnabled=!1),typeof n.autoReviewProvider!=`string`&&(n.autoReviewProvider=``),typeof n.autoReviewModel!=`string`&&(n.autoReviewModel=``),typeof n.autoReviewFallbackProfile!=`string`&&(n.autoReviewFallbackProfile=``),n.autoReviewModelSelection!==`round-robin`&&n.autoReviewModelSelection!==`random`&&(n.autoReviewModelSelection=`round-robin`),Array.isArray(n.autoReviewFallbackModels)||(n.autoReviewFallbackModels=[]),(typeof n.autoReviewDebounceMs!=`number`||!Number.isFinite(n.autoReviewDebounceMs)||n.autoReviewDebounceMs<0)&&(n.autoReviewDebounceMs=15e3),(typeof n.autoReviewMaxFilesPerBatch!=`number`||!Number.isFinite(n.autoReviewMaxFilesPerBatch)||n.autoReviewMaxFilesPerBatch<1)&&(n.autoReviewMaxFilesPerBatch=15),(typeof n.autoReviewMaxConcurrentReviews!=`number`||!Number.isFinite(n.autoReviewMaxConcurrentReviews)||n.autoReviewMaxConcurrentReviews<1)&&(n.autoReviewMaxConcurrentReviews=2),n.autoReviewCascadeOn!==`off`&&n.autoReviewCascadeOn!==`critical`&&n.autoReviewCascadeOn!==`high`&&(n.autoReviewCascadeOn=`off`),typeof n.showModelReasoning!=`boolean`&&(n.showModelReasoning=!0),typeof n.autoCollapseInput!=`boolean`&&(n.autoCollapseInput=!1),typeof n.showAgentSwarmPanel==`boolean`?n.showAgentSwarmPanel=n.showAgentSwarmPanel?`bottom`:`off`:(typeof n.showAgentSwarmPanel!=`string`||![`bottom`,`sidebar`,`off`].includes(n.showAgentSwarmPanel))&&(n.showAgentSwarmPanel=`bottom`),typeof n.allowOutsideProjectRoot!=`boolean`&&(n.allowOutsideProjectRoot=!0),typeof n.readSymbols!=`boolean`&&(n.readSymbols=!1),typeof n.showSageMemoryInject!=`boolean`&&(n.showSageMemoryInject=!1),(typeof n.sageMemoryInjectThreshold!=`number`||!Number.isFinite(n.sageMemoryInjectThreshold)||n.sageMemoryInjectThreshold<0||n.sageMemoryInjectThreshold>1)&&(n.sageMemoryInjectThreshold=.85),(typeof n.preRefineSeconds!=`number`||!Number.isFinite(n.preRefineSeconds)||n.preRefineSeconds<0)&&(n.preRefineSeconds=3),(typeof n.bySession!=`object`||n.bySession===null||Array.isArray(n.bySession))&&(n.bySession={}),(typeof n.sessionDefaults!=`object`||n.sessionDefaults===null||Array.isArray(n.sessionDefaults))&&(n.sessionDefaults={}),typeof n.activeSessionId!=`string`&&(n.activeSessionId=null),(typeof n.multiDiffSummaryThreshold!=`number`||!Number.isFinite(n.multiDiffSummaryThreshold)||n.multiDiffSummaryThreshold<0)&&(n.multiDiffSummaryThreshold=5),typeof n.keyboardShortcuts!=`boolean`&&(n.keyboardShortcuts=!1),n},partialize:e=>{let{hqToken:t,...n}=e;return n},merge:(e,t)=>{let{hqToken:n,...r}=e??{};return{...t,...r,hqToken:``}}})),T=[`common`,`activity`,`chat`,`commandPalette`,`settings`,`setup`,`toasts`];function E(){try{return _(w.getState().uiLocale)}catch{return`en`}}r.use(e).use(t((e,t)=>d(Object.assign({"./locales/de/activity.json":()=>u(()=>import(`./activity-FxWZooaS.js`),[]),"./locales/de/chat.json":()=>u(()=>import(`./chat-BHsbpaVt.js`),[]),"./locales/de/commandPalette.json":()=>u(()=>import(`./commandPalette-aaAou3Tl.js`),[]),"./locales/de/common.json":()=>u(()=>import(`./common-C3PzxyXg.js`),[]),"./locales/de/settings.json":()=>u(()=>import(`./settings-B1vpPbTt.js`),[]),"./locales/de/setup.json":()=>u(()=>import(`./setup-B9oerXTs.js`),[]),"./locales/de/toasts.json":()=>u(()=>import(`./toasts-BsmyGP95.js`),[]),"./locales/en/activity.json":()=>u(()=>import(`./activity-CXLMCm4J.js`),[]),"./locales/en/chat.json":()=>u(()=>import(`./chat-BITJe8-v.js`).then(e=>e.n),__vite__mapDeps([0,1])),"./locales/en/commandPalette.json":()=>u(()=>import(`./commandPalette-BovBiPec.js`).then(e=>e.n),__vite__mapDeps([2,1])),"./locales/en/common.json":()=>u(()=>import(`./common-BBHmIHQW.js`).then(e=>e.n),__vite__mapDeps([3,1])),"./locales/en/settings.json":()=>u(()=>import(`./settings-WuyKla3E.js`),[]),"./locales/en/setup.json":()=>u(()=>import(`./setup-qooXjj4V.js`).then(e=>e.n),__vite__mapDeps([4,1])),"./locales/en/toasts.json":()=>u(()=>import(`./toasts-DZ6HdKgG.js`).then(e=>e.n),__vite__mapDeps([5,1])),"./locales/es/activity.json":()=>u(()=>import(`./activity-Dt348P4m.js`),[]),"./locales/es/chat.json":()=>u(()=>import(`./chat-6dE2AJNN.js`),[]),"./locales/es/commandPalette.json":()=>u(()=>import(`./commandPalette-Nlxs0V7J.js`),[]),"./locales/es/common.json":()=>u(()=>import(`./common-CUWL8eNX.js`),[]),"./locales/es/settings.json":()=>u(()=>import(`./settings-BcB2BIE2.js`),[]),"./locales/es/setup.json":()=>u(()=>import(`./setup-Cmq_aIjv.js`),[]),"./locales/es/toasts.json":()=>u(()=>import(`./toasts-DizCJjAR.js`),[]),"./locales/fr/activity.json":()=>u(()=>import(`./activity-CCW2-qSA.js`),[]),"./locales/fr/chat.json":()=>u(()=>import(`./chat-B3AJmhGD.js`),[]),"./locales/fr/commandPalette.json":()=>u(()=>import(`./commandPalette-Dfk74u87.js`),[]),"./locales/fr/common.json":()=>u(()=>import(`./common-xPePelft.js`),[]),"./locales/fr/settings.json":()=>u(()=>import(`./settings-BZnHCnGT.js`),[]),"./locales/fr/setup.json":()=>u(()=>import(`./setup-BWlr07i_.js`),[]),"./locales/fr/toasts.json":()=>u(()=>import(`./toasts-CgXHu8ZB.js`),[]),"./locales/it/activity.json":()=>u(()=>import(`./activity-CmzV075e.js`),[]),"./locales/it/chat.json":()=>u(()=>import(`./chat-mSbSzPl5.js`),[]),"./locales/it/commandPalette.json":()=>u(()=>import(`./commandPalette-CUh_kgfp.js`),[]),"./locales/it/common.json":()=>u(()=>import(`./common-DuR5FTPN.js`),[]),"./locales/it/settings.json":()=>u(()=>import(`./settings-DwbEJvxt.js`),[]),"./locales/it/setup.json":()=>u(()=>import(`./setup-DK5JTuqw.js`),[]),"./locales/it/toasts.json":()=>u(()=>import(`./toasts-bPl097de.js`),[]),"./locales/pt-BR/activity.json":()=>u(()=>import(`./activity-D2D6_ljD.js`),[]),"./locales/pt-BR/chat.json":()=>u(()=>import(`./chat-_Xp5fDnj.js`),[]),"./locales/pt-BR/commandPalette.json":()=>u(()=>import(`./commandPalette-tFxIIhvU.js`),[]),"./locales/pt-BR/common.json":()=>u(()=>import(`./common-CvSB5NM3.js`),[]),"./locales/pt-BR/settings.json":()=>u(()=>import(`./settings-D9AQ5wLT2.js`),[]),"./locales/pt-BR/setup.json":()=>u(()=>import(`./setup-B-xPcuTH.js`),[]),"./locales/pt-BR/toasts.json":()=>u(()=>import(`./toasts-NC2MT4uN.js`),[]),"./locales/tr/activity.json":()=>u(()=>import(`./activity-87Kr1xrI.js`),[]),"./locales/tr/chat.json":()=>u(()=>import(`./chat-U-Jjb8_k.js`),[]),"./locales/tr/commandPalette.json":()=>u(()=>import(`./commandPalette-CGMq-qlP.js`),[]),"./locales/tr/common.json":()=>u(()=>import(`./common-DT2FL9xN.js`),[]),"./locales/tr/settings.json":()=>u(()=>import(`./settings-DiVpBZQ2.js`),[]),"./locales/tr/setup.json":()=>u(()=>import(`./setup-CQ4-lz5u.js`),[]),"./locales/tr/toasts.json":()=>u(()=>import(`./toasts-tCVo15mP.js`),[])}),`./locales/${e}/${t}.json`,4))).init({lng:E(),fallbackLng:`en`,supportedLngs:[...p],ns:[...T],defaultNS:`common`,partialBundledLanguages:!0,resources:{en:{common:s,chat:a,commandPalette:o,setup:c,toasts:l}},interpolation:{escapeValue:!1},react:{useSuspense:!1},returnNull:!1});function D(e){typeof document<`u`&&(document.documentElement.lang=e)}D(r.language||`en`);var O=[`activity`,`settings`];r.loadNamespaces(O).catch(e=>{console.warn(JSON.stringify({level:`warn`,event:`i18n_deferred_namespace_prefetch_failed`,namespaces:O,error:f(e),timestamp:new Date().toISOString()}))}),w.subscribe((e,t)=>{let n=e.uiLocale;n&&n!==t.uiLocale&&n!==r.language&&r.changeLanguage(n).then(()=>D(n))});function k(){window.wrongstackDesktopHost?.onLocaleChanged?.(e=>{if(!e)return;let t=_(e);if(t===r.language)return;let n=w.getState();n.uiLocale!==t&&n.set({uiLocale:t}),r.changeLanguage(t).then(()=>D(t))})}try{k()}catch{}export{f as i,w as n,m as r,x as t};