@p4code/cli 0.9.24 → 0.9.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AcpMcpStdioBridge-BNuxv1nx.mjs → AcpMcpStdioBridge-DLEEBpNR.mjs} +4 -4
- package/dist/AcpMcpStdioBridge-Dozbm_3J.mjs +3 -0
- package/dist/{Effect-BrI3bavz.mjs → Effect-DwQPN8rO.mjs} +35 -2
- package/dist/{Schema-06GeVid5.mjs → Schema-CdYZrGX6.mjs} +24 -3
- package/dist/{Stream-DKSvHopl.mjs → Stream-F-Z4HJeD.mjs} +2 -2
- package/dist/{TraceDiagnostics-Dk5M3WAT.mjs → TraceDiagnostics-D1Qz3qce.mjs} +18 -7
- package/dist/bin.mjs +2 -2
- package/dist/{binCli-CBzw8eZx.mjs → binCli-CcEaWLAR.mjs} +11 -11
- package/dist/claude-history-worker.mjs +1 -1
- package/dist/{claudeHistoryWorker-BZBBGtSw.mjs → claudeHistoryWorker-Bf24F_k8.mjs} +1 -1
- package/dist/{claudeHistoryWorker-DlhW7K2f.mjs → claudeHistoryWorker-DOjYf4xB.mjs} +4 -4
- package/dist/client/.vite/manifest.json +2259 -2257
- package/dist/client/assets/{2NI2N5EU-Dz1H18lO.js → 2NI2N5EU--LXjbTE-.js} +2 -2
- package/dist/client/assets/{4UO7MD6I-DxZW-JIQ.js → 4UO7MD6I-D_jr6_IV.js} +2 -2
- package/dist/client/assets/{5B3SVYGG-Cl2owg_V.js → 5B3SVYGG-tThUTA_S.js} +2 -2
- package/dist/client/assets/{5GK6JWQ2-A0G_mE3E.js → 5GK6JWQ2-BCuuAhKJ.js} +2 -2
- package/dist/client/assets/{5N7A7DKN-Bd00cghV.js → 5N7A7DKN-rdPMRoZL.js} +2 -2
- package/dist/client/assets/{5OC2THR4-ytZLjDMp.js → 5OC2THR4-gvpm3IL0.js} +2 -2
- package/dist/client/assets/{5S6HY5KT-XbqbgHxv.js → 5S6HY5KT-CWanNmdR.js} +2 -2
- package/dist/client/assets/{6IMQ5BUJ-BtndAY2_.js → 6IMQ5BUJ-1sguTKZ9.js} +2 -2
- package/dist/client/assets/{6OLKWJ4F-DNXmh00R.js → 6OLKWJ4F-9loy41nw.js} +2 -2
- package/dist/client/assets/{74OO7NKP-DbprmlDc.js → 74OO7NKP-ukQR6jKi.js} +2 -2
- package/dist/client/assets/{75O6YZUN-DZ_5zRwt.js → 75O6YZUN-BjBd5LQ0.js} +2 -2
- package/dist/client/assets/{77XECAW3-CgSkQSMJ.js → 77XECAW3-Ccw2Y7VD.js} +2 -2
- package/dist/client/assets/{ABYRPUBD-ucE-F8EO.js → ABYRPUBD-CvqVJLPf.js} +2 -2
- package/dist/client/assets/AlertDialogRoot-CimqRgXh.js +2 -0
- package/dist/client/assets/{AnimatedHeight-B2j_NXft.js → AnimatedHeight-Dwarin_V.js} +2 -2
- package/dist/client/assets/{AuthSurfaceShell-DqI-KrrY.js → AuthSurfaceShell-BvGaTutU.js} +2 -2
- package/dist/client/assets/{BB2UYUI2-CXw0vAgW.js → BB2UYUI2-Drnmium_.js} +2 -2
- package/dist/client/assets/{BUM34MOA-DBHGisGU.js → BUM34MOA-AkPmeijf.js} +2 -2
- package/dist/client/assets/{CEQABKGZ-MGn88wbo.js → CEQABKGZ-BNUlDSIK.js} +2 -2
- package/dist/client/assets/{CXAC5362-C1Fk1A6g.js → CXAC5362-Bmar3Iii.js} +2 -2
- package/dist/client/assets/{ChatGptUsageButton-_JZfpkEi.js → ChatGptUsageButton-D6Iy8SVv.js} +2 -2
- package/dist/client/assets/ChatMarkdown-DHhJpg3q.js +49 -0
- package/dist/client/assets/{CheckboxIndicator-DFCs5GRD.js → CheckboxIndicator-DbA95VlZ.js} +2 -2
- package/dist/client/assets/{ClippedText-BIwvWMlV.js → ClippedText-UM8CaEu4.js} +2 -2
- package/dist/client/assets/{CodexSetupSection.logic-B8uhmM78.js → CodexSetupSection.logic-kKJPABQZ.js} +2 -2
- package/dist/client/assets/{CollapsiblePanel-CsWNZ7jo.js → CollapsiblePanel-C1iRr4kZ.js} +2 -2
- package/dist/client/assets/{ComboboxClear-Cv9NZFNr.js → ComboboxClear-DaifQLU5.js} +2 -2
- package/dist/client/assets/{ComboboxGroupLabel-BPe0M6wJ.js → ComboboxGroupLabel-C03JGZRD.js} +2 -2
- package/dist/client/assets/{CommandBlock-BJ2nHWe_.js → CommandBlock-DH_L_Tgo.js} +2 -2
- package/dist/client/assets/{CompositeRoot-RcqGhRAf.js → CompositeRoot-B1DTZCNU.js} +2 -2
- package/dist/client/assets/{ConnectAgentSurface-kcWh3f_f.js → ConnectAgentSurface-C5bZc2ZR.js} +2 -2
- package/dist/client/assets/{ConnectionStatusDot-DIUevPBM.js → ConnectionStatusDot-CCTiSlHA.js} +2 -2
- package/dist/client/assets/{DRLTVNUE-CmpBRyx_.js → DRLTVNUE-BqWUfmRf.js} +2 -2
- package/dist/client/assets/{DYY6UVD2-rvY-xhxe.js → DYY6UVD2-CyRsghfa.js} +2 -2
- package/dist/client/assets/{DevicePanel-Bkrn90hU.js → DevicePanel-DocID7hH.js} +2 -2
- package/dist/client/assets/{DeviceSetup-BQvNWMm0.js → DeviceSetup-CX2OWVB9.js} +2 -2
- package/dist/client/assets/{DialogRoot-Dg58-QOq.js → DialogRoot-D64NsaiW.js} +2 -2
- package/dist/client/assets/{DialogTitle-CSaaIBpP.js → DialogTitle-CYefNdHm.js} +2 -2
- package/dist/client/assets/{DiffCommentAnnotation-eHSeIufV.js → DiffCommentAnnotation-ChKqFxt5.js} +2 -2
- package/dist/client/assets/{DiffFileTree-opfyNeFz.js → DiffFileTree-B6AgzOXX.js} +2 -2
- package/dist/client/assets/{DiffPanel-C4ySgbUg.js → DiffPanel-DKAHtq5x.js} +2 -2
- package/dist/client/assets/{DiffWorkerPoolProvider-BwOTmWKP.js → DiffWorkerPoolProvider-CK3y5UA1.js} +3 -3
- package/dist/client/assets/{EmbeddedDesign-BW5Rcxmc.js → EmbeddedDesign-Bj-kkArq.js} +5 -5
- package/dist/client/assets/{EnvironmentMachineIcon-DM48TG2x.js → EnvironmentMachineIcon-CJ30kzSK.js} +2 -2
- package/dist/client/assets/{ExpandableText-CYFNBBpY.js → ExpandableText-CBPvhWvZ.js} +2 -2
- package/dist/client/assets/{FNOVOB4O-B8vuCGFt.js → FNOVOB4O-DYXYw-b1.js} +2 -2
- package/dist/client/assets/{FieldControl-DHSVFpKc.js → FieldControl-CkgERQaU.js} +2 -2
- package/dist/client/assets/{FileDiff-CZk9prBc.js → FileDiff-BLuBewdN.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-BcCGkQ__.js → FilePreviewPanel-DWNimHTU.js} +4 -4
- package/dist/client/assets/{FoldedSettingsSection-COBhgfnb.js → FoldedSettingsSection-C3cuD_W9.js} +2 -2
- package/dist/client/assets/{HDGCDEEZ-DRcTM9ws.js → HDGCDEEZ-7WPyPcLr.js} +2 -2
- package/dist/client/assets/{HSJLKHB7-Dh4X6CJ4.js → HSJLKHB7-t8_OkffK.js} +2 -2
- package/dist/client/assets/{Icons-DpgbzNj8.js → Icons-BUrn1Fzo.js} +2 -2
- package/dist/client/assets/Input-Gb8KV9DV.js +2 -0
- package/dist/client/assets/{IntervalSecondsField-D0j2uU5s.js → IntervalSecondsField-D9JXVV-s.js} +2 -2
- package/dist/client/assets/JZOYTAAL-BzA5Kg5m.js +1 -0
- package/dist/client/assets/{K3MD6TGW-uz2CK9vb.js → K3MD6TGW-DoqPvoaq.js} +2 -2
- package/dist/client/assets/{K7RP3OMA-uWbuKqQP.js → K7RP3OMA--ZFOkyEG.js} +2 -2
- package/dist/client/assets/KeybindingsSettings.logic-CMs7OPcH.js +2 -0
- package/dist/client/assets/{LHDIQX7Q-BaUgpa7I.js → LHDIQX7Q-hUqw2I9B.js} +2 -2
- package/dist/client/assets/{LUXOKEGN-C-Usmwyz.js → LUXOKEGN-Dvu_mp-q.js} +2 -2
- package/dist/client/assets/{LinkMachineSelect-CB99X8v3.js → LinkMachineSelect-SHXPDP_g.js} +2 -2
- package/dist/client/assets/MathTypeset-C02HYdjx.css +1 -0
- package/dist/client/assets/{MathTypeset-Dv2b-uiV.js → MathTypeset-TM-3r0WA.js} +2 -2
- package/dist/client/assets/{ModelLiveLayer-DIrV--mW.js → ModelLiveLayer-Bb-7OhJ9.js} +3 -3
- package/dist/client/assets/{N3JZAHOW-CLD7n6Za.js → N3JZAHOW-LjhhJ-00.js} +2 -2
- package/dist/client/assets/{NUIALGQ3-CVI_F8c-.js → NUIALGQ3-Dg1KXz02.js} +2 -2
- package/dist/client/assets/{NoProjectsHero-CAoW0Xej.js → NoProjectsHero-D0OPZtzO.js} +2 -2
- package/dist/client/assets/{O65XPQGZ-g6xpsO0r.js → O65XPQGZ-BxaJR80d.js} +2 -2
- package/dist/client/assets/{O7XIQ6OM-CBkPdCIB.js → O7XIQ6OM-CCXPxMuU.js} +2 -2
- package/dist/client/assets/{OFQON5FD-DpM-bsDn.js → OFQON5FD-WUMBXQkX.js} +2 -2
- package/dist/client/assets/{P4ConnectAccountPages-CCjWOetO.js → P4ConnectAccountPages-BNK6s-RS.js} +2 -2
- package/dist/client/assets/{P4ConnectSidebarSignIn-CfEPRRB6.js → P4ConnectSidebarSignIn-CWW40SMl.js} +2 -2
- package/dist/client/assets/{PJQHF43J-Sp1j42CR.js → PJQHF43J-BrNjCaLl.js} +2 -2
- package/dist/client/assets/{PanelLayoutControls-CcdUv-ij.js → PanelLayoutControls-DiXjRWIw.js} +7 -7
- package/dist/client/assets/{PierreEntryIcon-vf9Z0_eJ.js → PierreEntryIcon-D29_Ylm_.js} +2 -2
- package/dist/client/assets/{PopoverHandle-s36xVlsK.js → PopoverHandle-BgggGdpn.js} +2 -2
- package/dist/client/assets/PreviewPanel-DutKwWE7.js +2 -0
- package/dist/client/assets/{ProjectDefaultsSettings-TlEARfjk.js → ProjectDefaultsSettings-DMfJN66D.js} +2 -2
- package/dist/client/assets/{ProjectFavicon-Dd4p_a9n.js → ProjectFavicon-DFI1NI3D.js} +3 -3
- package/dist/client/assets/{ProjectIconPickerDialog-D5UkwTkD.js → ProjectIconPickerDialog-BqGWzrTc.js} +2 -2
- package/dist/client/assets/{ProjectMonogram-Aw_ZBtDB.js → ProjectMonogram-D4xxVtw8.js} +2 -2
- package/dist/client/assets/{ProviderAuthTerminal-Cw2WcQr1.js → ProviderAuthTerminal-CRSvI-Og.js} +2 -2
- package/dist/client/assets/ProviderModelPicker-D73G0AKf.js +2 -0
- package/dist/client/assets/{ProviderSettingsForm-DaeugImp.js → ProviderSettingsForm-DchD8HSN.js} +2 -2
- package/dist/client/assets/{PullRequestCodeTab-DdfQeIIl.js → PullRequestCodeTab-BdXdTg-d.js} +3 -3
- package/dist/client/assets/{RHNBAITX-DQfv99hf.js → RHNBAITX-PsYrngSs.js} +2 -2
- package/dist/client/assets/{ReadOnlySourcePreview-Vvv9UVOM.js → ReadOnlySourcePreview-8jLKmc3M.js} +2 -2
- package/dist/client/assets/{RedactedSensitiveText-bQSbv34p.js → RedactedSensitiveText-DhV2Jdu8.js} +2 -2
- package/dist/client/assets/{RenderErrorBoundary-4-dgp9K8.js → RenderErrorBoundary-56lc2IQ3.js} +3 -3
- package/dist/client/assets/{RightPanelResizeHandle-B6vIzqA0.js → RightPanelResizeHandle-ClzdYxWw.js} +2 -2
- package/dist/client/assets/{SLD4V6NK-BKBt5rH4.js → SLD4V6NK-CxidvPXU.js} +2 -2
- package/dist/client/assets/{ScheduledTasksSettings-Dbz9TZ6o.js → ScheduledTasksSettings-BdMCgBm5.js} +5 -5
- package/dist/client/assets/{ScopedSwitch-D1e9m-dH.js → ScopedSwitch-CwnjCta_.js} +2 -2
- package/dist/client/assets/{ScrollAreaCorner-Cn2VDisz.js → ScrollAreaCorner-CfTQYjCW.js} +2 -2
- package/dist/client/assets/{SecretInput-C6zW-8wI.js → SecretInput-BYfVbTLh.js} +2 -2
- package/dist/client/assets/{SelectScrollUpArrow-C40FP3vq.js → SelectScrollUpArrow-BE0-tVtP.js} +2 -2
- package/dist/client/assets/{SelfImproveSettingsSection-WXBG9l_4.js → SelfImproveSettingsSection-DsqFeICK.js} +2 -2
- package/dist/client/assets/{SettingsPanels-BEtJwC6n.js → SettingsPanels-D_rJsyjt.js} +14 -14
- package/dist/client/assets/{SettingsPanels.logic-y95n8OOO.js → SettingsPanels.logic-BTJUBh-T.js} +2 -2
- package/dist/client/assets/{SettingsScopeNotice-DE1t1kw-.js → SettingsScopeNotice-CAVvn3pQ.js} +2 -2
- package/dist/client/assets/{SidebarStageBackdrop-CYLpofvt.js → SidebarStageBackdrop-DdxWuxIk.js} +2 -2
- package/dist/client/assets/{T3PCR2KE-BryFgp5Q.js → T3PCR2KE-BtQsKjM5.js} +2 -2
- package/dist/client/assets/{TKWO2OVW-DcRjYaVG.js → TKWO2OVW-CeYF-suq.js} +2 -2
- package/dist/client/assets/{TSHNXIZL-hAylFob1.js → TSHNXIZL-FQ7ZWHEn.js} +2 -2
- package/dist/client/assets/{ThemeEditorPanel-DeGNehj1.js → ThemeEditorPanel-BJucNhy-.js} +2 -2
- package/dist/client/assets/{ThreadDetailsItemsMenu-D0mfEKtW.js → ThreadDetailsItemsMenu-CRBBIuc7.js} +10 -10
- package/dist/client/assets/ThreadTerminalDrawer-Ci0mbLzJ.js +5 -0
- package/dist/client/assets/{TooltipProvider-DQ0TF9NB.js → TooltipProvider-BH5ni_Lo.js} +2 -2
- package/dist/client/assets/{UQJE5E4I-BfaZIz58.js → UQJE5E4I-CeqBk-r6.js} +2 -2
- package/dist/client/assets/{USNYFO5S-jOq8Kcgw.js → USNYFO5S-_1m41tJt.js} +2 -2
- package/dist/client/assets/{Virtualizer-B3FSTwJv.js → Virtualizer-DLB0FYm-.js} +2 -2
- package/dist/client/assets/{WEVWDWVA-1T3GTRY3.js → WEVWDWVA-DmSV8HLL.js} +2 -2
- package/dist/client/assets/{WorkspaceBreadcrumb-Dno2N8Xd.js → WorkspaceBreadcrumb-DQkeBQUl.js} +2 -2
- package/dist/client/assets/{WorkspacePageContainer-OLpcgD_f.js → WorkspacePageContainer-D2rx9iDg.js} +2 -2
- package/dist/client/assets/{WorkspacePageHeader-Bn0m4gpR.js → WorkspacePageHeader-D8-RIRjQ.js} +2 -2
- package/dist/client/assets/{X5RFHQXM-CaiE8-NB.js → X5RFHQXM-BUdDYXox.js} +2 -2
- package/dist/client/assets/{X62E3GBT-CKnjYZvp.js → X62E3GBT-BbQ7FmNB.js} +2 -2
- package/dist/client/assets/{XBNEOJTC-DF-d22o-.js → XBNEOJTC-BLEZA-vx.js} +2 -2
- package/dist/client/assets/{YHV2MVVZ-VSj4WI2u.js → YHV2MVVZ-DM2RTtkR.js} +2 -2
- package/dist/client/assets/{YURCZMG2-C9wxlavt.js → YURCZMG2-D5w6cPMY.js} +2 -2
- package/dist/client/assets/{YVG2LODB-JRtigNQC.js → YVG2LODB-BkLbsaCo.js} +2 -2
- package/dist/client/assets/_chat-CKMs-ajx.js +47 -0
- package/dist/client/assets/{_chat.design-DxTdYmIe.js → _chat.design-CpqXODBn.js} +2 -2
- package/dist/client/assets/{_chat.index-CNIRuBqG.js → _chat.index-B0eOfZAf.js} +2 -2
- package/dist/client/assets/_chat.new-CqLuDynd.js +4 -0
- package/dist/client/assets/{_chat.pull-requests-C6rdgLS9.js → _chat.pull-requests-C4Eo8GDQ.js} +2 -2
- package/dist/client/assets/{alert-CfhQnxcL.js → alert-D1O9oex3.js} +2 -2
- package/dist/client/assets/{alert-dialog-Dn_PRSFU.js → alert-dialog-3XDceRWv.js} +2 -2
- package/dist/client/assets/{assetUrls-BMizLezw.js → assetUrls-Dq0gsqWs.js} +2 -2
- package/dist/client/assets/{assets-DT0KoRIr.js → assets-C3_UZib9.js} +2 -2
- package/dist/client/assets/{browserHistoryStore-xnY5QhfE.js → browserHistoryStore-CVCo7qfb.js} +2 -2
- package/dist/client/assets/{browserLinkTarget-CH-4nkAf.js → browserLinkTarget-CopcRHna.js} +2 -2
- package/dist/client/assets/{checkbox-iFzfBLKr.js → checkbox-CxRqp4sO.js} +2 -2
- package/dist/client/assets/{color-picker-W1NtR7ha.js → color-picker-CvbP7BS3.js} +2 -2
- package/dist/client/assets/{combobox-B0IMIA-1.js → combobox-CuyUAuiC.js} +2 -2
- package/dist/client/assets/command-4bqVdX0m.js +2 -0
- package/dist/client/assets/{connect-BflmwHyv.js → connect-DFGquf-O.js} +2 -2
- package/dist/client/assets/connect-agent-Db5rxxY1.js +2 -0
- package/dist/client/assets/{design-B_bv-H7n.js → design-DzoN9JgQ.js} +2 -2
- package/dist/client/assets/{device-i4SkE05R.js → device-H2MyT_kA.js} +2 -2
- package/dist/client/assets/{dialog-DFlZvvht.js → dialog-CrLVN_m6.js} +2 -2
- package/dist/client/assets/{diffPanelStore-CGdPbp5I.js → diffPanelStore-CxnPNigi.js} +2 -2
- package/dist/client/assets/{diffRendering-B7lkQ5_O.js → diffRendering-cyTQV5bk.js} +2 -2
- package/dist/client/assets/{dist-BvS7KgJD.js → dist-J7s-H61h.js} +3 -3
- package/dist/client/assets/{draft-input-1HTN8QVo.js → draft-input-UuEBPJE8.js} +2 -2
- package/dist/client/assets/{duoViewer-DbnFva5H.js → duoViewer-C3DQnADY.js} +2 -2
- package/dist/client/assets/{dynamic-DmVpEfW3.js → dynamic-PDa6LTqb.js} +2 -2
- package/dist/client/assets/{embeddedScripts-D0-ABFFC.js → embeddedScripts-BDzRNXSL.js} +2 -2
- package/dist/client/assets/{empty-Dn5VI2Xk.js → empty-YMXgQbNI.js} +2 -2
- package/dist/client/assets/entities-HOBDIiHK.js +2 -0
- package/dist/client/assets/fileLinks-BlT4My6t.js +2 -0
- package/dist/client/assets/{fileTreeExpansion-Bp5eLBXI.js → fileTreeExpansion-D5nN-Oqd.js} +2 -2
- package/dist/client/assets/{getDiffFileInput-CKgGUEGl.js → getDiffFileInput-4gToQuSl.js} +2 -2
- package/dist/client/assets/{htmlRender-BdsR_7vV.js → htmlRender-CUGVJXGf.js} +2 -2
- package/dist/client/assets/{index-DQKD4Lk2.js → index-C04a0SKq.js} +3 -3
- package/dist/client/assets/{input-yaZxaTds.js → input-DxHa9qj5.js} +2 -2
- package/dist/client/assets/{input-group-B1TOCtDG.js → input-group-_rAbDbys.js} +2 -2
- package/dist/client/assets/katex-B940_AAO.js +258 -0
- package/dist/client/assets/{kbd-R7rkirqT.js → kbd-DjUfNaix.js} +2 -2
- package/dist/client/assets/{keybindings-CrlWqd5q.js → keybindings-8_1sqf8s.js} +2 -2
- package/dist/client/assets/{lazy-C5ansoaW.js → lazy-C1dqAep6.js} +4 -4
- package/dist/client/assets/{lazyRouteComponent-BxpFJiXB.js → lazyRouteComponent-DLamKhHF.js} +2 -2
- package/dist/client/assets/{link-2ZiGGBbw.js → link-D1nkgCv7.js} +2 -2
- package/dist/client/assets/{linkedPrompt-CwNmoWmu.js → linkedPrompt-Quysf0mk.js} +2 -2
- package/dist/client/assets/main-BFdCLmkY.js +39 -0
- package/dist/client/assets/main-BQBpA03z.css +2 -0
- package/dist/client/assets/mediaReference-D19Dzoh3.js +2 -0
- package/dist/client/assets/mediaSource-DfsR3T70.js +2 -0
- package/dist/client/assets/{modelScene-D8CdQkcp.js → modelScene-CcF-Uii-.js} +2 -2
- package/dist/client/assets/{number-field-DNna9ps3.js → number-field-CALZZPio.js} +2 -2
- package/dist/client/assets/{observeResize-Cz6dJUG2.js → observeResize-DLmefMqO.js} +2 -2
- package/dist/client/assets/{onboarding-BG6FdUUU.js → onboarding-plATuZco.js} +2 -2
- package/dist/client/assets/{openFileInPreview-BaemzSTr.js → openFileInPreview-BCGQQ_Ia.js} +2 -2
- package/dist/client/assets/{p4ProjectFile-O_tvpvNW.js → p4ProjectFile-DCNJ4pTp.js} +2 -2
- package/dist/client/assets/{pair-BNIczJXa.js → pair-umv6-haX.js} +2 -2
- package/dist/client/assets/{pendingSendStore-Cc6n4Xji.js → pendingSendStore-CgfQk4GV.js} +2 -2
- package/dist/client/assets/{phoneViewer-CqawjVDW.js → phoneViewer-DJWjzgFc.js} +2 -2
- package/dist/client/assets/{pierre-icons-BfZ11Q2h.js → pierre-icons-fv1goMS6.js} +2 -2
- package/dist/client/assets/{popover-DnYfrQly.js → popover-DxCAIK62.js} +2 -2
- package/dist/client/assets/preview-Ce5ECOHv.js +2 -0
- package/dist/client/assets/{preview-Bi-hPWTp.js → preview-x1tmlUez.js} +2 -2
- package/dist/client/assets/{previewMiniPlayerStore-W10VSM09.js → previewMiniPlayerStore-CEd7VI6J.js} +2 -2
- package/dist/client/assets/{primary-CDuW5QwW.js → primary-DcnaBKM0.js} +2 -2
- package/dist/client/assets/{primaryCloudLinkState-BONYlcei.js → primaryCloudLinkState-TS0IW37f.js} +2 -2
- package/dist/client/assets/{projectFilesQueryState-Ck4wjfaq.js → projectFilesQueryState-DKw9S3nn.js} +2 -2
- package/dist/client/assets/{projectScriptEditor-DgVU8tRa.js → projectScriptEditor-DT7-Ivvb.js} +2 -2
- package/dist/client/assets/{providerSkills-Dfc0PY_E.js → providerSkills-G8ld9nNp.js} +2 -2
- package/dist/client/assets/pullRequestDetail.logic-Dm3mx1US.js +10 -0
- package/dist/client/assets/{pullRequestIcons-DwblWS4R.js → pullRequestIcons-D8rnFTkk.js} +2 -2
- package/dist/client/assets/{pullRequestReviewStore-Cc4bHb4o.js → pullRequestReviewStore-C45fih_P.js} +2 -2
- package/dist/client/assets/{pullRequests-BSjV3BBU.js → pullRequests-euX1Ch2G.js} +2 -2
- package/dist/client/assets/queries-DNRXml7d.js +2 -0
- package/dist/client/assets/query-Bw8YoCbO.js +2 -0
- package/dist/client/assets/{radio-group-EK7EPCn2.js → radio-group-DpD3XHAp.js} +2 -2
- package/dist/client/assets/{relay-Ceq0htTl.js → relay-YiJpGyaO.js} +2 -2
- package/dist/client/assets/{relayFailureReason-DfHD60Z_.js → relayFailureReason-Baxcpnas.js} +2 -2
- package/dist/client/assets/{renderScheduler-BGJGU9W9.js → renderScheduler-BuGbk7RK.js} +2 -2
- package/dist/client/assets/{rightPanelStore-AjYoRisO.js → rightPanelStore-BF1zmmXM.js} +2 -2
- package/dist/client/assets/runtime-DIAcbMTc.js +9 -0
- package/dist/client/assets/{runtimeModeConfig-Oh86kRYJ.js → runtimeModeConfig-4g_-_dE2.js} +2 -2
- package/dist/client/assets/{scheduledTasksSettings.logic-h-rZbNI3.js → scheduledTasksSettings.logic-BOrkdeD3.js} +3 -3
- package/dist/client/assets/{scroll-area-DhDCLqyU.js → scroll-area-CokPD3-i.js} +2 -2
- package/dist/client/assets/{select-CNcZzYBl.js → select-CxYi0YMi.js} +2 -2
- package/dist/client/assets/{selfImproveFindings-CvQXlaMJ.js → selfImproveFindings-CE-lxRTw.js} +2 -2
- package/dist/client/assets/{server-Bw1ZPPkk.js → server-BNjk2K1j.js} +2 -2
- package/dist/client/assets/{session-YEQs2e4k.js → session-DMNo4Bh3.js} +2 -2
- package/dist/client/assets/{session-logic-BOQRidTa.js → session-logic-CELyWJ1v.js} +4 -4
- package/dist/client/assets/{settings-Dj9xov5g.js → settings-Bt6o5coA.js} +2 -2
- package/dist/client/assets/{settings.appearance-BFkpCG_N.js → settings.appearance-pkRxkhgs.js} +2 -2
- package/dist/client/assets/settings.archived-OjOh5b0A.js +2 -0
- package/dist/client/assets/{settings.computer-use-Bi6Yznts.js → settings.computer-use-Dh6Z2-Jg.js} +2 -2
- package/dist/client/assets/settings.connections-F3LWiK8-.js +2 -0
- package/dist/client/assets/{settings.data-controls-CMPajamk.js → settings.data-controls-DgOo9a4b.js} +2 -2
- package/dist/client/assets/{settings.decisions-BaYWexvw.js → settings.decisions-lQFEkC9t.js} +2 -2
- package/dist/client/assets/settings.designs-C1tyiETD.js +2 -0
- package/dist/client/assets/settings.diagnostics-kp_wJw6e.js +2 -0
- package/dist/client/assets/{settings.general-BqeVFfxZ.js → settings.general-B5Kke4t3.js} +2 -2
- package/dist/client/assets/{settings.integrations-CYmWtYZT.js → settings.integrations-CjiKCDy_.js} +2 -2
- package/dist/client/assets/{settings.keybindings-Rdl8b88k.js → settings.keybindings-CouYSmxE.js} +2 -2
- package/dist/client/assets/{settings.open-source-licenses-C-Brz8iy.js → settings.open-source-licenses-CHFTLx1q.js} +2 -2
- package/dist/client/assets/settings.plugins-StUBBho3.js +5 -0
- package/dist/client/assets/{settings.projects-BTKNVvto.js → settings.projects-B_SxK9Cl.js} +4 -4
- package/dist/client/assets/settings.providers-Ch16WkgV.js +3 -0
- package/dist/client/assets/{settings.scheduled-tasks-Da_-twWT.js → settings.scheduled-tasks-KNcUc94O.js} +2 -2
- package/dist/client/assets/{settings.secrets-B_ZY_xsv.js → settings.secrets-2aMmfgKR.js} +2 -2
- package/dist/client/assets/{settings.snap-shot-lnIAMmUa.js → settings.snap-shot-B5cEBXZD.js} +2 -2
- package/dist/client/assets/settings.source-control-G_TX95re.js +2 -0
- package/dist/client/assets/settings.storage-BdNNKm9m.js +2 -0
- package/dist/client/assets/settingsLayout-CzGbLP4v.js +3 -0
- package/dist/client/assets/{sidebar-BUDllWET.js → sidebar-ovj9EiR4.js} +2 -2
- package/dist/client/assets/{sidebarProjectGrouping-xYoX3lLq.js → sidebarProjectGrouping-DT6LCDEX.js} +2 -2
- package/dist/client/assets/{skeleton-C6O21cqb.js → skeleton-0IEb3e4e.js} +2 -2
- package/dist/client/assets/sourceControl-CPobWWHq.js +2 -0
- package/dist/client/assets/{sourceControlClients-C3cHOUoL.js → sourceControlClients-4PlkytxQ.js} +2 -2
- package/dist/client/assets/{spinner-m1uNq_wW.js → spinner-7CSKKESP.js} +2 -2
- package/dist/client/assets/src-BVovWpja.js +15 -0
- package/dist/client/assets/{terminal-links-CxLXIwP1.js → terminal-links-BTdovUFa.js} +2 -2
- package/dist/client/assets/{terminalSessions-CXGA3pch.js → terminalSessions-EUiRWJti.js} +2 -2
- package/dist/client/assets/{textarea-xZYMC9X5.js → textarea-DMmmmGA1.js} +2 -2
- package/dist/client/assets/{themePalette-BcMO2M90.js → themePalette-C7ZOgucT.js} +2 -2
- package/dist/client/assets/{threadCheckpoints-DUorxvL1.js → threadCheckpoints-DjIk4Kvg.js} +2 -2
- package/dist/client/assets/{toggle-DumCe7R7.js → toggle-4vFx94TS.js} +2 -2
- package/dist/client/assets/{toggle-group-CzE2mG-B.js → toggle-group-d6H735Xi.js} +2 -2
- package/dist/client/assets/{tooltip-BhCWnsdW.js → tooltip-CGvxq8k3.js} +2 -2
- package/dist/client/assets/{uiStateStore-JOwhQqDV.js → uiStateStore-MbQdhAPp.js} +2 -2
- package/dist/client/assets/{usage-Blib8u_-.js → usage-Da_tm2dn.js} +2 -2
- package/dist/client/assets/{usageAccess-COKmar79.js → usageAccess-B-HGPPkp.js} +2 -2
- package/dist/client/assets/{usageFormat-2913AogD.js → usageFormat-DcON9Kz_.js} +2 -2
- package/dist/client/assets/{usageShortcuts-U_aRtpf7.js → usageShortcuts-B_o9XxKX.js} +2 -2
- package/dist/client/assets/{use-atom-command-DkmE-pw9.js → use-atom-command-C4Tyb1VL.js} +2 -2
- package/dist/client/assets/{useAriaLabelledBy-BiZIzNf7.js → useAriaLabelledBy-CcwjH1QH.js} +2 -2
- package/dist/client/assets/useHandleNewThread-Qb_yy6KY.js +2 -0
- package/dist/client/assets/{useLocation-BXwb7I1F.js → useLocation-CIvcNoeU.js} +2 -2
- package/dist/client/assets/{useNavigate-P1p3Es15.js → useNavigate-DVrOlf8m.js} +2 -2
- package/dist/client/assets/{useNavigateBack-D02Al7yk.js → useNavigateBack-Dmf0SIc3.js} +2 -2
- package/dist/client/assets/{useP4ConnectAuthPrompt-4l_tJOsn.js → useP4ConnectAuthPrompt-BPXqJdyY.js} +2 -2
- package/dist/client/assets/{useParams-DsmZTF__.js → useParams-BeJIRxxE.js} +2 -2
- package/dist/client/assets/{usePermissionStatus-DeJYBk6u.js → usePermissionStatus-Cx1Wuwk0.js} +2 -2
- package/dist/client/assets/{usePopupViewport-BBKn7x_4.js → usePopupViewport-OR_PF2s-.js} +2 -2
- package/dist/client/assets/{usePullRequestActions-DtDOHLgX.js → usePullRequestActions-B_Nrg846.js} +2 -2
- package/dist/client/assets/{useRegisterFieldControl-DkFmgEzw.js → useRegisterFieldControl-B72Afmil.js} +2 -2
- package/dist/client/assets/{useScopedModelAvailability-B-vTMNh_.js → useScopedModelAvailability-DVQ42jT4.js} +2 -2
- package/dist/client/assets/{useSettings-Dp27sUML.js → useSettings-BWMcQzC-.js} +2 -2
- package/dist/client/assets/{utils-BVnIIHXP.js → utils-DFNDxNZi.js} +21 -21
- package/dist/client/assets/{vcsRefInvalidation-DU1ipBl9.js → vcsRefInvalidation-CV8dYgi0.js} +2 -2
- package/dist/client/assets/{welcome-CmsT2lJW.js → welcome-BxhPM21H.js} +2 -2
- package/dist/client/index.html +1 -1
- package/dist/client/third-party-licenses.json +1 -1
- package/dist/{mcpResponsePayloads-C8W7Qyxk.mjs → mcpResponsePayloads-SwQXsZoI.mjs} +3 -3
- package/dist/{preview-iNdhUsAa.mjs → preview-BGylKXB6.mjs} +235 -101
- package/dist/{renderer-DKOOIEoX.mjs → renderer-CQkeNW9b.mjs} +2 -2
- package/dist/{runtime-Bm_EVnst.mjs → runtime-O5AWAEzD.mjs} +3 -3
- package/dist/{runtimeLayer-hDhX2kHB.mjs → runtimeLayer-C-Fo4HWH.mjs} +1 -1
- package/dist/{runtimeLayer-CZ8Ru7Ia.mjs → runtimeLayer-ChPBglJB.mjs} +2298 -1209
- package/dist/{sdk-CcrYY4k4.mjs → sdk-C8tgjyIq.mjs} +29609 -23199
- package/dist/{server-qfCj2NpU.mjs → server-CsS0d2BE.mjs} +358 -88
- package/dist/{sha2-Daa2Fiv1.mjs → sha2-BjjJcoUu.mjs} +449 -24
- package/package.json +1 -1
- package/dist/AcpMcpStdioBridge-C9Ry_oCI.mjs +0 -3
- package/dist/client/assets/AlertDialogRoot-CNpt8h9w.js +0 -2
- package/dist/client/assets/ChatMarkdown-DO_2fTqM.js +0 -49
- package/dist/client/assets/Input-BT2VVALp.js +0 -2
- package/dist/client/assets/JZOYTAAL-BCzM9Qh2.js +0 -1
- package/dist/client/assets/KeybindingsSettings.logic-oAUXQqts.js +0 -2
- package/dist/client/assets/MathTypeset-DEcVZfaU.css +0 -1
- package/dist/client/assets/PreviewPanel-DIVx5x1H.js +0 -2
- package/dist/client/assets/ProviderModelPicker-rRVcFLyP.js +0 -2
- package/dist/client/assets/ThreadTerminalDrawer-B77-xYz_.js +0 -5
- package/dist/client/assets/_chat-BA5cbHxE.js +0 -47
- package/dist/client/assets/_chat.new-Bw2VR60x.js +0 -4
- package/dist/client/assets/command-BdVxwZ8D.js +0 -2
- package/dist/client/assets/connect-agent-AVHGyda5.js +0 -2
- package/dist/client/assets/entities-JWl3bvMT.js +0 -2
- package/dist/client/assets/fileLinks-Y3tOmcmb.js +0 -2
- package/dist/client/assets/katex-DJhrJSbw.js +0 -258
- package/dist/client/assets/main-43D2LVmx.js +0 -38
- package/dist/client/assets/main-Rpw_0nEx.css +0 -2
- package/dist/client/assets/mediaReference-Bh7Pydqp.js +0 -2
- package/dist/client/assets/mediaSource-Do7lCSv7.js +0 -2
- package/dist/client/assets/preview-Dd9kGZBH.js +0 -2
- package/dist/client/assets/pullRequestDetail.logic-Dy7e4vh2.js +0 -10
- package/dist/client/assets/queries-BQAICaPF.js +0 -2
- package/dist/client/assets/query-DFSffMGJ.js +0 -2
- package/dist/client/assets/runtime-vb0YwEUc.js +0 -9
- package/dist/client/assets/settings.archived-D96oQP2t.js +0 -2
- package/dist/client/assets/settings.connections-C7OGFqf1.js +0 -2
- package/dist/client/assets/settings.designs-t7-jewWy.js +0 -2
- package/dist/client/assets/settings.diagnostics-qkp4kADk.js +0 -2
- package/dist/client/assets/settings.plugins-DAvzBYum.js +0 -5
- package/dist/client/assets/settings.providers-r89DCT90.js +0 -3
- package/dist/client/assets/settings.source-control-BIPVuyIo.js +0 -2
- package/dist/client/assets/settings.storage-vvoP_prr.js +0 -2
- package/dist/client/assets/settingsLayout-DaKDuaST.js +0 -3
- package/dist/client/assets/sourceControl-gh0Nj17P.js +0 -2
- package/dist/client/assets/src-DHn7yNZx.js +0 -15
- package/dist/client/assets/useHandleNewThread-C1YHLGL_.js +0 -2
package/dist/client/assets/{PanelLayoutControls-CcdUv-ij.js → PanelLayoutControls-DiXjRWIw.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PullRequestCodeTab-DdfQeIIl.js","assets/react-BUfh6y28.js","assets/jsx-runtime-DJeoFXNw.js","assets/utils-BVnIIHXP.js","assets/activity-CbqMUSRC.js","assets/createLucideIcon-DDevWfFk.js","assets/Icon-DYn8279B.js","assets/alarm-clock-D3-pktbt.js","assets/app-window-DT4yrrS-.js","assets/archive-Cr7-RIjC.js","assets/arrow-down-up-CQvYrirj.js","assets/arrow-down-BKghgxKI.js","assets/arrow-left-BWI0-vRp.js","assets/arrow-right-left-DXmmhGuH.js","assets/arrow-right-BJPYbHTL.js","assets/arrow-up-down-BEa_lFuV.js","assets/arrow-up-left-DLNjxPfK.js","assets/arrow-up-right-B8xNcEXp.js","assets/arrow-up-DMEbfkKl.js","assets/battery-BNMPLne0.js","assets/bell-vGxw63Gg.js","assets/blocks-CpHzQlR2.js","assets/book-open-DKRWS47i.js","assets/bookmark-DfPbwgkW.js","assets/bot-Cp92syL6.js","assets/box-D-FyjNxy.js","assets/bug-DH2pu6U9.js","assets/calendar-arrow-down-WH0xj289.js","assets/calendar-arrow-up-Lk-Us3ba.js","assets/calendar-clock-BARV5L0a.js","assets/calendar-DHdDnhKF.js","assets/camera-8ozLiwCj.js","assets/chart-no-axes-column-CQLqBsxb.js","assets/check-CdrGo1Oa.js","assets/chevron-down-D0M7_175.js","assets/chevron-left-CEWOKn-e.js","assets/chevron-right-DPl-L-yL.js","assets/chevron-up-gyDnPot_.js","assets/chevrons-left-right-ellipsis-DEfsDjXt.js","assets/chevrons-up-down-DakHVkrx.js","assets/chromium-x91nZeen.js","assets/circle-alert-DsKXULDS.js","assets/circle-arrow-up-DCmGv6Tl.js","assets/circle-check-CZ31KO9m.js","assets/circle-dashed-DMw11mBM.js","assets/circle-dot-CWCBN-HY.js","assets/circle-slash-eIt5hG5T.js","assets/circle-stop-0Wd2uKSK.js","assets/circle-x-DMkHWcTz.js","assets/circle-Doq0I3MA.js","assets/clock-3-C5l2rPxd.js","assets/clock-aK6BX5Ve.js","assets/cloud-download-Ddj2y2Q1.js","assets/cloud-upload-BzCXws1i.js","assets/cloud-BhcSs4Ie.js","assets/code-xml-DsmxIkJL.js","assets/code-Dfd-vS1O.js","assets/columns-2-CgvyvCTB.js","assets/copy-CO2RgESU.js","assets/corner-left-up-DUJ8nnVp.js","assets/corner-up-right-xmYx6v5O.js","assets/cpu-DBknwmfd.js","assets/database-D2y6m7fG.js","assets/download-S2u-tXaE.js","assets/earth-CDbKfFEl.js","assets/ellipsis-vertical-CY0vJAc8.js","assets/ellipsis-Zza4fevQ.js","assets/external-link-D1GSnnDW.js","assets/eye-off-CH68-9dO.js","assets/eye-C3U51ndb.js","assets/file-braces-BzATadbM.js","assets/file-code-corner-eTofF8xM.js","assets/file-diff-CNp_vbEN.js","assets/file-search-ymCSYDZx.js","assets/file-spreadsheet-GRfTgOTy.js","assets/file-text-Bfv40hwh.js","assets/file-Ksu7amJn.js","assets/files-DlNPWYbd.js","assets/film-BUU7xHiL.js","assets/flask-conical-Dsv3DUqc.js","assets/fold-vertical-CN9ryhZz.js","assets/folder-closed-urrrH8hq.js","assets/folder-cog-Dph_MIqG.js","assets/folder-git-2-BNs-MyeS.js","assets/folder-git-CZrtjtbc.js","assets/folder-open-glqXjO8U.js","assets/folder-plus-hbrm_0zI.js","assets/folder-tree-DRc_6QzW.js","assets/folder-7OwzWKex.js","assets/gauge-Bn8T6vfX.js","assets/git-branch-plus-DHrV8m4V.js","assets/git-branch-fKUdZyoj.js","assets/git-commit-horizontal-BKUdfVpN.js","assets/git-fork-q7k7fP_a.js","assets/git-merge-B6FlDJ0L.js","assets/git-pull-request-arrow-C03R6MRd.js","assets/git-pull-request-closed-BmuvrrUt.js","assets/git-pull-request-draft-BiETgjOy.js","assets/globe-rqPSVFGf.js","assets/grip-vertical-CDZpgHdL.js","assets/hammer-D3FVtCT2.js","assets/hard-drive-BYq2E_is.js","assets/hat-glasses-Dr2HzrbT.js","assets/history-CdIQPf9A.js","assets/house-ClTLFcnB.js","assets/image-Dp6bFTt-.js","assets/inbox-CcvYrvdu.js","assets/info-D9JLmnlB.js","assets/key-round-POn1aRXW.js","assets/keyboard-Cwz72Cn4.js","assets/laptop-BRe6y-6m.js","assets/layers-DnKM4R7R.js","assets/lightbulb-D4c0exHI.js","assets/link-2-LC4CLD9N.js","assets/link-BG0xfm4f.js","assets/list-checks-D4Mjxs0W.js","assets/list-filter-CT2YuCdg.js","assets/list-ordered-CmlribqV.js","assets/list-todo-C9Q41q8t.js","assets/list-DFOg7UCj.js","assets/loader-circle-C9YTWe0R.js","assets/lock-open-ZMNlBvF_.js","assets/lock-CUPWkQFd.js","assets/log-in-CmJt2PGl.js","assets/mail-DH8sy4L4.js","assets/maximize-2-Ci1M4n4b.js","assets/maximize--OpXUP-L.js","assets/memory-stick-BfRByDz7.js","assets/message-circle-question-mark-B1TZAw6J.js","assets/message-circle-CHd5kZQY.js","assets/message-square-dashed-Cdozx3vh.js","assets/message-square-off-CWEe8iPZ.js","assets/message-square-text-DqZTWyZK.js","assets/message-square-warning-BNloiEzN.js","assets/message-square-HrqKYo9g.js","assets/messages-square-CNMItvyI.js","assets/minimize-2-C4_6Xjo0.js","assets/minus-BIm_k5Zx.js","assets/monitor-Dsi2qeBw.js","assets/moon-CQPzCH_B.js","assets/mouse-pointer-2-4CaeeJnC.js","assets/mouse-pointer-click-BPbYQy6n.js","assets/octagon-alert-EzAYxsw5.js","assets/package-plus-B0kbli0A.js","assets/package-DgK3Panc.js","assets/paintbrush-CRnk3l4s.js","assets/palette-oisfBZwg.js","assets/panel-bottom-_VbUQKRM.js","assets/panel-left-7a6N5kup.js","assets/panel-right-BeNqPQu9.js","assets/paperclip-D4ApErSa.js","assets/panels-top-left-DWNysJ-h.js","assets/pen-line-dPqyqyP8.js","assets/pencil-ruler-DmVfcvOi.js","assets/pencil-CkBDbGEU.js","assets/picture-in-picture-2-CM4GLcBZ.js","assets/pilcrow-D4Yvx6IY.js","assets/pin-DXnYmcqx.js","assets/play-3I2EkmKd.js","assets/plug-2-s7zj7Hxq.js","assets/plus-B2sOrZDk.js","assets/plug-YkUyuPha.js","assets/power-Bvdrcoxh.js","assets/presentation-Dzj9KqNW.js","assets/puzzle-A0RiinH5.js","assets/qr-code-DliRXqLn.js","assets/quote-BVm0cRnP.js","assets/radio-tower-DUk4f2-O.js","assets/redo-2-BJ7l6vPt.js","assets/refresh-cw-D5OcXJqv.js","assets/rotate-ccw-DpwKQVbi.js","assets/rotate-cw--ORF2bp-.js","assets/route-VA8ojaMC.js","assets/rows-3-BtaOoWPd.js","assets/scale-CFZenX_z.js","assets/search-BXnNiPfE.js","assets/send-rvnCC0tk.js","assets/server-D1-mXw9_.js","assets/settings-2-Bv4a7vuX.js","assets/settings-DSIgI7hn.js","assets/shield-check-Dp6nEC76.js","assets/shield-question-mark-Ct8sQE8L.js","assets/shield-BffxaUbT.js","assets/sliders-horizontal-Cjgfn3-e.js","assets/smartphone-D_YX6TMp.js","assets/smile-plus-CCWLDL7I.js","assets/sparkles-cGzc0RFW.js","assets/square-arrow-out-up-right-BhjBGexN.js","assets/square-pen-D43PK7SU.js","assets/square-split-horizontal-1peTt3kF.js","assets/square-split-vertical-BiyS0VO4.js","assets/square-terminal-jbiJud2S.js","assets/square-ekoTCPwL.js","assets/star-DNOgk1Yn.js","assets/sun-Doo18Rp9.js","assets/tag-COKMM2Nu.js","assets/target-DINbFNKH.js","assets/terminal-B0APSOls.js","assets/text-align-start-CwrzoVmt.js","assets/text-search-CmRPmwd0.js","assets/text-wrap-CQL7aZBn.js","assets/ticket-DOLQqHse.js","assets/trash-2-PlYko97C.js","assets/trending-down-DVeDgUDE.js","assets/trending-up-DbEIgYu9.js","assets/triangle-alert-BoPMRm-g.js","assets/type-CjUvBO4t.js","assets/undo-2-BD9xLk2R.js","assets/unfold-vertical-CldLe1hB.js","assets/unlink-2-D70rwDdQ.js","assets/unplug-BYib3V6l.js","assets/upload-Cra7ct3V.js","assets/user-check-CcyAu7dq.js","assets/user-lock--_mHRTC7.js","assets/user-plus-zMaVgV4o.js","assets/user-round-x-pYk-6fRI.js","assets/user-round-4JeqoQGO.js","assets/users-BZYEVbyz.js","assets/wifi-off-ODm5nCE4.js","assets/workflow-BefWgmas.js","assets/wrench-pR-6hpnb.js","assets/x-C35beONT.js","assets/zap-BIb9m3mg.js","assets/src-DHn7yNZx.js","assets/useRender-BP5vR6yH.js","assets/runtime-vb0YwEUc.js","assets/TooltipProvider-DQ0TF9NB.js","assets/relay-Ceq0htTl.js","assets/spinner-m1uNq_wW.js","assets/useParams-DsmZTF__.js","assets/CollapsiblePanel-CsWNZ7jo.js","assets/DiffFileTree-opfyNeFz.js","assets/useSettings-Dp27sUML.js","assets/server-Bw1ZPPkk.js","assets/session-YEQs2e4k.js","assets/use-atom-command-DkmE-pw9.js","assets/themePalette-BcMO2M90.js","assets/diffRendering-B7lkQ5_O.js","assets/index-DQKD4Lk2.js","assets/fileTreeExpansion-Bp5eLBXI.js","assets/pierre-icons-BfZ11Q2h.js","assets/query-DFSffMGJ.js","assets/DiffCommentAnnotation-eHSeIufV.js","assets/Virtualizer-B3FSTwJv.js","assets/getDiffFileInput-CKgGUEGl.js","assets/main-43D2LVmx.js","assets/vcsRefInvalidation-DU1ipBl9.js","assets/entities-JWl3bvMT.js","assets/number-field-DNna9ps3.js","assets/useRegisterFieldControl-DkFmgEzw.js","assets/FormContext-CXpUoAJn.js","assets/CSPContext-jKZ42W4p.js","assets/select-CNcZzYBl.js","assets/SelectScrollUpArrow-C40FP3vq.js","assets/usePreviousValue-Dx4Nv0v8.js","assets/link-2ZiGGBbw.js","assets/redirect-D3L17tzd.js","assets/lazyRouteComponent-BxpFJiXB.js","assets/useNavigate-P1p3Es15.js","assets/useLocation-BXwb7I1F.js","assets/rightPanelStore-AjYoRisO.js","assets/toastHelpers-DxXYm50b.js","assets/queries-BQAICaPF.js","assets/diffPanelStore-CGdPbp5I.js","assets/threadCheckpoints-DUorxvL1.js","assets/session-logic-BOQRidTa.js","assets/htmlRender-BdsR_7vV.js","assets/mediaSource-Do7lCSv7.js","assets/fileLinks-Y3tOmcmb.js","assets/mediaReference-Bh7Pydqp.js","assets/usageFormat-2913AogD.js","assets/timestampFormat-Dq7sHZpd.js","assets/env-BfPir1X4.js","assets/tooltip-BhCWnsdW.js","assets/skeleton-C6O21cqb.js","assets/useAriaLabelledBy-BiZIzNf7.js","assets/toggle-DumCe7R7.js","assets/toggle-group-CzE2mG-B.js","assets/CompositeRoot-RcqGhRAf.js","assets/input-yaZxaTds.js","assets/Input-BT2VVALp.js","assets/FieldControl-DHSVFpKc.js","assets/scroll-area-DhDCLqyU.js","assets/ScrollAreaCorner-Cn2VDisz.js","assets/dist-BvS7KgJD.js","assets/dialog-DFlZvvht.js","assets/DialogTitle-CSaaIBpP.js","assets/DialogRoot-Dg58-QOq.js","assets/dialog-styles-Df-wlHU1.js","assets/sidebar-BUDllWET.js","assets/useResizeDrag-CWrW8GV3.js","assets/relayFailureReason-DfHD60Z_.js","assets/previewMiniPlayerStore-W10VSM09.js","assets/popover-DnYfrQly.js","assets/PopoverHandle-s36xVlsK.js","assets/usePopupViewport-BBKn7x_4.js","assets/observeResize-Cz6dJUG2.js","assets/AnimatedHeight-B2j_NXft.js","assets/assets-DT0KoRIr.js","assets/sourceControl-gh0Nj17P.js","assets/assetUrls-BMizLezw.js","assets/browserHistoryStore-xnY5QhfE.js","assets/preview-Bi-hPWTp.js","assets/openFileInPreview-BaemzSTr.js","assets/keybindings-CrlWqd5q.js","assets/Icons-DpgbzNj8.js","assets/preview-Dd9kGZBH.js","assets/PierreEntryIcon-vf9Z0_eJ.js","assets/RenderErrorBoundary-4-dgp9K8.js","assets/sourceControlClients-C3cHOUoL.js","assets/browserLinkTarget-CH-4nkAf.js","assets/pullRequestIcons-DwblWS4R.js","assets/pullRequests-BSjV3BBU.js","assets/threadSort-Bd2rijEy.js","assets/ProjectFavicon-Dd4p_a9n.js","assets/ProjectMonogram-Aw_ZBtDB.js","assets/composerTrigger-BGi0iyhl.js","assets/projectFilesQueryState-Ck4wjfaq.js","assets/pullRequestDetail.logic-Dy7e4vh2.js","assets/checkbox-iFzfBLKr.js","assets/CheckboxIndicator-DFCs5GRD.js","assets/FieldItemContext-sr3mCd2v.js","assets/pullRequestReviewStore-Cc4bHb4o.js","assets/terminalSessions-CXGA3pch.js","assets/useHandleNewThread-C1YHLGL_.js","assets/p4ProjectFile-O_tvpvNW.js","assets/uiStateStore-JOwhQqDV.js","assets/EnvironmentMachineIcon-DM48TG2x.js","assets/sidebarProjectGrouping-xYoX3lLq.js","assets/alert-CfhQnxcL.js","assets/alert-dialog-Dn_PRSFU.js","assets/AlertDialogRoot-CNpt8h9w.js","assets/semver-BoU8Be_3.js","assets/ChatGptUsageButton-_JZfpkEi.js","assets/RedactedSensitiveText-bQSbv34p.js","assets/kbd-R7rkirqT.js","assets/settingsLayout-DaKDuaST.js","assets/WorkspacePageContainer-OLpcgD_f.js","assets/KeybindingsSettings.logic-oAUXQqts.js","assets/usageShortcuts-U_aRtpf7.js","assets/primaryCloudLinkState-BONYlcei.js","assets/command-BdVxwZ8D.js","assets/ComboboxClear-Cv9NZFNr.js","assets/ComboboxGroupLabel-BPe0M6wJ.js","assets/ConnectionStatusDot-DIUevPBM.js","assets/standalone-page-DrNBm39d.js","assets/primary-CDuW5QwW.js","assets/onboarding-BG6FdUUU.js","assets/scheduledTasksSettings.logic-h-rZbNI3.js","assets/main-Rpw_0nEx.css","assets/DiffWorkerPoolProvider-BwOTmWKP.js","assets/textarea-xZYMC9X5.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PullRequestCodeTab-BdXdTg-d.js","assets/react-BUfh6y28.js","assets/jsx-runtime-DJeoFXNw.js","assets/utils-DFNDxNZi.js","assets/activity-CbqMUSRC.js","assets/createLucideIcon-DDevWfFk.js","assets/Icon-DYn8279B.js","assets/alarm-clock-D3-pktbt.js","assets/app-window-DT4yrrS-.js","assets/archive-Cr7-RIjC.js","assets/arrow-down-up-CQvYrirj.js","assets/arrow-down-BKghgxKI.js","assets/arrow-left-BWI0-vRp.js","assets/arrow-right-left-DXmmhGuH.js","assets/arrow-right-BJPYbHTL.js","assets/arrow-up-down-BEa_lFuV.js","assets/arrow-up-left-DLNjxPfK.js","assets/arrow-up-right-B8xNcEXp.js","assets/arrow-up-DMEbfkKl.js","assets/battery-BNMPLne0.js","assets/bell-vGxw63Gg.js","assets/blocks-CpHzQlR2.js","assets/book-open-DKRWS47i.js","assets/bookmark-DfPbwgkW.js","assets/bot-Cp92syL6.js","assets/box-D-FyjNxy.js","assets/bug-DH2pu6U9.js","assets/calendar-arrow-down-WH0xj289.js","assets/calendar-arrow-up-Lk-Us3ba.js","assets/calendar-clock-BARV5L0a.js","assets/calendar-DHdDnhKF.js","assets/camera-8ozLiwCj.js","assets/chart-no-axes-column-CQLqBsxb.js","assets/check-CdrGo1Oa.js","assets/chevron-down-D0M7_175.js","assets/chevron-left-CEWOKn-e.js","assets/chevron-right-DPl-L-yL.js","assets/chevron-up-gyDnPot_.js","assets/chevrons-left-right-ellipsis-DEfsDjXt.js","assets/chevrons-up-down-DakHVkrx.js","assets/chromium-x91nZeen.js","assets/circle-alert-DsKXULDS.js","assets/circle-arrow-up-DCmGv6Tl.js","assets/circle-check-CZ31KO9m.js","assets/circle-dashed-DMw11mBM.js","assets/circle-dot-CWCBN-HY.js","assets/circle-slash-eIt5hG5T.js","assets/circle-stop-0Wd2uKSK.js","assets/circle-x-DMkHWcTz.js","assets/circle-Doq0I3MA.js","assets/clock-3-C5l2rPxd.js","assets/clock-aK6BX5Ve.js","assets/cloud-download-Ddj2y2Q1.js","assets/cloud-upload-BzCXws1i.js","assets/cloud-BhcSs4Ie.js","assets/code-xml-DsmxIkJL.js","assets/code-Dfd-vS1O.js","assets/columns-2-CgvyvCTB.js","assets/copy-CO2RgESU.js","assets/corner-left-up-DUJ8nnVp.js","assets/corner-up-right-xmYx6v5O.js","assets/cpu-DBknwmfd.js","assets/database-D2y6m7fG.js","assets/download-S2u-tXaE.js","assets/earth-CDbKfFEl.js","assets/ellipsis-vertical-CY0vJAc8.js","assets/ellipsis-Zza4fevQ.js","assets/external-link-D1GSnnDW.js","assets/eye-off-CH68-9dO.js","assets/eye-C3U51ndb.js","assets/file-braces-BzATadbM.js","assets/file-code-corner-eTofF8xM.js","assets/file-diff-CNp_vbEN.js","assets/file-search-ymCSYDZx.js","assets/file-spreadsheet-GRfTgOTy.js","assets/file-text-Bfv40hwh.js","assets/file-Ksu7amJn.js","assets/files-DlNPWYbd.js","assets/film-BUU7xHiL.js","assets/flask-conical-Dsv3DUqc.js","assets/fold-vertical-CN9ryhZz.js","assets/folder-closed-urrrH8hq.js","assets/folder-cog-Dph_MIqG.js","assets/folder-git-2-BNs-MyeS.js","assets/folder-git-CZrtjtbc.js","assets/folder-open-glqXjO8U.js","assets/folder-plus-hbrm_0zI.js","assets/folder-tree-DRc_6QzW.js","assets/folder-7OwzWKex.js","assets/gauge-Bn8T6vfX.js","assets/git-branch-plus-DHrV8m4V.js","assets/git-branch-fKUdZyoj.js","assets/git-commit-horizontal-BKUdfVpN.js","assets/git-fork-q7k7fP_a.js","assets/git-merge-B6FlDJ0L.js","assets/git-pull-request-arrow-C03R6MRd.js","assets/git-pull-request-closed-BmuvrrUt.js","assets/git-pull-request-draft-BiETgjOy.js","assets/globe-rqPSVFGf.js","assets/grip-vertical-CDZpgHdL.js","assets/hammer-D3FVtCT2.js","assets/hard-drive-BYq2E_is.js","assets/hat-glasses-Dr2HzrbT.js","assets/history-CdIQPf9A.js","assets/house-ClTLFcnB.js","assets/image-Dp6bFTt-.js","assets/inbox-CcvYrvdu.js","assets/info-D9JLmnlB.js","assets/key-round-POn1aRXW.js","assets/keyboard-Cwz72Cn4.js","assets/laptop-BRe6y-6m.js","assets/layers-DnKM4R7R.js","assets/lightbulb-D4c0exHI.js","assets/link-2-LC4CLD9N.js","assets/link-BG0xfm4f.js","assets/list-checks-D4Mjxs0W.js","assets/list-filter-CT2YuCdg.js","assets/list-ordered-CmlribqV.js","assets/list-todo-C9Q41q8t.js","assets/list-DFOg7UCj.js","assets/loader-circle-C9YTWe0R.js","assets/lock-open-ZMNlBvF_.js","assets/lock-CUPWkQFd.js","assets/log-in-CmJt2PGl.js","assets/mail-DH8sy4L4.js","assets/maximize-2-Ci1M4n4b.js","assets/maximize--OpXUP-L.js","assets/memory-stick-BfRByDz7.js","assets/message-circle-question-mark-B1TZAw6J.js","assets/message-circle-CHd5kZQY.js","assets/message-square-dashed-Cdozx3vh.js","assets/message-square-off-CWEe8iPZ.js","assets/message-square-text-DqZTWyZK.js","assets/message-square-warning-BNloiEzN.js","assets/message-square-HrqKYo9g.js","assets/messages-square-CNMItvyI.js","assets/minimize-2-C4_6Xjo0.js","assets/minus-BIm_k5Zx.js","assets/monitor-Dsi2qeBw.js","assets/moon-CQPzCH_B.js","assets/mouse-pointer-2-4CaeeJnC.js","assets/mouse-pointer-click-BPbYQy6n.js","assets/octagon-alert-EzAYxsw5.js","assets/package-plus-B0kbli0A.js","assets/package-DgK3Panc.js","assets/paintbrush-CRnk3l4s.js","assets/palette-oisfBZwg.js","assets/panel-bottom-_VbUQKRM.js","assets/panel-left-7a6N5kup.js","assets/panel-right-BeNqPQu9.js","assets/paperclip-D4ApErSa.js","assets/panels-top-left-DWNysJ-h.js","assets/pen-line-dPqyqyP8.js","assets/pencil-ruler-DmVfcvOi.js","assets/pencil-CkBDbGEU.js","assets/picture-in-picture-2-CM4GLcBZ.js","assets/pilcrow-D4Yvx6IY.js","assets/pin-DXnYmcqx.js","assets/play-3I2EkmKd.js","assets/plug-2-s7zj7Hxq.js","assets/plus-B2sOrZDk.js","assets/plug-YkUyuPha.js","assets/power-Bvdrcoxh.js","assets/presentation-Dzj9KqNW.js","assets/puzzle-A0RiinH5.js","assets/qr-code-DliRXqLn.js","assets/quote-BVm0cRnP.js","assets/radio-tower-DUk4f2-O.js","assets/redo-2-BJ7l6vPt.js","assets/refresh-cw-D5OcXJqv.js","assets/rotate-ccw-DpwKQVbi.js","assets/rotate-cw--ORF2bp-.js","assets/route-VA8ojaMC.js","assets/rows-3-BtaOoWPd.js","assets/scale-CFZenX_z.js","assets/search-BXnNiPfE.js","assets/send-rvnCC0tk.js","assets/server-D1-mXw9_.js","assets/settings-2-Bv4a7vuX.js","assets/settings-DSIgI7hn.js","assets/shield-check-Dp6nEC76.js","assets/shield-question-mark-Ct8sQE8L.js","assets/shield-BffxaUbT.js","assets/sliders-horizontal-Cjgfn3-e.js","assets/smartphone-D_YX6TMp.js","assets/smile-plus-CCWLDL7I.js","assets/sparkles-cGzc0RFW.js","assets/square-arrow-out-up-right-BhjBGexN.js","assets/square-pen-D43PK7SU.js","assets/square-split-horizontal-1peTt3kF.js","assets/square-split-vertical-BiyS0VO4.js","assets/square-terminal-jbiJud2S.js","assets/square-ekoTCPwL.js","assets/star-DNOgk1Yn.js","assets/sun-Doo18Rp9.js","assets/tag-COKMM2Nu.js","assets/target-DINbFNKH.js","assets/terminal-B0APSOls.js","assets/text-align-start-CwrzoVmt.js","assets/text-search-CmRPmwd0.js","assets/text-wrap-CQL7aZBn.js","assets/ticket-DOLQqHse.js","assets/trash-2-PlYko97C.js","assets/trending-down-DVeDgUDE.js","assets/trending-up-DbEIgYu9.js","assets/triangle-alert-BoPMRm-g.js","assets/type-CjUvBO4t.js","assets/undo-2-BD9xLk2R.js","assets/unfold-vertical-CldLe1hB.js","assets/unlink-2-D70rwDdQ.js","assets/unplug-BYib3V6l.js","assets/upload-Cra7ct3V.js","assets/user-check-CcyAu7dq.js","assets/user-lock--_mHRTC7.js","assets/user-plus-zMaVgV4o.js","assets/user-round-x-pYk-6fRI.js","assets/user-round-4JeqoQGO.js","assets/users-BZYEVbyz.js","assets/wifi-off-ODm5nCE4.js","assets/workflow-BefWgmas.js","assets/wrench-pR-6hpnb.js","assets/x-C35beONT.js","assets/zap-BIb9m3mg.js","assets/src-BVovWpja.js","assets/useRender-BP5vR6yH.js","assets/runtime-DIAcbMTc.js","assets/TooltipProvider-BH5ni_Lo.js","assets/relay-YiJpGyaO.js","assets/spinner-7CSKKESP.js","assets/useParams-BeJIRxxE.js","assets/CollapsiblePanel-C1iRr4kZ.js","assets/DiffFileTree-B6AgzOXX.js","assets/useSettings-BWMcQzC-.js","assets/server-BNjk2K1j.js","assets/session-DMNo4Bh3.js","assets/use-atom-command-C4Tyb1VL.js","assets/themePalette-C7ZOgucT.js","assets/diffRendering-cyTQV5bk.js","assets/index-C04a0SKq.js","assets/fileTreeExpansion-D5nN-Oqd.js","assets/pierre-icons-fv1goMS6.js","assets/query-Bw8YoCbO.js","assets/DiffCommentAnnotation-ChKqFxt5.js","assets/Virtualizer-DLB0FYm-.js","assets/getDiffFileInput-4gToQuSl.js","assets/main-BFdCLmkY.js","assets/vcsRefInvalidation-CV8dYgi0.js","assets/entities-HOBDIiHK.js","assets/number-field-CALZZPio.js","assets/useRegisterFieldControl-B72Afmil.js","assets/FormContext-CXpUoAJn.js","assets/CSPContext-jKZ42W4p.js","assets/select-CxYi0YMi.js","assets/SelectScrollUpArrow-BE0-tVtP.js","assets/usePreviousValue-Dx4Nv0v8.js","assets/link-D1nkgCv7.js","assets/redirect-D3L17tzd.js","assets/lazyRouteComponent-DLamKhHF.js","assets/useNavigate-DVrOlf8m.js","assets/useLocation-CIvcNoeU.js","assets/rightPanelStore-BF1zmmXM.js","assets/toastHelpers-DxXYm50b.js","assets/queries-DNRXml7d.js","assets/diffPanelStore-CxnPNigi.js","assets/threadCheckpoints-DjIk4Kvg.js","assets/session-logic-CELyWJ1v.js","assets/htmlRender-CUGVJXGf.js","assets/mediaSource-DfsR3T70.js","assets/fileLinks-BlT4My6t.js","assets/mediaReference-D19Dzoh3.js","assets/usageFormat-DcON9Kz_.js","assets/timestampFormat-Dq7sHZpd.js","assets/env-BfPir1X4.js","assets/tooltip-CGvxq8k3.js","assets/skeleton-0IEb3e4e.js","assets/useAriaLabelledBy-CcwjH1QH.js","assets/toggle-4vFx94TS.js","assets/toggle-group-d6H735Xi.js","assets/CompositeRoot-B1DTZCNU.js","assets/input-DxHa9qj5.js","assets/Input-Gb8KV9DV.js","assets/FieldControl-CkgERQaU.js","assets/scroll-area-CokPD3-i.js","assets/ScrollAreaCorner-CfTQYjCW.js","assets/dist-J7s-H61h.js","assets/dialog-CrLVN_m6.js","assets/DialogTitle-CYefNdHm.js","assets/DialogRoot-D64NsaiW.js","assets/dialog-styles-Df-wlHU1.js","assets/sidebar-ovj9EiR4.js","assets/useResizeDrag-CWrW8GV3.js","assets/relayFailureReason-Baxcpnas.js","assets/previewMiniPlayerStore-CEd7VI6J.js","assets/popover-DxCAIK62.js","assets/PopoverHandle-BgggGdpn.js","assets/usePopupViewport-OR_PF2s-.js","assets/observeResize-DLmefMqO.js","assets/AnimatedHeight-Dwarin_V.js","assets/assets-C3_UZib9.js","assets/sourceControl-CPobWWHq.js","assets/assetUrls-Dq0gsqWs.js","assets/browserHistoryStore-CVCo7qfb.js","assets/preview-x1tmlUez.js","assets/openFileInPreview-BCGQQ_Ia.js","assets/keybindings-8_1sqf8s.js","assets/Icons-BUrn1Fzo.js","assets/preview-Ce5ECOHv.js","assets/PierreEntryIcon-D29_Ylm_.js","assets/RenderErrorBoundary-56lc2IQ3.js","assets/sourceControlClients-4PlkytxQ.js","assets/browserLinkTarget-CopcRHna.js","assets/pullRequestIcons-D8rnFTkk.js","assets/pullRequests-euX1Ch2G.js","assets/threadSort-Bd2rijEy.js","assets/ProjectFavicon-DFI1NI3D.js","assets/ProjectMonogram-D4xxVtw8.js","assets/composerTrigger-BGi0iyhl.js","assets/projectFilesQueryState-DKw9S3nn.js","assets/pullRequestDetail.logic-Dm3mx1US.js","assets/checkbox-CxRqp4sO.js","assets/CheckboxIndicator-DbA95VlZ.js","assets/FieldItemContext-sr3mCd2v.js","assets/pullRequestReviewStore-C45fih_P.js","assets/terminalSessions-EUiRWJti.js","assets/useHandleNewThread-Qb_yy6KY.js","assets/p4ProjectFile-DCNJ4pTp.js","assets/uiStateStore-MbQdhAPp.js","assets/EnvironmentMachineIcon-CJ30kzSK.js","assets/sidebarProjectGrouping-DT6LCDEX.js","assets/alert-D1O9oex3.js","assets/alert-dialog-3XDceRWv.js","assets/AlertDialogRoot-CimqRgXh.js","assets/semver-BoU8Be_3.js","assets/ChatGptUsageButton-D6Iy8SVv.js","assets/RedactedSensitiveText-DhV2Jdu8.js","assets/kbd-DjUfNaix.js","assets/settingsLayout-CzGbLP4v.js","assets/WorkspacePageContainer-D2rx9iDg.js","assets/KeybindingsSettings.logic-CMs7OPcH.js","assets/usageShortcuts-B_o9XxKX.js","assets/primaryCloudLinkState-TS0IW37f.js","assets/command-4bqVdX0m.js","assets/ComboboxClear-DaifQLU5.js","assets/ComboboxGroupLabel-C03JGZRD.js","assets/ConnectionStatusDot-CCTiSlHA.js","assets/standalone-page-DrNBm39d.js","assets/primary-DcnaBKM0.js","assets/onboarding-plATuZco.js","assets/scheduledTasksSettings.logic-BOrkdeD3.js","assets/main-BQBpA03z.css","assets/DiffWorkerPoolProvider-CK3y5UA1.js","assets/textarea-DMmmmGA1.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./index-C04a0SKq.js";import{n as r,t as i}from"./jsx-runtime-DJeoFXNw.js";import{$l as a,$n as o,A as s,Al as c,Bl as l,D as u,Dd as d,Ea as f,F as p,Hf as m,Id as h,Jd as g,Jo as _,Js as v,Ld as y,Ml as b,Ol as x,Os as S,Pf as C,Qn as w,Ru as T,Sf as E,Su as D,Ud as O,Vd as k,Vu as A,Wo as j,Xn as M,Ys as N,Zd as P,Zf as F,Zn as I,_l as L,af as R,al as z,ap as B,ar as V,au as ee,bf as H,cr as U,du as te,ep as ne,er as re,ff as ie,fr as ae,gd as oe,gu as se,hd as ce,hr as le,ip as ue,ir as de,jf as fe,jl as pe,ju as me,kl as he,ku as ge,lu as _e,mr as W,of as ve,ol as ye,op as be,ou as xe,pl as Se,rd as Ce,rr as we,sl as Te,sr as Ee,su as De,t as G,td as Oe,tr as ke,uu as Ae,vd as je,xf as Me,zd as Ne,zf as Pe}from"./utils-DFNDxNZi.js";import{Ec as Fe,Nr as Ie,U as Le,qc as Re,ra as ze,ua as Be}from"./src-BVovWpja.js";import{Ar as Ve,Jn as He,Kn as Ue,Rn as We,Un as Ge,Xn as Ke,qn as qe}from"./runtime-DIAcbMTc.js";import{C as Je,O as Ye,k as Xe,w as Ze}from"./entities-HOBDIiHK.js";import{F as Qe,H as $e,I as et,J as tt,S as nt,b as rt,q as it,u as at,v as ot}from"./TooltipProvider-BH5ni_Lo.js";import{F as st,P as ct,n as lt,q as ut}from"./ChatMarkdown-DHhJpg3q.js";import{a as dt,o as ft,s as pt,t as mt}from"./select-CxYi0YMi.js";import{t as ht}from"./spinner-7CSKKESP.js";import{a as gt,h as _t,m as vt}from"./relay-YiJpGyaO.js";import{D as yt,J as bt,K as xt,f as St}from"./useSettings-BWMcQzC-.js";import{s as Ct}from"./server-BNjk2K1j.js";import{i as wt,n as Tt}from"./session-DMNo4Bh3.js";import{n as Et}from"./query-Bw8YoCbO.js";import{t as Dt}from"./use-atom-command-C4Tyb1VL.js";import{t as Ot,u as kt}from"./rightPanelStore-BF1zmmXM.js";import{f as At}from"./queries-DNRXml7d.js";import{C as jt,Q as Mt,Z as Nt,_ as K,at as Pt,c as Ft,d as It,ft as Lt,l as Rt,lt as zt,nt as Bt,ot as Vt,s as Ht,t as Ut,tt as Wt,u as Gt,v as Kt,w as qt}from"./diffRendering-cyTQV5bk.js";import{C as Jt,E as Yt,G as Xt,H as Zt,K as Qt,U as $t,V as en,W as tn,d as nn,i as rn,u as an}from"./Virtualizer-DLB0FYm-.js";import{l as on,ut as sn}from"./getDiffFileInput-4gToQuSl.js";import{i as cn,r as ln,t as un}from"./DiffWorkerPoolProvider-CK3y5UA1.js";import{t as dn}from"./cloneFileDiffMetadata-zVRGqYgv.js";import{n as fn,r as pn,t as mn}from"./FileDiff-BLuBewdN.js";import{S as hn,a as gn,b as _n,i as vn,n as yn,r as bn,t as xn}from"./DiffCommentAnnotation-ChKqFxt5.js";import{r as Sn}from"./mediaSource-DfsR3T70.js";import{o as Cn}from"./timestampFormat-Dq7sHZpd.js";import{t as wn}from"./env-BfPir1X4.js";import{a as q,n as J,r as Tn,t as Y}from"./tooltip-CGvxq8k3.js";import{t as En}from"./skeleton-0IEb3e4e.js";import{t as Dn}from"./textarea-DMmmmGA1.js";import{t as On}from"./toggle-4vFx94TS.js";import{n as kn,t as An}from"./toggle-group-d6H735Xi.js";import{i as jn,l as Mn,o as Nn,r as Pn,s as Fn,t as In}from"./combobox-CuyUAuiC.js";import{t as Ln}from"./input-DxHa9qj5.js";import{t as Rn}from"./scroll-area-CokPD3-i.js";import{a as zn,c as Bn,i as Vn,o as Hn,r as Un,s as Wn,t as Gn}from"./dialog-CrLVN_m6.js";import{a as Kn,i as qn,o as Jn,r as Yn,t as Xn}from"./empty-YMXgQbNI.js";import{i as Zn}from"./device-H2MyT_kA.js";import{a as Qn,i as $n,n as er,o as tr,t as nr}from"./popover-DxCAIK62.js";import{t as rr}from"./observeResize-DLmefMqO.js";import{n as ir,r as ar,t as or}from"./RightPanelResizeHandle-ClzdYxWw.js";import{n as sr,t as cr}from"./assetUrls-Dq0gsqWs.js";import{f as lr}from"./browserHistoryStore-CVCo7qfb.js";import{M as ur,_ as dr,y as fr}from"./keybindings-8_1sqf8s.js";import{i as pr,n as mr}from"./Icons-BUrn1Fzo.js";import{t as hr}from"./PierreEntryIcon-D29_Ylm_.js";import{C as gr,E as _r,S as vr,T as yr,_ as br,a as xr,b as Sr,c as Cr,d as wr,g as Tr,h as Er,l as Dr,m as Or,mt as kr,o as Ar,ot as jr,p as Mr,pt as Nr,s as Pr,u as Fr,v as Ir,w as Lr,x as Rr,y as zr}from"./RenderErrorBoundary-56lc2IQ3.js";import{n as Br,r as Vr}from"./sourceControlClients-4PlkytxQ.js";import{n as X}from"./pullRequestIcons-D8rnFTkk.js";import{A as Hr,O as Ur,a as Wr,c as Gr,i as Kr,n as qr,r as Jr,u as Yr}from"./pullRequests-euX1Ch2G.js";import{A as Xr,B as Zr,C as Qr,D as $r,E as ei,F as ti,H as ni,I as ri,K as ii,L as ai,M as oi,N as si,O as ci,R as li,S as ui,T as di,V as fi,W as pi,_ as mi,a as hi,c as gi,f as _i,j as vi,k as yi,l as bi,m as xi,o as Si,p as Ci,q as wi,r as Ti,s as Ei,t as Di,u as Oi,v as ki,w as Ai,x as ji,y as Mi,z as Ni}from"./pullRequestDetail.logic-Dm3mx1US.js";import{i as Pi,n as Fi,r as Ii,t as Li}from"./pullRequestReviewStore-C45fih_P.js";import{t as Ri}from"./terminalLabels-BgLOlb2G.js";import{n as zi}from"./useHandleNewThread-Qb_yy6KY.js";import{i as Bi}from"./uiStateStore-MbQdhAPp.js";import{n as Vi}from"./EnvironmentMachineIcon-CJ30kzSK.js";import{i as Hi,n as Ui,r as Wi,t as Gi}from"./alert-D1O9oex3.js";import{t as Ki}from"./kbd-DjUfNaix.js";import{d as qi,l as Ji,t as Yi,u as Xi}from"./command-4bqVdX0m.js";import{Ai as Zi,Ao as Qi,Bi as $i,Do as ea,Eo as ta,Gi as na,Hi as ra,Ii as ia,Ki as aa,Oo as oa,Pi as sa,Ri as ca,Ui as la,Wi as ua,b as da,eo as fa,gi as pa,hi as ma,ji as ha,no as ga,v as _a,vn as va,x as ya,y as ba,zo as xa}from"./main-BFdCLmkY.js";import"./WorkspacePageHeader-D8-RIRjQ.js";import{a as Sa,c as Ca,r as wa,t as Ta}from"./usePullRequestActions-B_Nrg846.js";function Ea(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Da(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:Oa(e.items,t.items)}function Oa(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 ka(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(Mt,``),t.before(r)):(r.setAttribute(Nt,``),t.after(r)),n?.observe(r),r}function Aa(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var ja=1e5,Ma=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,Na=`data-diffs-search`,Pa=`:host {
|
|
3
3
|
display: block;
|
|
4
4
|
position: sticky;
|
|
5
5
|
z-index: 100;
|
|
@@ -201,10 +201,10 @@ import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./index-DQKD4Lk2.js
|
|
|
201
201
|
transition: none;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
`;function Ko(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?`${Go}\n${a}`:Go,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)(un,{children:(0,$.jsx)(Io,{...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 qo(e,t){return async n=>{let r=Gt(n),i=n.prevName?Gt({...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 Jo(e,t){return qo(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 He(a);return a.value},t.cacheKey)}function Yo(e,t){return qo(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 He(a);return a.value},t.cacheKey)}var Xo=`p4code:preview-panel-width`,Zo=360,Qo=.7,$o=360,es=540;function ts(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=ns(e,i.enabled??!0,i.container),o=i.widthStorageKey??Xo,s=i.defaultWidth??es,c;return n[2]!==a||n[3]!==o||n[4]!==s?(c={storageKey:o,defaultWidth:s,minWidth:Zo,maxWidth:a,edge:`left`},n[2]=a,n[3]=o,n[4]=s,n[5]=c):c=n[5],ar(c)}function ns(e,t,n){let r=(0,Q.c)(5),[i,a]=(0,Z.useState)(rs),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(is(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 rs(){return is(typeof window>`u`?1280:window.innerWidth)}function is(e,t){let n=Math.floor(e*Qo),r=t===void 0?1/0:Math.floor(t)-$o;return Math.max(Zo,Math.min(n,r))}function as(e){let t=(0,Q.c)(4);if(e.inlineSize){let n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(ss,{...e,inlineSize:e.inlineSize}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,$.jsx)(os,{...e}),t[2]=e,t[3]=n),n}function os(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=ts(n,i),o;return t[4]!==a||t[5]!==e?(o=(0,$.jsx)(ss,{...e,inlineSize:a,hostRef:n}),t[4]=a,t[5]=e,t[6]=o):o=t[6],o}function ss(e){let t=(0,Q.c)(43);wn&&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(cs)})});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?{[ir]:`${c}px`,width:a?`100%`:r&&!i?`0px`:`var(${ir})`,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)(or,{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(${ir}) - 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 cs(e){return{...e,suppressed:!1}}function ls(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 us(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(ds),n=fs,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 ds(e){return!!e}function fs(e){let t=(0,Q.c)(11),[n,r]=(0,Z.useState)(ps),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 ps(){return new Set}function ms(e){let t=(0,Q.c)(12),n=fa(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)(ls,{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)(us,{sources:o,fallback:a,className:s}),t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function hs(e,t){return e==null||t==null?!1:e.trim().toLowerCase()===t.trim().toLowerCase()}function gs(e){return e.capabilities.edit?.changeRequest===!0?e.viewerPermissions.editChangeRequest===void 0?hs(e.viewer,e.author?.login)||e.viewerPermissions.actions.includes(`merge`):e.viewerPermissions.editChangeRequest:!1}function _s(e,t){return e.capabilities.edit?.comment!==!0||t.kind!==`issue-comment`&&t.kind!==`review-comment`?!1:t.canEdit===void 0?hs(e.viewer,t.author?.login):t.canEdit}function vs(e,t){return e.viewerPermissions.resolve&&t.canResolve!==!1}function ys(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)(O,{"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}var bs=/^\s{0,3}((?:`{3,})|(?:~{3,}))(.*)\r?$/u,xs=8,Ss=/^(?: {4}|\t)/u,Cs=/^<?(https?:\/\/\S+?)>?$/u,ws=/\.(?:png|jpe?g|gif|webp|avif|heic|heif|svg)(?:$|[?#])/iu,Ts=/^\[[^\]]*\]\((https?:\/\/[^\s)]+)\)$/u,Es=/\.(?:mp4|webm|mov|m4v|ogv)(?:$|[?#])/iu,Ds=/^https:\/\/github\.com\/user-attachments\/assets\/[\w-]+$/iu,Os=/<(?:video|source)\b[^>]*\bsrc\s*=\s*["']([^"']+)["']/iu,ks=/^\s*<video\b/iu,As=/<\/video>\s*$/iu;function js(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function Ms(e){let t=Cs.exec(e.trim())?.[1]??Ts.exec(e.trim())?.[1];return t===void 0||!js(t)?null:Es.test(t)||Ds.test(t)?{url:t,media:`video`}:ws.test(t)?{url:t,media:`image`}:null}function Ns(e){let t=[],n=[],r=null,i=()=>{let e=n.join(`
|
|
204
|
+
`;function Ko(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?`${Go}\n${a}`:Go,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)(un,{children:(0,$.jsx)(Io,{...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 qo(e,t){return async n=>{let r=Gt(n),i=n.prevName?Gt({...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 Jo(e,t){return qo(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 Ve(a);return a.value},t.cacheKey)}function Yo(e,t){return qo(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 Ve(a);return a.value},t.cacheKey)}var Xo=`p4code:preview-panel-width`,Zo=360,Qo=.7,$o=360,es=540;function ts(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=ns(e,i.enabled??!0,i.container),o=i.widthStorageKey??Xo,s=i.defaultWidth??es,c;return n[2]!==a||n[3]!==o||n[4]!==s?(c={storageKey:o,defaultWidth:s,minWidth:Zo,maxWidth:a,edge:`left`},n[2]=a,n[3]=o,n[4]=s,n[5]=c):c=n[5],ar(c)}function ns(e,t,n){let r=(0,Q.c)(5),[i,a]=(0,Z.useState)(rs),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(is(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 rs(){return is(typeof window>`u`?1280:window.innerWidth)}function is(e,t){let n=Math.floor(e*Qo),r=t===void 0?1/0:Math.floor(t)-$o;return Math.max(Zo,Math.min(n,r))}function as(e){let t=(0,Q.c)(4);if(e.inlineSize){let n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(ss,{...e,inlineSize:e.inlineSize}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,$.jsx)(os,{...e}),t[2]=e,t[3]=n),n}function os(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=ts(n,i),o;return t[4]!==a||t[5]!==e?(o=(0,$.jsx)(ss,{...e,inlineSize:a,hostRef:n}),t[4]=a,t[5]=e,t[6]=o):o=t[6],o}function ss(e){let t=(0,Q.c)(43);wn&&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(cs)})});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?{[ir]:`${c}px`,width:a?`100%`:r&&!i?`0px`:`var(${ir})`,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)(or,{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(${ir}) - 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 cs(e){return{...e,suppressed:!1}}function ls(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 us(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(ds),n=fs,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 ds(e){return!!e}function fs(e){let t=(0,Q.c)(11),[n,r]=(0,Z.useState)(ps),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 ps(){return new Set}function ms(e){let t=(0,Q.c)(12),n=fa(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)(ls,{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)(us,{sources:o,fallback:a,className:s}),t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function hs(e,t){return e==null||t==null?!1:e.trim().toLowerCase()===t.trim().toLowerCase()}function gs(e){return e.capabilities.edit?.changeRequest===!0?e.viewerPermissions.editChangeRequest===void 0?hs(e.viewer,e.author?.login)||e.viewerPermissions.actions.includes(`merge`):e.viewerPermissions.editChangeRequest:!1}function _s(e,t){return e.capabilities.edit?.comment!==!0||t.kind!==`issue-comment`&&t.kind!==`review-comment`?!1:t.canEdit===void 0?hs(e.viewer,t.author?.login):t.canEdit}function vs(e,t){return e.viewerPermissions.resolve&&t.canResolve!==!1}function ys(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)(O,{"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}var bs=/^\s{0,3}((?:`{3,})|(?:~{3,}))(.*)\r?$/u,xs=8,Ss=/^(?: {4}|\t)/u,Cs=/^<?(https?:\/\/\S+?)>?$/u,ws=/\.(?:png|jpe?g|gif|webp|avif|heic|heif|svg)(?:$|[?#])/iu,Ts=/^\[[^\]]*\]\((https?:\/\/[^\s)]+)\)$/u,Es=/\.(?:mp4|webm|mov|m4v|ogv)(?:$|[?#])/iu,Ds=/^https:\/\/github\.com\/user-attachments\/assets\/[\w-]+$/iu,Os=/<(?:video|source)\b[^>]*\bsrc\s*=\s*["']([^"']+)["']/iu,ks=/^\s*<video\b/iu,As=/<\/video>\s*$/iu;function js(e){try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`}catch{return!1}}function Ms(e){let t=Cs.exec(e.trim())?.[1]??Ts.exec(e.trim())?.[1];return t===void 0||!js(t)?null:Es.test(t)||Ds.test(t)?{url:t,media:`video`}:ws.test(t)?{url:t,media:`image`}:null}function Ns(e){let t=[],n=[],r=null,i=()=>{let e=n.join(`
|
|
205
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
206
|
`);for(let e=0;e<a.length;e+=1){let o=a[e],s=bs.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||Ss.test(o)){n.push(o);continue}let c=Ms(o);if(c!==null){i(),t.push({id:`attachment:${t.length}`,kind:`attachment`,...c});continue}if(!ks.test(o)){n.push(o);continue}let l=Math.min(e+xs,a.length)-1,u=e;for(;u<l&&!As.test(a[u]);)u+=1;let d=As.test(a[u])?Os.exec(a.slice(e,u+1).join(`
|
|
207
|
-
`))?.[1]:void 0;d!==void 0&&js(d)?(i(),t.push({id:`attachment:${t.length}`,kind:`attachment`,url:d,media:`video`}),e=u):n.push(o)}return i(),t}function Ps(e,t){if(!/^\/(?![/\\])/u.test(e))return e;try{return new URL(e,t).href}catch{return e}}function Fs(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 Is=/#[1-9]\d*|[0-9a-f]{40}/giu,Ls=/[A-Za-z0-9_]/u,Rs=/[\s([{]/u,zs=new Set([`link`,`linkReference`]);function Bs(e){let t=e.repositoryUrl.replace(/\/+$/u,``);return e=>{Fs(e,Is,(e,n)=>{let r=e.startsWith(`#`),i=n.input[n.index-1],a=n.input[n.index+e.length];return i!==void 0&&(r?Ls.test(i):!Rs.test(i))||a!==void 0&&Ls.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)}]}},zs)}}function Vs(e){let t=n=>{(n.type===`image`||n.type===`definition`)&&n.url!==void 0&&(n.url=Ps(n.url,e.changeRequestUrl)),n.children?.forEach(t)};return e=>t(e)}var Hs=[],Us=new Map;function Ws(e){if(!e)return Hs;let t=Us.get(e);return t||(t=[[Vs,{changeRequestUrl:e}],[Bs,{repositoryUrl:e}]],Us.set(e,t)),t}var Gs=(0,Z.createContext)(null);function Ks(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=sr(n,s),l=cr(n,s),u=c._tag===`Success`?c.url:c._tag===`Failure`?a:null,d=u===null?null:u+Sn(i),f;return t[3]!==l||t[4]!==d||t[5]!==i?(f=(0,$.jsx)(ct,{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 qs(e){let t=(0,Q.c)(12),{text:n,cwd:r,environmentId:i,threadRef:a,className:o}=e,s=Ns(n),c=(0,Z.useContext)(Gs),l=c?.repositoryUrl,u=a??c?.threadRef??void 0,d=l??null,f;t[0]===d?f=t[1]:(f=Ws(d),t[0]=d,t[1]=f);let p=f,m;t[2]===o?m=t[3]:(m=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]=m);let h;t[4]!==r||t[5]!==i||t[6]!==p||t[7]!==u?(h=e=>{if(e.kind===`markdown`||e.media===`image`)return(0,$.jsx)(ut,{text:e.kind===`markdown`?e.text:``,cwd:r,threadRef:u,pullRequestPanelRef:u??Ot,environmentId:i,extraRemarkPlugins:p,githubMedia:!0},e.id);let t=e.media===`video`?lt(e.url):null;return t===null?e.media===`video`?(0,$.jsx)(ct,{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)(k,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Open attachment on GitHub`}),(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-3 shrink-0 text-muted-foreground`})]},e.id):(0,$.jsx)(Ks,{environmentId:i,cwd:r,url:e.url,fetchUrl:t},`${e.id}:${e.url}`)},t[4]=r,t[5]=i,t[6]=p,t[7]=u,t[8]=h):h=t[8];let g=s.map(h),_;return t[9]!==m||t[10]!==g?(_=(0,$.jsx)(`div`,{className:m,"data-image-gallery":!0,children:g}),t[9]=m,t[10]=g,t[11]=_):_=t[11],_}function Js(e){let t=(0,Q.c)(52),{value:n,cwd:r,environmentId:i,threadRef:a,placeholder:o,label:s,saving:c,allowEmpty:l,className:u,onSave:d,onCancel:f}=e,p=a===void 0?null:a,m=l!==void 0&&l,h=wt(i,Be),[g,_]=(0,Z.useState)(n),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(n);b!==n&&(x(n),_(n));let S;t[0]===g?S=t[1]:(S=g.trim(),t[0]=g,t[1]=S);let C=S.length===0,w=!h||c||C&&!m,T;t[2]===u?T=t[3]:(T=G(`space-y-2`,u),t[2]=u,t[3]=T);let E;t[4]!==g||t[5]!==i||t[6]!==f||t[7]!==d||t[8]!==w||t[9]!==c?(E=e=>{e.nativeEvent.isComposing||e.keyCode===229||(e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey?(e.preventDefault(),e.stopPropagation(),!w&&!e.repeat&&Tt(i,`source-control:write`)&&d(g)):e.key!==`Escape`||c||(e.preventDefault(),f()))},t[4]=g,t[5]=i,t[6]=f,t[7]=d,t[8]=w,t[9]=c,t[10]=E):E=t[10];let D=v?`preview`:`write`,O;t[11]===D?O=t[12]:(O=[D],t[11]=D,t[12]=O);let k,A,j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=e[0];(t===`write`||t===`preview`)&&y(t===`preview`)},j=(0,$.jsx)(An,{value:`write`,children:`Write`}),k=(0,$.jsx)(An,{value:`preview`,children:`Preview`}),t[13]=k,t[14]=A,t[15]=j):(k=t[13],A=t[14],j=t[15]);let M;t[16]!==c||t[17]!==O?(M=(0,$.jsxs)(kn,{"aria-label":`Markdown editor mode`,variant:`segmented`,value:O,disabled:c,onValueChange:A,children:[j,k]}),t[16]=c,t[17]=O,t[18]=M):M=t[18];let N;t[19]!==r||t[20]!==g||t[21]!==C||t[22]!==i||t[23]!==s||t[24]!==o||t[25]!==v||t[26]!==c||t[27]!==p?(N=v?(0,$.jsx)(`div`,{className:`rounded-lg border border-border/60 px-3 py-2`,children:C?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Nothing to preview.`}):(0,$.jsx)(qs,{text:g,cwd:r,environmentId:i,threadRef:p})}):(0,$.jsx)(Dn,{autoFocus:!0,disabled:c,value:g,rows:6,placeholder:o,"aria-label":s,onChange:e=>_(e.target.value)}),t[19]=r,t[20]=g,t[21]=C,t[22]=i,t[23]=s,t[24]=o,t[25]=v,t[26]=c,t[27]=p,t[28]=N):N=t[28];let P;t[29]!==f||t[30]!==c?(P=(0,$.jsx)(W,{size:`xs`,variant:`ghost`,disabled:c,onClick:f,children:`Cancel`}),t[29]=f,t[30]=c,t[31]=P):P=t[31];let F=!h||c||C&&!m,I;t[32]!==m||t[33]!==g||t[34]!==C||t[35]!==i||t[36]!==d||t[37]!==c?(I=()=>{!Tt(i,`source-control:write`)||c||C&&!m||d(g)},t[32]=m,t[33]=g,t[34]=C,t[35]=i,t[36]=d,t[37]=c,t[38]=I):I=t[38];let L=c?`Saving...`:`Save`,R;t[39]!==F||t[40]!==I||t[41]!==L?(R=(0,$.jsx)(W,{size:`xs`,variant:`outline`,disabled:F,onClick:I,children:L}),t[39]=F,t[40]=I,t[41]=L,t[42]=R):R=t[42];let z;t[43]!==P||t[44]!==R?(z=(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[P,R]}),t[43]=P,t[44]=R,t[45]=z):z=t[45];let B;return t[46]!==M||t[47]!==N||t[48]!==z||t[49]!==T||t[50]!==E?(B=(0,$.jsxs)(`div`,{className:T,onKeyDown:E,children:[M,N,z]}),t[46]=M,t[47]=N,t[48]=z,t[49]=T,t[50]=E,t[51]=B):B=t[51],B}var Ys=[`thumbs-up`,`thumbs-down`,`laugh`,`hooray`,`confused`,`heart`,`rocket`,`eyes`],Xs={"thumbs-up":`👍`,"thumbs-down":`👎`,laugh:`😄`,hooray:`🎉`,confused:`😕`,heart:`❤️`,rocket:`🚀`,eyes:`👀`},Zs={"thumbs-up":`thumbs up`,"thumbs-down":`thumbs down`,laugh:`laugh`,hooray:`hooray`,confused:`confused`,heart:`heart`,rocket:`rocket`,eyes:`eyes`};function Qs(e){return Xs[e]}function $s(e){return Zs[e]}var ec=3;function tc(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 nc(e,t){return t?`${e} ${e===1?`other`:`others`}`:`${e} ${e===1?`person`:`people`}`}function rc(e){let t=e.actors.length<e.count,n=(e.viewerHasReacted&&t?[`You`,...e.actors]:[...e.actors]).slice(0,Math.min(ec,e.count)),r=Math.max(0,e.count-n.length);return`${tc([...n,...r>0?[nc(r,n.length>0)]:[]])} reacted with ${$s(e.content)} emoji`}function ic(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 Ys.flatMap(e=>n.get(e)??[])}var ac=`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`,oc=new Map;function sc(e){return e.map(e=>`${e.content}:${e.count}:${+!!e.viewerHasReacted}`).join(` `)}function cc(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:oc},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=Dt(Jr.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=sc(n),d=f.signature===e?f.values:oc,m=ic(n,d),b=async(t,n)=>{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}}),gt.add({type:`error`,title:`The reaction could not be saved`})):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":`${$s(e.content)}, ${e.count}`,disabled:!r,className:G(ac,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:Qs(e.content)}),(0,$.jsx)(`span`,{className:`tabular-nums`,children:e.count})]}),(0,$.jsx)(J,{side:`top`,children:rc(e)})]},e.content)),v=r?(0,$.jsxs)(nr,{open:l,onOpenChange:u,children:[(0,$.jsx)(tr,{render:(0,$.jsx)(`button`,{type:`button`,"aria-label":`Add a reaction`,className:G(ac,`border-border/70 px-1.5 text-muted-foreground hover:border-primary/60 hover:text-foreground`)}),children:(0,$.jsx)(Me,{"aria-hidden":!0,className:`size-3.5`})}),(0,$.jsx)($n,{align:`start`,side:`top`,padding:`compact`,children:(0,$.jsx)(`div`,{className:`flex items-center gap-0.5`,children:Ys.map(e=>{let t=m.find(t=>t.content===e)?.viewerHasReacted??!1;return(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t,"aria-label":$s(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:Qs(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 lc=`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 text-sm shadow-sm`;function uc(e){return t=>{t.key===`Escape`&&e.onCancel&&(t.preventDefault(),e.onCancel()),yn(t,e.value,e.pending)&&(t.preventDefault(),e.onSubmit())}}function dc(e){return e===`left`?`deletions`:`additions`}function fc(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 pc(e){let t=(0,Q.c)(11),{comment:n,onRemove:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=G(lc,`border-dashed`),t[0]=i):i=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(je,{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)(Pe,{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:mc,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function mc(e){return e.stopPropagation()}function hc({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),[j,M]=(0,Z.useState)(!1),N=O?.threadId===e.id?O:null,P=ei(e.comments,N?.comments??[]),F=N===null?e.nextCommentsCursor??null:N.nextCursor,I=e.commentCount??P.length,L=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:mi(r.comments,t,n)}:r),w(null))},R=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}}},z=async()=>{if(!(F===null||j)){M(!0);try{let t=await f(F);if(t===null)return;k(n=>({threadId:e.id,comments:ei(n?.threadId===e.id?n.comments:[],t.comments),nextCursor:t.nextCursor}))}finally{M(!1)}}};return(0,$.jsxs)(`div`,{className:lc,contentEditable:!1,onPointerDown:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(at,{className:G(`size-3.5`,e.isResolved&&`text-success-foreground`),icon:e.isResolved?rt:ot}),(0,$.jsxs)(`button`,{type:`button`,className:`hover:text-foreground`,"aria-expanded":_,onClick:()=>v(e=>!e),children:[e.isResolved?`Resolved`:`Open`,` · `,I,` `,I===1?`comment`:`comments`]}),e.isOutdated?(0,$.jsx)(`span`,{children:`outdated`}):null,u?(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,className:`ml-auto`,disabled:s||c,onClick:u,children:[(0,$.jsx)(A,{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)(Qi,{open:_,children:(0,$.jsxs)(pa,{children:[(0,$.jsx)(`div`,{className:`mt-2 space-y-3`,children:P.map(e=>(0,$.jsxs)(`article`,{className:`group min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(Ar,{actor:e.author}),(0,$.jsx)(`span`,{children:Cn(e.createdAt)}),(0,$.jsx)(cc,{className:`ml-auto justify-end`,reactions:e.reactions??[],canReact:i,subjectId:e.id,environmentId:a,reference:o,onRefresh:g})]}),C===e.id?(0,$.jsx)(Js,{className:`mt-1`,value:e.body,cwd:t,environmentId:a,label:`Edit comment`,saving:T,onSave:t=>void L(e.id,t),onCancel:()=>w(null)}):(0,$.jsxs)(`div`,{className:`mt-1 flex items-start gap-1`,children:[(0,$.jsx)(qs,{className:`min-w-0 flex-1 text-sm`,text:e.body,cwd:t,environmentId:a}),p(e)?(0,$.jsx)(ys,{"aria-label":`Edit comment`,onClick:()=>w(e.id)}):null]})]},e.id))}),F===null?null:(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsx)(W,{size:`xs`,variant:`ghost`,disabled:j,onClick:()=>void z(),children:j?`Loading...`:`Load more comments`})}),n?y?(0,$.jsxs)(`div`,{className:`mt-2`,children:[(0,$.jsx)(Dn,{autoFocus:!0,size:`sm`,value:x,placeholder:`Reply`,"aria-label":`Reply to this conversation`,onChange:e=>S(e.target.value),onKeyDown:uc({value:x,pending:s,onSubmit:()=>void R(),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 R(),children:`Reply`})]})]}):(0,$.jsx)(W,{size:`xs`,variant:`ghost`,className:`mt-2`,onClick:()=>b(!0),children:`Reply`}):null]})})]})}function gc(e){return e.repositoryIdentity?.canonicalKey?.toLowerCase()}function _c(e,t,n){let r=new Map(t.map((e,t)=>[e,t])),i=new Map;for(let t of e){let e=gc(t);if(!e)continue;let a=r.get(t.environmentId);if(a===void 0)continue;let o=i.get(e);(o===void 0||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=gc(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 vc(e,t,n){let r=t.find(t=>t.environmentId===e.environmentId&&t.id===e.projectId),i=r===void 0?void 0:gc(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&&gc(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 yc(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 bc(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 xc(e,t){let n=(0,Q.c)(13),r=Xe(),i;n[0]!==e||n[1]!==t||n[2]!==r?(i=t===null?null:yc(r.filter(t=>t.environmentId===e).flatMap(Sc),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:Wr({environmentId:e,input:t}),n[4]=e,n[5]=t,n[6]=o):o=n[6];let s=Et(o),c;n[7]!==s||n[8]!==a?(c=bc(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 Sc(e){return e.pullRequests??[]}function Cc(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 wc=3e5,Tc=36e4;function Ec(e){return e.visible&&e.now-e.lastRefreshedAt>=1e4}function Dc(e){return e.lastRefreshedAt!==void 0&&Ec({...e,lastRefreshedAt:e.lastRefreshedAt})}function Oc(e){return e.now-e.lastInteractedAt<36e4&&Ec(e)}var kc=new Map,Ac=0,jc=new Set,Mc=[`pointerdown`,`pointermove`,`keydown`,`wheel`],Nc=()=>{let e=Date.now(),t=e-Ac>=Tc;if(Ac=e,t)for(let e of jc)e()};function Pc(e){if(jc.size===0){Ac=Date.now();for(let e of Mc)document.addEventListener(e,Nc,{passive:!0})}return jc.add(e),()=>{if(jc.delete(e),!(jc.size>0))for(let e of Mc)document.removeEventListener(e,Nc)}}function Fc(e,t={}){let{enabled:n=!0,key:r,intervalMs:i=wc}=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&&(kc.set(s,e),a.current())},t=()=>document.visibilityState===`visible`,r=()=>{let n=Date.now();if(n-Ac>=36e4)return;let r=kc.get(s);r===void 0?kc.set(s,n):Dc({visible:t(),now:n,lastRefreshedAt:r})&&e(n)},o=()=>{let n=Date.now(),r=kc.get(s)??n;Oc({visible:t(),now:n,lastRefreshedAt:r,lastInteractedAt:Ac})&&e(n)},c,l=()=>{clearInterval(c),c=t()?setInterval(o,i):void 0},u=()=>{r(),l()},d=Pc(()=>{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 Ic(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=Lr({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 Lc(e){let t=(0,Q.c)(14),{stack:n,reference:r,onSelect:i,pending:a}=e,o=a!==void 0&&a,s;if(t[0]!==i||t[1]!==o||t[2]!==r||t[3]!==n.layers){let e;t[5]!==i||t[6]!==o||t[7]!==r?(e=e=>(0,$.jsxs)(ke,{onClick:()=>{i?.({...r,number:e.number})},disabled:!i||o,"aria-current":e.number===r.number?`true`:void 0,children:[(0,$.jsx)(Ic,{layer:e}),e.number===r.number?(0,$.jsx)(x,{"aria-hidden":!0,className:`size-3.5`}):null]},e.number),t[5]=i,t[6]=o,t[7]=r,t[8]=e):e=t[8],s=n.layers.toReversed().map(e),t[0]=i,t[1]=o,t[2]=r,t[3]=n.layers,t[4]=s}else s=t[4];let c;t[9]===n.base?c=t[10]:(c=(0,$.jsxs)(re,{children:[`↳ `,n.base]}),t[9]=n.base,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,$.jsxs)(`div`,{className:`max-h-80 overflow-y-auto`,children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Rc(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)(re,{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 zc(e){let t=(0,Q.c)(108),{hostLabel:n,stack:r,reference:i,environmentId:a,stale:s,canMerge:c,canRebase:l,mergeMethod:u,onSelect:d,onActed:f,notice:p,onRetry:h}=e,[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(!1),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S={reportFailure:!1},t[0]=S):S=t[0];let C=Dt(Jr.runAction,S),w,T,E,D,O,k,A,j,M,N,P,F;if(t[1]!==c||t[2]!==l||t[3]!==v||t[4]!==a||t[5]!==n||t[6]!==u||t[7]!==p||t[8]!==f||t[9]!==h||t[10]!==d||t[11]!==g||t[12]!==b||t[13]!==i||t[14]!==C||t[15]!==r||t[16]!==s){let e=r.layers.at(-1),S=r.layers.filter(Yc),L=S.some(Jc),z;t[29]===i?z=t[30]:(z=e=>e.number===i.number,t[29]=i,t[30]=z);let B=r.layers.findIndex(z)+1,V=r.layers.slice(0,B).filter(qc),ee=r.layers[B-1],H=V.some(Kc),U=S.flatMap(Gc).length!==S.length,te=b||s||ee?.state!==`open`||V.some(Wc)||H||V.length===0||V.some(Uc),ne=b||s||U||L||S.length===0;D=async()=>{if(b||!v||(v===`merge`?!c||te:!l||ne))return;let t=v,o=t===`merge`?ee:e;if(!o?.headSha)return;let s=(t===`merge`?V:S).flatMap(Hc);x(!0),y(null);let d=gt.add({type:`loading`,title:t===`merge`?`Merging stack...`:`Rebasing stack...`}),p=await C({environmentId:a,input:{...i,number:o.number,stackNumber:r.number,expectedStackHeads:s,action:t,...t===`merge`?{mergeMethod:u}:{updateMethod:`rebase`}}});x(!1),f(),p._tag===`Failure`?gt.update(d,{type:`error`,title:t===`merge`?`Could not merge the stack`:`Could not rebase the stack`,description:ai(He(p),t===`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.`:`The host refused the rebase. A rebase stops at the first commit that does not apply cleanly.`)}):gt.update(d,{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=v===`merge`?V:S,ie=`Stack ${r.number}, layer ${B} of ${r.layers.length}`,oe;t[31]===ie?oe=t[32]:(oe=(0,$.jsx)(W,{variant:`ghost`,size:`xs`,"aria-label":ie}),t[31]=ie,t[32]=oe);let se;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(X.stack,{"aria-hidden":!0,className:`size-3.5`}),t[33]=se):se=t[33];let ce;t[34]===h?ce=t[35]:(ce=h?(0,$.jsx)(m,{"aria-hidden":!0,className:`size-3 text-warning`}):null,t[34]=h,t[35]=ce);let le;t[36]!==B||t[37]!==r.layers.length||t[38]!==oe||t[39]!==ce?(le=(0,$.jsx)(q,{render:(0,$.jsxs)(ae,{render:oe,children:[se,` `,B,`/`,r.layers.length,ce]})}),t[36]=B,t[37]=r.layers.length,t[38]=oe,t[39]=ce,t[40]=le):le=t[40];let ue=p?` · ${p}`:null,de;t[41]!==B||t[42]!==r.layers.length||t[43]!==r.number||t[44]!==ue?(de=(0,$.jsxs)(J,{children:[`View stack #`,r.number,`, layer `,B,` of `,r.layers.length,ue]}),t[41]=B,t[42]=r.layers.length,t[43]=r.number,t[44]=ue,t[45]=de):de=t[45];let fe;t[46]!==le||t[47]!==de?(fe=(0,$.jsxs)(Y,{children:[le,de]}),t[46]=le,t[47]=de,t[48]=fe):fe=t[48];let pe=!!h,me;t[49]!==p||t[50]!==r.number||t[51]!==pe?(me=(0,$.jsx)(Rc,{number:r.number,notice:p,stale:pe}),t[49]=p,t[50]=r.number,t[51]=pe,t[52]=me):me=t[52];let he;t[53]===h?he=t[54]:(he=h?(0,$.jsx)(ke,{onClick:h,children:`Retry stack refresh`}):null,t[53]=h,t[54]=he);let ge;t[55]===d?ge=t[56]:(ge=d?e=>{_(!1),d(e)}:void 0,t[55]=d,t[56]=ge);let _e;t[57]!==b||t[58]!==i||t[59]!==r||t[60]!==ge?(_e=(0,$.jsx)(Lc,{stack:r,reference:i,pending:b,onSelect:ge}),t[57]=b,t[58]=i,t[59]=r,t[60]=ge,t[61]=_e):_e=t[61];let ve;t[62]!==me||t[63]!==he||t[64]!==_e?(ve=(0,$.jsxs)(o,{children:[me,he,_e]}),t[62]=me,t[63]=he,t[64]=_e,t[65]=ve):ve=t[65];let ye=c||l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{}),c?(0,$.jsxs)(ke,{disabled:te,onClick:()=>y(`merge`),children:[(0,$.jsx)(X.merged,{"aria-hidden":!0}),`Merge stack (`,V.length,`)`]}):null,l?(0,$.jsxs)(ke,{disabled:ne,onClick:()=>y(`update-branch`),children:[(0,$.jsx)(R,{"aria-hidden":!0}),`Rebase stack`]}):null,H||V.some(Vc)?(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,be;t[66]!==ve||t[67]!==ye?(be=(0,$.jsxs)(we,{align:`start`,children:[ve,ye]}),t[66]=ve,t[67]=ye,t[68]=be):be=t[68],t[69]!==g||t[70]!==fe||t[71]!==be?(P=(0,$.jsxs)(I,{open:g,onOpenChange:_,children:[fe,be]}),t[69]=g,t[70]=fe,t[71]=be,t[72]=P):P=t[72],F=c&&ee?.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:te&&!s,"aria-disabled":te||void 0,"aria-description":s?p??void 0:void 0,onClick:te?void 0:()=>y(`merge`),children:[(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),`Merge stack`]})})}),(0,$.jsx)(J,{children:s?p:`Merge stack through #${i.number} into ${r.base} (${V.length} ${V.length===1?`pull request`:`pull requests`})`})]}):null,E=Gn,M=v!==null,t[73]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{e||y(null)},t[73]=N):N=t[73],T=Wn,A=`max-w-md`;let xe=v===`merge`?`Merge ${V.length} pull requests?`:`Rebase ${S.length} pull requests?`,Se;t[74]===xe?Se=t[75]:(Se=(0,$.jsx)(Bn,{children:xe}),t[74]=xe,t[75]=Se);let Ce=v===`merge`?`Merge #${i.number} and its unmerged layers below into ${r.base} using ${u}. ${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.`,Te;t[76]===Ce?Te=t[77]:(Te=(0,$.jsx)(Un,{children:Ce}),t[76]=Ce,t[77]=Te),t[78]!==Se||t[79]!==Te?(j=(0,$.jsxs)(zn,{children:[Se,Te]}),t[78]=Se,t[79]=Te,t[80]=j):j=t[80],w=Hn,O=`max-h-48 space-y-1 overflow-y-auto text-sm`,k=re.map(Bc),t[1]=c,t[2]=l,t[3]=v,t[4]=a,t[5]=n,t[6]=u,t[7]=p,t[8]=f,t[9]=h,t[10]=d,t[11]=g,t[12]=b,t[13]=i,t[14]=C,t[15]=r,t[16]=s,t[17]=w,t[18]=T,t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A,t[24]=j,t[25]=M,t[26]=N,t[27]=P,t[28]=F}else w=t[17],T=t[18],E=t[19],D=t[20],O=t[21],k=t[22],A=t[23],j=t[24],M=t[25],N=t[26],P=t[27],F=t[28];let L;t[81]!==O||t[82]!==k?(L=(0,$.jsx)(`ul`,{className:O,children:k}),t[81]=O,t[82]=k,t[83]=L):L=t[83];let z;t[84]!==w||t[85]!==L?(z=(0,$.jsx)(w,{children:L}),t[84]=w,t[85]=L,t[86]=z):z=t[86];let B;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(W,{variant:`outline`,onClick:()=>y(null),children:`Cancel`}),t[87]=B):B=t[87];let V;t[88]===D?V=t[89]:(V=()=>void D(),t[88]=D,t[89]=V);let ee=v===`merge`?`Merge stack`:`Rebase stack`,H;t[90]!==V||t[91]!==ee?(H=(0,$.jsxs)(Vn,{children:[B,(0,$.jsx)(W,{onClick:V,children:ee})]}),t[90]=V,t[91]=ee,t[92]=H):H=t[92];let U;t[93]!==T||t[94]!==z||t[95]!==H||t[96]!==A||t[97]!==j?(U=(0,$.jsxs)(T,{className:A,children:[j,z,H]}),t[93]=T,t[94]=z,t[95]=H,t[96]=A,t[97]=j,t[98]=U):U=t[98];let te;t[99]!==E||t[100]!==U||t[101]!==M||t[102]!==N?(te=(0,$.jsx)(E,{open:M,onOpenChange:N,children:U}),t[99]=E,t[100]=U,t[101]=M,t[102]=N,t[103]=te):te=t[103];let ne;return t[104]!==te||t[105]!==P||t[106]!==F?(ne=(0,$.jsxs)($.Fragment,{children:[P,F,te]}),t[104]=te,t[105]=P,t[106]=F,t[107]=ne):ne=t[107],ne}function Bc(e){return(0,$.jsx)(`li`,{className:`flex items-center gap-2 rounded-md bg-muted/50 px-3 py-2`,children:(0,$.jsx)(Ic,{layer:e,compact:!0})},e.number)}function Vc(e){return e.isDraft}function Hc(e){return e.headSha?[{number:e.number,headSha:e.headSha}]:[]}function Uc(e){return e.isDraft}function Wc(e){return!e.headSha}function Gc(e){return e.headSha?[{number:e.number,headSha:e.headSha}]:[]}function Kc(e){return e.state!==`open`}function qc(e){return e.state!==`merged`}function Jc(e){return e.state!==`open`}function Yc(e){return e.state!==`merged`}var Xc={code:`Code`,tests:`Tests`,mocks:`Mocks`,generated:`Generated`,docs:`Docs`};function Zc(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?Jr.changeBreakdown({environmentId:n,input:r}):null,t[0]=n,t[1]=r,t[2]=c,t[3]=u):u=t[3];let d=Et(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)(Dr,{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)($c,{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 Qc(e){let t=(0,Q.c)(8),{environmentId:n,reference:r,className:i}=e,a;t[0]!==n||t[1]!==r?(a=Jr.changeBreakdown({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=Et(a);if(!o.data)return null;let s;t[3]===o.data?s=t[4]:(s=(0,$.jsx)($c,{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 $c(e){let t=(0,Q.c)(8),{breakdown:n,total:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Object.keys(Xc),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)(el,{label:Xc[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)(el,{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 el(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=_r(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=_r(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 tl(e){let t=(0,Q.c)(3),n=Ze();if(kr(n.get(e.environmentId)?.environment.capabilities)===`unsupported`)return null;let r=`${e.environmentId}:${e.url}`,i;return t[0]!==e||t[1]!==r?(i=(0,$.jsx)(nl,{...e},r),t[0]=e,t[1]=r,t[2]=i):i=t[2],i}function nl({environmentId:e,reference:t,url:n,threadRef:r,display:i,onPickerOpenChange:a}){let o=qe(n),s=Ye(r?.environmentId===e?r:null),c=s===null?null:r,l=jr(e),u=l.isLinked(s,n),d=Et(l.mode===`multiple`&&i!==`menu-item`?Jr.linkedThreads({environmentId:e,input:o===null?t:{...t,...Ue(o)}}):null),[f,p]=(0,Z.useState)(d.data);d.data!==null&&d.data!==f&&p(d.data);let[m,h]=(0,Z.useState)(!1),g=async(r,i)=>{if(!(o===null||m)){h(!0);try{await l.changeLink(N(e,r),n,!i)}catch(e){gt.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{h(!1)}l.mode===`multiple`&&j.refresh(Jr.linkedThreads({environmentId:e,input:{...t,...Ue(o)}})),a?.(!1)}};if(o===null||!u&&!l.canLink(n))return null;let _=l.mode===`multiple`?(d.data??f)?.threads??[]:[],v=_.length>0?`Linked from ${_.length} ${_.length===1?`thread`:`threads`}`:`Linked threads`;return(0,$.jsxs)($.Fragment,{children:[i===`count`&&(_.length>0||d.error!==null)?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,"aria-label":v,onClick:()=>da({query:n,...(d.data??f)===null?{}:{linkedThreads:{environmentId:e,threads:_}}}),children:[(0,$.jsx)(je,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{"aria-hidden":!0,children:_.length||`?`})]})}),(0,$.jsxs)(J,{children:[v,`. Search in the command palette.`]})]}):null,i===`menu-item`?(0,$.jsxs)(ke,{disabled:m,onClick:()=>{c===null?a?.(!0):g(c.threadId,u)},children:[u?(0,$.jsx)(X.unlink,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(X.link,{"aria-hidden":!0,className:`size-3.5`}),u?`Unlink from this thread`:c?`Link to this thread`:`Link to thread`]}):null,i===`picker`?(0,$.jsx)(Gn,{open:!0,onOpenChange:a,children:(0,$.jsxs)(Wn,{className:`max-w-md`,showCloseButton:!1,children:[(0,$.jsx)(Bn,{className:`sr-only`,children:`Link pull request to a thread`}),(0,$.jsx)(rl,{environmentId:e,url:n,pending:m,onSelect:e=>void g(e,!1)})]})}):null]})}function rl(e){let t=(0,Q.c)(36),{environmentId:n,url:r,pending:i,onSelect:a}=e,o=Xe(),s=jr(n),c=Je(),[l,u]=(0,Z.useState)(``),d;if(t[0]!==n||t[1]!==c){let e;t[3]===n?e=t[4]:(e=e=>e.environmentId===n,t[3]=n,t[4]=e),d=new Map(c.filter(e).map(al)),t[0]=n,t[1]=c,t[2]=d}else d=t[2];let f=d,p,m,h,g,_,v,y,b,S;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(il);m=Yi,_=`none`,v=l,y=u,b=`Choose a thread`,t[22]===i?S=t[23]:(S=(0,$.jsx)(Ji,{placeholder:`Search threads or projects...`,disabled:i}),t[22]=i,t[23]=S),p=qi,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)(Xi,{value:e.id,disabled:i||t,onClick:()=>a(e.id),children:[(0,$.jsx)(je,{"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)(x,{"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]=S}else p=t[13],m=t[14],h=t[15],g=t[16],_=t[17],v=t[18],y=t[19],b=t[20],S=t[21];let C;t[24]!==p||t[25]!==h||t[26]!==g?(C=(0,$.jsx)(p,{className:h,children:g}),t[24]=p,t[25]=h,t[26]=g,t[27]=C):C=t[27];let w;return t[28]!==m||t[29]!==_||t[30]!==v||t[31]!==y||t[32]!==b||t[33]!==S||t[34]!==C?(w=(0,$.jsxs)(m,{mode:_,value:v,onValueChange:y,"aria-label":b,children:[S,C]}),t[28]=m,t[29]=_,t[30]=v,t[31]=y,t[32]=b,t[33]=S,t[34]=C,t[35]=w):w=t[35],w}function il(e,t){return t.updatedAt.localeCompare(e.updatedAt)}function al(e){return[e.id,e.title]}function ol(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)(wr,{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)(ye,{"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)(Ae,{"aria-hidden":!0,className:`size-3.5 self-center`}),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-baseline 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-baseline 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 sl(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 cl(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)(An,{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)(kn,{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 ll(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 ul(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}=vt(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 dl(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 fl=[`w-3/5`,`w-2/5`,`w-1/2`,`w-2/3`,`w-2/5`,`w-3/5`,`w-1/2`],pl=[`w-2/5`,`w-1/3`,`w-2/5`,`w-1/4`,`w-1/3`,`w-2/5`,`w-1/3`],ml=[{value:`summary`,label:`Summary`},{value:`timeline`,label:`Timeline`},{value:`code`,label:`Code`}];function hl(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},gl),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 gl(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)(dl,{className:`size-4 rounded-full`}),(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,$.jsx)(dl,{className:G(`h-4`,fl[t%fl.length])}),(0,$.jsx)(dl,{className:G(`h-3.5`,pl[t%pl.length])})]}),(0,$.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[(0,$.jsx)(dl,{className:`w-12`}),(0,$.jsx)(dl,{className:`w-16`})]})]},t)}function _l(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?ml:o,p,m;t[0]!==n||t[1]!==r?(p=r?{...n,...r,isDraft:r.isDraft??n?.isDraft}:n,m=p?Lr({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`?zr(p.checksState):null,t[4]=p,t[5]=g);let _=g,v=a??null,y=r?.changedFiles??null,b;t[6]!==s||t[7]!==f?(b=f.find(e=>e.value===s)?.value??f[0]?.value??`summary`,t[6]=s,t[7]=f,t[8]=b):b=t[8];let x=b,S=!p&&`motion-safe:animate-skeleton`,C;t[9]===S?C=t[10]:(C=G(`flex h-full min-h-0 flex-col overflow-hidden bg-background`,S),t[9]=S,t[10]=C);let w;t[11]===l?w=t[12]:(w=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)(ye,{"aria-hidden":!0,className:`size-3.5`})}):null,t[11]=l,t[12]=w);let T;t[13]!==c||t[14]!==p||t[15]!==h?.toneClassName?(T=p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:p.repository}),(0,$.jsxs)(le,{onClick:()=>void bt()?.shell.openExternal(p.url),"aria-label":`Open pull request #${p.number} on host`,children:[(0,$.jsxs)(`span`,{className:h?.toneClassName,children:[`#`,p.number]}),(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-2.5`})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dl,{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]=T):T=t[16];let E;t[17]!==w||t[18]!==T?(E=(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:[w,T]})}),t[17]=w,t[18]=T,t[19]=E):E=t[19];let D;t[20]===i?D=t[21]:(D=i??(0,$.jsx)(dl,{className:`h-6 w-16 rounded-md`}),t[20]=i,t[21]=D);let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Pull request actions loading`,children:(0,$.jsx)(ee,{"aria-hidden":!0,className:`size-4`})}),t[22]=O):O=t[22];let k;t[23]===u?k=t[24]:(k=u?(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":`Collapse pull request panel`,onClick:u,children:(0,$.jsx)(Ne,{"aria-hidden":!0,className:`size-3.5`})}):null,t[23]=u,t[24]=k);let A;t[25]!==D||t[26]!==k?(A=(0,$.jsxs)(`div`,{className:`mr-4 flex h-7 shrink-0 items-center justify-end gap-1`,children:[D,O,k]}),t[25]=D,t[26]=k,t[27]=A):A=t[27];let j,M,N;t[28]===p?(j=t[29],M=t[30],N=t[31]):(j=(0,$.jsx)(sl,{children:p?(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold leading-snug`,children:p.title}):(0,$.jsx)(dl,{className:`h-5 w-4/5 max-w-md`})}),M=p?(0,$.jsx)(Ar,{actor:p.author??null,tooltip:!1}):(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(dl,{className:`size-4 rounded-full`}),(0,$.jsx)(dl,{className:`h-3 w-14`})]}),N=p?(0,$.jsxs)(`span`,{children:[`updated `,Cn(p.updatedAt)]}):(0,$.jsx)(dl,{className:`h-3 w-16`}),t[28]=p,t[29]=j,t[30]=M,t[31]=N);let P;t[32]!==v||t[33]!==d?(P=v?(0,$.jsx)(ul,{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]=P):P=t[34];let I,L;t[35]===p?(I=t[36],L=t[37]):(I=(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)(va,{value:p.baseBranch})}):(0,$.jsx)(dl,{className:`h-3 w-12`})}),L=p?(0,$.jsx)(ul,{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)(dl,{className:`h-3 w-32 flex-1`}),t[35]=p,t[36]=I,t[37]=L);let R;t[38]===y?R=t[39]:(R=y===null?(0,$.jsx)(dl,{className:`h-3 w-10`}):`${y.toLocaleString()} ${y===1?`file`:`files`}`,t[38]=y,t[39]=R);let z;t[40]===p?z=t[41]:(z=p?(0,$.jsx)(Dr,{additions:p.additions??0,deletions:p.deletions??0,className:`shrink-0 font-mono text-xs`}):(0,$.jsx)(dl,{className:`h-3 w-20`}),t[40]=p,t[41]=z);let B;t[42]!==j||t[43]!==M||t[44]!==N||t[45]!==P||t[46]!==I||t[47]!==L||t[48]!==R||t[49]!==z?(B=(0,$.jsx)(`div`,{className:`col-span-2 grid grid-rows-[1fr]`,children:(0,$.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,$.jsx)(ol,{title:j,author:M,updated:N,checkout:P,base:I,head:L,files:R,diffStat:z})})}),t[42]=j,t[43]=M,t[44]=N,t[45]=P,t[46]=I,t[47]=L,t[48]=R,t[49]=z,t[50]=B):B=t[50];let V;t[51]===_?V=t[52]:(V=_?(0,$.jsx)(ll,{className:_.toneClassName,icon:(0,$.jsx)(_.Icon,{"aria-hidden":!0,className:`size-3.5`}),label:_.label}):(0,$.jsx)(ll,{icon:(0,$.jsx)(dl,{className:`my-px size-3.5 rounded-full`}),label:(0,$.jsx)(dl,{className:`w-28`})}),t[51]=_,t[52]=V);let H;t[53]!==x||t[54]!==V||t[55]!==f?(H=(0,$.jsx)(cl,{tabs:f,value:x,inert:!0,children:V}),t[53]=x,t[54]=V,t[55]=f,t[56]=H):H=t[56];let U;t[57]!==A||t[58]!==B||t[59]!==H||t[60]!==E?(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:[E,A,B,H]}),t[57]=A,t[58]=B,t[59]=H,t[60]=E,t[61]=U):U=t[61];let te;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(ne,{"aria-hidden":!0,className:`size-3.5`}),`Reviewers`]}),t[62]=te):te=t[62];let re;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(dl,{className:`h-3 w-10`}),t[63]=re):re=t[63];let ie;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(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:[te,(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-foreground`,children:[re,(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Reviewers loading`,children:(0,$.jsx)(F,{"aria-hidden":!0,className:`size-3.5`})})]})]}),t[64]=ie):ie=t[64];let ae;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(fe,{"aria-hidden":!0,className:`size-3.5`}),`Labels`]}),t[65]=ae):ae=t[65];let oe;t[66]===n?oe=t[67]:(oe=n?.labels?n.labels.length>0?n.labels.map(vl):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dl,{className:`h-4.5 w-24`}),(0,$.jsx)(dl,{className:`h-4.5 w-20`})]}),t[66]=n,t[67]=oe);let se;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Labels loading`,children:(0,$.jsx)(fe,{"aria-hidden":!0,className:`size-3.5`})}),t[68]=se):se=t[68];let ce;t[69]===oe?ce=t[70]:(ce=(0,$.jsx)(`section`,{className:`px-4 pt-2.5 pb-1`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[ie,(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:[ae,(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1 text-foreground`,children:[oe,se]})]})]})}),t[69]=oe,t[70]=ce);let ue;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(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)(pe,{"aria-hidden":!0,className:`size-3.5 rotate-90 text-muted-foreground/60`})]})}),t[71]=ue):ue=t[71];let de;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(dl,{className:`h-5 w-40`}),t[72]=de):de=t[72];let me;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsxs)(`section`,{children:[ue,(0,$.jsxs)(`div`,{className:`space-y-3 px-4 pb-4`,children:[de,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(dl,{className:`h-4 w-full`}),(0,$.jsx)(dl,{className:`h-4 w-11/12`}),(0,$.jsx)(dl,{className:`h-4 w-4/5`}),(0,$.jsx)(dl,{className:`h-4 w-2/3`})]})]})]}),t[73]=me):me=t[73];let he;t[74]===ce?he=t[75]:(he=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:[ce,me]}),t[74]=ce,t[75]=he);let ge;return t[76]!==U||t[77]!==he||t[78]!==C?(ge=(0,$.jsxs)(`div`,{role:`status`,"aria-label":`Loading pull request`,className:C,children:[U,he]}),t[76]=U,t[77]=he,t[78]=C,t[79]=ge):ge=t[79],ge}function vl(e){return(0,$.jsx)(Fr,{label:e,size:`default`,className:`max-w-48`},e.name)}function yl(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},bl)}),t[0]=r,t[1]=i),i}function bl(e,t){return(0,$.jsxs)(`div`,{className:`flex h-7 items-center gap-2 rounded-md px-2`,children:[(0,$.jsx)(dl,{className:`size-4 rounded-full`}),(0,$.jsx)(dl,{className:pl[t%pl.length]})]},t)}function xl(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},Sl)})}),t[0]=r,t[1]=i),i}function Sl(e,t){return(0,$.jsxs)(`div`,{className:`relative pb-5`,children:[(0,$.jsx)(dl,{className:`absolute -left-[1.55rem] top-1 size-2 rounded-full`}),(0,$.jsx)(dl,{className:G(`h-3.5`,fl[t%fl.length])}),(0,$.jsx)(dl,{className:`mt-1.5 w-16`})]},t)}function Cl(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},wl)}),t[0]=r,t[1]=i),i}function wl(e,t){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(dl,{className:`size-5 shrink-0 rounded-full`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(dl,{className:pl[t%pl.length]}),(0,$.jsx)(dl,{className:`w-full`}),(0,$.jsx)(dl,{className:`w-3/4`})]})]},t)}function Tl(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)(sa,{"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 El(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)(Kn,{variant:`icon`,children:(0,$.jsx)(X.pullRequest,{})}),t[0]=l):l=t[0];let u;t[1]===s?u=t[2]:(u=(0,$.jsx)(Jn,{children:s}),t[1]=s,t[2]=u);let d;t[3]===r?d=t[4]:(d=(0,$.jsx)(Yn,{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)(sa,{size:`sm`,refreshing:c}),`Retry`]}):null,o?(0,$.jsxs)(W,{size:`sm`,variant:`outline`,render:(0,$.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`}),children:[(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-3.5`}),`Open on GitHub`]}):null]}):null,t[8]=o,t[9]=i,t[10]=c,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,$.jsxs)(Xn,{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 Dl=e=>e===Vr?`Open on host`:`Open on ${e.label}`;function Ol(e){return[{id:`copy-link`,label:`Copy link`,icon:`copy`},{id:`open-external`,label:e}]}async function kl({url:e,openLabel:t,position:n}){let r=bt();if(!r)return;let i=null;try{i=await r.contextMenu.show(Ol(t),n)}catch{return}try{i===`copy-link`?await _t(e,`link`):i===`open-external`&&await r.shell.openExternal(e)}catch{gt.add({type:`error`,title:i===`copy-link`?`Could not copy the link`:`Could not open the link`})}}function Al(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=Dt(Jr.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();t.length===0||f!==null||a||(p(e),e===`comment`?(await h({environmentId:n,input:{...r,body:t}}))._tag===`Failure`?(p(null),gt.add({type:`error`,title:`Could not post the comment`})):(d(``),p(null),l(),c()):((await s(t,e)).commentPosted&&(d(``),l()),p(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,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)(Dn,{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)(ie,{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 jl=[{value:`comment`,label:`Comment`,sent:`Review submitted`,icon:(0,$.jsx)(je,{className:`size-3`})},{value:`approve`,label:`Approve`,sent:`Pull request approved`,icon:(0,$.jsx)(x,{className:`size-3`})},{value:`request-changes`,label:`Request changes`,sent:`Changes requested`,icon:(0,$.jsx)(B,{className:`size-3`})}];function Ml(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=Ii(r),p;t[0]===r?p=t[1]:(p=Fi(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=Pi(h),_=Pi(Ll),v=Pi(Il),y=Pi(Fl),b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},t[4]=b):b=t[4];let x=Dt(Jr.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=jl.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}});c(!1),a._tag===`Failure`?gt.add({type:`error`,title:`The review could not be submitted`,description:ai(He(a),`The host refused the review. Your draft is still here to try again.`)}):(_(m,i.map(Pl)),y(m,t),gt.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)(Dn,{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)(mt,{value:C?.value??null,disabled:s,onValueChange:e=>{e!==null&&d(e)},children:[(0,$.jsx)(pt,{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)(ft,{side:`top`,alignItemWithTrigger:!1,children:p.map(Nl)})]}):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 Nl(e){return(0,$.jsx)(dt,{value:e.value,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.icon,e.label]})},e.value)}function Pl(e){return e.id}function Fl(e){return e.clearSummary}function Il(e){return e.setSummary}function Ll(e){return e.removeComments}function Rl(e){let t=(0,Q.c)(63),{environmentId:n,reference:r,detail:i,actionPending:a,onCommentAction:o,onCommented:s,onReviewSubmitted:c,openReviewRequest:l}=e,[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(`comment`),g=(0,Z.useRef)(null),_=(0,Z.useRef)(null),v=Ii(r),y=Pi(zl),b;t[0]===r?b=t[1]:(b=Fi(r),t[0]=r,t[1]=b);let x=b,S;t[2]===x?S=t[3]:(S=e=>(e.summaries[x]??``).trim().length>0,t[2]=x,t[3]=S);let C=Pi(S),w=v.length>0||C,[T,E]=(0,Z.useState)(l);l!==T&&(E(l),h(`review`),d(!0));let D=i.capabilities.comment&&i.viewerPermissions.comment,O;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),O=i.capabilities.review.verdicts.filter(e),t[4]=i.capabilities.review.verdicts,t[5]=i.viewerPermissions,t[6]=O}else O=t[6];let k=O;if(!D&&k.length===0)return null;let A=D?k.length===0?`comment`:m:`review`,j;t[9]===w?j=t[10]:(j=e=>{e&&h(w?`review`:`comment`),d(e)},t[9]=w,t[10]=j);let M;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(W,{size:`icon`,variant:`glass`}),t[11]=M):M=t[11];let N=v.length>0?`Review pull request, ${v.length} ${v.length===1?`comment`:`comments`} pending`:w||!D?`Review pull request`:`Comment on pull request`,P;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(je,{className:`size-4`}),t[12]=P):P=t[12];let F;t[13]===v.length?F=t[14]:(F=v.length>0?(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-info px-1 text-3xs font-semibold tabular-nums text-white`,children:v.length}):null,t[13]=v.length,t[14]=F);let I;t[15]!==N||t[16]!==F?(I=(0,$.jsxs)(tr,{render:M,"aria-label":N,children:[P,F]}),t[15]=N,t[16]=F,t[17]=I):I=t[17];let L=A===`review`?_:g,R;t[18]!==D||t[19]!==A||t[20]!==v.length||t[21]!==k.length?(R=D&&k.length>0?(0,$.jsxs)(kn,{"aria-label":`Composer mode`,variant:`segmented`,value:[A],onValueChange:e=>{let t=e[0];(t===`comment`||t===`review`)&&h(t)},children:[(0,$.jsx)(An,{value:`comment`,children:`Comment`}),(0,$.jsx)(An,{value:`review`,children:v.length>0?`Review (${v.length})`:`Review`})]}):(0,$.jsx)(Qn,{children:A===`review`?`Review pull request`:`Comment on pull request`}),t[18]=D,t[19]=A,t[20]=v.length,t[21]=k.length,t[22]=R):R=t[22];let z;t[23]!==y||t[24]!==A||t[25]!==v.length||t[26]!==x||t[27]!==f?(z=A===`review`&&v.length>0?(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":`Discard pending line comments`,title:`Discard pending line comments`,disabled:f,onClick:()=>y(x),children:(0,$.jsx)(Pe,{className:`size-3.5`})}):null,t[23]=y,t[24]=A,t[25]=v.length,t[26]=x,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 V;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(er,{render:B,"aria-label":`Close composer`,children:(0,$.jsx)(be,{className:`size-3.5`})}),t[30]=V):V=t[30];let ee;t[31]===z?ee=t[32]:(ee=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[z,V]}),t[31]=z,t[32]=ee);let H;t[33]!==R||t[34]!==ee?(H=(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[R,ee]}),t[33]=R,t[34]=ee,t[35]=H):H=t[35];let U;t[36]!==i.provider||t[37]!==n||t[38]!==A||t[39]!==c||t[40]!==r||t[41]!==f||t[42]!==k?(U=k.length>0?(0,$.jsx)(`div`,{hidden:A!==`review`,children:(0,$.jsx)(Ml,{environmentId:n,reference:r,verdicts:k,requestChangesSummaryRequired:Br.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]=A,t[39]=c,t[40]=r,t[41]=f,t[42]=k,t[43]=U):U=t[43];let te;t[44]!==a||t[45]!==D||t[46]!==i||t[47]!==n||t[48]!==A||t[49]!==o||t[50]!==s||t[51]!==r?(te=D?(0,$.jsx)(`div`,{hidden:A!==`comment`,children:(0,$.jsx)(Al,{environmentId:n,reference:r,detail:i,actionPending:a,textareaRef:g,onCommentAction:o,onCommented:s,onClose:()=>d(!1)})}):null,t[44]=a,t[45]=D,t[46]=i,t[47]=n,t[48]=A,t[49]=o,t[50]=s,t[51]=r,t[52]=te):te=t[52];let ne;t[53]!==L||t[54]!==H||t[55]!==U||t[56]!==te?(ne=(0,$.jsxs)($n,{keepMounted:!0,side:`top`,align:`end`,sideOffset:8,width:`lg`,initialFocus:L,"aria-label":`Pull request composer`,children:[H,U,te]}),t[53]=L,t[54]=H,t[55]=U,t[56]=te,t[57]=ne):ne=t[57];let re;return t[58]!==u||t[59]!==ne||t[60]!==j||t[61]!==I?(re=(0,$.jsxs)(nr,{open:u,onOpenChange:j,children:[I,ne]}),t[58]=u,t[59]=ne,t[60]=j,t[61]=I,t[62]=re):re=t[62],re}function zl(e){return e.clear}function Bl(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)=>{!e&&t.reason===`item-press`?t.cancel():s(e)},t[15]=s,t[16]=E);let D;t[17]!==n||t[18]!==r?(D=(0,$.jsx)(Mn,{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)(Fn,{"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)(yl,{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)(Pn,{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)(jn,{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)(Nn,{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)(In,{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 Vl(e,t){if(t.length===0)return!0;let n=t.toLowerCase();return e.name.toLowerCase().includes(n)||(e.description??``).toLowerCase().includes(n)}function Hl(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?Jr.labelCandidates({environmentId:n,input:r}):null,t[0]=n,t[1]=a,t[2]=r,t[3]=d):d=t[3];let f=Et(d),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={reportFailure:!1},t[4]=p):p=t[4];let m=Dt(Jr.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=>Vl(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}});u(null),t._tag===`Failure`&>.add({type:`error`,title:e.isApplied?`Could not take ${e.name} off`:`Could not put ${e.name} on`,description:ai(He(t),`The host refused it. Check that you have triage access on this repository.`)})},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)(fe,{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)(Bl,{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:Wl,disabled:w,onSelect:T,children:Ul}),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 Ul(e){let t=Ur(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)(x,{"aria-label":`Applied`,className:`size-3.5 shrink-0`}):null]})}function Wl(e){return e.name}function Gl(e,t){if(t.length===0)return!0;let n=t.toLowerCase();return e.login.toLowerCase().includes(n)||(e.name??``).toLowerCase().includes(n)}function Kl(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?Jr.reviewerCandidates({environmentId:n,input:r}):null,t[0]=n,t[1]=a,t[2]=r,t[3]=d):d=t[3];let f=Et(d),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={reportFailure:!1},t[4]=p):p=t[4];let m=Dt(Jr.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=>Gl(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}});u(null),t._tag===`Failure`?gt.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:ai(He(t),`The host refused it. Check that you have write access on this repository, and that they still have access to it.`)}):gt.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)(F,{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)(Bl,{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:Jl,disabled:w,onSelect:T,children:ql}),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 ql(e){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ar,{actor:e,className:`flex-1`}),e.kind===`team`?(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`team`}):null,e.isRequested?(0,$.jsx)(x,{"aria-label":`Already asked`,className:`size-3.5 shrink-0`}):null]})}function Jl(e){return`${e.kind}:${e.id}`}function Yl(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)(qs,{...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 Xl=1;function Zl(e){let t=e.sectionTop<e.viewportTop,n=e.headingTop<=e.viewportTop+Xl;return!t||!n?null:Math.max(0,e.scrollTop+e.sectionTop-e.viewportTop)}function Ql(e){return e.toLowerCase()}function $l(e){let t=(0,Q.c)(27),{comment:n,detail:r}=e,i=n.author,a;t[0]!==i||t[1]!==r?(a=i?Br.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)(Ar,{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=Cn(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 eu(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 tu(e){let t=e.toLowerCase().replace(/_/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function nu(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)(Js,{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)(Yl,{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)(ys,{"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 ru(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)($l,{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)(he,{"aria-hidden":!0,className:m}),t[5]=m,t[6]=h);let g;t[7]!==i||t[8]!==h?(g=(0,$.jsxs)(ra,{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)(eu,{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)(ra,{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)(nu,{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)(pa,{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)(Qi,{open:l,onOpenChange:u,children:C}),t[34]=l,t[35]=C,t[36]=w):w=t[36],w}function iu(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 au(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=Zl({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)(pe,{"aria-hidden":!0,className:_}),t[7]=_,t[8]=v);let y;t[9]!==h||t[10]!==v?(y=(0,$.jsxs)(ra,{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)(pa,{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)(Qi,{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 ou=10,su=`p4code:pull-request-comment-filter:v1`,cu=Re({bots:Fe,resolved:Fe}),lu={bots:!1,resolved:!1};function uu(e){let t=(0,Q.c)(110),{scrollerRef:n,environmentId:r,threadRef:i,reference:a,detail:s,activityPending:c,checksStale:l,activityError:u,pendingFinding:d,fixFindingLabel:f,fixCheckLabel:p,onFixFinding:m,onRefresh:h,onRefreshChecks:g}=e,_=l!==void 0&&l,v=f===void 0?`Fix in a thread`:f,y=p===void 0?`Fix`:p,b=g===void 0?h:g,x;t[0]===s.url?x=t[1]:(x={url:s.url,count:ou},t[0]=s.url,t[1]=x);let[C,T]=(0,Z.useState)(x),E=C.url===s.url?C.count:ou,[D,O]=S(su,lu,cu),k=new Map(s.reviewThreads.flatMap(yu)),j=e=>k.get(e.id)?.isResolved===!0||ti(e.reviewState)===`dismissed`,M=vu,N=_u,P;t[2]!==D.bots||t[3]!==D.resolved||t[4]!==j?(P=e=>(D.bots||!M(e)||N(e))&&(D.resolved||!j(e)),t[2]=D.bots,t[3]=D.resolved,t[4]=j,t[5]=P):P=t[5];let F=s.comments.filter(P),L=s.comments.length-F.length,R=F.slice(Math.max(0,F.length-E)),B=F.length-R.length,[V,ee]=(0,Z.useState)(`newest`),H=ci(R,V),U;t[6]!==s.url||t[7]!==B||t[8]!==E?(U=B>0?(0,$.jsxs)(W,{size:`sm`,variant:`outline`,className:`w-full`,onClick:()=>T({url:s.url,count:E+ou}),children:[`Show `,Math.min(B,ou),` older comment`,B===1?``:`s`,` (`,B,` hidden)`]}):null,t[6]=s.url,t[7]=B,t[8]=E,t[9]=U):U=t[9];let te=U,ie=Ai(s.comments,s.commits),oe=new Map(ie.flatMap(gu)),se=[...s.reviewers.map(e=>({key:e.login,actor:e,outcome:oe.get(Ql(e.login))?.outcome??null,stale:oe.get(Ql(e.login))?.stale??!1})),...ie.filter(e=>!s.reviewers.some(t=>e.actor!==null&&Ql(t.login)===Ql(e.actor.login))).map(hu)],ce=Nr(i),le;t[10]===ce?le=t[11]:(le=e=>{ce(e).catch(mu)},t[10]=ce,t[11]=le);let ue=le,de;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(de={reportFailure:!1},t[12]=de):de=t[12];let pe=Dt(Jr.update,de),me;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(me={reportFailure:!1},t[13]=me):me=t[13];let he=Dt(Jr.updateComment,me),[ge,_e]=(0,Z.useState)(null),[ve,ye]=(0,Z.useState)(!1),[be,xe]=(0,Z.useState)(null),[Se,Te]=(0,Z.useState)(!1),Ee=be?.pullRequest===s.url?be.commentId:null,De;t[14]!==ve||t[15]!==r||t[16]!==h||t[17]!==a||t[18]!==pe?(De=async e=>{if(ve)return;ye(!0);let t=await pe({environmentId:r,input:{...a,body:e}});ye(!1),t._tag===`Failure`?gt.add({type:`error`,title:`Could not save the description`}):(_e(null),h())},t[14]=ve,t[15]=r,t[16]=h,t[17]=a,t[18]=pe,t[19]=De):De=t[19];let Oe=De,ke;t[20]===s?ke=t[21]:(ke=e=>_s(s,e),t[20]=s,t[21]=ke);let Ae;t[22]===s.url?Ae=t[23]:(Ae=e=>xe(e===null?null:{pullRequest:s.url,commentId:e.id}),t[22]=s.url,t[23]=Ae);let je;t[24]!==Se||t[25]!==r||t[26]!==h||t[27]!==a||t[28]!==he?(je=async(e,t)=>{if(Se||e.kind===`review`)return;Te(!0);let n=await he({environmentId:r,input:{...a,commentId:e.id,kind:e.kind,body:t}});Te(!1),n._tag===`Failure`?gt.add({type:`error`,title:`Could not save the comment`}):(xe(null),h())},t[24]=Se,t[25]=r,t[26]=h,t[27]=a,t[28]=he,t[29]=je):je=t[29];let Me={cwd:s.workspaceRoot,environmentId:r,threadRef:i,canEdit:ke,editingId:Ee,saving:Se,onEdit:Ae,onSave:je},Ne=e=>{let t=k.get(e.id),n=ii(e.body);if(j(e))return(0,$.jsx)(ru,{comment:e,editing:Me,detail:s,thread:t,label:t?.isResolved?`Resolved`:`Review dismissed`,body:n,reactionBar:(0,$.jsx)(cc,{className:`ml-auto justify-end`,reactions:e.reactions??[],canReact:s.capabilities.reactions===!0,subjectId:e.id,environmentId:r,reference:a,onRefresh:h})},`${s.url}:${e.id}`);let i=ti(e.reviewState),o=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)(cc,{reactions:e.reactions??[],canReact:s.capabilities.reactions===!0,subjectId:e.id,environmentId:r,reference:a,onRefresh:h,className:`ml-auto justify-end`});return(0,$.jsxs)(`article`,{className:`group rounded-lg border border-border/60 bg-background [contain-intrinsic-block-size:160px] [content-visibility:auto]`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2 rounded-t-lg bg-muted/25 px-3 py-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)($l,{comment:e,detail:s}),i?(0,$.jsx)(Or,{outcome:i}):e.reviewState?(0,$.jsx)(`span`,{children:tu(e.reviewState)}):null]}),m&&o?(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,className:`-mt-1 shrink-0`,disabled:d!=null,onClick:()=>m(o),children:[(0,$.jsx)(A,{className:`size-3`}),d===oi(o)?`Preparing...`:v]}):null,c]}),(0,$.jsx)(`div`,{className:`px-3`,children:(0,$.jsx)(eu,{comment:e,thread:t})}),n===null&&!Me.canEdit(e)?null:(0,$.jsx)(nu,{className:`px-3 py-3`,comment:e,editing:Me})]},`${s.url}:${e.id}`)},Pe;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,$.jsx)(ne,{className:`size-3.5`}),t[30]=Pe):Pe=t[30];let Fe=se.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,$.jsx)(`span`,{className:`flex items-center -space-x-1`,children:se.map(pu)}),Ie;t[31]!==s.capabilities.reviewers.listCandidates||t[32]!==s.capabilities.reviewers.request||t[33]!==s.viewerPermissions||t[34]!==r||t[35]!==a?(Ie=s.capabilities.reviewers.request&&s.capabilities.reviewers.listCandidates?(0,$.jsx)(Kl,{environmentId:r,reference:a,allowed:s.viewerPermissions.requestReviewers}):null,t[31]=s.capabilities.reviewers.listCandidates,t[32]=s.capabilities.reviewers.request,t[33]=s.viewerPermissions,t[34]=r,t[35]=a,t[36]=Ie):Ie=t[36];let Le;t[37]!==Fe||t[38]!==Ie?(Le=(0,$.jsx)(iu,{icon:Pe,label:`Reviewers`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[Fe,Ie]})}),t[37]=Fe,t[38]=Ie,t[39]=Le):Le=t[39];let Re;t[40]!==s.capabilities.labels||t[41]!==s.labels||t[42]!==s.viewerPermissions||t[43]!==r||t[44]!==a?(Re=s.labels.length>0||s.capabilities.labels===!0?(0,$.jsx)(iu,{icon:(0,$.jsx)(fe,{className:`size-3.5`}),label:`Labels`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[s.labels.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):s.labels.map(fu),s.capabilities.labels===!0?(0,$.jsx)(Hl,{environmentId:r,reference:a,allowed:s.viewerPermissions.labels!==!1}):null]})}):null,t[40]=s.capabilities.labels,t[41]=s.labels,t[42]=s.viewerPermissions,t[43]=r,t[44]=a,t[45]=Re):Re=t[45];let ze;t[46]!==Le||t[47]!==Re?(ze=(0,$.jsx)(`section`,{className:`px-4 pt-2.5 pb-1`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Le,Re]})}),t[46]=Le,t[47]=Re,t[48]=ze):ze=t[48];let Be=`description:${s.url}`,Ve;t[49]!==ve||t[50]!==ge||t[51]!==s||t[52]!==r||t[53]!==Oe||t[54]!==i?(Ve=(0,$.jsx)(`div`,{className:`group`,children:ge===s.url?(0,$.jsx)(Js,{allowEmpty:!0,value:s.body,cwd:s.workspaceRoot,environmentId:r,threadRef:i,label:`Pull request description`,placeholder:`Describe this pull request`,saving:ve,onSave:e=>void Oe(e),onCancel:()=>_e(null)}):(0,$.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,$.jsx)(qs,{className:`min-w-0 flex-1`,text:s.body.trim().length>0?s.body:`_No description provided._`,cwd:s.workspaceRoot,environmentId:r,threadRef:i}),gs(s)?(0,$.jsx)(ys,{"aria-label":`Edit description`,onClick:()=>_e(s.url)}):null]})}),t[49]=ve,t[50]=ge,t[51]=s,t[52]=r,t[53]=Oe,t[54]=i,t[55]=Ve):Ve=t[55];let He;t[56]!==Be||t[57]!==Ve?(He=(0,$.jsx)(au,{title:`Description`,keepMounted:!0,children:Ve},Be),t[56]=Be,t[57]=Ve,t[58]=He):He=t[58];let Ue=`checks:${s.url}`,We;t[59]!==_||t[60]!==s.checks||t[61]!==y||t[62]!==m||t[63]!==b||t[64]!==ue||t[65]!==d?(We=_?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Check details are out of date.`}),(0,$.jsx)(W,{size:`xs`,variant:`ghost`,onClick:b,children:`Refresh`})]}):s.checks.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No checks reported.`}):s.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&&ue(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)(Pr,{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)})]}),m&&r?(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,className:`shrink-0`,disabled:d!=null,onClick:()=>m(n),children:[(0,$.jsx)(A,{className:`size-3`}),d===oi(n)?`Preparing...`:y]}):null]},`${t}:${e.name}:${e.url??``}`)}),t[59]=_,t[60]=s.checks,t[61]=y,t[62]=m,t[63]=b,t[64]=ue,t[65]=d,t[66]=We):We=t[66];let Ge;t[67]!==Ue||t[68]!==We?(Ge=(0,$.jsx)(au,{title:`Checks`,defaultOpen:!1,children:We},Ue),t[67]=Ue,t[68]=We,t[69]=Ge):Ge=t[69];let Ke=au,qe=`Comments (${s.commentCount})`,Je;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,$.jsx)(W,{size:`xs`,variant:`ghost-muted`}),t[70]=Je):Je=t[70];let Ye;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,$.jsx)(Ce,{"aria-hidden":!0,className:`size-3`}),t[71]=Ye):Ye=t[71];let Xe=L>0?`${L} hidden`:`Filter`,Ze;t[72]===Xe?Ze=t[73]:(Ze=(0,$.jsxs)(ae,{render:Je,"aria-label":`Filter comments`,children:[Ye,Xe]}),t[72]=Xe,t[73]=Ze);let Qe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,$.jsx)(re,{children:`Show`}),t[74]=Qe):Qe=t[74];let $e;t[75]===O?$e=t[76]:($e=e=>O(t=>({...t,bots:e})),t[75]=O,t[76]=$e);let et;t[77]!==D.bots||t[78]!==$e?(et=(0,$.jsx)(w,{checked:D.bots,closeOnClick:!1,onCheckedChange:$e,children:`Bot comments`}),t[77]=D.bots,t[78]=$e,t[79]=et):et=t[79];let tt;t[80]===O?tt=t[81]:(tt=e=>O(t=>({...t,resolved:e})),t[80]=O,t[81]=tt);let nt;t[82]!==D.resolved||t[83]!==tt?(nt=(0,$.jsx)(w,{checked:D.resolved,closeOnClick:!1,onCheckedChange:tt,children:`Resolved or dismissed`}),t[82]=D.resolved,t[83]=tt,t[84]=nt):nt=t[84];let rt;t[85]!==et||t[86]!==nt?(rt=(0,$.jsx)(we,{align:`end`,children:(0,$.jsxs)(o,{children:[Qe,et,nt]})}),t[85]=et,t[86]=nt,t[87]=rt):rt=t[87];let it;t[88]!==Ze||t[89]!==rt?(it=(0,$.jsxs)(I,{children:[Ze,rt]}),t[88]=Ze,t[89]=rt,t[90]=it):it=t[90];let at=V===`newest`?`Show oldest comments first`:`Show newest comments first`,ot,st;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(ot=()=>ee(du),st=(0,$.jsx)(z,{"aria-hidden":!0,className:`size-3`}),t[91]=ot,t[92]=st):(ot=t[91],st=t[92]);let ct=V===`newest`?`Newest first`:`Oldest first`,lt;t[93]!==at||t[94]!==ct?(lt=(0,$.jsxs)(W,{size:`xs`,variant:`ghost-muted`,"aria-label":at,onClick:ot,children:[st,ct]}),t[93]=at,t[94]=ct,t[95]=lt):lt=t[95];let ut;t[96]!==it||t[97]!==lt?(ut=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[it,lt]}),t[96]=it,t[97]=lt,t[98]=ut):ut=t[98];let dt=c?(0,$.jsx)(Cl,{}):u?(0,$.jsx)(Tl,{compact:!0,error:u,onRetry:h}):(0,$.jsxs)($.Fragment,{children:[s.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`,` `,s.comments.length,` are here; open it on the host to read the rest.`]}):null,s.comments.length===0?(0,$.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No comments yet.`}):F.length===0?(0,$.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:L===1?`The only comment is hidden by the filter.`:`All ${L} comments are hidden by the filter.`}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[V===`oldest`?te:null,H.map(Ne),V===`newest`?te:null,E>ou?(0,$.jsxs)(W,{size:`sm`,variant:`ghost`,className:`w-full`,onClick:()=>T({url:s.url,count:ou}),children:[`Show only `,ou,` recent comments`]}):null]})]}),ft;t[99]!==Ke||t[100]!==qe||t[101]!==ut||t[102]!==dt?(ft=(0,$.jsx)(Ke,{title:qe,actions:ut,children:dt}),t[99]=Ke,t[100]=qe,t[101]=ut,t[102]=dt,t[103]=ft):ft=t[103];let pt;return t[104]!==n||t[105]!==ze||t[106]!==He||t[107]!==Ge||t[108]!==ft?(pt=(0,$.jsxs)(`div`,{ref:n,className:`h-full overflow-y-auto`,"data-pull-request-summary-scroll":!0,children:[ze,He,Ge,ft]}),t[104]=n,t[105]=ze,t[106]=He,t[107]=Ge,t[108]=ft,t[109]=pt):pt=t[109],pt}function du(e){return e===`newest`?`oldest`:`newest`}function fu(e){return(0,$.jsx)(Fr,{label:e,size:`default`,className:`max-w-48`},e.name)}function pu(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?Rr(e.outcome,e.stale):void 0)}),children:[(0,$.jsx)(Ar,{actor:e.actor,tooltip:!1,variant:`avatar`}),e.outcome?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Mr,{outcome:e.outcome,stale:e.stale}),(0,$.jsx)(`span`,{className:`sr-only`,children:e.stale?vr(e.outcome):Sr(e.outcome)})]}):null]}),(0,$.jsx)(J,{side:`bottom`,children:e.outcome?`${n} — ${e.stale?vr(e.outcome):Sr(e.outcome)}`:n})]},e.key)}function mu(e){console.error(e),gt.add({type:`error`,title:`Unable to open check details`})}function hu(e){return{key:e.key,actor:e.actor,outcome:e.outcome,stale:e.stale}}function gu(e){return e.actor?[[Ql(e.actor.login),e]]:[]}function _u(e){let t=ti(e.reviewState);return t===`approved`||t===`changes-requested`}function vu(e){return e.author?.isBot===!0||e.author?.login.endsWith(`[bot]`)===!0}function yu(e){return e.comments.map(t=>[t.id,e])}function bu(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)(qs,{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 xu(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 Su(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 Cu(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)(Su,{className:r,children:i}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function wu(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)(Cu,{className:r,icon:i}):(0,$.jsx)(Su,{className:r,children:(0,$.jsx)(xr,{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 Tu(e){return e.toLowerCase().replaceAll(`_`,` `).replaceAll(`-`,` `).replace(/^\w/u,e=>e.toUpperCase())}function Eu(e){let t=(0,Q.c)(4),{state:n}=e,r;t[0]===n?r=t[1]:(r=Tu(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 Du(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 shrink-0`,"aria-label":`Open activity on host`,onClick:()=>r(n),children:(0,$.jsx)(xe,{className:`size-3`})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Ou(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=Dt(Jr.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}});u(!1),t._tag===`Failure`?gt.add({type:`error`,title:`Could not save the comment`}):(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)(xu,{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)(Eu,{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=Cn(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)(_e,{"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)(wr,{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)(ys,{"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)(cc,{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)(Du,{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-center 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)(Js,{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)(bu,{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 ku(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 Au(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=ku(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)(je,{className:`size-3.5`}),t[2]=f):f=t[2];let p=!s,m;t[3]!==u||t[4]!==p?(m=(0,$.jsx)(wu,{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=Cn(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)(he,{"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)(ra,{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)(Ou,{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)(pa,{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)(Qi,{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 ju(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)(me,{className:`size-3.5`}),t[3]=o):o=t[3];let s;t[4]===n.commitAuthors?s=t[5]:(s=(0,$.jsx)(wu,{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=Cn(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)(Dr,{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 Mu(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)(Cu,{icon:i.icon}),t[2]=i.icon,t[3]=a);let o;t[4]===n.actor?o=t[5]:(o=n.actor?(0,$.jsx)(xu,{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=Cn(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 Nu(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)(Er,{outcome:r}),t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,$.jsx)(wu,{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)(xu,{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`:gr(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=Sr(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=vr(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=Cn(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)(_e,{"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)(wr,{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)(cc,{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)(Du,{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-center 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)(bu,{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 Pu(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=_i(r);let e=$r(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=>_s(r,e)).map(Iu)),t[21]=r,t[22]=b);let x=b,S=s===`newest`?d:d.toReversed(),C=Mi(S),w=Fu;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)(Au,{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)(ju,{event:n,onOpen:c},n.id);let i=ti(n.reviewState);return i===null?(0,$.jsx)(Mu,{event:n},n.id):(0,$.jsx)(Nu,{event:n,outcome:i,stale:ui(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 Fu(e){bt()?.shell.openExternal(e)}function Iu(e){return[e.id,e]}function Lu(e){let t=(0,Q.c)(10),{environmentId:n,reference:r,threadRef:i}=e,a;t[0]!==n||t[1]!==r?(a=Jr.detail({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=Et(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)(Ru,{checks:o.data.checks,threadRef:i}),t[7]=o.data.checks,t[8]=i,t[9]=s):s=t[9],s}function Ru(e){let t=(0,Q.c)(23),{checks:n,threadRef:r}=e,i=Nr(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}=ki(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=Rn,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)(Pr,{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(zu)},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 zu(e){console.error(e),gt.add({type:`error`,title:`Unable to open check details`})}function Bu(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=zr(n);let e;t[19]===r?e=t[20]:(e=r?.filter(Uu).length??0,t[19]=r,t[20]=e),y=e;let i;t[21]===r?i=t[22]:(i=r?.filter(Hu).length??0,t[21]=r,t[22]=i),_=i;let a;t[23]!==r||t[24]!==d?(a=r===void 0||d?null:yr(r),t[23]=r,t[24]=d,t[25]=a):a=t[25],b=a,g=nr,h=tr,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=Vu,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)(Lu,{environmentId:a,reference:o,threadRef:f}):null:(0,$.jsx)(Ru,{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)($n,{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 Vu(e){return e.stopPropagation()}function Hu(e){return e.status===`failure`||e.status===`cancelled`}function Uu(e){return e.status===`pending`}var Wu=(0,Z.createContext)(null);function Gu(e){let t=(0,Q.c)(7),{text:n,plain:r,className:i}=e,a=r!==void 0&&r,o=(0,Z.useContext)(Wu);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)(qs,{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 Ku(e,t,n){return Math.max(Math.min(e+t,n-1),0)}function qu(e){return[...new Set([...e.excerpts.map(e=>e.path),...e.files.map(e=>e.path)])]}function Ju(e){let t=qu(e).length;return t===0?`Context, no code`:t===1?`1 file`:`${t} files`}function Yu(e){return e<26?String.fromCharCode(65+e):String(e+1)}function Xu(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;else{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 Zu(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 Qu={context:` `,addition:`+`,deletion:`-`};function $u(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(`${Qu[e.kind]}${e.text.replace(/\n$/,``)}`),e.text.endsWith(`
|
|
207
|
+
`))?.[1]:void 0;d!==void 0&&js(d)?(i(),t.push({id:`attachment:${t.length}`,kind:`attachment`,url:d,media:`video`}),e=u):n.push(o)}return i(),t}function Ps(e,t){if(!/^\/(?![/\\])/u.test(e))return e;try{return new URL(e,t).href}catch{return e}}function Fs(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 Is=/#[1-9]\d*|[0-9a-f]{40}/giu,Ls=/[A-Za-z0-9_]/u,Rs=/[\s([{]/u,zs=new Set([`link`,`linkReference`]);function Bs(e){let t=e.repositoryUrl.replace(/\/+$/u,``);return e=>{Fs(e,Is,(e,n)=>{let r=e.startsWith(`#`),i=n.input[n.index-1],a=n.input[n.index+e.length];return i!==void 0&&(r?Ls.test(i):!Rs.test(i))||a!==void 0&&Ls.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)}]}},zs)}}function Vs(e){let t=n=>{(n.type===`image`||n.type===`definition`)&&n.url!==void 0&&(n.url=Ps(n.url,e.changeRequestUrl)),n.children?.forEach(t)};return e=>t(e)}var Hs=[],Us=new Map;function Ws(e){if(!e)return Hs;let t=Us.get(e);return t||(t=[[Vs,{changeRequestUrl:e}],[Bs,{repositoryUrl:e}]],Us.set(e,t)),t}var Gs=(0,Z.createContext)(null);function Ks(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=sr(n,s),l=cr(n,s),u=c._tag===`Success`?c.url:c._tag===`Failure`?a:null,d=u===null?null:u+Sn(i),f;return t[3]!==l||t[4]!==d||t[5]!==i?(f=(0,$.jsx)(ut,{src:d,originalUrl:i,label:`Pull request video`,className:`w-full`,videoClassName:`rounded-lg border border-border/60`,onRetry:l}),t[3]=l,t[4]=d,t[5]=i,t[6]=f):f=t[6],f}function qs(e){let t=(0,Q.c)(12),{text:n,cwd:r,environmentId:i,threadRef:a,className:o}=e,s=Ns(n),c=(0,Z.useContext)(Gs),l=c?.repositoryUrl,u=a??c?.threadRef??void 0,d=l??null,f;t[0]===d?f=t[1]:(f=Ws(d),t[0]=d,t[1]=f);let p=f,m;t[2]===o?m=t[3]:(m=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]=m);let h;t[4]!==r||t[5]!==i||t[6]!==p||t[7]!==u?(h=e=>{if(e.kind===`markdown`||e.media===`image`)return(0,$.jsx)(lt,{text:e.kind===`markdown`?e.text:``,cwd:r,threadRef:u,pullRequestPanelRef:u??Ot,environmentId:i,extraRemarkPlugins:p,githubMedia:!0},e.id);let t=e.media===`video`?ct(e.url):null;return t===null?e.media===`video`?(0,$.jsx)(ut,{src:e.url,originalUrl:e.url,label:`Pull request video`,className:`w-full`,videoClassName:`rounded-lg border border-border/60`},`${e.id}:${e.url}`):(0,$.jsxs)(`a`,{href:e.url,rel:`noreferrer noopener`,target:`_blank`,className:`flex items-center gap-2 rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-sm hover:bg-muted/60`,children:[(0,$.jsx)(k,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Open attachment on GitHub`}),(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-3 shrink-0 text-muted-foreground`})]},e.id):(0,$.jsx)(Ks,{environmentId:i,cwd:r,url:e.url,fetchUrl:t},`${e.id}:${e.url}`)},t[4]=r,t[5]=i,t[6]=p,t[7]=u,t[8]=h):h=t[8];let g=s.map(h),_;return t[9]!==m||t[10]!==g?(_=(0,$.jsx)(`div`,{className:m,"data-image-gallery":!0,children:g}),t[9]=m,t[10]=g,t[11]=_):_=t[11],_}function Js(e){let t=(0,Q.c)(52),{value:n,cwd:r,environmentId:i,threadRef:a,placeholder:o,label:s,saving:c,allowEmpty:l,className:u,onSave:d,onCancel:f}=e,p=a===void 0?null:a,m=l!==void 0&&l,h=wt(i,Be),[g,_]=(0,Z.useState)(n),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(n);b!==n&&(x(n),_(n));let S;t[0]===g?S=t[1]:(S=g.trim(),t[0]=g,t[1]=S);let C=S.length===0,w=!h||c||C&&!m,T;t[2]===u?T=t[3]:(T=G(`space-y-2`,u),t[2]=u,t[3]=T);let E;t[4]!==g||t[5]!==i||t[6]!==f||t[7]!==d||t[8]!==w||t[9]!==c?(E=e=>{e.nativeEvent.isComposing||e.keyCode===229||(e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey?(e.preventDefault(),e.stopPropagation(),!w&&!e.repeat&&Tt(i,`source-control:write`)&&d(g)):e.key!==`Escape`||c||(e.preventDefault(),f()))},t[4]=g,t[5]=i,t[6]=f,t[7]=d,t[8]=w,t[9]=c,t[10]=E):E=t[10];let D=v?`preview`:`write`,O;t[11]===D?O=t[12]:(O=[D],t[11]=D,t[12]=O);let k,A,j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=e[0];(t===`write`||t===`preview`)&&y(t===`preview`)},j=(0,$.jsx)(An,{value:`write`,children:`Write`}),k=(0,$.jsx)(An,{value:`preview`,children:`Preview`}),t[13]=k,t[14]=A,t[15]=j):(k=t[13],A=t[14],j=t[15]);let M;t[16]!==c||t[17]!==O?(M=(0,$.jsxs)(kn,{"aria-label":`Markdown editor mode`,variant:`segmented`,value:O,disabled:c,onValueChange:A,children:[j,k]}),t[16]=c,t[17]=O,t[18]=M):M=t[18];let N;t[19]!==r||t[20]!==g||t[21]!==C||t[22]!==i||t[23]!==s||t[24]!==o||t[25]!==v||t[26]!==c||t[27]!==p?(N=v?(0,$.jsx)(`div`,{className:`rounded-lg border border-border/60 px-3 py-2`,children:C?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Nothing to preview.`}):(0,$.jsx)(qs,{text:g,cwd:r,environmentId:i,threadRef:p})}):(0,$.jsx)(Dn,{autoFocus:!0,disabled:c,value:g,rows:6,placeholder:o,"aria-label":s,onChange:e=>_(e.target.value)}),t[19]=r,t[20]=g,t[21]=C,t[22]=i,t[23]=s,t[24]=o,t[25]=v,t[26]=c,t[27]=p,t[28]=N):N=t[28];let P;t[29]!==f||t[30]!==c?(P=(0,$.jsx)(W,{size:`xs`,variant:`ghost`,disabled:c,onClick:f,children:`Cancel`}),t[29]=f,t[30]=c,t[31]=P):P=t[31];let F=!h||c||C&&!m,I;t[32]!==m||t[33]!==g||t[34]!==C||t[35]!==i||t[36]!==d||t[37]!==c?(I=()=>{!Tt(i,`source-control:write`)||c||C&&!m||d(g)},t[32]=m,t[33]=g,t[34]=C,t[35]=i,t[36]=d,t[37]=c,t[38]=I):I=t[38];let L=c?`Saving...`:`Save`,R;t[39]!==F||t[40]!==I||t[41]!==L?(R=(0,$.jsx)(W,{size:`xs`,variant:`outline`,disabled:F,onClick:I,children:L}),t[39]=F,t[40]=I,t[41]=L,t[42]=R):R=t[42];let z;t[43]!==P||t[44]!==R?(z=(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[P,R]}),t[43]=P,t[44]=R,t[45]=z):z=t[45];let B;return t[46]!==M||t[47]!==N||t[48]!==z||t[49]!==T||t[50]!==E?(B=(0,$.jsxs)(`div`,{className:T,onKeyDown:E,children:[M,N,z]}),t[46]=M,t[47]=N,t[48]=z,t[49]=T,t[50]=E,t[51]=B):B=t[51],B}var Ys=[`thumbs-up`,`thumbs-down`,`laugh`,`hooray`,`confused`,`heart`,`rocket`,`eyes`],Xs={"thumbs-up":`👍`,"thumbs-down":`👎`,laugh:`😄`,hooray:`🎉`,confused:`😕`,heart:`❤️`,rocket:`🚀`,eyes:`👀`},Zs={"thumbs-up":`thumbs up`,"thumbs-down":`thumbs down`,laugh:`laugh`,hooray:`hooray`,confused:`confused`,heart:`heart`,rocket:`rocket`,eyes:`eyes`};function Qs(e){return Xs[e]}function $s(e){return Zs[e]}var ec=3;function tc(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 nc(e,t){return t?`${e} ${e===1?`other`:`others`}`:`${e} ${e===1?`person`:`people`}`}function rc(e){let t=e.actors.length<e.count,n=(e.viewerHasReacted&&t?[`You`,...e.actors]:[...e.actors]).slice(0,Math.min(ec,e.count)),r=Math.max(0,e.count-n.length);return`${tc([...n,...r>0?[nc(r,n.length>0)]:[]])} reacted with ${$s(e.content)} emoji`}function ic(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 Ys.flatMap(e=>n.get(e)??[])}var ac=`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`,oc=new Map;function sc(e){return e.map(e=>`${e.content}:${e.count}:${+!!e.viewerHasReacted}`).join(` `)}function cc(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:oc},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=Dt(Jr.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=sc(n),d=f.signature===e?f.values:oc,m=ic(n,d),b=async(t,n)=>{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}}),gt.add({type:`error`,title:`The reaction could not be saved`})):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":`${$s(e.content)}, ${e.count}`,disabled:!r,className:G(ac,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:Qs(e.content)}),(0,$.jsx)(`span`,{className:`tabular-nums`,children:e.count})]}),(0,$.jsx)(J,{side:`top`,children:rc(e)})]},e.content)),v=r?(0,$.jsxs)(nr,{open:l,onOpenChange:u,children:[(0,$.jsx)(tr,{render:(0,$.jsx)(`button`,{type:`button`,"aria-label":`Add a reaction`,className:G(ac,`border-border/70 px-1.5 text-muted-foreground hover:border-primary/60 hover:text-foreground`)}),children:(0,$.jsx)(Me,{"aria-hidden":!0,className:`size-3.5`})}),(0,$.jsx)($n,{align:`start`,side:`top`,padding:`compact`,children:(0,$.jsx)(`div`,{className:`flex items-center gap-0.5`,children:Ys.map(e=>{let t=m.find(t=>t.content===e)?.viewerHasReacted??!1;return(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t,"aria-label":$s(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:Qs(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 lc=`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 text-sm shadow-sm`;function uc(e){return t=>{t.key===`Escape`&&e.onCancel&&(t.preventDefault(),e.onCancel()),yn(t,e.value,e.pending)&&(t.preventDefault(),e.onSubmit())}}function dc(e){return e===`left`?`deletions`:`additions`}function fc(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 pc(e){let t=(0,Q.c)(11),{comment:n,onRemove:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=G(lc,`border-dashed`),t[0]=i):i=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(je,{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)(Pe,{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:mc,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function mc(e){return e.stopPropagation()}function hc({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),[j,M]=(0,Z.useState)(!1),N=O?.threadId===e.id?O:null,P=ei(e.comments,N?.comments??[]),F=N===null?e.nextCommentsCursor??null:N.nextCursor,I=e.commentCount??P.length,L=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:mi(r.comments,t,n)}:r),w(null))},R=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}}},z=async()=>{if(!(F===null||j)){M(!0);try{let t=await f(F);if(t===null)return;k(n=>({threadId:e.id,comments:ei(n?.threadId===e.id?n.comments:[],t.comments),nextCursor:t.nextCursor}))}finally{M(!1)}}};return(0,$.jsxs)(`div`,{className:lc,contentEditable:!1,onPointerDown:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(at,{className:G(`size-3.5`,e.isResolved&&`text-success-foreground`),icon:e.isResolved?rt:ot}),(0,$.jsxs)(`button`,{type:`button`,className:`hover:text-foreground`,"aria-expanded":_,onClick:()=>v(e=>!e),children:[e.isResolved?`Resolved`:`Open`,` · `,I,` `,I===1?`comment`:`comments`]}),e.isOutdated?(0,$.jsx)(`span`,{children:`outdated`}):null,u?(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,className:`ml-auto`,disabled:s||c,onClick:u,children:[(0,$.jsx)(A,{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)(ta,{open:_,children:(0,$.jsxs)(ea,{children:[(0,$.jsx)(`div`,{className:`mt-2 space-y-3`,children:P.map(e=>(0,$.jsxs)(`article`,{className:`group min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(Ar,{actor:e.author}),(0,$.jsx)(`span`,{children:Cn(e.createdAt)}),(0,$.jsx)(cc,{className:`ml-auto justify-end`,reactions:e.reactions??[],canReact:i,subjectId:e.id,environmentId:a,reference:o,onRefresh:g})]}),C===e.id?(0,$.jsx)(Js,{className:`mt-1`,value:e.body,cwd:t,environmentId:a,label:`Edit comment`,saving:T,onSave:t=>void L(e.id,t),onCancel:()=>w(null)}):(0,$.jsxs)(`div`,{className:`mt-1 flex items-start gap-1`,children:[(0,$.jsx)(qs,{className:`min-w-0 flex-1 text-sm`,text:e.body,cwd:t,environmentId:a}),p(e)?(0,$.jsx)(ys,{"aria-label":`Edit comment`,onClick:()=>w(e.id)}):null]})]},e.id))}),F===null?null:(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsx)(W,{size:`xs`,variant:`ghost`,disabled:j,onClick:()=>void z(),children:j?`Loading...`:`Load more comments`})}),n?y?(0,$.jsxs)(`div`,{className:`mt-2`,children:[(0,$.jsx)(Dn,{autoFocus:!0,size:`sm`,value:x,placeholder:`Reply`,"aria-label":`Reply to this conversation`,onChange:e=>S(e.target.value),onKeyDown:uc({value:x,pending:s,onSubmit:()=>void R(),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 R(),children:`Reply`})]})]}):(0,$.jsx)(W,{size:`xs`,variant:`ghost`,className:`mt-2`,onClick:()=>b(!0),children:`Reply`}):null]})})]})}function gc(e){return e.repositoryIdentity?.canonicalKey?.toLowerCase()}function _c(e,t,n){let r=new Map(t.map((e,t)=>[e,t])),i=new Map;for(let t of e){let e=gc(t);if(!e)continue;let a=r.get(t.environmentId);if(a===void 0)continue;let o=i.get(e);(o===void 0||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=gc(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 vc(e,t,n){let r=t.find(t=>t.environmentId===e.environmentId&&t.id===e.projectId),i=r===void 0?void 0:gc(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&&gc(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 yc(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 bc(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 xc(e,t){let n=(0,Q.c)(13),r=Xe(),i;n[0]!==e||n[1]!==t||n[2]!==r?(i=t===null?null:yc(r.filter(t=>t.environmentId===e).flatMap(Sc),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:Wr({environmentId:e,input:t}),n[4]=e,n[5]=t,n[6]=o):o=n[6];let s=Et(o),c;n[7]!==s||n[8]!==a?(c=bc(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 Sc(e){return e.pullRequests??[]}function Cc(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 wc=3e5,Tc=36e4;function Ec(e){return e.visible&&e.now-e.lastRefreshedAt>=1e4}function Dc(e){return e.lastRefreshedAt!==void 0&&Ec({...e,lastRefreshedAt:e.lastRefreshedAt})}function Oc(e){return e.now-e.lastInteractedAt<36e4&&Ec(e)}var kc=new Map,Ac=0,jc=new Set,Mc=[`pointerdown`,`pointermove`,`keydown`,`wheel`],Nc=()=>{let e=Date.now(),t=e-Ac>=Tc;if(Ac=e,t)for(let e of jc)e()};function Pc(e){if(jc.size===0){Ac=Date.now();for(let e of Mc)document.addEventListener(e,Nc,{passive:!0})}return jc.add(e),()=>{if(jc.delete(e),!(jc.size>0))for(let e of Mc)document.removeEventListener(e,Nc)}}function Fc(e,t={}){let{enabled:n=!0,key:r,intervalMs:i=wc}=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&&(kc.set(s,e),a.current())},t=()=>document.visibilityState===`visible`,r=()=>{let n=Date.now();if(n-Ac>=36e4)return;let r=kc.get(s);r===void 0?kc.set(s,n):Dc({visible:t(),now:n,lastRefreshedAt:r})&&e(n)},o=()=>{let n=Date.now(),r=kc.get(s)??n;Oc({visible:t(),now:n,lastRefreshedAt:r,lastInteractedAt:Ac})&&e(n)},c,l=()=>{clearInterval(c),c=t()?setInterval(o,i):void 0},u=()=>{r(),l()},d=Pc(()=>{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 Ic(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=Lr({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 Lc(e){let t=(0,Q.c)(14),{stack:n,reference:r,onSelect:i,pending:a}=e,o=a!==void 0&&a,s;if(t[0]!==i||t[1]!==o||t[2]!==r||t[3]!==n.layers){let e;t[5]!==i||t[6]!==o||t[7]!==r?(e=e=>(0,$.jsxs)(ke,{onClick:()=>{i?.({...r,number:e.number})},disabled:!i||o,"aria-current":e.number===r.number?`true`:void 0,children:[(0,$.jsx)(Ic,{layer:e}),e.number===r.number?(0,$.jsx)(x,{"aria-hidden":!0,className:`size-3.5`}):null]},e.number),t[5]=i,t[6]=o,t[7]=r,t[8]=e):e=t[8],s=n.layers.toReversed().map(e),t[0]=i,t[1]=o,t[2]=r,t[3]=n.layers,t[4]=s}else s=t[4];let c;t[9]===n.base?c=t[10]:(c=(0,$.jsxs)(re,{children:[`↳ `,n.base]}),t[9]=n.base,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,$.jsxs)(`div`,{className:`max-h-80 overflow-y-auto`,children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Rc(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)(re,{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 zc(e){let t=(0,Q.c)(108),{hostLabel:n,stack:r,reference:i,environmentId:a,stale:s,canMerge:c,canRebase:l,mergeMethod:u,onSelect:d,onActed:f,notice:p,onRetry:h}=e,[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(!1),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S={reportFailure:!1},t[0]=S):S=t[0];let C=Dt(Jr.runAction,S),w,T,E,D,O,k,A,j,M,N,P,F;if(t[1]!==c||t[2]!==l||t[3]!==v||t[4]!==a||t[5]!==n||t[6]!==u||t[7]!==p||t[8]!==f||t[9]!==h||t[10]!==d||t[11]!==g||t[12]!==b||t[13]!==i||t[14]!==C||t[15]!==r||t[16]!==s){let e=r.layers.at(-1),S=r.layers.filter(Yc),L=S.some(Jc),z;t[29]===i?z=t[30]:(z=e=>e.number===i.number,t[29]=i,t[30]=z);let B=r.layers.findIndex(z)+1,V=r.layers.slice(0,B).filter(qc),ee=r.layers[B-1],H=V.some(Kc),U=S.flatMap(Gc).length!==S.length,te=b||s||ee?.state!==`open`||V.some(Wc)||H||V.length===0||V.some(Uc),ne=b||s||U||L||S.length===0;D=async()=>{if(b||!v||(v===`merge`?!c||te:!l||ne))return;let t=v,o=t===`merge`?ee:e;if(!o?.headSha)return;let s=(t===`merge`?V:S).flatMap(Hc);x(!0),y(null);let d=gt.add({type:`loading`,title:t===`merge`?`Merging stack...`:`Rebasing stack...`}),p=await C({environmentId:a,input:{...i,number:o.number,stackNumber:r.number,expectedStackHeads:s,action:t,...t===`merge`?{mergeMethod:u}:{updateMethod:`rebase`}}});x(!1),f(),p._tag===`Failure`?gt.update(d,{type:`error`,title:t===`merge`?`Could not merge the stack`:`Could not rebase the stack`,description:ai(Ve(p),t===`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.`:`The host refused the rebase. A rebase stops at the first commit that does not apply cleanly.`)}):gt.update(d,{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=v===`merge`?V:S,ie=`Stack ${r.number}, layer ${B} of ${r.layers.length}`,oe;t[31]===ie?oe=t[32]:(oe=(0,$.jsx)(W,{variant:`ghost`,size:`xs`,"aria-label":ie}),t[31]=ie,t[32]=oe);let se;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(X.stack,{"aria-hidden":!0,className:`size-3.5`}),t[33]=se):se=t[33];let ce;t[34]===h?ce=t[35]:(ce=h?(0,$.jsx)(m,{"aria-hidden":!0,className:`size-3 text-warning`}):null,t[34]=h,t[35]=ce);let le;t[36]!==B||t[37]!==r.layers.length||t[38]!==oe||t[39]!==ce?(le=(0,$.jsx)(q,{render:(0,$.jsxs)(ae,{render:oe,children:[se,` `,B,`/`,r.layers.length,ce]})}),t[36]=B,t[37]=r.layers.length,t[38]=oe,t[39]=ce,t[40]=le):le=t[40];let ue=p?` · ${p}`:null,de;t[41]!==B||t[42]!==r.layers.length||t[43]!==r.number||t[44]!==ue?(de=(0,$.jsxs)(J,{children:[`View stack #`,r.number,`, layer `,B,` of `,r.layers.length,ue]}),t[41]=B,t[42]=r.layers.length,t[43]=r.number,t[44]=ue,t[45]=de):de=t[45];let fe;t[46]!==le||t[47]!==de?(fe=(0,$.jsxs)(Y,{children:[le,de]}),t[46]=le,t[47]=de,t[48]=fe):fe=t[48];let pe=!!h,me;t[49]!==p||t[50]!==r.number||t[51]!==pe?(me=(0,$.jsx)(Rc,{number:r.number,notice:p,stale:pe}),t[49]=p,t[50]=r.number,t[51]=pe,t[52]=me):me=t[52];let he;t[53]===h?he=t[54]:(he=h?(0,$.jsx)(ke,{onClick:h,children:`Retry stack refresh`}):null,t[53]=h,t[54]=he);let ge;t[55]===d?ge=t[56]:(ge=d?e=>{_(!1),d(e)}:void 0,t[55]=d,t[56]=ge);let _e;t[57]!==b||t[58]!==i||t[59]!==r||t[60]!==ge?(_e=(0,$.jsx)(Lc,{stack:r,reference:i,pending:b,onSelect:ge}),t[57]=b,t[58]=i,t[59]=r,t[60]=ge,t[61]=_e):_e=t[61];let ve;t[62]!==me||t[63]!==he||t[64]!==_e?(ve=(0,$.jsxs)(o,{children:[me,he,_e]}),t[62]=me,t[63]=he,t[64]=_e,t[65]=ve):ve=t[65];let ye=c||l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{}),c?(0,$.jsxs)(ke,{disabled:te,onClick:()=>y(`merge`),children:[(0,$.jsx)(X.merged,{"aria-hidden":!0}),`Merge stack (`,V.length,`)`]}):null,l?(0,$.jsxs)(ke,{disabled:ne,onClick:()=>y(`update-branch`),children:[(0,$.jsx)(R,{"aria-hidden":!0}),`Rebase stack`]}):null,H||V.some(Vc)?(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,be;t[66]!==ve||t[67]!==ye?(be=(0,$.jsxs)(we,{align:`start`,children:[ve,ye]}),t[66]=ve,t[67]=ye,t[68]=be):be=t[68],t[69]!==g||t[70]!==fe||t[71]!==be?(P=(0,$.jsxs)(I,{open:g,onOpenChange:_,children:[fe,be]}),t[69]=g,t[70]=fe,t[71]=be,t[72]=P):P=t[72],F=c&&ee?.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:te&&!s,"aria-disabled":te||void 0,"aria-description":s?p??void 0:void 0,onClick:te?void 0:()=>y(`merge`),children:[(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),`Merge stack`]})})}),(0,$.jsx)(J,{children:s?p:`Merge stack through #${i.number} into ${r.base} (${V.length} ${V.length===1?`pull request`:`pull requests`})`})]}):null,E=Gn,M=v!==null,t[73]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{e||y(null)},t[73]=N):N=t[73],T=Wn,A=`max-w-md`;let xe=v===`merge`?`Merge ${V.length} pull requests?`:`Rebase ${S.length} pull requests?`,Se;t[74]===xe?Se=t[75]:(Se=(0,$.jsx)(Bn,{children:xe}),t[74]=xe,t[75]=Se);let Ce=v===`merge`?`Merge #${i.number} and its unmerged layers below into ${r.base} using ${u}. ${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.`,Te;t[76]===Ce?Te=t[77]:(Te=(0,$.jsx)(Un,{children:Ce}),t[76]=Ce,t[77]=Te),t[78]!==Se||t[79]!==Te?(j=(0,$.jsxs)(zn,{children:[Se,Te]}),t[78]=Se,t[79]=Te,t[80]=j):j=t[80],w=Hn,O=`max-h-48 space-y-1 overflow-y-auto text-sm`,k=re.map(Bc),t[1]=c,t[2]=l,t[3]=v,t[4]=a,t[5]=n,t[6]=u,t[7]=p,t[8]=f,t[9]=h,t[10]=d,t[11]=g,t[12]=b,t[13]=i,t[14]=C,t[15]=r,t[16]=s,t[17]=w,t[18]=T,t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A,t[24]=j,t[25]=M,t[26]=N,t[27]=P,t[28]=F}else w=t[17],T=t[18],E=t[19],D=t[20],O=t[21],k=t[22],A=t[23],j=t[24],M=t[25],N=t[26],P=t[27],F=t[28];let L;t[81]!==O||t[82]!==k?(L=(0,$.jsx)(`ul`,{className:O,children:k}),t[81]=O,t[82]=k,t[83]=L):L=t[83];let z;t[84]!==w||t[85]!==L?(z=(0,$.jsx)(w,{children:L}),t[84]=w,t[85]=L,t[86]=z):z=t[86];let B;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(W,{variant:`outline`,onClick:()=>y(null),children:`Cancel`}),t[87]=B):B=t[87];let V;t[88]===D?V=t[89]:(V=()=>void D(),t[88]=D,t[89]=V);let ee=v===`merge`?`Merge stack`:`Rebase stack`,H;t[90]!==V||t[91]!==ee?(H=(0,$.jsxs)(Vn,{children:[B,(0,$.jsx)(W,{onClick:V,children:ee})]}),t[90]=V,t[91]=ee,t[92]=H):H=t[92];let U;t[93]!==T||t[94]!==z||t[95]!==H||t[96]!==A||t[97]!==j?(U=(0,$.jsxs)(T,{className:A,children:[j,z,H]}),t[93]=T,t[94]=z,t[95]=H,t[96]=A,t[97]=j,t[98]=U):U=t[98];let te;t[99]!==E||t[100]!==U||t[101]!==M||t[102]!==N?(te=(0,$.jsx)(E,{open:M,onOpenChange:N,children:U}),t[99]=E,t[100]=U,t[101]=M,t[102]=N,t[103]=te):te=t[103];let ne;return t[104]!==te||t[105]!==P||t[106]!==F?(ne=(0,$.jsxs)($.Fragment,{children:[P,F,te]}),t[104]=te,t[105]=P,t[106]=F,t[107]=ne):ne=t[107],ne}function Bc(e){return(0,$.jsx)(`li`,{className:`flex items-center gap-2 rounded-md bg-muted/50 px-3 py-2`,children:(0,$.jsx)(Ic,{layer:e,compact:!0})},e.number)}function Vc(e){return e.isDraft}function Hc(e){return e.headSha?[{number:e.number,headSha:e.headSha}]:[]}function Uc(e){return e.isDraft}function Wc(e){return!e.headSha}function Gc(e){return e.headSha?[{number:e.number,headSha:e.headSha}]:[]}function Kc(e){return e.state!==`open`}function qc(e){return e.state!==`merged`}function Jc(e){return e.state!==`open`}function Yc(e){return e.state!==`merged`}var Xc={code:`Code`,tests:`Tests`,mocks:`Mocks`,generated:`Generated`,docs:`Docs`};function Zc(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?Jr.changeBreakdown({environmentId:n,input:r}):null,t[0]=n,t[1]=r,t[2]=c,t[3]=u):u=t[3];let d=Et(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)(Dr,{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)($c,{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 Qc(e){let t=(0,Q.c)(8),{environmentId:n,reference:r,className:i}=e,a;t[0]!==n||t[1]!==r?(a=Jr.changeBreakdown({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=Et(a);if(!o.data)return null;let s;t[3]===o.data?s=t[4]:(s=(0,$.jsx)($c,{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 $c(e){let t=(0,Q.c)(8),{breakdown:n,total:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Object.keys(Xc),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)(el,{label:Xc[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)(el,{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 el(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=_r(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=_r(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 tl(e){let t=(0,Q.c)(3),n=Ze();if(kr(n.get(e.environmentId)?.environment.capabilities)===`unsupported`)return null;let r=`${e.environmentId}:${e.url}`,i;return t[0]!==e||t[1]!==r?(i=(0,$.jsx)(nl,{...e},r),t[0]=e,t[1]=r,t[2]=i):i=t[2],i}function nl({environmentId:e,reference:t,url:n,threadRef:r,display:i,onPickerOpenChange:a}){let o=Ke(n),s=Ye(r?.environmentId===e?r:null),c=s===null?null:r,l=jr(e),u=l.isLinked(s,n),d=Et(l.mode===`multiple`&&i!==`menu-item`?Jr.linkedThreads({environmentId:e,input:o===null?t:{...t,...We(o)}}):null),[f,p]=(0,Z.useState)(d.data);d.data!==null&&d.data!==f&&p(d.data);let[m,h]=(0,Z.useState)(!1),g=async(r,i)=>{if(!(o===null||m)){h(!0);try{await l.changeLink(N(e,r),n,!i)}catch(e){gt.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{h(!1)}l.mode===`multiple`&&j.refresh(Jr.linkedThreads({environmentId:e,input:{...t,...We(o)}})),a?.(!1)}};if(o===null||!u&&!l.canLink(n))return null;let _=l.mode===`multiple`?(d.data??f)?.threads??[]:[],v=_.length>0?`Linked from ${_.length} ${_.length===1?`thread`:`threads`}`:`Linked threads`;return(0,$.jsxs)($.Fragment,{children:[i===`count`&&(_.length>0||d.error!==null)?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,"aria-label":v,onClick:()=>pa({query:n,...(d.data??f)===null?{}:{linkedThreads:{environmentId:e,threads:_}}}),children:[(0,$.jsx)(je,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{"aria-hidden":!0,children:_.length||`?`})]})}),(0,$.jsxs)(J,{children:[v,`. Search in the command palette.`]})]}):null,i===`menu-item`?(0,$.jsxs)(ke,{disabled:m,onClick:()=>{c===null?a?.(!0):g(c.threadId,u)},children:[u?(0,$.jsx)(X.unlink,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(X.link,{"aria-hidden":!0,className:`size-3.5`}),u?`Unlink from this thread`:c?`Link to this thread`:`Link to thread`]}):null,i===`picker`?(0,$.jsx)(Gn,{open:!0,onOpenChange:a,children:(0,$.jsxs)(Wn,{className:`max-w-md`,showCloseButton:!1,children:[(0,$.jsx)(Bn,{className:`sr-only`,children:`Link pull request to a thread`}),(0,$.jsx)(rl,{environmentId:e,url:n,pending:m,onSelect:e=>void g(e,!1)})]})}):null]})}function rl(e){let t=(0,Q.c)(36),{environmentId:n,url:r,pending:i,onSelect:a}=e,o=Xe(),s=jr(n),c=Je(),[l,u]=(0,Z.useState)(``),d;if(t[0]!==n||t[1]!==c){let e;t[3]===n?e=t[4]:(e=e=>e.environmentId===n,t[3]=n,t[4]=e),d=new Map(c.filter(e).map(al)),t[0]=n,t[1]=c,t[2]=d}else d=t[2];let f=d,p,m,h,g,_,v,y,b,S;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(il);m=Yi,_=`none`,v=l,y=u,b=`Choose a thread`,t[22]===i?S=t[23]:(S=(0,$.jsx)(Ji,{placeholder:`Search threads or projects...`,disabled:i}),t[22]=i,t[23]=S),p=qi,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)(Xi,{value:e.id,disabled:i||t,onClick:()=>a(e.id),children:[(0,$.jsx)(je,{"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)(x,{"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]=S}else p=t[13],m=t[14],h=t[15],g=t[16],_=t[17],v=t[18],y=t[19],b=t[20],S=t[21];let C;t[24]!==p||t[25]!==h||t[26]!==g?(C=(0,$.jsx)(p,{className:h,children:g}),t[24]=p,t[25]=h,t[26]=g,t[27]=C):C=t[27];let w;return t[28]!==m||t[29]!==_||t[30]!==v||t[31]!==y||t[32]!==b||t[33]!==S||t[34]!==C?(w=(0,$.jsxs)(m,{mode:_,value:v,onValueChange:y,"aria-label":b,children:[S,C]}),t[28]=m,t[29]=_,t[30]=v,t[31]=y,t[32]=b,t[33]=S,t[34]=C,t[35]=w):w=t[35],w}function il(e,t){return t.updatedAt.localeCompare(e.updatedAt)}function al(e){return[e.id,e.title]}function ol(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)(wr,{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)(ye,{"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)(Ae,{"aria-hidden":!0,className:`size-3.5 self-center`}),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-baseline 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-baseline 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 sl(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 cl(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)(An,{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)(kn,{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 ll(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 ul(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}=vt(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 dl(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 fl=[`w-3/5`,`w-2/5`,`w-1/2`,`w-2/3`,`w-2/5`,`w-3/5`,`w-1/2`],pl=[`w-2/5`,`w-1/3`,`w-2/5`,`w-1/4`,`w-1/3`,`w-2/5`,`w-1/3`],ml=[{value:`summary`,label:`Summary`},{value:`timeline`,label:`Timeline`},{value:`code`,label:`Code`}];function hl(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},gl),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 gl(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)(dl,{className:`size-4 rounded-full`}),(0,$.jsxs)(`div`,{className:`min-w-0 space-y-1.5`,children:[(0,$.jsx)(dl,{className:G(`h-4`,fl[t%fl.length])}),(0,$.jsx)(dl,{className:G(`h-3.5`,pl[t%pl.length])})]}),(0,$.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[(0,$.jsx)(dl,{className:`w-12`}),(0,$.jsx)(dl,{className:`w-16`})]})]},t)}function _l(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?ml:o,p,m;t[0]!==n||t[1]!==r?(p=r?{...n,...r,isDraft:r.isDraft??n?.isDraft}:n,m=p?Lr({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`?zr(p.checksState):null,t[4]=p,t[5]=g);let _=g,v=a??null,y=r?.changedFiles??null,b;t[6]!==s||t[7]!==f?(b=f.find(e=>e.value===s)?.value??f[0]?.value??`summary`,t[6]=s,t[7]=f,t[8]=b):b=t[8];let x=b,S=!p&&`motion-safe:animate-skeleton`,C;t[9]===S?C=t[10]:(C=G(`flex h-full min-h-0 flex-col overflow-hidden bg-background`,S),t[9]=S,t[10]=C);let w;t[11]===l?w=t[12]:(w=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)(ye,{"aria-hidden":!0,className:`size-3.5`})}):null,t[11]=l,t[12]=w);let T;t[13]!==c||t[14]!==p||t[15]!==h?.toneClassName?(T=p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:p.repository}),(0,$.jsxs)(le,{onClick:()=>void bt()?.shell.openExternal(p.url),"aria-label":`Open pull request #${p.number} on host`,children:[(0,$.jsxs)(`span`,{className:h?.toneClassName,children:[`#`,p.number]}),(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-2.5`})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dl,{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]=T):T=t[16];let E;t[17]!==w||t[18]!==T?(E=(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:[w,T]})}),t[17]=w,t[18]=T,t[19]=E):E=t[19];let D;t[20]===i?D=t[21]:(D=i??(0,$.jsx)(dl,{className:`h-6 w-16 rounded-md`}),t[20]=i,t[21]=D);let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Pull request actions loading`,children:(0,$.jsx)(ee,{"aria-hidden":!0,className:`size-4`})}),t[22]=O):O=t[22];let k;t[23]===u?k=t[24]:(k=u?(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":`Collapse pull request panel`,onClick:u,children:(0,$.jsx)(Ne,{"aria-hidden":!0,className:`size-3.5`})}):null,t[23]=u,t[24]=k);let A;t[25]!==D||t[26]!==k?(A=(0,$.jsxs)(`div`,{className:`mr-4 flex h-7 shrink-0 items-center justify-end gap-1`,children:[D,O,k]}),t[25]=D,t[26]=k,t[27]=A):A=t[27];let j,M,N;t[28]===p?(j=t[29],M=t[30],N=t[31]):(j=(0,$.jsx)(sl,{children:p?(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold leading-snug`,children:p.title}):(0,$.jsx)(dl,{className:`h-5 w-4/5 max-w-md`})}),M=p?(0,$.jsx)(Ar,{actor:p.author??null,tooltip:!1}):(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(dl,{className:`size-4 rounded-full`}),(0,$.jsx)(dl,{className:`h-3 w-14`})]}),N=p?(0,$.jsxs)(`span`,{children:[`updated `,Cn(p.updatedAt)]}):(0,$.jsx)(dl,{className:`h-3 w-16`}),t[28]=p,t[29]=j,t[30]=M,t[31]=N);let P;t[32]!==v||t[33]!==d?(P=v?(0,$.jsx)(ul,{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]=P):P=t[34];let I,L;t[35]===p?(I=t[36],L=t[37]):(I=(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)(va,{value:p.baseBranch})}):(0,$.jsx)(dl,{className:`h-3 w-12`})}),L=p?(0,$.jsx)(ul,{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)(dl,{className:`h-3 w-32 flex-1`}),t[35]=p,t[36]=I,t[37]=L);let R;t[38]===y?R=t[39]:(R=y===null?(0,$.jsx)(dl,{className:`h-3 w-10`}):`${y.toLocaleString()} ${y===1?`file`:`files`}`,t[38]=y,t[39]=R);let z;t[40]===p?z=t[41]:(z=p?(0,$.jsx)(Dr,{additions:p.additions??0,deletions:p.deletions??0,className:`shrink-0 font-mono text-xs`}):(0,$.jsx)(dl,{className:`h-3 w-20`}),t[40]=p,t[41]=z);let B;t[42]!==j||t[43]!==M||t[44]!==N||t[45]!==P||t[46]!==I||t[47]!==L||t[48]!==R||t[49]!==z?(B=(0,$.jsx)(`div`,{className:`col-span-2 grid grid-rows-[1fr]`,children:(0,$.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,$.jsx)(ol,{title:j,author:M,updated:N,checkout:P,base:I,head:L,files:R,diffStat:z})})}),t[42]=j,t[43]=M,t[44]=N,t[45]=P,t[46]=I,t[47]=L,t[48]=R,t[49]=z,t[50]=B):B=t[50];let V;t[51]===_?V=t[52]:(V=_?(0,$.jsx)(ll,{className:_.toneClassName,icon:(0,$.jsx)(_.Icon,{"aria-hidden":!0,className:`size-3.5`}),label:_.label}):(0,$.jsx)(ll,{icon:(0,$.jsx)(dl,{className:`my-px size-3.5 rounded-full`}),label:(0,$.jsx)(dl,{className:`w-28`})}),t[51]=_,t[52]=V);let H;t[53]!==x||t[54]!==V||t[55]!==f?(H=(0,$.jsx)(cl,{tabs:f,value:x,inert:!0,children:V}),t[53]=x,t[54]=V,t[55]=f,t[56]=H):H=t[56];let U;t[57]!==A||t[58]!==B||t[59]!==H||t[60]!==E?(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:[E,A,B,H]}),t[57]=A,t[58]=B,t[59]=H,t[60]=E,t[61]=U):U=t[61];let te;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(ne,{"aria-hidden":!0,className:`size-3.5`}),`Reviewers`]}),t[62]=te):te=t[62];let re;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(dl,{className:`h-3 w-10`}),t[63]=re):re=t[63];let ie;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(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:[te,(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-foreground`,children:[re,(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Reviewers loading`,children:(0,$.jsx)(F,{"aria-hidden":!0,className:`size-3.5`})})]})]}),t[64]=ie):ie=t[64];let ae;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,$.jsx)(fe,{"aria-hidden":!0,className:`size-3.5`}),`Labels`]}),t[65]=ae):ae=t[65];let oe;t[66]===n?oe=t[67]:(oe=n?.labels?n.labels.length>0?n.labels.map(vl):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dl,{className:`h-4.5 w-24`}),(0,$.jsx)(dl,{className:`h-4.5 w-20`})]}),t[66]=n,t[67]=oe);let se;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,disabled:!0,"aria-label":`Labels loading`,children:(0,$.jsx)(fe,{"aria-hidden":!0,className:`size-3.5`})}),t[68]=se):se=t[68];let ce;t[69]===oe?ce=t[70]:(ce=(0,$.jsx)(`section`,{className:`px-4 pt-2.5 pb-1`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[ie,(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:[ae,(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1 text-foreground`,children:[oe,se]})]})]})}),t[69]=oe,t[70]=ce);let ue;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(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)(pe,{"aria-hidden":!0,className:`size-3.5 rotate-90 text-muted-foreground/60`})]})}),t[71]=ue):ue=t[71];let de;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(dl,{className:`h-5 w-40`}),t[72]=de):de=t[72];let me;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsxs)(`section`,{children:[ue,(0,$.jsxs)(`div`,{className:`space-y-3 px-4 pb-4`,children:[de,(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(dl,{className:`h-4 w-full`}),(0,$.jsx)(dl,{className:`h-4 w-11/12`}),(0,$.jsx)(dl,{className:`h-4 w-4/5`}),(0,$.jsx)(dl,{className:`h-4 w-2/3`})]})]})]}),t[73]=me):me=t[73];let he;t[74]===ce?he=t[75]:(he=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:[ce,me]}),t[74]=ce,t[75]=he);let ge;return t[76]!==U||t[77]!==he||t[78]!==C?(ge=(0,$.jsxs)(`div`,{role:`status`,"aria-label":`Loading pull request`,className:C,children:[U,he]}),t[76]=U,t[77]=he,t[78]=C,t[79]=ge):ge=t[79],ge}function vl(e){return(0,$.jsx)(Fr,{label:e,size:`default`,className:`max-w-48`},e.name)}function yl(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},bl)}),t[0]=r,t[1]=i),i}function bl(e,t){return(0,$.jsxs)(`div`,{className:`flex h-7 items-center gap-2 rounded-md px-2`,children:[(0,$.jsx)(dl,{className:`size-4 rounded-full`}),(0,$.jsx)(dl,{className:pl[t%pl.length]})]},t)}function xl(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},Sl)})}),t[0]=r,t[1]=i),i}function Sl(e,t){return(0,$.jsxs)(`div`,{className:`relative pb-5`,children:[(0,$.jsx)(dl,{className:`absolute -left-[1.55rem] top-1 size-2 rounded-full`}),(0,$.jsx)(dl,{className:G(`h-3.5`,fl[t%fl.length])}),(0,$.jsx)(dl,{className:`mt-1.5 w-16`})]},t)}function Cl(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},wl)}),t[0]=r,t[1]=i),i}function wl(e,t){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(dl,{className:`size-5 shrink-0 rounded-full`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(dl,{className:pl[t%pl.length]}),(0,$.jsx)(dl,{className:`w-full`}),(0,$.jsx)(dl,{className:`w-3/4`})]})]},t)}function Tl(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)(xa,{"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 El(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)(Kn,{variant:`icon`,children:(0,$.jsx)(X.pullRequest,{})}),t[0]=l):l=t[0];let u;t[1]===s?u=t[2]:(u=(0,$.jsx)(Jn,{children:s}),t[1]=s,t[2]=u);let d;t[3]===r?d=t[4]:(d=(0,$.jsx)(Yn,{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)(xa,{size:`sm`,refreshing:c}),`Retry`]}):null,o?(0,$.jsxs)(W,{size:`sm`,variant:`outline`,render:(0,$.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`}),children:[(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-3.5`}),`Open on GitHub`]}):null]}):null,t[8]=o,t[9]=i,t[10]=c,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,$.jsxs)(Xn,{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 Dl=e=>e===Vr?`Open on host`:`Open on ${e.label}`;function Ol(e){return[{id:`copy-link`,label:`Copy link`,icon:`copy`},{id:`open-external`,label:e}]}async function kl({url:e,openLabel:t,position:n}){let r=bt();if(!r)return;let i=null;try{i=await r.contextMenu.show(Ol(t),n)}catch{return}try{i===`copy-link`?await _t(e,`link`):i===`open-external`&&await r.shell.openExternal(e)}catch{gt.add({type:`error`,title:i===`copy-link`?`Could not copy the link`:`Could not open the link`})}}function Al(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=Dt(Jr.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();t.length===0||f!==null||a||(p(e),e===`comment`?(await h({environmentId:n,input:{...r,body:t}}))._tag===`Failure`?(p(null),gt.add({type:`error`,title:`Could not post the comment`})):(d(``),p(null),l(),c()):((await s(t,e)).commentPosted&&(d(``),l()),p(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,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)(Dn,{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)(ie,{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 jl=[{value:`comment`,label:`Comment`,sent:`Review submitted`,icon:(0,$.jsx)(je,{className:`size-3`})},{value:`approve`,label:`Approve`,sent:`Pull request approved`,icon:(0,$.jsx)(x,{className:`size-3`})},{value:`request-changes`,label:`Request changes`,sent:`Changes requested`,icon:(0,$.jsx)(B,{className:`size-3`})}];function Ml(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=Ii(r),p;t[0]===r?p=t[1]:(p=Fi(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=Pi(h),_=Pi(Ll),v=Pi(Il),y=Pi(Fl),b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},t[4]=b):b=t[4];let x=Dt(Jr.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=jl.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}});c(!1),a._tag===`Failure`?gt.add({type:`error`,title:`The review could not be submitted`,description:ai(Ve(a),`The host refused the review. Your draft is still here to try again.`)}):(_(m,i.map(Pl)),y(m,t),gt.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)(Dn,{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)(mt,{value:C?.value??null,disabled:s,onValueChange:e=>{e!==null&&d(e)},children:[(0,$.jsx)(pt,{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)(ft,{side:`top`,alignItemWithTrigger:!1,children:p.map(Nl)})]}):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 Nl(e){return(0,$.jsx)(dt,{value:e.value,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.icon,e.label]})},e.value)}function Pl(e){return e.id}function Fl(e){return e.clearSummary}function Il(e){return e.setSummary}function Ll(e){return e.removeComments}function Rl(e){let t=(0,Q.c)(63),{environmentId:n,reference:r,detail:i,actionPending:a,onCommentAction:o,onCommented:s,onReviewSubmitted:c,openReviewRequest:l}=e,[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(`comment`),g=(0,Z.useRef)(null),_=(0,Z.useRef)(null),v=Ii(r),y=Pi(zl),b;t[0]===r?b=t[1]:(b=Fi(r),t[0]=r,t[1]=b);let x=b,S;t[2]===x?S=t[3]:(S=e=>(e.summaries[x]??``).trim().length>0,t[2]=x,t[3]=S);let C=Pi(S),w=v.length>0||C,[T,E]=(0,Z.useState)(l);l!==T&&(E(l),h(`review`),d(!0));let D=i.capabilities.comment&&i.viewerPermissions.comment,O;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),O=i.capabilities.review.verdicts.filter(e),t[4]=i.capabilities.review.verdicts,t[5]=i.viewerPermissions,t[6]=O}else O=t[6];let k=O;if(!D&&k.length===0)return null;let A=D?k.length===0?`comment`:m:`review`,j;t[9]===w?j=t[10]:(j=e=>{e&&h(w?`review`:`comment`),d(e)},t[9]=w,t[10]=j);let M;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(W,{size:`icon`,variant:`glass`}),t[11]=M):M=t[11];let N=v.length>0?`Review pull request, ${v.length} ${v.length===1?`comment`:`comments`} pending`:w||!D?`Review pull request`:`Comment on pull request`,P;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(je,{className:`size-4`}),t[12]=P):P=t[12];let F;t[13]===v.length?F=t[14]:(F=v.length>0?(0,$.jsx)(`span`,{"aria-hidden":!0,className:`absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-info px-1 text-3xs font-semibold tabular-nums text-white`,children:v.length}):null,t[13]=v.length,t[14]=F);let I;t[15]!==N||t[16]!==F?(I=(0,$.jsxs)(tr,{render:M,"aria-label":N,children:[P,F]}),t[15]=N,t[16]=F,t[17]=I):I=t[17];let L=A===`review`?_:g,R;t[18]!==D||t[19]!==A||t[20]!==v.length||t[21]!==k.length?(R=D&&k.length>0?(0,$.jsxs)(kn,{"aria-label":`Composer mode`,variant:`segmented`,value:[A],onValueChange:e=>{let t=e[0];(t===`comment`||t===`review`)&&h(t)},children:[(0,$.jsx)(An,{value:`comment`,children:`Comment`}),(0,$.jsx)(An,{value:`review`,children:v.length>0?`Review (${v.length})`:`Review`})]}):(0,$.jsx)(Qn,{children:A===`review`?`Review pull request`:`Comment on pull request`}),t[18]=D,t[19]=A,t[20]=v.length,t[21]=k.length,t[22]=R):R=t[22];let z;t[23]!==y||t[24]!==A||t[25]!==v.length||t[26]!==x||t[27]!==f?(z=A===`review`&&v.length>0?(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":`Discard pending line comments`,title:`Discard pending line comments`,disabled:f,onClick:()=>y(x),children:(0,$.jsx)(Pe,{className:`size-3.5`})}):null,t[23]=y,t[24]=A,t[25]=v.length,t[26]=x,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 V;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(er,{render:B,"aria-label":`Close composer`,children:(0,$.jsx)(be,{className:`size-3.5`})}),t[30]=V):V=t[30];let ee;t[31]===z?ee=t[32]:(ee=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[z,V]}),t[31]=z,t[32]=ee);let H;t[33]!==R||t[34]!==ee?(H=(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[R,ee]}),t[33]=R,t[34]=ee,t[35]=H):H=t[35];let U;t[36]!==i.provider||t[37]!==n||t[38]!==A||t[39]!==c||t[40]!==r||t[41]!==f||t[42]!==k?(U=k.length>0?(0,$.jsx)(`div`,{hidden:A!==`review`,children:(0,$.jsx)(Ml,{environmentId:n,reference:r,verdicts:k,requestChangesSummaryRequired:Br.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]=A,t[39]=c,t[40]=r,t[41]=f,t[42]=k,t[43]=U):U=t[43];let te;t[44]!==a||t[45]!==D||t[46]!==i||t[47]!==n||t[48]!==A||t[49]!==o||t[50]!==s||t[51]!==r?(te=D?(0,$.jsx)(`div`,{hidden:A!==`comment`,children:(0,$.jsx)(Al,{environmentId:n,reference:r,detail:i,actionPending:a,textareaRef:g,onCommentAction:o,onCommented:s,onClose:()=>d(!1)})}):null,t[44]=a,t[45]=D,t[46]=i,t[47]=n,t[48]=A,t[49]=o,t[50]=s,t[51]=r,t[52]=te):te=t[52];let ne;t[53]!==L||t[54]!==H||t[55]!==U||t[56]!==te?(ne=(0,$.jsxs)($n,{keepMounted:!0,side:`top`,align:`end`,sideOffset:8,width:`lg`,initialFocus:L,"aria-label":`Pull request composer`,children:[H,U,te]}),t[53]=L,t[54]=H,t[55]=U,t[56]=te,t[57]=ne):ne=t[57];let re;return t[58]!==u||t[59]!==ne||t[60]!==j||t[61]!==I?(re=(0,$.jsxs)(nr,{open:u,onOpenChange:j,children:[I,ne]}),t[58]=u,t[59]=ne,t[60]=j,t[61]=I,t[62]=re):re=t[62],re}function zl(e){return e.clear}function Bl(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)=>{!e&&t.reason===`item-press`?t.cancel():s(e)},t[15]=s,t[16]=E);let D;t[17]!==n||t[18]!==r?(D=(0,$.jsx)(Mn,{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)(Fn,{"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)(yl,{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)(Pn,{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)(jn,{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)(Nn,{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)(In,{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 Vl(e,t){if(t.length===0)return!0;let n=t.toLowerCase();return e.name.toLowerCase().includes(n)||(e.description??``).toLowerCase().includes(n)}function Hl(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?Jr.labelCandidates({environmentId:n,input:r}):null,t[0]=n,t[1]=a,t[2]=r,t[3]=d):d=t[3];let f=Et(d),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={reportFailure:!1},t[4]=p):p=t[4];let m=Dt(Jr.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=>Vl(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}});u(null),t._tag===`Failure`&>.add({type:`error`,title:e.isApplied?`Could not take ${e.name} off`:`Could not put ${e.name} on`,description:ai(Ve(t),`The host refused it. Check that you have triage access on this repository.`)})},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)(fe,{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)(Bl,{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:Wl,disabled:w,onSelect:T,children:Ul}),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 Ul(e){let t=Ur(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)(x,{"aria-label":`Applied`,className:`size-3.5 shrink-0`}):null]})}function Wl(e){return e.name}function Gl(e,t){if(t.length===0)return!0;let n=t.toLowerCase();return e.login.toLowerCase().includes(n)||(e.name??``).toLowerCase().includes(n)}function Kl(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?Jr.reviewerCandidates({environmentId:n,input:r}):null,t[0]=n,t[1]=a,t[2]=r,t[3]=d):d=t[3];let f=Et(d),p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p={reportFailure:!1},t[4]=p):p=t[4];let m=Dt(Jr.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=>Gl(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}});u(null),t._tag===`Failure`?gt.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:ai(Ve(t),`The host refused it. Check that you have write access on this repository, and that they still have access to it.`)}):gt.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)(F,{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)(Bl,{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:Jl,disabled:w,onSelect:T,children:ql}),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 ql(e){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ar,{actor:e,className:`flex-1`}),e.kind===`team`?(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`team`}):null,e.isRequested?(0,$.jsx)(x,{"aria-label":`Already asked`,className:`size-3.5 shrink-0`}):null]})}function Jl(e){return`${e.kind}:${e.id}`}function Yl(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)(qs,{...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 Xl=1;function Zl(e){let t=e.sectionTop<e.viewportTop,n=e.headingTop<=e.viewportTop+Xl;return!t||!n?null:Math.max(0,e.scrollTop+e.sectionTop-e.viewportTop)}function Ql(e){return e.toLowerCase()}function $l(e){let t=(0,Q.c)(27),{comment:n,detail:r}=e,i=n.author,a;t[0]!==i||t[1]!==r?(a=i?Br.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)(Ar,{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=Cn(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 eu(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 tu(e){let t=e.toLowerCase().replace(/_/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function nu(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)(Js,{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)(Yl,{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)(ys,{"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 ru(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)($l,{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)(he,{"aria-hidden":!0,className:m}),t[5]=m,t[6]=h);let g;t[7]!==i||t[8]!==h?(g=(0,$.jsxs)(oa,{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)(eu,{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)(oa,{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)(nu,{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)(ea,{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)(ta,{open:l,onOpenChange:u,children:C}),t[34]=l,t[35]=C,t[36]=w):w=t[36],w}function iu(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 au(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=Zl({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)(pe,{"aria-hidden":!0,className:_}),t[7]=_,t[8]=v);let y;t[9]!==h||t[10]!==v?(y=(0,$.jsxs)(oa,{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)(ea,{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)(ta,{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 ou=10,su=`p4code:pull-request-comment-filter:v1`,cu=Re({bots:Fe,resolved:Fe}),lu={bots:!1,resolved:!1};function uu(e){let t=(0,Q.c)(110),{scrollerRef:n,environmentId:r,threadRef:i,reference:a,detail:s,activityPending:c,checksStale:l,activityError:u,pendingFinding:d,fixFindingLabel:f,fixCheckLabel:p,onFixFinding:m,onRefresh:h,onRefreshChecks:g}=e,_=l!==void 0&&l,v=f===void 0?`Fix in a thread`:f,y=p===void 0?`Fix`:p,b=g===void 0?h:g,x;t[0]===s.url?x=t[1]:(x={url:s.url,count:ou},t[0]=s.url,t[1]=x);let[C,T]=(0,Z.useState)(x),E=C.url===s.url?C.count:ou,[D,O]=S(su,lu,cu),k=new Map(s.reviewThreads.flatMap(yu)),j=e=>k.get(e.id)?.isResolved===!0||ti(e.reviewState)===`dismissed`,M=vu,N=_u,P;t[2]!==D.bots||t[3]!==D.resolved||t[4]!==j?(P=e=>(D.bots||!M(e)||N(e))&&(D.resolved||!j(e)),t[2]=D.bots,t[3]=D.resolved,t[4]=j,t[5]=P):P=t[5];let F=s.comments.filter(P),L=s.comments.length-F.length,R=F.slice(Math.max(0,F.length-E)),B=F.length-R.length,[V,ee]=(0,Z.useState)(`newest`),H=ci(R,V),U;t[6]!==s.url||t[7]!==B||t[8]!==E?(U=B>0?(0,$.jsxs)(W,{size:`sm`,variant:`outline`,className:`w-full`,onClick:()=>T({url:s.url,count:E+ou}),children:[`Show `,Math.min(B,ou),` older comment`,B===1?``:`s`,` (`,B,` hidden)`]}):null,t[6]=s.url,t[7]=B,t[8]=E,t[9]=U):U=t[9];let te=U,ie=Ai(s.comments,s.commits),oe=new Map(ie.flatMap(gu)),se=[...s.reviewers.map(e=>({key:e.login,actor:e,outcome:oe.get(Ql(e.login))?.outcome??null,stale:oe.get(Ql(e.login))?.stale??!1})),...ie.filter(e=>!s.reviewers.some(t=>e.actor!==null&&Ql(t.login)===Ql(e.actor.login))).map(hu)],ce=Nr(i),le;t[10]===ce?le=t[11]:(le=e=>{ce(e).catch(mu)},t[10]=ce,t[11]=le);let ue=le,de;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(de={reportFailure:!1},t[12]=de):de=t[12];let pe=Dt(Jr.update,de),me;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(me={reportFailure:!1},t[13]=me):me=t[13];let he=Dt(Jr.updateComment,me),[ge,_e]=(0,Z.useState)(null),[ve,ye]=(0,Z.useState)(!1),[be,xe]=(0,Z.useState)(null),[Se,Te]=(0,Z.useState)(!1),Ee=be?.pullRequest===s.url?be.commentId:null,De;t[14]!==ve||t[15]!==r||t[16]!==h||t[17]!==a||t[18]!==pe?(De=async e=>{if(ve)return;ye(!0);let t=await pe({environmentId:r,input:{...a,body:e}});ye(!1),t._tag===`Failure`?gt.add({type:`error`,title:`Could not save the description`}):(_e(null),h())},t[14]=ve,t[15]=r,t[16]=h,t[17]=a,t[18]=pe,t[19]=De):De=t[19];let Oe=De,ke;t[20]===s?ke=t[21]:(ke=e=>_s(s,e),t[20]=s,t[21]=ke);let Ae;t[22]===s.url?Ae=t[23]:(Ae=e=>xe(e===null?null:{pullRequest:s.url,commentId:e.id}),t[22]=s.url,t[23]=Ae);let je;t[24]!==Se||t[25]!==r||t[26]!==h||t[27]!==a||t[28]!==he?(je=async(e,t)=>{if(Se||e.kind===`review`)return;Te(!0);let n=await he({environmentId:r,input:{...a,commentId:e.id,kind:e.kind,body:t}});Te(!1),n._tag===`Failure`?gt.add({type:`error`,title:`Could not save the comment`}):(xe(null),h())},t[24]=Se,t[25]=r,t[26]=h,t[27]=a,t[28]=he,t[29]=je):je=t[29];let Me={cwd:s.workspaceRoot,environmentId:r,threadRef:i,canEdit:ke,editingId:Ee,saving:Se,onEdit:Ae,onSave:je},Ne=e=>{let t=k.get(e.id),n=ii(e.body);if(j(e))return(0,$.jsx)(ru,{comment:e,editing:Me,detail:s,thread:t,label:t?.isResolved?`Resolved`:`Review dismissed`,body:n,reactionBar:(0,$.jsx)(cc,{className:`ml-auto justify-end`,reactions:e.reactions??[],canReact:s.capabilities.reactions===!0,subjectId:e.id,environmentId:r,reference:a,onRefresh:h})},`${s.url}:${e.id}`);let i=ti(e.reviewState),o=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)(cc,{reactions:e.reactions??[],canReact:s.capabilities.reactions===!0,subjectId:e.id,environmentId:r,reference:a,onRefresh:h,className:`ml-auto justify-end`});return(0,$.jsxs)(`article`,{className:`group rounded-lg border border-border/60 bg-background [contain-intrinsic-block-size:160px] [content-visibility:auto]`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2 rounded-t-lg bg-muted/25 px-3 py-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)($l,{comment:e,detail:s}),i?(0,$.jsx)(Or,{outcome:i}):e.reviewState?(0,$.jsx)(`span`,{children:tu(e.reviewState)}):null]}),m&&o?(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,className:`-mt-1 shrink-0`,disabled:d!=null,onClick:()=>m(o),children:[(0,$.jsx)(A,{className:`size-3`}),d===oi(o)?`Preparing...`:v]}):null,c]}),(0,$.jsx)(`div`,{className:`px-3`,children:(0,$.jsx)(eu,{comment:e,thread:t})}),n===null&&!Me.canEdit(e)?null:(0,$.jsx)(nu,{className:`px-3 py-3`,comment:e,editing:Me})]},`${s.url}:${e.id}`)},Pe;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,$.jsx)(ne,{className:`size-3.5`}),t[30]=Pe):Pe=t[30];let Fe=se.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):(0,$.jsx)(`span`,{className:`flex items-center -space-x-1`,children:se.map(pu)}),Ie;t[31]!==s.capabilities.reviewers.listCandidates||t[32]!==s.capabilities.reviewers.request||t[33]!==s.viewerPermissions||t[34]!==r||t[35]!==a?(Ie=s.capabilities.reviewers.request&&s.capabilities.reviewers.listCandidates?(0,$.jsx)(Kl,{environmentId:r,reference:a,allowed:s.viewerPermissions.requestReviewers}):null,t[31]=s.capabilities.reviewers.listCandidates,t[32]=s.capabilities.reviewers.request,t[33]=s.viewerPermissions,t[34]=r,t[35]=a,t[36]=Ie):Ie=t[36];let Le;t[37]!==Fe||t[38]!==Ie?(Le=(0,$.jsx)(iu,{icon:Pe,label:`Reviewers`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[Fe,Ie]})}),t[37]=Fe,t[38]=Ie,t[39]=Le):Le=t[39];let Re;t[40]!==s.capabilities.labels||t[41]!==s.labels||t[42]!==s.viewerPermissions||t[43]!==r||t[44]!==a?(Re=s.labels.length>0||s.capabilities.labels===!0?(0,$.jsx)(iu,{icon:(0,$.jsx)(fe,{className:`size-3.5`}),label:`Labels`,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[s.labels.length===0?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):s.labels.map(fu),s.capabilities.labels===!0?(0,$.jsx)(Hl,{environmentId:r,reference:a,allowed:s.viewerPermissions.labels!==!1}):null]})}):null,t[40]=s.capabilities.labels,t[41]=s.labels,t[42]=s.viewerPermissions,t[43]=r,t[44]=a,t[45]=Re):Re=t[45];let ze;t[46]!==Le||t[47]!==Re?(ze=(0,$.jsx)(`section`,{className:`px-4 pt-2.5 pb-1`,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[Le,Re]})}),t[46]=Le,t[47]=Re,t[48]=ze):ze=t[48];let Be=`description:${s.url}`,Ve;t[49]!==ve||t[50]!==ge||t[51]!==s||t[52]!==r||t[53]!==Oe||t[54]!==i?(Ve=(0,$.jsx)(`div`,{className:`group`,children:ge===s.url?(0,$.jsx)(Js,{allowEmpty:!0,value:s.body,cwd:s.workspaceRoot,environmentId:r,threadRef:i,label:`Pull request description`,placeholder:`Describe this pull request`,saving:ve,onSave:e=>void Oe(e),onCancel:()=>_e(null)}):(0,$.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,$.jsx)(qs,{className:`min-w-0 flex-1`,text:s.body.trim().length>0?s.body:`_No description provided._`,cwd:s.workspaceRoot,environmentId:r,threadRef:i}),gs(s)?(0,$.jsx)(ys,{"aria-label":`Edit description`,onClick:()=>_e(s.url)}):null]})}),t[49]=ve,t[50]=ge,t[51]=s,t[52]=r,t[53]=Oe,t[54]=i,t[55]=Ve):Ve=t[55];let He;t[56]!==Be||t[57]!==Ve?(He=(0,$.jsx)(au,{title:`Description`,keepMounted:!0,children:Ve},Be),t[56]=Be,t[57]=Ve,t[58]=He):He=t[58];let Ue=`checks:${s.url}`,We;t[59]!==_||t[60]!==s.checks||t[61]!==y||t[62]!==m||t[63]!==b||t[64]!==ue||t[65]!==d?(We=_?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Check details are out of date.`}),(0,$.jsx)(W,{size:`xs`,variant:`ghost`,onClick:b,children:`Refresh`})]}):s.checks.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No checks reported.`}):s.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&&ue(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)(Pr,{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)})]}),m&&r?(0,$.jsxs)(W,{size:`xs`,variant:`ghost`,className:`shrink-0`,disabled:d!=null,onClick:()=>m(n),children:[(0,$.jsx)(A,{className:`size-3`}),d===oi(n)?`Preparing...`:y]}):null]},`${t}:${e.name}:${e.url??``}`)}),t[59]=_,t[60]=s.checks,t[61]=y,t[62]=m,t[63]=b,t[64]=ue,t[65]=d,t[66]=We):We=t[66];let Ge;t[67]!==Ue||t[68]!==We?(Ge=(0,$.jsx)(au,{title:`Checks`,defaultOpen:!1,children:We},Ue),t[67]=Ue,t[68]=We,t[69]=Ge):Ge=t[69];let Ke=au,qe=`Comments (${s.commentCount})`,Je;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,$.jsx)(W,{size:`xs`,variant:`ghost-muted`}),t[70]=Je):Je=t[70];let Ye;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,$.jsx)(Ce,{"aria-hidden":!0,className:`size-3`}),t[71]=Ye):Ye=t[71];let Xe=L>0?`${L} hidden`:`Filter`,Ze;t[72]===Xe?Ze=t[73]:(Ze=(0,$.jsxs)(ae,{render:Je,"aria-label":`Filter comments`,children:[Ye,Xe]}),t[72]=Xe,t[73]=Ze);let Qe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,$.jsx)(re,{children:`Show`}),t[74]=Qe):Qe=t[74];let $e;t[75]===O?$e=t[76]:($e=e=>O(t=>({...t,bots:e})),t[75]=O,t[76]=$e);let et;t[77]!==D.bots||t[78]!==$e?(et=(0,$.jsx)(w,{checked:D.bots,closeOnClick:!1,onCheckedChange:$e,children:`Bot comments`}),t[77]=D.bots,t[78]=$e,t[79]=et):et=t[79];let tt;t[80]===O?tt=t[81]:(tt=e=>O(t=>({...t,resolved:e})),t[80]=O,t[81]=tt);let nt;t[82]!==D.resolved||t[83]!==tt?(nt=(0,$.jsx)(w,{checked:D.resolved,closeOnClick:!1,onCheckedChange:tt,children:`Resolved or dismissed`}),t[82]=D.resolved,t[83]=tt,t[84]=nt):nt=t[84];let rt;t[85]!==et||t[86]!==nt?(rt=(0,$.jsx)(we,{align:`end`,children:(0,$.jsxs)(o,{children:[Qe,et,nt]})}),t[85]=et,t[86]=nt,t[87]=rt):rt=t[87];let it;t[88]!==Ze||t[89]!==rt?(it=(0,$.jsxs)(I,{children:[Ze,rt]}),t[88]=Ze,t[89]=rt,t[90]=it):it=t[90];let at=V===`newest`?`Show oldest comments first`:`Show newest comments first`,ot,st;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(ot=()=>ee(du),st=(0,$.jsx)(z,{"aria-hidden":!0,className:`size-3`}),t[91]=ot,t[92]=st):(ot=t[91],st=t[92]);let ct=V===`newest`?`Newest first`:`Oldest first`,lt;t[93]!==at||t[94]!==ct?(lt=(0,$.jsxs)(W,{size:`xs`,variant:`ghost-muted`,"aria-label":at,onClick:ot,children:[st,ct]}),t[93]=at,t[94]=ct,t[95]=lt):lt=t[95];let ut;t[96]!==it||t[97]!==lt?(ut=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[it,lt]}),t[96]=it,t[97]=lt,t[98]=ut):ut=t[98];let dt=c?(0,$.jsx)(Cl,{}):u?(0,$.jsx)(Tl,{compact:!0,error:u,onRetry:h}):(0,$.jsxs)($.Fragment,{children:[s.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`,` `,s.comments.length,` are here; open it on the host to read the rest.`]}):null,s.comments.length===0?(0,$.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No comments yet.`}):F.length===0?(0,$.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:L===1?`The only comment is hidden by the filter.`:`All ${L} comments are hidden by the filter.`}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[V===`oldest`?te:null,H.map(Ne),V===`newest`?te:null,E>ou?(0,$.jsxs)(W,{size:`sm`,variant:`ghost`,className:`w-full`,onClick:()=>T({url:s.url,count:ou}),children:[`Show only `,ou,` recent comments`]}):null]})]}),ft;t[99]!==Ke||t[100]!==qe||t[101]!==ut||t[102]!==dt?(ft=(0,$.jsx)(Ke,{title:qe,actions:ut,children:dt}),t[99]=Ke,t[100]=qe,t[101]=ut,t[102]=dt,t[103]=ft):ft=t[103];let pt;return t[104]!==n||t[105]!==ze||t[106]!==He||t[107]!==Ge||t[108]!==ft?(pt=(0,$.jsxs)(`div`,{ref:n,className:`h-full overflow-y-auto`,"data-pull-request-summary-scroll":!0,children:[ze,He,Ge,ft]}),t[104]=n,t[105]=ze,t[106]=He,t[107]=Ge,t[108]=ft,t[109]=pt):pt=t[109],pt}function du(e){return e===`newest`?`oldest`:`newest`}function fu(e){return(0,$.jsx)(Fr,{label:e,size:`default`,className:`max-w-48`},e.name)}function pu(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?Rr(e.outcome,e.stale):void 0)}),children:[(0,$.jsx)(Ar,{actor:e.actor,tooltip:!1,variant:`avatar`}),e.outcome?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Mr,{outcome:e.outcome,stale:e.stale}),(0,$.jsx)(`span`,{className:`sr-only`,children:e.stale?vr(e.outcome):Sr(e.outcome)})]}):null]}),(0,$.jsx)(J,{side:`bottom`,children:e.outcome?`${n} — ${e.stale?vr(e.outcome):Sr(e.outcome)}`:n})]},e.key)}function mu(e){console.error(e),gt.add({type:`error`,title:`Unable to open check details`})}function hu(e){return{key:e.key,actor:e.actor,outcome:e.outcome,stale:e.stale}}function gu(e){return e.actor?[[Ql(e.actor.login),e]]:[]}function _u(e){let t=ti(e.reviewState);return t===`approved`||t===`changes-requested`}function vu(e){return e.author?.isBot===!0||e.author?.login.endsWith(`[bot]`)===!0}function yu(e){return e.comments.map(t=>[t.id,e])}function bu(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)(qs,{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 xu(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 Su(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 Cu(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)(Su,{className:r,children:i}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function wu(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)(Cu,{className:r,icon:i}):(0,$.jsx)(Su,{className:r,children:(0,$.jsx)(xr,{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 Tu(e){return e.toLowerCase().replaceAll(`_`,` `).replaceAll(`-`,` `).replace(/^\w/u,e=>e.toUpperCase())}function Eu(e){let t=(0,Q.c)(4),{state:n}=e,r;t[0]===n?r=t[1]:(r=Tu(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 Du(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 shrink-0`,"aria-label":`Open activity on host`,onClick:()=>r(n),children:(0,$.jsx)(xe,{className:`size-3`})}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Ou(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=Dt(Jr.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}});u(!1),t._tag===`Failure`?gt.add({type:`error`,title:`Could not save the comment`}):(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)(xu,{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)(Eu,{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=Cn(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)(_e,{"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)(wr,{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)(ys,{"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)(cc,{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)(Du,{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-center 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)(Js,{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)(bu,{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 ku(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 Au(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=ku(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)(je,{className:`size-3.5`}),t[2]=f):f=t[2];let p=!s,m;t[3]!==u||t[4]!==p?(m=(0,$.jsx)(wu,{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=Cn(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)(he,{"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)(oa,{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)(Ou,{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)(ea,{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)(ta,{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 ju(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)(me,{className:`size-3.5`}),t[3]=o):o=t[3];let s;t[4]===n.commitAuthors?s=t[5]:(s=(0,$.jsx)(wu,{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=Cn(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)(Dr,{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 Mu(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)(Cu,{icon:i.icon}),t[2]=i.icon,t[3]=a);let o;t[4]===n.actor?o=t[5]:(o=n.actor?(0,$.jsx)(xu,{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=Cn(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 Nu(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)(Er,{outcome:r}),t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,$.jsx)(wu,{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)(xu,{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`:gr(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=Sr(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=vr(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=Cn(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)(_e,{"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)(wr,{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)(cc,{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)(Du,{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-center 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)(bu,{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 Pu(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=_i(r);let e=$r(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=>_s(r,e)).map(Iu)),t[21]=r,t[22]=b);let x=b,S=s===`newest`?d:d.toReversed(),C=Mi(S),w=Fu;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)(Au,{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)(ju,{event:n,onOpen:c},n.id);let i=ti(n.reviewState);return i===null?(0,$.jsx)(Mu,{event:n},n.id):(0,$.jsx)(Nu,{event:n,outcome:i,stale:ui(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 Fu(e){bt()?.shell.openExternal(e)}function Iu(e){return[e.id,e]}function Lu(e){let t=(0,Q.c)(10),{environmentId:n,reference:r,threadRef:i}=e,a;t[0]!==n||t[1]!==r?(a=Jr.detail({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=Et(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)(Ru,{checks:o.data.checks,threadRef:i}),t[7]=o.data.checks,t[8]=i,t[9]=s):s=t[9],s}function Ru(e){let t=(0,Q.c)(23),{checks:n,threadRef:r}=e,i=Nr(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}=ki(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=Rn,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)(Pr,{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(zu)},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 zu(e){console.error(e),gt.add({type:`error`,title:`Unable to open check details`})}function Bu(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=zr(n);let e;t[19]===r?e=t[20]:(e=r?.filter(Uu).length??0,t[19]=r,t[20]=e),y=e;let i;t[21]===r?i=t[22]:(i=r?.filter(Hu).length??0,t[21]=r,t[22]=i),_=i;let a;t[23]!==r||t[24]!==d?(a=r===void 0||d?null:yr(r),t[23]=r,t[24]=d,t[25]=a):a=t[25],b=a,g=nr,h=tr,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=Vu,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)(Lu,{environmentId:a,reference:o,threadRef:f}):null:(0,$.jsx)(Ru,{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)($n,{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 Vu(e){return e.stopPropagation()}function Hu(e){return e.status===`failure`||e.status===`cancelled`}function Uu(e){return e.status===`pending`}var Wu=(0,Z.createContext)(null);function Gu(e){let t=(0,Q.c)(7),{text:n,plain:r,className:i}=e,a=r!==void 0&&r,o=(0,Z.useContext)(Wu);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)(qs,{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 Ku(e,t,n){return Math.max(Math.min(e+t,n-1),0)}function qu(e){return[...new Set([...e.excerpts.map(e=>e.path),...e.files.map(e=>e.path)])]}function Ju(e){let t=qu(e).length;return t===0?`Context, no code`:t===1?`1 file`:`${t} files`}function Yu(e){return e<26?String.fromCharCode(65+e):String(e+1)}function Xu(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;else{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 Zu(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 Qu={context:` `,addition:`+`,deletion:`-`};function $u(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(`${Qu[e.kind]}${e.text.replace(/\n$/,``)}`),e.text.endsWith(`
|
|
208
208
|
`)||r.push(`\`);i=e+1}return`${r.join(`
|
|
209
209
|
`)}\n`}function ed(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},()=>`
|
|
210
210
|
`),...s]:s.slice(s.length-o),l=t.filter(e=>e.oldLine!==null).map(e=>e.text),u=r.slice(i+a);return u.length>0&&l.at(-1)?.endsWith(`
|
|
@@ -213,6 +213,6 @@ import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./index-DQKD4Lk2.js
|
|
|
213
213
|
[data-code]::-webkit-scrollbar-thumb {
|
|
214
214
|
background-color: var(--diffs-bg-context);
|
|
215
215
|
}
|
|
216
|
-
`;function ld(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}=xt(),m;if(t[0]!==n||t[1]!==r){bb0:{if(r===null){m=null;break bb0}let e=Xu(r),i=Zu(e,n);if(i.length===0){m=null;break bb0}let a=Ft($u(n.path,It(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){m=null;break bb0}let s={additions:new Set(i.flatMap(pd)),deletions:new Set(i.flatMap(fd))},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],m=c}t[0]=n,t[1]=r,t[2]=m}else m=t[2];let h=m,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=ed(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=fc(e.position),i=dc(t.side);h?.drawn[i].has(t.line)&&r(i,t.line,t=>({...t,pending:[...t.pending,e]}))}if(u!==null){let e=fc(u.position);r(dc(e.side),e.line,dd)}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=p(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=Rt(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:aa,unsafeCSS:cd,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)(Gu,{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)(mn,{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(ud)}):null,e.metadata.pending.map(e=>(0,$.jsx)(pc,{comment:e,onRemove:()=>o?.onRemove(e.id)},e.id)),e.metadata.draft&&u!==null&&o!==null?(0,$.jsx)(xn,{kind:`draft`,rangeLabel:`${n.path}:${fc(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=>{o.canComment?(o.onComment({path:n.path,oldPath:r===null?null:md(r,n.path),position:u.position,body:e}),d(null)):D(e)}}):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 ud(e){return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(ad,{marker:e.marker}),(0,$.jsx)(`span`,{className:`text-foreground`,children:e.title})]},e.marker)}function dd(e){return{...e,draft:!0}}function fd(e){return e.oldLine===null?[]:[e.oldLine]}function pd(e){return e.newLine===null?[]:[e.newLine]}function md(e,t){let n=It(e);return n===t?null:n}function hd(e){let t=(0,Q.c)(11),{file:n,loadDiffFiles:r}=e,{resolvedTheme:i}=xt(),a;t[0]===n?a=t[1]:(a=dn(n),t[0]=n,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=Rt(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:aa,unsafeCSS:Go,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)(mn,{fileDiff:o,options:l})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}var gd={tradeoff:`A tradeoff to weigh`,contract:`A contract to check`,product:`A product call`,risk:`A risk to judge`,accessibility:`An accessibility call`};function _d(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]:(_=td(n),t[0]=n,t[1]=_);let{lettered:v,byExcerpt:y}=_,x;t[2]===n.excerpts?x=t[3]:(x=new Set(n.excerpts.map(vd)),t[2]=n.excerpts,t[3]=x);let S=x,C,w,T,E,D,O,k,A,j;if(t[4]!==y||t[5]!==f||t[6]!==d||t[7]!==S||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]===S?e=t[33]:(e=e=>!S.has(e.path),t[32]=S,t[33]=e);let c=n.files.filter(e);C=v.length>0;let m=C&&`@min-[90rem]/guide:grid-cols-[minmax(0,1fr)_20rem]`;t[34]===m?w=t[35]:(w=G(`grid gap-8`,m),t[34]=m,t[35]=w),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 x;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(W,{size:`xs`,variant:`ghost-muted`,className:`@min-[56rem]/guide:hidden`}),t[39]=x):x=t[39];let 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)(he,{"aria-hidden":!0,className:F}),t[45]=F,t[46]=I);let L;t[47]!==N||t[48]!==I?(L=(0,$.jsxs)(ra,{render:x,children:[N,I]}),t[47]=N,t[48]=I,t[49]=L):L=t[49];let R=r===0,z;t[50]===p?z=t[51]:(z=()=>p(-1),t[50]=p,t[51]=z);let B;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(b,{"aria-hidden":!0}),t[52]=B):B=t[52];let V;t[53]!==R||t[54]!==z?(V=(0,$.jsx)(W,{size:`icon-xs`,variant:`outline`,"aria-label":`Previous stop`,disabled:R,onClick:z,children:B}),t[53]=R,t[54]=z,t[55]=V):V=t[55];let ee=r===i-1,H;t[56]===p?H=t[57]:(H=()=>p(1),t[56]=p,t[57]=H);let U;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(he,{"aria-hidden":!0}),t[58]=U):U=t[58];let ne;t[59]!==ee||t[60]!==H?(ne=(0,$.jsx)(W,{size:`icon-xs`,variant:`outline`,"aria-label":`Next stop`,disabled:ee,onClick:H,children:U}),t[59]=ee,t[60]=H,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)(Ki,{children:`J`}),(0,$.jsx)(Ki,{children:`K`})]}),t[62]=re):re=t[62];let ie;t[63]!==V||t[64]!==ne?(ie=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[V,ne,re]}),t[63]=V,t[64]=ne,t[65]=ie):ie=t[65];let ae;t[66]!==_||t[67]!==L||t[68]!==ie?(ae=(0,$.jsxs)(`header`,{className:`flex items-center justify-between gap-2`,children:[_,L,ie]}),t[66]=_,t[67]=L,t[68]=ie,t[69]=ae):ae=t[69];let oe;t[70]===s?oe=t[71]:(oe=(0,$.jsx)(pa,{className:`@min-[56rem]/guide:hidden`,children:(0,$.jsx)(`div`,{className:`pt-3`,children:s})}),t[70]=s,t[71]=oe),t[72]!==o||t[73]!==a||t[74]!==ae||t[75]!==oe?(E=(0,$.jsxs)(Qi,{open:a,onOpenChange:o,children:[ae,oe]}),t[72]=o,t[73]=a,t[74]=ae,t[75]=oe,t[76]=E):E=t[76];let se;t[77]===n.title?se=t[78]:(se=(0,$.jsx)(`h2`,{className:`text-lg font-semibold text-foreground`,children:n.title}),t[77]=n.title,t[78]=se);let ce;t[79]===n.summary?ce=t[80]:(ce=n.summary.trim()===``?null:(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(Gu,{text:n.summary})}),t[79]=n.summary,t[80]=ce),t[81]!==se||t[82]!==ce?(D=(0,$.jsxs)(`div`,{className:`flex max-w-[60rem] flex-col gap-2`,children:[se,ce]}),t[81]=se,t[82]=ce,t[83]=D):D=t[83],t[84]===n.attention?O=t[85]:(O=n.attention===null?null:(0,$.jsxs)(Gi,{controlAlignment:`first-line`,children:[(0,$.jsx)(De,{}),(0,$.jsx)(Hi,{children:gd[n.attention.kind]}),(0,$.jsx)(Wi,{children:(0,$.jsx)(`div`,{children:(0,$.jsx)(Gu,{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)(un,{children:n.excerpts.map((e,t)=>(0,$.jsx)(ld,{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)(od,{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)(un,{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:Ht([t]);return(0,$.jsx)(`li`,{className:`border-border/60 not-first:border-t`,children:(0,$.jsxs)(Qi,{children:[(0,$.jsxs)(ra,{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)(pe,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground group-data-panel-open:rotate-90`}),(0,$.jsx)(te,{"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)(Gu,{text:e.note,plain:!0})}):null,n===null?null:(0,$.jsx)(Dr,{additions:n.additions,deletions:n.deletions,className:`shrink-0 font-mono`})]}),(0,$.jsx)(pa,{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)(hd,{file:t,loadDiffFiles:u})})]})},e.path)})})})]}):null,t[4]=y,t[5]=f,t[6]=d,t[7]=S,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]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A,t[31]=j}else C=t[23],w=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)(Gu,{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)(oe,{"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)(Gu,{text:e,plain:!0})})]},e)),m===null?null:(0,$.jsxs)(W,{size:`sm`,variant:`ghost-muted`,onClick:()=>m(``),children:[(0,$.jsx)(oe,{"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)(je,{"aria-hidden":!0}),`Finish review`]}):(0,$.jsxs)(W,{size:`multiline`,className:`max-w-full`,onClick:()=>p(1),children:[(0,$.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`Next: `,c]}),(0,$.jsx)(Te,{"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]!==C||t[116]!==v?(I=C?(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)(od,{notes:v})}):null,t[115]=C,t[116]=v,t[117]=I):I=t[117];let L;return t[118]!==w||t[119]!==F||t[120]!==I?(L=(0,$.jsxs)(`div`,{className:w,children:[F,I]}),t[118]=w,t[119]=F,t[120]=I,t[121]=L):L=t[121],L}function vd(e){return e.path}var yd=new Map;function bd(e){let t=(0,Q.c)(24),{environmentId:n,reference:r,headSha:i,wantedPaths:a}=e,o;t[0]===r?o=t[1]:(o=Fi(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:yd},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:yd},f=a.some(e=>!d.files.has(e))&&!d.done,p=Et,m=f?Jr.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=h.isPending,y,b;t[13]!==_||t[14]!==g||t[15]!==s||t[16]!==v?(y=()=>{g===null||v||u(e=>{let t=e.key===s?e:{key:s,cursor:null,done:!1,files:yd};if(t.cursor!==_||t.done)return t;let n=Ft(g.patch,`pull-request-guide:${s}:${_??`first`}`),r=new Map(t.files);if(n?.kind===`files`)for(let e of n.files)r.set(Gt(e),e);return{key:s,cursor:g.nextCursor,done:g.nextCursor===null,files:r}})},b=[_,g,s,v],t[13]=_,t[14]=g,t[15]=s,t[16]=v,t[17]=y,t[18]=b):(y=t[17],b=t[18]),(0,Z.useEffect)(y,b);let x=f&&h.error===null,S=f?h.error:null,C;return t[19]!==d.files||t[20]!==h.refresh||t[21]!==x||t[22]!==S?(C={files:d.files,loading:x,error:S,retry:h.refresh},t[19]=d.files,t[20]=h.refresh,t[21]=x,t[22]=S,t[23]=C):C=t[23],C}function xd(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=_a(ba(n,r),i.headSha),t[0]=n,t[1]=i.headSha,t[2]=r,t[3]=d):d=t[3];let f=d,p=ua(f),m;t[4]===f?m=t[5]:(m=e=>ya.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?[]:qu(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=bd(C),T=Dt(Jr.diffFileContents),E=`pull-request-guide:${f}`,D;t[13]!==n||t[14]!==T||t[15]!==r||t[16]!==E?(D=Yo(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(Ku(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||ha()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key!==`j`&&e.key!==`k`||ur(e.target)||(e.preventDefault(),N(e.key===`j`?1:-1))},t[25]=N,t[26]=P);let F=(0,Z.useEffectEvent)(P),I;t[27]!==o||t[28]!==F?(I=()=>{if(!o)return;let e=e=>F(e);return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},t[27]=o,t[28]=F,t[29]=I):I=t[29];let L;t[30]===o?L=t[31]:(L=[o],t[30]=o,t[31]=L),(0,Z.useEffect)(I,L);let R;t[32]!==j||t[33]!==i.stops||t[34]!==y||t[35]!==p.seen?(R=(0,$.jsx)(`aside`,{className:`sticky top-4 self-start @max-[56rem]/guide:hidden`,children:(0,$.jsx)(nd,{stops:i.stops,position:y,seen:p.seen,onSelect:j})}),t[32]=j,t[33]=i.stops,t[34]=y,t[35]=p.seen,t[36]=R):R=t[36];let z;t[37]===w.error?z=t[38]:(z=w.error===null?null:(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The diff could not be loaded, so excerpts are missing: `,w.error]}),t[37]=w.error,t[38]=z);let B;t[39]!==s||t[40]!==w.files||t[41]!==w.loading||t[42]!==j||t[43]!==i.stops||t[44]!==O||t[45]!==c||t[46]!==l||t[47]!==u||t[48]!==y||t[49]!==g||t[50]!==N||t[51]!==b||t[52]!==v||t[53]!==p.seen||t[54]!==h?(B=b===null?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This change has no files to tour.`}):(0,$.jsx)(_d,{stop:b,index:y,stopCount:v,railOpen:g,onRailOpenChange:_,stopList:(0,$.jsx)(nd,{stops:i.stops,position:y,seen:p.seen,onSelect:j}),nextTitle:i.stops[y+1]?.title??null,files:w.files,loadDiffFiles:O,diffLoading:w.loading,commenting:s,onStep:N,onAsk:c===null?null:e=>c(y,e),onFinish:l===null?null:()=>{h(e=>({seen:new Set(e.seen).add(y)})),l()},onOpenFile:u},y),t[39]=s,t[40]=w.files,t[41]=w.loading,t[42]=j,t[43]=i.stops,t[44]=O,t[45]=c,t[46]=l,t[47]=u,t[48]=y,t[49]=g,t[50]=N,t[51]=b,t[52]=v,t[53]=p.seen,t[54]=h,t[55]=B):B=t[55];let V;t[56]!==a||t[57]!==z||t[58]!==B?(V=(0,$.jsxs)(`main`,{className:`flex min-w-0 flex-col gap-4`,children:[a,z,B]}),t[56]=a,t[57]=z,t[58]=B,t[59]=V):V=t[59];let ee;return t[60]!==R||t[61]!==V?(ee=(0,$.jsx)(`div`,{ref:k,className:`@container/guide h-full overflow-y-auto scrollbar-gutter-both`,children:(0,$.jsxs)(`div`,{className:`mx-auto grid max-w-[100rem] gap-6 px-4 py-4 @min-[56rem]/guide:grid-cols-[16rem_minmax(0,1fr)] @min-[90rem]/guide:gap-8 @min-[90rem]/guide:px-6`,children:[R,V]})}),t[60]=R,t[61]=V,t[62]=ee):ee=t[62],ee}function Sd(e){let t=(0,Q.c)(28),{environmentId:n,reference:r,title:i}=e,a;t[0]!==n||t[1]!==r?(a=Jr.reviewGuide({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=Et(a),s;t[3]===n?s=t[4]:(s=Jr.generateReviewGuide.permissionAtom(n),t[3]=n,t[4]=s);let c=_(s),l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[5]=l):l=t[5];let u=Dt(Jr.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=()=>ya.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),v;t[11]!==p?.run?._tag||t[12]!==g?(v=()=>{p?.run?._tag===`Running`&&g()},t[11]=p?.run?._tag,t[12]=g,t[13]=v):v=t[13];let y=p?.run?._tag,b;t[14]===y?b=t[15]:(b=[y],t[14]=y,t[15]=b),(0,Z.useEffect)(v,b);let x;t[16]!==n||t[17]!==u||t[18]!==r||t[19]!==m||t[20]!==g?(x=async()=>{if(m)return;f(!0),g();let e=await u({environmentId:n,input:r});f(!1),e._tag===`Failure`&&(ya.getState().settle(ba(n,r)),gt.add({type:`error`,title:`Could not start a review guide`,description:ai(He(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]=x):x=t[21];let S=x,C;return t[22]!==c||t[23]!==p||t[24]!==o||t[25]!==m||t[26]!==S?(C={query:o,data:p,running:m,canWrite:c,write:S},t[22]=c,t[23]=p,t[24]=o,t[25]=m,t[26]=S,t[27]=C):C=t[27],C}function Cd(e){let t=(0,Q.c)(72),{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:h,data:g,running:_,canWrite:v,write:y}=Sd(p),b;t[4]!==n||t[5]!==r?(b=ba(n,r),t[4]=n,t[5]=r,t[6]=b):b=t[6];let x=b,S;t[7]===r?S=t[8]:(S=Fi(r),t[7]=r,t[8]=S);let C=S,w=Ii(r),T=Pi(Td),D=Pi(wd),O;t[9]!==T||t[10]!==s||t[11]!==c||t[12]!==w||t[13]!==D||t[14]!==C?(O=!s&&c===null?null:{canComment:s,pending:w,onComment:e=>{let{path:t,oldPath:n,position:r,body:i}=e;return T(C,{id:Li(),path:t,...n===null?{}:{oldPath:n},position:r,body:i})},onRemove:e=>D(C,e),onAskAgent:c},t[9]=T,t[10]=s,t[11]=c,t[12]=w,t[13]=D,t[14]=C,t[15]=O):O=t[15];let k=O,A,j;t[16]!==o||t[17]!==x?(A=()=>{if(o)return ya.getState().setShown(x),()=>{ya.getState().shownKey===x&&ya.getState().setShown(null)}},j=[o,x],t[16]=o,t[17]=x,t[18]=A,t[19]=j):(A=t[18],j=t[19]),(0,Z.useEffect)(A,j);let M=g?.guide??null,N=o&&M!==null,P;t[20]===f?P=t[21]:(P=()=>f?.(),t[20]=f,t[21]=P);let F=(0,Z.useEffectEvent)(P),I;t[22]!==F||t[23]!==N?(I=()=>{N&&F()},t[22]=F,t[23]=N,t[24]=I):I=t[24];let L;t[25]===N?L=t[26]:(L=[N],t[25]=N,t[26]=L),(0,Z.useEffect)(I,L);let R=g?.run??null,z=g?.currentHeadSha??null,B=M!==null&&z!==null&&z!==M.headSha,V=R?._tag===`Failed`&&R.headSha===z?R.detail:null,ee;t[27]!==v||t[28]!==_||t[29]!==y?(ee=(e,t)=>v?(0,$.jsxs)(W,{size:t,variant:`outline`,disabled:_,onClick:()=>void y(),children:[_?(0,$.jsx)(ht,{}):(0,$.jsx)(E,{"aria-hidden":!0,className:`size-3.5`}),_?`Reading the change...`:e]}):null,t[27]=v,t[28]=_,t[29]=y,t[30]=ee):ee=t[30];let H=ee;if(M===null){if(h.isPending&&g===null){let e;return t[31]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{className:`flex min-h-48 items-center justify-center`,children:(0,$.jsx)(ht,{})}),t[31]=e):e=t[31],e}let e=_?`Writing a review guide`:V===null?`No review guide yet`:`Could not write a review guide`,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=_?`An agent is reading the change. A large one takes a few minutes. You can leave; you will be told when it is ready.`:V===null?h.error??`A guide is a tour of the change: stops through the code in reading order, with the calls only a maintainer can make.`:Ed,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=V===null?`Write guide`:`Try again`,o;t[36]!==a||t[37]!==H?(o=H(a,`sm`),t[36]=a,t[37]=H,t[38]=o):o=t[38];let s;t[39]!==V||t[40]!==_?(s=V===null||_?null:(0,$.jsx)(Dd,{detail:V}),t[39]=V,t[40]=_,t[41]=s):s=t[41];let c;return t[42]!==n||t[43]!==i||t[44]!==o||t[45]!==s?(c=(0,$.jsxs)(`div`,{className:`scrollbar-gutter-both flex h-full flex-col items-center justify-center-safe gap-2 overflow-y-auto px-4 py-10 text-center`,children:[n,i,o,s]}),t[42]=n,t[43]=i,t[44]=o,t[45]=s,t[46]=c):c=t[46],c}let U;t[47]!==v||t[48]!==V||t[49]!==_||t[50]!==B||t[51]!==H?(U=B||V!==null||_?(0,$.jsxs)(Gi,{variant:_?`info`:`warning`,children:[_?(0,$.jsx)(ht,{}):(0,$.jsx)(m,{}),(0,$.jsx)(Wi,{children:_?`Rewriting this guide. You will be told when the new one is ready.`:V===null?`Written before the latest push.`:(0,$.jsxs)($.Fragment,{children:[`Could not rewrite this guide. ${Ed}`,(0,$.jsx)(Dd,{detail:V})]})}),!_&&v?(0,$.jsx)(Ui,{children:H(`Rewrite`,`xs`)}):null]}):null,t[47]=v,t[48]=V,t[49]=_,t[50]=B,t[51]=H,t[52]=U):U=t[52];let te=U,ne;t[53]!==n||t[54]!==a?(ne={environmentId:n,cwd:a},t[53]=n,t[54]=a,t[55]=ne):ne=t[55];let re;t[56]!==M||t[57]!==l?(re=l===null?null:(e,t)=>{let n=M.stops[e];n!==void 0&&l(n,e,t)},t[56]=M,t[57]=l,t[58]=re):re=t[58];let ie;t[59]!==o||t[60]!==te||t[61]!==k||t[62]!==n||t[63]!==M||t[64]!==u||t[65]!==d||t[66]!==r||t[67]!==re?(ie=(0,$.jsx)(xd,{environmentId:n,reference:r,guide:M,banner:te,active:o,commenting:k,onAsk:re,onFinish:u,onOpenFile:d}),t[59]=o,t[60]=te,t[61]=k,t[62]=n,t[63]=M,t[64]=u,t[65]=d,t[66]=r,t[67]=re,t[68]=ie):ie=t[68];let ae;return t[69]!==ne||t[70]!==ie?(ae=(0,$.jsx)(Wu,{value:ne,children:ie}),t[69]=ne,t[70]=ie,t[71]=ae):ae=t[71],ae}function wd(e){return e.removeComment}function Td(e){return e.addComment}var Ed=`Check the review guide model in Settings → Source control.`;function Dd(e){let t=(0,Q.c)(3),{detail:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`summary`,{className:`cursor-pointer rounded-sm -outline-offset-2 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:`Technical details`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,$.jsxs)(`details`,{className:`w-full max-w-lg text-xs text-muted-foreground`,children:[r,(0,$.jsx)(`pre`,{className:`scrollbar-gutter-both mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/40 p-3 text-left font-mono text-xs`,children:n})]}),t[1]=n,t[2]=i),i}function Od(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 kd={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`},Ad={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.`},jd=`The host refused it. A rebase stops at the first commit that does not apply cleanly; updating with a merge commit may still work.`,Md=[{value:`summary`,label:`Summary`},{value:`guide`,label:`Guide`},{value:`timeline`,label:`Timeline`},{value:`code`,label:`Code`}],Nd=()=>n(()=>import(`./PullRequestCodeTab-DdfQeIIl.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,339,340,341,342,343,344,345,346,347,348,349,350,351])),Pd=(0,Z.lazy)(Nd);function Fd(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)(Ee,{}),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)(V,{value:e.environmentId,disabled:a,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Vi,{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)(de,{value:r,onValueChange:s,children:c})]}),t[8]=s,t[9]=c,t[10]=r,t[11]=l):l=t[11],l}var Id=(e,t)=>{e.preventDefault(),e.stopPropagation(),kl({url:t.url,openLabel:Dl(Br.get(t.provider)),position:{x:e.clientX,y:e.clientY}})};function Ld(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 h;t[9]===p?h=t[10]:(h=(0,$.jsx)(m,{"aria-hidden":!0,className:p}),t[9]=p,t[10]=h);let g;t[11]!==c||t[12]!==f||t[13]!==h?(g=(0,$.jsxs)(tr,{openOnHover:!0,delay:0,closeDelay:120,render:f,children:[c,h]}),t[11]=c,t[12]=f,t[13]=h,t[14]=g):g=t[14];let _;t[15]===u?_=t[16]:(_=(0,$.jsx)(`p`,{className:`text-xs text-foreground`,children:u}),t[15]=u,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Changes can be cleanly merged.`}),t[17]=v):v=t[17];let y;t[18]!==r.methods||t[19]!==a||t[20]!==i?(y=r.methods.length>0?(0,$.jsx)(`span`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:r.methods.map(e=>(0,$.jsxs)(W,{size:`xs`,variant:`outline`,disabled:i,onClick:()=>a(e),children:[(0,$.jsx)(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]=y):y=t[21];let b;t[22]!==_||t[23]!==y?(b=(0,$.jsxs)($n,{align:`start`,side:`bottom`,className:`max-w-80`,padding:`compact`,children:[_,v,y]}),t[22]=_,t[23]=y,t[24]=b):b=t[24];let x;return t[25]!==b||t[26]!==g?(x=(0,$.jsxs)(nr,{children:[g,b]}),t[25]=b,t[26]=g,t[27]=x):x=t[27],x}function Rd({environmentId:e,shortcutsEnabled:t,getShortcutContext:n,threadRef:r=null,reference:i,listEntry:o=null,refreshToken:s=0,onActed:c,onClose:f,context:p=`page`,composerDraftTarget:m,onBack:h,onSelectPullRequest:y,onGuideShown:b}){let S=Ze(),C=Je(),w=C.find(t=>t.id===i.projectId&&t.environmentId===e),T=w?.repositoryIdentity,O=S.get(e)?.environment.capabilities.threadPullRequests===!0,k=(0,Z.useMemo)(()=>O?ni(i,T):{projectId:i.projectId,repository:i.repository,number:i.number},[i,T,O]),j=`${k.projectId}:${k.host??``}:${k.repository}#${k.number}`,P=o?.projectId===k.projectId&&o.repository.toLowerCase()===k.repository.toLowerCase()&&(k.host===void 0||o.host.toLowerCase()===k.host.toLowerCase())&&o.number===k.number?o:null,[F,R]=(0,Z.useState)(!1),[B,ee]=(0,Z.useState)(0),[H,te]=(0,Z.useState)(`summary`),[ne,re]=(0,Z.useState)(`newest`),[ie,se]=(0,Z.useState)(()=>({pullRequestKey:j,oid:null})),ce=ie.pullRequestKey===j?ie.oid:null,le=e=>{se({pullRequestKey:j,oid:e})},ue=e=>{le(e),te(`code`)},[fe,pe]=(0,Z.useState)(null),_e=e=>{le(null),pe(t=>({path:e,nonce:(t?.nonce??0)+1})),Nd(),te(`code`)},be=ya(t=>t.openRequestKey===ba(e,k));be&&H!==`guide`&&te(`guide`),(0,Z.useEffect)(()=>{be&&ya.getState().requestOpen(null)},[be]);let Ce=`${e}:${j}`,[Te,De]=(0,Z.useState)(()=>({key:Ce,tabs:new Set([`summary`])})),Me=Te.key===Ce?Te.tabs:new Set([H]);(0,Z.useEffect)(()=>{De(e=>e.key===Ce?e.tabs.has(H)?e:{key:Ce,tabs:new Set(e.tabs).add(H)}:{key:Ce,tabs:new Set([H])})},[H,Ce]);let[Fe,Ie]=(0,Z.useState)(!1),Re=(0,Z.useRef)({});(0,Z.useEffect)(()=>{Ie(Re.current[H]??!1)},[H]);let Ve=Fe,Ue=(0,Z.useRef)({}),Ge=(0,Z.useMemo)(()=>({summary:e=>{Ue.current.summary=e},timeline:e=>{Ue.current.timeline=e},code:e=>{Ue.current.code=e}}),[]),Ye=(0,Z.useRef)(null),Xe=(0,Z.useRef)(null),Qe=(0,Z.useRef)(null);(0,Z.useLayoutEffect)(()=>{let e=Qe.current;e!==null&&(Qe.current=null,Ve&&e.tab===H&&Ue.current[H]===e.scroller&&(e.scroller.scrollTop=Math.max(0,e.scroller.scrollTop+e.delta)))},[Ve,H]);let $e=Bi(e=>e.pullRequestMergeMethod),et=Bi(e=>e.setPullRequestMergeMethod),tt=wa(e,k.projectId),nt=(0,Z.useMemo)(()=>tt(),[tt]),[rt,it]=(0,Z.useState)(null),at=e=>{it({pullRequestKey:j,method:e})},ot=Od(j),[st,ct]=(0,Z.useState)(null),lt=wt(e,Be),ut=Et(Jr.detail({environmentId:e,input:k})),dt=Et(Jr.activity({environmentId:e,input:k})),ft=Gr(e),[pt,mt]=(0,Z.useState)(()=>ri(typeof window>`u`?void 0:window.localStorage,e,k));(0,Z.useEffect)(()=>{mt(ri(typeof window>`u`?void 0:window.localStorage,e,k))},[e,j,k.projectId,k.repository,k.number]),(0,Z.useEffect)(()=>{ut.data!==null&&(wi(typeof window>`u`?void 0:window.localStorage,e,k,ut.data),mt(ut.data))},[ut.data,e,j,k.projectId,k.repository,k.number]);let ht=Ni({live:ut.data,cached:pt,reference:k}),_t=(0,Z.useMemo)(()=>P===null?null:Kr(P),[P]),xt=(0,Z.useMemo)(()=>ut.data===null?null:{...ut.data,checksState:Ir(ut.data.checks)},[ut.data]),Ot=Yr(e,k,xt,ut.dataUpdatedAt),jt=(0,Z.useMemo)(()=>qr(ht,qr(Ot,_t)),[ht,Ot,_t]),Mt=(0,Z.useMemo)(()=>ht===null||jt===null||jt===ht?ht:{...ht,title:jt.title,state:jt.state,headBranch:jt.headBranch,baseBranch:jt.baseBranch,updatedAt:jt.updatedAt,author:jt.author??ht.author,additions:jt.additions??ht.additions,deletions:jt.deletions??ht.deletions,changedFiles:jt.changedFiles??ht.changedFiles,mergeability:jt.mergeability??ht.mergeability,closedAt:jt.closedAt===void 0?ht.closedAt:jt.closedAt,mergedAt:jt.mergedAt===void 0?ht.mergedAt:jt.mergedAt,isDraft:jt.isDraft??ht.isDraft},[ht,jt]),Nt=dt.data,K=(0,Z.useMemo)(()=>Mt===null?null:{...Mt,capabilities:lt?Mt.capabilities:{...Mt.capabilities,reactions:!1,edit:{changeRequest:!1,comment:!1}},viewerPermissions:lt?Mt.viewerPermissions:{...Mt.viewerPermissions,actions:[],comment:!1,resolve:!1,verdicts:[],requestReviewers:!1,updateMethods:[],labels:!1},author:Nt?.author??Mt.author,reviewers:Nt?.reviewers??Mt.reviewers,comments:Nt?.comments??[],commentCount:Nt?.commentCount??0,commentsTruncated:Nt?.commentsTruncated??!1,reviewThreads:Nt?.reviewThreads??[],commits:Nt?.commits??[],reactions:Nt?.reactions??[]},[Nt,lt,Mt]),Pt=K??jt,Ft=_(Ct),{copyToClipboard:It}=vt({target:`pull request reference`,onCopy:e=>gt.add({type:`success`,title:`${e} copied`}),onError:(e,t)=>gt.add({type:`error`,title:`Failed to copy ${t}`,description:e.message})}),Lt=(0,Z.useEffectEvent)(e=>{!t||e.defaultPrevented||ha()||dr(e,Ft,{context:n()})===`pullRequest.copyNumber`&&(e.preventDefault(),e.stopPropagation(),e.repeat||It(`#${k.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,j]);let Rt=K===null?null:Ke(K.url),zt=Br.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?vi(Pt.provider,Pt.number,Pt.headBranch,K?.headRepositoryNameWithOwner,Ke(Pt.url)):di(k,T),Ut=(0,Z.useCallback)(e=>{gt.add({type:`error`,title:`Could not copy checkout command`,description:e.message})},[]),Wt=Et(K===null?null:At.listRefs({environmentId:e,input:{cwd:K.workspaceRoot,includeMatchingRemoteRefs:!0,limit:2}})),Gt=K!==null&&Qr(K.baseBranch,Wt.data?.refs??[]),Kt=xc(e,(0,Z.useMemo)(()=>K===null||K.capabilities.stacks!==!0||!O?null:{...k,host:k.host??qe(K.url)?.host},[K,k,O])),qt=Kt.data,Jt=O&&K?.capabilities.stacks===!0&&K.capabilities.stackActions===!0&&S.get(e)?.environment.capabilities.pullRequestStackActions===!0,Yt=Ti({supportsStackActions:Jt,hasStack:qt!==null,stackPending:!Kt.isFresh,stackError:Kt.error}),Xt=Jt&&qt!==null,Zt=Yt?null:Kt.error?`Couldn't check stack membership`:`Checking stack membership…`,Qt=dt.isPending&&Nt===null,$t=Nt===null?dt.error:null,en=(0,Z.useCallback)(()=>{ut.refresh(),dt.refresh(),Kt.refresh()},[dt.refresh,ut.refresh,Kt.refresh]),[tn,nn]=(0,Z.useState)(0),rn=tn+(ft??0),an=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!Mt)return;let e={key:Ce,updatedAt:Mt.updatedAt};if(pi(an.current,e)){if(dt.isPending)return;dt.refresh(),nn(e=>e+1)}an.current=e},[dt.isPending,dt.refresh,Mt,Ce]),Fc(()=>{ut.refresh()},{key:`pull-request:${e}:${j}`});let on=Dt(Jr.invalidate,{reportFailure:!1}),[sn,cn]=(0,Z.useState)(!1),ln=sn||ut.isPending,un=(0,Z.useCallback)(async()=>{cn(!0);try{await on({environmentId:e,input:{reference:k}}),en(),nn(e=>e+1)}finally{cn(!1)}},[e,on,k,en]),dn=(0,Z.useRef)(s);(0,Z.useEffect)(()=>{dn.current!==s&&(dn.current=s,un())},[s,un]);let fn=Dt(Jr.runAction,{reportFailure:!1}),pn=Dt(Jr.comment,{reportFailure:!1}),[mn,hn]=(0,Z.useState)(null),gn=mn!==null,_n=Dt(Jr.update,{reportFailure:!1}),[vn,yn]=(0,Z.useState)(null),bn=vn?.pullRequestKey===j?vn.text:null,[xn,Sn]=(0,Z.useState)(!1),wn=zi(),{environments:En}=yt(),Dn=(0,Z.useMemo)(()=>{let t=C.find(t=>t.id===k.projectId&&t.environmentId===e)?.repositoryIdentity;return We(t,k.repository,k.number)},[e,C,k.number,k.projectId,k.repository]),On=(0,Z.useMemo)(()=>p===`page`?vc({environmentId:e,projectId:k.projectId},C,En.map(e=>({environmentId:e.environmentId,label:e.label,machine:Le(e.serverConfig)}))):[],[p,e,En,C,k.projectId]),[kn,An]=(0,Z.useState)(null),jn=kn?.pullRequestKey===j?kn.environmentId:e,Mn=On.find(e=>e.environmentId===jn)??null,Nn=Mn?.environmentId??e,Pn=Mn?.workspaceRoot??K?.workspaceRoot??w?.workspaceRoot??null,Fn=wt(Nn,ze),In=Ca({environmentId:Nn,cwd:Pn}),Rn=async(t,n,r)=>{c?.(t,`sent`);let i=await fn({environmentId:e,input:{...k,action:t,...n?{mergeMethod:n}:{},...r?{updateMethod:r}:{}}});if(hn(null),i._tag===`Failure`){let e=He(i),n=r===`rebase`?jd:Ad[t];return gt.add({type:`error`,title:kd[t],description:ai(e,n)}),c?.(t,`failed`),!1}return t===`revert`&>.add({type:`success`,title:`Revert pull request opened`}),t===`delete-branch`&>.add({type:`success`,title:`Branch deleted`}),Xr(t)?un():en(),c?.(t,`done`),!0},zn=async(e,t,n)=>!lt||mn!==null?!1:(hn(e),Rn(e,t,n)),Bn=async(t,n)=>!lt||mn!==null?{commentPosted:!1}:(hn(n),(await pn({environmentId:e,input:{...k,body:t}}))._tag===`Failure`?(hn(null),gt.add({type:`error`,title:`Could not post the comment`}),{commentPosted:!1}):(await Rn(n)||en(),{commentPosted:!0})),Vn=async t=>{let n=t.trim();if(!lt||K===null||xn)return;if(n.length===0||n===K.title){yn(null);return}Sn(!0);let r=await _n({environmentId:e,input:{...k,title:n}});Sn(!1),r._tag===`Failure`?gt.add({type:`error`,title:`The title could not be saved`,description:ai(He(r),`The host refused the new title.`)}):(yn(null),en())},Hn=m??null,Un=In.isAllowed&&Fn,Wn=Hn!==null||Un,Gn=si(Hn!==null),Kn=Sd({environmentId:e,reference:k,title:K?.title??null}),qn=()=>{Kn.write(),Kn.data?.guide??te(`guide`)},Jn=async(e,t,n)=>{let r=n??await wn(e).then(e=>e,()=>null);return r===null?null:(t===null||Sa(r.draftId,t),r)},Yn=async(t,n,r)=>{if(!K||st!==null)return;if(Hn!==null){Sa(Hn,n),gt.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=v(Nn,Mn?.projectId??K.projectId),a=await Jn(i,n);if(ct(null),a!==null&&r?.keepGuide===!0){let t=u.getState().getDraftSession(a.draftId);t!==null&&(kt.getState().openPullRequest(N(t.environmentId,t.threadId),{environmentId:e,projectId:k.projectId,...k.host===void 0?{}:{host:k.host},repository:k.repository,number:k.number,url:K.url}),ya.getState().requestOpen(ba(e,k)))}a===null?gt.add({type:`error`,title:`Could not open a thread`,description:`Try again from the project, or open a thread first.`}):gt.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.`})},Xn=async(e,t,n=`worktree`)=>{if(!Pt||st!==null)return;if(Hn!==null&&t!==null){Sa(Hn,t),gt.add({type:`success`,title:`Added to the composer`,description:`The task is in the composer — read it over, then send.`});return}if(Pn===null||!In.isAllowed||!Tt(Nn,`source-control:write`)||n===`worktree`&&!Tt(Nn,`orchestration:operate`))return;ct(e);let r=gt.add({type:`loading`,title:`Preparing the pull request checkout...`}),i=v(Nn,Mn?.projectId??Pt.projectId),a=await wn(i).then(e=>e,()=>null);if(a===null){ct(null),gt.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 In.run({reference:Pt.url,mode:n,threadId:a.threadId});if(o._tag===`Failure`){ct(null);let e=In.error instanceof Error?In.error.message:null;gt.update(r,{type:`error`,title:`Could not prepare the pull request checkout`,...e?{description:e}:{}});return}if(!await wn(i,{branch:o.value.branch,worktreePath:o.value.worktreePath,envMode:o.value.worktreePath===null?`local`:`worktree`}).then(e=>e!==null,()=>!1)){ct(null),gt.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.`};t===null?gt.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):(await Jn(i,t,a),gt.update(r,o.value.isOnPullRequestHead?{type:`success`,title:`Checkout ready`,description:`The task is in the composer — read it over, then send.`}:s))},Zn=()=>{K&&Yn(`ask`,{...Ei({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,state:K.state,isDraft:K.isDraft})})},Qn=()=>{K&&Yn(`explain`,{...gi({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,state:K.state,isDraft:K.isDraft})})},$n=(e,t,n)=>{K&&Yn(`guide-stop:${t}`,Si({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})},er=(e,t)=>{K&&Yn(`selection:${e.comment.id}`,hi({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)},tr=e=>{Pt&&Xn(`checkout:${e}`,null,e)},nr=e=>{K&&Xn(oi(e),bi({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,state:K.state,isDraft:K.isDraft,finding:e}))},rr=()=>{K&&Xn(`findings`,Oi({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,state:K.state,isDraft:K.isDraft,reviewThreads:K.reviewThreads,comments:K.comments,checks:Or?[]:K.checks,commentsTruncated:K.commentsTruncated}))},ir=()=>{Pt&&Xn(`conflicts`,{prompt:Ci({number:Pt.number,url:Pt.url,headBranch:Pt.headBranch,baseBranch:Pt.baseBranch})})},ar=K?K.capabilities.mergeMethods.filter(e=>K.mergeCapabilities[e]):[],or=rt?.pullRequestKey===j?rt.method:null,sr=Zr(ar,or,nt,$e),cr=Di[sr],lr=`Auto-merge (${cr.toLowerCase()})`,ur=K?.state===`open`&&K.mergeability===`conflicting`,pr=K?.state===`open`&&K.autoMergeEnabled===!0,mr=K?.autoMergeMethod,hr=mr?`Auto-merge (${Di[mr].toLowerCase()})`:`Auto-merge`,_r=K?.state===`open`?K.workflowApprovalsRequired??0:0,vr=K===null?null:li(K),br=St(e,e=>e.reviewGuidesEnabled),xr=Md.filter(e=>(e.value!==`code`||K===null||K.capabilities.diff)&&(e.value!==`guide`||br));(0,Z.useEffect)(()=>{xr.some(e=>e.value===H)||te(`summary`)},[H,xr]);let Sr=e=>K?.capabilities.actions.includes(e)===!0&&K.viewerPermissions.actions.includes(e),Cr=K?Ir(K.checks):null,Tr=jt?.checksState===void 0?Cr:jt.checksState,Dr=Tr!==`failing`&&K?.checks.some(e=>e.status===`action-required`)?`pending`:Tr,Or=Dr!==Cr,kr=K?fi({state:K.state,isDraft:K.isDraft,mergeability:K.mergeability,checksState:Dr,autoMergeEnabled:K.autoMergeEnabled,hasMergeMethod:ar.length>0,canMerge:!Xt&&Sr(`merge`),canMarkReady:Sr(`ready`),canEnableAutoMerge:!Xt&&Sr(`enable-auto-merge`)}):null,jr=K?.state===`open`&&Sr(K.isDraft?`ready`:`draft`)&&!(K.isDraft&&kr===`ready`),Mr=Yt&&K?.state===`open`&&(pr&&Sr(`disable-auto-merge`)||!pr&&kr!==`enable-auto-merge`&&!K.isDraft&&!ur&&Sr(`enable-auto-merge`)&&ar.length>0),Nr=Yt&&K?.state===`open`&&(kr===`enable-auto-merge`||kr===`auto-merge-armed`)&&Sr(`merge`)&&!K.isDraft&&!ur&&ar.length>0,Pr=K?.state===`open`&&Sr(`merge`)&&!K.isDraft&&!ur&&ar.length>1,Fr=K?Lr({state:K.state,isDraft:K.isDraft}):null,Rr=K!==null&&xi(K),Vr=En.some(t=>t.environmentId===e&&t.connection.phase===`connected`),Hr=async()=>{K!==null&&await bt()?.dialogs.confirm([`Delete branch ${K.headBranch}?`,`This deletes ${K.headBranch} from ${K.headRepositoryNameWithOwner??K.repository}. Local branches and worktrees are not changed.`].join(`
|
|
217
|
-
`),{variant:`destructive`})&&zn(`delete-branch`)},Ur=_r>0&&!Or&&Sr(`approve-workflows`),Wr=Or?Dr===null?`No checks reported`:zr(Dr).label:K?yr(K.checks):null,$r=K&&!K.commentsTruncated?Ai(K.comments,K.commits).filter(e=>e.outcome===`approved`&&!e.stale).length:0,ei=p===`page`?(0,$.jsxs)(I,{children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(ae,{disabled:st!==null||Pn===null,render:(0,$.jsxs)(W,{size:`xs`,variant:`outline`,"aria-label":st?.startsWith(`checkout`)?`Checking out...`:`Check out`,children:[(0,$.jsx)(ge,{"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)(he,{"aria-hidden":!0,className:`size-3.5 text-muted-foreground`})]})})}),(0,$.jsx)(J,{children:`Check out this pull request`})]}),(0,$.jsxs)(we,{align:`end`,side:`bottom`,children:[(0,$.jsxs)(ke,{disabled:!Un,onClick:()=>tr(`worktree`),children:[(0,$.jsx)(ge,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`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)(ke,{disabled:!In.isAllowed,onClick:()=>tr(`local`),children:[(0,$.jsx)(D,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`In this repository`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:"Switches the branch you are working in, like `gh pr checkout`."})]})]}),On.length>0?(0,$.jsx)(Fd,{environments:On,value:Nn,onChange:e=>An({pullRequestKey:j,environmentId:e}),disabled:st!==null}):null]})]}):null,ti=(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||Hn===null&&(Pn===null||!Un),onClick:ir,"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)(_l,{seed:P,summary:jt,checkoutCommand:Ht,onCheckoutError:Ut,number:k.number,tabs:xr,activeTab:H,...h?{onBack:h}:{},...f?{onClose:f}:{},actions:Pt?(0,$.jsxs)(Tn,{delay:150,closeDelay:150,timeout:400,children:[Pt.state===`open`&&Pt.mergeability===`conflicting`?ti:null,ei]}):void 0}):(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 w-full flex-col bg-background`,children:[F&&K?(0,$.jsx)(tl,{display:`picker`,environmentId:e,reference:k,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&&!f&&`hidden`),children:[(0,$.jsxs)(`div`,{className:`pl-4 grid h-7 min-w-0 items-center overflow-hidden`,children:[(0,$.jsx)(`div`,{"aria-hidden":Ve,inert:Ve,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`,Ve?`pointer-events-none -translate-y-1 opacity-0 duration-100`:`translate-y-0 opacity-100 delay-50 duration-150`),children:K&&Fr?(0,$.jsxs)($.Fragment,{children:[h?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(W,{size:`icon-micro`,variant:`ghost-muted`,onClick:h,className:`-ml-1.5`,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(ye,{"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 bt()?.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 bt()?.shell.openExternal(K.url),onContextMenu:e=>Id(e,K),className:G(`inline-flex shrink-0 cursor-pointer items-center gap-0.5 font-medium underline-offset-2 hover:underline`,Fr.toneClassName),"aria-label":`Open pull request #${K.number} on host`,children:[`#`,K.number,(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-2.5`})]})}),(0,$.jsx)(J,{side:`top`,children:Dl(zt)})]})]}):null}),(0,$.jsx)(`div`,{"aria-hidden":!Ve,inert:!Ve,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`,Ve?`translate-y-0 opacity-100 delay-50 duration-150`:`pointer-events-none translate-y-1 opacity-0 duration-100`),children:K&&Fr?(0,$.jsxs)($.Fragment,{children:[h?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(W,{size:`icon-micro`,variant:`ghost-muted`,tabIndex:Ve?0:-1,onClick:h,className:`-ml-1.5`,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(ye,{"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:Ve?0:-1,onClick:()=>void bt()?.shell.openExternal(K.url),onContextMenu:e=>Id(e,K),className:G(`inline-flex shrink-0 cursor-pointer items-center gap-0.5 font-medium underline-offset-2 hover:underline`,Fr.toneClassName),"aria-label":`Open pull request #${K.number} on host`,children:[`#`,K.number,(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-2.5`})]})}),(0,$.jsx)(J,{side:`top`,children:Dl(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 select-none items-center justify-end gap-1`,children:[K?(0,$.jsxs)(Tn,{delay:150,closeDelay:150,timeout:400,children:[p===`page`?(0,$.jsx)(tl,{display:`count`,environmentId:e,reference:k,url:K.url,threadRef:null}):null,!qt&&Jt&&Kt.error?(0,$.jsx)(W,{variant:`ghost`,size:`xs`,onClick:Kt.refresh,children:`Retry stack lookup`}):null,qt?(0,$.jsx)(zc,{hostLabel:zt.label,stack:qt,notice:Kt.notice,onRetry:Kt.error?Kt.refresh:void 0,reference:k,environmentId:e,onSelect:y,mergeMethod:sr,stale:!Kt.isFresh,canMerge:Jt&&Sr(`merge`)&&ar.length>0,canRebase:Jt&&K.viewerPermissions.stackRebase===!0,onActed:()=>{en(),c?.()}}):null,pr&&kr!==`auto-merge-armed`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(M,{size:`control`,variant:`info`,role:`img`,"aria-label":hr,children:[(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:hr})]})}),(0,$.jsxs)(J,{side:`top`,children:[hr,`: the host will merge this on its own once its requirements are met`]})]}):null,kr===`resolve`?ti:kr===`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:gn,onClick:()=>void zn(`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`})]}):kr===`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:gn,"aria-disabled":Zt!==null||void 0,"aria-description":Zt??void 0,...Zt===null?ot.props(`enable-auto-merge`,()=>void zn(`enable-auto-merge`,sr)):{},"aria-label":mn===`enable-auto-merge`?`Enabling...`:ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr,children:[ot.isArmed(`enable-auto-merge`)?(0,$.jsx)(x,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(Cc,{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:mn===`enable-auto-merge`?`Enabling...`:ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr})]})})]})})}),(0,$.jsx)(J,{side:`top`,children:Zt??(mn===`enable-auto-merge`?`Enabling...`:ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr)})]}):kr===`auto-merge-armed`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(M,{size:`control`,variant:`info`,role:`img`,"aria-label":hr,children:[(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:hr})]})}),(0,$.jsxs)(J,{side:`top`,children:[hr,`: the host will merge this on its own once its requirements are met`]})]}):kr===`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:gn,"aria-disabled":Zt!==null||void 0,"aria-description":Zt??void 0,...Zt===null?ot.props(`merge`,()=>void zn(`merge`,sr)):{},"aria-label":mn===`merge`?`Merging...`:ot.isArmed(`merge`)?`Confirm merge?`:cr,children:[ot.isArmed(`merge`)?(0,$.jsx)(x,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(Cc,{className:`@max-[30rem]/pr-header:hidden`,children:(0,$.jsxs)(`span`,{className:`grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:cr}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:mn===`merge`?`Merging...`:ot.isArmed(`merge`)?`Confirm merge?`:cr})]})})]})})}),(0,$.jsx)(J,{side:`top`,children:Zt??(mn===`merge`?`Merging...`:ot.isArmed(`merge`)?`Confirm merge?`:cr)})]}):(kr===`merged`||kr===`closed`)&&Fr!==null?(0,$.jsx)(M,{size:`control`,variant:`outline`,children:(0,$.jsxs)(`span`,{className:G(`flex items-center gap-1`,Fr.toneClassName),children:[(0,$.jsx)(Fr.Icon,{className:`size-3.5`}),Fr.label]})}):null,ei,(0,$.jsxs)(I,{children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(ae,{render:(0,$.jsx)(W,{"aria-label":ln?`Refreshing pull request`:`More pull request actions`,size:`icon-xs`,variant:`ghost-muted`}),children:ln?(0,$.jsx)(sa,{refreshing:!0,size:`md`}):(0,$.jsx)(d,{className:`size-4`})})}),(0,$.jsx)(J,{children:ln?`Refreshing pull request`:`More pull request actions`})]}),(0,$.jsxs)(we,{align:`end`,side:`bottom`,children:[(0,$.jsx)(tl,{display:`menu-item`,environmentId:e,reference:k,url:K.url,threadRef:r??(typeof m==`object`?m:null),onPickerOpenChange:R}),(0,$.jsxs)(ke,{disabled:ln,onClick:()=>void un(),children:[(0,$.jsx)(sa,{size:`sm`,refreshing:ln}),`Refresh`]}),(0,$.jsxs)(ke,{disabled:st!==null,onClick:Zn,children:[(0,$.jsx)(oe,{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:Hn===null?`Opens a thread that knows which pull request you mean.`:`Adds the pull request to this thread's composer.`})]})]}),(0,$.jsxs)(ke,{disabled:st!==null,onClick:Qn,children:[(0,$.jsx)(L,{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)(ke,{disabled:st!==null||!Wn,onClick:rr,children:[(0,$.jsx)(A,{className:`size-3.5`}),st===`findings`?`Preparing...`:Gn.fixFindings]}),br&&Kn.canWrite?(0,$.jsxs)(ke,{disabled:Kn.running,onClick:qn,children:[(0,$.jsx)(E,{className:`size-3.5`}),Kn.running?`Writing guide...`:Kn.data?.guide==null?`Write guide`:`Rewrite guide`]}):null,On.length>0?(0,$.jsx)(Fd,{environments:On,value:Nn,onChange:e=>An({pullRequestKey:j,environmentId:e}),disabled:st!==null}):null,(0,$.jsx)(Ee,{}),K.state===`open`?(0,$.jsxs)($.Fragment,{children:[jr?(0,$.jsxs)(ke,{disabled:gn,onClick:()=>void zn(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,Nr?(0,$.jsxs)(ke,{closeOnClick:ot.isArmed(`merge`),"aria-label":ot.isArmed(`merge`)?`Confirm merge?`:`Merge now`,disabled:gn,...ot.props(`merge`,()=>void zn(`merge`,sr)),children:[(0,$.jsx)(X.merged,{className:`size-3.5`}),ot.isArmed(`merge`)?`Confirm merge?`:`Merge now`]}):null,pr&&Sr(`disable-auto-merge`)?(0,$.jsxs)(ke,{disabled:gn,onClick:()=>void zn(`disable-auto-merge`),children:[(0,$.jsx)(X.merged,{className:`size-3.5`}),`Disable auto-merge`]}):Mr?(0,$.jsxs)(ke,{closeOnClick:ot.isArmed(`enable-auto-merge`),"aria-label":ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:`Enable auto-merge`,disabled:gn,...ot.props(`enable-auto-merge`,()=>void zn(`enable-auto-merge`,sr)),children:[(0,$.jsx)(X.merged,{className:`size-3.5`}),ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:`Enable auto-merge`]}):null,Pr?(0,$.jsxs)($.Fragment,{children:[jr||Nr||Mr?(0,$.jsx)(Ee,{}):null,(0,$.jsx)(de,{value:sr,onValueChange:e=>{let t=e;at(t),et(t)},children:ar.map(e=>(0,$.jsx)(V,{value:e,disabled:gn,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:Di[e]})]})},e))})]}):null,yi(jr,Mr||Nr,Pr)?(0,$.jsx)(Ee,{}):null]}):null,(0,$.jsxs)(ke,{onClick:()=>void bt()?.shell.openExternal(K.url),children:[(0,$.jsx)(Se,{className:`size-3.5`}),Dl(zt)]}),(0,$.jsxs)(ke,{onClick:()=>It(K.url,`PR link`),children:[(0,$.jsx)(Oe,{className:`size-3.5`}),`Copy link`,(0,$.jsx)(U,{children:fr(Ft,`thread.copyReference`)})]}),(0,$.jsxs)(ke,{onClick:()=>It(`#${k.number}`,`PR number`),children:[(0,$.jsx)(a,{className:`size-3.5`}),`Copy PR number`,(0,$.jsx)(U,{children:fr(Ft,`pullRequest.copyNumber`)})]}),K.state===`open`&&Sr(`close`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{}),(0,$.jsxs)(ke,{closeOnClick:ot.isArmed(`close`),"aria-label":ot.isArmed(`close`)?`Confirm close?`:`Close pull request`,variant:`destructive`,disabled:gn,...ot.props(`close`,()=>void zn(`close`)),children:[(0,$.jsx)(X.closed,{className:`size-3.5`}),ot.isArmed(`close`)?`Confirm close?`:`Close pull request`]})]}):K.state===`closed`&&Sr(`reopen`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{}),(0,$.jsxs)(ke,{disabled:gn,onClick:()=>void zn(`reopen`),children:[(0,$.jsx)(X.reopen,{className:`size-3.5`}),`Reopen pull request`]})]}):K.state===`merged`&&Sr(`revert`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{}),(0,$.jsxs)(ke,{closeOnClick:ot.isArmed(`revert`),"aria-label":ot.isArmed(`revert`)?`Confirm revert?`:`Revert changes`,variant:ot.isArmed(`revert`)?`destructive`:`default`,disabled:gn,...ot.props(`revert`,()=>void zn(`revert`)),children:[(0,$.jsx)(ve,{className:`size-3.5`}),ot.isArmed(`revert`)?`Confirm revert?`:`Revert changes`]})]}):null,Rr?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{}),(0,$.jsxs)(ke,{variant:`destructive`,disabled:gn||!Vr,onClick:()=>void Hr(),children:[(0,$.jsx)(Pe,{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:mn===`delete-branch`?`Deleting branch...`:`Delete branch`}),(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:Vr?K.headBranch:`Reconnect to delete this branch`})]})]})]}):null]})]})]}):null,f?(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":`Collapse pull request panel`,onClick:f,children:(0,$.jsx)(Ne,{className:`size-3.5`})}):null]}),(0,$.jsx)(`div`,{className:G(`col-span-2 grid`,Ve?`grid-rows-[1fr]`:`grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`),children:(0,$.jsx)(`div`,{ref:Xe,className:G(`min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none`,Ve?`translate-y-0 opacity-100 delay-50`:`translate-y-1 opacity-0 duration-100`),inert:!Ve,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)(Ar,{actor:K.author,profileUrl:Vt,variant:`avatar`,className:`shrink-0`}),(0,$.jsx)(`span`,{className:`shrink-0`,children:Cn(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:[vr?(0,$.jsxs)(Ld,{baseBranch:K.baseBranch,freshness:vr,pending:gn,onUpdate:e=>void zn(`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)(va,{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)(va,{value:K.baseBranch,showTitle:!1})})]})}),(0,$.jsx)(J,{side:`top`,children:Gt?`Stacked on ${K.baseBranch}`:K.baseBranch})]}),(0,$.jsx)(ye,{"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)(va,{value:K.headBranch,showTitle:!1})})}),(0,$.jsx)(J,{side:`top`,children:K.headBranch})]})]}),(0,$.jsxs)(`span`,{className:`ml-auto inline-flex shrink-0 items-baseline justify-end gap-2 text-2xs`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-baseline gap-1 tabular-nums`,"aria-label":`${K.changedFiles.toLocaleString()} changed ${K.changedFiles===1?`file`:`files`}`,children:[(0,$.jsx)(Ae,{"aria-hidden":!0,className:`size-3 self-center`}),K.changedFiles.toLocaleString()]}),(0,$.jsx)(Zc,{environmentId:e,reference:k,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`,Ve?`grid-rows-[0fr]`:`grid-rows-[1fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`),children:(0,$.jsx)(`div`,{ref:Ye,className:G(`min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none`,Ve?`-translate-y-1 opacity-0 duration-100`:`translate-y-0 opacity-100 delay-50`),inert:Ve,children:K?(0,$.jsx)(ol,{title:bn===null?(0,$.jsxs)(sl,{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})]}),gs(K)?(0,$.jsx)(ys,{"aria-label":`Edit title`,onClick:()=>yn({pullRequestKey:j,text:K.title})}):null]}):(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(Ln,{autoFocus:!0,size:`sm`,disabled:xn,value:bn,"aria-label":`Pull request title`,onChange:e=>yn({pullRequestKey:j,text:e.target.value}),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),Vn(bn)):e.key===`Escape`&&(e.preventDefault(),yn(null))}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(W,{size:`xs`,variant:`ghost`,disabled:xn,onClick:()=>yn(null),children:`Cancel`}),(0,$.jsx)(W,{size:`xs`,variant:`outline`,disabled:!lt||xn||bn.trim().length===0,onClick:()=>void Vn(bn),children:xn?`Saving...`:`Save`})]})]}),author:(0,$.jsx)(Ar,{actor:K.author,profileUrl:Vt}),updated:(0,$.jsxs)(`span`,{children:[`updated `,Cn(K.updatedAt)]}),checkout:Ht?(0,$.jsx)(ul,{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:vr?(0,$.jsxs)(Ld,{baseBranch:K.baseBranch,freshness:vr,pending:gn,onUpdate:e=>void zn(`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)(va,{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)(va,{value:K.baseBranch,showTitle:!1})})]})}),(0,$.jsx)(J,{side:`top`,children:Gt?`Stacked on ${K.baseBranch}`:K.baseBranch})]}),head:(0,$.jsx)(ul,{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)(Zc,{environmentId:e,reference:k,additions:K.additions,deletions:K.deletions,className:`shrink-0 font-mono text-xs`,eager:!0})}):null})}),K?(0,$.jsx)(cl,{tabs:xr,value:H,onValueChange:te,onTabIntent:e=>{e===`code`&&Nd()},children:H===`summary`?Ur?(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:gn,...ot.props(`approve-workflows`,()=>void zn(`approve-workflows`)),"aria-label":mn===`approve-workflows`?`Approving...`:ot.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`,children:[(0,$.jsx)(g,{"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:mn===`approve-workflows`?`Approving...`:ot.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`})]})]})})}),(0,$.jsx)(J,{side:`top`,children:mn===`approve-workflows`?`Approving...`:ot.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`})]}):(0,$.jsx)(ll,{className:`text-muted-foreground`,"aria-label":Wr?`Checks: ${Wr}`:`Checks`,icon:Dr===null?(0,$.jsx)(l,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Bu,{checks:K.checks,stale:Or,checksState:Dr,threadRef:r}),label:Wr}):H===`timeline`?(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(wr,{className:G(`whitespace-nowrap text-2xs transition-opacity`,(Qt||$t)&&`opacity-35`),children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"aria-label":$t?`Comments unavailable`:`${K.commentCount.toLocaleString()} ${K.commentCount===1?`comment`:`comments`}`,children:[(0,$.jsx)(je,{"aria-hidden":!0,className:`size-3`}),$t?`—`:Qt?`…`:K.commentCount.toLocaleString()]}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"aria-label":$t?`Commits unavailable`:`${K.commits.length.toLocaleString()} ${K.commits.length===1?`commit`:`commits`}`,children:[(0,$.jsx)(me,{"aria-hidden":!0,className:`size-3`}),$t?`—`:Qt?`…`:K.commits.length.toLocaleString()]}),$r>0?(0,$.jsxs)(`span`,{className:G(`inline-flex items-center gap-1`,gr(`approved`)),children:[(0,$.jsx)(Er,{outcome:`approved`,className:`size-3`}),$r.toLocaleString(),(0,$.jsx)(`span`,{className:`sr-only`,children:$r===1?`approval`:`approvals`})]}):null]}),(0,$.jsxs)(W,{size:`xs`,variant:`ghost-muted`,"aria-label":ne===`newest`?`Show oldest activity first`:`Show newest activity first`,onClick:()=>re(e=>e===`newest`?`oldest`:`newest`),children:[(0,$.jsx)(z,{"aria-hidden":!0,className:`size-3`}),ne===`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=Ue.current[H];if(e.target!==t||t==null)return;let n=t.scrollTop;Ie(e=>{let r=e,i=Ye.current?.scrollHeight??0,a=i-(Xe.current?.scrollHeight??0);return e?n<4&&i>0&&(r=!1):i>0&&n>i+32&&(Qe.current={tab:H,scroller:t,delta:-a},r=!0),Re.current[H]=r,r})},children:ut.error&&!K?(0,$.jsx)(El,{...ji(ut.failure)?{title:`Pull request #${k.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:en,...Dn?{gitHubUrl:Dn}:{}}):K?(0,$.jsxs)(Gs,{value:Bt,children:[Me.has(`summary`)?(0,$.jsx)(`div`,{className:G(`absolute inset-0`,H!==`summary`&&`invisible`),children:(0,$.jsx)(uu,{scrollerRef:Ge.summary,environmentId:e,threadRef:r,reference:k,detail:K,activityPending:Qt,checksStale:Or,activityError:$t,pendingFinding:st,fixFindingLabel:Gn.fixFinding,fixCheckLabel:Gn.fixCheck,...Wn?{onFixFinding:nr}:{},onRefresh:en,onRefreshChecks:un})}):null,Me.has(`guide`)?(0,$.jsx)(`div`,{className:G(`absolute inset-0`,H!==`guide`&&`invisible`),children:(0,$.jsx)(Cd,{environmentId:e,reference:k,active:H===`guide`,title:K.title,workspaceRoot:K.workspaceRoot,canComment:K.capabilities.review.inlineComment&&K.viewerPermissions.comment,onAskAboutLines:(e,t)=>er({comment:e,request:t},{keepGuide:!0}),onAskAboutStop:$n,onFinishReview:K.capabilities.review.verdicts.some(e=>K.viewerPermissions.verdicts.includes(e))?()=>ee(e=>e+1):null,onOpenFile:_e,onTourShown:b})}):null,Me.has(`timeline`)?(0,$.jsx)(`div`,{className:G(`absolute inset-0`,H!==`timeline`&&`invisible`),children:Qt?(0,$.jsx)(xl,{}):$t?(0,$.jsx)(Tl,{error:$t,onRetry:dt.refresh}):(0,$.jsx)(Pu,{scrollerRef:Ge.timeline,detail:K,environmentId:e,threadRef:r,reference:k,order:ne,onOpenCommit:ue,onRefresh:en})}):null,Me.has(`code`)?(0,$.jsx)(`div`,{className:G(`absolute inset-0`,H!==`code`&&`invisible`),children:(0,$.jsx)(Z.Suspense,{fallback:(0,$.jsx)(jo,{label:`Loading pull request diff...`}),children:(0,$.jsx)(Pd,{scrollerRef:Ge.code,onAddToAgentSelection:er,environmentId:e,reference:k,detail:K,selectedCommitOid:ce,onSelectedCommitChange:le,pendingFinding:st,fixFindingLabel:Gn.fixFinding,...Wn?{onFixFinding:nr}:{},onRefresh:en,refreshToken:rn,revealRequest:fe})})}):null]}):null}),K?(0,$.jsx)(`div`,{className:`absolute right-4 bottom-3 z-20`,children:(0,$.jsx)(Rl,{environmentId:e,reference:k,detail:K,actionPending:gn,onCommentAction:Bn,onCommented:en,onReviewSubmitted:en,openReviewRequest:B},JSON.stringify([e,k.projectId,k.host,k.repository,k.number]))}):null]})}function zd(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=Jr.runAction.permissionAtom(n.environmentId),t[0]=n.environmentId,t[1]=d);let f=_(d),p=wa(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 v;t[10]===p?v=t[11]:(v=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 Zr(t,null,p(),Bi.getState().pullRequestMergeMethod)},t[10]=p,t[11]=v);let y;t[12]!==n.environmentId||t[13]!==h||t[14]!==g||t[15]!==v?(y={environmentId:n.environmentId,reference:h,onSuccess:g,resolveMergeMethod:v},t[12]=n.environmentId,t[13]=h,t[14]=g,t[15]=v,t[16]=y):y=t[16];let{actionPending:b,perform:x}=Ta(y),S,C;if(t[17]!==b||t[18]!==f||t[19]!==l||t[20]!==n||t[21]!==r||t[22]!==c||t[23]!==x||t[24]!==u||t[25]!==i){C=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Hr(n,r),a=b||l||u;if(e.length===0){C=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]!==x?(d=e=>{let t=Bd[e].label,r=Bd[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 x(e),onPointerDown:t=>{e===`close`&&t.isPrimary&&t.button===0&&(t.stopPropagation(),c?.(n,t.nativeEvent))}}),children:[a?(0,$.jsx)(ht,{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]=x,t[35]=d):d=t[35],S=(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":b||l,children:e.map(d)})}t[17]=b,t[18]=f,t[19]=l,t[20]=n,t[21]=r,t[22]=c,t[23]=x,t[24]=u,t[25]=i,t[26]=S,t[27]=C}else S=t[26],C=t[27];return C===Symbol.for(`react.early_return_sentinel`)?S:C}var Bd={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}},Vd=`group/pr-row flex w-full items-center gap-2 rounded-md py-1 pr-1 text-left`,Hd=`shrink-0 font-mono text-xs tabular-nums text-muted-foreground`;function Ud(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)(Tr,{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)(Cr,{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 Wd(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:Cn(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 Gd(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)(xr,{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 Kd(e){let t=(0,Q.c)(8),{head:n,base:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(va,{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)(va,{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}function qd(e){if(e.getModifierState?.(`AltGraph`)&&!/^[a-z0-9]$/i.test(e.key))return null;let t=e.key.toLowerCase();return(/^[\p{L}\p{M}]+$/u.test(t)&&!/\p{Script=Latin}/u.test(t)?e.code?.match(/^Key([A-Z])$/)?.[1]?.toLowerCase():void 0)??t}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"]`,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=[Zi,ma];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){if(t.defaultPrevented||t.isComposing||t.metaKey||t.ctrlKey||t.altKey)return null;let n=qd(t);return e.find(e=>e.available&&e.shortcut.toLowerCase()===n)??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:T,shortcut:`B`,available:e.browserAvailable,disabledReason:Yd.browser,onClick:e.onAddBrowser},{label:`Terminal`,icon:C,shortcut:`T`,available:e.terminalAvailable,disabledReason:Yd.terminal,onClick:e.onAddTerminal},{label:`Files`,icon:se,shortcut:`F`,available:e.filesAvailable,disabledReason:Yd.files,onClick:e.onAddFiles},...e.onAddDesign?[{label:`Design`,icon:h,shortcut:`G`,available:e.filesAvailable,disabledReason:`Open a project to use Design.`,onClick:e.onAddDesign}]:[],{label:`Diff`,icon:Ae,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:H,shortcut:`M`,available:e.deviceAvailable,disabledReason:Yd.device,onClick:e.onAddDevice}],a=i.filter(uf),o=a.length===0?-1:Math.min(n,a.length-1),s=(0,Z.useRef)(a);(0,Z.useEffect)(()=>{s.current=a});let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[0]=c):c=t[0],(0,Z.useEffect)(()=>{let e=e=>{let t=nf(s.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)},c);let l=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey)&&a.length!==0){if(e.key===`ArrowDown`||e.key===`ArrowRight`)e.preventDefault(),r((o+1)%a.length);else if(e.key===`ArrowUp`||e.key===`ArrowLeft`)e.preventDefault(),r(o===-1?a.length-1:(o-1+a.length)%a.length);else if(e.key===`Enter`){if(e.target!==e.currentTarget)return;let t=a[o];if(!t)return;e.preventDefault(),t.onClick()}}},u=lf,d=e=>o!==-1&&a[o]===e,f=cf,p;t[1]===a?p=t[2]:(p=a.map(sf),t[1]=a,t[2]=p);let m=p.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 _=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`,d(t)&&`bg-card/60`),children:[f(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)(Ki,{variant:`pill`,children:t.shortcut})]}),t.label===`Browser`&&e.browserProfiles.length>1?(0,$.jsxs)(I,{children:[(0,$.jsx)(ae,{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)(he,{className:`size-3.5`})}),(0,$.jsx)(we,{align:`end`,side:`bottom`,sideOffset:6,className:`max-w-56`,children:e.browserProfiles.map(t=>(0,$.jsx)(ke,{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:[f(t,`size-4`),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,$.jsx)(Ki,{variant:`pill`,children:t.shortcut})]})},t.label)),v;t[4]===_?v=t[5]:(v=(0,$.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(14rem,1fr))] gap-x-3 gap-y-2`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==v||t[7]!==g?(y=(0,$.jsxs)(`div`,{className:`w-full max-w-3xl`,children:[g,v]}),t[6]=v,t[7]=g,t[8]=y):y=t[8];let b;return t[9]!==u||t[10]!==l||t[11]!==y||t[12]!==m?(b=(0,$.jsx)(`div`,{ref:u,tabIndex:0,onKeyDown:l,"aria-label":`Open a surface`,"data-surface-launcher-keys":m,className:`scrollbar-gutter-both flex min-h-0 flex-1 flex-col overflow-y-auto bg-muted px-5 py-6 outline-none`,children:y}),t[9]=u,t[10]=l,t[11]=y,t[12]=m,t[13]=b):b=t[13],b}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)??Ri(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=st(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)(T,{className:`size-3 shrink-0`}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,$.jsx)(us,{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)(Ae,{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)(h,{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)(se,{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)(hr,{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)(C,{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)(ue,{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)(pr,{className:`size-3 shrink-0`}):n.target?.platform===`android`?(0,$.jsx)(mr,{className:`size-3 shrink-0`}):(0,$.jsx)(H,{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 Ge(a.pullRequests))Ve(e,{host:n,repository:r.repository,number:r.number})&&(i===void 0||(e.snapshot?.syncedAt??``)>(i.snapshot?.syncedAt??``))&&(i=e);return i}function gf(e){let t=(0,Q.c)(11),{surface:n,environmentId:r,seed:i}=e,a=n.environmentId??r,o=Je(),s=Xe(),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?Ie(l,l.provider):null),d=Ze(),f=a===null?void 0:d.get(a)?.environment.capabilities,p=f?.threadPullRequests===!0?hf(s,a,u,n)?.snapshot??null:null,m=Et(a===null||f?.pullRequests!==!0||p!==null?null:Jr.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 _=Yr(a,g,null),v=p??qr(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=Lr({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=la(oa(ca,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)(ia,{items:a,strategy:$i,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)(xa,{sensors:r,collisionDetection:ta,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}=na(o),f;t[8]===l?f=t[9]:(f=ea.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=wn&&e.mode===`inline`,r=lr().profiles,{resolvedTheme:i}=xt(),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=>{t.defaultPrevented||t.isComposing||dr(t,e.keybindings,{context:{...e.getShortcutContext(),rightPanelOpen:!0}})===`rightPanel.new`&&(document.querySelector(Jd)||(!f||p&&e.browserAvailable)&&(t.preventDefault(),t.stopPropagation(),!t.repeat&&(p?e.onAddTools?.():document.querySelector(`[data-surface-launcher-keys]`)?.focus())))},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 x=b,S;t[12]===e?S=t[13]:(S=async(t,n)=>{t.preventDefault(),t.stopPropagation();let r=bt();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&&ga?.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]=S);let C=S,w=Cf,T;t[14]===e?T=t[15]:(T=(t,n)=>{t.button===1&&(t.preventDefault(),t.stopPropagation(),e.onCloseSurface(n))},t[14]=e,t[15]=T);let E=T,D,O;t[16]!==e.activeSurfaceId||t[17]!==u.hasOverflow?(D=()=>{e.activeSurfaceId&&u.hasOverflow&&(a.current?.querySelector(`[data-active-tab='true']`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},O=[e.activeSurfaceId,u.hasOverflow],t[16]=e.activeSurfaceId,t[17]=u.hasOverflow,t[18]=D,t[19]=O):(D=t[18],O=t[19]),(0,Z.useEffect)(D,O);let k,A;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{let e=Qd(a.current);if(!e)return;let t=e.firstElementChild,n=rr(t?[e,t]:e,y);return e.addEventListener(`scroll`,y,{passive:!0}),y(),()=>{n(),e.removeEventListener(`scroll`,y)}},A=[y],t[20]=k,t[21]=A):(k=t[20],A=t[21]),(0,Z.useEffect)(k,A);let j,M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{let e=Qd(a.current);if(!e)return;let t=t=>{if(t.ctrlKey)return;let n=Math.abs(t.deltaX)>Math.abs(t.deltaY)?t.deltaX:t.deltaY;if(t.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=16),t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=e.clientWidth),n===0)return;let r=e.scrollLeft;e.scrollLeft+=n,e.scrollLeft!==r&&(t.preventDefault(),y())};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},M=[y],t[22]=j,t[23]=M):(j=t[22],M=t[23]),(0,Z.useEffect)(j,M);let N=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 R;t[30]===e.defaultWidth?R=t[31]:(R=e.defaultWidth===void 0?{}:{defaultWidth:e.defaultWidth},t[30]=e.defaultWidth,t[31]=R);let z;t[32]===e.inlineSize?z=t[33]:(z=e.inlineSize?{inlineSize:e.inlineSize}:{},t[32]=e.inlineSize,t[33]=z);let B=e.mode===`inline`&&!e.layoutControls?`pr-28`:`pr-3`,V=n&&`drag-region`,ee=n&&`wco:pr-(--workspace-native-controls-inset)`,H=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)]`,U;t[34]!==B||t[35]!==V||t[36]!==ee||t[37]!==H?(U=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`,B,V,ee,H),t[34]=B,t[35]=V,t[36]=ee,t[37]=H,t[38]=U):U=t[38];let te=e.surfaces,ne=e.onMoveSurface,re;t[39]!==E||t[40]!==C||t[41]!==n||t[42]!==e||t[43]!==o||t[44]!==i?(re=e.surfaces.map(t=>{let r=t.id===e.activeSurfaceId,a=e.pendingSurfaceIds.has(t.id),c=df(t,e.previewSessions,e.terminalLabelsById,e.asideTitlesByThreadId),l=$d(t,e.previewSessions),u=tf(l?e.desktopByTabId[l]??null:null),d=l?e.previewRuntimeTabId?.(l)??null:null;return(0,$.jsxs)(yf,{surfaceId:t.id,disabled:!e.onMoveSurface||o===t.id,"data-active-tab":r,onMouseDown:w,onAuxClick:e=>E(e,t),onContextMenu:e=>void C(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(),ga?.setAudioMuted(d,u!==`muted`).catch(Sf)},children:(0,$.jsx)(at,{className:`size-3`,icon:u===`muted`?tt:it})})}),(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)(be,{className:`size-3.5`})})]},t.id)}),t[39]=E,t[40]=C,t[41]=n,t[42]=e,t[43]=o,t[44]=i,t[45]=re):re=t[45];let ie;t[46]!==e.onMoveSurface||t[47]!==e.surfaces||t[48]!==re?(ie=(0,$.jsx)(Rn,{radius:`none`,ref:a,hideScrollbars:!0,scrollFade:!0,className:`w-fit min-w-0 flex-initial`,"data-right-panel-tab-list":!0,children:(0,$.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center gap-1`,children:(0,$.jsx)(_f,{surfaces:te,onMove:ne,children:re})})}),t[46]=e.onMoveSurface,t[47]=e.surfaces,t[48]=re,t[49]=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:()=>x(-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:()=>x(1),size:`icon-xs`,variant:`ghost`,children:(0,$.jsx)(pe,{})})})}),(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)(P,{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]!==U||t[65]!==ie||t[66]!==ae||t[67]!==oe||t[68]!==ce||t[69]!==le?(ue=(0,$.jsxs)(`div`,{className:U,"data-right-panel-tabbar":!0,children:[ie,ae,oe,se,e.layoutControls,ce,le]}),t[63]=e.layoutControls,t[64]=U,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 me;return t[93]!==e.mode||t[94]!==F||t[95]!==I||t[96]!==L||t[97]!==R||t[98]!==z||t[99]!==ue||t[100]!==fe?(me=(0,$.jsxs)(as,{mode:N,...F,...I,...L,...R,...z,children:[ue,fe]}),t[93]=e.mode,t[94]=F,t[95]=I,t[96]=L,t[97]=R,t[98]=z,t[99]=ue,t[100]=fe,t[101]=me):me=t[101],me}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}=Zn(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)(32),{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:b}=e,x=n===void 0||n,S=r===void 0||r,C=i===void 0||i,w=h===void 0?`Right panel is unavailable`:h,T=g===void 0?0:g,E=l===`popover`?void 0:v,D;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(kf,{}),t[0]=D):D=t[0];let O;t[1]!==E||t[2]!==c?(O=(0,$.jsx)(On,{className:`relative shrink-0 [-webkit-app-region:no-drag]`,pressed:c,onPressedChange:E,"aria-label":`Toggle thread details panel`,variant:`ghost`,size:`sm`,children:D}),t[1]=E,t[2]=c,t[3]=O):O=t[3];let k=O,A;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(`span`,{className:`flex shrink-0`}),t[4]=A):A=t[4];let j;t[5]!==u||t[6]!==l||t[7]!==k?(j=(0,$.jsx)(q,{render:A,children:l===`popover`?(0,$.jsx)(tr,{handle:u,render:k}):k}),t[5]=u,t[6]=l,t[7]=k,t[8]=j):j=t[8];let M=d?` (${d})`:``,N;t[9]===M?N=t[10]:(N=(0,$.jsxs)(J,{side:`bottom`,children:[`Toggle thread details`,M]}),t[9]=M,t[10]=N);let P;t[11]!==j||t[12]!==N?(P=(0,$.jsxs)(Y,{children:[j,N]}),t[11]=j,t[12]=N,t[13]=P):P=t[13];let F=x?P:null,I;t[14]!==_||t[15]!==S||t[16]!==a||t[17]!==o||t[18]!==s?(I=S?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`flex shrink-0`}),children:(0,$.jsx)(On,{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)(y,{className:`size-4`})})}),(0,$.jsx)(J,{side:`bottom`,children:a?`Toggle terminal drawer${s?` (${s})`:``}`:`Terminal drawer is unavailable`})]}):null,t[14]=_,t[15]=S,t[16]=a,t[17]=o,t[18]=s,t[19]=I):I=t[19];let L;t[20]!==b||t[21]!==f||t[22]!==p||t[23]!==m||t[24]!==T||t[25]!==w||t[26]!==C?(L=C?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`flex shrink-0`}),children:(0,$.jsx)(On,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:p,onPressedChange:b,"aria-label":T>0?`Toggle right panel, ${T} ${T===1?`tab`:`tabs`}`:`Toggle right panel`,variant:`ghost`,size:`sm`,disabled:!f,children:T>0?(0,$.jsx)(Df,{count:T}):(0,$.jsx)(at,{className:`size-4`,icon:p?nt:$e})})}),(0,$.jsx)(J,{side:`bottom`,children:f?`Toggle right panel${m?` (${m})`:``}`:w})]}):null,t[20]=b,t[21]=f,t[22]=p,t[23]=m,t[24]=T,t[25]=w,t[26]=C,t[27]=L):L=t[27];let R;return t[28]!==F||t[29]!==I||t[30]!==L?(R=(0,$.jsxs)(`div`,{className:`flex h-full shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,"data-panel-layout-controls":!0,children:[F,I,L]}),t[28]=F,t[29]=I,t[30]=L,t[31]=R):R=t[31],R});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?et:Qe,o;t[0]===a?o=t[1]:(o=(0,$.jsx)(at,{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)(On,{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{_s as A,Oo as B,Fc as C,hc as D,pc as E,Jo as F,Yo as I,Ko as L,ms as M,as as N,fc as O,ts as P,ko as R,Lc as S,_c as T,_l as _,Vd as a,Zc as b,Kd as c,zd as d,Rd as f,El as g,kl as h,qd as i,vs as j,dc as k,Ud as l,Dl as m,Of as n,Hd as o,Bu as p,bf as r,Gd as s,Ef as t,Wd as u,hl as v,xc as w,Rc as x,Qc as y,jo as z};
|
|
218
|
-
//# sourceMappingURL=PanelLayoutControls-
|
|
216
|
+
`;function ld(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}=xt(),m;if(t[0]!==n||t[1]!==r){bb0:{if(r===null){m=null;break bb0}let e=Xu(r),i=Zu(e,n);if(i.length===0){m=null;break bb0}let a=Ft($u(n.path,It(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){m=null;break bb0}let s={additions:new Set(i.flatMap(pd)),deletions:new Set(i.flatMap(fd))},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],m=c}t[0]=n,t[1]=r,t[2]=m}else m=t[2];let h=m,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=ed(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=fc(e.position),i=dc(t.side);h?.drawn[i].has(t.line)&&r(i,t.line,t=>({...t,pending:[...t.pending,e]}))}if(u!==null){let e=fc(u.position);r(dc(e.side),e.line,dd)}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=p(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=Rt(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:Qi,unsafeCSS:cd,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)(Gu,{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)(mn,{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(ud)}):null,e.metadata.pending.map(e=>(0,$.jsx)(pc,{comment:e,onRemove:()=>o?.onRemove(e.id)},e.id)),e.metadata.draft&&u!==null&&o!==null?(0,$.jsx)(xn,{kind:`draft`,rangeLabel:`${n.path}:${fc(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=>{o.canComment?(o.onComment({path:n.path,oldPath:r===null?null:md(r,n.path),position:u.position,body:e}),d(null)):D(e)}}):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 ud(e){return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,$.jsx)(ad,{marker:e.marker}),(0,$.jsx)(`span`,{className:`text-foreground`,children:e.title})]},e.marker)}function dd(e){return{...e,draft:!0}}function fd(e){return e.oldLine===null?[]:[e.oldLine]}function pd(e){return e.newLine===null?[]:[e.newLine]}function md(e,t){let n=It(e);return n===t?null:n}function hd(e){let t=(0,Q.c)(11),{file:n,loadDiffFiles:r}=e,{resolvedTheme:i}=xt(),a;t[0]===n?a=t[1]:(a=dn(n),t[0]=n,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=Rt(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:Qi,unsafeCSS:Go,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)(mn,{fileDiff:o,options:l})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}var gd={tradeoff:`A tradeoff to weigh`,contract:`A contract to check`,product:`A product call`,risk:`A risk to judge`,accessibility:`An accessibility call`};function _d(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]:(_=td(n),t[0]=n,t[1]=_);let{lettered:v,byExcerpt:y}=_,x;t[2]===n.excerpts?x=t[3]:(x=new Set(n.excerpts.map(vd)),t[2]=n.excerpts,t[3]=x);let S=x,C,w,T,E,D,O,k,A,j;if(t[4]!==y||t[5]!==f||t[6]!==d||t[7]!==S||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]===S?e=t[33]:(e=e=>!S.has(e.path),t[32]=S,t[33]=e);let c=n.files.filter(e);C=v.length>0;let m=C&&`@min-[90rem]/guide:grid-cols-[minmax(0,1fr)_20rem]`;t[34]===m?w=t[35]:(w=G(`grid gap-8`,m),t[34]=m,t[35]=w),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 x;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(W,{size:`xs`,variant:`ghost-muted`,className:`@min-[56rem]/guide:hidden`}),t[39]=x):x=t[39];let 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)(he,{"aria-hidden":!0,className:F}),t[45]=F,t[46]=I);let L;t[47]!==N||t[48]!==I?(L=(0,$.jsxs)(oa,{render:x,children:[N,I]}),t[47]=N,t[48]=I,t[49]=L):L=t[49];let R=r===0,z;t[50]===p?z=t[51]:(z=()=>p(-1),t[50]=p,t[51]=z);let B;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(b,{"aria-hidden":!0}),t[52]=B):B=t[52];let V;t[53]!==R||t[54]!==z?(V=(0,$.jsx)(W,{size:`icon-xs`,variant:`outline`,"aria-label":`Previous stop`,disabled:R,onClick:z,children:B}),t[53]=R,t[54]=z,t[55]=V):V=t[55];let ee=r===i-1,H;t[56]===p?H=t[57]:(H=()=>p(1),t[56]=p,t[57]=H);let U;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(he,{"aria-hidden":!0}),t[58]=U):U=t[58];let ne;t[59]!==ee||t[60]!==H?(ne=(0,$.jsx)(W,{size:`icon-xs`,variant:`outline`,"aria-label":`Next stop`,disabled:ee,onClick:H,children:U}),t[59]=ee,t[60]=H,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)(Ki,{children:`J`}),(0,$.jsx)(Ki,{children:`K`})]}),t[62]=re):re=t[62];let ie;t[63]!==V||t[64]!==ne?(ie=(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[V,ne,re]}),t[63]=V,t[64]=ne,t[65]=ie):ie=t[65];let ae;t[66]!==_||t[67]!==L||t[68]!==ie?(ae=(0,$.jsxs)(`header`,{className:`flex items-center justify-between gap-2`,children:[_,L,ie]}),t[66]=_,t[67]=L,t[68]=ie,t[69]=ae):ae=t[69];let oe;t[70]===s?oe=t[71]:(oe=(0,$.jsx)(ea,{className:`@min-[56rem]/guide:hidden`,children:(0,$.jsx)(`div`,{className:`pt-3`,children:s})}),t[70]=s,t[71]=oe),t[72]!==o||t[73]!==a||t[74]!==ae||t[75]!==oe?(E=(0,$.jsxs)(ta,{open:a,onOpenChange:o,children:[ae,oe]}),t[72]=o,t[73]=a,t[74]=ae,t[75]=oe,t[76]=E):E=t[76];let se;t[77]===n.title?se=t[78]:(se=(0,$.jsx)(`h2`,{className:`text-lg font-semibold text-foreground`,children:n.title}),t[77]=n.title,t[78]=se);let ce;t[79]===n.summary?ce=t[80]:(ce=n.summary.trim()===``?null:(0,$.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(Gu,{text:n.summary})}),t[79]=n.summary,t[80]=ce),t[81]!==se||t[82]!==ce?(D=(0,$.jsxs)(`div`,{className:`flex max-w-[60rem] flex-col gap-2`,children:[se,ce]}),t[81]=se,t[82]=ce,t[83]=D):D=t[83],t[84]===n.attention?O=t[85]:(O=n.attention===null?null:(0,$.jsxs)(Gi,{controlAlignment:`first-line`,children:[(0,$.jsx)(De,{}),(0,$.jsx)(Hi,{children:gd[n.attention.kind]}),(0,$.jsx)(Wi,{children:(0,$.jsx)(`div`,{children:(0,$.jsx)(Gu,{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)(un,{children:n.excerpts.map((e,t)=>(0,$.jsx)(ld,{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)(od,{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)(un,{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:Ht([t]);return(0,$.jsx)(`li`,{className:`border-border/60 not-first:border-t`,children:(0,$.jsxs)(ta,{children:[(0,$.jsxs)(oa,{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)(pe,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground group-data-panel-open:rotate-90`}),(0,$.jsx)(te,{"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)(Gu,{text:e.note,plain:!0})}):null,n===null?null:(0,$.jsx)(Dr,{additions:n.additions,deletions:n.deletions,className:`shrink-0 font-mono`})]}),(0,$.jsx)(ea,{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)(hd,{file:t,loadDiffFiles:u})})]})},e.path)})})})]}):null,t[4]=y,t[5]=f,t[6]=d,t[7]=S,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]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A,t[31]=j}else C=t[23],w=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)(Gu,{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)(oe,{"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)(Gu,{text:e,plain:!0})})]},e)),m===null?null:(0,$.jsxs)(W,{size:`sm`,variant:`ghost-muted`,onClick:()=>m(``),children:[(0,$.jsx)(oe,{"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)(je,{"aria-hidden":!0}),`Finish review`]}):(0,$.jsxs)(W,{size:`multiline`,className:`max-w-full`,onClick:()=>p(1),children:[(0,$.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`Next: `,c]}),(0,$.jsx)(Te,{"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]!==C||t[116]!==v?(I=C?(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)(od,{notes:v})}):null,t[115]=C,t[116]=v,t[117]=I):I=t[117];let L;return t[118]!==w||t[119]!==F||t[120]!==I?(L=(0,$.jsxs)(`div`,{className:w,children:[F,I]}),t[118]=w,t[119]=F,t[120]=I,t[121]=L):L=t[121],L}function vd(e){return e.path}var yd=new Map;function bd(e){let t=(0,Q.c)(24),{environmentId:n,reference:r,headSha:i,wantedPaths:a}=e,o;t[0]===r?o=t[1]:(o=Fi(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:yd},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:yd},f=a.some(e=>!d.files.has(e))&&!d.done,p=Et,m=f?Jr.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=h.isPending,y,b;t[13]!==_||t[14]!==g||t[15]!==s||t[16]!==v?(y=()=>{g===null||v||u(e=>{let t=e.key===s?e:{key:s,cursor:null,done:!1,files:yd};if(t.cursor!==_||t.done)return t;let n=Ft(g.patch,`pull-request-guide:${s}:${_??`first`}`),r=new Map(t.files);if(n?.kind===`files`)for(let e of n.files)r.set(Gt(e),e);return{key:s,cursor:g.nextCursor,done:g.nextCursor===null,files:r}})},b=[_,g,s,v],t[13]=_,t[14]=g,t[15]=s,t[16]=v,t[17]=y,t[18]=b):(y=t[17],b=t[18]),(0,Z.useEffect)(y,b);let x=f&&h.error===null,S=f?h.error:null,C;return t[19]!==d.files||t[20]!==h.refresh||t[21]!==x||t[22]!==S?(C={files:d.files,loading:x,error:S,retry:h.refresh},t[19]=d.files,t[20]=h.refresh,t[21]=x,t[22]=S,t[23]=C):C=t[23],C}function xd(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=_a(ba(n,r),i.headSha),t[0]=n,t[1]=i.headSha,t[2]=r,t[3]=d):d=t[3];let f=d,p=da(f),m;t[4]===f?m=t[5]:(m=e=>ya.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?[]:qu(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=bd(C),T=Dt(Jr.diffFileContents),E=`pull-request-guide:${f}`,D;t[13]!==n||t[14]!==T||t[15]!==r||t[16]!==E?(D=Yo(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(Ku(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||ma()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key!==`j`&&e.key!==`k`||ur(e.target)||(e.preventDefault(),N(e.key===`j`?1:-1))},t[25]=N,t[26]=P);let F=(0,Z.useEffectEvent)(P),I;t[27]!==o||t[28]!==F?(I=()=>{if(!o)return;let e=e=>F(e);return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},t[27]=o,t[28]=F,t[29]=I):I=t[29];let L;t[30]===o?L=t[31]:(L=[o],t[30]=o,t[31]=L),(0,Z.useEffect)(I,L);let R;t[32]!==j||t[33]!==i.stops||t[34]!==y||t[35]!==p.seen?(R=(0,$.jsx)(`aside`,{className:`sticky top-4 self-start @max-[56rem]/guide:hidden`,children:(0,$.jsx)(nd,{stops:i.stops,position:y,seen:p.seen,onSelect:j})}),t[32]=j,t[33]=i.stops,t[34]=y,t[35]=p.seen,t[36]=R):R=t[36];let z;t[37]===w.error?z=t[38]:(z=w.error===null?null:(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The diff could not be loaded, so excerpts are missing: `,w.error]}),t[37]=w.error,t[38]=z);let B;t[39]!==s||t[40]!==w.files||t[41]!==w.loading||t[42]!==j||t[43]!==i.stops||t[44]!==O||t[45]!==c||t[46]!==l||t[47]!==u||t[48]!==y||t[49]!==g||t[50]!==N||t[51]!==b||t[52]!==v||t[53]!==p.seen||t[54]!==h?(B=b===null?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This change has no files to tour.`}):(0,$.jsx)(_d,{stop:b,index:y,stopCount:v,railOpen:g,onRailOpenChange:_,stopList:(0,$.jsx)(nd,{stops:i.stops,position:y,seen:p.seen,onSelect:j}),nextTitle:i.stops[y+1]?.title??null,files:w.files,loadDiffFiles:O,diffLoading:w.loading,commenting:s,onStep:N,onAsk:c===null?null:e=>c(y,e),onFinish:l===null?null:()=>{h(e=>({seen:new Set(e.seen).add(y)})),l()},onOpenFile:u},y),t[39]=s,t[40]=w.files,t[41]=w.loading,t[42]=j,t[43]=i.stops,t[44]=O,t[45]=c,t[46]=l,t[47]=u,t[48]=y,t[49]=g,t[50]=N,t[51]=b,t[52]=v,t[53]=p.seen,t[54]=h,t[55]=B):B=t[55];let V;t[56]!==a||t[57]!==z||t[58]!==B?(V=(0,$.jsxs)(`main`,{className:`flex min-w-0 flex-col gap-4`,children:[a,z,B]}),t[56]=a,t[57]=z,t[58]=B,t[59]=V):V=t[59];let ee;return t[60]!==R||t[61]!==V?(ee=(0,$.jsx)(`div`,{ref:k,className:`@container/guide h-full overflow-y-auto scrollbar-gutter-both`,children:(0,$.jsxs)(`div`,{className:`mx-auto grid max-w-[100rem] gap-6 px-4 py-4 @min-[56rem]/guide:grid-cols-[16rem_minmax(0,1fr)] @min-[90rem]/guide:gap-8 @min-[90rem]/guide:px-6`,children:[R,V]})}),t[60]=R,t[61]=V,t[62]=ee):ee=t[62],ee}function Sd(e){let t=(0,Q.c)(28),{environmentId:n,reference:r,title:i}=e,a;t[0]!==n||t[1]!==r?(a=Jr.reviewGuide({environmentId:n,input:r}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=Et(a),s;t[3]===n?s=t[4]:(s=Jr.generateReviewGuide.permissionAtom(n),t[3]=n,t[4]=s);let c=_(s),l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[5]=l):l=t[5];let u=Dt(Jr.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=()=>ya.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),v;t[11]!==p?.run?._tag||t[12]!==g?(v=()=>{p?.run?._tag===`Running`&&g()},t[11]=p?.run?._tag,t[12]=g,t[13]=v):v=t[13];let y=p?.run?._tag,b;t[14]===y?b=t[15]:(b=[y],t[14]=y,t[15]=b),(0,Z.useEffect)(v,b);let x;t[16]!==n||t[17]!==u||t[18]!==r||t[19]!==m||t[20]!==g?(x=async()=>{if(m)return;f(!0),g();let e=await u({environmentId:n,input:r});f(!1),e._tag===`Failure`&&(ya.getState().settle(ba(n,r)),gt.add({type:`error`,title:`Could not start a review guide`,description:ai(Ve(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]=x):x=t[21];let S=x,C;return t[22]!==c||t[23]!==p||t[24]!==o||t[25]!==m||t[26]!==S?(C={query:o,data:p,running:m,canWrite:c,write:S},t[22]=c,t[23]=p,t[24]=o,t[25]=m,t[26]=S,t[27]=C):C=t[27],C}function Cd(e){let t=(0,Q.c)(72),{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:h,data:g,running:_,canWrite:v,write:y}=Sd(p),b;t[4]!==n||t[5]!==r?(b=ba(n,r),t[4]=n,t[5]=r,t[6]=b):b=t[6];let x=b,S;t[7]===r?S=t[8]:(S=Fi(r),t[7]=r,t[8]=S);let C=S,w=Ii(r),T=Pi(Td),D=Pi(wd),O;t[9]!==T||t[10]!==s||t[11]!==c||t[12]!==w||t[13]!==D||t[14]!==C?(O=!s&&c===null?null:{canComment:s,pending:w,onComment:e=>{let{path:t,oldPath:n,position:r,body:i}=e;return T(C,{id:Li(),path:t,...n===null?{}:{oldPath:n},position:r,body:i})},onRemove:e=>D(C,e),onAskAgent:c},t[9]=T,t[10]=s,t[11]=c,t[12]=w,t[13]=D,t[14]=C,t[15]=O):O=t[15];let k=O,A,j;t[16]!==o||t[17]!==x?(A=()=>{if(o)return ya.getState().setShown(x),()=>{ya.getState().shownKey===x&&ya.getState().setShown(null)}},j=[o,x],t[16]=o,t[17]=x,t[18]=A,t[19]=j):(A=t[18],j=t[19]),(0,Z.useEffect)(A,j);let M=g?.guide??null,N=o&&M!==null,P;t[20]===f?P=t[21]:(P=()=>f?.(),t[20]=f,t[21]=P);let F=(0,Z.useEffectEvent)(P),I;t[22]!==F||t[23]!==N?(I=()=>{N&&F()},t[22]=F,t[23]=N,t[24]=I):I=t[24];let L;t[25]===N?L=t[26]:(L=[N],t[25]=N,t[26]=L),(0,Z.useEffect)(I,L);let R=g?.run??null,z=g?.currentHeadSha??null,B=M!==null&&z!==null&&z!==M.headSha,V=R?._tag===`Failed`&&R.headSha===z?R.detail:null,ee;t[27]!==v||t[28]!==_||t[29]!==y?(ee=(e,t)=>v?(0,$.jsxs)(W,{size:t,variant:`outline`,disabled:_,onClick:()=>void y(),children:[_?(0,$.jsx)(ht,{}):(0,$.jsx)(E,{"aria-hidden":!0,className:`size-3.5`}),_?`Reading the change...`:e]}):null,t[27]=v,t[28]=_,t[29]=y,t[30]=ee):ee=t[30];let H=ee;if(M===null){if(h.isPending&&g===null){let e;return t[31]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{className:`flex min-h-48 items-center justify-center`,children:(0,$.jsx)(ht,{})}),t[31]=e):e=t[31],e}let e=_?`Writing a review guide`:V===null?`No review guide yet`:`Could not write a review guide`,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=_?`An agent is reading the change. A large one takes a few minutes. You can leave; you will be told when it is ready.`:V===null?h.error??`A guide is a tour of the change: stops through the code in reading order, with the calls only a maintainer can make.`:Ed,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=V===null?`Write guide`:`Try again`,o;t[36]!==a||t[37]!==H?(o=H(a,`sm`),t[36]=a,t[37]=H,t[38]=o):o=t[38];let s;t[39]!==V||t[40]!==_?(s=V===null||_?null:(0,$.jsx)(Dd,{detail:V}),t[39]=V,t[40]=_,t[41]=s):s=t[41];let c;return t[42]!==n||t[43]!==i||t[44]!==o||t[45]!==s?(c=(0,$.jsxs)(`div`,{className:`scrollbar-gutter-both flex h-full flex-col items-center justify-center-safe gap-2 overflow-y-auto px-4 py-10 text-center`,children:[n,i,o,s]}),t[42]=n,t[43]=i,t[44]=o,t[45]=s,t[46]=c):c=t[46],c}let U;t[47]!==v||t[48]!==V||t[49]!==_||t[50]!==B||t[51]!==H?(U=B||V!==null||_?(0,$.jsxs)(Gi,{variant:_?`info`:`warning`,children:[_?(0,$.jsx)(ht,{}):(0,$.jsx)(m,{}),(0,$.jsx)(Wi,{children:_?`Rewriting this guide. You will be told when the new one is ready.`:V===null?`Written before the latest push.`:(0,$.jsxs)($.Fragment,{children:[`Could not rewrite this guide. ${Ed}`,(0,$.jsx)(Dd,{detail:V})]})}),!_&&v?(0,$.jsx)(Ui,{children:H(`Rewrite`,`xs`)}):null]}):null,t[47]=v,t[48]=V,t[49]=_,t[50]=B,t[51]=H,t[52]=U):U=t[52];let te=U,ne;t[53]!==n||t[54]!==a?(ne={environmentId:n,cwd:a},t[53]=n,t[54]=a,t[55]=ne):ne=t[55];let re;t[56]!==M||t[57]!==l?(re=l===null?null:(e,t)=>{let n=M.stops[e];n!==void 0&&l(n,e,t)},t[56]=M,t[57]=l,t[58]=re):re=t[58];let ie;t[59]!==o||t[60]!==te||t[61]!==k||t[62]!==n||t[63]!==M||t[64]!==u||t[65]!==d||t[66]!==r||t[67]!==re?(ie=(0,$.jsx)(xd,{environmentId:n,reference:r,guide:M,banner:te,active:o,commenting:k,onAsk:re,onFinish:u,onOpenFile:d}),t[59]=o,t[60]=te,t[61]=k,t[62]=n,t[63]=M,t[64]=u,t[65]=d,t[66]=r,t[67]=re,t[68]=ie):ie=t[68];let ae;return t[69]!==ne||t[70]!==ie?(ae=(0,$.jsx)(Wu,{value:ne,children:ie}),t[69]=ne,t[70]=ie,t[71]=ae):ae=t[71],ae}function wd(e){return e.removeComment}function Td(e){return e.addComment}var Ed=`Check the review guide model in Settings → Source control.`;function Dd(e){let t=(0,Q.c)(3),{detail:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`summary`,{className:`cursor-pointer rounded-sm -outline-offset-2 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:`Technical details`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,$.jsxs)(`details`,{className:`w-full max-w-lg text-xs text-muted-foreground`,children:[r,(0,$.jsx)(`pre`,{className:`scrollbar-gutter-both mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/40 p-3 text-left font-mono text-xs`,children:n})]}),t[1]=n,t[2]=i),i}function Od(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 kd={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`},Ad={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.`},jd=`The host refused it. A rebase stops at the first commit that does not apply cleanly; updating with a merge commit may still work.`,Md=[{value:`summary`,label:`Summary`},{value:`guide`,label:`Guide`},{value:`timeline`,label:`Timeline`},{value:`code`,label:`Code`}],Nd=()=>n(()=>import(`./PullRequestCodeTab-BdXdTg-d.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,339,340,341,342,343,344,345,346,347,348,349,350,351])),Pd=(0,Z.lazy)(Nd);function Fd(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)(Ee,{}),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)(V,{value:e.environmentId,disabled:a,children:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Vi,{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)(de,{value:r,onValueChange:s,children:c})]}),t[8]=s,t[9]=c,t[10]=r,t[11]=l):l=t[11],l}var Id=(e,t)=>{e.preventDefault(),e.stopPropagation(),kl({url:t.url,openLabel:Dl(Br.get(t.provider)),position:{x:e.clientX,y:e.clientY}})};function Ld(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 h;t[9]===p?h=t[10]:(h=(0,$.jsx)(m,{"aria-hidden":!0,className:p}),t[9]=p,t[10]=h);let g;t[11]!==c||t[12]!==f||t[13]!==h?(g=(0,$.jsxs)(tr,{openOnHover:!0,delay:0,closeDelay:120,render:f,children:[c,h]}),t[11]=c,t[12]=f,t[13]=h,t[14]=g):g=t[14];let _;t[15]===u?_=t[16]:(_=(0,$.jsx)(`p`,{className:`text-xs text-foreground`,children:u}),t[15]=u,t[16]=_);let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:`Changes can be cleanly merged.`}),t[17]=v):v=t[17];let y;t[18]!==r.methods||t[19]!==a||t[20]!==i?(y=r.methods.length>0?(0,$.jsx)(`span`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:r.methods.map(e=>(0,$.jsxs)(W,{size:`xs`,variant:`outline`,disabled:i,onClick:()=>a(e),children:[(0,$.jsx)(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]=y):y=t[21];let b;t[22]!==_||t[23]!==y?(b=(0,$.jsxs)($n,{align:`start`,side:`bottom`,className:`max-w-80`,padding:`compact`,children:[_,v,y]}),t[22]=_,t[23]=y,t[24]=b):b=t[24];let x;return t[25]!==b||t[26]!==g?(x=(0,$.jsxs)(nr,{children:[g,b]}),t[25]=b,t[26]=g,t[27]=x):x=t[27],x}function Rd({environmentId:e,shortcutsEnabled:t,getShortcutContext:n,threadRef:r=null,reference:i,listEntry:o=null,refreshToken:s=0,onActed:c,onClose:f,context:p=`page`,composerDraftTarget:m,onBack:h,onSelectPullRequest:y,onGuideShown:b}){let S=Ze(),C=Je(),w=C.find(t=>t.id===i.projectId&&t.environmentId===e),T=w?.repositoryIdentity,O=S.get(e)?.environment.capabilities.threadPullRequests===!0,k=(0,Z.useMemo)(()=>O?ni(i,T):{projectId:i.projectId,repository:i.repository,number:i.number},[i,T,O]),j=`${k.projectId}:${k.host??``}:${k.repository}#${k.number}`,P=o?.projectId===k.projectId&&o.repository.toLowerCase()===k.repository.toLowerCase()&&(k.host===void 0||o.host.toLowerCase()===k.host.toLowerCase())&&o.number===k.number?o:null,[F,R]=(0,Z.useState)(!1),[B,ee]=(0,Z.useState)(0),[H,te]=(0,Z.useState)(`summary`),[ne,re]=(0,Z.useState)(`newest`),[ie,se]=(0,Z.useState)(()=>({pullRequestKey:j,oid:null})),ce=ie.pullRequestKey===j?ie.oid:null,le=e=>{se({pullRequestKey:j,oid:e})},ue=e=>{le(e),te(`code`)},[fe,pe]=(0,Z.useState)(null),_e=e=>{le(null),pe(t=>({path:e,nonce:(t?.nonce??0)+1})),Nd(),te(`code`)},be=ya(t=>t.openRequestKey===ba(e,k));be&&H!==`guide`&&te(`guide`),(0,Z.useEffect)(()=>{be&&ya.getState().requestOpen(null)},[be]);let Ce=`${e}:${j}`,[Te,De]=(0,Z.useState)(()=>({key:Ce,tabs:new Set([`summary`])})),Me=Te.key===Ce?Te.tabs:new Set([H]);(0,Z.useEffect)(()=>{De(e=>e.key===Ce?e.tabs.has(H)?e:{key:Ce,tabs:new Set(e.tabs).add(H)}:{key:Ce,tabs:new Set([H])})},[H,Ce]);let[Fe,Ie]=(0,Z.useState)(!1),Re=(0,Z.useRef)({});(0,Z.useEffect)(()=>{Ie(Re.current[H]??!1)},[H]);let Ue=Fe,We=(0,Z.useRef)({}),Ge=(0,Z.useMemo)(()=>({summary:e=>{We.current.summary=e},timeline:e=>{We.current.timeline=e},code:e=>{We.current.code=e}}),[]),Ye=(0,Z.useRef)(null),Xe=(0,Z.useRef)(null),Qe=(0,Z.useRef)(null);(0,Z.useLayoutEffect)(()=>{let e=Qe.current;e!==null&&(Qe.current=null,Ue&&e.tab===H&&We.current[H]===e.scroller&&(e.scroller.scrollTop=Math.max(0,e.scroller.scrollTop+e.delta)))},[Ue,H]);let $e=Bi(e=>e.pullRequestMergeMethod),et=Bi(e=>e.setPullRequestMergeMethod),tt=wa(e,k.projectId),nt=(0,Z.useMemo)(()=>tt(),[tt]),[rt,it]=(0,Z.useState)(null),at=e=>{it({pullRequestKey:j,method:e})},ot=Od(j),[st,ct]=(0,Z.useState)(null),lt=wt(e,Be),ut=Et(Jr.detail({environmentId:e,input:k})),dt=Et(Jr.activity({environmentId:e,input:k})),ft=Gr(e),[pt,mt]=(0,Z.useState)(()=>ri(typeof window>`u`?void 0:window.localStorage,e,k));(0,Z.useEffect)(()=>{mt(ri(typeof window>`u`?void 0:window.localStorage,e,k))},[e,j,k.projectId,k.repository,k.number]),(0,Z.useEffect)(()=>{ut.data!==null&&(wi(typeof window>`u`?void 0:window.localStorage,e,k,ut.data),mt(ut.data))},[ut.data,e,j,k.projectId,k.repository,k.number]);let ht=Ni({live:ut.data,cached:pt,reference:k}),_t=(0,Z.useMemo)(()=>P===null?null:Kr(P),[P]),xt=(0,Z.useMemo)(()=>ut.data===null?null:{...ut.data,checksState:Ir(ut.data.checks)},[ut.data]),Ot=Yr(e,k,xt,ut.dataUpdatedAt),jt=(0,Z.useMemo)(()=>qr(ht,qr(Ot,_t)),[ht,Ot,_t]),Mt=(0,Z.useMemo)(()=>ht===null||jt===null||jt===ht?ht:{...ht,title:jt.title,state:jt.state,headBranch:jt.headBranch,baseBranch:jt.baseBranch,updatedAt:jt.updatedAt,author:jt.author??ht.author,additions:jt.additions??ht.additions,deletions:jt.deletions??ht.deletions,changedFiles:jt.changedFiles??ht.changedFiles,mergeability:jt.mergeability??ht.mergeability,closedAt:jt.closedAt===void 0?ht.closedAt:jt.closedAt,mergedAt:jt.mergedAt===void 0?ht.mergedAt:jt.mergedAt,isDraft:jt.isDraft??ht.isDraft},[ht,jt]),Nt=dt.data,K=(0,Z.useMemo)(()=>Mt===null?null:{...Mt,capabilities:lt?Mt.capabilities:{...Mt.capabilities,reactions:!1,edit:{changeRequest:!1,comment:!1}},viewerPermissions:lt?Mt.viewerPermissions:{...Mt.viewerPermissions,actions:[],comment:!1,resolve:!1,verdicts:[],requestReviewers:!1,updateMethods:[],labels:!1},author:Nt?.author??Mt.author,reviewers:Nt?.reviewers??Mt.reviewers,comments:Nt?.comments??[],commentCount:Nt?.commentCount??0,commentsTruncated:Nt?.commentsTruncated??!1,reviewThreads:Nt?.reviewThreads??[],commits:Nt?.commits??[],reactions:Nt?.reactions??[]},[Nt,lt,Mt]),Pt=K??jt,Ft=_(Ct),{copyToClipboard:It}=vt({target:`pull request reference`,onCopy:e=>gt.add({type:`success`,title:`${e} copied`}),onError:(e,t)=>gt.add({type:`error`,title:`Failed to copy ${t}`,description:e.message})}),Lt=(0,Z.useEffectEvent)(e=>{!t||e.defaultPrevented||ma()||dr(e,Ft,{context:n()})===`pullRequest.copyNumber`&&(e.preventDefault(),e.stopPropagation(),e.repeat||It(`#${k.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,j]);let Rt=K===null?null:qe(K.url),zt=Br.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?vi(Pt.provider,Pt.number,Pt.headBranch,K?.headRepositoryNameWithOwner,qe(Pt.url)):di(k,T),Ut=(0,Z.useCallback)(e=>{gt.add({type:`error`,title:`Could not copy checkout command`,description:e.message})},[]),Wt=Et(K===null?null:At.listRefs({environmentId:e,input:{cwd:K.workspaceRoot,includeMatchingRemoteRefs:!0,limit:2}})),Gt=K!==null&&Qr(K.baseBranch,Wt.data?.refs??[]),Kt=xc(e,(0,Z.useMemo)(()=>K===null||K.capabilities.stacks!==!0||!O?null:{...k,host:k.host??Ke(K.url)?.host},[K,k,O])),qt=Kt.data,Jt=O&&K?.capabilities.stacks===!0&&K.capabilities.stackActions===!0&&S.get(e)?.environment.capabilities.pullRequestStackActions===!0,Yt=Ti({supportsStackActions:Jt,hasStack:qt!==null,stackPending:!Kt.isFresh,stackError:Kt.error}),Xt=Jt&&qt!==null,Zt=Yt?null:Kt.error?`Couldn't check stack membership`:`Checking stack membership…`,Qt=dt.isPending&&Nt===null,$t=Nt===null?dt.error:null,en=(0,Z.useCallback)(()=>{ut.refresh(),dt.refresh(),Kt.refresh()},[dt.refresh,ut.refresh,Kt.refresh]),[tn,nn]=(0,Z.useState)(0),rn=tn+(ft??0),an=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!Mt)return;let e={key:Ce,updatedAt:Mt.updatedAt};if(pi(an.current,e)){if(dt.isPending)return;dt.refresh(),nn(e=>e+1)}an.current=e},[dt.isPending,dt.refresh,Mt,Ce]),Fc(()=>{ut.refresh()},{key:`pull-request:${e}:${j}`});let on=Dt(Jr.invalidate,{reportFailure:!1}),[sn,cn]=(0,Z.useState)(!1),ln=sn||ut.isPending,un=(0,Z.useCallback)(async()=>{cn(!0);try{await on({environmentId:e,input:{reference:k}}),en(),nn(e=>e+1)}finally{cn(!1)}},[e,on,k,en]),dn=(0,Z.useRef)(s);(0,Z.useEffect)(()=>{dn.current!==s&&(dn.current=s,un())},[s,un]);let fn=Dt(Jr.runAction,{reportFailure:!1}),pn=Dt(Jr.comment,{reportFailure:!1}),[mn,hn]=(0,Z.useState)(null),gn=mn!==null,_n=Dt(Jr.update,{reportFailure:!1}),[vn,yn]=(0,Z.useState)(null),bn=vn?.pullRequestKey===j?vn.text:null,[xn,Sn]=(0,Z.useState)(!1),wn=zi(),{environments:En}=yt(),Dn=(0,Z.useMemo)(()=>{let t=C.find(t=>t.id===k.projectId&&t.environmentId===e)?.repositoryIdentity;return He(t,k.repository,k.number)},[e,C,k.number,k.projectId,k.repository]),On=(0,Z.useMemo)(()=>p===`page`?vc({environmentId:e,projectId:k.projectId},C,En.map(e=>({environmentId:e.environmentId,label:e.label,machine:Le(e.serverConfig)}))):[],[p,e,En,C,k.projectId]),[kn,An]=(0,Z.useState)(null),jn=kn?.pullRequestKey===j?kn.environmentId:e,Mn=On.find(e=>e.environmentId===jn)??null,Nn=Mn?.environmentId??e,Pn=Mn?.workspaceRoot??K?.workspaceRoot??w?.workspaceRoot??null,Fn=wt(Nn,ze),In=Ca({environmentId:Nn,cwd:Pn}),Rn=async(t,n,r)=>{c?.(t,`sent`);let i=await fn({environmentId:e,input:{...k,action:t,...n?{mergeMethod:n}:{},...r?{updateMethod:r}:{}}});if(hn(null),i._tag===`Failure`){let e=Ve(i),n=r===`rebase`?jd:Ad[t];return gt.add({type:`error`,title:kd[t],description:ai(e,n)}),c?.(t,`failed`),!1}return t===`revert`&>.add({type:`success`,title:`Revert pull request opened`}),t===`delete-branch`&>.add({type:`success`,title:`Branch deleted`}),Xr(t)?un():en(),c?.(t,`done`),!0},zn=async(e,t,n)=>!lt||mn!==null?!1:(hn(e),Rn(e,t,n)),Bn=async(t,n)=>!lt||mn!==null?{commentPosted:!1}:(hn(n),(await pn({environmentId:e,input:{...k,body:t}}))._tag===`Failure`?(hn(null),gt.add({type:`error`,title:`Could not post the comment`}),{commentPosted:!1}):(await Rn(n)||en(),{commentPosted:!0})),Vn=async t=>{let n=t.trim();if(!lt||K===null||xn)return;if(n.length===0||n===K.title){yn(null);return}Sn(!0);let r=await _n({environmentId:e,input:{...k,title:n}});Sn(!1),r._tag===`Failure`?gt.add({type:`error`,title:`The title could not be saved`,description:ai(Ve(r),`The host refused the new title.`)}):(yn(null),en())},Hn=m??null,Un=In.isAllowed&&Fn,Wn=Hn!==null||Un,Gn=si(Hn!==null),Kn=Sd({environmentId:e,reference:k,title:K?.title??null}),qn=()=>{Kn.write(),Kn.data?.guide??te(`guide`)},Jn=async(e,t,n)=>{let r=n??await wn(e).then(e=>e,()=>null);return r===null?null:(t===null||Sa(r.draftId,t),r)},Yn=async(t,n,r)=>{if(!K||st!==null)return;if(Hn!==null){Sa(Hn,n),gt.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=v(Nn,Mn?.projectId??K.projectId),a=await Jn(i,n);if(ct(null),a!==null&&r?.keepGuide===!0){let t=u.getState().getDraftSession(a.draftId);t!==null&&(kt.getState().openPullRequest(N(t.environmentId,t.threadId),{environmentId:e,projectId:k.projectId,...k.host===void 0?{}:{host:k.host},repository:k.repository,number:k.number,url:K.url}),ya.getState().requestOpen(ba(e,k)))}a===null?gt.add({type:`error`,title:`Could not open a thread`,description:`Try again from the project, or open a thread first.`}):gt.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.`})},Xn=async(e,t,n=`worktree`)=>{if(!Pt||st!==null)return;if(Hn!==null&&t!==null){Sa(Hn,t),gt.add({type:`success`,title:`Added to the composer`,description:`The task is in the composer — read it over, then send.`});return}if(Pn===null||!In.isAllowed||!Tt(Nn,`source-control:write`)||n===`worktree`&&!Tt(Nn,`orchestration:operate`))return;ct(e);let r=gt.add({type:`loading`,title:`Preparing the pull request checkout...`}),i=v(Nn,Mn?.projectId??Pt.projectId),a=await wn(i).then(e=>e,()=>null);if(a===null){ct(null),gt.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 In.run({reference:Pt.url,mode:n,threadId:a.threadId});if(o._tag===`Failure`){ct(null);let e=In.error instanceof Error?In.error.message:null;gt.update(r,{type:`error`,title:`Could not prepare the pull request checkout`,...e?{description:e}:{}});return}if(!await wn(i,{branch:o.value.branch,worktreePath:o.value.worktreePath,envMode:o.value.worktreePath===null?`local`:`worktree`}).then(e=>e!==null,()=>!1)){ct(null),gt.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.`};t===null?gt.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):(await Jn(i,t,a),gt.update(r,o.value.isOnPullRequestHead?{type:`success`,title:`Checkout ready`,description:`The task is in the composer — read it over, then send.`}:s))},Zn=()=>{K&&Yn(`ask`,{...Ei({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,state:K.state,isDraft:K.isDraft})})},Qn=()=>{K&&Yn(`explain`,{...gi({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,state:K.state,isDraft:K.isDraft})})},$n=(e,t,n)=>{K&&Yn(`guide-stop:${t}`,Si({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})},er=(e,t)=>{K&&Yn(`selection:${e.comment.id}`,hi({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)},tr=e=>{Pt&&Xn(`checkout:${e}`,null,e)},nr=e=>{K&&Xn(oi(e),bi({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,state:K.state,isDraft:K.isDraft,finding:e}))},rr=()=>{K&&Xn(`findings`,Oi({number:K.number,title:K.title,url:K.url,headBranch:K.headBranch,baseBranch:K.baseBranch,state:K.state,isDraft:K.isDraft,reviewThreads:K.reviewThreads,comments:K.comments,checks:Or?[]:K.checks,commentsTruncated:K.commentsTruncated}))},ir=()=>{Pt&&Xn(`conflicts`,{prompt:Ci({number:Pt.number,url:Pt.url,headBranch:Pt.headBranch,baseBranch:Pt.baseBranch})})},ar=K?K.capabilities.mergeMethods.filter(e=>K.mergeCapabilities[e]):[],or=rt?.pullRequestKey===j?rt.method:null,sr=Zr(ar,or,nt,$e),cr=Di[sr],lr=`Auto-merge (${cr.toLowerCase()})`,ur=K?.state===`open`&&K.mergeability===`conflicting`,pr=K?.state===`open`&&K.autoMergeEnabled===!0,mr=K?.autoMergeMethod,hr=mr?`Auto-merge (${Di[mr].toLowerCase()})`:`Auto-merge`,_r=K?.state===`open`?K.workflowApprovalsRequired??0:0,vr=K===null?null:li(K),br=St(e,e=>e.reviewGuidesEnabled),xr=Md.filter(e=>(e.value!==`code`||K===null||K.capabilities.diff)&&(e.value!==`guide`||br));(0,Z.useEffect)(()=>{xr.some(e=>e.value===H)||te(`summary`)},[H,xr]);let Sr=e=>K?.capabilities.actions.includes(e)===!0&&K.viewerPermissions.actions.includes(e),Cr=K?Ir(K.checks):null,Tr=jt?.checksState===void 0?Cr:jt.checksState,Dr=Tr!==`failing`&&K?.checks.some(e=>e.status===`action-required`)?`pending`:Tr,Or=Dr!==Cr,kr=K?fi({state:K.state,isDraft:K.isDraft,mergeability:K.mergeability,checksState:Dr,autoMergeEnabled:K.autoMergeEnabled,hasMergeMethod:ar.length>0,canMerge:!Xt&&Sr(`merge`),canMarkReady:Sr(`ready`),canEnableAutoMerge:!Xt&&Sr(`enable-auto-merge`)}):null,jr=K?.state===`open`&&Sr(K.isDraft?`ready`:`draft`)&&!(K.isDraft&&kr===`ready`),Mr=Yt&&K?.state===`open`&&(pr&&Sr(`disable-auto-merge`)||!pr&&kr!==`enable-auto-merge`&&!K.isDraft&&!ur&&Sr(`enable-auto-merge`)&&ar.length>0),Nr=Yt&&K?.state===`open`&&(kr===`enable-auto-merge`||kr===`auto-merge-armed`)&&Sr(`merge`)&&!K.isDraft&&!ur&&ar.length>0,Pr=K?.state===`open`&&Sr(`merge`)&&!K.isDraft&&!ur&&ar.length>1,Fr=K?Lr({state:K.state,isDraft:K.isDraft}):null,Rr=K!==null&&xi(K),Vr=En.some(t=>t.environmentId===e&&t.connection.phase===`connected`),Hr=async()=>{K!==null&&await bt()?.dialogs.confirm([`Delete branch ${K.headBranch}?`,`This deletes ${K.headBranch} from ${K.headRepositoryNameWithOwner??K.repository}. Local branches and worktrees are not changed.`].join(`
|
|
217
|
+
`),{variant:`destructive`})&&zn(`delete-branch`)},Ur=_r>0&&!Or&&Sr(`approve-workflows`),Wr=Or?Dr===null?`No checks reported`:zr(Dr).label:K?yr(K.checks):null,$r=K&&!K.commentsTruncated?Ai(K.comments,K.commits).filter(e=>e.outcome===`approved`&&!e.stale).length:0,ei=p===`page`?(0,$.jsxs)(I,{children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(ae,{disabled:st!==null||Pn===null,render:(0,$.jsxs)(W,{size:`xs`,variant:`outline`,"aria-label":st?.startsWith(`checkout`)?`Checking out...`:`Check out`,children:[(0,$.jsx)(ge,{"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)(he,{"aria-hidden":!0,className:`size-3.5 text-muted-foreground`})]})})}),(0,$.jsx)(J,{children:`Check out this pull request`})]}),(0,$.jsxs)(we,{align:`end`,side:`bottom`,children:[(0,$.jsxs)(ke,{disabled:!Un,onClick:()=>tr(`worktree`),children:[(0,$.jsx)(ge,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`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)(ke,{disabled:!In.isAllowed,onClick:()=>tr(`local`),children:[(0,$.jsx)(D,{className:`mt-1 size-3.5 shrink-0 self-start`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`In this repository`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:"Switches the branch you are working in, like `gh pr checkout`."})]})]}),On.length>0?(0,$.jsx)(Fd,{environments:On,value:Nn,onChange:e=>An({pullRequestKey:j,environmentId:e}),disabled:st!==null}):null]})]}):null,ti=(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||Hn===null&&(Pn===null||!Un),onClick:ir,"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)(_l,{seed:P,summary:jt,checkoutCommand:Ht,onCheckoutError:Ut,number:k.number,tabs:xr,activeTab:H,...h?{onBack:h}:{},...f?{onClose:f}:{},actions:Pt?(0,$.jsxs)(Tn,{delay:150,closeDelay:150,timeout:400,children:[Pt.state===`open`&&Pt.mergeability===`conflicting`?ti:null,ei]}):void 0}):(0,$.jsxs)(`div`,{className:`relative flex h-full min-h-0 w-full flex-col bg-background`,children:[F&&K?(0,$.jsx)(tl,{display:`picker`,environmentId:e,reference:k,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&&!f&&`hidden`),children:[(0,$.jsxs)(`div`,{className:`pl-4 grid h-7 min-w-0 items-center overflow-hidden`,children:[(0,$.jsx)(`div`,{"aria-hidden":Ue,inert:Ue,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`,Ue?`pointer-events-none -translate-y-1 opacity-0 duration-100`:`translate-y-0 opacity-100 delay-50 duration-150`),children:K&&Fr?(0,$.jsxs)($.Fragment,{children:[h?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(W,{size:`icon-micro`,variant:`ghost-muted`,onClick:h,className:`-ml-1.5`,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(ye,{"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 bt()?.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 bt()?.shell.openExternal(K.url),onContextMenu:e=>Id(e,K),className:G(`inline-flex shrink-0 cursor-pointer items-center gap-0.5 font-medium underline-offset-2 hover:underline`,Fr.toneClassName),"aria-label":`Open pull request #${K.number} on host`,children:[`#`,K.number,(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-2.5`})]})}),(0,$.jsx)(J,{side:`top`,children:Dl(zt)})]})]}):null}),(0,$.jsx)(`div`,{"aria-hidden":!Ue,inert:!Ue,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`,Ue?`translate-y-0 opacity-100 delay-50 duration-150`:`pointer-events-none translate-y-1 opacity-0 duration-100`),children:K&&Fr?(0,$.jsxs)($.Fragment,{children:[h?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(W,{size:`icon-micro`,variant:`ghost-muted`,tabIndex:Ue?0:-1,onClick:h,className:`-ml-1.5`,"aria-label":`Back to this thread's pull requests`,children:(0,$.jsx)(ye,{"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:Ue?0:-1,onClick:()=>void bt()?.shell.openExternal(K.url),onContextMenu:e=>Id(e,K),className:G(`inline-flex shrink-0 cursor-pointer items-center gap-0.5 font-medium underline-offset-2 hover:underline`,Fr.toneClassName),"aria-label":`Open pull request #${K.number} on host`,children:[`#`,K.number,(0,$.jsx)(xe,{"aria-hidden":!0,className:`size-2.5`})]})}),(0,$.jsx)(J,{side:`top`,children:Dl(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 select-none items-center justify-end gap-1`,children:[K?(0,$.jsxs)(Tn,{delay:150,closeDelay:150,timeout:400,children:[p===`page`?(0,$.jsx)(tl,{display:`count`,environmentId:e,reference:k,url:K.url,threadRef:null}):null,!qt&&Jt&&Kt.error?(0,$.jsx)(W,{variant:`ghost`,size:`xs`,onClick:Kt.refresh,children:`Retry stack lookup`}):null,qt?(0,$.jsx)(zc,{hostLabel:zt.label,stack:qt,notice:Kt.notice,onRetry:Kt.error?Kt.refresh:void 0,reference:k,environmentId:e,onSelect:y,mergeMethod:sr,stale:!Kt.isFresh,canMerge:Jt&&Sr(`merge`)&&ar.length>0,canRebase:Jt&&K.viewerPermissions.stackRebase===!0,onActed:()=>{en(),c?.()}}):null,pr&&kr!==`auto-merge-armed`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(M,{size:`control`,variant:`info`,role:`img`,"aria-label":hr,children:[(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:hr})]})}),(0,$.jsxs)(J,{side:`top`,children:[hr,`: the host will merge this on its own once its requirements are met`]})]}):null,kr===`resolve`?ti:kr===`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:gn,onClick:()=>void zn(`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`})]}):kr===`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:gn,"aria-disabled":Zt!==null||void 0,"aria-description":Zt??void 0,...Zt===null?ot.props(`enable-auto-merge`,()=>void zn(`enable-auto-merge`,sr)):{},"aria-label":mn===`enable-auto-merge`?`Enabling...`:ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr,children:[ot.isArmed(`enable-auto-merge`)?(0,$.jsx)(x,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(Cc,{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:mn===`enable-auto-merge`?`Enabling...`:ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr})]})})]})})}),(0,$.jsx)(J,{side:`top`,children:Zt??(mn===`enable-auto-merge`?`Enabling...`:ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:lr)})]}):kr===`auto-merge-armed`?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsxs)(M,{size:`control`,variant:`info`,role:`img`,"aria-label":hr,children:[(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(`span`,{className:`@max-[30rem]/pr-header:hidden`,children:hr})]})}),(0,$.jsxs)(J,{side:`top`,children:[hr,`: the host will merge this on its own once its requirements are met`]})]}):kr===`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:gn,"aria-disabled":Zt!==null||void 0,"aria-description":Zt??void 0,...Zt===null?ot.props(`merge`,()=>void zn(`merge`,sr)):{},"aria-label":mn===`merge`?`Merging...`:ot.isArmed(`merge`)?`Confirm merge?`:cr,children:[ot.isArmed(`merge`)?(0,$.jsx)(x,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(X.merged,{"aria-hidden":!0,className:`size-3.5`}),(0,$.jsx)(Cc,{className:`@max-[30rem]/pr-header:hidden`,children:(0,$.jsxs)(`span`,{className:`grid`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`invisible col-start-1 row-start-1`,children:cr}),(0,$.jsx)(`span`,{className:`col-start-1 row-start-1`,children:mn===`merge`?`Merging...`:ot.isArmed(`merge`)?`Confirm merge?`:cr})]})})]})})}),(0,$.jsx)(J,{side:`top`,children:Zt??(mn===`merge`?`Merging...`:ot.isArmed(`merge`)?`Confirm merge?`:cr)})]}):(kr===`merged`||kr===`closed`)&&Fr!==null?(0,$.jsx)(M,{size:`control`,variant:`outline`,children:(0,$.jsxs)(`span`,{className:G(`flex items-center gap-1`,Fr.toneClassName),children:[(0,$.jsx)(Fr.Icon,{className:`size-3.5`}),Fr.label]})}):null,ei,(0,$.jsxs)(I,{children:[(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(ae,{render:(0,$.jsx)(W,{"aria-label":ln?`Refreshing pull request`:`More pull request actions`,size:`icon-xs`,variant:`ghost-muted`}),children:ln?(0,$.jsx)(xa,{refreshing:!0,size:`md`}):(0,$.jsx)(d,{className:`size-4`})})}),(0,$.jsx)(J,{children:ln?`Refreshing pull request`:`More pull request actions`})]}),(0,$.jsxs)(we,{align:`end`,side:`bottom`,children:[(0,$.jsx)(tl,{display:`menu-item`,environmentId:e,reference:k,url:K.url,threadRef:r??(typeof m==`object`?m:null),onPickerOpenChange:R}),(0,$.jsxs)(ke,{disabled:ln,onClick:()=>void un(),children:[(0,$.jsx)(xa,{size:`sm`,refreshing:ln}),`Refresh`]}),(0,$.jsxs)(ke,{disabled:st!==null,onClick:Zn,children:[(0,$.jsx)(oe,{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:Hn===null?`Opens a thread that knows which pull request you mean.`:`Adds the pull request to this thread's composer.`})]})]}),(0,$.jsxs)(ke,{disabled:st!==null,onClick:Qn,children:[(0,$.jsx)(L,{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)(ke,{disabled:st!==null||!Wn,onClick:rr,children:[(0,$.jsx)(A,{className:`size-3.5`}),st===`findings`?`Preparing...`:Gn.fixFindings]}),br&&Kn.canWrite?(0,$.jsxs)(ke,{disabled:Kn.running,onClick:qn,children:[(0,$.jsx)(E,{className:`size-3.5`}),Kn.running?`Writing guide...`:Kn.data?.guide==null?`Write guide`:`Rewrite guide`]}):null,On.length>0?(0,$.jsx)(Fd,{environments:On,value:Nn,onChange:e=>An({pullRequestKey:j,environmentId:e}),disabled:st!==null}):null,(0,$.jsx)(Ee,{}),K.state===`open`?(0,$.jsxs)($.Fragment,{children:[jr?(0,$.jsxs)(ke,{disabled:gn,onClick:()=>void zn(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,Nr?(0,$.jsxs)(ke,{closeOnClick:ot.isArmed(`merge`),"aria-label":ot.isArmed(`merge`)?`Confirm merge?`:`Merge now`,disabled:gn,...ot.props(`merge`,()=>void zn(`merge`,sr)),children:[(0,$.jsx)(X.merged,{className:`size-3.5`}),ot.isArmed(`merge`)?`Confirm merge?`:`Merge now`]}):null,pr&&Sr(`disable-auto-merge`)?(0,$.jsxs)(ke,{disabled:gn,onClick:()=>void zn(`disable-auto-merge`),children:[(0,$.jsx)(X.merged,{className:`size-3.5`}),`Disable auto-merge`]}):Mr?(0,$.jsxs)(ke,{closeOnClick:ot.isArmed(`enable-auto-merge`),"aria-label":ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:`Enable auto-merge`,disabled:gn,...ot.props(`enable-auto-merge`,()=>void zn(`enable-auto-merge`,sr)),children:[(0,$.jsx)(X.merged,{className:`size-3.5`}),ot.isArmed(`enable-auto-merge`)?`Confirm auto-merge?`:`Enable auto-merge`]}):null,Pr?(0,$.jsxs)($.Fragment,{children:[jr||Nr||Mr?(0,$.jsx)(Ee,{}):null,(0,$.jsx)(de,{value:sr,onValueChange:e=>{let t=e;at(t),et(t)},children:ar.map(e=>(0,$.jsx)(V,{value:e,disabled:gn,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:Di[e]})]})},e))})]}):null,yi(jr,Mr||Nr,Pr)?(0,$.jsx)(Ee,{}):null]}):null,(0,$.jsxs)(ke,{onClick:()=>void bt()?.shell.openExternal(K.url),children:[(0,$.jsx)(Se,{className:`size-3.5`}),Dl(zt)]}),(0,$.jsxs)(ke,{onClick:()=>It(K.url,`PR link`),children:[(0,$.jsx)(Oe,{className:`size-3.5`}),`Copy link`,(0,$.jsx)(U,{children:fr(Ft,`thread.copyReference`)})]}),(0,$.jsxs)(ke,{onClick:()=>It(`#${k.number}`,`PR number`),children:[(0,$.jsx)(a,{className:`size-3.5`}),`Copy PR number`,(0,$.jsx)(U,{children:fr(Ft,`pullRequest.copyNumber`)})]}),K.state===`open`&&Sr(`close`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{}),(0,$.jsxs)(ke,{closeOnClick:ot.isArmed(`close`),"aria-label":ot.isArmed(`close`)?`Confirm close?`:`Close pull request`,variant:`destructive`,disabled:gn,...ot.props(`close`,()=>void zn(`close`)),children:[(0,$.jsx)(X.closed,{className:`size-3.5`}),ot.isArmed(`close`)?`Confirm close?`:`Close pull request`]})]}):K.state===`closed`&&Sr(`reopen`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{}),(0,$.jsxs)(ke,{disabled:gn,onClick:()=>void zn(`reopen`),children:[(0,$.jsx)(X.reopen,{className:`size-3.5`}),`Reopen pull request`]})]}):K.state===`merged`&&Sr(`revert`)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{}),(0,$.jsxs)(ke,{closeOnClick:ot.isArmed(`revert`),"aria-label":ot.isArmed(`revert`)?`Confirm revert?`:`Revert changes`,variant:ot.isArmed(`revert`)?`destructive`:`default`,disabled:gn,...ot.props(`revert`,()=>void zn(`revert`)),children:[(0,$.jsx)(ve,{className:`size-3.5`}),ot.isArmed(`revert`)?`Confirm revert?`:`Revert changes`]})]}):null,Rr?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ee,{}),(0,$.jsxs)(ke,{variant:`destructive`,disabled:gn||!Vr,onClick:()=>void Hr(),children:[(0,$.jsx)(Pe,{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:mn===`delete-branch`?`Deleting branch...`:`Delete branch`}),(0,$.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:Vr?K.headBranch:`Reconnect to delete this branch`})]})]})]}):null]})]})]}):null,f?(0,$.jsx)(W,{size:`icon-xs`,variant:`ghost`,"aria-label":`Collapse pull request panel`,onClick:f,children:(0,$.jsx)(Ne,{className:`size-3.5`})}):null]}),(0,$.jsx)(`div`,{className:G(`col-span-2 grid`,Ue?`grid-rows-[1fr]`:`grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`),children:(0,$.jsx)(`div`,{ref:Xe,className:G(`min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none`,Ue?`translate-y-0 opacity-100 delay-50`:`translate-y-1 opacity-0 duration-100`),inert:!Ue,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)(Ar,{actor:K.author,profileUrl:Vt,variant:`avatar`,className:`shrink-0`}),(0,$.jsx)(`span`,{className:`shrink-0`,children:Cn(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:[vr?(0,$.jsxs)(Ld,{baseBranch:K.baseBranch,freshness:vr,pending:gn,onUpdate:e=>void zn(`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)(va,{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)(va,{value:K.baseBranch,showTitle:!1})})]})}),(0,$.jsx)(J,{side:`top`,children:Gt?`Stacked on ${K.baseBranch}`:K.baseBranch})]}),(0,$.jsx)(ye,{"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)(va,{value:K.headBranch,showTitle:!1})})}),(0,$.jsx)(J,{side:`top`,children:K.headBranch})]})]}),(0,$.jsxs)(`span`,{className:`ml-auto inline-flex shrink-0 items-baseline justify-end gap-2 text-2xs`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-baseline gap-1 tabular-nums`,"aria-label":`${K.changedFiles.toLocaleString()} changed ${K.changedFiles===1?`file`:`files`}`,children:[(0,$.jsx)(Ae,{"aria-hidden":!0,className:`size-3 self-center`}),K.changedFiles.toLocaleString()]}),(0,$.jsx)(Zc,{environmentId:e,reference:k,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`,Ue?`grid-rows-[0fr]`:`grid-rows-[1fr] transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none`),children:(0,$.jsx)(`div`,{ref:Ye,className:G(`min-h-0 overflow-hidden transition-[opacity,transform] duration-150 ease-out motion-reduce:transform-none motion-reduce:transition-none`,Ue?`-translate-y-1 opacity-0 duration-100`:`translate-y-0 opacity-100 delay-50`),inert:Ue,children:K?(0,$.jsx)(ol,{title:bn===null?(0,$.jsxs)(sl,{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})]}),gs(K)?(0,$.jsx)(ys,{"aria-label":`Edit title`,onClick:()=>yn({pullRequestKey:j,text:K.title})}):null]}):(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(Ln,{autoFocus:!0,size:`sm`,disabled:xn,value:bn,"aria-label":`Pull request title`,onChange:e=>yn({pullRequestKey:j,text:e.target.value}),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),Vn(bn)):e.key===`Escape`&&(e.preventDefault(),yn(null))}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(W,{size:`xs`,variant:`ghost`,disabled:xn,onClick:()=>yn(null),children:`Cancel`}),(0,$.jsx)(W,{size:`xs`,variant:`outline`,disabled:!lt||xn||bn.trim().length===0,onClick:()=>void Vn(bn),children:xn?`Saving...`:`Save`})]})]}),author:(0,$.jsx)(Ar,{actor:K.author,profileUrl:Vt}),updated:(0,$.jsxs)(`span`,{children:[`updated `,Cn(K.updatedAt)]}),checkout:Ht?(0,$.jsx)(ul,{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:vr?(0,$.jsxs)(Ld,{baseBranch:K.baseBranch,freshness:vr,pending:gn,onUpdate:e=>void zn(`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)(va,{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)(va,{value:K.baseBranch,showTitle:!1})})]})}),(0,$.jsx)(J,{side:`top`,children:Gt?`Stacked on ${K.baseBranch}`:K.baseBranch})]}),head:(0,$.jsx)(ul,{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)(Zc,{environmentId:e,reference:k,additions:K.additions,deletions:K.deletions,className:`shrink-0 font-mono text-xs`,eager:!0})}):null})}),K?(0,$.jsx)(cl,{tabs:xr,value:H,onValueChange:te,onTabIntent:e=>{e===`code`&&Nd()},children:H===`summary`?Ur?(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:gn,...ot.props(`approve-workflows`,()=>void zn(`approve-workflows`)),"aria-label":mn===`approve-workflows`?`Approving...`:ot.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`,children:[(0,$.jsx)(g,{"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:mn===`approve-workflows`?`Approving...`:ot.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`})]})]})})}),(0,$.jsx)(J,{side:`top`,children:mn===`approve-workflows`?`Approving...`:ot.isArmed(`approve-workflows`)?`Confirm approve?`:`Approve workflows to run`})]}):(0,$.jsx)(ll,{className:`text-muted-foreground`,"aria-label":Wr?`Checks: ${Wr}`:`Checks`,icon:Dr===null?(0,$.jsx)(l,{"aria-hidden":!0,className:`size-3.5`}):(0,$.jsx)(Bu,{checks:K.checks,stale:Or,checksState:Dr,threadRef:r}),label:Wr}):H===`timeline`?(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(wr,{className:G(`whitespace-nowrap text-2xs transition-opacity`,(Qt||$t)&&`opacity-35`),children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"aria-label":$t?`Comments unavailable`:`${K.commentCount.toLocaleString()} ${K.commentCount===1?`comment`:`comments`}`,children:[(0,$.jsx)(je,{"aria-hidden":!0,className:`size-3`}),$t?`—`:Qt?`…`:K.commentCount.toLocaleString()]}),(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,"aria-label":$t?`Commits unavailable`:`${K.commits.length.toLocaleString()} ${K.commits.length===1?`commit`:`commits`}`,children:[(0,$.jsx)(me,{"aria-hidden":!0,className:`size-3`}),$t?`—`:Qt?`…`:K.commits.length.toLocaleString()]}),$r>0?(0,$.jsxs)(`span`,{className:G(`inline-flex items-center gap-1`,gr(`approved`)),children:[(0,$.jsx)(Er,{outcome:`approved`,className:`size-3`}),$r.toLocaleString(),(0,$.jsx)(`span`,{className:`sr-only`,children:$r===1?`approval`:`approvals`})]}):null]}),(0,$.jsxs)(W,{size:`xs`,variant:`ghost-muted`,"aria-label":ne===`newest`?`Show oldest activity first`:`Show newest activity first`,onClick:()=>re(e=>e===`newest`?`oldest`:`newest`),children:[(0,$.jsx)(z,{"aria-hidden":!0,className:`size-3`}),ne===`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=We.current[H];if(e.target!==t||t==null)return;let n=t.scrollTop;Ie(e=>{let r=e,i=Ye.current?.scrollHeight??0,a=i-(Xe.current?.scrollHeight??0);return e?n<4&&i>0&&(r=!1):i>0&&n>i+32&&(Qe.current={tab:H,scroller:t,delta:-a},r=!0),Re.current[H]=r,r})},children:ut.error&&!K?(0,$.jsx)(El,{...ji(ut.failure)?{title:`Pull request #${k.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:en,...Dn?{gitHubUrl:Dn}:{}}):K?(0,$.jsxs)(Gs,{value:Bt,children:[Me.has(`summary`)?(0,$.jsx)(`div`,{className:G(`absolute inset-0`,H!==`summary`&&`invisible`),children:(0,$.jsx)(uu,{scrollerRef:Ge.summary,environmentId:e,threadRef:r,reference:k,detail:K,activityPending:Qt,checksStale:Or,activityError:$t,pendingFinding:st,fixFindingLabel:Gn.fixFinding,fixCheckLabel:Gn.fixCheck,...Wn?{onFixFinding:nr}:{},onRefresh:en,onRefreshChecks:un})}):null,Me.has(`guide`)?(0,$.jsx)(`div`,{className:G(`absolute inset-0`,H!==`guide`&&`invisible`),children:(0,$.jsx)(Cd,{environmentId:e,reference:k,active:H===`guide`,title:K.title,workspaceRoot:K.workspaceRoot,canComment:K.capabilities.review.inlineComment&&K.viewerPermissions.comment,onAskAboutLines:(e,t)=>er({comment:e,request:t},{keepGuide:!0}),onAskAboutStop:$n,onFinishReview:K.capabilities.review.verdicts.some(e=>K.viewerPermissions.verdicts.includes(e))?()=>ee(e=>e+1):null,onOpenFile:_e,onTourShown:b})}):null,Me.has(`timeline`)?(0,$.jsx)(`div`,{className:G(`absolute inset-0`,H!==`timeline`&&`invisible`),children:Qt?(0,$.jsx)(xl,{}):$t?(0,$.jsx)(Tl,{error:$t,onRetry:dt.refresh}):(0,$.jsx)(Pu,{scrollerRef:Ge.timeline,detail:K,environmentId:e,threadRef:r,reference:k,order:ne,onOpenCommit:ue,onRefresh:en})}):null,Me.has(`code`)?(0,$.jsx)(`div`,{className:G(`absolute inset-0`,H!==`code`&&`invisible`),children:(0,$.jsx)(Z.Suspense,{fallback:(0,$.jsx)(jo,{label:`Loading pull request diff...`}),children:(0,$.jsx)(Pd,{scrollerRef:Ge.code,onAddToAgentSelection:er,environmentId:e,reference:k,detail:K,selectedCommitOid:ce,onSelectedCommitChange:le,pendingFinding:st,fixFindingLabel:Gn.fixFinding,...Wn?{onFixFinding:nr}:{},onRefresh:en,refreshToken:rn,revealRequest:fe})})}):null]}):null}),K?(0,$.jsx)(`div`,{className:`absolute right-4 bottom-3 z-20`,children:(0,$.jsx)(Rl,{environmentId:e,reference:k,detail:K,actionPending:gn,onCommentAction:Bn,onCommented:en,onReviewSubmitted:en,openReviewRequest:B},JSON.stringify([e,k.projectId,k.host,k.repository,k.number]))}):null]})}function zd(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=Jr.runAction.permissionAtom(n.environmentId),t[0]=n.environmentId,t[1]=d);let f=_(d),p=wa(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 v;t[10]===p?v=t[11]:(v=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 Zr(t,null,p(),Bi.getState().pullRequestMergeMethod)},t[10]=p,t[11]=v);let y;t[12]!==n.environmentId||t[13]!==h||t[14]!==g||t[15]!==v?(y={environmentId:n.environmentId,reference:h,onSuccess:g,resolveMergeMethod:v},t[12]=n.environmentId,t[13]=h,t[14]=g,t[15]=v,t[16]=y):y=t[16];let{actionPending:b,perform:x}=Ta(y),S,C;if(t[17]!==b||t[18]!==f||t[19]!==l||t[20]!==n||t[21]!==r||t[22]!==c||t[23]!==x||t[24]!==u||t[25]!==i){C=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Hr(n,r),a=b||l||u;if(e.length===0){C=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]!==x?(d=e=>{let t=Bd[e].label,r=Bd[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 x(e),onPointerDown:t=>{e===`close`&&t.isPrimary&&t.button===0&&(t.stopPropagation(),c?.(n,t.nativeEvent))}}),children:[a?(0,$.jsx)(ht,{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]=x,t[35]=d):d=t[35],S=(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":b||l,children:e.map(d)})}t[17]=b,t[18]=f,t[19]=l,t[20]=n,t[21]=r,t[22]=c,t[23]=x,t[24]=u,t[25]=i,t[26]=S,t[27]=C}else S=t[26],C=t[27];return C===Symbol.for(`react.early_return_sentinel`)?S:C}var Bd={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}},Vd=`group/pr-row flex w-full items-center gap-2 rounded-md py-1 pr-1 text-left`,Hd=`shrink-0 font-mono text-xs tabular-nums text-muted-foreground`;function Ud(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)(Tr,{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)(Cr,{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 Wd(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:Cn(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 Gd(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)(xr,{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 Kd(e){let t=(0,Q.c)(8),{head:n,base:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(va,{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)(va,{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}function qd(e){if(e.getModifierState?.(`AltGraph`)&&!/^[a-z0-9]$/i.test(e.key))return null;let t=e.key.toLowerCase();return(/^[\p{L}\p{M}]+$/u.test(t)&&!/\p{Script=Latin}/u.test(t)?e.code?.match(/^Key([A-Z])$/)?.[1]?.toLowerCase():void 0)??t}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"]`,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=[ha,Zi];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){if(t.defaultPrevented||t.isComposing||t.metaKey||t.ctrlKey||t.altKey)return null;let n=qd(t);return e.find(e=>e.available&&e.shortcut.toLowerCase()===n)??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:T,shortcut:`B`,available:e.browserAvailable,disabledReason:Yd.browser,onClick:e.onAddBrowser},{label:`Terminal`,icon:C,shortcut:`T`,available:e.terminalAvailable,disabledReason:Yd.terminal,onClick:e.onAddTerminal},{label:`Files`,icon:se,shortcut:`F`,available:e.filesAvailable,disabledReason:Yd.files,onClick:e.onAddFiles},...e.onAddDesign?[{label:`Design`,icon:h,shortcut:`G`,available:e.filesAvailable,disabledReason:`Open a project to use Design.`,onClick:e.onAddDesign}]:[],{label:`Diff`,icon:Ae,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:H,shortcut:`M`,available:e.deviceAvailable,disabledReason:Yd.device,onClick:e.onAddDevice}],a=i.filter(uf),o=a.length===0?-1:Math.min(n,a.length-1),s=(0,Z.useRef)(a);(0,Z.useEffect)(()=>{s.current=a});let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[0]=c):c=t[0],(0,Z.useEffect)(()=>{let e=e=>{let t=nf(s.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)},c);let l=e=>{if(!(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey)&&a.length!==0){if(e.key===`ArrowDown`||e.key===`ArrowRight`)e.preventDefault(),r((o+1)%a.length);else if(e.key===`ArrowUp`||e.key===`ArrowLeft`)e.preventDefault(),r(o===-1?a.length-1:(o-1+a.length)%a.length);else if(e.key===`Enter`){if(e.target!==e.currentTarget)return;let t=a[o];if(!t)return;e.preventDefault(),t.onClick()}}},u=lf,d=e=>o!==-1&&a[o]===e,f=cf,p;t[1]===a?p=t[2]:(p=a.map(sf),t[1]=a,t[2]=p);let m=p.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 _=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`,d(t)&&`bg-card/60`),children:[f(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)(Ki,{variant:`pill`,children:t.shortcut})]}),t.label===`Browser`&&e.browserProfiles.length>1?(0,$.jsxs)(I,{children:[(0,$.jsx)(ae,{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)(he,{className:`size-3.5`})}),(0,$.jsx)(we,{align:`end`,side:`bottom`,sideOffset:6,className:`max-w-56`,children:e.browserProfiles.map(t=>(0,$.jsx)(ke,{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:[f(t,`size-4`),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,$.jsx)(Ki,{variant:`pill`,children:t.shortcut})]})},t.label)),v;t[4]===_?v=t[5]:(v=(0,$.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(14rem,1fr))] gap-x-3 gap-y-2`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==v||t[7]!==g?(y=(0,$.jsxs)(`div`,{className:`w-full max-w-3xl`,children:[g,v]}),t[6]=v,t[7]=g,t[8]=y):y=t[8];let b;return t[9]!==u||t[10]!==l||t[11]!==y||t[12]!==m?(b=(0,$.jsx)(`div`,{ref:u,tabIndex:0,onKeyDown:l,"aria-label":`Open a surface`,"data-surface-launcher-keys":m,className:`scrollbar-gutter-both flex min-h-0 flex-1 flex-col overflow-y-auto bg-muted px-5 py-6 outline-none`,children:y}),t[9]=u,t[10]=l,t[11]=y,t[12]=m,t[13]=b):b=t[13],b}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)??Ri(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=st(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)(T,{className:`size-3 shrink-0`}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,$.jsx)(us,{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)(Ae,{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)(h,{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)(se,{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)(hr,{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)(C,{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)(ue,{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)(pr,{className:`size-3 shrink-0`}):n.target?.platform===`android`?(0,$.jsx)(mr,{className:`size-3 shrink-0`}):(0,$.jsx)(H,{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 Ue(a.pullRequests))Ge(e,{host:n,repository:r.repository,number:r.number})&&(i===void 0||(e.snapshot?.syncedAt??``)>(i.snapshot?.syncedAt??``))&&(i=e);return i}function gf(e){let t=(0,Q.c)(11),{surface:n,environmentId:r,seed:i}=e,a=n.environmentId??r,o=Je(),s=Xe(),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?Ie(l,l.provider):null),d=Ze(),f=a===null?void 0:d.get(a)?.environment.capabilities,p=f?.threadPullRequests===!0?hf(s,a,u,n)?.snapshot??null:null,m=Et(a===null||f?.pullRequests!==!0||p!==null?null:Jr.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 _=Yr(a,g,null),v=p??qr(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=Lr({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=na(ua(ra,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)(sa,{items:a,strategy:ia,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)($i,{sensors:r,collisionDetection:la,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}=ca(o),f;t[8]===l?f=t[9]:(f=aa.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=wn&&e.mode===`inline`,r=lr().profiles,{resolvedTheme:i}=xt(),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=>{t.defaultPrevented||t.isComposing||dr(t,e.keybindings,{context:{...e.getShortcutContext(),rightPanelOpen:!0}})===`rightPanel.new`&&(document.querySelector(Jd)||(!f||p&&e.browserAvailable)&&(t.preventDefault(),t.stopPropagation(),!t.repeat&&(p?e.onAddTools?.():document.querySelector(`[data-surface-launcher-keys]`)?.focus())))},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 x=b,S;t[12]===e?S=t[13]:(S=async(t,n)=>{t.preventDefault(),t.stopPropagation();let r=bt();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&&ga?.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]=S);let C=S,w=Cf,T;t[14]===e?T=t[15]:(T=(t,n)=>{t.button===1&&(t.preventDefault(),t.stopPropagation(),e.onCloseSurface(n))},t[14]=e,t[15]=T);let E=T,D,O;t[16]!==e.activeSurfaceId||t[17]!==u.hasOverflow?(D=()=>{e.activeSurfaceId&&u.hasOverflow&&(a.current?.querySelector(`[data-active-tab='true']`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},O=[e.activeSurfaceId,u.hasOverflow],t[16]=e.activeSurfaceId,t[17]=u.hasOverflow,t[18]=D,t[19]=O):(D=t[18],O=t[19]),(0,Z.useEffect)(D,O);let k,A;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{let e=Qd(a.current);if(!e)return;let t=e.firstElementChild,n=rr(t?[e,t]:e,y);return e.addEventListener(`scroll`,y,{passive:!0}),y(),()=>{n(),e.removeEventListener(`scroll`,y)}},A=[y],t[20]=k,t[21]=A):(k=t[20],A=t[21]),(0,Z.useEffect)(k,A);let j,M;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{let e=Qd(a.current);if(!e)return;let t=t=>{if(t.ctrlKey)return;let n=Math.abs(t.deltaX)>Math.abs(t.deltaY)?t.deltaX:t.deltaY;if(t.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=16),t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=e.clientWidth),n===0)return;let r=e.scrollLeft;e.scrollLeft+=n,e.scrollLeft!==r&&(t.preventDefault(),y())};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},M=[y],t[22]=j,t[23]=M):(j=t[22],M=t[23]),(0,Z.useEffect)(j,M);let N=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 R;t[30]===e.defaultWidth?R=t[31]:(R=e.defaultWidth===void 0?{}:{defaultWidth:e.defaultWidth},t[30]=e.defaultWidth,t[31]=R);let z;t[32]===e.inlineSize?z=t[33]:(z=e.inlineSize?{inlineSize:e.inlineSize}:{},t[32]=e.inlineSize,t[33]=z);let B=e.mode===`inline`&&!e.layoutControls?`pr-28`:`pr-3`,V=n&&`drag-region`,ee=n&&`wco:pr-(--workspace-native-controls-inset)`,H=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)]`,U;t[34]!==B||t[35]!==V||t[36]!==ee||t[37]!==H?(U=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`,B,V,ee,H),t[34]=B,t[35]=V,t[36]=ee,t[37]=H,t[38]=U):U=t[38];let te=e.surfaces,ne=e.onMoveSurface,re;t[39]!==E||t[40]!==C||t[41]!==n||t[42]!==e||t[43]!==o||t[44]!==i?(re=e.surfaces.map(t=>{let r=t.id===e.activeSurfaceId,a=e.pendingSurfaceIds.has(t.id),c=df(t,e.previewSessions,e.terminalLabelsById,e.asideTitlesByThreadId),l=$d(t,e.previewSessions),u=tf(l?e.desktopByTabId[l]??null:null),d=l?e.previewRuntimeTabId?.(l)??null:null;return(0,$.jsxs)(yf,{surfaceId:t.id,disabled:!e.onMoveSurface||o===t.id,"data-active-tab":r,onMouseDown:w,onAuxClick:e=>E(e,t),onContextMenu:e=>void C(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(),ga?.setAudioMuted(d,u!==`muted`).catch(Sf)},children:(0,$.jsx)(at,{className:`size-3`,icon:u===`muted`?tt:it})})}),(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)(be,{className:`size-3.5`})})]},t.id)}),t[39]=E,t[40]=C,t[41]=n,t[42]=e,t[43]=o,t[44]=i,t[45]=re):re=t[45];let ie;t[46]!==e.onMoveSurface||t[47]!==e.surfaces||t[48]!==re?(ie=(0,$.jsx)(Rn,{radius:`none`,ref:a,hideScrollbars:!0,scrollFade:!0,className:`w-fit min-w-0 flex-initial`,"data-right-panel-tab-list":!0,children:(0,$.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center gap-1`,children:(0,$.jsx)(_f,{surfaces:te,onMove:ne,children:re})})}),t[46]=e.onMoveSurface,t[47]=e.surfaces,t[48]=re,t[49]=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:()=>x(-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:()=>x(1),size:`icon-xs`,variant:`ghost`,children:(0,$.jsx)(pe,{})})})}),(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)(P,{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]!==U||t[65]!==ie||t[66]!==ae||t[67]!==oe||t[68]!==ce||t[69]!==le?(ue=(0,$.jsxs)(`div`,{className:U,"data-right-panel-tabbar":!0,children:[ie,ae,oe,se,e.layoutControls,ce,le]}),t[63]=e.layoutControls,t[64]=U,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 me;return t[93]!==e.mode||t[94]!==F||t[95]!==I||t[96]!==L||t[97]!==R||t[98]!==z||t[99]!==ue||t[100]!==fe?(me=(0,$.jsxs)(as,{mode:N,...F,...I,...L,...R,...z,children:[ue,fe]}),t[93]=e.mode,t[94]=F,t[95]=I,t[96]=L,t[97]=R,t[98]=z,t[99]=ue,t[100]=fe,t[101]=me):me=t[101],me}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}=Zn(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)(32),{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:b}=e,x=n===void 0||n,S=r===void 0||r,C=i===void 0||i,w=h===void 0?`Right panel is unavailable`:h,T=g===void 0?0:g,E=l===`popover`?void 0:v,D;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(kf,{}),t[0]=D):D=t[0];let O;t[1]!==E||t[2]!==c?(O=(0,$.jsx)(On,{className:`relative shrink-0 [-webkit-app-region:no-drag]`,pressed:c,onPressedChange:E,"aria-label":`Toggle thread details panel`,variant:`ghost`,size:`sm`,children:D}),t[1]=E,t[2]=c,t[3]=O):O=t[3];let k=O,A;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(`span`,{className:`flex shrink-0`}),t[4]=A):A=t[4];let j;t[5]!==u||t[6]!==l||t[7]!==k?(j=(0,$.jsx)(q,{render:A,children:l===`popover`?(0,$.jsx)(tr,{handle:u,render:k}):k}),t[5]=u,t[6]=l,t[7]=k,t[8]=j):j=t[8];let M=d?` (${d})`:``,N;t[9]===M?N=t[10]:(N=(0,$.jsxs)(J,{side:`bottom`,children:[`Toggle thread details`,M]}),t[9]=M,t[10]=N);let P;t[11]!==j||t[12]!==N?(P=(0,$.jsxs)(Y,{children:[j,N]}),t[11]=j,t[12]=N,t[13]=P):P=t[13];let F=x?P:null,I;t[14]!==_||t[15]!==S||t[16]!==a||t[17]!==o||t[18]!==s?(I=S?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`flex shrink-0`}),children:(0,$.jsx)(On,{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)(y,{className:`size-4`})})}),(0,$.jsx)(J,{side:`bottom`,children:a?`Toggle terminal drawer${s?` (${s})`:``}`:`Terminal drawer is unavailable`})]}):null,t[14]=_,t[15]=S,t[16]=a,t[17]=o,t[18]=s,t[19]=I):I=t[19];let L;t[20]!==b||t[21]!==f||t[22]!==p||t[23]!==m||t[24]!==T||t[25]!==w||t[26]!==C?(L=C?(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{render:(0,$.jsx)(`span`,{className:`flex shrink-0`}),children:(0,$.jsx)(On,{className:`shrink-0 [-webkit-app-region:no-drag]`,pressed:p,onPressedChange:b,"aria-label":T>0?`Toggle right panel, ${T} ${T===1?`tab`:`tabs`}`:`Toggle right panel`,variant:`ghost`,size:`sm`,disabled:!f,children:T>0?(0,$.jsx)(Df,{count:T}):(0,$.jsx)(at,{className:`size-4`,icon:p?nt:$e})})}),(0,$.jsx)(J,{side:`bottom`,children:f?`Toggle right panel${m?` (${m})`:``}`:w})]}):null,t[20]=b,t[21]=f,t[22]=p,t[23]=m,t[24]=T,t[25]=w,t[26]=C,t[27]=L):L=t[27];let R;return t[28]!==F||t[29]!==I||t[30]!==L?(R=(0,$.jsxs)(`div`,{className:`flex h-full shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,"data-panel-layout-controls":!0,children:[F,I,L]}),t[28]=F,t[29]=I,t[30]=L,t[31]=R):R=t[31],R});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?et:Qe,o;t[0]===a?o=t[1]:(o=(0,$.jsx)(at,{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)(On,{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{_s as A,Oo as B,Fc as C,hc as D,pc as E,Jo as F,Yo as I,Ko as L,ms as M,as as N,fc as O,ts as P,ko as R,Lc as S,_c as T,_l as _,Vd as a,Zc as b,Kd as c,zd as d,Rd as f,El as g,kl as h,qd as i,vs as j,dc as k,Ud as l,Dl as m,Of as n,Hd as o,Bu as p,bf as r,Gd as s,Ef as t,Wd as u,hl as v,xc as w,Rc as x,Qc as y,jo as z};
|
|
218
|
+
//# sourceMappingURL=PanelLayoutControls-DiXjRWIw.js.map
|