@p4code/cli 0.8.33 → 0.8.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-CReSoYE2.mjs → binCli-26z5sNBT.mjs} +2313 -1491
  3. package/dist/client/.vite/manifest.json +2037 -2022
  4. package/dist/client/assets/{2NI2N5EU-Cq8AdBdr.js → 2NI2N5EU-BLnY4aCF.js} +2 -2
  5. package/dist/client/assets/{4UO7MD6I-BtyHa2r8.js → 4UO7MD6I-BApNVkfU.js} +2 -2
  6. package/dist/client/assets/{5B3SVYGG-DJhrK_P7.js → 5B3SVYGG-Y7V7NdZO.js} +2 -2
  7. package/dist/client/assets/{5GK6JWQ2-Di3oWVTL.js → 5GK6JWQ2-BSIhKcw-.js} +2 -2
  8. package/dist/client/assets/{5N7A7DKN-IYvb4i83.js → 5N7A7DKN-CNUCnWLs.js} +2 -2
  9. package/dist/client/assets/{5OC2THR4-C4L8eWnK.js → 5OC2THR4-Bne-pf_A.js} +2 -2
  10. package/dist/client/assets/{5S6HY5KT-CRP52QAR.js → 5S6HY5KT-7d4UMONz.js} +2 -2
  11. package/dist/client/assets/{6IMQ5BUJ-CNHI0F6y.js → 6IMQ5BUJ-BWW19n-D.js} +2 -2
  12. package/dist/client/assets/{6OLKWJ4F-B4vHLWw5.js → 6OLKWJ4F-CxTUuvA6.js} +2 -2
  13. package/dist/client/assets/{74OO7NKP-Cy2GHTnO.js → 74OO7NKP-DByVTRKE.js} +2 -2
  14. package/dist/client/assets/{75O6YZUN-DQlP5MhD.js → 75O6YZUN-CZanyedf.js} +2 -2
  15. package/dist/client/assets/{77XECAW3-DSSYRZCk.js → 77XECAW3-TL2w7pHK.js} +2 -2
  16. package/dist/client/assets/{ABYRPUBD-BKqULKA5.js → ABYRPUBD-CJboH7Uz.js} +2 -2
  17. package/dist/client/assets/AlertDialogRoot-9jRALQXL.js +2 -0
  18. package/dist/client/assets/{AnimatedHeight-CFR4EWDw.js → AnimatedHeight-OxEbW01v.js} +2 -2
  19. package/dist/client/assets/{AuthSurfaceShell-X2oPejN8.js → AuthSurfaceShell-KQXgPV4i.js} +2 -2
  20. package/dist/client/assets/{BB2UYUI2-C2iBTfII.js → BB2UYUI2-BxW-R2h1.js} +2 -2
  21. package/dist/client/assets/{BUM34MOA-D8LFlnDQ.js → BUM34MOA-ngG-irUy.js} +2 -2
  22. package/dist/client/assets/{CEQABKGZ-D15ZAT0K.js → CEQABKGZ-C-u-W0bS.js} +2 -2
  23. package/dist/client/assets/{CXAC5362-CicOZ45Z.js → CXAC5362-DfFRkI7L.js} +2 -2
  24. package/dist/client/assets/ChatGptUsageButton-C3KgGt4z.js +2 -0
  25. package/dist/client/assets/{ChatMarkdown-DfVVLQX2.js → ChatMarkdown-9gWM0ED9.js} +9 -9
  26. package/dist/client/assets/{CheckboxIndicator-IpoyLEZ-.js → CheckboxIndicator-DbU3csPQ.js} +2 -2
  27. package/dist/client/assets/{ClippedText-DTOlMbAH.js → ClippedText-CS_BYNco.js} +2 -2
  28. package/dist/client/assets/{CodexSetupSection.logic-B5cbwzh2.js → CodexSetupSection.logic-CNbTXxKb.js} +2 -2
  29. package/dist/client/assets/{ComboboxClear-DsPTusk5.js → ComboboxClear-Bn_kslrf.js} +2 -2
  30. package/dist/client/assets/{ComboboxGroupLabel-DqaoaBhS.js → ComboboxGroupLabel-fL8lMA25.js} +2 -2
  31. package/dist/client/assets/{CommandBlock-Da9iVEid.js → CommandBlock-DcQXu_lq.js} +2 -2
  32. package/dist/client/assets/ComposerPromptEditor-DQ9wFfKn.js +204 -0
  33. package/dist/client/assets/{CompositeRoot-Dfl7FdSL.js → CompositeRoot-BuwzXGHT.js} +2 -2
  34. package/dist/client/assets/{ConnectionDiagnosisDetails-DCPX1JuG.js → ConnectionDiagnosisDetails-DGbJY7Hw.js} +2 -2
  35. package/dist/client/assets/{ConnectionStatusDot-DVkDejK1.js → ConnectionStatusDot-CixsTBXI.js} +2 -2
  36. package/dist/client/assets/{DRLTVNUE-BEVEy9Nb.js → DRLTVNUE-Cbb71R0Y.js} +2 -2
  37. package/dist/client/assets/{DYY6UVD2-DtPiS3Ow.js → DYY6UVD2-BZn5fuF5.js} +2 -2
  38. package/dist/client/assets/{DevicePanel-B8KdDbzD.js → DevicePanel-JP__PY1s.js} +2 -2
  39. package/dist/client/assets/{DeviceSetup-5wa1rPPZ.js → DeviceSetup-D8qb_qBj.js} +2 -2
  40. package/dist/client/assets/{DialogTitle-JDa7kdjH.js → DialogTitle-B_9LEmy3.js} +2 -2
  41. package/dist/client/assets/{DiffCommentAnnotation-Bp1MeIVC.js → DiffCommentAnnotation-WMKzOwCh.js} +2 -2
  42. package/dist/client/assets/{DiffFileTree-b24emCci.js → DiffFileTree-BSbsOOmA.js} +2 -2
  43. package/dist/client/assets/DiffPanel-BWFuiHvv.js +2 -0
  44. package/dist/client/assets/{DiffWorkerPoolProvider-BoEAlLkf.js → DiffWorkerPoolProvider-BBk0lIX3.js} +2 -2
  45. package/dist/client/assets/EmbeddedDesign-B4RMmwTG.css +1 -0
  46. package/dist/client/assets/EmbeddedDesign-D5YUndkh.js +21 -0
  47. package/dist/client/assets/{EnvironmentMachineIcon-Emg7F_9r.js → EnvironmentMachineIcon-Dpgx67FY.js} +2 -2
  48. package/dist/client/assets/{ExpandableText-CK6tzx1k.js → ExpandableText-Cpm1gOKG.js} +2 -2
  49. package/dist/client/assets/{FNOVOB4O-C31Sm0mF.js → FNOVOB4O-BkEIrB0k.js} +2 -2
  50. package/dist/client/assets/{FieldControl-7KI8YfqD.js → FieldControl-BHe6unoZ.js} +2 -2
  51. package/dist/client/assets/{FileDiff-CXJUPm2t.js → FileDiff-C1vAOUga.js} +2 -2
  52. package/dist/client/assets/{FilePreviewPanel-BMID-IVR.js → FilePreviewPanel-CbpNevZP.js} +4 -4
  53. package/dist/client/assets/{FoldedSettingsSection-Dzi9RecU.js → FoldedSettingsSection-DySTg20x.js} +2 -2
  54. package/dist/client/assets/{FormContext-DAP0MupI.js → FormContext-CmvUzTS-.js} +2 -2
  55. package/dist/client/assets/{HDGCDEEZ-DZ2nNieb.js → HDGCDEEZ-CN-ckGDk.js} +2 -2
  56. package/dist/client/assets/{HSJLKHB7-DlFBBKjs.js → HSJLKHB7-B0BvmnZE.js} +2 -2
  57. package/dist/client/assets/{Icons-aTRNsMJy.js → Icons-B4l3TqYa.js} +2 -2
  58. package/dist/client/assets/Input-Cv-TKh6s.js +2 -0
  59. package/dist/client/assets/JZOYTAAL-CB_B_Rei.js +1 -0
  60. package/dist/client/assets/{K3MD6TGW-Drb40Qks.js → K3MD6TGW-IS0rWO1U.js} +2 -2
  61. package/dist/client/assets/{K7RP3OMA-C0M5Zt3R.js → K7RP3OMA-DcqjCOJO.js} +2 -2
  62. package/dist/client/assets/{KeybindingsSettings.logic-mOtug0lc.js → KeybindingsSettings.logic-mF9mJWrc.js} +2 -2
  63. package/dist/client/assets/{LHDIQX7Q-CdTAxECn.js → LHDIQX7Q-CLMgIt4Y.js} +2 -2
  64. package/dist/client/assets/{LUXOKEGN-DtIPjv1z.js → LUXOKEGN-B1dkmN_M.js} +2 -2
  65. package/dist/client/assets/{MathTypeset-DTaIJ55e.js → MathTypeset-qeRVy_bc.js} +2 -2
  66. package/dist/client/assets/{N3JZAHOW-C8Pvhbkj.js → N3JZAHOW-C6sq5aqx.js} +2 -2
  67. package/dist/client/assets/{NUIALGQ3-DY7_VZ5G.js → NUIALGQ3-BG7xJ_qe.js} +2 -2
  68. package/dist/client/assets/{NoProjectsHero-CDfuCTEv.js → NoProjectsHero-B0KzU91d.js} +2 -2
  69. package/dist/client/assets/{O65XPQGZ-BH6EzDhm.js → O65XPQGZ-BEfVfDlS.js} +2 -2
  70. package/dist/client/assets/{O7XIQ6OM-BSPRvWV7.js → O7XIQ6OM-BUiRjV87.js} +2 -2
  71. package/dist/client/assets/{OFQON5FD-VO8HiyY7.js → OFQON5FD-DTgVPbd-.js} +2 -2
  72. package/dist/client/assets/{P4ConnectAccountPages-Cbg00I7Q.js → P4ConnectAccountPages-C4KYM5XU.js} +2 -2
  73. package/dist/client/assets/{P4ConnectSidebarSignIn-C9gBlkFF.js → P4ConnectSidebarSignIn-DNPUNJl_.js} +2 -2
  74. package/dist/client/assets/{PJQHF43J-yTbK55y3.js → PJQHF43J-QRnhQpHu.js} +2 -2
  75. package/dist/client/assets/PanelLayoutControls-4VFKEoHg.js +216 -0
  76. package/dist/client/assets/{PierreEntryIcon-HuUxlwtG.js → PierreEntryIcon-DeI-j_7w.js} +2 -2
  77. package/dist/client/assets/{PopoverHandle-CG975ng4.js → PopoverHandle-DMB4QSp6.js} +2 -2
  78. package/dist/client/assets/PreviewPanel-CO66mekh.js +2 -0
  79. package/dist/client/assets/ProjectDefaultsSettings-BF-iyQ8T.js +2 -0
  80. package/dist/client/assets/{ProjectFavicon-UXGwc_-W.js → ProjectFavicon-_6hkSNzm.js} +3 -3
  81. package/dist/client/assets/{ProjectIconPickerDialog-BAM7e1e5.js → ProjectIconPickerDialog-DeL1rZxy.js} +2 -2
  82. package/dist/client/assets/{ProjectMonogram-f16fmYcx.js → ProjectMonogram-Cn4l-YGU.js} +2 -2
  83. package/dist/client/assets/{ProviderAuthTerminal-e0ZkNHAb.js → ProviderAuthTerminal-qGeMxZDy.js} +2 -2
  84. package/dist/client/assets/ProviderModelPicker-DJQYH_Pp.js +2 -0
  85. package/dist/client/assets/{ProviderSettingsForm-CXMFT8YA.js → ProviderSettingsForm-BSVuPnR0.js} +2 -2
  86. package/dist/client/assets/PullRequestCodeTab-0OaJE6XS.js +6 -0
  87. package/dist/client/assets/{RHNBAITX-TQrYdbHC.js → RHNBAITX-ChqB7inB.js} +2 -2
  88. package/dist/client/assets/{ReadOnlySourcePreview-xMB_y284.js → ReadOnlySourcePreview-B08Wms4m.js} +2 -2
  89. package/dist/client/assets/{RenderErrorBoundary-C2ZkZ4DB.js → RenderErrorBoundary-BsOuLEci.js} +3 -3
  90. package/dist/client/assets/{SLD4V6NK-Bz1tyL2C.js → SLD4V6NK-IkYRGtTH.js} +2 -2
  91. package/dist/client/assets/ScheduledTasksSettings-1UDkELZo.js +4 -0
  92. package/dist/client/assets/{ScopedSwitch-DBUAjY1n.js → ScopedSwitch-Bhp6-hCj.js} +2 -2
  93. package/dist/client/assets/{ScrollAreaCorner-U1Zhpkdl.js → ScrollAreaCorner-BPMuWLbs.js} +2 -2
  94. package/dist/client/assets/{SecretInput-BxYmGvR5.js → SecretInput-RlOzrLKL.js} +2 -2
  95. package/dist/client/assets/{SelectScrollUpArrow-CJ4E0xi4.js → SelectScrollUpArrow-6kh66YCd.js} +2 -2
  96. package/dist/client/assets/{SettingsPanels-DRK5QQ04.js → SettingsPanels-BfBUSBAG.js} +6 -6
  97. package/dist/client/assets/{SettingsPanels.logic-Bdp6GzIj.js → SettingsPanels.logic-BsFZYDgm.js} +2 -2
  98. package/dist/client/assets/{SettingsScopeNotice-DYiUHoov.js → SettingsScopeNotice-H7UzC9bb.js} +2 -2
  99. package/dist/client/assets/{T3PCR2KE-DJwqsK9f.js → T3PCR2KE-BxaunvVy.js} +2 -2
  100. package/dist/client/assets/{TKWO2OVW-CRU32th0.js → TKWO2OVW-DFURsfqA.js} +2 -2
  101. package/dist/client/assets/{TSHNXIZL-dMhDuHVe.js → TSHNXIZL-CIukdyLy.js} +2 -2
  102. package/dist/client/assets/{ThemeEditorPanel-BIQc-w2Q.js → ThemeEditorPanel-otrA-nTg.js} +3 -3
  103. package/dist/client/assets/{ThreadTerminalDrawer-BqO5rPzw.js → ThreadTerminalDrawer-BQKZCFAC.js} +4 -4
  104. package/dist/client/assets/TooltipViewport-ZmVCer7P.js +2 -0
  105. package/dist/client/assets/{UQJE5E4I-DH2S3Hdw.js → UQJE5E4I-CfqCotH2.js} +2 -2
  106. package/dist/client/assets/{USNYFO5S-Cfz4g-2W.js → USNYFO5S-CctAAheU.js} +2 -2
  107. package/dist/client/assets/{Virtualizer-ChRGRE40.js → Virtualizer-CImHNxBq.js} +2 -2
  108. package/dist/client/assets/{WEVWDWVA-C55QWN7O.js → WEVWDWVA-DS9YO9IT.js} +2 -2
  109. package/dist/client/assets/{WorkspaceBreadcrumb-8nBISaRF.js → WorkspaceBreadcrumb-BW_omYU1.js} +2 -2
  110. package/dist/client/assets/{WorkspacePageContainer-BGE_kHaP.js → WorkspacePageContainer-BS8FWt_4.js} +2 -2
  111. package/dist/client/assets/{WorkspacePageHeader-D704geLh.js → WorkspacePageHeader-CE_94tTR.js} +2 -2
  112. package/dist/client/assets/{X5RFHQXM-hmS6q1sh.js → X5RFHQXM-B0KbwoE1.js} +2 -2
  113. package/dist/client/assets/{X62E3GBT-BhTtqjj4.js → X62E3GBT-wpz8X9Yh.js} +2 -2
  114. package/dist/client/assets/{XBNEOJTC-1paZyqxX.js → XBNEOJTC-DFRK5c6Y.js} +2 -2
  115. package/dist/client/assets/{YHV2MVVZ-DbfthGUh.js → YHV2MVVZ-1NnqTTZ2.js} +2 -2
  116. package/dist/client/assets/{YURCZMG2-D8tAzwGP.js → YURCZMG2-rnzWY5ij.js} +2 -2
  117. package/dist/client/assets/{YVG2LODB-DMSQWWQ_.js → YVG2LODB-Dxuuk2M-.js} +2 -2
  118. package/dist/client/assets/_chat-1QGQLbCc.js +45 -0
  119. package/dist/client/assets/{_chat.design-CdPf_wsA.js → _chat.design-z2pu_9A5.js} +2 -2
  120. package/dist/client/assets/{_chat.index-BkTRJLOf.js → _chat.index-D8X9o5jY.js} +2 -2
  121. package/dist/client/assets/{_chat.new-CEmRJFEH.js → _chat.new-CGJw8cpo.js} +3 -3
  122. package/dist/client/assets/_chat.pull-requests-BfW9qMU1.js +2 -0
  123. package/dist/client/assets/{alert-DiE1d01s.js → alert-DO06etEs.js} +2 -2
  124. package/dist/client/assets/{assetUrls-BeScRf6b.js → assetUrls-CmOUMX2M.js} +2 -2
  125. package/dist/client/assets/assets-aBpLf8r4.js +2 -0
  126. package/dist/client/assets/{browserHistoryStore-hrG24FfH.js → browserHistoryStore-tYgeZygn.js} +2 -2
  127. package/dist/client/assets/{browserLinkTarget-D8HEmVsi.js → browserLinkTarget-CQFfJKWJ.js} +2 -2
  128. package/dist/client/assets/{checkbox-CwFE3KXZ.js → checkbox-BEQFb7GO.js} +2 -2
  129. package/dist/client/assets/{color-picker-BKtR2mwD.js → color-picker-CXfnfmuH.js} +2 -2
  130. package/dist/client/assets/{combobox-DBUxcuwi.js → combobox--XoXA5uu.js} +2 -2
  131. package/dist/client/assets/{command-NV0JEoGo.js → command-E2aLhsct.js} +2 -2
  132. package/dist/client/assets/composer-logic-BPTz1APL.js +6 -0
  133. package/dist/client/assets/{composerDraftUploads-BmpBCVnP.js → composerDraftUploads-b_0oxKs9.js} +2 -2
  134. package/dist/client/assets/{connect-Bzgsrfe8.js → connect-CU9dNvTt.js} +2 -2
  135. package/dist/client/assets/{connect-agent-BCguLPkZ.js → connect-agent-Byc9PCdW.js} +2 -2
  136. package/dist/client/assets/{design-BGLTZdWG.js → design-CoGbXd61.js} +2 -2
  137. package/dist/client/assets/{device-D0-STSSP.js → device-DmH6IHQ4.js} +2 -2
  138. package/dist/client/assets/{dialog-pqqgtsKn.js → dialog-CBBxT1gk.js} +2 -2
  139. package/dist/client/assets/{diffRendering-eAJMSnXr.js → diffRendering-BOVFJuWd.js} +2 -2
  140. package/dist/client/assets/{dist-KeWCSS5h.js → dist-B2P3f-0Q.js} +3 -3
  141. package/dist/client/assets/{draft-input-DrGl-qts.js → draft-input-CSOOVntS.js} +2 -2
  142. package/dist/client/assets/{duoViewer-DKygyhUj.js → duoViewer-BhHYrurM.js} +2 -2
  143. package/dist/client/assets/{dynamic-DKhgWyT6.js → dynamic-BhzrutAo.js} +2 -2
  144. package/dist/client/assets/{embeddedScripts-WSYzbtcW.js → embeddedScripts-43_R83vp.js} +2 -2
  145. package/dist/client/assets/{empty-Du5F51Da.js → empty-FOL5U4KY.js} +2 -2
  146. package/dist/client/assets/entities-Bqo0n1Pb.js +2 -0
  147. package/dist/client/assets/{fileLinks-BEJjCE8r.js → fileLinks-D4GSqJYj.js} +2 -2
  148. package/dist/client/assets/{fileTreeExpansion-CCF3XVRn.js → fileTreeExpansion-BBT5F8P1.js} +2 -2
  149. package/dist/client/assets/{getDiffFileInput-Dkc1Whpr.js → getDiffFileInput-CGw09SPI.js} +2 -2
  150. package/dist/client/assets/{guideRunStore-CVyie1IJ.js → guideRunStore-DvIkVECt.js} +2 -2
  151. package/dist/client/assets/{htmlRender-fSOuRG49.js → htmlRender-CmEeFzCo.js} +2 -2
  152. package/dist/client/assets/{index-RvCv9K-x.js → index-B1djVqM4.js} +3 -3
  153. package/dist/client/assets/{input-GkmNnHh7.js → input-ekYqAkUx.js} +2 -2
  154. package/dist/client/assets/{input-group-Cql1yQRL.js → input-group-C3pxk97H.js} +2 -2
  155. package/dist/client/assets/{kbd-D2OGhJqG.js → kbd-3FPzNikV.js} +2 -2
  156. package/dist/client/assets/{keybindings-1XWkWeQB.js → keybindings-B3oDRRkK.js} +2 -2
  157. package/dist/client/assets/{lazy-BUyZ03gL.js → lazy-DyNR0b0B.js} +4 -4
  158. package/dist/client/assets/{lazyRouteComponent-BXmOK9bz.js → lazyRouteComponent-BPxq_G_s.js} +2 -2
  159. package/dist/client/assets/{link-BGMNeg05.js → link-B3B5a5Ju.js} +2 -2
  160. package/dist/client/assets/{linkedPrompt-B3l4m_6D.js → linkedPrompt-BsCPMHxQ.js} +2 -2
  161. package/dist/client/assets/main-BWh6jqG2.js +29 -0
  162. package/dist/client/assets/main-DdVSHl80.css +2 -0
  163. package/dist/client/assets/{mediaReference-CsA5Lv5E.js → mediaReference-Bb8H-qbI.js} +2 -2
  164. package/dist/client/assets/{mediaSource-BbYoxHZJ.js → mediaSource-C2MsZgy8.js} +2 -2
  165. package/dist/client/assets/number-field-SoHEiP55.js +2 -0
  166. package/dist/client/assets/{observeResize-CNtO3VS7.js → observeResize-3Vj9DYOV.js} +2 -2
  167. package/dist/client/assets/{onboarding-KXMrOHsw.js → onboarding-CPgiVEVK.js} +2 -2
  168. package/dist/client/assets/{openFileInPreview-BKTnNQFl.js → openFileInPreview-BBWCOLh_.js} +2 -2
  169. package/dist/client/assets/{p4ProjectFile-sAVjpCzn.js → p4ProjectFile-qmvlbzKv.js} +2 -2
  170. package/dist/client/assets/{pair-BIaVaT-B.js → pair-CZnRGdd8.js} +2 -2
  171. package/dist/client/assets/{pendingSendStore-CPz2p40W.js → pendingSendStore-L5KquCDf.js} +2 -2
  172. package/dist/client/assets/{phoneViewer-DGKQHyy3.js → phoneViewer-D-8v-sMf.js} +2 -2
  173. package/dist/client/assets/{pierre-icons-6ByaxkH5.js → pierre-icons-jwqMPUxD.js} +2 -2
  174. package/dist/client/assets/{popover-BIXQitBy.js → popover-OfG3wVsl.js} +2 -2
  175. package/dist/client/assets/{preview-BcEybEc8.js → preview-BYnEURcB.js} +2 -2
  176. package/dist/client/assets/{preview-C3ymkoAM.js → preview-DGdQ5Ycc.js} +2 -2
  177. package/dist/client/assets/{previewMiniPlayerStore-DWw2A_gt.js → previewMiniPlayerStore-Dlbj5KrZ.js} +2 -2
  178. package/dist/client/assets/primary-B47ivN3o.js +2 -0
  179. package/dist/client/assets/primaryCloudLinkState-CreqR0gU.js +2 -0
  180. package/dist/client/assets/projectFilesQueryState-CanWrACx.js +2 -0
  181. package/dist/client/assets/{projectScriptEditor-CNXQwWP8.js → projectScriptEditor-gWuw6vwd.js} +2 -2
  182. package/dist/client/assets/{providerSkills-CNeLyiqf.js → providerSkills-C_Rxqah9.js} +2 -2
  183. package/dist/client/assets/{pullRequestDetail.logic-BNpxef-3.js → pullRequestDetail.logic-RASi2EgP.js} +4 -4
  184. package/dist/client/assets/{pullRequestIcons-CSs54zQk.js → pullRequestIcons-ucGaXXG7.js} +2 -2
  185. package/dist/client/assets/{pullRequestReviewStore-BawbGhnx.js → pullRequestReviewStore-CEr41DEl.js} +2 -2
  186. package/dist/client/assets/pullRequests-Bw3Ui6hK.js +2 -0
  187. package/dist/client/assets/queries-EslKFJTV.js +2 -0
  188. package/dist/client/assets/query-d1pQlqP0.js +2 -0
  189. package/dist/client/assets/{radio-group-yq5YEgUO.js → radio-group-Ciy_K5uE.js} +2 -2
  190. package/dist/client/assets/{renderScheduler--3RDWz9Z.js → renderScheduler-CP-JkmKx.js} +2 -2
  191. package/dist/client/assets/rightPanelStore-D3KOmuPa.js +2 -0
  192. package/dist/client/assets/runtime-DR7JxgbQ.js +6 -0
  193. package/dist/client/assets/runtime-d6B1vJeH.js +3 -0
  194. package/dist/client/assets/runtimeModeConfig-Rxeb1uGg.js +2 -0
  195. package/dist/client/assets/{scheduledTasksSettings.logic-DefawCwN.js → scheduledTasksSettings.logic-CVIC4Kpr.js} +3 -3
  196. package/dist/client/assets/{scroll-area-CfW8fzQ8.js → scroll-area-yyfi3ycu.js} +2 -2
  197. package/dist/client/assets/{select-C10oXKGz.js → select-DaYjjw1q.js} +2 -2
  198. package/dist/client/assets/selfImproveFindings-1XIHD-7i.js +2 -0
  199. package/dist/client/assets/server-sXApTCjZ.js +2 -0
  200. package/dist/client/assets/{session-yxXjF8AQ.js → session-C949OsEI.js} +2 -2
  201. package/dist/client/assets/session-logic-DkSfwnHl.js +26 -0
  202. package/dist/client/assets/{settings-CgshkEb_.js → settings-B0O54Q3P.js} +2 -2
  203. package/dist/client/assets/{settings.appearance-yicuncxz.js → settings.appearance-BesXhA1a.js} +2 -2
  204. package/dist/client/assets/settings.archived-FtcZf_Ug.js +2 -0
  205. package/dist/client/assets/settings.computer-use-BeKmLbNe.js +2 -0
  206. package/dist/client/assets/settings.connections-D1UxckE0.js +2 -0
  207. package/dist/client/assets/{settings.data-controls-CZ5aXdyA.js → settings.data-controls-lPiIwMgc.js} +2 -2
  208. package/dist/client/assets/settings.decisions-D97jIUyr.js +2 -0
  209. package/dist/client/assets/{settings.designs-j9E6N2pN.js → settings.designs-B473PRvt.js} +2 -2
  210. package/dist/client/assets/settings.diagnostics-DDOaOIDg.js +2 -0
  211. package/dist/client/assets/{settings.general-BCrYSHkU.js → settings.general-qzEOE2zF.js} +2 -2
  212. package/dist/client/assets/settings.integrations-D6ctQ9WI.js +2 -0
  213. package/dist/client/assets/{settings.keybindings-BQ-LrcTn.js → settings.keybindings-BL57H4sD.js} +2 -2
  214. package/dist/client/assets/{settings.open-source-licenses-BHiHgzgF.js → settings.open-source-licenses-DaS82UhN.js} +2 -2
  215. package/dist/client/assets/{settings.plugins-DavhWo4Q.js → settings.plugins-DnS3RrT2.js} +4 -4
  216. package/dist/client/assets/{settings.projects-uuJOwkSl.js → settings.projects-D-ZICXey.js} +4 -4
  217. package/dist/client/assets/settings.providers-CFpCmv0o.js +3 -0
  218. package/dist/client/assets/{settings.scheduled-tasks-DoWHIDOp.js → settings.scheduled-tasks-IEAC3STn.js} +2 -2
  219. package/dist/client/assets/{settings.snap-shot-ClKlVUUJ.js → settings.snap-shot-BaOFk9WR.js} +2 -2
  220. package/dist/client/assets/{settings.source-control-o8jFa_Cr.js → settings.source-control-BW16AA5z.js} +2 -2
  221. package/dist/client/assets/{settings.storage-Bb-cW0xG.js → settings.storage-D4vBYBRP.js} +2 -2
  222. package/dist/client/assets/settingsLayout-CFQx1XDM.js +3 -0
  223. package/dist/client/assets/{sidebar-Bd6PzVyD.js → sidebar-C1E4GqL6.js} +2 -2
  224. package/dist/client/assets/{sidebarProjectGrouping-C13IyN_p.js → sidebarProjectGrouping-9cUrCOXH.js} +2 -2
  225. package/dist/client/assets/{skeleton-pd7m2J5F.js → skeleton-BCpBrYxh.js} +2 -2
  226. package/dist/client/assets/{sourceControl-Y9v_vyKt.js → sourceControl-DwJWPP0h.js} +2 -2
  227. package/dist/client/assets/{sourceControlClients-KQ5315mN.js → sourceControlClients-BBJW7ra4.js} +2 -2
  228. package/dist/client/assets/{spinner-CW23--q5.js → spinner-CSTrcxhP.js} +2 -2
  229. package/dist/client/assets/{terminal-links-Bd9AoAyA.js → terminal-links-D18LpQ1T.js} +2 -2
  230. package/dist/client/assets/{terminalSessions-CF7f4A-6.js → terminalSessions-C2NUFncF.js} +2 -2
  231. package/dist/client/assets/{textarea-DSS-lavF.js → textarea-R4UQ47Ns.js} +2 -2
  232. package/dist/client/assets/{themePalette-C_1pk_Mi.js → themePalette-neUNWCzK.js} +3 -3
  233. package/dist/client/assets/toast-B84QdqqM.js +2 -0
  234. package/dist/client/assets/{toggle-Cpfo0sMT.js → toggle-BH5BGBcD.js} +2 -2
  235. package/dist/client/assets/{toggle-group-FrArhs7R.js → toggle-group-Di3SFV73.js} +2 -2
  236. package/dist/client/assets/{tooltip-CSzrAm8M.js → tooltip-D-GRl-oZ.js} +2 -2
  237. package/dist/client/assets/{uiStateStore-VHQ8vDs5.js → uiStateStore-xSkh4_PU.js} +2 -2
  238. package/dist/client/assets/{usage-uwswTMhu.js → usage-DUdXloVo.js} +2 -2
  239. package/dist/client/assets/{usageAccess-BDwH_c8I.js → usageAccess-DSLF-sRE.js} +2 -2
  240. package/dist/client/assets/{usageFormat-CKgwjLMR.js → usageFormat-Bzyvr9m4.js} +2 -2
  241. package/dist/client/assets/{usageShortcuts-lXBRgPmi.js → usageShortcuts-D6nQeRtx.js} +2 -2
  242. package/dist/client/assets/{use-atom-command-CSWaAmR7.js → use-atom-command-DA6OG-Qk.js} +2 -2
  243. package/dist/client/assets/{useAriaLabelledBy-vgEmgPPR.js → useAriaLabelledBy-PLuOxvFb.js} +2 -2
  244. package/dist/client/assets/{useHandleNewThread-BVFM3SUe.js → useHandleNewThread-Dm0SCq59.js} +2 -2
  245. package/dist/client/assets/{useLocation-FEfJrgGU.js → useLocation-Bqc94klS.js} +2 -2
  246. package/dist/client/assets/{useNavigate-Lp_S-tAl.js → useNavigate-DdjG4MB_.js} +2 -2
  247. package/dist/client/assets/{useNavigateBack-BTJoRrRy.js → useNavigateBack-sP0LsL3p.js} +2 -2
  248. package/dist/client/assets/{useP4ConnectAuthPrompt-7Z8osIH2.js → useP4ConnectAuthPrompt-C9d7n33S.js} +2 -2
  249. package/dist/client/assets/{useParams-8KxPyQmv.js → useParams-DZQvRQLJ.js} +2 -2
  250. package/dist/client/assets/{usePermissionStatus-CyvlYHNs.js → usePermissionStatus-BzfAUU9X.js} +2 -2
  251. package/dist/client/assets/{usePullRequestActions-DfyxdDPg.js → usePullRequestActions-DIjGLg1E.js} +3 -3
  252. package/dist/client/assets/{useRegisterFieldControl-Dj6RbECy.js → useRegisterFieldControl-CyBVe0G0.js} +2 -2
  253. package/dist/client/assets/{useScopedModelAvailability-BfFbT2DU.js → useScopedModelAvailability-D4n22Nmm.js} +2 -2
  254. package/dist/client/assets/useSettings-CaJMqrvF.js +3 -0
  255. package/dist/client/assets/utils-BoMYW9A3.js +37 -0
  256. package/dist/client/assets/vcsRefInvalidation-w_CQ3i43.js +2 -0
  257. package/dist/client/assets/{welcome-CIETplg9.js → welcome-BIKH3rbU.js} +2 -2
  258. package/dist/client/index.html +1 -1
  259. package/dist/{renderer-D8FhaVWU.mjs → renderer-CveKT929.mjs} +26 -3
  260. package/dist/{runtime-a3PrAU7n.mjs → runtime-DGGSjC6Q.mjs} +149 -5
  261. package/package.json +1 -1
  262. package/dist/client/assets/AlertDialogRoot-B--i3imS.js +0 -2
  263. package/dist/client/assets/ChatGptUsageButton-LQ3LzsF3.js +0 -2
  264. package/dist/client/assets/ComposerPromptEditor-Bz4_w6ez.js +0 -204
  265. package/dist/client/assets/DiffPanel-bEjr64Vx.js +0 -2
  266. package/dist/client/assets/EmbeddedDesign-Cud7UEy4.css +0 -1
  267. package/dist/client/assets/EmbeddedDesign-DmRjhA9k.js +0 -21
  268. package/dist/client/assets/Input-rVh9fuLP.js +0 -2
  269. package/dist/client/assets/JZOYTAAL-DXVzZiqj.js +0 -1
  270. package/dist/client/assets/PanelLayoutControls-40ju6vkz.js +0 -216
  271. package/dist/client/assets/PreviewPanel-Ljaq9IHA.js +0 -2
  272. package/dist/client/assets/ProjectDefaultsSettings-DhwkzlK6.js +0 -2
  273. package/dist/client/assets/ProviderModelPicker-BviWI2wX.js +0 -2
  274. package/dist/client/assets/PullRequestCodeTab-Bm67cV34.js +0 -6
  275. package/dist/client/assets/ScheduledTasksSettings-D-GMMbJH.js +0 -4
  276. package/dist/client/assets/TooltipViewport-Bz56sWCM.js +0 -2
  277. package/dist/client/assets/_chat-CXVo1NVJ.js +0 -46
  278. package/dist/client/assets/_chat.pull-requests-4M0tUrJ6.js +0 -2
  279. package/dist/client/assets/assets-RdKoqY9e.js +0 -2
  280. package/dist/client/assets/composer-logic-BQdFVlkE.js +0 -6
  281. package/dist/client/assets/entities-n6SMnPE8.js +0 -2
  282. package/dist/client/assets/main-BP1f3auf.css +0 -2
  283. package/dist/client/assets/main-Dcfxjdkd.js +0 -29
  284. package/dist/client/assets/number-field-jauVDwvy.js +0 -2
  285. package/dist/client/assets/primary-DD11poOa.js +0 -2
  286. package/dist/client/assets/primaryCloudLinkState-CD2_f6q-.js +0 -2
  287. package/dist/client/assets/projectFilesQueryState-C8dGr8oR.js +0 -2
  288. package/dist/client/assets/pullRequests-jsc4Hq78.js +0 -2
  289. package/dist/client/assets/queries-DZV2RDc9.js +0 -2
  290. package/dist/client/assets/query-BV3IuYff.js +0 -2
  291. package/dist/client/assets/rightPanelStore-CeZBJCMI.js +0 -2
  292. package/dist/client/assets/runtime-DSZ2mWrf.js +0 -6
  293. package/dist/client/assets/runtime-DTUiqO10.js +0 -3
  294. package/dist/client/assets/runtimeModeConfig-BwioIXVs.js +0 -2
  295. package/dist/client/assets/server-ztj8tD38.js +0 -2
  296. package/dist/client/assets/session-logic-w7gGMFHb.js +0 -26
  297. package/dist/client/assets/settings.archived-ZXG8lJ_T.js +0 -2
  298. package/dist/client/assets/settings.computer-use-lOJg1Jos.js +0 -2
  299. package/dist/client/assets/settings.connections-DSPQOd-W.js +0 -2
  300. package/dist/client/assets/settings.decisions-C8qxQCjl.js +0 -2
  301. package/dist/client/assets/settings.diagnostics-yio3SGbE.js +0 -2
  302. package/dist/client/assets/settings.integrations-Dl-vtiOS.js +0 -2
  303. package/dist/client/assets/settings.providers-rZQTQdtf.js +0 -3
  304. package/dist/client/assets/settingsLayout-DzBeWTUO.js +0 -3
  305. package/dist/client/assets/toast-BFuAqla3.js +0 -2
  306. package/dist/client/assets/useSettings-CPPvBMmM.js +0 -3
  307. package/dist/client/assets/utils-BE5iQuUP.js +0 -37
  308. package/dist/client/assets/vcsRefInvalidation-DCdd2BDA.js +0 -2
