@p4code/cli 0.8.33 → 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-CReSoYE2.mjs → binCli-26z5sNBT.mjs} +2313 -1491
  3. package/dist/client/.vite/manifest.json +2037 -2022
  4. package/dist/client/assets/{2NI2N5EU-Cq8AdBdr.js → 2NI2N5EU-BLnY4aCF.js} +2 -2
  5. package/dist/client/assets/{4UO7MD6I-BtyHa2r8.js → 4UO7MD6I-BApNVkfU.js} +2 -2
  6. package/dist/client/assets/{5B3SVYGG-DJhrK_P7.js → 5B3SVYGG-Y7V7NdZO.js} +2 -2
  7. package/dist/client/assets/{5GK6JWQ2-Di3oWVTL.js → 5GK6JWQ2-BSIhKcw-.js} +2 -2
  8. package/dist/client/assets/{5N7A7DKN-IYvb4i83.js → 5N7A7DKN-CNUCnWLs.js} +2 -2
  9. package/dist/client/assets/{5OC2THR4-C4L8eWnK.js → 5OC2THR4-Bne-pf_A.js} +2 -2
  10. package/dist/client/assets/{5S6HY5KT-CRP52QAR.js → 5S6HY5KT-7d4UMONz.js} +2 -2
  11. package/dist/client/assets/{6IMQ5BUJ-CNHI0F6y.js → 6IMQ5BUJ-BWW19n-D.js} +2 -2
  12. package/dist/client/assets/{6OLKWJ4F-B4vHLWw5.js → 6OLKWJ4F-CxTUuvA6.js} +2 -2
  13. package/dist/client/assets/{74OO7NKP-Cy2GHTnO.js → 74OO7NKP-DByVTRKE.js} +2 -2
  14. package/dist/client/assets/{75O6YZUN-DQlP5MhD.js → 75O6YZUN-CZanyedf.js} +2 -2
  15. package/dist/client/assets/{77XECAW3-DSSYRZCk.js → 77XECAW3-TL2w7pHK.js} +2 -2
  16. package/dist/client/assets/{ABYRPUBD-BKqULKA5.js → ABYRPUBD-CJboH7Uz.js} +2 -2
  17. package/dist/client/assets/AlertDialogRoot-9jRALQXL.js +2 -0
  18. package/dist/client/assets/{AnimatedHeight-CFR4EWDw.js → AnimatedHeight-OxEbW01v.js} +2 -2
  19. package/dist/client/assets/{AuthSurfaceShell-X2oPejN8.js → AuthSurfaceShell-KQXgPV4i.js} +2 -2
  20. package/dist/client/assets/{BB2UYUI2-C2iBTfII.js → BB2UYUI2-BxW-R2h1.js} +2 -2
  21. package/dist/client/assets/{BUM34MOA-D8LFlnDQ.js → BUM34MOA-ngG-irUy.js} +2 -2
  22. package/dist/client/assets/{CEQABKGZ-D15ZAT0K.js → CEQABKGZ-C-u-W0bS.js} +2 -2
  23. package/dist/client/assets/{CXAC5362-CicOZ45Z.js → CXAC5362-DfFRkI7L.js} +2 -2
  24. package/dist/client/assets/ChatGptUsageButton-C3KgGt4z.js +2 -0
  25. package/dist/client/assets/{ChatMarkdown-DfVVLQX2.js → ChatMarkdown-9gWM0ED9.js} +9 -9
  26. package/dist/client/assets/{CheckboxIndicator-IpoyLEZ-.js → CheckboxIndicator-DbU3csPQ.js} +2 -2
  27. package/dist/client/assets/{ClippedText-DTOlMbAH.js → ClippedText-CS_BYNco.js} +2 -2
  28. package/dist/client/assets/{CodexSetupSection.logic-B5cbwzh2.js → CodexSetupSection.logic-CNbTXxKb.js} +2 -2
  29. package/dist/client/assets/{ComboboxClear-DsPTusk5.js → ComboboxClear-Bn_kslrf.js} +2 -2
  30. package/dist/client/assets/{ComboboxGroupLabel-DqaoaBhS.js → ComboboxGroupLabel-fL8lMA25.js} +2 -2
  31. package/dist/client/assets/{CommandBlock-Da9iVEid.js → CommandBlock-DcQXu_lq.js} +2 -2
  32. package/dist/client/assets/ComposerPromptEditor-DQ9wFfKn.js +204 -0
  33. package/dist/client/assets/{CompositeRoot-Dfl7FdSL.js → CompositeRoot-BuwzXGHT.js} +2 -2
  34. package/dist/client/assets/{ConnectionDiagnosisDetails-DCPX1JuG.js → ConnectionDiagnosisDetails-DGbJY7Hw.js} +2 -2
  35. package/dist/client/assets/{ConnectionStatusDot-DVkDejK1.js → ConnectionStatusDot-CixsTBXI.js} +2 -2
  36. package/dist/client/assets/{DRLTVNUE-BEVEy9Nb.js → DRLTVNUE-Cbb71R0Y.js} +2 -2
  37. package/dist/client/assets/{DYY6UVD2-DtPiS3Ow.js → DYY6UVD2-BZn5fuF5.js} +2 -2
  38. package/dist/client/assets/{DevicePanel-B8KdDbzD.js → DevicePanel-JP__PY1s.js} +2 -2
  39. package/dist/client/assets/{DeviceSetup-5wa1rPPZ.js → DeviceSetup-D8qb_qBj.js} +2 -2
  40. package/dist/client/assets/{DialogTitle-JDa7kdjH.js → DialogTitle-B_9LEmy3.js} +2 -2
  41. package/dist/client/assets/{DiffCommentAnnotation-Bp1MeIVC.js → DiffCommentAnnotation-WMKzOwCh.js} +2 -2
  42. package/dist/client/assets/{DiffFileTree-b24emCci.js → DiffFileTree-BSbsOOmA.js} +2 -2
  43. package/dist/client/assets/DiffPanel-BWFuiHvv.js +2 -0
  44. package/dist/client/assets/{DiffWorkerPoolProvider-BoEAlLkf.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-Emg7F_9r.js → EnvironmentMachineIcon-Dpgx67FY.js} +2 -2
  48. package/dist/client/assets/{ExpandableText-CK6tzx1k.js → ExpandableText-Cpm1gOKG.js} +2 -2
  49. package/dist/client/assets/{FNOVOB4O-C31Sm0mF.js → FNOVOB4O-BkEIrB0k.js} +2 -2
  50. package/dist/client/assets/{FieldControl-7KI8YfqD.js → FieldControl-BHe6unoZ.js} +2 -2
  51. package/dist/client/assets/{FileDiff-CXJUPm2t.js → FileDiff-C1vAOUga.js} +2 -2
  52. package/dist/client/assets/{FilePreviewPanel-BMID-IVR.js → FilePreviewPanel-CbpNevZP.js} +4 -4
  53. package/dist/client/assets/{FoldedSettingsSection-Dzi9RecU.js → FoldedSettingsSection-DySTg20x.js} +2 -2
  54. package/dist/client/assets/{FormContext-DAP0MupI.js → FormContext-CmvUzTS-.js} +2 -2
  55. package/dist/client/assets/{HDGCDEEZ-DZ2nNieb.js → HDGCDEEZ-CN-ckGDk.js} +2 -2
  56. package/dist/client/assets/{HSJLKHB7-DlFBBKjs.js → HSJLKHB7-B0BvmnZE.js} +2 -2
  57. package/dist/client/assets/{Icons-aTRNsMJy.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-Drb40Qks.js → K3MD6TGW-IS0rWO1U.js} +2 -2
  61. package/dist/client/assets/{K7RP3OMA-C0M5Zt3R.js → K7RP3OMA-DcqjCOJO.js} +2 -2
  62. package/dist/client/assets/{KeybindingsSettings.logic-mOtug0lc.js → KeybindingsSettings.logic-mF9mJWrc.js} +2 -2
  63. package/dist/client/assets/{LHDIQX7Q-CdTAxECn.js → LHDIQX7Q-CLMgIt4Y.js} +2 -2
  64. package/dist/client/assets/{LUXOKEGN-DtIPjv1z.js → LUXOKEGN-B1dkmN_M.js} +2 -2
  65. package/dist/client/assets/{MathTypeset-DTaIJ55e.js → MathTypeset-qeRVy_bc.js} +2 -2
  66. package/dist/client/assets/{N3JZAHOW-C8Pvhbkj.js → N3JZAHOW-C6sq5aqx.js} +2 -2
  67. package/dist/client/assets/{NUIALGQ3-DY7_VZ5G.js → NUIALGQ3-BG7xJ_qe.js} +2 -2
  68. package/dist/client/assets/{NoProjectsHero-CDfuCTEv.js → NoProjectsHero-B0KzU91d.js} +2 -2
  69. package/dist/client/assets/{O65XPQGZ-BH6EzDhm.js → O65XPQGZ-BEfVfDlS.js} +2 -2
  70. package/dist/client/assets/{O7XIQ6OM-BSPRvWV7.js → O7XIQ6OM-BUiRjV87.js} +2 -2
  71. package/dist/client/assets/{OFQON5FD-VO8HiyY7.js → OFQON5FD-DTgVPbd-.js} +2 -2
  72. package/dist/client/assets/{P4ConnectAccountPages-Cbg00I7Q.js → P4ConnectAccountPages-C4KYM5XU.js} +2 -2
  73. package/dist/client/assets/{P4ConnectSidebarSignIn-C9gBlkFF.js → P4ConnectSidebarSignIn-DNPUNJl_.js} +2 -2
  74. package/dist/client/assets/{PJQHF43J-yTbK55y3.js → PJQHF43J-QRnhQpHu.js} +2 -2
  75. package/dist/client/assets/PanelLayoutControls-4VFKEoHg.js +216 -0
  76. package/dist/client/assets/{PierreEntryIcon-HuUxlwtG.js → PierreEntryIcon-DeI-j_7w.js} +2 -2
  77. package/dist/client/assets/{PopoverHandle-CG975ng4.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-UXGwc_-W.js → ProjectFavicon-_6hkSNzm.js} +3 -3
  81. package/dist/client/assets/{ProjectIconPickerDialog-BAM7e1e5.js → ProjectIconPickerDialog-DeL1rZxy.js} +2 -2
  82. package/dist/client/assets/{ProjectMonogram-f16fmYcx.js → ProjectMonogram-Cn4l-YGU.js} +2 -2
  83. package/dist/client/assets/{ProviderAuthTerminal-e0ZkNHAb.js → ProviderAuthTerminal-qGeMxZDy.js} +2 -2
  84. package/dist/client/assets/ProviderModelPicker-DJQYH_Pp.js +2 -0
  85. package/dist/client/assets/{ProviderSettingsForm-CXMFT8YA.js → ProviderSettingsForm-BSVuPnR0.js} +2 -2
  86. package/dist/client/assets/PullRequestCodeTab-0OaJE6XS.js +6 -0
  87. package/dist/client/assets/{RHNBAITX-TQrYdbHC.js → RHNBAITX-ChqB7inB.js} +2 -2
  88. package/dist/client/assets/{ReadOnlySourcePreview-xMB_y284.js → ReadOnlySourcePreview-B08Wms4m.js} +2 -2
  89. package/dist/client/assets/{RenderErrorBoundary-C2ZkZ4DB.js → RenderErrorBoundary-BsOuLEci.js} +3 -3
  90. package/dist/client/assets/{SLD4V6NK-Bz1tyL2C.js → SLD4V6NK-IkYRGtTH.js} +2 -2
  91. package/dist/client/assets/ScheduledTasksSettings-1UDkELZo.js +4 -0
  92. package/dist/client/assets/{ScopedSwitch-DBUAjY1n.js → ScopedSwitch-Bhp6-hCj.js} +2 -2
  93. package/dist/client/assets/{ScrollAreaCorner-U1Zhpkdl.js → ScrollAreaCorner-BPMuWLbs.js} +2 -2
  94. package/dist/client/assets/{SecretInput-BxYmGvR5.js → SecretInput-RlOzrLKL.js} +2 -2
  95. package/dist/client/assets/{SelectScrollUpArrow-CJ4E0xi4.js → SelectScrollUpArrow-6kh66YCd.js} +2 -2
  96. package/dist/client/assets/{SettingsPanels-DRK5QQ04.js → SettingsPanels-BfBUSBAG.js} +6 -6
  97. package/dist/client/assets/{SettingsPanels.logic-Bdp6GzIj.js → SettingsPanels.logic-BsFZYDgm.js} +2 -2
  98. package/dist/client/assets/{SettingsScopeNotice-DYiUHoov.js → SettingsScopeNotice-H7UzC9bb.js} +2 -2
  99. package/dist/client/assets/{T3PCR2KE-DJwqsK9f.js → T3PCR2KE-BxaunvVy.js} +2 -2
  100. package/dist/client/assets/{TKWO2OVW-CRU32th0.js → TKWO2OVW-DFURsfqA.js} +2 -2
  101. package/dist/client/assets/{TSHNXIZL-dMhDuHVe.js → TSHNXIZL-CIukdyLy.js} +2 -2
  102. package/dist/client/assets/{ThemeEditorPanel-BIQc-w2Q.js → ThemeEditorPanel-otrA-nTg.js} +3 -3
  103. package/dist/client/assets/{ThreadTerminalDrawer-BqO5rPzw.js → ThreadTerminalDrawer-BQKZCFAC.js} +4 -4
  104. package/dist/client/assets/TooltipViewport-ZmVCer7P.js +2 -0
  105. package/dist/client/assets/{UQJE5E4I-DH2S3Hdw.js → UQJE5E4I-CfqCotH2.js} +2 -2
  106. package/dist/client/assets/{USNYFO5S-Cfz4g-2W.js → USNYFO5S-CctAAheU.js} +2 -2
  107. package/dist/client/assets/{Virtualizer-ChRGRE40.js → Virtualizer-CImHNxBq.js} +2 -2
  108. package/dist/client/assets/{WEVWDWVA-C55QWN7O.js → WEVWDWVA-DS9YO9IT.js} +2 -2
  109. package/dist/client/assets/{WorkspaceBreadcrumb-8nBISaRF.js → WorkspaceBreadcrumb-BW_omYU1.js} +2 -2
  110. package/dist/client/assets/{WorkspacePageContainer-BGE_kHaP.js → WorkspacePageContainer-BS8FWt_4.js} +2 -2
  111. package/dist/client/assets/{WorkspacePageHeader-D704geLh.js → WorkspacePageHeader-CE_94tTR.js} +2 -2
  112. package/dist/client/assets/{X5RFHQXM-hmS6q1sh.js → X5RFHQXM-B0KbwoE1.js} +2 -2
  113. package/dist/client/assets/{X62E3GBT-BhTtqjj4.js → X62E3GBT-wpz8X9Yh.js} +2 -2
  114. package/dist/client/assets/{XBNEOJTC-1paZyqxX.js → XBNEOJTC-DFRK5c6Y.js} +2 -2
  115. package/dist/client/assets/{YHV2MVVZ-DbfthGUh.js → YHV2MVVZ-1NnqTTZ2.js} +2 -2
  116. package/dist/client/assets/{YURCZMG2-D8tAzwGP.js → YURCZMG2-rnzWY5ij.js} +2 -2
  117. package/dist/client/assets/{YVG2LODB-DMSQWWQ_.js → YVG2LODB-Dxuuk2M-.js} +2 -2
  118. package/dist/client/assets/_chat-1QGQLbCc.js +45 -0
  119. package/dist/client/assets/{_chat.design-CdPf_wsA.js → _chat.design-z2pu_9A5.js} +2 -2
  120. package/dist/client/assets/{_chat.index-BkTRJLOf.js → _chat.index-D8X9o5jY.js} +2 -2
  121. package/dist/client/assets/{_chat.new-CEmRJFEH.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-DiE1d01s.js → alert-DO06etEs.js} +2 -2
  124. package/dist/client/assets/{assetUrls-BeScRf6b.js → assetUrls-CmOUMX2M.js} +2 -2
  125. package/dist/client/assets/assets-aBpLf8r4.js +2 -0
  126. package/dist/client/assets/{browserHistoryStore-hrG24FfH.js → browserHistoryStore-tYgeZygn.js} +2 -2
  127. package/dist/client/assets/{browserLinkTarget-D8HEmVsi.js → browserLinkTarget-CQFfJKWJ.js} +2 -2
  128. package/dist/client/assets/{checkbox-CwFE3KXZ.js → checkbox-BEQFb7GO.js} +2 -2
  129. package/dist/client/assets/{color-picker-BKtR2mwD.js → color-picker-CXfnfmuH.js} +2 -2
  130. package/dist/client/assets/{combobox-DBUxcuwi.js → combobox--XoXA5uu.js} +2 -2
  131. package/dist/client/assets/{command-NV0JEoGo.js → command-E2aLhsct.js} +2 -2
  132. package/dist/client/assets/composer-logic-BPTz1APL.js +6 -0
  133. package/dist/client/assets/{composerDraftUploads-BmpBCVnP.js → composerDraftUploads-b_0oxKs9.js} +2 -2
  134. package/dist/client/assets/{connect-Bzgsrfe8.js → connect-CU9dNvTt.js} +2 -2
  135. package/dist/client/assets/{connect-agent-BCguLPkZ.js → connect-agent-Byc9PCdW.js} +2 -2
  136. package/dist/client/assets/{design-BGLTZdWG.js → design-CoGbXd61.js} +2 -2
  137. package/dist/client/assets/{device-D0-STSSP.js → device-DmH6IHQ4.js} +2 -2
  138. package/dist/client/assets/{dialog-pqqgtsKn.js → dialog-CBBxT1gk.js} +2 -2
  139. package/dist/client/assets/{diffRendering-eAJMSnXr.js → diffRendering-BOVFJuWd.js} +2 -2
  140. package/dist/client/assets/{dist-KeWCSS5h.js → dist-B2P3f-0Q.js} +3 -3
  141. package/dist/client/assets/{draft-input-DrGl-qts.js → draft-input-CSOOVntS.js} +2 -2
  142. package/dist/client/assets/{duoViewer-DKygyhUj.js → duoViewer-BhHYrurM.js} +2 -2
  143. package/dist/client/assets/{dynamic-DKhgWyT6.js → dynamic-BhzrutAo.js} +2 -2
  144. package/dist/client/assets/{embeddedScripts-WSYzbtcW.js → embeddedScripts-43_R83vp.js} +2 -2
  145. package/dist/client/assets/{empty-Du5F51Da.js → empty-FOL5U4KY.js} +2 -2
  146. package/dist/client/assets/entities-Bqo0n1Pb.js +2 -0
  147. package/dist/client/assets/{fileLinks-BEJjCE8r.js → fileLinks-D4GSqJYj.js} +2 -2
  148. package/dist/client/assets/{fileTreeExpansion-CCF3XVRn.js → fileTreeExpansion-BBT5F8P1.js} +2 -2
  149. package/dist/client/assets/{getDiffFileInput-Dkc1Whpr.js → getDiffFileInput-CGw09SPI.js} +2 -2
  150. package/dist/client/assets/{guideRunStore-CVyie1IJ.js → guideRunStore-DvIkVECt.js} +2 -2
  151. package/dist/client/assets/{htmlRender-fSOuRG49.js → htmlRender-CmEeFzCo.js} +2 -2
  152. package/dist/client/assets/{index-RvCv9K-x.js → index-B1djVqM4.js} +3 -3
  153. package/dist/client/assets/{input-GkmNnHh7.js → input-ekYqAkUx.js} +2 -2
  154. package/dist/client/assets/{input-group-Cql1yQRL.js → input-group-C3pxk97H.js} +2 -2
  155. package/dist/client/assets/{kbd-D2OGhJqG.js → kbd-3FPzNikV.js} +2 -2
  156. package/dist/client/assets/{keybindings-1XWkWeQB.js → keybindings-B3oDRRkK.js} +2 -2
  157. package/dist/client/assets/{lazy-BUyZ03gL.js → lazy-DyNR0b0B.js} +4 -4
  158. package/dist/client/assets/{lazyRouteComponent-BXmOK9bz.js → lazyRouteComponent-BPxq_G_s.js} +2 -2
  159. package/dist/client/assets/{link-BGMNeg05.js → link-B3B5a5Ju.js} +2 -2
  160. package/dist/client/assets/{linkedPrompt-B3l4m_6D.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-CsA5Lv5E.js → mediaReference-Bb8H-qbI.js} +2 -2
  164. package/dist/client/assets/{mediaSource-BbYoxHZJ.js → mediaSource-C2MsZgy8.js} +2 -2
  165. package/dist/client/assets/number-field-SoHEiP55.js +2 -0
  166. package/dist/client/assets/{observeResize-CNtO3VS7.js → observeResize-3Vj9DYOV.js} +2 -2
  167. package/dist/client/assets/{onboarding-KXMrOHsw.js → onboarding-CPgiVEVK.js} +2 -2
  168. package/dist/client/assets/{openFileInPreview-BKTnNQFl.js → openFileInPreview-BBWCOLh_.js} +2 -2
  169. package/dist/client/assets/{p4ProjectFile-sAVjpCzn.js → p4ProjectFile-qmvlbzKv.js} +2 -2
  170. package/dist/client/assets/{pair-BIaVaT-B.js → pair-CZnRGdd8.js} +2 -2
  171. package/dist/client/assets/{pendingSendStore-CPz2p40W.js → pendingSendStore-L5KquCDf.js} +2 -2
  172. package/dist/client/assets/{phoneViewer-DGKQHyy3.js → phoneViewer-D-8v-sMf.js} +2 -2
  173. package/dist/client/assets/{pierre-icons-6ByaxkH5.js → pierre-icons-jwqMPUxD.js} +2 -2
  174. package/dist/client/assets/{popover-BIXQitBy.js → popover-OfG3wVsl.js} +2 -2
  175. package/dist/client/assets/{preview-BcEybEc8.js → preview-BYnEURcB.js} +2 -2
  176. package/dist/client/assets/{preview-C3ymkoAM.js → preview-DGdQ5Ycc.js} +2 -2
  177. package/dist/client/assets/{previewMiniPlayerStore-DWw2A_gt.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-CNXQwWP8.js → projectScriptEditor-gWuw6vwd.js} +2 -2
  182. package/dist/client/assets/{providerSkills-CNeLyiqf.js → providerSkills-C_Rxqah9.js} +2 -2
  183. package/dist/client/assets/{pullRequestDetail.logic-BNpxef-3.js → pullRequestDetail.logic-RASi2EgP.js} +4 -4
  184. package/dist/client/assets/{pullRequestIcons-CSs54zQk.js → pullRequestIcons-ucGaXXG7.js} +2 -2
  185. package/dist/client/assets/{pullRequestReviewStore-BawbGhnx.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-yq5YEgUO.js → radio-group-Ciy_K5uE.js} +2 -2
  190. package/dist/client/assets/{renderScheduler--3RDWz9Z.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-DefawCwN.js → scheduledTasksSettings.logic-CVIC4Kpr.js} +3 -3
  196. package/dist/client/assets/{scroll-area-CfW8fzQ8.js → scroll-area-yyfi3ycu.js} +2 -2
  197. package/dist/client/assets/{select-C10oXKGz.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-yxXjF8AQ.js → session-C949OsEI.js} +2 -2
  201. package/dist/client/assets/session-logic-DkSfwnHl.js +26 -0
  202. package/dist/client/assets/{settings-CgshkEb_.js → settings-B0O54Q3P.js} +2 -2
  203. package/dist/client/assets/{settings.appearance-yicuncxz.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-CZ5aXdyA.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-j9E6N2pN.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-BCrYSHkU.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-BQ-LrcTn.js → settings.keybindings-BL57H4sD.js} +2 -2
  214. package/dist/client/assets/{settings.open-source-licenses-BHiHgzgF.js → settings.open-source-licenses-DaS82UhN.js} +2 -2
  215. package/dist/client/assets/{settings.plugins-DavhWo4Q.js → settings.plugins-DnS3RrT2.js} +4 -4
  216. package/dist/client/assets/{settings.projects-uuJOwkSl.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-DoWHIDOp.js → settings.scheduled-tasks-IEAC3STn.js} +2 -2
  219. package/dist/client/assets/{settings.snap-shot-ClKlVUUJ.js → settings.snap-shot-BaOFk9WR.js} +2 -2
  220. package/dist/client/assets/{settings.source-control-o8jFa_Cr.js → settings.source-control-BW16AA5z.js} +2 -2
  221. package/dist/client/assets/{settings.storage-Bb-cW0xG.js → settings.storage-D4vBYBRP.js} +2 -2
  222. package/dist/client/assets/settingsLayout-CFQx1XDM.js +3 -0
  223. package/dist/client/assets/{sidebar-Bd6PzVyD.js → sidebar-C1E4GqL6.js} +2 -2
  224. package/dist/client/assets/{sidebarProjectGrouping-C13IyN_p.js → sidebarProjectGrouping-9cUrCOXH.js} +2 -2
  225. package/dist/client/assets/{skeleton-pd7m2J5F.js → skeleton-BCpBrYxh.js} +2 -2
  226. package/dist/client/assets/{sourceControl-Y9v_vyKt.js → sourceControl-DwJWPP0h.js} +2 -2
  227. package/dist/client/assets/{sourceControlClients-KQ5315mN.js → sourceControlClients-BBJW7ra4.js} +2 -2
  228. package/dist/client/assets/{spinner-CW23--q5.js → spinner-CSTrcxhP.js} +2 -2
  229. package/dist/client/assets/{terminal-links-Bd9AoAyA.js → terminal-links-D18LpQ1T.js} +2 -2
  230. package/dist/client/assets/{terminalSessions-CF7f4A-6.js → terminalSessions-C2NUFncF.js} +2 -2
  231. package/dist/client/assets/{textarea-DSS-lavF.js → textarea-R4UQ47Ns.js} +2 -2
  232. package/dist/client/assets/{themePalette-C_1pk_Mi.js → themePalette-neUNWCzK.js} +3 -3
  233. package/dist/client/assets/toast-B84QdqqM.js +2 -0
  234. package/dist/client/assets/{toggle-Cpfo0sMT.js → toggle-BH5BGBcD.js} +2 -2
  235. package/dist/client/assets/{toggle-group-FrArhs7R.js → toggle-group-Di3SFV73.js} +2 -2
  236. package/dist/client/assets/{tooltip-CSzrAm8M.js → tooltip-D-GRl-oZ.js} +2 -2
  237. package/dist/client/assets/{uiStateStore-VHQ8vDs5.js → uiStateStore-xSkh4_PU.js} +2 -2
  238. package/dist/client/assets/{usage-uwswTMhu.js → usage-DUdXloVo.js} +2 -2
  239. package/dist/client/assets/{usageAccess-BDwH_c8I.js → usageAccess-DSLF-sRE.js} +2 -2
  240. package/dist/client/assets/{usageFormat-CKgwjLMR.js → usageFormat-Bzyvr9m4.js} +2 -2
  241. package/dist/client/assets/{usageShortcuts-lXBRgPmi.js → usageShortcuts-D6nQeRtx.js} +2 -2
  242. package/dist/client/assets/{use-atom-command-CSWaAmR7.js → use-atom-command-DA6OG-Qk.js} +2 -2
  243. package/dist/client/assets/{useAriaLabelledBy-vgEmgPPR.js → useAriaLabelledBy-PLuOxvFb.js} +2 -2
  244. package/dist/client/assets/{useHandleNewThread-BVFM3SUe.js → useHandleNewThread-Dm0SCq59.js} +2 -2
  245. package/dist/client/assets/{useLocation-FEfJrgGU.js → useLocation-Bqc94klS.js} +2 -2
  246. package/dist/client/assets/{useNavigate-Lp_S-tAl.js → useNavigate-DdjG4MB_.js} +2 -2
  247. package/dist/client/assets/{useNavigateBack-BTJoRrRy.js → useNavigateBack-sP0LsL3p.js} +2 -2
  248. package/dist/client/assets/{useP4ConnectAuthPrompt-7Z8osIH2.js → useP4ConnectAuthPrompt-C9d7n33S.js} +2 -2
  249. package/dist/client/assets/{useParams-8KxPyQmv.js → useParams-DZQvRQLJ.js} +2 -2
  250. package/dist/client/assets/{usePermissionStatus-CyvlYHNs.js → usePermissionStatus-BzfAUU9X.js} +2 -2
  251. package/dist/client/assets/{usePullRequestActions-DfyxdDPg.js → usePullRequestActions-DIjGLg1E.js} +3 -3
  252. package/dist/client/assets/{useRegisterFieldControl-Dj6RbECy.js → useRegisterFieldControl-CyBVe0G0.js} +2 -2
  253. package/dist/client/assets/{useScopedModelAvailability-BfFbT2DU.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-CIETplg9.js → welcome-BIKH3rbU.js} +2 -2
  258. package/dist/client/index.html +1 -1
  259. package/dist/{renderer-D8FhaVWU.mjs → renderer-CveKT929.mjs} +26 -3
  260. package/dist/{runtime-a3PrAU7n.mjs → runtime-DGGSjC6Q.mjs} +149 -5
  261. package/package.json +1 -1
  262. package/dist/client/assets/AlertDialogRoot-B--i3imS.js +0 -2
  263. package/dist/client/assets/ChatGptUsageButton-LQ3LzsF3.js +0 -2
  264. package/dist/client/assets/ComposerPromptEditor-Bz4_w6ez.js +0 -204
  265. package/dist/client/assets/DiffPanel-bEjr64Vx.js +0 -2
  266. package/dist/client/assets/EmbeddedDesign-Cud7UEy4.css +0 -1
  267. package/dist/client/assets/EmbeddedDesign-DmRjhA9k.js +0 -21
  268. package/dist/client/assets/Input-rVh9fuLP.js +0 -2
  269. package/dist/client/assets/JZOYTAAL-DXVzZiqj.js +0 -1
  270. package/dist/client/assets/PanelLayoutControls-40ju6vkz.js +0 -216
  271. package/dist/client/assets/PreviewPanel-Ljaq9IHA.js +0 -2
  272. package/dist/client/assets/ProjectDefaultsSettings-DhwkzlK6.js +0 -2
  273. package/dist/client/assets/ProviderModelPicker-BviWI2wX.js +0 -2
  274. package/dist/client/assets/PullRequestCodeTab-Bm67cV34.js +0 -6
  275. package/dist/client/assets/ScheduledTasksSettings-D-GMMbJH.js +0 -4
  276. package/dist/client/assets/TooltipViewport-Bz56sWCM.js +0 -2
  277. package/dist/client/assets/_chat-CXVo1NVJ.js +0 -46
  278. package/dist/client/assets/_chat.pull-requests-4M0tUrJ6.js +0 -2
  279. package/dist/client/assets/assets-RdKoqY9e.js +0 -2
  280. package/dist/client/assets/composer-logic-BQdFVlkE.js +0 -6
  281. package/dist/client/assets/entities-n6SMnPE8.js +0 -2
  282. package/dist/client/assets/main-BP1f3auf.css +0 -2
  283. package/dist/client/assets/main-Dcfxjdkd.js +0 -29
  284. package/dist/client/assets/number-field-jauVDwvy.js +0 -2
  285. package/dist/client/assets/primary-DD11poOa.js +0 -2
  286. package/dist/client/assets/primaryCloudLinkState-CD2_f6q-.js +0 -2
  287. package/dist/client/assets/projectFilesQueryState-C8dGr8oR.js +0 -2
  288. package/dist/client/assets/pullRequests-jsc4Hq78.js +0 -2
  289. package/dist/client/assets/queries-DZV2RDc9.js +0 -2
  290. package/dist/client/assets/query-BV3IuYff.js +0 -2
  291. package/dist/client/assets/rightPanelStore-CeZBJCMI.js +0 -2
  292. package/dist/client/assets/runtime-DSZ2mWrf.js +0 -6
  293. package/dist/client/assets/runtime-DTUiqO10.js +0 -3
  294. package/dist/client/assets/runtimeModeConfig-BwioIXVs.js +0 -2
  295. package/dist/client/assets/server-ztj8tD38.js +0 -2
  296. package/dist/client/assets/session-logic-w7gGMFHb.js +0 -26
  297. package/dist/client/assets/settings.archived-ZXG8lJ_T.js +0 -2
  298. package/dist/client/assets/settings.computer-use-lOJg1Jos.js +0 -2
  299. package/dist/client/assets/settings.connections-DSPQOd-W.js +0 -2
  300. package/dist/client/assets/settings.decisions-C8qxQCjl.js +0 -2
  301. package/dist/client/assets/settings.diagnostics-yio3SGbE.js +0 -2
  302. package/dist/client/assets/settings.integrations-Dl-vtiOS.js +0 -2
  303. package/dist/client/assets/settings.providers-rZQTQdtf.js +0 -3
  304. package/dist/client/assets/settingsLayout-DzBeWTUO.js +0 -3
  305. package/dist/client/assets/toast-BFuAqla3.js +0 -2
  306. package/dist/client/assets/useSettings-CPPvBMmM.js +0 -3
  307. package/dist/client/assets/utils-BE5iQuUP.js +0 -37
  308. package/dist/client/assets/vcsRefInvalidation-DCdd2BDA.js +0 -2
