@p4code/cli 0.8.12 → 0.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (336) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-DUdPoqDO.mjs → binCli-BvhJ8Jqb.mjs} +2111 -1587
  3. package/dist/client/.vite/manifest.json +2144 -2145
  4. package/dist/client/assets/AlertDialogRoot-DvQNG7Nt.js +2 -0
  5. package/dist/client/assets/{AnimatedHeight-D-OJUoBJ.js → AnimatedHeight-CH-N3JTc.js} +2 -2
  6. package/dist/client/assets/{AuthSurfaceShell-TTILQgs8.js → AuthSurfaceShell-Dfm2iXjM.js} +2 -2
  7. package/dist/client/assets/{CSPContext-D8hlJ4eS.js → CSPContext-4VAD2_gc.js} +2 -2
  8. package/dist/client/assets/{ChatGptUsageButton-BG4sHSE5.js → ChatGptUsageButton-BE2a_fvh.js} +2 -2
  9. package/dist/client/assets/ChatMarkdown-2qihmx2E.js +65 -0
  10. package/dist/client/assets/CheckboxIndicator-ClY0P0ol.js +2 -0
  11. package/dist/client/assets/CodexSetupSection.logic-CZIedhFM.js +2 -0
  12. package/dist/client/assets/{CollapsiblePanel-kfl4yLKn.js → CollapsiblePanel-Cubscn-a.js} +2 -2
  13. package/dist/client/assets/ComboboxClear-qTthzuJh.js +2 -0
  14. package/dist/client/assets/{CommandBlock-CgdYijxc.js → CommandBlock-cV3B4sIS.js} +2 -2
  15. package/dist/client/assets/{ComposerPromptEditor-5vyHXxd7.js → ComposerPromptEditor-l0YJjut-.js} +44 -44
  16. package/dist/client/assets/{CompositeRoot-B9Xvst63.js → CompositeRoot-DUqf78yV.js} +2 -2
  17. package/dist/client/assets/{ConnectionStatusDot-DtKQQSMi.js → ConnectionStatusDot-cdpNRZhA.js} +2 -2
  18. package/dist/client/assets/{DevicePanel-DQ8cLDHy.js → DevicePanel-CyqJ_QAv.js} +2 -2
  19. package/dist/client/assets/{DeviceSetup-BP4bZJQS.js → DeviceSetup-B9gRys_T.js} +2 -2
  20. package/dist/client/assets/{DialogTitle-BzKEBo4W.js → DialogTitle-CQU6s1Wy.js} +2 -2
  21. package/dist/client/assets/{DiffCommentAnnotation-x4D5cVr3.js → DiffCommentAnnotation-DqJdp0B7.js} +2 -2
  22. package/dist/client/assets/{DiffFileTree-oPb1WMLR.js → DiffFileTree-C0BZv_u5.js} +2 -2
  23. package/dist/client/assets/DiffPanel-DvpW3Wct.js +2 -0
  24. package/dist/client/assets/{DiffWorkerPoolProvider-D2__qhqn.js → DiffWorkerPoolProvider-C0s_fra9.js} +3 -3
  25. package/dist/client/assets/{EmbeddedDesign-ClvOPYvI.js → EmbeddedDesign-DGCXXVf5.js} +4 -4
  26. package/dist/client/assets/{EnvironmentMachineIcon-COX4G5YJ.js → EnvironmentMachineIcon-DCdlTSYU.js} +2 -2
  27. package/dist/client/assets/{ExpandableText-BHihVj6x.js → ExpandableText-BtdwzlFy.js} +3 -3
  28. package/dist/client/assets/{FieldControl-CIaYJhnp.js → FieldControl-BI2gK4Z0.js} +2 -2
  29. package/dist/client/assets/{FileDiff-CrB6gsM6.js → FileDiff-BtKZeeO5.js} +2 -2
  30. package/dist/client/assets/{FilePreviewPanel-BrfGUkiA.js → FilePreviewPanel-DzVGuSCc.js} +4 -4
  31. package/dist/client/assets/{FoldedSettingsSection-DGBHqNlE.js → FoldedSettingsSection-VCEXXLW3.js} +2 -2
  32. package/dist/client/assets/{FormContext-DTtr4Y3v.js → FormContext-Bgwez2tv.js} +2 -2
  33. package/dist/client/assets/{Icons-BFyKltvl.js → Icons-B5JVkp3z.js} +2 -2
  34. package/dist/client/assets/Input-BQRZG5rU.js +2 -0
  35. package/dist/client/assets/{KeybindingsSettings.logic-_oQM9Dzv.js → KeybindingsSettings.logic-6lVDnd1N.js} +2 -2
  36. package/dist/client/assets/{NoProjectsHero-CCYi-y6n.js → NoProjectsHero-BQBJO2CN.js} +2 -2
  37. package/dist/client/assets/PanelLayoutControls-DnSdAhOm.js +216 -0
  38. package/dist/client/assets/{PierreEntryIcon-CKjQpgLO.js → PierreEntryIcon-B1r7qMgq.js} +2 -2
  39. package/dist/client/assets/PopoverHandle-CBT8hFut.js +2 -0
  40. package/dist/client/assets/PreviewPanel-CtXaNx5N.js +2 -0
  41. package/dist/client/assets/ProjectDefaultsSettings-BYtlqxeq.js +2 -0
  42. package/dist/client/assets/{ProjectFavicon-fx1QfVoh.js → ProjectFavicon-B5bWp7V6.js} +3 -3
  43. package/dist/client/assets/{ProjectIconPickerDialog-CFdK4dy-.js → ProjectIconPickerDialog-BWSyrwJD.js} +2 -2
  44. package/dist/client/assets/{ProjectMonogram-BMGWdmjv.js → ProjectMonogram-B9iJhcVp.js} +2 -2
  45. package/dist/client/assets/{ProviderAuthTerminal-B43zNZyt.js → ProviderAuthTerminal-B2L5_uXE.js} +2 -2
  46. package/dist/client/assets/{ProviderModelPicker-7TESki3o.js → ProviderModelPicker-B8ibbi9S.js} +2 -2
  47. package/dist/client/assets/{ProviderSettingsForm-DTbceLMt.js → ProviderSettingsForm-DYn7It9I.js} +2 -2
  48. package/dist/client/assets/PullRequestCodeTab-BfSQc1r1.js +6 -0
  49. package/dist/client/assets/{ReadOnlySourcePreview-b2w3OoiX.js → ReadOnlySourcePreview-8MghAaC9.js} +2 -2
  50. package/dist/client/assets/{RenderErrorBoundary-Dkgc28VE.js → RenderErrorBoundary-Dm9BLD1I.js} +2 -2
  51. package/dist/client/assets/{ScheduledTasksSettings-CEsxWqiH.js → ScheduledTasksSettings-ClZG_1G7.js} +2 -2
  52. package/dist/client/assets/{ScopedSwitch-Bku3NuH1.js → ScopedSwitch-C7nxtEAT.js} +2 -2
  53. package/dist/client/assets/{ScrollAreaCorner-SeZ1sx-t.js → ScrollAreaCorner-CoeXGFSL.js} +2 -2
  54. package/dist/client/assets/{SecretInput-D0DyMDSw.js → SecretInput-CROqj1gF.js} +2 -2
  55. package/dist/client/assets/SelectScrollUpArrow-SDOpV3nj.js +2 -0
  56. package/dist/client/assets/{SettingsPanels-BoxSRF3Y.js → SettingsPanels-kXpGLc3M.js} +6 -6
  57. package/dist/client/assets/{SettingsPanels.logic-DIWicQHy.js → SettingsPanels.logic-CcNyZsm-.js} +2 -2
  58. package/dist/client/assets/{SettingsScopeNotice-4PZ3qjUl.js → SettingsScopeNotice-CM4ubyNs.js} +2 -2
  59. package/dist/client/assets/{T3ConnectAccountPages-DA0BptAt.js → T3ConnectAccountPages-Cm4JG3hx.js} +2 -2
  60. package/dist/client/assets/{T3ConnectSidebarSignIn-B05eHBr6.js → T3ConnectSidebarSignIn-CmvCTtlG.js} +2 -2
  61. package/dist/client/assets/{ThemeEditorPanel-DWb0qJem.js → ThemeEditorPanel-kOwPAMtd.js} +3 -3
  62. package/dist/client/assets/ThreadTerminalDrawer-CK0khkH6.js +5 -0
  63. package/dist/client/assets/TooltipViewport-BKD6QABG.js +2 -0
  64. package/dist/client/assets/{Virtualizer-Cyq5hRoq.js → Virtualizer-B895TWmX.js} +2 -2
  65. package/dist/client/assets/{WorkspaceBreadcrumb-B0Ap9wKu.js → WorkspaceBreadcrumb-BmVcurpi.js} +2 -2
  66. package/dist/client/assets/{WorkspacePageContainer-COKQZB3N.js → WorkspacePageContainer-BSjVd7h4.js} +2 -2
  67. package/dist/client/assets/{WorkspacePageHeader-BDzzcsWQ.js → WorkspacePageHeader-BLYOcS9Z.js} +2 -2
  68. package/dist/client/assets/_chat-akhFQFVf.js +45 -0
  69. package/dist/client/assets/{_chat.index-obkH3dRC.js → _chat.index-P-ZRID1j.js} +2 -2
  70. package/dist/client/assets/{_chat.new-DVE644MB.js → _chat.new-DXkFcRYp.js} +2 -2
  71. package/dist/client/assets/_chat.pull-requests-BYR5YTIM.js +2 -0
  72. package/dist/client/assets/{abnfDiagram-VCTEODGH-CPHKGdm2.js → abnfDiagram-VCTEODGH-CcoyEMJc.js} +2 -2
  73. package/dist/client/assets/{alert-B2wk0CaO.js → alert-5swcxUBm.js} +2 -2
  74. package/dist/client/assets/architecture-7GRP2DOG-BCI44Tco.js +1 -0
  75. package/dist/client/assets/{architectureDiagram-5GKGNRK7-DZFW2-cw.js → architectureDiagram-5GKGNRK7-CXxubV6d.js} +2 -2
  76. package/dist/client/assets/assets-C7tdule6.js +2 -0
  77. package/dist/client/assets/{blockDiagram-I7D4REHJ-DmEMRtTm.js → blockDiagram-I7D4REHJ-DWnNJQVf.js} +2 -2
  78. package/dist/client/assets/{browserHistoryStore-VpfOHXQM.js → browserHistoryStore-PqPCT4tW.js} +2 -2
  79. package/dist/client/assets/{browserLinkTarget-BPuATALO.js → browserLinkTarget-CWURM-O2.js} +2 -2
  80. package/dist/client/assets/{c4Diagram-7LVT6UL2-eYwJlimj.js → c4Diagram-7LVT6UL2-DKlxhhfG.js} +2 -2
  81. package/dist/client/assets/channel-FPHxEbB1.js +2 -0
  82. package/dist/client/assets/{checkbox-DU_a7ZnJ.js → checkbox-1tz9neVf.js} +2 -2
  83. package/dist/client/assets/{chunk-4HAMMTFA-cctCxKWZ.js → chunk-4HAMMTFA-BXCbWh-l.js} +2 -2
  84. package/dist/client/assets/{chunk-75Z2AOVW-yaFLBspz.js → chunk-75Z2AOVW-ByRA_PDR.js} +2 -2
  85. package/dist/client/assets/{chunk-DU6HZSFF-COvkbqst.js → chunk-DU6HZSFF-CxOE2RJx.js} +2 -2
  86. package/dist/client/assets/{chunk-F27PBJKO-BoZkG8KP.js → chunk-F27PBJKO-DXbxgIcF.js} +2 -2
  87. package/dist/client/assets/{chunk-GMAD6QVW-D54p8a4L.js → chunk-GMAD6QVW-C-CPxvzK.js} +2 -2
  88. package/dist/client/assets/{chunk-GVQU2GXP-CDiM6HNZ.js → chunk-GVQU2GXP-N8FA1SLM.js} +2 -2
  89. package/dist/client/assets/{chunk-IMKFNOWR-BCKRWLFe.js → chunk-IMKFNOWR-DTBCxfEA.js} +2 -2
  90. package/dist/client/assets/{chunk-L3NEJ4N5-DFKc7N9P.js → chunk-L3NEJ4N5-DpY0Sgfm.js} +2 -2
  91. package/dist/client/assets/{chunk-OSK3NFVY-DGczxohY.js → chunk-OSK3NFVY-BZXi7c79.js} +2 -2
  92. package/dist/client/assets/{chunk-P2QGCYS3-C-hXHVpV.js → chunk-P2QGCYS3-CEZ0Wrp3.js} +2 -2
  93. package/dist/client/assets/{chunk-POPQ4Y6H-BMxZmq3k.js → chunk-POPQ4Y6H-ChY6VtHX.js} +2 -2
  94. package/dist/client/assets/{chunk-PWAF6VOD-CtRucGgL.js → chunk-PWAF6VOD-ynZZsG4M.js} +2 -2
  95. package/dist/client/assets/{chunk-SHT3W25Y-B5VCRMvd.js → chunk-SHT3W25Y-B2nWifo1.js} +2 -2
  96. package/dist/client/assets/{chunk-SVP7TREG-BpH-ABz6.js → chunk-SVP7TREG-B8mLhKtO.js} +2 -2
  97. package/dist/client/assets/{chunk-TICWLB2K-CTkLpoi-.js → chunk-TICWLB2K-DRpXMD23.js} +2 -2
  98. package/dist/client/assets/classDiagram-ZZMXUADV-BmhihMCg.js +2 -0
  99. package/dist/client/assets/classDiagram-v2-VYDZK3BY-BmhihMCg.js +2 -0
  100. package/dist/client/assets/{color-picker-CYOS1hwQ.js → color-picker-N6f_Hu7P.js} +2 -2
  101. package/dist/client/assets/{combobox-CZradSHe.js → combobox-B07cVaQY.js} +2 -2
  102. package/dist/client/assets/{command-BB0IyhBc.js → command-B70eQIps.js} +2 -2
  103. package/dist/client/assets/{connect-liVdG7hL.js → connect-C2Pvay2K.js} +2 -2
  104. package/dist/client/assets/{connect-agent-CMmb-Zab.js → connect-agent-F9m6jdrN.js} +2 -2
  105. package/dist/client/assets/{cynefin-OW5HDTMX-B4foSkMN.js → cynefin-OW5HDTMX-Bdj9a2Tr.js} +1 -1
  106. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-Cq1u5nRd.js → cynefinDiagram-5FMLGOSQ-CI4Z0tY2.js} +2 -2
  107. package/dist/client/assets/{dagre-GXQ25YYZ-BnWkCI00.js → dagre-GXQ25YYZ-BiXNu3UE.js} +2 -2
  108. package/dist/client/assets/device-dy573Bzs.js +2 -0
  109. package/dist/client/assets/{diagram-S7CK7UJ4-Bk90dFWN.js → diagram-S7CK7UJ4-BoHm89r6.js} +2 -2
  110. package/dist/client/assets/{diagram-UQ7AKVKN-Dh52RrnP.js → diagram-UQ7AKVKN-C-2Ubrz8.js} +2 -2
  111. package/dist/client/assets/{diagram-VSXAHHWV-uV_w7lVo.js → diagram-VSXAHHWV-5CTD9pHp.js} +2 -2
  112. package/dist/client/assets/{diagram-VX7I27RA-DL1AuClH.js → diagram-VX7I27RA-BJfYpp_F.js} +2 -2
  113. package/dist/client/assets/{diagram-Z3DM3KII-B5dyOgFp.js → diagram-Z3DM3KII-z35dx_kK.js} +2 -2
  114. package/dist/client/assets/{dialog-x5a5g_fa.js → dialog-DmneyTGi.js} +2 -2
  115. package/dist/client/assets/{diffRendering-DHxotmCj.js → diffRendering-BiYYLTwl.js} +2 -2
  116. package/dist/client/assets/{discovery-list-Bn1UyUNL.js → discovery-list-ZGkddsst.js} +2 -2
  117. package/dist/client/assets/{dist-DtZBcVS4.js → dist-Bl7QV0pY.js} +3 -3
  118. package/dist/client/assets/{draft-input-CwXvLRjL.js → draft-input-DHZ1J7B_.js} +2 -2
  119. package/dist/client/assets/{duoViewer-zxcLfYBx.js → duoViewer-CPD9Wvk1.js} +2 -2
  120. package/dist/client/assets/{dynamic-6kg5nPKs.js → dynamic-DcfMLaU_.js} +2 -2
  121. package/dist/client/assets/{ebnfDiagram-PWID7BFC-1CxZtGTD.js → ebnfDiagram-PWID7BFC-C2Fa8ORo.js} +2 -2
  122. package/dist/client/assets/{embeddedScripts-DYX91Iqp.js → embeddedScripts-DFdnbLSr.js} +2 -2
  123. package/dist/client/assets/{empty-C-FrtXzi.js → empty-hFNkAHps.js} +2 -2
  124. package/dist/client/assets/entities-B2DNkHHQ.js +2 -0
  125. package/dist/client/assets/{environments-C3ohMa2W.js → environments-Bqz0Jaj_.js} +2 -2
  126. package/dist/client/assets/{erDiagram-RLTQ6QDP-CsGV-1_T.js → erDiagram-RLTQ6QDP-WIlBdlNc.js} +2 -2
  127. package/dist/client/assets/eventmodeling-NTZA5JFV-Q6rJ-HVs.js +1 -0
  128. package/dist/client/assets/{fileLinks-Dm5o4ow4.js → fileLinks-Y7rrQ-ob.js} +2 -2
  129. package/dist/client/assets/{fileTreeExpansion-C8bS7Zih.js → fileTreeExpansion-CktIYdPM.js} +2 -2
  130. package/dist/client/assets/flowDiagram-HODETNUW-Dyon23dU.js +1 -0
  131. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-DPJOvh4Y.js → ganttDiagram-EL5Y4UJY-CzIDxrzr.js} +2 -2
  132. package/dist/client/assets/{getDiffFileInput-Dl5o7z9L.js → getDiffFileInput-DaXZ00WD.js} +2 -2
  133. package/dist/client/assets/{gitGraph-4MIJSDKK-BZfRHVrB.js → gitGraph-4MIJSDKK-VJZ5WW8j.js} +1 -1
  134. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-DAAU0j3h.js → gitGraphDiagram-WWUBYQGX--N7ACKgH.js} +2 -2
  135. package/dist/client/assets/{guideRunStore-CEASlKCi.js → guideRunStore-C8Xso-YV.js} +2 -2
  136. package/dist/client/assets/{htmlRender-Egw4Y-80.js → htmlRender-BxVc1PlI.js} +2 -2
  137. package/dist/client/assets/{index-B_GLtP0M.js → index-9_IX9wXh.js} +3 -3
  138. package/dist/client/assets/{info-A6RAGUB7-ycVybacD.js → info-A6RAGUB7-BsLL2HTs.js} +1 -1
  139. package/dist/client/assets/{infoDiagram-27XIBGKW-oqlTnqq9.js → infoDiagram-27XIBGKW-H0RWUQa6.js} +2 -2
  140. package/dist/client/assets/{input-DhWmPSxf.js → input-RqvQJ9gh.js} +2 -2
  141. package/dist/client/assets/{input-group-D4qHaxH8.js → input-group-BFtrsedw.js} +2 -2
  142. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-BUi7N4un.js → ishikawaDiagram-5VMMS53U-BoBtpQFP.js} +2 -2
  143. package/dist/client/assets/{journeyDiagram-3NMN7TZE-B2J9IlBm.js → journeyDiagram-3NMN7TZE-rcwS0plS.js} +2 -2
  144. package/dist/client/assets/{kanban-definition-UXKFOSKX-49qHmkgE.js → kanban-definition-UXKFOSKX-CMC0FYSq.js} +2 -2
  145. package/dist/client/assets/{kbd-I5TavBvc.js → kbd-BnsXAHsc.js} +2 -2
  146. package/dist/client/assets/{keybindings-B3kvDAJC.js → keybindings-BtHOXkP-.js} +2 -2
  147. package/dist/client/assets/{lazyRouteComponent-ZmKiS4iU.js → lazyRouteComponent-T0YE6Rn9.js} +2 -2
  148. package/dist/client/assets/{line-C5HQ6j78.js → line-CbOfbAku.js} +2 -2
  149. package/dist/client/assets/{link-DQB3a7WC.js → link-gKYnbTYT.js} +2 -2
  150. package/dist/client/assets/{linkedPrompt-FeVRd-O-.js → linkedPrompt-Bw0INRKj.js} +2 -2
  151. package/dist/client/assets/main-C6Kmott7.js +30 -0
  152. package/dist/client/assets/{main-CuoFsMGE.css → main-CoSpTpWL.css} +1 -1
  153. package/dist/client/assets/{mediaReference-ltmoE8jM.js → mediaReference-CRKV_ScS.js} +2 -2
  154. package/dist/client/assets/{mediaSource-CMMCxBE2.js → mediaSource-Hn2lPB2b.js} +2 -2
  155. package/dist/client/assets/{mermaid-parser.core-CrL8urD6.js → mermaid-parser.core-BGJPFG4o.js} +4 -4
  156. package/dist/client/assets/{mermaid.core-P-NUuG-D.js → mermaid.core-Bt6Qv84k.js} +5 -5
  157. package/dist/client/assets/{mindmap-definition-YA3MSWOX-CIwOTWEt.js → mindmap-definition-YA3MSWOX-4Y8RevXP.js} +2 -2
  158. package/dist/client/assets/number-field-DIYUxout.js +2 -0
  159. package/dist/client/assets/{observeResize-Cpph8C0G.js → observeResize-D9ECzP-D.js} +2 -2
  160. package/dist/client/assets/{onboarding-BU1V8wHr.js → onboarding-BnJjKcjq.js} +2 -2
  161. package/dist/client/assets/{openFileInPreview-DHDgTtRZ.js → openFileInPreview-BupyBOTN.js} +2 -2
  162. package/dist/client/assets/{p4ProjectFile-D9Mx0dmO.js → p4ProjectFile-CUk0B5Zd.js} +2 -2
  163. package/dist/client/assets/{packet-AYTQ26CC-Dx1MWiCF.js → packet-AYTQ26CC-CRQRHja4.js} +1 -1
  164. package/dist/client/assets/{pair-Cu7mXLMq.js → pair-ohR-X0pV.js} +2 -2
  165. package/dist/client/assets/{pegDiagram-XKGWAZYB-6LaNggoU.js → pegDiagram-XKGWAZYB-Dk0K8AzU.js} +2 -2
  166. package/dist/client/assets/{phoneViewer-DxbJZZ1_.js → phoneViewer-DD_58CZV.js} +2 -2
  167. package/dist/client/assets/{pie-WAS4IAKB-BHElrMQ0.js → pie-WAS4IAKB-CWKurrWM.js} +1 -1
  168. package/dist/client/assets/{pieDiagram-E7YTZNPT-BZ-KGbt4.js → pieDiagram-E7YTZNPT-DlRA_ADi.js} +2 -2
  169. package/dist/client/assets/{pierre-icons-BoPbdUrw.js → pierre-icons-Bj2UJzq7.js} +2 -2
  170. package/dist/client/assets/{popover-Bc0WvoPP.js → popover-DE9WCm99.js} +2 -2
  171. package/dist/client/assets/{preview-IWIgXHdy.js → preview-Cl-7ojv-.js} +2 -2
  172. package/dist/client/assets/{preview-Bdfy10VL.js → preview-Czvs-xjq.js} +2 -2
  173. package/dist/client/assets/{previewMiniPlayerStore-CTOOyQLc.js → previewMiniPlayerStore-Bz1T9oVV.js} +2 -2
  174. package/dist/client/assets/primary-C0h34HcZ.js +2 -0
  175. package/dist/client/assets/primaryCloudLinkState-EkUmcneJ.js +2 -0
  176. package/dist/client/assets/projectFilesQueryState-DDX2gPG6.js +2 -0
  177. package/dist/client/assets/projectScriptEditor-B-W-Sbdv.js +2 -0
  178. package/dist/client/assets/{providerSkills-CKg8n_Pc.js → providerSkills-OoPsDyac.js} +2 -2
  179. package/dist/client/assets/{pullRequestDetail.logic-rvhEbiFP.js → pullRequestDetail.logic-BZIPv0wR.js} +4 -4
  180. package/dist/client/assets/{pullRequestIcons-BaQbmCBu.js → pullRequestIcons-D5Yo5Zsn.js} +2 -2
  181. package/dist/client/assets/{pullRequestReviewStore-wpVYihKr.js → pullRequestReviewStore-DaEzt1m1.js} +2 -2
  182. package/dist/client/assets/{pullRequests-DJrYzynz.js → pullRequests-BuF4aTBF.js} +2 -2
  183. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-CvnGxXew.js → quadrantDiagram-AXDQQJYC-Cgrn1gJf.js} +2 -2
  184. package/dist/client/assets/queries-B5qQohie.js +2 -0
  185. package/dist/client/assets/query-Bd5_Y_Vy.js +2 -0
  186. package/dist/client/assets/{radar-RG4KPBEZ-BrffrDRx.js → radar-RG4KPBEZ-BNds8J7E.js} +1 -1
  187. package/dist/client/assets/radio-group-CBunNtTU.js +2 -0
  188. package/dist/client/assets/{railroad-74A4TZTK-B3VSFrGQ.js → railroad-74A4TZTK-c-ku32yb.js} +1 -1
  189. package/dist/client/assets/railroad-abnf-HS5TGJTU-DdK1L4Kf.js +1 -0
  190. package/dist/client/assets/railroad-ebnf-LZEXJU2U-DAIwdsWb.js +1 -0
  191. package/dist/client/assets/railroad-peg-WCYAUIDC-B6SwzZWt.js +1 -0
  192. package/dist/client/assets/{railroadDiagram-O6MQD6OU-BbIi-aIS.js → railroadDiagram-O6MQD6OU-CQ0Qmd0t.js} +2 -2
  193. package/dist/client/assets/{renderScheduler-B_XMfDdk.js → renderScheduler-CFozWmL-.js} +2 -2
  194. package/dist/client/assets/{requirementDiagram-BXWQKSXE-BcjJ0oP9.js → requirementDiagram-BXWQKSXE-ssGfFSCi.js} +2 -2
  195. package/dist/client/assets/{rightPanelStore-37-59X44.js → rightPanelStore-6-YhsfkE.js} +2 -2
  196. package/dist/client/assets/runtime-C2Cbg6bw.js +2 -0
  197. package/dist/client/assets/runtime-C9FXEGBC.js +6 -0
  198. package/dist/client/assets/{runtimeModeConfig-DF8wod3s.js → runtimeModeConfig-C3q8YqVA.js} +2 -2
  199. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-DmFJ2EWh.js → sankeyDiagram-P5KCCOFB-CTZUXdFj.js} +2 -2
  200. package/dist/client/assets/{scheduledTasksSettings.logic-BYBxTiFF.js → scheduledTasksSettings.logic-Cucrqmxt.js} +3 -3
  201. package/dist/client/assets/{scroll-area-BDT5qfX2.js → scroll-area-Davaj52_.js} +2 -2
  202. package/dist/client/assets/{select-BQxcmO_1.js → select-B47XfaxQ.js} +2 -2
  203. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-D8YdQDYA.js → sequenceDiagram-WJ2MYXX4-B8uW-gHN.js} +2 -2
  204. package/dist/client/assets/server-B3nCKBrK.js +2 -0
  205. package/dist/client/assets/{session-CLz6NCKX.js → session-DtKtS09P.js} +2 -2
  206. package/dist/client/assets/{session-logic-CD6ctino.js → session-logic-P3KsudEl.js} +4 -4
  207. package/dist/client/assets/{settings-Swwhfgp0.js → settings-BNJbLRpG.js} +2 -2
  208. package/dist/client/assets/settings.appearance-DKLKCSXj.js +2 -0
  209. package/dist/client/assets/settings.archived-BeEB6d0D.js +2 -0
  210. package/dist/client/assets/{settings.computer-use-nLbSQfdv.js → settings.computer-use-BcdKzzUy.js} +2 -2
  211. package/dist/client/assets/settings.connections-Cjmfz_7g.js +2 -0
  212. package/dist/client/assets/{settings.data-controls-BZsALFNW.js → settings.data-controls-CZHmsfBq.js} +2 -2
  213. package/dist/client/assets/{settings.decisions-ewNyURd9.js → settings.decisions-C3WA_g2Z.js} +2 -2
  214. package/dist/client/assets/settings.diagnostics-Bfh6T3JX.js +2 -0
  215. package/dist/client/assets/settings.general-HB-_Jy6d.js +2 -0
  216. package/dist/client/assets/{settings.integrations-Cra2dW7z.js → settings.integrations-C-uLxrlE.js} +2 -2
  217. package/dist/client/assets/{settings.keybindings-TlPhoEQg.js → settings.keybindings-BGq7j4EC.js} +2 -2
  218. package/dist/client/assets/{settings.open-source-licenses-B-yrCrWG.js → settings.open-source-licenses-VexlqZXJ.js} +2 -2
  219. package/dist/client/assets/settings.plugins-P_jMyYCz.js +5 -0
  220. package/dist/client/assets/settings.projects-Bl6-Pt9m.js +4 -0
  221. package/dist/client/assets/settings.providers-Dk00EIn3.js +3 -0
  222. package/dist/client/assets/settings.scheduled-tasks-IH5fvnPs.js +2 -0
  223. package/dist/client/assets/{settings.snap-shot-DjahqLFc.js → settings.snap-shot-CaOvSkk3.js} +2 -2
  224. package/dist/client/assets/{settings.source-control-2ejyJuaq.js → settings.source-control-hwzkeaj5.js} +2 -2
  225. package/dist/client/assets/{settings.storage-CWhyfrpB.js → settings.storage-YtslAsAl.js} +2 -2
  226. package/dist/client/assets/{settingsLayout-D-5E1K-3.js → settingsLayout-Oe2gP0HD.js} +3 -3
  227. package/dist/client/assets/{sidebar-D5nBG54l.js → sidebar-BkujXU9U.js} +2 -2
  228. package/dist/client/assets/{sidebarProjectGrouping-D1iMa8Uh.js → sidebarProjectGrouping-zfg6kMP5.js} +2 -2
  229. package/dist/client/assets/{skeleton-oZHFXSZp.js → skeleton-C6_D5JUu.js} +2 -2
  230. package/dist/client/assets/{sortable.esm-By3lSBxO.js → sortable.esm-CFdu6ubt.js} +2 -2
  231. package/dist/client/assets/{sourceControl-mPa5Da0-.js → sourceControl-CNpb3juM.js} +2 -2
  232. package/dist/client/assets/{spinner-Bnjv_L8F.js → spinner-CpLstN6u.js} +2 -2
  233. package/dist/client/assets/{standalone-page-Davc_MrS.js → standalone-page-7vaVYOp-.js} +2 -2
  234. package/dist/client/assets/{stateDiagram-D77RDMKH-DoURp1ek.js → stateDiagram-D77RDMKH-BXjvJECk.js} +2 -2
  235. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DoChugDq.js +2 -0
  236. package/dist/client/assets/{swimlanes-42K2YHIH-CnIKMVp7.js → swimlanes-42K2YHIH-BuQKiVFK.js} +2 -2
  237. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Bwk0C9Yw.js +9 -0
  238. package/dist/client/assets/{terminal-links-BT70vIBN.js → terminal-links-CjmSI9gV.js} +2 -2
  239. package/dist/client/assets/{terminalSessions-5_U2zswb.js → terminalSessions-C0i8FMIw.js} +2 -2
  240. package/dist/client/assets/{textarea-B8WPFAr0.js → textarea-DKdxwZZC.js} +2 -2
  241. package/dist/client/assets/{themePalette-CdoksNDx.js → themePalette-7p_LOU3J.js} +3 -3
  242. package/dist/client/assets/{threadSort-CGw2yc3P.js → threadSort-urWEkJav.js} +2 -2
  243. package/dist/client/assets/{timeline-definition-24CTP7MA-Bb4-XE1H.js → timeline-definition-24CTP7MA-gsy_kdrp.js} +2 -2
  244. package/dist/client/assets/toast-D1xgN6T2.js +2 -0
  245. package/dist/client/assets/{toggle-DLuCM2ny.js → toggle-BshAsXT6.js} +2 -2
  246. package/dist/client/assets/{toggle-group-RZD18_sD.js → toggle-group-ZNzhUvHt.js} +2 -2
  247. package/dist/client/assets/tooltip-Cq9yz15d.js +2 -0
  248. package/dist/client/assets/{treeView-Q6P3EWNA-m0IX4uRr.js → treeView-Q6P3EWNA-BHvMPOqK.js} +1 -1
  249. package/dist/client/assets/{treemap-WGGIJYW6-DjF5oRc6.js → treemap-WGGIJYW6-D8SWHA1Z.js} +1 -1
  250. package/dist/client/assets/usage-BsNTrKRO.js +2 -0
  251. package/dist/client/assets/{usageAccess-CGcVLBtI.js → usageAccess-CieOJbVm.js} +2 -2
  252. package/dist/client/assets/{usageFormat-B-HlJYM5.js → usageFormat-BEGhDYfU.js} +2 -2
  253. package/dist/client/assets/{usageShortcuts-CUsmDt-0.js → usageShortcuts-DxuByyhD.js} +2 -2
  254. package/dist/client/assets/{use-atom-command-BEC7Dpf5.js → use-atom-command-DFVJioxM.js} +2 -2
  255. package/dist/client/assets/{useAriaLabelledBy-DZIzyiAY.js → useAriaLabelledBy-u5efXUxw.js} +2 -2
  256. package/dist/client/assets/{useHandleNewThread-B6GE4-lt.js → useHandleNewThread-D3kzOunA.js} +2 -2
  257. package/dist/client/assets/{useLocation-UcmQE5FC.js → useLocation-B3ir4ben.js} +2 -2
  258. package/dist/client/assets/useNavigate-DRqH9NhA.js +2 -0
  259. package/dist/client/assets/{useNavigateBack-B0y76gBs.js → useNavigateBack-XQd0WINI.js} +2 -2
  260. package/dist/client/assets/{useParams-DdYFF9g9.js → useParams-Cil-ZIwd.js} +2 -2
  261. package/dist/client/assets/{usePermissionStatus-C01enB4u.js → usePermissionStatus-C4aMrLLP.js} +2 -2
  262. package/dist/client/assets/{usePullRequestActions-C9Nx99x7.js → usePullRequestActions-eR9_K37m.js} +3 -3
  263. package/dist/client/assets/{useRegisterFieldControl-Bmw-33lq.js → useRegisterFieldControl-75QESVfk.js} +2 -2
  264. package/dist/client/assets/{useScopedModelAvailability-Bx5MEwNY.js → useScopedModelAvailability-DloNarQ1.js} +2 -2
  265. package/dist/client/assets/useSettings-BVUg52H2.js +3 -0
  266. package/dist/client/assets/{useT3ConnectAuthPrompt-B9-kgi3N.js → useT3ConnectAuthPrompt-iHfw63uu.js} +2 -2
  267. package/dist/client/assets/utils-BEVyjoxo.js +37 -0
  268. package/dist/client/assets/vcsRefInvalidation-DZeFb_fD.js +2 -0
  269. package/dist/client/assets/{vennDiagram-4TSXK5OY-CCjFehou.js → vennDiagram-4TSXK5OY-DWeHYWRx.js} +2 -2
  270. package/dist/client/assets/{wardley-WFR3VGLG-C8OgmKG3.js → wardley-WFR3VGLG-CfPV8k7N.js} +1 -1
  271. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-aAotQeyV.js → wardleyDiagram-VM6X3IG4-D0SH6I3q.js} +2 -2
  272. package/dist/client/assets/{welcome-DgOu9i5m.js → welcome-BWkyKuVQ.js} +2 -2
  273. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-B6Gl2NIG.js → xychartDiagram-S5SC5T6Z-CHYweeaE.js} +2 -2
  274. package/dist/client/index.html +1 -1
  275. package/dist/{renderer-C4obs87z.mjs → renderer-BFtino0A.mjs} +2 -2
  276. package/dist/{runtime-2Dbe0RYi.mjs → runtime-ERvpj9Mz.mjs} +80 -6
  277. package/package.json +1 -1
  278. package/dist/client/assets/AlertDialogRoot-Bb5-VhZe.js +0 -2
  279. package/dist/client/assets/ChatMarkdown-6z7RF4Ki.js +0 -65
  280. package/dist/client/assets/CheckboxIndicator-BzFOZwIv.js +0 -2
  281. package/dist/client/assets/CodexSetupSection.logic-CesZU0jj.js +0 -2
  282. package/dist/client/assets/ComboboxClear-Di7TLMMS.js +0 -2
  283. package/dist/client/assets/DiffPanel-FegTwEoZ.js +0 -2
  284. package/dist/client/assets/Input-DoZ73vNO.js +0 -2
  285. package/dist/client/assets/PanelLayoutControls-CNS9IpqP.js +0 -216
  286. package/dist/client/assets/PopoverHandle-D2swQJBt.js +0 -2
  287. package/dist/client/assets/PreviewPanel-CJ81wdo6.js +0 -2
  288. package/dist/client/assets/ProjectDefaultsSettings-CXY57B72.js +0 -2
  289. package/dist/client/assets/PullRequestCodeTab-ClHfRIZg.js +0 -6
  290. package/dist/client/assets/SelectScrollUpArrow-CAd5YEsi.js +0 -2
  291. package/dist/client/assets/ThreadTerminalDrawer-g8xlxRvR.js +0 -5
  292. package/dist/client/assets/TooltipViewport-Wc_QpRGI.js +0 -2
  293. package/dist/client/assets/_chat-BCpoMsA8.js +0 -45
  294. package/dist/client/assets/_chat.pull-requests-Dl8vaGsi.js +0 -2
  295. package/dist/client/assets/architecture-7GRP2DOG-Dr1CsNUa.js +0 -1
  296. package/dist/client/assets/assets-Bv4X710m.js +0 -2
  297. package/dist/client/assets/channel-DSsQ3W5t.js +0 -2
  298. package/dist/client/assets/classDiagram-ZZMXUADV-BBQf0-yA.js +0 -2
  299. package/dist/client/assets/classDiagram-v2-VYDZK3BY-BBQf0-yA.js +0 -2
  300. package/dist/client/assets/device-DLB3WAXi.js +0 -2
  301. package/dist/client/assets/entities-ed9IspYf.js +0 -2
  302. package/dist/client/assets/eventmodeling-NTZA5JFV-Ji6bAwP8.js +0 -1
  303. package/dist/client/assets/flowDiagram-HODETNUW-AAO2RT67.js +0 -1
  304. package/dist/client/assets/main-DUXMPAgZ.js +0 -30
  305. package/dist/client/assets/number-field-N4gbrhyd.js +0 -2
  306. package/dist/client/assets/primary-Ce2kT30K.js +0 -2
  307. package/dist/client/assets/primaryCloudLinkState-Do0JJRXu.js +0 -2
  308. package/dist/client/assets/projectFilesQueryState-CRMf46rk.js +0 -2
  309. package/dist/client/assets/projectScriptEditor-BCJfjG7L.js +0 -2
  310. package/dist/client/assets/queries-p9BAZLb-.js +0 -2
  311. package/dist/client/assets/query-CpOQgkic.js +0 -2
  312. package/dist/client/assets/radio-group-CfHe3q1m.js +0 -2
  313. package/dist/client/assets/railroad-abnf-HS5TGJTU-BS7JDegU.js +0 -1
  314. package/dist/client/assets/railroad-ebnf-LZEXJU2U-PJ7TdaXJ.js +0 -1
  315. package/dist/client/assets/railroad-peg-WCYAUIDC-BnDwBnfu.js +0 -1
  316. package/dist/client/assets/runtime-AivVP3k8.js +0 -6
  317. package/dist/client/assets/runtime-BfjHqyQH.js +0 -2
  318. package/dist/client/assets/server-BC4-DXjw.js +0 -2
  319. package/dist/client/assets/settings.appearance-BSzr_T9U.js +0 -2
  320. package/dist/client/assets/settings.archived-BoCdDvJy.js +0 -2
  321. package/dist/client/assets/settings.connections-C4NVZA2N.js +0 -2
  322. package/dist/client/assets/settings.diagnostics-DD8ubhwU.js +0 -2
  323. package/dist/client/assets/settings.general-CtzJh4Rx.js +0 -2
  324. package/dist/client/assets/settings.plugins-imKgCVn_.js +0 -5
  325. package/dist/client/assets/settings.projects-tzSgXlw4.js +0 -4
  326. package/dist/client/assets/settings.providers-CJMKBwGi.js +0 -3
  327. package/dist/client/assets/settings.scheduled-tasks-CsxzXKIe.js +0 -2
  328. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-D7St643I.js +0 -2
  329. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-D5SXc1iu.js +0 -9
  330. package/dist/client/assets/toast-BYGWNQVa.js +0 -2
  331. package/dist/client/assets/tooltip-924Ikq0L.js +0 -2
  332. package/dist/client/assets/usage-DozNd-7N.js +0 -2
  333. package/dist/client/assets/useNavigate-Dvl9uiuL.js +0 -2
  334. package/dist/client/assets/useSettings-CbuRZg7F.js +0 -3
  335. package/dist/client/assets/utils-CRwA5SKO.js +0 -37
  336. package/dist/client/assets/vcsRefInvalidation-Dkz0bLCm.js +0 -2
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Ai as n,Ba as r,Bi as i,Br as a,Ca as o,Cr as s,Di as c,Eo as l,Er as u,Fa as d,Ia as f,Ja as p,Li as m,Mi as h,Na as g,Ni as _,Oi as v,Or as y,Pi as b,Pr as x,Qi as S,Qr as C,So as w,Ta as T,Ti as E,Tr as D,Zr as O,_a as k,_i as A,_o as j,cE as M,ci as N,co as P,di as F,fi as I,ga as L,gi as R,hi as z,ho as B,ji as V,jr as ee,ki as H,kr as U,li as W,mi as G,mo as K,ni as q,oi as te,pa as ne,pi as re,po as ie,pr as ae,si as oe,ti as se,ui as J,va as ce,vi as le,vo as Y,xr as ue,yo as de,yr as fe}from"./utils-CRwA5SKO.js";import{u as pe}from"./TooltipViewport-Wc_QpRGI.js";var X=e(t()),me=X.createContext(void 0);function Z(e){let t=X.useContext(me);if(t===void 0&&!e)throw Error(l(47));return t}var he=e(ce());function ge(){return{...te(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var _e={...N,disabled:E(e=>e.disabled),instantType:E(e=>e.instantType),openMethod:E(e=>e.openMethod),openChangeReason:E(e=>e.openChangeReason),modal:E(e=>e.modal),focusManagerModal:E(e=>e.focusManagerModal),stickIfOpen:E(e=>e.stickIfOpen),titleElementId:E(e=>e.titleElementId),descriptionElementId:E(e=>e.descriptionElementId),openOnHover:E(e=>e.openOnHover),closeDelay:E(e=>e.closeDelay),hasViewport:E(e=>e.hasViewport)},ve=class e extends le{constructor(e,t,n=!1){let r={...ge(),...e},i=new W;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=oe(i,t,n),super(r,{popupRef:X.createRef(),backdropRef:X.createRef(),internalBackdropRef:X.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:X.createRef(),beforeContentFocusGuardRef:X.createRef(),stickIfOpenTimeout:new ne,triggerElements:i},_e)}setOpen=(e,t)=>{let n=t.reason===P,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)};let a=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&a!=null&&(t.trigger=this.context.triggerElements.getById(a)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let n={open:e,openChangeReason:t.reason};F(n,e,t.trigger),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),he.flushSync(o)):o(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let{store:r,internalStore:i}=R(t,(t,r)=>new e(n,t,r));return X.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()},Q=e(M());function ye({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:s=!1,handle:c,triggerId:l,defaultTriggerId:u=null}=e,d=ve.useStore(c?.store,{modal:s,open:r,openProp:n,activeTriggerId:u,triggerIdProp:l});ue(()=>{n===void 0&&d.state.open===!1&&r===!0&&d.update({open:!0,activeTriggerId:u})}),d.useControlledProp(`openProp`,n),d.useControlledProp(`triggerIdProp`,l);let f=d.useState(`open`),m=d.useState(`mounted`),h=d.useState(`payload`),g=_()!=null;d.useContextCallback(`onOpenChange`,i),d.useContextCallback(`onOpenChangeComplete`,a),z(d,f),I(d);let{forceUnmount:v}=re(f,d,()=>{d.update({stickIfOpen:!0,openChangeReason:null})});d.useSyncedValues({modal:s,nested:g}),X.useEffect(()=>{f||d.context.stickIfOpenTimeout.clear()},[d,f]);let y=X.useCallback(()=>{d.setOpen(!1,o(p))},[d]);X.useImperativeHandle(e.actionsRef,()=>({unmount:v,close:y}),[v,y]);let b=f||m,x=X.useMemo(()=>({store:d}),[d]);return(0,Q.jsxs)(me.Provider,{value:x,children:[b&&(0,Q.jsx)(xe,{store:d,modal:s}),typeof t==`function`?t({payload:h}):t]})}function be(e){return Z(!0)?(0,Q.jsx)(ye,{props:e}):(0,Q.jsx)(V,{children:(0,Q.jsx)(ye,{props:e})})}function xe({store:e,modal:t}){let n=e.useState(`floatingRootContext`),r=c(n,{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),i=r.reference??w,a=r.trigger??w,o=X.useMemo(()=>de(J,r.floating),[r.floating]);return G(e,{activeTriggerProps:i,inactiveTriggerProps:a,popupProps:o}),null}var Se=X.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:u=!1,delay:d=300,closeDelay:f=0,id:p,...h}=e,_=Z(!0),y=s?.store??_?.store;if(!y)throw Error(l(74));let b=T(p),x=y.useState(`isTriggerActive`,b),w=y.useState(`floatingRootContext`),E=y.useState(`isOpenedByTrigger`,b),D=y.useState(`triggerPopupId`,b),O=X.useRef(null),{registerTrigger:k,isMountedByThisTrigger:j}=A(b,O,y,{payload:c,disabled:a,openOnHover:u,closeDelay:f}),M=y.useState(`openChangeReason`),N=y.useState(`stickIfOpen`),P=y.useState(`openMethod`),F=y.useState(`focusManagerModal`),I=se(w,{enabled:w!=null&&u&&(P!==`touch`||M!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:C(),restMs:d,delay:{close:f},triggerElementRef:O,isActiveTrigger:x,isClosing:()=>y.select(`transitionStatus`)===`ending`}),L=v(w,{enabled:w!=null,stickIfOpen:N}),R=fe(()=>y.select(`open`),e=>{y.set(`openMethod`,e)}),z=y.useState(`triggerProps`,j),{getButtonProps:V,buttonRef:ee}=g({disabled:a,native:o}),H={open(e){return e&&M===`trigger-press`?K.open(e):B.open(e)}},{preFocusGuardRef:U,handlePreFocusGuardFocus:W,handleFocusTargetFocus:G}=ae(y,O),q=Y(`button`,e,{state:{disabled:a,open:E},ref:[ee,t,k,O],props:[L.reference,I,z,R,{[m]:``,id:b,"aria-haspopup":`dialog`,"aria-expanded":E,"aria-controls":D},h,V],stateAttributesMapping:H});return j&&!F?(0,Q.jsxs)(X.Fragment,{children:[(0,Q.jsx)(S,{ref:U,onFocus:W}),(0,Q.jsx)(X.Fragment,{children:q},b),(0,Q.jsx)(S,{ref:y.context.triggerFocusTargetRef,onFocus:G})]}):(0,Q.jsx)(X.Fragment,{children:q},b)}),Ce=X.createContext(void 0);function we(){let e=X.useContext(Ce);if(e===void 0)throw Error(l(45));return e}var Te=X.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Z();return i.useState(`mounted`)||n?(0,Q.jsx)(Ce.Provider,{value:n,children:(0,Q.jsx)(b,{ref:t,...r})}):null}),Ee=X.createContext(void 0);function De(){let e=X.useContext(Ee);if(!e)throw Error(l(46));return e}var Oe=X.forwardRef(function(e,t){let{render:r,className:a,style:o,anchor:c,positionMethod:l=`absolute`,side:f=`bottom`,align:p=`center`,sideOffset:m=0,alignOffset:g=0,collisionBoundary:_=`clipping-ancestors`,collisionPadding:v=5,arrowPadding:b=5,sticky:x=!1,disableAnchorTracking:S=!1,collisionAvoidance:C=i,...w}=e,{store:T}=Z(),E=we(),O=h(),A=T.useState(`floatingRootContext`),j=T.useState(`mounted`),M=T.useState(`open`),N=T.useState(`openChangeReason`),P=T.useState(`activeTriggerElement`),F=T.useState(`modal`),I=T.useState(`openMethod`),L=T.useState(`positionerElement`),R=T.useState(`instantType`),z=T.useState(`transitionStatus`),B=T.useState(`hasViewport`),V=X.useRef(null),H=k(L,!1,!1),W=y({anchor:c,floatingRootContext:A,positionMethod:l,mounted:j,side:f,sideOffset:m,align:p,alignOffset:g,arrowPadding:b,collisionBoundary:_,collisionPadding:v,sticky:x,disableAnchorTracking:S,keepMounted:E,nodeId:O,collisionAvoidance:C,adaptiveOrigin:B?U:void 0}),G=A.useState(`domReferenceElement`);d(()=>{let e=G,t=V.current;if(e&&(V.current=e),t&&e&&e!==t){T.set(`instantType`,void 0);let e=new AbortController;return H(()=>{T.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[G,H,T]),s(M&&F===!0&&N!==`trigger-hover`,I===`touch`,L,P);let K=X.useCallback(e=>{T.set(`positionerElement`,e)},[T]),q={open:M,side:W.side,align:W.align,anchorHidden:W.anchorHidden,instant:R},te=D(e,q,{styles:W.positionerStyles,transitionStatus:z,props:w,refs:[t,K],hidden:!j,inert:!M});return(0,Q.jsxs)(Ee.Provider,{value:W,children:[j&&F===!0&&N!==`trigger-hover`&&(0,Q.jsx)(u,{ref:T.context.internalBackdropRef,inert:ee(!M),cutout:P}),(0,Q.jsx)(n,{id:O,children:te})]})}),$=X.createContext(void 0);function ke(){let[e,t]=X.useState(0),n=f(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:X.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function Ae(e){let{value:t,children:n}=e;return(0,Q.jsx)($.Provider,{value:t,children:n})}function je(){let e=X.useContext($);d(()=>e?.register(),[e])}var Me={...ie,...j},Ne=X.forwardRef(function(e,t){let{render:n,className:i,style:o,initialFocus:s,finalFocus:c,...l}=e,{store:u}=Z(),d=De(),f=O(!0)!=null,{context:p,hasClosePart:m}=ke(),h=u.useState(`open`),g=u.useState(`openMethod`),_=u.useState(`instantType`),v=u.useState(`transitionStatus`),y=u.useState(`popupProps`),b=u.useState(`titleElementId`),S=u.useState(`descriptionElementId`),C=u.useState(`modal`),w=u.useState(`mounted`),T=u.useState(`openChangeReason`),E=u.useState(`activeTriggerElement`),D=u.useState(`floatingRootContext`),k=D.useState(`floatingId`),A=u.useState(`disabled`),j=u.useState(`openOnHover`),M=u.useState(`closeDelay`),N=l.id??k;L({open:h,ref:u.context.popupRef,onComplete(){h&&u.context.onOpenChangeComplete?.(!0)}}),q(D,{enabled:j&&!A,closeDelay:M});function P(e){return e!==`touch`||u.context.popupRef.current}let F=s===void 0?P:s,I=C!==!1&&m;u.useSyncedValue(`focusManagerModal`,I);let R=X.useCallback(e=>{u.set(`popupElement`,e)},[u]),z={open:h,side:d.side,align:d.align,instant:_,transitionStatus:v},B=Y(`div`,e,{state:z,ref:[t,u.context.popupRef,R],props:[y,{id:N,role:`dialog`,...J,"aria-labelledby":b,"aria-describedby":S,onKeyDown(e){f&&a.has(e.key)&&e.stopPropagation()}},x(v),l],stateAttributesMapping:Me});return(0,Q.jsx)(H,{context:D,openInteractionType:g,modal:I,disabled:!w||T===`trigger-hover`,initialFocus:F,returnFocus:c,restoreFocus:`popup`,previousFocusableElement:r(E)?E:void 0,nextFocusableElement:u.context.triggerFocusTargetRef,beforeContentFocusGuardRef:u.context.beforeContentFocusGuardRef,children:(0,Q.jsx)(Ae,{value:p,children:B})})}),Pe=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),Fe={activationDirection:e=>e?{"data-activation-direction":e}:null},Ie=X.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{store:s}=Z(),{side:c}=De(),l=s.useState(`instantType`),{children:u,state:d}=pe({store:s,side:c,cssVars:Pe,children:a}),f={activationDirection:d.activationDirection,transitioning:d.transitioning,instant:l};return Y(`div`,e,{state:f,ref:t,props:[o,{children:u}],stateAttributesMapping:Fe})}),Le=class{constructor(){this.store=new ve}open(e){let t=e?this.store.context.triggerElements.getById(e)??void 0:void 0;if(e&&!t)throw Error(l(80,e));this.store.setOpen(!0,o(p,void 0,t))}close(){this.store.setOpen(!1,o(p,void 0,void 0))}get isOpen(){return this.store.select(`open`)}};function Re(){return new Le}export{Oe as a,be as c,je as i,Z as l,Ie as n,Te as o,Ne as r,Se as s,Re as t};
2
- //# sourceMappingURL=PopoverHandle-D2swQJBt.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,Bo as r,Bp as i,D as a,Gn as o,Ho as s,Jn as c,Js as l,Kd as u,Ko as d,Ku as f,ME as p,Of as m,Op as h,Pp as g,Qn as _,Ro as v,Um as y,Up as b,Wn as x,Yn as S,Zn as C,ar as w,cE as T,cg as E,dp as D,fd as O,ir as k,mg as A,or as j,pp as M,qn as ee,qu as N,rr as te,sp as P,sr as F,t as ne,tr as re,v_ as I,wf as ie}from"./utils-CRwA5SKO.js";import{R as L,W as R}from"./runtime-AivVP3k8.js";import{b as ae}from"./entities-ed9IspYf.js";import{ct as oe}from"./ChatMarkdown-6z7RF4Ki.js";import{i as z}from"./toast-BYGWNQVa.js";import{a as se,n as ce,t as B}from"./tooltip-924Ikq0L.js";import{n as le,s as ue,t as de}from"./environments-C3ohMa2W.js";import{i as V,n as fe}from"./session-CLz6NCKX.js";import{t as H}from"./use-atom-command-BEC7Dpf5.js";import{l as U}from"./rightPanelStore-37-59X44.js";import{L as W}from"./useSettings-CbuRZg7F.js";import{n as G}from"./toastHelpers-Dsph6LwL.js";import{A as K,k as q}from"./PanelLayoutControls-CNS9IpqP.js";import{o as pe}from"./timestampFormat-wac2e_Jz.js";import{a as me,o as he,r as ge,t as _e}from"./empty-C-FrtXzi.js";import{a as ve,i as ye,t as be}from"./previewMiniPlayerStore-CTOOyQLc.js";import{n as xe,t as Se}from"./discovery-list-Bn1UyUNL.js";import{t as Ce}from"./observeResize-Cpph8C0G.js";import{n as we}from"./openFileInPreview-DHDgTtRZ.js";import{T as Te,a as Ee,b as De,f as Oe,i as ke,n as Ae,o as je,r as Me,t as Ne,u as Pe,w as Fe}from"./browserHistoryStore-VpfOHXQM.js";import{t as Ie}from"./preview-Bdfy10VL.js";import{n as Le,r as Re,t as ze}from"./preview-IWIgXHdy.js";import{n as Be,r as J,t as Y}from"./input-group-D4qHaxH8.js";import{Fa as Ve,Ji as He,Pa as Ue,Qi as We,Xi as Ge,Yi as Ke,Zi as qe,ca as Je,da as Ye,fa as X,ha as Xe,na as Ze,oa as Qe,qa as $e,ra as et,sa as tt,ta as nt}from"./main-DUXMPAgZ.js";import{a as rt,c as it,d as at,f as ot,i as st,l as ct,n as lt,o as ut,r as dt,s as ft,u as pt}from"./_chat-BCpoMsA8.js";var Z=e(t(),1),Q=p(),mt=`data:image/png;base64,`;function ht(e){if(!e.screenshot)return{status:`none`};try{let{dataUrl:t}=e.screenshot;if(!t.startsWith(mt))return{status:`failed`};let n=Xe(t,`preview-annotation-${e.id}.png`,`image/png`);return n.size>0?{status:`captured`,file:n}:{status:`failed`}}catch{return{status:`failed`}}}var $=e(T(),1),gt=()=>{};function _t(e){let t=(0,Q.c)(78),{url:n,loading:r,canGoBack:i,canGoForward:a,refreshDisabled:o,inputDisabled:s,focusUrlNonce:c,onBack:l,onForward:d,onRefresh:p,onSubmit:m,onOpenInBrowser:g,onCapture:_,captureDisabled:v,recording:y,onPictureInPicture:b,pictureInPicture:x,pictureInPictureDisabled:S,onPickElement:C,pickActive:w,pickDisabled:T,pickDisabledReason:E,trailingActions:D,leadingActions:k}=e,A=(0,Z.useRef)(null),[j,ee]=(0,Z.useState)(n),[te,P]=(0,Z.useState)(!1),re,I;t[0]===c?(re=t[1],I=t[2]):(re=()=>{if(c==null)return;let e=A.current;e&&e.focus()},I=[c],t[0]=c,t[1]=re,t[2]=I),(0,Z.useEffect)(re,I);let ie;t[3]!==j||t[4]!==m?(ie=e=>{e?.preventDefault();let t=j.trim();t.length!==0&&(m(t),A.current?.blur())},t[3]=j,t[4]=m,t[5]=ie):ie=t[5];let L=ie,R=i?l:gt,ae=!i,oe;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(f,{}),t[6]=oe):oe=t[6];let z;t[7]!==R||t[8]!==ae?(z=(0,$.jsx)(F,{variant:`ghost`,size:`icon-xs`,onClick:R,disabled:ae,"aria-label":`Back`,type:`button`,children:oe}),t[7]=R,t[8]=ae,t[9]=z):z=t[9];let le=a?d:gt,ue=!a,de;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(N,{}),t[10]=de):de=t[10];let V;t[11]!==le||t[12]!==ue?(V=(0,$.jsx)(F,{variant:`ghost`,size:`icon-xs`,onClick:le,disabled:ue,"aria-label":`Forward`,type:`button`,children:de}),t[11]=le,t[12]=ue,t[13]=V):V=t[13];let fe=o?gt:p,H=r?`Stop`:`Refresh`,U;t[14]!==o||t[15]!==fe||t[16]!==H?(U=(0,$.jsx)(F,{variant:`ghost`,size:`icon-xs`,onClick:fe,disabled:o,"aria-label":H,type:`button`}),t[14]=o,t[15]=fe,t[16]=H,t[17]=U):U=t[17];let W;t[18]===r?W=t[19]:(W=(0,$.jsx)($e,{refreshing:r}),t[18]=r,t[19]=W);let G;t[20]!==U||t[21]!==W?(G=(0,$.jsx)(se,{render:U,children:W}),t[20]=U,t[21]=W,t[22]=G):G=t[22];let K=r?`Loading…`:`Refresh`,q;t[23]===K?q=t[24]:(q=(0,$.jsx)(ce,{children:K}),t[23]=K,t[24]=q);let pe;t[25]!==G||t[26]!==q?(pe=(0,$.jsxs)(B,{children:[G,q]}),t[25]=G,t[26]=q,t[27]=pe):pe=t[27];let me;t[28]!==V||t[29]!==pe||t[30]!==z?(me=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`Navigation`,children:[z,V,pe]}),t[28]=V,t[29]=pe,t[30]=z,t[31]=me):me=t[31];let he=te?j:n,ge;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ge=e=>ee(e.target.value),t[32]=ge):ge=t[32];let _e;t[33]===n?_e=t[34]:(_e=()=>{ee(n),P(!0),queueMicrotask(()=>A.current?.select())},t[33]=n,t[34]=_e);let ve;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ve=()=>{P(!1)},t[35]=ve):ve=t[35];let ye;t[36]!==L||t[37]!==n?(ye=e=>{e.key===`Enter`&&L(e),e.key===`Escape`&&(e.preventDefault(),ee(n),A.current?.blur())},t[36]=L,t[37]=n,t[38]=ye):ye=t[38];let be;t[39]!==s||t[40]!==he||t[41]!==_e||t[42]!==ye?(be=(0,$.jsx)(B,{children:(0,$.jsx)(se,{render:(0,$.jsx)(J,{ref:A,value:he,onChange:ge,onFocus:_e,onBlur:ve,onKeyDown:ye,placeholder:`Search or enter URL`,spellCheck:!1,disabled:s,"data-preview-url-input":!0,size:`sm`})})}),t[39]=s,t[40]=he,t[41]=_e,t[42]=ye,t[43]=be):be=t[43];let xe;t[44]!==te||t[45]!==g?(xe=g&&!te?(0,$.jsx)(Be,{align:`inline-end`,children:(0,$.jsx)(`span`,{className:`pointer-events-none flex opacity-0 transition-opacity focus-within:pointer-events-auto focus-within:opacity-100 group-hover/address:pointer-events-auto group-hover/address:opacity-100`,children:(0,$.jsx)(F,{variant:`ghost`,size:`icon-xs`,onClick:g,"aria-label":`Open in system browser`,type:`button`,children:(0,$.jsx)(u,{})})})}):null,t[44]=te,t[45]=g,t[46]=xe):xe=t[46];let Se;t[47]!==be||t[48]!==xe?(Se=(0,$.jsxs)(Y,{variant:`ghost`,className:`group/address h-7 flex-1`,children:[be,xe]}),t[47]=be,t[48]=xe,t[49]=Se):Se=t[49];let Ce;t[50]!==C||t[51]!==w||t[52]!==T||t[53]!==E?(Ce=C?(0,$.jsxs)(B,{children:[(0,$.jsx)(se,{render:(0,$.jsx)(F,{variant:w?`secondary`:`ghost`,size:`icon-xs`,onClick:C,disabled:T,"aria-label":w?`Cancel annotation`:`Annotate preview`,"aria-pressed":w?`true`:`false`,type:`button`}),children:(0,$.jsx)(M,{className:ne(w&&`text-primary`)})}),(0,$.jsx)(ce,{children:T&&E?E:w?`Cancel annotation (Esc)`:`Annotate elements, regions, and drawings`})]}):null,t[50]=C,t[51]=w,t[52]=T,t[53]=E,t[54]=Ce):Ce=t[54];let we;t[55]!==v||t[56]!==_||t[57]!==y?(we=_?(0,$.jsxs)(B,{children:[(0,$.jsxs)(se,{render:(0,$.jsx)(F,{variant:y?`secondary`:`ghost`,size:`icon-xs`,onClick:e=>_(e.shiftKey),"aria-label":y?`Stop recording`:`Capture screenshot`,type:`button`,className:`relative`,disabled:v}),children:[(0,$.jsx)(O,{className:ne(y&&`text-destructive`)}),y?(0,$.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-1.5 animate-status-pulse rounded-full bg-destructive`}):null]}),(0,$.jsx)(ce,{children:y?`Stop recording`:`Screenshot · Shift-click to record`})]}):null,t[55]=v,t[56]=_,t[57]=y,t[58]=we):we=t[58];let Te;t[59]!==b||t[60]!==x||t[61]!==S?(Te=b?(0,$.jsx)(F,{variant:x?`secondary`:`ghost`,size:`icon-xs`,onClick:b,"aria-label":x?`Close floating preview`:`Float preview over chat`,"aria-pressed":x?`true`:`false`,type:`button`,disabled:S,children:(0,$.jsx)(h,{className:ne(x&&`text-primary`)})}):null,t[59]=b,t[60]=x,t[61]=S,t[62]=Te):Te=t[62];let Ee;t[63]!==k||t[64]!==L||t[65]!==me||t[66]!==Se||t[67]!==Ce||t[68]!==we||t[69]!==Te||t[70]!==D?(Ee=(0,$.jsxs)(`form`,{onSubmit:L,className:`flex h-10 min-h-10 shrink-0 items-center gap-1 border-b border-border/60 bg-background px-2 in-data-[preview-panel-mode=inline]:mb-3 in-data-[preview-panel-mode=inline]:h-7 in-data-[preview-panel-mode=inline]:min-h-7 in-data-[preview-panel-mode=inline]:border-b-transparent`,"data-surface-subheader":!0,children:[me,k,Se,Ce,we,Te,D]}),t[63]=k,t[64]=L,t[65]=me,t[66]=Se,t[67]=Ce,t[68]=we,t[69]=Te,t[70]=D,t[71]=Ee):Ee=t[71];let De;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(De={boxShadow:`0 0 6px 1px var(--color-ring)`},t[72]=De):De=t[72];let Oe;t[73]===r?Oe=t[74]:(Oe=(0,$.jsx)(`div`,{"aria-hidden":!0,"data-loading":r,className:`preview-loading-progress pointer-events-none absolute bottom-0 left-0 z-10 h-0.5 w-full origin-left rounded-r-full bg-primary`,style:De}),t[73]=r,t[74]=Oe);let ke;return t[75]!==Ee||t[76]!==Oe?(ke=(0,$.jsxs)(`div`,{className:`relative`,children:[Ee,Oe]}),t[75]=Ee,t[76]=Oe,t[77]=ke):ke=t[77],ke}function vt(e){let t=(0,Q.c)(10),{threadRef:n,server:r,onOpen:i}=e,a;t[0]===r?a=t[1]:(a=yt(r),t[0]=r,t[1]=a);let o=a,s;t[2]!==r.requestedUrl||t[3]!==n?(s=(0,$.jsx)(q,{threadRef:n,url:r.requestedUrl}),t[2]=r.requestedUrl,t[3]=n,t[4]=s):s=t[4];let c=`${r.host}:${r.port}`,l;return t[5]!==i||t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,$.jsx)(xe,{onClick:i,icon:s,title:o,description:c}),t[5]=i,t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function yt(e){return e.processName?e.processName:`Listening`}function bt(e){let t=(0,Q.c)(26),{threadRef:n,entry:r,onOpen:i,onRemove:a}=e,o;t[0]===r.url?o=t[1]:(o=new URL(r.url),t[0]=r.url,t[1]=o);let s=o,c=s.pathname===`/`?``:s.pathname,l=`${s.host}${c}${s.search}${s.hash}`,u;t[2]===r.lastVisitedAt?u=t[3]:(u=Ne(r.lastVisitedAt)?pe(new Date(r.lastVisitedAt).toISOString()):``,t[2]=r.lastVisitedAt,t[3]=u);let d=u;ft();let f;t[4]!==r.url||t[5]!==n?(f=(0,$.jsx)(q,{threadRef:n,url:r.url}),t[4]=r.url,t[5]=n,t[6]=f):f=t[6];let p=r.title??l,m;t[7]===p?m=t[8]:(m=(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:p}),t[7]=p,t[8]=m);let h=r.title?`${l} · `:``,g;t[9]!==h||t[10]!==d?(g=(0,$.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[h,d]}),t[9]=h,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==m||t[13]!==g?(_=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[m,g]}),t[12]=m,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==i||t[16]!==f||t[17]!==_?(v=(0,$.jsxs)(`button`,{type:`button`,onClick:i,className:`flex w-full items-center gap-3 px-3 py-3 pr-10 text-left hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:[f,_]}),t[15]=i,t[16]=f,t[17]=_,t[18]=v):v=t[18];let b=`Remove ${l} from history`,x;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(y,{className:`size-3.5`}),t[19]=x):x=t[19];let S;t[20]!==a||t[21]!==b?(S=(0,$.jsx)(`button`,{type:`button`,"aria-label":b,onClick:a,className:`absolute right-3 rounded p-1 text-muted-foreground opacity-0 hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring group-hover:opacity-100`,children:x}),t[20]=a,t[21]=b,t[22]=S):S=t[22];let C;return t[23]!==S||t[24]!==v?(C=(0,$.jsxs)(`div`,{className:`group relative flex w-full items-center`,children:[v,S]}),t[23]=S,t[24]=v,t[25]=C):C=t[25],C}function xt(e){let t=(0,Q.c)(7),n=Je(e.environmentId,e.configuredUrls),r;if(t[0]!==e.configuredUrls||t[1]!==e.environmentId||t[2]!==n.configuredUrlProbing||t[3]!==n.servers){let i;t[5]===e.environmentId?i=t[6]:(i=t=>({...t,url:je(e.environmentId,t.url),requestedUrl:t.url}),t[5]=e.environmentId,t[6]=i),r=St({scanner:n.servers.map(i),configuredUrls:e.configuredUrls??[],configuredUrlProbing:n.configuredUrlProbing}),t[0]=e.configuredUrls,t[1]=e.environmentId,t[2]=n.configuredUrlProbing,t[3]=n.servers,t[4]=r}else r=t[4];return r}function St(e){let t=new Map;for(let n of e.configuredUrls){let e=wt(n);if(!e)continue;let r=Ct(e.host,e.port);t.has(r)||t.set(r,e)}let n=[];for(let r of e.scanner){let i=Ct(r.host,r.port),a=t.get(i);n.push({...r,requestedUrl:a&&e.configuredUrlProbing===!1?a.url:r.requestedUrl,source:a?`configured`:`scanner`})}return n.toSorted((e,t)=>{let n={configured:0,scanner:1};return n[e.source]===n[t.source]?e.port-t.port:n[e.source]-n[t.source]})}function Ct(e,t){let n=e.toLowerCase();return`${ze(n)?`loopback`:n}:${t}`}function wt(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`||!ze(t.hostname))return null;let n=t.port?Number.parseInt(t.port,10):t.protocol===`http:`?80:443;return!Number.isFinite(n)||n<=0?null:{host:t.hostname,port:n,url:t.href}}catch{return null}}function Tt(e){let t=(0,Q.c)(24),{threadRef:n,environmentId:r,configuredUrls:a,recentEntries:o,onRemoveRecent:s,onOpenUrl:c}=e,l;t[0]!==a||t[1]!==r?(l={environmentId:r,configuredUrls:a},t[0]=a,t[1]=r,t[2]=l):l=t[2];let u=xt(l),d,f,p,h;if(t[3]!==c||t[4]!==s||t[5]!==o||t[6]!==u.length||t[7]!==n){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e=o.filter(Et).slice(0,8);if(u.length===0&&e.length===0){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(_e,{children:[(0,$.jsx)(me,{variant:`icon`,children:(0,$.jsx)(ie,{className:`size-4.5 text-muted-foreground`})}),(0,$.jsx)(he,{children:`No preview yet`}),(0,$.jsx)(ge,{children:`Type a URL above, or run a dev script. Browser-ready localhost servers will show up here automatically.`})]}),t[12]=e):e=t[12],h=e;break bb0}p=`scrollbar-gutter-both flex h-full min-h-0 overflow-y-auto px-5 py-8`,d=`mx-auto flex w-full max-w-xl flex-col gap-6`,f=e.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(m,{className:`size-4 shrink-0`}),(0,$.jsx)(`h2`,{className:`font-medium`,children:`Recently used`})]}),(0,$.jsx)(Se,{children:e.map(e=>(0,$.jsx)(bt,{threadRef:n,entry:e,onOpen:()=>c(e.url),onRemove:()=>s(e.url)},e.url))})]}):null}t[3]=c,t[4]=s,t[5]=o,t[6]=u.length,t[7]=n,t[8]=d,t[9]=f,t[10]=p,t[11]=h}else d=t[8],f=t[9],p=t[10],h=t[11];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;t[13]!==c||t[14]!==u||t[15]!==n?(g=u.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(i,{className:`size-4 shrink-0`}),(0,$.jsx)(`h2`,{className:`font-medium`,children:`Local servers`})]}),(0,$.jsx)(Se,{children:u.map(e=>(0,$.jsx)(vt,{threadRef:n,server:e,onOpen:()=>c(e.requestedUrl)},`${e.host}:${e.port}`))}),(0,$.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:`Select a live local server to open it in this browser tab.`})]}):null,t[13]=c,t[14]=u,t[15]=n,t[16]=g):g=t[16];let _;t[17]!==d||t[18]!==f||t[19]!==g?(_=(0,$.jsxs)(`div`,{className:d,children:[f,g]}),t[17]=d,t[18]=f,t[19]=g,t[20]=_):_=t[20];let v;return t[21]!==p||t[22]!==_?(v=(0,$.jsx)(`div`,{className:p,children:_}),t[21]=p,t[22]=_,t[23]=v):v=t[23],v}function Et(e){return URL.canParse(e.url)}var Dt=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],Ot=()=>{let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(B,{children:[(0,$.jsx)(se,{render:(0,$.jsx)(j,{render:(0,$.jsx)(F,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":`Preview menu`})}),children:(0,$.jsx)(D,{})}),(0,$.jsx)(ce,{children:`More`})]}),e[0]=t):t=e[0],t};function kt(e){let t=(0,Q.c)(74),{enabled:n,actions:r,zoomFactor:i,colorScheme:a,deviceToolbarVisible:s,onToggleDeviceToolbar:l,nativePictureInPicture:u,profileName:d,move:f}=e,p;t[0]===i?p=t[1]:(p=Math.round(i*100),t[0]=i,t[1]=p);let m=`${p}%`,h=!n,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(Ot,{}),t[2]=v):v=t[2];let y;t[3]!==r.hardReload||t[4]!==h?(y=(0,$.jsx)(S,{onClick:r.hardReload,disabled:h,children:`Hard reload`}),t[3]=r.hardReload,t[4]=h,t[5]=y):y=t[5];let x;t[6]!==r.openDevTools||t[7]!==h?(x=r.openDevTools?(0,$.jsx)(S,{onClick:r.openDevTools,disabled:h,children:`Open DevTools`}):null,t[6]=r.openDevTools,t[7]=h,t[8]=x):x=t[8];let T;t[9]!==r.toggleNativePictureInPicture||t[10]!==h||t[11]!==u?(T=r.toggleNativePictureInPicture?(0,$.jsx)(S,{onClick:r.toggleNativePictureInPicture,disabled:h,children:u?`Close separate preview window`:`Open separate preview window`}):null,t[9]=r.toggleNativePictureInPicture,t[10]=h,t[11]=u,t[12]=T):T=t[12];let E;t[13]===f?E=t[14]:(E=f?(0,$.jsx)(S,{onClick:f.onMove,children:f.label}):null,t[13]=f,t[14]=E);let D=s?`Hide device toolbar`:`Show device toolbar`,O;t[15]!==h||t[16]!==l||t[17]!==D?(O=(0,$.jsx)(S,{onClick:l,disabled:h,children:D}),t[15]=h,t[16]=l,t[17]=D,t[18]=O):O=t[18];let A;t[19]===h?A=t[20]:(A=(0,$.jsx)(w,{disabled:h,children:`Appearance`}),t[19]=h,t[20]=A);let j;t[21]===r?j=t[22]:(j=e=>r.setColorScheme(e),t[21]=r,t[22]=j);let M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=Dt.map(jt),t[23]=M):M=t[23];let N;t[24]!==a||t[25]!==j?(N=(0,$.jsx)(k,{children:(0,$.jsx)(_,{value:a,onValueChange:j,children:M})}),t[24]=a,t[25]=j,t[26]=N):N=t[26];let ne;t[27]!==N||t[28]!==A?(ne=(0,$.jsxs)(te,{children:[A,N]}),t[27]=N,t[28]=A,t[29]=ne):ne=t[29];let I;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(re,{}),t[30]=I):I=t[30];let ie;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(`span`,{children:`Zoom`}),t[31]=ie):ie=t[31];let L;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(P,{}),t[32]=L):L=t[32];let R;t[33]!==r.zoomOut||t[34]!==h?(R=(0,$.jsx)(F,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:r.zoomOut,"aria-label":`Zoom out`,disabled:h,children:L}),t[33]=r.zoomOut,t[34]=h,t[35]=R):R=t[35];let ae;t[36]===m?ae=t[37]:(ae=(0,$.jsx)(`span`,{className:`min-w-12 text-center text-xs tabular-nums text-muted-foreground`,children:m}),t[36]=m,t[37]=ae);let oe;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(g,{}),t[38]=oe):oe=t[38];let z;t[39]!==r.zoomIn||t[40]!==h?(z=(0,$.jsx)(F,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:r.zoomIn,"aria-label":`Zoom in`,disabled:h,children:oe}),t[39]=r.zoomIn,t[40]=h,t[41]=z):z=t[41];let se;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,$.jsx)(b,{}),t[42]=se):se=t[42];let ce;t[43]!==r.resetZoom||t[44]!==h?(ce=(0,$.jsx)(F,{variant:`ghost`,size:`icon-xs`,type:`button`,onClick:r.resetZoom,"aria-label":`Reset zoom`,disabled:h,children:se}),t[43]=r.resetZoom,t[44]=h,t[45]=ce):ce=t[45];let B;t[46]!==R||t[47]!==ae||t[48]!==z||t[49]!==ce?(B=(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[R,ae,z,ce]}),t[46]=R,t[47]=ae,t[48]=z,t[49]=ce,t[50]=B):B=t[50];let le;t[51]!==h||t[52]!==B?(le=(0,$.jsxs)(S,{closeOnClick:!1,onClick:At,className:`justify-between`,disabled:h,children:[ie,B]}),t[51]=h,t[52]=B,t[53]=le):le=t[53];let ue;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,$.jsx)(re,{}),t[54]=ue):ue=t[54];let de;t[55]===d?de=t[56]:(de=d?(0,$.jsx)(c,{className:`max-w-64`,children:(0,$.jsxs)(`span`,{className:`block truncate`,children:[`Profile: `,d]})}):null,t[55]=d,t[56]=de);let V;t[57]===r.clearCookies?V=t[58]:(V=(0,$.jsx)(S,{onClick:r.clearCookies,children:`Clear cookies`}),t[57]=r.clearCookies,t[58]=V);let fe;t[59]===r.clearCache?fe=t[60]:(fe=(0,$.jsx)(S,{onClick:r.clearCache,children:`Clear cache`}),t[59]=r.clearCache,t[60]=fe);let H;t[61]!==de||t[62]!==V||t[63]!==fe?(H=(0,$.jsxs)(ee,{children:[de,V,fe]}),t[61]=de,t[62]=V,t[63]=fe,t[64]=H):H=t[64];let U;return t[65]!==ne||t[66]!==le||t[67]!==H||t[68]!==y||t[69]!==x||t[70]!==T||t[71]!==E||t[72]!==O?(U=(0,$.jsxs)(o,{children:[v,(0,$.jsxs)(C,{align:`end`,sideOffset:6,children:[y,x,T,E,O,ne,I,le,ue,H]})]}),t[65]=ne,t[66]=le,t[67]=H,t[68]=y,t[69]=x,t[70]=T,t[71]=E,t[72]=O,t[73]=U):U=t[73],U}function At(e){return e.preventDefault()}function jt(e){return(0,$.jsx)(n,{value:e.value,children:e.label},e.value)}function Mt(e){return d[e]||(e.length>0?e:`Network error`)}function Nt(e){let t=(0,Q.c)(21),{url:n,fileName:r,downloadUrl:i,onOpen:a}=e,o;t[0]===n?o=t[1]:(o=Lt(n)??n,t[0]=n,t[1]=o);let s=o,c,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(It,{className:`mb-6 size-12 text-muted-foreground/70`}),l=(0,$.jsx)(`h1`,{className:`mb-3 text-2xl font-semibold leading-tight text-foreground`,children:`This file can’t be shown here`}),t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u;t[4]===r?u=t[5]:(u=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:r}),t[4]=r,t[5]=u);let d;t[6]!==s||t[7]!==u?(d=(0,$.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[u,` from `,s,` was downloaded instead.`]}),t[6]=s,t[7]=u,t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`div`,{className:`flex-1`}),t[9]=f):f=t[9];let p;t[10]===a?p=t[11]:(p=(0,$.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,onClick:a,children:`Open in browser`}),t[10]=a,t[11]=p);let m;t[12]!==i||t[13]!==r?(m=i?(0,$.jsx)(F,{type:`button`,size:`sm`,render:(0,$.jsx)(`a`,{href:i,download:r}),children:`Download`}):null,t[12]=i,t[13]=r,t[14]=m):m=t[14];let h;t[15]!==p||t[16]!==m?(h=(0,$.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 pt-8`,children:[f,p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17];let g;return t[18]!==d||t[19]!==h?(g=(0,$.jsx)(`div`,{className:`scrollbar-gutter-both relative flex h-full min-h-0 w-full overflow-y-auto bg-background`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-1 flex-col px-8 py-12 sm:py-16`,children:[c,l,d,h]})}),t[18]=d,t[19]=h,t[20]=g):g=t[20],g}function Pt(e){let t=(0,Q.c)(44),{url:n,code:r,description:i,onReload:a,move:o}=e,[s,c]=(0,Z.useState)(!1),l;t[0]===n?l=t[1]:(l=Lt(n)??n,t[0]=n,t[1]=l);let u=l,d;t[2]===i?d=t[3]:(d=Mt(i),t[2]=i,t[3]=d);let f=d,p;t[4]!==r||t[5]!==i?(p=i.length>0?i:`ERR_${Math.abs(r)||`FAILED`}`,t[4]=r,t[5]=i,t[6]=p):p=t[6];let m=p,h,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(It,{className:`mb-6 size-12 text-muted-foreground/70`}),g=(0,$.jsx)(`h1`,{className:`mb-3 text-2xl font-semibold leading-tight text-foreground`,children:`This site can’t be reached`}),t[7]=h,t[8]=g):(h=t[7],g=t[8]);let _;t[9]===u?_=t[10]:(_=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:u}),t[9]=u,t[10]=_);let v;t[11]!==f||t[12]!==_?(v=(0,$.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[_,`: `,f,`.`]}),t[11]=f,t[12]=_,t[13]=v):v=t[13];let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(`p`,{className:`mb-2 font-medium text-foreground`,children:`Try:`}),t[14]=y):y=t[14];let b,x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`li`,{children:`Checking your connection`}),b=(0,$.jsx)(`li`,{children:`Confirming the dev server is running`}),t[15]=b,t[16]=x):(b=t[15],x=t[16]);let S;t[17]===o?S=t[18]:(S=o?(0,$.jsx)(`li`,{children:`Opening it in the environment’s browser, which reaches its network`}):null,t[17]=o,t[18]=S);let C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(`li`,{children:`Checking the proxy and the firewall`}),t[19]=C):C=t[19];let w;t[20]===S?w=t[21]:(w=(0,$.jsx)(Ve,{children:(0,$.jsxs)(`div`,{className:`mt-6 rounded-lg border border-border bg-muted/40 p-4 text-sm`,children:[y,(0,$.jsxs)(`ul`,{className:`list-disc space-y-1 pl-5 text-muted-foreground`,children:[x,b,S,C]})]})}),t[20]=S,t[21]=w);let T;t[22]!==s||t[23]!==w?(T=(0,$.jsx)(Ue,{open:s,children:w}),t[22]=s,t[23]=w,t[24]=T):T=t[24];let E;t[25]===m?E=t[26]:(E=(0,$.jsx)(`div`,{className:`mt-8 text-xs uppercase tracking-wide text-muted-foreground/70`,children:m}),t[25]=m,t[26]=E);let D;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>c(Ft),t[27]=D):D=t[27];let O=s?`Hide details`:`Details`,k;t[28]===O?k=t[29]:(k=(0,$.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,onClick:D,children:O}),t[28]=O,t[29]=k);let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(`div`,{className:`flex-1`}),t[30]=A):A=t[30];let j;t[31]===o?j=t[32]:(j=o?(0,$.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,onClick:o.onMove,children:o.label}):null,t[31]=o,t[32]=j);let M;t[33]===a?M=t[34]:(M=(0,$.jsx)(F,{type:`button`,size:`sm`,onClick:a,children:`Reload`}),t[33]=a,t[34]=M);let ee;t[35]!==k||t[36]!==j||t[37]!==M?(ee=(0,$.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 pt-8`,children:[k,A,j,M]}),t[35]=k,t[36]=j,t[37]=M,t[38]=ee):ee=t[38];let N;return t[39]!==T||t[40]!==E||t[41]!==ee||t[42]!==v?(N=(0,$.jsx)(`div`,{className:`scrollbar-gutter-both relative flex h-full min-h-0 w-full overflow-y-auto bg-background`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-1 flex-col px-8 py-12 sm:py-16`,children:[h,g,v,T,E,ee]})}),t[39]=T,t[40]=E,t[41]=ee,t[42]=v,t[43]=N):N=t[43],N}function Ft(e){return!e}function It(e){let t=(0,Q.c)(5),{className:n}=e,r,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`path`,{d:`M16 12 L48 12 L48 52 L16 52 Z`}),i=(0,$.jsx)(`path`,{d:`M22 22 L42 22 M22 30 L36 30 M22 38 L40 38`,strokeLinecap:`round`}),a=(0,$.jsx)(`path`,{d:`M52 8 L12 56`,strokeLinecap:`round`}),t[0]=r,t[1]=i,t[2]=a):(r=t[0],i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,$.jsxs)(`svg`,{viewBox:`0 0 64 64`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,className:n,children:[r,i,a]}),t[3]=n,t[4]=o),o}function Lt(e){try{return new URL(e).host}catch{return null}}var Rt=1500,zt=.001;function Bt(e){let t=(0,Q.c)(11),{zoomFactor:n}=e,[r,i]=(0,Z.useState)(!1),a=(0,Z.useRef)(n),o=(0,Z.useRef)(null),s,c;t[0]===n?(s=t[1],c=t[2]):(s=()=>{if(!(Math.abs(a.current-n)<zt))return a.current=n,i(!0),o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{i(!1),o.current=null},Rt),()=>{o.current!==null&&(window.clearTimeout(o.current),o.current=null)}},c=[n],t[0]=n,t[1]=s,t[2]=c),(0,Z.useEffect)(s,c);let l;t[3]===n?l=t[4]:(l=Math.round(n*100),t[3]=n,t[4]=l);let u=`${l}%`,d=!r,f=r?`opacity-100 translate-y-0`:`opacity-0 -translate-y-1`,p;t[5]===f?p=t[6]:(p=ne(`pointer-events-none absolute top-3 right-3 z-20 select-none rounded-full border border-border/70 bg-popover/95 px-2.5 py-1 text-xs font-medium text-foreground shadow-md/10 backdrop-blur transition-all duration-200 ease-out`,f),t[5]=f,t[6]=p);let m;return t[7]!==u||t[8]!==d||t[9]!==p?(m=(0,$.jsx)(`div`,{"aria-hidden":d,className:p,children:u}),t[7]=u,t[8]=d,t[9]=p,t[10]=m):m=t[10],m}function Vt(e,t){return e.find(e=>e.id===t)?.name??`Removed profile`}var Ht=typeof window>`u`?null:W();function Ut(e){let t=(0,Q.c)(12),n=at(e.threadRef.environmentId),r;t[0]!==n||t[1]!==e.download.id||t[2]!==e.tabId||t[3]!==e.threadRef.threadId?(r=n?ot({access:n,threadId:e.threadRef.threadId,tabId:e.tabId},e.download.id):null,t[0]=n,t[1]=e.download.id,t[2]=e.tabId,t[3]=e.threadRef.threadId,t[4]=r):r=t[4];let i;t[5]===e.url?i=t[6]:(i=()=>void Ht?.shell.openExternal(e.url).catch(Wt),t[5]=e.url,t[6]=i);let a;return t[7]!==e.download.fileName||t[8]!==e.url||t[9]!==r||t[10]!==i?(a=(0,$.jsx)(Nt,{url:e.url,fileName:e.download.fileName,downloadUrl:r,onOpen:i}),t[7]=e.download.fileName,t[8]=e.url,t[9]=r,t[10]=i,t[11]=a):a=t[11],a}function Wt(){}function Gt({threadRef:e,tabId:t,configuredUrls:n,visible:i,onSendAnnotation:o}){let[c,u]=(0,Z.useState)(void 0),[d,f]=(0,Z.useState)(!1),p=V(e.environmentId,`orchestration:operate`)&&!!o,m=We(),h=(0,Z.useRef)(null),g=(0,Z.useRef)(!0),_=(0,Z.useRef)(e);_.current=e;let y=s(e),b=Ee(e,50),S=ve(t=>ye(t.byThreadKey,e)),C=a(e=>e.addPreviewAnnotation),w=a(e=>e.addImage),T=le(e.environmentId),D=T?new URL(T).hostname:null,O=H(Ie.open),k=H(Ie.close,`preview close`),j=de(e.environmentId)?.label??`the environment`,M=ue(),ee=ae(e.environmentId),N=H(Ie.resize,`preview viewport resize`),te=H(Ie.adjust,`preview appearance or zoom`);lt(e),(0,Z.useEffect)(()=>(g.current=!0,()=>{g.current=!1}),[]);let P=t??y.activeTabId,F=P?Ze(e,y.serverEpoch,P):null,re=P&&F?m.has(F)?F:He(e,P):null,I=P?y.sessions[P]??null:null,ie=Te(e.environmentId,I),W=I?.runtime===`server`&&!ie,K=I?.runtime===`server`,q=(0,Z.useRef)(null),[pe,me]=(0,Z.useState)(!1),he=(0,Z.useRef)(null),[ge,_e]=(0,Z.useState)(0),xe=I?.runtime===`server`&&(I.viewport??E)._tag!==`fill`;(0,Z.useEffect)(()=>{let e=he.current;if(e&&xe)return Ce(e,([e])=>_e(Math.max(1,Math.round(e?.contentRect.width??0))))},[xe]);let[Se,Ne]=(0,Z.useState)(null),Fe=W&&Se!==F,[ze,Be]=(0,Z.useState)(null),J=P?y.desktopByTabId[P]??null:null,Y=I?.navStatus??{_tag:`Idle`},Ve=Y._tag===`Idle`?``:Y.url,Ue=J?.loading??Y._tag===`Loading`,Je=J?.canGoBack??I?.canGoBack??!1,Xe=J?.canGoForward??I?.canGoForward??!1,$e=Y._tag===`Idle`,at=Y._tag===`LoadFailed`,ot=ut(I),ft=W&&!ot&&!at&&ze!==F,Q=J?.controller??`none`,mt=I?.viewport??E,gt=Oe(),vt=I?.profileId??`default`,yt=Vt(gt.profiles,vt),bt=nt(e=>F?e.byTabId[F]?.rect??null:null),xt=Y._tag===`Success`?Y.url:null,St=Y._tag===`Success`?Y.title:null,Ct=b[0]?.url,wt=l(e);(0,Z.useEffect)(()=>{xt&&St&&Ct&&ke(_.current,xt,St,D)},[D,Ct,St,xt,wt]);let Et=(0,Z.useCallback)(async t=>{if(W&&q.current)return!Fe&&(q.current.navigate(t),v(e,t),!0);if(F&&X)return await X.navigate(F,t),v(e,t),!0;let n=await Ye({openPreview:O,threadRef:e,url:t});if(n._tag===`Failure`&&!L(n)){let e=R(n);e instanceof we&&z.add({type:`error`,title:`Unable to open browser`,description:e.message})}return n._tag===`Success`},[W,O,F,Fe,e]),Dt=(0,Z.useCallback)(async t=>{try{let n=Re(t);await Et(n)&&Ae(e,n)}catch{}},[Et,e]),Ot=(0,Z.useCallback)(async t=>{try{let n=W||!X?Le(t):je(e.environmentId,t);await Et(n)&&Ae(e,t)}catch{}},[W,Et,e]),At=(0,Z.useCallback)(()=>{W?q.current?.reload():X&&F&&X.refresh(F)},[W,F]),jt=(0,Z.useCallback)(async t=>{if(!P)return;let n=await te({environmentId:e.environmentId,input:{threadId:e.threadId,tabId:P,...t}});if(n._tag===`Failure`){let e=R(n);z.add({type:`error`,title:`Unable to change the browser tab`,description:e instanceof Error?e.message:`An error occurred.`});return}r(e,n.value)},[te,P,e]),Mt=I?.zoomFactor??1,Nt=(0,Z.useCallback)(e=>{let t=A.indexOf(Mt),n=e===0?1:A[Math.min(Math.max((t<0?7:t)+e,0),A.length-1)];n!==Mt&&jt({zoomFactor:n})},[jt,Mt]),Ft=(0,Z.useCallback)(()=>{K?Nt(1):X&&F&&X.zoomIn(F)},[F,K,Nt]),It=(0,Z.useCallback)(()=>{K?Nt(-1):X&&F&&X.zoomOut(F)},[F,K,Nt]),Lt=(0,Z.useCallback)(()=>{K?Nt(0):X&&F&&X.resetZoom(F)},[F,K,Nt]),Rt=(0,Z.useCallback)(async t=>{if(!P)return;let n=await N({environmentId:e.environmentId,input:{threadId:e.threadId,tabId:P,viewport:t}});if(n._tag===`Failure`){let e=R(n);throw z.add({type:`error`,title:`Unable to resize browser viewport`,description:e instanceof Error?e.message:`An error occurred.`}),e}r(e,n.value)},[N,P,e]),zt=()=>{if(F){if(mt._tag!==`fill`){Qe(F,E).catch(()=>void 0);return}Qe(F,Pe({defaults:gt,panelRect:bt,zoomFactor:K?Mt:J?.zoomFactor})).catch(()=>void 0)}};(0,Z.useEffect)(()=>{if(F)return tt(F,Rt)},[Rt,F]);let Wt=(0,Z.useCallback)(()=>{W?q.current?.history(-1):X&&F&&X.goBack(F)},[W,F]),Gt=(0,Z.useCallback)(()=>{W?q.current?.history(1):X&&F&&X.goForward(F)},[W,F]),Kt=(0,Z.useCallback)(()=>{Ht&&Ve&&Ht.shell.openExternal(Ve).catch(()=>void 0)},[Ve]),qt=De(e.environmentId,M,ee,I),Jt=qt===`server`?`Open in ${j}'s browser`:`Open on this computer`,Yt=(0,Z.useCallback)(async()=>{if(!qt||!P||!I)return;let t=await Ye({openPreview:O,threadRef:e,...Ve?{url:qt===`desktop`?je(e.environmentId,Ve):Ve}:{},viewport:mt,...I.profileId===void 0?{}:{profileId:I.profileId},runtime:qt});if(t._tag===`Failure`){if(L(t))return;let e=R(t);z.add({type:`error`,title:`Unable to move the browser tab`,description:e instanceof Error?e.message:`An error occurred.`});return}U.getState().openBrowser(e,t.value.tabId),await ct({closePreview:k,snapshot:I,tabId:P,threadRef:e})},[k,qt,O,I,P,e,Ve,mt]),Xt=(0,Z.useCallback)(()=>{if(P){if(S===P){ve.getState().close(e);return}ve.getState().open(e,be(P)),U.getState().close(e)}},[S,P,e]),Zt=e=>()=>{e&&F&&e(F).catch(()=>void 0)},Qt=K?{hardReload:()=>void jt({hardReload:!0}),setColorScheme:e=>void jt({colorScheme:e}),zoomIn:Ft,zoomOut:It,resetZoom:Lt,clearCookies:()=>void jt({clear:`cookies`}),clearCache:()=>void jt({clear:`cache`}),...ie&&X?{openDevTools:Zt(X.openDevTools),toggleNativePictureInPicture:()=>$t()}:{}}:X?{hardReload:Zt(X.hardReload),setColorScheme:e=>{F&&X?.setColorScheme(F,e).catch(()=>void 0)},zoomIn:Ft,zoomOut:It,resetZoom:Lt,clearCookies:()=>void X?.clearCookies(e.environmentId,vt).catch(()=>void 0),clearCache:()=>void X?.clearCache(e.environmentId,vt).catch(()=>void 0),openDevTools:Zt(X.openDevTools),toggleNativePictureInPicture:()=>$t()}:null,$t=(0,Z.useCallback)(()=>{X&&F&&(J?.pictureInPicture?X.pictureInPicture.close:X.pictureInPicture.open)(F).catch(e=>{z.add({type:`error`,title:`Unable to update popped-out preview`,description:e instanceof Error?e.message:`An error occurred.`})})},[J?.pictureInPicture,F]),en=(0,Z.useCallback)(t=>{if(!X||!F||!P)return;let n=X;if(re){qe(re).then(e=>{if(!e)return;let t=!1,r,i=()=>{if(!navigator.clipboard?.writeText){z.update(r,G({type:`error`,title:`Unable to copy recording path`,description:`Clipboard API unavailable.`,actionProps:a}));return}navigator.clipboard.writeText(e.path).then(()=>{t=!0,o(),window.setTimeout(()=>{t=!1,o()},2e3)},e=>{z.update(r,G({type:`error`,title:`Unable to copy recording path`,description:e instanceof Error?e.message:`An error occurred.`,actionProps:a}))})},a={children:oe(navigator.platform),onClick:()=>void n.revealArtifact(e.path)},o=()=>{z.update(r,G({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:t?`Copied!`:`Copy path`,disabled:t,onClick:i},secondaryActionVariant:`outline`}}))};r=z.add(G({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:`Copy path`,onClick:i},secondaryActionVariant:`outline`}}))},e=>{z.add({type:`error`,title:`Unable to stop recording`,description:e instanceof Error?e.message:`An error occurred.`})});return}if(t){Ge(F,e,P).catch(e=>{let t=e instanceof Error?e.message:`An error occurred.`;Ke(e)||z.add({type:`error`,title:`Unable to start recording`,description:t})});return}n.captureScreenshot(F).then(e=>{let t={children:oe(navigator.platform),onClick:()=>void n.revealArtifact(e.path)},r=!1,i=!1,a,o=(e=`success`,n=`Screenshot saved`,o)=>{z.update(a,G({type:e,title:n,description:o,actionProps:{children:i?`Copied!`:`Copy image`,disabled:i,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:r?`Copied!`:`Copy path`,disabled:r,onClick:s}}],secondaryActionProps:{...t},secondaryActionVariant:`outline`}}))},s=()=>{if(!navigator.clipboard?.writeText){o(`error`,`Unable to copy screenshot path`,`Clipboard API unavailable.`);return}navigator.clipboard.writeText(e.path).then(()=>{r=!0,o(),window.setTimeout(()=>{r=!1,o()},2e3)},e=>{o(`error`,`Unable to copy screenshot path`,e instanceof Error?e.message:`An error occurred.`)})},c=()=>{n.copyArtifactToClipboard(e.path).then(()=>{i=!0,o(),window.setTimeout(()=>{i=!1,o()},2e3)},e=>{o(`error`,`Unable to copy screenshot`,e instanceof Error?e.message:`An error occurred.`)})};a=z.add(G({type:`success`,title:`Screenshot saved`,actionProps:{children:`Copy image`,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:`Copy path`,onClick:s}}],secondaryActionProps:{...t},secondaryActionVariant:`outline`}}))},e=>{z.add({type:`error`,title:`Unable to capture screenshot`,description:e instanceof Error?e.message:`An error occurred.`})})},[re,F,P,e]),tn=(0,Z.useCallback)(()=>{if(!X||!F)return;if(h.current){h.current.cancelled=!0,X.cancelPickElement(F).catch(()=>void 0);return}let t=typeof document<`u`?document.activeElement:null,n={cancelled:!1},r=!1;h.current=n,f(!0),(async()=>{try{if(await X.setAnnotationSendEnabled?.(F,!!o&&fe(e.environmentId,`orchestration:operate`)),n.cancelled)return;let t=await X.pickElement(F);if(!t||n.cancelled)return;h.current===n&&(h.current=null,g.current&&f(!1),r=!0);let{annotation:i,submission:a,screenshotFailed:s=!1}=t,c=ht(i),l=s||c.status===`failed`,u=c.status===`failed`?{...i,screenshot:null}:i;C(e,u),l&&z.add(G({type:`error`,title:`Could not capture the picked element`,description:`The annotation was kept without the screenshot.`}));let d=c.status===`captured`?c.file:null,p=d&&u.screenshot?{type:`image`,id:u.id,name:d.name,mimeType:d.type,sizeBytes:d.size,previewUrl:u.screenshot.dataUrl,file:d}:null;p&&w(e,p),a===`send`&&fe(e.environmentId,`orchestration:operate`)&&o?.(u,p)}catch{}finally{let e=h.current===n;if(e&&(h.current=null,g.current&&f(!1)),(e||r)&&t&&t.isConnected&&typeof t.focus==`function`)try{t.focus({preventScroll:!0})}catch{}}})()},[w,C,o,F,e]);return(0,Z.useEffect)(()=>{d&&X&&F&&X.setAnnotationSendEnabled?.(F,p).catch(()=>void 0)},[p,d,F]),(0,Z.useEffect)(()=>()=>{h.current&&(h.current.cancelled=!0,h.current=null,X&&F&&X.cancelPickElement(F).catch(()=>void 0),g.current&&f(!1))},[F]),(0,Z.useEffect)(()=>{if(i)return pt(e=>{switch(e){case`refresh`:At();return;case`focus-url`:u(e=>(e??0)+1);return;case`zoom-in`:Ft();return;case`zoom-out`:It();return;case`reset-zoom`:Lt();return;case`toggle-panel`:return}})},[At,Lt,Ft,It,i]),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,"data-thread-key":l(e),children:[(0,$.jsx)(_t,{url:Ve,loading:Ue||ft,canGoBack:Je&&!Fe,canGoForward:Xe&&!Fe,refreshDisabled:$e||Fe,inputDisabled:Fe,focusUrlNonce:c,onBack:Wt,onForward:Gt,onRefresh:At,onSubmit:e=>void Dt(e),onOpenInBrowser:P?Kt:void 0,onCapture:X&&P&&!W?en:void 0,captureDisabled:!J||at,recording:re!==null,onPictureInPicture:P&&(W||X)?Xt:void 0,pictureInPicture:S===P,pictureInPictureDisabled:at||!W&&!J?.hasWebContents,onPickElement:X&&P&&!W?tn:void 0,pickActive:d,pickDisabled:!P||at,pickDisabledReason:at?`Page didn't load — pick unavailable until the page renders`:void 0,leadingActions:vt===gt.profileId?null:(0,$.jsxs)(B,{children:[(0,$.jsx)(se,{render:(0,$.jsx)(x,{variant:`outline`,className:`max-w-28 shrink-0`}),children:(0,$.jsx)(`span`,{className:`truncate`,children:yt})}),(0,$.jsx)(ce,{side:`top`,children:yt})]}),trailingActions:Qt?(0,$.jsx)(kt,{enabled:F!==null&&(K||(J?.hasWebContents??!1)),actions:Qt,...qt?{move:{label:Jt,onMove:()=>void Yt()}}:{},profileName:yt,zoomFactor:K?Mt:J?.zoomFactor??1,colorScheme:K?I?.colorScheme??`system`:J?.colorScheme??`system`,deviceToolbarVisible:mt._tag!==`fill`,onToggleDeviceToolbar:zt,nativePictureInPicture:J?.pictureInPicture??!1}):null}),(0,$.jsxs)(`div`,{ref:he,className:`relative min-h-0 flex-1 overflow-hidden`,children:[F&&I&&W?(0,$.jsxs)($.Fragment,{children:[mt._tag!==`fill`&&!ot&&!at?(0,$.jsx)(`div`,{className:`absolute inset-x-0 top-0 z-10`,children:(0,$.jsx)(et,{setting:mt,width:ge,aspectRatio:pe?mt.width/mt.height:null,onAspectRatioChange:e=>me(e!==null),onChange:e=>Qe(F,e)})}):null,(0,$.jsx)(`div`,{className:`absolute inset-x-0 bottom-0`,style:{top:mt._tag===`fill`?0:38},children:(0,$.jsx)(dt,{ref:q,environmentId:e.environmentId,threadId:e.threadId,tabId:I.tabId,visible:i,onFirstFrame:()=>Be(F),onControl:e=>Ne(e?.controller===`you`?F:null),onPopup:t=>it(e,t,`panel`),className:ne(`absolute inset-0 h-full w-full`,(ot||at)&&`invisible`)},F)})]}):F&&I&&!ot?X?(0,$.jsx)(rt,{tabId:F,visible:i&&!at,className:`absolute inset-0 h-full w-full`},F):(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center p-8 text-center`,children:(0,$.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:`This tab is open in the P4 Code desktop app.`})}):null,ot?(0,$.jsx)(Tt,{threadRef:e,environmentId:e.environmentId,configuredUrls:n,recentEntries:b,onRemoveRecent:t=>Me(e,t),onOpenUrl:e=>void Ot(e)}):null,I&&J?(0,$.jsx)(Bt,{zoomFactor:J.zoomFactor}):null,F&&J&&!ot&&!at&&!m.has(F)?(0,$.jsx)(st,{tabId:F,zoomFactor:J.zoomFactor,controller:Q}):null,Y._tag===`LoadFailed`&&Y.download?(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,$.jsx)(Ut,{threadRef:e,tabId:I?.tabId??``,url:Y.url,download:Y.download})}):Y._tag===`LoadFailed`?(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,$.jsx)(Pt,{url:Y.url,code:Y.code,description:Y.description,onReload:At,...qt===`server`?{move:{label:Jt,onMove:()=>void Yt()}}:{}})}):null]})]})}function Kt(e){let t=(0,Q.c)(18),{mode:n,threadRef:r,tabId:i,configuredUrls:a,visible:o,onSendAnnotation:s}=e,c=Fe(r.environmentId),l=V(r.environmentId,I);if(!l||!c){let e=l?`Preview is only available in the P4 Code desktop app.`:`Pair this client again with preview access to control browser previews.`,r;t[0]===e?r=t[1]:(r=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:(0,$.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:e})}),t[0]=e,t[1]=r);let i;return t[2]!==n||t[3]!==r?(i=(0,$.jsx)(K,{mode:n,children:r}),t[2]=n,t[3]=r,t[4]=i):i=t[4],i}let u;t[5]===i?u=t[6]:(u=i===void 0?{}:{tabId:i},t[5]=i,t[6]=u);let d;t[7]===s?d=t[8]:(d=s?{onSendAnnotation:s}:{},t[7]=s,t[8]=d);let f;t[9]!==a||t[10]!==u||t[11]!==d||t[12]!==r||t[13]!==o?(f=(0,$.jsx)(Gt,{threadRef:r,...u,configuredUrls:a,visible:o,...d}),t[9]=a,t[10]=u,t[11]=d,t[12]=r,t[13]=o,t[14]=f):f=t[14];let p;return t[15]!==n||t[16]!==f?(p=(0,$.jsx)(K,{mode:n,children:f}),t[15]=n,t[16]=f,t[17]=p):p=t[17],p}export{Kt as PreviewPanel};
2
- //# sourceMappingURL=PreviewPanel-CJ81wdo6.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{Ht as t,Jt as ee,Kt as te,ME as n,Nt as ne,Vt as re,cE as r,dh as i,ks as a,nn as ie}from"./utils-CRwA5SKO.js";import{a as o,c as s,o as c,s as l,t as u}from"./select-BQxcmO_1.js";import{t as ae}from"./useNavigate-Dvl9uiuL.js";import{i as oe}from"./toast-BYGWNQVa.js";import{a as se}from"./environments-C3ohMa2W.js";import{t as ce}from"./server-BC4-DXjw.js";import{i as le}from"./useSettings-CbuRZg7F.js";import{t as d}from"./pullRequestDetail.logic-rvhEbiFP.js";import{i as ue}from"./p4ProjectFile-D9Mx0dmO.js";import{B as de,F as f,L as fe,N as pe,P as me,S as p,a as m,n as he,p as ge,r as h,s as _e}from"./settingsLayout-D-5E1K-3.js";import{La as ve,ir as g}from"./main-DUXMPAgZ.js";import{t as ye}from"./ProviderModelPicker-7TESki3o.js";import{n as be,t as xe}from"./runtimeModeConfig-DF8wod3s.js";var Se=n(),_=e(r(),1),Ce=[`recursive`,`top-level`,`none`];function we(e){return e!==null&&Ce.includes(e)}function Te(e){let n=(0,Se.c)(95),{category:r}=e,{scope:Te,target:v,targets:Ae,connectedEnvironments:je}=de(),y=me(),b=fe(),Me=ae(),{environments:x}=se(),S,C,w,T,E;if(n[0]!==x||n[1]!==y||n[2]!==v){w=v?x.find(e=>e.environmentId===v.environmentId):void 0;let e=w?.serverConfig?.providers??ce;T=te(e,y.defaultModelSelection),S=ee(re(t(e),y,v?.projectId??null)),C=ne(y,e,T?.instanceId,T?.model),E=S.find(e=>e.instanceId===T?.instanceId),n[0]=x,n[1]=y,n[2]=v,n[3]=S,n[4]=C,n[5]=w,n[6]=T,n[7]=E}else S=n[3],C=n[4],w=n[5],T=n[6],E=n[7];let D=E,O;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=[`defaultModelSelection`],n[8]=O):O=n[8];let k=f(O),A;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=[`defaultRuntimeMode`],n[9]=A):A=n[9];let j=f(A),Ne=xe[y.defaultRuntimeMode].icon,M;n[10]===Symbol.for(`react.memo_cache_sentinel`)?(M=[`defaultThreadEnvMode`],n[10]=M):M=n[10];let N=f(M),P;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=[`worktreeSubmodules`],n[11]=P):P=n[11];let F=f(P),I;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(I=[`enableAgentBrowserAccess`],n[12]=I):I=n[12];let L=f(I),Pe;n[13]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=[`defaultAutoPull`],n[13]=Pe):Pe=n[13];let R=f(Pe),z;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(z=[`removeAgentCreditsOnMerge`],n[14]=z):z=n[14];let B=f(z),Fe;n[15]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=[`pullRequestMergeMethod`],n[15]=Fe):Fe=n[15];let Ie=f(Fe),Le;n[16]===Symbol.for(`react.memo_cache_sentinel`)?(Le=[`defaultModelSelection`],n[16]=Le):Le=n[16];let Re=pe(Le),V=Te.kind===`project`||Te.kind===`checkout`,H=je.length===0,ze;n[17]===v?ze=n[18]:(ze=v?ue(v.settings,null,null,null).settings:null,n[17]=v,n[18]=ze);let Be=ze,Ve;n[19]!==S||n[20]!==x||n[21]!==y||n[22]!==Ae?(Ve=function(e,ee){let te=S.find(t=>t.instanceId===e);for(let n of Ae){let r=x.find(e=>e.environmentId===n.environmentId),i=r?.serverConfig;if(!i)continue;let a=re(t(i.providers),n.settings,n.projectId).find(t=>t.instanceId===e),ie=ne(le(n.settings,y),i.providers).get(e);if(!a?.enabled||!a.isAvailable||a.driverKind!==te?.driverKind||!ie?.some(e=>e.slug===ee&&!e.isUnavailable))return`This model is unavailable on ${r?.label??`a selected environment`}. Select that environment to choose its model separately.`}return null},n[19]=S,n[20]=x,n[21]=y,n[22]=Ae,n[23]=Ve):Ve=n[23];let U=Ve,He;n[24]!==U||n[25]!==b?(He=e=>{let t=e?U(e.instanceId,e.model):null;if(t){oe.add({type:`error`,title:`Default model not saved`,description:t});return}b({defaultModelSelection:e})},n[24]=U,n[25]=b,n[26]=He):He=n[26];let W=He,Ue;n[27]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=[`defaultModelSelection`],n[27]=Ue):Ue=n[27];let We=V?`Model for new threads in this project.`:`Default model for new threads. Projects can override it.`,Ge=H||k||Re===`project`?void 0:y.defaultModelSelection===null?`Automatic`:void 0,G;n[28]!==W||n[29]!==y.defaultModelSelection?(G=y.defaultModelSelection===null?null:(0,_.jsx)(h,{label:`default model`,onClick:()=>W(null)}),n[28]=W,n[29]=y.defaultModelSelection,n[30]=G):G=n[30];let K;n[31]!==D||n[32]!==S||n[33]!==k||n[34]!==U||n[35]!==C||n[36]!==Me||n[37]!==w||n[38]!==T||n[39]!==W||n[40]!==y.planModeEnabled?(K=T&&D?(0,_.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-1.5`,children:[(0,_.jsx)(ye,{environmentId:w?.environmentId??null,activeInstanceId:T.instanceId,model:T.model,lockedProvider:null,instanceEntries:S,modelOptionsByInstance:C,triggerClassName:he,...k?{triggerLabel:`Mixed`}:{},getModelDisabledReason:U,onOpenProviderSetup:e=>{w&&Me({to:`/settings/providers`,search:{environmentId:w.environmentId,instanceId:e}})},onInstanceModelChange:(e,t)=>W(a(e,t))}),k?null:(0,_.jsx)(ie,{provider:D.driverKind,models:D.models,model:T.model,prompt:``,onPromptChange:ke,modelOptions:T.options??[],allowPromptInjectedEffort:!1,planModeEnabled:y.planModeEnabled,triggerClassName:he,onModelOptionsChange:e=>W(a(T.instanceId,T.model,e))})]}):(0,_.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`No providers available`}),n[31]=D,n[32]=S,n[33]=k,n[34]=U,n[35]=C,n[36]=Me,n[37]=w,n[38]=T,n[39]=W,n[40]=y.planModeEnabled,n[41]=K):K=n[41];let Ke;n[42]!==k||n[43]!==We||n[44]!==Ge||n[45]!==G||n[46]!==K?(Ke=(0,_.jsx)(m,{serverScoped:!0,settingKeys:Ue,mixed:k,id:`default-model`,title:`Model`,description:We,status:Ge,resetAction:G,control:K}),n[42]=k,n[43]=We,n[44]=Ge,n[45]=G,n[46]=K,n[47]=Ke):Ke=n[47];let qe=Ke,Je;n[48]===Symbol.for(`react.memo_cache_sentinel`)?(Je=[`defaultThreadEnvMode`],n[48]=Je):Je=n[48];let Ye;n[49]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=g(`new-threads`),n[49]=Ye):Ye=n[49];let Xe=V?`Where new threads in this project start.`:`Where new threads start. Projects and their p4.json can override it.`,q;n[50]!==V||n[51]!==y.defaultThreadEnvMode||n[52]!==b?(q=!V&&y.defaultThreadEnvMode!==null?(0,_.jsx)(h,{label:`default workspace`,onClick:()=>b({defaultThreadEnvMode:null})}):null,n[50]=V,n[51]=y.defaultThreadEnvMode,n[52]=b,n[53]=q):q=n[53];let Ze=N?null:Be?.defaultThreadEnvMode??null,J;n[54]===b?J=n[55]:(J=e=>{(e===`auto`||e===`local`||e===`worktree`)&&b({defaultThreadEnvMode:e})},n[54]=b,n[55]=J);let Y;n[56]===H?Y=n[57]:(Y=(0,_.jsx)(l,{size:`sm`,"aria-label":`Default workspace`,children:(0,_.jsx)(s,{children:e=>e===`auto`||e===`local`||e===`worktree`?p(e):H?`Unavailable`:`Mixed`})}),n[56]=H,n[57]=Y);let Qe;n[58]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,_.jsx)(o,{value:`auto`,children:p(`auto`)}),n[58]=Qe):Qe=n[58];let $e;n[59]===Symbol.for(`react.memo_cache_sentinel`)?($e=(0,_.jsx)(o,{value:`local`,children:p(`local`)}),n[59]=$e):$e=n[59];let et;n[60]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,_.jsxs)(c,{align:`end`,alignItemWithTrigger:!1,children:[Qe,$e,(0,_.jsx)(o,{value:`worktree`,children:p(`worktree`)})]}),n[60]=et):et=n[60];let X;n[61]!==Ze||n[62]!==J||n[63]!==Y?(X=(0,_.jsxs)(u,{value:Ze,onValueChange:J,children:[Y,et]}),n[61]=Ze,n[62]=J,n[63]=Y,n[64]=X):X=n[64];let tt;n[65]!==N||n[66]!==Xe||n[67]!==q||n[68]!==X?(tt=(0,_.jsx)(m,{serverScoped:!0,settingKeys:Je,mixed:N,id:Ye.id,title:`Workspace`,description:Xe,resetAction:q,control:X}),n[65]=N,n[66]=Xe,n[67]=q,n[68]=X,n[69]=tt):tt=n[69];let Z=tt,nt=r===`general`||r===`project`?`project-defaults`:r===`integrations`?`browser-access`:`source-control-defaults`,rt=r===`general`||r===`project`?`New threads`:r===`integrations`?`Browser`:`Repositories`,Q;n[70]!==Ne||n[71]!==r||n[72]!==Be?.worktreeSubmodules||n[73]!==V||n[74]!==B||n[75]!==R||n[76]!==L||n[77]!==Ie||n[78]!==j||n[79]!==F||n[80]!==qe||n[81]!==y.defaultAutoPull||n[82]!==y.defaultRuntimeMode||n[83]!==y.enableAgentBrowserAccess||n[84]!==y.pullRequestMergeMethod||n[85]!==y.removeAgentCreditsOnMerge||n[86]!==y.worktreeSubmodules||n[87]!==H||n[88]!==b||n[89]!==Z?(Q=r===`project`?(0,_.jsxs)(_.Fragment,{children:[qe,Z]}):r===`general`?(0,_.jsxs)(_.Fragment,{children:[qe,(0,_.jsx)(m,{serverScoped:!0,settingKeys:[`defaultRuntimeMode`],mixed:j,...g(`default-permissions`),description:V?`Permissions for new threads in this project.`:`Default permissions for new threads. Projects can override them.`,resetAction:y.defaultRuntimeMode===i.defaultRuntimeMode?null:(0,_.jsx)(h,{label:`default permissions`,onClick:()=>b({defaultRuntimeMode:i.defaultRuntimeMode})}),control:(0,_.jsxs)(u,{value:j?null:y.defaultRuntimeMode,onValueChange:e=>{e&&b({defaultRuntimeMode:e})},children:[(0,_.jsxs)(l,{size:`sm`,"aria-label":`Default permissions`,children:[!j&&(0,_.jsx)(Ne,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,_.jsx)(s,{children:j?`Mixed`:xe[y.defaultRuntimeMode].label})]}),(0,_.jsx)(c,{align:`end`,alignItemWithTrigger:!1,children:be.map(Oe)})]})}),Z,(0,_.jsx)(m,{serverScoped:!0,settingKeys:[`worktreeSubmodules`],mixed:F,...g(`worktree-submodules`),description:V?`How new worktrees in this project populate git submodules.`:`How new worktrees populate git submodules. Projects and their p4.json can override it.`,resetAction:!V&&y.worktreeSubmodules!==null?(0,_.jsx)(h,{label:`worktree submodules`,onClick:()=>b({worktreeSubmodules:null})}):null,control:(0,_.jsxs)(u,{value:F?null:Be?.worktreeSubmodules??null,onValueChange:e=>{we(e)&&b({worktreeSubmodules:e})},children:[(0,_.jsx)(l,{size:`sm`,"aria-label":`Worktree submodules`,children:(0,_.jsx)(s,{children:e=>we(e)?ge[e]:H?`Unavailable`:`Mixed`})}),(0,_.jsx)(c,{align:`end`,alignItemWithTrigger:!1,children:Ce.map(De)})]})})]}):r===`source-control`?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(m,{serverScoped:!0,settingKeys:[`defaultAutoPull`],mixed:R,id:`automatic-pull`,title:`Automatically pull`,description:V?`Keeps this project's default branch current when the checkout has no local changes or commits.`:`Keeps the default branch current when the checkout has no local changes or commits. Projects can override it.`,resetAction:y.defaultAutoPull?(0,_.jsx)(h,{label:`default automatic pull`,tooltip:`Reset automatic pull to off`,onClick:()=>b({defaultAutoPull:!1})}):null,control:(0,_.jsx)(ve,{"aria-label":`Default automatic pull`,mixed:R,checked:!R&&y.defaultAutoPull,onCheckedChange:e=>b({defaultAutoPull:e})})}),(0,_.jsx)(m,{serverScoped:!0,settingKeys:[`removeAgentCreditsOnMerge`],mixed:B,...g(`remove-agent-credits-on-merge`),description:`Remove recognized agent credit lines from GitHub merge and squash messages, keeping human co-authors. Includes auto-merge. Excludes merge queues, stack merges, and existing commits.`,resetAction:y.removeAgentCreditsOnMerge?(0,_.jsx)(h,{label:`agent credit removal`,tooltip:`Keep agent credits`,onClick:()=>b({removeAgentCreditsOnMerge:!1})}):null,control:(0,_.jsx)(ve,{"aria-label":`Remove agent credits when merging`,mixed:B,checked:!B&&y.removeAgentCreditsOnMerge,onCheckedChange:e=>b({removeAgentCreditsOnMerge:e})})}),(0,_.jsx)(m,{serverScoped:!0,settingKeys:[`pullRequestMergeMethod`],mixed:Ie,...g(`pull-request-merge-method`),description:V?`Pull requests in this project start with this method.`:`Pull requests start with this method. Last selected reuses whatever you chose most recently on this device.`,resetAction:y.pullRequestMergeMethod===null?null:(0,_.jsx)(h,{label:`default merge method`,tooltip:`Reset to last selected`,onClick:()=>b({pullRequestMergeMethod:null})}),control:(0,_.jsxs)(u,{value:Ie?null:y.pullRequestMergeMethod??`last`,onValueChange:e=>{e===`last`?b({pullRequestMergeMethod:null}):(e===`merge`||e===`squash`||e===`rebase`)&&b({pullRequestMergeMethod:e})},children:[(0,_.jsx)(l,{size:`sm`,"aria-label":`Default pull request merge method`,children:(0,_.jsx)(s,{children:Ee})}),(0,_.jsxs)(c,{align:`end`,alignItemWithTrigger:!1,children:[(0,_.jsx)(o,{value:`last`,children:`Last selected`}),(0,_.jsx)(o,{value:`merge`,children:d.merge}),(0,_.jsx)(o,{value:`squash`,children:d.squash}),(0,_.jsx)(o,{value:`rebase`,children:d.rebase})]})]})})]}):(0,_.jsx)(_.Fragment,{children:(0,_.jsx)(m,{serverScoped:!0,settingKeys:[`enableAgentBrowserAccess`],mixed:L,id:g(`agent-browser-access`).id,title:`Agent browser access`,description:V?`Allow agents in this project to use the shared browser. Applies when the agent session next starts.`:`Allow agents to use the shared browser. Projects can override it.`,resetAction:y.enableAgentBrowserAccess===i.enableAgentBrowserAccess?null:(0,_.jsx)(h,{label:`default browser access`,onClick:()=>b({enableAgentBrowserAccess:i.enableAgentBrowserAccess})}),control:(0,_.jsx)(ve,{"aria-label":`Agent browser access`,mixed:L,checked:!L&&y.enableAgentBrowserAccess,onCheckedChange:e=>b({enableAgentBrowserAccess:e})})})}),n[70]=Ne,n[71]=r,n[72]=Be?.worktreeSubmodules,n[73]=V,n[74]=B,n[75]=R,n[76]=L,n[77]=Ie,n[78]=j,n[79]=F,n[80]=qe,n[81]=y.defaultAutoPull,n[82]=y.defaultRuntimeMode,n[83]=y.enableAgentBrowserAccess,n[84]=y.pullRequestMergeMethod,n[85]=y.removeAgentCreditsOnMerge,n[86]=y.worktreeSubmodules,n[87]=H,n[88]=b,n[89]=Z,n[90]=Q):Q=n[90];let $;return n[91]!==nt||n[92]!==rt||n[93]!==Q?($=(0,_.jsx)(_e,{id:nt,title:rt,children:Q}),n[91]=nt,n[92]=rt,n[93]=Q,n[94]=$):$=n[94],$}function Ee(e){return e===`merge`||e===`squash`||e===`rebase`?d[e]:e===`last`?`Last selected`:`Mixed`}function De(e){return(0,_.jsx)(o,{value:e,children:ge[e]},e)}function Oe(e){let t=xe[e],ee=t.icon;return(0,_.jsx)(o,{value:e,className:`min-w-64`,children:(0,_.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,_.jsx)(ee,{className:`size-3.5 shrink-0 text-muted-foreground`}),t.label]}),(0,_.jsx)(`span`,{className:`text-xs leading-4 text-muted-foreground`,children:t.description})]})},e)}function ke(){}export{Te as t};
2
- //# sourceMappingURL=ProjectDefaultsSettings-CXY57B72.js.map
@@ -1,6 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,A as r,Em as i,Es as a,F as o,Gn as s,Jo as c,Kn as l,Kp as u,Mf as d,Qn as ee,Rd as f,Yn as p,Zn as te,Zp as m,by as ne,cE as h,ff as g,gd as re,kp as ie,np as ae,or as oe,sr as _,t as se,tr as ce,vd as le,xm as ue}from"./utils-CRwA5SKO.js";import{R as v}from"./runtime-AivVP3k8.js";import{M as de}from"./runtime-BfjHqyQH.js";import{i as fe}from"./toast-BYGWNQVa.js";import{a as y,c as pe,d as me,m as he,n as b,p as ge,t as x,u as _e}from"./tooltip-924Ikq0L.js";import{a as ve,n as ye,r as be,t as xe}from"./DiffFileTree-oPb1WMLR.js";import{n as Se}from"./query-CpOQgkic.js";import{t as S}from"./use-atom-command-BEC7Dpf5.js";import{I as Ce,s as we,v as Te}from"./useSettings-CbuRZg7F.js";import{a as Ee,c as De,d as Oe,i as ke,l as Ae,s as je,u as C}from"./diffRendering-DHxotmCj.js";import{C as Me,D as Ne,E as Pe,I as Fe,N as Ie,O as Le,P as Re,T as ze,w as Be}from"./PanelLayoutControls-CNS9IpqP.js";import{t as Ve}from"./DiffCommentAnnotation-x4D5cVr3.js";import{n as He,t as w}from"./toggle-group-RZD18_sD.js";import{c as Ue,o as We}from"./RenderErrorBoundary-Dkgc28VE.js";import{r as T}from"./pullRequests-DJrYzynz.js";import{N as Ge}from"./pullRequestDetail.logic-rvhEbiFP.js";import{t as Ke}from"./checkbox-DU_a7ZnJ.js";import{i as qe,n as Je,r as Ye,t as Xe}from"./pullRequestReviewStore-wpVYihKr.js";import{Fa as Ze,Ia as Qe,Pa as $e,Ra as et}from"./main-DUXMPAgZ.js";var E=e(t(),1),tt=new Set([`pnpm-lock.yaml`,`yarn.lock`,`package-lock.json`,`bun.lockb`,`Cargo.lock`,`go.sum`,`composer.lock`,`Gemfile.lock`]),nt=new Set([`__snapshots__`,`__generated__`,`dist`,`build`,`vendor`]),rt=new Set([`__tests__`,`tests`,`test`]),it=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`];function at(e){let t=e.split(`/`),n=t.at(-1)??``;return tt.has(n)||n.endsWith(`.snap`)||n.endsWith(`.min.js`)||n.endsWith(`.min.css`)||/\.generated\./.test(n)||t.slice(0,-1).some(e=>nt.has(e))?`generated`:/\.(?:test|spec)\./.test(n)||t.slice(0,-1).some(e=>rt.has(e))?`test`:`source`}function ot(e){let t=e.lastIndexOf(`.`);return t>e.lastIndexOf(`/`)?e.slice(0,t):e}function D(e){return ot(e.split(`/`).at(-1)??``)}function st(e,t){let n=e.split(`/`).slice(0,-1);for(let e of t.split(`/`))e!==`.`&&e!==``&&(e===`..`?n.pop():n.push(e));return n.join(`/`)}var O=/(?:\bfrom|\bimport|\brequire\s*\()\s*\(?\s*["']([^"']+)["']/g;function k(e,t,n,r){let i=new Set;for(let a of t){O.lastIndex=0;let t=O.exec(a);for(;t!==null;){let o=t[1]??``,s=o.startsWith(`.`)?st(e,o):o,c=it.find(e=>s.endsWith(e)),l=c===void 0?s:s.slice(0,-c.length),u=n.get(l)??n.get(`${l}/index`)??r.get(D(l));u!==void 0&&u!==e&&i.add(u),t=O.exec(a)}}return i}function ct(e,t){let n=new Set(e),r=[],i=[...e].sort((e,t)=>e.localeCompare(t));for(;n.size>0;){let e=i.filter(e=>n.has(e)),a=e.find(e=>[...t.get(e)??[]].every(e=>!n.has(e)))??e[0];n.delete(a),r.push(a)}return r}function lt(e){return(e.split(`/`).at(-1)??``).replace(/\.(?:test|spec)\..*$/,``).replace(/\.[^.]+$/,``)}function ut(e){let t=new Map;for(let n of e)t.set(C(n),n);let n=new Map;for(let e of t.keys())n.set(e,at(e));let r=[...t.keys()].filter(e=>n.get(e)===`source`),i=new Map,a=new Set,o=new Map;for(let e of r){i.set(ot(e),e);let t=D(e);o.has(t)&&a.add(t),o.set(t,e)}for(let e of a)o.delete(e);let s=new Map;for(let e of r){let n=t.get(e);s.set(e,k(e,[...n.additionLines,...n.deletionLines],i,o))}let c=ct(r,s),l=new Map;c.forEach((e,t)=>{let n=D(e);l.has(n)||l.set(n,t)});let u=[...t.keys()].filter(e=>n.get(e)===`test`).sort((e,t)=>(l.get(lt(e))??2**53-1)-(l.get(lt(t))??2**53-1)||e.localeCompare(t)),d=[...t.keys()].filter(e=>n.get(e)===`generated`).sort((e,t)=>e.localeCompare(t));return[...c,...u,...d].map(e=>t.get(e))}function dt(e,t,n){return e.hunks.some(e=>t===`left`?n>=e.deletionStart&&n<e.deletionStart+e.deletionCount:n>=e.additionStart&&n<e.additionStart+e.additionCount)}function ft(e,t,n){let r=t===`folded`;return n.has(e)?!r:r}function pt(e,t,n,r){if(ft(e,n,r)===t)return r;let i=new Set(r);return i.has(e)?i.delete(e):i.add(e),i}function A(e){return e===null?null:new Map(e.files.map(e=>[e.path,e.state]))}function j(e){return e===`viewed`}function mt(e){return e===`dismissed`}function ht(e,t,n){return n.get(e)??j(t?.get(e))}function gt(e,t,n){return e.reduce((e,r)=>ht(r,t,n)?e+1:e,0)}function M(e,t,n,r){if(t===null||e.size===0)return e;let i=new Map(e);for(let[a,o]of e)n.has(a)||(r.has(a)||j(t.get(a))===o)&&i.delete(a);return i.size===e.size?e:i}function N(e,t,n){let r=new Map(e);for(let{path:e,viewed:i}of t)n.has(e)&&r.get(e)===i&&r.delete(e);return r.size===e.size?e:r}function _t(e){return[...e].map(([e,t])=>({path:e,viewed:t}))}var P=400,vt=new Map;function yt(e){let{environmentId:t,reference:n,enabled:r,paths:i}=e,a=Se(r?T.filesViewed({environmentId:t,input:n}):null),o=a.refresh,s=(0,E.useMemo)(()=>A(a.data),[a.data]),c=a.data?.truncated===!0,l=a.error,[u,d]=(0,E.useState)(vt),ee=S(T.setFilesViewed,{reportFailure:!1}),f=(0,E.useRef)(new Map),p=(0,E.useRef)(new Map),te=(0,E.useRef)(0),m=(0,E.useRef)(null),ne=`${t} ${n.projectId} ${n.repository} ${n.number}`,h=(0,E.useRef)(ne),g=(0,E.useRef)(new Map),re=(0,E.useRef)(s);re.current=s,(0,E.useEffect)(()=>{let e=new Set([...f.current.keys(),...p.current.keys()]),t=new Set;for(let[n,r]of g.current)e.has(n)||r===s||(t.add(n),g.current.delete(n));d(n=>M(n,s,e,t))},[s]);let ie=(0,E.useCallback)(()=>{m.current=null;let e=_t(f.current);if(e.length===0)return;f.current=new Map;let r=h.current,i=++te.current;for(let t of e)p.current.set(t.path,i);ee({environmentId:t,input:{...n,files:e}}).then(t=>{let n=e.map(e=>e.path).filter(e=>p.current.get(e)===i);for(let e of n)p.current.delete(e);if(h.current===r){if(t._tag===`Failure`){let r=new Set(n.filter(e=>!f.current.has(e)));d(t=>N(t,e,r)),r.size>0&&!v(t)&&fe.add({type:`error`,title:`Could not update viewed files`});return}for(let e of n)g.current.set(e,re.current);o()}})},[t,n,o,ee]),ae=(0,E.useRef)(ie);ae.current=ie,(0,E.useEffect)(()=>{let e=ae.current;return h.current=ne,()=>{m.current!==null&&(clearTimeout(m.current),e()),f.current=new Map,p.current=new Map,g.current=new Map,d(vt)}},[ne]);let oe=(0,E.useRef)(o);oe.current=o;let _=(0,E.useCallback)(()=>oe.current(),[]),se=(0,E.useCallback)((e,t)=>{d(n=>new Map(n).set(e,t)),f.current.set(e,t),m.current!==null&&clearTimeout(m.current),m.current=setTimeout(()=>ae.current(),P)},[]),ce=(0,E.useCallback)(e=>ht(e,s,u),[u,s]),le=(0,E.useCallback)(e=>!u.has(e)&&mt(s?.get(e)),[u,s]),ue=(0,E.useMemo)(()=>gt(i,s,u),[u,i,s]);return(0,E.useMemo)(()=>({enabled:r,isViewed:ce,isStale:le,setViewed:se,viewedCount:ue,truncated:c,error:l,refresh:_}),[r,l,le,ce,_,se,c,ue])}var F=e(h(),1),bt=10,xt=`t3code.pullRequestFileTreeOpen`,St=`
2
- [data-diffs-header] [data-additions-count],
3
- [data-diffs-header] [data-deletions-count] {
4
- display: none !important;
5
- }`,Ct=[];function I({scrollerRef:e,environmentId:t,reference:h,detail:v,selectedCommitOid:tt,onSelectedCommitChange:nt,pendingFinding:rt,fixFindingLabel:it=`Fix in a thread`,onFixFinding:at,onAddToAgentSelection:ot,onRefresh:D,refreshToken:st=0,revealRequest:O=null}){let{resolvedTheme:k}=Ce(),ct=we(),[lt,A]=(0,E.useState)(()=>new Set),[j,mt]=(0,E.useState)(bt),[ht,gt]=(0,E.useState)(null),M=ht??(ct.diffFilesCollapsed?`folded`:`expanded`),N=ct.diffLayout,_t=Te(),[P,vt]=(0,E.useState)(ct.wordWrap),[I,wt]=(0,E.useState)(ct.diffIgnoreWhitespace),[Tt,Et]=a(xt,!1,ne),[Dt,L]=(0,E.useState)(null),[R,z]=(0,E.useState)(null),[Ot,kt]=(0,E.useState)(!1),[At,jt]=(0,E.useState)(!1),[Mt,Nt]=(0,E.useState)({key:``,cursor:null,slices:Ct}),Pt=(0,E.useRef)(new Map),[Ft,It]=(0,E.useState)(null),B=Je(h),V=tt,H=V===null?B:`${B}@${V}`;(0,E.useEffect)(()=>{z(null),L(null),A(new Set),gt(null),mt(bt),jt(!1),Nt({key:H,cursor:null,slices:Ct}),Pt.current.clear()},[H]);let U=Mt.key===H?Mt.slices:Ct,W=Mt.key===H?Mt.cursor:null,G=Se(T.diff({environmentId:t,input:{...h,...W===null?{}:{cursor:W},...V===null?{}:{commit:V}}}));(0,E.useEffect)(()=>{let e=G.data;e!==null&&Nt(t=>{let n=t.key===H?t.slices:Ct,r={cursor:W,patch:e.patch,truncated:e.truncated,nextCursor:e.nextCursor,omittedFileStats:e.omittedFileStats??[]},i=n.findIndex(e=>e.cursor===W);if(i===-1)return{key:H,cursor:W,slices:[...n,r]};let a=n[i];return a!==void 0&&a.patch===r.patch&&a.truncated===r.truncated&&a.nextCursor===r.nextCursor&&a.omittedFileStats.length===r.omittedFileStats.length&&a.omittedFileStats.every((e,t)=>{let n=r.omittedFileStats[t];return n!==void 0&&n.path===e.path&&n.additions===e.additions&&n.deletions===e.deletions})?t:{key:H,cursor:W,slices:[...n.slice(0,i),r]}})},[W,G.data,H]);let Lt=c(T.diff({environmentId:t,input:{...h,...V===null?{}:{commit:V}}})),Rt=B,zt=Ye(h),Bt=qe(e=>e.addComment),Vt=qe(e=>e.removeComment),Ht=S(T.replyToThread,{reportFailure:!1}),Ut=S(T.setThreadResolution,{reportFailure:!1}),Wt=S(T.updateComment,{reportFailure:!1}),Gt=S(T.threadComments,{reportFailure:!1}),Kt=S(T.diffFileContents),qt=(0,E.useMemo)(()=>Ie(Kt,{environmentId:t,reference:h,commit:V,cacheKey:`pull-request:${B}:${v.updatedAt}:${V??`all`}`}),[V,v.updatedAt,t,Kt,h,B]),K=(0,E.useMemo)(()=>{let e=v.capabilities.review,t=v.viewerPermissions;return{inlineComment:e.inlineComment&&t.comment,reply:e.reply&&t.comment,resolve:e.resolve&&t.resolve}},[v.capabilities.review,v.viewerPermissions]),Jt=K.inlineComment&&V===null,q=(0,E.useMemo)(()=>U.map(e=>{let t=`pull-request:${H}:${k}:${I}:${e.cursor??`first`}:${Ee(e.patch)}`,n=Pt.current.get(t);if(n)return n;let r=De(e.patch,t,{compactPartialHunkOffsets:!0,ignoreWhitespace:I});return r&&Pt.current.set(t,r),r}),[U,k,H,I]),J=(0,E.useMemo)(()=>q.flatMap(e=>e?.kind===`files`?ut(e.files):[]),[q]),Yt=(0,E.useMemo)(()=>J.map(e=>C(e)),[J]),Xt=v.capabilities.viewedFiles,Y=yt({environmentId:t,reference:h,enabled:Xt!==void 0,paths:Yt}),{setViewed:Zt,refresh:Qt,enabled:$t,isViewed:en,isStale:tn}=Y,nn=(0,E.useRef)(st);(0,E.useEffect)(()=>{nn.current!==st&&(nn.current=st,Nt({key:H,cursor:null,slices:Ct}),Lt(),Qt())},[st,H,Lt,Qt]);let X=U.at(-1)?.nextCursor??null,rn=U.some(e=>e.truncated)||q.some(e=>e?.kind===`raw`),an=(0,E.useMemo)(()=>{let e=new Set;if(V!==null)return e;for(let t of J){let n=C(t);for(let r of v.reviewThreads)r.path===n&&r.line!==null&&dt(t,r.side,r.line)&&e.add(r.id)}return e},[V,v.reviewThreads,J]),on=(0,E.useMemo)(()=>J.map(e=>{let t=ke(e),n=C(e),r=new Map,i=(e,t)=>{let n=`${e}:${t}`,i=r.get(n);if(i)return i;let a={side:e,line:t,threads:[],pending:[],draft:!1};return r.set(n,a),a};for(let e of v.reviewThreads)e.path===n&&e.line!==null&&an.has(e.id)&&i(e.side,e.line).threads.push(e);if(V===null)for(let e of zt){if(e.path!==n)continue;let t=ze(e.position);i(t.side,t.line).pending.push(e)}if(R?.fileKey===t){let e=ze(R.position);i(e.side,e.line).draft=!0}let a=[...r.values()].map(e=>({side:Pe(e.side),lineNumber:e.line,metadata:{threads:e.threads,pending:e.pending,draft:e.draft}}));return{fileKey:t,path:n,fileDiff:e,annotations:a,annotationsVersion:Ee(a.map(({side:e,lineNumber:t,metadata:n})=>`${e}:${t}:${n.draft?`d`:``}:${n.pending.map(e=>`${e.id}:${e.body}`).join(`,`)}:${n.threads.map(e=>`${e.id}:${e.isResolved?`r`:``}:${e.isOutdated?`o`:``}:${e.comments.map(e=>`${e.id}:${e.author?.login??``}:${e.createdAt}:${e.body}:${(e.reactions??[]).map(e=>`${e.content}:${e.count}:${e.viewerHasReacted?`v`:``}`).join(`,`)}`).join(`;`)}`).join(`,`)}`).join(`|`))}}),[V,v.reviewThreads,R,J,zt,an]),Z=(0,E.useMemo)(()=>on.map(({fileKey:e,path:t,fileDiff:n,annotations:r,annotationsVersion:i})=>{let a=ft(e,M,lt),o=$t?`e${en(t)?`v`:``}${tn(t)?`s`:``}`:``;return{id:e,type:`diff`,fileDiff:n,annotations:r,collapsed:a,version:Ee(`${a?`1`:`0`}:${o}:${i}`)}}),[on,$t,M,en,tn,lt]),sn=(0,E.useMemo)(()=>new Map(U.flatMap(e=>e.omittedFileStats.map(e=>[e.path,e]))),[U]),cn=(0,E.useMemo)(()=>new Map(q.flatMap(e=>e?.kind===`files`?e.files.map((t,n)=>[ke(t),je([e.sourceFiles[n]??t])]):[])),[q]),ln=(0,E.useMemo)(()=>Z.map(e=>e.id),[Z]),un=(0,E.useMemo)(()=>new Set(Z.filter(e=>e.collapsed===!0).map(e=>e.id)),[Z]),dn=be(ln,un),fn=(0,E.useMemo)(()=>ye(J),[J]),pn=X!==null&&X!==W&&!G.isPending&&G.error===null,mn=(0,E.useCallback)(()=>{X!==null&&Nt(e=>({...e,cursor:X}))},[X]),[hn,gn]=(0,E.useState)(null);(0,E.useEffect)(()=>{if(hn===null||!pn)return;let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&mn()},{rootMargin:`240px`});return e.observe(hn),()=>e.disconnect()},[pn,mn,hn]);let Q=(0,E.useCallback)(e=>A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[]),_n=(0,E.useCallback)((e,t,n)=>{Zt(t,n),A(t=>pt(e,n,M,t))},[M,Zt]),vn=ve(Ft,H),yn=(0,E.useCallback)(e=>{let t=Z.find(t=>C(t.fileDiff)===e);t!==void 0&&(t.collapsed===!0&&Q(t.id),vn(t.id))},[Z,vn,Q]),bn=(0,E.useRef)(null);(0,E.useEffect)(()=>{if(O!==null&&bn.current!==O.nonce){if(!Z.some(e=>C(e.fileDiff)===O.path)){pn&&mn();return}bn.current=O.nonce,yn(O.path)}},[pn,Z,mn,yn,O]);let xn=()=>{gt(be(ln,un)?`expanded`:`folded`),A(new Set)},$=(0,E.useMemo)(()=>v.commits.toSorted((e,t)=>Date.parse(t.committedDate)-Date.parse(e.committedDate)),[v.commits]),Sn=(0,E.useCallback)((e,t)=>{if(!e||!Jt)return;let n=t.item;if(n.type!==`diff`)return;let r=J.find(e=>ke(e)===n.id);if(!r)return;let i=C(r),a=Oe(r),s=q.flatMap(e=>e?.kind===`files`?e.sourceFiles:[]).find(e=>C(e)===i),c=e.endSide??e.side,l=(s&&o(s,e.end,c))??o(r,e.end,c);l!==null&&z({fileKey:n.id,path:i,oldPath:a===i?null:a,position:l,range:e})},[Jt,J,q]),Cn=(0,E.useCallback)((e,t,n)=>{let i=J.find(t=>ke(t)===e.fileKey),a=i===void 0?null:r({id:`pull-request-selection:${e.fileKey}:${e.range.start}:${e.range.end}`,sectionId:`pull-request:${v.number}`,sectionTitle:`PR #${v.number} review`,filePath:e.path,fileDiff:i,range:e.range,text:t});z(null),L(null),a!==null&&n(a)},[v.number,J]),wn=(0,E.useCallback)(()=>X===null?null:(0,F.jsx)(`div`,{ref:gn,className:`flex items-center justify-center gap-2 py-2 text-xs text-muted-foreground`,children:G.error===null?G.isPending?`Loading more files...`:null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{children:`The rest of this diff could not be loaded.`}),(0,F.jsx)(_,{size:`xs`,variant:`outline`,onClick:()=>G.refresh(),children:`Retry`})]})}),[X,G.error,G.isPending,G.refresh]),Tn=(0,E.useCallback)(e=>{let t=e.collapsed===!0;return(0,F.jsx)(_,{size:`icon-micro`,variant:`ghost-muted`,"aria-expanded":!t,"aria-label":t?`Expand diff`:`Collapse diff`,className:`mr-1`,onClick:t=>{t.stopPropagation(),Q(e.id)},children:(0,F.jsx)(pe,{className:`size-4`,icon:t?me:_e})})},[Q]),En=(0,E.useRef)(Y);En.current=Y;let Dn=(0,E.useRef)(_n);Dn.current=_n;let On=(0,E.useCallback)(e=>{if(e.type!==`diff`)return null;let{additions:t,deletions:n}=cn.get(e.id)??je([e.fileDiff]),r=C(e.fileDiff);if(t===0&&n===0){let e=sn.get(r);e&&({additions:t,deletions:n}=e)}let i=(0,F.jsx)(We,{additions:t,deletions:n,className:`font-mono text-2xs`}),a=En.current;if(!a.enabled)return i;let o=a.isViewed(r),s=a.isStale(r);return(0,F.jsxs)(`span`,{className:`flex items-center gap-3`,children:[i,(0,F.jsxs)(`label`,{"data-viewed-toggle":``,className:`flex cursor-pointer select-none items-center gap-1.5 text-2xs text-muted-foreground`,onClick:e=>e.stopPropagation(),children:[(0,F.jsx)(Ke,{"aria-label":s?`Changed`:`Viewed`,checked:o,onCheckedChange:t=>Dn.current(e.id,r,t===!0)}),s?(0,F.jsxs)(x,{children:[(0,F.jsx)(y,{render:(0,F.jsx)(`span`,{className:`text-warning-foreground`}),children:`Changed`}),(0,F.jsx)(b,{side:`bottom`,children:`This file has been pushed to since you marked it viewed.`})]}):(0,F.jsx)(`span`,{className:`@max-xs:hidden`,children:`Viewed`})]})]})},[sn,cn]),kn=(0,E.useMemo)(()=>({diffStyle:N===`split`?`split`:`unified`,lineDiffType:`none`,overflow:P?`wrap`:`scroll`,theme:Ae(k),preferredHighlighter:et,themeType:k,stickyHeaders:!0,loadDiffFiles:qt,enableGutterUtility:Jt&&R===null,enableLineSelection:Jt&&R===null,onGutterUtilityClick:Sn,onLineSelectionEnd:Sn}),[N,P,k,qt,Jt,R,Sn]),An=(0,E.useCallback)(async(e,t)=>{if(Ot)return!1;kt(!0);let n=await t();return kt(!1),n._tag===`Failure`?(fe.add({type:`error`,title:e}),!1):(D(),!0)},[D,Ot]),jn=(0,E.useCallback)(e=>(0,F.jsx)(Be,{thread:e,workspaceRoot:v.workspaceRoot,canReply:K.reply,canResolve:K.resolve&&Le(v,e),canReact:v.capabilities.reactions===!0,environmentId:t,reference:h,pending:Ot,fixPending:rt===Ge({kind:`thread`,thread:e}),fixLabel:it,...at?{onFix:()=>at({kind:`thread`,thread:e})}:{},onLoadMore:async n=>{let r=await Gt({environmentId:t,input:{...h,threadId:e.id,cursor:n}});return r._tag===`Failure`?(fe.add({type:`error`,title:`More comments could not be loaded`}),null):r.value},onReply:n=>An(`Reply could not be posted`,()=>Ht({environmentId:t,input:{...h,threadId:e.id,body:n}})),canEditComment:e=>Ne(v,{author:e.author,kind:`review-comment`,canEdit:e.canEdit}),onEditComment:(e,n)=>An(`The comment could not be saved`,()=>Wt({environmentId:t,input:{...h,commentId:e,kind:`review-comment`,body:n}})),onToggleResolved:()=>void An(`The conversation could not be updated`,()=>Ut({environmentId:t,input:{...h,threadId:e.id,resolved:!e.isResolved}})),onReacted:D},`${h.projectId}#${h.number}:${e.id}`),[v,t,it,Gt,D,at,rt,h,Ht,K.reply,K.resolve,An,Ut,Ot,Wt]),Mn=(0,E.useCallback)(e=>(0,F.jsxs)(`div`,{className:`py-1 font-sans text-foreground`,children:[e.metadata.threads.map(jn),e.metadata.pending.map(e=>(0,F.jsx)(Me,{comment:e,onRemove:()=>Vt(Rt,e.id)},e.id)),e.metadata.draft&&R?(0,F.jsx)(Ve,{kind:`draft`,rangeLabel:`${R.path}:${ze(R.position).line}`,text:``,submitLabel:`Add to review`,...ot?{secondaryAction:{label:`Add to agent`,onAction:e=>Cn(R,e,t=>ot({comment:t,request:e}))}}:{},onCancel:()=>{z(null),L(null)},onComment:e=>{Bt(Rt,{id:Xe(),path:R.path,...R.oldPath===null?{}:{oldPath:R.oldPath},position:R.position,body:e}),z(null),L(null)}}):null]}),[Bt,R,Cn,ot,Vt,jn,Rt]),Nn=$.find(e=>e.oid===V);(0,E.useEffect)(()=>{V!==null&&Nn===void 0&&nt(null)},[V,nt,Nn]);let Pn=Nn?Nn.messageHeadline:`All commits`,Fn=e=>{wt(e),z(null),L(null)},In=(0,F.jsxs)(`div`,{className:`@container flex h-10 min-h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 bg-background px-4 text-xs text-muted-foreground`,children:[(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[$.length>0?(0,F.jsxs)(s,{children:[(0,F.jsxs)(oe,{render:(0,F.jsx)(_,{size:`xs`,variant:`secondary`}),className:`min-w-0 max-w-64`,"aria-label":`Diff scope: ${Pn}`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:Pn}),(0,F.jsx)(re,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,F.jsxs)(te,{align:`start`,className:`max-w-[min(28rem,calc(100vw-2rem))]`,children:[(0,F.jsxs)(ee,{value:V??`all`,onValueChange:e=>nt(e===`all`?null:e),children:[(0,F.jsx)(n,{value:`all`,closeOnClick:!0,children:(0,F.jsx)(`span`,{children:`All commits`})}),$.slice(0,j).map(e=>(0,F.jsx)(n,{value:e.oid,closeOnClick:!0,children:(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(x,{children:[(0,F.jsx)(y,{render:(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:e.messageHeadline})}),(0,F.jsx)(b,{side:`top`,children:e.messageHeadline})]}),(0,F.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-xs text-muted-foreground`,children:e.oid.slice(0,7)})]})},e.oid))]}),$.length>j?(0,F.jsx)(p,{closeOnClick:!1,onClick:()=>mt(e=>e+bt),children:(0,F.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Show more (`,$.length-j,` left)`]})}):null]})]}):null,(0,F.jsxs)(Ue,{children:[(0,F.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[J.length,` `,J.length===1?`file`:`files`,X===null?``:`+`]}),Y.enabled&&J.length>0?(0,F.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 tabular-nums`,children:[(0,F.jsxs)(`span`,{className:`shrink-0`,children:[Y.viewedCount,` / `,J.length]}),(0,F.jsx)(`span`,{className:`truncate`,children:Xt===`environment`?`viewed in ${de}`:`viewed`}),Xt===`environment`?(0,F.jsxs)(x,{children:[(0,F.jsx)(y,{render:(0,F.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,F.jsx)(d,{"aria-label":`These ticks are kept here, not on the host`,className:`text-muted-foreground size-3.5`})}),(0,F.jsx)(b,{side:`bottom`,children:`This host keeps no shared record of which files you have read, so these ticks are kept by this environment. They follow you between the apps connected to it, but the host's own web UI will not show them.`})]}):null,Y.error===null?null:(0,F.jsxs)(x,{children:[(0,F.jsx)(y,{render:(0,F.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,F.jsx)(i,{"aria-label":`Your ticks could not be read`,className:`size-3.5 text-warning-foreground`})}),(0,F.jsxs)(b,{side:`bottom`,children:[`The boxes below are whatever was last read, and empty if nothing has been read yet. `,Y.error]})]}),Y.truncated?(0,F.jsxs)(x,{children:[(0,F.jsx)(y,{render:(0,F.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,F.jsx)(i,{"aria-label":`This count covers only part of the change`,className:`size-3.5 text-warning-foreground`})}),(0,F.jsx)(b,{side:`bottom`,children:`This change has more files than the host will report ticks for in one read, so the count is short and some boxes below start empty.`})]}):null]}):null,rn?(0,F.jsxs)(x,{children:[(0,F.jsx)(y,{render:(0,F.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,F.jsx)(i,{"aria-label":`Some of this diff was not shown`,className:`size-3.5 text-warning-foreground`})}),(0,F.jsx)(b,{side:`bottom`,children:`The host withheld part of this diff — a binary file, or a change too large to inline.`})]}):null,V!==null&&K.inlineComment?(0,F.jsxs)(x,{children:[(0,F.jsx)(y,{render:(0,F.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,F.jsx)(ae,{"aria-label":`Line comments are written from the whole change`,className:`size-3.5`})}),(0,F.jsx)(b,{side:`bottom`,children:`A comment is anchored to the whole change, so switch to All commits to write one.`})]}):null]})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,F.jsxs)(s,{children:[(0,F.jsxs)(x,{children:[(0,F.jsx)(y,{render:(0,F.jsx)(oe,{render:(0,F.jsx)(_,{size:`icon-sm`,variant:`ghost`}),className:`@lg:hidden`,"aria-label":`Diff options`}),children:(0,F.jsx)(m,{className:`size-3.5`})}),(0,F.jsx)(b,{side:`top`,children:`Diff options`})]}),(0,F.jsxs)(te,{align:`end`,children:[(0,F.jsx)(l,{checked:I,onCheckedChange:e=>Fn(e),children:`Hide whitespace changes`}),(0,F.jsx)(l,{checked:P,onCheckedChange:e=>vt(e),children:`Wrap lines`}),(0,F.jsx)(ce,{}),(0,F.jsxs)(ee,{value:N,onValueChange:e=>{(e===`stacked`||e===`split`)&&_t({diffLayout:e})},children:[(0,F.jsx)(n,{value:`stacked`,closeOnClick:!0,children:`Stacked`}),(0,F.jsx)(n,{value:`split`,closeOnClick:!0,children:`Split`})]})]})]}),(0,F.jsxs)(`div`,{className:`hidden items-center gap-1 @lg:flex`,children:[(0,F.jsxs)(x,{children:[(0,F.jsx)(y,{render:(0,F.jsx)(w,{"aria-label":I?`Show whitespace changes`:`Hide whitespace changes`,variant:`ghost`,size:`sm`,pressed:I,onPressedChange:e=>Fn(!!e)}),children:(0,F.jsx)(ie,{className:`size-3.5`})}),(0,F.jsx)(b,{side:`top`,children:I?`Show whitespace changes`:`Hide whitespace changes`})]}),(0,F.jsxs)(He,{"aria-label":`Diff layout`,className:`shrink-0`,variant:`segmented`,value:[N],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&_t({diffLayout:t})},children:[(0,F.jsx)(w,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,F.jsx)(u,{className:`size-3.5`})}),(0,F.jsx)(w,{"aria-label":`Split diff view`,value:`split`,children:(0,F.jsx)(f,{className:`size-3.5`})})]}),(0,F.jsxs)(x,{children:[(0,F.jsx)(y,{render:(0,F.jsx)(w,{"aria-label":P?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`ghost`,size:`sm`,pressed:P,onPressedChange:e=>{vt(!!e)}}),children:(0,F.jsx)(ue,{className:`size-3.5`})}),(0,F.jsx)(b,{side:`top`,children:P?`Disable line wrapping`:`Enable line wrapping`})]})]}),ln.length>0?(0,F.jsx)(_,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":dn?`Expand all files`:`Collapse all files`,onClick:xn,children:(0,F.jsx)(pe,{className:`size-3.5`,icon:dn?he:ge})}):null,ln.length>0?(0,F.jsxs)(x,{children:[(0,F.jsx)(y,{render:(0,F.jsx)(w,{"aria-label":Tt?`Hide file tree`:`Show file tree`,variant:`ghost`,size:`sm`,pressed:Tt,onPressedChange:e=>Et(!!e)}),children:(0,F.jsx)(g,{className:`size-3.5`})}),(0,F.jsx)(b,{side:`top`,children:Tt?`Hide file tree`:`Show file tree`})]}):null]})]}),Ln=t=>(0,F.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[In,(0,F.jsx)(`div`,{ref:e,className:`min-h-0 flex-1 overflow-auto`,children:t})]});if(G.isPending&&U.length===0)return Ln((0,F.jsx)(Fe,{label:`Loading pull request diff...`}));if(G.error&&U.length===0)return Ln((0,F.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:G.error}));let Rn=X===null?q.flatMap(e=>e?.kind===`raw`?[e]:[]):[];if(J.length===0&&Rn.length>0)return Ln((0,F.jsx)(`div`,{className:`space-y-4 px-4 py-5`,children:Rn.map(e=>(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,F.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))}));if(Z.length===0&&X===null)return Ln((0,F.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:V===null?`This pull request has no file changes.`:`This commit has no file changes.`}));let zn=v.reviewThreads.filter(e=>!an.has(e.id)),Bn=new Map;for(let e of zn){let t=Bn.get(e.path);t?t.push(e):Bn.set(e.path,[e])}let Vn=Rn.length===0?null:(0,F.jsx)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-5`,children:Rn.map(e=>(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,F.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))});return(0,F.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[In,Bn.size>0?(0,F.jsx)(`div`,{className:`shrink-0 border-b border-border/60`,children:(0,F.jsxs)($e,{open:At,onOpenChange:jt,children:[(0,F.jsx)(`h2`,{children:(0,F.jsxs)(Qe,{className:`flex w-full items-center gap-1.5 px-4 py-2 text-left text-xs text-muted-foreground`,children:[(0,F.jsx)(`span`,{children:X===null?`Conversations not on the current diff`:`Conversations not on the diff loaded so far`}),(0,F.jsx)(le,{"aria-hidden":!0,className:se(`size-3.5 transition-transform`,At&&`rotate-90`)}),(0,F.jsx)(`span`,{"aria-hidden":!0,className:`tabular-nums`,children:zn.length}),(0,F.jsx)(`span`,{className:`sr-only`,children:zn.length===1?`1 conversation`:`${zn.length} conversations`})]})}),(0,F.jsx)(Ze,{children:(0,F.jsx)(`div`,{className:`max-h-64 space-y-3 overflow-auto px-4 pb-3`,children:[...Bn].map(([e,t])=>(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(x,{children:[(0,F.jsx)(y,{render:(0,F.jsx)(`p`,{className:`truncate px-3 text-xs text-muted-foreground`,children:e})}),(0,F.jsx)(b,{side:`top`,children:e})]}),(0,F.jsx)(`div`,{className:`mt-1 space-y-2`,children:t.map(e=>(0,F.jsxs)(`div`,{children:[e.line===null?null:(0,F.jsxs)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:[`Line `,e.line]}),jn(e)]},e.id))})]},e))})})]})}):null,(0,F.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,F.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1`,onClickCapture:e=>{let t=e.nativeEvent.composedPath?.()??[];for(let e of t)if(e instanceof HTMLElement){if(e instanceof HTMLButtonElement||e instanceof HTMLAnchorElement||e.hasAttribute(`data-viewed-toggle`))return;if(e.hasAttribute(`data-diffs-header`)){let t=e.querySelector(`[data-title]`)?.textContent?.trim();if(t===void 0||t===``)return;let n=Z.find(e=>C(e.fileDiff)===t);n!==void 0&&Q(n.id);return}}},children:(0,F.jsx)(Re,{className:`@container h-full overflow-auto [scrollbar-gutter:stable]`,containerRef:e,viewerRef:It,items:Z,selectedLines:Dt,onSelectedLinesChange:L,options:kn,renderCodeViewFooter:wn,renderHeaderPrefix:Tn,renderHeaderMetadata:On,renderAnnotation:Mn,onRevealSearchMatch:e=>A(t=>pt(e.id,!1,M,t)),unsafeCSSExtra:St})}),Tt?(0,F.jsx)(`aside`,{className:`flex w-[min(20rem,40%)] min-w-48 shrink-0 border-l border-border/60`,children:(0,F.jsx)(xe,{ariaLabel:`Pull request #${v.number} files`,entries:fn,onSelectFile:yn,footer:X===null?null:(0,F.jsx)(`div`,{className:`shrink-0 border-t border-border/60 p-2`,children:(0,F.jsx)(_,{type:`button`,size:`xs`,variant:`outline`,className:`w-full`,disabled:G.isPending,onClick:G.error===null?mn:()=>G.refresh(),children:G.error===null?G.isPending?`Loading more files...`:`Load more files`:`Retry`})})})}):null]}),Vn]})}export{I as default};
6
- //# sourceMappingURL=PullRequestCodeTab-ClHfRIZg.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$i as n,$r as r,An as i,Ar as a,Bn as o,Br as s,Ca as c,Cn as l,Cr as u,Da as d,Di as f,Dr as p,Ei as m,En as h,Eo as g,Er as _,Fa as v,Hn as y,Ia as b,Ln as x,Ma as S,Mn as C,Na as w,Nn as ee,Oa as te,Oi as T,On as E,Or as D,Pi as O,Pr as k,Ra as A,Ri as j,So as M,Tn as N,To as P,Tr as F,Un as I,Va as ne,Vn as re,Xi as ie,Zr as L,_o as R,ai as z,bi as B,bn as V,br as H,cE as ae,da as oe,ea as se,ei as U,ga as ce,ia as le,io as ue,jn as de,jr as fe,ki as pe,kn as me,ma as W,na as G,po as K,ta as he,to as q,ui as ge,uo as _e,vo as J,vr as ve,wn as Y,wo as ye,xa as be,xo as xe,xr as Se,ya as Ce,yi as we,yo as Te}from"./utils-CRwA5SKO.js";import{d as Ee}from"./TooltipViewport-Wc_QpRGI.js";import{t as De}from"./useRegisterFieldControl-Bmw-33lq.js";import{t as Oe}from"./FormContext-DTtr4Y3v.js";import{a as X,i as ke,n as Ae,r as je,t as Me}from"./CSPContext-D8hlJ4eS.js";var Z=e(t()),Q=e(ae());function Ne(e){let{id:t,value:a,defaultValue:s=null,onValueChange:l,open:u,defaultOpen:d=!1,onOpenChange:p,name:m,form:g,autoComplete:_,disabled:y=!1,readOnly:S=!1,required:C=!1,modal:w=!0,actionsRef:te,inputRef:E,onOpenChangeComplete:D,items:O,multiple:k=!1,itemToStringLabel:A,itemToStringValue:j,isItemEqualToValue:F=me,highlightItemOnHover:I=!0,children:ie}=e,{clearErrors:L}=Oe(),{setDirty:R,setTouched:ae,setFocused:oe,shouldValidateOnChange:le,validityData:de,setFilled:fe,name:pe,disabled:W,validation:K,validationMode:he}=x(),q=ee({id:t}),_e=W||y,J=pe??m,[Y,be]=ne({controlled:a,default:k?s??xe:s,name:`Select`,state:`value`}),[X,Ae]=ne({controlled:u,default:d,name:`Select`,state:`open`}),Me=Z.useRef([]),Ne=Z.useRef([]),Pe=Z.useRef(null),Fe=Z.useRef(null),Ie=Z.useRef(0),Le=Z.useRef(null),Re=Z.useRef([]),ze=Z.useRef(!1),Be=Z.useRef(!1),Ve=Z.useRef(null),He=Z.useRef(null),Ue=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),We=Z.useRef(!1),{mounted:Ge,setMounted:Ke,transitionStatus:qe}=Ce(X),{openMethod:Je,triggerProps:Ye}=ve(X),$=P(()=>new we({id:q,labelId:void 0,modal:w,multiple:k,itemToStringLabel:A,itemToStringValue:j,isItemEqualToValue:F,value:Y,open:X,mounted:Ge,transitionStatus:qe,items:O,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Xe=B($,V.activeIndex),Ze=B($,V.selectedIndex),Qe=B($,V.triggerElement),$e=B($,V.positionerElement),et=Ee(Je),tt=Je??et,nt=Z.useMemo(()=>k&&Array.isArray(Y)&&Y.length===0?``:h(Y,j),[k,Y,j]),rt=Z.useMemo(()=>k&&Array.isArray(Y)?Y.map(e=>h(e,j)):h(Y,j),[k,Y,j]),it=G($.state.triggerElement),at=b(()=>rt);De(it,q,Y,at);let ot=Z.useRef(Y),st=k?Array.isArray(Y)&&Y.length>0:Y!=null;v(()=>{Y!==ot.current&&$.set(`forceMount`,!0)},[$,Y]),v(()=>{fe(st)},[st,fe]),v(function(){let e=Re.current,t;if(k){let n=Array.isArray(Y)?Y:[];if(n.length===0)t=null;else{let r=n[n.length-1],a=i(e,r,F);t=a===-1?null:a}}else{let n=i(e,Y,F);t=n===-1?null:n}t===null&&(He.current=null),!X&&$.set(`selectedIndex`,t)},[st,k,X,Y,Re,F,$,He]),H(Y,()=>{L(J),R(Y!==de.initialValue),le()?K.commit(Y):K.commit(Y,!0)});let ct=b((e,t)=>{if(p?.(e,t),!t.isCanceled&&(Ae(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(ae(!0),oe(!1),he===`onBlur`&&K.commit(Y)),!e&&$.state.activeIndex!==null)){let e=Me.current[$.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),lt=b(()=>{Ke(!1),$.update({activeIndex:null,openMethod:null}),D?.(!1)});ce({enabled:!te,open:X,ref:Pe,onComplete(){X||lt()}}),Z.useImperativeHandle(te,()=>({unmount:lt}),[lt]);let ut=b((e,t)=>{l?.(e,t),!t.isCanceled&&be(e)}),dt=b(()=>{let e=$.state.listElement||Pe.current;if(!e)return;let t=je(e.scrollHeight,e.clientHeight),n=ke(e.scrollTop,t),r=n>0,i=n<t;$.state.scrollUpArrowVisible!==r&&$.set(`scrollUpArrowVisible`,r),$.state.scrollDownArrowVisible!==i&&$.set(`scrollDownArrowVisible`,i)}),ft=z({open:X,onOpenChange:ct,elements:{reference:Qe,floating:$e}}),pt=T(ft,{enabled:!S&&!_e,event:`mousedown`}),mt=f(ft),ht=U(ft,{enabled:!S&&!_e,listRef:Me,activeIndex:Xe,selectedIndex:Ze,disabledIndices:xe,onNavigate(e){(e!==null||X)&&$.set(`activeIndex`,e)},focusItemOnHover:I}),gt=r(ft,{enabled:!S&&!_e&&(X||!k),listRef:Ne,activeIndex:Xe,selectedIndex:Ze,onMatch(e){X?$.set(`activeIndex`,e):ut(Re.current[e],c(`none`))},onTyping(e){ze.current=e}}),_t=Z.useMemo(()=>{let e=Te(gt.reference,ht.reference,mt.reference,pt.reference,Ye);return q&&(e.id=q),e},[pt.reference,gt.reference,ht.reference,mt.reference,Ye,q]),vt=Z.useMemo(()=>Te(ge,gt.floating,ht.floating,mt.floating),[gt.floating,ht.floating,mt.floating]),yt=ht.item??M;Se(()=>{$.update({popupProps:vt,triggerProps:_t})}),v(()=>{$.update({id:q,modal:w,multiple:k,value:Y,open:X,mounted:Ge,transitionStatus:qe,popupProps:vt,triggerProps:_t,items:O,itemToStringLabel:A,itemToStringValue:j,isItemEqualToValue:F,openMethod:tt})},[$,q,w,k,Y,X,Ge,qe,vt,_t,O,A,j,F,tt]);let bt=Z.useMemo(()=>({store:$,name:J,required:C,disabled:_e,readOnly:S,multiple:k,highlightItemOnHover:I,setValue:ut,setOpen:ct,listRef:Me,popupRef:Pe,scrollHandlerRef:Fe,handleScrollArrowVisibility:dt,scrollArrowsMountedCountRef:Ie,itemProps:yt,events:ft.context.events,valueRef:Le,valuesRef:Re,labelsRef:Ne,typingRef:ze,selectionRef:Ue,firstItemTextRef:Ve,selectedItemTextRef:He,validation:K,onOpenChangeComplete:D,keyboardActiveRef:Be,alignItemWithTriggerActiveRef:We,initialValueRef:ot}),[$,J,C,_e,S,k,I,ut,ct,yt,ft.context.events,K,D,dt]),xt=ye(E,K.inputRef),St=k&&Array.isArray(Y)&&Y.length>0,Ct=k?void 0:J,wt=Z.useMemo(()=>!k||!Array.isArray(Y)||!J?null:Y.map(e=>{let t=h(e,j);return(0,Q.jsx)(`input`,{type:`hidden`,form:g,name:J,value:t},t)}),[k,Y,g,J,j]);return(0,Q.jsx)(re.Provider,{value:bt,children:(0,Q.jsxs)(o.Provider,{value:ft,children:[ie,(0,Q.jsx)(`input`,{...K.getInputValidationProps({onFocus(){$.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||_e||S){e.preventBaseUIHandler?.();return}let t=e.currentTarget.value,n=c(ue,e.nativeEvent);function r(){if(k)return;let e=Re.current.find(e=>h(e,j).toLowerCase()===t.toLowerCase()||N(e,A).toLowerCase()===t.toLowerCase());e!=null&&(R(e!==de.initialValue),ut(e,n),le()&&K.commit(e))}$.set(`forceMount`,!0),queueMicrotask(r)}}),id:q&&Ct==null?`${q}-hidden-input`:void 0,form:g,name:Ct,autoComplete:_,value:nt,disabled:_e,required:C&&!St,readOnly:S,ref:xt,style:J?se:n,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),wt]})})}var Pe={value:()=>null},Fe=Z.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:u}=I(),d=B(c,V.value),f=B(c,V.items),p=B(c,V.itemToStringLabel),m=B(c,V.hasSelectedValue),h=!m&&a!=null&&i==null,g=B(c,V.hasNullItemLabel,h),_={value:d,placeholder:!m},v=null;return v=typeof i==`function`?i(d):i??(!m&&a!=null&&!g?a:Array.isArray(d)?l(d,f,p):Y(d,f,p)),J(`span`,e,{state:_,ref:[t,u],props:[{children:v},s],stateAttributesMapping:Pe})}),Ie=Z.createContext(void 0),Le=Z.forwardRef(function(e,t){let{store:n}=I(),r=B(n,V.mounted),i=B(n,V.forceMount);return r||i?(0,Q.jsx)(Ie.Provider,{value:!0,children:(0,Q.jsx)(O,{ref:t,...e})}):null}),Re=Z.createContext(void 0);function ze(){let e=Z.useContext(Re);if(!e)throw Error(g(59));return e}function Be(e,t){e&&Object.assign(e.style,t)}var Ve={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},He={position:`fixed`},Ue=Z.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:a,render:o,side:s=`bottom`,align:l=`center`,sideOffset:d=0,alignOffset:f=0,collisionBoundary:m=`clipping-ancestors`,collisionPadding:h,arrowPadding:g=5,sticky:x=!1,disableAnchorTracking:S,alignItemWithTrigger:w=!0,collisionAvoidance:ee=j,style:te,...T}=e,{store:E,listRef:O,labelsRef:k,alignItemWithTriggerActiveRef:A,selectedItemTextRef:M,valuesRef:N,initialValueRef:P,popupRef:ne,setValue:re}=I(),ie=y(),L=B(E,V.open),R=B(E,V.mounted),z=B(E,V.modal),H=B(E,V.value),ae=B(E,V.openMethod),oe=B(E,V.positionerElement),se=B(E,V.triggerElement),U=B(E,V.isItemEqualToValue),ce=B(E,V.transitionStatus),le=Z.useRef(null),de=Z.useRef(null),[pe,me]=Z.useState(w),W=R&&pe&&ae!==`touch`;!R&&pe!==w&&me(w),v(()=>{R||(V.scrollUpArrowVisible(E.state)&&E.set(`scrollUpArrowVisible`,!1),V.scrollDownArrowVisible(E.state)&&E.set(`scrollDownArrowVisible`,!1))},[E,R]),Z.useImperativeHandle(A,()=>W),u((W||z)&&L,ae===`touch`,oe,se);let G=D({anchor:n,floatingRootContext:ie,positionMethod:r,mounted:R,side:s,sideOffset:d,align:l,alignOffset:f,arrowPadding:g,collisionBoundary:m,collisionPadding:h,sticky:x,disableAnchorTracking:S??W,collisionAvoidance:ee,keepMounted:!0}),K=W?`none`:G.side,he=W?He:G.positionerStyles,q={open:L,side:K,align:G.align,anchorHidden:G.anchorHidden};v(()=>{E.set(`popupSide`,G.side)},[E,G.side]);let ge=b(e=>{E.set(`positionerElement`,e)}),_e=F(e,q,{styles:he,transitionStatus:ce,props:T,refs:[t,ge],hidden:!R,inert:!L}),J=Z.useRef(0),ve=b(e=>{if(e.size===0&&J.current===0||N.current.length===0)return;let t=J.current;if(J.current=e.size,e.size===t)return;let n=c(ue);if(t!==0&&!E.state.multiple&&H!==null&&i(N.current,H,U)===-1){let e=P.current,t=e!=null&&i(N.current,e,U)!==-1?e:null;re(t,n),t===null&&(E.set(`selectedIndex`,null),M.current=null)}if(t!==0&&E.state.multiple&&Array.isArray(H)){let e=e=>i(N.current,e,U)!==-1,t=H.filter(t=>e(t));(t.length!==H.length||t.some(e=>!C(H,e,U)))&&(re(t,n),t.length===0&&(E.set(`selectedIndex`,null),M.current=null))}if(L&&W){E.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};Be(oe,e),Be(ne.current,e)}}),Y=Z.useMemo(()=>({...G,side:K,alignItemWithTriggerActive:W,setControlledAlignItemWithTrigger:me,scrollUpArrowRef:le,scrollDownArrowRef:de}),[G,K,W,me]);return(0,Q.jsx)(p,{elementsRef:O,labelsRef:k,onMapChange:ve,children:(0,Q.jsxs)(Re.Provider,{value:Y,children:[R&&z&&(0,Q.jsx)(_,{inert:fe(!L),cutout:se}),_e]})})}),We={...K,...R},Ge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:o,...l}=e,{store:u,popupRef:d,onOpenChangeComplete:f,setOpen:p,valueRef:m,firstItemTextRef:h,selectedItemTextRef:g,keyboardActiveRef:_,multiple:x,handleScrollArrowVisibility:C,scrollHandlerRef:w,listRef:ee,highlightItemOnHover:te}=I(),{side:T,align:E,alignItemWithTriggerActive:D,isPositioned:O,setControlledAlignItemWithTrigger:j,scrollDownArrowRef:M,scrollUpArrowRef:N}=ze(),P=L(!0)!=null,F=y(),ne=a(),{nonce:re,disableStyleElements:ie}=Me(),R=B(u,V.id),z=B(u,V.open),H=B(u,V.mounted),ae=B(u,V.popupProps),oe=B(u,V.transitionStatus),se=B(u,V.triggerElement),U=B(u,V.positionerElement),ue=B(u,V.listElement),de=Z.useRef(!1),fe=Z.useRef(!1),me=Z.useRef({}),W=be(),G=b(e=>{if(!U||!d.current||!fe.current)return;if(de.current||!D){C();return}let t=U.style.top===`0px`,n=U.style.bottom===`0px`;if(!t&&!n){C();return}let r=Je(U),i=Ye(U.getBoundingClientRect().height,`y`,r),a=he(U),o=getComputedStyle(U),s=parseFloat(o.marginTop),c=parseFloat(o.marginBottom),l=Ke(getComputedStyle(d.current)),u=Math.min(a.documentElement.clientHeight-s-c,l),f=e.scrollTop,p=qe(e),m=0,h=null,g=!1,_=!1,v=e=>{U.style.height=`${e}px`},y=(t,n)=>{let r=X(t,0,u-i);r>0&&v(i+r),e.scrollTop=n,u-(i+r)<=1&&(de.current=!0),C()},b=t?p-f:f,x=Math.min(i+b,u);if(m=x,b<=1){y(b,t?p:0);return}if(u-x>1?t?_=!0:h=0:(g=!0,n&&f<p&&(h=f-(b-(i+b-u)))),m=Math.ceil(m),m!==0&&v(m),_||h!=null){let t=qe(e),n=_?t:X(h,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(g||m>=u-1)&&(de.current=!0),C()});Z.useImperativeHandle(w,()=>G,[G]),ce({open:z,ref:d,onComplete(){z&&f?.(!0)}});let K={open:z,transitionStatus:oe,side:T,align:E};v(()=>{U&&d.current&&!Object.keys(me.current).length&&(me.current={top:U.style.top||`0`,left:U.style.left||`0`,right:U.style.right,height:U.style.height,bottom:U.style.bottom,minHeight:U.style.minHeight,maxHeight:U.style.maxHeight,marginTop:U.style.marginTop,marginBottom:U.style.marginBottom})},[d,U]),v(()=>{z||D||(fe.current=!1,de.current=!1,Be(U,me.current))},[z,D,U,d]),v(()=>{let e=d.current;if(!z||!se||!U||!e||D&&!O||u.state.transitionStatus===`ending`)return;if(!D){fe.current=!0,W.request(C),e.style.removeProperty(`--transform-origin`);return}let t=Ze(e);e.style.removeProperty(`--transform-origin`);try{let t=g.current;t?.isConnected||(t=!V.hasSelectedValue(u.state)&&h.current?.isConnected?h.current:null);let n=m.current,r=getComputedStyle(U),i=getComputedStyle(e),a=he(se),o=A(U),s=Je(se),c=$(se.getBoundingClientRect(),s),l=$(U.getBoundingClientRect(),s),d=c.height,f=ue||e,p=f.scrollHeight,_=parseFloat(i.borderBottomWidth),v=parseFloat(r.marginTop)||10,y=parseFloat(r.marginBottom)||10,b=parseFloat(r.minHeight)||100,x=Ke(i),w=a.documentElement.clientHeight-v-y,T=a.documentElement.clientWidth,E=w-c.bottom+d,D,O=ne===`rtl`?c.right-l.width:c.left,k=0;if(t&&n){let e=$(n.getBoundingClientRect(),s);D=$(t.getBoundingClientRect(),s),O=l.left+(ne===`rtl`?e.right-D.right:e.left-D.left);let r=e.top-c.top+e.height/2;k=D.top-l.top+D.height/2-r}let M=E+k+y+_,N=Math.min(w,M),P=w-v-y,F=M-N,I=T-5;U.style.left=`${X(O,5,I-l.width)}px`,U.style.height=`${N}px`,U.style.maxHeight=`auto`,U.style.marginTop=`${v}px`,U.style.marginBottom=`${y}px`,e.style.height=`100%`;let re=qe(f),ie=F>=re-1;ie&&(N=Math.min(w,l.height)-(F-re));let L=c.top<20||c.bottom>w-20||Math.ceil(N)+1<Math.min(p,b),R=(o.visualViewport?.scale??1)!==1&&S;if(L||R){fe.current=!0,Be(U,me.current),j(!1);return}let z=Math.max(b,N);if(ie){let e=Math.max(0,w-M);U.style.top=l.height>=P?`0`:`${e}px`,U.style.height=`${N}px`,f.scrollTop=qe(f)}else U.style.bottom=`0`,f.scrollTop=F;if(D){let t=l.top,n=l.height,r=D.top+D.height/2,i=n>0?(r-t)/n*100:50,a=X(i,0,100);e.style.setProperty(`--transform-origin`,`50% ${a}%`)}(z===w||N>=x)&&(de.current=!0),C(),te&&u.state.selectedIndex===null&&u.state.activeIndex===null&&ee.current[0]!=null&&u.set(`activeIndex`,0),fe.current=!0}finally{t()}},[u,z,U,se,m,h,g,d,C,D,j,W,M,N,ue,ee,te,ne,O]),Z.useEffect(()=>{if(!D||!U||!z)return;let e=A(U);function t(e){p(!1,c(_e,e))}return le(e,`resize`,t)},[p,D,U,z]);let q={...ue?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":x||void 0,id:`${R}-list`},onKeyDown(e){_.current=!0,P&&s.has(e.key)&&e.stopPropagation()},onMouseMove(){_.current=!1},onScroll(e){ue||G(e.currentTarget)},...D&&{style:ue?{height:`100%`}:Ve}},ge=J(`div`,e,{ref:[t,d],state:K,stateAttributesMapping:We,props:[ae,q,k(oe),{className:!ue&&D?Ae.className:void 0},l]});return(0,Q.jsxs)(Z.Fragment,{children:[!ie&&Ae.getElement(re),(0,Q.jsx)(pe,{context:F,modal:!1,disabled:!H,returnFocus:o,restoreFocus:!0,children:ge})]})});function Ke(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function qe(e){return je(e.scrollHeight,e.clientHeight)}function Je(e){return m.getScale(e)}function Ye(e,t,n){return e/n[t]}function $(e,t){return ie({x:Ye(e.x,`x`,t),y:Ye(e.y,`y`,t),width:Ye(e.width,`x`,t),height:Ye(e.height,`y`,t)})}var Xe=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Ze(e){let{style:t}=e,n={};for(let[e,r]of Xe)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of Xe){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Qe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=I(),{alignItemWithTriggerActive:c}=ze(),l=B(o,V.hasScrollArrows),u=B(o,V.openMethod),d=B(o,V.multiple),f={id:`${B(o,V.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:Ve},className:l&&u!==`touch`?Ae.className:void 0},p=b(e=>{o.set(`listElement`,e)});return J(`div`,e,{ref:[t,p],props:[f,a]})}),$e=Z.createContext(void 0);function et(){let e=Z.useContext($e);if(!e)throw Error(g(57));return e}var tt=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:l=!1,...u}=e,f=Z.useRef(null),p=te({label:o,textRef:f,indexGuessBehavior:d.GuessFromOrder}),{store:m,itemProps:h,setOpen:g,setValue:_,selectionRef:y,typingRef:b,valuesRef:x,multiple:S,selectedItemTextRef:C}=I(),ee=B(m,V.isActive,p.index),T=B(m,V.isSelected,p.index,a),D=B(m,V.isSelectedByFocus,p.index),O=B(m,V.isItemEqualToValue),k=p.index,A=k!==-1,j=Z.useRef(null);v(()=>{if(!A)return;let e=x.current;return e[k]=a,()=>{delete e[k]}},[A,k,a,x]),v(()=>{if(!A)return;let e=m.state.value,t=e;S&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&E(a,t,O)&&(m.set(`selectedIndex`,k),f.current&&(C.current=f.current))},[A,k,S,O,m,a,C]);let M=Z.useRef(null),N=Z.useRef(`mouse`),P=Z.useRef(!1),{getButtonProps:F,buttonRef:ne}=w({disabled:s,focusableWhenDisabled:!0,native:l,composite:!0}),re={disabled:s,selected:T,highlighted:ee};function ie(e){let t=m.state.value;if(S){let n=Array.isArray(t)?t:[],r=T?de(n,a,O):[...n,a];_(r,c(q,e))}else _(a,c(q,e)),g(!1,c(q,e))}function L(){y.current.dragY=0}let R={role:`option`,"aria-selected":T,tabIndex:ee?0:-1,onKeyDown(e){M.current=e.key,m.set(`activeIndex`,k),e.key===` `&&b.current&&e.preventDefault()},onClick(e){let t=e.type===`click`&&N.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&oe(e.nativeEvent)&&(n!==void 0||ee),i=t&&!r&&!P.current;P.current=!1,(e.type!==`keydown`||M.current!==null)&&(s||e.type===`keydown`&&M.current===` `&&b.current||i||(M.current=null,ie(e.nativeEvent)))},onPointerEnter(e){N.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=y.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){N.current=e.pointerType,P.current=!0,L()},onMouseUp(){if(L(),s||N.current===`touch`||P.current)return;let e=!y.current.allowSelectedMouseUp&&T,t=!y.current.allowUnselectedMouseUp&&!T;e||t||(P.current=!0,j.current?.click(),P.current=!1)}},z=J(`div`,e,{ref:[ne,t,p.ref,j],state:re,props:[h,R,u,F]}),H=Z.useMemo(()=>({selected:T,index:k,textRef:f,selectedByFocus:D,hasRegistered:A}),[T,k,f,D,A]);return(0,Q.jsx)($e.Provider,{value:H,children:z})})),nt=Z.memo(Z.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i,hasRegistered:a}=et(),{firstItemTextRef:o,selectedItemTextRef:s}=I(),{render:c,className:l,style:u,...d}=e,f=Z.useCallback(e=>{e&&(a&&n===0&&(o.current=e),a&&i&&(s.current=e))},[o,s,n,i,a]);return J(`div`,e,{ref:[f,t,r],props:d})})),rt=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=I(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=ze(),_=c?V.scrollUpArrowVisible:V.scrollDownArrowVisible,y=B(l,_),b=B(l,V.openMethod),x=y&&b!==`touch`,S=W(),C=c?g:h,{transitionStatus:w,setMounted:ee}=Ce(x);v(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),ce({open:x,ref:C,onComplete(){x||ee(!1)}});let te=J(`div`,e,{ref:[t,C],state:{direction:a,visible:x,side:m,transitionStatus:w},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||S.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=je(e.scrollHeight,e.clientHeight),r=ke(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){S.clear();return}if(a.length>0){let t=C.current?.offsetHeight||0;e.scrollTop=it(a,c,r,e.clientHeight,t,n)}S.start(40,t)}S.start(40,t)},onMouseLeave(){S.clear()}},s]});return x||o?te:null});function it(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?ke(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?ke(l.offsetTop+l.offsetHeight-r+i,a):a}var at=Z.forwardRef(function(e,t){return(0,Q.jsx)(rt,{...e,ref:t,direction:`down`})}),ot=Z.forwardRef(function(e,t){return(0,Q.jsx)(rt,{...e,ref:t,direction:`up`})});export{Qe as a,Le as c,tt as i,Fe as l,at as n,Ge as o,nt as r,Ue as s,ot as t,Ne as u};
2
- //# sourceMappingURL=SelectScrollUpArrow-CAd5YEsi.js.map
@@ -1,5 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Cm as n,Dc as r,Es as i,Fy as a,ME as o,Pp as s,Sy as c,T_ as l,Um as u,Yo as d,by as f,cE as p,dm as m,g_ as h,jo as g,sm as ee,sr as te,t as _,um as v,vm as y,zy as b}from"./utils-CRwA5SKO.js";import{R as ne,W as re}from"./runtime-AivVP3k8.js";import{f as ie,i as ae,m as oe}from"./toast-BYGWNQVa.js";import{a as x,n as S,t as C}from"./tooltip-924Ikq0L.js";import{f as se}from"./server-BC4-DXjw.js";import{i as ce,n as le}from"./session-CLz6NCKX.js";import{t as ue}from"./use-atom-command-BEC7Dpf5.js";import{l as de}from"./rightPanelStore-37-59X44.js";import{a as fe}from"./fileLinks-Dm5o4ow4.js";import{R as pe,s as me}from"./useSettings-CbuRZg7F.js";import{n as he}from"./toastHelpers-Dsph6LwL.js";import{t as ge}from"./observeResize-Cpph8C0G.js";import{S as _e,c as ve,d as w,n as T,s as E,x as ye}from"./browserHistoryStore-VpfOHXQM.js";import{S as D,a as be,c as xe,d as Se,f as Ce,l as we,p as Te,u as Ee,x as O}from"./keybindings-B3kvDAJC.js";import{t as De}from"./preview-Bdfy10VL.js";import{n as k,r as A}from"./browserLinkTarget-BPuATALO.js";import{i as Oe,o as j,t as ke}from"./popover-Bc0WvoPP.js";import{i as Ae,n as je,t as M}from"./terminal-links-BT70vIBN.js";import{a as Me,i as Ne,o as N,t as P}from"./terminalSessions-5_U2zswb.js";import{t as Pe}from"./terminalLabels-BgLOlb2G.js";import{Da as Fe,Oa as F,Wa as Ie,wa as I,xa as Le}from"./main-DUXMPAgZ.js";var L=e(t(),1),Re=o(),R=e(p(),1);function ze(e){let{bounds:t,selectionRect:n,pointer:r,viewport:i}=e,a=r??{x:n?.right??t.left+t.width-140,y:n?n.bottom+4:t.top+12};return{x:Math.max(8,Math.min(Math.max(t.left,a.x),t.left+t.width,i.width-8)),y:Math.max(8,Math.min(Math.max(t.top,a.y),t.top+t.height,i.height-8))}}function Be({element:e,getActionElement:t,onSelection:n,onDismiss:r}){let i=e.ownerDocument,a=i.defaultView,o=!1,s=!1,c=!1,l=null,u=null,d=null,f=e=>e!==null&&(t?.()?.contains(e)??!1),p=()=>{u!==null&&a.clearTimeout(u),d!==null&&a.cancelAnimationFrame(d),u=d=null},m=()=>{p(),o=s=!1,l=null,c=!0},h=()=>{m(),r(`cancel`)},g=()=>{m(),r(`interaction`)},ee=e=>{p(),u=a.setTimeout(()=>{u=null,d=a.requestAnimationFrame(()=>{d=null,n(l)})},e)},te=n=>{if(!n.isPrimary)return;if(f(n.target)){m();return}p(),o=n.button===0;let i=e.contains(n.target);s=!1,c=!0,l=null,i?r(`interaction`):t?.()&&r(`cancel`)},_=e=>{e.isPrimary&&(e.target?.closest(`button, [role=button]`)||(s=e.button===0&&!e.defaultPrevented,c=!s))},v=e=>{e.isPrimary&&e.button===0&&(o=!1)},y=e=>{e.button===0&&(o=!1,s&&(s=!1,l={x:e.clientX,y:e.clientY},ee(e.detail>=2?500:0)))},b=e=>{f(e.target)&&e.key!==`Escape`||(e.key===`Escape`?h():o||(p(),s=!1,l=null,c=!1))},ne=e=>{f(e.target)?m():!o&&t?.()&&h()},re=()=>{p(),o||(l=null,c=!0),r(`cancel`)};return i.addEventListener(`pointerdown`,te,!0),e.addEventListener(`pointerdown`,_),a.addEventListener(`pointerup`,v),a.addEventListener(`mouseup`,y),a.addEventListener(`pointercancel`,h),i.addEventListener(`keydown`,b),i.addEventListener(`focusin`,ne),e.addEventListener(`contextmenu`,g,!0),e.addEventListener(`scroll`,re,!0),a.addEventListener(`blur`,h),a.addEventListener(`resize`,h),{get pending(){return u!==null||d!==null},cancel:m,selectionChanged(){f(i.activeElement)||(o||s?r(`cancel`):!c&&u===null&&d===null&&ee(0))},dispose(){m(),i.removeEventListener(`pointerdown`,te,!0),e.removeEventListener(`pointerdown`,_),a.removeEventListener(`pointerup`,v),a.removeEventListener(`mouseup`,y),a.removeEventListener(`pointercancel`,h),i.removeEventListener(`keydown`,b),i.removeEventListener(`focusin`,ne),e.removeEventListener(`contextmenu`,g,!0),e.removeEventListener(`scroll`,re,!0),a.removeEventListener(`blur`,h),a.removeEventListener(`resize`,h)}}}var z=new Map(`Unidentified.Backquote.Backslash.BracketLeft.BracketRight.Comma.Digit0.Digit1.Digit2.Digit3.Digit4.Digit5.Digit6.Digit7.Digit8.Digit9.Equal.IntlBackslash.IntlRo.IntlYen.KeyA.KeyB.KeyC.KeyD.KeyE.KeyF.KeyG.KeyH.KeyI.KeyJ.KeyK.KeyL.KeyM.KeyN.KeyO.KeyP.KeyQ.KeyR.KeyS.KeyT.KeyU.KeyV.KeyW.KeyX.KeyY.KeyZ.Minus.Period.Quote.Semicolon.Slash.AltLeft.AltRight.Backspace.CapsLock.ContextMenu.ControlLeft.ControlRight.Enter.MetaLeft.MetaRight.ShiftLeft.ShiftRight.Space.Tab.Convert.KanaMode.NonConvert.Delete.End.Help.Home.Insert.PageDown.PageUp.ArrowDown.ArrowLeft.ArrowRight.ArrowUp.NumLock.Numpad0.Numpad1.Numpad2.Numpad3.Numpad4.Numpad5.Numpad6.Numpad7.Numpad8.Numpad9.NumpadAdd.NumpadBackspace.NumpadClear.NumpadClearEntry.NumpadComma.NumpadDecimal.NumpadDivide.NumpadEnter.NumpadEqual.NumpadMemoryAdd.NumpadMemoryClear.NumpadMemoryRecall.NumpadMemoryStore.NumpadMemorySubtract.NumpadMultiply.NumpadParenLeft.NumpadParenRight.NumpadSubtract.NumpadSeparator.NumpadArrowUp.NumpadArrowDown.NumpadArrowRight.NumpadArrowLeft.NumpadBegin.NumpadHome.NumpadEnd.NumpadInsert.NumpadDelete.NumpadPageUp.NumpadPageDown.Escape.F1.F2.F3.F4.F5.F6.F7.F8.F9.F10.F11.F12.F13.F14.F15.F16.F17.F18.F19.F20.F21.F22.F23.F24.F25.Fn.FnLock.PrintScreen.ScrollLock.Pause.BrowserBack.BrowserFavorites.BrowserForward.BrowserHome.BrowserRefresh.BrowserSearch.BrowserStop.Eject.LaunchApp1.LaunchApp2.LaunchMail.MediaPlayPause.MediaSelect.MediaStop.MediaTrackNext.MediaTrackPrevious.Power.Sleep.AudioVolumeDown.AudioVolumeMute.AudioVolumeUp.WakeUp.Copy.Cut.Paste`.split(`.`).map((e,t)=>[e,t]));function B(e){return z.get(e)??0}var Ve=new Map([[`!`,`1`],[`@`,`2`],[`#`,`3`],[`$`,`4`],[`%`,`5`],[`^`,`6`],[`&`,`7`],[`*`,`8`],[`(`,`9`],[`)`,`0`],[`~`,"`"],[`_`,`-`],[`+`,`=`],[`{`,`[`],[`}`,`]`],[`|`,`\\`],[`:`,`;`],[`"`,`'`],[`<`,`,`],[`>`,`.`],[`?`,`/`]]),He;function Ue(){if(He)return He;let e=(globalThis.navigator?.keyboard)?.getLayoutMap().catch(()=>void 0)??Promise.resolve(void 0);return He=e,e}function V(e){return!e.shiftKey||e.ctrlKey||e.altKey||e.metaKey?0:+([...e.key].length===1)}function We(e,t){if([...e.key].length!==1)return 0;let n=t?.get(e.code);if(n&&[...n].length===1)return n.codePointAt(0)??0;if(/^[A-Z]$/u.test(e.key))return e.key.charCodeAt(0)+32;if(e.shiftKey){let t=Ve.get(e.key);if(t)return t.codePointAt(0)??0;let n=e.key.toLowerCase();return n!==e.key&&[...n].length===1?n.codePointAt(0)??0:0}return e.key.codePointAt(0)??0}var H=`/assets/ghostty-vt-DdA0Zryv.wasm`,Ge=`/assets/ghostty-write-pty-hgyAvVbe.wasm`,U=new TextDecoder,Ke=class e{memory;layouts;exports;memoryView;ptyWriters=new Map;nextPtyWriterId=1;writePtyFunctionIndex=0;constructor(e){this.exports=e.exports;let t=e.exports.memory;if(!(t instanceof WebAssembly.Memory))throw Error(`libghostty-vt did not export WebAssembly memory`);this.memory=t,this.memoryView=new DataView(t.buffer);let n=this.call(`ghostty_type_json`),r=new Uint8Array(t.buffer),i=n;for(;i<r.length&&r[i]!==0;)i+=1;this.layouts=JSON.parse(U.decode(r.subarray(n,i)))}static async load(){let t=await fetch(H);if(!t.ok)throw Error(`Unable to load libghostty-vt (${t.status})`);let n,r=await WebAssembly.instantiate(await t.arrayBuffer(),{env:{log:(e,t)=>{if(!n)return;let r=n.exports.memory;if(!(r instanceof WebAssembly.Memory))return;let i=U.decode(new Uint8Array(r.buffer,e,t));console.debug(`[libghostty-vt]`,i)}}});n=r.instance;let i=new e(r.instance);return await i.installWritePtyTrampoline(),i}call(e,...t){let n=this.exports[e];if(typeof n!=`function`)throw Error(`libghostty-vt export is unavailable: ${e}`);return n(...t)}layout(e){let t=this.layouts[e];if(!t)throw Error(`libghostty-vt type layout is unavailable: ${e}`);return t}alloc(e){let t=this.call(`ghostty_wasm_alloc_u8_array`,e);if(t===0)throw Error(`libghostty-vt failed to allocate ${e} bytes`);return new Uint8Array(this.memory.buffer,t,e).fill(0),t}free(e,t){e!==0&&this.call(`ghostty_wasm_free_u8_array`,e,t)}allocOpaque(){let e=this.call(`ghostty_wasm_alloc_opaque`);if(e===0)throw Error(`libghostty-vt failed to allocate an opaque pointer`);return new DataView(this.memory.buffer).setUint32(e,0,!0),e}freeOpaque(e){e!==0&&this.call(`ghostty_wasm_free_opaque`,e)}readPointer(e){return this.memoryDataView().getUint32(e,!0)}attachPtyWriter(e,t){if(this.writePtyFunctionIndex===0)throw Error(`libghostty-vt PTY callback trampoline is unavailable`);let n=this.nextPtyWriterId++;return this.ptyWriters.set(n,t),this.call(`ghostty_terminal_set`,e,0,n),this.call(`ghostty_terminal_set`,e,1,this.writePtyFunctionIndex),n}detachPtyWriter(e,t){this.call(`ghostty_terminal_set`,e,1,0),this.call(`ghostty_terminal_set`,e,0,0),this.ptyWriters.delete(t)}view(e,t){return new DataView(this.memory.buffer,e,t)}bytes(e,t){return new Uint8Array(this.memory.buffer,e,t)}memoryDataView(){return this.memoryView.buffer!==this.memory.buffer&&(this.memoryView=new DataView(this.memory.buffer)),this.memoryView}setField(e,t,n,r){let i=this.layout(t).fields[n];if(!i)throw Error(`libghostty-vt field is unavailable: ${t}.${n}`);let a=this.memoryDataView(),o=e+i.offset;switch(i.type){case`bool`:case`u8`:a.setUint8(o,r);return;case`u16`:a.setUint16(o,r,!0);return;case`i32`:a.setInt32(o,r,!0);return;case`u32`:case`enum`:a.setUint32(o,r,!0);return;case`u64`:a.setBigUint64(o,BigInt(r),!0);return;default:throw Error(`Unsupported libghostty-vt field type: ${i.type}`)}}readField(e,t,n){let r=this.layout(t).fields[n];if(!r)throw Error(`libghostty-vt field is unavailable: ${t}.${n}`);let i=this.memoryDataView(),a=e+r.offset;switch(r.type){case`bool`:case`u8`:return i.getUint8(a);case`u16`:return i.getUint16(a,!0);case`i32`:return i.getInt32(a,!0);case`u32`:case`enum`:return i.getUint32(a,!0);case`u64`:return Number(i.getBigUint64(a,!0));default:throw Error(`Unsupported libghostty-vt field type: ${r.type}`)}}async installWritePtyTrampoline(){let e=await fetch(Ge);if(!e.ok)throw Error(`Unable to load the libghostty-vt PTY trampoline (${e.status})`);let t=(await WebAssembly.instantiate(await e.arrayBuffer(),{env:{t3_write_pty:(e,t,n,r)=>{let i=this.ptyWriters.get(t);i&&r!==0&&i(U.decode(new Uint8Array(this.memory.buffer,n,r)))}}})).instance.exports.ghostty_write_pty,n=this.exports.__indirect_function_table;if(typeof t!=`function`||!(n instanceof WebAssembly.Table))throw Error(`libghostty-vt did not expose its callback table`);let r=n.length;n.grow(1),n.set(r,t),this.writePtyFunctionIndex=r}},W=null;function G(){return W??=Ke.load().catch(e=>{throw W=null,e}),W}var K=0,qe=-3,Je=1e4,Ye=16,Xe=768,q={cols:1,rows:2,dirty:3,rowIterator:4,background:5,foreground:6,cursor:7,cursorHasValue:8,cursorStyle:10,cursorVisible:11,cursorBlinking:12,cursorInViewport:14,cursorX:15,cursorY:16},J={dirty:1,raw:2,cells:3},Y={raw:1,style:2,graphemesLength:3,graphemes:4,background:5,foreground:6,selected:7},X={keys:0,values:20,graphemesLength:40,selected:44,background:48,foreground:52,written:56,size:60},Ze={wide:3},Qe={narrow:0,wide:1,spacerTail:2,spacerHead:3},$e=new TextDecoder,et=new TextEncoder;function tt(e,t){let n=(e,t)=>Math.floor((e*155+t*100)/255);return{r:n(e.r,t.r),g:n(e.g,t.g),b:n(e.b,t.b)}}function nt(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b}function rt(e,t){if(t===1)return String.fromCodePoint(e.getUint32(0,!0));let n=4096,r=``;for(let i=0;i<t;i+=n){let a=Math.min(n,t-i),o=Array(a);for(let t=0;t<a;t+=1)o[t]=e.getUint32((i+t)*4,!0);r+=String.fromCodePoint(...o)}return r}var it=class e{runtime;terminalSlot=0;terminal=0;renderStateSlot=0;renderState=0;rowIteratorSlot=0;rowCellsSlot=0;keyEncoderSlot=0;keyEncoder=0;keyEventSlot=0;keyEvent=0;mouseEncoderSlot=0;mouseEncoder=0;mouseEventSlot=0;mouseEvent=0;ptyWriterId=0;ptyWriter=null;scratch=0;graphemes=0;graphemeCapacity=0;style=0;cellQuery=0;scrollbar=0;rows=[];disposed=!1;keyboardLayoutMap;constructor(e){this.runtime=e,Ue().then(e=>{this.disposed||(this.keyboardLayoutMap=e)})}static async create(t,n,r,i,a,o){let s=new e(await G());try{return s.initialize(t,n,r,i,a,o),s}catch(e){throw s.dispose(),e}}initialize(e,t,n,r,i,a){let o=this.runtime.layout(`GhosttyTerminalOptions`).size,s=this.runtime.alloc(o);this.runtime.setField(s,`GhosttyTerminalOptions`,`cols`,e),this.runtime.setField(s,`GhosttyTerminalOptions`,`rows`,t),this.runtime.setField(s,`GhosttyTerminalOptions`,`max_scrollback`,Je),this.terminalSlot=this.runtime.allocOpaque();let c=this.runtime.call(`ghostty_terminal_new`,0,this.terminalSlot,s);this.runtime.free(s,o),this.assertSuccess(`ghostty_terminal_new`,c),this.terminal=this.runtime.readPointer(this.terminalSlot),this.applyDefaultCursorBlink(),this.ptyWriter=a,this.ptyWriterId=this.runtime.attachPtyWriter(this.terminal,a),this.renderStateSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_render_state_new`,this.runtime.call(`ghostty_render_state_new`,0,this.renderStateSlot)),this.renderState=this.runtime.readPointer(this.renderStateSlot),this.rowIteratorSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_render_state_row_iterator_new`,this.runtime.call(`ghostty_render_state_row_iterator_new`,0,this.rowIteratorSlot)),this.rowCellsSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_render_state_row_cells_new`,this.runtime.call(`ghostty_render_state_row_cells_new`,0,this.rowCellsSlot)),this.keyEncoderSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_key_encoder_new`,this.runtime.call(`ghostty_key_encoder_new`,0,this.keyEncoderSlot)),this.keyEncoder=this.runtime.readPointer(this.keyEncoderSlot),this.keyEventSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_key_event_new`,this.runtime.call(`ghostty_key_event_new`,0,this.keyEventSlot)),this.keyEvent=this.runtime.readPointer(this.keyEventSlot),this.mouseEncoderSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_mouse_encoder_new`,this.runtime.call(`ghostty_mouse_encoder_new`,0,this.mouseEncoderSlot)),this.mouseEncoder=this.runtime.readPointer(this.mouseEncoderSlot),this.mouseEventSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_mouse_event_new`,this.runtime.call(`ghostty_mouse_event_new`,0,this.mouseEventSlot)),this.mouseEvent=this.runtime.readPointer(this.mouseEventSlot),this.scratch=this.runtime.alloc(16);let l=this.runtime.layout(`GhosttyStyle`).size;this.style=this.runtime.alloc(l),this.runtime.setField(this.style,`GhosttyStyle`,`size`,l),this.cellQuery=this.runtime.alloc(X.size);let u=this.runtime.memoryDataView(),d=[[Y.style,this.style],[Y.graphemesLength,this.cellQuery+X.graphemesLength],[Y.selected,this.cellQuery+X.selected],[Y.background,this.cellQuery+X.background],[Y.foreground,this.cellQuery+X.foreground]];for(let[e,[t,n]]of d.entries())u.setUint32(this.cellQuery+X.keys+e*4,t,!0),u.setUint32(this.cellQuery+X.values+e*4,n,!0);this.scrollbar=this.runtime.alloc(this.runtime.layout(`GhosttyTerminalScrollbar`).size),this.setTheme(i),this.resize(e,t,n,r)}write(e){this.ensureActive();let t=typeof e==`string`?et.encode(e):e;if(t.length===0)return;let n=this.runtime.alloc(t.length);this.runtime.bytes(n,t.length).set(t),this.runtime.call(`ghostty_terminal_vt_write`,this.terminal,n,t.length),this.runtime.free(n,t.length)}resetAndWrite(e){if(this.ensureActive(),this.runtime.call(`ghostty_terminal_reset`,this.terminal),this.applyDefaultCursorBlink(),this.rows=[],e.length===0)return;let t=this.ptyWriter;this.ptyWriterId!==0&&(this.runtime.detachPtyWriter(this.terminal,this.ptyWriterId),this.ptyWriterId=0);try{this.write(e)}finally{t!==null&&!this.disposed&&(this.ptyWriterId=this.runtime.attachPtyWriter(this.terminal,t))}}resize(e,t,n,r){this.ensureActive(),this.assertSuccess(`ghostty_terminal_resize`,this.runtime.call(`ghostty_terminal_resize`,this.terminal,Math.max(1,Math.min(65535,e)),Math.max(1,Math.min(65535,t)),Math.max(1,Math.round(n)),Math.max(1,Math.round(r))))}applyDefaultCursorBlink(){let e=this.runtime.alloc(1);this.runtime.bytes(e,1)[0]=1,this.runtime.call(`ghostty_terminal_set`,this.terminal,23,e),this.runtime.free(e,1)}setTheme(e){this.ensureActive();let t=this.runtime.alloc(3);for(let[n,r]of[[11,e.foreground],[12,e.background],[13,e.cursor]])this.runtime.bytes(t,3).set([r.r,r.g,r.b]),this.runtime.call(`ghostty_terminal_set`,this.terminal,n,t);this.runtime.free(t,3),e.palette&&this.setPalette(e.palette)}setPalette(e){let t=this.runtime.alloc(Xe);this.runtime.call(`ghostty_terminal_get`,this.terminal,25,t);let n=this.runtime.bytes(t,Xe);e.slice(0,16).forEach((e,t)=>{n.set([e.r,e.g,e.b],t*3)}),this.runtime.call(`ghostty_terminal_set`,this.terminal,14,t),this.runtime.free(t,Xe)}scroll(e){this.ensureActive();let t=this.runtime.layout(`GhosttyTerminalScrollViewport`),n=this.runtime.alloc(t.size);this.runtime.setField(n,`GhosttyTerminalScrollViewport`,`tag`,2);let r=t.fields.value;this.runtime.view(n+r.offset,r.size).setInt32(0,e,!0),this.runtime.call(`ghostty_terminal_scroll_viewport`,this.terminal,n),this.runtime.free(n,t.size)}scrollToBottom(){this.ensureActive();let e=this.runtime.layout(`GhosttyTerminalScrollViewport`),t=this.runtime.alloc(e.size);this.runtime.setField(t,`GhosttyTerminalScrollViewport`,`tag`,1),this.runtime.call(`ghostty_terminal_scroll_viewport`,this.terminal,t),this.runtime.free(t,e.size)}isViewportActive(){return this.ensureActive(),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_terminal_get`,this.terminal,32,this.scratch)===K&&this.runtime.bytes(this.scratch,1)[0]!==0}scrollbarState(){this.ensureActive();let e=this.runtime.layout(`GhosttyTerminalScrollbar`);return this.runtime.bytes(this.scrollbar,e.size).fill(0),this.runtime.call(`ghostty_terminal_get`,this.terminal,9,this.scrollbar)===K?{total:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`total`),offset:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`offset`),len:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`len`)}:null}isMouseTracking(){return this.ensureActive(),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_terminal_get`,this.terminal,11,this.scratch)===K&&this.runtime.bytes(this.scratch,1)[0]!==0}isMouseAnyEventTracking(){return this.ensureActive(),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_terminal_mode_get`,this.terminal,1003,this.scratch)===K&&this.runtime.bytes(this.scratch,1)[0]!==0}isAlternateScreen(){return this.ensureActive(),this.runtime.bytes(this.scratch,4).fill(0),this.runtime.call(`ghostty_terminal_get`,this.terminal,6,this.scratch)===K&&this.runtime.view(this.scratch,4).getUint32(0,!0)===1}isApplicationCursorKeys(){return this.ensureActive(),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_terminal_mode_get`,this.terminal,1,this.scratch)===K&&this.runtime.bytes(this.scratch,1)[0]!==0}encodeKey(e,t=`press`){this.ensureActive(),this.runtime.call(`ghostty_key_encoder_setopt_from_terminal`,this.keyEncoder,this.terminal),this.runtime.call(`ghostty_key_event_set_action`,this.keyEvent,t===`release`?0:e.repeat?2:1),this.runtime.call(`ghostty_key_event_set_key`,this.keyEvent,B(e.code));let n=+!!e.shiftKey|(e.ctrlKey?2:0)|(e.altKey?4:0)|(e.metaKey?8:0)|(e.getModifierState(`CapsLock`)?16:0)|(e.getModifierState(`NumLock`)?32:0);this.runtime.call(`ghostty_key_event_set_mods`,this.keyEvent,n),this.runtime.call(`ghostty_key_event_set_consumed_mods`,this.keyEvent,V(e)),this.runtime.call(`ghostty_key_event_set_composing`,this.keyEvent,+!!e.isComposing),this.runtime.call(`ghostty_key_event_set_unshifted_codepoint`,this.keyEvent,We(e,this.keyboardLayoutMap));let r=e.key.length===1?e.key:``,i=et.encode(r),a=i.length===0?0:this.runtime.alloc(i.length);a!==0&&this.runtime.bytes(a,i.length).set(i),this.runtime.call(`ghostty_key_event_set_utf8`,this.keyEvent,a,i.length);let o=this.runtime.call(`ghostty_wasm_alloc_usize`),s=this.encodeOutput(o,(e,t)=>this.runtime.call(`ghostty_key_encoder_encode`,this.keyEncoder,this.keyEvent,e,t,o));return this.runtime.call(`ghostty_wasm_free_usize`,o),a!==0&&this.runtime.free(a,i.length),s}encodePaste(e){this.ensureActive();let t=et.encode(e);if(t.length===0)return``;let n=this.runtime.alloc(t.length);this.runtime.bytes(n,t.length).set(t),this.runtime.bytes(this.scratch,1)[0]=0;let r=this.runtime.call(`ghostty_terminal_mode_get`,this.terminal,2004,this.scratch)===K&&this.runtime.bytes(this.scratch,1)[0]!==0,i=this.runtime.call(`ghostty_wasm_alloc_usize`),a=``,o=this.runtime.call(`ghostty_paste_encode`,n,t.length,+!!r,0,0,i),s=this.runtime.view(i,4).getUint32(0,!0);if(o===qe&&s>0){let e=this.runtime.alloc(s),o=this.runtime.call(`ghostty_paste_encode`,n,t.length,+!!r,e,s,i),c=this.runtime.view(i,4).getUint32(0,!0);a=o===K?$e.decode(this.runtime.bytes(e,c)):``,this.runtime.free(e,s)}return this.runtime.call(`ghostty_wasm_free_usize`,i),this.runtime.free(n,t.length),a}encodeMouse(e){this.ensureActive(),this.runtime.call(`ghostty_mouse_encoder_setopt_from_terminal`,this.mouseEncoder,this.terminal);let t=this.runtime.layout(`GhosttyMouseEncoderSize`),n=this.runtime.alloc(t.size);for(let[r,i]of[[`size`,t.size],[`screen_width`,e.screenWidth],[`screen_height`,e.screenHeight],[`cell_width`,e.cellWidth],[`cell_height`,e.cellHeight],[`padding_top`,e.paddingTop],[`padding_bottom`,e.paddingBottom],[`padding_right`,e.paddingRight],[`padding_left`,e.paddingLeft]])this.runtime.setField(n,`GhosttyMouseEncoderSize`,r,Math.max(0,Math.round(i)));this.runtime.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,2,n),this.runtime.free(n,t.size),this.runtime.bytes(this.scratch,1)[0]=+!!e.anyButtonPressed,this.runtime.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,3,this.scratch),this.runtime.bytes(this.scratch,1)[0]=1,this.runtime.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,4,this.scratch),this.runtime.call(`ghostty_mouse_event_set_action`,this.mouseEvent,e.action===`press`?0:e.action===`release`?1:2),e.button===null?this.runtime.call(`ghostty_mouse_event_clear_button`,this.mouseEvent):this.runtime.call(`ghostty_mouse_event_set_button`,this.mouseEvent,e.button),this.runtime.call(`ghostty_mouse_event_set_mods`,this.mouseEvent,e.mods);let r=this.runtime.layout(`GhosttyMousePosition`),i=this.runtime.alloc(r.size),a=this.runtime.view(i,r.size);a.setFloat32(r.fields.x.offset,e.x,!0),a.setFloat32(r.fields.y.offset,e.y,!0),this.runtime.call(`ghostty_mouse_event_set_position`,this.mouseEvent,i),this.runtime.free(i,r.size);let o=this.runtime.call(`ghostty_wasm_alloc_usize`),s=this.encodeOutput(o,(e,t)=>this.runtime.call(`ghostty_mouse_encoder_encode`,this.mouseEncoder,this.mouseEvent,e,t,o));return this.runtime.call(`ghostty_wasm_free_usize`,o),s}setSelection(e,t){this.ensureActive();let n=this.runtime.layout(`GhosttySelection`),r=this.runtime.layout(`GhosttyGridRef`).size,i=this.runtime.alloc(n.size),a=0,o=0;try{this.runtime.setField(i,`GhosttySelection`,`size`,n.size),a=this.gridRef(e.x,e.y,e.tag??1),o=this.gridRef(t.x,t.y,t.tag??1);let r=n.fields.start,s=n.fields.end;this.runtime.bytes(i+r.offset,r.size).set(this.runtime.bytes(a,r.size)),this.runtime.bytes(i+s.offset,s.size).set(this.runtime.bytes(o,s.size)),this.runtime.call(`ghostty_terminal_set`,this.terminal,21,i)}finally{this.runtime.free(a,r),this.runtime.free(o,r),this.runtime.free(i,n.size)}}selectAll(){this.ensureActive();let e=this.runtime.layout(`GhosttySelection`),t=this.runtime.alloc(e.size);try{if(this.runtime.setField(t,`GhosttySelection`,`size`,e.size),this.runtime.call(`ghostty_terminal_select_all`,this.terminal,t)!==K)return null;let n=this.pointFromGridRef(t+e.fields.start.offset,2),r=this.pointFromGridRef(t+e.fields.end.offset,2);return!n||!r?null:(this.runtime.call(`ghostty_terminal_set`,this.terminal,21,t),{start:n,end:r})}finally{this.runtime.free(t,e.size)}}selectWord(e,t){return this.selectAt(`GhosttyTerminalSelectWordOptions`,`ghostty_terminal_select_word`,e,t)}selectLine(e,t){return this.selectAt(`GhosttyTerminalSelectLineOptions`,`ghostty_terminal_select_line`,e,t)}hyperlinkAt(e,t){this.ensureActive();let n=this.gridRef(e,t),r=this.runtime.call(`ghostty_wasm_alloc_usize`),i=this.runtime.call(`ghostty_grid_ref_hyperlink_uri`,n,0,0,r),a=this.runtime.view(r,4).getUint32(0,!0),o=null;if(i===qe&&a>0){let e=this.runtime.alloc(a),t=this.runtime.call(`ghostty_grid_ref_hyperlink_uri`,n,e,a,r),i=this.runtime.view(r,4).getUint32(0,!0);t===K&&i>0&&(o=$e.decode(this.runtime.bytes(e,i))),this.runtime.free(e,a)}return this.runtime.call(`ghostty_wasm_free_usize`,r),this.runtime.free(n,this.runtime.layout(`GhosttyGridRef`).size),o}clearSelection(){this.ensureActive(),this.runtime.call(`ghostty_terminal_set`,this.terminal,21,0)}snapshot(){this.ensureActive(),this.assertSuccess(`ghostty_render_state_update`,this.runtime.call(`ghostty_render_state_update`,this.renderState,this.terminal));let e=this.getU16(q.cols),t=this.getU16(q.rows),n=this.getU32(q.dirty),r=this.getColor(q.foreground,{r:229,g:231,b:235}),i=this.getColor(q.background,{r:0,g:0,b:0}),a=this.getBool(q.cursorHasValue)?this.getColor(q.cursor,r):r,o=this.getBool(q.cursorInViewport),s=this.getBool(q.cursorVisible)&&o,c=o?this.getU16(q.cursorX):-1,l=o?this.getU16(q.cursorY):-1;(this.rows.length!==t||this.rows.some(t=>t.cells.length!==e))&&(this.rows=Array.from({length:t},()=>({cells:Array.from({length:e},()=>this.emptyCell(r,i)),text:``,isWrapContinuation:!1,wrapsToNext:!1})));let u=new Set;if(n!==0){this.assertSuccess(`ghostty_render_state_get(row iterator)`,this.runtime.call(`ghostty_render_state_get`,this.renderState,q.rowIterator,this.rowIteratorSlot));let a=this.runtime.readPointer(this.rowIteratorSlot),o=0;for(;o<t&&this.runtime.call(`ghostty_render_state_row_iterator_next`,a)!==0;)(n===2||this.getRowBool(a,J.dirty))&&(this.rows[o]=this.readRow(a,e,r,i),u.add(o),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_render_state_row_set`,a,0,this.scratch)),o+=1;this.runtime.view(this.scratch,4).setUint32(0,0,!0),this.runtime.call(`ghostty_render_state_set`,this.renderState,0,this.scratch)}return{cols:e,rows:t,foreground:r,background:i,cursor:a,cursorX:c,cursorY:l,cursorVisible:s,cursorBlinking:this.getBool(q.cursorBlinking),cursorStyle:this.getU32(q.cursorStyle),dirtyRows:u,rowData:this.rows}}selectionText(){this.ensureActive();let e=this.runtime.alloc(Ye),t=this.runtime.view(e,Ye);t.setUint32(0,Ye,!0),t.setUint32(4,0,!0),t.setUint8(8,1),t.setUint8(9,1),t.setUint32(12,0,!0);let n=this.runtime.call(`ghostty_wasm_alloc_usize`),r=this.runtime.call(`ghostty_terminal_selection_format_buf`,this.terminal,e,0,0,n),i=this.runtime.view(n,4).getUint32(0,!0),a=``;if(r===qe&&i>0){let t=this.runtime.alloc(i),r=this.runtime.call(`ghostty_terminal_selection_format_buf`,this.terminal,e,t,i,n),o=this.runtime.view(n,4).getUint32(0,!0);r===K&&(a=$e.decode(this.runtime.bytes(t,o))),this.runtime.free(t,i)}return this.runtime.call(`ghostty_wasm_free_usize`,n),this.runtime.free(e,Ye),a}viewportPointToScreen(e,t){return this.convertPoint(e,t,1,2)}screenPointToViewport(e,t){return this.convertPoint(e,t,2,1)}convertPoint(e,t,n,r){this.ensureActive();let i=this.gridRef(e,t,n),a=this.pointFromGridRef(i,r);return this.runtime.free(i,this.runtime.layout(`GhosttyGridRef`).size),a}dispose(){if(!this.disposed){if(this.disposed=!0,this.mouseEvent&&this.runtime.call(`ghostty_mouse_event_free`,this.mouseEvent),this.mouseEncoder&&this.runtime.call(`ghostty_mouse_encoder_free`,this.mouseEncoder),this.keyEvent&&this.runtime.call(`ghostty_key_event_free`,this.keyEvent),this.keyEncoder&&this.runtime.call(`ghostty_key_encoder_free`,this.keyEncoder),this.rowCellsSlot){let e=this.runtime.readPointer(this.rowCellsSlot);e&&this.runtime.call(`ghostty_render_state_row_cells_free`,e)}if(this.rowIteratorSlot){let e=this.runtime.readPointer(this.rowIteratorSlot);e&&this.runtime.call(`ghostty_render_state_row_iterator_free`,e)}this.renderState&&this.runtime.call(`ghostty_render_state_free`,this.renderState),this.terminal&&(this.ptyWriterId&&this.runtime.detachPtyWriter(this.terminal,this.ptyWriterId),this.runtime.call(`ghostty_terminal_free`,this.terminal)),this.style&&this.runtime.free(this.style,this.runtime.layout(`GhosttyStyle`).size),this.cellQuery&&this.runtime.free(this.cellQuery,X.size),this.scrollbar&&this.runtime.free(this.scrollbar,this.runtime.layout(`GhosttyTerminalScrollbar`).size),this.scratch&&this.runtime.free(this.scratch,16),this.graphemes&&this.runtime.free(this.graphemes,this.graphemeCapacity);for(let e of[this.mouseEventSlot,this.mouseEncoderSlot,this.keyEventSlot,this.keyEncoderSlot,this.rowCellsSlot,this.rowIteratorSlot,this.renderStateSlot,this.terminalSlot])this.runtime.freeOpaque(e)}}encodeOutput(e,t){let n=t(0,0),r=this.runtime.view(e,4).getUint32(0,!0);if(n===K&&r===0||n!==qe||r===0)return``;let i=this.runtime.alloc(r),a=t(i,r),o=this.runtime.view(e,4).getUint32(0,!0),s=a===K?$e.decode(this.runtime.bytes(i,o)):``;return this.runtime.free(i,r),s}readRow(e,t,n,r){this.assertSuccess(`ghostty_render_state_row_get(raw)`,this.runtime.call(`ghostty_render_state_row_get`,e,J.raw,this.scratch));let i=this.runtime.view(this.scratch,8).getBigUint64(0,!0);this.runtime.bytes(this.scratch+8,1)[0]=0,this.assertSuccess(`ghostty_row_get(wrap continuation)`,this.runtime.call(`ghostty_row_get`,i,2,this.scratch+8));let a=this.runtime.bytes(this.scratch+8,1)[0]!==0;this.runtime.bytes(this.scratch+8,1)[0]=0,this.assertSuccess(`ghostty_row_get(wrap)`,this.runtime.call(`ghostty_row_get`,i,1,this.scratch+8));let o=this.runtime.bytes(this.scratch+8,1)[0]!==0;this.assertSuccess(`ghostty_render_state_row_get(cells)`,this.runtime.call(`ghostty_render_state_row_get`,e,J.cells,this.rowCellsSlot));let s=this.runtime.readPointer(this.rowCellsSlot),{size:c,fields:l}=this.runtime.layout(`GhosttyStyle`),u=[];for(;u.length<t&&this.runtime.call(`ghostty_render_state_row_cells_next`,s)!==0;){this.runtime.bytes(this.style,c).fill(0),this.runtime.setField(this.style,`GhosttyStyle`,`size`,c);let e=this.runtime.call(`ghostty_render_state_row_cells_get_multi`,s,5,this.cellQuery+X.keys,this.cellQuery+X.values,this.cellQuery+X.written),t=this.runtime.memoryDataView(),i=t.getUint32(this.cellQuery+X.written,!0);i<3&&this.assertSuccess(`ghostty_render_state_row_cells_get_multi`,e);let a=t.getUint32(this.cellQuery+X.graphemesLength,!0),o=t.getUint8(this.cellQuery+X.selected)!==0,d=i>=4?this.readColor(this.cellQuery+X.background):r,f=i===5?this.readColor(this.cellQuery+X.foreground):i===3?this.getCellColor(s,Y.foreground,n):n,p=``;if(a>0){let e=a*4;if(e>this.graphemeCapacity){let t=Math.max(e,this.graphemeCapacity*2),n=this.runtime.alloc(t);this.runtime.free(this.graphemes,this.graphemeCapacity),this.graphemes=n,this.graphemeCapacity=t}this.runtime.call(`ghostty_render_state_row_cells_get`,s,Y.graphemes,this.graphemes)===K&&(p=rt(this.runtime.view(this.graphemes,e),a))}let m=0;if(p.length===0&&u.at(-1)?.text.length){this.assertSuccess(`ghostty_render_state_row_cells_get(raw)`,this.runtime.call(`ghostty_render_state_row_cells_get`,s,Y.raw,this.scratch));let e=this.runtime.view(this.scratch,8).getBigUint64(0,!0);this.runtime.view(this.scratch+8,4).setUint32(0,0,!0),this.assertSuccess(`ghostty_cell_get(wide)`,this.runtime.call(`ghostty_cell_get`,e,Ze.wide,this.scratch+8)),m=this.runtime.view(this.scratch+8,4).getUint32(0,!0)}let h=this.runtime.memoryDataView();h.getUint8(this.style+l.inverse.offset)!==0&&([f,d]=[d,f]),h.getUint8(this.style+l.faint.offset)!==0&&(f=tt(f,d)),u.push({text:p,wide:m,foreground:f,background:d,bold:h.getUint8(this.style+l.bold.offset)!==0,italic:h.getUint8(this.style+l.italic.offset)!==0,invisible:h.getUint8(this.style+l.invisible.offset)!==0,strikethrough:h.getUint8(this.style+l.strikethrough.offset)!==0,overline:h.getUint8(this.style+l.overline.offset)!==0,underline:h.getInt32(this.style+l.underline.offset,!0)!==0,selected:o})}for(;u.length<t;)u.push(this.emptyCell(n,r));return{cells:u,text:u.map(e=>e.text||` `).join(``).trimEnd(),isWrapContinuation:a,wrapsToNext:o}}gridRef(e,t,n=1){let r=this.runtime.layout(`GhosttyPoint`),i=this.runtime.alloc(r.size);this.runtime.setField(i,`GhosttyPoint`,`tag`,n);let a=r.fields.value,o=a.offset,s=this.runtime.view(i+o,a.size);s.setUint16(0,Math.max(0,e),!0),s.setUint32(4,Math.max(0,t),!0);let c=this.runtime.layout(`GhosttyGridRef`).size,l=this.runtime.alloc(c);this.runtime.setField(l,`GhosttyGridRef`,`size`,c);let u=this.runtime.call(`ghostty_terminal_grid_ref`,this.terminal,i,l);return this.runtime.free(i,r.size),u!==K&&(this.runtime.free(l,c),this.assertSuccess(`ghostty_terminal_grid_ref`,u)),l}selectAt(e,t,n,r){this.ensureActive();let i=this.runtime.layout(e),a=this.runtime.layout(`GhosttySelection`),o=this.runtime.alloc(i.size),s=0,c=0,l=null;try{this.runtime.setField(o,e,`size`,i.size),s=this.gridRef(n,r);let u=i.fields.ref;if(this.runtime.bytes(o+u.offset,u.size).set(this.runtime.bytes(s,u.size)),c=this.runtime.alloc(a.size),this.runtime.setField(c,`GhosttySelection`,`size`,a.size),this.runtime.call(t,this.terminal,o,c)===K){let e=c+a.fields.start.offset,t=c+a.fields.end.offset,n=this.pointFromGridRef(e,1),r=this.pointFromGridRef(t,1),i=this.pointFromGridRef(e,2),o=this.pointFromGridRef(t,2);n&&r&&i&&o&&(l={viewport:{start:n,end:r},screen:{start:i,end:o}}),this.runtime.call(`ghostty_terminal_set`,this.terminal,21,c)}}finally{this.runtime.free(c,a.size),this.runtime.free(s,this.runtime.layout(`GhosttyGridRef`).size),this.runtime.free(o,i.size)}return l}pointFromGridRef(e,t){let n=this.runtime.layout(`GhosttyPointCoordinate`),r=this.runtime.alloc(n.size),i=this.runtime.call(`ghostty_terminal_point_from_grid_ref`,this.terminal,e,t,r)===K?{x:this.runtime.readField(r,`GhosttyPointCoordinate`,`x`),y:this.runtime.readField(r,`GhosttyPointCoordinate`,`y`)}:null;return this.runtime.free(r,n.size),i}getU16(e){return this.runtime.bytes(this.scratch,2).fill(0),this.assertSuccess(`ghostty_render_state_get`,this.runtime.call(`ghostty_render_state_get`,this.renderState,e,this.scratch)),this.runtime.view(this.scratch,2).getUint16(0,!0)}getU32(e){return this.runtime.bytes(this.scratch,4).fill(0),this.assertSuccess(`ghostty_render_state_get`,this.runtime.call(`ghostty_render_state_get`,this.renderState,e,this.scratch)),this.runtime.view(this.scratch,4).getUint32(0,!0)}getBool(e){return this.runtime.bytes(this.scratch,1)[0]=0,this.assertSuccess(`ghostty_render_state_get`,this.runtime.call(`ghostty_render_state_get`,this.renderState,e,this.scratch)),this.runtime.bytes(this.scratch,1)[0]!==0}getColor(e,t){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.call(`ghostty_render_state_get`,this.renderState,e,this.scratch)===K?this.readColor(this.scratch):t}getRowBool(e,t){return this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_render_state_row_get`,e,t,this.scratch)===K&&this.runtime.bytes(this.scratch,1)[0]!==0}getCellColor(e,t,n){return this.runtime.bytes(this.scratch,3).fill(0),this.runtime.call(`ghostty_render_state_row_cells_get`,e,t,this.scratch)===K?this.readColor(this.scratch):n}readColor(e){let t=this.runtime.memoryDataView();return{r:t.getUint8(e),g:t.getUint8(e+1),b:t.getUint8(e+2)}}emptyCell(e,t){return{text:``,wide:0,foreground:e,background:t,bold:!1,italic:!1,invisible:!1,strikethrough:!1,overline:!1,underline:!1,selected:!1}}assertSuccess(e,t){if(t!==K)throw Error(`${e} failed with result ${t}`)}ensureActive(){if(this.disposed)throw Error(`libghostty-vt terminal has been disposed`)}};function at(e,t){return nt(e,t)}var ot=`rgba(72, 122, 191, 0.35)`;function Z(e){return`rgb(${e.r}, ${e.g}, ${e.b})`}function st(e,t){return at(e.foreground,t.foreground)&&e.bold===t.bold&&e.italic===t.italic&&e.invisible===t.invisible}function ct(e,t,n){let r=t+1;for(;r<e.length;){let t=e[r];if(!t)break;if(t.wide===Qe.spacerTail){r+=1;continue}if(t.text.length===0||!n(t))break;r+=1}return r}function lt(e,t,n){return`${e.italic?`italic`:`normal`} ${e.bold?`700`:`400`} ${t}px ${n}`}function ut(e,t,n){e.font=`normal 400 ${t}px ${n}`;let r=e.measureText(`M`),i=e.measureText(`Mg`),a=i.actualBoundingBoxAscent||t,o=a+i.actualBoundingBoxDescent,s=Math.max(1,Math.round(t*1.35),Math.ceil(o));return{width:Math.max(1,r.width),height:s,baseline:Math.round((s-o)/2+a)}}function Q(e,t,n,r){return{cols:Math.max(1,Math.floor((e-r*2)/n.width)),rows:Math.max(1,Math.floor((t-r*2)/n.height))}}function dt(e){let{context:t,snapshot:n,metrics:r,fontSize:i,fontFamily:a,padding:o,forceFull:s,cursorOn:c,previousCursorY:l}=e,u=e.focused??!0,d=e.selectionBackground??ot,f=e.hoveredLinkRange??null,p=e.originY??o,m=s?Array.from({length:n.rows},(e,t)=>t):[...n.dirtyRows];l!=null&&l>=0&&!m.includes(l)&&m.push(l),n.cursorVisible&&n.cursorY>=0&&!m.includes(n.cursorY)&&m.push(n.cursorY),s&&(t.save(),t.resetTransform(),t.fillStyle=Z(n.background),t.fillRect(0,0,t.canvas.width,t.canvas.height),t.restore()),t.textBaseline=`alphabetic`;for(let e of m){let s=n.rowData[e];if(!s)continue;let c=p+e*r.height;t.fillStyle=Z(n.background),t.fillRect(o,c,n.cols*r.width,r.height);let l=0;for(;l<s.cells.length;){let e=s.cells[l];if(!e)break;let i=l+1;for(;i<s.cells.length;){let t=s.cells[i];if(!t||t.selected!==e.selected||!at(t.background,e.background))break;i+=1}if(e.selected||!at(e.background,n.background)){let a=o+l*r.width,s=(i-l)*r.width;at(e.background,n.background)||(t.fillStyle=Z(e.background),t.fillRect(a,c,s,r.height)),e.selected&&(t.fillStyle=d,t.fillRect(a,c,s,r.height))}l=i}let u=0;for(;u<s.cells.length;){let e=s.cells[u];if(!e)break;if(e.text.length===0){u+=1;continue}let n=ct(s.cells,u,t=>st(t,e)),l=s.cells.slice(u,n).map(e=>e.text).join(``);!e.invisible&&l.trim().length>0&&(t.save(),t.beginPath(),t.rect(o+u*r.width,c,(n-u)*r.width,r.height),t.clip(),t.font=lt(e,i,a),t.fillStyle=Z(e.foreground),t.fillText(l,o+u*r.width,c+r.baseline,(n-u)*r.width),t.restore()),u=n}for(let n=0;n<s.cells.length;n+=1){let i=s.cells[n],a=f!==null&&e>=f.start.y&&e<=f.end.y&&(e>f.start.y||n>=f.start.x)&&(e<f.end.y||n<=f.end.x);if(!i||!i.underline&&!i.strikethrough&&!i.overline&&!a)continue;t.fillStyle=Z(i.foreground);let l=o+n*r.width;(i.underline||a)&&t.fillRect(l,c+r.height-2,r.width,1),i.strikethrough&&t.fillRect(l,c+Math.floor(r.height*.55),r.width,1),i.overline&&t.fillRect(l,c+1,r.width,1)}}if(c&&n.cursorVisible&&n.cursorX>=0&&n.cursorY>=0){let e=o+n.cursorX*r.width,s=p+n.cursorY*r.height;if(t.fillStyle=Z(n.cursor),!u)t.strokeStyle=Z(n.cursor),t.strokeRect(e+.5,s+.5,r.width-1,r.height-1);else if(n.cursorStyle===0)t.fillRect(e,s,2,r.height);else if(n.cursorStyle===2)t.fillRect(e,s+r.height-2,r.width,2);else if(n.cursorStyle===3)t.strokeStyle=Z(n.cursor),t.strokeRect(e+.5,s+.5,r.width-1,r.height-1);else{t.fillRect(e,s,r.width,r.height);let o=n.rowData[n.cursorY]?.cells[n.cursorX];o?.text&&(t.font=lt(o,i,a),t.fillStyle=Z(n.background),t.fillText(o.text,e,s+r.baseline,r.width))}}}var ft=`/assets/SymbolsNerdFontMono-Regular-aK5vsLov.woff2`,pt=6,mt=32,ht=`"Symbols Nerd Font Mono", "Symbols Nerd Font", "JetBrainsMono Nerd Font", "JetBrainsMono NF", "FiraCode Nerd Font", "Hack Nerd Font", "MesloLGS NF", "CaskaydiaCove Nerd Font", "PowerlineSymbols", monospace`,gt=`"SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", `+ht,$=4,_t=18,vt=500,yt=`iMW0@# .`,bt=[`normal 400`,`normal 700`,`italic 400`,`italic 700`],xt=null;function St(){return xt===null&&(xt=(async()=>{try{let e=new FontFace(`Symbols Nerd Font Mono`,`url(${ft})`);document.fonts.add(await e.load())}catch{}})()),xt}function Ct(e){return e.split(`,`).map(e=>{let t=e.trim();return t.length===0?``:/^(['"]).*\1$/.test(t)||/^[a-zA-Z][a-zA-Z0-9-]*$/.test(t)?t:`"${t.replaceAll(`"`,``)}"`}).filter(e=>e.length>0).join(`, `)}function wt(e){let t=e===void 0?``:Ct(e);return t.length===0?gt:`${t}, ${ht}`}function Tt(e){let t=e===void 0?``:Ct(e);return t.length===0||!I(t)?gt:wt(t)}async function Et(e,t,n){let r=wt(e),i=n?.load??((e,t)=>document.fonts.load(e,t));try{await Promise.all(bt.map(e=>i(`${e} ${t}px ${r}`,yt)))}catch{}return(n?.resolve??Tt)(e)}function Dt(e){return e===void 0||!Number.isFinite(e)?12:Math.max(pt,Math.min(mt,Math.round(e)))}function Ot(e){return e.focused&&e.cursorBlinking&&e.cursorVisible&&!e.reducedMotion}function kt(e,t,n,r,i){if(!i)return t;let a=e-t*2-n*r;return t+Math.max(0,a)}function At(e,t){let n=Math.max(0,e.total),r=Math.max(0,Math.min(e.len,n)),i=Math.max(0,n-r);if(t<=0||r<=0||i===0)return null;let a=Math.min(t,Math.max(_t,t*r/n));return{thumbHeight:a,thumbTop:Math.max(0,t-a)*(Math.max(0,Math.min(e.offset,i))/i),maxOffset:i}}function jt(e,t,n,r){let i=At(e,t);if(i===null)return 0;let a=Math.max(0,t-i.thumbHeight);if(a===0)return 0;let o=Math.max(0,Math.min(n-r,a));return Math.round(o/a*i.maxOffset)}function Mt(e){let{bounds:t,clientX:n,clientY:r,cols:i,rows:a,metrics:o,padding:s,originY:c}=e,l=n-t.left-s,u=r-t.top-c;return l<0||u<0||l>=i*o.width||u>=a*o.height?null:{x:Math.floor(l/o.width),y:Math.floor(u/o.height)}}function Nt(e,t){let n=e.cells.map(e=>e.text||` `).join(``);return t?n.trimEnd():n}function Pt(e,t){let n=0;for(let r=0;r<t;r+=1)n+=e.cells[r]?.text.length||1;return n}function Ft(e,t){return t?.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}function It(e,t){for(let n=0;n<e.cells.length;n+=1)if(t<Pt(e,n+1))return n;return Math.max(0,e.cells.length-1)}function Lt(e,t,n){let r=M(t+1,t=>{let n=e[t];return n?{isWrapped:n.isWrapContinuation,translateToString:(e=!1)=>Nt(n,e)}:null});if(!r)return null;let i=r.segments[0];if(i&&e[i.bufferLineNumber-1]?.isWrapContinuation)return null;let a=r.segments.find(e=>e.bufferLineNumber===t+1),o=e[t];if(!a||!o)return null;let s=r.segments.at(-1),c=s?e[s.bufferLineNumber-1]:void 0,l=c!==void 0&&c.wrapsToNext,u=a.startIndex+Pt(o,n);for(let t of je(r.text))if(u>=t.start&&u<t.end){if(t.end===r.text.length&&l)return null;let n=r.segments.find(e=>t.start>=e.startIndex&&t.start<e.endIndex),i=r.segments.find(e=>t.end-1>=e.startIndex&&t.end-1<e.endIndex),a=n?e[n.bufferLineNumber-1]:void 0,o=i?e[i.bufferLineNumber-1]:void 0;return!n||!i||!a||!o?null:{text:t.text,range:{start:{x:It(a,t.start-n.startIndex),y:n.bufferLineNumber-1},end:{x:It(o,t.end-1-i.startIndex),y:i.bufferLineNumber-1}}}}return null}function Rt(e,t=navigator.platform){let n=e.key.toLowerCase();return n===`insert`&&!r(t)?e.ctrlKey&&!e.shiftKey&&!e.metaKey:n===`c`?r(t)?e.metaKey:e.ctrlKey:!1}function zt(e,t){e.value=t,t.length!==0&&e.select()}function Bt(e,t){t.length!==0&&e.value===t&&(e.value=``)}function Vt(e,t){return e.length===0||!t?{preventDefault:!1,claimWriteFallback:!1}:(t.setData(`text/plain`,e),{preventDefault:!0,claimWriteFallback:!0})}function Ht(e,t=navigator.platform){let n=e.key.toLowerCase();return n===`insert`&&!r(t)?e.shiftKey&&!e.ctrlKey&&!e.metaKey:n===`v`?r(t)?e.metaKey:e.ctrlKey&&e.shiftKey:!1}function Ut(){return/linux|bsd/i.test(navigator.platform)}function Wt(e){return e.inputType===``||e.inputType===`insertCompositionText`||e.inputType===`insertFromComposition`}function Gt(e,t){return e.isComposing||t||e.key===`Process`||e.keyCode===229}function Kt(e){return e.getModifierState(`AltGraph`)&&[...e.key].length===1}function qt(e,t){return e&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey}function Jt(e,t,n){let r=e===`motion`?t:``;return{send:t.length>0&&(e!==`motion`||t!==n),nextMotionData:r}}function Yt(e,t,n){return{tracking:t,motionData:e===t?n:``}}function Xt(e,t,n,r){let i=r+(e.deltaMode===1?e.deltaY*t:e.deltaMode===2?e.deltaY*n*t:e.deltaY)/t,a=Math.trunc(i);return{rows:a,remainder:i-a}}function Zt(e,t){return e===0?``:(e<0?t?`\x1BOA`:`\x1B[A`:t?`\x1BOB`:`\x1B[B`).repeat(Math.abs(e))}function Qt(e){switch(e){case 0:return 1;case 1:return 3;case 2:return 2;case 3:return 4;case 4:return 5;default:return null}}var $t=4;function en(e,t){return{count:e!==null&&t.timeStamp-e.time<=500&&Math.hypot(t.clientX-e.x,t.clientY-e.y)<=$t?e.count>=3?1:e.count+1:1,time:t.timeStamp,x:t.clientX,y:t.clientY}}var tn=class e{canvas;input;scrollbar;cols=1;rows=1;mount;context;core;options;visible;hasSize=!1;metrics;fontFamily;requestedFontFamily;fontSize;fontEpoch=0;pendingFontEpoch=null;stopObservingResize;scrollbarThumb;snapshot=null;frame=0;cursorTimer=null;compositionInputToSuppress=null;compositionSuppressionTimer=null;cursorOn=!0;renderedCursorY=null;forceFullRender=!0;scrollbarDirty=!0;scrollbarState=null;scrollbarPointerId=null;scrollbarPointerOffset=0;disposed=!1;resizeNotifyTimer=null;originY=$;mountHeight=0;selectionEnd=null;selectionAnchorScreen=null;selectionEndScreen=null;selectionMode=`cell`;selectionBase=null;selectionScrollTimer=null;selectionScrollDelta=0;selectionPointer=null;mouseReportingPointerId=null;mouseReportingButton=null;linkActivationPointerId=null;linkActivationLink=null;linkActivationOrigin=null;hoveredLink=null;hoverPointer=null;selectionClickSequence=null;selectionMoved=!1;composing=!1;focused=!1;resizeNotified=!1;canvasConfigured=!1;theme;suppressedKeyCodes=new Set;pasteShortcutToken=0;copyShortcutToken=0;clearSelectionAfterCopy=!1;primedCopySelection=``;wheelRemainder=0;touchScroll=null;lastMouseMotionData=``;mouseAnyEventTracking=!1;dprMedia=null;reducedMotionMedia=window.matchMedia?.(`(prefers-reduced-motion: reduce)`);inputLeft=-1;inputTop=-1;constructor(e,t,n,r,i,a,o,s,c,l){this.mount=e,this.canvas=t,this.input=n,this.scrollbar=r,this.scrollbarThumb=i,this.context=a,this.core=o,this.mouseAnyEventTracking=o.isMouseAnyEventTracking(),this.metrics=s,this.options=l,this.visible=l.visible??!0,this.theme=l.theme,this.fontFamily=c,this.requestedFontFamily=l.font?.family,this.fontSize=Dt(l.font?.size),this.installEvents(),this.watchDevicePixelRatio(),this.reducedMotionMedia?.addEventListener(`change`,this.onReducedMotionChange),document.fonts.addEventListener(`loadingdone`,this.onFontsLoaded),this.stopObservingResize=ge(e,()=>this.fit())}static async create(t,n){let r=document.createElement(`canvas`);r.className=`block size-full cursor-text`,r.style.touchAction=`pan-x pinch-zoom`,r.setAttribute(`aria-hidden`,`true`);let i=document.createElement(`textarea`);i.className=`t3-ghostty-input`,i.setAttribute(`aria-label`,`Terminal input`),i.autocapitalize=`off`,i.autocomplete=`off`,i.spellcheck=!1,i.style.cssText=`position:absolute;left:4px;top:4px;width:1px;height:1px;opacity:0;padding:0;border:0;resize:none;pointer-events:none;`;let a=document.createElement(`div`);a.className=`group absolute top-1 right-px bottom-1 z-1 w-[var(--app-scrollbar-width)] cursor-default touch-none`,a.setAttribute(`role`,`scrollbar`),a.setAttribute(`aria-label`,`Terminal scrollback`),a.setAttribute(`aria-orientation`,`vertical`),a.tabIndex=0,a.hidden=!0;let o=document.createElement(`div`);o.className=`absolute inset-x-px top-0 rounded-[3px] bg-[var(--app-scrollbar-thumb)] transition-[background-color] duration-[120ms] ease-[ease-out] group-hover:bg-[var(--app-scrollbar-thumb-hover)] group-focus-visible:bg-[var(--app-scrollbar-thumb-hover)]`,a.append(o),t.replaceChildren(r,i,a);let s=r.getContext(`2d`,{alpha:!1});if(!s)throw Error(`Canvas 2D is unavailable`);s.fillStyle=`rgb(${n.theme.background.r}, ${n.theme.background.g}, ${n.theme.background.b})`,s.fillRect(0,0,r.width,r.height);let c=Dt(n.font?.size);try{await St()}catch{}let l=await Et(n.font?.family,c),u=ut(s,c,l),d=Q(t.clientWidth,t.clientHeight,u,$),f=await it.create(d.cols,d.rows,u.width,u.height,n.theme,n.onData),p=new e(t,r,i,a,o,s,f,u,l,n);return p.fit(),p}setVisible(e){if(!(this.disposed||this.visible===e)){if(this.visible=e,this.cursorOn=!0,this.forceFullRender=!0,this.scrollbarDirty=!0,!e){this.cancelRender(),this.setSelectionAutoscroll(0);return}this.fit()}}write(e){this.disposed||(this.core.write(e),this.synchronizeMouseTrackingState(),this.cursorOn=!0,this.scrollbarDirty=!0,this.requestRender())}resetAndWrite(e){this.disposed||(this.lastMouseMotionData=``,this.core.resetAndWrite(e),this.synchronizeMouseTrackingState(),this.cursorOn=!0,this.forceFullRender=!0,this.scrollbarDirty=!0,this.requestRender())}setTheme(e){this.disposed||(this.theme=e,this.core.setTheme(e),this.forceFullRender=!0,this.requestRender())}refreshLinkActivation(){this.disposed||this.refreshHoveredLink()}async setFont(e){if(this.disposed)return;let t=Dt(e.size),n=++this.fontEpoch;this.pendingFontEpoch=n;let r=await Et(e.family,t);this.disposed||n!==this.fontEpoch||(this.pendingFontEpoch=null,this.fontFamily=r,this.requestedFontFamily=e.family,this.fontSize=t,this.applyFontMetrics())}applyFontMetrics(){this.metrics=ut(this.context,this.fontSize,this.fontFamily),this.core.resize(this.cols,this.rows,this.metrics.width,this.metrics.height),this.inputLeft=-1,this.inputTop=-1,this.forceFullRender=!0,this.scrollbarDirty=!0,this.fit(),this.requestRender()}onReducedMotionChange=()=>{this.disposed||(this.cursorOn=!0,this.requestRender())};onFontsLoaded=()=>{if(this.disposed||this.pendingFontEpoch!==null)return;let e=Tt(this.requestedFontFamily);if(e!==this.fontFamily){this.fontFamily=e,this.applyFontMetrics();return}let t=ut(this.context,this.fontSize,this.fontFamily);(t.width!==this.metrics.width||t.height!==this.metrics.height||t.baseline!==this.metrics.baseline)&&this.applyFontMetrics()};resendSize(){this.resizeNotified=!1,this.fit()}fit(){if(this.disposed||!this.visible)return!1;let e=this.mount.clientWidth,t=this.mount.clientHeight;if(e<=0||t<=0)return this.hasSize=!1,this.forceFullRender=!0,this.cancelRender(),!1;this.hasSize=!0;let n=window.devicePixelRatio||1,r=Math.max(1,Math.round(e*n)),i=Math.max(1,Math.round(t*n)),a=!1;(this.canvas.width!==r||this.canvas.height!==i||!this.canvasConfigured)&&(this.canvas.width=r,this.canvas.height=i,this.context.setTransform(n,0,0,n,0,0),this.canvasConfigured=!0,this.forceFullRender=!0,this.scrollbarDirty=!0,a=!0);let o=Q(e,t,this.metrics,$);return this.mountHeight=t,(o.cols!==this.cols||o.rows!==this.rows||!this.resizeNotified)&&(this.cols=o.cols,this.rows=o.rows,this.core.resize(o.cols,o.rows,this.metrics.width,this.metrics.height),this.notifyResize(),this.forceFullRender=!0,this.scrollbarDirty=!0,a=!0),(a||this.forceFullRender)&&this.renderFrame(),!0}notifyResize(){this.resizeNotified=!0,this.resizeNotifyTimer!==null&&window.clearTimeout(this.resizeNotifyTimer),this.resizeNotifyTimer=window.setTimeout(()=>{this.resizeNotifyTimer=null,this.disposed||this.options.onResize(this.cols,this.rows)},150)}onWindowPointerRelease=()=>{this.disposed||this.resizeNotifyTimer===null||(this.fit(),this.resizeNotifyTimer!==null&&(window.clearTimeout(this.resizeNotifyTimer),this.resizeNotifyTimer=null,this.options.onResize(this.cols,this.rows)))};focus(){!this.disposed&&this.visible&&this.input.focus({preventScroll:!0})}async pasteFromClipboard(e,t=()=>!0){let n=++this.pasteShortcutToken,r=await e();if(this.disposed||this.pasteShortcutToken!==n||!t()||(this.pasteShortcutToken+=1,r.length===0))return;let i=this.core.encodePaste(r);i.length>0&&this.options.onData(i)}pasteTerminalSelection(){let e=this.getSelection();e.length!==0&&this.pasteFromClipboard(()=>Promise.resolve(e))}hasSelection(){return this.core.selectionText().length>0}getSelection(){return this.core.selectionText()}selectAll(){this.clearPrimedCopy();let e=this.core.selectAll();this.selectionAnchorScreen=e?.start??null,this.selectionEndScreen=e?.end??null,this.selectionEnd=e?this.core.screenPointToViewport(e.end.x,e.end.y):null,this.selectionMode=`cell`,this.selectionBase=null,this.setSelectionAutoscroll(0),this.options.onSelectionChange(),this.forceFullRender=!0,this.requestRender()}getSelectionPosition(){return!this.selectionAnchorScreen||!this.selectionEndScreen||!this.hasSelection()?null:this.selectionAnchorScreen.y<this.selectionEndScreen.y||this.selectionAnchorScreen.y===this.selectionEndScreen.y&&this.selectionAnchorScreen.x<=this.selectionEndScreen.x?{start:this.selectionAnchorScreen,end:this.selectionEndScreen}:{start:this.selectionEndScreen,end:this.selectionAnchorScreen}}getSelectionEndClientRect(){let e=this.getSelectionPosition();if(!e)return null;let t=this.core.screenPointToViewport(e.end.x,e.end.y);if(!t||t.x<0||t.x>=this.cols||t.y<0||t.y>=this.rows)return null;let n=this.canvas.getBoundingClientRect();return{right:n.left+$+(t.x+1)*this.metrics.width,bottom:n.top+this.originY+(t.y+1)*this.metrics.height}}clearSelection(){this.clearPrimedCopy(),this.core.clearSelection(),this.selectionEnd=null,this.selectionAnchorScreen=null,this.selectionEndScreen=null,this.selectionMode=`cell`,this.selectionBase=null,this.setSelectionAutoscroll(0),this.options.onSelectionChange(),this.forceFullRender=!0,this.requestRender()}scrollToBottom(){this.core.scrollToBottom(),this.forceFullRender=!0,this.scrollbarDirty=!0,this.requestRender()}isAtBottom(){return this.core.isViewportActive()}dispose(){this.disposed||(this.disposed=!0,this.stopObservingResize(),document.fonts.removeEventListener(`loadingdone`,this.onFontsLoaded),this.dprMedia?.removeEventListener(`change`,this.onDevicePixelRatioChange),this.dprMedia=null,this.reducedMotionMedia?.removeEventListener(`change`,this.onReducedMotionChange),this.selectionScrollTimer!==null&&window.clearInterval(this.selectionScrollTimer),this.resizeNotifyTimer!==null&&(window.clearTimeout(this.resizeNotifyTimer),this.resizeNotifyTimer=null,this.options.onResize(this.cols,this.rows)),this.cancelRender(),this.compositionSuppressionTimer!==null&&window.clearTimeout(this.compositionSuppressionTimer),this.removeEvents(),this.core.dispose(),(this.canvas.parentElement===this.mount||this.input.parentElement===this.mount||this.scrollbar.parentElement===this.mount)&&(this.canvas.remove(),this.input.remove(),this.scrollbar.remove()))}onKeyDown=e=>{if(Kt(e)||!this.options.beforeKey(e)){this.suppressedKeyCodes.add(e.code);return}if(Gt(e,this.composing)){this.suppressedKeyCodes.add(e.code);return}let t=r(navigator.platform),n=t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey;if(e.key.toLowerCase()===`a`&&n&&!e.altKey&&(t?!e.shiftKey:e.shiftKey)){e.preventDefault(),e.stopPropagation(),this.suppressedKeyCodes.add(e.code),this.selectAll();return}let i=e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&(e.key===`PageUp`||e.key===`PageDown`),a=e.shiftKey&&!e.altKey&&n&&(e.key===`Home`||e.key===`End`);if((i||a)&&!this.core.isAlternateScreen()){let t=this.readScrollbarState();if(t!==null){e.preventDefault(),e.stopPropagation(),this.suppressedKeyCodes.add(e.code);let n=e.key===`Home`?-t.offset:e.key===`End`?t.total-t.len-t.offset:Math.max(1,t.len)*(e.key===`PageUp`?-1:1);this.scrollViewport(n);return}}if(Rt(e)&&this.hasSelection()){let t=this.getSelection();if(this.primeCopy(t),e.shiftKey||e.key.toLowerCase()===`insert`)e.preventDefault(),document.execCommand(`copy`);else{this.clearSelectionAfterCopy=!e.shiftKey&&!r(navigator.platform);let n=navigator.clipboard;if(typeof n?.writeText==`function`){let e=++this.copyShortcutToken;Promise.resolve().then(()=>{this.disposed||this.copyShortcutToken!==e||n.writeText(t).then(()=>{this.disposed||this.copyShortcutToken!==e||this.clearSelectionAfterCopy&&(this.clearSelectionAfterCopy=!1,this.clearSelection())},()=>{this.copyShortcutToken===e&&(this.clearSelectionAfterCopy=!1)})})}}this.suppressedKeyCodes.add(e.code);return}if(Ht(e)){this.suppressedKeyCodes.add(e.code);let t=navigator.clipboard;if(typeof t?.readText==`function`){let e=++this.pasteShortcutToken;t.readText().then(t=>{this.disposed||this.pasteShortcutToken!==e||(this.pasteShortcutToken+=1,t.length>0&&this.options.onData(this.core.encodePaste(t)))},()=>{})}return}this.clearPrimedCopy();let o=this.core.encodeKey(e);o.length!==0&&(this.suppressedKeyCodes.delete(e.code),e.preventDefault(),e.stopPropagation(),this.options.onData(o))};onKeyUp=e=>{if(this.suppressedKeyCodes.delete(e.code)||Gt(e,this.composing))return;let t=this.core.encodeKey(e,`release`);t.length!==0&&(e.preventDefault(),e.stopPropagation(),this.options.onData(t))};onFocus=()=>{this.focused=!0,this.cursorOn=!0,this.requestRender()};onBlur=()=>{this.focused=!1,this.refreshHoveredLink(),this.cursorOn=!0,this.requestRender()};onDevicePixelRatioChange=()=>{this.watchDevicePixelRatio(),this.fit()};watchDevicePixelRatio(){this.dprMedia?.removeEventListener(`change`,this.onDevicePixelRatioChange),this.dprMedia=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this.dprMedia.addEventListener(`change`,this.onDevicePixelRatioChange)}primeCopy(e){this.primedCopySelection=e,zt(this.input,e)}clearPrimedCopy(){Bt(this.input,this.primedCopySelection),this.primedCopySelection=``}onCopyEvent=e=>{let t=this.hasSelection()?this.getSelection():this.input.value;this.primeCopy(t);let n=Vt(t,e.clipboardData);n.preventDefault&&e.preventDefault(),n.claimWriteFallback&&(this.copyShortcutToken+=1,this.clearSelectionAfterCopy&&(this.clearSelectionAfterCopy=!1,this.clearSelection()))};onPaste=e=>{e.preventDefault();let t=e.clipboardData?.getData(`text/plain`)??``;t.length!==0&&(this.pasteShortcutToken+=1,this.options.onData(this.core.encodePaste(t)))};onCompositionStart=()=>{this.clearPrimedCopy(),this.clearCompositionInputSuppression(),this.composing=!0};onCompositionEnd=e=>{this.composing=!1;let t=this.input.value||e.data;t.length>0&&this.options.onData(t),this.input.value=``,this.compositionInputToSuppress=t,this.compositionSuppressionTimer=window.setTimeout(()=>{this.compositionInputToSuppress=null,this.compositionSuppressionTimer=null},100)};onInput=e=>{let t=e;if(this.composing||t.isComposing)return;let n=this.input.value||t.data||``;if(n===this.compositionInputToSuppress&&Wt(t)){this.clearCompositionInputSuppression(),this.input.value=``;return}this.clearCompositionInputSuppression(),n.length>0&&this.options.onData(n),this.input.value=``};clearCompositionInputSuppression(){this.compositionSuppressionTimer!==null&&(window.clearTimeout(this.compositionSuppressionTimer),this.compositionSuppressionTimer=null),this.compositionInputToSuppress=null}onPointerDown=e=>{if(e.pointerType===`touch`){if(e.preventDefault(),!e.isPrimary||this.touchScroll!==null)return;this.touchScroll={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,lastY:e.clientY,remainder:0,moved:!1},this.clearHoveredLink(),this.canvas.setPointerCapture(e.pointerId);return}if(this.focus(),qt(this.core.isMouseTracking(),e)){let t=Qt(e.button);if(t===null)return;e.preventDefault(),e.stopPropagation(),this.clearHoveredLink(`default`),this.mouseReportingPointerId=e.pointerId,this.mouseReportingButton=t,this.sendMouse(`press`,t,e),this.canvas.setPointerCapture(e.pointerId);return}if(e.button===1&&Ut()){this.pasteTerminalSelection();return}if(e.button!==0)return;let t=this.recordSelectionClick(e),n=this.linkAt(e.clientX,e.clientY);if(n&&!e.shiftKey&&t===1){e.preventDefault(),e.stopPropagation(),this.linkActivationPointerId=e.pointerId,this.linkActivationLink=n,this.linkActivationOrigin={x:e.clientX,y:e.clientY,clickCount:t},this.canvas.setPointerCapture(e.pointerId);return}this.clearHoveredLink(),this.beginSelection(e,t),this.canvas.setPointerCapture(e.pointerId)};recordSelectionClick(e){return this.selectionClickSequence=en(this.selectionClickSequence,e),this.selectionClickSequence.count}beginSelection(e,t){let n=this.cellAt(e.clientX,e.clientY);this.selectionMoved=!1,this.selectionMode=t>=3?`line`:t===2?`word`:`cell`;let r=this.selectionMode===`line`?this.core.selectLine(n.x,n.y):this.selectionMode===`word`?this.core.selectWord(n.x,n.y):null;if(r)this.selectionBase=r.screen,this.selectionEnd=r.viewport.end,this.selectionAnchorScreen=r.screen.start,this.selectionEndScreen=r.screen.end,this.options.onSelectionChange();else{this.selectionMode=`cell`,this.selectionBase=null,this.selectionEnd=n;let e=this.core.viewportPointToScreen(n.x,n.y);this.selectionAnchorScreen=e,this.selectionEndScreen=e,e?this.core.setSelection({...e,tag:2},{...e,tag:2}):this.core.setSelection(n,n)}this.forceFullRender=!0,this.requestRender()}onPointerMove=e=>{if(e.pointerType===`touch`){let t=this.touchScroll;if(t?.pointerId!==e.pointerId||(e.preventDefault(),t.moved||=Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>$t,!t.moved))return;let n=Xt({deltaY:t.lastY-e.clientY,deltaMode:0},this.metrics.height,this.rows,t.remainder);t.lastY=e.clientY,t.remainder=n.remainder,this.scrollRows(n.rows,e);return}if(this.linkActivationPointerId===e.pointerId){let t=this.linkActivationOrigin;if(t===null||Math.hypot(e.clientX-t.x,e.clientY-t.y)<=$t)return;this.linkActivationPointerId=null,this.linkActivationLink=null,this.linkActivationOrigin=null,this.clearHoveredLink(),this.beginSelection({clientX:t.x,clientY:t.y},t.clickCount)}let t=this.synchronizeMouseTrackingState();if(this.mouseReportingPointerId===e.pointerId||qt(t,e)){e.preventDefault(),this.hoverPointer={x:e.clientX,y:e.clientY},this.setHoveredLink(null),this.canvas.style.cursor=`default`,this.sendMouse(`motion`,this.buttonFromButtons(e.buttons),e);return}if(this.lastMouseMotionData=``,!this.selectionAnchorScreen||!this.canvas.hasPointerCapture(e.pointerId)){this.updateHoverCursor(e);return}this.clearHoveredLink(),this.selectionPointer={x:e.clientX,y:e.clientY};let n=this.canvas.getBoundingClientRect(),r=Math.max(n.top,0)+$,i=Math.min(n.bottom,window.innerHeight)-$;this.setSelectionAutoscroll(e.clientY<r?-1:+(e.clientY>i));let a=this.cellAt(e.clientX,e.clientY);(a.x!==this.selectionEnd?.x||a.y!==this.selectionEnd.y)&&this.extendSelectionTo(e.clientX,e.clientY)};extendSelectionTo(e,t){let n=this.selectionAnchorScreen;if(n===null)return;let r=this.cellAt(e,t);this.selectionMoved=!0,this.selectionEnd=r;let i=this.selectionMode===`line`?this.core.selectLine(r.x,r.y):this.selectionMode===`word`?this.core.selectWord(r.x,r.y):null,a=this.core.viewportPointToScreen(r.x,r.y);if(a===null)return;let o=this.selectionBase,s=o!==null&&(a.y<o.start.y||a.y===o.start.y&&a.x<o.start.x),c=o===null?n:s?o.end:o.start,l=i===null?a:s?i.screen.start:i.screen.end;this.selectionAnchorScreen=c,this.selectionEndScreen=l,this.core.setSelection({...c,tag:2},{...l,tag:2}),this.options.onSelectionChange(),this.forceFullRender=!0,this.requestRender()}setSelectionAutoscroll(e){if(this.selectionScrollDelta=e,e===0){this.selectionScrollTimer!==null&&(window.clearInterval(this.selectionScrollTimer),this.selectionScrollTimer=null);return}this.selectionScrollTimer===null&&(this.selectionScrollTimer=window.setInterval(()=>{if(this.disposed||this.selectionScrollDelta===0)return;this.scrollViewport(this.selectionScrollDelta);let e=this.selectionPointer;e&&this.extendSelectionTo(e.x,e.y)},80))}updateHoverCursor(e){this.hoverPointer={x:e.clientX,y:e.clientY},this.refreshHoveredLink()}onPointerLeave=()=>{this.lastMouseMotionData=``,this.clearHoveredLink()};clearHoveredLink(e=``){this.hoverPointer=null,this.setHoveredLink(null),this.canvas.style.cursor=e}refreshHoveredLink(){let e=this.hoverPointer,t=e?this.linkAt(e.x,e.y):null;this.setHoveredLink(t)}setHoveredLink(e){let t=this.hoveredLink,n=t?.text===e?.text&&t?.range.start.x===e?.range.start.x&&t?.range.start.y===e?.range.start.y&&t?.range.end.x===e?.range.end.x&&t?.range.end.y===e?.range.end.y;this.canvas.style.cursor=e?`pointer`:``,!n&&(this.hoveredLink=e,this.forceFullRender=!0,this.requestRender())}onPointerUp=e=>{if(e.pointerType===`touch`){let t=this.touchScroll;if(t?.pointerId!==e.pointerId||(this.touchScroll=null,e.preventDefault(),this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId),e.type===`pointercancel`||t.moved))return;if(this.focus(),qt(this.core.isMouseTracking(),e))this.sendMouse(`press`,Qt(0),e),this.sendMouse(`release`,Qt(0),e);else{let t=this.linkAt(e.clientX,e.clientY);t?this.options.onLinkActivate(t.text,e):this.clearSelection()}return}if(this.setSelectionAutoscroll(0),this.linkActivationPointerId===e.pointerId){e.preventDefault(),e.stopPropagation();let t=this.linkActivationLink;this.linkActivationPointerId=null,this.linkActivationLink=null,this.linkActivationOrigin=null,this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId),e.type!==`pointercancel`&&t&&Ft(t,this.linkAt(e.clientX,e.clientY))&&this.options.onLinkActivate(t.text,e);return}if(this.mouseReportingPointerId===e.pointerId){e.preventDefault(),e.stopPropagation(),this.sendMouse(`release`,this.mouseReportingButton,e),this.mouseReportingPointerId=null,this.mouseReportingButton=null,this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId),e.type===`pointercancel`?this.clearHoveredLink():(this.hoverPointer={x:e.clientX,y:e.clientY},this.refreshHoveredLink());return}if(this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId),e.button===1&&Ut()){e.preventDefault();return}e.button===0&&(!this.selectionMoved&&this.selectionMode===`cell`&&this.clearSelection(),this.options.onSelectionChange())};onWheel=e=>{if(e.deltaY===0)return;e.preventDefault();let t=Xt(e,this.metrics.height,this.rows,this.wheelRemainder);this.wheelRemainder=t.remainder,this.scrollRows(t.rows,e)};scrollRows(e,t){if(e===0)return;let n=Math.abs(e);if(qt(this.core.isMouseTracking(),t)){let r=e<0?4:5;for(let e=0;e<n;e+=1)this.sendMouse(`press`,r,t);return}if(this.core.isAlternateScreen()){this.options.onData(Zt(e,this.core.isApplicationCursorKeys()));return}this.scrollViewport(e)}onMouseDown=e=>{(e.button===0||e.button===1&&Ut())&&e.preventDefault(),this.focus()};onMouseUp=e=>{e.button===1&&Ut()&&e.preventDefault()};onContextMenu=e=>{if(qt(this.core.isMouseTracking(),e)){e.preventDefault();return}this.options.onContextMenu?.(e)};onScrollbarPointerDown=e=>{if(e.button!==0)return;let t=this.readScrollbarState();if(t===null)return;let n=this.scrollbar.getBoundingClientRect(),r=At(t,n.height);r!==null&&(e.preventDefault(),e.stopPropagation(),this.scrollbarPointerId=e.pointerId,this.scrollbarPointerOffset=e.target===this.scrollbarThumb?e.clientY-n.top-r.thumbTop:r.thumbHeight/2,this.scrollbar.setPointerCapture(e.pointerId),this.scrollbarToPointer(e.clientY,n))};onScrollbarPointerMove=e=>{e.pointerId===this.scrollbarPointerId&&this.scrollbarState!==null&&(e.preventDefault(),this.scrollbarToPointer(e.clientY,this.scrollbar.getBoundingClientRect()))};onScrollbarPointerUp=e=>{e.pointerId===this.scrollbarPointerId&&(e.preventDefault(),this.scrollbarPointerId=null,this.scrollbar.hasPointerCapture(e.pointerId)&&this.scrollbar.releasePointerCapture(e.pointerId))};onScrollbarKeyDown=e=>{let t=this.readScrollbarState();if(t===null)return;let n=0;switch(e.key){case`ArrowUp`:n=-1;break;case`ArrowDown`:n=1;break;case`PageUp`:n=-Math.max(1,t.len);break;case`PageDown`:n=Math.max(1,t.len);break;case`Home`:n=-t.offset;break;case`End`:n=t.total-t.len-t.offset;break;default:return}e.preventDefault(),e.stopPropagation(),this.scrollViewport(n)};installEvents(){this.input.addEventListener(`keydown`,this.onKeyDown),this.input.addEventListener(`keyup`,this.onKeyUp),this.input.addEventListener(`focus`,this.onFocus),this.input.addEventListener(`blur`,this.onBlur),this.input.addEventListener(`input`,this.onInput),this.input.addEventListener(`paste`,this.onPaste),this.input.addEventListener(`copy`,this.onCopyEvent),this.input.addEventListener(`compositionstart`,this.onCompositionStart),this.input.addEventListener(`compositionend`,this.onCompositionEnd),this.canvas.addEventListener(`pointerdown`,this.onPointerDown),this.canvas.addEventListener(`pointermove`,this.onPointerMove),this.canvas.addEventListener(`pointerleave`,this.onPointerLeave),this.canvas.addEventListener(`pointerup`,this.onPointerUp),this.canvas.addEventListener(`pointercancel`,this.onPointerUp),this.canvas.addEventListener(`wheel`,this.onWheel,{passive:!1}),this.canvas.addEventListener(`mousedown`,this.onMouseDown),this.canvas.addEventListener(`mouseup`,this.onMouseUp),this.canvas.addEventListener(`contextmenu`,this.onContextMenu),this.scrollbar.addEventListener(`pointerdown`,this.onScrollbarPointerDown),this.scrollbar.addEventListener(`pointermove`,this.onScrollbarPointerMove),this.scrollbar.addEventListener(`pointerup`,this.onScrollbarPointerUp),this.scrollbar.addEventListener(`pointercancel`,this.onScrollbarPointerUp),this.scrollbar.addEventListener(`keydown`,this.onScrollbarKeyDown),window.addEventListener(`pointerup`,this.onWindowPointerRelease),window.addEventListener(`pointercancel`,this.onWindowPointerRelease)}removeEvents(){this.input.removeEventListener(`keydown`,this.onKeyDown),this.input.removeEventListener(`keyup`,this.onKeyUp),this.input.removeEventListener(`focus`,this.onFocus),this.input.removeEventListener(`blur`,this.onBlur),this.input.removeEventListener(`input`,this.onInput),this.input.removeEventListener(`paste`,this.onPaste),this.input.removeEventListener(`copy`,this.onCopyEvent),this.input.removeEventListener(`compositionstart`,this.onCompositionStart),this.input.removeEventListener(`compositionend`,this.onCompositionEnd),this.canvas.removeEventListener(`pointerdown`,this.onPointerDown),this.canvas.removeEventListener(`pointermove`,this.onPointerMove),this.canvas.removeEventListener(`pointerleave`,this.onPointerLeave),this.canvas.removeEventListener(`pointerup`,this.onPointerUp),this.canvas.removeEventListener(`pointercancel`,this.onPointerUp),this.canvas.removeEventListener(`wheel`,this.onWheel),this.canvas.removeEventListener(`mousedown`,this.onMouseDown),this.canvas.removeEventListener(`mouseup`,this.onMouseUp),this.canvas.removeEventListener(`contextmenu`,this.onContextMenu),this.scrollbar.removeEventListener(`pointerdown`,this.onScrollbarPointerDown),this.scrollbar.removeEventListener(`pointermove`,this.onScrollbarPointerMove),this.scrollbar.removeEventListener(`pointerup`,this.onScrollbarPointerUp),this.scrollbar.removeEventListener(`pointercancel`,this.onScrollbarPointerUp),this.scrollbar.removeEventListener(`keydown`,this.onScrollbarKeyDown),window.removeEventListener(`pointerup`,this.onWindowPointerRelease),window.removeEventListener(`pointercancel`,this.onWindowPointerRelease)}scrollViewport(e){let t=Math.trunc(e),n=this.readScrollbarState();if(n!==null){let e=Math.max(0,n.total-n.len),r=Math.max(0,Math.min(n.offset+t,e));t=r-n.offset,this.scrollbarState={...n,offset:r}}t!==0&&(this.core.scroll(t),this.forceFullRender=!0,this.scrollbarDirty=!0,this.requestRender())}scrollbarToPointer(e,t){let n=this.scrollbarState;if(n===null)return;let r=jt(n,t.height,e-t.top,this.scrollbarPointerOffset);this.scrollViewport(r-n.offset)}updateScrollbar(){let e=this.readScrollbarState(),t=e===null?null:At(e,Math.max(0,this.mount.clientHeight-8));this.scrollbar.hidden=t===null,e!==null&&t!==null&&(this.scrollbar.setAttribute(`aria-valuemin`,`0`),this.scrollbar.setAttribute(`aria-valuemax`,String(t.maxOffset)),this.scrollbar.setAttribute(`aria-valuenow`,String(Math.max(0,Math.min(e.offset,t.maxOffset)))),this.scrollbarThumb.style.height=`${t.thumbHeight}px`,this.scrollbarThumb.style.transform=`translateY(${t.thumbTop}px)`)}readScrollbarState(){let e=this.core.scrollbarState();return this.scrollbarState=e,e}requestRender(){!this.disposed&&this.visible&&this.hasSize&&this.frame===0&&(this.frame=window.requestAnimationFrame(()=>{this.frame=0,this.renderFrame()}))}cancelRender(){this.frame!==0&&(window.cancelAnimationFrame(this.frame),this.frame=0),this.cursorTimer!==null&&(window.clearTimeout(this.cursorTimer),this.cursorTimer=null)}renderFrame(){if(this.disposed||!this.visible)return;if(this.frame!==0&&(window.cancelAnimationFrame(this.frame),this.frame=0),this.mount.clientWidth===0||this.mount.clientHeight===0){this.hasSize=!1,this.forceFullRender=!0,this.cancelRender();return}this.snapshot=this.core.snapshot(),this.blinkEnabled()||(this.cursorOn=!0);let e=this.readScrollbarState(),t=e!==null&&e.total>e.len,n=kt(this.mountHeight,$,this.rows,this.metrics.height,t);n!==this.originY&&(this.originY=n,this.forceFullRender=!0),this.refreshHoveredLink(),dt({context:this.context,snapshot:this.snapshot,metrics:this.metrics,fontSize:this.fontSize,fontFamily:this.fontFamily,padding:$,originY:this.originY,forceFull:this.forceFullRender,cursorOn:this.cursorOn,previousCursorY:this.renderedCursorY,focused:this.focused,hoveredLinkRange:this.hoveredLink?.range??null,...this.theme.selectionBackground===void 0?{}:{selectionBackground:this.theme.selectionBackground}}),this.positionInput(),this.renderedCursorY=this.cursorOn&&this.snapshot.cursorVisible&&this.snapshot.cursorY>=0?this.snapshot.cursorY:null,this.scrollbarDirty&&(this.scrollbarDirty=!1,this.updateScrollbar()),this.forceFullRender=!1,this.scheduleCursorBlink()}scheduleCursorBlink(){this.cursorTimer!==null&&window.clearTimeout(this.cursorTimer),this.cursorTimer=null,this.blinkEnabled()&&(this.cursorTimer=window.setTimeout(()=>{this.cursorTimer=null,this.cursorOn=!this.cursorOn,this.requestRender()},vt))}blinkEnabled(){let e=this.snapshot;return!e||!this.visible||!this.hasSize?!1:Ot({focused:this.focused,cursorBlinking:e.cursorBlinking,cursorVisible:e.cursorVisible,reducedMotion:this.reducedMotionMedia?.matches??!1})}positionInput(){let e=this.snapshot;if(!e||!e.cursorVisible||e.cursorX<0||e.cursorY<0)return;let t=$+e.cursorX*this.metrics.width,n=this.originY+e.cursorY*this.metrics.height;(t!==this.inputLeft||n!==this.inputTop)&&(this.inputLeft=t,this.inputTop=n,this.input.style.left=`${t}px`,this.input.style.top=`${n}px`,this.input.style.height=`${this.metrics.height}px`)}cellAt(e,t){let n=this.canvas.getBoundingClientRect();return{x:Math.max(0,Math.min(this.cols-1,Math.floor((e-n.left-$)/this.metrics.width))),y:Math.max(0,Math.min(this.rows-1,Math.floor((t-n.top-this.originY)/this.metrics.height)))}}linkAt(e,t){let n=this.findLinkAt(e,t);return n&&this.options.canActivateLink?.(n.text)!==!1?n:null}findLinkAt(e,t){if(!this.snapshot)return null;let n=Mt({bounds:this.canvas.getBoundingClientRect(),clientX:e,clientY:t,cols:this.cols,rows:this.rows,metrics:this.metrics,padding:$,originY:this.originY});if(!n)return null;let r=this.core.hyperlinkAt(n.x,n.y);if(r){let e={...n},t={...n};for(;;){let t=e.x>0?{x:e.x-1,y:e.y}:e.y>0&&this.snapshot.rowData[e.y]?.isWrapContinuation?{x:this.cols-1,y:e.y-1}:null;if(!t||this.core.hyperlinkAt(t.x,t.y)!==r)break;e.x=t.x,e.y=t.y}for(;;){let e=t.x+1<this.cols?{x:t.x+1,y:t.y}:t.y+1<this.rows&&this.snapshot.rowData[t.y]?.wrapsToNext?{x:0,y:t.y+1}:null;if(!e||this.core.hyperlinkAt(e.x,e.y)!==r)break;t.x=e.x,t.y=e.y}return{text:r,range:{start:e,end:t}}}return Lt(this.snapshot.rowData,n.y,n.x)}sendMouse(e,t,n){let r=this.canvas.getBoundingClientRect(),i=this.core.encodeMouse({action:e,button:t,mods:+!!n.shiftKey|(n.ctrlKey?2:0)|(n.altKey?4:0)|(n.metaKey?8:0),x:Math.max(0,n.clientX-r.left),y:Math.max(0,n.clientY-r.top),screenWidth:r.width,screenHeight:r.height,cellWidth:this.metrics.width,cellHeight:this.metrics.height,paddingLeft:$,paddingRight:$,paddingTop:this.originY,paddingBottom:Math.max(0,r.height-this.originY-this.rows*this.metrics.height),anyButtonPressed:n.buttons!==0}),a=Jt(e,i,this.lastMouseMotionData);this.lastMouseMotionData=a.nextMotionData,a.send&&this.options.onData(i)}synchronizeMouseTrackingState(){let e=this.core.isMouseAnyEventTracking(),t=Yt(this.mouseAnyEventTracking,e,this.lastMouseMotionData);return this.mouseAnyEventTracking=t.tracking,this.lastMouseMotionData=t.motionData,e}buttonFromButtons(e){return e&1?1:e&4?3:e&2?2:e&8?4:e&16?5:null}};function nn(e){let t=(0,Re.c)(14),{children:n,label:r,onClick:i,tooltip:a}=e,o;t[0]===n?o=t[1]:(o=(0,R.jsx)(`span`,{className:`relative flex size-3 items-center justify-center group-hover/tab:hidden group-focus-visible/close:hidden`,children:n}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,R.jsx)(u,{className:`hidden size-3 group-hover/tab:block group-focus-visible/close:block`}),t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==i||t[5]!==o?(c=(0,R.jsxs)(`button`,{type:`button`,className:`cursor-pointer group/close relative flex size-4 shrink-0 items-center justify-center rounded-sm hover:bg-muted`,"aria-label":r,onClick:i,children:[o,s]}),t[3]=r,t[4]=i,t[5]=o,t[6]=c):c=t[6];let l=c;if(!a)return l;let d;t[7]===l?d=t[8]:(d=(0,R.jsx)(x,{render:l}),t[7]=l,t[8]=d);let f;t[9]===a?f=t[10]:(f=(0,R.jsx)(S,{children:a}),t[9]=a,t[10]=f);let p;return t[11]!==d||t[12]!==f?(p=(0,R.jsxs)(C,{children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13],p}var rn=0;function an(){return rn>0}async function on(e){let t=pe();if(!t)return!0;rn+=1;try{return await t.dialogs.confirm(e.length===1?[`Close terminal "${e[0]}"?`,`This stops the running process and clears its history.`].join(`
2
- `):[`Close ${e.length} terminals?`,`This stops their running processes and clears their histories: ${e.map(e=>`"${e}"`).join(`, `)}.`].join(`
3
- `),{variant:`destructive`})}catch{return!1}finally{--rn}}var sn={environmentId:a,threadId:a,targetOrigin:a,cause:c()},cn=class extends b()(`TerminalLinkPreviewOpenError`,sn){get message(){return`Failed to open terminal link ${this.targetOrigin} in preview for thread ${this.threadId}.`}};async function ln(e){if(!(!e.forceBrowser&&k(e.url)&&ye(e.threadRef.environmentId)&&e.threadRef.threadId.length>0&&await A()===`app`)){e.fallbackToBrowser();return}let t={environmentId:e.threadRef.environmentId,threadId:e.threadRef.threadId,targetOrigin:new URL(e.url).origin},n=await w(),r=_e(e.threadRef.environmentId),i=await e.openPreview({environmentId:e.threadRef.environmentId,input:{threadId:e.threadRef.threadId,url:e.url,viewport:ve(n),profileId:E(n),...r===void 0?{}:{runtime:r}}});if(i._tag===`Failure`){if(ne(i))return;console.error(new cn({...t,cause:i.cause})),e.fallbackToBrowser();return}T(e.threadRef,e.url),g(e.threadRef,i.value),de.getState().openBrowser(e.threadRef,i.value.tabId)}function un(e){return{...e===void 0?{}:{platform:e},context:{terminalFocus:!0,terminalOpen:!0}}}function dn(e,t,n){return we(e,t,un(n))?(e.preventDefault(),!0):!1}function fn(e,t,n){return e.repeat?dn(e,t,n):!1}var pn=180,mn=.75;function hn(){return typeof window>`u`?280:Math.max(pn,Math.floor(window.innerHeight*mn))}function gn(e,t=hn()){return Math.min(Math.max(Math.round(Number.isFinite(e)?e:280),pn),t)}function _n(e,t){e.write(`\r\n[terminal] ${t}\r\n`)}function vn(e,t){t.type===`reset`?e.resetAndWrite(t.data):t.type===`append`&&e.write(t.data)}function yn(e,t,n){if(t.version===0)return n;let r=N(t.output,n);return vn(e,r),e.clearSelection(),r.cursor}function bn(e,t){if(typeof document>`u`)return t;let n=document.createElement(`canvas`);n.width=1,n.height=1;let r=n.getContext(`2d`,{willReadFrequently:!0});if(!r)return t;r.clearRect(0,0,1,1),r.fillStyle=e,r.fillRect(0,0,1,1);let[i,a,o,s]=r.getImageData(0,0,1,1).data;return s===0?t:{r:i??t.r,g:a??t.g,b:o??t.b}}function xn(e){let t=Number.parseInt(e.slice(1),16);return{r:t>>16&255,g:t>>8&255,b:t&255}}var Sn={light:[`#000000`,`#cd3131`,`#107c10`,`#949800`,`#0451a5`,`#bc05bc`,`#0598bc`,`#555555`,`#666666`,`#cd3131`,`#14ce14`,`#b5ba00`,`#0451a5`,`#bc05bc`,`#0598bc`,`#a5a5a5`].map(xn),dark:[`#000000`,`#cd3131`,`#0dbc79`,`#e5e510`,`#2472c8`,`#bc3fbc`,`#11a8cd`,`#e5e5e5`,`#666666`,`#f14c4c`,`#23d18b`,`#f5f543`,`#3b8eea`,`#d670d6`,`#29b8db`,`#e5e5e5`].map(xn)};function Cn(e){return e?JSON.stringify(Object.entries(e).filter(([e,t])=>e.length>0&&typeof t==`string`).sort(([e],[t])=>e.localeCompare(t))):``}function wn(e,t){let n=e?.trim().toLowerCase();return!n||n===`transparent`||n===`rgba(0, 0, 0, 0)`||n===`rgba(0 0 0 / 0)`?t:e??t}function Tn(e,t,n){return wn(e.getPropertyValue(t),n)}function En(e,t){let n=e.trim();return n.length>0?{family:n,size:t}:{size:t}}function Dn(e){let t=e?.closest(`[data-thread-terminal-drawer]`)??document.querySelector(`[data-thread-terminal-drawer]`)??document.body,n=getComputedStyle(t),r=e?getComputedStyle(e):n,i=r.colorScheme,a=i===`dark`||i!==`light`&&document.documentElement.classList.contains(`dark`),o=a?`rgb(14, 18, 24)`:`rgb(255, 255, 255)`,s=a?`rgb(237, 241, 247)`:`rgb(28, 33, 41)`,c=getComputedStyle(document.body),l=getComputedStyle(document.documentElement),u=wn(n.backgroundColor,wn(c.backgroundColor,o)),d=wn(n.color,wn(c.color,s)),f=Tn(r,`--terminal-background`,Tn(l,`--terminal-background`,u)),p=Tn(r,`--terminal-foreground`,Tn(l,`--terminal-foreground`,d)),m=Tn(r,`--terminal-cursor`,a?`rgb(180, 203, 255)`:`rgb(38, 56, 78)`),h=Tn(r,`--terminal-selection-background`,a?`rgba(180, 203, 255, 0.25)`:`rgba(37, 63, 99, 0.2)`);return{background:bn(f,a?{r:14,g:18,b:24}:{r:255,g:255,b:255}),foreground:bn(p,a?{r:237,g:241,b:247}:{r:28,g:33,b:41}),cursor:bn(m,a?{r:180,g:203,b:255}:{r:38,g:56,b:78}),palette:Sn[a?`dark`:`light`],selectionBackground:h}}function On(e){let t=e.start.y+1;return{lineStart:t,lineEnd:Math.max(t,e.end.y+1)}}function kn(e){return[...e?.canAddToChat===!1?[]:[{id:`add-to-chat`,label:`Add to chat`}],{id:`copy`,label:`Copy`}]}function An(e){let{hasSelection:t,canAddToChat:n=!0}=e;return[...kn({canAddToChat:n}).map(e=>({...e,disabled:!t})),{id:`paste`,label:`Paste`,...e.readOnly?{disabled:!0}:{}},{id:`select-all`,label:`Select all`},{id:`scroll-to-bottom`,label:`Jump to latest`}]}function jn(e){return e.actionPending||e.openMenuRequestId===e.currentRequestId}function Mn(e,t,n,r){return r>0&&(e===`closed`||e===`exited`)&&e!==t&&!n}function Nn({advancedTypography:e,threadRef:t,threadId:n,terminalId:r,terminalLabel:i,cwd:a,worktreePath:o,runtimeEnv:s,providerInstanceId:c,onSessionExited:u,onAddTerminalContext:f,focusRequestId:p,autoFocus:m,visible:g,resizeEpoch:ee,drawerHeight:te,keybindings:_}){let v=(0,L.useRef)(null),y=(0,L.useRef)(null),b=(0,L.useRef)(g),x=t.environmentId,S=ce(x,l),C=(0,L.useEffectEvent)(()=>le(x,l)),de=ce(x,h),ge=(0,L.useEffectEvent)(e=>Ae(e)||le(x,`orchestration:operate`)),_e=d(se.configValueAtom(x)),ve=Ie(x,_e?.availableEditors??[]),w=(0,L.useEffectEvent)(e=>ve(e)),T=ue(De.open,{reportFailure:!1}),E=ue(Ne.write,{reportFailure:!1}),ye=ue(Ne.resize,{reportFailure:!1}),we=(0,L.useRef)(!1),k=(0,L.useRef)(0),A=(0,L.useRef)(null),Oe=(0,L.useRef)(_),j=(0,L.useMemo)(()=>Cn(s),[s]),ke=(0,L.useEffectEvent)(()=>{C()&&u()}),je=(0,L.useEffectEvent)(e=>{f?.(e)}),M=(0,L.useEffectEvent)(()=>f!==void 0),Pe=(0,L.useEffectEvent)(()=>i),I=me(t=>Fe({advanced:e,code:t.fontFamilyCode,terminal:t.fontFamilyTerminal})),Le=me(t=>F({advanced:e,code:t.fontSizeCode,terminal:t.fontSizeTerminal})),Re=(0,L.useRef)({family:I,size:Le}),z=P({environmentId:x,terminal:{threadId:n,terminalId:r,cwd:a,...o===void 0?{}:{worktreePath:o},...s?{env:s}:{},...c?{providerInstanceId:c}:{}}}),B=S&&z.version>0&&z.status===`running`,Ve=B?z.output.generation:null,He=(0,L.useEffectEvent)(e=>E({environmentId:x,input:{threadId:n,terminalId:r,data:e}})),Ue=(0,L.useEffectEvent)((e,t)=>{if(B&&C())return ye({environmentId:x,input:{threadId:n,terminalId:r,cols:e,rows:t}})}),V=z.output,We=z.error,H=z.status,Ge=(0,L.useRef)(Me),U=(0,L.useRef)(`closed`),Ke=(0,L.useEffectEvent)((e,t,n)=>{let r=U.current;n>0&&t===`running`?we.current=!1:Mn(t,r,we.current,n)&&(we.current=!0,_n(e,t===`closed`?`Terminal closed`:`Process exited`),window.setTimeout(()=>{we.current&&ke()},0)),n>0&&(U.current=t)}),W=z.version,G=(0,L.useRef)({output:V,error:We,status:H,version:W}),K=(0,L.useRef)(G.current);return K.current={output:V,error:We,status:H,version:W},(0,L.useEffect)(()=>{Oe.current=_},[_]),(0,L.useLayoutEffect)(()=>{y.current&&(y.current.input.readOnly=!S)},[S]),(0,L.useEffect)(()=>{y.current?.refreshLinkActivation()},[de]),(0,L.useEffect)(()=>{Ve!==null&&y.current?.resendSize()},[Ve]),(0,L.useLayoutEffect)(()=>{b.current=g,y.current?.setVisible(g)},[g]),(0,L.useEffect)(()=>{let e=Re.current;(e.family!==I||e.size!==Le)&&(Re.current={family:I,size:Le},y.current?.setFont(En(I,Le)))},[I,Le]),(0,L.useEffect)(()=>{let e=v.current;if(!e)return;let n=pe(),i=!1,o=null,s=null,c=[],l=null;return(async()=>{let o=Re.current,u={theme:Dn(e),font:En(o.family,o.size),get visible(){return b.current},onData:e=>ve(e),onResize:(e,t)=>void Ue(e,t),onSelectionChange:()=>E(),beforeKey:e=>me(e),onLinkActivate:(e,t)=>_e(e,t),canActivateLink:e=>ge(e),onContextMenu:e=>{y.current&&ue(e)}},d=await tn.create(e,u);if(i)return d.dispose(),null;d.setVisible(b.current),d.setTheme(Dn(e)),s=d,y.current=d,d.input.readOnly=!C();let f=Re.current;(f.family!==o.family||f.size!==o.size)&&d.setFont(En(f.family,f.size));let p=K.current;G.current=p;let m=N(p.output,Me);m.type===`reset`&&m.data.length>0&&vn(d,m),Ge.current=m.cursor,p.error!==null&&_n(d,p.error),U.current=`closed`,Ke(d,p.status,p.version),C()&&b.current&&e.contains(document.activeElement)&&d.focus();let h=(e=!1)=>{let t=A.current===k.current;(e||t)&&(k.current+=1),t&&n?.contextMenu.close()},g=()=>{l?.cancel(),h(!0)};c.push(g);let ee=(e=null)=>{let t=y.current,n=v.current;if(!t||!n||!t.hasSelection())return null;let i=t.getSelection(),a=t.getSelectionPosition(),o=i.replace(/\r\n/g,`
4
- `).replace(/^\n+|\n+$/g,``);if(!a||o.length===0)return null;let{lineStart:s,lineEnd:c}=On(a);return{position:ze({bounds:n.getBoundingClientRect(),selectionRect:t.getSelectionEndClientRect(),pointer:e,viewport:{width:window.innerWidth,height:window.innerHeight}}),clipboardText:i,selection:{terminalId:r,terminalLabel:Pe(),lineStart:s,lineEnd:c,text:o}}},te=e=>{je(e),y.current?.clearSelection(),y.current?.focus()},_=(e,t,n)=>{if(e!==k.current)return;let r=y.current;r&&_n(r,t instanceof Error?t.message:n)},S=e=>{e===k.current&&y.current?.focus()},se=async(e,t)=>{try{await oe(e,`terminal selection`)}catch(e){_(t,e,`Unable to copy terminal selection`)}S(t)},ce=async e=>{if(!C())return;let t=y.current;if(t){try{await t.pasteFromClipboard(()=>ie(`terminal input`),()=>e===k.current)}catch(t){_(e,t,`Unable to read the clipboard`);return}S(e)}},ue=async e=>{if(!n||!y.current)return;e.preventDefault(),g();let t=ee(),r=k.current,i;try{i=await n.contextMenu.show(An({hasSelection:t!==null,canAddToChat:M(),readOnly:!C()}),{x:e.clientX,y:e.clientY})}catch(e){_(r,e,`Unable to open the terminal context menu`),S(r);return}if(r===k.current&&i!==null)switch(i){case`add-to-chat`:t&&M()&&te(t.selection);return;case`copy`:t&&await se(t.clipboardText,r);return;case`paste`:await ce(r);return;case`select-all`:y.current?.selectAll(),S(r);return;case`scroll-to-bottom`:y.current?.scrollToBottom(),S(r);return}},de=async e=>{if(!n){g();return}if(A.current===k.current)return;let t=ee(e);if(!t){g();return}let r=++k.current;A.current=r;let i=await n.contextMenu.show(kn({canAddToChat:M()}),t.position).finally(()=>{A.current===r&&(A.current=null)});if(r===k.current&&i!==null)switch(i){case`add-to-chat`:M()&&te(t.selection);return;case`copy`:await se(t.clipboardText,r);return}},pe=async(e,t)=>{if(!C())return;let n=y.current;if(!n)return;let r=await He(e);if(r._tag===`Failure`&&!ne(r)){let e=re(r);_n(n,e instanceof Error?e.message:t)}};function me(e){let t=Oe.current,n={context:{terminalFocus:!0,terminalOpen:!0}};if(dn(e,t)||Te(e,t,n)||Se(e,t,n)||Ce(e,t,n)||Ee(e,t,n)||be(e,t,n))return!1;let r=D(e);if(r!==null)return e.preventDefault(),e.stopPropagation(),pe(r,`Failed to move cursor`),!1;let i=O(e);return i===null?!xe(e)||(e.preventDefault(),e.stopPropagation(),pe(`\f`,`Failed to clear terminal`),!1):(e.preventDefault(),e.stopPropagation(),pe(i,`Failed to delete terminal input`),!1)}function _e(e,r){if(!ge(e))return;let i=y.current;if(!i)return;if(Ae(e)){if(!n){_n(i,`Opening links is unavailable in this browser.`);return}let a=()=>{n.shell.openExternal(e).catch(e=>{_n(i,e instanceof Error?e.message:`Unable to open link`)})};if(!le(x,`preview:operate`)){a();return}ln({url:e,threadRef:t,openPreview:T,fallbackToBrowser:a,forceBrowser:r.metaKey||r.ctrlKey}).catch(e=>{ae.add(he({type:`error`,title:`Unable to open link`,description:e instanceof Error?e.message:`An error occurred.`}))});return}let o=fe(e,a);(async()=>{let e=await w(o);if(e._tag===`Success`||ne(e))return;let t=re(e);_n(i,t instanceof Error?t.message:`Unable to open path`)})()}function ve(e){C()&&(async()=>{let t=await He(e);if(t._tag===`Success`||ne(t))return;let n=re(t);_n(d,n instanceof Error?n.message:`Terminal write failed`)})()}function E(){y.current?.hasSelection()||jn({actionPending:l?.pending??!1,openMenuRequestId:A.current,currentRequestId:k.current})&&g()}l=Be({element:e,onSelection:e=>{de(e)},onDismiss:e=>h(e===`interaction`)}),c.push(()=>l?.dispose());let ye=new MutationObserver(()=>{let e=y.current;e&&e.setTheme(Dn(v.current))});ye.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`]}),c.push(()=>ye.disconnect());let we=window.setTimeout(()=>{let e=y.current;if(!e)return;let t=e.isAtBottom();e.fit(),t&&e.scrollToBottom()},30);c.push(()=>window.clearTimeout(we));let De=c;return c=[],s=null,()=>{for(let e of De.toReversed())e();y.current===d&&(y.current=null),d.dispose()}})().then(e=>{if(i){e?.();return}o=e}).catch(t=>{for(let e of c.toReversed())e();if(c=[],y.current===s&&(y.current=null),s?.dispose(),s=null,i)return;let n=t instanceof Error?t.message:`Unable to initialize libghostty-vt`;e.textContent=`${n} — close and reopen the terminal to retry.`}),()=>{i=!0;let t=e.contains(document.activeElement);o?.(),C()&&t&&e.isConnected&&e.focus({preventScroll:!0})}},[a,x,j,r,n,o]),(0,L.useEffect)(()=>{let e=y.current,t={output:V,error:We,status:H,version:W};if(!e){G.current=t;return}let n=G.current;Ke(e,t.status,t.version),(t.version!==n.version||t.output!==n.output)&&(Ge.current=yn(e,t,Ge.current),t.error!==null&&t.error!==n.error&&_n(e,t.error),G.current=t)},[V,We,H,W]),(0,L.useEffect)(()=>{m&&S&&g&&(y.current??v.current)?.focus()},[m,S,p,g]),(0,L.useEffect)(()=>{let e=y.current;if(!e||!b.current)return;let t=e.isAtBottom(),n=window.requestAnimationFrame(()=>{b.current&&(e.fit(),t&&e.scrollToBottom())});return()=>{window.cancelAnimationFrame(n)}},[te,x,ee,r,n]),(0,R.jsx)(`div`,{ref:v,tabIndex:-1,className:`relative h-full w-full overflow-hidden bg-(--terminal-background)`})}function Pn(e){let t=(0,Re.c)(16),{label:n,className:r,onClick:i,children:a,disabled:o}=e,s=o&&`opacity-45 cursor-not-allowed`,c;t[0]!==r||t[1]!==s?(c=_(r,s),t[0]=r,t[1]=s,t[2]=c):c=t[2];let l=o?void 0:i,u;t[3]!==o||t[4]!==n||t[5]!==c||t[6]!==l?(u=(0,R.jsx)(`button`,{type:`button`,className:c,onClick:l,"aria-label":n,"aria-disabled":o}),t[3]=o,t[4]=n,t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]!==a||t[9]!==u?(d=(0,R.jsx)(j,{openOnHover:!0,render:u,children:a}),t[8]=a,t[9]=u,t[10]=d):d=t[10];let f;t[11]===n?f=t[12]:(f=(0,R.jsx)(Oe,{tooltipStyle:!0,side:`bottom`,sideOffset:6,align:`center`,className:`pointer-events-none select-none`,children:n}),t[11]=n,t[12]=f);let p;return t[13]!==d||t[14]!==f?(p=(0,R.jsxs)(ke,{children:[d,f]}),t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function Fn(e){let t=(0,Re.c)(169),{mode:r,threadRef:a,threadId:o,cwd:c,worktreePath:u,runtimeEnv:d,visible:p,height:h,terminalIds:g,activeTerminalId:b,terminalGroups:ne,activeTerminalGroupId:re,focusRequestId:ie,onSplitTerminal:ae,onSplitTerminalVertical:oe,onNewTerminal:x,splitShortcutLabel:S,splitVerticalShortcutLabel:C,newShortcutLabel:se,closeShortcutLabel:ue,onActiveTerminalChange:de,onCloseTerminal:fe,onHeightChange:pe,onAddTerminalContext:me,keybindings:he,terminalLabelsById:ge,terminalLaunchLocationsById:_e}=e,ve=r===void 0?`drawer`:r,w=p===void 0||p,T=ce(a.environmentId,l),E=ve===`panel`,[ye]=i(Le,!1,f),D=h,[be,xe]=(0,L.useState)(hn),Se;t[0]!==D||t[1]!==o?(Se=()=>({threadId:o,height:D}),t[0]=D,t[1]=o,t[2]=Se):Se=t[2];let[Ce,we]=(0,L.useState)(Se),Te=Ce.threadId===o?Ce.height:D,Ee;t[3]!==Te||t[4]!==be?(Ee=gn(Te,be),t[3]=Te,t[4]=be,t[5]=Ee):Ee=t[5];let O=Ee,De;t[6]!==D||t[7]!==o?(De=e=>{we(t=>{let n=t.threadId===o?t.height:D,r=typeof e==`function`?e(n):e;return r===n&&t.threadId===o?t:{threadId:o,height:r}})},t[6]=D,t[7]=o,t[8]=De):De=t[8];let k=De,[A,Oe]=(0,L.useState)(0),j=(0,L.useRef)(O),ke=(0,L.useRef)(Te),Ae=(0,L.useRef)(D),je=(0,L.useRef)(pe),M=(0,L.useRef)(null),Me=(0,L.useRef)(!1),Ne;if(t[9]!==g){Ne=[];let e=new Set;for(let t of g){let n=t.trim();n.length===0||e.has(n)||(e.add(n),Ne.push(n))}t[9]=g,t[10]=Ne}else Ne=t[10];let N=Ne,P=N.length===0?``:N.includes(b)?b:N[0]??``,Fe;bb0:{if(N.length===0){let e;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[11]=e):e=t[11],Fe=e;break bb0}let e;t[12]===N?e=t[13]:(e=new Set(N),t[12]=N,t[13]=e);let n=e,r;if(t[14]!==N||t[15]!==ne||t[16]!==n){let e=new Set,i=new Set;r=[];let a=e=>{if(!i.has(e))return i.add(e),e;let t=2;for(;i.has(`${e}-${t}`);)t+=1;let n=`${e}-${t}`;return i.add(n),n};for(let t of ne){let i=[],o=new Set;for(let r of t.terminalIds){let t=r.trim();t.length!==0&&(o.has(t)||(o.add(t),n.has(t)&&(e.has(t)||i.push(t))))}if(i.length===0)continue;for(let t of i)e.add(t);let s=t.id.trim().length>0?t.id.trim():`group-${i[0]??N[0]??``}`;r.push({id:a(s),terminalIds:i,...t.splitDirection===`vertical`?{splitDirection:`vertical`}:{}})}for(let t of N)e.has(t)||r.push({id:a(`group-${t}`),terminalIds:[t]});let o=new Map(N.map(Bn));r.sort((e,t)=>{let n=e=>Math.min(...e.map(e=>o.get(e)??1/0));return n(e.terminalIds)-n(t.terminalIds)}),t[14]=N,t[15]=ne,t[16]=n,t[17]=r}else r=t[17];Fe=r}let F=Fe,Ie;bb1:{let e=F.findIndex(e=>e.id===re);if(e>=0){Ie=e;break bb1}let t=F.findIndex(e=>e.terminalIds.includes(P));Ie=t>=0?t:0}let I=Ie,ze;t[18]!==N.length||t[19]!==I||t[20]!==P||t[21]!==F?(ze=F[I]?.terminalIds??(N.length>0?[P]:[]),t[18]=N.length,t[19]=I,t[20]=P,t[21]=F,t[22]=ze):ze=t[22];let Be=ze,z=F[I]?.splitDirection??`horizontal`,B=N.length>1,Ve=Be.length>1,He;t[23]===F?He=t[24]:(He=F.length>1||F.some(zn),t[23]=F,t[24]=He);let Ue=He,V=Be.length>=4,We;if(t[25]!==N||t[26]!==ge){We=new Map;for(let e of N)We.set(e,ge?.get(e)??Pe(e));t[25]=N,t[26]=ge,t[27]=We}else We=t[27];let H=We,Ge;t[28]!==c||t[29]!==d||t[30]!==_e||t[31]!==u?(Ge=e=>_e?.get(e)??{cwd:c,...u===void 0?{}:{worktreePath:u},...d?{runtimeEnv:d}:{}},t[28]=c,t[29]=d,t[30]=_e,t[31]=u,t[32]=Ge):Ge=t[32];let U=Ge,Ke=V?`Split Terminal Horizontally (max 4 per group)`:S?`Split Terminal Horizontally (${S})`:`Split Terminal Horizontally`,W=V?`Split Terminal Vertically (max 4 per group)`:C?`Split Terminal Vertically (${C})`:`Split Terminal Vertically`,G=se?`New Terminal (${se})`:`New Terminal`,K=ue?`Close Terminal (${ue})`:`Close Terminal`,qe;t[33]!==T||t[34]!==V||t[35]!==ae?(qe=()=>{T&&!V&&ae()},t[33]=T,t[34]=V,t[35]=ae,t[36]=qe):qe=t[36];let Je=qe,Ye;t[37]!==T||t[38]!==V||t[39]!==oe?(Ye=()=>{T&&!V&&oe()},t[37]=T,t[38]=V,t[39]=oe,t[40]=Ye):Ye=t[40];let Xe=Ye,q;t[41]!==T||t[42]!==x?(q=()=>{T&&x()},t[41]=T,t[42]=x,t[43]=q):q=t[43];let J=q,Y;t[44]!==T||t[45]!==fe||t[46]!==H||t[47]!==a.environmentId?(Y=e=>{T&&on([H.get(e)??Pe(e)]).then(t=>{t&&le(a.environmentId,`terminal:operate`)&&fe(e)})},t[44]=T,t[45]=fe,t[46]=H,t[47]=a.environmentId,t[48]=Y):Y=t[48];let X=Y,Ze,Qe;t[49]===pe?(Ze=t[50],Qe=t[51]):(Ze=()=>{je.current=pe},Qe=[pe],t[49]=pe,t[50]=Ze,t[51]=Qe),(0,L.useEffect)(Ze,Qe);let $e,et;t[52]===O?($e=t[53],et=t[54]):($e=()=>{let e=M.current;if(e){e.drawer?.style.setProperty(`height`,`${j.current}px`);return}j.current=O},et=[O],t[52]=O,t[53]=$e,t[54]=et),(0,L.useLayoutEffect)($e,et);let tt,nt;t[55]===Te?(tt=t[56],nt=t[57]):(tt=()=>{ke.current=Te},nt=[Te],t[55]=Te,t[56]=tt,t[57]=nt),(0,L.useEffect)(tt,nt);let rt;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(rt=e=>{Ae.current!==e&&(Ae.current=e,je.current(e))},t[58]=rt):rt=t[58];let it=rt,at;t[59]===D?at=t[60]:(at=()=>{Ae.current=D},t[59]=D,t[60]=at);let ot;t[61]!==D||t[62]!==o?(ot=[D,o],t[61]=D,t[62]=o,t[63]=ot):ot=t[63],(0,L.useEffect)(at,ot);let Z;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Z=e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),Me.current=!1,M.current={pointerId:e.pointerId,startY:e.clientY,startHeight:j.current,drawer:e.currentTarget.parentElement})},t[64]=Z):Z=t[64];let st=Z,ct;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ct=e=>{let t=M.current;if(!t||t.pointerId!==e.pointerId)return;e.preventDefault();let n=gn(t.startHeight+(t.startY-e.clientY));n!==j.current&&(Me.current=!0,j.current=n,t.drawer?.style.setProperty(`height`,`${n}px`))},t[65]=ct):ct=t[65];let lt=ct,ut;t[66]===k?ut=t[67]:(ut=e=>{let t=M.current;if(t&&t.pointerId===e.pointerId){if(M.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),!Me.current||j.current===t.startHeight){let e=gn(ke.current);j.current=e,t.drawer?.style.setProperty(`height`,`${e}px`);return}k(j.current),it(j.current),Oe(Rn)}},t[66]=k,t[67]=ut);let Q=ut,dt,ft;t[68]===w?(dt=t[69],ft=t[70]):(dt=()=>{if(!w)return;let e=()=>{let e=M.current,t=gn(j.current);e&&t!==j.current&&(j.current=t,e.drawer?.style.setProperty(`height`,`${t}px`)),xe(hn()),Oe(Ln)};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},ft=[w],t[68]=w,t[69]=dt,t[70]=ft),(0,L.useEffect)(dt,ft);let pt,mt;t[71]===w?(pt=t[72],mt=t[73]):(pt=()=>{w&&(xe(hn()),Oe(In))},mt=[w],t[71]=w,t[72]=pt,t[73]=mt),(0,L.useEffect)(pt,mt);let ht,gt;if(t[74]===Symbol.for(`react.memo_cache_sentinel`)?(ht=()=>()=>{it(ke.current)},gt=[it],t[74]=ht,t[75]=gt):(ht=t[74],gt=t[75]),(0,L.useEffect)(ht,gt),N.length===0){let e=E?`right-panel`:`drawer`,n=E?`h-full flex-1`:`shrink-0 border-t border-border/80`,r;t[76]===n?r=t[77]:(r=_(`relative flex min-w-0 flex-col overflow-hidden bg-background`,n),t[76]=n,t[77]=r);let i;t[78]!==O||t[79]!==E?(i=E?void 0:{height:`${O}px`},t[78]=O,t[79]=E,t[80]=i):i=t[80];let a;t[81]!==Q||t[82]!==E?(a=E?null:(0,R.jsx)(`div`,{className:`absolute inset-x-0 top-0 z-20 h-1.5 cursor-row-resize`,onPointerDown:st,onPointerMove:lt,onPointerUp:Q,onPointerCancel:Q,onLostPointerCapture:Q}),t[81]=Q,t[82]=E,t[83]=a):a=t[83];let o;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,R.jsx)(`p`,{children:`No terminal sessions for this thread yet.`}),t[84]=o):o=t[84];let s=!T,c;t[85]!==G||t[86]!==J||t[87]!==s?(c=(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-4 py-6 text-center text-sm text-muted-foreground`,children:[o,(0,R.jsx)(te,{size:`xs`,variant:`outline`,onClick:J,disabled:s,children:G})]}),t[85]=G,t[86]=J,t[87]=s,t[88]=c):c=t[88];let l;return t[89]!==e||t[90]!==r||t[91]!==i||t[92]!==a||t[93]!==c?(l=(0,R.jsxs)(`aside`,{"data-thread-terminal-drawer":!0,"data-terminal-owner":e,className:r,style:i,children:[a,c]}),t[89]=e,t[90]=r,t[91]=i,t[92]=a,t[93]=c,t[94]=l):l=t[94],l}let $;t[95]!==U||t[96]!==P?($=U(P),t[95]=U,t[96]=P,t[97]=$):$=t[97];let _t=$,vt=E?`right-panel`:`drawer`,yt=E?`h-full flex-1`:`shrink-0 border-t border-border/80`,bt;t[98]===yt?bt=t[99]:(bt=_(`relative flex min-w-0 flex-col overflow-hidden bg-background`,yt),t[98]=yt,t[99]=bt);let xt;t[100]!==O||t[101]!==E?(xt=E?void 0:{height:`${O}px`},t[100]=O,t[101]=E,t[102]=xt):xt=t[102];let St;t[103]!==Q||t[104]!==E?(St=E?null:(0,R.jsx)(`div`,{className:`absolute inset-x-0 top-0 z-20 h-1.5 cursor-row-resize`,onPointerDown:st,onPointerMove:lt,onPointerUp:Q,onPointerCancel:Q,onLostPointerCapture:Q}),t[103]=Q,t[104]=E,t[105]=St):St=t[105];let Ct;t[106]!==T||t[107]!==K||t[108]!==X||t[109]!==V||t[110]!==B||t[111]!==G||t[112]!==J||t[113]!==Je||t[114]!==Xe||t[115]!==P||t[116]!==Ke||t[117]!==W?(Ct=!B&&(0,R.jsx)(`div`,{className:`pointer-events-none absolute right-2 top-2 z-20`,children:(0,R.jsxs)(`div`,{className:`pointer-events-auto inline-flex items-center overflow-hidden rounded-md border border-border/80 bg-background shadow-xs`,children:[(0,R.jsx)(Pn,{disabled:!T,className:`p-1 text-foreground/90 transition-colors ${V?`cursor-not-allowed opacity-64 hover:bg-transparent`:`hover:bg-accent`}`,onClick:Je,label:Ke,children:(0,R.jsx)(v,{className:`size-3.25`})}),(0,R.jsx)(`div`,{className:`h-4 w-px bg-border/80`}),(0,R.jsx)(Pn,{disabled:!T,className:`p-1 text-foreground/90 transition-colors ${V?`cursor-not-allowed opacity-64 hover:bg-transparent`:`hover:bg-accent`}`,onClick:Xe,label:W,children:(0,R.jsx)(m,{className:`size-3.25`})}),(0,R.jsx)(`div`,{className:`h-4 w-px bg-border/80`}),(0,R.jsx)(Pn,{disabled:!T,className:`p-1 text-foreground/90 transition-colors hover:bg-accent`,onClick:J,label:G,children:(0,R.jsx)(s,{className:`size-3.25`})}),(0,R.jsx)(`div`,{className:`h-4 w-px bg-border/80`}),(0,R.jsx)(Pn,{disabled:!T,className:`p-1 text-foreground/90 transition-colors hover:bg-accent`,onClick:()=>X(P),label:K,children:(0,R.jsx)(n,{className:`size-3.25`})})]})}),t[106]=T,t[107]=K,t[108]=X,t[109]=V,t[110]=B,t[111]=G,t[112]=J,t[113]=Je,t[114]=Xe,t[115]=P,t[116]=Ke,t[117]=W,t[118]=Ct):Ct=t[118];let wt=B&&`gap-1.5`,Tt;t[119]===wt?Tt=t[120]:(Tt=_(`flex h-full min-h-0 bg-(--terminal-background)`,wt),t[119]=wt,t[120]=Tt);let Et;t[121]!==_t||t[122]!==ye||t[123]!==O||t[124]!==ie||t[125]!==Ve||t[126]!==he||t[127]!==de||t[128]!==me||t[129]!==fe||t[130]!==A||t[131]!==U||t[132]!==P||t[133]!==z||t[134]!==H||t[135]!==o||t[136]!==a||t[137]!==w||t[138]!==Be?(Et=(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:Ve?(0,R.jsx)(`div`,{className:`grid h-full w-full min-w-0 gap-0 overflow-hidden`,style:z===`vertical`?{gridTemplateRows:`repeat(${Be.length}, minmax(0, 1fr))`}:{gridTemplateColumns:`repeat(${Be.length}, minmax(0, 1fr))`},children:Be.map(e=>{let t=U(e);return(0,R.jsx)(`div`,{className:`min-h-0 min-w-0 ${z===`vertical`?`border-t first:border-t-0`:`border-l first:border-l-0`} ${e===P?`border-border`:`border-border/70`}`,onPointerDown:()=>{e!==P&&de(e)},children:(0,R.jsx)(`div`,{className:`h-full`,children:(0,R.jsx)(Nn,{advancedTypography:ye,threadRef:a,threadId:o,terminalId:e,terminalLabel:H.get(e)??`Terminal`,cwd:t.cwd,...t.worktreePath===void 0?{}:{worktreePath:t.worktreePath},...t.runtimeEnv?{runtimeEnv:t.runtimeEnv}:{},onSessionExited:()=>fe(e),onAddTerminalContext:me,focusRequestId:ie,autoFocus:e===P,visible:w,resizeEpoch:A,drawerHeight:O,keybindings:he})})},e)})}):(0,R.jsx)(`div`,{className:`h-full`,children:(0,R.jsx)(Nn,{advancedTypography:ye,threadRef:a,threadId:o,terminalId:P,terminalLabel:H.get(P)??`Terminal`,cwd:_t.cwd,..._t.worktreePath===void 0?{}:{worktreePath:_t.worktreePath},..._t.runtimeEnv?{runtimeEnv:_t.runtimeEnv}:{},onSessionExited:()=>fe(P),onAddTerminalContext:me,focusRequestId:ie,autoFocus:!0,visible:w,resizeEpoch:A,drawerHeight:O,keybindings:he},P)})}),t[121]=_t,t[122]=ye,t[123]=O,t[124]=ie,t[125]=Ve,t[126]=he,t[127]=de,t[128]=me,t[129]=fe,t[130]=A,t[131]=U,t[132]=P,t[133]=z,t[134]=H,t[135]=o,t[136]=a,t[137]=w,t[138]=Be,t[139]=Et):Et=t[139];let Dt;t[140]!==T||t[141]!==ue||t[142]!==K||t[143]!==X||t[144]!==V||t[145]!==B||t[146]!==G||t[147]!==de||t[148]!==J||t[149]!==Je||t[150]!==Xe||t[151]!==P||t[152]!==F||t[153]!==Ue||t[154]!==Ke||t[155]!==W||t[156]!==H?(Dt=B&&(0,R.jsxs)(`aside`,{className:`flex w-36 min-w-36 flex-col border border-border/70 bg-muted/10`,children:[(0,R.jsx)(`div`,{className:`flex h-[22px] items-stretch justify-end border-b border-border/70`,children:(0,R.jsxs)(`div`,{className:`inline-flex h-full items-stretch`,children:[(0,R.jsx)(Pn,{disabled:!T,className:`inline-flex h-full items-center px-1 text-foreground/90 transition-colors ${V?`cursor-not-allowed opacity-64 hover:bg-transparent`:`hover:bg-accent/70`}`,onClick:Je,label:Ke,children:(0,R.jsx)(v,{className:`size-3.25`})}),(0,R.jsx)(Pn,{disabled:!T,className:`inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors ${V?`cursor-not-allowed opacity-64 hover:bg-transparent`:`hover:bg-accent/70`}`,onClick:Xe,label:W,children:(0,R.jsx)(m,{className:`size-3.25`})}),(0,R.jsx)(Pn,{disabled:!T,className:`inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors hover:bg-accent/70`,onClick:J,label:G,children:(0,R.jsx)(s,{className:`size-3.25`})}),(0,R.jsx)(Pn,{disabled:!T,className:`inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors hover:bg-accent/70`,onClick:()=>X(P),label:K,children:(0,R.jsx)(n,{className:`size-3.25`})})]})}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 py-1`,children:F.map(e=>{let t=e.terminalIds.includes(P),n=t?P:e.terminalIds[0]??P,r=e.terminalIds.length,i=r>1,a=i?e.splitDirection===`vertical`?`Stacked`:`Side by side`:`Single`,o=i?e.splitDirection===`vertical`?m:v:ee;return(0,R.jsxs)(`div`,{className:`pb-0.5`,children:[Ue&&(0,R.jsxs)(`button`,{type:`button`,className:`flex h-[22px] w-full cursor-pointer items-center gap-1 rounded px-1.5 text-2xs ${t?`bg-accent/50 text-foreground`:`text-muted-foreground hover:bg-accent/40 hover:text-foreground`}`,onClick:()=>de(n),children:[(0,R.jsx)(o,{className:`size-3 shrink-0`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:a}),(0,R.jsx)(`span`,{className:`text-muted-foreground/70 text-3xs tabular-nums`,children:r})]}),(0,R.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.terminalIds.map(e=>{let t=e===P,n=H.get(e)??`Terminal`,r=`Close ${n}${t&&ue?` (${ue})`:``}`;return(0,R.jsxs)(`div`,{className:_(`group/tab flex h-6 w-full items-center gap-0.5 rounded-md pr-2 pl-1.5 text-xs`,t?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent/60 hover:text-foreground`),children:[T?(0,R.jsx)(nn,{label:r,onClick:()=>X(e),tooltip:r,children:(0,R.jsx)(y,{className:`size-3 shrink-0`})}):(0,R.jsx)(y,{className:`size-3 shrink-0`}),(0,R.jsx)(`button`,{type:`button`,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-1 text-left`,onClick:()=>de(e),children:(0,R.jsx)(`span`,{className:`truncate`,children:n})})]},e)})})]},e.id)})})]}),t[140]=T,t[141]=ue,t[142]=K,t[143]=X,t[144]=V,t[145]=B,t[146]=G,t[147]=de,t[148]=J,t[149]=Je,t[150]=Xe,t[151]=P,t[152]=F,t[153]=Ue,t[154]=Ke,t[155]=W,t[156]=H,t[157]=Dt):Dt=t[157];let Ot;t[158]!==Tt||t[159]!==Et||t[160]!==Dt?(Ot=(0,R.jsx)(`div`,{className:`min-h-0 w-full flex-1`,children:(0,R.jsxs)(`div`,{className:Tt,children:[Et,Dt]})}),t[158]=Tt,t[159]=Et,t[160]=Dt,t[161]=Ot):Ot=t[161];let kt;return t[162]!==vt||t[163]!==bt||t[164]!==xt||t[165]!==St||t[166]!==Ct||t[167]!==Ot?(kt=(0,R.jsxs)(`aside`,{"data-thread-terminal-drawer":!0,"data-terminal-owner":vt,className:bt,style:xt,children:[St,Ct,Ot]}),t[162]=vt,t[163]=bt,t[164]=xt,t[165]=St,t[166]=Ct,t[167]=Ot,t[168]=kt):kt=t[168],kt}function In(e){return e+1}function Ln(e){return e+1}function Rn(e){return e+1}function zn(e){return e.terminalIds.length>1}function Bn(e,t){return[e,t]}export{dn as a,tn as c,fn as i,Be as l,Fn as n,on as o,Dn as r,an as s,Nn as t,ze as u};
5
- //# sourceMappingURL=ThreadTerminalDrawer-g8xlxRvR.js.map