@pi-chamber/web 1.0.4-rc.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/assets/DiagramView-BpG1c3Hi.js +1 -0
  2. package/dist/assets/{DiffView-Cay8VAqL.js → DiffView-BxwoRCYx.js} +5 -5
  3. package/dist/assets/FileSaveConflictDialog-DP7k9a-i.js +3 -0
  4. package/dist/assets/{FilesView-CEeQzjc6.js → FilesView-D_2QcdUt.js} +4 -4
  5. package/dist/assets/{GitHubDetailScaffold-q4YP8iyJ.js → GitHubDetailScaffold-UxLAMAOl.js} +2 -2
  6. package/dist/assets/GitHubLinkPicker-Bh9RO1yK.js +1 -0
  7. package/dist/assets/{GitHubListPrimitives-XkALat1v.js → GitHubListPrimitives-DQyhT5wG.js} +1 -1
  8. package/dist/assets/{GitView-DV3d0oSJ.js → GitView-XBBheKRM.js} +4 -4
  9. package/dist/assets/{IssuesSurface-OTyt9f3A.js → IssuesSurface-BA1kpvAJ.js} +3 -3
  10. package/dist/assets/{JsonTreeView-X2Auiy_q.js → JsonTreeView-BAaEPL4O.js} +1 -1
  11. package/dist/assets/MarkdownRendererImpl-DzgDmUsL.js +12 -0
  12. package/dist/assets/{PatchDiff-GMQAv4en.js → PatchDiff-BMEUsgXH.js} +1 -1
  13. package/dist/assets/{PierreDiffViewer-0X__nypk.js → PierreDiffViewer-BW8MO-O6.js} +2 -2
  14. package/dist/assets/PullRequestsSurface-B3ictm4I.js +2 -0
  15. package/dist/assets/SessionSwitcherContent-rLoyVqgs.js +1 -0
  16. package/dist/assets/SessionSwitcherDropdown-CfySKnUu.js +2 -0
  17. package/dist/assets/{SessionUnreadDot-CJFawQpo.js → SessionUnreadDot-CmEF9sxM.js} +1 -1
  18. package/dist/assets/SettingsView-BiwlwnTK.js +6 -0
  19. package/dist/assets/SettingsWindow-j0e99YI0.js +1 -0
  20. package/dist/assets/ToolOutputDialog-VlS12Xyq.js +8 -0
  21. package/dist/assets/ToolPartDiffPreview-DdSneZws.js +1 -0
  22. package/dist/assets/{VirtualizedFileDiff-CUWx7JVZ.js → VirtualizedFileDiff-BqiXjvP6.js} +1 -1
  23. package/dist/assets/{Virtualizer-wpC51ZBQ.js → Virtualizer-Cp_cJWbI.js} +1 -1
  24. package/dist/assets/{collapsible-Ce85nuXX.js → collapsible-C7oyikVm.js} +1 -1
  25. package/dist/assets/{computeVirtualFileMetrics-3PpRLd5B.js → computeVirtualFileMetrics-BJjC-tXV.js} +1 -1
  26. package/dist/assets/{contextFileOpenGuard-PoBklHMz.js → contextFileOpenGuard-BBzqKGei.js} +1 -1
  27. package/dist/assets/{gitStatusPredicates-BvzxqidP.js → gitStatusPredicates-Dq-E5DaH.js} +1 -1
  28. package/dist/assets/{githubLink-iQ51wqRa.js → githubLink-Cryd7GkG.js} +5 -5
  29. package/dist/assets/index-BbhXFTId.js +1 -0
  30. package/dist/assets/index-BnZVqcki.js +11 -0
  31. package/dist/assets/index-BnieExes.css +1 -0
  32. package/dist/assets/{main-PSCt716b.js → main-9O5IAtT_.js} +4 -4
  33. package/dist/assets/{main-FasHq7Ck.js → main-DWGwALIw.js} +2 -2
  34. package/dist/assets/{markdownCore-BH56o6Wu.js → markdownCore-B9AuEyYi.js} +1 -1
  35. package/dist/assets/miniChat-CgOaJfD8.js +2 -0
  36. package/dist/assets/mobile-BbJcYVym.js +2 -0
  37. package/dist/assets/nativeFileSave-BzhtrDoD.js +1 -0
  38. package/dist/assets/{pi-session-focus-preference-D2-1HWmY.js → pi-session-focus-preference-Bmk1iOvn.js} +4 -4
  39. package/dist/assets/{renderDiffWithHighlighter-l8hZWWBO.js → renderDiffWithHighlighter-CVLsdtQ5.js} +1 -1
  40. package/dist/assets/renderElectronMiniChatApp-R5o9NwFC.js +2 -0
  41. package/dist/assets/{renderFileWithHighlighter-BvDoP7ob.js → renderFileWithHighlighter-DJ9mk2bZ.js} +1 -1
  42. package/dist/assets/renderMobileApp-CQ9tWYIj.js +11 -0
  43. package/dist/assets/runtimeEndpointReset-CtK4C_5h.js +62 -0
  44. package/dist/assets/{runtimeSurface-B1GRkkKC.js → runtimeSurface-DBiUWYK2.js} +1 -1
  45. package/dist/assets/useAppFontEffects-DviRbaCJ.js +212 -0
  46. package/dist/assets/{useFilesViewSearch-D1jsGQrN.js → useFilesViewSearch-D2Au5Xgt.js} +1 -1
  47. package/dist/assets/{useGitHubRemoteSearch-zNgy2bSt.js → useGitHubRemoteSearch-D-K7aolk.js} +1 -1
  48. package/dist/assets/{useSwitcherItems-OCRYcHeu.js → useSwitcherItems-Dej8BzXI.js} +1 -1
  49. package/dist/assets/vendor-aparajita-capacitor-secure-storage-BYohCVY0.js +1 -0
  50. package/dist/assets/{vendor-base-ui-DIkTOIJS.js → vendor-base-ui-BscvGUFt.js} +1 -1
  51. package/dist/assets/vendor-boot-Dgb9NVFe.js +69 -0
  52. package/dist/assets/vendor-capacitor-app-BjdQVib9.js +1 -0
  53. package/dist/assets/vendor-capacitor-keyboard-eTtI5go3.js +1 -0
  54. package/dist/assets/vendor-capacitor-push-notifications-CBKq2Arn.js +1 -0
  55. package/dist/assets/vendor-capacitor-status-bar-9rNIGxlO.js +1 -0
  56. package/dist/assets/{vendor-codemirror-autocomplete-DsFn4GLp.js → vendor-codemirror-autocomplete-DxS3jwvE.js} +1 -1
  57. package/dist/assets/{vendor-codemirror-lang-angular-B_NMmBbS.js → vendor-codemirror-lang-angular-DdjXl9e2.js} +1 -1
  58. package/dist/assets/vendor-codemirror-lang-cpp--aMr7NVt.js +1 -0
  59. package/dist/assets/vendor-codemirror-lang-css-CZ_qxZY9.js +1 -0
  60. package/dist/assets/{vendor-codemirror-lang-go-C2KHbcll.js → vendor-codemirror-lang-go-Ca-y2Alu.js} +2 -2
  61. package/dist/assets/vendor-codemirror-lang-html-COZ0L5wT.js +1 -0
  62. package/dist/assets/vendor-codemirror-lang-java-D3Rf3QNJ.js +1 -0
  63. package/dist/assets/{vendor-codemirror-lang-javascript-DpTUrvx8.js → vendor-codemirror-lang-javascript-DwJ-IvCs.js} +2 -2
  64. package/dist/assets/vendor-codemirror-lang-jinja-D_5lod6k.js +1 -0
  65. package/dist/assets/vendor-codemirror-lang-json-BG8C7OpC.js +1 -0
  66. package/dist/assets/vendor-codemirror-lang-less-CVEkoaTw.js +1 -0
  67. package/dist/assets/vendor-codemirror-lang-liquid-U9vj0m8w.js +1 -0
  68. package/dist/assets/vendor-codemirror-lang-markdown-DqlYH9gY.js +1 -0
  69. package/dist/assets/vendor-codemirror-lang-php-BFEiEVA1.js +1 -0
  70. package/dist/assets/vendor-codemirror-lang-python-Cz1dQXQd.js +3 -0
  71. package/dist/assets/vendor-codemirror-lang-rust-C_CoD9mj.js +1 -0
  72. package/dist/assets/vendor-codemirror-lang-sass-BuR0aKh5.js +1 -0
  73. package/dist/assets/{vendor-codemirror-lang-sql-C_RazIaB.js → vendor-codemirror-lang-sql-DggNUjdM.js} +2 -2
  74. package/dist/assets/{vendor-codemirror-lang-vue-BYL0r7KR.js → vendor-codemirror-lang-vue-DFZHi2J3.js} +1 -1
  75. package/dist/assets/vendor-codemirror-lang-wast-zuTN3SHT.js +1 -0
  76. package/dist/assets/vendor-codemirror-lang-xml-CrcvhI-k.js +1 -0
  77. package/dist/assets/vendor-codemirror-lang-yaml-DcVWsakb.js +1 -0
  78. package/dist/assets/{vendor-codemirror-language-data-DglcKYWT.js → vendor-codemirror-language-data-CCLITgCF.js} +2 -2
  79. package/dist/assets/{vendor-codemirror-search-DaE6R5gH.js → vendor-codemirror-search-H7NOEdbX.js} +2 -2
  80. package/dist/assets/{vendor-lezer-cpp-Dt99h3WT.js → vendor-lezer-cpp-C8aD2KAr.js} +1 -1
  81. package/dist/assets/{vendor-lezer-css-DNU_fzPI.js → vendor-lezer-css-2lbTJF-Y.js} +1 -1
  82. package/dist/assets/{vendor-lezer-go-BEFtcNyS.js → vendor-lezer-go-Bw6LFTrZ.js} +1 -1
  83. package/dist/assets/{vendor-lezer-html-DDGRhRUz.js → vendor-lezer-html-D7ym2z7S.js} +1 -1
  84. package/dist/assets/{vendor-lezer-java-DmfZtW09.js → vendor-lezer-java-CZhK7w21.js} +1 -1
  85. package/dist/assets/{vendor-lezer-javascript-oje4tdp_.js → vendor-lezer-javascript-rpKeTHZp.js} +1 -1
  86. package/dist/assets/{vendor-lezer-json-BRXb_bDX.js → vendor-lezer-json-C7jwsd2G.js} +1 -1
  87. package/dist/assets/{vendor-lezer-lr-BU2qmu_5.js → vendor-lezer-lr-DR-ylqNN.js} +1 -1
  88. package/dist/assets/{vendor-lezer-markdown-CicYv7V9.js → vendor-lezer-markdown-Bir0m5nB.js} +1 -1
  89. package/dist/assets/{vendor-lezer-php-COORrTpE.js → vendor-lezer-php-y0hIEfo1.js} +1 -1
  90. package/dist/assets/{vendor-lezer-python-Cuvm9X9Y.js → vendor-lezer-python-D64A9lNV.js} +1 -1
  91. package/dist/assets/{vendor-lezer-rust-C_zOfHbX.js → vendor-lezer-rust-E3ZA9T2L.js} +1 -1
  92. package/dist/assets/{vendor-lezer-sass-DWP4w7O1.js → vendor-lezer-sass-C5UFI9SP.js} +1 -1
  93. package/dist/assets/{vendor-lezer-xml-Br6nOYeG.js → vendor-lezer-xml-DOy7FzCR.js} +1 -1
  94. package/dist/assets/{vendor-lezer-yaml-CYQmm6Sb.js → vendor-lezer-yaml-kEjaSCvZ.js} +1 -1
  95. package/dist/assets/{vendor-replit-codemirror-vim-CZy3BUVv.js → vendor-replit-codemirror-vim-BLfh0LPy.js} +1 -1
  96. package/dist/assets/{web-components-v9fuidaX.js → web-components-C7CmoFxi.js} +1 -1
  97. package/dist/index.html +4 -4
  98. package/dist/mini-chat.html +3 -3
  99. package/dist/mobile.html +3 -3
  100. package/package.json +1 -1
  101. package/server/lib/pi/routes.js +1 -0
  102. package/server/lib/pi/session-daemon/DOCUMENTATION.md +1 -1
  103. package/server/lib/pi/session-daemon/supervisor.js +13 -1
  104. package/server/lib/pi/session-daemon/supervisor.test.js +92 -0
  105. package/server/lib/relay/DOCUMENTATION.md +4 -0
  106. package/server/lib/terminal/DOCUMENTATION.md +1 -0
  107. package/dist/assets/DiagramView-GKGxPczP.js +0 -1
  108. package/dist/assets/FileSaveConflictDialog-BRM9TJo0.js +0 -3
  109. package/dist/assets/GitHubLinkPicker-B9xgIW8y.js +0 -1
  110. package/dist/assets/MarkdownRendererImpl-1HameF6j.js +0 -12
  111. package/dist/assets/PullRequestsSurface-Dec20SIg.js +0 -2
  112. package/dist/assets/SessionSwitcherContent-DEw4nz7K.js +0 -1
  113. package/dist/assets/SessionSwitcherDropdown-DmLhbRzE.js +0 -2
  114. package/dist/assets/SettingsView-CwSspvq-.js +0 -6
  115. package/dist/assets/SettingsWindow-DkPv9MaU.js +0 -1
  116. package/dist/assets/ToolOutputDialog-DDwbOpTO.js +0 -8
  117. package/dist/assets/ToolPartDiffPreview-DZRP7p-Q.js +0 -1
  118. package/dist/assets/index-CkMnC_GK.js +0 -1
  119. package/dist/assets/index-Dd2OcIUY.js +0 -10
  120. package/dist/assets/index-DvN8zlLT.css +0 -1
  121. package/dist/assets/miniChat-BzfobBDq.js +0 -2
  122. package/dist/assets/mobile-DAzZE2EL.js +0 -2
  123. package/dist/assets/renderElectronMiniChatApp-DGYSIihR.js +0 -2
  124. package/dist/assets/renderMobileApp-CwgWG0lU.js +0 -11
  125. package/dist/assets/runtimeEndpointReset-CmI6dBKM.js +0 -62
  126. package/dist/assets/useAppFontEffects--lKKtKVo.js +0 -212
  127. package/dist/assets/vendor-aparajita-capacitor-secure-storage-5IShChL0.js +0 -1
  128. package/dist/assets/vendor-boot-DyL2td56.js +0 -69
  129. package/dist/assets/vendor-capacitor-app-BrDJj9I_.js +0 -1
  130. package/dist/assets/vendor-capacitor-core-B4EWRrHz.js +0 -1
  131. package/dist/assets/vendor-capacitor-keyboard-CYccoJjr.js +0 -1
  132. package/dist/assets/vendor-capacitor-push-notifications-KNe1zSBF.js +0 -1
  133. package/dist/assets/vendor-capacitor-status-bar-B-N0EOVk.js +0 -1
  134. package/dist/assets/vendor-codemirror-lang-cpp-GOE7Gjd0.js +0 -1
  135. package/dist/assets/vendor-codemirror-lang-css-Dwf2XpnZ.js +0 -1
  136. package/dist/assets/vendor-codemirror-lang-html-DcKqyeGk.js +0 -1
  137. package/dist/assets/vendor-codemirror-lang-java-6eGbyB2k.js +0 -1
  138. package/dist/assets/vendor-codemirror-lang-jinja-xSUJjXhr.js +0 -1
  139. package/dist/assets/vendor-codemirror-lang-json-CLGxdOCz.js +0 -1
  140. package/dist/assets/vendor-codemirror-lang-less-6nXi1rS9.js +0 -1
  141. package/dist/assets/vendor-codemirror-lang-liquid-B9hmb9P8.js +0 -1
  142. package/dist/assets/vendor-codemirror-lang-markdown-DmFP9s6x.js +0 -1
  143. package/dist/assets/vendor-codemirror-lang-php-DC6To8iX.js +0 -1
  144. package/dist/assets/vendor-codemirror-lang-python-yuxIkjit.js +0 -3
  145. package/dist/assets/vendor-codemirror-lang-rust-di1Sjz-0.js +0 -1
  146. package/dist/assets/vendor-codemirror-lang-sass-BWpV9NPV.js +0 -1
  147. package/dist/assets/vendor-codemirror-lang-wast-BiVarhcz.js +0 -1
  148. package/dist/assets/vendor-codemirror-lang-xml-Cn1lY1ts.js +0 -1
  149. package/dist/assets/vendor-codemirror-lang-yaml-BZ6mZw9L.js +0 -1