@@ -1,216 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PullRequestCodeTab-Bm67cV34.js","assets/react-DH3P2YXY.js","assets/jsx-runtime-BnjsACtP.js","assets/utils-BE5iQuUP.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-DSZ2mWrf.js","assets/runtime-DTUiqO10.js","assets/TooltipViewport-Bz56sWCM.js","assets/toast-BFuAqla3.js","assets/spinner-CW23--q5.js","assets/useParams-8KxPyQmv.js","assets/DiffFileTree-b24emCci.js","assets/useSettings-CPPvBMmM.js","assets/server-ztj8tD38.js","assets/session-yxXjF8AQ.js","assets/use-atom-command-CSWaAmR7.js","assets/themePalette-C_1pk_Mi.js","assets/diffRendering-eAJMSnXr.js","assets/index-RvCv9K-x.js","assets/fileTreeExpansion-CCF3XVRn.js","assets/pierre-icons-6ByaxkH5.js","assets/query-BV3IuYff.js","assets/DiffCommentAnnotation-Bp1MeIVC.js","assets/Virtualizer-ChRGRE40.js","assets/getDiffFileInput-Dkc1Whpr.js","assets/main-Dcfxjdkd.js","assets/vcsRefInvalidation-DCdd2BDA.js","assets/entities-n6SMnPE8.js","assets/number-field-jauVDwvy.js","assets/useRegisterFieldControl-Dj6RbECy.js","assets/FormContext-DAP0MupI.js","assets/CSPContext-DGVCKkcb.js","assets/select-C10oXKGz.js","assets/SelectScrollUpArrow-CJ4E0xi4.js","assets/link-BGMNeg05.js","assets/redirect-D3L17tzd.js","assets/lazyRouteComponent-BXmOK9bz.js","assets/useNavigate-Lp_S-tAl.js","assets/useLocation-FEfJrgGU.js","assets/rightPanelStore-CeZBJCMI.js","assets/toastHelpers-DxXYm50b.js","assets/queries-DZV2RDc9.js","assets/session-logic-w7gGMFHb.js","assets/htmlRender-fSOuRG49.js","assets/mediaSource-BbYoxHZJ.js","assets/fileLinks-BEJjCE8r.js","assets/mediaReference-CsA5Lv5E.js","assets/usageFormat-CKgwjLMR.js","assets/timestampFormat-wac2e_Jz.js","assets/env-wK1YYxA8.js","assets/tooltip-CSzrAm8M.js","assets/skeleton-pd7m2J5F.js","assets/useAriaLabelledBy-vgEmgPPR.js","assets/toggle-Cpfo0sMT.js","assets/toggle-group-FrArhs7R.js","assets/CompositeRoot-Dfl7FdSL.js","assets/input-GkmNnHh7.js","assets/Input-rVh9fuLP.js","assets/FieldControl-7KI8YfqD.js","assets/scroll-area-CfW8fzQ8.js","assets/ScrollAreaCorner-U1Zhpkdl.js","assets/dist-KeWCSS5h.js","assets/DialogTitle-JDa7kdjH.js","assets/dialog-pqqgtsKn.js","assets/sidebar-Bd6PzVyD.js","assets/useResizeDrag-Dc7crya0.js","assets/observeResize-CNtO3VS7.js","assets/AnimatedHeight-CFR4EWDw.js","assets/assets-RdKoqY9e.js","assets/sourceControl-Y9v_vyKt.js","assets/assetUrls-BeScRf6b.js","assets/browserHistoryStore-hrG24FfH.js","assets/preview-C3ymkoAM.js","assets/openFileInPreview-BKTnNQFl.js","assets/keybindings-1XWkWeQB.js","assets/Icons-aTRNsMJy.js","assets/preview-BcEybEc8.js","assets/PierreEntryIcon-HuUxlwtG.js","assets/RenderErrorBoundary-C2ZkZ4DB.js","assets/sourceControlClients-KQ5315mN.js","assets/browserLinkTarget-D8HEmVsi.js","assets/pullRequestIcons-CSs54zQk.js","assets/pullRequests-jsc4Hq78.js","assets/threadSort-Bd2rijEy.js","assets/popover-BIXQitBy.js","assets/PopoverHandle-CG975ng4.js","assets/ProjectFavicon-UXGwc_-W.js","assets/ProjectMonogram-f16fmYcx.js","assets/projectFilesQueryState-C8dGr8oR.js","assets/checkbox-CwFE3KXZ.js","assets/CheckboxIndicator-IpoyLEZ-.js","assets/FieldItemContext-BsKb7ObC.js","assets/terminalSessions-CF7f4A-6.js","assets/AlertDialogRoot-B--i3imS.js","assets/uiStateStore-VHQ8vDs5.js","assets/composer-logic-BQdFVlkE.js","assets/composerTrigger-BGi0iyhl.js","assets/useHandleNewThread-BVFM3SUe.js","assets/p4ProjectFile-sAVjpCzn.js","assets/composerDraftUploads-BmpBCVnP.js","assets/guideRunStore-CVyie1IJ.js","assets/pullRequestDetail.logic-BNpxef-3.js","assets/pullRequestReviewStore-BawbGhnx.js","assets/sidebarProjectGrouping-C13IyN_p.js","assets/EnvironmentMachineIcon-Emg7F_9r.js","assets/alert-DiE1d01s.js","assets/semver-CFbvOQKc.js","assets/ChatGptUsageButton-LQ3LzsF3.js","assets/kbd-D2OGhJqG.js","assets/settingsLayout-DzBeWTUO.js","assets/WorkspacePageContainer-BGE_kHaP.js","assets/KeybindingsSettings.logic-mOtug0lc.js","assets/usageShortcuts-lXBRgPmi.js","assets/primaryCloudLinkState-CD2_f6q-.js","assets/command-NV0JEoGo.js","assets/ComboboxClear-DsPTusk5.js","assets/ComboboxGroupLabel-DqaoaBhS.js","assets/ConnectionStatusDot-DVkDejK1.js","assets/standalone-page-3TM7ZX16.js","assets/primary-DD11poOa.js","assets/onboarding-KXMrOHsw.js","assets/scheduledTasksSettings.logic-DefawCwN.js","assets/main-BP1f3auf.css","assets/DiffWorkerPoolProvider-BoEAlLkf.js","assets/textarea-DSS-lavF.js"])))=>i.map(i=>d[i]);
2
- import{a as e,t}from"./react-DH3P2YXY.js";import{t as n}from"./index-RvCv9K-x.js";import{n as r,t as i}from"./jsx-runtime-BnjsACtP.js";import{$_ as a,$n as o,A as s,Ad as c,Bd as l,Bp as u,D as d,Df as f,El as p,F as m,Gp as h,Hy as g,If as _,Im as v,Ip as y,Jn as b,Jp as x,K_ as S,Ky as C,Md as w,Ms as T,Np as E,Od as D,Om as O,Pp as k,Qd as A,Qf as j,Qn as M,Qs as N,Rp as P,Xm as F,Xn as I,Yn as L,Zn as ee,Zo as R,Zs as z,_m as B,ab as te,ad as V,af as H,ar as ne,bf as re,cf as U,dr as W,ec as ie,eh as ae,ep as oe,fd as se,fp as ce,fr as le,gd as ue,hf as de,hp as fe,id as pe,if as me,jd as he,jm as ge,js as _e,kd as ve,kf as ye,ks as be,lf as xe,lm as Se,mg as Ce,nh as we,nm as Te,nr as Ee,od as De,of as Oe,or as ke,pp as Ae,qm as je,rm as Me,rr as Ne,t as G,th as Pe,tr as Fe,ts as Ie,uf as Le,ur as Re,vm as ze,wa as Be,wp as Ve,ym as He,zf as Ue,zm as We}from"./utils-BE5iQuUP.js";import{W as Ge}from"./runtime-DSZ2mWrf.js";import{A as Ke,T as qe,k as Je,w as Ye}from"./entities-n6SMnPE8.js";import{_n as Xe,fn as Ze,gn as Qe,hn as $e,sn as et,yn as tt}from"./runtime-DTUiqO10.js";import{F as nt,K as rt,P as it,V as at,_ as ot,l as st,q as ct,x as lt,y as ut}from"./TooltipViewport-Bz56sWCM.js";import{J as dt,L as ft,R as pt,n as mt}from"./ChatMarkdown-DfVVLQX2.js";import{a as ht,o as gt,s as _t,t as vt}from"./select-C10oXKGz.js";import{t as yt}from"./spinner-CW23--q5.js";import{i as bt,m as xt,p as St}from"./toast-BFuAqla3.js";import{E as Ct,J as wt,K as Tt,f as Et}from"./useSettings-CPPvBMmM.js";import{s as Dt}from"./server-ztj8tD38.js";import{i as Ot,n as kt}from"./session-yxXjF8AQ.js";import{n as At}from"./query-BV3IuYff.js";import{t as jt}from"./use-atom-command-CSWaAmR7.js";import{t as K,u as Mt}from"./rightPanelStore-CeZBJCMI.js";import{u as Nt}from"./queries-DZV2RDc9.js";import{C as Pt,Q as Ft,Z as It,_ as Lt,at as Rt,c as zt,d as Bt,ft as Vt,l as Ht,lt as Ut,nt as Wt,ot as Gt,s as Kt,t as qt,tt as Jt,u as Yt,v as Xt,w as Zt}from"./diffRendering-eAJMSnXr.js";import{C as Qt,E as $t,G as en,H as tn,K as nn,U as rn,V as an,W as on,d as sn,i as cn,u as ln}from"./Virtualizer-ChRGRE40.js";import{l as un,ut as dn}from"./getDiffFileInput-Dkc1Whpr.js";import{i as fn,r as pn,t as mn}from"./DiffWorkerPoolProvider-BoEAlLkf.js";import{t as hn}from"./cloneFileDiffMetadata-zVRGqYgv.js";import{n as gn,r as _n,t as vn}from"./FileDiff-CXJUPm2t.js";import{S as yn,a as bn,b as xn,i as Sn,n as Cn,r as wn,t as Tn}from"./DiffCommentAnnotation-Bp1MeIVC.js";import{r as En}from"./mediaSource-BbYoxHZJ.js";import{o as Dn}from"./timestampFormat-wac2e_Jz.js";import{t as On}from"./env-wK1YYxA8.js";import{a as q,n as J,r as kn,t as Y}from"./tooltip-CSzrAm8M.js";import{t as An}from"./skeleton-pd7m2J5F.js";import{t as jn}from"./textarea-DSS-lavF.js";import{t as Mn}from"./toggle-Cpfo0sMT.js";import{n as Nn,t as Pn}from"./toggle-group-FrArhs7R.js";import{i as Fn,l as In,o as Ln,r as Rn,s as zn,t as Bn}from"./combobox-DBUxcuwi.js";import{t as Vn}from"./input-GkmNnHh7.js";import{t as Hn}from"./scroll-area-CfW8fzQ8.js";import{a as Un,c as Wn,i as Gn,o as Kn,r as qn,s as Jn,t as Yn}from"./dialog-pqqgtsKn.js";import{t as Xn}from"./useResizeDrag-Dc7crya0.js";import{a as Zn,i as Qn,o as $n,r as er,t as tr}from"./empty-Du5F51Da.js";import{i as nr}from"./device-D0-STSSP.js";import{t as rr}from"./observeResize-CNtO3VS7.js";import{n as ir,t as ar}from"./assetUrls-BeScRf6b.js";import{f as or}from"./browserHistoryStore-hrG24FfH.js";import{_ as sr,y as cr}from"./keybindings-1XWkWeQB.js";import{i as lr,n as ur}from"./Icons-aTRNsMJy.js";import{t as dr}from"./PierreEntryIcon-HuUxlwtG.js";import{C as fr,S as pr,T as mr,_ as hr,a as gr,b as _r,c as vr,d as yr,g as br,h as xr,l as Sr,lt as Cr,m as wr,nt as Tr,o as Er,p as Dr,s as Or,u as kr,ut as Ar,v as jr,w as Mr,x as Nr,y as Pr}from"./RenderErrorBoundary-C2ZkZ4DB.js";import{n as Fr,r as Ir}from"./sourceControlClients-KQ5315mN.js";import{n as X}from"./pullRequestIcons-CSs54zQk.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-jsc4Hq78.js";import{a as Gr,i as Kr,n as qr,o as Jr,t as Yr}from"./popover-BIXQitBy.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-BNpxef-3.js";import{i as Li,n as Ri,r as zi,t as Bi}from"./pullRequestReviewStore-BawbGhnx.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-VHQ8vDs5.js";import{n as Qi}from"./useHandleNewThread-BVFM3SUe.js";import{i as $i,m as ea,n as ta,r as na,t as ra}from"./guideRunStore-CVyie1IJ.js";import{n as ia}from"./EnvironmentMachineIcon-Emg7F_9r.js";import{i as aa,n as oa,r as sa,t as ca}from"./alert-DiE1d01s.js";import{t as la}from"./kbd-D2OGhJqG.js";import{d as ua,l as da,t as fa,u as pa}from"./command-NV0JEoGo.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-Dcfxjdkd.js";import"./WorkspacePageHeader-D704geLh.js";import{r as Ea,s as Da,t as Oa}from"./usePullRequestActions-DfyxdDPg.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(Ft,``),t.before(r)):(r.setAttribute(It,``),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=`${wn}\n${La}`;let i=document.createElement(`div`);i.innerHTML=bn;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 Sn({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(yn(e)&&!e.altKey&&!e.shiftKey&&(e.key.toLowerCase()===`f`||e.code===`KeyF`)){e.preventDefault(),this.open();return}if(this.#n==null)return;let t=xn(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;un({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=Qt()?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=Jt;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:Gt},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??Wt}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??Jt.hunkLineCount,lineHeight:e?.lineHeight??Jt.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??Jt.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??Jt.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??Rt}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return Ut&&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(){en(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(Vt),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=!on(r,i),o=!on(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),rn(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?(en(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):nn(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??Gt;return Lt()&&Pt(e)?(this.clearReadySubscription(),!0):(dn(this.pendingHighlighterTheme,e)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=e;let t=!1;return Xt({themes:Zt(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 _n(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 fn(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&&tn(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=an({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!dn(e.theme??Gt,t.theme??Gt)||(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||$t(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 G(`flex items-center justify-between gap-2`,e===`embedded`?`px-2`:`px-4`,On&&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=On&&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=G(`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)(An,{className:`size-2.5`})}),i=(0,$.jsx)(An,{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)(An,{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)(An,{shape:`pill`,className:`h-3 w-5`}),(0,$.jsx)(An,{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)(An,{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)(An,{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)(An,{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=ln(),D=(0,Z.useContext)(cn),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=sn(e=>{p?.(e)}),L=C!==void 0,ee=sn((e,t,n)=>{if(E==null)throw Error(`CodeView: EditContext is not attached`);let r={...a,...t};return E(e,r,n)}),R=sn((e,t)=>{l?.(e,t)}),z=sn((e,t,n)=>u?.(e,t,n)??`reject`),B=sn(e=>{d?.(e)}),te=(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:ee,onItemEditChange:l==null?void 0:R,onItemEditComplete:u==null?void 0:z,onRevealSearchMatch:d==null?void 0:B}),[E,L,ee,R,z,B,I,F,P,k,j,o,l,u,d,p,m]),[V]=(0,Z.useState)(()=>Uo()),[,H]=(0,Z.useState)({}),ne=sn(e=>{O.current.instance!=null&&(e==null||e!==O.current.instance.getContainerElement())&&(O.current.instance.cleanUp(),V.publish(void 0),O.current=Lo(T)),e!=null&&e!==O.current.instance?.getContainerElement()&&(O.current.instance=new go(te,i?void 0:D,!0),O.current.instance.setup(e)),Fo(r,e)}),re=sn(e=>{O.current.disableFlushSync?V.publish(e):(0,ko.flushSync)(()=>{V.publish(e)})}),U=(0,Z.useMemo)(()=>{if(M||A||j||P||F)return{hasHeaderRenderers:M,hasAnnotationRenderer:A,hasGutterRenderer:j,onSnapshotChange:re}},[re,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(rn(te,r)||(O.current.managedOptions=te,e.setOptions(te),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(U),l=!1;U!==i&&((U==null||i==null)&&(l=!0),O.current.slotCoordinator=U),(a||o)&&e.render(!0),o&&U==null&&V.publish(void 0),l&&H({})}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:ne,className:n,style:w}),(N||P||F)&&(0,$.jsx)(Go,{managedContentStore:V,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=sn(t=>e.subscribe(t)),u=sn(()=>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 gn({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 pn({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=`${qt}
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)(mn,{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=Yt(n),i=n.prevName?Yt({...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 Ge(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 Ge(a);return a.value},t.cacheKey)}var $o=C,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=be(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}=Xn(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{_e(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?rr(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=G(`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);On&&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=G(`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=G(`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=G(`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=G(`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=G(`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=G(`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)(u,{"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=ir(n,s),l=ar(n,s),u=c._tag===`Success`?c.url:c._tag===`Failure`?a:null,d=u===null?null:u+En(i),f;return t[3]!==l||t[4]!==d||t[5]!==i?(f=(0,$.jsx)(dt,{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=G(`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)(mt,{text:e.kind===`markdown`?e.text:`![](<${e.url}>)`,cwd:r,threadRef:u,pullRequestPanelRef:u??K,environmentId:i,extraRemarkPlugins:f,githubMedia:!0},e.id);let t=e.media===`video`?ft(e.url):null;return t===null?e.media===`video`?(0,$.jsx)(dt,{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)(P,{"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)(H,{"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:o,placeholder:s,label:c,saving:l,allowEmpty:u,className:d,onSave:f,onCancel:p}=e,m=o===void 0?null:o,h=u!==void 0&&u,g=Ot(i,a),[_,v]=(0,Z.useState)(n),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(n);x!==n&&(S(n),v(n));let C;t[0]===_?C=t[1]:(C=_.trim(),t[0]=_,t[1]=C);let w=C.length===0,T=!g||l||w&&!h,E;t[2]===d?E=t[3]:(E=G(`space-y-2`,d),t[2]=d,t[3]=E);let D;t[4]!==_||t[5]!==i||t[6]!==p||t[7]!==f||t[8]!==T||t[9]!==l?(D=e=>{if(!(e.nativeEvent.isComposing||e.keyCode===229)){if(e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey){e.preventDefault(),e.stopPropagation(),!T&&!e.repeat&&kt(i,`source-control:write`)&&f(_);return}e.key!==`Escape`||l||(e.preventDefault(),p())}},t[4]=_,t[5]=i,t[6]=p,t[7]=f,t[8]=T,t[9]=l,t[10]=D):D=t[10];let O=y?`preview`:`write`,k;t[11]===O?k=t[12]:(k=[O],t[11]=O,t[12]=k);let A,j,M;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{let t=e[0];(t===`write`||t===`preview`)&&b(t===`preview`)},M=(0,$.jsx)(Pn,{value:`write`,children:`Write`}),A=(0,$.jsx)(Pn,{value:`preview`,children:`Preview`}),t[13]=A,t[14]=j,t[15]=M):(A=t[13],j=t[14],M=t[15]);let N;t[16]!==l||t[17]!==k?(N=(0,$.jsxs)(Nn,{"aria-label":`Markdown editor mode`,variant:`segmented`,value:k,disabled:l,onValueChange:j,children:[M,A]}),t[16]=l,t[17]=k,t[18]=N):N=t[18];let P;t[19]!==r||t[20]!==_||t[21]!==w||t[22]!==i||t[23]!==c||t[24]!==s||t[25]!==y||t[26]!==l||t[27]!==m?(P=y?(0,$.jsx)(`div`,{className:`rounded-lg border border-border/60 px-3 py-2`,children:w?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Nothing to preview.`}):(0,$.jsx)(Ys,{text:_,cwd:r,environmentId:i,threadRef:m})}):(0,$.jsx)(jn,{autoFocus:!0,disabled:l,value:_,rows:6,placeholder:s,"aria-label":c,onChange:e=>v(e.target.value)}),t[19]=r,t[20]=_,t[21]=w,t[22]=i,t[23]=c,t[24]=s,t[25]=y,t[26]=l,t[27]=m,t[28]=P):P=t[28];let F;t[29]!==p||t[30]!==l?(F=(0,$.jsx)(W,{size:`xs`,variant:`ghost`,disabled:l,onClick:p,children:`Cancel`}),t[29]=p,t[30]=l,t[31]=F):F=t[31];let I=!g||l||w&&!h,L;t[32]!==h||t[33]!==_||t[34]!==w||t[35]!==i||t[36]!==f||t[37]!==l?(L=()=>{!kt(i,`source-control:write`)||l||w&&!h||f(_)},t[32]=h,t[33]=_,t[34]=w,t[35]=i,t[36]=f,t[37]=l,t[38]=L):L=t[38];let ee=l?`Saving...`:`Save`,R;t[39]!==I||t[40]!==L||t[41]!==ee?(R=(0,$.jsx)(W,{size:`xs`,variant:`outline`,disabled:I,onClick:L,children:ee}),t[39]=I,t[40]=L,t[41]=ee,t[42]=R):R=t[42];let z;t[43]!==F||t[44]!==R?(z=(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[F,R]}),t[43]=F,t[44]=R,t[45]=z):z=t[45];let B;return t[46]!==N||t[47]!==P||t[48]!==z||t[49]!==E||t[50]!==D?(B=(0,$.jsxs)(`div`,{className:E,onKeyDown:D,children:[N,P,z]}),t[46]=N,t[47]=P,t[48]=z,t[49]=E,t[50]=D,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=jt(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}}),bt.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=G(`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)(Y,{children:[(0,$.jsxs)(q,{render:(0,$.jsx)(`button`,{type:`button`,"aria-pressed":e.viewerHasReacted,"aria-label":`${tc(e.content)}, ${e.count}`,disabled:!r,className:G(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)(J,{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:G(sc,`border-border/70 px-1.5 text-muted-foreground hover:border-primary/60 hover:text-foreground`)}),children:(0,$.jsx)(ze,{"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:G(`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()),Cn(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=G(dc,`border-dashed`),t[0]=i):i=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(fe,{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)(v,{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:d,onLoadMore:f,canEditComment:p,onEditComment:m,onToggleResolved:h,onReacted:g}){let[_,v]=(0,Z.useState)(!e.isResolved),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(``),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(!1),D=(0,Z.useRef)(!1),[O,k]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(!1),M=O?.threadId===e.id?O:null,N=$r(e.comments,M?.comments??[]),P=M===null?e.nextCommentsCursor??null:M.nextCursor,F=e.commentCount??N.length,I=async(t,n)=>{if(T)return;E(!0);let r=await m(t,n);E(!1),r&&(k(r=>r?.threadId===e.id?{...r,comments:Ci(r.comments,t,n)}:r),w(null))},L=async()=>{let t=x.trim();if(!(t.length===0||s||D.current)){D.current=!0;try{await d(t)&&(k(t=>t?.threadId===e.id?{...t,nextCursor:t.nextCursor??e.nextCommentsCursor??null}:t),S(``),b(!1))}finally{D.current=!1}}},ee=async()=>{if(!(P===null||A)){j(!0);try{let t=await f(P);if(t===null)return;k(n=>({threadId:e.id,comments:$r(n?.threadId===e.id?n.comments:[],t.comments),nextCursor:t.nextCursor}))}finally{j(!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)(st,{className:G(`size-3.5`,e.isResolved&&`text-success-foreground`),icon:e.isResolved?ut:ot}),(0,$.jsxs)(`button`,{type:`button`,className:`hover:text-foreground`,"aria-expanded":_,onClick:()=>v(e=>!e),children:[e.isResolved?`Resolved`:`Open`,` · `,F,` `,F===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)(Ue,{className:`size-3`}),c?`Preparing...`:l]}):null,r?(0,$.jsx)(W,{size:`xs`,variant:`ghost`,className:u?void 0:`ml-auto`,disabled:s,onClick:h,children:e.isResolved?`Unresolve`:`Resolve`}):null]}),(0,$.jsx)(xa,{open:_,children:(0,$.jsxs)(ba,{children:[(0,$.jsx)(`div`,{className:`mt-2 space-y-3`,children:N.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)(Er,{actor:e.author}),(0,$.jsx)(`span`,{children:Dn(e.createdAt)}),(0,$.jsx)(uc,{className:`ml-auto justify-end`,reactions:e.reactions??[],canReact:i,subjectId:e.id,environmentId:a,reference:o,onRefresh:g})]}),C===e.id?(0,$.jsx)(Xs,{className:`mt-1`,value:e.body,cwd:t,environmentId:a,label:`Edit comment`,saving:T,onSave:t=>void I(e.id,t),onCancel:()=>w(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}),p(e)?(0,$.jsx)(Es,{"aria-label":`Edit comment`,onClick:()=>w(e.id)}):null]})]},e.id))}),P===null?null:(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsx)(W,{size:`xs`,variant:`ghost`,disabled:A,onClick:()=>void ee(),children:A?`Loading...`:`Load more comments`})}),n?y?(0,$.jsxs)(`div`,{className:`mt-2`,children:[(0,$.jsx)(jn,{autoFocus:!0,size:`sm`,value:x,placeholder:`Reply`,"aria-label":`Reply to this conversation`,onChange:e=>S(e.target.value),onKeyDown:fc({value:x,pending:s,onSubmit:()=>void L(),onCancel:()=>b(!1)})}),(0,$.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,$.jsx)(W,{size:`xs`,variant:`ghost`,onClick:()=>b(!1),children:`Cancel`}),(0,$.jsx)(W,{size:`xs`,disabled:s||x.trim().length===0,onClick:()=>void L(),children:`Reply`})]})]}):(0,$.jsx)(W,{size:`xs`,variant:`ghost`,className:`mt-2`,onClick:()=>b(!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=Ke(),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=At(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 rr(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=G(`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=fr({state:n.state,isDraft:n.isDraft??!1}),a=o.Icon,s=!0,c=G(`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,s=a!==void 0&&a,c;if(t[0]!==i||t[1]!==s||t[2]!==r||t[3]!==n.layers){let e;t[5]!==i||t[6]!==s||t[7]!==r?(e=e=>(0,$.jsxs)(o,{onClick:()=>{i?.({...r,number:e.number})},disabled:!i||s,"aria-current":e.number===r.number?`true`:void 0,children:[(0,$.jsx)(Rc,{layer:e}),e.number===r.number?(0,$.jsx)(D,{"aria-hidden":!0,className:`size-3.5`}):null]},e.number),t[5]=i,t[6]=s,t[7]=r,t[8]=e):e=t[8],c=n.layers.toReversed().map(e),t[0]=i,t[1]=s,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)(M,{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)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{role:`status`,className:`text-xs font-normal`}),children:a?`May be stale`:`Refreshing…`}),(0,$.jsx)(J,{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)(M,{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:s,canRebase:c,mergeMethod:l,onSelect:u,onActed:d,notice:f,onRetry:p}=e,[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(!1),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},t[0]=b):b=t[0];let x=jt(Ur.runAction,b),S,C,w,T,E,D,O,k,A,j,M,N;if(t[1]!==s||t[2]!==c||t[3]!==g||t[4]!==a||t[5]!==n||t[6]!==l||t[7]!==f||t[8]!==d||t[9]!==p||t[10]!==u||t[11]!==m||t[12]!==v||t[13]!==i||t[14]!==x||t[15]!==r){let e=r.layers.at(-1),b=r.layers.filter(Zc),P=b.some(Xc),F;t[28]===i?F=t[29]:(F=e=>e.number===i.number,t[28]=i,t[29]=F);let I=r.layers.findIndex(F)+1,R=r.layers.slice(0,I).filter(Yc),z=r.layers[I-1],B=R.some(Jc),te=b.flatMap(qc).length!==b.length,V=v||z?.state!==`open`||R.some(Kc)||B||R.length===0||R.some(Gc),H=v||te||P||b.length===0;T=async()=>{if(v||!g||(g===`merge`?!s||V:!c||H))return;let t=g,o=t===`merge`?z:e;if(!o?.headSha)return;let u=(t===`merge`?R:b).flatMap(Wc);y(!0),_(null);let f=bt.add({type:`loading`,title:t===`merge`?`Merging stack...`:`Rebasing stack...`}),p=await x({environmentId:a,input:{...i,number:o.number,stackNumber:r.number,expectedStackHeads:u,action:t,...t===`merge`?{mergeMethod:l}:{updateMethod:`rebase`}}});y(!1),d(),p._tag===`Failure`?bt.update(f,{type:`error`,title:t===`merge`?`Could not merge the stack`:`Could not rebase the stack`,description:String(Ge(p))}):bt.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=g===`merge`?R:b,U=`Stack ${r.number}, layer ${I} of ${r.layers.length}`,ie;t[30]===U?ie=t[31]:(ie=(0,$.jsx)(W,{variant:`ghost`,size:`xs`,"aria-label":U}),t[30]=U,t[31]=ie);let ae;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(X.stack,{"aria-hidden":!0,className:`size-3.5`}),t[32]=ae):ae=t[32];let oe;t[33]===p?oe=t[34]:(oe=p?(0,$.jsx)(We,{"aria-hidden":!0,className:`size-3 text-warning`}):null,t[33]=p,t[34]=oe);let se;t[35]!==I||t[36]!==r.layers.length||t[37]!==ie||t[38]!==oe?(se=(0,$.jsx)(q,{render:(0,$.jsxs)(Re,{render:ie,children:[ae,` `,I,`/`,r.layers.length,oe]})}),t[35]=I,t[36]=r.layers.length,t[37]=ie,t[38]=oe,t[39]=se):se=t[39];let ce=f?` · ${f}`:null,le;t[40]!==I||t[41]!==r.layers.length||t[42]!==r.number||t[43]!==ce?(le=(0,$.jsxs)(J,{children:[`View stack #`,r.number,`, layer `,I,` of `,r.layers.length,ce]}),t[40]=I,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)(Y,{children:[se,le]}),t[45]=se,t[46]=le,t[47]=ue):ue=t[47];let de=!!p,fe;t[48]!==f||t[49]!==r.number||t[50]!==de?(fe=(0,$.jsx)(Bc,{number:r.number,notice:f,stale:de}),t[48]=f,t[49]=r.number,t[50]=de,t[51]=fe):fe=t[51];let pe;t[52]===p?pe=t[53]:(pe=p?(0,$.jsx)(o,{onClick:p,children:`Retry stack refresh`}):null,t[52]=p,t[53]=pe);let me;t[54]===u?me=t[55]:(me=u?e=>{h(!1),u(e)}:void 0,t[54]=u,t[55]=me);let he;t[56]!==v||t[57]!==i||t[58]!==r||t[59]!==me?(he=(0,$.jsx)(zc,{stack:r,reference:i,pending:v,onSelect:me}),t[56]=v,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)(ee,{children:[fe,pe,he]}),t[61]=fe,t[62]=pe,t[63]=he,t[64]=ge):ge=t[64];let _e=s||c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ne,{}),s?(0,$.jsxs)(o,{disabled:V,onClick:()=>_(`merge`),children:[(0,$.jsx)(X.merged,{"aria-hidden":!0}),`Merge stack (`,R.length,`)`]}):null,c?(0,$.jsxs)(o,{disabled:H,onClick:()=>_(`update-branch`),children:[(0,$.jsx)(Te,{"aria-hidden":!0}),`Rebase stack`]}):null,B||R.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)(Fe,{align:`start`,children:[ge,_e]}),t[65]=ge,t[66]=_e,t[67]=ve):ve=t[67],t[68]!==m||t[69]!==ue||t[70]!==ve?(M=(0,$.jsxs)(L,{open:m,onOpenChange:h,children:[ue,ve]}),t[68]=m,t[69]=ue,t[70]=ve,t[71]=M):M=t[71],N=s&&z?.state===`open`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsxs)(W,{variant:`default`,size:`xs`,disabled:V,onClick:()=>_(`merge`),children:[(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),`Merge stack`]})})}),(0,$.jsxs)(J,{children:[`Merge stack through #`,i.number,` into `,r.base,` (`,R.length,` `,R.length===1?`pull request`:`pull requests`,`)`]})]}):null,w=Yn,A=g!==null,t[72]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{e||_(null)},t[72]=j):j=t[72],C=Jn,O=`max-w-md`;let ye=g===`merge`?`Merge ${R.length} pull requests?`:`Rebase ${b.length} pull requests?`,be;t[73]===ye?be=t[74]:(be=(0,$.jsx)(Wn,{children:ye}),t[73]=ye,t[74]=be);let xe=g===`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)(qn,{children:xe}),t[75]=xe,t[76]=Se),t[77]!==be||t[78]!==Se?(k=(0,$.jsxs)(Un,{children:[be,Se]}),t[77]=be,t[78]=Se,t[79]=k):k=t[79],S=Kn,E=`max-h-48 space-y-1 overflow-y-auto text-sm`,D=re.map(Hc),t[1]=s,t[2]=c,t[3]=g,t[4]=a,t[5]=n,t[6]=l,t[7]=f,t[8]=d,t[9]=p,t[10]=u,t[11]=m,t[12]=v,t[13]=i,t[14]=x,t[15]=r,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E,t[21]=D,t[22]=O,t[23]=k,t[24]=A,t[25]=j,t[26]=M,t[27]=N}else S=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];let P;t[80]!==E||t[81]!==D?(P=(0,$.jsx)(`ul`,{className:E,children:D}),t[80]=E,t[81]=D,t[82]=P):P=t[82];let F;t[83]!==S||t[84]!==P?(F=(0,$.jsx)(S,{children:P}),t[83]=S,t[84]=P,t[85]=F):F=t[85];let I;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(W,{variant:`outline`,onClick:()=>_(null),children:`Cancel`}),t[86]=I):I=t[86];let R;t[87]===T?R=t[88]:(R=()=>void T(),t[87]=T,t[88]=R);let z=g===`merge`?`Merge stack`:`Rebase stack`,B;t[89]!==R||t[90]!==z?(B=(0,$.jsxs)(Gn,{children:[I,(0,$.jsx)(W,{onClick:R,children:z})]}),t[89]=R,t[90]=z,t[91]=B):B=t[91];let te;t[92]!==C||t[93]!==F||t[94]!==B||t[95]!==O||t[96]!==k?(te=(0,$.jsxs)(C,{className:O,children:[k,F,B]}),t[92]=C,t[93]=F,t[94]=B,t[95]=O,t[96]=k,t[97]=te):te=t[97];let V;t[98]!==w||t[99]!==te||t[100]!==A||t[101]!==j?(V=(0,$.jsx)(w,{open:A,onOpenChange:j,children:te}),t[98]=w,t[99]=te,t[100]=A,t[101]=j,t[102]=V):V=t[102];let H;return t[103]!==V||t[104]!==M||t[105]!==N?(H=(0,$.jsxs)($.Fragment,{children:[M,N,V]}),t[103]=V,t[104]=M,t[105]=N,t[106]=H):H=t[106],H}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=At(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)(q,{onPointerEnter:p,onFocus:m,render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(Sr,{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)(J,{side:`bottom`,children:(0,$.jsx)(tl,{breakdown:f,total:{additions:i,deletions:a}})}):d.isPending?(0,$.jsx)(J,{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)(Y,{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=At(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=mr(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=mr(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=qe();if(Ar(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 s=tt(n),c=Je(r?.environmentId===e?r:null),l=c===null?null:r,u=Tr(e),d=u.isLinked(c,n),f=At(u.mode===`multiple`&&i!==`menu-item`?Ur.linkedThreads({environmentId:e,input:s===null?t:{...t,...et(s)}}):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(!(s===null||h)){g(!0);try{await u.changeLink(N(e,r),n,!i)}catch(e){bt.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`&&R.refresh(Ur.linkedThreads({environmentId:e,input:{...t,...et(s)}})),a?.(!1)}};if(s===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)(Y,{children:[(0,$.jsx)(q,{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)(fe,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{"aria-hidden":!0,children:v.length||`?`})]})}),(0,$.jsxs)(J,{children:[y,`. Search in the command palette.`]})]}):null,i===`menu-item`?(0,$.jsxs)(o,{disabled:h,onClick:()=>{l===null?a?.(!0):_(l.threadId,d)},children:[d?(0,$.jsx)(X.unlink,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(X.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)(Yn,{open:!0,onOpenChange:a,children:(0,$.jsxs)(Jn,{className:`max-w-md`,showCloseButton:!1,children:[(0,$.jsx)(Wn,{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=Ke(),s=Tr(n),c=Ye(),[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)(fe,{"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)(D,{"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)(yr,{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)(V,{"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)(xe,{"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=G(`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)(Pn,{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)(Nn,{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=G(`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}=St(d),m;t[5]===o?m=t[6]:(m=G(`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=G(`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=G(`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)(q,{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)(J,{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)(Y,{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=G(`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:G(`h-4`,ml[t%ml.length])}),(0,$.jsx)(pl,{className:G(`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?fr({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`?jr(p.checksState):null,t[4]=p,t[5]=g);let _=g,v=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 S=x,C=!p&&`motion-safe:animate-skeleton`,w;t[9]===C?w=t[10]:(w=G(`flex h-full min-h-0 flex-col overflow-hidden bg-background`,C),t[9]=C,t[10]=w);let T;t[11]===l?T=t[12]:(T=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)(V,{"aria-hidden":!0,className:`size-3.5`})}):null,t[11]=l,t[12]=T);let E;t[13]!==c||t[14]!==p||t[15]!==h?.toneClassName?(E=p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:p.repository}),(0,$.jsxs)(le,{onClick:()=>void wt()?.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)(H,{"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]=E):E=t[16];let D;t[17]!==T||t[18]!==E?(D=(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:[T,E]})}),t[17]=T,t[18]=E,t[19]=D):D=t[19];let k;t[20]===i?k=t[21]:(k=i??(0,$.jsx)(pl,{className:`h-6 w-16 rounded-md`}),t[20]=i,t[21]=k);let A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Pull request actions loading`,children:(0,$.jsx)(me,{"aria-hidden":!0,className:`size-4`})}),t[22]=A):A=t[22];let j;t[23]===u?j=t[24]:(j=u?(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":`Collapse pull request panel`,onClick:u,children:(0,$.jsx)(y,{"aria-hidden":!0,className:`size-3.5`})}):null,t[23]=u,t[24]=j);let M;t[25]!==k||t[26]!==j?(M=(0,$.jsxs)(`div`,{className:`mr-4 flex h-7 shrink-0 items-center justify-end gap-1`,children:[k,A,j]}),t[25]=k,t[26]=j,t[27]=M):M=t[27];let N,P,I;t[28]===p?(N=t[29],P=t[30],I=t[31]):(N=(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`})}),P=p?(0,$.jsx)(Er,{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 `,Dn(p.updatedAt)]}):(0,$.jsx)(pl,{className:`h-3 w-16`}),t[28]=p,t[29]=N,t[30]=P,t[31]=I);let L;t[32]!==v||t[33]!==d?(L=v?(0,$.jsx)(fl,{value:v,target:`pull request checkout command`,copyLabel:`Copy checkout command`,copiedLabel:`Checkout command copied`,className:`ml-auto font-mono`,tooltipSide:`bottom`,...d?{onError:d}:{}},v):null,t[32]=v,t[33]=d,t[34]=L):L=t[34];let ee,R;t[35]===p?(ee=t[36],R=t[37]):(ee=(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`})}),R=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]=ee,t[37]=R);let z;t[38]===b?z=t[39]:(z=b===null?(0,$.jsx)(pl,{className:`h-3 w-10`}):`${b.toLocaleString()} ${b===1?`file`:`files`}`,t[38]=b,t[39]=z);let B;t[40]===p?B=t[41]:(B=p?(0,$.jsx)(Sr,{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]=B);let te;t[42]!==N||t[43]!==P||t[44]!==I||t[45]!==L||t[46]!==ee||t[47]!==R||t[48]!==z||t[49]!==B?(te=(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:N,author:P,updated:I,checkout:L,base:ee,head:R,files:z,diffStat:B})})}),t[42]=N,t[43]=P,t[44]=I,t[45]=L,t[46]=ee,t[47]=R,t[48]=z,t[49]=B,t[50]=te):te=t[50];let ne;t[51]===_?ne=t[52]:(ne=_?(0,$.jsx)(dl,{className:_.toneClassName,icon:(0,$.jsx)(_.Icon,{"aria-hidden":!0,className:`size-3.5`}),label:_.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]=_,t[52]=ne);let re;t[53]!==S||t[54]!==ne||t[55]!==f?(re=(0,$.jsx)(ul,{tabs:f,value:S,inert:!0,children:ne}),t[53]=S,t[54]=ne,t[55]=f,t[56]=re):re=t[56];let U;t[57]!==M||t[58]!==te||t[59]!==re||t[60]!==D?(U=(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:[D,M,te,re]}),t[57]=M,t[58]=te,t[59]=re,t[60]=D,t[61]=U):U=t[61];let ie;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(F,{"aria-hidden":!0,className:`size-3.5`}),`Reviewers`]}),t[62]=ie):ie=t[62];let ae;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(pl,{className:`h-3 w-10`}),t[63]=ae):ae=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:[ie,(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-foreground`,children:[ae,(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Reviewers loading`,children:(0,$.jsx)(je,{"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)(O,{"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 ue;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Labels loading`,children:(0,$.jsx)(O,{"aria-hidden":!0,className:`size-3.5`})}),t[68]=ue):ue=t[68];let de;t[69]===ce?de=t[70]:(de=(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,ue]})]})]})}),t[69]=ce,t[70]=de);let fe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(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)(he,{"aria-hidden":!0,className:`size-3.5 rotate-90 text-muted-foreground/60`})]})}),t[71]=fe):fe=t[71];let pe;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,$.jsx)(pl,{className:`h-5 w-40`}),t[72]=pe):pe=t[72];let ge;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,$.jsxs)(`section`,{children:[fe,(0,$.jsxs)(`div`,{className:`space-y-3 px-4 pb-4`,children:[pe,(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]=ge):ge=t[73];let _e;t[74]===de?_e=t[75]:(_e=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:[de,ge]}),t[74]=de,t[75]=_e);let ve;return t[76]!==U||t[77]!==_e||t[78]!==w?(ve=(0,$.jsxs)(`div`,{role:`status`,"aria-label":`Loading pull request`,className:w,children:[U,_e]}),t[76]=U,t[77]=_e,t[78]=w,t[79]=ve):ve=t[79],ve}function bl(e){return(0,$.jsx)(kr,{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:G(`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=G(`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)(Zn,{variant:`icon`,children:(0,$.jsx)(X.pullRequest,{})}),t[0]=l):l=t[0];let u;t[1]===s?u=t[2]:(u=(0,$.jsx)($n,{children:s}),t[1]=s,t[2]=u);let d;t[3]===r?d=t[4]:(d=(0,$.jsx)(er,{children:r}),t[3]=r,t[4]=d);let f;t[5]!==u||t[6]!==d?(f=(0,$.jsxs)(Qn,{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)(H,{"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)(tr,{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===Ir?`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=wt();if(!r)return;let i=null;try{i=await r.contextMenu.show(Al(t),n)}catch{return}try{i===`copy-link`?await xt(e,`link`):i===`open-external`&&await r.shell.openExternal(e)}catch{bt.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=jt(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),bt.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)(jn,{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)(X.closed,{className:`size-3.5`}):(0,$.jsx)(X.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)(Se,{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)(fe,{className:`size-3`})},{value:`approve`,label:`Approve`,sent:`Pull request approved`,icon:(0,$.jsx)(D,{className:`size-3`})},{value:`request-changes`,label:`Request changes`,sent:`Changes requested`,icon:(0,$.jsx)(Pe,{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=jt(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`){bt.add({type:`error`,title:`The review could not be submitted`});return}_(m,i.map(Il)),y(m,t),bt.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)(jn,{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)(vt,{value:C?.value??null,disabled:s,onValueChange:e=>{e!==null&&d(e)},children:[(0,$.jsx)(_t,{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)(gt,{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)(ht,{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),y=zi(r),b=Li(Vl),x;t[0]===r?x=t[1]:(x=Ri(r),t[0]=r,t[1]=x);let S=x,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=y.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=y.length>0?`Review pull request, ${y.length} ${y.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)(fe,{className:`size-4`}),t[12]=F):F=t[12];let I;t[13]===y.length?I=t[14]:(I=y.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:y.length}):null,t[13]=y.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 ee=j===`review`?_:g,R;t[18]!==O||t[19]!==j||t[20]!==y.length||t[21]!==A.length?(R=O&&A.length>0?(0,$.jsxs)(Nn,{"aria-label":`Composer mode`,variant:`segmented`,value:[j],onValueChange:e=>{let t=e[0];(t===`comment`||t===`review`)&&h(t)},children:[(0,$.jsx)(Pn,{value:`comment`,children:`Comment`}),(0,$.jsx)(Pn,{value:`review`,children:y.length>0?`Review (${y.length})`:`Review`})]}):(0,$.jsx)(Gr,{children:j===`review`?`Review pull request`:`Comment on pull request`}),t[18]=O,t[19]=j,t[20]=y.length,t[21]=A.length,t[22]=R):R=t[22];let z;t[23]!==b||t[24]!==j||t[25]!==y.length||t[26]!==S||t[27]!==f?(z=j===`review`&&y.length>0?(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":`Discard pending line comments`,title:`Discard pending line comments`,disabled:f,onClick:()=>b(S),children:(0,$.jsx)(v,{className:`size-3.5`})}):null,t[23]=b,t[24]=j,t[25]=y.length,t[26]=S,t[27]=f,t[28]=z):z=t[28];let B;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`}),t[29]=B):B=t[29];let te;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(qr,{render:B,"aria-label":`Close composer`,children:(0,$.jsx)(we,{className:`size-3.5`})}),t[30]=te):te=t[30];let V;t[31]===z?V=t[32]:(V=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[z,te]}),t[31]=z,t[32]=V);let H;t[33]!==R||t[34]!==V?(H=(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[R,V]}),t[33]=R,t[34]=V,t[35]=H):H=t[35];let ne;t[36]!==i.provider||t[37]!==n||t[38]!==j||t[39]!==c||t[40]!==r||t[41]!==f||t[42]!==A?(ne=A.length>0?(0,$.jsx)(`div`,{hidden:j!==`review`,children:(0,$.jsx)(Pl,{environmentId:n,reference:r,verdicts:A,requestChangesSummaryRequired:Fr.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]=ne):ne=t[43];let re;t[44]!==a||t[45]!==O||t[46]!==i||t[47]!==n||t[48]!==j||t[49]!==o||t[50]!==s||t[51]!==r?(re=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]=re):re=t[52];let U;t[53]!==ee||t[54]!==H||t[55]!==ne||t[56]!==re?(U=(0,$.jsxs)(Kr,{keepMounted:!0,side:`top`,align:`end`,sideOffset:8,width:`lg`,initialFocus:ee,"aria-label":`Pull request composer`,children:[H,ne,re]}),t[53]=ee,t[54]=H,t[55]=ne,t[56]=re,t[57]=U):U=t[57];let ie;return t[58]!==u||t[59]!==U||t[60]!==M||t[61]!==L?(ie=(0,$.jsxs)(Yr,{open:u,onOpenChange:M,children:[L,U]}),t[58]=u,t[59]=U,t[60]=M,t[61]=L,t[62]=ie):ie=t[62],ie}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)(q,{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)(J,{side:`bottom`,children:a}),t[3]=a,t[4]=i);let o;return t[5]!==e||t[6]!==i?(o=(0,$.jsxs)(Y,{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)(In,{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)(zn,{"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)(Rn,{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)(Fn,{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)(Ln,{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)(Bn,{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=At(d),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={reportFailure:!1},t[4]=p):p=t[4];let m=jt(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`){bt.add({type:`error`,title:e.isApplied?`Could not take ${e.name} off`:`Could not put ${e.name} on`,description:di(Ge(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)(O,{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)(D,{"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=At(d),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={reportFailure:!1},t[4]=p):p=t[4];let m=jt(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 _=g,v;t[12]!==n||t[13]!==l||t[14]!==r||t[15]!==m?(v=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`){bt.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(Ge(t),`The host refused it. Check that you have write access on this repository, and that they still have access to it.`)});return}bt.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]=v):v=t[16];let y=v,b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(je,{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:`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:x,error:S,candidates:_,emptyLabel:`Nobody else has access to this repository.`,noMatchLabel:`Nobody with access matches that.`,errorLabel:`The people with access could not be read.`,truncated:C,truncatedLabel:`This repository has more people with access than are listed here. Ask for the rest on the host.`,candidateKey:Xl,disabled:w,onSelect:T,children:Yl}),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 Yl(e){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Er,{actor:e,className:`flex-1`}),e.kind===`team`?(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`team`}):null,e.isRequested?(0,$.jsx)(D,{"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(),rr(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=G(`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=G(`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?Fr.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)(Er,{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=Dn(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)(q,{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)(J,{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)(Y,{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)(Y,{children:[(0,$.jsx)(q,{render:o,children:a}),(0,$.jsx)(J,{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=G(`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,[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(null),f;t[0]!==n||t[1]!==s?(f=(0,$.jsx)(tu,{comment:n,detail:s}),t[0]=n,t[1]=s,t[2]=f):f=t[2];let p=l&&`rotate-180`,m;t[3]===p?m=t[4]:(m=G(`size-3.5 transition-transform`,p),t[3]=p,t[4]=m);let h;t[5]===m?h=t[6]:(h=(0,$.jsx)(ve,{"aria-hidden":!0,className:m}),t[5]=m,t[6]=h);let g;t[7]!==i||t[8]!==h?(g=(0,$.jsxs)(va,{ref:d,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,h]}),t[7]=i,t[8]=h,t[9]=g):g=t[9];let _;t[10]!==o||t[11]!==f||t[12]!==g?(_=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[f,g,o]}),t[10]=o,t[11]=f,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==n||t[15]!==c?(v=(0,$.jsx)(nu,{comment:n,thread:c}),t[14]=n,t[15]=c,t[16]=v):v=t[16];let y;t[17]!==a||t[18]!==l?(y=!l&&a?(0,$.jsx)(va,{className:`mt-2 block w-full truncate text-left text-xs text-muted-foreground hover:text-foreground`,onClick:()=>d.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]=l,t[19]=y):y=t[19];let b;t[20]!==_||t[21]!==v||t[22]!==y?(b=(0,$.jsxs)(`div`,{className:`p-3`,children:[_,v,y]}),t[20]=_,t[21]=v,t[22]=y,t[23]=b):b=t[23];let x;t[24]!==a||t[25]!==n||t[26]!==r||t[27]!==l?(x=l?(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]=l,t[28]=x):x=t[28];let S;t[29]===x?S=t[30]:(S=(0,$.jsx)(ba,{children:x}),t[29]=x,t[30]=S);let C;t[31]!==S||t[32]!==b?(C=(0,$.jsxs)(`article`,{className:`group rounded-lg border border-border/60 [contain-intrinsic-block-size:44px] [content-visibility:auto]`,children:[b,S]}),t[31]=S,t[32]=b,t[33]=C):C=t[33];let w;return t[34]!==l||t[35]!==C?(w=(0,$.jsx)(xa,{open:l,onOpenChange:u,children:C}),t[34]=l,t[35]=C,t[36]=w):w=t[36],w}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]:(_=G(`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)(he,{"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 C;return t[20]!==l||t[21]!==b||t[22]!==S||t[23]!==m?(C=(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]=C):C=t[24],C}var cu=10,lu=`p4code:pull-request-comment-filter:v1`,uu=te({bots:g,resolved:g}),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:d,fixCheckLabel:f,onFixFinding:p,onRefresh:m,onRefreshChecks:h}=e,g=c!==void 0&&c,_=d===void 0?`Fix in a thread`:d,v=f===void 0?`Fix`:f,y=h===void 0?m:h,b;t[0]===o.url?b=t[1]:(b={url:o.url,count:cu},t[0]=o.url,t[1]=b);let[x,S]=(0,Z.useState)(b),C=x.url===o.url?x.count:cu,[w,E]=T(lu,du,uu),D=new Map(o.reviewThreads.flatMap(bu)),k=e=>D.get(e.id)?.isResolved===!0||ri(e.reviewState)===`dismissed`,A=yu,j;t[2]!==w.bots||t[3]!==w.resolved||t[4]!==k?(j=e=>(w.bots||!A(e))&&(w.resolved||!k(e)),t[2]=w.bots,t[3]=w.resolved,t[4]=k,t[5]=j):j=t[5];let N=o.comments.filter(j),P=o.comments.length-N.length,R=N.slice(Math.max(0,N.length-C)),z=N.length-R.length,[B,te]=(0,Z.useState)(`newest`),V=Ei(R,B),H;t[6]!==o.url||t[7]!==z||t[8]!==C?(H=z>0?(0,$.jsxs)(W,{size:`sm`,variant:`outline`,className:`w-full`,onClick:()=>S({url:o.url,count:C+cu}),children:[`Show `,Math.min(z,cu),` older comment`,z===1?``:`s`,` (`,z,` hidden)`]}):null,t[6]=o.url,t[7]=z,t[8]=C,t[9]=H):H=t[9];let ne=H,re=pi(o.comments,o.commits),U=new Map(re.flatMap(vu)),ie=[...o.reviewers.map(e=>({key:e.login,actor:e,outcome:U.get(eu(e.login))?.outcome??null,stale:U.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=Cr(i),se;t[10]===ae?se=t[11]:(se=e=>{ae(e).catch(gu)},t[10]=ae,t[11]=se);let ce=se,le;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(le={reportFailure:!1},t[12]=le):le=t[12];let ue=jt(Ur.update,le),de;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(de={reportFailure:!1},t[13]=de):de=t[13];let fe=jt(Ur.updateComment,de),[me,he]=(0,Z.useState)(null),[ge,_e]=(0,Z.useState)(!1),[ve,ye]=(0,Z.useState)(null),[be,xe]=(0,Z.useState)(!1),Se=ve?.pullRequest===o.url?ve.commentId:null,Ce;t[14]!==ge||t[15]!==r||t[16]!==m||t[17]!==a||t[18]!==ue?(Ce=async e=>{if(ge)return;_e(!0);let t=await ue({environmentId:r,input:{...a,body:e}});if(_e(!1),t._tag===`Failure`){bt.add({type:`error`,title:`Could not save the description`});return}he(null),m()},t[14]=ge,t[15]=r,t[16]=m,t[17]=a,t[18]=ue,t[19]=Ce):Ce=t[19];let we=Ce,Te;t[20]===o?Te=t[21]:(Te=e=>ws(o,e),t[20]=o,t[21]=Te);let Ee;t[22]===o.url?Ee=t[23]:(Ee=e=>ye(e===null?null:{pullRequest:o.url,commentId:e.id}),t[22]=o.url,t[23]=Ee);let De;t[24]!==be||t[25]!==r||t[26]!==m||t[27]!==a||t[28]!==fe?(De=async(e,t)=>{if(be||e.kind===`review`)return;xe(!0);let n=await fe({environmentId:r,input:{...a,commentId:e.id,kind:e.kind,body:t}});if(xe(!1),n._tag===`Failure`){bt.add({type:`error`,title:`Could not save the comment`});return}ye(null),m()},t[24]=be,t[25]=r,t[26]=m,t[27]=a,t[28]=fe,t[29]=De):De=t[29];let Oe={cwd:o.workspaceRoot,environmentId:r,threadRef:i,canEdit:Te,editingId:Se,saving:be,onEdit:Ee,onSave:De},ke=e=>{let t=D.get(e.id),n=ii(e.body);if(k(e))return(0,$.jsx)(au,{comment:e,editing:Oe,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:m})},`${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:m,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)(Dr,{outcome:i}):e.reviewState?(0,$.jsx)(`span`,{children:ru(e.reviewState)}):null]}),p&&s?(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,className:`-mt-1 shrink-0`,disabled:u!=null,onClick:()=>p(s),children:[(0,$.jsx)(Ue,{className:`size-3`}),u===ci(s)?`Preparing...`:_]}):null,c]}),(0,$.jsx)(`div`,{className:`px-3`,children:(0,$.jsx)(nu,{comment:e,thread:t})}),n===null&&!Oe.canEdit(e)?null:(0,$.jsx)(iu,{className:`px-3 py-3`,comment:e,editing:Oe})]},`${o.url}:${e.id}`)},Ae;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,$.jsx)(F,{className:`size-3.5`}),t[30]=Ae):Ae=t[30];let je=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)}),Me;t[31]!==o.capabilities.reviewers.listCandidates||t[32]!==o.capabilities.reviewers.request||t[33]!==o.viewerPermissions||t[34]!==r||t[35]!==a?(Me=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]=Me):Me=t[36];let Ne;t[37]!==je||t[38]!==Me?(Ne=(0,$.jsx)(ou,{icon:Ae,label:`Reviewers`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[je,Me]})}),t[37]=je,t[38]=Me,t[39]=Ne):Ne=t[39];let Pe;t[40]!==o.capabilities.labels||t[41]!==o.labels||t[42]!==o.viewerPermissions||t[43]!==r||t[44]!==a?(Pe=o.labels.length>0||o.capabilities.labels===!0?(0,$.jsx)(ou,{icon:(0,$.jsx)(O,{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]=Pe):Pe=t[45];let Ie;t[46]!==Ne||t[47]!==Pe?(Ie=(0,$.jsx)(`section`,{className:`px-4 pt-2.5 pb-1`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Ne,Pe]})}),t[46]=Ne,t[47]=Pe,t[48]=Ie):Ie=t[48];let Le=`description:${o.url}`,ze;t[49]!==ge||t[50]!==me||t[51]!==o||t[52]!==r||t[53]!==we||t[54]!==i?(ze=(0,$.jsx)(`div`,{className:`group`,children:me===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:ge,onSave:e=>void we(e),onCancel:()=>he(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:()=>he(o.url)}):null]})}),t[49]=ge,t[50]=me,t[51]=o,t[52]=r,t[53]=we,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]!==g||t[60]!==o.checks||t[61]!==v||t[62]!==p||t[63]!==y||t[64]!==ce||t[65]!==u?(He=g?(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:y,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&&ce(e.url),className:G(`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)(Or,{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:br(e)})]}),p&&r?(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,className:`shrink-0`,disabled:u!=null,onClick:()=>p(n),children:[(0,$.jsx)(Ue,{className:`size-3`}),u===ci(n)?`Preparing...`:v]}):null]},`${t}:${e.name}:${e.url??``}`)}),t[59]=g,t[60]=o.checks,t[61]=v,t[62]=p,t[63]=y,t[64]=ce,t[65]=u,t[66]=He):He=t[66];let We;t[67]!==Ve||t[68]!==He?(We=(0,$.jsx)(su,{title:`Checks`,defaultOpen:!1,children:He},Ve),t[67]=Ve,t[68]=He,t[69]=We):We=t[69];let Ge=su,Ke=`Comments (${o.commentCount})`,qe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,$.jsx)(W,{size:`xs`,variant:`ghost-muted`}),t[70]=qe):qe=t[70];let Je;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,$.jsx)(oe,{"aria-hidden":!0,className:`size-3`}),t[71]=Je):Je=t[71];let Ye=P>0?`${P} hidden`:`Filter`,Xe;t[72]===Ye?Xe=t[73]:(Xe=(0,$.jsxs)(Re,{render:qe,"aria-label":`Filter comments`,children:[Je,Ye]}),t[72]=Ye,t[73]=Xe);let Ze;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,$.jsx)(M,{children:`Show`}),t[74]=Ze):Ze=t[74];let Qe;t[75]===E?Qe=t[76]:(Qe=e=>E(t=>({...t,bots:e})),t[75]=E,t[76]=Qe);let $e;t[77]!==w.bots||t[78]!==Qe?($e=(0,$.jsx)(I,{checked:w.bots,closeOnClick:!1,onCheckedChange:Qe,children:`Bot comments`}),t[77]=w.bots,t[78]=Qe,t[79]=$e):$e=t[79];let et;t[80]===E?et=t[81]:(et=e=>E(t=>({...t,resolved:e})),t[80]=E,t[81]=et);let tt;t[82]!==w.resolved||t[83]!==et?(tt=(0,$.jsx)(I,{checked:w.resolved,closeOnClick:!1,onCheckedChange:et,children:`Resolved or dismissed`}),t[82]=w.resolved,t[83]=et,t[84]=tt):tt=t[84];let nt;t[85]!==$e||t[86]!==tt?(nt=(0,$.jsx)(Fe,{align:`end`,children:(0,$.jsxs)(ee,{children:[Ze,$e,tt]})}),t[85]=$e,t[86]=tt,t[87]=nt):nt=t[87];let rt;t[88]!==Xe||t[89]!==nt?(rt=(0,$.jsxs)(L,{children:[Xe,nt]}),t[88]=Xe,t[89]=nt,t[90]=rt):rt=t[90];let it=B===`newest`?`Show oldest comments first`:`Show newest comments first`,at,ot;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(at=()=>te(pu),ot=(0,$.jsx)(pe,{"aria-hidden":!0,className:`size-3`}),t[91]=at,t[92]=ot):(at=t[91],ot=t[92]);let st=B===`newest`?`Newest first`:`Oldest first`,ct;t[93]!==it||t[94]!==st?(ct=(0,$.jsxs)(W,{size:`xs`,variant:`ghost-muted`,"aria-label":it,onClick:at,children:[ot,st]}),t[93]=it,t[94]=st,t[95]=ct):ct=t[95];let lt;t[96]!==rt||t[97]!==ct?(lt=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[rt,ct]}),t[96]=rt,t[97]=ct,t[98]=lt):lt=t[98];let ut=s?(0,$.jsx)(Tl,{}):l?(0,$.jsx)(Dl,{compact:!0,error:l,onRetry:m}):(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:[B===`oldest`?ne:null,V.map(ke),B===`newest`?ne:null,C>cu?(0,$.jsxs)(W,{size:`sm`,variant:`ghost`,className:`w-full`,onClick:()=>S({url:o.url,count:cu}),children:[`Show only `,cu,` recent comments`]}):null]})]}),dt;t[99]!==Ge||t[100]!==Ke||t[101]!==lt||t[102]!==ut?(dt=(0,$.jsx)(Ge,{title:Ke,actions:lt,children:ut}),t[99]=Ge,t[100]=Ke,t[101]=lt,t[102]=ut,t[103]=dt):dt=t[103];let ft;return t[104]!==n||t[105]!==Ie||t[106]!==Be||t[107]!==We||t[108]!==dt?(ft=(0,$.jsxs)(`div`,{ref:n,className:`h-full overflow-y-auto`,"data-pull-request-summary-scroll":!0,children:[Ie,Be,We,dt]}),t[104]=n,t[105]=Ie,t[106]=Be,t[107]=We,t[108]=dt,t[109]=ft):ft=t[109],ft}function pu(e){return e===`newest`?`oldest`:`newest`}function mu(e){return(0,$.jsx)(kr,{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)(Y,{children:[(0,$.jsxs)(q,{render:(0,$.jsx)(`span`,{className:G(`relative rounded-full hover:z-10`,e.outcome?_r(e.outcome,e.stale):void 0)}),children:[(0,$.jsx)(Er,{actor:e.actor,tooltip:!1,variant:`avatar`}),e.outcome?(0,$.jsx)(`span`,{className:`sr-only`,children:e.stale?Nr(e.outcome):Pr(e.outcome)}):null]}),(0,$.jsx)(J,{side:`bottom`,children:e.outcome?`${n} — ${e.stale?Nr(e.outcome):Pr(e.outcome)}`:n})]},e.key)}function gu(e){console.error(e),bt.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=G(`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)(gr,{actor:s,className:G(`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)(H,{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=jt(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`){bt.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=Dn(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)(U,{"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)(yr,{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),l;t[0]===n?l=t[1]:(l=Au(n),t[0]=n,t[1]=l);let u=l,d=n[0];if(d===void 0)return null;let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(fe,{className:`size-3.5`}),t[2]=f):f=t[2];let p=!s,m;t[3]!==u||t[4]!==p?(m=(0,$.jsx)(Tu,{actors:u,className:`top-6`,fallback:f,muted:p}),t[3]=u,t[4]=p,t[5]=m):m=t[5];let h=s?`text-foreground opacity-100`:`text-muted-foreground opacity-55`,g;t[6]===h?g=t[7]:(g=G(`flex w-full min-w-0 items-center gap-3 py-2 text-left transition-opacity hover:opacity-100`,h),t[6]=h,t[7]=g);let _;t[8]===n.length?_=t[9]:(_=n.length.toLocaleString(),t[8]=n.length,t[9]=_);let v=n.length===1?`comment`:`comments`,y;t[10]!==_||t[11]!==v?(y=(0,$.jsxs)(`span`,{className:`block text-xs font-semibold`,children:[_,` `,v]}),t[10]=_,t[11]=v,t[12]=y):y=t[12];let b;t[13]===u.length?b=t[14]:(b=u.length.toLocaleString(),t[13]=u.length,t[14]=b);let x=u.length===1?`author`:`authors`,S;t[15]===d.at?S=t[16]:(S=Dn(d.at),t[15]=d.at,t[16]=S);let C;t[17]!==b||t[18]!==x||t[19]!==S?(C=(0,$.jsxs)(`span`,{className:`block truncate text-3xs text-muted-foreground`,children:[b,` `,x,` ·`,` `,S]}),t[17]=b,t[18]=x,t[19]=S,t[20]=C):C=t[20];let w;t[21]!==C||t[22]!==y?(w=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[y,C]}),t[21]=C,t[22]=y,t[23]=w):w=t[23];let T=s&&`rotate-180`,E;t[24]===T?E=t[25]:(E=G(`size-3.5 shrink-0 text-muted-foreground transition-transform`,T),t[24]=T,t[25]=E);let D;t[26]===E?D=t[27]:(D=(0,$.jsx)(ve,{"aria-hidden":!0,className:E}),t[26]=E,t[27]=D);let O;t[28]!==w||t[29]!==D||t[30]!==g?(O=(0,$.jsxs)(va,{className:g,children:[w,D]}),t[28]=w,t[29]=D,t[30]=g,t[31]=O):O=t[31];let k;t[32]!==i||t[33]!==r||t[34]!==n||t[35]!==a||t[36]!==s||t[37]!==o?(k=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]=k):k=t[38];let A;t[39]===k?A=t[40]:(A=(0,$.jsx)(ba,{children:k}),t[39]=k,t[40]=A);let j;t[41]!==O||t[42]!==A?(j=(0,$.jsxs)(`div`,{children:[O,A]}),t[41]=O,t[42]=A,t[43]=j):j=t[43];let M;t[44]!==s||t[45]!==j?(M=(0,$.jsx)(xa,{open:s,onOpenChange:c,children:j}),t[44]=s,t[45]=j,t[46]=M):M=t[46];let N;return t[47]!==M||t[48]!==m?(N=(0,$.jsxs)(`div`,{className:`relative mb-5 pl-12 [contain-intrinsic-block-size:48px] [content-visibility:auto]`,children:[m,M]}),t[47]=M,t[48]=m,t[49]=N):N=t[49],N}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)(ye,{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 u;t[8]===n.id?u=t[9]:(u=n.id.slice(0,7),t[8]=n.id,t[9]=u);let d;t[10]===u?d=t[11]:(d=(0,$.jsx)(`code`,{className:`font-mono`,children:u}),t[10]=u,t[11]=d);let f;t[12]===n.at?f=t[13]:(f=Dn(n.at),t[12]=n.at,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,$.jsx)(`span`,{children:f}),t[14]=f,t[15]=p);let m;t[16]!==p||t[17]!==d?(m=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-3xs text-muted-foreground`,children:[d,p]}),t[16]=p,t[17]=d,t[18]=m):m=t[18];let h;t[19]!==m||t[20]!==l?(h=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,m]}),t[19]=m,t[20]=l,t[21]=h):h=t[21];let g;t[22]!==n.additions||t[23]!==n.deletions?(g=n.additions!==null&&n.deletions!==null?(0,$.jsx)(Sr,{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]=g):g=t[24];let _;t[25]!==h||t[26]!==g?(_=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5 py-1.5`,children:[h,g]}),t[25]=h,t[26]=g,t[27]=_):_=t[27];let v;return t[28]!==i||t[29]!==_||t[30]!==a||t[31]!==s?(v=(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,_]}),t[28]=i,t[29]=_,t[30]=a,t[31]=s,t[32]=v):v=t[32],v}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)(X.pullRequest,{className:`size-3.5`}),label:`Pull request opened`}:n.kind===`merged`?{icon:(0,$.jsx)(X.merged,{className:`size-3.5`}),label:`Pull request merged`}:{icon:(0,$.jsx)(X.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=Dn(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)(wr,{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=G(`font-medium lowercase`,i?`text-muted-foreground opacity-70`:pr(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=Pr(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)(q,{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=Nr(r),t[22]=r,t[23]=v);let y;t[24]===v?y=t[25]:(y=(0,$.jsx)(J,{children:v}),t[24]=v,t[25]=y);let b;t[26]!==_||t[27]!==y||t[28]!==f?(b=(0,$.jsxs)(Y,{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=Dn(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)(U,{"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)(yr,{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)(X.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){wt()?.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=At(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=Cr(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=Hn,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)(Or,{status:e.status}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})}),(0,$.jsx)(J,{side:`top`,children:e.description??e.name})]}),(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:br(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),bt.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=jr(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:Mr(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:G(`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=G(`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=G(`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)(b,{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=G(`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=G(`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)(D,{"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=G(`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:c,onOpenFile:l}=e,[u,d]=(0,Z.useState)(null),{resolvedTheme:f}=Tt(),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=zt(ed(n.path,Bt(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 h=p,g=h?.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]!==c||t[12]!==g?(e=async e=>{let t=await c(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]=c,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]!==h?.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);h?.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]=h?.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=m(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=s({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=Ht(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]!==h?(N=h===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)(vn,{fileDiff:h.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)(Tn,{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 `,h.shown,` of`,` `,h.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)(se,{"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]=h,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=Bt(e);return n===t?null:n}function gd(e){let t=(0,Q.c)(11),{file:n,loadDiffFiles:r}=e,{resolvedTheme:i}=Tt(),a;t[0]===n?a=t[1]:(a=hn(n),t[0]=n,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=Ht(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)(vn,{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:l,loadDiffFiles:u,diffLoading:d,commenting:f,onStep:p,onAsk:m,onFinish:h,onOpenFile:g}=e,_;t[0]===n?_=t[1]:(_=nd(n),t[0]=n,t[1]=_);let{lettered:v,byExcerpt:y}=_,b;t[2]===n.excerpts?b=t[3]:(b=new Set(n.excerpts.map(yd)),t[2]=n.excerpts,t[3]=b);let x=b,S,C,T,E,D,O,k,A,j;if(t[4]!==y||t[5]!==f||t[6]!==d||t[7]!==x||t[8]!==l||t[9]!==r||t[10]!==v||t[11]!==u||t[12]!==g||t[13]!==o||t[14]!==p||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]===x?e=t[33]:(e=e=>!x.has(e.path),t[32]=x,t[33]=e);let c=n.files.filter(e);S=v.length>0;let m=S&&`@min-[90rem]/guide:grid-cols-[minmax(0,1fr)_20rem]`;t[34]===m?C=t[35]:(C=G(`grid gap-8`,m),t[34]=m,t[35]=C),T=`flex min-w-0 flex-col gap-5`;let h=r+1,_;t[36]!==i||t[37]!==h?(_=(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground tabular-nums @max-[56rem]/guide:hidden`,children:[`Stop `,h,` of `,i]}),t[36]=i,t[37]=h,t[38]=_):_=t[38];let b;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(W,{size:`xs`,variant:`ghost-muted`,className:`@min-[56rem]/guide:hidden`}),t[39]=b):b=t[39];let M=r+1,N;t[40]!==i||t[41]!==M?(N=(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[`Stop `,M,` of `,i]}),t[40]=i,t[41]=M,t[42]=N):N=t[42];let P=a&&`rotate-180`,F;t[43]===P?F=t[44]:(F=G(P),t[43]=P,t[44]=F);let I;t[45]===F?I=t[46]:(I=(0,$.jsx)(ve,{"aria-hidden":!0,className:F}),t[45]=F,t[46]=I);let L;t[47]!==N||t[48]!==I?(L=(0,$.jsxs)(va,{render:b,children:[N,I]}),t[47]=N,t[48]=I,t[49]=L):L=t[49];let ee=r===0,R;t[50]===p?R=t[51]:(R=()=>p(-1),t[50]=p,t[51]=R);let z;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(w,{"aria-hidden":!0}),t[52]=z):z=t[52];let B;t[53]!==ee||t[54]!==R?(B=(0,$.jsx)(W,{size:`icon-xs`,variant:`outline`,"aria-label":`Previous stop`,disabled:ee,onClick:R,children:z}),t[53]=ee,t[54]=R,t[55]=B):B=t[55];let te=r===i-1,V;t[56]===p?V=t[57]:(V=()=>p(1),t[56]=p,t[57]=V);let H;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(ve,{"aria-hidden":!0}),t[58]=H):H=t[58];let ne;t[59]!==te||t[60]!==V?(ne=(0,$.jsx)(W,{size:`icon-xs`,variant:`outline`,"aria-label":`Next stop`,disabled:te,onClick:V,children:H}),t[59]=te,t[60]=V,t[61]=ne):ne=t[61];let re;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(re=(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]=re):re=t[62];let U;t[63]!==B||t[64]!==ne?(U=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[B,ne,re]}),t[63]=B,t[64]=ne,t[65]=U):U=t[65];let ie;t[66]!==_||t[67]!==L||t[68]!==U?(ie=(0,$.jsxs)(`header`,{className:`flex items-center justify-between gap-2`,children:[_,L,U]}),t[66]=_,t[67]=L,t[68]=U,t[69]=ie):ie=t[69];let ae;t[70]===s?ae=t[71]:(ae=(0,$.jsx)(ba,{className:`@min-[56rem]/guide:hidden`,children:(0,$.jsx)(`div`,{className:`pt-3`,children:s})}),t[70]=s,t[71]=ae),t[72]!==o||t[73]!==a||t[74]!==ie||t[75]!==ae?(E=(0,$.jsxs)(xa,{open:a,onOpenChange:o,children:[ie,ae]}),t[72]=o,t[73]=a,t[74]=ie,t[75]=ae,t[76]=E):E=t[76];let oe;t[77]===n.title?oe=t[78]:(oe=(0,$.jsx)(`h2`,{className:`text-lg font-semibold text-foreground`,children:n.title}),t[77]=n.title,t[78]=oe);let se;t[79]===n.summary?se=t[80]:(se=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]=se),t[81]!==oe||t[82]!==se?(D=(0,$.jsxs)(`div`,{className:`flex max-w-[60rem] flex-col gap-2`,children:[oe,se]}),t[81]=oe,t[82]=se,t[83]=D):D=t[83],t[84]===n.attention?O=t[85]:(O=n.attention===null?null:(0,$.jsxs)(ca,{controlAlignment:`first-line`,children:[(0,$.jsx)(Oe,{}),(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]=O),t[86]!==y||t[87]!==f||t[88]!==d||t[89]!==l||t[90]!==u||t[91]!==g||t[92]!==n.excerpts?(k=n.excerpts.length>0?(0,$.jsx)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:(0,$.jsx)(mn,{children:n.excerpts.map((e,t)=>(0,$.jsx)(ud,{excerpt:e,file:l.get(e.path)??null,loading:d,notes:y[t]??[],commenting:f,loadDiffFiles:u,onOpenFile:g},`${e.path}:${e.side}:${e.start}-${e.end}`))})}):null,t[86]=y,t[87]=f,t[88]=d,t[89]=l,t[90]=u,t[91]=g,t[92]=n.excerpts,t[93]=k):k=t[93],t[94]===v?A=t[95]:(A=(0,$.jsx)(sd,{notes:v,className:`@min-[90rem]/guide:hidden`}),t[94]=v,t[95]=A),j=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)(mn,{children:(0,$.jsx)(`ul`,{className:`flex flex-col overflow-hidden rounded-lg border border-border/60`,children:c.map(e=>{let t=l.get(e.path),n=t===void 0?null:Kt([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)(he,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground group-data-panel-open:rotate-90`}),(0,$.jsx)(Le,{"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)(Sr,{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:d?`Loading the diff...`:`This file is not in the loaded diff.`}):(0,$.jsx)(gd,{file:t,loadDiffFiles:u})})]})},e.path)})})})]}):null,t[4]=y,t[5]=f,t[6]=d,t[7]=x,t[8]=l,t[9]=r,t[10]=v,t[11]=u,t[12]=g,t[13]=o,t[14]=p,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]=S,t[24]=C,t[25]=T,t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A,t[31]=j}else S=t[23],C=t[24],T=t[25],E=t[26],D=t[27],O=t[28],k=t[29],A=t[30],j=t[31];let M;t[96]!==m||t[97]!==n.questions?(M=n.questions.length>0||m!==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=>m===null?(0,$.jsx)(`div`,{className:`text-sm text-foreground`,children:(0,$.jsx)(Ku,{text:e})},e):(0,$.jsxs)(`button`,{type:`button`,onClick:()=>m(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)(Ae,{"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)),m===null?null:(0,$.jsxs)(W,{size:`sm`,variant:`ghost-muted`,onClick:()=>m(``),children:[(0,$.jsx)(Ae,{"aria-hidden":!0}),`Ask about this stop`]})]})]}):null,t[96]=m,t[97]=n.questions,t[98]=M):M=t[98];let N;t[99]!==c||t[100]!==h||t[101]!==p?(N=c===null?h===null?null:(0,$.jsxs)(W,{onClick:h,children:[(0,$.jsx)(fe,{"aria-hidden":!0}),`Finish review`]}):(0,$.jsxs)(W,{className:`min-w-0`,onClick:()=>p(1),children:[(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Next: `,c]}),(0,$.jsx)(De,{"aria-hidden":!0})]}),t[99]=c,t[100]=h,t[101]=p,t[102]=N):N=t[102];let P;t[103]===N?P=t[104]:(P=(0,$.jsx)(`footer`,{className:`flex flex-wrap items-center justify-end gap-3 border-t border-border/60 pt-4`,children:N}),t[103]=N,t[104]=P);let F;t[105]!==M||t[106]!==P||t[107]!==T||t[108]!==E||t[109]!==D||t[110]!==O||t[111]!==k||t[112]!==A||t[113]!==j?(F=(0,$.jsxs)(`article`,{className:T,children:[E,D,O,k,A,j,M,P]}),t[105]=M,t[106]=P,t[107]=T,t[108]=E,t[109]=D,t[110]=O,t[111]=k,t[112]=A,t[113]=j,t[114]=F):F=t[114];let I;t[115]!==S||t[116]!==v?(I=S?(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:v})}):null,t[115]=S,t[116]=v,t[117]=I):I=t[117];let L;return t[118]!==C||t[119]!==F||t[120]!==I?(L=(0,$.jsxs)(`div`,{className:C,children:[F,I]}),t[118]=C,t[119]=F,t[120]=I,t[121]=L):L=t[121],L}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=At,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=zt(g.patch,`pull-request-guide:${s}:${_??`first`}`),r=new Map(t.files);if(n?.kind===`files`)for(let e of n.files)r.set(Yt(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=jt(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 ee;t[32]!==j||t[33]!==i.stops||t[34]!==y||t[35]!==p.seen?(ee=(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]=ee):ee=t[36];let R;t[37]===w.error?R=t[38]:(R=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]=R);let z;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?(z=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]=z):z=t[55];let B;t[56]!==a||t[57]!==R||t[58]!==z?(B=(0,$.jsxs)(`main`,{className:`flex min-w-0 flex-col gap-4`,children:[a,R,z]}),t[56]=a,t[57]=R,t[58]=z,t[59]=B):B=t[59];let te;return t[60]!==ee||t[61]!==B?(te=(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:[ee,B]})}),t[60]=ee,t[61]=B,t[62]=te):te=t[62],te}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=At(a),s;t[3]===n?s=t[4]:(s=Ur.generateReviewGuide.permissionAtom(n),t[3]=n,t[4]=s);let c=Ie(s),l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[5]=l):l=t[5];let u=jt(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)),bt.add({type:`error`,title:`Could not start a review guide`,description:di(Ge(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:f}=e,p;t[0]!==n||t[1]!==r||t[2]!==i?(p={environmentId:n,reference:r,title:i},t[0]=n,t[1]=r,t[2]=i,t[3]=p):p=t[3];let{query:m,data:h,running:g,canWrite:_,write:v}=Cd(p),y;t[4]!==n||t[5]!==r?(y=ta(n,r),t[4]=n,t[5]=r,t[6]=y):y=t[6];let b=y,x;t[7]===r?x=t[8]:(x=Ri(r),t[7]=r,t[8]=x);let S=x,C=zi(r),w=Li(Ed),T=Li(Td),E;t[9]!==w||t[10]!==s||t[11]!==c||t[12]!==C||t[13]!==T||t[14]!==S?(E=!s&&c===null?null:{canComment:s,pending:C,onComment:e=>{let{path:t,oldPath:n,position:r,body:i}=e;return w(S,{id:Bi(),path:t,...n===null?{}:{oldPath:n},position:r,body:i})},onRemove:e=>T(S,e),onAskAgent:c},t[9]=w,t[10]=s,t[11]=c,t[12]=C,t[13]=T,t[14]=S,t[15]=E):E=t[15];let D=E,O,k;t[16]!==o||t[17]!==b?(O=()=>{if(o)return $i.getState().setShown(b),()=>{$i.getState().shownKey===b&&$i.getState().setShown(null)}},k=[o,b],t[16]=o,t[17]=b,t[18]=O,t[19]=k):(O=t[18],k=t[19]),(0,Z.useEffect)(O,k);let A=h?.guide??null,j=o&&A!==null,M;t[20]===f?M=t[21]:(M=()=>f?.(),t[20]=f,t[21]=M);let N=(0,Z.useEffectEvent)(M),P;t[22]!==N||t[23]!==j?(P=()=>{j&&N()},t[22]=N,t[23]=j,t[24]=P):P=t[24];let F;t[25]===j?F=t[26]:(F=[j],t[25]=j,t[26]=F),(0,Z.useEffect)(P,F);let I=h?.run??null,L=h?.currentHeadSha??null,ee=A!==null&&L!==null&&L!==A.headSha,R=I?._tag===`Failed`&&I.headSha===L?I.detail:null,z;t[27]!==_||t[28]!==g||t[29]!==v?(z=(e,t)=>_?(0,$.jsxs)(W,{size:t,variant:`outline`,disabled:g,onClick:()=>void v(),children:[g?(0,$.jsx)(yt,{}):(0,$.jsx)(He,{"aria-hidden":!0,className:`size-3.5`}),g?`Reading the change...`:e]}):null,t[27]=_,t[28]=g,t[29]=v,t[30]=z):z=t[30];let B=z;if(A===null){if(m.isPending&&h===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)(yt,{})}),t[31]=e):e=t[31],e}let e=g?`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=R??m.error??(g?`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=R===null?`Write guide`:`Try again`,o;t[36]!==a||t[37]!==B?(o=B(a,`sm`),t[36]=a,t[37]=B,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 te;t[43]!==_||t[44]!==R||t[45]!==g||t[46]!==ee||t[47]!==B?(te=ee||R!==null||g?(0,$.jsxs)(ca,{variant:g?`info`:`warning`,children:[g?(0,$.jsx)(yt,{}):(0,$.jsx)(We,{}),(0,$.jsx)(sa,{children:g?`Rewriting this guide. You will be told when the new one is ready.`:R??`Written before the latest push.`}),!g&&_?(0,$.jsx)(oa,{children:B(`Rewrite`,`xs`)}):null]}):null,t[43]=_,t[44]=R,t[45]=g,t[46]=ee,t[47]=B,t[48]=te):te=t[48];let V=te,H;t[49]!==n||t[50]!==a?(H={environmentId:n,cwd:a},t[49]=n,t[50]=a,t[51]=H):H=t[51];let ne;t[52]!==A||t[53]!==l?(ne=l===null?null:(e,t)=>{let n=A.stops[e];n!==void 0&&l(n,e,t)},t[52]=A,t[53]=l,t[54]=ne):ne=t[54];let re;t[55]!==o||t[56]!==V||t[57]!==D||t[58]!==n||t[59]!==A||t[60]!==u||t[61]!==d||t[62]!==r||t[63]!==ne?(re=(0,$.jsx)(Sd,{environmentId:n,reference:r,guide:A,banner:V,active:o,commenting:D,onAsk:ne,onFinish:u,onOpenFile:d}),t[55]=o,t[56]=V,t[57]=D,t[58]=n,t[59]=A,t[60]=u,t[61]=d,t[62]=r,t[63]=ne,t[64]=re):re=t[64];let U;return t[65]!==H||t[66]!==re?(U=(0,$.jsx)(Gu,{value:H,children:re}),t[65]=H,t[66]=re,t[67]=U):U=t[67],U}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-Bm67cV34.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:ie(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)(ne,{}),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)(Ne,{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)(Ee,{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(Fr.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=G(`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 f;t[4]!==u||t[5]!==d?(f=(0,$.jsx)(`button`,{type:`button`,"aria-label":u,className:d}),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]===o?p=t[8]:(p=G(`size-3.5 shrink-0`,o),t[7]=o,t[8]=p);let m;t[9]===p?m=t[10]:(m=(0,$.jsx)(We,{"aria-hidden":!0,className:p}),t[9]=p,t[10]=m);let h;t[11]!==c||t[12]!==f||t[13]!==m?(h=(0,$.jsxs)(Jr,{openOnHover:!0,delay:0,closeDelay:120,render:f,children:[c,m]}),t[11]=c,t[12]=f,t[13]=m,t[14]=h):h=t[14];let g;t[15]===u?g=t[16]:(g=(0,$.jsx)(`p`,{className:`text-xs text-foreground`,children:u}),t[15]=u,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Changes can be cleanly merged.`}),t[17]=_):_=t[17];let v;t[18]!==r.methods||t[19]!==a||t[20]!==i?(v=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)(X.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]=v):v=t[21];let y;t[22]!==g||t[23]!==v?(y=(0,$.jsxs)(Kr,{align:`start`,side:`bottom`,className:`max-w-80`,padding:`compact`,children:[g,_,v]}),t[22]=g,t[23]=v,t[24]=y):y=t[24];let b;return t[25]!==y||t[26]!==h?(b=(0,$.jsxs)(Yr,{children:[h,y]}),t[25]=y,t[26]=h,t[27]=b):b=t[27],b}function zd({environmentId:e,shortcutsEnabled:t,getShortcutContext:n,threadRef:r=null,reference:i,listEntry:s=null,refreshToken:c=0,onActed:u,onClose:m,context:g=`page`,composerDraftTarget:_,onBack:x,onSelectPullRequest:C,onGuideShown:w}){let T=qe(),E=Ye(),O=E.find(t=>t.id===i.projectId&&t.environmentId===e),k=O?.repositoryIdentity,M=T.get(e)?.environment.capabilities.threadPullRequests===!0,P=(0,Z.useMemo)(()=>M?mi(i,k):{projectId:i.projectId,repository:i.repository,number:i.number},[i,k,M]),F=`${P.projectId}:${P.host??``}:${P.repository}#${P.number}`,I=s?.projectId===P.projectId&&s.repository.toLowerCase()===P.repository.toLowerCase()&&(P.host===void 0||s.host.toLowerCase()===P.host.toLowerCase())&&s.number===P.number?s:null,[ee,R]=(0,Z.useState)(!1),[B,te]=(0,Z.useState)(0),[U,ie]=(0,Z.useState)(`summary`),[ae,oe]=(0,Z.useState)(`newest`),[ce,le]=(0,Z.useState)(()=>({pullRequestKey:F,oid:null})),de=ce.pullRequestKey===F?ce.oid:null,me=e=>{le({pullRequestKey:F,oid:e})},he=e=>{me(e),ie(`code`)},[ge,_e]=(0,Z.useState)(null),be=e=>{me(null),_e(t=>({path:e,nonce:(t?.nonce??0)+1})),Md(),ie(`code`)},Se=$i(t=>t.openRequestKey===ta(e,P));Se&&U!==`guide`&&ie(`guide`),(0,Z.useEffect)(()=>{Se&&$i.getState().requestOpen(null)},[Se]);let Ce=`${e}:${F}`,[we,Te]=(0,Z.useState)(()=>({key:Ce,tabs:new Set([`summary`])})),De=we.key===Ce?we.tabs:new Set([U]);(0,Z.useEffect)(()=>{Te(e=>e.key===Ce?e.tabs.has(U)?e:{key:Ce,tabs:new Set(e.tabs).add(U)}:{key:Ce,tabs:new Set([U])})},[U,Ce]);let[Oe,je]=(0,Z.useState)(!1),Pe=(0,Z.useRef)({});(0,Z.useEffect)(()=>{je(Pe.current[U]??!1)},[U]);let Le=Oe,ze=(0,Z.useRef)({}),Be=(0,Z.useMemo)(()=>({summary:e=>{ze.current.summary=e},timeline:e=>{ze.current.timeline=e},code:e=>{ze.current.code=e}}),[]),We=(0,Z.useRef)(null),Ke=(0,Z.useRef)(null),Je=(0,Z.useRef)(null);(0,Z.useLayoutEffect)(()=>{let e=Je.current;e!==null&&(Je.current=null,Le&&e.tab===U&&ze.current[U]===e.scroller&&(e.scroller.scrollTop=Math.max(0,e.scroller.scrollTop+e.delta)))},[Le,U]);let Ze=Yi(e=>e.pullRequestMergeMethod),$e=Yi(e=>e.setPullRequestMergeMethod),et=Ea(e,P.projectId),nt=(0,Z.useMemo)(()=>et(),[et]),[rt,it]=(0,Z.useState)(null),at=e=>{it({pullRequestKey:F,method:e})},ot=Dd(F),[st,ct]=(0,Z.useState)(null),lt=Ot(e,a),ut=At(Ur.detail({environmentId:e,input:P})),dt=At(Ur.activity({environmentId:e,input:P})),ft=zr(e),[pt,mt]=(0,Z.useState)(()=>oi(typeof window>`u`?void 0:window.localStorage,e,P));(0,Z.useEffect)(()=>{mt(oi(typeof window>`u`?void 0:window.localStorage,e,P))},[e,F,P.projectId,P.repository,P.number]),(0,Z.useEffect)(()=>{ut.data!==null&&(gi(typeof window>`u`?void 0:window.localStorage,e,P,ut.data),mt(ut.data))},[ut.data,e,F,P.projectId,P.repository,P.number]);let ht=Zr({live:ut.data,cached:pt,reference:P}),gt=(0,Z.useMemo)(()=>I===null?null:Br(I),[I]),_t=(0,Z.useMemo)(()=>ut.data===null?null:{...ut.data,checksState:hr(ut.data.checks)},[ut.data]),vt=Wr(e,P,_t,ut.dataUpdatedAt),yt=(0,Z.useMemo)(()=>Hr(ht,Hr(vt,gt)),[ht,vt,gt]),xt=(0,Z.useMemo)(()=>ht===null||yt===null||yt===ht?ht:{...ht,title:yt.title,state:yt.state,headBranch:yt.headBranch,baseBranch:yt.baseBranch,updatedAt:yt.updatedAt,author:yt.author??ht.author,additions:yt.additions??ht.additions,deletions:yt.deletions??ht.deletions,changedFiles:yt.changedFiles??ht.changedFiles,mergeability:yt.mergeability??ht.mergeability,closedAt:yt.closedAt===void 0?ht.closedAt:yt.closedAt,mergedAt:yt.mergedAt===void 0?ht.mergedAt:yt.mergedAt,isDraft:yt.isDraft??ht.isDraft},[ht,yt]),Tt=dt.data,K=(0,Z.useMemo)(()=>xt===null?null:{...xt,capabilities:lt?xt.capabilities:{...xt.capabilities,reactions:!1,edit:{changeRequest:!1,comment:!1}},viewerPermissions:lt?xt.viewerPermissions:{...xt.viewerPermissions,actions:[],comment:!1,resolve:!1,verdicts:[],requestReviewers:!1,updateMethods:[],labels:!1},author:Tt?.author??xt.author,reviewers:Tt?.reviewers??xt.reviewers,comments:Tt?.comments??[],commentCount:Tt?.commentCount??0,commentsTruncated:Tt?.commentsTruncated??!1,reviewThreads:Tt?.reviewThreads??[],commits:Tt?.commits??[],reactions:Tt?.reactions??[]},[Tt,lt,xt]),Pt=K??yt,Ft=Ie(Dt),{copyToClipboard:It}=St({target:`pull request reference`,onCopy:e=>bt.add({type:`success`,title:`${e} copied`}),onError:(e,t)=>bt.add({type:`error`,title:`Failed to copy ${t}`,description:e.message})}),Lt=(0,Z.useEffectEvent)(e=>{!t||e.defaultPrevented||Ca()||sr(e,Ft,{context:n()})===`pullRequest.copyNumber`&&(e.preventDefault(),e.stopPropagation(),e.repeat||It(`#${P.number}`,`PR number`))});(0,Z.useEffect)(()=>{let e=e=>Lt(e);return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]),(0,Z.useEffect)(()=>{K?.autoMergeMethod!==void 0&&at(K.autoMergeMethod)},[K?.autoMergeMethod,F]);let Rt=K===null?null:Qe(K.url),zt=Fr.get(K?.provider),Bt=(0,Z.useMemo)(()=>({repositoryUrl:Rt===null?null:zt.referenceAutolinkRepositoryUrl(Rt),threadRef:r}),[zt,Rt,r]),Vt=K?.author&&Rt!==null?zt.authorProfileUrl(K.author.login,Rt):null,Ht=Pt?si(Pt.provider,Pt.number,Pt.headBranch,K?.headRepositoryNameWithOwner,Qe(Pt.url)):ei(P,k),Ut=(0,Z.useCallback)(e=>{bt.add({type:`error`,title:`Could not copy checkout command`,description:e.message})},[]),Wt=At(K===null?null:Nt.listRefs({environmentId:e,input:{cwd:K.workspaceRoot,includeMatchingRemoteRefs:!0,limit:2}})),Gt=K!==null&&Pi(K.baseBranch,Wt.data?.refs??[]),Kt=Cc(e,(0,Z.useMemo)(()=>K===null||K.capabilities.stacks!==!0||!M?null:{...P,host:P.host??tt(K.url)?.host},[K,P,M])),qt=Kt.data,Jt=M&&K?.capabilities.stacks===!0&&K.capabilities.stackActions===!0&&T.get(e)?.environment.capabilities.pullRequestStackActions===!0,Yt=Ai({supportsStackActions:Jt,hasStack:qt!==null,stackPending:!Kt.isFresh,stackError:Kt.error}),Xt=dt.isPending&&Tt===null,Zt=Tt===null?dt.error:null,Qt=(0,Z.useCallback)(()=>{ut.refresh(),dt.refresh(),Kt.refresh()},[dt.refresh,ut.refresh,Kt.refresh]),[$t,en]=(0,Z.useState)(0),tn=$t+(ft??0),nn=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!xt)return;let e={key:Ce,updatedAt:xt.updatedAt};if(ti(nn.current,e)){if(dt.isPending)return;dt.refresh(),en(e=>e+1)}nn.current=e},[dt.isPending,dt.refresh,xt,Ce]),Lc(()=>{ut.refresh()},{key:`pull-request:${e}:${F}`});let rn=jt(Ur.invalidate,{reportFailure:!1}),[an,on]=(0,Z.useState)(!1),sn=an||ut.isPending,cn=(0,Z.useCallback)(async()=>{on(!0);try{await rn({environmentId:e,input:{reference:P}}),Qt(),en(e=>e+1)}finally{on(!1)}},[e,rn,P,Qt]),ln=(0,Z.useRef)(c);(0,Z.useEffect)(()=>{ln.current!==c&&(ln.current=c,cn())},[c,cn]);let un=jt(Ur.runAction,{reportFailure:!1}),dn=jt(Ur.comment,{reportFailure:!1}),[fn,pn]=(0,Z.useState)(null),mn=fn!==null,hn=jt(Ur.update,{reportFailure:!1}),[gn,_n]=(0,Z.useState)(null),vn=gn?.pullRequestKey===F?gn.text:null,[yn,bn]=(0,Z.useState)(!1),xn=Qi(),{environments:Sn}=Ct(),Cn=(0,Z.useMemo)(()=>{let t=E.find(t=>t.id===P.projectId&&t.environmentId===e)?.repositoryIdentity;return Xe(t,P.repository,P.number)},[e,E,P.number,P.projectId,P.repository]),wn=(0,Z.useMemo)(()=>g===`page`?bc({environmentId:e,projectId:P.projectId},E,Sn.map(e=>({environmentId:e.environmentId,label:e.label,machine:p(e.serverConfig)}))):[],[g,e,Sn,E,P.projectId]),[Tn,En]=(0,Z.useState)(null),On=Tn?.pullRequestKey===F?Tn.environmentId:e,An=wn.find(e=>e.environmentId===On)??null,jn=An?.environmentId??e,Mn=An?.workspaceRoot??K?.workspaceRoot??O?.workspaceRoot??null,Nn=Ot(jn,S),Pn=Da({environmentId:jn,cwd:Mn}),Fn=async(t,n,r)=>{u?.(t,`sent`);let i=await un({environmentId:e,input:{...P,action:t,...n?{mergeMethod:n}:{},...r?{updateMethod:r}:{}}});if(pn(null),i._tag===`Failure`){let e=Ge(i),n=r===`rebase`?Ad:kd[t];return bt.add({type:`error`,title:Od[t],description:di(e,n)}),u?.(t,`failed`),!1}return t===`revert`&&bt.add({type:`success`,title:`Revert pull request opened`}),t===`delete-branch`&&bt.add({type:`success`,title:`Branch deleted`}),Ti(t)?cn():Qt(),u?.(t,`done`),!0},In=async(e,t,n)=>!lt||fn!==null?!1:(pn(e),Fn(e,t,n)),Ln=async(t,n)=>!lt||fn!==null?{commentPosted:!1}:(pn(n),(await dn({environmentId:e,input:{...P,body:t}}))._tag===`Failure`?(pn(null),bt.add({type:`error`,title:`Could not post the comment`}),{commentPosted:!1}):(await Fn(n)||Qt(),{commentPosted:!0})),Rn=async t=>{let n=t.trim();if(!lt||K===null||yn)return;if(n.length===0||n===K.title){_n(null);return}bn(!0);let r=await hn({environmentId:e,input:{...P,title:n}});if(bn(!1),r._tag===`Failure`){bt.add({type:`error`,title:`The title could not be saved`,description:di(Ge(r),`The host refused the new title.`)});return}_n(null),Qt()},zn=_??null,Bn=Pn.isAllowed&&Nn,Hn=zn!==null||Bn,Un=ui(zn!==null),Wn=Cd({environmentId:e,reference:P,title:K?.title??null}),Gn=()=>{Wn.write(),Wn.data?.guide??ie(`guide`)},Kn=(e,t)=>{let n=d.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})},qn=async(e,t,n)=>{let r=n??await xn(e).then(e=>e,()=>null);return r===null?null:(t===null||Kn(r.draftId,t),r)},Jn=async(t,n,r)=>{if(!K||st!==null)return;if(zn!==null){Kn(zn,n),bt.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}ct(t);let i=z(jn,An?.projectId??K.projectId),a=await qn(i,n);if(ct(null),a!==null&&r?.keepGuide===!0){let t=d.getState().getDraftSession(a.draftId);t!==null&&(Mt.getState().openPullRequest(N(t.environmentId,t.threadId),{environmentId:e,projectId:P.projectId,...P.host===void 0?{}:{host:P.host},repository:P.repository,number:P.number,url:K.url}),$i.getState().requestOpen(ta(e,P)))}if(a===null){bt.add({type:`error`,title:`Could not open a thread`,description:`Try again from the project, or open a thread first.`});return}bt.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.`})},Yn=async(e,t,n=`worktree`)=>{if(!Pt||st!==null)return;if(zn!==null&&t!==null){Kn(zn,t),bt.add({type:`success`,title:`Added to the composer`,description:`The task is in the composer — read it over, then send.`});return}if(Mn===null||!Pn.isAllowed||!kt(jn,`source-control:write`)||n===`worktree`&&!kt(jn,`orchestration:operate`))return;ct(e);let r=bt.add({type:`loading`,title:`Preparing the pull request checkout...`}),i=z(jn,An?.projectId??Pt.projectId),a=await xn(i).then(e=>e,()=>null);if(a===null){ct(null),bt.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 Pn.run({reference:Pt.url,mode:n,threadId:a.threadId});if(o._tag===`Failure`){ct(null);let e=Pn.error instanceof Error?Pn.error.message:null;bt.update(r,{type:`error`,title:`Could not prepare the pull request checkout`,...e?{description:e}:{}});return}if(!await xn(i,{branch:o.value.branch,worktreePath:o.value.worktreePath,envMode:o.value.worktreePath===null?`local`:`worktree`}).then(e=>e!==null,()=>!1)){ct(null),bt.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}ct(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){bt.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 qn(i,t,a),bt.update(r,o.value.isOnPullRequestHead?{type:`success`,title:`Checkout ready`,description:`The task is in the composer — read it over, then send.`}:s)},Xn=()=>{K&&Jn(`ask`,{...Oi({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,state:K.state,isDraft:K.isDraft})})},Zn=()=>{K&&Jn(`explain`,{...ji({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,state:K.state,isDraft:K.isDraft})})},Qn=(e,t,n)=>{K&&Jn(`guide-stop:${t}`,vi({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,state:K.state,isDraft:K.isDraft,stop:{index:t,title:e.title,summary:e.summary,attention:e.attention?.note??null,excerpts:e.excerpts},question:n}),{keepGuide:!0})},$n=(e,t)=>{K&&Jn(`selection:${e.comment.id}`,wi({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,state:K.state,isDraft:K.isDraft,comment:e.comment,request:e.request}),t)},er=e=>{Pt&&Yn(`checkout:${e}`,null,e)},tr=e=>{K&&Yn(ci(e),bi({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,finding:e}))},nr=()=>{K&&Yn(`findings`,Di({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,reviewThreads:K.reviewThreads,comments:K.comments,checks:kr?[]:K.checks,commentsTruncated:K.commentsTruncated}))},rr=()=>{Pt&&Yn(`conflicts`,{prompt:Si({number:Pt.number,url:Pt.url,headBranch:Pt.headBranch,baseBranch:Pt.baseBranch})})},ir=K?K.capabilities.mergeMethods.filter(e=>K.mergeCapabilities[e]):[],ar=rt?.pullRequestKey===F?rt.method:null,or=hi(ir,ar,nt,Ze),lr=Mi[or],ur=`Auto-merge (${lr.toLowerCase()})`,dr=K?.state===`open`&&K.mergeability===`conflicting`,mr=K?.state===`open`&&K.autoMergeEnabled===!0,gr=K?.autoMergeMethod,_r=gr?`Auto-merge (${Mi[gr].toLowerCase()})`:`Auto-merge`,vr=K?.state===`open`?K.workflowApprovalsRequired??0:0,br=K===null?null:Ii(K),xr=Et(e,e=>e.reviewGuidesEnabled),Sr=jd.filter(e=>(e.value!==`code`||K===null||K.capabilities.diff)&&(e.value!==`guide`||xr));(0,Z.useEffect)(()=>{Sr.some(e=>e.value===U)||ie(`summary`)},[U,Sr]);let Cr=e=>K?.capabilities.actions.includes(e)===!0&&K.viewerPermissions.actions.includes(e),Tr=K?hr(K.checks):null,Dr=yt?.checksState===void 0?Tr:yt.checksState,Or=Dr!==`failing`&&K?.checks.some(e=>e.status===`action-required`)?`pending`:Dr,kr=Or!==Tr,Ar=K?ni({state:K.state,isDraft:K.isDraft,mergeability:K.mergeability,checksState:Or,autoMergeEnabled:K.autoMergeEnabled,hasMergeMethod:ir.length>0,canMerge:Yt&&Cr(`merge`),canMarkReady:Cr(`ready`),canEnableAutoMerge:Yt&&Cr(`enable-auto-merge`)}):null,Nr=K?.state===`open`&&Cr(K.isDraft?`ready`:`draft`)&&!(K.isDraft&&Ar===`ready`),Pr=Yt&&K?.state===`open`&&(mr&&Cr(`disable-auto-merge`)||!mr&&Ar!==`enable-auto-merge`&&!K.isDraft&&!dr&&Cr(`enable-auto-merge`)&&ir.length>0),Ir=Yt&&K?.state===`open`&&(Ar===`enable-auto-merge`||Ar===`auto-merge-armed`)&&Cr(`merge`)&&!K.isDraft&&!dr&&ir.length>0,Lr=K?.state===`open`&&Cr(`merge`)&&!K.isDraft&&!dr&&ir.length>1,Rr=K?fr({state:K.state,isDraft:K.isDraft}):null,Vr=K!==null&&ki(K),Gr=Sn.some(t=>t.environmentId===e&&t.connection.phase===`connected`),Kr=async()=>{K!==null&&await wt()?.dialogs.confirm([`Delete branch ${K.headBranch}?`,`This deletes ${K.headBranch} from ${K.headRepositoryNameWithOwner??K.repository}. Local branches and worktrees are not changed.`].join(`
215
- `),{variant:`destructive`})&&In(`delete-branch`)},qr=vr>0&&!kr&&Cr(`approve-workflows`),Jr=kr?Or===null?`No checks reported`:jr(Or).label:K?Mr(K.checks):null,Yr=K&&!K.commentsTruncated?pi(K.comments,K.commits).filter(e=>e.outcome===`approved`&&!e.stale).length:0,Qr=g===`page`?(0,$.jsxs)(L,{children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(Re,{disabled:st!==null||Mn===null,render:(0,$.jsxs)(W,{size:`xs`,variant:`outline`,"aria-label":st?.startsWith(`checkout`)?`Checking out...`:`Check out`,children:[(0,$.jsx)(f,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[35rem]/pr-header:hidden`,children:st?.startsWith(`checkout`)?`Checking out...`:`Check out`}),(0,$.jsx)(ve,{"aria-hidden":!0,className:`size-3.5 text-muted-foreground`})]})})}),(0,$.jsx)(J,{children:`Check out this pull request`})]}),(0,$.jsxs)(Fe,{align:`end`,side:`bottom`,children:[(0,$.jsxs)(o,{disabled:!Bn,onClick:()=>er(`worktree`),children:[(0,$.jsx)(f,{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)(o,{disabled:!Pn.isAllowed,onClick:()=>er(`local`),children:[(0,$.jsx)(re,{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`."})]})]}),wn.length>0?(0,$.jsx)(Id,{environments:wn,value:jn,onChange:e=>En({pullRequestKey:F,environmentId:e}),disabled:st!==null}):null]})]}):null,$r=(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(W,{size:`xs`,variant:`destructive-outline`,disabled:st!==null||zn===null&&Mn===null,onClick:rr,"aria-label":st===`conflicts`?`Preparing...`:`Resolve conflicts`,children:[(0,$.jsx)(X.conflicting,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:st===`conflicts`?`Preparing...`:`Resolve conflicts`})]})})}),(0,$.jsx)(J,{side:`top`,children:st===`conflicts`?`Preparing...`:`Resolve conflicts`})]});return ut.isPending&&!K?(0,$.jsx)(yl,{seed:I,summary:yt,checkoutCommand:Ht,onCheckoutError:Ut,number:P.number,tabs:Sr,activeTab:U,...x?{onBack:x}:{},...m?{onClose:m}:{},actions:Pt?(0,$.jsxs)(kn,{delay:150,closeDelay:150,timeout:400,children:[Pt.state===`open`&&Pt.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:[ee&&K?(0,$.jsx)(rl,{display:`picker`,environmentId:e,reference:P,url:K.url,threadRef:null,onPickerOpenChange:R},`${e}:${K.url}`):null,(0,$.jsxs)(`div`,{className:G(`@container/pr-header grid min-w-0 shrink-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2`,K&&`border-b border-border/60`,!K&&!m&&`hidden`),children:[(0,$.jsxs)(`div`,{className:`pl-4 grid h-7 min-w-0 items-center overflow-hidden`,children:[(0,$.jsx)(`div`,{"aria-hidden":Le,inert:Le,className:G(`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`,Le?`pointer-events-none -translate-y-1 opacity-0 duration-100`:`translate-y-0 opacity-100 delay-50 duration-150`),children:K&&Rr?(0,$.jsxs)($.Fragment,{children:[x?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(W,{size:`icon-micro`,variant:`ghost-muted`,onClick:x,className:`-ml-1.5`,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(V,{"aria-hidden":!0,className:`size-3.5`})})}),(0,$.jsx)(J,{side:`top`,children:`Back to pull requests`})]}):null,(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:Rt?(0,$.jsx)(`button`,{type:`button`,onClick:()=>void wt()?.shell.openExternal(Rt),className:`min-w-0 cursor-pointer truncate text-left font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:K.repository}):(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium text-muted-foreground`,children:K.repository})}),(0,$.jsx)(J,{side:`top`,children:Rt?`Open ${K.repository} repository`:K.repository})]}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void wt()?.shell.openExternal(K.url),onContextMenu:e=>Ld(e,K),className:G(`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 #${K.number} on host`,children:[`#`,K.number,(0,$.jsx)(H,{"aria-hidden":!0,className:`size-2.5`})]})}),(0,$.jsx)(J,{side:`top`,children:kl(zt)})]})]}):null}),(0,$.jsx)(`div`,{"aria-hidden":!Le,inert:!Le,className:G(`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`,Le?`translate-y-0 opacity-100 delay-50 duration-150`:`pointer-events-none translate-y-1 opacity-0 duration-100`),children:K&&Rr?(0,$.jsxs)($.Fragment,{children:[x?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(W,{size:`icon-micro`,variant:`ghost-muted`,tabIndex:Le?0:-1,onClick:x,className:`-ml-1.5`,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(V,{"aria-hidden":!0,className:`size-3.5`})})}),(0,$.jsx)(J,{side:`top`,children:`Back to pull requests`})]}):null,(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(`button`,{type:`button`,tabIndex:Le?0:-1,onClick:()=>void wt()?.shell.openExternal(K.url),onContextMenu:e=>Ld(e,K),className:G(`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 #${K.number} on host`,children:[`#`,K.number,(0,$.jsx)(H,{"aria-hidden":!0,className:`size-2.5`})]})}),(0,$.jsx)(J,{side:`top`,children:kl(zt)})]}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:K.title})}),(0,$.jsx)(J,{side:`top`,children:K.title})]})]}):null})]}),(0,$.jsxs)(`div`,{className:`mr-4 flex h-7 shrink-0 items-center justify-end gap-1`,children:[K?(0,$.jsxs)(kn,{delay:150,closeDelay:150,timeout:400,children:[!qt&&Jt&&Kt.error?(0,$.jsx)(W,{variant:`ghost`,size:`xs`,onClick:Kt.refresh,children:`Retry stack lookup`}):null,qt?(0,$.jsx)(Vc,{hostLabel:zt.label,stack:qt,notice:Kt.notice,onRetry:Kt.error?Kt.refresh:void 0,reference:P,environmentId:e,onSelect:C,mergeMethod:or,canMerge:Kt.isFresh&&Jt&&Cr(`merge`)&&ir.length>0,canRebase:Kt.isFresh&&Jt&&K.viewerPermissions.stackRebase===!0,onActed:()=>{Qt(),u?.()}}):null,g===`page`?(0,$.jsx)(rl,{display:`count`,environmentId:e,reference:P,url:K.url,threadRef:null}):null,mr&&Ar!==`auto-merge-armed`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(b,{size:`control`,variant:`info`,role:`img`,"aria-label":_r,children:[(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:_r})]})}),(0,$.jsxs)(J,{side:`top`,children:[_r,`: the host will merge this on its own once its requirements are met`]})]}):null,Ar===`resolve`?$r:Ar===`ready`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(W,{size:`xs`,variant:`default`,disabled:mn,onClick:()=>void In(`ready`),"aria-label":`Ready for review`,children:[(0,$.jsx)(X.pullRequest,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:`Ready for review`})]})})}),(0,$.jsx)(J,{side:`top`,children:`Ready for review`})]}):Ar===`enable-auto-merge`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(W,{size:`xs`,variant:`default`,disabled:mn,...ot.props(`enable-auto-merge`,()=>void In(`enable-auto-merge`,or)),"aria-label":fn===`enable-auto-merge`?`Enabling...`:ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:ur,children:[ot.isArmed(`enable-auto-merge`)?(0,$.jsx)(D,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(X.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:ur}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:fn===`enable-auto-merge`?`Enabling...`:ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:ur})]})})]})})}),(0,$.jsx)(J,{side:`top`,children:fn===`enable-auto-merge`?`Enabling...`:ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:ur})]}):Ar===`auto-merge-armed`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(b,{size:`control`,variant:`info`,role:`img`,"aria-label":_r,children:[(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:_r})]})}),(0,$.jsxs)(J,{side:`top`,children:[_r,`: the host will merge this on its own once its requirements are met`]})]}):Ar===`merge`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,$.jsxs)(W,{size:`xs`,variant:`default`,disabled:mn,...ot.props(`merge`,()=>void In(`merge`,or)),"aria-label":fn===`merge`?`Merging...`:ot.isArmed(`merge`)?`Confirm merge?`:lr,children:[ot.isArmed(`merge`)?(0,$.jsx)(D,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(X.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:fn===`merge`?`Merging...`:ot.isArmed(`merge`)?`Confirm merge?`:lr})]})})]})})}),(0,$.jsx)(J,{side:`top`,children:fn===`merge`?`Merging...`:ot.isArmed(`merge`)?`Confirm merge?`:lr})]}):(Ar===`merged`||Ar===`closed`)&&Rr!==null?(0,$.jsx)(b,{size:`control`,variant:`outline`,children:(0,$.jsxs)(`span`,{className:G(`flex items-center gap-1`,Rr.toneClassName),children:[(0,$.jsx)(Rr.Icon,{className:`size-3.5`}),Rr.label]})}):null,Qr,(0,$.jsxs)(L,{children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(Re,{render:(0,$.jsx)(W,{"aria-label":sn?`Refreshing pull request`:`More pull request actions`,size:`icon-xs`,variant:`ghost-muted`}),children:sn?(0,$.jsx)(_a,{refreshing:!0,size:`md`}):(0,$.jsx)(Ve,{className:`size-4`})})}),(0,$.jsx)(J,{children:sn?`Refreshing pull request`:`More pull request actions`})]}),(0,$.jsxs)(Fe,{align:`end`,side:`bottom`,children:[(0,$.jsx)(rl,{display:`menu-item`,environmentId:e,reference:P,url:K.url,threadRef:r??(typeof _==`object`?_:null),onPickerOpenChange:R}),(0,$.jsxs)(o,{disabled:sn,onClick:()=>void cn(),children:[(0,$.jsx)(_a,{size:`sm`,refreshing:sn}),`Refresh`]}),(0,$.jsxs)(o,{disabled:st!==null,onClick:Xn,children:[(0,$.jsx)(Ae,{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:st===`ask`?`Opening...`:`Ask a question`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:zn===null?`Opens a thread that knows which pull request you mean.`:`Adds the pull request to this thread's composer.`})]})]}),(0,$.jsxs)(o,{disabled:st!==null,onClick:Zn,children:[(0,$.jsx)(ue,{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:st===`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)(o,{disabled:st!==null||!Hn,onClick:nr,children:[(0,$.jsx)(Ue,{className:`size-3.5`}),st===`findings`?`Preparing...`:Un.fixFindings]}),xr&&Wn.canWrite?(0,$.jsxs)(o,{disabled:Wn.running,onClick:Gn,children:[(0,$.jsx)(He,{className:`size-3.5`}),Wn.running?`Writing guide...`:Wn.data?.guide==null?`Write guide`:`Rewrite guide`]}):null,wn.length>0?(0,$.jsx)(Id,{environments:wn,value:jn,onChange:e=>En({pullRequestKey:F,environmentId:e}),disabled:st!==null}):null,(0,$.jsx)(ne,{}),K.state===`open`?(0,$.jsxs)($.Fragment,{children:[Nr?(0,$.jsxs)(o,{disabled:mn,onClick:()=>void In(K.isDraft?`ready`:`draft`),children:[K.isDraft?(0,$.jsx)(X.pullRequest,{className:`size-3.5`}):(0,$.jsx)(X.draft,{className:`size-3.5`}),K.isDraft?`Ready for review`:`Convert to draft`]}):null,Ir?(0,$.jsxs)(o,{closeOnClick:ot.isArmed(`merge`),"aria-label":ot.isArmed(`merge`)?`Confirm merge?`:`Merge now`,disabled:mn,...ot.props(`merge`,()=>void In(`merge`,or)),children:[(0,$.jsx)(X.merged,{className:`size-3.5`}),ot.isArmed(`merge`)?`Confirm merge?`:`Merge now`]}):null,mr&&Cr(`disable-auto-merge`)?(0,$.jsxs)(o,{disabled:mn,onClick:()=>void In(`disable-auto-merge`),children:[(0,$.jsx)(X.merged,{className:`size-3.5`}),`Disable auto-merge`]}):Pr?(0,$.jsxs)(o,{closeOnClick:ot.isArmed(`enable-auto-merge`),"aria-label":ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:`Enable auto-merge`,disabled:mn,...ot.props(`enable-auto-merge`,()=>void In(`enable-auto-merge`,or)),children:[(0,$.jsx)(X.merged,{className:`size-3.5`}),ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:`Enable auto-merge`]}):null,Lr?(0,$.jsxs)($.Fragment,{children:[Nr||Ir||Pr?(0,$.jsx)(ne,{}):null,(0,$.jsx)(Ee,{value:or,onValueChange:e=>{let t=e;at(t),$e(t)},children:ir.map(e=>(0,$.jsx)(Ne,{value:e,disabled:mn,closeOnClick:!0,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(X.merged,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:Mi[e]})]})},e))})]}):null,Xr(Nr,Pr||Ir,Lr)?(0,$.jsx)(ne,{}):null]}):null,(0,$.jsxs)(o,{onClick:()=>void wt()?.shell.openExternal(K.url),children:[(0,$.jsx)(se,{className:`size-3.5`}),kl(zt)]}),(0,$.jsxs)(o,{onClick:()=>It(K.url,`PR link`),children:[(0,$.jsx)(j,{className:`size-3.5`}),`Copy link`,(0,$.jsx)(ke,{children:cr(Ft,`thread.copyReference`)})]}),(0,$.jsxs)(o,{onClick:()=>It(`#${P.number}`,`PR number`),children:[(0,$.jsx)(A,{className:`size-3.5`}),`Copy PR number`,(0,$.jsx)(ke,{children:cr(Ft,`pullRequest.copyNumber`)})]}),K.state===`open`&&Cr(`close`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ne,{}),(0,$.jsxs)(o,{closeOnClick:ot.isArmed(`close`),"aria-label":ot.isArmed(`close`)?`Confirm close?`:`Close pull request`,variant:`destructive`,disabled:mn,...ot.props(`close`,()=>void In(`close`)),children:[(0,$.jsx)(X.closed,{className:`size-3.5`}),ot.isArmed(`close`)?`Confirm close?`:`Close pull request`]})]}):K.state===`closed`&&Cr(`reopen`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ne,{}),(0,$.jsxs)(o,{disabled:mn,onClick:()=>void In(`reopen`),children:[(0,$.jsx)(X.reopen,{className:`size-3.5`}),`Reopen pull request`]})]}):K.state===`merged`&&Cr(`revert`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ne,{}),(0,$.jsxs)(o,{closeOnClick:ot.isArmed(`revert`),"aria-label":ot.isArmed(`revert`)?`Confirm revert?`:`Revert changes`,variant:ot.isArmed(`revert`)?`destructive`:`default`,disabled:mn,...ot.props(`revert`,()=>void In(`revert`)),children:[(0,$.jsx)(Me,{className:`size-3.5`}),ot.isArmed(`revert`)?`Confirm revert?`:`Revert changes`]})]}):null,Vr?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ne,{}),(0,$.jsxs)(o,{variant:`destructive`,disabled:mn||!Gr,onClick:()=>void Kr(),children:[(0,$.jsx)(v,{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:fn===`delete-branch`?`Deleting branch...`:`Delete branch`}),(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:Gr?K.headBranch:`Reconnect to delete this branch`})]})]})]}):null]})]})]}):null,m?(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":`Collapse pull request panel`,onClick:m,children:(0,$.jsx)(y,{className:`size-3.5`})}):null]}),(0,$.jsx)(`div`,{className:G(`col-span-2 grid`,Le?`grid-rows-[1fr]`:`grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`),children:(0,$.jsx)(`div`,{ref:Ke,className:G(`min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none`,Le?`translate-y-0 opacity-100 delay-50`:`translate-y-1 opacity-0 duration-100`),inert:!Le,children:K?(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)(Er,{actor:K.author,profileUrl:Vt,variant:`avatar`,className:`shrink-0`}),(0,$.jsx)(`span`,{className:`shrink-0`,children:Dn(K.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:[br?(0,$.jsxs)(Rd,{baseBranch:K.baseBranch,freshness:br,pending:mn,onUpdate:e=>void In(`update-branch`,void 0,e),iconClassName:`size-3`,className:`max-w-[40%]`,children:[Gt?(0,$.jsx)(X.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:K.baseBranch,showTitle:!1})})]}):(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1`,children:[Gt?(0,$.jsx)(X.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:K.baseBranch,showTitle:!1})})]})}),(0,$.jsx)(J,{side:`top`,children:Gt?`Stacked on ${K.baseBranch}`:K.baseBranch})]}),(0,$.jsx)(V,{"aria-label":`receives changes from`,className:`size-3 shrink-0 opacity-60`}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`code`,{className:`flex min-w-0 flex-1`,children:(0,$.jsx)(ma,{value:K.headBranch,showTitle:!1})})}),(0,$.jsx)(J,{side:`top`,children:K.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":`${K.changedFiles.toLocaleString()} changed ${K.changedFiles===1?`file`:`files`}`,children:[(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-3`}),K.changedFiles.toLocaleString()]}),(0,$.jsx)($c,{environmentId:e,reference:P,additions:K.additions,deletions:K.deletions,className:`shrink-0 font-mono text-2xs`,eager:!0})]})]})}):null})}),(0,$.jsx)(`div`,{className:G(`col-span-2 grid`,Le?`grid-rows-[0fr]`:`grid-rows-[1fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`),children:(0,$.jsx)(`div`,{ref:We,className:G(`min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none`,Le?`-translate-y-1 opacity-0 duration-100`:`translate-y-0 opacity-100 delay-50`),inert:Le,children:K?(0,$.jsx)(cl,{title:vn===null?(0,$.jsxs)(ll,{className:`group gap-1`,children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-base font-semibold leading-snug`,children:K.title})}),(0,$.jsx)(J,{side:`top`,children:K.title})]}),Cs(K)?(0,$.jsx)(Es,{"aria-label":`Edit title`,onClick:()=>_n({pullRequestKey:F,text:K.title})}):null]}):(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(Vn,{autoFocus:!0,size:`sm`,disabled:yn,value:vn,"aria-label":`Pull request title`,onChange:e=>_n({pullRequestKey:F,text:e.target.value}),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),Rn(vn)):e.key===`Escape`&&(e.preventDefault(),_n(null))}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(W,{size:`xs`,variant:`ghost`,disabled:yn,onClick:()=>_n(null),children:`Cancel`}),(0,$.jsx)(W,{size:`xs`,variant:`outline`,disabled:!lt||yn||vn.trim().length===0,onClick:()=>void Rn(vn),children:yn?`Saving...`:`Save`})]})]}),author:(0,$.jsx)(Er,{actor:K.author,profileUrl:Vt}),updated:(0,$.jsxs)(`span`,{children:[`updated `,Dn(K.updatedAt)]}),checkout:Ht?(0,$.jsx)(fl,{value:Ht,target:`pull request checkout command`,copyLabel:`Copy checkout command`,copiedLabel:`Checkout command copied`,className:`ml-auto font-mono`,tooltipSide:`bottom`,onError:Ut},Ht):null,base:br?(0,$.jsxs)(Rd,{baseBranch:K.baseBranch,freshness:br,pending:mn,onUpdate:e=>void In(`update-branch`,void 0,e),className:`max-w-[40%]`,children:[Gt?(0,$.jsx)(X.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:K.baseBranch,showTitle:!1})})]}):(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-[40%] shrink-0 items-center gap-1`,children:[Gt?(0,$.jsx)(X.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:K.baseBranch,showTitle:!1})})]})}),(0,$.jsx)(J,{side:`top`,children:Gt?`Stacked on ${K.baseBranch}`:K.baseBranch})]}),head:(0,$.jsx)(fl,{value:K.headBranch,target:`branch name`,copyLabel:`Copy pull request branch`,copiedLabel:`Branch name copied`},K.headBranch),files:`${K.changedFiles.toLocaleString()} ${K.changedFiles===1?`file`:`files`}`,diffStat:(0,$.jsx)($c,{environmentId:e,reference:P,additions:K.additions,deletions:K.deletions,className:`shrink-0 font-mono text-xs`,eager:!0})}):null})}),K?(0,$.jsx)(ul,{tabs:Sr,value:U,onValueChange:ie,onTabIntent:e=>{e===`code`&&Md()},children:U===`summary`?qr?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`ml-auto inline-flex shrink-0`,children:(0,$.jsxs)(W,{size:`xs`,variant:`warning-outline`,disabled:mn,...ot.props(`approve-workflows`,()=>void In(`approve-workflows`)),"aria-label":fn===`approve-workflows`?`Approving...`:ot.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`,children:[(0,$.jsx)(h,{"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:fn===`approve-workflows`?`Approving...`:ot.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`})]})]})})}),(0,$.jsx)(J,{side:`top`,children:fn===`approve-workflows`?`Approving...`:ot.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`})]}):(0,$.jsx)(dl,{className:`text-muted-foreground`,"aria-label":Jr?`Checks: ${Jr}`:`Checks`,icon:Or===null?(0,$.jsx)(l,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Vu,{checks:K.checks,stale:kr,checksState:Or,threadRef:r}),label:Jr}):U===`timeline`?(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(yr,{className:G(`whitespace-nowrap text-2xs transition-opacity`,(Xt||Zt)&&`opacity-35`),children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"aria-label":Zt?`Comments unavailable`:`${K.commentCount.toLocaleString()} ${K.commentCount===1?`comment`:`comments`}`,children:[(0,$.jsx)(fe,{"aria-hidden":!0,className:`size-3`}),Zt?`—`:Xt?`…`:K.commentCount.toLocaleString()]}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"aria-label":Zt?`Commits unavailable`:`${K.commits.length.toLocaleString()} ${K.commits.length===1?`commit`:`commits`}`,children:[(0,$.jsx)(ye,{"aria-hidden":!0,className:`size-3`}),Zt?`—`:Xt?`…`:K.commits.length.toLocaleString()]}),Yr>0?(0,$.jsxs)(`span`,{className:G(`inline-flex items-center gap-1`,pr(`approved`)),children:[(0,$.jsx)(wr,{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":ae===`newest`?`Show oldest activity first`:`Show newest activity first`,onClick:()=>oe(e=>e===`newest`?`oldest`:`newest`),children:[(0,$.jsx)(pe,{"aria-hidden":!0,className:`size-3`}),ae===`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=ze.current[U];if(e.target!==t||t==null)return;let n=t.scrollTop;je(e=>{let r=e,i=We.current?.scrollHeight??0,a=i-(Ke.current?.scrollHeight??0);return e?n<4&&i>0&&(r=!1):i>0&&n>i+32&&(Je.current={tab:U,scroller:t,delta:-a},r=!0),Pe.current[U]=r,r})},children:ut.error&&!K?(0,$.jsx)(Ol,{...fi(ut.failure)?{title:`Pull request #${P.number} not found`,error:`It may be an issue rather than a pull request, or this account can't see it.`}:{error:ut.error},refreshing:ut.isPending,onRetry:Qt,...Cn?{gitHubUrl:Cn}:{}}):K?(0,$.jsxs)(qs,{value:Bt,children:[De.has(`summary`)?(0,$.jsx)(`div`,{className:G(`absolute inset-0`,U!==`summary`&&`invisible`),children:(0,$.jsx)(fu,{scrollerRef:Be.summary,environmentId:e,threadRef:r,reference:P,detail:K,activityPending:Xt,checksStale:kr,activityError:Zt,pendingFinding:st,fixFindingLabel:Un.fixFinding,fixCheckLabel:Un.fixCheck,...Hn?{onFixFinding:tr}:{},onRefresh:Qt,onRefreshChecks:cn})}):null,De.has(`guide`)?(0,$.jsx)(`div`,{className:G(`absolute inset-0`,U!==`guide`&&`invisible`),children:(0,$.jsx)(wd,{environmentId:e,reference:P,active:U===`guide`,title:K.title,workspaceRoot:K.workspaceRoot,canComment:K.capabilities.review.inlineComment&&K.viewerPermissions.comment,onAskAboutLines:(e,t)=>$n({comment:e,request:t},{keepGuide:!0}),onAskAboutStop:Qn,onFinishReview:K.capabilities.review.verdicts.some(e=>K.viewerPermissions.verdicts.includes(e))?()=>te(e=>e+1):null,onOpenFile:be,onTourShown:w})}):null,De.has(`timeline`)?(0,$.jsx)(`div`,{className:G(`absolute inset-0`,U!==`timeline`&&`invisible`),children:Xt?(0,$.jsx)(Cl,{}):Zt?(0,$.jsx)(Dl,{error:Zt,onRetry:dt.refresh}):(0,$.jsx)(Fu,{scrollerRef:Be.timeline,detail:K,environmentId:e,threadRef:r,reference:P,order:ae,onOpenCommit:he,onRefresh:Qt})}):null,De.has(`code`)?(0,$.jsx)(`div`,{className:G(`absolute inset-0`,U!==`code`&&`invisible`),children:(0,$.jsx)(Z.Suspense,{fallback:(0,$.jsx)(Po,{label:`Loading pull request diff...`}),children:(0,$.jsx)(Nd,{scrollerRef:Be.code,onAddToAgentSelection:$n,environmentId:e,reference:P,detail:K,selectedCommitOid:de,onSelectedCommitChange:me,pendingFinding:st,fixFindingLabel:Un.fixFinding,...Hn?{onFixFinding:tr}:{},onRefresh:Qt,refreshToken:tn,revealRequest:ge})})}):null]}):null}),K?(0,$.jsx)(`div`,{className:`absolute right-4 bottom-3 z-20`,children:(0,$.jsx)(Bl,{environmentId:e,reference:P,detail:K,actionPending:mn,onCommentAction:Ln,onCommented:Qt,onReviewSubmitted:Qt,openReviewRequest:B},JSON.stringify([e,P.projectId,P.host,P.repository,P.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=Ie(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)(Y,{children:[(0,$.jsxs)(q,{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)(yt,{size:`xs`}):(0,$.jsx)(r,{"aria-hidden":!0,className:`size-3`}),t]}),(0,$.jsx)(J,{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:X.closed},merge:{label:`Merge`,Icon:X.merged},ready:{label:`Ready for review`,Icon:X.pullRequest},reopen:{label:`Reopen`,Icon:X.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=G(`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)(xr,{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)(vr,{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=G(`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:Dn(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=G(`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)(gr,{actor:n,className:`size-3.5`}),t[4]=n,t[5]=c);let l;t[6]===i?l=t[7]:(l=G(`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)(q,{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)(J,{side:`top`,children:f}),t[15]=f,t[16]=p);let m;return t[17]!==d||t[18]!==p?(m=(0,$.jsxs)(Y,{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)(q,{render:e.trigger}),t[0]=e.trigger,t[1]=n);let r;t[2]===e.reason?r=t[3]:(r=(0,$.jsx)(J,{side:`top`,children:e.reason}),t[2]=e.reason,t[3]=r);let i;return t[4]!==n||t[5]!==r?(i=(0,$.jsxs)(Y,{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:_,shortcut:`B`,available:e.browserAvailable,disabledReason:Yd.browser,onClick:e.onAddBrowser},{label:`Terminal`,icon:ge,shortcut:`T`,available:e.terminalAvailable,disabledReason:Yd.terminal,onClick:e.onAddTerminal},{label:`Files`,icon:de,shortcut:`F`,available:e.filesAvailable,disabledReason:Yd.files,onClick:e.onAddFiles},...e.onAddDesign?[{label:`Design`,icon:E,shortcut:`G`,available:e.filesAvailable,disabledReason:`Open a project to use Design.`,onClick:e.onAddDesign}]:[],{label:`Diff`,icon:xe,shortcut:`D`,available:e.diffAvailable,disabledReason:Yd.diff,onClick:e.onAddDiff},{label:`Pull request`,icon:X.pullRequest,shortcut:`P`,available:e.pullRequestAvailable,disabledReason:Yd.pullRequest,onClick:e.onAddPullRequest},{label:`Linked pull requests`,icon:X.link,shortcut:`L`,available:e.pullRequestsAvailable,disabledReason:Yd.pullRequests,onClick:e.onAddPullRequests},{label:`Device`,description:`Watch an iOS Simulator or Android Emulator.`,icon:B,shortcut:`M`,available:e.deviceAvailable,disabledReason:Yd.device,onClick:e.onAddDevice}],a=i.filter(uf),s=a.length===0?-1:Math.min(n,a.length-1),c=(0,Z.useRef)(a);(0,Z.useEffect)(()=>{c.current=a});let l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],t[0]=l):l=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)},l);let u=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey)&&a.length!==0){if(e.key===`ArrowDown`||e.key===`ArrowRight`){e.preventDefault(),r((s+1)%a.length);return}if(e.key===`ArrowUp`||e.key===`ArrowLeft`){e.preventDefault(),r(s===-1?a.length-1:(s-1+a.length)%a.length);return}if(e.key===`Enter`){if(e.target!==e.currentTarget)return;let t=a[s];if(!t)return;e.preventDefault(),t.onClick()}}},d=lf,f=e=>s!==-1&&a[s]===e,p=cf,m;t[1]===a?m=t[2]:(m=a.map(sf),t[1]=a,t[2]=m);let h=m.join(``),g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(`h3`,{className:`mb-3 font-medium text-foreground text-sm`,children:`Tools`}),t[3]=g):g=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:G(`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`,f(t)&&`bg-card/60`),children:[p(t,`size-4`),(0,$.jsx)(`span`,{className:G(`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)(L,{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)(ve,{className:`size-3.5`})}),(0,$.jsx)(Fe,{align:`end`,side:`bottom`,sideOffset:6,className:`max-w-56`,children:e.browserProfiles.map(t=>(0,$.jsx)(o,{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:[p(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 b;t[6]!==y||t[7]!==g?(b=(0,$.jsxs)(`div`,{className:`w-full max-w-3xl`,children:[g,y]}),t[6]=y,t[7]=g,t[8]=b):b=t[8];let x;return t[9]!==d||t[10]!==u||t[11]!==b||t[12]!==h?(x=(0,$.jsx)(`div`,{ref:d,tabIndex:0,onKeyDown:u,"aria-label":`Open a surface`,"data-surface-launcher-keys":h,className:`scrollbar-gutter-both flex min-h-0 flex-1 flex-col overflow-y-auto bg-muted px-5 py-6 outline-none`,children:b}),t[9]=d,t[10]=u,t[11]=b,t[12]=h,t[13]=x):x=t[13],x}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=pt(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)(_,{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)(xe,{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)(E,{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)(de,{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)(dr,{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)(ge,{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)(X.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)(ae,{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)(ce,{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)(lr,{className:`size-3 shrink-0`}):n.target?.platform===`android`?(0,$.jsx)(ur,{className:`size-3 shrink-0`}):(0,$.jsx)(B,{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 $e(a.pullRequests))Ze(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=Ye(),s=Ke(),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=qe(),f=a===null?void 0:d.get(a)?.environment.capabilities,p=f?.threadPullRequests===!0?hf(s,a,u,n)?.snapshot??null:null,m=At(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)(X.pullRequest,{className:`size-3 shrink-0 text-muted-foreground`}),t[7]=e):e=t[7],e}let y=fr({state:v.state,isDraft:v.isDraft??m?.isDraft??i?.isDraft??!1}),b=y.Icon,x=G(`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=G(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=On&&e.mode===`inline`,r=or().profiles,{resolvedTheme:i}=Tt(),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={hasOverflow:!1,canScrollLeft:!1,canScrollRight:!1},t[0]=l):l=t[0];let[u,d]=(0,Z.useState)(l),f=e.open!==!1&&e.surfaces.length>0,p=f&&e.onAddTools!==void 0,m;t[1]!==f||t[2]!==p||t[3]!==e?(m=t=>{if(!(t.defaultPrevented||t.isComposing)&&sr(t,e.keybindings,{context:{...e.getShortcutContext(),rightPanelOpen:!0}})===`rightPanel.new`&&!document.querySelector(Jd)&&(!f||p&&e.browserAvailable)&&(t.preventDefault(),t.stopPropagation(),!t.repeat)){if(!p){document.querySelector(`[data-surface-launcher-keys]`)?.focus();return}e.onAddTools?.()}},t[1]=f,t[2]=p,t[3]=e,t[4]=m):m=t[4];let h=(0,Z.useEffectEvent)(m),g;t[5]!==h||t[6]!==e.open?(g=()=>{if(e.open!==!1)return document.addEventListener(`keydown`,h,!0),()=>document.removeEventListener(`keydown`,h,!0)},t[5]=h,t[6]=e.open,t[7]=g):g=t[7];let _;t[8]===e.open?_=t[9]:(_=[e.open],t[8]=e.open,t[9]=_),(0,Z.useEffect)(g,_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{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;d(e=>e.hasOverflow===t&&e.canScrollLeft===n&&e.canScrollRight===r?e:{hasOverflow:t,canScrollLeft:n,canScrollRight:r})},t[10]=v):v=t[10];let y=v,b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=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]=b):b=t[11];let S=b,C;t[12]===e?C=t[13]:(C=async(t,n)=>{t.preventDefault(),t.stopPropagation();let r=wt();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]=C);let w=C,T=Cf,E;t[14]===e?E=t[15]:(E=(t,n)=>{t.button===1&&(t.preventDefault(),t.stopPropagation(),e.onCloseSurface(n))},t[14]=e,t[15]=E);let D=E,O,k;t[16]!==e.activeSurfaceId||t[17]!==u.hasOverflow?(O=()=>{e.activeSurfaceId&&u.hasOverflow&&(a.current?.querySelector(`[data-active-tab='true']`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},k=[e.activeSurfaceId,u.hasOverflow],t[16]=e.activeSurfaceId,t[17]=u.hasOverflow,t[18]=O,t[19]=k):(O=t[18],k=t[19]),(0,Z.useEffect)(O,k);let A,j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{let e=Qd(a.current);if(!e)return;let t=e.firstElementChild,n=rr(t?[e,t]:e,y);return e.addEventListener(`scroll`,y,{passive:!0}),y(),()=>{n(),e.removeEventListener(`scroll`,y)}},j=[y],t[20]=A,t[21]=j):(A=t[20],j=t[21]),(0,Z.useEffect)(A,j);let M,N;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{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(),y())};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},N=[y],t[22]=M,t[23]=N):(M=t[22],N=t[23]),(0,Z.useEffect)(M,N);let P=e.mode,F;t[24]===e.maximized?F=t[25]:(F=e.maximized===void 0?{}:{maximized:e.maximized},t[24]=e.maximized,t[25]=F);let I;t[26]===e.open?I=t[27]:(I=e.open===void 0?{}:{open:e.open},t[26]=e.open,t[27]=I);let L;t[28]===e.widthStorageKey?L=t[29]:(L=e.widthStorageKey===void 0?{}:{widthStorageKey:e.widthStorageKey},t[28]=e.widthStorageKey,t[29]=L);let ee;t[30]===e.defaultWidth?ee=t[31]:(ee=e.defaultWidth===void 0?{}:{defaultWidth:e.defaultWidth},t[30]=e.defaultWidth,t[31]=ee);let R;t[32]===e.inlineSize?R=t[33]:(R=e.inlineSize?{inlineSize:e.inlineSize}:{},t[32]=e.inlineSize,t[33]=R);let z=e.mode===`inline`&&!e.layoutControls?`pr-28`:`pr-3`,B=n&&`drag-region`,te=n&&`wco:pr-(--workspace-native-controls-inset)`,V=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)]`,H;t[34]!==z||t[35]!==B||t[36]!==te||t[37]!==V?(H=G(`flex h-[var(--workspace-topbar-height)] min-h-[var(--workspace-topbar-height)] shrink-0 items-center gap-1 bg-(--app-chrome-background) pl-2`,z,B,te,V),t[34]=z,t[35]=B,t[36]=te,t[37]=V,t[38]=H):H=t[38];let ne=e.surfaces,re=e.onMoveSurface,U;t[39]!==D||t[40]!==w||t[41]!==n||t[42]!==e||t[43]!==o||t[44]!==i?(U=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:T,onAuxClick:e=>D(e,t),onContextMenu:e=>void w(e,t),className:G(`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)(Y,{children:[(0,$.jsx)(q,{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)(st,{className:`size-3`,icon:u===`muted`?ct:rt})})}),(0,$.jsx)(J,{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)(Y,{children:[(0,$.jsx)(q,{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)(J,{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:G(`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)(we,{className:`size-3.5`})})]},t.id)}),t[39]=D,t[40]=w,t[41]=n,t[42]=e,t[43]=o,t[44]=i,t[45]=U):U=t[45];let ie;t[46]!==e.onMoveSurface||t[47]!==e.surfaces||t[48]!==U?(ie=(0,$.jsx)(Hn,{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:ne,onMove:re,children:U})})}),t[46]=e.onMoveSurface,t[47]=e.surfaces,t[48]=U,t[49]=ie):ie=t[49];let ae;t[50]!==u.canScrollLeft||t[51]!==u.canScrollRight||t[52]!==u.hasOverflow?(ae=u.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)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(W,{"aria-label":`Scroll tabs left`,disabled:!u.canScrollLeft,onClick:()=>S(-1),size:`icon-xs`,variant:`ghost`,children:(0,$.jsx)(c,{})})})}),(0,$.jsx)(J,{children:`Scroll tabs left`})]}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`inline-flex`,children:(0,$.jsx)(W,{"aria-label":`Scroll tabs right`,disabled:!u.canScrollRight,onClick:()=>S(1),size:`icon-xs`,variant:`ghost`,children:(0,$.jsx)(he,{})})})}),(0,$.jsx)(J,{children:`Scroll tabs right`})]})]}):null,t[50]=u.canScrollLeft,t[51]=u.canScrollRight,t[52]=u.hasOverflow,t[53]=ae):ae=t[53];let oe;t[54]!==p||t[55]!==e.onAddTools?(oe=p?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{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)(x,{className:`size-4`})}),(0,$.jsx)(J,{children:`New tab`})]}):null,t[54]=p,t[55]=e.onAddTools,t[56]=oe):oe=t[56];let se;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`min-w-0 flex-1`}),t[57]=se):se=t[57];let ce;t[58]!==n||t[59]!==e.layoutControls?(ce=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]=ce):ce=t[60];let le;t[61]===n?le=t[62]:(le=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]=le);let ue;t[63]!==e.layoutControls||t[64]!==H||t[65]!==ie||t[66]!==ae||t[67]!==oe||t[68]!==ce||t[69]!==le?(ue=(0,$.jsxs)(`div`,{className:H,"data-right-panel-tabbar":!0,children:[ie,ae,oe,se,e.layoutControls,ce,le]}),t[63]=e.layoutControls,t[64]=H,t[65]=ie,t[66]=ae,t[67]=oe,t[68]=ce,t[69]=le,t[70]=ue):ue=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]!==F||t[95]!==I||t[96]!==L||t[97]!==ee||t[98]!==R||t[99]!==ue||t[100]!==fe?(pe=(0,$.jsxs)(fs,{mode:P,...F,...I,...L,...ee,...R,children:[ue,fe]}),t[93]=e.mode,t[94]=F,t[95]=I,t[96]=L,t[97]=ee,t[98]=R,t[99]=ue,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}=nr(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:g,onToggleTerminal:_,onToggleThreadPanel:v,onToggleRightPanel:y}=e,b=n===void 0||n,x=r===void 0||r,S=i===void 0||i,C=h===void 0?`Right panel is unavailable`:h,w=g===void 0?0:g,T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(kf,{}),t[0]=T):T=t[0];let E;t[1]===c?E=t[2]:(E=(0,$.jsx)(Mn,{className:`relative shrink-0 [-webkit-app-region:no-drag]`,pressed:c,"aria-label":`Toggle thread details panel`,variant:`ghost`,size:`sm`,children:T}),t[1]=c,t[2]=E);let D=E,O;t[3]!==v||t[4]!==l||t[5]!==d?(O=e=>(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:e,...l===`popover`?{}:{onClick:v}}),(0,$.jsxs)(J,{side:`bottom`,children:[`Toggle thread details`,d?` (${d})`:``]})]}),t[3]=v,t[4]=l,t[5]=d,t[6]=O):O=t[6];let A=O,j;t[7]!==b||t[8]!==u||t[9]!==l||t[10]!==D||t[11]!==A?(j=b?A(l===`popover`?(0,$.jsx)(Jr,{handle:u,render:D}):D):null,t[7]=b,t[8]=u,t[9]=l,t[10]=D,t[11]=A,t[12]=j):j=t[12];let M;t[13]!==_||t[14]!==x||t[15]!==a||t[16]!==o||t[17]!==s?(M=x?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`flex shrink-0`}),children:(0,$.jsx)(Mn,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:o,onPressedChange:_,"aria-label":`Toggle terminal drawer`,variant:`ghost`,size:`sm`,disabled:!a,children:(0,$.jsx)(k,{className:`size-4`})})}),(0,$.jsx)(J,{side:`bottom`,children:a?`Toggle terminal drawer${s?` (${s})`:``}`:`Terminal drawer is unavailable`})]}):null,t[13]=_,t[14]=x,t[15]=a,t[16]=o,t[17]=s,t[18]=M):M=t[18];let N;t[19]!==y||t[20]!==f||t[21]!==p||t[22]!==m||t[23]!==w||t[24]!==C||t[25]!==S?(N=S?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`flex shrink-0`}),children:(0,$.jsx)(Mn,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:p,onPressedChange:y,"aria-label":w>0?`Toggle right panel, ${w} ${w===1?`tab`:`tabs`}`:`Toggle right panel`,variant:`ghost`,size:`sm`,disabled:!f,children:w>0?(0,$.jsx)(Df,{count:w}):(0,$.jsx)(st,{className:`size-4`,icon:p?lt:at})})}),(0,$.jsx)(J,{side:`bottom`,children:f?`Toggle right panel${m?` (${m})`:``}`:C})]}):null,t[19]=y,t[20]=f,t[21]=p,t[22]=m,t[23]=w,t[24]=C,t[25]=S,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?nt:it,o;t[0]===a?o=t[1]:(o=(0,$.jsx)(st,{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)(q,{render:(0,$.jsx)(Mn,{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)(J,{side:`bottom`,children:i}),t[7]=i,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,$.jsxs)(Y,{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-40ju6vkz.js.map