specrails-desktop 2.16.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/dist/assets/{ActivityFeedPage-C_clKk8d.js → ActivityFeedPage-BLDMBgwL.js} +1 -1
- package/client/dist/assets/AgentsPage-CFaIiyAA.js +86 -0
- package/client/dist/assets/{AnalyticsPage-DZkVU3yd.js → AnalyticsPage-DY8ECq2R.js} +1 -1
- package/client/dist/assets/{BarChart-Dq1h8eYR.js → BarChart-ouivqe5L.js} +2 -2
- package/client/dist/assets/CodePage-DAFtRafz.js +2 -0
- package/client/dist/assets/{DesktopAnalyticsPage-CYhXhJoQ.js → DesktopAnalyticsPage-DIMhuuv0.js} +1 -1
- package/client/dist/assets/{DocsDialog-CS3Syf61.js → DocsDialog-DBYhv3SM.js} +2 -2
- package/client/dist/assets/{DocsPage-l3ZcTO2E.js → DocsPage-DeLRn8W_.js} +2 -2
- package/client/dist/assets/{ExportDropdown-DdB2ncYh.js → ExportDropdown-2XwQ08sz.js} +1 -1
- package/client/dist/assets/{IntegrationsPage-CJ_Om1zu.js → IntegrationsPage-DB-a4FDV.js} +3 -3
- package/client/dist/assets/JobDetailPage-C3lljMiV.js +16 -0
- package/client/dist/assets/JobsPage-CzquwJ6G.js +1 -0
- package/client/dist/assets/LoopBuilderPage-TkoalfW5.js +7 -0
- package/client/dist/assets/LoopsPage-ypooVAQ5.js +1 -0
- package/client/dist/assets/{agents-CQlu1nOm.js → agents-4fnKlwcG.js} +1 -1
- package/client/dist/assets/{agents-DcoUUFZl.js → agents-B-rVIhuw.js} +1 -1
- package/client/dist/assets/{agents-DVYpVGur.js → agents-BRUz6RJs.js} +1 -1
- package/client/dist/assets/{agents-DCX9D3-Q.js → agents-CZQvKDIb.js} +1 -1
- package/client/dist/assets/{agents-BYjUOrLD.js → agents-CuRY-Zg_.js} +1 -1
- package/client/dist/assets/{agents-Jc-CjBDB.js → agents-D7nWnLg6.js} +1 -1
- package/client/dist/assets/{agents-CIhRSOna.js → agents-DzhSlNZd.js} +1 -1
- package/client/dist/assets/{agents-1lhqEcXH.js → agents-E-42N3b1.js} +1 -1
- package/client/dist/assets/{cssMode-DSHXamUH.js → cssMode-BijCvCxs.js} +1 -1
- package/client/dist/assets/{dist-js-Ele_sHO7.js → dist-js-D7m9--SN.js} +1 -1
- package/client/dist/assets/{dist-js-D27I-bfi.js → dist-js-nZhsq1qo.js} +1 -1
- package/client/dist/assets/{editor.main-Cd8qBRAT.js → editor.main-DMIcqwXb.js} +2 -2
- package/client/dist/assets/{freemarker2-CkEKTBm2.js → freemarker2-CP2AizpZ.js} +1 -1
- package/client/dist/assets/{handlebars-BRGx0JpL.js → handlebars-8ElanPOm.js} +1 -1
- package/client/dist/assets/{html-BfRIaGgN.js → html-Mu3b73tG.js} +1 -1
- package/client/dist/assets/{htmlMode-BTpSnsDE.js → htmlMode-tHprGCEv.js} +1 -1
- package/client/dist/assets/index-CDEQ4aU_.js +144 -0
- package/client/dist/assets/{javascript-DMmE2kKN.js → javascript-DlG0apUe.js} +1 -1
- package/client/dist/assets/{jsonMode-hYuaUleY.js → jsonMode-Cr0T4SXO.js} +1 -1
- package/client/dist/assets/{lib-qdRfWwE1.js → lib-Bu76JzdB.js} +2 -2
- package/client/dist/assets/{liquid-C-VbuTr7.js → liquid-QgTgbClC.js} +1 -1
- package/client/dist/assets/{lspLanguageFeatures-BALx-vjn.js → lspLanguageFeatures-D-BxkRza.js} +1 -1
- package/client/dist/assets/mcp-BSCAtU6Y.js +1 -0
- package/client/dist/assets/mcp-Cb6fUaFJ.js +1 -0
- package/client/dist/assets/mcp-CyP0quZ7.js +1 -0
- package/client/dist/assets/mcp-D-zQCO5E.js +1 -0
- package/client/dist/assets/mcp-DCTNWpfB.js +1 -0
- package/client/dist/assets/mcp-DEFGJ1OJ.js +1 -0
- package/client/dist/assets/mcp-DFG9OEXM.js +1 -0
- package/client/dist/assets/mcp-DyERgHA2.js +1 -0
- package/client/dist/assets/{mdx-Cs8MNCzn.js → mdx-B2QTaeRe.js} +1 -1
- package/client/dist/assets/{monaco.contribution-CIvCAJs4.js → monaco.contribution-CkdGfXCC.js} +2 -2
- package/client/dist/assets/{python-CGShLxuI.js → python-BlF0qnMQ.js} +1 -1
- package/client/dist/assets/{razor-CvOBQGd5.js → razor--3PSy3lb.js} +1 -1
- package/client/dist/assets/setup-BiQ7ut8d.js +1 -0
- package/client/dist/assets/setup-BxvjG5Xp.js +1 -0
- package/client/dist/assets/setup-CQ-F6Ciq.js +1 -0
- package/client/dist/assets/setup-D2JlpJEz.js +1 -0
- package/client/dist/assets/setup-DG1R6J6o.js +1 -0
- package/client/dist/assets/setup-DuFJZJsm.js +1 -0
- package/client/dist/assets/setup-DyJszDqm.js +1 -0
- package/client/dist/assets/setup-Ynw19V8w.js +1 -0
- package/client/dist/assets/{tsMode-04uOpiiP.js → tsMode-CHfsvcOI.js} +1 -1
- package/client/dist/assets/{typescript-CX0CwyIZ.js → typescript-Bjxf6BOp.js} +1 -1
- package/client/dist/assets/{upload-DPG87J4t.js → upload-x42OZJr2.js} +1 -1
- package/client/dist/assets/{value-BRVOAvhY.js → value-fEDhg5Bd.js} +1 -1
- package/client/dist/assets/{workers-yr2u4c3C.js → workers-CAAvSda9.js} +1 -1
- package/client/dist/assets/{xml-C0OFlt5X.js → xml-iYCSJ4oL.js} +1 -1
- package/client/dist/assets/{yaml-DgabaPs5.js → yaml-DtO-_yDY.js} +1 -1
- package/client/dist/index.html +10 -9
- package/docs/README.md +2 -0
- package/docs/guide/de/integrations/5-mcp-server.md +74 -0
- package/docs/guide/en/integrations/5-mcp-server.md +74 -0
- package/docs/guide/es/integrations/5-mcp-server.md +74 -0
- package/docs/guide/fr/integrations/5-mcp-server.md +74 -0
- package/docs/guide/it/integrations/5-mcp-server.md +74 -0
- package/docs/guide/ja/integrations/5-mcp-server.md +74 -0
- package/docs/guide/pt/integrations/5-mcp-server.md +74 -0
- package/docs/guide/zh/integrations/5-mcp-server.md +74 -0
- package/docs/mcp.md +249 -0
- package/package.json +8 -5
- package/server/dist/index.js +30 -0
- package/server/dist/mcp/guide.js +82 -0
- package/server/dist/mcp/index.js +21 -0
- package/server/dist/mcp/mcp-admin-router.js +71 -0
- package/server/dist/mcp/mcp-server.js +143 -0
- package/server/dist/mcp/mcp-tiers.js +48 -0
- package/server/dist/mcp/mcp-token.js +119 -0
- package/server/dist/mcp/resources.js +24 -0
- package/server/dist/mcp/tools/agents.js +319 -0
- package/server/dist/mcp/tools/analytics.js +168 -0
- package/server/dist/mcp/tools/app-settings.js +81 -0
- package/server/dist/mcp/tools/catalog.js +45 -0
- package/server/dist/mcp/tools/chat.js +147 -0
- package/server/dist/mcp/tools/code.js +145 -0
- package/server/dist/mcp/tools/jira.js +222 -0
- package/server/dist/mcp/tools/jobs.js +258 -0
- package/server/dist/mcp/tools/loops.js +229 -0
- package/server/dist/mcp/tools/meta.js +96 -0
- package/server/dist/mcp/tools/plugins.js +83 -0
- package/server/dist/mcp/tools/projects.js +62 -0
- package/server/dist/mcp/tools/rails.js +181 -0
- package/server/dist/mcp/tools/setup.js +187 -0
- package/server/dist/mcp/tools/specs.js +327 -0
- package/server/dist/mcp/tools/types.js +137 -0
- package/server/dist/mcp/tools/watch.js +93 -0
- package/server/dist/mobile/mobile-event-bus.js +2 -0
- package/server/dist/project-router-tickets.js +2 -2
- package/server/dist/rails-router.js +5 -0
- package/client/dist/assets/AgentsPage-jcPUtPhP.js +0 -86
- package/client/dist/assets/CodePage-BcbZT88K.js +0 -2
- package/client/dist/assets/JobDetailPage-D5Cxw0md.js +0 -16
- package/client/dist/assets/JobsPage-3v_iX83r.js +0 -1
- package/client/dist/assets/LoopBuilderPage-4s_adZy5.js +0 -7
- package/client/dist/assets/LoopsPage-DA94-o0j.js +0 -1
- package/client/dist/assets/index-meTWPBzY.js +0 -144
- package/client/dist/assets/setup-BOmQ4vh2.js +0 -1
- package/client/dist/assets/setup-BwO2-kuK.js +0 -1
- package/client/dist/assets/setup-CUTNWz-0.js +0 -1
- package/client/dist/assets/setup-Cf3hjChU.js +0 -1
- package/client/dist/assets/setup-CsuXrbJ2.js +0 -1
- package/client/dist/assets/setup-Df4cJOqu.js +0 -1
- package/client/dist/assets/setup-Do0fWx6W.js +0 -1
- package/client/dist/assets/setup-GlkDhBlJ.js +0 -1
- /package/client/dist/assets/{abap-CK68cr9-.js → abap-BFJA_Joo.js} +0 -0
- /package/client/dist/assets/{activity-D4dhNEwO.js → activity-BXBMi28x.js} +0 -0
- /package/client/dist/assets/{activity-usnNa7FX.js → activity-By6I70Ws.js} +0 -0
- /package/client/dist/assets/{activity-BbNkUmW4.js → activity-CfedQaof.js} +0 -0
- /package/client/dist/assets/{activity-B2MvEH54.js → activity-D62CDlQz.js} +0 -0
- /package/client/dist/assets/{activity-DHjfmAyT.js → activity-DAFuSwnt.js} +0 -0
- /package/client/dist/assets/{activity-C7VdmeGb.js → activity-Did0FnrH.js} +0 -0
- /package/client/dist/assets/{activity-Di2f50_Z.js → activity-oLgwaVyt.js} +0 -0
- /package/client/dist/assets/{addon-image-biWX2UUm.js → addon-image-bPlduuUZ.js} +0 -0
- /package/client/dist/assets/{addon-ligatures-D4EiDb5r.js → addon-ligatures-BexpF7xb.js} +0 -0
- /package/client/dist/assets/{addon-webgl-CDCIZQ03.js → addon-webgl-Zy4IOieH.js} +0 -0
- /package/client/dist/assets/{addspec-BxMn39wn.js → addspec-B2fTENuq.js} +0 -0
- /package/client/dist/assets/{addspec-DAveBiCE.js → addspec-BmggyuCD.js} +0 -0
- /package/client/dist/assets/{addspec-1HEtmLv1.js → addspec-CFsLeQKV.js} +0 -0
- /package/client/dist/assets/{addspec-DfuR6EAl.js → addspec-CkHI5c5H.js} +0 -0
- /package/client/dist/assets/{addspec-CO1xv6BL.js → addspec-Cvm06hGe.js} +0 -0
- /package/client/dist/assets/{addspec-IozoiiGs.js → addspec-DwoLTocx.js} +0 -0
- /package/client/dist/assets/{addspec-CNyAUGz_.js → addspec-gthH-H1g.js} +0 -0
- /package/client/dist/assets/{agentstudio-Q0Sq_jTg.js → agentstudio-BtASTJl7.js} +0 -0
- /package/client/dist/assets/{agentstudio-9NbsoGXk.js → agentstudio-CIe9C892.js} +0 -0
- /package/client/dist/assets/{agentstudio-B-jQgYV-.js → agentstudio-CYGk-jjo.js} +0 -0
- /package/client/dist/assets/{agentstudio-Bwa72b1S.js → agentstudio-CwiS3BTp.js} +0 -0
- /package/client/dist/assets/{agentstudio-B1y0JWY-.js → agentstudio-D0bQBWpI.js} +0 -0
- /package/client/dist/assets/{agentstudio-DCyDW8sy.js → agentstudio-Dq-bZrI3.js} +0 -0
- /package/client/dist/assets/{agentstudio-1E-bag77.js → agentstudio-n0pmwz2I.js} +0 -0
- /package/client/dist/assets/{aiedit-qTGI_PGs.js → aiedit-1Z-UYKFb.js} +0 -0
- /package/client/dist/assets/{aiedit-CGxeml8D.js → aiedit-BAJM9Cch.js} +0 -0
- /package/client/dist/assets/{aiedit-CfBNanHE.js → aiedit-CYnsp1Iv.js} +0 -0
- /package/client/dist/assets/{aiedit-CvSspQmE.js → aiedit-CZBZAyeK.js} +0 -0
- /package/client/dist/assets/{aiedit-kAU7KADg.js → aiedit-CunYxmW0.js} +0 -0
- /package/client/dist/assets/{aiedit-DUpe7NxI.js → aiedit-s1T1EMK8.js} +0 -0
- /package/client/dist/assets/{aiedit-DSLtsYIu.js → aiedit-uIDh2tlc.js} +0 -0
- /package/client/dist/assets/{analytics-DBGO8B6-.js → analytics-B95FiMuD.js} +0 -0
- /package/client/dist/assets/{analytics-CgEkAUiP.js → analytics-DPIkvuTS.js} +0 -0
- /package/client/dist/assets/{analytics-DDqve9Ma.js → analytics-DPmCEzvJ.js} +0 -0
- /package/client/dist/assets/{analytics-D1ElChhs.js → analytics-DRexho82.js} +0 -0
- /package/client/dist/assets/{analytics-DEsEAJZL.js → analytics-DVFNjjAv.js} +0 -0
- /package/client/dist/assets/{analytics-BDlELxc7.js → analytics-DZKGAUdm.js} +0 -0
- /package/client/dist/assets/{analytics-CQqu1yE5.js → analytics-g9ASAR_r.js} +0 -0
- /package/client/dist/assets/{apex-BHHyAVNb.js → apex-C1f-z6NO.js} +0 -0
- /package/client/dist/assets/{atom-one-dark-DrWoEEbZ.js → atom-one-dark-CT4DolNR.js} +0 -0
- /package/client/dist/assets/{attachments-3CuBBRFu.js → attachments--jr2QLGv.js} +0 -0
- /package/client/dist/assets/{attachments-pW3zm9nu.js → attachments-BgqfeoOx.js} +0 -0
- /package/client/dist/assets/{attachments-BNgH6Tcu.js → attachments-Bj3HHTXV.js} +0 -0
- /package/client/dist/assets/{attachments-D5fVsMgb.js → attachments-C3skjFyH.js} +0 -0
- /package/client/dist/assets/{attachments-UJtEq892.js → attachments-CnPS8YWu.js} +0 -0
- /package/client/dist/assets/{attachments-CppM7de8.js → attachments-DejzxE0C.js} +0 -0
- /package/client/dist/assets/{attachments-BLqqPGyy.js → attachments-FFb2xHc_.js} +0 -0
- /package/client/dist/assets/{azcli-C56lfIEP.js → azcli-Dr0WBJTP.js} +0 -0
- /package/client/dist/assets/{bat-BLamSaf-.js → bat-BKG3k49W.js} +0 -0
- /package/client/dist/assets/{bicep-lrOcEItS.js → bicep-DXs2wTcS.js} +0 -0
- /package/client/dist/assets/{browser-C91MQBxx.js → browser-BS9t1qMc.js} +0 -0
- /package/client/dist/assets/{browser-B7i7Ysc8.js → browser-BpMo-amf.js} +0 -0
- /package/client/dist/assets/{browser-DwE289IS.js → browser-CsC3NOZ-.js} +0 -0
- /package/client/dist/assets/{browser-C__Vz7KR.js → browser-DS6xnywt.js} +0 -0
- /package/client/dist/assets/{browser-DhwTc0ry.js → browser-Dm6F9bqQ.js} +0 -0
- /package/client/dist/assets/{browser-EFmPpkvO.js → browser-Dm_Of27q.js} +0 -0
- /package/client/dist/assets/{browser-BVQgd1_1.js → browser-U3iouSXn.js} +0 -0
- /package/client/dist/assets/{cameligo-BK_p0bgU.js → cameligo-Detknuxp.js} +0 -0
- /package/client/dist/assets/{chat-PVakYp92.js → chat-B2tWTbZL.js} +0 -0
- /package/client/dist/assets/{chat-BnJPyeUK.js → chat-CXOJHDUZ.js} +0 -0
- /package/client/dist/assets/{chat-CE8bx6Rz.js → chat-Cy78lw1n.js} +0 -0
- /package/client/dist/assets/{chat-UMl6H55K.js → chat-D78VMi-v.js} +0 -0
- /package/client/dist/assets/{chat-BXVx6rb5.js → chat-De1RgOXU.js} +0 -0
- /package/client/dist/assets/{chat-C5nJF6L0.js → chat-DyTbH-0F.js} +0 -0
- /package/client/dist/assets/{chat-9RcD5Lcn.js → chat-sqZyn0C4.js} +0 -0
- /package/client/dist/assets/{clojure-BQ7JOykv.js → clojure-CCu4UNKg.js} +0 -0
- /package/client/dist/assets/{clsx-CjLeUJfG.js → clsx-pVRQNNR0.js} +0 -0
- /package/client/dist/assets/{code-u9Sg9ohM.js → code-6LokPmIE.js} +0 -0
- /package/client/dist/assets/{code-OoLqhjoI.js → code-CLTuhuvM.js} +0 -0
- /package/client/dist/assets/{code-Lg4awa35.js → code-CwGlPuwb.js} +0 -0
- /package/client/dist/assets/{code-BPMR8_Vp.js → code-DFCDV5e1.js} +0 -0
- /package/client/dist/assets/{code-eh4vO2-_.js → code-Djq48g0s.js} +0 -0
- /package/client/dist/assets/{code-aCUqkVN_.js → code-Do27r8WG.js} +0 -0
- /package/client/dist/assets/{code-BsOBm1Fb.js → code-Drc7f197.js} +0 -0
- /package/client/dist/assets/{coffee-BD3DiL5s.js → coffee-Bam7Y9IR.js} +0 -0
- /package/client/dist/assets/{commands-B9XEyMj-.js → commands-CxReviyc.js} +0 -0
- /package/client/dist/assets/{commands-Ic1DJDxm.js → commands-CzP1qQyD.js} +0 -0
- /package/client/dist/assets/{commands-BdI0CtOL.js → commands-DGP46UxM.js} +0 -0
- /package/client/dist/assets/{commands-DSX3yJyr.js → commands-DQvoMqa7.js} +0 -0
- /package/client/dist/assets/{commands-yNn4IA4C.js → commands-DeKaz04Q.js} +0 -0
- /package/client/dist/assets/{commands-BI1Ta-E7.js → commands-DwYhwQsF.js} +0 -0
- /package/client/dist/assets/{commands-C2ewlyXo.js → commands-lm6Vlght.js} +0 -0
- /package/client/dist/assets/{common-CzCQ0rpW.js → common-B0crwfK0.js} +0 -0
- /package/client/dist/assets/{common-CNoRVpnA.js → common-BlqmiTj4.js} +0 -0
- /package/client/dist/assets/{common-CcHFVATT.js → common-CIUPtPdu.js} +0 -0
- /package/client/dist/assets/{common-LDwESeCX.js → common-C_-0fZsp.js} +0 -0
- /package/client/dist/assets/{common-C9VyfY7g.js → common-DH9A-wTo.js} +0 -0
- /package/client/dist/assets/{common-Dmpyh323.js → common-DJM41wFl.js} +0 -0
- /package/client/dist/assets/{common-ULlk84G4.js → common-SyTaRc_K.js} +0 -0
- /package/client/dist/assets/{cpp-splnCwCh.js → cpp-BhOkAe-9.js} +0 -0
- /package/client/dist/assets/{csharp-BCpsl-o3.js → csharp-BgHArJNx.js} +0 -0
- /package/client/dist/assets/{csp-tkCWrZmb.js → csp-Xzh56_3-.js} +0 -0
- /package/client/dist/assets/{css-B_xdnReq.js → css-CD7-RYRS.js} +0 -0
- /package/client/dist/assets/{cypher-OL1zq-y3.js → cypher-l2xAdF3X.js} +0 -0
- /package/client/dist/assets/{dart-CtTlOkrm.js → dart-CDOWeyzt.js} +0 -0
- /package/client/dist/assets/{dashboard-C-dXxut-.js → dashboard-B1rs1wki.js} +0 -0
- /package/client/dist/assets/{dashboard-CUjyhohl.js → dashboard-D9QPCmv3.js} +0 -0
- /package/client/dist/assets/{dashboard-C52PElPV.js → dashboard-Dxgb47lO.js} +0 -0
- /package/client/dist/assets/{dashboard-03EpOoMM.js → dashboard-TuElRCZX.js} +0 -0
- /package/client/dist/assets/{dashboard-Ch6H-457.js → dashboard-UWXs9_wy.js} +0 -0
- /package/client/dist/assets/{dashboard-zH9quXks.js → dashboard-ajT8usAi.js} +0 -0
- /package/client/dist/assets/{dashboard-C2owt3eN.js → dashboard-zwN2xswo.js} +0 -0
- /package/client/dist/assets/{dockerfile-DcQ5CNiW.js → dockerfile-Dv8atx7v.js} +0 -0
- /package/client/dist/assets/{ecl-DZpiDRt6.js → ecl-DIYTlbD_.js} +0 -0
- /package/client/dist/assets/{editor.api2-Cwla1nvV.js → editor.api2-CrNrMVfe.js} +0 -0
- /package/client/dist/assets/{elixir-Dzj2lqtK.js → elixir-CR7PLJja.js} +0 -0
- /package/client/dist/assets/{explore-4SD1DxR0.js → explore-BYFCCka4.js} +0 -0
- /package/client/dist/assets/{explore-xQoaak6e.js → explore-CE0wSNV1.js} +0 -0
- /package/client/dist/assets/{explore-CZt4Ncpa.js → explore-CSDcRUNj.js} +0 -0
- /package/client/dist/assets/{explore-DQ0XEjed.js → explore-CvM08PpD.js} +0 -0
- /package/client/dist/assets/{explore-CCcPXrHg.js → explore-Jkw93usp.js} +0 -0
- /package/client/dist/assets/{explore-BxR9q8Hq.js → explore-kK239uoZ.js} +0 -0
- /package/client/dist/assets/{explore-B2n8r9Ye.js → explore-mLI5eXks.js} +0 -0
- /package/client/dist/assets/{flow9-CFENCHIZ.js → flow9-DCK5-6NG.js} +0 -0
- /package/client/dist/assets/{format-command-CMsBTOPN.js → format-command-rVyGPxWE.js} +0 -0
- /package/client/dist/assets/{fsharp-D-4bv7FB.js → fsharp-DJ1xiUVU.js} +0 -0
- /package/client/dist/assets/{go-djxbTJq7.js → go-BEvbHcbb.js} +0 -0
- /package/client/dist/assets/{graphql-DHIFrkZ6.js → graphql-DN1ktXnz.js} +0 -0
- /package/client/dist/assets/{hcl-CXVoowNb.js → hcl-DJaIjIEr.js} +0 -0
- /package/client/dist/assets/{ini-Crzc5kly.js → ini-PlKfLEnb.js} +0 -0
- /package/client/dist/assets/{integrations-A9f08E0o.js → integrations-B8hT0Qf_.js} +0 -0
- /package/client/dist/assets/{integrations-DwSVdCpf.js → integrations-Bdk5dMyv.js} +0 -0
- /package/client/dist/assets/{integrations-B46ac3sf.js → integrations-CYqz7YFS.js} +0 -0
- /package/client/dist/assets/{integrations-9qxUNhPD.js → integrations-Cj_BsXxJ.js} +0 -0
- /package/client/dist/assets/{integrations-B17KyA-i.js → integrations-D8M8eJH2.js} +0 -0
- /package/client/dist/assets/{integrations-DkBi-Gsh.js → integrations-TJuDBl-9.js} +0 -0
- /package/client/dist/assets/{integrations-C7u7SInG.js → integrations-TwQV3sLw.js} +0 -0
- /package/client/dist/assets/{java-CYLaJrdE.js → java-3PUwMlx-.js} +0 -0
- /package/client/dist/assets/{jira-01H1RfQj.js → jira--rI5PfuE.js} +0 -0
- /package/client/dist/assets/{jira-CBU0200d.js → jira-BoRyckbb.js} +0 -0
- /package/client/dist/assets/{jira-BpnpUFlb.js → jira-C95FN3yk.js} +0 -0
- /package/client/dist/assets/{jira-DzIVvNmy.js → jira-CNUUgTs4.js} +0 -0
- /package/client/dist/assets/{jira-Dht8qNck.js → jira-DHFnvEm8.js} +0 -0
- /package/client/dist/assets/{jira-4Fin3fu7.js → jira-NhkbrDXe.js} +0 -0
- /package/client/dist/assets/{jira-0ldfMByG.js → jira-wiIvGma5.js} +0 -0
- /package/client/dist/assets/{jobs-Oz3UtLQn.js → jobs-Bjp7v9aA.js} +0 -0
- /package/client/dist/assets/{jobs-jEQidSIb.js → jobs-Bjt5PyVv.js} +0 -0
- /package/client/dist/assets/{jobs-BF9raUkL.js → jobs-BmTs4Bn3.js} +0 -0
- /package/client/dist/assets/{jobs-DcCONARH.js → jobs-Cchy-18B.js} +0 -0
- /package/client/dist/assets/{jobs-DM9owF1j.js → jobs-D2QVTPbz.js} +0 -0
- /package/client/dist/assets/{jobs-Bw4hqEro.js → jobs-LK1ImiDH.js} +0 -0
- /package/client/dist/assets/{jobs-ym72SIR9.js → jobs-yPz4Dvi-.js} +0 -0
- /package/client/dist/assets/{julia-BJ7tUU-T.js → julia-DC6LnY15.js} +0 -0
- /package/client/dist/assets/{kotlin-CeWcU3lC.js → kotlin-CoGntbZF.js} +0 -0
- /package/client/dist/assets/{less-CviwWNG4.js → less-DCFflTXL.js} +0 -0
- /package/client/dist/assets/{lexon-Dt28jqDS.js → lexon-BTOivnjP.js} +0 -0
- /package/client/dist/assets/{loops-Fv4Bs-9A.js → loops-BFIcYvpy.js} +0 -0
- /package/client/dist/assets/{loops-D_ZxkD4l.js → loops-BU314kSd.js} +0 -0
- /package/client/dist/assets/{loops-DE-2cmLw.js → loops-C3OaXou9.js} +0 -0
- /package/client/dist/assets/{loops-mcoeFMat.js → loops-Cv6Aeszq.js} +0 -0
- /package/client/dist/assets/{loops-B_w7STrw.js → loops-IQe23ef6.js} +0 -0
- /package/client/dist/assets/{loops-BYNUJVyD.js → loops-LqZ4MC6J.js} +0 -0
- /package/client/dist/assets/{loops-B_gS4Pqu.js → loops-SbkOdciY.js} +0 -0
- /package/client/dist/assets/{lua-B6AOaJSi.js → lua-ClKCZMmP.js} +0 -0
- /package/client/dist/assets/{m3-VnMkHJcy.js → m3-25hKFWMb.js} +0 -0
- /package/client/dist/assets/{markdown-8vKNdvIM.js → markdown-BGAj9q0K.js} +0 -0
- /package/client/dist/assets/{mips-DoEcuzan.js → mips-BrVgY2Pf.js} +0 -0
- /package/client/dist/assets/{msdax-CNzvHyEp.js → msdax-7EhcRsm8.js} +0 -0
- /package/client/dist/assets/{mysql-Buk3vUtL.js → mysql-B5_atCBH.js} +0 -0
- /package/client/dist/assets/{nav-_0vAgZ_k.js → nav-B2Cv1vjz.js} +0 -0
- /package/client/dist/assets/{nav-Cw3_40fA.js → nav-Br2AivTc.js} +0 -0
- /package/client/dist/assets/{nav-DNDJ3H-_.js → nav-CFofO7QO.js} +0 -0
- /package/client/dist/assets/{nav-CCz4krPP.js → nav-CyHKTZxn.js} +0 -0
- /package/client/dist/assets/{nav-B5W9IMnf.js → nav-DqyLGJmF.js} +0 -0
- /package/client/dist/assets/{nav-CrG_mYRr.js → nav-_-siCrRv.js} +0 -0
- /package/client/dist/assets/{nav-DbAbG5_k.js → nav-rO4Nqnh-.js} +0 -0
- /package/client/dist/assets/{nav-DVp1nEsi.js → nav-zyBhf29M.js} +0 -0
- /package/client/dist/assets/{objective-c-DfOmda-5.js → objective-c-CLUvUl9T.js} +0 -0
- /package/client/dist/assets/{pascal-DoAA2yjy.js → pascal-BnU1HU42.js} +0 -0
- /package/client/dist/assets/{pascaligo-C65Vn1fu.js → pascaligo-dsKvjFzi.js} +0 -0
- /package/client/dist/assets/{perl-INlfQ_ro.js → perl-CZne1GYG.js} +0 -0
- /package/client/dist/assets/{pgsql-DtwRzglx.js → pgsql-CMa5W_iF.js} +0 -0
- /package/client/dist/assets/{php-DfHqVNet.js → php-Cu4mS35J.js} +0 -0
- /package/client/dist/assets/{pla-D3dNVRYk.js → pla-B7COwnnm.js} +0 -0
- /package/client/dist/assets/{postiats-UKXD1rM4.js → postiats-GLeNtnBQ.js} +0 -0
- /package/client/dist/assets/{powerquery-zE3E3O7s.js → powerquery-BqPf3R1W.js} +0 -0
- /package/client/dist/assets/{powershell-Df9b3zQl.js → powershell-D9btb5su.js} +0 -0
- /package/client/dist/assets/{protobuf-BF0nUVrW.js → protobuf-6GHSuaNm.js} +0 -0
- /package/client/dist/assets/{pug-Bj6Yikv_.js → pug-ct6rYKQd.js} +0 -0
- /package/client/dist/assets/{qsharp-BI4h-raZ.js → qsharp-CIrAQNPy.js} +0 -0
- /package/client/dist/assets/{r-DhpnmaXx.js → r-Bk-a0sON.js} +0 -0
- /package/client/dist/assets/{redis-DwYYPr4d.js → redis-C9yfaWYh.js} +0 -0
- /package/client/dist/assets/{redshift-D2f3Bc-4.js → redshift-DaOT1jRU.js} +0 -0
- /package/client/dist/assets/{restructuredtext-Dkiif6fe.js → restructuredtext-C1t9LQfS.js} +0 -0
- /package/client/dist/assets/{ruby-C6hLmHy0.js → ruby-COiPZJjc.js} +0 -0
- /package/client/dist/assets/{rust-X8WAGtxB.js → rust--gZOJZzj.js} +0 -0
- /package/client/dist/assets/{sb-4M2la0Kr.js → sb-NHf3iazF.js} +0 -0
- /package/client/dist/assets/{scala-CaCXz58E.js → scala-D1nO1TBd.js} +0 -0
- /package/client/dist/assets/{scheme-CMdjpmP7.js → scheme-Bref42s5.js} +0 -0
- /package/client/dist/assets/{scss-QopmvPyp.js → scss-BS9CCLr3.js} +0 -0
- /package/client/dist/assets/{settings-DyBxunCh.js → settings-BN4dufu6.js} +0 -0
- /package/client/dist/assets/{settings-BN7OusER.js → settings-Bap_q3rt.js} +0 -0
- /package/client/dist/assets/{settings-Bi5FFkIw.js → settings-BlYjWMy5.js} +0 -0
- /package/client/dist/assets/{settings-iQe5Dim-.js → settings-C7t_uUz4.js} +0 -0
- /package/client/dist/assets/{settings-fk-WlnUt.js → settings-CIFrUsKt.js} +0 -0
- /package/client/dist/assets/{settings-BA1V6KdK.js → settings-Cbj9VWmI.js} +0 -0
- /package/client/dist/assets/{settings-CRJxyTNN.js → settings-D7saHMU8.js} +0 -0
- /package/client/dist/assets/{settings-0m2iuTzd.js → settings-DrRjM5e8.js} +0 -0
- /package/client/dist/assets/{shell-CDBchS00.js → shell-DT3joMBB.js} +0 -0
- /package/client/dist/assets/{solidity-DvBfi5mC.js → solidity-o2Fm9dvg.js} +0 -0
- /package/client/dist/assets/{sophia-HSnXR17u.js → sophia-Dj1N6Xqb.js} +0 -0
- /package/client/dist/assets/{sparql-DhG_ppup.js → sparql-D2fjpTWm.js} +0 -0
- /package/client/dist/assets/{specs-BvsFNKTs.js → specs-C-WXGBqy.js} +0 -0
- /package/client/dist/assets/{specs-D4ORogcT.js → specs-C57koADY.js} +0 -0
- /package/client/dist/assets/{specs-CnH7dOiF.js → specs-CCXV-eSF.js} +0 -0
- /package/client/dist/assets/{specs-CUE3xSFM.js → specs-CYA5Bv7Q.js} +0 -0
- /package/client/dist/assets/{specs-C2wW5bq8.js → specs-DFCFg51O.js} +0 -0
- /package/client/dist/assets/{specs-C_8j4ELZ.js → specs-Dslng_yW.js} +0 -0
- /package/client/dist/assets/{specs-D6Y76Bgi.js → specs-DwRPiJTc.js} +0 -0
- /package/client/dist/assets/{specs-Bku8SypT.js → specs-DzlROLy7.js} +0 -0
- /package/client/dist/assets/{sql-DHeIS-tf.js → sql-BArhsPUz.js} +0 -0
- /package/client/dist/assets/{st-CMWchiRU.js → st-Bd2-tALj.js} +0 -0
- /package/client/dist/assets/{swift-CDXvBefj.js → swift-DvEpXBKj.js} +0 -0
- /package/client/dist/assets/{systemverilog-0RTukYUE.js → systemverilog-mHEbsnVH.js} +0 -0
- /package/client/dist/assets/{tcl-CbBF_Ttl.js → tcl-DePutp1e.js} +0 -0
- /package/client/dist/assets/{terminal-CB33IsO1.js → terminal-2S-Wsk6L.js} +0 -0
- /package/client/dist/assets/{terminal-Cz_Puz0q.js → terminal-BRQMrU74.js} +0 -0
- /package/client/dist/assets/{terminal-DFEH9XTQ.js → terminal-BTiemy98.js} +0 -0
- /package/client/dist/assets/{terminal-BTanJIt_.js → terminal-CjQeWfpp.js} +0 -0
- /package/client/dist/assets/{terminal-CY_sPfdD.js → terminal-CmP5riTU.js} +0 -0
- /package/client/dist/assets/{terminal-BLh00ouM.js → terminal-CnObBCAh.js} +0 -0
- /package/client/dist/assets/{terminal-CR6t-Oey.js → terminal-DcPKgKMN.js} +0 -0
- /package/client/dist/assets/{terminal-Cj4HzP3p.js → terminal-XciDq6VV.js} +0 -0
- /package/client/dist/assets/{tickets-OrJwUxJR.js → tickets-7kl_0jgM.js} +0 -0
- /package/client/dist/assets/{tickets-68LH1xp6.js → tickets-BSyaZI8d.js} +0 -0
- /package/client/dist/assets/{tickets-blQnNA4N.js → tickets-CcTcvwKS.js} +0 -0
- /package/client/dist/assets/{tickets-D6f3GSYn.js → tickets-D75vyZJj.js} +0 -0
- /package/client/dist/assets/{tickets-PtHNxQo5.js → tickets-D79ZT2SZ.js} +0 -0
- /package/client/dist/assets/{tickets-DBQXMYYA.js → tickets-DbcMWq5L.js} +0 -0
- /package/client/dist/assets/{tickets-jxsTrApR.js → tickets-ZA_2iPd1.js} +0 -0
- /package/client/dist/assets/{tickets-REr-EQx9.js → tickets-mxd23fWX.js} +0 -0
- /package/client/dist/assets/{twig-DCcGd8FE.js → twig-DQ2zIX0b.js} +0 -0
- /package/client/dist/assets/{typespec-HTphp-Uh.js → typespec-DPoaiGTJ.js} +0 -0
- /package/client/dist/assets/{vb-Cb_yUcVd.js → vb-Jo98wdMr.js} +0 -0
- /package/client/dist/assets/{wgsl-DrKU3YXj.js → wgsl-DZc4h_eS.js} +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/editor.main-Cd8qBRAT.js","assets/chunk-CilyBKbf.js","assets/preload-helper-DSXbuxSR.js","assets/editor.api2-Cwla1nvV.js","assets/editor-Br_kD0ds.css","assets/workers-yr2u4c3C.js","assets/monaco.contribution-CIvCAJs4.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{t}from"./preload-helper-DSXbuxSR.js";import{At as n,Bt as r,Cn as i,G as a,Ht as o,L as s,Mt as c,R as l,Sn as u,St as d,U as f,Ut as p,_t as m,a as h,bn as g,bt as _,en as v,gn as y,hn as b,ht as x,jt as S,l as C,nn as w,rt as T,tn as E,v as D,wn as O,xt as k,y as A,yt as j}from"./index-meTWPBzY.js";var M=r(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),N=r(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),P=r(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),F=e(O(),1),I=e(i(),1);function L(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function R(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function ee(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var te=(e,t)=>Math.abs(e-t)<1.01,ne=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},z,B=()=>{if(z!==void 0)return z;if(typeof navigator>`u`)return z=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return z=!0;let e=navigator.maxTouchPoints;return z=navigator.platform===`MacIntel`&&e!==void 0&&e>0},V=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},re=e=>e,ie=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},H=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(V(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(V(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},U={passive:!0},ae=typeof window>`u`?!0:`onscrollend`in window,W=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&ae,o=0,s=a?null:ne(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,U),a&&r.addEventListener(`scrollend`,u,U),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},G=(e,t)=>W(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),oe=(e,t,n)=>{if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},K=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},se=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:re,rangeExtractor:ie,onChange:()=>{},measureElement:oe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}this.options=t},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=R(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!B()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,U),e.addEventListener(`touchend`,n,U),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=R(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,r,i,a,o)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=R(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o},s)=>{let c=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let l=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=this.options.gap,a=e*2,o=this._flatMeasurements;if(!o||o.length<a){let e=new Float64Array(a);o&&l>0&&e.set(o.subarray(0,l*2)),o=e,this._flatMeasurements=o}let s;if(l===0)s=t+n;else{let e=l-1;s=o[e*2]+o[e*2+1]+i}for(let t=l;t<e;t++){let e=r(t),n=c.get(e),a=typeof n==`number`?n:this.options.estimateSize(t);o[t*2]=s,o[t*2+1]=a,s+=a+i}let u=L(e,o,r);return this.measurementsCache=u,u}let u=this.measurementsCache.slice(0,l),d=Array(a).fill(void 0);for(let e=0;e<l;e++){let t=u[e];t&&(d[t.lane]=e)}for(let i=l;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),s,l,f=o===`estimate`||c.has(e);if(a!==void 0&&this.options.lanes>1){s=a;let e=d[s],r=e===void 0?void 0:u[e];l=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?u[i-1]:this.getFurthestMeasurement(u,i);l=e?e.end+this.options.gap:t+n,s=e?e.lane:i%this.options.lanes,this.options.lanes>1&&f&&this.laneAssignments.set(i,s)}let p=c.get(e),m=typeof p==`number`?p:this.options.estimateSize(i),h=l+m;u[i]={index:i,start:l,size:m,end:h,key:e,lane:s},d[s]=i}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=R(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?le({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:r===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=R(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);o!==0&&(this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!==`backward`:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this))&&(B()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=o:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0})),(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,this.notify(!1))},this.getVirtualItems=R(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return ee(t[ce(0,t.length-1,r?e=>n[e*2]:e=>ee(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&te(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},ce=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function le({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:i}){let a=e.length-1,o=i?e=>i[e*2]:t=>e[t].start,s=i?e=>i[e*2]+i[e*2+1]:t=>e[t].end;if(e.length<=r)return{startIndex:0,endIndex:a};let c=ce(0,a,o,n),l=c;if(r===1)for(;l<a&&s(l)<n+t;)l++;else if(r>1){let i=Array(r).fill(0);for(;l<a&&i.some(e=>e<n+t);){let t=e[l];i[t.lane]=t.end,l++}let o=Array(r).fill(n+t);for(;c>=0&&o.some(e=>e>=n);){let t=e[c];o[t.lane]=t.start,c--}c=Math.max(0,c-c%r),l=Math.min(a,l+(r-1-l%r))}return{startIndex:c,endIndex:l}}var ue=typeof document<`u`?F.useLayoutEffect:F.useEffect;function q({useFlushSync:e=!0,...t}){let n=F.useReducer(e=>e+1,0)[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,I.flushSync)(n):n(),(a=t.onChange)==null||a.call(t,r,i)}},[i]=F.useState(()=>new se(r));return i.setOptions(r),ue(()=>i._didMount(),[]),ue(()=>i._willUpdate()),i}function de(e){return q({observeElementRect:H,observeElementOffset:G,scrollToFn:K,...e})}var J=E(),Y=e=>`specrails-desktop:code-tree-filter:${e}`,X=e=>`specrails-desktop:code-tree-collapsed:${e}`;function Z(e){return e.split(`/`).length-1}function fe(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function pe(e){return e?e.length>10?e.slice(0,10):e:null}function me(e){return e===`created`?`added`:e===`modified`?`changed`:e===`deleted`?`deleted`:null}function he(e,t){if(t.size===0)return!1;let n=e.split(`/`);for(let e=1;e<n.length;e++)if(t.has(n.slice(0,e).join(`/`)))return!0;return!1}function ge({onOpenFile:e,selectedPath:t,filterJobId:n,filterTicketId:r}){let{t:i}=y(`code`),{activeProjectId:a}=o(),{openTicketDetail:s}=C(),{registerHandler:l,unregisterHandler:u}=v(),[d,h]=(0,F.useState)(()=>{if(!a)return`touched-by-ai`;try{let e=localStorage.getItem(Y(a));if(e===`all`||e===`touched-by-ai`)return e}catch{}return`touched-by-ai`});(0,F.useEffect)(()=>{if(a)try{localStorage.setItem(Y(a),d)}catch{}},[d,a]);let[g,_]=(0,F.useState)(()=>{if(!a)return new Set;try{let e=localStorage.getItem(X(a));if(!e)return new Set;let t=JSON.parse(e);if(Array.isArray(t))return new Set(t.filter(e=>typeof e==`string`))}catch{}return new Set});(0,F.useEffect)(()=>{if(a)try{localStorage.setItem(X(a),JSON.stringify([...g]))}catch{}},[g,a]);let b=(0,F.useCallback)(e=>{_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),T=(0,F.useCallback)(()=>{_(new Set)},[]),{data:E,refresh:D,isFirstLoad:O}=p({namespace:`code-tree:${d}:${d===`touched-by-ai`?`${n??`all-jobs`}:${r??`all-specs`}`:`all`}`,projectId:a,initialValue:[],fetcher:(0,F.useCallback)(async()=>{let e=[],t=null;for(let i=0;i<100;i+=1){let i=new URLSearchParams({withProvenance:`1`,filter:d});d===`touched-by-ai`&&n&&i.set(`jobId`,n),d===`touched-by-ai`&&typeof r==`number`&&i.set(`ticketId`,String(r)),t&&i.set(`cursor`,t);let a=await fetch(`${w()}/code/tree?${i.toString()}`);if(!a.ok)break;let o=await a.json().catch(()=>({}));if(Array.isArray(o.entries)&&e.push(...o.entries),!o.nextCursor)break;t=o.nextCursor}return e},[d,n,r])}),k=(0,F.useRef)(a);(0,F.useEffect)(()=>{k.current=a},[a]),(0,F.useEffect)(()=>{if(!a)return;let e=`code-tree-${a}`;return l(e,e=>{let t=e;t.projectId===k.current&&t.type===`file.provenance_updated`&&D()}),()=>u(e)},[a,l,u,D]);let A=(0,F.useRef)(null),j=(0,F.useMemo)(()=>(E??[]).filter(e=>!he(e.path,g)),[E,g]),P=(0,F.useCallback)(()=>{_(new Set((E??[]).filter(e=>e.kind===`dir`).map(e=>e.path)))},[E]),I=de({count:j.length,getScrollElement:()=>A.current,estimateSize:()=>28,overscan:12,initialRect:{width:320,height:600},observeElementRect:(e,t)=>{let n=e.scrollElement;if(!n)return()=>{};let r=()=>{let e=n.getBoundingClientRect(),r=e.height||n.clientHeight||600;t({width:e.width||n.clientWidth||320,height:r})};if(r(),typeof ResizeObserver<`u`){let e=new ResizeObserver(r);return e.observe(n),()=>e.disconnect()}return()=>{}}}),L=j.length===0,R=(0,F.useMemo)(()=>(E??[]).filter(e=>e.kind===`file`).length,[E]);return(0,J.jsxs)(`div`,{className:`flex flex-col h-full`,"data-testid":`file-tree`,children:[(0,J.jsxs)(`div`,{className:`px-2 py-2 border-b border-border text-xs space-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>h(`touched-by-ai`),className:f(`px-2 py-1 rounded-md transition-colors`,d===`touched-by-ai`?`bg-accent-primary/20 text-accent-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),"aria-pressed":d===`touched-by-ai`,children:i(n?`tree.jobFiles`:r?`tree.specFiles`:`tree.touchedByAi`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>h(`all`),className:f(`px-2 py-1 rounded-md transition-colors`,d===`all`?`bg-accent-primary/20 text-accent-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),"aria-pressed":d===`all`,children:i(`tree.allFiles`)}),(0,J.jsx)(`div`,{className:`flex-1`}),(0,J.jsx)(`button`,{type:`button`,onClick:P,title:i(`tree.collapseAll`),className:`px-1.5 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50`,"aria-label":i(`tree.collapseAll`),children:(0,J.jsx)(S,{className:`w-3.5 h-3.5`})}),(0,J.jsx)(`button`,{type:`button`,onClick:T,title:i(`tree.expandAll`),className:`px-1.5 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50`,"aria-label":i(`tree.expandAll`),children:(0,J.jsx)(c,{className:`w-3.5 h-3.5`})})]}),d===`touched-by-ai`&&R>0&&(0,J.jsx)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-muted-foreground`,children:(0,J.jsx)(`span`,{children:i(`tree.touchedCount`,{count:R})})})]}),L&&O?(0,J.jsx)(`div`,{className:`flex-1 flex items-center justify-center px-4 text-center`,"data-testid":`file-tree-loading`,children:(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground animate-pulse`,children:i(`tree.loadingFiles`)})}):L&&d===`touched-by-ai`?(0,J.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center px-4 text-center gap-3`,children:[(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`tree.emptyTouched`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>h(`all`),className:`text-xs px-3 py-1.5 rounded-md bg-accent-primary/20 text-accent-primary hover:bg-accent-primary/30`,children:i(`tree.showAllFiles`)})]}):L?(0,J.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-xs text-muted-foreground px-4 text-center`,children:i(`tree.noFiles`)}):(0,J.jsx)(`div`,{ref:A,className:`flex-1 overflow-auto`,"data-testid":`file-tree-scroller`,children:(0,J.jsx)(`div`,{style:{height:I.getTotalSize(),position:`relative`,width:`100%`},children:I.getVirtualItems().map(n=>{let r=j[n.index],a=Z(r.path)*12,o=r.kind===`file`&&r.path===t,l=r.provenance?.createdByTicketId,u=r.provenance?.modifiedByTicketIds??[],d=r.provenance?.latest??null,p=pe(d?.jobId),h=me(d?.kind),_=r.kind===`dir`,v=_&&g.has(r.path),y=r.provenance?.touchedFileCount??0;return(0,J.jsxs)(`div`,{style:{position:`absolute`,top:0,left:0,transform:`translateY(${n.start}px)`,height:n.size,width:`100%`},className:f(`flex items-center gap-2 px-2 text-xs cursor-pointer hover:bg-muted/50`,o&&`bg-muted text-foreground`),onClick:()=>{_?b(r.path):e(r.path)},role:`button`,tabIndex:0,"aria-expanded":_?!v:void 0,"data-testid":`file-tree-row-${r.path}`,children:[(0,J.jsxs)(`span`,{style:{paddingLeft:a},className:`flex items-center gap-1 min-w-0 flex-1`,children:[_?(0,J.jsxs)(J.Fragment,{children:[v?(0,J.jsx)(S,{className:`w-3 h-3 text-muted-foreground flex-shrink-0`}):(0,J.jsx)(c,{className:`w-3 h-3 text-muted-foreground flex-shrink-0`}),v?(0,J.jsx)(N,{className:`w-3.5 h-3.5 text-accent-info flex-shrink-0`}):(0,J.jsx)(m,{className:`w-3.5 h-3.5 text-accent-info flex-shrink-0`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`w-3 flex-shrink-0`}),(0,J.jsx)(M,{className:`w-3.5 h-3.5 text-muted-foreground flex-shrink-0`})]}),(0,J.jsx)(`span`,{className:`truncate ml-0.5`,children:fe(r.path)})]}),(0,J.jsxs)(`span`,{className:`flex items-center gap-1 flex-shrink-0`,children:[_&&y>0&&(0,J.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted/60 text-muted-foreground`,title:i(`tree.folderTouched`,{count:y}),children:y}),!_&&h&&(0,J.jsx)(`span`,{className:f(`text-[10px] px-1.5 py-0.5 rounded`,d?.kind===`created`&&`bg-accent-success/15 text-accent-success`,d?.kind===`modified`&&`bg-accent-info/15 text-accent-info`,d?.kind===`deleted`&&`bg-destructive/15 text-destructive`),title:d?.kind===`created`?i(`tree.latestTitleCreated`):d?.kind===`deleted`?i(`tree.latestTitleDeleted`):i(`tree.latestTitleModified`),children:i(`action.${h}`)}),!_&&p&&(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-muted/60 text-muted-foreground font-mono`,title:i(`tree.jobTitle`,{jobId:d?.jobId??``}),children:[(0,J.jsx)(x,{className:`h-3 w-3`}),p]}),!_&&typeof l==`number`&&(0,J.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s(l)},className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-success/20 text-accent-success`,"data-testid":`provenance-chip-created-${l}`,title:i(`tree.createdBySpec`,{id:l}),children:[`#`,l]}),!_&&u.slice(0,2).map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),s(e)},className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-info/15 text-accent-info`,"data-testid":`provenance-chip-modified-${e}`,title:i(`tree.modifiedBySpec`,{id:e}),children:[`#`,e]},e))]})]},r.path)})})})]})}function _e(e){return new Worker(`/assets/editor.worker-Bd9IXS8d.js`,{name:e?.name})}function ve(e){return new Worker(`/assets/json.worker-DzV-CpCQ.js`,{name:e?.name})}function ye(e){return new Worker(`/assets/css.worker-Wv5dxAWO.js`,{name:e?.name})}function be(e){return new Worker(`/assets/html.worker-CQP8QQsS.js`,{name:e?.name})}function xe(e){return new Worker(`/assets/ts.worker-METxwbDZ.js`,{name:e?.name})}var Se=!1;function Ce(e){let t=e.trim().match(/^hsl\(\s*([-\d.]+)[\s,]+([\d.]+)%[\s,]+([\d.]+)%\s*\)$/i);return t?[parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])]:null}function Q(e,t=`#1e1e1e`){if(e.startsWith(`#`))return e;let n=Ce(e);if(!n)return t;let[r,i,a]=n,o=i/100,s=a/100,c=(1-Math.abs(2*s-1))*o,l=(r%360+360)%360/60,u=c*(1-Math.abs(l%2-1)),d=0,f=0,p=0;l<1?(d=c,f=u):l<2?(d=u,f=c):l<3?(f=c,p=u):l<4?(f=u,p=c):l<5?(d=u,p=c):(d=c,p=u);let m=s-c/2,h=e=>Math.round((e+m)*255).toString(16).padStart(2,`0`);return`#${h(d)}${h(f)}${h(p)}`}function we(e){return`specrails-${e}`}function Te(e,t){let n=we(t.id),r=t.xterm,i=Q(r.background),a=Q(r.foreground),o=Q(r.brightBlack),s=Q(r.magenta),c=Q(r.yellow),l=Q(r.cyan),u=Q(r.blue),d=Q(r.green),f=Q(r.brightBlack),p=Q(r.brightCyan),m=Q(r.red),h=Q(r.selectionBackground);return e.editor.defineTheme(n,{base:t.scheme===`light`?`vs`:`vs-dark`,inherit:!0,rules:[{token:``,foreground:a.slice(1)},{token:`comment`,foreground:f.slice(1),fontStyle:`italic`},{token:`keyword`,foreground:s.slice(1)},{token:`string`,foreground:c.slice(1)},{token:`number`,foreground:l.slice(1)},{token:`constant`,foreground:p.slice(1)},{token:`constant.numeric`,foreground:l.slice(1)},{token:`type`,foreground:d.slice(1)},{token:`type.identifier`,foreground:d.slice(1)},{token:`identifier`,foreground:a.slice(1)},{token:`function`,foreground:u.slice(1)},{token:`tag`,foreground:m.slice(1)},{token:`attribute.name`,foreground:p.slice(1)},{token:`attribute.value`,foreground:c.slice(1)},{token:`delimiter`,foreground:o.slice(1)},{token:`operator`,foreground:o.slice(1)}],colors:{"editor.background":i,"editor.foreground":a,"editorLineNumber.foreground":o,"editorLineNumber.activeForeground":a,"editorCursor.foreground":Q(r.cursor),"editor.selectionBackground":h,"editor.inactiveSelectionBackground":h,"editor.lineHighlightBackground":Q(r.black),"editor.lineHighlightBorder":Q(r.black),"editorGutter.background":i,"editorWhitespace.foreground":o,"editorIndentGuide.background1":Q(r.black),"editorIndentGuide.activeBackground1":o,"scrollbarSlider.background":`${o}55`,"scrollbarSlider.hoverBackground":`${o}88`,"scrollbarSlider.activeBackground":`${o}bb`,"minimap.background":i}}),n}function Ee(){Se||=(self.MonacoEnvironment={getWorker(e,t){switch(t){case`json`:return new ve;case`css`:case`scss`:case`less`:return new ye;case`html`:case`handlebars`:case`razor`:return new be;case`typescript`:case`javascript`:return new xe;default:return new _e}}},!0)}function De({content:e,language:n,readOnly:r,onChange:i}){let{t:a}=y(`code`),o=h(),s=(0,F.useRef)(null),c=(0,F.useRef)(null),l=(0,F.useRef)(null),[u,d]=(0,F.useState)(!1),f=(0,F.useRef)(e),p=(0,F.useRef)(n),m=(0,F.useRef)(o),g=(0,F.useRef)(r),_=(0,F.useRef)(i);return(0,F.useEffect)(()=>{f.current=e},[e]),(0,F.useEffect)(()=>{p.current=n},[n]),(0,F.useEffect)(()=>{m.current=o},[o]),(0,F.useEffect)(()=>{g.current=r},[r]),(0,F.useEffect)(()=>{_.current=i},[i]),(0,F.useEffect)(()=>{let e=!1;return Ee(),t(()=>import(`./editor.main-Cd8qBRAT.js`).then(t=>{if(e||!s.current)return;l.current=t;let n=Te(t,m.current),r=t.editor.create(s.current,{value:f.current,language:p.current,readOnly:g.current,theme:n,minimap:{enabled:!1},lineNumbers:`on`,scrollBeyondLastLine:!1,automaticLayout:!0,fontSize:13});r.onDidChangeModelContent(()=>{_.current?.(r.getValue())}),c.current=r}),__vite__mapDeps([0,1,2,3,4,5,6])).catch(()=>{e||d(!0)}),()=>{e=!0,c.current?.dispose?.(),c.current=null}},[]),(0,F.useEffect)(()=>{let t=c.current;t&&t.getValue?.()!==e&&t.setValue?.(e)},[e]),(0,F.useEffect)(()=>{c.current?.updateOptions?.({readOnly:r})},[r]),(0,F.useEffect)(()=>{let e=l.current,t=c.current;if(!e||!t)return;let r=t.getModel?.();r&&e.editor.setModelLanguage(r,n)},[n]),(0,F.useEffect)(()=>{let e=l.current;if(!e)return;let t=Te(e,o);e.editor.setTheme(t)},[o]),u?(0,J.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center gap-2 text-sm text-muted-foreground`,"data-testid":`monaco-load-error`,children:[(0,J.jsx)(`span`,{children:a(`monaco.loadFailed`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`rounded-md bg-accent-primary/15 px-3 py-1 text-xs text-accent-primary hover:bg-accent-primary/25`,children:a(`monaco.reload`)})]}):(0,J.jsx)(`div`,{ref:s,className:`w-full h-full`,"data-testid":`monaco-host`})}var Oe=(0,F.lazy)(async()=>({default:De}));function ke({content:e,language:t,readOnly:n=!0,onChange:r}){let{t:i}=y(`code`);return(0,J.jsx)(F.Suspense,{fallback:(0,J.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-sm text-muted-foreground animate-pulse`,children:i(`monaco.loadingEditor`)}),children:(0,J.jsx)(Oe,{content:e,language:t,readOnly:n,onChange:r})})}function Ae(e,t){if(!e)return null;let n=Date.parse(e);if(Number.isNaN(n))return null;let r=Math.round((n-Date.now())/1e3),i=new Intl.RelativeTimeFormat(t,{numeric:`auto`}),a=Math.abs(r);return a<60?i.format(r,`second`):a<3600?i.format(Math.round(r/60),`minute`):a<86400?i.format(Math.round(r/3600),`hour`):i.format(Math.round(r/86400),`day`)}function je({path:e,summary:t,stale:r,regenerating:i,generateDisabledReason:a,onCollapse:o}){let{t:s,i18n:c}=y(`code`),{openTicketDetail:l}=C();if(!t)return(0,J.jsx)(`div`,{className:`border-b border-border px-4 py-3 bg-surface`,"data-testid":`summary-header-empty`,children:(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-0.5 min-w-0`,children:[(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:e}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a?s(`summary.unavailable`,{reason:a}):s(`summary.empty`)})]}),o&&(0,J.jsxs)(`button`,{type:`button`,onClick:o,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,J.jsx)(n,{className:`h-3.5 w-3.5`}),s(`summary.hide`)]})]})});let u=Ae(t.generatedAt,c.language),d=t.triggeredBy?.ticketId,p=t.triggeredBy?.modifiedTicketIds??[];return(0,J.jsx)(`div`,{className:`border-b border-border px-4 py-3 bg-surface`,"data-testid":`summary-header`,children:(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:e}),r&&(0,J.jsx)(`span`,{className:f(`text-[10px] px-1.5 py-0.5 rounded bg-accent-warning/20 text-accent-warning font-medium`),"data-testid":`summary-stale-badge`,children:s(`summary.stale`)}),i&&(0,J.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-accent-primary animate-pulse`,"aria-hidden":!0})]}),(0,J.jsx)(`p`,{className:`text-sm text-foreground mt-1`,children:t.summary}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 mt-2 flex-wrap`,children:[typeof d==`number`&&(0,J.jsxs)(`button`,{type:`button`,onClick:()=>l(d),className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-success/20 text-accent-success`,children:[`#`,d]}),p.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>l(e),className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-info/15 text-accent-info`,children:[`#`,e]},e)),u&&(0,J.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:u})]})]}),o&&(0,J.jsxs)(`button`,{type:`button`,onClick:o,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,J.jsx)(n,{className:`h-3.5 w-3.5`}),s(`summary.hide`)]})]})})}function Me({content:e}){return(0,J.jsx)(A,{remarkPlugins:[D],children:e})}function Ne(e,t){return t===`markdown`||t===`md`?!0:/\.(md|mdx|markdown)$/i.test(e)}var Pe=180,Fe=120,Ie=240;function Le(e){return e?`specrails-desktop:code-summary-collapsed:${e}`:null}function Re(e){return e?`specrails-desktop:code-history-height:${e}`:null}function ze(e){return e?`specrails-desktop:code-history-collapsed:${e}`:null}function Be(e){let t=Re(e);if(!t)return Pe;try{let e=localStorage.getItem(t),n=e?Number(e):NaN;return Number.isFinite(n)&&n>0?n:Pe}catch{return Pe}}function Ve(e,t){let n=Re(e);if(n)try{localStorage.setItem(n,String(Math.round(t)))}catch{}}function He(e){let t=Le(e);if(!t)return!1;try{return localStorage.getItem(t)===`true`}catch{return!1}}function Ue(e,t){let n=Le(e);if(n)try{localStorage.setItem(n,t?`true`:`false`)}catch{}}function We(e){let t=ze(e);if(!t)return!1;try{return localStorage.getItem(t)===`true`}catch{return!1}}function Ge(e,t){let n=ze(e);if(n)try{localStorage.setItem(n,t?`true`:`false`)}catch{}}function Ke(e,t){let n=Math.max(Fe,t-Ie);return Math.min(Math.max(e,Fe),n)}function qe({relPath:e,onFilterJob:t,onSummaryActionChange:r,onCopyPathActionChange:i}){let{t:a}=y(`code`),{activeProjectId:u}=o(),{openTicketDetail:d}=C(),{registerHandler:f,unregisterHandler:p}=v(),m=l({allowMove:!1}),h=(0,F.useRef)(null),[g,_]=(0,F.useState)(null),[x,S]=(0,F.useState)(!0),[T,E]=(0,F.useState)(!1),[D,O]=(0,F.useState)(!1),[k,A]=(0,F.useState)(()=>He(u)),[j,M]=(0,F.useState)(()=>Be(u)),[N,P]=(0,F.useState)(()=>We(u)),I=(0,F.useRef)(u);(0,F.useEffect)(()=>{I.current=u},[u]);let L=(0,F.useRef)(e);(0,F.useEffect)(()=>{L.current=e},[e]),(0,F.useEffect)(()=>{let e=h.current?.clientHeight||window.innerHeight;A(He(u)),M(Ke(Be(u),e)),P(We(u))},[u]);let R=(0,F.useCallback)(e=>{let t=e.clientY,n=j,r=h.current?.clientHeight||window.innerHeight,i=e.currentTarget;try{i.setPointerCapture(e.pointerId)}catch{}function a(e){M(Ke(n+(t-e.clientY),r))}function o(){window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o),M(e=>{let t=Ke(e,r);return Ve(u,t),t})}window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,o)},[u,j]),ee=(0,F.useCallback)(()=>{let e=Ke(Pe,h.current?.clientHeight||window.innerHeight);M(e),Ve(u,e)},[u]),te=(0,F.useCallback)(()=>{A(e=>{let t=!e;return Ue(u,t),t})},[u]),ne=(0,F.useCallback)(()=>{P(e=>{let t=!e;return Ge(u,t),t})},[u]);(0,F.useEffect)(()=>{E(!1),O(!1),U(`preview`),W(!1)},[e]);let z=(0,F.useRef)(0),B=(0,F.useCallback)(async()=>{let t=++z.current;S(!0);try{let n=await fetch(`${w()}/code/file?path=${encodeURIComponent(e)}`);if(t!==z.current)return;if(!n.ok){_(null);return}let r=await n.json();if(t!==z.current)return;_(r)}catch{t===z.current&&_(null)}finally{t===z.current&&S(!1)}},[e,u]);(0,F.useEffect)(()=>{B()},[B]),(0,F.useEffect)(()=>{if(!u)return;let e=`code-file-${u}`;return f(e,e=>{let t=e;t.projectId===I.current&&(t.type===`file.summary_updated`&&t.path===L.current?(E(!1),B()):t.type===`file.summary_failed`&&t.path===L.current?(b.error(t.reason??a(`summary.generationFailed`)),E(!1)):t.type===`file.summary_skipped`&&t.path===L.current&&(t.reason&&b(a(`summary.skipped`,{reason:t.reason})),E(!1)))}),()=>p(e)},[u,f,p,B,a]);let V=(0,F.useCallback)(async t=>{E(!0);try{let n=await fetch(`${w()}/code/file/regenerate-summary?path=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({overrideBudget:t})}),r=await n.json().catch(()=>({}));if(!n.ok){E(!1);let e=typeof r.skipped==`string`?r.skipped:null;b.error(e?a(`summary.skipped`,{reason:e}):a(`summary.generationFailed`));return}if(r.skipped===`budget`){E(!1),O(!0);return}if(r.skipped){E(!1),b(a(`summary.skipped`,{reason:r.skipped}));return}await B(),E(!1)}catch{E(!1),b.error(a(`summary.generationFailed`))}},[B,e,a]),re=(0,F.useCallback)(async()=>{let t=g?.absolutePath??e;try{await navigator.clipboard?.writeText(t),b.success(a(`viewer.pathCopied`))}catch{b.error(a(`viewer.copyPathFailed`))}},[g,e,a]),ie=(0,F.useMemo)(()=>Ne(e,g?.language),[e,g?.language]),[H,U]=(0,F.useState)(`preview`),[ae,W]=(0,F.useState)(!1),[G,oe]=(0,F.useState)(``),[K,se]=(0,F.useState)(!1),ce=g?.content!==void 0&&!g.binary&&!g.tooLarge&&g.reason!==`not-found`,le=(0,F.useCallback)(()=>{oe(g?.content??``),U(`raw`),W(!0)},[g]),ue=(0,F.useCallback)(async()=>{se(!0);try{let t=await fetch(`${w()}/code/file`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e,content:G})});if(!t.ok){let e=await t.json().catch(()=>({}));b.error(e.error??a(`viewer.saveFailed`));return}b.success(a(`viewer.saved`)),W(!1),B()}catch{b.error(a(`viewer.saveFailed`))}finally{se(!1)}},[e,G,a,B]),q=g?.summary??null,de=!!g?.summaryStale,Y=g?.provenance??[],X=g?.reason===`not-found`,Z=X?a(`summary.reason.missing`):g?.binary?a(`summary.reason.binary`):g?.tooLarge?a(`summary.reason.tooLarge`):null;return(0,F.useEffect)(()=>{if(r){if(x&&!g){r(null);return}return r({hasSummary:!!q,regenerating:T,disabledReason:Z,onClick:()=>V(!1)}),()=>r(null)}},[g,V,x,r,T,q,Z]),(0,F.useEffect)(()=>{if(i){if(x&&!g){i(null);return}return i({onClick:re}),()=>i(null)}},[re,g,x,i]),x&&!g?(0,J.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted-foreground animate-pulse`,children:a(`viewer.loadingFile`)}):(0,J.jsxs)(`div`,{ref:h,className:`flex flex-col h-full`,"data-testid":`file-viewer`,children:[k?(0,J.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center justify-between border-b border-border bg-surface px-4`,"data-testid":`summary-header-collapsed`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e}),(0,J.jsxs)(`button`,{type:`button`,onClick:te,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,J.jsx)(c,{className:`h-3.5 w-3.5`}),a(`viewer.showSummary`)]})]}):(0,J.jsx)(je,{path:e,summary:q,stale:de,regenerating:T,generateDisabledReason:Z,onCollapse:te}),(0,J.jsxs)(`div`,{className:`px-4 py-1 border-b border-border flex items-center justify-between gap-3`,children:[(0,J.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:ie&&g?.content!==void 0&&!g.binary&&!g.tooLarge&&(0,J.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px]`,role:`group`,"aria-label":a(`viewer.markdownViewMode`),children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>U(`preview`),"aria-pressed":H===`preview`,className:H===`preview`?`px-2 py-1 rounded-md bg-accent-primary/20 text-accent-primary`:`px-2 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50`,children:a(`viewer.preview`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>U(`raw`),"aria-pressed":H===`raw`,className:H===`raw`?`px-2 py-1 rounded-md bg-accent-primary/20 text-accent-primary`:`px-2 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50`,children:a(`viewer.raw`)})]})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 text-[11px] shrink-0`,children:[ce&&!ae&&(0,J.jsx)(`button`,{type:`button`,onClick:le,className:`px-2 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50`,children:a(`viewer.edit`)}),ae&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>W(!1),disabled:K,className:`px-2 py-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50 disabled:opacity-50`,children:a(`actions.cancel`,{ns:`common`})}),(0,J.jsx)(`button`,{type:`button`,onClick:ue,disabled:K,className:`px-2 py-1 rounded-md bg-accent-primary/20 text-accent-primary hover:bg-accent-primary/30 disabled:opacity-50`,children:a(K?`viewer.saving`:`viewer.save`)})]})]})]}),(0,J.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:X?(0,J.jsx)(`div`,{className:`h-full flex items-center justify-center text-sm text-muted-foreground`,"data-testid":`file-missing`,children:a(`viewer.missingFile`)}):g?.binary?(0,J.jsx)(`div`,{className:`h-full flex items-center justify-center text-sm text-muted-foreground`,"data-testid":`file-binary`,children:a(`viewer.binaryFile`)}):g?.tooLarge?(0,J.jsx)(`div`,{className:`h-full flex items-center justify-center text-sm text-muted-foreground`,"data-testid":`file-too-large`,children:a(`viewer.tooLarge`,{size:Math.round((g.sizeBytes??0)/1024/1024)})}):g?.content===void 0?(0,J.jsx)(`div`,{className:`h-full flex items-center justify-center text-sm text-muted-foreground`,children:a(`viewer.noContent`)}):ae?(0,J.jsx)(ke,{content:G,language:g.language??`plaintext`,readOnly:!1,onChange:oe}):ie&&H===`preview`?(0,J.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4 prose prose-invert prose-sm max-w-none prose-p:my-2 prose-headings:mt-4 prose-headings:mb-2 prose-pre:bg-muted/40 prose-pre:rounded-md prose-code:before:content-none prose-code:after:content-none`,"data-testid":`markdown-preview`,children:(0,J.jsx)(Me,{content:g.content})}):(0,J.jsx)(ke,{content:g.content,language:g.language??`plaintext`})}),Y.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":a(`history.resize`),onPointerDown:N?void 0:R,onDoubleClick:N?void 0:ee,className:N?`flex h-8 shrink-0 items-center justify-between border-t border-border bg-card/35 px-4`:`flex h-8 shrink-0 cursor-row-resize items-center justify-between border-y border-border/40 bg-card/35 px-4 hover:bg-accent-primary/10`,title:N?void 0:a(`resizer.hint`),"data-testid":`code-history-resizer`,children:[(0,J.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground`,children:a(`history.title`,{count:Y.length})}),(0,J.jsxs)(`button`,{type:`button`,onPointerDown:e=>e.stopPropagation(),onClick:ne,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[N?(0,J.jsx)(n,{className:`h-3.5 w-3.5`}):(0,J.jsx)(c,{className:`h-3.5 w-3.5`}),a(N?`history.show`:`history.hide`)]})]}),!N&&(0,J.jsx)(Je,{rows:Y,onOpenTicket:d,onFilterJob:t,height:j})]}),D&&(0,J.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,role:`dialog`,"aria-modal":`true`,"data-testid":`budget-prompt`,onClick:m.guardBackdrop(()=>O(!1)),children:[(0,J.jsxs)(`div`,{ref:m.panelRef,onClick:e=>e.stopPropagation(),className:`bg-card border border-border rounded-lg p-4 w-80 flex flex-col gap-3`,style:m.panelStyle,children:[(0,J.jsx)(`p`,{className:`text-sm text-foreground`,children:a(`viewer.budgetPrompt`)}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>O(!1),className:`text-xs px-3 py-1.5 rounded-md text-muted-foreground hover:text-foreground`,children:a(`common:actions.cancel`)}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>{O(!1),V(!0)},className:`text-xs px-3 py-1.5 rounded-md bg-accent-primary text-white`,children:a(`common:actions.confirm`)})]})]}),(0,J.jsx)(s,{handles:m.resizeHandles})]})]})}function Je({rows:e,onOpenTicket:t,onFilterJob:n,height:r}){let{t:i}=y(`code`),[a,o]=(0,F.useState)(null),[s,c]=(0,F.useState)({});if(e.length===0)return null;async function l(e,t){if(a===t){o(null);return}if(o(t),!(!e.jobId||s[t])){c(e=>({...e,[t]:`loading`}));try{let n=new URLSearchParams({jobId:e.jobId,path:e.path}),r=await fetch(`${w()}/code/diff?${n.toString()}`);if(r.status===404){c(e=>({...e,[t]:`missing`}));return}if(!r.ok)throw Error(`diff failed`);let i=await r.json();c(e=>({...e,[t]:{patch:i.patch??``,truncated:i.truncated===!0}}))}catch{c(e=>({...e,[t]:`missing`}))}}}return(0,J.jsx)(`div`,{className:`shrink-0 border-t border-border bg-card/40 px-4 py-3 overflow-hidden`,style:{height:r},"data-testid":`file-provenance-timeline`,children:(0,J.jsx)(`div`,{className:`h-full overflow-auto space-y-1`,children:e.map((e,r)=>{let o=e.kind===`created`?_:e.kind===`deleted`?k:j,c=e.jobId?e.jobId.length>12?e.jobId.slice(0,12):e.jobId:i(`history.unknownJob`),u=`${e.jobId??`job`}:${e.path}:${e.at}:${r}`,d=s[u];return(0,J.jsxs)(`div`,{className:`rounded-md hover:bg-muted/40`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-[minmax(72px,auto)_minmax(0,1fr)_auto] items-center gap-2 text-xs px-2 py-1.5`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 min-w-0`,children:[(0,J.jsx)(o,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,J.jsx)(`span`,{className:`capitalize`,children:i(`kind.${e.kind}`)})]}),(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 min-w-0 text-muted-foreground`,children:[(0,J.jsx)(x,{className:`h-3.5 w-3.5 shrink-0`}),e.jobId&&n?(0,J.jsx)(`button`,{type:`button`,onClick:()=>n(e.jobId),className:`font-mono truncate hover:text-foreground`,title:i(`history.filterByJob`,{jobId:e.jobId}),children:c}):(0,J.jsx)(`span`,{className:`font-mono truncate`,title:e.jobId??void 0,children:c}),e.jobId&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>l(e,u),className:`shrink-0 rounded bg-muted/60 px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground`,children:i(`history.diff`)}),typeof e.ticketId==`number`&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>t(e.ticketId),className:`shrink-0 rounded bg-accent-primary/15 px-1.5 py-0.5 text-[10px] text-accent-primary hover:bg-accent-primary/25`,title:i(`history.openSpec`,{ticketId:e.ticketId}),children:i(`history.specChip`,{ticketId:e.ticketId})})]}),(0,J.jsx)(`time`,{className:`text-[11px] text-muted-foreground`,dateTime:new Date(e.at).toISOString(),children:new Date(e.at).toLocaleString()})]}),a===u&&(0,J.jsx)(`div`,{className:`px-2 pb-2`,children:d===`loading`?(0,J.jsx)(`div`,{className:`rounded-md bg-muted/35 px-2 py-2 text-[11px] text-muted-foreground`,children:i(`history.loadingDiff`)}):d===`missing`||!d?(0,J.jsx)(`div`,{className:`rounded-md bg-muted/35 px-2 py-2 text-[11px] text-muted-foreground`,children:i(`history.diffUnavailable`)}):(0,J.jsxs)(`pre`,{className:`max-h-72 overflow-auto rounded-md bg-muted/50 px-2 py-2 font-mono text-[11px] leading-relaxed text-foreground/85`,children:[d.patch,d.truncated?`\n${i(`history.diffTruncated`)}`:``]})})]},u)})})})}var Ye=320,Xe=240,Ze=520;function Qe(e){return e?`specrails-desktop:code-tree-width:${e}`:null}function $e(e){let t=Qe(e);if(!t)return Ye;try{let e=localStorage.getItem(t),n=e?Number(e):NaN;return Number.isFinite(n)&&n>0?n:Ye}catch{return Ye}}function et(e,t){let n=Qe(e);if(n)try{localStorage.setItem(n,String(Math.round(t)))}catch{}}function $(e,t){let n=Math.max(Xe,t-Ze);return Math.min(Math.max(e,Xe),n)}function tt(){let{t:e}=y(`code`),{activeProjectId:t}=o(),[n]=u(),r=g(),i=(0,F.useRef)(null),[a,s]=(0,F.useState)(n.get(`path`)),[c,l]=(0,F.useState)(null),[d,f]=(0,F.useState)(null),[p,m]=(0,F.useState)(()=>$e(t)),h=n.get(`jobId`),_=(0,F.useMemo)(()=>{let e=n.get(`ticketId`);if(!e)return null;let t=Number(e);return Number.isInteger(t)&&t>0?t:null},[n]),[v,b]=(0,F.useState)(_==null?``:String(_));(0,F.useEffect)(()=>{let e=n.get(`path`);e!==a&&s(e)},[n]),(0,F.useEffect)(()=>{b(_==null?``:String(_))},[_]),(0,F.useEffect)(()=>{let e=i.current?.clientWidth||window.innerWidth;m($($e(t),e))},[t]),(0,F.useEffect)(()=>{let e=i.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect.width;typeof t==`number`&&m(e=>$(e,t))});return t.observe(e),()=>t.disconnect()},[]);let x=(0,F.useCallback)(e=>{let n=e.clientX,r=p,a=i.current?.clientWidth||window.innerWidth,o=e.currentTarget;try{o.setPointerCapture(e.pointerId)}catch{}function s(e){m($(r+(e.clientX-n),a))}function c(){window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),m(e=>{let n=$(e,a);return et(t,n),n})}window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[t,p]),S=(0,F.useCallback)(()=>{let e=$(Ye,i.current?.clientWidth||window.innerWidth);m(e),et(t,e)},[t]),C=(0,F.useCallback)(e=>{s(e);let t=new URLSearchParams(n);t.set(`path`,e),r({pathname:`/code`,search:`?${t.toString()}`},{replace:!0})},[r,n]),w=(0,F.useCallback)(e=>{let t=new URLSearchParams(n);t.set(`jobId`,e),t.delete(`ticketId`),r({pathname:`/code`,search:`?${t.toString()}`},{replace:!0})},[r,n]),T=(0,F.useCallback)(()=>{let e=new URLSearchParams(n);e.delete(`jobId`),e.delete(`ticketId`),r({pathname:`/code`,search:e.toString()?`?${e.toString()}`:``},{replace:!0})},[r,n]),E=(0,F.useCallback)(e=>{let t=Number(e.trim());if(!Number.isInteger(t)||t<=0){T();return}let i=new URLSearchParams(n);i.set(`ticketId`,String(t)),i.delete(`jobId`),r({pathname:`/code`,search:`?${i.toString()}`},{replace:!0})},[T,r,n]);return(0,J.jsxs)(`div`,{ref:i,className:`flex h-full w-full`,"data-testid":`code-page`,children:[(0,J.jsx)(`aside`,{className:`overflow-hidden flex flex-col shrink-0`,style:{width:p},children:(0,J.jsx)(ge,{onOpenFile:C,selectedPath:a,filterJobId:h,filterTicketId:_},t??`no-project`)}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":e(`page.resizeFileTree`),onPointerDown:x,onDoubleClick:S,className:`relative w-1.5 shrink-0 cursor-col-resize select-none touch-none border-x border-border/40 hover:bg-accent-primary/20 focus-visible:outline-none focus-visible:bg-accent-primary/30`,title:e(`resizer.hint`),"data-testid":`code-tree-resizer`}),(0,J.jsxs)(`main`,{className:`flex-1 overflow-hidden flex flex-col`,children:[(0,J.jsx)(nt,{jobId:h,ticketId:_,ticketInput:v,onTicketInputChange:b,onApplyTicket:E,onClear:T,summaryAction:c,copyPathAction:d}),(h||_)&&(0,J.jsx)(rt,{jobId:h,ticketId:_,onOpenFile:C}),a?(0,J.jsx)(qe,{relPath:a,onFilterJob:w,onSummaryActionChange:l,onCopyPathActionChange:f}):(0,J.jsx)(`div`,{className:`h-full flex items-center justify-center text-sm text-muted-foreground`,children:e(`page.selectFile`)})]})]})}function nt({jobId:e,ticketId:t,ticketInput:n,onTicketInputChange:r,onApplyTicket:i,onClear:o,summaryAction:s,copyPathAction:c}){let{t:l}=y(`code`),u=t?`spec`:e?`job-context`:`all`;return(0,J.jsx)(`div`,{className:`border-b border-border bg-background/80 px-4 py-2`,"data-testid":`code-provenance-toolbar`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[(0,J.jsx)(P,{className:`h-3.5 w-3.5`}),l(`toolbar.scope`)]}),(0,J.jsx)(`button`,{type:`button`,onClick:o,"aria-pressed":u===`all`,className:u===`all`?`rounded-md bg-accent-primary/20 px-2 py-1 text-xs text-accent-primary`:`rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:l(`toolbar.allAi`)}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border/70 bg-card/40 px-1 py-1`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>i(n),"aria-pressed":u===`spec`,className:u===`spec`?`rounded bg-accent-success/20 px-2 py-0.5 text-xs text-accent-success`:`rounded px-2 py-0.5 text-xs text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:l(`toolbar.spec`)}),(0,J.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i(n)},placeholder:l(`toolbar.ticketIdPlaceholder`),inputMode:`numeric`,className:`h-6 w-20 bg-transparent px-1 font-mono text-xs outline-none placeholder:text-muted-foreground/60`})]}),(0,J.jsx)(`div`,{className:`flex-1`}),c&&(0,J.jsx)(`button`,{type:`button`,onClick:c.onClick,className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:l(`toolbar.copyFilePath`)}),s&&(0,J.jsxs)(`button`,{type:`button`,onClick:s.onClick,disabled:s.regenerating||!!s.disabledReason,"aria-label":s.hasSummary?l(`toolbar.regenerateSummary`):l(`toolbar.generateSummary`),className:`inline-flex items-center gap-1.5 rounded-md bg-accent-primary/15 px-2.5 py-1 text-xs text-accent-primary hover:bg-accent-primary/25 disabled:opacity-50`,title:s.disabledReason?l(`toolbar.summaryUnavailable`,{reason:s.disabledReason}):void 0,children:[(0,J.jsx)(T,{className:s.regenerating?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),s.hasSummary?s.regenerating?l(`toolbar.regenerating`):l(`toolbar.regenerateSummary`):s.regenerating?l(`toolbar.generating`):l(`toolbar.generateSummary`)]}),u===`job-context`&&(0,J.jsx)(`span`,{className:`rounded-md bg-accent-info/15 px-2 py-1 text-xs text-accent-info`,children:l(`toolbar.jobContext`)}),(e||t)&&(0,J.jsxs)(`button`,{type:`button`,onClick:o,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,J.jsx)(a,{className:`h-3.5 w-3.5`}),l(`toolbar.clear`)]})]})})}function rt({jobId:e,ticketId:t,onOpenFile:n}){let{t:r}=y(`code`),[i,a]=(0,F.useState)(null);(0,F.useEffect)(()=>{let n=!1,r=new URLSearchParams;return e&&r.set(`jobId`,e),t&&r.set(`ticketId`,String(t)),fetch(`${w()}/code/provenance?${r.toString()}`).then(e=>e.ok?e.json():[]).then(e=>{n||a(Array.isArray(e)?e:[])}).catch(()=>{n||a([])}),()=>{n=!0}},[e,t]);let o=(0,F.useMemo)(()=>{let e=i??[];return{created:e.filter(e=>e.kind===`created`),modified:e.filter(e=>e.kind===`modified`),deleted:e.filter(e=>e.kind===`deleted`)}},[i]),s=i?.length??0;return(0,J.jsx)(`section`,{className:`border-b border-border bg-card/35 px-4 py-3`,"data-testid":`provenance-result-panel`,children:(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold truncate`,children:e?r(`provenancePanel.jobTitle`,{jobId:e}):r(`provenancePanel.specTitle`,{ticketId:t})}),(0,J.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:r(`provenancePanel.touchedFiles`,{count:s})})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,J.jsx)(it,{label:r(`action.added`),rows:o.created,icon:`created`,onOpenFile:n}),(0,J.jsx)(it,{label:r(`action.changed`),rows:o.modified,icon:`modified`,onOpenFile:n}),(0,J.jsx)(it,{label:r(`action.deleted`),rows:o.deleted,icon:`deleted`,onOpenFile:n})]})]}),(0,J.jsx)(`div`,{className:`flex items-center gap-1 shrink-0`,children:e&&(0,J.jsxs)(`a`,{href:`/jobs/${encodeURIComponent(e)}`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,J.jsx)(d,{className:`h-3.5 w-3.5`}),r(`provenancePanel.log`)]})})]})})}function it({label:e,rows:t,icon:n,onOpenFile:r}){return(0,J.jsxs)(`details`,{className:`group min-w-[180px] max-w-[320px]`,children:[(0,J.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-1.5 rounded-md bg-muted/35 px-2 py-1 text-xs hover:bg-muted/55`,children:[(0,J.jsx)(n===`created`?_:n===`deleted`?k:j,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,J.jsx)(`span`,{children:e}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:t.length})]}),t.length>0&&(0,J.jsx)(`div`,{className:`mt-1 max-h-28 overflow-auto rounded-md border border-border/60 bg-background/60 p-1`,children:t.map((e,t)=>(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(e.path),className:`block w-full truncate rounded px-1.5 py-1 text-left font-mono text-[11px] text-muted-foreground hover:bg-muted/50 hover:text-foreground`,title:e.path,children:e.path},`${e.path}-${e.jobId??`job`}-${e.at}-${t}`))})]})}export{tt as default};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{At as t,Bt as n,Ct as r,Dt as i,E as a,Et as o,Gt as s,H as c,Ht as l,Mt as u,O as d,Ot as f,T as p,U as m,V as h,Wt as g,bn as ee,en as _,et as v,f as y,ft as b,gn as x,hn as S,it as te,jt as C,l as w,nn as T,o as E,p as D,tn as O,tt as k,u as ne,v as A,wn as j,wt as M,xn as re,y as N,yn as P}from"./index-meTWPBzY.js";import{t as F}from"./lib-qdRfWwE1.js";import{t as ie}from"./format-command-CMsBTOPN.js";var I=n(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),L=n(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),R=e(j(),1),z=O();function ae({phases:e,phaseDefinitions:t}){return t.length===0?null:(0,z.jsx)(`div`,{className:`flex items-center`,children:t.map((n,r)=>{let i=e[n.key]??`idle`,o=r<t.length-1?e[t[r+1].key]??`idle`:null;return(0,z.jsxs)(`div`,{className:`flex items-center`,children:[(0,z.jsxs)(p,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 cursor-default px-4`,children:[(0,z.jsx)(oe,{state:i}),(0,z.jsx)(`span`,{className:m(`text-xs font-medium transition-colors`,i===`running`?`text-blue-400 aurora-light:text-accent-info`:i===`done`?`text-emerald-400 aurora-light:text-accent-success`:i===`error`?`text-red-400 aurora-light:text-destructive`:`text-muted-foreground/40`),children:n.label})]})}),(0,z.jsxs)(a,{side:`bottom`,className:`max-w-[200px]`,children:[(0,z.jsx)(`p`,{className:`font-medium`,children:n.label}),(0,z.jsx)(`p`,{className:`text-muted-foreground mt-0.5`,children:n.description})]})]}),o!==null&&(0,z.jsx)(`div`,{className:m(`h-px w-12 -mt-5 shrink-0 transition-all duration-300`,o===`done`||i===`done`?`bg-emerald-500/30 aurora-light:bg-accent-success/40`:o===`running`?`bg-blue-400/40 aurora-light:bg-accent-info/40`:`bg-border/30`)})]},n.key)})})}function oe({state:e}){return(0,z.jsxs)(`div`,{className:m(`flex items-center justify-center w-10 h-10 rounded-full transition-all duration-300`,e===`running`?`bg-blue-500/10 aurora-light:bg-accent-info/10 ring-1 ring-blue-400/30 aurora-light:ring-accent-info/30 animate-pulse`:e===`done`?`bg-emerald-500/10 aurora-light:bg-accent-success/10`:e===`error`?`bg-red-500/10 aurora-light:bg-destructive/10`:`bg-muted/20`),children:[e===`running`&&(0,z.jsx)(b,{className:`w-6 h-6 text-blue-400 aurora-light:text-accent-info animate-spin`}),e===`done`&&(0,z.jsx)(f,{className:`w-6 h-6 text-emerald-400 aurora-light:text-accent-success`}),e===`error`&&(0,z.jsx)(i,{className:`w-6 h-6 text-red-400 aurora-light:text-destructive`}),e===`idle`&&(0,z.jsx)(o,{className:`w-6 h-6 text-muted-foreground/20`})]})}function B(e,t){let n=(typeof t==`number`?t:new Date(t).getTime())-new Date(e).getTime();if(!Number.isFinite(n)||n<0)return`—`;let r=Math.round(n/1e3);if(r<60)return`${r}s`;let i=Math.floor(r/60),a=r%60;return i<60?`${i}m ${a}s`:`${Math.floor(i/60)}h ${i%60}m`}function V(e){let t=new Set;for(let n of e)if(n.event_type===`log`)try{let e=(JSON.parse(n.payload).line??``).match(/(?:Writing|Editing|Created?|Updated?)\s+(?:file:\s*)?([\w./\-]+\.\w+)/i);e&&t.add(e[1])}catch{}return Array.from(t).slice(0,20)}var H={steps:0,actionKey:``,actionArg:``,lastSeenIdx:0};function se(e,t){if(t.type===`reset`)return H;if(t.type===`consume`){let{events:n}=t,r=e.lastSeenIdx>n.length?n.length:e.lastSeenIdx;if(n.length<=r)return r===e.lastSeenIdx?e:{...e,lastSeenIdx:r};let{steps:i,actionKey:a,actionArg:o}=e;for(let e=r;e<n.length;e++){let t=D(n[e]);t.step&&(i+=t.stepCount??1),t.actionKey&&(a=t.actionKey,o=t.actionArg??``)}return{steps:i,actionKey:a,actionArg:o,lastSeenIdx:n.length}}return e}function ce({job:e,events:t,defaultOpen:n=!0,pipelineTotals:r,phases:a,phaseDefinitions:o}){let{t:s}=x(`jobs`),[c,l]=(0,R.useState)(n),d=(0,R.useMemo)(()=>V(t),[t]),p=e.status===`running`,h=e.status===`completed`,[g,ee]=(0,R.useState)(()=>Date.now());(0,R.useEffect)(()=>{if(!p)return;let e=window.setInterval(()=>ee(Date.now()),1e3);return()=>window.clearInterval(e)},[p]);let[_,v]=(0,R.useReducer)(se,H),S=(0,R.useRef)(e.id);(0,R.useEffect)(()=>{S.current!==e.id&&(S.current=e.id,v({type:`reset`})),v({type:`consume`,events:t})},[e.id,t]);let[te,C]=(0,R.useState)(!0);(0,R.useEffect)(()=>{if(!p)return;C(!0);let e=window.setTimeout(()=>C(!1),8e3);return()=>window.clearTimeout(e)},[p,e.id]);let w=e.finished_at?B(e.started_at,e.finished_at):p?B(e.started_at,g):`—`,T=!!e.total_cost_usd_estimated,E=e.total_cost_usd==null?null:`${T?`~`:``}$${e.total_cost_usd.toFixed(4)}`,D=e.num_turns==null?null:String(e.num_turns),O=e.tokens_in==null?null:(e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0),k=O==null?null:`${(O/1e3).toFixed(1)}k`,ne=(0,R.useMemo)(()=>!a||!o?null:o.find(e=>a[e.key]===`running`)?.label??null,[a,o]),A=p&&_.steps===0?`connecting`:_.actionKey||`thinking`,j=y.has(A)&&_.actionArg!==``,M=y.has(A)&&!j?`working`:A,re=j?s(`statusPanel.activity.${M}`,{arg:_.actionArg}):s(`statusPanel.activity.${M}`),N=ne??(p&&_.steps===0?s(`statusPanel.activity.starting`):null),P=_.steps>0?s(`statusPanel.steps`,{count:_.steps}):null,F=s(p?`statusPanel.inProgress`:h?`statusPanel.completed`:`statusPanel.failed`),ie=p?`border-accent-info/20 bg-accent-info/5`:h?`border-emerald-500/20 aurora-light:border-accent-success/30 bg-emerald-500/5 aurora-light:bg-accent-success/5`:`border-red-500/20 aurora-light:border-destructive/30 bg-red-500/5 aurora-light:bg-destructive/5`,I=p?b:h?f:i,L=p?`w-4 h-4 text-accent-info shrink-0 animate-spin`:h?`w-4 h-4 text-emerald-400 aurora-light:text-accent-success shrink-0`:`w-4 h-4 text-red-400 aurora-light:text-destructive shrink-0`;return(0,z.jsxs)(`div`,{className:m(`mx-4 my-2 rounded-xl border transition-colors duration-500`,ie),children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>l(!c),className:`w-full flex items-center gap-3 px-4 py-3`,children:[(0,z.jsx)(I,{className:L,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`text-sm font-semibold flex-1 text-left`,children:F}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,z.jsx)(`span`,{className:`tabular-nums`,children:w}),p?P&&(0,z.jsx)(`span`,{className:`tabular-nums`,children:P}):(0,z.jsxs)(z.Fragment,{children:[E&&(0,z.jsx)(`span`,{className:`tabular-nums text-yellow-400 aurora-light:text-accent-warning`,children:E}),d.length>0&&(0,z.jsx)(`span`,{children:s(`statusPanel.filesCount`,{count:d.length})})]})]}),(0,z.jsx)(u,{className:m(`w-4 h-4 text-muted-foreground/40 transition-transform duration-150 shrink-0`,c&&`rotate-180`)})]}),c&&(0,z.jsx)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/20`,children:p?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`pt-3 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:s(`statusPanel.zoneInProgress`)}),(0,z.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3 sm:items-stretch`,children:[(0,z.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2 sm:w-44 shrink-0`,children:[(0,z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:[s(`statusPanel.duration`),(0,z.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-accent-info animate-pulse`,title:s(`statusPanel.liveTooltip`),"aria-label":s(`statusPanel.liveTooltip`)})]}),(0,z.jsx)(`p`,{className:`text-sm font-semibold tabular-nums mt-0.5 text-accent-info`,children:w})]}),(0,z.jsxs)(`div`,{className:`flex-1 flex items-center gap-2 bg-muted/10 rounded-lg px-3 py-2 min-w-0`,children:[(0,z.jsx)(b,{className:`w-3.5 h-3.5 text-accent-info shrink-0 animate-spin`,"aria-hidden":`true`}),N&&(0,z.jsx)(`span`,{className:`text-[11px] font-medium px-1.5 py-0.5 rounded bg-accent-info/15 text-accent-info shrink-0`,children:N}),(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground truncate flex-1 min-w-0`,children:re}),P&&(0,z.jsxs)(`span`,{className:`text-[11px] text-muted-foreground/60 tabular-nums shrink-0`,children:[`· `,P]})]})]}),te&&(0,z.jsx)(`p`,{className:`text-[11px] text-muted-foreground/40 leading-snug`,children:s(`statusPanel.explainer`)}),(0,z.jsx)(`p`,{className:`pt-1 text-[10px] text-muted-foreground/50 uppercase tracking-wider border-t border-accent-info/10 mt-1`,children:s(`statusPanel.zoneFinalPending`)}),(0,z.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,z.jsx)(G,{label:s(`statusPanel.cost`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.costTooltip`)}),(0,z.jsx)(G,{label:s(`statusPanel.turns`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.pendingTooltip`)}),(0,z.jsx)(G,{label:s(`statusPanel.tokens`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.pendingTooltip`)})]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`pt-3 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:s(`statusPanel.zoneFinal`)}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:[(0,z.jsx)(U,{label:s(`statusPanel.duration`),value:w}),(0,z.jsx)(W,{label:s(`statusPanel.cost`),value:E,valueClass:`text-yellow-400 aurora-light:text-accent-warning`,naCaption:s(`statusPanel.notAvailable`)}),(0,z.jsx)(W,{label:s(`statusPanel.turns`),value:D,naCaption:s(`statusPanel.notAvailable`)}),(0,z.jsx)(W,{label:s(`statusPanel.tokens`),value:k,naCaption:s(`statusPanel.notAvailable`)})]}),r&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:s(`statusPanel.pipelineTotal`,{count:r.jobCount})}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,z.jsx)(U,{label:s(`statusPanel.totalCost`),value:`$${r.totalCostUsd.toFixed(4)}`,valueClass:`text-yellow-400 aurora-light:text-accent-warning`}),(0,z.jsx)(U,{label:s(`statusPanel.totalTokens`),value:`${((r.totalTokensIn+r.totalTokensOut+r.totalTokensCacheRead+r.totalTokensCacheCreate)/1e3).toFixed(1)}k`})]})]}),d.length>0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:s(`statusPanel.filesModified`)}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d.map(e=>(0,z.jsx)(`code`,{className:`text-[10px] font-mono bg-muted/30 px-2 py-0.5 rounded text-cyan-400/80 aurora-light:text-accent-info`,children:e},e))})]})]})})]})}function U({label:e,value:t,valueClass:n}){return(0,z.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2`,children:[(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,z.jsx)(`p`,{className:m(`text-sm font-semibold tabular-nums mt-0.5`,n),children:t})]})}function W({label:e,value:t,valueClass:n,naCaption:r}){return(0,z.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2`,children:[(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,z.jsx)(`p`,{className:m(`text-sm font-semibold tabular-nums mt-0.5`,t==null?`text-muted-foreground`:n),children:t??`—`}),t==null&&(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/30 mt-0.5`,children:r})]})}function G({label:e,caption:t,tooltip:n}){return(0,z.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2 ring-1 ring-accent-info/10`,title:n,children:[(0,z.jsxs)(`p`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:[e,(0,z.jsx)(I,{className:`w-2.5 h-2.5 text-muted-foreground/30`,"aria-hidden":`true`})]}),(0,z.jsx)(`p`,{className:`text-sm font-semibold tabular-nums mt-0.5 text-muted-foreground/40`,children:`—`}),(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/30 mt-0.5`,children:t})]})}var K=4;function le({tickets:e,onTicketClick:n}){let{t:r}=x(`jobs`),[i,a]=(0,R.useState)(!1);if(e.length===0)return null;let o=e.length>=K&&!i?e.slice(0,1):e,s=e.length-o.length;return(0,z.jsxs)(`div`,{className:`rounded-xl border border-border/40 bg-card/40 px-4 py-3 space-y-1.5`,children:[o.map(e=>(0,z.jsx)(q,{ticket:e,onClick:()=>n(e.id)},e.id)),s>0&&(0,z.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[r(`ticketHeader.showMore`,{count:s}),(0,z.jsx)(u,{className:`w-3 h-3`})]}),i&&e.length>=K&&(0,z.jsxs)(`button`,{type:`button`,onClick:()=>a(!1),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[r(`ticketHeader.showLess`),(0,z.jsx)(t,{className:`w-3 h-3`})]})]})}function q({ticket:e,onClick:t}){let{t:n}=x(`jobs`),r=e.title==null,i=`inline-flex items-center px-1.5 py-0.5 rounded-md text-[11px] font-mono tabular-nums shrink-0`;return r?(0,z.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:(0,z.jsx)(`span`,{className:m(i,`text-muted-foreground bg-muted/20 select-none`),title:n(`ticketHeader.deletedTooltip`),children:n(`ticketHeader.deletedTicket`,{id:e.id})})}):(0,z.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-2 min-w-0 w-full text-left group`,title:e.title??void 0,children:[(0,z.jsxs)(`span`,{className:m(i,`text-accent-primary bg-accent-primary/10 group-hover:bg-accent-primary/20 transition-colors`),children:[`#`,e.id]}),(0,z.jsx)(`span`,{className:`text-lg font-semibold text-foreground truncate group-hover:text-accent-primary transition-colors`,children:e.title})]})}function J(e){let t=e.trimStart();return!!(/^#{1,6}\s/.test(t)||/^[-*+]\s/.test(t)||/^\d+\.\s/.test(t)||/^\|.+\|/.test(t)||t.startsWith("```")||t.startsWith(`> `)||/\*\*[^*]+\*\*/.test(e)||/`[^`]+`/.test(e)||/\[.+\]\(.+\)/.test(e)||/^(-{3,}|_{3,}|\*{3,})$/.test(t)||/^- \[[ x]\]\s/.test(t))}function ue(e,t){let n=`${e.id??t}`,r=e.timestamp;if(e.event_type===`log`)try{let t=JSON.parse(e.payload).line??``;return t.trim()?t.startsWith(`▸`)||t.match(/^(architect|developer|reviewer|ship|analyst)\s*:/i)?{id:n,content:t,type:`phase`,timestamp:r}:e.source===`stderr`?{id:n,content:t,type:`stderr`,timestamp:r}:J(t)?{id:n,content:t,type:`assistant`,timestamp:r}:{id:n,content:t,type:`plain`,timestamp:r}:null}catch{return null}if(e.event_type!==`log`&&e.event_type!==`result`)return null;if(e.event_type===`result`)try{let t=JSON.parse(e.payload),i=[];return t.duration_ms&&i.push(`${(t.duration_ms/1e3).toFixed(1)}s`),t.total_cost_usd&&i.push(`$${t.total_cost_usd.toFixed(4)}`),t.num_turns&&i.push(s.t(`jobs:logViewer.turns`,{count:t.num_turns})),{id:n,content:`▸ ${s.t(`jobs:logViewer.completed`)}${i.length?` — ${i.join(` · `)}`:``}`,type:`result`,timestamp:r}}catch{return null}return null}function de(e){let t=`none`,n=[];for(let r of e){let e=r.type;if(e!==`plain`&&e!==`log`){t=`none`,n.push(r);continue}let i=r.content;i.startsWith(`--- `)?(t=`saw_minus`,n.push({...r,type:`diff-meta`})):t===`saw_minus`&&i.startsWith(`+++ `)?(t=`active`,n.push({...r,type:`diff-meta`})):t===`active`&&i.startsWith(`@@ `)?n.push({...r,type:`diff-hunk`}):t===`active`&&i.startsWith(`+`)&&!i.startsWith(`+++`)?n.push({...r,type:`diff-add`}):t===`active`&&i.startsWith(`-`)&&!i.startsWith(`---`)?n.push({...r,type:`diff-remove`}):(t===`active`&&(i.startsWith(` `)||i===``)||(t=`none`),n.push(r))}return n}function Y(e){let t=[{key:`__preamble__`,header:null,lines:[]}];for(let n of e)n.type===`phase`?t.push({key:n.id,header:n,lines:[]}):t[t.length-1].lines.push(n);return t.filter(e=>e.header!==null||e.lines.length>0)}function fe({events:e,isLoading:t}){let{t:n,i18n:r}=x(`jobs`),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(!0),[l,d]=(0,R.useState)(new Set),f=(0,R.useRef)(null),p=(0,R.useRef)(null),{processedLines:m,groups:h,totalLines:g}=(0,R.useMemo)(()=>{let t=e.map((e,t)=>ue(e,t)).filter(e=>e!==null),n=[];for(let e of t){let t=n.length>0?n[n.length-1]:null;e.type===`assistant`&&t?.type===`assistant`?t.content+=`
|
|
2
|
-
`+e.content:n.push({...e})}let r=de(n);return{processedLines:r,groups:Y(r),totalLines:r.length}},[e,r.language]),ee=(0,R.useMemo)(()=>{if(!i)return g;let e=i.toLowerCase();return m.filter(t=>t.content.toLowerCase().includes(e)).length},[i,m,g]),_=(0,R.useCallback)(()=>{let e=p.current;e&&(e.scrollTop=e.scrollHeight)},[]);(0,R.useEffect)(()=>{o&&_()},[e.length,o,_]);function v(){let e=p.current;e&&s(e.scrollHeight-e.scrollTop-e.clientHeight<50)}function y(e){d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return t?(0,z.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`logViewer.loading`)})}):g===0?(0,z.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`logViewer.empty`)})}):(0,z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,z.jsxs)(`div`,{className:`px-4 py-2 border-b border-border flex items-center gap-2`,children:[(0,z.jsxs)(`div`,{className:`relative flex-1 max-w-xs`,children:[(0,z.jsx)(k,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,z.jsx)(E,{placeholder:n(`logViewer.filterPlaceholder`),value:i,onChange:e=>a(e.target.value),className:`pl-7 h-7`})]}),(0,z.jsx)(c,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:()=>{let e=m.map(e=>e.content).join(`
|
|
3
|
-
`);navigator.clipboard.writeText(e).then(()=>{S.success(n(`logViewer.copySuccess`))}).catch(()=>{S.error(n(`logViewer.copyFailed`))})},children:(0,z.jsx)(M,{className:`w-3.5 h-3.5`})}),(0,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:n(`logViewer.lineCount`,{filtered:ee,total:g})})]}),(0,z.jsxs)(`div`,{ref:p,className:`flex-1 overflow-y-auto p-2 text-xs relative`,onScroll:v,children:[h.map(e=>(0,z.jsx)(X,{group:e,filter:i,collapsed:l.has(e.key),onToggle:()=>y(e.key)},e.key)),(0,z.jsx)(`div`,{ref:f})]}),!o&&(0,z.jsxs)(c,{size:`sm`,variant:`secondary`,onClick:()=>{s(!0),_()},className:`absolute bottom-16 right-6 h-7 gap-1 shadow-lg`,children:[(0,z.jsx)(u,{className:`w-3 h-3`}),n(`logViewer.jumpToBottom`)]})]})}var X=(0,R.memo)(function({group:e,filter:t,collapsed:n,onToggle:r}){let{t:i}=x(`jobs`),a=t?e.lines.filter(e=>e.content.toLowerCase().includes(t.toLowerCase())):e.lines;if(e.header===null)return a.length===0?null:(0,z.jsx)(`div`,{children:a.map((e,t)=>(0,z.jsx)(Q,{line:e,even:t%2==0},e.id))});let o=e.header.content;return(0,z.jsxs)(`div`,{className:`mt-3 rounded-md overflow-hidden border border-border/20`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:r,className:m(`flex items-center gap-2 w-full text-left px-3 py-2`,`bg-primary/5 border-b border-primary/20`,`hover:bg-primary/10 transition-colors duration-150 cursor-pointer`),children:[(0,z.jsx)(C,{className:m(`w-3 h-3 text-primary/60 shrink-0 transition-transform duration-150`,!n&&`rotate-90`)}),(0,z.jsx)(`span`,{className:`flex-1 text-[12px] font-semibold text-foreground leading-none`,children:o}),e.header.timestamp&&(0,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 font-mono tabular-nums shrink-0`,children:new Date(e.header.timestamp).toLocaleTimeString(`en`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}),(0,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:i(`logViewer.phaseLines`,{count:e.lines.length})})]}),!n&&(0,z.jsx)(`div`,{className:`bg-muted/5`,children:a.length===0?(0,z.jsx)(`p`,{className:`px-4 py-2 text-[10px] text-muted-foreground/40 italic`,children:i(t?`logViewer.noMatchingLines`:`logViewer.noOutput`)}):a.map((e,t)=>(0,z.jsx)(Q,{line:e,even:t%2==0},e.id))})]})}),Z=[F],Q=(0,R.memo)(function({line:e,even:t}){let n=e.type===`assistant`,r=e.type===`diff-add`,i=e.type===`diff-remove`,a=e.type===`diff-meta`,o=e.type===`diff-hunk`;return(0,z.jsxs)(`div`,{className:m(`flex items-start gap-2 group px-2 py-0.5 rounded-sm`,!(r||i||a||o)&&(t?`bg-muted/20`:`bg-transparent`),e.type===`result`&&`bg-emerald-500/5 aurora-light:bg-accent-success/10 border-l-2 border-emerald-500/40 aurora-light:border-accent-success/40 mt-2 py-2`,r&&`bg-emerald-500/8 aurora-light:bg-accent-success/10 border-l-2 border-emerald-500/50 aurora-light:border-accent-success/50`,i&&`bg-red-500/8 aurora-light:bg-destructive/10 border-l-2 border-red-500/50 aurora-light:border-destructive/50`,a&&`bg-accent-primary/5 border-l-2 border-accent-primary/30`,o&&`bg-accent-info/5 border-l-2 border-accent-info/30`),children:[e.timestamp&&(0,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0 mt-0.5 w-[52px] font-mono tabular-nums`,children:new Date(e.timestamp).toLocaleTimeString(`en`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}),n?(0,z.jsx)(`div`,{className:`flex-1 min-w-0 prose prose-invert prose-xs max-w-none
|
|
4
|
-
prose-p:my-1 prose-p:leading-relaxed
|
|
5
|
-
prose-headings:mt-2 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold
|
|
6
|
-
prose-ul:my-1 prose-ol:my-1 prose-li:my-0
|
|
7
|
-
prose-code:text-cyan-300 prose-code:text-[11px] prose-code:bg-muted/40 prose-code:px-1 prose-code:py-0.5 prose-code:rounded
|
|
8
|
-
prose-pre:my-1 prose-pre:bg-muted/30 prose-pre:rounded-md prose-pre:p-2 prose-pre:text-[11px]
|
|
9
|
-
prose-strong:text-foreground prose-em:text-foreground/70
|
|
10
|
-
prose-a:text-blue-400 prose-a:no-underline hover:prose-a:underline
|
|
11
|
-
prose-table:my-2 prose-table:text-[11px]
|
|
12
|
-
prose-thead:border-border prose-thead:bg-muted/30
|
|
13
|
-
prose-th:px-3 prose-th:py-1.5 prose-th:text-left prose-th:font-semibold prose-th:text-foreground/90
|
|
14
|
-
prose-td:px-3 prose-td:py-1.5 prose-td:border-border
|
|
15
|
-
prose-tr:border-border
|
|
16
|
-
text-foreground/80`,children:(0,z.jsx)(N,{remarkPlugins:[A],rehypePlugins:Z,children:e.content})}):(0,z.jsx)(`span`,{className:m(`flex-1 break-all leading-relaxed whitespace-pre-wrap font-mono`,e.type===`tool-use`&&`text-cyan-400/80 aurora-light:text-accent-info text-[11px]`,e.type===`stderr`&&`text-orange-400 aurora-light:text-accent-warning`,e.type===`result`&&`text-emerald-400 aurora-light:text-accent-success font-medium`,e.type===`log`&&`text-foreground/60`,e.type===`plain`&&`text-foreground/70`,e.type===`tool-result`&&`text-muted-foreground/50`,r&&`text-emerald-400 aurora-light:text-accent-success`,i&&`text-red-400 aurora-light:text-destructive`,a&&`text-accent-primary/80`,o&&`text-accent-info/80`),children:e.content})]})}),pe={running:{variant:`running`,labelKey:`statusLabel.running`,tooltipKey:`statusTooltip.running`},completed:{variant:`success`,labelKey:`statusLabel.completed`,tooltipKey:`statusTooltip.completed`},failed:{variant:`failed`,labelKey:`statusLabel.failed`,tooltipKey:`statusTooltip.failed`},canceled:{variant:`canceled`,labelKey:`statusLabel.canceled`,tooltipKey:`statusTooltip.canceled`},queued:{variant:`queued`,labelKey:`statusLabel.queued`,tooltipKey:`statusTooltip.queued`}};function $(){let{t:e}=x(`jobs`),{id:t}=re(),{activeProjectId:n,projects:i}=l(),o=i.find(e=>e.id===n)?.provider,s=ee(),{openTicketDetail:u}=w(),[y,E]=(0,R.useState)(null),[D,O]=(0,R.useState)([]),[k,A]=(0,R.useState)([]),[j,M]=(0,R.useState)({}),[N,F]=(0,R.useState)([]),[I,oe]=(0,R.useState)(!0),[B,V]=(0,R.useState)(!1),[H,se]=(0,R.useState)(null),[U,W]=(0,R.useState)(!1),[G,K]=(0,R.useState)(``),[q,J]=(0,R.useState)(!1),[ue,de]=(0,R.useState)(!1);(0,R.useEffect)(()=>{if(!t)return;let e=new AbortController;E(null),O([]),A([]),M({}),oe(!0),V(!1);async function n(){try{let n=await fetch(`${T()}/jobs/${t}`,{signal:e.signal});if(n.status===404){V(!0);return}if(!n.ok)throw Error(`Failed to fetch job`);let r=await n.json();E(r.job),O(r.events)}catch(e){if(e.name===`AbortError`)return;V(!0)}finally{e.signal.aborted||oe(!1)}}return n(),()=>e.abort()},[t,n]),(0,R.useEffect)(()=>{if(!y?.pipeline_id){F([]);return}let e=y.pipeline_id;fetch(`${T()}/pipelines/${e}`).then(e=>e.ok?e.json():null).then(e=>{e?.jobs&&F(e.jobs)}).catch(()=>{})},[y?.pipeline_id,y?.status]);let Y=(0,R.useRef)(n);Y.current=n;let X=(0,R.useRef)([]),Z=(0,R.useRef)(null),Q=(0,R.useCallback)(()=>{Z.current=null;let e=X.current;e.length!==0&&(X.current=[],O(t=>{let n=[...t,...e];return n.length>1e4?n.slice(n.length-8e3):n}))},[]),$=(0,R.useCallback)(e=>{let t=X.current;t.push(e),t.length>1e4&&(X.current=t.slice(-8e3)),Z.current||=requestAnimationFrame(Q)},[Q]);(0,R.useEffect)(()=>()=>{Z.current&&cancelAnimationFrame(Z.current)},[]);let me=(0,R.useCallback)(e=>{let n=e;if(!(Y.current&&n.projectId&&n.projectId!==Y.current)){if(n.type===`init`){let e=n.phaseDefinitions??[];A(e);let t={};for(let r of e)t[r.key]=n.phases?.[r.key]??`idle`;M(t)}else if(n.type===`event`&&n.jobId===t)$({id:Date.now(),job_id:t??``,seq:n.seq??0,event_type:n.event_type,source:n.source,payload:n.payload,timestamp:n.timestamp});else if(n.type===`log`&&n.processId===t)$({id:Date.now(),job_id:t??``,seq:0,event_type:`log`,source:n.source,payload:JSON.stringify({line:n.line}),timestamp:n.timestamp});else if(n.type===`job.turn_user`&&n.jobId===t)W(!0);else if(n.type===`job.turn_done`&&n.jobId===t)se(n.totals),W(!1);else if(n.type===`job.finalized`&&n.jobId===t){W(!1),J(!1);let e=n.totals;e&&se(e),fetch(`${T()}/jobs/${t}`).then(e=>e.json()).then(e=>E(e.job)).catch(()=>{})}else if(n.type===`phase`){let e=n.phase,t=n.state;M(n=>({...n,[e]:t}))}else if(n.type===`queue`){let e=n.jobs?.find(e=>e.id===t);if(e){let n=e.status;E(e=>e&&{...e,status:n}),(n===`completed`||n===`failed`||n===`canceled`)&&fetch(`${T()}/jobs/${t}`).then(e=>e.json()).then(e=>E(e.job)).catch(()=>{})}}}},[t,$]),{registerHandler:he,unregisterHandler:ge}=_();(0,R.useEffect)(()=>(he(`job-detail-${t}`,me),()=>ge(`job-detail-${t}`)),[t,me,he,ge]),(0,R.useEffect)(()=>{if(!t||!y||y.status!==`running`||y.hasTelemetry)return;let e=setInterval(()=>{fetch(`${T()}/jobs/${t}`).then(e=>e.ok?e.json():null).then(e=>{e?.job?.hasTelemetry&&E(e=>e&&{...e,hasTelemetry:!0})}).catch(()=>{})},8e3);return()=>clearInterval(e)},[t,y?.status,y?.hasTelemetry]);async function _e(){if(t)try{let n=await fetch(`${T()}/jobs/${t}`,{method:`DELETE`});if(n.ok)(await n.json()).status===`deleted`?(S.success(e(`detail.toast.jobDeleted`)),s(`/jobs`)):S.success(e(`detail.toast.cancelSignalSent`),{description:e(`detail.toast.cancelSignalSentDescription`)});else{let t=await n.json();S.error(e(`detail.toast.failed`),{description:t.error})}}catch{S.error(e(`detail.toast.networkError`))}}async function ve(){if(!(!t||q)){J(!0);try{let n=await fetch(`${T()}/jobs/${t}/finalize`,{method:`POST`});if(n.ok)S.success(e(`detail.toast.finalizeScheduled`));else{let t=await n.json().catch(()=>({}));S.error(e(`detail.toast.finalizeFailed`),{description:t.error}),J(!1)}}catch{S.error(e(`detail.toast.networkError`)),J(!1)}}}async function ye(){let n=G.trim();if(!(!t||!n||ue)){de(!0);try{let r=await fetch(`${T()}/jobs/${t}/messages`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:n})});if(r.ok)K(``);else{let t=await r.json().catch(()=>({}));S.error(e(`detail.toast.sendFailed`),{description:t.error})}}catch{S.error(e(`detail.toast.networkError`))}finally{de(!1)}}}async function be(){if(y)try{let t=await fetch(`${T()}/jobs/${y.id}/diagnostic`);if(!t.ok){let n=await t.json().catch(()=>({}));throw Error(n.error??e(`detail.toast.exportFailedHttp`,{status:t.status}))}let n=await t.blob(),r=URL.createObjectURL(n),i=new Date().toISOString().slice(0,10),a=document.createElement(`a`);a.href=r,a.download=`specrails-diagnostic-${y.id}-${i}.zip`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(r)}catch(t){S.error(e(`detail.toast.exportFailed`),{description:t.message})}}async function xe(){if(y)try{let t=await fetch(`${T()}/spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({command:y.command})}),n=await t.json();if(!t.ok)throw Error(n.error??e(`detail.toast.spawnFailed`));S.success(e(`detail.toast.jobRequeued`)),s(`/jobs/${n.jobId}`)}catch(e){S.error(e.message)}}if(I)return(0,z.jsx)(`div`,{className:`max-w-5xl mx-auto px-4 py-6`,children:(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsx)(`div`,{className:`h-4 w-48 bg-muted/30 rounded animate-pulse`}),(0,z.jsx)(`div`,{className:`h-20 bg-muted/30 rounded-lg animate-pulse`}),(0,z.jsx)(`div`,{className:`h-64 bg-muted/30 rounded-lg animate-pulse`})]})});if(B||!y)return(0,z.jsxs)(`div`,{className:`max-w-5xl mx-auto px-4 py-6 flex flex-col items-center gap-3 mt-12`,children:[(0,z.jsx)(`p`,{className:`text-lg font-semibold`,children:e(`detail.notFound`)}),(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`detail.notFoundDescription`,{id:t})}),(0,z.jsx)(c,{asChild:!0,variant:`outline`,size:`sm`,children:(0,z.jsxs)(P,{to:`/`,children:[(0,z.jsx)(L,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.backToDashboard`)]})})]});let Se=pe[y.status]??pe.queued,Ce=y.status===`running`,we=y.status===`completed`||y.status===`failed`,Te=!!y.interactive,Ee=Te&&Ce,De=(y.tickets?.length??0)>0,Oe=N.length>1?{totalCostUsd:N.reduce((e,t)=>e+(t.total_cost_usd??0),0),totalTokensIn:N.reduce((e,t)=>e+(t.tokens_in??0),0),totalTokensOut:N.reduce((e,t)=>e+(t.tokens_out??0),0),totalTokensCacheRead:N.reduce((e,t)=>e+(t.tokens_cache_read??0),0),totalTokensCacheCreate:N.reduce((e,t)=>e+(t.tokens_cache_create??0),0),jobCount:N.length}:null;return(0,z.jsxs)(`div`,{"data-job-detail-surface":!0,className:`flex flex-col h-full max-w-5xl mx-auto w-full`,children:[(0,z.jsxs)(`div`,{className:`px-4 py-4 border-b border-border space-y-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,z.jsxs)(P,{to:`/`,className:`hover:text-foreground transition-colors flex items-center gap-1`,children:[(0,z.jsx)(L,{className:`w-3 h-3`}),e(`detail.breadcrumbDashboard`)]}),(0,z.jsx)(C,{className:`w-3 h-3`}),(0,z.jsx)(`span`,{className:`text-foreground font-mono`,children:e(`detail.breadcrumbJob`,{id:t?.slice(0,8)})})]}),De&&(0,z.jsx)(le,{tickets:y.tickets??[],onTicketClick:u}),(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`space-y-1 min-w-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,z.jsxs)(p,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsx)(`div`,{children:(0,z.jsx)(h,{variant:Se.variant,children:e(Se.labelKey)})})}),(0,z.jsx)(a,{children:e(Se.tooltipKey)})]}),(0,z.jsx)(`code`,{className:m(`font-mono text-foreground/90 truncate`,De?`text-xs text-muted-foreground`:`text-sm`),children:ie(y.command,o)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap`,children:[(0,z.jsx)(`span`,{children:y.started_at?e(`detail.startedAgo`,{timeAgo:ne(new Date(y.started_at),{addSuffix:!0,locale:g()})}):e(`detail.queuedWaiting`)}),y.model&&(0,z.jsx)(`span`,{className:`text-muted-foreground/40`,children:y.model})]})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[y.hasTelemetry&&(0,z.jsxs)(p,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsxs)(c,{variant:`outline`,size:`sm`,className:`h-7`,onClick:be,"aria-label":e(`detail.exportDiagnosticAria`),children:[(0,z.jsx)(r,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.exportDiagnostic`)]})}),(0,z.jsx)(a,{children:e(`detail.exportDiagnosticTooltip`)})]}),we&&(0,z.jsxs)(p,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsxs)(c,{variant:`outline`,size:`sm`,onClick:xe,className:`h-7`,children:[(0,z.jsx)(te,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.reExecute`)]})}),(0,z.jsx)(a,{children:e(`detail.reExecuteTooltip`)})]}),Ee&&(0,z.jsxs)(p,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsxs)(c,{variant:`outline`,size:`sm`,onClick:ve,disabled:q,className:`h-7 border-accent-success/40 text-accent-success hover:bg-accent-success/10`,children:[(0,z.jsx)(f,{className:`w-3.5 h-3.5 mr-1.5`}),e(q?`detail.finalizing`:`detail.finalizeJob`)]})}),(0,z.jsx)(a,{children:e(`detail.finalizeJobTooltip`)})]}),Ce&&(0,z.jsxs)(p,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsx)(c,{variant:`outline`,size:`sm`,onClick:_e,className:`h-7 border-destructive/30 text-destructive hover:bg-destructive/10`,children:e(Te?`detail.cancelInteractive`:`detail.cancelJob`)})}),(0,z.jsx)(a,{children:e(`detail.cancelJobTooltip`)})]})]})]}),(0,z.jsx)(ae,{phases:j,phaseDefinitions:k})]}),(y.status===`running`||y.status===`completed`||y.status===`failed`)&&(0,z.jsx)(ce,{job:y,events:D,defaultOpen:y.status===`completed`||y.status===`running`,pipelineTotals:Oe??void 0,phases:j,phaseDefinitions:k}),(0,z.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:(0,z.jsx)(fe,{events:D})}),Ee&&(0,z.jsxs)(`div`,{className:`shrink-0 border-t border-border/40 bg-surface/40 px-3 py-2 space-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[U&&(0,z.jsx)(b,{className:`w-3 h-3 animate-spin`}),e(U?`detail.interactive.working`:`detail.interactive.ready`)]}),H&&(0,z.jsx)(`span`,{className:`tabular-nums`,children:e(`detail.interactive.liveTotals`,{turns:H.num_turns,cost:H.total_cost_usd.toFixed(4)})})]}),(0,z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,z.jsx)(`textarea`,{value:G,onChange:e=>K(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ye())},rows:2,placeholder:e(`detail.interactive.placeholder`),"aria-label":e(`detail.interactive.placeholder`),className:`flex-1 resize-none rounded-md border border-border/50 bg-background px-2.5 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-ring`}),(0,z.jsxs)(c,{size:`sm`,onClick:()=>void ye(),disabled:ue||!G.trim(),className:`h-9 shrink-0`,children:[(0,z.jsx)(v,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.interactive.send`)]})]})]})]})}export{$ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{Bt as t,Dt as n,E as r,F as i,G as a,H as o,Ht as s,I as c,J as l,L as u,M as d,N as f,O as p,Ot as m,P as h,R as g,T as _,Tt as v,Ut as y,V as b,Wt as x,bn as ee,gn as S,hn as C,j as w,n as te,nn as T,pt as ne,tn as E,u as D,v as O,wn as k,y as A}from"./index-meTWPBzY.js";import{t as j}from"./ExportDropdown-DdB2ncYh.js";import{t as re}from"./format-command-CMsBTOPN.js";var ie=t(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),M=e(k(),1),N=E();function P(e){if(e==null)return`—`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function F(e){return e==null?`—`:e===0?`$0`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function I(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function L({label:e,a:t,b:n,highlight:r}){return(0,N.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 py-2 border-b border-border/20 last:border-0 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,N.jsx)(`span`,{className:`font-mono text-right ${r===`a`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:t}),(0,N.jsx)(`span`,{className:`font-mono text-right ${r===`b`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:n})]})}function R(e,t,n=!0){return e==null||t==null||e===t?null:n?e<t?`a`:`b`:e>t?`a`:`b`}function ae({jobIds:e,onClose:t}){let{t:r}=S(`jobs`),[i,o]=(0,M.useState)(null),[s,c]=(0,M.useState)(!0),[l,d]=(0,M.useState)(null),{panelRef:f,panelStyle:p,headerHandleProps:h,resizeHandles:_,isFloating:v,guardBackdrop:y}=g();(0,M.useEffect)(()=>{let t=new AbortController;return fetch(`${T()}/jobs/compare?jobIds=${e.join(`,`)}`,{signal:t.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{o(e),c(!1)}).catch(e=>{e.name!==`AbortError`&&(d(e.message),c(!1))}),()=>t.abort()},[e]);function b(e,t){return(0,N.jsxs)(`div`,{className:`text-center space-y-1`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-medium uppercase tracking-wider`,children:r(`comparison.jobN`,{n:t+1})}),(0,N.jsx)(`code`,{className:`text-[10px] text-foreground/70 block truncate max-w-[160px] mx-auto`,children:e.command}),(0,N.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-[10px]`,children:[e.status===`completed`?(0,N.jsx)(m,{className:`w-3 h-3 text-emerald-400 aurora-light:text-accent-success`}):(0,N.jsx)(n,{className:`w-3 h-3 text-rose-400 aurora-light:text-destructive`}),(0,N.jsx)(`span`,{className:`capitalize text-muted-foreground`,children:r(`statusLabel.${e.status}`,{defaultValue:e.status})})]}),(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-mono`,children:e.id.slice(0,8)})]})}return(0,N.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:y(t),children:[(0,N.jsxs)(`div`,{ref:f,className:`w-full max-w-lg rounded-xl border border-border/30 bg-popover p-5 shadow-xl space-y-4 mx-4`,onClick:e=>e.stopPropagation(),style:p,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between ${v?`cursor-grab active:cursor-grabbing`:``}`,...h,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold`,children:r(`comparison.title`)}),(0,N.jsx)(`button`,{type:`button`,onClick:t,className:`text-muted-foreground hover:text-foreground transition-colors`,children:(0,N.jsx)(a,{className:`w-4 h-4`})})]}),s&&(0,N.jsx)(`div`,{className:`space-y-2`,children:[0,1,2,3].map(e=>(0,N.jsx)(`div`,{className:`h-8 bg-muted/20 rounded animate-pulse`},e))}),l&&(0,N.jsx)(`p`,{className:`text-xs text-red-400 aurora-light:text-destructive`,children:r(`comparison.loadFailed`,{error:l})}),i&&(()=>{let[e,t]=i.jobs,n=R(e.durationMs,t.durationMs,!0),a=R(e.totalCostUsd,t.totalCostUsd,!0),o=R(e.tokensOut==null?null:e.tokensOut,t.tokensOut==null?null:t.tokensOut,!0);return(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 pb-3 border-b border-border/30 mb-1`,children:[(0,N.jsx)(`div`,{}),b(e,0),b(t,1)]}),(0,N.jsx)(L,{label:r(`comparison.duration`),a:P(e.durationMs),b:P(t.durationMs),highlight:n}),(0,N.jsx)(L,{label:r(`comparison.cost`),a:F(e.totalCostUsd),b:F(t.totalCostUsd),highlight:a}),(0,N.jsx)(L,{label:r(`comparison.tokensOut`),a:I(e.tokensOut),b:I(t.tokensOut),highlight:o}),(0,N.jsx)(L,{label:r(`comparison.tokensIn`),a:I(e.tokensIn),b:I(t.tokensIn),highlight:null}),(0,N.jsx)(L,{label:r(`comparison.cacheRead`),a:I(e.tokensCacheRead),b:I(t.tokensCacheRead),highlight:null}),(0,N.jsx)(L,{label:r(`comparison.model`),a:e.model??`—`,b:t.model??`—`,highlight:null}),(0,N.jsx)(L,{label:r(`comparison.phasesDone`),a:e.phasesCompleted.length>0?e.phasesCompleted.join(`, `):`—`,b:t.phasesCompleted.length>0?t.phasesCompleted.join(`, `):`—`,highlight:null})]})})(),i&&(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60 text-center`,children:r(`comparison.betterValueHint`)})]}),(0,N.jsx)(u,{handles:_})]})}var z={running:{variant:`running`,labelKey:`statusLabel.running`,tooltipKey:`statusTooltip.running`},completed:{variant:`success`,labelKey:`statusLabel.done`,tooltipKey:`statusTooltip.completed`},failed:{variant:`failed`,labelKey:`statusLabel.failed`,tooltipKey:`statusTooltip.failed`},canceled:{variant:`canceled`,labelKey:`statusLabel.canceled`,tooltipKey:`statusTooltip.canceled`},queued:{variant:`queued`,labelKey:`statusLabel.queued`,tooltipKey:`statusTooltip.queuedToRun`},zombie_terminated:{variant:`failed`,labelKey:`statusLabel.zombie`,tooltipKey:`statusTooltip.zombie`},skipped:{variant:`warning`,labelKey:`statusLabel.skipped`,tooltipKey:`statusTooltip.skipped`}},oe=[`running`,`completed`,`failed`,`canceled`,`zombie_terminated`,`queued`,`skipped`],B={critical:{className:`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`,labelKey:`recent.priority.critical`},high:{className:`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`,labelKey:`recent.priority.high`},normal:{className:``,labelKey:`recent.priority.normal`},low:{className:`bg-gray-500/15 aurora-light:bg-muted text-gray-400 aurora-light:text-muted-foreground border-gray-500/30 aurora-light:border-border`,labelKey:`recent.priority.low`}};function se(e){return e==null||e===0?null:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function ce(e,t){if(!t)return null;let n=new Date(t).getTime()-new Date(e).getTime();if(n<0)return null;let r=Math.round(n/1e3);if(r<60)return`${r}s`;let i=Math.floor(r/60),a=r%60;return i<60?`${i}m ${a}s`:`${Math.floor(i/60)}h ${i%60}m`}function le(e){return e==null||e===0?null:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function ue(e){try{return D(new Date(e),{addSuffix:!0,locale:x()})}catch{return e}}var V=10;function H({jobs:e,isLoading:t,onJobsCleared:n,onProposalClick:a,onProposalDelete:m}){let{t:y}=S(`jobs`),x=ee(),{activeProjectId:te,projects:E}=s(),D=E.find(e=>e.id===te)?.provider,[O,k]=(0,M.useState)(null),[A,j]=(0,M.useState)(``),[P,F]=(0,M.useState)(``),[I,L]=(0,M.useState)(!1),[R,H]=(0,M.useState)(``),[U,W]=(0,M.useState)(``),[G,de]=(0,M.useState)(!1),[K,q]=(0,M.useState)(null),[J,fe]=(0,M.useState)(V),[Y,pe]=(0,M.useState)(!1),[X,Z]=(0,M.useState)([]),[me,Q]=(0,M.useState)(null),{panelRef:he,panelStyle:ge,headerHandleProps:_e,resizeHandles:ve,isFloating:ye,guardBackdrop:be}=g();(0,M.useEffect)(()=>{fe(V)},[e.length]);function xe(){pe(e=>!e),Z([])}function Se(e){Z(t=>{if(t.includes(e))return t.filter(t=>t!==e);if(t.length>=2)return t;let n=[...t,e];return n.length===2&&Q(n),n})}let $=e.filter(e=>!(O&&e.status!==O||A&&e.started_at<A||P&&e.started_at>`${P}T23:59:59`)),Ce=e.filter(e=>!(R&&e.started_at<R||U&&e.started_at>`${U}T23:59:59`)).length;async function we(e){de(!0);try{let t={};e===`range`&&(R&&(t.from=R),U&&(t.to=U));let r=await fetch(`${T()}/jobs`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(r.ok){let e=await r.json();C.success(y(`recent.toast.cleared`,{count:e.deleted})),L(!1),H(``),W(``),n?.()}else C.error(y(`recent.toast.clearFailed`))}catch{C.error(y(`recent.toast.networkError`))}finally{de(!1)}}return t?(0,N.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-1`,children:[0,1,2].map(e=>(0,N.jsx)(`div`,{className:`h-9 bg-muted/30 rounded-md animate-pulse`},e))}):e.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg border border-dashed border-border/40 bg-card/50 p-8 text-center space-y-2`,children:[(0,N.jsx)(v,{className:`w-8 h-8 text-muted-foreground/30 mx-auto`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:y(`recent.emptyTitle`)}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:y(`recent.emptyDescription`)})]}):(0,N.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>k(null),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${O===null?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:y(`recent.filterAll`,{count:e.length})}),oe.map(t=>{let n=e.filter(e=>e.status===t).length;return n===0?null:(0,N.jsx)(`button`,{type:`button`,onClick:()=>k(O===t?null:t),className:`px-2 py-0.5 rounded text-[10px] font-medium capitalize transition-colors ${O===t?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:y(`recent.filterStatus`,{status:y(`statusName.${t}`),count:n})},t)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`input`,{type:`date`,value:A,onChange:e=>j(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:y(`recent.fromDate`)}),(0,N.jsx)(`input`,{type:`date`,value:P,onChange:e=>F(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:y(`recent.toDate`)}),(A||P)&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>{j(``),F(``)},className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:y(`recent.clear`)}),(0,N.jsxs)(_,{children:[(0,N.jsx)(p,{asChild:!0,children:(0,N.jsx)(o,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 transition-colors ${Y?`text-foreground bg-accent`:`text-muted-foreground hover:text-foreground`}`,onClick:xe,children:(0,N.jsx)(ie,{className:`w-3.5 h-3.5`})})}),(0,N.jsx)(r,{children:y(Y?`recent.exitCompareMode`:`recent.compareTwoJobs`)})]}),(0,N.jsxs)(_,{children:[(0,N.jsx)(p,{asChild:!0,children:(0,N.jsx)(o,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-muted-foreground hover:text-destructive`,onClick:()=>L(!0),children:(0,N.jsx)(l,{className:`w-3.5 h-3.5`})})}),(0,N.jsx)(r,{children:y(`recent.clearJobs`)})]})]})]}),Y&&(0,N.jsxs)(`div`,{className:`flex items-center justify-between rounded-md bg-accent/40 px-3 py-1.5 text-[10px] text-muted-foreground`,children:[(0,N.jsxs)(`span`,{children:[X.length===0&&y(`recent.selectTwoToCompare`),X.length===1&&y(`recent.selectOneMore`),X.length===2&&y(`recent.readyToCompare`)]}),X.length===2&&(0,N.jsx)(`button`,{type:`button`,className:`text-[10px] font-medium text-foreground hover:underline`,onClick:()=>Q(X),children:y(`recent.compareAction`)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1 text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:[(0,N.jsx)(`span`,{className:`w-14`,children:y(`recent.colStatus`)}),(0,N.jsx)(`span`,{className:`flex-1 min-w-0`,children:y(`recent.colCommand`)}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,N.jsx)(`span`,{className:`w-14 text-right`,children:y(`recent.colDuration`)}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:y(`recent.colTokens`)}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:y(`recent.colCost`)}),(0,N.jsx)(`span`,{className:`w-20 text-right`,children:y(`recent.colStarted`)})]})]}),(0,N.jsx)(`div`,{className:`space-y-0.5`,children:$.slice(0,J).map(e=>{let t=z[e.status]??z.queued,n=se(e.total_cost_usd),i=ce(e.started_at,e.finished_at),o=le((e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0)||null),s=e.id.startsWith(`proposal:`),c=s?e.id.replace(`proposal:`,``):null,u=X.includes(e.id),d=Y&&!s&&X.length===2&&!u;return(0,N.jsxs)(`div`,{role:`button`,tabIndex:0,className:`flex items-center gap-3 px-3 py-2 rounded-md transition-colors cursor-pointer group ${u?`bg-accent/70 ring-1 ring-border`:d?`opacity-40 cursor-not-allowed`:`hover:bg-accent/50`}`,onClick:()=>{if(Y&&!s){Se(e.id);return}s&&c?a?.(c):x(`/jobs/${e.id}`)},children:[(0,N.jsxs)(_,{children:[(0,N.jsx)(p,{asChild:!0,children:(0,N.jsx)(`div`,{children:(0,N.jsx)(b,{variant:t.variant,children:y(t.labelKey)})})}),(0,N.jsx)(r,{children:y(t.tooltipKey)})]}),e.priority&&e.priority!==`normal`&&(0,N.jsx)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[9px] font-medium border ${B[e.priority].className}`,children:y(B[e.priority].labelKey)}),e.profile_name&&(0,N.jsxs)(_,{children:[(0,N.jsx)(p,{asChild:!0,children:(0,N.jsx)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[9px] font-medium border border-accent-primary/40 bg-accent-primary/10 text-accent-primary/90`,children:e.profile_name})}),(0,N.jsx)(r,{children:y(`recent.profileTooltip`,{name:e.profile_name})})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1 flex-1 min-w-0`,children:[e.pipeline_id&&(0,N.jsxs)(_,{children:[(0,N.jsx)(p,{asChild:!0,children:(0,N.jsx)(ne,{className:`w-3 h-3 text-accent-primary/60 shrink-0`})}),(0,N.jsxs)(r,{children:[y(`recent.pipelinePart`),e.depends_on_job_id&&` ${y(`recent.pipelineDependsOn`)}`,e.skip_reason&&` — ${e.skip_reason}`]})]}),(0,N.jsx)(`code`,{className:`text-xs text-foreground/80 truncate`,children:re(e.command,D)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-muted-foreground shrink-0`,children:[(0,N.jsx)(`span`,{className:`w-14 text-right`,children:i??`—`}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:o?`${o}`:`—`}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:n??`—`}),(0,N.jsx)(`span`,{className:`w-20 text-right`,children:ue(e.started_at)}),s&&c&&(0,N.jsx)(`button`,{type:`button`,className:`w-4 h-4 md:opacity-0 md:group-hover:opacity-100 text-muted-foreground hover:text-destructive transition-all`,onClick:e=>{e.stopPropagation(),q(c)},title:y(`recent.deleteProposal`),children:(0,N.jsx)(l,{className:`w-3 h-3`})})]})]},e.id)})}),$.length>J&&(0,N.jsx)(`div`,{className:`pt-1 text-center`,children:(0,N.jsx)(`button`,{type:`button`,onClick:()=>fe(e=>e+V),className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors px-3 py-1 rounded hover:bg-accent/50`,children:y(`recent.loadMore`,{count:$.length-J})})}),I&&(0,N.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:be(()=>L(!1)),children:[(0,N.jsxs)(`div`,{ref:he,className:`w-80 rounded-xl border border-border/30 bg-popover p-4 shadow-lg space-y-4`,onClick:e=>e.stopPropagation(),style:ge,children:[(0,N.jsxs)(`div`,{..._e,className:ye?`cursor-grab active:cursor-grabbing`:void 0,children:[(0,N.jsx)(`h3`,{className:`text-sm font-semibold`,children:y(`recent.clearModal.title`)}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:y(`recent.clearModal.jobsInHistory`,{count:e.length})})]}),(0,N.jsx)(o,{variant:`destructive`,size:`sm`,className:`w-full`,disabled:G,onClick:()=>we(`all`),children:y(`recent.clearModal.clearAll`,{count:e.length})}),(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`recent.clearModal.orByRange`)}),(0,N.jsxs)(`div`,{className:`flex gap-2`,children:[(0,N.jsx)(`input`,{type:`date`,value:R,onChange:e=>H(e.target.value),className:`flex-1 h-7 rounded-md border border-border bg-input px-2 text-xs text-foreground`,placeholder:y(`recent.clearModal.fromPlaceholder`)}),(0,N.jsx)(`input`,{type:`date`,value:U,onChange:e=>W(e.target.value),className:`flex-1 h-7 rounded-md border border-border bg-input px-2 text-xs text-foreground`,placeholder:y(`recent.clearModal.toPlaceholder`)})]}),(0,N.jsx)(o,{variant:`outline`,size:`sm`,className:`w-full`,disabled:G||!R&&!U,onClick:()=>we(`range`),children:R||U?y(`recent.clearModal.clearInRange`,{count:Ce}):y(`recent.clearModal.clearRange`)})]}),(0,N.jsx)(o,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:()=>L(!1),children:y(`common:actions.cancel`)})]}),(0,N.jsx)(u,{handles:ve})]}),(0,N.jsx)(w,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,N.jsxs)(d,{className:`max-w-sm`,children:[(0,N.jsxs)(i,{children:[(0,N.jsx)(c,{children:y(`recent.deleteProposalConfirm.title`)}),(0,N.jsx)(f,{children:y(`recent.deleteProposalConfirm.description`)})]}),(0,N.jsxs)(h,{children:[(0,N.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>q(null),children:y(`common:actions.cancel`)}),(0,N.jsx)(o,{variant:`destructive`,size:`sm`,onClick:()=>{K&&m?.(K),q(null)},children:y(`common:actions.delete`)})]})]})}),me&&(0,N.jsx)(ae,{jobIds:me,onClose:()=>{Q(null),Z([]),pe(!1)}})]})}function U(){let{t:e}=S(`jobs`),{activeProjectId:t}=s(),{recentJobs:n}=te(t),{data:r,isFirstLoad:a,refresh:l}=y({namespace:`jobs`,projectId:t,initialValue:n,fetcher:async()=>{let e=await fetch(`${T()}/jobs?limit=10`);return e.ok?(await e.json()).jobs:[]},pollInterval:1e4}),{data:u}=y({namespace:`proposals`,projectId:t,initialValue:[],fetcher:async()=>{let e=await fetch(`${T()}/propose?limit=10`);return e.ok?(await e.json()).proposals:[]},pollInterval:1e4}),f={input:`queued`,exploring:`running`,review:`running`,refining:`running`,creating_issue:`running`,created:`completed`,cancelled:`canceled`},p=u.map(e=>({id:`proposal:${e.id}`,command:`/specrails:propose-feature ${e.idea.length>60?e.idea.slice(0,57)+`...`:e.idea}`,started_at:e.created_at,status:f[e.status]??`queued`})),m=[...r,...p].sort((e,t)=>new Date(t.started_at).getTime()-new Date(e.started_at).getTime()),[g,_]=(0,M.useState)(null),v=(0,M.useCallback)(async e=>{try{let t=await fetch(`${T()}/propose/${e}`);if(!t.ok)return;_((await t.json()).proposal)}catch{}},[]),x=(0,M.useCallback)(async t=>{try{(await fetch(`${T()}/propose/${t}`,{method:`DELETE`})).ok&&(C.success(e(`page.proposalDeleted`)),l())}catch{}},[l,e]);return(0,N.jsxs)(`div`,{className:`max-w-4xl mx-auto px-4 py-6`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,N.jsx)(`h1`,{className:`text-sm font-semibold`,children:e(`page.title`)}),(0,N.jsx)(j,{baseUrl:`${T()}/jobs/export`,label:e(`page.exportJobs`)})]}),(0,N.jsx)(H,{jobs:m,isLoading:a,onJobsCleared:l,onProposalClick:v,onProposalDelete:x}),(0,N.jsx)(w,{open:g!==null,onOpenChange:e=>!e&&_(null),children:(0,N.jsx)(d,{className:`max-w-3xl glass-card`,children:g&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(i,{children:(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(c,{className:`flex-1 min-w-0`,children:e(`page.proposal.title`)}),(0,N.jsx)(b,{variant:g.status===`created`?`success`:g.status===`cancelled`?`destructive`:`secondary`,children:g.status})]})}),(0,N.jsx)(`div`,{className:`text-xs text-muted-foreground bg-muted/20 rounded px-2 py-1 italic`,children:g.idea}),g.result_markdown?(0,N.jsx)(`div`,{className:`max-h-[400px] overflow-y-auto rounded-lg px-3 py-2 text-xs bg-muted/40`,children:(0,N.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none prose-p:my-1 prose-headings:mt-2 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-code:text-cyan-300 prose-code:text-[10px] prose-code:bg-muted/40 prose-code:px-1 prose-code:py-0.5 prose-code:rounded text-foreground/80`,children:(0,N.jsx)(A,{remarkPlugins:[O],children:g.result_markdown})})}):(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:e(`page.proposal.noContent`)}),g.issue_url&&(0,N.jsxs)(`div`,{className:`text-xs`,children:[e(`page.proposal.githubIssue`),` `,(0,N.jsx)(`a`,{href:g.issue_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent-primary hover:underline`,children:g.issue_url})]}),(0,N.jsxs)(h,{children:[(0,N.jsx)(o,{variant:`destructive`,size:`sm`,onClick:()=>{x(g.id),_(null)},children:e(`common:actions.delete`)}),(0,N.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>_(null),children:e(`common:actions.close`)})]})]})})})]})}export{U as default};
|