@openchamber/web 1.24.1 → 1.24.2
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/bin/cli.test.js +22 -0
- package/bin/lib/commands-status.js +5 -0
- package/dist/assets/{CodeMirrorCommentWidgets-DvUH815P.js → CodeMirrorCommentWidgets-B_vBPQYm.js} +1 -1
- package/dist/assets/DiffView-Ce0oBXXQ.js +4 -0
- package/dist/assets/{FilesView-D0bM9FVB.js → FilesView-DtXueAWP.js} +5 -5
- package/dist/assets/{GitView-Bxuv3dfP.js → GitView-k0hUF8KB.js} +4 -4
- package/dist/assets/{GuestAttachDialog-B0u3Q5uO.js → GuestAttachDialog-DIf2U85Z.js} +1 -1
- package/dist/assets/{JsonTreeView-BBVPFM5K.js → JsonTreeView-4AnJ04Pw.js} +1 -1
- package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/{LinearIssuesView-UI1FcSC8.js → LinearIssuesView-z_9p2GuO.js} +1 -1
- package/dist/assets/{MarkdownImageGallery-CUJxH8Le.js → MarkdownImageGallery-BC-BNN-s.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-D5BZOg8X.js → MarkdownRendererImpl-DyaBTUbH.js} +6 -6
- package/dist/assets/{OnboardingScreen-5Gou9cGD.js → OnboardingScreen-DKU_yTb6.js} +1 -1
- package/dist/assets/{PatchDiff-C4rE5k6z.js → PatchDiff-DpGmHRnV.js} +1 -1
- package/dist/assets/PierreDiffViewer-CgLl_tp7.js +210 -0
- package/dist/assets/{PlanView-u2yi5XGJ.js → PlanView-CrfB4qqY.js} +4 -4
- package/dist/assets/{PluginPane-QxjsKYeO.js → PluginPane-B5cn-jPy.js} +1 -1
- package/dist/assets/{SettingsView-Fo5ZqMaT.js → SettingsView-DMKKwezx.js} +12 -12
- package/dist/assets/{SettingsWindow-HVDVANjJ.js → SettingsWindow-DwbnVzOC.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-D3hzkybB.js → SubmoduleDiffSummary-hkGcvs0E.js} +1 -1
- package/dist/assets/{ToolOutputDialog-3J6IRayW.js → ToolOutputDialog-DuoIOc0j.js} +6 -6
- package/dist/assets/{ToolPartDiffPreview-DarxPjSd.js → ToolPartDiffPreview-t1Bvq_2Y.js} +2 -2
- package/dist/assets/{VirtualizedFileDiff-CZgXWHjU.js → VirtualizedFileDiff-BK4aU5qJ.js} +4 -4
- package/dist/assets/{WalkthroughView-wSpED5L4.js → WalkthroughView-Bk6TPNFw.js} +2 -2
- package/dist/assets/{appThemeRegistry-Cf8KitzT.js → appThemeRegistry-DnOVbJjF.js} +1 -1
- package/dist/assets/{commitAndPush-DZnzlhvc.js → commitAndPush-DLWNZkkY.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-VYnT_A2h.js → computeVirtualFileMetrics-BVTujWSX.js} +1 -1
- package/dist/assets/{de-BM_8EDD3.js → de-zEHaAIi3.js} +4 -4
- package/dist/assets/{es-CxZjlqpo.js → es-CBDgEzgk.js} +3 -3
- package/dist/assets/{fr-VCixCnMW.js → fr-DjiTptT_.js} +4 -4
- package/dist/assets/{index-B9Hvzjwl.css → index-AgOdanig.css} +1 -1
- package/dist/assets/index-B-2_X4DD.js +40 -0
- package/dist/assets/{index-3U4CtS9b.js → index-CkA4p2IK.js} +1 -1
- package/dist/assets/{isDiffPlainText-ImDG3Uhg.js → isDiffPlainText-D3yX_vx4.js} +1 -1
- package/dist/assets/{isFilePlainText-D_YDVYDb.js → isFilePlainText-CZR9TcHV.js} +1 -1
- package/dist/assets/{ja-CZ5k_GyD.js → ja-CerMgj3r.js} +4 -4
- package/dist/assets/{ko-7YM3A1Xh.js → ko-DHYDAze5.js} +4 -4
- package/dist/assets/main-BDka4W43.js +896 -0
- package/dist/assets/main-Dl7Dyge_.js +2 -0
- package/dist/assets/{markdownCore-DHvqMxPn.js → markdownCore-DFmr0rUR.js} +4 -4
- package/dist/assets/miniChat-CLKQPPpO.js +2 -0
- package/dist/assets/mobile--giD2Q1L.js +2 -0
- package/dist/assets/{patchFileDiff-DDQ6Rq5e.js → patchFileDiff-DRh-AQvd.js} +3 -3
- package/dist/assets/{pl-BcgDO_w5.js → pl-BTB_93bq.js} +4 -4
- package/dist/assets/{pt-BR-CU2u_1q5.js → pt-BR-BwA3oyCK.js} +3 -3
- package/dist/assets/renderElectronMiniChatApp-DmB7zpVK.js +2 -0
- package/dist/assets/{renderMobileApp-D0Y8DtkA.js → renderMobileApp-pMfOuQfl.js} +7 -7
- package/dist/assets/runtimeEndpointReset-Gqhmkm3U.js +25 -0
- package/dist/assets/{scheduledTasksApi-D8pq6gQz.js → scheduledTasksApi-CeRAIUmW.js} +1 -1
- package/dist/assets/{shikiHighlight-1imXsir9.js → shikiHighlight-BfjuB3CD.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-Dgqc63LZ.js → textMateThemeFromAppTheme-BP60t9SX.js} +1 -1
- package/dist/assets/{tr-DuYhOzNe.js → tr-CcPsJoNM.js} +3 -3
- package/dist/assets/{uk-Cuk7-uvq.js → uk-B68WibXi.js} +3 -3
- package/dist/assets/{useAppFontEffects-BItUWdo4.js → useAppFontEffects-DcdrFv2Z.js} +144 -144
- package/dist/assets/{useInlineCommentController-CkbKsm7m.js → useInlineCommentController-Cq4SUjsA.js} +2 -2
- package/dist/assets/{useRootScrollLock-vmzxZjWA.js → useRootScrollLock-CSdR6Wnm.js} +2 -2
- package/dist/assets/{vendor-codemirror-language-data-BDyxuqK4.js → vendor-codemirror-language-data-BFm1Ju2w.js} +2 -2
- package/dist/assets/vendor-katex-Cp579UoJ.css +1 -0
- package/dist/assets/{vendor-zod-fZppILAM.js → vendor-zod-CgAdXWZO.js} +4 -4
- package/dist/assets/{web-components-D7FinaeH.js → web-components-2vo9YsZc.js} +1 -1
- package/dist/assets/{zh-CN-CUWoiRHd.js → zh-CN-DbFHYXwP.js} +3 -3
- package/dist/assets/{zh-TW-CQ8EBSBN.js → zh-TW-DmXAwdty.js} +3 -3
- package/dist/index.html +6 -4
- package/dist/mini-chat.html +6 -4
- package/dist/mobile.html +6 -4
- package/package.json +4 -4
- package/server/index.js +3 -0
- package/server/lib/agent-tool/DOCUMENTATION.md +17 -4
- package/server/lib/agent-tool/runtime.js +62 -15
- package/server/lib/agent-tool/runtime.test.js +88 -2
- package/server/lib/fs/DOCUMENTATION.md +2 -1
- package/server/lib/fs/routes.js +56 -4
- package/server/lib/fs/routes.test.js +116 -0
- package/server/lib/git/DOCUMENTATION.md +2 -2
- package/server/lib/git/service.js +94 -9
- package/server/lib/git/service.test.js +18 -0
- package/server/lib/message-queue/DOCUMENTATION.md +4 -1
- package/server/lib/message-queue/runtime.js +16 -1
- package/server/lib/message-queue/runtime.test.js +21 -5
- package/server/lib/notifications/routes.js +5 -0
- package/server/lib/openchamber-sessions/routes.js +18 -18
- package/server/lib/openchamber-sessions/routes.test.js +49 -0
- package/server/lib/opencode/DOCUMENTATION.md +1 -1
- package/server/lib/opencode/bootstrap-runtime.js +1 -0
- package/server/lib/opencode/session-runtime.js +68 -0
- package/server/lib/opencode/session-runtime.test.js +43 -0
- package/server/lib/projects/project-config.js +2 -2
- package/server/lib/realtime-proxy-terminal.test.js +150 -0
- package/server/lib/realtime-proxy.js +2 -0
- package/server/lib/routing/DOCUMENTATION.md +5 -3
- package/server/lib/scheduled-tasks/runtime.js +2 -2
- package/server/lib/scheduled-tasks/runtime.test.js +14 -0
- package/server/lib/small-model/DOCUMENTATION.md +14 -2
- package/server/lib/small-model/call.js +37 -6
- package/server/lib/small-model/call.test.js +182 -0
- package/server/lib/terminal/DOCUMENTATION.md +21 -2
- package/server/lib/terminal/runtime.js +10 -3
- package/server/lib/terminal/runtime.test.js +22 -0
- package/server/lib/terminal/shutdown.js +106 -0
- package/server/lib/terminal/shutdown.test.js +84 -0
- package/server/lib/tts/service.test.js +78 -0
- package/dist/assets/DiffView-DkC3xlRJ.js +0 -4
- package/dist/assets/PierreDiffViewer-ByRVu6ss.js +0 -161
- package/dist/assets/index-DLHQogv8.js +0 -40
- package/dist/assets/main-CycplCph.js +0 -2
- package/dist/assets/main-DFYTCx5o.js +0 -896
- package/dist/assets/miniChat-DIQKfY2V.js +0 -2
- package/dist/assets/mobile-BMwz5q-m.js +0 -2
- package/dist/assets/renderElectronMiniChatApp-3_d6g6CU.js +0 -2
- package/dist/assets/runtimeEndpointReset-DhC3REb2.js +0 -25
- /package/dist/assets/{vendor-katex-k3Ppq1Ha.js → vendor-katex-CHD9BdDO.js} +0 -0
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{R as i,f as Ye,j as t}from"./vendor-react-BUCujlKS.js";import{u as ae,O as Ce,a as Re,G as Fn}from"./index-DLHQogv8.js";import{c as Dn,b as An,u as Vn,a as En,B as Ln,C as Tn,P as Tt,h as Mn,e as Bn,g as In,i as Pn,f as zn}from"./patchFileDiff-DDQ6Rq5e.js";import{c as On,b as _n,i as Kn,u as Gn,a as Hn,d as $n,S as qn}from"./SubmoduleDiffSummary-D3hzkybB.js";import{f as ze,B as fe,I as T,h as je,Z as $t,af as Wn,K as ne,ag as Un,bg as Jn,J as Xn,ah as Yn,aj as Qn,z as Mt,k as Zn,d5 as qt,t as Je,kj as es,aw as Xe,aa as ts,ab as ns,ac as ss,k9 as Wt,kk as rs,ax as Ut,gC as is,au as Ue,av as os,c5 as Jt,aq as as,as as ls,at as cs,ap as us}from"./useAppFontEffects-BItUWdo4.js";import{f as ds,d as fs}from"./runtimeEndpointReset-DhC3REb2.js";import{P as ms}from"./PierreDiffViewer-ByRVu6ss.js";import{u as ps,v as hs,g as gs,W as xs}from"./main-DFYTCx5o.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-zod-fZppILAM.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./vendor-zustand-BAGL70zf.js";import"./vendor-opencode-sdk-BJ73u-bH.js";import"./VirtualizedFileDiff-CZgXWHjU.js";import"./web-components-D7FinaeH.js";import"./computeVirtualFileMetrics-VYnT_A2h.js";import"./vendor-shiki-Bbf2GEcE.js";import"./vendor-shikijs-core-CGM_jqPK.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-BgLrS_2D.js";import"./vendor-hast-util-to-html-BKBhbTDb.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-rJCbAzvX.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import"./themeResolver-BmJyTmjJ.js";import"./vendor-pierre-theming-C6Z4M5_u.js";import"./vendor-shikijs-engine-javascript-Cme4830A.js";import"./vendor-oniguruma-to-es-DLBnFDCE.js";import"./vendor-oniguruma-parser-C0D4_9rT.js";import"./vendor-regex-BBWcyTkg.js";import"./vendor-regex-utilities-2BQyy0xI.js";import"./vendor-regex-recursion-JU4mF-dD.js";import"./vendor-shikijs-transformers-CZWsLLKm.js";import"./isDiffPlainText-ImDG3Uhg.js";import"./vendor-diff-C3JhlQdm.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-base-ui-CsXYnR5c.js";import"./vendor-floating-ui-utils-D6FqdtJt.js";import"./vendor-floating-ui-react-dom-DxYCWdHj.js";import"./vendor-floating-ui-dom-BTvzWks8.js";import"./vendor-floating-ui-core-PuGzNPnN.js";import"./vendor-use-sync-external-store-D6wYuSt-.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-dnd-kit-core-BZknOX2w.js";import"./vendor-dnd-kit-utilities-B_MdXhJC.js";import"./vendor-dnd-kit-accessibility-BHxJPORy.js";import"./vendor-dnd-kit-sortable-CsEagZ81.js";import"./vendor-framer-motion-Bq3iTZ6r.js";import"./vendor-motion-dom-DcCgeG69.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-tanstack-react-virtual-ClYN8CzB.js";import"./vendor-tanstack-virtual-core-BewVQryB.js";import"./contextPanelEmbeddedChat-CirXEPJq.js";import"./vendor-sonner-DFyL3AvE.js";import"./vendor-cmdk-DgLInKvT.js";import"./vendor-radix-ui-react-dialog-B94Bt2qq.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-DcAh5WdT.js";import"./vendor-radix-ui-react-context-Czxm7Z62.js";import"./vendor-radix-ui-react-id-f5BLKEVw.js";import"./vendor-radix-ui-react-use-layout-effect-D_3IhJdJ.js";import"./vendor-radix-ui-react-use-controllable-state-BFT5YmkA.js";import"./vendor-radix-ui-react-dismissable-layer-D7kXcwgJ.js";import"./vendor-radix-ui-react-primitive-DhVoX9SD.js";import"./vendor-radix-ui-react-slot-BQgQOasS.js";import"./vendor-radix-ui-react-use-callback-ref-BZPnuXAC.js";import"./vendor-radix-ui-react-use-escape-keydown-oph88g-F.js";import"./vendor-radix-ui-react-focus-scope-CiaxW4dD.js";import"./vendor-radix-ui-react-portal-BMJYHWck.js";import"./vendor-radix-ui-react-presence-CNxf-uq4.js";import"./vendor-radix-ui-react-focus-guards-B6qJXYua.js";import"./vendor-react-remove-scroll-DO7dCTnK.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-BcFYyj3E.js";import"./vendor-react-style-singleton-q6EMHnwf.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-zDC0RhA3.js";import"./vendor-use-callback-ref-D3RC8gqK.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-language-BgPj_McA.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-codemirror-state-C9awkmn-.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-CiLROUVV.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-lang-javascript-Cc2ZYbgX.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-DzPz9Wgq.js";import"./vendor-codemirror-lang-json-CMBS2tG9.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-O0cZX78y.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-CfgK872x.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-BPGOH9ye.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-BDyxuqK4.js";import"./vendor-codemirror-lang-python-HahnQaAS.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-codemirror-commands-B7H_j0iU.js";import"./vendor-legendapp-list-BuBPBC3R.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./GuestAttachDialog-B0u3Q5uO.js";import"./PluginPane-QxjsKYeO.js";import"./Virtualizer-D_a8gKmg.js";import"./useInlineCommentController-CkbKsm7m.js";import"./appThemeRegistry-Cf8KitzT.js";import"./textMateThemeFromAppTheme-Dgqc63LZ.js";import"./useRootScrollLock-vmzxZjWA.js";import"./scheduledTasksApi-D8pq6gQz.js";import"./vendor-cron-parser-CUcP7OfX.js";import"./vendor-luxon-BZ0puJYg.js";const ys=i.memo(function(e){const s=Ye.c(13),{index:c,staged:x,busyHunk:p,disabled:y,onAction:j}=e,{t:C}=ze();let l;s[0]!==x?(l=x?["unstage"]:["discard","stage"],s[0]=x,s[1]=l):l=s[1];const b=l;let R;s[2]===Symbol.for("react.memo_cache_sentinel")?(R={top:"var(--oc-hunk-action-offset, 0.25rem)"},s[2]=R):R=s[2];let d;s[3]!==b||s[4]!==p||s[5]!==y||s[6]!==c||s[7]!==j||s[8]!==C?(d=t.jsx("div",{className:"pointer-events-auto flex items-center gap-0.5 rounded-full border border-[var(--interactive-border)]/45 bg-[var(--surface-background)]/95 px-1 py-0.5 shadow-sm backdrop-blur-md",children:b.map(w=>{const K=C(w==="stage"?"diffView.hunk.stageTitle":w==="unstage"?"diffView.hunk.unstageTitle":"diffView.hunk.discardTitle",{index:c+1}),P=p?.index===c&&p.action===w;return t.jsx(fe,{variant:"ghost",size:"xs",className:je("rounded-full bg-transparent text-muted-foreground hover:bg-transparent hover:text-foreground",w==="discard"&&"text-[var(--status-error)] hover:text-[var(--status-error)]",w==="stage"&&"text-[var(--status-success)] hover:text-[var(--status-success)]"),disabled:y||p!==null,title:K,"aria-label":K,onPointerDown:ws,onClick:f=>{f.stopPropagation(),j(c,w)},children:t.jsx(T,{name:P?"loader-4":w==="stage"?"add":"arrow-go-back",className:je(w==="stage"?"size-4":"size-3.5",P&&"animate-spin")})},w)})}),s[3]=b,s[4]=p,s[5]=y,s[6]=c,s[7]=j,s[8]=C,s[9]=d):d=s[9];let M;return s[10]!==c||s[11]!==d?(M=t.jsx("div",{className:"pointer-events-none absolute right-3 z-20",style:R,"data-hunk-actions":c,children:d}),s[10]=c,s[11]=d,s[12]=M):M=s[12],M});function ws(a){return a.stopPropagation()}const Bt=(a,e)=>{if(e.length===0)return null;let s=null,c=null;for(const p of e)p.top<=a?(!s||p.top>s.top)&&(s=p):(!c||p.top<c.top)&&(c=p);const x=s??c;return x?{path:x.path,topOffset:x.top-a}:null},bs=(a,e,s,c)=>Math.min(Math.max(0,c),Math.max(0,a+s-e)),It=a=>{if(!a)return null;const e=a.split(`
|
|
2
|
-
`);let s=null;for(const c of e){const x=c.match(/^@@\s*-\d+(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s*@@/);if(x){const p=Number.parseInt(x[1]??"",10);s=Number.isFinite(p)&&p>=1?p:null;continue}if(s!==null){if(c.startsWith(" ")){s+=1;continue}if(c.startsWith("+"))return s;if(c.startsWith("-"))return Math.max(1,s)}}return null},js=1100,vs=15e3,Pt=500,zt=300,Xt=1e6,yt=3,ks=a=>a<=6?a:a<=12?6:a<=25?4:2,Ot={status:"loading"},Ss=3,Ns=i.memo(()=>{const a=Ye.c(4),{t:e}=ze();let s;a[0]!==e?(s=e("diffView.binary.unavailable"),a[0]=e,a[1]=s):s=a[1];let c;return a[2]!==s?(c=t.jsx("div",{className:"rounded-lg border border-border/60 bg-background px-3 py-2",children:t.jsx("div",{className:"typography-meta text-muted-foreground",children:s})}),a[2]=s,a[3]=c):c=a[3],c}),Yt={"?":{code:"?",color:"var(--status-info)",descriptionKey:"diffView.change.untracked"},A:{code:"A",color:"var(--status-success)",descriptionKey:"diffView.change.new"},D:{code:"D",color:"var(--status-error)",descriptionKey:"diffView.change.deleted"},R:{code:"R",color:"var(--status-info)",descriptionKey:"diffView.change.renamed"},C:{code:"C",color:"var(--status-info)",descriptionKey:"diffView.change.copied"},M:{code:"M",color:"var(--status-warning)",descriptionKey:"diffView.change.modified"}},Cs=Yt.M,Rs=a=>{const e=a.index?.trim(),s=a.working_dir?.trim();return e&&e!=="?"?e.charAt(0):s?s.charAt(0):e?.charAt(0)||s?.charAt(0)||"M"},Qt=a=>{const e=Rs(a);return Yt[e]??Cs},Fs=a=>{const{index:e,working_dir:s}=a;return e==="A"||s==="A"||e==="?"||s==="?"},_t=a=>{const e=a.index?.trim();return!!(e&&e!=="?")},Kt=a=>!!a.working_dir?.trim()||a.index==="?",Ds=(a,e)=>is(a,e),Gt=a=>(a||"").replace(/\\/g,"/").replace(/\/+$/,""),Ht=(a,e)=>{const s=a.split(`
|
|
3
|
-
`),c=e.split(`
|
|
4
|
-
`),x=Math.min(s.length,c.length);for(let p=0;p<x;p+=1)if(s[p]!==c[p])return p+1;return c.length>s.length?s.length+1:s.length>c.length?Math.max(1,c.length):1},As=a=>Array.isArray(a)?a.filter(e=>!e||typeof e!="object"?!1:typeof e.file=="string"):[],Vs=a=>a==="added"?"A":a==="deleted"?"D":"M",wt=(a,e,s)=>Pn(e)?{original:"",modified:"",isBinary:!0,patch:e,contextMode:s}:{original:"",modified:"",patch:e,fileDiff:zn(a,e),contextMode:s},Zt=(a,e,s)=>{const c=a??0,x=e??0;return!c&&!x?null:t.jsxs("span",{className:je("typography-meta flex items-center gap-1 text-xs whitespace-nowrap","flex-shrink-0",s?.className),children:[c?t.jsxs("span",{style:{color:"var(--status-success)"},children:["+",c]}):null,x?t.jsxs("span",{style:{color:"var(--status-error)"},children:["-",x]}):null]})},Es=i.memo(a=>{const e=Ye.c(68),{scope:s,workingCount:c,stagedCount:x,turnCount:p,branchCount:y,commitCount:j,prCount:C,showCommitOption:l,showBranchOption:b,onScopeChange:R}=a,{t:d}=ze(),[M,w]=i.useState(!1),K=s==="pr"?C??0:s==="staged"?x:s==="turn"?p:s==="branch"?y??0:s==="commit"?j??0:c;let P;e[0]!==s||e[1]!==d?(P=d(s==="pr"?"session.githubIntegration.tabs.pullRequests":s==="staged"?"diffView.scope.staged":s==="turn"?"diffView.scope.lastTurn":s==="branch"?"diffView.scope.branch":s==="commit"?"commitComparison.mode":"diffView.scope.changed"),e[0]=s,e[1]=d,e[2]=P):P=e[2];const f=P;let me;e[3]!==d?(me=d("diffView.scope.selectorAria"),e[3]=d,e[4]=me):me=e[4];let pe;e[5]!==K?(pe=t.jsxs("span",{className:"diff-toolbar__scope-count",children:[": ",K]}),e[5]=K,e[6]=pe):pe=e[6];let te;e[7]!==f||e[8]!==pe?(te=t.jsxs("span",{className:"whitespace-nowrap",children:[f,pe]}),e[7]=f,e[8]=pe,e[9]=te):te=e[9];let v;e[10]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(T,{name:"arrow-down-s",className:"size-4 flex-shrink-0 opacity-60"}),e[10]=v):v=e[10];let E;e[11]!==me||e[12]!==te?(E=t.jsx(as,{asChild:!0,children:t.jsxs("button",{type:"button",className:"flex h-7 flex-shrink-0 items-center gap-1.5 rounded-md px-2 typography-ui-label font-semibold text-foreground outline-none hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-ring","aria-label":me,children:[te,v]})}),e[11]=me,e[12]=te,e[13]=E):E=e[13];let k;e[14]!==R?(k=Q=>{(Q==="working"||Q==="staged"||Q==="turn"||Q==="branch"||Q==="commit"||Q==="pr")&&(R?.(Q),w(!1))},e[14]=R,e[15]=k):k=e[15];let se;e[16]!==d?(se=d("diffView.scope.changed"),e[16]=d,e[17]=se):se=e[17];let J;e[18]!==se?(J=t.jsx("span",{children:se}),e[18]=se,e[19]=J):J=e[19];let le;e[20]!==c?(le=t.jsx("span",{className:"typography-meta text-muted-foreground",children:c}),e[20]=c,e[21]=le):le=e[21];let re;e[22]!==le||e[23]!==J?(re=t.jsx(Ue,{value:"working",children:t.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[J,le]})}),e[22]=le,e[23]=J,e[24]=re):re=e[24];let ce;e[25]!==d?(ce=d("diffView.scope.staged"),e[25]=d,e[26]=ce):ce=e[26];let X;e[27]!==ce?(X=t.jsx("span",{children:ce}),e[27]=ce,e[28]=X):X=e[28];let $;e[29]!==x?($=t.jsx("span",{className:"typography-meta text-muted-foreground",children:x}),e[29]=x,e[30]=$):$=e[30];let ue;e[31]!==X||e[32]!==$?(ue=t.jsx(Ue,{value:"staged",children:t.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[X,$]})}),e[31]=X,e[32]=$,e[33]=ue):ue=e[33];let B;e[34]!==d?(B=d("diffView.scope.lastTurn"),e[34]=d,e[35]=B):B=e[35];let D;e[36]!==B?(D=t.jsx("span",{children:B}),e[36]=B,e[37]=D):D=e[37];let q;e[38]!==p?(q=t.jsx("span",{className:"typography-meta text-muted-foreground",children:p}),e[38]=p,e[39]=q):q=e[39];let G;e[40]!==D||e[41]!==q?(G=t.jsx(Ue,{value:"turn",children:t.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[D,q]})}),e[40]=D,e[41]=q,e[42]=G):G=e[42];let de;e[43]!==y||e[44]!==b||e[45]!==d?(de=b?t.jsx(Ue,{value:"branch",children:t.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[t.jsx("span",{children:d("diffView.scope.branch")}),t.jsx("span",{className:"typography-meta text-muted-foreground",children:y??"…"})]})}):null,e[43]=y,e[44]=b,e[45]=d,e[46]=de):de=e[46];let Y;e[47]!==j||e[48]!==l||e[49]!==d?(Y=l&&t.jsx(Ue,{value:"commit",children:t.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[t.jsx("span",{children:d("commitComparison.mode")}),t.jsx("span",{className:"typography-meta text-muted-foreground",children:j??"…"})]})}),e[47]=j,e[48]=l,e[49]=d,e[50]=Y):Y=e[50];let L;e[51]!==C||e[52]!==l||e[53]!==d?(L=l&&t.jsx(Ue,{value:"pr",children:t.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[t.jsx("span",{children:d("session.githubIntegration.tabs.pullRequests")}),t.jsx("span",{className:"typography-meta text-muted-foreground",children:C??"…"})]})}),e[51]=C,e[52]=l,e[53]=d,e[54]=L):L=e[54];let W;e[55]!==s||e[56]!==re||e[57]!==ue||e[58]!==G||e[59]!==de||e[60]!==Y||e[61]!==L||e[62]!==k?(W=t.jsx(ls,{align:"start",className:"w-40",children:t.jsxs(cs,{value:s,onValueChange:k,children:[re,ue,G,de,Y,L]})}),e[55]=s,e[56]=re,e[57]=ue,e[58]=G,e[59]=de,e[60]=Y,e[61]=L,e[62]=k,e[63]=W):W=e[63];let ve;return e[64]!==M||e[65]!==W||e[66]!==E?(ve=t.jsxs(us,{open:M,onOpenChange:w,children:[E,W]}),e[64]=M,e[65]=W,e[66]=E,e[67]=ve):ve=e[67],ve}),Ls=i.memo(a=>{const e=Ye.c(11),{changedFiles:s,selectedFile:c,onSelectFile:x}=a,{t:p}=ze();if(s.length===0)return null;let y;if(e[0]!==s||e[1]!==x||e[2]!==c||e[3]!==p){let C;e[5]!==x||e[6]!==c||e[7]!==p?(C=l=>{const b=Qt(l),R=c===l.path;return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>x(l.path),className:je("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors",R?"bg-interactive-selection text-interactive-selection-foreground":"text-muted-foreground hover:bg-interactive-hover hover:text-foreground"),children:[t.jsx(Ut,{filePath:l.path,className:"h-3.5 w-3.5 flex-shrink-0"}),t.jsx("span",{className:"typography-micro font-semibold w-4 text-center uppercase",style:{color:b.color},title:p(b.descriptionKey),"aria-label":p(b.descriptionKey),children:b.code}),t.jsx("span",{className:"min-w-0 flex-1 truncate typography-meta",style:{direction:"rtl",textAlign:"left",unicodeBidi:"plaintext"},title:l.path,children:l.path}),Zt(l.insertions,l.deletions)]})},l.path)},e[5]=x,e[6]=c,e[7]=p,e[8]=C):C=e[8],y=s.map(C),e[0]=s,e[1]=x,e[2]=c,e[3]=p,e[4]=y}else y=e[4];let j;return e[9]!==y?(j=t.jsx(Jt,{outerClassName:"flex-1 min-h-0",className:"px-2 py-2",children:t.jsx("ul",{className:"flex flex-col gap-1",children:y})}),e[9]=y,e[10]=j):j=e[10],j}),Ts=i.memo(a=>{const e=Ye.c(20),{filePath:s,diff:c,renderSideBySide:x}=a,{t:p}=ze(),y=c.original.length>0,j=c.modified.length>0,C=x?"flex flex-row gap-6 items-start justify-center":"flex flex-col gap-4 items-center",l=x?"flex flex-col items-center gap-2 flex-1 min-w-0":"flex flex-col items-center gap-2";let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={contain:"layout"},e[0]=b):b=e[0];let R;e[1]!==c.original||e[2]!==s||e[3]!==y||e[4]!==l||e[5]!==x||e[6]!==p?(R=y&&t.jsxs("div",{className:l,children:[t.jsx("span",{className:"typography-meta text-muted-foreground font-medium",children:p("diffView.image.original")}),t.jsx("img",{src:c.original,alt:p("diffView.image.originalAlt",{path:s}),className:x?"max-w-full max-h-[70vh] object-contain":"max-w-full object-contain",style:{imageRendering:"auto"}})]}),e[1]=c.original,e[2]=s,e[3]=y,e[4]=l,e[5]=x,e[6]=p,e[7]=R):R=e[7];let d;e[8]!==c.modified||e[9]!==s||e[10]!==j||e[11]!==y||e[12]!==l||e[13]!==x||e[14]!==p?(d=j&&t.jsxs("div",{className:l,children:[t.jsx("span",{className:"typography-meta text-muted-foreground font-medium",children:p(y?"diffView.image.modified":"diffView.image.new")}),t.jsx("img",{src:c.modified,alt:p("diffView.image.modifiedAlt",{path:s}),className:x?"max-w-full max-h-[70vh] object-contain":"max-w-full object-contain",style:{imageRendering:"auto"}})]}),e[8]=c.modified,e[9]=s,e[10]=j,e[11]=y,e[12]=l,e[13]=x,e[14]=p,e[15]=d):d=e[15];let M;return e[16]!==C||e[17]!==R||e[18]!==d?(M=t.jsx("div",{className:"w-full overflow-auto p-4",style:b,children:t.jsxs("div",{className:C,children:[R,d]})}),e[16]=C,e[17]=R,e[18]=d,e[19]=M):M=e[19],M}),Ms=i.memo(a=>{const e=Ye.c(20),{filePath:s,diff:c,staged:x,renderSideBySide:p,wrapLines:y,hunkActions:j}=a;let C;e[0]!==s?(C=os(s)||"text",e[0]=s,e[1]=C):C=e[1];const l=C;if(c.submodule){let d;return e[2]!==c.submodule||e[3]!==x?(d=t.jsx(qn,{state:c.submodule,staged:x}),e[2]=c.submodule,e[3]=x,e[4]=d):d=e[4],d}if(c.isBinary){let d;return e[5]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ns,{}),e[5]=d):d=e[5],d}if(Xe(s)){let d;return e[6]!==c||e[7]!==s||e[8]!==p?(d=t.jsx(Ts,{filePath:s,diff:c,renderSideBySide:p}),e[6]=c,e[7]=s,e[8]=p,e[9]=d):d=e[9],d}let b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b={contain:"layout"},e[10]=b):b=e[10];let R;return e[11]!==c.fileDiff||e[12]!==c.modified||e[13]!==c.original||e[14]!==s||e[15]!==j||e[16]!==l||e[17]!==p||e[18]!==y?(R=t.jsx("div",{className:"w-full",style:b,children:t.jsx(ms,{original:c.original,modified:c.modified,fileDiff:c.fileDiff,language:l,fileName:s,renderSideBySide:p,wrapLines:y,layout:"inline",hunkActions:j})}),e[11]=c.fileDiff,e[12]=c.modified,e[13]=c.original,e[14]=s,e[15]=j,e[16]=l,e[17]=p,e[18]=y,e[19]=R):R=e[19],R}),Bs=i.memo(({visible:a=!0,directory:e,file:s,layout:c,wrapLines:x,isSelected:p,isExpanded:y,isMounted:j,onSelect:C,onExpandedChange:l,registerSectionRef:b,showOpenInEditorAction:R=!1,isOpeningInEditor:d=!1,onOpenInEditor:M,staged:w=!1,loadFullFiles:K=!1,initialDiffData:P=null,comparisonDiff:f,onRetryComparisonDiff:me,readOnlyActions:pe=!1,hunkActionsEnabled:te=!1})=>{const{t:v}=ze(),{git:E}=$t(),k=ne(i.useCallback(g=>g.directories.get(e)?.diffCache.get(s.path)??null,[e,s.path])),se=ne(g=>g.setDiff),J=ne(g=>g.fetchStatus),le=ae(g=>g.setDiffFileLayout),[re,ce]=i.useState(0),[X,$]=i.useState(null),[ue,B]=i.useState(!1),D=i.useMemo(()=>f?f.status==="error"?{kind:"error",message:f.message}:null:X,[f,X]),q=f?f.status==="loading":ue,[G,de]=i.useState(null),Y=i.useRef(!1),[L,W]=i.useState(null),[ve,Q]=i.useState(!1),[ie,Qe]=i.useState(null),[lt,Fe]=i.useState(null),he=i.useRef(null),mt=i.useRef(null),Oe=i.useMemo(()=>Qt(s),[s]),_e=c==="side-by-side",De=K?"full":"patch",ge=`${s.index}:${s.working_dir}:${s.insertions}:${s.deletions}`,o=te&&!pe&&!P&&!f&&!Xe(s.path),xe=JSON.stringify([Re(),e,s.path,w,ge,re]),z=L?.scope===xe?L.patch:null,Ze=L?.scope===xe?L.submodule:null,U=i.useMemo(()=>f?f.status==="ready"?f.data:null:P||(w?lt:ie||(k?{original:k.original,modified:k.modified,isBinary:k.isBinary,submodule:k.submodule,contextMode:"full"}:null)),[f,k,P,ie,w,lt]),et=U?.contextMode===De,tt=i.useCallback(g=>{mt.current=g,b(s.path,g)},[s.path,b]),nt=i.useCallback(g=>{l(s.path,g)},[s.path,l]),st=i.useCallback(()=>{C(s.path)},[s.path,C]),rt=i.useRef({fileStatusKey:ge,staged:w});i.useEffect(()=>{if(!a)return;const g=rt.current;g.fileStatusKey===ge&&g.staged===w||(rt.current={fileStatusKey:ge,staged:w},w?Fe(null):Qe(null),$(null),he.current=null)},[ge,w,a]),i.useEffect(()=>{if(!a||!y||!j||X)return;if(!e||f||P||U&&et&&(!o||z!==null)){he.current=null,B(!1);return}const g=`${e}::${s.path}::${w?"staged":"unstaged"}::${ge}::${De}::${re}`;if(he.current===g)return;he.current=g,$(null),B(!0);let O=!1;const ye=Re(),Ge=K?Xt:yt,Z=Xe(s.path)?E.getGitFileDiff(e,{path:s.path,staged:w}):!K&&z!==null?Promise.resolve({diff:z,submodule:Ze}):E.getGitDiff(e,{path:s.path,staged:w,contextLines:Ge}),Ve=o&&K&&z===null?E.getGitDiff(e,{path:s.path,staged:w,contextLines:yt}).then(S=>S.diff):Promise.resolve(z),Ie=Promise.all([Z,Ve]),we=vs;let _;const Ee=new Promise((S,He)=>{_=setTimeout(()=>He(new Error(`Timed out after ${we}ms`)),we)});return Promise.race([Ie,Ee]).then(([S,He])=>{if(O||ye!==Re())return;const be="diff"in S&&!K?S.diff:He;if(o&&K&&be!==null&&/^@@\s/m.test(be)&&"diff"in S&&S.diff!==be&&!Mn(S.diff,be))throw W(null),new Error(v("diffView.hunk.unavailable"));if(o&&be!==null&&W({scope:xe,patch:be,submodule:S.submodule}),"diff"in S){const Se={...wt(s.path,S.diff,De),submodule:S.submodule};w?Fe(Se):Qe(Se)}else{const Se={original:S.original??"",modified:S.modified??"",isBinary:S.isBinary,submodule:S.submodule,contextMode:"full"};w?Fe(Se):se(e,s.path,Se,ye)}B(!1)}).catch(S=>{if(!(O||ye!==Re())){if(B(!1),S instanceof Fn){$({kind:"unavailable",reason:S.reason}),S.reason==="path_not_found"&&J(e,E,{force:!0,silent:!0});return}$({kind:"error",message:S instanceof Error?S.message:String(S)})}}).finally(()=>clearTimeout(_)),()=>{O=!0,clearTimeout(_),he.current===g&&(he.current=null)}},[z,Ze,o,xe,f,De,U,et,re,e,J,s.path,ge,E,P,y,j,K,X,se,w,v,a]);const ct=i.useCallback(()=>{nt(!y),st()},[nt,st,y]),Ae=i.useCallback(()=>{$(null),W(null),Qe(null),Fe(null),he.current=null,ce(g=>g+1)},[]),ke=i.useCallback(async(g,O)=>{if(!e||!o||q||D||Y.current||G!==null)return;const ye=z?Bn(z,g):null;if(!ye){Je.error(v("diffView.hunk.unavailable"));return}if(w&&O!=="unstage"||!w&&O==="unstage")return;Y.current=!0;const Ge=Re();de({index:g,action:O});try{const Z=O==="stage"?E.stageGitHunk:O==="unstage"?E.unstageGitHunk:E.revertGitHunk;if(!Z){Je.error(v("diffView.hunk.unsupported"));return}if(await Z(e,s.path,ye),Ge!==Re())return;Ae(),qt.requestGitRefresh({directory:e,paths:[s.path]}),await J(e,E)}catch(Z){if(Ge!==Re())return;Ae(),Je.error(Z instanceof Error&&Z.message?Z.message:v("diffView.hunk.unavailable"))}finally{Y.current=!1,de(Z=>Z?.index===g&&Z.action===O?null:Z)}},[z,o,q,D,e,J,s.path,E,G,Ae,w,v]),Be=i.useMemo(()=>o&&z!==null?In(z):[],[z,o]),Ke=i.useCallback(g=>t.jsx(ys,{index:g,staged:w,busyHunk:G,disabled:q||!!D,onAction:ke}),[D,ke,G,q,w]),it=i.useMemo(()=>Be.length>0?{anchors:Be,render:Ke}:void 0,[Be,Ke]);return t.jsxs("div",{ref:tt,className:"scroll-mt-9 border-b border-[var(--interactive-border)]/40 last:border-b-0",children:[t.jsx("div",{className:"sticky top-0 z-30 border-b border-[var(--interactive-border)]/35 bg-[var(--surface-elevated)]/90 backdrop-blur-md supports-[backdrop-filter]:bg-[var(--surface-elevated)]/80",children:t.jsxs("div",{role:"button",tabIndex:0,onClick:ct,onKeyDown:g=>{g.target===g.currentTarget&&(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),ct())},className:je("cursor-pointer","group/header relative grid min-h-9 w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2 overflow-hidden px-3 py-2","bg-transparent","text-muted-foreground hover:text-foreground",p?"bg-[var(--interactive-selection)]/35":null),children:[t.jsx("div",{className:"absolute inset-0 pointer-events-none group-hover/header:bg-[var(--interactive-hover)]/50"}),t.jsxs("div",{className:"relative flex min-w-0 flex-1 items-center gap-2",children:[t.jsx("span",{className:"flex size-5 items-center justify-center opacity-70 group-hover/header:opacity-100",children:y?t.jsx(T,{name:"arrow-down-s",className:"size-4"}):t.jsx(T,{name:"arrow-right-s",className:"size-4"})}),t.jsx("span",{className:"typography-micro font-semibold leading-none w-4 text-center uppercase",style:{color:Oe.color},title:v(Oe.descriptionKey),"aria-label":v(Oe.descriptionKey),children:Oe.code}),t.jsx("span",{className:"min-w-0 flex-1 overflow-hidden typography-ui-label",title:s.path,children:t.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[t.jsx(Ut,{filePath:s.path,className:"h-3.5 w-3.5 flex-shrink-0 align-middle"}),(()=>{const g=s.path.lastIndexOf("/");if(g===-1)return t.jsx("span",{className:"block min-w-0 truncate typography-ui-label text-foreground",style:{direction:"rtl",textAlign:"left",unicodeBidi:"plaintext"},children:s.path});const O=s.path.slice(0,g),ye=s.path.slice(g+1);return t.jsxs("span",{className:"flex min-w-0 items-baseline overflow-hidden",children:[t.jsx("span",{className:"min-w-0 truncate typography-ui-label text-muted-foreground",style:{direction:"rtl",textAlign:"left",unicodeBidi:"plaintext"},children:O}),t.jsxs("span",{className:"flex-shrink-0 typography-ui-label",children:[t.jsx("span",{className:"text-muted-foreground",children:"/"}),t.jsx("span",{className:"text-foreground",children:ye})]})]})})()]})})]}),t.jsxs("div",{className:"relative flex shrink-0 items-center justify-self-end gap-2",children:[Zt(s.insertions,s.deletions),R&&M?t.jsx(fe,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0 opacity-70 hover:opacity-100",title:v("diffView.actions.openFileInEditorAtChange"),onClick:g=>{g.stopPropagation(),M(s.path,U)},disabled:d,children:d?t.jsx(T,{name:"loader-4",className:"size-3.5 animate-spin"}):t.jsx(T,{name:"edit",className:"size-3.5"})}):null,t.jsx(Wt,{mode:_e?"side-by-side":"unified",onModeChange:g=>{const O=g==="side-by-side"?"side-by-side":"inline";le(s.path,O)},className:"opacity-70"})]})]})}),y&&t.jsxs("div",{className:"relative bg-background overflow-hidden",children:[!j&&!D?t.jsx("div",{className:"h-40 border border-border/40 bg-background/40"}):null,D?.kind==="unavailable"?t.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-sm text-muted-foreground",children:[t.jsx("div",{className:"typography-ui-label font-semibold text-foreground",children:D.reason==="nested_repository"?v("diffView.unavailable.nestedRepositoryTitle"):D.reason==="untracked_directory"?v("diffView.unavailable.untrackedDirectoryTitle"):v("diffView.unavailable.missingTitle")}),t.jsx("div",{className:"typography-meta text-muted-foreground max-w-[32rem] text-center",children:D.reason==="nested_repository"?v("diffView.unavailable.nestedRepositoryDescription"):D.reason==="untracked_directory"?v("diffView.unavailable.untrackedDirectoryDescription"):v("diffView.unavailable.missingDescription")}),D.reason==="path_not_found"?t.jsx("button",{type:"button",className:"typography-ui-label text-primary hover:underline",onClick:Ae,children:v("diffView.actions.retry")}):null]}):null,D?.kind==="error"?t.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-sm text-muted-foreground",children:[t.jsx("div",{className:"typography-ui-label font-semibold text-foreground",children:v("diffView.state.failedToLoadDiff")}),t.jsx("div",{className:"typography-meta text-muted-foreground max-w-[32rem] text-center",children:D.message}),t.jsx("button",{type:"button",className:"typography-ui-label text-primary hover:underline",onClick:()=>f?me?.():Ae(),children:v("diffView.actions.retry")})]}):null,j&&q&&!U&&!D?t.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 py-8 text-sm text-muted-foreground",children:[t.jsx(T,{name:"loader-4",className:"size-4 animate-spin"}),v("diffView.state.loadingDiff")]}):null,j&&U&&!ve&&s.insertions+s.deletions>Pt?t.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-sm text-muted-foreground",children:[t.jsx("div",{className:"typography-ui-label font-semibold text-foreground",children:v("diffView.state.largeDiff",{count:s.insertions+s.deletions})}),t.jsx("div",{className:"typography-meta text-muted-foreground",children:v("diffView.state.largeDiffDescription")}),t.jsx("button",{type:"button",className:"typography-ui-label text-primary hover:underline",onClick:()=>Q(!0),children:v("diffView.actions.renderAnyway")})]}):null,j&&U&&(ve||s.insertions+s.deletions<=Pt)?t.jsx(t.Fragment,{children:t.jsx(Ms,{filePath:s.path,diff:U,staged:w,renderSideBySide:_e,wrapLines:x,hunkActions:it})}):null]})]})}),to=({visible:a=!0,hideStackedFileSidebar:e=!1,stackedDefaultCollapsedAll:s=!1,pinSelectedFileHeaderToTopOnNavigate:c=!1,showOpenInEditorAction:x=!1,diffScope:p="all",onDiffScopeChange:y,targetFilePath:j=null,flushContent:C=!1})=>{const{t:l}=ze(),{git:b,files:R}=$t(),d=Wn(),M=ne(n=>n.runtimeKey),{rootIsGitRepo:w,gitDirectory:K,nestedRepos:P}=Un(d??null,{enabled:a}),f=K??d,me=ae(n=>n.openContextSurface),pe=ps(n=>n.requestSource),{screenWidth:te,isMobile:v}=Jn(),E=Xn(f??null),k=Yn(f??null),se=Qn(f??null),J=ne(n=>n.setActiveDirectory),le=ne(n=>n.ensureStatus),re=ne(n=>n.selectNestedRepo),ce=ne(n=>n.fetchStatus),X=ne(n=>n.fetchBranches),$=ne(n=>n.clearDiffCache),ue=ne(n=>n.setDiff),[B,D]=i.useState(null),[q,G]=i.useState(!1),[de,Y]=i.useState(null),[L,W]=i.useState(()=>new Set),[ve,Q]=i.useState(()=>new Set),[ie,Qe]=i.useState(!1),[lt,Fe]=i.useState(0),[he,mt]=i.useState(()=>new Map),[Oe,_e]=i.useState(!1),[De,ge]=i.useState(!1),[o,xe]=i.useState(p);i.useEffect(()=>{xe(p)},[p]);const z=ae(n=>n.pendingDiffFile),Ze=ae(n=>n.pendingDiffStaged),U=ae(n=>n.pendingDiffScope),et=ae(n=>n.setPendingDiffFile),tt=ae(n=>n.diffLayoutPreference),nt=ae(n=>n.diffFileLayout),st=ae(n=>n.setDiffFileLayout),rt=ae(n=>n.diffWrapLines),ct=ae(n=>n.setDiffWrapLines),Ae=ae(n=>n.openContextFileAtLine),ke=Mt(n=>n.currentSessionId),Be=Zn(o==="turn"?ke??"":"",d??void 0),Ke=rt,it=o==="staged"?!0:o==="working"?!1:null,g=it??q,O=v||te<=768,ye=!!ke&&o!=="turn"&&o!=="commit"&&o!=="pr"&&!O&&!Ce(),Ge=o!=="turn"&&!O&&!Ce(),Z=!e&&!O&&te>=1024,Ve=i.useRef(null),Ie=i.useRef(new Map),we=i.useRef(null),_=i.useRef(null),Ee=i.useRef(!1),S=i.useRef(null),He=i.useRef(null),be=i.useRef(null),Se=i.useRef(null),bt=i.useCallback(()=>{const n=Ve.current;if(!n)return null;const r=n.getBoundingClientRect().top,m=[];for(const[u,h]of Ie.current)h&&m.push({path:u,top:h.getBoundingClientRect().top});return Bt(r,m)},[]),$e=i.useCallback(()=>{we.current=null,Ee.current=!1,Y(null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null)},[]),qe=i.useCallback(n=>{W(r=>{if(r.has(n))return r;const m=new Set(r);return m.add(n),m})},[]),ot=i.useMemo(()=>{for(let n=Be.length-1;n>=0;n-=1){const r=Be[n];if(r.role==="user")return As(r.summary?.diffs)}return[]},[Be]),en=i.useMemo(()=>{const n=new Map;for(const r of ot)if(r.file){if(typeof r.patch=="string"){n.set(r.file,wt(r.file,r.patch,"patch"));continue}n.set(r.file,{original:r.before??"",modified:r.after??"",contextMode:"full"})}return n},[ot]),tn=i.useMemo(()=>k?.files?k.files.filter(Kt).length:0,[k]),nn=i.useMemo(()=>k?.files?k.files.filter(_t).length:0,[k]),sn=ot.length,H=k?.current??null,Le=Dn(f??null,H,a&&o==="pr"&&!Ce()),Te=Le.selectedSource,Me=An(f??null,H,a&&o==="commit"&&!Ce()),Pe=Me.selectedCommit?.hash??null;i.useEffect(()=>{(o==="commit"||o==="pr")&&Ce()&&(xe("working"),y?.("working"))},[o,y]);const We=ne(n=>f?n.directories.get(f)?.branches??null:null),rn=ne(n=>f?n.directories.get(f)?.isLoadingBranches??!1:!1),on=i.useCallback(()=>{f&&X(f,b)},[f,X,b]),an=On(f??null,a&&E!==!1,rn,!!We,on,Ss),jt=i.useMemo(()=>{const n=k?.tracking?.trim().split("/")[0];return(n&&We?.defaultBranches?.[n])??We?.defaultBranches?.origin??null},[We,k?.tracking]),vt=!Ce()&&_n(H,jt),ln=k!==null,kt=Ce()||an||Kn(H,jt,ln,We!==null),cn=Vn(n=>n.setOverride),{base:Ne,resolved:un,revision:St}=En(f??null,H,a&&vt&&o==="branch"),[dn,fn]=i.useState(0);i.useEffect(()=>{const n=$n(o,!kt);n!==o&&(xe(n),n==="working"&&y?.("working"))},[o,kt,y]);const mn=i.useMemo(()=>o==="pr"?Te:o==="commit"&&Pe?{kind:"commit",hash:Pe}:o==="branch"&&Ne&&H?{kind:"branch",baseRef:Ne,headRef:H}:null,[o,Ne,H,Pe,Te]),V=Gn(f??null,mn,a&&!Ce(),o==="branch"?St:""),{fetchDiff:Nt}=V,Ct=o==="commit"?V.files:null,Rt=o==="commit"?V.error:null,ut=o==="branch"?V.files:null,Ft=o==="branch"?V.error:null,Dt=V.files?o==="pr"?JSON.stringify([V.key,V.revision]):V.key:null,pn=i.useMemo(()=>o==="branch"||o==="commit"||o==="pr"?Array.from(L).sort().join("\0"):"",[o,L]),hn=i.useCallback(async n=>{try{const r=ie&&o!=="pr",m=await Nt(n,r?Xt:yt);return{status:"ready",data:wt(n,m.diff,r?"full":"patch")}}catch(r){return{status:"error",message:r instanceof Error?r.message:l("diffView.state.failedToLoadDiff")}}},[o,Nt,ie,l]),gn=Hn(Dt,a?pn:"",Dt?hn:null,Ot,JSON.stringify([o==="branch"?St:"",o==="pr"?V.revision:0,dn,ie])),xn=ut?.length??null,N=i.useMemo(()=>{if(o==="commit"||o==="pr")return(V.files??[]).map(u=>({path:u.path,index:"",working_dir:u.status,insertions:u.insertions,deletions:u.deletions,isNew:u.status==="A"}));if(o==="branch")return(ut??[]).map(u=>({path:u.path,index:"",working_dir:u.status,insertions:0,deletions:0,isNew:u.status==="A"})).sort((u,h)=>u.path.localeCompare(h.path));if(o==="turn")return ot.map(u=>({path:u.file??"",index:"",working_dir:Vs(u.status),insertions:u.additions??0,deletions:u.deletions??0,isNew:u.status==="added"})).filter(u=>u.path).sort((u,h)=>u.path.localeCompare(h.path));if(!k?.files)return[];const n=k.diffStats,r=o==="staged"?_t:o==="working"?Kt:()=>!0,m=u=>{const h=n?.staged?.[u],A=n?.working?.[u];return o==="staged"?{insertions:h?.insertions??0,deletions:h?.deletions??0}:o==="working"?{insertions:A?.insertions??0,deletions:A?.deletions??0}:{insertions:(h?.insertions??0)+(A?.insertions??0),deletions:(h?.deletions??0)+(A?.deletions??0)}};return k.files.filter(r).map(u=>{const h=m(u.path);return{...u,insertions:h.insertions,deletions:h.deletions,isNew:Fs(u)}}).sort((u,h)=>u.path.localeCompare(h.path))},[o,ut,V.files,ot,k]),pt=i.useMemo(()=>N.map(n=>n.path).join("\0"),[N]);i.useEffect(()=>{const n=pt?pt.split("\0"):[],r=new Set(n),m=`${f??""}:${o}:${s?"collapsed":"default"}`,u=He.current!==m;He.current=m,W(h=>{if(u){const I=s?0:ks(n.length);return new Set(n.slice(0,I))}let A=!1;const F=new Set;for(const I of h){if(!r.has(I)){A=!0;continue}F.add(I)}return A?F:h}),Q(h=>{if(u)return new Set;let A=!1;const F=new Set;for(const I of h){if(!r.has(I)){A=!0;continue}F.add(I)}return A?F:h})},[o,pt,f,s]);const At=i.useCallback(()=>{if(S.current=null,!a)return;const n=Ve.current;if(!n)return;const r=n.getBoundingClientRect(),m=r.top-zt,u=r.bottom+zt,h={},A=[];for(const[F,I]of Ie.current){if(!I)continue;const ee=I.getBoundingClientRect();A.push({path:F,top:ee.top}),L.has(F)&&(ee.bottom<m||ee.top>u||(h[F]=!0))}be.current=Bt(r.top,A),Q(F=>{let I=!1;const ee=new Set(F);for(const at of Object.keys(h))ee.has(at)||(ee.add(at),I=!0);return I?ee:F})},[L,a]),oe=i.useCallback(()=>{a&&(typeof window>"u"||S.current===null&&(S.current=window.requestAnimationFrame(At)))},[At,a]);i.useEffect(()=>{const n=Ve.current;if(!(!a||!n))return oe(),n.addEventListener("scroll",oe,{passive:!0}),window.addEventListener("resize",oe),()=>{n.removeEventListener("scroll",oe),window.removeEventListener("resize",oe),S.current!==null&&(window.cancelAnimationFrame(S.current),S.current=null)}},[N,L,oe,a]);const ht=i.useCallback(n=>{const r=nt[n.path];if(r)return r;if(tt==="inline")return"inline";if(tt==="side-by-side")return"side-by-side";const m=te<js;return n.isNew||m?"inline":"side-by-side"},[nt,tt,te]),Vt=i.useMemo(()=>N.length===0?null:N.every(n=>ht(n)==="side-by-side")?"side-by-side":"inline",[N,ht]);i.useEffect(()=>{a&&f&&(J(f),le(f,b))},[f,J,le,b,a]);const dt=JSON.stringify([M,f]),gt=i.useRef({scope:dt,paths:new Set,dirty:!1}),Et=i.useRef(a);i.useEffect(()=>{const n=a&&!Et.current;if(Et.current=a,gt.current.scope!==dt&&(gt.current={scope:dt,paths:new Set,dirty:!1}),!f)return;const r=u=>{u?.length&&(Se.current=bt()??be.current,$(f,u),mt(h=>{const A=new Map(h);for(const F of u)A.set(F,(A.get(F)??0)+1);return A})),ce(f,b,{silent:!0})},m=gt.current;return a&&(n||m.dirty)&&(r([...m.paths]),m.paths.clear(),m.dirty=!1),qt.onGitRefreshHint(u=>{if(Gt(u.directory)===Gt(f)){if(!a){m.dirty=!0;for(const h of u.paths??[])m.paths.add(h);return}r(u.paths)}})},[bt,$,f,ce,b,dt,a]),i.useLayoutEffect(()=>{const n=Se.current;if(!n)return;Se.current=null;const r=Ve.current,m=Ie.current.get(n.path);if(!r||!m)return;const u=r.getBoundingClientRect().top,h=m.getBoundingClientRect().top-u;r.scrollTop=bs(r.scrollTop,n.topOffset,h,r.scrollHeight-r.clientHeight),be.current=n},[he]),i.useEffect(()=>{!a||o!=="all"&&!U||z&&(U&&xe(U),D(z),G(U==="staged"||!U&&Ze),et(null),Ee.current=!0,we.current=z,qe(z),Fe(n=>n+1))},[o,qe,z,U,Ze,et,a]),i.useEffect(()=>{if(o==="all")return;const n=j?.trim();n&&(D(n),G(o==="staged"),Ee.current=!0,we.current=n,qe(n),Fe(r=>r+1))},[o,qe,j]),i.useEffect(()=>{if(!B)return;N.some(r=>r.path===B)||(D(null),G(!1))},[N,B]);const yn=i.useCallback((n,r)=>{const m=Ie.current;r?m.set(n,r):m.delete(n),oe()},[oe]),wn=i.useCallback((n,r)=>{$e(),W(m=>{const u=m.has(n);if(r===u)return m;const h=new Set(m);return r?h.add(n):h.delete(n),h}),r||Q(m=>{if(!m.has(n))return m;const u=new Set(m);return u.delete(n),u}),oe()},[$e,oe]),bn=i.useCallback(()=>{$e(),W(n=>n.size>0?new Set:new Set(N.map(r=>r.path))),Q(new Set),oe()},[$e,N,oe]),jn=i.useCallback(async n=>{if(!ke)return;const r=Mt.getState().getDirectoryForSession(ke)||d||"";if(!r){Je.error(l("diffView.reviewDialog.toast.noSessionDirectory"));return}ge(!0);try{await es({originalSessionID:ke,directory:r,providerID:n.providerID,modelID:n.modelID,agent:n.agent||void 0,variant:n.variant||void 0,generateHandoff:n.generateHandoff,returnAfterHandoffRequest:n.generateHandoff,autoReview:n.autoReview}),_e(!1)}catch(m){console.error("[review-flow] failed to start review flow",m),Je.error(m instanceof Error?m.message:l("diffView.reviewDialog.toast.startFailed"))}finally{ge(!1)}},[ke,d,l]),ft=i.useCallback(n=>{const r=Ie.current.get(n),m=Ve.current;if(!r||!m)return!1;const u=r.getBoundingClientRect().top-m.getBoundingClientRect().top;return m.scrollTo({top:m.scrollTop+u,behavior:"auto"}),!0},[]);i.useEffect(()=>{const n=we.current;if(!a||!n)return;let r=0;const m=20;let u=!1;const h=(F=!0)=>{u||(u=!0,we.current=null,Ee.current=!1,F&&Y(null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null))},A=()=>{if(u){_.current=null;return}const F=we.current;if(!F){h(),_.current=null;return}if(!ft(F)){r+=1,r<m?_.current=window.requestAnimationFrame(A):(h(),_.current=null);return}if(c&&Ee.current){Y(F),h(!1);return}h()};return _.current=window.requestAnimationFrame(A),()=>{u=!0,_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null)}},[c,lt,ft,a]);const vn=i.useCallback(n=>{},[]),xt=i.useCallback(n=>{$e(),D(n),G(!1),Ee.current=!0,we.current=n,qe(n),Fe(r=>r+1),ft(n)},[$e,qe,ft]);i.useEffect(()=>{const n=r=>{if(!a||!r.altKey||r.metaKey||r.ctrlKey||r.shiftKey||r.key!=="ArrowDown"&&r.key!=="ArrowUp")return;const m=r.target;if(m instanceof HTMLElement&&(m.isContentEditable||m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.closest('[role="dialog"]'))||N.length===0)return;const u=r.key==="ArrowDown"?1:-1,h=B?N.findIndex(I=>I.path===B):-1,A=h===-1?u>0?0:N.length-1:h+u,F=N[A];F&&(r.preventDefault(),xt(F.path))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[N,B,xt,a]);const kn=i.useCallback(n=>{const r=n==="side-by-side"?"side-by-side":"inline";N.forEach(m=>{st(m.path,r)})},[N,st]),[Sn,Lt]=i.useState(null),Nn=i.useCallback(async(n,r)=>{if(!f||!n)return;Lt(n);const m=Re();try{let u=null;if(r?.patch&&!r.isBinary&&!Xe(n)?u=It(r.patch):r&&r.contextMode==="full"&&!r.isBinary&&!Xe(n)&&(u=Ht(r.original,r.modified)),u===null)try{const ee=await b.getGitDiff(f,{path:n,staged:g,contextLines:3});u=It(ee.diff)}catch{u=null}let h=r;if(u===null||!h){const ee=await b.getGitFileDiff(f,{path:n,staged:g}),at={original:ee.original??"",modified:ee.modified??"",isBinary:ee.isBinary,submodule:ee.submodule};h=at,g||ue(f,n,at,m)}const A=u??(h.isBinary||Xe(n)?1:Ht(h.original,h.modified)),F=Ds(f,n),I=await hs(R,F,{directory:f});if(!I.ok){Je.error(gs(I.reason));return}Ae(f,F,A,1)}finally{Lt(u=>u===n?null:u)}},[g,f,R,b,Ae,ue]),Cn=()=>{if(!f)return null;const n=r=>it!==null?it:q&&r===B;return t.jsxs("div",{className:je("flex min-w-0 flex-1 min-h-0 h-full",C?"gap-0":"gap-3 px-3 pb-3 pt-2"),children:[Z&&t.jsxs("section",{className:"hidden lg:flex w-72 flex-col rounded-xl border border-border/60 bg-background/70 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/40",children:[t.jsx("span",{className:"typography-ui-header font-semibold text-foreground",children:l("diffView.section.files")}),t.jsx("span",{className:"typography-meta text-muted-foreground",children:N.length})]}),t.jsx(Ls,{changedFiles:N,selectedFile:null,onSelectFile:xt})]}),t.jsx("div",{className:"relative flex-1 min-w-0 min-h-0 h-full",children:t.jsx(Jt,{ref:Ve,outerClassName:"min-h-0 h-full",className:"[overflow-anchor:none] pb-16",disableHorizontal:!0,observeMutations:!1,preventOverscroll:!0,"data-diff-virtual-root":!0,children:t.jsx("div",{className:"flex flex-col [overflow-anchor:none]","data-diff-virtual-content":!0,children:N.map(r=>t.jsx(Bs,{visible:a,directory:f,file:r,layout:ht(r),wrapLines:Ke,isSelected:!1,isExpanded:L.has(r.path),isMounted:ve.has(r.path)||r.path===de,onSelect:vn,onExpandedChange:wn,registerSectionRef:yn,showOpenInEditorAction:x&&o!=="turn",isOpeningInEditor:Sn===r.path,onOpenInEditor:(m,u)=>{Nn(m,u)},staged:n(r.path),loadFullFiles:ie&&o!=="pr",readOnlyActions:o==="branch"||o==="commit"||o==="pr",hunkActionsEnabled:o==="all"||o==="working"||o==="staged",comparisonDiff:o==="branch"||o==="commit"||o==="pr"?gn.get(r.path)??Ot:void 0,onRetryComparisonDiff:()=>fn(m=>m+1),initialDiffData:o==="turn"?en.get(r.path)??null:null},`${Re()}:${f}:${r.path}:${he.get(r.path)??0}`))})})})]})},Rn=()=>{if(!f)return t.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:l("diffView.state.selectSessionDirectory")});if(o!=="turn"&&se&&!k)return t.jsxs("div",{className:"flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground",children:[t.jsx(T,{name:"loader-4",className:"size-4 animate-spin"}),l("diffView.state.loadingRepositoryStatus")]});if(o!=="turn"&&E===!1)return t.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:l("diffView.state.notGitRepository")});if(o==="pr"){if(!Te||V.error)return t.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center",children:[t.jsx("p",{className:"typography-meta text-muted-foreground",children:V.error??Le.error??(Le.loading?l("session.githubPrPicker.loading.pullRequests"):l("pullRequestComparison.select"))}),(V.error||Le.error)&&t.jsx(fe,{variant:"outline",size:"sm",onClick:()=>{Te?V.refresh():Le.refresh()},children:l("diffView.actions.retry")}),!Te&&!Le.loading&&t.jsx(Tt,{comparison:Le})]});if(!V.files)return t.jsxs("div",{className:"flex flex-1 items-center justify-center gap-2 typography-meta text-muted-foreground",children:[t.jsx(T,{name:"loader-4",className:"size-4 animate-spin"}),l("diffView.state.loadingDiff")]})}if(o==="commit"){if(Rt)return t.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center",children:[t.jsx("p",{className:"typography-meta text-muted-foreground",children:Rt}),t.jsx(fe,{variant:"outline",size:"sm",onClick:()=>{V.refresh()},children:l("diffView.actions.retry")})]});if(!Pe&&!Me.loading)return t.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:Me.error??l("commitComparison.noCommits")});if(!Ct)return t.jsxs("div",{className:"flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground",children:[t.jsx(T,{name:"loader-4",className:"size-4 animate-spin"}),l("diffView.state.loadingDiff")]})}if(o==="branch"){if(!un)return t.jsxs("div",{className:"flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground",children:[t.jsx(T,{name:"loader-4",className:"size-4 animate-spin"}),l("diffView.branch.resolvingBase")]});if(!Ne)return t.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-6 text-center",children:[t.jsx(T,{name:"git-branch",className:"size-6 text-muted-foreground"}),t.jsx("div",{className:"typography-ui-label font-semibold text-foreground",children:l("diffView.branch.noBaseTitle")}),t.jsx("div",{className:"max-w-sm typography-micro text-muted-foreground",children:l("gitView.pr.toast.baseBranchRequired")})]});if(Ft)return t.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-6 text-center",children:[t.jsx("div",{className:"typography-ui-label font-semibold text-foreground",children:l("diffView.branch.loadError")}),t.jsx("div",{className:"max-w-sm typography-micro text-muted-foreground",children:Ft}),t.jsx(fe,{variant:"outline",size:"sm",onClick:()=>{V.refresh()},children:l("diffView.actions.retry")})]});if(ut===null)return t.jsxs("div",{className:"flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground",children:[t.jsx(T,{name:"loader-4",className:"size-4 animate-spin"}),l("diffView.branch.loadingFiles")]})}return N.length===0?t.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:o==="turn"?l("diffView.state.noLastTurnChanges"):o==="pr"?l("walkthrough.blocked.emptyDiff.description"):o==="commit"?l("commitComparison.emptyDiff"):o==="branch"&&Ne?l("diffView.branch.empty",{base:fs(Ne)}):l("diffView.state.cleanWorkingTree")}):Cn()};return t.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-background",children:[t.jsxs("div",{className:"@container/diff-toolbar flex min-w-0 items-center gap-2 px-3 py-2 bg-background",children:[w===!1&&Array.isArray(P)&&P.length>0?t.jsx(ds,{repositories:P,selectedRepository:K??null,onSelectRepository:n=>{d&&re(d,n)},repositoryRoot:d??void 0}):null,!v&&(o!=="all"?t.jsx(Es,{scope:o,workingCount:tn,stagedCount:nn,turnCount:sn,branchCount:xn,commitCount:o==="commit"?Ct?.length??null:null,prCount:o==="pr"?V.files?.length??null:null,showCommitOption:!Ce(),showBranchOption:vt,onScopeChange:n=>{xe(n),y?.(n)}}):t.jsx("div",{className:"flex items-center gap-1 rounded-md px-2 py-1 text-muted-foreground shrink-0",children:t.jsx("span",{className:"typography-ui-label font-semibold text-foreground",children:se&&!k?l("diffView.state.loadingChanges"):N.length===1?l("diffView.summary.changedFilesSingle",{count:N.length}):l("diffView.summary.changedFilesPlural",{count:N.length})})})),o==="branch"&&t.jsx(Ln,{branches:We?.all??[],currentBranch:H,base:Ne,onSelect:n=>{f&&H&&cn(f,H,n)}},JSON.stringify([f,H])),o==="commit"&&t.jsx(Tn,{commits:Me.commits,selectedHash:Pe,loading:Me.loading,error:Me.error,onSelect:Me.select,onRefresh:()=>{Me.refresh()}},JSON.stringify([f,H])),o==="pr"&&t.jsxs(t.Fragment,{children:[t.jsx(Tt,{comparison:Le},JSON.stringify([M,f,H])),Te&&t.jsx(fe,{variant:"ghost",size:"sm",disabled:V.loading,"aria-label":l("session.githubIssuePicker.actions.refresh"),title:l("session.githubIssuePicker.actions.refresh"),onClick:()=>{V.refresh()},children:t.jsx(T,{name:"refresh",className:"size-4"})})]}),N.length>0&&t.jsxs(fe,{variant:"ghost",size:"sm",onClick:bn,className:je("diff-toolbar__expand-button h-7 flex-shrink-0 gap-1 px-1.5 text-muted-foreground hover:text-foreground","ml-auto"),title:L.size>0?l("diffView.actions.collapseAll"):l("diffView.actions.expandAll"),children:[t.jsx(T,{name:"expand-up-down",className:"size-4"}),t.jsx("span",{className:"diff-toolbar__expand-label typography-ui-label",children:L.size>0?l("diffView.actions.collapseAll"):l("diffView.actions.expandAll")})]}),N.length>0&&ye&&t.jsxs(fe,{variant:"default",size:"sm",onClick:()=>_e(!0),disabled:De,className:"diff-toolbar__review-button h-7 flex-shrink-0 gap-1.5 px-2","aria-label":l("diffView.actions.reviewAria"),children:[De?t.jsx(T,{name:"loader-4",className:"size-4 animate-spin"}):t.jsx(T,{name:"search-eye",className:"size-4"}),t.jsx("span",{className:"diff-toolbar__review-label typography-ui-label",children:l("diffView.actions.review")})]}),N.length>0&&Ge&&t.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>{const n=f??"";pe(n,o==="pr"&&Te?Te:o==="commit"&&Pe?{kind:"commit",hash:Pe}:o==="branch"&&Ne&&H?{kind:"branch",baseRef:Ne,headRef:H}:{kind:"working-tree",scope:o==="staged"||o==="working"?o:"all"}),me(d??n,"walkthrough")},className:je("diff-toolbar__walkthrough-button h-7 flex-shrink-0 gap-1.5 px-2",xs),"aria-label":l("walkthrough.action.open"),children:[t.jsx(T,{name:"route",className:"size-4"}),t.jsx("span",{className:"diff-toolbar__walkthrough-label typography-ui-label",children:l("walkthrough.action.open")})]}),N.length>0&&o!=="pr"&&t.jsxs(ts,{children:[t.jsx(ns,{asChild:!0,children:t.jsx(fe,{variant:"ghost",size:"sm",onClick:()=>Qe(n=>!n),"aria-pressed":ie,"aria-label":l(ie?"diffView.actions.disableFullFiles":"diffView.actions.loadFullFiles"),className:je("h-7 w-7 flex-shrink-0 p-0 text-muted-foreground hover:text-foreground",ie&&"bg-interactive-selection text-interactive-selection-foreground"),children:t.jsx(T,{name:"file-download",className:"size-4"})})}),t.jsx(ss,{children:t.jsx("p",{children:l(ie?"diffView.actions.disableFullFiles":"diffView.actions.loadFullFiles")})})]}),N.length>0&&t.jsx(fe,{variant:"ghost",size:"sm",onClick:()=>ct(!rt),className:je("h-5 w-5 p-0 transition-opacity",Ke?"text-foreground opacity-100":"text-muted-foreground opacity-60 hover:opacity-100"),title:l(Ke?"diffView.actions.disableLineWrap":"diffView.actions.enableLineWrap"),children:t.jsx(T,{name:"text-wrap",className:"size-4"})}),Vt&&t.jsx(Wt,{mode:Vt==="side-by-side"?"side-by-side":"unified",onModeChange:kn})]}),t.jsx(rs,{open:Oe,onOpenChange:_e,projectDirectory:f??null,submitting:De,onConfirm:jn}),Rn()]})};export{to as DiffView,Bs as MultiFileDiffEntry};
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import{R as I,j as M,c as ye,r as l}from"./vendor-react-BUCujlKS.js";import{a as Ke}from"./web-components-D7FinaeH.js";import{f as Ie}from"./computeVirtualFileMetrics-VYnT_A2h.js";import{V as Ye,F as Xe}from"./VirtualizedFileDiff-CZgXWHjU.js";import{V as Je}from"./Virtualizer-D_a8gKmg.js";import{eL as Qe,eM as ze,bg as Ze,c5 as et,h as Ne}from"./useAppFontEffects-BItUWdo4.js";import{I as He,a as tt,u as nt}from"./useInlineCommentController-CkbKsm7m.js";import"./index-DLHQogv8.js";import{ag as rt}from"./runtimeEndpointReset-DhC3REb2.js";import{ensurePierreThemeRegistered as $e,getResolvedShikiTheme as qe}from"./appThemeRegistry-Cf8KitzT.js";const ve=i=>{if(i.type==="new"){const n=Math.min(i.selection.start,i.selection.end),r=Math.max(i.selection.start,i.selection.end);return`new-comment-${i.selection.side??"additions"}-${n}-${r}`}return`draft-${i.draft.id}`},it=i=>{const{drafts:n,editingDraftId:r,selection:a}=i,d=[];for(const w of n){if(!Number.isFinite(w.endLine))continue;const E=Math.max(1,Math.floor(w.endLine)),C=w.side==="original"?"deletions":"additions";d.push({lineNumber:E,side:C,metadata:{type:w.id===r?"edit":"saved",draft:w}})}return a&&!r&&d.push({lineNumber:Math.max(a.start,a.end),side:a.side??"additions",metadata:{type:"new",selection:a}}),d};function ot(i){const n=i.trim();if(!n)return null;if(/^-?\d+(\.\d+)?$/.test(n)){const r=Number.parseFloat(n);return Number.isFinite(r)?r:null}if(n.endsWith("px")){const r=Number.parseFloat(n.slice(0,-2));return Number.isFinite(r)?r:null}return null}function Be(i){if(!(!i||i<=0))return Math.max(200,Math.floor(i))}function st(i){const{diffRootRef:n,drafts:r,selection:a,editingDraftId:d,commentText:w,onTextChange:E,fileLabel:C,onSave:u,onCancel:$,onEdit:z,onDelete:N}=i,[V,O]=I.useState(0),[ee,P]=I.useState(null),H=I.useMemo(()=>!a||d?null:ve({type:"new",selection:a}),[d,a]),te=I.useMemo(()=>{const o=r.map(b=>ve({type:b.id===d?"edit":"saved",draft:b}));return H&&o.push(H),o},[r,d,H]),K=I.useCallback(o=>{const b=n.current;if(!b)return null;const S=b.querySelector("diffs-container");if(!(S instanceof HTMLElement))return null;const k=S.querySelector(`[data-annotation-id="${o}"]`);if(k instanceof HTMLElement)return k;const T=S.shadowRoot;return T?T.querySelector(`[data-annotation-id="${o}"]`):null},[n]);I.useEffect(()=>{if(te.length===0)return;let o=!1,b=0;const S=12,k=()=>{o||te.every(F=>!!K(F))||b>=S||(b+=1,requestAnimationFrame(()=>{o||(O(F=>F+1),k())}))};return k(),()=>{o=!0}},[te,K]),I.useEffect(()=>{const o=n.current;if(!o)return;const b=()=>{const k=getComputedStyle(o),T=ot(k.getPropertyValue("--oc-context-panel-width")),F=o.getBoundingClientRect(),W=T??F.width;P(W>0?W:null)};b();const S=new ResizeObserver(()=>{b()});return S.observe(o),window.addEventListener("resize",b),()=>{S.disconnect(),window.removeEventListener("resize",b)}},[n]);const Y=I.useCallback(o=>{const S=n.current?.getBoundingClientRect(),k=o.closest("[data-annotation-content]"),T=k instanceof HTMLElement?k.getBoundingClientRect():o.getBoundingClientRect(),F=[T.width];S&&F.push(S.right-T.left);const W=F.filter(ce=>Number.isFinite(ce)&&ce>0);return W.length>0?Be(Math.min(...W)):Be(ee)},[n,ee]);return M.jsxs(M.Fragment,{children:[r.map(o=>{const b=ve({type:o.id===d?"edit":"saved",draft:o}),S=K(b);if(!S)return null;const k=Y(S);return o.id===d?ye.createPortal(M.jsx(He,{initialText:w,onTextChange:E,fileLabel:C,lineRange:{start:o.startLine,end:o.endLine,side:o.side==="original"?"deletions":"additions"},isEditing:!0,onSave:u,onCancel:$,maxWidth:k}),S,`draft-edit-${o.id}`):ye.createPortal(M.jsx(tt,{draft:o,onEdit:()=>z(o),onDelete:()=>N(o),maxWidth:k}),S,`draft-card-${o.id}`)}),a&&!d&&H&&(()=>{const o=K(H);if(!o)return null;const b=Y(o);return ye.createPortal(M.jsx(He,{initialText:w,onTextChange:E,fileLabel:C,lineRange:a,isEditing:!1,onSave:u,onCancel:$,maxWidth:b}),o,H)})()]})}const De=[],at=`
|
|
2
|
-
[data-gutter-buffer="annotation"] { min-height: 0; }
|
|
3
|
-
[data-code] { min-height: 2.5rem; align-content: start; }
|
|
4
|
-
`,Oe=5e5,lt=`
|
|
5
|
-
:host {
|
|
6
|
-
font-family: var(--font-mono);
|
|
7
|
-
font-size: var(--text-code);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
pre, [data-code] {
|
|
11
|
-
font-family: var(--font-mono);
|
|
12
|
-
font-size: var(--text-code);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/* Mobile touch selection support */
|
|
16
|
-
[data-line-number] {
|
|
17
|
-
touch-action: manipulation;
|
|
18
|
-
-webkit-tap-highlight-color: transparent;
|
|
19
|
-
cursor: pointer;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/* Ensure interactive line numbers work on touch */
|
|
23
|
-
pre[data-interactive-line-numbers] [data-line-number] {
|
|
24
|
-
touch-action: manipulation;
|
|
25
|
-
}
|
|
26
|
-
`,We=`
|
|
27
|
-
${lt}
|
|
28
|
-
|
|
29
|
-
/* While a multi-line content drag is being mapped to a line selection the
|
|
30
|
-
row highlight is the feedback; the native blue text selection on top of
|
|
31
|
-
it reads as double-selection, so it is painted transparent for the drag's
|
|
32
|
-
duration only (single-line selections keep the normal look for copying). */
|
|
33
|
-
:host([data-oc-comment-drag]) {
|
|
34
|
-
user-select: none;
|
|
35
|
-
-webkit-user-select: none;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/* Gutter "+" comment utility: theme primary, and smaller than Pierre's
|
|
39
|
-
1lh default, which reads oversized next to our 13px line numbers. */
|
|
40
|
-
[data-utility-button] {
|
|
41
|
-
width: 16px;
|
|
42
|
-
height: 16px;
|
|
43
|
-
align-self: center;
|
|
44
|
-
margin-right: calc(-16px + 1ch);
|
|
45
|
-
border-radius: 5px;
|
|
46
|
-
background-color: var(--primary-base);
|
|
47
|
-
color: var(--primary-foreground);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
:host {
|
|
51
|
-
--diffs-bg-separator-override: var(--surface-elevated);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
[data-diff-header],
|
|
55
|
-
[data-diff] {
|
|
56
|
-
[data-separator] {
|
|
57
|
-
height: 24px !important;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
[data-separator="line-info-basic"] {
|
|
62
|
-
height: 24px !important;
|
|
63
|
-
background: var(--diffs-bg) !important;
|
|
64
|
-
position: relative;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
[data-diff-type="single"] [data-gutter],
|
|
68
|
-
[data-diff-type="split"] [data-deletions] [data-gutter] {
|
|
69
|
-
[data-separator-wrapper] {
|
|
70
|
-
position: absolute;
|
|
71
|
-
left: 100%;
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
gap: unset;
|
|
75
|
-
width: max-content;
|
|
76
|
-
background: transparent;
|
|
77
|
-
color: var(--diffs-fg-number);
|
|
78
|
-
font-family: var(--diffs-header-font-family, var(--font-sans));
|
|
79
|
-
font-size: 0.75rem;
|
|
80
|
-
line-height: 1;
|
|
81
|
-
margin-left: calc(-2ch - 2px);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
[data-separator-wrapper][data-separator-multi-button] {
|
|
85
|
-
margin-left: calc(-3ch - 2px);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
[data-expand-button],
|
|
89
|
-
[data-separator-content] {
|
|
90
|
-
display: block;
|
|
91
|
-
align-self: unset;
|
|
92
|
-
min-width: unset;
|
|
93
|
-
min-height: unset;
|
|
94
|
-
padding: 0;
|
|
95
|
-
flex-shrink: 0;
|
|
96
|
-
grid-column: unset;
|
|
97
|
-
border: none;
|
|
98
|
-
width: auto;
|
|
99
|
-
height: auto;
|
|
100
|
-
background-color: transparent;
|
|
101
|
-
color: inherit;
|
|
102
|
-
font: inherit;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
[data-expand-button]:not([data-expand-all-button]) {
|
|
106
|
-
&[data-expand-down]::before {
|
|
107
|
-
content: '\\2191';
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
&[data-expand-up]::before {
|
|
111
|
-
content: '\\2193';
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
&[data-expand-both]::before {
|
|
115
|
-
content: '\\2195';
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
svg {
|
|
119
|
-
display: none;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
[data-separator-content] {
|
|
124
|
-
background: transparent;
|
|
125
|
-
margin-left: calc(2px + 1ch);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
[data-expand-all-button] {
|
|
129
|
-
position: relative;
|
|
130
|
-
margin-left: 14px;
|
|
131
|
-
text-transform: lowercase;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
[data-expand-all-button]::before {
|
|
135
|
-
content: '';
|
|
136
|
-
display: block;
|
|
137
|
-
position: absolute;
|
|
138
|
-
top: 50%;
|
|
139
|
-
left: -8px;
|
|
140
|
-
margin-top: -1px;
|
|
141
|
-
width: 3px;
|
|
142
|
-
height: 3px;
|
|
143
|
-
border-radius: 2px;
|
|
144
|
-
background-color: var(--diffs-fg-number);
|
|
145
|
-
pointer-events: none;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
[data-separator-content]:hover,
|
|
149
|
-
[data-expand-button]:hover,
|
|
150
|
-
[data-expand-all-button]:hover {
|
|
151
|
-
color: var(--diffs-fg);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
[data-expand-all-button]:hover {
|
|
155
|
-
text-decoration: underline;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
`;function ct(i){let n=2166136261;for(let r=0;r<i.length;r+=1)n^=i.charCodeAt(r),n=n+((n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24))>>>0;return n.toString(16)}function je(i){const n=i.length>400?`${i.slice(0,200)}${i.slice(-200)}`:i;return`${i.length}:${ct(n)}`}const dt=(i,n,r,a)=>{const d=a.side==="deletions",E=(r?(d?r.deletionLines:r.additionLines).join(""):d?i:n).split(`
|
|
159
|
-
`),C=Math.min(a.start,a.end),u=Math.max(a.start,a.end),$=Math.max(1,C),z=Math.min(E.length,u);return $>z?"":E.slice($-1,z).join(`
|
|
160
|
-
`)},ut=(i,n)=>i===n?!0:!i||!n?!1:i.start===n.start&&i.end===n.end&&i.side===n.side,ft=i=>i==="auto"||i==="scroll"||i==="overlay",ht=i=>{let n=i?.parentElement??null;for(;n;){const r=window.getComputedStyle(n);if(ft(r.overflowY))return n;n=n.parentElement}return null},mt=(i,n)=>{if(!i||!n||typeof window>"u")return()=>{};const r=ht(i);if(!r)return()=>{};const a=n.getBoundingClientRect().height;if(!a)return()=>{};const d=i.getBoundingClientRect().top-r.getBoundingClientRect().top,w=n.style.minHeight;n.style.minHeight=`${Math.ceil(a)}px`;let E=!1;return()=>{if(E)return;E=!0,n.style.minHeight=w;const u=i.getBoundingClientRect().top-r.getBoundingClientRect().top-d;u&&(r.scrollTop+=u)}},pt=(i,n)=>{if(typeof window>"u")return()=>{};let r=null,a=null,d=!1;const w=()=>{d||(a?.disconnect(),a=null,r=window.requestAnimationFrame(()=>{r=window.requestAnimationFrame(()=>{d||n()})}))},E=()=>i.querySelector("diffs-container")?.shadowRoot??void 0,C=(u=E())=>!!u?.querySelector("[data-line]");return C()?w():typeof MutationObserver<"u"?(a=new MutationObserver(()=>{const u=E();if(u){if(C(u)){w();return}a?.disconnect(),a=new MutationObserver(()=>{C(u)&&w()}),a.observe(u,{childList:!0,subtree:!0})}}),a.observe(i,{childList:!0,subtree:!0})):r=window.requestAnimationFrame(w),()=>{d=!0,a?.disconnect(),r!==null&&window.cancelAnimationFrame(r)}},ge=new WeakMap,gt={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function yt(i){const n=i.closest("[data-diff-virtual-root]");if(n instanceof HTMLElement){const r=n.querySelector("[data-diff-virtual-content]");return{key:n,root:n,content:r instanceof HTMLElement?r:void 0}}return{key:document,root:document,content:void 0}}function vt(i){if(typeof document>"u")return null;const n=yt(i);let r=ge.get(n.key);if(!r){const d=new Je;d.setup(n.root,n.content),r={virtualizer:d,refs:0},ge.set(n.key,r)}r.refs+=1;let a=!1;return{virtualizer:r.virtualizer,root:n.root,release:()=>{if(a)return;a=!0;const d=ge.get(n.key);d&&(d.refs-=1,!(d.refs>0)&&(d.virtualizer.cleanUp(),ge.delete(n.key)))}}}const bt=(i,n,r)=>{if(typeof window>"u")return()=>{};const a=[],d=()=>{try{i.rerender()}catch{}const w=n?.root;w instanceof HTMLElement?w.dispatchEvent(new Event("scroll",{bubbles:!1})):document.dispatchEvent(new Event("scroll",{bubbles:!1})),window.dispatchEvent(new Event("resize")),r()};return a.push(window.requestAnimationFrame(d)),a.push(window.requestAnimationFrame(()=>{a.push(window.requestAnimationFrame(d))})),()=>{for(const w of a)window.cancelAnimationFrame(w)}},Pt=({original:i,modified:n,fileDiff:r,language:a,fileName:d,renderSideBySide:w,wrapLines:E,layout:C="fill",enableComments:u=!0,hunkActions:$})=>{const z=Qe(),N=z?.currentTheme.metadata.variant==="dark",V=z?.availableThemes.find(e=>e.metadata.id===z.lightThemeId)??ze(!1),O=z?.availableThemes.find(e=>e.metadata.id===z.darkThemeId)??ze(!0),{isMobile:ee}=Ze(),P=$?.anchors??De,[H,te]=I.useState(()=>({fileDiff:void 0,anchors:De,targets:new Map})),K=nt({source:"diff",fileLabel:d||"unknown",language:a,getCodeForRange:e=>dt(i,n,r,e),toStoreRange:e=>({startLine:e.start,endLine:e.end,side:e.side==="deletions"?"original":"modified"}),fromDraftRange:e=>({start:e.startLine,end:e.endLine,side:e.side==="original"?"deletions":"additions"})}),{drafts:Y,selection:o,setSelection:b,commentText:S,setCommentText:k,editingDraftId:T,saveComment:F,cancel:W,startEdit:ce,deleteDraft:Ve}=K,de=l.useRef(null),U=l.useRef(null),ne=l.useRef(""),q=l.useRef(!1),ue=l.useRef(null);l.useEffect(()=>{de.current=o},[o]),l.useEffect(()=>{U.current=T},[T]),l.useEffect(()=>{ne.current=S},[S]);const fe=l.useCallback(e=>{if(!u||q.current)return;const t=de.current;if(!(!e&&t&&ne.current.trim())){if(ee&&t&&e&&e.side===t.side){const s=Math.min(t.start,e.start),c=Math.max(t.end,e.end);b({...e,start:s,end:c})}else b(e);e&&(U.current||k(""))}},[u,ee,k,b]),Ue=l.useCallback(()=>{W()},[W]),Ee=l.useCallback(e=>{const t=document.createElement("div");if(t.style.position="relative",e.metadata.type==="hunk-action")return t.dataset.hunkActionTarget=String(e.metadata.index),t.style.height="0px",t;const s=ve(e.metadata);return t.dataset.annotationId=s,t.dataset.annotationSide=e.side,t.dataset.annotationLine=String(e.lineNumber),t},[]),Te=l.useCallback((e,t,s)=>{const c=new Map;if(s!=="unmount"){const f=Number.parseFloat(getComputedStyle(document.documentElement).fontSize)*2,y=new Map,x=[];for(const R of e.shadowRoot?.querySelectorAll("slot")??[])for(const L of R.assignedElements()){const v=L.querySelector("[data-hunk-action-target]"),h=Number(v?.dataset.hunkActionTarget);if(!v||!Number.isInteger(h)||h<0)continue;c.set(h,v);const m=R.closest("[data-code]");if(!m)continue;let g=y.get(m);g||(g=m.getBoundingClientRect(),y.set(m,g));const j=v.getBoundingClientRect().top,ae=Math.max(g.top+4,Math.min(j+4,g.bottom-f-4));x.push({target:v,offset:ae-j})}for(const{target:R,offset:L}of x){const v=`${L}px`;R.style.getPropertyValue("--oc-hunk-action-offset")!==v&&R.style.setProperty("--oc-hunk-action-offset",v)}}const p=t.fileDiff;te(f=>f.fileDiff===p&&f.anchors===P&&f.targets.size===c.size&&[...c].every(([y,x])=>f.targets.get(y)===x)?f:{fileDiff:p,anchors:P,targets:c})},[P]),_e=l.useCallback((e,t)=>{F(e,t??o??void 0)},[F,o]),_=l.useCallback(e=>{b(e);const t=A.current;if(t)try{q.current=!0,t.setSelectedLines(e),ue.current=e}catch{}finally{q.current=!1}},[b]),re=l.useRef(null),be=l.useRef(null);l.useEffect(()=>{if(!u)return;const e=J.current;if(!e)return;const t=()=>{const h=e.querySelector("diffs-container");return h instanceof HTMLElement?h.shadowRoot:null},s=h=>{const m=e.querySelector("diffs-container");m instanceof HTMLElement&&(h?m.setAttribute("data-oc-comment-drag",""):m.removeAttribute("data-oc-comment-drag"))},c=(h,m)=>{const j=t()?.elementFromPoint(h,m)??document.elementFromPoint(h,m);if(!(j instanceof Element))return null;const ae=!!j.closest("[data-column-number]"),le=j.closest("[data-line]");if(!(le instanceof HTMLElement))return null;const Le=Number.parseInt(le.getAttribute("data-line")??"",10);if(!Number.isFinite(Le)||Le<=0)return null;const Ge=le.getAttribute("data-line-type")==="change-deletion"||le.closest("[data-code][data-deletions]")!=null?"deletions":"additions";return{line:Le,side:Ge,numberColumn:ae}};let p=null,f=!1,y=null;const x=h=>{re.current=h;const m=A.current;if(m)try{q.current=!0,m.setSelectedLines(h)}catch{}finally{q.current=!1}},R=h=>{if(h.button!==0||h.pointerType!=="mouse")return;const m=c(h.clientX,h.clientY);if(!m||m.numberColumn){p=null;return}p={line:m.line,side:m.side},f=!1,y=h.pointerId},L=h=>{if(p==null||h.pointerId!==y)return;const m=c(h.clientX,h.clientY);if(m){if(!f){if(m.line===p.line)return;f=!0,s(!0),window.getSelection()?.removeAllRanges();const g=t();g&&"getSelection"in g&&g.getSelection()?.removeAllRanges()}x({start:Math.min(p.line,m.line),end:Math.max(p.line,m.line),side:p.side})}},v=h=>{if(p==null||h.pointerId!==y)return;const m=f;if(p=null,f=!1,y=null,s(!1),!m)return;const g=re.current;re.current=null,g&&(de.current&&ne.current.trim()&&!U.current||(_(g),U.current||k("")))};return e.addEventListener("pointerdown",R),document.addEventListener("pointermove",L,{passive:!0}),document.addEventListener("pointerup",v),()=>{e.removeEventListener("pointerdown",R),document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",v),s(!1)}},[_,u,k]);const Me=l.useCallback(e=>{if(!u)return;const t=re.current,s=t&&e.start>=t.start&&e.end<=t.end&&(e.side==null||e.side===t.side);be.current!==null&&(window.clearTimeout(be.current),be.current=null),re.current=null,_(s&&t?t:e),U.current||k("")},[_,u,k]),Ce=l.useCallback(e=>{if(!u||e.numberColumn||window.getSelection()?.toString().trim())return;const t=e.annotationSide,s={start:e.lineNumber,end:e.lineNumber,side:t},c=de.current;if(c&&c.start===s.start&&c.end===s.end&&c.side===s.side){if(!ne.current.trim()){b(null);const p=A.current;try{q.current=!0,p?.setSelectedLines(null)}finally{q.current=!1}}return}c&&ne.current.trim()&&!U.current||(_(s),U.current||k(""))},[_,u,k,b]),Pe=l.useCallback(e=>{const t=e.closest("[data-line-type]")?.getAttribute("data-line-type")??e.getAttribute("data-line-type");if(t==="change-deletion")return"deletions";if(t==="change-addition")return"additions";const s=e.getAttribute("data-column-side")??e.getAttribute("data-side")??e.closest("[data-column-side]")?.getAttribute("data-column-side");if(s==="deletions"||s==="left"||s==="original")return"deletions";if(s==="additions"||s==="right"||s==="modified")return"additions";const c=e.closest("[data-line-type]");if(c instanceof HTMLElement){const p=c.getBoundingClientRect(),f=e.getBoundingClientRect(),y=p.left+p.width/2;return f.left+f.width/2<y?"deletions":"additions"}return"additions"},[]);$e(V),$e(O);const X=`${V.metadata.id}:${O.metadata.id}:${N?"dark":"light"}`,ie=l.useMemo(()=>{if(r){const e=r.deletionLines.reduce((s,c)=>s+c.length,0),t=r.additionLines.reduce((s,c)=>s+c.length,0);return Math.max(e,t)>Oe}return Math.max(i.length,n.length)>Oe},[r,n.length,i.length]),J=l.useRef(null),Q=l.useRef(null),A=l.useRef(null),oe=l.useRef(null),we=l.useRef(null),ke=l.useRef(null),Re=l.useRef(void 0),he=l.useRef(void 0),me=l.useRef(void 0),pe=l.useRef(void 0),[,xe]=I.useReducer(e=>e+1,0),Z=rt(ie?"unified":w?"split":"unified"),B=l.useMemo(()=>qe(V),[V]),D=l.useMemo(()=>qe(O),[O]);I.useLayoutEffect(()=>{const e=J.current;if(!e)return;const t=e.querySelector("diffs-container");if(!t)return;const s=N?D:B,c=(j,ae)=>j.colors?.[ae],p=c(B,"terminal.ansiGreen"),f=c(B,"terminal.ansiRed"),y=c(B,"terminal.ansiBlue"),x=c(D,"terminal.ansiGreen"),R=c(D,"terminal.ansiRed"),L=c(D,"terminal.ansiBlue");t.style.setProperty("--shiki-light",B.fg),t.style.setProperty("--shiki-light-bg",B.bg),p&&t.style.setProperty("--shiki-light-addition-color",p),f&&t.style.setProperty("--shiki-light-deletion-color",f),y&&t.style.setProperty("--shiki-light-modified-color",y),t.style.setProperty("--shiki-dark",D.fg),t.style.setProperty("--shiki-dark-bg",D.bg),x&&t.style.setProperty("--shiki-dark-addition-color",x),R&&t.style.setProperty("--shiki-dark-deletion-color",R),L&&t.style.setProperty("--shiki-dark-modified-color",L),t.style.setProperty("--diffs-bg",s.bg),t.style.setProperty("--diffs-fg",s.fg);const v=N?x:p,h=N?R:f,m=N?L:y;v&&t.style.setProperty("--diffs-addition-color-override",v),h&&t.style.setProperty("--diffs-deletion-color-override",h),m&&t.style.setProperty("--diffs-modified-color-override",m);const g=t.shadowRoot?.querySelector("pre");g&&(g.style.setProperty("--shiki-light",B.fg),g.style.setProperty("--shiki-light-bg",B.bg),p&&g.style.setProperty("--shiki-light-addition-color",p),f&&g.style.setProperty("--shiki-light-deletion-color",f),y&&g.style.setProperty("--shiki-light-modified-color",y),g.style.setProperty("--shiki-dark",D.fg),g.style.setProperty("--shiki-dark-bg",D.bg),x&&g.style.setProperty("--shiki-dark-addition-color",x),R&&g.style.setProperty("--shiki-dark-deletion-color",R),L&&g.style.setProperty("--shiki-dark-modified-color",L),g.style.setProperty("--diffs-bg",s.bg),g.style.setProperty("--diffs-fg",s.fg),v&&g.style.setProperty("--diffs-addition-color-override",v),h&&g.style.setProperty("--diffs-deletion-color-override",h),m&&g.style.setProperty("--diffs-modified-color-override",m))},[D,X,N,B]);const G=l.useMemo(()=>({theme:{dark:O.metadata.id,light:V.metadata.id},themeType:N?"dark":"light",diffStyle:w?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",maxLineDiffLength:ie?0:1e3,maxLineLengthForHighlighting:ie?1:1e3,tokenizeMaxLineLength:ie?1:1e3,collapsedContextThreshold:0,expansionLineCount:20,overflow:E?"wrap":"scroll",disableFileHeader:!0,enableLineSelection:u,enableGutterUtility:u,onGutterUtilityClick:u?Me:void 0,onLineClick:u?Ce:void 0,onLineSelected:u?fe:void 0,unsafeCSS:P.length>0?`${We}
|
|
161
|
-
${at}`:We,renderAnnotation:u||P.length>0?Ee:void 0,onPostRender:P.length>0?Te:void 0}),[Te,P.length,O.metadata.id,u,N,ie,V.metadata.id,w,E,fe,Me,Ce,Ee]),se=l.useMemo(()=>{const e=u?it({drafts:Y,editingDraftId:T,selection:o}):[];for(const t of P)e.push({side:t.side,lineNumber:t.lineNumber,metadata:{type:"hunk-action",index:t.index}});return e},[T,u,Y,P,o]),Se=l.useRef(se);if(l.useEffect(()=>{Se.current=se},[se]),l.useEffect(()=>{const e=Q.current;return()=>{A.current?.cleanUp(),A.current=null,oe.current?.release(),oe.current=null,we.current=null,ke.current=null,Re.current=void 0,he.current=void 0,me.current=void 0,pe.current=void 0,e&&(e.innerHTML="")}},[]),l.useEffect(()=>{if(typeof window>"u")return;const e=Q.current,t=J.current;if(!e||!Z)return;const s=mt(t,e);let c=oe.current;c||(c=vt(e),oe.current=c),oe.current=c;const p=c?.virtualizer??null,f=r?void 0:{name:d||"",contents:i,lang:a,cacheKey:`old:${X}:${d}:${je(i)}`},y=r?void 0:{name:d||"",contents:n,lang:a,cacheKey:`new:${X}:${d}:${je(n)}`},x=r?he.current!==r:he.current!==void 0||!f||!y||!me.current||!pe.current||!Ie(me.current,f)||!Ie(pe.current,y),R=A.current,L=!!(R&&(we.current!==p||ke.current!==Z||p&&(Re.current!==G.hunkSeparators||x)));L&&(R?.cleanUp(),A.current=null,e.innerHTML="");let v=A.current;const h=!L&&R?!Ke(R.options,G):!1;if(v?v.setOptions(G):(v=c?new Ye(G,c.virtualizer,gt,Z):new Xe(G,Z),A.current=v,ue.current=null),we.current=p,ke.current=Z,Re.current=p?G.hunkSeparators:void 0,he.current=r,me.current=f,pe.current=y,r)v.render({fileDiff:r,forceRender:h,lineAnnotations:Se.current,containerWrapper:e});else{if(!f||!y)return;v.render({oldFile:f,newFile:y,forceRender:h,lineAnnotations:Se.current,containerWrapper:e})}const m=pt(e,()=>{s(),bt(v,c,xe)});return()=>{m(),s()}},[X,r,d,a,n,G,i,Z]),l.useEffect(()=>{const e=A.current;if(e){try{e.setLineAnnotations(se)}catch(t){console.error("Failed to apply diff line annotations",t);try{e.setLineAnnotations([])}catch{}}requestAnimationFrame(()=>{if(A.current===e){try{e.rerender()}catch{}xe()}})}},[se]),l.useEffect(()=>{const e=A.current;if(!e||o!==null)return;const t=ue.current;if(!ut(o,t))try{q.current=!0,e.setSelectedLines(o),ue.current=o}catch{}finally{q.current=!1}},[o]),l.useEffect(()=>{if(!u)return;const e=Q.current;if(!e)return;let t=null,s=()=>{};const c=()=>{const f=e.querySelector("diffs-container")?.shadowRoot;if(!f){t=requestAnimationFrame(c);return}const y=x=>{if(!(x instanceof MouseEvent)||x.button!==0||!(x.target instanceof Element))return;const R=x.target.closest("[data-column-number]");if(!(R instanceof HTMLElement))return;const L=R.getAttribute("data-column-number"),v=L?parseInt(L,10):NaN;if(Number.isNaN(v))return;const h=Pe(R);fe({start:v,end:v,side:h}),x.preventDefault(),x.stopPropagation()};f.addEventListener("click",y,!0),s=()=>{f.removeEventListener("click",y,!0)}};return c(),()=>{t!==null&&cancelAnimationFrame(t),s()}},[X,u,d,fe,Pe]),l.useEffect(()=>{const e=Q.current;if(!e)return;let t=null,s=null;const p=setTimeout(()=>{const f=e.querySelector("diffs-container");if(!(f instanceof HTMLElement))return;const y=f.shadowRoot;t=new MutationObserver(()=>{s&&cancelAnimationFrame(s),s=requestAnimationFrame(()=>{xe(),s=null})}),t.observe(f,{childList:!0,subtree:!0}),y&&t.observe(y,{childList:!0,subtree:!0})},100);return()=>{clearTimeout(p),s&&cancelAnimationFrame(s),t?.disconnect()}},[X,d]),typeof window>"u")return null;const Ae=u?M.jsx(st,{diffRootRef:J,drafts:Y,selection:o,editingDraftId:T,commentText:S,onTextChange:k,fileLabel:d?.split("/").pop()??"",onSave:_e,onCancel:Ue,onEdit:e=>{_({start:e.startLine,end:e.endLine,side:e.side==="original"?"deletions":"additions"}),ce(e)},onDelete:Ve}):null,Fe=$&&r&&H.fileDiff===r&&H.anchors===P?[...H.targets].map(([e,t])=>ye.createPortal($.render(e),t,`hunk-${e}`)):null;return C==="fill"?M.jsx("div",{className:Ne("flex flex-col relative","size-full"),"data-diff-virtual-root":!0,children:M.jsxs("div",{className:"flex-1 relative min-h-0",children:[M.jsx(et,{outerClassName:"pierre-diff-wrapper size-full",disableHorizontal:!1,fillContainer:!0,"data-diff-virtual-content":!0,children:M.jsx("div",{ref:J,className:"size-full relative",children:M.jsx("div",{ref:Q,className:"size-full"})})}),Ae,Fe]})}):M.jsxs("div",{className:Ne("relative","w-full"),children:[M.jsx("div",{ref:J,className:"pierre-diff-wrapper w-full overflow-x-auto overflow-y-visible relative",children:M.jsx("div",{ref:Q,className:"w-full"})}),Ae,Fe]})};export{Pt as P};
|