@@ -1 +1 @@
1
- import{dL as j,dk as k,dp as y}from"./useAppFontEffects--lKKtKVo.js";import{f as D,B as C}from"./web-components-v9fuidaX.js";import{M as P,G as L,u as O,W as A,a as M,b as R,n as F,t as H}from"./Virtualizer-wpC51ZBQ.js";import{j as d}from"./vendor-boot-DyL2td56.js";import{V as _,F as N}from"./VirtualizedFileDiff-CUWx7JVZ.js";import{a as w}from"./vendor-react-DASdDPIk.js";function T({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function V(e,t){const n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:z(n,e.startContentIndex)}}function z(e,t){let n=e.unifiedLineStart;for(let l=0;l<t;l++){const s=e.hunkContent[l];n+=s.type==="context"?s.lines:s.deletions+s.additions}return n}function U(e){const t=j(e);if(t.length!==1)throw console.error(t),new Error("PatchDiff: Provided patch must include only 1 patch, with 1 diff");const{files:n}=t[0];if(n.length!==1)throw console.error(n),new Error("FileDiff: Provided patch must contain exactly 1 file diff");return n[0]}function $({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:l,renderHeaderFilenameSuffix:s,renderHeaderMetadata:x,renderAnnotation:f,renderGutterUtility:u,renderMergeConflictUtility:o,lineAnnotations:a,getHoveredLine:g,getInstance:m}){const p=n?.(e),c=l?.(e),i=s?.(e),v=x?.(e);return d.jsxs(d.Fragment,{children:[p!=null?d.jsx("div",{slot:k,children:p}):d.jsxs(d.Fragment,{children:[c!=null&&d.jsx("div",{slot:"header-prefix",children:c}),i!=null&&d.jsx("div",{slot:"header-filename-suffix",children:i}),v!=null&&d.jsx("div",{slot:"header-metadata",children:v})]}),f!=null&&a?.map((r,h)=>d.jsx("div",{slot:D(r),children:f(r)},h)),t!=null&&o!=null&&m!=null&&t.map(r=>{if(r==null)return;const h=b(r,e);return d.jsx("div",{slot:h,style:P,children:o(r,m)},h)}),u!=null&&d.jsx("div",{slot:"gutter-utility-slot",style:L,children:u(g)})]})}function b(e,t){const n=V(e,t);return n!=null?T({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex}):void 0}const S=typeof window>"u"?w.useEffect:w.useLayoutEffect;function G({fileDiff:e,options:t,lineAnnotations:n,selectedLines:l,prerenderedHTML:s,metrics:x,hasGutterRenderUtility:f,hasCustomHeader:u,disableWorkerPool:o,contentEditable:a}){const g=O(),m=l!==void 0,p=w.useContext(A),c=M(),i=w.useRef(null),v=R(r=>{if(r!=null){if(i.current!=null)throw new Error("useFileDiffInstance: An instance should not already exist when a node is created");g!=null?i.current=new _(E({controlledSelection:m,contentEditable:a,hasCustomHeader:u,hasEditor:c!==void 0,hasGutterRenderUtility:f,options:t}),g,x,o?void 0:p,!0):i.current=new N(E({controlledSelection:m,contentEditable:a,hasCustomHeader:u,hasEditor:c!==void 0,hasGutterRenderUtility:f,options:t}),o?void 0:p,!0),i.current.hydrate({fileDiff:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:s})}else{if(i.current==null)throw new Error("useFileDiffInstance: A FileDiff instance should exist when unmounting");i.current.cleanUp(),i.current=null}});return S(()=>{const{current:r}=i;if(r==null)return;const h=E({controlledSelection:m,contentEditable:a,hasCustomHeader:u,hasEditor:c!==void 0,hasGutterRenderUtility:f,options:t}),I=!C(r.options,h);r.setOptions(h),r.render({forceRender:I,fileDiff:e,lineAnnotations:n}),l!==void 0&&r.setSelectedLines(l)}),S(()=>{if(a&&i.current!=null){if(c===void 0)throw new Error("FileDiff: Editor is not attached");return c.edit(i.current)}},[a,c]),{ref:v,getHoveredLine:w.useCallback(()=>i.current?.getHoveredLine(),[])}}function E({options:e,controlledSelection:t,contentEditable:n,hasCustomHeader:l,hasEditor:s,hasGutterRenderUtility:x}){const f=n&&s,u=t||x||l;if(!u&&!f)return e;let o={...e};return u&&(o={...o,controlledSelection:t,renderCustomHeader:l?F:e?.renderCustomHeader,renderGutterUtility:x?F:e?.renderGutterUtility}),f&&(o={...o,useTokenTransformer:!0,enableGutterUtility:!1,enableLineSelection:!1,expandUnchanged:!0,lineHoverHighlight:"disabled"}),o}function Y({patch:e,options:t,metrics:n,lineAnnotations:l,selectedLines:s,className:x,style:f,prerenderedHTML:u,renderAnnotation:o,renderCustomHeader:a,renderHeaderPrefix:g,renderHeaderFilenameSuffix:m,renderHeaderMetadata:p,renderGutterUtility:c,disableWorkerPool:i=!1,contentEditable:v=!1}){const r=q(e),{ref:h,getHoveredLine:I}=G({fileDiff:r,options:t,metrics:n,lineAnnotations:l,selectedLines:s,prerenderedHTML:u,hasGutterRenderUtility:c!=null,hasCustomHeader:a!=null,disableWorkerPool:i,contentEditable:v});return d.jsx(y,{ref:h,className:x,style:f,children:H($({fileDiff:r,renderCustomHeader:a,renderHeaderPrefix:g,renderHeaderFilenameSuffix:m,renderHeaderMetadata:p,renderAnnotation:o,lineAnnotations:l,renderGutterUtility:c,getHoveredLine:I}),u)})}function q(e){return w.useMemo(()=>U(e),[e])}export{Y as P};
1
+ import{dL as k,dk as j,dp as y}from"./useAppFontEffects-DviRbaCJ.js";import{f as D,B as C}from"./web-components-C7CmoFxi.js";import{M as P,G as L,u as O,W as A,a as M,b as R,n as F,t as H}from"./Virtualizer-Cp_cJWbI.js";import{k as d}from"./vendor-boot-Dgb9NVFe.js";import{V as _,F as N}from"./VirtualizedFileDiff-BqiXjvP6.js";import{a as w}from"./vendor-react-DASdDPIk.js";function T({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function V(e,t){const n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:z(n,e.startContentIndex)}}function z(e,t){let n=e.unifiedLineStart;for(let l=0;l<t;l++){const s=e.hunkContent[l];n+=s.type==="context"?s.lines:s.deletions+s.additions}return n}function U(e){const t=k(e);if(t.length!==1)throw console.error(t),new Error("PatchDiff: Provided patch must include only 1 patch, with 1 diff");const{files:n}=t[0];if(n.length!==1)throw console.error(n),new Error("FileDiff: Provided patch must contain exactly 1 file diff");return n[0]}function $({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:l,renderHeaderFilenameSuffix:s,renderHeaderMetadata:x,renderAnnotation:f,renderGutterUtility:u,renderMergeConflictUtility:o,lineAnnotations:a,getHoveredLine:g,getInstance:m}){const p=n?.(e),c=l?.(e),i=s?.(e),v=x?.(e);return d.jsxs(d.Fragment,{children:[p!=null?d.jsx("div",{slot:j,children:p}):d.jsxs(d.Fragment,{children:[c!=null&&d.jsx("div",{slot:"header-prefix",children:c}),i!=null&&d.jsx("div",{slot:"header-filename-suffix",children:i}),v!=null&&d.jsx("div",{slot:"header-metadata",children:v})]}),f!=null&&a?.map((r,h)=>d.jsx("div",{slot:D(r),children:f(r)},h)),t!=null&&o!=null&&m!=null&&t.map(r=>{if(r==null)return;const h=b(r,e);return d.jsx("div",{slot:h,style:P,children:o(r,m)},h)}),u!=null&&d.jsx("div",{slot:"gutter-utility-slot",style:L,children:u(g)})]})}function b(e,t){const n=V(e,t);return n!=null?T({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex}):void 0}const S=typeof window>"u"?w.useEffect:w.useLayoutEffect;function G({fileDiff:e,options:t,lineAnnotations:n,selectedLines:l,prerenderedHTML:s,metrics:x,hasGutterRenderUtility:f,hasCustomHeader:u,disableWorkerPool:o,contentEditable:a}){const g=O(),m=l!==void 0,p=w.useContext(A),c=M(),i=w.useRef(null),v=R(r=>{if(r!=null){if(i.current!=null)throw new Error("useFileDiffInstance: An instance should not already exist when a node is created");g!=null?i.current=new _(E({controlledSelection:m,contentEditable:a,hasCustomHeader:u,hasEditor:c!==void 0,hasGutterRenderUtility:f,options:t}),g,x,o?void 0:p,!0):i.current=new N(E({controlledSelection:m,contentEditable:a,hasCustomHeader:u,hasEditor:c!==void 0,hasGutterRenderUtility:f,options:t}),o?void 0:p,!0),i.current.hydrate({fileDiff:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:s})}else{if(i.current==null)throw new Error("useFileDiffInstance: A FileDiff instance should exist when unmounting");i.current.cleanUp(),i.current=null}});return S(()=>{const{current:r}=i;if(r==null)return;const h=E({controlledSelection:m,contentEditable:a,hasCustomHeader:u,hasEditor:c!==void 0,hasGutterRenderUtility:f,options:t}),I=!C(r.options,h);r.setOptions(h),r.render({forceRender:I,fileDiff:e,lineAnnotations:n}),l!==void 0&&r.setSelectedLines(l)}),S(()=>{if(a&&i.current!=null){if(c===void 0)throw new Error("FileDiff: Editor is not attached");return c.edit(i.current)}},[a,c]),{ref:v,getHoveredLine:w.useCallback(()=>i.current?.getHoveredLine(),[])}}function E({options:e,controlledSelection:t,contentEditable:n,hasCustomHeader:l,hasEditor:s,hasGutterRenderUtility:x}){const f=n&&s,u=t||x||l;if(!u&&!f)return e;let o={...e};return u&&(o={...o,controlledSelection:t,renderCustomHeader:l?F:e?.renderCustomHeader,renderGutterUtility:x?F:e?.renderGutterUtility}),f&&(o={...o,useTokenTransformer:!0,enableGutterUtility:!1,enableLineSelection:!1,expandUnchanged:!0,lineHoverHighlight:"disabled"}),o}function Y({patch:e,options:t,metrics:n,lineAnnotations:l,selectedLines:s,className:x,style:f,prerenderedHTML:u,renderAnnotation:o,renderCustomHeader:a,renderHeaderPrefix:g,renderHeaderFilenameSuffix:m,renderHeaderMetadata:p,renderGutterUtility:c,disableWorkerPool:i=!1,contentEditable:v=!1}){const r=q(e),{ref:h,getHoveredLine:I}=G({fileDiff:r,options:t,metrics:n,lineAnnotations:l,selectedLines:s,prerenderedHTML:u,hasGutterRenderUtility:c!=null,hasCustomHeader:a!=null,disableWorkerPool:i,contentEditable:v});return d.jsx(y,{ref:h,className:x,style:f,children:H($({fileDiff:r,renderCustomHeader:a,renderHeaderPrefix:g,renderHeaderFilenameSuffix:m,renderHeaderMetadata:p,renderAnnotation:o,lineAnnotations:l,renderGutterUtility:c,getHoveredLine:I}),u)})}function q(e){return w.useMemo(()=>U(e),[e])}export{Y as P};
@@ -1,4 +1,4 @@
1
- import{aJ as Re,j as M}from"./vendor-boot-DyL2td56.js";import{a as d,R as ae}from"./vendor-react-DASdDPIk.js";import{B as Se}from"./web-components-v9fuidaX.js";import{f as ce}from"./computeVirtualFileMetrics-3PpRLd5B.js";import{V as Ee,F as ke}from"./VirtualizedFileDiff-CUWx7JVZ.js";import{aX as xe,aj as Te}from"./useAppFontEffects--lKKtKVo.js";import{a$ as Oe}from"./runtimeEndpointReset-CmI6dBKM.js";import{ensurePierreThemeRegistered as ue,getResolvedShikiTheme as he}from"./appThemeRegistry-gegrE2dq.js";import{_ as de,o as fe}from"./index-Dd2OcIUY.js";const J=new Set;let ne=null;function E(n){J.add(n),ne??=requestAnimationFrame(ve)}function ve(n){const e=new Set(J);J.clear();for(const t of e)try{t(n)}catch(r){console.error(r)}J.size>0?ne=requestAnimationFrame(ve):ne=null}function ge({scrollTop:n,scrollHeight:e,height:t,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:s}){const h=t+s*2,f=r?t+i*2:h;if(e=Math.max(e,f),h>=e||r){const g=Math.max(n-i,0),y=Math.min(n+f,e);return{top:g,bottom:Math.max(y,g)}}let c=n+t/2-h/2,m=c+h;return c<0&&(c=0),m>e&&(m=e),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(m,e),c))}}function ze(n,e){return n==null||e==null?n===e:n.top===e.top&&n.bottom===e.bottom}const be=1e3,De=be*4,Ce=[0,1e-6,.99999,1],Ie={overscrollSize:be,intersectionObserverMargin:De,resizeDebugging:!1};let X=0,Me=-1;var He=class x{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++Me}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...Ie,...e}}setup(e,t){if(this.root==null){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Ce,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{x.__STOP?(x.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:x.__lastScrollPosition}),E(this.computeRenderRangeAndEmit)):(x.__lastScrollPosition=this.getScrollTop(),x.__STOP=!0)};for(const[r,i]of this.connectQueue.entries())this.connect(r,i);this.connectQueue.clear(),this.markDOMDirty(),E(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),E(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=ge({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const r=this.getScrollTop(),i=this.getHeight(),s=this.config.intersectionObserverMargin,h=r-s,f=r+i+s;return!(e<h-t||e>f)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(const r of e){const i=r.borderBoxSize[0].blockSize;this.root instanceof Document?i!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:i-X,newSize:i}),X=i)):r.target===this.root?i!==this.height&&(this.heightDirty=!0,t=!0):r.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:i-X,newSize:i}),X=i))}t&&E(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+U(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),E(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){const t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),E(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{x.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,E(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{x.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,E(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{x.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,E(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(x.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let t=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const s=ge({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&ze(this.windowSpecs,s)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=s}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const r=this.getScrollAnchor(this.height),i=new Set;for(const s of e?this.observers.values():this.visibleInstances.values())s.onRender(e)&&i.add(s);for(const s of this.instancesChanged)i.has(s)||s.onRender(e)&&i.add(s);this.scrollFix(r);for(const s of i)s.reconcileHeights();t||=this.instancesChanged.size>0,t&&this.markDOMDirty(),(t||e)&&E(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;const t=this.getScrollContainerElement(),{lineIndex:r,lineOffset:i,fileElement:s,fileOffset:h,fileTypeOffset:f}=e;if(r!=null&&i!=null){const m=s.shadowRoot?.querySelector(`[data-line][data-line-index="${r}"]`);if(m instanceof HTMLElement){const g=U(m,t);if(g!==i){const y=g-i;this.applyScrollFix(y)}return}}const c=U(s,t);if(f==="top")c!==h&&this.applyScrollFix(c-h);else{const m=c+s.getBoundingClientRect().height;m!==h&&this.applyScrollFix(m-h)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){const t=this.getScrollContainerElement();let r;for(const[i]of this.visibleInstances.entries()){const s=U(i,t),h=s+i.offsetHeight;let f,c;h<=0?(f=h,c="bottom"):(f=s,c="top");let m,g;if(h>0&&s<e)for(const w of i.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(w instanceof HTMLElement))continue;const q=w.dataset.lineIndex;if(q==null)continue;const z=U(w,t);if(!(z<0)){m=q,g=z;break}}if(r?.lineOffset!=null&&g==null)continue;let y=!1;(r==null||g!=null&&(r.lineOffset==null||g<r.lineOffset)||g==null&&r.lineOffset==null&&(f>=0&&(r.fileOffset<0||f<r.fileOffset)||f<0&&r.fileOffset<0&&f>r.fileOffset))&&(y=!0),y&&(r={fileElement:i,fileTypeOffset:c,fileOffset:f,lineIndex:m,lineOffset:g})}return r}handleIntersectionChange=e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:r}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const i=this.observers.get(t);i!=null&&(r&&!this.visibleInstances.has(t)?(i.setVisibility(!0),this.visibleInstances.set(t,i),this.visibleInstancesDirty=!0):!r&&this.visibleInstances.has(t)&&(i.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&E(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function U(n,e){const t=n.getBoundingClientRect(),r=e?.getBoundingClientRect().top??0;return t.top-r}const pe=5e5,Pe=`
1
+ import{aN as Re,k as M}from"./vendor-boot-Dgb9NVFe.js";import{a as d,R as ae}from"./vendor-react-DASdDPIk.js";import{B as Se}from"./web-components-C7CmoFxi.js";import{f as ce}from"./computeVirtualFileMetrics-BJjC-tXV.js";import{V as Ee,F as ke}from"./VirtualizedFileDiff-BqiXjvP6.js";import{aX as xe,aj as Te}from"./useAppFontEffects-DviRbaCJ.js";import{a$ as Oe}from"./runtimeEndpointReset-CtK4C_5h.js";import{ensurePierreThemeRegistered as ue,getResolvedShikiTheme as he}from"./appThemeRegistry-gegrE2dq.js";import{_ as de,o as fe}from"./index-BnZVqcki.js";const J=new Set;let ne=null;function E(n){J.add(n),ne??=requestAnimationFrame(ve)}function ve(n){const e=new Set(J);J.clear();for(const t of e)try{t(n)}catch(r){console.error(r)}J.size>0?ne=requestAnimationFrame(ve):ne=null}function ge({scrollTop:n,scrollHeight:e,height:t,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:s}){const h=t+s*2,f=r?t+i*2:h;if(e=Math.max(e,f),h>=e||r){const g=Math.max(n-i,0),y=Math.min(n+f,e);return{top:g,bottom:Math.max(y,g)}}let c=n+t/2-h/2,m=c+h;return c<0&&(c=0),m>e&&(m=e),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(m,e),c))}}function ze(n,e){return n==null||e==null?n===e:n.top===e.top&&n.bottom===e.bottom}const be=1e3,De=be*4,Ce=[0,1e-6,.99999,1],Ie={overscrollSize:be,intersectionObserverMargin:De,resizeDebugging:!1};let X=0,Me=-1;var He=class x{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++Me}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...Ie,...e}}setup(e,t){if(this.root==null){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Ce,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{x.__STOP?(x.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:x.__lastScrollPosition}),E(this.computeRenderRangeAndEmit)):(x.__lastScrollPosition=this.getScrollTop(),x.__STOP=!0)};for(const[r,i]of this.connectQueue.entries())this.connect(r,i);this.connectQueue.clear(),this.markDOMDirty(),E(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),E(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=ge({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const r=this.getScrollTop(),i=this.getHeight(),s=this.config.intersectionObserverMargin,h=r-s,f=r+i+s;return!(e<h-t||e>f)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(const r of e){const i=r.borderBoxSize[0].blockSize;this.root instanceof Document?i!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:i-X,newSize:i}),X=i)):r.target===this.root?i!==this.height&&(this.heightDirty=!0,t=!0):r.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:i-X,newSize:i}),X=i))}t&&E(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+U(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),E(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){const t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),E(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{x.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,E(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{x.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,E(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{x.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,E(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(x.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let t=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const s=ge({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&ze(this.windowSpecs,s)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=s}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const r=this.getScrollAnchor(this.height),i=new Set;for(const s of e?this.observers.values():this.visibleInstances.values())s.onRender(e)&&i.add(s);for(const s of this.instancesChanged)i.has(s)||s.onRender(e)&&i.add(s);this.scrollFix(r);for(const s of i)s.reconcileHeights();t||=this.instancesChanged.size>0,t&&this.markDOMDirty(),(t||e)&&E(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;const t=this.getScrollContainerElement(),{lineIndex:r,lineOffset:i,fileElement:s,fileOffset:h,fileTypeOffset:f}=e;if(r!=null&&i!=null){const m=s.shadowRoot?.querySelector(`[data-line][data-line-index="${r}"]`);if(m instanceof HTMLElement){const g=U(m,t);if(g!==i){const y=g-i;this.applyScrollFix(y)}return}}const c=U(s,t);if(f==="top")c!==h&&this.applyScrollFix(c-h);else{const m=c+s.getBoundingClientRect().height;m!==h&&this.applyScrollFix(m-h)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){const t=this.getScrollContainerElement();let r;for(const[i]of this.visibleInstances.entries()){const s=U(i,t),h=s+i.offsetHeight;let f,c;h<=0?(f=h,c="bottom"):(f=s,c="top");let m,g;if(h>0&&s<e)for(const w of i.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(w instanceof HTMLElement))continue;const q=w.dataset.lineIndex;if(q==null)continue;const z=U(w,t);if(!(z<0)){m=q,g=z;break}}if(r?.lineOffset!=null&&g==null)continue;let y=!1;(r==null||g!=null&&(r.lineOffset==null||g<r.lineOffset)||g==null&&r.lineOffset==null&&(f>=0&&(r.fileOffset<0||f<r.fileOffset)||f<0&&r.fileOffset<0&&f>r.fileOffset))&&(y=!0),y&&(r={fileElement:i,fileTypeOffset:c,fileOffset:f,lineIndex:m,lineOffset:g})}return r}handleIntersectionChange=e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:r}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const i=this.observers.get(t);i!=null&&(r&&!this.visibleInstances.has(t)?(i.setVisibility(!0),this.visibleInstances.set(t,i),this.visibleInstancesDirty=!0):!r&&this.visibleInstances.has(t)&&(i.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&E(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function U(n,e){const t=n.getBoundingClientRect(),r=e?.getBoundingClientRect().top??0;return t.top-r}const pe=5e5,Pe=`
2
2
  :host {
3
3
  font-family: var(--font-mono);
4
4
  font-size: var(--text-code);
@@ -131,4 +131,4 @@ import{aJ as Re,j as M}from"./vendor-boot-DyL2td56.js";import{a as d,R as ae}fro
131
131
  text-decoration: underline;
132
132
  }
133
133
  }
134
- `;function _e(n){let e=2166136261;for(let t=0;t<n.length;t+=1)e^=n.charCodeAt(t),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16)}function me(n){const e=n.length>400?`${n.slice(0,200)}${n.slice(-200)}`:n;return`${n.length}:${_e(e)}`}const Fe=n=>n==="auto"||n==="scroll"||n==="overlay",Ae=n=>{let e=n?.parentElement??null;for(;e;){const t=window.getComputedStyle(e);if(Fe(t.overflowY))return e;e=e.parentElement}return null},Ve=(n,e)=>{if(!n||!e||typeof window>"u")return()=>{};const t=Ae(n);if(!t)return()=>{};const r=e.getBoundingClientRect().height;if(!r)return()=>{};const i=n.getBoundingClientRect().top-t.getBoundingClientRect().top,s=e.style.minHeight;e.style.minHeight=`${Math.ceil(r)}px`;let h=!1;return()=>{if(h)return;h=!0,e.style.minHeight=s;const c=n.getBoundingClientRect().top-t.getBoundingClientRect().top-i;c&&(t.scrollTop+=c)}},$e=(n,e)=>{if(typeof window>"u")return()=>{};let t=null,r=null,i=!1;const s=()=>{i||(r?.disconnect(),r=null,t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{i||e()})}))},h=()=>n.querySelector("diffs-container")?.shadowRoot??void 0,f=(c=h())=>!!c?.querySelector("[data-line]");return f()?s():typeof MutationObserver<"u"?(r=new MutationObserver(()=>{const c=h();if(c){if(f(c)){s();return}r?.disconnect(),r=new MutationObserver(()=>{f(c)&&s()}),r.observe(c,{childList:!0,subtree:!0})}}),r.observe(n,{childList:!0,subtree:!0})):t=window.requestAnimationFrame(s),()=>{i=!0,r?.disconnect(),t!==null&&window.cancelAnimationFrame(t)}},Z=new WeakMap,qe={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function We(n){const e=n.closest("[data-diff-virtual-root]");if(e instanceof HTMLElement){const t=e.querySelector("[data-diff-virtual-content]");return{key:e,root:e,content:t instanceof HTMLElement?t:void 0}}return{key:document,root:document,content:void 0}}function Be(n){if(typeof document>"u")return null;const e=We(n);let t=Z.get(e.key);if(!t){const i=new He;i.setup(e.root,e.content),t={virtualizer:i,refs:0},Z.set(e.key,t)}t.refs+=1;let r=!1;return{virtualizer:t.virtualizer,root:e.root,release:()=>{if(r)return;r=!0;const i=Z.get(e.key);i&&(i.refs-=1,!(i.refs>0)&&(i.virtualizer.cleanUp(),Z.delete(e.key)))}}}const Ne=(n,e,t)=>{if(typeof window>"u")return()=>{};const r=[],i=()=>{try{n.rerender()}catch{}const s=e?.root;s instanceof HTMLElement?s.dispatchEvent(new Event("scroll",{bubbles:!1})):document.dispatchEvent(new Event("scroll",{bubbles:!1})),window.dispatchEvent(new Event("resize")),t()};return r.push(window.requestAnimationFrame(i)),r.push(window.requestAnimationFrame(()=>{r.push(window.requestAnimationFrame(i))})),()=>{for(const s of r)window.cancelAnimationFrame(s)}},tt=({original:n,modified:e,fileDiff:t,language:r,fileName:i,renderSideBySide:s,wrapLines:h,layout:f="fill",enableGutterUtility:c=!1,enableLineSelection:m=!1,onGutterUtilityClick:g,onLineSelectionEnd:y,lineAnnotations:w,renderAnnotation:q})=>{const z=xe(),D=z?.currentTheme.metadata.variant==="dark",_=z?.availableThemes.find(o=>o.metadata.id===z.lightThemeId)??de(!1),F=z?.availableThemes.find(o=>o.metadata.id===z.darkThemeId)??de(!0);ue(_),ue(F);const W=`${_.metadata.id}:${F.metadata.id}:${D?"dark":"light"}`,B=d.useMemo(()=>{if(t){const o=t.deletionLines.reduce((a,u)=>a+u.length,0),l=t.additionLines.reduce((a,u)=>a+u.length,0);return Math.max(o,l)>pe}return Math.max(n.length,e.length)>pe},[t,e.length,n.length]),Q=d.useRef(null),N=d.useRef(null),A=d.useRef(null),j=d.useRef(null),ee=d.useRef(null),te=d.useRef(null),re=d.useRef(void 0),K=d.useRef(void 0),G=d.useRef(void 0),Y=d.useRef(void 0),[,se]=ae.useReducer(o=>o+1,0),V=Oe(B?"unified":s?"split":"unified"),C=d.useRef(new Map),ie=d.useRef(q);ie.current=q;const oe=o=>`${o.side}:${o.lineNumber}`,le=d.useCallback(o=>{if(typeof document>"u")return;const l=`${o.side}:${o.lineNumber}`;let a=C.current.get(l);if(!a){const u=document.createElement("div");u.setAttribute("data-pichamber-line-annotation",l),a={root:Re.createRoot(u),element:u},C.current.set(l,a)}return a.root.render(ie.current?.(o)??null),a.element},[]);d.useEffect(()=>{if(!w){for(const[,a]of C.current)a.root.unmount();C.current.clear();return}const o=new Set(w.map(oe));for(const[a,u]of C.current)o.has(a)||(u.root.unmount(),C.current.delete(a));const l=ie.current;if(l)for(const a of w){const u=C.current.get(oe(a));u&&u.root.render(l(a))}},[w]),d.useEffect(()=>{const o=C.current;return()=>{for(const l of o.values())l.root.unmount();o.clear()}},[]);const T=d.useMemo(()=>he(_),[_]),O=d.useMemo(()=>he(F),[F]);ae.useLayoutEffect(()=>{const o=Q.current;if(!o)return;const l=o.querySelector("diffs-container");if(!l)return;const a=D?O:T,u=(ye,we)=>ye.colors?.[we],R=u(T,"terminal.ansiGreen"),v=u(T,"terminal.ansiRed"),b=u(T,"terminal.ansiBlue"),P=u(O,"terminal.ansiGreen"),k=u(O,"terminal.ansiRed"),I=u(O,"terminal.ansiBlue");l.style.setProperty("--shiki-light",T.fg),l.style.setProperty("--shiki-light-bg",T.bg),R&&l.style.setProperty("--shiki-light-addition-color",R),v&&l.style.setProperty("--shiki-light-deletion-color",v),b&&l.style.setProperty("--shiki-light-modified-color",b),l.style.setProperty("--shiki-dark",O.fg),l.style.setProperty("--shiki-dark-bg",O.bg),P&&l.style.setProperty("--shiki-dark-addition-color",P),k&&l.style.setProperty("--shiki-dark-deletion-color",k),I&&l.style.setProperty("--shiki-dark-modified-color",I),l.style.setProperty("--diffs-bg",a.bg),l.style.setProperty("--diffs-fg",a.fg);const S=D?P:R,L=D?k:v,$=D?I:b;S&&l.style.setProperty("--diffs-addition-color-override",S),L&&l.style.setProperty("--diffs-deletion-color-override",L),$&&l.style.setProperty("--diffs-modified-color-override",$);const p=l.shadowRoot?.querySelector("pre");p&&(p.style.setProperty("--shiki-light",T.fg),p.style.setProperty("--shiki-light-bg",T.bg),R&&p.style.setProperty("--shiki-light-addition-color",R),v&&p.style.setProperty("--shiki-light-deletion-color",v),b&&p.style.setProperty("--shiki-light-modified-color",b),p.style.setProperty("--shiki-dark",O.fg),p.style.setProperty("--shiki-dark-bg",O.bg),P&&p.style.setProperty("--shiki-dark-addition-color",P),k&&p.style.setProperty("--shiki-dark-deletion-color",k),I&&p.style.setProperty("--shiki-dark-modified-color",I),p.style.setProperty("--diffs-bg",a.bg),p.style.setProperty("--diffs-fg",a.fg),S&&p.style.setProperty("--diffs-addition-color-override",S),L&&p.style.setProperty("--diffs-deletion-color-override",L),$&&p.style.setProperty("--diffs-modified-color-override",$))},[O,W,D,T]);const H=d.useMemo(()=>({theme:{dark:F.metadata.id,light:_.metadata.id},themeType:D?"dark":"light",diffStyle:s?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",maxLineDiffLength:B?0:1e3,maxLineLengthForHighlighting:B?1:1e3,tokenizeMaxLineLength:B?1:1e3,collapsedContextThreshold:0,expansionLineCount:20,overflow:h?"wrap":"scroll",disableFileHeader:!0,enableLineSelection:m,enableGutterUtility:c,enableHoverUtility:!1,...g?{onGutterUtilityClick:g}:{},...y?{onLineSelectionEnd:y}:{},renderAnnotation:le,unsafeCSS:Le}),[le,F.metadata.id,c,m,D,B,_.metadata.id,g,y,s,h]);return d.useEffect(()=>{const o=N.current;return()=>{A.current?.cleanUp(),A.current=null,j.current?.release(),j.current=null,ee.current=null,te.current=null,re.current=void 0,K.current=void 0,G.current=void 0,Y.current=void 0,o&&(o.innerHTML="")}},[]),d.useEffect(()=>{if(typeof window>"u")return;const o=N.current,l=Q.current;if(!o||!V)return;const a=Ve(l,o);let u=j.current;u||(u=Be(o),j.current=u),j.current=u;const R=u?.virtualizer??null,v=t?void 0:{name:i||"",contents:n,lang:r,cacheKey:`old:${W}:${i}:${me(n)}`},b=t?void 0:{name:i||"",contents:e,lang:r,cacheKey:`new:${W}:${i}:${me(e)}`},P=t?K.current!==t:K.current!==void 0||!v||!b||!G.current||!Y.current||!ce(G.current,v)||!ce(Y.current,b),k=A.current,I=!!(k&&(ee.current!==R||te.current!==V||R&&(re.current!==H.hunkSeparators||P)));I&&(k?.cleanUp(),A.current=null,o.innerHTML="");let S=A.current;const L=!I&&k?!Se(k.options,H):!1;if(S?S.setOptions(H):(S=u?new Ee(H,u.virtualizer,qe,V):new ke(H,V),A.current=S),ee.current=R,te.current=V,re.current=R?H.hunkSeparators:void 0,K.current=t,G.current=v,Y.current=b,t)S.render({fileDiff:t,forceRender:L,containerWrapper:o,...w?{lineAnnotations:w}:{}});else{if(!v||!b)return;S.render({oldFile:v,newFile:b,forceRender:L,containerWrapper:o,...w?{lineAnnotations:w}:{}})}const $=$e(o,()=>{a(),Ne(S,u,se)});return()=>{$(),a()}},[W,t,i,r,w,e,H,n,V]),d.useEffect(()=>{const o=N.current;if(!o)return;let l=null,a=null;const R=setTimeout(()=>{const v=o.querySelector("diffs-container");if(!(v instanceof HTMLElement))return;const b=v.shadowRoot;l=new MutationObserver(()=>{a&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{se(),a=null})}),l.observe(v,{childList:!0,subtree:!0}),b&&l.observe(b,{childList:!0,subtree:!0})},100);return()=>{clearTimeout(R),a&&cancelAnimationFrame(a),l?.disconnect()}},[W,i]),typeof window>"u"?null:f==="fill"?M.jsx("div",{className:fe("flex flex-col relative","size-full"),"data-diff-virtual-root":!0,children:M.jsx("div",{className:"flex-1 relative min-h-0",children:M.jsx(Te,{outerClassName:"pierre-diff-wrapper size-full",disableHorizontal:!1,fillContainer:!0,"data-diff-virtual-content":!0,children:M.jsx("div",{ref:Q,className:"size-full relative",children:M.jsx("div",{ref:N,className:"size-full"})})})})}):M.jsx("div",{className:fe("relative","w-full"),children:M.jsx("div",{ref:Q,className:"pierre-diff-wrapper w-full overflow-x-auto overflow-y-visible relative","data-no-drawer-swipe":"true",children:M.jsx("div",{ref:N,className:"w-full"})})})};export{tt as P};
134
+ `;function _e(n){let e=2166136261;for(let t=0;t<n.length;t+=1)e^=n.charCodeAt(t),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16)}function me(n){const e=n.length>400?`${n.slice(0,200)}${n.slice(-200)}`:n;return`${n.length}:${_e(e)}`}const Fe=n=>n==="auto"||n==="scroll"||n==="overlay",Ae=n=>{let e=n?.parentElement??null;for(;e;){const t=window.getComputedStyle(e);if(Fe(t.overflowY))return e;e=e.parentElement}return null},Ve=(n,e)=>{if(!n||!e||typeof window>"u")return()=>{};const t=Ae(n);if(!t)return()=>{};const r=e.getBoundingClientRect().height;if(!r)return()=>{};const i=n.getBoundingClientRect().top-t.getBoundingClientRect().top,s=e.style.minHeight;e.style.minHeight=`${Math.ceil(r)}px`;let h=!1;return()=>{if(h)return;h=!0,e.style.minHeight=s;const c=n.getBoundingClientRect().top-t.getBoundingClientRect().top-i;c&&(t.scrollTop+=c)}},$e=(n,e)=>{if(typeof window>"u")return()=>{};let t=null,r=null,i=!1;const s=()=>{i||(r?.disconnect(),r=null,t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{i||e()})}))},h=()=>n.querySelector("diffs-container")?.shadowRoot??void 0,f=(c=h())=>!!c?.querySelector("[data-line]");return f()?s():typeof MutationObserver<"u"?(r=new MutationObserver(()=>{const c=h();if(c){if(f(c)){s();return}r?.disconnect(),r=new MutationObserver(()=>{f(c)&&s()}),r.observe(c,{childList:!0,subtree:!0})}}),r.observe(n,{childList:!0,subtree:!0})):t=window.requestAnimationFrame(s),()=>{i=!0,r?.disconnect(),t!==null&&window.cancelAnimationFrame(t)}},Z=new WeakMap,qe={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function Ne(n){const e=n.closest("[data-diff-virtual-root]");if(e instanceof HTMLElement){const t=e.querySelector("[data-diff-virtual-content]");return{key:e,root:e,content:t instanceof HTMLElement?t:void 0}}return{key:document,root:document,content:void 0}}function We(n){if(typeof document>"u")return null;const e=Ne(n);let t=Z.get(e.key);if(!t){const i=new He;i.setup(e.root,e.content),t={virtualizer:i,refs:0},Z.set(e.key,t)}t.refs+=1;let r=!1;return{virtualizer:t.virtualizer,root:e.root,release:()=>{if(r)return;r=!0;const i=Z.get(e.key);i&&(i.refs-=1,!(i.refs>0)&&(i.virtualizer.cleanUp(),Z.delete(e.key)))}}}const Be=(n,e,t)=>{if(typeof window>"u")return()=>{};const r=[],i=()=>{try{n.rerender()}catch{}const s=e?.root;s instanceof HTMLElement?s.dispatchEvent(new Event("scroll",{bubbles:!1})):document.dispatchEvent(new Event("scroll",{bubbles:!1})),window.dispatchEvent(new Event("resize")),t()};return r.push(window.requestAnimationFrame(i)),r.push(window.requestAnimationFrame(()=>{r.push(window.requestAnimationFrame(i))})),()=>{for(const s of r)window.cancelAnimationFrame(s)}},tt=({original:n,modified:e,fileDiff:t,language:r,fileName:i,renderSideBySide:s,wrapLines:h,layout:f="fill",enableGutterUtility:c=!1,enableLineSelection:m=!1,onGutterUtilityClick:g,onLineSelectionEnd:y,lineAnnotations:w,renderAnnotation:q})=>{const z=xe(),D=z?.currentTheme.metadata.variant==="dark",_=z?.availableThemes.find(o=>o.metadata.id===z.lightThemeId)??de(!1),F=z?.availableThemes.find(o=>o.metadata.id===z.darkThemeId)??de(!0);ue(_),ue(F);const N=`${_.metadata.id}:${F.metadata.id}:${D?"dark":"light"}`,W=d.useMemo(()=>{if(t){const o=t.deletionLines.reduce((a,u)=>a+u.length,0),l=t.additionLines.reduce((a,u)=>a+u.length,0);return Math.max(o,l)>pe}return Math.max(n.length,e.length)>pe},[t,e.length,n.length]),Q=d.useRef(null),B=d.useRef(null),A=d.useRef(null),j=d.useRef(null),ee=d.useRef(null),te=d.useRef(null),re=d.useRef(void 0),K=d.useRef(void 0),G=d.useRef(void 0),Y=d.useRef(void 0),[,se]=ae.useReducer(o=>o+1,0),V=Oe(W?"unified":s?"split":"unified"),C=d.useRef(new Map),ie=d.useRef(q);ie.current=q;const oe=o=>`${o.side}:${o.lineNumber}`,le=d.useCallback(o=>{if(typeof document>"u")return;const l=`${o.side}:${o.lineNumber}`;let a=C.current.get(l);if(!a){const u=document.createElement("div");u.setAttribute("data-pichamber-line-annotation",l),a={root:Re.createRoot(u),element:u},C.current.set(l,a)}return a.root.render(ie.current?.(o)??null),a.element},[]);d.useEffect(()=>{if(!w){for(const[,a]of C.current)a.root.unmount();C.current.clear();return}const o=new Set(w.map(oe));for(const[a,u]of C.current)o.has(a)||(u.root.unmount(),C.current.delete(a));const l=ie.current;if(l)for(const a of w){const u=C.current.get(oe(a));u&&u.root.render(l(a))}},[w]),d.useEffect(()=>{const o=C.current;return()=>{for(const l of o.values())l.root.unmount();o.clear()}},[]);const T=d.useMemo(()=>he(_),[_]),O=d.useMemo(()=>he(F),[F]);ae.useLayoutEffect(()=>{const o=Q.current;if(!o)return;const l=o.querySelector("diffs-container");if(!l)return;const a=D?O:T,u=(ye,we)=>ye.colors?.[we],R=u(T,"terminal.ansiGreen"),v=u(T,"terminal.ansiRed"),b=u(T,"terminal.ansiBlue"),P=u(O,"terminal.ansiGreen"),k=u(O,"terminal.ansiRed"),I=u(O,"terminal.ansiBlue");l.style.setProperty("--shiki-light",T.fg),l.style.setProperty("--shiki-light-bg",T.bg),R&&l.style.setProperty("--shiki-light-addition-color",R),v&&l.style.setProperty("--shiki-light-deletion-color",v),b&&l.style.setProperty("--shiki-light-modified-color",b),l.style.setProperty("--shiki-dark",O.fg),l.style.setProperty("--shiki-dark-bg",O.bg),P&&l.style.setProperty("--shiki-dark-addition-color",P),k&&l.style.setProperty("--shiki-dark-deletion-color",k),I&&l.style.setProperty("--shiki-dark-modified-color",I),l.style.setProperty("--diffs-bg",a.bg),l.style.setProperty("--diffs-fg",a.fg);const S=D?P:R,L=D?k:v,$=D?I:b;S&&l.style.setProperty("--diffs-addition-color-override",S),L&&l.style.setProperty("--diffs-deletion-color-override",L),$&&l.style.setProperty("--diffs-modified-color-override",$);const p=l.shadowRoot?.querySelector("pre");p&&(p.style.setProperty("--shiki-light",T.fg),p.style.setProperty("--shiki-light-bg",T.bg),R&&p.style.setProperty("--shiki-light-addition-color",R),v&&p.style.setProperty("--shiki-light-deletion-color",v),b&&p.style.setProperty("--shiki-light-modified-color",b),p.style.setProperty("--shiki-dark",O.fg),p.style.setProperty("--shiki-dark-bg",O.bg),P&&p.style.setProperty("--shiki-dark-addition-color",P),k&&p.style.setProperty("--shiki-dark-deletion-color",k),I&&p.style.setProperty("--shiki-dark-modified-color",I),p.style.setProperty("--diffs-bg",a.bg),p.style.setProperty("--diffs-fg",a.fg),S&&p.style.setProperty("--diffs-addition-color-override",S),L&&p.style.setProperty("--diffs-deletion-color-override",L),$&&p.style.setProperty("--diffs-modified-color-override",$))},[O,N,D,T]);const H=d.useMemo(()=>({theme:{dark:F.metadata.id,light:_.metadata.id},themeType:D?"dark":"light",diffStyle:s?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",maxLineDiffLength:W?0:1e3,maxLineLengthForHighlighting:W?1:1e3,tokenizeMaxLineLength:W?1:1e3,collapsedContextThreshold:0,expansionLineCount:20,overflow:h?"wrap":"scroll",disableFileHeader:!0,enableLineSelection:m,enableGutterUtility:c,enableHoverUtility:!1,...g?{onGutterUtilityClick:g}:{},...y?{onLineSelectionEnd:y}:{},renderAnnotation:le,unsafeCSS:Le}),[le,F.metadata.id,c,m,D,W,_.metadata.id,g,y,s,h]);return d.useEffect(()=>{const o=B.current;return()=>{A.current?.cleanUp(),A.current=null,j.current?.release(),j.current=null,ee.current=null,te.current=null,re.current=void 0,K.current=void 0,G.current=void 0,Y.current=void 0,o&&(o.innerHTML="")}},[]),d.useEffect(()=>{if(typeof window>"u")return;const o=B.current,l=Q.current;if(!o||!V)return;const a=Ve(l,o);let u=j.current;u||(u=We(o),j.current=u),j.current=u;const R=u?.virtualizer??null,v=t?void 0:{name:i||"",contents:n,lang:r,cacheKey:`old:${N}:${i}:${me(n)}`},b=t?void 0:{name:i||"",contents:e,lang:r,cacheKey:`new:${N}:${i}:${me(e)}`},P=t?K.current!==t:K.current!==void 0||!v||!b||!G.current||!Y.current||!ce(G.current,v)||!ce(Y.current,b),k=A.current,I=!!(k&&(ee.current!==R||te.current!==V||R&&(re.current!==H.hunkSeparators||P)));I&&(k?.cleanUp(),A.current=null,o.innerHTML="");let S=A.current;const L=!I&&k?!Se(k.options,H):!1;if(S?S.setOptions(H):(S=u?new Ee(H,u.virtualizer,qe,V):new ke(H,V),A.current=S),ee.current=R,te.current=V,re.current=R?H.hunkSeparators:void 0,K.current=t,G.current=v,Y.current=b,t)S.render({fileDiff:t,forceRender:L,containerWrapper:o,...w?{lineAnnotations:w}:{}});else{if(!v||!b)return;S.render({oldFile:v,newFile:b,forceRender:L,containerWrapper:o,...w?{lineAnnotations:w}:{}})}const $=$e(o,()=>{a(),Be(S,u,se)});return()=>{$(),a()}},[N,t,i,r,w,e,H,n,V]),d.useEffect(()=>{const o=B.current;if(!o)return;let l=null,a=null;const R=setTimeout(()=>{const v=o.querySelector("diffs-container");if(!(v instanceof HTMLElement))return;const b=v.shadowRoot;l=new MutationObserver(()=>{a&&cancelAnimationFrame(a),a=requestAnimationFrame(()=>{se(),a=null})}),l.observe(v,{childList:!0,subtree:!0}),b&&l.observe(b,{childList:!0,subtree:!0})},100);return()=>{clearTimeout(R),a&&cancelAnimationFrame(a),l?.disconnect()}},[N,i]),typeof window>"u"?null:f==="fill"?M.jsx("div",{className:fe("flex flex-col relative","size-full"),"data-diff-virtual-root":!0,children:M.jsx("div",{className:"flex-1 relative min-h-0",children:M.jsx(Te,{outerClassName:"pierre-diff-wrapper size-full",disableHorizontal:!1,fillContainer:!0,"data-diff-virtual-content":!0,children:M.jsx("div",{ref:Q,className:"size-full relative",children:M.jsx("div",{ref:B,className:"size-full"})})})})}):M.jsx("div",{className:fe("relative","w-full"),children:M.jsx("div",{ref:Q,className:"pierre-diff-wrapper w-full overflow-x-auto overflow-y-visible relative","data-no-drawer-swipe":"true",children:M.jsx("div",{ref:B,className:"w-full"})})})};export{tt as P};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/useAppFontEffects-DviRbaCJ.js","assets/index-BnZVqcki.js","assets/vendor-zustand-CUi8eEds.js","assets/vendor-react-DASdDPIk.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/index-BnieExes.css","assets/vendor-boot-Dgb9NVFe.js","assets/runtimeSurface-DBiUWYK2.js","assets/nativeFileSave-BzhtrDoD.js"])))=>i.map(i=>d[i]);
2
+ import{_ as Ne}from"./vendor-vite-runtime-DD1OZmLC.js";import{k as e,bV as Ye,bW as Qe,bX as Xe,bY as Ze,bZ as et}from"./vendor-boot-Dgb9NVFe.js";import{R as o}from"./vendor-react-DASdDPIk.js";import{u as le,a as Le,b as ht,c as ft,G as xt,d as pt,e as gt,f as bt,r as vt,g as tt,t as yt,h as ce,i as jt,j as wt,k as kt,l as Ct,m as Nt,n as St,o as Rt}from"./useGitHubRemoteSearch-D-K7aolk.js";import{q as Ee,t as H,a5 as Lt,B as P,I as z,b3 as Et,ai as st,a8 as Me,ab as ze,ad as Ae,cu as Ft,cv as Pt,o as Se,af as we,ag as Tt,p as Mt}from"./useAppFontEffects-DviRbaCJ.js";import{Q as O,_ as zt,$ as At,R as Dt,a0 as $t,a1 as Gt,a2 as Ht,a3 as qt,a4 as It,a5 as De,a6 as Ot,a7 as Bt,a8 as _t,a9 as Ut,aa as Vt,ab as Kt,ac as Jt,ad as Wt}from"./runtimeEndpointReset-CtK4C_5h.js";import{c as Yt,d as Qt,s as Xt,m as Zt,g as nt,e as es,f as ts,h as ge,l as ss,G as ns,i as te,j as as,k as ls,n as os,o as is,b as fe,u as rs,p as cs,q as ds,r as us,t as $e,w as ke,x as Ce,y as ms,z as Ge,A as He,B as qe,C as at,D as hs,E as Ie,F as fs,H as xs,I as ps,J as gs,K as bs,P as be,L as he,M as vs,a as ys,N as Oe,O as js,Q as ws}from"./GitHubDetailScaffold-UxLAMAOl.js";import{o as xe,aR as ks,A as Cs,t as Ns,v as Ss}from"./index-BnZVqcki.js";import{S as ve,G as Rs}from"./GitHubListPrimitives-DQyhT5wG.js";import{P as Ls}from"./PierreDiffViewer-BW8MO-O6.js";import{c as Es,p as Fs}from"./vendor-zustand-CUi8eEds.js";import"./vendor-clsx-B-dksMZM.js";import"./runtimeSurface-DBiUWYK2.js";import"./nativeFileSave-BzhtrDoD.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./SessionUnreadDot-CmEF9sxM.js";/* empty css */import"./permissionStore-B9Hkrqny.js";import"./vendor-dompurify-r8glNMJW.js";import"./web-components-C7CmoFxi.js";import"./computeVirtualFileMetrics-BJjC-tXV.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-yJ9XpNMI.js";import"./vendor-pierre-theming-Dgp7B_O4.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"./VirtualizedFileDiff-BqiXjvP6.js";import"./renderDiffWithHighlighter-CVLsdtQ5.js";import"./vendor-diff-C3JhlQdm.js";import"./appThemeRegistry-gegrE2dq.js";import"./registerCustomTheme-DmolaWWZ.js";const Fe=()=>{const t=Ee(),[s,n]=o.useState(null);return{send:o.useCallback(async l=>{const d=t.github;if(!d)return H.error("GitHub is not available in this runtime"),!1;n(l.key);try{const c=await d.agentContext(l.directory,l.repo,l.contextType,l.number,l.contextOptions),r=Yt({kind:l.kind,repo:l.repo,number:l.number,detail:l.detail}),x=Qt({kind:l.kind,repo:l.repo,number:l.number,contextText:c.text}),p=Lt.getState();p.setPendingInputText(r,"append");const k=p.pendingSyntheticParts??[];return p.setPendingSyntheticParts([...k,{text:x,synthetic:!0}]),H.success("Added to composer"),!0}catch(c){return H.error(c instanceof Error?c.message:"Failed to fetch GitHub context"),!1}finally{n(null)}},[t.github]),sendingKey:s}},Ps=800,Ts=3,Pe={added:{icon:"add-circle",letter:"A",tint:"text-[var(--status-success)]"},removed:{icon:"subtract",letter:"D",tint:"text-[var(--status-error)]"},modified:{icon:"pencil",letter:"M",tint:"text-[var(--status-warning)]"},renamed:{icon:"expand-up-down",letter:"R",tint:"text-[var(--status-info)]"},other:{icon:"file",letter:"•",tint:"text-muted-foreground"}},lt=t=>{switch((t??"").toLowerCase()){case"added":return"added";case"removed":return"removed";case"modified":return"modified";case"renamed":return"renamed";default:return"other"}},ot=t=>Pe[t].icon,Ms=t=>Pe[t].letter,Re=t=>Pe[t].tint,it=t=>{const s=t.lastIndexOf("/");return s<0?{dir:"",base:t}:{dir:t.slice(0,s),base:t.slice(s+1)}},rt=t=>{const s=typeof t.additions=="number"?t.additions:0,n=typeof t.deletions=="number"?t.deletions:0;return s!==0||n!==0?s+n:typeof t.changes=="number"?t.changes:0},ct=t=>rt(t)>Ps,zs=t=>{const s=new Map;for(const a of t){const l=a.filename.lastIndexOf("/"),d=l<0?"":a.filename.slice(0,l),c=s.get(d);c?c.push(a):s.set(d,[a])}const n=[...s.entries()].map(([a,l])=>({folder:a,files:[...l].sort((d,c)=>d.filename.localeCompare(c.filename,void 0,{sensitivity:"base"}))}));return n.sort((a,l)=>a.folder===""?1:l.folder===""?-1:a.folder.localeCompare(l.folder,void 0,{sensitivity:"base"})),n},As=t=>{let s=0,n=0;for(const a of t)s+=typeof a.additions=="number"?a.additions:0,n+=typeof a.deletions=="number"?a.deletions:0;return{additions:s,deletions:n}},Ds=t=>{const s={};return t.forEach((n,a)=>{s[n.filename]=a>=Ts||ct(n)}),s},$s=(t,s,n)=>{if(!s)return null;const a=t.split("/");if(a.length!==3||a.some(r=>r.length===0))return null;const[l,d,c]=a;return`https://${l}/${d}/${c}/blob/${s}/${n}`},Gs=({comment:t,onRemove:s})=>e.jsxs("div",{className:"rounded-md border border-dashed border-border p-2.5 typography-ui text-foreground",contentEditable:!1,onPointerDown:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-1.5 typography-micro text-muted-foreground",children:[e.jsx(z,{name:"chat-1",className:"size-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:"Pending — sent when you submit the review"}),e.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":"Discard this comment",title:"Discard this comment",onClick:s,className:"ml-auto size-6",children:e.jsx(z,{name:"delete-bin",className:"size-3.5"})})]}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap break-words",children:t.body})]}),Be=({thread:t,replyAllowed:s,replyDisabledReason:n,resolveAllowed:a,resolveDisabledReason:l,busy:d,onReply:c,onToggleResolved:r})=>{const[x,p]=o.useState(!t.resolved),[k,m]=o.useState(!1),[b,h]=o.useState(""),[A,F]=o.useState(!1),T=t.comments.length,j=async()=>{const g=b.trim();if(!(g.length===0||A||d)){F(!0);try{await c(g)&&(h(""),m(!1))}finally{F(!1)}}};return e.jsxs("div",{className:"rounded-md border border-border/60 bg-[var(--surface-elevated)] p-2.5 typography-ui text-foreground",contentEditable:!1,onPointerDown:g=>g.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-1.5 typography-micro text-muted-foreground",children:[e.jsx(z,{name:t.resolved?"check":"chat-1",className:xe("size-3.5 shrink-0",t.resolved?"text-[var(--status-success)]":""),"aria-hidden":"true"}),e.jsxs("button",{type:"button",className:"hover:text-foreground","aria-expanded":x,onClick:()=>p(g=>!g),children:[t.resolved?"Resolved":"Open"," · ",T," ",T===1?"comment":"comments"]}),e.jsx(P,{type:"button",variant:"ghost",size:"xs",className:"ml-auto",disabled:!a||d,title:l??(t.resolved?"Reopen this conversation":"Resolve this conversation"),"aria-label":t.resolved?"Reopen conversation":"Resolve conversation",onClick:r,children:t.resolved?"Unresolve":"Resolve"})]}),x?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 flex flex-col gap-2",children:t.comments.map((g,i)=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"typography-micro text-muted-foreground",children:g.author?.login??"ghost"}),e.jsx(ns,{markdown:g.body,html:g.bodyHtml??null,fallbackUrl:g.url})]},g.id??`${t.id}-${i}`))}),s?k?e.jsxs("div",{className:"mt-2",children:[e.jsx("textarea",{autoFocus:!0,value:b,rows:2,placeholder:"Reply","aria-label":"Reply to this conversation",disabled:A||d,onChange:g=>h(g.target.value),onKeyDown:g=>{g.nativeEvent.isComposing||(g.key==="Escape"&&(g.preventDefault(),m(!1)),g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&!g.shiftKey&&!g.altKey&&!g.repeat&&(g.preventDefault(),g.stopPropagation(),j()))},className:"min-h-12 w-full rounded-md border border-border bg-[var(--surface-elevated)] p-2 typography-ui text-foreground"}),e.jsxs("div",{className:"mt-1.5 flex justify-end gap-1.5",children:[e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>m(!1),children:"Cancel"}),e.jsx(P,{type:"button",variant:"default",size:"xs",disabled:A||d||b.trim().length===0,onClick:()=>{j()},children:A?"Replying…":"Reply"})]})]}):e.jsx(P,{type:"button",variant:"ghost",size:"xs",className:"mt-2",onClick:()=>m(!0),children:"Reply"}):n?e.jsxs("p",{className:"mt-2 typography-micro text-muted-foreground",title:n,children:["Reply unavailable — ",n.charAt(0).toLowerCase()+n.slice(1)]}):null]}):null]})},Hs=({path:t,line:s,sendingToAgent:n,onCancel:a,onAddToReview:l,onSendToAgent:d})=>{const[c,r]=o.useState(""),x=o.useRef(null),p=c.trim();o.useLayoutEffect(()=>{const m=window.requestAnimationFrame(()=>{x.current?.focus({preventScroll:!0})});return()=>window.cancelAnimationFrame(m)},[]);const k=()=>{p&&l(p)};return e.jsxs("div",{className:"rounded-md border border-border/60 bg-[var(--surface-elevated)] p-2.5",contentEditable:!1,onPointerDown:m=>m.stopPropagation(),children:[e.jsxs("p",{className:"truncate font-mono typography-micro text-muted-foreground",title:`${t}:${s}`,children:[t,":",s]}),e.jsx("textarea",{ref:x,value:c,rows:3,placeholder:"Add a comment…","aria-label":`Comment on ${t} line ${s}`,onChange:m=>r(m.target.value),onFocus:m=>{const b=m.currentTarget.value.length;m.currentTarget.setSelectionRange(b,b)},onKeyDown:m=>{m.nativeEvent.isComposing||(m.key==="Escape"&&(m.preventDefault(),a()),m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&!m.shiftKey&&!m.altKey&&!m.repeat&&(m.preventDefault(),m.stopPropagation(),k()))},className:"mt-1.5 min-h-16 w-full rounded-md border border-border bg-[var(--surface-elevated)] p-2 typography-ui text-foreground"}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx("span",{className:"mr-auto typography-micro text-muted-foreground",children:"Ctrl/Cmd+Enter to add"}),e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:a,children:"Cancel"}),e.jsx(P,{type:"button",variant:"outline",size:"xs",disabled:!p||n,title:"Send this line to the agent",onClick:()=>d(p),children:n?"Sending…":"Send to agent"}),e.jsx(P,{type:"button",variant:"default",size:"xs",disabled:!p,onClick:k,children:"Add to review"})]})]})},qs=({file:t,collapsed:s,onToggleCollapse:n,viewed:a,onToggleViewed:l,blobUrl:d,threads:c,directory:r,repo:x,number:p,github:k,access:m,onThreadsChanged:b})=>{const h=O(w=>w.threadAction),A=le(w=>w.removeComment),F=le(w=>w.addComment),T=Le(x,p),[j,g]=o.useState(null),[i,C]=o.useState(!1),{send:L,sendingKey:f}=Fe(),{original:N,modified:E}=o.useMemo(()=>Xt(t.patch),[t.patch]),M=o.useMemo(()=>Zt(t.patch),[t.patch]),B=`pr-${p}-file-${t.filename}`,V=nt(m),S=es(m),$=ts(m),K=o.useCallback(w=>{if(!w||!V.allowed)return;const q=(w.endSide??w.side??"additions")==="deletions"?"deletions":"additions",ie=q==="deletions"?M.syntheticToOld.get(w.end):M.syntheticToNew.get(w.end);if(ie==null){H.error("That line is outside the rendered hunks");return}g({synthLine:w.end,side:q,realLine:ie,realSide:q==="deletions"?"LEFT":"RIGHT"})},[V.allowed,M]),_=lt(t.status),{dir:X,base:R}=it(t.filename),I=ct(t),[y,de]=o.useState(!1),Q=I&&!y&&!a&&t.patch!=null,ee=c.filter(w=>!w.resolved).length,Z=o.useMemo(()=>T.filter(w=>w.path===t.filename),[T,t.filename]),{annotations:se,orphans:ne}=o.useMemo(()=>{const w=new Map,G=[],q=(D,U)=>{const W=`${D}:${U}`;let J=w.get(W);return J||(J={side:D,synthLine:U,threads:[],pendings:[]},w.set(W,J)),J};for(const D of c){const U=D.line??D.originalLine??null;if(U==null){G.push(D);continue}let W,J;if(D.diffSide==="LEFT"?(J="deletions",W=M.oldToSynthetic.get(U)):D.diffSide==="RIGHT"?(J="additions",W=M.newToSynthetic.get(U)):(W=M.newToSynthetic.get(U),J="additions",W==null&&(W=M.oldToSynthetic.get(U),J="deletions")),W==null){G.push(D);continue}q(J,W).threads.push(D)}for(const D of Z){if(D.line==null)continue;const U=D.side==="LEFT"?"deletions":"additions",W=U==="deletions"?M.oldToSynthetic.get(D.line):M.newToSynthetic.get(D.line);W!=null&&q(U,W).pendings.push(D)}return j&&q(j.side,j.synthLine),{annotations:[...w.values()].sort((D,U)=>D.synthLine-U.synthLine).map(D=>({side:D.side,lineNumber:D.synthLine,metadata:{threads:D.threads,pendings:D.pendings,draft:j&&j.side===D.side&&j.synthLine===D.synthLine?{realLine:j.realLine,realSide:j.realSide}:null}})),orphans:G}},[c,Z,j,M]),oe=o.useCallback(async(w,G)=>{const q=w.comments[w.comments.length-1]?.id??null;if(typeof q!="number")return H.error("Cannot reply to this thread yet"),!1;if(i)return!1;C(!0);try{return(await h(r,x,p,w.id,{action:"reply",body:G,commentId:q},k)).ok?(H.success("Reply posted"),b(),!0):(H.error("Failed to post reply"),!1)}finally{C(!1)}},[r,x,p,k,h,i,b]),ae=o.useCallback(w=>{i||(C(!0),h(r,x,p,w.id,w.resolved?{action:"unresolve"}:{action:"resolve"},k).then(G=>{G.ok?(H.success(w.resolved?"Thread reopened":"Thread resolved"),b()):H.error("Failed to update thread")}).finally(()=>C(!1)))},[r,x,p,k,h,i,b]),ue=o.useCallback(w=>e.jsxs("div",{className:"flex flex-col gap-1.5 px-3 py-2",contentEditable:!1,onPointerDown:G=>G.stopPropagation(),children:[w.metadata.threads.map(G=>e.jsx(Be,{thread:G,replyAllowed:S.allowed,replyDisabledReason:S.reason,resolveAllowed:$.allowed,resolveDisabledReason:$.reason,busy:i,onReply:q=>oe(G,q),onToggleResolved:()=>ae(G)},G.id)),w.metadata.pendings.map(G=>e.jsx(Gs,{comment:G,onRemove:()=>A(x,p,G.id)},G.id)),w.metadata.draft?e.jsx(Hs,{path:t.filename,line:w.metadata.draft.realLine,sendingToAgent:f===`${B}-draft-agent`,onCancel:()=>g(null),onAddToReview:G=>{const q=w.metadata.draft;q&&(F(x,p,{path:t.filename,body:G,line:q.realLine,side:q.realSide}),g(null),H.success("Added to review"))},onSendToAgent:G=>{const q=w.metadata.draft;q&&L({key:`${B}-draft-agent`,kind:"lines",directory:r,repo:x,number:p,contextType:"pr",contextOptions:{includeDiff:!0},detail:`${t.filename} line ${q.realLine} ("${G.trim()}")`})}}):null]}),[S.allowed,S.reason,$.allowed,$.reason,i,oe,ae,A,F,x,p,t.filename,B,f,r,L]);return e.jsxs("article",{className:"overflow-hidden rounded-md border border-border/60",children:[e.jsxs("div",{className:"sticky top-8 z-[5] flex items-center gap-1.5 bg-[var(--surface-muted)] px-2 py-1.5",children:[e.jsx(P,{type:"button",variant:"ghost",size:"icon",onClick:()=>n(t.filename),"aria-label":s?`Expand ${t.filename}`:`Collapse ${t.filename}`,title:s?"Expand":"Collapse",className:"size-6",children:e.jsx(z,{name:s?"arrow-right-s":"arrow-down-s",className:"size-4"})}),e.jsx(z,{name:ot(_),className:xe("size-3.5 shrink-0",Re(_)),"aria-hidden":"true"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono typography-micro",title:t.filename,children:[X?e.jsxs("span",{className:"text-muted-foreground",children:[X,"/"]}):null,e.jsx("span",{className:"text-foreground",children:R})]}),_!=="other"?e.jsx("span",{className:xe("shrink-0 rounded px-1 font-mono typography-micro",Re(_)),title:t.status??void 0,children:Ms(_)}):null,e.jsx(ge,{additions:t.additions,deletions:t.deletions,className:"typography-micro"}),c.length>0||Z.length>0?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 typography-micro text-muted-foreground",title:`${c.length} ${c.length===1?"conversation":"conversations"}${Z.length>0?`, ${Z.length} pending`:""}`,children:[e.jsx(z,{name:"chat-1",className:"size-3.5","aria-hidden":"true"}),c.length>0?e.jsx("span",{className:"tabular-nums",children:ee>0?ee:c.length}):null,Z.length>0?e.jsxs("span",{className:"tabular-nums",children:["+",Z.length]}):null]}):null,e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5",onClick:w=>w.stopPropagation(),children:[e.jsx(Et,{checked:a,onChange:w=>l(t.filename,w),ariaLabel:a?`Mark ${t.filename} as not viewed`:`Mark ${t.filename} as viewed`}),e.jsx("span",{className:"typography-micro text-muted-foreground",children:"Viewed"})]}),e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>{L({key:`${B}-agent`,kind:"file",directory:r,repo:x,number:p,contextType:"pr",contextOptions:{includeDiff:!0},detail:t.filename})},disabled:f===`${B}-agent`,"aria-label":`Send ${t.filename} to agent`,children:"Send to agent"})]}),s?null:e.jsxs("div",{className:"flex flex-col gap-2 p-2",children:[ne.length>0?e.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md bg-[var(--surface-muted)] px-2 py-2",children:[e.jsxs("p",{className:"typography-micro text-muted-foreground",children:["Other conversations (",ne.length,") — ",ne.length===1?"this line is":"these lines are"," no longer in the diff"]}),ne.map(w=>e.jsx(Be,{thread:w,replyAllowed:S.allowed,replyDisabledReason:S.reason,resolveAllowed:$.allowed,resolveDisabledReason:$.reason,busy:i,onReply:G=>oe(w,G),onToggleResolved:()=>ae(w)},w.id))]}):null,Q?e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-[var(--surface-muted)] px-3 py-3 typography-ui",children:[e.jsx(z,{name:"file",className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),e.jsxs("p",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:["Large diff — ",rt(t)," changed lines"]}),e.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>de(!0),children:"Load diff"})]}):t.patch?e.jsx("div",{className:"min-h-24 overflow-hidden",children:e.jsx(Ls,{original:N,modified:E,language:ss(t.filename),fileName:t.filename,renderSideBySide:!1,layout:"inline",enableGutterUtility:V.allowed&&j===null,enableLineSelection:V.allowed&&j===null,onGutterUtilityClick:K,onLineSelectionEnd:K,lineAnnotations:se,renderAnnotation:w=>ue(w)})}):e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-[var(--surface-muted)] px-3 py-3 typography-ui",children:[e.jsx(z,{name:"file",className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),e.jsx("p",{className:"min-w-0 flex-1 text-muted-foreground",children:"Diff not available for this file."}),d?e.jsx(P,{type:"button",variant:"link",size:"sm",asChild:!0,children:e.jsx("a",{href:d,target:"_blank",rel:"noreferrer",children:"Open on GitHub"})}):null]})]})]})},Is=o.memo(qs),Os=({directory:t,repo:s,number:n,github:a,pr:l,access:d,onCommented:c})=>{const r=O(i=>i.addComment),x=O(i=>i.performAction),p=le(i=>i.clearCommentDraft),{draft:k,onDraftChange:m,flushDraft:b}=ht(s,n),{busy:h,error:A,submit:F}=ft({postComment:i=>r(t,s,n,i,a),runFollowUp:i=>x(t,s,n,i,a),verbs:{close:"close",reopen:"reopen"},doneLabels:{close:"Closed with comment",reopen:"Reopened with comment"},afterPost:()=>{m(""),p(s,n),c()}}),T=nt(d),j=l.state==="open"?"close":l.state==="closed"?"reopen":null,g=j?te(j,l,d):null;return T.allowed?e.jsx(xt,{draft:k,onDraftChange:m,onDraftBlur:b,ariaLabel:"Leave a comment on this pull request",busy:h,error:A,disabledReason:T.reason,followUp:j?{id:j,label:j==="close"?"Close with comment":"Reopen with comment",busyLabel:j==="close"?"Closing…":"Reopening…",onRun:()=>{F(j,k)},allowed:g?.allowed===!0,reason:g?.reason}:null,onSubmitComment:()=>{F("comment",k)}}):null},Bs={comment:"Comment",approve:"Approve","request-changes":"Request changes"},_s=({repo:t,number:s,verdicts:n,summary:a,verdict:l,pendingCount:d,busy:c,textareaRef:r,onSubmit:x})=>{const p=le(h=>h.setSummary),k=le(h=>h.setVerdict),m=n.includes(l)?l:n[0]??"comment",b=ls({verdict:m,summary:a,pendingCount:d});return e.jsxs("div",{children:[e.jsx(zt,{ref:r,rows:3,value:a,placeholder:"Summarize your review (optional)","aria-label":"Review summary",disabled:c,onChange:h=>p(t,s,h.target.value),onKeyDown:h=>{h.nativeEvent.isComposing||h.key==="Enter"&&(h.metaKey||h.ctrlKey)&&!h.shiftKey&&!h.altKey&&!h.repeat&&(h.preventDefault(),h.stopPropagation(),b&&!c&&x())}}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsxs("label",{className:"inline-flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"sr-only",children:"Review verdict"}),e.jsx("select",{value:m,disabled:c,onChange:h=>k(t,s,h.target.value),"aria-label":"Review verdict",className:"h-7 max-w-40 truncate rounded-md border border-border bg-[var(--surface-elevated)] px-1.5 typography-micro text-foreground",children:n.map(h=>e.jsx("option",{value:h,children:Bs[h]},h))})]}),e.jsx(P,{type:"button",variant:"default",size:"xs",disabled:c||!b,title:b?`Submit review${d>0?` with ${d} ${d===1?"line comment":"line comments"}`:""}`:"Add a summary or a line comment first",onClick:x,children:c?"Submitting…":"Submit review"})]})]})},dt=({directory:t,repo:s,number:n,github:a,access:l,size:d="sm",onReviewSubmitted:c})=>{const r=O(M=>M.submitReview),x=le(M=>M.removeComments),p=le(M=>M.clearSummary),k=le(M=>M.clearComments),m=Le(s,n),b=pt(s,n),h=gt(s,n),[A,F]=o.useState(!1),[T,j]=o.useState(!1),g=o.useRef(null),i=o.useMemo(()=>as(l),[l]),C=i.includes(h)?h:i[0]??"comment",L=m.length,f=L>0||b.trim().length>0;if(o.useEffect(()=>{if(!A)return;const M=window.requestAnimationFrame(()=>g.current?.focus({preventScroll:!0}));return()=>window.cancelAnimationFrame(M)},[A]),i.length===0)return null;const N=async()=>{if(T)return;const M=b,B=[...m];j(!0);try{const V=B.map($=>({path:$.path,body:$.body,...$.line!=null?{line:$.line}:{},...$.side?{side:$.side}:{}})),S=await r(t,s,n,{event:C,body:M.trim()?M:void 0,comments:V},a);if(!S.ok){H.error(S.error?.kind==="failed"?S.error.message:"Failed to submit review");return}x(s,n,B.map($=>$.id)),p(s,n,M),H.success(C==="approve"?"Pull request approved":C==="request-changes"?"Changes requested":"Review submitted"),F(!1),c?.()}finally{j(!1)}},E=L>0?`Review · ${L}`:"Review";return e.jsxs(Ye,{open:A,onOpenChange:F,children:[e.jsxs(Qe,{render:e.jsx(P,{type:"button",variant:L>0?"default":"outline",size:d,className:"shrink-0","aria-label":L>0?`Review pull request, ${L} ${L===1?"line comment":"line comments"} pending`:"Review pull request",title:f?"Finish your review":"Approve, request changes, or comment with a review"}),children:[e.jsx(z,{name:"file-check",className:"size-3.5","aria-hidden":"true"}),E]}),e.jsx(Xe,{children:e.jsx(Ze,{className:"z-50",side:"top",align:"end",sideOffset:8,collisionPadding:8,children:e.jsxs(et,{"aria-label":"Review pull request",className:"w-[min(24rem,calc(100vw-2rem))] rounded-lg border border-border/60 bg-[var(--surface-elevated)] p-3 shadow-lg",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate typography-ui-label text-foreground",children:L>0?`Review · ${L} ${L===1?"line comment":"line comments"}`:"Review pull request"}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[L>0?e.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":"Discard pending line comments",title:"Discard pending line comments",disabled:T,onClick:()=>k(s,n),className:"size-6",children:e.jsx(z,{name:"delete-bin",className:"size-3.5"})}):null,e.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":"Close review",onClick:()=>F(!1),className:"size-6",children:e.jsx(z,{name:"close",className:"size-3.5"})})]})]}),e.jsx(_s,{repo:s,number:n,verdicts:i,summary:b,verdict:C,pendingCount:L,busy:T,textareaRef:g,onSubmit:()=>{N()}})]})})})]})},ye=(t,s)=>`${t}#${s}`,_e=50,Us=Object.freeze([]),Ue=(t,s)=>{const n=Object.keys(t);if(n.length<=_e)return t;const a={};for(const l of n.slice(n.length-_e))a[l]=t[l];if(!(s in a)&&s in t){const l=Object.keys(a)[0];delete a[l],a[s]=t[s]}return a},pe=Es()(Fs((t,s)=>({entries:{},setViewed:(n,a,l,d)=>{const c=ye(n,a);(s().entries[c]?.viewed.includes(l)??!1)!==d&&t(p=>{const k=p.entries[c]??{viewed:[],headSha:null},m=d?[...k.viewed,l]:k.viewed.filter(b=>b!==l);return{entries:Ue({...p.entries,[c]:{...k,viewed:m}},c)}})},syncHeadSha:(n,a,l)=>{const d=ye(n,a),c=s().entries[d];c&&c.headSha===(l??null)||t(r=>({entries:Ue({...r.entries,[d]:{viewed:[],headSha:l??null}},d)}))},resetForRuntimeSwitch:()=>t({entries:{}})}),{name:"pichamber:github-viewed-files",version:1,storage:ks(),partialize:t=>({entries:t.entries})}));typeof window<"u"&&Cs(()=>{pe.getState().resetForRuntimeSwitch()});const Vs=(t,s)=>pe(n=>n.entries[ye(t,s)]?.viewed??Us),Ks=(t,s)=>pe(n=>n.entries[ye(t,s)]?.viewed.length??0),Ve=20,Js=[],Ws=[],Ke=t=>`pr-file-${encodeURIComponent(t)}`,ut=o.memo(({file:t,viewed:s,threadCount:n,pendingCount:a,showDir:l,onSelectFile:d})=>{const c=lt(t.status),{dir:r,base:x}=it(t.filename);return e.jsxs("button",{type:"button",onClick:()=>d(t.filename),title:t.filename,"aria-label":`Go to ${t.filename}`,className:"flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-left hover:bg-interactive-hover",children:[e.jsx(z,{name:ot(c),className:xe("size-3.5 shrink-0",Re(c)),"aria-hidden":"true"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono typography-micro",children:[l&&r?e.jsxs("span",{className:"text-muted-foreground",children:[r,"/"]}):null,e.jsx("span",{className:"text-foreground",children:x})]}),e.jsx(ge,{additions:t.additions,deletions:t.deletions,className:"typography-micro"}),n>0?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 typography-micro text-muted-foreground",title:`${n} ${n===1?"conversation":"conversations"}`,children:[e.jsx(z,{name:"chat-1",className:"size-3","aria-hidden":"true"}),e.jsx("span",{className:"tabular-nums",children:n})]}):null,a>0?e.jsxs("span",{className:"shrink-0 tabular-nums typography-micro text-muted-foreground",title:`${a} pending`,children:["+",a]}):null,s?e.jsx(z,{name:"check",className:"size-3.5 shrink-0 text-[var(--status-success)]","aria-label":"Viewed"}):null]})});ut.displayName="FileJumpRow";const mt=({files:t,viewedPaths:s,threadCounts:n,pendingCounts:a,onSelectFile:l})=>{const[d,c]=o.useState(""),r=o.useMemo(()=>zs(t),[t]),x=o.useMemo(()=>new Set(s),[s]),p=d.trim().toLowerCase(),k=o.useMemo(()=>p?r.map(m=>({...m,files:m.files.filter(b=>b.filename.toLowerCase().includes(p))})).filter(m=>m.files.length>0):r,[r,p]);return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-1",children:[e.jsx(st,{value:d,onChange:m=>c(m.target.value),placeholder:"Filter files","aria-label":"Filter files",className:"h-7 shrink-0 typography-micro"}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",role:"list","aria-label":"Changed files",children:k.length===0?e.jsx("p",{className:"px-1.5 py-2 typography-micro text-muted-foreground",children:t.length===0?"No changed files":"No files match"}):k.map(m=>e.jsxs("div",{role:"group","aria-label":m.folder||"Repository root",children:[r.length>1?e.jsx("p",{className:"truncate px-1.5 pt-1.5 pb-0.5 typography-micro text-muted-foreground",title:m.folder||"/",children:m.folder||"/"}):null,m.files.map(b=>e.jsx(ut,{file:b,viewed:x.has(b.filename),threadCount:n.get(b.filename)??0,pendingCount:a.get(b.filename)??0,showDir:r.length<=1,onSelectFile:l},b.filename))]},m.folder))})]})},Ys=t=>{const[s,n]=o.useState(!1),{onSelectFile:a}=t,l=o.useCallback(d=>{n(!1),a(d)},[a]);return e.jsxs(Ye,{open:s,onOpenChange:n,children:[e.jsxs(Qe,{render:e.jsx(P,{type:"button",variant:"ghost",size:"xs",className:"shrink-0","aria-label":`Jump to file, ${t.files.length} ${t.files.length===1?"file":"files"}`,title:"Jump to file"}),children:[e.jsx(z,{name:"file",className:"size-3.5","aria-hidden":"true"}),"Files"]}),e.jsx(Xe,{children:e.jsx(Ze,{className:"z-50",side:"bottom",align:"start",sideOffset:4,collisionPadding:8,children:e.jsx(et,{"aria-label":"Jump to file",className:"flex max-h-[min(28rem,calc(100dvh-4rem))] w-[min(22rem,calc(100vw-2rem))] flex-col rounded-lg border border-border/60 bg-[var(--surface-elevated)] p-1.5 shadow-lg",children:e.jsx(mt,{...t,onSelectFile:l})})})})]})},Qs=48,Xs=(t,s)=>{const[n,a]=o.useState(null);return o.useLayoutEffect(()=>{if(!s)return;const l=t.current?.closest("[data-diff-virtual-root]");if(!(l instanceof HTMLElement))return;const d=()=>{const r=Math.max(160,Math.floor(l.clientHeight-Qs));a(x=>x===r?x:r)};if(d(),typeof ResizeObserver>"u")return;const c=new ResizeObserver(d);return c.observe(l),()=>c.disconnect()},[t,s]),n},Zs=t=>{const{directory:s,repo:n,number:a,github:l,access:d,headSha:c=null}=t,r=t.files?.files??Js,x=Vs(n,a),p=Ks(n,a),k=Le(n,a);o.useEffect(()=>{pe.getState().syncHeadSha(n,a,c)},[n,a,c]);const m=o.useMemo(()=>Ds(r),[r]),b=o.useRef(m);b.current=m;const h=o.useRef(r);h.current=r;const[A,F]=o.useState({}),[T,j]=o.useState(Ve),g=o.useMemo(()=>As(r),[r]),i=o.useMemo(()=>{const R=new Map;for(const I of t.threads){if(!I.path)continue;const y=R.get(I.path)??[];y.push(I),R.set(I.path,y)}return R},[t.threads]),C=o.useMemo(()=>{const R=new Map;for(const[I,y]of i)R.set(I,y.length);return R},[i]),L=o.useMemo(()=>{const R=new Map;for(const I of k)R.set(I.path,(R.get(I.path)??0)+1);return R},[k]),f=o.useCallback(R=>{F(I=>({...I,[R]:!(I[R]??b.current[R]??!1)}))},[]),N=o.useCallback(()=>{F(Object.fromEntries(h.current.map(R=>[R.filename,!1])))},[]),E=o.useCallback(()=>{F(Object.fromEntries(h.current.map(R=>[R.filename,!0])))},[]),M=o.useCallback((R,I)=>{pe.getState().setViewed(n,a,R,I),F(y=>({...y,[R]:I}))},[n,a]),B=o.useCallback(R=>{F(y=>y[R]??b.current[R]??!1?{...y,[R]:!1}:y);const I=h.current.findIndex(y=>y.filename===R);I>=0&&j(y=>I<y?y:I+1),requestAnimationFrame(()=>{document.getElementById(Ke(R))?.scrollIntoView({block:"start"})})},[]),V=o.useMemo(()=>r.slice(0,T),[r,T]),S=o.useRef(null),$=Xs(S,V.length>0),K=o.useMemo(()=>new Set(x),[x]),_=r.length===1?"1 file":`${r.length} files`,X=r.length===0?"Nothing viewed yet":`${p}/${r.length} viewed`;return e.jsxs("section",{"aria-label":"Changed files",className:"@container flex flex-col gap-2","data-diff-virtual-content":!0,children:[e.jsx(ve,{error:t.filesError,onRetry:t.onRetryFiles,label:"Changed files"}),e.jsx(ve,{error:t.threadsError,onRetry:t.onRetryDetail,label:"Review threads"}),e.jsxs("div",{className:"sticky top-0 z-10 flex h-8 shrink-0 items-center gap-2 border-b border-border/60 bg-[var(--surface-background)] px-1 text-[12px]",children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:_}),e.jsx(ge,{additions:g.additions,deletions:g.deletions}),e.jsxs("span",{className:"shrink-0 tabular-nums text-muted-foreground","aria-label":X,children:[p,"/",r.length," viewed"]}),e.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[e.jsx(dt,{directory:s,repo:n,number:a,github:l,access:d,size:"xs",onReviewSubmitted:t.onReviewSubmitted}),e.jsx("span",{className:"@4xl:hidden",children:e.jsx(Ys,{files:r,viewedPaths:x,threadCounts:C,pendingCounts:L,onSelectFile:B})}),e.jsx(P,{type:"button",variant:"ghost",size:"icon",onClick:N,"aria-label":"Expand all files",title:"Expand all files",className:"size-7",children:e.jsx(z,{name:"expand-up-down",className:"size-3.5"})}),e.jsx(P,{type:"button",variant:"ghost",size:"icon",onClick:E,"aria-label":"Collapse all files",title:"Collapse all files",className:"size-7",children:e.jsx(z,{name:"collapse-vertical",className:"size-3.5"})})]})]}),t.filesLoading&&V.length===0?e.jsx(Rs,{rows:5,label:"Loading changed files"}):null,!t.filesLoading&&V.length===0?e.jsx("p",{className:"px-1 py-4 typography-micro text-muted-foreground",children:"No changed files"}):null,V.length>0?e.jsxs("div",{className:"flex min-h-0 items-start gap-3",children:[e.jsx("aside",{ref:S,"aria-label":"Changed files",style:$!=null?{height:$}:void 0,className:"sticky top-10 hidden max-h-[calc(100dvh-10rem)] w-60 shrink-0 flex-col @4xl:flex",children:e.jsx(mt,{files:r,viewedPaths:x,threadCounts:C,pendingCounts:L,onSelectFile:B})}),e.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:V.map(R=>e.jsx("div",{id:Ke(R.filename),className:"scroll-mt-12",children:e.jsx(Is,{file:R,collapsed:A[R.filename]??m[R.filename]??!1,onToggleCollapse:f,viewed:K.has(R.filename),onToggleViewed:M,blobUrl:$s(n,c,R.filename),threads:i.get(R.filename)??Ws,directory:s,repo:n,number:a,github:l,access:d,onThreadsChanged:t.onRetryDetail})},R.filename))})]}):null,r.length>T?e.jsx("div",{children:e.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>j(T+Ve),children:"Show more files"})}):null,t.filesHasMore?e.jsx("div",{children:e.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:t.onLoadMoreFiles,children:"Load more files"})}):null]})},en=({directory:t,repo:s,number:n,github:a,checks:l,checksError:d,checksLoading:c,onRetryChecks:r,onOpenFilesAtLine:x})=>{const[p,k]=o.useState({}),[m,b]=o.useState({}),{send:h,sendingKey:A}=Fe(),F=os(l);return e.jsxs("div",{className:"flex flex-col gap-1 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-1 py-1",children:[e.jsx("p",{className:"min-w-0 flex-1 typography-micro text-muted-foreground","aria-live":"polite",children:F?F.text:c?"Loading checks…":"No checks reported for this pull request."}),F&&F.failed>0?e.jsxs(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>{h({key:`pr-${n}-failed-checks`,kind:"checks",directory:t,repo:s,number:n,contextType:"checks"})},disabled:A===`pr-${n}-failed-checks`,"aria-label":"Send failed checks to agent",title:"Send failed checks to agent",children:[e.jsx(z,{name:"send-plane-2",className:"size-3.5"}),"Send failures to agent"]}):null,e.jsxs(P,{type:"button",variant:"ghost",size:"xs",onClick:r,"aria-label":"Refresh checks",title:"Refresh checks",children:[e.jsx(z,{name:"refresh",className:xe("size-3.5",c&&"animate-spin")}),"Refresh"]})]}),e.jsx(ve,{error:d,onRetry:r,label:"Checks"}),l?e.jsx(tn,{checks:l,directory:t,repo:s,number:n,github:a,expandedJobs:p,onToggleJob:T=>k(j=>({...j,[T]:!j[T]})),jobSteps:m,setJobSteps:b,sendingKey:A,send:h,onOpenFilesAtLine:x}):null]})},tn=({checks:t,directory:s,repo:n,number:a,github:l,expandedJobs:d,onToggleJob:c,jobSteps:r,setJobSteps:x,sendingKey:p,send:k,onOpenFilesAtLine:m})=>{const b=O(i=>i.rerunFailedChecks),[h,A]=o.useState({}),F=async i=>{const C=`run-${i.id??i.name}`;if(c(C),!(d[C]||r[C]||i.id==null)){x(L=>({...L,[C]:{steps:[],loading:!0}}));try{const f=(await l.checkJobs(s,n,i.runId??null,i.id)).jobs[0];x(E=>({...E,[C]:{steps:f?.steps??[],loading:!1}}));const N=await l.checkAnnotations(s,n,i.id).catch(()=>null);N&&A(E=>({...E,[i.id]:{loading:!1,items:N.annotations}}))}catch{x(L=>({...L,[C]:{steps:[],loading:!1}}))}}},T=async i=>{(await b(s,n,i,l)).ok?H.success("Re-run requested"):H.error("Re-run failed")},j=i=>{const C=`run-${i.id??i.name}`,L=d[C]??!1,f=r[C],N=is(i);return e.jsxs("div",{className:"rounded-md px-2 py-2 hover:bg-interactive-hover",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(fe,{state:i.conclusion??i.status}),e.jsx("span",{className:"min-w-0 flex-1 truncate typography-ui text-foreground",title:i.name,children:i.name}),i.conclusion?e.jsx("span",{className:"typography-micro text-muted-foreground",children:i.conclusion}):null,e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>{F(i)},"aria-expanded":L,"aria-label":`${L?"Collapse":"Expand"} ${i.name}`,children:"Details"}),N&&i.runId!=null?e.jsx(P,{type:"button",variant:"outline",size:"xs",onClick:()=>{T(i.runId)},children:"Re-run"}):null,N?e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>{k({key:`${C}-agent`,kind:"check",directory:s,repo:n,number:a,contextType:"checks",detail:i.name})},disabled:p===`${C}-agent`,"aria-label":`Send ${i.name} to agent`,children:"Send to agent"}):null]}),L?e.jsxs("div",{className:"mt-1.5 flex flex-col gap-1 border-t border-border/60 pt-1.5",children:[f?.loading?e.jsx("span",{className:"typography-micro text-muted-foreground",children:"Loading steps…"}):null,(f?.steps??[]).map((E,M)=>e.jsxs("div",{className:"flex items-center gap-1.5 typography-micro text-muted-foreground",children:[e.jsx(fe,{state:E.conclusion??E.status}),e.jsx("span",{className:"truncate",children:E.name}),E.conclusion?e.jsxs("span",{children:["· ",E.conclusion]}):null]},`${E.name}-${M}`)),i.id!=null&&h[i.id]?.items?.length?e.jsx("div",{className:"flex flex-col gap-1",children:h[i.id]?.items.map((E,M)=>e.jsxs("div",{className:"typography-micro text-muted-foreground",children:[E.path&&E.startLine&&m?e.jsxs("button",{type:"button",className:"font-mono underline",onClick:()=>m(E.path,E.startLine),children:[E.path,":",E.startLine]}):e.jsxs("span",{className:"font-mono",children:[E.path,E.startLine?`:${E.startLine}`:""]})," ",E.title?e.jsxs("span",{className:"text-foreground",children:[E.title," — "]}):null,E.message]},M))}):null]}):null]},C)},g=(i,C)=>e.jsxs("div",{className:"flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-interactive-hover",children:[e.jsx(fe,{state:i.state}),e.jsx("span",{className:"min-w-0 flex-1 truncate typography-ui text-foreground",title:i.context,children:i.context}),i.description?e.jsx("span",{className:"truncate typography-micro text-muted-foreground",children:i.description}):null]},`${i.context}-${C}`);return e.jsxs("div",{className:"flex flex-col gap-1",children:[t.sectionErrors?.runs||t.sectionErrors?.statuses?e.jsx("div",{className:"rounded-md border border-[var(--status-warning-border)] bg-[var(--status-warning-background)] px-2 py-1 typography-micro text-foreground",role:"alert",children:"Some check sources failed to load; counts below are partial, not empty."}):null,t.runs.length>0?e.jsx("div",{className:"flex flex-col","aria-label":"Check runs",children:t.runs.map(j)}):null,t.statuses.length>0?e.jsx("div",{className:"flex flex-col","aria-label":"Commit statuses",children:t.statuses.map(g)}):null,t.runs.length===0&&t.statuses.length===0?e.jsx("p",{className:"typography-ui text-muted-foreground",children:"No checks reported for this pull request."}):null]})},Je=({pr:t})=>e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(at,{login:t.author?.login,avatarUrl:t.author?.avatarUrl,size:"xs"}),t.author?.login??"ghost"]}),t.updatedAt?` · updated ${bs(t.updatedAt)}`:"",t.draft?" · Draft":""]}),We=({pr:t,filesCount:s})=>e.jsxs(e.Fragment,{children:[e.jsx("code",{className:"shrink-0 truncate",title:t.base,children:t.base}),e.jsx("span",{className:"shrink-0","aria-label":"receives changes from",children:"←"}),e.jsx("code",{className:"min-w-0 flex-1 truncate",title:t.head,children:t.head}),typeof s=="number"?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 tabular-nums",children:[e.jsx(z,{name:"file-code",className:"size-3 shrink-0","aria-hidden":"true"}),s," ",s===1?"file":"files"]}):null,e.jsx(ge,{additions:t.additions,deletions:t.deletions})]}),sn=({repo:t,pr:s,access:n,acting:a,mergeMethod:l,onMergeMethodChange:d,onRun:c,checkingOut:r,onCheckout:x,onCopyLink:p,askSending:k,onAskAgent:m})=>{const b=O(N=>N.setMergeMethod),h=s.state==="open",A=be.filter(N=>te(N.id,s,n).allowed),F=A.some(N=>N.id===l)?l:A[0]?.id??l,T=te(F,s,n),j=te("ready",s,n),g=te("draft",s,n),i=te("close",s,n),C=te("reopen",s,n),L=be.find(N=>N.id===F)??be[0],f=A.length===0||a;return e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 pt-1 pb-2","aria-label":"Pull request actions",children:[h&&!s.draft?e.jsxs("span",{role:"group","aria-label":"Merge pull request",className:"inline-flex shrink-0 items-center gap-1",children:[e.jsx(ce,{copy:he(F,s.base,s.head),busy:a,disabled:!T.allowed,disabledReason:T.reason??`Merge via ${L.label}`,label:F==="merge"?"Merge pull request":L.label,icon:e.jsx(z,{name:"git-merge",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>c(F)}),e.jsxs(Me,{modal:!1,children:[e.jsx(ze,{asChild:!0,children:e.jsx(P,{type:"button",variant:"default",size:"xs",className:"shrink-0 px-1.5",title:"Merge options","aria-label":"Merge options",disabled:f,children:e.jsx(z,{name:"arrow-down-s",className:"size-3.5"})})}),e.jsx(Ae,{align:"start",className:"w-72",children:e.jsx(Ft,{value:F,onValueChange:N=>{const E=N;d(E),b(t,E)},children:be.map(N=>{const E=te(N.id,s,n);return e.jsx(Pt,{value:N.id,disabled:!E.allowed,title:E.reason??N.description,children:e.jsxs("span",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"truncate",children:N.label}),e.jsx("span",{className:"truncate typography-micro text-muted-foreground",children:N.description})]})},N.id)})})})]})]}):null,h&&s.draft?e.jsx(ce,{copy:he("ready",s.base,s.head),busy:a,disabled:!j.allowed,disabledReason:j.reason??"Ready for review",label:"Ready for review",icon:e.jsx(z,{name:"git-pull-request",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>c("ready")}):null,h&&!s.draft?e.jsx(ce,{copy:he("draft",s.base,s.head),busy:a,variant:"outline",disabled:!g.allowed,disabledReason:g.reason??"Convert to draft",label:"Convert to draft",icon:e.jsx(z,{name:"pencil",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>c("draft")}):null,h?e.jsx(ce,{copy:he("close",s.base,s.head),busy:a,destructive:!0,variant:"outline",disabled:!i.allowed,disabledReason:i.reason??"Close pull request",label:"Close",icon:e.jsx(z,{name:"close",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>c("close")}):e.jsxs(P,{type:"button",variant:"outline",size:"xs",className:"shrink-0",onClick:()=>c("reopen"),disabled:!C.allowed||a,title:C.reason??"Reopen pull request","aria-label":"Reopen pull request",children:[e.jsx(z,{name:"history",className:"size-3.5","aria-hidden":"true"}),"Reopen"]}),e.jsxs(P,{type:"button",variant:"outline",size:"xs",className:"shrink-0",onClick:()=>x("worktree"),disabled:r,title:"Check out in a new worktree","aria-label":"Check out in a new worktree",children:[e.jsx(z,{name:"git-branch",className:"size-3.5","aria-hidden":"true"}),r?"Checking out…":"Check out"]}),e.jsx(ce,{copy:{title:"Check out this branch here?",detail:"This switches your current checkout to the PR branch. Uncommitted work may be disrupted.",confirm:"Check out here",progress:"Checking out…"},busy:r,variant:"outline",label:"Check out here",icon:e.jsx(z,{name:"git-branch",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>x("current")}),e.jsxs(P,{type:"button",variant:"outline",size:"xs",className:"shrink-0",onClick:m,disabled:k,title:"Send pull request context to the agent composer","aria-label":"Ask agent about this pull request",children:[e.jsx(z,{name:"send-plane-2",className:"size-3.5","aria-hidden":"true"}),k?"Asking…":"Ask agent"]}),e.jsxs(P,{type:"button",variant:"ghost",size:"xs",className:"shrink-0",onClick:()=>{Se(s.url)},title:"Review on GitHub","aria-label":"Review on GitHub",children:[e.jsx(z,{name:"external-link",className:"size-3.5","aria-hidden":"true"}),"Review on GitHub"]}),e.jsxs(Me,{modal:!1,children:[e.jsx(ze,{asChild:!0,children:e.jsx(P,{type:"button",variant:"ghost",size:"xs",className:"shrink-0 px-1.5","aria-label":"More pull request actions",title:"More pull request actions",children:e.jsx(z,{name:"more-2",className:"size-4"})})}),e.jsxs(Ae,{align:"end",className:"w-60",children:[e.jsxs(we,{onClick:()=>{Se(s.url)},children:[e.jsx(z,{name:"external-link",className:"size-3.5"}),"Open on GitHub"]}),e.jsxs(we,{onClick:p,children:[e.jsx(z,{name:"file-copy",className:"size-3.5"}),"Copy link"]}),e.jsx(Tt,{}),e.jsxs(we,{onClick:()=>x("worktree"),disabled:r,children:[e.jsx(z,{name:"git-branch",className:"size-3.5"}),"Check out in new worktree"]})]})]})]})},nn=({pr:t,access:s,acting:n,onRun:a})=>{const l=vs(t);if(!l)return null;const d=te("update-branch",t,s),c=l.tone==="error"?"border-[var(--status-error-border)] bg-[var(--status-error-background)] text-foreground":"border-[var(--status-warning-border)] bg-[var(--status-warning-background)] text-foreground",r=l.tone==="error"?"text-[var(--status-error)]":"text-[var(--status-warning)]";return e.jsxs("div",{className:`mx-3 mb-2 flex flex-wrap items-center gap-x-2 gap-y-1.5 rounded-md border px-2.5 py-2 ${c}`,role:"status",children:[e.jsx(z,{name:l.icon,className:`size-4 shrink-0 ${r}`,"aria-hidden":"true"}),e.jsxs("p",{className:"min-w-0 flex-1 basis-48",children:[e.jsxs("span",{className:"typography-ui-label font-medium",children:[l.title," ",e.jsx("code",{className:"font-mono",children:t.base})]}),e.jsx("span",{className:"block typography-micro text-muted-foreground",children:l.detail})]}),l.canUpdate?e.jsx(ce,{copy:he("update-branch",t.base,t.head),busy:n,variant:"outline",disabled:!d.allowed,disabledReason:d.reason??"Update branch",label:"Update branch",icon:e.jsx(z,{name:"refresh",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>a("update-branch")}):e.jsxs(P,{type:"button",variant:"outline",size:"xs",className:"shrink-0",onClick:()=>{Se(t.url)},title:"Resolve conflicts on GitHub","aria-label":"Resolve conflicts on GitHub",children:[e.jsx(z,{name:"external-link",className:"size-3.5","aria-hidden":"true"}),"Resolve on GitHub"]})]})},an=t=>{const{directory:s,repo:n,number:a,github:l,detail:d}=t,c=O(u=>u.performAction),r=O(u=>u.updateTitleBody),x=O(u=>u.checkout),[p,k]=o.useState("summary"),[m,b]=o.useState(!1),[h,A]=o.useState(()=>At(n)??"merge"),[F,T]=o.useState(!1),[j,g]=o.useState(""),[i,C]=o.useState(!1),[L,f]=o.useState(""),[N,E]=o.useState("newest"),[M,B]=o.useState(1),[V,S]=o.useState(!1),[$,K]=o.useState(null),_=bt(n,a),{send:X,sendingKey:R}=Fe(),I=rs(s,n),y=d?.pr??null,de=d?.sectionErrors??null,Q=o.useMemo(()=>({capabilities:d?.capabilities??null,isAuthor:cs(y?.author?.login,d?.viewerLogin),permissionFallback:d?.viewerPermission?.fallback===!0}),[d?.capabilities,d?.viewerLogin,d?.viewerPermission?.fallback,y?.author?.login]),ee=ds(y,Q);o.useEffect(()=>{k("summary"),T(!1),C(!1),B(1),K(null)},[n,a]);const Z=o.useCallback(async u=>{b(!0);try{const Y=await c(s,n,a,u,l);if(!Y.ok){H.error(Y.error?.kind==="failed"?Y.error.message:"Action failed");return}u==="close"?H.success("Pull request closed"):u==="reopen"?H.success("Pull request reopened"):u==="update-branch"?H.success("Branch update requested"):u==="ready"?H.success("Marked as ready for review"):u==="draft"?H.success("Converted to draft"):H.success("Pull request merged")}finally{b(!1)}},[s,n,a,l,c]),se=o.useCallback(()=>{X({key:`pr-${a}-ask`,kind:"pr",directory:s,repo:n,number:a,contextType:"pr"})},[X,s,n,a]),ne=o.useCallback(async()=>{if(!j.trim()){H.error("Enter a title");return}const u=await r(s,n,a,{title:j.trim()},l);u.ok?(H.success("Title updated"),T(!1)):H.error(u.error?.kind==="failed"?u.error.message:"Failed to update title")},[j,s,n,a,l,r]),oe=o.useCallback(async()=>{const u=await r(s,n,a,{body:L},l);u.ok?(H.success("Description updated"),C(!1)):H.error(u.error?.kind==="failed"?u.error.message:"Failed to update description")},[L,s,n,a,l,r]),ae=Ee().git,ue=o.useCallback(async u=>{if(u==="current"){const Y=await Ne(()=>import("./useAppFontEffects-DviRbaCJ.js").then(re=>re.dV),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(re=>re.useGitStore.getState().directories.get(s)?.status??null).catch(()=>null);if(Y&&!Y.isClean){H.error("Working tree has uncommitted changes. Commit or stash first, or use New worktree.");return}}S(!0);try{const Y=await x(s,n,a,u,l);Y.ok?(await vt(s,ae),K({path:Y.path??null,branch:Y.branch??""}),H.success(u==="worktree"?"Worktree created":"Branch checked out")):H.error(Y.error?.kind==="failed"?Y.error.message:"Checkout failed")}finally{S(!1)}},[s,n,a,l,ae,x]),w=o.useCallback(()=>{$?.path&&Ne(async()=>{const{useSessionUIStore:u}=await import("./useAppFontEffects-DviRbaCJ.js").then(Y=>Y.dS);return{useSessionUIStore:u}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(({useSessionUIStore:u})=>{u.getState().openNewSessionDraft({directoryOverride:$.path}),Ns.getState().setActiveMainTab("chat")})},[$]),G=us(y?.url),q=o.useMemo(()=>{const u=[...t.comments];return u.sort((Y,je)=>{const re=Y.createdAt?Date.parse(Y.createdAt):0,Te=je.createdAt?Date.parse(je.createdAt):0;return N==="newest"?Te-re:re-Te}),u},[t.comments,N]),D=q.slice(0,M*20),U=D.filter(u=>!$e(u.author?.login)),W=D.filter(u=>$e(u.author?.login));if(t.detailError&&!d)return e.jsx(ke,{header:e.jsx(Ce,{onBack:t.onBack,backLabel:"Back to pull requests",repoName:I,number:a,openLabel:`Open pull request #${a} on GitHub`,title:`Pull request #${a}`}),tabs:[],activeTab:"",onTabChange:()=>{},children:e.jsx(tt,{info:yt(t.detailError),onRetry:t.onRetryDetail})});if(!y){const u=t.seed&&t.seed.number===a?t.seed:null;return e.jsx(ke,{header:e.jsx(Ce,{onBack:t.onBack,backLabel:"Back to pull requests",repoName:I,number:a,url:u?.url??null,numberTintClass:u?He("pr",u.state,u.draft):void 0,statePill:u?e.jsx(Ge,{kind:"pr",state:u.state,draft:u.draft}):void 0,openLabel:`Open pull request #${a} on GitHub`,title:u?.title??null,meta:u?e.jsx(Je,{pr:u}):void 0,branches:u?e.jsx(We,{pr:u,filesCount:u.changedFiles??null}):void 0}),tabs:[],activeTab:"",onTabChange:()=>{},children:e.jsx(ms,{label:"Loading pull request"})})}const J=t.checks?.summary??null,me=t.files?.files.length??y.changedFiles??0,v=_>0&&!t.hideFilesTab?`${me} · ${_} pending`:String(me);return e.jsx(ke,{header:e.jsxs(e.Fragment,{children:[e.jsx(Ce,{onBack:t.onBack,backLabel:"Back to pull requests",repoName:I,number:y.number,url:y.url,numberTintClass:He("pr",y.state,y.draft),statePill:e.jsx(Ge,{kind:"pr",state:y.state,draft:y.draft}),openLabel:`Open pull request #${y.number} on GitHub`,title:y.title,onEditTitle:()=>{g(y.title),T(!0)},editTitleLabel:"Edit pull request title",editTitleDisabledReason:ee.allowed?null:ee.reason,meta:e.jsx(Je,{pr:y}),branches:e.jsx(We,{pr:y,filesCount:me})}),e.jsx(sn,{directory:s,repo:n,number:a,github:l,pr:y,access:Q,acting:m,mergeMethod:h,onMergeMethodChange:A,onRun:u=>{Z(u)},checkingOut:V,onCheckout:u=>{ue(u)},onCopyLink:G,askSending:R===`pr-${a}-ask`,onAskAgent:se}),e.jsx(nn,{pr:y,access:Q,acting:m,onRun:u=>{Z(u)}})]}),tabs:[{id:"summary",label:"Summary"},...t.hideFilesTab?[]:[{id:"files",label:"Code",hint:v}],{id:"checks",label:"Checks",hint:J?`${J.success}/${J.total}`:void 0,glyph:J?e.jsx(fe,{state:J.state}):void 0}],activeTab:p,onTabChange:u=>k(u),children:e.jsxs("div",{className:"flex flex-col gap-1 px-3 py-2",children:[t.detailStale?e.jsxs("p",{className:"typography-micro text-muted-foreground",role:"note",children:["Showing saved details — last refresh failed."," ",e.jsx("button",{type:"button",className:"underline",onClick:t.onRetryDetail,children:"Retry"})]}):null,Q.permissionFallback?e.jsx("p",{className:"typography-micro text-muted-foreground",role:"note",children:"Permissions could not be loaded — actions stay enabled and any failure will be shown after you act."}):null,F?e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 py-1",children:[e.jsx(st,{value:j,onChange:u=>g(u.target.value),"aria-label":"Pull request title",className:"h-7"}),e.jsx(P,{type:"button",variant:"default",size:"xs",onClick:()=>{ne()},children:"Save"}),e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>T(!1),children:"Cancel"})]}):null,$?e.jsxs("p",{className:"flex flex-wrap items-center gap-1.5 typography-micro text-muted-foreground",children:[e.jsx(z,{name:"check",className:"size-3.5 shrink-0 text-[var(--status-success)]"}),e.jsxs("span",{children:["Ready on ",$.branch,$.path?` at ${$.path}`:"","."]}),$.path?e.jsx(P,{type:"button",variant:"default",size:"xs",onClick:w,children:"Open session here"}):null,e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>K(null),"aria-label":"Dismiss checkout result",children:"Dismiss"})]}):null,p==="summary"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5 py-1",children:[e.jsx(qe,{icon:"user",label:"Reviewers",children:e.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5",children:[y.requestedReviewers.length===0?e.jsx("span",{className:"typography-micro text-muted-foreground",children:"None"}):y.requestedReviewers.map(u=>e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 typography-micro text-muted-foreground",children:[e.jsx(at,{login:u.login,avatarUrl:u.avatarUrl,size:"xs"}),e.jsx("span",{className:"truncate",children:u.login})]},u.login)),e.jsxs("span",{className:"typography-micro tabular-nums text-muted-foreground",children:[y.reviewSummary.approvals," approvals · ",y.reviewSummary.changesRequested," changes requested ·"," ",y.reviewSummary.commented," commented"]})]})}),e.jsx(qe,{icon:"list-unordered",label:"Labels",children:e.jsx("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:y.labels.length===0?e.jsx("span",{className:"typography-micro text-muted-foreground",children:"None"}):y.labels.map(u=>e.jsx(hs,{name:u.name,color:u.color},u.name))})})]}),e.jsx(Ie,{id:`pr-${a}-description`,title:"Description",action:i?void 0:e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>{f(y.body??""),C(!0)},"aria-label":"Edit description",title:ee.reason??"Edit description",disabled:!ee.allowed,children:"Edit"}),children:i?e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("textarea",{value:L,onChange:u=>f(u.target.value),rows:6,"aria-label":"Pull request description",className:"min-h-24 w-full rounded-md border border-border bg-[var(--surface-elevated)] p-2 typography-ui text-foreground"}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(P,{type:"button",variant:"default",size:"sm",onClick:()=>{oe()},children:"Save"}),e.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>C(!1),children:"Cancel"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(fs,{markdown:y.body??"",html:y.bodyHtml??null,fallbackUrl:y.url,label:"pull request description"}),y.body?.trim()?null:e.jsx("p",{className:"typography-micro text-muted-foreground",children:"No description provided."})]})}),e.jsx(Ie,{id:`pr-${a}-comments`,title:`Comments${q.length?` (${q.length})`:""}`,action:e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:[t.hideFilesTab?e.jsx(dt,{directory:s,repo:n,number:a,github:l,access:Q,size:"xs",onReviewSubmitted:t.onRetryDetail}):null,e.jsx(gs,{order:N,onToggle:()=>E(N==="newest"?"oldest":"newest")})]}),children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(ve,{error:t.commentsError,onRetry:t.onRetryComments,label:"Comments"}),U.map(u=>e.jsx(xs,{comment:u},u.id)),e.jsx(ps,{comments:W}),t.commentsLoading&&q.length===0&&!t.commentsError?e.jsx("p",{className:"typography-micro text-muted-foreground",children:"Loading comments…"}):null,q.length===0&&!t.commentsLoading&&!t.commentsError?e.jsx("p",{className:"typography-micro text-muted-foreground",children:"No comments yet."}):null,q.length>D.length?e.jsx("div",{children:e.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>B(M+1),children:"Show older comments"})}):t.commentsHasMore?e.jsx("div",{children:e.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:t.onLoadMoreComments,disabled:t.commentsLoading,children:t.commentsLoading?"Loading…":"Load older comments"})}):null,e.jsx(Os,{directory:s,repo:n,number:a,github:l,pr:y,access:Q,onCommented:()=>{t.onRetryComments(),t.onRetryDetail()}})]})})]}):null,p==="files"&&!t.hideFilesTab?e.jsx(Zs,{files:t.files,filesLoading:t.filesLoading,filesError:t.filesError,filesHasMore:t.filesHasMore,onLoadMoreFiles:t.onLoadMoreFiles,onRetryFiles:t.onRetryFiles,threads:t.threads,threadsError:de?.threads??null,onRetryDetail:t.onRetryDetail,directory:s,repo:n,number:a,github:l,access:Q,headSha:y.headSha??null,onReviewSubmitted:t.onRetryDetail},`${n}#${a}`):null,p==="checks"?e.jsx(en,{directory:s,repo:n,number:a,github:l,checks:t.checks,checksError:t.checksError,checksLoading:t.checksLoading,onRetryChecks:t.onRetryChecks,onOpenFilesAtLine:t.onOpenFilesAtLine}):null]})})},ln=({items:t,hasMore:s,isLoadingMore:n,isLoading:a,isRefreshing:l,stale:d,error:c,filters:r,checksByUrl:x,countComplete:p=!0,incompleteNotice:k=null,remote:m=null,numberJump:b=null,onFiltersChange:h,onClearFilters:A,onLoadMore:F,onRetry:T,onOpen:j,headerActionsSlot:g=null,headerActionsPresentation:i="drawer"})=>{const C=r.state==="open"&&r.involvement==="all"&&!r.search.trim(),L=o.useCallback(f=>e.jsx("li",{role:"listitem",children:e.jsx(jt,{glyph:e.jsx(ys,{kind:"pr",state:f.state,draft:f.draft}),glyphBelow:e.jsx(fe,{state:(f.url?x[f.url]:void 0)??null}),number:`#${f.number}`,title:f.title,status:e.jsx(ge,{additions:f.additions,deletions:f.deletions,className:"typography-micro"}),meta:e.jsxs(e.Fragment,{children:[e.jsx(wt,{login:f.author?.login,avatarUrl:f.author?.avatarUrl}),e.jsx(kt,{head:f.head,base:f.base}),f.draft?e.jsx("span",{className:"shrink-0 rounded bg-[var(--surface-muted)] px-1 typography-micro text-muted-foreground",children:"Draft"}):null]}),updatedAt:f.updatedAt,onOpen:()=>j(f.number),ariaLabel:`Open pull request #${f.number} ${f.title}`})},f.number),[x,j]);return e.jsx(Ct,{items:t,renderRow:L,hasMore:s,isLoadingMore:n,isLoading:a,isRefreshing:l,stale:d,error:c,searchValue:r.search,onSearchChange:f=>h({search:f}),searchPlaceholder:"Search pull requests, or label:bug",searchAriaLabel:"Search pull requests",toolbarControls:e.jsx(Nt,{stateValue:r.state,stateOptions:Oe.map(f=>({id:f.id,label:f.label})),onStateChange:f=>h({state:f}),involvementValue:r.involvement,involvementOptions:ws.map(f=>({id:f.id,label:f.label})),onInvolvementChange:f=>h({involvement:f}),sortValue:r.sort,sortOptions:js.map(f=>({id:f.id,label:f.label})),onSortChange:f=>h({sort:f}),sortAriaLabel:"Sort pull requests"}),headerActionsSlot:g,headerActionsPresentation:i,isDefaultFilters:C,stateLabel:Oe.find(f=>f.id===r.state)?.label??r.state,kindSingular:"pull request",kindPlural:"pull requests",noItemsTitle:r.state==="open"?"No open pull requests":"No pull requests yet",noItemsBody:"Pull requests for this repository appear here.",noItemsIcon:"git-pull-request",listAriaLabel:"Pull requests",skeletonLabel:"Loading pull requests",updatedAtOf:f=>f.updatedAt,countComplete:p,incompleteNotice:k,remote:m,numberJump:b,numberJumpKind:"pull request",onClearFilters:A,onLoadMore:F,onRetry:T,onOpen:j})},on=t=>{const s=Dt(n=>n.results);return o.useMemo(()=>{const n=$t(s),a={};for(const l of t){if(!l.url)continue;const d=n.get(l.url);d!==void 0&&(a[l.url]=d)}return a},[t,s])},ca=({hideFilesTab:t=!1,headerActionsSlot:s=null,headerActionsPresentation:n="drawer"})=>{const a=Mt()??"";return a?e.jsx(rn,{directory:a,hideFilesTab:t,headerActionsSlot:s,headerActionsPresentation:n}):e.jsx("div",{className:"flex h-full items-center justify-center p-6 text-center",children:e.jsx("p",{className:"typography-ui text-muted-foreground",children:"Open a project to browse pull requests."})})},rn=({directory:t,hideFilesTab:s,headerActionsSlot:n=null,headerActionsPresentation:a="drawer"})=>{const d=Ee().github??null,[c,r]=o.useState(!1),[x,p]=o.useState(!1),k=o.useRef(null);return o.useEffect(()=>Gt(),[]),e.jsx(St,{directory:t,isRefreshing:c,onRefresh:()=>k.current?.(),children:({repo:m,directory:b})=>e.jsx(cn,{directory:b,repo:m,github:d,refreshing:c,setRefreshing:r,loadingMore:x,setLoadingMore:p,refreshRef:k,hideFilesTab:s,headerActionsSlot:n,headerActionsPresentation:a},m)})},cn=({directory:t,repo:s,github:n,refreshing:a,setRefreshing:l,loadingMore:d,setLoadingMore:c,refreshRef:r,hideFilesTab:x,headerActionsSlot:p=null,headerActionsPresentation:k="drawer"})=>{const m=O(v=>v.ensureCollectionsFresh),b=O(v=>v.searchRemote),h=O(v=>v.loadMoreRemote),A=O(v=>v.loadMoreCollection),F=O(v=>v.refreshAllForScope),T=O(v=>v.selectPullRequest),j=O(v=>v.setFilters),g=O(v=>v.resetFilters),i=Ht(t,s),C=qt(t),L=It(),f=C.repo===s?C.number:null,N=i.state==="open"?"open":i.state==="all"?"both":"closed";o.useEffect(()=>{if(!n)return;let v=!1;return l(!0),m(t,s,N,n).then(()=>{v||l(!1)}).catch(()=>{v||l(!1)}),()=>{v=!0}},[t,s,n,N]),o.useEffect(()=>{if(!n)return;const v=()=>{typeof document<"u"&&document.hidden||m(t,s,N,n).catch(()=>{})};return window.addEventListener("focus",v),document.addEventListener("visibilitychange",v),()=>{window.removeEventListener("focus",v),document.removeEventListener("visibilitychange",v)}},[t,s,n,N]);const E=De(s,"open"),M=De(s,"closed"),B=o.useMemo(()=>Ot(s),[s,E?.data,M?.data]),V=o.useMemo(()=>new Set(B.map(v=>v.number)),[B]),S=o.useMemo(()=>Bt(B,{state:i.state,involvement:i.involvement,search:i.search,sort:i.sort,viewerLogin:L}),[B,i.state,i.involvement,i.search,i.sort,L]),$=on(S),K=N==="both"?[E,M]:[N==="open"?E:M],_=K.some(v=>v?.data!=null),X=_&&K.every(v=>v?.data?.nextCursor==null),R=K.reduce((v,u)=>v+(u?.data?.items.length??0),0),I=K.find(v=>v?.error)?.error??null,y=K.some(v=>v?.isLoading),de=K.some(v=>v?.stale),Q=i.search.trim(),ee=i.involvement!=="all"&&!L,Z=Q.length>0||i.involvement!=="all",se=o.useMemo(()=>({state:i.state,involvement:i.involvement,q:Q}),[i.state,i.involvement,Q]),ne=`${se.state}|${se.involvement}|${se.q}`,oe=!X&&_&&S.length===0&&(Q.length>0||ee),ae=o.useCallback(v=>n?b(t,s,v,n):Promise.resolve(null),[t,s,n,b]),ue=o.useCallback(v=>n?h(t,s,v,n):Promise.resolve(null),[t,s,n,h]),{remoteView:w,numberJump:G,remotePending:q,handleSearchAll:ie}=Rt({repo:s,query:se,queryKey:ne,autoRemote:oe,indexNumbers:V,visibleItems:S,searchText:Q,useRemoteEntry:Wt,runSearch:ae,runLoadMore:ue}),D=o.useMemo(()=>{if(X||!_||!Z)return null;const v=S.length===1?"1 match":`${S.length} matches`,u=R===1?"1 most recent loaded pull request":`${R} most recent loaded pull requests`;return`Showing ${v} from the ${u}`},[X,_,Z,S.length,R]),U=o.useCallback(()=>{n&&(l(!0),F(t,s,n).then(()=>{l(!1)}).catch(()=>l(!1)))},[t,s,n,F,l]);o.useEffect(()=>(r.current=U,()=>{r.current===U&&(r.current=null)}),[r,U]);const W=o.useCallback(()=>{if(!n)return;c(!0);const v=N==="both"?["open","closed"]:[N];Promise.all(v.map(u=>A(t,s,u,n))).then(()=>c(!1)).catch(()=>c(!1))},[t,s,N,n,A,c]),J=o.useCallback(v=>{T(t,s,v)},[t,s,T]),me=o.useCallback(()=>{T(t,null,null)},[t,T]);return n?f!=null?e.jsx(dn,{directory:t,repo:s,number:f,github:n,onBack:me,hideFilesTab:x,seed:_t(s,f)}):e.jsx(ln,{items:S,headerActionsSlot:p,headerActionsPresentation:k,hasMore:K.some(v=>v?.data?.nextCursor!=null),isLoadingMore:d,isLoading:y,isRefreshing:a&&_,stale:de,error:I,filters:i,checksByUrl:$,countComplete:X,incompleteNotice:D?{summary:D,searching:q,onSearchAll:ie}:null,remote:w,numberJump:G,onFiltersChange:v=>j(t,s,v),onClearFilters:()=>g(t,s),onLoadMore:W,onRetry:U,onOpen:J}):e.jsx(tt,{info:{reason:"failed",message:"GitHub is not available in this runtime."}})},dn=({directory:t,repo:s,number:n,github:a,onBack:l,hideFilesTab:d,seed:c})=>{const r=O(S=>S.ensureDetail),x=O(S=>S.ensureComments),p=O(S=>S.ensureFiles),k=O(S=>S.ensureChecks),m=O(S=>S.loadMoreFiles),b=O(S=>S.loadMoreComments),h=O(S=>S.refreshComments),A=O(S=>S.refreshDetail),F=O(S=>S.refreshChecks);o.useEffect(()=>{r(t,s,n,a).catch(()=>{}),x(t,s,n,a).catch(()=>{}),d||p(t,s,n,a).catch(()=>{}),k(t,s,n,a).catch(()=>{})},[t,s,n,d]);const T=Ut(s,n),j=Vt(s,n),g=Kt(s,n),i=Jt(s,n),C=T?.data?.detail??null,L=o.useCallback((S,$)=>{const K=Ss(t);Ne(async()=>{const{useUIStore:_}=await import("./index-BnZVqcki.js").then(X=>X.cB);return{useUIStore:_}},__vite__mapDeps([1,2,3,4,5,6,7,8])).then(({useUIStore:_})=>{_.getState().openContextFileAtLine(K,S,$)}).catch(()=>{})},[t]),f=o.useCallback(()=>{m(t,s,n,a).catch(()=>{})},[t,s,n,a,m]),N=o.useCallback(()=>{b(t,s,n,a).catch(()=>{})},[t,s,n,a,b]),E=o.useCallback(()=>{h(t,s,n,a).catch(()=>{})},[t,s,n,a,h]),M=o.useCallback(()=>{A(t,s,n,a).catch(()=>{})},[t,s,n,a,A]),B=o.useCallback(()=>{p(t,s,n,a).catch(()=>{})},[t,s,n,a,p]),V=o.useCallback(()=>{F(t,s,n,a).catch(()=>{})},[t,s,n,a,F]);return e.jsx(an,{hideFilesTab:d,seed:c,directory:t,repo:s,number:n,github:a,detail:C,detailError:T?.error??null,detailStale:T?.stale??!1,files:g?.data??null,filesError:g?.error??null,filesLoading:g?.isLoading??!1,filesHasMore:g?.data?.nextCursor!=null,onLoadMoreFiles:f,checks:i?.data??null,checksError:i?.error??null,checksLoading:i?.isLoading??!1,reviews:C?.reviews??[],threads:C?.threads??[],comments:j?.data?.comments??[],commentsError:j?.error??null,commentsLoading:j?.isLoading??!1,commentsHasMore:j?.data?.nextCursor!=null,onLoadMoreComments:N,onRetryComments:E,onBack:l,onRetryDetail:M,onRetryFiles:B,onRetryChecks:V,onOpenFilesAtLine:L})};export{ca as PullRequestsSurface};
@@ -0,0 +1 @@
1
+ import{k as e,bh as N}from"./vendor-boot-Dgb9NVFe.js";import{R as f}from"./vendor-react-DASdDPIk.js";import{h as b,I as x,i as T,j as U,r as R}from"./useAppFontEffects-DviRbaCJ.js";import{u as E}from"./useSwitcherItems-Dej8BzXI.js";import{t as M,o as v}from"./index-BnZVqcki.js";import{g as P,a as G,S as B,f as F}from"./SessionUnreadDot-CmEF9sxM.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CUi8eEds.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./runtimeSurface-DBiUWYK2.js";import"./nativeFileSave-BzhtrDoD.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";function ee({onSelect:t,variant:h,scopeProjectId:d}){const r=E(!0,{scopeProjectId:d}),o=b(s=>s.openNewSessionDraft),a=M(s=>s.setActiveMainTab),i=f.useCallback(()=>{a("chat"),t(),o()},[t,o,a]),[l,m]=f.useState(new Set),c=f.useCallback(s=>{m(p=>{const u=new Set(p);return u.has(s)?u.delete(s):u.add(s),u})},[]);return e.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(N,{onClick:i,className:v("group relative flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover"),children:[e.jsx(x,{name:"chat-new",className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate typography-ui-label font-normal leading-tight text-foreground",children:"New session"})]}),r.length===0?e.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:"No recent sessions"}):r.map(s=>e.jsx(C,{item:s,depth:0,variant:h,expandedParents:l,toggleParent:c,closeDropdown:t},s.node.session.id))]})})}function C({item:t,depth:h,variant:d,expandedParents:r,toggleParent:o,closeDropdown:a}){const{node:i,secondaryMeta:l}=t,m=i.session,c=i.children.length>0,s=r.has(m.id);return e.jsxs(e.Fragment,{children:[e.jsx(H,{session:m,depth:h,variant:d,secondaryMeta:l,hasChildren:c,isExpanded:s,onToggleExpand:c?()=>o(m.id):void 0,closeDropdown:a}),c&&s?i.children.map(p=>e.jsx(C,{item:{node:p,projectId:t.projectId,groupDirectory:t.groupDirectory,secondaryMeta:l},depth:h+1,variant:d,expandedParents:r,toggleParent:o,closeDropdown:a},p.session.id)):null]})}function H({session:t,depth:h,variant:d,secondaryMeta:r,hasChildren:o,isExpanded:a,onToggleExpand:i,closeDropdown:l}){const m=b(n=>n.currentSessionId),c=b(n=>n.setCurrentSession),s=T(t.id),p=U(t.id),u=m===t.id,k=P(t),j=s?.type??"idle",g=j==="busy"||j==="retry",D=!g&&p>0&&!u,I=t.time?.updated||t.time?.created||Date.now(),L=F(I),S=r?.projectLabel?.trim()||null,w=r?.branchLabel?.trim()||null,y=w&&w!=="HEAD"?w:null,A=f.useCallback(()=>{if(u){l();return}const n=R(t);c(t.id,n??null),l()},[l,u,t,c]);return e.jsxs(N,{onClick:n=>{if(n.target?.closest("[data-switcher-expand]")){n.preventDefault();return}A()},"data-slot":"session-switcher-item",className:v("group relative flex w-full cursor-pointer items-start gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover"),style:{paddingLeft:8+h*12},children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[d==="compact"&&o?e.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:n=>{n.preventDefault(),n.stopPropagation(),i?.()},className:"inline-flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center rounded text-muted-foreground/70 hover:text-foreground","aria-label":a?"Collapse subsessions":"Expand subsessions",children:a?e.jsx(x,{name:"arrow-down-s",className:"h-3.5 w-3.5"}):e.jsx(x,{name:"arrow-right-s",className:"h-3.5 w-3.5"})}):null,e.jsx("span",{className:"truncate typography-ui-label font-normal leading-tight text-foreground",children:k})]}),d==="default"?e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 truncate text-muted-foreground/70 leading-tight typography-micro",children:[o?e.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:n=>{n.preventDefault(),n.stopPropagation(),i?.()},className:"inline-flex h-3 w-3 flex-shrink-0 items-center justify-center rounded text-muted-foreground/70 hover:text-foreground","aria-label":a?"Collapse subsessions":"Expand subsessions",children:a?e.jsx(x,{name:"arrow-down-s",className:"h-3 w-3"}):e.jsx(x,{name:"arrow-right-s",className:"h-3 w-3"})}):null,e.jsx("span",{className:"flex-shrink-0",children:g?e.jsx(G,{sessionId:t.id,running:!0}):D?e.jsx(B,{label:"Session complete"}):L}),S?e.jsx("span",{className:"truncate",children:S}):null,y?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[e.jsx(x,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground/70"}),e.jsx("span",{className:"truncate",children:y})]}):null]}):null]}),g?e.jsx("span",{className:"flex h-3 w-3 flex-shrink-0 items-center justify-center self-center",children:e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary animate-busy-pulse","aria-label":"Session active",title:"Session active"})}):null]})}export{ee as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionSwitcherContent-rLoyVqgs.js","assets/vendor-boot-Dgb9NVFe.js","assets/vendor-react-DASdDPIk.js","assets/vendor-clsx-B-dksMZM.js","assets/useAppFontEffects-DviRbaCJ.js","assets/index-BnZVqcki.js","assets/vendor-zustand-CUi8eEds.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/index-BnieExes.css","assets/runtimeSurface-DBiUWYK2.js","assets/nativeFileSave-BzhtrDoD.js","assets/useSwitcherItems-Dej8BzXI.js","assets/SessionUnreadDot-CmEF9sxM.js"])))=>i.map(i=>d[i]);
2
+ import{_ as m}from"./vendor-vite-runtime-DD1OZmLC.js";import{k as o}from"./vendor-boot-Dgb9NVFe.js";import{a as d,R as c}from"./vendor-react-DASdDPIk.js";import{a8 as l,ab as x,ad as u}from"./useAppFontEffects-DviRbaCJ.js";import{t as n,o as f}from"./index-BnZVqcki.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CUi8eEds.js";import"./runtimeSurface-DBiUWYK2.js";import"./nativeFileSave-BzhtrDoD.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";const w=c.lazy(()=>m(()=>import("./SessionSwitcherContent-rLoyVqgs.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])));function R({children:p,variant:t="default",scopeProjectId:a=null,align:i="start"}){const r=n(e=>e.isSessionDropdownOpen),s=n(e=>e.setSessionDropdownOpen);return o.jsxs(l,{open:r,onOpenChange:s,modal:!1,children:[o.jsx(x,{asChild:!0,children:p}),o.jsx(u,{align:i,sideOffset:6,className:f("overflow-hidden p-1 max-w-[calc(100vw-32px)]",t==="compact"?"w-[280px]":"w-[360px]"),children:r?o.jsx(d.Suspense,{fallback:o.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:"Loading…"}),children:o.jsx(w,{onSelect:()=>s(!1),variant:t,scopeProjectId:a})}):null})]})}export{R as SessionSwitcherDropdown};
@@ -1 +1 @@
1
- import{C as m,a7 as D,o as h}from"./index-Dd2OcIUY.js";import{j as g}from"./vendor-boot-DyL2td56.js";import"./vendor-react-DASdDPIk.js";import{cN as M,cO as b,cP as w}from"./useAppFontEffects--lKKtKVo.js";const S="Awaiting first prompt";function z(e,t="Untitled Session"){const r=e?.title?.trim();return r||(e?.messageCount===0?S:t)}const R=(e,t,r)=>{const s=`${r}:`,o=new Set([...t].filter(a=>a.startsWith(s)));return e.size===o.size&&[...o].every(a=>e.has(a))?e:o},T=(e,t)=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r},x=e=>{const t=new Date(e),r=new Date,s=(n,i)=>n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate(),o=new Date(r);return o.setDate(r.getDate()-1),s(t,r)?"Today":s(t,o)?"Yesterday":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}).replace(",","")},k=e=>{const t=new Date,r=new Date(e);if(((o,a)=>o.getFullYear()===a.getFullYear()&&o.getMonth()===a.getMonth()&&o.getDate()===a.getDate())(r,t)){const o=Date.now()-e;return o<6e4?"Just now":o<36e5?`${Math.floor(o/6e4)}min ago`:`${Math.floor(o/36e5)}h ago`}return x(e)},E=e=>{const t=Math.max(0,Date.now()-e),r=6e4,s=60*r,o=24*s,a=7*o,n=30*o,i=365*o;return t<s?`${Math.max(1,Math.floor(t/r))}m`:t<o?`${Math.floor(t/s)}h`:t<a?`${Math.floor(t/o)}d ago`:t<5*a?`${Math.floor(t/a)}w ago`:t<i?`${Math.floor(t/n)}mo`:`${Math.floor(t/i)}y ago`},d=e=>e.toLowerCase().replace(/[-_]/g,"").trim(),U=(e,t)=>e?d(e)!==d(t):!1,B=e=>{const t=new Map;return e.forEach(r=>{t.set(r.id,r)}),Array.from(t.values())},Y=e=>`__archived__:${e}`,j=(e,t)=>{const r=m(e.directory??null),s=m(e.project?.worktree??null),o=r??s;if(!o)return"unassigned";if(t&&o===t)return"project root";const n=(t&&o.startsWith(`${t}/`)?o.slice(t.length+1):o).split("/").filter(Boolean);return n[n.length-1]??"unassigned"},v=e=>e.replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase()),K=(e,t)=>v(e.label?.trim()||D(e.normalizedPath,t)||e.normalizedPath),O="calc(1.25rem * var(--padding-scale, 1))",p="size-4 shrink-0",y="min-w-0 truncate typography-ui-label font-normal",C=p,$=y,N="group relative my-0.5 flex w-full cursor-pointer items-center gap-1.5 rounded-xl px-3 py-2 text-left transition-colors hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",W=N,G=e=>e?C:p,H=e=>e?$:y,u=1e3,c=60*u,l=60*c,L=e=>{const t=Math.max(0,e);return t<c?`${Math.floor(t/u)}s`:t<l?`${Math.floor(t/c)}m ${Math.floor(t%c/u)}s`:`${Math.floor(t/l)}h ${Math.floor(t%l/c)}m`},A=1e3,J=({sessionId:e,running:t,className:r})=>{const s=M(e),o=b(e),a=w(t,A),n=t?Math.max(0,a-(s??a)):o;if(n===void 0)return null;const i=L(n),f=t?`Active for ${i}`:`Last turn took ${i}`;return g.jsx("span",{className:h("shrink-0 tabular-nums",t?"text-primary":"text-[var(--status-info)]",r),"aria-label":f,title:f,children:i})};function X({label:e,className:t}){return g.jsx("span",{className:h("size-1.5 shrink-0 rounded-full bg-foreground",t),"aria-label":e,title:e})}export{X as S,J as a,k as b,Y as c,B as d,y as e,E as f,z as g,G as h,H as i,W as j,N as k,U as l,O as m,v as n,K as o,R as p,j as r,p as s,T as t};
1
+ import{C as m,a7 as D,o as h}from"./index-BnZVqcki.js";import{k as g}from"./vendor-boot-Dgb9NVFe.js";import"./vendor-react-DASdDPIk.js";import{cN as M,cO as b,cP as w}from"./useAppFontEffects-DviRbaCJ.js";const S="Awaiting first prompt";function k(e,t="Untitled Session"){const r=e?.title?.trim();return r||(e?.messageCount===0?S:t)}const z=(e,t,r)=>{const s=`${r}:`,o=new Set([...t].filter(a=>a.startsWith(s)));return e.size===o.size&&[...o].every(a=>e.has(a))?e:o},R=(e,t)=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r},x=e=>{const t=new Date(e),r=new Date,s=(n,i)=>n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate(),o=new Date(r);return o.setDate(r.getDate()-1),s(t,r)?"Today":s(t,o)?"Yesterday":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}).replace(",","")},T=e=>{const t=new Date,r=new Date(e);if(((o,a)=>o.getFullYear()===a.getFullYear()&&o.getMonth()===a.getMonth()&&o.getDate()===a.getDate())(r,t)){const o=Date.now()-e;return o<6e4?"Just now":o<36e5?`${Math.floor(o/6e4)}min ago`:`${Math.floor(o/36e5)}h ago`}return x(e)},E=e=>{const t=Math.max(0,Date.now()-e),r=6e4,s=60*r,o=24*s,a=7*o,n=30*o,i=365*o;return t<s?`${Math.max(1,Math.floor(t/r))}m`:t<o?`${Math.floor(t/s)}h`:t<a?`${Math.floor(t/o)}d ago`:t<5*a?`${Math.floor(t/a)}w ago`:t<i?`${Math.floor(t/n)}mo`:`${Math.floor(t/i)}y ago`},d=e=>e.toLowerCase().replace(/[-_]/g,"").trim(),U=(e,t)=>e?d(e)!==d(t):!1,B=e=>{const t=new Map;return e.forEach(r=>{t.set(r.id,r)}),Array.from(t.values())},Y=e=>`__archived__:${e}`,K=(e,t)=>{const r=m(e.directory??null),s=m(e.project?.worktree??null),o=r??s;if(!o)return"unassigned";if(t&&o===t)return"project root";const n=(t&&o.startsWith(`${t}/`)?o.slice(t.length+1):o).split("/").filter(Boolean);return n[n.length-1]??"unassigned"},v=e=>e.replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase()),O=(e,t)=>v(e.label?.trim()||D(e.normalizedPath,t)||e.normalizedPath),W="calc(1.25rem * var(--padding-scale, 1))",p="size-4 shrink-0",y="min-w-0 truncate typography-ui-label font-normal",C=p,$=y,N="group relative my-0.5 flex w-full cursor-pointer items-center gap-1.5 rounded-xl px-3 py-2 text-left transition-colors hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",j=N,G=e=>e?C:p,H=e=>e?$:y,u=1e3,c=60*u,l=60*c,L=e=>{const t=Math.max(0,e);return t<c?`${Math.floor(t/u)}s`:t<l?`${Math.floor(t/c)}m ${Math.floor(t%c/u)}s`:`${Math.floor(t/l)}h ${Math.floor(t%l/c)}m`},A=1e3,J=({sessionId:e,running:t,className:r})=>{const s=M(e),o=b(e),a=w(t,A),n=t?Math.max(0,a-(s??a)):o;if(n===void 0)return null;const i=L(n),f=t?`Active for ${i}`:`Last turn took ${i}`;return g.jsx("span",{className:h("shrink-0 tabular-nums",t?"text-primary":"text-[var(--status-info)]",r),"aria-label":f,title:f,children:i})};function X({label:e,className:t}){return g.jsx("span",{className:h("size-1.5 shrink-0 rounded-full bg-foreground",t),"aria-label":e,title:e})}export{X as S,J as a,T as b,Y as c,B as d,y as e,E as f,k as g,G as h,H as i,j,N as k,U as l,W as m,v as n,O as o,z as p,K as r,p as s,R as t};