specrails-desktop 2.35.0 → 2.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/client/dist/assets/{ActivityFeedPage-LCBJ5WiD.js → ActivityFeedPage-tAQcWs1R.js} +1 -1
  2. package/client/dist/assets/{AgentBrowserCapture-B-xQpyZr.js → AgentBrowserCapture-BX8BNae5.js} +1 -1
  3. package/client/dist/assets/{AgentModeAnalyticsPane-BI1Vcf3T.js → AgentModeAnalyticsPane-BVAqCL0K.js} +2 -2
  4. package/client/dist/assets/{AgentModeCodePane-BTRwCl9h.js → AgentModeCodePane-9XfqQc9c.js} +2 -2
  5. package/client/dist/assets/{AgentModeJobsPane-VzeBJLqP.js → AgentModeJobsPane-BCjLsPhc.js} +1 -1
  6. package/client/dist/assets/{AgentsPage-CJj1K24O.js → AgentsPage-C8J_42sm.js} +1 -1
  7. package/client/dist/assets/{AnalyticsPage-CQpV5_fX.js → AnalyticsPage-BtQuyfJm.js} +1 -1
  8. package/client/dist/assets/{CodePage-9-tFh0jB.js → CodePage-BZ2MwdCu.js} +1 -1
  9. package/client/dist/assets/{DesktopAnalyticsPage-BcZ0_O_C.js → DesktopAnalyticsPage-Bh_29V4g.js} +1 -1
  10. package/client/dist/assets/{DocsDialog-BPAzDICW.js → DocsDialog-C76VdBJC.js} +1 -1
  11. package/client/dist/assets/{DocsPage-Dqo4Hn6G.js → DocsPage-ziMlj6B6.js} +1 -1
  12. package/client/dist/assets/{InteractiveJobComposer-D36fZWai.js → InteractiveJobComposer-BCZiSfzc.js} +1 -1
  13. package/client/dist/assets/{JobDetailModal-BxsktbkQ.js → JobDetailModal-NAJmuYIT.js} +1 -1
  14. package/client/dist/assets/{JobDetailPage-WWyCy6Sp.js → JobDetailPage-fE0ZycUX.js} +1 -1
  15. package/client/dist/assets/{JobsPage-CEbM7uxU.js → JobsPage-z5M_HVJG.js} +1 -1
  16. package/client/dist/assets/{LoopBuilderPage-CYsSN8io.js → LoopBuilderPage-j1FQS47c.js} +1 -1
  17. package/client/dist/assets/{LoopPreviewModal-BJhgX5wY.js → LoopPreviewModal-DhDJjdCe.js} +1 -1
  18. package/client/dist/assets/{LoopsPage-DB4OqMot.js → LoopsPage-Ll7zORZb.js} +1 -1
  19. package/client/dist/assets/{MinimizedChatsContext-CcjBHMHd.js → MinimizedChatsContext-Bd3OqR_S.js} +1 -1
  20. package/client/dist/assets/{PluginsPage-CR8K4nM_.js → PluginsPage-DN4kGvJt.js} +1 -1
  21. package/client/dist/assets/{ProjectSettingsDialog-C45-qhF4.js → ProjectSettingsDialog-OgsgxjzF.js} +1 -1
  22. package/client/dist/assets/{ReviewPacketPage-Cz_QQeC3.js → ReviewPacketPage-DFog4sXn.js} +1 -1
  23. package/client/dist/assets/{TemplatePreviewModal-wFBd2vQP.js → TemplatePreviewModal-L2XxqiOD.js} +1 -1
  24. package/client/dist/assets/{TicketDetailModal-BvZoyDAL.js → TicketDetailModal-CsF-AWZX.js} +1 -1
  25. package/client/dist/assets/{Trans-DXZ-BLXb.js → Trans-Bsz9_gyq.js} +1 -1
  26. package/client/dist/assets/{formatDistanceToNow-C0ImhVKp.js → formatDistanceToNow-DQCvMgUc.js} +1 -1
  27. package/client/dist/assets/{getTimezoneOffsetInMilliseconds-owhDdTXs.js → getTimezoneOffsetInMilliseconds-C16cxSe1.js} +1 -1
  28. package/client/dist/assets/{i18n-DwgvwTnx.js → i18n-hnX2DPmo.js} +2 -2
  29. package/client/dist/assets/{index-DhjjFyU5.js → index-DIhMEAVw.js} +14 -14
  30. package/client/dist/assets/index-DwygcU7s.css +2 -0
  31. package/client/dist/assets/{jira-api-CcZMcEN5.js → jira-api-B1-MUehg.js} +1 -1
  32. package/client/dist/assets/{mcp-DsTwmjST.js → mcp-B8X8wBLu.js} +1 -1
  33. package/client/dist/assets/{mcp-SMkn8boG.js → mcp-C2AojZZN.js} +1 -1
  34. package/client/dist/assets/mcp-D8BT78_L.js +1 -0
  35. package/client/dist/assets/{mcp-D4ZjtIx3.js → mcp-Df5RWBNk.js} +1 -1
  36. package/client/dist/assets/{mcp-DIfBUv2D.js → mcp-Dj7BgMQW.js} +1 -1
  37. package/client/dist/assets/{mcp-D2pc5GGx.js → mcp-Q7iT7rcz.js} +1 -1
  38. package/client/dist/assets/{mcp-fSfiVYAc.js → mcp-YlvNvJbW.js} +1 -1
  39. package/client/dist/assets/{mcp-Czd_iyp0.js → mcp-mKFpTSRb.js} +1 -1
  40. package/client/dist/assets/{spending-BQX3P7Cq.js → spending-EC9xqio-.js} +1 -1
  41. package/client/dist/assets/{useDesktop-BzX769yH.js → useDesktop-BQVt8lFd.js} +1 -1
  42. package/client/dist/index.html +12 -12
  43. package/docs/mcp.md +16 -0
  44. package/package.json +1 -1
  45. package/server/dist/agent-chat-manager.js +2 -0
  46. package/server/dist/agent-mcp-config.js +94 -2
  47. package/server/dist/agent-operator-prompt.js +4 -0
  48. package/server/dist/desktop-router.js +22 -0
  49. package/server/dist/external-mcp.js +370 -0
  50. package/client/dist/assets/index-xBFsOEiJ.css +0 -2
  51. package/client/dist/assets/mcp-uDkXYu4L.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{t as r}from"./react-dom-DiWzBDP9.js";import{u as i}from"./chunk-KS7C4IRE-DEKu087k.js";import{w as a}from"./i18n-DwgvwTnx.js";import{n as o,t as s}from"./createLucideIcon-Bjbbp_KS.js";import{t as c}from"./sparkles-DrY8hb0X.js";import{t as l}from"./x-CBMI9ejn.js";import{r as u}from"./useDesktop-BzX769yH.js";var d=s(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),f=s(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),p=s(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),m=s(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),h=s(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),g=s(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),_=e(t(),1),v=[`title`,`description`,`labels`,`priority`,`acceptanceCriteria`],y={title:``,description:``,labels:[],priority:`medium`,acceptanceCriteria:[]};function b(e){return!e||typeof e!=`object`?!1:e.type===`spec_draft.update`}var x=e(r(),1),S=n(),C=42;function w(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=C?t:t.slice(0,C-1).trimEnd()+`…`}function T({chat:e,projectName:t,onRestore:n,onClose:r}){let{t:i}=o(`chat`),a=w(e.label);return(0,S.jsxs)(`div`,{"data-testid":`minimized-chat-chip-${e.id}`,className:`grid items-start gap-2 w-full max-w-full`,style:{gridTemplateColumns:`auto minmax(0, 1fr) auto`},children:[(0,S.jsx)(E,{kind:e.kind}),(0,S.jsxs)(`button`,{type:`button`,onClick:n,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary/50 rounded overflow-hidden`,"aria-label":i(`chip.restore`,{label:e.label}),title:e.label,children:[(0,S.jsx)(`div`,{className:`text-sm font-medium text-foreground truncate`,children:a}),(0,S.jsx)(`div`,{className:`text-[11px] text-muted-foreground mt-0.5 truncate`,children:i(`chip.continueEditing`,{projectName:t})})]}),(0,S.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-6 h-6 rounded text-muted-foreground hover:text-foreground hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary/50`,"aria-label":i(`chip.close`,{label:e.label}),children:(0,S.jsx)(l,{className:`w-3.5 h-3.5`})})]})}function E({kind:e}){let{t}=o(`chat`);return(0,S.jsx)(e===`ai-edit`?c:g,{className:`w-4 h-4 text-accent-primary flex-shrink-0 mt-0.5`,"aria-label":t(e===`ai-edit`?`chip.kindAiEdit`:`chip.kindExploreSpec`)})}function D({chats:e,projects:t,hidden:n,onRestore:r,onClose:i}){let{t:a}=o(`chat`),s=(0,_.useMemo)(()=>{let e=new Map;for(let n of t)e.set(n.id,n.name);return e},[t]),c=(0,_.useMemo)(()=>[...e].sort((e,t)=>t.createdAt-e.createdAt),[e]);return n||c.length===0?null:(0,x.createPortal)((0,S.jsxs)(`div`,{"data-testid":`minimized-chats-dock`,"aria-label":a(`dock.minimizedSessions`,{count:c.length}),className:`fixed bottom-4 right-14 z-[70] flex flex-col-reverse gap-2 w-[320px] max-w-[calc(100vw-15rem)] max-h-[70vh] overflow-y-auto pointer-events-none`,children:[c.map(e=>(0,S.jsx)(`div`,{className:`pointer-events-auto glass-card border border-border/30 rounded-lg p-3 shadow-lg w-full`,children:(0,S.jsx)(T,{chat:e,projectName:s.get(e.projectId)??a(`dock.unknownProject`),onRestore:()=>r(e.id),onClose:()=>i(e.id)})},e.id)),c.length>1&&(0,S.jsxs)(`div`,{className:`pointer-events-auto self-end inline-flex items-center gap-1 rounded-full bg-card/80 border border-border/40 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur-sm`,children:[(0,S.jsx)(m,{className:`w-3 h-3`}),a(`dock.minimizedCount`,{count:c.length})]})]}),document.body)}var O=(0,_.createContext)(null),k=`specrails-desktop:minimized-chats`,A=`specrails-desktop:minimized-chats-pending`,j=50,M=8e3;function N(){return L(k)}function P(e){z(k,e)}function F(){return L(A)}function I(e){z(A,e)}function L(e){if(typeof window>`u`)return[];try{let t=window.localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(B):[]}catch{return[]}}function R(e){return e.length<=j?e:[...e].sort((e,t)=>e.createdAt-t.createdAt).slice(e.length-j)}function z(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(e,JSON.stringify(R(t)))}catch{}}function B(e){if(!e||typeof e!=`object`)return!1;let t=e;return!(typeof t.id!=`string`||typeof t.projectId!=`string`||typeof t.label!=`string`||typeof t.restoreRoute!=`string`||typeof t.createdAt!=`number`||t.kind!==`explore-spec`&&t.kind!==`ai-edit`||!t.params||typeof t.params!=`object`)}function V(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function H(e){return e.kind===`explore-spec`?e.params.resumeConversationId??`pending:${e.params.pendingSpecId}`:e.params.resumeRefineId??`agent:${e.params.agentId}`}function U(e,t){return e.kind!==t.kind||e.projectId!==t.projectId?!1:H(e)===H(t)}function W({children:e}){let{projects:t,activeProjectId:n,setActiveProjectId:r}=u(),o=i(),{registerHandler:s,unregisterHandler:c}=a(),[l,d]=(0,_.useState)(()=>N()),[f,p]=(0,_.useState)([]),m=(0,_.useRef)(l);m.current=l;let h=(0,_.useRef)(f);h.current=f;let g=(0,_.useRef)(new Map),v=(0,_.useRef)(t);v.current=t;let y=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(y.current)return;y.current=!0;let e=F();I([]),e.length!==0&&d(t=>{let n=[...t];for(let t of e)n.some(e=>e.id===t.id||U(e,t))||n.push(t);return P(n),m.current=n,n})},[]),(0,_.useEffect)(()=>{let e=g.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear()}},[]),(0,_.useEffect)(()=>{P(l)},[l]),(0,_.useEffect)(()=>{I(f)},[f]);let x=(0,_.useRef)(()=>{}),C=(0,_.useRef)(()=>{});(0,_.useEffect)(()=>{let e=`minimized-chats:spec-draft`;return s(e,e=>{if(!b(e))return;let t=e.conversationId,n=m.current.find(e=>e.kind===`explore-spec`&&e.params.resumeConversationId===t);if(!n)return;let r=e.draft;r.title?.trim()&&x.current(n.id,r.title);let i={};r.title!==void 0&&(i.title=r.title),r.description!==void 0&&(i.description=r.description),r.priority!==void 0&&(i.priority=r.priority),r.labels!==void 0&&(i.labels=r.labels),r.acceptanceCriteria!==void 0&&(i.acceptanceCriteria=r.acceptanceCriteria),Object.keys(i).length>0&&C.current(n.id,i)}),()=>c(e)},[s,c]),(0,_.useEffect)(()=>{if(t.length===0)return;let e=new Set(t.map(e=>e.id));d(t=>{let n=t.filter(t=>e.has(t.projectId));return n.length===t.length?t:(P(n),m.current=n,n)}),p(t=>{let n=t.filter(t=>e.has(t.projectId));return n.length===t.length?t:(I(n),h.current=n,n)})},[t]);let w=(0,_.useCallback)(e=>{let t=V(),n={...e,id:t,createdAt:Date.now()};if(d(e=>{let t=R([...e.filter(e=>!U(e,n)),n]);return P(t),m.current=t,t}),e.kind===`explore-spec`){let t=e.params.resumeConversationId;t&&fetch(`/api/projects/${e.projectId}/chat/conversations/${t}/minimize`,{method:`POST`}).catch(()=>{})}return t},[]),T=(0,_.useCallback)(e=>{let t=g.current.get(e);t&&(clearTimeout(t),g.current.delete(e))},[]),E=(0,_.useCallback)(e=>{T(e),d(t=>{let n=t.filter(t=>t.id!==e);return P(n),m.current=n,n}),p(t=>{let n=t.filter(t=>t.id!==e);return n.length===t.length?t:(I(n),h.current=n,n)})},[T]),k=(0,_.useCallback)((e,t)=>{let n=t.trim();n&&d(t=>{let r=t.map(t=>t.id===e&&t.label!==n?{...t,label:n}:t);return r===t?t:(m.current=r,r)})},[]),A=(0,_.useCallback)((e,t)=>{d(n=>{let r=n.map(n=>{if(n.id!==e||n.kind!==`explore-spec`)return n;let r={...n.params.draftOverrides??{},...t};return{...n,params:{...n.params,draftOverrides:r}}});return m.current=r,r})},[]),j=(0,_.useCallback)(e=>{let t=m.current.find(t=>t.id===e);if(!t||v.current.length>0&&!v.current.some(e=>e.id===t.projectId))return;if(t.kind===`explore-spec`){let e=t.params.resumeConversationId;e&&fetch(`/api/projects/${t.projectId}/chat/conversations/${e}/restore`,{method:`POST`}).catch(()=>{})}n!==t.projectId&&r(t.projectId),o(t.restoreRoute),p(n=>{let r=[...n.filter(t=>t.id!==e),t];return I(r),h.current=r,r}),d(t=>{let n=t.filter(t=>t.id!==e);return P(n),m.current=n,n}),T(e);let i=setTimeout(()=>{g.current.delete(e),h.current.some(t=>t.id===e)&&(p(t=>{let n=t.filter(t=>t.id!==e);return I(n),h.current=n,n}),d(n=>{if(n.some(n=>n.id===e||U(n,t)))return n;let r=[...n,t];return P(r),m.current=r,r}))},M);g.current.set(e,i)},[n,r,o,T]),L=(0,_.useRef)(j);L.current=j;let z=(0,_.useRef)(E);z.current=E,x.current=k,C.current=A;let B=(0,_.useCallback)((e,t)=>{let n=h.current,r=n.findIndex(n=>n.kind===e&&n.projectId===t);if(r===-1)return null;let i=n[r];return T(i.id),p(e=>{let t=e.filter(e=>e.id!==i.id);return I(t),t}),h.current=n.filter(e=>e.id!==i.id),i},[T]),H=(0,_.useCallback)(e=>{let t=V(),i={...e,id:t,createdAt:Date.now()};n!==e.projectId&&r(e.projectId),o(e.restoreRoute),p(e=>{let t=[...e,i];return I(t),h.current=t,t}),T(t);let a=setTimeout(()=>{g.current.delete(t),h.current.some(e=>e.id===t)&&(p(e=>{let n=e.filter(e=>e.id!==t);return I(n),h.current=n,n}),d(e=>{if(e.some(e=>e.id===t||U(e,i)))return e;let n=[...e,i];return P(n),m.current=n,n}))},M);g.current.set(t,a)},[n,r,o,T]),W=(0,_.useMemo)(()=>({chats:l,pendingRestores:f,minimize:w,updateLabel:k,patchExploreSpecDraft:A,close:E,restore:j,takePendingRestore:B,triggerResume:H}),[l,f,w,k,A,E,j,B,H]);return(0,S.jsxs)(O.Provider,{value:W,children:[e,(0,S.jsx)(D,{chats:l,projects:t,hidden:!1,onRestore:j,onClose:E})]})}function G(){return(0,_.useContext)(O)||{chats:[],pendingRestores:[],minimize:()=>``,updateLabel:()=>{},patchExploreSpecDraft:()=>{},close:()=>{},restore:()=>{},takePendingRestore:()=>null,triggerResume:()=>{}}}function K(e,t,n){let{pendingRestores:r,takePendingRestore:i}=G(),a=(0,_.useRef)(n);a.current=n,(0,_.useEffect)(()=>{if(!t)return;let n=i(e,t);n&&a.current(n)},[r,e,t,i])}export{v as a,h as c,f as d,d as f,y as i,m as l,G as n,b as o,K as r,g as s,W as t,p as u};