@@ -1,26 +0,0 @@
1
- import{$g as e,Bs as t,Cu as n,Du as r,Eu as i,Ot as a,Ou as o,Rs as s,Tu as c,V as l,_E as u,bE as d,gx as f,n_ as p,ux as m,wu as ee}from"./utils-BE5iQuUP.js";import{Kt as te,Ut as h,an as ne,d as re,in as ie,qt as ae,yn as oe}from"./runtime-DTUiqO10.js";import{h as se}from"./htmlRender-fSOuRG49.js";import{n as ce,t as le}from"./mediaSource-BbYoxHZJ.js";import{l as ue}from"./usageFormat-CKgwjLMR.js";function g(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function _(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function de(e,t){if(e!==`Skill`)return;let n=g(t),r=_(n?.skill);return r===void 0?void 0:{name:r,args:_(n?.args)}}function fe(e){return e===`js`||e===`cua_repl.js`||e===`node_repl.js`}var pe={key:`computer-use`,name:`Computer Use`,kind:`computer`};function me(e,t){if(e===`cua_repl.js`)return`computer`;let n=g(t)?.code;return fe(e)&&typeof n==`string`&&(/\bsky\s*\./u.test(n)||/["']@oai\/sky["']/u.test(n))?`computer`:void 0}function he(e,t,n){if(fe(e)){let r=_(n),i=r&&r.toLowerCase()!==`js`&&r.toLowerCase()!==e?.toLowerCase()?r:void 0;return _(g(t)?.title)??i??(me(e,t)===`computer`?`Computer use`:`Run JavaScript`)}let r=de(e,t);return r===void 0?void 0:`Skill: ${r.name}`}function ge(e){return e!==void 0&&Object.keys(e).length>0}var _e=[`path`,`filePath`,`file_path`,`relativePath`,`filename`,`fileName`,`newPath`,`oldPath`];function v(e,t,n,r){if(r>4||t.length>=8)return;if(Array.isArray(e)){for(let i of e)if(v(i,t,n,r+1),t.length>=8)return;return}let i=g(e);if(i){for(let e of _e){let r=_(i[e]);if(r&&!n.has(r)&&(n.add(r),t.push(r),t.length>=8))return}for(let e of[`locations`,`item`,`input`,`result`,`rawInput`,`data`,`changes`])if(e in i&&(v(i[e],t,n,r+1),t.length>=8))return}}function ve(e){let t=[];return v(e,t,new Set,0),t}function ye(e){let t=_(e);if(t&&!/__|[./]/u.test(t))return t.replace(/[_\s-]/gu,``).toLowerCase()}function be(e){let t=e.itemType??void 0,n=_(e.requestKind)?.toLowerCase(),r=_(e.data?.kind)?.toLowerCase(),i=ye(_(e.data?.toolName)??_(g(e.data?.item)?.tool));return t===`command_execution`?`command`:t===`image_view`?`read`:t===`file_change`?`file_change`:t===`web_search`?`search`:n===`command`||r===`execute`?`command`:n===`file-change`||r===`edit`||r===`move`||r===`delete`||r===`write`?`file_change`:r===`search`||i===`find`||i===`grep`||i===`glob`||i===`rg`||i===`ls`?`search`:n===`file-read`||r===`read`?`read`:i===`terminal`||i===`bash`||i===`shell`?`command`:i===`read`||i===`readfile`?`read`:`other`}var xe=[`pattern`,`query`,`searchTerm`,`regex`,`grep`,`needle`],Se=[`glob`,`globPattern`,`glob_pattern`,`include`,`filePattern`,`file_pattern`],Ce=[`path`,`target_directory`,`targetDirectory`,`directory`,`cwd`,`root`];function y(e,t){if(e)for(let n of t){let t=_(e[n]);if(t)return t}}function we(e){return[e?.rawInput,e?.input,g(e?.item)?.input].map(g).find(e=>ge(e??void 0))??e}function Te(e){if(e)return e.split(/[\\/]/u).findLast(e=>e.length>0&&e!==`.`)}function Ee(e){let t=we(e),n=y(t,xe),r=y(t,Se),i=Te(y(t,Ce));if(n&&i)return`Searched ${n} in ${i}`;if(r&&i)return`Searched files ${r} in ${i}`;if(r)return`Searched files ${r}`;if(n)return`Searched ${n}`;if(i)return`Searched in ${i}`}function De(e,t=0){let n=e.trim(),r=t>0?` +${t} more`:``;return n?`Read ${n}${r}`:`Read file${r}`}function b(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function x(e,t){if(typeof e!=`string`)return;let n=e.trim();return n&&n.length<=t?n:void 0}function S(e){let t=x(e,4096);if(t)try{let e=new URL(t);return e.protocol===`http:`||e.protocol===`https:`||e.protocol===`data:`?e.href:void 0}catch{return}}function Oe(e){let t=x(e,4096);if(t)try{let e=new URL(t);return e.protocol===`http:`||e.protocol===`https:`?e.href:void 0}catch{return}}function ke(e){let t=b(e),n=x(t?.appId,512);if(t?._tag===`app-id`&&n&&/^[A-Za-z0-9._-]+$/u.test(n))return{_tag:`app-id`,appId:n};let r=x(t?.displayName,160);if(t?._tag===`display-name`&&r)return{_tag:`display-name`,displayName:r}}function Ae(e){let t=b(e);if(t?._tag===`website`){let e=Oe(t.pageUrl),n=S(t.faviconUrl),r=S(t.faviconUrlDark);if(e)return{_tag:`website`,pageUrl:e,...n?{faviconUrl:n}:{},...r?{faviconUrlDark:r}:{}}}if(t?._tag===`native-app`){let e=ke(t.app);if(e)return{_tag:`native-app`,app:e}}if(t?._tag===`themed-logo`){let e=S(t.logoUrl),n=S(t.logoUrlDark);if(e)return{_tag:`themed-logo`,logoUrl:e,...n?{logoUrlDark:n}:{}}}}function je(e){let t=b(e),n=x(t?.key,512),r=x(t?.name,160),i=t?.kind;if(!n||!r||i!==`browser`&&i!==`computer`&&i!==`integration`)return;let a=Ae(t?.icon);return{key:n,name:r,kind:i,...a?{icon:a}:{}}}function Me(e){let t=b(e),n=je(t?.toolSource),r=t?.toolSurface===`browser`||t?.toolSurface===`computer`?t.toolSurface:n?.kind===`computer`||n?.kind===`browser`?n.kind:t?.type===`dynamic_tool`?me(typeof t.toolName==`string`?t.toolName:void 0,t.input):void 0,i=r===`computer`&&n?.kind!==`computer`?pe:n,a=Ae(t?.toolIcon),o=x(t?.viewedImagePath,4096);return{...r?{toolSurface:r}:{},...a?{toolIcon:a}:{},...i?{toolSource:i}:{},...o&&!/[\r\n]/.test(o)&&re(o)?{viewedImagePath:o}:{}}}var Ne=`2026-01-26`,C=`p4McpApp`,Pe=80,Fe=2e3,Ie=32,Le=256,Re=256,ze=4096,Be=/^(?:https?|wss?):\/\/(?:\*\.)?[a-z0-9-]+(?:\.[a-z0-9-]+)*(?::\d{1,5})?$/i;function Ve(e){if(!Array.isArray(e))return;let t=e.filter(e=>typeof e==`string`&&e.length<=Le&&Be.test(e)).slice(0,Ie);return t.length===0?void 0:t}function He(e){if(!d(e))return;let t={};for(let n of[`connectDomains`,`resourceDomains`,`frameDomains`,`baseUriDomains`]){let r=Ve(e[n]);r!==void 0&&(t[n]=r)}return Object.keys(t).length===0?void 0:t}var Ue=[`camera`,`microphone`,`geolocation`,`clipboardWrite`];function We(e){if(!d(e))return;let t={};for(let n of Ue)d(e[n])&&(t[n]={});return Object.keys(t).length===0?void 0:t}var w=e=>typeof e==`string`&&e.trim()!==``&&e.length<=Re?e:void 0;function Ge(e){if(!d(e))return;let t=w(e.attachmentId),n=w(e.server),r=w(e.tool),i=typeof e.resourceUri==`string`&&e.resourceUri.length<=ze?e.resourceUri:void 0;if(t===void 0||n===void 0||r===void 0||i===void 0||!i.startsWith(`ui://`))return;let a=He(e.csp),o=We(e.permissions);return{attachmentId:t,server:n,tool:r,resourceUri:i,...a===void 0?{}:{csp:a},...o===void 0?{}:{permissions:o},...typeof e.prefersBorder==`boolean`?{prefersBorder:e.prefersBorder}:{}}}function Ke(e,t){return e.attachmentId===t.attachmentId&&e.server===t.server&&e.tool===t.tool&&e.resourceUri===t.resourceUri}function qe(e){let t=[];return e?.camera&&t.push(`camera`),e?.microphone&&t.push(`microphone`),e?.geolocation&&t.push(`geolocation`),e?.clipboardWrite&&t.push(`clipboard-write`),t.join(`; `)}function Je(e){return Number.isFinite(e)?Math.round(Math.min(Fe,Math.max(Pe,e))):320}function Ye(e){return`${e.tool.replace(/[^\w.-]+/g,`-`).slice(0,80)||`app`}.html`}function T(e,t,n=`p4-code`,r=`${e[0]} ${e[3]}`){return{displayName:r,labels:e,icon:n,summaryAction:t}}var Xe=new Set([`p4-code`,`p4_code`,`p4code`]),E={p4_computer_use:T([`Control`,`Controlling`,`Controlled`,`a computer`],`browser`,`browser`),p4_computer_use_reset:T([`Reset`,`Resetting`,`Reset`,`Computer Use`],`browser`,`browser`),p4_computer_use_hosts:T([`List`,`Listing`,`Listed`,`Computer Use hosts`],`browser`,`browser`),p4_decide:T([`Ask`,`Asking`,`Asked`,`Decisions`],`decide`),link_pull_request:T([`Link`,`Linking`,`Linked`,`a pull request`],`link-pr`,`pull-request`),unlink_pull_request:T([`Unlink`,`Unlinking`,`Unlinked`,`a pull request`],`unlink-pr`,`pull-request`),list_thread_pull_requests:T([`Check`,`Checking`,`Checked`,`linked pull requests`],`list-prs`,`pull-request`),watch_pull_request:T([`Watch`,`Watching`,`Watching`,`a pull request`],`watch-pr`,`pull-request`),unwatch_pull_request:T([`Stop watching`,`Stopping watching`,`Stopped watching`,`a pull request`],`unwatch-pr`,`pull-request`),write_pull_request_guides:T([`Write`,`Writing`,`Started`,`review guides`],`write-pr-guides`,`pull-request`),read_pull_request_guide:T([`Read`,`Reading`,`Read`,`a review guide`],`read-pr-guide`,`pull-request`),orchestrator_capabilities:T([`Get`,`Getting`,`Got`,`orchestration capabilities`],`capabilities`),delegate_task:T([`Delegate`,`Delegating`,`Delegated`,`a child task`],`delegate`),task_status:T([`Get`,`Getting`,`Got`,`delegated task status`],`task-status`),task_cancel:T([`Cancel`,`Canceling`,`Requested cancellation of`,`delegated task`],`task-cancel`),schedule_task:T([`Schedule`,`Scheduling`,`Scheduled`,`a recurring task`],`schedule-create`),list_scheduled_tasks:T([`List`,`Listing`,`Listed`,`scheduled tasks`],`schedule-list`),update_scheduled_task:T([`Update`,`Updating`,`Updated`,`a scheduled task`],`schedule-update`),delete_scheduled_task:T([`Delete`,`Deleting`,`Requested deletion of`,`a scheduled task`],`schedule-delete`),request_secret:T([`Ask for`,`Asking for`,`Asked for`,`a secret`],`secret-request`),create_threads:T([`Create`,`Creating`,`Created`,`P4 threads`],`thread-create`),p4_thread_start:T([`Start`,`Starting`,`Started`,`a P4 Code thread`],`thread-create`),p4_thread_list:T([`List`,`Listing`,`Listed`,`P4 threads`],`thread-list`),p4_thread_read:T([`Read`,`Reading`,`Read`,`a P4 Code thread`],`thread-read`),p4_thread_send:T([`Send`,`Sending`,`Sent`,`to a P4 Code thread`],`thread-send`),p4_thread_wait:T([`Wait`,`Waiting`,`Waited`,`for a P4 Code thread`],`thread-wait`),p4_workflow_stop:T([`Stop`,`Stopping`,`Requested a stop for`,`a workflow`],`workflow-stop`),p4_thread_interrupt:T([`Interrupt`,`Interrupting`,`Requested an interrupt of`,`a P4 Code thread`],`thread-interrupt`),p4_worktree_handoff:T([`Hand off`,`Handing off`,`Handed off`,`thread to a git worktree`],`worktree-handoff`),p4_worktree_status:T([`Get`,`Getting`,`Got`,`thread worktree status`],`worktree-status`),preview_status:T([`Get`,`Getting`,`Got`,`preview browser status`],`browser`,`browser`),preview_open:T([`Open`,`Opening`,`Opened`,`a page in the preview browser`],`browser`,`browser`),preview_navigate:T([`Navigate`,`Navigating`,`Navigated`,`the preview browser`],`browser`,`browser`),preview_dialog:T([`Respond`,`Responding`,`Responded`,`to a preview browser dialog`],`browser`,`browser`),preview_snapshot:T([`Take a snapshot of`,`Taking a snapshot of`,`Took a snapshot of`,`the preview page`],`browser`,`browser`,`Snapshot the preview page`),preview_click:T([`Click`,`Clicking`,`Clicked`,`in the preview browser`],`browser`,`browser`),preview_press:T([`Press`,`Pressing`,`Pressed`,`a key in the preview browser`],`browser`,`browser`),preview_type:T([`Type`,`Typing`,`Typed`,`in the preview browser`],`browser`,`browser`),preview_hover:T([`Hover`,`Hovering`,`Hovered`,`in the preview browser`],`browser`,`browser`),preview_select:T([`Choose`,`Choosing`,`Chose`,`an option in the preview browser`],`browser`,`browser`),preview_drag:T([`Drag`,`Dragging`,`Dragged`,`in the preview browser`],`browser`,`browser`),preview_upload:T([`Upload`,`Uploading`,`Uploaded`,`files to the preview browser`],`browser`,`browser`),preview_scroll:T([`Scroll`,`Scrolling`,`Scrolled`,`the preview browser`],`browser`,`browser`),preview_resize:T([`Resize`,`Resizing`,`Resized`,`the preview browser`],`browser`,`browser`),preview_evaluate:T([`Evaluate`,`Evaluating`,`Evaluated`,`script in the preview browser`],`browser`,`browser`),preview_wait_for:T([`Wait`,`Waiting`,`Waited`,`for the preview page`],`browser`,`browser`),preview_set_appearance:T([`Set`,`Setting`,`Set`,`preview browser appearance`],`browser`,`browser`),preview_recording_start:T([`Start`,`Starting`,`Started`,`recording the preview browser`],`browser`,`browser`),preview_recording_stop:T([`Stop`,`Stopping`,`Stopped`,`recording the preview browser`],`browser`,`browser`),device_list:T([`List`,`Listing`,`Listed`,`simulators and emulators`],`device`,`device`),device_open:T([`Open`,`Opening`,`Opened`,`a device in the Device panel`],`device`,`device`),device_screenshot:T([`Take a screenshot of`,`Taking a screenshot of`,`Took a screenshot of`,`the device`],`device`,`device`),device_close:T([`Close`,`Closing`,`Closed`,`a device`],`device`,`device`),run_scheduled_task_now:T([`Run`,`Running`,`Requested a run of`,`a scheduled task`],`schedule-run`),p4_queue_list:T([`List`,`Listing`,`Listed`,`queued messages`],`queue-list`),p4_queue_read:T([`Read`,`Reading`,`Read`,`a queued message`],`queue-read`),p4_queue_edit:T([`Edit`,`Editing`,`Edited`,`a queued message`],`queue-edit`),p4_queue_cancel:T([`Cancel`,`Canceling`,`Requested cancellation of`,`a queued run`],`queue-cancel`),p4_queue_reorder:T([`Reorder`,`Reordering`,`Reordered`,`a queued run`],`queue-reorder`),p4_queue_promote_to_steer:T([`Steer with`,`Steering with`,`Requested steering with`,`a queued message`],`queue-steer`),p4_pending_request_list:T([`List`,`Listing`,`Listed`,`pending requests`],`question-list`),p4_pending_request_read:T([`Read`,`Reading`,`Read`,`pending requests`],`question-read`),p4_pending_request_respond:T([`Respond to`,`Responding to`,`Responded to`,`pending requests`],`question-respond`),p4_thread_diff:T([`Read`,`Reading`,`Read`,`a thread diff`],`thread-read`),p4_thread_configuration:T([`Read`,`Reading`,`Read`,`thread configuration`],`thread-configuration`),p4_thread_configure:T([`Set`,`Setting`,`Set`,`thread model`],`thread-configure`),p4_thread_fork:T([`Fork`,`Forking`,`Requested a fork of`,`this thread`],`thread-fork`),p4_thread_merge_back:T([`Merge`,`Merging`,`Requested a merge of`,`thread context`],`thread-merge`),p4_thread_search:T([`Search`,`Searching`,`Searched`,`thread content`],`thread-search`),p4_thread_transfers:T([`Read`,`Reading`,`Read`,`thread transfers`],`thread-transfers`),p4_thread_organize:T([`Organize`,`Organizing`,`Organized`,`a thread`],`thread-organize`),p4_thread_update:T([`Update`,`Updating`,`Updated`,`P4 Code thread metadata`],`thread-update`),p4_worktree_list:T([`List`,`Listing`,`Listed`,`workspace branches`],`worktree-list`),p4_preview_list:T([`List`,`Listing`,`Listed`,`preview tabs`],`browser`,`browser`),p4_preview_close:T([`Close`,`Closing`,`Closed`,`a preview tab`],`browser`,`browser`),p4_environment_read:T([`Read`,`Reading`,`Read`,`environment preferences`],`environment-read`),p4_environment_preferences_update:T([`Update`,`Updating`,`Updated`,`environment preferences`],`environment-update`),p4_mcp_server_list:T([`List`,`Listing`,`Listed`,`MCP servers`],`environment-read`),p4_mcp_server_set_enabled:T([`Update`,`Updating`,`Updated`,`an MCP server`],`environment-update`),p4_thread_launch:T([`Launch`,`Launching`,`Launched`,`a project thread`],`thread-create`),p4_project_list:T([`List`,`Listing`,`Listed`,`projects`],`project-list`),p4_project_read:T([`Read`,`Reading`,`Read`,`a project`],`project-read`),p4_project_create:T([`Register`,`Registering`,`Registered`,`a project`],`project-create`),p4_project_update:T([`Update`,`Updating`,`Updated`,`a project`],`project-update`),p4_project_delete:T([`Delete`,`Deleting`,`Deleted`,`a project`],`project-delete`),p4_project_clone:T([`Clone`,`Cloning`,`Cloned`,`a repository`],`project-clone`),p4_attachment_prepare_upload:T([`Prepare`,`Preparing`,`Prepared`,`an attachment upload`],`attachment-prepare`),p4_attachment_discard:T([`Discard`,`Discarding`,`Discarded`,`a pending attachment`],`attachment-discard`),p4_thread_send_attachments:T([`Send`,`Sending`,`Sent`,`attachments`],`attachment-send`),html_preview:T([`Preview`,`Previewing`,`Previewed`,`an HTML page`],`html-preview`),html_render:T([`Render`,`Rendering`,`Rendered`,`an HTML page`],`html-render`)};new Set(Object.keys(E));function Ze(e){return e.replace(/\s+(?:complete|completed)\s*$/i,``).trim()}function Qe(e){let t=Ze(e),n=/^mcp__(?<server>.+?)__(?<tool>.+)$/i.exec(t);if(n?.groups){let{server:e,tool:t}=n.groups;return e!==void 0&&t!==void 0&&Xe.has(e.toLowerCase())?t:null}let r=/^(?<server>p4[-_]?code)(?:[.:/]|\s*·\s*)(?<tool>.+)$/i.exec(t);if(r?.groups)return r.groups.tool??null;let i=/^(?:mcp[-_]{1,2})?p4[-_ ]?code(?:__|[-_.:/ ])(?<tool>.+)$/i.exec(t)?.groups?.tool??t;if(Object.hasOwn(E,i))return i;if(!/^p4-code-/i.test(t))return null;let a=null;for(let e of Object.keys(E))t.endsWith(`_${e}`)&&e.length>(a?.length??0)&&(a=e);return a}function $e(e){let t=e==null?null:Qe(e);return t!==null&&Object.hasOwn(E,t)?t:null}function D(e){let t=e==null?null:Qe(e);return t!==null&&Object.hasOwn(E,t)?E[t]:null}var et=16384,tt=8192,nt=256,rt=100,it=32,at=4,ot=128,st=new TextEncoder;function O(e,t,n=0){if(n>at||t.remainingNodes--<=0)return t.exceeded=!0,{failed:!1};if(typeof e==`string`){if(e.length>t.remainingBytes)return t.exceeded=!0,{failed:!1};let r=st.encode(e).byteLength;if(r>t.remainingBytes)return t.exceeded=!0,{failed:!1};t.remainingBytes-=r;try{return O(JSON.parse(e),t,n+1)}catch{return{failed:!1}}}if(Array.isArray(e)){if(e.length>it)return t.exceeded=!0,{failed:!1};let r,i=!1;for(let a of e){let e=d(a)?a.text:void 0,o=O(d(e)?e.text??e:e,t,n+1);if(r??=o.data,i||=o.failed,t.exceeded)break}return{...r===void 0?{}:{data:r},failed:i}}if(!d(e))return{failed:!1};let r=e.isError===!0||e.is_error===!0||e._tag===`OrchestratorMcpFailure`||e.error!=null,i=e.structuredContent??e.content;if(i!==void 0){let e=O(i,t,n+1);return{...e,failed:r||e.failed}}return{data:e,failed:r}}function k(e){if(!(typeof e!=`string`||e.length>nt||e.trim()===``))return Array.from(e).join(``)}function A(e){let t={remainingBytes:et,remainingNodes:ot,exceeded:!1},n=O(e,t),r=n.failed?{isError:!0}:{},i=t.exceeded?void 0:n.data;if(i!==void 0){for(let e of[`threadId`,`messageId`,`taskId`,`scheduledTaskId`]){let t=k(i[e]);t!==void 0&&(r[e]=t)}i.status===`rolled_back`&&(r.status=`rolled_back`);let e=se(i.htmlRender);e!==void 0&&(r.htmlRender=e);let t=Ge(i[C]);t!==void 0&&(r[C]=t);let n=d(i.thread)?k(i.thread.threadId):void 0;if(n!==void 0&&(r.thread={threadId:n}),Array.isArray(i.threads)){let e=i.threads.length<=rt,t=[];if(e)for(let n of i.threads){if(!d(n)){e=!1;break}let r=k(n.threadId),i=n.status===`rolled_back`;if(r===void 0&&!i){e=!1;break}t.push({...r===void 0?{}:{threadId:r},...i?{status:`rolled_back`}:{}})}e?r.threads=t:(delete r.threadId,delete r.status)}}let a=()=>st.encode(JSON.stringify(r)).byteLength>tt;a()&&(delete r.threads,delete r.threadId,delete r.status);let o=r[C];if(o?.csp!==void 0&&a()){let{csp:e,...t}=o;r[C]=t}return a()&&delete r[C],Object.keys(r).length===0?void 0:r}function ct(e){if($e(e.toolName)!==`html_render`)return;let t=A(e.output);return t?.isError?void 0:t?.htmlRender}function lt(e){let t=A(e.output)?.[C];return t!==void 0&&e.toolName===`${t.server}.${t.tool}`?t:void 0}function ut(e){return/file not found|no files found|enoent|no such file|commandnotfoundexception|command not found|is not recognized as the name of a cmdlet|a parameter cannot be found that matches parameter name/i.test(e)||/cannot find path/i.test(e)&&/because it does not exist/i.test(e)||/is not recognized/i.test(e)&&/the term '/i.test(e)||/<exited with exit code\s+[1-9]\d*\s*>/i.test(e)||/exit(?:ed)? with exit code\s+[1-9]\d*/i.test(e)||/exit code\s*[:\s]\s*[1-9]\d*\b/i.test(e)}function j(e){if(!d(e)||e.type!==`image`)return null;let t=d(e.source)?e.source:void 0;if(t!==void 0&&t.type!==`base64`)return null;let n=t===void 0?e.mimeType:t.media_type,r=t===void 0?e.data:t.data;if(typeof n!=`string`||!p(n))return null;let i={mimeType:n.toLowerCase()};return typeof r==`string`?{...i,data:r}:i}function dt(e){return Array.isArray(e)?e:d(e)&&Array.isArray(e.content)?e.content:[e]}Math.ceil(e/3)*4;function ft(e){let t=[];for(let n of dt(e))if(j(n)!==null&&(t.push(n),t.length===8))break;return t}function pt(e){return ft(e).flatMap(e=>j(e)??[])}var mt=4;function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ht(e){return M(e)&&e.truncated===!0&&typeof e.summary==`string`}function N(e,t){if(t>mt)return null;if(typeof e==`string`)return e;if(Array.isArray(e)){let n=e.map(e=>N(e,t+1));return n.every(e=>e!==null)?n.filter(e=>e!==``).join(`
2
- `):null}if(!M(e))return null;if(e.type===`text`&&typeof e.text==`string`)return e.text;if(e.type===`image`)return j(e)?``:`[image]`;if(e.type===`resource_link`&&typeof e.uri==`string`)return e.uri;if(e.type===`resource`&&M(e.resource)){let t=e.resource;if(typeof t.text==`string`)return t.text;if(typeof t.uri==`string`)return t.uri}let n=Object.keys(e).filter(e=>e!==`isError`&&e!==`is_error`);if(n.length===1&&n[0]===`content`)return N(e.content,t+1);if(n.length===2&&n.includes(`content`)&&n.includes(`structuredContent`)){let n=N(e.content,t+1);return n?.trim()?n:null}return null}function P(e){try{return JSON.parse(e)}catch{return}}function gt(e){let t=e.trim();if(!/^[[{]/.test(t))return e;let n=P(t);if(n!==void 0)return JSON.stringify(n,null,2);let r=t.split(`
3
- `).filter(e=>e.trim()).map(e=>P(e.trim()));return r.some(e=>e===void 0)?e:r.map(e=>JSON.stringify(e,null,2)).join(`
4
-
5
- `)}function _t(e,t=!1){if(e==null||t&&M(e)&&e.type===`image`)return null;let n=N(e,0);if(n!==null)return n.trim()?gt(n):null;let r;try{r=JSON.stringify(e,null,2)}catch{return String(e)}return r===void 0||r===`{}`||r===`[]`?null:r}function F(e){if(e.command!==void 0)return{command:e.command.trim()||null,args:null,argsText:null};let t=e.args;if(M(t)&&!ht(t)){let e=Object.entries(t).flatMap(([e,t])=>t===void 0?[]:[[e,typeof t==`string`&&t!==``?t:JSON.stringify(t)??String(t)]]);return{command:null,args:e.length>0?e:null,argsText:null}}return{command:null,args:null,argsText:_t(t)}}function vt(e){return e.command!==null||e.args!==null||e.argsText!==null}var yt=new Set([`idle`,`pending`,`running`,`waiting`]);function bt(e){return yt.has(e.status)?`live`:m(e.updatedAt)}function xt(e){switch(e.type){case`command_execution`:return e.outputOmitted===!0;case`dynamic_tool`:return e.outputOmitted===!0||ht(e.input);default:return!1}}function St(e){if(!e.trimStart().startsWith(`{"stdout"`))return e;let t=P(e.trim());return!M(t)||typeof t.stdout!=`string`||typeof t.stderr!=`string`||typeof t.interrupted!=`boolean`?e:[t.stdout,t.stderr].filter(e=>typeof e==`string`&&e.trim().length>0).join(`
6
- `)}function Ct(e){switch(e.type){case`command_execution`:return e.output?.trim()&&St(e.output)||null;case`dynamic_tool`:return e.outputOmitted===!0?null:_t(e.output,e.viewedImagePath!==void 0);case`file_search`:return e.results?.length?e.results.map(e=>[`${e.fileName}${e.line===void 0?``:`:${e.line}`}`,e.preview?.trim()].filter(Boolean).join(`
7
- `)).join(`
8
- `):null;case`web_search`:return e.results?.length?e.results.map(e=>[e.title?.trim()||e.url,e.title?e.url:void 0,e.snippet?.trim()].filter(Boolean).join(`
9
- `)).join(`
10
-
11
- `):null;default:return null}}function wt(e){return e.type!==`dynamic_tool`||e.outputOmitted===!0?[]:pt(e.output).map((t,n)=>({_tag:`tool-output-image`,threadId:e.threadId,itemId:e.id,index:n}))}function Tt(e){switch(e.type){case`reasoning`:return e.text.trim().length>0;case`command_execution`:return F({command:e.input}).command!==null||e.outputOmitted===!0||!!e.output?.trim()||e.exitCode!==void 0&&e.exitCode!==0;case`file_change`:case`checkpoint`:case`fork`:case`handoff`:return!0;case`file_search`:return(e.results?.length??0)>0||!!e.pattern?.trim();case`web_search`:return(e.results?.length??0)>0||(e.patterns?.length??0)>0;case`dynamic_tool`:return e.outputOmitted===!0||vt(F({args:e.input}));case`approval_request`:return!!e.prompt?.trim();case`user_input_request`:return e.questions.length>0;case`notification`:return!!e.detail?.trim();case`system_notice`:return e.message.trim().length>0;case`error`:return e.failure.message.trim().length>0;case`proposed_plan`:return e.markdown.trim().length>0;case`todo_list`:return e.steps.length>0;case`subagent`:return e.childThreadId!==null;default:return!1}}var Et=64,Dt=new Set([`sh`,`bash`,`zsh`,`dash`,`ash`,`ksh`,`fish`]),Ot=new Set([`cmd`,`cmd.exe`,`powershell`,`powershell.exe`,`pwsh`,`pwsh.exe`]),kt=new Set([`-o`,`-O`,`--rcfile`,`--init-file`]),At=new Set([`builtin`,`command`,`exec`]),jt=new Set([`nocorrect`,`noglob`,`time`]),Mt=new Set([`pop-location`,`push-location`,`set-location`]),Nt=new Set([`-mta`,`-nologo`,`-noninteractive`,`-noprofile`,`-sta`]),Pt=new Set([`-configurationname`,`-executionpolicy`,`-inputformat`,`-outputformat`,`-version`,`-windowstyle`,`-workingdirectory`]),Ft=new Set([`-confirm`,`-debug`,`-loaduserprofile`,`-nonewwindow`,`-passthru`,`-usenewenvironment`,`-verbose`,`-wait`,`-whatif`]),It=new Set([`-argumentlist`,`-credential`,`-environment`,`-erroraction`,`-errorvariable`,`-informationaction`,`-informationvariable`,`-outbuffer`,`-outvariable`,`-pipelinevariable`,`-progressaction`,`-redirectstandarderror`,`-redirectstandardinput`,`-redirectstandardoutput`,`-verb`,`-warningaction`,`-warningvariable`,`-windowstyle`,`-workingdirectory`]),Lt=new Set([`[`,`[[`,`test`,`true`]),Rt="<>(){}[];|&$`#!%@:",zt="){]}`",I=new Set(`!,#,.,:,[,[[,alias,and,autoload,begin,bg,bind,bindkey,break,builtin,caller,case,catch,cd,command,compgen,complete,compopt,continue,coproc,declare,dirs,disown,do,done,elif,else,enable,end,esac,eval,exec,exit,export,false,fc,fg,fi,finally,for,foreach,function,getopts,history,if,in,jobs,let,local,logout,mapfile,nocorrect,noglob,not,or,popd,pushd,read,readarray,readonly,repeat,return,select,set,setopt,shift,shopt,source,switch,suspend,test,then,time,times,trap,try,true,type,typeset,ulimit,umask,unalias,until,unset,unsetopt,wait,while`.split(`,`)),Bt=new Set(`and.begin.break.case.catch.continue.coproc.do.done.elif.else.end.esac.eval.exec.exit.false.fi.finally.for.foreach.function.if.in.not.or.repeat.return.select.switch.then.try.until.while`.split(`.`));function Vt(e,t){for(let n=t;n<e.length;n+=1){let t=e[n];if(t===`--`||!t.startsWith(`-`))return null;if(kt.has(t)){n+=1;continue}if(t===`--command`||/^-[a-zA-Z]*c[a-zA-Z]*$/.test(t))return n+1}return null}var Ht={env:new Set([`-C`,`--chdir`,`-S`,`--split-string`,`-u`,`--unset`]),sudo:new Set([`-C`,`--close-from`,`-D`,`--chdir`,`-g`,`--group`,`-u`,`--user`])},Ut={env:new Set([`-0`,`--null`,`-i`,`--ignore-environment`,`--debug`,`-v`]),sudo:new Set([`-A`,`--askpass`,`-b`,`--background`,`-E`,`-H`,`-i`,`-n`,`-S`])};function L(e){let t=e.trim(),n=[],r=``,i=null,a=!1,o=!1,s=0,c=0,l=!1;for(let e=0;e<t.length;e+=1){let u=t[e];if(a){r+=u,a=!1,l=!0;continue}if(u===`\\`&&i!==`'`){let n=t[e+1],o=i===null&&/^(?:[A-Za-z]:|\.{1,2})(?:\\[^\s]*)?$/u.test(r);if((i===`"`||o)&&n!==void 0&&n!==`"`&&n!==`\\`&&n!==`$`&&n!=="`"&&n!==`
12
- `){r+=u,l=!0;continue}a=!0,l=!0;continue}if(o){r+=u,u==="`"&&(o=!1),l=!0;continue}if(i!==null){u===i?i=null:r+=u,l=!0;continue}if(u==="`"){r+=u,o=!0,l=!0;continue}if(u===`$`&&t[e+1]===`{`){r+="${",c+=1,l=!0,e+=1;continue}if(u===`{`&&c>0){r+=u,c+=1,l=!0;continue}if(u===`}`&&c>0){r+=u,--c,l=!0;continue}if(u===`$`&&t[e+1]===`(`){r+=`$(`,s+=1,l=!0,e+=1;continue}if(u===`(`){r+=u,s+=1,l=!0;continue}if(u===`)`&&s>0){r+=u,--s,l=!0;continue}if(u===`"`||u===`'`){i=u,l=!0;continue}if(/\s/u.test(u)){if(s>0||c>0){r+=u,l=!0;continue}l&&=(n.push(r),r=``,!1);continue}r+=u,l=!0}return i!==null||a||o||s>0||c>0?null:(l&&n.push(r),n)}function Wt(e,t,n){let r=``,i=0;for(let a of n){if(a.start>=t)break;r+=e.slice(i,a.start),i=Math.min(a.end,t)}return r+e.slice(i,t)}function Gt(e,t,n){let r=t;for(;e[r]===` `||e[r]===` `;)r+=1;let i=``,a=null,o=!1;for(;r<e.length;r+=1){let t=e[r];if(o){i+=t,o=!1;continue}if(t===`\\`&&a!==`'`){o=!0;continue}if(a!==null){t===a?a=null:i+=t;continue}if(t===`"`||t===`'`){a=t;continue}if(/\s/u.test(t)||`;&|<>()`.includes(t))break;i+=t}return!i||a!==null||o?null:{heredoc:{delimiter:i,stripTabs:n},end:r}}function Kt(e,t,n){let r=t;for(let t of n){let n=!1;for(;r<=e.length;){let i=e.indexOf(`
13
- `,r),a=i===-1?e.length:i,o=e.slice(r,a).replace(/\r$/u,``),s=t.stripTabs?o.replace(/^\t+/u,``):o;if(r=i===-1?e.length:i+1,s===t.delimiter){n=!0;break}if(i===-1)break}if(!n)return null}return e.slice(r).trim()||null}function R(e){let t=null,n=null,r=!1,i=!1,a=!1,o=0,s=0,c=[],l=[],u=0,d=null;for(let f=0;f<e.length;f+=1){let p=e[f];if(n!==null){p===n&&e[f+1]===`@`&&(f===0||e[f-1]===`
14
- `)&&(n=null,f+=1);continue}if(a){if(p!==`
15
- `)continue;a=!1,l.push({start:u,end:f})}if(r){r=!1;continue}if(p===`\\`&&t!==`'`){r=!0;continue}if(i){p==="`"&&(i=!1);continue}if(t!==null){p===t&&(t=null);continue}if(p===`@`&&(e[f+1]===`"`||e[f+1]===`'`)&&(e[f+2]===`
16
- `||e[f+2]===`\r`&&e[f+3]===`
17
- `)){n=e[f+1],f+=1;continue}if(p===`"`||p===`'`){t=p;continue}if(p==="`"){i=!0;continue}if(p===`#`&&(f===0||/\s/u.test(e[f-1])||`;&|(`.includes(e[f-1]))){a=!0,u=f;continue}if(p===`$`&&e[f+1]===`{`){s+=1,f+=1;continue}if(p===`{`&&s>0){s+=1;continue}if(p===`}`&&s>0){--s;continue}if(p===`(`){o+=1;continue}if(p===`)`&&o>0){--o;continue}if(o>0||s>0)continue;if(p===`<`&&e[f+1]===`<`&&e[f+2]!==`<`){let t=e[f+2]===`-`,n=Gt(e,f+(t?3:2),t);if(n===null)return{firstCommand:e.trim(),remainingCommand:null,separator:null};c.push(n.heredoc),f=n.end-1;continue}let m=p===`&`&&e[f+1]===`&`||p===`|`&&(e[f+1]===`|`||e[f+1]===`&`),ee=p===`&`&&(e[f-1]===`>`||e[f-1]===`<`||e[f+1]===`>`);if(!m&&!`;&|
18
- `.includes(p)||ee)continue;if(p===`
19
- `&&c.length>0){let t=d;return{firstCommand:Wt(e,t?.index??f,l).trimStart(),remainingCommand:[t?e.slice(t.index+t.length,f).trim():``,Kt(e,f+1,c)].filter(e=>!!e).join(`
20
- `)||null,separator:t?e.slice(t.index,t.index+t.length):`
21
- `}}if(c.length>0){d??={index:f,length:m?2:1},m&&(f+=1);continue}let te=Wt(e,f,l).trimStart(),h=f+(m?2:1);for(;/\s/u.test(e[h]??``);)h+=1;return{firstCommand:te,remainingCommand:e.slice(h).trim()||null,separator:m?e.slice(f,f+2):p}}return a&&l.push({start:u,end:e.length}),{firstCommand:Wt(e,e.length,l).trim(),remainingCommand:null,separator:null}}function qt(e){let t=e.trimStart();for(;t.startsWith(`#`);){let e=t.indexOf(`
22
- `);if(e===-1)return null;t=t.slice(e+1).trimStart()}return t||null}function Jt(e){let t=``,n=null,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i];if(r){t+=a,r=!1;continue}if(a===`\\`&&n!==`'`){if(e[i+1]===`
23
- `){i+=1;continue}if(e[i+1]===`\r`&&e[i+2]===`
24
- `){i+=2;continue}t+=a,r=!0;continue}n===null?(a===`"`||a===`'`)&&(n=a):a===n&&(n=null),t+=a}return t}function z(e,t){let n=e[t];if(!n||/^[<>]\(/u.test(n))return null;let r=n.match(/^(?:(?:(?:\d+|\*|\{[A-Za-z_][A-Za-z0-9_]*\})?(?:<<<|<<-|<<|<>|>>|>\||<&|>&|<|>))|&>>|&>)(.*)$/u);return r?r[1]?t+1:e[t+1]===void 0?e.length+1:t+2:null}function Yt(e){return e.map(e=>`'${e.replaceAll(`'`,`'\\''`)}'`).join(` `)}function Xt(e,t,n){if(e===`bundle`)return t[n+1]===`exec`&&t[n+2]!==void 0?n+2:null;if(e===`nohup`){let e=n+1;t[e]===`--`&&(e+=1);let r=t[e];return r&&!r.startsWith(`-`)?e:null}return e===`script`?/^-[adkpqr]+$/u.test(t[n+1]??``)&&t[n+3]!==void 0?n+3:null:e===`arch`?/^-(?:arm64|arm64e|i386|x86_64)$/u.test(t[n+1]??``)?t[n+2]===void 0?null:n+2:t[n+1]===`-arch`&&t[n+3]!==void 0?n+3:null:(e===`timeout`||e===`gtimeout`)&&/^(?:\d+(?:\.\d*)?|\.\d+)[smhd]?$/u.test(t[n+1]??``)&&t[n+2]!==void 0?n+2:null}function B(e){let t=e.trim();if(!t||/^[A-Za-z][A-Za-z0-9+.-]*:(?![\\/])/u.test(t))return null;let n=t.split(/[\\/]/u).at(-1);return!n||/\s/u.test(n)&&!/[\\/]/u.test(t)||Rt.includes(n[0]??``)||zt.includes(n.at(-1)??``)?null:n}function Zt(e){let t=e.trimStart(),n=t[0];if(n!==`"`&&n!==`'`)return B(t.match(/^\S+/u)?.[0]??``);let r=``;for(let e=1;e<t.length;e+=1){let i=t[e];if(i==="`"&&t[e+1]!==void 0){r+=t[e+1],e+=1;continue}if(i===n){if(n===`'`&&t[e+1]===`'`){r+=`'`,e+=1;continue}return B(r)}r+=i}return null}function Qt(e){let t=e.match(/^\s*&\s+([\s\S]*)$/u);return t?Zt(t[1]):void 0}function $t(e,t,n,r){let i=e.match(/^\s*\$(?:(env|global|local|script):)?[A-Za-z_][A-Za-z0-9_]*\s*=\s*([\s\S]*)$/iu);if(!i)return{matched:!1,program:null};if(i[1]?.toLowerCase()===`env`)return{matched:!0,program:n?V(n,t,`shell`,r-1):null};let a=i[2].trim();if(/^(?:\[ordered\]\s*)?@\s*[{(]/iu.test(a))return{matched:!0,program:null};let o=Qt(a);if(o!==void 0)return{matched:!0,program:o};let s=a.match(/^(?:@?\(\s*)?([A-Za-z][A-Za-z0-9_.-]*)\b/u)?.[1];return s&&!I.has(s.toLowerCase())?{matched:!0,program:V(a,t+1,`shell`,r)??s}:{matched:!0,program:n?V(n,t,`shell`,r-1):null}}function en(e,t,n,r,i,a,o){let s=e=>e?V(i&&a?`${e} ${a} ${i}`:e,r+1,`shell`,o):null;if(e===`cmd`||e===`cmd.exe`){for(let e=n;e<t.length;e+=1){let n=t[e].toLowerCase();if(n!==`/c`&&n!==`/k`)continue;let r=t[e+1];return{matched:!0,program:s(r)}}return{matched:!1,program:null}}for(let e=n;e<t.length;e+=1){let n=t[e].toLowerCase();if(n===`-command`||n===`-c`){let n=t[e+1];return{matched:!0,program:s(n)}}if(n===`-file`||n===`-f`)return{matched:!0,program:B(t[e+1]??``)};if(n===`-encodedcommand`||n===`-enc`||n===`-e`)return{matched:!0,program:null};if(Pt.has(n)){e+=1;continue}if(!Nt.has(n)&&!n.startsWith(`-`))return{matched:!0,program:B(t[e])}}return{matched:!1,program:null}}function tn(e,t){for(let n=t;n<e.length;n+=1){let t=e[n],r=t.toLowerCase();if(r===`-filepath`)return B(e[n+1]??``);if(!Ft.has(r)){if(It.has(r)){if(e[n+1]===void 0)return null;n+=1;continue}return t.startsWith(`-`)?null:B(t)}}return null}function nn(e){let t=e.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/su);if(!t)return null;let n=t[1],r=t[2].trim();if(!r||/[$`]/u.test(r))return{name:n,program:null};if(r.startsWith(`(`)&&r.endsWith(`)`))r=L(r.slice(1,-1))?.[0]??``;else if(/\s/u.test(r)&&!/[\\/]/u.test(r))return{name:n,program:null};return{name:n,program:B(r)}}function rn(e){let t=e.match(/^\$(?:([A-Za-z_][A-Za-z0-9_]*)|\{([A-Za-z_][A-Za-z0-9_]*)(?:\[@\])?\})$/u);return t?.[1]??t?.[2]??null}function an(e){let t=new Map,n=e,r=0;for(let e=0;n&&e<64;e+=1){let e=qt(n);if(e===null)return null;let i=R(e),a=L(Jt(i.firstCommand));if(a===null)return null;let o=+(a[0]===`do`||a[0]===`then`);for(;o<a.length;){let e=z(a,o);if(e!==null&&e<=a.length){o=e;continue}if(/^[A-Za-z_][A-Za-z0-9_]*\+?=/u.test(a[o]??``)){o+=1;continue}break}let s=rn(a[o]??``),c=s?t.get(s):void 0;if(c)return c;let l=a[0];if((l===`fi`||l===`done`||l===`esac`)&&(r=Math.max(0,r-1)),(l===`if`||l===`for`||l===`while`||l===`until`||l===`select`||l===`case`)&&(r+=1),r===0&&l===`unset`)for(let e of a.slice(1))t.delete(e);let u=+(a[0]===`export`),d=a.slice(u).map(nn);if(r===0&&d.length>0&&d.every(e=>e!==null))for(let e of d)e.program?t.set(e.name,e.program):t.delete(e.name);n=i.remainingCommand}return null}function on(e,t,n,r,i,a){let o=n;if(e===`command`)for(;o<t.length;){let e=t[o];if(e===`--`){o+=1;break}if(!e.startsWith(`-`)||e===`-`)break;if(e!==`-p`)return null;o+=1}else if(e===`builtin`){if(t[o]===`--`)o+=1;else if(t[o]?.startsWith(`-`))return null}else if(e===`exec`)for(;o<t.length;){let e=t[o];if(e===`--`){o+=1;break}if(e===`-a`){if(t[o+1]===void 0)return null;o+=2;continue}if(/^-a.+/u.test(e)||/^-[cl]+$/u.test(e)){o+=1;continue}if(e.startsWith(`-`)&&e!==`-`)return null;break}let s=t.slice(o);if(s.length===0)return null;let c=0;for(;c<s.length;){let e=z(s,c);if(e===null||e>s.length)break;c=e}let l=s[c];if(l&&/^[A-Za-z_][A-Za-z0-9_]*\+?=/u.test(l))return null;let u=V(Yt(s),r+1,e===`exec`?`exec`:`shell`,a);return u===null?e!==`exec`&&l&&l===l.toLowerCase()&&I.has(l)&&!Bt.has(l)&&i?V(i,r,`shell`,a-1):null:u}function sn(e,t,n,r){if(t>=8||r<=0)return null;let i=qt(e);if(i===null||/^(?:catch|finally|for|foreach|function|if|param|switch|try|while)\s*[{(]/iu.test(i)||/^[A-Za-z_][A-Za-z0-9_]*\s*\(\s*\)\s*\{/u.test(i)||i.startsWith(`[[`))return null;let a=R(i);if(/^@["'](?:\r?\n)/u.test(a.firstCommand.trimStart()))return a.remainingCommand?V(a.remainingCommand,t,`shell`,r-1):null;let o=$t(a.firstCommand,t,a.remainingCommand,r);if(o.matched)return o.program;let s=a.firstCommand.match(/^\s*((?:\.{1,2}|%[A-Za-z_][A-Za-z0-9_]*%|\$env:[A-Za-z_][A-Za-z0-9_]*)\\\S+)/iu)?.[1];if(s)return B(s);let c=L(Jt(a.firstCommand));if(c===null)return null;let l=a.firstCommand.trimStart()[0];if(c.length===1&&(l===`"`||l===`'`)&&/[\s()=]/u.test(c[0]??``)&&!/[\\/]/u.test(c[0]??``))return a.remainingCommand?V(a.remainingCommand,t,n,r-1):null;let u=0,d=null,f=n,p=!1,m=!1;for(;u<c.length;){let e=c[u];if(!e)return null;let n=z(c,u);if(n!==null){if(n>c.length)return null;m=!0,u=n;continue}if(/^[A-Za-z_][A-Za-z0-9_]*\+?=/.test(e)){p=!0,u+=1;continue}if(f===`shell`&&e===`:`)return a.remainingCommand?V(a.remainingCommand,t,f,r-1):null;if(Rt.includes(e[0]??``)&&!(e.startsWith(`$`)&&e.includes(`/`)))return f===`shell`&&e.startsWith(`[`)&&a.remainingCommand?V(a.remainingCommand,t,f,r-1):null;let i=e.split(/[\\/]/).at(-1),o=e===i;if(i===`env`||i===`sudo`){d=i,f=`exec`,u+=1;continue}if(d!==null&&e===`--`){d=null,u+=1;continue}if(d!==null&&e.startsWith(`-`)){if(d===`env`&&(e===`-S`||e===`--split-string`)){let e=c[u+1];return e?V(e,t+1,f,r):null}if(d===`env`&&e.startsWith(`--split-string=`))return V(e.slice(15),t+1,f,r);if(Ht[d].has(e)){if(c[u+1]===void 0)return null;u+=2;continue}if(Ut[d].has(e)){u+=1;continue}let n=e.indexOf(`=`);if(e.startsWith(`--`)&&n>2){if(!Ht[d].has(e.slice(0,n)))return null;u+=1;continue}if(/^-[A-Za-z].+/.test(e)&&!e.startsWith(`--`)){let t=!1;for(let[n,r]of e.slice(1).split(``).entries()){let i=`-${r}`;if(Ht[d].has(i)){t=n===e.length-2;break}if(!Ut[d].has(i))return null}if(t&&c[u+1]===void 0)return null;u+=t?2:1;continue}return null}if(i&&Dt.has(i.replace(/\.exe$/i,``).toLowerCase())){let e=Vt(c,u+1);if(e!==null){let n=c[e];return n?V(n,t+1,`shell`,r):null}}let s=i?.toLowerCase();if(s&&Ot.has(s)){let e=en(s,c,u+1,t,a.remainingCommand,a.separator,r);if(e.matched)return e.program}if(s===`start-process`){let e=tn(c,u+1);if(e!==null)return e}if(f===`shell`&&o&&i&&jt.has(i)){if(u+=1,i===`time`&&c[u]===`-p`&&(u+=1),c[u]?.startsWith(`-`))return null;continue}if(o&&i){let e=Xt(i,c,u);if(e!==null){let n=V(Yt(c.slice(e)),t+1,`exec`,r);if(n!==null)return n}}return o&&i&&At.has(i)?on(i,c,u+1,t,a.remainingCommand,r):(f===`shell`||d===`sudo`&&i&&Lt.has(i))&&o&&i&&I.has(i)&&(!Bt.has(i)||i===`false`&&a.separator!==`&&`)&&a.remainingCommand||f===`shell`&&o&&s&&Mt.has(s)&&a.remainingCommand?V(a.remainingCommand,t,`shell`,r-1):!i||o&&I.has(i)||Rt.includes(i[0]??``)||zt.includes(i.at(-1)??``)||i.endsWith(`()`)||/^[A-Za-z_][A-Za-z0-9_]*\(\)\{$/u.test(i)?null:i||null}return(p||m)&&d===null&&a.remainingCommand?V(a.remainingCommand,t,f,r-1):null}function V(e,t,n,r=Et){if(r<=0)return null;let i=Qt(e);return i===void 0?sn(e,t,n,r)??(n===`shell`?an(e):null):i}function cn(e,t=0){return V(e,t,`shell`,Et)}var ln=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/gu;function un(e){return mn(hn(e))}var dn=/[a-z][\w+.-]*:\/\/\S+|(?:\b[a-z]:)?[^\s"'`=,;:()<>|&]+/giu;function fn(e){if(e.includes(`://`)||/[*?[{]/u.test(e))return e;let t=e.replaceAll(`\\`,`/`).replace(/\/+$/u,``),n=t.lastIndexOf(`/`);if(n<0)return e;let r=t.slice(n+1);if(!/[a-z]/iu.test(r))return e;let i=/^(?:~|\.{1,2}|[a-z]:)?\//iu.test(t),a=/.\.[a-z0-9]+$/iu.test(r),o=t.split(`/`).length-1;return i||a||o>=2?r:e}function pn(e){return e.replace(dn,fn)}function mn(e){return e.replace(ln,e=>e===``?`␡`:String.fromCharCode(9216+e.charCodeAt(0)))}function hn(e){let t=e.trim();if(R(t).remainingCommand!==null)return t;let n=L(t),r=n?.[0]?.split(/[\\/]/u).at(-1)?.replace(/\.exe$/iu,``);if(!n||!r||!Dt.has(r))return t;let i=Vt(n,1);return i===null||i!==n.length-1?t:n[i]?.trim()||t}var gn=new Set([`powershell`,`pwsh`]),_n=new Set(`Add Approve Assert Backup Block Build Checkpoint Clear Close Compare Complete Compress Confirm Connect Convert ConvertFrom ConvertTo Copy Debug Deny Deploy Disable Disconnect Dismount Edit Enable Enter Exit Expand Export Find ForEach Format Get Grant Group Hide Import Initialize Install Invoke Join Limit Lock Measure Merge Mount Move New Open Optimize Out Ping Pop Protect Publish Push Read Receive Redo Register Remove Rename Repair Request Reset Resize Resolve Restart Restore Resume Revoke Save Search Select Send Set Show Skip Sort Split Start Step Stop Submit Suspend Switch Sync Tee Test Trace Unblock Undo Uninstall Unlock Unprotect Unpublish Unregister Update Use Wait Watch Where Write`.split(` `));function vn(e){let t=/^([A-Z][a-z]+(?:[A-Z][a-z]+)?)-[A-Z][A-Za-z]*$/u.exec(e);return t!==null&&_n.has(t[1])}function yn(e){let t=/^(?:&\s*)?(?:"([^"]*)"|'([^']*)'|(\S+))/u.exec(e.trim()),n=(t?.[1]??t?.[2]??t?.[3]??``).split(/[\\/]/u).at(-1)?.toLowerCase().replace(/\.exe$/u,``);return n&&gn.has(n)||bn(e)?`powershell`:`shellscript`}function bn(e){let t=e.trim();if(/^&\s*\S/u.test(t))return!0;for(let e=0;t&&e<Et;e+=1){let{firstCommand:e,remainingCommand:n}=R(t),r=e.trim();if(/^\$(?:env|global|local|script):/iu.test(r)||/^\$[A-Za-z_]\w*\s+=/u.test(r)||vn(r.match(/^\S+/u)?.[0]??``))return!0;t=n}return!1}var xn=new Set([`cat`,`head`,`tail`,`nl`,`less`,`more`,`bat`,`sed`]),Sn=new Set([`grep`,`egrep`,`fgrep`,`rg`,`ag`]),Cn=new Set([`ls`,`tree`,`find`]),wn=new Set([`head`,`tail`,`wc`,`sort`,`uniq`,`cut`,`grep`,`cat`]),Tn={head:new Set([`-n`,`-c`]),tail:new Set([`-n`,`-c`]),sed:new Set([`-e`,`-f`]),grep:new Set([`-e`,`-f`,`-m`,`-A`,`-B`,`-C`,`--regexp`,`--file`,`--max-count`]),rg:new Set([`-e`,`-f`,`-g`,`-t`,`-T`,`-m`,`-A`,`-B`,`-C`,`-M`,`--regexp`,`--file`,`--glob`,`--iglob`,`--type`,`--type-not`,`--max-count`,`--max-columns`,`--context`,`--after-context`,`--before-context`]),ag:new Set([`-G`,`-A`,`-B`,`-C`,`-m`]),tree:new Set([`-L`,`-I`,`-P`])};function En(e,t){let n=Tn[e]??new Set,r=[],i=[],a=!1;for(let e=0;e<t.length;e+=1){let o=t[e];if(/^\d*(?:>>?|<|>&)/u.test(o)){/^\d*(?:>>?|<|>&)$/u.test(o)&&(e+=1);continue}if(!a&&o===`--`){a=!0;continue}if(!a&&o.startsWith(`-`)&&o!==`-`){if(n.has(o)){let n=t[e+1];(o===`-e`||o===`--regexp`)&&n!==void 0&&i.push(n),e+=1}else o.startsWith(`--regexp=`)&&i.push(o.slice(9));continue}r.push(o)}return{positionals:r,patterns:i}}function Dn(e){let t=L(e);if(!t||t.length===0)return null;let n=t[0].split(`/`).at(-1),{positionals:r,patterns:i}=En(n===`egrep`||n===`fgrep`?`grep`:n,t.slice(1));if(xn.has(n)){if(n===`sed`){if(!t.includes(`-n`)||t.includes(`-i`))return null;let e=i.length>0?r:r.slice(1);return e.length>0?{kind:`read`,paths:e}:null}return r.length>0?{kind:`read`,paths:r}:null}if(Sn.has(n)){let e=i[0]??r[0];return e?{kind:`search`,query:e,targets:i.length>0?r:r.slice(1)}:null}return Cn.has(n)?{kind:`list`,target:n===`find`?t.slice(1).find(e=>!e.startsWith(`-`)&&e!==`(`)??null:r[0]??null}:null}function On(e){let t=hn(e).trim(),n=null,r=null;for(;t;){let e=R(t),i=e.firstCommand.trim();if(r===null){if(/^cd(?:\s|$)/u.test(i)&&e.separator===`&&`){t=e.remainingCommand;continue}if(r=Dn(i),r===null)return null}else{let e=L(i)?.[0]?.split(`/`).at(-1);if(n!==`|`||!e||!wn.has(e))return null}n=e.separator,t=e.remainingCommand}return r}function kn(e){return e.replace(/[\\/]+$/u,``).split(/[\\/]/u).at(-1)||e}function An(e,t,n=kn){let r=On(e);if(!r)return null;let i=t===`past`,a=e=>e[0]===void 0?``:`${n(e[0])}${e.length>1?` +${e.length-1} more`:``}`;switch(r.kind){case`read`:return`${i?`Read`:`Reading`} ${a(r.paths)}`;case`search`:{let e=a(r.targets);return`${i?`Searched`:`Searching`} for ${r.query}${e?` in ${e}`:``}`}case`list`:return`${i?`Listed`:`Listing`} files${r.target?` in ${a([r.target])}`:``}`}}function H(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function U(e){return typeof e==`string`&&e.trim()!==``?e:void 0}function W(e,t=0){if(t>4)return{failed:!1};if(typeof e==`string`)try{return W(JSON.parse(e),t+1)}catch{return{failed:!1}}if(Array.isArray(e)){let n,r=!1;for(let i of e){let e=H(i),a=e?.text??H(e?.content)?.text,o=W(H(a)?.text??a,t+1);n??=o.data,r||=o.failed}return{...n?{data:n}:{},failed:r}}let n=H(e);if(!n)return{failed:!1};let r=n.isError===!0||n.is_error===!0||typeof n._tag==`string`&&/(?:Error|Failure)$/.test(n._tag)||n.error!=null,i=n.structuredContent??n.content;if(i!==void 0){let e=W(i,t+1);return{...e.data?{data:e.data}:{},failed:r||e.failed}}return{data:n,failed:r}}function jn(e){let t=W(e).data;return t&&typeof t.toolName==`string`?H(t.args):t}function Mn(e){return W(e).failed}function G(e){return new Set(e.filter(e=>e!==void 0)).size+e.filter(e=>e===void 0).length}function K(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function Nn(e,t){let n=t.map(e=>{let t=W(e.output);return{input:jn(e.input),output:t.data,outcome:t.failed?`failed`:e.outcome}}),r=n.filter(e=>e.outcome===`completed`),i=n.filter(e=>e.outcome===`failed`).length,a=r.length>0?r:n,o=K(a.length,`time`),s=(e,t,n)=>`${r.length>0?e:`Tried to ${t}`} ${n}`,c=e=>a.map(t=>U(t.output?.[e])??U(t.input?.[e])),l=a.map(e=>U(e.output?.id)??U(e.output?.projectId)??U(e.input?.projectId)),u=a.map(e=>U(e.output?.threadId)??U(H(e.output?.thread)?.threadId)??U(e.input?.threadId)),d;switch(e){case`thread-send`:{let e=G(a.map(e=>U(e.output?.messageId))),t=u.every(e=>e!==void 0),n=new Set(u).size;d=s(`Sent`,`send`,t?e===n&&e>1?`messages to ${K(n,`thread`)}`:`${K(e,`message`)} to ${K(n,`thread`)}`:K(e,`message`));break}case`thread-create`:{let e=[];d=r.length>0&&r.every(t=>(Array.isArray(t.output?.threads)?t.output.threads:[t.output]).every(t=>{let n=H(t);if(n?.status===`rolled_back`)return!0;let r=U(n?.threadId);return r?(e.push(r),!0):!1}))?`Created ${K(new Set(e).size,`thread`)}`:`Requested thread creation ${o}`;break}case`delegate`:d=s(`Delegated`,`delegate`,K(G(c(`taskId`)),`task`));break;case`thread-read`:case`thread-wait`:{let t=u.every(e=>e!==void 0)?K(new Set(u).size,`thread`):`threads ${o}`;d=e===`thread-read`?s(`Read`,`read`,t):s(`Waited on`,`wait on`,t);break}case`thread-list`:d=s(`Listed`,`list`,`threads ${o}`);break;case`thread-interrupt`:d=s(`Requested interrupts for`,`interrupt`,K(G(u),`thread`));break;case`workflow-stop`:d=s(`Requested stops for`,`stop`,K(G(c(`subagentId`)),`workflow`));break;case`task-status`:d=s(`Checked`,`check`,`task status ${o}`);break;case`task-cancel`:d=s(`Requested cancellation of`,`cancel`,K(G(c(`taskId`)),`task`));break;case`schedule-create`:d=s(`Scheduled`,`schedule`,K(G(c(`scheduledTaskId`)),`task`));break;case`schedule-list`:d=s(`Listed`,`list`,`scheduled tasks ${o}`);break;case`schedule-update`:d=s(`Updated`,`update`,K(G(c(`scheduledTaskId`)),`scheduled task`));break;case`schedule-delete`:d=s(`Requested deletion of`,`delete`,K(G(c(`scheduledTaskId`)),`scheduled task`));break;case`schedule-run`:d=s(`Requested`,`request`,K(a.length,`scheduled task run`));break;case`thread-configuration`:d=s(`Checked`,`check`,`thread configuration ${o}`);break;case`thread-configure`:d=s(`Set`,`set`,`thread model ${o}`);break;case`thread-fork`:d=s(`Requested`,`request`,K(a.length,`thread fork`));break;case`thread-merge`:d=s(`Requested`,`request`,K(a.length,`context merge`));break;case`thread-search`:d=s(`Searched`,`search`,`threads ${o}`);break;case`thread-transfers`:d=s(`Checked`,`check`,`thread transfers ${o}`);break;case`thread-organize`:d=s(`Organized`,`organize`,`threads ${o}`);break;case`thread-update`:d=s(`Updated`,`update`,K(G(u),`thread`));break;case`queue-list`:d=s(`Listed`,`list`,`queued messages ${o}`);break;case`queue-read`:d=s(`Read`,`read`,K(G(c(`queuedRunId`)),`queued message`));break;case`queue-edit`:d=s(`Edited`,`edit`,K(G(c(`queuedRunId`)),`queued message`));break;case`queue-cancel`:d=s(`Requested cancellation of`,`cancel`,K(G(c(`queuedRunId`)),`queued run`));break;case`queue-reorder`:d=s(`Reordered`,`reorder`,K(G(c(`queuedRunId`)),`queued run`));break;case`queue-steer`:d=s(`Requested steering with`,`steer with`,K(G(c(`queuedRunId`)),`queued message`));break;case`question-list`:d=s(`Listed`,`list`,`pending requests ${o}`);break;case`question-read`:d=s(`Read`,`read`,K(G(c(`requestId`)),`pending request`));break;case`question-respond`:d=s(`Responded to`,`respond to`,K(G(c(`requestId`)),`pending request`));break;case`secret-request`:d=s(`Asked for`,`ask for`,K(a.length,`secret`));break;case`worktree-handoff`:d=s(`Handed off to`,`hand off to`,K(G(c(`worktreePath`)),`worktree`));break;case`worktree-list`:d=s(`Listed`,`list`,`workspace branches ${o}`);break;case`worktree-status`:d=s(`Checked`,`check`,`worktree status ${o}`);break;case`project-list`:d=s(`Listed`,`list`,`projects ${o}`);break;case`project-read`:d=s(`Read`,`read`,K(G(l),`project`));break;case`project-create`:d=s(`Registered`,`register`,K(G(l),`project`));break;case`project-update`:d=s(`Updated`,`update`,K(G(l),`project`));break;case`project-delete`:d=s(`Deleted`,`delete`,K(G(l),`project`));break;case`project-clone`:d=s(`Cloned`,`clone`,K(G(c(`cwd`)),`repository`,`repositories`));break;case`environment-read`:d=s(`Checked`,`check`,`environment preferences ${o}`);break;case`environment-update`:d=s(`Updated`,`update`,`environment preferences ${o}`);break;case`attachment-prepare`:d=s(`Prepared`,`prepare`,K(G(c(`attachmentId`)),`attachment upload`));break;case`attachment-discard`:d=s(`Discarded`,`discard`,K(G(c(`attachmentId`)),`pending attachment`));break;case`attachment-send`:{let e=new Map;a.forEach((t,n)=>e.set(U(t.output?.messageId)??`call-${n}`,t));let t=[...e.values()].reduce((e,t)=>e+(Array.isArray(t.input?.attachments)?t.input.attachments.length:0),0),n=[...e.values()].every(e=>Array.isArray(e.input?.attachments)&&e.input.attachments.length>0),r=u.every(e=>e!==void 0)?` to ${K(new Set(u).size,`thread`)}`:``;d=s(`Sent`,`send`,n?`${K(t,`attachment`)}${r}`:`attachments${r} ${o}`);break}case`link-pr`:d=s(`Linked`,`link`,K(a.length,`pull request`));break;case`unlink-pr`:d=s(`Unlinked`,`unlink`,K(a.length,`pull request`));break;case`watch-pr`:d=s(`Watching`,`watch`,K(a.length,`pull request`));break;case`unwatch-pr`:d=s(`Stopped watching`,`stop watching`,K(a.length,`pull request`));break;case`list-prs`:d=s(`Checked`,`check`,`linked pull requests${a.length===1?``:` ${o}`}`);break;case`write-pr-guides`:{let e=a.flatMap(e=>Array.isArray(e.output?.guides)?e.output.guides.map(e=>H(e)?.outcome):[]),t=e.filter(e=>e!==`failed`).length,n=e.length-t;i+=n,d=e.length>0&&t===0?`Could not start ${K(n,`review guide`)}`:s(`Started`,`start`,e.length===0?`review guides ${o}`:`${K(t,`review guide`)}${n>0?`, ${n} failed`:``}`);break}case`read-pr-guide`:d=s(`Read`,`read`,K(a.length,`review guide`));break;case`browser`:d=s(`Used`,`use`,`browser ${o}`);break;case`decide`:d=s(`Asked`,`ask`,`Decisions ${o}`);break;case`device`:d=s(`Used`,`use`,`device controls ${o}`);break;case`html-preview`:d=s(`Previewed`,`preview`,K(a.length,`HTML page`));break;case`html-render`:d=s(`Rendered`,`render`,K(a.length,`HTML page`));break;case`capabilities`:d=s(`Checked`,`check`,`orchestration capabilities ${o}`)}return{label:d,failedCount:i}}function Pn(e){return e.status===`running`?`Compacting context`:e.beforeTokenCount!==void 0&&e.afterTokenCount!==void 0?`Context compacted ${ue(e.beforeTokenCount)} → ${ue(e.afterTokenCount)} tokens`:`Context compacted`}function Fn(e){return e.replace(/\s+(?:complete|completed)\s*$/i,``).trim()}function q(e){let t=e.structuredPayload;if(t?.type===`dynamic_tool`&&t.toolName)return t.toolName;let n=J(e.toolData);return typeof n?.server==`string`&&typeof n.tool==`string`?`${n.server}.${n.tool}`:typeof n?.toolName==`string`?n.toolName:D(e.toolTitle)?e.toolTitle:e.label}function In(e){let t=e.structuredPayload,n=J(e.toolData);return t?.type===`dynamic_tool`?t.output:n?.output??n?.result??n?.rawOutput??n?.content}function Ln(e,t,n){if(!e)return null;let[r,i,a,o]=e.labels,s=t===`inProgress`?i:t===`completed`?a:t===`failed`?`Failed to ${r.toLowerCase()}`:t===`declined`?`Declined to ${r.toLowerCase()}`:t===`stopped`?`Stopped ${i.toLowerCase()}`:i,c=e.summaryAction===`link-pr`||e.summaryAction===`unlink-pr`||e.summaryAction===`list-prs`||e.summaryAction===`watch-pr`||e.summaryAction===`unwatch-pr`?e.summaryAction:void 0,l=J(n),u=J(l?.arguments)??J(l?.input)??J(l?.rawInput),d=(typeof u?.url==`string`?oe(u.url):null)?.number??u?.number;return{displayName:`${s} ${c!==void 0&&c!==`list-prs`&&typeof d==`number`&&Number.isSafeInteger(d)&&d>0?`PR #${d}`:o}`,icon:e.icon,...c===void 0?{}:{action:c}}}function Rn(e,t){return e===`failed`||e===`declined`||e===`stopped`||e===`idle`?e:t||e===`inProgress`?`inProgress`:`completed`}function zn(e,t){let n=D(q(e)),r=e.toolLifecycleStatus??t;return Ln(n,n&&Mn(In(e))?`failed`:r,e.toolData)}function J(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function Bn(e){return e.tone===`tool`||e.tone===`thinking`||e.tone===`error`||e.command!==void 0&&e.command.trim().length>0||e.requestKind!==void 0||e.itemType!==void 0&&o(e.itemType)}function Vn(e,t){if(e.tone===`error`||e.toolLifecycleStatus===`failed`||e.toolLifecycleStatus===`declined`)return!0;if(!Bn(e))return!1;if(D(q(e))&&Mn(In(e)))return!0;let n=e.structuredPayload;if(n?.type===`command_execution`&&(n.outputIndicatesFailure||n.exitCode!==void 0&&n.exitCode!==0||n.output&&ut(n.output.slice(0,32768))))return!0;let r=t?[e.detail,e.command].filter(Boolean).join(`
25
- `):e.detail??``;return r.length>0&&ut(r)}function Hn(e){return Vn(e,!0)}function Un(e){return Vn(e,!1)}function Wn(e){return e.itemType===`file_search`||e.itemType===`web_search`&&/\bgrep\b/i.test(Fn(e.toolTitle??e.label))}function Y(e){if(e.itemType===`thread_created`)return`thread-create`;let t=zn(e);if(t?.action!==void 0)return t.action;if(t?.icon===`browser`)return`browser`;if(t?.icon===`device`)return`device`;if(e.requestKind===`file-read`||e.viewedImagePath!==void 0)return`read`;if(e.itemType===`approval_request`||e.itemType===`user_input_request`)return Bn(e)?`other`:`update`;let n=e.itemType===`command_execution`&&e.command?On(e.command):null;if(n)return n.kind===`read`?`read`:`code-search`;let r=J(e.toolData)??{},i=e.structuredPayload?.type===`dynamic_tool`?e.structuredPayload.toolName:typeof r.toolName==`string`?r.toolName:e.toolTitle,a=be({itemType:e.itemType===`command_execution`||e.itemType===`file_change`||e.itemType===`web_search`?e.itemType:e.itemType===`dynamic_tool`?`dynamic_tool_call`:void 0,title:e.toolTitle??e.label,data:{...r,...i?{toolName:i}:{}}});return a===`read`?`read`:a===`file_change`||e.itemType===`file_change`?`edit`:a===`command`||e.itemType===`command_execution`||e.command?`command`:a===`search`?e.itemType===`web_search`&&!Wn(e)?`search`:`code-search`:Wn(e)?`code-search`:e.itemType===`web_search`?`search`:(e.changedFiles?.length??0)>0?`edit`:Bn(e)?`other`:`update`}function Gn(e){let t=e.viewedImagePath?.trim();if(t!==void 0&&!/[\r\n]/.test(t)&&re(t))return t;let n=e.detail?.trim();return Y(e)===`read`&&n!==void 0&&!/[\r\n]/.test(n)&&re(n)?n:null}function Kn(e,t){let n=ce(e,t.workspaceRoot??`.`);if(n._tag!==`WorkspaceFile`)return null;let r=t.workspaceRoot==null&&n.path.startsWith(`./`)?n.path.slice(2):n.path,i=le(e,{threadId:t.threadId,workspaceRoot:t.workspaceRoot,resolvedFilePath:r});return i===null||i.access!==`environment`?null:{resource:i.resource,alt:i.name,srcFragment:i.srcFragment}}function qn(e,t){if(e!==`edit`)return t.length;let n=new Set,r=0;for(let e of t)if(!e.changedFiles||e.changedFiles.length===0)r+=1;else for(let t of e.changedFiles)n.add(t);return n.size+r}function Jn(e,t){switch(e){case`link-pr`:return`Linked ${t} ${t===1?`pull request`:`pull requests`}`;case`unlink-pr`:return`Unlinked ${t} ${t===1?`pull request`:`pull requests`}`;case`watch-pr`:return`Watching ${t} ${t===1?`pull request`:`pull requests`}`;case`unwatch-pr`:return`Stopped watching ${t} ${t===1?`pull request`:`pull requests`}`;case`list-prs`:return t===1?`Checked linked pull requests`:`Checked linked pull requests ${t} times`;case`read`:return`Read ${t} ${t===1?`file`:`files`}`;case`edit`:return`Changed ${t} ${t===1?`file`:`files`}`;case`command`:return`Ran ${t} ${t===1?`command`:`commands`}`;case`thread-create`:return`Created ${t} ${t===1?`thread`:`threads`}`;case`device`:return`Used device controls ${t} ${t===1?`time`:`times`}`;case`browser`:return`Used browser ${t} ${t===1?`time`:`times`}`;case`search`:return`Searched the web ${t} ${t===1?`time`:`times`}`;case`code-search`:return`Searched code ${t} ${t===1?`time`:`times`}`;case`other`:return`Used ${t} ${t===1?`tool`:`tools`}`;case`update`:return`Received ${t} ${t===1?`update`:`updates`}`}}function Yn(e){let t=e.structuredPayload,n=e.toolData!==null&&typeof e.toolData==`object`?e.toolData:void 0;return{input:t?.type===`dynamic_tool`?t.input:n?.arguments??n?.input??n?.rawInput,output:In(e),outcome:e.toolLifecycleStatus===`failed`||e.toolLifecycleStatus===`declined`||e.tone===`error`?`failed`:e.toolLifecycleStatus===`completed`?`completed`:`unfinished`}}function Xn(e){switch(e){case`command`:case`edit`:case`delegate`:case`task-cancel`:case`thread-create`:case`thread-send`:case`thread-interrupt`:case`workflow-stop`:case`schedule-create`:case`schedule-update`:case`schedule-delete`:case`schedule-run`:case`thread-configure`:case`thread-fork`:case`thread-merge`:case`thread-organize`:case`thread-update`:case`queue-edit`:case`queue-cancel`:case`queue-reorder`:case`queue-steer`:case`question-respond`:case`worktree-handoff`:case`project-create`:case`project-update`:case`project-delete`:case`project-clone`:case`environment-update`:case`attachment-prepare`:case`attachment-discard`:case`attachment-send`:return 0;case`other`:case`update`:return 2;default:return 1}}function Zn(e){let t=e.filter(e=>e.itemType!==`reasoning`);if(e.length>0&&t.length===0)return{summary:e.length===1?`Thought`:`Thought (×${e.length})`,hasFailure:!1};e=t;let n=new Map,r=new Map;for(let t of e){let e=D(q(t))?.summaryAction??null;if(t.toolSource&&e===null){r.set(t.toolSource.key,t.toolSource);continue}let i=Y(t),a=e??i,o=n.get(a);o?o.entries.push(t):n.set(a,{action:i,p4Action:e,entries:[t]})}let i=[...n].map(([e,t],n)=>({index:n,count:t.entries.length,priority:Xn(e),...t.p4Action?Nn(t.p4Action,t.entries.map(Yn)):{label:Jn(t.action,qn(t.action,t.entries)),failedCount:t.entries.filter(Un).length}})),a=[...i].sort((e,t)=>e.priority-t.priority||e.index-t.index).slice(0,2).sort((e,t)=>e.index-t.index),o=a.map(({label:e})=>e);if(r.size>0){let e=[...r.values()],t=[...new Set(e.map(e=>e.name))],n=t.length<2?t[0]:t.length===2?t.join(` and `):`${t.slice(0,-1).join(`, `)}, and ${t.at(-1)}`,i=e.every(e=>e.kind===`integration`);o.unshift(`Used ${n}${i?` ${t.length===1?`integration`:`integrations`}`:``}`)}let s=e.filter(e=>e.toolSource!==void 0&&D(q(e))===null).length,c=e.length-s-a.reduce((e,t)=>e+t.count,0);c>0&&o.push(`Performed ${c} other ${c===1?`action`:`actions`}`);let l=o.map((e,t)=>t===0?e:e.charAt(0).toLowerCase()+e.slice(1));return{summary:l.length<3?l.join(` and `):`${l.slice(0,-1).join(`, `)}, and ${l.at(-1)}`,hasFailure:i.some(e=>e.failedCount>0)}}function Qn(e){let t=e.filter(e=>e.itemType!==`reasoning`);if(e.length>0&&t.length===0)return`reasoning`;if(e=t,e.length>0&&e.every(e=>zn(e)?.icon===`pull-request`))return`pull-request`;let n=new Set(e.map(Y));if(n.size!==1)return`mixed`;let r=n.values().next().value;if(r!==`other`)return r;let i=new Set(e.map(e=>e.itemType===`dynamic_tool`?`dynamic-tool`:e.itemType===`subagent`||e.tone===`thinking`?`agent-tool`:e.tone===`tool`?`tone-tool`:`other`));return i.size===1?i.values().next().value:`mixed`}function $n(e){let t=/^\s*\*\*([^*\r\n]+)\*\*[ \t]*\r?(?:\n|$)/.exec(e)?.[1],n=(t??e).replace(/!?\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[ \t]*(?:#{1,6}|[-*+]|\d+\.)[ \t]+/gm,``).replace(/`+|\*\*|~~/g,``).replace(/(^|[^\w*])[*_]([^*_\n]+)[*_](?![\w*])/g,`$1$2`).replace(/\s+/g,` `).trim();if(t!==void 0)return n;let r=/[.?!]["'”’)]?(?=\s)/.exec(n);return r?n.slice(0,r.index+r[0].length):n}function X(e,t){if(e?.status!==`failed`)return null;let n=null;for(let r of t)r.type===`error`&&r.status===`failed`&&r.runId===e.id&&r.nodeId===e.rootNodeId&&(n===null||f(r.updatedAt)>f(n.updatedAt)||f(r.updatedAt)===f(n.updatedAt)&&(r.ordinal>n.ordinal||r.ordinal===n.ordinal&&r.id>n.id))&&(n=r);return n?.failure??null}function er(e,t){let n=t!==null&&t!==e?.message?null:e;return{usageLimitResetAt:n?.class===`usage_limit`?n.resetAt??null:null,lastError:t??e?.message??null,lastErrorClass:t!==null&&t!==e?.message?null:e?.class??null}}function tr(e){let t=null;for(let n of e)n.status!==`queued`&&(n.status!==`cancelled`||n.startedAt!==null)&&(t===null||nr(n,t))&&(t=n);return t}function nr(e,t){let n=e=>e.completedAt?f(e.completedAt):1/0;return n(e)===n(t)?e.ordinal>t.ordinal:n(e)>n(t)}function rr(e,t,n){let r=tr(e);return r?.status===`failed`&&er(X(r,t),n).lastErrorClass===`usage_limit`?r:null}function ir(e,t,n){let r=rr(e,t,n);return r!==null&&e.some(e=>e.ordinal>r.ordinal)?r:null}function ar(e){let t=null;for(let n of e)(n.status!==`queued`||n.queueHeld!==!0)&&(t===null||n.ordinal>t.ordinal)&&(t=n);return t}function or(e,t){if(e.startedAt===null)return null;let r=n(e.status)?t:e.completedAt===null?null:Date.parse(e.completedAt);if(r===null)return null;let i=Date.parse(e.startedAt);return Number.isFinite(i)&&Number.isFinite(r)?Math.max(0,r-i):null}function sr(e){if(!Number.isFinite(e)||e<0)return`0ms`;if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4){let t=Math.round(e/100)/10;return t>=10?`10s`:`${t.toFixed(1)}s`}if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=[];return n>0&&a.push(`${n}h`),r>0&&a.push(`${r}m`),i>0&&a.push(`${i}s`),a.join(` `)}var cr=new Set([`preparing`,`starting`,`running`,`waiting`]),lr=new Set([`preparing`,`starting`,`running`]);function ur(e,t){return e.runs.reduce((e,n)=>t(n)&&(e===null||n.ordinal>e.ordinal)?n:e,null)}function dr(e,t){let n=cr.has(t.status)?c(e.providerTurns,t.activeAttemptId)?.status:void 0;return{runId:t.id,status:t.status,requestedAt:m(t.requestedAt),startedAt:t.startedAt===null?null:m(t.startedAt),completedAt:t.completedAt===null?null:m(t.completedAt),assistantMessageId:e.messages.findLast(e=>e.runId===t.id&&e.role===`assistant`)?.id??null,...n===void 0||n===`pending`||n===`running`?{}:{turnEnded:!0},...t.sourcePlanRef===void 0?{}:{sourcePlanRef:t.sourcePlanRef}}}function fr(e){let t=e.providerSessions.findLast(t=>t.providerInstanceId===e.thread.providerInstanceId);return ir(e.runs,e.turnItems,t?.lastError??null)}function pr(e){return fr(e)??ar(e.runs)}function mr(e){let t=pr(e);return t===null?null:dr(e,t)}function hr(e){let t=ur(e,e=>cr.has(e.status))??pr(e);return t===null?null:dr(e,t)}function gr(e){let t=_r(e);return t!==null&&n(t.status)?t.startedAt:null}function _r(e){if(!ee(e.thread))return null;let t=e.nodes.findLast(e=>e.kind===`root_turn`&&e.runId===null);return t===void 0?null:{status:t.status,startedAt:t.startedAt===null?null:m(t.startedAt),completedAt:t.completedAt===null?null:m(t.completedAt)}}function vr(e){return e.providerThreads.find(t=>t.id===e.thread.activeProviderThreadId&&t.providerInstanceId===e.thread.modelSelection.instanceId)?.nativeMetadata?.modelSelection??null}var yr=[`reasoningEffort`,`effort`,`reasoning`,`variant`];function br(e,n=[],r){let i=n.find(t=>t.slug===e.model)?.capabilities;if(!i)return null;let a=t({caps:i,selections:e.options});for(let t of yr){let n=a.find(e=>e.id===t);if(n?.type!==`select`)continue;let i=s(n,e,r);if(i)return i}return null}var xr={idle:`Idle`,pending:`Working`,running:`Working`,waiting:`Waiting`,completed:`Completed`,interrupted:`Interrupted`,failed:`Failed`,cancelled:`Cancelled`,rolled_back:`Cancelled`};function Sr(e,t){if(e===null)return`Starting`;let r=xr[e.status],i=n(e.status);if(!i&&e.status!==`completed`)return r;let a=e.startedAt===null?NaN:Date.parse(e.startedAt),o=i?t:e.completedAt===null?NaN:Date.parse(e.completedAt);if(!Number.isFinite(a)||!Number.isFinite(o))return r;let s=sr(Math.max(1e3,Math.floor((o-a)/1e3)*1e3));return i?`${r} ${s}`:`${r} in ${s}`}function Cr(e){let t=mr(e),n=e.providerSessions.findLast(t=>t.providerInstanceId===e.thread.providerInstanceId),r=fr(e),a=pr(e),o=hr(e),s=ur(e,e=>cr.has(e.status)),c=ie(ne({latestRun:a,providerThreads:e.providerThreads,turnItems:e.turnItems,activeProviderThreadId:e.thread.activeProviderThreadId,runs:e.runs,pullRequests:e.thread.pullRequests}));if(t===null&&e.thread.activeProviderThreadId===null&&!c)return null;let l=ur(e,e=>lr.has(e.status))?.id??null;return{status:r?`failed`:c&&a?.status!==`failed`?`idle`:o?.status??`idle`,activeRunId:l,activityStartedAt:s===null?null:m(i(s)),providerInstanceId:e.thread.providerInstanceId,providerName:n?.driver??null,...er(X(a,e.turnItems),n?.lastError??null),updatedAt:m(e.updatedAt)}}function wr(e){return te(e)&&e?.activeRunId!==null&&e?.activeRunId!==void 0}var Z={subagent:{order:0,singular:`subagent`,plural:`subagents`},command:{order:1,singular:`command`,plural:`commands`},monitor:{order:2,singular:`monitor`,plural:`monitors`},background_task:{order:3,singular:`background task`,plural:`background tasks`}};function Tr(e){return e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`}function Er(e){if(e.length===0)return null;let t=ie(e),n=e.map(e=>{let t=e.description?.trim(),n=e.kind===`subagent`&&t!==void 0?ae(t).trim():t;return{taskId:e.taskId,kind:e.kind,label:n===void 0||n.length===0?Z[e.kind].singular:n,childThreadId:e.kind===`subagent`?e.childThreadId:void 0}}).sort((e,t)=>Z[e.kind].order-Z[t.kind].order),[r]=n;if(n.length===1&&r!==void 0){let e=Z[r.kind].singular,i=r.label!==e;return{title:t?i?`${r.kind===`monitor`?``:`Waiting on ${e} `}${r.label}`:`Waiting on a ${e}`:i?`Running: ${r.label}`:`Running a ${e}`,items:n,waiting:t}}let i=new Map;for(let e of n)i.set(e.kind,(i.get(e.kind)??0)+1);let a=Array.from(i,([e,t])=>{let{singular:n,plural:r}=Z[e];return`${t} ${t===1?n:r}`});return{title:`${t?`Waiting on`:`Running`} ${Tr(a)}`,items:n,waiting:t}}var Dr={active:`Pursuing goal`,paused:`Goal paused`,blocked:`Goal blocked`,usage_limited:`Goal hit a usage limit`,budget_limited:`Goal reached its token budget`,complete:`Goal complete`};function Or(e){return e<1e3?`${e}`:e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}m`}function kr(e,t){let n=[];return e.tokensUsed!==void 0&&e.tokensUsed>0&&n.push(e.tokenBudget==null?`${Or(e.tokensUsed)} tokens`:`${Or(e.tokensUsed)} / ${Or(e.tokenBudget)} tokens`),e.timeUsedSeconds!==void 0&&e.timeUsedSeconds>=60&&n.push(sr(e.timeUsedSeconds*1e3)),e.checks!==void 0&&e.checks>0&&n.push(`${e.checks} ${e.checks===1?`check`:`checks`}`),{title:e.status===`active`&&!t?`Goal set`:Dr[e.status],objective:e.objective,usage:n.length===0?null:n.join(` · `),canResume:e.status!==`active`&&e.status!==`complete`}}function Ar(e){switch(e.kind){case`subagent`:case`delegated_task`:return e.childThreadId;case`command`:case`monitor`:case`background_task`:case`system`:return;default:return}}var jr=`Preparing workspace`;function Mr(e){return e.type===`command_execution`&&e.input===jr||e.type===`error`&&e.status===`cancelled`&&e.failure.code===`workspace_preparation_failed`}function Nr(e,t){let n=new Set(e.flatMap(e=>e.status===`failed`&&e.workspacePreparation!==void 0?[e.id]:[])),r=new Set;if(n.size===0)return r;for(let e of t)e.type===`error`&&e.status===`failed`&&e.failure.code===`workspace_preparation_failed`&&e.runId!==null&&n.has(e.runId)&&r.add(e.runId);return r}function Pr(e){return e.tone===`tool`||e.tone===`thinking`||e.tone===`error`||e.command!==void 0||e.requestKind!==void 0}function Fr(e){return e.itemType===`error`}function Ir(e){if(!Pr(e)||Hn(e)||e.tone===`thinking`&&e.itemType!==`reasoning`)return!1;let t=e.toolLifecycleStatus;return t!==`failed`&&t!==`declined`&&t!==`inProgress`&&t!==`stopped`&&t!==`idle`}function Lr(e){return Pr(e)&&!Hn(e)&&!Ir(e)}function Rr(e,t){return e===null||e.status===`preparing`||e.status===`queued`||e.status===`starting`||e.status===`running`||e.status===`waiting`?!1:t?.activeRunId!==e.runId}function zr(e,t,n){return h({latestRun:e,runtime:t})??(t?.activeRunId==null?n:null)}function Br(e){return[...e].toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}function Vr(e){return[...e].toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}function Hr(e,t){if(e===null)return null;let n=e.plans.filter(e=>e.kind===`todo_list`),r=[...n].toReversed().find(e=>e.runId===t)??n.at(-1)??null;return r===null||r.steps.length===0?null:{createdAt:Q(e,r.id),runId:r.runId,explanation:r.explanation??null,steps:r.steps.map(({text:e,status:t,durationMs:n})=>({step:e,status:t===`running`?`inProgress`:t,...n===void 0?{}:{durationMs:n}}))}}function Q(e,t){let n=e.turnItems.findLast(e=>(e.type===`proposed_plan`||e.type===`todo_list`)&&e.planId===t);return m(n?.updatedAt??e.updatedAt)}function Ur(e,t){let n=Q(e,t.id);return{id:t.id,createdAt:n,updatedAt:n,runId:t.runId,planMarkdown:t.markdown,status:t.status}}function Wr(e,t){if(e===null)return null;let n=e.plans.filter(e=>e.kind===`proposed_plan`),r=t?n.filter(e=>e.runId===t):n,i=[...r.length>0?r:n].toSorted((t,n)=>Q(e,t.id).localeCompare(Q(e,n.id))||t.id.localeCompare(n.id)).at(-1);return i===void 0?null:Ur(e,i)}function Gr(e){return e?.status===`active`}var Kr=new Set([`fork`,`handoff`,`run_interrupt_request`,`run_interrupt_result`,`secret_request`,`subagent`]),qr=new Set([`fork`,`thread_created`,`secret_request`]);function Jr(e){return e.kind===`event`&&qr.has(e.projectedItem.item.type)}function $(e){return m(e.item.startedAt??e.item.updatedAt)}function Yr(e){switch(e.status){case`pending`:case`running`:case`waiting`:return`inProgress`;case`completed`:return`completed`;case`idle`:return`idle`;case`failed`:return`failed`;case`cancelled`:case`interrupted`:return`stopped`}}function Xr(e){if(e.type===`error`)return`info`;if(e.type===`reasoning`)return`thinking`;switch(e.type){case`command_execution`:case`file_change`:case`file_search`:case`web_search`:case`dynamic_tool`:case`subagent`:case`thread_created`:case`user_input_request`:case`approval_request`:return`tool`;default:return`info`}}function Zr(e){if(e.retry===void 0)return{label:e.failure.class===`usage_limit`?`Usage limit reached`:e.title?.trim()||`Provider error`,detail:e.failure.message};let t=e.retry.maxAttempts===null?`${e.retry.attempt}`:`${e.retry.attempt}/${e.retry.maxAttempts}`,n=e.status===`running`?`Retrying provider (${t})`:e.status===`completed`?`Provider recovered (${t} retries)`:e.status===`failed`?`${e.failure.class===`usage_limit`?`Usage limit reached`:`Provider error`} after ${t} retries`:`Provider retry stopped (${t})`,r=e.status===`running`&&e.retry.retryDelayMs!==null&&e.retry.retryDelayMs>0?e.retry.retryDelayMs<1e3?` Retrying in ${e.retry.retryDelayMs}ms.`:` Retrying in ${(e.retry.retryDelayMs/1e3).toFixed(1).replace(/\.0$/u,``)}s.`:``;return{label:n,detail:`${e.failure.message}${r}`}}function Qr(e){let{item:t}=e,n=t.title?.trim()||null,i={id:t.id,createdAt:$(e),runId:t.runId,tone:Xr(t),itemType:t.type,toolLifecycleStatus:Yr(t),structuredPayload:t,projectedItem:e,...Me(t)};switch(t.type){case`thread_created`:return{...i,label:`Created thread`};case`compaction`:return{...i,label:Pn(t),sourceActivityKind:`context-compaction`,...t.summary?{detail:t.summary}:{}};case`reasoning`:return{...i,label:n??`Thinking`,...t.text?{detail:t.text}:{}};case`command_execution`:return{...i,label:n??`Ran command`,command:t.input,rawCommand:t.input,toolTitle:n??`Command`,toolData:t};case`file_change`:return{...i,label:n??(t.changes!==void 0&&t.changes.length>1?`Changed ${t.changes.length} files`:`Changed ${t.fileName}`),changedFiles:t.changes?.map(e=>e.path)??[t.fileName],toolTitle:n??`File change`,toolData:t};case`file_search`:return{...i,label:n??Ee(t)??`Searched files`,...t.pattern?{detail:t.pattern}:{},toolTitle:n??`File search`,toolData:t};case`web_search`:return{...i,label:n??`Searched the web`,...t.patterns?.length?{detail:t.patterns.join(`, `)}:{},toolTitle:n??`Web search`,toolData:t};case`checkpoint`:return{...i,label:n??`Checkpoint captured`,changedFiles:t.files.map(e=>e.path),toolData:t};case`system_notice`:return{...i,label:t.message,...r(t)?{}:{sourceActivityKind:`runtime.warning`}};case`error`:{let e=Zr(t);return{...i,...e,...t.failure.class===`usage_limit`&&t.status!==`completed`?{sourceActivityKind:`runtime.warning`}:t.retry===void 0?{sourceActivityKind:`runtime.error`}:{},toolData:t}}case`dynamic_tool`:{let e=be({itemType:`dynamic_tool_call`,data:{toolName:t.toolName??void 0,input:t.input}}),[r]=ve({input:t.input});return{...i,label:n??(e===`read`?De(r??``):e===`search`?Ee({input:t.input})??t.toolName??`Tool call`:t.toolName??`Tool call`),toolTitle:n??t.toolName??`Tool`,toolData:{input:t.input,output:t.output}}}case`approval_request`:return{...i,label:n??`Approval requested`,detail:t.prompt??t.requestKind,toolData:t};case`user_input_request`:return{...i,label:n??(t.questionAnswer?`Answered questions`:`Input requested`),...t.questionAnswer?{questionAnswer:t.questionAnswer}:{},toolData:t};default:return{...i,label:n??t.type.replaceAll(`_`,` `),toolData:t}}}function $r(e){let t=new Set,n=[],r=new Map((e.attempts??[]).map(e=>[e.rootNodeId,e])),i=new Map((e.nodes??[]).map(e=>[e.id,e])),a=new Map((e.plans??[]).map(e=>[e.id,e])),o=e=>{if(e.nodeId===null||e.runId===null)return;let t=e.nodeId,n=new Set;for(;t!==null&&!n.has(t);){n.add(t);let a=r.get(t);if(a?.runId===e.runId)return a;let o=i.get(t);if(o===void 0)return;let s=r.get(o.rootNodeId);if(s?.runId===e.runId)return s;t=o.parentNodeId}},s=new Set(e.visibleTurnItems.flatMap(({item:e})=>e.type===`user_input_request`&&e.questionAnswer?[`async-answer:${e.questionAnswer.requestId}`]:[]));for(let r of e.visibleTurnItems){let{item:i}=r;if(Mr(i)||i.type===`todo_list`||i.type===`checkpoint`||i.type===`user_message`&&s.has(i.messageId))continue;let c=$(r),l=o(i),u=l===void 0?{}:{attempt:l};if(i.type===`notification`){n.push({id:i.id,kind:`work`,createdAt:c,entry:{id:i.id,createdAt:c,runId:i.runId,label:i.summary,tone:`info`,itemType:i.type,structuredPayload:i,projectedItem:r},...u});continue}if(i.type===`user_message`||i.type===`assistant_message`){let a={id:i.messageId,role:i.type===`user_message`?`user`:`assistant`,text:i.text,...i.type===`user_message`&&i.context?{context:i.context}:{},...(i.attachments?.length??0)>0?{attachments:(i.attachments??[]).map(t=>{let n=e.attachmentUrlById?.get(t.id);return n?{...t,previewUrl:n}:t})}:{},runId:i.runId,streaming:i.type===`assistant_message`&&i.streaming,...i.type===`user_message`?{createdBy:i.createdBy,creationSource:i.creationSource,...i.senderThreadId===void 0?{}:{senderThreadId:i.senderThreadId},...i.scheduledTaskId===void 0?{}:{scheduledTaskId:i.scheduledTaskId}}:{},createdAt:c,updatedAt:m(i.updatedAt),...i.type===`user_message`?{inputIntent:i.inputIntent}:{}};t.add(a.id),n.push({id:a.id,kind:`message`,createdAt:c,message:a,projectedItem:r,...u});continue}if(i.type===`proposed_plan`){let e=a.get(i.planId),t={id:i.planId,runId:i.runId,planMarkdown:i.markdown,status:e?.kind===`proposed_plan`?e.status:`active`,createdAt:c,updatedAt:m(i.updatedAt)};n.push({id:i.id,kind:`proposed-plan`,createdAt:c,proposedPlan:t,...u});continue}let d=i.type===`dynamic_tool`&&i.status===`completed`?ct(i):void 0;if(d!==void 0){n.push({id:i.id,kind:`html-render`,createdAt:c,runId:i.runId,htmlRender:d,...u});continue}let f=i.type===`dynamic_tool`&&i.status===`completed`?lt(i):void 0;if(f!==void 0){n.push({id:i.id,kind:`mcp-app`,createdAt:c,runId:i.runId,sourceThreadId:r.sourceThreadId,itemId:r.sourceItemId,revision:bt(i),mcpApp:f,...u});continue}if(Kr.has(i.type)){n.push({id:i.id,kind:`event`,createdAt:c,projectedItem:r,...u});continue}n.push({id:i.id,kind:`work`,createdAt:c,entry:Qr(r),...u})}let c=new Set([...t,...s]);for(let t of e.anchoredMessages??[]){if(c.has(t.id))continue;c.add(t.id);let e={id:t.id,kind:`message`,createdAt:t.createdAt,message:t},r=n.findIndex(e=>e.createdAt>t.createdAt);r===-1?n.push(e):n.splice(r,0,e)}for(let t of e.optimisticMessages)t.inputIntent!==`queued_turn`&&!c.has(t.id)&&(c.add(t.id),n.push({id:t.id,kind:`message`,createdAt:t.createdAt,message:t}));return n}var ei=Object.freeze([]);function ti(e){let t=new Set;for(let n of e??[]){if(!a(n))continue;let e=n.previewUrl;e?.startsWith(`blob:`)||e?.startsWith(`data:`)||t.add(n.id)}return t.size===0?ei:Array.from(t,e=>({_tag:`attachment`,attachmentId:e}))}function ni(e,t){if(Object.keys(t).length===0)return ei;let n=new Set;for(let r of e??[])if(r.role===`user`&&t[r.id]?.length)for(let e of r.attachments??[])a(e)&&n.add(e.id);return n.size===0?ei:Array.from(n,e=>({_tag:`attachment`,attachmentId:e}))}function ri(){let e=new WeakMap,t=new WeakMap;return(n,r)=>{let i=n.attachments;if(!i||i.length===0)return n;let a=e.get(i)??i,o,s=!1;for(let[e,t]of i.entries()){let n=r(t),i=`previewUrl`in t?t.previewUrl:void 0,c=a[e],l=`previewUrl`in c?c.previewUrl:void 0,u=!n||n===i?t:n===l?c:{...t,previewUrl:n};s||=u!==t,u!==c&&(o??=a.slice(),o[e]=u)}let c=s?o??a:i;if(e.set(i,c),c===i)return t.delete(n),n;let l=t.get(n);if(l?.attachments===c)return l;let u={...n,attachments:c};return t.set(n,u),u}}function ii(e,t){if(e.role!==`assistant`||t.role!==`assistant`||!e.streaming||!t.streaming)return!1;let{text:n,updatedAt:r,...i}=e,{text:a,updatedAt:o,...s}=t;return l(i,s)}function ai(e,t){let{item:n,...r}=e,{item:i,...a}=t;if(n.type!==`assistant_message`||i.type!==`assistant_message`||!n.streaming||!i.streaming||!l(r,a)||$(e)!==$(t))return!1;let{text:o,updatedAt:s,...c}=n,{text:d,updatedAt:f,...p}=i;return u(c,p)}function oi(e,t){let n=t.input;if(e.visibleTurnItems.length<n.visibleTurnItems.length||!l(e.optimisticMessages,n.optimisticMessages)||!l(e.anchoredMessages,n.anchoredMessages)||!l(e.attachmentUrlById,n.attachmentUrlById)||!l(e.attempts,n.attempts)||!l(e.nodes,n.nodes)||!l(e.plans,n.plans))return null;let r=e.visibleTurnItems.length>n.visibleTurnItems.length;if(r&&(e.optimisticMessages.length>0||(e.anchoredMessages?.length??0)>0)||r&&e.visibleTurnItems.slice(n.visibleTurnItems.length).some(({item:e})=>e.type===`user_input_request`&&e.questionAnswer!==void 0||e.type===`user_message`&&e.messageId.startsWith(`async-answer:`)))return null;let i=new Map;for(let[t,r]of n.visibleTurnItems.entries()){let n=e.visibleTurnItems[t];if(n!==r){if(!ai(r,n))return null;i.set(r,n)}}if(i.size===0&&!r)return t.entries;let a=t.entries.map(e=>{let t=e.kind===`message`&&e.projectedItem!==void 0?i.get(e.projectedItem):void 0;return e.kind!==`message`||t?.item.type!==`assistant_message`?e:{...e,projectedItem:t,message:{...e.message,text:t.item.text,updatedAt:m(t.item.updatedAt)}}});return r&&a.push(...$r({...e,visibleTurnItems:e.visibleTurnItems.slice(n.visibleTurnItems.length)})),a}function si(e,t=null){let n=t===null?null:oi(e,t);if(n!==null)return{input:e,entries:n};let r=$r(e);if(t===null||!l(e.attachmentUrlById,t.input.attachmentUrlById))return{input:e,entries:r};let i=new Map(t.entries.flatMap(e=>e.kind===`message`?[[e.id,e]]:[]));return{input:e,entries:r.map(e=>{if(e.kind!==`message`||e.projectedItem===void 0)return e;let t=i.get(e.id);return t?.projectedItem===e.projectedItem?t.attempt===e.attempt?t:{...e,message:t.message}:e})}}function ci(e){return Object.fromEntries(e.flatMap(e=>e.runId===null?[]:[[e.runId,e.checkpointTurnCount]]))}function li(e){let t=new Map;for(let n of e.checkpoints)n.status===`ready`&&t.set(n.runId,n);let n=new Map;for(let r of e.timelineEntries){if(r.kind!==`message`||r.message.role!==`user`||r.message.inputIntent!==`turn_start`&&r.message.inputIntent!==`queued_turn`||r.message.runId===null)continue;let e=t.get(r.message.runId);e!==void 0&&n.set(r.message.id,Math.max(0,e.checkpointTurnCount-1))}return n}function ui(e){return e===null?`disconnected`:e.status===`preparing`||e.status===`starting`||e.status===`queued`?`connecting`:e.status===`running`||e.status===`waiting`?`running`:`ready`}function di(e,t){return e&&(ui(t)===`running`||wr(t))}export{cn as $,br as A,ir as B,Nr as C,gr as D,vr as E,or as F,zn as G,$n as H,sr as I,Qn as J,Zn as K,tr as L,Ar as M,Er as N,hr as O,kr as P,yn as Q,X as R,Pr as S,fe as St,_r as T,Fn as U,Rn as V,Kn as W,Gn as X,Un as Y,un as Z,ni as _,de as _t,Br as a,Tt as at,Lr as b,De as bt,li as c,Ct as ct,Gr as d,Fe as dt,pn as et,ci as f,Ne as ft,Zr as g,Ke as gt,ai as h,Ye as ht,di as i,bt as it,Sr as j,Cr as k,si as l,A as lt,ii as m,qe as mt,Hr as n,mn as nt,Vr as o,xt as ot,Rr as p,Je as pt,Y as q,zr as r,F as rt,ui as s,wt as st,ri as t,An as tt,Wr as u,D as ut,ti as v,ve as vt,mr as w,Fr as x,Ee as xt,Jr as y,he as yt,ar as z};
26
- //# sourceMappingURL=session-logic-w7gGMFHb.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./SettingsPanels-DRK5QQ04.js";var t=e;export{t as component};
2
- //# sourceMappingURL=settings.archived-ZXG8lJ_T.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{Ey as i,Fd as a,am as o,dr as s,td as c}from"./utils-BE5iQuUP.js";import{t as l}from"./useNavigate-Lp_S-tAl.js";import{F as u,I as d,L as f,R as p,V as m,a as h,i as g,s as _}from"./settingsLayout-DzBeWTUO.js";import{va as v}from"./main-Dcfxjdkd.js";var y=n(),b=e(t(),1),x=e(r(),1);function S(e){let t=(0,y.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=(0,x.jsx)(`span`,{className:`mt-3 ml-4 flex size-10 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground`,children:(0,x.jsx)(n,{"aria-hidden":!0,className:`size-5`})}),t[3]=n,t[4]=i);let a;t[5]===r?a=t[6]:(a=(0,x.jsx)(h,{...r,className:`min-w-0 flex-1`}),t[5]=r,t[6]=a);let o;return t[7]!==i||t[8]!==a?(o=(0,x.jsxs)(`div`,{className:`flex items-start`,children:[i,a]}),t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function C(){let e=l(),{search:t}=m(),n=u(),r=p(),h=f(),y=d([`decisionVisionEnabled`]),C=!!n.decisionOpenRouterKey,w=window.desktopBridge,[T,E]=(0,b.useState)([]),[D,O]=(0,b.useState)(!!w?.listComputerUsePermissionHosts),[k,A]=(0,b.useState)(``),[j,M]=(0,b.useState)(!1),[N,P]=(0,b.useState)(``);(0,b.useEffect)(()=>{let e=!0,t=async()=>{if(w?.listComputerUsePermissionHosts&&w.requestComputerUsePermission)try{let t=await w.listComputerUsePermissionHosts(),n=await Promise.all(t.map(async e=>({...e,permissions:await w.requestComputerUsePermission({...e,action:`status`})})));e&&(E(n),A(``))}catch{e&&A(`Could not read helper status. Refresh to try again.`)}finally{e&&O(!1)}};t();let n=w?.onComputerUsePermissionHostsChanged?.(()=>void t()),r=()=>void t();return window.addEventListener(`focus`,r),()=>{e=!1,n?.(),window.removeEventListener(`focus`,r)}},[w]);let F=async e=>{M(!0),A(``);try{await e()}catch(e){A(e instanceof Error?e.message:`Computer Use setup failed.`)}finally{M(!1)}},I=(e,t)=>F(async()=>{let n=await w?.requestComputerUsePermission?.({environmentId:e.environmentId,hostId:e.hostId,action:t});n&&E(t=>t.map(t=>t.hostId===e.hostId?{...t,permissions:n}:t))});return(0,x.jsxs)(g,{children:[(0,x.jsxs)(`header`,{className:`space-y-2 px-3 sm:px-4`,children:[(0,x.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Computer Use`}),(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage how agents interact with apps and browsers on your computer.`})]}),(0,x.jsxs)(_,{title:`Control`,variant:`plain`,children:[(0,x.jsxs)(`div`,{className:`divide-y divide-border overflow-hidden rounded-2xl border border-border`,children:[(0,x.jsx)(S,{icon:c,title:`Desktop apps`,description:`Control apps through the P4 Code desktop helper. Stop active control from the menu bar.`,status:D?`Checking helper…`:T.length?`Connected`:window.desktopBridge?`No helper connected`:`Open the desktop app to set up app control.`,control:w?.revealComputerUseHelper?(0,x.jsx)(s,{size:`sm`,variant:`outline`,disabled:j,onClick:()=>void F(()=>w.revealComputerUseHelper()),children:`Reveal in Finder`}):void 0,children:T.map(e=>(0,x.jsxs)(`div`,{className:`space-y-2 py-3`,children:[(0,x.jsx)(`p`,{className:`text-xs font-medium`,children:e.label}),(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Allow app interaction and screenshots in macOS settings, then refresh the status.`}),(0,x.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,x.jsxs)(s,{size:`sm`,variant:`outline`,disabled:j,onClick:()=>void I(e,e.permissions?.accessibility?`open-accessibility`:`allow-accessibility`),children:[`Accessibility: `,e.permissions?.accessibility?`Allowed`:`Allow`]}),(0,x.jsxs)(s,{size:`sm`,variant:`outline`,disabled:j,onClick:()=>void I(e,e.permissions?.screenRecording?`open-screen-recording`:`allow-screen-recording`),children:[`Screen Recording: `,e.permissions?.screenRecording?`Allowed`:`Allow`]}),(0,x.jsx)(s,{size:`sm`,variant:`ghost`,disabled:j,onClick:()=>void I(e,`status`),children:`Refresh`})]})]},`${e.environmentId}:${e.hostId}`))}),(0,x.jsx)(S,{icon:a,title:`Google Chrome`,description:`Control browser tabs with the Chrome extension. Its toolbar button stops control of the current tab.`,status:w?.setupComputerUseChrome?void 0:`Set up the Chrome extension from the desktop app.`,control:w?.setupComputerUseChrome?(0,x.jsx)(s,{size:`sm`,variant:`outline`,disabled:j,onClick:()=>void F(async()=>{let e=await w.setupComputerUseChrome();P(e.extensionPath)}),children:`Set up Chrome`}):void 0,children:N?(0,x.jsxs)(`p`,{className:`break-all py-3 text-xs text-muted-foreground`,role:`status`,children:[`In chrome://extensions, enable Developer mode and use Load unpacked to open:`,` `,N]}):null})]}),k?(0,x.jsx)(`p`,{className:`px-4 text-sm text-destructive`,role:`alert`,children:k}):null]}),(0,x.jsx)(_,{title:`Navigation`,variant:`plain`,children:(0,x.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border`,children:(0,x.jsx)(S,{icon:o,id:`computer-use-faster-navigation`,title:`Faster navigation`,description:`Use screenshot suggestions from Jev or Luna Decisions to find navigation targets.`,serverScoped:!0,settingKeys:[`decisionVisionEnabled`],control:(0,x.jsx)(v,{"aria-label":`Faster navigation`,checked:n.decisionVisionEnabled,mixed:y,disabled:!h,onCheckedChange:e=>r({decisionVisionEnabled:e})}),children:(0,x.jsxs)(`div`,{className:`space-y-3 py-3`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,x.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[i[n.decisionModel],` ·`,` `,C?`API key saved`:`API key needed`]}),(0,x.jsx)(s,{size:`sm`,variant:`outline`,onClick:()=>void e({to:`/settings/decisions`,search:t.machine?{machine:t.machine}:{}}),children:`Model and API key`})]}),n.decisionVisionEnabled&&!C?(0,x.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Add an API key in Decisions to use faster navigation.`}):null,(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`When enabled, screenshots go to the selected service. Suggestions never click by themselves.`})]})})})})]})}var w=C;export{w as component};
2
- //# sourceMappingURL=settings.computer-use-lOJg1Jos.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{$_ as i,$n as a,Am as o,El as s,Gl as c,H_ as l,I_ as u,J_ as d,Jp as f,K_ as p,Kl as m,Nd as h,Ov as g,Q_ as _,Qp as v,Qx as y,R_ as b,Rf as x,U_ as S,Uc as C,V_ as w,Wy as T,X_ as E,Y_ as D,Yn as O,Z_ as k,Zo as A,__ as j,am as M,ar as N,as as P,bx as F,cr as ee,dr as I,eE as te,ev as ne,fr as re,gC as ie,iE as ae,if as oe,is as se,jd as ce,lr as le,nh as ue,nr as de,nv as fe,ov as L,ps as pe,q_ as me,rE as he,rr as ge,sE as _e,sb as R,sr as ve,t as ye,tr as be,ts as xe,tv as Se,ur as Ce,us as z,ux as B,x_ as we,z_ as Te}from"./utils-BE5iQuUP.js";import{Dt as V,Et as Ee,F as De,Ht as Oe,On as ke,Ot as Ae,R as je,Ut as Me,W as Ne,jt as H,kt as U,o as Pe,on as Fe,tt as Ie,w as Le,x as Re}from"./runtime-DSZ2mWrf.js";import{E as ze,Et as Be,F as Ve,Mt as He,Ot as Ue,S as W,_ as We,jt as Ge,t as G}from"./runtime-DTUiqO10.js";import{a as Ke,c as qe,o as Je,s as Ye,t as Xe}from"./select-C10oXKGz.js";import{t as K}from"./spinner-CW23--q5.js";import{i as q,p as Ze}from"./toast-BFuAqla3.js";import{A as Qe,D as $e,E as et,O as tt,b as nt,c as J,et as rt,s as it,v as at}from"./useSettings-CPPvBMmM.js";import{f as ot,h as st,s as ct}from"./server-ztj8tD38.js";import{a as lt,i as ut,n as dt,s as ft}from"./session-yxXjF8AQ.js";import{n as pt}from"./query-BV3IuYff.js";import{t as mt}from"./use-atom-command-CSWaAmR7.js";import{t as Y}from"./toastHelpers-DxXYm50b.js";import{i as ht,r as gt}from"./timestampFormat-wac2e_Jz.js";import{a as _t,n as vt,t as yt}from"./tooltip-CSzrAm8M.js";import{t as bt}from"./textarea-DSS-lavF.js";import{t as xt}from"./input-GkmNnHh7.js";import{t as St}from"./scroll-area-CfW8fzQ8.js";import{a as Ct,c as wt,i as Tt,l as Et,n as Dt,o as Ot,r as kt,s as At,t as jt}from"./dialog-pqqgtsKn.js";import{n as Mt}from"./P4ConnectAccountPages-Cbg00I7Q.js";import{a as Nt,i as Pt,o as Ft,r as It,t as Lt}from"./empty-Du5F51Da.js";import{t as Rt}from"./AnimatedHeight-CFR4EWDw.js";import{C as zt,_ as Bt,w as Vt,y as Ht}from"./keybindings-1XWkWeQB.js";import{i as Ut,o as Wt,t as Gt}from"./popover-BIXQitBy.js";import{t as Kt}from"./checkbox-CwFE3KXZ.js";import{_ as qt,a as Jt,c as Yt,d as Xt,f as Zt,g as Qt,i as $t,l as en,p as tn,r as nn,s as rn,u as an,v as on}from"./uiStateStore-VHQ8vDs5.js";import{n as sn,t as X}from"./EnvironmentMachineIcon-Emg7F_9r.js";import{r as cn,t as ln}from"./alert-DiE1d01s.js";import{a as un,i as dn,s as fn,u as pn}from"./settingsLayout-DzBeWTUO.js";import{_ as mn,b as hn,g as gn,h as _n,v as vn,x as yn,y as bn}from"./command-NV0JEoGo.js";import{t as xn}from"./ConnectionStatusDot-DVkDejK1.js";import{a as Sn,n as Cn,o as wn,s as Tn,t as En}from"./primary-DD11poOa.js";import{n as Dn,t as On}from"./onboarding-KXMrOHsw.js";import{Ar as kn,Er as An,Fr as jn,Gn as Mn,Ir as Nn,Jn as Pn,Jt as Fn,Kn as In,Kt as Ln,Mr as Rn,Nr as zn,Or as Bn,Pr as Vn,Qn as Hn,T as Un,Tr as Wn,Wt as Gn,Xn as Kn,Yn as qn,Zn as Jn,_r as Yn,ga as Xn,gr as Zn,ha as Qn,hr as $n,ir as er,jr as tr,kr as nr,li as rr,mr as ir,qn as ar,qt as or,ui as sr,va as cr}from"./main-Dcfxjdkd.js";import{i as lr,n as ur,r as dr}from"./ConnectionDiagnosisDetails-DCPX1JuG.js";import{t as fr}from"./FoldedSettingsSection-Dzi9RecU.js";var Z=n(),pr=[{scope:me,title:`View environment`,description:`Read threads, status, checkpoints, and configuration.`},{scope:p,title:`Operate tasks`,description:`Start, update, and stop tasks.`},{scope:_,title:`Change environment settings`,description:`Edit environment preferences and keybindings.`},{scope:D,title:`Manage providers`,description:`Configure, install, sign in to, and update providers and usage sources.`},{scope:w,title:`Maintain environment`,description:`Update the server and control environment processes.`},{scope:d,title:`Control previews`,description:`Open browser previews and host browser automation.`},{scope:Te,title:`View diagnostics and usage`,description:`Read process diagnostics, resource history, and usage totals.`},{scope:fe,title:`View terminals`,description:`Read existing terminal output and status.`},{scope:Se,title:`Use terminals`,description:`Create terminals and send input to running shells.`},{scope:i,title:`Change source control`,description:`Commit, push, manage branches and repositories, and change pull requests.`},{scope:l,title:`Read files`,description:`Browse host files, search workspaces, and inspect local changes.`},{scope:S,title:`Write files`,description:`Edit workspace files and save plans to disk.`},{scope:u,title:`View access`,description:`Inspect pairing links and authorized clients.`},{scope:b,title:`Manage access`,description:`Issue and revoke credentials for other clients.`},{scope:E,title:`View relay`,description:`Inspect managed relay connectivity.`},{scope:k,title:`Manage relay`,description:`Change managed tunnel connectivity.`}],Q=e(r(),1);function mr(e){let t=(0,Z.c)(4),{environmentId:n,connected:r,routeContext:i}=e,a=i!==void 0&&i,o=lt(n),s;return t[0]!==r||t[1]!==a||t[2]!==o?(s=r&&!o.hasError&&!o.isPending&&o.data?.authenticated?(0,Q.jsxs)(`div`,{className:`space-y-3 py-3 text-xs`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:a?`These permissions apply to your active route. Other routes may have different permissions.`:`These permissions apply to this client’s current connection.`}),(0,Q.jsx)(`ul`,{className:`grid gap-x-6 gap-y-2 sm:grid-cols-2`,children:pr.map(e=>{let{scope:t,title:n}=e;return(0,Q.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:L(o.data,t)?`Allowed`:`Not granted`})]},t)})})]}):(0,Q.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:`Permissions not checked. Connect to this environment to view this session’s permissions.`}),t[0]=r,t[1]=a,t[2]=o,t[3]=s):s=t[3],s}var $=e(t(),1);function hr(e,t){let n=new URL(e);return n.pathname=`/pair`,He(n,t).toString()}function gr(e,t){return new URL(e).protocol===`https:`?W({host:e,token:t}):null}function _r(){let e=(0,Z.c)(48),t=window.desktopBridge?.setLocalEnvironmentEnabled,[n]=(0,$.useState)(vr),[r,i]=(0,$.useState)(!1),[a,o]=(0,$.useState)(!1),[s,c]=(0,$.useState)(null);if(!t)return null;let l;e[0]===n?l=e[1]:(l=async()=>{o(!0),c(null);try{await t(!n)}catch(e){let t=e;c(t instanceof Error?t.message:`Couldn't change this setting.`),o(!1)}},e[0]=n,e[1]=l);let u=l,d;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=er(`local-environment`),e[2]=d):d=e[2];let f=n?`Run agents on this computer. Turn off to use P4 Code only with remote environments.`:`Turned off. Agents only run in remote environments.`,p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>i(!0),e[3]=p):p=e[3];let m;e[4]!==n||e[5]!==a?(m=(0,Q.jsx)(cr,{checked:n,disabled:a,onCheckedChange:p,"aria-label":`Local environment`}),e[4]=n,e[5]=a,e[6]=m):m=e[6];let h;e[7]!==f||e[8]!==m?(h=(0,Q.jsx)(un,{...d,description:f,control:m}),e[7]=f,e[8]=m,e[9]=h):h=e[9];let g;e[10]===a?g=e[11]:(g=e=>{a||(i(e),e||c(null))},e[10]=a,e[11]=g);let _=n?`Turn off local environment?`:`Turn on local environment?`,v;e[12]===_?v=e[13]:(v=(0,Q.jsx)(Nn,{children:_}),e[12]=_,e[13]=v);let y=n?`P4 Code will restart without running a server on this computer. Any agents and terminals running here will stop, and other devices will no longer be able to connect to this computer. Your projects, history, and remote environments are unaffected.`:`P4 Code will restart and start running a server on this computer again.`,b;e[14]===y?b=e[15]:(b=(0,Q.jsx)(Rn,{children:y}),e[14]=y,e[15]=b);let x;e[16]!==b||e[17]!==v?(x=(0,Q.jsxs)(Vn,{children:[v,b]}),e[16]=b,e[17]=v,e[18]=x):x=e[18];let S;e[19]===s?S=e[20]:(S=s?(0,Q.jsx)(`p`,{className:`px-6 pb-4 text-sm text-destructive`,children:s}):null,e[19]=s,e[20]=S);let C;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(I,{variant:`outline`}),e[21]=C):C=e[21];let w;e[22]===a?w=e[23]:(w=(0,Q.jsx)(tr,{disabled:a,render:C,children:`Cancel`}),e[22]=a,e[23]=w);let T=n?`destructive`:`default`,E;e[24]===u?E=e[25]:(E=()=>void u(),e[24]=u,e[25]=E);let D;e[26]!==n||e[27]!==a?(D=a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Restarting…`]}):n?`Restart and turn off`:`Restart and turn on`,e[26]=n,e[27]=a,e[28]=D):D=e[28];let O;e[29]!==a||e[30]!==T||e[31]!==E||e[32]!==D?(O=(0,Q.jsx)(I,{variant:T,disabled:a,onClick:E,children:D}),e[29]=a,e[30]=T,e[31]=E,e[32]=D,e[33]=O):O=e[33];let k;e[34]!==w||e[35]!==O?(k=(0,Q.jsxs)(zn,{children:[w,O]}),e[34]=w,e[35]=O,e[36]=k):k=e[36];let A;e[37]!==x||e[38]!==S||e[39]!==k?(A=(0,Q.jsxs)(jn,{children:[x,S,k]}),e[37]=x,e[38]=S,e[39]=k,e[40]=A):A=e[40];let j;e[41]!==r||e[42]!==A||e[43]!==g?(j=(0,Q.jsx)(kn,{open:r,onOpenChange:g,children:A}),e[41]=r,e[42]=A,e[43]=g,e[44]=j):j=e[44];let M;return e[45]!==j||e[46]!==h?(M=(0,Q.jsxs)(Q.Fragment,{children:[h,j]}),e[45]=j,e[46]=h,e[47]=M):M=e[47],M}function vr(){return!Le()}function yr(e){return e.serverConfig===null?`Connect to this environment to change its icon.`:e.serverConfig.environment.capabilities.environmentIcon===!0?e.operateAccess===`granted`?null:`Your session on this environment cannot change its settings.`:`This environment's server is too old to keep an icon. Update it to choose one.`}function br(e){let t=(0,Z.c)(27),{environmentId:n,serverConfig:r}=e,i=nt(n),o=ut(n,`settings:write`)?`granted`:`denied`,c;t[0]!==o||t[1]!==r?(c=yr({serverConfig:r,operateAccess:o}),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l=c,u=r?.environment.platform.machine??`server`,d;t[3]===r?d=t[4]:(d=s(r),t[3]=r,t[4]=d);let f=d,p;t[5]===f?p=t[6]:(p=(0,Q.jsxs)(le,{children:[(0,Q.jsx)(sn,{kind:f}),`Icon`]}),t[5]=f,t[6]=p);let m;t[7]===l?m=t[8]:(m=l===null?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{disabled:!0,className:`whitespace-normal`,children:l}),(0,Q.jsx)(N,{})]}),t[7]=l,t[8]=m);let h;t[9]!==u||t[10]!==l||t[11]!==i?(h=e=>{l===null&&we(e)&&i({environmentIcon:e===u?null:e})},t[9]=u,t[10]=l,t[11]=i,t[12]=h):h=t[12];let g;t[13]!==u||t[14]!==l||t[15]!==r?.environment?(g=j.map(e=>(0,Q.jsx)(ge,{value:e,disabled:l!==null,children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(sn,{kind:e,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:X[e]}),e===u?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:r?.environment.platform.machine?`detected`:`default`}):null]})},e)),t[13]=u,t[14]=l,t[15]=r?.environment,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==h||t[19]!==g?(_=(0,Q.jsx)(de,{value:f,onValueChange:h,children:g}),t[17]=f,t[18]=h,t[19]=g,t[20]=_):_=t[20];let v;t[21]!==m||t[22]!==_?(v=(0,Q.jsxs)(ee,{children:[m,_]}),t[21]=m,t[22]=_,t[23]=v):v=t[23];let y;return t[24]!==p||t[25]!==v?(y=(0,Q.jsxs)(ve,{children:[p,v]}),t[24]=p,t[25]=v,t[26]=y):y=t[26],y}function xr(e){let t=(0,Z.c)(31),{environment:n,onAddRoute:r}=e,i=U(n.entry),a=i.map(Cr),[o,s]=(0,$.useState)(null),c=o!==null&&o.length===a.length&&o.some((e,t)=>e!==a[t])?[...o]:a,l=new Map(i.map(Sr)),u=c.flatMap(e=>l.get(e)??[]),d=ft(n.environmentId),p;t[0]!==n.connection||t[1]!==d._tag||t[2]!==d.value?(p=d._tag===`Some`&&n.connection.phase===`connected`?V(d.value.target):null,t[0]=n.connection,t[1]=d._tag,t[2]=d.value,t[3]=p):p=t[3];let m=p,h=mt(st.reorderRoutes,`Reorder routes`),g=mt(st.removeRoute,`Remove route`),_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_={activationConstraint:{distance:4}},t[4]=_):_=t[4];let v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={coordinateGetter:rn},t[5]=v):v=t[5];let y=qt(Qt(Zt,_),Qt(Xt,v)),b;t[6]!==n.environmentId||t[7]!==g?(b=async e=>{let t=Ee(e);await rt(`Remove ${Ae(e)} route?${t===null?``:`\n${t}`}`,{variant:`destructive`})===!0&&await g({environmentId:n.environmentId,routeId:V(e.target)})},t[6]=n.environmentId,t[7]=g,t[8]=b):b=t[8];let x=b,S=e=>{if(e.over===null||e.active.id===e.over.id)return;let t=Jt(c,c.indexOf(String(e.active.id)),c.indexOf(String(e.over.id)));s(t),h({environmentId:n.environmentId,routeIds:t}).then(e=>{e._tag===`Failure`&&s(null)})},C=an,w=tn,T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=[sr,rr],t[9]=T):T=t[9];let E=$t,D=en,O=`Routes to ${n.label}, preferred first`,k=u.map((e,t)=>(0,Q.jsx)(wr,{route:e,position:t+1,inUse:V(e.target)===m,removable:u.length>1&&!H(e),onRemove:()=>void x(e)},V(e.target))),A;t[10]!==k||t[11]!==O?(A=(0,Q.jsx)(`ol`,{"aria-label":O,children:k}),t[10]=k,t[11]=O,t[12]=A):A=t[12];let j;t[13]!==E||t[14]!==c||t[15]!==A||t[16]!==D?(j=(0,Q.jsx)(E,{items:c,strategy:D,children:A}),t[13]=E,t[14]=c,t[15]=A,t[16]=D,t[17]=j):j=t[17];let M;t[18]!==C||t[19]!==S||t[20]!==y||t[21]!==j||t[22]!==w||t[23]!==T?(M=(0,Q.jsx)(C,{sensors:y,collisionDetection:w,modifiers:T,onDragEnd:S,children:j}),t[18]=C,t[19]=S,t[20]=y,t[21]=j,t[22]=w,t[23]=T,t[24]=M):M=t[24];let N;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(f,{className:`size-3`}),t[25]=N):N=t[25];let P;t[26]===r?P=t[27]:(P=(0,Q.jsx)(`div`,{className:`-ml-1.5 pt-1`,children:(0,Q.jsxs)(I,{size:`xs`,variant:`ghost-muted`,onClick:r,children:[N,`Add route`]})}),t[26]=r,t[27]=P);let F;return t[28]!==M||t[29]!==P?(F=(0,Q.jsxs)(`div`,{className:`mt-2 border-t border-border/50 py-2`,children:[M,P]}),t[28]=M,t[29]=P,t[30]=F):F=t[30],F}function Sr(e){return[V(e.target),e]}function Cr(e){return V(e.target)}function wr(e){let t=(0,Z.c)(43),{route:n,position:r,inUse:i,removable:a,onRemove:o}=e,s;t[0]===n.target?s=t[1]:(s=V(n.target),t[0]=n.target,t[1]=s);let c=s,l;t[2]===n?l=t[3]:(l=Ae(n),t[2]=n,t[3]=l);let u=l,d;t[4]===n?d=t[5]:(d=Ee(n),t[4]=n,t[5]=d);let f=d,p;t[6]===c?p=t[7]:(p={id:c},t[6]=c,t[7]=p);let{attributes:m,listeners:h,setNodeRef:g,setActivatorNodeRef:_,transform:v,transition:y,isDragging:b}=Yt(p),S;t[8]===v?S=t[9]:(S=on.Translate.toString(v),t[8]=v,t[9]=S);let C;t[10]!==S||t[11]!==y?(C={transform:S,transition:y},t[10]=S,t[11]=y,t[12]=C):C=t[12];let w=b&&`relative z-10 rounded-md bg-background shadow-md`,T;t[13]===w?T=t[14]:(T=ye(`flex items-center gap-2 py-2`,w),t[13]=w,t[14]=T);let E;t[15]===i?E=t[16]:(E=i?(0,Q.jsx)(`span`,{className:`rounded-sm bg-success/12 px-1 text-2xs font-normal text-success-foreground`,children:`In use`}):null,t[15]=i,t[16]=E);let D;t[17]!==u||t[18]!==E?(D=(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[u,E]}),t[17]=u,t[18]=E,t[19]=D):D=t[19];let O;t[20]!==f||t[21]!==n?(O=f===null?null:(0,Q.jsxs)(`p`,{className:`truncate text-2xs text-muted-foreground`,children:[f,H(n)?` · found automatically`:``]}),t[20]=f,t[21]=n,t[22]=O):O=t[22];let k;t[23]!==D||t[24]!==O?(k=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[D,O]}),t[23]=D,t[24]=O,t[25]=k):k=t[25];let A=`Reorder ${u}, position ${r}`,j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(x,{className:`size-3.5`}),t[26]=j):j=t[26];let M;t[27]!==m||t[28]!==h||t[29]!==_||t[30]!==A?(M=(0,Q.jsx)(`button`,{type:`button`,ref:_,...m,...h,"aria-label":A,className:`flex size-6 shrink-0 cursor-grab touch-none items-center justify-center rounded text-muted-foreground/70 outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring active:cursor-grabbing`,children:j}),t[27]=m,t[28]=h,t[29]=_,t[30]=A,t[31]=M):M=t[31];let N;t[32]!==u||t[33]!==o||t[34]!==a?(N=a?(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`Remove ${u} route`,onClick:o}),children:(0,Q.jsx)(ue,{className:`size-3`})}),(0,Q.jsx)(vt,{side:`top`,children:`Remove route`})]}):null,t[32]=u,t[33]=o,t[34]=a,t[35]=N):N=t[35];let P;return t[36]!==g||t[37]!==k||t[38]!==M||t[39]!==N||t[40]!==C||t[41]!==T?(P=(0,Q.jsxs)(`li`,{ref:g,style:C,className:T,children:[k,M,N]}),t[36]=g,t[37]=k,t[38]=M,t[39]=N,t[40]=C,t[41]=T,t[42]=P):P=t[42],P}function Tr(e){let t=e.username?`${e.username}@${e.hostname}`:e.hostname;return e.port?`${t}:${e.port}`:t}function Er(e,t=null){let{entry:n}=e;if(n.target._tag===`PrimaryConnectionTarget`)return`This machine`;let r=U(n);if(r.length>1){let e=t===null?void 0:r.find(e=>V(e.target)===V(t));return e===void 0?Ae(r[0]):`via ${Ae(e)}`}return e.relayManaged?`P4 Connect`:We(n.target)?`WSL`:n.target._tag===`SshConnectionTarget`&&ae(n.profile)&&n.profile.value._tag===`SshConnectionProfile`?`SSH ${Tr(n.profile.value.target)}`:e.displayUrl??`Remote link`}function Dr(e){let t=(0,Z.c)(23),{kind:n,label:r,subtitle:i,below:a,detail:o,dimmed:s,className:c,children:l}=e,u=s!==void 0&&s&&`opacity-60`,d;t[0]!==c||t[1]!==u?(d=ye(`grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 px-3 py-2.5 sm:px-4`,u,c),t[0]=c,t[1]=u,t[2]=d):d=t[2];let f;t[3]===n?f=t[4]:(f=(0,Q.jsx)(sn,{"aria-hidden":!0,kind:n,className:`size-4 text-muted-foreground`}),t[3]=n,t[4]=f);let p;t[5]===r?p=t[6]:(p=(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,children:r}),t[5]=r,t[6]=p);let m;t[7]===i?m=t[8]:(m=(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==a||t[10]!==p||t[11]!==m?(h=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[p,m,a]}),t[9]=a,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]===l?g=t[14]:(g=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:l}),t[13]=l,t[14]=g);let _;t[15]===o?_=t[16]:(_=o?(0,Q.jsx)(`div`,{className:`col-span-2 col-start-2 min-w-0`,children:o}):null,t[15]=o,t[16]=_);let v;return t[17]!==d||t[18]!==f||t[19]!==h||t[20]!==g||t[21]!==_?(v=(0,Q.jsxs)(`div`,{className:d,children:[f,h,g,_]}),t[17]=d,t[18]=f,t[19]=h,t[20]=g,t[21]=_,t[22]=v):v=t[22],v}var Or=[{value:100,label:`Prefer`},{value:50,label:`Normal`},{value:25,label:`Less often`},{value:0,label:`Manual only`}];function kr(e){return e===void 0||e===50?50:e===0?0:e<50?25:100}function Ar(e){return Or.find(t=>t.value===e).label}function jr(e,t){let n=e.flatMap(e=>{let n=kr(t[e.environmentId]);return n===50?[]:[`${e.label} ${Ar(n).toLowerCase()}`]});return n.length===0?null:n.join(` · `)}function Mr(e){let t=(0,Z.c)(27),{environments:n}=e,r=it(),i=J(),a=at();if(n.length<2)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=er(`load-balancing`),t[0]=o):o=t[0];let{id:c,title:l}=o,u;t[1]!==n||t[2]!==r.loadBalancingEnabled||t[3]!==r.loadBalancingWeights?(u=r.loadBalancingEnabled?jr(n,r.loadBalancingWeights):`Off`,t[1]=n,t[2]=r.loadBalancingEnabled,t[3]=r.loadBalancingWeights,t[4]=u):u=t[4];let d=!i,f;t[5]===a?f=t[6]:(f=e=>a({loadBalancingEnabled:e}),t[5]=a,t[6]=f);let p;t[7]!==r.loadBalancingEnabled||t[8]!==d||t[9]!==f?(p=(0,Q.jsx)(cr,{"aria-label":`Automatically balance load`,checked:r.loadBalancingEnabled,disabled:d,onCheckedChange:f}),t[7]=r.loadBalancingEnabled,t[8]=d,t[9]=f,t[10]=p):p=t[10];let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`New threads in shared projects start on the machine with the most free CPU and memory, weighted by each machine's preference.`}),t[11]=m):m=t[11];let h;if(t[12]!==n||t[13]!==r.loadBalancingEnabled||t[14]!==r.loadBalancingWeights||t[15]!==i||t[16]!==a){let e;t[18]!==r.loadBalancingEnabled||t[19]!==r.loadBalancingWeights||t[20]!==i||t[21]!==a?(e=e=>(0,Q.jsx)(Dr,{kind:s(e.serverConfig),label:e.label,subtitle:Er(e),children:(0,Q.jsxs)(Xe,{items:Or,value:kr(r.loadBalancingWeights[e.environmentId]),disabled:!i||!r.loadBalancingEnabled,onValueChange:t=>{t!==null&&a({loadBalancingWeights:{...r.loadBalancingWeights,[e.environmentId]:t}})},children:[(0,Q.jsx)(Ye,{size:`xs`,className:`w-32`,"aria-label":`${e.label} load preference`,children:(0,Q.jsx)(qe,{})}),(0,Q.jsx)(Je,{align:`end`,alignItemWithTrigger:!1,children:Or.map(Nr)})]})},e.environmentId),t[18]=r.loadBalancingEnabled,t[19]=r.loadBalancingWeights,t[20]=i,t[21]=a,t[22]=e):e=t[22],h=n.map(e),t[12]=n,t[13]=r.loadBalancingEnabled,t[14]=r.loadBalancingWeights,t[15]=i,t[16]=a,t[17]=h}else h=t[17];let g;return t[23]!==u||t[24]!==p||t[25]!==h?(g=(0,Q.jsxs)(fr,{id:c,title:l,summary:u,control:p,children:[m,h]}),t[23]=u,t[24]=p,t[25]=h,t[26]=g):g=t[26],g}function Nr(e){let{value:t,label:n}=e;return(0,Q.jsx)(Ke,{value:t,children:n},t)}var Pr=[{value:`off`,label:`Off`},{value:`read`,label:`Read PRs`},{value:`read-write`,label:`Read and act`}],Fr={"read-write":`read and act`,read:`read PRs`};function Ir(e){let t=[`read-write`,`read`].flatMap(t=>{let n=e.filter(e=>e.permission===t);return n.length===0?[]:[`${n.map(e=>e.label).join(`, `)} ${Fr[t]}`]});return t.length===0?null:t.join(` · `)}function Lr(e){let t=(0,Z.c)(19),{environments:n}=e,r=xe(st.githubRoutingPermissionsValueAtom),i=xe(st.catalogValueAtom),a=mt(st.setGitHubRoutingPermission),[o,c]=(0,$.useState)(!1);if(n.length<2)return null;let l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=er(`github-routing`),t[0]=l):l=t[0];let{id:u,title:d}=l,f;t[1]!==n||t[2]!==r?(f=Ir(n.map(e=>({label:e.label,permission:Me(e.entry,r)})))??`Off`,t[1]=n,t[2]=r,t[3]=f):f=t[3];let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`Machines you trust here can read PR data through each other's GitHub access. Enable both machines. Read and act may use broader permissions than the machine that owns them. This applies only to this device.`}),t[4]=p):p=t[4];let m;if(t[5]!==i||t[6]!==n||t[7]!==r||t[8]!==o||t[9]!==a){let e;t[11]!==i||t[12]!==r||t[13]!==o||t[14]!==a?(e=e=>(0,Q.jsx)(Dr,{kind:s(e.serverConfig),label:e.label,subtitle:Er(e),children:(0,Q.jsxs)(Xe,{items:Pr,value:Me(e.entry,r),disabled:!i.isReady||o||Oe(e.entry)===null,onValueChange:t=>{t!==null&&(c(!0),a({environmentId:e.environmentId,permission:t}).then(e=>{c(!1),e._tag===`Failure`&&q.add({type:`error`,title:`Could not save GitHub routing permission`})}))},children:[(0,Q.jsx)(Ye,{size:`xs`,className:`w-32`,"aria-label":`${e.label} GitHub routing`,children:(0,Q.jsx)(qe,{})}),(0,Q.jsx)(Je,{align:`end`,alignItemWithTrigger:!1,children:Pr.map(Rr)})]})},e.environmentId),t[11]=i,t[12]=r,t[13]=o,t[14]=a,t[15]=e):e=t[15],m=n.map(e),t[5]=i,t[6]=n,t[7]=r,t[8]=o,t[9]=a,t[10]=m}else m=t[10];let h;return t[16]!==f||t[17]!==m?(h=(0,Q.jsxs)(fr,{id:u,title:d,summary:f,children:[p,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}function Rr(e){let{value:t,label:n}=e;return(0,Q.jsx)(Ke,{value:t,children:n},t)}function zr(e){let t=(0,Z.c)(26),{environmentLabel:n,onCancel:r,onConfirm:i}=e,a=Mt(),[o,s]=(0,$.useState)(n);n!==null&&n!==o&&s(n);let c=a.open,l=n!==null,u;t[0]===r?u=t[1]:(u=e=>{e||r()},t[0]=r,t[1]=u);let d;t[2]===o?d=t[3]:(d=(0,Q.jsxs)(Nn,{children:[`Remove `,o,` from this device?`]}),t[2]=o,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(Rn,{children:`This forgets its pairing, credentials, and cached threads here.`}),t[4]=f):f=t[4];let p;t[5]!==r||t[6]!==c?(p=c?(0,Q.jsx)(re,{onClick:()=>{r(),c()},children:`P4 Connect settings`}):`P4 Connect settings`,t[5]=r,t[6]=c,t[7]=p):p=t[7];let m;t[8]===p?m=t[9]:(m=(0,Q.jsxs)(Rn,{children:[`It stays on your P4 Connect account and keeps its host space. Deregister it in`,` `,p,` `,`to free it.`]}),t[8]=p,t[9]=m);let h;t[10]!==d||t[11]!==m?(h=(0,Q.jsxs)(Vn,{children:[d,f,m]}),t[10]=d,t[11]=m,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(tr,{render:(0,Q.jsx)(I,{variant:`outline`}),children:`Cancel`}),t[13]=g):g=t[13];let _;t[14]===i?_=t[15]:(_=(0,Q.jsxs)(zn,{children:[g,(0,Q.jsx)(I,{variant:`destructive`,onClick:i,children:`Remove from this device`})]}),t[14]=i,t[15]=_);let v;t[16]!==h||t[17]!==_?(v=(0,Q.jsxs)(jn,{children:[h,_]}),t[16]=h,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==l||t[20]!==v||t[21]!==u?(y=(0,Q.jsx)(kn,{open:l,onOpenChange:u,children:v}),t[19]=l,t[20]=v,t[21]=u,t[22]=y):y=t[22];let b;return t[23]!==a.portals||t[24]!==y?(b=(0,Q.jsxs)(Q.Fragment,{children:[y,a.portals]}),t[23]=a.portals,t[24]=y,t[25]=b):b=t[25],b}var Br={pairingLinks:[],clientSessions:[]};function Vr(e,t,n){let r=n(t);return[...e.filter(e=>n(e)!==r),t]}function Hr(e,t){switch(t.type){case`snapshot`:return t.payload;case`pairingLinkUpserted`:return{...e,pairingLinks:Vr(e.pairingLinks,t.payload,e=>e.id)};case`pairingLinkRemoved`:return{...e,pairingLinks:e.pairingLinks.filter(e=>e.id!==t.payload.id)};case`clientUpserted`:return{...e,clientSessions:Vr(e.clientSessions,t.payload,e=>e.sessionId)};case`clientRemoved`:return{...e,clientSessions:e.clientSessions.filter(e=>e.sessionId!==t.payload.sessionId)}}}function Ur(e,t){let n=Hr(e,t);return[n,[{version:1,revision:t.revision,type:`snapshot`,payload:n}]]}function Wr(e){return{accessChanges:De(e,{label:`environment-data:server:auth-access-changes`,subscribe:e=>Ie(C.subscribeAuthAccess,{}).pipe(g(()=>Br,Ur))})}}var Gr=Wr(G),Kr=3e4,qr=class extends R()(`DesktopNetworkAccessUnavailableError`,{}){get message(){return`Desktop network access is unavailable.`}},Jr=class extends R()(`DesktopServerExposureStateLoadError`,{cause:T()}){get message(){return`Failed to load desktop server exposure state.`}},Yr=class extends R()(`DesktopAdvertisedEndpointsLoadError`,{cause:T()}){get message(){return`Failed to load advertised desktop endpoints.`}};function Xr(){return typeof window>`u`?void 0:window.desktopBridge}function Zr(e){let t=y(`loadDesktopNetworkAccess`)(function*(){let t=e();if(!t)return yield*new qr;let[n,r]=yield*F([ie({try:()=>t.getServerExposureState(),catch:e=>new Jr({cause:e})}),ie({try:()=>t.getAdvertisedEndpoints(),catch:e=>new Yr({cause:e})})],{concurrency:`unbounded`});return{advertisedEndpoints:r,serverExposureState:n}});return P(t()).pipe(z({staleTime:Kr,revalidateOnMount:!0}),se,pe(`desktop:network-access`))}var Qr=Zr(Xr);function $r(){A.refresh(Qr)}function ei(e,t){let n=t.trim().toLowerCase();if(n.length===0)return e;let r=[],i=[];for(let t of e){let e=t.alias.toLowerCase();e.startsWith(n)?r.push(t):e.includes(n)&&i.push(t)}return[...r,...i]}var ti=class extends R()(`DesktopSshDiscoveryUnavailableError`,{}){get message(){return`Desktop SSH host discovery is unavailable.`}},ni=class extends R()(`DesktopSshDiscoveryError`,{cause:T()}){get message(){return`Failed to discover SSH hosts.`}};function ri(){return typeof window>`u`?void 0:window.desktopBridge}function ii(e){let t=y(`discoverDesktopSshHosts`)(function*(){let t=e();return t?yield*ie({try:()=>t.discoverSshHosts(),catch:e=>new ni({cause:e})}):yield*new ti});return P(t()).pipe(z({staleTime:3e4,revalidateOnMount:!0}),se,pe(`desktop:ssh-hosts`))}var ai=ii(ri),oi=443,si=[],ci=[],li=`backend:default-wsl`,ui=`backend:wsl-off`,di=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function fi(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:di.format(t)}function pi(e){let t=(0,Z.c)(13),{scopes:n,label:r}=e,i=`${n.length} ${n.length===1?`scope`:`scopes`}`,a=`${r}: show ${i}`,o;t[0]===a?o=t[1]:(o=(0,Q.jsx)(`button`,{type:`button`,"aria-label":a,className:`cursor-help underline decoration-border underline-offset-2 outline-hidden hover:text-foreground focus-visible:text-foreground`}),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==o?(s=(0,Q.jsx)(Wt,{openOnHover:!0,delay:250,closeDelay:100,render:o,children:i}),t[2]=i,t[3]=o,t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{className:`mb-1 font-medium`,children:`Granted scopes`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=n.map(mi),t[6]=n,t[7]=l);let u;t[8]===l?u=t[9]:(u=(0,Q.jsxs)(Ut,{side:`top`,align:`start`,tooltipStyle:!0,className:`w-max max-w-80 whitespace-normal`,children:[c,(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l})]}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Gt,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function mi(e){return(0,Q.jsx)(`code`,{className:`font-mono text-foreground/85`,children:e},e)}function hi(e){let t=e.host.trim();if(t.length===0)throw Error(`SSH host or alias is required.`);let n=t,r=e.username.trim()||null,i=null,a=n.lastIndexOf(`@`);if(a>0){let e=n.slice(0,a).trim();n=n.slice(a+1).trim(),!r&&e.length>0&&(r=e)}let o=/^\[([^\]]+)\](?::(\d+))?$/u.exec(n);if(o)n=o[1].trim(),o[2]&&(i=Number.parseInt(o[2],10));else{let e=n.split(`:`);e.length===2&&/^\d+$/u.test(e[1]??``)&&(n=e[0].trim(),i=Number.parseInt(e[1],10))}let s=e.port.trim();if(s.length>0&&(i=Number.parseInt(s,10)),n.length===0)throw Error(`SSH host or alias is required.`);if(i!==null&&(!Number.isInteger(i)||i<=0||i>65535))throw Error(`SSH port must be between 1 and 65535.`);return{alias:n,hostname:n,username:r,port:i}}function gi(e){let t=e.trim();if(!t)return null;try{let e=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//u.test(t)||t.startsWith(`//`)?t:`https://${t}`,n=new URL(e,window.location.origin),r=ze(n);if(r)return{host:r.host,pairingCode:r.token};let i=Ge(n);return i?{host:n.origin,pairingCode:i}:null}catch{return null}}function _i(e){let t=gi(e.host);if(t)return t;let n=e.host.trim(),r=e.pairingCode.trim();if(!n)throw Error(`Enter a backend host.`);if(!r)throw Error(`Enter a pairing code.`);return{host:n,pairingCode:r}}function vi(e){let t=`Failed to connect SSH host.`;return(e instanceof Error?e.message:t).replace(/^Error invoking remote method 'desktop:ensure-ssh-environment':\s*/u,``).replace(/^Ssh[A-Za-z]+Error:\s*/u,``).trim()||t}var yi=`first:rounded-t-xl last:rounded-b-xl px-3 py-2.5 sm:px-4`;function bi(e){return Ln}function xi(e,t){return e===`endpoint-rail`?ye(`relative first:rounded-t-xl last:rounded-b-xl px-3 py-3 sm:px-4`,!t&&`bg-muted/15`):ye(yi,!t&&`bg-muted/24`)}function Si(e){return[...e].toSorted((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())}function Ci(e,t){return[`${e.length} ${e.length===1?`client`:`clients`}`,t.length>0?`${t.length} ${t.length===1?`pairing link`:`pairing links`}`:null].filter(e=>e!==null).join(` · `)}function wi(e){return[...e].toSorted((e,t)=>e.current===t.current?e.connected===t.connected?new Date(t.issuedAt).getTime()-new Date(e.issuedAt).getTime():e.connected?-1:1:e.current?-1:1)}function Ti(e){return{...e,scopes:e.permissions??e.scopes,createdAt:B(e.createdAt),expiresAt:B(e.expiresAt)}}function Ei(e){return{...e,scopes:e.permissions??e.scopes,issuedAt:B(e.issuedAt),expiresAt:B(e.expiresAt),lastConnectedAt:e.lastConnectedAt===null?null:B(e.lastConnectedAt)}}function Di(e,t){let n=e.filter(e=>e.status!==`unavailable`);if(t){let e=n.find(e=>ki(e)===t);if(e)return e}return n.find(e=>e.isDefault)??n.find(e=>e.reachability!==`loopback`)??n.find(e=>e.compatibility.hostedHttpsApp===`compatible`)??null}function Oi(e){return e.id.startsWith(`tailscale-magicdns:`)}function ki(e){if(e.id.startsWith(`desktop-loopback:`))return`desktop-core:loopback:http`;if(e.id.startsWith(`desktop-lan:`))return`desktop-core:lan:http`;if(e.id.startsWith(`tailscale-ip:`))return`tailscale:ip:http`;if(Oi(e))return`tailscale:magicdns:https`;let t=`unknown`;try{t=new URL(e.httpBaseUrl).protocol.replace(/:$/u,``)}catch{}return`${e.provider.id}:${e.reachability}:${t}:${e.label}`}function Ai(e,t){return e.compatibility.hostedHttpsApp===`compatible`?gr(e.httpBaseUrl,t)??hr(e.httpBaseUrl,t):hr(e.httpBaseUrl,t)}function ji(e){let t=new URL(`/pair`,window.location.href);return He(t,e).toString()}function Mi(e){try{let t=new URL(e);return t.pathname===`/pair`&&t.searchParams.has(`host`)}catch{return!1}}function Ni(e,t){if(Mi(t))return`Opens the hosted app, no install needed`;switch(e.reachability){case`lan`:return`Devices on the same network`;case`private-network`:return`Devices on your private network`;case`public`:return`Reachable from anywhere`;case`loopback`:return`Clients on this machine`}}var Pi=(0,$.memo)(function(e){let t=(0,Z.c)(135),{pairingLink:n,credential:r,endpointUrl:i,endpoints:a,defaultEndpointKey:o,presentation:s,revokingPairingLinkId:c,onRevoke:l,canRevoke:u}=e,d=s===void 0?`current`:s,f=pn(1e3),p=new Date(n.expiresAt).getTime(),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(!1),[y,b]=(0,$.useState)(null),x=(0,$.useId)(),S;t[0]===r?S=t[1]:(S=r?ji(r):null,t[0]=r,t[1]=S);let C=S,w;t[2]!==r||t[3]!==i?(w=r&&i!=null&&i!==``?gr(i,r):null,t[2]=r,t[3]=i,t[4]=w):w=t[4];let T=w,E;if(t[5]!==r||t[6]!==o||t[7]!==a){let e=Di(a,o);E=e&&r?Ai(e,r):null,t[5]=r,t[6]=o,t[7]=a,t[8]=E}else E=t[8];let D=E,O;if(t[9]!==r||t[10]!==a){bb0:{let e=[];if(!r){O=e;break bb0}for(let t of a){if(t.status===`unavailable`)continue;let n=Ai(t,r);e.push({id:t.id,preferenceKey:ki(t),label:t.label,url:n,detail:Ni(t,n),qrShareable:ar(t)})}O=e}t[9]=r,t[10]=a,t[11]=O}else O=t[11];let k=O,A;t[12]!==r||t[13]!==C||t[14]!==D||t[15]!==i||t[16]!==T?(A=D??(r&&i!=null&&i!==``?T??hr(i,r):Re(window.location.hostname)?null:C),t[12]=r,t[13]=C,t[14]=D,t[15]=i,t[16]=T,t[17]=A):A=t[17];let j=A,[M,N]=(0,$.useState)(null),P=M??j??r??``,F=P!==r,ee=F&&Mi(P),te=k.find(e=>e.url===P)?.qrShareable??!0,ne=typeof window<`u`&&window.isSecureContext&&navigator.clipboard?.writeText!=null,re;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(re={onCopy:ra,onError:(e,t)=>{let{value:n,kind:r}=t;N(n),h(!0),q.add(Y({type:`error`,title:ne?r===`hosted-link`?`Could not copy hosted app link`:r===`link`?`Could not copy pairing URL`:`Could not copy pairing code`:`Clipboard copy unavailable`,description:ne?e.message:`Showing the full value instead.`}))}},t[18]=re):re=t[18];let{copyToClipboard:ie}=Ze(re),ae;t[19]===ie?ae=t[20]:(ae=(e,t)=>{ie(e,{value:e,kind:t})},t[19]=ie,t[20]=ae);let oe=ae,se=ia,ce;t[21]!==oe||t[22]!==r?(ce=()=>{r&&oe(r,`code`)},t[21]=oe,t[22]=r,t[23]=ce):ce=t[23];let le=ce,ue;t[24]===n.expiresAt?ue=t[25]:(ue=fi(n.expiresAt),t[24]=n.expiresAt,t[25]=ue);let de=ue,fe=n.label??`Pairing link`,L;t[26]!==o||t[27]!==k||t[28]!==y?(L=qn(k,y,o),t[26]=o,t[27]=k,t[28]=y,t[29]=L):L=t[29];let pe=L,me=pe?.url??j,he=pe?.qrShareable??!0;if(p<=f)return null;let ge;t[30]===d?ge=t[31]:(ge=bi(d),t[30]=d,t[31]=ge);let _e;t[32]===n.createdAt?_e=t[33]:(_e=fi(n.createdAt),t[32]=n.createdAt,t[33]=_e);let R=`Link created at ${_e}`,ve;t[34]===R?ve=t[35]:(ve=(0,Q.jsx)(xn,{tooltipText:R,dotClassName:`bg-warning`}),t[34]=R,t[35]=ve);let be;t[36]===fe?be=t[37]:(be=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:fe}),t[36]=fe,t[37]=be);let xe;t[38]!==ve||t[39]!==be?(xe=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[ve,be]}),t[38]=ve,t[39]=be,t[40]=xe):xe=t[40];let Se;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Q.jsx)(`span`,{}),t[41]=Se):Se=t[41];let Ce;t[42]!==f||t[43]!==n.expiresAt?(Ce=ht(n.expiresAt,f),t[42]=f,t[43]=n.expiresAt,t[44]=Ce):Ce=t[44];let z;t[45]===Ce?z=t[46]:(z=(0,Q.jsx)(_t,{render:Se,children:Ce}),t[45]=Ce,t[46]=z);let B;t[47]===de?B=t[48]:(B=(0,Q.jsx)(vt,{side:`top`,children:de}),t[47]=de,t[48]=B);let we;t[49]!==z||t[50]!==B?(we=(0,Q.jsxs)(yt,{children:[z,B]}),t[49]=z,t[50]=B,t[51]=we):we=t[51];let Te;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `}),t[52]=Te):Te=t[52];let V;t[53]===n.scopes?V=t[54]:(V=(0,Q.jsx)(pi,{scopes:n.scopes,label:`Pairing link scopes`}),t[53]=n.scopes,t[54]=V);let Ee;t[55]!==we||t[56]!==V?(Ee=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[we,Te,V]}),t[55]=we,t[56]=V,t[57]=Ee):Ee=t[57];let De;t[58]!==r||t[59]!==j?(De=r?j===null?(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Copy the token and pair from another client using this backend's reachable host.`}):null:(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Create a new link to share from this client.`}),t[58]=r,t[59]=j,t[60]=De):De=t[60];let Oe;t[61]!==xe||t[62]!==Ee||t[63]!==De?(Oe=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[xe,Ee,De]}),t[61]=xe,t[62]=Ee,t[63]=De,t[64]=Oe):Oe=t[64];let ke;t[65]!==g||t[66]!==x||t[67]!==j?(ke=j&&ne?(0,Q.jsxs)(I,{size:`xs`,variant:`outline`,"aria-expanded":g,"aria-controls":x,onClick:()=>_(aa),children:[(0,Q.jsx)(v,{"aria-hidden":!0}),`Share`]}):null,t[65]=g,t[66]=x,t[67]=j,t[68]=ke):ke=t[68];let Ae=r!==void 0&&m,je;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>{h(e),e||N(null)},t[69]=je):je=t[69];let Me;t[70]!==r||t[71]!==le||t[72]!==j?(Me=r?ne?j?null:(0,Q.jsx)(I,{size:`xs`,variant:`outline`,onClick:le,children:`Copy code`}):(0,Q.jsx)(Et,{render:(0,Q.jsx)(I,{size:`xs`,variant:`outline`}),children:j?`Show link`:`Show code`}):null,t[70]=r,t[71]=le,t[72]=j,t[73]=Me):Me=t[73];let Ne=F?ee?`Hosted app pairing link`:`Pairing link`:`Pairing code`,H;t[74]===Ne?H=t[75]:(H=(0,Q.jsx)(wt,{children:Ne}),t[74]=Ne,t[75]=H);let U=F?ee?`Clipboard copy is unavailable here. Open or manually copy this hosted app link on the device you want to connect.`:`Clipboard copy is unavailable here. Open or manually copy this full pairing URL on the device you want to connect.`:`Clipboard copy is unavailable here. Manually copy this code into another client.`,Pe;t[76]===U?Pe=t[77]:(Pe=(0,Q.jsx)(kt,{children:U}),t[76]=U,t[77]=Pe);let Fe;t[78]!==H||t[79]!==Pe?(Fe=(0,Q.jsxs)(Ct,{children:[H,Pe]}),t[78]=H,t[79]=Pe,t[80]=Fe):Fe=t[80];let Ie=F?4:3,Le;t[81]!==P||t[82]!==Ie?(Le=(0,Q.jsx)(bt,{readOnly:!0,value:P,rows:Ie,onFocus:oa,onClick:sa}),t[81]=P,t[82]=Ie,t[83]=Le):Le=t[83];let ze;t[84]!==te||t[85]!==F||t[86]!==P?(ze=F&&te?(0,Q.jsx)(`div`,{className:`flex justify-center rounded-xl border border-border/60 bg-muted/30 p-4`,children:(0,Q.jsx)(Un,{value:P,size:132,level:`M`,marginSize:2,title:`Pairing link — scan to open on another device`})}):null,t[84]=te,t[85]=F,t[86]=P,t[87]=ze):ze=t[87];let Be;t[88]!==Le||t[89]!==ze?(Be=(0,Q.jsxs)(Ot,{children:[Le,ze]}),t[88]=Le,t[89]=ze,t[90]=Be):Be=t[90];let Ve;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,Q.jsx)(I,{variant:`outline`,onClick:()=>h(!1),children:`Done`}),t[91]=Ve):Ve=t[91];let He;t[92]===le?He=t[93]:(He=ne?(0,Q.jsx)(I,{variant:`outline`,onClick:le,children:`Copy code`}):null,t[92]=le,t[93]=He);let Ue;t[94]===He?Ue=t[95]:(Ue=(0,Q.jsxs)(Tt,{variant:`bare`,children:[Ve,He]}),t[94]=He,t[95]=Ue);let W;t[96]!==Fe||t[97]!==Be||t[98]!==Ue?(W=(0,Q.jsxs)(At,{className:`max-w-md`,children:[Fe,Be,Ue]}),t[96]=Fe,t[97]=Be,t[98]=Ue,t[99]=W):W=t[99];let We;t[100]!==Ae||t[101]!==Me||t[102]!==W?(We=(0,Q.jsxs)(jt,{open:Ae,onOpenChange:je,children:[Me,W]}),t[100]=Ae,t[101]=Me,t[102]=W,t[103]=We):We=t[103];let Ge=!u||c===n.id,G;t[104]!==l||t[105]!==n.id?(G=()=>void l(n.id),t[104]=l,t[105]=n.id,t[106]=G):G=t[106];let Ke=c===n.id?`Revoking…`:`Revoke`,qe;t[107]!==Ge||t[108]!==G||t[109]!==Ke?(qe=(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,disabled:Ge,onClick:G,children:Ke}),t[107]=Ge,t[108]=G,t[109]=Ke,t[110]=qe):qe=t[110];let Je;t[111]!==ke||t[112]!==We||t[113]!==qe?(Je=(0,Q.jsxs)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:[ke,We,qe]}),t[111]=ke,t[112]=We,t[113]=qe,t[114]=Je):Je=t[114];let Ye;t[115]!==Oe||t[116]!==Je?(Ye=(0,Q.jsxs)(`div`,{className:or,children:[Oe,Je]}),t[115]=Oe,t[116]=Je,t[117]=Ye):Ye=t[117];let Xe=g&&me!==null,K;t[118]!==he||t[119]!==oe||t[120]!==k||t[121]!==le||t[122]!==me||t[123]!==x||t[124]!==pe?.id?(K=me===null?null:(0,Q.jsxs)(`div`,{id:x,className:`mt-3 flex flex-col gap-4 border-t border-border/50 pt-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[k.length>1?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,role:`radiogroup`,"aria-label":`Endpoint the pairing QR code and URL use`,children:[(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Reach this machine via`}),k.map(e=>{let t=e.id===pe?.id;return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:ye(`flex w-full items-baseline gap-2 rounded-lg border px-2.5 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,t?`border-foreground/60 bg-muted/30`:`border-border/50 hover:bg-muted/20`),onClick:()=>b(e.id),children:[(0,Q.jsx)(`span`,{className:ye(`text-xs font-medium`,t?`text-foreground`:`text-muted-foreground`),children:e.label}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-2xs text-muted-foreground/70`,children:e.detail})]},e.id)})]}):null,(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-muted/30 px-2.5 py-1.5`,children:[(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-2xs text-muted-foreground`,children:me})}),(0,Q.jsx)(vt,{side:`top`,children:me})]}),(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,className:`shrink-0`,onClick:()=>oe(me,se(me)),children:`Copy link`})]}),(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,onClick:le,children:`Copy code only`})]}),he?(0,Q.jsx)(`div`,{className:`w-fit shrink-0 self-center rounded-xl bg-white p-3 sm:self-start`,children:(0,Q.jsx)(Un,{value:me,size:168,level:`M`,marginSize:1,title:`Pairing link — scan to open on another device`})}):(0,Q.jsx)(`div`,{className:`flex size-[192px] shrink-0 items-center justify-center self-center rounded-xl border border-border/50 p-4 sm:self-start`,children:(0,Q.jsx)(`p`,{className:`text-center text-2xs text-muted-foreground/70`,children:`No QR for this endpoint. Another device scanning a loopback link would dial itself; copy the URL for use on this machine instead.`})})]}),t[118]=he,t[119]=oe,t[120]=k,t[121]=le,t[122]=me,t[123]=x,t[124]=pe?.id,t[125]=K):K=t[125];let Qe;t[126]===K?Qe=t[127]:(Qe=(0,Q.jsx)(Xn,{children:K}),t[126]=K,t[127]=Qe);let $e;t[128]!==Xe||t[129]!==Qe?($e=(0,Q.jsx)(Qn,{open:Xe,children:Qe}),t[128]=Xe,t[129]=Qe,t[130]=$e):$e=t[130];let et;return t[131]!==ge||t[132]!==Ye||t[133]!==$e?(et=(0,Q.jsxs)(`div`,{className:ge,children:[Ye,$e]}),t[131]=ge,t[132]=Ye,t[133]=$e,t[134]=et):et=t[134],et}),Fi=(0,$.memo)(function(e){let t=(0,Z.c)(54),{clientSession:n,presentation:r,revokingClientSessionId:i,onRevokeSession:a,canRevoke:o}=e,s=r===void 0?`current`:r,c=pn(1e3),l=n.current||n.connected,u=n.lastConnectedAt,d;t[0]!==l||t[1]!==u||t[2]!==c?(d=l?u?`Connected for ${gt(u,c)}`:`Connected`:u?`Last connected at ${fi(u)}`:`Not connected yet.`,t[0]=l,t[1]=u,t[2]=c,t[3]=d):d=t[3];let f=d,p;t[4]===n.client.deviceType?p=t[5]:(p=n.client.deviceType===`unknown`?null:n.client.deviceType[0]?.toUpperCase()+n.client.deviceType.slice(1),t[4]=n.client.deviceType,t[5]=p);let m=n.client.os??null,h=n.client.browser??null,g=n.client.ipAddress??null,_;t[6]!==p||t[7]!==m||t[8]!==h||t[9]!==g?(_=[p,m,h,g].filter(ca),t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_):_=t[10];let v=_,y;t[11]!==n.client.browser||t[12]!==n.client.label||t[13]!==n.client.os||t[14]!==n.subject?(y=n.client.label??([n.client.os,n.client.browser].filter(Boolean).join(` · `)||n.subject),t[11]=n.client.browser,t[12]=n.client.label,t[13]=n.client.os,t[14]=n.subject,t[15]=y):y=t[15];let b=y,x;t[16]===s?x=t[17]:(x=bi(s),t[16]=s,t[17]=x);let S=l?`bg-success`:`bg-muted-foreground/30`,C=l?`bg-success/60 duration-2000`:null,w;t[18]!==f||t[19]!==S||t[20]!==C?(w=(0,Q.jsx)(xn,{tooltipText:f,dotClassName:S,pingClassName:C}),t[18]=f,t[19]=S,t[20]=C,t[21]=w):w=t[21];let T;t[22]===b?T=t[23]:(T=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:b}),t[22]=b,t[23]=T);let E;t[24]===n.current?E=t[25]:(E=n.current?(0,Q.jsx)(`span`,{className:`text-3xs text-muted-foreground/80 rounded-md border border-border/50 bg-muted/50 px-1 py-0.5`,children:`This device`}):null,t[24]=n.current,t[25]=E);let D;t[26]!==w||t[27]!==T||t[28]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[w,T,E]}),t[26]=w,t[27]=T,t[28]=E,t[29]=D):D=t[29];let O;t[30]===v?O=t[31]:(O=v.length>0?(0,Q.jsxs)(Q.Fragment,{children:[v.join(` · `),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `})]}):null,t[30]=v,t[31]=O);let k;t[32]===n.scopes?k=t[33]:(k=(0,Q.jsx)(pi,{scopes:n.scopes,label:`Client scopes`}),t[32]=n.scopes,t[33]=k);let A;t[34]!==O||t[35]!==k?(A=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[O,k]}),t[34]=O,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==D||t[38]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[D,A]}),t[37]=D,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==o||t[41]!==n.current||t[42]!==n.sessionId||t[43]!==a||t[44]!==i?(M=n.current?null:(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,disabled:!o||i===n.sessionId,onClick:()=>void a(n.sessionId),children:i===n.sessionId?`Revoking…`:`Revoke`}),t[40]=o,t[41]=n.current,t[42]=n.sessionId,t[43]=a,t[44]=i,t[45]=M):M=t[45];let N;t[46]===M?N=t[47]:(N=(0,Q.jsx)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:M}),t[46]=M,t[47]=N);let P;t[48]!==j||t[49]!==N?(P=(0,Q.jsxs)(`div`,{className:or,children:[j,N]}),t[48]=j,t[49]=N,t[50]=P):P=t[50];let F;return t[51]!==P||t[52]!==x?(F=(0,Q.jsx)(`div`,{className:x,children:P}),t[51]=P,t[52]=x,t[53]=F):F=t[53],F}),Ii=(0,$.memo)(function({onPairingLinkCreated:e,clientSessions:t,isRevokingOtherClients:n,onRevokeOtherClients:r,delegatableScopes:i}){let a=tt(),[o,s]=(0,$.useState)(!1),[c,u]=(0,$.useState)(``),[d,p]=(0,$.useState)([...ne]),m=d.filter(e=>i.includes(e)),[h,g]=(0,$.useState)(!1),_=(0,$.useCallback)(async()=>{if(a!==null&&m.length!==0&&dt(a,`access:write`)&&m.every(e=>dt(a,e))){g(!0);try{e(await Cn({label:c,scopes:m})),u(``),p(ne.filter(e=>i.includes(e))),s(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to create pairing URL.`;q.add(Y({type:`error`,title:`Could not create pairing URL`,description:t}))}finally{g(!1)}}},[i,e,c,a,m]),v=(0,$.useCallback)((e,t)=>{p(n=>Kn(n,e,t))},[]);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,disabled:n||!In(t),onClick:()=>void r(),children:n?`Revoking…`:`Revoke others`}),(0,Q.jsxs)(jt,{open:o,onOpenChange:e=>{s(e),e||(u(``),p(ne.filter(e=>i.includes(e))))},children:[(0,Q.jsx)(Et,{render:(0,Q.jsxs)(I,{size:`xs`,variant:`default`,children:[(0,Q.jsx)(f,{className:`size-3`}),`Create link`]})}),(0,Q.jsxs)(At,{className:`max-w-md`,children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(wt,{children:`Create pairing link`}),(0,Q.jsx)(kt,{children:`Generate a one-time link that another device can use to pair with this backend as an authorized client.`})]}),(0,Q.jsxs)(Ot,{children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Client label (optional)`}),(0,Q.jsx)(xt,{value:c,onChange:e=>u(e.target.value),placeholder:`e.g. Living room iPad`,disabled:h,autoFocus:!0})]}),(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-xs font-medium text-foreground`,children:`Permissions`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Limit what the paired client can do.`})]}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(I,{size:`xs`,variant:`outline`,disabled:h,onClick:()=>p([me,l,Te,fe].filter(e=>i.includes(e))),children:`Read only`}),(0,Q.jsx)(I,{size:`xs`,variant:`outline`,disabled:h,onClick:()=>p(ne.filter(e=>i.includes(e))),children:`Standard`})]})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-border/60 rounded-lg border border-input bg-muted/25`,children:pr.filter(({scope:e})=>i.includes(e)).map(({scope:e,title:t,description:n})=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-3 py-2.5 transition-colors hover:bg-muted/40`,children:[(0,Q.jsx)(Kt,{className:`mt-0.5`,checked:d.includes(e),disabled:h,onCheckedChange:t=>v(e,t===!0)}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-xs font-medium text-foreground`,children:t}),(0,Q.jsx)(`span`,{className:`block text-xs leading-snug text-muted-foreground`,children:n})]})]},e))}),m.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:`Select at least one permission.`}):m.includes(`access:write`)?(0,Q.jsx)(`p`,{className:`text-xs text-warning`,children:`This client can create or revoke access for other devices.`}):null]})]}),(0,Q.jsxs)(Tt,{variant:`bare`,children:[(0,Q.jsx)(I,{variant:`outline`,disabled:h,onClick:()=>s(!1),children:`Cancel`}),(0,Q.jsx)(I,{disabled:h||m.length===0,onClick:()=>void _(),children:h?`Creating…`:`Create link`})]})]})]})]})}),Li=(0,$.memo)(function(e){let t=(0,Z.c)(39),{endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:a,isLoading:o,pairingLinks:s,createdPairingCredentials:c,clientSessions:l,revokingPairingLinkId:u,revokingClientSessionId:d,onRevokePairingLink:f,onRevokeClientSession:p,canRevoke:m}=e,h=a===void 0?`current`:a,g;if(t[0]!==m||t[1]!==c||t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==f||t[6]!==s||t[7]!==h||t[8]!==u){let e;t[10]!==m||t[11]!==c||t[12]!==i||t[13]!==n||t[14]!==r||t[15]!==f||t[16]!==h||t[17]!==u?(e=e=>(0,Q.jsx)(Pi,{pairingLink:e,credential:c.get(e.id),endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:h,revokingPairingLinkId:u,onRevoke:f,canRevoke:m},e.id),t[10]=m,t[11]=c,t[12]=i,t[13]=n,t[14]=r,t[15]=f,t[16]=h,t[17]=u,t[18]=e):e=t[18],g=s.map(e),t[0]=m,t[1]=c,t[2]=i,t[3]=n,t[4]=r,t[5]=f,t[6]=s,t[7]=h,t[8]=u,t[9]=g}else g=t[9];let _;if(t[19]!==m||t[20]!==l||t[21]!==p||t[22]!==h||t[23]!==d){let e;t[25]!==m||t[26]!==p||t[27]!==h||t[28]!==d?(e=e=>(0,Q.jsx)(Fi,{clientSession:e,presentation:h,revokingClientSessionId:d,onRevokeSession:p,canRevoke:m},e.sessionId),t[25]=m,t[26]=p,t[27]=h,t[28]=d,t[29]=e):e=t[29],_=l.map(e),t[19]=m,t[20]=l,t[21]=p,t[22]=h,t[23]=d,t[24]=_}else _=t[24];let v;t[30]!==l.length||t[31]!==o||t[32]!==s.length||t[33]!==h?(v=s.length===0&&l.length===0&&!o?(0,Q.jsx)(`div`,{className:bi(h),children:(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:`No pairing links or client sessions.`})}):null,t[30]=l.length,t[31]=o,t[32]=s.length,t[33]=h,t[34]=v):v=t[34];let y;return t[35]!==g||t[36]!==_||t[37]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[g,_,v]}),t[35]=g,t[36]=_,t[37]=v,t[38]=y):y=t[38],y}),Ri=(0,$.memo)(function(e){let t=(0,Z.c)(50),{endpoint:n,isDefault:r,presentation:i,onSetDefault:a,onSetupTailscaleServe:o,onDisableTailscaleServe:s,isUpdatingTailscaleServe:c}=e,l=i===void 0?`current`:i,u=n.status===`available`,d;t[0]===n?d=t[1]:(d=Oi(n)&&n.status!==`available`,t[0]=n,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=Oi(n)&&n.status===`available`,t[2]=n,t[3]=p);let m=p,h=!f,g=l===`endpoint-rail`,_;t[4]!==u||t[5]!==l?(_=xi(l,u),t[4]=u,t[5]=l,t[6]=_):_=t[6];let v;t[7]!==r||t[8]!==g?(v=g&&r?(0,Q.jsx)(`span`,{className:`absolute inset-y-2 left-0 w-1 rounded-r-full bg-primary`,"aria-hidden":!0}):null,t[7]=r,t[8]=g,t[9]=v):v=t[9];let y;t[10]===n.label?y=t[11]:(y=(0,Q.jsx)(`h3`,{className:`shrink-0 text-sm leading-5 font-medium text-foreground`,children:n.label}),t[10]=n.label,t[11]=y);let b;t[12]!==n.httpBaseUrl||t[13]!==h?(b=h?(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-xs leading-5 text-muted-foreground`,children:n.httpBaseUrl})}),(0,Q.jsx)(vt,{side:`top`,children:n.httpBaseUrl})]}):null,t[12]=n.httpBaseUrl,t[13]=h,t[14]=b):b=t[14];let x;t[15]===u?x=t[16]:(x=u?null:(0,Q.jsx)(`span`,{className:`shrink-0 rounded-md border border-border/70 px-1 py-0.5 text-3xs text-muted-foreground`,children:`Setup required`}),t[15]=u,t[16]=x);let S;t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-3`,children:[y,b,x]}),t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20];let C;t[21]===r?C=t[22]:(C=r?(0,Q.jsx)(`span`,{className:`rounded-md border border-primary/30 bg-primary/10 px-1 py-0.5 text-3xs text-primary`,children:`Default`}):null,t[21]=r,t[22]=C);let w;t[23]!==n||t[24]!==c||t[25]!==f||t[26]!==o?(w=f?(0,Q.jsx)(I,{size:`xs`,variant:`outline`,onClick:()=>o(n),disabled:c,children:c?`Restarting…`:`Setup`}):null,t[23]=n,t[24]=c,t[25]=f,t[26]=o,t[27]=w):w=t[27];let T;t[28]!==m||t[29]!==n||t[30]!==c||t[31]!==s?(T=m?(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,onClick:()=>s(n),disabled:c,children:c?`Restarting…`:`Disable`}):null,t[28]=m,t[29]=n,t[30]=c,t[31]=s,t[32]=T):T=t[32];let E;t[33]!==n||t[34]!==r||t[35]!==f||t[36]!==a?(E=!f&&!r?(0,Q.jsx)(I,{size:`xs`,variant:`outline`,onClick:()=>a(n),children:`Set as default`}):null,t[33]=n,t[34]=r,t[35]=f,t[36]=a,t[37]=E):E=t[37];let D;t[38]!==C||t[39]!==w||t[40]!==T||t[41]!==E?(D=(0,Q.jsxs)(`div`,{className:`ml-auto flex min-h-6 shrink-0 items-center justify-end gap-2`,children:[C,w,T,E]}),t[38]=C,t[39]=w,t[40]=T,t[41]=E,t[42]=D):D=t[42];let O;t[43]!==D||t[44]!==S?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-6 min-w-0 flex-col gap-2 sm:-my-0.5 sm:flex-row sm:items-center`,children:[S,D]}),t[43]=D,t[44]=S,t[45]=O):O=t[45];let k;return t[46]!==O||t[47]!==_||t[48]!==v?(k=(0,Q.jsxs)(`div`,{className:_,children:[v,O]}),t[46]=O,t[47]=_,t[48]=v,t[49]=k):k=t[49],k});function zi(e){let t=(0,Z.c)(14),{endpoint:n,hiddenEndpointCount:r,expanded:i,onToggleExpanded:a,fallback:o}=e;if(!n)return o;let s;t[0]===n.httpBaseUrl?s=t[1]:(s=(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:n.httpBaseUrl}),t[0]=n.httpBaseUrl,t[1]=s);let c;t[2]!==i||t[3]!==r?(c=r>0?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:i?`Hide`:`+${r}`}):null,t[2]=i,t[3]=r,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[s,c]}),t[5]=s,t[6]=c,t[7]=l):l=t[7];let u=l,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Reachable at`}),t[8]=d):d=t[8];let f;return t[9]!==i||t[10]!==r||t[11]!==a||t[12]!==u?(f=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-1`,children:[d,r>0?(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex min-w-0 max-w-full items-baseline gap-2 border-b border-dotted border-muted-foreground/60 text-left text-muted-foreground underline-offset-4 hover:border-foreground hover:text-foreground`,onClick:a,"aria-expanded":i,children:u}):(0,Q.jsx)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-2`,children:u})]}),t[9]=i,t[10]=r,t[11]=a,t[12]=u,t[13]=f):f=t[13],f}function Bi(e){if(!e.entry.enabled&&e.connection.phase!==`unsupported`)return{text:`Off`,tone:`muted`};let{connection:t}=e;switch(t.phase){case`connected`:return{text:`Connected`,tone:`muted`};case`connecting`:return{text:`Connecting`,tone:`muted`};case`reconnecting`:return{text:t.error?`Reconnecting: ${t.error}`:`Reconnecting`,tone:`error`};case`unsupported`:return{text:`Client not supported`,tone:`muted`};case`error`:return{text:t.error?`Connection failed: ${t.error}`:`Connection failed`,tone:`error`};case`offline`:return{text:`Offline`,tone:`muted`};case`available`:return{text:`Not connected`,tone:`muted`}}}function Vi(e){let t=(0,Z.c)(177),{environment:n,removingEnvironmentId:r,onSetEnabled:i,onRemove:o,onAddRoute:c}=e,[l,u]=(0,$.useState)(!1),[d,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(!1),h=n.environmentId,g=n.connection.phase===`unsupported`,_=n.entry.enabled&&!g,v=n.connection.phase===`connected`,y=r===h,b=n.connection.traceId,x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x={target:`trace ID`,onCopy:Xi,onError:Yi},t[0]=x):x=t[0];let{copyToClipboard:S}=Ze(x),C;t[1]===S?C=t[2]:(C=e=>{S(e,{traceId:e})},t[1]=S,t[2]=C);let w=C,T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T={target:`MCP URL`,onCopy:Ji,onError:qi},t[3]=T):T=t[3];let{copyToClipboard:E}=Ze(T),D;t[4]===n.serverConfig?D=t[5]:(D=Wn(n.serverConfig),t[4]=n.serverConfig,t[5]=D);let k=D,A;t[6]===h?A=t[7]:(A=ot.updateStateAtom(h),t[6]=h,t[7]=A);let j=xe(A),P=j.status===`running`&&j.stage===`resuming`,F;t[8]===n?F=t[9]:(F=Bi(n),t[8]=n,t[9]=F);let ee=F,ne=n.serverConfig?.environment.serverVersion??null,re=Qe(),ie;t[10]!==h||t[11]!==re.environments?(ie=te(re.environments.get(h)?.status??_e())?.descriptor,t[10]=h,t[11]=re.environments,t[12]=ie):ie=t[12];let ae=ie,[se,le]=(0,$.useState)(ae);ae!==void 0&&ae!==se&&le(ae);let ue;t[13]!==h||t[14]!==re.environments?(ue=re.environments.get(h)?.environment.endpoint.httpBaseUrl,t[13]=h,t[14]=re.environments,t[15]=ue):ue=t[15];let de=ue,[fe,L]=(0,$.useState)(de);de!==void 0&&de!==fe&&L(de);let pe=mt(st.retryNow),{diagnosis:me,state:he,relayOnly:ge}=lr(n),R=P?null:me,ve=ft(h),Se=v&&ve._tag===`Some`?ve.value.target:null,z=de??fe,B;t[16]!==Se||t[17]!==n.entry||t[18]!==z?(B=Ue({entry:n.entry,relayHttpBaseUrl:z,connectedTarget:Se}),t[16]=Se,t[17]=n.entry,t[18]=z,t[19]=B):B=t[19];let we=B,Te;t[20]!==n.serverConfig||t[21]!==se?(Te=n.serverConfig??(se===void 0?null:{environment:se}),t[20]=n.serverConfig,t[21]=se,t[22]=Te):Te=t[22];let V;t[23]===Te?V=t[24]:(V=s(Te),t[23]=Te,t[24]=V);let Ee=V,De;t[25]===n.entry?De=t[26]:(De=U(n.entry),t[25]=n.entry,t[26]=De);let Oe=De.length,ke;t[27]!==Se||t[28]!==n?(ke=Er(n,Se),t[27]=Se,t[28]=n,t[29]=ke):ke=t[29];let Ae=R?null:P?`Restarting`:ee.text,je=_&&k?ne:null,Me;t[30]!==ke||t[31]!==Ae||t[32]!==je?(Me=[ke,Ae,je].filter(Ki),t[30]=ke,t[31]=Ae,t[32]=je,t[33]=Me):Me=t[33];let Ne=Me.join(` · `),H=_&&v&&k!==null&&(j.status===`idle`||j.status===`failed`),Pe;t[34]!==_||t[35]!==n.connection||t[36]!==g?(Pe=g?n.connection.error??Be(n.connection):_?Be(n.connection):`Switched off`,t[34]=_,t[35]=n.connection,t[36]=g,t[37]=Pe):Pe=t[37];let Fe=`${Pe}${k?`\nUpdate available: ${k.serverVersion} → ${k.clientVersion}`:``}`,Ie=n.label,Le=!_,Re=_&&ee.tone===`error`&&!P&&!R&&`text-destructive`,ze;t[38]===Re?ze=t[39]:(ze=ye(`min-w-0 truncate`,Re),t[38]=Re,t[39]=ze);let He;t[40]===ze?He=t[41]:(He=(0,Q.jsx)(`span`,{className:ze}),t[40]=ze,t[41]=He);let W;t[42]!==Fe||t[43]!==Ne||t[44]!==He?(W=(0,Q.jsx)(_t,{payload:Fe,render:He,children:Ne}),t[42]=Fe,t[43]=Ne,t[44]=He,t[45]=W):W=t[45];let We;t[46]===Fe?We=t[47]:(We=(0,Q.jsx)(vt,{side:`top`,className:`whitespace-pre-wrap`,children:Fe}),t[46]=Fe,t[47]=We);let Ge;t[48]!==W||t[49]!==We?(Ge=(0,Q.jsxs)(yt,{children:[W,We]}),t[48]=W,t[49]=We,t[50]=Ge):Ge=t[50];let G;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[51]=G):G=t[51];let Ke;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=()=>u(Gi),t[52]=Ke):Ke=t[52];let qe=Oe===1?`Routes`:`${Oe} routes`,Je=l&&`rotate-90`,Ye;t[53]===Je?Ye=t[54]:(Ye=ye(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,Je),t[53]=Je,t[54]=Ye);let Xe;t[55]===Ye?Xe=t[56]:(Xe=(0,Q.jsx)(ce,{"aria-hidden":!0,className:Ye}),t[55]=Ye,t[56]=Xe);let K;t[57]!==l||t[58]!==qe||t[59]!==Xe?(K=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":l,onClick:Ke,className:`inline-flex shrink-0 items-center gap-0.5 rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[qe,Xe]}),t[57]=l,t[58]=qe,t[59]=Xe,t[60]=K):K=t[60];let q;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[61]=q):q=t[61];let $e=`remote-permissions-${h}`,et;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>f(Wi),t[62]=et):et=t[62];let tt=d&&`rotate-90`,nt;t[63]===tt?nt=t[64]:(nt=ye(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,tt),t[63]=tt,t[64]=nt);let J;t[65]===nt?J=t[66]:(J=(0,Q.jsx)(ce,{"aria-hidden":!0,className:nt}),t[65]=nt,t[66]=J);let rt;t[67]!==d||t[68]!==$e||t[69]!==J?(rt=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":d,"aria-controls":$e,onClick:et,className:`inline-flex shrink-0 items-center gap-0.5 rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[`Permissions`,J]}),t[67]=d,t[68]=$e,t[69]=J,t[70]=rt):rt=t[70];let it;t[71]!==Ge||t[72]!==K||t[73]!==rt?(it=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[Ge,G,K,q,rt]}),t[71]=Ge,t[72]=K,t[73]=rt,t[74]=it):it=t[74];let at;t[75]!==he||t[76]!==R||t[77]!==p?(at=R?(0,Q.jsx)(dr,{diagnosis:R,retryAt:he.phase===`backoff`?he.retryAt:null,attempt:he.attempt,expanded:p,onToggle:()=>m(Ui)}):null,t[75]=he,t[76]=R,t[77]=p,t[78]=at):at=t[78];let ct;t[79]===j?ct=t[80]:(ct=j.status===`idle`?null:(0,Q.jsx)(`div`,{className:`mt-1 max-w-md`,children:(0,Q.jsx)(Zn,{state:j})}),t[79]=j,t[80]=ct);let lt;t[81]!==at||t[82]!==ct?(lt=(0,Q.jsxs)(Q.Fragment,{children:[at,ct]}),t[81]=at,t[82]=ct,t[83]=lt):lt=t[83];let ut;t[84]!==R||t[85]!==p||t[86]!==n||t[87]!==h||t[88]!==c||t[89]!==ge||t[90]!==pe?(ut=R&&p?(0,Q.jsx)(ur,{hostLabel:n.label,diagnosis:R,onRetry:()=>void pe(h),onAddRoute:ge?()=>c(n):null}):null,t[84]=R,t[85]=p,t[86]=n,t[87]=h,t[88]=c,t[89]=ge,t[90]=pe,t[91]=ut):ut=t[91];let dt;t[92]!==n||t[93]!==c||t[94]!==l?(dt=l&&(0,Q.jsx)(xr,{environment:n,onAddRoute:()=>c(n)}),t[92]=n,t[93]=c,t[94]=l,t[95]=dt):dt=t[95];let pt;t[96]!==h||t[97]!==v||t[98]!==d?(pt=d&&(0,Q.jsx)(`div`,{id:`remote-permissions-${h}`,className:`mt-2 border-t border-border/50`,children:(0,Q.jsx)(mr,{environmentId:h,connected:v,routeContext:!0})}),t[96]=h,t[97]=v,t[98]=d,t[99]=pt):pt=t[99];let Y;t[100]!==ut||t[101]!==dt||t[102]!==pt?(Y=(0,Q.jsxs)(Q.Fragment,{children:[ut,dt,pt]}),t[100]=ut,t[101]=dt,t[102]=pt,t[103]=Y):Y=t[103];let ht;t[104]!==n.entry.serverUpdateRequired||t[105]!==n.label||t[106]!==h||t[107]!==se?.serverVersion||t[108]!==j.status||t[109]!==g?(ht=g&&n.entry.serverUpdateRequired===!0&&j.status!==`running`?(0,Q.jsx)(ir,{environmentId:h,serverLabel:`${n.label} server`,fromVersion:se?.serverVersion,targetVersion:Ve,label:j.status===`failed`?`Retry update`:`Update`}):null,t[104]=n.entry.serverUpdateRequired,t[105]=n.label,t[106]=h,t[107]=se?.serverVersion,t[108]=j.status,t[109]=g,t[110]=ht):ht=t[110];let gt;t[111]!==n.label||t[112]!==n.serverConfig||t[113]!==h||t[114]!==j.status||t[115]!==H||t[116]!==k?(gt=H?(0,Q.jsx)($n,{environmentId:h,serverLabel:`${n.label} server`,selfUpdate:An(n.serverConfig),installation:n.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:Bn(n.serverConfig),threadContinuation:nr(n.serverConfig),targetVersion:k.clientVersion,label:j.status===`failed`?`Retry update`:`Update`,appearance:`icon`}):null,t[111]=n.label,t[112]=n.serverConfig,t[113]=h,t[114]=j.status,t[115]=H,t[116]=k,t[117]=gt):gt=t[117];let bt=y||g,xt=`${_?`Switch off`:`Switch on`} ${n.label}`,St;t[118]!==h||t[119]!==i?(St=e=>i(h,e),t[118]=h,t[119]=i,t[120]=St):St=t[120];let Ct;t[121]!==_||t[122]!==bt||t[123]!==xt||t[124]!==St?(Ct=(0,Q.jsx)(_t,{render:(0,Q.jsx)(cr,{size:`sm`,checked:_,disabled:bt,"aria-label":xt,onCheckedChange:St})}),t[121]=_,t[122]=bt,t[123]=xt,t[124]=St,t[125]=Ct):Ct=t[125];let wt=g?`Client not supported`:_?`Switch off`:`Switch on`,Tt;t[126]===wt?Tt=t[127]:(Tt=(0,Q.jsx)(vt,{side:`top`,children:wt}),t[126]=wt,t[127]=Tt);let Et;t[128]!==Ct||t[129]!==Tt?(Et=(0,Q.jsxs)(yt,{children:[Ct,Tt]}),t[128]=Ct,t[129]=Tt,t[130]=Et):Et=t[130];let Dt=`More actions for ${n.label}`,Ot;t[131]!==y||t[132]!==Dt?(Ot=(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,disabled:y,"aria-label":Dt}),t[131]=y,t[132]=Dt,t[133]=Ot):Ot=t[133];let kt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(kt=(0,Q.jsx)(oe,{className:`size-3.5`}),t[134]=kt):kt=t[134];let At;t[135]===Ot?At=t[136]:(At=(0,Q.jsx)(Ce,{render:Ot,children:kt}),t[135]=Ot,t[136]=At);let jt;t[137]!==n.serverConfig||t[138]!==h?(jt=(0,Q.jsx)(br,{environmentId:h,serverConfig:n.serverConfig}),t[137]=n.serverConfig,t[138]=h,t[139]=jt):jt=t[139];let Mt,Nt;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=()=>u(Hi),Nt=(0,Q.jsx)(M,{}),t[140]=Mt,t[141]=Nt):(Mt=t[140],Nt=t[141]);let Pt=l?`Hide routes`:`Routes`,Ft;t[142]===Pt?Ft=t[143]:(Ft=(0,Q.jsxs)(a,{onClick:Mt,children:[Nt,Pt]}),t[142]=Pt,t[143]=Ft);let It;t[144]!==E||t[145]!==we?(It=we?(0,Q.jsx)(a,{onClick:()=>E(we,{url:we}),children:`Copy MCP URL`}):null,t[144]=E,t[145]=we,t[146]=It):It=t[146];let Lt;t[147]!==w||t[148]!==b?(Lt=b?(0,Q.jsx)(a,{onClick:()=>w(b),children:`Copy trace ID`}):null,t[147]=w,t[148]=b,t[149]=Lt):Lt=t[149];let Rt;t[150]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=(0,Q.jsx)(N,{}),t[150]=Rt):Rt=t[150];let zt;t[151]!==n||t[152]!==o?(zt=()=>o(n),t[151]=n,t[152]=o,t[153]=zt):zt=t[153];let Bt=y?`Removing…`:`Remove from this device…`,Vt;t[154]!==zt||t[155]!==Bt?(Vt=(0,Q.jsx)(a,{variant:`destructive`,onClick:zt,children:Bt}),t[154]=zt,t[155]=Bt,t[156]=Vt):Vt=t[156];let Ht;t[157]!==jt||t[158]!==Ft||t[159]!==It||t[160]!==Lt||t[161]!==Vt?(Ht=(0,Q.jsxs)(be,{align:`end`,children:[jt,Ft,It,Lt,Rt,Vt]}),t[157]=jt,t[158]=Ft,t[159]=It,t[160]=Lt,t[161]=Vt,t[162]=Ht):Ht=t[162];let Ut;t[163]!==At||t[164]!==Ht?(Ut=(0,Q.jsxs)(O,{children:[At,Ht]}),t[163]=At,t[164]=Ht,t[165]=Ut):Ut=t[165];let Wt;return t[166]!==n.label||t[167]!==Ee||t[168]!==Le||t[169]!==it||t[170]!==lt||t[171]!==Y||t[172]!==ht||t[173]!==gt||t[174]!==Et||t[175]!==Ut?(Wt=(0,Q.jsxs)(Dr,{kind:Ee,label:Ie,dimmed:Le,subtitle:it,below:lt,detail:Y,children:[ht,gt,Et,Ut]}),t[166]=n.label,t[167]=Ee,t[168]=Le,t[169]=it,t[170]=lt,t[171]=Y,t[172]=ht,t[173]=gt,t[174]=Et,t[175]=Ut,t[176]=Wt):Wt=t[176],Wt}function Hi(e){return!e}function Ui(e){return!e}function Wi(e){return!e}function Gi(e){return!e}function Ki(e){return e!==null}function qi(e){q.add(Y({type:`error`,title:`Could not copy MCP URL`,description:e.message}))}function Ji(e){let{url:t}=e;q.add({type:`success`,title:`MCP URL copied`,description:`Add it to an agent, e.g. claude mcp add --transport http p4 ${t}`})}function Yi(e){q.add(Y({type:`error`,title:`Could not copy trace ID`,description:e.message}))}function Xi(e){let{traceId:t}=e;q.add({type:`success`,title:`Trace ID copied`,description:t})}function Zi(e){let t=(0,Z.c)(10),{checked:n,disabled:r,disabledReason:i,onCheckedChange:a,ariaLabel:o}=e,s=o===void 0?`Enable P4 Connect`:o,c;t[0]===a?c=t[1]:(c=a?{onCheckedChange:a}:{},t[0]=a,t[1]=c);let l;t[2]!==s||t[3]!==n||t[4]!==r||t[5]!==c?(l=(0,Q.jsx)(cr,{"aria-label":s,checked:n,disabled:r,...c}),t[2]=s,t[3]=n,t[4]=r,t[5]=c,t[6]=l):l=t[6];let u=l,d;return t[7]!==u||t[8]!==i?(d=i?(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:u})}),(0,Q.jsx)(vt,{side:`top`,children:i})]}):u,t[7]=u,t[8]=i,t[9]=d):d=t[9],d}function Qi(e){let t=(0,Z.c)(53),{canManageRelay:n}=e,r=tt(),{isSignedIn:i,linkState:a,linkRevoked:o,managedTunnelActive:s,managedTunnelOutOfSync:l,publishAgentActivity:u,holdWebhooksWhileOffline:d,operationError:f,reconcileCloudState:p}=Fn(),[h,g]=(0,$.useState)(!1),[_,v]=(0,$.useState)(!1),y=i?n?null:`Your session does not have permission to manage P4 Connect access.`:`Sign in to P4 Connect to manage this environment.`,b=h||_,x=(0,$.useEffectEvent)(a.refresh),S;t[0]===x?S=t[1]:(S=()=>{let e=window.setInterval(()=>x(),3e4);return()=>window.clearInterval(e)},t[0]=x,t[1]=S);let C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[2]=C):C=t[2],(0,$.useEffect)(S,C);let w=s?a.data?.reachability:void 0,T;t[3]===w?T=t[4]:(T=w?.status===`reachable`?m(w):w?.status===`unreachable`?(0,Q.jsxs)(`span`,{className:`block text-destructive`,children:[[w.reason,w.hint,`Fix: ${w.fix}`].filter(Boolean).join(` `),` `,(0,Q.jsx)(`a`,{href:c(w.cause),target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:`More info`})]}):null,t[3]=w,t[4]=T);let E=T,D;t[5]!==r||t[6]!==u||t[7]!==p?(D=async e=>{r!==null&&dt(r,`relay:write`)&&(g(!0),await p({managedTunnel:e,publish:u})&&q.add({type:`success`,title:e?`P4 Connect linked`:u?`P4 Connect tunnel disabled`:`P4 Connect unlinked`,description:e?`This environment is available through P4 Connect.`:u?`The managed tunnel was removed. Agent activity publishing stays on.`:`This environment is no longer available through P4 Connect.`}),g(!1))},t[5]=r,t[6]=u,t[7]=p,t[8]=D):D=t[8];let O=D,k;t[9]!==s||t[10]!==r||t[11]!==p?(k=async e=>{r!==null&&dt(r,`relay:write`)&&(v(!0),await p({managedTunnel:s,publish:e})&&q.add({type:`success`,title:e?`Agent activity enabled`:`Agent activity disabled`,description:e?`This environment publishes agent activity to your mobile clients.`:`This environment will stop publishing agent activity.`}),v(!1))},t[9]=s,t[10]=r,t[11]=p,t[12]=k):k=t[12];let A=k,j;t[13]!==s||t[14]!==u||t[15]!==p?(j=async e=>{v(!0),await p({managedTunnel:s,publish:u,holdWebhooksWhileOffline:e})&&q.add({type:`success`,title:e?`Webhooks held while offline`:`Webhooks no longer held`,description:e?`P4 Connect keeps webhook requests for up to 24 hours while this environment is offline.`:`Requests to an offline environment now fail. Anything already held is still delivered.`}),v(!1)},t[13]=s,t[14]=u,t[15]=p,t[16]=j):j=t[16];let M=j,N;t[17]!==n||t[18]!==y||t[19]!==b||t[20]!==i||t[21]!==o||t[22]!==s||t[23]!==l||t[24]!==f||t[25]!==a.data||t[26]!==a.error||t[27]!==a.isPending||t[28]!==w?.status||t[29]!==E||t[30]!==O?(N=window.desktopBridge?(0,Q.jsx)(un,{title:er(`p4-connect`).title,description:o?`This environment was removed from P4 Connect. Turn it on to link it again.`:s?w?.status===`unreachable`?`P4 Connect is on, but other devices cannot reach this environment.`:w?.status===`reachable`?`This environment is available to your other devices through P4 Connect.`:`P4 Connect is on. Reachability has not been checked yet.`:l?`P4 Connect is out of sync. This environment is linked only to publish agent activity, so other devices cannot connect. Turn P4 Connect on to repair it.`:`Make this environment available to your other devices through P4 Connect.`,status:f??a.error??E,control:(0,Q.jsx)(Zi,{checked:s,disabled:!n||!i||a.data===null||a.isPending||b,disabledReason:y,onCheckedChange:e=>void O(e)})}):o?(0,Q.jsx)(un,{title:er(`p4-connect`).title,description:"This environment was removed from P4 Connect. Run `p4c connect link` on the host to link it again."}):null,t[17]=n,t[18]=y,t[19]=b,t[20]=i,t[21]=o,t[22]=s,t[23]=l,t[24]=f,t[25]=a.data,t[26]=a.error,t[27]=a.isPending,t[28]=w?.status,t[29]=E,t[30]=O,t[31]=N):N=t[31];let P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=er(`publish-agent-activity`),t[32]=P):P=t[32];let F=!n||!i||a.data===null||a.isPending||b,ee;t[33]===A?ee=t[34]:(ee=e=>void A(e),t[33]=A,t[34]=ee);let I;t[35]!==y||t[36]!==u||t[37]!==ee||t[38]!==F?(I=(0,Q.jsx)(un,{title:P.title,description:`Send activity to mobile notifications and Live Activities without P4 Connect.`,control:(0,Q.jsx)(Zi,{ariaLabel:`Publish agent activity to mobile clients`,checked:u,disabled:F,disabledReason:y,onCheckedChange:ee})}),t[35]=y,t[36]=u,t[37]=ee,t[38]=F,t[39]=I):I=t[39];let te;t[40]!==n||t[41]!==y||t[42]!==d||t[43]!==b||t[44]!==i||t[45]!==s||t[46]!==a.isPending||t[47]!==M?(te=s?(0,Q.jsx)(un,{title:er(`hold-webhooks-while-offline`).title,description:`Keep webhook requests for up to 24 hours while this environment is offline, then deliver them. Off: P4 Connect only forwards requests and stores nothing.`,control:(0,Q.jsx)(Zi,{ariaLabel:`Hold webhook requests while this environment is offline`,checked:d,disabled:!n||!i||a.isPending||b,disabledReason:y,onCheckedChange:e=>void M(e)})}):null,t[40]=n,t[41]=y,t[42]=d,t[43]=b,t[44]=i,t[45]=s,t[46]=a.isPending,t[47]=M,t[48]=te):te=t[48];let ne;return t[49]!==I||t[50]!==te||t[51]!==N?(ne=(0,Q.jsxs)(Q.Fragment,{children:[N,I,te]}),t[49]=I,t[50]=te,t[51]=N,t[52]=ne):ne=t[52],ne}function $i(e){let t=(0,Z.c)(3),{canReadRelay:n,canManageRelay:r}=e;if(!Pe())return null;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(un,{title:`P4 Connect`,description:`To edit these settings, pair this connection with both View relay and Manage relay permissions.`}),t[0]=e):e=t[0],e}let i;return t[1]===r?i=t[2]:(i=(0,Q.jsx)(Qi,{canManageRelay:r}),t[1]=r,t[2]=i),i}function ea(e){let t=(0,Z.c)(4),{cloudEnabled:n}=e,r=n===void 0||n,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Nt,{variant:`icon`,children:(0,Q.jsx)(h,{})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Ft,{children:`No saved remote environments`}),t[1]=a):a=t[1];let o=r?`Click “Add environment” to pair another environment, or connect one from P4 Connect.`:`Click “Add environment” to pair another environment.`,s;return t[2]===o?s=t[3]:(s=(0,Q.jsxs)(Lt,{className:`min-h-52`,children:[i,(0,Q.jsxs)(Pt,{children:[a,(0,Q.jsx)(It,{children:o})]})]}),t[2]=o,t[3]=s),s}function ta(e){let t=(0,Z.c)(3),{primaryEnvironmentId:n,savedEnvironments:r}=e,i;return t[0]!==n||t[1]!==r?(i=Pe()?(0,Q.jsx)(Gn,{primaryEnvironmentId:n,savedEnvironments:r,empty:(0,Q.jsx)(ea,{})}):r.length===0?(0,Q.jsx)(ea,{cloudEnabled:!1}):null,t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function na(){let e=window.desktopBridge,t=xe(ct),{environments:n}=et(),r=$e(),i=mt(On,{reportFailure:!1}),a=mt(Dn,{reportFailure:!1}),c=mt(st.remove,{reportFailure:!1}),l=mt(st.register,{reportFailure:!1}),d=Qe(),p=mt(st.setEnabled,{reportFailure:!1}),m=r?.environmentId??null,g=En(),_=g.data?.authenticated?g.data.permissions??g.data.scopes??null:null,v=e?null:g.data?.auth.policy??null,y=(0,$.useMemo)(()=>n.filter(e=>e.entry.target._tag!==`PrimaryConnectionTarget`),[n]),x=(0,$.useMemo)(()=>y.filter(e=>!We(e.entry.target)),[y]),S=(0,$.useMemo)(()=>P(e=>y.map(t=>({environment:t,updateStatus:e(ot.updateStateAtom(t.environmentId)).status}))),[y]),C=xe(S),T=(0,$.useMemo)(()=>C.flatMap(({environment:e,updateStatus:t})=>{let n=Wn(e.serverConfig),r=An(e.serverConfig),i=Bn(e.serverConfig);return!n||t===`running`||!e.entry.enabled||e.connection.phase!==`connected`||We(e.entry.target)||r===null||r===`desktop-managed`&&!i?[]:[{environmentId:e.environmentId,serverLabel:e.label,selfUpdate:r,installation:e.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:i,threadContinuation:nr(e.serverConfig),continueThreadsAfterServerUpdate:e.serverConfig?.settings.continueThreadsAfterServerUpdate??!1,targetVersion:n.clientVersion}]}),[C]),D=(0,$.useMemo)(()=>[...r?[r]:[],...y.filter(e=>e.entry.enabled)],[r,y]),A=(0,$.useMemo)(()=>{let e=new Set;for(let t of y){let n=t.entry.profile;if(t.entry.target._tag!==`SshConnectionTarget`||he(n)||n.value._tag!==`SshConnectionProfile`)continue;let r=n.value.target;e.add(r.alias),e.add(Tr(r))}return e},[y]),[j,M]=(0,$.useState)(null),[N,F]=(0,$.useState)(null),[ee,te]=(0,$.useState)(()=>new Map),ne=(0,$.useCallback)(e=>{te(t=>new Map(t).set(e.id,e.credential))},[]),[re,ie]=(0,$.useState)(null),[ae,se]=(0,$.useState)(null),[le,ue]=(0,$.useState)(!1),[de,fe]=(0,$.useState)(!1),[L,pe]=(0,$.useState)(null),[me,ge]=(0,$.useState)(`remote`),[_e,R]=(0,$.useState)(``),[ve,Se]=(0,$.useState)(``),[z,B]=(0,$.useState)(``),[we,Te]=(0,$.useState)(``),[V,Ee]=(0,$.useState)(``),[De,Oe]=(0,$.useState)(!1),Ae=(0,$.useRef)(void 0),[Me,H]=(0,$.useState)(null),[U,Ie]=(0,$.useState)(!1),[Re,ze]=(0,$.useState)(null),[Be,Ve]=(0,$.useState)(!1),[He,Ue]=(0,$.useState)(!1),[W,Ge]=(0,$.useState)(!1),[G,Ze]=(0,$.useState)(!1),[tt,nt]=(0,$.useState)(null),[J,it]=(0,$.useState)(null),at=J!==null,[lt,ft]=(0,$.useState)(null),[ht,gt]=(0,$.useState)(!1),[bt,Mt]=(0,$.useState)(String(oi)),[Nt,Pt]=(0,$.useState)(null),Ft=r?.serverConfig??null,It=Wn(Ft),Lt=xe(ot.updateStateAtom(m)),[Ut,Wt]=(0,$.useState)(!1),Gt=nn(e=>e.defaultAdvertisedEndpointKey),Kt=nn(e=>e.setDefaultAdvertisedEndpointKey),qt=ut(m,u),Jt=ut(m,b),Yt=ut(m,E),Xt=ut(m,w),Zt=ut(m,k),Qt=!Le()&&Xt,$t=pt(qt&&m!==null?Gr.accessChanges({environmentId:m,input:null}):null),en=pt(Qt&&e?Qr:null),tn=e!==void 0&&de&&me===`ssh`,rn=pt(tn?ai:null),an=rn.refresh;(0,$.useEffect)(()=>{tn&&an()},[tn,an]);let on=pt(Qt&&e?Jn:null),X=on.data,pn=tt??on.error,xn=on.isPending&&on.data===null,Cn=rn.data??ci,Fn=(0,$.useMemo)(()=>Cn.filter(e=>{let t=Tr(e);return!A.has(e.alias)&&!A.has(t)}),[Cn,A]),In=(0,$.useMemo)(()=>ei(Fn,z),[z,Fn]),Ln=rn.isPending&&rn.data===null,Un=rn.error,Gn=e!==void 0&&(Ln||Fn.length>0),Kn=en.data?.serverExposureState??null,qn=en.data?.advertisedEndpoints??si,Xn=j??en.error,Qn=N??$t.error,rr=$t.isPending&&$t.data===null,ir=(0,$.useMemo)(()=>{let e=$t.data;return e?.type===`snapshot`?Si(e.payload.pairingLinks.map(e=>Ti(e))):[]},[$t.data]),ar=(0,$.useMemo)(()=>{let e=$t.data;return e?.type===`snapshot`?wi(e.payload.clientSessions.map(e=>Ei(e))):[]},[$t.data]),or=e?Kn?.mode===`network-accessible`:v===`remote-reachable`,sr=bt.trim(),lr=Number(sr),ur=/^\d+$/u.test(sr)&&Number.isInteger(lr)&&lr>=1&&lr<=65535,dr=(0,$.useMemo)(()=>{if(!lt)return null;if(!ur||lr===oi)return lt.httpBaseUrl;try{let e=new URL(lt.httpBaseUrl);return e.port=String(lr),e.toString().replace(/\/$/u,``)}catch{return lt.httpBaseUrl}},[ur,lr,lt]),Z=(0,$.useCallback)(async t=>{if(e&&m!==null&&dt(m,`environment:maintain`)){Ve(!0),M(null);try{await e.setServerExposureMode(t?`network-accessible`:`local-only`),$r(),Ue(!1),Ve(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to update network exposure.`;Ue(!1),M(t),q.add(Y({type:`error`,title:`Could not update network access`,description:t})),Ve(!1)}}},[e,m]),pr=(0,$.useCallback)(()=>{Nt!==null&&Z(Nt===`network-accessible`)},[Z,Nt]),hr=(0,$.useCallback)(async()=>{if(e&&m!==null&&dt(m,`environment:maintain`)&&ur){Ge(!0),M(null);try{await e.setTailscaleServeEnabled({enabled:!0,port:lr}),$r(),ft(null)}catch(e){let t=e instanceof Error?e.message:`Failed to configure Tailscale HTTPS.`;M(t),q.add(Y({type:`error`,title:`Could not set up Tailscale HTTPS`,description:t}))}finally{Ge(!1)}}},[e,ur,lr,m]),gr=(0,$.useCallback)(e=>{Mt(String(Kn?.tailscaleServePort??oi)),ft(e)},[Kn?.tailscaleServePort]),vr=(0,$.useCallback)(async()=>{if(e&&m!==null&&dt(m,`environment:maintain`)){Ge(!0),M(null);try{await e.setTailscaleServeEnabled({enabled:!1,port:Kn?.tailscaleServePort??oi}),$r(),gt(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to disable Tailscale HTTPS.`;M(t),q.add(Y({type:`error`,title:`Could not disable Tailscale HTTPS`,description:t}))}finally{Ge(!1)}}},[e,Kn,m]),yr=(0,$.useCallback)(e=>{gt(!0)},[]),xr=(0,$.useCallback)(async e=>{if(m!==null&&dt(m,`access:write`)){ie(e),F(null);try{await Tn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke pairing link.`;F(t),q.add(Y({type:`error`,title:`Could not revoke pairing link`,description:t}))}finally{ie(null)}}},[m]),Sr=(0,$.useCallback)(async e=>{if(m!==null&&dt(m,`access:write`)){se(e),F(null);try{await wn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke client access.`;F(t),q.add(Y({type:`error`,title:`Could not revoke client access`,description:t}))}finally{se(null)}}},[m]),Cr=(0,$.useCallback)(async()=>{if(m!==null&&dt(m,`access:write`)){ue(!0),F(null);try{let e=await Sn();q.add({type:`success`,title:e===1?`Revoked 1 other client`:`Revoked ${e} clients`,description:`Other paired clients will need a new pairing link before reconnecting.`})}catch(e){let t=e instanceof Error?e.message:`Failed to revoke other clients.`;F(t),q.add(Y({type:`error`,title:`Could not revoke other clients`,description:t}))}finally{ue(!1)}}},[m]),wr=(0,$.useCallback)(async e=>{Ie(!0),H(null);let t=await a({target:e,label:``,...L?{expectedEnvironmentId:L.environmentId}:{}});if(t._tag===`Failure`){je(t)||H(vi(Ne(t))),Ie(!1);return}R(``),Se(``),B(``),Te(``),Ee(``),fe(!1),q.add({type:`success`,title:L?`Route added`:`Environment connected`,description:L?`${L.label} can now be reached over SSH ${e.alias}.`:`${e.alias} is ready over an SSH-managed tunnel.`}),Ie(!1)},[a,L]),Er=(0,$.useCallback)(async()=>{if(me===`ssh`){let e;try{e=hi({host:z,username:we,port:V})}catch(e){H(vi(e));return}await wr(e);return}Ie(!0),H(null);let e;try{e=_i({host:_e,pairingCode:ve})}catch(e){let t=e instanceof Error?e.message:`Failed to add backend.`;H(t),q.add(Y({type:`error`,title:`Could not add backend`,description:t})),Ie(!1);return}let t=await i({...e,...L?{expectedEnvironmentId:L.environmentId}:{}});if(t._tag===`Failure`){if(!je(t)){let e=Ne(t),n=e instanceof Error?e.message:`Failed to add backend.`;H(n),q.add(Y({type:`error`,title:`Could not add backend`,description:n}))}Ie(!1);return}R(``),Se(``),B(``),Te(``),Ee(``),fe(!1),q.add(L?{type:`success`,title:`Route added`,description:`${L.label} now has another way to connect.`}:{type:`success`,title:`Backend added`,description:`The environment is saved and will reconnect on app startup.`}),Ie(!1)},[L,i,wr,_e,me,ve,z,V,we]),Dr=(0,$.useCallback)(e=>{e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&z.trim().length>0&&(e.preventDefault(),Er())},[Er,z]),Or=(0,$.useCallback)(async t=>{if(U||!e)return;Ie(!0),H(null),B(t.alias);let n;try{n=await e.resolveSshHost(t.alias)}catch(e){H(vi(e)),Ie(!1);return}Te(n.username??``),Ee(n.port===null?``:String(n.port)),await wr(n)},[wr,e,U]),kr=(0,$.useCallback)(e=>{if(e.nativeEvent.isComposing||e.keyCode===229)return;let n=De&&Gn;if(n){let n=Bt(e,t,{platform:navigator.platform,context:{modelPickerOpen:!1}}),r=Vt(n??``),i=r===null?void 0:In[r];if(i){e.preventDefault(),e.stopPropagation(),Oe(!1),Or(i);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation();return}}let r=n&&Ae.current!==void 0;!e.defaultPrevented&&!r&&e.key===`Enter`&&z.trim().length>0&&(e.preventDefault(),Er())},[In,Er,Or,Gn,t,z,De]),Ar=(0,$.useCallback)(async(e,t)=>{H(null);let n=await p({environmentId:e,enabled:t});if(n._tag===`Failure`&&!je(n)){let e=Ne(n),r=e instanceof Error?e.message:`Failed to switch the backend ${t?`on`:`off`}.`;H(r),q.add(Y({type:`error`,title:`Could not switch backend ${t?`on`:`off`}`,description:r}))}},[p]),jr=(0,$.useCallback)(async e=>{let t=e.environmentId;ze(t),H(null);let n=await c(t);if(ze(null),n._tag===`Failure`&&!je(n)){let e=Ne(n),t=e instanceof Error?e.message:`Failed to remove backend.`;H(t),q.add(Y({type:`error`,title:`Could not remove backend`,description:t}))}},[c]),[Nr,Pr]=(0,$.useState)(null),Fr=(0,$.useCallback)(async e=>{if(e.relayManaged&&Pe()){Pr(e);return}await rt(`Remove ${e.label} from this device?\nThis forgets its pairing, credentials, and cached threads here. Switch it off instead to keep it saved.`,{variant:`destructive`})===!0&&await jr(e)},[jr]),Ir=ir,Rr=(0,$.useMemo)(()=>qn.find(Oi)??null,[qn]),Br=(0,$.useMemo)(()=>or?qn.filter(e=>!Oi(e)):[],[qn,or]),Vr=(0,$.useMemo)(()=>Rr?[...Br,Rr]:Br,[Rr,Br]),Hr=(0,$.useMemo)(()=>Di(Br,Gt),[Gt,Br]),Ur=(0,$.useMemo)(()=>Hr??Di(Rr?[Rr]:[],Gt),[Gt,Hr,Rr]),Wr=Ur?ki(Ur):null,Kr=(0,$.useCallback)(e=>{Kt(ki(e))},[Kt]),qr=(0,$.useCallback)(e=>{let t=gi(e);if(t){R(t.host),Se(t.pairingCode);return}R(e)},[]),Jr=e=>{let t=me===e.mode;return(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":t,className:ye(`group flex min-h-24 items-start gap-3 rounded-lg border p-4 text-left`,t?`border-primary/50 bg-primary/5`:`border-border/60 hover:bg-muted/40`),disabled:U,onClick:()=>{ge(e.mode)},children:[e.icon?(0,Q.jsx)(`span`,{className:ye(`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md border`,t?`border-primary/30 bg-primary/10 text-primary`:`border-border/70 bg-background text-muted-foreground group-hover:text-foreground`),children:e.icon}):null,(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})},Yr=()=>(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Host`}),(0,Q.jsx)(xt,{value:_e,onChange:e=>qr(e.target.value),placeholder:`backend.example.com`,disabled:U,spellCheck:!1})]}),(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Pairing code`}),(0,Q.jsx)(xt,{value:ve,onChange:e=>Se(e.target.value),placeholder:`PAIRCODE`,disabled:U,spellCheck:!1})]})]}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`span`,{className:`mt-1 block text-2xs text-muted-foreground`,children:`Paste a full pairing URL here to fill both fields automatically.`})})]}),Xr=L!==null&&!L.relayManaged&&d.environments.has(L.environmentId)?d.environments.get(L.environmentId).environment:null,Zr=async()=>{if(Xr===null||L===null)return;Ie(!0);let e=await l(new Fe({target:new ke({environmentId:Xr.environmentId,label:L.label})}));if(Ie(!1),e._tag===`Failure`){if(!je(e)){let t=Ne(e);H(t instanceof Error?t.message:`Could not add the route.`)}return}fe(!1),q.add({type:`success`,title:`Route added`,description:`${L.label} falls back to P4 Connect when its other routes are unreachable.`})},ti=()=>(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[Xr===null?null:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This machine is on your P4 Connect account. Use it as a fallback route.`}),(0,Q.jsx)(I,{size:`xs`,variant:`outline`,disabled:U,onClick:()=>void Zr(),children:`Add P4 Connect`})]}),Yr(),Me?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:Me}):null,(0,Q.jsxs)(I,{variant:`outline`,className:`w-full`,disabled:U,onClick:()=>void Er(),children:[(0,Q.jsx)(f,{className:`size-3.5`}),U?`Adding…`:L?`Add route`:`Add environment`]})]}),ni=()=>(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`block`,children:[(0,Q.jsx)(`label`,{htmlFor:`saved-backend-ssh-host`,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`SSH host or alias`}),(0,Q.jsxs)(gn,{items:In,itemToStringValue:e=>e.alias,mode:`none`,openOnInputClick:!0,open:De,onOpenChange:Oe,onItemHighlighted:e=>{Ae.current=e},value:z,onValueChange:(e,t)=>{if(B(e),t.reason!==`item-press`)return;let n=In.find(t=>t.alias===e);n&&Or(n)},children:[(0,Q.jsx)(vn,{id:`saved-backend-ssh-host`,onKeyDown:kr,placeholder:`Search hosts or type devbox`,disabled:U,spellCheck:!1}),Gn?(0,Q.jsx)(yn,{children:Ln?(0,Q.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:`Loading hosts…`}):In.length>0?(0,Q.jsx)(hn,{className:`max-h-72`,children:In.map((e,n)=>{let r=Tr(e),i=n<9?zt(n):null,a=i?Ht(t,i,navigator.platform):null;return(0,Q.jsxs)(bn,{value:e,className:`h-8 min-h-8 whitespace-nowrap`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:e.alias}),r===e.alias?(0,Q.jsx)(`span`,{className:`flex-1`}):(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:r}),a?(0,Q.jsx)(_n,{className:`shrink-0`,children:a}):null]},`${e.alias}:${e.hostname}:${e.port??``}`)})}):(0,Q.jsxs)(mn,{className:`break-all`,children:[`No hosts match "`,z.trim(),`".`]})}):null]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_7rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Username`}),(0,Q.jsx)(xt,{value:we,onChange:e=>Te(e.target.value),onKeyDown:Dr,placeholder:`root`,disabled:U,spellCheck:!1})]}),(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Port`}),(0,Q.jsx)(xt,{value:V,onChange:e=>Ee(e.target.value),onKeyDown:Dr,placeholder:`22`,inputMode:`numeric`,disabled:U,spellCheck:!1})]})]}),Me||Un?(0,Q.jsx)(ln,{variant:`error`,children:(0,Q.jsx)(cn,{children:Me??Un})}):null,(0,Q.jsxs)(I,{variant:`outline`,className:`w-full`,disabled:U,onClick:()=>void Er(),children:[(0,Q.jsx)(f,{className:`size-3.5`}),U?`Adding…`:L?`Add route`:`Add environment`]})]})}),ri=()=>(0,Q.jsx)(cr,{checked:Kn?.mode===`network-accessible`,disabled:!Kn||Be,onCheckedChange:e=>{Pt(e?`network-accessible`:`local-only`),Ue(!0)},"aria-label":`Enable network access`}),ii=e=>Ut?Br.map(t=>{let n=ki(t);return(0,Q.jsx)(Ri,{endpoint:t,isDefault:n===Wr,presentation:e,onSetDefault:Kr,onSetupTailscaleServe:gr,onDisableTailscaleServe:yr,isUpdatingTailscaleServe:W},t.id)}):null,di=(0,$.useCallback)(async t=>{if(e&&m!==null&&dt(m,`environment:maintain`)){Ze(!0),nt(null);try{await t(),Hn()}catch(e){let t=e instanceof Error?e.message:`Failed to update WSL backend.`;nt(t),q.add(Y({type:`error`,title:`Could not change WSL backend`,description:t})),Hn()}finally{Ze(!1)}}},[e,m]),fi=(0,$.useCallback)(()=>{nt(null),Hn()},[]),pi=(0,$.useMemo)(()=>n.some(e=>We(e.entry.target)),[n]),mi=(0,$.useCallback)(t=>{if(!e||!X)return;let n=X.distros.find(e=>e.isDefault)?.name??null;if(t===ui){if(!X.enabled&&!X.wslOnly)return;let t=X.wslOnly;if(pi||t){it({kind:`disable`,wasWslOnly:t});return}di(()=>e.setWslBackendEnabled(!1));return}let r=t===li?null:t,i=r??n;if(!X.enabled){it({kind:`enable`,nextDistro:r});return}if((X.distro??n)!==i){if(pi||X.wslOnly){it({kind:`distro`,nextDistro:r});return}di(()=>e.setWslDistro(r))}},[di,e,X,pi]),yi=(0,$.useCallback)(t=>{if(!e||!J||J.kind!==`enable`)return;let n=J.nextDistro;it(null);let r=X?.distro??null;di(()=>Mn({bridge:e,mode:t,nextDistro:n,persistedDistro:r}))},[di,e,X,J]),xi=(0,$.useCallback)(t=>{e&&X&&X.wslOnly!==t&&it({kind:`wsl-only`,nextValue:t})},[e,X]),Ai=(0,$.useCallback)(()=>{if(!e||!J)return;let t=J;if(t.kind!==`enable`){if(it(null),t.kind===`disable`){di(async()=>{let n=await e.setWslBackendEnabled(!1);return t.wasWslOnly?await e.setWslOnly(!1):n});return}if(t.kind===`distro`){di(()=>e.setWslDistro(t.nextDistro));return}di(()=>e.setWslOnly(t.nextValue))}},[di,e,J]),ji=()=>{if(!X)return Pn({state:null,error:pn})&&Qt?(0,Q.jsx)(un,{...er(`wsl-backend`),description:`Couldn't load the WSL backend state.`,status:(0,Q.jsx)(`span`,{className:`block text-destructive`,children:pn}),control:(0,Q.jsx)(I,{size:`sm`,variant:`outline`,onClick:fi,disabled:xn,children:xn?`Retrying…`:`Retry`})}):null;if(!Pn({state:X,error:pn}))return null;if(!X.available)return(0,Q.jsx)(un,{...er(`wsl-backend`),description:`WSL is unavailable, so Windows is running instead. Turn WSL off to clear this preference.`,status:pn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:pn}):null,control:(0,Q.jsx)(I,{size:`sm`,variant:`outline`,disabled:G,onClick:()=>mi(ui),children:`Switch to Windows`})});let e=X.distros.find(e=>e.isDefault)?.name??null,t=X.enabled?X.distro??e??li:ui,n=t===ui?`Off`:t===li?`Default distro`:t;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(un,{...er(`wsl-backend`),description:`Run the selected WSL distro alongside Windows. Projects remain on their current filesystem.`,status:pn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:pn}):X.preflightError?(0,Q.jsxs)(`span`,{className:`block text-destructive`,children:[`WSL backend couldn't start: `,X.preflightError]}):null,control:(0,Q.jsxs)(Xe,{value:t,onValueChange:e=>{typeof e==`string`&&mi(e)},children:[(0,Q.jsx)(Ye,{size:`sm`,className:`w-full sm:w-56`,"aria-label":`WSL backend`,disabled:G,children:(0,Q.jsx)(qe,{children:n})}),(0,Q.jsxs)(Je,{align:`end`,alignItemWithTrigger:!1,children:[(0,Q.jsx)(Ke,{hideIndicator:!0,value:ui,children:`Off`}),X.distros.length===0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ke,{hideIndicator:!0,value:li,children:`Default distro`}),X.distro===null?null:(0,Q.jsx)(Ke,{hideIndicator:!0,value:X.distro,children:X.distro})]}):X.distros.map(e=>(0,Q.jsxs)(Ke,{hideIndicator:!0,value:e.name,children:[e.name,e.isDefault?` (default)`:``]},e.name))]})]})}),X.enabled?(0,Q.jsx)(un,{title:`WSL only`,description:`Run only the WSL backend. P4 Code restarts when this changes.`,className:`bg-muted/20 pl-7 sm:pl-8`,control:(0,Q.jsx)(cr,{checked:X.wslOnly,disabled:G,onCheckedChange:e=>xi(e),"aria-label":`Run WSL only`})}):null]})},Mi=()=>(0,Q.jsx)(un,{title:er(`tailscale-https`).title,description:Rr?Rr.status===`available`?Rr.httpBaseUrl:`Use Tailscale Serve to expose this backend through a MagicDNS HTTPS URL.`:`Start Tailscale to set up HTTPS access through MagicDNS.`,control:Rr?(0,Q.jsx)(cr,{checked:Rr.status===`available`,disabled:W,onCheckedChange:e=>{if(e){gr(Rr);return}yr(Rr)},"aria-label":`Enable Tailscale HTTPS`}):null}),Ni=e=>(0,Q.jsxs)(Q.Fragment,{children:[Qn?(0,Q.jsx)(`div`,{className:bi(e),children:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:Qn})}):null,(0,Q.jsx)(Li,{endpointUrl:Kn?.endpointUrl,endpoints:Vr,defaultEndpointKey:Wr,presentation:e,isLoading:rr,pairingLinks:Ir,createdPairingCredentials:ee,clientSessions:ar,revokingPairingLinkId:re,revokingClientSessionId:ae,onRevokePairingLink:xr,onRevokeClientSession:Sr,canRevoke:Jt})]}),Pi=()=>(0,Q.jsx)(un,{title:er(`network-access`).title,description:or?(0,Q.jsx)(zi,{endpoint:Hr,hiddenEndpointCount:Math.max(Br.length-1,0),expanded:Ut,onToggleExpanded:()=>Wt(e=>!e),fallback:Kn?.endpointUrl?`Reachable at ${Kn.endpointUrl}`:Kn?.advertisedHost?`Exposed on all interfaces. Pairing links use ${Kn.advertisedHost}.`:`Exposed on all interfaces.`}):Kn?`Limited to this machine.`:`Loading…`,status:Xn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:Xn}):null,control:ri()}),Fi=()=>(0,Q.jsx)(un,{title:er(`network-access`).title,description:e?`This connection cannot view or change network exposure.`:v===`remote-reachable`?`Remote access is already configured. Change network exposure where the server starts.`:v===`loopback-browser`?`Only this machine can connect. Restart with a non-loopback host for remote pairing.`:`Network exposure information is unavailable.`,control:!e&&(v===`remote-reachable`||v===`loopback-browser`)?(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:(0,Q.jsx)(cr,{checked:or,disabled:!0,"aria-label":`Enable network access`})})}),(0,Q.jsx)(vt,{side:`top`,children:`Network exposure changes restart the backend and must be controlled where the server process is launched.`})]}):void 0}),Bi=(0,Q.jsx)(Q.Fragment,{children:m===null?(0,Q.jsxs)(fn,{...er(`connections-environment`),children:[(0,Q.jsx)(un,{title:`No environment selected`,description:`Connect an environment to view its settings and access.`}),(0,Q.jsx)(_r,{}),Yt||Zt?(0,Q.jsx)($i,{canReadRelay:Yt,canManageRelay:Zt}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(fn,{...er(`connections-environment`),title:r?.label??(e?`This machine`:`Primary environment`),icon:(0,Q.jsx)(sn,{"aria-hidden":!0,kind:Ft?s(Ft):`desktop`,className:`size-4`}),headerAction:m===null?null:(0,Q.jsxs)(O,{children:[(0,Q.jsx)(Ce,{render:(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`More actions for this machine`}),children:(0,Q.jsx)(oe,{className:`size-3.5`})}),(0,Q.jsx)(be,{align:`end`,children:(0,Q.jsx)(br,{environmentId:m,serverConfig:Ft})})]}),children:[(0,Q.jsx)(_r,{}),Qt?(0,Q.jsx)(un,{title:`Version`,description:Lt.status===`idle`?[Ft?.environment.serverVersion??null,r?.displayUrl??null].filter(e=>e!==null).join(` · `)||`Loading…`:(0,Q.jsx)(Zn,{state:Lt}),control:It&&m!==null&&Lt.status!==`running`?(0,Q.jsx)($n,{size:`sm`,environmentId:m,serverLabel:r?`${r.label} server`:`server`,selfUpdate:An(Ft),installation:Ft?.environment.capabilities.serverInstallation,desktopAppUpdate:Bn(Ft),threadContinuation:nr(Ft),targetVersion:It.clientVersion,label:Lt.status===`failed`?`Retry update`:`Update to ${It.clientVersion}`}):Lt.status===`idle`&&Ft?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Up to date`}):void 0}):null,Qt&&e?(0,Q.jsxs)(Q.Fragment,{children:[Pi(),ii(`endpoint-rail`),Mi(),ji(),Yt||Zt?(0,Q.jsx)($i,{canReadRelay:Yt,canManageRelay:Zt}):null]}):Qt?(0,Q.jsxs)(Q.Fragment,{children:[Fi(),Yt||Zt?(0,Q.jsx)($i,{canReadRelay:Yt,canManageRelay:Zt}):null]}):null,r?(0,Q.jsxs)(`details`,{className:`group px-3 sm:px-4`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-md text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring [&::-webkit-details-marker]:hidden`,children:[`Permissions`,(0,Q.jsx)(ce,{"aria-hidden":!0,className:`size-3 text-muted-foreground group-open:rotate-90`})]}),(0,Q.jsx)(mr,{environmentId:r.environmentId,connected:r.connection.phase===`connected`})]}):null]}),qt||Jt?(0,Q.jsx)(fr,{id:`authorized-clients`,title:`Authorized clients`,summary:Ci(ar,Ir),control:Jt?(0,Q.jsx)(Ii,{delegatableScopes:_??[],onPairingLinkCreated:ne,clientSessions:qt&&$t.error===null&&$t.data?.type===`snapshot`?ar:null,isRevokingOtherClients:le,onRevokeOtherClients:Cr}):void 0,children:(0,Q.jsx)(St,{scrollFade:!0,chainVerticalScroll:!0,className:`max-h-[22.5rem]`,"data-testid":`authorized-clients-scroll-area`,children:qt?Ni(`current`):(0,Q.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`This connection can create access links but cannot view authorized clients.`})})}):null,(0,Q.jsx)(kn,{open:He&&Qt,onOpenChange:e=>{Be||Ue(e)},onOpenChangeComplete:e=>{e||Pt(null)},children:(0,Q.jsxs)(jn,{children:[(0,Q.jsxs)(Vn,{children:[(0,Q.jsx)(Nn,{children:Nt===`network-accessible`?`Enable network access?`:`Disable network access?`}),(0,Q.jsx)(Rn,{children:Nt===`network-accessible`?`Let your other devices connect to P4 Code over the network. Pair devices to give them access. P4 Code will restart.`:`Devices connected over your local network will disconnect. Existing tunnels, such as P4 Connect or Tailscale HTTPS, keep working. P4 Code will restart.`})]}),(0,Q.jsxs)(zn,{children:[(0,Q.jsx)(tr,{disabled:Be,render:(0,Q.jsx)(I,{variant:`outline`,disabled:Be}),children:(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:`Cancel`})}),(0,Q.jsxs)(I,{variant:`default`,onClick:pr,disabled:!Qt||Nt===null||Be,children:[Be&&(0,Q.jsx)(K,{size:`sm`}),(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:Be?`Restarting…`:Nt===`network-accessible`?`Restart and enable`:`Restart and disable`})]})]})]})}),(0,Q.jsx)(kn,{open:at&&Qt,onOpenChange:e=>{G||e||it(null)},children:(0,Q.jsxs)(jn,{children:[(0,Q.jsxs)(Vn,{children:[(0,Q.jsx)(Nn,{children:J?.kind===`disable`?J.wasWslOnly?`Turn off WSL and switch back to Windows?`:`Disable WSL backend?`:J?.kind===`distro`?`Switch WSL distro?`:J?.kind===`enable`?`Start the WSL backend`:J?.nextValue?`Run only the WSL backend?`:`Re-enable the Windows backend?`}),(0,Q.jsx)(Rn,{children:J?.kind===`disable`?J.wasWslOnly?`P4 Code will restart on the Windows backend. Threads and projects opened against WSL stay safe inside the distro and become available again when you re-enable WSL.`:`The WSL backend will stop. Threads and projects opened against WSL stay safe inside the distro, but they'll be unavailable in P4 Code until you re-enable WSL.`:J?.kind===`distro`?`P4 Code will restart the WSL backend on the new distro. Sessions still running on the current distro will be interrupted.`:J?.kind===`enable`?`Run the WSL backend alongside the Windows one, or stop the Windows backend and use only WSL? You can change this later from Settings.`:J?.nextValue?`P4 Code will restart and start only the WSL backend. Your Windows-side projects won't be accessible until you turn this off again.`:`P4 Code will restart and bring the Windows backend back up alongside WSL.`})]}),(0,Q.jsxs)(zn,{children:[(0,Q.jsx)(tr,{disabled:G,render:(0,Q.jsx)(I,{variant:`outline`,disabled:G}),children:`Cancel`}),J?.kind===`enable`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(I,{variant:`outline`,onClick:()=>yi(`wsl-only`),disabled:G||!Qt,children:G?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Applying…`]}):`Use only WSL`}),(0,Q.jsx)(I,{variant:`default`,onClick:()=>yi(`both`),disabled:G||!Qt,children:G?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Applying…`]}):`Run both backends`})]}):(0,Q.jsx)(I,{variant:J?.kind===`disable`||J?.kind===`wsl-only`&&J.nextValue?`destructive`:`default`,onClick:Ai,disabled:G||!Qt,children:G?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Applying…`]}):J?.kind===`disable`?J.wasWslOnly?`Switch to Windows`:`Disable WSL`:J?.kind===`distro`?`Switch distro`:J?.nextValue?`Restart and enable`:`Restart and disable`})]})]})}),(0,Q.jsx)(kn,{open:ht&&Qt,onOpenChange:e=>{W||gt(e)},children:(0,Q.jsxs)(jn,{children:[(0,Q.jsxs)(Vn,{children:[(0,Q.jsx)(Nn,{children:`Disable Tailscale HTTPS?`}),(0,Q.jsx)(Rn,{children:`P4 Code will restart the local backend without Tailscale Serve.`})]}),(0,Q.jsxs)(zn,{children:[(0,Q.jsx)(tr,{disabled:W,render:(0,Q.jsx)(I,{variant:`outline`,disabled:W}),children:`Cancel`}),(0,Q.jsx)(I,{variant:`destructive`,onClick:()=>void vr(),disabled:W||!Qt,children:W?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Restarting…`]}):`Restart and disable`})]})]})}),(0,Q.jsx)(jt,{open:lt!==null,onOpenChange:e=>{W||e||ft(null)},children:(0,Q.jsxs)(At,{className:`max-w-md`,children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(wt,{children:`Set up Tailscale HTTPS?`}),(0,Q.jsx)(kt,{children:`P4 Code will restart the local backend with Tailscale Serve enabled and ask Tailscale to proxy HTTPS traffic to this backend.`})]}),(0,Q.jsxs)(Ot,{children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`HTTPS port`}),(0,Q.jsx)(xt,{className:`mt-2`,type:`number`,inputMode:`numeric`,min:1,max:65535,step:1,value:bt,onChange:e=>Mt(e.target.value),disabled:W})]}),ur?null:(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:`Enter a port from 1 to 65535.`}),(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-muted/20 px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`HTTPS endpoint`}),(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm text-foreground`,children:dr??`Pending MagicDNS endpoint`})}),dr?(0,Q.jsx)(vt,{side:`top`,children:dr}):null]})]})]}),(0,Q.jsxs)(Tt,{children:[(0,Q.jsx)(Dt,{disabled:W,render:(0,Q.jsx)(I,{variant:`outline`,disabled:W}),children:`Cancel`}),(0,Q.jsx)(I,{onClick:()=>void hr(),disabled:W||!ur,children:W?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{size:`sm`}),`Restarting…`]}):`Enable`})]})]})})]})});return(0,Q.jsxs)(dn,{children:[Bi,(0,Q.jsxs)(fn,{...er(`remote-environments`),title:`Environments`,headerAction:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[T.length>0?(0,Q.jsx)(Yn,{targets:T,variant:`ghost-muted`}):null,(0,Q.jsxs)(jt,{open:de,onOpenChange:e=>{fe(e),e?pe(null):H(null)},children:[(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(Et,{render:(0,Q.jsxs)(I,{size:`xs`,variant:`ghost-muted`,"aria-label":`Add environment`,children:[(0,Q.jsx)(f,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`Add environment`})]})})}),(0,Q.jsx)(vt,{side:`top`,children:`Add environment`})]}),(0,Q.jsxs)(At,{className:`max-h-[80dvh] sm:max-w-3xl`,children:[(0,Q.jsxs)(Ct,{children:[(0,Q.jsx)(wt,{children:L?`Add a route to ${L.label}`:`Add Environment`}),(0,Q.jsx)(kt,{children:L?`Pair this machine again over another address, such as its Tailscale name. It joins the existing routes instead of adding a second machine.`:`Pair another environment to this client.`})]}),(0,Q.jsx)(Ot,{children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Jr({mode:`remote`,title:`Remote link`,description:`Enter a backend host and pairing code.`,icon:(0,Q.jsx)(h,{"aria-hidden":!0,className:`size-4`})}),e?Jr({mode:`ssh`,title:`SSH`,description:`Use local SSH config, agent, and tunnels for the backend.`,icon:(0,Q.jsx)(o,{"aria-hidden":!0,className:`size-4`})}):null]}),(0,Q.jsx)(Rt,{children:me===`ssh`?ni():ti()})]})})]})]})]}),children:[x.map(e=>(0,Q.jsx)(Vi,{environment:e,removingEnvironmentId:Re,onSetEnabled:Ar,onRemove:Fr,onAddRoute:e=>{pe(e),H(null),fe(!0)}},e.environmentId)),(0,Q.jsx)(ta,{primaryEnvironmentId:m,savedEnvironments:y})]}),Pe()?(0,Q.jsx)(zr,{environmentLabel:Nr?.label??null,onCancel:()=>Pr(null),onConfirm:()=>{Nr&&(Pr(null),jr(Nr))}}):null,(0,Q.jsx)(Mr,{environments:D}),(0,Q.jsx)(Lr,{environments:D})]})}function ra(e){let{kind:t}=e;q.add({type:`success`,title:t===`hosted-link`?`Hosted app link copied`:t===`link`?`Pairing URL copied`:`Pairing code copied`,description:t===`hosted-link`?`Open it in the browser on the device you want to connect.`:t===`link`?`Open it in the client you want to pair to this environment.`:`Paste it into another client to finish pairing.`})}function ia(e){return Mi(e)?`hosted-link`:`link`}function aa(e){return!e}function oa(e){return e.currentTarget.select()}function sa(e){return e.currentTarget.select()}function ca(e){return e!==null}var la=na;export{la as component};
2
- //# sourceMappingURL=settings.connections-DSPQOd-W.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{Dy as i,Ey as a,Tb as o,dr as s}from"./utils-BE5iQuUP.js";import{a as c,c as l,o as u,s as d,t as f}from"./select-C10oXKGz.js";import{t as p}from"./input-GkmNnHh7.js";import{F as m,L as h,R as g,a as _,i as v,s as y}from"./settingsLayout-DzBeWTUO.js";import{va as b}from"./main-Dcfxjdkd.js";var x=n(),S=e(t(),1),C=e(r(),1);function w(){let e=(0,x.c)(28),t=m(T),n=g(),r=h(),[i,a]=(0,S.useState)(``),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[`decisionOpenRouterKey`],e[0]=o):o=e[0];let c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,C.jsxs)(C.Fragment,{children:[`Used by Jev and Luna Decisions.`,` `,(0,C.jsx)(`a`,{href:`https://openrouter.ai/settings/keys`,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:`Get an API key`})]}),e[1]=c):c=e[1];let l=t?`Key saved`:`No key saved`,u;e[2]!==r||e[3]!==i||e[4]!==n?(u=e=>{e.preventDefault(),i.trim()&&r&&(n({decisionOpenRouterKey:i.trim()}),a(``))},e[2]=r,e[3]=i,e[4]=n,e[5]=u):u=e[5];let d=!r,f=t?`Replace saved key`:`API key`,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>a(e.target.value),e[6]=v):v=e[6];let y;e[7]!==i||e[8]!==d||e[9]!==f?(y=(0,C.jsx)(`div`,{className:`min-w-40 flex-1`,children:(0,C.jsx)(p,{"aria-label":`OpenRouter API key`,type:`password`,autoComplete:`off`,value:i,disabled:d,placeholder:f,onChange:v})}),e[7]=i,e[8]=d,e[9]=f,e[10]=y):y=e[10];let b;e[11]!==r||e[12]!==i?(b=!r||!i.trim(),e[11]=r,e[12]=i,e[13]=b):b=e[13];let w;e[14]===b?w=e[15]:(w=(0,C.jsx)(s,{type:`submit`,size:`sm`,disabled:b,children:`Save`}),e[14]=b,e[15]=w);let E;e[16]!==r||e[17]!==t||e[18]!==n?(E=t&&(0,C.jsx)(s,{type:`button`,size:`sm`,variant:`outline`,disabled:!r,onClick:()=>n({decisionOpenRouterKey:``}),children:`Remove`}),e[16]=r,e[17]=t,e[18]=n,e[19]=E):E=e[19];let D;e[20]!==E||e[21]!==u||e[22]!==y||e[23]!==w?(D=(0,C.jsxs)(`form`,{className:`flex max-w-lg flex-wrap items-center gap-2`,onSubmit:u,children:[y,w,E]}),e[20]=E,e[21]=u,e[22]=y,e[23]=w,e[24]=D):D=e[24];let O;return e[25]!==D||e[26]!==l?(O=(0,C.jsx)(_,{title:`OpenRouter API key`,serverScoped:!0,settingKeys:o,description:c,status:l,children:D}),e[25]=D,e[26]=l,e[27]=O):O=e[27],O}function T(e){return!!e.decisionOpenRouterKey}function E(){let e=(0,x.c)(23),t=m(),n=g(),r=h(),s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[`decisionModel`],e[0]=s):s=e[0];let c=!r,p;e[1]===n?p=e[2]:(p=e=>{o(i)(e)&&n({decisionModel:e})},e[1]=n,e[2]=p);let S=a[t.decisionModel],T;e[3]===S?T=e[4]:(T=(0,C.jsx)(d,{"aria-label":`Decision model`,children:(0,C.jsx)(l,{children:S})}),e[3]=S,e[4]=T);let E;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,C.jsx)(u,{children:i.literals.map(D)}),e[5]=E):E=e[5];let O;e[6]!==t.decisionModel||e[7]!==c||e[8]!==p||e[9]!==T?(O=(0,C.jsx)(_,{id:`decision-model`,title:`Decision model`,serverScoped:!0,settingKeys:s,description:`Fast, structured answers for agents, fit scores on question options, and Computer Use navigation.`,control:(0,C.jsxs)(f,{value:t.decisionModel,disabled:c,onValueChange:p,children:[T,E]})}),e[6]=t.decisionModel,e[7]=c,e[8]=p,e[9]=T,e[10]=O):O=e[10];let k;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,C.jsx)(w,{}),e[11]=k):k=e[11];let A;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=[`decisionVisionEnabled`],e[12]=A):A=e[12];let j=!r,M;e[13]===n?M=e[14]:(M=e=>n({decisionVisionEnabled:e}),e[13]=n,e[14]=M);let N;e[15]!==t.decisionVisionEnabled||e[16]!==M||e[17]!==j?(N=(0,C.jsx)(_,{title:`Computer Use vision`,serverScoped:!0,settingKeys:A,description:`Use screenshots with Decisions to suggest navigation targets. Jev vision is experimental.`,control:(0,C.jsx)(b,{"aria-label":`Computer Use vision`,checked:t.decisionVisionEnabled,disabled:j,onCheckedChange:M})}),e[15]=t.decisionVisionEnabled,e[16]=M,e[17]=j,e[18]=N):N=e[18];let P;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,C.jsx)(_,{title:`What is shared`,description:`Decision requests send their text and any included images to the selected service. Computer Use vision also sends screenshots. Keys stay in this environment's secret store.`}),e[19]=P):P=e[19];let F;return e[20]!==N||e[21]!==O?(F=(0,C.jsx)(v,{children:(0,C.jsxs)(y,{title:`Decisions`,children:[O,k,N,P]})}),e[20]=N,e[21]=O,e[22]=F):F=e[22],F}function D(e){return(0,C.jsx)(c,{value:e,children:a[e]},e)}var O=E;export{O as component};
2
- //# sourceMappingURL=settings.decisions-C8qxQCjl.js.map