specrails-desktop 2.29.3 → 2.29.4

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 (55) hide show
  1. package/client/dist/assets/{ActivityFeedPage-CFB4UBhT.js → ActivityFeedPage-CDMzpGXd.js} +1 -1
  2. package/client/dist/assets/{AgentBrowserCapture-C-T0r16B.js → AgentBrowserCapture-BVTacapZ.js} +1 -1
  3. package/client/dist/assets/{AgentModeCodePane-IljV5FOQ.js → AgentModeCodePane-D9bhFyuy.js} +2 -2
  4. package/client/dist/assets/{AgentModeJobsPane-B5miH10_.js → AgentModeJobsPane-DAjN8Au5.js} +1 -1
  5. package/client/dist/assets/{AgentsPage-BgYQrAcH.js → AgentsPage-CebykajE.js} +1 -1
  6. package/client/dist/assets/{AnalyticsPage-BtVCuNjL.js → AnalyticsPage-BiPrVvgv.js} +1 -1
  7. package/client/dist/assets/{CodePage-Cb_jAjSV.js → CodePage-Dw9eQFRS.js} +1 -1
  8. package/client/dist/assets/{DesktopAnalyticsPage-s_Cc_JL1.js → DesktopAnalyticsPage-cCG_JAEi.js} +1 -1
  9. package/client/dist/assets/{DocsDialog-Cr47QI9L.js → DocsDialog-C1kZ_mRP.js} +1 -1
  10. package/client/dist/assets/{DocsPage-C_WPRuG_.js → DocsPage-3GivxWJm.js} +1 -1
  11. package/client/dist/assets/{InteractiveJobComposer-NfFOciRB.js → InteractiveJobComposer-KuZXGdr8.js} +1 -1
  12. package/client/dist/assets/{JobDetailModal-DqEW7Z7K.js → JobDetailModal-DWpRALkB.js} +1 -1
  13. package/client/dist/assets/{JobDetailPage-D4ppEpDE.js → JobDetailPage-mrXDKafj.js} +1 -1
  14. package/client/dist/assets/{JobsPage-DStSoMyq.js → JobsPage-CUYXjcoc.js} +1 -1
  15. package/client/dist/assets/{LoopBuilderPage-DltCwS4P.js → LoopBuilderPage-CwjBD5Gm.js} +1 -1
  16. package/client/dist/assets/{LoopPreviewModal-BWaiAbUq.js → LoopPreviewModal-CO9ton0-.js} +1 -1
  17. package/client/dist/assets/{LoopsPage-BqjbXuBZ.js → LoopsPage-CLL5UuvN.js} +1 -1
  18. package/client/dist/assets/{MinimizedChatsContext--o3JAM9F.js → MinimizedChatsContext-DJAkRYps.js} +1 -1
  19. package/client/dist/assets/{PluginsPage-B-UOmzXw.js → PluginsPage-DZvCC5Ri.js} +1 -1
  20. package/client/dist/assets/{ProjectSettingsDialog-DkGajIxE.js → ProjectSettingsDialog-C7Hesadg.js} +1 -1
  21. package/client/dist/assets/{TemplatePreviewModal-5CUXlkw7.js → TemplatePreviewModal-DczCzUzP.js} +1 -1
  22. package/client/dist/assets/{TicketDetailModal-B_igqmti.js → TicketDetailModal-CFh7GOv5.js} +3 -3
  23. package/client/dist/assets/{Trans-DDMIBBUd.js → Trans-Cm9rhdnG.js} +1 -1
  24. package/client/dist/assets/{dashboard-DAr6F9et.js → dashboard-CHCEkds4.js} +1 -1
  25. package/client/dist/assets/{dashboard-D4Uj-XWc2.js → dashboard-Cqmmbh3l2.js} +1 -1
  26. package/client/dist/assets/{dashboard-BYzxom0L.js → dashboard-CrlTV1ms.js} +1 -1
  27. package/client/dist/assets/dashboard-Cslu_GCH.js +1 -0
  28. package/client/dist/assets/{dashboard-CnNtJBQ5.js → dashboard-DUU8-_Rg.js} +1 -1
  29. package/client/dist/assets/{dashboard-vrjZvxWy.js → dashboard-DweT3Y4R.js} +1 -1
  30. package/client/dist/assets/{dashboard-D57uRaGw2.js → dashboard-Dy2Um-US2.js} +1 -1
  31. package/client/dist/assets/{dashboard-vAcsn0L3.js → dashboard-WhzOQw1S.js} +1 -1
  32. package/client/dist/assets/{dist-js-DcoXTnEI.js → dist-js-BERxOT0X.js} +1 -1
  33. package/client/dist/assets/{dist-js-BCUhGUXS.js → dist-js-Di8lflPo.js} +1 -1
  34. package/client/dist/assets/{formatDistanceToNow-DP3Ab6fX.js → formatDistanceToNow-BAXZRbEO.js} +1 -1
  35. package/client/dist/assets/{getTimezoneOffsetInMilliseconds-DdKKL8Fx.js → getTimezoneOffsetInMilliseconds-DwzZXHtg.js} +1 -1
  36. package/client/dist/assets/{i18n-DREQCE2F.js → i18n-cK5pPbj8.js} +2 -2
  37. package/client/dist/assets/{index-CQBIemiz.css → index-BT6xDQjB.css} +1 -1
  38. package/client/dist/assets/index-CCq_kIrF.js +76 -0
  39. package/client/dist/assets/{spending-CtY7yYes.js → spending-BLb5pj6G.js} +1 -1
  40. package/client/dist/assets/{useBrowserCaptureSession-BFBdW59q.js → useBrowserCaptureSession-DR1_jL56.js} +1 -1
  41. package/client/dist/assets/{useDesktop-uWVZ8eia.js → useDesktop-D4DxBGPU.js} +1 -1
  42. package/client/dist/index.html +12 -12
  43. package/docs/internals/safe-pr-review-flow.md +32 -3
  44. package/package.json +1 -1
  45. package/server/dist/active-pr-continuation.js +115 -1
  46. package/server/dist/agent-operator-prompt.js +9 -0
  47. package/server/dist/mcp/tools/rails.js +8 -0
  48. package/server/dist/project-git.js +7 -2
  49. package/server/dist/rail-isolated-launch.js +82 -23
  50. package/server/dist/rail-pr-decision.js +8 -0
  51. package/server/dist/rail-worktree-release.js +88 -2
  52. package/server/dist/rails-router.js +99 -1
  53. package/server/dist/worktree-manager.js +32 -5
  54. package/client/dist/assets/dashboard-BmDZmHyY.js +0 -1
  55. package/client/dist/assets/index-B784m8RT.js +0 -76
