@p4code/cli 0.8.34 → 0.8.35

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 (308) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-CvWinVsO.mjs → binCli-26z5sNBT.mjs} +2242 -1476
  3. package/dist/client/.vite/manifest.json +2038 -2023
  4. package/dist/client/assets/{2NI2N5EU-Dlr3FZf7.js → 2NI2N5EU-BLnY4aCF.js} +2 -2
  5. package/dist/client/assets/{4UO7MD6I-Cy2sjs8O.js → 4UO7MD6I-BApNVkfU.js} +2 -2
  6. package/dist/client/assets/{5B3SVYGG-DaCwFaTp.js → 5B3SVYGG-Y7V7NdZO.js} +2 -2
  7. package/dist/client/assets/{5GK6JWQ2-BVM9871F.js → 5GK6JWQ2-BSIhKcw-.js} +2 -2
  8. package/dist/client/assets/{5N7A7DKN-BVMU2dmG.js → 5N7A7DKN-CNUCnWLs.js} +2 -2
  9. package/dist/client/assets/{5OC2THR4-2tkjJ38q.js → 5OC2THR4-Bne-pf_A.js} +2 -2
  10. package/dist/client/assets/{5S6HY5KT-BGTQzE2T.js → 5S6HY5KT-7d4UMONz.js} +2 -2
  11. package/dist/client/assets/{6IMQ5BUJ-DMdx9ktL.js → 6IMQ5BUJ-BWW19n-D.js} +2 -2
  12. package/dist/client/assets/{6OLKWJ4F-B0TXT19U.js → 6OLKWJ4F-CxTUuvA6.js} +2 -2
  13. package/dist/client/assets/{74OO7NKP-Cukz2OUS.js → 74OO7NKP-DByVTRKE.js} +2 -2
  14. package/dist/client/assets/{75O6YZUN-D3k2sZNm.js → 75O6YZUN-CZanyedf.js} +2 -2
  15. package/dist/client/assets/{77XECAW3-CjIq7P_x.js → 77XECAW3-TL2w7pHK.js} +2 -2
  16. package/dist/client/assets/{ABYRPUBD-hf0OeD7n.js → ABYRPUBD-CJboH7Uz.js} +2 -2
  17. package/dist/client/assets/AlertDialogRoot-9jRALQXL.js +2 -0
  18. package/dist/client/assets/{AnimatedHeight-CHpFDL1r.js → AnimatedHeight-OxEbW01v.js} +2 -2
  19. package/dist/client/assets/{AuthSurfaceShell-whDvSlDA.js → AuthSurfaceShell-KQXgPV4i.js} +2 -2
  20. package/dist/client/assets/{BB2UYUI2-RUQPN7sp.js → BB2UYUI2-BxW-R2h1.js} +2 -2
  21. package/dist/client/assets/{BUM34MOA-f5Ez9vSp.js → BUM34MOA-ngG-irUy.js} +2 -2
  22. package/dist/client/assets/{CEQABKGZ-C2ZheKpY.js → CEQABKGZ-C-u-W0bS.js} +2 -2
  23. package/dist/client/assets/{CXAC5362-B0KvwGJk.js → CXAC5362-DfFRkI7L.js} +2 -2
  24. package/dist/client/assets/ChatGptUsageButton-C3KgGt4z.js +2 -0
  25. package/dist/client/assets/{ChatMarkdown-C2KOLN1s.js → ChatMarkdown-9gWM0ED9.js} +9 -9
  26. package/dist/client/assets/{CheckboxIndicator-zwVHomgm.js → CheckboxIndicator-DbU3csPQ.js} +2 -2
  27. package/dist/client/assets/{ClippedText-Cx9jjhQp.js → ClippedText-CS_BYNco.js} +2 -2
  28. package/dist/client/assets/{CodexSetupSection.logic-150217tr.js → CodexSetupSection.logic-CNbTXxKb.js} +2 -2
  29. package/dist/client/assets/{ComboboxClear-tzFhNwrk.js → ComboboxClear-Bn_kslrf.js} +2 -2
  30. package/dist/client/assets/{ComboboxGroupLabel-C1Icd2UF.js → ComboboxGroupLabel-fL8lMA25.js} +2 -2
  31. package/dist/client/assets/{CommandBlock-D9QqOlDX.js → CommandBlock-DcQXu_lq.js} +2 -2
  32. package/dist/client/assets/ComposerPromptEditor-DQ9wFfKn.js +204 -0
  33. package/dist/client/assets/{CompositeRoot-BD0GlRg8.js → CompositeRoot-BuwzXGHT.js} +2 -2
  34. package/dist/client/assets/{ConnectionDiagnosisDetails-BQ3BFqRL.js → ConnectionDiagnosisDetails-DGbJY7Hw.js} +2 -2
  35. package/dist/client/assets/{ConnectionStatusDot-DLQm_zZ7.js → ConnectionStatusDot-CixsTBXI.js} +2 -2
  36. package/dist/client/assets/{DRLTVNUE-vgHnaBR1.js → DRLTVNUE-Cbb71R0Y.js} +2 -2
  37. package/dist/client/assets/{DYY6UVD2-BQAAF_8A.js → DYY6UVD2-BZn5fuF5.js} +2 -2
  38. package/dist/client/assets/{DevicePanel-Yd3YuPQd.js → DevicePanel-JP__PY1s.js} +2 -2
  39. package/dist/client/assets/{DeviceSetup-DW4g9NNK.js → DeviceSetup-D8qb_qBj.js} +2 -2
  40. package/dist/client/assets/{DialogTitle-DCMYEIWZ.js → DialogTitle-B_9LEmy3.js} +2 -2
  41. package/dist/client/assets/{DiffCommentAnnotation-BLItJ7Ia.js → DiffCommentAnnotation-WMKzOwCh.js} +2 -2
  42. package/dist/client/assets/{DiffFileTree-B1-D1WV6.js → DiffFileTree-BSbsOOmA.js} +2 -2
  43. package/dist/client/assets/DiffPanel-BWFuiHvv.js +2 -0
  44. package/dist/client/assets/{DiffWorkerPoolProvider-BzkGX7xm.js → DiffWorkerPoolProvider-BBk0lIX3.js} +2 -2
  45. package/dist/client/assets/EmbeddedDesign-B4RMmwTG.css +1 -0
  46. package/dist/client/assets/EmbeddedDesign-D5YUndkh.js +21 -0
  47. package/dist/client/assets/{EnvironmentMachineIcon-5-erc8l_.js → EnvironmentMachineIcon-Dpgx67FY.js} +2 -2
  48. package/dist/client/assets/{ExpandableText-D2jzDgm7.js → ExpandableText-Cpm1gOKG.js} +2 -2
  49. package/dist/client/assets/{FNOVOB4O-CE98DPML.js → FNOVOB4O-BkEIrB0k.js} +2 -2
  50. package/dist/client/assets/{FieldControl-CBMzQqd5.js → FieldControl-BHe6unoZ.js} +2 -2
  51. package/dist/client/assets/{FileDiff-2qSm00aV.js → FileDiff-C1vAOUga.js} +2 -2
  52. package/dist/client/assets/{FilePreviewPanel-Drpn6NuE.js → FilePreviewPanel-CbpNevZP.js} +4 -4
  53. package/dist/client/assets/{FoldedSettingsSection-Db7e_9rd.js → FoldedSettingsSection-DySTg20x.js} +2 -2
  54. package/dist/client/assets/{FormContext-BGRz6hhb.js → FormContext-CmvUzTS-.js} +2 -2
  55. package/dist/client/assets/{HDGCDEEZ-C0-Zci_l.js → HDGCDEEZ-CN-ckGDk.js} +2 -2
  56. package/dist/client/assets/{HSJLKHB7-4e5L-KC4.js → HSJLKHB7-B0BvmnZE.js} +2 -2
  57. package/dist/client/assets/{Icons-DwLGuyWf.js → Icons-B4l3TqYa.js} +2 -2
  58. package/dist/client/assets/Input-Cv-TKh6s.js +2 -0
  59. package/dist/client/assets/JZOYTAAL-CB_B_Rei.js +1 -0
  60. package/dist/client/assets/{K3MD6TGW-Gi4s7ooz.js → K3MD6TGW-IS0rWO1U.js} +2 -2
  61. package/dist/client/assets/{K7RP3OMA-BVc6P2bZ.js → K7RP3OMA-DcqjCOJO.js} +2 -2
  62. package/dist/client/assets/{KeybindingsSettings.logic-CU23l8mP.js → KeybindingsSettings.logic-mF9mJWrc.js} +2 -2
  63. package/dist/client/assets/{LHDIQX7Q-DbBCFdJr.js → LHDIQX7Q-CLMgIt4Y.js} +2 -2
  64. package/dist/client/assets/{LUXOKEGN-C4n0-A1h.js → LUXOKEGN-B1dkmN_M.js} +2 -2
  65. package/dist/client/assets/{MathTypeset--azkeKic.js → MathTypeset-qeRVy_bc.js} +2 -2
  66. package/dist/client/assets/{N3JZAHOW-2wC96xvZ.js → N3JZAHOW-C6sq5aqx.js} +2 -2
  67. package/dist/client/assets/{NUIALGQ3-Di1L_kRJ.js → NUIALGQ3-BG7xJ_qe.js} +2 -2
  68. package/dist/client/assets/{NoProjectsHero-CC3oMKUV.js → NoProjectsHero-B0KzU91d.js} +2 -2
  69. package/dist/client/assets/{O65XPQGZ-BeKB0m-p.js → O65XPQGZ-BEfVfDlS.js} +2 -2
  70. package/dist/client/assets/{O7XIQ6OM-1wrcdCMc.js → O7XIQ6OM-BUiRjV87.js} +2 -2
  71. package/dist/client/assets/{OFQON5FD-CsMmmhLT.js → OFQON5FD-DTgVPbd-.js} +2 -2
  72. package/dist/client/assets/{P4ConnectAccountPages-BDxb29bY.js → P4ConnectAccountPages-C4KYM5XU.js} +2 -2
  73. package/dist/client/assets/{P4ConnectSidebarSignIn-Dp5OsZBa.js → P4ConnectSidebarSignIn-DNPUNJl_.js} +2 -2
  74. package/dist/client/assets/{PJQHF43J-CY_GpbqJ.js → PJQHF43J-QRnhQpHu.js} +2 -2
  75. package/dist/client/assets/PanelLayoutControls-4VFKEoHg.js +216 -0
  76. package/dist/client/assets/{PierreEntryIcon-B5tjtDkE.js → PierreEntryIcon-DeI-j_7w.js} +2 -2
  77. package/dist/client/assets/{PopoverHandle-CZh3pqXt.js → PopoverHandle-DMB4QSp6.js} +2 -2
  78. package/dist/client/assets/PreviewPanel-CO66mekh.js +2 -0
  79. package/dist/client/assets/ProjectDefaultsSettings-BF-iyQ8T.js +2 -0
  80. package/dist/client/assets/{ProjectFavicon-CkSteHLT.js → ProjectFavicon-_6hkSNzm.js} +3 -3
  81. package/dist/client/assets/{ProjectIconPickerDialog-9heAZbVC.js → ProjectIconPickerDialog-DeL1rZxy.js} +2 -2
  82. package/dist/client/assets/{ProjectMonogram-DIqp1OmB.js → ProjectMonogram-Cn4l-YGU.js} +2 -2
  83. package/dist/client/assets/{ProviderAuthTerminal-BSsraub7.js → ProviderAuthTerminal-qGeMxZDy.js} +2 -2
  84. package/dist/client/assets/ProviderModelPicker-DJQYH_Pp.js +2 -0
  85. package/dist/client/assets/{ProviderSettingsForm-CAFBbrfr.js → ProviderSettingsForm-BSVuPnR0.js} +2 -2
  86. package/dist/client/assets/PullRequestCodeTab-0OaJE6XS.js +6 -0
  87. package/dist/client/assets/{RHNBAITX-BdiF8iR_.js → RHNBAITX-ChqB7inB.js} +2 -2
  88. package/dist/client/assets/{ReadOnlySourcePreview-BXDLfPcr.js → ReadOnlySourcePreview-B08Wms4m.js} +2 -2
  89. package/dist/client/assets/{RenderErrorBoundary-CR2cHAQ5.js → RenderErrorBoundary-BsOuLEci.js} +3 -3
  90. package/dist/client/assets/{SLD4V6NK-Bo1z-c9S.js → SLD4V6NK-IkYRGtTH.js} +2 -2
  91. package/dist/client/assets/ScheduledTasksSettings-1UDkELZo.js +4 -0
  92. package/dist/client/assets/{ScopedSwitch-CX4FTGjy.js → ScopedSwitch-Bhp6-hCj.js} +2 -2
  93. package/dist/client/assets/{ScrollAreaCorner-BCdJHqsj.js → ScrollAreaCorner-BPMuWLbs.js} +2 -2
  94. package/dist/client/assets/{SecretInput-BPPzPNI1.js → SecretInput-RlOzrLKL.js} +2 -2
  95. package/dist/client/assets/{SelectScrollUpArrow-CR3Z6_pf.js → SelectScrollUpArrow-6kh66YCd.js} +2 -2
  96. package/dist/client/assets/{SettingsPanels-DoJnxtp0.js → SettingsPanels-BfBUSBAG.js} +6 -6
  97. package/dist/client/assets/{SettingsPanels.logic-t7cG-B6z.js → SettingsPanels.logic-BsFZYDgm.js} +2 -2
  98. package/dist/client/assets/{SettingsScopeNotice-DD4QFo3v.js → SettingsScopeNotice-H7UzC9bb.js} +2 -2
  99. package/dist/client/assets/{T3PCR2KE-Cg6A465M.js → T3PCR2KE-BxaunvVy.js} +2 -2
  100. package/dist/client/assets/{TKWO2OVW-CWeCEb5C.js → TKWO2OVW-DFURsfqA.js} +2 -2
  101. package/dist/client/assets/{TSHNXIZL-DTjzxHgA.js → TSHNXIZL-CIukdyLy.js} +2 -2
  102. package/dist/client/assets/{ThemeEditorPanel-BwydY72w.js → ThemeEditorPanel-otrA-nTg.js} +3 -3
  103. package/dist/client/assets/{ThreadTerminalDrawer-QTFG89J_.js → ThreadTerminalDrawer-BQKZCFAC.js} +4 -4
  104. package/dist/client/assets/TooltipViewport-ZmVCer7P.js +2 -0
  105. package/dist/client/assets/{UQJE5E4I-DS4MjKhw.js → UQJE5E4I-CfqCotH2.js} +2 -2
  106. package/dist/client/assets/{USNYFO5S-Be1OZGok.js → USNYFO5S-CctAAheU.js} +2 -2
  107. package/dist/client/assets/{Virtualizer-BpizRoFL.js → Virtualizer-CImHNxBq.js} +2 -2
  108. package/dist/client/assets/{WEVWDWVA-oFS2VG1Y.js → WEVWDWVA-DS9YO9IT.js} +2 -2
  109. package/dist/client/assets/{WorkspaceBreadcrumb-ckARUoj9.js → WorkspaceBreadcrumb-BW_omYU1.js} +2 -2
  110. package/dist/client/assets/{WorkspacePageContainer-D5yW7_av.js → WorkspacePageContainer-BS8FWt_4.js} +2 -2
  111. package/dist/client/assets/{WorkspacePageHeader-CTWcEH7d.js → WorkspacePageHeader-CE_94tTR.js} +2 -2
  112. package/dist/client/assets/{X5RFHQXM-Bjw0rDxX.js → X5RFHQXM-B0KbwoE1.js} +2 -2
  113. package/dist/client/assets/{X62E3GBT-BPHYY59t.js → X62E3GBT-wpz8X9Yh.js} +2 -2
  114. package/dist/client/assets/{XBNEOJTC-W72qCYdc.js → XBNEOJTC-DFRK5c6Y.js} +2 -2
  115. package/dist/client/assets/{YHV2MVVZ-DA_drdwk.js → YHV2MVVZ-1NnqTTZ2.js} +2 -2
  116. package/dist/client/assets/{YURCZMG2-CsfrwNLG.js → YURCZMG2-rnzWY5ij.js} +2 -2
  117. package/dist/client/assets/{YVG2LODB-dXCBipzg.js → YVG2LODB-Dxuuk2M-.js} +2 -2
  118. package/dist/client/assets/_chat-1QGQLbCc.js +45 -0
  119. package/dist/client/assets/{_chat.design-KVMajkdX.js → _chat.design-z2pu_9A5.js} +2 -2
  120. package/dist/client/assets/{_chat.index-BknTP6QZ.js → _chat.index-D8X9o5jY.js} +2 -2
  121. package/dist/client/assets/{_chat.new-DLFV1XOJ.js → _chat.new-CGJw8cpo.js} +3 -3
  122. package/dist/client/assets/_chat.pull-requests-BfW9qMU1.js +2 -0
  123. package/dist/client/assets/{alert-Dh8AVuLe.js → alert-DO06etEs.js} +2 -2
  124. package/dist/client/assets/{assetUrls-C6W2_00u.js → assetUrls-CmOUMX2M.js} +2 -2
  125. package/dist/client/assets/assets-aBpLf8r4.js +2 -0
  126. package/dist/client/assets/{browserHistoryStore-CeBJcpoN.js → browserHistoryStore-tYgeZygn.js} +2 -2
  127. package/dist/client/assets/{browserLinkTarget-D5ew8rLG.js → browserLinkTarget-CQFfJKWJ.js} +2 -2
  128. package/dist/client/assets/{checkbox-Y4v7A1IZ.js → checkbox-BEQFb7GO.js} +2 -2
  129. package/dist/client/assets/{color-picker-DEWeNc5K.js → color-picker-CXfnfmuH.js} +2 -2
  130. package/dist/client/assets/{combobox-DGrx2JGy.js → combobox--XoXA5uu.js} +2 -2
  131. package/dist/client/assets/{command-DR1GjC1a.js → command-E2aLhsct.js} +2 -2
  132. package/dist/client/assets/composer-logic-BPTz1APL.js +6 -0
  133. package/dist/client/assets/{composerDraftUploads-DK6jH0cB.js → composerDraftUploads-b_0oxKs9.js} +2 -2
  134. package/dist/client/assets/{connect-B1NcR-kN.js → connect-CU9dNvTt.js} +2 -2
  135. package/dist/client/assets/{connect-agent-BNrm24qs.js → connect-agent-Byc9PCdW.js} +2 -2
  136. package/dist/client/assets/{design-CbG6XJYX.js → design-CoGbXd61.js} +2 -2
  137. package/dist/client/assets/{device-6R-yC55P.js → device-DmH6IHQ4.js} +2 -2
  138. package/dist/client/assets/{dialog-BwjzOzO6.js → dialog-CBBxT1gk.js} +2 -2
  139. package/dist/client/assets/{diffRendering-CG_sb5me.js → diffRendering-BOVFJuWd.js} +2 -2
  140. package/dist/client/assets/{dist-CFar2AY1.js → dist-B2P3f-0Q.js} +3 -3
  141. package/dist/client/assets/{draft-input-CpqOZR5i.js → draft-input-CSOOVntS.js} +2 -2
  142. package/dist/client/assets/{duoViewer-BhE8QUaC.js → duoViewer-BhHYrurM.js} +2 -2
  143. package/dist/client/assets/{dynamic-CIBySV57.js → dynamic-BhzrutAo.js} +2 -2
  144. package/dist/client/assets/{embeddedScripts-B0vXhhvs.js → embeddedScripts-43_R83vp.js} +2 -2
  145. package/dist/client/assets/{empty-C0oiFHy_.js → empty-FOL5U4KY.js} +2 -2
  146. package/dist/client/assets/entities-Bqo0n1Pb.js +2 -0
  147. package/dist/client/assets/{fileLinks-CP5NWXaI.js → fileLinks-D4GSqJYj.js} +2 -2
  148. package/dist/client/assets/{fileTreeExpansion-BKVd4HrC.js → fileTreeExpansion-BBT5F8P1.js} +2 -2
  149. package/dist/client/assets/{getDiffFileInput-CIK5OMl_.js → getDiffFileInput-CGw09SPI.js} +2 -2
  150. package/dist/client/assets/{guideRunStore-CegZr43-.js → guideRunStore-DvIkVECt.js} +2 -2
  151. package/dist/client/assets/{htmlRender-NqJI2UJ2.js → htmlRender-CmEeFzCo.js} +2 -2
  152. package/dist/client/assets/{index-Czsz7nXH.js → index-B1djVqM4.js} +3 -3
  153. package/dist/client/assets/{input-BCWES8Y7.js → input-ekYqAkUx.js} +2 -2
  154. package/dist/client/assets/{input-group-CfPOCEuC.js → input-group-C3pxk97H.js} +2 -2
  155. package/dist/client/assets/{kbd-EDrgCOls.js → kbd-3FPzNikV.js} +2 -2
  156. package/dist/client/assets/{keybindings-BG7j7M7S.js → keybindings-B3oDRRkK.js} +2 -2
  157. package/dist/client/assets/{lazy-D6W01WxZ.js → lazy-DyNR0b0B.js} +4 -4
  158. package/dist/client/assets/{lazyRouteComponent-B8CSLurY.js → lazyRouteComponent-BPxq_G_s.js} +2 -2
  159. package/dist/client/assets/{link-COzhJ6br.js → link-B3B5a5Ju.js} +2 -2
  160. package/dist/client/assets/{linkedPrompt-X4NBlFef.js → linkedPrompt-BsCPMHxQ.js} +2 -2
  161. package/dist/client/assets/main-BWh6jqG2.js +29 -0
  162. package/dist/client/assets/main-DdVSHl80.css +2 -0
  163. package/dist/client/assets/{mediaReference-CKap6oNP.js → mediaReference-Bb8H-qbI.js} +2 -2
  164. package/dist/client/assets/{mediaSource-DG5l5-5f.js → mediaSource-C2MsZgy8.js} +2 -2
  165. package/dist/client/assets/number-field-SoHEiP55.js +2 -0
  166. package/dist/client/assets/{observeResize-BUAH1dvA.js → observeResize-3Vj9DYOV.js} +2 -2
  167. package/dist/client/assets/{onboarding-CnVH7A6c.js → onboarding-CPgiVEVK.js} +2 -2
  168. package/dist/client/assets/{openFileInPreview-B0i3eZpu.js → openFileInPreview-BBWCOLh_.js} +2 -2
  169. package/dist/client/assets/{p4ProjectFile-0RRo3hX4.js → p4ProjectFile-qmvlbzKv.js} +2 -2
  170. package/dist/client/assets/{pair-B4KNAPh5.js → pair-CZnRGdd8.js} +2 -2
  171. package/dist/client/assets/{pendingSendStore-Dzn7x7Cg.js → pendingSendStore-L5KquCDf.js} +2 -2
  172. package/dist/client/assets/{phoneViewer-RhpfiwR2.js → phoneViewer-D-8v-sMf.js} +2 -2
  173. package/dist/client/assets/{pierre-icons-Cisj4-__.js → pierre-icons-jwqMPUxD.js} +2 -2
  174. package/dist/client/assets/{popover-BnqKHl4L.js → popover-OfG3wVsl.js} +2 -2
  175. package/dist/client/assets/{preview-CiojYkh4.js → preview-BYnEURcB.js} +2 -2
  176. package/dist/client/assets/{preview-Dwq2O7nm.js → preview-DGdQ5Ycc.js} +2 -2
  177. package/dist/client/assets/{previewMiniPlayerStore-ByZNhmNc.js → previewMiniPlayerStore-Dlbj5KrZ.js} +2 -2
  178. package/dist/client/assets/primary-B47ivN3o.js +2 -0
  179. package/dist/client/assets/primaryCloudLinkState-CreqR0gU.js +2 -0
  180. package/dist/client/assets/projectFilesQueryState-CanWrACx.js +2 -0
  181. package/dist/client/assets/{projectScriptEditor-B4iSq27p.js → projectScriptEditor-gWuw6vwd.js} +2 -2
  182. package/dist/client/assets/{providerSkills-C4Fu_qyq.js → providerSkills-C_Rxqah9.js} +2 -2
  183. package/dist/client/assets/{pullRequestDetail.logic-BmYDDw_8.js → pullRequestDetail.logic-RASi2EgP.js} +4 -4
  184. package/dist/client/assets/{pullRequestIcons-DFcQ9rtl.js → pullRequestIcons-ucGaXXG7.js} +2 -2
  185. package/dist/client/assets/{pullRequestReviewStore-BGzKslrq.js → pullRequestReviewStore-CEr41DEl.js} +2 -2
  186. package/dist/client/assets/pullRequests-Bw3Ui6hK.js +2 -0
  187. package/dist/client/assets/queries-EslKFJTV.js +2 -0
  188. package/dist/client/assets/query-d1pQlqP0.js +2 -0
  189. package/dist/client/assets/{radio-group-DOHTpBxX.js → radio-group-Ciy_K5uE.js} +2 -2
  190. package/dist/client/assets/{renderScheduler-Df4T8RWh.js → renderScheduler-CP-JkmKx.js} +2 -2
  191. package/dist/client/assets/rightPanelStore-D3KOmuPa.js +2 -0
  192. package/dist/client/assets/runtime-DR7JxgbQ.js +6 -0
  193. package/dist/client/assets/runtime-d6B1vJeH.js +3 -0
  194. package/dist/client/assets/runtimeModeConfig-Rxeb1uGg.js +2 -0
  195. package/dist/client/assets/{scheduledTasksSettings.logic-7E0KSnA7.js → scheduledTasksSettings.logic-CVIC4Kpr.js} +3 -3
  196. package/dist/client/assets/{scroll-area-B9LorBFb.js → scroll-area-yyfi3ycu.js} +2 -2
  197. package/dist/client/assets/{select-Ctq0UILH.js → select-DaYjjw1q.js} +2 -2
  198. package/dist/client/assets/selfImproveFindings-1XIHD-7i.js +2 -0
  199. package/dist/client/assets/server-sXApTCjZ.js +2 -0
  200. package/dist/client/assets/{session-C7ckxjAM.js → session-C949OsEI.js} +2 -2
  201. package/dist/client/assets/session-logic-DkSfwnHl.js +26 -0
  202. package/dist/client/assets/{settings-BqhxEPKC.js → settings-B0O54Q3P.js} +2 -2
  203. package/dist/client/assets/{settings.appearance-DljtCz6-.js → settings.appearance-BesXhA1a.js} +2 -2
  204. package/dist/client/assets/settings.archived-FtcZf_Ug.js +2 -0
  205. package/dist/client/assets/settings.computer-use-BeKmLbNe.js +2 -0
  206. package/dist/client/assets/settings.connections-D1UxckE0.js +2 -0
  207. package/dist/client/assets/{settings.data-controls-Cdccmn63.js → settings.data-controls-lPiIwMgc.js} +2 -2
  208. package/dist/client/assets/settings.decisions-D97jIUyr.js +2 -0
  209. package/dist/client/assets/{settings.designs-TeCw-uLf.js → settings.designs-B473PRvt.js} +2 -2
  210. package/dist/client/assets/settings.diagnostics-DDOaOIDg.js +2 -0
  211. package/dist/client/assets/{settings.general-uxwywmhh.js → settings.general-qzEOE2zF.js} +2 -2
  212. package/dist/client/assets/settings.integrations-D6ctQ9WI.js +2 -0
  213. package/dist/client/assets/{settings.keybindings-C0FBNk1_.js → settings.keybindings-BL57H4sD.js} +2 -2
  214. package/dist/client/assets/{settings.open-source-licenses-wMwaYCss.js → settings.open-source-licenses-DaS82UhN.js} +2 -2
  215. package/dist/client/assets/{settings.plugins-CFiDE3ms.js → settings.plugins-DnS3RrT2.js} +4 -4
  216. package/dist/client/assets/{settings.projects-DN0n2td7.js → settings.projects-D-ZICXey.js} +4 -4
  217. package/dist/client/assets/settings.providers-CFpCmv0o.js +3 -0
  218. package/dist/client/assets/{settings.scheduled-tasks-uCL4Wgvt.js → settings.scheduled-tasks-IEAC3STn.js} +2 -2
  219. package/dist/client/assets/{settings.snap-shot-C4OHP0nR.js → settings.snap-shot-BaOFk9WR.js} +2 -2
  220. package/dist/client/assets/{settings.source-control-pMBspYC4.js → settings.source-control-BW16AA5z.js} +2 -2
  221. package/dist/client/assets/{settings.storage-QCydiEyw.js → settings.storage-D4vBYBRP.js} +2 -2
  222. package/dist/client/assets/settingsLayout-CFQx1XDM.js +3 -0
  223. package/dist/client/assets/{sidebar-CRr8B41y.js → sidebar-C1E4GqL6.js} +2 -2
  224. package/dist/client/assets/{sidebarProjectGrouping-miDXfjI3.js → sidebarProjectGrouping-9cUrCOXH.js} +2 -2
  225. package/dist/client/assets/{skeleton-C9J-Xl06.js → skeleton-BCpBrYxh.js} +2 -2
  226. package/dist/client/assets/{sourceControl-C8nJMDiL.js → sourceControl-DwJWPP0h.js} +2 -2
  227. package/dist/client/assets/{sourceControlClients-DKONtKbZ.js → sourceControlClients-BBJW7ra4.js} +2 -2
  228. package/dist/client/assets/{spinner-CNva85zM.js → spinner-CSTrcxhP.js} +2 -2
  229. package/dist/client/assets/{terminal-links-BJzLp7ix.js → terminal-links-D18LpQ1T.js} +2 -2
  230. package/dist/client/assets/{terminalSessions-BPc8sBGR.js → terminalSessions-C2NUFncF.js} +2 -2
  231. package/dist/client/assets/{textarea-DjRGRzMg.js → textarea-R4UQ47Ns.js} +2 -2
  232. package/dist/client/assets/{themePalette-fhKYLCuU.js → themePalette-neUNWCzK.js} +3 -3
  233. package/dist/client/assets/toast-B84QdqqM.js +2 -0
  234. package/dist/client/assets/{toggle-Bbnow7xY.js → toggle-BH5BGBcD.js} +2 -2
  235. package/dist/client/assets/{toggle-group-Cilo8czD.js → toggle-group-Di3SFV73.js} +2 -2
  236. package/dist/client/assets/{tooltip-T5ePvxsH.js → tooltip-D-GRl-oZ.js} +2 -2
  237. package/dist/client/assets/{uiStateStore-D9r3BNZ-.js → uiStateStore-xSkh4_PU.js} +2 -2
  238. package/dist/client/assets/{usage-QBPLx2wr.js → usage-DUdXloVo.js} +2 -2
  239. package/dist/client/assets/{usageAccess-DUfVA8nU.js → usageAccess-DSLF-sRE.js} +2 -2
  240. package/dist/client/assets/{usageFormat-C-mTuUS7.js → usageFormat-Bzyvr9m4.js} +2 -2
  241. package/dist/client/assets/{usageShortcuts-CB6TvooP.js → usageShortcuts-D6nQeRtx.js} +2 -2
  242. package/dist/client/assets/{use-atom-command-BNkv9iyk.js → use-atom-command-DA6OG-Qk.js} +2 -2
  243. package/dist/client/assets/{useAriaLabelledBy-D5HM2KLM.js → useAriaLabelledBy-PLuOxvFb.js} +2 -2
  244. package/dist/client/assets/{useHandleNewThread-DntRaFvm.js → useHandleNewThread-Dm0SCq59.js} +2 -2
  245. package/dist/client/assets/{useLocation-DbWity7H.js → useLocation-Bqc94klS.js} +2 -2
  246. package/dist/client/assets/{useNavigate-Cxh24teV.js → useNavigate-DdjG4MB_.js} +2 -2
  247. package/dist/client/assets/{useNavigateBack-B5mTfIHJ.js → useNavigateBack-sP0LsL3p.js} +2 -2
  248. package/dist/client/assets/{useP4ConnectAuthPrompt-sjWWPvrn.js → useP4ConnectAuthPrompt-C9d7n33S.js} +2 -2
  249. package/dist/client/assets/{useParams-D9PdK0IA.js → useParams-DZQvRQLJ.js} +2 -2
  250. package/dist/client/assets/{usePermissionStatus-D6i3IaCj.js → usePermissionStatus-BzfAUU9X.js} +2 -2
  251. package/dist/client/assets/{usePullRequestActions-9274Vp3W.js → usePullRequestActions-DIjGLg1E.js} +3 -3
  252. package/dist/client/assets/{useRegisterFieldControl-DZyLTxKX.js → useRegisterFieldControl-CyBVe0G0.js} +2 -2
  253. package/dist/client/assets/{useScopedModelAvailability-CmlQi7Iz.js → useScopedModelAvailability-D4n22Nmm.js} +2 -2
  254. package/dist/client/assets/useSettings-CaJMqrvF.js +3 -0
  255. package/dist/client/assets/utils-BoMYW9A3.js +37 -0
  256. package/dist/client/assets/vcsRefInvalidation-w_CQ3i43.js +2 -0
  257. package/dist/client/assets/{welcome-DVusCS_L.js → welcome-BIKH3rbU.js} +2 -2
  258. package/dist/client/index.html +1 -1
  259. package/dist/{renderer-CJXpJ36b.mjs → renderer-CveKT929.mjs} +26 -3
  260. package/dist/{runtime-EqYv-lrV.mjs → runtime-DGGSjC6Q.mjs} +148 -4
  261. package/package.json +1 -1
  262. package/dist/client/assets/AlertDialogRoot-BUODcEy9.js +0 -2
  263. package/dist/client/assets/ChatGptUsageButton-CMIjZ66V.js +0 -2
  264. package/dist/client/assets/ComposerPromptEditor-D2ObH3Py.js +0 -204
  265. package/dist/client/assets/DiffPanel-BGnRzWM8.js +0 -2
  266. package/dist/client/assets/EmbeddedDesign-BV_FcJ4l.js +0 -21
  267. package/dist/client/assets/EmbeddedDesign-Cud7UEy4.css +0 -1
  268. package/dist/client/assets/Input-DLaKk0qb.js +0 -2
  269. package/dist/client/assets/JZOYTAAL-SLYGD65P.js +0 -1
  270. package/dist/client/assets/PanelLayoutControls-CqeL3uQz.js +0 -216
  271. package/dist/client/assets/PreviewPanel-CvBQAq3I.js +0 -2
  272. package/dist/client/assets/ProjectDefaultsSettings-DLJfUN7i.js +0 -2
  273. package/dist/client/assets/ProviderModelPicker-AkULlCAn.js +0 -2
  274. package/dist/client/assets/PullRequestCodeTab-BamXVeZz.js +0 -6
  275. package/dist/client/assets/ScheduledTasksSettings-DF_KhqLx.js +0 -4
  276. package/dist/client/assets/TooltipViewport-C14m3uB7.js +0 -2
  277. package/dist/client/assets/_chat-BIqme2Hz.js +0 -46
  278. package/dist/client/assets/_chat.pull-requests-BDLRkW2A.js +0 -2
  279. package/dist/client/assets/assets-D-xsxvzf.js +0 -2
  280. package/dist/client/assets/composer-logic-BW4G8aDL.js +0 -6
  281. package/dist/client/assets/entities-Om5Klild.js +0 -2
  282. package/dist/client/assets/main-BGaSDXjP.js +0 -29
  283. package/dist/client/assets/main-BP1f3auf.css +0 -2
  284. package/dist/client/assets/number-field-DGdBjQD2.js +0 -2
  285. package/dist/client/assets/primary-CMwTDEi1.js +0 -2
  286. package/dist/client/assets/primaryCloudLinkState-2j4MjqVh.js +0 -2
  287. package/dist/client/assets/projectFilesQueryState-DXrTSOqg.js +0 -2
  288. package/dist/client/assets/pullRequests-DT0oG7tF.js +0 -2
  289. package/dist/client/assets/queries-CXgT6mki.js +0 -2
  290. package/dist/client/assets/query-DlK0I8Jc.js +0 -2
  291. package/dist/client/assets/rightPanelStore-DXw7-xK3.js +0 -2
  292. package/dist/client/assets/runtime-BL7IF4n-.js +0 -3
  293. package/dist/client/assets/runtime-Dm3Pi31_.js +0 -6
  294. package/dist/client/assets/runtimeModeConfig-_-kQoAWi.js +0 -2
  295. package/dist/client/assets/server-BvxyePeo.js +0 -2
  296. package/dist/client/assets/session-logic-P8gC-UQc.js +0 -26
  297. package/dist/client/assets/settings.archived-SsFK0IFf.js +0 -2
  298. package/dist/client/assets/settings.computer-use-CVmc70Ib.js +0 -2
  299. package/dist/client/assets/settings.connections-BrPlTKQ_.js +0 -2
  300. package/dist/client/assets/settings.decisions-pkwqjsKP.js +0 -2
  301. package/dist/client/assets/settings.diagnostics-BZD1uMGP.js +0 -2
  302. package/dist/client/assets/settings.integrations-Du282Gn7.js +0 -2
  303. package/dist/client/assets/settings.providers-DeUZZg7C.js +0 -3
  304. package/dist/client/assets/settingsLayout-DFYjWgKN.js +0 -3
  305. package/dist/client/assets/toast-BcjbmUtS.js +0 -2
  306. package/dist/client/assets/useSettings-BL4ZWGQV.js +0 -3
  307. package/dist/client/assets/utils-CrFJwxSd.js +0 -37
  308. package/dist/client/assets/vcsRefInvalidation-BPy1eoDi.js +0 -2
@@ -0,0 +1,216 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PullRequestCodeTab-0OaJE6XS.js","assets/react-DH3P2YXY.js","assets/jsx-runtime-BnjsACtP.js","assets/utils-BoMYW9A3.js","assets/activity-BT9zGwI4.js","assets/createLucideIcon-BRvysHna.js","assets/Icon-BiSXef-P.js","assets/alarm-clock-DLm_0oDD.js","assets/app-window-CBNJqZPl.js","assets/archive-D_14z4Xm.js","assets/arrow-down-up-Tu6B2hri.js","assets/arrow-down-Bo_WAMYh.js","assets/arrow-left-Ba8eq_9S.js","assets/arrow-right-left-DyJucsB1.js","assets/arrow-right-Bg4mlTrk.js","assets/arrow-up-down-AigUcA_4.js","assets/arrow-up-left-C6F8l2kC.js","assets/arrow-up-right-BNXlwlzJ.js","assets/arrow-up-D4kutFpL.js","assets/battery-DdftvRcq.js","assets/bell-4pS2DvJU.js","assets/blocks-N48yRCu0.js","assets/book-open-m1zikk07.js","assets/bookmark-DCumPe18.js","assets/bot-C71zefL3.js","assets/box-N7KHNXgQ.js","assets/bug-_77C5nd4.js","assets/calendar-arrow-down-tK2df2Gr.js","assets/calendar-arrow-up-DoqzmS-b.js","assets/calendar-clock-D24iG-gJ.js","assets/calendar-CuDpKI2e.js","assets/camera-CRxcom4Z.js","assets/chart-no-axes-column-CWRXr09M.js","assets/check-Cs_SSACZ.js","assets/chevron-down-Do9qqNbR.js","assets/chevron-left-D56AngEd.js","assets/chevron-right-CcbZ6PxZ.js","assets/chevron-up-CZEzk9UW.js","assets/chevrons-left-right-ellipsis-BuDdURW0.js","assets/chevrons-up-down-CMYBD15h.js","assets/chromium-IRgsGkxl.js","assets/circle-alert-Rh3WFq8P.js","assets/circle-arrow-up-CBkBThPI.js","assets/circle-check-Davl0yih.js","assets/circle-dashed-Divqvc3s.js","assets/circle-dot-DDXvyPkX.js","assets/circle-slash-BHppGVB2.js","assets/circle-x-DCG47j33.js","assets/circle-BXaepj2J.js","assets/clock-3-BjqRuWmx.js","assets/clock-BZce7MqL.js","assets/cloud-download-Cw2Qyeof.js","assets/cloud-upload-Bbq2IGQX.js","assets/cloud-Cnpuf424.js","assets/code-xml-C7_RVxwx.js","assets/code-C8ZFD3fi.js","assets/columns-2-R7e6oP5f.js","assets/copy-C6t_ZU58.js","assets/corner-left-up-CIgtHeD1.js","assets/corner-up-right-BWhPHx5s.js","assets/cpu-4YV41FL_.js","assets/database-0EoDfSWv.js","assets/download-CfEwtjBn.js","assets/earth-B0lYBmT1.js","assets/ellipsis-vertical-BM1Lc1f1.js","assets/ellipsis-CSD7gEuG.js","assets/external-link-Df6uBnqH.js","assets/eye-off-D5GkPp8X.js","assets/eye-DlWBkL1d.js","assets/file-braces-DycW5IfR.js","assets/file-code-corner-Bph0gpk_.js","assets/file-diff-uE_kfwjO.js","assets/file-search-BxZuGCW_.js","assets/file-spreadsheet-BDzNPY8g.js","assets/file-text-Bn72KOhu.js","assets/file-DHjVYhLT.js","assets/files-DsO7Sg8V.js","assets/film-Bbn0ceXE.js","assets/flask-conical-Cg6idKdH.js","assets/folder-closed-D6kbWc3q.js","assets/folder-cog-CBSQaLA2.js","assets/folder-git-2-n1sLmp_t.js","assets/folder-git-DCVI-R4l.js","assets/folder-open-Bu-nFCGY.js","assets/folder-plus-wg03g0vP.js","assets/folder-tree-FUExeKOH.js","assets/folder-Cieksypr.js","assets/gauge-Cgf0xSWC.js","assets/git-branch-plus-GXmZfN57.js","assets/git-branch-BWQfoO37.js","assets/git-commit-horizontal-BI_Z5Kib.js","assets/git-fork-CK2oK4JM.js","assets/git-merge-CH86CpaI.js","assets/git-pull-request-arrow-BYmuTHnq.js","assets/git-pull-request-closed-EzDnMgeA.js","assets/git-pull-request-draft-DbMmZ9EC.js","assets/globe-DHq8q48U.js","assets/grip-vertical-sTbvrVma.js","assets/hammer-BnFrycrq.js","assets/hard-drive-CnhXqMSu.js","assets/hat-glasses-C1sL_lJD.js","assets/history-BOloOry4.js","assets/house-LvUaI36y.js","assets/image-DFl_i29V.js","assets/inbox-Bfua4pqw.js","assets/info-Bwtivk15.js","assets/keyboard-C94dd8zf.js","assets/laptop-BJfWDOqH.js","assets/layers-BczY2xKh.js","assets/lightbulb-AbDNyk1F.js","assets/link-2-J9n7Ukgt.js","assets/link-iM9yOrD5.js","assets/list-checks--PgwqWme.js","assets/list-filter-C7uwdO5w.js","assets/list-ordered-JmJCtT6d.js","assets/list-todo-BOZtqLIw.js","assets/list-BNel2JmV.js","assets/loader-circle-DOPuwGUy.js","assets/lock-open-qdfB-3sG.js","assets/lock-CNeMaiIX.js","assets/log-in-DuxSLs9h.js","assets/mail-DrFNo5rr.js","assets/maximize-2-C4jSdiqI.js","assets/maximize-BKkQJR3r.js","assets/memory-stick-yVhfpVno.js","assets/message-circle-question-mark-qR5q6Xbi.js","assets/message-circle-qu3riBnu.js","assets/message-square-dashed-BDjE-epL.js","assets/message-square-off-BF3vA0b4.js","assets/message-square-text-CfjrqiSr.js","assets/message-square-warning-6MHWBWO6.js","assets/message-square-B2NO3ViY.js","assets/messages-square-BDA1tcVi.js","assets/minimize-2-D1qaBNiP.js","assets/minus-DVH2v7vL.js","assets/monitor-DYdSXGUQ.js","assets/moon-z0kk2bkY.js","assets/mouse-pointer-2-BzC5PGDm.js","assets/mouse-pointer-click-_zj1O0gg.js","assets/octagon-alert-BQp6gUkE.js","assets/package-plus-DaYcLmCH.js","assets/package-BDRaz7Ff.js","assets/paintbrush-Cd3ye7YJ.js","assets/palette-DWDYvvRF.js","assets/panel-bottom-DX8HINCH.js","assets/panel-left-aKsqIRJO.js","assets/panel-right-XrDzcWDK.js","assets/paperclip-BAtVoM2Q.js","assets/panels-top-left-ug17nD5b.js","assets/pen-line-BtsHFcuV.js","assets/pencil-ruler-u4ck96IX.js","assets/pencil-CS36_8K6.js","assets/picture-in-picture-2-CTTZM7s_.js","assets/pilcrow-B0pICPe4.js","assets/pin-B28emPdt.js","assets/play-utur7gJ1.js","assets/plug-2-BbsYUlrD.js","assets/plus-BFikiw2m.js","assets/plug-Cz_1a3P7.js","assets/power-lnBvrj1p.js","assets/presentation-DuhP07nk.js","assets/puzzle-_xVT2Tkf.js","assets/qr-code-8OyojaA-.js","assets/quote-CY1r_9f2.js","assets/radio-tower-CQ9UBgC-.js","assets/redo-2-CMJUpQN9.js","assets/refresh-cw-Bb4DfPZ_.js","assets/rotate-ccw-DIk8O74I.js","assets/rotate-cw-BCqL9vBU.js","assets/route-DDK4p_jp.js","assets/rows-3-KtFgL-bn.js","assets/scale-BWqluNv-.js","assets/search-2NYXmfL3.js","assets/send-Usbx4MSt.js","assets/server-C5VT7--0.js","assets/settings-2-CG9Vl9Oj.js","assets/settings-CSrjOUO8.js","assets/shield-check-BhnliHga.js","assets/shield-question-mark-DJzZ_XtG.js","assets/shield-Bo3bXsl5.js","assets/sliders-horizontal-CbQdxecl.js","assets/smartphone-DLXjLUvY.js","assets/smile-plus-B6sk7n9M.js","assets/sparkles-D72pVUsJ.js","assets/square-arrow-out-up-right-D4Y8_c2a.js","assets/square-pen-B9IATJSK.js","assets/square-split-horizontal-BEBi5lgX.js","assets/square-split-vertical-BvRRvh2L.js","assets/square-terminal-MebNo2O3.js","assets/square-ChD_5l-9.js","assets/star-BFGG9hcF.js","assets/sun-CV31Z7e1.js","assets/tag-DAyj5h5G.js","assets/target-DRkzkaHT.js","assets/terminal-Dbk8nKIT.js","assets/text-align-start-BlQ02nAY.js","assets/text-search-CmNwvT1W.js","assets/text-wrap-Y7SHIazH.js","assets/ticket-B3TOD4z9.js","assets/trash-2-vrfXuXSc.js","assets/trending-down-0HJRpRPf.js","assets/trending-up-B0AABrFJ.js","assets/triangle-alert-DcIYyjDc.js","assets/type-CcxvYAFU.js","assets/undo-2-CbzuoKHe.js","assets/unlink-2-Cu9CVRNc.js","assets/unplug-D0qX6EAT.js","assets/upload-_7gAV2BZ.js","assets/user-check-vIX5oc4W.js","assets/user-lock-Bz0imDJs.js","assets/user-plus-6mh3DQc1.js","assets/user-round-x-Dyi0-TdA.js","assets/user-round-CdU_AaX_.js","assets/users-CfjzCdxE.js","assets/wifi-off-DzVPlURa.js","assets/workflow-DbsdAT4Y.js","assets/wrench-Bjp_8iLx.js","assets/x-CJgPyqpa.js","assets/zap-C_GfNMdZ.js","assets/runtime-DR7JxgbQ.js","assets/runtime-d6B1vJeH.js","assets/TooltipViewport-ZmVCer7P.js","assets/toast-B84QdqqM.js","assets/spinner-CSTrcxhP.js","assets/useParams-DZQvRQLJ.js","assets/DiffFileTree-BSbsOOmA.js","assets/useSettings-CaJMqrvF.js","assets/server-sXApTCjZ.js","assets/session-C949OsEI.js","assets/use-atom-command-DA6OG-Qk.js","assets/themePalette-neUNWCzK.js","assets/diffRendering-BOVFJuWd.js","assets/index-B1djVqM4.js","assets/fileTreeExpansion-BBT5F8P1.js","assets/pierre-icons-jwqMPUxD.js","assets/query-d1pQlqP0.js","assets/DiffCommentAnnotation-WMKzOwCh.js","assets/Virtualizer-CImHNxBq.js","assets/getDiffFileInput-CGw09SPI.js","assets/main-BWh6jqG2.js","assets/vcsRefInvalidation-w_CQ3i43.js","assets/entities-Bqo0n1Pb.js","assets/number-field-SoHEiP55.js","assets/useRegisterFieldControl-CyBVe0G0.js","assets/FormContext-CmvUzTS-.js","assets/CSPContext-DGVCKkcb.js","assets/select-DaYjjw1q.js","assets/SelectScrollUpArrow-6kh66YCd.js","assets/link-B3B5a5Ju.js","assets/redirect-D3L17tzd.js","assets/lazyRouteComponent-BPxq_G_s.js","assets/useNavigate-DdjG4MB_.js","assets/useLocation-Bqc94klS.js","assets/rightPanelStore-D3KOmuPa.js","assets/toastHelpers-DxXYm50b.js","assets/queries-EslKFJTV.js","assets/session-logic-DkSfwnHl.js","assets/htmlRender-CmEeFzCo.js","assets/mediaSource-C2MsZgy8.js","assets/fileLinks-D4GSqJYj.js","assets/mediaReference-Bb8H-qbI.js","assets/usageFormat-Bzyvr9m4.js","assets/timestampFormat-wac2e_Jz.js","assets/env-wK1YYxA8.js","assets/tooltip-D-GRl-oZ.js","assets/skeleton-BCpBrYxh.js","assets/useAriaLabelledBy-PLuOxvFb.js","assets/toggle-BH5BGBcD.js","assets/toggle-group-Di3SFV73.js","assets/CompositeRoot-BuwzXGHT.js","assets/input-ekYqAkUx.js","assets/Input-Cv-TKh6s.js","assets/FieldControl-BHe6unoZ.js","assets/scroll-area-yyfi3ycu.js","assets/ScrollAreaCorner-BPMuWLbs.js","assets/dist-B2P3f-0Q.js","assets/DialogTitle-B_9LEmy3.js","assets/dialog-CBBxT1gk.js","assets/sidebar-C1E4GqL6.js","assets/useResizeDrag-Dc7crya0.js","assets/observeResize-3Vj9DYOV.js","assets/AnimatedHeight-OxEbW01v.js","assets/assets-aBpLf8r4.js","assets/sourceControl-DwJWPP0h.js","assets/assetUrls-CmOUMX2M.js","assets/browserHistoryStore-tYgeZygn.js","assets/preview-DGdQ5Ycc.js","assets/openFileInPreview-BBWCOLh_.js","assets/keybindings-B3oDRRkK.js","assets/Icons-B4l3TqYa.js","assets/preview-BYnEURcB.js","assets/PierreEntryIcon-DeI-j_7w.js","assets/RenderErrorBoundary-BsOuLEci.js","assets/sourceControlClients-BBJW7ra4.js","assets/browserLinkTarget-CQFfJKWJ.js","assets/pullRequestIcons-ucGaXXG7.js","assets/pullRequests-Bw3Ui6hK.js","assets/threadSort-Bd2rijEy.js","assets/popover-OfG3wVsl.js","assets/PopoverHandle-DMB4QSp6.js","assets/ProjectFavicon-_6hkSNzm.js","assets/ProjectMonogram-Cn4l-YGU.js","assets/projectFilesQueryState-CanWrACx.js","assets/checkbox-BEQFb7GO.js","assets/CheckboxIndicator-DbU3csPQ.js","assets/FieldItemContext-BsKb7ObC.js","assets/terminalSessions-C2NUFncF.js","assets/AlertDialogRoot-9jRALQXL.js","assets/uiStateStore-xSkh4_PU.js","assets/composer-logic-BPTz1APL.js","assets/composerTrigger-BGi0iyhl.js","assets/useHandleNewThread-Dm0SCq59.js","assets/p4ProjectFile-qmvlbzKv.js","assets/composerDraftUploads-b_0oxKs9.js","assets/guideRunStore-DvIkVECt.js","assets/pullRequestDetail.logic-RASi2EgP.js","assets/pullRequestReviewStore-CEr41DEl.js","assets/sidebarProjectGrouping-9cUrCOXH.js","assets/EnvironmentMachineIcon-Dpgx67FY.js","assets/alert-DO06etEs.js","assets/semver-CFbvOQKc.js","assets/ChatGptUsageButton-C3KgGt4z.js","assets/kbd-3FPzNikV.js","assets/settingsLayout-CFQx1XDM.js","assets/WorkspacePageContainer-BS8FWt_4.js","assets/KeybindingsSettings.logic-mF9mJWrc.js","assets/usageShortcuts-D6nQeRtx.js","assets/primaryCloudLinkState-CreqR0gU.js","assets/command-E2aLhsct.js","assets/ComboboxClear-Bn_kslrf.js","assets/ComboboxGroupLabel-fL8lMA25.js","assets/ConnectionStatusDot-CixsTBXI.js","assets/standalone-page-3TM7ZX16.js","assets/primary-B47ivN3o.js","assets/onboarding-CPgiVEVK.js","assets/scheduledTasksSettings.logic-CVIC4Kpr.js","assets/main-DdVSHl80.css","assets/DiffWorkerPoolProvider-BBk0lIX3.js","assets/textarea-R4UQ47Ns.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,t}from"./react-DH3P2YXY.js";import{t as n}from"./index-B1djVqM4.js";import{n as r,t as i}from"./jsx-runtime-BnjsACtP.js";import{$d as a,$f as o,$n as s,A as c,Ad as l,Af as u,Bf as d,Bm as f,D as p,Dl as m,F as h,Fp as g,Jm as _,Jn as v,Kp as y,Lf as b,Lm as x,Lp as S,Md as C,Mm as w,Ms as T,Nd as E,Of as D,Pp as O,Qn as k,Qs as A,Tp as j,Uy as M,Vd as N,Vp as P,Xn as F,Yn as I,Yp as L,Zm as R,Zn as z,Zo as B,Zs as V,_d as H,ad as U,af as ee,ar as te,bm as ne,df as re,dr as W,ec as G,ev as ie,fr as ae,gf as oe,gp as se,hg as ce,im as le,jd as ue,js as de,kd as fe,km as pe,ks as me,lf as he,mp as ge,nh as _e,nr as ve,ob as ye,od as be,of as xe,or as Se,pd as Ce,pp as we,q_ as Te,qy as Ee,rh as De,rm as Oe,rr as ke,sd as Ae,sf as je,t as K,th as Me,tp as Ne,tr as Pe,ts as Fe,uf as Ie,um as Le,ur as Re,vm as ze,wa as Be,xf as Ve,ym as He,zp as Ue}from"./utils-BoMYW9A3.js";import{W as We}from"./runtime-DR7JxgbQ.js";import{A as Ge,T as Ke,k as qe,w as Je}from"./entities-Bqo0n1Pb.js";import{_n as Ye,fn as Xe,gn as Ze,hn as Qe,sn as $e,yn as et}from"./runtime-d6B1vJeH.js";import{F as tt,K as nt,P as rt,V as it,_ as at,l as ot,q as st,x as ct,y as lt}from"./TooltipViewport-ZmVCer7P.js";import{J as ut,L as dt,R as ft,n as pt}from"./ChatMarkdown-9gWM0ED9.js";import{a as mt,o as ht,s as gt,t as _t}from"./select-DaYjjw1q.js";import{t as vt}from"./spinner-CSTrcxhP.js";import{i as yt,m as bt,p as xt}from"./toast-B84QdqqM.js";import{E as St,J as Ct,K as wt,f as Tt}from"./useSettings-CaJMqrvF.js";import{s as Et}from"./server-sXApTCjZ.js";import{i as Dt,n as Ot}from"./session-C949OsEI.js";import{n as kt}from"./query-d1pQlqP0.js";import{t as At}from"./use-atom-command-DA6OG-Qk.js";import{t as q,u as jt}from"./rightPanelStore-D3KOmuPa.js";import{u as Mt}from"./queries-EslKFJTV.js";import{C as Nt,Q as Pt,Z as Ft,_ as It,at as Lt,c as Rt,d as zt,ft as Bt,l as Vt,lt as Ht,nt as Ut,ot as Wt,s as Gt,t as Kt,tt as qt,u as Jt,v as Yt,w as Xt}from"./diffRendering-BOVFJuWd.js";import{C as Zt,E as Qt,G as $t,H as en,K as tn,U as nn,V as rn,W as an,d as on,i as sn,u as cn}from"./Virtualizer-CImHNxBq.js";import{l as ln,ut as un}from"./getDiffFileInput-CGw09SPI.js";import{i as dn,r as fn,t as pn}from"./DiffWorkerPoolProvider-BBk0lIX3.js";import{t as mn}from"./cloneFileDiffMetadata-zVRGqYgv.js";import{n as hn,r as gn,t as _n}from"./FileDiff-C1vAOUga.js";import{S as vn,a as yn,b as bn,i as xn,n as Sn,r as Cn,t as wn}from"./DiffCommentAnnotation-WMKzOwCh.js";import{r as Tn}from"./mediaSource-C2MsZgy8.js";import{o as En}from"./timestampFormat-wac2e_Jz.js";import{t as Dn}from"./env-wK1YYxA8.js";import{a as J,n as Y,r as On,t as X}from"./tooltip-D-GRl-oZ.js";import{t as kn}from"./skeleton-BCpBrYxh.js";import{t as An}from"./textarea-R4UQ47Ns.js";import{t as jn}from"./toggle-BH5BGBcD.js";import{n as Mn,t as Nn}from"./toggle-group-Di3SFV73.js";import{i as Pn,l as Fn,o as In,r as Ln,s as Rn,t as zn}from"./combobox--XoXA5uu.js";import{t as Bn}from"./input-ekYqAkUx.js";import{t as Vn}from"./scroll-area-yyfi3ycu.js";import{a as Hn,c as Un,i as Wn,o as Gn,r as Kn,s as qn,t as Jn}from"./dialog-CBBxT1gk.js";import{t as Yn}from"./useResizeDrag-Dc7crya0.js";import{a as Xn,i as Zn,o as Qn,r as $n,t as er}from"./empty-FOL5U4KY.js";import{i as tr}from"./device-DmH6IHQ4.js";import{t as nr}from"./observeResize-3Vj9DYOV.js";import{n as rr,t as ir}from"./assetUrls-CmOUMX2M.js";import{f as ar}from"./browserHistoryStore-tYgeZygn.js";import{_ as or,y as sr}from"./keybindings-B3oDRRkK.js";import{i as cr,n as lr}from"./Icons-B4l3TqYa.js";import{t as ur}from"./PierreEntryIcon-DeI-j_7w.js";import{C as dr,S as fr,T as pr,_ as mr,a as hr,b as gr,c as _r,d as vr,g as yr,h as br,l as xr,lt as Sr,m as Cr,nt as wr,o as Tr,p as Er,s as Dr,u as Or,ut as kr,v as Ar,w as jr,x as Mr,y as Nr}from"./RenderErrorBoundary-BsOuLEci.js";import{n as Pr,r as Fr}from"./sourceControlClients-BBJW7ra4.js";import{n as Ir}from"./pullRequestIcons-ucGaXXG7.js";import{D as Lr,a as Rr,c as zr,i as Br,k as Vr,n as Hr,r as Ur,u as Wr}from"./pullRequests-Bw3Ui6hK.js";import{a as Gr,i as Kr,n as qr,o as Jr,t as Yr}from"./popover-OfG3wVsl.js";import{A as Xr,B as Zr,C as Qr,D as $r,E as ei,G as ti,H as ni,I as ri,J as ii,K as ai,L as oi,M as si,N as ci,O as li,P as ui,R as di,S as fi,T as pi,U as mi,V as hi,Y as gi,_ as _i,a as vi,b as yi,c as bi,d as xi,f as Si,g as Ci,i as wi,j as Ti,k as Ei,l as Di,o as Oi,p as ki,r as Ai,s as ji,t as Mi,v as Ni,w as Pi,y as Fi,z as Ii}from"./pullRequestDetail.logic-RASi2EgP.js";import{i as Li,n as Ri,r as zi,t as Bi}from"./pullRequestReviewStore-CEr41DEl.js";import{t as Vi}from"./terminalLabels-BgLOlb2G.js";import{_ as Hi,c as Ui,f as Wi,g as Gi,i as Ki,o as qi,p as Ji,r as Yi,u as Xi,v as Zi}from"./uiStateStore-xSkh4_PU.js";import{n as Qi}from"./useHandleNewThread-Dm0SCq59.js";import{i as $i,m as ea,n as ta,r as na,t as ra}from"./guideRunStore-DvIkVECt.js";import{n as ia}from"./EnvironmentMachineIcon-Dpgx67FY.js";import{i as aa,n as oa,r as sa,t as ca}from"./alert-DO06etEs.js";import{t as la}from"./kbd-3FPzNikV.js";import{d as ua,l as da,t as fa,u as pa}from"./command-E2aLhsct.js";import{$t as ma,Gi as ha,Jr as ga,Oa as _a,_a as va,ci as ya,ga as ba,ha as xa,qi as Sa,qr as Ca,si as wa,ya as Ta}from"./main-BWh6jqG2.js";import"./WorkspacePageHeader-CE_94tTR.js";import{r as Ea,s as Da,t as Oa}from"./usePullRequestActions-DIjGLg1E.js";function ka(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Aa(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:ja(e.items,t.items)}function ja(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function Ma(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(Pt,``),t.before(r)):(r.setAttribute(Ft,``),t.after(r)),n?.observe(r),r}function Na(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var Pa=1e5,Fa=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,Ia=`data-diffs-search`,La=`:host {
3
+ display: block;
4
+ position: sticky;
5
+ z-index: 100;
6
+ height: 0;
7
+ }
8
+ [data-icon-sprite] {
9
+ position: absolute;
10
+ }
11
+ [data-search-panel] {
12
+ position: relative;
13
+ top: 8px;
14
+ }
15
+ [data-editor-widget] {
16
+ --diffs-bg: var(--diffs-search-panel-bg, Canvas);
17
+ --diffs-fg: var(--diffs-search-panel-fg, CanvasText);
18
+ --diffs-modified-base: var(--diffs-search-panel-accent, light-dark(#009fff, #69b1ff));
19
+ --diffs-header-font-fallback: var(--diffs-search-panel-font, system-ui, sans-serif);
20
+ }`,Ra,za=class{#e;#t;#n;#r=[];#i=new Map;#a;#o;#s=[];#c=[];constructor(e){this.#e=e}get isOpen(){return this.#t!=null}open(){if(this.#n!=null){this.#n.setMode(`find`);return}let e=this.#e.getContainerElement();if(e==null)return;let t=document.createElement(`div`);t.setAttribute(Ia,``),t.style.top=`${this.#e.getStickyHeaderOffset()}px`;let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=`${Cn}\n${La}`;let i=document.createElement(`div`);i.innerHTML=yn;let a=document.createElement(`div`);n.append(r,...i.children,a),e.prepend(t),this.#t=t;let o=Xa(),s=()=>this.#n===l,c=o===``,l=new xn({textDocument:{search:e=>s()?this.#u(e):[]},containerElement:a,defaultQuery:o,mode:`find`,allowReplace:!1,initialMatch:o===``?void 0:[0,0],scrollToMatch:([e])=>{s()&&this.#f(e)},applyReplace:()=>{},onUpdate:(e,t)=>{if(!s())return;if(e.length===0){(!c||this.#r.length===0)&&this.#d([]);return}if(t?.syncSelection===!1)return this.#p(),this.#a==null?void 0:e[this.#a];let n=e[this.#a??this.#e.getFirstVisibleSearchMatchIndex(this.#r)];return n!=null&&this.#f(n[0]),n},onClose:()=>this.#l(!0)});this.#n=l,c&&requestAnimationFrame(()=>{c=!1}),l.focus()}close(){this.#n?.close()}refresh(e=!1){if(this.#n!=null){if(!e&&Va(this.#c,this.#e.getSearchItems())){this.#p();return}this.#n.updateMatches({syncSelection:!1})}}repaint(){this.#r.length>0&&this.#p()}ownsEvent(e){return e.composedPath().some(e=>e instanceof Element&&e.hasAttribute(Ia))}handleKeyDown=e=>{if(e.isComposing||e.keyCode===229)return;if(this.ownsEvent(e)&&Ya(e)){e.key===`Escape`&&e.stopPropagation();return}if(e.defaultPrevented)return;if(vn(e)&&!e.altKey&&!e.shiftKey&&(e.key.toLowerCase()===`f`||e.code===`KeyF`)){e.preventDefault(),this.open();return}if(this.#n==null)return;let t=bn(e);t==null?e.key===`Escape`&&!Ya(e)&&(e.preventDefault(),e.stopPropagation(),this.close()):(e.preventDefault(),this.#n.navigate(t===`previous`))};cleanUp(){this.#l(!1)}#l(e){this.#t!=null&&(this.#n?.cleanup(),this.#n=void 0,this.#t.remove(),this.#t=void 0,this.#c=[],this.#d([]),e&&this.#e.getContainerElement()?.focus({preventScroll:!0}))}#u(e){let t=this.#a==null?void 0:this.#r[this.#a],n=this.#e.getSearchItems();return this.#c=n.map(e=>[e.id,e.fileDiff]),this.#d(Ba(n,e),t),this.#r.map(e=>e.range)}#d(e,t){this.#r=e,this.#i=Ha(e),this.#a=t==null?void 0:Ua(e,t),e.length===0&&(this.#e.cancelSearchReveal(),this.#p())}#f(e){let t=this.#r.findIndex(t=>t.range[0]===e);t!==-1&&(this.#a=t,this.#o=this.#r[t],this.#e.revealSearchMatch(this.#r[t]),this.#p())}#p(){let e=Za();if(e==null)return;for(let t of this.#s)e.match.delete(t),e.focus.delete(t);this.#s=[];let t=this.#a==null?void 0:this.#r[this.#a],n;for(let{entry:r,element:i}of this.#e.getMountedSearchMatches(this.#i)){let a=Wa(i,r.start,r.end);a!=null&&((r===t?e.focus:e.match).add(a),this.#s.push(a),r===t&&(n??=i))}t!=null&&n!=null&&this.#o===t&&(this.#o=void 0,this.#e.revealSearchMatchHorizontally(t,n))}};function Ba(e,t){if(t.text===``||t.text.includes(`
21
+ `))return[];let n;try{n=new RegExp(t.regex?t.text:Ja(t.text),t.caseSensitive?`g`:`gi`)}catch{return[]}let r=[],i=0;for(let a=0;a<e.length&&r.length<Pa;a++){let o=e[a];if(o.type!==`diff`)continue;let{fileDiff:s}=o;ln({diff:s,diffStyle:`unified`,expandedHunks:!0,callback:({type:e,deletionLine:c,additionLine:l})=>{let u=e===`change`&&c!=null,d=u?c:l,f=Ga((u?s.deletionLines:s.additionLines)[d.lineIndex]??``);n.lastIndex=0;let p;for(;(p=n.exec(f))!==null;){let s=p[0].length;if(s===0){n.lastIndex++;continue}if((!t.wholeWord||Ka(f,p.index,s))&&(r.push({id:o.id,itemIndex:a,side:u?`deletions`:`additions`,isContext:e!==`change`,lineNumber:d.lineNumber,unifiedLineIndex:d.unifiedLineIndex,start:p.index,end:p.index+s,range:[i+p.index,i+p.index+s]}),r.length>=Pa))return!0}i+=f.length+1}})}return r}function Va(e,t){return e.length===t.length&&t.every((t,n)=>t.id===e[n][0]&&t.fileDiff===e[n][1])}function Ha(e){let t=new Map;for(let n of e){let e=t.get(n.itemIndex);e??t.set(n.itemIndex,e=[]),e.push(n)}return t}function Ua(e,t){let n=e.findIndex(e=>e.id===t.id&&e.side===t.side&&e.lineNumber===t.lineNumber&&e.start===t.start);return n===-1?void 0:n}function Wa(e,t,n){let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=0,a,o=0,s;for(;(s=r.nextNode())!=null;){let e=s.data.length;if(a==null&&t<i+e&&(a=s,o=t-i),a!=null&&n<=i+e){let e=document.createRange();return e.setStart(a,o),e.setEnd(s,n-i),e}i+=e}}function Ga(e){return e.endsWith(`\r
22
+ `)?e.slice(0,-2):e.endsWith(`
23
+ `)||e.endsWith(`\r`)?e.slice(0,-1):e}function Ka(e,t,n){return qa(e,t-1)&&qa(e,t+n)}function qa(e,t){if(t<0||t>=e.length)return!0;let n=e.charCodeAt(t);return n<=32||n===127||Fa.includes(e[t])}function Ja(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ya(e){let t=e.composedPath()[0];return t instanceof HTMLElement&&(t.isContentEditable||t.matches(`input, textarea, select`))}function Xa(){let e=document.getSelection()?.toString()??``;return e.includes(`
24
+ `)?``:e}function Za(){if(Ra!=null)return Ra;if(typeof CSS<`u`&&`highlights`in CSS&&typeof Highlight<`u`)return Ra={match:new Highlight,focus:new Highlight},CSS.highlights.set(`diffs-search-match`,Ra.match),CSS.highlights.set(`diffs-search-focus`,Ra.focus),Ra}var Qa=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.parseDiffOptions.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),$a=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],eo=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],to=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],no=Symbol(`CodeView.itemOptionsState`);function ro(e,t){Object.defineProperty(e,no,{configurable:!1,enumerable:!1,value:t})}function io(e){return e[no]}function ao(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var oo=120,so=1,co=48,lo=`--diffs-overflow-override`;function uo(e,t,n){return{containerHeight:e,triggerTop:t,targetTop:n,targetBottom:e-n,threshold:e-t}}var fo=uo(12e6,1e6,2e6),po=uo(2**22,5e5,1e6);function mo(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var ho=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),go=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollRebaseConfig=Zt()?po:fo;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=qt;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;pendingHighlighterTheme;isContainerManaged;search=new za(this);pendingSearchReveal;constructor(e={theme:Wt},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??Ut}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??qt.hunkLineCount,lineHeight:e?.lineHeight??qt.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??qt.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??qt.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??Lt}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return Ht&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<so||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),ho&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(lo,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,oo)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(lo,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element!=null&&(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0),!1);if(r.element!=null&&i===r.render)return!1;let a=r.element??Ma(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isContainerManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.search.handleKeyDown),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){$t(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let{items:e}=this,t=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),e});this.itemEditors.clear(),this.attachedEditors.clear(),this.selectedLines=null,this.items=[],this.idToItem.clear(),this.instanceToItem.clear();let n=!1,r;for(let e of t)try{e.editor.cleanUp(`discard`)}catch(e){n||(n=!0,r=e)}for(let t of e)try{t.instance.cleanUp()}catch(e){n||(n=!0,r=e)}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator(),this.search.refresh(),n)throw r}cleanUp(){let e=!1,t;try{this.reset()}catch(n){e=!0,t=n}if(this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.search.handleKeyDown),this.search.cleanUp(),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,e)throw t}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(Bt),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))So(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return ka()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}openSearch(){this.search.open()}closeSearch(){this.search.close()}getSearchItems(){return this.items.map(e=>e.item)}getFirstVisibleSearchMatchIndex(e){if(this.items.length===0)return 0;let t=this.getScrollTop()-this.getItemTopOffset()+this.getStickyHeaderOffset(),n=this.findFirstVisibleIndex(Math.max(this.getScrollTop()-this.getItemTopOffset(),0)),r=this.items[n];for(let i=0;i<e.length;i++){let a=e[i];if(a.itemIndex<n)continue;if(a.itemIndex>n)return i;let o=this.getLineScrollPosition(r,a);if(o==null||r.top+o.top>=t)return i}return 0}revealSearchMatch(e,t=!1){let n=this.idToItem.get(e.id);if(n==null||n.type!==`diff`)return;if(n.item.collapsed===!0){if(this.options.onRevealSearchMatch==null){this.scrollTo({type:`item`,id:e.id,align:`start`});return}this.pendingSearchReveal=e,this.options.onRevealSearchMatch(n.item);return}let r={type:`line`,id:e.id,lineNumber:e.lineNumber,side:e.side,align:`center`,offset:-(this.getStickyHeaderOffset()+co)/2},i=n.instance.getRenderedDiff()!=null;if(this.pendingSearchReveal=i?void 0:e,i&&e.side===`additions`&&!n.instance.isLineRenderable(e.lineNumber))n.instance.revealLine(e.lineNumber);else if(i&&!t&&this.isScrollTargetInView(r))return;this.scrollTo(r)}cancelSearchReveal(){this.pendingSearchReveal=void 0}resumePendingSearchReveal(e){let t=this.pendingSearchReveal;if(t!=null){for(let n of e)if(n.item.id===t.id&&n.item.collapsed!==!0&&n.instance.getRenderedDiff()!=null){queueMicrotask(()=>{this.pendingSearchReveal===t&&this.revealSearchMatch(t,!0)});return}}}revealSearchMatchHorizontally(e,t){let n=this.idToItem.get(e.id),r=t.closest(`[data-code]`);if(n==null||r==null||r.scrollWidth<=r.clientWidth)return;let i=r.getBoundingClientRect(),a=_o(t,e.start,e.end);if(a==null)return;let o=r.querySelector(`:scope > [data-gutter]`)?.getBoundingClientRect().right,s=o!=null&&o>i.left?o:i.left,c=r.scrollLeft;if(a.left<s+24)c-=s+24-a.left;else if(a.right>i.right-24)c+=a.right-(i.right-24);else return;n.instance.setCodeScrollLeft(Math.max(0,c))}isScrollTargetInView(e){let t=this.getScrollTargetRect(e);if(t==null)return!1;let n=this.getItemTopOffset()+t.top,r=this.getScrollTop();return n>=r+this.getStickyHeaderOffset()+co&&n+t.height<=r+this.getHeight()}getMountedSearchMatches(e){let t=[],{firstIndex:n,lastIndex:r}=this.renderState;if(n===-1)return t;for(let i=n;i<=r;i++){let n=e.get(i),r=n==null?void 0:this.items[i]?.element?.shadowRoot;if(r==null)continue;let a=new Map;for(let e of r.querySelectorAll(`[data-line][data-line-index]`)){let t=e.getAttribute(`data-line-index`).split(`,`)[0],n=e.closest(`[data-deletions]`)==null?`additions`:`deletions`;a.set(`${n}:${t}`,e)}for(let e of n){let n=a.get(`additions:${e.unifiedLineIndex}`),r=a.get(`deletions:${e.unifiedLineIndex}`),i=e.side===`deletions`?[r??n]:e.isContext?[n,r]:[n];for(let n of i)n!=null&&t.push({entry:e,element:n})}}return t}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),this.search.refresh(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),this.search.refresh(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection(),this.search.refresh()}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.setItems(n),!0}setItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e));try{this.syncItemEditors(t)}finally{for(let e of t?.values()??[])e.instance.cleanUp()}this.syncSelection(),this.search.refresh()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=vo(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;yo(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!an(r,i),o=!an(n,this.getLayout());o&&this.syncLayout();let s=a||bo(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||xo(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),nn(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let c=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isContainerManaged&&(this.items.length>0||c)&&this.render()}capturePendingLayoutAnchor(e=this.idToItem){this.root!=null&&this.items.length!==0&&this.pendingScrollTarget==null&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(t=!1){e.__STOP||(t?($t(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):tn(this.computeRenderRangeAndEmit))}isReady(){let{workerManager:e}=this;return e==null||e.getStats().workersFailed?this.isSharedHighlighterReady():e.isInitialized()?(this.clearReadySubscription(),!0):(this.isReadySubscription??=e.subscribeToStatChanges(e=>{(e.managerState===`initialized`||e.workersFailed)&&(this.clearReadySubscription(),this.render(!0))}),e.getStats().managerState===`waiting`&&e.initialize().catch(()=>{}),!1)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0,this.pendingHighlighterTheme=void 0)}isSharedHighlighterReady(){let e=this.workerManager?.getFileRenderOptions().theme??this.options.theme??Wt;return It()&&Nt(e)?(this.clearReadySubscription(),!0):(un(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return Yt({themes:Xt(e),langs:[],preferredHighlighter:this.options.preferredHighlighter}).then(()=>{t||(this.clearReadySubscription(),this.render(!0))},e=>{t||(this.clearReadySubscription(),console.error(e))}),()=>{t=!0}})(),!1)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=Oo(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(t!=null||n!=null||r!=null)return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new gn(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new dn(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&en(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null,this.options.onSelectedLinesChange?.(null);return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i;try{if(r==null&&e.type===`diff`&&!e.instance.__canAttachEditor()){e.instance.__prepareForEditing();return}if(r==null){mo(n);let r=io(e.instance.options);if(r==null)throw Error(`CodeView.attachItemEditor: instance options are missing their state`);let a=e=>{let t=this.idToItem.get(r.id);t!=null&&this.options.onItemEditChange?.(e,t.item)},o=this.options.getEditStateKey?.(e.item);if(e.type===`diff`){let s=n(`file-diff`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}else{let s=n(`file`,{onChange:a},o);i=s,this.itemEditors.set(t,{editor:s,state:r,dispose:s.edit(e.instance)})}}else r.dispose=(e.type,r.editor.edit(e.instance));this.attachedEditors.add(t)}catch(t){throw i?.cleanUp(),this.releaseRenderedItem(e),t}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null){let{edit:e=!1,collapsed:t=!1}=i.item;if(e){t&&this.attachedEditors.delete(n)&&r.editor.cleanUp(`recycle`);continue}}else a!=null&&(r.state.removedItem=a.item);this.itemEditors.delete(n),this.attachedEditors.delete(n),t.push(r)}if(t.length===0)return;let n=!1,r;for(let e of t){try{e.dispose()}catch(e){n||(n=!0,r=e)}let t=this.idToItem.get(e.state.id);t!=null&&this.markItemLayoutDirty(t)}if(this.render(),n)throw r}requireItemFromState(e){let t=this.idToItem.get(e.id)?.item??e.removedItem;if(t==null)throw Error(`CodeView.onItemEditComplete: unknown item "${e.id}"`);return t}completeFileItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`file`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a file item`);let r={...n,file:t.file,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}completeDiffItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`diff`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a diff item`);let r={...n,fileDiff:t.fileDiff,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n!=null&&n.type!==`position`&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of $a)ao(e,t,()=>this.options[t]);ao(e,`stickyHeader`,()=>this.options.stickyHeaders),ao(e,`collapsed`,e=>{let t=io(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),ao(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=io(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of eo)this.defineItemSharedCallback(e,`file`,t);for(let t of to)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of Qa)ao(e,t,()=>this.options[t]);ao(e,`stickyHeader`,()=>this.options.stickyHeaders),ao(e,`hunkSeparators`,()=>this.options.hunkSeparators),ao(e,`collapsed`,e=>{let t=io(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),ao(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=io(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of eo)this.defineItemSharedCallback(e,`diff`,t);for(let t of to)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return ro(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return ro(t,{id:e}),t}updateItemOptionsId(e,t){let n=io(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(n!=null&&n.type===t)return n}defineItemSharedCallback(e,t,n){ao(e,n,e=>{if(this.options[n]==null)return;let r=io(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){ao(e,n,e=>{let r=io(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)},i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);if(e.version===t.version)return!1;e.item=t,e.version=t.version,e.renderedOptionsRevision=-1;let n=this.pendingSearchReveal;return n!=null&&n.id===t.id&&t.collapsed!==!0&&queueMicrotask(()=>{this.pendingSearchReveal===n&&this.revealSearchMatch(n,!0)}),!0}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>this.scrollRebaseConfig.threshold}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),this.scrollRebaseConfig.containerHeight):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=Na(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=Na(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let{scrollPageOffset:t,scrollRebaseConfig:n}=this,r=this.clampScrollPageOffset(t),i=e-r,a=this.getMaxPagedScrollTop(),o=this.getMaxScrollPageOffset(),s=i>n.threshold&&r<o,c=i<n.triggerTop&&r>0;return i<0||i>a||s||c?this.resolveScrollPageWindow(e,c?Math.min(n.targetBottom,a):n.targetTop):{pagedScrollTop:Na(this.clampPagedScrollTop(i)),scrollPageOffset:r}}needsScrollPageUpdate(e){let t=Na(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${Co(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${Co(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null||!this.isReady())return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=rn({scrollTop:s-this.header.height,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m=this.reconcileHeaderFooterHosts(),h,g=new Set,_=this.findFirstVisibleIndex(u),v=this.findLastVisibleIndex(d);for(let e=_;e<=v;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),Eo(this.stickyContainer,t.element,h),n.virtualizedSetup(),To(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element):(Eo(this.stickyContainer,t.element,h),To(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,g.add(t)),h=t.element),t.item.edit===!0&&this.attachItemEditor(t)}this.renderState.firstIndex=_<=v?_:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.flushManagers(g),m&&this.measureMountedHosts(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();let y=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let b=y==null?0:y-i,x=s,S=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,b);e==null?x=i:(x=e,S=!0)}else x=y??s;x!==l&&(this.applyScrollFix(x,l,this.windowSpecs),l=x),S&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=Na(l),this.updateStickyPositioning(),this.validateStickyContainerHeight(),this.fixContainerFocus(),g.size>0&&(this.resumePendingSearchReveal(g),this.search.repaint()),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container!=null&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(r!=null&&i!=null)return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);if(t==null){this.stickyOffset.style.height=`${this.getPagedLayoutTop(e.top)}px`;return}this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;(n-t!==this.renderState.stickyHeight||t!==this.renderState.stickyTop||n!==this.renderState.stickyBottom)&&this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=e=>{e!=null&&this.search.isOpen&&this.search.ownsEvent(e)||(this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0)};handleResize=e=>{let t=!1;for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=so){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else this.scrollDirty=!0,this.heightDirty=!0,t=!0;t&&this.render(!0)};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(o!==-1&&s!==-1){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=Na(this.clampScrollTop(e)),i=Na(t),{scrollPageOffset:a}=this,o=Na(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;(r!==this.renderState.scrollTop||r!==i||l!==o||u)&&(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null||Na(this.getScrollTop())===Na(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);Aa(this.slotSnapshot,e)||(this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);if(e.top=r,e.type===`diff`){let n=e.item.fileDiff.isPartial;e.height=e.instance.updateCodeViewLayout(e.item.fileDiff,r,t,e.item.annotations??[]),n&&!e.item.fileDiff.isPartial&&this.search.refresh(!0)}else e.height=e.instance.updateCodeViewLayout(e.item.file,r,t,e.item.annotations??[]);r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function _o(e,t,n){let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=0,a,o=0,s;for(;(s=r.nextNode())!=null;){let e=s.data.length;if(a==null&&t<i+e&&(a=s,o=t-i),a!=null&&n<=i+e){let e=document.createRange();return e.setStart(a,o),e.setEnd(s,n-i),e.getBoundingClientRect()}i+=e}}function vo(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,e.top,void 0,e.item.annotations??[])}function yo(e,t){return!un(e.theme??Wt,t.theme??Wt)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function bo(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function xo(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function So(e){return e instanceof SVGElement||Qt(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function Co(e){let t=wo(e.start,e.side),n=wo(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function wo(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function To(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function Eo(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function Do(e){return(e.annotations?.length??0)>0}function Oo(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)Do(t.item)&&i.push(t);return i.length>0?i:void 0}var Z=e(t(),1),ko=e(Be(),1),Q=r(),$=e(i(),1);function Ao(e){return K(`flex items-center justify-between gap-2`,e===`embedded`?`px-2`:`px-4`,Dn&&e!==`sheet`&&e!==`embedded`?`drag-region h-[var(--workspace-topbar-height)] border-b border-border wco:pr-(--workspace-native-controls-inset)`:`flex h-10 min-h-10 shrink-0 items-center border-b border-border/60 bg-background in-data-[preview-panel-mode=inline]:mb-3 in-data-[preview-panel-mode=inline]:h-7 in-data-[preview-panel-mode=inline]:min-h-7 in-data-[preview-panel-mode=inline]:border-b-transparent`)}function jo(e){let t=(0,Q.c)(10),n=Dn&&e.mode!==`sheet`&&e.mode!==`embedded`,r=e.mode===`inline`?`w-[42vw] min-w-[360px] max-w-[560px] shrink-0 border-l border-border`:`w-full`,i;t[0]===r?i=t[1]:(i=K(`flex h-full min-w-0 flex-col bg-background`,r),t[0]=r,t[1]=i);let a;t[2]!==e.header||t[3]!==e.mode||t[4]!==n?(a=n?(0,$.jsx)(`div`,{className:Ao(e.mode),children:e.header}):(0,$.jsx)(`div`,{className:Ao(e.mode),"data-surface-subheader":!0,children:e.header}),t[2]=e.header,t[3]=e.mode,t[4]=n,t[5]=a):a=t[5];let o;return t[6]!==e.children||t[7]!==i||t[8]!==a?(o=(0,$.jsxs)(`div`,{className:i,children:[a,e.children]}),t[6]=e.children,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Mo(e){let t=(0,Q.c)(7),{titleWidth:n}=e,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`flex size-5 shrink-0 items-center justify-center`,children:(0,$.jsx)(kn,{className:`size-2.5`})}),i=(0,$.jsx)(kn,{className:`size-5 shrink-0`}),t[0]=r,t[1]=i):(r=t[0],i=t[1]);let a=n===`short`?`h-3 w-2/5 max-w-52`:n===`medium`?`h-3 w-1/2 max-w-64`:`h-3 w-3/5 max-w-72`,o;t[2]===a?o=t[3]:(o=(0,$.jsx)(kn,{shape:`pill`,className:a}),t[2]=a,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,$.jsx)(kn,{shape:`pill`,className:`h-3 w-5`}),(0,$.jsx)(kn,{shape:`pill`,className:`h-3 w-5`})]}),t[4]=s):s=t[4];let c;return t[5]===o?c=t[6]:(c=(0,$.jsxs)(`div`,{className:`flex h-8 items-center gap-2 px-2 pr-3`,children:[r,i,o,s]}),t[5]=o,t[6]=c),c}function No(e){let t=(0,Q.c)(3),{width:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(kn,{shape:`pill`,className:`h-2.5 w-5 shrink-0`}),t[0]=r):r=t[0];let i=n===`short`?`h-2.5 w-3/5`:n===`medium`?`h-2.5 w-2/3`:`h-2.5 w-4/5`,a;return t[1]===i?a=t[2]:(a=(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[r,(0,$.jsx)(kn,{shape:`pill`,className:i})]}),t[1]=i,t[2]=a),a}function Po(e){let t=(0,Q.c)(10),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Mo,{titleWidth:`medium`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`flex h-6 items-center gap-2 px-2 pr-3`,children:[(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border/40`}),(0,$.jsx)(kn,{shape:`pill`,className:`h-2.5 w-24`}),(0,$.jsx)(`div`,{className:`h-px flex-1 bg-border/40`})]}),t[1]=r):r=t[1];let i,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,$.jsx)(No,{width:`medium`}),(0,$.jsx)(No,{width:`long`}),(0,$.jsx)(No,{width:`short`})]}),a=(0,$.jsx)(Mo,{titleWidth:`short`}),o=(0,$.jsx)(Mo,{titleWidth:`long`}),t[2]=i,t[3]=a,t[4]=o):(i=t[2],a=t[3],o=t[4]);let s;t[5]===e.label?s=t[6]:(s=(0,$.jsx)(`span`,{className:`sr-only`,children:e.label}),t[5]=e.label,t[6]=s);let c;return t[7]!==e.label||t[8]!==s?(c=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden bg-background`,role:`status`,"aria-live":`polite`,"aria-label":e.label,children:[n,r,i,a,o,s]}),t[7]=e.label,t[8]=s,t[9]=c):c=t[9],c}function Fo(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}var Io=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function Lo(e){return{instance:void 0,items:void 0,controlled:e,managedOptions:void 0,disableFlushSync:!1,slotCoordinator:void 0}}function Ro(e,t){let{className:n,containerRef:r,disableWorkerPool:i=!1,editorOptions:a,getEditStateKey:o,initialItems:s,items:c,onItemEditChange:l,onItemEditComplete:u,onRevealSearchMatch:d,onScroll:f,onSelectedLinesChange:p,options:m,renderAnnotation:h,renderCodeViewFooter:g,renderCodeViewHeader:_,renderCustomHeader:v,renderGutterUtility:y,renderHeaderFilenameSuffix:b,renderHeaderMetadata:x,renderHeaderPrefix:S,selectedLines:C,style:w}=e,T=c!==void 0,E=cn(),D=(0,Z.useContext)(sn),O=(0,Z.useRef)(Lo(T)),k=v!=null,A=h!=null,j=y!=null,M=k||S!=null||b!=null||x!=null,N=M||A||j,P=_!=null,F=g!=null,I=on(e=>{p?.(e)}),L=C!==void 0,R=on((e,t,n)=>{if(E==null)throw Error(`CodeView: EditContext is not attached`);let r={...a,...t};return E(e,r,n)}),z=on((e,t)=>{l?.(e,t)}),B=on((e,t,n)=>u?.(e,t,n)??`reject`),V=on(e=>{d?.(e)}),H=(0,Z.useMemo)(()=>Wo({options:m,hasCustomHeader:k,hasGutterRenderer:j,hasCodeViewHeader:P,hasCodeViewFooter:F,onSelectedLinesChange:p==null?void 0:I,controlledSelection:L,getEditStateKey:o,createEditor:E==null?void 0:R,onItemEditChange:l==null?void 0:z,onItemEditComplete:u==null?void 0:B,onRevealSearchMatch:d==null?void 0:V}),[E,L,R,z,B,V,I,F,P,k,j,o,l,u,d,p,m]),[U]=(0,Z.useState)(()=>Uo()),[,ee]=(0,Z.useState)({}),te=on(e=>{O.current.instance!=null&&(e==null||e!==O.current.instance.getContainerElement())&&(O.current.instance.cleanUp(),U.publish(void 0),O.current=Lo(T)),e!=null&&e!==O.current.instance?.getContainerElement()&&(O.current.instance=new go(H,i?void 0:D,!0),O.current.instance.setup(e)),Fo(r,e)}),ne=on(e=>{O.current.disableFlushSync?U.publish(e):(0,ko.flushSync)(()=>{U.publish(e)})}),re=(0,Z.useMemo)(()=>{if(M||A||j||P||F)return{hasHeaderRenderers:M,hasAnnotationRenderer:A,hasGutterRenderer:j,onSnapshotChange:ne}},[ne,A,j,M,P,F]);return Io(()=>f==null?void 0:O.current.instance?.subscribeToScroll(f)),Io(()=>{let{instance:e,controlled:t,items:n,managedOptions:r,slotCoordinator:i}=O.current;if(e!=null)try{O.current.disableFlushSync=!0;let a=!1;if(nn(H,r)||(O.current.managedOptions=H,e.setOptions(H),a=!0),t!==T){console.error(`CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.`);return}if(T)c!==n&&(Vo(n,c)?O.current.items=c:Bo(n,c)?(O.current.items=c,e.addItems(c.slice(n.length))):(O.current.items=c,e.setItems(c),a=!0));else if(n==null){let t=s??[];O.current.items=t,t.length>0&&(e.setItems(t),a=!0)}C!==void 0&&e.setSelectedLines(C,{notify:!1});let o=e.setSlotCoordinator(re),l=!1;re!==i&&((re==null||i==null)&&(l=!0),O.current.slotCoordinator=re),(a||o)&&e.render(!0),o&&re==null&&U.publish(void 0),l&&ee({})}finally{O.current.disableFlushSync=!1}}),(0,Z.useImperativeHandle)(t,()=>({addItems(e){let{controlled:t,instance:n}=O.current;Ho(t,`addItems`),n==null?console.error(`CodeView.addItems: no valid instance to append items with`,e):n.addItems(e)},getItem(e){let{instance:t}=O.current;if(t==null){console.error(`CodeView.getItem: no valid instance exists`,e);return}return t.getItem(e)},removeItem(e){let{controlled:t,instance:n}=O.current;return Ho(t,`removeItem`),n==null?(console.error(`CodeView.removeItem: no valid instance to remove item from`,e),!1):n.removeItem(e)},updateItem(e){let{controlled:t,instance:n}=O.current;return Ho(t,`updateItem`),n==null?(console.error(`CodeView.updateItem: no valid instance to update item with`,e),!1):n.updateItem(e)},updateItemId(e,t){let{controlled:n,instance:r}=O.current;return Ho(n,`updateItemId`),r==null?(console.error(`CodeView.updateItemId: no valid instance to update item id with`,e,t),!1):r.updateItemId(e,t)},scrollTo(e){let{instance:t}=O.current;t==null?console.error(`CodeView.scrollTo: no valid instance to scroll with`,e):t.scrollTo(e)},setSelectedLines(e){let{instance:t}=O.current;t==null?console.error(`CodeView.setSelectedLines: no valid instance to update selection with`,e):(t.setSelectedLines(e,{notify:!1}),I(e))},getSelectedLines(){let{instance:e}=O.current;return e==null?(console.error(`CodeView.getSelectedLines: no valid instance exists`),null):e.getSelectedLines()},clearSelectedLines(){let{instance:e}=O.current;e==null?console.error(`CodeView.clearSelectedLines: no valid instance to update selection with`):(e.clearSelectedLines({notify:!1}),I(null))},getEditor(e){let{instance:t}=O.current;if(t==null){console.error(`CodeView.getEditor: no valid instance exists`,e);return}return t.getEditor(e)},getInstance(){return O.current.instance}}),[I]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{ref:te,className:n,style:w}),(N||P||F)&&(0,$.jsx)(Go,{managedContentStore:U,renderCustomHeader:v,renderHeaderPrefix:S,renderHeaderFilenameSuffix:b,renderHeaderMetadata:x,renderAnnotation:h,renderGutterUtility:y,renderCodeViewHeader:_,renderCodeViewFooter:g})]})}var zo=(0,Z.forwardRef)(Ro);function Bo(e,t){if(e==null||t.length<=e.length)return!1;if(e.length===0)return!0;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return!1;return!0}function Vo(e,t){if(e==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ho(e,t){if(e)throw Error(`CodeView.${t} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`)}function Uo(){let e,t=new Set;return{getSnapshot(){return e},publish(n){if(!Aa(e,n)){e=n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function Wo({options:e,hasCustomHeader:t,hasGutterRenderer:n,hasCodeViewHeader:r,hasCodeViewFooter:i,onSelectedLinesChange:a,controlledSelection:o,getEditStateKey:s,createEditor:c,onItemEditChange:l,onItemEditComplete:u,onRevealSearchMatch:d}){let f={...e,controlledSelection:o,onSelectedLinesChange:a,createEditor:c};return s!=null&&(f.getEditStateKey=s),l!=null&&(f.onItemEditChange=l),u!=null&&(f.onItemEditComplete=u),d!=null&&(f.onRevealSearchMatch=d),t&&(f.renderCustomHeader=qo),n&&(f.renderGutterUtility=qo),r&&(f.renderCodeViewHeader=qo),i&&(f.renderCodeViewFooter=qo),f}var Go=(0,Z.memo)(function({managedContentStore:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderCodeViewHeader:s,renderCodeViewFooter:c}){"use no memo";let l=on(t=>e.subscribe(t)),u=on(()=>e.getSnapshot()),d=(0,Z.useSyncExternalStore)(l,u,u),f=``;for(let e of d?.items??[])f+=`${e.id}:${e.version}:${e.type}`;let p=(0,Z.useMemo)(()=>d?.items?.map(e=>(0,ko.createPortal)(Ko({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o}),e.element,e.id)),[t,n,r,i,a,o,f]),m=(0,Z.useMemo)(()=>s!=null&&d?.header!=null?(0,ko.createPortal)(s(),d.header):null,[s,d?.header]),h=(0,Z.useMemo)(()=>c!=null&&d?.footer!=null?(0,ko.createPortal)(c(),d.footer):null,[c,d?.footer]);return(0,$.jsxs)($.Fragment,{children:[p,m,h]})});function Ko({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o}){if(e.type===`diff`){let{item:s,instance:c}=e;return hn({fileDiff:s.fileDiff,renderCustomHeader:t==null?void 0:()=>t(s),renderHeaderPrefix:n==null?void 0:()=>n(s),renderHeaderFilenameSuffix:r==null?void 0:()=>r(s),renderHeaderMetadata:i==null?void 0:()=>i(s),renderAnnotation:a==null?void 0:e=>a(e,s),lineAnnotations:s.annotations,renderGutterUtility:o==null?void 0:e=>o(e,s),getHoveredLine:c.getHoveredLine,getAnnotationSlotName:c.getAnnotationSlotName})}{let{item:s,instance:c}=e;return fn({file:s.file,renderCustomHeader:t==null?void 0:()=>t(s),renderHeaderPrefix:n==null?void 0:()=>n(s),renderHeaderFilenameSuffix:r==null?void 0:()=>r(s),renderHeaderMetadata:i==null?void 0:()=>i(s),renderAnnotation:a==null?void 0:e=>a(e,s),lineAnnotations:s.annotations,renderGutterUtility:o==null?void 0:e=>o(e,s),getHoveredLine:c.getHoveredLine,getAnnotationSlotName:c.getAnnotationSlotName})}}function qo(){}var Jo=`${Kt}
25
+ :is(
26
+ [data-line],
27
+ [data-line-annotation],
28
+ [data-merge-conflict],
29
+ [data-merge-conflict-actions],
30
+ [data-no-newline]
31
+ )[data-selected-line] {
32
+ --diffs-line-bg: light-dark(
33
+ color-mix(
34
+ in lab,
35
+ var(--code-background) 88%,
36
+ color-mix(in srgb, var(--code-background) 50%, var(--diffs-modified-base))
37
+ ),
38
+ color-mix(
39
+ in lab,
40
+ var(--code-background) 80%,
41
+ color-mix(in srgb, var(--code-background) 70%, var(--diffs-modified-base))
42
+ )
43
+ ) !important;
44
+ }
45
+
46
+ :is([data-gutter-buffer], [data-column-number])[data-selected-line] {
47
+ --diffs-line-bg: light-dark(
48
+ color-mix(
49
+ in lab,
50
+ var(--code-background) 91%,
51
+ color-mix(in srgb, var(--code-background) 35%, var(--diffs-modified-base))
52
+ ),
53
+ color-mix(
54
+ in lab,
55
+ var(--code-background) 85%,
56
+ color-mix(in srgb, var(--code-background) 60%, var(--diffs-modified-base))
57
+ )
58
+ ) !important;
59
+ }
60
+
61
+ [data-indicators="bars"]
62
+ :is([data-column-number], [data-gutter-buffer="annotation"])[data-selected-line] {
63
+ position: relative;
64
+ }
65
+
66
+ [data-indicators="bars"]
67
+ :is([data-column-number], [data-gutter-buffer="annotation"])[data-selected-line]::before {
68
+ position: absolute !important;
69
+ inset-block: 0 !important;
70
+ inset-inline-start: 0 !important;
71
+ display: block !important;
72
+ width: 4px !important;
73
+ min-width: 4px !important;
74
+ max-width: 4px !important;
75
+ height: auto !important;
76
+ padding: 0 !important;
77
+ content: "" !important;
78
+ background-color: var(--diffs-modified-base) !important;
79
+ background-image: none !important;
80
+ }
81
+
82
+ [data-file-info] {
83
+ background-color: var(--code-background) !important;
84
+ border-block-color: transparent !important;
85
+ color: var(--code-foreground) !important;
86
+ }
87
+
88
+ [data-diffs-header] {
89
+ position: sticky !important;
90
+ top: 0;
91
+ z-index: 4;
92
+ background-color: var(--code-background) !important;
93
+ border-bottom-color: transparent !important;
94
+ align-items: center !important;
95
+ font-family: var(--font-sans) !important;
96
+ font-size: 12px !important;
97
+ line-height: 1 !important;
98
+ min-height: 32px !important;
99
+ padding-block: 6px !important;
100
+ padding-inline: 8px 12px !important;
101
+ }
102
+
103
+ [data-diffs-header]:hover {
104
+ /* A native scrollbar gutter cannot be painted by descendants. Use an inset edge cue instead
105
+ of a full-width band that would look accidentally clipped at the gutter. */
106
+ background-color: var(--code-background) !important;
107
+ box-shadow: inset 3px 0 color-mix(in srgb, var(--code-foreground) 24%, transparent);
108
+ }
109
+
110
+ /* Hunk separators are the way to the unchanged lines between hunks. They keep the library's
111
+ layout, with the expand button in its own cell, but sit one step off the code surface so they
112
+ read as quiet controls; hover brings them forward. */
113
+ :is([data-separator="line-info"], [data-separator="line-info-basic"]) {
114
+ /* Exact and margin-free: the virtualizer places rows from hunkSeparatorHeight below. */
115
+ height: 24px !important;
116
+ margin-block: 0 !important;
117
+ --diffs-bg-separator: color-mix(in srgb, var(--code-background) 97%, var(--code-foreground));
118
+ }
119
+
120
+ :is([data-separator="line-info"], [data-separator="line-info-basic"]) [data-separator-content] {
121
+ color: color-mix(in srgb, var(--code-foreground) 50%, var(--code-background)) !important;
122
+ font-family: var(--font-sans) !important;
123
+ font-size: 11px !important;
124
+ text-decoration: none !important;
125
+ }
126
+
127
+ :is([data-separator="line-info"], [data-separator="line-info-basic"]) [data-expand-button] {
128
+ color: color-mix(in srgb, var(--code-foreground) 50%, var(--code-background)) !important;
129
+ }
130
+
131
+ :is([data-separator="line-info"], [data-separator="line-info-basic"])[data-expand-index]
132
+ :is([data-separator-content], [data-expand-button]):hover {
133
+ color: var(--code-foreground) !important;
134
+ background-color: color-mix(
135
+ in srgb,
136
+ var(--code-background) 92%,
137
+ var(--code-foreground)
138
+ ) !important;
139
+ }
140
+
141
+ [data-diffs-header] [data-header-content] {
142
+ align-items: center !important;
143
+ line-height: 1 !important;
144
+ }
145
+
146
+ /* Pierre clips file names with overflow: hidden for its start ellipsis. A 1em line box cuts off
147
+ descenders. Only the clipped names get room: 16px plus the header's 12px of padding stays
148
+ inside its 32px min-height, which diffHeaderHeight assumes. */
149
+ [data-diffs-header] :is([data-title], [data-prev-name]) {
150
+ line-height: 16px !important;
151
+ }
152
+
153
+ [data-diffs-header] [data-metadata] {
154
+ align-items: center !important;
155
+ line-height: 1 !important;
156
+ font-variant-numeric: tabular-nums;
157
+ }
158
+
159
+ [data-diffs-header] [data-additions-count],
160
+ [data-diffs-header] [data-deletions-count] {
161
+ font-family: var(--font-mono) !important;
162
+ font-size: 11px !important;
163
+ font-variant-numeric: tabular-nums;
164
+ line-height: 1 !important;
165
+ }
166
+
167
+ [data-diffs-header] [data-change-icon],
168
+ [data-diffs-header] [data-rename-icon] {
169
+ display: block;
170
+ flex-shrink: 0;
171
+ }
172
+
173
+ [data-title] {
174
+ cursor: pointer;
175
+ transition: color 120ms ease;
176
+ font-family: var(--font-sans) !important;
177
+ }
178
+
179
+ [data-title]:hover {
180
+ color: color-mix(in srgb, var(--code-foreground) 84%, var(--primary)) !important;
181
+ }
182
+
183
+ /* Expanding a file mounts its body all at once; easing it in matches the 200ms the app's
184
+ collapsibles take. Appearance only — the viewer owns geometry, so height cannot animate.
185
+ Departing content cuts, the same one-way rule the pull request chrome fold follows. */
186
+ [data-diff],
187
+ [data-file] {
188
+ transition: opacity 200ms ease-out;
189
+ }
190
+
191
+ @starting-style {
192
+ [data-diff],
193
+ [data-file] {
194
+ opacity: 0;
195
+ }
196
+ }
197
+
198
+ @media (prefers-reduced-motion: reduce) {
199
+ [data-diff],
200
+ [data-file] {
201
+ transition: none;
202
+ }
203
+ }
204
+ `;function Yo(e){let t=(0,Q.c)(18),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({options:r,viewerRef:o,className:n,unsafeCSSExtra:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===o?s=t[7]:(s=o?{ref:o}:{},t[6]=o,t[7]=s);let c=n?`diff-render-surface [--code-background:var(--background)] outline-none ${n}`:`diff-render-surface [--code-background:var(--background)] outline-none`,l=a?`${Jo}\n${a}`:Jo,u,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u={diffHeaderHeight:32,hunkSeparatorHeight:24,spacing:0,paddingTop:0,paddingBottom:8},d={paddingTop:0,paddingBottom:0,gap:0},t[8]=u,t[9]=d):(u=t[8],d=t[9]);let f;t[10]!==r||t[11]!==l?(f={...r,unsafeCSS:l,itemMetrics:u,layout:d},t[10]=r,t[11]=l,t[12]=f):f=t[12];let p;return t[13]!==i||t[14]!==s||t[15]!==c||t[16]!==f?(p=(0,$.jsx)(pn,{children:(0,$.jsx)(zo,{...i,...s,className:c,options:f})}),t[13]=i,t[14]=s,t[15]=c,t[16]=f,t[17]=p):p=t[17],p}function Xo(e,t){return async n=>{let r=Jt(n),i=n.prevName?Jt({...n,name:n.prevName}):r,a=await e({changeType:n.type,oldPath:i,newPath:r}),o={name:r,contents:a.newContents,cacheKey:`${t}:new:${r}`};return n.type===`rename-pure`?{oldFile:null,newFile:o}:{oldFile:{name:i,contents:a.oldContents,cacheKey:`${t}:old:${i}`},newFile:o}}}function Zo(e,t){return Xo(async({changeType:n,oldPath:r,newPath:i})=>{let a=await e({environmentId:t.environmentId,input:{cwd:t.cwd,sourceKind:t.sourceKind,changeType:n,baseRef:t.baseRef,headRef:t.headRef,oldPath:r,newPath:i}});if(a._tag!==`Success`)throw We(a);return a.value},t.cacheKey)}function Qo(e,t){return Xo(async({changeType:n,oldPath:r,newPath:i})=>{let a=await e({environmentId:t.environmentId,input:{...t.reference,...t.commit===null?{}:{commit:t.commit},changeType:n,oldPath:r,newPath:i}});if(a._tag!==`Success`)throw We(a);return a.value},t.cacheKey)}var $o=Ee,es=`--resizable-width`;function ts(e){let{storageKey:t,defaultWidth:n,minWidth:r,maxWidth:i,edge:a}=e,o=(0,Z.useCallback)(e=>Number.isFinite(e)?Math.max(r,Math.min(i,e)):n,[n,i,r]),s=()=>{if(typeof window>`u`)return n;try{let e=me(t,$o);return o(e??n)}catch(e){return console.error(`Could not read persisted panel width.`,e),n}},[c,l]=(0,Z.useState)(()=>({storageKey:t,width:s()}));c.storageKey!==t&&l({storageKey:t,width:s()});let u=o(c.width),d=(0,Z.useRef)({clamp:o,storageKey:t,width:u});(0,Z.useLayoutEffect)(()=>{d.current={clamp:o,storageKey:t,width:u}},[o,u,t]);let{refresh:f,...p}=Yn(e=>{let n=e.currentTarget.parentElement;return n?.style.setProperty(`transition-property`,`none`),{width:u,edge:a,resize(e){let t=d.current.clamp(e);return n?.style.setProperty(es,`${t}px`),t},finish(e){l({storageKey:t,width:e});try{de(d.current.storageKey,e,$o)}catch(e){console.error(`Could not persist panel width.`,e)}},cleanup(e){n?.style.removeProperty(`transition-property`),e||n?.style.setProperty(es,`${d.current.width}px`)}}},t);return(0,Z.useLayoutEffect)(f,[o,u,f]),{width:u,handlers:p}}var ns=`p4code:preview-panel-width`,rs=360,is=.7,as=360,os=540;function ss(e,t){let n=(0,Q.c)(6),r;n[0]===t?r=n[1]:(r=t===void 0?{}:t,n[0]=t,n[1]=r);let i=r,a=cs(e,i.enabled??!0,i.container),o=i.widthStorageKey??ns,s=i.defaultWidth??os,c;return n[2]!==a||n[3]!==o||n[4]!==s?(c={storageKey:o,defaultWidth:s,minWidth:rs,maxWidth:a,edge:`left`},n[2]=a,n[3]=o,n[4]=s,n[5]=c):c=n[5],ts(c)}function cs(e,t,n){let r=(0,Q.c)(5),[i,a]=(0,Z.useState)(ls),o,s;return r[0]!==n||r[1]!==t||r[2]!==e?(o=()=>{if(typeof window>`u`)return;let r=n??(t?e?.current?.parentElement:null)??null,i=()=>{a(us(window.innerWidth,r?.clientWidth))};i();let o=0,s=()=>{o===0&&(o=window.requestAnimationFrame(()=>{o=0,i()}))};window.addEventListener(`resize`,s);let c=r?nr(r,i):void 0;return()=>{window.removeEventListener(`resize`,s),o!==0&&window.cancelAnimationFrame(o),c?.()}},s=[n,e,t],r[0]=n,r[1]=t,r[2]=e,r[3]=o,r[4]=s):(o=r[3],s=r[4]),(0,Z.useLayoutEffect)(o,s),i}function ls(){return us(typeof window>`u`?1280:window.innerWidth)}function us(e,t){let n=Math.floor(e*is),r=t===void 0?1/0:Math.floor(t)-as;return Math.max(rs,Math.min(n,r))}function ds(e){let t=(0,Q.c)(6),{handlers:n,className:r}=e,i;t[0]===r?i=t[1]:(i=K(`group absolute inset-y-0 -left-1 z-20 w-2 cursor-col-resize select-none`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover:bg-border group-active:bg-primary/60`}),t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==i?(o=(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,className:i,...n,children:a}),t[3]=n,t[4]=i,t[5]=o):o=t[5],o}function fs(e){let t=(0,Q.c)(4);if(e.inlineSize){let n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(ms,{...e,inlineSize:e.inlineSize}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,$.jsx)(ps,{...e}),t[2]=e,t[3]=n),n}function ps(e){let t=(0,Q.c)(7),n=(0,Z.useRef)(null),r=e.mode===`inline`&&!e.maximized,i;t[0]!==e.defaultWidth||t[1]!==e.widthStorageKey||t[2]!==r?(i={enabled:r,widthStorageKey:e.widthStorageKey,defaultWidth:e.defaultWidth},t[0]=e.defaultWidth,t[1]=e.widthStorageKey,t[2]=r,t[3]=i):i=t[3];let a=ss(n,i),o;return t[4]!==a||t[5]!==e?(o=(0,$.jsx)(ms,{...e,inlineSize:a,hostRef:n}),t[4]=a,t[5]=e,t[6]=o):o=t[6],o}function ms(e){let t=(0,Q.c)(43);Dn&&e.mode!==`sheet`&&e.mode;let n=e.mode===`inline`,r=n&&e.open!==void 0,i=e.open??!0,a=e.maximized??!1,o=(0,Z.useRef)(null),s=e.hostRef??o,{width:c,handlers:l}=e.inlineSize,u;t[0]!==a||t[1]!==i||t[2]!==c?(u=()=>({open:i,width:c,maximized:a,suppressed:!1}),t[0]=a,t[1]=i,t[2]=c,t[3]=u):u=t[3];let[d,f]=(0,Z.useState)(u);(d.open!==i||d.width!==c||d.maximized!==a)&&f({open:i,width:c,maximized:a,suppressed:r&&d.open===i&&(d.width!==c||d.maximized!==a)});let p=d.suppressed,m,h;t[4]===p?(m=t[5],h=t[6]):(m=()=>{if(!p)return;let e=0,t=window.requestAnimationFrame(()=>{e=window.requestAnimationFrame(()=>{f(hs)})});return()=>{window.cancelAnimationFrame(t),window.cancelAnimationFrame(e)}},h=[p],t[4]=p,t[5]=m,t[6]=h),(0,Z.useLayoutEffect)(m,h);let g=n?a?`flex-1 border-l border-border`:`shrink-0 border-l border-border`:`w-full`,_=r&&`[[data-panel-animations=true]_&]:transition-[width] [[data-panel-animations=true]_&]:duration-(--panel-animation-duration) [[data-panel-animations=true]_&]:ease-out`,v=r&&i&&`[[data-panel-animations=true]_&]:starting:w-0!`,y=r&&!i&&`pointer-events-none`,b;t[7]!==g||t[8]!==_||t[9]!==v||t[10]!==y?(b=K(`relative flex h-full min-h-0 min-w-0 max-w-full flex-col self-stretch bg-background`,g,_,v,y),t[7]=g,t[8]=_,t[9]=v,t[10]=y,t[11]=b):b=t[11];let x;t[12]!==r||t[13]!==n||t[14]!==a||t[15]!==i||t[16]!==p||t[17]!==c?(x=n?{[es]:`${c}px`,width:a?`100%`:r&&!i?`0px`:`var(${es})`,transitionDuration:p?`0ms`:void 0}:void 0,t[12]=r,t[13]=n,t[14]=a,t[15]=i,t[16]=p,t[17]=c,t[18]=x):x=t[18];let S=e.mode,C=a?`true`:`false`,w;t[19]!==l||t[20]!==n||t[21]!==a?(w=n&&!a?(0,$.jsx)(ds,{handlers:l}):null,t[19]=l,t[20]=n,t[21]=a,t[22]=w):w=t[22];let T=r&&`overflow-clip`,E=r&&!a&&`flex justify-end`,D;t[23]!==T||t[24]!==E?(D=K(`h-full min-h-0 w-full`,T,E),t[23]=T,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==r||t[27]!==a?(O=r&&!a?{width:`calc(var(${es}) - 1px)`}:void 0,t[26]=r,t[27]=a,t[28]=O):O=t[28];let k;t[29]!==e.children||t[30]!==O?(k=(0,$.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 shrink-0 flex-col`,style:O,children:e.children}),t[29]=e.children,t[30]=O,t[31]=k):k=t[31];let A;t[32]!==D||t[33]!==k?(A=(0,$.jsx)(`div`,{className:D,children:k}),t[32]=D,t[33]=k,t[34]=A):A=t[34];let j;return t[35]!==s||t[36]!==e.mode||t[37]!==C||t[38]!==w||t[39]!==A||t[40]!==b||t[41]!==x?(j=(0,$.jsxs)(`div`,{ref:s,className:b,style:x,"data-preview-panel-mode":S,"data-preview-panel-maximized":C,children:[w,A]}),t[35]=s,t[36]=e.mode,t[37]=C,t[38]=w,t[39]=A,t[40]=b,t[41]=x,t[42]=j):j=t[42],j}function hs(e){return{...e,suppressed:!1}}function gs(e){let t=(0,Q.c)(6),{className:n}=e,r;t[0]===n?r=t[1]:(r=K(`relative flex flex-col gap-0.5 overflow-hidden rounded-sm border border-border/60 bg-card p-1 shadow-xs/5`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-destructive/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-warning/80`}),(0,$.jsx)(`span`,{className:`size-[3px] rounded-full bg-success/80`})]}),t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsxs)(`div`,{className:`mt-[1px] flex flex-1 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{className:`h-[2px] w-full rounded-full bg-muted-foreground/30`}),(0,$.jsx)(`span`,{className:`h-[2px] w-3/5 rounded-full bg-muted-foreground/20`})]}),t[3]=a):a=t[3];let o;return t[4]===r?o=t[5]:(o=(0,$.jsxs)(`div`,{"aria-hidden":!0,className:r,children:[i,a]}),t[4]=r,t[5]=o),o}function _s(e){let t=(0,Q.c)(10),n,r,i;t[0]===e.sources?(n=t[1],r=t[2],i=t[3]):(r=e.sources.filter(vs),n=ys,i=r.join(`\0`),t[0]=e.sources,t[1]=n,t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==e.className||t[6]!==e.fallback||t[7]!==r||t[8]!==i?(a=(0,$.jsx)(n,{sources:r,fallback:e.fallback,className:e.className},i),t[4]=n,t[5]=e.className,t[6]=e.fallback,t[7]=r,t[8]=i,t[9]=a):a=t[9],a}function vs(e){return!!e}function ys(e){let t=(0,Q.c)(11),[n,r]=(0,Z.useState)(bs),i;if(t[0]!==n||t[1]!==e.sources){let r;t[3]===n?r=t[4]:(r=e=>!n.has(e),t[3]=n,t[4]=r),i=e.sources.find(r),t[0]=n,t[1]=e.sources,t[2]=i}else i=t[2];let a=i;if(!a)return e.fallback;let o;t[5]===a?o=t[6]:(o=()=>r(e=>new Set(e).add(a)),t[5]=a,t[6]=o);let s;return t[7]!==e.className||t[8]!==a||t[9]!==o?(s=(0,$.jsx)(`img`,{src:a,alt:``,"aria-hidden":`true`,draggable:!1,className:e.className,onError:o}),t[7]=e.className,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function bs(){return new Set}function xs(e){let t=(0,Q.c)(12),n=ha(e.threadRef,e.url),r;t[0]===e.className?r=t[1]:(r=K(`size-7 shrink-0`,e.className),t[0]=e.className,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,$.jsx)(gs,{className:r}),t[2]=r,t[3]=i);let a=i,o;t[4]===n?o=t[5]:(o=[n],t[4]=n,t[5]=o);let s;t[6]===e.className?s=t[7]:(s=K(`size-7 shrink-0 rounded object-contain`,e.className),t[6]=e.className,t[7]=s);let c;return t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,$.jsx)(_s,{sources:o,fallback:a,className:s}),t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function Ss(e,t){return e==null||t==null?!1:e.trim().toLowerCase()===t.trim().toLowerCase()}function Cs(e){return e.capabilities.edit?.changeRequest===!0?e.viewerPermissions.editChangeRequest===void 0?Ss(e.viewer,e.author?.login)||e.viewerPermissions.actions.includes(`merge`):e.viewerPermissions.editChangeRequest:!1}function ws(e,t){return e.capabilities.edit?.comment!==!0||t.kind!==`issue-comment`&&t.kind!==`review-comment`?!1:t.canEdit===void 0?Ss(e.viewer,t.author?.login):t.canEdit}function Ts(e,t){return e.viewerPermissions.resolve&&t.canResolve!==!1}function Es(e){let t=(0,Q.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=K(`flex shrink-0 opacity-0 transition-opacity pointer-coarse:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100 focus-within:opacity-100 motion-reduce:transition-none`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(P,{"aria-hidden":!0,className:`size-3`}),t[5]=a):a=t[5];let o;t[6]===r?o=t[7]:(o=(0,$.jsx)(W,{...r,size:`icon-xs`,variant:`ghost-muted`,children:a}),t[6]=r,t[7]=o);let s;return t[8]!==i||t[9]!==o?(s=(0,$.jsx)(`span`,{className:i,children:o}),t[8]=i,t[9]=o,t[10]=s):s=t[10],s}function Ds(e,t,n,r){i(e);function i(e){if(e.children!==void 0)for(let a=0;a<e.children.length;a+=1){let o=e.children[a];if(r.has(o.type))continue;if(o.type!==`text`||o.value===void 0){i(o);continue}let s=[],c=0,l=!1;t.lastIndex=0;let u=t.exec(o.value);for(;u!==null;){let e=u.index,r=n(u[0],{index:e,input:u.input});if(r===!1?t.lastIndex=e+1:(c<e&&s.push({type:`text`,value:o.value.slice(c,e)}),s.push(r),c=e+u[0].length,l=!0),!t.global)break;u=t.exec(o.value)}l&&(c<o.value.length&&s.push({type:`text`,value:o.value.slice(c)}),e.children.splice(a,1,...s),a+=s.length-1)}}}var Os=/^\s{0,3}((?:`{3,})|(?:~{3,}))(.*)$/u,ks=8,As=/^(?: {4}|\t)/u,js=/^<?(https?:\/\/\S+?)>?$/u,Ms=/\.(?:png|jpe?g|gif|webp|avif|heic|heif|svg)(?:$|[?#])/iu,Ns=/^\[[^\]]*\]\((https?:\/\/[^\s)]+)\)$/u,Ps=/\.(?:mp4|webm|mov|m4v|ogv)(?:$|[?#])/iu,Fs=/^https:\/\/github\.com\/user-attachments\/assets\/[\w-]+$/iu,Is=/<(?:video|source)\b[^>]*\bsrc\s*=\s*["']([^"']+)["']/iu,Ls=/^\s*<video\b/iu,Rs=/<\/video>\s*$/iu;function zs(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function Bs(e){let t=js.exec(e.trim())?.[1]??Ns.exec(e.trim())?.[1];return t===void 0||!zs(t)?null:Ps.test(t)||Fs.test(t)?{url:t,media:`video`}:Ms.test(t)?{url:t,media:`image`}:null}function Vs(e){let t=[],n=[],r=null,i=()=>{let e=n.join(`
205
+ `).replace(/^\n+/u,``).replace(/\s+$/u,``);n.length=0,e.trim().length>0&&t.push({id:`markdown:${t.length}`,kind:`markdown`,text:e})},a=e.split(`
206
+ `);for(let e=0;e<a.length;e+=1){let o=a[e],s=Os.exec(o);if(s!==null){let e=s[1],t=r!==null&&e[0]===r[0]&&e.length>=r.length&&s[2].trim().length===0;r===null?r=e:t&&(r=null),n.push(o);continue}if(r!==null||As.test(o)){n.push(o);continue}let c=Bs(o);if(c!==null){i(),t.push({id:`attachment:${t.length}`,kind:`attachment`,...c});continue}if(!Ls.test(o)){n.push(o);continue}let l=Math.min(e+ks,a.length)-1,u=e;for(;u<l&&!Rs.test(a[u]);)u+=1;let d=Rs.test(a[u])?Is.exec(a.slice(e,u+1).join(`
207
+ `))?.[1]:void 0;d!==void 0&&zs(d)?(i(),t.push({id:`attachment:${t.length}`,kind:`attachment`,url:d,media:`video`}),e=u):n.push(o)}return i(),t}var Hs=/#[1-9]\d*|[0-9a-f]{40}/giu,Us=/[A-Za-z0-9_]/u,Ws=/[\s([{]/u,Gs=new Set([`link`,`linkReference`]);function Ks(e){let t=e.repositoryUrl.replace(/\/+$/u,``);return e=>{Ds(e,Hs,(e,n)=>{let r=e.startsWith(`#`),i=n.input[n.index-1],a=n.input[n.index+e.length];return i!==void 0&&(r?Us.test(i):!Ws.test(i))||a!==void 0&&Us.test(a)?!1:{type:`link`,url:r?`${t}/issues/${e.slice(1)}`:`${t}/commit/${e}`,data:{hProperties:{dataPullRequestAutolink:r?`reference`:`commit`}},children:[{type:`text`,value:r?e:e.slice(0,7)}]}},Gs)}}var qs=(0,Z.createContext)(null);function Js(e){let t=(0,Q.c)(7),{environmentId:n,cwd:r,url:i,fetchUrl:a}=e,o;t[0]!==r||t[1]!==a?(o={_tag:`github-media`,cwd:r,url:a},t[0]=r,t[1]=a,t[2]=o):o=t[2];let s=o,c=rr(n,s),l=ir(n,s),u=c._tag===`Success`?c.url:c._tag===`Failure`?a:null,d=u===null?null:u+Tn(i),f;return t[3]!==l||t[4]!==d||t[5]!==i?(f=(0,$.jsx)(ut,{src:d,originalUrl:i,label:`Pull request video`,className:`w-full`,videoClassName:`rounded-lg border border-border/60`,onRetry:l}),t[3]=l,t[4]=d,t[5]=i,t[6]=f):f=t[6],f}function Ys(e){let t=(0,Q.c)(12),{text:n,cwd:r,environmentId:i,threadRef:a,className:o}=e,s=Vs(n),c=(0,Z.useContext)(qs),l=c?.repositoryUrl,u=a??c?.threadRef??void 0,d;t[0]===l?d=t[1]:(d=l?[[Ks,{repositoryUrl:l}]]:[],t[0]=l,t[1]=d);let f=d,p;t[2]===o?p=t[3]:(p=K(`space-y-3 [&_[data-markdown-details]]:border-0 [&_[data-markdown-details-summary]]:text-foreground/80 [&_[data-markdown-details-summary]>svg]:text-muted-foreground/60`,o),t[2]=o,t[3]=p);let m;t[4]!==r||t[5]!==i||t[6]!==f||t[7]!==u?(m=e=>{if(e.kind===`markdown`||e.media===`image`)return(0,$.jsx)(pt,{text:e.kind===`markdown`?e.text:`![](<${e.url}>)`,cwd:r,threadRef:u,pullRequestPanelRef:u??q,environmentId:i,extraRemarkPlugins:f,githubMedia:!0},e.id);let t=e.media===`video`?dt(e.url):null;return t===null?e.media===`video`?(0,$.jsx)(ut,{src:e.url,originalUrl:e.url,label:`Pull request video`,className:`w-full`,videoClassName:`rounded-lg border border-border/60`},`${e.id}:${e.url}`):(0,$.jsxs)(`a`,{href:e.url,rel:`noreferrer noopener`,target:`_blank`,className:`flex items-center gap-2 rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-sm hover:bg-muted/60`,children:[(0,$.jsx)(Ue,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Open attachment on GitHub`}),(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-3 shrink-0 text-muted-foreground`})]},e.id):(0,$.jsx)(Js,{environmentId:i,cwd:r,url:e.url,fetchUrl:t},`${e.id}:${e.url}`)},t[4]=r,t[5]=i,t[6]=f,t[7]=u,t[8]=m):m=t[8];let h=s.map(m),g;return t[9]!==p||t[10]!==h?(g=(0,$.jsx)(`div`,{className:p,"data-image-gallery":!0,children:h}),t[9]=p,t[10]=h,t[11]=g):g=t[11],g}function Xs(e){let t=(0,Q.c)(52),{value:n,cwd:r,environmentId:i,threadRef:a,placeholder:o,label:s,saving:c,allowEmpty:l,className:u,onSave:d,onCancel:f}=e,p=a===void 0?null:a,m=l!==void 0&&l,h=Dt(i,ie),[g,_]=(0,Z.useState)(n),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(n);b!==n&&(x(n),_(n));let S;t[0]===g?S=t[1]:(S=g.trim(),t[0]=g,t[1]=S);let C=S.length===0,w=!h||c||C&&!m,T;t[2]===u?T=t[3]:(T=K(`space-y-2`,u),t[2]=u,t[3]=T);let E;t[4]!==g||t[5]!==i||t[6]!==f||t[7]!==d||t[8]!==w||t[9]!==c?(E=e=>{if(!(e.nativeEvent.isComposing||e.keyCode===229)){if(e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey){e.preventDefault(),e.stopPropagation(),!w&&!e.repeat&&Ot(i,`source-control:write`)&&d(g);return}e.key!==`Escape`||c||(e.preventDefault(),f())}},t[4]=g,t[5]=i,t[6]=f,t[7]=d,t[8]=w,t[9]=c,t[10]=E):E=t[10];let D=v?`preview`:`write`,O;t[11]===D?O=t[12]:(O=[D],t[11]=D,t[12]=O);let k,A,j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=e[0];(t===`write`||t===`preview`)&&y(t===`preview`)},j=(0,$.jsx)(Nn,{value:`write`,children:`Write`}),k=(0,$.jsx)(Nn,{value:`preview`,children:`Preview`}),t[13]=k,t[14]=A,t[15]=j):(k=t[13],A=t[14],j=t[15]);let M;t[16]!==c||t[17]!==O?(M=(0,$.jsxs)(Mn,{"aria-label":`Markdown editor mode`,variant:`segmented`,value:O,disabled:c,onValueChange:A,children:[j,k]}),t[16]=c,t[17]=O,t[18]=M):M=t[18];let N;t[19]!==r||t[20]!==g||t[21]!==C||t[22]!==i||t[23]!==s||t[24]!==o||t[25]!==v||t[26]!==c||t[27]!==p?(N=v?(0,$.jsx)(`div`,{className:`rounded-lg border border-border/60 px-3 py-2`,children:C?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Nothing to preview.`}):(0,$.jsx)(Ys,{text:g,cwd:r,environmentId:i,threadRef:p})}):(0,$.jsx)(An,{autoFocus:!0,disabled:c,value:g,rows:6,placeholder:o,"aria-label":s,onChange:e=>_(e.target.value)}),t[19]=r,t[20]=g,t[21]=C,t[22]=i,t[23]=s,t[24]=o,t[25]=v,t[26]=c,t[27]=p,t[28]=N):N=t[28];let P;t[29]!==f||t[30]!==c?(P=(0,$.jsx)(W,{size:`xs`,variant:`ghost`,disabled:c,onClick:f,children:`Cancel`}),t[29]=f,t[30]=c,t[31]=P):P=t[31];let F=!h||c||C&&!m,I;t[32]!==m||t[33]!==g||t[34]!==C||t[35]!==i||t[36]!==d||t[37]!==c?(I=()=>{!Ot(i,`source-control:write`)||c||C&&!m||d(g)},t[32]=m,t[33]=g,t[34]=C,t[35]=i,t[36]=d,t[37]=c,t[38]=I):I=t[38];let L=c?`Saving...`:`Save`,R;t[39]!==F||t[40]!==I||t[41]!==L?(R=(0,$.jsx)(W,{size:`xs`,variant:`outline`,disabled:F,onClick:I,children:L}),t[39]=F,t[40]=I,t[41]=L,t[42]=R):R=t[42];let z;t[43]!==P||t[44]!==R?(z=(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[P,R]}),t[43]=P,t[44]=R,t[45]=z):z=t[45];let B;return t[46]!==M||t[47]!==N||t[48]!==z||t[49]!==T||t[50]!==E?(B=(0,$.jsxs)(`div`,{className:T,onKeyDown:E,children:[M,N,z]}),t[46]=M,t[47]=N,t[48]=z,t[49]=T,t[50]=E,t[51]=B):B=t[51],B}var Zs=[`thumbs-up`,`thumbs-down`,`laugh`,`hooray`,`confused`,`heart`,`rocket`,`eyes`],Qs={"thumbs-up":`👍`,"thumbs-down":`👎`,laugh:`😄`,hooray:`🎉`,confused:`😕`,heart:`❤️`,rocket:`🚀`,eyes:`👀`},$s={"thumbs-up":`thumbs up`,"thumbs-down":`thumbs down`,laugh:`laugh`,hooray:`hooray`,confused:`confused`,heart:`heart`,rocket:`rocket`,eyes:`eyes`};function ec(e){return Qs[e]}function tc(e){return $s[e]}var nc=3;function rc(e){return e.length<=1?e[0]??``:e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(`, `)}, and ${e.at(-1)}`}function ic(e,t){return t?`${e} ${e===1?`other`:`others`}`:`${e} ${e===1?`person`:`people`}`}function ac(e){let t=e.actors.length<e.count,n=(e.viewerHasReacted&&t?[`You`,...e.actors]:[...e.actors]).slice(0,Math.min(nc,e.count)),r=Math.max(0,e.count-n.length);return`${rc([...n,...r>0?[ic(r,n.length>0)]:[]])} reacted with ${tc(e.content)} emoji`}function oc(e,t){if(t.size===0)return e;let n=new Map(e.map(e=>[e.content,e]));for(let[e,r]of t){let t=n.get(e);if(t===void 0){r&&n.set(e,{content:e,count:1,actors:[],viewerHasReacted:!0});continue}if(t.viewerHasReacted===r)continue;let i=t.count+(r?1:-1);i<=0?n.delete(e):n.set(e,{...t,count:i,viewerHasReacted:r})}return Zs.flatMap(e=>n.get(e)??[])}var sc=`inline-flex h-6 shrink-0 items-center gap-1 rounded-full border px-2 text-xs outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,cc=new Map;function lc(e){return e.map(e=>`${e.content}:${e.count}:${+!!e.viewerHasReacted}`).join(` `)}function uc(e){let t=(0,Q.c)(23),{reactions:n,canReact:r,subjectId:i,environmentId:a,reference:o,onRefresh:s,className:c}=e,[l,u]=(0,Z.useState)(!1),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={signature:``,values:cc},t[0]=d):d=t[0];let[f,p]=(0,Z.useState)(d),m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m={reportFailure:!1},t[1]=m):m=t[1];let h=At(Ur.setReaction,m),g,_,v,y;if(t[2]!==r||t[3]!==c||t[4]!==a||t[5]!==s||t[6]!==f.signature||t[7]!==f.values||t[8]!==l||t[9]!==n||t[10]!==o||t[11]!==h||t[12]!==i){y=Symbol.for(`react.early_return_sentinel`);bb0:{let e=lc(n),d=f.signature===e?f.values:cc,m=oc(n,d),b=async(t,n)=>{if(p({signature:e,values:new Map([...d,[t,n]])}),(await h({environmentId:a,input:{...o,...i===void 0?{}:{subjectId:i},content:t,reacted:n}}))._tag===`Failure`){p(e=>{let n=new Map(e.values);return n.delete(t),{signature:e.signature,values:n}}),yt.add({type:`error`,title:`The reaction could not be saved`});return}s()};if(m.length===0&&!r){y=null;break bb0}t[17]===c?g=t[18]:(g=K(`flex min-w-0 max-w-full flex-wrap items-center gap-1`,c),t[17]=c,t[18]=g),_=m.map(e=>(0,$.jsxs)(X,{children:[(0,$.jsxs)(J,{render:(0,$.jsx)(`button`,{type:`button`,"aria-pressed":e.viewerHasReacted,"aria-label":`${tc(e.content)}, ${e.count}`,disabled:!r,className:K(sc,e.viewerHasReacted?`border-primary/60 bg-primary/10 text-foreground`:`border-border/70 bg-muted/40 text-muted-foreground`,r?`hover:border-primary/60`:`cursor-default`),onClick:()=>void b(e.content,!e.viewerHasReacted)}),children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:ec(e.content)}),(0,$.jsx)(`span`,{className:`tabular-nums`,children:e.count})]}),(0,$.jsx)(Y,{side:`top`,children:ac(e)})]},e.content)),v=r?(0,$.jsxs)(Yr,{open:l,onOpenChange:u,children:[(0,$.jsx)(Jr,{render:(0,$.jsx)(`button`,{type:`button`,"aria-label":`Add a reaction`,className:K(sc,`border-border/70 px-1.5 text-muted-foreground hover:border-primary/60 hover:text-foreground`)}),children:(0,$.jsx)(He,{"aria-hidden":!0,className:`size-3.5`})}),(0,$.jsx)(Kr,{align:`start`,side:`top`,padding:`compact`,children:(0,$.jsx)(`div`,{className:`flex items-center gap-0.5`,children:Zs.map(e=>{let t=m.find(t=>t.content===e)?.viewerHasReacted??!1;return(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t,"aria-label":tc(e),className:K(`flex size-7 items-center justify-center rounded-md text-base outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,t&&`bg-primary/10`),onClick:()=>{u(!1),b(e,!t)},children:(0,$.jsx)(`span`,{"aria-hidden":!0,children:ec(e)})},e)})})})]}):null}t[2]=r,t[3]=c,t[4]=a,t[5]=s,t[6]=f.signature,t[7]=f.values,t[8]=l,t[9]=n,t[10]=o,t[11]=h,t[12]=i,t[13]=g,t[14]=_,t[15]=v,t[16]=y}else g=t[13],_=t[14],v=t[15],y=t[16];if(y!==Symbol.for(`react.early_return_sentinel`))return y;let b;return t[19]!==g||t[20]!==_||t[21]!==v?(b=(0,$.jsxs)(`div`,{className:g,children:[_,v]}),t[19]=g,t[20]=_,t[21]=v,t[22]=b):b=t[22],b}var dc=`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 text-sm shadow-sm`;function fc(e){return t=>{t.key===`Escape`&&e.onCancel&&(t.preventDefault(),e.onCancel()),Sn(t,e.value,e.pending)&&(t.preventDefault(),e.onSubmit())}}function pc(e){return e===`left`?`deletions`:`additions`}function mc(e){switch(e.kind){case`added`:return{line:e.newLine,side:`right`};case`deleted`:return{line:e.oldLine,side:`left`};case`context`:return{line:e.side===`left`?e.oldLine:e.newLine,side:e.side}}}function hc(e){let t=(0,Q.c)(11),{comment:n,onRemove:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=K(dc,`border-dashed`),t[0]=i):i=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(se,{className:`size-3.5`}),o=(0,$.jsx)(`span`,{children:`Pending — sent when you submit the review`}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(x,{className:`size-3.5`}),t[3]=s):s=t[3];let c;t[4]===r?c=t[5]:(c=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[a,o,(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,className:`ml-auto`,"aria-label":`Discard this comment`,onClick:r,children:s})]}),t[4]=r,t[5]=c);let l;t[6]===n.body?l=t[7]:(l=(0,$.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap leading-relaxed`,children:n.body}),t[6]=n.body,t[7]=l);let u;return t[8]!==c||t[9]!==l?(u=(0,$.jsxs)(`div`,{className:i,contentEditable:!1,onPointerDown:gc,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function gc(e){return e.stopPropagation()}function _c({thread:e,workspaceRoot:t,canReply:n,canResolve:r,canReact:i,environmentId:a,reference:o,pending:s,fixPending:c,fixLabel:l=`Fix in a thread`,onFix:u,onReply:f,onLoadMore:p,canEditComment:m,onEditComment:h,onToggleResolved:g,onReacted:_}){let[v,y]=(0,Z.useState)(!e.isResolved),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(``),[w,T]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(!1),O=(0,Z.useRef)(!1),[k,A]=(0,Z.useState)(null),[j,M]=(0,Z.useState)(!1),N=k?.threadId===e.id?k:null,P=$r(e.comments,N?.comments??[]),F=N===null?e.nextCommentsCursor??null:N.nextCursor,I=e.commentCount??P.length,L=async(t,n)=>{if(E)return;D(!0);let r=await h(t,n);D(!1),r&&(A(r=>r?.threadId===e.id?{...r,comments:Ci(r.comments,t,n)}:r),T(null))},R=async()=>{let t=S.trim();if(!(t.length===0||s||O.current)){O.current=!0;try{await f(t)&&(A(t=>t?.threadId===e.id?{...t,nextCursor:t.nextCursor??e.nextCommentsCursor??null}:t),C(``),x(!1))}finally{O.current=!1}}},z=async()=>{if(!(F===null||j)){M(!0);try{let t=await p(F);if(t===null)return;A(n=>({threadId:e.id,comments:$r(n?.threadId===e.id?n.comments:[],t.comments),nextCursor:t.nextCursor}))}finally{M(!1)}}};return(0,$.jsxs)(`div`,{className:dc,contentEditable:!1,onPointerDown:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(ot,{className:K(`size-3.5`,e.isResolved&&`text-success-foreground`),icon:e.isResolved?lt:at}),(0,$.jsxs)(`button`,{type:`button`,className:`hover:text-foreground`,"aria-expanded":v,onClick:()=>y(e=>!e),children:[e.isResolved?`Resolved`:`Open`,` · `,I,` `,I===1?`comment`:`comments`]}),e.isOutdated?(0,$.jsx)(`span`,{children:`outdated`}):null,u?(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,className:`ml-auto`,disabled:s||c,onClick:u,children:[(0,$.jsx)(d,{className:`size-3`}),c?`Preparing...`:l]}):null,r?(0,$.jsx)(W,{size:`xs`,variant:`ghost`,className:u?void 0:`ml-auto`,disabled:s,onClick:g,children:e.isResolved?`Unresolve`:`Resolve`}):null]}),(0,$.jsx)(xa,{open:v,children:(0,$.jsxs)(ba,{children:[(0,$.jsx)(`div`,{className:`mt-2 space-y-3`,children:P.map(e=>(0,$.jsxs)(`article`,{className:`group min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(Tr,{actor:e.author}),(0,$.jsx)(`span`,{children:En(e.createdAt)}),(0,$.jsx)(uc,{className:`ml-auto justify-end`,reactions:e.reactions??[],canReact:i,subjectId:e.id,environmentId:a,reference:o,onRefresh:_})]}),w===e.id?(0,$.jsx)(Xs,{className:`mt-1`,value:e.body,cwd:t,environmentId:a,label:`Edit comment`,saving:E,onSave:t=>void L(e.id,t),onCancel:()=>T(null)}):(0,$.jsxs)(`div`,{className:`mt-1 flex items-start gap-1`,children:[(0,$.jsx)(Ys,{className:`min-w-0 flex-1 text-sm`,text:e.body,cwd:t,environmentId:a}),m(e)?(0,$.jsx)(Es,{"aria-label":`Edit comment`,onClick:()=>T(e.id)}):null]})]},e.id))}),F===null?null:(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsx)(W,{size:`xs`,variant:`ghost`,disabled:j,onClick:()=>void z(),children:j?`Loading...`:`Load more comments`})}),n?b?(0,$.jsxs)(`div`,{className:`mt-2`,children:[(0,$.jsx)(An,{autoFocus:!0,size:`sm`,value:S,placeholder:`Reply`,"aria-label":`Reply to this conversation`,onChange:e=>C(e.target.value),onKeyDown:fc({value:S,pending:s,onSubmit:()=>void R(),onCancel:()=>x(!1)})}),(0,$.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,$.jsx)(W,{size:`xs`,variant:`ghost`,onClick:()=>x(!1),children:`Cancel`}),(0,$.jsx)(W,{size:`xs`,disabled:s||S.trim().length===0,onClick:()=>void R(),children:`Reply`})]})]}):(0,$.jsx)(W,{size:`xs`,variant:`ghost`,className:`mt-2`,onClick:()=>x(!0),children:`Reply`}):null]})})]})}function vc(e){return e.repositoryIdentity?.canonicalKey?.toLowerCase()}function yc(e,t,n){let r=new Map(t.map((e,t)=>[e,t])),i=new Map;for(let t of e){let e=vc(t);if(!e)continue;let a=r.get(t.environmentId);if(a===void 0)continue;let o=i.get(e);if(o===void 0){i.set(e,t.environmentId);continue}o!==n&&(t.environmentId===n||a<(r.get(o)??2**53-1))&&i.set(e,t.environmentId)}let a=new Map;for(let t of e){if(!r.has(t.environmentId))continue;let e=vc(t);if(e&&i.get(e)!==t.environmentId)continue;let n=a.get(t.environmentId);n===void 0?a.set(t.environmentId,[t.id]):n.push(t.id)}return a}function bc(e,t,n){let r=t.find(t=>t.environmentId===e.environmentId&&t.id===e.projectId),i=r===void 0?void 0:vc(r),a=n.find(t=>t.environmentId===e.environmentId);if(r===void 0||!i||a===void 0)return[];let o=n.flatMap(n=>{if(n.environmentId===e.environmentId)return[];let r=t.find(e=>e.environmentId===n.environmentId&&vc(e)===i);return r===void 0?[]:[{environmentId:n.environmentId,projectId:r.id,workspaceRoot:r.workspaceRoot,label:n.label,...n.machine===void 0?{}:{machine:n.machine}}]});return o.length===0?[]:[{environmentId:e.environmentId,projectId:r.id,workspaceRoot:r.workspaceRoot,label:a.label,...a.machine===void 0?{}:{machine:a.machine}},...o]}function xc(e,t){let n=t.host?.toLowerCase();if(!n)return null;let r=e.filter(e=>e.host.toLowerCase()===n&&e.repository.toLowerCase()===t.repository.toLowerCase()),i=r.filter(e=>e.number===t.number),a=(i.length>0?i:r.filter(e=>e.stack?.layers.some(e=>e.number===t.number))).toSorted((e,t)=>Date.parse(t.snapshot?.syncedAt??t.linkedAt)-Date.parse(e.snapshot?.syncedAt??e.linkedAt))[0]?.stack;return!a||!a.layers.some(e=>e.number===t.number)?null:{id:a.id,number:a.number,url:a.url,base:a.base,layers:a.layers.map(e=>{let t=r.filter(t=>t.number===e.number).toSorted((e,t)=>Date.parse(t.snapshot?.syncedAt??t.linkedAt)-Date.parse(e.snapshot?.syncedAt??e.linkedAt))[0]?.snapshot;return{...e,...t?{title:t.title,isDraft:t.isDraft}:{}}})}}function Sc(e,t){let n=e.isSuccess?e.data:e.data??t;return{data:n,isFresh:e.isSuccess,notice:n===null?null:e.error?`Stack data may be stale. We couldn’t refresh it.`:!e.isSuccess||e.isPending?`Refreshing stack… Showing saved data.`:null}}function Cc(e,t){let n=(0,Q.c)(13),r=Ge(),i;n[0]!==e||n[1]!==t||n[2]!==r?(i=t===null?null:xc(r.filter(t=>t.environmentId===e).flatMap(wc),t),n[0]=e,n[1]=t,n[2]=r,n[3]=i):i=n[3];let a=i,o;n[4]!==e||n[5]!==t?(o=t===null?null:Rr({environmentId:e,input:t}),n[4]=e,n[5]=t,n[6]=o):o=n[6];let s=kt(o),c;n[7]!==s||n[8]!==a?(c=Sc(s,a),n[7]=s,n[8]=a,n[9]=c):c=n[9];let l;return n[10]!==s||n[11]!==c?(l={...s,...c},n[10]=s,n[11]=c,n[12]=l):l=n[12],l}function wc(e){return e.pullRequests??[]}function Tc(e){let t=(0,Q.c)(12),{children:n,className:r}=e,i=(0,Z.useRef)(null),[a,o]=(0,Z.useState)(null),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current;if(e)return nr(e,e=>{let t=Math.ceil(e.at(-1)?.contentRect.width??0);t>0&&o(t)})},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Z.useLayoutEffect)(s,c);let l;t[2]===r?l=t[3]:(l=K(`inline-block overflow-hidden transition-[width] duration-150 ease-out motion-reduce:transition-none`,r),t[2]=r,t[3]=l);let u;t[4]===a?u=t[5]:(u=a===null?void 0:{width:a},t[4]=a,t[5]=u);let d;t[6]===n?d=t[7]:(d=(0,$.jsx)(`span`,{ref:i,className:`block w-max whitespace-nowrap`,children:n}),t[6]=n,t[7]=d);let f;return t[8]!==l||t[9]!==u||t[10]!==d?(f=(0,$.jsx)(`span`,{"data-slot":`animated-width`,className:l,style:u,children:d}),t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}var Ec=3e5,Dc=36e4;function Oc(e){return e.visible&&e.now-e.lastRefreshedAt>=1e4}function kc(e){return e.lastRefreshedAt!==void 0&&Oc({...e,lastRefreshedAt:e.lastRefreshedAt})}function Ac(e){return e.now-e.lastInteractedAt<36e4&&Oc(e)}var jc=new Map,Mc=0,Nc=new Set,Pc=[`pointerdown`,`pointermove`,`keydown`,`wheel`],Fc=()=>{let e=Date.now(),t=e-Mc>=Dc;if(Mc=e,t)for(let e of Nc)e()};function Ic(e){if(Nc.size===0){Mc=Date.now();for(let e of Pc)document.addEventListener(e,Fc,{passive:!0})}return Nc.add(e),()=>{if(Nc.delete(e),!(Nc.size>0))for(let e of Pc)document.removeEventListener(e,Fc)}}function Lc(e,t={}){let{enabled:n=!0,key:r,intervalMs:i=Ec}=t,a=(0,Z.useRef)(e);a.current=e;let o=(0,Z.useId)(),s=r??o;(0,Z.useEffect)(()=>{if(!n)return;let e=e=>{a.current!==null&&(jc.set(s,e),a.current())},t=()=>document.visibilityState===`visible`,r=()=>{let n=Date.now();if(n-Mc>=36e4)return;let r=jc.get(s);if(r===void 0){jc.set(s,n);return}kc({visible:t(),now:n,lastRefreshedAt:r})&&e(n)},o=()=>{let n=Date.now(),r=jc.get(s)??n;Ac({visible:t(),now:n,lastRefreshedAt:r,lastInteractedAt:Mc})&&e(n)},c,l=()=>{clearInterval(c),c=t()?setInterval(o,i):void 0},u=()=>{r(),l()},d=Ic(()=>{r(),l()});return r(),l(),window.addEventListener(`focus`,r),document.addEventListener(`visibilitychange`,u),()=>{clearInterval(c),window.removeEventListener(`focus`,r),document.removeEventListener(`visibilitychange`,u),d()}},[n,s,i])}function Rc(e){let t=(0,Q.c)(22),{layer:n,compact:r}=e,i=r!==void 0&&r,a,o,s,c;t[0]!==n.isDraft||t[1]!==n.state?(o=dr({state:n.state,isDraft:n.isDraft??!1}),a=o.Icon,s=!0,c=K(`size-4 shrink-0`,o.toneClassName),t[0]=n.isDraft,t[1]=n.state,t[2]=a,t[3]=o,t[4]=s,t[5]=c):(a=t[2],o=t[3],s=t[4],c=t[5]);let l;t[6]!==a||t[7]!==s||t[8]!==c?(l=(0,$.jsx)(a,{"aria-hidden":s,className:c}),t[6]=a,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=n.title||n.headBranch,d;t[10]===u?d=t[11]:(d=(0,$.jsx)(`span`,{className:`block truncate`,children:u}),t[10]=u,t[11]=d);let f=i?null:`${n.headBranch} · `,p;t[12]!==n.number||t[13]!==o.label||t[14]!==f?(p=(0,$.jsxs)(`span`,{className:`block truncate text-xs font-normal text-muted-foreground`,children:[`#`,n.number,` · `,f,o.label]}),t[12]=n.number,t[13]=o.label,t[14]=f,t[15]=p):p=t[15];let m;t[16]!==d||t[17]!==p?(m=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,p]}),t[16]=d,t[17]=p,t[18]=m):m=t[18];let h;return t[19]!==l||t[20]!==m?(h=(0,$.jsxs)($.Fragment,{children:[l,m]}),t[19]=l,t[20]=m,t[21]=h):h=t[21],h}function zc(e){let t=(0,Q.c)(14),{stack:n,reference:r,onSelect:i,pending:a}=e,o=a!==void 0&&a,c;if(t[0]!==i||t[1]!==o||t[2]!==r||t[3]!==n.layers){let e;t[5]!==i||t[6]!==o||t[7]!==r?(e=e=>(0,$.jsxs)(s,{onClick:()=>{i?.({...r,number:e.number})},disabled:!i||o,"aria-current":e.number===r.number?`true`:void 0,children:[(0,$.jsx)(Rc,{layer:e}),e.number===r.number?(0,$.jsx)(fe,{"aria-hidden":!0,className:`size-3.5`}):null]},e.number),t[5]=i,t[6]=o,t[7]=r,t[8]=e):e=t[8],c=n.layers.toReversed().map(e),t[0]=i,t[1]=o,t[2]=r,t[3]=n.layers,t[4]=c}else c=t[4];let l;t[9]===n.base?l=t[10]:(l=(0,$.jsxs)(k,{children:[`↳ `,n.base]}),t[9]=n.base,t[10]=l);let u;return t[11]!==c||t[12]!==l?(u=(0,$.jsxs)(`div`,{className:`max-h-80 overflow-y-auto`,children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function Bc(e){let t=(0,Q.c)(8),{number:n,notice:r,stale:i}=e,a=i!==void 0&&i,o;t[0]===n?o=t[1]:(o=(0,$.jsxs)(`span`,{children:[`Stack #`,n]}),t[0]=n,t[1]=o);let s;t[2]!==r||t[3]!==a?(s=r?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{role:`status`,className:`text-xs font-normal`}),children:a?`May be stale`:`Refreshing…`}),(0,$.jsx)(Y,{children:r})]}):null,t[2]=r,t[3]=a,t[4]=s):s=t[4];let c;return t[5]!==o||t[6]!==s?(c=(0,$.jsx)(k,{children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[o,s]})}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Vc(e){let t=(0,Q.c)(107),{hostLabel:n,stack:r,reference:i,environmentId:a,canMerge:o,canRebase:c,mergeMethod:l,onSelect:u,onActed:d,notice:p,onRetry:m}=e,[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(!1),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x={reportFailure:!1},t[0]=x):x=t[0];let S=At(Ur.runAction,x),C,w,T,E,D,O,k,A,j,M,N,P;if(t[1]!==o||t[2]!==c||t[3]!==_||t[4]!==a||t[5]!==n||t[6]!==l||t[7]!==p||t[8]!==d||t[9]!==m||t[10]!==u||t[11]!==h||t[12]!==y||t[13]!==i||t[14]!==S||t[15]!==r){let e=r.layers.at(-1),x=r.layers.filter(Zc),F=x.some(Xc),L;t[28]===i?L=t[29]:(L=e=>e.number===i.number,t[28]=i,t[29]=L);let R=r.layers.findIndex(L)+1,B=r.layers.slice(0,R).filter(Yc),V=r.layers[R-1],H=B.some(Jc),U=x.flatMap(qc).length!==x.length,ee=y||V?.state!==`open`||B.some(Kc)||H||B.length===0||B.some(Gc),ne=y||U||F||x.length===0;E=async()=>{if(y||!_||(_===`merge`?!o||ee:!c||ne))return;let t=_,s=t===`merge`?V:e;if(!s?.headSha)return;let u=(t===`merge`?B:x).flatMap(Wc);b(!0),v(null);let f=yt.add({type:`loading`,title:t===`merge`?`Merging stack...`:`Rebasing stack...`}),p=await S({environmentId:a,input:{...i,number:s.number,stackNumber:r.number,expectedStackHeads:u,action:t,...t===`merge`?{mergeMethod:l}:{updateMethod:`rebase`}}});b(!1),d(),p._tag===`Failure`?yt.update(f,{type:`error`,title:t===`merge`?`Could not merge the stack`:`Could not rebase the stack`,description:String(We(p))}):yt.update(f,{type:`success`,title:t===`merge`?`Stack merge request completed`:`Stack rebased`,description:t===`merge`?`${n} merged the stack or added it to its merge queue.`:void 0})};let re=_===`merge`?B:x,G=`Stack ${r.number}, layer ${R} of ${r.layers.length}`,ie;t[30]===G?ie=t[31]:(ie=(0,$.jsx)(W,{variant:`ghost`,size:`xs`,"aria-label":G}),t[30]=G,t[31]=ie);let ae;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(Ir.stack,{"aria-hidden":!0,className:`size-3.5`}),t[32]=ae):ae=t[32];let oe;t[33]===m?oe=t[34]:(oe=m?(0,$.jsx)(f,{"aria-hidden":!0,className:`size-3 text-warning`}):null,t[33]=m,t[34]=oe);let se;t[35]!==R||t[36]!==r.layers.length||t[37]!==ie||t[38]!==oe?(se=(0,$.jsx)(J,{render:(0,$.jsxs)(Re,{render:ie,children:[ae,` `,R,`/`,r.layers.length,oe]})}),t[35]=R,t[36]=r.layers.length,t[37]=ie,t[38]=oe,t[39]=se):se=t[39];let ce=p?` · ${p}`:null,le;t[40]!==R||t[41]!==r.layers.length||t[42]!==r.number||t[43]!==ce?(le=(0,$.jsxs)(Y,{children:[`View stack #`,r.number,`, layer `,R,` of `,r.layers.length,ce]}),t[40]=R,t[41]=r.layers.length,t[42]=r.number,t[43]=ce,t[44]=le):le=t[44];let ue;t[45]!==se||t[46]!==le?(ue=(0,$.jsxs)(X,{children:[se,le]}),t[45]=se,t[46]=le,t[47]=ue):ue=t[47];let de=!!m,fe;t[48]!==p||t[49]!==r.number||t[50]!==de?(fe=(0,$.jsx)(Bc,{number:r.number,notice:p,stale:de}),t[48]=p,t[49]=r.number,t[50]=de,t[51]=fe):fe=t[51];let pe;t[52]===m?pe=t[53]:(pe=m?(0,$.jsx)(s,{onClick:m,children:`Retry stack refresh`}):null,t[52]=m,t[53]=pe);let me;t[54]===u?me=t[55]:(me=u?e=>{g(!1),u(e)}:void 0,t[54]=u,t[55]=me);let he;t[56]!==y||t[57]!==i||t[58]!==r||t[59]!==me?(he=(0,$.jsx)(zc,{stack:r,reference:i,pending:y,onSelect:me}),t[56]=y,t[57]=i,t[58]=r,t[59]=me,t[60]=he):he=t[60];let ge;t[61]!==fe||t[62]!==pe||t[63]!==he?(ge=(0,$.jsxs)(z,{children:[fe,pe,he]}),t[61]=fe,t[62]=pe,t[63]=he,t[64]=ge):ge=t[64];let _e=o||c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(te,{}),o?(0,$.jsxs)(s,{disabled:ee,onClick:()=>v(`merge`),children:[(0,$.jsx)(Ir.merged,{"aria-hidden":!0}),`Merge stack (`,B.length,`)`]}):null,c?(0,$.jsxs)(s,{disabled:ne,onClick:()=>v(`update-branch`),children:[(0,$.jsx)(Oe,{"aria-hidden":!0}),`Rebase stack`]}):null,H||B.some(Uc)?(0,$.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:`Every layer being merged must be open and ready for review.`}):null]}):null,ve;t[65]!==ge||t[66]!==_e?(ve=(0,$.jsxs)(Pe,{align:`start`,children:[ge,_e]}),t[65]=ge,t[66]=_e,t[67]=ve):ve=t[67],t[68]!==h||t[69]!==ue||t[70]!==ve?(N=(0,$.jsxs)(I,{open:h,onOpenChange:g,children:[ue,ve]}),t[68]=h,t[69]=ue,t[70]=ve,t[71]=N):N=t[71],P=o&&V?.state===`open`?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsxs)(W,{variant:`default`,size:`xs`,disabled:ee,onClick:()=>v(`merge`),children:[(0,$.jsx)(Ir.merged,{"aria-hidden":!0,className:`size-3.5`}),`Merge stack`]})})}),(0,$.jsxs)(Y,{children:[`Merge stack through #`,i.number,` into `,r.base,` (`,B.length,` `,B.length===1?`pull request`:`pull requests`,`)`]})]}):null,T=Jn,j=_!==null,t[72]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{e||v(null)},t[72]=M):M=t[72],w=qn,k=`max-w-md`;let ye=_===`merge`?`Merge ${B.length} pull requests?`:`Rebase ${x.length} pull requests?`,be;t[73]===ye?be=t[74]:(be=(0,$.jsx)(Un,{children:ye}),t[73]=ye,t[74]=be);let xe=_===`merge`?`Merge #${i.number} and its unmerged layers below into ${r.base} using ${l}. ${n} checks their rules before merging or queueing them and rebases the remaining stack after merging.`:`Rebase the remote branches from bottom to top onto ${r.base}. This rewrites branch history and may restart checks. If a layer fails, earlier updates remain.`,Se;t[75]===xe?Se=t[76]:(Se=(0,$.jsx)(Kn,{children:xe}),t[75]=xe,t[76]=Se),t[77]!==be||t[78]!==Se?(A=(0,$.jsxs)(Hn,{children:[be,Se]}),t[77]=be,t[78]=Se,t[79]=A):A=t[79],C=Gn,D=`max-h-48 space-y-1 overflow-y-auto text-sm`,O=re.map(Hc),t[1]=o,t[2]=c,t[3]=_,t[4]=a,t[5]=n,t[6]=l,t[7]=p,t[8]=d,t[9]=m,t[10]=u,t[11]=h,t[12]=y,t[13]=i,t[14]=S,t[15]=r,t[16]=C,t[17]=w,t[18]=T,t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A,t[24]=j,t[25]=M,t[26]=N,t[27]=P}else C=t[16],w=t[17],T=t[18],E=t[19],D=t[20],O=t[21],k=t[22],A=t[23],j=t[24],M=t[25],N=t[26],P=t[27];let F;t[80]!==D||t[81]!==O?(F=(0,$.jsx)(`ul`,{className:D,children:O}),t[80]=D,t[81]=O,t[82]=F):F=t[82];let L;t[83]!==C||t[84]!==F?(L=(0,$.jsx)(C,{children:F}),t[83]=C,t[84]=F,t[85]=L):L=t[85];let R;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(W,{variant:`outline`,onClick:()=>v(null),children:`Cancel`}),t[86]=R):R=t[86];let B;t[87]===E?B=t[88]:(B=()=>void E(),t[87]=E,t[88]=B);let V=_===`merge`?`Merge stack`:`Rebase stack`,H;t[89]!==B||t[90]!==V?(H=(0,$.jsxs)(Wn,{children:[R,(0,$.jsx)(W,{onClick:B,children:V})]}),t[89]=B,t[90]=V,t[91]=H):H=t[91];let U;t[92]!==w||t[93]!==L||t[94]!==H||t[95]!==k||t[96]!==A?(U=(0,$.jsxs)(w,{className:k,children:[A,L,H]}),t[92]=w,t[93]=L,t[94]=H,t[95]=k,t[96]=A,t[97]=U):U=t[97];let ee;t[98]!==T||t[99]!==U||t[100]!==j||t[101]!==M?(ee=(0,$.jsx)(T,{open:j,onOpenChange:M,children:U}),t[98]=T,t[99]=U,t[100]=j,t[101]=M,t[102]=ee):ee=t[102];let ne;return t[103]!==ee||t[104]!==N||t[105]!==P?(ne=(0,$.jsxs)($.Fragment,{children:[N,P,ee]}),t[103]=ee,t[104]=N,t[105]=P,t[106]=ne):ne=t[106],ne}function Hc(e){return(0,$.jsx)(`li`,{className:`flex items-center gap-2 rounded-md bg-muted/50 px-3 py-2`,children:(0,$.jsx)(Rc,{layer:e,compact:!0})},e.number)}function Uc(e){return e.isDraft}function Wc(e){return e.headSha?[{number:e.number,headSha:e.headSha}]:[]}function Gc(e){return e.isDraft}function Kc(e){return!e.headSha}function qc(e){return e.headSha?[{number:e.number,headSha:e.headSha}]:[]}function Jc(e){return e.state!==`open`}function Yc(e){return e.state!==`merged`}function Xc(e){return e.state!==`open`}function Zc(e){return e.state!==`merged`}var Qc={code:`Code`,tests:`Tests`,mocks:`Mocks`,generated:`Generated`,docs:`Docs`};function $c(e){let t=(0,Q.c)(18),{environmentId:n,reference:r,additions:i,deletions:a,className:o,eager:s}=e,[c,l]=(0,Z.useState)(s!==void 0&&s),u;t[0]!==n||t[1]!==r||t[2]!==c?(u=c?Ur.changeBreakdown({environmentId:n,input:r}):null,t[0]=n,t[1]=r,t[2]=c,t[3]=u):u=t[3];let d=kt(u),f=d.data;if(i===0&&a===0)return null;let p,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>l(!0),m=()=>l(!0),t[4]=p,t[5]=m):(p=t[4],m=t[5]);let h;t[6]!==i||t[7]!==o||t[8]!==a?(h=(0,$.jsx)(J,{onPointerEnter:p,onFocus:m,render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(xr,{additions:i,deletions:a,className:o})})}),t[6]=i,t[7]=o,t[8]=a,t[9]=h):h=t[9];let g;t[10]!==i||t[11]!==f||t[12]!==a||t[13]!==d.isPending?(g=f?(0,$.jsx)(Y,{side:`bottom`,children:(0,$.jsx)(tl,{breakdown:f,total:{additions:i,deletions:a}})}):d.isPending?(0,$.jsx)(Y,{side:`bottom`,children:`Loading breakdown`}):null,t[10]=i,t[11]=f,t[12]=a,t[13]=d.isPending,t[14]=g):g=t[14];let _;return t[15]!==h||t[16]!==g?(_=(0,$.jsxs)(X,{children:[h,g]}),t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function el(e){let t=(0,Q.c)(8),{environmentId:n,reference:r,className:i}=e,a;t[0]!==n||t[1]!==r?(a=Ur.changeBreakdown({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=kt(a);if(!o.data)return null;let s;t[3]===o.data?s=t[4]:(s=(0,$.jsx)(tl,{breakdown:o.data}),t[3]=o.data,t[4]=s);let c;return t[5]!==i||t[6]!==s?(c=(0,$.jsx)(`div`,{className:i,children:s}),t[5]=i,t[6]=s,t[7]=c):c=t[7],c}function tl(e){let t=(0,Q.c)(8),{breakdown:n,total:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Object.keys(Qc),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=i.map(e=>{let{additions:t,deletions:r}=n[e];return t===0&&r===0?null:(0,$.jsx)(nl,{label:Qc[e],additions:t,deletions:r},e)}),t[1]=n,t[2]=a);let o;t[3]===r?o=t[4]:(o=r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`col-span-3 border-t border-border`}),(0,$.jsx)(nl,{label:`Total`,additions:r.additions,deletions:r.deletions})]}):null,t[3]=r,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_auto_auto] justify-start gap-x-4 gap-y-1 py-0.5 font-mono tabular-nums`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function nl(e){let t=(0,Q.c)(14),{label:n,additions:r,deletions:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(`span`,{className:`font-sans`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=pr(r),t[2]=r,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,$.jsxs)(`span`,{className:`text-right text-diff-addition-foreground`,children:[`+`,o]}),t[4]=o,t[5]=s);let c;t[6]===i?c=t[7]:(c=pr(i),t[6]=i,t[7]=c);let l;t[8]===c?l=t[9]:(l=(0,$.jsxs)(`span`,{className:`text-right text-diff-deletion`,children:[`-`,c]}),t[8]=c,t[9]=l);let u;return t[10]!==a||t[11]!==s||t[12]!==l?(u=(0,$.jsxs)($.Fragment,{children:[a,s,l]}),t[10]=a,t[11]=s,t[12]=l,t[13]=u):u=t[13],u}function rl(e){let t=(0,Q.c)(3),n=Ke();if(kr(n.get(e.environmentId)?.environment.capabilities)===`unsupported`)return null;let r=`${e.environmentId}:${e.url}`,i;return t[0]!==e||t[1]!==r?(i=(0,$.jsx)(il,{...e},r),t[0]=e,t[1]=r,t[2]=i):i=t[2],i}function il({environmentId:e,reference:t,url:n,threadRef:r,display:i,onPickerOpenChange:a}){let o=et(n),c=qe(r?.environmentId===e?r:null),l=c===null?null:r,u=wr(e),d=u.isLinked(c,n),f=kt(u.mode===`multiple`&&i!==`menu-item`?Ur.linkedThreads({environmentId:e,input:o===null?t:{...t,...$e(o)}}):null),[p,m]=(0,Z.useState)(f.data);f.data!==null&&f.data!==p&&m(f.data);let[h,g]=(0,Z.useState)(!1),_=async(r,i)=>{if(!(o===null||h)){g(!0);try{await u.changeLink(A(e,r),n,!i)}catch(e){yt.add({type:`error`,title:i?`Could not unlink the pull request`:`Could not link the pull request`,description:e instanceof Error?e.message:String(e)});return}finally{g(!1)}u.mode===`multiple`&&B.refresh(Ur.linkedThreads({environmentId:e,input:{...t,...$e(o)}})),a?.(!1)}};if(o===null||!d&&!u.canLink(n))return null;let v=u.mode===`multiple`?(f.data??p)?.threads??[]:[],y=v.length>0?`Linked from ${v.length} ${v.length===1?`thread`:`threads`}`:`Linked threads`;return(0,$.jsxs)($.Fragment,{children:[i===`count`&&(v.length>0||f.error!==null)?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,"aria-label":y,onClick:()=>ga({query:n,...(f.data??p)===null?{}:{linkedThreads:{environmentId:e,threads:v}}}),children:[(0,$.jsx)(se,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{"aria-hidden":!0,children:v.length||`?`})]})}),(0,$.jsxs)(Y,{children:[y,`. Search in the command palette.`]})]}):null,i===`menu-item`?(0,$.jsxs)(s,{disabled:h,onClick:()=>{l===null?a?.(!0):_(l.threadId,d)},children:[d?(0,$.jsx)(Ir.unlink,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Ir.link,{"aria-hidden":!0,className:`size-3.5`}),d?`Unlink from this thread`:l?`Link to this thread`:`Link to thread`]}):null,i===`picker`?(0,$.jsx)(Jn,{open:!0,onOpenChange:a,children:(0,$.jsxs)(qn,{className:`max-w-md`,showCloseButton:!1,children:[(0,$.jsx)(Un,{className:`sr-only`,children:`Link pull request to a thread`}),(0,$.jsx)(al,{environmentId:e,url:n,pending:h,onSelect:e=>void _(e,!1)})]})}):null]})}function al(e){let t=(0,Q.c)(36),{environmentId:n,url:r,pending:i,onSelect:a}=e,o=Ge(),s=wr(n),c=Je(),[l,u]=(0,Z.useState)(``),d;if(t[0]!==n||t[1]!==c){let e;t[3]===n?e=t[4]:(e=e=>e.environmentId===n,t[3]=n,t[4]=e),d=new Map(c.filter(e).map(sl)),t[0]=n,t[1]=c,t[2]=d}else d=t[2];let f=d,p,m,h,g,_,v,y,b,x;if(t[5]!==n||t[6]!==s||t[7]!==a||t[8]!==i||t[9]!==f||t[10]!==l||t[11]!==o||t[12]!==r){let e=l.trim().toLocaleLowerCase(),c=o.filter(t=>t.environmentId===n&&t.archivedAt===null&&`${t.title} ${f.get(t.projectId)??``}`.toLocaleLowerCase().includes(e)).toSorted(ol);m=fa,_=`none`,v=l,y=u,b=`Choose a thread`,t[22]===i?x=t[23]:(x=(0,$.jsx)(da,{placeholder:`Search threads or projects...`,disabled:i}),t[22]=i,t[23]=x),p=ua,h=`max-h-80 overflow-y-auto`,g=c.length===0?(0,$.jsx)(`div`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:`No active threads found.`}):c.map(e=>{let t=s.isLinked(e,r);return(0,$.jsxs)(pa,{value:e.id,disabled:i||t,onClick:()=>a(e.id),children:[(0,$.jsx)(se,{"aria-hidden":!0,className:`size-4 shrink-0`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.title||`Untitled thread`}),(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:f.get(e.projectId)})]}),t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(fe,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Linked`})]}):null]},e.id)}),t[5]=n,t[6]=s,t[7]=a,t[8]=i,t[9]=f,t[10]=l,t[11]=o,t[12]=r,t[13]=p,t[14]=m,t[15]=h,t[16]=g,t[17]=_,t[18]=v,t[19]=y,t[20]=b,t[21]=x}else p=t[13],m=t[14],h=t[15],g=t[16],_=t[17],v=t[18],y=t[19],b=t[20],x=t[21];let S;t[24]!==p||t[25]!==h||t[26]!==g?(S=(0,$.jsx)(p,{className:h,children:g}),t[24]=p,t[25]=h,t[26]=g,t[27]=S):S=t[27];let C;return t[28]!==m||t[29]!==_||t[30]!==v||t[31]!==y||t[32]!==b||t[33]!==x||t[34]!==S?(C=(0,$.jsxs)(m,{mode:_,value:v,onValueChange:y,"aria-label":b,children:[x,S]}),t[28]=m,t[29]=_,t[30]=v,t[31]=y,t[32]=b,t[33]=x,t[34]=S,t[35]=C):C=t[35],C}function ol(e,t){return t.updatedAt.localeCompare(e.updatedAt)}function sl(e){return[e.id,e.title]}function cl(e){let t=(0,Q.c)(23),{title:n,author:r,updated:i,checkout:a,base:o,head:s,files:c,diffStat:l}=e,u;t[0]!==r||t[1]!==i?(u=(0,$.jsxs)(vr,{className:`min-w-0 whitespace-nowrap`,children:[r,i]}),t[0]=r,t[1]=i,t[2]=u):u=t[2];let d;t[3]!==a||t[4]!==u?(d=(0,$.jsxs)(`div`,{className:`mt-2 flex min-h-5 min-w-0 items-center gap-2 text-xs text-muted-foreground`,children:[u,a]}),t[3]=a,t[4]=u,t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(be,{"aria-label":`receives changes from`,className:`size-3.5 shrink-0 opacity-60`}),t[6]=f):f=t[6];let p;t[7]!==o||t[8]!==s?(p=(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 font-mono text-xs text-muted-foreground/70`,children:[o,f,s]}),t[7]=o,t[8]=s,t[9]=p):p=t[9];let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(Ie,{"aria-hidden":!0,className:`size-3.5`}),t[10]=m):m=t[10];let h;t[11]===c?h=t[12]:(h=(0,$.jsxs)(`span`,{className:`inline-flex min-w-16 items-center justify-end gap-1.5 tabular-nums`,children:[m,c]}),t[11]=c,t[12]=h);let g;t[13]!==l||t[14]!==h?(g=(0,$.jsxs)(`span`,{className:`ml-auto inline-flex shrink-0 items-center justify-end gap-2`,children:[h,l]}),t[13]=l,t[14]=h,t[15]=g):g=t[15];let _;t[16]!==p||t[17]!==g?(_=(0,$.jsxs)(`div`,{className:`mt-4 flex min-h-5 min-w-0 items-center gap-2 text-xs text-muted-foreground`,children:[p,g]}),t[16]=p,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==d||t[20]!==_||t[21]!==n?(v=(0,$.jsxs)(`div`,{className:`col-span-2 mt-1 min-w-0 px-4 pb-4`,children:[n,d,_]}),t[19]=d,t[20]=_,t[21]=n,t[22]=v):v=t[22],v}function ll(e){let t=(0,Q.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=K(`flex min-h-7 min-w-0 items-center sm:min-h-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,$.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ul(e){let t=(0,Q.c)(18),{tabs:n,value:r,onValueChange:i,onTabIntent:a,inert:o,children:s}=e,c;t[0]===r?c=t[1]:(c=[r],t[0]=r,t[1]=c);let l;t[2]!==i||t[3]!==n?(l=e=>{let t=n.find(t=>t.value===e[0])?.value;t&&i?.(t)},t[2]=i,t[3]=n,t[4]=l):l=t[4];let u;if(t[5]!==a||t[6]!==n){let e;t[8]===a?e=t[9]:(e=e=>(0,$.jsx)(Nn,{value:e.value,onPointerEnter:a?()=>a(e.value):void 0,onFocus:a?()=>a(e.value):void 0,children:e.label},e.value),t[8]=a,t[9]=e),u=n.map(e),t[5]=a,t[6]=n,t[7]=u}else u=t[7];let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,$.jsx)(Mn,{className:`shrink-0`,size:`segmented`,variant:`segmented`,value:c,onValueChange:l,children:u}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==s||t[15]!==o||t[16]!==d?(f=(0,$.jsxs)(`nav`,{className:`col-span-2 flex min-w-0 flex-wrap items-center gap-2 border-t border-border/60 px-4 py-2`,"aria-label":`Pull request tabs`,inert:o,children:[d,s]}),t[14]=s,t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function dl(e){let t=(0,Q.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({icon:r,label:i,className:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=K(`ml-auto flex h-4 min-w-0 flex-1 flex-wrap content-start items-center justify-end gap-x-1.5 overflow-hidden text-xs`,n),t[5]=n,t[6]=o);let s;t[7]===i?s=t[8]:(s=(0,$.jsx)(`span`,{className:`whitespace-nowrap`,children:i}),t[7]=i,t[8]=s);let c;return t[9]!==r||t[10]!==a||t[11]!==o||t[12]!==s?(c=(0,$.jsxs)(`span`,{className:o,...a,children:[r,s]}),t[9]=r,t[10]=a,t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function fl(e){let t=(0,Q.c)(33),{value:n,target:r,copyLabel:i,copiedLabel:a,className:o,tooltipSide:s,onError:c}=e,l=s===void 0?`top`:s,u;t[0]===c?u=t[1]:(u=c?{onError:c}:{},t[0]=c,t[1]=u);let d;t[2]!==u||t[3]!==r?(d={target:r,timeout:1600,...u},t[2]=u,t[3]=r,t[4]=d):d=t[4];let{copyToClipboard:f,isCopied:p}=xt(d),m;t[5]===o?m=t[6]:(m=K(`relative grid w-fit min-w-0 max-w-full shrink cursor-pointer rounded px-1 py-0.5 text-left outline-none transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent/45 hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,o),t[5]=o,t[6]=m);let h=p?a:i,g;t[7]!==f||t[8]!==n?(g=()=>f(n),t[7]=f,t[8]=n,t[9]=g):g=t[9];let _;t[10]!==m||t[11]!==h||t[12]!==g?(_=(0,$.jsx)(`button`,{type:`button`,className:m,"aria-label":h,onClick:g}),t[10]=m,t[11]=h,t[12]=g,t[13]=_):_=t[13];let v=p?`opacity-0`:`opacity-100`,y;t[14]===v?y=t[15]:(y=K(`col-start-1 row-start-1 min-w-0 truncate transition-opacity duration-150 motion-reduce:transition-none`,v),t[14]=v,t[15]=y);let b;t[16]!==y||t[17]!==n?(b=(0,$.jsx)(`code`,{className:y,children:n}),t[16]=y,t[17]=n,t[18]=b):b=t[18];let x=p?`opacity-100`:`opacity-0`,S;t[19]===x?S=t[20]:(S=K(`col-start-1 row-start-1 truncate text-center transition-opacity duration-150 motion-reduce:transition-none`,x),t[19]=x,t[20]=S);let C;t[21]===S?C=t[22]:(C=(0,$.jsx)(`span`,{"aria-hidden":`true`,className:S,children:`Copied`}),t[21]=S,t[22]=C);let w;t[23]!==b||t[24]!==C||t[25]!==_?(w=(0,$.jsxs)(J,{render:_,children:[b,C]}),t[23]=b,t[24]=C,t[25]=_,t[26]=w):w=t[26];let T=`${p?`Copied`:i}: ${n}`,E;t[27]!==T||t[28]!==l?(E=(0,$.jsx)(Y,{variant:`code`,side:l,children:T}),t[27]=T,t[28]=l,t[29]=E):E=t[29];let D;return t[30]!==w||t[31]!==E?(D=(0,$.jsxs)(X,{children:[w,E]}),t[30]=w,t[31]=E,t[32]=D):D=t[32],D}function pl(e){let t=(0,Q.c)(4),{className:n}=e,r;t[0]===n?r=t[1]:(r=K(`block h-3 rounded bg-muted-foreground/15`,n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{"aria-hidden":!0,className:r}),t[2]=r,t[3]=i),i}var ml=[`w-3/5`,`w-2/5`,`w-1/2`,`w-2/3`,`w-2/5`,`w-3/5`,`w-1/2`],hl=[`w-2/5`,`w-1/3`,`w-2/5`,`w-1/4`,`w-1/3`,`w-2/5`,`w-1/3`],gl=[{value:`summary`,label:`Summary`},{value:`timeline`,label:`Timeline`},{value:`code`,label:`Code`}];function _l(e){let t=(0,Q.c)(8),{rows:n,caption:r}=e,i=n===void 0?7:n,a=r??`Loading pull requests`,o;t[0]===r?o=t[1]:(o=r?(0,$.jsx)(`p`,{className:`px-3 pb-1 text-xs font-medium text-muted-foreground/70`,children:r}):null,t[0]=r,t[1]=o);let s;t[2]===i?s=t[3]:(s=Array.from({length:i},vl),t[2]=i,t[3]=s);let c;return t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,$.jsxs)(`div`,{role:`status`,"aria-label":a,className:`motion-safe:animate-skeleton space-y-0.5`,children:[o,s]}),t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function vl(e,t){return(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 rounded-md px-3 py-2.5`,children:[(0,$.jsx)(pl,{className:`size-4 rounded-full`}),(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,$.jsx)(pl,{className:K(`h-4`,ml[t%ml.length])}),(0,$.jsx)(pl,{className:K(`h-3.5`,hl[t%hl.length])})]}),(0,$.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[(0,$.jsx)(pl,{className:`w-12`}),(0,$.jsx)(pl,{className:`w-16`})]})]},t)}function yl(e){let t=(0,Q.c)(80),{seed:n,summary:r,actions:i,checkoutCommand:a,tabs:o,activeTab:s,number:c,onBack:l,onClose:u,onCheckoutError:d}=e,f=o===void 0?gl:o,p,m;t[0]!==n||t[1]!==r?(p=r?{...n,...r,isDraft:r.isDraft??n?.isDraft}:n,m=p?dr({state:p.state,isDraft:p.isDraft??!1}):null,t[0]=n,t[1]=r,t[2]=p,t[3]=m):(p=t[2],m=t[3]);let h=m,g;t[4]===p?g=t[5]:(g=p?.checksState===`failing`||p?.checksState===`pending`?Ar(p.checksState):null,t[4]=p,t[5]=g);let v=g,y=a??null,b=r?.changedFiles??null,x;t[6]!==s||t[7]!==f?(x=f.find(e=>e.value===s)?.value??f[0]?.value??`summary`,t[6]=s,t[7]=f,t[8]=x):x=t[8];let w=x,T=!p&&`motion-safe:animate-skeleton`,E;t[9]===T?E=t[10]:(E=K(`flex h-full min-h-0 flex-col overflow-hidden bg-background`,T),t[9]=T,t[10]=E);let D;t[11]===l?D=t[12]:(D=l?(0,$.jsx)(W,{size:`icon-micro`,variant:`ghost-muted`,className:`-ml-1.5`,onClick:l,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(be,{"aria-hidden":!0,className:`size-3.5`})}):null,t[11]=l,t[12]=D);let O;t[13]!==c||t[14]!==p||t[15]!==h?.toneClassName?(O=p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:p.repository}),(0,$.jsxs)(ae,{onClick:()=>void Ct()?.shell.openExternal(p.url),"aria-label":`Open pull request #${p.number} on host`,children:[(0,$.jsxs)(`span`,{className:h?.toneClassName,children:[`#`,p.number]}),(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-2.5`})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(pl,{className:`w-24`}),(0,$.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`#`,c??`…`]})]}),t[13]=c,t[14]=p,t[15]=h?.toneClassName,t[16]=O):O=t[16];let k;t[17]!==D||t[18]!==O?(k=(0,$.jsx)(`div`,{className:`pl-4 grid h-7 min-w-0 items-center overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-sm text-muted-foreground sm:text-xs`,children:[D,O]})}),t[17]=D,t[18]=O,t[19]=k):k=t[19];let A;t[20]===i?A=t[21]:(A=i??(0,$.jsx)(pl,{className:`h-6 w-16 rounded-md`}),t[20]=i,t[21]=A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Pull request actions loading`,children:(0,$.jsx)(ee,{"aria-hidden":!0,className:`size-4`})}),t[22]=j):j=t[22];let M;t[23]===u?M=t[24]:(M=u?(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":`Collapse pull request panel`,onClick:u,children:(0,$.jsx)(S,{"aria-hidden":!0,className:`size-3.5`})}):null,t[23]=u,t[24]=M);let N;t[25]!==A||t[26]!==M?(N=(0,$.jsxs)(`div`,{className:`mr-4 flex h-7 shrink-0 items-center justify-end gap-1`,children:[A,j,M]}),t[25]=A,t[26]=M,t[27]=N):N=t[27];let P,F,I;t[28]===p?(P=t[29],F=t[30],I=t[31]):(P=(0,$.jsx)(ll,{children:p?(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold leading-snug`,children:p.title}):(0,$.jsx)(pl,{className:`h-5 w-4/5 max-w-md`})}),F=p?(0,$.jsx)(Tr,{actor:p.author??null,tooltip:!1}):(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(pl,{className:`size-4 rounded-full`}),(0,$.jsx)(pl,{className:`h-3 w-14`})]}),I=p?(0,$.jsxs)(`span`,{children:[`updated `,En(p.updatedAt)]}):(0,$.jsx)(pl,{className:`h-3 w-16`}),t[28]=p,t[29]=P,t[30]=F,t[31]=I);let L;t[32]!==y||t[33]!==d?(L=y?(0,$.jsx)(fl,{value:y,target:`pull request checkout command`,copyLabel:`Copy checkout command`,copiedLabel:`Checkout command copied`,className:`ml-auto font-mono`,tooltipSide:`bottom`,...d?{onError:d}:{}},y):null,t[32]=y,t[33]=d,t[34]=L):L=t[34];let z,B;t[35]===p?(z=t[36],B=t[37]):(z=(0,$.jsx)(`span`,{className:`inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1`,children:p?(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(ma,{value:p.baseBranch})}):(0,$.jsx)(pl,{className:`h-3 w-12`})}),B=p?(0,$.jsx)(fl,{value:p.headBranch,target:`branch name`,copyLabel:`Copy pull request branch`,copiedLabel:`Branch name copied`,className:`min-w-0 font-mono`},p.headBranch):(0,$.jsx)(pl,{className:`h-3 w-32 flex-1`}),t[35]=p,t[36]=z,t[37]=B);let V;t[38]===b?V=t[39]:(V=b===null?(0,$.jsx)(pl,{className:`h-3 w-10`}):`${b.toLocaleString()} ${b===1?`file`:`files`}`,t[38]=b,t[39]=V);let H;t[40]===p?H=t[41]:(H=p?(0,$.jsx)(xr,{additions:p.additions??0,deletions:p.deletions??0,className:`shrink-0 font-mono text-xs`}):(0,$.jsx)(pl,{className:`h-3 w-20`}),t[40]=p,t[41]=H);let U;t[42]!==P||t[43]!==F||t[44]!==I||t[45]!==L||t[46]!==z||t[47]!==B||t[48]!==V||t[49]!==H?(U=(0,$.jsx)(`div`,{className:`col-span-2 grid grid-rows-[1fr]`,children:(0,$.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,$.jsx)(cl,{title:P,author:F,updated:I,checkout:L,base:z,head:B,files:V,diffStat:H})})}),t[42]=P,t[43]=F,t[44]=I,t[45]=L,t[46]=z,t[47]=B,t[48]=V,t[49]=H,t[50]=U):U=t[50];let te;t[51]===v?te=t[52]:(te=v?(0,$.jsx)(dl,{className:v.toneClassName,icon:(0,$.jsx)(v.Icon,{"aria-hidden":!0,className:`size-3.5`}),label:v.label}):(0,$.jsx)(dl,{icon:(0,$.jsx)(pl,{className:`my-px size-3.5 rounded-full`}),label:(0,$.jsx)(pl,{className:`w-28`})}),t[51]=v,t[52]=te);let ne;t[53]!==w||t[54]!==te||t[55]!==f?(ne=(0,$.jsx)(ul,{tabs:f,value:w,inert:!0,children:te}),t[53]=w,t[54]=te,t[55]=f,t[56]=ne):ne=t[56];let re;t[57]!==N||t[58]!==U||t[59]!==ne||t[60]!==k?(re=(0,$.jsxs)(`div`,{className:`@container/pr-header grid min-w-0 shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 border-b border-border/60`,children:[k,N,U,ne]}),t[57]=N,t[58]=U,t[59]=ne,t[60]=k,t[61]=re):re=t[61];let G;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(R,{"aria-hidden":!0,className:`size-3.5`}),`Reviewers`]}),t[62]=G):G=t[62];let ie;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(pl,{className:`h-3 w-10`}),t[63]=ie):ie=t[63];let oe;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsxs)(`div`,{className:`grid min-h-7 min-w-0 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 text-xs sm:min-h-6`,children:[G,(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-foreground`,children:[ie,(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Reviewers loading`,children:(0,$.jsx)(_,{"aria-hidden":!0,className:`size-3.5`})})]})]}),t[64]=oe):oe=t[64];let se;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(pe,{"aria-hidden":!0,className:`size-3.5`}),`Labels`]}),t[65]=se):se=t[65];let ce;t[66]===n?ce=t[67]:(ce=n?.labels?n.labels.length>0?n.labels.map(bl):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(pl,{className:`h-4.5 w-24`}),(0,$.jsx)(pl,{className:`h-4.5 w-20`})]}),t[66]=n,t[67]=ce);let le;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Labels loading`,children:(0,$.jsx)(pe,{"aria-hidden":!0,className:`size-3.5`})}),t[68]=le):le=t[68];let ue;t[69]===ce?ue=t[70]:(ue=(0,$.jsx)(`section`,{className:`px-4 pt-2.5 pb-1`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[oe,(0,$.jsxs)(`div`,{className:`grid min-h-7 min-w-0 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 text-xs sm:min-h-6`,children:[se,(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1 text-foreground`,children:[ce,le]})]})]})}),t[69]=ce,t[70]=ue);let de;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(`div`,{className:`sticky top-0 z-10 flex w-full items-center bg-background pr-4`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 px-4 py-3 text-left text-xs font-medium text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Description`}),(0,$.jsx)(C,{"aria-hidden":!0,className:`size-3.5 rotate-90 text-muted-foreground/60`})]})}),t[71]=de):de=t[71];let fe;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,$.jsx)(pl,{className:`h-5 w-40`}),t[72]=fe):fe=t[72];let me;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsxs)(`section`,{children:[de,(0,$.jsxs)(`div`,{className:`space-y-3 px-4 pb-4`,children:[fe,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(pl,{className:`h-4 w-full`}),(0,$.jsx)(pl,{className:`h-4 w-11/12`}),(0,$.jsx)(pl,{className:`h-4 w-4/5`}),(0,$.jsx)(pl,{className:`h-4 w-2/3`})]})]})]}),t[73]=me):me=t[73];let he;t[74]===ue?he=t[75]:(he=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:[ue,me]}),t[74]=ue,t[75]=he);let ge;return t[76]!==re||t[77]!==he||t[78]!==E?(ge=(0,$.jsxs)(`div`,{role:`status`,"aria-label":`Loading pull request`,className:E,children:[re,he]}),t[76]=re,t[77]=he,t[78]=E,t[79]=ge):ge=t[79],ge}function bl(e){return(0,$.jsx)(Or,{label:e,size:`default`,className:`max-w-48`},e.name)}function xl(e){let t=(0,Q.c)(2),{rows:n}=e,r=n===void 0?4:n,i;return t[0]===r?i=t[1]:(i=(0,$.jsx)(`div`,{role:`status`,"aria-label":`Loading people`,className:`motion-safe:animate-skeleton space-y-1 p-1`,children:Array.from({length:r},Sl)}),t[0]=r,t[1]=i),i}function Sl(e,t){return(0,$.jsxs)(`div`,{className:`flex h-7 items-center gap-2 rounded-md px-2`,children:[(0,$.jsx)(pl,{className:`size-4 rounded-full`}),(0,$.jsx)(pl,{className:hl[t%hl.length]})]},t)}function Cl(e){let t=(0,Q.c)(2),{rows:n}=e,r=n===void 0?6:n,i;return t[0]===r?i=t[1]:(i=(0,$.jsx)(`div`,{role:`status`,"aria-label":`Loading timeline`,className:`motion-safe:animate-skeleton px-4 py-5`,children:(0,$.jsx)(`div`,{className:`relative ml-2 border-l border-border/70 pl-5`,children:Array.from({length:r},wl)})}),t[0]=r,t[1]=i),i}function wl(e,t){return(0,$.jsxs)(`div`,{className:`relative pb-5`,children:[(0,$.jsx)(pl,{className:`absolute -left-[1.55rem] top-1 size-2 rounded-full`}),(0,$.jsx)(pl,{className:K(`h-3.5`,ml[t%ml.length])}),(0,$.jsx)(pl,{className:`mt-1.5 w-16`})]},t)}function Tl(e){let t=(0,Q.c)(2),{rows:n}=e,r=n===void 0?3:n,i;return t[0]===r?i=t[1]:(i=(0,$.jsx)(`div`,{role:`status`,"aria-label":`Loading pull request conversation`,className:`motion-safe:animate-skeleton space-y-4 py-2`,children:Array.from({length:r},El)}),t[0]=r,t[1]=i),i}function El(e,t){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(pl,{className:`size-5 shrink-0 rounded-full`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(pl,{className:hl[t%hl.length]}),(0,$.jsx)(pl,{className:`w-full`}),(0,$.jsx)(pl,{className:`w-3/4`})]})]},t)}function Dl(e){let t=(0,Q.c)(12),{error:n,onRetry:r,compact:i}=e,a=i!==void 0&&i?`py-3`:`min-h-48 px-4 py-10`,o;t[0]===a?o=t[1]:(o=K(`flex flex-col items-center justify-center gap-2 text-center`,a),t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load pull request activity`}),t[2]=s):s=t[2];let c;t[3]===n?c=t[4]:(c=(0,$.jsx)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:n}),t[3]=n,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(_a,{"aria-hidden":!0,size:`sm`}),t[5]=l):l=t[5];let u;t[6]===r?u=t[7]:(u=(0,$.jsxs)(W,{size:`sm`,variant:`outline`,onClick:r,children:[l,`Retry`]}),t[6]=r,t[7]=u);let d;return t[8]!==o||t[9]!==c||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:o,children:[s,c,u]}),t[8]=o,t[9]=c,t[10]=u,t[11]=d):d=t[11],d}function Ol(e){let t=(0,Q.c)(15),{title:n,error:r,onRetry:i,refreshing:a,gitHubUrl:o}=e,s=n===void 0?`Could not load pull requests`:n,c=a!==void 0&&a,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(Xn,{variant:`icon`,children:(0,$.jsx)(Ir.pullRequest,{})}),t[0]=l):l=t[0];let u;t[1]===s?u=t[2]:(u=(0,$.jsx)(Qn,{children:s}),t[1]=s,t[2]=u);let d;t[3]===r?d=t[4]:(d=(0,$.jsx)($n,{children:r}),t[3]=r,t[4]=d);let f;t[5]!==u||t[6]!==d?(f=(0,$.jsxs)(Zn,{children:[u,d]}),t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;t[8]!==o||t[9]!==i||t[10]!==c?(p=i||o?(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[i?(0,$.jsxs)(W,{size:`sm`,variant:`outline`,onClick:i,disabled:c,"aria-busy":c,children:[(0,$.jsx)(_a,{size:`sm`,refreshing:c}),`Retry`]}):null,o?(0,$.jsxs)(W,{size:`sm`,variant:`outline`,render:(0,$.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`}),children:[(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-3.5`}),`Open on GitHub`]}):null]}):null,t[8]=o,t[9]=i,t[10]=c,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,$.jsxs)(er,{className:`scrollbar-gutter-both min-h-0 justify-center-safe overflow-y-auto [&>*]:shrink-0`,children:[l,f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m}var kl=e=>e===Fr?`Open on host`:`Open on ${e.label}`;function Al(e){return[{id:`copy-link`,label:`Copy link`,icon:`copy`},{id:`open-external`,label:e}]}async function jl({url:e,openLabel:t,position:n}){let r=Ct();if(!r)return;let i=null;try{i=await r.contextMenu.show(Al(t),n)}catch{return}try{i===`copy-link`?await bt(e,`link`):i===`open-external`&&await r.shell.openExternal(e)}catch{yt.add({type:`error`,title:i===`copy-link`?`Could not copy the link`:`Could not open the link`})}}function Ml(e){let t=(0,Q.c)(42),{environmentId:n,reference:r,detail:i,actionPending:a,textareaRef:o,onCommentAction:s,onCommented:c,onClose:l}=e,[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={reportFailure:!1},t[0]=m):m=t[0];let h=At(Ur.comment,m),g=i.state===`open`&&i.capabilities.actions.includes(`close`)&&i.viewerPermissions.actions.includes(`close`)?`close`:i.state===`closed`&&i.capabilities.actions.includes(`reopen`)&&i.viewerPermissions.actions.includes(`reopen`)?`reopen`:null,_;t[1]!==a||t[2]!==u||t[3]!==n||t[4]!==l||t[5]!==s||t[6]!==c||t[7]!==h||t[8]!==r||t[9]!==f?(_=async e=>{let t=u.trim();if(!(t.length===0||f!==null||a)){if(p(e),e!==`comment`){(await s(t,e)).commentPosted&&(d(``),l()),p(null);return}if((await h({environmentId:n,input:{...r,body:t}}))._tag===`Failure`){p(null),yt.add({type:`error`,title:`Could not post the comment`});return}d(``),p(null),l(),c()}},t[1]=a,t[2]=u,t[3]=n,t[4]=l,t[5]=s,t[6]=c,t[7]=h,t[8]=r,t[9]=f,t[10]=_):_=t[10];let v=_,y=f!==null||a,b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>d(e.target.value),t[11]=b):b=t[11];let x;t[12]===v?x=t[13]:(x=e=>{e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey&&(e.preventDefault(),e.stopPropagation(),e.repeat||v(`comment`))},t[12]=v,t[13]=x);let S;t[14]!==u||t[15]!==y||t[16]!==x||t[17]!==o?(S=(0,$.jsx)(An,{ref:o,disabled:y,value:u,rows:3,placeholder:`Leave a comment`,"aria-label":`Comment on this pull request`,onChange:b,onKeyDown:x}),t[14]=u,t[15]=y,t[16]=x,t[17]=o,t[18]=S):S=t[18];let C;t[19]!==a||t[20]!==u||t[21]!==g||t[22]!==v||t[23]!==f?(C=g===null?null:(0,$.jsxs)(W,{size:`xs`,variant:g===`close`?`destructive-outline`:`outline`,disabled:u.trim().length===0||f!==null||a,onClick:()=>void v(g),children:[g===`close`?(0,$.jsx)(Ir.closed,{className:`size-3.5`}):(0,$.jsx)(Ir.reopen,{className:`size-3.5`}),f===g?g===`close`?`Closing...`:`Reopening...`:g===`close`?`Close with comment`:`Reopen with comment`]}),t[19]=a,t[20]=u,t[21]=g,t[22]=v,t[23]=f,t[24]=C):C=t[24];let w;t[25]!==a||t[26]!==u||t[27]!==f?(w=u.trim().length===0||f!==null||a,t[25]=a,t[26]=u,t[27]=f,t[28]=w):w=t[28];let T;t[29]===v?T=t[30]:(T=()=>void v(`comment`),t[29]=v,t[30]=T);let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(Le,{className:`size-3.5`}),t[31]=E):E=t[31];let D=f===`comment`?`Posting...`:`Comment`,O;t[32]!==D||t[33]!==w||t[34]!==T?(O=(0,$.jsxs)(W,{size:`xs`,variant:`outline`,disabled:w,onClick:T,children:[E,D]}),t[32]=D,t[33]=w,t[34]=T,t[35]=O):O=t[35];let k;t[36]!==O||t[37]!==C?(k=(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[C,O]}),t[36]=O,t[37]=C,t[38]=k):k=t[38];let A;return t[39]!==k||t[40]!==S?(A=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[S,k]}),t[39]=k,t[40]=S,t[41]=A):A=t[41],A}var Nl=[{value:`comment`,label:`Comment`,sent:`Review submitted`,icon:(0,$.jsx)(se,{className:`size-3`})},{value:`approve`,label:`Approve`,sent:`Pull request approved`,icon:(0,$.jsx)(fe,{className:`size-3`})},{value:`request-changes`,label:`Request changes`,sent:`Changes requested`,icon:(0,$.jsx)(_e,{className:`size-3`})}];function Pl(e){let t=(0,Q.c)(70),{environmentId:n,reference:r,verdicts:i,requestChangesSummaryRequired:a,textareaRef:o,pending:s,onPendingChange:c,onSubmitted:l}=e,[u,d]=(0,Z.useState)(`comment`),f=zi(r),p;t[0]===r?p=t[1]:(p=Ri(r),t[0]=r,t[1]=p);let m=p,h;t[2]===m?h=t[3]:(h=e=>e.summaries[m]??``,t[2]=m,t[3]=h);let g=Li(h),_=Li(zl),v=Li(Rl),y=Li(Ll),b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},t[4]=b):b=t[4];let x=At(Ur.submitReview,b),S,C,w,T,E,D,O,k;if(t[5]!==g||t[6]!==y||t[7]!==f||t[8]!==n||t[9]!==c||t[10]!==l||t[11]!==s||t[12]!==r||t[13]!==_||t[14]!==a||t[15]!==u||t[16]!==m||t[17]!==v||t[18]!==x||t[19]!==o||t[20]!==i){let e;t[29]===i?e=t[30]:(e=e=>i.includes(e.value),t[29]=i,t[30]=e);let p=Nl.filter(e);C=p.find(e=>e.value===u)??p[0];let h;t[31]!==g||t[32]!==y||t[33]!==f||t[34]!==n||t[35]!==c||t[36]!==l||t[37]!==s||t[38]!==r||t[39]!==_||t[40]!==m||t[41]!==x?(h=async e=>{if(s)return;let t=g,i=f;c(!0);let a=await x({environmentId:n,input:{...r,verdict:e.value,body:t,comments:i}});if(c(!1),a._tag===`Failure`){yt.add({type:`error`,title:`The review could not be submitted`});return}_(m,i.map(Il)),y(m,t),yt.add({type:`success`,title:e.sent}),l()},t[31]=g,t[32]=y,t[33]=f,t[34]=n,t[35]=c,t[36]=l,t[37]=s,t[38]=r,t[39]=_,t[40]=m,t[41]=x,t[42]=h):h=t[42],w=h;let b;t[43]!==f||t[44]!==a?(b=(e,t)=>e===`request-changes`&&a?t.trim().length>0:e===`approve`||t.trim().length>0||f.length>0,t[43]=f,t[44]=a,t[45]=b):b=t[45];let A=b,j=C===void 0||A(C.value,``)?`Summarize your review (optional)`:C.value===`request-changes`&&a?`Summarize your review (required to request changes)`:`Summarize your review or add line comments`,M;t[46]!==m||t[47]!==v?(M=e=>v(m,e.target.value),t[46]=m,t[47]=v,t[48]=M):M=t[48],t[49]!==g||t[50]!==j||t[51]!==M||t[52]!==o?(k=(0,$.jsx)(An,{ref:o,rows:3,value:g,placeholder:j,"aria-label":`Review summary`,onChange:M}),t[49]=g,t[50]=j,t[51]=M,t[52]=o,t[53]=k):k=t[53],D=`mt-2 flex justify-end gap-2`,O=p.length>1?(0,$.jsxs)(_t,{value:C?.value??null,disabled:s,onValueChange:e=>{e!==null&&d(e)},children:[(0,$.jsx)(gt,{size:`xs`,className:`mr-auto w-auto min-w-0`,"aria-label":`Review verdict`,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[C?.icon,C?.label]})}),(0,$.jsx)(ht,{side:`top`,alignItemWithTrigger:!1,children:p.map(Fl)})]}):null,S=W,T=`xs`,E=s||C===void 0||!A(C.value,g),t[5]=g,t[6]=y,t[7]=f,t[8]=n,t[9]=c,t[10]=l,t[11]=s,t[12]=r,t[13]=_,t[14]=a,t[15]=u,t[16]=m,t[17]=v,t[18]=x,t[19]=o,t[20]=i,t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k}else S=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28];let A;t[54]!==C||t[55]!==w?(A=()=>{C!==void 0&&w(C)},t[54]=C,t[55]=w,t[56]=A):A=t[56];let j=s?`Submitting...`:`Submit review`,M;t[57]!==S||t[58]!==j||t[59]!==T||t[60]!==E||t[61]!==A?(M=(0,$.jsx)(S,{size:T,disabled:E,onClick:A,children:j}),t[57]=S,t[58]=j,t[59]=T,t[60]=E,t[61]=A,t[62]=M):M=t[62];let N;t[63]!==M||t[64]!==D||t[65]!==O?(N=(0,$.jsxs)(`div`,{className:D,children:[O,M]}),t[63]=M,t[64]=D,t[65]=O,t[66]=N):N=t[66];let P;return t[67]!==N||t[68]!==k?(P=(0,$.jsxs)($.Fragment,{children:[k,N]}),t[67]=N,t[68]=k,t[69]=P):P=t[69],P}function Fl(e){return(0,$.jsx)(mt,{value:e.value,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.icon,e.label]})},e.value)}function Il(e){return e.id}function Ll(e){return e.clearSummary}function Rl(e){return e.setSummary}function zl(e){return e.removeComments}function Bl(e){let t=(0,Q.c)(63),{environmentId:n,reference:r,detail:i,actionPending:a,onCommentAction:o,onCommented:s,onReviewSubmitted:c,openReviewRequest:l}=e,[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(`comment`),g=(0,Z.useRef)(null),_=(0,Z.useRef)(null),v=zi(r),y=Li(Vl),b;t[0]===r?b=t[1]:(b=Ri(r),t[0]=r,t[1]=b);let S=b,C;t[2]===S?C=t[3]:(C=e=>(e.summaries[S]??``).trim().length>0,t[2]=S,t[3]=C);let w=Li(C),T=v.length>0||w,[E,D]=(0,Z.useState)(l);l!==E&&(D(l),h(`review`),d(!0));let O=i.capabilities.comment&&i.viewerPermissions.comment,k;if(t[4]!==i.capabilities.review.verdicts||t[5]!==i.viewerPermissions){let e;t[7]===i.viewerPermissions?e=t[8]:(e=e=>i.viewerPermissions.verdicts.includes(e),t[7]=i.viewerPermissions,t[8]=e),k=i.capabilities.review.verdicts.filter(e),t[4]=i.capabilities.review.verdicts,t[5]=i.viewerPermissions,t[6]=k}else k=t[6];let A=k;if(!O&&A.length===0)return null;let j=O?A.length===0?`comment`:m:`review`,M;t[9]===T?M=t[10]:(M=e=>{e&&h(T?`review`:`comment`),d(e)},t[9]=T,t[10]=M);let N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(W,{size:`icon`,variant:`glass`}),t[11]=N):N=t[11];let P=v.length>0?`Review pull request, ${v.length} ${v.length===1?`comment`:`comments`} pending`:T||!O?`Review pull request`:`Comment on pull request`,F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(se,{className:`size-4`}),t[12]=F):F=t[12];let I;t[13]===v.length?I=t[14]:(I=v.length>0?(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-info px-1 text-3xs font-semibold tabular-nums text-white`,children:v.length}):null,t[13]=v.length,t[14]=I);let L;t[15]!==P||t[16]!==I?(L=(0,$.jsxs)(Jr,{render:N,"aria-label":P,children:[F,I]}),t[15]=P,t[16]=I,t[17]=L):L=t[17];let R=j===`review`?_:g,z;t[18]!==O||t[19]!==j||t[20]!==v.length||t[21]!==A.length?(z=O&&A.length>0?(0,$.jsxs)(Mn,{"aria-label":`Composer mode`,variant:`segmented`,value:[j],onValueChange:e=>{let t=e[0];(t===`comment`||t===`review`)&&h(t)},children:[(0,$.jsx)(Nn,{value:`comment`,children:`Comment`}),(0,$.jsx)(Nn,{value:`review`,children:v.length>0?`Review (${v.length})`:`Review`})]}):(0,$.jsx)(Gr,{children:j===`review`?`Review pull request`:`Comment on pull request`}),t[18]=O,t[19]=j,t[20]=v.length,t[21]=A.length,t[22]=z):z=t[22];let B;t[23]!==y||t[24]!==j||t[25]!==v.length||t[26]!==S||t[27]!==f?(B=j===`review`&&v.length>0?(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":`Discard pending line comments`,title:`Discard pending line comments`,disabled:f,onClick:()=>y(S),children:(0,$.jsx)(x,{className:`size-3.5`})}):null,t[23]=y,t[24]=j,t[25]=v.length,t[26]=S,t[27]=f,t[28]=B):B=t[28];let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`}),t[29]=V):V=t[29];let H;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(qr,{render:V,"aria-label":`Close composer`,children:(0,$.jsx)(De,{className:`size-3.5`})}),t[30]=H):H=t[30];let U;t[31]===B?U=t[32]:(U=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[B,H]}),t[31]=B,t[32]=U);let ee;t[33]!==z||t[34]!==U?(ee=(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[z,U]}),t[33]=z,t[34]=U,t[35]=ee):ee=t[35];let te;t[36]!==i.provider||t[37]!==n||t[38]!==j||t[39]!==c||t[40]!==r||t[41]!==f||t[42]!==A?(te=A.length>0?(0,$.jsx)(`div`,{hidden:j!==`review`,children:(0,$.jsx)(Pl,{environmentId:n,reference:r,verdicts:A,requestChangesSummaryRequired:Pr.get(i.provider).reviewSummaryRequired(`request-changes`),textareaRef:_,pending:f,onPendingChange:p,onSubmitted:()=>{d(!1),c()}})}):null,t[36]=i.provider,t[37]=n,t[38]=j,t[39]=c,t[40]=r,t[41]=f,t[42]=A,t[43]=te):te=t[43];let ne;t[44]!==a||t[45]!==O||t[46]!==i||t[47]!==n||t[48]!==j||t[49]!==o||t[50]!==s||t[51]!==r?(ne=O?(0,$.jsx)(`div`,{hidden:j!==`comment`,children:(0,$.jsx)(Ml,{environmentId:n,reference:r,detail:i,actionPending:a,textareaRef:g,onCommentAction:o,onCommented:s,onClose:()=>d(!1)})}):null,t[44]=a,t[45]=O,t[46]=i,t[47]=n,t[48]=j,t[49]=o,t[50]=s,t[51]=r,t[52]=ne):ne=t[52];let re;t[53]!==R||t[54]!==ee||t[55]!==te||t[56]!==ne?(re=(0,$.jsxs)(Kr,{keepMounted:!0,side:`top`,align:`end`,sideOffset:8,width:`lg`,initialFocus:R,"aria-label":`Pull request composer`,children:[ee,te,ne]}),t[53]=R,t[54]=ee,t[55]=te,t[56]=ne,t[57]=re):re=t[57];let G;return t[58]!==u||t[59]!==re||t[60]!==M||t[61]!==L?(G=(0,$.jsxs)(Yr,{open:u,onOpenChange:M,children:[L,re]}),t[58]=u,t[59]=re,t[60]=M,t[61]=L,t[62]=G):G=t[62],G}function Vl(e){return e.clear}function Hl(e){let t=(0,Q.c)(53),{icon:n,label:r,allowed:i,disabledReason:a,open:o,onOpenChange:s,query:c,onQueryChange:l,searchLabel:u,isPending:d,error:f,candidates:p,emptyLabel:m,noMatchLabel:h,errorLabel:g,truncated:_,truncatedLabel:v,candidateKey:y,disabled:b,onSelect:x,children:S}=e;if(!i){let e;t[0]!==n||t[1]!==r?(e=(0,$.jsx)(J,{render:(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":r,children:n})}),t[0]=n,t[1]=r,t[2]=e):e=t[2];let i;t[3]===a?i=t[4]:(i=(0,$.jsx)(Y,{side:`bottom`,children:a}),t[3]=a,t[4]=i);let o;return t[5]!==e||t[6]!==i?(o=(0,$.jsxs)(X,{children:[e,i]}),t[5]=e,t[6]=i,t[7]=o):o=t[7],o}let C;t[8]!==y||t[9]!==p?(C=p.map(y),t[8]=y,t[9]=p,t[10]=C):C=t[10];let w=C,T;t[11]!==y||t[12]!==p||t[13]!==x?(T=e=>{let t=p.find(t=>y(t)===e);t&&x(t)},t[11]=y,t[12]=p,t[13]=x,t[14]=T):T=t[14];let E;t[15]===s?E=t[16]:(E=(e,t)=>{if(!e&&t.reason===`item-press`){t.cancel();return}s(e)},t[15]=s,t[16]=E);let D;t[17]!==n||t[18]!==r?(D=(0,$.jsx)(Fn,{render:(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":r,children:n})}),t[17]=n,t[18]=r,t[19]=D):D=t[19];let O;t[20]===l?O=t[21]:(O=e=>l(e.target.value),t[20]=l,t[21]=O);let k;t[22]!==c||t[23]!==u||t[24]!==O?(k=(0,$.jsx)(Rn,{"aria-label":u,placeholder:u,value:c,onChange:O}),t[22]=c,t[23]=u,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==p||t[27]!==S||t[28]!==b||t[29]!==m||t[30]!==f||t[31]!==g||t[32]!==d||t[33]!==w||t[34]!==h||t[35]!==c?(A=d?(0,$.jsx)(xl,{rows:4}):f===null?p.length===0?(0,$.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:c.length>0?h:m}):p.map((e,t)=>(0,$.jsx)(Ln,{hideIndicator:!0,index:t,value:w[t],disabled:b,children:S(e)},w[t])):(0,$.jsxs)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:[g,` `,f]}),t[26]=p,t[27]=S,t[28]=b,t[29]=m,t[30]=f,t[31]=g,t[32]=d,t[33]=w,t[34]=h,t[35]=c,t[36]=A):A=t[36];let j;t[37]!==_||t[38]!==v?(j=_?(0,$.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:v}):null,t[37]=_,t[38]=v,t[39]=j):j=t[39];let M;t[40]!==A||t[41]!==j?(M=(0,$.jsxs)(Pn,{className:`max-h-72`,children:[A,j]}),t[40]=A,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==k||t[44]!==M?(N=(0,$.jsxs)(In,{align:`start`,side:`bottom`,className:`w-72`,children:[k,M]}),t[43]=k,t[44]=M,t[45]=N):N=t[45];let P;return t[46]!==w||t[47]!==o||t[48]!==N||t[49]!==T||t[50]!==E||t[51]!==D?(P=(0,$.jsxs)(zn,{items:w,filteredItems:w,filter:null,autoHighlight:!0,value:null,onValueChange:T,open:o,onOpenChange:E,children:[D,N]}),t[46]=w,t[47]=o,t[48]=N,t[49]=T,t[50]=E,t[51]=D,t[52]=P):P=t[52],P}function Ul(e,t){if(t.length===0)return!0;let n=t.toLowerCase();return e.name.toLowerCase().includes(n)||(e.description??``).toLowerCase().includes(n)}function Wl(e){let t=(0,Q.c)(30),{environmentId:n,reference:r,allowed:i}=e,[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),d;t[0]!==n||t[1]!==a||t[2]!==r?(d=a?Ur.labelCandidates({environmentId:n,input:r}):null,t[0]=n,t[1]=a,t[2]=r,t[3]=d):d=t[3];let f=kt(d),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={reportFailure:!1},t[4]=p):p=t[4];let m=At(Ur.setLabels,p),h;t[5]===f.data?.candidates?h=t[6]:(h=f.data?.candidates??[],t[5]=f.data?.candidates,t[6]=h);let g;if(t[7]!==s||t[8]!==h){let e;t[10]===s?e=t[11]:(e=e=>Ul(e,s),t[10]=s,t[11]=e),g=h.filter(e),t[7]=s,t[8]=h,t[9]=g}else g=t[9];let _=g,v;t[12]!==n||t[13]!==l||t[14]!==r||t[15]!==m?(v=async e=>{if(l!==null)return;u(e.name);let t=await m({environmentId:n,input:{...r,labels:[e.name],applied:!e.isApplied}});if(u(null),t._tag===`Failure`){yt.add({type:`error`,title:e.isApplied?`Could not take ${e.name} off`:`Could not put ${e.name} on`,description:di(We(t),`The host refused it. Check that you have triage access on this repository.`)});return}},t[12]=n,t[13]=l,t[14]=r,t[15]=m,t[16]=v):v=t[16];let y=v,b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(pe,{className:`size-3.5`}),t[17]=b):b=t[17];let x=f.isPending&&f.data===null,S=f.data===null?f.error:null,C=f.data?.truncated===!0,w=l!==null,T;t[18]===y?T=t[19]:(T=e=>void y(e),t[18]=y,t[19]=T);let E;return t[20]!==i||t[21]!==_||t[22]!==a||t[23]!==s||t[24]!==w||t[25]!==T||t[26]!==x||t[27]!==S||t[28]!==C?(E=(0,$.jsx)(Hl,{icon:b,label:`Change labels`,allowed:i,disabledReason:`Changing labels needs triage access on this repository`,open:a,onOpenChange:o,query:s,onQueryChange:c,searchLabel:`Search labels`,isPending:x,error:S,candidates:_,emptyLabel:`This repository has no labels.`,noMatchLabel:`No label matches that.`,errorLabel:`The labels could not be read.`,truncated:C,truncatedLabel:`This repository has more labels than are listed here. Apply the rest on the host.`,candidateKey:Kl,disabled:w,onSelect:T,children:Gl}),t[20]=i,t[21]=_,t[22]=a,t[23]=s,t[24]=w,t[25]=T,t[26]=x,t[27]=S,t[28]=C,t[29]=E):E=t[29],E}function Gl(e){let t=Lr(e.color);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full bg-muted-foreground`,...t?{style:{backgroundColor:t}}:{}}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.name,e.description?(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.description]}):null]}),e.isApplied?(0,$.jsx)(fe,{"aria-label":`Applied`,className:`size-3.5 shrink-0`}):null]})}function Kl(e){return e.name}function ql(e,t){if(t.length===0)return!0;let n=t.toLowerCase();return e.login.toLowerCase().includes(n)||(e.name??``).toLowerCase().includes(n)}function Jl(e){let t=(0,Q.c)(30),{environmentId:n,reference:r,allowed:i}=e,[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),d;t[0]!==n||t[1]!==a||t[2]!==r?(d=a?Ur.reviewerCandidates({environmentId:n,input:r}):null,t[0]=n,t[1]=a,t[2]=r,t[3]=d):d=t[3];let f=kt(d),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={reportFailure:!1},t[4]=p):p=t[4];let m=At(Ur.requestReviewers,p),h;t[5]===f.data?.candidates?h=t[6]:(h=f.data?.candidates??[],t[5]=f.data?.candidates,t[6]=h);let g;if(t[7]!==s||t[8]!==h){let e;t[10]===s?e=t[11]:(e=e=>ql(e,s),t[10]=s,t[11]=e),g=h.filter(e),t[7]=s,t[8]=h,t[9]=g}else g=t[9];let v=g,y;t[12]!==n||t[13]!==l||t[14]!==r||t[15]!==m?(y=async e=>{if(l!==null)return;u(e.id);let t=await m({environmentId:n,input:{...r,reviewers:[{id:e.id,kind:e.kind}],requested:!e.isRequested}});if(u(null),t._tag===`Failure`){yt.add({type:`error`,title:e.isRequested?`Could not take back the review request to ${e.login}`:`Could not ask ${e.login} for a review`,description:di(We(t),`The host refused it. Check that you have write access on this repository, and that they still have access to it.`)});return}yt.add({type:`success`,title:e.isRequested?`Review request to ${e.login} taken back`:`Review requested from ${e.login}`})},t[12]=n,t[13]=l,t[14]=r,t[15]=m,t[16]=y):y=t[16];let b=y,x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(_,{className:`size-3.5`}),t[17]=x):x=t[17];let S=f.isPending&&f.data===null,C=f.data===null?f.error:null,w=f.data?.truncated===!0,T=l!==null,E;t[18]===b?E=t[19]:(E=e=>void b(e),t[18]=b,t[19]=E);let D;return t[20]!==i||t[21]!==v||t[22]!==a||t[23]!==s||t[24]!==T||t[25]!==E||t[26]!==S||t[27]!==C||t[28]!==w?(D=(0,$.jsx)(Hl,{icon:x,label:`Request a review`,allowed:i,disabledReason:`Asking someone to review needs write access on this repository`,open:a,onOpenChange:o,query:s,onQueryChange:c,searchLabel:`Search people with access`,isPending:S,error:C,candidates:v,emptyLabel:`Nobody else has access to this repository.`,noMatchLabel:`Nobody with access matches that.`,errorLabel:`The people with access could not be read.`,truncated:w,truncatedLabel:`This repository has more people with access than are listed here. Ask for the rest on the host.`,candidateKey:Xl,disabled:T,onSelect:E,children:Yl}),t[20]=i,t[21]=v,t[22]=a,t[23]=s,t[24]=T,t[25]=E,t[26]=S,t[27]=C,t[28]=w,t[29]=D):D=t[29],D}function Yl(e){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Tr,{actor:e,className:`flex-1`}),e.kind===`team`?(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`team`}):null,e.isRequested?(0,$.jsx)(fe,{"aria-label":`Already asked`,className:`size-3.5 shrink-0`}):null]})}function Xl(e){return`${e.kind}:${e.id}`}function Zl(e){let t=(0,Q.c)(28),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(null),l=(0,Z.useId)(),u,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{let e=c.current;if(!e)return;let t=()=>s(e.getBoundingClientRect().height>240);return t(),nr(e,t)},d=[],t[3]=u,t[4]=d):(u=t[3],d=t[4]),(0,Z.useEffect)(u,d);let f;t[5]===n?f=t[6]:(f=K(`min-w-0`,n),t[5]=n,t[6]=f);let p=!i&&`max-h-[240px] overflow-hidden`,m;t[7]===p?m=t[8]:(m=K(`relative`,p),t[7]=p,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>a(!0),t[9]=h):h=t[9];let g;t[10]===r?g=t[11]:(g=(0,$.jsx)(`div`,{ref:c,children:(0,$.jsx)(Ys,{...r})}),t[10]=r,t[11]=g);let _;t[12]!==i||t[13]!==o?(_=o&&!i?(0,$.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-background to-transparent`}):null,t[12]=i,t[13]=o,t[14]=_):_=t[14];let v;t[15]!==l||t[16]!==m||t[17]!==g||t[18]!==_?(v=(0,$.jsxs)(`div`,{id:l,className:m,onFocusCapture:h,children:[g,_]}),t[15]=l,t[16]=m,t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==i||t[21]!==l||t[22]!==o?(y=o?(0,$.jsx)(W,{size:`xs`,variant:`ghost-muted`,className:`mt-2`,"aria-expanded":i,"aria-controls":l,onClick:()=>{i&&c.current?.parentElement?.scrollIntoView({block:`nearest`}),a(!i)},children:i?`Show less`:`Show full comment`}):null,t[20]=i,t[21]=l,t[22]=o,t[23]=y):y=t[23];let b;return t[24]!==y||t[25]!==f||t[26]!==v?(b=(0,$.jsxs)(`div`,{className:f,children:[v,y]}),t[24]=y,t[25]=f,t[26]=v,t[27]=b):b=t[27],b}var Ql=1;function $l(e){let t=e.sectionTop<e.viewportTop,n=e.headingTop<=e.viewportTop+Ql;return!t||!n?null:Math.max(0,e.scrollTop+e.sectionTop-e.viewportTop)}function eu(e){return e.toLowerCase()}function tu(e){let t=(0,Q.c)(27),{comment:n,detail:r}=e,i=n.author,a;t[0]!==i||t[1]!==r?(a=i?Pr.get(r.provider).authorProfileUrl(i.login,r.url):null,t[0]=i,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]!==i||t[4]!==o?(s=(0,$.jsx)(Tr,{actor:i,profileUrl:o,className:`max-w-full`}),t[3]=i,t[4]=o,t[5]=s):s=t[5];let c;t[6]===n.url?c=t[7]:(c=n.url?(0,$.jsx)(`a`,{href:n.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground hover:text-foreground hover:underline`}):(0,$.jsx)(`span`,{className:`text-muted-foreground`}),t[6]=n.url,t[7]=c);let l=n.createdAt,u;t[8]===n.createdAt?u=t[9]:(u=En(n.createdAt),t[8]=n.createdAt,t[9]=u);let d;t[10]!==n.createdAt||t[11]!==u?(d=(0,$.jsx)(`time`,{dateTime:l,children:u}),t[10]=n.createdAt,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==c||t[14]!==d?(f=(0,$.jsx)(J,{render:c,children:d}),t[13]=c,t[14]=d,t[15]=f):f=t[15];let p;t[16]===n.createdAt?p=t[17]:(p=new Date(n.createdAt).toLocaleString(),t[16]=n.createdAt,t[17]=p);let m=n.url?` · Open comment on host`:``,h;t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(Y,{children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20];let g;t[21]!==h||t[22]!==f?(g=(0,$.jsxs)(X,{children:[f,h]}),t[21]=h,t[22]=f,t[23]=g):g=t[23];let _;return t[24]!==g||t[25]!==s?(_=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 text-xs`,children:[s,g]}),t[24]=g,t[25]=s,t[26]=_):_=t[26],_}function nu(e){let t=(0,Q.c)(8),{comment:n,thread:r}=e,i=r?.path??n.path;if(!i)return null;let a=`${i}${r?.line?`:${r.line}`:``}`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`span`,{className:`truncate font-mono`}),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:o,children:a}),(0,$.jsx)(Y,{children:a})]}),t[1]=a,t[2]=s);let c;t[3]===r?.isOutdated?c=t[4]:(c=r?.isOutdated?(0,$.jsx)(`span`,{className:`shrink-0`,children:`Outdated`}):null,t[3]=r?.isOutdated,t[4]=c);let l;return t[5]!==s||t[6]!==c?(l=(0,$.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-2 text-xs text-muted-foreground`,children:[s,c]}),t[5]=s,t[6]=c,t[7]=l):l=t[7],l}function ru(e){let t=e.toLowerCase().replace(/_/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function iu(e){let t=(0,Q.c)(29),{comment:n,editing:r,className:i}=e;if(r.editingId===n.id){let e;t[0]!==n||t[1]!==r?(e=e=>r.onSave(n,e),t[0]=n,t[1]=r,t[2]=e):e=t[2];let a;t[3]===r?a=t[4]:(a=()=>r.onEdit(null),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==n.body||t[7]!==r.cwd||t[8]!==r.environmentId||t[9]!==r.saving||t[10]!==r.threadRef||t[11]!==e||t[12]!==a?(o=(0,$.jsx)(Xs,{className:i,value:n.body,cwd:r.cwd,environmentId:r.environmentId,threadRef:r.threadRef,label:`Edit comment`,saving:r.saving,onSave:e,onCancel:a}),t[5]=i,t[6]=n.body,t[7]=r.cwd,t[8]=r.environmentId,t[9]=r.saving,t[10]=r.threadRef,t[11]=e,t[12]=a,t[13]=o):o=t[13],o}let a;t[14]===i?a=t[15]:(a=K(`flex items-start gap-1`,i),t[14]=i,t[15]=a);let o;t[16]!==n.body||t[17]!==n.id||t[18]!==r.cwd||t[19]!==r.environmentId||t[20]!==r.threadRef?(o=(0,$.jsx)(Zl,{className:`min-w-0 flex-1`,text:n.body,cwd:r.cwd,environmentId:r.environmentId,threadRef:r.threadRef},n.id),t[16]=n.body,t[17]=n.id,t[18]=r.cwd,t[19]=r.environmentId,t[20]=r.threadRef,t[21]=o):o=t[21];let s;t[22]!==n||t[23]!==r?(s=r.canEdit(n)?(0,$.jsx)(Es,{"aria-label":`Edit comment`,onClick:()=>r.onEdit(n)}):null,t[22]=n,t[23]=r,t[24]=s):s=t[24];let c;return t[25]!==a||t[26]!==o||t[27]!==s?(c=(0,$.jsxs)(`div`,{className:a,children:[o,s]}),t[25]=a,t[26]=o,t[27]=s,t[28]=c):c=t[28],c}function au(e){let t=(0,Q.c)(37),{comment:n,editing:r,label:i,body:a,reactionBar:o,detail:s,thread:c}=e,[u,d]=(0,Z.useState)(!1),f=(0,Z.useRef)(null),p;t[0]!==n||t[1]!==s?(p=(0,$.jsx)(tu,{comment:n,detail:s}),t[0]=n,t[1]=s,t[2]=p):p=t[2];let m=u&&`rotate-180`,h;t[3]===m?h=t[4]:(h=K(`size-3.5 transition-transform`,m),t[3]=m,t[4]=h);let g;t[5]===h?g=t[6]:(g=(0,$.jsx)(l,{"aria-hidden":!0,className:h}),t[5]=h,t[6]=g);let _;t[7]!==i||t[8]!==g?(_=(0,$.jsxs)(va,{ref:f,className:`flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:[i,g]}),t[7]=i,t[8]=g,t[9]=_):_=t[9];let v;t[10]!==o||t[11]!==p||t[12]!==_?(v=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[p,_,o]}),t[10]=o,t[11]=p,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==n||t[15]!==c?(y=(0,$.jsx)(nu,{comment:n,thread:c}),t[14]=n,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==a||t[18]!==u?(b=!u&&a?(0,$.jsx)(va,{className:`mt-2 block w-full truncate text-left text-xs text-muted-foreground hover:text-foreground`,onClick:()=>f.current?.focus({preventScroll:!0}),children:a.replace(/<!--[\s\S]*?-->/gu,``).replace(/^\s*>?\s*\[!\w+\]\s*$/gmu,``).replace(/!?(\[([^\]]+)\])\([^)]*\)/gu,`$2`).replace(/^[\s>#*-]+/gmu,``).replace(/[*`]/gu,``).replace(/\s+/g,` `).trim()}):null,t[17]=a,t[18]=u,t[19]=b):b=t[19];let x;t[20]!==v||t[21]!==y||t[22]!==b?(x=(0,$.jsxs)(`div`,{className:`p-3`,children:[v,y,b]}),t[20]=v,t[21]=y,t[22]=b,t[23]=x):x=t[23];let S;t[24]!==a||t[25]!==n||t[26]!==r||t[27]!==u?(S=u?(0,$.jsx)(`div`,{className:`px-3 pb-3`,children:a===null&&!r.canEdit(n)?null:(0,$.jsx)(iu,{className:`mt-2`,comment:n,editing:r})}):null,t[24]=a,t[25]=n,t[26]=r,t[27]=u,t[28]=S):S=t[28];let C;t[29]===S?C=t[30]:(C=(0,$.jsx)(ba,{children:S}),t[29]=S,t[30]=C);let w;t[31]!==C||t[32]!==x?(w=(0,$.jsxs)(`article`,{className:`group rounded-lg border border-border/60 [contain-intrinsic-block-size:44px] [content-visibility:auto]`,children:[x,C]}),t[31]=C,t[32]=x,t[33]=w):w=t[33];let T;return t[34]!==u||t[35]!==w?(T=(0,$.jsx)(xa,{open:u,onOpenChange:d,children:w}),t[34]=u,t[35]=w,t[36]=T):T=t[36],T}function ou(e){let t=(0,Q.c)(8),{icon:n,label:r,children:i}=e,a;t[0]!==n||t[1]!==r?(a=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[n,r]}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,$.jsx)(`span`,{className:`min-w-0 text-foreground`,children:i}),t[3]=i,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`div`,{className:`grid min-h-7 min-w-0 grid-cols-[6rem_minmax(0,1fr)] items-center gap-2 text-xs sm:min-h-6`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function su(e){let t=(0,Q.c)(25),{title:n,defaultOpen:r,keepMounted:i,actions:a,children:o}=e,s=r===void 0||r,c=i!==void 0&&i,[l,u]=(0,Z.useState)(s),d=(0,Z.useRef)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{if(!e){let e=d.current,t=e?.closest(`[data-pull-request-summary-section]`),n=e?.closest(`[data-pull-request-summary-scroll]`);if(e&&t&&n){let r=$l({scrollTop:n.scrollTop,viewportTop:n.getBoundingClientRect().top,sectionTop:t.getBoundingClientRect().top,headingTop:e.getBoundingClientRect().top});r!==null&&(n.scrollTop=r)}}u(e)},t[0]=f):f=t[0];let p=f,m;t[1]===n?m=t[2]:(m=(0,$.jsx)(`section`,{"aria-label":n}),t[1]=n,t[2]=m);let h;t[3]===n?h=t[4]:(h=(0,$.jsx)(`span`,{children:n}),t[3]=n,t[4]=h);let g=l&&`rotate-90`,_;t[5]===g?_=t[6]:(_=K(`size-3.5 text-muted-foreground/60 transition-transform`,g),t[5]=g,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,$.jsx)(C,{"aria-hidden":!0,className:_}),t[7]=_,t[8]=v);let y;t[9]!==h||t[10]!==v?(y=(0,$.jsxs)(va,{className:`flex min-w-0 flex-1 items-center gap-1.5 px-4 py-3 text-left text-xs font-medium text-muted-foreground hover:text-foreground`,children:[h,v]}),t[9]=h,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==a||t[13]!==y?(b=(0,$.jsxs)(`div`,{ref:d,className:`sticky top-0 z-10 flex w-full items-center bg-background pr-4`,children:[y,a]}),t[12]=a,t[13]=y,t[14]=b):b=t[14];let x;t[15]===o?x=t[16]:(x=(0,$.jsx)(`div`,{className:`px-4 pb-4`,children:o}),t[15]=o,t[16]=x);let S;t[17]!==c||t[18]!==x?(S=(0,$.jsx)(ba,{keepMounted:c,children:x}),t[17]=c,t[18]=x,t[19]=S):S=t[19];let w;return t[20]!==l||t[21]!==b||t[22]!==S||t[23]!==m?(w=(0,$.jsxs)(xa,{open:l,onOpenChange:p,render:m,"data-pull-request-summary-section":!0,children:[b,S]}),t[20]=l,t[21]=b,t[22]=S,t[23]=m,t[24]=w):w=t[24],w}var cu=10,lu=`p4code:pull-request-comment-filter:v1`,uu=ye({bots:M,resolved:M}),du={bots:!1,resolved:!1};function fu(e){let t=(0,Q.c)(110),{scrollerRef:n,environmentId:r,threadRef:i,reference:a,detail:o,activityPending:s,checksStale:c,activityError:l,pendingFinding:u,fixFindingLabel:f,fixCheckLabel:p,onFixFinding:m,onRefresh:h,onRefreshChecks:g}=e,_=c!==void 0&&c,v=f===void 0?`Fix in a thread`:f,y=p===void 0?`Fix`:p,b=g===void 0?h:g,x;t[0]===o.url?x=t[1]:(x={url:o.url,count:cu},t[0]=o.url,t[1]=x);let[S,C]=(0,Z.useState)(x),w=S.url===o.url?S.count:cu,[E,D]=T(lu,du,uu),O=new Map(o.reviewThreads.flatMap(bu)),A=e=>O.get(e.id)?.isResolved===!0||ri(e.reviewState)===`dismissed`,j=yu,M;t[2]!==E.bots||t[3]!==E.resolved||t[4]!==A?(M=e=>(E.bots||!j(e))&&(E.resolved||!A(e)),t[2]=E.bots,t[3]=E.resolved,t[4]=A,t[5]=M):M=t[5];let N=o.comments.filter(M),P=o.comments.length-N.length,L=N.slice(Math.max(0,N.length-w)),B=N.length-L.length,[V,H]=(0,Z.useState)(`newest`),ee=Ei(L,V),te;t[6]!==o.url||t[7]!==B||t[8]!==w?(te=B>0?(0,$.jsxs)(W,{size:`sm`,variant:`outline`,className:`w-full`,onClick:()=>C({url:o.url,count:w+cu}),children:[`Show `,Math.min(B,cu),` older comment`,B===1?``:`s`,` (`,B,` hidden)`]}):null,t[6]=o.url,t[7]=B,t[8]=w,t[9]=te):te=t[9];let ne=te,re=pi(o.comments,o.commits),G=new Map(re.flatMap(vu)),ie=[...o.reviewers.map(e=>({key:e.login,actor:e,outcome:G.get(eu(e.login))?.outcome??null,stale:G.get(eu(e.login))?.stale??!1})),...re.filter(e=>!o.reviewers.some(t=>e.actor!==null&&eu(t.login)===eu(e.actor.login))).map(_u)],ae=Sr(i),oe;t[10]===ae?oe=t[11]:(oe=e=>{ae(e).catch(gu)},t[10]=ae,t[11]=oe);let se=oe,ce;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(ce={reportFailure:!1},t[12]=ce):ce=t[12];let le=At(Ur.update,ce),ue;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ue={reportFailure:!1},t[13]=ue):ue=t[13];let de=At(Ur.updateComment,ue),[fe,me]=(0,Z.useState)(null),[he,ge]=(0,Z.useState)(!1),[_e,ve]=(0,Z.useState)(null),[ye,be]=(0,Z.useState)(!1),xe=_e?.pullRequest===o.url?_e.commentId:null,Se;t[14]!==he||t[15]!==r||t[16]!==h||t[17]!==a||t[18]!==le?(Se=async e=>{if(he)return;ge(!0);let t=await le({environmentId:r,input:{...a,body:e}});if(ge(!1),t._tag===`Failure`){yt.add({type:`error`,title:`Could not save the description`});return}me(null),h()},t[14]=he,t[15]=r,t[16]=h,t[17]=a,t[18]=le,t[19]=Se):Se=t[19];let Ce=Se,we;t[20]===o?we=t[21]:(we=e=>ws(o,e),t[20]=o,t[21]=we);let Te;t[22]===o.url?Te=t[23]:(Te=e=>ve(e===null?null:{pullRequest:o.url,commentId:e.id}),t[22]=o.url,t[23]=Te);let Ee;t[24]!==ye||t[25]!==r||t[26]!==h||t[27]!==a||t[28]!==de?(Ee=async(e,t)=>{if(ye||e.kind===`review`)return;be(!0);let n=await de({environmentId:r,input:{...a,commentId:e.id,kind:e.kind,body:t}});if(be(!1),n._tag===`Failure`){yt.add({type:`error`,title:`Could not save the comment`});return}ve(null),h()},t[24]=ye,t[25]=r,t[26]=h,t[27]=a,t[28]=de,t[29]=Ee):Ee=t[29];let De={cwd:o.workspaceRoot,environmentId:r,threadRef:i,canEdit:we,editingId:xe,saving:ye,onEdit:Te,onSave:Ee},Oe=e=>{let t=O.get(e.id),n=ii(e.body);if(A(e))return(0,$.jsx)(au,{comment:e,editing:De,detail:o,thread:t,label:t?.isResolved?`Resolved`:`Review dismissed`,body:n,reactionBar:(0,$.jsx)(uc,{className:`ml-auto justify-end`,reactions:e.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:e.id,environmentId:r,reference:a,onRefresh:h})},`${o.url}:${e.id}`);let i=ri(e.reviewState),s=e.kind!==`review`&&e.kind!==`review-comment`||i===`approved`?null:t===void 0?n===null?null:{kind:`comment`,comment:e}:{kind:`thread`,thread:t},c=(0,$.jsx)(uc,{reactions:e.reactions??[],canReact:o.capabilities.reactions===!0,subjectId:e.id,environmentId:r,reference:a,onRefresh:h,className:`ml-auto justify-end`});return(0,$.jsxs)(`article`,{className:`group rounded-lg border border-border/60 bg-background [contain-intrinsic-block-size:160px] [content-visibility:auto]`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2 rounded-t-lg bg-muted/25 px-3 py-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(tu,{comment:e,detail:o}),i?(0,$.jsx)(Er,{outcome:i}):e.reviewState?(0,$.jsx)(`span`,{children:ru(e.reviewState)}):null]}),m&&s?(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,className:`-mt-1 shrink-0`,disabled:u!=null,onClick:()=>m(s),children:[(0,$.jsx)(d,{className:`size-3`}),u===ci(s)?`Preparing...`:v]}):null,c]}),(0,$.jsx)(`div`,{className:`px-3`,children:(0,$.jsx)(nu,{comment:e,thread:t})}),n===null&&!De.canEdit(e)?null:(0,$.jsx)(iu,{className:`px-3 py-3`,comment:e,editing:De})]},`${o.url}:${e.id}`)},ke;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,$.jsx)(R,{className:`size-3.5`}),t[30]=ke):ke=t[30];let Ae=ie.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,$.jsx)(`span`,{className:`flex items-center -space-x-1`,children:ie.map(hu)}),je;t[31]!==o.capabilities.reviewers.listCandidates||t[32]!==o.capabilities.reviewers.request||t[33]!==o.viewerPermissions||t[34]!==r||t[35]!==a?(je=o.capabilities.reviewers.request&&o.capabilities.reviewers.listCandidates?(0,$.jsx)(Jl,{environmentId:r,reference:a,allowed:o.viewerPermissions.requestReviewers}):null,t[31]=o.capabilities.reviewers.listCandidates,t[32]=o.capabilities.reviewers.request,t[33]=o.viewerPermissions,t[34]=r,t[35]=a,t[36]=je):je=t[36];let Me;t[37]!==Ae||t[38]!==je?(Me=(0,$.jsx)(ou,{icon:ke,label:`Reviewers`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[Ae,je]})}),t[37]=Ae,t[38]=je,t[39]=Me):Me=t[39];let Fe;t[40]!==o.capabilities.labels||t[41]!==o.labels||t[42]!==o.viewerPermissions||t[43]!==r||t[44]!==a?(Fe=o.labels.length>0||o.capabilities.labels===!0?(0,$.jsx)(ou,{icon:(0,$.jsx)(pe,{className:`size-3.5`}),label:`Labels`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[o.labels.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):o.labels.map(mu),o.capabilities.labels===!0?(0,$.jsx)(Wl,{environmentId:r,reference:a,allowed:o.viewerPermissions.labels!==!1}):null]})}):null,t[40]=o.capabilities.labels,t[41]=o.labels,t[42]=o.viewerPermissions,t[43]=r,t[44]=a,t[45]=Fe):Fe=t[45];let Ie;t[46]!==Me||t[47]!==Fe?(Ie=(0,$.jsx)(`section`,{className:`px-4 pt-2.5 pb-1`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Me,Fe]})}),t[46]=Me,t[47]=Fe,t[48]=Ie):Ie=t[48];let Le=`description:${o.url}`,ze;t[49]!==he||t[50]!==fe||t[51]!==o||t[52]!==r||t[53]!==Ce||t[54]!==i?(ze=(0,$.jsx)(`div`,{className:`group`,children:fe===o.url?(0,$.jsx)(Xs,{allowEmpty:!0,value:o.body,cwd:o.workspaceRoot,environmentId:r,threadRef:i,label:`Pull request description`,placeholder:`Describe this pull request`,saving:he,onSave:e=>void Ce(e),onCancel:()=>me(null)}):(0,$.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,$.jsx)(Ys,{className:`min-w-0 flex-1`,text:o.body.trim().length>0?o.body:`_No description provided._`,cwd:o.workspaceRoot,environmentId:r,threadRef:i}),Cs(o)?(0,$.jsx)(Es,{"aria-label":`Edit description`,onClick:()=>me(o.url)}):null]})}),t[49]=he,t[50]=fe,t[51]=o,t[52]=r,t[53]=Ce,t[54]=i,t[55]=ze):ze=t[55];let Be;t[56]!==Le||t[57]!==ze?(Be=(0,$.jsx)(su,{title:`Description`,keepMounted:!0,children:ze},Le),t[56]=Le,t[57]=ze,t[58]=Be):Be=t[58];let Ve=`checks:${o.url}`,He;t[59]!==_||t[60]!==o.checks||t[61]!==y||t[62]!==m||t[63]!==b||t[64]!==se||t[65]!==u?(He=_?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Check details are out of date.`}),(0,$.jsx)(W,{size:`xs`,variant:`ghost`,onClick:b,children:`Refresh`})]}):o.checks.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No checks reported.`}):o.checks.map((e,t)=>{let n={kind:`check`,check:e},r=e.status===`failure`||e.status===`cancelled`;return(0,$.jsxs)(`div`,{className:`group flex items-center gap-2 rounded-md pr-1 hover:bg-accent/60`,children:[(0,$.jsxs)(`button`,{type:`button`,disabled:!e.url,onClick:()=>e.url&&se(e.url),className:K(`flex min-w-0 flex-1 items-start gap-2 rounded-md px-2 py-2 text-left text-xs leading-5 [&>svg]:mt-0.5`,e.url?`cursor-pointer`:`cursor-default`),children:[(0,$.jsx)(Dr,{status:e.status}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere`,children:e.name}),(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:yr(e)})]}),m&&r?(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,className:`shrink-0`,disabled:u!=null,onClick:()=>m(n),children:[(0,$.jsx)(d,{className:`size-3`}),u===ci(n)?`Preparing...`:y]}):null]},`${t}:${e.name}:${e.url??``}`)}),t[59]=_,t[60]=o.checks,t[61]=y,t[62]=m,t[63]=b,t[64]=se,t[65]=u,t[66]=He):He=t[66];let Ue;t[67]!==Ve||t[68]!==He?(Ue=(0,$.jsx)(su,{title:`Checks`,defaultOpen:!1,children:He},Ve),t[67]=Ve,t[68]=He,t[69]=Ue):Ue=t[69];let We=su,Ge=`Comments (${o.commentCount})`,Ke;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,$.jsx)(W,{size:`xs`,variant:`ghost-muted`}),t[70]=Ke):Ke=t[70];let qe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,$.jsx)(Ne,{"aria-hidden":!0,className:`size-3`}),t[71]=qe):qe=t[71];let Je=P>0?`${P} hidden`:`Filter`,Ye;t[72]===Je?Ye=t[73]:(Ye=(0,$.jsxs)(Re,{render:Ke,"aria-label":`Filter comments`,children:[qe,Je]}),t[72]=Je,t[73]=Ye);let Xe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,$.jsx)(k,{children:`Show`}),t[74]=Xe):Xe=t[74];let Ze;t[75]===D?Ze=t[76]:(Ze=e=>D(t=>({...t,bots:e})),t[75]=D,t[76]=Ze);let Qe;t[77]!==E.bots||t[78]!==Ze?(Qe=(0,$.jsx)(F,{checked:E.bots,closeOnClick:!1,onCheckedChange:Ze,children:`Bot comments`}),t[77]=E.bots,t[78]=Ze,t[79]=Qe):Qe=t[79];let $e;t[80]===D?$e=t[81]:($e=e=>D(t=>({...t,resolved:e})),t[80]=D,t[81]=$e);let et;t[82]!==E.resolved||t[83]!==$e?(et=(0,$.jsx)(F,{checked:E.resolved,closeOnClick:!1,onCheckedChange:$e,children:`Resolved or dismissed`}),t[82]=E.resolved,t[83]=$e,t[84]=et):et=t[84];let tt;t[85]!==Qe||t[86]!==et?(tt=(0,$.jsx)(Pe,{align:`end`,children:(0,$.jsxs)(z,{children:[Xe,Qe,et]})}),t[85]=Qe,t[86]=et,t[87]=tt):tt=t[87];let nt;t[88]!==Ye||t[89]!==tt?(nt=(0,$.jsxs)(I,{children:[Ye,tt]}),t[88]=Ye,t[89]=tt,t[90]=nt):nt=t[90];let rt=V===`newest`?`Show oldest comments first`:`Show newest comments first`,it,at;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(it=()=>H(pu),at=(0,$.jsx)(U,{"aria-hidden":!0,className:`size-3`}),t[91]=it,t[92]=at):(it=t[91],at=t[92]);let ot=V===`newest`?`Newest first`:`Oldest first`,st;t[93]!==rt||t[94]!==ot?(st=(0,$.jsxs)(W,{size:`xs`,variant:`ghost-muted`,"aria-label":rt,onClick:it,children:[at,ot]}),t[93]=rt,t[94]=ot,t[95]=st):st=t[95];let ct;t[96]!==nt||t[97]!==st?(ct=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[nt,st]}),t[96]=nt,t[97]=st,t[98]=ct):ct=t[98];let lt=s?(0,$.jsx)(Tl,{}):l?(0,$.jsx)(Dl,{compact:!0,error:l,onRetry:h}):(0,$.jsxs)($.Fragment,{children:[o.commentsTruncated?(0,$.jsxs)(`p`,{className:`mb-2 rounded-md border border-warning/30 bg-warning-surface px-2 py-1.5 text-xs`,children:[`This conversation is longer than this page reads in one go. The most recent`,` `,o.comments.length,` are here; open it on the host to read the rest.`]}):null,o.comments.length===0?(0,$.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No comments yet.`}):N.length===0?(0,$.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:P===1?`The only comment is hidden by the filter.`:`All ${P} comments are hidden by the filter.`}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[V===`oldest`?ne:null,ee.map(Oe),V===`newest`?ne:null,w>cu?(0,$.jsxs)(W,{size:`sm`,variant:`ghost`,className:`w-full`,onClick:()=>C({url:o.url,count:cu}),children:[`Show only `,cu,` recent comments`]}):null]})]}),ut;t[99]!==We||t[100]!==Ge||t[101]!==ct||t[102]!==lt?(ut=(0,$.jsx)(We,{title:Ge,actions:ct,children:lt}),t[99]=We,t[100]=Ge,t[101]=ct,t[102]=lt,t[103]=ut):ut=t[103];let dt;return t[104]!==n||t[105]!==Ie||t[106]!==Be||t[107]!==Ue||t[108]!==ut?(dt=(0,$.jsxs)(`div`,{ref:n,className:`h-full overflow-y-auto`,"data-pull-request-summary-scroll":!0,children:[Ie,Be,Ue,ut]}),t[104]=n,t[105]=Ie,t[106]=Be,t[107]=Ue,t[108]=ut,t[109]=dt):dt=t[109],dt}function pu(e){return e===`newest`?`oldest`:`newest`}function mu(e){return(0,$.jsx)(Or,{label:e,size:`default`,className:`max-w-48`},e.name)}function hu(e){let t=e.actor?.login??`ghost`,n=e.actor?.name&&e.actor.name!==t?`${e.actor.name} (@${t})`:t;return(0,$.jsxs)(X,{children:[(0,$.jsxs)(J,{render:(0,$.jsx)(`span`,{className:K(`relative rounded-full hover:z-10`,e.outcome?gr(e.outcome,e.stale):void 0)}),children:[(0,$.jsx)(Tr,{actor:e.actor,tooltip:!1,variant:`avatar`}),e.outcome?(0,$.jsx)(`span`,{className:`sr-only`,children:e.stale?Mr(e.outcome):Nr(e.outcome)}):null]}),(0,$.jsx)(Y,{side:`bottom`,children:e.outcome?`${n} — ${e.stale?Mr(e.outcome):Nr(e.outcome)}`:n})]},e.key)}function gu(e){console.error(e),yt.add({type:`error`,title:`Unable to open check details`})}function _u(e){return{key:e.key,actor:e.actor,outcome:e.outcome,stale:e.stale}}function vu(e){return e.actor?[[eu(e.actor.login),e]]:[]}function yu(e){return e.author?.isBot===!0||e.author?.login.endsWith(`[bot]`)===!0}function bu(e){return e.comments.map(t=>[t.id,e])}function xu(e){let t=(0,Q.c)(6),{body:n,markdown:r,cwd:i,environmentId:a,threadRef:o}=e,s;return t[0]!==n||t[1]!==i||t[2]!==a||t[3]!==r||t[4]!==o?(s=(0,$.jsx)(`div`,{className:`mt-3`,children:r?(0,$.jsx)(Ys,{text:n,cwd:i,environmentId:a,threadRef:o}):(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-xs text-muted-foreground`,children:n})}),t[0]=n,t[1]=i,t[2]=a,t[3]=r,t[4]=o,t[5]=s):s=t[5],s}function Su(e){let t=(0,Q.c)(2),{actor:n}=e,r=n?.login??`ghost`,i;return t[0]===r?i=t[1]:(i=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:r}),t[0]=r,t[1]=i),i}function Cu(e){let t=(0,Q.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=K(`absolute left-0 top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center bg-background`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,$.jsx)(`span`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function wu(e){let t=(0,Q.c)(5),{icon:n,className:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`span`,{className:`flex size-7 items-center justify-center bg-background text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,$.jsx)(Cu,{className:r,children:i}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Tu(e){let t=(0,Q.c)(5),{actors:n,className:r,fallback:i,muted:a}=e,o=a!==void 0&&a,s=n[0],c;return t[0]!==s||t[1]!==r||t[2]!==i||t[3]!==o?(c=s===void 0?(0,$.jsx)(wu,{className:r,icon:i}):(0,$.jsx)(Cu,{className:r,children:(0,$.jsx)(hr,{actor:s,className:K(`size-7 bg-muted text-3xs transition-opacity`,o&&`opacity-45 grayscale`)})}),t[0]=s,t[1]=r,t[2]=i,t[3]=o,t[4]=c):c=t[4],c}function Eu(e){return e.toLowerCase().replaceAll(`_`,` `).replaceAll(`-`,` `).replace(/^\w/u,e=>e.toUpperCase())}function Du(e){let t=(0,Q.c)(4),{state:n}=e,r;t[0]===n?r=t[1]:(r=Eu(n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,$.jsx)(`span`,{className:`text-3xs font-medium text-muted-foreground`,children:r}),t[2]=r,t[3]=i),i}function Ou(e){let t=(0,Q.c)(3),{url:n,onOpen:r}=e,i;return t[0]!==r||t[1]!==n?(i=n===null?null:(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost-muted`,className:`-mr-1 -mt-1 shrink-0`,"aria-label":`Open activity on host`,onClick:()=>r(n),children:(0,$.jsx)(xe,{className:`size-3`})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function ku(e){let t=(0,Q.c)(59),{event:n,editable:r,cwd:i,onOpen:a,reactions:o}=e,[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={reportFailure:!1},t[0]=d):d=t[0];let f=At(Ur.updateComment,d),p;t[1]!==r||t[2]!==o||t[3]!==l||t[4]!==f?(p=async e=>{if(r===null||l||r.kind===`review`)return;u(!0);let t=await f({environmentId:o.environmentId,input:{...o.reference,commentId:r.id,kind:r.kind,body:e}});if(u(!1),t._tag===`Failure`){yt.add({type:`error`,title:`Could not save the comment`});return}c(!1),o.onRefresh()},t[1]=r,t[2]=o,t[3]=l,t[4]=f,t[5]=p):p=t[5];let m=p,h;t[6]===n.actor?h=t[7]:(h=(0,$.jsx)(Su,{actor:n.actor}),t[6]=n.actor,t[7]=h);let g;t[8]===n.title?g=t[9]:(g=(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:n.title}),t[8]=n.title,t[9]=g);let _;t[10]===n.reviewState?_=t[11]:(_=n.reviewState?(0,$.jsx)(Du,{state:n.reviewState}):null,t[10]=n.reviewState,t[11]=_);let v;t[12]!==h||t[13]!==g||t[14]!==_?(v=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs`,children:[h,g,_]}),t[12]=h,t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]===n.at?y=t[17]:(y=En(n.at),t[16]=n.at,t[17]=y);let b;t[18]===y?b=t[19]:(b=(0,$.jsx)(`span`,{children:y}),t[18]=y,t[19]=b);let x;t[20]===n.path?x=t[21]:(x=n.path?(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,$.jsx)(he,{"aria-hidden":!0,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:n.path})]}):null,t[20]=n.path,t[21]=x);let S;t[22]!==b||t[23]!==x?(S=(0,$.jsxs)(vr,{className:`mt-1 flex-wrap text-2xs text-muted-foreground`,children:[b,x]}),t[22]=b,t[23]=x,t[24]=S):S=t[24];let C;t[25]!==S||t[26]!==v?(C=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==s?(w=r!==null&&!s?(0,$.jsx)(Es,{className:`-mt-1`,"aria-label":`Edit comment`,onClick:()=>c(!0)}):null,t[28]=r,t[29]=s,t[30]=w):w=t[30];let T;t[31]!==n.id||t[32]!==n.reactions||t[33]!==o.canReact||t[34]!==o.environmentId||t[35]!==o.onRefresh||t[36]!==o.reference?(T=o.canReact||n.reactions.length>0?(0,$.jsx)(uc,{className:`ml-auto justify-end`,reactions:n.reactions,canReact:o.canReact,subjectId:n.id,environmentId:o.environmentId,reference:o.reference,onRefresh:o.onRefresh}):null,t[31]=n.id,t[32]=n.reactions,t[33]=o.canReact,t[34]=o.environmentId,t[35]=o.onRefresh,t[36]=o.reference,t[37]=T):T=t[37];let E;t[38]!==n.url||t[39]!==a?(E=(0,$.jsx)(Ou,{url:n.url,onOpen:a}),t[38]=n.url,t[39]=a,t[40]=E):E=t[40];let D;t[41]!==C||t[42]!==w||t[43]!==T||t[44]!==E?(D=(0,$.jsx)(`div`,{className:`px-2`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start gap-2`,children:[C,w,T,E]})}),t[41]=C,t[42]=w,t[43]=T,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==i||t[47]!==r||t[48]!==s||t[49]!==n.body||t[50]!==n.markdown||t[51]!==o.environmentId||t[52]!==o.threadRef||t[53]!==m||t[54]!==l?(O=s&&r!==null?(0,$.jsx)(`div`,{className:`px-2 pb-2 pt-3`,children:(0,$.jsx)(Xs,{value:r.body,cwd:i,environmentId:o.environmentId,threadRef:o.threadRef,label:`Edit comment`,saving:l,onSave:e=>void m(e),onCancel:()=>c(!1)})}):n.body?(0,$.jsx)(`div`,{className:`px-2 pb-2`,children:(0,$.jsx)(xu,{body:n.body,markdown:n.markdown,cwd:i,environmentId:o.environmentId,threadRef:o.threadRef})}):null,t[46]=i,t[47]=r,t[48]=s,t[49]=n.body,t[50]=n.markdown,t[51]=o.environmentId,t[52]=o.threadRef,t[53]=m,t[54]=l,t[55]=O):O=t[55];let k;return t[56]!==D||t[57]!==O?(k=(0,$.jsxs)(`article`,{className:`group py-2`,children:[D,O]}),t[56]=D,t[57]=O,t[58]=k):k=t[58],k}function Au(e){let t=new Map;for(let n of e){let e=n.actor;e!==null&&!t.has(e.login)&&t.set(e.login,e)}return[...t.values()]}function ju(e){let t=(0,Q.c)(50),{events:n,editable:r,cwd:i,onOpen:a,reactions:o}=e,[s,c]=(0,Z.useState)(!1),u;t[0]===n?u=t[1]:(u=Au(n),t[0]=n,t[1]=u);let d=u,f=n[0];if(f===void 0)return null;let p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(se,{className:`size-3.5`}),t[2]=p):p=t[2];let m=!s,h;t[3]!==d||t[4]!==m?(h=(0,$.jsx)(Tu,{actors:d,className:`top-6`,fallback:p,muted:m}),t[3]=d,t[4]=m,t[5]=h):h=t[5];let g=s?`text-foreground opacity-100`:`text-muted-foreground opacity-55`,_;t[6]===g?_=t[7]:(_=K(`flex w-full min-w-0 items-center gap-3 py-2 text-left transition-opacity hover:opacity-100`,g),t[6]=g,t[7]=_);let v;t[8]===n.length?v=t[9]:(v=n.length.toLocaleString(),t[8]=n.length,t[9]=v);let y=n.length===1?`comment`:`comments`,b;t[10]!==v||t[11]!==y?(b=(0,$.jsxs)(`span`,{className:`block text-xs font-semibold`,children:[v,` `,y]}),t[10]=v,t[11]=y,t[12]=b):b=t[12];let x;t[13]===d.length?x=t[14]:(x=d.length.toLocaleString(),t[13]=d.length,t[14]=x);let S=d.length===1?`author`:`authors`,C;t[15]===f.at?C=t[16]:(C=En(f.at),t[15]=f.at,t[16]=C);let w;t[17]!==x||t[18]!==S||t[19]!==C?(w=(0,$.jsxs)(`span`,{className:`block truncate text-3xs text-muted-foreground`,children:[x,` `,S,` ·`,` `,C]}),t[17]=x,t[18]=S,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==b?(T=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[b,w]}),t[21]=w,t[22]=b,t[23]=T):T=t[23];let E=s&&`rotate-180`,D;t[24]===E?D=t[25]:(D=K(`size-3.5 shrink-0 text-muted-foreground transition-transform`,E),t[24]=E,t[25]=D);let O;t[26]===D?O=t[27]:(O=(0,$.jsx)(l,{"aria-hidden":!0,className:D}),t[26]=D,t[27]=O);let k;t[28]!==T||t[29]!==O||t[30]!==_?(k=(0,$.jsxs)(va,{className:_,children:[T,O]}),t[28]=T,t[29]=O,t[30]=_,t[31]=k):k=t[31];let A;t[32]!==i||t[33]!==r||t[34]!==n||t[35]!==a||t[36]!==s||t[37]!==o?(A=s?(0,$.jsx)(`div`,{className:`mt-1 space-y-1`,children:n.map(e=>(0,$.jsx)(ku,{event:e,editable:r.get(e.id)??null,cwd:i,onOpen:a,reactions:o},`${o.reference.projectId}#${o.reference.number}:${e.id}`))}):null,t[32]=i,t[33]=r,t[34]=n,t[35]=a,t[36]=s,t[37]=o,t[38]=A):A=t[38];let j;t[39]===A?j=t[40]:(j=(0,$.jsx)(ba,{children:A}),t[39]=A,t[40]=j);let M;t[41]!==k||t[42]!==j?(M=(0,$.jsxs)(`div`,{children:[k,j]}),t[41]=k,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==s||t[45]!==M?(N=(0,$.jsx)(xa,{open:s,onOpenChange:c,children:M}),t[44]=s,t[45]=M,t[46]=N):N=t[46];let P;return t[47]!==N||t[48]!==h?(P=(0,$.jsxs)(`div`,{className:`relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]`,children:[h,N]}),t[47]=N,t[48]=h,t[49]=P):P=t[49],P}function Mu(e){let t=(0,Q.c)(33),{event:n,onOpen:r}=e,i=`View commit ${n.id}`,a;t[0]!==n.id||t[1]!==r?(a=()=>r(n.id),t[0]=n.id,t[1]=r,t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(u,{className:`size-3.5`}),t[3]=o):o=t[3];let s;t[4]===n.commitAuthors?s=t[5]:(s=(0,$.jsx)(Tu,{actors:n.commitAuthors,fallback:o}),t[4]=n.commitAuthors,t[5]=s);let c=n.body??`Untitled commit`,l;t[6]===c?l=t[7]:(l=(0,$.jsx)(`div`,{className:`truncate text-xs font-semibold text-foreground transition-colors group-hover:text-primary`,children:c}),t[6]=c,t[7]=l);let d;t[8]===n.id?d=t[9]:(d=n.id.slice(0,7),t[8]=n.id,t[9]=d);let f;t[10]===d?f=t[11]:(f=(0,$.jsx)(`code`,{className:`font-mono`,children:d}),t[10]=d,t[11]=f);let p;t[12]===n.at?p=t[13]:(p=En(n.at),t[12]=n.at,t[13]=p);let m;t[14]===p?m=t[15]:(m=(0,$.jsx)(`span`,{children:p}),t[14]=p,t[15]=m);let h;t[16]!==m||t[17]!==f?(h=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-3xs text-muted-foreground`,children:[f,m]}),t[16]=m,t[17]=f,t[18]=h):h=t[18];let g;t[19]!==h||t[20]!==l?(g=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,h]}),t[19]=h,t[20]=l,t[21]=g):g=t[21];let _;t[22]!==n.additions||t[23]!==n.deletions?(_=n.additions!==null&&n.deletions!==null?(0,$.jsx)(xr,{additions:n.additions,deletions:n.deletions,className:`ml-auto shrink-0 font-mono text-3xs`}):null,t[22]=n.additions,t[23]=n.deletions,t[24]=_):_=t[24];let v;t[25]!==g||t[26]!==_?(v=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5 py-1.5`,children:[g,_]}),t[25]=g,t[26]=_,t[27]=v):v=t[27];let y;return t[28]!==i||t[29]!==v||t[30]!==a||t[31]!==s?(y=(0,$.jsxs)(`button`,{type:`button`,className:`group relative mb-5 block w-full cursor-pointer rounded-sm pl-12 text-left outline-none [contain-intrinsic-block-size:48px] [content-visibility:auto] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,"aria-label":i,onClick:a,children:[s,v]}),t[28]=i,t[29]=v,t[30]=a,t[31]=s,t[32]=y):y=t[32],y}function Nu(e){let t=(0,Q.c)(21),{event:n}=e,r;t[0]===n.kind?r=t[1]:(r=n.kind===`opened`?{icon:(0,$.jsx)(Ir.pullRequest,{className:`size-3.5`}),label:`Pull request opened`}:n.kind===`merged`?{icon:(0,$.jsx)(Ir.merged,{className:`size-3.5`}),label:`Pull request merged`}:{icon:(0,$.jsx)(Ir.closed,{className:`size-3.5`}),label:`Pull request closed`},t[0]=n.kind,t[1]=r);let i=r,a;t[2]===i.icon?a=t[3]:(a=(0,$.jsx)(wu,{icon:i.icon}),t[2]=i.icon,t[3]=a);let o;t[4]===n.actor?o=t[5]:(o=n.actor?(0,$.jsx)(Su,{actor:n.actor}):null,t[4]=n.actor,t[5]=o);let s;t[6]===i.label?s=t[7]:(s=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),t[6]=i.label,t[7]=s);let c;t[8]!==o||t[9]!==s?(c=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o,s]}),t[8]=o,t[9]=s,t[10]=c):c=t[10];let l;t[11]===n.at?l=t[12]:(l=En(n.at),t[11]=n.at,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,$.jsx)(`div`,{className:`mt-0.5 text-2xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;t[15]!==c||t[16]!==u?(d=(0,$.jsxs)(`div`,{className:`py-1.5 text-xs`,children:[c,u]}),t[15]=c,t[16]=u,t[17]=d):d=t[17];let f;return t[18]!==a||t[19]!==d?(f=(0,$.jsxs)(`div`,{className:`relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]`,children:[a,d]}),t[18]=a,t[19]=d,t[20]=f):f=t[20],f}function Pu(e){let t=(0,Q.c)(69),{event:n,outcome:r,stale:i,cwd:a,onOpen:o,reactions:s}=e,c;t[0]===n.actor?c=t[1]:(c=n.actor?[n.actor]:[],t[0]=n.actor,t[1]=c);let l;t[2]===r?l=t[3]:(l=(0,$.jsx)(Cr,{outcome:r}),t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,$.jsx)(Tu,{actors:c,className:`top-6`,fallback:l}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]===n.actor?d=t[8]:(d=(0,$.jsx)(Su,{actor:n.actor}),t[7]=n.actor,t[8]=d);let f=!i,p;t[9]!==r||t[10]!==i?(p=K(`font-medium lowercase`,i?`text-muted-foreground opacity-70`:fr(r)),t[9]=r,t[10]=i,t[11]=p):p=t[11];let m;t[12]===p?m=t[13]:(m=(0,$.jsx)(`span`,{className:p}),t[12]=p,t[13]=m);let h;t[14]===r?h=t[15]:(h=Nr(r),t[14]=r,t[15]=h);let g;t[16]===i?g=t[17]:(g=i?(0,$.jsx)(`span`,{className:`sr-only`,children:`, before the latest commits`}):null,t[16]=i,t[17]=g);let _;t[18]!==m||t[19]!==h||t[20]!==g?(_=(0,$.jsxs)(J,{render:m,children:[h,g]}),t[18]=m,t[19]=h,t[20]=g,t[21]=_):_=t[21];let v;t[22]===r?v=t[23]:(v=Mr(r),t[22]=r,t[23]=v);let y;t[24]===v?y=t[25]:(y=(0,$.jsx)(Y,{children:v}),t[24]=v,t[25]=y);let b;t[26]!==_||t[27]!==y||t[28]!==f?(b=(0,$.jsxs)(X,{disabled:f,children:[_,y]}),t[26]=_,t[27]=y,t[28]=f,t[29]=b):b=t[29];let x;t[30]!==b||t[31]!==d?(x=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 text-xs`,children:[d,b]}),t[30]=b,t[31]=d,t[32]=x):x=t[32];let S;t[33]===n.at?S=t[34]:(S=En(n.at),t[33]=n.at,t[34]=S);let C;t[35]===S?C=t[36]:(C=(0,$.jsx)(`span`,{children:S}),t[35]=S,t[36]=C);let w;t[37]===n.path?w=t[38]:(w=n.path?(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,$.jsx)(he,{"aria-hidden":!0,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:n.path})]}):null,t[37]=n.path,t[38]=w);let T;t[39]!==C||t[40]!==w?(T=(0,$.jsx)(`div`,{className:`mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:(0,$.jsxs)(vr,{className:`flex-wrap text-2xs text-muted-foreground`,children:[C,w]})}),t[39]=C,t[40]=w,t[41]=T):T=t[41];let E;t[42]!==x||t[43]!==T?(E=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,T]}),t[42]=x,t[43]=T,t[44]=E):E=t[44];let D;t[45]!==n.id||t[46]!==n.reactions||t[47]!==s.canReact||t[48]!==s.environmentId||t[49]!==s.onRefresh||t[50]!==s.reference?(D=s.canReact||n.reactions.length>0?(0,$.jsx)(uc,{className:`ml-auto justify-end`,reactions:n.reactions,canReact:s.canReact,subjectId:n.id,environmentId:s.environmentId,reference:s.reference,onRefresh:s.onRefresh}):null,t[45]=n.id,t[46]=n.reactions,t[47]=s.canReact,t[48]=s.environmentId,t[49]=s.onRefresh,t[50]=s.reference,t[51]=D):D=t[51];let O;t[52]!==n.url||t[53]!==o?(O=(0,$.jsx)(Ou,{url:n.url,onOpen:o}),t[52]=n.url,t[53]=o,t[54]=O):O=t[54];let k;t[55]!==E||t[56]!==D||t[57]!==O?(k=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start gap-2 py-1.5`,children:[E,D,O]}),t[55]=E,t[56]=D,t[57]=O,t[58]=k):k=t[58];let A;t[59]!==a||t[60]!==n.body||t[61]!==n.markdown||t[62]!==s.environmentId||t[63]!==s.threadRef?(A=n.body?(0,$.jsx)(xu,{body:n.body,markdown:n.markdown,cwd:a,environmentId:s.environmentId,threadRef:s.threadRef}):null,t[59]=a,t[60]=n.body,t[61]=n.markdown,t[62]=s.environmentId,t[63]=s.threadRef,t[64]=A):A=t[64];let j;return t[65]!==k||t[66]!==A||t[67]!==u?(j=(0,$.jsxs)(`div`,{className:`group relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]`,children:[u,k,A]}),t[65]=k,t[66]=A,t[67]=u,t[68]=j):j=t[68],j}function Fu(e){let t=(0,Q.c)(38),{scrollerRef:n,detail:r,environmentId:i,threadRef:a,reference:o,order:s,onOpenCommit:c,onRefresh:l}=e,u=a===void 0?null:a,d,f,p,m,h,g,_;if(t[0]!==r||t[1]!==i||t[2]!==c||t[3]!==l||t[4]!==s||t[5]!==o||t[6]!==n||t[7]!==u){d=xi(r);let e=li(r.commits),a=r.capabilities.reactions===!0,v;t[15]!==i||t[16]!==l||t[17]!==o||t[18]!==a||t[19]!==u?(v={canReact:a,environmentId:i,threadRef:u,reference:o,onRefresh:l},t[15]=i,t[16]=l,t[17]=o,t[18]=a,t[19]=u,t[20]=v):v=t[20];let y=v,b;t[21]===r?b=t[22]:(b=new Map(r.comments.filter(e=>ws(r,e)).map(Lu)),t[21]=r,t[22]=b);let x=b,S=s===`newest`?d:d.toReversed(),C=Ni(S),w=Iu;g=n,_=`scrollbar-gutter-both h-full overflow-y-auto px-4 py-5`,h=`mx-auto max-w-3xl`,f=`relative`,t[23]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute bottom-5 left-[15px] top-1 w-px bg-border/45`}),t[23]=p):p=t[23],m=C.map(t=>{if(t.kind===`comments`)return(0,$.jsx)(ju,{events:t.events,editable:x,cwd:r.workspaceRoot,onOpen:w,reactions:y},`comments:${t.events[0]?.id??`empty`}`);let n=t.event;if(n.kind===`commit`)return(0,$.jsx)(Mu,{event:n,onOpen:c},n.id);let i=ri(n.reviewState);return i===null?(0,$.jsx)(Nu,{event:n},n.id):(0,$.jsx)(Pu,{event:n,outcome:i,stale:Qr(n.at,e),cwd:r.workspaceRoot,onOpen:w,reactions:y},n.id)}),t[0]=r,t[1]=i,t[2]=c,t[3]=l,t[4]=s,t[5]=o,t[6]=n,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_}else d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14];let v;t[24]!==f||t[25]!==p||t[26]!==m?(v=(0,$.jsxs)(`div`,{className:f,children:[p,m]}),t[24]=f,t[25]=p,t[26]=m,t[27]=v):v=t[27];let y;t[28]===d.length?y=t[29]:(y=d.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-center text-muted-foreground`,children:[(0,$.jsx)(Ir.pullRequest,{className:`mb-2 size-5`}),(0,$.jsx)(`p`,{className:`text-xs`,children:`No activity yet.`})]}):null,t[28]=d.length,t[29]=y);let b;t[30]!==h||t[31]!==v||t[32]!==y?(b=(0,$.jsxs)(`div`,{className:h,children:[v,y]}),t[30]=h,t[31]=v,t[32]=y,t[33]=b):b=t[33];let x;return t[34]!==b||t[35]!==g||t[36]!==_?(x=(0,$.jsx)(`div`,{ref:g,className:_,children:b}),t[34]=b,t[35]=g,t[36]=_,t[37]=x):x=t[37],x}function Iu(e){Ct()?.shell.openExternal(e)}function Lu(e){return[e.id,e]}function Ru(e){let t=(0,Q.c)(10),{environmentId:n,reference:r,threadRef:i}=e,a;t[0]!==n||t[1]!==r?(a=Ur.detail({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=kt(a);if(o.error!==null){let e;return t[3]===o.error?e=t[4]:(e=(0,$.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:o.error}),t[3]=o.error,t[4]=e),e}if(o.data===null){let e=o.isPending?`Loading checks…`:`No checks reported`,n;return t[5]===e?n=t[6]:(n=(0,$.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e}),t[5]=e,t[6]=n),n}let s;return t[7]!==o.data.checks||t[8]!==i?(s=(0,$.jsx)(zu,{checks:o.data.checks,threadRef:i}),t[7]=o.data.checks,t[8]=i,t[9]=s):s=t[9],s}function zu(e){let t=(0,Q.c)(23),{checks:n,threadRef:r}=e,i=Sr(r),[a,o]=(0,Z.useState)(!1),s,c,l,u,d,f;if(t[0]!==n||t[1]!==i||t[2]!==a){f=Symbol.for(`react.early_return_sentinel`);bb0:{let{attention:e,running:r,completed:o}=_i(n);c=e.length+r.length>0&&o.length>0;let p=[...e,...r,...a||!c?o:[]];if(n.length===0){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No checks reported`}),t[9]=e):e=t[9],f=e;break bb0}s=Vn,d=`max-h-64`,l=`flex flex-col gap-1`,u=p.map((e,t)=>(0,$.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(Dr,{status:e.status}),(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})}),(0,$.jsx)(Y,{side:`top`,children:e.description??e.name})]}),(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:yr(e)}),e.url===null?null:(0,$.jsx)(`button`,{type:`button`,className:`shrink-0 text-primary hover:underline`,onClick:()=>{e.url&&i(e.url).catch(Bu)},children:`Details`})]},`${t}:${e.name}`))}t[0]=n,t[1]=i,t[2]=a,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f}else s=t[3],c=t[4],l=t[5],u=t[6],d=t[7],f=t[8];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[10]!==l||t[11]!==u?(p=(0,$.jsx)(`ul`,{className:l,children:u}),t[10]=l,t[11]=u,t[12]=p):p=t[12];let m;t[13]!==s||t[14]!==d||t[15]!==p?(m=(0,$.jsx)(s,{className:d,children:p}),t[13]=s,t[14]=d,t[15]=p,t[16]=m):m=t[16];let h;t[17]!==c||t[18]!==a?(h=c?(0,$.jsx)(W,{variant:`ghost`,size:`xs`,"aria-expanded":a,onClick:()=>o(!a),children:a?`Show less`:`Show all`}):null,t[17]=c,t[18]=a,t[19]=h):h=t[19];let g;return t[20]!==m||t[21]!==h?(g=(0,$.jsxs)($.Fragment,{children:[m,h]}),t[20]=m,t[21]=h,t[22]=g):g=t[22],g}function Bu(e){console.error(e),yt.add({type:`error`,title:`Unable to open check details`})}function Vu(e){let t=(0,Q.c)(65),{checksState:n,checks:r,stale:i,environmentId:a,reference:o,threadRef:s,variant:c,className:l,render:u}=e,d=i!==void 0&&i,f=s===void 0?null:s,p=c===void 0?`icon`:c,m,h,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==r||t[1]!==n||t[2]!==l||t[3]!==u||t[4]!==d||t[5]!==p){v=Ar(n);let e;t[19]===r?e=t[20]:(e=r?.filter(Wu).length??0,t[19]=r,t[20]=e),y=e;let i;t[21]===r?i=t[22]:(i=r?.filter(Uu).length??0,t[21]=r,t[22]=i),_=i;let a;t[23]!==r||t[24]!==d?(a=r===void 0||d?null:jr(r),t[23]=r,t[24]=d,t[25]=a):a=t[25],b=a,g=Yr,h=Jr,C=p===`count`,w=p===`count`?`Open checks: ${b??v.label}`:`Checks: ${v.label}`,t[26]!==l||t[27]!==u||t[28]!==p?(T=p===`count`?u??(0,$.jsx)(W,{variant:`ghost`,size:`sm`,className:l}):(0,$.jsx)(`span`,{role:`button`,tabIndex:0,className:K(`inline-flex shrink-0 cursor-pointer items-center`,l)}),t[26]=l,t[27]=u,t[28]=p,t[29]=T):T=t[29],E=Hu,m=v.Icon,x=!0,S=K(`size-3.5`,v.toneClassName),t[0]=r,t[1]=n,t[2]=l,t[3]=u,t[4]=d,t[5]=p,t[6]=m,t[7]=h,t[8]=g,t[9]=_,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E}else m=t[6],h=t[7],g=t[8],_=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18];let D;t[30]!==m||t[31]!==x||t[32]!==S?(D=(0,$.jsx)(m,{"aria-hidden":x,className:S}),t[30]=m,t[31]=x,t[32]=S,t[33]=D):D=t[33];let O;t[34]!==r||t[35]!==_||t[36]!==y||t[37]!==p?(O=p===`count`?(0,$.jsx)($.Fragment,{children:r!==void 0&&y>0?(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[y,`/`,r.length]}):_>0?(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[_,` failed`]}):null}):null,t[34]=r,t[35]=_,t[36]=y,t[37]=p,t[38]=O):O=t[38];let k;t[39]!==h||t[40]!==D||t[41]!==O||t[42]!==C||t[43]!==w||t[44]!==T||t[45]!==E?(k=(0,$.jsxs)(h,{nativeButton:C,"aria-label":w,render:T,onClick:E,children:[D,O]}),t[39]=h,t[40]=D,t[41]=O,t[42]=C,t[43]=w,t[44]=T,t[45]=E,t[46]=k):k=t[46];let A;t[47]===v.label?A=t[48]:(A=(0,$.jsx)(`p`,{className:`mb-2 font-medium text-sm`,children:v.label}),t[47]=v.label,t[48]=A);let j;t[49]===b?j=t[50]:(j=b===null?null:(0,$.jsx)(`p`,{className:`mb-2 text-muted-foreground text-xs`,children:b}),t[49]=b,t[50]=j);let M;t[51]!==r||t[52]!==a||t[53]!==o||t[54]!==d||t[55]!==f?(M=d?(0,$.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Check details are out of date. Refresh the pull request to update them.`}):r===void 0?a!==void 0&&o!==void 0?(0,$.jsx)(Ru,{environmentId:a,reference:o,threadRef:f}):null:(0,$.jsx)(zu,{checks:r,threadRef:f}),t[51]=r,t[52]=a,t[53]=o,t[54]=d,t[55]=f,t[56]=M):M=t[56];let N;t[57]!==A||t[58]!==j||t[59]!==M?(N=(0,$.jsxs)(Kr,{align:`start`,width:`md`,side:`bottom`,children:[A,j,M]}),t[57]=A,t[58]=j,t[59]=M,t[60]=N):N=t[60];let P;return t[61]!==g||t[62]!==k||t[63]!==N?(P=(0,$.jsxs)(g,{children:[k,N]}),t[61]=g,t[62]=k,t[63]=N,t[64]=P):P=t[64],P}function Hu(e){return e.stopPropagation()}function Uu(e){return e.status===`failure`||e.status===`cancelled`}function Wu(e){return e.status===`pending`}var Gu=(0,Z.createContext)(null);function Ku(e){let t=(0,Q.c)(7),{text:n,plain:r,className:i}=e,a=r!==void 0&&r,o=(0,Z.useContext)(Gu);if(a||o===null)return n;let s=o.cwd,c=o.environmentId,l;t[0]===i?l=t[1]:(l=K(`space-y-0 [&_.chat-markdown]:text-inherit`,i),t[0]=i,t[1]=l);let u;return t[2]!==o.cwd||t[3]!==o.environmentId||t[4]!==l||t[5]!==n?(u=(0,$.jsx)(Ys,{text:n,cwd:s,environmentId:c,className:l}),t[2]=o.cwd,t[3]=o.environmentId,t[4]=l,t[5]=n,t[6]=u):u=t[6],u}function qu(e,t,n){return Math.max(Math.min(e+t,n-1),0)}function Ju(e){return[...new Set([...e.excerpts.map(e=>e.path),...e.files.map(e=>e.path)])]}function Yu(e){let t=Ju(e).length;return t===0?`Context, no code`:t===1?`1 file`:`${t} files`}function Xu(e){return e<26?String.fromCharCode(65+e):String(e+1)}function Zu(e){let t=[];return e.hunks.forEach((n,r)=>{let i=n.deletionStart,a=n.additionStart;for(let o of n.hunkContent){if(o.type===`context`){for(let n=0;n<o.lines;n+=1)t.push({kind:`context`,oldLine:i,newLine:a,oldAt:i,newAt:a,text:e.additionLines[o.additionLineIndex+n]??``,hunk:r}),i+=1,a+=1;continue}for(let n=0;n<o.deletions;n+=1)t.push({kind:`deletion`,oldLine:i,newLine:null,oldAt:i,newAt:a,text:e.deletionLines[o.deletionLineIndex+n]??``,hunk:r}),i+=1;for(let n=0;n<o.additions;n+=1)t.push({kind:`addition`,oldLine:null,newLine:a,oldAt:i,newAt:a,text:e.additionLines[o.additionLineIndex+n]??``,hunk:r}),a+=1}}),t}function Qu(e,t){let n=e=>t.side===`new`?e.newLine:e.oldLine,r=e=>{let r=n(e);return r!==null&&r>=t.start&&r<=t.end},i=e.findIndex(r);if(i===-1)return[];let a=e.findLastIndex(r),o=(t,n)=>e[t]?.hunk===e[n]?.hunk;if(t.side===`new`&&e[i]?.kind===`addition`)for(;i>0&&e[i-1]?.kind===`deletion`&&o(i-1,i);)--i;if(t.side===`old`&&e[a]?.kind===`deletion`)for(;a<e.length-1&&e[a+1]?.kind===`addition`&&o(a+1,a);)a+=1;return e.slice(i,a+1)}var $u={context:` `,addition:`+`,deletion:`-`};function ed(e,t,n){if(n.length===0)return``;let r=[`diff --git a/${t} b/${e}`,`--- a/${t}`,`+++ b/${e}`],i=0;for(;i<n.length;){let e=i;for(;e+1<n.length&&n[e+1]?.hunk===n[i]?.hunk;)e+=1;let t=n.slice(i,e+1),a=t[0],o=t.filter(e=>e.oldLine!==null).length,s=t.filter(e=>e.newLine!==null).length,c=o===0?Math.max(a.oldAt-1,0):a.oldAt,l=s===0?Math.max(a.newAt-1,0):a.newAt;r.push(`@@ -${c},${o} +${l},${s} @@`);for(let e of t)r.push(`${$u[e.kind]}${e.text.replace(/\r?\n$/,``)}`);i=e+1}return`${r.join(`
208
+ `)}\n`}function td(e,t){let n=t[0];if(n===void 0||t.some(e=>e.hunk!==n.hunk))return null;let r=e.match(/[^\n]*\n|[^\n]+$/g)??[],i=n.newAt-1,a=t.filter(e=>e.newLine!==null).length,o=n.oldAt-1,s=r.slice(0,i),c=o>=s.length?[...Array.from({length:o-s.length},()=>`
209
+ `),...s]:s.slice(s.length-o),l=t.filter(e=>e.oldLine!==null).map(e=>e.text.endsWith(`
210
+ `)?e.text:`${e.text}\n`);return[...c,...l,...r.slice(i+a)].join(``)}function nd(e){let t=e.notes.map((e,t)=>({marker:Xu(t),note:e}));return{lettered:t,byExcerpt:e.excerpts.map(e=>{let n=new Map;for(let{marker:r,note:i}of t){if(i.path!==e.path||i.line<e.start||i.line>e.end)continue;let t={marker:r,title:i.title},a=n.get(i.line);a===void 0?n.set(i.line,[t]):a.push(t)}return[...n].map(([e,t])=>({line:e,markers:t}))})}}function rd(e){let t=(0,Q.c)(15),{stops:n,position:r,seen:i,onSelect:a}=e,o=i.size,s;t[0]!==a||t[1]!==r||t[2]!==i?(s=(e,t)=>(0,$.jsx)(`li`,{children:(0,$.jsx)(id,{active:r===t,onClick:()=>a(t),lead:(0,$.jsx)(ad,{number:t+1,seen:i.has(t)}),title:e.title,detail:(0,$.jsxs)($.Fragment,{children:[e.attention===null?null:(0,$.jsx)(v,{size:`sm`,variant:`warning`,children:`Look closely`}),(0,$.jsx)(`span`,{children:Yu(e)})]})})},t),t[0]=a,t[1]=r,t[2]=i,t[3]=s):s=t[3];let c=s,l;t[4]!==o||t[5]!==n.length?(l=(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground tabular-nums @max-[56rem]/guide:hidden`,children:[o,` of `,n.length,` read`]}),t[4]=o,t[5]=n.length,t[6]=l):l=t[6];let u;t[7]!==c||t[8]!==n?(u=n.map(c),t[7]=c,t[8]=n,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsx)(`ol`,{className:`flex flex-col gap-0.5`,children:u})}),t[10]=u,t[11]=d);let f;return t[12]!==l||t[13]!==d?(f=(0,$.jsxs)(`nav`,{"aria-label":`Review tour`,className:`flex min-h-0 flex-col gap-4`,children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14],f}function id(e){let t=(0,Q.c)(15),{active:n,onClick:r,lead:i,title:a,detail:o}=e,s=n?`step`:void 0,c=n?`bg-accent text-accent-foreground`:`hover:bg-accent/50`,l;t[0]===c?l=t[1]:(l=K(`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,c),t[0]=c,t[1]=l);let u;t[2]===a?u=t[3]:(u=(0,$.jsx)(`span`,{className:`text-sm text-foreground`,children:a}),t[2]=a,t[3]=u);let d;t[4]===o?d=t[5]:(d=o===null?null:(0,$.jsx)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:o}),t[4]=o,t[5]=d);let f;t[6]!==u||t[7]!==d?(f=(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[u,d]}),t[6]=u,t[7]=d,t[8]=f):f=t[8];let p;return t[9]!==i||t[10]!==r||t[11]!==s||t[12]!==l||t[13]!==f?(p=(0,$.jsxs)(`button`,{type:`button`,"aria-current":s,onClick:r,className:l,children:[i,f]}),t[9]=i,t[10]=r,t[11]=s,t[12]=l,t[13]=f,t[14]=p):p=t[14],p}function ad(e){let t=(0,Q.c)(8),{number:n,seen:r}=e,i=r?`border-success/40 text-success-foreground`:`border-border text-muted-foreground`,a;t[0]===i?a=t[1]:(a=K(`flex size-5 shrink-0 items-center justify-center rounded-full border text-2xs tabular-nums`,i),t[0]=i,t[1]=a);let o;t[2]!==n||t[3]!==r?(o=r?(0,$.jsx)(fe,{"aria-label":`Stop ${n}, read`,className:`size-3`}):n,t[2]=n,t[3]=r,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsx)(`span`,{className:a,children:o}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function od(e){let t=(0,Q.c)(2),{marker:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`inline-flex size-4.5 shrink-0 items-center justify-center rounded-full bg-info/16 font-medium text-3xs text-info-foreground tabular-nums`,children:n}),t[0]=n,t[1]=r),r}function sd(e){let t=(0,Q.c)(12),{notes:n,className:r}=e;if(n.length===0)return null;let i;t[0]===r?i=t[1]:(i=K(`flex min-w-0 flex-col gap-2`,r),t[0]=r,t[1]=i);let a=n.length===1?`1 note`:`${n.length} notes`,o;t[2]===a?o=t[3]:(o=(0,$.jsxs)(`h4`,{className:`flex items-baseline justify-between gap-2 text-xs font-medium text-foreground`,children:[`Notes on this stop`,(0,$.jsx)(`span`,{className:`font-normal text-muted-foreground tabular-nums`,children:a})]}),t[2]=a,t[3]=o);let s;t[4]===n?s=t[5]:(s=n.map(cd),t[4]=n,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,$.jsx)(`ol`,{className:`flex flex-col gap-3`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==i||t[9]!==o||t[10]!==c?(l=(0,$.jsxs)(`section`,{className:i,children:[o,c]}),t[8]=i,t[9]=o,t[10]=c,t[11]=l):l=t[11],l}function cd(e){let{marker:t,note:n}=e;return(0,$.jsxs)(`li`,{className:`flex min-w-0 gap-2`,children:[(0,$.jsx)(od,{marker:t}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`font-medium text-foreground`,children:n.title}),(0,$.jsxs)(`span`,{className:`truncate font-mono text-2xs text-muted-foreground`,children:[n.path.split(`/`).at(-1),`:`,n.line]})]}),n.body.trim()===``?null:(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(Ku,{text:n.body})})]})]},t)}var ld=`${Jo}
211
+ [data-code]::-webkit-scrollbar-thumb {
212
+ background-color: var(--diffs-bg-context);
213
+ }
214
+ `;function ud(e){let t=(0,Q.c)(60),{excerpt:n,file:r,loading:i,notes:a,commenting:o,loadDiffFiles:s,onOpenFile:l}=e,[u,d]=(0,Z.useState)(null),{resolvedTheme:f}=wt(),p;if(t[0]!==n||t[1]!==r){bb0:{if(r===null){p=null;break bb0}let e=Zu(r),i=Qu(e,n);if(i.length===0){p=null;break bb0}let a=Rt(ed(n.path,zt(r),i),`pull-request-guide-excerpt:${n.path}:${n.side}:${n.start}-${n.end}`),o=a?.kind===`files`?a.files[0]:void 0;if(o===void 0){p=null;break bb0}let s={additions:new Set(i.flatMap(md)),deletions:new Set(i.flatMap(pd))},c;t[3]!==s||t[4]!==o||t[5]!==e||t[6]!==i?(c={fileDiff:o,rows:i,shown:i.length,total:e.length,drawn:s},t[3]=s,t[4]=o,t[5]=e,t[6]=i,t[7]=c):c=t[7],p=c}t[0]=n,t[1]=r,t[2]=p}else p=t[2];let m=p,g=m?.rows??null,_;bb1:{if(g===null||g.some(e=>e.hunk!==g[0]?.hunk)){_=null;break bb1}let e;t[8]!==n.end||t[9]!==n.side||t[10]!==n.start||t[11]!==s||t[12]!==g?(e=async e=>{let t=await s(e),r=td(t.newFile.contents,g);return r===null?t:{newFile:t.newFile,oldFile:{name:t.oldFile?.name??t.newFile.name,contents:r,cacheKey:`${t.newFile.cacheKey??t.newFile.name}:excerpt:${n.side}:${n.start}-${n.end}`}}},t[8]=n.end,t[9]=n.side,t[10]=n.start,t[11]=s,t[12]=g,t[13]=e):e=t[13],_=e}let v=_,y;t[14]!==o?.pending||t[15]!==u||t[16]!==n.path||t[17]!==n.side||t[18]!==a||t[19]!==m?.drawn?(y=()=>{let e=new Map,t=(t,n)=>{let r=`${t}:${n}`,i=e.get(r);if(i!==void 0)return i;let a={side:t,lineNumber:n,metadata:{markers:[],pending:[],draft:!1}};return e.set(r,a),a},r=(n,r,i)=>{let a=t(n,r);e.set(`${n}:${r}`,{...a,metadata:i(a.metadata)})},i=n.side===`new`?`additions`:`deletions`;for(let e of a)r(i,e.line,t=>({...t,markers:[...t.markers,...e.markers]}));for(let e of o?.pending??[]){if(e.path!==n.path)continue;let t=mc(e.position),i=pc(t.side);m?.drawn[i].has(t.line)&&r(i,t.line,t=>({...t,pending:[...t.pending,e]}))}if(u!==null){let e=mc(u.position);r(pc(e.side),e.line,fd)}return[...e.values()]},t[14]=o?.pending,t[15]=u,t[16]=n.path,t[17]=n.side,t[18]=a,t[19]=m?.drawn,t[20]=y):y=t[20],o?.pending;let b;t[21]===y?b=t[22]:(b=y(),t[21]=y,t[22]=b);let x=b,S;t[23]===r?S=t[24]:(S=e=>{if(e===null||r===null)return;let t=h(r,e.end,e.endSide??e.side);t!==null&&d({range:e,position:t})},t[23]=r,t[24]=S);let C=S,w=o!==null&&u===null,T=o?.onAskAgent??null,E;t[25]!==u||t[26]!==n.path||t[27]!==r||t[28]!==T?(E=e=>{if(u===null||r===null||T===null)return;let t=c({id:`pull-request-guide:${n.path}:${u.range.start}:${u.range.end}`,sectionId:`pull-request-guide:${n.path}`,sectionTitle:`Review guide`,filePath:n.path,fileDiff:r,range:u.range,text:e});d(null),t!==null&&T(t,e)},t[25]=u,t[26]=n.path,t[27]=r,t[28]=T,t[29]=E):E=t[29];let D=E,O;t[30]===f?O=t[31]:(O=Vt(f),t[30]=f,t[31]=O);let k;t[32]===v?k=t[33]:(k=v===null?{hunkSeparators:`simple`}:{loadDiffFiles:v},t[32]=v,t[33]=k);let A;t[34]!==C||t[35]!==w||t[36]!==f||t[37]!==O||t[38]!==k?(A={diffStyle:`unified`,lineDiffType:`none`,overflow:`scroll`,theme:O,themeType:f,preferredHighlighter:Ta,unsafeCSS:ld,enableGutterUtility:w,enableLineSelection:w,onGutterUtilityClick:C,onLineSelectionEnd:C,...k},t[34]=C,t[35]=w,t[36]=f,t[37]=O,t[38]=k,t[39]=A):A=t[39];let j=A,M;t[40]===n.caption?M=t[41]:(M=n.caption.trim()===``?null:(0,$.jsx)(`figcaption`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(Ku,{text:n.caption,plain:!0})}),t[40]=n.caption,t[41]=M);let N;t[42]!==x||t[43]!==D||t[44]!==o||t[45]!==u||t[46]!==n.end||t[47]!==n.path||t[48]!==n.side||t[49]!==n.start||t[50]!==r||t[51]!==i||t[52]!==T||t[53]!==l||t[54]!==j||t[55]!==m?(N=m===null?i?(0,$.jsxs)(`p`,{className:`rounded-lg border border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[`Loading `,n.path,`...`]}):(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,$.jsx)(`span`,{className:`font-mono text-foreground`,children:n.path}),` lines `,n.start,`-`,n.end,` are not in the loaded diff.`]}),(0,$.jsx)(W,{size:`xs`,variant:`outline`,onClick:()=>l(n.path),children:`Open in Code`})]}):(0,$.jsx)(`div`,{className:`min-w-0 overflow-hidden rounded-lg border border-border/60`,children:(0,$.jsx)(_n,{fileDiff:m.fileDiff,options:j,lineAnnotations:x,selectedLines:u?.range??null,renderAnnotation:e=>(0,$.jsxs)(`div`,{className:`font-sans`,children:[e.metadata.markers.length>0?(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-1 text-xs`,children:e.metadata.markers.map(dd)}):null,e.metadata.pending.map(e=>(0,$.jsx)(hc,{comment:e,onRemove:()=>o?.onRemove(e.id)},e.id)),e.metadata.draft&&u!==null&&o!==null?(0,$.jsx)(wn,{kind:`draft`,rangeLabel:`${n.path}:${mc(u.position).line}`,text:``,placeholder:o.canComment?`Add a comment…`:`Ask the agent about these lines…`,submitLabel:o.canComment?`Add to review`:`Ask agent`,...o.canComment&&T!==null?{secondaryAction:{label:`Ask agent`,onAction:e=>D(e)}}:{},onCancel:()=>d(null),onComment:e=>{if(!o.canComment){D(e);return}o.onComment({path:n.path,oldPath:r===null?null:hd(r,n.path),position:u.position,body:e}),d(null)}}):null]}),renderHeaderMetadata:()=>(0,$.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[n.side===`old`?`removed code, `:``,`showing `,m.shown,` of`,` `,m.total,` diff lines`]}),(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost-muted`,"aria-label":`Open ${n.path} in Code`,onClick:()=>l(n.path),children:(0,$.jsx)(Ce,{"aria-hidden":!0})})]})})}),t[42]=x,t[43]=D,t[44]=o,t[45]=u,t[46]=n.end,t[47]=n.path,t[48]=n.side,t[49]=n.start,t[50]=r,t[51]=i,t[52]=T,t[53]=l,t[54]=j,t[55]=m,t[56]=N):N=t[56];let P;return t[57]!==M||t[58]!==N?(P=(0,$.jsxs)(`figure`,{className:`flex min-w-0 flex-col gap-1.5`,children:[M,N]}),t[57]=M,t[58]=N,t[59]=P):P=t[59],P}function dd(e){return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(od,{marker:e.marker}),(0,$.jsx)(`span`,{className:`text-foreground`,children:e.title})]},e.marker)}function fd(e){return{...e,draft:!0}}function pd(e){return e.oldLine===null?[]:[e.oldLine]}function md(e){return e.newLine===null?[]:[e.newLine]}function hd(e,t){let n=zt(e);return n===t?null:n}function gd(e){let t=(0,Q.c)(11),{file:n,loadDiffFiles:r}=e,{resolvedTheme:i}=wt(),a;t[0]===n?a=t[1]:(a=mn(n),t[0]=n,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=Vt(i),t[2]=i,t[3]=s);let c;t[4]!==r||t[5]!==i||t[6]!==s?(c={diffStyle:`unified`,lineDiffType:`none`,overflow:`scroll`,disableFileHeader:!0,theme:s,themeType:i,preferredHighlighter:Ta,unsafeCSS:Jo,loadDiffFiles:r},t[4]=r,t[5]=i,t[6]=s,t[7]=c):c=t[7];let l=c,u;return t[8]!==o||t[9]!==l?(u=(0,$.jsx)(`div`,{className:`border-t border-border/60`,children:(0,$.jsx)(_n,{fileDiff:o,options:l})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}var _d={tradeoff:`A tradeoff to weigh`,contract:`A contract to check`,product:`A product call`,risk:`A risk to judge`,accessibility:`An accessibility call`};function vd(e){let t=(0,Q.c)(122),{stop:n,index:r,stopCount:i,railOpen:a,onRailOpenChange:o,stopList:s,nextTitle:c,files:u,loadDiffFiles:d,diffLoading:f,commenting:p,onStep:m,onAsk:h,onFinish:g,onOpenFile:_}=e,v;t[0]===n?v=t[1]:(v=nd(n),t[0]=n,t[1]=v);let{lettered:y,byExcerpt:b}=v,x;t[2]===n.excerpts?x=t[3]:(x=new Set(n.excerpts.map(yd)),t[2]=n.excerpts,t[3]=x);let S=x,w,T,D,O,k,A,j,M,N;if(t[4]!==b||t[5]!==p||t[6]!==f||t[7]!==S||t[8]!==u||t[9]!==r||t[10]!==y||t[11]!==d||t[12]!==_||t[13]!==o||t[14]!==m||t[15]!==a||t[16]!==n.attention||t[17]!==n.excerpts||t[18]!==n.files||t[19]!==n.summary||t[20]!==n.title||t[21]!==i||t[22]!==s){let e;t[32]===S?e=t[33]:(e=e=>!S.has(e.path),t[32]=S,t[33]=e);let c=n.files.filter(e);w=y.length>0;let h=w&&`@min-[90rem]/guide:grid-cols-[minmax(0,1fr)_20rem]`;t[34]===h?T=t[35]:(T=K(`grid gap-8`,h),t[34]=h,t[35]=T),D=`flex min-w-0 flex-col gap-5`;let g=r+1,v;t[36]!==i||t[37]!==g?(v=(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground tabular-nums @max-[56rem]/guide:hidden`,children:[`Stop `,g,` of `,i]}),t[36]=i,t[37]=g,t[38]=v):v=t[38];let x;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(W,{size:`xs`,variant:`ghost-muted`,className:`@min-[56rem]/guide:hidden`}),t[39]=x):x=t[39];let P=r+1,F;t[40]!==i||t[41]!==P?(F=(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[`Stop `,P,` of `,i]}),t[40]=i,t[41]=P,t[42]=F):F=t[42];let I=a&&`rotate-180`,L;t[43]===I?L=t[44]:(L=K(I),t[43]=I,t[44]=L);let R;t[45]===L?R=t[46]:(R=(0,$.jsx)(l,{"aria-hidden":!0,className:L}),t[45]=L,t[46]=R);let z;t[47]!==F||t[48]!==R?(z=(0,$.jsxs)(va,{render:x,children:[F,R]}),t[47]=F,t[48]=R,t[49]=z):z=t[49];let B=r===0,V;t[50]===m?V=t[51]:(V=()=>m(-1),t[50]=m,t[51]=V);let H;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(E,{"aria-hidden":!0}),t[52]=H):H=t[52];let U;t[53]!==B||t[54]!==V?(U=(0,$.jsx)(W,{size:`icon-xs`,variant:`outline`,"aria-label":`Previous stop`,disabled:B,onClick:V,children:H}),t[53]=B,t[54]=V,t[55]=U):U=t[55];let ee=r===i-1,te;t[56]===m?te=t[57]:(te=()=>m(1),t[56]=m,t[57]=te);let ne;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(l,{"aria-hidden":!0}),t[58]=ne):ne=t[58];let G;t[59]!==ee||t[60]!==te?(G=(0,$.jsx)(W,{size:`icon-xs`,variant:`outline`,"aria-label":`Next stop`,disabled:ee,onClick:te,children:ne}),t[59]=ee,t[60]=te,t[61]=G):G=t[61];let ie;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsxs)(`span`,{"aria-hidden":!0,className:`ml-1 flex items-center gap-0.5 @max-[30rem]/guide:hidden`,children:[(0,$.jsx)(la,{children:`J`}),(0,$.jsx)(la,{children:`K`})]}),t[62]=ie):ie=t[62];let ae;t[63]!==U||t[64]!==G?(ae=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[U,G,ie]}),t[63]=U,t[64]=G,t[65]=ae):ae=t[65];let oe;t[66]!==v||t[67]!==z||t[68]!==ae?(oe=(0,$.jsxs)(`header`,{className:`flex items-center justify-between gap-2`,children:[v,z,ae]}),t[66]=v,t[67]=z,t[68]=ae,t[69]=oe):oe=t[69];let se;t[70]===s?se=t[71]:(se=(0,$.jsx)(ba,{className:`@min-[56rem]/guide:hidden`,children:(0,$.jsx)(`div`,{className:`pt-3`,children:s})}),t[70]=s,t[71]=se),t[72]!==o||t[73]!==a||t[74]!==oe||t[75]!==se?(O=(0,$.jsxs)(xa,{open:a,onOpenChange:o,children:[oe,se]}),t[72]=o,t[73]=a,t[74]=oe,t[75]=se,t[76]=O):O=t[76];let ce;t[77]===n.title?ce=t[78]:(ce=(0,$.jsx)(`h2`,{className:`text-lg font-semibold text-foreground`,children:n.title}),t[77]=n.title,t[78]=ce);let le;t[79]===n.summary?le=t[80]:(le=n.summary.trim()===``?null:(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(Ku,{text:n.summary})}),t[79]=n.summary,t[80]=le),t[81]!==ce||t[82]!==le?(k=(0,$.jsxs)(`div`,{className:`flex max-w-[60rem] flex-col gap-2`,children:[ce,le]}),t[81]=ce,t[82]=le,t[83]=k):k=t[83],t[84]===n.attention?A=t[85]:(A=n.attention===null?null:(0,$.jsxs)(ca,{controlAlignment:`first-line`,children:[(0,$.jsx)(je,{}),(0,$.jsx)(aa,{children:_d[n.attention.kind]}),(0,$.jsx)(sa,{children:(0,$.jsx)(`div`,{children:(0,$.jsx)(Ku,{text:n.attention.note})})})]}),t[84]=n.attention,t[85]=A),t[86]!==b||t[87]!==p||t[88]!==f||t[89]!==u||t[90]!==d||t[91]!==_||t[92]!==n.excerpts?(j=n.excerpts.length>0?(0,$.jsx)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:(0,$.jsx)(pn,{children:n.excerpts.map((e,t)=>(0,$.jsx)(ud,{excerpt:e,file:u.get(e.path)??null,loading:f,notes:b[t]??[],commenting:p,loadDiffFiles:d,onOpenFile:_},`${e.path}:${e.side}:${e.start}-${e.end}`))})}):null,t[86]=b,t[87]=p,t[88]=f,t[89]=u,t[90]=d,t[91]=_,t[92]=n.excerpts,t[93]=j):j=t[93],t[94]===y?M=t[95]:(M=(0,$.jsx)(sd,{notes:y,className:`@min-[90rem]/guide:hidden`}),t[94]=y,t[95]=M),N=c.length>0?(0,$.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:n.excerpts.length>0?`Also in this stop`:`Files in this stop`}),(0,$.jsx)(pn,{children:(0,$.jsx)(`ul`,{className:`flex flex-col overflow-hidden rounded-lg border border-border/60`,children:c.map(e=>{let t=u.get(e.path),n=t===void 0?null:Gt([t]);return(0,$.jsx)(`li`,{className:`border-border/60 not-first:border-t`,children:(0,$.jsxs)(xa,{children:[(0,$.jsxs)(va,{className:`group flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left text-xs outline-none hover:bg-accent/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[(0,$.jsx)(C,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground group-data-panel-open:rotate-90`}),(0,$.jsx)(re,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate font-mono text-foreground`,children:e.path}),e.note!==void 0&&e.note.trim()!==``?(0,$.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-muted-foreground @max-[30rem]/guide:hidden`,children:(0,$.jsx)(Ku,{text:e.note,plain:!0})}):null,n===null?null:(0,$.jsx)(xr,{additions:n.additions,deletions:n.deletions,className:`shrink-0 font-mono`})]}),(0,$.jsx)(ba,{animate:!1,children:t===void 0?(0,$.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:f?`Loading the diff...`:`This file is not in the loaded diff.`}):(0,$.jsx)(gd,{file:t,loadDiffFiles:d})})]})},e.path)})})})]}):null,t[4]=b,t[5]=p,t[6]=f,t[7]=S,t[8]=u,t[9]=r,t[10]=y,t[11]=d,t[12]=_,t[13]=o,t[14]=m,t[15]=a,t[16]=n.attention,t[17]=n.excerpts,t[18]=n.files,t[19]=n.summary,t[20]=n.title,t[21]=i,t[22]=s,t[23]=w,t[24]=T,t[25]=D,t[26]=O,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N}else w=t[23],T=t[24],D=t[25],O=t[26],k=t[27],A=t[28],j=t[29],M=t[30],N=t[31];let P;t[96]!==h||t[97]!==n.questions?(P=n.questions.length>0||h!==null?(0,$.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[n.questions.length>0?(0,$.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:`Questions to consider`}):null,(0,$.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5`,children:[n.questions.map(e=>h===null?(0,$.jsx)(`div`,{className:`text-sm text-foreground`,children:(0,$.jsx)(Ku,{text:e})},e):(0,$.jsxs)(`button`,{type:`button`,onClick:()=>h(e),className:`flex min-w-0 items-start gap-2 rounded-lg border border-border/60 px-3 py-1.5 text-left text-sm text-foreground outline-none hover:bg-accent/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[(0,$.jsx)(ge,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Ask an agent: `}),(0,$.jsx)(`span`,{children:(0,$.jsx)(Ku,{text:e,plain:!0})})]},e)),h===null?null:(0,$.jsxs)(W,{size:`sm`,variant:`ghost-muted`,onClick:()=>h(``),children:[(0,$.jsx)(ge,{"aria-hidden":!0}),`Ask about this stop`]})]})]}):null,t[96]=h,t[97]=n.questions,t[98]=P):P=t[98];let F;t[99]!==c||t[100]!==g||t[101]!==m?(F=c===null?g===null?null:(0,$.jsxs)(W,{onClick:g,children:[(0,$.jsx)(se,{"aria-hidden":!0}),`Finish review`]}):(0,$.jsxs)(W,{className:`min-w-0`,onClick:()=>m(1),children:[(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Next: `,c]}),(0,$.jsx)(Ae,{"aria-hidden":!0})]}),t[99]=c,t[100]=g,t[101]=m,t[102]=F):F=t[102];let I;t[103]===F?I=t[104]:(I=(0,$.jsx)(`footer`,{className:`flex flex-wrap items-center justify-end gap-3 border-t border-border/60 pt-4`,children:F}),t[103]=F,t[104]=I);let L;t[105]!==P||t[106]!==I||t[107]!==D||t[108]!==O||t[109]!==k||t[110]!==A||t[111]!==j||t[112]!==M||t[113]!==N?(L=(0,$.jsxs)(`article`,{className:D,children:[O,k,A,j,M,N,P,I]}),t[105]=P,t[106]=I,t[107]=D,t[108]=O,t[109]=k,t[110]=A,t[111]=j,t[112]=M,t[113]=N,t[114]=L):L=t[114];let R;t[115]!==w||t[116]!==y?(R=w?(0,$.jsx)(`aside`,{className:`hidden @min-[90rem]/guide:block @min-[90rem]/guide:sticky @min-[90rem]/guide:top-4 @min-[90rem]/guide:self-start`,children:(0,$.jsx)(sd,{notes:y})}):null,t[115]=w,t[116]=y,t[117]=R):R=t[117];let z;return t[118]!==T||t[119]!==L||t[120]!==R?(z=(0,$.jsxs)(`div`,{className:T,children:[L,R]}),t[118]=T,t[119]=L,t[120]=R,t[121]=z):z=t[121],z}function yd(e){return e.path}var bd=new Map;function xd(e){let t=(0,Q.c)(23),{environmentId:n,reference:r,headSha:i,wantedPaths:a}=e,o;t[0]===r?o=t[1]:(o=Ri(r),t[0]=r,t[1]=o);let s=`${n}:${o}:${i}`,c;t[2]===s?c=t[3]:(c={key:s,cursor:null,done:!1,files:bd},t[2]=s,t[3]=c);let[l,u]=(0,Z.useState)(c),d,f,p,m;t[4]!==n||t[5]!==s||t[6]!==l||t[7]!==r||t[8]!==a?(d=l.key===s?l:{key:s,cursor:null,done:!1,files:bd},f=a.some(e=>!d.files.has(e))&&!d.done,p=kt,m=f?Ur.diff({environmentId:n,input:{...r,...d.cursor===null?{}:{cursor:d.cursor}}}):null,t[4]=n,t[5]=s,t[6]=l,t[7]=r,t[8]=a,t[9]=d,t[10]=f,t[11]=p,t[12]=m):(d=t[9],f=t[10],p=t[11],m=t[12]);let h=p(m),g=h.data,_=d.cursor,v,y;t[13]!==_||t[14]!==g||t[15]!==s?(v=()=>{g!==null&&u(e=>{let t=e.key===s?e:{key:s,cursor:null,done:!1,files:bd};if(t.cursor!==_||t.done)return t;let n=Rt(g.patch,`pull-request-guide:${s}:${_??`first`}`),r=new Map(t.files);if(n?.kind===`files`)for(let e of n.files)r.set(Jt(e),e);return{key:s,cursor:g.nextCursor,done:g.nextCursor===null,files:r}})},y=[_,g,s],t[13]=_,t[14]=g,t[15]=s,t[16]=v,t[17]=y):(v=t[16],y=t[17]),(0,Z.useEffect)(v,y);let b=f&&h.error===null,x=f?h.error:null,S;return t[18]!==d.files||t[19]!==h.refresh||t[20]!==b||t[21]!==x?(S={files:d.files,loading:b,error:x,retry:h.refresh},t[18]=d.files,t[19]=h.refresh,t[20]=b,t[21]=x,t[22]=S):S=t[22],S}function Sd(e){let t=(0,Q.c)(63),{environmentId:n,reference:r,guide:i,banner:a,active:o,commenting:s,onAsk:c,onFinish:l,onOpenFile:u}=e,d;t[0]!==n||t[1]!==i.headSha||t[2]!==r?(d=ra(ta(n,r),i.headSha),t[0]=n,t[1]=i.headSha,t[2]=r,t[3]=d):d=t[3];let f=d,p=na(f),m;t[4]===f?m=t[5]:(m=e=>$i.getState().setProgress(f,t=>({...t,...e(t)})),t[4]=f,t[5]=m);let h=m,[g,_]=(0,Z.useState)(!1),v=i.stops.length,y=Math.max(Math.min(p.position,v-1),0),b=i.stops[y]??null,x;t[6]===b?x=t[7]:(x=b===null?[]:Ju(b),t[6]=b,t[7]=x);let S=x,C;t[8]!==n||t[9]!==i.headSha||t[10]!==r||t[11]!==S?(C={environmentId:n,reference:r,headSha:i.headSha,wantedPaths:S},t[8]=n,t[9]=i.headSha,t[10]=r,t[11]=S,t[12]=C):C=t[12];let w=xd(C),T=At(Ur.diffFileContents),E=`pull-request-guide:${f}`,D;t[13]!==n||t[14]!==T||t[15]!==r||t[16]!==E?(D=Qo(T,{environmentId:n,reference:r,commit:null,cacheKey:E}),t[13]=n,t[14]=T,t[15]=r,t[16]=E,t[17]=D):D=t[17];let O=D,k=(0,Z.useRef)(null),A;t[18]!==y||t[19]!==h?(A=e=>{h(t=>({position:e,seen:e>y?new Set(t.seen).add(y):t.seen})),_(!1),k.current?.scrollTo({top:0})},t[18]=y,t[19]=h,t[20]=A):A=t[20];let j=A,M;t[21]!==j||t[22]!==y||t[23]!==v?(M=e=>j(qu(y,e,v)),t[21]=j,t[22]=y,t[23]=v,t[24]=M):M=t[24];let N=M,P;t[25]===N?P=t[26]:(P=e=>{e.defaultPrevented||e.isComposing||Ca()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||(e.key===`j`||e.key===`k`)&&(ea(e.target)||(e.preventDefault(),N(e.key===`j`?1:-1)))},t[25]=N,t[26]=P);let F=(0,Z.useEffectEvent)(P),I;t[27]!==o||t[28]!==F?(I=()=>{if(!o)return;let e=e=>F(e);return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},t[27]=o,t[28]=F,t[29]=I):I=t[29];let L;t[30]===o?L=t[31]:(L=[o],t[30]=o,t[31]=L),(0,Z.useEffect)(I,L);let R;t[32]!==j||t[33]!==i.stops||t[34]!==y||t[35]!==p.seen?(R=(0,$.jsx)(`aside`,{className:`sticky top-4 self-start @max-[56rem]/guide:hidden`,children:(0,$.jsx)(rd,{stops:i.stops,position:y,seen:p.seen,onSelect:j})}),t[32]=j,t[33]=i.stops,t[34]=y,t[35]=p.seen,t[36]=R):R=t[36];let z;t[37]===w.error?z=t[38]:(z=w.error===null?null:(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The diff could not be loaded, so excerpts are missing: `,w.error]}),t[37]=w.error,t[38]=z);let B;t[39]!==s||t[40]!==w.files||t[41]!==w.loading||t[42]!==j||t[43]!==i.stops||t[44]!==O||t[45]!==c||t[46]!==l||t[47]!==u||t[48]!==y||t[49]!==g||t[50]!==N||t[51]!==b||t[52]!==v||t[53]!==p.seen||t[54]!==h?(B=b===null?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This change has no files to tour.`}):(0,$.jsx)(vd,{stop:b,index:y,stopCount:v,railOpen:g,onRailOpenChange:_,stopList:(0,$.jsx)(rd,{stops:i.stops,position:y,seen:p.seen,onSelect:j}),nextTitle:i.stops[y+1]?.title??null,files:w.files,loadDiffFiles:O,diffLoading:w.loading,commenting:s,onStep:N,onAsk:c===null?null:e=>c(y,e),onFinish:l===null?null:()=>{h(e=>({seen:new Set(e.seen).add(y)})),l()},onOpenFile:u},y),t[39]=s,t[40]=w.files,t[41]=w.loading,t[42]=j,t[43]=i.stops,t[44]=O,t[45]=c,t[46]=l,t[47]=u,t[48]=y,t[49]=g,t[50]=N,t[51]=b,t[52]=v,t[53]=p.seen,t[54]=h,t[55]=B):B=t[55];let V;t[56]!==a||t[57]!==z||t[58]!==B?(V=(0,$.jsxs)(`main`,{className:`flex min-w-0 flex-col gap-4`,children:[a,z,B]}),t[56]=a,t[57]=z,t[58]=B,t[59]=V):V=t[59];let H;return t[60]!==R||t[61]!==V?(H=(0,$.jsx)(`div`,{ref:k,className:`@container/guide h-full overflow-y-auto scrollbar-gutter-both`,children:(0,$.jsxs)(`div`,{className:`mx-auto grid max-w-[100rem] gap-6 px-4 py-4 @min-[56rem]/guide:grid-cols-[16rem_minmax(0,1fr)] @min-[90rem]/guide:gap-8 @min-[90rem]/guide:px-6`,children:[R,V]})}),t[60]=R,t[61]=V,t[62]=H):H=t[62],H}function Cd(e){let t=(0,Q.c)(28),{environmentId:n,reference:r,title:i}=e,a;t[0]!==n||t[1]!==r?(a=Ur.reviewGuide({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=kt(a),s;t[3]===n?s=t[4]:(s=Ur.generateReviewGuide.permissionAtom(n),t[3]=n,t[4]=s);let c=Fe(s),l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[5]=l):l=t[5];let u=At(Ur.generateReviewGuide,l),[d,f]=(0,Z.useState)(!1),p=o.data,m=d||p?.run?._tag===`Running`,h;t[6]!==p||t[7]!==n||t[8]!==r||t[9]!==i?(h=()=>$i.getState().watch({environmentId:n,reference:r,title:i,previousGuideAt:p?.guide?.generatedAt??null,previousFailedAt:p?.run?._tag===`Failed`?p.run.failedAt:null,since:Date.now()}),t[6]=p,t[7]=n,t[8]=r,t[9]=i,t[10]=h):h=t[10];let g=(0,Z.useEffectEvent)(h),_;t[11]!==p?.run?._tag||t[12]!==g?(_=()=>{p?.run?._tag===`Running`&&g()},t[11]=p?.run?._tag,t[12]=g,t[13]=_):_=t[13];let v=p?.run?._tag,y;t[14]===v?y=t[15]:(y=[v],t[14]=v,t[15]=y),(0,Z.useEffect)(_,y);let b;t[16]!==n||t[17]!==u||t[18]!==r||t[19]!==m||t[20]!==g?(b=async()=>{if(m)return;f(!0),g();let e=await u({environmentId:n,input:r});f(!1),e._tag===`Failure`&&($i.getState().settle(ta(n,r)),yt.add({type:`error`,title:`Could not start a review guide`,description:di(We(e),`Check the review guide model in Settings → Source Control.`)}))},t[16]=n,t[17]=u,t[18]=r,t[19]=m,t[20]=g,t[21]=b):b=t[21];let x=b,S;return t[22]!==c||t[23]!==p||t[24]!==o||t[25]!==m||t[26]!==x?(S={query:o,data:p,running:m,canWrite:c,write:x},t[22]=c,t[23]=p,t[24]=o,t[25]=m,t[26]=x,t[27]=S):S=t[27],S}function wd(e){let t=(0,Q.c)(68),{environmentId:n,reference:r,title:i,workspaceRoot:a,active:o,canComment:s,onAskAboutLines:c,onAskAboutStop:l,onFinishReview:u,onOpenFile:d,onTourShown:p}=e,m;t[0]!==n||t[1]!==r||t[2]!==i?(m={environmentId:n,reference:r,title:i},t[0]=n,t[1]=r,t[2]=i,t[3]=m):m=t[3];let{query:h,data:g,running:_,canWrite:v,write:y}=Cd(m),b;t[4]!==n||t[5]!==r?(b=ta(n,r),t[4]=n,t[5]=r,t[6]=b):b=t[6];let x=b,S;t[7]===r?S=t[8]:(S=Ri(r),t[7]=r,t[8]=S);let C=S,w=zi(r),T=Li(Ed),E=Li(Td),D;t[9]!==T||t[10]!==s||t[11]!==c||t[12]!==w||t[13]!==E||t[14]!==C?(D=!s&&c===null?null:{canComment:s,pending:w,onComment:e=>{let{path:t,oldPath:n,position:r,body:i}=e;return T(C,{id:Bi(),path:t,...n===null?{}:{oldPath:n},position:r,body:i})},onRemove:e=>E(C,e),onAskAgent:c},t[9]=T,t[10]=s,t[11]=c,t[12]=w,t[13]=E,t[14]=C,t[15]=D):D=t[15];let O=D,k,A;t[16]!==o||t[17]!==x?(k=()=>{if(o)return $i.getState().setShown(x),()=>{$i.getState().shownKey===x&&$i.getState().setShown(null)}},A=[o,x],t[16]=o,t[17]=x,t[18]=k,t[19]=A):(k=t[18],A=t[19]),(0,Z.useEffect)(k,A);let j=g?.guide??null,M=o&&j!==null,N;t[20]===p?N=t[21]:(N=()=>p?.(),t[20]=p,t[21]=N);let P=(0,Z.useEffectEvent)(N),F;t[22]!==P||t[23]!==M?(F=()=>{M&&P()},t[22]=P,t[23]=M,t[24]=F):F=t[24];let I;t[25]===M?I=t[26]:(I=[M],t[25]=M,t[26]=I),(0,Z.useEffect)(F,I);let L=g?.run??null,R=g?.currentHeadSha??null,z=j!==null&&R!==null&&R!==j.headSha,B=L?._tag===`Failed`&&L.headSha===R?L.detail:null,V;t[27]!==v||t[28]!==_||t[29]!==y?(V=(e,t)=>v?(0,$.jsxs)(W,{size:t,variant:`outline`,disabled:_,onClick:()=>void y(),children:[_?(0,$.jsx)(vt,{}):(0,$.jsx)(ne,{"aria-hidden":!0,className:`size-3.5`}),_?`Reading the change...`:e]}):null,t[27]=v,t[28]=_,t[29]=y,t[30]=V):V=t[30];let H=V;if(j===null){if(h.isPending&&g===null){let e;return t[31]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{className:`flex min-h-48 items-center justify-center`,children:(0,$.jsx)(vt,{})}),t[31]=e):e=t[31],e}let e=_?`Writing a review guide`:`No review guide yet`,n;t[32]===e?n=t[33]:(n=(0,$.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e}),t[32]=e,t[33]=n);let r=B??h.error??(_?`An agent is reading the change. A large one takes a few minutes. You can leave; you will be told when it is ready.`:`A guide is a tour of the change: stops through the code in reading order, with the calls only a maintainer can make.`),i;t[34]===r?i=t[35]:(i=(0,$.jsx)(`p`,{className:`max-w-md text-xs text-muted-foreground`,children:r}),t[34]=r,t[35]=i);let a=B===null?`Write guide`:`Try again`,o;t[36]!==a||t[37]!==H?(o=H(a,`sm`),t[36]=a,t[37]=H,t[38]=o):o=t[38];let s;return t[39]!==n||t[40]!==i||t[41]!==o?(s=(0,$.jsxs)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-2 px-4 py-10 text-center`,children:[n,i,o]}),t[39]=n,t[40]=i,t[41]=o,t[42]=s):s=t[42],s}let U;t[43]!==v||t[44]!==B||t[45]!==_||t[46]!==z||t[47]!==H?(U=z||B!==null||_?(0,$.jsxs)(ca,{variant:_?`info`:`warning`,children:[_?(0,$.jsx)(vt,{}):(0,$.jsx)(f,{}),(0,$.jsx)(sa,{children:_?`Rewriting this guide. You will be told when the new one is ready.`:B??`Written before the latest push.`}),!_&&v?(0,$.jsx)(oa,{children:H(`Rewrite`,`xs`)}):null]}):null,t[43]=v,t[44]=B,t[45]=_,t[46]=z,t[47]=H,t[48]=U):U=t[48];let ee=U,te;t[49]!==n||t[50]!==a?(te={environmentId:n,cwd:a},t[49]=n,t[50]=a,t[51]=te):te=t[51];let re;t[52]!==j||t[53]!==l?(re=l===null?null:(e,t)=>{let n=j.stops[e];n!==void 0&&l(n,e,t)},t[52]=j,t[53]=l,t[54]=re):re=t[54];let G;t[55]!==o||t[56]!==ee||t[57]!==O||t[58]!==n||t[59]!==j||t[60]!==u||t[61]!==d||t[62]!==r||t[63]!==re?(G=(0,$.jsx)(Sd,{environmentId:n,reference:r,guide:j,banner:ee,active:o,commenting:O,onAsk:re,onFinish:u,onOpenFile:d}),t[55]=o,t[56]=ee,t[57]=O,t[58]=n,t[59]=j,t[60]=u,t[61]=d,t[62]=r,t[63]=re,t[64]=G):G=t[64];let ie;return t[65]!==te||t[66]!==G?(ie=(0,$.jsx)(Gu,{value:te,children:G}),t[65]=te,t[66]=G,t[67]=ie):ie=t[67],ie}function Td(e){return e.removeComment}function Ed(e){return e.addComment}function Dd(e){let t=(0,Q.c)(12),[n,r]=(0,Z.useState)(null),i=n?.scopeKey===e?n:null,a,o;t[0]!==n||t[1]!==e?(a=()=>{if(!n)return;let t=()=>r(null);if(n.scopeKey!==e){t();return}let i=e=>{e.target instanceof Node&&!n.element.contains(e.target)&&t()},a=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())},o=window.setTimeout(t,3e3);return document.addEventListener(`pointerdown`,i,!0),window.addEventListener(`keydown`,a,!0),window.addEventListener(`blur`,t),()=>{window.clearTimeout(o),document.removeEventListener(`pointerdown`,i,!0),window.removeEventListener(`keydown`,a,!0),window.removeEventListener(`blur`,t)}},o=[n,e],t[0]=n,t[1]=e,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,Z.useEffect)(a,o);let s;t[4]===i?.action?s=t[5]:(s=e=>i?.action===e,t[4]=i?.action,t[5]=s);let c;t[6]!==i||t[7]!==e?(c=(t,n)=>({onClick:a=>{i?.action===t&&i.element===a.currentTarget?(r(null),n()):r({scopeKey:e,action:t,element:a.currentTarget})},onBlur:()=>r(null)}),t[6]=i,t[7]=e,t[8]=c):c=t[8];let l;return t[9]!==s||t[10]!==c?(l={isArmed:s,props:c},t[9]=s,t[10]=c,t[11]=l):l=t[11],l}var Od={merge:`Could not merge this pull request`,ready:`Could not mark this ready for review`,draft:`Could not convert this to a draft`,close:`Could not close this pull request`,reopen:`Could not reopen this pull request`,"update-branch":`Could not update this branch`,"enable-auto-merge":`Could not turn on auto-merge`,"disable-auto-merge":`Could not turn off auto-merge`,revert:`Could not open a revert pull request`,"delete-branch":`Could not delete this branch`,"approve-workflows":`Could not approve workflows`},kd={merge:`The host refused the merge. Check that you have write access, that the checks it requires have passed, and that the branch is not conflicting.`,ready:`The host refused it. Check that you have write access to this repository.`,draft:`The host refused it. Check that you have write access to this repository.`,close:`The host refused it. Check that you have write access, or that you opened it.`,reopen:`The host refused it. Check that you have write access, and that the branch still exists.`,"update-branch":`The host refused it. Check that you have write access to the branch — one from a fork also needs its author to allow edits from maintainers — and that it does not conflict with the base.`,"enable-auto-merge":`The host refused it. Check that this repository allows auto-merge, that you have write access, and that there is something left for it to wait on.`,"disable-auto-merge":`The host refused it. Check that you have write access, and that the merge has not already happened.`,revert:`The host refused it. Check that you have write access and that this pull request was merged on the host.`,"delete-branch":`The host refused it. Check that you have write access to the source repository and that the branch has not moved since this page loaded.`,"approve-workflows":`The host refused it. Check that you have Actions write access and that these workflow runs are still awaiting approval.`},Ad=`The host refused it. A rebase stops at the first commit that does not apply cleanly; updating with a merge commit may still work.`,jd=[{value:`summary`,label:`Summary`},{value:`guide`,label:`Guide`},{value:`timeline`,label:`Timeline`},{value:`code`,label:`Code`}],Md=()=>n(()=>import(`./PullRequestCodeTab-0OaJE6XS.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338])),Nd=(0,Z.lazy)(Md),Pd=new Map,Fd=e=>typeof e==`string`?e:G(e);function Id(e){let t=(0,Q.c)(12),{environments:n,value:r,onChange:i,disabled:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(te,{}),t[0]=o):o=t[0];let s;t[1]===i?s=t[2]:(s=e=>i(e),t[1]=i,t[2]=s);let c;if(t[3]!==a||t[4]!==n){let e;t[6]===a?e=t[7]:(e=e=>(0,$.jsx)(ke,{value:e.environmentId,disabled:a,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(ia,{kind:e.machine??`server`,className:`size-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.label})]})},e.environmentId),t[6]=a,t[7]=e),c=n.map(e),t[3]=a,t[4]=n,t[5]=c}else c=t[5];let l;return t[8]!==s||t[9]!==c||t[10]!==r?(l=(0,$.jsxs)($.Fragment,{children:[o,(0,$.jsx)(ve,{value:r,onValueChange:s,children:c})]}),t[8]=s,t[9]=c,t[10]=r,t[11]=l):l=t[11],l}var Ld=(e,t)=>{e.preventDefault(),e.stopPropagation(),jl({url:t.url,openLabel:kl(Pr.get(t.provider)),position:{x:e.clientX,y:e.clientY}})};function Rd(e){let t=(0,Q.c)(28),{baseBranch:n,freshness:r,pending:i,onUpdate:a,iconClassName:o,className:s,children:c}=e,l;t[0]===r.behindBy?l=t[1]:(l=r.behindBy===null?``:` by ${r.behindBy.toLocaleString()} ${r.behindBy===1?`commit`:`commits`}`,t[0]=r.behindBy,t[1]=l);let u=`This branch is out-of-date with ${n}${l}.`,d;t[2]===s?d=t[3]:(d=K(`inline-flex min-w-0 shrink-0 cursor-help items-center gap-1 rounded-sm text-warning-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,s),t[2]=s,t[3]=d);let p;t[4]!==u||t[5]!==d?(p=(0,$.jsx)(`button`,{type:`button`,"aria-label":u,className:d}),t[4]=u,t[5]=d,t[6]=p):p=t[6];let m;t[7]===o?m=t[8]:(m=K(`size-3.5 shrink-0`,o),t[7]=o,t[8]=m);let h;t[9]===m?h=t[10]:(h=(0,$.jsx)(f,{"aria-hidden":!0,className:m}),t[9]=m,t[10]=h);let g;t[11]!==c||t[12]!==p||t[13]!==h?(g=(0,$.jsxs)(Jr,{openOnHover:!0,delay:0,closeDelay:120,render:p,children:[c,h]}),t[11]=c,t[12]=p,t[13]=h,t[14]=g):g=t[14];let _;t[15]===u?_=t[16]:(_=(0,$.jsx)(`p`,{className:`text-xs text-foreground`,children:u}),t[15]=u,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Changes can be cleanly merged.`}),t[17]=v):v=t[17];let y;t[18]!==r.methods||t[19]!==a||t[20]!==i?(y=r.methods.length>0?(0,$.jsx)(`span`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:r.methods.map(e=>(0,$.jsxs)(W,{size:`xs`,variant:`outline`,disabled:i,onClick:()=>a(e),children:[(0,$.jsx)(Ir.merged,{"aria-hidden":!0,className:`size-3`}),e===`rebase`?`Update with rebase`:`Update branch`]},e))}):null,t[18]=r.methods,t[19]=a,t[20]=i,t[21]=y):y=t[21];let b;t[22]!==_||t[23]!==y?(b=(0,$.jsxs)(Kr,{align:`start`,side:`bottom`,className:`max-w-80`,padding:`compact`,children:[_,v,y]}),t[22]=_,t[23]=y,t[24]=b):b=t[24];let x;return t[25]!==b||t[26]!==g?(x=(0,$.jsxs)(Yr,{children:[g,b]}),t[25]=b,t[26]=g,t[27]=x):x=t[27],x}function zd({environmentId:e,shortcutsEnabled:t,getShortcutContext:n,threadRef:r=null,reference:i,listEntry:c=null,refreshToken:f=0,onActed:h,onClose:g,context:_=`page`,composerDraftTarget:b,onBack:C,onSelectPullRequest:w,onGuideShown:T}){let E=Ke(),O=Je(),k=O.find(t=>t.id===i.projectId&&t.environmentId===e),M=k?.repositoryIdentity,P=E.get(e)?.environment.capabilities.threadPullRequests===!0,F=(0,Z.useMemo)(()=>P?mi(i,M):{projectId:i.projectId,repository:i.repository,number:i.number},[i,M,P]),L=`${F.projectId}:${F.host??``}:${F.repository}#${F.number}`,R=c?.projectId===F.projectId&&c.repository.toLowerCase()===F.repository.toLowerCase()&&(F.host===void 0||c.host.toLowerCase()===F.host.toLowerCase())&&c.number===F.number?c:null,[z,B]=(0,Z.useState)(!1),[ee,re]=(0,Z.useState)(0),[G,ae]=(0,Z.useState)(`summary`),[oe,ce]=(0,Z.useState)(`newest`),[ue,de]=(0,Z.useState)(()=>({pullRequestKey:L,oid:null})),pe=ue.pullRequestKey===L?ue.oid:null,me=e=>{de({pullRequestKey:L,oid:e})},he=e=>{me(e),ae(`code`)},[_e,ye]=(0,Z.useState)(null),we=e=>{me(null),ye(t=>({path:e,nonce:(t?.nonce??0)+1})),Md(),ae(`code`)},Ee=$i(t=>t.openRequestKey===ta(e,F));Ee&&G!==`guide`&&ae(`guide`),(0,Z.useEffect)(()=>{Ee&&$i.getState().requestOpen(null)},[Ee]);let De=`${e}:${L}`,[Oe,Ae]=(0,Z.useState)(()=>({key:De,tabs:new Set([`summary`])})),je=Oe.key===De?Oe.tabs:new Set([G]);(0,Z.useEffect)(()=>{Ae(e=>e.key===De?e.tabs.has(G)?e:{key:De,tabs:new Set(e.tabs).add(G)}:{key:De,tabs:new Set([G])})},[G,De]);let[Me,Ne]=(0,Z.useState)(!1),Le=(0,Z.useRef)({});(0,Z.useEffect)(()=>{Ne(Le.current[G]??!1)},[G]);let ze=Me,Be=(0,Z.useRef)({}),He=(0,Z.useMemo)(()=>({summary:e=>{Be.current.summary=e},timeline:e=>{Be.current.timeline=e},code:e=>{Be.current.code=e}}),[]),Ue=(0,Z.useRef)(null),Ge=(0,Z.useRef)(null),qe=(0,Z.useRef)(null);(0,Z.useLayoutEffect)(()=>{let e=qe.current;e!==null&&(qe.current=null,ze&&e.tab===G&&Be.current[G]===e.scroller&&(e.scroller.scrollTop=Math.max(0,e.scroller.scrollTop+e.delta)))},[ze,G]);let Xe=Yi(e=>e.pullRequestMergeMethod),Qe=Yi(e=>e.setPullRequestMergeMethod),$e=Ea(e,F.projectId),tt=(0,Z.useMemo)(()=>$e(),[$e]),[nt,rt]=(0,Z.useState)(null),it=e=>{rt({pullRequestKey:L,method:e})},at=Dd(L),[ot,st]=(0,Z.useState)(null),ct=Dt(e,ie),lt=kt(Ur.detail({environmentId:e,input:F})),ut=kt(Ur.activity({environmentId:e,input:F})),dt=zr(e),[ft,pt]=(0,Z.useState)(()=>oi(typeof window>`u`?void 0:window.localStorage,e,F));(0,Z.useEffect)(()=>{pt(oi(typeof window>`u`?void 0:window.localStorage,e,F))},[e,L,F.projectId,F.repository,F.number]),(0,Z.useEffect)(()=>{lt.data!==null&&(gi(typeof window>`u`?void 0:window.localStorage,e,F,lt.data),pt(lt.data))},[lt.data,e,L,F.projectId,F.repository,F.number]);let mt=Zr({live:lt.data,cached:ft,reference:F}),ht=(0,Z.useMemo)(()=>R===null?null:Br(R),[R]),gt=(0,Z.useMemo)(()=>lt.data===null?null:{...lt.data,checksState:mr(lt.data.checks)},[lt.data]),_t=Wr(e,F,gt,lt.dataUpdatedAt),vt=(0,Z.useMemo)(()=>Hr(mt,Hr(_t,ht)),[mt,_t,ht]),bt=(0,Z.useMemo)(()=>mt===null||vt===null||vt===mt?mt:{...mt,title:vt.title,state:vt.state,headBranch:vt.headBranch,baseBranch:vt.baseBranch,updatedAt:vt.updatedAt,author:vt.author??mt.author,additions:vt.additions??mt.additions,deletions:vt.deletions??mt.deletions,changedFiles:vt.changedFiles??mt.changedFiles,mergeability:vt.mergeability??mt.mergeability,closedAt:vt.closedAt===void 0?mt.closedAt:vt.closedAt,mergedAt:vt.mergedAt===void 0?mt.mergedAt:vt.mergedAt,isDraft:vt.isDraft??mt.isDraft},[mt,vt]),wt=ut.data,q=(0,Z.useMemo)(()=>bt===null?null:{...bt,capabilities:ct?bt.capabilities:{...bt.capabilities,reactions:!1,edit:{changeRequest:!1,comment:!1}},viewerPermissions:ct?bt.viewerPermissions:{...bt.viewerPermissions,actions:[],comment:!1,resolve:!1,verdicts:[],requestReviewers:!1,updateMethods:[],labels:!1},author:wt?.author??bt.author,reviewers:wt?.reviewers??bt.reviewers,comments:wt?.comments??[],commentCount:wt?.commentCount??0,commentsTruncated:wt?.commentsTruncated??!1,reviewThreads:wt?.reviewThreads??[],commits:wt?.commits??[],reactions:wt?.reactions??[]},[wt,ct,bt]),Nt=q??vt,Pt=Fe(Et),{copyToClipboard:Ft}=xt({target:`pull request reference`,onCopy:e=>yt.add({type:`success`,title:`${e} copied`}),onError:(e,t)=>yt.add({type:`error`,title:`Failed to copy ${t}`,description:e.message})}),It=(0,Z.useEffectEvent)(e=>{!t||e.defaultPrevented||Ca()||or(e,Pt,{context:n()})===`pullRequest.copyNumber`&&(e.preventDefault(),e.stopPropagation(),e.repeat||Ft(`#${F.number}`,`PR number`))});(0,Z.useEffect)(()=>{let e=e=>It(e);return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]),(0,Z.useEffect)(()=>{q?.autoMergeMethod!==void 0&&it(q.autoMergeMethod)},[q?.autoMergeMethod,L]);let Lt=q===null?null:Ze(q.url),Rt=Pr.get(q?.provider),zt=(0,Z.useMemo)(()=>({repositoryUrl:Lt===null?null:Rt.referenceAutolinkRepositoryUrl(Lt),threadRef:r}),[Rt,Lt,r]),Bt=q?.author&&Lt!==null?Rt.authorProfileUrl(q.author.login,Lt):null,Vt=Nt?si(Nt.provider,Nt.number,Nt.headBranch,q?.headRepositoryNameWithOwner,Ze(Nt.url)):ei(F,M),Ht=(0,Z.useCallback)(e=>{yt.add({type:`error`,title:`Could not copy checkout command`,description:e.message})},[]),Ut=kt(q===null?null:Mt.listRefs({environmentId:e,input:{cwd:q.workspaceRoot,includeMatchingRemoteRefs:!0,limit:2}})),Wt=q!==null&&Pi(q.baseBranch,Ut.data?.refs??[]),Gt=Cc(e,(0,Z.useMemo)(()=>q===null||q.capabilities.stacks!==!0||!P?null:{...F,host:F.host??et(q.url)?.host},[q,F,P])),Kt=Gt.data,qt=P&&q?.capabilities.stacks===!0&&q.capabilities.stackActions===!0&&E.get(e)?.environment.capabilities.pullRequestStackActions===!0,Jt=Ai({supportsStackActions:qt,hasStack:Kt!==null,stackPending:!Gt.isFresh,stackError:Gt.error}),Yt=ut.isPending&&wt===null,Xt=wt===null?ut.error:null,Zt=(0,Z.useCallback)(()=>{lt.refresh(),ut.refresh(),Gt.refresh()},[ut.refresh,lt.refresh,Gt.refresh]),[Qt,$t]=(0,Z.useState)(0),en=Qt+(dt??0),tn=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!bt)return;let e={key:De,updatedAt:bt.updatedAt};if(ti(tn.current,e)){if(ut.isPending)return;ut.refresh(),$t(e=>e+1)}tn.current=e},[ut.isPending,ut.refresh,bt,De]),Lc(()=>{lt.refresh()},{key:`pull-request:${e}:${L}`});let nn=At(Ur.invalidate,{reportFailure:!1}),[rn,an]=(0,Z.useState)(!1),on=rn||lt.isPending,sn=(0,Z.useCallback)(async()=>{an(!0);try{await nn({environmentId:e,input:{reference:F}}),Zt(),$t(e=>e+1)}finally{an(!1)}},[e,nn,F,Zt]),cn=(0,Z.useRef)(f);(0,Z.useEffect)(()=>{cn.current!==f&&(cn.current=f,sn())},[f,sn]);let ln=At(Ur.runAction,{reportFailure:!1}),un=At(Ur.comment,{reportFailure:!1}),[dn,fn]=(0,Z.useState)(null),pn=dn!==null,mn=At(Ur.update,{reportFailure:!1}),[hn,gn]=(0,Z.useState)(null),_n=hn?.pullRequestKey===L?hn.text:null,[vn,yn]=(0,Z.useState)(!1),bn=Qi(),{environments:xn}=St(),Sn=(0,Z.useMemo)(()=>{let t=O.find(t=>t.id===F.projectId&&t.environmentId===e)?.repositoryIdentity;return Ye(t,F.repository,F.number)},[e,O,F.number,F.projectId,F.repository]),Cn=(0,Z.useMemo)(()=>_===`page`?bc({environmentId:e,projectId:F.projectId},O,xn.map(e=>({environmentId:e.environmentId,label:e.label,machine:m(e.serverConfig)}))):[],[_,e,xn,O,F.projectId]),[wn,Tn]=(0,Z.useState)(null),Dn=wn?.pullRequestKey===L?wn.environmentId:e,kn=Cn.find(e=>e.environmentId===Dn)??null,An=kn?.environmentId??e,jn=kn?.workspaceRoot??q?.workspaceRoot??k?.workspaceRoot??null,Mn=Dt(An,Te),Nn=Da({environmentId:An,cwd:jn}),Pn=async(t,n,r)=>{h?.(t,`sent`);let i=await ln({environmentId:e,input:{...F,action:t,...n?{mergeMethod:n}:{},...r?{updateMethod:r}:{}}});if(fn(null),i._tag===`Failure`){let e=We(i),n=r===`rebase`?Ad:kd[t];return yt.add({type:`error`,title:Od[t],description:di(e,n)}),h?.(t,`failed`),!1}return t===`revert`&&yt.add({type:`success`,title:`Revert pull request opened`}),t===`delete-branch`&&yt.add({type:`success`,title:`Branch deleted`}),Ti(t)?sn():Zt(),h?.(t,`done`),!0},Fn=async(e,t,n)=>!ct||dn!==null?!1:(fn(e),Pn(e,t,n)),In=async(t,n)=>!ct||dn!==null?{commentPosted:!1}:(fn(n),(await un({environmentId:e,input:{...F,body:t}}))._tag===`Failure`?(fn(null),yt.add({type:`error`,title:`Could not post the comment`}),{commentPosted:!1}):(await Pn(n)||Zt(),{commentPosted:!0})),Ln=async t=>{let n=t.trim();if(!ct||q===null||vn)return;if(n.length===0||n===q.title){gn(null);return}yn(!0);let r=await mn({environmentId:e,input:{...F,title:n}});if(yn(!1),r._tag===`Failure`){yt.add({type:`error`,title:`The title could not be saved`,description:di(We(r),`The host refused the new title.`)});return}gn(null),Zt()},Rn=b??null,zn=Nn.isAllowed&&Mn,Vn=Rn!==null||zn,Hn=ui(Rn!==null),Un=Cd({environmentId:e,reference:F,title:q?.title??null}),Wn=()=>{Un.write(),Un.data?.guide??ae(`guide`)},Gn=(e,t)=>{let n=p.getState(),r=n.getComposerDraft(e),i=Fd(e),a=new Set((r?.reviewComments??[]).map(e=>e.id)),o=new Set((t.reviewComments??[]).filter(e=>a.has(e.id)).map(e=>e.id)),s=ai(r?.prompt??``,r?.reviewComments??[],o),c=Fi({prompt:s,lastHandoffPrompt:Pd.get(i)},t.prompt);Pd.set(i,t.prompt),n.setPrompt(e,c),n.setReviewComments(e,yi(r?.reviewComments??[],t.reviewComments??[]));for(let r of t.reviewComments??[])o.has(r.id)&&n.addReviewComment(e,r,{allowDuplicateReference:!0,insertAtCaret:!1})},Kn=async(e,t,n)=>{let r=n??await bn(e).then(e=>e,()=>null);return r===null?null:(t===null||Gn(r.draftId,t),r)},qn=async(t,n,r)=>{if(!q||ot!==null)return;if(Rn!==null){Gn(Rn,n),yt.add({type:`success`,title:`Added to the composer`,description:n.prompt.length>0?`The question is in the composer — read it over, then send.`:`The pull request is in the composer — type your question, then send.`});return}st(t);let i=V(An,kn?.projectId??q.projectId),a=await Kn(i,n);if(st(null),a!==null&&r?.keepGuide===!0){let t=p.getState().getDraftSession(a.draftId);t!==null&&(jt.getState().openPullRequest(A(t.environmentId,t.threadId),{environmentId:e,projectId:F.projectId,...F.host===void 0?{}:{host:F.host},repository:F.repository,number:F.number,url:q.url}),$i.getState().requestOpen(ta(e,F)))}if(a===null){yt.add({type:`error`,title:`Could not open a thread`,description:`Try again from the project, or open a thread first.`});return}yt.add({type:`success`,title:`Asked in a thread`,description:n.prompt.length>0?`The question is in the composer — read it over, then send.`:`The pull request is in the composer — type your question, then send.`})},Jn=async(e,t,n=`worktree`)=>{if(!Nt||ot!==null)return;if(Rn!==null&&t!==null){Gn(Rn,t),yt.add({type:`success`,title:`Added to the composer`,description:`The task is in the composer — read it over, then send.`});return}if(jn===null||!Nn.isAllowed||!Ot(An,`source-control:write`)||n===`worktree`&&!Ot(An,`orchestration:operate`))return;st(e);let r=yt.add({type:`loading`,title:`Preparing the pull request checkout...`}),i=V(An,kn?.projectId??Nt.projectId),a=await bn(i).then(e=>e,()=>null);if(a===null){st(null),yt.update(r,{type:`error`,title:`Could not open a thread for the checkout`,description:`Try again from the project, or open a thread first.`});return}let o=await Nn.run({reference:Nt.url,mode:n,threadId:a.threadId});if(o._tag===`Failure`){st(null);let e=Nn.error instanceof Error?Nn.error.message:null;yt.update(r,{type:`error`,title:`Could not prepare the pull request checkout`,...e?{description:e}:{}});return}if(!await bn(i,{branch:o.value.branch,worktreePath:o.value.worktreePath,envMode:o.value.worktreePath===null?`local`:`worktree`}).then(e=>e!==null,()=>!1)){st(null),yt.update(r,{type:`error`,title:`Checked out, but the thread stayed where it was`,description:`The checkout is ready on \`${o.value.branch}\`. Point a thread at it from the branch picker, then ask again.`});return}st(null);let s={type:`warning`,title:`Checked out, but not on the latest commits`,description:`The checkout could not be moved onto the pull request's latest commits, so the code there is older than the pull request. Uncommitted work or local commits keep it where it is.`};if(t===null){yt.update(r,o.value.isOnPullRequestHead?{type:`success`,title:n===`local`?`Checked out here`:`Checked out`,description:n===`local`?`This repository is on the pull request's branch, with a thread open on it.`:`The pull request is in its own worktree, with a thread open on it.`}:s);return}await Kn(i,t,a),yt.update(r,o.value.isOnPullRequestHead?{type:`success`,title:`Checkout ready`,description:`The task is in the composer — read it over, then send.`}:s)},Yn=()=>{q&&qn(`ask`,{...Oi({number:q.number,title:q.title,url:q.url,headBranch:q.headBranch,baseBranch:q.baseBranch,state:q.state,isDraft:q.isDraft})})},Xn=()=>{q&&qn(`explain`,{...ji({number:q.number,title:q.title,url:q.url,headBranch:q.headBranch,baseBranch:q.baseBranch,state:q.state,isDraft:q.isDraft})})},Zn=(e,t,n)=>{q&&qn(`guide-stop:${t}`,vi({number:q.number,title:q.title,url:q.url,headBranch:q.headBranch,baseBranch:q.baseBranch,state:q.state,isDraft:q.isDraft,stop:{index:t,title:e.title,summary:e.summary,attention:e.attention?.note??null,excerpts:e.excerpts},question:n}),{keepGuide:!0})},Qn=(e,t)=>{q&&qn(`selection:${e.comment.id}`,wi({number:q.number,title:q.title,url:q.url,headBranch:q.headBranch,baseBranch:q.baseBranch,state:q.state,isDraft:q.isDraft,comment:e.comment,request:e.request}),t)},$n=e=>{Nt&&Jn(`checkout:${e}`,null,e)},er=e=>{q&&Jn(ci(e),bi({number:q.number,title:q.title,url:q.url,headBranch:q.headBranch,baseBranch:q.baseBranch,finding:e}))},tr=()=>{q&&Jn(`findings`,Di({number:q.number,title:q.title,url:q.url,headBranch:q.headBranch,baseBranch:q.baseBranch,reviewThreads:q.reviewThreads,comments:q.comments,checks:Or?[]:q.checks,commentsTruncated:q.commentsTruncated}))},nr=()=>{Nt&&Jn(`conflicts`,{prompt:Si({number:Nt.number,url:Nt.url,headBranch:Nt.headBranch,baseBranch:Nt.baseBranch})})},rr=q?q.capabilities.mergeMethods.filter(e=>q.mergeCapabilities[e]):[],ir=nt?.pullRequestKey===L?nt.method:null,ar=hi(rr,ir,tt,Xe),cr=Mi[ar],lr=`Auto-merge (${cr.toLowerCase()})`,ur=q?.state===`open`&&q.mergeability===`conflicting`,pr=q?.state===`open`&&q.autoMergeEnabled===!0,hr=q?.autoMergeMethod,gr=hr?`Auto-merge (${Mi[hr].toLowerCase()})`:`Auto-merge`,_r=q?.state===`open`?q.workflowApprovalsRequired??0:0,yr=q===null?null:Ii(q),br=Tt(e,e=>e.reviewGuidesEnabled),xr=jd.filter(e=>(e.value!==`code`||q===null||q.capabilities.diff)&&(e.value!==`guide`||br));(0,Z.useEffect)(()=>{xr.some(e=>e.value===G)||ae(`summary`)},[G,xr]);let Sr=e=>q?.capabilities.actions.includes(e)===!0&&q.viewerPermissions.actions.includes(e),wr=q?mr(q.checks):null,Er=vt?.checksState===void 0?wr:vt.checksState,Dr=Er!==`failing`&&q?.checks.some(e=>e.status===`action-required`)?`pending`:Er,Or=Dr!==wr,kr=q?ni({state:q.state,isDraft:q.isDraft,mergeability:q.mergeability,checksState:Dr,autoMergeEnabled:q.autoMergeEnabled,hasMergeMethod:rr.length>0,canMerge:Jt&&Sr(`merge`),canMarkReady:Sr(`ready`),canEnableAutoMerge:Jt&&Sr(`enable-auto-merge`)}):null,Mr=q?.state===`open`&&Sr(q.isDraft?`ready`:`draft`)&&!(q.isDraft&&kr===`ready`),Nr=Jt&&q?.state===`open`&&(pr&&Sr(`disable-auto-merge`)||!pr&&kr!==`enable-auto-merge`&&!q.isDraft&&!ur&&Sr(`enable-auto-merge`)&&rr.length>0),Fr=Jt&&q?.state===`open`&&(kr===`enable-auto-merge`||kr===`auto-merge-armed`)&&Sr(`merge`)&&!q.isDraft&&!ur&&rr.length>0,Lr=q?.state===`open`&&Sr(`merge`)&&!q.isDraft&&!ur&&rr.length>1,Rr=q?dr({state:q.state,isDraft:q.isDraft}):null,Vr=q!==null&&ki(q),Gr=xn.some(t=>t.environmentId===e&&t.connection.phase===`connected`),Kr=async()=>{q!==null&&await Ct()?.dialogs.confirm([`Delete branch ${q.headBranch}?`,`This deletes ${q.headBranch} from ${q.headRepositoryNameWithOwner??q.repository}. Local branches and worktrees are not changed.`].join(`
215
+ `),{variant:`destructive`})&&Fn(`delete-branch`)},qr=_r>0&&!Or&&Sr(`approve-workflows`),Jr=Or?Dr===null?`No checks reported`:Ar(Dr).label:q?jr(q.checks):null,Yr=q&&!q.commentsTruncated?pi(q.comments,q.commits).filter(e=>e.outcome===`approved`&&!e.stale).length:0,Qr=_===`page`?(0,$.jsxs)(I,{children:[(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(Re,{disabled:ot!==null||jn===null,render:(0,$.jsxs)(W,{size:`xs`,variant:`outline`,"aria-label":ot?.startsWith(`checkout`)?`Checking out...`:`Check out`,children:[(0,$.jsx)(D,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[35rem]/pr-header:hidden`,children:ot?.startsWith(`checkout`)?`Checking out...`:`Check out`}),(0,$.jsx)(l,{"aria-hidden":!0,className:`size-3.5 text-muted-foreground`})]})})}),(0,$.jsx)(Y,{children:`Check out this pull request`})]}),(0,$.jsxs)(Pe,{align:`end`,side:`bottom`,children:[(0,$.jsxs)(s,{disabled:!zn,onClick:()=>$n(`worktree`),children:[(0,$.jsx)(D,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`In a separate worktree`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Its own folder and thread. Nothing you have open moves.`})]})]}),(0,$.jsxs)(s,{disabled:!Nn.isAllowed,onClick:()=>$n(`local`),children:[(0,$.jsx)(Ve,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`In this repository`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:"Switches the branch you are working in, like `gh pr checkout`."})]})]}),Cn.length>0?(0,$.jsx)(Id,{environments:Cn,value:An,onChange:e=>Tn({pullRequestKey:L,environmentId:e}),disabled:ot!==null}):null]})]}):null,$r=(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(W,{size:`xs`,variant:`destructive-outline`,disabled:ot!==null||Rn===null&&jn===null,onClick:nr,"aria-label":ot===`conflicts`?`Preparing...`:`Resolve conflicts`,children:[(0,$.jsx)(Ir.conflicting,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:ot===`conflicts`?`Preparing...`:`Resolve conflicts`})]})})}),(0,$.jsx)(Y,{side:`top`,children:ot===`conflicts`?`Preparing...`:`Resolve conflicts`})]});return lt.isPending&&!q?(0,$.jsx)(yl,{seed:R,summary:vt,checkoutCommand:Vt,onCheckoutError:Ht,number:F.number,tabs:xr,activeTab:G,...C?{onBack:C}:{},...g?{onClose:g}:{},actions:Nt?(0,$.jsxs)(On,{delay:150,closeDelay:150,timeout:400,children:[Nt.state===`open`&&Nt.mergeability===`conflicting`?$r:null,Qr]}):void 0}):(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 w-full flex-col bg-background`,children:[z&&q?(0,$.jsx)(rl,{display:`picker`,environmentId:e,reference:F,url:q.url,threadRef:null,onPickerOpenChange:B},`${e}:${q.url}`):null,(0,$.jsxs)(`div`,{className:K(`@container/pr-header grid min-w-0 shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2`,q&&`border-b border-border/60`,!q&&!g&&`hidden`),children:[(0,$.jsxs)(`div`,{className:`pl-4 grid h-7 min-w-0 items-center overflow-hidden`,children:[(0,$.jsx)(`div`,{"aria-hidden":ze,inert:ze,className:K(`col-start-1 row-start-1 flex min-w-0 items-center gap-1 text-sm text-muted-foreground transition-[opacity,transform] ease-out motion-reduce:transform-none motion-reduce:transition-none sm:text-xs`,ze?`pointer-events-none -translate-y-1 opacity-0 duration-100`:`translate-y-0 opacity-100 delay-50 duration-150`),children:q&&Rr?(0,$.jsxs)($.Fragment,{children:[C?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(W,{size:`icon-micro`,variant:`ghost-muted`,onClick:C,className:`-ml-1.5`,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(be,{"aria-hidden":!0,className:`size-3.5`})})}),(0,$.jsx)(Y,{side:`top`,children:`Back to pull requests`})]}):null,(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:Lt?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void Ct()?.shell.openExternal(Lt),className:`min-w-0 cursor-pointer truncate text-left font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:q.repository}):(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium text-muted-foreground`,children:q.repository})}),(0,$.jsx)(Y,{side:`top`,children:Lt?`Open ${q.repository} repository`:q.repository})]}),(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void Ct()?.shell.openExternal(q.url),onContextMenu:e=>Ld(e,q),className:K(`inline-flex shrink-0 cursor-pointer items-center gap-0.5 font-medium underline-offset-2 hover:underline`,Rr.toneClassName),"aria-label":`Open pull request #${q.number} on host`,children:[`#`,q.number,(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-2.5`})]})}),(0,$.jsx)(Y,{side:`top`,children:kl(Rt)})]})]}):null}),(0,$.jsx)(`div`,{"aria-hidden":!ze,inert:!ze,className:K(`col-start-1 row-start-1 flex min-w-0 items-center gap-1 text-sm text-muted-foreground transition-[opacity,transform] ease-out motion-reduce:transform-none motion-reduce:transition-none sm:text-xs`,ze?`translate-y-0 opacity-100 delay-50 duration-150`:`pointer-events-none translate-y-1 opacity-0 duration-100`),children:q&&Rr?(0,$.jsxs)($.Fragment,{children:[C?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(W,{size:`icon-micro`,variant:`ghost-muted`,tabIndex:ze?0:-1,onClick:C,className:`-ml-1.5`,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(be,{"aria-hidden":!0,className:`size-3.5`})})}),(0,$.jsx)(Y,{side:`top`,children:`Back to pull requests`})]}):null,(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(`button`,{type:`button`,tabIndex:ze?0:-1,onClick:()=>void Ct()?.shell.openExternal(q.url),onContextMenu:e=>Ld(e,q),className:K(`inline-flex shrink-0 cursor-pointer items-center gap-0.5 font-medium underline-offset-2 hover:underline`,Rr.toneClassName),"aria-label":`Open pull request #${q.number} on host`,children:[`#`,q.number,(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-2.5`})]})}),(0,$.jsx)(Y,{side:`top`,children:kl(Rt)})]}),(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:q.title})}),(0,$.jsx)(Y,{side:`top`,children:q.title})]})]}):null})]}),(0,$.jsxs)(`div`,{className:`mr-4 flex h-7 shrink-0 items-center justify-end gap-1`,children:[q?(0,$.jsxs)(On,{delay:150,closeDelay:150,timeout:400,children:[!Kt&&qt&&Gt.error?(0,$.jsx)(W,{variant:`ghost`,size:`xs`,onClick:Gt.refresh,children:`Retry stack lookup`}):null,Kt?(0,$.jsx)(Vc,{hostLabel:Rt.label,stack:Kt,notice:Gt.notice,onRetry:Gt.error?Gt.refresh:void 0,reference:F,environmentId:e,onSelect:w,mergeMethod:ar,canMerge:Gt.isFresh&&qt&&Sr(`merge`)&&rr.length>0,canRebase:Gt.isFresh&&qt&&q.viewerPermissions.stackRebase===!0,onActed:()=>{Zt(),h?.()}}):null,_===`page`?(0,$.jsx)(rl,{display:`count`,environmentId:e,reference:F,url:q.url,threadRef:null}):null,pr&&kr!==`auto-merge-armed`?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(v,{size:`control`,variant:`info`,role:`img`,"aria-label":gr,children:[(0,$.jsx)(Ir.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:gr})]})}),(0,$.jsxs)(Y,{side:`top`,children:[gr,`: the host will merge this on its own once its requirements are met`]})]}):null,kr===`resolve`?$r:kr===`ready`?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(W,{size:`xs`,variant:`default`,disabled:pn,onClick:()=>void Fn(`ready`),"aria-label":`Ready for review`,children:[(0,$.jsx)(Ir.pullRequest,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:`Ready for review`})]})})}),(0,$.jsx)(Y,{side:`top`,children:`Ready for review`})]}):kr===`enable-auto-merge`?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(W,{size:`xs`,variant:`default`,disabled:pn,...at.props(`enable-auto-merge`,()=>void Fn(`enable-auto-merge`,ar)),"aria-label":dn===`enable-auto-merge`?`Enabling...`:at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr,children:[at.isArmed(`enable-auto-merge`)?(0,$.jsx)(fe,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Ir.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(Tc,{className:`@max-[30rem]/pr-header:hidden`,children:(0,$.jsxs)(`span`,{className:`grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:lr}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:dn===`enable-auto-merge`?`Enabling...`:at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr})]})})]})})}),(0,$.jsx)(Y,{side:`top`,children:dn===`enable-auto-merge`?`Enabling...`:at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr})]}):kr===`auto-merge-armed`?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(v,{size:`control`,variant:`info`,role:`img`,"aria-label":gr,children:[(0,$.jsx)(Ir.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:gr})]})}),(0,$.jsxs)(Y,{side:`top`,children:[gr,`: the host will merge this on its own once its requirements are met`]})]}):kr===`merge`?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(W,{size:`xs`,variant:`default`,disabled:pn,...at.props(`merge`,()=>void Fn(`merge`,ar)),"aria-label":dn===`merge`?`Merging...`:at.isArmed(`merge`)?`Confirm merge?`:cr,children:[at.isArmed(`merge`)?(0,$.jsx)(fe,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Ir.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(Tc,{className:`@max-[30rem]/pr-header:hidden`,children:(0,$.jsxs)(`span`,{className:`grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:cr}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:dn===`merge`?`Merging...`:at.isArmed(`merge`)?`Confirm merge?`:cr})]})})]})})}),(0,$.jsx)(Y,{side:`top`,children:dn===`merge`?`Merging...`:at.isArmed(`merge`)?`Confirm merge?`:cr})]}):(kr===`merged`||kr===`closed`)&&Rr!==null?(0,$.jsx)(v,{size:`control`,variant:`outline`,children:(0,$.jsxs)(`span`,{className:K(`flex items-center gap-1`,Rr.toneClassName),children:[(0,$.jsx)(Rr.Icon,{className:`size-3.5`}),Rr.label]})}):null,Qr,(0,$.jsxs)(I,{children:[(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(Re,{render:(0,$.jsx)(W,{"aria-label":on?`Refreshing pull request`:`More pull request actions`,size:`icon-xs`,variant:`ghost-muted`}),children:on?(0,$.jsx)(_a,{refreshing:!0,size:`md`}):(0,$.jsx)(j,{className:`size-4`})})}),(0,$.jsx)(Y,{children:on?`Refreshing pull request`:`More pull request actions`})]}),(0,$.jsxs)(Pe,{align:`end`,side:`bottom`,children:[(0,$.jsx)(rl,{display:`menu-item`,environmentId:e,reference:F,url:q.url,threadRef:r??(typeof b==`object`?b:null),onPickerOpenChange:B}),(0,$.jsxs)(s,{disabled:on,onClick:()=>void sn(),children:[(0,$.jsx)(_a,{size:`sm`,refreshing:on}),`Refresh`]}),(0,$.jsxs)(s,{disabled:ot!==null,onClick:Yn,children:[(0,$.jsx)(ge,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:ot===`ask`?`Opening...`:`Ask a question`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Rn===null?`Opens a thread that knows which pull request you mean.`:`Adds the pull request to this thread's composer.`})]})]}),(0,$.jsxs)(s,{disabled:ot!==null,onClick:Xn,children:[(0,$.jsx)(H,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:ot===`explain`?`Opening...`:`Explain this PR`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`A walk through the diff and what to read closely.`})]})]}),(0,$.jsxs)(s,{disabled:ot!==null||!Vn,onClick:tr,children:[(0,$.jsx)(d,{className:`size-3.5`}),ot===`findings`?`Preparing...`:Hn.fixFindings]}),br&&Un.canWrite?(0,$.jsxs)(s,{disabled:Un.running,onClick:Wn,children:[(0,$.jsx)(ne,{className:`size-3.5`}),Un.running?`Writing guide...`:Un.data?.guide==null?`Write guide`:`Rewrite guide`]}):null,Cn.length>0?(0,$.jsx)(Id,{environments:Cn,value:An,onChange:e=>Tn({pullRequestKey:L,environmentId:e}),disabled:ot!==null}):null,(0,$.jsx)(te,{}),q.state===`open`?(0,$.jsxs)($.Fragment,{children:[Mr?(0,$.jsxs)(s,{disabled:pn,onClick:()=>void Fn(q.isDraft?`ready`:`draft`),children:[q.isDraft?(0,$.jsx)(Ir.pullRequest,{className:`size-3.5`}):(0,$.jsx)(Ir.draft,{className:`size-3.5`}),q.isDraft?`Ready for review`:`Convert to draft`]}):null,Fr?(0,$.jsxs)(s,{closeOnClick:at.isArmed(`merge`),"aria-label":at.isArmed(`merge`)?`Confirm merge?`:`Merge now`,disabled:pn,...at.props(`merge`,()=>void Fn(`merge`,ar)),children:[(0,$.jsx)(Ir.merged,{className:`size-3.5`}),at.isArmed(`merge`)?`Confirm merge?`:`Merge now`]}):null,pr&&Sr(`disable-auto-merge`)?(0,$.jsxs)(s,{disabled:pn,onClick:()=>void Fn(`disable-auto-merge`),children:[(0,$.jsx)(Ir.merged,{className:`size-3.5`}),`Disable auto-merge`]}):Nr?(0,$.jsxs)(s,{closeOnClick:at.isArmed(`enable-auto-merge`),"aria-label":at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:`Enable auto-merge`,disabled:pn,...at.props(`enable-auto-merge`,()=>void Fn(`enable-auto-merge`,ar)),children:[(0,$.jsx)(Ir.merged,{className:`size-3.5`}),at.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:`Enable auto-merge`]}):null,Lr?(0,$.jsxs)($.Fragment,{children:[Mr||Fr||Nr?(0,$.jsx)(te,{}):null,(0,$.jsx)(ve,{value:ar,onValueChange:e=>{let t=e;it(t),Qe(t)},children:rr.map(e=>(0,$.jsx)(ke,{value:e,disabled:pn,closeOnClick:!0,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Ir.merged,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:Mi[e]})]})},e))})]}):null,Xr(Mr,Nr||Fr,Lr)?(0,$.jsx)(te,{}):null]}):null,(0,$.jsxs)(s,{onClick:()=>void Ct()?.shell.openExternal(q.url),children:[(0,$.jsx)(Ce,{className:`size-3.5`}),kl(Rt)]}),(0,$.jsxs)(s,{onClick:()=>Ft(q.url,`PR link`),children:[(0,$.jsx)(o,{className:`size-3.5`}),`Copy link`,(0,$.jsx)(Se,{children:sr(Pt,`thread.copyReference`)})]}),(0,$.jsxs)(s,{onClick:()=>Ft(`#${F.number}`,`PR number`),children:[(0,$.jsx)(a,{className:`size-3.5`}),`Copy PR number`,(0,$.jsx)(Se,{children:sr(Pt,`pullRequest.copyNumber`)})]}),q.state===`open`&&Sr(`close`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(te,{}),(0,$.jsxs)(s,{closeOnClick:at.isArmed(`close`),"aria-label":at.isArmed(`close`)?`Confirm close?`:`Close pull request`,variant:`destructive`,disabled:pn,...at.props(`close`,()=>void Fn(`close`)),children:[(0,$.jsx)(Ir.closed,{className:`size-3.5`}),at.isArmed(`close`)?`Confirm close?`:`Close pull request`]})]}):q.state===`closed`&&Sr(`reopen`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(te,{}),(0,$.jsxs)(s,{disabled:pn,onClick:()=>void Fn(`reopen`),children:[(0,$.jsx)(Ir.reopen,{className:`size-3.5`}),`Reopen pull request`]})]}):q.state===`merged`&&Sr(`revert`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(te,{}),(0,$.jsxs)(s,{closeOnClick:at.isArmed(`revert`),"aria-label":at.isArmed(`revert`)?`Confirm revert?`:`Revert changes`,variant:at.isArmed(`revert`)?`destructive`:`default`,disabled:pn,...at.props(`revert`,()=>void Fn(`revert`)),children:[(0,$.jsx)(le,{className:`size-3.5`}),at.isArmed(`revert`)?`Confirm revert?`:`Revert changes`]})]}):null,Vr?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(te,{}),(0,$.jsxs)(s,{variant:`destructive`,disabled:pn||!Gr,onClick:()=>void Kr(),children:[(0,$.jsx)(x,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:dn===`delete-branch`?`Deleting branch...`:`Delete branch`}),(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:Gr?q.headBranch:`Reconnect to delete this branch`})]})]})]}):null]})]})]}):null,g?(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":`Collapse pull request panel`,onClick:g,children:(0,$.jsx)(S,{className:`size-3.5`})}):null]}),(0,$.jsx)(`div`,{className:K(`col-span-2 grid`,ze?`grid-rows-[1fr]`:`grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`),children:(0,$.jsx)(`div`,{ref:Ge,className:K(`min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none`,ze?`translate-y-0 opacity-100 delay-50`:`translate-y-1 opacity-0 duration-100`),inert:!ze,children:q?(0,$.jsx)(`div`,{className:`col-span-2 min-w-0 px-4 pb-2 pt-1`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 shrink items-center gap-1.5 overflow-hidden text-xs text-muted-foreground`,children:[(0,$.jsx)(Tr,{actor:q.author,profileUrl:Bt,variant:`avatar`,className:`shrink-0`}),(0,$.jsx)(`span`,{className:`shrink-0`,children:En(q.updatedAt)})]}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`h-3 w-px shrink-0 bg-border/70`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 font-mono text-2xs text-muted-foreground/65`,children:[yr?(0,$.jsxs)(Rd,{baseBranch:q.baseBranch,freshness:yr,pending:pn,onUpdate:e=>void Fn(`update-branch`,void 0,e),iconClassName:`size-3`,className:`max-w-[40%]`,children:[Wt?(0,$.jsx)(Ir.stack,{"aria-label":`Stacked pull request`,className:`size-3 shrink-0`}):null,(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(ma,{value:q.baseBranch,showTitle:!1})})]}):(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1`,children:[Wt?(0,$.jsx)(Ir.stack,{"aria-label":`Stacked pull request`,className:`size-3 shrink-0`}):null,(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(ma,{value:q.baseBranch,showTitle:!1})})]})}),(0,$.jsx)(Y,{side:`top`,children:Wt?`Stacked on ${q.baseBranch}`:q.baseBranch})]}),(0,$.jsx)(be,{"aria-label":`receives changes from`,className:`size-3 shrink-0 opacity-60`}),(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`code`,{className:`flex min-w-0 flex-1`,children:(0,$.jsx)(ma,{value:q.headBranch,showTitle:!1})})}),(0,$.jsx)(Y,{side:`top`,children:q.headBranch})]})]}),(0,$.jsxs)(`span`,{className:`ml-auto inline-flex shrink-0 items-center justify-end gap-2 text-2xs`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 tabular-nums`,"aria-label":`${q.changedFiles.toLocaleString()} changed ${q.changedFiles===1?`file`:`files`}`,children:[(0,$.jsx)(Ie,{"aria-hidden":!0,className:`size-3`}),q.changedFiles.toLocaleString()]}),(0,$.jsx)($c,{environmentId:e,reference:F,additions:q.additions,deletions:q.deletions,className:`shrink-0 font-mono text-2xs`,eager:!0})]})]})}):null})}),(0,$.jsx)(`div`,{className:K(`col-span-2 grid`,ze?`grid-rows-[0fr]`:`grid-rows-[1fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`),children:(0,$.jsx)(`div`,{ref:Ue,className:K(`min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none`,ze?`-translate-y-1 opacity-0 duration-100`:`translate-y-0 opacity-100 delay-50`),inert:ze,children:q?(0,$.jsx)(cl,{title:_n===null?(0,$.jsxs)(ll,{className:`group gap-1`,children:[(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-base font-semibold leading-snug`,children:q.title})}),(0,$.jsx)(Y,{side:`top`,children:q.title})]}),Cs(q)?(0,$.jsx)(Es,{"aria-label":`Edit title`,onClick:()=>gn({pullRequestKey:L,text:q.title})}):null]}):(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(Bn,{autoFocus:!0,size:`sm`,disabled:vn,value:_n,"aria-label":`Pull request title`,onChange:e=>gn({pullRequestKey:L,text:e.target.value}),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),Ln(_n)):e.key===`Escape`&&(e.preventDefault(),gn(null))}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(W,{size:`xs`,variant:`ghost`,disabled:vn,onClick:()=>gn(null),children:`Cancel`}),(0,$.jsx)(W,{size:`xs`,variant:`outline`,disabled:!ct||vn||_n.trim().length===0,onClick:()=>void Ln(_n),children:vn?`Saving...`:`Save`})]})]}),author:(0,$.jsx)(Tr,{actor:q.author,profileUrl:Bt}),updated:(0,$.jsxs)(`span`,{children:[`updated `,En(q.updatedAt)]}),checkout:Vt?(0,$.jsx)(fl,{value:Vt,target:`pull request checkout command`,copyLabel:`Copy checkout command`,copiedLabel:`Checkout command copied`,className:`ml-auto font-mono`,tooltipSide:`bottom`,onError:Ht},Vt):null,base:yr?(0,$.jsxs)(Rd,{baseBranch:q.baseBranch,freshness:yr,pending:pn,onUpdate:e=>void Fn(`update-branch`,void 0,e),className:`max-w-[40%]`,children:[Wt?(0,$.jsx)(Ir.stack,{"aria-label":`Stacked pull request`,className:`size-3 shrink-0`}):null,(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(ma,{value:q.baseBranch,showTitle:!1})})]}):(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1`,children:[Wt?(0,$.jsx)(Ir.stack,{"aria-label":`Stacked pull request`,className:`size-3 shrink-0`}):null,(0,$.jsx)(`code`,{className:`flex min-w-0`,children:(0,$.jsx)(ma,{value:q.baseBranch,showTitle:!1})})]})}),(0,$.jsx)(Y,{side:`top`,children:Wt?`Stacked on ${q.baseBranch}`:q.baseBranch})]}),head:(0,$.jsx)(fl,{value:q.headBranch,target:`branch name`,copyLabel:`Copy pull request branch`,copiedLabel:`Branch name copied`},q.headBranch),files:`${q.changedFiles.toLocaleString()} ${q.changedFiles===1?`file`:`files`}`,diffStat:(0,$.jsx)($c,{environmentId:e,reference:F,additions:q.additions,deletions:q.deletions,className:`shrink-0 font-mono text-xs`,eager:!0})}):null})}),q?(0,$.jsx)(ul,{tabs:xr,value:G,onValueChange:ae,onTabIntent:e=>{e===`code`&&Md()},children:G===`summary`?qr?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`ml-auto inline-flex shrink-0`,children:(0,$.jsxs)(W,{size:`xs`,variant:`warning-outline`,disabled:pn,...at.props(`approve-workflows`,()=>void Fn(`approve-workflows`)),"aria-label":dn===`approve-workflows`?`Approving...`:at.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`,children:[(0,$.jsx)(y,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsxs)(`span`,{className:`inline-grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:`Approve workflows to run`}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:`Confirm approve?`}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:dn===`approve-workflows`?`Approving...`:at.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`})]})]})})}),(0,$.jsx)(Y,{side:`top`,children:dn===`approve-workflows`?`Approving...`:at.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`})]}):(0,$.jsx)(dl,{className:`text-muted-foreground`,"aria-label":Jr?`Checks: ${Jr}`:`Checks`,icon:Dr===null?(0,$.jsx)(N,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Vu,{checks:q.checks,stale:Or,checksState:Dr,threadRef:r}),label:Jr}):G===`timeline`?(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(vr,{className:K(`whitespace-nowrap text-2xs transition-opacity`,(Yt||Xt)&&`opacity-35`),children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"aria-label":Xt?`Comments unavailable`:`${q.commentCount.toLocaleString()} ${q.commentCount===1?`comment`:`comments`}`,children:[(0,$.jsx)(se,{"aria-hidden":!0,className:`size-3`}),Xt?`—`:Yt?`…`:q.commentCount.toLocaleString()]}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"aria-label":Xt?`Commits unavailable`:`${q.commits.length.toLocaleString()} ${q.commits.length===1?`commit`:`commits`}`,children:[(0,$.jsx)(u,{"aria-hidden":!0,className:`size-3`}),Xt?`—`:Yt?`…`:q.commits.length.toLocaleString()]}),Yr>0?(0,$.jsxs)(`span`,{className:K(`inline-flex items-center gap-1`,fr(`approved`)),children:[(0,$.jsx)(Cr,{outcome:`approved`,className:`size-3`}),Yr.toLocaleString(),(0,$.jsx)(`span`,{className:`sr-only`,children:Yr===1?`approval`:`approvals`})]}):null]}),(0,$.jsxs)(W,{size:`xs`,variant:`ghost-muted`,"aria-label":oe===`newest`?`Show oldest activity first`:`Show newest activity first`,onClick:()=>ce(e=>e===`newest`?`oldest`:`newest`),children:[(0,$.jsx)(U,{"aria-hidden":!0,className:`size-3`}),oe===`newest`?`Newest first`:`Oldest first`]})]}):null}):null]}),(0,$.jsx)(`div`,{className:`relative flex min-h-0 flex-1 flex-col overflow-hidden`,onScrollCapture:e=>{let t=Be.current[G];if(e.target!==t||t==null)return;let n=t.scrollTop;Ne(e=>{let r=e,i=Ue.current?.scrollHeight??0,a=i-(Ge.current?.scrollHeight??0);return e?n<4&&i>0&&(r=!1):i>0&&n>i+32&&(qe.current={tab:G,scroller:t,delta:-a},r=!0),Le.current[G]=r,r})},children:lt.error&&!q?(0,$.jsx)(Ol,{...fi(lt.failure)?{title:`Pull request #${F.number} not found`,error:`It may be an issue rather than a pull request, or this account can't see it.`}:{error:lt.error},refreshing:lt.isPending,onRetry:Zt,...Sn?{gitHubUrl:Sn}:{}}):q?(0,$.jsxs)(qs,{value:zt,children:[je.has(`summary`)?(0,$.jsx)(`div`,{className:K(`absolute inset-0`,G!==`summary`&&`invisible`),children:(0,$.jsx)(fu,{scrollerRef:He.summary,environmentId:e,threadRef:r,reference:F,detail:q,activityPending:Yt,checksStale:Or,activityError:Xt,pendingFinding:ot,fixFindingLabel:Hn.fixFinding,fixCheckLabel:Hn.fixCheck,...Vn?{onFixFinding:er}:{},onRefresh:Zt,onRefreshChecks:sn})}):null,je.has(`guide`)?(0,$.jsx)(`div`,{className:K(`absolute inset-0`,G!==`guide`&&`invisible`),children:(0,$.jsx)(wd,{environmentId:e,reference:F,active:G===`guide`,title:q.title,workspaceRoot:q.workspaceRoot,canComment:q.capabilities.review.inlineComment&&q.viewerPermissions.comment,onAskAboutLines:(e,t)=>Qn({comment:e,request:t},{keepGuide:!0}),onAskAboutStop:Zn,onFinishReview:q.capabilities.review.verdicts.some(e=>q.viewerPermissions.verdicts.includes(e))?()=>re(e=>e+1):null,onOpenFile:we,onTourShown:T})}):null,je.has(`timeline`)?(0,$.jsx)(`div`,{className:K(`absolute inset-0`,G!==`timeline`&&`invisible`),children:Yt?(0,$.jsx)(Cl,{}):Xt?(0,$.jsx)(Dl,{error:Xt,onRetry:ut.refresh}):(0,$.jsx)(Fu,{scrollerRef:He.timeline,detail:q,environmentId:e,threadRef:r,reference:F,order:oe,onOpenCommit:he,onRefresh:Zt})}):null,je.has(`code`)?(0,$.jsx)(`div`,{className:K(`absolute inset-0`,G!==`code`&&`invisible`),children:(0,$.jsx)(Z.Suspense,{fallback:(0,$.jsx)(Po,{label:`Loading pull request diff...`}),children:(0,$.jsx)(Nd,{scrollerRef:He.code,onAddToAgentSelection:Qn,environmentId:e,reference:F,detail:q,selectedCommitOid:pe,onSelectedCommitChange:me,pendingFinding:ot,fixFindingLabel:Hn.fixFinding,...Vn?{onFixFinding:er}:{},onRefresh:Zt,refreshToken:en,revealRequest:_e})})}):null]}):null}),q?(0,$.jsx)(`div`,{className:`absolute right-4 bottom-3 z-20`,children:(0,$.jsx)(Bl,{environmentId:e,reference:F,detail:q,actionPending:pn,onCommentAction:In,onCommented:Zt,onReviewSubmitted:Zt,openReviewRequest:ee},JSON.stringify([e,F.projectId,F.host,F.repository,F.number]))}):null]})}function Bd(e){let t=(0,Q.c)(36),{entry:n,hostActions:r,visible:i,onActed:a,closing:o,sweeping:s,onCloseSweepStart:c}=e,l=o!==void 0&&o,u=s!==void 0&&s,d;t[0]===n.environmentId?d=t[1]:(d=Ur.runAction.permissionAtom(n.environmentId),t[0]=n.environmentId,t[1]=d);let f=Fe(d),p=Ea(n.environmentId,n.projectId),m;t[2]!==n.host||t[3]!==n.number||t[4]!==n.projectId||t[5]!==n.repository?(m={projectId:n.projectId,host:n.host,repository:n.repository,number:n.number},t[2]=n.host,t[3]=n.number,t[4]=n.projectId,t[5]=n.repository,t[6]=m):m=t[6];let h=m,g;t[7]!==n||t[8]!==a?(g=e=>a?.({entry:n,action:e}),t[7]=n,t[8]=a,t[9]=g):g=t[9];let _;t[10]===p?_=t[11]:(_=e=>{let t=e.capabilities.mergeMethods.filter(t=>e.mergeCapabilities[t]);if(t.length===0)throw Error(`No merge method is available for this repository.`);return hi(t,null,p(),Yi.getState().pullRequestMergeMethod)},t[10]=p,t[11]=_);let v;t[12]!==n.environmentId||t[13]!==h||t[14]!==g||t[15]!==_?(v={environmentId:n.environmentId,reference:h,onSuccess:g,resolveMergeMethod:_},t[12]=n.environmentId,t[13]=h,t[14]=g,t[15]=_,t[16]=v):v=t[16];let{actionPending:y,perform:b}=Oa(v),x,S;if(t[17]!==y||t[18]!==f||t[19]!==l||t[20]!==n||t[21]!==r||t[22]!==c||t[23]!==b||t[24]!==u||t[25]!==i){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Vr(n,r),a=y||l||u;if(e.length===0){S=null;break bb0}let o=i||a?`flex`:`none`,s;t[28]===o?s=t[29]:(s={display:o},t[28]=o,t[29]=s);let d;t[30]!==a||t[31]!==f||t[32]!==n||t[33]!==c||t[34]!==b?(d=e=>{let t=Vd[e].label,r=Vd[e].Icon;return(0,$.jsxs)(X,{children:[(0,$.jsxs)(J,{render:(0,$.jsx)(W,{variant:e===`close`?`destructive-outline`:`outline`,size:`xs`,disabled:!f||a||e===`merge`&&n.stack!==void 0,"aria-label":`${t} #${n.number}`,onClick:()=>void b(e),onPointerDown:t=>{e===`close`&&t.isPrimary&&t.button===0&&(t.stopPropagation(),c?.(n,t.nativeEvent))}}),children:[a?(0,$.jsx)(vt,{size:`xs`}):(0,$.jsx)(r,{"aria-hidden":!0,className:`size-3`}),t]}),(0,$.jsx)(Y,{children:e===`merge`&&n.stack?`Open this pull request to merge its stack`:e===`close`&&c?`Close immediately, or drag across rows to close several`:`${t} immediately`})]},e)},t[30]=a,t[31]=f,t[32]=n,t[33]=c,t[34]=b,t[35]=d):d=t[35],x=(0,$.jsx)(`div`,{className:`shrink-0 items-center gap-1 pr-3`,style:s,role:`group`,"aria-label":`Quick actions for pull request #${n.number}`,"data-pull-request-action-pending":y||l,children:e.map(d)})}t[17]=y,t[18]=f,t[19]=l,t[20]=n,t[21]=r,t[22]=c,t[23]=b,t[24]=u,t[25]=i,t[26]=x,t[27]=S}else x=t[26],S=t[27];return S===Symbol.for(`react.early_return_sentinel`)?x:S}var Vd={close:{label:`Close`,Icon:Ir.closed},merge:{label:`Merge`,Icon:Ir.merged},ready:{label:`Ready for review`,Icon:Ir.pullRequest},reopen:{label:`Reopen`,Icon:Ir.reopen}},Hd=`group/pr-row flex w-full items-center gap-2 rounded-md py-1 pr-1 text-left`,Ud=`shrink-0 font-mono text-xs tabular-nums text-muted-foreground`;function Wd(e){let t=(0,Q.c)(23),{state:n,isDraft:r,mergeability:i,baseBranch:a,below:o,className:s}=e,c;t[0]===s?c=t[1]:(c=K(`flex w-4 shrink-0 flex-col items-center gap-0.5`,s),t[0]=s,t[1]=c);let l;t[2]!==r||t[3]!==n?(l=(0,$.jsx)(br,{state:n,isDraft:r}),t[2]=r,t[3]=n,t[4]=l):l=t[4];let u;t[5]===i?u=t[6]:(u=i===void 0?{}:{mergeability:i},t[5]=i,t[6]=u);let d;t[7]===a?d=t[8]:(d=a===void 0?{}:{baseBranch:a},t[7]=a,t[8]=d);let f;t[9]!==r||t[10]!==n||t[11]!==u||t[12]!==d?(f=(0,$.jsx)(`span`,{className:`absolute -right-1 -bottom-1 inline-flex`,children:(0,$.jsx)(_r,{state:n,isDraft:r,...u,...d,className:`size-3 fill-background [stroke-width:2.5]`})}),t[9]=r,t[10]=n,t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==l||t[15]!==f?(p=(0,$.jsxs)(`span`,{className:`relative inline-flex`,children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16];let m;t[17]===o?m=t[18]:(m=o?(0,$.jsx)(`span`,{className:`inline-flex text-2xs`,children:o}):null,t[17]=o,t[18]=m);let h;return t[19]!==c||t[20]!==p||t[21]!==m?(h=(0,$.jsxs)(`span`,{className:c,children:[p,m]}),t[19]=c,t[20]=p,t[21]=m,t[22]=h):h=t[22],h}function Gd(e){let t=(0,Q.c)(22),{number:n,title:r,status:i,signals:a,meta:o,metaClassName:s,updatedAt:c}=e,l;t[0]===r?l=t[1]:(l=(0,$.jsx)(`span`,{className:`min-w-0 truncate text-sm`,children:r}),t[0]=r,t[1]=l);let u;t[2]===a?u=t[3]:(u=a?(0,$.jsx)(`span`,{className:`flex shrink-0 items-center gap-1 text-2xs`,children:a}):null,t[2]=a,t[3]=u);let d;t[4]===i?d=t[5]:(d=i?(0,$.jsx)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-2xs`,children:i}):null,t[4]=i,t[5]=d);let f;t[6]!==n||t[7]!==l||t[8]!==u||t[9]!==d?(f=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[n,l,u,d]}),t[6]=n,t[7]=l,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]===s?p=t[12]:(p=K(`flex min-w-0 items-center gap-1.5 overflow-hidden text-2xs text-muted-foreground`,s),t[11]=s,t[12]=p);let m;t[13]===c?m=t[14]:(m=c?(0,$.jsx)(`span`,{className:`ml-auto shrink-0 whitespace-nowrap tabular-nums`,children:En(c)}):null,t[13]=c,t[14]=m);let h;t[15]!==o||t[16]!==p||t[17]!==m?(h=(0,$.jsxs)(`span`,{className:p,children:[o,m]}),t[15]=o,t[16]=p,t[17]=m,t[18]=h):h=t[18];let g;return t[19]!==f||t[20]!==h?(g=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,h]}),t[19]=f,t[20]=h,t[21]=g):g=t[21],g}function Kd(e){let t=(0,Q.c)(20),{actor:n,className:r,labelClassName:i}=e,a=n?.login??`ghost`,o;t[0]===r?o=t[1]:(o=K(`inline-flex min-w-0 items-center gap-1`,r),t[0]=r,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,$.jsx)(`span`,{className:o}),t[2]=o,t[3]=s);let c;t[4]===n?c=t[5]:(c=(0,$.jsx)(hr,{actor:n,className:`size-3.5`}),t[4]=n,t[5]=c);let l;t[6]===i?l=t[7]:(l=K(`truncate`,i),t[6]=i,t[7]=l);let u;t[8]!==a||t[9]!==l?(u=(0,$.jsx)(`span`,{className:l,children:a}),t[8]=a,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,$.jsxs)(J,{render:s,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14];let f=n?.name&&n.name!==a?`${n.name} (@${a})`:a,p;t[15]===f?p=t[16]:(p=(0,$.jsx)(Y,{side:`top`,children:f}),t[15]=f,t[16]=p);let m;return t[17]!==d||t[18]!==p?(m=(0,$.jsxs)(X,{children:[d,p]}),t[17]=d,t[18]=p,t[19]=m):m=t[19],m}function qd(e){let t=(0,Q.c)(8),{head:n,base:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(ma,{value:n}),t[0]=n,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`span`,{className:`shrink-0`,children:`→`}),t[2]=a):a=t[2];let o;t[3]===r?o=t[4]:(o=(0,$.jsx)(ma,{value:r,className:`max-w-[45%] shrink-0`}),t[3]=r,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s=(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 font-mono`,children:[i,a,o]}),t[5]=i,t[6]=o,t[7]=s):s=t[7],s}var Jd=[`[data-slot="dialog-popup"]`,`[data-slot="alert-dialog-popup"]`,`[data-slot="command-dialog-popup"]`,`[data-slot="menu-popup"]`,`[data-slot="select-popup"]`,`[data-slot="popover-popup"]`,`[data-slot="combobox-popup"]`,`[data-slot="autocomplete-popup"]`].join(`,`),Yd={browser:`Only available in the desktop app.`,terminal:`Available when a project is open.`,files:`Available when a project is open.`,diff:`Available for Git repositories.`,pullRequest:`No pull request on this branch yet.`,pullRequests:`No linked pull requests available.`,device:`Available from a thread.`},Xd=1,Zd=[ya,wa];function Qd(e){return e?.querySelector(`[data-slot="scroll-area-viewport"]`)??null}function $d(e,t){return e.kind!==`preview`||!e.resourceId?null:t[e.resourceId]?.tabId??null}function ef(e){return{label:e.overlay?.audioMuted??!1?`Unmute tab`:`Mute tab`,disabled:e.overlay===null||!e.canResolveRuntimeTabId}}function tf(e){return e?.audible?e.audioMuted?`muted`:`audible`:`none`}function nf(e,t){return t.defaultPrevented||t.isComposing||t.metaKey||t.ctrlKey||t.altKey?null:e.find(e=>e.available&&e.shortcut.toLowerCase()===t.key.toLowerCase())??null}function rf(e){return e?.closest(`input, textarea, select, [contenteditable]:not([contenteditable="false"])`)!=null}function af(e){let t=(0,Q.c)(7),n;t[0]===e.trigger?n=t[1]:(n=(0,$.jsx)(J,{render:e.trigger}),t[0]=e.trigger,t[1]=n);let r;t[2]===e.reason?r=t[3]:(r=(0,$.jsx)(Y,{side:`top`,children:e.reason}),t[2]=e.reason,t[3]=r);let i;return t[4]!==n||t[5]!==r?(i=(0,$.jsxs)(X,{children:[n,r]}),t[4]=n,t[5]=r,t[6]=i):i=t[6],i}function of(e){let t=(0,Q.c)(14),[n,r]=(0,Z.useState)(-1),i=[{label:`Browser`,icon:b,shortcut:`B`,available:e.browserAvailable,disabledReason:Yd.browser,onClick:e.onAddBrowser},{label:`Terminal`,icon:w,shortcut:`T`,available:e.terminalAvailable,disabledReason:Yd.terminal,onClick:e.onAddTerminal},{label:`Files`,icon:oe,shortcut:`F`,available:e.filesAvailable,disabledReason:Yd.files,onClick:e.onAddFiles},...e.onAddDesign?[{label:`Design`,icon:O,shortcut:`G`,available:e.filesAvailable,disabledReason:`Open a project to use Design.`,onClick:e.onAddDesign}]:[],{label:`Diff`,icon:Ie,shortcut:`D`,available:e.diffAvailable,disabledReason:Yd.diff,onClick:e.onAddDiff},{label:`Pull request`,icon:Ir.pullRequest,shortcut:`P`,available:e.pullRequestAvailable,disabledReason:Yd.pullRequest,onClick:e.onAddPullRequest},{label:`Linked pull requests`,icon:Ir.link,shortcut:`L`,available:e.pullRequestsAvailable,disabledReason:Yd.pullRequests,onClick:e.onAddPullRequests},{label:`Device`,description:`Watch an iOS Simulator or Android Emulator.`,icon:ze,shortcut:`M`,available:e.deviceAvailable,disabledReason:Yd.device,onClick:e.onAddDevice}],a=i.filter(uf),o=a.length===0?-1:Math.min(n,a.length-1),c=(0,Z.useRef)(a);(0,Z.useEffect)(()=>{c.current=a});let u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[0]=u):u=t[0],(0,Z.useEffect)(()=>{let e=e=>{let t=nf(c.current,e);if(!t||document.querySelector(Jd))return;let n=e.composedPath()[0]??e.target;n instanceof Element&&rf(n)||(e.preventDefault(),e.stopPropagation(),t.onClick())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},u);let d=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey)&&a.length!==0){if(e.key===`ArrowDown`||e.key===`ArrowRight`){e.preventDefault(),r((o+1)%a.length);return}if(e.key===`ArrowUp`||e.key===`ArrowLeft`){e.preventDefault(),r(o===-1?a.length-1:(o-1+a.length)%a.length);return}if(e.key===`Enter`){if(e.target!==e.currentTarget)return;let t=a[o];if(!t)return;e.preventDefault(),t.onClick()}}},f=lf,p=e=>o!==-1&&a[o]===e,m=cf,h;t[1]===a?h=t[2]:(h=a.map(sf),t[1]=a,t[2]=h);let g=h.join(``),_;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`h3`,{className:`mb-3 font-medium text-foreground text-sm`,children:`Tools`}),t[3]=_):_=t[3];let v=i.map(t=>t.available?(0,$.jsxs)(`div`,{className:`group relative`,onMouseEnter:()=>r(a.indexOf(t)),onMouseLeave:()=>r(e=>e===a.indexOf(t)?-1:e),children:[(0,$.jsxs)(`button`,{type:`button`,onClick:t.onClick,className:K(`flex h-10 w-full cursor-pointer items-center gap-3 rounded-lg bg-card px-3.5 text-left text-sm transition-colors group-hover:bg-card/60`,p(t)&&`bg-card/60`),children:[m(t,`size-4`),(0,$.jsx)(`span`,{className:K(`min-w-0 flex-1 truncate`,t.label===`Browser`&&e.browserProfiles.length>1&&`pr-8`),children:t.label}),(0,$.jsx)(la,{variant:`pill`,children:t.shortcut})]}),t.label===`Browser`&&e.browserProfiles.length>1?(0,$.jsxs)(I,{children:[(0,$.jsx)(Re,{render:(0,$.jsx)(W,{"aria-label":`Open browser in a profile`,className:`absolute top-1/2 right-10 -translate-y-1/2`,size:`icon-xs`,variant:`ghost-muted`}),children:(0,$.jsx)(l,{className:`size-3.5`})}),(0,$.jsx)(Pe,{align:`end`,side:`bottom`,sideOffset:6,className:`max-w-56`,children:e.browserProfiles.map(t=>(0,$.jsx)(s,{onClick:()=>e.onAddBrowserInProfile(t.id),children:(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t.name})},t.id))})]}):null]},t.label):(0,$.jsx)(af,{reason:t.disabledReason,trigger:(0,$.jsxs)(`div`,{tabIndex:0,"aria-disabled":`true`,className:`flex h-10 w-full cursor-default items-center gap-3 rounded-lg bg-card px-3.5 text-left text-sm opacity-50`,children:[m(t,`size-4`),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,$.jsx)(la,{variant:`pill`,children:t.shortcut})]})},t.label)),y;t[4]===v?y=t[5]:(y=(0,$.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(14rem,1fr))] gap-x-3 gap-y-2`,children:v}),t[4]=v,t[5]=y);let x;t[6]!==y||t[7]!==_?(x=(0,$.jsxs)(`div`,{className:`w-full max-w-3xl`,children:[_,y]}),t[6]=y,t[7]=_,t[8]=x):x=t[8];let S;return t[9]!==f||t[10]!==d||t[11]!==x||t[12]!==g?(S=(0,$.jsx)(`div`,{ref:f,tabIndex:0,onKeyDown:d,"aria-label":`Open a surface`,"data-surface-launcher-keys":g,className:`scrollbar-gutter-both flex min-h-0 flex-1 flex-col overflow-y-auto bg-muted px-5 py-6 outline-none`,children:x}),t[9]=f,t[10]=d,t[11]=x,t[12]=g,t[13]=S):S=t[13],S}function sf(e){return e.shortcut}function cf(e,t){let n=t===void 0?`size-4`:t,r=e.icon;return(0,$.jsx)(`span`,{className:`relative inline-flex shrink-0 text-muted-foreground`,children:(0,$.jsx)(r,{className:n})})}function lf(e){e?.focus()}function uf(e){return e.available}function df(e,t,n,r){switch(e.kind){case`diff`:return`Diff`;case`design`:return`Design`;case`files`:return`Files`;case`file`:return e.relativePath.slice(Math.max(e.relativePath.lastIndexOf(`/`),e.relativePath.lastIndexOf(`\\`))+1);case`terminal`:return n.get(e.activeTerminalId)??Vi(e.activeTerminalId);case`pull-request`:return`#${e.number}`;case`pull-requests`:return`Pull requests`;case`tools`:return`Tools`;case`aside`:return r?.get(e.threadId)??`Side chat`;case`device`:return e.title??e.target?.name??`Device`;case`preview`:{let n=e.resourceId?t[e.resourceId]:null;if(!n||n.navStatus._tag===`Idle`)return`New tab`;if(n.navStatus.title.trim().length>0)return n.navStatus.title;try{return new URL(n.navStatus.url).host||`Browser`}catch{return`Browser`}}}}function ff(e){let t=(0,Q.c)(8),{capturedUrl:n,url:r}=e,i;t[0]===r?i=t[1]:(i=ft(r,32),t[0]=r,t[1]=i);let a=i,o;t[2]!==n||t[3]!==a?(o=[n,a],t[2]=n,t[3]=a,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(b,{className:`size-3 shrink-0`}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,$.jsx)(_s,{sources:o,fallback:s,className:`size-3 shrink-0 rounded-sm object-contain`}),t[6]=o,t[7]=c),c}function pf(e,t){try{return new URL(e).origin===new URL(t).origin}catch{return!1}}function mf(e){let t=(0,Q.c)(19),{surface:n,sessions:r,desktopByTabId:i,theme:a,environmentId:o,pullRequestStatusSeeds:s}=e;switch(n.kind){case`preview`:{let e=n.resourceId?r[n.resourceId]:null,a=!e||e.navStatus._tag===`Idle`?null:e.navStatus.url,o=e?i[e.tabId]?.favicon??null:null,s=o&&a&&pf(o.pageUrl,a)?o.dataUrl:null,c;return t[0]!==s||t[1]!==a?(c=(0,$.jsx)(ff,{capturedUrl:s,url:a}),t[0]=s,t[1]=a,t[2]=c):c=t[2],c}case`diff`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ie,{className:`size-3 shrink-0`}),t[3]=e):e=t[3],e}case`design`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(O,{className:`size-3 shrink-0`}),t[4]=e):e=t[4],e}case`files`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(oe,{className:`size-3 shrink-0`}),t[5]=e):e=t[5],e}case`file`:{let e;return t[6]!==n.relativePath||t[7]!==a?(e=(0,$.jsx)(ur,{pathValue:n.relativePath,kind:`file`,theme:a,className:`size-3`}),t[6]=n.relativePath,t[7]=a,t[8]=e):e=t[8],e}case`terminal`:{let e;return t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(w,{className:`size-3 shrink-0`}),t[9]=e):e=t[9],e}case`pull-request`:{let e=s?.[n.id],r;return t[10]!==o||t[11]!==n||t[12]!==e?(r=(0,$.jsx)(gf,{surface:n,environmentId:o,seed:e}),t[10]=o,t[11]=n,t[12]=e,t[13]=r):r=t[13],r}case`pull-requests`:{let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ir.link,{className:`size-3 shrink-0`}),t[14]=e):e=t[14],e}case`tools`:{let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Me,{className:`size-3 shrink-0`}),t[15]=e):e=t[15],e}case`aside`:{let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(we,{className:`size-3 shrink-0`}),t[16]=e):e=t[16],e}case`device`:{let e;return t[17]===n.target?.platform?e=t[18]:(e=n.target?.platform===`ios`?(0,$.jsx)(cr,{className:`size-3 shrink-0`}):n.target?.platform===`android`?(0,$.jsx)(lr,{className:`size-3 shrink-0`}):(0,$.jsx)(ze,{className:`size-3 shrink-0`}),t[17]=n.target?.platform,t[18]=e),e}}}function hf(e,t,n,r){if(t===null||n===null)return;let i;for(let a of e)if(a.environmentId===t)for(let e of Qe(a.pullRequests))Xe(e,{host:n,repository:r.repository,number:r.number})&&(i===void 0||(e.snapshot?.syncedAt??``)>(i.snapshot?.syncedAt??``))&&(i=e);return i}function gf(e){let t=(0,Q.c)(11),{surface:n,environmentId:r,seed:i}=e,a=n.environmentId??r,o=Je(),s=Ge(),c;t[0]!==a||t[1]!==n.projectId?(c=e=>e.environmentId===a&&e.id===n.projectId,t[0]=a,t[1]=n.projectId,t[2]=c):c=t[2];let l=o.find(c)?.repositoryIdentity,u=n.host??(l?.provider?ce(l,l.provider):null),d=Ke(),f=a===null?void 0:d.get(a)?.environment.capabilities,p=f?.threadPullRequests===!0?hf(s,a,u,n)?.snapshot??null:null,m=kt(a===null||f?.pullRequests!==!0||p!==null?null:Ur.detail({environmentId:a,input:{projectId:n.projectId,...f?.threadPullRequests===!0&&n.host!==void 0?{host:n.host}:{},repository:n.repository,number:n.number}})).data,h=n.projectId,g;t[3]!==n.number||t[4]!==n.repository||t[5]!==h?(g={projectId:h,repository:n.repository,number:n.number},t[3]=n.number,t[4]=n.repository,t[5]=h,t[6]=g):g=t[6];let _=Wr(a,g,null),v=p??Hr(m,_)??i??null;if(v===null){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ir.pullRequest,{className:`size-3 shrink-0 text-muted-foreground`}),t[7]=e):e=t[7],e}let y=dr({state:v.state,isDraft:v.isDraft??m?.isDraft??i?.isDraft??!1}),b=y.Icon,x=K(`size-3 shrink-0`,y.toneClassName),S;return t[8]!==y||t[9]!==x?(S=(0,$.jsx)(b,{className:x}),t[8]=y,t[9]=x,t[10]=S):S=t[10],S}function _f(e){let t=(0,Q.c)(13),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={activationConstraint:{distance:6}},t[0]=n):n=t[0];let r=Hi(Gi(Wi,n)),i;t[1]===e.surfaces?i=t[2]:(i=e.surfaces.map(vf),t[1]=e.surfaces,t[2]=i);let a=i,{onMove:o,surfaces:s}=e,c;t[3]!==o||t[4]!==s?(c=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=s.findIndex(e=>e.id===n.id);r>=0&&o?.(String(t.id),r)},t[3]=o,t[4]=s,t[5]=c):c=t[5];let l=c,u;t[6]!==e.children||t[7]!==a?(u=(0,$.jsx)(Ki,{items:a,strategy:qi,children:e.children}),t[6]=e.children,t[7]=a,t[8]=u):u=t[8];let d;return t[9]!==l||t[10]!==r||t[11]!==u?(d=(0,$.jsx)(Xi,{sensors:r,collisionDetection:Ji,modifiers:Zd,onDragEnd:l,children:u}),t[9]=l,t[10]=r,t[11]=u,t[12]=d):d=t[12],d}function vf(e){return e.id}function yf(e){let t=(0,Q.c)(22),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({surfaceId:a,disabled:r,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]!==r||t[6]!==a?(o={id:a,disabled:r},t[5]=r,t[6]=a,t[7]=o):o=t[7];let{listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=Ui(o),f;t[8]===l?f=t[9]:(f=Zi.Translate.toString(l),t[8]=l,t[9]=f);let p;t[10]!==f||t[11]!==u?(p={transform:f,transition:u},t[10]=f,t[11]=u,t[12]=p):p=t[12];let m=d&&`relative z-10`,h;t[13]!==n||t[14]!==m?(h=K(n,m),t[13]=n,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==s||t[17]!==i||t[18]!==c||t[19]!==p||t[20]!==h?(g=(0,$.jsx)(`div`,{...i,...s,ref:c,style:p,className:h}),t[16]=s,t[17]=i,t[18]=c,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}function bf(e){let t=(0,Q.c)(102),n=Dn&&e.mode===`inline`,r=ar().profiles,{resolvedTheme:i}=wt(),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(null),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={hasOverflow:!1,canScrollLeft:!1,canScrollRight:!1},t[0]=c):c=t[0];let[l,u]=(0,Z.useState)(c),d=e.open!==!1&&e.surfaces.length>0,f=d&&e.onAddTools!==void 0,p;t[1]!==d||t[2]!==f||t[3]!==e?(p=t=>{if(!(t.defaultPrevented||t.isComposing)&&or(t,e.keybindings,{context:{...e.getShortcutContext(),rightPanelOpen:!0}})===`rightPanel.new`&&!document.querySelector(Jd)&&(!d||f&&e.browserAvailable)&&(t.preventDefault(),t.stopPropagation(),!t.repeat)){if(!f){document.querySelector(`[data-surface-launcher-keys]`)?.focus();return}e.onAddTools?.()}},t[1]=d,t[2]=f,t[3]=e,t[4]=p):p=t[4];let m=(0,Z.useEffectEvent)(p),h;t[5]!==m||t[6]!==e.open?(h=()=>{if(e.open!==!1)return document.addEventListener(`keydown`,m,!0),()=>document.removeEventListener(`keydown`,m,!0)},t[5]=m,t[6]=e.open,t[7]=h):h=t[7];let g;t[8]===e.open?g=t[9]:(g=[e.open],t[8]=e.open,t[9]=g),(0,Z.useEffect)(h,g);let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{let e=Qd(a.current);if(!e)return;let t=e.scrollWidth-e.clientWidth>Xd,n=t&&e.scrollLeft>Xd,r=t&&e.scrollLeft+e.clientWidth<e.scrollWidth-Xd;u(e=>e.hasOverflow===t&&e.canScrollLeft===n&&e.canScrollRight===r?e:{hasOverflow:t,canScrollLeft:n,canScrollRight:r})},t[10]=_):_=t[10];let v=_,y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{let t=Qd(a.current);if(!t)return;let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;t.scrollBy({left:e*Math.max(120,t.clientWidth*.75),behavior:n?`auto`:`smooth`})},t[11]=y):y=t[11];let b=y,x;t[12]===e?x=t[13]:(x=async(t,n)=>{t.preventDefault(),t.stopPropagation();let r=Ct();if(!r)return;let i=e.surfaces.findIndex(e=>e.id===n.id);if(i<0)return;let a=[];n.kind===`device`&&e.onRenameDevice&&a.push({id:`rename`,label:`Rename`}),n.kind===`file`&&n.attachment===void 0&&a.push({id:`copy-path`,label:`Copy path`});let o=$d(n,e.previewSessions),c=o?e.desktopByTabId[o]??null:null,l=c?.audioMuted??!1;n.kind===`preview`&&a.push({id:`toggle-mute`,...ef({overlay:c,canResolveRuntimeTabId:e.previewRuntimeTabId!==void 0})}),a.push({id:`close`,label:`Close`},{id:`close-others`,label:`Close others`,disabled:e.surfaces.length<=1},{id:`close-to-right`,label:`Close to the right`,disabled:i>=e.surfaces.length-1},{id:`close-all`,label:`Close all`,disabled:e.surfaces.length===0});let u=await r.contextMenu.show(a,{x:t.clientX,y:t.clientY});bb134:switch(u){case`rename`:s(n.id);break bb134;case`copy-path`:n.kind===`file`&&n.attachment===void 0&&e.onCopyFilePath(n.relativePath);break bb134;case`toggle-mute`:{let t=o&&c?e.previewRuntimeTabId?.(o)??null:null;t&&Sa?.setAudioMuted(t,!l).catch(wf);break bb134}case`close`:e.onCloseSurface(n);break bb134;case`close-others`:e.onCloseOtherSurfaces(n);break bb134;case`close-to-right`:e.onCloseSurfacesToRight(n);break bb134;case`close-all`:e.onCloseAllSurfaces();break bb134}},t[12]=e,t[13]=x);let S=x,w=Cf,T;t[14]===e?T=t[15]:(T=(t,n)=>{t.button===1&&(t.preventDefault(),t.stopPropagation(),e.onCloseSurface(n))},t[14]=e,t[15]=T);let E=T,D,O;t[16]!==e.activeSurfaceId||t[17]!==l.hasOverflow?(D=()=>{e.activeSurfaceId&&l.hasOverflow&&(a.current?.querySelector(`[data-active-tab='true']`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},O=[e.activeSurfaceId,l.hasOverflow],t[16]=e.activeSurfaceId,t[17]=l.hasOverflow,t[18]=D,t[19]=O):(D=t[18],O=t[19]),(0,Z.useEffect)(D,O);let k,A;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{let e=Qd(a.current);if(!e)return;let t=e.firstElementChild,n=nr(t?[e,t]:e,v);return e.addEventListener(`scroll`,v,{passive:!0}),v(),()=>{n(),e.removeEventListener(`scroll`,v)}},A=[v],t[20]=k,t[21]=A):(k=t[20],A=t[21]),(0,Z.useEffect)(k,A);let j,M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{let e=Qd(a.current);if(!e)return;let t=t=>{if(t.ctrlKey)return;let n=Math.abs(t.deltaX)>Math.abs(t.deltaY)?t.deltaX:t.deltaY;if(t.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=16),t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=e.clientWidth),n===0)return;let r=e.scrollLeft;e.scrollLeft+=n,e.scrollLeft!==r&&(t.preventDefault(),v())};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},M=[v],t[22]=j,t[23]=M):(j=t[22],M=t[23]),(0,Z.useEffect)(j,M);let N=e.mode,P;t[24]===e.maximized?P=t[25]:(P=e.maximized===void 0?{}:{maximized:e.maximized},t[24]=e.maximized,t[25]=P);let F;t[26]===e.open?F=t[27]:(F=e.open===void 0?{}:{open:e.open},t[26]=e.open,t[27]=F);let I;t[28]===e.widthStorageKey?I=t[29]:(I=e.widthStorageKey===void 0?{}:{widthStorageKey:e.widthStorageKey},t[28]=e.widthStorageKey,t[29]=I);let R;t[30]===e.defaultWidth?R=t[31]:(R=e.defaultWidth===void 0?{}:{defaultWidth:e.defaultWidth},t[30]=e.defaultWidth,t[31]=R);let z;t[32]===e.inlineSize?z=t[33]:(z=e.inlineSize?{inlineSize:e.inlineSize}:{},t[32]=e.inlineSize,t[33]=z);let B=e.mode===`inline`&&!e.layoutControls?`pr-28`:`pr-3`,V=n&&`drag-region`,H=n&&`wco:pr-(--workspace-native-controls-inset)`,U=e.mode===`inline`&&e.maximized&&`[[data-sidebar-state=collapsed]_&]:pl-[var(--workspace-titlebar-content-left)] max-md:[[data-sidebar-state=expanded]_&]:pl-[var(--workspace-titlebar-content-left)]`,ee;t[34]!==B||t[35]!==V||t[36]!==H||t[37]!==U?(ee=K(`flex h-[var(--workspace-topbar-height)] min-h-[var(--workspace-topbar-height)] shrink-0 items-center gap-1 bg-(--app-chrome-background) pl-2`,B,V,H,U),t[34]=B,t[35]=V,t[36]=H,t[37]=U,t[38]=ee):ee=t[38];let te=e.surfaces,ne=e.onMoveSurface,re;t[39]!==E||t[40]!==S||t[41]!==n||t[42]!==e||t[43]!==o||t[44]!==i?(re=e.surfaces.map(t=>{let r=t.id===e.activeSurfaceId,a=e.pendingSurfaceIds.has(t.id),c=df(t,e.previewSessions,e.terminalLabelsById,e.asideTitlesByThreadId),l=$d(t,e.previewSessions),u=tf(l?e.desktopByTabId[l]??null:null),d=l?e.previewRuntimeTabId?.(l)??null:null;return(0,$.jsxs)(yf,{surfaceId:t.id,disabled:!e.onMoveSurface||o===t.id,"data-active-tab":r,onMouseDown:w,onAuxClick:e=>E(e,t),onContextMenu:e=>void S(e,t),className:K(`cursor-pointer group/tab flex h-7 w-52 shrink-0 items-center gap-2 rounded-md pr-1 pl-2.5 text-sm transition-colors duration-150`,n&&`[-webkit-app-region:no-drag]`,r?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:bg-accent/60 hover:text-foreground`),children:[(0,$.jsxs)(`span`,{className:`relative flex size-4 shrink-0 items-center justify-center [&_img]:size-3.5 [&_svg]:size-3.5`,children:[(0,$.jsx)(mf,{surface:t,sessions:e.previewSessions,desktopByTabId:e.desktopByTabId,theme:i,environmentId:e.environmentId,pullRequestStatusSeeds:e.pullRequestStatusSeeds}),a?(0,$.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full bg-current`,"aria-hidden":!0}):null]}),u===`none`||!d?null:(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`button`,{type:`button`,className:`cursor-pointer flex size-4 shrink-0 items-center justify-center rounded-sm hover:bg-muted`,"aria-label":u===`muted`?`Unmute ${c}`:`Mute ${c}`,onClick:e=>{e.stopPropagation(),Sa?.setAudioMuted(d,u!==`muted`).catch(Sf)},children:(0,$.jsx)(ot,{className:`size-3`,icon:u===`muted`?st:nt})})}),(0,$.jsx)(Y,{children:u===`muted`?`Unmute tab`:`Mute tab`})]}),o===t.id?(0,$.jsx)(`input`,{"aria-label":`Device tab name`,className:`min-w-0 flex-1 rounded-sm bg-background px-1 outline-none ring-1 ring-inset ring-ring`,defaultValue:c,ref:xf,onBlur:n=>{e.onRenameDevice?.(t.id,n.currentTarget.value),s(null)},onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=c,e.currentTarget.blur())}}):(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`button`,{type:`button`,onDoubleClick:()=>{t.kind===`device`&&e.onRenameDevice&&s(t.id)},className:`cursor-pointer flex h-full min-w-0 flex-1 items-center`,onClick:()=>e.onActivate(t),children:(0,$.jsx)(`span`,{className:`truncate`,children:c})})}),(0,$.jsx)(Y,{children:t.kind===`device`?(0,$.jsx)(Tf,{surface:t,environmentId:e.environmentId,title:c}):c})]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`Close ${c}`,className:K(`cursor-pointer flex size-5 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-opacity duration-150 hover:bg-muted hover:text-foreground focus-visible:opacity-100 pointer-coarse:opacity-100 motion-reduce:transition-none`,r?`opacity-100`:`opacity-0 group-hover/tab:opacity-100`),onClick:()=>e.onCloseSurface(t),children:(0,$.jsx)(De,{className:`size-3.5`})})]},t.id)}),t[39]=E,t[40]=S,t[41]=n,t[42]=e,t[43]=o,t[44]=i,t[45]=re):re=t[45];let G;t[46]!==e.onMoveSurface||t[47]!==e.surfaces||t[48]!==re?(G=(0,$.jsx)(Vn,{radius:`none`,ref:a,hideScrollbars:!0,scrollFade:!0,className:`w-fit min-w-0 flex-initial`,"data-right-panel-tab-list":!0,children:(0,$.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center gap-1`,children:(0,$.jsx)(_f,{surfaces:te,onMove:ne,children:re})})}),t[46]=e.onMoveSurface,t[47]=e.surfaces,t[48]=re,t[49]=G):G=t[49];let ie;t[50]!==l.canScrollLeft||t[51]!==l.canScrollRight||t[52]!==l.hasOverflow?(ie=l.hasOverflow?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 [-webkit-app-region:no-drag]`,role:`group`,"aria-label":`Scroll panel tabs`,children:[(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(W,{"aria-label":`Scroll tabs left`,disabled:!l.canScrollLeft,onClick:()=>b(-1),size:`icon-xs`,variant:`ghost`,children:(0,$.jsx)(ue,{})})})}),(0,$.jsx)(Y,{children:`Scroll tabs left`})]}),(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(W,{"aria-label":`Scroll tabs right`,disabled:!l.canScrollRight,onClick:()=>b(1),size:`icon-xs`,variant:`ghost`,children:(0,$.jsx)(C,{})})})}),(0,$.jsx)(Y,{children:`Scroll tabs right`})]})]}):null,t[50]=l.canScrollLeft,t[51]=l.canScrollRight,t[52]=l.hasOverflow,t[53]=ie):ie=t[53];let ae;t[54]!==f||t[55]!==e.onAddTools?(ae=f?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(W,{"aria-label":`New tab`,className:`shrink-0 [-webkit-app-region:no-drag]`,onClick:e.onAddTools,size:`icon-xs`,variant:`ghost-muted`}),children:(0,$.jsx)(L,{className:`size-4`})}),(0,$.jsx)(Y,{children:`New tab`})]}):null,t[54]=f,t[55]=e.onAddTools,t[56]=ae):ae=t[56];let oe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`min-w-0 flex-1`}),t[57]=oe):oe=t[57];let se;t[58]!==n||t[59]!==e.layoutControls?(se=n&&!e.layoutControls?(0,$.jsx)(`span`,{"aria-hidden":!0,className:`hidden w-24 shrink-0 wco:block`}):null,t[58]=n,t[59]=e.layoutControls,t[60]=se):se=t[60];let ce;t[61]===n?ce=t[62]:(ce=n?(0,$.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none fixed top-[var(--workspace-controls-top)] right-[var(--workspace-controls-right)] h-[var(--workspace-topbar-height)] w-28 [-webkit-app-region:no-drag]`}):null,t[61]=n,t[62]=ce);let le;t[63]!==e.layoutControls||t[64]!==ee||t[65]!==G||t[66]!==ie||t[67]!==ae||t[68]!==se||t[69]!==ce?(le=(0,$.jsxs)(`div`,{className:ee,"data-right-panel-tabbar":!0,children:[G,ie,ae,oe,e.layoutControls,se,ce]}),t[63]=e.layoutControls,t[64]=ee,t[65]=G,t[66]=ie,t[67]=ae,t[68]=se,t[69]=ce,t[70]=le):le=t[70];let de;t[71]!==r||t[72]!==e.activeSurfaceId||t[73]!==e.browserAvailable||t[74]!==e.children||t[75]!==e.deviceAvailable||t[76]!==e.diffAvailable||t[77]!==e.filesAvailable||t[78]!==e.onAddBrowser||t[79]!==e.onAddBrowserInProfile||t[80]!==e.onAddDesign||t[81]!==e.onAddDevice||t[82]!==e.onAddDiff||t[83]!==e.onAddFiles||t[84]!==e.onAddPullRequest||t[85]!==e.onAddPullRequests||t[86]!==e.onAddTerminal||t[87]!==e.pullRequestAvailable||t[88]!==e.pullRequestsAvailable||t[89]!==e.terminalAvailable?(de=e.activeSurfaceId===null||e.activeSurfaceId===`tools`?(0,$.jsx)(of,{onAddBrowser:e.onAddBrowser,onAddBrowserInProfile:e.onAddBrowserInProfile,browserProfiles:r,onAddTerminal:e.onAddTerminal,onAddDiff:e.onAddDiff,onAddFiles:e.onAddFiles,...e.onAddDesign?{onAddDesign:e.onAddDesign}:{},onAddPullRequest:e.onAddPullRequest,onAddPullRequests:e.onAddPullRequests,onAddDevice:e.onAddDevice,browserAvailable:e.browserAvailable,terminalAvailable:e.terminalAvailable,diffAvailable:e.diffAvailable,filesAvailable:e.filesAvailable,pullRequestAvailable:e.pullRequestAvailable,pullRequestsAvailable:e.pullRequestsAvailable,deviceAvailable:e.deviceAvailable}):e.children,t[71]=r,t[72]=e.activeSurfaceId,t[73]=e.browserAvailable,t[74]=e.children,t[75]=e.deviceAvailable,t[76]=e.diffAvailable,t[77]=e.filesAvailable,t[78]=e.onAddBrowser,t[79]=e.onAddBrowserInProfile,t[80]=e.onAddDesign,t[81]=e.onAddDevice,t[82]=e.onAddDiff,t[83]=e.onAddFiles,t[84]=e.onAddPullRequest,t[85]=e.onAddPullRequests,t[86]=e.onAddTerminal,t[87]=e.pullRequestAvailable,t[88]=e.pullRequestsAvailable,t[89]=e.terminalAvailable,t[90]=de):de=t[90];let fe;t[91]===de?fe=t[92]:(fe=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-right-panel-surface-content":!0,children:de}),t[91]=de,t[92]=fe);let pe;return t[93]!==e.mode||t[94]!==P||t[95]!==F||t[96]!==I||t[97]!==R||t[98]!==z||t[99]!==le||t[100]!==fe?(pe=(0,$.jsxs)(fs,{mode:N,...P,...F,...I,...R,...z,children:[le,fe]}),t[93]=e.mode,t[94]=P,t[95]=F,t[96]=I,t[97]=R,t[98]=z,t[99]=le,t[100]=fe,t[101]=pe):pe=t[101],pe}function xf(e){e?.focus(),e?.select()}function Sf(){}function Cf(e){e.button===1&&e.preventDefault()}function wf(){}function Tf(e){let t=(0,Q.c)(15),n=e.surface.target,{state:r}=tr(n?e.environmentId:null),i;t[0]!==r||t[1]!==n?(i=n?r.devices.find(e=>e.hostId===n.hostId&&e.id===n.deviceId):void 0,t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]!==r||t[4]!==n?(o=n?r.hosts.find(e=>e.id===n.hostId):void 0,t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=o,c;t[6]===e.title?c=t[7]:(c=(0,$.jsx)(`span`,{children:e.title}),t[6]=e.title,t[7]=c);let l;t[8]!==a?.version||t[9]!==s?.label||t[10]!==n?(l=n?(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[s?.label??`Device host`,` ·`,` `,a?.version??(n.platform===`ios`?`iOS`:`Android`)]}):null,t[8]=a?.version,t[9]=s?.label,t[10]=n,t[11]=l):l=t[11];let u;return t[12]!==c||t[13]!==l?(u=(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[c,l]}),t[12]=c,t[13]=l,t[14]=u):u=t[14],u}var Ef=(0,Z.memo)(function(e){let t=(0,Q.c)(31),{showThreadPanelControl:n,showTerminalControl:r,showRightPanelControl:i,terminalAvailable:a,terminalOpen:o,terminalShortcutLabel:s,threadPanelOpen:c,threadPanelPresentation:l,threadPanelPopoverHandle:u,threadPanelShortcutLabel:d,rightPanelAvailable:f,rightPanelOpen:p,rightPanelShortcutLabel:m,rightPanelUnavailableLabel:h,rightPanelTabCount:_,onToggleTerminal:v,onToggleThreadPanel:y,onToggleRightPanel:b}=e,x=n===void 0||n,S=r===void 0||r,C=i===void 0||i,w=h===void 0?`Right panel is unavailable`:h,T=_===void 0?0:_,E;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(kf,{}),t[0]=E):E=t[0];let D;t[1]===c?D=t[2]:(D=(0,$.jsx)(jn,{className:`relative shrink-0 [-webkit-app-region:no-drag]`,pressed:c,"aria-label":`Toggle thread details panel`,variant:`ghost`,size:`sm`,children:E}),t[1]=c,t[2]=D);let O=D,k;t[3]!==y||t[4]!==l||t[5]!==d?(k=e=>(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:e,...l===`popover`?{}:{onClick:y}}),(0,$.jsxs)(Y,{side:`bottom`,children:[`Toggle thread details`,d?` (${d})`:``]})]}),t[3]=y,t[4]=l,t[5]=d,t[6]=k):k=t[6];let A=k,j;t[7]!==x||t[8]!==u||t[9]!==l||t[10]!==O||t[11]!==A?(j=x?A(l===`popover`?(0,$.jsx)(Jr,{handle:u,render:O}):O):null,t[7]=x,t[8]=u,t[9]=l,t[10]=O,t[11]=A,t[12]=j):j=t[12];let M;t[13]!==v||t[14]!==S||t[15]!==a||t[16]!==o||t[17]!==s?(M=S?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`flex shrink-0`}),children:(0,$.jsx)(jn,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:o,onPressedChange:v,"aria-label":`Toggle terminal drawer`,variant:`ghost`,size:`sm`,disabled:!a,children:(0,$.jsx)(g,{className:`size-4`})})}),(0,$.jsx)(Y,{side:`bottom`,children:a?`Toggle terminal drawer${s?` (${s})`:``}`:`Terminal drawer is unavailable`})]}):null,t[13]=v,t[14]=S,t[15]=a,t[16]=o,t[17]=s,t[18]=M):M=t[18];let N;t[19]!==b||t[20]!==f||t[21]!==p||t[22]!==m||t[23]!==T||t[24]!==w||t[25]!==C?(N=C?(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{render:(0,$.jsx)(`span`,{className:`flex shrink-0`}),children:(0,$.jsx)(jn,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:p,onPressedChange:b,"aria-label":T>0?`Toggle right panel, ${T} ${T===1?`tab`:`tabs`}`:`Toggle right panel`,variant:`ghost`,size:`sm`,disabled:!f,children:T>0?(0,$.jsx)(Df,{count:T}):(0,$.jsx)(ot,{className:`size-4`,icon:p?ct:it})})}),(0,$.jsx)(Y,{side:`bottom`,children:f?`Toggle right panel${m?` (${m})`:``}`:w})]}):null,t[19]=b,t[20]=f,t[21]=p,t[22]=m,t[23]=T,t[24]=w,t[25]=C,t[26]=N):N=t[26];let P;return t[27]!==M||t[28]!==N||t[29]!==j?(P=(0,$.jsxs)(`div`,{className:`flex h-full shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,"data-panel-layout-controls":!0,children:[j,M,N]}),t[27]=M,t[28]=N,t[29]=j,t[30]=P):P=t[30],P});function Df(e){let t=(0,Q.c)(4),{count:n}=e,r=n>99?`∞`:String(n),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}),t[0]=i):i=t[0];let a=r.length>1?11:13,o;return t[1]!==r||t[2]!==a?(o=(0,$.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:[i,(0,$.jsx)(`text`,{x:`12`,y:`12.5`,fill:`currentColor`,stroke:`none`,fontSize:a,fontWeight:600,textAnchor:`middle`,dominantBaseline:`central`,className:`tabular-nums`,children:r})]}),t[1]=r,t[2]=a,t[3]=o):o=t[3],o}var Of=(0,Z.memo)(function(e){let t=(0,Q.c)(12),{maximized:n,onToggle:r}=e,i=n?`Restore panel size`:`Maximize panel`,a=n?tt:rt,o;t[0]===a?o=t[1]:(o=(0,$.jsx)(ot,{className:`size-3.5`,icon:a}),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==o?(s=(0,$.jsx)(J,{render:(0,$.jsx)(jn,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:n,onPressedChange:r,"aria-label":i,variant:`ghost`,size:`sm`,children:o})}),t[2]=i,t[3]=n,t[4]=r,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(0,$.jsx)(Y,{side:`bottom`,children:i}),t[7]=i,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,$.jsxs)(X,{children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l});function kf(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`svg`,{"aria-hidden":!0,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,className:`size-4`,children:[(0,$.jsx)(`circle`,{cx:`6`,cy:`7.5`,r:`2.5`}),(0,$.jsx)(`circle`,{cx:`6`,cy:`16.5`,r:`2.5`}),(0,$.jsx)(`path`,{d:`M12 7.5h8`}),(0,$.jsx)(`path`,{d:`M12 16.5h8`})]}),e[0]=t):t=e[0],t}export{Ts as A,Cc as C,mc as D,_c as E,Qo as F,Yo as I,Mo as L,fs as M,ss as N,pc as O,Zo as P,Po as R,Lc as S,hc as T,_l as _,Ud as a,Bc as b,Wd as c,zd as d,Vu as f,yl as g,Ol as h,Hd as i,xs as j,ws as k,Gd as l,jl as m,Of as n,Kd as o,kl as p,bf as r,qd as s,Ef as t,Bd as u,el as v,yc as w,zc as x,$c as y,jo as z};
216
+ //# sourceMappingURL=PanelLayoutControls-4VFKEoHg.js.map