1
+ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{t as r}from"./react-dom-DiWzBDP9.js";import{u as i}from"./chunk-KS7C4IRE-DEKu087k.js";import{w as a}from"./i18n-hnX2DPmo.js";import{n as o,t as s}from"./createLucideIcon-Bjbbp_KS.js";import{t as c}from"./sparkles-DrY8hb0X.js";import{t as l}from"./x-CBMI9ejn.js";import{r as u}from"./useDesktop-BQVt8lFd.js";var d=s(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),f=s(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),p=s(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),m=s(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),h=s(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),g=s(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),_=e(t(),1),v=[`title`,`description`,`labels`,`priority`,`acceptanceCriteria`],y={title:``,description:``,labels:[],priority:`medium`,acceptanceCriteria:[]};function b(e){return!e||typeof e!=`object`?!1:e.type===`spec_draft.update`}var x=e(r(),1),S=n(),C=42;function w(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=C?t:t.slice(0,C-1).trimEnd()+`…`}function T({chat:e,projectName:t,onRestore:n,onClose:r}){let{t:i}=o(`chat`),a=w(e.label);return(0,S.jsxs)(`div`,{"data-testid":`minimized-chat-chip-${e.id}`,className:`grid items-start gap-2 w-full max-w-full`,style:{gridTemplateColumns:`auto minmax(0, 1fr) auto`},children:[(0,S.jsx)(E,{kind:e.kind}),(0,S.jsxs)(`button`,{type:`button`,onClick:n,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary/50 rounded overflow-hidden`,"aria-label":i(`chip.restore`,{label:e.label}),title:e.label,children:[(0,S.jsx)(`div`,{className:`text-sm font-medium text-foreground truncate`,children:a}),(0,S.jsx)(`div`,{className:`text-[11px] text-muted-foreground mt-0.5 truncate`,children:i(`chip.continueEditing`,{projectName:t})})]}),(0,S.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-6 h-6 rounded text-muted-foreground hover:text-foreground hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-primary/50`,"aria-label":i(`chip.close`,{label:e.label}),children:(0,S.jsx)(l,{className:`w-3.5 h-3.5`})})]})}function E({kind:e}){let{t}=o(`chat`);return(0,S.jsx)(e===`ai-edit`?c:g,{className:`w-4 h-4 text-accent-primary flex-shrink-0 mt-0.5`,"aria-label":t(e===`ai-edit`?`chip.kindAiEdit`:`chip.kindExploreSpec`)})}function D({chats:e,projects:t,hidden:n,onRestore:r,onClose:i}){let{t:a}=o(`chat`),s=(0,_.useMemo)(()=>{let e=new Map;for(let n of t)e.set(n.id,n.name);return e},[t]),c=(0,_.useMemo)(()=>[...e].sort((e,t)=>t.createdAt-e.createdAt),[e]);return n||c.length===0?null:(0,x.createPortal)((0,S.jsxs)(`div`,{"data-testid":`minimized-chats-dock`,"aria-label":a(`dock.minimizedSessions`,{count:c.length}),className:`fixed bottom-4 right-14 z-[70] flex flex-col-reverse gap-2 w-[320px] max-w-[calc(100vw-15rem)] max-h-[70vh] overflow-y-auto pointer-events-none`,children:[c.map(e=>(0,S.jsx)(`div`,{className:`pointer-events-auto glass-card border border-border/30 rounded-lg p-3 shadow-lg w-full`,children:(0,S.jsx)(T,{chat:e,projectName:s.get(e.projectId)??a(`dock.unknownProject`),onRestore:()=>r(e.id),onClose:()=>i(e.id)})},e.id)),c.length>1&&(0,S.jsxs)(`div`,{className:`pointer-events-auto self-end inline-flex items-center gap-1 rounded-full bg-card/80 border border-border/40 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur-sm`,children:[(0,S.jsx)(m,{className:`w-3 h-3`}),a(`dock.minimizedCount`,{count:c.length})]})]}),document.body)}var O=(0,_.createContext)(null),k=`specrails-desktop:minimized-chats`,A=`specrails-desktop:minimized-chats-pending`,j=50,M=8e3;function N(){return L(k)}function P(e){z(k,e)}function F(){return L(A)}function I(e){z(A,e)}function L(e){if(typeof window>`u`)return[];try{let t=window.localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(B):[]}catch{return[]}}function R(e){return e.length<=j?e:[...e].sort((e,t)=>e.createdAt-t.createdAt).slice(e.length-j)}function z(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(e,JSON.stringify(R(t)))}catch{}}function B(e){if(!e||typeof e!=`object`)return!1;let t=e;return!(typeof t.id!=`string`||typeof t.projectId!=`string`||typeof t.label!=`string`||typeof t.restoreRoute!=`string`||typeof t.createdAt!=`number`||t.kind!==`explore-spec`&&t.kind!==`ai-edit`||!t.params||typeof t.params!=`object`)}function V(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function H(e){return e.kind===`explore-spec`?e.params.resumeConversationId??`pending:${e.params.pendingSpecId}`:e.params.resumeRefineId??`agent:${e.params.agentId}`}function U(e,t){return e.kind!==t.kind||e.projectId!==t.projectId?!1:H(e)===H(t)}function W({children:e}){let{projects:t,activeProjectId:n,setActiveProjectId:r}=u(),o=i(),{registerHandler:s,unregisterHandler:c}=a(),[l,d]=(0,_.useState)(()=>N()),[f,p]=(0,_.useState)([]),m=(0,_.useRef)(l);m.current=l;let h=(0,_.useRef)(f);h.current=f;let g=(0,_.useRef)(new Map),v=(0,_.useRef)(t);v.current=t;let y=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(y.current)return;y.current=!0;let e=F();I([]),e.length!==0&&d(t=>{let n=[...t];for(let t of e)n.some(e=>e.id===t.id||U(e,t))||n.push(t);return P(n),m.current=n,n})},[]),(0,_.useEffect)(()=>{let e=g.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear()}},[]),(0,_.useEffect)(()=>{P(l)},[l]),(0,_.useEffect)(()=>{I(f)},[f]);let x=(0,_.useRef)(()=>{}),C=(0,_.useRef)(()=>{});(0,_.useEffect)(()=>{let e=`minimized-chats:spec-draft`;return s(e,e=>{if(!b(e))return;let t=e.conversationId,n=m.current.find(e=>e.kind===`explore-spec`&&e.params.resumeConversationId===t);if(!n)return;let r=e.draft;r.title?.trim()&&x.current(n.id,r.title);let i={};r.title!==void 0&&(i.title=r.title),r.description!==void 0&&(i.description=r.description),r.priority!==void 0&&(i.priority=r.priority),r.labels!==void 0&&(i.labels=r.labels),r.acceptanceCriteria!==void 0&&(i.acceptanceCriteria=r.acceptanceCriteria),Object.keys(i).length>0&&C.current(n.id,i)}),()=>c(e)},[s,c]),(0,_.useEffect)(()=>{if(t.length===0)return;let e=new Set(t.map(e=>e.id));d(t=>{let n=t.filter(t=>e.has(t.projectId));return n.length===t.length?t:(P(n),m.current=n,n)}),p(t=>{let n=t.filter(t=>e.has(t.projectId));return n.length===t.length?t:(I(n),h.current=n,n)})},[t]);let w=(0,_.useCallback)(e=>{let t=V(),n={...e,id:t,createdAt:Date.now()};if(d(e=>{let t=R([...e.filter(e=>!U(e,n)),n]);return P(t),m.current=t,t}),e.kind===`explore-spec`){let t=e.params.resumeConversationId;t&&fetch(`/api/projects/${e.projectId}/chat/conversations/${t}/minimize`,{method:`POST`}).catch(()=>{})}return t},[]),T=(0,_.useCallback)(e=>{let t=g.current.get(e);t&&(clearTimeout(t),g.current.delete(e))},[]),E=(0,_.useCallback)(e=>{T(e),d(t=>{let n=t.filter(t=>t.id!==e);return P(n),m.current=n,n}),p(t=>{let n=t.filter(t=>t.id!==e);return n.length===t.length?t:(I(n),h.current=n,n)})},[T]),k=(0,_.useCallback)((e,t)=>{let n=t.trim();n&&d(t=>{let r=t.map(t=>t.id===e&&t.label!==n?{...t,label:n}:t);return r===t?t:(m.current=r,r)})},[]),A=(0,_.useCallback)((e,t)=>{d(n=>{let r=n.map(n=>{if(n.id!==e||n.kind!==`explore-spec`)return n;let r={...n.params.draftOverrides??{},...t};return{...n,params:{...n.params,draftOverrides:r}}});return m.current=r,r})},[]),j=(0,_.useCallback)(e=>{let t=m.current.find(t=>t.id===e);if(!t||v.current.length>0&&!v.current.some(e=>e.id===t.projectId))return;if(t.kind===`explore-spec`){let e=t.params.resumeConversationId;e&&fetch(`/api/projects/${t.projectId}/chat/conversations/${e}/restore`,{method:`POST`}).catch(()=>{})}n!==t.projectId&&r(t.projectId),o(t.restoreRoute),p(n=>{let r=[...n.filter(t=>t.id!==e),t];return I(r),h.current=r,r}),d(t=>{let n=t.filter(t=>t.id!==e);return P(n),m.current=n,n}),T(e);let i=setTimeout(()=>{g.current.delete(e),h.current.some(t=>t.id===e)&&(p(t=>{let n=t.filter(t=>t.id!==e);return I(n),h.current=n,n}),d(n=>{if(n.some(n=>n.id===e||U(n,t)))return n;let r=[...n,t];return P(r),m.current=r,r}))},M);g.current.set(e,i)},[n,r,o,T]),L=(0,_.useRef)(j);L.current=j;let z=(0,_.useRef)(E);z.current=E,x.current=k,C.current=A;let B=(0,_.useCallback)((e,t)=>{let n=h.current,r=n.findIndex(n=>n.kind===e&&n.projectId===t);if(r===-1)return null;let i=n[r];return T(i.id),p(e=>{let t=e.filter(e=>e.id!==i.id);return I(t),t}),h.current=n.filter(e=>e.id!==i.id),i},[T]),H=(0,_.useCallback)(e=>{let t=V(),i={...e,id:t,createdAt:Date.now()};n!==e.projectId&&r(e.projectId),o(e.restoreRoute),p(e=>{let t=[...e,i];return I(t),h.current=t,t}),T(t);let a=setTimeout(()=>{g.current.delete(t),h.current.some(e=>e.id===t)&&(p(e=>{let n=e.filter(e=>e.id!==t);return I(n),h.current=n,n}),d(e=>{if(e.some(e=>e.id===t||U(e,i)))return e;let n=[...e,i];return P(n),m.current=n,n}))},M);g.current.set(t,a)},[n,r,o,T]),W=(0,_.useMemo)(()=>({chats:l,pendingRestores:f,minimize:w,updateLabel:k,patchExploreSpecDraft:A,close:E,restore:j,takePendingRestore:B,triggerResume:H}),[l,f,w,k,A,E,j,B,H]);return(0,S.jsxs)(O.Provider,{value:W,children:[e,(0,S.jsx)(D,{chats:l,projects:t,hidden:!1,onRestore:j,onClose:E})]})}function G(){return(0,_.useContext)(O)||{chats:[],pendingRestores:[],minimize:()=>``,updateLabel:()=>{},patchExploreSpecDraft:()=>{},close:()=>{},restore:()=>{},takePendingRestore:()=>null,triggerResume:()=>{}}}function K(e,t,n){let{pendingRestores:r,takePendingRestore:i}=G(),a=(0,_.useRef)(n);a.current=n,(0,_.useEffect)(()=>{if(!t)return;let n=i(e,t);n&&a.current(n)},[r,e,t,i])}export{v as a,h as c,f as d,d as f,y as i,m as l,G as n,b as o,K as r,g as s,W as t,p as u};
@@ -1,2 +1,2 @@
1
- import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{w as r}from"./i18n-DwgvwTnx.js";import{n as i,t as a}from"./createLucideIcon-Bjbbp_KS.js";import{n as o}from"./dist-bVqfYmby.js";import{t as s}from"./download-CFHyyHcw.js";import{t as c}from"./loader-circle-DcygOQpC.js";import{t as l}from"./search-Cq_gE3Ik.js";import{t as u}from"./trash-2-BOU3WdZZ.js";import{t as d}from"./triangle-alert-H9T4jAmh.js";import{n as f,t as p}from"./jira-api-CcZMcEN5.js";import{a as m}from"./auth-D_5bQv5W.js";import{n as h,r as g}from"./useDesktop-BzX769yH.js";import{a as _,n as v,o as y,r as b,t as x}from"./dialog-CdWCb02j.js";import{t as S}from"./button-CJqFnUOL.js";import{t as C}from"./utils-BC4DHlz2.js";import{r as w}from"./provider-capabilities-Doej9lfa.js";import{At as T,Ot as E,_ as D,lt as O,nt as k,rt as A,tt as j}from"./index-DhjjFyU5.js";var M=a(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),ee=a(`folder-kanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),N=a(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),P=a(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),F=a(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),I=e(t(),1),L=n(),te=[`todo`,`in_progress`,`on_review`,`done`,`cancelled`],R={todo:`todo`,in_progress:`inProgress`,on_review:`onReview`,done:`done`,cancelled:`cancelled`};function z({onConnected:e,onSkip:t,apiBase:n}){let{t:r}=i(`jira`),[a,s]=(0,I.useState)(1),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)(``),[f,m]=(0,I.useState)(``),[h,g]=(0,I.useState)(`idle`),[_,v]=(0,I.useState)(null),[y,b]=(0,I.useState)(`cloud`),[x,C]=(0,I.useState)([]),[w,T]=(0,I.useState)(``),[E,O]=(0,I.useState)(``),[k,A]=(0,I.useState)(``),[j,M]=(0,I.useState)(!1),[ee,N]=(0,I.useState)([]),[P,F]=(0,I.useState)({}),[z,ne]=(0,I.useState)(``),[U,W]=(0,I.useState)(!1),G=()=>({baseUrl:c.trim(),accountEmail:u.trim()||null,token:f});async function K(){g(`testing`);try{let e=await p.test(G(),n);g(`ok`),v(e.displayName),b(e.deployment)}catch(e){g(`error`),o.error(H(e,r))}}async function q(){s(2),M(!0);try{let{projects:e}=await p.discoverProjects({...G(),query:w.trim()||void 0},n);C(e)}catch(e){o.error(H(e,r))}finally{M(!1)}}async function J(){if(s(3),E)try{let{statuses:e}=await p.discoverStatuses({...G(),projectKey:E},n);N(e)}catch{N([])}}async function Y(){W(!0);try{let t=Object.fromEntries(Object.entries(P).filter(([,e])=>e));await p.connect({...G(),jiraProjectKey:E.trim(),statusMap:Object.keys(t).length?t:null,discardStatus:z.trim()||null},n),o.success(r(`status.connected`,{key:E.trim()})),e()}catch(e){o.error(H(e,r))}finally{W(!1)}}return(0,L.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-wizard`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`wizard.step`,{current:a,total:4})}),t&&(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`text-xs text-muted-foreground hover:text-foreground hover:underline`,"data-testid":`jira-later`,children:r(`wizard.later`)})]}),a===1&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step1Title`)}),(0,L.jsx)(B,{label:r(`creds.baseUrlLabel`),help:r(`creds.baseUrlHelp`),children:(0,L.jsx)(D,{value:c,onChange:e=>{l(e.target.value),g(`idle`)},placeholder:r(`creds.baseUrlPlaceholder`)})}),(0,L.jsx)(B,{label:r(`creds.emailLabel`),help:r(`creds.emailHelp`),children:(0,L.jsx)(D,{value:u,onChange:e=>{d(e.target.value),g(`idle`)},placeholder:r(`creds.emailPlaceholder`)})}),(0,L.jsx)(B,{label:r(`creds.tokenLabel`),help:r(`creds.tokenHelp`),children:(0,L.jsx)(D,{type:`password`,value:f,onChange:e=>{m(e.target.value),g(`idle`)}})}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(S,{size:`sm`,variant:`outline`,onClick:K,disabled:!c.trim()||!f.trim()||h===`testing`,children:r(h===`testing`?`creds.testing`:h===`ok`?`creds.retest`:`creds.test`)}),h===`ok`&&(0,L.jsxs)(`span`,{className:`text-xs text-accent-success`,"data-testid":`jira-test-ok`,children:[`✓ `,r(`creds.testOk`,{name:_??``}),` · `,r(y===`cloud`?`review.cloud`:`review.dc`)]})]}),(0,L.jsx)(`div`,{className:`flex justify-end`,children:(0,L.jsx)(S,{size:`sm`,onClick:q,disabled:h!==`ok`,children:r(`wizard.next`)})})]}),a===2&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step2Title`)}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(D,{value:w,onChange:e=>T(e.target.value),placeholder:r(`project.searchPlaceholder`)}),(0,L.jsx)(S,{size:`sm`,variant:`outline`,onClick:q,children:r(`project.searchPlaceholder`)})]}),j?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`project.loading`)}):x.length===0?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`project.none`)}):(0,L.jsx)(`div`,{className:`max-h-48 space-y-1 overflow-y-auto`,"data-testid":`jira-project-list`,children:x.map(e=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{O(e.key),A(e.name)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left text-sm hover:bg-muted ${E===e.key?`bg-muted`:``}`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:e.key}),(0,L.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.name})]},e.id))}),(0,L.jsx)(B,{label:r(`project.manualLabel`),children:(0,L.jsx)(D,{value:E,onChange:e=>{O(e.target.value.toUpperCase()),A(``)},placeholder:r(`project.manualPlaceholder`)})}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(S,{size:`sm`,variant:`ghost`,onClick:()=>s(1),children:r(`wizard.back`)}),(0,L.jsx)(S,{size:`sm`,onClick:J,disabled:!E.trim(),children:r(`wizard.next`)})]})]}),a===3&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step3Title`)}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`mapping.intro`)}),te.map(e=>(0,L.jsx)(B,{label:r(`mapping.${R[e]}`),children:(0,L.jsxs)(`select`,{value:P[e]??``,onChange:t=>F(n=>({...n,[e]:t.target.value||void 0})),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,children:[(0,L.jsx)(`option`,{value:``,children:r(`mapping.auto`)}),ee.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.id))]})},e)),(0,L.jsx)(B,{label:r(`discard.configLabel`),help:r(`discard.configHelp`),children:(0,L.jsxs)(`select`,{value:z,onChange:e=>ne(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-discard-status-select`,children:[(0,L.jsx)(`option`,{value:``,children:r(`discard.configNone`)}),ee.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.id))]})}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(S,{size:`sm`,variant:`ghost`,onClick:()=>s(2),children:r(`wizard.back`)}),(0,L.jsx)(S,{size:`sm`,onClick:()=>s(4),children:r(`wizard.next`)})]})]}),a===4&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step4Title`)}),(0,L.jsxs)(`dl`,{className:`space-y-1 text-sm`,children:[(0,L.jsx)(V,{label:r(`review.site`),value:c}),(0,L.jsx)(V,{label:r(`review.project`),value:k?`${E} — ${k}`:E}),(0,L.jsx)(V,{label:r(`review.account`),value:_??u}),(0,L.jsx)(V,{label:r(`review.type`),value:r(y===`cloud`?`review.cloud`:`review.dc`)}),(0,L.jsx)(V,{label:r(`discard.reviewLabel`),value:z||r(`discard.configNone`)})]}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(S,{size:`sm`,variant:`ghost`,onClick:()=>s(3),children:r(`wizard.back`)}),(0,L.jsx)(S,{size:`sm`,onClick:Y,disabled:U,children:r(U?`wizard.connecting`:`wizard.connect`)})]})]})]})}function B({label:e,help:t,children:n}){return(0,L.jsxs)(`label`,{className:`block space-y-1`,children:[(0,L.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:e}),n,t&&(0,L.jsx)(`span`,{className:`block text-[11px] text-muted-foreground`,children:t})]})}function V({label:e,value:t}){return(0,L.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,L.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,L.jsx)(`dd`,{className:`truncate text-right font-medium`,children:t})]})}function H(e,t){return e instanceof Error?e.message:t(`errors.generic`)}var ne=[`todo`,`in_progress`,`on_review`,`done`,`cancelled`],U={todo:`todo`,in_progress:`inProgress`,on_review:`onReview`,done:`done`,cancelled:`cancelled`};function W({state:e,onChanged:t,apiBase:n}){let{t:r}=i(`jira`),a=e.connection,[s,c]=(0,I.useState)(a.enabled),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(!1),[m,h]=(0,I.useState)([]),[g,_]=(0,I.useState)([]),[v,y]=(0,I.useState)(a.discardStatus??``),[b,x]=(0,I.useState)(a.statusMap??{}),C=e.outbox??{pending:0,inflight:0,done:0,dead:0},w=(0,I.useCallback)(async()=>{try{let{ops:e}=n?await p.listOutbox(`dead`,n):await p.listOutbox(`dead`);h(e)}catch{h([])}},[n]);(0,I.useEffect)(()=>{w()},[w]),(0,I.useEffect)(()=>{let e=!1;return p.listStatuses(n).then(({statuses:t})=>{e||_(t)}).catch(()=>{e||_([])}),()=>{e=!0}},[n]);async function T(e){let i=v;y(e);try{n?await p.patchConnection({discardStatus:e||null},n):await p.patchConnection({discardStatus:e||null}),t()}catch(e){y(i),o.error(K(e,r))}}async function E(e,i){let a=b,s={...b,[e]:i||void 0};x(s);let c=Object.fromEntries(Object.entries(s).filter(([,e])=>e));try{n?await p.patchConnection({statusMap:Object.keys(c).length?c:null},n):await p.patchConnection({statusMap:Object.keys(c).length?c:null}),t()}catch(e){x(a),o.error(K(e,r))}}async function D(){let e=!s;c(e),f(!0);try{n?await p.setEnabled(e,n):await p.setEnabled(e)}catch(t){c(!e),o.error(K(t,r))}finally{f(!1)}}async function O(){u(!0);try{let e=n?await p.syncNow(n):await p.syncNow();o.success(r(`status.syncedToast`,{count:e.upserted}))}catch(e){o.error(K(e,r))}finally{u(!1)}}async function k(){if(window.confirm(r(`status.disconnectConfirm`))){f(!0);try{n?await p.disconnect(n):await p.disconnect(),o.success(r(`status.disconnectedToast`)),t()}catch(e){o.error(K(e,r))}finally{f(!1)}}}async function A(e){try{n?await p.retryOutbox(e,n):await p.retryOutbox(e),await w()}catch(e){o.error(K(e,r))}}let j=C.pending+C.inflight;return(0,L.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-connected`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:r(`status.connected`,{key:a.jiraProjectKey})}),(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[a.baseUrl,` · `,a.deployment===`cloud`?r(`review.cloud`):r(`review.dc`)]})]}),(0,L.jsx)(`a`,{href:`${a.baseUrl}/browse/${a.jiraProjectKey}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-accent-primary hover:underline`,children:r(`badge.openInJira`)})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:r(`status.enabledLabel`)}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(s?`status.enabledHelp`:`status.pausedHelp`)})]}),(0,L.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":s,"aria-label":r(`status.enabledLabel`),disabled:d,onClick:D,className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${s?`bg-accent-success`:`bg-input`}`,children:(0,L.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform ${s?`translate-x-4`:`translate-x-0.5`}`})})]}),(0,L.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-status-map`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:r(`wizard.step3Title`)}),(0,L.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:r(`mapping.intro`)}),(0,L.jsx)(`div`,{className:`space-y-2`,children:ne.map(e=>(0,L.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r(`mapping.${U[e]}`)}),(0,L.jsxs)(`select`,{value:b[e]??``,onChange:t=>void E(e,t.target.value),className:`w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-statusmap-${e}`,children:[(0,L.jsx)(`option`,{value:``,children:r(`mapping.auto`)}),g.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.id)),b[e]&&!g.some(t=>t.name===b[e])&&(0,L.jsx)(`option`,{value:b[e],children:b[e]})]})]},e))})]}),(0,L.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:r(`discard.configLabel`)}),(0,L.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:r(`discard.configHelp`)}),(0,L.jsxs)(`select`,{value:v,onChange:e=>void T(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-discard-status-select`,children:[(0,L.jsx)(`option`,{value:``,children:r(`discard.configNone`)}),g.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.id)),v&&!g.some(e=>e.name===v)&&(0,L.jsx)(`option`,{value:v,children:v})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(S,{variant:`outline`,size:`sm`,onClick:O,disabled:l,children:r(l?`status.syncing`:`status.syncNow`)}),(0,L.jsx)(S,{variant:`ghost`,size:`sm`,onClick:k,disabled:d,className:`text-destructive`,children:r(`status.disconnect`)})]}),(0,L.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-outbox`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:r(`outbox.title`)}),C.dead>0?(0,L.jsx)(`p`,{className:`mt-1 text-xs text-accent-warning`,children:r(`outbox.dead`,{count:C.dead})}):j>0?(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:r(`outbox.pending`,{count:j})}):(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:r(`outbox.allSynced`)}),m.length>0&&(0,L.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`outbox.deadHelp`)}),m.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded border border-border/60 px-2 py-1`,children:[(0,L.jsxs)(`span`,{className:`truncate text-xs`,children:[G(e,r),` · `,e.deadReason??e.lastError??``]}),(0,L.jsx)(S,{variant:`outline`,size:`sm`,onClick:()=>A(e.id),children:r(`outbox.retry`)})]},e.id))]})]})]})}function G(e,t){return e.opType===`transition`?t(`outbox.opTransition`):e.opType===`comment`?t(`outbox.opComment`):t(`outbox.opCreate`)}function K(e,t){return e instanceof Error?e.message:t(`errors.generic`)}var q=new Set([`claude`,`codex`,`kimi`]);function J(e){return{provider:e,label:e===`codex`?`Codex`:`Claude`,active:!1,available:!1,detectedRoute:!1,requests:0,inputTokens:0,inputTokensSaved:0,outputTokens:0,outputTokensSaved:0,outputSavingsPercent:0,outputSavingsMethod:`none`,outputSavingsAllocated:!1}}function Y(){return{updatedAt:null,proxyStatsAvailable:!1,durableSavingsAvailable:!1,outputSavingsAvailable:!1,outputSavingsMethod:null,outputConfidence:null,providers:{codex:J(`codex`),claude:J(`claude`)},lastIssue:null}}var X={installed:!1,installSource:null,version:null,executablePath:null,uvPath:null,port:8787,phase:`idle`,activeProviders:{codex:!1,claude:!1},availableProviders:{codex:!1,claude:!1},detectedRoutes:{codex:!1,claude:!1},proxyRunning:!1,proxyPid:null,learning:{enabled:!1,baselineReady:!1,baselineSamples:0,updatedAt:null,lastIssue:null},metrics:Y(),lastIssue:null,updatedAt:null};function re(e){let t=e?.metrics??Y();return{...X,...e,activeProviders:{...X.activeProviders,...e?.activeProviders},availableProviders:{...X.availableProviders,...e?.availableProviders},detectedRoutes:{...X.detectedRoutes,...e?.detectedRoutes},learning:{...X.learning,...e?.learning},metrics:{...Y(),...t,providers:{codex:{...J(`codex`),...t.providers?.codex},claude:{...J(`claude`),...t.providers?.claude}}}}}async function Z(e){let t=await e.text(),n=t?JSON.parse(t):{};if(!e.ok){let t=n.issue;throw Object.assign(Error(t?.title??n.error??`HTTP ${e.status}`),{payload:n})}return n}function Q(e){return`${m}/api/projects/${e}`}function ie(e,t=`en`){if(!Number.isFinite(e))return`0`;try{return Intl.NumberFormat(t,{notation:`compact`,maximumFractionDigits:1}).format(Math.max(0,e))}catch{return Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(Math.max(0,e))}}function $(e,t,n){return`${ie(e,t)} ${n}`}function ae(){let{t:e}=i(`integrations`),{projects:t}=g(),{registerHandler:n,unregisterHandler:a}=r(),[o,s]=(0,I.useState)(``),[c,u]=(0,I.useState)(`all`),[d,f]=(0,I.useState)(X),[p,h]=(0,I.useState)(!0),[S,w]=(0,I.useState)(null),[T,E]=(0,I.useState)([]),[D,M]=(0,I.useState)(!1),[P,F]=(0,I.useState)(!1),[te,R]=(0,I.useState)(null),[z,B]=(0,I.useState)({jira:0,serena:0,projects:0}),V=(0,I.useCallback)(async()=>{try{let e=await fetch(`${m}/api/global-plugins/headroom`).then(e=>Z(e));f(re(e.state))}finally{h(!1)}},[]);(0,I.useEffect)(()=>{V()},[V]),(0,I.useEffect)(()=>(n(`plugins-page`,e=>{let t=e;t.type===`plugin.headroom_progress`&&(t.line&&E(e=>[...e.slice(-80),t.line]),V())}),()=>a(`plugins-page`)),[n,a,V]),(0,I.useEffect)(()=>{let e=!1;async function n(){let n=await Promise.all(t.map(async e=>{let[t,n]=await Promise.all([fetch(`${Q(e.id)}/jira/connection`).then(e=>Z(e)).catch(()=>({connected:!1})),fetch(`${Q(e.id)}/plugins`).then(e=>Z(e)).catch(()=>({plugins:[]}))]),r=n.plugins.find(e=>e.name===`serena`);return{jira:+!!t.connected,serena:r&&r.status!==`not-installed`&&r.status!==`orphan`?1:0}}));e||B({jira:n.reduce((e,t)=>e+t.jira,0),serena:n.reduce((e,t)=>e+t.serena,0),projects:t.length})}return n(),()=>{e=!0}},[t]);async function H(e,t){w(e),E([]);try{let e=(await t()).state;e&&f(re(e))}catch(e){let t=e.payload;t?.state&&f(re(t.state))}finally{w(null),V()}}let ne=(0,I.useMemo)(()=>[{id:`headroom-ai`,title:`Headroom AI`,scope:`global`,icon:N,description:e(`plugins.catalog.headroom.description`),installed:d.installed,status:d.lastIssue?`attention`:d.installed?d.activeProviders.codex||d.activeProviders.claude?d.installSource===`system`?`external-active`:`active`:d.installSource===`system`?`external`:`installed`:`available`,statusLabel:d.lastIssue?e(`plugins.status.attention`):d.installed?d.activeProviders.codex||d.activeProviders.claude?d.installSource===`system`?e(`plugins.status.externalActive`):e(`plugins.status.active`):d.installSource===`system`?e(`plugins.status.external`):e(`plugins.status.installed`):e(`plugins.status.available`),actionKind:d.lastIssue?`review`:d.installed?`manage`:`install`,actionLabel:d.lastIssue?e(`plugins.actions.review`):d.installed?e(`plugins.actions.manage`):e(`plugins.actions.install`),busy:S===`install`,action:()=>{if(d.lastIssue||d.installed){M(!0);return}H(`install`,()=>fetch(`${m}/api/global-plugins/headroom/install`,{method:`POST`}).then(e=>Z(e)))}}],[d,S,e]),U=(0,I.useMemo)(()=>[{id:`jira`,title:`Jira`,scope:`project`,icon:ee,description:e(`plugins.catalog.jira.description`),installed:z.jira>0,status:z.jira>0?`configured`:`available`,statusLabel:z.jira>0?e(`plugins.status.configuredCount`,{count:z.jira}):e(`plugins.status.available`),actionKind:z.jira>0?`manage`:`install`,actionLabel:z.jira>0?e(`plugins.actions.manage`):e(`plugins.actions.install`),action:()=>R(`jira`)},{id:`serena`,title:`Serena`,scope:`project`,icon:j,description:e(`plugins.catalog.serena.description`),installed:z.serena>0,status:z.serena>0?`installed`:`available`,statusLabel:z.serena>0?e(`plugins.status.installedCount`,{count:z.serena}):e(`plugins.status.available`),actionKind:z.serena>0?`manage`:`install`,actionLabel:z.serena>0?e(`plugins.actions.manage`):e(`plugins.actions.install`),action:()=>R(`serena`)}],[z,e]),W=o.trim().toLowerCase(),G=t=>`${t.title} ${t.description} ${t.statusLabel} ${e(`plugins.scope.${t.scope}`)}`.toLowerCase().includes(W),K=[...ne,...U].filter(e=>c!==`all`&&e.scope!==c?!1:G(e)),q=K.filter(e=>e.scope===`global`&&e.installed),J=K.filter(e=>e.scope===`project`&&e.installed),Y=K.filter(e=>e.scope===`global`&&!e.installed),ie=K.filter(e=>e.scope===`project`&&!e.installed),$=q.length>0||J.length>0,ae=Y.length>0||ie.length>0,ce=[d.installed,z.jira>0,z.serena>0].filter(Boolean).length;return(0,L.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[(0,L.jsxs)(`div`,{className:`border-b border-border px-6 py-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`grid h-9 w-9 place-items-center rounded-lg border border-accent-primary/25 bg-accent-primary/10 text-accent-primary`,children:(0,L.jsx)(O,{className:`h-4 w-4`})}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`h1`,{className:`text-lg font-semibold tracking-normal`,children:e(`plugins.page.title`)}),(0,L.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e(`plugins.page.subtitle`)})]}),(0,L.jsxs)(`div`,{className:`mr-12 flex items-center gap-2 rounded-lg border border-border bg-card/60 px-3 py-2 text-xs`,children:[(0,L.jsx)(A,{className:`h-3.5 w-3.5 text-accent-success`}),(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:e(`plugins.page.readyCount`,{count:ce})})]})]}),(0,L.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 md:flex-row md:items-center`,children:[(0,L.jsxs)(`label`,{className:`relative flex-1`,children:[(0,L.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,L.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:e(`plugins.search.placeholder`),className:`h-9 w-full rounded-lg border border-border bg-background pl-9 pr-3 text-sm outline-none transition-colors focus:border-accent-primary/60`})]}),(0,L.jsx)(`div`,{className:`inline-flex h-9 rounded-lg border border-border bg-card p-1`,children:[`all`,`global`,`project`].map(t=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>u(t),className:C(`rounded-md px-3 text-xs capitalize transition-colors`,c===t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:e(`plugins.filters.${t}`)},t))})]})]}),(0,L.jsxs)(`div`,{className:`flex-1 overflow-auto px-6 py-5`,children:[(0,L.jsxs)(`section`,{className:`mb-6`,children:[(0,L.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,L.jsx)(k,{className:`h-3.5 w-3.5`}),e(`plugins.sections.installed`)]}),$?(0,L.jsx)(oe,{globalPlugins:q,projectPlugins:J}):(0,L.jsx)(se,{text:e(W?`plugins.empty.installedSearch`:`plugins.empty.installed`)})]}),(0,L.jsxs)(`section`,{children:[(0,L.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,L.jsx)(O,{className:`h-3.5 w-3.5`}),e(`plugins.sections.available`)]}),ae?(0,L.jsx)(oe,{globalPlugins:Y,projectPlugins:ie}):(0,L.jsx)(se,{text:e(W?`plugins.empty.availableSearch`:`plugins.empty.allInstalled`)})]})]}),(0,L.jsx)(x,{open:D,onOpenChange:M,children:(0,L.jsxs)(v,{className:`w-[calc(100vw-2rem)] max-w-xl overflow-x-hidden p-4 sm:p-6`,children:[(0,L.jsxs)(_,{children:[(0,L.jsx)(y,{children:e(`plugins.headroom.title`)}),(0,L.jsx)(b,{children:e(`plugins.headroom.dialogDescription`)})]}),(0,L.jsx)(de,{state:d,loading:p,busy:S,logs:T,onInstall:()=>H(`install`,()=>fetch(`${m}/api/global-plugins/headroom/install`,{method:`POST`}).then(e=>Z(e))),onToggleProvider:(e,t)=>H(`${t?`deactivate`:`activate`}-${e}`,()=>fetch(`${m}/api/global-plugins/headroom/${t?`deactivate`:`activate`}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e})}).then(e=>Z(e))),onDeactivateAll:()=>H(`deactivate-all`,async()=>{let e={state:d};for(let t of[`codex`,`claude`])d.activeProviders[t]&&(e=await fetch(`${m}/api/global-plugins/headroom/deactivate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:t})}).then(e=>Z(e)));return e}),onUninstall:()=>H(`uninstall`,()=>fetch(`${m}/api/global-plugins/headroom/uninstall`,{method:`POST`}).then(e=>Z(e))),onSetPort:e=>H(`port`,()=>fetch(`${m}/api/global-plugins/headroom/port`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({port:e})}).then(e=>Z(e))),onOpenDiagnostics:()=>F(!0)})]})}),(0,L.jsx)(ve,{plugin:te,projects:t,onClose:()=>R(null)}),(0,L.jsx)(xe,{open:P,onClose:()=>F(!1)})]})}function oe({globalPlugins:e,projectPlugins:t}){let{t:n}=i(`integrations`);return(0,L.jsxs)(`div`,{className:C(`grid grid-cols-1 gap-4`,e.length>0&&t.length>0&&`xl:grid-cols-2`),children:[e.length>0&&(0,L.jsxs)(`section`,{children:[(0,L.jsx)(le,{title:n(`plugins.groups.global.title`),detail:n(`plugins.groups.global.detail`),scope:`global`}),(0,L.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,320px))] justify-start gap-3`,children:e.map(e=>(0,L.jsx)(ue,{plugin:e},e.id))})]}),t.length>0&&(0,L.jsxs)(`section`,{children:[(0,L.jsx)(le,{title:n(`plugins.groups.project.title`),detail:n(`plugins.groups.project.detail`),scope:`project`}),(0,L.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,320px))] justify-start gap-3`,children:t.map(e=>(0,L.jsx)(ue,{plugin:e},e.id))})]})]})}function se({text:e}){return(0,L.jsx)(`div`,{className:`flex h-[74px] max-w-[320px] items-center rounded-lg border border-dashed border-border bg-card/35 px-3 text-xs text-muted-foreground`,children:e})}function ce({scope:e}){let{t}=i(`integrations`);return(0,L.jsx)(`span`,{className:C(`rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wide`,e===`global`?`bg-accent-primary/10 text-accent-primary`:`bg-accent-info/10 text-accent-info`),children:t(`plugins.scope.${e}`)})}function le({title:e,detail:t,scope:n}){return(0,L.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,L.jsx)(`div`,{className:C(`h-px flex-1`,n===`global`?`bg-accent-primary/30`:`bg-accent-info/30`)}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card/70 px-2 py-1`,children:[(0,L.jsx)(ce,{scope:n}),(0,L.jsx)(`span`,{className:`text-xs font-medium`,children:e}),(0,L.jsx)(`span`,{className:`hidden text-[11px] text-muted-foreground sm:inline`,children:t})]}),(0,L.jsx)(`div`,{className:C(`h-px flex-1`,n===`global`?`bg-accent-primary/30`:`bg-accent-info/30`)})]})}function ue({plugin:e}){let{t}=i(`integrations`),n=e.icon,r=e.scope===`global`,a=e.status===`attention`,o=e.busy?c:e.actionKind===`install`?s:e.actionKind===`review`?d:F,l=C(`shrink-0 rounded border px-1.5 py-0.5 text-[10px] leading-none`,a?`border-accent-warning/30 bg-accent-warning/10 text-accent-warning`:e.installed?`border-accent-success/25 bg-accent-success/10 text-accent-success`:`border-border bg-muted text-muted-foreground`);return(0,L.jsxs)(`article`,{className:`grid h-[88px] w-full grid-cols-[38px_minmax(0,1fr)_auto] items-center gap-3 rounded-lg border border-border bg-card/70 px-3 transition-colors hover:border-accent-primary/35 hover:bg-card`,children:[(0,L.jsx)(`div`,{className:C(`grid h-[38px] w-[38px] shrink-0 place-items-center rounded-lg border`,r?`border-accent-primary/25 bg-accent-primary/10 text-accent-primary`:`border-accent-info/25 bg-accent-info/10 text-accent-info`),children:(0,L.jsx)(n,{className:`h-4 w-4`})}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`h2`,{className:`truncate text-sm font-semibold leading-5`,children:e.title}),(0,L.jsx)(`p`,{className:`mt-1 truncate text-[11px] leading-4 text-muted-foreground`,children:e.description}),(0,L.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[(0,L.jsx)(ce,{scope:e.scope}),(0,L.jsx)(`span`,{className:l,children:e.statusLabel})]})]}),(0,L.jsxs)(`button`,{type:`button`,disabled:e.busy,onClick:e.action,className:`flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-xs font-medium transition-colors hover:bg-muted disabled:opacity-50`,children:[(0,L.jsx)(o,{className:C(`h-3.5 w-3.5`,e.busy&&`animate-spin`)}),e.busy?t(`plugins.actions.installing`):e.actionLabel]})]})}function de({state:e,loading:t,busy:n,logs:r,onInstall:a,onToggleProvider:o,onDeactivateAll:l,onUninstall:d,onSetPort:p,onOpenDiagnostics:m}){let{t:h}=i(`integrations`),[g,_]=(0,I.useState)(String(e.port)),[v,y]=(0,I.useState)(!1);(0,I.useEffect)(()=>_(String(e.port)),[e.port]),(0,I.useEffect)(()=>{e.installed||y(!1)},[e.installed]);let b=e.activeProviders.codex||e.activeProviders.claude,x=e.installSource===`system`;return(0,L.jsxs)(`aside`,{className:`w-full min-w-0 overflow-hidden rounded-lg border border-border bg-card/80 p-4`,children:[(0,L.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,L.jsx)(`div`,{className:`grid h-10 w-10 place-items-center rounded-lg border border-accent-primary/25 bg-accent-primary/10 text-accent-primary`,children:(0,L.jsx)(N,{className:`h-4 w-4`})}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold`,children:h(`plugins.headroom.title`)}),(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:h(`plugins.headroom.panelDescription`)})]})]}),(0,L.jsxs)(`div`,{className:`mb-4 grid grid-cols-3 gap-2 text-xs`,children:[(0,L.jsx)(fe,{label:h(`plugins.headroom.metrics.install`),value:t?h(`plugins.headroom.metrics.checking`):e.installed?h(`plugins.headroom.metrics.ready`):h(`plugins.headroom.metrics.missing`),good:e.installed}),(0,L.jsx)(fe,{label:h(`plugins.headroom.metrics.source`),value:e.installSource===`system`?h(`plugins.headroom.metrics.system`):e.installSource===`managed`?h(`plugins.headroom.metrics.specrails`):h(`plugins.headroom.metrics.none`),good:e.installed}),(0,L.jsx)(fe,{label:h(`plugins.headroom.metrics.proxy`),value:e.proxyRunning?`:${e.port}`:h(b?`plugins.headroom.metrics.starting`:`plugins.headroom.metrics.off`),good:e.proxyRunning||!b})]}),e.lastIssue&&(0,L.jsx)(pe,{issue:e.lastIssue}),e.installed?(0,L.jsxs)(`div`,{className:`mb-4 space-y-2`,children:[(0,L.jsx)(_e,{provider:`codex`,active:e.activeProviders.codex,available:e.availableProviders.codex,detectedRoute:e.detectedRoutes.codex,busy:n===`activate-codex`||n===`deactivate-codex`,onClick:()=>o(`codex`,e.activeProviders.codex)}),(0,L.jsx)(_e,{provider:`claude`,active:e.activeProviders.claude,available:e.availableProviders.claude,detectedRoute:e.detectedRoutes.claude,busy:n===`activate-claude`||n===`deactivate-claude`,onClick:()=>o(`claude`,e.activeProviders.claude)}),b&&(0,L.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:l,className:`flex h-8 w-full items-center justify-center gap-2 rounded-lg border border-border bg-background/45 text-xs hover:bg-muted/50 disabled:opacity-50`,children:[n===`deactivate-all`?(0,L.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}):(0,L.jsx)(P,{className:`h-3.5 w-3.5`}),h(`plugins.headroom.actions.disableAllRoutes`)]})]}):(0,L.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:a,className:`mb-3 flex h-9 w-full items-center justify-center gap-2 rounded-lg bg-accent-primary px-3 text-xs font-medium text-white disabled:opacity-50`,children:[n===`install`?(0,L.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}):(0,L.jsx)(s,{className:`h-3.5 w-3.5`}),h(`plugins.headroom.actions.installWithUv`)]}),e.installed&&(0,L.jsx)(me,{state:e}),(0,L.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/45 p-3`,children:[(0,L.jsx)(`label`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:h(`plugins.headroom.port.label`)}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),className:`h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-sm`}),(0,L.jsx)(`button`,{type:`button`,disabled:!!n||Number(g)===e.port,onClick:()=>p(Number(g)),className:`rounded-md border border-border px-2 text-xs hover:bg-muted disabled:opacity-50`,children:h(`plugins.headroom.port.apply`)})]})]}),r.length>0&&(0,L.jsx)(`pre`,{className:`mb-3 max-h-32 overflow-y-auto overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-border bg-background/60 p-2 text-[10px] text-muted-foreground`,children:r.join(`
1
+ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{w as r}from"./i18n-hnX2DPmo.js";import{n as i,t as a}from"./createLucideIcon-Bjbbp_KS.js";import{n as o}from"./dist-bVqfYmby.js";import{t as s}from"./download-CFHyyHcw.js";import{t as c}from"./loader-circle-DcygOQpC.js";import{t as l}from"./search-Cq_gE3Ik.js";import{t as u}from"./trash-2-BOU3WdZZ.js";import{t as d}from"./triangle-alert-H9T4jAmh.js";import{n as f,t as p}from"./jira-api-B1-MUehg.js";import{a as m}from"./auth-D_5bQv5W.js";import{n as h,r as g}from"./useDesktop-BQVt8lFd.js";import{a as _,n as v,o as y,r as b,t as x}from"./dialog-CdWCb02j.js";import{t as S}from"./button-CJqFnUOL.js";import{t as C}from"./utils-BC4DHlz2.js";import{r as w}from"./provider-capabilities-Doej9lfa.js";import{At as T,Ot as E,_ as D,lt as O,nt as k,rt as A,tt as j}from"./index-DIhMEAVw.js";var M=a(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),ee=a(`folder-kanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),N=a(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),P=a(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),F=a(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),I=e(t(),1),L=n(),te=[`todo`,`in_progress`,`on_review`,`done`,`cancelled`],R={todo:`todo`,in_progress:`inProgress`,on_review:`onReview`,done:`done`,cancelled:`cancelled`};function z({onConnected:e,onSkip:t,apiBase:n}){let{t:r}=i(`jira`),[a,s]=(0,I.useState)(1),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)(``),[f,m]=(0,I.useState)(``),[h,g]=(0,I.useState)(`idle`),[_,v]=(0,I.useState)(null),[y,b]=(0,I.useState)(`cloud`),[x,C]=(0,I.useState)([]),[w,T]=(0,I.useState)(``),[E,O]=(0,I.useState)(``),[k,A]=(0,I.useState)(``),[j,M]=(0,I.useState)(!1),[ee,N]=(0,I.useState)([]),[P,F]=(0,I.useState)({}),[z,ne]=(0,I.useState)(``),[U,W]=(0,I.useState)(!1),G=()=>({baseUrl:c.trim(),accountEmail:u.trim()||null,token:f});async function K(){g(`testing`);try{let e=await p.test(G(),n);g(`ok`),v(e.displayName),b(e.deployment)}catch(e){g(`error`),o.error(H(e,r))}}async function q(){s(2),M(!0);try{let{projects:e}=await p.discoverProjects({...G(),query:w.trim()||void 0},n);C(e)}catch(e){o.error(H(e,r))}finally{M(!1)}}async function J(){if(s(3),E)try{let{statuses:e}=await p.discoverStatuses({...G(),projectKey:E},n);N(e)}catch{N([])}}async function Y(){W(!0);try{let t=Object.fromEntries(Object.entries(P).filter(([,e])=>e));await p.connect({...G(),jiraProjectKey:E.trim(),statusMap:Object.keys(t).length?t:null,discardStatus:z.trim()||null},n),o.success(r(`status.connected`,{key:E.trim()})),e()}catch(e){o.error(H(e,r))}finally{W(!1)}}return(0,L.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-wizard`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`wizard.step`,{current:a,total:4})}),t&&(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`text-xs text-muted-foreground hover:text-foreground hover:underline`,"data-testid":`jira-later`,children:r(`wizard.later`)})]}),a===1&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step1Title`)}),(0,L.jsx)(B,{label:r(`creds.baseUrlLabel`),help:r(`creds.baseUrlHelp`),children:(0,L.jsx)(D,{value:c,onChange:e=>{l(e.target.value),g(`idle`)},placeholder:r(`creds.baseUrlPlaceholder`)})}),(0,L.jsx)(B,{label:r(`creds.emailLabel`),help:r(`creds.emailHelp`),children:(0,L.jsx)(D,{value:u,onChange:e=>{d(e.target.value),g(`idle`)},placeholder:r(`creds.emailPlaceholder`)})}),(0,L.jsx)(B,{label:r(`creds.tokenLabel`),help:r(`creds.tokenHelp`),children:(0,L.jsx)(D,{type:`password`,value:f,onChange:e=>{m(e.target.value),g(`idle`)}})}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,L.jsx)(S,{size:`sm`,variant:`outline`,onClick:K,disabled:!c.trim()||!f.trim()||h===`testing`,children:r(h===`testing`?`creds.testing`:h===`ok`?`creds.retest`:`creds.test`)}),h===`ok`&&(0,L.jsxs)(`span`,{className:`text-xs text-accent-success`,"data-testid":`jira-test-ok`,children:[`✓ `,r(`creds.testOk`,{name:_??``}),` · `,r(y===`cloud`?`review.cloud`:`review.dc`)]})]}),(0,L.jsx)(`div`,{className:`flex justify-end`,children:(0,L.jsx)(S,{size:`sm`,onClick:q,disabled:h!==`ok`,children:r(`wizard.next`)})})]}),a===2&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step2Title`)}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(D,{value:w,onChange:e=>T(e.target.value),placeholder:r(`project.searchPlaceholder`)}),(0,L.jsx)(S,{size:`sm`,variant:`outline`,onClick:q,children:r(`project.searchPlaceholder`)})]}),j?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`project.loading`)}):x.length===0?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`project.none`)}):(0,L.jsx)(`div`,{className:`max-h-48 space-y-1 overflow-y-auto`,"data-testid":`jira-project-list`,children:x.map(e=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{O(e.key),A(e.name)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left text-sm hover:bg-muted ${E===e.key?`bg-muted`:``}`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:e.key}),(0,L.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.name})]},e.id))}),(0,L.jsx)(B,{label:r(`project.manualLabel`),children:(0,L.jsx)(D,{value:E,onChange:e=>{O(e.target.value.toUpperCase()),A(``)},placeholder:r(`project.manualPlaceholder`)})}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(S,{size:`sm`,variant:`ghost`,onClick:()=>s(1),children:r(`wizard.back`)}),(0,L.jsx)(S,{size:`sm`,onClick:J,disabled:!E.trim(),children:r(`wizard.next`)})]})]}),a===3&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step3Title`)}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`mapping.intro`)}),te.map(e=>(0,L.jsx)(B,{label:r(`mapping.${R[e]}`),children:(0,L.jsxs)(`select`,{value:P[e]??``,onChange:t=>F(n=>({...n,[e]:t.target.value||void 0})),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,children:[(0,L.jsx)(`option`,{value:``,children:r(`mapping.auto`)}),ee.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.id))]})},e)),(0,L.jsx)(B,{label:r(`discard.configLabel`),help:r(`discard.configHelp`),children:(0,L.jsxs)(`select`,{value:z,onChange:e=>ne(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-discard-status-select`,children:[(0,L.jsx)(`option`,{value:``,children:r(`discard.configNone`)}),ee.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.id))]})}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(S,{size:`sm`,variant:`ghost`,onClick:()=>s(2),children:r(`wizard.back`)}),(0,L.jsx)(S,{size:`sm`,onClick:()=>s(4),children:r(`wizard.next`)})]})]}),a===4&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`wizard.step4Title`)}),(0,L.jsxs)(`dl`,{className:`space-y-1 text-sm`,children:[(0,L.jsx)(V,{label:r(`review.site`),value:c}),(0,L.jsx)(V,{label:r(`review.project`),value:k?`${E} — ${k}`:E}),(0,L.jsx)(V,{label:r(`review.account`),value:_??u}),(0,L.jsx)(V,{label:r(`review.type`),value:r(y===`cloud`?`review.cloud`:`review.dc`)}),(0,L.jsx)(V,{label:r(`discard.reviewLabel`),value:z||r(`discard.configNone`)})]}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(S,{size:`sm`,variant:`ghost`,onClick:()=>s(3),children:r(`wizard.back`)}),(0,L.jsx)(S,{size:`sm`,onClick:Y,disabled:U,children:r(U?`wizard.connecting`:`wizard.connect`)})]})]})]})}function B({label:e,help:t,children:n}){return(0,L.jsxs)(`label`,{className:`block space-y-1`,children:[(0,L.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:e}),n,t&&(0,L.jsx)(`span`,{className:`block text-[11px] text-muted-foreground`,children:t})]})}function V({label:e,value:t}){return(0,L.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,L.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,L.jsx)(`dd`,{className:`truncate text-right font-medium`,children:t})]})}function H(e,t){return e instanceof Error?e.message:t(`errors.generic`)}var ne=[`todo`,`in_progress`,`on_review`,`done`,`cancelled`],U={todo:`todo`,in_progress:`inProgress`,on_review:`onReview`,done:`done`,cancelled:`cancelled`};function W({state:e,onChanged:t,apiBase:n}){let{t:r}=i(`jira`),a=e.connection,[s,c]=(0,I.useState)(a.enabled),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(!1),[m,h]=(0,I.useState)([]),[g,_]=(0,I.useState)([]),[v,y]=(0,I.useState)(a.discardStatus??``),[b,x]=(0,I.useState)(a.statusMap??{}),C=e.outbox??{pending:0,inflight:0,done:0,dead:0},w=(0,I.useCallback)(async()=>{try{let{ops:e}=n?await p.listOutbox(`dead`,n):await p.listOutbox(`dead`);h(e)}catch{h([])}},[n]);(0,I.useEffect)(()=>{w()},[w]),(0,I.useEffect)(()=>{let e=!1;return p.listStatuses(n).then(({statuses:t})=>{e||_(t)}).catch(()=>{e||_([])}),()=>{e=!0}},[n]);async function T(e){let i=v;y(e);try{n?await p.patchConnection({discardStatus:e||null},n):await p.patchConnection({discardStatus:e||null}),t()}catch(e){y(i),o.error(K(e,r))}}async function E(e,i){let a=b,s={...b,[e]:i||void 0};x(s);let c=Object.fromEntries(Object.entries(s).filter(([,e])=>e));try{n?await p.patchConnection({statusMap:Object.keys(c).length?c:null},n):await p.patchConnection({statusMap:Object.keys(c).length?c:null}),t()}catch(e){x(a),o.error(K(e,r))}}async function D(){let e=!s;c(e),f(!0);try{n?await p.setEnabled(e,n):await p.setEnabled(e)}catch(t){c(!e),o.error(K(t,r))}finally{f(!1)}}async function O(){u(!0);try{let e=n?await p.syncNow(n):await p.syncNow();o.success(r(`status.syncedToast`,{count:e.upserted}))}catch(e){o.error(K(e,r))}finally{u(!1)}}async function k(){if(window.confirm(r(`status.disconnectConfirm`))){f(!0);try{n?await p.disconnect(n):await p.disconnect(),o.success(r(`status.disconnectedToast`)),t()}catch(e){o.error(K(e,r))}finally{f(!1)}}}async function A(e){try{n?await p.retryOutbox(e,n):await p.retryOutbox(e),await w()}catch(e){o.error(K(e,r))}}let j=C.pending+C.inflight;return(0,L.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-connected`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:r(`status.connected`,{key:a.jiraProjectKey})}),(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[a.baseUrl,` · `,a.deployment===`cloud`?r(`review.cloud`):r(`review.dc`)]})]}),(0,L.jsx)(`a`,{href:`${a.baseUrl}/browse/${a.jiraProjectKey}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-accent-primary hover:underline`,children:r(`badge.openInJira`)})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-border p-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:r(`status.enabledLabel`)}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(s?`status.enabledHelp`:`status.pausedHelp`)})]}),(0,L.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":s,"aria-label":r(`status.enabledLabel`),disabled:d,onClick:D,className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${s?`bg-accent-success`:`bg-input`}`,children:(0,L.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform ${s?`translate-x-4`:`translate-x-0.5`}`})})]}),(0,L.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-status-map`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:r(`wizard.step3Title`)}),(0,L.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:r(`mapping.intro`)}),(0,L.jsx)(`div`,{className:`space-y-2`,children:ne.map(e=>(0,L.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r(`mapping.${U[e]}`)}),(0,L.jsxs)(`select`,{value:b[e]??``,onChange:t=>void E(e,t.target.value),className:`w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-statusmap-${e}`,children:[(0,L.jsx)(`option`,{value:``,children:r(`mapping.auto`)}),g.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.id)),b[e]&&!g.some(t=>t.name===b[e])&&(0,L.jsx)(`option`,{value:b[e],children:b[e]})]})]},e))})]}),(0,L.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:r(`discard.configLabel`)}),(0,L.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:r(`discard.configHelp`)}),(0,L.jsxs)(`select`,{value:v,onChange:e=>void T(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-discard-status-select`,children:[(0,L.jsx)(`option`,{value:``,children:r(`discard.configNone`)}),g.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.name},e.id)),v&&!g.some(e=>e.name===v)&&(0,L.jsx)(`option`,{value:v,children:v})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(S,{variant:`outline`,size:`sm`,onClick:O,disabled:l,children:r(l?`status.syncing`:`status.syncNow`)}),(0,L.jsx)(S,{variant:`ghost`,size:`sm`,onClick:k,disabled:d,className:`text-destructive`,children:r(`status.disconnect`)})]}),(0,L.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-outbox`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium`,children:r(`outbox.title`)}),C.dead>0?(0,L.jsx)(`p`,{className:`mt-1 text-xs text-accent-warning`,children:r(`outbox.dead`,{count:C.dead})}):j>0?(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:r(`outbox.pending`,{count:j})}):(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:r(`outbox.allSynced`)}),m.length>0&&(0,L.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`outbox.deadHelp`)}),m.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded border border-border/60 px-2 py-1`,children:[(0,L.jsxs)(`span`,{className:`truncate text-xs`,children:[G(e,r),` · `,e.deadReason??e.lastError??``]}),(0,L.jsx)(S,{variant:`outline`,size:`sm`,onClick:()=>A(e.id),children:r(`outbox.retry`)})]},e.id))]})]})]})}function G(e,t){return e.opType===`transition`?t(`outbox.opTransition`):e.opType===`comment`?t(`outbox.opComment`):t(`outbox.opCreate`)}function K(e,t){return e instanceof Error?e.message:t(`errors.generic`)}var q=new Set([`claude`,`codex`,`kimi`]);function J(e){return{provider:e,label:e===`codex`?`Codex`:`Claude`,active:!1,available:!1,detectedRoute:!1,requests:0,inputTokens:0,inputTokensSaved:0,outputTokens:0,outputTokensSaved:0,outputSavingsPercent:0,outputSavingsMethod:`none`,outputSavingsAllocated:!1}}function Y(){return{updatedAt:null,proxyStatsAvailable:!1,durableSavingsAvailable:!1,outputSavingsAvailable:!1,outputSavingsMethod:null,outputConfidence:null,providers:{codex:J(`codex`),claude:J(`claude`)},lastIssue:null}}var X={installed:!1,installSource:null,version:null,executablePath:null,uvPath:null,port:8787,phase:`idle`,activeProviders:{codex:!1,claude:!1},availableProviders:{codex:!1,claude:!1},detectedRoutes:{codex:!1,claude:!1},proxyRunning:!1,proxyPid:null,learning:{enabled:!1,baselineReady:!1,baselineSamples:0,updatedAt:null,lastIssue:null},metrics:Y(),lastIssue:null,updatedAt:null};function re(e){let t=e?.metrics??Y();return{...X,...e,activeProviders:{...X.activeProviders,...e?.activeProviders},availableProviders:{...X.availableProviders,...e?.availableProviders},detectedRoutes:{...X.detectedRoutes,...e?.detectedRoutes},learning:{...X.learning,...e?.learning},metrics:{...Y(),...t,providers:{codex:{...J(`codex`),...t.providers?.codex},claude:{...J(`claude`),...t.providers?.claude}}}}}async function Z(e){let t=await e.text(),n=t?JSON.parse(t):{};if(!e.ok){let t=n.issue;throw Object.assign(Error(t?.title??n.error??`HTTP ${e.status}`),{payload:n})}return n}function Q(e){return`${m}/api/projects/${e}`}function ie(e,t=`en`){if(!Number.isFinite(e))return`0`;try{return Intl.NumberFormat(t,{notation:`compact`,maximumFractionDigits:1}).format(Math.max(0,e))}catch{return Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(Math.max(0,e))}}function $(e,t,n){return`${ie(e,t)} ${n}`}function ae(){let{t:e}=i(`integrations`),{projects:t}=g(),{registerHandler:n,unregisterHandler:a}=r(),[o,s]=(0,I.useState)(``),[c,u]=(0,I.useState)(`all`),[d,f]=(0,I.useState)(X),[p,h]=(0,I.useState)(!0),[S,w]=(0,I.useState)(null),[T,E]=(0,I.useState)([]),[D,M]=(0,I.useState)(!1),[P,F]=(0,I.useState)(!1),[te,R]=(0,I.useState)(null),[z,B]=(0,I.useState)({jira:0,serena:0,projects:0}),V=(0,I.useCallback)(async()=>{try{let e=await fetch(`${m}/api/global-plugins/headroom`).then(e=>Z(e));f(re(e.state))}finally{h(!1)}},[]);(0,I.useEffect)(()=>{V()},[V]),(0,I.useEffect)(()=>(n(`plugins-page`,e=>{let t=e;t.type===`plugin.headroom_progress`&&(t.line&&E(e=>[...e.slice(-80),t.line]),V())}),()=>a(`plugins-page`)),[n,a,V]),(0,I.useEffect)(()=>{let e=!1;async function n(){let n=await Promise.all(t.map(async e=>{let[t,n]=await Promise.all([fetch(`${Q(e.id)}/jira/connection`).then(e=>Z(e)).catch(()=>({connected:!1})),fetch(`${Q(e.id)}/plugins`).then(e=>Z(e)).catch(()=>({plugins:[]}))]),r=n.plugins.find(e=>e.name===`serena`);return{jira:+!!t.connected,serena:r&&r.status!==`not-installed`&&r.status!==`orphan`?1:0}}));e||B({jira:n.reduce((e,t)=>e+t.jira,0),serena:n.reduce((e,t)=>e+t.serena,0),projects:t.length})}return n(),()=>{e=!0}},[t]);async function H(e,t){w(e),E([]);try{let e=(await t()).state;e&&f(re(e))}catch(e){let t=e.payload;t?.state&&f(re(t.state))}finally{w(null),V()}}let ne=(0,I.useMemo)(()=>[{id:`headroom-ai`,title:`Headroom AI`,scope:`global`,icon:N,description:e(`plugins.catalog.headroom.description`),installed:d.installed,status:d.lastIssue?`attention`:d.installed?d.activeProviders.codex||d.activeProviders.claude?d.installSource===`system`?`external-active`:`active`:d.installSource===`system`?`external`:`installed`:`available`,statusLabel:d.lastIssue?e(`plugins.status.attention`):d.installed?d.activeProviders.codex||d.activeProviders.claude?d.installSource===`system`?e(`plugins.status.externalActive`):e(`plugins.status.active`):d.installSource===`system`?e(`plugins.status.external`):e(`plugins.status.installed`):e(`plugins.status.available`),actionKind:d.lastIssue?`review`:d.installed?`manage`:`install`,actionLabel:d.lastIssue?e(`plugins.actions.review`):d.installed?e(`plugins.actions.manage`):e(`plugins.actions.install`),busy:S===`install`,action:()=>{if(d.lastIssue||d.installed){M(!0);return}H(`install`,()=>fetch(`${m}/api/global-plugins/headroom/install`,{method:`POST`}).then(e=>Z(e)))}}],[d,S,e]),U=(0,I.useMemo)(()=>[{id:`jira`,title:`Jira`,scope:`project`,icon:ee,description:e(`plugins.catalog.jira.description`),installed:z.jira>0,status:z.jira>0?`configured`:`available`,statusLabel:z.jira>0?e(`plugins.status.configuredCount`,{count:z.jira}):e(`plugins.status.available`),actionKind:z.jira>0?`manage`:`install`,actionLabel:z.jira>0?e(`plugins.actions.manage`):e(`plugins.actions.install`),action:()=>R(`jira`)},{id:`serena`,title:`Serena`,scope:`project`,icon:j,description:e(`plugins.catalog.serena.description`),installed:z.serena>0,status:z.serena>0?`installed`:`available`,statusLabel:z.serena>0?e(`plugins.status.installedCount`,{count:z.serena}):e(`plugins.status.available`),actionKind:z.serena>0?`manage`:`install`,actionLabel:z.serena>0?e(`plugins.actions.manage`):e(`plugins.actions.install`),action:()=>R(`serena`)}],[z,e]),W=o.trim().toLowerCase(),G=t=>`${t.title} ${t.description} ${t.statusLabel} ${e(`plugins.scope.${t.scope}`)}`.toLowerCase().includes(W),K=[...ne,...U].filter(e=>c!==`all`&&e.scope!==c?!1:G(e)),q=K.filter(e=>e.scope===`global`&&e.installed),J=K.filter(e=>e.scope===`project`&&e.installed),Y=K.filter(e=>e.scope===`global`&&!e.installed),ie=K.filter(e=>e.scope===`project`&&!e.installed),$=q.length>0||J.length>0,ae=Y.length>0||ie.length>0,ce=[d.installed,z.jira>0,z.serena>0].filter(Boolean).length;return(0,L.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[(0,L.jsxs)(`div`,{className:`border-b border-border px-6 py-4`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`grid h-9 w-9 place-items-center rounded-lg border border-accent-primary/25 bg-accent-primary/10 text-accent-primary`,children:(0,L.jsx)(O,{className:`h-4 w-4`})}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`h1`,{className:`text-lg font-semibold tracking-normal`,children:e(`plugins.page.title`)}),(0,L.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:e(`plugins.page.subtitle`)})]}),(0,L.jsxs)(`div`,{className:`mr-12 flex items-center gap-2 rounded-lg border border-border bg-card/60 px-3 py-2 text-xs`,children:[(0,L.jsx)(A,{className:`h-3.5 w-3.5 text-accent-success`}),(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:e(`plugins.page.readyCount`,{count:ce})})]})]}),(0,L.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 md:flex-row md:items-center`,children:[(0,L.jsxs)(`label`,{className:`relative flex-1`,children:[(0,L.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,L.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:e(`plugins.search.placeholder`),className:`h-9 w-full rounded-lg border border-border bg-background pl-9 pr-3 text-sm outline-none transition-colors focus:border-accent-primary/60`})]}),(0,L.jsx)(`div`,{className:`inline-flex h-9 rounded-lg border border-border bg-card p-1`,children:[`all`,`global`,`project`].map(t=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>u(t),className:C(`rounded-md px-3 text-xs capitalize transition-colors`,c===t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:e(`plugins.filters.${t}`)},t))})]})]}),(0,L.jsxs)(`div`,{className:`flex-1 overflow-auto px-6 py-5`,children:[(0,L.jsxs)(`section`,{className:`mb-6`,children:[(0,L.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,L.jsx)(k,{className:`h-3.5 w-3.5`}),e(`plugins.sections.installed`)]}),$?(0,L.jsx)(oe,{globalPlugins:q,projectPlugins:J}):(0,L.jsx)(se,{text:e(W?`plugins.empty.installedSearch`:`plugins.empty.installed`)})]}),(0,L.jsxs)(`section`,{children:[(0,L.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,L.jsx)(O,{className:`h-3.5 w-3.5`}),e(`plugins.sections.available`)]}),ae?(0,L.jsx)(oe,{globalPlugins:Y,projectPlugins:ie}):(0,L.jsx)(se,{text:e(W?`plugins.empty.availableSearch`:`plugins.empty.allInstalled`)})]})]}),(0,L.jsx)(x,{open:D,onOpenChange:M,children:(0,L.jsxs)(v,{className:`w-[calc(100vw-2rem)] max-w-xl overflow-x-hidden p-4 sm:p-6`,children:[(0,L.jsxs)(_,{children:[(0,L.jsx)(y,{children:e(`plugins.headroom.title`)}),(0,L.jsx)(b,{children:e(`plugins.headroom.dialogDescription`)})]}),(0,L.jsx)(de,{state:d,loading:p,busy:S,logs:T,onInstall:()=>H(`install`,()=>fetch(`${m}/api/global-plugins/headroom/install`,{method:`POST`}).then(e=>Z(e))),onToggleProvider:(e,t)=>H(`${t?`deactivate`:`activate`}-${e}`,()=>fetch(`${m}/api/global-plugins/headroom/${t?`deactivate`:`activate`}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e})}).then(e=>Z(e))),onDeactivateAll:()=>H(`deactivate-all`,async()=>{let e={state:d};for(let t of[`codex`,`claude`])d.activeProviders[t]&&(e=await fetch(`${m}/api/global-plugins/headroom/deactivate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:t})}).then(e=>Z(e)));return e}),onUninstall:()=>H(`uninstall`,()=>fetch(`${m}/api/global-plugins/headroom/uninstall`,{method:`POST`}).then(e=>Z(e))),onSetPort:e=>H(`port`,()=>fetch(`${m}/api/global-plugins/headroom/port`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({port:e})}).then(e=>Z(e))),onOpenDiagnostics:()=>F(!0)})]})}),(0,L.jsx)(ve,{plugin:te,projects:t,onClose:()=>R(null)}),(0,L.jsx)(xe,{open:P,onClose:()=>F(!1)})]})}function oe({globalPlugins:e,projectPlugins:t}){let{t:n}=i(`integrations`);return(0,L.jsxs)(`div`,{className:C(`grid grid-cols-1 gap-4`,e.length>0&&t.length>0&&`xl:grid-cols-2`),children:[e.length>0&&(0,L.jsxs)(`section`,{children:[(0,L.jsx)(le,{title:n(`plugins.groups.global.title`),detail:n(`plugins.groups.global.detail`),scope:`global`}),(0,L.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,320px))] justify-start gap-3`,children:e.map(e=>(0,L.jsx)(ue,{plugin:e},e.id))})]}),t.length>0&&(0,L.jsxs)(`section`,{children:[(0,L.jsx)(le,{title:n(`plugins.groups.project.title`),detail:n(`plugins.groups.project.detail`),scope:`project`}),(0,L.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(260px,320px))] justify-start gap-3`,children:t.map(e=>(0,L.jsx)(ue,{plugin:e},e.id))})]})]})}function se({text:e}){return(0,L.jsx)(`div`,{className:`flex h-[74px] max-w-[320px] items-center rounded-lg border border-dashed border-border bg-card/35 px-3 text-xs text-muted-foreground`,children:e})}function ce({scope:e}){let{t}=i(`integrations`);return(0,L.jsx)(`span`,{className:C(`rounded px-1.5 py-0.5 text-[10px] uppercase tracking-wide`,e===`global`?`bg-accent-primary/10 text-accent-primary`:`bg-accent-info/10 text-accent-info`),children:t(`plugins.scope.${e}`)})}function le({title:e,detail:t,scope:n}){return(0,L.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,L.jsx)(`div`,{className:C(`h-px flex-1`,n===`global`?`bg-accent-primary/30`:`bg-accent-info/30`)}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card/70 px-2 py-1`,children:[(0,L.jsx)(ce,{scope:n}),(0,L.jsx)(`span`,{className:`text-xs font-medium`,children:e}),(0,L.jsx)(`span`,{className:`hidden text-[11px] text-muted-foreground sm:inline`,children:t})]}),(0,L.jsx)(`div`,{className:C(`h-px flex-1`,n===`global`?`bg-accent-primary/30`:`bg-accent-info/30`)})]})}function ue({plugin:e}){let{t}=i(`integrations`),n=e.icon,r=e.scope===`global`,a=e.status===`attention`,o=e.busy?c:e.actionKind===`install`?s:e.actionKind===`review`?d:F,l=C(`shrink-0 rounded border px-1.5 py-0.5 text-[10px] leading-none`,a?`border-accent-warning/30 bg-accent-warning/10 text-accent-warning`:e.installed?`border-accent-success/25 bg-accent-success/10 text-accent-success`:`border-border bg-muted text-muted-foreground`);return(0,L.jsxs)(`article`,{className:`grid h-[88px] w-full grid-cols-[38px_minmax(0,1fr)_auto] items-center gap-3 rounded-lg border border-border bg-card/70 px-3 transition-colors hover:border-accent-primary/35 hover:bg-card`,children:[(0,L.jsx)(`div`,{className:C(`grid h-[38px] w-[38px] shrink-0 place-items-center rounded-lg border`,r?`border-accent-primary/25 bg-accent-primary/10 text-accent-primary`:`border-accent-info/25 bg-accent-info/10 text-accent-info`),children:(0,L.jsx)(n,{className:`h-4 w-4`})}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`h2`,{className:`truncate text-sm font-semibold leading-5`,children:e.title}),(0,L.jsx)(`p`,{className:`mt-1 truncate text-[11px] leading-4 text-muted-foreground`,children:e.description}),(0,L.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[(0,L.jsx)(ce,{scope:e.scope}),(0,L.jsx)(`span`,{className:l,children:e.statusLabel})]})]}),(0,L.jsxs)(`button`,{type:`button`,disabled:e.busy,onClick:e.action,className:`flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-xs font-medium transition-colors hover:bg-muted disabled:opacity-50`,children:[(0,L.jsx)(o,{className:C(`h-3.5 w-3.5`,e.busy&&`animate-spin`)}),e.busy?t(`plugins.actions.installing`):e.actionLabel]})]})}function de({state:e,loading:t,busy:n,logs:r,onInstall:a,onToggleProvider:o,onDeactivateAll:l,onUninstall:d,onSetPort:p,onOpenDiagnostics:m}){let{t:h}=i(`integrations`),[g,_]=(0,I.useState)(String(e.port)),[v,y]=(0,I.useState)(!1);(0,I.useEffect)(()=>_(String(e.port)),[e.port]),(0,I.useEffect)(()=>{e.installed||y(!1)},[e.installed]);let b=e.activeProviders.codex||e.activeProviders.claude,x=e.installSource===`system`;return(0,L.jsxs)(`aside`,{className:`w-full min-w-0 overflow-hidden rounded-lg border border-border bg-card/80 p-4`,children:[(0,L.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,L.jsx)(`div`,{className:`grid h-10 w-10 place-items-center rounded-lg border border-accent-primary/25 bg-accent-primary/10 text-accent-primary`,children:(0,L.jsx)(N,{className:`h-4 w-4`})}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold`,children:h(`plugins.headroom.title`)}),(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:h(`plugins.headroom.panelDescription`)})]})]}),(0,L.jsxs)(`div`,{className:`mb-4 grid grid-cols-3 gap-2 text-xs`,children:[(0,L.jsx)(fe,{label:h(`plugins.headroom.metrics.install`),value:t?h(`plugins.headroom.metrics.checking`):e.installed?h(`plugins.headroom.metrics.ready`):h(`plugins.headroom.metrics.missing`),good:e.installed}),(0,L.jsx)(fe,{label:h(`plugins.headroom.metrics.source`),value:e.installSource===`system`?h(`plugins.headroom.metrics.system`):e.installSource===`managed`?h(`plugins.headroom.metrics.specrails`):h(`plugins.headroom.metrics.none`),good:e.installed}),(0,L.jsx)(fe,{label:h(`plugins.headroom.metrics.proxy`),value:e.proxyRunning?`:${e.port}`:h(b?`plugins.headroom.metrics.starting`:`plugins.headroom.metrics.off`),good:e.proxyRunning||!b})]}),e.lastIssue&&(0,L.jsx)(pe,{issue:e.lastIssue}),e.installed?(0,L.jsxs)(`div`,{className:`mb-4 space-y-2`,children:[(0,L.jsx)(_e,{provider:`codex`,active:e.activeProviders.codex,available:e.availableProviders.codex,detectedRoute:e.detectedRoutes.codex,busy:n===`activate-codex`||n===`deactivate-codex`,onClick:()=>o(`codex`,e.activeProviders.codex)}),(0,L.jsx)(_e,{provider:`claude`,active:e.activeProviders.claude,available:e.availableProviders.claude,detectedRoute:e.detectedRoutes.claude,busy:n===`activate-claude`||n===`deactivate-claude`,onClick:()=>o(`claude`,e.activeProviders.claude)}),b&&(0,L.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:l,className:`flex h-8 w-full items-center justify-center gap-2 rounded-lg border border-border bg-background/45 text-xs hover:bg-muted/50 disabled:opacity-50`,children:[n===`deactivate-all`?(0,L.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}):(0,L.jsx)(P,{className:`h-3.5 w-3.5`}),h(`plugins.headroom.actions.disableAllRoutes`)]})]}):(0,L.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:a,className:`mb-3 flex h-9 w-full items-center justify-center gap-2 rounded-lg bg-accent-primary px-3 text-xs font-medium text-white disabled:opacity-50`,children:[n===`install`?(0,L.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}):(0,L.jsx)(s,{className:`h-3.5 w-3.5`}),h(`plugins.headroom.actions.installWithUv`)]}),e.installed&&(0,L.jsx)(me,{state:e}),(0,L.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/45 p-3`,children:[(0,L.jsx)(`label`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:h(`plugins.headroom.port.label`)}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),className:`h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-sm`}),(0,L.jsx)(`button`,{type:`button`,disabled:!!n||Number(g)===e.port,onClick:()=>p(Number(g)),className:`rounded-md border border-border px-2 text-xs hover:bg-muted disabled:opacity-50`,children:h(`plugins.headroom.port.apply`)})]})]}),r.length>0&&(0,L.jsx)(`pre`,{className:`mb-3 max-h-32 overflow-y-auto overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-border bg-background/60 p-2 text-[10px] text-muted-foreground`,children:r.join(`
2
2
  `)}),(0,L.jsxs)(`button`,{type:`button`,onClick:m,className:`mb-2 flex h-8 w-full items-center justify-center gap-2 rounded-lg border border-border text-xs hover:bg-muted/50`,children:[(0,L.jsx)(f,{className:`h-3.5 w-3.5`}),h(`plugins.headroom.actions.viewDiagnostics`)]}),e.installed&&(0,L.jsx)(`div`,{className:`rounded-lg border border-destructive/25 bg-destructive/5 p-3`,children:v?(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:h(x?`plugins.headroom.confirmDetach`:`plugins.headroom.confirmUninstall`)}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,disabled:!!n,onClick:()=>y(!1),className:`h-8 rounded-md border border-border text-xs hover:bg-muted/50 disabled:opacity-50`,children:h(`plugins.actions.cancel`)}),(0,L.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:d,className:`flex h-8 items-center justify-center gap-2 rounded-md bg-destructive px-2 text-xs font-medium text-destructive-foreground disabled:opacity-50`,children:[n===`uninstall`?(0,L.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}):(0,L.jsx)(u,{className:`h-3.5 w-3.5`}),h(x?`plugins.headroom.actions.detach`:`plugins.headroom.actions.uninstall`)]})]})]}):(0,L.jsxs)(`button`,{type:`button`,disabled:!!n,onClick:()=>y(!0),className:`flex h-8 w-full items-center justify-center gap-2 rounded-md text-xs font-medium text-destructive hover:bg-destructive/10 disabled:opacity-50`,children:[(0,L.jsx)(u,{className:`h-3.5 w-3.5`}),h(x?`plugins.headroom.actions.detachHeadroom`:`plugins.headroom.actions.uninstallHeadroom`)]})})]})}function fe({label:e,value:t,good:n}){return(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/45 p-2`,children:[(0,L.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e}),(0,L.jsx)(`div`,{className:C(`mt-0.5 font-medium`,n?`text-foreground`:`text-accent-warning`),children:t})]})}function pe({issue:e}){let{t}=i(`integrations`),n=`plugins.headroom.issues.${e.code}`,r=t(`${n}.title`,{defaultValue:e.title}),a=t(`${n}.guidance`,{defaultValue:e.guidance});return(0,L.jsx)(`div`,{className:`mb-3 rounded-lg border border-accent-warning/35 bg-accent-warning/10 p-3`,children:(0,L.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,L.jsx)(d,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-accent-warning`}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`text-xs font-medium`,children:r}),(0,L.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-muted-foreground`,children:a}),(0,L.jsx)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:t(`plugins.headroom.issueCode`,{code:e.code})})]})]})})}function me({state:e}){let{t,i18n:n}=i(`integrations`),r=e.metrics,a=r.outputSavingsAvailable,o=[`codex`,`claude`].map(e=>({provider:e,metric:r.providers[e]})),s=t(`plugins.headroom.savings.tokens`),c=o.reduce((e,{metric:t})=>({inputTokens:e.inputTokens+t.inputTokens,inputTokensSaved:e.inputTokensSaved+t.inputTokensSaved,outputTokens:e.outputTokens+t.outputTokens,outputTokensSaved:e.outputTokensSaved+t.outputTokensSaved}),{inputTokens:0,inputTokensSaved:0,outputTokens:0,outputTokensSaved:0}),l=o.some(({metric:e})=>e.inputTokensSaved>0),u=o.some(({metric:e})=>e.active),d=t(a?`plugins.headroom.savings.statusInputOutput`:l?`plugins.headroom.savings.statusInputOnly`:u?`plugins.headroom.savings.statusRouting`:`plugins.headroom.savings.statusInactive`),f=a||l;return(0,L.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/45 p-3`,children:[(0,L.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(T,{className:`h-3.5 w-3.5 text-accent-primary`}),(0,L.jsx)(`div`,{className:`truncate text-xs font-medium`,children:t(`plugins.headroom.savings.title`)})]}),(0,L.jsx)(`span`,{className:C(`shrink-0 rounded border px-1.5 py-0.5 text-[10px]`,f?`border-accent-success/25 bg-accent-success/10 text-accent-success`:u?`border-accent-primary/25 bg-accent-primary/10 text-accent-primary`:`border-border bg-muted text-muted-foreground`),children:d})]}),(0,L.jsxs)(`div`,{className:`mb-2 rounded-md bg-muted/35 px-2.5 py-2`,children:[(0,L.jsx)(`div`,{className:`mb-1.5 text-[10px] font-medium uppercase text-muted-foreground`,children:t(`plugins.headroom.savings.totals`)}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,L.jsx)(he,{label:t(`plugins.headroom.savings.input`),processed:c.inputTokens>0?$(c.inputTokens,n.language,s):t(`plugins.headroom.savings.noData`),saved:$(c.inputTokensSaved,n.language,s)}),(0,L.jsx)(he,{align:`right`,label:t(`plugins.headroom.savings.output`),processed:c.outputTokens>0?$(c.outputTokens,n.language,s):t(`plugins.headroom.savings.noData`),saved:a?$(c.outputTokensSaved,n.language,s):t(`plugins.headroom.savings.noData`)})]})]}),(0,L.jsx)(`div`,{className:`grid gap-2`,children:o.map(({provider:e,metric:t})=>(0,L.jsx)(ge,{metric:t,outputAvailable:r.outputSavingsAvailable},e))}),(0,L.jsx)(`div`,{className:`mt-2 flex items-center justify-end gap-2 text-[10px] text-muted-foreground`,children:r.updatedAt?t(`plugins.headroom.savings.updatedLive`):t(`plugins.headroom.savings.baselineSamples`,{count:e.learning.baselineSamples})})]})}function he({label:e,processed:t,saved:n,detail:r,align:a=`left`}){let{t:o}=i(`integrations`);return(0,L.jsxs)(`div`,{className:C(`min-w-0`,a===`right`&&`text-right`),children:[(0,L.jsx)(`div`,{className:`text-[10px] font-medium uppercase text-muted-foreground`,children:e}),(0,L.jsxs)(`div`,{className:`mt-1 space-y-0.5 text-[11px]`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-baseline justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:o(`plugins.headroom.savings.processed`)}),(0,L.jsx)(`span`,{className:`truncate font-semibold tabular-nums text-foreground`,children:t})]}),(0,L.jsxs)(`div`,{className:`flex min-w-0 items-baseline justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:o(`plugins.headroom.savings.saved`)}),(0,L.jsx)(`span`,{className:`truncate font-semibold tabular-nums text-foreground`,children:n})]})]}),r&&(0,L.jsx)(`div`,{className:`mt-1 truncate text-[10px] text-muted-foreground`,children:r})]})}function ge({metric:e,outputAvailable:t}){let{t:n,i18n:r}=i(`integrations`),a=!e.available,o=a||!e.active,s=n(`plugins.headroom.savings.tokens`),c=e.inputTokens>0?$(e.inputTokens,r.language,s):n(`plugins.headroom.savings.noData`),l=$(e.inputTokensSaved,r.language,s),u=e.outputTokens>0?$(e.outputTokens,r.language,s):n(`plugins.headroom.savings.noData`),d=t?$(e.outputTokensSaved,r.language,s):e.active?n(`plugins.headroom.savings.noData`):n(`plugins.headroom.savings.off`),f=e.requests>0?n(`plugins.headroom.savings.requestCount`,{count:ie(e.requests,r.language)}):a?n(`plugins.headroom.provider.noProjectUsesProvider`):e.active?n(`plugins.headroom.savings.inputSavingsActive`):n(`plugins.headroom.savings.routeDisabled`);return(0,L.jsxs)(`div`,{className:C(`rounded-md border border-border bg-card/45 px-2.5 py-2`,o&&`opacity-70`),children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,L.jsx)(`span`,{className:`text-xs font-medium`,children:e.label}),e.detectedRoute&&(0,L.jsx)(`span`,{className:`rounded bg-accent-primary/10 px-1.5 py-0.5 text-[9px] uppercase text-accent-primary`,children:n(`plugins.headroom.savings.detected`)})]}),(0,L.jsx)(`div`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:f}),(0,L.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-3`,children:[(0,L.jsx)(he,{label:n(`plugins.headroom.savings.input`),processed:c,saved:l}),(0,L.jsx)(he,{align:`right`,label:n(`plugins.headroom.savings.output`),processed:u,saved:d})]})]})}function _e({provider:e,active:t,available:n,detectedRoute:r,busy:a,onClick:o}){let{t:s}=i(`integrations`),l=s(n?t?`plugins.headroom.provider.routedThroughHeadroom`:r?`plugins.headroom.provider.detectedExternalRoute`:`plugins.headroom.provider.notRouted`:`plugins.headroom.provider.noProjectUsesProvider`);return(0,L.jsxs)(`button`,{type:`button`,onClick:o,disabled:a||!n,className:`flex w-full items-center gap-3 rounded-lg border border-border bg-background/45 p-3 text-left hover:bg-muted/35 disabled:opacity-50`,children:[(0,L.jsx)(`div`,{className:C(`grid h-8 w-8 place-items-center rounded-md`,t?`bg-accent-success/15 text-accent-success`:`bg-muted text-muted-foreground`),children:a?(0,L.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}):(0,L.jsx)(M,{className:`h-3.5 w-3.5`})}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`div`,{className:`text-xs font-medium capitalize`,children:e}),(0,L.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:l})]}),(0,L.jsx)(`span`,{className:C(`h-5 w-9 rounded-full p-0.5 transition-colors`,t?`bg-accent-success`:`bg-muted`),children:(0,L.jsx)(`span`,{className:C(`block h-4 w-4 rounded-full bg-white shadow transition-transform`,t&&`translate-x-4`)})})]})}function ve({plugin:e,projects:t,onClose:n}){let{t:r}=i(`integrations`),[a,o]=(0,I.useState)(``);(0,I.useEffect)(()=>o(``),[e]);let s=t.find(e=>e.id===a)??null;return(0,L.jsx)(x,{open:!!e,onOpenChange:e=>{e||n()},children:(0,L.jsxs)(v,{className:`w-[calc(100vw-2rem)] max-w-3xl overflow-x-hidden p-4 sm:p-6`,children:[(0,L.jsxs)(_,{children:[(0,L.jsx)(y,{children:r(e===`jira`?`plugins.projectWizard.configureJira`:`plugins.projectWizard.installSerena`)}),(0,L.jsx)(b,{children:r(`plugins.projectWizard.description`)})]}),(0,L.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-[260px_minmax(0,1fr)]`,children:[(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/70 p-3`,children:[(0,L.jsx)(`div`,{className:`mb-2 text-xs font-medium text-muted-foreground`,children:r(`plugins.projectWizard.chooseProject`)}),(0,L.jsx)(`div`,{className:`max-h-[52vh] space-y-1 overflow-auto`,children:t.map(t=>{let n=e===`serena`&&!h(t).some(e=>q.has(e));return(0,L.jsxs)(`button`,{type:`button`,disabled:n,onClick:()=>o(t.id),className:C(`w-full rounded-md px-2 py-2 text-left transition-colors`,t.id===a?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/45 hover:text-foreground`,n&&`cursor-not-allowed opacity-45`),children:[(0,L.jsx)(`div`,{className:`truncate text-xs font-medium`,children:t.name}),(0,L.jsx)(`div`,{className:`truncate text-[10px]`,children:n?r(`plugins.projectWizard.requiresSupportedProvider`,{defaultValue:`Requires Claude, Codex, or Kimi`}):t.path})]},t.id)})})]}),(0,L.jsx)(`div`,{className:`min-h-[360px] rounded-lg border border-border bg-card/70 p-4`,children:s?e===`jira`?(0,L.jsx)(ye,{project:s,onDone:n}):(0,L.jsx)(be,{project:s,onDone:n}):(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:r(`plugins.projectWizard.selectProjectToContinue`)})})]})]})})}function ye({project:e,onDone:t}){let{t:n}=i(`integrations`),r=Q(e.id),[a,o]=(0,I.useState)(null),[s,l]=(0,I.useState)(!0),[u,d]=(0,I.useState)(null),f=(0,I.useCallback)(async()=>{l(!0),d(null);try{let e=await fetch(`${r}/jira/connection`).then(e=>Z(e));o(e)}catch(e){o({connected:!1}),d(e.message)}finally{l(!1)}},[r]);return(0,I.useEffect)(()=>{f()},[f]),s?(0,L.jsxs)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:[(0,L.jsx)(c,{className:`mr-2 h-4 w-4 animate-spin`}),n(`plugins.jira.loading`,{defaultValue:`Loading Jira...`})]}):a?.connected&&a.connection?(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:n(`plugins.jira.titleForProject`,{name:e.name,defaultValue:`Jira for ${e.name}`})}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n(`plugins.jira.configuredDescription`,{defaultValue:`Manage the Jira project, status mapping, discard status, sync, and connection state.`})})]}),(0,L.jsx)(W,{state:a,apiBase:r,onChanged:()=>{f()}})]}):(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:n(`plugins.jira.titleForProject`,{name:e.name,defaultValue:`Jira for ${e.name}`})}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:u?n(`plugins.jira.loadFailed`,{message:u,defaultValue:`Could not load the current Jira configuration: ${u}`}):n(`plugins.jira.notConfiguredDescription`,{defaultValue:`Connect this project to Jira.`})})]}),(0,L.jsx)(z,{apiBase:r,onConnected:()=>{f()},onSkip:t})]})}function be({project:e,onDone:t}){let{t:n}=i(`integrations`),r=(0,I.useMemo)(()=>h(e).filter(e=>q.has(e)),[e]),a=r.includes(e.provider)?e.provider:r[0]??e.provider,[o,l]=(0,I.useState)(a),[u,f]=(0,I.useState)(null),[p,m]=(0,I.useState)(null),[g,_]=(0,I.useState)(!1),[v,y]=(0,I.useState)(null),b=(0,I.useRef)(0);(0,I.useEffect)(()=>{l(a),f(null),m(null)},[e.id,a]);let x=(0,I.useCallback)(async()=>{let t=++b.current;y(null);try{let n=`?provider=${encodeURIComponent(o)}`,r=await fetch(`${Q(e.id)}/plugins${n}`).then(e=>Z(e));if(t!==b.current)return;let i=r.plugins.find(e=>e.name===`serena`)??null;if(f(i),m(null),i?.status===`not-installed`){let r=await fetch(`${Q(e.id)}/plugins/serena/preview-install${n}`).then(e=>Z(e));t===b.current&&m(r)}}catch(e){t===b.current&&y(e.message)}},[e.id,o]);(0,I.useEffect)(()=>{x()},[x]);async function S(){_(!0),y(null);try{await fetch(`${Q(e.id)}/plugins/serena/install`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:o})}).then(e=>Z(e)),await x(),t()}catch(e){y(e.message)}finally{_(!1)}}let C=(p?.requirements??[]).every(e=>e.installed&&e.executable&&e.meetsMinimum),T=u?n(`plugins.projectStatus.${u.status}`,{defaultValue:u.status}):``,D=u?.name===`serena`?n(`plugins.catalog.serena.description`):u?.description;return!u&&!v?(0,L.jsxs)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:[(0,L.jsx)(c,{className:`mr-2 h-4 w-4 animate-spin`}),` `,n(`plugins.serena.loading`)]}):(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold`,children:n(`plugins.serena.titleForProject`,{name:e.name})}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n(`plugins.serena.description`)})]}),(0,L.jsxs)(`label`,{className:`block space-y-1`,children:[(0,L.jsx)(`span`,{className:`text-xs font-medium`,children:n(`plugins.serena.provider`,{defaultValue:`AI provider`})}),(0,L.jsx)(`select`,{"aria-label":n(`plugins.serena.provider`,{defaultValue:`AI provider`}),value:o,disabled:g,onChange:e=>{f(null),m(null),l(e.target.value)},className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-xs`,children:r.map(e=>(0,L.jsx)(`option`,{value:e,children:w(e)},e))})]}),u&&(0,L.jsxs)(`div`,{className:`rounded-lg border border-border bg-background/45 p-3`,children:[(0,L.jsx)(`div`,{className:`text-xs font-medium`,children:n(`plugins.serena.status`,{status:T})}),D&&(0,L.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:D})]}),p&&(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`mb-1 text-xs font-medium`,children:n(`plugins.serena.files`)}),(0,L.jsx)(`ul`,{className:`space-y-1 text-xs font-mono`,children:p.files.map(e=>(0,L.jsxs)(`li`,{className:e.op===`create`?`text-accent-success`:`text-accent-info`,children:[e.op===`create`?`+ `:`~ `,e.path]},e.path))})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`mb-1 text-xs font-medium`,children:n(`plugins.serena.prerequisites`)}),(0,L.jsx)(`ul`,{className:`space-y-1 text-xs`,children:p.requirements.map(e=>(0,L.jsxs)(`li`,{className:`flex items-center gap-2`,children:[e.installed&&e.executable&&e.meetsMinimum?(0,L.jsx)(E,{className:`h-3 w-3 text-accent-success`}):(0,L.jsx)(d,{className:`h-3 w-3 text-accent-warning`}),(0,L.jsxs)(`span`,{children:[e.name,e.minVersion?` >= ${e.minVersion}`:``]}),e.version&&(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.version,`)`]})]},e.name))})]})]}),v&&(0,L.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-xs text-destructive`,children:v}),(0,L.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md border border-border px-3 py-1.5 text-xs`,children:n(`plugins.actions.cancel`)}),(0,L.jsxs)(`button`,{type:`button`,disabled:g||u?.status!==`not-installed`||!C,onClick:S,className:`flex items-center gap-2 rounded-md bg-accent-primary px-3 py-1.5 text-xs text-white disabled:opacity-50`,children:[g?(0,L.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}):(0,L.jsx)(s,{className:`h-3.5 w-3.5`}),n(`plugins.actions.install`)]})]})]})}function xe({open:e,onClose:t}){let{t:n}=i(`integrations`),[r,a]=(0,I.useState)(null);return(0,I.useEffect)(()=>{e&&fetch(`${m}/api/global-plugins/headroom/diagnostics`).then(e=>Z(e)).then(a).catch(e=>a({error:e.message}))},[e]),(0,L.jsx)(x,{open:e,onOpenChange:e=>{e||t()},children:(0,L.jsxs)(v,{className:`max-w-3xl`,children:[(0,L.jsxs)(_,{children:[(0,L.jsxs)(y,{className:`flex items-center gap-2`,children:[(0,L.jsx)(F,{className:`h-4 w-4`}),` `,n(`plugins.diagnostics.title`)]}),(0,L.jsx)(b,{children:n(`plugins.diagnostics.description`)})]}),(0,L.jsx)(`pre`,{className:`max-h-[62vh] overflow-y-auto overflow-x-hidden whitespace-pre-wrap break-words rounded-lg border border-border bg-background p-3 text-xs`,children:JSON.stringify(r,null,2)})]})})}export{ae as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{n as r,t as i}from"./createLucideIcon-Bjbbp_KS.js";import{t as a}from"./git-branch-BRM0F5GN.js";import{r as o}from"./useDesktop-BzX769yH.js";import{a as s,n as c,o as l,r as u,t as d}from"./dialog-CdWCb02j.js";import{t as f}from"./utils-BC4DHlz2.js";import{Pt as p,Z as m,d as h,f as g,g as _,h as v,it as y,m as b,nt as x,p as S,tt as C}from"./index-DhjjFyU5.js";var w=i(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),T=e(t(),1),E=n(),D=[{id:`general`,icon:x,labelKey:`projectDialog.nav.general`},{id:`branch`,icon:a,labelKey:`projectDialog.nav.branch`},{id:`environment`,icon:w,labelKey:`projectDialog.nav.environment`},{id:`budget`,icon:m,labelKey:`projectDialog.nav.budget`},{id:`telemetry`,icon:p,labelKey:`projectDialog.nav.telemetry`},{id:`terminal`,icon:C,labelKey:`projectDialog.nav.terminal`}];function O({open:e,onClose:t}){let{t:n}=r(`settings`),{activeProjectId:i,projects:a}=o(),p=a.find(e=>e.id===i),[m,x]=(0,T.useState)(`general`),C=e=>f(`space-y-5`,m===e?``:`hidden`);return(0,E.jsx)(d,{open:e,onOpenChange:e=>{e||t()},children:(0,E.jsxs)(c,{movableResizable:!0,className:`flex max-w-5xl w-[92vw] h-[82vh] flex-col overflow-hidden`,children:[(0,E.jsxs)(s,{children:[(0,E.jsxs)(l,{className:`flex items-center gap-2`,children:[(0,E.jsx)(y,{className:`w-4 h-4`}),p?n(`projectDialog.title`,{name:p.name}):n(`page.title`)]}),(0,E.jsx)(u,{children:n(`projectDialog.description`)})]}),(0,E.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 py-2`,children:[(0,E.jsx)(`nav`,{className:`w-40 shrink-0 space-y-0.5 overflow-y-auto border-r border-border pr-2`,children:D.map(e=>{let t=e.icon;return(0,E.jsxs)(`button`,{type:`button`,onClick:()=>x(e.id),className:f(`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors`,m===e.id?`bg-accent-primary/15 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/40 hover:text-foreground`),children:[(0,E.jsx)(t,{className:`w-3.5 h-3.5 shrink-0`}),(0,E.jsx)(`span`,{className:`truncate`,children:n(e.labelKey)})]},e.id)})}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto pr-1`,children:[(0,E.jsx)(`div`,{className:C(`general`),children:(0,E.jsx)(S,{})}),(0,E.jsx)(`div`,{className:C(`branch`),children:(0,E.jsx)(g,{})}),(0,E.jsx)(`div`,{className:C(`environment`),children:(0,E.jsx)(v,{})}),(0,E.jsx)(`div`,{className:C(`budget`),children:(0,E.jsx)(h,{})}),(0,E.jsx)(`div`,{className:C(`telemetry`),children:(0,E.jsx)(b,{})}),(0,E.jsx)(`div`,{className:C(`terminal`),children:(0,E.jsx)(_,{mode:`project`})})]})]})]})})}export{O as ProjectSettingsDialog};
1
+ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{n as r,t as i}from"./createLucideIcon-Bjbbp_KS.js";import{t as a}from"./git-branch-BRM0F5GN.js";import{r as o}from"./useDesktop-BQVt8lFd.js";import{a as s,n as c,o as l,r as u,t as d}from"./dialog-CdWCb02j.js";import{t as f}from"./utils-BC4DHlz2.js";import{Pt as p,Z as m,d as h,f as g,g as _,h as v,it as y,m as b,nt as x,p as S,tt as C}from"./index-DIhMEAVw.js";var w=i(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),T=e(t(),1),E=n(),D=[{id:`general`,icon:x,labelKey:`projectDialog.nav.general`},{id:`branch`,icon:a,labelKey:`projectDialog.nav.branch`},{id:`environment`,icon:w,labelKey:`projectDialog.nav.environment`},{id:`budget`,icon:m,labelKey:`projectDialog.nav.budget`},{id:`telemetry`,icon:p,labelKey:`projectDialog.nav.telemetry`},{id:`terminal`,icon:C,labelKey:`projectDialog.nav.terminal`}];function O({open:e,onClose:t}){let{t:n}=r(`settings`),{activeProjectId:i,projects:a}=o(),p=a.find(e=>e.id===i),[m,x]=(0,T.useState)(`general`),C=e=>f(`space-y-5`,m===e?``:`hidden`);return(0,E.jsx)(d,{open:e,onOpenChange:e=>{e||t()},children:(0,E.jsxs)(c,{movableResizable:!0,className:`flex max-w-5xl w-[92vw] h-[82vh] flex-col overflow-hidden`,children:[(0,E.jsxs)(s,{children:[(0,E.jsxs)(l,{className:`flex items-center gap-2`,children:[(0,E.jsx)(y,{className:`w-4 h-4`}),p?n(`projectDialog.title`,{name:p.name}):n(`page.title`)]}),(0,E.jsx)(u,{children:n(`projectDialog.description`)})]}),(0,E.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 py-2`,children:[(0,E.jsx)(`nav`,{className:`w-40 shrink-0 space-y-0.5 overflow-y-auto border-r border-border pr-2`,children:D.map(e=>{let t=e.icon;return(0,E.jsxs)(`button`,{type:`button`,onClick:()=>x(e.id),className:f(`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors`,m===e.id?`bg-accent-primary/15 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/40 hover:text-foreground`),children:[(0,E.jsx)(t,{className:`w-3.5 h-3.5 shrink-0`}),(0,E.jsx)(`span`,{className:`truncate`,children:n(e.labelKey)})]},e.id)})}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto pr-1`,children:[(0,E.jsx)(`div`,{className:C(`general`),children:(0,E.jsx)(S,{})}),(0,E.jsx)(`div`,{className:C(`branch`),children:(0,E.jsx)(g,{})}),(0,E.jsx)(`div`,{className:C(`environment`),children:(0,E.jsx)(v,{})}),(0,E.jsx)(`div`,{className:C(`budget`),children:(0,E.jsx)(h,{})}),(0,E.jsx)(`div`,{className:C(`telemetry`),children:(0,E.jsx)(b,{})}),(0,E.jsx)(`div`,{className:C(`terminal`),children:(0,E.jsx)(_,{mode:`project`})})]})]})]})})}export{O as ProjectSettingsDialog};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{d as r,u as i}from"./chunk-KS7C4IRE-DEKu087k.js";import{n as a,t as o}from"./createLucideIcon-Bjbbp_KS.js";import{n as s}from"./save-B6wGWwBR.js";import{$ as ee,Z as c,o as l}from"./TicketDetailModal-BvZoyDAL.js";import{d as u,u as d}from"./MinimizedChatsContext-CcjBHMHd.js";import{t as te}from"./ban-E4EaZe3a.js";import{n as f}from"./file-text-BcLCfcWZ.js";import{t as p}from"./loader-circle-DcygOQpC.js";import{a as m,c as ne,t as re}from"./git-refresh-wTW0rO0Z.js";import{t as h}from"./sparkles-DrY8hb0X.js";import{t as g}from"./triangle-alert-H9T4jAmh.js";import{a as _,r as v}from"./useDesktop-BzX769yH.js";import{b as y,rt as b,vt as x}from"./index-DhjjFyU5.js";var S=o(`circle-dollar-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]),C=o(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),w=e(t(),1),T=(e={})=>({verbs:[],acceptMeaning:null,fineControlOnly:!1,inFlight:!1,terminal:!1,requiresIrreversibleConfirm:!1,...e});function E(e){let{decision:t,presentation:n,prUrl:r,canCreatePr:i}=e;if(t===`building`)return T({inFlight:!0});if(t===`merged`||t===`discarded`||n.superseded)return T({terminal:!0});if(n.manualRecovery||n.recoveryUnavailable||n.recoveryRecheck||n.retryablePush||n.retryablePrCreation||n.closed||n.deliveryBlocked&&!n.implementationFailed)return T({fineControlOnly:!0});if(n.noChanges)return T({verbs:[`accept`,`request-changes`],acceptMeaning:`mark-done`});if(n.implementationFailed)return T({verbs:n.succeededCount>0?[`request-changes`,`discard`]:[`discard`]});if(t===`pr_draft`)return T(r?{verbs:[`accept`,`request-changes`,`discard`],acceptMeaning:`publish`}:{fineControlOnly:!0});if(t===`pr_ready`)return T({verbs:[`request-changes`,`discard`]});if(t===`on_review`){let e=i?`create-pr`:`merge-local`;return T({verbs:[`accept`,`request-changes`,`discard`],acceptMeaning:e,requiresIrreversibleConfirm:e===`merge-local`})}return T({fineControlOnly:!0})}function ie(e,t){if(e===`discard`)return`discard`;if(e===`request-changes`)return null;switch(t.acceptMeaning){case`create-pr`:return`create-pr`;case`publish`:return`publish`;case`merge-local`:return`merge-local`;case`mark-done`:return`acknowledge-no-changes`;default:return null}}var D=n(),O=[`app-verified`,`ai-reported`,`reviewer-score`],k={"app-verified":b,"ai-reported":h,"reviewer-score":C},A={"app-verified":`text-accent-success border-accent-success/30 bg-accent-success/5`,"ai-reported":`text-accent-highlight border-accent-highlight/30 bg-accent-highlight/5`,"reviewer-score":`text-accent-info border-accent-info/30 bg-accent-info/5`};function j({item:e}){let{t}=a(`packet`);return(0,D.jsxs)(`li`,{className:`flex flex-col gap-1 py-1.5`,children:[(0,D.jsx)(`span`,{className:`text-sm text-foreground`,children:t(e.code,{...e.values??{},defaultValue:e.code})}),e.rawExcerpt?(0,D.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded border border-border/60 bg-background-deep/60 p-2 text-[11px] leading-relaxed text-muted-foreground whitespace-pre-wrap`,children:e.rawExcerpt}):null]})}function M({title:e,children:t,defaultOpen:n=!1,badge:r}){let[i,a]=(0,w.useState)(n);return(0,D.jsxs)(`div`,{className:`rounded-lg border border-border/60 bg-surface/40`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-center gap-2 px-4 py-3 text-left`,"aria-expanded":i,children:[i?(0,D.jsx)(d,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}):(0,D.jsx)(f,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,D.jsx)(`span`,{className:`flex-1 text-sm font-medium text-foreground`,children:e}),r]}),i?(0,D.jsx)(`div`,{className:`border-t border-border/60 px-4 py-3`,children:t}):null]})}function N(){let{prDeliveryId:e}=r(),{t}=a([`packet`,`common`]),n=i(),{activeProjectId:o}=v(),{act:d}=y(),{openTicketDetail:f}=l(),[h,b]=(0,w.useState)(null),[C,T]=(0,w.useState)(!0),[N,P]=(0,w.useState)(null),[F,I]=(0,w.useState)(null),[L,R]=(0,w.useState)(!1),[z,B]=(0,w.useState)(null),[V,H]=(0,w.useState)(``),[U,W]=(0,w.useState)(!1),[G,K]=(0,w.useState)(null),[q,J]=(0,w.useState)(!1),Y=(0,w.useCallback)(async()=>{if(!(!e||!o)){T(!0);try{let t=await fetch(`${_()}/rails/pr-deliveries/${e}/packet`);if(!t.ok){P(t.status===404?`notFound`:`loadFailed`),b(null);return}b(await t.json()),P(null)}catch{P(`loadFailed`)}finally{T(!1)}}},[e,o]);(0,w.useEffect)(()=>{Y()},[Y]);let X=h?.packet??null,Z=h?.acceptCapability??null,Q=(0,w.useMemo)(()=>{if(!X)return null;let e=m({decision:X.decision,ticketIds:X.ticketIds,prState:X.prUrl?`pr-created`:`none`,statusCode:X.statusCode,prUrl:X.prUrl,runIds:X.runIds});return E({decision:X.decision,presentation:e,prUrl:X.prUrl,canCreatePr:Z?.target===`create-pr`})},[X,Z]),$=(0,w.useCallback)(async e=>{if(!X||!Q)return;let t=ie(e,Q);if(t){B(null),I(e);try{let e=await d(X.railIndex,t,X.decision,X.prDeliveryId);e.ok?o&&re(o):B(e.status===409?`alreadyResolved`:`actionFailed`),await Y()}finally{I(null),R(!1)}}},[d,o,Y,X,Q]),ae=(0,w.useCallback)(async()=>{if(!(!X||!V.trim()||!o)){K(null),W(!0);try{let e=await fetch(`${_()}/rails/${X.railIndex}/launch`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({revisionOfDeliveryId:X.prDeliveryId,revisionNote:V.trim()})});if(!e.ok){let t=await e.json().catch(()=>null);K(t?.error===`invalid_revision_target`?`revisionStale`:`revisionFailed`);return}H(``),J(!1),await Y()}catch{K(`revisionFailed`)}finally{W(!1)}}},[o,Y,X,V]);if(C&&!X)return(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:[(0,D.jsx)(p,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}),t(`common:states.loading`)]});if(N||!X||!Q)return(0,D.jsxs)(`div`,{className:`mx-auto flex max-w-2xl flex-col items-center gap-4 p-10 text-center`,children:[(0,D.jsx)(g,{className:`size-6 text-accent-warning`,"aria-hidden":!0}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(N===`notFound`?`error.notFound`:`error.loadFailed`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>n(`/`),className:`rounded-md border border-border px-3 py-1.5 text-sm text-foreground hover:bg-surface`,children:t(`backToBoard`)})]});let oe=O.map(e=>({tier:e,items:X.proof.filter(t=>t.tier===e)})).filter(e=>e.items.length>0),se=X.cost.totalUsd===null?`—`:`${X.cost.estimated?`~`:``}$${X.cost.totalUsd.toFixed(2)}`;return(0,D.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 p-6`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>n(`/`),className:`flex w-fit items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,D.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),t(`backToBoard`)]}),(0,D.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-surface/60 p-5 shadow-sm`,children:[(0,D.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:t(X.headlineCode,{count:X.totalCount,succeeded:X.succeededCount,total:X.totalCount,defaultValue:X.headlineCode})}),(0,D.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[X.confidence?.overall!==null&&X.confidence?.overall!==void 0?(0,D.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-accent-info/30 bg-accent-info/10 px-2 py-0.5 text-accent-info`,title:t(`confidence.tooltip`),children:t(`confidence.pill`,{overall:X.confidence.overall})}):(0,D.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-border bg-background-deep/50 px-2 py-0.5 text-muted-foreground`,children:t(`confidence.unavailable`)}),(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,D.jsx)(S,{className:`size-3.5`,"aria-hidden":!0}),t(`cost.thisBuild`,{amount:se})]}),X.prUrl?(0,D.jsxs)(`a`,{href:X.prUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-accent-info hover:underline`,children:[(0,D.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),t(`openPr`,{number:X.prNumber??``})]}):null]}),Q.fineControlOnly?(0,D.jsx)(`p`,{className:`mt-4 rounded-md border border-accent-warning/30 bg-accent-warning/5 px-3 py-2 text-xs text-accent-warning`,children:t(`fineControlOnly`)}):Q.inFlight?(0,D.jsxs)(`p`,{className:`mt-4 flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,D.jsx)(p,{className:`size-4 animate-spin`,"aria-hidden":!0}),t(`stillWorking`)]}):Q.terminal?(0,D.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:t(`alreadyResolved`)}):(0,D.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[Q.verbs.includes(`accept`)?L?(0,D.jsxs)(`div`,{className:`flex w-full flex-col gap-2 rounded-md border border-destructive/40 bg-destructive/5 p-3`,children:[(0,D.jsx)(`p`,{className:`text-xs text-foreground`,children:t(`accept.irreversibleWarning`)}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>void $(`accept`),disabled:F!==null,className:`rounded-md bg-destructive px-3 py-1.5 text-sm font-medium text-white disabled:opacity-50`,"data-testid":`packet-accept-confirm`,children:t(`accept.irreversibleConfirm`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>R(!1),className:`rounded-md border border-border px-3 py-1.5 text-sm text-foreground`,children:t(`common:actions.cancel`)})]})]}):(0,D.jsxs)(`button`,{type:`button`,onClick:()=>{Q.requiresIrreversibleConfirm?R(!0):$(`accept`)},disabled:F!==null,className:`inline-flex items-center gap-1.5 rounded-md bg-accent-success px-3 py-1.5 text-sm font-medium text-white disabled:opacity-50`,"data-testid":`packet-accept`,children:[F===`accept`?(0,D.jsx)(p,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,D.jsx)(u,{className:`size-4`,"aria-hidden":!0}),t(`accept.${Q.acceptMeaning??`generic`}`)]}):null,Q.verbs.includes(`request-changes`)?(0,D.jsxs)(`button`,{type:`button`,onClick:()=>J(e=>!e),disabled:F!==null||U,"aria-expanded":q,className:`inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-sm text-foreground hover:bg-surface disabled:opacity-50`,"data-testid":`packet-request-changes`,children:[(0,D.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t(`requestChanges.label`)]}):null,Q.verbs.includes(`discard`)?(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void $(`discard`),disabled:F!==null,className:`inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-sm text-foreground hover:bg-surface disabled:opacity-50`,"data-testid":`packet-discard`,children:[F===`discard`?(0,D.jsx)(p,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,D.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t(`discard.label`)]}):null]}),z?(0,D.jsx)(`p`,{className:`mt-3 text-xs text-accent-warning`,children:t(`error.${z}`)}):null,q?(0,D.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 rounded-md border border-border/70 bg-background-deep/40 p-3`,children:[(0,D.jsx)(`label`,{htmlFor:`packet-revision-note`,className:`text-xs font-medium text-foreground`,children:t(`requestChanges.prompt`)}),(0,D.jsx)(`textarea`,{id:`packet-revision-note`,value:V,onChange:e=>H(e.target.value),rows:2,placeholder:t(`requestChanges.placeholder`),className:`resize-y rounded-md border border-border bg-surface px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground`,"data-testid":`packet-revision-input`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void ae(),disabled:U||V.trim().length===0,className:`inline-flex items-center gap-1.5 rounded-md bg-accent-primary px-3 py-1.5 text-sm font-medium text-white disabled:opacity-50`,"data-testid":`packet-revision-submit`,children:[U?(0,D.jsx)(p,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,D.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),t(`requestChanges.submit`)]}),(0,D.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`requestChanges.hint`)})]}),G?(0,D.jsx)(`p`,{className:`text-xs text-accent-warning`,children:t(`error.${G}`)}):null]}):null]}),X.driftNudges.length>0?(0,D.jsxs)(`div`,{className:`rounded-lg border border-accent-highlight/30 bg-accent-highlight/5 p-4`,"data-testid":`packet-drift-nudges`,children:[(0,D.jsx)(`h2`,{className:`mb-1 text-sm font-medium text-accent-highlight`,children:t(`drift.title`)}),(0,D.jsx)(`ul`,{className:`space-y-1 text-xs text-foreground`,children:X.driftNudges.map(e=>(0,D.jsx)(`li`,{children:t(e.code,{...e.values,defaultValue:e.code})},e.code))}),(0,D.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:t(`drift.advisory`)})]}):null,X.versions.length>1?(0,D.jsxs)(M,{title:t(`versions.title`,{count:X.versions.length}),badge:(0,D.jsx)(x,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),children:[(0,D.jsx)(`ol`,{className:`space-y-2`,"data-testid":`packet-versions`,children:X.versions.map(e=>(0,D.jsxs)(`li`,{className:`flex flex-col gap-0.5 text-sm`,children:[(0,D.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:e.current?`font-medium text-foreground`:`text-muted-foreground`,children:t(`versions.label`,{version:e.version})}),e.current?(0,D.jsx)(`span`,{className:`rounded-full border border-accent-primary/40 bg-accent-primary/10 px-1.5 text-[10px] text-accent-primary`,children:t(`versions.current`)}):null,(0,D.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.costUsd===null?`—`:`${e.costEstimated?`~`:``}$${e.costUsd.toFixed(2)}`})]}),(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.revisionNote??t(`versions.originalBuild`)})]},e.prDeliveryId))}),(0,D.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:t(`cost.allVersions`,{amount:X.chainCostUsd===null?`—`:`${X.chainCostEstimated?`~`:``}$${X.chainCostUsd.toFixed(2)}`})})]}):null,X.watchOut.length>0?(0,D.jsxs)(`div`,{className:`rounded-lg border border-accent-warning/30 bg-accent-warning/5 p-4`,children:[(0,D.jsxs)(`h2`,{className:`mb-2 flex items-center gap-1.5 text-sm font-medium text-accent-warning`,children:[(0,D.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t(`watchOut.title`)]}),(0,D.jsx)(`ul`,{className:`space-y-1`,children:X.watchOut.map((e,t)=>(0,D.jsx)(j,{item:e},`${e.code}-${t}`))})]}):null,(0,D.jsx)(M,{title:t(`sections.whatYouAsked`),defaultOpen:!0,children:(0,D.jsx)(`ul`,{className:`space-y-3`,children:X.sections.map(e=>(0,D.jsxs)(`li`,{className:`text-sm`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>f(e.ticketId),className:`text-accent-primary hover:underline`,children:[`#`,e.ticketId,` `,e.title??``]}),e.problem?(0,D.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:e.problem}):null]},e.ticketId))})}),(0,D.jsx)(M,{title:t(`sections.whatIDid`),children:(0,D.jsx)(`ul`,{className:`space-y-3`,children:X.sections.map(e=>(0,D.jsxs)(`li`,{className:`text-sm`,children:[(0,D.jsxs)(`span`,{className:`font-medium text-foreground`,children:[`#`,e.ticketId]}),` `,e.solution??(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:t(`noSolutionRecorded`)}),e.churn?(0,D.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t(`churn.line`,{files:e.churn.filesTouched,added:e.churn.addedLines,removed:e.churn.removedLines})}):(0,D.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t(`churn.batchNotSplittable`)})]},e.ticketId))})}),(0,D.jsx)(M,{title:t(`sections.howItWasChecked`),badge:X.evidenceUnavailable?(0,D.jsx)(`span`,{className:`rounded-full border border-border bg-background-deep/50 px-2 py-0.5 text-[10px] text-muted-foreground`,children:t(`proof.evidenceUnavailable`)}):void 0,children:(0,D.jsx)(`div`,{className:`space-y-4`,children:oe.map(({tier:e,items:n})=>{let r=k[e];return(0,D.jsxs)(`div`,{className:`rounded-md border px-3 py-2 ${A[e]}`,children:[(0,D.jsxs)(`h3`,{className:`mb-1 flex items-center gap-1.5 text-xs font-medium`,children:[(0,D.jsx)(r,{className:`size-3.5`,"aria-hidden":!0}),t(`tier.${e}.title`)]}),(0,D.jsx)(`p`,{className:`mb-2 text-[11px] opacity-80`,children:t(`tier.${e}.caveat`)}),(0,D.jsx)(`ul`,{className:`space-y-1`,children:n.map((e,t)=>(0,D.jsx)(j,{item:e},`${e.code}-${t}`))})]},e)})})})]})}export{N as default};
1
+ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{d as r,u as i}from"./chunk-KS7C4IRE-DEKu087k.js";import{n as a,t as o}from"./createLucideIcon-Bjbbp_KS.js";import{n as s}from"./save-B6wGWwBR.js";import{$ as ee,Z as c,o as l}from"./TicketDetailModal-CsF-AWZX.js";import{d as u,u as d}from"./MinimizedChatsContext-Bd3OqR_S.js";import{t as te}from"./ban-E4EaZe3a.js";import{n as f}from"./file-text-BcLCfcWZ.js";import{t as p}from"./loader-circle-DcygOQpC.js";import{a as m,c as ne,t as re}from"./git-refresh-wTW0rO0Z.js";import{t as h}from"./sparkles-DrY8hb0X.js";import{t as g}from"./triangle-alert-H9T4jAmh.js";import{a as _,r as v}from"./useDesktop-BQVt8lFd.js";import{b as y,rt as b,vt as x}from"./index-DIhMEAVw.js";var S=o(`circle-dollar-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]),C=o(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),w=e(t(),1),T=(e={})=>({verbs:[],acceptMeaning:null,fineControlOnly:!1,inFlight:!1,terminal:!1,requiresIrreversibleConfirm:!1,...e});function E(e){let{decision:t,presentation:n,prUrl:r,canCreatePr:i}=e;if(t===`building`)return T({inFlight:!0});if(t===`merged`||t===`discarded`||n.superseded)return T({terminal:!0});if(n.manualRecovery||n.recoveryUnavailable||n.recoveryRecheck||n.retryablePush||n.retryablePrCreation||n.closed||n.deliveryBlocked&&!n.implementationFailed)return T({fineControlOnly:!0});if(n.noChanges)return T({verbs:[`accept`,`request-changes`],acceptMeaning:`mark-done`});if(n.implementationFailed)return T({verbs:n.succeededCount>0?[`request-changes`,`discard`]:[`discard`]});if(t===`pr_draft`)return T(r?{verbs:[`accept`,`request-changes`,`discard`],acceptMeaning:`publish`}:{fineControlOnly:!0});if(t===`pr_ready`)return T({verbs:[`request-changes`,`discard`]});if(t===`on_review`){let e=i?`create-pr`:`merge-local`;return T({verbs:[`accept`,`request-changes`,`discard`],acceptMeaning:e,requiresIrreversibleConfirm:e===`merge-local`})}return T({fineControlOnly:!0})}function ie(e,t){if(e===`discard`)return`discard`;if(e===`request-changes`)return null;switch(t.acceptMeaning){case`create-pr`:return`create-pr`;case`publish`:return`publish`;case`merge-local`:return`merge-local`;case`mark-done`:return`acknowledge-no-changes`;default:return null}}var D=n(),O=[`app-verified`,`ai-reported`,`reviewer-score`],k={"app-verified":b,"ai-reported":h,"reviewer-score":C},A={"app-verified":`text-accent-success border-accent-success/30 bg-accent-success/5`,"ai-reported":`text-accent-highlight border-accent-highlight/30 bg-accent-highlight/5`,"reviewer-score":`text-accent-info border-accent-info/30 bg-accent-info/5`};function j({item:e}){let{t}=a(`packet`);return(0,D.jsxs)(`li`,{className:`flex flex-col gap-1 py-1.5`,children:[(0,D.jsx)(`span`,{className:`text-sm text-foreground`,children:t(e.code,{...e.values??{},defaultValue:e.code})}),e.rawExcerpt?(0,D.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded border border-border/60 bg-background-deep/60 p-2 text-[11px] leading-relaxed text-muted-foreground whitespace-pre-wrap`,children:e.rawExcerpt}):null]})}function M({title:e,children:t,defaultOpen:n=!1,badge:r}){let[i,a]=(0,w.useState)(n);return(0,D.jsxs)(`div`,{className:`rounded-lg border border-border/60 bg-surface/40`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-center gap-2 px-4 py-3 text-left`,"aria-expanded":i,children:[i?(0,D.jsx)(d,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}):(0,D.jsx)(f,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,D.jsx)(`span`,{className:`flex-1 text-sm font-medium text-foreground`,children:e}),r]}),i?(0,D.jsx)(`div`,{className:`border-t border-border/60 px-4 py-3`,children:t}):null]})}function N(){let{prDeliveryId:e}=r(),{t}=a([`packet`,`common`]),n=i(),{activeProjectId:o}=v(),{act:d}=y(),{openTicketDetail:f}=l(),[h,b]=(0,w.useState)(null),[C,T]=(0,w.useState)(!0),[N,P]=(0,w.useState)(null),[F,I]=(0,w.useState)(null),[L,R]=(0,w.useState)(!1),[z,B]=(0,w.useState)(null),[V,H]=(0,w.useState)(``),[U,W]=(0,w.useState)(!1),[G,K]=(0,w.useState)(null),[q,J]=(0,w.useState)(!1),Y=(0,w.useCallback)(async()=>{if(!(!e||!o)){T(!0);try{let t=await fetch(`${_()}/rails/pr-deliveries/${e}/packet`);if(!t.ok){P(t.status===404?`notFound`:`loadFailed`),b(null);return}b(await t.json()),P(null)}catch{P(`loadFailed`)}finally{T(!1)}}},[e,o]);(0,w.useEffect)(()=>{Y()},[Y]);let X=h?.packet??null,Z=h?.acceptCapability??null,Q=(0,w.useMemo)(()=>{if(!X)return null;let e=m({decision:X.decision,ticketIds:X.ticketIds,prState:X.prUrl?`pr-created`:`none`,statusCode:X.statusCode,prUrl:X.prUrl,runIds:X.runIds});return E({decision:X.decision,presentation:e,prUrl:X.prUrl,canCreatePr:Z?.target===`create-pr`})},[X,Z]),$=(0,w.useCallback)(async e=>{if(!X||!Q)return;let t=ie(e,Q);if(t){B(null),I(e);try{let e=await d(X.railIndex,t,X.decision,X.prDeliveryId);e.ok?o&&re(o):B(e.status===409?`alreadyResolved`:`actionFailed`),await Y()}finally{I(null),R(!1)}}},[d,o,Y,X,Q]),ae=(0,w.useCallback)(async()=>{if(!(!X||!V.trim()||!o)){K(null),W(!0);try{let e=await fetch(`${_()}/rails/${X.railIndex}/launch`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({revisionOfDeliveryId:X.prDeliveryId,revisionNote:V.trim()})});if(!e.ok){let t=await e.json().catch(()=>null);K(t?.error===`invalid_revision_target`?`revisionStale`:`revisionFailed`);return}H(``),J(!1),await Y()}catch{K(`revisionFailed`)}finally{W(!1)}}},[o,Y,X,V]);if(C&&!X)return(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:[(0,D.jsx)(p,{className:`mr-2 size-4 animate-spin`,"aria-hidden":!0}),t(`common:states.loading`)]});if(N||!X||!Q)return(0,D.jsxs)(`div`,{className:`mx-auto flex max-w-2xl flex-col items-center gap-4 p-10 text-center`,children:[(0,D.jsx)(g,{className:`size-6 text-accent-warning`,"aria-hidden":!0}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(N===`notFound`?`error.notFound`:`error.loadFailed`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>n(`/`),className:`rounded-md border border-border px-3 py-1.5 text-sm text-foreground hover:bg-surface`,children:t(`backToBoard`)})]});let oe=O.map(e=>({tier:e,items:X.proof.filter(t=>t.tier===e)})).filter(e=>e.items.length>0),se=X.cost.totalUsd===null?`—`:`${X.cost.estimated?`~`:``}$${X.cost.totalUsd.toFixed(2)}`;return(0,D.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 p-6`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>n(`/`),className:`flex w-fit items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,D.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),t(`backToBoard`)]}),(0,D.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-surface/60 p-5 shadow-sm`,children:[(0,D.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:t(X.headlineCode,{count:X.totalCount,succeeded:X.succeededCount,total:X.totalCount,defaultValue:X.headlineCode})}),(0,D.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[X.confidence?.overall!==null&&X.confidence?.overall!==void 0?(0,D.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-accent-info/30 bg-accent-info/10 px-2 py-0.5 text-accent-info`,title:t(`confidence.tooltip`),children:t(`confidence.pill`,{overall:X.confidence.overall})}):(0,D.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-border bg-background-deep/50 px-2 py-0.5 text-muted-foreground`,children:t(`confidence.unavailable`)}),(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,D.jsx)(S,{className:`size-3.5`,"aria-hidden":!0}),t(`cost.thisBuild`,{amount:se})]}),X.prUrl?(0,D.jsxs)(`a`,{href:X.prUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-accent-info hover:underline`,children:[(0,D.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),t(`openPr`,{number:X.prNumber??``})]}):null]}),Q.fineControlOnly?(0,D.jsx)(`p`,{className:`mt-4 rounded-md border border-accent-warning/30 bg-accent-warning/5 px-3 py-2 text-xs text-accent-warning`,children:t(`fineControlOnly`)}):Q.inFlight?(0,D.jsxs)(`p`,{className:`mt-4 flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,D.jsx)(p,{className:`size-4 animate-spin`,"aria-hidden":!0}),t(`stillWorking`)]}):Q.terminal?(0,D.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:t(`alreadyResolved`)}):(0,D.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[Q.verbs.includes(`accept`)?L?(0,D.jsxs)(`div`,{className:`flex w-full flex-col gap-2 rounded-md border border-destructive/40 bg-destructive/5 p-3`,children:[(0,D.jsx)(`p`,{className:`text-xs text-foreground`,children:t(`accept.irreversibleWarning`)}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>void $(`accept`),disabled:F!==null,className:`rounded-md bg-destructive px-3 py-1.5 text-sm font-medium text-white disabled:opacity-50`,"data-testid":`packet-accept-confirm`,children:t(`accept.irreversibleConfirm`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>R(!1),className:`rounded-md border border-border px-3 py-1.5 text-sm text-foreground`,children:t(`common:actions.cancel`)})]})]}):(0,D.jsxs)(`button`,{type:`button`,onClick:()=>{Q.requiresIrreversibleConfirm?R(!0):$(`accept`)},disabled:F!==null,className:`inline-flex items-center gap-1.5 rounded-md bg-accent-success px-3 py-1.5 text-sm font-medium text-white disabled:opacity-50`,"data-testid":`packet-accept`,children:[F===`accept`?(0,D.jsx)(p,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,D.jsx)(u,{className:`size-4`,"aria-hidden":!0}),t(`accept.${Q.acceptMeaning??`generic`}`)]}):null,Q.verbs.includes(`request-changes`)?(0,D.jsxs)(`button`,{type:`button`,onClick:()=>J(e=>!e),disabled:F!==null||U,"aria-expanded":q,className:`inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-sm text-foreground hover:bg-surface disabled:opacity-50`,"data-testid":`packet-request-changes`,children:[(0,D.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t(`requestChanges.label`)]}):null,Q.verbs.includes(`discard`)?(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void $(`discard`),disabled:F!==null,className:`inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-sm text-foreground hover:bg-surface disabled:opacity-50`,"data-testid":`packet-discard`,children:[F===`discard`?(0,D.jsx)(p,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,D.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t(`discard.label`)]}):null]}),z?(0,D.jsx)(`p`,{className:`mt-3 text-xs text-accent-warning`,children:t(`error.${z}`)}):null,q?(0,D.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 rounded-md border border-border/70 bg-background-deep/40 p-3`,children:[(0,D.jsx)(`label`,{htmlFor:`packet-revision-note`,className:`text-xs font-medium text-foreground`,children:t(`requestChanges.prompt`)}),(0,D.jsx)(`textarea`,{id:`packet-revision-note`,value:V,onChange:e=>H(e.target.value),rows:2,placeholder:t(`requestChanges.placeholder`),className:`resize-y rounded-md border border-border bg-surface px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground`,"data-testid":`packet-revision-input`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void ae(),disabled:U||V.trim().length===0,className:`inline-flex items-center gap-1.5 rounded-md bg-accent-primary px-3 py-1.5 text-sm font-medium text-white disabled:opacity-50`,"data-testid":`packet-revision-submit`,children:[U?(0,D.jsx)(p,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,D.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),t(`requestChanges.submit`)]}),(0,D.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`requestChanges.hint`)})]}),G?(0,D.jsx)(`p`,{className:`text-xs text-accent-warning`,children:t(`error.${G}`)}):null]}):null]}),X.driftNudges.length>0?(0,D.jsxs)(`div`,{className:`rounded-lg border border-accent-highlight/30 bg-accent-highlight/5 p-4`,"data-testid":`packet-drift-nudges`,children:[(0,D.jsx)(`h2`,{className:`mb-1 text-sm font-medium text-accent-highlight`,children:t(`drift.title`)}),(0,D.jsx)(`ul`,{className:`space-y-1 text-xs text-foreground`,children:X.driftNudges.map(e=>(0,D.jsx)(`li`,{children:t(e.code,{...e.values,defaultValue:e.code})},e.code))}),(0,D.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:t(`drift.advisory`)})]}):null,X.versions.length>1?(0,D.jsxs)(M,{title:t(`versions.title`,{count:X.versions.length}),badge:(0,D.jsx)(x,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),children:[(0,D.jsx)(`ol`,{className:`space-y-2`,"data-testid":`packet-versions`,children:X.versions.map(e=>(0,D.jsxs)(`li`,{className:`flex flex-col gap-0.5 text-sm`,children:[(0,D.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:e.current?`font-medium text-foreground`:`text-muted-foreground`,children:t(`versions.label`,{version:e.version})}),e.current?(0,D.jsx)(`span`,{className:`rounded-full border border-accent-primary/40 bg-accent-primary/10 px-1.5 text-[10px] text-accent-primary`,children:t(`versions.current`)}):null,(0,D.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.costUsd===null?`—`:`${e.costEstimated?`~`:``}$${e.costUsd.toFixed(2)}`})]}),(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.revisionNote??t(`versions.originalBuild`)})]},e.prDeliveryId))}),(0,D.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:t(`cost.allVersions`,{amount:X.chainCostUsd===null?`—`:`${X.chainCostEstimated?`~`:``}$${X.chainCostUsd.toFixed(2)}`})})]}):null,X.watchOut.length>0?(0,D.jsxs)(`div`,{className:`rounded-lg border border-accent-warning/30 bg-accent-warning/5 p-4`,children:[(0,D.jsxs)(`h2`,{className:`mb-2 flex items-center gap-1.5 text-sm font-medium text-accent-warning`,children:[(0,D.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t(`watchOut.title`)]}),(0,D.jsx)(`ul`,{className:`space-y-1`,children:X.watchOut.map((e,t)=>(0,D.jsx)(j,{item:e},`${e.code}-${t}`))})]}):null,(0,D.jsx)(M,{title:t(`sections.whatYouAsked`),defaultOpen:!0,children:(0,D.jsx)(`ul`,{className:`space-y-3`,children:X.sections.map(e=>(0,D.jsxs)(`li`,{className:`text-sm`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>f(e.ticketId),className:`text-accent-primary hover:underline`,children:[`#`,e.ticketId,` `,e.title??``]}),e.problem?(0,D.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:e.problem}):null]},e.ticketId))})}),(0,D.jsx)(M,{title:t(`sections.whatIDid`),children:(0,D.jsx)(`ul`,{className:`space-y-3`,children:X.sections.map(e=>(0,D.jsxs)(`li`,{className:`text-sm`,children:[(0,D.jsxs)(`span`,{className:`font-medium text-foreground`,children:[`#`,e.ticketId]}),` `,e.solution??(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:t(`noSolutionRecorded`)}),e.churn?(0,D.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t(`churn.line`,{files:e.churn.filesTouched,added:e.churn.addedLines,removed:e.churn.removedLines})}):(0,D.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t(`churn.batchNotSplittable`)})]},e.ticketId))})}),(0,D.jsx)(M,{title:t(`sections.howItWasChecked`),badge:X.evidenceUnavailable?(0,D.jsx)(`span`,{className:`rounded-full border border-border bg-background-deep/50 px-2 py-0.5 text-[10px] text-muted-foreground`,children:t(`proof.evidenceUnavailable`)}):void 0,children:(0,D.jsx)(`div`,{className:`space-y-4`,children:oe.map(({tier:e,items:n})=>{let r=k[e];return(0,D.jsxs)(`div`,{className:`rounded-md border px-3 py-2 ${A[e]}`,children:[(0,D.jsxs)(`h3`,{className:`mb-1 flex items-center gap-1.5 text-xs font-medium`,children:[(0,D.jsx)(r,{className:`size-3.5`,"aria-hidden":!0}),t(`tier.${e}.title`)]}),(0,D.jsx)(`p`,{className:`mb-2 text-[11px] opacity-80`,children:t(`tier.${e}.caveat`)}),(0,D.jsx)(`ul`,{className:`space-y-1`,children:n.map((e,t)=>(0,D.jsx)(j,{item:e},`${e.code}-${t}`))})]},e)})})})]})}export{N as default};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-zu2_FqZY.js";import{n as t}from"./createLucideIcon-Bjbbp_KS.js";import{t as n}from"./brain-DI9lHkKY.js";import{t as r}from"./download-CFHyyHcw.js";import{t as i}from"./git-branch-BRM0F5GN.js";import{t as a}from"./play-DNlrawbS.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./dialog-CdWCb02j.js";import{t as f}from"./button-CJqFnUOL.js";import{Q as p,Tt as m,et as h,w as g}from"./index-DhjjFyU5.js";var _=e(),v={start:a,"ai-step":n,shell:p,decider:i,condition:i,end:h};function y(e){return e.type===`ai-step`?typeof e.data?.prompt==`string`?e.data.prompt:null:e.type===`shell`?typeof e.data?.command==`string`?e.data.command:null:e.type===`decider`?typeof e.data?.goal==`string`?e.data.goal:null:e.type===`end`?e.data?.outcome===`failure`?`failure`:`success`:null}function b({template:e,onClose:i,onUse:a,mode:p=`use`}){let{t:b}=t(`loops`);return(0,_.jsx)(d,{open:e!==null,onOpenChange:e=>{e||i()},children:(0,_.jsx)(c,{movableResizable:!0,className:`max-w-lg`,children:e&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(o,{children:[(0,_.jsxs)(l,{className:`flex items-center gap-2`,children:[(0,_.jsx)(n,{className:`w-4 h-4 text-accent-highlight`}),e.name]}),(0,_.jsx)(u,{children:e.description})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[g(e.graph)?(0,_.jsx)(`span`,{title:b(`gallery.needsSpecHint`),className:`px-1.5 py-0.5 rounded text-[10px] bg-accent-secondary/15 text-accent-secondary`,children:b(`gallery.needsSpec`)}):(0,_.jsx)(`span`,{title:b(`gallery.standaloneHint`),className:`px-1.5 py-0.5 rounded text-[10px] bg-accent-success/15 text-accent-success`,children:b(`gallery.standalone`)}),e.category&&(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-accent-info/15 text-accent-info`,children:b(`categories.${e.category}`,{defaultValue:e.category})}),e.tags.map(e=>(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))]}),(0,_.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.graph.config.timeoutMinutes>0?b(`preview.limits`,{iterations:e.graph.config.maxIterations,timeout:e.graph.config.timeoutMinutes}):b(`preview.limitsNoTimeout`,{iterations:e.graph.config.maxIterations})}),(0,_.jsxs)(`div`,{className:`max-h-[50vh] overflow-y-auto space-y-1.5 pr-1`,children:[(0,_.jsx)(`span`,{className:`block text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:b(`preview.steps`)}),e.graph.nodes.map((e,t)=>{let n=v[e.type]??h,r=y(e);return(0,_.jsxs)(`div`,{className:`rounded border border-border bg-surface/30 p-2`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,_.jsxs)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[t+1,`.`]}),(0,_.jsx)(n,{className:`w-3.5 h-3.5 text-accent-primary`}),b(`builder.nodes.${e.type}`)]}),r&&(0,_.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words text-[11px] text-muted-foreground font-mono`,children:r})]},e.id)})]}),(0,_.jsxs)(s,{children:[(0,_.jsx)(f,{variant:`ghost`,onClick:i,children:b(`common:actions.cancel`)}),(0,_.jsxs)(f,{onClick:()=>a(e.id),children:[p===`fork`?(0,_.jsx)(m,{className:`w-3.5 h-3.5 mr-1.5`}):(0,_.jsx)(r,{className:`w-3.5 h-3.5 mr-1.5`}),b(p===`fork`?`actions.fork`:`actions.use`)]})]})]})})})}export{b as n,y as r,v as t};
1
+ import{t as e}from"./jsx-runtime-zu2_FqZY.js";import{n as t}from"./createLucideIcon-Bjbbp_KS.js";import{t as n}from"./brain-DI9lHkKY.js";import{t as r}from"./download-CFHyyHcw.js";import{t as i}from"./git-branch-BRM0F5GN.js";import{t as a}from"./play-DNlrawbS.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./dialog-CdWCb02j.js";import{t as f}from"./button-CJqFnUOL.js";import{Q as p,Tt as m,et as h,w as g}from"./index-DIhMEAVw.js";var _=e(),v={start:a,"ai-step":n,shell:p,decider:i,condition:i,end:h};function y(e){return e.type===`ai-step`?typeof e.data?.prompt==`string`?e.data.prompt:null:e.type===`shell`?typeof e.data?.command==`string`?e.data.command:null:e.type===`decider`?typeof e.data?.goal==`string`?e.data.goal:null:e.type===`end`?e.data?.outcome===`failure`?`failure`:`success`:null}function b({template:e,onClose:i,onUse:a,mode:p=`use`}){let{t:b}=t(`loops`);return(0,_.jsx)(d,{open:e!==null,onOpenChange:e=>{e||i()},children:(0,_.jsx)(c,{movableResizable:!0,className:`max-w-lg`,children:e&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(o,{children:[(0,_.jsxs)(l,{className:`flex items-center gap-2`,children:[(0,_.jsx)(n,{className:`w-4 h-4 text-accent-highlight`}),e.name]}),(0,_.jsx)(u,{children:e.description})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[g(e.graph)?(0,_.jsx)(`span`,{title:b(`gallery.needsSpecHint`),className:`px-1.5 py-0.5 rounded text-[10px] bg-accent-secondary/15 text-accent-secondary`,children:b(`gallery.needsSpec`)}):(0,_.jsx)(`span`,{title:b(`gallery.standaloneHint`),className:`px-1.5 py-0.5 rounded text-[10px] bg-accent-success/15 text-accent-success`,children:b(`gallery.standalone`)}),e.category&&(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-accent-info/15 text-accent-info`,children:b(`categories.${e.category}`,{defaultValue:e.category})}),e.tags.map(e=>(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))]}),(0,_.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.graph.config.timeoutMinutes>0?b(`preview.limits`,{iterations:e.graph.config.maxIterations,timeout:e.graph.config.timeoutMinutes}):b(`preview.limitsNoTimeout`,{iterations:e.graph.config.maxIterations})}),(0,_.jsxs)(`div`,{className:`max-h-[50vh] overflow-y-auto space-y-1.5 pr-1`,children:[(0,_.jsx)(`span`,{className:`block text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:b(`preview.steps`)}),e.graph.nodes.map((e,t)=>{let n=v[e.type]??h,r=y(e);return(0,_.jsxs)(`div`,{className:`rounded border border-border bg-surface/30 p-2`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,_.jsxs)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[t+1,`.`]}),(0,_.jsx)(n,{className:`w-3.5 h-3.5 text-accent-primary`}),b(`builder.nodes.${e.type}`)]}),r&&(0,_.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words text-[11px] text-muted-foreground font-mono`,children:r})]},e.id)})]}),(0,_.jsxs)(s,{children:[(0,_.jsx)(f,{variant:`ghost`,onClick:i,children:b(`common:actions.cancel`)}),(0,_.jsxs)(f,{onClick:()=>a(e.id),children:[p===`fork`?(0,_.jsx)(m,{className:`w-3.5 h-3.5 mr-1.5`}):(0,_.jsx)(r,{className:`w-3.5 h-3.5 mr-1.5`}),b(p===`fork`?`actions.fork`:`actions.use`)]})]})]})})})}export{b as n,y as r,v as t};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-js-Rlh4FLH5.js","assets/core-B3mKBIh5.js","assets/rolldown-runtime-CNC7AqOf.js","assets/event-Bt7f3wXe.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{t as r}from"./react-dom-DiWzBDP9.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{u as a}from"./chunk-KS7C4IRE-DEKu087k.js";import{_ as o,a as s,f as c,h as l,o as u,v as d,w as f}from"./i18n-DwgvwTnx.js";import{t as p}from"./Trans-DXZ-BLXb.js";import{n as m,t as h}from"./createLucideIcon-Bjbbp_KS.js";import{n as g}from"./dist-bVqfYmby.js";import{n as _,t as v}from"./save-B6wGWwBR.js";import{c as y,d as b,f as x,n as S}from"./MinimizedChatsContext-CcjBHMHd.js";import{t as C}from"./file-text-BcLCfcWZ.js";import{t as w}from"./circle-x-CMYsN4ZH.js";import{t as T}from"./download-CFHyyHcw.js";import{t as ee}from"./git-branch-BRM0F5GN.js";import{t as te}from"./loader-circle-DcygOQpC.js";import{t as ne}from"./pencil-C9RkrIPZ.js";import{t as E}from"./play-DNlrawbS.js";import{t as re}from"./plus-CsnjfkmX.js";import{t as ie}from"./search-Cq_gE3Ik.js";import{t as ae}from"./trash-2-BOU3WdZZ.js";import{t as D}from"./triangle-alert-H9T4jAmh.js";import{n as oe,t as se}from"./jira-api-CcZMcEN5.js";import{t as ce}from"./x-CBMI9ejn.js";import{t as O}from"./zap-CHo3aCD1.js";import{a as k,n as A}from"./auth-D_5bQv5W.js";import{a as j,r as M}from"./useDesktop-BzX769yH.js";import{a as le,c as ue,i as de,n as fe,o as pe,r as me,s as he,t as ge}from"./dialog-CdWCb02j.js";import{t as N}from"./button-CJqFnUOL.js";import{t as P}from"./utils-BC4DHlz2.js";import{n as _e}from"./provider-capabilities-Doej9lfa.js";import{n as ve,t as F}from"./lib-CGdyxIWg.js";import{t as ye}from"./formatDistanceToNow-C0ImhVKp.js";import{n as be}from"./spending-BQX3P7Cq.js";var xe=h(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Se=h(`circle-arrow-right`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m12 16 4-4-4-4`,key:`1i9zcv`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),I=h(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ce=h(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),we=h(`file-minus-corner`,[[`path`,{d:`M20 14V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12`,key:`l9p8hp`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Te=h(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),Ee=h(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),De=h(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),L=h(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Oe=h(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),ke=h(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Ae=h(`split`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),R=h(`ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),je=h(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Me=h(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),z=new Map,Ne=2e3;function B(e){z.set(e,(z.get(e)??0)+1)}function Pe(e){(z.get(e)??0)<=0||setTimeout(()=>{let t=(z.get(e)??0)-1;t<=0?z.delete(e):z.set(e,t)},Ne)}function Fe(e){return e?(z.get(e)??0)>0:!1}var V=e(t(),1),Ie=3e3,Le=`
2
+ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{t as r}from"./react-dom-DiWzBDP9.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{u as a}from"./chunk-KS7C4IRE-DEKu087k.js";import{_ as o,a as s,f as c,h as l,o as u,v as d,w as f}from"./i18n-hnX2DPmo.js";import{t as p}from"./Trans-Bsz9_gyq.js";import{n as m,t as h}from"./createLucideIcon-Bjbbp_KS.js";import{n as g}from"./dist-bVqfYmby.js";import{n as _,t as v}from"./save-B6wGWwBR.js";import{c as y,d as b,f as x,n as S}from"./MinimizedChatsContext-Bd3OqR_S.js";import{t as C}from"./file-text-BcLCfcWZ.js";import{t as w}from"./circle-x-CMYsN4ZH.js";import{t as T}from"./download-CFHyyHcw.js";import{t as ee}from"./git-branch-BRM0F5GN.js";import{t as te}from"./loader-circle-DcygOQpC.js";import{t as ne}from"./pencil-C9RkrIPZ.js";import{t as E}from"./play-DNlrawbS.js";import{t as re}from"./plus-CsnjfkmX.js";import{t as ie}from"./search-Cq_gE3Ik.js";import{t as ae}from"./trash-2-BOU3WdZZ.js";import{t as D}from"./triangle-alert-H9T4jAmh.js";import{n as oe,t as se}from"./jira-api-B1-MUehg.js";import{t as ce}from"./x-CBMI9ejn.js";import{t as O}from"./zap-CHo3aCD1.js";import{a as k,n as A}from"./auth-D_5bQv5W.js";import{a as j,r as M}from"./useDesktop-BQVt8lFd.js";import{a as le,c as ue,i as de,n as fe,o as pe,r as me,s as he,t as ge}from"./dialog-CdWCb02j.js";import{t as N}from"./button-CJqFnUOL.js";import{t as P}from"./utils-BC4DHlz2.js";import{n as _e}from"./provider-capabilities-Doej9lfa.js";import{n as ve,t as F}from"./lib-CGdyxIWg.js";import{t as ye}from"./formatDistanceToNow-DQCvMgUc.js";import{n as be}from"./spending-EC9xqio-.js";var xe=h(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Se=h(`circle-arrow-right`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m12 16 4-4-4-4`,key:`1i9zcv`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),I=h(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ce=h(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),we=h(`file-minus-corner`,[[`path`,{d:`M20 14V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12`,key:`l9p8hp`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Te=h(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),Ee=h(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),De=h(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),L=h(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Oe=h(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),ke=h(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Ae=h(`split`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),R=h(`ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),je=h(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Me=h(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),z=new Map,Ne=2e3;function B(e){z.set(e,(z.get(e)??0)+1)}function Pe(e){(z.get(e)??0)<=0||setTimeout(()=>{let t=(z.get(e)??0)-1;t<=0?z.delete(e):z.set(e,t)},Ne)}function Fe(e){return e?(z.get(e)??0)>0:!1}var V=e(t(),1),Ie=3e3,Le=`
3
3
 
4
4
  ---
5
5
 
@@ -1 +1 @@
1
- import{a as e,t}from"./rolldown-runtime-CNC7AqOf.js";import{n}from"./jsx-runtime-zu2_FqZY.js";import{T as r}from"./i18n-DwgvwTnx.js";import{a as i,d as a,f as o,i as s,l as c,p as l,s as u,u as d}from"./createLucideIcon-Bjbbp_KS.js";var f=t(((e,t)=>{t.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}})),p=e(n()),m=e(f()),h=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function g(e){var t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(m.default[n[1]]||e.charAt(e.length-2)===`/`)&&(t.voidElement=!0),t.name.startsWith(`!--`))){var r=e.indexOf(`-->`);return{type:`comment`,comment:r===-1?``:e.slice(4,r)}}for(var i=new RegExp(h),a=null;(a=i.exec(e))!==null;)if(a[0].trim())if(a[1]){var o=a[1].trim(),s=[o,``];o.indexOf(`=`)>-1&&(s=o.split(`=`)),t.attrs[s[0]]=s[1],i.lastIndex--}else a[2]&&(t.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return t}var _=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,v=/^\s*$/,y=Object.create(null);function b(e,t){switch(t.type){case`text`:return e+t.content;case`tag`:return e+=`<`+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+`="`+e[n]+`"`);return t.length?` `+t.join(` `):``}(t.attrs):``)+(t.voidElement?`/>`:`>`),t.voidElement?e:e+t.children.reduce(b,``)+`</`+t.name+`>`;case`comment`:return e+`<!--`+t.comment+`-->`}}var x={parse:function(e,t){t||={},t.components||=y;var n,r=[],i=[],a=-1,o=!1;if(e.indexOf(`<`)!==0){var s=e.indexOf(`<`);r.push({type:`text`,content:s===-1?e:e.substring(0,s)})}return e.replace(_,function(s,c){if(o){if(s!==`</`+n.name+`>`)return;o=!1}var l,u=s.charAt(1)!==`/`,d=s.startsWith(`<!--`),f=c+s.length,p=e.charAt(f);if(d){var m=g(s);return a<0?(r.push(m),r):((l=i[a]).children.push(m),r)}if(u&&(a++,(n=g(s)).type===`tag`&&t.components[n.name]&&(n.type=`component`,o=!0),n.voidElement||o||!p||p===`<`||n.children.push({type:`text`,content:e.slice(f,e.indexOf(`<`,f))}),a===0&&r.push(n),(l=i[a-1])&&l.children.push(n),i[a]=n),(!u||n.voidElement)&&(a>-1&&(n.voidElement||n.name===s.slice(2,-1))&&(a--,n=a===-1?r:i[a]),!o&&p!==`<`&&p)){l=a===-1?r:i[a].children;var h=e.indexOf(`<`,f),_=e.slice(f,h===-1?void 0:h);v.test(_)&&(_=` `),(h>-1&&a+l.length>=0||_!==` `)&&l.push({type:`text`,content:_})}}),r},stringify:function(e){return e.reduce(function(e,t){return e+b(``,t)},``)}},S=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},C=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?T(t):t},w=e=>Array.isArray(e)&&e.every(p.isValidElement),T=e=>Array.isArray(e)?e:[e],E=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},D=e=>{let t={};if(!e)return t;let n=e=>{T(e).forEach(e=>{a(e)||(S(e)?n(C(e)):d(e)&&!(0,p.isValidElement)(e)&&Object.assign(t,e))})};return n(e),t},O=(e,t,n,r)=>{if(!e)return``;let i=``,s=T(e),c=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return s.forEach((e,s)=>{if(a(e)){i+=`${e}`;return}if((0,p.isValidElement)(e)){let{props:o,type:l}=e,u=Object.keys(o).length,d=c.indexOf(l)>-1,f=o.children;if(!f&&d&&!u){i+=`<${l}/>`;return}if(!f&&(!d||u)||o.i18nIsDynamicList){i+=`<${s}></${s}>`;return}if(d&&u<=1){let e=a(f)?f:O(f,t,n,r);i+=`<${l}>${e}</${l}>`;return}let p=O(f,t,n,r);i+=`<${s}>${p}</${s}>`;return}if(e===null){o(n,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:r});return}if(d(e)){let{format:t,...a}=e,s=Object.keys(a);if(s.length===1){let e=t?`${s[0]}, ${t}`:s[0];i+=`{{${e}}}`;return}o(n,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:r,child:e});return}o(n,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:r,child:e})}),i},k=(e,t=[],n={})=>{if(!e)return e;let r=Object.keys(n),i=[...t,...r],a=``,o=0;for(;o<e.length;)if(e[o]===`<`){let t=!1,n=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(n){let e=n[1];(/^\d+$/.test(e)||i.includes(e))&&(t=!0,a+=n[0],o+=n[0].length)}if(!t){let n=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(n){let e=n[1];(/^\d+$/.test(e)||i.includes(e))&&(t=!0,a+=n[0],o+=n[0].length)}}t||(a+=`&lt;`,o+=1)}else a+=e[o],o+=1;return a},A=(e,t,n,r,i,o,s)=>{if(n===``)return[];let l=i.transKeepBasicHtmlNodesFor||[],f=n&&new RegExp(l.map(e=>`<${e}`).join(`|`)).test(n);if(!e&&!t&&!f&&!s)return[n];let m=t??{},h=e=>{T(e).forEach(e=>{a(e)||(S(e)?h(C(e)):d(e)&&!(0,p.isValidElement)(e)&&Object.assign(m,e))})};h(e);let g=k(n,l,m),_=x.parse(`<0>${g}</0>`),v={...m,...o},y=(e,t,n)=>{let r=C(e),i=D(r,t.children,n);return w(r)&&i.length===0||e.props?.i18nIsDynamicList?r:i},b=(e,t,n,r,i)=>{e.dummy?(e.children=t,n.push((0,p.cloneElement)(e,{key:r},i?void 0:t))):n.push(...p.Children.map([e],e=>{if(e.type===p.Fragment||e.props?.i18nIsDynamicList!==void 0){let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`children`||t===`i18nIsDynamicList`||(n[t]=e.props[t])}),(0,p.createElement)(e.type,n,i?null:t)}let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`ref`||t===`children`||(n[t]=e.props[t])}),(0,p.cloneElement)(e,n,i?null:t)}))},D=(e,n,o)=>{let m=T(e),h=T(n),g={};return h.reduce((e,n,h)=>{let _=n.children?.[0]?.content&&r.services.interpolator.interpolate(n.children[0].content,v,r.language);if(n.type===`tag`){let u=m[parseInt(n.name,10)];!u&&t&&(u=t[n.name]),o.length===1&&!u&&(u=o[0][n.name]),u||={};let x={...n.attrs};s&&Object.keys(x).forEach(e=>{let t=x[e];a(t)&&(x[e]=c(t))});let w=Object.keys(x).length===0?u:E({props:x},u),O=(0,p.isValidElement)(w),k=O&&S(n,!0)&&!n.voidElement,A=f&&d(w)&&w.dummy&&!O,j=d(t)&&Object.hasOwnProperty.call(t,n.name);if(a(w)){let t=r.services.interpolator.interpolate(w,v,r.language);e.push(t)}else if(S(w)||k){let t=y(w,n,o);b(w,t,e,h)}else if(A){let t=D(m,n.children,o);b(w,t,e,h)}else if(Number.isNaN(parseFloat(n.name)))if(j){let t=y(w,n,o);b(w,t,e,h,n.voidElement)}else if(i.transSupportBasicHtmlNodes&&l.indexOf(n.name)>-1)if(n.voidElement)e.push((0,p.createElement)(n.name,{key:`${n.name}-${h}`}));else{let t=g[n.name]||0;g[n.name]=t+1;let r,i=0;for(let e=0;e<m.length;e+=1){let a=m[e];if((0,p.isValidElement)(a)&&a.type===n.name){if(i===t){r=a;break}i+=1}}let a=r?T(C(r)):m,s=D(a,n.children,o);e.push((0,p.createElement)(n.name,{key:`${n.name}-${h}`},s))}else if(n.voidElement)e.push(`<${n.name} />`);else{let t=D(m,n.children,o);e.push(`<${n.name}>${t}</${n.name}>`)}else if(d(w)&&!O){let t=n.children[0]?_:null;t&&e.push(t)}else b(w,_,e,h,n.children.length!==1||!_)}else if(n.type===`text`){let t=i.transWrapTextNodes,a=typeof i.unescape==`function`?i.unescape:u().unescape,o=s?a(r.services.interpolator.interpolate(n.content,v,r.language)):r.services.interpolator.interpolate(n.content,v,r.language);t?e.push((0,p.createElement)(t,{key:`${n.name}-${h}`},o)):e.push(o)}return e},[])};return C(D([{dummy:!0,children:e||[]}],_,T(e||[]))[0])},j=(e,t,n)=>{let r=e.key||t,i=(0,p.cloneElement)(e,{key:r});if(!i.props||!i.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return i;function a(){return(0,p.createElement)(p.Fragment,null,i)}return(0,p.createElement)(a,{key:r})},M=(e,t)=>e.map((e,n)=>j(e,n,t)),N=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:j(e[r],r,t)})}),n},P=(e,t,n,r)=>e?Array.isArray(e)?M(e,t):d(e)?N(e,t):(l(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,F=e=>!d(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function I({children:e,count:t,parent:n,i18nKey:o,context:s,tOptions:c={},values:d,defaults:f,components:m,ns:h,i18n:g,t:_,shouldUnescape:v,...y}){let b=g||i();if(!b)return l(b,`NO_I18NEXT_INSTANCE`,`Trans: You need to pass in an i18next instance using i18nextReactModule`,{i18nKey:o}),e;let x=_||b.t.bind(b)||(e=>e),S={...u(),...b.options?.react},C=h||x.ns||b.options?.defaultNS;C=a(C)?[C]:C||[`translation`];let{transDefaultProps:w}=S,T=w?.tOptions?{...w.tOptions,...c}:c,E=v??w?.shouldUnescape,k=w?.values?{...w.values,...d}:d,j=w?.components?{...w.components,...m}:m,M=O(e,S,b,o),N=f||T?.defaultValue||M||S.transEmptyNodeValue||(typeof o==`function`?r(o):o),{hashTransKey:I}=S,L=o||(I?I(M||N):M||N);d=b.options?.interpolation?.defaultVariables?k&&Object.keys(k).length>0?{...k,...b.options.interpolation.defaultVariables}:{...b.options.interpolation.defaultVariables}:k;let R=D(e);R&&typeof R.count==`number`&&t===void 0&&(t=R.count);let z=d||t!==void 0&&!b.options?.interpolation?.alwaysFormat||!e?T.interpolation:{interpolation:{...T.interpolation,prefix:`#$?`,suffix:`?$#`}},B={...T,context:s||T.context,count:t,...d,...z,defaultValue:N,ns:C},V=L?x(L,B):N;V===L&&N&&(V=N);let H=P(j,V,b,o),U=H||e,W=null;F(H)&&(W=H,U=e);let G=A(U,W,V,b,S,B,E),K=n??S.defaultTransParent;return K?(0,p.createElement)(K,y,G):G}function L({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:o={},values:c,defaults:l,components:u,ns:d,i18n:f,t:m,shouldUnescape:h,...g}){let{i18n:_,defaultNS:v}=(0,p.useContext)(s)||{},y=f||_||i(),b=m||y?.t.bind(y);return I({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:o,values:c,defaults:l,components:u,ns:d||b?.ns||v||y?.options?.defaultNS,i18n:y,t:m,shouldUnescape:h,...g})}export{L as t};
1
+ import{a as e,t}from"./rolldown-runtime-CNC7AqOf.js";import{n}from"./jsx-runtime-zu2_FqZY.js";import{T as r}from"./i18n-hnX2DPmo.js";import{a as i,d as a,f as o,i as s,l as c,p as l,s as u,u as d}from"./createLucideIcon-Bjbbp_KS.js";var f=t(((e,t)=>{t.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}})),p=e(n()),m=e(f()),h=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function g(e){var t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(m.default[n[1]]||e.charAt(e.length-2)===`/`)&&(t.voidElement=!0),t.name.startsWith(`!--`))){var r=e.indexOf(`-->`);return{type:`comment`,comment:r===-1?``:e.slice(4,r)}}for(var i=new RegExp(h),a=null;(a=i.exec(e))!==null;)if(a[0].trim())if(a[1]){var o=a[1].trim(),s=[o,``];o.indexOf(`=`)>-1&&(s=o.split(`=`)),t.attrs[s[0]]=s[1],i.lastIndex--}else a[2]&&(t.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return t}var _=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,v=/^\s*$/,y=Object.create(null);function b(e,t){switch(t.type){case`text`:return e+t.content;case`tag`:return e+=`<`+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+`="`+e[n]+`"`);return t.length?` `+t.join(` `):``}(t.attrs):``)+(t.voidElement?`/>`:`>`),t.voidElement?e:e+t.children.reduce(b,``)+`</`+t.name+`>`;case`comment`:return e+`<!--`+t.comment+`-->`}}var x={parse:function(e,t){t||={},t.components||=y;var n,r=[],i=[],a=-1,o=!1;if(e.indexOf(`<`)!==0){var s=e.indexOf(`<`);r.push({type:`text`,content:s===-1?e:e.substring(0,s)})}return e.replace(_,function(s,c){if(o){if(s!==`</`+n.name+`>`)return;o=!1}var l,u=s.charAt(1)!==`/`,d=s.startsWith(`<!--`),f=c+s.length,p=e.charAt(f);if(d){var m=g(s);return a<0?(r.push(m),r):((l=i[a]).children.push(m),r)}if(u&&(a++,(n=g(s)).type===`tag`&&t.components[n.name]&&(n.type=`component`,o=!0),n.voidElement||o||!p||p===`<`||n.children.push({type:`text`,content:e.slice(f,e.indexOf(`<`,f))}),a===0&&r.push(n),(l=i[a-1])&&l.children.push(n),i[a]=n),(!u||n.voidElement)&&(a>-1&&(n.voidElement||n.name===s.slice(2,-1))&&(a--,n=a===-1?r:i[a]),!o&&p!==`<`&&p)){l=a===-1?r:i[a].children;var h=e.indexOf(`<`,f),_=e.slice(f,h===-1?void 0:h);v.test(_)&&(_=` `),(h>-1&&a+l.length>=0||_!==` `)&&l.push({type:`text`,content:_})}}),r},stringify:function(e){return e.reduce(function(e,t){return e+b(``,t)},``)}},S=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},C=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?T(t):t},w=e=>Array.isArray(e)&&e.every(p.isValidElement),T=e=>Array.isArray(e)?e:[e],E=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},D=e=>{let t={};if(!e)return t;let n=e=>{T(e).forEach(e=>{a(e)||(S(e)?n(C(e)):d(e)&&!(0,p.isValidElement)(e)&&Object.assign(t,e))})};return n(e),t},O=(e,t,n,r)=>{if(!e)return``;let i=``,s=T(e),c=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return s.forEach((e,s)=>{if(a(e)){i+=`${e}`;return}if((0,p.isValidElement)(e)){let{props:o,type:l}=e,u=Object.keys(o).length,d=c.indexOf(l)>-1,f=o.children;if(!f&&d&&!u){i+=`<${l}/>`;return}if(!f&&(!d||u)||o.i18nIsDynamicList){i+=`<${s}></${s}>`;return}if(d&&u<=1){let e=a(f)?f:O(f,t,n,r);i+=`<${l}>${e}</${l}>`;return}let p=O(f,t,n,r);i+=`<${s}>${p}</${s}>`;return}if(e===null){o(n,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:r});return}if(d(e)){let{format:t,...a}=e,s=Object.keys(a);if(s.length===1){let e=t?`${s[0]}, ${t}`:s[0];i+=`{{${e}}}`;return}o(n,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:r,child:e});return}o(n,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:r,child:e})}),i},k=(e,t=[],n={})=>{if(!e)return e;let r=Object.keys(n),i=[...t,...r],a=``,o=0;for(;o<e.length;)if(e[o]===`<`){let t=!1,n=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(n){let e=n[1];(/^\d+$/.test(e)||i.includes(e))&&(t=!0,a+=n[0],o+=n[0].length)}if(!t){let n=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(n){let e=n[1];(/^\d+$/.test(e)||i.includes(e))&&(t=!0,a+=n[0],o+=n[0].length)}}t||(a+=`&lt;`,o+=1)}else a+=e[o],o+=1;return a},A=(e,t,n,r,i,o,s)=>{if(n===``)return[];let l=i.transKeepBasicHtmlNodesFor||[],f=n&&new RegExp(l.map(e=>`<${e}`).join(`|`)).test(n);if(!e&&!t&&!f&&!s)return[n];let m=t??{},h=e=>{T(e).forEach(e=>{a(e)||(S(e)?h(C(e)):d(e)&&!(0,p.isValidElement)(e)&&Object.assign(m,e))})};h(e);let g=k(n,l,m),_=x.parse(`<0>${g}</0>`),v={...m,...o},y=(e,t,n)=>{let r=C(e),i=D(r,t.children,n);return w(r)&&i.length===0||e.props?.i18nIsDynamicList?r:i},b=(e,t,n,r,i)=>{e.dummy?(e.children=t,n.push((0,p.cloneElement)(e,{key:r},i?void 0:t))):n.push(...p.Children.map([e],e=>{if(e.type===p.Fragment||e.props?.i18nIsDynamicList!==void 0){let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`children`||t===`i18nIsDynamicList`||(n[t]=e.props[t])}),(0,p.createElement)(e.type,n,i?null:t)}let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`ref`||t===`children`||(n[t]=e.props[t])}),(0,p.cloneElement)(e,n,i?null:t)}))},D=(e,n,o)=>{let m=T(e),h=T(n),g={};return h.reduce((e,n,h)=>{let _=n.children?.[0]?.content&&r.services.interpolator.interpolate(n.children[0].content,v,r.language);if(n.type===`tag`){let u=m[parseInt(n.name,10)];!u&&t&&(u=t[n.name]),o.length===1&&!u&&(u=o[0][n.name]),u||={};let x={...n.attrs};s&&Object.keys(x).forEach(e=>{let t=x[e];a(t)&&(x[e]=c(t))});let w=Object.keys(x).length===0?u:E({props:x},u),O=(0,p.isValidElement)(w),k=O&&S(n,!0)&&!n.voidElement,A=f&&d(w)&&w.dummy&&!O,j=d(t)&&Object.hasOwnProperty.call(t,n.name);if(a(w)){let t=r.services.interpolator.interpolate(w,v,r.language);e.push(t)}else if(S(w)||k){let t=y(w,n,o);b(w,t,e,h)}else if(A){let t=D(m,n.children,o);b(w,t,e,h)}else if(Number.isNaN(parseFloat(n.name)))if(j){let t=y(w,n,o);b(w,t,e,h,n.voidElement)}else if(i.transSupportBasicHtmlNodes&&l.indexOf(n.name)>-1)if(n.voidElement)e.push((0,p.createElement)(n.name,{key:`${n.name}-${h}`}));else{let t=g[n.name]||0;g[n.name]=t+1;let r,i=0;for(let e=0;e<m.length;e+=1){let a=m[e];if((0,p.isValidElement)(a)&&a.type===n.name){if(i===t){r=a;break}i+=1}}let a=r?T(C(r)):m,s=D(a,n.children,o);e.push((0,p.createElement)(n.name,{key:`${n.name}-${h}`},s))}else if(n.voidElement)e.push(`<${n.name} />`);else{let t=D(m,n.children,o);e.push(`<${n.name}>${t}</${n.name}>`)}else if(d(w)&&!O){let t=n.children[0]?_:null;t&&e.push(t)}else b(w,_,e,h,n.children.length!==1||!_)}else if(n.type===`text`){let t=i.transWrapTextNodes,a=typeof i.unescape==`function`?i.unescape:u().unescape,o=s?a(r.services.interpolator.interpolate(n.content,v,r.language)):r.services.interpolator.interpolate(n.content,v,r.language);t?e.push((0,p.createElement)(t,{key:`${n.name}-${h}`},o)):e.push(o)}return e},[])};return C(D([{dummy:!0,children:e||[]}],_,T(e||[]))[0])},j=(e,t,n)=>{let r=e.key||t,i=(0,p.cloneElement)(e,{key:r});if(!i.props||!i.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return i;function a(){return(0,p.createElement)(p.Fragment,null,i)}return(0,p.createElement)(a,{key:r})},M=(e,t)=>e.map((e,n)=>j(e,n,t)),N=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:j(e[r],r,t)})}),n},P=(e,t,n,r)=>e?Array.isArray(e)?M(e,t):d(e)?N(e,t):(l(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,F=e=>!d(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function I({children:e,count:t,parent:n,i18nKey:o,context:s,tOptions:c={},values:d,defaults:f,components:m,ns:h,i18n:g,t:_,shouldUnescape:v,...y}){let b=g||i();if(!b)return l(b,`NO_I18NEXT_INSTANCE`,`Trans: You need to pass in an i18next instance using i18nextReactModule`,{i18nKey:o}),e;let x=_||b.t.bind(b)||(e=>e),S={...u(),...b.options?.react},C=h||x.ns||b.options?.defaultNS;C=a(C)?[C]:C||[`translation`];let{transDefaultProps:w}=S,T=w?.tOptions?{...w.tOptions,...c}:c,E=v??w?.shouldUnescape,k=w?.values?{...w.values,...d}:d,j=w?.components?{...w.components,...m}:m,M=O(e,S,b,o),N=f||T?.defaultValue||M||S.transEmptyNodeValue||(typeof o==`function`?r(o):o),{hashTransKey:I}=S,L=o||(I?I(M||N):M||N);d=b.options?.interpolation?.defaultVariables?k&&Object.keys(k).length>0?{...k,...b.options.interpolation.defaultVariables}:{...b.options.interpolation.defaultVariables}:k;let R=D(e);R&&typeof R.count==`number`&&t===void 0&&(t=R.count);let z=d||t!==void 0&&!b.options?.interpolation?.alwaysFormat||!e?T.interpolation:{interpolation:{...T.interpolation,prefix:`#$?`,suffix:`?$#`}},B={...T,context:s||T.context,count:t,...d,...z,defaultValue:N,ns:C},V=L?x(L,B):N;V===L&&N&&(V=N);let H=P(j,V,b,o),U=H||e,W=null;F(H)&&(W=H,U=e);let G=A(U,W,V,b,S,B,E),K=n??S.defaultTransParent;return K?(0,p.createElement)(K,y,G):G}function L({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:o={},values:c,defaults:l,components:u,ns:d,i18n:f,t:m,shouldUnescape:h,...g}){let{i18n:_,defaultNS:v}=(0,p.useContext)(s)||{},y=f||_||i(),b=m||y?.t.bind(y);return I({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:o,values:c,defaults:l,components:u,ns:d||b?.ns||v||y?.options?.defaultNS,i18n:y,t:m,shouldUnescape:h,...g})}export{L as t};
@@ -1 +1 @@
1
- import{b as e,f as t,h as n,m as r,p as i,u as a,x as o}from"./i18n-DwgvwTnx.js";import{t as s}from"./getTimezoneOffsetInMilliseconds-owhDdTXs.js";function c(e,n){let r=t(e)-+t(n);return r<0?-1:r>0?1:r}function l(e){return n(e,Date.now())}function u(e,t,n){let[i,a]=r(n?.in,e,t),o=i.getFullYear()-a.getFullYear(),s=i.getMonth()-a.getMonth();return o*12+s}function d(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function f(e,n){return t(e)-+t(n)}function p(e,n){let r=t(e,n?.in);return r.setHours(23,59,59,999),r}function m(e,n){let r=t(e,n?.in),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function h(e,n){let r=t(e,n?.in);return+p(r,n)==+m(r,n)}function g(e,t,n){let[i,a,o]=r(n?.in,e,e,t),s=c(a,o),l=Math.abs(u(a,o));if(l<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-s*l);let d=c(a,o)===-s;h(i)&&l===1&&c(i,o)===1&&(d=!1);let f=s*(l-+d);return f===0?0:f}function _(e,t,n){let r=f(e,t)/1e3;return d(n?.roundingMethod)(r)}function v(t,n,l){let u=i(),d=l?.locale??u.locale??a,f=c(t,n);if(isNaN(f))throw RangeError(`Invalid time value`);let p=Object.assign({},l,{addSuffix:l?.addSuffix,comparison:f}),[m,h]=r(l?.in,...f>0?[n,t]:[t,n]),v=_(h,m),y=(s(h)-s(m))/1e3,b=Math.round((v-y)/60),x;if(b<2)return l?.includeSeconds?v<5?d.formatDistance(`lessThanXSeconds`,5,p):v<10?d.formatDistance(`lessThanXSeconds`,10,p):v<20?d.formatDistance(`lessThanXSeconds`,20,p):v<40?d.formatDistance(`halfAMinute`,0,p):v<60?d.formatDistance(`lessThanXMinutes`,1,p):d.formatDistance(`xMinutes`,1,p):b===0?d.formatDistance(`lessThanXMinutes`,1,p):d.formatDistance(`xMinutes`,b,p);if(b<45)return d.formatDistance(`xMinutes`,b,p);if(b<90)return d.formatDistance(`aboutXHours`,1,p);if(b<1440){let e=Math.round(b/60);return d.formatDistance(`aboutXHours`,e,p)}else if(b<2520)return d.formatDistance(`xDays`,1,p);else if(b<43200){let t=Math.round(b/e);return d.formatDistance(`xDays`,t,p)}else if(b<43200*2)return x=Math.round(b/o),d.formatDistance(`aboutXMonths`,x,p);if(x=g(h,m),x<12){let e=Math.round(b/o);return d.formatDistance(`xMonths`,e,p)}else{let e=x%12,t=Math.trunc(x/12);return e<3?d.formatDistance(`aboutXYears`,t,p):e<9?d.formatDistance(`overXYears`,t,p):d.formatDistance(`almostXYears`,t+1,p)}}function y(e,t){return v(e,l(e),t)}export{y as t};
1
+ import{b as e,f as t,h as n,m as r,p as i,u as a,x as o}from"./i18n-hnX2DPmo.js";import{t as s}from"./getTimezoneOffsetInMilliseconds-C16cxSe1.js";function c(e,n){let r=t(e)-+t(n);return r<0?-1:r>0?1:r}function l(e){return n(e,Date.now())}function u(e,t,n){let[i,a]=r(n?.in,e,t),o=i.getFullYear()-a.getFullYear(),s=i.getMonth()-a.getMonth();return o*12+s}function d(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function f(e,n){return t(e)-+t(n)}function p(e,n){let r=t(e,n?.in);return r.setHours(23,59,59,999),r}function m(e,n){let r=t(e,n?.in),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function h(e,n){let r=t(e,n?.in);return+p(r,n)==+m(r,n)}function g(e,t,n){let[i,a,o]=r(n?.in,e,e,t),s=c(a,o),l=Math.abs(u(a,o));if(l<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-s*l);let d=c(a,o)===-s;h(i)&&l===1&&c(i,o)===1&&(d=!1);let f=s*(l-+d);return f===0?0:f}function _(e,t,n){let r=f(e,t)/1e3;return d(n?.roundingMethod)(r)}function v(t,n,l){let u=i(),d=l?.locale??u.locale??a,f=c(t,n);if(isNaN(f))throw RangeError(`Invalid time value`);let p=Object.assign({},l,{addSuffix:l?.addSuffix,comparison:f}),[m,h]=r(l?.in,...f>0?[n,t]:[t,n]),v=_(h,m),y=(s(h)-s(m))/1e3,b=Math.round((v-y)/60),x;if(b<2)return l?.includeSeconds?v<5?d.formatDistance(`lessThanXSeconds`,5,p):v<10?d.formatDistance(`lessThanXSeconds`,10,p):v<20?d.formatDistance(`lessThanXSeconds`,20,p):v<40?d.formatDistance(`halfAMinute`,0,p):v<60?d.formatDistance(`lessThanXMinutes`,1,p):d.formatDistance(`xMinutes`,1,p):b===0?d.formatDistance(`lessThanXMinutes`,1,p):d.formatDistance(`xMinutes`,b,p);if(b<45)return d.formatDistance(`xMinutes`,b,p);if(b<90)return d.formatDistance(`aboutXHours`,1,p);if(b<1440){let e=Math.round(b/60);return d.formatDistance(`aboutXHours`,e,p)}else if(b<2520)return d.formatDistance(`xDays`,1,p);else if(b<43200){let t=Math.round(b/e);return d.formatDistance(`xDays`,t,p)}else if(b<43200*2)return x=Math.round(b/o),d.formatDistance(`aboutXMonths`,x,p);if(x=g(h,m),x<12){let e=Math.round(b/o);return d.formatDistance(`xMonths`,e,p)}else{let e=x%12,t=Math.trunc(x/12);return e<3?d.formatDistance(`aboutXYears`,t,p):e<9?d.formatDistance(`overXYears`,t,p):d.formatDistance(`almostXYears`,t+1,p)}}function y(e,t){return v(e,l(e),t)}export{y as t};
@@ -1 +1 @@
1
- import{f as e}from"./i18n-DwgvwTnx.js";function t(t){let n=e(t),r=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return r.setUTCFullYear(n.getFullYear()),t-+r}export{t};
1
+ import{f as e}from"./i18n-hnX2DPmo.js";function t(t){let n=e(t),r=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return r.setUTCFullYear(n.getFullYear()),t-+r}export{t};