@@ -1,11 +1,11 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-js-BCUhGUXS.js","assets/index-B784m8RT.js","assets/rolldown-runtime-CNC7AqOf.js","assets/jsx-runtime-zu2_FqZY.js","assets/react-dom-DiWzBDP9.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-Cx5sqopX.js","assets/i18n-DREQCE2F.js","assets/createLucideIcon-Bjbbp_KS.js","assets/activity-DiyjsgQV.js","assets/addspec-Rw8uVBC1.js","assets/agent-BqEfA5u5.js","assets/agents-DhG7mg6-.js","assets/agentstudio-BIUe1Im2.js","assets/aiedit-iIjz2_Qk.js","assets/analytics-DZ8Aoq3I.js","assets/attachments-B53PG733.js","assets/browser-CXUcnTMI.js","assets/chat-BGD7MXAy.js","assets/code-BDXEM4ml.js","assets/commands-DyUZQ1FI.js","assets/common-DHsv9N5d.js","assets/dashboard-BmDZmHyY.js","assets/explore-DgBACn39.js","assets/integrations-mB-7zoyT.js","assets/jira-CmKWERE0.js","assets/jobs-DoSaFzAa.js","assets/loops-BzfXWEwO.js","assets/mcp-uDkXYu4L.js","assets/nav-myFaXRHD.js","assets/settings-B0ypw9uw.js","assets/setup-CmK87LuS.js","assets/specs-DII0C8gw.js","assets/terminal-BFRZnMPP.js","assets/tickets-D_yDquEw.js","assets/Trans-DDMIBBUd.js","assets/dist-bVqfYmby.js","assets/arrow-left-CpIR4j7G.js","assets/useBrowserCaptureSession-BFBdW59q.js","assets/auth-D_5bQv5W.js","assets/api-B2M7CtDw.js","assets/arrow-up-right-9DoMn7fD.js","assets/MinimizedChatsContext--o3JAM9F.js","assets/sparkles-DrY8hb0X.js","assets/x-CBMI9ejn.js","assets/useSharedWebSocket-DaPh7QBL.js","assets/useDesktop-uWVZ8eia.js","assets/external-link-BcU5EWZp.js","assets/chevron-right-CViMxucY.js","assets/circle-x-CMYsN4ZH.js","assets/download-CFHyyHcw.js","assets/file-text-CFT-xXKN.js","assets/git-branch-BRM0F5GN.js","assets/loader-circle-DcygOQpC.js","assets/pencil-C9RkrIPZ.js","assets/play-DNlrawbS.js","assets/plus-CsnjfkmX.js","assets/save-28sIlCdr.js","assets/search-Cq_gE3Ik.js","assets/trash-2-BOU3WdZZ.js","assets/triangle-alert-H9T4jAmh.js","assets/zap-CHo3aCD1.js","assets/dist-Cez5CRkX.js","assets/button-BUIIBQPT.js","assets/clsx-CjueKrWZ.js","assets/utils-BC4DHlz2.js","assets/dialog-CzIekCw0.js","assets/jira-api-BgFIr8eD.js","assets/lib-CGdyxIWg.js","assets/getTimezoneOffsetInMilliseconds-DdKKL8Fx.js","assets/index-CQBIemiz.css"])))=>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{l as a}from"./chunk-KS7C4IRE-Cx5sqopX.js";import{_ as o,a as s,f as c,h as l,o as u,v as d}from"./i18n-DREQCE2F.js";import{t as f}from"./Trans-DDMIBBUd.js";import{n as p,t as m}from"./createLucideIcon-Bjbbp_KS.js";import{n as h}from"./dist-bVqfYmby.js";import{t as g}from"./arrow-left-CpIR4j7G.js";import{c as _,g as v,h as y,i as b,m as x,o as S,t as C,u as w}from"./useBrowserCaptureSession-BFBdW59q.js";import{n as T,u as E}from"./MinimizedChatsContext--o3JAM9F.js";import{n as D,t as ee}from"./external-link-BcU5EWZp.js";import{t as te}from"./circle-x-CMYsN4ZH.js";import{t as O}from"./download-CFHyyHcw.js";import{t as ne}from"./file-text-CFT-xXKN.js";import{t as k}from"./git-branch-BRM0F5GN.js";import{t as re}from"./loader-circle-DcygOQpC.js";import{t as ie}from"./pencil-C9RkrIPZ.js";import{t as ae}from"./play-DNlrawbS.js";import{t as oe}from"./plus-CsnjfkmX.js";import{t as se}from"./save-28sIlCdr.js";import{t as A}from"./search-Cq_gE3Ik.js";import{t as ce}from"./trash-2-BOU3WdZZ.js";import{t as le}from"./triangle-alert-H9T4jAmh.js";import{t as ue}from"./x-CBMI9ejn.js";import{t as de}from"./zap-CHo3aCD1.js";import{a as j}from"./auth-D_5bQv5W.js";import{n as M}from"./useSharedWebSocket-DaPh7QBL.js";import{t as N}from"./api-B2M7CtDw.js";import{r as P}from"./useDesktop-uWVZ8eia.js";import{t as F}from"./button-BUIIBQPT.js";import{t as I}from"./utils-BC4DHlz2.js";import{a as fe,c as pe,i as me,n as he,o as ge,r as _e,s as ve,t as ye}from"./dialog-CzIekCw0.js";import{t as L}from"./jira-api-BgFIr8eD.js";import{n as be,t as xe}from"./lib-CGdyxIWg.js";import{t as R}from"./formatDistanceToNow-DP3Ab6fX.js";import{n as Se}from"./spending-CtY7yYes.js";var Ce=m(`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`}]]),we=m(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Te=m(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),Ee=m(`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`}]]),z=m(`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`}]]),B=m(`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=m(`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`}]]),V=m(`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`}]]),H=m(`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`}]]),U=m(`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`}]]),W=new Map,Oe=2e3;function ke(e){W.set(e,(W.get(e)??0)+1)}function Ae(e){(W.get(e)??0)<=0||setTimeout(()=>{let t=(W.get(e)??0)-1;t<=0?W.delete(e):W.set(e,t)},Oe)}function je(e){return e?(W.get(e)??0)>0:!1}var G=e(t(),1),Me=3e3,Ne=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-js-Di8lflPo.js","assets/index-CCq_kIrF.js","assets/rolldown-runtime-CNC7AqOf.js","assets/jsx-runtime-zu2_FqZY.js","assets/react-dom-DiWzBDP9.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-Cx5sqopX.js","assets/i18n-cK5pPbj8.js","assets/createLucideIcon-Bjbbp_KS.js","assets/activity-DiyjsgQV.js","assets/addspec-Rw8uVBC1.js","assets/agent-BqEfA5u5.js","assets/agents-DhG7mg6-.js","assets/agentstudio-BIUe1Im2.js","assets/aiedit-iIjz2_Qk.js","assets/analytics-DZ8Aoq3I.js","assets/attachments-B53PG733.js","assets/browser-CXUcnTMI.js","assets/chat-BGD7MXAy.js","assets/code-BDXEM4ml.js","assets/commands-DyUZQ1FI.js","assets/common-DHsv9N5d.js","assets/dashboard-Cslu_GCH.js","assets/explore-DgBACn39.js","assets/integrations-mB-7zoyT.js","assets/jira-CmKWERE0.js","assets/jobs-DoSaFzAa.js","assets/loops-BzfXWEwO.js","assets/mcp-uDkXYu4L.js","assets/nav-myFaXRHD.js","assets/settings-B0ypw9uw.js","assets/setup-CmK87LuS.js","assets/specs-DII0C8gw.js","assets/terminal-BFRZnMPP.js","assets/tickets-D_yDquEw.js","assets/Trans-Cm9rhdnG.js","assets/dist-bVqfYmby.js","assets/arrow-left-CpIR4j7G.js","assets/useBrowserCaptureSession-DR1_jL56.js","assets/auth-D_5bQv5W.js","assets/api-B2M7CtDw.js","assets/arrow-up-right-9DoMn7fD.js","assets/MinimizedChatsContext-DJAkRYps.js","assets/sparkles-DrY8hb0X.js","assets/x-CBMI9ejn.js","assets/useSharedWebSocket-DaPh7QBL.js","assets/useDesktop-D4DxBGPU.js","assets/external-link-BcU5EWZp.js","assets/chevron-right-CViMxucY.js","assets/circle-x-CMYsN4ZH.js","assets/download-CFHyyHcw.js","assets/file-text-CFT-xXKN.js","assets/git-branch-BRM0F5GN.js","assets/loader-circle-DcygOQpC.js","assets/pencil-C9RkrIPZ.js","assets/play-DNlrawbS.js","assets/plus-CsnjfkmX.js","assets/save-28sIlCdr.js","assets/search-Cq_gE3Ik.js","assets/trash-2-BOU3WdZZ.js","assets/triangle-alert-H9T4jAmh.js","assets/zap-CHo3aCD1.js","assets/dist-Cez5CRkX.js","assets/button-BUIIBQPT.js","assets/clsx-CjueKrWZ.js","assets/utils-BC4DHlz2.js","assets/dialog-CzIekCw0.js","assets/jira-api-BgFIr8eD.js","assets/lib-CGdyxIWg.js","assets/getTimezoneOffsetInMilliseconds-DwzZXHtg.js","assets/index-BT6xDQjB.css"])))=>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{l as a}from"./chunk-KS7C4IRE-Cx5sqopX.js";import{_ as o,a as s,f as c,h as l,o as u,v as d}from"./i18n-cK5pPbj8.js";import{t as f}from"./Trans-Cm9rhdnG.js";import{n as p,t as m}from"./createLucideIcon-Bjbbp_KS.js";import{n as h}from"./dist-bVqfYmby.js";import{t as g}from"./arrow-left-CpIR4j7G.js";import{c as _,g as v,h as y,i as b,m as x,o as S,t as C,u as w}from"./useBrowserCaptureSession-DR1_jL56.js";import{n as T,u as E}from"./MinimizedChatsContext-DJAkRYps.js";import{n as D,t as ee}from"./external-link-BcU5EWZp.js";import{t as te}from"./circle-x-CMYsN4ZH.js";import{t as O}from"./download-CFHyyHcw.js";import{t as ne}from"./file-text-CFT-xXKN.js";import{t as k}from"./git-branch-BRM0F5GN.js";import{t as re}from"./loader-circle-DcygOQpC.js";import{t as ie}from"./pencil-C9RkrIPZ.js";import{t as ae}from"./play-DNlrawbS.js";import{t as oe}from"./plus-CsnjfkmX.js";import{t as se}from"./save-28sIlCdr.js";import{t as A}from"./search-Cq_gE3Ik.js";import{t as ce}from"./trash-2-BOU3WdZZ.js";import{t as le}from"./triangle-alert-H9T4jAmh.js";import{t as ue}from"./x-CBMI9ejn.js";import{t as de}from"./zap-CHo3aCD1.js";import{a as j}from"./auth-D_5bQv5W.js";import{n as M}from"./useSharedWebSocket-DaPh7QBL.js";import{t as N}from"./api-B2M7CtDw.js";import{r as P}from"./useDesktop-D4DxBGPU.js";import{t as F}from"./button-BUIIBQPT.js";import{t as I}from"./utils-BC4DHlz2.js";import{a as fe,c as pe,i as me,n as he,o as ge,r as _e,s as ve,t as ye}from"./dialog-CzIekCw0.js";import{t as L}from"./jira-api-BgFIr8eD.js";import{n as be,t as xe}from"./lib-CGdyxIWg.js";import{t as R}from"./formatDistanceToNow-BAXZRbEO.js";import{n as Se}from"./spending-BLb5pj6G.js";var Ce=m(`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`}]]),we=m(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Te=m(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),Ee=m(`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`}]]),z=m(`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`}]]),B=m(`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=m(`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`}]]),V=m(`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`}]]),H=m(`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`}]]),U=m(`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`}]]),W=new Map,Oe=2e3;function ke(e){W.set(e,(W.get(e)??0)+1)}function Ae(e){(W.get(e)??0)<=0||setTimeout(()=>{let t=(W.get(e)??0)-1;t<=0?W.delete(e):W.set(e,t)},Oe)}function je(e){return e?(W.get(e)??0)>0:!1}var G=e(t(),1),Me=3e3,Ne=`
3
3
 
4
4
  ---
5
5
 
6
6
  ## Contract Layer
7
7
 
8
- `;function K(e){return`${j}/api/projects/${encodeURIComponent(e)}`}function Pe(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Fe(e,t){let n=new Map(e.map(e=>[e.id,e])),r=t.map(e=>{let t=n.get(e.id);return t&&Pe(t,e)?t:e});return r.length===e.length&&r.every((t,n)=>t===e[n])?e:r}function Ie(){let{t:e}=p(`tickets`),{activeProjectId:t}=P(),[n,r]=(0,G.useState)([]),[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(new Set),[u,d]=(0,G.useState)(new Set),f=(0,G.useRef)(t);f.current=t;let m=(0,G.useRef)(0),g=(0,G.useRef)(null),_=(0,G.useRef)(new Set),{registerHandler:v,unregisterHandler:y,connectionStatus:b}=M(),x=(0,G.useId)(),S=(0,G.useCallback)(async(e,t)=>{let n=K(e),r=await fetch(`${n}/tickets`,{signal:t,cache:`no-store`});if(!r.ok)throw Error(`Failed to fetch tickets: ${r.status}`);let i=await r.json();return Array.isArray(i)?i:i.tickets??[]},[]),C=(0,G.useCallback)(async(t,n)=>{let i=++m.current;g.current?.abort();let o=new AbortController;g.current=o,f.current===t&&(a(!0),s(null));try{let a=await S(t,o.signal);if(o.signal.aborted||i!==m.current||f.current!==t)return;let s=_.current,c=new Set;if(n===`merge`)for(let e of a)s.size>0&&!s.has(e.id)&&c.add(e.id);_.current=new Set(a.map(e=>e.id)),r(n===`replace`?a:e=>Fe(e,a)),c.size>0&&s.size>0&&(l(c),h.success(e(`toasts.newTicketsAdded`,{count:c.size}),{id:`tickets-added-${t}`}),setTimeout(()=>{f.current===t&&l(e=>{let t=new Set(e);for(let e of c)t.delete(e);return t})},Me))}catch(e){if(o.signal.aborted||i!==m.current||f.current!==t)return;s(e instanceof Error?e.message:String(e))}finally{i===m.current&&(g.current===o&&(g.current=null),f.current===t&&a(!1))}},[S,e]),w=(0,G.useCallback)(async()=>{t&&await C(t,`merge`)},[t,C]);(0,G.useEffect)(()=>{if(m.current+=1,g.current?.abort(),g.current=null,r([]),a(!1),s(null),_.current=new Set,l(new Set),d(new Set),t)return C(t,`replace`),()=>{m.current+=1,g.current?.abort(),g.current=null}},[t,C]);let T=(0,G.useCallback)(t=>{let n=t;if(!n||typeof n.type!=`string`)return;let i=f.current;if(!(n.projectId&&n.projectId!==i))switch(n.type){case`mcp.activity`:n.affectedProjectId&&n.affectedProjectId===i&&w();break;case`ticket_created`:{if(!n.ticket)break;let t=n.ticket;r(e=>e.some(e=>e.id===t.id)?e:[...e,t]),_.current.add(t.id),l(e=>new Set([...e,t.id])),je(i)||h.success(e(`toasts.newTicket`,{title:t.title}),{id:`new-ticket-${t.id}`}),setTimeout(()=>{l(e=>{let n=new Set(e);return n.delete(t.id),n})},Me);break}case`ticket_updated`:{if(!n.ticket)break;if(n.ticket.id===0){w();break}let e=n.ticket;r(t=>t.map(t=>t.id===e.id?e:t)),typeof e.description==`string`&&e.description.includes(Ne)&&d(t=>{if(!t.has(e.id))return t;let n=new Set(t);return n.delete(e.id),n});break}case`ticket_deleted`:{if(n.ticketId==null)break;let e=n.ticketId;r(t=>t.filter(t=>t.id!==e)),_.current.delete(e);break}case`explore.contract_refine_started`:if(n.ticketId==null)break;d(e=>new Set([...e,n.ticketId]));break;case`explore.contract_refine_failed`:{if(n.ticketId==null)break;let e=n.ticketId;d(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n});break}}},[w,e]);(0,G.useLayoutEffect)(()=>(v(`tickets-${x}`,T),()=>y(`tickets-${x}`)),[T,v,y,x]);let E=(0,G.useRef)(b);return(0,G.useEffect)(()=>{E.current!==`connected`&&b===`connected`&&f.current&&w(),E.current=b},[b,w]),{tickets:n,loading:i,isLoading:i,error:o,newTicketIds:c,contractRefiningIds:u,refetch:w,refresh:w,deleteTicket:(0,G.useCallback)(async e=>{let n=t;if(!n)return!1;try{let t=await fetch(`${K(n)}/tickets/${e}`,{method:`DELETE`});return t.ok&&f.current===n&&await C(n,`merge`),t.ok}catch{return!1}},[t,C]),updateTicketStatus:(0,G.useCallback)(async(e,n)=>{let r=t;if(!r)return!1;try{let t=await fetch(`${K(r)}/tickets/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:n})});return t.ok&&f.current===r&&await C(r,`merge`),t.ok}catch{return!1}},[t,C]),updateTicketPriority:(0,G.useCallback)(async(e,n)=>{let r=t;if(!r)return!1;try{let t=await fetch(`${K(r)}/tickets/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({priority:n})});return t.ok&&f.current===r&&await C(r,`merge`),t.ok}catch{return!1}},[t,C]),createTicket:(0,G.useCallback)(async e=>{let n=t;if(!n)return!1;try{let t=await fetch(`${K(n)}/tickets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return t.ok&&f.current===n&&await C(n,`merge`),t.ok}catch{return!1}},[t,C]),updateTicket:(0,G.useCallback)(async(e,n)=>{let r=t;if(!r)return!1;try{let t=await fetch(`${K(r)}/tickets/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});return t.ok&&f.current===r&&await C(r,`merge`),t.ok}catch{return!1}},[t,C])}}var q=n(),Le=224,Re=8,ze=8;function Be({rails:e,onMoveToRail:t,onClose:n,anchorRect:r}){let{t:i}=p(`tickets`),a=(0,G.useRef)(null),[o,s]=(0,G.useState)(!1);(0,G.useLayoutEffect)(()=>{let e=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(e)},[]),(0,G.useEffect)(()=>{function e(e){a.current&&(a.current.contains(e.target)||n())}function t(e){e.key===`Escape`&&n()}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[n]);let{top:c,left:l,caretLeft:u}=(0,G.useMemo)(()=>{let e=r.left+r.width/2,t=e-Le/2,n=window.innerWidth-Le-Re,i=Math.max(Re,Math.min(n,t)),a=e-i,o=Math.max(12,Math.min(Le-12,a));return{top:r.bottom+ze,left:i,caretLeft:o}},[r]);return(0,q.jsxs)(`div`,{ref:a,role:`dialog`,"aria-label":i(`rail.popoverTitle`),"data-testid":`move-to-rail-popover`,style:{top:c,left:l,width:Le,opacity:+!!o,transform:o?`translateY(0) scale(1)`:`translateY(-4px) scale(0.97)`,transformOrigin:`${u}px top`,transition:`opacity 140ms ease-out, transform 160ms cubic-bezier(0.2, 0.9, 0.3, 1)`},className:`fixed z-50 rounded-xl border border-border/60 bg-card/95 backdrop-blur shadow-xl shadow-black/40 p-1`,children:[(0,q.jsx)(`div`,{"aria-hidden":!0,className:`absolute w-2 h-2 rotate-45 bg-card/95 border-l border-t border-border/60`,style:{top:-5,left:u-4}}),(0,q.jsx)(`div`,{className:`px-2 py-1.5 text-[10px] uppercase tracking-wider text-muted-foreground/70 font-medium`,children:i(`rail.popoverTitle`)}),e.length===0?(0,q.jsx)(`div`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:i(`rail.noRails`)}):(0,q.jsx)(`ul`,{className:`flex flex-col`,children:e.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{t(e.id),n()},className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-lg text-left text-sm hover:bg-accent-info/10 hover:text-accent-info transition-colors`,children:[e.status===`running`?(0,q.jsx)(ae,{className:`w-3 h-3 text-accent-success animate-pulse shrink-0`,"aria-hidden":!0}):(0,q.jsx)(we,{className:`w-3 h-3 text-muted-foreground/60 shrink-0`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),(0,q.jsx)(Ce,{className:`w-3.5 h-3.5 text-muted-foreground/40 shrink-0`,"aria-hidden":!0})]})},e.id))})]})}var J=/\n*##\s*Acceptance Criteria\s*\n([\s\S]*?)(?=\n##\s|\n*$)/i;function Ve(e){if(!e)return{body:``,criteria:[]};let t=J.exec(e);if(!t)return{body:e.replace(/\s+$/,``),criteria:[]};let n=t[1],r=e.slice(0,t.index),i=e.slice(t.index+t[0].length),a=`${r.replace(/\s+$/,``)}${i?`\n\n${i.replace(/^\s+/,``)}`:``}`,o=n.split(/\r?\n/).map(e=>e.replace(/^\s*[-*+]\s+/,``).trim()).filter(e=>e.length>0);return{body:a.replace(/\s+$/,``),criteria:o}}var He=new Set([`draft`,`todo`]);function Y(e){return!!(He.has(e.status)||e.source===`jira`&&e.jira_key&&e.status!==`cancelled`)}function X(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}var Z=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_TERMINAL_PANEL;return typeof e!=`string`||e!==`false`})(),Ue=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_AGENTS_SECTION;return typeof e!=`string`||e!==`false`})(),We=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_CODE_EXPLORER;return typeof e!=`string`||e!==`false`})(),Ge=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_JIRA;return typeof e!=`string`||e!==`false`})(),Ke=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_MCP;return typeof e!=`string`||e!==`false`})(),qe=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_AGENT_CHAT;return typeof e!=`string`||e!==`false`})(),Je=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_AGENT_MODE;return qe&&(typeof e!=`string`||e!==`false`)})();(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_INTERACTIVE_JOBS;return typeof e!=`string`||e!==`false`})();var Ye=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_LOOPS_SECTION;return typeof e!=`string`||e!==`false`})();function Xe(){let{activeProjectId:e}=P(),[t,n]=(0,G.useState)({connected:!1,key:null,discardStatus:null}),[r,i]=(0,G.useState)(!0);return(0,G.useEffect)(()=>{if(!Ge||!e){n({connected:!1,key:null,discardStatus:null}),i(!1);return}let t=!1;return i(!0),L.getConnection().then(e=>{if(t)return;let r=!!(e.connected&&e.connection?.enabled);n({connected:r,key:e.connection?.jiraProjectKey??null,discardStatus:r?e.connection?.discardStatus??null:null})}).catch(()=>{t||n({connected:!1,key:null,discardStatus:null})}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e]),{connected:t.connected,jiraProjectKey:t.key,discardStatus:t.discardStatus,loading:r}}function Ze({open:e,onOpenChange:t,ticket:n,discardStatus:r,onDiscarded:i}){let{t:a}=p(`jira`),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(!1);async function u(){l(!0);try{await L.discardSpec(n.id,o.trim()||null),h.success(a(`discard.movedToast`,{status:r,key:n.jira_key??`#${n.id}`})),t(!1),s(``),i?.()}catch(e){h.error(e instanceof Error?e.message:a(`errors.generic`))}finally{l(!1)}}return(0,q.jsx)(ye,{open:e,onOpenChange:e=>{c||t(e)},children:(0,q.jsxs)(he,{movableResizable:!0,className:`max-w-md`,"data-testid":`jira-discard-dialog`,children:[(0,q.jsxs)(fe,{children:[(0,q.jsx)(ge,{children:a(`discard.title`,{status:r})}),(0,q.jsx)(_e,{children:a(`discard.body`,{status:r,key:n.jira_key??`#${n.id}`})})]}),(0,q.jsxs)(`label`,{className:`block space-y-1`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:a(`discard.commentLabel`)}),(0,q.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:a(`discard.commentPlaceholder`),rows:3,className:`w-full rounded-md border border-border bg-input px-3 py-2 text-xs text-foreground placeholder:text-muted-foreground resize-none`,"data-testid":`jira-discard-comment`})]}),(0,q.jsxs)(me,{children:[(0,q.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>t(!1),disabled:c,children:a(`wizard.cancel`)}),(0,q.jsxs)(F,{size:`sm`,onClick:u,disabled:c,"data-testid":`jira-discard-confirm`,children:[(0,q.jsx)(v,{className:`w-3.5 h-3.5 mr-1.5`}),c?a(`discard.moving`):a(`discard.confirm`,{status:r})]})]})]})})}var Qe={draft:{dotClass:`bg-accent-secondary/60`,textClass:`text-accent-secondary`,borderClass:`border-l-[3px] border-dashed border-accent-secondary/50 pl-3`,labelKey:`common:status.draft`,pulsing:!1},todo:{dotClass:`bg-slate-500/70`,textClass:`text-muted-foreground`,borderClass:`border-l-[3px] border-dashed border-slate-500/40 pl-3`,labelKey:`status.todo`,pulsing:!1},in_progress:{dotClass:`bg-blue-400 aurora-light:bg-accent-info`,textClass:`text-foreground font-semibold`,borderClass:`border-l-[3px] border-solid border-blue-500 pl-3`,labelKey:`status.inProgress`,pulsing:!0},on_review:{dotClass:`bg-accent-warning/80`,textClass:`text-accent-warning`,borderClass:`border-l-[3px] border-solid border-accent-warning/60 pl-3`,labelKey:`status.onReview`,pulsing:!1},done:{dotClass:`text-emerald-400 aurora-light:text-accent-success`,textClass:`text-emerald-400/80 aurora-light:text-accent-success`,borderClass:`border-l-[3px] border-solid border-emerald-500 pl-3`,labelKey:`status.done`,pulsing:!1},cancelled:{dotClass:`text-red-400/60 aurora-light:text-destructive/70`,textClass:`text-muted-foreground/50`,borderClass:`pl-3`,labelKey:`status.cancelled`,pulsing:!1}};function $e({status:e,className:t}){let{t:n}=p(`specs`),r=Qe[e];return e===`done`?(0,q.jsx)(D,{className:I(`w-3.5 h-3.5 shrink-0`,r.dotClass,t),"aria-label":n(`status.done`)}):e===`cancelled`?(0,q.jsx)(ue,{className:I(`w-3.5 h-3.5 shrink-0`,r.dotClass,t),"aria-label":n(`status.cancelled`)}):r.pulsing?(0,q.jsxs)(`span`,{className:I(`relative flex shrink-0 h-2.5 w-2.5`,t),"aria-label":n(`status.inProgress`),children:[(0,q.jsx)(`span`,{className:I(`animate-ping absolute inline-flex h-full w-full rounded-full opacity-60`,r.dotClass)}),(0,q.jsx)(`span`,{className:I(`relative inline-flex rounded-full h-2.5 w-2.5`,r.dotClass)})]}):(0,q.jsx)(`span`,{className:I(`inline-flex rounded-full h-2.5 w-2.5 shrink-0`,r.dotClass,t),"aria-label":n(r.labelKey)})}function et({status:e,className:t}){let{t:n}=p(`specs`),r=Qe[e];return(0,q.jsxs)(`span`,{className:I(`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[11px] font-medium border`,e===`todo`&&`bg-slate-500/10 border-slate-500/30 text-slate-400 aurora-light:bg-muted aurora-light:border-border aurora-light:text-muted-foreground`,e===`in_progress`&&`bg-blue-500/10 border-blue-500/30 text-blue-400 aurora-light:bg-accent-info/10 aurora-light:border-accent-info/30 aurora-light:text-accent-info`,e===`on_review`&&`bg-accent-warning/10 border-accent-warning/30 text-accent-warning`,e===`done`&&`bg-emerald-500/10 border-emerald-500/30 text-emerald-400 aurora-light:bg-accent-success/10 aurora-light:border-accent-success/30 aurora-light:text-accent-success`,e===`cancelled`&&`bg-red-500/10 border-red-500/30 text-red-400/60 aurora-light:bg-destructive/10 aurora-light:border-destructive/30 aurora-light:text-destructive/70`,t),children:[(0,q.jsx)($e,{status:e}),n(r.labelKey)]})}async function tt(e,t,n){let r=new FormData;r.append(`file`,t);let i=await fetch(`${N()}/tickets/${e}/attachments`,{method:`POST`,body:r,signal:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error??u.t(`attachments:errors.uploadFailed`,{status:i.status}))}return(await i.json()).attachment}async function nt(e,t){let n=await fetch(`${N()}/tickets/${e}/attachments/${t}`,{method:`DELETE`});if(!n.ok&&n.status!==404)throw Error(u.t(`attachments:errors.deleteFailed`,{status:n.status}))}async function rt(e){let t=await fetch(`${N()}/tickets/${e}/attachments`,{method:`DELETE`});if(!t.ok&&t.status!==404)throw Error(u.t(`attachments:errors.bulkDeleteFailed`,{status:t.status}))}async function it(e){let t=await fetch(`${N()}/tickets/${e}/attachments`);if(!t.ok)throw Error(u.t(`attachments:errors.listFailed`,{status:t.status}));return(await t.json()).attachments}function at(e,t){return`${N()}/tickets/${e}/attachments/${t}`}async function ot(e,t){let n=await fetch(at(e,t));if(!n.ok)throw Error(u.t(`attachments:errors.fetchFailed`,{status:n.status}));return n.blob()}var st=`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/csv,text/plain,application/json,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/sql,application/x-sql,text/sql,text/x-sql,.sql`,ct=new Set(st.split(`,`).filter(e=>!e.startsWith(`.`))),lt=/\.sql$/i,ut=/\.(png|jpe?g|gif|webp)$/i;function dt(e){return ct.has(e.type)||lt.test(e.name)||ut.test(e.name)}function ft(){return typeof window<`u`&&window.__TAURI_INTERNALS__!==void 0}function pt(e){return Function(`s`,`return import(s)`)(e).catch(()=>null)}async function mt(e){if(ft()){try{let t=await pt(`@tauri-apps/plugin-opener`);if(t?.revealItemInDir){await t.revealItemInDir(e);return}}catch{}try{await(await pt(`@tauri-apps/api/shell`))?.open?.(e)}catch{}}}async function Q(e){if(ft())try{let t=await i(()=>import(`./dist-js-BCUhGUXS.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70]));if(typeof t.open==`function`){await t.open(e);return}}catch(e){console.warn(`[openExternalUrl] tauri shell open failed:`,e)}try{window.open(e,`_blank`,`noopener,noreferrer`)}catch{}}function ht(e,t){let n=()=>l(t?.in,NaN),r=t?.additionalDigits??2,i=bt(e),a;if(i.date){let e=xt(i.date,r);a=St(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,u;if(i.time&&(s=wt(i.time),isNaN(s)))return n();if(i.timezone){if(u=Et(i.timezone),isNaN(u))return n()}else{let e=new Date(o+s),n=c(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return c(o+s+u,t?.in)}var gt={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},_t=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,vt=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,yt=/^([+-])(\d{2})(?::?(\d{2}))?$/;function bt(e){let t={},n=e.split(gt.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],gt.timeZoneDelimiter.test(t.date)&&(t.date=e.split(gt.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=gt.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function xt(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function St(e,t){if(t===null)return new Date(NaN);let n=e.match(_t);if(!n)return new Date(NaN);let r=!!n[4],i=Ct(n[1]),a=Ct(n[2])-1,o=Ct(n[3]),s=Ct(n[4]),c=Ct(n[5])-1;if(r)return Mt(t,s,c)?Dt(t,s,c):new Date(NaN);{let e=new Date(0);return!At(t,a,o)||!jt(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function Ct(e){return e?parseInt(e):1}function wt(e){let t=e.match(vt);if(!t)return NaN;let n=Tt(t[1]),r=Tt(t[2]),i=Tt(t[3]);return Nt(n,r,i)?n*o+r*d+i*1e3:NaN}function Tt(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function Et(e){if(e===`Z`)return 0;let t=e.match(yt);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return Pt(r,i)?n*(r*o+i*d):NaN}function Dt(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var Ot=[31,null,31,30,31,30,31,31,30,31,30,31];function kt(e){return e%400==0||e%4==0&&e%100!=0}function At(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Ot[t]||(kt(e)?29:28))}function jt(e,t){return t>=1&&t<=(kt(e)?366:365)}function Mt(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function Nt(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Pt(e,t){return t>=0&&t<=59}function Ft({ticketKey:e,attachment:t,onClose:n}){let{t:r}=p(`attachments`),[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(null);if((0,G.useEffect)(()=>{if(!t)return;function e(e){e.key===`Escape`&&n()}document.addEventListener(`keydown`,e);let r=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.removeEventListener(`keydown`,e),document.body.style.overflow=r}},[t,n]),(0,G.useEffect)(()=>{if(!t){a(null),s(null);return}let n=!1;return a(null),s(null),ot(e,t.id).then(e=>{n||a(URL.createObjectURL(e))}).catch(e=>{n||s(e instanceof Error?e.message:r(`errors.loadFailed`))}),()=>{n=!0}},[t,e]),(0,G.useEffect)(()=>()=>{i&&URL.revokeObjectURL(i)},[i]),!t)return null;let c=t.mimeType.startsWith(`image/`),l=t.mimeType===`application/pdf`;return(0,q.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":r(`lightbox.preview`,{name:t.filename}),className:`fixed inset-0 z-[100] flex flex-col bg-black/85 backdrop-blur-sm animate-in fade-in-0 duration-200`,onClick:n,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-white/10 bg-black/40`,onClick:e=>e.stopPropagation(),children:[(0,q.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":r(`lightbox.backToDesktop`),className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-md text-sm text-white/85 hover:bg-white/10 hover:text-white transition-colors`,children:[(0,q.jsx)(g,{className:`w-4 h-4`}),r(`common:actions.back`)]}),(0,q.jsxs)(`div`,{className:`flex-1 text-center min-w-0 px-4`,children:[(0,q.jsx)(`div`,{className:`text-sm font-medium text-white/95 truncate`,children:t.filename}),(0,q.jsx)(`div`,{className:`text-[11px] text-white/50`,children:t.mimeType})]}),(0,q.jsxs)(`a`,{href:i??`#`,download:t.filename,onClick:e=>{e.stopPropagation(),i||e.preventDefault()},className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-md text-sm text-white/85 hover:bg-white/10 hover:text-white transition-colors`,"aria-label":r(`lightbox.download`),children:[(0,q.jsx)(O,{className:`w-4 h-4`}),r(`lightbox.download`)]})]}),(0,q.jsx)(`div`,{className:I(`flex-1 flex items-center justify-center overflow-auto p-6`),onClick:n,children:o?(0,q.jsx)(`div`,{onClick:e=>e.stopPropagation(),className:`text-center text-white/80 px-8 py-10 rounded-lg bg-white/5 border border-white/10`,children:(0,q.jsx)(`p`,{className:`text-sm`,children:r(`lightbox.loadError`,{error:o})})}):i?c?(0,q.jsx)(`img`,{src:i,alt:t.filename,onClick:e=>e.stopPropagation(),className:`max-h-full max-w-full rounded-lg shadow-2xl animate-in zoom-in-95 duration-200`}):l?(0,q.jsx)(`iframe`,{src:i,title:t.filename,onClick:e=>e.stopPropagation(),className:`w-full h-full max-w-5xl bg-white rounded-lg shadow-2xl`}):(0,q.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`text-center text-white/80 px-8 py-10 rounded-lg bg-white/5 border border-white/10`,children:[(0,q.jsx)(`p`,{className:`text-sm mb-3`,children:r(`lightbox.previewUnavailable`)}),(0,q.jsxs)(`a`,{href:i,download:t.filename,className:`inline-flex items-center gap-2 px-4 py-2 rounded-md bg-white/10 hover:bg-white/20 text-white transition-colors`,children:[(0,q.jsx)(O,{className:`w-4 h-4`}),r(`lightbox.downloadFile`,{name:t.filename})]})]}):(0,q.jsx)(`div`,{onClick:e=>e.stopPropagation(),className:`text-center text-white/70 px-8 py-10 rounded-lg bg-white/5 border border-white/10`,children:(0,q.jsx)(`p`,{className:`text-sm`,children:r(`lightbox.loading`)})})})]})}function It(e,t){let n=new Set,r=[];for(let i of[...e,...t])n.has(i.id)||(n.add(i.id),r.push(i));return r}function Lt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Rt(e){return e.startsWith(`image/`)?`🖼`:e===`application/pdf`?`📄`:e===`text/csv`||e.includes(`spreadsheetml`)||e===`application/vnd.ms-excel`?`📊`:e===`application/json`?`{ }`:e===`text/plain`||e.includes(`sql`)?`📝`:`📎`}function zt(e){try{return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}catch{return e}}function Bt({ticketKey:e,attachments:t,onChange:n,className:r}){let{t:i}=p(`attachments`),[a,o]=(0,G.useState)(new Set),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(null);if((0,G.useEffect)(()=>{let r=!1;return it(e).then(e=>{if(r)return;let i=It(t,e);i.length!==t.length&&n?.(i)}).catch(()=>{}),()=>{r=!0}},[e]),!t||t.length===0)return null;let d=[...t].sort((e,t)=>e.addedAt<t.addedAt?1:-1);async function f(r){c(null),o(e=>{let t=new Set(e);return t.add(r.id),t});try{await nt(e,r.id),await new Promise(e=>setTimeout(e,160)),n?.(t.filter(e=>e.id!==r.id))}catch(e){c(e instanceof Error?e.message:i(`errors.removeFailed`)),o(e=>{let t=new Set(e);return t.delete(r.id),t})}}return(0,q.jsxs)(`section`,{className:I(`mt-4`,r),"aria-label":i(`section.ariaLabel`),children:[(0,q.jsxs)(`header`,{className:`flex items-center justify-between mb-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:i(`section.title`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:i(`section.fileCount`,{count:d.length})})]}),(0,q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:d.map(e=>{let t=a.has(e.id);return(0,q.jsxs)(`li`,{className:I(`flex items-center gap-3 px-2.5 py-2 rounded-md border border-border bg-card/60 hover:bg-card transition-all duration-200`,t&&`opacity-0 scale-95 max-h-0 py-0 border-transparent overflow-hidden`),children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`w-6 text-center text-sm shrink-0`,children:Rt(e.mimeType)}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>u(e),className:`flex-1 min-w-0 flex flex-col text-sm text-left hover:text-primary transition-colors`,children:[(0,q.jsx)(`span`,{className:`font-medium truncate text-foreground`,children:e.filename}),(0,q.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[Lt(e.size),` · `,zt(e.addedAt)]})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>u(e),className:`text-[11px] text-primary hover:underline shrink-0`,children:i(`common:actions.open`)}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>f(e),"aria-label":i(`removeFile`,{name:e.filename}),disabled:t,className:`w-6 h-6 inline-flex items-center justify-center rounded text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-50`,children:`×`})]},e.id)})}),s&&(0,q.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:s}),(0,q.jsx)(Ft,{ticketKey:e,attachment:l,onClose:()=>u(null)})]})}function Vt({ticketId:e,onClose:t}){let{t:n}=p(`code`),r=a(),{activeProjectId:i}=P(),[o,s]=(0,G.useState)(null);return(0,G.useEffect)(()=>{if(!We)return;let t=new AbortController;return s(null),fetch(`${N()}/code/provenance?ticketId=${e}`,{signal:t.signal}).then(e=>e.ok?e.json():[]).then(e=>{s(Array.isArray(e)?e:[])}).catch(e=>{e?.name!==`AbortError`&&s([])}),()=>t.abort()},[e,i]),!We||!o||o.length===0?null:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:n(`ticketFiles.title`)}),(0,q.jsx)(`ul`,{className:`space-y-1`,children:o.map((e,i)=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{t(),r(`/code?path=${encodeURIComponent(e.path)}`)},className:`w-full text-left flex items-center gap-2 rounded px-2 py-1 text-xs hover:bg-muted/40`,children:[(0,q.jsx)(e.kind===`created`?z:e.kind===`deleted`?Ee:ne,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{className:`font-mono truncate flex-1`,children:e.path}),e.jobId&&(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] text-muted-foreground font-mono shrink-0`,title:n(`ticketFiles.jobTitle`,{jobId:e.jobId}),children:[(0,q.jsx)(B,{className:`h-3 w-3`}),e.jobId.length>10?e.jobId.slice(0,10):e.jobId]}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wider shrink-0`,children:n(`kind.${e.kind}`)})]})},`${e.path}-${i}`))})]})}var Ht={critical:`bg-red-500/15 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive border-red-500/30 aurora-light:border-destructive/30`,high:`bg-orange-500/15 aurora-light:bg-accent-warning/10 text-orange-400 aurora-light:text-accent-warning border-orange-500/30 aurora-light:border-accent-warning/30`,medium:``,low:`bg-gray-500/15 aurora-light:bg-muted text-gray-400 aurora-light:text-muted-foreground border-gray-500/30 aurora-light:border-border`};function Ut(e){try{return R(new Date(e),{addSuffix:!0,locale:s()})}catch{return e}}function Wt({tickets:e,excludeIds:t,onSelect:n}){let{t:r}=p(`tickets`),[i,a]=(0,G.useState)(``),o=(0,G.useMemo)(()=>{let n=new Set(t),r=e.filter(e=>e.status!==`cancelled`&&!n.has(e.id));if(!i.trim())return r;let a=i.toLowerCase();return r.filter(e=>e.title.toLowerCase().includes(a)||e.description.toLowerCase().includes(a))},[e,t,i]);return(0,q.jsxs)(`div`,{"data-testid":`spec-compare-picker`,className:`h-full flex flex-col rounded-xl bg-card border border-border/40 shadow-2xl shadow-black/50 overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`px-4 py-3 border-b border-border/30 flex items-center gap-2`,children:[(0,q.jsx)(U,{className:`w-3.5 h-3.5 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`text-xs font-semibold text-foreground`,children:r(`comparePicker.title`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:r(`comparePicker.count`,{n:o.length})})]}),(0,q.jsx)(`div`,{className:`px-4 py-2 border-b border-border/20`,children:(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(A,{className:`absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,q.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:r(`comparePicker.searchPlaceholder`),className:`w-full h-7 rounded border border-border bg-input pl-7 pr-2 text-[11px] text-foreground placeholder:text-muted-foreground outline-none focus:border-accent-primary/60`})]})}),(0,q.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`spec-compare-picker-list`,children:o.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-center px-4 py-8 gap-2`,children:[(0,q.jsx)(U,{className:`w-6 h-6 text-muted-foreground/40`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.trim()?r(`comparePicker.noMatches`):r(`comparePicker.empty`)})]}):(0,q.jsx)(`ul`,{className:`divide-y divide-border/10`,children:o.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,"data-testid":`spec-compare-card-${e.id}`,onClick:()=>n(e.id),className:`w-full text-left px-4 py-2.5 hover:bg-accent/30 transition-colors flex items-start gap-2 group`,children:[(0,q.jsx)($e,{status:e.status}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:[`#`,e.id]}),e.priority&&Ht[e.priority]&&(0,q.jsx)(`span`,{className:`inline-flex items-center rounded px-1 py-0.5 text-[9px] font-medium border ${Ht[e.priority]}`,children:r(`priority.${e.priority}`)})]}),(0,q.jsx)(`p`,{className:`mt-0.5 text-xs text-foreground truncate group-hover:text-accent-primary transition-colors`,children:e.title||r(`untitled`)}),e.description&&(0,q.jsx)(`p`,{className:`mt-0.5 text-[10px] text-muted-foreground line-clamp-1`,children:e.description.slice(0,120)}),e.labels&&e.labels.length>0&&(0,q.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:[e.labels.slice(0,3).map(e=>(0,q.jsx)(`span`,{className:`inline-flex items-center rounded px-1 py-0.5 text-[9px] bg-accent/40 text-foreground/60`,children:e},e)),e.labels.length>3&&(0,q.jsxs)(`span`,{className:`text-[9px] text-muted-foreground`,children:[`+`,e.labels.length-3]})]}),(0,q.jsx)(`p`,{className:`mt-1 text-[9px] text-muted-foreground`,children:r(`meta.updatedAgo`,{time:Ut(e.updated_at)})})]})]})},e.id))})})]})}var Gt=.25,Kt=.75;function qt({state:e,leftTicket:t,rightTicket:n,allTickets:r,allLabels:i,onSave:a,onDelete:o,onOpenTicket:s,onCloseAll:c,onSetCompared:l,onSetRatio:u,onExitSplit:d}){let f=(0,G.useRef)(null),p=(0,G.useRef)(null),[m,h]=(0,G.useState)(!0);(0,G.useEffect)(()=>{let e=setTimeout(()=>h(!1),320);return()=>clearTimeout(e)},[]);let g=(0,G.useCallback)(e=>{if(!p.current)return;let t=window.innerWidth,n=e.clientX/t;u(Math.min(Kt,Math.max(Gt,n)))},[u]),_=(0,G.useCallback)(e=>{if(!p.current)return;let{pointerId:t,element:n}=p.current;try{n.releasePointerCapture(t)}catch{}p.current=null,window.removeEventListener(`pointermove`,g),window.removeEventListener(`pointerup`,_),window.removeEventListener(`pointercancel`,_)},[g]),v=(0,G.useCallback)(e=>{let t=e.currentTarget;try{t.setPointerCapture(e.pointerId)}catch{}p.current={pointerId:e.pointerId,element:t},window.addEventListener(`pointermove`,g),window.addEventListener(`pointerup`,_),window.addEventListener(`pointercancel`,_)},[g,_]);(0,G.useEffect)(()=>()=>{window.removeEventListener(`pointermove`,g),window.removeEventListener(`pointerup`,_),window.removeEventListener(`pointercancel`,_);let e=p.current;if(e){try{e.element.releasePointerCapture(e.pointerId)}catch{}p.current=null}},[g,_]);let y=(0,G.useCallback)(t=>{let n=.04;t.key===`ArrowLeft`?(t.preventDefault(),u(Math.max(Gt,e.splitRatio-n))):t.key===`ArrowRight`?(t.preventDefault(),u(Math.min(Kt,e.splitRatio+n))):t.key===`Home`?(t.preventDefault(),u(Gt)):t.key===`End`?(t.preventDefault(),u(Kt)):t.key===`0`&&(t.preventDefault(),u(.5))},[u,e.splitRatio]),b=e=>{e.target===e.currentTarget&&c()},x=u=>{let d=u===e.originSide,f=u===`left`?t:n;return f?(0,q.jsx)(Hn,{ticket:f,allLabels:i,allTickets:r,onClose:d?c:()=>l(null,u),onOpenTicket:s,onSave:a,onDelete:o,embedded:!0},`${u}-${f.id}`):(0,q.jsx)(Wt,{tickets:r,excludeIds:[t?.id,n?.id].filter(e=>e!=null),onSelect:e=>l(e,u)})},S=(e.splitRatio*100).toFixed(2),C=((1-e.splitRatio)*100).toFixed(2);return(0,q.jsxs)(`div`,{ref:f,"data-testid":`split-view-shell`,className:`fixed inset-0 z-[68] flex`,onClick:b,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/70 pointer-events-none`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`relative flex w-full h-full`,style:{transition:m?`opacity 280ms cubic-bezier(0.34, 1.56, 0.64, 1)`:void 0},children:[(0,q.jsx)(`div`,{"data-testid":`split-panel-left`,className:`relative h-full overflow-hidden`,style:{width:`${S}%`,transition:m?`width 280ms cubic-bezier(0.34, 1.56, 0.64, 1)`:void 0},children:(0,q.jsx)(`div`,{className:`h-full flex items-center justify-center p-2`,children:(0,q.jsx)(`div`,{className:`w-full h-full max-h-[95vh]`,children:x(`left`)})})}),(0,q.jsx)(`div`,{"data-testid":`split-divider`,role:`separator`,"aria-orientation":`vertical`,"aria-valuenow":Math.round(e.splitRatio*100),"aria-valuemin":Math.round(Gt*100),"aria-valuemax":Math.round(Kt*100),tabIndex:0,onPointerDown:v,onKeyDown:y,className:`relative z-10 w-2 cursor-col-resize bg-border/40 hover:bg-accent-primary/40 transition-colors focus:outline-none focus:bg-accent-primary/60`}),(0,q.jsx)(`div`,{"data-testid":`split-panel-right`,className:`relative h-full overflow-hidden`,style:{width:`${C}%`,transition:m?`width 280ms cubic-bezier(0.34, 1.56, 0.64, 1)`:void 0},children:(0,q.jsx)(`div`,{className:`h-full flex items-center justify-center p-2`,children:(0,q.jsx)(`div`,{className:`w-full h-full max-h-[95vh]`,children:x(`right`)})})})]})]})}var Jt=.5,Yt=.25,Xt=.75,Zt={leftId:null,rightId:null,originSide:null,splitRatio:Jt};function Qt(e){return Number.isFinite(e)?Math.min(Xt,Math.max(Yt,e)):Jt}function $t(e,t){switch(t.type){case`openCentered`:return e.originSide!==null&&e.leftId!==t.id&&e.rightId!==t.id?{leftId:t.id,rightId:null,originSide:null,splitRatio:Jt}:e.originSide!==null&&(e.leftId===t.id||e.rightId===t.id)?e:{...Zt,leftId:t.id};case`closeAll`:return Zt;case`enterSplit`:{let n=t.ticketId??e.leftId;return n===null||e.originSide!==null?e:t.side===`left`?{leftId:n,rightId:null,originSide:`left`,splitRatio:Jt}:{leftId:null,rightId:n,originSide:`right`,splitRatio:Jt}}case`setComparedTicket`:{if(e.originSide===null)return e;let n=e.originSide===`left`?`right`:`left`;return t.side===n?t.side===`left`?{...e,leftId:t.id}:{...e,rightId:t.id}:e}case`exitSplit`:{if(e.originSide===null)return e;let t=e.originSide===`left`?e.leftId:e.rightId;return{...Zt,leftId:t}}case`setSplitRatio`:return{...e,splitRatio:Qt(t.ratio)};default:return e}}var en=(0,G.createContext)(null),tn=900;function nn({children:e}){let[t,n]=(0,G.useReducer)($t,Zt),{tickets:r,updateTicket:i,deleteTicket:a}=Ie(),{activeProjectId:o,setActiveProjectId:s}=P(),c=(0,G.useRef)(null);(0,G.useEffect)(()=>{n({type:`closeAll`});let e=c.current;e&&(c.current=null,e.projectId===o&&n({type:`openCentered`,id:e.ticketId}))},[o]);let l=(0,G.useCallback)(e=>n({type:`openCentered`,id:e}),[]),u=(0,G.useCallback)((e,t)=>{if(e===o){n({type:`openCentered`,id:t});return}c.current={projectId:e,ticketId:t},s(e)},[o,s]),d=(0,G.useCallback)(()=>n({type:`closeAll`}),[]),f=(0,G.useCallback)((e,t)=>{typeof window<`u`&&window.innerWidth<tn||n({type:`enterSplit`,side:e,ticketId:t})},[]),p=(0,G.useCallback)((e,t)=>n({type:`setComparedTicket`,id:e,side:t}),[]),m=(0,G.useCallback)(()=>n({type:`exitSplit`}),[]),h=(0,G.useCallback)(e=>n({type:`setSplitRatio`,ratio:e}),[]);(0,G.useEffect)(()=>{if(typeof window>`u`)return;function e(){window.innerWidth<tn&&n({type:`exitSplit`})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let g=(0,G.useMemo)(()=>{let e=new Set;for(let t of r)for(let n of t.labels??[])e.add(n);return Array.from(e).sort()},[r]),_=t.leftId==null?null:r.find(e=>e.id===t.leftId)??null,v=t.rightId==null?null:r.find(e=>e.id===t.rightId)??null,y=(0,G.useMemo)(()=>({openTicketDetail:l,openTicketDetailInProject:u,closeTicketDetail:d,enterSplit:f,setComparedTicket:p,exitSplit:m,setSplitRatio:h,state:t}),[l,u,d,f,p,m,h,t]),b=t.originSide!==null;return(0,q.jsxs)(en.Provider,{value:y,children:[e,!b&&_&&(0,q.jsx)(Hn,{ticket:_,allLabels:g,allTickets:r,onClose:d,onOpenTicket:l,onSave:i,onDelete:a},_.id),b&&(0,q.jsx)(qt,{state:t,leftTicket:_,rightTicket:v,allTickets:r,allLabels:g,onSave:i,onDelete:a,onOpenTicket:l,onCloseAll:d,onSetCompared:p,onSetRatio:h,onExitSplit:m})]})}function rn(){return(0,G.useContext)(en)||{openTicketDetail:()=>{typeof console<`u`&&console.warn(`[TicketDetailModalContext] openTicketDetail called without provider`)},openTicketDetailInProject:()=>{typeof console<`u`&&console.warn(`[TicketDetailModalContext] openTicketDetailInProject called without provider`)},closeTicketDetail:()=>{},enterSplit:()=>{},setComparedTicket:()=>{},exitSplit:()=>{},setSplitRatio:()=>{},state:Zt}}function an(e){return e<.005?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function on(e){return e<1e3?`${e} ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`}function sn({ticketId:e}){let{t}=p(`tickets`),[n,r]=(0,G.useState)(null),i=a(),{activeProjectId:o}=P(),{closeTicketDetail:s}=rn();if((0,G.useEffect)(()=>{let t=new AbortController;return r(null),fetch(`${N()}/tickets/${e}/spending-summary`,{signal:t.signal}).then(e=>e.ok?e.json():null).then(e=>{e&&r(e)}).catch(()=>{}),()=>t.abort()},[e,o]),!n||!n.bySurface||!n.totalRuns||n.totalRuns===0)return null;let c=Object.entries(n.bySurface).filter(([,e])=>e.count>0).map(([e,n])=>t(`spendingLine.breakdownItem`,{n:n.count,label:Se[e].toLowerCase()})).join(` + `);return(0,q.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),s(),i(`/analytics?ticketId=${e}`)},className:`mt-1.5 group inline-flex items-center gap-1.5 text-[11px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,"aria-label":t(`spendingLine.ariaLabel`),children:[(0,q.jsxs)(`span`,{className:`tabular-nums font-medium text-foreground`,title:(n.estimatedCostUsd??0)>0?t(`spendingLine.estimatedTooltip`):void 0,children:[(n.estimatedCostUsd??0)>0?`~`:``,an(n.totalCostUsd)]}),(0,q.jsx)(`span`,{className:`text-muted-foreground/60`,children:`·`}),(0,q.jsx)(`span`,{className:`tabular-nums`,children:t(`spendingLine.turns`,{count:n.totalTurns})}),(0,q.jsx)(`span`,{className:`text-muted-foreground/60`,children:`·`}),(0,q.jsx)(`span`,{className:`tabular-nums`,children:t(`spendingLine.active`,{duration:on(n.activeDurationMs)})}),c&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground/60`,children:`·`}),(0,q.jsx)(`span`,{children:c})]}),(0,q.jsx)(v,{className:`w-3 h-3 opacity-0 group-hover:opacity-100 transition-opacity`})]})}var cn=/^\d{4}-\d{2}-\d{2}T/;function ln(e){if(cn.test(e))try{return{text:R(ht(e),{addSuffix:!0,locale:s()}),title:e}}catch{}return{text:e}}function un({localId:e}){let{t}=p(`jira`),{activeProjectId:n}=P(),r=Xe(),[i,a]=(0,G.useState)(null);if((0,G.useEffect)(()=>{if(!Ge||!r.connected)return;let t=!1;return a(null),L.getSpecDetails(e).then(e=>{t||a(e)}).catch(()=>{t||a(null)}),()=>{t=!0}},[e,n,r.connected]),!Ge||!r.connected||!i)return null;let o=i.development,s=i.fields.length>0,c=o.pullRequests.length>0,l=o.branches.length>0,u=(o.commits?.length??0)>0;return!s&&!c&&!l&&!u?null:(0,q.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-details-panel`,children:[s&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:t(`detail.detailsTitle`)}),(0,q.jsx)(`div`,{className:`space-y-1.5`,children:i.fields.map((e,t)=>{let n=ln(e.value);return(0,q.jsxs)(`div`,{className:`text-xs`,children:[(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide block`,children:e.label}),e.href?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{Q(e.href)},className:`inline-flex items-center gap-1 text-accent-info hover:underline text-left`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.value}),(0,q.jsx)(ee,{className:`w-3 h-3 shrink-0`})]}):(0,q.jsx)(`span`,{className:`text-foreground/80 whitespace-pre-line`,title:n.title,children:n.text})]},`${e.label}-${t}`)})})]}),(c||l||u)&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:t(`detail.developmentTitle`)}),c&&(0,q.jsxs)(`div`,{className:`mb-2`,children:[(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide block mb-1`,children:t(`detail.dev.pullRequests`)}),(0,q.jsx)(`div`,{className:`space-y-1`,children:o.pullRequests.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{Q(e.url)},className:`w-full flex items-start gap-1.5 text-left text-xs hover:bg-accent-info/10 rounded px-1 py-0.5`,"data-testid":`jira-dev-pr`,children:[(0,q.jsx)(De,{className:`w-3 h-3 mt-0.5 shrink-0 text-accent-info`}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`truncate text-foreground/80 block`,children:e.title}),(0,q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[e.status,e.sourceBranch?` · ${e.sourceBranch} → ${e.destBranch??``}`:``]})]})]},e.url))})]}),l&&(0,q.jsxs)(`div`,{className:`mb-2`,children:[(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide block mb-1`,children:t(`detail.dev.branches`)}),(0,q.jsx)(`div`,{className:`space-y-1`,children:o.branches.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{Q(e.url)},className:`w-full flex items-center gap-1.5 text-left text-xs hover:bg-accent-info/10 rounded px-1 py-0.5`,"data-testid":`jira-dev-branch`,children:[(0,q.jsx)(k,{className:`w-3 h-3 shrink-0 text-accent-info`}),(0,q.jsx)(`span`,{className:`truncate font-mono text-foreground/80`,children:e.name}),e.repo&&(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground truncate`,children:e.repo})]},e.url))})]}),u&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide block mb-1`,children:t(`detail.dev.commits`)}),(0,q.jsx)(`div`,{className:`space-y-1`,children:o.commits.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{Q(e.url)},className:`w-full flex items-center gap-1.5 text-left text-xs hover:bg-accent-info/10 rounded px-1 py-0.5`,"data-testid":`jira-dev-commit`,children:[(0,q.jsx)(B,{className:`w-3 h-3 shrink-0 text-accent-info`}),(0,q.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground shrink-0`,children:e.displayId}),(0,q.jsx)(`span`,{className:`truncate text-foreground/80`,children:e.message})]},e.url))})]})]})]})}var dn=e(r(),1);function fn({open:e,url:t,projectId:n,onClose:r}){let{t:i}=p(`browser`),a=C({projectId:n,open:e,initialUrl:t}),{canvasRef:o,viewport:s,status:c,errorMsg:l,url:u,title:d,popup:f}=a,[m,h]=(0,G.useState)(t),S=(0,G.useRef)(a.forwardInput);S.current=a.forwardInput;let T=(0,G.useRef)(null),E=(0,G.useCallback)(()=>(T.current??=b(e=>S.current(e)),T.current),[]);(0,G.useEffect)(()=>()=>{T.current?.dispose(),T.current=null},[]),(0,G.useEffect)(()=>{u&&h(u)},[u]),(0,G.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r]);let D=(0,G.useCallback)((e,t)=>{let n=o.current?.getBoundingClientRect();return n?_({x:e,y:t},{left:n.left,top:n.top,width:n.width,height:n.height},s):{x:0,y:0}},[o,s]),te=e=>e===2?`right`:e===1?`middle`:`left`,O=(0,G.useCallback)(e=>{let t=D(e.clientX,e.clientY);E().move(t.x,t.y)},[D,E]),ne=(0,G.useCallback)(e=>{let t=D(e.clientX,e.clientY),n=E();n.move(t.x,t.y),n.flush(),a.forwardInput({type:`mouse`,action:`down`,x:t.x,y:t.y,button:te(e.button),clickCount:e.detail||1})},[D,a,E]),k=(0,G.useCallback)(e=>{let t=D(e.clientX,e.clientY),n=E();n.move(t.x,t.y),n.flush(),a.forwardInput({type:`mouse`,action:`up`,x:t.x,y:t.y,button:te(e.button),clickCount:e.detail||1})},[D,a,E]),re=(0,G.useCallback)(e=>{let t=D(e.clientX,e.clientY);E().wheel(t.x,t.y,e.deltaX,e.deltaY)},[D,E]),ie=(0,G.useCallback)(e=>{if(e.key===`Escape`)return;let t=e.metaKey||e.ctrlKey;if(t&&(e.key===`c`||e.key===`v`||e.key===`x`)){e.preventDefault();let t=e.key;(async()=>{try{if(t===`v`){let e=await navigator.clipboard.readText();e&&await a.clipboard(`paste`,e)}else{let{text:e}=await a.clipboard(t===`x`?`cut`:`copy`);e&&await navigator.clipboard.writeText(e)}}catch{}})();return}let n={type:`key`,action:`down`,key:e.key,code:e.code,text:!t&&e.key.length===1?e.key:void 0};a.forwardInput(n),(e.key===`Tab`||e.key===` `||e.key.startsWith(`Arrow`))&&e.preventDefault()},[a]),ae=(0,G.useCallback)(e=>{e.key!==`Escape`&&a.forwardInput({type:`key`,action:`up`,key:e.key,code:e.code})},[a]),oe=(0,G.useCallback)(()=>{a.navigate(`goto`,m)},[a,m]);return!e||typeof document>`u`?null:(0,dn.createPortal)((0,q.jsx)(`div`,{className:`fixed inset-0 z-[80] bg-background-deep/50 backdrop-blur-sm pointer-events-auto`,onClick:e=>{e.target===e.currentTarget&&r()},"data-testid":`webview-modal`,children:(0,q.jsxs)(`div`,{className:`absolute inset-2 flex flex-col border border-border rounded-lg bg-background-deep overflow-hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":i(`modal.dialogLabel`),onClick:e=>e.stopPropagation(),children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/50 bg-surface/80 shrink-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(F,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":i(`common:actions.back`),onClick:()=>a.navigate(`back`),children:(0,q.jsx)(g,{className:`w-4 h-4`})}),(0,q.jsx)(F,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":i(`modal.nav.forward`),onClick:()=>a.navigate(`forward`),children:(0,q.jsx)(v,{className:`w-4 h-4`})}),(0,q.jsx)(F,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":i(`modal.nav.reload`),onClick:()=>a.navigate(`reload`),children:(0,q.jsx)(x,{className:`w-4 h-4`})})]}),(0,q.jsxs)(`form`,{className:`flex-1 flex items-center gap-2 min-w-0`,onSubmit:e=>{e.preventDefault(),oe()},children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0 rounded-md border border-border bg-background px-2.5 py-1`,children:[(0,q.jsx)(y,{className:`w-3.5 h-3.5 text-muted-foreground shrink-0`}),(0,q.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),oe())},placeholder:i(`modal.address.placeholder`),"aria-label":i(`modal.address.label`),className:`flex-1 min-w-0 bg-transparent outline-none text-sm`})]}),(0,q.jsx)(F,{type:`submit`,size:`sm`,variant:`secondary`,className:`shrink-0`,disabled:c===`error`,children:i(`modal.address.go`)})]}),(0,q.jsx)(F,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":i(`modal.closeBrowser`),onClick:r,children:(0,q.jsx)(ue,{className:`w-4 h-4`})})]}),(0,q.jsxs)(`div`,{className:`px-3 py-1 text-[11px] text-muted-foreground truncate shrink-0 flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full shrink-0 ${c===`ready`?`bg-accent-success`:c===`error`?`bg-destructive`:`bg-accent-warning animate-pulse`}`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`truncate`,children:c===`connecting`?i(`modal.status.connecting`):c===`error`?l??i(`modal.status.unavailable`):d||``})]}),f&&(0,q.jsxs)(`div`,{"data-testid":`webview-popup-bar`,className:`flex items-center gap-2 px-3 py-1.5 text-xs border-b shrink-0 ${f.active?`bg-accent-info/10 border-accent-info/30 text-accent-info`:`bg-surface/70 border-border/40 text-muted-foreground`}`,children:[(0,q.jsx)(ee,{className:`w-3.5 h-3.5 shrink-0`}),f.active?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`truncate font-medium`,children:i(`popup.loginWindow`,{origin:w(f.url)})}),f.count>1&&(0,q.jsx)(`span`,{className:`shrink-0 opacity-70`,children:i(`popup.stacked`,{count:f.count-1})}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>a.setPopupView(`root`),className:`ml-auto shrink-0 inline-flex items-center gap-1 h-6 px-2 rounded-md border border-current/30 hover:bg-card/60 transition-colors`,children:[(0,q.jsx)(g,{className:`w-3 h-3`}),i(`popup.backToPage`)]})]}):(0,q.jsxs)(`button`,{type:`button`,onClick:()=>a.setPopupView(`popup`),className:`inline-flex items-center gap-1 h-6 px-2 rounded-md border border-border/50 hover:bg-card/60 hover:text-foreground transition-colors`,children:[i(`popup.show`),f.count>1&&(0,q.jsx)(`span`,{className:`opacity-70`,children:i(`popup.stacked`,{count:f.count-1})})]})]}),(0,q.jsx)(`div`,{className:`relative flex-1 min-h-0 overflow-hidden flex items-center justify-center outline-none`,tabIndex:0,onKeyDown:ie,onKeyUp:ae,children:c===`error`?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center max-w-md px-6`,children:[(0,q.jsx)(le,{className:`w-8 h-8 text-accent-warning`}),(0,q.jsx)(`p`,{className:`text-sm text-foreground/90`,children:l??i(`modal.error.unavailable`)})]}):(0,q.jsx)(`canvas`,{ref:o,className:`max-w-full max-h-full block shadow-2xl cursor-default`,onPointerMove:O,onPointerDown:ne,onPointerUp:k,onContextMenu:e=>e.preventDefault(),onWheel:re})})]})}),document.body)}var pn=(0,G.createContext)(null);function mn({children:e}){let{activeProjectId:t}=P(),[n,r]=(0,G.useState)(null),i=(0,G.useCallback)(e=>r(e),[]),a=S();return(0,q.jsxs)(pn.Provider,{value:{openWebView:i,canOpenWebView:a&&!!t},children:[e,a&&n&&t&&(0,q.jsx)(fn,{open:!0,url:n,projectId:t,onClose:()=>r(null)})]})}function hn(){return(0,G.useContext)(pn)??{openWebView:()=>{},canOpenWebView:!1}}var gn={analyzing:`activity:smash.stage.analyzing`,identifying:`activity:smash.stage.identifying`,ordering:`activity:smash.stage.ordering`},_n=(0,G.createContext)(null);function $(e){return`smash:${e}`}async function vn(e,t){try{let n=await fetch(`${j}/api/projects/${e}/tickets/${t}/smash`,{method:`POST`});if(n.ok)h.loading(u.t(`activity:smash.retrying`),{id:$(t)});else{let e=await n.json().catch(()=>({}));h.error(e.reason?u.t(`activity:smash.couldNotRetryWithReason`,{reason:e.reason}):u.t(`activity:smash.couldNotRetry`),{id:$(t)})}}catch(e){h.error(u.t(`activity:smash.retryFailed`,{message:e.message}),{id:$(t)})}}async function yn(e,t,n){try{let r=await fetch(`${j}/api/projects/${e}/tickets/${t}/smash/undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({smashedAt:n})});if(r.ok)h.success(u.t(`activity:smash.undone`),{id:$(t),duration:3e3});else{let e=await r.json().catch(()=>({}));h.error(e.reason?u.t(`activity:smash.undoFailedWithReason`,{reason:e.reason}):u.t(`activity:smash.undoFailed`),{id:$(t)})}}catch(e){h.error(u.t(`activity:smash.undoFailedWithReason`,{reason:e.message}),{id:$(t)})}}function bn({children:e}){let{registerHandler:t,unregisterHandler:n}=M(),[r,i]=(0,G.useState)({}),a=(0,G.useRef)(new Map),o=(0,G.useRef)(new Map),s=(0,G.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.started`)return;let n=t.ticketId,r=t.runId,o=t.projectId,s=t.timestamp,c=t.ticketTitle;typeof n!=`number`||!r||!o||(a.current.set(n,o),i(e=>({...e,[n]:{ticketId:n,runId:r,stage:`analyzing`,startedAt:s??new Date().toISOString(),ticketTitle:c}})),h.loading(u.t(gn.analyzing),{id:$(n),description:c?u.t(`activity:smash.onTitled`,{title:c}):u.t(`activity:smash.onThisSpec`)}))},[]),c=(0,G.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.progress`)return;let n=t.ticketId,r=t.stage;if(typeof n!=`number`||!r)return;let a;i(e=>{let t=e[n];return t?(a=t.ticketTitle,{...e,[n]:{...t,stage:r}}):e}),h.loading(u.t(gn[r]),{id:$(n),description:a?u.t(`activity:smash.onTitled`,{title:a}):u.t(`activity:smash.onThisSpec`)})},[]),l=(0,G.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.completed`)return;let n=t.ticketId,r=t.runId,a=t.projectId,s=t.smashedAt,c=t.childrenIds;typeof n!=`number`||!r||!a||!s||!c||(o.current.set(r,s),i(e=>{let t={...e};return delete t[n],t}),h.success(u.t(`activity:smash.split`,{count:c.length}),{id:$(n),duration:1e4,action:{label:u.t(`activity:smash.undoAction`),onClick:()=>void yn(a,n,s)}}))},[]),d=(0,G.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.failed`)return;let n=t.ticketId,r=t.projectId,o=t.reason??`unknown`;if(typeof n!=`number`||!r)return;a.current.set(n,r),i(e=>{let t={...e};return delete t[n],t});let s=o===`invalid-output`?u.t(`activity:smash.failReason.invalidOutput`):o===`timeout`?u.t(`activity:smash.failReason.timeout`):o===`model_error`?u.t(`activity:smash.failReason.modelError`):o===`crashed`?u.t(`activity:smash.failReason.crashed`):u.t(`activity:smash.failReason.generic`,{reason:o});h.error(u.t(`activity:smash.couldNotComplete`),{id:$(n),description:s,action:{label:u.t(`common:actions.retry`),onClick:()=>void vn(r,n)},duration:15e3})},[]),f=(0,G.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.undone`)return;let n=t.ticketId;typeof n==`number`&&(h.dismiss($(n)),h.success(u.t(`activity:smash.undone`),{id:$(n),duration:3e3}))},[]);(0,G.useLayoutEffect)(()=>(t(`_smash_started`,s),t(`_smash_progress`,c),t(`_smash_completed`,l),t(`_smash_failed`,d),t(`_smash_undone`,f),()=>{n(`_smash_started`),n(`_smash_progress`),n(`_smash_completed`),n(`_smash_failed`),n(`_smash_undone`)}),[t,n,s,c,l,d,f]),(0,G.useEffect)(()=>()=>{a.current.clear(),o.current.clear()},[]);let p=(0,G.useMemo)(()=>({inflight:r}),[r]);return(0,q.jsx)(_n.Provider,{value:p,children:e})}function xn(e){let t=(0,G.useContext)(_n);return!t||e==null?null:t.inflight[e]??null}var Sn=150,Cn={analyzing:0,identifying:1,ordering:2},wn={analyzing:`smash.stage.analyzing`,identifying:`smash.stage.identifying`,ordering:`smash.stage.ordering`};function Tn({stage:e,minDisplayMs:t=Sn}){let{t:n}=p(`activity`),[r,i]=(0,G.useState)(e),a=(0,G.useRef)(Date.now()),o=(0,G.useRef)(null);if((0,G.useEffect)(()=>{if(e===r)return;let n=Date.now()-a.current,s=Math.max(0,t-n);return o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{i(e),a.current=Date.now(),o.current=null},s),()=>{o.current&&clearTimeout(o.current)}},[e,r,t]),!r)return null;let s=Cn[r];return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md border border-accent-highlight/40 bg-accent-highlight/10 text-sm text-foreground`,role:`status`,"aria-live":`polite`,"data-testid":`smash-status-pills`,children:[(0,q.jsx)(re,{className:`h-4 w-4 animate-spin text-accent-highlight`,"aria-hidden":!0}),(0,q.jsx)(`div`,{className:`flex items-center gap-1.5`,children:[`analyzing`,`identifying`,`ordering`].map(e=>(0,q.jsx)(`span`,{className:[`inline-block w-1.5 h-1.5 rounded-full transition-all`,Cn[e]<=s?`bg-accent-highlight`:`bg-muted`,e===r?`scale-125`:`scale-100`].join(` `),"aria-hidden":!0},e))}),(0,q.jsx)(`span`,{className:`font-medium`,children:n(wn[r])})]})}var En={simple:{titleKey:`smashModal.modes.simple.title`,bulletKeys:[`smashModal.modes.simple.bullet1`,`smashModal.modes.simple.bullet2`,`smashModal.modes.simple.bullet3`],etaKey:`smashModal.modes.simple.eta`},full:{titleKey:`smashModal.modes.full.title`,bulletKeys:[`smashModal.modes.full.bullet1`,`smashModal.modes.full.bullet2`,`smashModal.modes.full.bullet3`,`smashModal.modes.full.bullet4`],etaKey:`smashModal.modes.full.eta`}};function Dn({open:e,ticketTitle:t,isReSmash:n,childrenCount:r,submitting:i=!1,onCancel:a,onConfirm:o}){let{t:s}=p(`activity`),[c,l]=(0,G.useState)(`simple`),{panelRef:u,panelStyle:d,headerHandleProps:m,resizeHandles:h,isFloating:g,guardBackdrop:_}=pe();return e?(0,q.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"data-testid":`smash-confirm-modal`,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:_(a)}),(0,q.jsxs)(`div`,{ref:u,className:`relative w-full max-w-lg m-4 rounded-xl glass-card border border-border/30 animate-in fade-in zoom-in-95 duration-150`,style:d,children:[(0,q.jsxs)(`div`,{...m,className:`flex items-start justify-between gap-3 px-5 py-4 border-b border-border/30 ${g?`cursor-grab active:cursor-grabbing`:``}`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0`,children:[(0,q.jsx)(H,{className:`w-5 h-5 text-accent-highlight shrink-0 mt-0.5`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:s(`smashModal.title`)}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground truncate`,title:t,children:t})]})]}),(0,q.jsx)(`button`,{type:`button`,onClick:a,className:`h-7 w-7 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-surface/50 transition-colors shrink-0`,"aria-label":s(`common:actions.close`),children:(0,q.jsx)(ue,{className:`w-4 h-4`})})]}),n&&r>0&&(0,q.jsx)(`div`,{className:`mx-5 mt-4 rounded-md border border-accent-warning/40 bg-accent-warning/10 px-3 py-2 text-xs text-foreground`,children:(0,q.jsx)(f,{t:s,i18nKey:`smashModal.reSmashWarning`,count:r})}),(0,q.jsxs)(`div`,{className:`px-5 py-4 space-y-3`,children:[(0,q.jsx)(`p`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:s(`smashModal.modePickerLabel`)}),[`simple`,`full`].map(e=>{let t=En[e],n=c===e;return(0,q.jsx)(`button`,{type:`button`,onClick:()=>l(e),disabled:i,className:`w-full text-left rounded-lg border px-3 py-3 transition-colors ${n?`border-accent-highlight/60 bg-accent-highlight/10`:`border-border/40 bg-card/40 hover:bg-card/60 hover:border-border/60`}`,"data-testid":`smash-mode-${e}`,children:(0,q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 h-3.5 w-3.5 rounded-full border-2 shrink-0 ${n?`border-accent-highlight bg-accent-highlight`:`border-muted-foreground/60`}`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[e===`full`&&(0,q.jsx)(de,{className:`w-3.5 h-3.5 text-accent-highlight`,"aria-hidden":!0}),s(t.titleKey)]}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:s(t.etaKey)})]}),(0,q.jsx)(`ul`,{className:`space-y-0.5`,children:t.bulletKeys.map(e=>(0,q.jsxs)(`li`,{className:`text-[11px] text-foreground/70 leading-snug`,children:[`• `,s(e)]},e))})]})]})},e)})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-5 py-3 border-t border-border/30 bg-surface/20`,children:[(0,q.jsx)(F,{variant:`ghost`,size:`sm`,onClick:a,disabled:i,children:s(`common:actions.cancel`)}),(0,q.jsxs)(F,{size:`sm`,onClick:()=>o(c),disabled:i,"data-testid":`smash-confirm-modal-continue`,children:[(0,q.jsx)(H,{className:`w-3.5 h-3.5 mr-1.5`}),s(i?`smashModal.starting`:n?`smashModal.confirmReSmash`:`smashModal.smash`)]})]})]}),(0,q.jsx)(ve,{handles:h})]}):null}var On=`## Contract Layer`;function kn(e,t){return!(!t||e.status===`draft`||e.parent_epic_id!=null||!e.description?.includes(On))}function An({ticket:e,projectId:t,featureFlagOn:n,childrenCount:r}){let{t:i}=p(`activity`),a=xn(e.id),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(!1),u=e.is_epic===!0,d=!u&&kn(e,n),f=u&&n,m=u&&r>0,g=(0,G.useCallback)(async n=>{l(!0);try{let r=await fetch(`${j}/api/projects/${t}/tickets/${e.id}/smash`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:n})});if(!r.ok){let e=await r.json().catch(()=>({}));h.error(e.reason?i(`smash.couldNotStartWithReason`,{reason:e.reason}):i(`smash.couldNotStart`));return}s(!1)}catch(e){h.error(i(`smash.smashFailed`,{message:e.message}))}finally{l(!1)}},[t,e.id,i]),_=(0,G.useCallback)(async n=>{if(m){l(!0);try{if(!(await fetch(`${j}/api/projects/${t}/tickets/${e.id}/children`,{method:`DELETE`})).ok){h.error(i(`smash.couldNotDeleteChildren`)),l(!1);return}}catch(e){h.error(i(`smash.deleteFailed`,{message:e.message})),l(!1);return}}await g(n)},[m,g,t,e.id,i]);return!d&&!f?null:a?(0,q.jsx)(`div`,{className:`flex flex-col gap-2`,"data-testid":`smash-actions-streaming`,children:(0,q.jsx)(Tn,{stage:a.stage})}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(F,{size:`sm`,variant:`outline`,onClick:()=>s(!0),className:`border-accent-highlight/40 text-accent-highlight hover:bg-accent-highlight/10`,"data-testid":f?`resmash-button`:`smash-button`,children:[(0,q.jsx)(H,{className:`w-3.5 h-3.5 mr-1.5`}),i(f?`smash.reSmashButton`:`smash.smashButton`)]}),(0,q.jsx)(Dn,{open:o,ticketTitle:e.title,isReSmash:m,childrenCount:r,submitting:c,onCancel:()=>s(!1),onConfirm:_})]})}function jn({epic:e,childExecutionOrder:t,totalChildren:n,onOpenEpic:r}){let{t:i}=p(`activity`);return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-accent-secondary/30 bg-accent-secondary/10 px-3 py-1.5 text-xs`,"data-testid":`epic-breadcrumb`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:r,className:`text-accent-secondary hover:underline font-medium`,children:[`← `,e.title]}),t!=null&&n>0&&(0,q.jsx)(`span`,{className:`text-foreground/60`,children:i(`epicChildren.step`,{order:t,total:n})})]})}var Mn={critical:`bg-red-400`,high:`bg-orange-400`,medium:`bg-yellow-400`,low:`bg-slate-400`};function Nn(e){return e?Mn[e]:`bg-muted`}function Pn(e){return[...e].sort((e,t)=>{let n=e.execution_order??1/0,r=t.execution_order??1/0;return n===r?e.id-t.id:n-r})}function Fn({ticket:e,allTickets:t,onOpenTicket:n}){let{t:r}=p(`activity`),i=e.is_epic===!0,a=e.parent_epic_id!=null;if(!i&&!a)return null;if(i){let i=Pn(t.filter(t=>t.parent_epic_id===e.id));return(0,q.jsx)(In,{header:r(`family.subSpecsHeader`,{count:i.length}),rows:i,currentId:e.id,onOpenTicket:n,emptyMessage:r(`family.emptySubSpecs`)})}let o=t.find(t=>t.id===e.parent_epic_id)??null,s=Pn(t.filter(t=>t.parent_epic_id===e.parent_epic_id)),c=o?[o,...s]:s;return(0,q.jsx)(In,{header:r(`family.familyHeader`,{count:s.length}),rows:c,currentId:e.id,onOpenTicket:n,emptyMessage:r(`family.noSiblings`)})}function In({header:e,rows:t,currentId:n,onOpenTicket:r,emptyMessage:i}){let{t:a}=p(`activity`);return(0,q.jsxs)(`div`,{"data-testid":`epic-family-sidebar`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5`,children:[(0,q.jsx)(H,{className:`w-3 h-3 text-accent-highlight`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:e})]}),t.length===0?(0,q.jsx)(`p`,{className:`text-[10px] text-foreground/50 italic`,children:i}):(0,q.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:t.map(e=>{let t=e.id===n,i=e.is_epic===!0;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{t||r(e.id)},disabled:t,"aria-label":a(i?`family.openParentEpic`:`family.openSubSpec`,{title:e.title}),"aria-current":t?`page`:void 0,className:[`w-full flex items-center gap-1.5 rounded px-1.5 py-1 text-left transition-colors`,t?`bg-accent-highlight/15 cursor-default`:`hover:bg-muted/30 cursor-pointer`].join(` `),"data-testid":`epic-family-row-${e.id}`,children:[i?(0,q.jsx)(E,{className:`w-3 h-3 text-accent-highlight flex-shrink-0`,"aria-hidden":!0}):(0,q.jsx)(`span`,{className:`text-[9px] tabular-nums text-foreground/40 w-3 text-center flex-shrink-0`,children:e.execution_order??`–`}),(0,q.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full flex-shrink-0 ${Nn(e.priority)}`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`text-[11px] truncate ${t?`text-foreground font-medium`:`text-foreground/80`}`,title:e.title,children:e.title})]})},e.id)})})]})}var Ln=900,Rn=.2,zn=[{value:`critical`,labelKey:`priority.critical`,className:`text-red-400`},{value:`high`,labelKey:`priority.high`,className:`text-orange-400`},{value:`medium`,labelKey:`priority.medium`,className:`text-yellow-400`},{value:`low`,labelKey:`priority.low`,className:`text-slate-400`}];function Bn(e){return e.jira_epic_key&&e.jira_url?e.jira_url.replace(/\/browse\/[^/]+$/,`/browse/${e.jira_epic_key}`):null}var Vn={manual:`source.manual`,"product-backlog":`source.productBacklog`,"propose-spec":`source.proposeSpec`,"get-backlog-specs":`source.getBacklogSpecs`,"free-prompt":`source.freePrompt`};function Hn({ticket:e,allLabels:t,allTickets:n,onClose:r,onOpenTicket:i,onSave:a,onDelete:o,rails:s,onMoveToRail:c,onRemoveFromRail:l,embedded:u=!1}){let{t:d}=p(`tickets`),{t:m}=p(`jira`),{activeProjectId:g,projects:_}=P(),{enterSplit:y,state:b}=rn(),x=b.originSide!==null,S=_.find(e=>e.id===g)?.provider!==`codex`,C=(0,G.useMemo)(()=>(n??[]).filter(t=>t.parent_epic_id===e.id),[n,e.id]),w=(0,G.useMemo)(()=>e.parent_epic_id==null?null:(n??[]).find(t=>t.id===e.parent_epic_id)??null,[n,e.parent_epic_id]),T=(0,G.useMemo)(()=>w?(n??[]).filter(e=>e.parent_epic_id===w.id).length:0,[n,w]),[E,D]=(0,G.useState)(e.title),[O,ne]=(0,G.useState)(e.description),[k,ae]=(0,G.useState)(e.priority??`medium`),[A,le]=(0,G.useState)([...e.labels??[]]),[de,j]=(0,G.useState)(!1),[M,N]=(0,G.useState)(!1),[I,L]=(0,G.useState)(``),[be,xe]=(0,G.useState)(!1),[R,Se]=(0,G.useState)(!1),[Ce,we]=(0,G.useState)(!1),[Ee,z]=(0,G.useState)(!1),[B,De]=(0,G.useState)(!1),[V,H]=(0,G.useState)(!1),U=Xe(),W=U.connected&&!!U.discardStatus&&e.source===`jira`&&!!e.jira_key,Oe=U.connected&&e.source===`jira`&&!!e.jira_key,[ke,Ae]=(0,G.useState)(e.attachments??[]);(0,G.useEffect)(()=>{Ae(e.attachments??[])},[e.attachments,e.id]);let je=(0,G.useRef)(null),Me=(0,G.useRef)(null),Ne=(0,G.useRef)(null),K=(0,G.useMemo)(()=>E!==e.title||O!==e.description||k!==e.priority||JSON.stringify(A)!==JSON.stringify(e.labels),[E,O,k,A,e]);(0,G.useEffect)(()=>{de&&je.current?.focus()},[de]),(0,G.useEffect)(()=>{if(M){let e=Me.current;e&&(e.focus(),e.selectionStart=e.value.length)}},[M]),(0,G.useEffect)(()=>{be&&Ne.current?.focus()},[be]),(0,G.useEffect)(()=>{function e(e){e.key===`Escape`&&!de&&!M&&!R&&r()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,de,M,R]);let Pe=(0,G.useMemo)(()=>{if(!I.trim())return[];let e=I.toLowerCase();return t.filter(t=>t.toLowerCase().includes(e)&&!A.includes(t)).slice(0,5)},[I,t,A]),Fe=(0,G.useCallback)(e=>{let t=e.trim();t&&!A.includes(t)&&le(e=>[...e,t]),L(``)},[A]),Ie=(0,G.useCallback)(e=>{le(t=>t.filter(t=>t!==e))},[]),Le=(0,G.useCallback)(async()=>{let t={};if(E!==e.title&&(t.title=E),O!==e.description&&(t.description=O),k!==e.priority&&(t.priority=k),JSON.stringify(A)!==JSON.stringify(e.labels)&&(t.labels=A),Object.keys(t).length===0){r();return}De(!0);let n=await a(e.id,t);De(!1),n?(h.success(d(`detailModal.toast.updated`)),r()):h.error(d(`detailModal.toast.updateFailed`))},[E,O,k,A,e,a,r,d]),Re=(0,G.useCallback)(async()=>{if(V)return;H(!0);let t=!1;try{t=await o(e.id)}catch{t=!1}if(H(!1),!t){h.error(d(`detailModal.toast.deleteFailed`));return}Se(!1),r()},[V,e.id,o,r,d]),[ze,Be]=(0,G.useState)(0),J=(0,G.useRef)(null),[Ve,He]=(0,G.useState)(()=>typeof window<`u`&&window.innerWidth>=Ln);(0,G.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>He(window.innerWidth>=Ln);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let Y=!u&&!x&&Ve,X=(0,G.useCallback)(e=>{J.current&&Be(e.clientX-J.current.startX)},[]),Z=(0,G.useCallback)(t=>{if(!J.current)return;let n=t.clientX-J.current.startX,i=window.innerWidth*Rn;if(window.removeEventListener(`pointermove`,X),window.removeEventListener(`pointerup`,Z),window.removeEventListener(`pointercancel`,Z),J.current=null,Be(0),Math.abs(n)>=i&&window.innerWidth>=Ln){let t=b.leftId===e.id;y(n<0?`left`:`right`,e.id),t||r()}},[y,X,b.leftId,e.id,r]),Ue=(0,G.useCallback)(e=>{Y&&e.button===0&&(e.target.closest(`button, input, textarea, select, [contenteditable="true"]`)||(J.current={startX:e.clientX,pointerId:e.pointerId},window.addEventListener(`pointermove`,X),window.addEventListener(`pointerup`,Z),window.addEventListener(`pointercancel`,Z)))},[Y,X,Z]);(0,G.useEffect)(()=>()=>{J.current&&(window.removeEventListener(`pointermove`,X),window.removeEventListener(`pointerup`,Z),window.removeEventListener(`pointercancel`,Z))},[X,Z]);let We=(0,G.useCallback)(()=>{if(!Y||window.innerWidth<Ln)return;let t=b.leftId===e.id;y(`right`,e.id),t||r()},[Y,y,b.leftId,e.id,r]),{panelRef:Ge,panelStyle:Ke,resizeHandles:qe,guardBackdrop:Je}=pe({enabled:!u,allowMove:!1}),Ye=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{ref:Ge,className:u?`relative w-full h-full rounded-xl bg-card border border-border/40 shadow-2xl shadow-black/50 flex flex-col overflow-hidden`:`relative w-full max-w-[67rem] m-4 rounded-xl bg-card border border-border/40 shadow-2xl shadow-black/50 flex flex-col animate-in fade-in zoom-in-95 duration-200 h-[90vh]`,style:{...ze===0?{transition:`transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1)`}:{transform:`translateX(${ze}px)`,transition:`none`},...Ke},children:[w&&(0,q.jsx)(`div`,{className:`px-5 pt-3`,children:(0,q.jsx)(jn,{epic:w,childExecutionOrder:e.execution_order??null,totalChildren:T,onOpenEpic:()=>i?.(w.id)})}),(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-3 px-5 py-4 border-b border-border/30 ${Y?`cursor-grab active:cursor-grabbing`:``}`,onPointerDown:Ue,"data-testid":`ticket-modal-header`,children:[(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[de?(0,q.jsx)(`input`,{ref:je,value:E,onChange:e=>D(e.target.value),onBlur:()=>j(!1),onKeyDown:t=>{t.key===`Enter`&&j(!1),t.key===`Escape`&&(D(e.title),j(!1))},className:`w-full bg-transparent border-b border-accent-primary/50 text-sm font-semibold text-foreground outline-none pb-0.5`}):(0,q.jsxs)(`button`,{type:`button`,onClick:()=>j(!0),className:`group flex items-center gap-1.5 text-left w-full`,children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground truncate`,children:E||d(`untitled`)}),(0,q.jsx)(ie,{className:`w-3 h-3 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0`})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5`,children:[(0,q.jsxs)(`span`,{className:`text-[10px] text-foreground font-mono`,children:[`#`,e.id]}),e.status===`on_review`&&(0,q.jsx)(`span`,{title:d(`specs:status.onReviewHint`),"data-testid":`ticket-modal-on-review-badge`,children:(0,q.jsx)(et,{status:`on_review`})})]}),(0,q.jsx)(sn,{ticketId:e.id})]}),g&&(0,q.jsx)(`div`,{className:`shrink-0`,children:(0,q.jsx)(An,{ticket:e,projectId:g,featureFlagOn:S,childrenCount:C.length})}),(0,q.jsx)(Wn,{ticket:e,title:E,description:O,priority:k,labels:A,onClose:r}),s&&(c||l)&&(0,q.jsx)(Gn,{ticket:e,rails:s,onMoveToRail:c,onRemoveFromRail:l}),Y&&(0,q.jsxs)(F,{variant:`outline`,size:`sm`,className:`shrink-0 mr-1 gap-1.5`,"data-testid":`ticket-modal-compare`,onClick:We,title:d(`detailModal.compareTooltip`),children:[(0,q.jsx)(Te,{className:`w-3.5 h-3.5`}),d(`detailModal.compare`)]}),(0,q.jsx)(`button`,{onClick:r,className:`h-7 w-7 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-surface/50 transition-colors cursor-pointer shrink-0`,"data-testid":`ticket-modal-close`,children:(0,q.jsx)(ue,{className:`w-4 h-4`})})]}),(0,q.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0`,children:(0,q.jsxs)(`div`,{className:`flex flex-col sm:flex-row h-full`,children:[(0,q.jsxs)(`div`,{className:`flex-1 min-w-0 px-5 py-4 space-y-4 flex flex-col`,children:[(0,q.jsxs)(`div`,{className:`flex-1 flex flex-col`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-1.5`,children:d(`fields.description`)}),!M&&(0,q.jsxs)(`button`,{type:`button`,onClick:()=>N(!0),className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[(0,q.jsx)(ie,{className:`w-2.5 h-2.5`}),d(`common:actions.edit`)]})]}),M?(0,q.jsxs)(`div`,{className:`space-y-1.5 flex-1 flex flex-col`,children:[(0,q.jsx)(`textarea`,{ref:Me,value:O,onChange:e=>ne(e.target.value),className:`w-full flex-1 rounded-lg border border-border bg-input px-3 py-2 text-xs text-foreground placeholder:text-muted-foreground resize-none min-h-[300px]`,placeholder:d(`fields.markdownPlaceholder`)}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(F,{variant:`ghost`,size:`sm`,className:`h-6 text-[10px]`,onClick:()=>N(!1),children:d(`detailModal.doneEditing`)}),(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground`,children:d(`fields.supportsMarkdown`)})]})]}):O?(0,q.jsx)(Yn,{description:O,onEdit:()=>N(!0)}):(0,q.jsx)(`button`,{type:`button`,onClick:()=>N(!0),className:`w-full rounded-lg border border-dashed border-border/40 bg-muted/10 px-3 py-4 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/20 transition-colors text-center`,children:d(`detailModal.addDescription`)})]}),(0,q.jsx)(Bt,{ticketKey:e.id,attachments:ke,onChange:Ae}),(0,q.jsx)(Vt,{ticketId:e.id,onClose:r}),e.prerequisites&&e.prerequisites.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:d(`detailModal.prerequisites`)}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.prerequisites.map(e=>(0,q.jsxs)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-mono bg-accent/60 text-foreground/70`,children:[`#`,e]},e))})]})]}),(0,q.jsxs)(`div`,{className:`sm:w-56 sm:border-l border-t sm:border-t-0 border-border/30 px-4 py-4 space-y-4 bg-muted/5`,children:[e.jira_url&&e.jira_key&&(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{Q(e.jira_url)},"data-testid":`jira-go-to-ticket`,className:`w-full inline-flex items-center justify-center gap-1.5 h-7 rounded border border-accent-info/50 bg-accent-info/10 px-2 text-xs font-medium text-accent-info hover:bg-accent-info/20 transition-colors`,children:[(0,q.jsx)(ee,{className:`w-3.5 h-3.5 shrink-0`}),m(`detail.goToTicket`,{key:e.jira_key})]}),e.jira_epic_key&&(0,q.jsxs)(`div`,{"data-testid":`jira-epic`,children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:m(`detail.epic`)}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{let t=Bn(e);t&&Q(t)},title:e.jira_epic_name??e.jira_epic_key,className:`w-full inline-flex items-center gap-1.5 rounded border border-accent-highlight/40 bg-accent-highlight/5 px-2 py-1.5 text-left text-xs hover:bg-accent-highlight/10 transition-colors`,children:[(0,q.jsx)(`span`,{className:`font-mono text-accent-highlight shrink-0`,children:e.jira_epic_key}),e.jira_epic_name&&(0,q.jsx)(`span`,{className:`truncate text-foreground/80`,children:e.jira_epic_name})]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:d(`fields.priority`)}),(0,q.jsx)(`select`,{value:k,onChange:e=>ae(e.target.value),className:`w-full h-7 rounded border border-border bg-input px-2 text-xs text-foreground`,children:zn.map(e=>(0,q.jsx)(`option`,{value:e.value,children:d(e.labelKey)},e.value))})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:d(`fields.labels`)}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-1.5`,children:A.map(e=>(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] font-medium bg-accent/60 text-foreground/70 group`,children:[e,(0,q.jsx)(`button`,{type:`button`,onClick:()=>Ie(e),className:`text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,q.jsx)(te,{className:`w-2.5 h-2.5`})})]},e))}),be?(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(`input`,{ref:Ne,value:I,onChange:e=>L(e.target.value),onKeyDown:e=>{e.key===`Enter`&&I.trim()&&(e.preventDefault(),Fe(I)),e.key===`Escape`&&(xe(!1),L(``))},onBlur:()=>{I.trim()&&Fe(I),xe(!1),L(``)},placeholder:d(`detailModal.addLabelPlaceholder`),className:`w-full h-6 rounded border border-border bg-input px-2 text-[10px] text-foreground placeholder:text-muted-foreground`}),Pe.length>0&&(0,q.jsx)(`div`,{className:`absolute left-0 right-0 top-full mt-0.5 rounded border border-border/50 bg-popover shadow-lg z-10 py-0.5`,children:Pe.map(e=>(0,q.jsx)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),Fe(e)},className:`w-full text-left px-2 py-1 text-[10px] hover:bg-accent/50 text-foreground/80`,children:e},e))})]}):(0,q.jsxs)(`button`,{type:`button`,onClick:()=>xe(!0),className:`flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,q.jsx)(oe,{className:`w-2.5 h-2.5`}),d(`detailModal.addLabel`)]})]}),(0,q.jsx)(Fn,{ticket:e,allTickets:n??[],onOpenTicket:e=>i?.(e)}),e.source===`jira`&&e.jira_key&&(0,q.jsx)(un,{localId:e.id}),e.metadata?.effort_level&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-0.5`,children:d(`detailModal.effort`)}),(0,q.jsx)(`span`,{className:`text-xs text-foreground/70`,children:e.metadata.effort_level})]}),e.assignee&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-0.5`,children:d(`detailModal.assignee`)}),(0,q.jsx)(`span`,{className:`text-xs text-foreground/70`,children:e.assignee})]})]})]})}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3 border-t border-border/30`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-muted-foreground`,children:[(0,q.jsx)(`span`,{children:d(`meta.createdAgo`,{time:Un(e.created_at)})}),(0,q.jsx)(`span`,{children:d(`meta.updatedAgo`,{time:Un(e.updated_at)})}),e.source&&(0,q.jsx)(`span`,{className:`bg-muted/30 rounded px-1.5 py-0.5`,children:Vn[e.source]?d(Vn[e.source]):e.source})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[W?(0,q.jsxs)(F,{variant:`ghost`,size:`sm`,className:`h-7 text-xs text-accent-info hover:bg-accent-info/10`,onClick:()=>we(!0),"data-testid":`jira-move-to-button`,children:[(0,q.jsx)(v,{className:`w-3 h-3 mr-1`}),m(`discard.moveButton`,{status:U.discardStatus})]}):(0,q.jsxs)(F,{variant:`ghost`,size:`sm`,className:`h-7 text-xs text-red-400 aurora-light:text-destructive hover:text-red-300 aurora-light:hover:text-destructive hover:bg-red-500/10 aurora-light:hover:bg-destructive/10`,onClick:()=>Se(!0),children:[(0,q.jsx)(ce,{className:`w-3 h-3 mr-1`}),d(`common:actions.delete`)]}),K&&(0,q.jsxs)(F,{size:`sm`,className:`h-7 text-xs`,onClick:()=>{Oe?z(!0):Le()},disabled:B||!E.trim(),children:[(0,q.jsx)(se,{className:`w-3 h-3 mr-1`}),d(B?`common:states.saving`:`common:actions.save`)]})]})]})]}),(0,q.jsx)(ye,{open:R,onOpenChange:e=>{V||Se(e)},children:(0,q.jsxs)(he,{className:`max-w-sm`,children:[(0,q.jsxs)(fe,{children:[(0,q.jsx)(ge,{children:d(`deleteDialog.title`)}),(0,q.jsx)(_e,{children:(0,q.jsx)(f,{t:d,i18nKey:`deleteDialog.body`,values:{id:e.id,title:e.title},components:{strong:(0,q.jsx)(`span`,{className:`font-semibold text-foreground`})}})})]}),(0,q.jsxs)(me,{children:[(0,q.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>Se(!1),disabled:V,children:d(`common:actions.cancel`)}),(0,q.jsxs)(F,{variant:`destructive`,size:`sm`,onClick:()=>{Re()},disabled:V,"aria-busy":V,children:[V?(0,q.jsx)(re,{className:`w-3.5 h-3.5 mr-1.5 animate-spin`}):(0,q.jsx)(ce,{className:`w-3.5 h-3.5 mr-1.5`}),d(`common:actions.delete`)]})]})]})}),W&&U.discardStatus&&(0,q.jsx)(Ze,{open:Ce,onOpenChange:we,ticket:{id:e.id,title:e.title,jira_key:e.jira_key},discardStatus:U.discardStatus,onDiscarded:r}),(0,q.jsx)(ye,{open:Ee,onOpenChange:z,children:(0,q.jsxs)(he,{className:`max-w-md`,"data-testid":`jira-save-confirm`,children:[(0,q.jsxs)(fe,{children:[(0,q.jsx)(ge,{children:m(`detail.saveTitle`)}),(0,q.jsx)(_e,{children:m(`detail.saveBody`,{key:e.jira_key??`#${e.id}`})})]}),(0,q.jsxs)(me,{children:[(0,q.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>z(!1),children:d(`common:actions.cancel`)}),(0,q.jsxs)(F,{size:`sm`,onClick:()=>{z(!1),Le()},disabled:B,"data-testid":`jira-save-confirm-btn`,children:[(0,q.jsx)(se,{className:`w-3.5 h-3.5 mr-1.5`}),m(`detail.saveConfirm`)]})]})]})})]});return u?Ye:(0,q.jsxs)(`div`,{className:`fixed inset-0 z-[68] flex items-center justify-center`,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/70`,onClick:Je(r)}),Ye,(0,q.jsx)(ve,{handles:qe})]})}function Un(e){try{return R(new Date(e),{addSuffix:!0,locale:s()})}catch{return e}}function Wn({ticket:e,title:t,description:n,priority:r,labels:i,onClose:a}){let{t:o}=p(`tickets`),{triggerResume:s}=T(),{activeProjectId:c}=P(),{closeTicketDetail:l}=rn();return Y(e)?(0,q.jsxs)(F,{variant:`default`,size:`sm`,onClick:()=>{if(!c)return;let{body:u,criteria:d}=Ve(n);s({kind:`explore-spec`,projectId:c,label:t||e.title||o(`detailModal.ticketFallbackLabel`,{id:e.id}),restoreRoute:`/`,params:{initialIdea:``,pendingSpecId:X(),initialAttachmentIds:[],resumeConversationId:e.origin_conversation_id??void 0,editTicket:{id:e.id,title:t,description:u,labels:i,priority:r,acceptanceCriteria:d,status:e.status}}}),l(),a()},className:`shrink-0 mr-2`,"data-testid":`continue-editing`,children:[(0,q.jsx)(V,{className:`w-3.5 h-3.5 mr-1.5`}),o(`detailModal.continueEditing`)]}):null}function Gn({ticket:e,rails:t,onMoveToRail:n,onRemoveFromRail:r}){let{t:i}=p(`tickets`),[a,o]=(0,G.useState)(null),s=(0,G.useRef)(null),c=t.find(t=>t.ticketIds.includes(e.id));return c?r?(0,q.jsxs)(F,{variant:`outline`,size:`sm`,className:`shrink-0 mr-2 gap-1.5 border-accent-warning/30 text-accent-warning hover:bg-accent-warning/10 hover:text-accent-warning`,"data-testid":`modal-remove-from-rail`,onClick:()=>r(e.id),title:i(`rail.currentlyOn`,{rail:c.label}),children:[(0,q.jsx)(g,{className:`w-3.5 h-3.5`,"aria-hidden":!0}),i(`rail.removeFromRail`)]}):null:n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(F,{ref:s,variant:`outline`,size:`sm`,className:`shrink-0 mr-2 gap-1.5 border-accent-info/30 text-accent-info hover:bg-accent-info/10 hover:text-accent-info`,"data-testid":`modal-move-to-rail`,onClick:()=>{s.current&&o(s.current.getBoundingClientRect())},children:[i(`rail.moveToRail`),(0,q.jsx)(v,{className:`w-3.5 h-3.5`,"aria-hidden":!0})]}),a&&(0,q.jsx)(Be,{rails:t,anchorRect:a,onMoveToRail:t=>n(e.id,t),onClose:()=>o(null)})]}):null}var Kn=`
8
+ `;function K(e){return`${j}/api/projects/${encodeURIComponent(e)}`}function Pe(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Fe(e,t){let n=new Map(e.map(e=>[e.id,e])),r=t.map(e=>{let t=n.get(e.id);return t&&Pe(t,e)?t:e});return r.length===e.length&&r.every((t,n)=>t===e[n])?e:r}function Ie(){let{t:e}=p(`tickets`),{activeProjectId:t}=P(),[n,r]=(0,G.useState)([]),[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(new Set),[u,d]=(0,G.useState)(new Set),f=(0,G.useRef)(t);f.current=t;let m=(0,G.useRef)(0),g=(0,G.useRef)(null),_=(0,G.useRef)(new Set),{registerHandler:v,unregisterHandler:y,connectionStatus:b}=M(),x=(0,G.useId)(),S=(0,G.useCallback)(async(e,t)=>{let n=K(e),r=await fetch(`${n}/tickets`,{signal:t,cache:`no-store`});if(!r.ok)throw Error(`Failed to fetch tickets: ${r.status}`);let i=await r.json();return Array.isArray(i)?i:i.tickets??[]},[]),C=(0,G.useCallback)(async(t,n)=>{let i=++m.current;g.current?.abort();let o=new AbortController;g.current=o,f.current===t&&(a(!0),s(null));try{let a=await S(t,o.signal);if(o.signal.aborted||i!==m.current||f.current!==t)return;let s=_.current,c=new Set;if(n===`merge`)for(let e of a)s.size>0&&!s.has(e.id)&&c.add(e.id);_.current=new Set(a.map(e=>e.id)),r(n===`replace`?a:e=>Fe(e,a)),c.size>0&&s.size>0&&(l(c),h.success(e(`toasts.newTicketsAdded`,{count:c.size}),{id:`tickets-added-${t}`}),setTimeout(()=>{f.current===t&&l(e=>{let t=new Set(e);for(let e of c)t.delete(e);return t})},Me))}catch(e){if(o.signal.aborted||i!==m.current||f.current!==t)return;s(e instanceof Error?e.message:String(e))}finally{i===m.current&&(g.current===o&&(g.current=null),f.current===t&&a(!1))}},[S,e]),w=(0,G.useCallback)(async()=>{t&&await C(t,`merge`)},[t,C]);(0,G.useEffect)(()=>{if(m.current+=1,g.current?.abort(),g.current=null,r([]),a(!1),s(null),_.current=new Set,l(new Set),d(new Set),t)return C(t,`replace`),()=>{m.current+=1,g.current?.abort(),g.current=null}},[t,C]);let T=(0,G.useCallback)(t=>{let n=t;if(!n||typeof n.type!=`string`)return;let i=f.current;if(!(n.projectId&&n.projectId!==i))switch(n.type){case`mcp.activity`:n.affectedProjectId&&n.affectedProjectId===i&&w();break;case`ticket_created`:{if(!n.ticket)break;let t=n.ticket;r(e=>e.some(e=>e.id===t.id)?e:[...e,t]),_.current.add(t.id),l(e=>new Set([...e,t.id])),je(i)||h.success(e(`toasts.newTicket`,{title:t.title}),{id:`new-ticket-${t.id}`}),setTimeout(()=>{l(e=>{let n=new Set(e);return n.delete(t.id),n})},Me);break}case`ticket_updated`:{if(!n.ticket)break;if(n.ticket.id===0){w();break}let e=n.ticket;r(t=>t.map(t=>t.id===e.id?e:t)),typeof e.description==`string`&&e.description.includes(Ne)&&d(t=>{if(!t.has(e.id))return t;let n=new Set(t);return n.delete(e.id),n});break}case`ticket_deleted`:{if(n.ticketId==null)break;let e=n.ticketId;r(t=>t.filter(t=>t.id!==e)),_.current.delete(e);break}case`explore.contract_refine_started`:if(n.ticketId==null)break;d(e=>new Set([...e,n.ticketId]));break;case`explore.contract_refine_failed`:{if(n.ticketId==null)break;let e=n.ticketId;d(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n});break}}},[w,e]);(0,G.useLayoutEffect)(()=>(v(`tickets-${x}`,T),()=>y(`tickets-${x}`)),[T,v,y,x]);let E=(0,G.useRef)(b);return(0,G.useEffect)(()=>{E.current!==`connected`&&b===`connected`&&f.current&&w(),E.current=b},[b,w]),{tickets:n,loading:i,isLoading:i,error:o,newTicketIds:c,contractRefiningIds:u,refetch:w,refresh:w,deleteTicket:(0,G.useCallback)(async e=>{let n=t;if(!n)return!1;try{let t=await fetch(`${K(n)}/tickets/${e}`,{method:`DELETE`});return t.ok&&f.current===n&&await C(n,`merge`),t.ok}catch{return!1}},[t,C]),updateTicketStatus:(0,G.useCallback)(async(e,n)=>{let r=t;if(!r)return!1;try{let t=await fetch(`${K(r)}/tickets/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:n})});return t.ok&&f.current===r&&await C(r,`merge`),t.ok}catch{return!1}},[t,C]),updateTicketPriority:(0,G.useCallback)(async(e,n)=>{let r=t;if(!r)return!1;try{let t=await fetch(`${K(r)}/tickets/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({priority:n})});return t.ok&&f.current===r&&await C(r,`merge`),t.ok}catch{return!1}},[t,C]),createTicket:(0,G.useCallback)(async e=>{let n=t;if(!n)return!1;try{let t=await fetch(`${K(n)}/tickets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return t.ok&&f.current===n&&await C(n,`merge`),t.ok}catch{return!1}},[t,C]),updateTicket:(0,G.useCallback)(async(e,n)=>{let r=t;if(!r)return!1;try{let t=await fetch(`${K(r)}/tickets/${e}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});return t.ok&&f.current===r&&await C(r,`merge`),t.ok}catch{return!1}},[t,C])}}var q=n(),Le=224,Re=8,ze=8;function Be({rails:e,onMoveToRail:t,onClose:n,anchorRect:r}){let{t:i}=p(`tickets`),a=(0,G.useRef)(null),[o,s]=(0,G.useState)(!1);(0,G.useLayoutEffect)(()=>{let e=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(e)},[]),(0,G.useEffect)(()=>{function e(e){a.current&&(a.current.contains(e.target)||n())}function t(e){e.key===`Escape`&&n()}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[n]);let{top:c,left:l,caretLeft:u}=(0,G.useMemo)(()=>{let e=r.left+r.width/2,t=e-Le/2,n=window.innerWidth-Le-Re,i=Math.max(Re,Math.min(n,t)),a=e-i,o=Math.max(12,Math.min(Le-12,a));return{top:r.bottom+ze,left:i,caretLeft:o}},[r]);return(0,q.jsxs)(`div`,{ref:a,role:`dialog`,"aria-label":i(`rail.popoverTitle`),"data-testid":`move-to-rail-popover`,style:{top:c,left:l,width:Le,opacity:+!!o,transform:o?`translateY(0) scale(1)`:`translateY(-4px) scale(0.97)`,transformOrigin:`${u}px top`,transition:`opacity 140ms ease-out, transform 160ms cubic-bezier(0.2, 0.9, 0.3, 1)`},className:`fixed z-50 rounded-xl border border-border/60 bg-card/95 backdrop-blur shadow-xl shadow-black/40 p-1`,children:[(0,q.jsx)(`div`,{"aria-hidden":!0,className:`absolute w-2 h-2 rotate-45 bg-card/95 border-l border-t border-border/60`,style:{top:-5,left:u-4}}),(0,q.jsx)(`div`,{className:`px-2 py-1.5 text-[10px] uppercase tracking-wider text-muted-foreground/70 font-medium`,children:i(`rail.popoverTitle`)}),e.length===0?(0,q.jsx)(`div`,{className:`px-2 py-2 text-xs text-muted-foreground`,children:i(`rail.noRails`)}):(0,q.jsx)(`ul`,{className:`flex flex-col`,children:e.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{t(e.id),n()},className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-lg text-left text-sm hover:bg-accent-info/10 hover:text-accent-info transition-colors`,children:[e.status===`running`?(0,q.jsx)(ae,{className:`w-3 h-3 text-accent-success animate-pulse shrink-0`,"aria-hidden":!0}):(0,q.jsx)(we,{className:`w-3 h-3 text-muted-foreground/60 shrink-0`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),(0,q.jsx)(Ce,{className:`w-3.5 h-3.5 text-muted-foreground/40 shrink-0`,"aria-hidden":!0})]})},e.id))})]})}var J=/\n*##\s*Acceptance Criteria\s*\n([\s\S]*?)(?=\n##\s|\n*$)/i;function Ve(e){if(!e)return{body:``,criteria:[]};let t=J.exec(e);if(!t)return{body:e.replace(/\s+$/,``),criteria:[]};let n=t[1],r=e.slice(0,t.index),i=e.slice(t.index+t[0].length),a=`${r.replace(/\s+$/,``)}${i?`\n\n${i.replace(/^\s+/,``)}`:``}`,o=n.split(/\r?\n/).map(e=>e.replace(/^\s*[-*+]\s+/,``).trim()).filter(e=>e.length>0);return{body:a.replace(/\s+$/,``),criteria:o}}var He=new Set([`draft`,`todo`]);function Y(e){return!!(He.has(e.status)||e.source===`jira`&&e.jira_key&&e.status!==`cancelled`)}function X(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}var Z=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_TERMINAL_PANEL;return typeof e!=`string`||e!==`false`})(),Ue=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_AGENTS_SECTION;return typeof e!=`string`||e!==`false`})(),We=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_CODE_EXPLORER;return typeof e!=`string`||e!==`false`})(),Ge=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_JIRA;return typeof e!=`string`||e!==`false`})(),Ke=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_MCP;return typeof e!=`string`||e!==`false`})(),qe=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_AGENT_CHAT;return typeof e!=`string`||e!==`false`})(),Je=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_AGENT_MODE;return qe&&(typeof e!=`string`||e!==`false`)})();(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_INTERACTIVE_JOBS;return typeof e!=`string`||e!==`false`})();var Ye=(()=>{let e={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_FEATURE_LOOPS_SECTION;return typeof e!=`string`||e!==`false`})();function Xe(){let{activeProjectId:e}=P(),[t,n]=(0,G.useState)({connected:!1,key:null,discardStatus:null}),[r,i]=(0,G.useState)(!0);return(0,G.useEffect)(()=>{if(!Ge||!e){n({connected:!1,key:null,discardStatus:null}),i(!1);return}let t=!1;return i(!0),L.getConnection().then(e=>{if(t)return;let r=!!(e.connected&&e.connection?.enabled);n({connected:r,key:e.connection?.jiraProjectKey??null,discardStatus:r?e.connection?.discardStatus??null:null})}).catch(()=>{t||n({connected:!1,key:null,discardStatus:null})}).finally(()=>{t||i(!1)}),()=>{t=!0}},[e]),{connected:t.connected,jiraProjectKey:t.key,discardStatus:t.discardStatus,loading:r}}function Ze({open:e,onOpenChange:t,ticket:n,discardStatus:r,onDiscarded:i}){let{t:a}=p(`jira`),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(!1);async function u(){l(!0);try{await L.discardSpec(n.id,o.trim()||null),h.success(a(`discard.movedToast`,{status:r,key:n.jira_key??`#${n.id}`})),t(!1),s(``),i?.()}catch(e){h.error(e instanceof Error?e.message:a(`errors.generic`))}finally{l(!1)}}return(0,q.jsx)(ye,{open:e,onOpenChange:e=>{c||t(e)},children:(0,q.jsxs)(he,{movableResizable:!0,className:`max-w-md`,"data-testid":`jira-discard-dialog`,children:[(0,q.jsxs)(fe,{children:[(0,q.jsx)(ge,{children:a(`discard.title`,{status:r})}),(0,q.jsx)(_e,{children:a(`discard.body`,{status:r,key:n.jira_key??`#${n.id}`})})]}),(0,q.jsxs)(`label`,{className:`block space-y-1`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:a(`discard.commentLabel`)}),(0,q.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:a(`discard.commentPlaceholder`),rows:3,className:`w-full rounded-md border border-border bg-input px-3 py-2 text-xs text-foreground placeholder:text-muted-foreground resize-none`,"data-testid":`jira-discard-comment`})]}),(0,q.jsxs)(me,{children:[(0,q.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>t(!1),disabled:c,children:a(`wizard.cancel`)}),(0,q.jsxs)(F,{size:`sm`,onClick:u,disabled:c,"data-testid":`jira-discard-confirm`,children:[(0,q.jsx)(v,{className:`w-3.5 h-3.5 mr-1.5`}),c?a(`discard.moving`):a(`discard.confirm`,{status:r})]})]})]})})}var Qe={draft:{dotClass:`bg-accent-secondary/60`,textClass:`text-accent-secondary`,borderClass:`border-l-[3px] border-dashed border-accent-secondary/50 pl-3`,labelKey:`common:status.draft`,pulsing:!1},todo:{dotClass:`bg-slate-500/70`,textClass:`text-muted-foreground`,borderClass:`border-l-[3px] border-dashed border-slate-500/40 pl-3`,labelKey:`status.todo`,pulsing:!1},in_progress:{dotClass:`bg-blue-400 aurora-light:bg-accent-info`,textClass:`text-foreground font-semibold`,borderClass:`border-l-[3px] border-solid border-blue-500 pl-3`,labelKey:`status.inProgress`,pulsing:!0},on_review:{dotClass:`bg-accent-warning/80`,textClass:`text-accent-warning`,borderClass:`border-l-[3px] border-solid border-accent-warning/60 pl-3`,labelKey:`status.onReview`,pulsing:!1},done:{dotClass:`text-emerald-400 aurora-light:text-accent-success`,textClass:`text-emerald-400/80 aurora-light:text-accent-success`,borderClass:`border-l-[3px] border-solid border-emerald-500 pl-3`,labelKey:`status.done`,pulsing:!1},cancelled:{dotClass:`text-red-400/60 aurora-light:text-destructive/70`,textClass:`text-muted-foreground/50`,borderClass:`pl-3`,labelKey:`status.cancelled`,pulsing:!1}};function $e({status:e,className:t}){let{t:n}=p(`specs`),r=Qe[e];return e===`done`?(0,q.jsx)(D,{className:I(`w-3.5 h-3.5 shrink-0`,r.dotClass,t),"aria-label":n(`status.done`)}):e===`cancelled`?(0,q.jsx)(ue,{className:I(`w-3.5 h-3.5 shrink-0`,r.dotClass,t),"aria-label":n(`status.cancelled`)}):r.pulsing?(0,q.jsxs)(`span`,{className:I(`relative flex shrink-0 h-2.5 w-2.5`,t),"aria-label":n(`status.inProgress`),children:[(0,q.jsx)(`span`,{className:I(`animate-ping absolute inline-flex h-full w-full rounded-full opacity-60`,r.dotClass)}),(0,q.jsx)(`span`,{className:I(`relative inline-flex rounded-full h-2.5 w-2.5`,r.dotClass)})]}):(0,q.jsx)(`span`,{className:I(`inline-flex rounded-full h-2.5 w-2.5 shrink-0`,r.dotClass,t),"aria-label":n(r.labelKey)})}function et({status:e,className:t}){let{t:n}=p(`specs`),r=Qe[e];return(0,q.jsxs)(`span`,{className:I(`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[11px] font-medium border`,e===`todo`&&`bg-slate-500/10 border-slate-500/30 text-slate-400 aurora-light:bg-muted aurora-light:border-border aurora-light:text-muted-foreground`,e===`in_progress`&&`bg-blue-500/10 border-blue-500/30 text-blue-400 aurora-light:bg-accent-info/10 aurora-light:border-accent-info/30 aurora-light:text-accent-info`,e===`on_review`&&`bg-accent-warning/10 border-accent-warning/30 text-accent-warning`,e===`done`&&`bg-emerald-500/10 border-emerald-500/30 text-emerald-400 aurora-light:bg-accent-success/10 aurora-light:border-accent-success/30 aurora-light:text-accent-success`,e===`cancelled`&&`bg-red-500/10 border-red-500/30 text-red-400/60 aurora-light:bg-destructive/10 aurora-light:border-destructive/30 aurora-light:text-destructive/70`,t),children:[(0,q.jsx)($e,{status:e}),n(r.labelKey)]})}async function tt(e,t,n){let r=new FormData;r.append(`file`,t);let i=await fetch(`${N()}/tickets/${e}/attachments`,{method:`POST`,body:r,signal:n});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error??u.t(`attachments:errors.uploadFailed`,{status:i.status}))}return(await i.json()).attachment}async function nt(e,t){let n=await fetch(`${N()}/tickets/${e}/attachments/${t}`,{method:`DELETE`});if(!n.ok&&n.status!==404)throw Error(u.t(`attachments:errors.deleteFailed`,{status:n.status}))}async function rt(e){let t=await fetch(`${N()}/tickets/${e}/attachments`,{method:`DELETE`});if(!t.ok&&t.status!==404)throw Error(u.t(`attachments:errors.bulkDeleteFailed`,{status:t.status}))}async function it(e){let t=await fetch(`${N()}/tickets/${e}/attachments`);if(!t.ok)throw Error(u.t(`attachments:errors.listFailed`,{status:t.status}));return(await t.json()).attachments}function at(e,t){return`${N()}/tickets/${e}/attachments/${t}`}async function ot(e,t){let n=await fetch(at(e,t));if(!n.ok)throw Error(u.t(`attachments:errors.fetchFailed`,{status:n.status}));return n.blob()}var st=`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/csv,text/plain,application/json,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/sql,application/x-sql,text/sql,text/x-sql,.sql`,ct=new Set(st.split(`,`).filter(e=>!e.startsWith(`.`))),lt=/\.sql$/i,ut=/\.(png|jpe?g|gif|webp)$/i;function dt(e){return ct.has(e.type)||lt.test(e.name)||ut.test(e.name)}function ft(){return typeof window<`u`&&window.__TAURI_INTERNALS__!==void 0}function pt(e){return Function(`s`,`return import(s)`)(e).catch(()=>null)}async function mt(e){if(ft()){try{let t=await pt(`@tauri-apps/plugin-opener`);if(t?.revealItemInDir){await t.revealItemInDir(e);return}}catch{}try{await(await pt(`@tauri-apps/api/shell`))?.open?.(e)}catch{}}}async function Q(e){if(ft())try{let t=await i(()=>import(`./dist-js-Di8lflPo.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70]));if(typeof t.open==`function`){await t.open(e);return}}catch(e){console.warn(`[openExternalUrl] tauri shell open failed:`,e)}try{window.open(e,`_blank`,`noopener,noreferrer`)}catch{}}function ht(e,t){let n=()=>l(t?.in,NaN),r=t?.additionalDigits??2,i=bt(e),a;if(i.date){let e=xt(i.date,r);a=St(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,u;if(i.time&&(s=wt(i.time),isNaN(s)))return n();if(i.timezone){if(u=Et(i.timezone),isNaN(u))return n()}else{let e=new Date(o+s),n=c(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return c(o+s+u,t?.in)}var gt={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},_t=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,vt=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,yt=/^([+-])(\d{2})(?::?(\d{2}))?$/;function bt(e){let t={},n=e.split(gt.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],gt.timeZoneDelimiter.test(t.date)&&(t.date=e.split(gt.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=gt.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function xt(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function St(e,t){if(t===null)return new Date(NaN);let n=e.match(_t);if(!n)return new Date(NaN);let r=!!n[4],i=Ct(n[1]),a=Ct(n[2])-1,o=Ct(n[3]),s=Ct(n[4]),c=Ct(n[5])-1;if(r)return Mt(t,s,c)?Dt(t,s,c):new Date(NaN);{let e=new Date(0);return!At(t,a,o)||!jt(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function Ct(e){return e?parseInt(e):1}function wt(e){let t=e.match(vt);if(!t)return NaN;let n=Tt(t[1]),r=Tt(t[2]),i=Tt(t[3]);return Nt(n,r,i)?n*o+r*d+i*1e3:NaN}function Tt(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function Et(e){if(e===`Z`)return 0;let t=e.match(yt);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return Pt(r,i)?n*(r*o+i*d):NaN}function Dt(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var Ot=[31,null,31,30,31,30,31,31,30,31,30,31];function kt(e){return e%400==0||e%4==0&&e%100!=0}function At(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Ot[t]||(kt(e)?29:28))}function jt(e,t){return t>=1&&t<=(kt(e)?366:365)}function Mt(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function Nt(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Pt(e,t){return t>=0&&t<=59}function Ft({ticketKey:e,attachment:t,onClose:n}){let{t:r}=p(`attachments`),[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(null);if((0,G.useEffect)(()=>{if(!t)return;function e(e){e.key===`Escape`&&n()}document.addEventListener(`keydown`,e);let r=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.removeEventListener(`keydown`,e),document.body.style.overflow=r}},[t,n]),(0,G.useEffect)(()=>{if(!t){a(null),s(null);return}let n=!1;return a(null),s(null),ot(e,t.id).then(e=>{n||a(URL.createObjectURL(e))}).catch(e=>{n||s(e instanceof Error?e.message:r(`errors.loadFailed`))}),()=>{n=!0}},[t,e]),(0,G.useEffect)(()=>()=>{i&&URL.revokeObjectURL(i)},[i]),!t)return null;let c=t.mimeType.startsWith(`image/`),l=t.mimeType===`application/pdf`;return(0,q.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":r(`lightbox.preview`,{name:t.filename}),className:`fixed inset-0 z-[100] flex flex-col bg-black/85 backdrop-blur-sm animate-in fade-in-0 duration-200`,onClick:n,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-white/10 bg-black/40`,onClick:e=>e.stopPropagation(),children:[(0,q.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":r(`lightbox.backToDesktop`),className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-md text-sm text-white/85 hover:bg-white/10 hover:text-white transition-colors`,children:[(0,q.jsx)(g,{className:`w-4 h-4`}),r(`common:actions.back`)]}),(0,q.jsxs)(`div`,{className:`flex-1 text-center min-w-0 px-4`,children:[(0,q.jsx)(`div`,{className:`text-sm font-medium text-white/95 truncate`,children:t.filename}),(0,q.jsx)(`div`,{className:`text-[11px] text-white/50`,children:t.mimeType})]}),(0,q.jsxs)(`a`,{href:i??`#`,download:t.filename,onClick:e=>{e.stopPropagation(),i||e.preventDefault()},className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-md text-sm text-white/85 hover:bg-white/10 hover:text-white transition-colors`,"aria-label":r(`lightbox.download`),children:[(0,q.jsx)(O,{className:`w-4 h-4`}),r(`lightbox.download`)]})]}),(0,q.jsx)(`div`,{className:I(`flex-1 flex items-center justify-center overflow-auto p-6`),onClick:n,children:o?(0,q.jsx)(`div`,{onClick:e=>e.stopPropagation(),className:`text-center text-white/80 px-8 py-10 rounded-lg bg-white/5 border border-white/10`,children:(0,q.jsx)(`p`,{className:`text-sm`,children:r(`lightbox.loadError`,{error:o})})}):i?c?(0,q.jsx)(`img`,{src:i,alt:t.filename,onClick:e=>e.stopPropagation(),className:`max-h-full max-w-full rounded-lg shadow-2xl animate-in zoom-in-95 duration-200`}):l?(0,q.jsx)(`iframe`,{src:i,title:t.filename,onClick:e=>e.stopPropagation(),className:`w-full h-full max-w-5xl bg-white rounded-lg shadow-2xl`}):(0,q.jsxs)(`div`,{onClick:e=>e.stopPropagation(),className:`text-center text-white/80 px-8 py-10 rounded-lg bg-white/5 border border-white/10`,children:[(0,q.jsx)(`p`,{className:`text-sm mb-3`,children:r(`lightbox.previewUnavailable`)}),(0,q.jsxs)(`a`,{href:i,download:t.filename,className:`inline-flex items-center gap-2 px-4 py-2 rounded-md bg-white/10 hover:bg-white/20 text-white transition-colors`,children:[(0,q.jsx)(O,{className:`w-4 h-4`}),r(`lightbox.downloadFile`,{name:t.filename})]})]}):(0,q.jsx)(`div`,{onClick:e=>e.stopPropagation(),className:`text-center text-white/70 px-8 py-10 rounded-lg bg-white/5 border border-white/10`,children:(0,q.jsx)(`p`,{className:`text-sm`,children:r(`lightbox.loading`)})})})]})}function It(e,t){let n=new Set,r=[];for(let i of[...e,...t])n.has(i.id)||(n.add(i.id),r.push(i));return r}function Lt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Rt(e){return e.startsWith(`image/`)?`🖼`:e===`application/pdf`?`📄`:e===`text/csv`||e.includes(`spreadsheetml`)||e===`application/vnd.ms-excel`?`📊`:e===`application/json`?`{ }`:e===`text/plain`||e.includes(`sql`)?`📝`:`📎`}function zt(e){try{return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}catch{return e}}function Bt({ticketKey:e,attachments:t,onChange:n,className:r}){let{t:i}=p(`attachments`),[a,o]=(0,G.useState)(new Set),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(null);if((0,G.useEffect)(()=>{let r=!1;return it(e).then(e=>{if(r)return;let i=It(t,e);i.length!==t.length&&n?.(i)}).catch(()=>{}),()=>{r=!0}},[e]),!t||t.length===0)return null;let d=[...t].sort((e,t)=>e.addedAt<t.addedAt?1:-1);async function f(r){c(null),o(e=>{let t=new Set(e);return t.add(r.id),t});try{await nt(e,r.id),await new Promise(e=>setTimeout(e,160)),n?.(t.filter(e=>e.id!==r.id))}catch(e){c(e instanceof Error?e.message:i(`errors.removeFailed`)),o(e=>{let t=new Set(e);return t.delete(r.id),t})}}return(0,q.jsxs)(`section`,{className:I(`mt-4`,r),"aria-label":i(`section.ariaLabel`),children:[(0,q.jsxs)(`header`,{className:`flex items-center justify-between mb-2`,children:[(0,q.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:i(`section.title`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:i(`section.fileCount`,{count:d.length})})]}),(0,q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:d.map(e=>{let t=a.has(e.id);return(0,q.jsxs)(`li`,{className:I(`flex items-center gap-3 px-2.5 py-2 rounded-md border border-border bg-card/60 hover:bg-card transition-all duration-200`,t&&`opacity-0 scale-95 max-h-0 py-0 border-transparent overflow-hidden`),children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`w-6 text-center text-sm shrink-0`,children:Rt(e.mimeType)}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>u(e),className:`flex-1 min-w-0 flex flex-col text-sm text-left hover:text-primary transition-colors`,children:[(0,q.jsx)(`span`,{className:`font-medium truncate text-foreground`,children:e.filename}),(0,q.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[Lt(e.size),` · `,zt(e.addedAt)]})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>u(e),className:`text-[11px] text-primary hover:underline shrink-0`,children:i(`common:actions.open`)}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>f(e),"aria-label":i(`removeFile`,{name:e.filename}),disabled:t,className:`w-6 h-6 inline-flex items-center justify-center rounded text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-50`,children:`×`})]},e.id)})}),s&&(0,q.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:s}),(0,q.jsx)(Ft,{ticketKey:e,attachment:l,onClose:()=>u(null)})]})}function Vt({ticketId:e,onClose:t}){let{t:n}=p(`code`),r=a(),{activeProjectId:i}=P(),[o,s]=(0,G.useState)(null);return(0,G.useEffect)(()=>{if(!We)return;let t=new AbortController;return s(null),fetch(`${N()}/code/provenance?ticketId=${e}`,{signal:t.signal}).then(e=>e.ok?e.json():[]).then(e=>{s(Array.isArray(e)?e:[])}).catch(e=>{e?.name!==`AbortError`&&s([])}),()=>t.abort()},[e,i]),!We||!o||o.length===0?null:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:n(`ticketFiles.title`)}),(0,q.jsx)(`ul`,{className:`space-y-1`,children:o.map((e,i)=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{t(),r(`/code?path=${encodeURIComponent(e.path)}`)},className:`w-full text-left flex items-center gap-2 rounded px-2 py-1 text-xs hover:bg-muted/40`,children:[(0,q.jsx)(e.kind===`created`?z:e.kind===`deleted`?Ee:ne,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,q.jsx)(`span`,{className:`font-mono truncate flex-1`,children:e.path}),e.jobId&&(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] text-muted-foreground font-mono shrink-0`,title:n(`ticketFiles.jobTitle`,{jobId:e.jobId}),children:[(0,q.jsx)(B,{className:`h-3 w-3`}),e.jobId.length>10?e.jobId.slice(0,10):e.jobId]}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wider shrink-0`,children:n(`kind.${e.kind}`)})]})},`${e.path}-${i}`))})]})}var Ht={critical:`bg-red-500/15 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive border-red-500/30 aurora-light:border-destructive/30`,high:`bg-orange-500/15 aurora-light:bg-accent-warning/10 text-orange-400 aurora-light:text-accent-warning border-orange-500/30 aurora-light:border-accent-warning/30`,medium:``,low:`bg-gray-500/15 aurora-light:bg-muted text-gray-400 aurora-light:text-muted-foreground border-gray-500/30 aurora-light:border-border`};function Ut(e){try{return R(new Date(e),{addSuffix:!0,locale:s()})}catch{return e}}function Wt({tickets:e,excludeIds:t,onSelect:n}){let{t:r}=p(`tickets`),[i,a]=(0,G.useState)(``),o=(0,G.useMemo)(()=>{let n=new Set(t),r=e.filter(e=>e.status!==`cancelled`&&!n.has(e.id));if(!i.trim())return r;let a=i.toLowerCase();return r.filter(e=>e.title.toLowerCase().includes(a)||e.description.toLowerCase().includes(a))},[e,t,i]);return(0,q.jsxs)(`div`,{"data-testid":`spec-compare-picker`,className:`h-full flex flex-col rounded-xl bg-card border border-border/40 shadow-2xl shadow-black/50 overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`px-4 py-3 border-b border-border/30 flex items-center gap-2`,children:[(0,q.jsx)(U,{className:`w-3.5 h-3.5 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`text-xs font-semibold text-foreground`,children:r(`comparePicker.title`)}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:r(`comparePicker.count`,{n:o.length})})]}),(0,q.jsx)(`div`,{className:`px-4 py-2 border-b border-border/20`,children:(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(A,{className:`absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,q.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:r(`comparePicker.searchPlaceholder`),className:`w-full h-7 rounded border border-border bg-input pl-7 pr-2 text-[11px] text-foreground placeholder:text-muted-foreground outline-none focus:border-accent-primary/60`})]})}),(0,q.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`spec-compare-picker-list`,children:o.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-center px-4 py-8 gap-2`,children:[(0,q.jsx)(U,{className:`w-6 h-6 text-muted-foreground/40`}),(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.trim()?r(`comparePicker.noMatches`):r(`comparePicker.empty`)})]}):(0,q.jsx)(`ul`,{className:`divide-y divide-border/10`,children:o.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,"data-testid":`spec-compare-card-${e.id}`,onClick:()=>n(e.id),className:`w-full text-left px-4 py-2.5 hover:bg-accent/30 transition-colors flex items-start gap-2 group`,children:[(0,q.jsx)($e,{status:e.status}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsxs)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:[`#`,e.id]}),e.priority&&Ht[e.priority]&&(0,q.jsx)(`span`,{className:`inline-flex items-center rounded px-1 py-0.5 text-[9px] font-medium border ${Ht[e.priority]}`,children:r(`priority.${e.priority}`)})]}),(0,q.jsx)(`p`,{className:`mt-0.5 text-xs text-foreground truncate group-hover:text-accent-primary transition-colors`,children:e.title||r(`untitled`)}),e.description&&(0,q.jsx)(`p`,{className:`mt-0.5 text-[10px] text-muted-foreground line-clamp-1`,children:e.description.slice(0,120)}),e.labels&&e.labels.length>0&&(0,q.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:[e.labels.slice(0,3).map(e=>(0,q.jsx)(`span`,{className:`inline-flex items-center rounded px-1 py-0.5 text-[9px] bg-accent/40 text-foreground/60`,children:e},e)),e.labels.length>3&&(0,q.jsxs)(`span`,{className:`text-[9px] text-muted-foreground`,children:[`+`,e.labels.length-3]})]}),(0,q.jsx)(`p`,{className:`mt-1 text-[9px] text-muted-foreground`,children:r(`meta.updatedAgo`,{time:Ut(e.updated_at)})})]})]})},e.id))})})]})}var Gt=.25,Kt=.75;function qt({state:e,leftTicket:t,rightTicket:n,allTickets:r,allLabels:i,onSave:a,onDelete:o,onOpenTicket:s,onCloseAll:c,onSetCompared:l,onSetRatio:u,onExitSplit:d}){let f=(0,G.useRef)(null),p=(0,G.useRef)(null),[m,h]=(0,G.useState)(!0);(0,G.useEffect)(()=>{let e=setTimeout(()=>h(!1),320);return()=>clearTimeout(e)},[]);let g=(0,G.useCallback)(e=>{if(!p.current)return;let t=window.innerWidth,n=e.clientX/t;u(Math.min(Kt,Math.max(Gt,n)))},[u]),_=(0,G.useCallback)(e=>{if(!p.current)return;let{pointerId:t,element:n}=p.current;try{n.releasePointerCapture(t)}catch{}p.current=null,window.removeEventListener(`pointermove`,g),window.removeEventListener(`pointerup`,_),window.removeEventListener(`pointercancel`,_)},[g]),v=(0,G.useCallback)(e=>{let t=e.currentTarget;try{t.setPointerCapture(e.pointerId)}catch{}p.current={pointerId:e.pointerId,element:t},window.addEventListener(`pointermove`,g),window.addEventListener(`pointerup`,_),window.addEventListener(`pointercancel`,_)},[g,_]);(0,G.useEffect)(()=>()=>{window.removeEventListener(`pointermove`,g),window.removeEventListener(`pointerup`,_),window.removeEventListener(`pointercancel`,_);let e=p.current;if(e){try{e.element.releasePointerCapture(e.pointerId)}catch{}p.current=null}},[g,_]);let y=(0,G.useCallback)(t=>{let n=.04;t.key===`ArrowLeft`?(t.preventDefault(),u(Math.max(Gt,e.splitRatio-n))):t.key===`ArrowRight`?(t.preventDefault(),u(Math.min(Kt,e.splitRatio+n))):t.key===`Home`?(t.preventDefault(),u(Gt)):t.key===`End`?(t.preventDefault(),u(Kt)):t.key===`0`&&(t.preventDefault(),u(.5))},[u,e.splitRatio]),b=e=>{e.target===e.currentTarget&&c()},x=u=>{let d=u===e.originSide,f=u===`left`?t:n;return f?(0,q.jsx)(Hn,{ticket:f,allLabels:i,allTickets:r,onClose:d?c:()=>l(null,u),onOpenTicket:s,onSave:a,onDelete:o,embedded:!0},`${u}-${f.id}`):(0,q.jsx)(Wt,{tickets:r,excludeIds:[t?.id,n?.id].filter(e=>e!=null),onSelect:e=>l(e,u)})},S=(e.splitRatio*100).toFixed(2),C=((1-e.splitRatio)*100).toFixed(2);return(0,q.jsxs)(`div`,{ref:f,"data-testid":`split-view-shell`,className:`fixed inset-0 z-[68] flex`,onClick:b,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/70 pointer-events-none`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`relative flex w-full h-full`,style:{transition:m?`opacity 280ms cubic-bezier(0.34, 1.56, 0.64, 1)`:void 0},children:[(0,q.jsx)(`div`,{"data-testid":`split-panel-left`,className:`relative h-full overflow-hidden`,style:{width:`${S}%`,transition:m?`width 280ms cubic-bezier(0.34, 1.56, 0.64, 1)`:void 0},children:(0,q.jsx)(`div`,{className:`h-full flex items-center justify-center p-2`,children:(0,q.jsx)(`div`,{className:`w-full h-full max-h-[95vh]`,children:x(`left`)})})}),(0,q.jsx)(`div`,{"data-testid":`split-divider`,role:`separator`,"aria-orientation":`vertical`,"aria-valuenow":Math.round(e.splitRatio*100),"aria-valuemin":Math.round(Gt*100),"aria-valuemax":Math.round(Kt*100),tabIndex:0,onPointerDown:v,onKeyDown:y,className:`relative z-10 w-2 cursor-col-resize bg-border/40 hover:bg-accent-primary/40 transition-colors focus:outline-none focus:bg-accent-primary/60`}),(0,q.jsx)(`div`,{"data-testid":`split-panel-right`,className:`relative h-full overflow-hidden`,style:{width:`${C}%`,transition:m?`width 280ms cubic-bezier(0.34, 1.56, 0.64, 1)`:void 0},children:(0,q.jsx)(`div`,{className:`h-full flex items-center justify-center p-2`,children:(0,q.jsx)(`div`,{className:`w-full h-full max-h-[95vh]`,children:x(`right`)})})})]})]})}var Jt=.5,Yt=.25,Xt=.75,Zt={leftId:null,rightId:null,originSide:null,splitRatio:Jt};function Qt(e){return Number.isFinite(e)?Math.min(Xt,Math.max(Yt,e)):Jt}function $t(e,t){switch(t.type){case`openCentered`:return e.originSide!==null&&e.leftId!==t.id&&e.rightId!==t.id?{leftId:t.id,rightId:null,originSide:null,splitRatio:Jt}:e.originSide!==null&&(e.leftId===t.id||e.rightId===t.id)?e:{...Zt,leftId:t.id};case`closeAll`:return Zt;case`enterSplit`:{let n=t.ticketId??e.leftId;return n===null||e.originSide!==null?e:t.side===`left`?{leftId:n,rightId:null,originSide:`left`,splitRatio:Jt}:{leftId:null,rightId:n,originSide:`right`,splitRatio:Jt}}case`setComparedTicket`:{if(e.originSide===null)return e;let n=e.originSide===`left`?`right`:`left`;return t.side===n?t.side===`left`?{...e,leftId:t.id}:{...e,rightId:t.id}:e}case`exitSplit`:{if(e.originSide===null)return e;let t=e.originSide===`left`?e.leftId:e.rightId;return{...Zt,leftId:t}}case`setSplitRatio`:return{...e,splitRatio:Qt(t.ratio)};default:return e}}var en=(0,G.createContext)(null),tn=900;function nn({children:e}){let[t,n]=(0,G.useReducer)($t,Zt),{tickets:r,updateTicket:i,deleteTicket:a}=Ie(),{activeProjectId:o,setActiveProjectId:s}=P(),c=(0,G.useRef)(null);(0,G.useEffect)(()=>{n({type:`closeAll`});let e=c.current;e&&(c.current=null,e.projectId===o&&n({type:`openCentered`,id:e.ticketId}))},[o]);let l=(0,G.useCallback)(e=>n({type:`openCentered`,id:e}),[]),u=(0,G.useCallback)((e,t)=>{if(e===o){n({type:`openCentered`,id:t});return}c.current={projectId:e,ticketId:t},s(e)},[o,s]),d=(0,G.useCallback)(()=>n({type:`closeAll`}),[]),f=(0,G.useCallback)((e,t)=>{typeof window<`u`&&window.innerWidth<tn||n({type:`enterSplit`,side:e,ticketId:t})},[]),p=(0,G.useCallback)((e,t)=>n({type:`setComparedTicket`,id:e,side:t}),[]),m=(0,G.useCallback)(()=>n({type:`exitSplit`}),[]),h=(0,G.useCallback)(e=>n({type:`setSplitRatio`,ratio:e}),[]);(0,G.useEffect)(()=>{if(typeof window>`u`)return;function e(){window.innerWidth<tn&&n({type:`exitSplit`})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let g=(0,G.useMemo)(()=>{let e=new Set;for(let t of r)for(let n of t.labels??[])e.add(n);return Array.from(e).sort()},[r]),_=t.leftId==null?null:r.find(e=>e.id===t.leftId)??null,v=t.rightId==null?null:r.find(e=>e.id===t.rightId)??null,y=(0,G.useMemo)(()=>({openTicketDetail:l,openTicketDetailInProject:u,closeTicketDetail:d,enterSplit:f,setComparedTicket:p,exitSplit:m,setSplitRatio:h,state:t}),[l,u,d,f,p,m,h,t]),b=t.originSide!==null;return(0,q.jsxs)(en.Provider,{value:y,children:[e,!b&&_&&(0,q.jsx)(Hn,{ticket:_,allLabels:g,allTickets:r,onClose:d,onOpenTicket:l,onSave:i,onDelete:a},_.id),b&&(0,q.jsx)(qt,{state:t,leftTicket:_,rightTicket:v,allTickets:r,allLabels:g,onSave:i,onDelete:a,onOpenTicket:l,onCloseAll:d,onSetCompared:p,onSetRatio:h,onExitSplit:m})]})}function rn(){return(0,G.useContext)(en)||{openTicketDetail:()=>{typeof console<`u`&&console.warn(`[TicketDetailModalContext] openTicketDetail called without provider`)},openTicketDetailInProject:()=>{typeof console<`u`&&console.warn(`[TicketDetailModalContext] openTicketDetailInProject called without provider`)},closeTicketDetail:()=>{},enterSplit:()=>{},setComparedTicket:()=>{},exitSplit:()=>{},setSplitRatio:()=>{},state:Zt}}function an(e){return e<.005?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function on(e){return e<1e3?`${e} ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`}function sn({ticketId:e}){let{t}=p(`tickets`),[n,r]=(0,G.useState)(null),i=a(),{activeProjectId:o}=P(),{closeTicketDetail:s}=rn();if((0,G.useEffect)(()=>{let t=new AbortController;return r(null),fetch(`${N()}/tickets/${e}/spending-summary`,{signal:t.signal}).then(e=>e.ok?e.json():null).then(e=>{e&&r(e)}).catch(()=>{}),()=>t.abort()},[e,o]),!n||!n.bySurface||!n.totalRuns||n.totalRuns===0)return null;let c=Object.entries(n.bySurface).filter(([,e])=>e.count>0).map(([e,n])=>t(`spendingLine.breakdownItem`,{n:n.count,label:Se[e].toLowerCase()})).join(` + `);return(0,q.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),s(),i(`/analytics?ticketId=${e}`)},className:`mt-1.5 group inline-flex items-center gap-1.5 text-[11px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,"aria-label":t(`spendingLine.ariaLabel`),children:[(0,q.jsxs)(`span`,{className:`tabular-nums font-medium text-foreground`,title:(n.estimatedCostUsd??0)>0?t(`spendingLine.estimatedTooltip`):void 0,children:[(n.estimatedCostUsd??0)>0?`~`:``,an(n.totalCostUsd)]}),(0,q.jsx)(`span`,{className:`text-muted-foreground/60`,children:`·`}),(0,q.jsx)(`span`,{className:`tabular-nums`,children:t(`spendingLine.turns`,{count:n.totalTurns})}),(0,q.jsx)(`span`,{className:`text-muted-foreground/60`,children:`·`}),(0,q.jsx)(`span`,{className:`tabular-nums`,children:t(`spendingLine.active`,{duration:on(n.activeDurationMs)})}),c&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground/60`,children:`·`}),(0,q.jsx)(`span`,{children:c})]}),(0,q.jsx)(v,{className:`w-3 h-3 opacity-0 group-hover:opacity-100 transition-opacity`})]})}var cn=/^\d{4}-\d{2}-\d{2}T/;function ln(e){if(cn.test(e))try{return{text:R(ht(e),{addSuffix:!0,locale:s()}),title:e}}catch{}return{text:e}}function un({localId:e}){let{t}=p(`jira`),{activeProjectId:n}=P(),r=Xe(),[i,a]=(0,G.useState)(null);if((0,G.useEffect)(()=>{if(!Ge||!r.connected)return;let t=!1;return a(null),L.getSpecDetails(e).then(e=>{t||a(e)}).catch(()=>{t||a(null)}),()=>{t=!0}},[e,n,r.connected]),!Ge||!r.connected||!i)return null;let o=i.development,s=i.fields.length>0,c=o.pullRequests.length>0,l=o.branches.length>0,u=(o.commits?.length??0)>0;return!s&&!c&&!l&&!u?null:(0,q.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-details-panel`,children:[s&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:t(`detail.detailsTitle`)}),(0,q.jsx)(`div`,{className:`space-y-1.5`,children:i.fields.map((e,t)=>{let n=ln(e.value);return(0,q.jsxs)(`div`,{className:`text-xs`,children:[(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide block`,children:e.label}),e.href?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{Q(e.href)},className:`inline-flex items-center gap-1 text-accent-info hover:underline text-left`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.value}),(0,q.jsx)(ee,{className:`w-3 h-3 shrink-0`})]}):(0,q.jsx)(`span`,{className:`text-foreground/80 whitespace-pre-line`,title:n.title,children:n.text})]},`${e.label}-${t}`)})})]}),(c||l||u)&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:t(`detail.developmentTitle`)}),c&&(0,q.jsxs)(`div`,{className:`mb-2`,children:[(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide block mb-1`,children:t(`detail.dev.pullRequests`)}),(0,q.jsx)(`div`,{className:`space-y-1`,children:o.pullRequests.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{Q(e.url)},className:`w-full flex items-start gap-1.5 text-left text-xs hover:bg-accent-info/10 rounded px-1 py-0.5`,"data-testid":`jira-dev-pr`,children:[(0,q.jsx)(De,{className:`w-3 h-3 mt-0.5 shrink-0 text-accent-info`}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`truncate text-foreground/80 block`,children:e.title}),(0,q.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[e.status,e.sourceBranch?` · ${e.sourceBranch} → ${e.destBranch??``}`:``]})]})]},e.url))})]}),l&&(0,q.jsxs)(`div`,{className:`mb-2`,children:[(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide block mb-1`,children:t(`detail.dev.branches`)}),(0,q.jsx)(`div`,{className:`space-y-1`,children:o.branches.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{Q(e.url)},className:`w-full flex items-center gap-1.5 text-left text-xs hover:bg-accent-info/10 rounded px-1 py-0.5`,"data-testid":`jira-dev-branch`,children:[(0,q.jsx)(k,{className:`w-3 h-3 shrink-0 text-accent-info`}),(0,q.jsx)(`span`,{className:`truncate font-mono text-foreground/80`,children:e.name}),e.repo&&(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground truncate`,children:e.repo})]},e.url))})]}),u&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground uppercase tracking-wide block mb-1`,children:t(`detail.dev.commits`)}),(0,q.jsx)(`div`,{className:`space-y-1`,children:o.commits.map(e=>(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{Q(e.url)},className:`w-full flex items-center gap-1.5 text-left text-xs hover:bg-accent-info/10 rounded px-1 py-0.5`,"data-testid":`jira-dev-commit`,children:[(0,q.jsx)(B,{className:`w-3 h-3 shrink-0 text-accent-info`}),(0,q.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground shrink-0`,children:e.displayId}),(0,q.jsx)(`span`,{className:`truncate text-foreground/80`,children:e.message})]},e.url))})]})]})]})}var dn=e(r(),1);function fn({open:e,url:t,projectId:n,onClose:r}){let{t:i}=p(`browser`),a=C({projectId:n,open:e,initialUrl:t}),{canvasRef:o,viewport:s,status:c,errorMsg:l,url:u,title:d,popup:f}=a,[m,h]=(0,G.useState)(t),S=(0,G.useRef)(a.forwardInput);S.current=a.forwardInput;let T=(0,G.useRef)(null),E=(0,G.useCallback)(()=>(T.current??=b(e=>S.current(e)),T.current),[]);(0,G.useEffect)(()=>()=>{T.current?.dispose(),T.current=null},[]),(0,G.useEffect)(()=>{u&&h(u)},[u]),(0,G.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r]);let D=(0,G.useCallback)((e,t)=>{let n=o.current?.getBoundingClientRect();return n?_({x:e,y:t},{left:n.left,top:n.top,width:n.width,height:n.height},s):{x:0,y:0}},[o,s]),te=e=>e===2?`right`:e===1?`middle`:`left`,O=(0,G.useCallback)(e=>{let t=D(e.clientX,e.clientY);E().move(t.x,t.y)},[D,E]),ne=(0,G.useCallback)(e=>{let t=D(e.clientX,e.clientY),n=E();n.move(t.x,t.y),n.flush(),a.forwardInput({type:`mouse`,action:`down`,x:t.x,y:t.y,button:te(e.button),clickCount:e.detail||1})},[D,a,E]),k=(0,G.useCallback)(e=>{let t=D(e.clientX,e.clientY),n=E();n.move(t.x,t.y),n.flush(),a.forwardInput({type:`mouse`,action:`up`,x:t.x,y:t.y,button:te(e.button),clickCount:e.detail||1})},[D,a,E]),re=(0,G.useCallback)(e=>{let t=D(e.clientX,e.clientY);E().wheel(t.x,t.y,e.deltaX,e.deltaY)},[D,E]),ie=(0,G.useCallback)(e=>{if(e.key===`Escape`)return;let t=e.metaKey||e.ctrlKey;if(t&&(e.key===`c`||e.key===`v`||e.key===`x`)){e.preventDefault();let t=e.key;(async()=>{try{if(t===`v`){let e=await navigator.clipboard.readText();e&&await a.clipboard(`paste`,e)}else{let{text:e}=await a.clipboard(t===`x`?`cut`:`copy`);e&&await navigator.clipboard.writeText(e)}}catch{}})();return}let n={type:`key`,action:`down`,key:e.key,code:e.code,text:!t&&e.key.length===1?e.key:void 0};a.forwardInput(n),(e.key===`Tab`||e.key===` `||e.key.startsWith(`Arrow`))&&e.preventDefault()},[a]),ae=(0,G.useCallback)(e=>{e.key!==`Escape`&&a.forwardInput({type:`key`,action:`up`,key:e.key,code:e.code})},[a]),oe=(0,G.useCallback)(()=>{a.navigate(`goto`,m)},[a,m]);return!e||typeof document>`u`?null:(0,dn.createPortal)((0,q.jsx)(`div`,{className:`fixed inset-0 z-[80] bg-background-deep/50 backdrop-blur-sm pointer-events-auto`,onClick:e=>{e.target===e.currentTarget&&r()},"data-testid":`webview-modal`,children:(0,q.jsxs)(`div`,{className:`absolute inset-2 flex flex-col border border-border rounded-lg bg-background-deep overflow-hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":i(`modal.dialogLabel`),onClick:e=>e.stopPropagation(),children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border/50 bg-surface/80 shrink-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(F,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":i(`common:actions.back`),onClick:()=>a.navigate(`back`),children:(0,q.jsx)(g,{className:`w-4 h-4`})}),(0,q.jsx)(F,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":i(`modal.nav.forward`),onClick:()=>a.navigate(`forward`),children:(0,q.jsx)(v,{className:`w-4 h-4`})}),(0,q.jsx)(F,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":i(`modal.nav.reload`),onClick:()=>a.navigate(`reload`),children:(0,q.jsx)(x,{className:`w-4 h-4`})})]}),(0,q.jsxs)(`form`,{className:`flex-1 flex items-center gap-2 min-w-0`,onSubmit:e=>{e.preventDefault(),oe()},children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0 rounded-md border border-border bg-background px-2.5 py-1`,children:[(0,q.jsx)(y,{className:`w-3.5 h-3.5 text-muted-foreground shrink-0`}),(0,q.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),oe())},placeholder:i(`modal.address.placeholder`),"aria-label":i(`modal.address.label`),className:`flex-1 min-w-0 bg-transparent outline-none text-sm`})]}),(0,q.jsx)(F,{type:`submit`,size:`sm`,variant:`secondary`,className:`shrink-0`,disabled:c===`error`,children:i(`modal.address.go`)})]}),(0,q.jsx)(F,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":i(`modal.closeBrowser`),onClick:r,children:(0,q.jsx)(ue,{className:`w-4 h-4`})})]}),(0,q.jsxs)(`div`,{className:`px-3 py-1 text-[11px] text-muted-foreground truncate shrink-0 flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full shrink-0 ${c===`ready`?`bg-accent-success`:c===`error`?`bg-destructive`:`bg-accent-warning animate-pulse`}`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`truncate`,children:c===`connecting`?i(`modal.status.connecting`):c===`error`?l??i(`modal.status.unavailable`):d||``})]}),f&&(0,q.jsxs)(`div`,{"data-testid":`webview-popup-bar`,className:`flex items-center gap-2 px-3 py-1.5 text-xs border-b shrink-0 ${f.active?`bg-accent-info/10 border-accent-info/30 text-accent-info`:`bg-surface/70 border-border/40 text-muted-foreground`}`,children:[(0,q.jsx)(ee,{className:`w-3.5 h-3.5 shrink-0`}),f.active?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`truncate font-medium`,children:i(`popup.loginWindow`,{origin:w(f.url)})}),f.count>1&&(0,q.jsx)(`span`,{className:`shrink-0 opacity-70`,children:i(`popup.stacked`,{count:f.count-1})}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>a.setPopupView(`root`),className:`ml-auto shrink-0 inline-flex items-center gap-1 h-6 px-2 rounded-md border border-current/30 hover:bg-card/60 transition-colors`,children:[(0,q.jsx)(g,{className:`w-3 h-3`}),i(`popup.backToPage`)]})]}):(0,q.jsxs)(`button`,{type:`button`,onClick:()=>a.setPopupView(`popup`),className:`inline-flex items-center gap-1 h-6 px-2 rounded-md border border-border/50 hover:bg-card/60 hover:text-foreground transition-colors`,children:[i(`popup.show`),f.count>1&&(0,q.jsx)(`span`,{className:`opacity-70`,children:i(`popup.stacked`,{count:f.count-1})})]})]}),(0,q.jsx)(`div`,{className:`relative flex-1 min-h-0 overflow-hidden flex items-center justify-center outline-none`,tabIndex:0,onKeyDown:ie,onKeyUp:ae,children:c===`error`?(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center max-w-md px-6`,children:[(0,q.jsx)(le,{className:`w-8 h-8 text-accent-warning`}),(0,q.jsx)(`p`,{className:`text-sm text-foreground/90`,children:l??i(`modal.error.unavailable`)})]}):(0,q.jsx)(`canvas`,{ref:o,className:`max-w-full max-h-full block shadow-2xl cursor-default`,onPointerMove:O,onPointerDown:ne,onPointerUp:k,onContextMenu:e=>e.preventDefault(),onWheel:re})})]})}),document.body)}var pn=(0,G.createContext)(null);function mn({children:e}){let{activeProjectId:t}=P(),[n,r]=(0,G.useState)(null),i=(0,G.useCallback)(e=>r(e),[]),a=S();return(0,q.jsxs)(pn.Provider,{value:{openWebView:i,canOpenWebView:a&&!!t},children:[e,a&&n&&t&&(0,q.jsx)(fn,{open:!0,url:n,projectId:t,onClose:()=>r(null)})]})}function hn(){return(0,G.useContext)(pn)??{openWebView:()=>{},canOpenWebView:!1}}var gn={analyzing:`activity:smash.stage.analyzing`,identifying:`activity:smash.stage.identifying`,ordering:`activity:smash.stage.ordering`},_n=(0,G.createContext)(null);function $(e){return`smash:${e}`}async function vn(e,t){try{let n=await fetch(`${j}/api/projects/${e}/tickets/${t}/smash`,{method:`POST`});if(n.ok)h.loading(u.t(`activity:smash.retrying`),{id:$(t)});else{let e=await n.json().catch(()=>({}));h.error(e.reason?u.t(`activity:smash.couldNotRetryWithReason`,{reason:e.reason}):u.t(`activity:smash.couldNotRetry`),{id:$(t)})}}catch(e){h.error(u.t(`activity:smash.retryFailed`,{message:e.message}),{id:$(t)})}}async function yn(e,t,n){try{let r=await fetch(`${j}/api/projects/${e}/tickets/${t}/smash/undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({smashedAt:n})});if(r.ok)h.success(u.t(`activity:smash.undone`),{id:$(t),duration:3e3});else{let e=await r.json().catch(()=>({}));h.error(e.reason?u.t(`activity:smash.undoFailedWithReason`,{reason:e.reason}):u.t(`activity:smash.undoFailed`),{id:$(t)})}}catch(e){h.error(u.t(`activity:smash.undoFailedWithReason`,{reason:e.message}),{id:$(t)})}}function bn({children:e}){let{registerHandler:t,unregisterHandler:n}=M(),[r,i]=(0,G.useState)({}),a=(0,G.useRef)(new Map),o=(0,G.useRef)(new Map),s=(0,G.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.started`)return;let n=t.ticketId,r=t.runId,o=t.projectId,s=t.timestamp,c=t.ticketTitle;typeof n!=`number`||!r||!o||(a.current.set(n,o),i(e=>({...e,[n]:{ticketId:n,runId:r,stage:`analyzing`,startedAt:s??new Date().toISOString(),ticketTitle:c}})),h.loading(u.t(gn.analyzing),{id:$(n),description:c?u.t(`activity:smash.onTitled`,{title:c}):u.t(`activity:smash.onThisSpec`)}))},[]),c=(0,G.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.progress`)return;let n=t.ticketId,r=t.stage;if(typeof n!=`number`||!r)return;let a;i(e=>{let t=e[n];return t?(a=t.ticketTitle,{...e,[n]:{...t,stage:r}}):e}),h.loading(u.t(gn[r]),{id:$(n),description:a?u.t(`activity:smash.onTitled`,{title:a}):u.t(`activity:smash.onThisSpec`)})},[]),l=(0,G.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.completed`)return;let n=t.ticketId,r=t.runId,a=t.projectId,s=t.smashedAt,c=t.childrenIds;typeof n!=`number`||!r||!a||!s||!c||(o.current.set(r,s),i(e=>{let t={...e};return delete t[n],t}),h.success(u.t(`activity:smash.split`,{count:c.length}),{id:$(n),duration:1e4,action:{label:u.t(`activity:smash.undoAction`),onClick:()=>void yn(a,n,s)}}))},[]),d=(0,G.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.failed`)return;let n=t.ticketId,r=t.projectId,o=t.reason??`unknown`;if(typeof n!=`number`||!r)return;a.current.set(n,r),i(e=>{let t={...e};return delete t[n],t});let s=o===`invalid-output`?u.t(`activity:smash.failReason.invalidOutput`):o===`timeout`?u.t(`activity:smash.failReason.timeout`):o===`model_error`?u.t(`activity:smash.failReason.modelError`):o===`crashed`?u.t(`activity:smash.failReason.crashed`):u.t(`activity:smash.failReason.generic`,{reason:o});h.error(u.t(`activity:smash.couldNotComplete`),{id:$(n),description:s,action:{label:u.t(`common:actions.retry`),onClick:()=>void vn(r,n)},duration:15e3})},[]),f=(0,G.useCallback)(e=>{let t=e;if(!t||t.type!==`smash.undone`)return;let n=t.ticketId;typeof n==`number`&&(h.dismiss($(n)),h.success(u.t(`activity:smash.undone`),{id:$(n),duration:3e3}))},[]);(0,G.useLayoutEffect)(()=>(t(`_smash_started`,s),t(`_smash_progress`,c),t(`_smash_completed`,l),t(`_smash_failed`,d),t(`_smash_undone`,f),()=>{n(`_smash_started`),n(`_smash_progress`),n(`_smash_completed`),n(`_smash_failed`),n(`_smash_undone`)}),[t,n,s,c,l,d,f]),(0,G.useEffect)(()=>()=>{a.current.clear(),o.current.clear()},[]);let p=(0,G.useMemo)(()=>({inflight:r}),[r]);return(0,q.jsx)(_n.Provider,{value:p,children:e})}function xn(e){let t=(0,G.useContext)(_n);return!t||e==null?null:t.inflight[e]??null}var Sn=150,Cn={analyzing:0,identifying:1,ordering:2},wn={analyzing:`smash.stage.analyzing`,identifying:`smash.stage.identifying`,ordering:`smash.stage.ordering`};function Tn({stage:e,minDisplayMs:t=Sn}){let{t:n}=p(`activity`),[r,i]=(0,G.useState)(e),a=(0,G.useRef)(Date.now()),o=(0,G.useRef)(null);if((0,G.useEffect)(()=>{if(e===r)return;let n=Date.now()-a.current,s=Math.max(0,t-n);return o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{i(e),a.current=Date.now(),o.current=null},s),()=>{o.current&&clearTimeout(o.current)}},[e,r,t]),!r)return null;let s=Cn[r];return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md border border-accent-highlight/40 bg-accent-highlight/10 text-sm text-foreground`,role:`status`,"aria-live":`polite`,"data-testid":`smash-status-pills`,children:[(0,q.jsx)(re,{className:`h-4 w-4 animate-spin text-accent-highlight`,"aria-hidden":!0}),(0,q.jsx)(`div`,{className:`flex items-center gap-1.5`,children:[`analyzing`,`identifying`,`ordering`].map(e=>(0,q.jsx)(`span`,{className:[`inline-block w-1.5 h-1.5 rounded-full transition-all`,Cn[e]<=s?`bg-accent-highlight`:`bg-muted`,e===r?`scale-125`:`scale-100`].join(` `),"aria-hidden":!0},e))}),(0,q.jsx)(`span`,{className:`font-medium`,children:n(wn[r])})]})}var En={simple:{titleKey:`smashModal.modes.simple.title`,bulletKeys:[`smashModal.modes.simple.bullet1`,`smashModal.modes.simple.bullet2`,`smashModal.modes.simple.bullet3`],etaKey:`smashModal.modes.simple.eta`},full:{titleKey:`smashModal.modes.full.title`,bulletKeys:[`smashModal.modes.full.bullet1`,`smashModal.modes.full.bullet2`,`smashModal.modes.full.bullet3`,`smashModal.modes.full.bullet4`],etaKey:`smashModal.modes.full.eta`}};function Dn({open:e,ticketTitle:t,isReSmash:n,childrenCount:r,submitting:i=!1,onCancel:a,onConfirm:o}){let{t:s}=p(`activity`),[c,l]=(0,G.useState)(`simple`),{panelRef:u,panelStyle:d,headerHandleProps:m,resizeHandles:h,isFloating:g,guardBackdrop:_}=pe();return e?(0,q.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center`,role:`dialog`,"aria-modal":`true`,"data-testid":`smash-confirm-modal`,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:_(a)}),(0,q.jsxs)(`div`,{ref:u,className:`relative w-full max-w-lg m-4 rounded-xl glass-card border border-border/30 animate-in fade-in zoom-in-95 duration-150`,style:d,children:[(0,q.jsxs)(`div`,{...m,className:`flex items-start justify-between gap-3 px-5 py-4 border-b border-border/30 ${g?`cursor-grab active:cursor-grabbing`:``}`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0`,children:[(0,q.jsx)(H,{className:`w-5 h-5 text-accent-highlight shrink-0 mt-0.5`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:s(`smashModal.title`)}),(0,q.jsx)(`p`,{className:`text-[11px] text-muted-foreground truncate`,title:t,children:t})]})]}),(0,q.jsx)(`button`,{type:`button`,onClick:a,className:`h-7 w-7 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-surface/50 transition-colors shrink-0`,"aria-label":s(`common:actions.close`),children:(0,q.jsx)(ue,{className:`w-4 h-4`})})]}),n&&r>0&&(0,q.jsx)(`div`,{className:`mx-5 mt-4 rounded-md border border-accent-warning/40 bg-accent-warning/10 px-3 py-2 text-xs text-foreground`,children:(0,q.jsx)(f,{t:s,i18nKey:`smashModal.reSmashWarning`,count:r})}),(0,q.jsxs)(`div`,{className:`px-5 py-4 space-y-3`,children:[(0,q.jsx)(`p`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:s(`smashModal.modePickerLabel`)}),[`simple`,`full`].map(e=>{let t=En[e],n=c===e;return(0,q.jsx)(`button`,{type:`button`,onClick:()=>l(e),disabled:i,className:`w-full text-left rounded-lg border px-3 py-3 transition-colors ${n?`border-accent-highlight/60 bg-accent-highlight/10`:`border-border/40 bg-card/40 hover:bg-card/60 hover:border-border/60`}`,"data-testid":`smash-mode-${e}`,children:(0,q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 h-3.5 w-3.5 rounded-full border-2 shrink-0 ${n?`border-accent-highlight bg-accent-highlight`:`border-muted-foreground/60`}`,"aria-hidden":!0}),(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[e===`full`&&(0,q.jsx)(de,{className:`w-3.5 h-3.5 text-accent-highlight`,"aria-hidden":!0}),s(t.titleKey)]}),(0,q.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:s(t.etaKey)})]}),(0,q.jsx)(`ul`,{className:`space-y-0.5`,children:t.bulletKeys.map(e=>(0,q.jsxs)(`li`,{className:`text-[11px] text-foreground/70 leading-snug`,children:[`• `,s(e)]},e))})]})]})},e)})]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-5 py-3 border-t border-border/30 bg-surface/20`,children:[(0,q.jsx)(F,{variant:`ghost`,size:`sm`,onClick:a,disabled:i,children:s(`common:actions.cancel`)}),(0,q.jsxs)(F,{size:`sm`,onClick:()=>o(c),disabled:i,"data-testid":`smash-confirm-modal-continue`,children:[(0,q.jsx)(H,{className:`w-3.5 h-3.5 mr-1.5`}),s(i?`smashModal.starting`:n?`smashModal.confirmReSmash`:`smashModal.smash`)]})]})]}),(0,q.jsx)(ve,{handles:h})]}):null}var On=`## Contract Layer`;function kn(e,t){return!(!t||e.status===`draft`||e.parent_epic_id!=null||!e.description?.includes(On))}function An({ticket:e,projectId:t,featureFlagOn:n,childrenCount:r}){let{t:i}=p(`activity`),a=xn(e.id),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(!1),u=e.is_epic===!0,d=!u&&kn(e,n),f=u&&n,m=u&&r>0,g=(0,G.useCallback)(async n=>{l(!0);try{let r=await fetch(`${j}/api/projects/${t}/tickets/${e.id}/smash`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:n})});if(!r.ok){let e=await r.json().catch(()=>({}));h.error(e.reason?i(`smash.couldNotStartWithReason`,{reason:e.reason}):i(`smash.couldNotStart`));return}s(!1)}catch(e){h.error(i(`smash.smashFailed`,{message:e.message}))}finally{l(!1)}},[t,e.id,i]),_=(0,G.useCallback)(async n=>{if(m){l(!0);try{if(!(await fetch(`${j}/api/projects/${t}/tickets/${e.id}/children`,{method:`DELETE`})).ok){h.error(i(`smash.couldNotDeleteChildren`)),l(!1);return}}catch(e){h.error(i(`smash.deleteFailed`,{message:e.message})),l(!1);return}}await g(n)},[m,g,t,e.id,i]);return!d&&!f?null:a?(0,q.jsx)(`div`,{className:`flex flex-col gap-2`,"data-testid":`smash-actions-streaming`,children:(0,q.jsx)(Tn,{stage:a.stage})}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(F,{size:`sm`,variant:`outline`,onClick:()=>s(!0),className:`border-accent-highlight/40 text-accent-highlight hover:bg-accent-highlight/10`,"data-testid":f?`resmash-button`:`smash-button`,children:[(0,q.jsx)(H,{className:`w-3.5 h-3.5 mr-1.5`}),i(f?`smash.reSmashButton`:`smash.smashButton`)]}),(0,q.jsx)(Dn,{open:o,ticketTitle:e.title,isReSmash:m,childrenCount:r,submitting:c,onCancel:()=>s(!1),onConfirm:_})]})}function jn({epic:e,childExecutionOrder:t,totalChildren:n,onOpenEpic:r}){let{t:i}=p(`activity`);return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-accent-secondary/30 bg-accent-secondary/10 px-3 py-1.5 text-xs`,"data-testid":`epic-breadcrumb`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:r,className:`text-accent-secondary hover:underline font-medium`,children:[`← `,e.title]}),t!=null&&n>0&&(0,q.jsx)(`span`,{className:`text-foreground/60`,children:i(`epicChildren.step`,{order:t,total:n})})]})}var Mn={critical:`bg-red-400`,high:`bg-orange-400`,medium:`bg-yellow-400`,low:`bg-slate-400`};function Nn(e){return e?Mn[e]:`bg-muted`}function Pn(e){return[...e].sort((e,t)=>{let n=e.execution_order??1/0,r=t.execution_order??1/0;return n===r?e.id-t.id:n-r})}function Fn({ticket:e,allTickets:t,onOpenTicket:n}){let{t:r}=p(`activity`),i=e.is_epic===!0,a=e.parent_epic_id!=null;if(!i&&!a)return null;if(i){let i=Pn(t.filter(t=>t.parent_epic_id===e.id));return(0,q.jsx)(In,{header:r(`family.subSpecsHeader`,{count:i.length}),rows:i,currentId:e.id,onOpenTicket:n,emptyMessage:r(`family.emptySubSpecs`)})}let o=t.find(t=>t.id===e.parent_epic_id)??null,s=Pn(t.filter(t=>t.parent_epic_id===e.parent_epic_id)),c=o?[o,...s]:s;return(0,q.jsx)(In,{header:r(`family.familyHeader`,{count:s.length}),rows:c,currentId:e.id,onOpenTicket:n,emptyMessage:r(`family.noSiblings`)})}function In({header:e,rows:t,currentId:n,onOpenTicket:r,emptyMessage:i}){let{t:a}=p(`activity`);return(0,q.jsxs)(`div`,{"data-testid":`epic-family-sidebar`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5`,children:[(0,q.jsx)(H,{className:`w-3 h-3 text-accent-highlight`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:e})]}),t.length===0?(0,q.jsx)(`p`,{className:`text-[10px] text-foreground/50 italic`,children:i}):(0,q.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:t.map(e=>{let t=e.id===n,i=e.is_epic===!0;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{t||r(e.id)},disabled:t,"aria-label":a(i?`family.openParentEpic`:`family.openSubSpec`,{title:e.title}),"aria-current":t?`page`:void 0,className:[`w-full flex items-center gap-1.5 rounded px-1.5 py-1 text-left transition-colors`,t?`bg-accent-highlight/15 cursor-default`:`hover:bg-muted/30 cursor-pointer`].join(` `),"data-testid":`epic-family-row-${e.id}`,children:[i?(0,q.jsx)(E,{className:`w-3 h-3 text-accent-highlight flex-shrink-0`,"aria-hidden":!0}):(0,q.jsx)(`span`,{className:`text-[9px] tabular-nums text-foreground/40 w-3 text-center flex-shrink-0`,children:e.execution_order??`–`}),(0,q.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full flex-shrink-0 ${Nn(e.priority)}`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`text-[11px] truncate ${t?`text-foreground font-medium`:`text-foreground/80`}`,title:e.title,children:e.title})]})},e.id)})})]})}var Ln=900,Rn=.2,zn=[{value:`critical`,labelKey:`priority.critical`,className:`text-red-400`},{value:`high`,labelKey:`priority.high`,className:`text-orange-400`},{value:`medium`,labelKey:`priority.medium`,className:`text-yellow-400`},{value:`low`,labelKey:`priority.low`,className:`text-slate-400`}];function Bn(e){return e.jira_epic_key&&e.jira_url?e.jira_url.replace(/\/browse\/[^/]+$/,`/browse/${e.jira_epic_key}`):null}var Vn={manual:`source.manual`,"product-backlog":`source.productBacklog`,"propose-spec":`source.proposeSpec`,"get-backlog-specs":`source.getBacklogSpecs`,"free-prompt":`source.freePrompt`};function Hn({ticket:e,allLabels:t,allTickets:n,onClose:r,onOpenTicket:i,onSave:a,onDelete:o,rails:s,onMoveToRail:c,onRemoveFromRail:l,embedded:u=!1}){let{t:d}=p(`tickets`),{t:m}=p(`jira`),{activeProjectId:g,projects:_}=P(),{enterSplit:y,state:b}=rn(),x=b.originSide!==null,S=_.find(e=>e.id===g)?.provider!==`codex`,C=(0,G.useMemo)(()=>(n??[]).filter(t=>t.parent_epic_id===e.id),[n,e.id]),w=(0,G.useMemo)(()=>e.parent_epic_id==null?null:(n??[]).find(t=>t.id===e.parent_epic_id)??null,[n,e.parent_epic_id]),T=(0,G.useMemo)(()=>w?(n??[]).filter(e=>e.parent_epic_id===w.id).length:0,[n,w]),[E,D]=(0,G.useState)(e.title),[O,ne]=(0,G.useState)(e.description),[k,ae]=(0,G.useState)(e.priority??`medium`),[A,le]=(0,G.useState)([...e.labels??[]]),[de,j]=(0,G.useState)(!1),[M,N]=(0,G.useState)(!1),[I,L]=(0,G.useState)(``),[be,xe]=(0,G.useState)(!1),[R,Se]=(0,G.useState)(!1),[Ce,we]=(0,G.useState)(!1),[Ee,z]=(0,G.useState)(!1),[B,De]=(0,G.useState)(!1),[V,H]=(0,G.useState)(!1),U=Xe(),W=U.connected&&!!U.discardStatus&&e.source===`jira`&&!!e.jira_key,Oe=U.connected&&e.source===`jira`&&!!e.jira_key,[ke,Ae]=(0,G.useState)(e.attachments??[]);(0,G.useEffect)(()=>{Ae(e.attachments??[])},[e.attachments,e.id]);let je=(0,G.useRef)(null),Me=(0,G.useRef)(null),Ne=(0,G.useRef)(null),K=(0,G.useMemo)(()=>E!==e.title||O!==e.description||k!==e.priority||JSON.stringify(A)!==JSON.stringify(e.labels),[E,O,k,A,e]);(0,G.useEffect)(()=>{de&&je.current?.focus()},[de]),(0,G.useEffect)(()=>{if(M){let e=Me.current;e&&(e.focus(),e.selectionStart=e.value.length)}},[M]),(0,G.useEffect)(()=>{be&&Ne.current?.focus()},[be]),(0,G.useEffect)(()=>{function e(e){e.key===`Escape`&&!de&&!M&&!R&&r()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,de,M,R]);let Pe=(0,G.useMemo)(()=>{if(!I.trim())return[];let e=I.toLowerCase();return t.filter(t=>t.toLowerCase().includes(e)&&!A.includes(t)).slice(0,5)},[I,t,A]),Fe=(0,G.useCallback)(e=>{let t=e.trim();t&&!A.includes(t)&&le(e=>[...e,t]),L(``)},[A]),Ie=(0,G.useCallback)(e=>{le(t=>t.filter(t=>t!==e))},[]),Le=(0,G.useCallback)(async()=>{let t={};if(E!==e.title&&(t.title=E),O!==e.description&&(t.description=O),k!==e.priority&&(t.priority=k),JSON.stringify(A)!==JSON.stringify(e.labels)&&(t.labels=A),Object.keys(t).length===0){r();return}De(!0);let n=await a(e.id,t);De(!1),n?(h.success(d(`detailModal.toast.updated`)),r()):h.error(d(`detailModal.toast.updateFailed`))},[E,O,k,A,e,a,r,d]),Re=(0,G.useCallback)(async()=>{if(V)return;H(!0);let t=!1;try{t=await o(e.id)}catch{t=!1}if(H(!1),!t){h.error(d(`detailModal.toast.deleteFailed`));return}Se(!1),r()},[V,e.id,o,r,d]),[ze,Be]=(0,G.useState)(0),J=(0,G.useRef)(null),[Ve,He]=(0,G.useState)(()=>typeof window<`u`&&window.innerWidth>=Ln);(0,G.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>He(window.innerWidth>=Ln);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let Y=!u&&!x&&Ve,X=(0,G.useCallback)(e=>{J.current&&Be(e.clientX-J.current.startX)},[]),Z=(0,G.useCallback)(t=>{if(!J.current)return;let n=t.clientX-J.current.startX,i=window.innerWidth*Rn;if(window.removeEventListener(`pointermove`,X),window.removeEventListener(`pointerup`,Z),window.removeEventListener(`pointercancel`,Z),J.current=null,Be(0),Math.abs(n)>=i&&window.innerWidth>=Ln){let t=b.leftId===e.id;y(n<0?`left`:`right`,e.id),t||r()}},[y,X,b.leftId,e.id,r]),Ue=(0,G.useCallback)(e=>{Y&&e.button===0&&(e.target.closest(`button, input, textarea, select, [contenteditable="true"]`)||(J.current={startX:e.clientX,pointerId:e.pointerId},window.addEventListener(`pointermove`,X),window.addEventListener(`pointerup`,Z),window.addEventListener(`pointercancel`,Z)))},[Y,X,Z]);(0,G.useEffect)(()=>()=>{J.current&&(window.removeEventListener(`pointermove`,X),window.removeEventListener(`pointerup`,Z),window.removeEventListener(`pointercancel`,Z))},[X,Z]);let We=(0,G.useCallback)(()=>{if(!Y||window.innerWidth<Ln)return;let t=b.leftId===e.id;y(`right`,e.id),t||r()},[Y,y,b.leftId,e.id,r]),{panelRef:Ge,panelStyle:Ke,resizeHandles:qe,guardBackdrop:Je}=pe({enabled:!u,allowMove:!1}),Ye=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{ref:Ge,className:u?`relative w-full h-full rounded-xl bg-card border border-border/40 shadow-2xl shadow-black/50 flex flex-col overflow-hidden`:`relative w-full max-w-[67rem] m-4 rounded-xl bg-card border border-border/40 shadow-2xl shadow-black/50 flex flex-col animate-in fade-in zoom-in-95 duration-200 h-[90vh]`,style:{...ze===0?{transition:`transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1)`}:{transform:`translateX(${ze}px)`,transition:`none`},...Ke},children:[w&&(0,q.jsx)(`div`,{className:`px-5 pt-3`,children:(0,q.jsx)(jn,{epic:w,childExecutionOrder:e.execution_order??null,totalChildren:T,onOpenEpic:()=>i?.(w.id)})}),(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-3 px-5 py-4 border-b border-border/30 ${Y?`cursor-grab active:cursor-grabbing`:``}`,onPointerDown:Ue,"data-testid":`ticket-modal-header`,children:[(0,q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[de?(0,q.jsx)(`input`,{ref:je,value:E,onChange:e=>D(e.target.value),onBlur:()=>j(!1),onKeyDown:t=>{t.key===`Enter`&&j(!1),t.key===`Escape`&&(D(e.title),j(!1))},className:`w-full bg-transparent border-b border-accent-primary/50 text-sm font-semibold text-foreground outline-none pb-0.5`}):(0,q.jsxs)(`button`,{type:`button`,onClick:()=>j(!0),className:`group flex items-center gap-1.5 text-left w-full`,children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground truncate`,children:E||d(`untitled`)}),(0,q.jsx)(ie,{className:`w-3 h-3 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0`})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5`,children:[(0,q.jsxs)(`span`,{className:`text-[10px] text-foreground font-mono`,children:[`#`,e.id]}),e.status===`on_review`&&(0,q.jsx)(`span`,{title:d(`specs:status.onReviewHint`),"data-testid":`ticket-modal-on-review-badge`,children:(0,q.jsx)(et,{status:`on_review`})})]}),(0,q.jsx)(sn,{ticketId:e.id})]}),g&&(0,q.jsx)(`div`,{className:`shrink-0`,children:(0,q.jsx)(An,{ticket:e,projectId:g,featureFlagOn:S,childrenCount:C.length})}),(0,q.jsx)(Wn,{ticket:e,title:E,description:O,priority:k,labels:A,onClose:r}),s&&(c||l)&&(0,q.jsx)(Gn,{ticket:e,rails:s,onMoveToRail:c,onRemoveFromRail:l}),Y&&(0,q.jsxs)(F,{variant:`outline`,size:`sm`,className:`shrink-0 mr-1 gap-1.5`,"data-testid":`ticket-modal-compare`,onClick:We,title:d(`detailModal.compareTooltip`),children:[(0,q.jsx)(Te,{className:`w-3.5 h-3.5`}),d(`detailModal.compare`)]}),(0,q.jsx)(`button`,{onClick:r,className:`h-7 w-7 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-surface/50 transition-colors cursor-pointer shrink-0`,"data-testid":`ticket-modal-close`,children:(0,q.jsx)(ue,{className:`w-4 h-4`})})]}),(0,q.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0`,children:(0,q.jsxs)(`div`,{className:`flex flex-col sm:flex-row h-full`,children:[(0,q.jsxs)(`div`,{className:`flex-1 min-w-0 px-5 py-4 space-y-4 flex flex-col`,children:[(0,q.jsxs)(`div`,{className:`flex-1 flex flex-col`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-1.5`,children:d(`fields.description`)}),!M&&(0,q.jsxs)(`button`,{type:`button`,onClick:()=>N(!0),className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[(0,q.jsx)(ie,{className:`w-2.5 h-2.5`}),d(`common:actions.edit`)]})]}),M?(0,q.jsxs)(`div`,{className:`space-y-1.5 flex-1 flex flex-col`,children:[(0,q.jsx)(`textarea`,{ref:Me,value:O,onChange:e=>ne(e.target.value),className:`w-full flex-1 rounded-lg border border-border bg-input px-3 py-2 text-xs text-foreground placeholder:text-muted-foreground resize-none min-h-[300px]`,placeholder:d(`fields.markdownPlaceholder`)}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(F,{variant:`ghost`,size:`sm`,className:`h-6 text-[10px]`,onClick:()=>N(!1),children:d(`detailModal.doneEditing`)}),(0,q.jsx)(`span`,{className:`text-[9px] text-muted-foreground`,children:d(`fields.supportsMarkdown`)})]})]}):O?(0,q.jsx)(Yn,{description:O,onEdit:()=>N(!0)}):(0,q.jsx)(`button`,{type:`button`,onClick:()=>N(!0),className:`w-full rounded-lg border border-dashed border-border/40 bg-muted/10 px-3 py-4 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/20 transition-colors text-center`,children:d(`detailModal.addDescription`)})]}),(0,q.jsx)(Bt,{ticketKey:e.id,attachments:ke,onChange:Ae}),(0,q.jsx)(Vt,{ticketId:e.id,onClose:r}),e.prerequisites&&e.prerequisites.length>0&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:d(`detailModal.prerequisites`)}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.prerequisites.map(e=>(0,q.jsxs)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-mono bg-accent/60 text-foreground/70`,children:[`#`,e]},e))})]})]}),(0,q.jsxs)(`div`,{className:`sm:w-56 sm:border-l border-t sm:border-t-0 border-border/30 px-4 py-4 space-y-4 bg-muted/5`,children:[e.jira_url&&e.jira_key&&(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{Q(e.jira_url)},"data-testid":`jira-go-to-ticket`,className:`w-full inline-flex items-center justify-center gap-1.5 h-7 rounded border border-accent-info/50 bg-accent-info/10 px-2 text-xs font-medium text-accent-info hover:bg-accent-info/20 transition-colors`,children:[(0,q.jsx)(ee,{className:`w-3.5 h-3.5 shrink-0`}),m(`detail.goToTicket`,{key:e.jira_key})]}),e.jira_epic_key&&(0,q.jsxs)(`div`,{"data-testid":`jira-epic`,children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:m(`detail.epic`)}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{let t=Bn(e);t&&Q(t)},title:e.jira_epic_name??e.jira_epic_key,className:`w-full inline-flex items-center gap-1.5 rounded border border-accent-highlight/40 bg-accent-highlight/5 px-2 py-1.5 text-left text-xs hover:bg-accent-highlight/10 transition-colors`,children:[(0,q.jsx)(`span`,{className:`font-mono text-accent-highlight shrink-0`,children:e.jira_epic_key}),e.jira_epic_name&&(0,q.jsx)(`span`,{className:`truncate text-foreground/80`,children:e.jira_epic_name})]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:d(`fields.priority`)}),(0,q.jsx)(`select`,{value:k,onChange:e=>ae(e.target.value),className:`w-full h-7 rounded border border-border bg-input px-2 text-xs text-foreground`,children:zn.map(e=>(0,q.jsx)(`option`,{value:e.value,children:d(e.labelKey)},e.value))})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-1.5`,children:d(`fields.labels`)}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-1.5`,children:A.map(e=>(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] font-medium bg-accent/60 text-foreground/70 group`,children:[e,(0,q.jsx)(`button`,{type:`button`,onClick:()=>Ie(e),className:`text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,q.jsx)(te,{className:`w-2.5 h-2.5`})})]},e))}),be?(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)(`input`,{ref:Ne,value:I,onChange:e=>L(e.target.value),onKeyDown:e=>{e.key===`Enter`&&I.trim()&&(e.preventDefault(),Fe(I)),e.key===`Escape`&&(xe(!1),L(``))},onBlur:()=>{I.trim()&&Fe(I),xe(!1),L(``)},placeholder:d(`detailModal.addLabelPlaceholder`),className:`w-full h-6 rounded border border-border bg-input px-2 text-[10px] text-foreground placeholder:text-muted-foreground`}),Pe.length>0&&(0,q.jsx)(`div`,{className:`absolute left-0 right-0 top-full mt-0.5 rounded border border-border/50 bg-popover shadow-lg z-10 py-0.5`,children:Pe.map(e=>(0,q.jsx)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),Fe(e)},className:`w-full text-left px-2 py-1 text-[10px] hover:bg-accent/50 text-foreground/80`,children:e},e))})]}):(0,q.jsxs)(`button`,{type:`button`,onClick:()=>xe(!0),className:`flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,q.jsx)(oe,{className:`w-2.5 h-2.5`}),d(`detailModal.addLabel`)]})]}),(0,q.jsx)(Fn,{ticket:e,allTickets:n??[],onOpenTicket:e=>i?.(e)}),e.source===`jira`&&e.jira_key&&(0,q.jsx)(un,{localId:e.id}),e.metadata?.effort_level&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-0.5`,children:d(`detailModal.effort`)}),(0,q.jsx)(`span`,{className:`text-xs text-foreground/70`,children:e.metadata.effort_level})]}),e.assignee&&(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-0.5`,children:d(`detailModal.assignee`)}),(0,q.jsx)(`span`,{className:`text-xs text-foreground/70`,children:e.assignee})]})]})]})}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3 border-t border-border/30`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-muted-foreground`,children:[(0,q.jsx)(`span`,{children:d(`meta.createdAgo`,{time:Un(e.created_at)})}),(0,q.jsx)(`span`,{children:d(`meta.updatedAgo`,{time:Un(e.updated_at)})}),e.source&&(0,q.jsx)(`span`,{className:`bg-muted/30 rounded px-1.5 py-0.5`,children:Vn[e.source]?d(Vn[e.source]):e.source})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[W?(0,q.jsxs)(F,{variant:`ghost`,size:`sm`,className:`h-7 text-xs text-accent-info hover:bg-accent-info/10`,onClick:()=>we(!0),"data-testid":`jira-move-to-button`,children:[(0,q.jsx)(v,{className:`w-3 h-3 mr-1`}),m(`discard.moveButton`,{status:U.discardStatus})]}):(0,q.jsxs)(F,{variant:`ghost`,size:`sm`,className:`h-7 text-xs text-red-400 aurora-light:text-destructive hover:text-red-300 aurora-light:hover:text-destructive hover:bg-red-500/10 aurora-light:hover:bg-destructive/10`,onClick:()=>Se(!0),children:[(0,q.jsx)(ce,{className:`w-3 h-3 mr-1`}),d(`common:actions.delete`)]}),K&&(0,q.jsxs)(F,{size:`sm`,className:`h-7 text-xs`,onClick:()=>{Oe?z(!0):Le()},disabled:B||!E.trim(),children:[(0,q.jsx)(se,{className:`w-3 h-3 mr-1`}),d(B?`common:states.saving`:`common:actions.save`)]})]})]})]}),(0,q.jsx)(ye,{open:R,onOpenChange:e=>{V||Se(e)},children:(0,q.jsxs)(he,{className:`max-w-sm`,children:[(0,q.jsxs)(fe,{children:[(0,q.jsx)(ge,{children:d(`deleteDialog.title`)}),(0,q.jsx)(_e,{children:(0,q.jsx)(f,{t:d,i18nKey:`deleteDialog.body`,values:{id:e.id,title:e.title},components:{strong:(0,q.jsx)(`span`,{className:`font-semibold text-foreground`})}})})]}),(0,q.jsxs)(me,{children:[(0,q.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>Se(!1),disabled:V,children:d(`common:actions.cancel`)}),(0,q.jsxs)(F,{variant:`destructive`,size:`sm`,onClick:()=>{Re()},disabled:V,"aria-busy":V,children:[V?(0,q.jsx)(re,{className:`w-3.5 h-3.5 mr-1.5 animate-spin`}):(0,q.jsx)(ce,{className:`w-3.5 h-3.5 mr-1.5`}),d(`common:actions.delete`)]})]})]})}),W&&U.discardStatus&&(0,q.jsx)(Ze,{open:Ce,onOpenChange:we,ticket:{id:e.id,title:e.title,jira_key:e.jira_key},discardStatus:U.discardStatus,onDiscarded:r}),(0,q.jsx)(ye,{open:Ee,onOpenChange:z,children:(0,q.jsxs)(he,{className:`max-w-md`,"data-testid":`jira-save-confirm`,children:[(0,q.jsxs)(fe,{children:[(0,q.jsx)(ge,{children:m(`detail.saveTitle`)}),(0,q.jsx)(_e,{children:m(`detail.saveBody`,{key:e.jira_key??`#${e.id}`})})]}),(0,q.jsxs)(me,{children:[(0,q.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>z(!1),children:d(`common:actions.cancel`)}),(0,q.jsxs)(F,{size:`sm`,onClick:()=>{z(!1),Le()},disabled:B,"data-testid":`jira-save-confirm-btn`,children:[(0,q.jsx)(se,{className:`w-3.5 h-3.5 mr-1.5`}),m(`detail.saveConfirm`)]})]})]})})]});return u?Ye:(0,q.jsxs)(`div`,{className:`fixed inset-0 z-[68] flex items-center justify-center`,children:[(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/70`,onClick:Je(r)}),Ye,(0,q.jsx)(ve,{handles:qe})]})}function Un(e){try{return R(new Date(e),{addSuffix:!0,locale:s()})}catch{return e}}function Wn({ticket:e,title:t,description:n,priority:r,labels:i,onClose:a}){let{t:o}=p(`tickets`),{triggerResume:s}=T(),{activeProjectId:c}=P(),{closeTicketDetail:l}=rn();return Y(e)?(0,q.jsxs)(F,{variant:`default`,size:`sm`,onClick:()=>{if(!c)return;let{body:u,criteria:d}=Ve(n);s({kind:`explore-spec`,projectId:c,label:t||e.title||o(`detailModal.ticketFallbackLabel`,{id:e.id}),restoreRoute:`/`,params:{initialIdea:``,pendingSpecId:X(),initialAttachmentIds:[],resumeConversationId:e.origin_conversation_id??void 0,editTicket:{id:e.id,title:t,description:u,labels:i,priority:r,acceptanceCriteria:d,status:e.status}}}),l(),a()},className:`shrink-0 mr-2`,"data-testid":`continue-editing`,children:[(0,q.jsx)(V,{className:`w-3.5 h-3.5 mr-1.5`}),o(`detailModal.continueEditing`)]}):null}function Gn({ticket:e,rails:t,onMoveToRail:n,onRemoveFromRail:r}){let{t:i}=p(`tickets`),[a,o]=(0,G.useState)(null),s=(0,G.useRef)(null),c=t.find(t=>t.ticketIds.includes(e.id));return c?r?(0,q.jsxs)(F,{variant:`outline`,size:`sm`,className:`shrink-0 mr-2 gap-1.5 border-accent-warning/30 text-accent-warning hover:bg-accent-warning/10 hover:text-accent-warning`,"data-testid":`modal-remove-from-rail`,onClick:()=>r(e.id),title:i(`rail.currentlyOn`,{rail:c.label}),children:[(0,q.jsx)(g,{className:`w-3.5 h-3.5`,"aria-hidden":!0}),i(`rail.removeFromRail`)]}):null:n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(F,{ref:s,variant:`outline`,size:`sm`,className:`shrink-0 mr-2 gap-1.5 border-accent-info/30 text-accent-info hover:bg-accent-info/10 hover:text-accent-info`,"data-testid":`modal-move-to-rail`,onClick:()=>{s.current&&o(s.current.getBoundingClientRect())},children:[i(`rail.moveToRail`),(0,q.jsx)(v,{className:`w-3.5 h-3.5`,"aria-hidden":!0})]}),a&&(0,q.jsx)(Be,{rails:t,anchorRect:a,onMoveToRail:t=>n(e.id,t),onClose:()=>o(null)})]}):null}var Kn=`
9
9
 
10
10
  ---
11
11
 
@@ -1 +1 @@
1
- import{a as e,t}from"./rolldown-runtime-CNC7AqOf.js";import{n}from"./jsx-runtime-zu2_FqZY.js";import{S as r}from"./i18n-DREQCE2F.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{S as r}from"./i18n-cK5pPbj8.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
- var e={railAdded:`Rail {{n}} aggiunto`,railRemoved:`{{rail}} rimosso`,railLimitReached:`Limite di rail raggiunto ({{max}} max)`,railDeleteFailed:`Impossibile rimuovere il rail — contiene spec, è in esecuzione o ha una decisione PR in sospeso`,launchTicketsInFlight:`Una spec di questo rail è già in lavorazione da un'esecuzione attiva`,launchAllSummary_one:`{{count}} rail lanciato in parallelo`,launchAllSummary_other:`{{count}} rail lanciati in parallelo`,launchAllNoneEligible:`Nessun rail pronto al lancio — assegna prima le spec a un rail libero`,launchAllFailed:`Nessun rail è stato lanciato`,railCompleted:`Rail {{n}} completato`,railFailed:`Rail {{n}} non riuscito — le spec sono tornate in Specs`,railEnded:`Rail {{n}} {{status}} — le spec sono tornate in Specs`,alreadyOnRail:`Già su {{rail}}`,movedToRail:`Spostata su {{rail}}`,railRunningStopFirst:`{{rail}} è in esecuzione — fermalo prima di rimuoverlo`,removedFromRail:`Rimossa da {{rail}}`,queuedOnRail:`In coda su {{rail}}`,queuedOnRailDescription:`Il rail è attualmente in esecuzione`,railStopped:`{{rail}} fermato`,stopFailed:`Impossibile fermare il rail`,syncTicketsFailed:`Impossibile sincronizzare i ticket del rail`,launchFailed:`Impossibile avviare il rail`,launchNetworkError:`Errore di rete durante l'avvio del rail`,railLaunched:`{{rail}} avviato`,launchDescription_one:`{{mode}} con {{count}} spec`,launchDescription_other:`{{mode}} con {{count}} spec`,railWorktreeNeedsReview:`Rail {{n}}: la spec #{{ticket}} richiede revisione dopo il merge`,railWorktreesNoGit:`Isolamento con worktree non disponibile: il progetto non è un repository git — esecuzione in modalità condivisa.`,railWorktreesNoCommits:`Isolamento con worktree non disponibile: il repository non ha ancora commit — crea un commit iniziale e rilancia.`,railWorktreesError:`L'isolamento tramite worktree è fallito — questa esecuzione continua SENZA il flusso di revisione PR (nessuna scheda di implementazione). Vedi il dettaglio dell'errore sotto.`,onReviewCannotMoveToRail:`Questa spec è in attesa della revisione della PR — risolvi prima la decisione sulla PR`,onReviewNotLaunchable:`Una spec di questo rail è in attesa della revisione della PR — risolvi la decisione sulla PR prima di lanciare`},t={operation:{inProgress:`Azione in corso…`,"create-pr":`Creazione PR…`,publish:`Pubblicazione…`,discard:`Eliminazione…`,dismiss:`Chiusura del follow-up…`,"poll-merge":`Verifica merge…`,reopen:`Riapertura…`,"merge-local":`Integrazione locale…`,"recover-and-retry":`Creazione del commit e nuovo tentativo di push del risultato preservato…`,"acknowledge-no-changes":`Contrassegno come completato…`},markDone:`Segna come completate`,refine:`Perfeziona`,completedToast:`Confermato — le spec sono passate a Completate`,markDoneConfirmTitle:`Segnare queste spec come completate?`,markDoneConfirmBody:`L’implementazione ha confermato che non servono modifiche al codice. Le spec passeranno a Completate e il worktree senza modifiche verrà ripulito.`,refineConfirmTitle:`Perfezionare queste spec?`,refineConfirmBody:`Il risultato senza modifiche verrà chiuso e le spec torneranno nel backlog per essere perfezionate. I log di esecuzione resteranno disponibili.`,localOnly:`Modifiche disponibili in locale`,localOnlyHint:`L’implementazione è completa, ma le modifiche non sono state inviate. Integrale localmente o riprova a pubblicarle quando il remoto sarà disponibile.`,noChanges:`Nessuna modifica necessaria`,partial:`{{succeeded}} implementazioni su {{total}} pronte`,createPartialPr:`Crea PR con {{count}}`,deliveryBlocked:`Implementazione completa — la consegna richiede attenzione`,updateFailed:`Implementazione completa — aggiornamento non riuscito`,retryPush:`Riprova push`,retryPushVerified:`Push verificato · il commit {{sha}} è nella PR`,commitAlreadyVerified:`Il commit {{sha}} è già verificato nella PR`,deliveryCommit:`commit {{sha}}`,prClosed:`PR chiusa senza merge`,reopen:`Riapri`,dismiss:`Chiudi follow-up`,discardLocalResult:`Elimina risultato locale`,dismissConfirmTitle:`Chiudere questo follow-up?`,dismissConfirmBody:`Questa scheda di follow-up verrà chiusa. Il relativo worktree verrà rimosso solo se è ancora sicuro farlo; in caso contrario, sarà conservato con un avviso. La PR esistente, il suo branch e lo stato di revisione resteranno invariati.`,discardLocalConfirmTitle:`Eliminare il risultato locale?`,discardLocalConfirmBody:`L’iterazione locale recuperabile verrà rimossa solo se è ancora sicuro farlo; se è cambiata, sarà conservata con un avviso. Qualsiasi PR esistente e il suo branch resteranno invariati. Un risultato rimosso non può essere recuperato.`,viewRunLog:`Visualizza il log di esecuzione di {{ref}}`,cleanupIncomplete_one:`Pulizia incompleta ({{count}} avviso)`,cleanupIncomplete_other:`Pulizia incompleta ({{count}} avvisi)`,cleanupIncompleteHint:`I dati di recupero locali sono stati conservati. Controlla questi dettagli prima di rimuovere qualcosa manualmente.`,copyCleanupDetails:`Copia dettagli di recupero`,safetyArchiveTitle:`Archivio di sicurezza ({{count}})`,safetyArchiveHint:`I file temporanei dell’area di lavoro sono stati conservati fuori dalla PR per precauzione. Puoi controllarli o rimuoverli manualmente.`,copySafetyArchive:`Copia percorsi`,unit:{failed:`implementazione non riuscita`,blocked:`consegna bloccata`,noChanges:`nessuna modifica`,succeeded:`pronta`},readyForReview:`Pronto per la revisione`,draftPr:`PR in bozza`,branchPushed:`Ramo inviato — PR in sospeso`,branchPushedHint:`Il ramo è stato inviato ma non è stato possibile creare la PR (GitHub CLI non disponibile). Riprova per crearla.`,iteratingPr:`Aggiornamento PR`,prReady:`PR pronta`,implementationFailed:`Implementazione non riuscita`,implementationFailedHint:`Il run di implementazione non è riuscito. Apri il log del run, poi scarta questa scheda prima di rilanciare.`,prFailed:`PR non riuscita`,prFailedDetail:`PR non riuscita: {{detail}}`,createDegraded:`Impossibile pubblicare la PR — {{detail}}. Riprova una volta risolto.`,createPr:`Crea PR`,createPrTooltip:`→ {{base}}`,publish:`Pubblica`,publishTooltip:`Apre la PR in bozza per la revisione del team`,checkout:`Passa al branch`,checkoutTooltip:`Esegui il checkout di {{branch}} nella cartella principale del progetto`,checkoutSuccess:`Checkout eseguito su {{branch}}`,checkoutFailed:`Impossibile eseguire il checkout del branch della PR`,checkoutDirtyTitle:`Checkout bloccato per proteggere le tue modifiche`,checkoutDirtyBody:`La cartella principale del progetto contiene modifiche senza commit. Esegui un commit o uno stash, quindi riprova. Non è stato modificato nulla.`,checkoutSafetyUnknownTitle:`Checkout in pausa: impossibile verificare la sicurezza`,checkoutSafetyUnknownBody:`Specrails non ha potuto leggere lo stato Git della cartella principale del progetto. Nulla è stato rilasciato o modificato. Riprova quando Git sarà disponibile.`,checkoutNotDeliverableTitle:`Questo branch della PR non contiene l’implementazione preservata`,checkoutNotDeliverableBody:`Il commit esatto della consegna non è ancora stato verificato. Ispeziona o recupera invece il risultato locale.`,inspectLocalResult:`Ispeziona il risultato locale`,inspectLocalResultTooltip:`Mostra il worktree isolato preservato e copia il suo percorso`,localResultPathCopied:`Percorso del risultato locale copiato`,localResultPath:`Risultato locale preservato`,localResultUnavailableHere:`Su questo computer non è disponibile alcun worktree recuperabile. Consulta il log dell’esecuzione dal computer su cui è stata eseguita.`,recoverAndRetry:`Crea commit e riprova il push`,recoverAndRetryConfirmTitle:`Creare il commit e inviare il risultato preservato?`,recoverAndRetryConfirmBody:`Specrails userà esclusivamente il worktree isolato o il branch registrato compatibile con il fast-forward per {{branch}}. Se necessario, creerà un commit con i file consegnabili e invierà quel commit esatto solo se la PR è ancora aperta sui branch di origine e destinazione previsti. La cartella principale del progetto e le sue modifiche senza commit non verranno toccate.`,recoverAndRetryVerified:`Il commit recuperato {{sha}} è verificato nella PR`,recoveryStillBlocked:`Il recupero locale richiede ancora attenzione`,recheckRecovery:`Controlla di nuovo`,recheckRecoveryConfirmTitle:`Controllare di nuovo questo computer?`,recheckRecoveryConfirmBody:`Specrails riesaminerà in questo clone il worktree, il branch, i ref, i reflog e gli oggetti Git orfani appartenenti alla consegna di {{branch}}. Se dimostra un unico risultato, potrà eseguire il commit delle modifiche isolate e ritentare il push esatto. La cartella principale del progetto non verrà toccata.`,recoveryUnavailable:`Impossibile verificare il recupero su questo computer`,recoveryUnavailableBody:`Specrails non ha potuto dimostrare in sicurezza un unico risultato appartenente alla consegna in questo clone. Nulla è stato modificato o rimosso. Controlla i dettagli della fase e i log di esecuzione. Se il run è stato eseguito su un altro computer, apri Specrails lì e controlla di nuovo.`,recoveryDetailSummary:`Dettaglio tecnico del recupero`,discard:`Scarta`,discardTooltip:`Chiude la consegna e riporta i ticket in Specs; il lavoro locale modificato viene conservato`,retryPr:`Riprova PR`,retry:`Riprova`,checkMerge:`Verifica merge`,verifyPr:`Verifica PR`,verifyPrTooltip:`Verifica il commit esatto su GitHub e se la PR è stata unita`,checkMergeTooltip:`Chiede a GitHub se è stato fatto il merge della PR`,prLinkFallback:`PR`,openPrTitle:`Apri la PR su GitHub`,notMergedYet:`Ancora nessun merge`,commitMissingRetry:`Il commit di consegna non è più presente nella PR. Puoi riprovare il push.`,prVerifiedWaiting:`Commit {{sha}} verificato · in attesa del merge`,alreadyResolved:`Già risolta altrove`,ghFailed:`GitHub CLI non riuscita: {{detail}}`,actionFailed:`Impossibile applicare la decisione sulla PR`,mergedToast:`Merge della PR effettuato — i ticket sono passati a Completato`,discardedToast:`PR scartata — i ticket sono tornati in Specs`,decisionPending:`Questo rail ha una decisione sulla PR in sospeso — creala, pubblicala o scartala prima di rilanciare`,discardConfirmTitle:`Scartare questa consegna?`,discardConfirmBody:`La PR verrà chiusa senza eliminare il branch remoto. Verranno rimossi solo i branch locali e i worktree di proprietà di SpecRails che si trovano ancora sul commit registrato; qualsiasi elemento modificato sarà conservato con un avviso. I ticket torneranno nel backlog di Specs. Le risorse locali rimosse non possono essere recuperate.`,implementationFailedDiscardTitle:`Scartare questa consegna non riuscita?`,implementationFailedDiscardBody:`La scheda verrà chiusa e i ticket torneranno in Specs. Il lavoro locale e i branch saranno conservati per l'ispezione. Potranno essere rimosse solo le risorse la cui pulizia è dimostrata sicura.`,mergeLocal:`Integra in locale`,mergeLocalTooltip:`Unisce i branch consegnati in {{base}} nel tuo checkout locale (senza GitHub)`,mergeLocalConfirmTitle:`Integrare in locale?`,mergeLocalConfirmBody:`I branch consegnati verranno uniti in {{base}} nel tuo checkout locale. Il checkout deve essere su {{base}} con albero di lavoro pulito.`,mergeLocalBlockedDirty:`Impossibile integrare: il tuo albero di lavoro su {{base}} ha modifiche non committate. Fai commit o stash e riprova.`,mergeLocalBlockedBranch:`Impossibile integrare: il tuo checkout è su {{current}}, non su {{base}}. Passa a {{base}} e riprova.`,mergeLocalFailed:`Merge locale fallito: {{detail}}`,mergedLocally:`Integrato in {{base}} in locale`},n={title:`Rails`,runningCount_one:`{{count}} in esecuzione`,runningCount_other:`{{count}} in esecuzione`,launchAll:`Lancia tutti`,launchAllTitle:`Lancia in parallelo tutti i rail pronti — ogni esecuzione è isolata nel proprio worktree git`},r={skipRunning_one:`{{count}} già in esecuzione`,skipRunning_other:`{{count}} già in esecuzione`,skipEmpty_one:`{{count}} senza spec`,skipEmpty_other:`{{count}} senza spec`,skipPendingDecision_one:`{{count}} in attesa di una decisione PR`,skipPendingDecision_other:`{{count}} in attesa di una decisione PR`,skipOnReview_one:`{{count}} con spec in revisione`,skipOnReview_other:`{{count}} con spec in revisione`,skipInFlight_one:`{{count}} saltato (spec già in corso)`,skipInFlight_other:`{{count}} saltati (spec già in corso)`,failedCount_one:`{{count}} non riuscito`,failedCount_other:`{{count}} non riusciti`},i={title:`Lancia tutti i rail`,railsCount_one:`{{count}} rail`,railsCount_other:`{{count}} rail`,specsCount_one:`{{count}} spec`,specsCount_other:`{{count}} spec`,isolationTitle:`Parallelo e isolato.`,isolationBody:`Ogni rail gira nel proprio worktree git — i lanci simultanei non collidono mai.`,pipelinesTitle_one:`{{count}} pipeline IA.`,pipelinesTitle_other:`{{count}} pipeline IA.`,pipelinesBody:`Un lancio per rail, ciascuno con la propria modalità, engine e profilo configurati.`,costTitle:`Costo moltiplicato.`,costBody:`Ogni rail genera la propria esecuzione IA — la spesa cresce con il numero di rail.`,launch_one:`Lancia {{count}} rail`,launch_other:`Lancia {{count}} rail`},a={viewJobLog:`Visualizza log del job`,log:`Log`,implement:`Implementa`,batch:`Batch`,freestyle:`Freestyle`,freestyleTitle:`Freestyle — Claude implementa la spec in autonomia, senza pipeline`,loop:`Loop`,loopTitle:`Loop — esegui un loop di automazione pubblicato sulle spec del rail`,pickLoop:`Scegli un loop…`,effortTitle:`Sforzo di ragionamento`,stop:`Stop`,play:`Avvia`,failedRetry:`Job non riuscito — clicca per riprovare`,addSpecsFirst:`Aggiungi prima delle spec a questo rail`,builtInLoops:`Integrati`,customLoops:`Loop personalizzati`,worktreesMerged:`{{count}} uniti`,worktreesNeedsReview:`{{count}} da rivedere`,execSteps:`{{count}} passi`,execLines:`{{count}} righe`,openspec:`OpenSpec`},o={moveToSpecs:`Sposta in Specs`,deleteRail:`Elimina {{label}}`,dropHere:`Rilascia qui`,dropOnThisRail:`Rilascia su questo rail`,dragSpecsHere:`Trascina qui le spec`},s={title:`Avvia in modalità Freestyle`,context_one:`{{rail}} · {{count}} spec`,context_other:`{{rail}} · {{count}} spec`,noPipelineTitle:`Nessuna pipeline OpenSpec.`,noPipelineBody:`Il flusso strutturato architect → developer → reviewer viene saltato del tutto.`,autonomyTitle:`Autonomia nativa di Claude.`,autonomyBody:`Claude lavora in autonomia usando agenti nativi e workflow dinamici.`,costTitle:`Costo variabile.`,costBody:`La spesa dipende da cosa Claude decide di fare — può essere più alta del previsto.`,continue:`Continua`},c={fetchFailed:`Impossibile recuperare i rail: {{status}}`},l={toasts:e,railPr:t,railsBoard:n,launchAll:r,launchAllDialog:i,railControls:a,railRow:o,freestyleDialog:s,useRails:c};export{l as default,s as freestyleDialog,r as launchAll,i as launchAllDialog,a as railControls,t as railPr,o as railRow,n as railsBoard,e as toasts,c as useRails};
1
+ var e={railAdded:`Rail {{n}} aggiunto`,railRemoved:`{{rail}} rimosso`,railLimitReached:`Limite di rail raggiunto ({{max}} max)`,railDeleteFailed:`Impossibile rimuovere il rail — contiene spec, è in esecuzione o ha una decisione PR in sospeso`,launchTicketsInFlight:`Una spec di questo rail è già in lavorazione da un'esecuzione attiva`,launchAllSummary_one:`{{count}} rail lanciato in parallelo`,launchAllSummary_other:`{{count}} rail lanciati in parallelo`,launchAllNoneEligible:`Nessun rail pronto al lancio — assegna prima le spec a un rail libero`,launchAllFailed:`Nessun rail è stato lanciato`,railCompleted:`Rail {{n}} completato`,railFailed:`Rail {{n}} non riuscito — le spec sono tornate in Specs`,railEnded:`Rail {{n}} {{status}} — le spec sono tornate in Specs`,alreadyOnRail:`Già su {{rail}}`,movedToRail:`Spostata su {{rail}}`,railRunningStopFirst:`{{rail}} è in esecuzione — fermalo prima di rimuoverlo`,removedFromRail:`Rimossa da {{rail}}`,queuedOnRail:`In coda su {{rail}}`,queuedOnRailDescription:`Il rail è attualmente in esecuzione`,railStopped:`{{rail}} fermato`,stopFailed:`Impossibile fermare il rail`,syncTicketsFailed:`Impossibile sincronizzare i ticket del rail`,launchFailed:`Impossibile avviare il rail`,launchNetworkError:`Errore di rete durante l'avvio del rail`,railLaunched:`{{rail}} avviato`,launchDescription_one:`{{mode}} con {{count}} spec`,launchDescription_other:`{{mode}} con {{count}} spec`,railWorktreeNeedsReview:`Rail {{n}}: la spec #{{ticket}} richiede revisione dopo il merge`,railWorktreesNoGit:`Isolamento con worktree non disponibile: il progetto non è un repository git — esecuzione in modalità condivisa.`,railWorktreesNoCommits:`Isolamento con worktree non disponibile: il repository non ha ancora commit — crea un commit iniziale e rilancia.`,railWorktreesError:`L'isolamento tramite worktree è fallito — questa esecuzione continua SENZA il flusso di revisione PR (nessuna scheda di implementazione). Vedi il dettaglio dell'errore sotto.`,onReviewCannotMoveToRail:`Questa spec è in attesa della revisione della PR — risolvi prima la decisione sulla PR`,onReviewNotLaunchable:`Una spec di questo rail è in attesa della revisione della PR — risolvi la decisione sulla PR prima di lanciare`},t={operation:{inProgress:`Azione in corso…`,"create-pr":`Creazione PR…`,publish:`Pubblicazione…`,discard:`Eliminazione…`,dismiss:`Chiusura del follow-up…`,"poll-merge":`Verifica merge…`,reopen:`Riapertura…`,"merge-local":`Integrazione locale…`,"recover-and-retry":`Creazione del commit e nuovo tentativo di push del risultato preservato…`,"acknowledge-no-changes":`Contrassegno come completato…`},markDone:`Segna come completate`,refine:`Perfeziona`,completedToast:`Confermato — le spec sono passate a Completate`,markDoneConfirmTitle:`Segnare queste spec come completate?`,markDoneConfirmBody:`L’implementazione ha confermato che non servono modifiche al codice. Le spec passeranno a Completate e il worktree senza modifiche verrà ripulito.`,refineConfirmTitle:`Perfezionare queste spec?`,refineConfirmBody:`Il risultato senza modifiche verrà chiuso e le spec torneranno nel backlog per essere perfezionate. I log di esecuzione resteranno disponibili.`,localOnly:`Modifiche disponibili in locale`,localOnlyHint:`L’implementazione è completa, ma le modifiche non sono state inviate. Integrale localmente o riprova a pubblicarle quando il remoto sarà disponibile.`,noChanges:`Nessuna modifica necessaria`,partial:`{{succeeded}} implementazioni su {{total}} pronte`,createPartialPr:`Crea PR con {{count}}`,deliveryBlocked:`Implementazione completa — la consegna richiede attenzione`,updateFailed:`Implementazione completa — aggiornamento non riuscito`,retryPush:`Riprova push`,retryPushVerified:`Push verificato · il commit {{sha}} è nella PR`,commitAlreadyVerified:`Il commit {{sha}} è già verificato nella PR`,deliveryCommit:`commit {{sha}}`,prClosed:`PR chiusa senza merge`,reopen:`Riapri`,dismiss:`Chiudi follow-up`,discardLocalResult:`Elimina risultato locale`,dismissConfirmTitle:`Chiudere questo follow-up?`,dismissConfirmBody:`Questa scheda di follow-up verrà chiusa. Il relativo worktree verrà rimosso solo se è ancora sicuro farlo; in caso contrario, sarà conservato con un avviso. La PR esistente, il suo branch e lo stato di revisione resteranno invariati.`,discardLocalConfirmTitle:`Eliminare il risultato locale?`,discardLocalConfirmBody:`L’iterazione locale recuperabile verrà rimossa solo se è ancora sicuro farlo; se è cambiata, sarà conservata con un avviso. Qualsiasi PR esistente e il suo branch resteranno invariati. Un risultato rimosso non può essere recuperato.`,viewRunLog:`Visualizza il log di esecuzione di {{ref}}`,cleanupIncomplete_one:`Pulizia incompleta ({{count}} avviso)`,cleanupIncomplete_other:`Pulizia incompleta ({{count}} avvisi)`,cleanupIncompleteHint:`I dati di recupero locali sono stati conservati. Controlla questi dettagli prima di rimuovere qualcosa manualmente.`,copyCleanupDetails:`Copia dettagli di recupero`,safetyArchiveTitle:`Archivio di sicurezza ({{count}})`,safetyArchiveHint:`I file temporanei dell’area di lavoro sono stati conservati fuori dalla PR per precauzione. Puoi controllarli o rimuoverli manualmente.`,copySafetyArchive:`Copia percorsi`,unit:{failed:`implementazione non riuscita`,blocked:`consegna bloccata`,noChanges:`nessuna modifica`,succeeded:`pronta`},readyForReview:`Pronto per la revisione`,draftPr:`PR in bozza`,branchPushed:`Ramo inviato — PR in sospeso`,branchPushedHint:`Il ramo è stato inviato ma non è stato possibile creare la PR (GitHub CLI non disponibile). Riprova per crearla.`,iteratingPr:`Aggiornamento PR`,prReady:`PR pronta`,implementationFailed:`Implementazione non riuscita`,implementationFailedHint:`Il run di implementazione non è riuscito. Apri il log del run, poi scarta questa scheda prima di rilanciare.`,prFailed:`PR non riuscita`,prFailedDetail:`PR non riuscita: {{detail}}`,createDegraded:`Impossibile pubblicare la PR — {{detail}}. Riprova una volta risolto.`,createPr:`Crea PR`,createPrTooltip:`→ {{base}}`,publish:`Pubblica`,publishTooltip:`Apre la PR in bozza per la revisione del team`,checkout:`Passa al branch`,checkoutTooltip:`Esegui il checkout di {{branch}} nella cartella principale del progetto`,checkoutSuccess:`Checkout eseguito su {{branch}}`,checkoutFailed:`Impossibile eseguire il checkout del branch della PR`,checkoutDirtyTitle:`Checkout bloccato per proteggere le tue modifiche`,checkoutDirtyBody:`La cartella principale del progetto contiene modifiche senza commit. Esegui un commit o uno stash, quindi riprova. Non è stato modificato nulla.`,checkoutSafetyUnknownTitle:`Checkout in pausa: impossibile verificare la sicurezza`,checkoutSafetyUnknownBody:`Specrails non ha potuto leggere lo stato Git della cartella principale del progetto. Nulla è stato rilasciato o modificato. Riprova quando Git sarà disponibile.`,checkoutNotDeliverableTitle:`Questo branch della PR non contiene l’implementazione preservata`,checkoutNotDeliverableBody:`Il commit esatto della consegna non è ancora stato verificato. Ispeziona o recupera invece il risultato locale.`,inspectLocalResult:`Ispeziona il risultato locale`,inspectLocalResultTooltip:`Mostra il worktree isolato preservato e copia il suo percorso`,localResultPathCopied:`Percorso del risultato locale copiato`,localResultPath:`Risultato locale preservato`,localResultUnavailableHere:`Su questo computer non è disponibile alcun worktree recuperabile. Consulta il log dell’esecuzione dal computer su cui è stata eseguita.`,recoverAndRetry:`Crea commit e riprova il push`,recoverAndRetryConfirmTitle:`Creare il commit e inviare il risultato preservato?`,recoverAndRetryConfirmBody:`Specrails userà esclusivamente il worktree isolato o il branch registrato compatibile con il fast-forward per {{branch}}. Se necessario, creerà un commit con i file consegnabili e invierà quel commit esatto solo se la PR è ancora aperta sui branch di origine e destinazione previsti. La cartella principale del progetto e le sue modifiche senza commit non verranno toccate.`,recoverAndRetryVerified:`Il commit recuperato {{sha}} è verificato nella PR`,recoveryStillBlocked:`Il recupero locale richiede ancora attenzione`,recheckRecovery:`Controlla di nuovo`,recheckRecoveryConfirmTitle:`Controllare di nuovo questo computer?`,recheckRecoveryConfirmBody:`Specrails riesaminerà in questo clone il worktree, il branch, i ref, i reflog e gli oggetti Git orfani appartenenti alla consegna di {{branch}}. Se dimostra un unico risultato, potrà eseguire il commit delle modifiche isolate e ritentare il push esatto. La cartella principale del progetto non verrà toccata.`,recoveryUnavailable:`Impossibile verificare il recupero su questo computer`,recoveryUnavailableBody:`Specrails non ha potuto dimostrare in sicurezza un unico risultato appartenente alla consegna in questo clone. Nulla è stato modificato o rimosso. Controlla i dettagli della fase e i log di esecuzione. Se il run è stato eseguito su un altro computer, apri Specrails lì e controlla di nuovo.`,recoveryDetailSummary:`Dettaglio tecnico del recupero`,discard:`Scarta`,discardTooltip:`Chiude la consegna e riporta i ticket in Specs; il lavoro locale modificato viene conservato`,retryPr:`Riprova PR`,retry:`Riprova`,checkMerge:`Verifica merge`,verifyPr:`Verifica PR`,verifyPrTooltip:`Verifica il commit esatto su GitHub e se la PR è stata unita`,checkMergeTooltip:`Chiede a GitHub se è stato fatto il merge della PR`,prLinkFallback:`PR`,openPrTitle:`Apri la PR su GitHub`,notMergedYet:`Ancora nessun merge`,commitMissingRetry:`Il commit di consegna non è più presente nella PR. Puoi riprovare il push.`,prVerifiedWaiting:`Commit {{sha}} verificato · in attesa del merge`,alreadyResolved:`Già risolta altrove`,ghFailed:`GitHub CLI non riuscita: {{detail}}`,actionFailed:`Impossibile applicare la decisione sulla PR`,mergedToast:`Merge della PR effettuato — i ticket sono passati a Completato`,discardedToast:`PR scartata — i ticket sono tornati in Specs`,decisionPending:`Questo rail ha una decisione sulla PR in sospeso — creala, pubblicala o scartala prima di rilanciare`,discardConfirmTitle:`Scartare questa consegna?`,discardConfirmBody:`La PR verrà chiusa senza eliminare il branch remoto. Verranno rimossi solo i branch locali e i worktree di proprietà di SpecRails che si trovano ancora sul commit registrato; qualsiasi elemento modificato sarà conservato con un avviso. I ticket torneranno nel backlog di Specs. Le risorse locali rimosse non possono essere recuperate.`,implementationFailedDiscardTitle:`Scartare questa consegna non riuscita?`,implementationFailedDiscardBody:`La scheda verrà chiusa e i ticket torneranno in Specs. Il lavoro locale e i branch saranno conservati per l'ispezione. Potranno essere rimosse solo le risorse la cui pulizia è dimostrata sicura.`,mergeLocal:`Integra in locale`,mergeLocalTooltip:`Unisce i branch consegnati in {{base}} nel tuo checkout locale (senza GitHub)`,mergeLocalConfirmTitle:`Integrare in locale?`,mergeLocalConfirmBody:`I branch consegnati verranno uniti in {{base}} nel tuo checkout locale. Il checkout deve essere su {{base}} con albero di lavoro pulito.`,mergeLocalBlockedDirty:`Impossibile integrare: il tuo albero di lavoro su {{base}} ha modifiche non committate. Fai commit o stash e riprova.`,mergeLocalBlockedBranch:`Impossibile integrare: il tuo checkout è su {{current}}, non su {{base}}. Passa a {{base}} e riprova.`,mergeLocalFailed:`Merge locale fallito: {{detail}}`,mergedLocally:`Integrato in {{base}} in locale`},n={title:`Rails`,runningCount_one:`{{count}} in esecuzione`,runningCount_other:`{{count}} in esecuzione`,launchAll:`Lancia tutti`,launchAllTitle:`Lancia in parallelo tutti i rail pronti — ogni esecuzione è isolata nel proprio worktree git`},r={skipRunning_one:`{{count}} già in esecuzione`,skipRunning_other:`{{count}} già in esecuzione`,skipEmpty_one:`{{count}} senza spec`,skipEmpty_other:`{{count}} senza spec`,skipPendingDecision_one:`{{count}} in attesa di una decisione PR`,skipPendingDecision_other:`{{count}} in attesa di una decisione PR`,skipOnReview_one:`{{count}} con spec in revisione`,skipOnReview_other:`{{count}} con spec in revisione`,skipInFlight_one:`{{count}} saltato (spec già in corso)`,skipInFlight_other:`{{count}} saltati (spec già in corso)`,failedCount_one:`{{count}} non riuscito`,failedCount_other:`{{count}} non riusciti`},i={title:`Lancia tutti i rail`,railsCount_one:`{{count}} rail`,railsCount_other:`{{count}} rail`,specsCount_one:`{{count}} spec`,specsCount_other:`{{count}} spec`,isolationTitle:`Parallelo e isolato.`,isolationBody:`Ogni rail gira nel proprio worktree git — i lanci simultanei non collidono mai.`,pipelinesTitle_one:`{{count}} pipeline IA.`,pipelinesTitle_other:`{{count}} pipeline IA.`,pipelinesBody:`Un lancio per rail, ciascuno con la propria modalità, engine e profilo configurati.`,costTitle:`Costo moltiplicato.`,costBody:`Ogni rail genera la propria esecuzione IA — la spesa cresce con il numero di rail.`,launch_one:`Lancia {{count}} rail`,launch_other:`Lancia {{count}} rail`},a={viewJobLog:`Visualizza log del job`,log:`Log`,implement:`Implementa`,batch:`Batch`,freestyle:`Freestyle`,freestyleTitle:`Freestyle — Claude implementa la spec in autonomia, senza pipeline`,loop:`Loop`,loopTitle:`Loop — esegui un loop di automazione pubblicato sulle spec del rail`,pickLoop:`Scegli un loop…`,effortTitle:`Sforzo di ragionamento`,stop:`Stop`,play:`Avvia`,failedRetry:`Job non riuscito — clicca per riprovare`,addSpecsFirst:`Aggiungi prima delle spec a questo rail`,builtInLoops:`Integrati`,customLoops:`Loop personalizzati`,worktreesMerged:`{{count}} uniti`,worktreesNeedsReview:`{{count}} da rivedere`,execSteps:`{{count}} passi`,execLines:`{{count}} righe`,openspec:`OpenSpec`},o={moveToSpecs:`Sposta in Specs`,deleteRail:`Elimina {{label}}`,dropHere:`Rilascia qui`,dropOnThisRail:`Rilascia su questo rail`,dragSpecsHere:`Trascina qui le spec`},s={title:`Avvia in modalità Freestyle`,context_one:`{{rail}} · {{count}} spec`,context_other:`{{rail}} · {{count}} spec`,noPipelineTitle:`Nessuna pipeline OpenSpec.`,noPipelineBody:`Il flusso strutturato architect → developer → reviewer viene saltato del tutto.`,autonomyTitle:`Autonomia nativa di Claude.`,autonomyBody:`Claude lavora in autonomia usando agenti nativi e workflow dinamici.`,costTitle:`Costo variabile.`,costBody:`La spesa dipende da cosa Claude decide di fare — può essere più alta del previsto.`,continue:`Continua`},c={fetchFailed:`Impossibile recuperare i rail: {{status}}`},l={chipNew:`Nuova PR`,chipTitle:`Consegnare in una PR esistente`,clear:`Rimuovi PR di destinazione`,newPr:`Nuova PR (predefinito)`,loading:`Caricamento PR aperte…`,none:`Nessuna PR aperta trovata`,fork:`Fork — push non possibile`,manualPlaceholder:`Numero PR`,manualUse:`Usa`,confirmTitle:`Consegnare nella PR esistente?`,confirmBody:`Questa esecuzione lavora sul branch head della PR e vi effettua il push — non viene creata una nuova PR.`,confirmBranch:`Branch head`,confirmLaunch:`Avvia verso la PR #{{number}}`,errors:{invalid_target_pr:`Numero PR non valido`,target_pr_requires_pr_mode:`Consegnare in una PR esistente richiede il flusso PR isolato`,target_pr_not_found:`PR non trovata in questo repository`,target_pr_not_open:`Quella PR non è più aperta`,target_pr_fork:`Quella PR proviene da un fork e non può ricevere push`,target_pr_invalid:`I branch della PR non sono utilizzabili come destinazione`,target_pr_unfetchable:`Impossibile recuperare il branch head della PR`}},u={toasts:e,railPr:t,railsBoard:n,launchAll:r,launchAllDialog:i,railControls:a,railRow:o,freestyleDialog:s,useRails:c,targetPr:l};export{u as default,s as freestyleDialog,r as launchAll,i as launchAllDialog,a as railControls,t as railPr,o as railRow,n as railsBoard,l as targetPr,e as toasts,c as useRails};