@p4code/cli 0.8.23 → 0.8.24

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 (217) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-DzKk3bdm.mjs → binCli-DNod5652.mjs} +2 -2
  3. package/dist/client/.vite/manifest.json +1315 -1315
  4. package/dist/client/assets/{AuthSurfaceShell-DJcUG_EN.js → AuthSurfaceShell-Wwq6fM9A.js} +2 -2
  5. package/dist/client/assets/{ChatGptUsageButton-BDCO7XMy.js → ChatGptUsageButton-8lmdyDiG.js} +2 -2
  6. package/dist/client/assets/{ChatMarkdown-CDno8Ayh.js → ChatMarkdown-Cd3yE4VU.js} +4 -4
  7. package/dist/client/assets/{CodexSetupSection.logic-BB9JxUR1.js → CodexSetupSection.logic-oYzzgIWo.js} +2 -2
  8. package/dist/client/assets/{CommandBlock-DQi0VdAG.js → CommandBlock-ByCjpPww.js} +2 -2
  9. package/dist/client/assets/{ComposerPromptEditor-DCjk2_nI.js → ComposerPromptEditor-4EkkS1N5.js} +4 -4
  10. package/dist/client/assets/{DevicePanel-D192Fic3.js → DevicePanel-DWlHQcLW.js} +2 -2
  11. package/dist/client/assets/{DeviceSetup-D9F7F9pV.js → DeviceSetup-Dm9ZbkMC.js} +2 -2
  12. package/dist/client/assets/{DiffCommentAnnotation-mA-RZ8Su.js → DiffCommentAnnotation-Dx-VhoLU.js} +2 -2
  13. package/dist/client/assets/{DiffFileTree-CaPQB8J4.js → DiffFileTree-BgjyfH71.js} +2 -2
  14. package/dist/client/assets/{DiffPanel-3G1enpU9.js → DiffPanel-tZN29mdM.js} +2 -2
  15. package/dist/client/assets/{DiffWorkerPoolProvider-BOInEqDW.js → DiffWorkerPoolProvider-C_yNvh6o.js} +2 -2
  16. package/dist/client/assets/{EmbeddedDesign-D97sS_-D.js → EmbeddedDesign-DDApp-WI.js} +2 -2
  17. package/dist/client/assets/{FileDiff-DLYKd8S8.js → FileDiff-B_422yEN.js} +2 -2
  18. package/dist/client/assets/{FilePreviewPanel-BCtCBzc7.js → FilePreviewPanel-B26lXYsA.js} +2 -2
  19. package/dist/client/assets/{FoldedSettingsSection-BIr-uvTu.js → FoldedSettingsSection-TLqDB_1b.js} +2 -2
  20. package/dist/client/assets/{NoProjectsHero-Dj3URl4e.js → NoProjectsHero-Bx1X9Us-.js} +2 -2
  21. package/dist/client/assets/{P4ConnectAccountPages-CFPHk3YU.js → P4ConnectAccountPages-BWvaLOY-.js} +2 -2
  22. package/dist/client/assets/{P4ConnectSidebarSignIn-BMrzp8XI.js → P4ConnectSidebarSignIn-C8z-Gfq5.js} +2 -2
  23. package/dist/client/assets/{PanelLayoutControls-C1Bf67DQ.js → PanelLayoutControls-C2deQDB2.js} +4 -4
  24. package/dist/client/assets/{PierreEntryIcon--dw21QmY.js → PierreEntryIcon-Ddl-VPd4.js} +2 -2
  25. package/dist/client/assets/{PreviewPanel-DCqFsoQM.js → PreviewPanel-8NDLwOfI.js} +2 -2
  26. package/dist/client/assets/{ProjectDefaultsSettings-B4srG1Zj.js → ProjectDefaultsSettings-DN1GxlYC.js} +2 -2
  27. package/dist/client/assets/{ProjectFavicon--HkFaTb7.js → ProjectFavicon-BDaMxno-.js} +3 -3
  28. package/dist/client/assets/{ProjectIconPickerDialog-Bl6Uid40.js → ProjectIconPickerDialog-Be5IQyyr.js} +2 -2
  29. package/dist/client/assets/{ProviderAuthTerminal-njw98kWo.js → ProviderAuthTerminal-BFGd236-.js} +2 -2
  30. package/dist/client/assets/{ProviderModelPicker-DBjdgQjr.js → ProviderModelPicker-DMtMvBKn.js} +2 -2
  31. package/dist/client/assets/{ProviderSettingsForm-_kCwzsZ5.js → ProviderSettingsForm-D6u9dY73.js} +2 -2
  32. package/dist/client/assets/{PullRequestCodeTab-2OTuKeLP.js → PullRequestCodeTab-hXtKZAP9.js} +2 -2
  33. package/dist/client/assets/{ReadOnlySourcePreview-BfF8Dhuk.js → ReadOnlySourcePreview-CDLZaWo2.js} +2 -2
  34. package/dist/client/assets/{RenderErrorBoundary-CReszKsZ.js → RenderErrorBoundary-BkcvpgEh.js} +2 -2
  35. package/dist/client/assets/{ScheduledTasksSettings-BJ6fD98R.js → ScheduledTasksSettings-BJyFxVyR.js} +2 -2
  36. package/dist/client/assets/{ScopedSwitch-QH2iiv6j.js → ScopedSwitch-yznbaSh9.js} +2 -2
  37. package/dist/client/assets/{SettingsPanels-BRQsxDAj.js → SettingsPanels-DdhZ2nXb.js} +2 -2
  38. package/dist/client/assets/{SettingsPanels.logic-DADnLbJa.js → SettingsPanels.logic-DIuWE5Xf.js} +2 -2
  39. package/dist/client/assets/{SettingsScopeNotice-D8WXgfaz.js → SettingsScopeNotice-D8K81IzP.js} +2 -2
  40. package/dist/client/assets/{ThemeEditorPanel-UEzfMVAc.js → ThemeEditorPanel-ePX4nwaV.js} +2 -2
  41. package/dist/client/assets/{ThreadTerminalDrawer-Do19kCZu.js → ThreadTerminalDrawer-5z4y3z0y.js} +2 -2
  42. package/dist/client/assets/{Virtualizer-BSpDafyf.js → Virtualizer-DEM6HN7-.js} +2 -2
  43. package/dist/client/assets/{_chat-D4YotsBW.js → _chat-C0vR23gu.js} +5 -5
  44. package/dist/client/assets/{_chat.design-BPvdgNpo.js → _chat.design-CQ52N70I.js} +2 -2
  45. package/dist/client/assets/{_chat.index-Z_VqAv7I.js → _chat.index-SFAYIX_P.js} +2 -2
  46. package/dist/client/assets/{_chat.new-DOi-AUHb.js → _chat.new-BO6oEisx.js} +2 -2
  47. package/dist/client/assets/{_chat.pull-requests-6QyjmUBZ.js → _chat.pull-requests-BfyCJw7Q.js} +2 -2
  48. package/dist/client/assets/{abnfDiagram-VCTEODGH--jeYDB6y.js → abnfDiagram-VCTEODGH-DhiN6SMz.js} +2 -2
  49. package/dist/client/assets/architecture-7GRP2DOG-Yd6b7qRF.js +1 -0
  50. package/dist/client/assets/{architectureDiagram-5GKGNRK7-CZT297Q4.js → architectureDiagram-5GKGNRK7-bs37U5FM.js} +2 -2
  51. package/dist/client/assets/{assets-CJFG5Oow.js → assets-BU-ex_t8.js} +2 -2
  52. package/dist/client/assets/{blockDiagram-I7D4REHJ-EkNtHyvf.js → blockDiagram-I7D4REHJ-Bz9mN89n.js} +2 -2
  53. package/dist/client/assets/{browserHistoryStore-DO5WuJ8O.js → browserHistoryStore-KDG9Uz1t.js} +2 -2
  54. package/dist/client/assets/{browserLinkTarget-CJGymzWC.js → browserLinkTarget-DmKK3HY0.js} +2 -2
  55. package/dist/client/assets/{c4Diagram-7LVT6UL2-CWpB4Da8.js → c4Diagram-7LVT6UL2-CtkHQd_E.js} +2 -2
  56. package/dist/client/assets/channel-DrCQqhMU.js +2 -0
  57. package/dist/client/assets/{chunk-4HAMMTFA-DmxkShmg.js → chunk-4HAMMTFA-BtUnQAH6.js} +2 -2
  58. package/dist/client/assets/{chunk-75Z2AOVW-DR0PpYOm.js → chunk-75Z2AOVW-CwSe19lZ.js} +2 -2
  59. package/dist/client/assets/{chunk-DU6HZSFF-BO8x-KoS.js → chunk-DU6HZSFF-Bwy7A0TF.js} +2 -2
  60. package/dist/client/assets/{chunk-F27PBJKO-Bj6z3Mgi.js → chunk-F27PBJKO-CVsi2uk3.js} +2 -2
  61. package/dist/client/assets/{chunk-GMAD6QVW-DDPfmhbi.js → chunk-GMAD6QVW-CVzXn5Hv.js} +2 -2
  62. package/dist/client/assets/{chunk-GVQU2GXP-Dt2y3Ljq.js → chunk-GVQU2GXP-7pPJVhuz.js} +2 -2
  63. package/dist/client/assets/{chunk-IMKFNOWR-ulVnFkwU.js → chunk-IMKFNOWR-D-dmx49n.js} +2 -2
  64. package/dist/client/assets/{chunk-L3NEJ4N5-Bq_d7JXK.js → chunk-L3NEJ4N5-DEJnMXSk.js} +2 -2
  65. package/dist/client/assets/{chunk-OSK3NFVY-D3zjZoqS.js → chunk-OSK3NFVY-CBtNmbZ8.js} +2 -2
  66. package/dist/client/assets/{chunk-P2QGCYS3-BO8zGK2Q.js → chunk-P2QGCYS3-TNHN3Sve.js} +2 -2
  67. package/dist/client/assets/{chunk-POPQ4Y6H-gzBrIuwg.js → chunk-POPQ4Y6H-1cq1nl-Z.js} +2 -2
  68. package/dist/client/assets/{chunk-PWAF6VOD-D5kNvXnl.js → chunk-PWAF6VOD-B85KpsBk.js} +2 -2
  69. package/dist/client/assets/{chunk-SHT3W25Y-BUoRhLSC.js → chunk-SHT3W25Y-3tA2UDk1.js} +2 -2
  70. package/dist/client/assets/{chunk-SVP7TREG-Bjv2VnZc.js → chunk-SVP7TREG-CHzBNDDY.js} +2 -2
  71. package/dist/client/assets/{chunk-TICWLB2K-DAdtg5Kx.js → chunk-TICWLB2K-MeLbkhnz.js} +2 -2
  72. package/dist/client/assets/classDiagram-ZZMXUADV-MCjIu9oU.js +2 -0
  73. package/dist/client/assets/classDiagram-v2-VYDZK3BY-MCjIu9oU.js +2 -0
  74. package/dist/client/assets/{composer-logic-LXlav2Vb.js → composer-logic-DyIi6K9e.js} +2 -2
  75. package/dist/client/assets/{composerDraftUploads-ykQlcbPE.js → composerDraftUploads-BEFyD-t4.js} +2 -2
  76. package/dist/client/assets/{connect-BtrTxy8-.js → connect-BUAMGrjt.js} +2 -2
  77. package/dist/client/assets/{connect-agent-CVmArWh1.js → connect-agent-BNwEsc4t.js} +2 -2
  78. package/dist/client/assets/{cynefin-OW5HDTMX-DOViMxbO.js → cynefin-OW5HDTMX-DTUXnTov.js} +1 -1
  79. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-BWRCt23-.js → cynefinDiagram-5FMLGOSQ-Cd9_EwZX.js} +2 -2
  80. package/dist/client/assets/{dagre-GXQ25YYZ-DgnOAR1P.js → dagre-GXQ25YYZ-D0hUgab8.js} +2 -2
  81. package/dist/client/assets/{design-D2FoGDbP.js → design-DaqMSnWJ.js} +2 -2
  82. package/dist/client/assets/{device-CdLsoK0D.js → device-DnfWBPpo.js} +2 -2
  83. package/dist/client/assets/{diagram-S7CK7UJ4-C-BUdvbR.js → diagram-S7CK7UJ4-DY-wIVhL.js} +2 -2
  84. package/dist/client/assets/{diagram-UQ7AKVKN-CYox921O.js → diagram-UQ7AKVKN-CmWAx8wR.js} +2 -2
  85. package/dist/client/assets/{diagram-VSXAHHWV-CCHV1RQz.js → diagram-VSXAHHWV-DvIYORJP.js} +2 -2
  86. package/dist/client/assets/{diagram-VX7I27RA-B4SkxxZx.js → diagram-VX7I27RA-Dj3l0KCm.js} +2 -2
  87. package/dist/client/assets/{diagram-Z3DM3KII-D80OJGVQ.js → diagram-Z3DM3KII-ClP8dtWB.js} +2 -2
  88. package/dist/client/assets/{diffRendering-CdquEtfn.js → diffRendering-BWY0g219.js} +2 -2
  89. package/dist/client/assets/{dist-DWlOCBGN.js → dist-C5JAYxip.js} +2 -2
  90. package/dist/client/assets/{duoViewer-Cig0lw70.js → duoViewer-fztyITHM.js} +2 -2
  91. package/dist/client/assets/{dynamic-DUhOBcsP.js → dynamic-CnYAeR9T.js} +2 -2
  92. package/dist/client/assets/{ebnfDiagram-PWID7BFC-AJpsDjYU.js → ebnfDiagram-PWID7BFC-DtbBVfJO.js} +2 -2
  93. package/dist/client/assets/{embeddedScripts-DVwzRCwI.js → embeddedScripts-Bf2j7tmA.js} +2 -2
  94. package/dist/client/assets/{entities-BBhhC0Ry.js → entities-BJgMc8pv.js} +2 -2
  95. package/dist/client/assets/{erDiagram-RLTQ6QDP-qU4wtJw2.js → erDiagram-RLTQ6QDP-Dm2mBAGp.js} +2 -2
  96. package/dist/client/assets/eventmodeling-NTZA5JFV-rDo_pcJr.js +1 -0
  97. package/dist/client/assets/{fileLinks-16LrhkMX.js → fileLinks-C9oYzhXv.js} +2 -2
  98. package/dist/client/assets/{fileTreeExpansion-BwModZ8t.js → fileTreeExpansion-CpkONCrM.js} +2 -2
  99. package/dist/client/assets/flowDiagram-HODETNUW-C55XBPww.js +1 -0
  100. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-CMa5sD7U.js → ganttDiagram-EL5Y4UJY-D4UHegQH.js} +2 -2
  101. package/dist/client/assets/{getDiffFileInput-CMp2lO2J.js → getDiffFileInput-BKRfCrth.js} +2 -2
  102. package/dist/client/assets/ghostty-write-pty-BWDOU6dy.wasm +0 -0
  103. package/dist/client/assets/{gitGraph-4MIJSDKK-d8ivfU97.js → gitGraph-4MIJSDKK-BUhEDO22.js} +1 -1
  104. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-dltGGWCt.js → gitGraphDiagram-WWUBYQGX-BwJT0OjN.js} +2 -2
  105. package/dist/client/assets/{guideRunStore-CKZDf9-2.js → guideRunStore-DkBR0CPU.js} +2 -2
  106. package/dist/client/assets/{index-oiPu1asR.js → index-BYQ1ybfT.js} +3 -3
  107. package/dist/client/assets/{info-A6RAGUB7-B_ozJ3Df.js → info-A6RAGUB7-scwAD75p.js} +1 -1
  108. package/dist/client/assets/{infoDiagram-27XIBGKW-BiB0fE5_.js → infoDiagram-27XIBGKW-BgR5Wn6l.js} +2 -2
  109. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-DhfuI9PX.js → ishikawaDiagram-5VMMS53U-BOnOvOet.js} +2 -2
  110. package/dist/client/assets/{journeyDiagram-3NMN7TZE-8alknR0e.js → journeyDiagram-3NMN7TZE-B1wXWe62.js} +2 -2
  111. package/dist/client/assets/{kanban-definition-UXKFOSKX-IrCQ1z1D.js → kanban-definition-UXKFOSKX-DI-FwQ_D.js} +2 -2
  112. package/dist/client/assets/{line-wwHo_z2p.js → line-c6BqGnEH.js} +2 -2
  113. package/dist/client/assets/{linkedPrompt-P6UqYCja.js → linkedPrompt-DjSidfRe.js} +2 -2
  114. package/dist/client/assets/{main-COMts6-0.js → main-4dRVuXx2.js} +7 -7
  115. package/dist/client/assets/{mediaReference-C10FT-nO.js → mediaReference-CWzBBNFa.js} +2 -2
  116. package/dist/client/assets/{mediaSource-tGWQYhPt.js → mediaSource-CHfRwmOf.js} +2 -2
  117. package/dist/client/assets/{mermaid-parser.core-YE1Gxotj.js → mermaid-parser.core-DOOH_cP_.js} +4 -4
  118. package/dist/client/assets/{mermaid.core-DE9uOpTH.js → mermaid.core-9Tao6ZdD.js} +5 -5
  119. package/dist/client/assets/{mindmap-definition-YA3MSWOX-CLa2hbBW.js → mindmap-definition-YA3MSWOX-CqmRXnVH.js} +2 -2
  120. package/dist/client/assets/{onboarding-DCwprQF7.js → onboarding-BmDFkmWD.js} +2 -2
  121. package/dist/client/assets/{openFileInPreview-Dj9ZUFfJ.js → openFileInPreview-DF_vZEIK.js} +2 -2
  122. package/dist/client/assets/{p4ProjectFile-DfE23uqD.js → p4ProjectFile-YfIRB1xP.js} +2 -2
  123. package/dist/client/assets/{packet-AYTQ26CC-Be9nXFns.js → packet-AYTQ26CC-B8LkZ5j3.js} +1 -1
  124. package/dist/client/assets/{pair-CZDxH6ja.js → pair-DSE8uuft.js} +2 -2
  125. package/dist/client/assets/{pegDiagram-XKGWAZYB-C230ixTv.js → pegDiagram-XKGWAZYB-CS17GwTP.js} +2 -2
  126. package/dist/client/assets/{phoneViewer-CdFM4t6r.js → phoneViewer-CYzqv5af.js} +2 -2
  127. package/dist/client/assets/{pie-WAS4IAKB-DdxLVm9y.js → pie-WAS4IAKB-B0WBcNHW.js} +1 -1
  128. package/dist/client/assets/{pieDiagram-E7YTZNPT-AK3e5d1A.js → pieDiagram-E7YTZNPT-Bk2IwUHp.js} +2 -2
  129. package/dist/client/assets/{pierre-icons-BodtO6xC.js → pierre-icons-CY4HbMoq.js} +2 -2
  130. package/dist/client/assets/{preview-x-GNJPih.js → preview-B5v36DP8.js} +2 -2
  131. package/dist/client/assets/{primary-BDy4SXjC.js → primary-BKQnuXrW.js} +2 -2
  132. package/dist/client/assets/{primaryCloudLinkState--Kh80aBj.js → primaryCloudLinkState-CJSCsrUH.js} +2 -2
  133. package/dist/client/assets/{projectFilesQueryState-Bb-3twEo.js → projectFilesQueryState-DltGYM_H.js} +2 -2
  134. package/dist/client/assets/{projectScriptEditor-CAk1a7Bv.js → projectScriptEditor-CZb_iNq3.js} +2 -2
  135. package/dist/client/assets/{providerSkills-9AaADmXt.js → providerSkills-Ct4SZ-mY.js} +2 -2
  136. package/dist/client/assets/{pullRequestDetail.logic-Fv7ouL_B.js → pullRequestDetail.logic-COstpMB1.js} +2 -2
  137. package/dist/client/assets/{pullRequests-I9yJXxf5.js → pullRequests-ClG7PJe0.js} +2 -2
  138. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-CcagVHbG.js → quadrantDiagram-AXDQQJYC-B0vWHjBG.js} +2 -2
  139. package/dist/client/assets/{queries-DY5q7KFy.js → queries-BWcz-n4a.js} +2 -2
  140. package/dist/client/assets/{radar-RG4KPBEZ-YiDR7Sp-.js → radar-RG4KPBEZ-DmYBXYPt.js} +1 -1
  141. package/dist/client/assets/{railroad-74A4TZTK-Cg9vU93U.js → railroad-74A4TZTK-D-4grcyc.js} +1 -1
  142. package/dist/client/assets/railroad-abnf-HS5TGJTU-6H_zYY6R.js +1 -0
  143. package/dist/client/assets/railroad-ebnf-LZEXJU2U-DYahAqN_.js +1 -0
  144. package/dist/client/assets/railroad-peg-WCYAUIDC-CdcgHAXA.js +1 -0
  145. package/dist/client/assets/{railroadDiagram-O6MQD6OU-DKJFQoet.js → railroadDiagram-O6MQD6OU-C7n4Qist.js} +2 -2
  146. package/dist/client/assets/{renderScheduler-skv2ZK84.js → renderScheduler-DrstEe4y.js} +2 -2
  147. package/dist/client/assets/{requirementDiagram-BXWQKSXE-CsnTqOO2.js → requirementDiagram-BXWQKSXE-BYX3uen6.js} +2 -2
  148. package/dist/client/assets/{runtime-BSS7jQw6.js → runtime-CArTL2GH.js} +2 -2
  149. package/dist/client/assets/{runtime-D-mOwjrE.js → runtime-Cj24N7je.js} +3 -3
  150. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-DkydPO4_.js → sankeyDiagram-P5KCCOFB-tAgp-_Ny.js} +2 -2
  151. package/dist/client/assets/{scheduledTasksSettings.logic-C-rCAoCn.js → scheduledTasksSettings.logic-zleH3iJ_.js} +2 -2
  152. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-Df0N4Qqb.js → sequenceDiagram-WJ2MYXX4-DlvnWAh_.js} +2 -2
  153. package/dist/client/assets/{server-WufAYYa2.js → server-Vynm5NwP.js} +2 -2
  154. package/dist/client/assets/{session-pjgqVscl.js → session-DyiiEN5g.js} +2 -2
  155. package/dist/client/assets/{session-logic-VyTvpA5f.js → session-logic-B8t9Dfk3.js} +2 -2
  156. package/dist/client/assets/{settings-CsOciX79.js → settings-CjeBlT1I.js} +2 -2
  157. package/dist/client/assets/{settings.appearance-BTa_DZJP.js → settings.appearance-DUvYlE0y.js} +2 -2
  158. package/dist/client/assets/settings.archived-B5WGVqfk.js +2 -0
  159. package/dist/client/assets/{settings.computer-use-0aB9RoDX.js → settings.computer-use-S7DPGiAx.js} +2 -2
  160. package/dist/client/assets/{settings.connections-DUkG_06v.js → settings.connections-DJEqNVad.js} +2 -2
  161. package/dist/client/assets/{settings.data-controls-Cn2MWFbv.js → settings.data-controls-Bj1pQ5cL.js} +2 -2
  162. package/dist/client/assets/{settings.decisions-nRlfWokn.js → settings.decisions-BufUBcem.js} +2 -2
  163. package/dist/client/assets/{settings.designs-CYIwYmP5.js → settings.designs-bWCNQca4.js} +2 -2
  164. package/dist/client/assets/{settings.diagnostics-pCb9rEgL.js → settings.diagnostics-Dx_NdxOm.js} +2 -2
  165. package/dist/client/assets/{settings.general-DPkJcwHC.js → settings.general-BQ6775Hi.js} +2 -2
  166. package/dist/client/assets/{settings.integrations-DVMeSb1K.js → settings.integrations-CgxBXw6p.js} +2 -2
  167. package/dist/client/assets/{settings.keybindings-PZlDKFMi.js → settings.keybindings-DrBH8mlK.js} +2 -2
  168. package/dist/client/assets/{settings.open-source-licenses-CoY0kkph.js → settings.open-source-licenses-B3CGE-JI.js} +2 -2
  169. package/dist/client/assets/{settings.plugins-DCo7nzjN.js → settings.plugins-BGUgmDOY.js} +2 -2
  170. package/dist/client/assets/{settings.projects-iA51Y3aj.js → settings.projects-BJ1cpGGM.js} +3 -3
  171. package/dist/client/assets/{settings.providers-BkUKaZF-.js → settings.providers-D2I5mNzk.js} +3 -3
  172. package/dist/client/assets/{settings.scheduled-tasks-C0FpV34l.js → settings.scheduled-tasks-D8hRaqp8.js} +2 -2
  173. package/dist/client/assets/{settings.snap-shot-C29-fDJw.js → settings.snap-shot-C2X5_E0H.js} +2 -2
  174. package/dist/client/assets/{settings.source-control-CqLszsPJ.js → settings.source-control-Dvac_5mZ.js} +2 -2
  175. package/dist/client/assets/{settings.storage-JCo0X6p0.js → settings.storage-1JdpL3lo.js} +2 -2
  176. package/dist/client/assets/{settingsLayout-DkRcMtAs.js → settingsLayout-CuUCC6iL.js} +2 -2
  177. package/dist/client/assets/{sidebarProjectGrouping-C94BzdFc.js → sidebarProjectGrouping-r5ezKRMx.js} +2 -2
  178. package/dist/client/assets/{sourceControl-BvubWC9K.js → sourceControl-b1QZpCro.js} +2 -2
  179. package/dist/client/assets/{sourceControlClients-DKVeNHGN.js → sourceControlClients-DUvOeR-2.js} +2 -2
  180. package/dist/client/assets/{stateDiagram-D77RDMKH-Ctp0qVPg.js → stateDiagram-D77RDMKH-BOgNCEU1.js} +2 -2
  181. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-D00LPIWv.js +2 -0
  182. package/dist/client/assets/{swimlanes-42K2YHIH-_LIKBAWu.js → swimlanes-42K2YHIH-BZG7hJb7.js} +2 -2
  183. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-vkEAWikD.js +9 -0
  184. package/dist/client/assets/{terminalSessions-WR45SySR.js → terminalSessions-BHzkH7av.js} +2 -2
  185. package/dist/client/assets/{timeline-definition-24CTP7MA--fH4g9Xi.js → timeline-definition-24CTP7MA-B5YiUA25.js} +2 -2
  186. package/dist/client/assets/{toast-x69BFrW5.js → toast-B3hjhWRf.js} +2 -2
  187. package/dist/client/assets/{treeView-Q6P3EWNA-BYF4NjYA.js → treeView-Q6P3EWNA-Cb4H3xoG.js} +1 -1
  188. package/dist/client/assets/{treemap-WGGIJYW6-DTEnfmuA.js → treemap-WGGIJYW6-BdpTgSX1.js} +1 -1
  189. package/dist/client/assets/{uiStateStore-CP4WDmc8.js → uiStateStore-DoJ0IbwQ.js} +2 -2
  190. package/dist/client/assets/{usage-C8NW06hk.js → usage-C2lJ6qWL.js} +2 -2
  191. package/dist/client/assets/{use-atom-command-rhVarDA8.js → use-atom-command-D34CFqu3.js} +2 -2
  192. package/dist/client/assets/{useHandleNewThread-Bhl1v82B.js → useHandleNewThread-DtUtwJAY.js} +2 -2
  193. package/dist/client/assets/{useP4ConnectAuthPrompt-ubtmHQ6f.js → useP4ConnectAuthPrompt-D4kHnZ3Q.js} +2 -2
  194. package/dist/client/assets/{usePullRequestActions-Djf1UHJs.js → usePullRequestActions-BypvA9CK.js} +2 -2
  195. package/dist/client/assets/{useScopedModelAvailability-BAzgc0gB.js → useScopedModelAvailability-YXOv7_8D.js} +2 -2
  196. package/dist/client/assets/{useSettings-BNs1IeKk.js → useSettings-BcmuuiTp.js} +2 -2
  197. package/dist/client/assets/{vcsRefInvalidation-DmqB0sWy.js → vcsRefInvalidation-hPKz3TmL.js} +2 -2
  198. package/dist/client/assets/{vennDiagram-4TSXK5OY-BzIqk05W.js → vennDiagram-4TSXK5OY-D4zvlwrY.js} +2 -2
  199. package/dist/client/assets/{wardley-WFR3VGLG-CWuiB19I.js → wardley-WFR3VGLG-Cscy0eBS.js} +1 -1
  200. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-C3KRakQk.js → wardleyDiagram-VM6X3IG4-od5X9Ppf.js} +2 -2
  201. package/dist/client/assets/{welcome-BFUhADQd.js → welcome-7UQgfS5x.js} +2 -2
  202. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-cK0SAbmi.js → xychartDiagram-S5SC5T6Z-KWfWaW4I.js} +2 -2
  203. package/dist/client/index.html +1 -1
  204. package/package.json +1 -1
  205. package/dist/client/assets/architecture-7GRP2DOG-5FKzTtFB.js +0 -1
  206. package/dist/client/assets/channel-mtMr1s7n.js +0 -2
  207. package/dist/client/assets/classDiagram-ZZMXUADV-B1oFCLrU.js +0 -2
  208. package/dist/client/assets/classDiagram-v2-VYDZK3BY-B1oFCLrU.js +0 -2
  209. package/dist/client/assets/eventmodeling-NTZA5JFV-CIzOZUSe.js +0 -1
  210. package/dist/client/assets/flowDiagram-HODETNUW-G6NoS3v2.js +0 -1
  211. package/dist/client/assets/ghostty-write-pty-hgyAvVbe.wasm +0 -0
  212. package/dist/client/assets/railroad-abnf-HS5TGJTU-CFQBiMqT.js +0 -1
  213. package/dist/client/assets/railroad-ebnf-LZEXJU2U-KvUMMzpJ.js +0 -1
  214. package/dist/client/assets/railroad-peg-WCYAUIDC-ps7Jjity.js +0 -1
  215. package/dist/client/assets/settings.archived-5E_Gxvpz.js +0 -2
  216. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DTjnbS5I.js +0 -2
  217. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-BEo2_7TC.js +0 -9
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,Bp as r,Jm as i,Jp as a,Mm as o,Np as s,Pf as c,RE as l,Rf as u,Sd as d,Zn as f,_d as p,cm as m,cr as h,dd as g,er as _,fm as v,hp as y,lr as b,mE as x,nr as S,qn as C,rr as w,sm as T,t as E,tp as D,tr as O,xd as ee}from"./utils-hgbJ2TVM.js";import{B as te,I as ne,l as re}from"./TooltipViewport-DJ2VRKCt.js";import{a as k,c as A,o as j,s as M,t as ie}from"./select-Bsag72zE.js";import{t as ae}from"./spinner-Bzrp5oww.js";import{t as N}from"./query-BFP47tsD.js";import{t as P}from"./use-atom-command-rhVarDA8.js";import{u as F}from"./rightPanelStore-XfAJpUIA.js";import{A as I}from"./PanelLayoutControls-C1Bf67DQ.js";import{a as L,n as oe,t as R}from"./tooltip-D-SzZpgJ.js";import{n as se,t as ce}from"./toggle-group-Clz6KDtW.js";import{t as z}from"./input-D_jxqXLR.js";import{t as B}from"./dialog-Cgb4jap2.js";import{i as le,n as ue,r as V,t as H}from"./device-CdLsoK0D.js";import{a as U,i as W}from"./previewMiniPlayerStore-DMd0mA7a.js";import{c as de,r as fe}from"./DeviceSetup-D9F7F9pV.js";import{n as pe,t as G}from"./discovery-list-DXkskf2A.js";import{ca as K,da as q,fa as J,pa as me,ua as he}from"./main-COMts6-0.js";import{C as ge,_ as _e,v as ve,y as ye}from"./_chat-D4YotsBW.js";var Y=e(t(),1),X=l(),be=class extends Error{status;constructor(e){super(`Screenshot capture failed (${e}). Try again.`),this.status=e}};async function xe(e,t){let n=e.platform===`ios`?`serve-sim`:`serve-emu`,r=U(`${e.access.httpBase}/vendor/${n}/api/screenshot?device=${encodeURIComponent(e.deviceId)}`,e.access),i=await fetch(r,{method:`POST`,credentials:e.access.credentials?`include`:`omit`,signal:AbortSignal.any([t,AbortSignal.timeout(2e4)])});if(!i.ok)throw new be(i.status);let a=await i.blob();if(!a.size)throw Error(`The device returned an empty screenshot. Try again.`);return a}var Z=e(x(),1);function Se(e){let t=(0,X.c)(94),{view:l,handle:x,controls:S}=e,E=S.detail?.settings,O=!x?.inputConnected,ee=E?.appearance===`dark`?`light`:`dark`,k;t[0]===x?k=t[1]:(k=()=>x?.pressButton(`home`),t[0]=x,t[1]=k);let A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(c,{}),t[2]=A):A=t[2];let j;t[3]!==O||t[4]!==k?(j=(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Home`,disabled:O,onClick:k,children:A}),t[3]=O,t[4]=k,t[5]=j):j=t[5];let M;t[6]!==S||t[7]!==x||t[8]!==O||t[9]!==e.platform||t[10]!==l.keyboard?.attached?(M=e.platform===`android`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Back`,disabled:O,onClick:()=>x?.pressButton(`back`),children:(0,Z.jsx)(d,{})}),(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Recents`,disabled:O,onClick:()=>x?.pressButton(`recents`),children:(0,Z.jsx)(v,{})}),(0,Z.jsxs)(C,{children:[(0,Z.jsx)(h,{render:(0,Z.jsx)(b,{size:`icon-sm`,variant:`ghost`,"aria-label":`Rotate device`,disabled:S.disabled}),children:(0,Z.jsx)(a,{})}),(0,Z.jsxs)(n,{side:`left`,children:[(0,Z.jsx)(f,{onClick:()=>void S.act({type:`setOrientation`,value:`portrait`}),children:`Portrait`}),(0,Z.jsx)(f,{onClick:()=>void S.act({type:`setOrientation`,value:`landscape_left`}),children:`Landscape`})]})]})]}):(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Rotate device`,disabled:O||!!l.keyboard?.attached,onClick:()=>x?.rotate(),children:(0,Z.jsx)(a,{})}),t[6]=S,t[7]=x,t[8]=O,t[9]=e.platform,t[10]=l.keyboard?.attached,t[11]=M):M=t[11];let ie;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(we,{}),t[12]=ie):ie=t[12];let ae=`Switch device to ${ee} mode`,N=S.disabled||!E?.appearance,P;t[13]!==S||t[14]!==ee?(P=()=>void S.act({type:`setAppearance`,value:ee}),t[13]=S,t[14]=ee,t[15]=P):P=t[15];let F=E?.appearance===`dark`?te:ne,I;t[16]===F?I=t[17]:(I=(0,Z.jsx)(re,{icon:F}),t[16]=F,t[17]=I);let L;t[18]!==ae||t[19]!==N||t[20]!==P||t[21]!==I?(L=(0,Z.jsx)(Q,{tooltipSide:`left`,label:ae,disabled:N,onClick:P,children:I}),t[18]=ae,t[19]=N,t[20]=P,t[21]=I,t[22]=L):L=t[22];let oe=S.disabled||!E?.textSize,R;t[23]===oe?R=t[24]:(R=(0,Z.jsx)(b,{size:`icon-sm`,variant:`ghost`,"aria-label":`Device text size`,title:`Device text size`,disabled:oe}),t[23]=oe,t[24]=R);let se;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(o,{}),t[25]=se):se=t[25];let ce;t[26]===R?ce=t[27]:(ce=(0,Z.jsx)(h,{render:R,children:se}),t[26]=R,t[27]=ce);let z=E?.textSize??``,B;t[28]===S?B=t[29]:(B=e=>{(e===`small`||e==="default"||e===`large`||e===`extra-large`)&&S.act({type:`setTextSize`,value:e})},t[28]=S,t[29]=B);let le;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(le=[[`small`,`Small`],[`default`,`Default`],[`large`,`Large`],[`extra-large`,`Extra large`]],t[30]=le):le=t[30];let ue;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ue=le.map(Ce),t[31]=ue):ue=t[31];let V;t[32]!==z||t[33]!==B?(V=(0,Z.jsx)(n,{side:`left`,className:`min-w-40`,children:(0,Z.jsx)(_,{value:z,onValueChange:B,children:ue})}),t[32]=z,t[33]=B,t[34]=V):V=t[34];let H;t[35]!==ce||t[36]!==V?(H=(0,Z.jsxs)(C,{children:[ce,V]}),t[35]=ce,t[36]=V,t[37]=H):H=t[37];let U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(T,{}),t[38]=U):U=t[38];let W;t[39]!==e.onTools||t[40]!==e.toolsOpen?(W=(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Device tools`,pressed:e.toolsOpen,onClick:e.onTools,children:U}),t[39]=e.onTools,t[40]=e.toolsOpen,t[41]=W):W=t[41];let de=e.screenshotPending?`Capturing screenshot`:`Save screenshot`,fe=!l.streaming||e.screenshotPending,pe;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(p,{}),t[42]=pe):pe=t[42];let G;t[43]!==e.onScreenshot||t[44]!==de||t[45]!==fe?(G=(0,Z.jsx)(Q,{tooltipSide:`left`,label:de,disabled:fe,onClick:e.onScreenshot,children:pe}),t[43]=e.onScreenshot,t[44]=de,t[45]=fe,t[46]=G):G=t[46];let K;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(h,{render:(0,Z.jsx)(b,{size:`icon-sm`,variant:`ghost`,"aria-label":`More device actions`,title:`More device actions`}),children:(0,Z.jsx)(y,{})}),t[47]=K):K=t[47];let q;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(s,{}),t[48]=q):q=t[48];let J;t[49]===e.onFloat?J=t[50]:(J=(0,Z.jsxs)(f,{onClick:e.onFloat,children:[q,`Float device over chat`]}),t[49]=e.onFloat,t[50]=J);let me;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(i,{}),t[51]=me):me=t[51];let he;t[52]===e.onClose?he=t[53]:(he=(0,Z.jsxs)(f,{onClick:e.onClose,children:[me,`Close device panel`]}),t[52]=e.onClose,t[53]=he);let ge;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(w,{}),t[54]=ge):ge=t[54];let _e;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(r,{}),t[55]=_e):_e=t[55];let ve;t[56]===e.onPowerOff?ve=t[57]:(ve=(0,Z.jsxs)(f,{variant:`destructive`,onClick:e.onPowerOff,children:[_e,`Power off device`]}),t[56]=e.onPowerOff,t[57]=ve);let ye;t[58]!==J||t[59]!==he||t[60]!==ve?(ye=(0,Z.jsxs)(C,{children:[K,(0,Z.jsxs)(n,{side:`left`,align:`end`,children:[J,he,ge,ve]})]}),t[58]=J,t[59]=he,t[60]=ve,t[61]=ye):ye=t[61];let Y;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(we,{}),t[62]=Y):Y=t[62];let be=!l.streaming||!!l.phoneUnavailableReason,xe=l.phoneUnavailableReason??void 0,Se;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(g,{}),t[63]=Se):Se=t[63];let Te;t[64]!==be||t[65]!==xe||t[66]!==l.phone||t[67]!==l.showPhone?(Te=(0,Z.jsx)(Q,{tooltipSide:`left`,label:`3D view`,pressed:l.phone,disabled:be,description:xe,onClick:l.showPhone,children:Se}),t[64]=be,t[65]=xe,t[66]=l.phone,t[67]=l.showPhone,t[68]=Te):Te=t[68];let Ee=!l.phone,De=!l.streaming,Oe;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(m,{}),t[69]=Oe):Oe=t[69];let ke;t[70]!==Ee||t[71]!==De||t[72]!==l.showFlat?(ke=(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Flat view`,pressed:Ee,disabled:De,onClick:l.showFlat,children:Oe}),t[70]=Ee,t[71]=De,t[72]=l.showFlat,t[73]=ke):ke=t[73];let Ae;t[74]===l.keyboard?Ae=t[75]:(Ae=l.keyboard?(0,Z.jsx)(Q,{tooltipSide:`left`,label:l.keyboard.attached?`Detach Magic Keyboard`:`Attach Magic Keyboard`,pressed:l.keyboard.attached,onClick:l.keyboard.toggle,children:(0,Z.jsx)(u,{})}):null,t[74]=l.keyboard,t[75]=Ae);let je;t[76]!==l.phone||t[77]!==l.resetView?(je=l.phone?(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Restore 3D view`,onClick:l.resetView,children:(0,Z.jsx)(D,{})}):null,t[76]=l.phone,t[77]=l.resetView,t[78]=je):je=t[78];let $;t[79]!==L||t[80]!==j||t[81]!==H||t[82]!==W||t[83]!==G||t[84]!==M||t[85]!==ye||t[86]!==Te||t[87]!==ke||t[88]!==Ae||t[89]!==je?($=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex shrink-0 flex-col items-center gap-1 overflow-y-auto rounded-full border border-border/50 bg-background/80 p-2 shadow-sm [scrollbar-width:none]`,children:[j,M,ie,L,H,W,G,ye,Y,Te,ke,Ae,je]}),t[79]=L,t[80]=j,t[81]=H,t[82]=W,t[83]=G,t[84]=M,t[85]=ye,t[86]=Te,t[87]=ke,t[88]=Ae,t[89]=je,t[90]=$):$=t[90];let Me;return t[91]!==$||t[92]!==l.foldingControls?(Me=(0,Z.jsxs)(`aside`,{"aria-label":`Device controls`,"data-layout":`rail`,className:`pointer-events-none absolute inset-y-0 right-0 z-10 flex w-14 flex-col items-center gap-2 overflow-y-auto [justify-content:safe_center] py-3 pr-2 [scrollbar-width:none]`,children:[$,l.foldingControls]}),t[91]=$,t[92]=l.foldingControls,t[93]=Me):Me=t[93],Me}function Ce(e){let[t,n]=e;return(0,Z.jsx)(O,{value:t,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:n}),(0,Z.jsx)(S,{})]})},t)}function we(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`my-1 h-px w-5 shrink-0 bg-border/70`}),e[0]=t):t=e[0],t}function Q(e){let t=(0,X.c)(18),n=e.pressed?`secondary`:`ghost`,r;t[0]!==e.children||t[1]!==e.disabled||t[2]!==e.label||t[3]!==e.onClick||t[4]!==e.pressed||t[5]!==n?(r=(0,Z.jsx)(b,{size:`icon-sm`,variant:n,"aria-label":e.label,"aria-pressed":e.pressed,disabled:e.disabled,onClick:e.onClick,children:e.children}),t[0]=e.children,t[1]=e.disabled,t[2]=e.label,t[3]=e.onClick,t[4]=e.pressed,t[5]=n,t[6]=r):r=t[6];let i=r,a;t[7]!==i||t[8]!==e.description||t[9]!==e.disabled||t[10]!==e.label?(a=e.disabled&&e.description?(0,Z.jsx)(L,{render:(0,Z.jsx)(`span`,{className:`inline-flex`,tabIndex:0,role:`group`,"aria-label":e.label}),children:i}):(0,Z.jsx)(L,{render:i}),t[7]=i,t[8]=e.description,t[9]=e.disabled,t[10]=e.label,t[11]=a):a=t[11];let o=e.description??e.label,s;t[12]!==e.tooltipSide||t[13]!==o?(s=(0,Z.jsx)(oe,{side:e.tooltipSide,children:o}),t[12]=e.tooltipSide,t[13]=o,t[14]=s):s=t[14];let c;return t[15]!==a||t[16]!==s?(c=(0,Z.jsxs)(R,{children:[a,s]}),t[15]=a,t[16]=s,t[17]=c):c=t[17],c}var Te=[{value:`small`,label:`Small`},{value:`default`,label:`Default`},{value:`large`,label:`Large`},{value:`extra-large`,label:`Extra large`}],Ee=[{value:`none`,label:`None`},{value:`grayscale`,label:`Grayscale`},{value:`red-green`,label:`Red / green (protanopia)`},{value:`green-red`,label:`Green / red (deuteranopia)`},{value:`blue-yellow`,label:`Blue / yellow (tritanopia)`}],De=[{value:`portrait`,label:`Portrait`},{value:`landscape_left`,label:`Landscape left`},{value:`portrait_upside_down`,label:`Upside down`},{value:`landscape_right`,label:`Landscape right`}],Oe=[{value:`camera`,label:`Camera`},{value:`microphone`,label:`Microphone`},{value:`photos`,label:`Photos`},{value:`contacts`,label:`Contacts`},{value:`calendar`,label:`Calendar`},{value:`reminders`,label:`Reminders`},{value:`location`,label:`Location`},{value:`notifications`,label:`Notifications`},{value:`motion`,label:`Motion`},{value:`media-library`,label:`Media library`},{value:`faceid`,label:`Face ID`}],ke=[{value:`camera`,label:`Camera`},{value:`microphone`,label:`Microphone`},{value:`photos`,label:`Photos`},{value:`contacts`,label:`Contacts`},{value:`calendar`,label:`Calendar`},{value:`location`,label:`Location`},{value:`notifications`,label:`Notifications`},{value:`motion`,label:`Physical activity`}],Ae=[{label:`San Francisco`,latitude:37.7749,longitude:-122.4194},{label:`New York`,latitude:40.7128,longitude:-74.006},{label:`London`,latitude:51.5074,longitude:-.1278},{label:`Stockholm`,latitude:59.3293,longitude:18.0686},{label:`Tokyo`,latitude:35.6762,longitude:139.6503}];function je(e){let t=(0,X.c)(129),{device:n,controls:r}=e,{detail:a,pending:o,error:s,foregroundApp:c,disabled:l,act:u}=r,d=a?.settings,f=n.platform===`ios`,p;t[0]===e.className?p=t[1]:(p=E(`flex min-h-0 flex-col border-border bg-background text-sm`,e.className),t[0]=e.className,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`span`,{className:`font-medium`,children:`Tools`}),t[2]=m):m=t[2];let h;t[3]===o?h=t[4]:(h=o?(0,Z.jsx)(ae,{size:`sm`}):null,t[3]=o,t[4]=h);let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(i,{}),t[5]=g):g=t[5];let _;t[6]===e.onClose?_=t[7]:(_=(0,Z.jsx)(b,{size:`icon-xs`,variant:`ghost-muted`,"aria-label":`Close tools`,className:`ml-auto`,onClick:e.onClose,children:g}),t[6]=e.onClose,t[7]=_);let v;t[8]!==h||t[9]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b px-3`,children:[m,h,_]}),t[8]=h,t[9]=_,t[10]=v):v=t[10];let y;t[11]===s?y=t[12]:(y=s?(0,Z.jsx)(`p`,{className:`border-b bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:s}):null,t[11]=s,t[12]=y);let x;t[13]!==a||t[14]!==s?(x=a===null&&!s?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-3 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ae,{size:`sm`}),` Reading device settings…`]}):null,t[13]=a,t[14]=s,t[15]=x):x=t[15];let S;t[16]===e.hostDiagnostics?S=t[17]:(S=e.hostDiagnostics?(0,Z.jsx)($,{title:`Host diagnostics`,children:(0,Z.jsx)(`p`,{className:`whitespace-pre-line text-xs text-muted-foreground`,children:e.hostDiagnostics})}):null,t[16]=e.hostDiagnostics,t[17]=S);let C=c?.id??`—`,w;t[18]===C?w=t[19]:(w=(0,Z.jsx)(Me,{label:`Foreground`,children:(0,Z.jsx)(`span`,{className:`truncate font-mono text-xs`,children:C})}),t[18]=C,t[19]=w);let T;t[20]!==u||t[21]!==l||t[22]!==c?(T=c?(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,Z.jsx)(b,{size:`xs`,variant:`outline`,disabled:l,onClick:()=>void u({type:`terminateApp`,appId:c.id}),children:`Terminate`}),(0,Z.jsx)(b,{size:`xs`,variant:`outline`,disabled:l,onClick:()=>void u({type:`launchApp`,appId:c.id}),children:`Relaunch`})]}):null,t[20]=u,t[21]=l,t[22]=c,t[23]=T):T=t[23];let D;t[24]===u?D=t[25]:(D=e=>u({type:`openUrl`,url:e}),t[24]=u,t[25]=D);let O;t[26]!==l||t[27]!==D?(O=(0,Z.jsx)(Ie,{placeholder:`https://… or myapp://`,action:`Open`,disabled:l,onSubmit:D}),t[26]=l,t[27]=D,t[28]=O):O=t[28];let ee=f?`Bundle ID to launch`:`Package name to launch`,te;t[29]===u?te=t[30]:(te=e=>u({type:`launchApp`,appId:e}),t[29]=u,t[30]=te);let ne;t[31]!==l||t[32]!==ee||t[33]!==te?(ne=(0,Z.jsx)(Ie,{placeholder:ee,action:`Launch`,disabled:l,onSubmit:te}),t[31]=l,t[32]=ee,t[33]=te,t[34]=ne):ne=t[34];let re;t[35]!==w||t[36]!==T||t[37]!==O||t[38]!==ne?(re=(0,Z.jsxs)($,{title:`App`,children:[w,T,O,ne]}),t[35]=w,t[36]=T,t[37]=O,t[38]=ne,t[39]=re):re=t[39];let k=f?`Simulator`:`Emulator`,A;t[40]===d?A=t[41]:(A=d?.appearance?[d.appearance]:[],t[40]=d,t[41]=A);let j;t[42]===u?j=t[43]:(j=e=>{let t=e[0];(t===`light`||t===`dark`)&&u({type:`setAppearance`,value:t})},t[42]=u,t[43]=j);let M,ie;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(ce,{value:`light`,children:`Light`}),ie=(0,Z.jsx)(ce,{value:`dark`,children:`Dark`}),t[44]=M,t[45]=ie):(M=t[44],ie=t[45]);let N;t[46]!==l||t[47]!==A||t[48]!==j?(N=(0,Z.jsx)(Me,{label:`Appearance`,children:(0,Z.jsxs)(se,{"aria-label":`Appearance`,value:A,disabled:l,onValueChange:j,children:[M,ie]})}),t[46]=l,t[47]=A,t[48]=j,t[49]=N):N=t[49];let P=d?.textSize??null,F;t[50]===u?F=t[51]:(F=e=>u({type:`setTextSize`,value:e}),t[50]=u,t[51]=F);let I;t[52]!==l||t[53]!==P||t[54]!==F?(I=(0,Z.jsx)(Me,{label:`Text size`,children:(0,Z.jsx)(Pe,{ariaLabel:`Text size`,value:P,options:Te,disabled:l,onChange:F})}),t[52]=l,t[53]=P,t[54]=F,t[55]=I):I=t[55];let L;t[56]!==u||t[57]!==l||t[58]!==f||t[59]!==d?(L=f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Me,{label:`Liquid Glass`,children:(0,Z.jsxs)(se,{"aria-label":`Liquid Glass`,value:d?.liquidGlass?[d.liquidGlass]:[],disabled:l||d?.liquidGlass===void 0,onValueChange:e=>{let t=e[0];(t===`clear`||t===`tinted`)&&u({type:`setLiquidGlass`,value:t})},children:[(0,Z.jsx)(ce,{value:`clear`,children:`Clear`}),(0,Z.jsx)(ce,{value:`tinted`,children:`Tinted`})]})}),(0,Z.jsx)(Me,{label:`Color filter`,children:(0,Z.jsx)(Pe,{ariaLabel:`Color filter`,value:d?.colorFilter??null,options:Ee,disabled:l,onChange:e=>u({type:`setColorFilter`,value:e})})})]}):(0,Z.jsx)(Me,{label:`Orientation`,children:(0,Z.jsx)(Pe,{ariaLabel:`Orientation`,value:null,placeholder:`Rotate to…`,options:De,disabled:l,onChange:e=>u({type:`setOrientation`,value:e})})}),t[56]=u,t[57]=l,t[58]=f,t[59]=d,t[60]=L):L=t[60];let oe=d?.reduceMotion,R;t[61]===u?R=t[62]:(R=e=>u({type:`setToggle`,setting:`reduceMotion`,value:e}),t[61]=u,t[62]=R);let z;t[63]!==l||t[64]!==oe||t[65]!==R?(z=(0,Z.jsx)(Ne,{label:`Reduce Motion`,checked:oe,disabled:l,onChange:R}),t[63]=l,t[64]=oe,t[65]=R,t[66]=z):z=t[66];let B;t[67]!==u||t[68]!==l||t[69]!==f||t[70]!==d?.increaseContrast||t[71]!==d?.networkEnabled||t[72]!==d?.reduceTransparency||t[73]!==d?.showBorders||t[74]!==d?.voiceOver?(B=f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ne,{label:`Increase Contrast`,checked:d?.increaseContrast,disabled:l,onChange:e=>u({type:`setToggle`,setting:`increaseContrast`,value:e})}),(0,Z.jsx)(Ne,{label:`Reduce Transparency`,checked:d?.reduceTransparency,disabled:l,onChange:e=>u({type:`setToggle`,setting:`reduceTransparency`,value:e})}),(0,Z.jsx)(Ne,{label:`Show Borders`,checked:d?.showBorders,disabled:l,onChange:e=>u({type:`setToggle`,setting:`showBorders`,value:e})}),(0,Z.jsx)(Ne,{label:`VoiceOver`,checked:d?.voiceOver,disabled:l,onChange:e=>u({type:`setToggle`,setting:`voiceOver`,value:e})})]}):(0,Z.jsx)(Ne,{label:`Network`,checked:d?.networkEnabled,disabled:l,onChange:e=>u({type:`setToggle`,setting:`networkEnabled`,value:e})}),t[67]=u,t[68]=l,t[69]=f,t[70]=d?.increaseContrast,t[71]=d?.networkEnabled,t[72]=d?.reduceTransparency,t[73]=d?.showBorders,t[74]=d?.voiceOver,t[75]=B):B=t[75];let le;t[76]!==k||t[77]!==N||t[78]!==I||t[79]!==L||t[80]!==z||t[81]!==B?(le=(0,Z.jsxs)($,{title:k,children:[N,I,L,z,B]}),t[76]=k,t[77]=N,t[78]=I,t[79]=L,t[80]=z,t[81]=B,t[82]=le):le=t[82];let ue=e.access===null,V;t[83]===e?V=t[84]:(V=t=>(e.onAxOverlayChange(t),Promise.resolve()),t[83]=e,t[84]=V);let H;t[85]!==e.axOverlay||t[86]!==ue||t[87]!==V?(H=(0,Z.jsx)($,{title:`Accessibility`,children:(0,Z.jsx)(Ne,{label:`Overlay element frames`,checked:e.axOverlay,disabled:ue,onChange:V})}),t[85]=e.axOverlay,t[86]=ue,t[87]=V,t[88]=H):H=t[88];let U,W;t[89]===u?(U=t[90],W=t[91]):(U=(e,t)=>u({type:`setLocation`,latitude:e,longitude:t}),W=()=>u({type:`clearLocation`}),t[89]=u,t[90]=U,t[91]=W);let de;t[92]!==l||t[93]!==f||t[94]!==U||t[95]!==W?(de=(0,Z.jsx)(Le,{disabled:l,canClear:f,onSet:U,onClear:W}),t[92]=l,t[93]=f,t[94]=U,t[95]=W,t[96]=de):de=t[96];let fe=f?Oe:ke,pe=c?.id??``,G;t[97]===u?G=t[98]:(G=(e,t,n)=>u({type:`setPermission`,appId:e,permission:t,decision:n}),t[97]=u,t[98]=G);let K;t[99]!==l||t[100]!==f||t[101]!==fe||t[102]!==pe||t[103]!==G?(K=(0,Z.jsx)(ze,{permissions:fe,canReset:f,defaultAppId:pe,disabled:l,onDecide:G}),t[99]=l,t[100]=f,t[101]=fe,t[102]=pe,t[103]=G,t[104]=K):K=t[104];let q;t[105]!==u||t[106]!==l||t[107]!==c||t[108]!==f?(q=f?(0,Z.jsxs)($,{title:`Push notification`,children:[(0,Z.jsx)(Ie,{placeholder:`Alert text`,action:`Send`,disabled:l||!c,onSubmit:e=>c?u({type:`sendPush`,appId:c.id,payload:e}):Promise.resolve()}),c?null:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Open an app first.`})]}):null,t[105]=u,t[106]=l,t[107]=c,t[108]=f,t[109]=q):q=t[109];let J;t[110]!==n||t[111]!==f||t[112]!==e.access?(J=f&&e.access?(0,Z.jsx)(Ve,{access:e.access,device:n}):null,t[110]=n,t[111]=f,t[112]=e.access,t[113]=J):J=t[113];let me;t[114]!==re||t[115]!==le||t[116]!==H||t[117]!==de||t[118]!==K||t[119]!==q||t[120]!==J||t[121]!==y||t[122]!==x||t[123]!==S?(me=(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[y,x,S,re,le,H,de,K,q,J]}),t[114]=re,t[115]=le,t[116]=H,t[117]=de,t[118]=K,t[119]=q,t[120]=J,t[121]=y,t[122]=x,t[123]=S,t[124]=me):me=t[124];let he;return t[125]!==p||t[126]!==me||t[127]!==v?(he=(0,Z.jsxs)(`div`,{className:p,children:[v,me]}),t[125]=p,t[126]=me,t[127]=v,t[128]=he):he=t[128],he}function $(e){let t=(0,X.c)(5),n;t[0]===e.title?n=t[1]:(n=(0,Z.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:e.title}),t[0]=e.title,t[1]=n);let r;return t[2]!==e.children||t[3]!==n?(r=(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2 border-b px-3 py-2.5 last:border-b-0`,children:[n,e.children]}),t[2]=e.children,t[3]=n,t[4]=r):r=t[4],r}function Me(e){let t=(0,X.c)(7),n;t[0]===e.label?n=t[1]:(n=(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.label}),t[0]=e.label,t[1]=n);let r;t[2]===e.children?r=t[3]:(r=(0,Z.jsx)(`div`,{className:`flex min-w-0 items-center justify-end`,children:e.children}),t[2]=e.children,t[3]=r);let i;return t[4]!==n||t[5]!==r?(i=(0,Z.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3`,children:[n,r]}),t[4]=n,t[5]=r,t[6]=i):i=t[6],i}function Ne(e){let t=(0,X.c)(10),n=e.checked??!1,r=e.disabled||e.checked===void 0,i;t[0]===e?i=t[1]:(i=t=>void e.onChange(t),t[0]=e,t[1]=i);let a;t[2]!==e.label||t[3]!==n||t[4]!==r||t[5]!==i?(a=(0,Z.jsx)(me,{size:`sm`,"aria-label":e.label,checked:n,disabled:r,onCheckedChange:i}),t[2]=e.label,t[3]=n,t[4]=r,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==e.label||t[8]!==a?(o=(0,Z.jsx)(Me,{label:e.label,children:a}),t[7]=e.label,t[8]=a,t[9]=o):o=t[9],o}function Pe(e){let t=(0,X.c)(25),n;if(t[0]!==e.options||t[1]!==e.value){let r;t[3]===e.value?r=t[4]:(r=t=>t.value===e.value,t[3]=e.value,t[4]=r),n=e.options.find(r),t[0]=e.options,t[1]=e.value,t[2]=n}else n=t[2];let r=n,i=e.value,a=e.disabled,o;t[5]===e?o=t[6]:(o=t=>{t!==null&&t!==e.value&&e.onChange(t)},t[5]=e,t[6]=o);let s;t[7]!==r||t[8]!==e.placeholder?(s=r?r.label:(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:e.placeholder??`Unknown`}),t[7]=r,t[8]=e.placeholder,t[9]=s):s=t[9];let c;t[10]===s?c=t[11]:(c=(0,Z.jsx)(A,{children:s}),t[10]=s,t[11]=c);let l;t[12]!==e.ariaLabel||t[13]!==c?(l=(0,Z.jsx)(M,{size:`xs`,className:`w-40`,"aria-label":e.ariaLabel,children:c}),t[12]=e.ariaLabel,t[13]=c,t[14]=l):l=t[14];let u;t[15]===e.options?u=t[16]:(u=e.options.map(Fe),t[15]=e.options,t[16]=u);let d;t[17]===u?d=t[18]:(d=(0,Z.jsx)(j,{align:`end`,alignItemWithTrigger:!1,children:u}),t[17]=u,t[18]=d);let f;return t[19]!==e.disabled||t[20]!==e.value||t[21]!==o||t[22]!==l||t[23]!==d?(f=(0,Z.jsxs)(ie,{value:i,disabled:a,onValueChange:o,children:[l,d]}),t[19]=e.disabled,t[20]=e.value,t[21]=o,t[22]=l,t[23]=d,t[24]=f):f=t[24],f}function Fe(e){return(0,Z.jsx)(k,{value:e.value,children:e.label},e.value)}function Ie(e){let t=(0,X.c)(20),[n,r]=(0,Y.useState)(``),i;t[0]!==e||t[1]!==n?(i=()=>{let t=n.trim();t&&e.onSubmit(t).then(()=>r(``))},t[0]=e,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===a?o=t[4]:(o=e=>{e.preventDefault(),a()},t[3]=a,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>r(e.target.value),t[5]=s):s=t[5];let c;t[6]!==e.disabled||t[7]!==e.placeholder||t[8]!==n?(c=(0,Z.jsx)(z,{size:`compact`,font:`mono`,className:`min-w-0 flex-1`,placeholder:e.placeholder,value:n,disabled:e.disabled,onChange:s}),t[6]=e.disabled,t[7]=e.placeholder,t[8]=n,t[9]=c):c=t[9];let l;t[10]!==e.disabled||t[11]!==n?(l=e.disabled||n.trim().length===0,t[10]=e.disabled,t[11]=n,t[12]=l):l=t[12];let u;t[13]!==e.action||t[14]!==l?(u=(0,Z.jsx)(b,{type:`submit`,size:`xs`,variant:`outline`,disabled:l,children:e.action}),t[13]=e.action,t[14]=l,t[15]=u):u=t[15];let d;return t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,Z.jsxs)(`form`,{className:`flex gap-1.5`,onSubmit:o,children:[c,u]}),t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function Le(e){let t=(0,X.c)(40),[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(``),o=Number(n),s=Number(i),c,l;t[0]!==n||t[1]!==i||t[2]!==o||t[3]!==s?(c={latitude:o,longitude:s},l=n.trim()!==``&&i.trim()!==``&&Math.abs(c.latitude)<=90&&Math.abs(c.longitude)<=180,t[0]=n,t[1]=i,t[2]=o,t[3]=s,t[4]=c,t[5]=l):(c=t[4],l=t[5]);let u=l,d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>r(e.target.value),t[6]=d):d=t[6];let f;t[7]!==n||t[8]!==e.disabled?(f=(0,Z.jsx)(z,{size:`compact`,font:`mono`,className:`min-w-0 flex-1`,placeholder:`Latitude`,inputMode:`decimal`,value:n,disabled:e.disabled,onChange:d}),t[7]=n,t[8]=e.disabled,t[9]=f):f=t[9];let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>a(e.target.value),t[10]=p):p=t[10];let m;t[11]!==i||t[12]!==e.disabled?(m=(0,Z.jsx)(z,{size:`compact`,font:`mono`,className:`min-w-0 flex-1`,placeholder:`Longitude`,inputMode:`decimal`,value:i,disabled:e.disabled,onChange:p}),t[11]=i,t[12]=e.disabled,t[13]=m):m=t[13];let h;t[14]!==f||t[15]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,m]}),t[14]=f,t[15]=m,t[16]=h):h=t[16];let g;t[17]===e?g=t[18]:(g=t=>{let n=Ae.find(e=>e.label===t);n&&(r(String(n.latitude)),a(String(n.longitude)),e.onSet(n.latitude,n.longitude))},t[17]=e,t[18]=g);let _;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(M,{size:`xs`,className:`w-32`,"aria-label":`Location preset`,children:(0,Z.jsx)(A,{children:(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`Preset…`})})}),t[19]=_):_=t[19];let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(j,{align:`start`,alignItemWithTrigger:!1,children:Ae.map(Re)}),t[20]=v):v=t[20];let y;t[21]!==e.disabled||t[22]!==g?(y=(0,Z.jsxs)(ie,{value:null,disabled:e.disabled,onValueChange:g,children:[_,v]}),t[21]=e.disabled,t[22]=g,t[23]=y):y=t[23];let x=e.disabled||!u,S;t[24]!==c.latitude||t[25]!==c.longitude||t[26]!==e?(S=()=>void e.onSet(c.latitude,c.longitude),t[24]=c.latitude,t[25]=c.longitude,t[26]=e,t[27]=S):S=t[27];let C;t[28]!==x||t[29]!==S?(C=(0,Z.jsx)(b,{size:`xs`,variant:`outline`,disabled:x,onClick:S,children:`Set`}),t[28]=x,t[29]=S,t[30]=C):C=t[30];let w;t[31]===e?w=t[32]:(w=e.canClear?(0,Z.jsx)(b,{size:`xs`,variant:`ghost`,disabled:e.disabled,onClick:()=>{r(``),a(``),e.onClear()},children:`Clear`}):null,t[31]=e,t[32]=w);let T;t[33]!==y||t[34]!==C||t[35]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[y,C,w]}),t[33]=y,t[34]=C,t[35]=w,t[36]=T):T=t[36];let E;return t[37]!==T||t[38]!==h?(E=(0,Z.jsxs)($,{title:`Location`,children:[h,T]}),t[37]=T,t[38]=h,t[39]=E):E=t[39],E}function Re(e){return(0,Z.jsx)(k,{value:e.label,children:e.label},e.label)}function ze(e){let t=(0,X.c)(40),[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(`camera`),o;t[0]!==n||t[1]!==e.defaultAppId?(o=n.trim()||e.defaultAppId,t[0]=n,t[1]=e.defaultAppId,t[2]=o):o=t[2];let s=o,c;t[3]!==i||t[4]!==e||t[5]!==s?(c=t=>void e.onDecide(s,i,t),t[3]=i,t[4]=e,t[5]=s,t[6]=c):c=t[6];let l=c,u=e.defaultAppId||`App ID`,d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>r(e.target.value),t[7]=d):d=t[7];let f;t[8]!==n||t[9]!==e.disabled||t[10]!==u?(f=(0,Z.jsx)(z,{size:`compact`,font:`mono`,placeholder:u,value:n,disabled:e.disabled,onChange:d}),t[8]=n,t[9]=e.disabled,t[10]=u,t[11]=f):f=t[11];let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>(a(e),Promise.resolve()),t[12]=p):p=t[12];let m;t[13]!==i||t[14]!==e.disabled||t[15]!==e.permissions?(m=(0,Z.jsx)(Pe,{ariaLabel:`Permission`,value:i,options:e.permissions,disabled:e.disabled,onChange:p}),t[13]=i,t[14]=e.disabled,t[15]=e.permissions,t[16]=m):m=t[16];let h=e.disabled||!s,g;t[17]===l?g=t[18]:(g=()=>l(`grant`),t[17]=l,t[18]=g);let _;t[19]!==h||t[20]!==g?(_=(0,Z.jsx)(b,{size:`xs`,variant:`outline`,disabled:h,onClick:g,children:`Grant`}),t[19]=h,t[20]=g,t[21]=_):_=t[21];let v=e.disabled||!s,y;t[22]===l?y=t[23]:(y=()=>l(`revoke`),t[22]=l,t[23]=y);let x;t[24]!==v||t[25]!==y?(x=(0,Z.jsx)(b,{size:`xs`,variant:`outline`,disabled:v,onClick:y,children:`Revoke`}),t[24]=v,t[25]=y,t[26]=x):x=t[26];let S;t[27]!==l||t[28]!==e.canReset||t[29]!==e.disabled||t[30]!==s?(S=e.canReset?(0,Z.jsx)(b,{size:`xs`,variant:`ghost`,disabled:e.disabled||!s,onClick:()=>l(`reset`),children:`Reset`}):null,t[27]=l,t[28]=e.canReset,t[29]=e.disabled,t[30]=s,t[31]=S):S=t[31];let C;t[32]!==x||t[33]!==S||t[34]!==m||t[35]!==_?(C=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[m,_,x,S]}),t[32]=x,t[33]=S,t[34]=m,t[35]=_,t[36]=C):C=t[36];let w;return t[37]!==C||t[38]!==f?(w=(0,Z.jsxs)($,{title:`Permissions`,children:[f,C]}),t[37]=C,t[38]=f,t[39]=w):w=t[39],w}var Be=100;function Ve(e){let t=(0,X.c)(19),[n,r]=(0,Y.useState)(!1),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,Y.useState)(i),s,c;t[1]!==n||t[2]!==e.access||t[3]!==e.device.id||t[4]!==e.device.platform?(s=()=>{if(!n)return;let t=ve({access:e.access,platform:e.device.platform,deviceId:e.device.id},(e,t)=>{o(n=>{let r=t?[...e]:[...n,...e];return r.length>Be?r.slice(-100):r})});return()=>{t(),o([])}},c=[n,e.access,e.device.id,e.device.platform],t[1]=n,t[2]=e.access,t[3]=e.device.id,t[4]=e.device.platform,t[5]=s,t[6]=c):(s=t[5],c=t[6]),(0,Y.useEffect)(s,c);let l=n&&`rotate-180`,u;t[7]===l?u=t[8]:(u=E(`ml-auto size-3.5 transition-transform`,l),t[7]=l,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,Z.jsxs)(J,{className:`flex w-full items-center gap-1.5 border-b px-3 py-2.5 text-left text-xs font-medium text-muted-foreground`,children:[`Event log`,(0,Z.jsx)(ee,{className:u})]}),t[9]=u,t[10]=d);let f;t[11]===a?f=t[12]:(f=a.length===0?(0,Z.jsx)(`li`,{className:`text-muted-foreground`,children:`No events yet.`}):a.map(He),t[11]=a,t[12]=f);let p;t[13]===f?p=t[14]:(p=(0,Z.jsx)(q,{children:(0,Z.jsx)(`ol`,{className:`max-h-64 overflow-y-auto px-3 py-2 font-mono text-2xs leading-relaxed`,children:f})}),t[13]=f,t[14]=p);let m;return t[15]!==n||t[16]!==d||t[17]!==p?(m=(0,Z.jsxs)(he,{open:n,onOpenChange:r,children:[d,p]}),t[15]=n,t[16]=d,t[17]=p,t[18]=m):m=t[18],m}function He(e){return(0,Z.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.timestamp.slice(11,19)}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.summary})]},e.id)}function Ue(e){let t=(0,X.c)(30),{environmentId:n,device:r,access:i,visible:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={reportFailure:!1},t[0]=o):o=t[0];let s=P(H.detail,o),c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c={reportFailure:!1},t[1]=c):c=t[1];let l=P(H.action,c),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(),v=(0,Y.useRef)(!1),y=(0,Y.useRef)(0),b=(0,Y.useRef)(null),x;t[2]!==r.hostId||t[3]!==r.id?(x={hostId:r.hostId,deviceId:r.id},t[2]=r.hostId,t[3]=r.id,t[4]=x):x=t[4];let S=x,C,w;t[5]!==n||t[6]!==s||t[7]!==S||t[8]!==a?(C=()=>{let e=y.current+=1;if(!a)return;let t={environmentId:n,input:S};return b.current=t,s(t).then(t=>{y.current===e&&(t._tag===`Success`?(d(t.value),h(null)):(d(null),h(N(t.cause))))}),()=>{b.current=null,y.current+=1}},w=[n,s,S,a],t[5]=n,t[6]=s,t[7]=S,t[8]=a,t[9]=C,t[10]=w):(C=t[9],w=t[10]),(0,Y.useEffect)(C,w);let T,E;t[11]!==i||t[12]!==r.id||t[13]!==r.platform||t[14]!==a?(T=()=>{if(!i||!a)return;let e=!0,t=ye({access:i,platform:r.platform,deviceId:r.id},t=>{e&&_(t)});return()=>{e=!1,t(),_(void 0)}},E=[i,r.id,r.platform,a],t[11]=i,t[12]=r.id,t[13]=r.platform,t[14]=a,t[15]=T,t[16]=E):(T=t[15],E=t[16]),(0,Y.useEffect)(T,E);let D=u!==null&&a,O;t[17]!==D||t[18]!==n||t[19]!==s||t[20]!==l||t[21]!==S?(O=async e=>{if(v.current||!D)return;v.current=!0;let t=y.current+=1;return p(!0),h(null),l({environmentId:n,input:{...S,...e}}).then(e=>{if(y.current!==t){let e=b.current;if(!e)return;let t=y.current+=1;return s(e).then(e=>{y.current===t&&(e._tag===`Success`?(d(e.value),h(null)):(d(null),h(N(e.cause))))})}e._tag===`Success`?d(e.value):h(N(e.cause))}).finally(()=>{v.current=!1,p(!1)})},t[17]=D,t[18]=n,t[19]=s,t[20]=l,t[21]=S,t[22]=O):O=t[22];let ee=O,te=f||!u||!a,ne=g===void 0?u?.foregroundApp??null:g,re;return t[23]!==ee||t[24]!==u||t[25]!==m||t[26]!==f||t[27]!==te||t[28]!==ne?(re={detail:u,pending:f,error:m,act:ee,disabled:te,foregroundApp:ne},t[23]=ee,t[24]=u,t[25]=m,t[26]=f,t[27]=te,t[28]=ne,t[29]=re):re=t[29],re}function We(e){let t=(0,X.c)(51),[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(null),f=(0,Y.useRef)(null),p=(0,Y.useRef)(null),m=V(e.environmentId,e.device.hostId),h;t[0]!==m||t[1]!==e?(h={...e,access:m},t[0]=m,t[1]=e,t[2]=h):h=t[2];let g=Ue(h),_,v;t[3]!==m||t[4]!==e.visible?(_=()=>((!m||!e.visible)&&f.current?.abort(),()=>{f.current?.abort(),p.current&&URL.revokeObjectURL(p.current),p.current=null}),v=[m,e.visible],t[3]=m,t[4]=e.visible,t[5]=_,t[6]=v):(_=t[5],v=t[6]),(0,Y.useEffect)(_,v);let y;t[7]!==m||t[8]!==e.device.id||t[9]!==e.device.name||t[10]!==e.device.platform||t[11]!==e.environmentId||t[12]!==e.visible?(y=()=>{if(!m||f.current||!e.visible)return;let t=new AbortController;return f.current=t,l(!0),d(null),xe({access:m,platform:e.device.platform,deviceId:e.device.id},t.signal).then(n=>{if(t.signal.aborted)return;p.current&&URL.revokeObjectURL(p.current);let r=URL.createObjectURL(n);p.current=r;let i=document.createElement(`a`);i.href=r,i.download=`${e.device.name.replace(/[^a-z0-9-]/gi,`-`)}-${Date.now()}.png`,document.body.append(i),i.click(),i.remove()}).catch(n=>{t.signal.aborted||(n instanceof be&&n.status===401&&ue(e.environmentId),d(n instanceof Error?n.message:`Screenshot capture failed. Try again.`))}).finally(()=>{f.current===t&&(f.current=null,l(!1))})},t[7]=m,t[8]=e.device.id,t[9]=e.device.name,t[10]=e.device.platform,t[11]=e.environmentId,t[12]=e.visible,t[13]=y):y=t[13];let b=y,x;t[14]!==g||t[15]!==u||t[16]!==i?(x=u||g.error&&!i?(0,Z.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-destructive`,children:u??g.error}):null,t[14]=g,t[15]=u,t[16]=i,t[17]=x):x=t[17];let S=`${e.hostLabel} · ${e.device.version}`,C;t[18]!==g||t[19]!==n||t[20]!==e.device.platform||t[21]!==e.onClose||t[22]!==e.onFloat||t[23]!==e.onPowerOff||t[24]!==b||t[25]!==c||t[26]!==i?(C=t=>(0,Z.jsx)(Se,{platform:e.device.platform,handle:n,view:t,controls:g,screenshotPending:c,onScreenshot:()=>void b(),toolsOpen:i,onTools:()=>a(!i),onFloat:e.onFloat,onClose:e.onClose,onPowerOff:e.onPowerOff}),t[18]=g,t[19]=n,t[20]=e.device.platform,t[21]=e.onClose,t[22]=e.onFloat,t[23]=e.onPowerOff,t[24]=b,t[25]=c,t[26]=i,t[27]=C):C=t[27];let w;t[28]!==o||t[29]!==e.device.hostId||t[30]!==e.device.id||t[31]!==e.device.name||t[32]!==e.device.platform||t[33]!==e.environmentId||t[34]!==e.visible||t[35]!==S||t[36]!==C?(w=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(_e,{environmentId:e.environmentId,platform:e.device.platform,deviceName:e.device.name,deviceDescription:S,deviceId:e.device.id,hostId:e.device.hostId,visible:e.visible,axOverlay:o,allowPhoneView:!0,onHandle:r,renderControls:C})}),t[28]=o,t[29]=e.device.hostId,t[30]=e.device.id,t[31]=e.device.name,t[32]=e.device.platform,t[33]=e.environmentId,t[34]=e.visible,t[35]=S,t[36]=C,t[37]=w):w=t[37];let T;t[38]!==x||t[39]!==w?(T=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[x,w]}),t[38]=x,t[39]=w,t[40]=T):T=t[40];let E;t[41]!==m||t[42]!==o||t[43]!==g||t[44]!==e.device||t[45]!==e.hostDiagnostics||t[46]!==i?(E=i?(0,Z.jsx)(je,{device:e.device,controls:g,hostDiagnostics:e.hostDiagnostics,access:m,axOverlay:o,onAxOverlayChange:s,onClose:()=>a(!1),className:`absolute inset-y-0 right-0 z-10 w-full max-w-72 border-l shadow-lg @[700px]:static @[700px]:w-72 @[700px]:shrink-0 @[700px]:shadow-none`}):null,t[41]=m,t[42]=o,t[43]=g,t[44]=e.device,t[45]=e.hostDiagnostics,t[46]=i,t[47]=E):E=t[47];let D;return t[48]!==T||t[49]!==E?(D=(0,Z.jsxs)(Z.Fragment,{children:[T,E]}),t[48]=T,t[49]=E,t[50]=D):D=t[50],D}var Ge=e=>e===`ios`?`iOS Simulators`:`Android Emulators`,Ke=e=>`${e.hostId}\u0000${e.id}`;function qe(e){let{environmentId:t,threadId:n}=e.threadRef,{state:r,loaded:a}=le(t),o=P(H.list,{reportFailure:!1}),s=P(H.open),c=P(H.close),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),p=d?Ke(d):null,h=r.hostStatus===`disabled`;(0,Y.useEffect)(()=>{e.visible&&a&&!h&&o({environmentId:t,input:{}})},[t,o,a,e.visible,h]);let g=(0,Y.useMemo)(()=>r.sessions.filter(e=>e.threadId===n),[r.sessions,n]),_=e.surface.target?g.find(t=>t.deviceId===e.surface.target?.deviceId&&t.hostId===e.surface.target.hostId):void 0,v=_?r.devices.find(e=>e.hostId===_.hostId&&e.id===_.deviceId):void 0,y=(0,Y.useMemo)(()=>Je(r),[r]),x=async i=>{let a=r.devices.find(e=>Ke(e)===i);if(a){u(null),f(a);try{let r=await s({environmentId:t,input:{threadId:n,hostId:a.hostId,deviceId:a.id,platform:a.platform}});r._tag===`Failure`?u(N(r.cause)):F.getState().openDevice(e.threadRef,{hostId:r.value.hostId,deviceId:r.value.deviceId,platform:a.platform,name:a.name})}finally{f(null)}}},S=()=>{v&&(W.getState().open(e.threadRef,{kind:`device`,hostId:v.hostId,deviceId:v.id,platform:v.platform,name:v.name}),F.getState().close(e.threadRef))},C=r=>{if(!r){F.getState().closeSurface(e.threadRef,e.surface.id);return}_&&(u(null),c({environmentId:t,input:{threadId:n,hostId:_.hostId,deviceId:_.deviceId,shutdown:r}}).then(t=>{t._tag===`Failure`?u(N(t.cause)):F.getState().closeSurface(e.threadRef,e.surface.id)}))},w=r.bootingDevices?.filter(e=>e.threadId===n)??[],T=Object.values(r.hostStatuses).some(e=>e.status===`ready`),D=!T&&Object.values(r.hostStatuses).some(e=>e.status===`installing`||e.status===`starting`),O=r.hosts.flatMap(e=>e.platforms.filter(e=>!e.available).map(t=>({...t,hostId:e.id,hostLabel:e.label})));return a&&(!r.onboardingCompleted||h)?(0,Z.jsx)(B,{open:e.visible,onOpenChange:t=>{t||e.onDismissSetup()},children:(0,Z.jsx)(K,{children:(0,Z.jsx)(fe,{environmentId:t,state:r})})}):(0,Z.jsxs)(I,{mode:e.mode,children:[T&&!v&&r.hostStatusDetail?(0,Z.jsx)(`div`,{role:`status`,className:`whitespace-pre-line border-b px-3 py-2 text-xs text-muted-foreground`,children:r.hostStatusDetail}):null,(0,Z.jsx)(de,{state:r,environmentId:t}),w.length>0?(0,Z.jsxs)(`div`,{role:`status`,className:`border-b px-3 py-2 text-xs text-muted-foreground`,children:[`Starting `,w.map(e=>e.name).join(`, `),`… This can take a minute.`]}):null,l?(0,Z.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 border-b bg-destructive/5 px-3 py-2 text-xs text-destructive`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words`,children:l}),(0,Z.jsx)(b,{size:`icon-xs`,variant:`ghost`,"aria-label":`Dismiss device error`,onClick:()=>u(null),children:(0,Z.jsx)(i,{className:`size-3`})})]}):null,(0,Z.jsx)(`div`,{className:`@container relative flex min-h-0 flex-1`,children:v&&_?(0,Z.jsx)(We,{environmentId:t,device:v,hostLabel:r.hosts.find(e=>e.id===v.hostId)?.label??`Device host`,hostDiagnostics:r.hostStatusDetail,visible:e.visible,onFloat:S,onClose:()=>C(!1),onPowerOff:()=>C(!0)},`${t}\u0000${Ke(v)}`):d||D||!a?(0,Z.jsx)(ge,{name:d?.name??`Devices`,description:d?`${r.hosts.find(e=>e.id===d.hostId)?.label??`Device host`} · ${d.version}`:``,stage:`opening`,message:d?d.booted?`Opening device…`:`Starting device…`:r.hostStatus===`installing`?r.hostStatusDetail??`Installing device support…`:`Finding devices…`}):(0,Z.jsx)(`div`,{className:`scrollbar-gutter-both flex size-full flex-col overflow-y-auto px-5 py-8 text-sm text-muted-foreground`,children:(0,Z.jsxs)(`div`,{className:E(`mx-auto flex w-full max-w-xl flex-col gap-6`,y.length===0&&`my-auto items-center text-center`),children:[y.length===0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(m,{className:`size-6 opacity-60`}),(0,Z.jsx)(`p`,{className:`max-w-sm`,children:r.hostStatus===`failed`?r.hostStatusDetail??`The device hub failed to start.`:`No simulators or emulators were found on this environment.`})]}):null,T&&y.length>0?(0,Z.jsx)(`div`,{className:`w-full space-y-6 text-left`,children:y.map(e=>(0,Z.jsxs)(`section`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(m,{className:`size-4 shrink-0`}),(0,Z.jsx)(`h3`,{className:`font-medium`,children:Ge(e.platform)})]}),(0,Z.jsx)(G,{children:e.devices.map(e=>(0,Z.jsx)(pe,{icon:(0,Z.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-md border border-border/60`,children:(0,Z.jsx)(m,{className:`size-4`})}),title:e.name,description:`${r.hosts.find(t=>t.id===e.hostId)?.label} · ${e.version} · ${e.booted?`Running`:`Stopped`}`,disabled:p!==null,"aria-label":`${e.booted?`Open`:`Start`} ${e.name}`,onClick:()=>void x(Ke(e)),action:p===Ke(e)?(0,Z.jsx)(ae,{size:`xs`}):(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.booted?`Open`:`Start`})},Ke(e)))})]},e.platform))}):null,T&&!r.devices.some(e=>e.platform===`android`)&&!O.some(e=>e.platform===`android`)?(0,Z.jsx)(`p`,{className:`max-w-sm text-xs`,children:`No Android virtual devices found. Create one in Android Studio's Device Manager, then refresh.`}):null,a&&!D?(0,Z.jsx)(b,{className:y.length>0?`self-start`:`self-center`,variant:y.length>0?`ghost`:`outline`,size:`sm`,onClick:()=>void o({environmentId:t,input:{}}),children:`Refresh devices`}):null]})})})]})}function Je(e){let t=[];for(let n of[`ios`,`android`]){let r=e.devices.filter(e=>e.platform===n).toSorted((e,t)=>Number(t.booted)-Number(e.booted)||e.name.localeCompare(t.name));r.length>0&&t.push({platform:n,devices:r})}return t}export{qe as DevicePanel};
2
- //# sourceMappingURL=DevicePanel-D192Fic3.js.map
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,Bp as r,Jm as i,Jp as a,Mm as o,Np as s,Pf as c,RE as l,Rf as u,Sd as d,Zn as f,_d as p,cm as m,cr as h,dd as g,er as _,fm as v,hp as y,lr as b,mE as x,nr as S,qn as C,rr as w,sm as T,t as E,tp as D,tr as O,xd as ee}from"./utils-hgbJ2TVM.js";import{B as te,I as ne,l as re}from"./TooltipViewport-DJ2VRKCt.js";import{a as k,c as A,o as j,s as M,t as ie}from"./select-Bsag72zE.js";import{t as ae}from"./spinner-Bzrp5oww.js";import{t as N}from"./query-BFP47tsD.js";import{t as P}from"./use-atom-command-D34CFqu3.js";import{u as F}from"./rightPanelStore-XfAJpUIA.js";import{A as I}from"./PanelLayoutControls-C2deQDB2.js";import{a as L,n as oe,t as R}from"./tooltip-D-SzZpgJ.js";import{n as se,t as ce}from"./toggle-group-Clz6KDtW.js";import{t as z}from"./input-D_jxqXLR.js";import{t as B}from"./dialog-Cgb4jap2.js";import{i as le,n as ue,r as V,t as H}from"./device-DnfWBPpo.js";import{a as U,i as W}from"./previewMiniPlayerStore-DMd0mA7a.js";import{c as de,r as fe}from"./DeviceSetup-Dm9ZbkMC.js";import{n as pe,t as G}from"./discovery-list-DXkskf2A.js";import{ca as K,da as q,fa as J,pa as me,ua as he}from"./main-4dRVuXx2.js";import{C as ge,_ as _e,v as ve,y as ye}from"./_chat-C0vR23gu.js";var Y=e(t(),1),X=l(),be=class extends Error{status;constructor(e){super(`Screenshot capture failed (${e}). Try again.`),this.status=e}};async function xe(e,t){let n=e.platform===`ios`?`serve-sim`:`serve-emu`,r=U(`${e.access.httpBase}/vendor/${n}/api/screenshot?device=${encodeURIComponent(e.deviceId)}`,e.access),i=await fetch(r,{method:`POST`,credentials:e.access.credentials?`include`:`omit`,signal:AbortSignal.any([t,AbortSignal.timeout(2e4)])});if(!i.ok)throw new be(i.status);let a=await i.blob();if(!a.size)throw Error(`The device returned an empty screenshot. Try again.`);return a}var Z=e(x(),1);function Se(e){let t=(0,X.c)(94),{view:l,handle:x,controls:S}=e,E=S.detail?.settings,O=!x?.inputConnected,ee=E?.appearance===`dark`?`light`:`dark`,k;t[0]===x?k=t[1]:(k=()=>x?.pressButton(`home`),t[0]=x,t[1]=k);let A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(c,{}),t[2]=A):A=t[2];let j;t[3]!==O||t[4]!==k?(j=(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Home`,disabled:O,onClick:k,children:A}),t[3]=O,t[4]=k,t[5]=j):j=t[5];let M;t[6]!==S||t[7]!==x||t[8]!==O||t[9]!==e.platform||t[10]!==l.keyboard?.attached?(M=e.platform===`android`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Back`,disabled:O,onClick:()=>x?.pressButton(`back`),children:(0,Z.jsx)(d,{})}),(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Recents`,disabled:O,onClick:()=>x?.pressButton(`recents`),children:(0,Z.jsx)(v,{})}),(0,Z.jsxs)(C,{children:[(0,Z.jsx)(h,{render:(0,Z.jsx)(b,{size:`icon-sm`,variant:`ghost`,"aria-label":`Rotate device`,disabled:S.disabled}),children:(0,Z.jsx)(a,{})}),(0,Z.jsxs)(n,{side:`left`,children:[(0,Z.jsx)(f,{onClick:()=>void S.act({type:`setOrientation`,value:`portrait`}),children:`Portrait`}),(0,Z.jsx)(f,{onClick:()=>void S.act({type:`setOrientation`,value:`landscape_left`}),children:`Landscape`})]})]})]}):(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Rotate device`,disabled:O||!!l.keyboard?.attached,onClick:()=>x?.rotate(),children:(0,Z.jsx)(a,{})}),t[6]=S,t[7]=x,t[8]=O,t[9]=e.platform,t[10]=l.keyboard?.attached,t[11]=M):M=t[11];let ie;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(we,{}),t[12]=ie):ie=t[12];let ae=`Switch device to ${ee} mode`,N=S.disabled||!E?.appearance,P;t[13]!==S||t[14]!==ee?(P=()=>void S.act({type:`setAppearance`,value:ee}),t[13]=S,t[14]=ee,t[15]=P):P=t[15];let F=E?.appearance===`dark`?te:ne,I;t[16]===F?I=t[17]:(I=(0,Z.jsx)(re,{icon:F}),t[16]=F,t[17]=I);let L;t[18]!==ae||t[19]!==N||t[20]!==P||t[21]!==I?(L=(0,Z.jsx)(Q,{tooltipSide:`left`,label:ae,disabled:N,onClick:P,children:I}),t[18]=ae,t[19]=N,t[20]=P,t[21]=I,t[22]=L):L=t[22];let oe=S.disabled||!E?.textSize,R;t[23]===oe?R=t[24]:(R=(0,Z.jsx)(b,{size:`icon-sm`,variant:`ghost`,"aria-label":`Device text size`,title:`Device text size`,disabled:oe}),t[23]=oe,t[24]=R);let se;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(o,{}),t[25]=se):se=t[25];let ce;t[26]===R?ce=t[27]:(ce=(0,Z.jsx)(h,{render:R,children:se}),t[26]=R,t[27]=ce);let z=E?.textSize??``,B;t[28]===S?B=t[29]:(B=e=>{(e===`small`||e==="default"||e===`large`||e===`extra-large`)&&S.act({type:`setTextSize`,value:e})},t[28]=S,t[29]=B);let le;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(le=[[`small`,`Small`],[`default`,`Default`],[`large`,`Large`],[`extra-large`,`Extra large`]],t[30]=le):le=t[30];let ue;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ue=le.map(Ce),t[31]=ue):ue=t[31];let V;t[32]!==z||t[33]!==B?(V=(0,Z.jsx)(n,{side:`left`,className:`min-w-40`,children:(0,Z.jsx)(_,{value:z,onValueChange:B,children:ue})}),t[32]=z,t[33]=B,t[34]=V):V=t[34];let H;t[35]!==ce||t[36]!==V?(H=(0,Z.jsxs)(C,{children:[ce,V]}),t[35]=ce,t[36]=V,t[37]=H):H=t[37];let U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(T,{}),t[38]=U):U=t[38];let W;t[39]!==e.onTools||t[40]!==e.toolsOpen?(W=(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Device tools`,pressed:e.toolsOpen,onClick:e.onTools,children:U}),t[39]=e.onTools,t[40]=e.toolsOpen,t[41]=W):W=t[41];let de=e.screenshotPending?`Capturing screenshot`:`Save screenshot`,fe=!l.streaming||e.screenshotPending,pe;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(p,{}),t[42]=pe):pe=t[42];let G;t[43]!==e.onScreenshot||t[44]!==de||t[45]!==fe?(G=(0,Z.jsx)(Q,{tooltipSide:`left`,label:de,disabled:fe,onClick:e.onScreenshot,children:pe}),t[43]=e.onScreenshot,t[44]=de,t[45]=fe,t[46]=G):G=t[46];let K;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(h,{render:(0,Z.jsx)(b,{size:`icon-sm`,variant:`ghost`,"aria-label":`More device actions`,title:`More device actions`}),children:(0,Z.jsx)(y,{})}),t[47]=K):K=t[47];let q;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(s,{}),t[48]=q):q=t[48];let J;t[49]===e.onFloat?J=t[50]:(J=(0,Z.jsxs)(f,{onClick:e.onFloat,children:[q,`Float device over chat`]}),t[49]=e.onFloat,t[50]=J);let me;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(i,{}),t[51]=me):me=t[51];let he;t[52]===e.onClose?he=t[53]:(he=(0,Z.jsxs)(f,{onClick:e.onClose,children:[me,`Close device panel`]}),t[52]=e.onClose,t[53]=he);let ge;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(w,{}),t[54]=ge):ge=t[54];let _e;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(r,{}),t[55]=_e):_e=t[55];let ve;t[56]===e.onPowerOff?ve=t[57]:(ve=(0,Z.jsxs)(f,{variant:`destructive`,onClick:e.onPowerOff,children:[_e,`Power off device`]}),t[56]=e.onPowerOff,t[57]=ve);let ye;t[58]!==J||t[59]!==he||t[60]!==ve?(ye=(0,Z.jsxs)(C,{children:[K,(0,Z.jsxs)(n,{side:`left`,align:`end`,children:[J,he,ge,ve]})]}),t[58]=J,t[59]=he,t[60]=ve,t[61]=ye):ye=t[61];let Y;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(we,{}),t[62]=Y):Y=t[62];let be=!l.streaming||!!l.phoneUnavailableReason,xe=l.phoneUnavailableReason??void 0,Se;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(g,{}),t[63]=Se):Se=t[63];let Te;t[64]!==be||t[65]!==xe||t[66]!==l.phone||t[67]!==l.showPhone?(Te=(0,Z.jsx)(Q,{tooltipSide:`left`,label:`3D view`,pressed:l.phone,disabled:be,description:xe,onClick:l.showPhone,children:Se}),t[64]=be,t[65]=xe,t[66]=l.phone,t[67]=l.showPhone,t[68]=Te):Te=t[68];let Ee=!l.phone,De=!l.streaming,Oe;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(m,{}),t[69]=Oe):Oe=t[69];let ke;t[70]!==Ee||t[71]!==De||t[72]!==l.showFlat?(ke=(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Flat view`,pressed:Ee,disabled:De,onClick:l.showFlat,children:Oe}),t[70]=Ee,t[71]=De,t[72]=l.showFlat,t[73]=ke):ke=t[73];let Ae;t[74]===l.keyboard?Ae=t[75]:(Ae=l.keyboard?(0,Z.jsx)(Q,{tooltipSide:`left`,label:l.keyboard.attached?`Detach Magic Keyboard`:`Attach Magic Keyboard`,pressed:l.keyboard.attached,onClick:l.keyboard.toggle,children:(0,Z.jsx)(u,{})}):null,t[74]=l.keyboard,t[75]=Ae);let je;t[76]!==l.phone||t[77]!==l.resetView?(je=l.phone?(0,Z.jsx)(Q,{tooltipSide:`left`,label:`Restore 3D view`,onClick:l.resetView,children:(0,Z.jsx)(D,{})}):null,t[76]=l.phone,t[77]=l.resetView,t[78]=je):je=t[78];let $;t[79]!==L||t[80]!==j||t[81]!==H||t[82]!==W||t[83]!==G||t[84]!==M||t[85]!==ye||t[86]!==Te||t[87]!==ke||t[88]!==Ae||t[89]!==je?($=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex shrink-0 flex-col items-center gap-1 overflow-y-auto rounded-full border border-border/50 bg-background/80 p-2 shadow-sm [scrollbar-width:none]`,children:[j,M,ie,L,H,W,G,ye,Y,Te,ke,Ae,je]}),t[79]=L,t[80]=j,t[81]=H,t[82]=W,t[83]=G,t[84]=M,t[85]=ye,t[86]=Te,t[87]=ke,t[88]=Ae,t[89]=je,t[90]=$):$=t[90];let Me;return t[91]!==$||t[92]!==l.foldingControls?(Me=(0,Z.jsxs)(`aside`,{"aria-label":`Device controls`,"data-layout":`rail`,className:`pointer-events-none absolute inset-y-0 right-0 z-10 flex w-14 flex-col items-center gap-2 overflow-y-auto [justify-content:safe_center] py-3 pr-2 [scrollbar-width:none]`,children:[$,l.foldingControls]}),t[91]=$,t[92]=l.foldingControls,t[93]=Me):Me=t[93],Me}function Ce(e){let[t,n]=e;return(0,Z.jsx)(O,{value:t,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:n}),(0,Z.jsx)(S,{})]})},t)}function we(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`my-1 h-px w-5 shrink-0 bg-border/70`}),e[0]=t):t=e[0],t}function Q(e){let t=(0,X.c)(18),n=e.pressed?`secondary`:`ghost`,r;t[0]!==e.children||t[1]!==e.disabled||t[2]!==e.label||t[3]!==e.onClick||t[4]!==e.pressed||t[5]!==n?(r=(0,Z.jsx)(b,{size:`icon-sm`,variant:n,"aria-label":e.label,"aria-pressed":e.pressed,disabled:e.disabled,onClick:e.onClick,children:e.children}),t[0]=e.children,t[1]=e.disabled,t[2]=e.label,t[3]=e.onClick,t[4]=e.pressed,t[5]=n,t[6]=r):r=t[6];let i=r,a;t[7]!==i||t[8]!==e.description||t[9]!==e.disabled||t[10]!==e.label?(a=e.disabled&&e.description?(0,Z.jsx)(L,{render:(0,Z.jsx)(`span`,{className:`inline-flex`,tabIndex:0,role:`group`,"aria-label":e.label}),children:i}):(0,Z.jsx)(L,{render:i}),t[7]=i,t[8]=e.description,t[9]=e.disabled,t[10]=e.label,t[11]=a):a=t[11];let o=e.description??e.label,s;t[12]!==e.tooltipSide||t[13]!==o?(s=(0,Z.jsx)(oe,{side:e.tooltipSide,children:o}),t[12]=e.tooltipSide,t[13]=o,t[14]=s):s=t[14];let c;return t[15]!==a||t[16]!==s?(c=(0,Z.jsxs)(R,{children:[a,s]}),t[15]=a,t[16]=s,t[17]=c):c=t[17],c}var Te=[{value:`small`,label:`Small`},{value:`default`,label:`Default`},{value:`large`,label:`Large`},{value:`extra-large`,label:`Extra large`}],Ee=[{value:`none`,label:`None`},{value:`grayscale`,label:`Grayscale`},{value:`red-green`,label:`Red / green (protanopia)`},{value:`green-red`,label:`Green / red (deuteranopia)`},{value:`blue-yellow`,label:`Blue / yellow (tritanopia)`}],De=[{value:`portrait`,label:`Portrait`},{value:`landscape_left`,label:`Landscape left`},{value:`portrait_upside_down`,label:`Upside down`},{value:`landscape_right`,label:`Landscape right`}],Oe=[{value:`camera`,label:`Camera`},{value:`microphone`,label:`Microphone`},{value:`photos`,label:`Photos`},{value:`contacts`,label:`Contacts`},{value:`calendar`,label:`Calendar`},{value:`reminders`,label:`Reminders`},{value:`location`,label:`Location`},{value:`notifications`,label:`Notifications`},{value:`motion`,label:`Motion`},{value:`media-library`,label:`Media library`},{value:`faceid`,label:`Face ID`}],ke=[{value:`camera`,label:`Camera`},{value:`microphone`,label:`Microphone`},{value:`photos`,label:`Photos`},{value:`contacts`,label:`Contacts`},{value:`calendar`,label:`Calendar`},{value:`location`,label:`Location`},{value:`notifications`,label:`Notifications`},{value:`motion`,label:`Physical activity`}],Ae=[{label:`San Francisco`,latitude:37.7749,longitude:-122.4194},{label:`New York`,latitude:40.7128,longitude:-74.006},{label:`London`,latitude:51.5074,longitude:-.1278},{label:`Stockholm`,latitude:59.3293,longitude:18.0686},{label:`Tokyo`,latitude:35.6762,longitude:139.6503}];function je(e){let t=(0,X.c)(129),{device:n,controls:r}=e,{detail:a,pending:o,error:s,foregroundApp:c,disabled:l,act:u}=r,d=a?.settings,f=n.platform===`ios`,p;t[0]===e.className?p=t[1]:(p=E(`flex min-h-0 flex-col border-border bg-background text-sm`,e.className),t[0]=e.className,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`span`,{className:`font-medium`,children:`Tools`}),t[2]=m):m=t[2];let h;t[3]===o?h=t[4]:(h=o?(0,Z.jsx)(ae,{size:`sm`}):null,t[3]=o,t[4]=h);let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(i,{}),t[5]=g):g=t[5];let _;t[6]===e.onClose?_=t[7]:(_=(0,Z.jsx)(b,{size:`icon-xs`,variant:`ghost-muted`,"aria-label":`Close tools`,className:`ml-auto`,onClick:e.onClose,children:g}),t[6]=e.onClose,t[7]=_);let v;t[8]!==h||t[9]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b px-3`,children:[m,h,_]}),t[8]=h,t[9]=_,t[10]=v):v=t[10];let y;t[11]===s?y=t[12]:(y=s?(0,Z.jsx)(`p`,{className:`border-b bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:s}):null,t[11]=s,t[12]=y);let x;t[13]!==a||t[14]!==s?(x=a===null&&!s?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-3 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ae,{size:`sm`}),` Reading device settings…`]}):null,t[13]=a,t[14]=s,t[15]=x):x=t[15];let S;t[16]===e.hostDiagnostics?S=t[17]:(S=e.hostDiagnostics?(0,Z.jsx)($,{title:`Host diagnostics`,children:(0,Z.jsx)(`p`,{className:`whitespace-pre-line text-xs text-muted-foreground`,children:e.hostDiagnostics})}):null,t[16]=e.hostDiagnostics,t[17]=S);let C=c?.id??`—`,w;t[18]===C?w=t[19]:(w=(0,Z.jsx)(Me,{label:`Foreground`,children:(0,Z.jsx)(`span`,{className:`truncate font-mono text-xs`,children:C})}),t[18]=C,t[19]=w);let T;t[20]!==u||t[21]!==l||t[22]!==c?(T=c?(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,Z.jsx)(b,{size:`xs`,variant:`outline`,disabled:l,onClick:()=>void u({type:`terminateApp`,appId:c.id}),children:`Terminate`}),(0,Z.jsx)(b,{size:`xs`,variant:`outline`,disabled:l,onClick:()=>void u({type:`launchApp`,appId:c.id}),children:`Relaunch`})]}):null,t[20]=u,t[21]=l,t[22]=c,t[23]=T):T=t[23];let D;t[24]===u?D=t[25]:(D=e=>u({type:`openUrl`,url:e}),t[24]=u,t[25]=D);let O;t[26]!==l||t[27]!==D?(O=(0,Z.jsx)(Ie,{placeholder:`https://… or myapp://`,action:`Open`,disabled:l,onSubmit:D}),t[26]=l,t[27]=D,t[28]=O):O=t[28];let ee=f?`Bundle ID to launch`:`Package name to launch`,te;t[29]===u?te=t[30]:(te=e=>u({type:`launchApp`,appId:e}),t[29]=u,t[30]=te);let ne;t[31]!==l||t[32]!==ee||t[33]!==te?(ne=(0,Z.jsx)(Ie,{placeholder:ee,action:`Launch`,disabled:l,onSubmit:te}),t[31]=l,t[32]=ee,t[33]=te,t[34]=ne):ne=t[34];let re;t[35]!==w||t[36]!==T||t[37]!==O||t[38]!==ne?(re=(0,Z.jsxs)($,{title:`App`,children:[w,T,O,ne]}),t[35]=w,t[36]=T,t[37]=O,t[38]=ne,t[39]=re):re=t[39];let k=f?`Simulator`:`Emulator`,A;t[40]===d?A=t[41]:(A=d?.appearance?[d.appearance]:[],t[40]=d,t[41]=A);let j;t[42]===u?j=t[43]:(j=e=>{let t=e[0];(t===`light`||t===`dark`)&&u({type:`setAppearance`,value:t})},t[42]=u,t[43]=j);let M,ie;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(ce,{value:`light`,children:`Light`}),ie=(0,Z.jsx)(ce,{value:`dark`,children:`Dark`}),t[44]=M,t[45]=ie):(M=t[44],ie=t[45]);let N;t[46]!==l||t[47]!==A||t[48]!==j?(N=(0,Z.jsx)(Me,{label:`Appearance`,children:(0,Z.jsxs)(se,{"aria-label":`Appearance`,value:A,disabled:l,onValueChange:j,children:[M,ie]})}),t[46]=l,t[47]=A,t[48]=j,t[49]=N):N=t[49];let P=d?.textSize??null,F;t[50]===u?F=t[51]:(F=e=>u({type:`setTextSize`,value:e}),t[50]=u,t[51]=F);let I;t[52]!==l||t[53]!==P||t[54]!==F?(I=(0,Z.jsx)(Me,{label:`Text size`,children:(0,Z.jsx)(Pe,{ariaLabel:`Text size`,value:P,options:Te,disabled:l,onChange:F})}),t[52]=l,t[53]=P,t[54]=F,t[55]=I):I=t[55];let L;t[56]!==u||t[57]!==l||t[58]!==f||t[59]!==d?(L=f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Me,{label:`Liquid Glass`,children:(0,Z.jsxs)(se,{"aria-label":`Liquid Glass`,value:d?.liquidGlass?[d.liquidGlass]:[],disabled:l||d?.liquidGlass===void 0,onValueChange:e=>{let t=e[0];(t===`clear`||t===`tinted`)&&u({type:`setLiquidGlass`,value:t})},children:[(0,Z.jsx)(ce,{value:`clear`,children:`Clear`}),(0,Z.jsx)(ce,{value:`tinted`,children:`Tinted`})]})}),(0,Z.jsx)(Me,{label:`Color filter`,children:(0,Z.jsx)(Pe,{ariaLabel:`Color filter`,value:d?.colorFilter??null,options:Ee,disabled:l,onChange:e=>u({type:`setColorFilter`,value:e})})})]}):(0,Z.jsx)(Me,{label:`Orientation`,children:(0,Z.jsx)(Pe,{ariaLabel:`Orientation`,value:null,placeholder:`Rotate to…`,options:De,disabled:l,onChange:e=>u({type:`setOrientation`,value:e})})}),t[56]=u,t[57]=l,t[58]=f,t[59]=d,t[60]=L):L=t[60];let oe=d?.reduceMotion,R;t[61]===u?R=t[62]:(R=e=>u({type:`setToggle`,setting:`reduceMotion`,value:e}),t[61]=u,t[62]=R);let z;t[63]!==l||t[64]!==oe||t[65]!==R?(z=(0,Z.jsx)(Ne,{label:`Reduce Motion`,checked:oe,disabled:l,onChange:R}),t[63]=l,t[64]=oe,t[65]=R,t[66]=z):z=t[66];let B;t[67]!==u||t[68]!==l||t[69]!==f||t[70]!==d?.increaseContrast||t[71]!==d?.networkEnabled||t[72]!==d?.reduceTransparency||t[73]!==d?.showBorders||t[74]!==d?.voiceOver?(B=f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ne,{label:`Increase Contrast`,checked:d?.increaseContrast,disabled:l,onChange:e=>u({type:`setToggle`,setting:`increaseContrast`,value:e})}),(0,Z.jsx)(Ne,{label:`Reduce Transparency`,checked:d?.reduceTransparency,disabled:l,onChange:e=>u({type:`setToggle`,setting:`reduceTransparency`,value:e})}),(0,Z.jsx)(Ne,{label:`Show Borders`,checked:d?.showBorders,disabled:l,onChange:e=>u({type:`setToggle`,setting:`showBorders`,value:e})}),(0,Z.jsx)(Ne,{label:`VoiceOver`,checked:d?.voiceOver,disabled:l,onChange:e=>u({type:`setToggle`,setting:`voiceOver`,value:e})})]}):(0,Z.jsx)(Ne,{label:`Network`,checked:d?.networkEnabled,disabled:l,onChange:e=>u({type:`setToggle`,setting:`networkEnabled`,value:e})}),t[67]=u,t[68]=l,t[69]=f,t[70]=d?.increaseContrast,t[71]=d?.networkEnabled,t[72]=d?.reduceTransparency,t[73]=d?.showBorders,t[74]=d?.voiceOver,t[75]=B):B=t[75];let le;t[76]!==k||t[77]!==N||t[78]!==I||t[79]!==L||t[80]!==z||t[81]!==B?(le=(0,Z.jsxs)($,{title:k,children:[N,I,L,z,B]}),t[76]=k,t[77]=N,t[78]=I,t[79]=L,t[80]=z,t[81]=B,t[82]=le):le=t[82];let ue=e.access===null,V;t[83]===e?V=t[84]:(V=t=>(e.onAxOverlayChange(t),Promise.resolve()),t[83]=e,t[84]=V);let H;t[85]!==e.axOverlay||t[86]!==ue||t[87]!==V?(H=(0,Z.jsx)($,{title:`Accessibility`,children:(0,Z.jsx)(Ne,{label:`Overlay element frames`,checked:e.axOverlay,disabled:ue,onChange:V})}),t[85]=e.axOverlay,t[86]=ue,t[87]=V,t[88]=H):H=t[88];let U,W;t[89]===u?(U=t[90],W=t[91]):(U=(e,t)=>u({type:`setLocation`,latitude:e,longitude:t}),W=()=>u({type:`clearLocation`}),t[89]=u,t[90]=U,t[91]=W);let de;t[92]!==l||t[93]!==f||t[94]!==U||t[95]!==W?(de=(0,Z.jsx)(Le,{disabled:l,canClear:f,onSet:U,onClear:W}),t[92]=l,t[93]=f,t[94]=U,t[95]=W,t[96]=de):de=t[96];let fe=f?Oe:ke,pe=c?.id??``,G;t[97]===u?G=t[98]:(G=(e,t,n)=>u({type:`setPermission`,appId:e,permission:t,decision:n}),t[97]=u,t[98]=G);let K;t[99]!==l||t[100]!==f||t[101]!==fe||t[102]!==pe||t[103]!==G?(K=(0,Z.jsx)(ze,{permissions:fe,canReset:f,defaultAppId:pe,disabled:l,onDecide:G}),t[99]=l,t[100]=f,t[101]=fe,t[102]=pe,t[103]=G,t[104]=K):K=t[104];let q;t[105]!==u||t[106]!==l||t[107]!==c||t[108]!==f?(q=f?(0,Z.jsxs)($,{title:`Push notification`,children:[(0,Z.jsx)(Ie,{placeholder:`Alert text`,action:`Send`,disabled:l||!c,onSubmit:e=>c?u({type:`sendPush`,appId:c.id,payload:e}):Promise.resolve()}),c?null:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Open an app first.`})]}):null,t[105]=u,t[106]=l,t[107]=c,t[108]=f,t[109]=q):q=t[109];let J;t[110]!==n||t[111]!==f||t[112]!==e.access?(J=f&&e.access?(0,Z.jsx)(Ve,{access:e.access,device:n}):null,t[110]=n,t[111]=f,t[112]=e.access,t[113]=J):J=t[113];let me;t[114]!==re||t[115]!==le||t[116]!==H||t[117]!==de||t[118]!==K||t[119]!==q||t[120]!==J||t[121]!==y||t[122]!==x||t[123]!==S?(me=(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[y,x,S,re,le,H,de,K,q,J]}),t[114]=re,t[115]=le,t[116]=H,t[117]=de,t[118]=K,t[119]=q,t[120]=J,t[121]=y,t[122]=x,t[123]=S,t[124]=me):me=t[124];let he;return t[125]!==p||t[126]!==me||t[127]!==v?(he=(0,Z.jsxs)(`div`,{className:p,children:[v,me]}),t[125]=p,t[126]=me,t[127]=v,t[128]=he):he=t[128],he}function $(e){let t=(0,X.c)(5),n;t[0]===e.title?n=t[1]:(n=(0,Z.jsx)(`h3`,{className:`text-xs font-medium text-muted-foreground`,children:e.title}),t[0]=e.title,t[1]=n);let r;return t[2]!==e.children||t[3]!==n?(r=(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2 border-b px-3 py-2.5 last:border-b-0`,children:[n,e.children]}),t[2]=e.children,t[3]=n,t[4]=r):r=t[4],r}function Me(e){let t=(0,X.c)(7),n;t[0]===e.label?n=t[1]:(n=(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.label}),t[0]=e.label,t[1]=n);let r;t[2]===e.children?r=t[3]:(r=(0,Z.jsx)(`div`,{className:`flex min-w-0 items-center justify-end`,children:e.children}),t[2]=e.children,t[3]=r);let i;return t[4]!==n||t[5]!==r?(i=(0,Z.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3`,children:[n,r]}),t[4]=n,t[5]=r,t[6]=i):i=t[6],i}function Ne(e){let t=(0,X.c)(10),n=e.checked??!1,r=e.disabled||e.checked===void 0,i;t[0]===e?i=t[1]:(i=t=>void e.onChange(t),t[0]=e,t[1]=i);let a;t[2]!==e.label||t[3]!==n||t[4]!==r||t[5]!==i?(a=(0,Z.jsx)(me,{size:`sm`,"aria-label":e.label,checked:n,disabled:r,onCheckedChange:i}),t[2]=e.label,t[3]=n,t[4]=r,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==e.label||t[8]!==a?(o=(0,Z.jsx)(Me,{label:e.label,children:a}),t[7]=e.label,t[8]=a,t[9]=o):o=t[9],o}function Pe(e){let t=(0,X.c)(25),n;if(t[0]!==e.options||t[1]!==e.value){let r;t[3]===e.value?r=t[4]:(r=t=>t.value===e.value,t[3]=e.value,t[4]=r),n=e.options.find(r),t[0]=e.options,t[1]=e.value,t[2]=n}else n=t[2];let r=n,i=e.value,a=e.disabled,o;t[5]===e?o=t[6]:(o=t=>{t!==null&&t!==e.value&&e.onChange(t)},t[5]=e,t[6]=o);let s;t[7]!==r||t[8]!==e.placeholder?(s=r?r.label:(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:e.placeholder??`Unknown`}),t[7]=r,t[8]=e.placeholder,t[9]=s):s=t[9];let c;t[10]===s?c=t[11]:(c=(0,Z.jsx)(A,{children:s}),t[10]=s,t[11]=c);let l;t[12]!==e.ariaLabel||t[13]!==c?(l=(0,Z.jsx)(M,{size:`xs`,className:`w-40`,"aria-label":e.ariaLabel,children:c}),t[12]=e.ariaLabel,t[13]=c,t[14]=l):l=t[14];let u;t[15]===e.options?u=t[16]:(u=e.options.map(Fe),t[15]=e.options,t[16]=u);let d;t[17]===u?d=t[18]:(d=(0,Z.jsx)(j,{align:`end`,alignItemWithTrigger:!1,children:u}),t[17]=u,t[18]=d);let f;return t[19]!==e.disabled||t[20]!==e.value||t[21]!==o||t[22]!==l||t[23]!==d?(f=(0,Z.jsxs)(ie,{value:i,disabled:a,onValueChange:o,children:[l,d]}),t[19]=e.disabled,t[20]=e.value,t[21]=o,t[22]=l,t[23]=d,t[24]=f):f=t[24],f}function Fe(e){return(0,Z.jsx)(k,{value:e.value,children:e.label},e.value)}function Ie(e){let t=(0,X.c)(20),[n,r]=(0,Y.useState)(``),i;t[0]!==e||t[1]!==n?(i=()=>{let t=n.trim();t&&e.onSubmit(t).then(()=>r(``))},t[0]=e,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===a?o=t[4]:(o=e=>{e.preventDefault(),a()},t[3]=a,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>r(e.target.value),t[5]=s):s=t[5];let c;t[6]!==e.disabled||t[7]!==e.placeholder||t[8]!==n?(c=(0,Z.jsx)(z,{size:`compact`,font:`mono`,className:`min-w-0 flex-1`,placeholder:e.placeholder,value:n,disabled:e.disabled,onChange:s}),t[6]=e.disabled,t[7]=e.placeholder,t[8]=n,t[9]=c):c=t[9];let l;t[10]!==e.disabled||t[11]!==n?(l=e.disabled||n.trim().length===0,t[10]=e.disabled,t[11]=n,t[12]=l):l=t[12];let u;t[13]!==e.action||t[14]!==l?(u=(0,Z.jsx)(b,{type:`submit`,size:`xs`,variant:`outline`,disabled:l,children:e.action}),t[13]=e.action,t[14]=l,t[15]=u):u=t[15];let d;return t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,Z.jsxs)(`form`,{className:`flex gap-1.5`,onSubmit:o,children:[c,u]}),t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function Le(e){let t=(0,X.c)(40),[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(``),o=Number(n),s=Number(i),c,l;t[0]!==n||t[1]!==i||t[2]!==o||t[3]!==s?(c={latitude:o,longitude:s},l=n.trim()!==``&&i.trim()!==``&&Math.abs(c.latitude)<=90&&Math.abs(c.longitude)<=180,t[0]=n,t[1]=i,t[2]=o,t[3]=s,t[4]=c,t[5]=l):(c=t[4],l=t[5]);let u=l,d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>r(e.target.value),t[6]=d):d=t[6];let f;t[7]!==n||t[8]!==e.disabled?(f=(0,Z.jsx)(z,{size:`compact`,font:`mono`,className:`min-w-0 flex-1`,placeholder:`Latitude`,inputMode:`decimal`,value:n,disabled:e.disabled,onChange:d}),t[7]=n,t[8]=e.disabled,t[9]=f):f=t[9];let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>a(e.target.value),t[10]=p):p=t[10];let m;t[11]!==i||t[12]!==e.disabled?(m=(0,Z.jsx)(z,{size:`compact`,font:`mono`,className:`min-w-0 flex-1`,placeholder:`Longitude`,inputMode:`decimal`,value:i,disabled:e.disabled,onChange:p}),t[11]=i,t[12]=e.disabled,t[13]=m):m=t[13];let h;t[14]!==f||t[15]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,m]}),t[14]=f,t[15]=m,t[16]=h):h=t[16];let g;t[17]===e?g=t[18]:(g=t=>{let n=Ae.find(e=>e.label===t);n&&(r(String(n.latitude)),a(String(n.longitude)),e.onSet(n.latitude,n.longitude))},t[17]=e,t[18]=g);let _;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(M,{size:`xs`,className:`w-32`,"aria-label":`Location preset`,children:(0,Z.jsx)(A,{children:(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`Preset…`})})}),t[19]=_):_=t[19];let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(j,{align:`start`,alignItemWithTrigger:!1,children:Ae.map(Re)}),t[20]=v):v=t[20];let y;t[21]!==e.disabled||t[22]!==g?(y=(0,Z.jsxs)(ie,{value:null,disabled:e.disabled,onValueChange:g,children:[_,v]}),t[21]=e.disabled,t[22]=g,t[23]=y):y=t[23];let x=e.disabled||!u,S;t[24]!==c.latitude||t[25]!==c.longitude||t[26]!==e?(S=()=>void e.onSet(c.latitude,c.longitude),t[24]=c.latitude,t[25]=c.longitude,t[26]=e,t[27]=S):S=t[27];let C;t[28]!==x||t[29]!==S?(C=(0,Z.jsx)(b,{size:`xs`,variant:`outline`,disabled:x,onClick:S,children:`Set`}),t[28]=x,t[29]=S,t[30]=C):C=t[30];let w;t[31]===e?w=t[32]:(w=e.canClear?(0,Z.jsx)(b,{size:`xs`,variant:`ghost`,disabled:e.disabled,onClick:()=>{r(``),a(``),e.onClear()},children:`Clear`}):null,t[31]=e,t[32]=w);let T;t[33]!==y||t[34]!==C||t[35]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[y,C,w]}),t[33]=y,t[34]=C,t[35]=w,t[36]=T):T=t[36];let E;return t[37]!==T||t[38]!==h?(E=(0,Z.jsxs)($,{title:`Location`,children:[h,T]}),t[37]=T,t[38]=h,t[39]=E):E=t[39],E}function Re(e){return(0,Z.jsx)(k,{value:e.label,children:e.label},e.label)}function ze(e){let t=(0,X.c)(40),[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(`camera`),o;t[0]!==n||t[1]!==e.defaultAppId?(o=n.trim()||e.defaultAppId,t[0]=n,t[1]=e.defaultAppId,t[2]=o):o=t[2];let s=o,c;t[3]!==i||t[4]!==e||t[5]!==s?(c=t=>void e.onDecide(s,i,t),t[3]=i,t[4]=e,t[5]=s,t[6]=c):c=t[6];let l=c,u=e.defaultAppId||`App ID`,d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>r(e.target.value),t[7]=d):d=t[7];let f;t[8]!==n||t[9]!==e.disabled||t[10]!==u?(f=(0,Z.jsx)(z,{size:`compact`,font:`mono`,placeholder:u,value:n,disabled:e.disabled,onChange:d}),t[8]=n,t[9]=e.disabled,t[10]=u,t[11]=f):f=t[11];let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>(a(e),Promise.resolve()),t[12]=p):p=t[12];let m;t[13]!==i||t[14]!==e.disabled||t[15]!==e.permissions?(m=(0,Z.jsx)(Pe,{ariaLabel:`Permission`,value:i,options:e.permissions,disabled:e.disabled,onChange:p}),t[13]=i,t[14]=e.disabled,t[15]=e.permissions,t[16]=m):m=t[16];let h=e.disabled||!s,g;t[17]===l?g=t[18]:(g=()=>l(`grant`),t[17]=l,t[18]=g);let _;t[19]!==h||t[20]!==g?(_=(0,Z.jsx)(b,{size:`xs`,variant:`outline`,disabled:h,onClick:g,children:`Grant`}),t[19]=h,t[20]=g,t[21]=_):_=t[21];let v=e.disabled||!s,y;t[22]===l?y=t[23]:(y=()=>l(`revoke`),t[22]=l,t[23]=y);let x;t[24]!==v||t[25]!==y?(x=(0,Z.jsx)(b,{size:`xs`,variant:`outline`,disabled:v,onClick:y,children:`Revoke`}),t[24]=v,t[25]=y,t[26]=x):x=t[26];let S;t[27]!==l||t[28]!==e.canReset||t[29]!==e.disabled||t[30]!==s?(S=e.canReset?(0,Z.jsx)(b,{size:`xs`,variant:`ghost`,disabled:e.disabled||!s,onClick:()=>l(`reset`),children:`Reset`}):null,t[27]=l,t[28]=e.canReset,t[29]=e.disabled,t[30]=s,t[31]=S):S=t[31];let C;t[32]!==x||t[33]!==S||t[34]!==m||t[35]!==_?(C=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[m,_,x,S]}),t[32]=x,t[33]=S,t[34]=m,t[35]=_,t[36]=C):C=t[36];let w;return t[37]!==C||t[38]!==f?(w=(0,Z.jsxs)($,{title:`Permissions`,children:[f,C]}),t[37]=C,t[38]=f,t[39]=w):w=t[39],w}var Be=100;function Ve(e){let t=(0,X.c)(19),[n,r]=(0,Y.useState)(!1),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,Y.useState)(i),s,c;t[1]!==n||t[2]!==e.access||t[3]!==e.device.id||t[4]!==e.device.platform?(s=()=>{if(!n)return;let t=ve({access:e.access,platform:e.device.platform,deviceId:e.device.id},(e,t)=>{o(n=>{let r=t?[...e]:[...n,...e];return r.length>Be?r.slice(-100):r})});return()=>{t(),o([])}},c=[n,e.access,e.device.id,e.device.platform],t[1]=n,t[2]=e.access,t[3]=e.device.id,t[4]=e.device.platform,t[5]=s,t[6]=c):(s=t[5],c=t[6]),(0,Y.useEffect)(s,c);let l=n&&`rotate-180`,u;t[7]===l?u=t[8]:(u=E(`ml-auto size-3.5 transition-transform`,l),t[7]=l,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,Z.jsxs)(J,{className:`flex w-full items-center gap-1.5 border-b px-3 py-2.5 text-left text-xs font-medium text-muted-foreground`,children:[`Event log`,(0,Z.jsx)(ee,{className:u})]}),t[9]=u,t[10]=d);let f;t[11]===a?f=t[12]:(f=a.length===0?(0,Z.jsx)(`li`,{className:`text-muted-foreground`,children:`No events yet.`}):a.map(He),t[11]=a,t[12]=f);let p;t[13]===f?p=t[14]:(p=(0,Z.jsx)(q,{children:(0,Z.jsx)(`ol`,{className:`max-h-64 overflow-y-auto px-3 py-2 font-mono text-2xs leading-relaxed`,children:f})}),t[13]=f,t[14]=p);let m;return t[15]!==n||t[16]!==d||t[17]!==p?(m=(0,Z.jsxs)(he,{open:n,onOpenChange:r,children:[d,p]}),t[15]=n,t[16]=d,t[17]=p,t[18]=m):m=t[18],m}function He(e){return(0,Z.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.timestamp.slice(11,19)}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.summary})]},e.id)}function Ue(e){let t=(0,X.c)(30),{environmentId:n,device:r,access:i,visible:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={reportFailure:!1},t[0]=o):o=t[0];let s=P(H.detail,o),c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c={reportFailure:!1},t[1]=c):c=t[1];let l=P(H.action,c),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(),v=(0,Y.useRef)(!1),y=(0,Y.useRef)(0),b=(0,Y.useRef)(null),x;t[2]!==r.hostId||t[3]!==r.id?(x={hostId:r.hostId,deviceId:r.id},t[2]=r.hostId,t[3]=r.id,t[4]=x):x=t[4];let S=x,C,w;t[5]!==n||t[6]!==s||t[7]!==S||t[8]!==a?(C=()=>{let e=y.current+=1;if(!a)return;let t={environmentId:n,input:S};return b.current=t,s(t).then(t=>{y.current===e&&(t._tag===`Success`?(d(t.value),h(null)):(d(null),h(N(t.cause))))}),()=>{b.current=null,y.current+=1}},w=[n,s,S,a],t[5]=n,t[6]=s,t[7]=S,t[8]=a,t[9]=C,t[10]=w):(C=t[9],w=t[10]),(0,Y.useEffect)(C,w);let T,E;t[11]!==i||t[12]!==r.id||t[13]!==r.platform||t[14]!==a?(T=()=>{if(!i||!a)return;let e=!0,t=ye({access:i,platform:r.platform,deviceId:r.id},t=>{e&&_(t)});return()=>{e=!1,t(),_(void 0)}},E=[i,r.id,r.platform,a],t[11]=i,t[12]=r.id,t[13]=r.platform,t[14]=a,t[15]=T,t[16]=E):(T=t[15],E=t[16]),(0,Y.useEffect)(T,E);let D=u!==null&&a,O;t[17]!==D||t[18]!==n||t[19]!==s||t[20]!==l||t[21]!==S?(O=async e=>{if(v.current||!D)return;v.current=!0;let t=y.current+=1;return p(!0),h(null),l({environmentId:n,input:{...S,...e}}).then(e=>{if(y.current!==t){let e=b.current;if(!e)return;let t=y.current+=1;return s(e).then(e=>{y.current===t&&(e._tag===`Success`?(d(e.value),h(null)):(d(null),h(N(e.cause))))})}e._tag===`Success`?d(e.value):h(N(e.cause))}).finally(()=>{v.current=!1,p(!1)})},t[17]=D,t[18]=n,t[19]=s,t[20]=l,t[21]=S,t[22]=O):O=t[22];let ee=O,te=f||!u||!a,ne=g===void 0?u?.foregroundApp??null:g,re;return t[23]!==ee||t[24]!==u||t[25]!==m||t[26]!==f||t[27]!==te||t[28]!==ne?(re={detail:u,pending:f,error:m,act:ee,disabled:te,foregroundApp:ne},t[23]=ee,t[24]=u,t[25]=m,t[26]=f,t[27]=te,t[28]=ne,t[29]=re):re=t[29],re}function We(e){let t=(0,X.c)(51),[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(null),f=(0,Y.useRef)(null),p=(0,Y.useRef)(null),m=V(e.environmentId,e.device.hostId),h;t[0]!==m||t[1]!==e?(h={...e,access:m},t[0]=m,t[1]=e,t[2]=h):h=t[2];let g=Ue(h),_,v;t[3]!==m||t[4]!==e.visible?(_=()=>((!m||!e.visible)&&f.current?.abort(),()=>{f.current?.abort(),p.current&&URL.revokeObjectURL(p.current),p.current=null}),v=[m,e.visible],t[3]=m,t[4]=e.visible,t[5]=_,t[6]=v):(_=t[5],v=t[6]),(0,Y.useEffect)(_,v);let y;t[7]!==m||t[8]!==e.device.id||t[9]!==e.device.name||t[10]!==e.device.platform||t[11]!==e.environmentId||t[12]!==e.visible?(y=()=>{if(!m||f.current||!e.visible)return;let t=new AbortController;return f.current=t,l(!0),d(null),xe({access:m,platform:e.device.platform,deviceId:e.device.id},t.signal).then(n=>{if(t.signal.aborted)return;p.current&&URL.revokeObjectURL(p.current);let r=URL.createObjectURL(n);p.current=r;let i=document.createElement(`a`);i.href=r,i.download=`${e.device.name.replace(/[^a-z0-9-]/gi,`-`)}-${Date.now()}.png`,document.body.append(i),i.click(),i.remove()}).catch(n=>{t.signal.aborted||(n instanceof be&&n.status===401&&ue(e.environmentId),d(n instanceof Error?n.message:`Screenshot capture failed. Try again.`))}).finally(()=>{f.current===t&&(f.current=null,l(!1))})},t[7]=m,t[8]=e.device.id,t[9]=e.device.name,t[10]=e.device.platform,t[11]=e.environmentId,t[12]=e.visible,t[13]=y):y=t[13];let b=y,x;t[14]!==g||t[15]!==u||t[16]!==i?(x=u||g.error&&!i?(0,Z.jsx)(`p`,{role:`alert`,className:`px-3 py-2 text-xs text-destructive`,children:u??g.error}):null,t[14]=g,t[15]=u,t[16]=i,t[17]=x):x=t[17];let S=`${e.hostLabel} · ${e.device.version}`,C;t[18]!==g||t[19]!==n||t[20]!==e.device.platform||t[21]!==e.onClose||t[22]!==e.onFloat||t[23]!==e.onPowerOff||t[24]!==b||t[25]!==c||t[26]!==i?(C=t=>(0,Z.jsx)(Se,{platform:e.device.platform,handle:n,view:t,controls:g,screenshotPending:c,onScreenshot:()=>void b(),toolsOpen:i,onTools:()=>a(!i),onFloat:e.onFloat,onClose:e.onClose,onPowerOff:e.onPowerOff}),t[18]=g,t[19]=n,t[20]=e.device.platform,t[21]=e.onClose,t[22]=e.onFloat,t[23]=e.onPowerOff,t[24]=b,t[25]=c,t[26]=i,t[27]=C):C=t[27];let w;t[28]!==o||t[29]!==e.device.hostId||t[30]!==e.device.id||t[31]!==e.device.name||t[32]!==e.device.platform||t[33]!==e.environmentId||t[34]!==e.visible||t[35]!==S||t[36]!==C?(w=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(_e,{environmentId:e.environmentId,platform:e.device.platform,deviceName:e.device.name,deviceDescription:S,deviceId:e.device.id,hostId:e.device.hostId,visible:e.visible,axOverlay:o,allowPhoneView:!0,onHandle:r,renderControls:C})}),t[28]=o,t[29]=e.device.hostId,t[30]=e.device.id,t[31]=e.device.name,t[32]=e.device.platform,t[33]=e.environmentId,t[34]=e.visible,t[35]=S,t[36]=C,t[37]=w):w=t[37];let T;t[38]!==x||t[39]!==w?(T=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[x,w]}),t[38]=x,t[39]=w,t[40]=T):T=t[40];let E;t[41]!==m||t[42]!==o||t[43]!==g||t[44]!==e.device||t[45]!==e.hostDiagnostics||t[46]!==i?(E=i?(0,Z.jsx)(je,{device:e.device,controls:g,hostDiagnostics:e.hostDiagnostics,access:m,axOverlay:o,onAxOverlayChange:s,onClose:()=>a(!1),className:`absolute inset-y-0 right-0 z-10 w-full max-w-72 border-l shadow-lg @[700px]:static @[700px]:w-72 @[700px]:shrink-0 @[700px]:shadow-none`}):null,t[41]=m,t[42]=o,t[43]=g,t[44]=e.device,t[45]=e.hostDiagnostics,t[46]=i,t[47]=E):E=t[47];let D;return t[48]!==T||t[49]!==E?(D=(0,Z.jsxs)(Z.Fragment,{children:[T,E]}),t[48]=T,t[49]=E,t[50]=D):D=t[50],D}var Ge=e=>e===`ios`?`iOS Simulators`:`Android Emulators`,Ke=e=>`${e.hostId}\u0000${e.id}`;function qe(e){let{environmentId:t,threadId:n}=e.threadRef,{state:r,loaded:a}=le(t),o=P(H.list,{reportFailure:!1}),s=P(H.open),c=P(H.close),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),p=d?Ke(d):null,h=r.hostStatus===`disabled`;(0,Y.useEffect)(()=>{e.visible&&a&&!h&&o({environmentId:t,input:{}})},[t,o,a,e.visible,h]);let g=(0,Y.useMemo)(()=>r.sessions.filter(e=>e.threadId===n),[r.sessions,n]),_=e.surface.target?g.find(t=>t.deviceId===e.surface.target?.deviceId&&t.hostId===e.surface.target.hostId):void 0,v=_?r.devices.find(e=>e.hostId===_.hostId&&e.id===_.deviceId):void 0,y=(0,Y.useMemo)(()=>Je(r),[r]),x=async i=>{let a=r.devices.find(e=>Ke(e)===i);if(a){u(null),f(a);try{let r=await s({environmentId:t,input:{threadId:n,hostId:a.hostId,deviceId:a.id,platform:a.platform}});r._tag===`Failure`?u(N(r.cause)):F.getState().openDevice(e.threadRef,{hostId:r.value.hostId,deviceId:r.value.deviceId,platform:a.platform,name:a.name})}finally{f(null)}}},S=()=>{v&&(W.getState().open(e.threadRef,{kind:`device`,hostId:v.hostId,deviceId:v.id,platform:v.platform,name:v.name}),F.getState().close(e.threadRef))},C=r=>{if(!r){F.getState().closeSurface(e.threadRef,e.surface.id);return}_&&(u(null),c({environmentId:t,input:{threadId:n,hostId:_.hostId,deviceId:_.deviceId,shutdown:r}}).then(t=>{t._tag===`Failure`?u(N(t.cause)):F.getState().closeSurface(e.threadRef,e.surface.id)}))},w=r.bootingDevices?.filter(e=>e.threadId===n)??[],T=Object.values(r.hostStatuses).some(e=>e.status===`ready`),D=!T&&Object.values(r.hostStatuses).some(e=>e.status===`installing`||e.status===`starting`),O=r.hosts.flatMap(e=>e.platforms.filter(e=>!e.available).map(t=>({...t,hostId:e.id,hostLabel:e.label})));return a&&(!r.onboardingCompleted||h)?(0,Z.jsx)(B,{open:e.visible,onOpenChange:t=>{t||e.onDismissSetup()},children:(0,Z.jsx)(K,{children:(0,Z.jsx)(fe,{environmentId:t,state:r})})}):(0,Z.jsxs)(I,{mode:e.mode,children:[T&&!v&&r.hostStatusDetail?(0,Z.jsx)(`div`,{role:`status`,className:`whitespace-pre-line border-b px-3 py-2 text-xs text-muted-foreground`,children:r.hostStatusDetail}):null,(0,Z.jsx)(de,{state:r,environmentId:t}),w.length>0?(0,Z.jsxs)(`div`,{role:`status`,className:`border-b px-3 py-2 text-xs text-muted-foreground`,children:[`Starting `,w.map(e=>e.name).join(`, `),`… This can take a minute.`]}):null,l?(0,Z.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 border-b bg-destructive/5 px-3 py-2 text-xs text-destructive`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words`,children:l}),(0,Z.jsx)(b,{size:`icon-xs`,variant:`ghost`,"aria-label":`Dismiss device error`,onClick:()=>u(null),children:(0,Z.jsx)(i,{className:`size-3`})})]}):null,(0,Z.jsx)(`div`,{className:`@container relative flex min-h-0 flex-1`,children:v&&_?(0,Z.jsx)(We,{environmentId:t,device:v,hostLabel:r.hosts.find(e=>e.id===v.hostId)?.label??`Device host`,hostDiagnostics:r.hostStatusDetail,visible:e.visible,onFloat:S,onClose:()=>C(!1),onPowerOff:()=>C(!0)},`${t}\u0000${Ke(v)}`):d||D||!a?(0,Z.jsx)(ge,{name:d?.name??`Devices`,description:d?`${r.hosts.find(e=>e.id===d.hostId)?.label??`Device host`} · ${d.version}`:``,stage:`opening`,message:d?d.booted?`Opening device…`:`Starting device…`:r.hostStatus===`installing`?r.hostStatusDetail??`Installing device support…`:`Finding devices…`}):(0,Z.jsx)(`div`,{className:`scrollbar-gutter-both flex size-full flex-col overflow-y-auto px-5 py-8 text-sm text-muted-foreground`,children:(0,Z.jsxs)(`div`,{className:E(`mx-auto flex w-full max-w-xl flex-col gap-6`,y.length===0&&`my-auto items-center text-center`),children:[y.length===0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(m,{className:`size-6 opacity-60`}),(0,Z.jsx)(`p`,{className:`max-w-sm`,children:r.hostStatus===`failed`?r.hostStatusDetail??`The device hub failed to start.`:`No simulators or emulators were found on this environment.`})]}):null,T&&y.length>0?(0,Z.jsx)(`div`,{className:`w-full space-y-6 text-left`,children:y.map(e=>(0,Z.jsxs)(`section`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(m,{className:`size-4 shrink-0`}),(0,Z.jsx)(`h3`,{className:`font-medium`,children:Ge(e.platform)})]}),(0,Z.jsx)(G,{children:e.devices.map(e=>(0,Z.jsx)(pe,{icon:(0,Z.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-md border border-border/60`,children:(0,Z.jsx)(m,{className:`size-4`})}),title:e.name,description:`${r.hosts.find(t=>t.id===e.hostId)?.label} · ${e.version} · ${e.booted?`Running`:`Stopped`}`,disabled:p!==null,"aria-label":`${e.booted?`Open`:`Start`} ${e.name}`,onClick:()=>void x(Ke(e)),action:p===Ke(e)?(0,Z.jsx)(ae,{size:`xs`}):(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.booted?`Open`:`Start`})},Ke(e)))})]},e.platform))}):null,T&&!r.devices.some(e=>e.platform===`android`)&&!O.some(e=>e.platform===`android`)?(0,Z.jsx)(`p`,{className:`max-w-sm text-xs`,children:`No Android virtual devices found. Create one in Android Studio's Device Manager, then refresh.`}):null,a&&!D?(0,Z.jsx)(b,{className:y.length>0?`self-start`:`self-center`,variant:y.length>0?`ghost`:`outline`,size:`sm`,onClick:()=>void o({environmentId:t,input:{}}),children:`Refresh devices`}):null]})})})]})}function Je(e){let t=[];for(let n of[`ios`,`android`]){let r=e.devices.filter(e=>e.platform===n).toSorted((e,t)=>Number(t.booted)-Number(e.booted)||e.name.localeCompare(t.name));r.length>0&&t.push({platform:n,devices:r})}return t}export{qe as DevicePanel};
2
+ //# sourceMappingURL=DevicePanel-DWlHQcLW.js.map
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{O_ as n,RE as r,bd as i,lr as a,mE as o,t as s}from"./utils-hgbJ2TVM.js";import{d as c,l,v as u}from"./TooltipViewport-DJ2VRKCt.js";import{t as d}from"./spinner-Bzrp5oww.js";import{i as f,n as p}from"./session-pjgqVscl.js";import{t as m}from"./use-atom-command-rhVarDA8.js";import{n as h}from"./dialog-Cgb4jap2.js";import{t as g}from"./device-CdLsoK0D.js";import{aa as _,la as v,oa as y,pa as b,sa as x}from"./main-COMts6-0.js";var S=r(),C=e(t(),1),w=e(o(),1);function T(e){let t=(0,S.c)(15),{state:n,environmentId:r}=e,i=m(g.list),[o,s]=(0,C.useState)(null);if(n.hostStatus===`disabled`)return null;let c;if(t[0]!==r||t[1]!==o||t[2]!==i||t[3]!==n.hostStatuses||t[4]!==n.hosts||t[5]!==n.supportsHostRetry){let e;t[7]!==r||t[8]!==o||t[9]!==i||t[10]!==n.hostStatuses||t[11]!==n.supportsHostRetry?(e=e=>{let t=n.hostStatuses[e.id];if(!t||![`installing`,`starting`,`failed`].includes(t.status))return null;let c=t.status===`failed`;return(0,w.jsxs)(`div`,{role:c?`alert`:`status`,className:`flex items-start gap-3 rounded-md border border-border/60 px-3 py-2 text-xs`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`p`,{className:`font-medium`,children:e.label}),(0,w.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-muted-foreground`,children:t.detail??(c?`Device support could not start.`:t.status===`installing`?`Installing device tools…`:`Starting device tools…`)}),c?(0,w.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Check the host connection and network access, then retry. Your device settings are saved.`}):null]}),c&&n.supportsHostRetry?(0,w.jsx)(a,{size:`compact`,variant:`outline`,disabled:o!==null,onClick:()=>{s(e.id),i({environmentId:r,input:{retryHostId:e.id}}).finally(()=>s(null))},children:o===e.id?`Retrying…`:`Retry`}):null]},e.id)},t[7]=r,t[8]=o,t[9]=i,t[10]=n.hostStatuses,t[11]=n.supportsHostRetry,t[12]=e):e=t[12],c=n.hosts.map(e),t[0]=r,t[1]=o,t[2]=i,t[3]=n.hostStatuses,t[4]=n.hosts,t[5]=n.supportsHostRetry,t[6]=c}else c=t[6];let l;return t[13]===c?l=t[14]:(l=(0,w.jsx)(`div`,{className:`space-y-2`,children:c}),t[13]=c,t[14]=l),l}var E=e=>e===`ios`?`iOS`:`Android`,D=`Enable this environment to open simulators and emulators, whether they run here or on a remote device host.`,O=`Allow new agent sessions in this environment to start and control local and remote devices, with required tools set up automatically.`;function k(e,t){let n=e.hosts.flatMap(e=>e.platforms).find(e=>e.platform===t);return n?.available?e.hostStatus===`ready`&&!e.devices.some(e=>e.platform===t)?{ready:!1,message:t===`ios`?`Xcode is installed, but no iOS Simulator is available. Install a runtime in Xcode Settings → Components.`:`The Android SDK is installed, but no virtual device exists. Create one in Android Studio → Device Manager.`}:{ready:!0,message:t===`ios`?`Xcode and iOS Simulator are available.`:`The Android SDK and Emulator are available.`}:{ready:!1,message:n?.reason??`${E(t)} support was not detected.`}}function A(e){let t=f(e.environmentId,n),r=m(g.configure),i=m(g.list,{reportFailure:!1}),[o,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(0),d=e.state.hostStatus!==`disabled`,S=e.state.hostStatus===`installing`||e.state.hostStatus===`starting`,E=e.state.hosts.some(e=>e.kind===`local`&&!e.platforms.some(e=>e.available)),k=async(t,n)=>{if(p(e.environmentId,`settings:write`)){c(t);try{let i=await r({environmentId:e.environmentId,input:n});t===`complete`&&i._tag===`Success`&&e.onComplete?.()}finally{c(null)}}};return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y,{title:`Set up devices`,description:`Review what runs on this environment before using simulators and emulators.`,children:(0,w.jsx)(v,{steps:[`Device hub`,`Simulators`,`Agent access`],currentStep:l,onStepChange:u,isStepDisabled:e=>S||o!==null||e>l})}),(0,w.jsxs)(x,{children:[(0,w.jsx)(T,{state:e.state,environmentId:e.environmentId}),l===0?(0,w.jsxs)(`section`,{className:`space-y-3 text-sm`,children:[(0,w.jsx)(`h3`,{className:`font-medium`,children:`Enable the device hub`}),(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,w.jsx)(`p`,{className:`text-muted-foreground`,children:D}),(0,w.jsx)(b,{checked:d,disabled:!t||S||o!==null,"aria-label":`Enable device hub`,onCheckedChange:e=>void k(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]}),(0,w.jsx)(j,{state:e.state,pending:o===`hub`||S&&o!==`agent`})]}):null,l===1||l===0&&d&&E?(0,w.jsxs)(`section`,{className:s(`space-y-3 text-sm`,l===0&&`mt-4`),children:[(0,w.jsx)(`h3`,{className:`font-medium`,children:`Check simulator support`}),(0,w.jsx)(M,{state:e.state,checking:o===`check`,disabled:!d||S||o!==null,onCheck:()=>{c(`check`),i({environmentId:e.environmentId,input:{}}).finally(()=>c(null))}})]}):null,l===2?(0,w.jsxs)(`section`,{className:`space-y-3 text-sm`,children:[(0,w.jsx)(`h3`,{className:`font-medium`,children:`Allow agent control`}),(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,w.jsx)(`p`,{className:`text-muted-foreground`,children:O}),(0,w.jsx)(b,{checked:e.state.agentAccessEnabled,disabled:!t||!d||S||o!==null,"aria-label":`Allow agents to control devices`,onCheckedChange:e=>void k(`agent`,{agentAccessEnabled:!!e})})]}),(0,w.jsx)(N,{state:e.state,pending:o===`agent`}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Leave this off to keep manual device controls without giving agents access.`})]}):null,e.state.hostStatus===`failed`&&e.state.hostStatusDetail?(0,w.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-destructive`,children:e.state.hostStatusDetail}):null]}),(0,w.jsxs)(_,{children:[l===0?(0,w.jsx)(h,{render:(0,w.jsx)(a,{variant:`outline`}),children:`Cancel`}):(0,w.jsx)(a,{variant:`outline`,disabled:S||o!==null,onClick:()=>u(l-1),children:`Back`}),l<2?(0,w.jsx)(a,{disabled:e.state.hostStatus!==`ready`||o!==null,onClick:()=>u(l+1),children:`Continue`}):(0,w.jsx)(a,{disabled:!t||e.state.hostStatus!==`ready`||o!==null,onClick:()=>void k(`complete`,{onboardingCompleted:!0}),children:o===`complete`?`Saving…`:`Done`})]})]})}function j(e){let t=(0,S.c)(5),{state:n,pending:r,compact:a}=e,o=a!==void 0&&a;if(!r&&n.hostStatus!==`ready`)return null;let s;t[0]===r?s=t[1]:(s=r?(0,w.jsx)(d,{size:`xs`}):(0,w.jsx)(i,{className:`size-3 text-success`}),t[0]=r,t[1]=s);let c=r?n.hostStatus===`installing`?o?`Installing…`:`Installing device hub…`:n.hostStatus===`starting`?o?`Starting…`:`Starting device hub…`:o?`Updating…`:`Updating device hub…`:`Device hub is ready.`,l;return t[2]!==s||t[3]!==c?(l=(0,w.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[s,c]}),t[2]=s,t[3]=c,t[4]=l):l=t[4],l}function M(e){let t=(0,S.c)(20),n;t[0]===e.state?n=t[1]:(n=k(e.state,`ios`),t[0]=e.state,t[1]=n);let r;t[2]===n?r=t[3]:(r=(0,w.jsx)(F,{platform:`iOS`,status:n}),t[2]=n,t[3]=r);let i;t[4]===e.state?i=t[5]:(i=k(e.state,`android`),t[4]=e.state,t[5]=i);let o;t[6]===i?o=t[7]:(o=(0,w.jsx)(F,{platform:`Android`,status:i}),t[6]=i,t[7]=o);let s;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`You can use either platform. Fixing a missing platform does not block the other one.`}),t[8]=s):s=t[8];let c;t[9]===e.checking?c=t[10]:(c=e.checking?(0,w.jsx)(d,{size:`xs`}):null,t[9]=e.checking,t[10]=c);let l=e.checking?`Checking…`:`Check again`,u;t[11]!==e.disabled||t[12]!==e.onCheck||t[13]!==c||t[14]!==l?(u=(0,w.jsxs)(a,{size:`compact`,variant:`outline`,disabled:e.disabled,onClick:e.onCheck,children:[c,l]}),t[11]=e.disabled,t[12]=e.onCheck,t[13]=c,t[14]=l,t[15]=u):u=t[15];let f;return t[16]!==r||t[17]!==o||t[18]!==u?(f=(0,w.jsxs)(`div`,{className:`space-y-3`,children:[r,o,s,u]}),t[16]=r,t[17]=o,t[18]=u,t[19]=f):f=t[19],f}function N(e){let t=(0,S.c)(4);if(e.pending){let n=e.state.hostStatus===`installing`?e.compact?`Installing…`:`Installing agent tools…`:e.state.hostStatus===`starting`?e.compact?`Starting…`:`Starting agent tools…`:e.compact?`Updating…`:`Updating agent access…`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,w.jsx)(d,{size:`xs`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,w.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[r,n]}),t[1]=n,t[2]=i),i}if(e.state.agentAccessEnabled&&e.state.hostStatus===`ready`&&e.state.hosts.some(P)){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,w.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,w.jsx)(i,{className:`size-3 text-success`}),`Agent tools are ready.`]}),t[3]=e):e=t[3],e}return null}function P(e){return e.agentDeviceInstalled}function F(e){let t=(0,S.c)(21),n=!e.compact&&`rounded-md border border-border/60 px-3 py-2`,r;t[0]===n?r=t[1]:(r=s(`flex gap-2`,n),t[0]=n,t[1]=r);let i=e.status.ready?`text-success`:`text-muted-foreground`,a;t[2]===i?a=t[3]:(a=s(`mt-0.5 size-4 shrink-0`,i),t[2]=i,t[3]=a);let o=e.status.ready?c:u,d;t[4]!==a||t[5]!==o?(d=(0,w.jsx)(l,{className:a,icon:o}),t[4]=a,t[5]=o,t[6]=d):d=t[6];let f=e.compact&&e.status.ready&&`flex items-center gap-2`,p;t[7]===f?p=t[8]:(p=s(f),t[7]=f,t[8]=p);let m;t[9]===e.platform?m=t[10]:(m=(0,w.jsx)(`p`,{className:`font-medium`,children:e.platform}),t[9]=e.platform,t[10]=m);let h=e.compact&&e.status.ready?`Ready`:e.status.message,g;t[11]===h?g=t[12]:(g=(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:h}),t[11]=h,t[12]=g);let _;t[13]!==g||t[14]!==p||t[15]!==m?(_=(0,w.jsxs)(`div`,{className:p,children:[m,g]}),t[13]=g,t[14]=p,t[15]=m,t[16]=_):_=t[16];let v;return t[17]!==r||t[18]!==_||t[19]!==d?(v=(0,w.jsxs)(`div`,{className:r,children:[d,_]}),t[17]=r,t[18]=_,t[19]=d,t[20]=v):v=t[20],v}export{O as a,T as c,F as i,j as n,D as o,A as r,k as s,N as t};
2
- //# sourceMappingURL=DeviceSetup-D9F7F9pV.js.map
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{O_ as n,RE as r,bd as i,lr as a,mE as o,t as s}from"./utils-hgbJ2TVM.js";import{d as c,l,v as u}from"./TooltipViewport-DJ2VRKCt.js";import{t as d}from"./spinner-Bzrp5oww.js";import{i as f,n as p}from"./session-DyiiEN5g.js";import{t as m}from"./use-atom-command-D34CFqu3.js";import{n as h}from"./dialog-Cgb4jap2.js";import{t as g}from"./device-DnfWBPpo.js";import{aa as _,la as v,oa as y,pa as b,sa as x}from"./main-4dRVuXx2.js";var S=r(),C=e(t(),1),w=e(o(),1);function T(e){let t=(0,S.c)(15),{state:n,environmentId:r}=e,i=m(g.list),[o,s]=(0,C.useState)(null);if(n.hostStatus===`disabled`)return null;let c;if(t[0]!==r||t[1]!==o||t[2]!==i||t[3]!==n.hostStatuses||t[4]!==n.hosts||t[5]!==n.supportsHostRetry){let e;t[7]!==r||t[8]!==o||t[9]!==i||t[10]!==n.hostStatuses||t[11]!==n.supportsHostRetry?(e=e=>{let t=n.hostStatuses[e.id];if(!t||![`installing`,`starting`,`failed`].includes(t.status))return null;let c=t.status===`failed`;return(0,w.jsxs)(`div`,{role:c?`alert`:`status`,className:`flex items-start gap-3 rounded-md border border-border/60 px-3 py-2 text-xs`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`p`,{className:`font-medium`,children:e.label}),(0,w.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-muted-foreground`,children:t.detail??(c?`Device support could not start.`:t.status===`installing`?`Installing device tools…`:`Starting device tools…`)}),c?(0,w.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Check the host connection and network access, then retry. Your device settings are saved.`}):null]}),c&&n.supportsHostRetry?(0,w.jsx)(a,{size:`compact`,variant:`outline`,disabled:o!==null,onClick:()=>{s(e.id),i({environmentId:r,input:{retryHostId:e.id}}).finally(()=>s(null))},children:o===e.id?`Retrying…`:`Retry`}):null]},e.id)},t[7]=r,t[8]=o,t[9]=i,t[10]=n.hostStatuses,t[11]=n.supportsHostRetry,t[12]=e):e=t[12],c=n.hosts.map(e),t[0]=r,t[1]=o,t[2]=i,t[3]=n.hostStatuses,t[4]=n.hosts,t[5]=n.supportsHostRetry,t[6]=c}else c=t[6];let l;return t[13]===c?l=t[14]:(l=(0,w.jsx)(`div`,{className:`space-y-2`,children:c}),t[13]=c,t[14]=l),l}var E=e=>e===`ios`?`iOS`:`Android`,D=`Enable this environment to open simulators and emulators, whether they run here or on a remote device host.`,O=`Allow new agent sessions in this environment to start and control local and remote devices, with required tools set up automatically.`;function k(e,t){let n=e.hosts.flatMap(e=>e.platforms).find(e=>e.platform===t);return n?.available?e.hostStatus===`ready`&&!e.devices.some(e=>e.platform===t)?{ready:!1,message:t===`ios`?`Xcode is installed, but no iOS Simulator is available. Install a runtime in Xcode Settings → Components.`:`The Android SDK is installed, but no virtual device exists. Create one in Android Studio → Device Manager.`}:{ready:!0,message:t===`ios`?`Xcode and iOS Simulator are available.`:`The Android SDK and Emulator are available.`}:{ready:!1,message:n?.reason??`${E(t)} support was not detected.`}}function A(e){let t=f(e.environmentId,n),r=m(g.configure),i=m(g.list,{reportFailure:!1}),[o,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(0),d=e.state.hostStatus!==`disabled`,S=e.state.hostStatus===`installing`||e.state.hostStatus===`starting`,E=e.state.hosts.some(e=>e.kind===`local`&&!e.platforms.some(e=>e.available)),k=async(t,n)=>{if(p(e.environmentId,`settings:write`)){c(t);try{let i=await r({environmentId:e.environmentId,input:n});t===`complete`&&i._tag===`Success`&&e.onComplete?.()}finally{c(null)}}};return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y,{title:`Set up devices`,description:`Review what runs on this environment before using simulators and emulators.`,children:(0,w.jsx)(v,{steps:[`Device hub`,`Simulators`,`Agent access`],currentStep:l,onStepChange:u,isStepDisabled:e=>S||o!==null||e>l})}),(0,w.jsxs)(x,{children:[(0,w.jsx)(T,{state:e.state,environmentId:e.environmentId}),l===0?(0,w.jsxs)(`section`,{className:`space-y-3 text-sm`,children:[(0,w.jsx)(`h3`,{className:`font-medium`,children:`Enable the device hub`}),(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,w.jsx)(`p`,{className:`text-muted-foreground`,children:D}),(0,w.jsx)(b,{checked:d,disabled:!t||S||o!==null,"aria-label":`Enable device hub`,onCheckedChange:e=>void k(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]}),(0,w.jsx)(j,{state:e.state,pending:o===`hub`||S&&o!==`agent`})]}):null,l===1||l===0&&d&&E?(0,w.jsxs)(`section`,{className:s(`space-y-3 text-sm`,l===0&&`mt-4`),children:[(0,w.jsx)(`h3`,{className:`font-medium`,children:`Check simulator support`}),(0,w.jsx)(M,{state:e.state,checking:o===`check`,disabled:!d||S||o!==null,onCheck:()=>{c(`check`),i({environmentId:e.environmentId,input:{}}).finally(()=>c(null))}})]}):null,l===2?(0,w.jsxs)(`section`,{className:`space-y-3 text-sm`,children:[(0,w.jsx)(`h3`,{className:`font-medium`,children:`Allow agent control`}),(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,w.jsx)(`p`,{className:`text-muted-foreground`,children:O}),(0,w.jsx)(b,{checked:e.state.agentAccessEnabled,disabled:!t||!d||S||o!==null,"aria-label":`Allow agents to control devices`,onCheckedChange:e=>void k(`agent`,{agentAccessEnabled:!!e})})]}),(0,w.jsx)(N,{state:e.state,pending:o===`agent`}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Leave this off to keep manual device controls without giving agents access.`})]}):null,e.state.hostStatus===`failed`&&e.state.hostStatusDetail?(0,w.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-destructive`,children:e.state.hostStatusDetail}):null]}),(0,w.jsxs)(_,{children:[l===0?(0,w.jsx)(h,{render:(0,w.jsx)(a,{variant:`outline`}),children:`Cancel`}):(0,w.jsx)(a,{variant:`outline`,disabled:S||o!==null,onClick:()=>u(l-1),children:`Back`}),l<2?(0,w.jsx)(a,{disabled:e.state.hostStatus!==`ready`||o!==null,onClick:()=>u(l+1),children:`Continue`}):(0,w.jsx)(a,{disabled:!t||e.state.hostStatus!==`ready`||o!==null,onClick:()=>void k(`complete`,{onboardingCompleted:!0}),children:o===`complete`?`Saving…`:`Done`})]})]})}function j(e){let t=(0,S.c)(5),{state:n,pending:r,compact:a}=e,o=a!==void 0&&a;if(!r&&n.hostStatus!==`ready`)return null;let s;t[0]===r?s=t[1]:(s=r?(0,w.jsx)(d,{size:`xs`}):(0,w.jsx)(i,{className:`size-3 text-success`}),t[0]=r,t[1]=s);let c=r?n.hostStatus===`installing`?o?`Installing…`:`Installing device hub…`:n.hostStatus===`starting`?o?`Starting…`:`Starting device hub…`:o?`Updating…`:`Updating device hub…`:`Device hub is ready.`,l;return t[2]!==s||t[3]!==c?(l=(0,w.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[s,c]}),t[2]=s,t[3]=c,t[4]=l):l=t[4],l}function M(e){let t=(0,S.c)(20),n;t[0]===e.state?n=t[1]:(n=k(e.state,`ios`),t[0]=e.state,t[1]=n);let r;t[2]===n?r=t[3]:(r=(0,w.jsx)(F,{platform:`iOS`,status:n}),t[2]=n,t[3]=r);let i;t[4]===e.state?i=t[5]:(i=k(e.state,`android`),t[4]=e.state,t[5]=i);let o;t[6]===i?o=t[7]:(o=(0,w.jsx)(F,{platform:`Android`,status:i}),t[6]=i,t[7]=o);let s;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`You can use either platform. Fixing a missing platform does not block the other one.`}),t[8]=s):s=t[8];let c;t[9]===e.checking?c=t[10]:(c=e.checking?(0,w.jsx)(d,{size:`xs`}):null,t[9]=e.checking,t[10]=c);let l=e.checking?`Checking…`:`Check again`,u;t[11]!==e.disabled||t[12]!==e.onCheck||t[13]!==c||t[14]!==l?(u=(0,w.jsxs)(a,{size:`compact`,variant:`outline`,disabled:e.disabled,onClick:e.onCheck,children:[c,l]}),t[11]=e.disabled,t[12]=e.onCheck,t[13]=c,t[14]=l,t[15]=u):u=t[15];let f;return t[16]!==r||t[17]!==o||t[18]!==u?(f=(0,w.jsxs)(`div`,{className:`space-y-3`,children:[r,o,s,u]}),t[16]=r,t[17]=o,t[18]=u,t[19]=f):f=t[19],f}function N(e){let t=(0,S.c)(4);if(e.pending){let n=e.state.hostStatus===`installing`?e.compact?`Installing…`:`Installing agent tools…`:e.state.hostStatus===`starting`?e.compact?`Starting…`:`Starting agent tools…`:e.compact?`Updating…`:`Updating agent access…`,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,w.jsx)(d,{size:`xs`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,w.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[r,n]}),t[1]=n,t[2]=i),i}if(e.state.agentAccessEnabled&&e.state.hostStatus===`ready`&&e.state.hosts.some(P)){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,w.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,w.jsx)(i,{className:`size-3 text-success`}),`Agent tools are ready.`]}),t[3]=e):e=t[3],e}return null}function P(e){return e.agentDeviceInstalled}function F(e){let t=(0,S.c)(21),n=!e.compact&&`rounded-md border border-border/60 px-3 py-2`,r;t[0]===n?r=t[1]:(r=s(`flex gap-2`,n),t[0]=n,t[1]=r);let i=e.status.ready?`text-success`:`text-muted-foreground`,a;t[2]===i?a=t[3]:(a=s(`mt-0.5 size-4 shrink-0`,i),t[2]=i,t[3]=a);let o=e.status.ready?c:u,d;t[4]!==a||t[5]!==o?(d=(0,w.jsx)(l,{className:a,icon:o}),t[4]=a,t[5]=o,t[6]=d):d=t[6];let f=e.compact&&e.status.ready&&`flex items-center gap-2`,p;t[7]===f?p=t[8]:(p=s(f),t[7]=f,t[8]=p);let m;t[9]===e.platform?m=t[10]:(m=(0,w.jsx)(`p`,{className:`font-medium`,children:e.platform}),t[9]=e.platform,t[10]=m);let h=e.compact&&e.status.ready?`Ready`:e.status.message,g;t[11]===h?g=t[12]:(g=(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:h}),t[11]=h,t[12]=g);let _;t[13]!==g||t[14]!==p||t[15]!==m?(_=(0,w.jsxs)(`div`,{className:p,children:[m,g]}),t[13]=g,t[14]=p,t[15]=m,t[16]=_):_=t[16];let v;return t[17]!==r||t[18]!==_||t[19]!==d?(v=(0,w.jsxs)(`div`,{className:r,children:[d,_]}),t[17]=r,t[18]=_,t[19]=d,t[20]=v):v=t[20],v}export{O as a,T as c,F as i,j as n,D as o,A as r,k as s,N as t};
2
+ //# sourceMappingURL=DeviceSetup-Dm9ZbkMC.js.map
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Om as n,RE as r,lr as i,mE as a,rp as o}from"./utils-hgbJ2TVM.js";import{w as s}from"./Virtualizer-BSpDafyf.js";import{o as c}from"./DiffWorkerPoolProvider-BOInEqDW.js";import{t as l}from"./textarea-wDfYVvpo.js";function u({metaKey:e,ctrlKey:t},n=s()){return n?e&&!t:t&&!e}function d(e){if(s()&&e.ctrlKey&&!e.altKey&&!e.metaKey)switch(e.key){case`a`:return`start`;case`e`:return`end`;case`p`:return`up`;case`n`:return`down`;case`f`:return`right`;case`b`:return`left`}if(!e.altKey&&!e.ctrlKey&&!e.metaKey){if(e.key===`ArrowUp`)return`up`;if(e.key===`ArrowDown`)return`down`;if(e.key===`ArrowLeft`)return`left`;if(e.key===`ArrowRight`)return`right`;if(e.key===`Home`)return`start`;if(e.key===`End`)return`end`}if(u(e)){if(e.key===`ArrowLeft`)return`textStart`;if(e.key===`ArrowRight`)return`end`}}var f=new WeakMap,p=h([{bindings:{Tab:`indent`,"shift+Tab":`outdent`,"cmdOrCtrl+[":`indentLess`,"cmdOrCtrl+]":`indentMore`,"cmdOrCtrl+z":`undo`,"cmdOrCtrl+shift+z":`redo`,"cmdOrCtrl+a":`selectAll`,"cmdOrCtrl+d":`findNextMatch`,"cmdOrCtrl+f":`openSearchPanel`,"cmdOrCtrl+alt+f":`openSearchReplacePanel`,"alt+ArrowUp":`moveLineUp`,"alt+ArrowDown":`moveLineDown`,"shift+alt+ArrowUp":`copyLineUp`,"shift+alt+ArrowDown":`copyLineDown`,Escape:`simplifySelection`,"cmdOrCtrl+Enter":`insertBlankLine`,"cmdOrCtrl+/":`toggleComment`,"shift+alt+a":`toggleBlockComment`,"cmdOrCtrl+Home":`moveCursorToDocStart`,"cmdOrCtrl+End":`moveCursorToDocEnd`,"cmdOrCtrl+shift+Home":`expandSelectionDocStart`,"cmdOrCtrl+shift+End":`expandSelectionDocEnd`}},{platform:`mac`,bindings:{"ctrl+k":`deleteHardLineForward`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`,"cmd+ArrowUp":`moveCursorToDocStart`,"cmd+ArrowDown":`moveCursorToDocEnd`,"cmd+shift+ArrowUp":`expandSelectionDocStart`,"cmd+shift+ArrowDown":`expandSelectionDocEnd`}},{platform:`windows`,bindings:{"ctrl+y":`redo`}},{platform:`linux`,bindings:{"ctrl+y":`redo`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`}}]),m={Backquote:"`",Minus:`-`,Equal:`=`,Comma:`,`,Period:`.`,Slash:`/`,Semicolon:`;`,Quote:`'`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Space:`Space`};function h(e){let t=f.get(e);if(t===void 0){t={mac:new Map,windows:new Map,linux:new Map};for(let n of e)for(let e of Object.keys(n.bindings)){let r=n.bindings[e];if(r===void 0)continue;let i=e.split(`+`),a=i.pop();for(let e of[`mac`,`windows`,`linux`]){if(n.platform!==void 0&&n.platform!==e)continue;let o=0;for(let t of i)t===`alt`?o|=1:t===`ctrl`?o|=2:t===`cmd`?o|=4:t===`shift`?o|=8:t===`cmdOrCtrl`&&(o|=e===`mac`?4:2);let s=t[e].get(o);s===void 0&&(s=new Map,t[e].set(o,s)),s.set(a,r)}}f.set(e,t)}return t}function g(e,t,n=s()){let r=e.key===` `?`Space`:e.key.length===1?e.key.toLowerCase():e.key,i=e.code??``,a=i.startsWith(`Key`)&&i.length===4?i.slice(3).toLowerCase():i.startsWith(`Digit`)&&i.length===6?i.slice(5):m[i],o=n?`mac`:globalThis.navigator?.platform.includes(`Linux`)===!0?`linux`:`windows`,c=+!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);if(t!==void 0){let e=h(t)[o].get(c),n=e?.get(r)??(a===void 0?void 0:e?.get(a));if(n!==void 0)return n}let l=p[o].get(c);return l?.get(r)??(a===void 0?void 0:l?.get(a))}function _(e,t=s()){if(!e.altKey&&u(e,t)&&((e.key.length===1?e.key.toLowerCase():e.key)===`g`||e.code===`KeyG`))return e.shiftKey?`previous`:`next`}var v=1e5,y=10,b=13,x=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,S=class{source;offset;length;lineOffsetStart;lineOffsetEnd;hasVirtualTrailingCRBreak;firstCharCode;lastCharCode;static Original=0;static Added=1;constructor(e,t,n,r,i,a,o,s){this.source=e,this.offset=t,this.length=n,this.lineOffsetStart=r,this.lineOffsetEnd=i,this.hasVirtualTrailingCRBreak=a,this.firstCharCode=o,this.lastCharCode=s}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart+ +!!this.hasVirtualTrailingCRBreak}},C=class{text;lineOffsets;constructor(e){this.text=e,this.lineOffsets=c(e)}append(e){let t=this.text.length;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===y||r===b)&&(r===b&&e.charCodeAt(n+1)===y&&n++,this.lineOffsets.push(t+n+1))}return this.text+=e,t}},w=class{piece;subtreeLength;subtreeLineBreakCount;subtreeFirstCharCode;subtreeLastCharCode;left=null;right=null;parent=null;priority=0;constructor(e,t=e.length,n=e.lineBreakCount,r=e.firstCharCode,i=e.lastCharCode){this.piece=e,this.subtreeLength=t,this.subtreeLineBreakCount=n,this.subtreeFirstCharCode=r,this.subtreeLastCharCode=i}updateSubtreeLength(){this.subtreeLength=(this.left?.subtreeLength??0)+this.piece.length+(this.right?.subtreeLength??0),this.subtreeLineBreakCount=(this.left?.subtreeLineBreakCount??0)+this.piece.lineBreakCount+(this.right?.subtreeLineBreakCount??0)-+!!N(this.left?.subtreeLastCharCode,this.piece.firstCharCode)-!!N(this.piece.lastCharCode,this.right?.subtreeFirstCharCode),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},T=class{#e;#t=new C(``);#n=null;#r=0;#i=0;#a=null;#o=null;#s=null;#c=2654435769;constructor(e){this.#e=new C(e);let t=this.#y(S.Original,0,e.length);this.#n=t.length>0?this.#C(t):null,this.#r=this.#n?.subtreeLength??0,this.#i=(this.#n?.subtreeLineBreakCount??0)+1}get lineCount(){return this.#i}getText(e){if(e===void 0)return this.#g();let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this.getTextSlice(t,n)}getLineText(e,t=!1){if(this.#a!==null&&this.#a[0]===e&&this.#a[1]===t)return this.#a[2];let n=this.#f(e);if(n===void 0)throw Error(`Line index out of range: ${e}`);let r=this.getTextSlice(n[0],n[1],!t);return this.#a=[e,t,r],this.#o=[e,t,r.length],r}getLineLength(e,t=!1){let n=this.#o,r=this.#a;if(n!==null&&n[0]===e&&n[1]===t)return n[2];if(r!==null&&r[0]===e&&r[1]===t){let n=r[2].length;return this.#o=[e,t,n],n}let i=this.#f(e);if(i===void 0)throw Error(`Line index out of range: ${e}`);let[a,o]=i,s=o-a;if(!t)for(;s>0&&E(this.charAt(a+s-1).charCodeAt(0));)s--;return this.#o=[e,t,s],s}getTextSlice(e,t,n=!1){if(e>=t)return``;let r=D(e,0,this.#r),i=D(t,r,this.#r);if(r>=i)return``;let a=this.#u(r);if(a===void 0)return``;let o=[],[s,c]=a,l=i-r;for(;s!==null&&l>0;){let e=Math.min(s.piece.length-c,l),t=this.#v(s.piece.source),r=s.piece.offset+c,i=r+e;if(n)for(;i>r&&E(t.text.charCodeAt(i-1));)i--;o.push(t.text.slice(r,i)),l-=e,c=0,s=this.#d(s)}return o.join(``)}charAt(e){let t=this.#u(e);if(t===void 0)return``;let[n,r]=t;return this.#v(n.piece.source).text.charAt(n.piece.offset+r)}includes(e){if(e.length===0)return!0;let t=O(e),n=0,r=!1;return this.#_(i=>{for(let a=i.start;a<i.end;a++){let o=i.text.charCodeAt(a);for(;n>0&&o!==e.charCodeAt(n);)n=t[n-1];if(o===e.charCodeAt(n)&&n++,n===e.length)return r=!0,!1}return!0}),r}findNextNonOverlappingSubstring(e,t){if(e.length===0||e.length>this.#r)return;let n=k(t,this.#r),r=n.reduce((e,[,t])=>Math.max(e,t),0),i=O(e),a=0,o=0,s,c;return this.#_(t=>{for(let l=t.start;l<t.end;l++){let u=t.text.charCodeAt(l);for(;a>0&&u!==e.charCodeAt(a);)a=i[a-1];if(u===e.charCodeAt(a)&&a++,a===e.length){let t=o-e.length+1;if(!A(n,t,t+e.length)){if(t>=r)return c=t,!1;s??=t}a=i[a-1]}o++}return!0}),c??s}search(e){if(e.text.length===0||this.#r===0||e.text.includes(`
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Om as n,RE as r,lr as i,mE as a,rp as o}from"./utils-hgbJ2TVM.js";import{w as s}from"./Virtualizer-DEM6HN7-.js";import{o as c}from"./DiffWorkerPoolProvider-C_yNvh6o.js";import{t as l}from"./textarea-wDfYVvpo.js";function u({metaKey:e,ctrlKey:t},n=s()){return n?e&&!t:t&&!e}function d(e){if(s()&&e.ctrlKey&&!e.altKey&&!e.metaKey)switch(e.key){case`a`:return`start`;case`e`:return`end`;case`p`:return`up`;case`n`:return`down`;case`f`:return`right`;case`b`:return`left`}if(!e.altKey&&!e.ctrlKey&&!e.metaKey){if(e.key===`ArrowUp`)return`up`;if(e.key===`ArrowDown`)return`down`;if(e.key===`ArrowLeft`)return`left`;if(e.key===`ArrowRight`)return`right`;if(e.key===`Home`)return`start`;if(e.key===`End`)return`end`}if(u(e)){if(e.key===`ArrowLeft`)return`textStart`;if(e.key===`ArrowRight`)return`end`}}var f=new WeakMap,p=h([{bindings:{Tab:`indent`,"shift+Tab":`outdent`,"cmdOrCtrl+[":`indentLess`,"cmdOrCtrl+]":`indentMore`,"cmdOrCtrl+z":`undo`,"cmdOrCtrl+shift+z":`redo`,"cmdOrCtrl+a":`selectAll`,"cmdOrCtrl+d":`findNextMatch`,"cmdOrCtrl+f":`openSearchPanel`,"cmdOrCtrl+alt+f":`openSearchReplacePanel`,"alt+ArrowUp":`moveLineUp`,"alt+ArrowDown":`moveLineDown`,"shift+alt+ArrowUp":`copyLineUp`,"shift+alt+ArrowDown":`copyLineDown`,Escape:`simplifySelection`,"cmdOrCtrl+Enter":`insertBlankLine`,"cmdOrCtrl+/":`toggleComment`,"shift+alt+a":`toggleBlockComment`,"cmdOrCtrl+Home":`moveCursorToDocStart`,"cmdOrCtrl+End":`moveCursorToDocEnd`,"cmdOrCtrl+shift+Home":`expandSelectionDocStart`,"cmdOrCtrl+shift+End":`expandSelectionDocEnd`}},{platform:`mac`,bindings:{"ctrl+k":`deleteHardLineForward`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`,"cmd+ArrowUp":`moveCursorToDocStart`,"cmd+ArrowDown":`moveCursorToDocEnd`,"cmd+shift+ArrowUp":`expandSelectionDocStart`,"cmd+shift+ArrowDown":`expandSelectionDocEnd`}},{platform:`windows`,bindings:{"ctrl+y":`redo`}},{platform:`linux`,bindings:{"ctrl+y":`redo`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`}}]),m={Backquote:"`",Minus:`-`,Equal:`=`,Comma:`,`,Period:`.`,Slash:`/`,Semicolon:`;`,Quote:`'`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Space:`Space`};function h(e){let t=f.get(e);if(t===void 0){t={mac:new Map,windows:new Map,linux:new Map};for(let n of e)for(let e of Object.keys(n.bindings)){let r=n.bindings[e];if(r===void 0)continue;let i=e.split(`+`),a=i.pop();for(let e of[`mac`,`windows`,`linux`]){if(n.platform!==void 0&&n.platform!==e)continue;let o=0;for(let t of i)t===`alt`?o|=1:t===`ctrl`?o|=2:t===`cmd`?o|=4:t===`shift`?o|=8:t===`cmdOrCtrl`&&(o|=e===`mac`?4:2);let s=t[e].get(o);s===void 0&&(s=new Map,t[e].set(o,s)),s.set(a,r)}}f.set(e,t)}return t}function g(e,t,n=s()){let r=e.key===` `?`Space`:e.key.length===1?e.key.toLowerCase():e.key,i=e.code??``,a=i.startsWith(`Key`)&&i.length===4?i.slice(3).toLowerCase():i.startsWith(`Digit`)&&i.length===6?i.slice(5):m[i],o=n?`mac`:globalThis.navigator?.platform.includes(`Linux`)===!0?`linux`:`windows`,c=+!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);if(t!==void 0){let e=h(t)[o].get(c),n=e?.get(r)??(a===void 0?void 0:e?.get(a));if(n!==void 0)return n}let l=p[o].get(c);return l?.get(r)??(a===void 0?void 0:l?.get(a))}function _(e,t=s()){if(!e.altKey&&u(e,t)&&((e.key.length===1?e.key.toLowerCase():e.key)===`g`||e.code===`KeyG`))return e.shiftKey?`previous`:`next`}var v=1e5,y=10,b=13,x=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,S=class{source;offset;length;lineOffsetStart;lineOffsetEnd;hasVirtualTrailingCRBreak;firstCharCode;lastCharCode;static Original=0;static Added=1;constructor(e,t,n,r,i,a,o,s){this.source=e,this.offset=t,this.length=n,this.lineOffsetStart=r,this.lineOffsetEnd=i,this.hasVirtualTrailingCRBreak=a,this.firstCharCode=o,this.lastCharCode=s}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart+ +!!this.hasVirtualTrailingCRBreak}},C=class{text;lineOffsets;constructor(e){this.text=e,this.lineOffsets=c(e)}append(e){let t=this.text.length;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===y||r===b)&&(r===b&&e.charCodeAt(n+1)===y&&n++,this.lineOffsets.push(t+n+1))}return this.text+=e,t}},w=class{piece;subtreeLength;subtreeLineBreakCount;subtreeFirstCharCode;subtreeLastCharCode;left=null;right=null;parent=null;priority=0;constructor(e,t=e.length,n=e.lineBreakCount,r=e.firstCharCode,i=e.lastCharCode){this.piece=e,this.subtreeLength=t,this.subtreeLineBreakCount=n,this.subtreeFirstCharCode=r,this.subtreeLastCharCode=i}updateSubtreeLength(){this.subtreeLength=(this.left?.subtreeLength??0)+this.piece.length+(this.right?.subtreeLength??0),this.subtreeLineBreakCount=(this.left?.subtreeLineBreakCount??0)+this.piece.lineBreakCount+(this.right?.subtreeLineBreakCount??0)-+!!N(this.left?.subtreeLastCharCode,this.piece.firstCharCode)-!!N(this.piece.lastCharCode,this.right?.subtreeFirstCharCode),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},T=class{#e;#t=new C(``);#n=null;#r=0;#i=0;#a=null;#o=null;#s=null;#c=2654435769;constructor(e){this.#e=new C(e);let t=this.#y(S.Original,0,e.length);this.#n=t.length>0?this.#C(t):null,this.#r=this.#n?.subtreeLength??0,this.#i=(this.#n?.subtreeLineBreakCount??0)+1}get lineCount(){return this.#i}getText(e){if(e===void 0)return this.#g();let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this.getTextSlice(t,n)}getLineText(e,t=!1){if(this.#a!==null&&this.#a[0]===e&&this.#a[1]===t)return this.#a[2];let n=this.#f(e);if(n===void 0)throw Error(`Line index out of range: ${e}`);let r=this.getTextSlice(n[0],n[1],!t);return this.#a=[e,t,r],this.#o=[e,t,r.length],r}getLineLength(e,t=!1){let n=this.#o,r=this.#a;if(n!==null&&n[0]===e&&n[1]===t)return n[2];if(r!==null&&r[0]===e&&r[1]===t){let n=r[2].length;return this.#o=[e,t,n],n}let i=this.#f(e);if(i===void 0)throw Error(`Line index out of range: ${e}`);let[a,o]=i,s=o-a;if(!t)for(;s>0&&E(this.charAt(a+s-1).charCodeAt(0));)s--;return this.#o=[e,t,s],s}getTextSlice(e,t,n=!1){if(e>=t)return``;let r=D(e,0,this.#r),i=D(t,r,this.#r);if(r>=i)return``;let a=this.#u(r);if(a===void 0)return``;let o=[],[s,c]=a,l=i-r;for(;s!==null&&l>0;){let e=Math.min(s.piece.length-c,l),t=this.#v(s.piece.source),r=s.piece.offset+c,i=r+e;if(n)for(;i>r&&E(t.text.charCodeAt(i-1));)i--;o.push(t.text.slice(r,i)),l-=e,c=0,s=this.#d(s)}return o.join(``)}charAt(e){let t=this.#u(e);if(t===void 0)return``;let[n,r]=t;return this.#v(n.piece.source).text.charAt(n.piece.offset+r)}includes(e){if(e.length===0)return!0;let t=O(e),n=0,r=!1;return this.#_(i=>{for(let a=i.start;a<i.end;a++){let o=i.text.charCodeAt(a);for(;n>0&&o!==e.charCodeAt(n);)n=t[n-1];if(o===e.charCodeAt(n)&&n++,n===e.length)return r=!0,!1}return!0}),r}findNextNonOverlappingSubstring(e,t){if(e.length===0||e.length>this.#r)return;let n=k(t,this.#r),r=n.reduce((e,[,t])=>Math.max(e,t),0),i=O(e),a=0,o=0,s,c;return this.#_(t=>{for(let l=t.start;l<t.end;l++){let u=t.text.charCodeAt(l);for(;a>0&&u!==e.charCodeAt(a);)a=i[a-1];if(u===e.charCodeAt(a)&&a++,a===e.length){let t=o-e.length+1;if(!A(n,t,t+e.length)){if(t>=r)return c=t,!1;s??=t}a=i[a-1]}o++}return!0}),c??s}search(e){if(e.text.length===0||this.#r===0||e.text.includes(`
2
2
  `)||e.text.includes(`\r`)||e.regex&&(e.text.includes(`\\n`)||e.text.includes(`\\r`)))return[];let t;try{t=R(e.text,e.regex,e.caseSensitive)}catch{return[]}return this.#l(t,e.wholeWord,v)}#l(e,t,n){let r=[],i=this.#g(),a=i.length,o=c(i);for(let s=0;s<o.length;s++){let c=o[s],l=o[s+1]??a;for(;l>c&&E(i.charCodeAt(l-1));)l--;let u=i.slice(c,l);e.lastIndex=0;let d;for(;(d=e.exec(u))!==null;){let a=d.index,o=d[0];if(o.length===0){e.lastIndex=V(u,a);continue}let s=c+a;if((!t||L(i,s,o.length))&&(r.push([s,s+o.length]),r.length>=n))return r;a===e.lastIndex&&(e.lastIndex=V(u,a))}}return r}insert(e,t){if(e.length===0)return;let n=D(t,0,this.#r);this.#b(n,n,e),this.#x()}delete(e,t){if(t<=0||this.#r===0)return;let n=D(e,0,this.#r),r=D(n+t,n,this.#r);n!==r&&(this.#b(n,r,``),this.#x())}applyEdits(e){if(e.length!==0){for(let t=e.length-1;t>=0;t--){let n=e[t],r=D(n.start,0,this.#r),i=D(n.end,r,this.#r);this.#b(r,i,n.text)}this.#x()}}positionAt(e){let t=D(e,0,this.#r);if(this.#r===0)return{line:0,character:0};let n=this.#p(t),r=t-(n===0?0:this.#m(n-1));return this.#s=[n,r,t],{line:n,character:r}}positionsAt(e){let t=Array.from({length:e.length});if(e.length===0)return t;if(this.#r===0)return t.fill({line:0,character:0});for(let n=0;n<e.length;n++)t[n]=this.positionAt(e[n]);return t}offsetAt(e){if(e.line<0||this.#r===0)return 0;if(e.line>=this.#i)throw Error(`Line index out of range: ${e.line}`);let t=this.#s;if(t!==null&&t[0]===e.line&&t[1]===e.character)return t[2];let n=this.#f(e.line);if(n===void 0)throw Error(`Line index out of range: ${e.line}`);let r=D(e.character,0,n[1]-n[0]);return n[0]+r}#u(e){if(e<0||e>=this.#r)return;let t=this.#n,n=e;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(n-=e,n<t.piece.length)return[t,n];n-=t.piece.length,t=t.right}}#d(e){if(e.right!==null){let t=e.right;for(;t.left!==null;)t=t.left;return t}let t=e;for(;t.parent!==null&&t===t.parent.right;)t=t.parent;return t.parent}#f(e){if(e<0)throw Error(`Line index out of range: ${e}`);if(this.#r===0){if(e===0)return[0,0];throw Error(`Line index out of range: ${e}`)}if(e>=this.#i)throw Error(`Line index out of range: ${e}`);return[e===0?0:this.#m(e-1),e<this.#i-1?this.#m(e):this.#r]}#p(e){let t=this.#n,n=D(e,0,this.#r),r=0;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(r+=(t.left?.subtreeLineBreakCount??0)-+!!N(t.left?.subtreeLastCharCode,t.piece.firstCharCode),n-=e,n<=t.piece.length){let e=this.#v(t.piece.source),i=Math.min(P(e.lineOffsets,t.piece.offset+n),t.piece.lineOffsetEnd);return r+=i-t.piece.lineOffsetStart,n===t.piece.length&&t.piece.hasVirtualTrailingCRBreak&&r++,n===t.piece.length&&N(t.piece.lastCharCode,this.#d(t)?.piece.firstCharCode)&&r--,r}r+=t.piece.lineBreakCount-+!!N(t.piece.lastCharCode,t.right?.subtreeFirstCharCode),n-=t.piece.length,t=t.right}return this.#i-1}#m(e){let t=this.#n,n=e,r=0,i;for(;t!==null;){let e=(t.left?.subtreeLineBreakCount??0)-+!!N(t.left?.subtreeLastCharCode,t.piece.firstCharCode);if(n<e){i=t.piece.firstCharCode,t=t.left;continue}let a=t.left?.subtreeLength??0;r+=a,n-=e;let o=t.right?.subtreeFirstCharCode??i,s=t.piece.lineBreakCount-+!!N(t.piece.lastCharCode,o);if(n<s)return r+this.#h(t.piece,n);r+=t.piece.length,n-=s,t=t.right}return this.#r}#h(e,t){return t<e.lineOffsetEnd-e.lineOffsetStart?this.#v(e.source).lineOffsets[e.lineOffsetStart+t]-e.offset:e.length}#g(){let e=[];return this.#_(t=>{e.push(t.text.slice(t.start,t.end))}),e.join(``)}#_(e){this.#j(this.#n,t=>{let n=this.#v(t.piece.source);return e({text:n.text,lineOffsets:n.lineOffsets,lineOffsetStart:t.piece.lineOffsetStart,lineOffsetEnd:t.piece.lineOffsetEnd,start:t.piece.offset,end:t.piece.offset+t.piece.length})})}#v(e){return e===S.Original?this.#e:this.#t}#y(e,t,n){let r=this.#v(e),i=t+n,a=P(r.lineOffsets,t),o=P(r.lineOffsets,i),s=r.text.charCodeAt(i-1);return new S(e,t,n,a,o,s===b&&r.lineOffsets[o-1]!==i,r.text.charCodeAt(t),s)}#b(e,t,n){if(e===t&&n.length===0)return;let[r,i]=this.#E(this.#n,e),a=this.#D(i,t-e),o;if(n.length>0){let e=this.#y(S.Added,this.#t.append(n),n.length);o=this.#O(this.#k(r,e),a)}else{let[e,t]=this.#A(a);o=e===void 0?r:this.#O(this.#k(r,e),t)}o!==null&&(o.parent=null),this.#n=o,this.#r=o?.subtreeLength??0,this.#i=(o?.subtreeLineBreakCount??0)+1}#x(){this.#a=null,this.#o=null,this.#s=null}#S(){return this.#c=Math.imul(this.#c,1664525)+1013904223>>>0,this.#c}#C(e){let t=new w(e);return t.priority=this.#S(),t}#w(e,t){e.left=t,t!==null&&(t.parent=e)}#T(e,t){e.right=t,t!==null&&(t.parent=e)}#E(e,t){if(e===null)return[null,null];if(t<=0)return[null,e];if(t>=e.subtreeLength)return[e,null];let n=e.left?.subtreeLength??0;if(t<=n){let[n,r]=this.#E(e.left,t);return this.#w(e,r),e.updateSubtreeLength(),[n,e]}let r=e.piece.length;if(t>=n+r){let[i,a]=this.#E(e.right,t-n-r);return this.#T(e,i),e.updateSubtreeLength(),[e,a]}let i=t-n,a=new w(this.#y(e.piece.source,e.piece.offset,i)),o=new w(this.#y(e.piece.source,e.piece.offset+i,r-i));return a.priority=e.priority,o.priority=e.priority,this.#w(a,e.left),this.#T(o,e.right),a.updateSubtreeLength(),o.updateSubtreeLength(),[a,o]}#D(e,t){if(e===null||t>=e.subtreeLength)return null;if(t<=0)return e;let n=e.left?.subtreeLength??0;if(t<=n)return this.#w(e,this.#D(e.left,t)),e.updateSubtreeLength(),e;let r=n+e.piece.length;if(t>=r)return this.#D(e.right,t-r);let i=t-n,a=new w(this.#y(e.piece.source,e.piece.offset+i,e.piece.length-i));return a.priority=e.priority,this.#T(a,e.right),a.updateSubtreeLength(),a}#O(e,t){return e===null?t:t===null?e:e.priority>=t.priority?(this.#T(e,this.#O(e.right,t)),e.updateSubtreeLength(),e):(this.#w(t,this.#O(e,t.left)),t.updateSubtreeLength(),t)}#k(e,t){if(e===null)return this.#C(t);let n=e;for(;n.right!==null;)n=n.right;if(j(n.piece,t)){n.piece=M(n.piece,t);for(let t=n;t!==null&&(t.updateSubtreeLength(),t!==e);)t=t.parent;return e}return this.#O(e,this.#C(t))}#A(e){if(e===null)return[void 0,null];if(e.left===null)return[e.piece,e.right];let[t,n]=this.#A(e.left);return this.#w(e,n),e.updateSubtreeLength(),[t,e]}#j(e,t){return e===null?!0:!this.#j(e.left,t)||t(e)===!1?!1:this.#j(e.right,t)}};function E(e){return e===10||e===13}function D(e,t,n){return Math.min(Math.max(e,t),n)}function O(e){let t=Array.from({length:e.length}).fill(0),n=0;for(let r=1;r<e.length;r++){let i=e.charCodeAt(r);for(;n>0&&i!==e.charCodeAt(n);)n=t[n-1];i===e.charCodeAt(n)&&n++,t[r]=n}return t}function k(e,t){let n=[];for(let[r,i]of e){let e=D(r,0,t),a=D(i,e,t);e<a&&n.push([e,a])}n.sort((e,t)=>e[0]-t[0]);let r=[];for(let e of n){let t=r[r.length-1];if(t!==void 0&&e[0]<=t[1]){t[1]=Math.max(t[1],e[1]);continue}r.push(e)}return r}function A(e,t,n){let r=0,i=e.length;for(;r<i;){let n=r+Math.floor((i-r)/2);e[n][1]<=t?r=n+1:i=n}let a=e[r];return a!==void 0&&a[0]<n}function j(e,t){return e.source===t.source&&e.offset+e.length===t.offset&&!N(e.lastCharCode,t.firstCharCode)}function M(e,t){return new S(e.source,e.offset,e.length+t.length,e.lineOffsetStart,t.lineOffsetEnd,t.hasVirtualTrailingCRBreak,e.firstCharCode,t.lastCharCode)}function N(e,t){return e===b&&t===y}function P(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2);e[i]<=t?n=i+1:r=i}return n}function F(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function I(e){if(e<=32||e===127)return!0;let t=String.fromCharCode(e);return x.includes(t)}function L(e,t,n){let r=t<=0||I(e.charCodeAt(t-1)),i=t+n>=e.length||I(e.charCodeAt(t+n));return r&&i}function R(e,t,n){let r=t?e:F(e);return new RegExp(r,`g${n?``:`i`}${t?`m`:``}`)}function z(e,t){return e.replace(/\$([$&]|\d+)/g,(e,n)=>n===`$`?`$`:n===`&`?t[0]??``:t[Number(n)]??``)}function B(e,t,n,r,i,a){if(!r.regex)return r.replaceText;let o=e(i),s=n(o.line),c=i-t({line:o.line,character:0}),l;try{l=R(r.text,!0,r.caseSensitive)}catch{return r.replaceText}l.lastIndex=c;let u=l.exec(s);return u===null||u.index!==c||u[0].length!==a-i?r.replaceText:z(r.replaceText,u)}function V(e,t){if(t+1<e.length){let n=e.charCodeAt(t),r=e.charCodeAt(t+1);if(n>=55296&&n<=56319&&r>=56320&&r<=57343)return t+2}return t+1}function H(e,t,n){let{style:r,dataset:i,children:a,...o}=t??{},s=document.createElement(e);return Object.assign(s,o),r!==void 0&&(typeof r==`string`?s.style.cssText=r:Object.assign(s.style,r)),i!==void 0&&(typeof i==`string`?s.dataset[i]=``:Array.isArray(i)?i.forEach(e=>{s.dataset[e]=``}):Object.assign(s.dataset,i)),a!==void 0&&s.replaceChildren(...a),n!==void 0&&n.appendChild(s),s}function U(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function W(e,t=`line`){let n=e.dataset[t];if(n===void 0)return;let r=parseInt(n,10);if(!Number.isNaN(r))return r}function ee(e,t){if(e.nodeType===3){let n=e.textContent?.length??0;return Math.max(0,Math.min(t,n))}return e.nodeType===1?Math.max(0,Math.min(t,e.childNodes.length)):0}function te(e,t){return Object.assign(e,t)}function ne(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}function re(e,t=1e3){return Math.round(e*t)/t}function ie(e){return e.endsWith(`
3
3
  `)||e.endsWith(`\r`)}function G(e){if(typeof Intl<`u`&&typeof Intl.Segmenter==`function`)return new Intl.Segmenter(void 0,e)}var K,q=!1;function J(){return q||=(K=G({granularity:`grapheme`}),!0),K}function ae(e){let t=e.ownerDocument,n=e.parentElement;for(;n!=null&&n!==t.body&&n!==t.documentElement;){let e=n.ownerDocument.defaultView?.getComputedStyle(n).overflowY;if(e===`auto`||e===`scroll`||e===`overlay`)return n;n=n.parentElement}return t}var Y=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
4
4
  <symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
@@ -33,4 +33,4 @@ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19
33
33
  <use href="#diffs-editor-icon-${e}"></use>
34
34
  </svg>`,se=class{#e;#t;#n;#r;#i;#a;constructor(e){let{textDocument:t,containerElement:n,defaultQuery:r,mode:i=`find`,allowReplace:a=!0,initialMatch:o,scrollToMatch:s,applyReplace:c,onUpdate:l,onClose:d}=e,f={text:r,replaceText:``,caseSensitive:!1,wholeWord:!1,regex:!1},p={all:[],current:void 0},m=H(`div`,{dataset:{matches:``,noMatches:``},textContent:`No results`}),h=e=>{p.all=f.text===``?[]:t.search(f);let n=p.all.length===0;if(P.disabled=n,F.disabled=n,n){m.textContent=`No results`,m.dataset.noMatches=``,p.current=void 0,l([]);return}if(delete m.dataset.noMatches,e?.syncSelection===!1){let e=l(p.all,{syncSelection:!1});g(e);return}g(l(p.all))};this.#n=h;let g=e=>{if(e===void 0)m.textContent=`${p.all.length} results`;else{let[t,n]=e,r=p.all.findIndex(e=>e[0]===t&&e[1]===n);m.textContent=`${r+1} of ${p.all.length}`}p.current=e},v=(e,t)=>{f[e]=t,h()},y=(e=!1,t=!1)=>{let n=p.all,r=n[0];if(n.length>0){if(e){let e=p.current?.[0]??0;r=n.at(-1);for(let t of n)if(t[1]<=e)r=t;else break}else{let e=p.current?.[1]??0;for(let t of n)if(t[0]>=e){r=t;break}}}r!==void 0&&(g(r),s(r,t)),p.current=r};this.#i=e=>y(e,!0);let b=(e,n)=>({start:e,end:n,text:B(e=>t.positionAt(e),e=>t.offsetAt(e),e=>t.getLineText(e),f,e,n)}),x=()=>{if(f.text===``||p.all.length===0)return;let e=p.current;if(e===void 0&&(y(!1,!0),e=p.current,e===void 0))return;let[t,n]=e,r=b(t,n);c([r]),s([t+r.text.length,t+r.text.length],!0),p.current=void 0,h()},S=()=>{f.text!==``&&p.all.length!==0&&(c(p.all.map(([e,t])=>b(e,t))),p.current=void 0,h())},C=()=>{this.cleanup(),d()};this.#a=C;let w=e=>H(`button`,{type:`button`,title:e.label,ariaLabel:e.label,dataset:{searchIcon:``,...e.dataset},innerHTML:X(e.icon,e.size??16),onclick:e.onClick}),T=(e,t,n)=>{let r=w({icon:e,label:t,size:14,onClick:()=>{let e=!f[n];r.ariaPressed=String(e),v(n,e)}});return r.ariaPressed=String(f[n]),r},E=T(`case`,`Match Case`,`caseSensitive`),D=T(`whole-word`,`Whole Word`,`wholeWord`),O=T(`regex`,`Regexp`,`regex`),k=H(`input`,{type:`text`,placeholder:`Replace`,dataset:`replace`,value:``,oninput:e=>{f.replaceText=e.target.value},onkeydown:e=>{if(e.isComposing||e.keyCode===229)return;let t=_(e);e.key===`Escape`?(e.preventDefault(),C()):e.key===`Enter`?(e.preventDefault(),x()):t!==void 0&&(e.preventDefault(),y(t===`previous`,!0))}});this.#t=H(`input`,{type:`text`,placeholder:`Search`,dataset:`search`,value:r,oninput:e=>{f.text=e.target.value,p.current=void 0,h()},onkeydown:e=>{if(e.isComposing||e.keyCode===229)return;let t=_(e);e.key===`Escape`?(e.preventDefault(),C()):e.key===`Enter`?(e.preventDefault(),y(e.shiftKey,!0)):t===void 0?u(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),z(e.altKey?`replace`:`find`)):(e.preventDefault(),y(t===`previous`,!0))}});let A=H(`div`,{dataset:`searchToggles`,children:[E,D,O]}),j=H(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,A]}),M=H(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[k]}),N=H(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[w({icon:`replace`,label:`Replace`,onClick:x}),w({icon:`replace-all`,label:`Replace All`,onClick:S})]}),P=w({icon:`arrow-up`,label:`Previous`,onClick:()=>{y(!0)}}),F=w({icon:`arrow-down`,label:`Next`,onClick:()=>{y()}});P.disabled=!0,F.disabled=!0;let I=H(`div`,{dataset:`searchNav`,children:[P,F]}),L=w({icon:`close`,label:`Close`,onClick:C,dataset:{searchClose:``}}),R=H(`div`,{dataset:{searchGrid:``,mode:i},children:[j,M,N,m,I,L]}),z=e=>{R.dataset.mode=a?e:`find`,this.#t.focus(),this.#t.select()};this.#r=z,this.#e=H(`div`,{dataset:`searchPanel`,children:[H(`div`,{dataset:`editorWidget`,children:[R]})]}),p.current=o,n.before(this.#e),requestAnimationFrame(()=>{o===void 0?l([]):h(),this.#t.select()})}focus(){this.#t.focus()}navigate(e){this.#i?.(e)}updateMatches(e){this.#n?.(e)}setMode(e){this.#r?.(e)}close(){this.#a?.()}cleanup(){this.#e.remove()}},ce=`@layer base,theme,rendered,unsafe;::selection{background-color:#0000}[data-deleted-text-selection] [data-deletions] ::selection,[data-deleted-text-selection] [data-line-type=change-deletion] ::selection{background-color:var(--diffs-editor-selection-bg)}@keyframes blinking{0%{opacity:1}50%{opacity:0}to{opacity:1}}:host,[data-code],[data-content],[data-diff-type=split][data-overflow=wrap]{position:relative}[data-code]{container-type:inline-size}[data-content]{cursor:text;caret-color:var(--diffs-bg-caret);background-color:#0000;outline:none}[data-line]{cursor:text;background-color:#0000}[data-line]:after{content:"";z-index:-20;background-color:var(--diffs-line-bg);pointer-events:none;position:absolute;inset:0}[data-line][data-editor-active-line]:after{box-shadow:inset 0 0 0 1px var(--diffs-editor-line-highlight-border)}[data-editor-overlay]{display:contents}[data-caret],[data-edit-prediction],[data-selection-range],[data-match-range],[data-bracket-match-range],[data-edit-prediction-deletion-range],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range],[data-marker-range],[data-remote-caret],[data-caret-highlight-range]{height:1lh;line-height:var(--diffs-line-height);pointer-events:none;position:absolute;top:0;left:0}[data-edit-prediction]{z-index:1;user-select:none;width:max-content;height:auto;color:var(--diffs-editor-edit-prediction-fg,color-mix(in lab, var(--diffs-fg) 45%, transparent));overflow:visible}[data-edit-prediction-line]{box-sizing:border-box;white-space:pre;width:max-content;min-height:1lh;display:block}[data-edit-prediction][data-replacement] [data-edit-prediction-line],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range]{background-color:var(--diffs-edit-prediction-bg,var(--diffs-bg))}[data-edit-prediction-suffix]{color:var(--diffs-fg)}[data-edit-prediction][data-wrap] [data-edit-prediction-line]{overflow-wrap:anywhere;white-space:pre-wrap;max-width:100%}[data-edit-prediction-line][data-empty]:after{content:"↵"}[data-edit-prediction-spacer]{margin-block-end:var(--diffs-edit-prediction-spacer-height)}[data-code][data-deletions] [data-edit-prediction-spacer]{box-sizing:content-box;margin-block-end:0;padding-block-end:var(--diffs-edit-prediction-spacer-height)}[data-edit-prediction-deletion-range]{--diffs-edit-prediction-deletion-color:var(--diffs-editor-edit-prediction-deletion-fg,color-mix(in lab, var(--diffs-deletion-base) 70%, transparent));z-index:1;background:linear-gradient(to bottom, transparent calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% + .5px), transparent calc(50% + .5px))}[data-edit-prediction-insertion-range]{z-index:0}[data-edit-prediction-replacement-range]{z-index:1}[data-caret]{z-index:2;background-color:var(--diffs-bg-caret-override,var(--diffs-editor-cursor-fg,light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));visibility:hidden;width:2px}@media (prefers-reduced-motion:no-preference){[data-caret]{animation:1.2s .8s infinite blinking}}[data-selection-range]{z-index:-10;background-color:var(--diffs-editor-selection-bg)}[data-caret-highlight-range]{z-index:-10;background-color:var(--diffs-caret-highlight-bg,var(--diffs-editor-selection-bg))}[data-selection-corner]{background-color:var(--diffs-selection-corner-bg,var(--diffs-bg));width:100%;height:100%}[data-match-range]{z-index:-10;background-color:var(--diffs-editor-match-bg,var(--diffs-editor-selection-bg))}[data-match-range]:not([data-focus]){background-color:var(--diffs-editor-match-highlight-bg,light-dark(#ff963288,#ff963266))}[data-bracket-match-range]{z-index:-9;box-sizing:border-box;border-bottom:1px solid var(--diffs-editor-bracket-match-border,color-mix(in lab, var(--diffs-fg) 60%, transparent));background-color:var(--diffs-editor-bracket-match-bg,color-mix(in lab, var(--diffs-fg) 5%, transparent))}[data-rtl]{border-top-left-radius:3px}[data-rtr]{border-top-right-radius:3px}[data-rbl]{border-bottom-left-radius:3px}[data-rbr]{border-bottom-right-radius:3px}[data-marker-range]{z-index:1;background-color:var(--diffs-marker-bg);mask-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+);mask-position:0 100%;mask-size:6px 3px;mask-repeat:repeat-x}[data-marker-error]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-error-fg,var(--diffs-deletion-base))}[data-marker-warning]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-warning-fg,light-dark(var(--diffs-warning-light),var(--diffs-warning-dark)))}[data-marker-info]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-info-fg,var(--diffs-modified-base))}[data-marker-hint]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-hint-fg,var(--diffs-fg-number))}@media (width>=480px){[data-content]{caret-color:#0000}[data-content]:focus~[data-editor-overlay] [data-caret]{visibility:visible}}[data-editor-widget]{--diffs-widget-fg:var(--diffs-fg);--diffs-widget-bg:color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));--diffs-widget-border:color-mix(in lab, var(--diffs-fg) 20%, transparent);--diffs-widget-shadow:inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013, 0 6px 18px #00000013;z-index:100;width:fit-content;max-width:calc(100% - 24px);font:14px/20px var(--diffs-header-font-fallback);border:1px solid var(--diffs-widget-border);background-color:var(--diffs-widget-bg);box-shadow:var(--diffs-widget-shadow);background-clip:padding-box;border-radius:9px;position:absolute;top:0;left:0}[data-marker-popover],[data-selection-action-popover]{--popover-gap:var(--diffs-popover-gap,var(--diffs-gap-fallback,8px));--popover-viewport-left:0px;--popover-viewport-right:100cqw;--popover-viewport-top:-99999px;--popover-viewport-bottom:99999px;--popover-min-left:calc(var(--popover-viewport-left) + var(--gutter-width,0px) + var(--popover-gap));--popover-available-width:max(0px, calc(var(--popover-viewport-right) - var(--popover-min-left) - var(--popover-gap)));max-width:min(640px, var(--popover-available-width));translate:clamp(var(--popover-min-left), var(--popover-x,var(--popover-min-left)), calc(var(--popover-viewport-right) - var(--popover-gap) - 100%)) clamp(var(--popover-viewport-top), calc(var(--popover-y,0px) + var(--popover-y-shift,0px)), calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%))}[data-marker-popover]{--diffs-widget-bg:var(--diffs-marker-bg);--diffs-widget-shadow:0 4px 8px #00000026, 0 6px 18px #00000026;min-width:min(180px, var(--popover-available-width));overflow-wrap:anywhere;color:var(--diffs-marker-contrast);white-space:normal;pointer-events:auto;border:0;padding:8px 12px;@supports (color:contrast-color(red)){color:contrast-color(var(--diffs-marker-bg,var(--diffs-bg)))}& [data-marker-message]{white-space:normal;overflow-wrap:anywhere;& code{white-space:normal;color:inherit;background-color:#0000;display:inline}}}[data-selection-action-popover]{pointer-events:auto;flex-wrap:wrap;align-items:center;gap:4px;width:max-content;padding:4px;display:flex}[data-search-panel]{z-index:100;flex-direction:column;justify-content:right;width:100%;height:0;display:flex;position:sticky;top:16px;right:16px;container:search-panel/inline-size;& [data-editor-widget]{z-index:100;flex-shrink:0;align-items:stretch;gap:8px;min-width:260px;max-width:100%;margin-inline:auto 16px;padding:4px;display:flex;position:relative}& svg{fill:currentColor;width:12px;height:12px;display:block}}[data-search-grid]{grid-template-columns:auto auto auto;grid-template-areas:"find matches nav""replace actions.";align-items:center;gap:4px 6px;width:100%;display:grid}[data-input-box][data-find]{grid-area:find}[data-search-nav]{grid-area:nav}[data-input-box][data-replace]{grid-area:replace}[data-replace-actions]{grid-area:actions}[data-search-grid][data-mode=find]{grid-template-areas:"find matches nav"}[data-search-grid][data-mode=find] [data-replace-cell]{display:none}@container search-panel (width<400px){[data-search-panel] [data-editor-widget]{padding:10px}[data-search-grid][data-mode=replace]{grid-template-columns:auto 1fr auto;grid-template-areas:"find find find""replace replace replace""nav matches actions"}[data-search-grid][data-mode=find]{grid-template-columns:auto 1fr auto;grid-template-areas:"find find find""nav matches matches"}[data-replace-actions]{justify-self:end}[data-search-grid] [data-input-box]{width:auto}}[data-input-box]{align-items:center;width:200px;display:flex;position:relative;& input{width:100%;min-width:0;color:var(--diffs-fg);background-color:var(--diffs-bg);border:1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));border-radius:6px;outline:none;flex-grow:1;padding-inline:6px;font-size:13px;line-height:24px;&::selection{background-color:color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg))}&:focus-visible{outline:1px solid var(--diffs-modified-base)}}&[data-find] input{padding-inline-end:72px}& [data-search-icon]{--diffs-search-icon-size:20px}}[data-search-toggles]{align-items:center;gap:1px;display:flex;position:absolute;top:50%;right:4px;transform:translateY(-50%)}[data-matches]{white-space:nowrap;min-width:50px;color:color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));flex-shrink:0;grid-area:matches;font-size:12px;font-weight:500;line-height:20px;&[data-no-matches]{color:color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg))}}[data-replace-actions],[data-search-nav]{align-items:center;display:flex}[data-search-icon]{appearance:none;width:var(--diffs-search-icon-size,24px);height:var(--diffs-search-icon-size,24px);color:color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));border-radius:var(--diffs-search-icon-radius,4px);cursor:pointer;background:0 0;border:0;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;transition:background-color .1s ease-in-out,color .1s ease-in-out;display:flex;&:disabled{opacity:.25;cursor:default}&:not(:disabled):hover{color:var(--diffs-fg)}&:focus-visible{outline:1px solid var(--diffs-modified-base)}&[aria-pressed=true]{color:var(--diffs-modified-base)}}[data-search-close]{--diffs-search-icon-size:20px;--diffs-search-icon-radius:50%;color:var(--diffs-widget-bg);background-color:color-mix(in lab, var(--diffs-widget-fg) 50%, var(--diffs-bg));position:absolute;top:0;right:0;transform:translate(50%,-50%);&:not(:disabled):hover{opacity:1;color:var(--diffs-widget-bg);background-color:var(--diffs-widget-fg)}}
35
35
  `,Z=e(t(),1),le=r();function Q(e,t,n){return!n&&(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&t.trim().length>0}var $=e(a(),1);function ue(e){let t=(0,le.c)(48),{kind:r,rangeLabel:a,text:s,onTextChange:c,onCancel:u,onComment:d,onDelete:f,placeholder:p,submitLabel:m,pending:h,secondaryAction:g,focusOnMount:_}=e,v=p===void 0?`Add a comment…`:p,y=m===void 0?`Comment`:m,b=h!==void 0&&h,x=_===void 0||_,[S,C]=(0,Z.useState)(``),w=r===`draft`&&!c?S:s,T;t[0]===w?T=t[1]:(T=w.trim(),t[0]=w,t[1]=T);let E=T,D=(0,Z.useRef)(null),O,k;if(t[2]!==x||t[3]!==r?(O=()=>{if(r!==`draft`||!x)return;let e=window.requestAnimationFrame(()=>{D.current?.focus({preventScroll:!0})});return()=>window.cancelAnimationFrame(e)},k=[x,r],t[2]=x,t[3]=r,t[4]=O,t[5]=k):(O=t[4],k=t[5]),(0,Z.useLayoutEffect)(O,k),r===`comment`){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(o,{className:`mt-0.5 size-3.5 shrink-0 text-primary/70`,"aria-hidden":`true`}),t[6]=e):e=t[6];let r;t[7]===w?r=t[8]:(r=(0,$.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap text-sm leading-5`,children:w}),t[7]=w,t[8]=r);let a;t[9]===f?a=t[10]:(a=f?(0,$.jsx)(`span`,{className:`-my-1 -mr-1 flex shrink-0 opacity-0 transition-opacity group-hover/comment:opacity-100 focus-within:opacity-100 max-sm:opacity-100`,children:(0,$.jsx)(i,{variant:`ghost-muted`,size:`icon-xs`,"aria-label":`Delete comment`,onClick:f,children:(0,$.jsx)(n,{className:`size-3`})})}):null,t[9]=f,t[10]=a);let s;return t[11]!==a||t[12]!==r?(s=(0,$.jsxs)(`div`,{"data-diff-comment-annotation":!0,className:`group/comment flex min-w-0 items-start gap-2.5 border-s-2 border-primary/55 bg-primary/[0.045] px-3 py-2.5 font-sans text-foreground`,contentEditable:!1,onPointerDown:pe,children:[e,r,a]}),t[11]=a,t[12]=r,t[13]=s):s=t[13],s}let A=`Comment on lines ${a}`,j;t[14]===c?j=t[15]:(j=e=>(c??C)(e.target.value),t[14]=c,t[15]=j);let M;t[16]!==u||t[17]!==d||t[18]!==b||t[19]!==E?(M=e=>{e.key===`Escape`&&(e.preventDefault(),u()),Q(e,E,b)&&(e.preventDefault(),d(E))},t[16]=u,t[17]=d,t[18]=b,t[19]=E,t[20]=M):M=t[20];let N;t[21]!==w||t[22]!==x||t[23]!==v||t[24]!==M||t[25]!==A||t[26]!==j?(N=(0,$.jsx)(l,{ref:D,autoFocus:x,size:`sm`,value:w,placeholder:v,"aria-label":A,onChange:j,onFocus:de,onKeyDown:M}),t[21]=w,t[22]=x,t[23]=v,t[24]=M,t[25]=A,t[26]=j,t[27]=N):N=t[27];let P;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(`span`,{className:`mr-auto text-3xs text-muted-foreground/70`,children:`⌘/Ctrl Enter to send`}),t[28]=P):P=t[28];let F;t[29]===u?F=t[30]:(F=(0,$.jsx)(i,{variant:`ghost-muted`,size:`xs`,onClick:u,children:`Cancel`}),t[29]=u,t[30]=F);let I;t[31]!==g||t[32]!==E?(I=g?(0,$.jsxs)(i,{size:`xs`,variant:`outline`,disabled:!g.allowEmpty&&!E,onClick:()=>g.onAction(E),children:[g.icon,g.label]}):null,t[31]=g,t[32]=E,t[33]=I):I=t[33];let L=b||!E,R;t[34]!==d||t[35]!==E?(R=()=>d(E),t[34]=d,t[35]=E,t[36]=R):R=t[36];let z;t[37]!==y||t[38]!==L||t[39]!==R?(z=(0,$.jsx)(i,{size:`xs`,disabled:L,onClick:R,children:y}),t[37]=y,t[38]=L,t[39]=R,t[40]=z):z=t[40];let B;t[41]!==F||t[42]!==I||t[43]!==z?(B=(0,$.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1`,children:[P,F,I,z]}),t[41]=F,t[42]=I,t[43]=z,t[44]=B):B=t[44];let V;return t[45]!==N||t[46]!==B?(V=(0,$.jsxs)(`div`,{"data-diff-comment-annotation":!0,className:`px-3 py-2 font-sans text-foreground`,contentEditable:!1,onPointerDown:fe,children:[N,B]}),t[45]=N,t[46]=B,t[47]=V):V=t[47],V}function de(e){let t=e.currentTarget.value.length;e.currentTarget.setSelectionRange(t,t)}function fe(e){return e.stopPropagation()}function pe(e){return e.stopPropagation()}export{u as S,re as _,Y as a,_ as b,ee as c,ie as d,te as f,ae as g,H as h,se as i,G as l,W as m,Q as n,oe as o,J as p,ce as r,U as s,ue as t,ne as u,T as v,d as x,g as y};
36
- //# sourceMappingURL=DiffCommentAnnotation-mA-RZ8Su.js.map
36
+ //# sourceMappingURL=DiffCommentAnnotation-Dx-VhoLU.js.map
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{RE as n,lr as r,mE as i,t as a}from"./utils-hgbJ2TVM.js";import{g as o,h as s,l as c}from"./TooltipViewport-DJ2VRKCt.js";import{K as l}from"./useSettings-BNs1IeKk.js";import{u as ee}from"./diffRendering-CdquEtfn.js";import{c as te,i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./fileTreeExpansion-BwModZ8t.js";import{t as ce}from"./pierre-icons-BodtO6xC.js";var le=n(),u=e(t(),1);function d(e,t,n){let r=(0,le.c)(8),[i,a]=(0,u.useState)(null),o=(0,u.useRef)(null),s,c;r[0]!==n||r[1]!==i||r[2]!==t||r[3]!==e?(s=()=>{if(i!==null&&o.current!==i){if(i.scope!==t){o.current=i;return}!e?.getInstance()||n&&!n.includes(i.fileKey)||(e.scrollTo({type:`item`,id:i.fileKey,align:`start`}),o.current=i)}},c=[i,t,e,n],r[0]=n,r[1]=i,r[2]=t,r[3]=e,r[4]=s,r[5]=c):(s=r[4],c=r[5]),(0,u.useEffect)(s,c);let l;return r[6]===t?l=r[7]:(l=e=>a({fileKey:e,scope:t}),r[6]=t,r[7]=l),l}function f(e,t){return e.length>0&&e.every(e=>t.has(e))}function p(e,t){return f(e,t)?new Set:new Set(e)}function m(e){switch(e.type){case`new`:return`added`;case`deleted`:return`deleted`;case`rename-pure`:case`rename-changed`:return`renamed`;case`change`:return`modified`}}function h(e){let t=new Map;for(let n of e){let e=ee(n),r=m(n),i=t.get(e);t.set(e,i===void 0||i===r?r:`modified`)}return[...t].map(([e,t])=>({path:e,status:t}))}function ue(e){let t=new Set;for(let n of e){let e=n.split(`/`),r=``;for(let n of e.slice(0,-1))r+=`${n}/`,t.add(r)}return[...t]}function de(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n);let r=``;for(let i of e.split(`/`).slice(0,-1))r+=`${i}/`,t.has(r)||t.set(r,n)}),t}function g(e){return(t,n)=>{let r=e();return(r.get(t.path)??2**53-1)-(r.get(n.path)??2**53-1)||t.depth-n.depth||t.path.localeCompare(n.path)}}function _(e){return e.split(`/`).filter(Boolean).length}function fe(e,t){let n=new Set(ue(e)),r=new Set(ue(t)),i=new Set(e),a=new Set(t),o=[];for(let t of e)a.has(t)||o.push({type:`remove`,path:t});let s=[...n].filter(e=>!r.has(e)).toSorted((e,t)=>_(t)-_(e));for(let e of s)o.push({type:`remove`,path:e,recursive:!0});let c=[...r].filter(e=>!n.has(e)).toSorted((e,t)=>_(e)-_(t));for(let e of c)o.push({type:`add`,path:e});for(let e of t)i.has(e)||o.push({type:`add`,path:e});return o}var v=e(i(),1);function y(e){let t=(0,le.c)(64),{entries:n,onSelectFile:i,selectedPath:ee,revealRequestId:d,ariaLabel:f,headerAccessory:p,footer:m,className:h}=e,g=ee===void 0?null:ee,_=d===void 0?0:d,{resolvedTheme:y}=l(),b;t[0]===n?b=t[1]:(b=n.map(he),t[0]=n,t[1]=b);let x=b,S;t[2]===x?S=t[3]:(S=ue(x),t[2]=x,t[3]=S);let C=S,w;t[4]===x?w=t[5]:(w=de(x),t[4]=x,t[5]=w);let T=w,[E]=(0,u.useState)(me),D;t[6]===n?D=t[7]:(D=n.map(pe),t[6]=n,t[7]=D);let O=D,k;t[8]===x?k=t[9]:(k=new Set(x),t[8]=x,t[9]=k);let A=(0,u.useRef)(k),j=(0,u.useRef)(i),ge=(0,u.useRef)(!1),M=(0,u.useRef)(null),_e=(0,u.useRef)(null),N,P;t[10]!==i||t[11]!==x?(N=()=>{A.current=new Set(x),j.current=i},P=[i,x],t[10]=i,t[11]=x,t[12]=N,t[13]=P):(N=t[12],P=t[13]),(0,u.useEffect)(N,P);let F,I;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{if(ge.current)return;let t=e.at(-1)?.replace(/\/$/,``);t&&A.current.has(t)&&j.current(t)},I=[],t[14]=F,t[15]=I):(F=t[14],I=t[15]);let L;t[16]===E.sort?L=t[17]:(L={density:`compact`,flattenEmptyDirectories:!0,initialExpansion:`open`,icons:ce,onSelectionChange:F,paths:I,search:!1,sort:E.sort,unsafeCSS:ae},t[16]=E.sort,t[17]=L);let{model:R}=oe(L),z;t[18]===C?z=t[19]:(z=e=>se(e,C),t[18]=C,t[19]=z);let B=ie(R,z),V,H;t[20]!==C||t[21]!==O||t[22]!==R||t[23]!==E||t[24]!==x||t[25]!==T?(V=()=>{E.update(T);let e=_e.current;if(e!==x){if(_e.current=x,e===null)R.resetPaths(x);else if(e.every((e,t)=>x[t]===e)){let t=fe(e,x);t.length>0&&R.batch(t)}else{let e=C.filter(e=>{let t=R.getItem(e);return t!==null&&`isExpanded`in t&&!t.isExpanded()});R.resetPaths(x);for(let t of e){let e=R.getItem(t);e!==null&&`collapse`in e&&e.collapse()}}R.setGitStatus(O)}},H=[C,O,R,E,x,T],t[20]=C,t[21]=O,t[22]=R,t[23]=E,t[24]=x,t[25]=T,t[26]=V,t[27]=H):(V=t[26],H=t[27]),(0,u.useEffect)(V,H);let U;t[28]!==R||t[29]!==_||t[30]!==g?(U=()=>{if(g===null){M.current=null;return}let e=R.getItem(g);if(e===null||e.isDirectory()){M.current=null;return}let t=M.current;if(t?.path===g&&t.revealRequestId===_)return;M.current={path:g,revealRequestId:_},ge.current=!0;for(let e of R.getSelectedPaths())e!==g&&R.getItem(e)?.deselect();let n=``;for(let e of g.split(`/`).slice(0,-1)){n+=`${e}/`;let t=R.getItem(n);t!==null&&`expand`in t&&t.expand()}e.select(),R.scrollToPath(g,{offset:`nearest`}),queueMicrotask(()=>{ge.current=!1})},t[28]=R,t[29]=_,t[30]=g,t[31]=U):U=t[31];let W;t[32]!==R||t[33]!==x||t[34]!==_||t[35]!==g?(W=[R,x,_,g],t[32]=R,t[33]=x,t[34]=_,t[35]=g,t[36]=W):W=t[36],(0,u.useEffect)(U,W);let G;t[37]===h?G=t[38]:(G=a(`flex min-h-0 flex-1 flex-col bg-background`,h),t[37]=h,t[38]=G);let K;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,v.jsx)(`span`,{className:`px-1 font-medium text-foreground`,children:`Files`}),t[39]=K):K=t[39];let q;t[40]===n.length?q=t[41]:(q=(0,v.jsx)(`span`,{className:`ml-auto tabular-nums`,children:n.length}),t[40]=n.length,t[41]=q);let J;t[42]!==B||t[43]!==C||t[44]!==R?(J=C.length>0?(0,v.jsx)(r,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":B?`Collapse all folders`:`Expand all folders`,onClick:()=>re(R,C,!B),children:(0,v.jsx)(c,{className:`size-3.5`,icon:B?s:o})}):null,t[42]=B,t[43]=C,t[44]=R,t[45]=J):J=t[45];let Y;t[46]!==p||t[47]!==q||t[48]!==J?(Y=(0,v.jsxs)(`div`,{className:`flex h-10 min-h-10 shrink-0 items-center gap-1 border-b border-border/60 bg-background px-2 text-xs text-muted-foreground in-data-[preview-panel-mode=inline]:mb-3 in-data-[preview-panel-mode=inline]:h-7 in-data-[preview-panel-mode=inline]:min-h-7 in-data-[preview-panel-mode=inline]:border-b-transparent`,"data-surface-subheader":!0,children:[K,q,p,J]}),t[46]=p,t[47]=q,t[48]=J,t[49]=Y):Y=t[49];let X;t[50]===R?X=t[51]:(X=e=>{if(e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let t=R.getSelectedPaths(),n=t.length===1?t[0]:void 0;n&&A.current.has(n)&&e.nativeEvent.composedPath().some(e=>e instanceof HTMLElement&&e.getAttribute(`data-item-path`)===n)&&j.current(n)},t[50]=R,t[51]=X);let Z;t[52]===y?Z=t[53]:(Z=ne(y),t[52]=y,t[53]=Z);let Q;t[54]!==f||t[55]!==R||t[56]!==X||t[57]!==Z?(Q=(0,v.jsx)(te,{model:R,"aria-label":f,onClickCapture:X,className:`min-h-0 flex-1 overflow-hidden`,style:Z}),t[54]=f,t[55]=R,t[56]=X,t[57]=Z,t[58]=Q):Q=t[58];let $;return t[59]!==m||t[60]!==G||t[61]!==Y||t[62]!==Q?($=(0,v.jsxs)(`div`,{className:G,children:[Y,Q,m]}),t[59]=m,t[60]=G,t[61]=Y,t[62]=Q,t[63]=$):$=t[63],$}function pe(e){return{path:e.path,status:e.status}}function me(){let e=new Map;return{sort:g(()=>e),update:t=>{e=t}}}function he(e){return e.path}export{d as a,p as i,h as n,f as r,y as t};
2
- //# sourceMappingURL=DiffFileTree-CaPQB8J4.js.map
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{RE as n,lr as r,mE as i,t as a}from"./utils-hgbJ2TVM.js";import{g as o,h as s,l as c}from"./TooltipViewport-DJ2VRKCt.js";import{K as l}from"./useSettings-BcmuuiTp.js";import{u as ee}from"./diffRendering-BWY0g219.js";import{c as te,i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./fileTreeExpansion-CpkONCrM.js";import{t as ce}from"./pierre-icons-CY4HbMoq.js";var le=n(),u=e(t(),1);function d(e,t,n){let r=(0,le.c)(8),[i,a]=(0,u.useState)(null),o=(0,u.useRef)(null),s,c;r[0]!==n||r[1]!==i||r[2]!==t||r[3]!==e?(s=()=>{if(i!==null&&o.current!==i){if(i.scope!==t){o.current=i;return}!e?.getInstance()||n&&!n.includes(i.fileKey)||(e.scrollTo({type:`item`,id:i.fileKey,align:`start`}),o.current=i)}},c=[i,t,e,n],r[0]=n,r[1]=i,r[2]=t,r[3]=e,r[4]=s,r[5]=c):(s=r[4],c=r[5]),(0,u.useEffect)(s,c);let l;return r[6]===t?l=r[7]:(l=e=>a({fileKey:e,scope:t}),r[6]=t,r[7]=l),l}function f(e,t){return e.length>0&&e.every(e=>t.has(e))}function p(e,t){return f(e,t)?new Set:new Set(e)}function m(e){switch(e.type){case`new`:return`added`;case`deleted`:return`deleted`;case`rename-pure`:case`rename-changed`:return`renamed`;case`change`:return`modified`}}function h(e){let t=new Map;for(let n of e){let e=ee(n),r=m(n),i=t.get(e);t.set(e,i===void 0||i===r?r:`modified`)}return[...t].map(([e,t])=>({path:e,status:t}))}function ue(e){let t=new Set;for(let n of e){let e=n.split(`/`),r=``;for(let n of e.slice(0,-1))r+=`${n}/`,t.add(r)}return[...t]}function de(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n);let r=``;for(let i of e.split(`/`).slice(0,-1))r+=`${i}/`,t.has(r)||t.set(r,n)}),t}function g(e){return(t,n)=>{let r=e();return(r.get(t.path)??2**53-1)-(r.get(n.path)??2**53-1)||t.depth-n.depth||t.path.localeCompare(n.path)}}function _(e){return e.split(`/`).filter(Boolean).length}function fe(e,t){let n=new Set(ue(e)),r=new Set(ue(t)),i=new Set(e),a=new Set(t),o=[];for(let t of e)a.has(t)||o.push({type:`remove`,path:t});let s=[...n].filter(e=>!r.has(e)).toSorted((e,t)=>_(t)-_(e));for(let e of s)o.push({type:`remove`,path:e,recursive:!0});let c=[...r].filter(e=>!n.has(e)).toSorted((e,t)=>_(e)-_(t));for(let e of c)o.push({type:`add`,path:e});for(let e of t)i.has(e)||o.push({type:`add`,path:e});return o}var v=e(i(),1);function y(e){let t=(0,le.c)(64),{entries:n,onSelectFile:i,selectedPath:ee,revealRequestId:d,ariaLabel:f,headerAccessory:p,footer:m,className:h}=e,g=ee===void 0?null:ee,_=d===void 0?0:d,{resolvedTheme:y}=l(),b;t[0]===n?b=t[1]:(b=n.map(he),t[0]=n,t[1]=b);let x=b,S;t[2]===x?S=t[3]:(S=ue(x),t[2]=x,t[3]=S);let C=S,w;t[4]===x?w=t[5]:(w=de(x),t[4]=x,t[5]=w);let T=w,[E]=(0,u.useState)(me),D;t[6]===n?D=t[7]:(D=n.map(pe),t[6]=n,t[7]=D);let O=D,k;t[8]===x?k=t[9]:(k=new Set(x),t[8]=x,t[9]=k);let A=(0,u.useRef)(k),j=(0,u.useRef)(i),ge=(0,u.useRef)(!1),M=(0,u.useRef)(null),_e=(0,u.useRef)(null),N,P;t[10]!==i||t[11]!==x?(N=()=>{A.current=new Set(x),j.current=i},P=[i,x],t[10]=i,t[11]=x,t[12]=N,t[13]=P):(N=t[12],P=t[13]),(0,u.useEffect)(N,P);let F,I;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{if(ge.current)return;let t=e.at(-1)?.replace(/\/$/,``);t&&A.current.has(t)&&j.current(t)},I=[],t[14]=F,t[15]=I):(F=t[14],I=t[15]);let L;t[16]===E.sort?L=t[17]:(L={density:`compact`,flattenEmptyDirectories:!0,initialExpansion:`open`,icons:ce,onSelectionChange:F,paths:I,search:!1,sort:E.sort,unsafeCSS:ae},t[16]=E.sort,t[17]=L);let{model:R}=oe(L),z;t[18]===C?z=t[19]:(z=e=>se(e,C),t[18]=C,t[19]=z);let B=ie(R,z),V,H;t[20]!==C||t[21]!==O||t[22]!==R||t[23]!==E||t[24]!==x||t[25]!==T?(V=()=>{E.update(T);let e=_e.current;if(e!==x){if(_e.current=x,e===null)R.resetPaths(x);else if(e.every((e,t)=>x[t]===e)){let t=fe(e,x);t.length>0&&R.batch(t)}else{let e=C.filter(e=>{let t=R.getItem(e);return t!==null&&`isExpanded`in t&&!t.isExpanded()});R.resetPaths(x);for(let t of e){let e=R.getItem(t);e!==null&&`collapse`in e&&e.collapse()}}R.setGitStatus(O)}},H=[C,O,R,E,x,T],t[20]=C,t[21]=O,t[22]=R,t[23]=E,t[24]=x,t[25]=T,t[26]=V,t[27]=H):(V=t[26],H=t[27]),(0,u.useEffect)(V,H);let U;t[28]!==R||t[29]!==_||t[30]!==g?(U=()=>{if(g===null){M.current=null;return}let e=R.getItem(g);if(e===null||e.isDirectory()){M.current=null;return}let t=M.current;if(t?.path===g&&t.revealRequestId===_)return;M.current={path:g,revealRequestId:_},ge.current=!0;for(let e of R.getSelectedPaths())e!==g&&R.getItem(e)?.deselect();let n=``;for(let e of g.split(`/`).slice(0,-1)){n+=`${e}/`;let t=R.getItem(n);t!==null&&`expand`in t&&t.expand()}e.select(),R.scrollToPath(g,{offset:`nearest`}),queueMicrotask(()=>{ge.current=!1})},t[28]=R,t[29]=_,t[30]=g,t[31]=U):U=t[31];let W;t[32]!==R||t[33]!==x||t[34]!==_||t[35]!==g?(W=[R,x,_,g],t[32]=R,t[33]=x,t[34]=_,t[35]=g,t[36]=W):W=t[36],(0,u.useEffect)(U,W);let G;t[37]===h?G=t[38]:(G=a(`flex min-h-0 flex-1 flex-col bg-background`,h),t[37]=h,t[38]=G);let K;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,v.jsx)(`span`,{className:`px-1 font-medium text-foreground`,children:`Files`}),t[39]=K):K=t[39];let q;t[40]===n.length?q=t[41]:(q=(0,v.jsx)(`span`,{className:`ml-auto tabular-nums`,children:n.length}),t[40]=n.length,t[41]=q);let J;t[42]!==B||t[43]!==C||t[44]!==R?(J=C.length>0?(0,v.jsx)(r,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":B?`Collapse all folders`:`Expand all folders`,onClick:()=>re(R,C,!B),children:(0,v.jsx)(c,{className:`size-3.5`,icon:B?s:o})}):null,t[42]=B,t[43]=C,t[44]=R,t[45]=J):J=t[45];let Y;t[46]!==p||t[47]!==q||t[48]!==J?(Y=(0,v.jsxs)(`div`,{className:`flex h-10 min-h-10 shrink-0 items-center gap-1 border-b border-border/60 bg-background px-2 text-xs text-muted-foreground in-data-[preview-panel-mode=inline]:mb-3 in-data-[preview-panel-mode=inline]:h-7 in-data-[preview-panel-mode=inline]:min-h-7 in-data-[preview-panel-mode=inline]:border-b-transparent`,"data-surface-subheader":!0,children:[K,q,p,J]}),t[46]=p,t[47]=q,t[48]=J,t[49]=Y):Y=t[49];let X;t[50]===R?X=t[51]:(X=e=>{if(e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let t=R.getSelectedPaths(),n=t.length===1?t[0]:void 0;n&&A.current.has(n)&&e.nativeEvent.composedPath().some(e=>e instanceof HTMLElement&&e.getAttribute(`data-item-path`)===n)&&j.current(n)},t[50]=R,t[51]=X);let Z;t[52]===y?Z=t[53]:(Z=ne(y),t[52]=y,t[53]=Z);let Q;t[54]!==f||t[55]!==R||t[56]!==X||t[57]!==Z?(Q=(0,v.jsx)(te,{model:R,"aria-label":f,onClickCapture:X,className:`min-h-0 flex-1 overflow-hidden`,style:Z}),t[54]=f,t[55]=R,t[56]=X,t[57]=Z,t[58]=Q):Q=t[58];let $;return t[59]!==m||t[60]!==G||t[61]!==Y||t[62]!==Q?($=(0,v.jsxs)(`div`,{className:G,children:[Y,Q,m]}),t[59]=m,t[60]=G,t[61]=Y,t[62]=Q,t[63]=$):$=t[63],$}function pe(e){return{path:e.path,status:e.status}}function me(){let e=new Map;return{sort:g(()=>e),update:t=>{e=t}}}function he(e){return e.path}export{d as a,p as i,h as n,f as r,y as t};
2
+ //# sourceMappingURL=DiffFileTree-BgjyfH71.js.map
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,$o as r,A as i,As as a,D as o,Em as s,Ey as c,I as l,Jb as u,Lf as d,Nx as f,Ox as p,Pp as m,Qu as h,RE as g,Rv as _,Ud as v,Vc as y,WS as b,Yp as x,Zp as S,_f as ee,ar as C,as as w,bd as te,cr as ne,er as re,es as ie,lr as T,mE as E,ng as D,or as ae,qn as O,rs as oe,sr as k,t as A,tr as se,ts as ce,ws as j,xd as M}from"./utils-hgbJ2TVM.js";import{M as N,N as P,R as F,W as I,Z as le,_t as ue,j as L,k as R}from"./runtime-D-mOwjrE.js";import{s as z}from"./vcsRefInvalidation-DmqB0sWy.js";import{C as B,D as de,k as fe}from"./entities-BBhhC0Ry.js";import{t as pe}from"./runtime-BSS7jQw6.js";import{d as me,f as he,g as ge,h as _e,l as ve,p as ye,x as V}from"./TooltipViewport-DJ2VRKCt.js";import{t as be}from"./useParams-Br7l7qPU.js";import{l as xe,p as Se}from"./toast-x69BFrW5.js";import{a as Ce,i as we,n as Te,r as Ee,t as De}from"./DiffFileTree-CaPQB8J4.js";import{K as Oe,s as ke,v as Ae}from"./useSettings-BNs1IeKk.js";import{f as je}from"./server-WufAYYa2.js";import{n as Me}from"./query-BFP47tsD.js";import{t as Ne}from"./use-atom-command-rhVarDA8.js";import{d as Pe,f as Fe}from"./providerSkills-9AaADmXt.js";import{t as Ie,u as Le}from"./queries-DY5q7KFy.js";import{a as Re,c as ze,l as Be,n as Ve,o as He,r as Ue,s as We,u as H}from"./diffRendering-CdquEtfn.js";import{F as Ge,I as Ke,L as qe,M as Je,P as U}from"./PanelLayoutControls-C1Bf67DQ.js";import{t as Ye}from"./DiffCommentAnnotation-mA-RZ8Su.js";import{c as Xe}from"./timestampFormat-wac2e_Jz.js";import{a as Ze,n as Qe,t as $e}from"./tooltip-D-SzZpgJ.js";import{n as et}from"./fileCommentAnnotations-BgdL_7u9.js";import{n as tt,t as nt}from"./toggle-group-Clz6KDtW.js";import{i as rt,l as it,n as at,o as ot,r as st,s as ct,t as lt}from"./combobox-BdGKdc6i.js";import{Ca as ut,ba as dt,ma as ft,pa as pt}from"./main-COMts6-0.js";import{A as mt,D as ht,E as W,O as gt,T as G,j as _t,k as vt,w as yt}from"./_chat-D4YotsBW.js";var K=e(t(),1),q=g();function bt(e,t){let n=(0,q.c)(4),r=Ie(e,t),i;return n[0]!==r.data||n[1]!==r.error||n[2]!==r.isPending?(i={data:r.data,error:r.error,isPending:r.isPending},n[0]=r.data,n[1]=r.error,n[2]=r.isPending,n[3]=i):i=n[3],i}var J=e(E(),1);function xt(e){let t=(0,q.c)(17),{filePath:n}=e,r=(0,K.useRef)(null),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={onCopy:()=>ht(r),onError:e=>W(r,e),timeout:G},t[0]=i):i=t[0];let{copyToClipboard:a,isCopied:o}=Se(i),s;t[1]!==a||t[2]!==n?(s=(0,J.jsx)(T,{ref:r,size:`icon-micro`,variant:`ghost-muted`,"aria-label":`Copy file path`,onClick:()=>a(n,void 0)}),t[1]=a,t[2]=n,t[3]=s):s=t[3];let c=o&&`text-success`,l;t[4]===c?l=t[5]:(l=A(`size-3`,c),t[4]=c,t[5]=l);let u=o?me:V,d;t[6]!==l||t[7]!==u?(d=(0,J.jsx)(ve,{className:l,icon:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]!==s||t[10]!==d?(f=(0,J.jsx)(Ze,{render:s,children:d}),t[9]=s,t[10]=d,t[11]=f):f=t[11];let p=o?`Copied`:`Copy path`,m;t[12]===p?m=t[13]:(m=(0,J.jsx)(Qe,{children:(0,J.jsx)(`p`,{children:p})}),t[12]=p,t[13]=m);let h;return t[14]!==f||t[15]!==m?(h=(0,J.jsxs)($e,{children:[f,m]}),t[14]=f,t[15]=m,t[16]=h):h=t[16],h}var St=[];function Ct(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function Y(e,t,n){let r=Ct(t),i=e.findIndex(e=>e.side===r&&e.lineNumber===t.end);return i<0?[...e,{side:r,lineNumber:t.end,metadata:{entries:[n]}}]:e.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,n]}}:e)}function wt(e){let t=(0,q.c)(66),{codeViewKey:n,files:r,sectionId:a,sectionTitle:s,composerDraftTarget:c,options:u,viewerRef:d,className:f,renderCodeViewFooter:p,unsafeCSSExtra:m,renderHeaderMetadata:h,renderHeaderFilenameSuffix:g,renderHeaderPrefix:_,onRevealSearchMatch:v}=e,y=o(kt),b=o(X),x;t[0]===c?x=t[1]:(x=e=>e.getComposerDraft(c)?.reviewComments??St,t[0]=c,t[1]=x);let S=o(x),[ee,C]=(0,K.useState)(null),[w,te]=(0,K.useState)(null),[ne,re]=(0,K.useState)(``),ie;t[2]===r?ie=t[3]:(ie=new Map(r.map(Ot)),t[2]=r,t[3]=ie);let T=ie,E;if(t[4]!==w||t[5]!==r||t[6]!==S||t[7]!==a){let e;t[9]!==w||t[10]!==S||t[11]!==a?(e=e=>{let{fileDiff:t,filePath:n,fileKey:r,fileVersion:i,collapsed:o}=e,s=S.filter(e=>e.sectionId===a&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=l(t,n);return r?Y(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),c=w?.fileKey===r?[...s,w.annotation]:s;return{id:r,type:`diff`,fileDiff:t,annotations:c,collapsed:o,version:Re(`${i}:${o?`1`:`0`}:${c.flatMap(Et).join(`:`)}`)}},t[9]=w,t[10]=S,t[11]=a,t[12]=e):e=t[12],E=r.map(e),t[4]=w,t[5]=r,t[6]=S,t[7]=a,t[8]=E}else E=t[8];let D=E,ae;t[13]!==c||t[14]!==w?.annotation||t[15]!==b?(ae=e=>{C(null),w?.annotation.metadata.entries.some(t=>t.id===e)?(te(null),re(``)):b(c,e)},t[13]=c,t[14]=w?.annotation,t[15]=b,t[16]=ae):ae=t[16];let O=ae,oe;t[17]!==y||t[18]!==c||t[19]!==w||t[20]!==T||t[21]!==a||t[22]!==s?(oe=(e,t)=>{let n=w?.annotation.metadata.entries.find(t=>t.id===e),r=w?T.get(w.fileKey):void 0;if(!n||!r)return;let o=i({id:n.id,sectionId:a,sectionTitle:s,filePath:r.filePath,fileDiff:r.fileDiff,range:n.range,text:t});o&&y(c,o),C(null),te(null),re(``)},t[17]=y,t[18]=c,t[19]=w,t[20]=T,t[21]=a,t[22]=s,t[23]=oe):oe=t[23];let k=oe,A;t[24]!==a||t[25]!==s?(A=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let r=et(),o=i({id:r,sectionId:a,sectionTitle:s,filePath:H(n.fileDiff),fileDiff:n.fileDiff,range:e,text:``});o&&(re(``),te({fileKey:n.id,annotation:{side:Ct(e),lineNumber:e.end,metadata:{entries:[{id:r,kind:`draft`,range:e,rangeLabel:o.rangeLabel,text:``}]}}}))},t[24]=a,t[25]=s,t[26]=A):A=t[26];let se=A,ce=w!==null,j;t[27]===d?j=t[28]:(j=d?{viewerRef:d}:{},t[27]=d,t[28]=j);let M;t[29]===f?M=t[30]:(M=f?{className:f}:{},t[29]=f,t[30]=M);let N;t[31]===m?N=t[32]:(N=m?{unsafeCSSExtra:m}:{},t[31]=m,t[32]=N);let P;t[33]===h?P=t[34]:(P=h?{renderHeaderMetadata:e=>e.type===`diff`?h(e.fileDiff):null}:{},t[33]=h,t[34]=P);let F;t[35]===p?F=t[36]:(F=p?{renderCodeViewFooter:p}:{},t[35]=p,t[36]=F);let I;t[37]===v?I=t[38]:(I=e=>v(e.id),t[37]=v,t[38]=I);let le=!ce,ue=!ce,L;t[39]!==se||t[40]!==u||t[41]!==le||t[42]!==ue?(L={...u,enableGutterUtility:le,enableLineSelection:ue,onGutterUtilityClick:se},t[39]=se,t[40]=u,t[41]=le,t[42]=ue,t[43]=L):L=t[43];let R;t[44]===g?R=t[45]:(R=e=>e.type===`diff`?g(e.fileDiff):null,t[44]=g,t[45]=R);let z;t[46]===_?z=t[47]:(z=e=>e.type===`diff`?_(e.fileDiff,e.id,e.collapsed===!0):null,t[46]=_,t[47]=z);let B;t[48]!==ne||t[49]!==O||t[50]!==k?(B=e=>{let t=e.metadata.entries.some(Tt);return(0,J.jsx)(`div`,{className:t?`py-1`:`divide-y divide-border/30 border-y border-border/30`,children:e.metadata.entries.map(e=>(0,J.jsx)(Ye,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.kind===`draft`?ne:e.text,onTextChange:re,onCancel:()=>O(e.id),onComment:t=>k(e.id,t),onDelete:()=>O(e.id)},e.id))})},t[48]=ne,t[49]=O,t[50]=k,t[51]=B):B=t[51];let de;return t[52]!==n||t[53]!==D||t[54]!==ee||t[55]!==P||t[56]!==F||t[57]!==I||t[58]!==L||t[59]!==R||t[60]!==z||t[61]!==B||t[62]!==j||t[63]!==M||t[64]!==N?(de=(0,J.jsx)(U,{...j,...M,...N,...P,...F,items:D,selectedLines:ee,onSelectedLinesChange:C,onRevealSearchMatch:I,options:L,renderHeaderFilenameSuffix:R,renderHeaderPrefix:z,renderAnnotation:B},n),t[52]=n,t[53]=D,t[54]=ee,t[55]=P,t[56]=F,t[57]=I,t[58]=L,t[59]=R,t[60]=z,t[61]=B,t[62]=j,t[63]=M,t[64]=N,t[65]=de):de=t[65],de}function Tt(e){return e.kind===`draft`}function Et(e){return e.metadata.entries.map(Dt)}function Dt(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Ot(e){return[e.fileKey,e]}function X(e){return e.removeReviewComment}function kt(e){return e.addReviewComment}function At(e){let t=_(4),n=R();return{diffPreview:P(e,{label:`environment-data:review:diff-preview`,tag:y.reviewGetDiffPreview,staleTimeMs:5e3}),diffFilePatch:L(e,{label:`environment-data:review:diff-file-patch`,staleTimeMs:3e5,execute:e=>le(y.reviewGetDiffPreview,e.request).pipe(t.withPermit,f(t=>{let n=t.sources.find(t=>t.kind===e.request.file.sourceKind);return n?b(n):p(new D({operation:`review.diffFilePatch`,kind:`git`,detail:`Diff no longer available. Refresh the comparison.`}))}))}),diffFileContents:N(e,{label:`environment-data:review:diff-file-contents`,tag:y.reviewGetDiffFileContents,scheduler:n,concurrency:{mode:`singleFlight`,key:({environmentId:e,input:t})=>JSON.stringify([e,t.cwd,t.sourceKind,t.baseRef,t.headRef,t.oldPath,t.newPath,t.changeType])}})}}var jt=At(pe);function Mt(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function Nt(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&Mt(t)===e.name),i=r.find(e=>e.remoteName===`origin`)??r[0]??null;return i&&n.delete(i),{id:`local:${e.name}`,label:e.name,local:e,remote:i}}),i=t.filter(e=>n.has(e)).map(e=>({id:`remote:${e.name}`,label:e.name,local:null,remote:e}));return[...r,...i]}function Pt(e,t){let n=t.trim().toLocaleLowerCase();return n.length===0?e:e.filter(e=>e.label.toLocaleLowerCase().includes(n)||e.local?.name.toLocaleLowerCase().includes(n)===!0||e.remote?.name.toLocaleLowerCase().includes(n)===!0)}var Ft=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function It(e){let t=(0,q.c)(86),{environmentId:n,cwd:i,source:a,baseRef:o,ignoreWhitespace:s,theme:c,revision:l,preview:u}=e,d=(0,K.useContext)(ie),f;t[0]!==o||t[1]!==i||t[2]!==n||t[3]!==s||t[4]!==a?.diffHash||t[5]!==a?.kind?(f=JSON.stringify([n,i,a?.kind,a?.diffHash,o,s]),t[0]=o,t[1]=i,t[2]=n,t[3]=s,t[4]=a?.diffHash,t[5]=a?.kind,t[6]=f):f=t[6];let p=f,m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=[0,1,2,3],t[7]=m):m=t[7];let h;t[8]===p?h=t[9]:(h={scope:p,indices:m},t[8]=p,t[9]=h);let[g,_]=(0,K.useState)(h),v;t[10]!==g.indices||t[11]!==g.scope||t[12]!==p?(v=g.scope===p?g.indices:[0,1,2,3],t[10]=g.indices,t[11]=g.scope,t[12]=p,t[13]=v):v=t[13];let y=v,b;t[14]===a?.files?b=t[15]:(b=()=>a?.files?.toSorted(Q)??[],t[14]=a?.files,t[15]=b),a?.files;let x;t[16]===b?x=t[17]:(x=b(),t[16]=b,t[17]=x);let S=x,ee;t[18]!==o||t[19]!==i||t[20]!==n||t[21]!==S||t[22]!==s||t[23]!==y||t[24]!==p||t[25]!==a?(ee=!n||!i||!a?[]:y.filter(e=>e<S.length).map(e=>{let t=S[e];return{index:e,query:jt.diffFilePatch({environmentId:n,input:{cacheKey:p,request:{cwd:i,...o?{baseRef:o}:{},ignoreWhitespace:s,file:{path:t.path,previousPath:t.previousPath,sourceKind:a.kind}}}})}}),t[18]=o,t[19]=i,t[20]=n,t[21]=S,t[22]=s,t[23]=y,t[24]=p,t[25]=a,t[26]=ee):ee=t[26];let C=ee,te;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(te=[],t[27]=te):te=t[27];let ne;t[28]!==l||t[29]!==p?(ne={scope:p,revision:l,queries:te},t[28]=l,t[29]=p,t[30]=ne):ne=t[30];let re=(0,K.useRef)(ne),T,E;t[31]!==C||t[32]!==d||t[33]!==l||t[34]!==p?(T=()=>{let e=re.current;re.current={scope:p,revision:l,queries:C};for(let{query:t}of C){let n=e.scope===p&&e.revision!==l,r=!e.queries.some(e=>e.query===t)&&d.get(t)._tag!==`Initial`&&!d.get(t).waiting;(n||r)&&d.refresh(t)}},E=[p,l,C,d],t[31]=C,t[32]=d,t[33]=l,t[34]=p,t[35]=T,t[36]=E):(T=t[35],E=t[36]),(0,K.useEffect)(T,E);let D;t[37]===c?D=t[38]:(D=ce(e=>w(e,e=>j(e,e=>{let t=ze(e.diff,`diff-panel:${c}`,{compactPartialHunkOffsets:!0});if(t?.kind===`files`&&t.files.length===1&&e.files?.length===1){let n=e.files[0],r={...t.files[0],name:n.path};n.previousPath===null?delete r.prevName:r.prevName=n.previousPath,t={...t,files:[r]}}return{source:e,patch:t}}))),t[37]=c,t[38]=D);let ae=D,O;t[39]!==ae||t[40]!==C?(O=oe(e=>new Map(C.map(t=>{let{index:n,query:r}=t;return[n,e(ae(r))]}))),t[39]=ae,t[40]=C,t[41]=O):O=t[41];let k=r(O),A;t[42]===k?A=t[43]:(A=(e,t)=>{let n=k.get(t);return!n||n._tag===`Initial`},t[42]=k,t[43]=A);let se=S.findIndex(A),M=a?se<0?S.length:se:u?.kind===`files`?u.files.length:0,N;t[44]===p?N=t[45]:(N=e=>_(t=>{let n=t.scope===p?t.indices:[0,1,2,3],r=e.filter(e=>!n.includes(e));return r.length===0?t:{scope:p,indices:[...n,...r]}}),t[44]=p,t[45]=N);let P=N,F;t[46]!==P||t[47]!==M?(F=()=>P(Array.from({length:4},(e,t)=>M+t)),t[46]=P,t[47]=M,t[48]=F):F=t[48];let I=F,le;t[49]===P?le=t[50]:(le=e=>P([e]),t[49]=P,t[50]=le);let ue=le,L;t[51]!==S||t[52]!==C?(L={queries:C,files:S},t[51]=S,t[52]=C,t[53]=L):L=t[53];let R=(0,K.useRef)(L),z,B;t[54]!==S||t[55]!==C?(z=()=>{R.current={queries:C,files:S}},B=[C,S],t[54]=S,t[55]=C,t[56]=z,t[57]=B):(z=t[56],B=t[57]),(0,K.useLayoutEffect)(z,B);let de;t[58]===d?de=t[59]:(de=e=>{let{queries:t,files:n}=R.current,r=t.find(t=>{let{index:r}=t;return n[r]?.path===e})?.query;r&&d.refresh(r)},t[58]=d,t[59]=de);let fe=de,pe;t[60]!==S||t[61]!==k||t[62]!==u||t[63]!==p||t[64]!==a?(pe=a?S.map((e,t)=>{let n=k.get(t);if(n?._tag===`Success`&&n.value.patch?.kind===`files`){let t=n.value.patch.files.find(t=>H(t)===e.path);if(t)return t}return{name:e.path,...e.previousPath?{prevName:e.previousPath}:{},type:e.previousPath?`rename-changed`:`change`,hunks:[],additionLines:[],deletionLines:[],splitLineCount:0,unifiedLineCount:0,isPartial:!0,cacheKey:`${p}:${e.path}:pending`}}):(u?.kind===`files`?u.files:[]).toSorted(Rt),t[60]=S,t[61]=k,t[62]=u,t[63]=p,t[64]=a,t[65]=pe):pe=t[65];let me=pe,he;if(t[66]!==S||t[67]!==k){let e;t[69]===k?e=t[70]:(e=(e,t)=>{let n=k.get(t);return[e.path,{error:n?._tag===`Failure`||n?._tag===`Success`&&(n.value.patch?.kind!==`files`||!n.value.patch.files.some(t=>H(t)===e.path)),truncated:n?._tag===`Success`&&n.value.source.truncated}]},t[69]=k,t[70]=e),he=new Map(S.map(e)),t[66]=S,t[67]=k,t[68]=he}else he=t[68];let ge=he,_e;if(t[71]!==S||t[72]!==k){let e;t[74]===k?e=t[75]:(e=(e,t)=>{let n=k.get(t);return n&&n._tag!==`Initial`},t[74]=k,t[75]=e),_e=new Set(S.filter(e).map(Lt)),t[71]=S,t[72]=k,t[73]=_e}else _e=t[73];let ve=_e,ye=[...k.values()].some(Z),V;return t[76]!==ge||t[77]!==I||t[78]!==ve||t[79]!==me||t[80]!==ue||t[81]!==fe||t[82]!==p||t[83]!==M||t[84]!==ye?(V={scope:p,fileStates:ge,isPending:ye,retry:fe,requestFile:ue,readyFilePaths:ve,renderableFiles:me,settledFileCount:M,loadNextFiles:I},t[76]=ge,t[77]=I,t[78]=ve,t[79]=me,t[80]=ue,t[81]=fe,t[82]=p,t[83]=M,t[84]=ye,t[85]=V):V=t[85],V}function Z(e){return e._tag===`Initial`||e.waiting}function Lt(e){return e.path}function Rt(e,t){return Ft.compare(H(e),H(t))}function Q(e,t){return Ft.compare(e.path,t.path)}function zt(e){let t=(0,q.c)(5),{load:n,count:r}=e,i=(0,K.useRef)(null),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{if(!i.current)return;let e=new IntersectionObserver(e=>{e.some(Vt)&&n()},{rootMargin:`600px`});return e.observe(i.current),()=>e.disconnect()},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,K.useEffect)(a,o);let s;return t[3]===r?s=t[4]:(s=(0,J.jsx)(`div`,{ref:i,role:`status`,"aria-label":`Loading diff…`,children:Array.from({length:Math.min(r,4)},Bt)}),t[3]=r,t[4]=s),s}function Bt(e,t){return(0,J.jsx)(`div`,{"aria-hidden":!0,className:`border-b border-border/40`,children:(0,J.jsx)(Ge,{titleWidth:`medium`})},t)}function Vt(e){return e.isIntersecting}function Ht(e){let t=(0,q.c)(16),{error:n,truncated:r,retry:i}=e;if(!n&&!r)return null;let a=n?`Retry loading diff`:`Partial diff preview`,o;t[0]!==n||t[1]!==i?(o=e=>{e.stopPropagation(),n&&i()},t[0]=n,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==a||t[4]!==o?(s=(0,J.jsx)(T,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":a,onClick:o}),t[3]=a,t[4]=o,t[5]=s):s=t[5];let c;t[6]===n?c=t[7]:(c=n?(0,J.jsx)(x,{className:`size-3`}):(0,J.jsx)(d,{className:`size-3`}),t[6]=n,t[7]=c);let l;t[8]!==s||t[9]!==c?(l=(0,J.jsx)(Ze,{render:s,children:c}),t[8]=s,t[9]=c,t[10]=l):l=t[10];let u=n?`Retry loading diff`:`This file is too large to show in full. Counts include all changes.`,f;t[11]===u?f=t[12]:(f=(0,J.jsx)(Qe,{children:u}),t[11]=u,t[12]=f);let p;return t[13]!==l||t[14]!==f?(p=(0,J.jsxs)($e,{children:[l,f]}),t[13]=l,t[14]=f,t[15]=p):p=t[15],p}var Ut=`__automatic_base_ref__`,Wt=`p4code.diffFileTreeOpen`,Gt=new WeakMap;function Kt(e){let t=Gt.get(e);if(t)return t;let n={fileDiff:e,fileKey:Ue(e),fileVersion:Ve(e)};return Gt.set(e,n),n}var qt=new Set;function Jt(e){let t=(0,q.c)(21),{filePath:n,fileKey:r,collapsed:i,unavailable:a,iconClassName:o,onToggle:s}=e,c=i?`Expand ${n}`:`Collapse ${n}`,l=!i,u;t[0]!==r||t[1]!==s?(u=e=>{e.stopPropagation(),s(r)},t[0]=r,t[1]=s,t[2]=u):u=t[2];let d;t[3]!==c||t[4]!==l||t[5]!==u||t[6]!==a?(d=(0,J.jsx)(T,{size:`icon-micro`,variant:`ghost`,className:`-ms-0.5`,"aria-label":c,"aria-expanded":l,disabled:a,onClick:u}),t[3]=c,t[4]=l,t[5]=u,t[6]=a,t[7]=d):d=t[7];let f;t[8]===o?f=t[9]:(f=A(`size-4`,o),t[8]=o,t[9]=f);let p=i?ye:he,m;t[10]!==f||t[11]!==p?(m=(0,J.jsx)(ve,{className:f,icon:p}),t[10]=f,t[11]=p,t[12]=m):m=t[12];let h;t[13]!==d||t[14]!==m?(h=(0,J.jsx)(Ze,{render:d,children:m}),t[13]=d,t[14]=m,t[15]=h):h=t[15];let g=i?`Expand diff`:`Collapse diff`,_;t[16]===g?_=t[17]:(_=(0,J.jsx)(Qe,{side:`top`,children:g}),t[16]=g,t[17]=_);let v;return t[18]!==_||t[19]!==h?(v=(0,J.jsxs)($e,{children:[h,_]}),t[18]=_,t[19]=h,t[20]=v):v=t[20],v}function Yt(e){let t=(0,q.c)(11),{filePath:n,hasStat:r,error:i,truncated:a,onRetry:o}=e,s;t[0]===n?s=t[1]:(s=(0,J.jsx)(xt,{filePath:n}),t[0]=n,t[1]=s);let c;t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==o||t[6]!==a?(c=r?(0,J.jsx)(Ht,{error:i,truncated:a,retry:()=>o(n)}):null,t[2]=i,t[3]=n,t[4]=r,t[5]=o,t[6]=a,t[7]=c):c=t[7];let l;return t[8]!==s||t[9]!==c?(l=(0,J.jsxs)(J.Fragment,{children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function Xt({mode:e=`inline`,composerDraftTarget:t,workspaceMutationId:i}){let{resolvedTheme:o}=Oe(),l=ke(),d=l.diffLayout,f=Ae(),[p,g]=(0,K.useState)(l.wordWrap),[_,y]=(0,K.useState)(l.diffIgnoreWhitespace),[b,x]=a(Wt,!1,c),[w,ie]=(0,K.useState)(``),[E,D]=(0,K.useState)(()=>({scopeKey:null,fileKeys:qt})),[oe,ce]=(0,K.useState)(0),[j,N]=(0,K.useState)(null),P=be({strict:!1,select:e=>xe(e)}),le=P?.threadId??null,L=fe(P),R=de(P)?.projection??null,pe=z(L?.environmentId??null),{canReadFiles:me}=pe,he=L?.projectId??null,ye=B(L&&he?{environmentId:L.environmentId,projectId:he}:null),V=L?.worktreePath??ye?.workspaceRoot,Se=L?.worktreePath?void 0:ye?.repositoryIdentity?.rootPath,Ie=r(je.configValueAtom(L?.environmentId??null)),Re=Pe(L?.environmentId??null),Ve=dt(L?.environmentId??null,Ie?.availableEditors??[]),Ue=Ne(jt.diffFileContents),Ge=Me(L!=null&&V!=null?Le.status({environmentId:L.environmentId,input:{cwd:V}}):null),U=_t(e=>mt(e.byThreadKey,P)),Ye=Ge.data?.isRepo??!0,{turnDiffSummaries:et,inferredCheckpointTurnCountByRunId:ht}=vt(R),W=(0,K.useMemo)(()=>[...et].toSorted((e,t)=>{let n=e.checkpointTurnCount??ht[e.runId]??0,r=t.checkpointTurnCount??ht[t.runId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n}),[ht,et]);(0,K.useEffect)(()=>{P&&U.kind===`turn`&&_t.getState().reconcileTurnSelection(P,W.map(e=>e.runId))},[U,W,P]);let G=U.kind===`turn`?U.turnId:null,q=U.kind===`unstaged`?`unstaged`:`branch`,xt=U.kind===`branch`?U.baseRef:null,St=U.kind===`turn`?U.filePath:null,Ct=U.kind===`turn`?U.revealRequestId:0,Y=G===null?void 0:W.find(e=>e.runId===G)??W[0],Tt=Y&&(Y.checkpointTurnCount??ht[Y.runId]),Et=W[0],Dt=G===null?q===`unstaged`?`Uncommitted`:`Changes`:Y?.runId===Et?.runId?`Latest turn`:`Turn ${Tt??`?`}`,Ot=Y?`turn:${Y.runId}`:q,X=P?`${P.environmentId}:${P.threadId}:${Ot}`:null,kt=`${X??Ot}:${oe}`,At=Y?`Turn ${Tt??`?`}`:q===`unstaged`?`Uncommitted`:`Changes`,Mt=(0,K.useMemo)(()=>typeof Tt==`number`?{fromTurnCount:Math.max(0,Tt-1),toTurnCount:Tt}:null,[Tt]),Ft=bt({environmentId:L?.environmentId??null,threadId:le,fromTurnCount:Mt?.fromTurnCount??null,toTurnCount:Mt?.toTurnCount??null,ignoreWhitespace:_,cacheScope:Y?`turn:${Y.runId}`:null},{enabled:Ye&&Y!==void 0}),Z=Me(me&&G===null&&L&&V?jt.diffPreview({environmentId:L.environmentId,input:{cwd:V,...xt?{baseRef:xt}:{},ignoreWhitespace:_}}):null),Lt=Ye&&G===null&&L!=null&&V!=null,Rt=P?`${P.environmentId}:${P.threadId}`:null,Q=Z.data?.sources.find(e=>e.kind===(q===`unstaged`?`working-tree`:`branch-range`)),Bt=Z.refresh,Vt=Bt,Ht=(0,K.useMemo)(()=>{let e=Z.data;if(G===null&&L&&e&&Q&&me)return Je(Ue,{environmentId:L.environmentId,cwd:e.cwd,sourceKind:Q.kind,baseRef:Q.baseRef,headRef:Q.headRef,cacheKey:Q.diffHash})},[L,Z.data,Ue,me,Q,G]),Gt=(0,K.useRef)(Ht);Gt.current=Ht;let Xt=(0,K.useCallback)(async e=>{let t=Gt.current;if(!t)throw Error(`Diff file contents are unavailable for this selection.`);return t(e)},[]),Zt=Me(G===null&&q===`branch`&&L&&Z.data?.cwd?Le.listRefs({environmentId:L.environmentId,input:{cwd:Z.data.cwd,includeMatchingRemoteRefs:!0,refKind:`local`,...w.trim().length>0?{query:w.trim()}:{},limit:100}}):null),Qt=Me(G===null&&q===`branch`&&L&&Z.data?.cwd?Le.listRefs({environmentId:L.environmentId,input:{cwd:Z.data.cwd,includeMatchingRemoteRefs:!0,refKind:`remote`,...w.trim().length>0?{query:w.trim()}:{},limit:100}}):null),$t=Nt(Zt.data?.refs.filter(e=>e.name!==Q?.headRef)??[],Qt.data?.refs??[]),en=Pt($t,w),tn=e=>xt&&xt===e.remote?.name?xt:e.local?.name??e.remote?.name??e.id,nn=[Ut,...$t.map(tn)],rn=[...w.trim().length===0?[Ut]:[],...en.map(tn)],an=Q?.diff,on=Y?Ft.data?.diff:an,sn=!Y&&Q?.truncated===!0,cn=Y?Ft.isPending:Z.isPending,ln=Y?Ft.error:Z.error,un=typeof on==`string`&&on.trim().length===0,$=!Y&&Q?.truncated&&Q.files?Q:null,dn=(0,K.useMemo)(()=>$?null:ze(on,`diff-panel:${o}`,{compactPartialHunkOffsets:G===null}),[$,o,on,G]),fn=(0,K.useMemo)(()=>new Map($?.files?.map(e=>[e.path,e])),[$?.files]),{scope:pn,isPending:mn,fileStates:hn,retry:gn,requestFile:_n,readyFilePaths:vn,renderableFiles:yn,settledFileCount:bn,loadNextFiles:xn}=It({environmentId:L?.environmentId,cwd:Z.data?.cwd,source:$,baseRef:$?.baseRef??xt,ignoreWhitespace:_,theme:o,revision:Z.data?u(Z.data.generatedAt):void 0,preview:dn}),Sn=Bt;(0,K.useEffect)(()=>{if(!Lt)return;let e=()=>Sn();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[Lt,Sn]),gt({enabled:Lt,mutationId:i,refresh:Sn,resourceKey:`diff:${Rt??``}`});let Cn=Z.isPending||mn,wn=(0,K.useMemo)(()=>yn.map(Kt),[yn]),Tn=(0,K.useMemo)(()=>l.diffFilesCollapsed?new Set(wn.map(e=>e.fileKey)):qt,[wn,l.diffFilesCollapsed]),En=E.scopeKey===X?E.fileKeys:Tn,Dn=(0,K.useCallback)(()=>bn<yn.length?(0,J.jsx)(zt,{load:xn,count:yn.length-bn}):null,[bn,yn.length,xn]),On=(0,K.useMemo)(()=>wn.filter(({fileDiff:e})=>!$||vn.has(H(e))).map(({fileDiff:e,fileKey:t,fileVersion:n})=>({fileDiff:e,filePath:H(e),fileKey:t,fileVersion:n,collapsed:En.has(t)||e.cacheKey?.endsWith(`:pending`)===!0})),[En,wn,$,vn]),kn=(0,K.useMemo)(()=>wn.map(e=>e.fileKey),[wn]),An=Ee(kn,En),jn=(0,K.useMemo)(()=>!Y&&Q?.files?Q.files.reduce((e,t)=>({additions:e.additions+t.additions,deletions:e.deletions+t.deletions}),{additions:0,deletions:0}):We(yn),[yn,Q,Y]),Mn=(0,K.useMemo)(()=>Te(yn),[yn]),Nn=St?On.find(e=>e.filePath===St)?.fileKey??null:null;(0,K.useEffect)(()=>{Nn&&j?.getInstance()&&j.scrollTo({type:`item`,id:Nn,align:`start`})},[j,kt,Nn,Ct]);let Pn=(0,K.useMemo)(()=>({collapseScopeKey:X,diffSelection:U}),[X,U]),Fn=Ce(j,Pn,On.map(e=>e.fileKey)),In=(0,K.useCallback)(e=>{let t=wn.findIndex(t=>H(t.fileDiff)===e),n=wn[t];n&&(D(e=>{let t=new Set(e.scopeKey===X?e.fileKeys:Tn);return t.delete(n.fileKey),{scopeKey:X,fileKeys:t}}),$&&t>=bn&&_n(t),Fn(n.fileKey))},[wn,X,Tn,Fn,$,bn,_n]),Ln=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!$||!St)return;let e=`${St}:${Ct}`;(Ln.current?.cache!==pn||Ln.current.key!==e)&&(Ln.current={cache:pn,key:e},In(St))},[$,St,Ct,pn,In]);let Rn=(0,K.useCallback)(e=>{Fe({threadRef:P,filePath:e,activeCwd:V,repositoryRoot:Se,openInEditor:e=>{(async()=>{let t=await Ve(e);t._tag===`Failure`&&!F(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,...P?{environmentId:P.environmentId,threadId:P.threadId}:{},...ue(I(t))})})()}})},[V,Se,Ve,P]),zn=(0,K.useRef)({collapseScopeKey:X,defaultCollapsedDiffFileKeys:Tn});(0,K.useLayoutEffect)(()=>{zn.current={collapseScopeKey:X,defaultCollapsedDiffFileKeys:Tn}},[X,Tn]);let Bn=(0,K.useCallback)(e=>{let{collapseScopeKey:t,defaultCollapsedDiffFileKeys:n}=zn.current;D(r=>{let i=new Set(r.scopeKey===t?r.fileKeys:n);return i.has(e)?i.delete(e):i.add(e),{scopeKey:t,fileKeys:i}})},[]),Vn=(0,K.useCallback)(e=>{let{collapseScopeKey:t,defaultCollapsedDiffFileKeys:n}=zn.current;D(r=>{let i=r.scopeKey===t?r.fileKeys:n;if(!i.has(e))return r;let a=new Set(i);return a.delete(e),{scopeKey:t,fileKeys:a}})},[]),Hn=(0,K.useCallback)(()=>{ce(e=>e+1),D(e=>{let t=e.scopeKey===X?e.fileKeys:Tn;return{scopeKey:X,fileKeys:we(kn,t)}})},[X,Tn,kn]),Un=e=>{P&&_t.getState().selectTurn(P,e)},Wn=e=>{P&&_t.getState().selectGitScope(P,e)},Gn=e=>{P&&_t.getState().selectBranchBaseRef(P,e)},Kn=Y?`turn:${Y.runId}`:``,qn=G===null?q:Y?.runId===Et?.runId?`latest`:Kn,Jn=e=>{if(e===`unstaged`||e===`branch`)Wn(e);else if(e===`latest`)Et&&Un(Et.runId);else{let t=W.find(t=>`turn:${t.runId}`===e);t&&Un(t.runId)}},Yn=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]`,children:[(0,J.jsxs)(O,{children:[(0,J.jsxs)(ne,{render:(0,J.jsx)(T,{size:`xs`,variant:`secondary`}),className:`max-w-full`,"aria-label":`Diff scope: ${Dt}`,children:[(0,J.jsx)(`span`,{className:`truncate`,children:Dt}),(0,J.jsx)(M,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,J.jsxs)(n,{align:`start`,children:[(0,J.jsxs)(re,{value:qn,onValueChange:Jn,children:[(0,J.jsx)(se,{value:`branch`,closeOnClick:!0,children:(0,J.jsx)(`span`,{children:`Changes`})}),(0,J.jsx)(se,{value:`unstaged`,closeOnClick:!0,children:(0,J.jsx)(`span`,{children:`Uncommitted`})}),(0,J.jsx)(se,{value:`latest`,closeOnClick:!0,children:(0,J.jsx)(`span`,{children:`Latest turn`})})]}),(0,J.jsxs)(C,{children:[(0,J.jsx)(k,{children:`Turn`}),(0,J.jsx)(ae,{children:(0,J.jsx)(re,{value:Kn,onValueChange:Jn,children:W.map(e=>{let t=e.checkpointTurnCount??ht[e.runId]??`?`;return(0,J.jsx)(se,{value:`turn:${e.runId}`,closeOnClick:!0,children:(0,J.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`span`,{children:[`Turn `,t]}),(0,J.jsx)(`span`,{className:`ml-auto text-xs tabular-nums text-muted-foreground`,children:Xe(e.completedAt,l.timestampFormat)})]})},e.runId)})})})]})]})]}),G===null&&q===`branch`&&Q?.baseRef&&(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-2 overflow-hidden text-xs text-muted-foreground`,"aria-label":`Comparing ${Q.headRef??`HEAD`} against ${Q.baseRef}`,children:[(0,J.jsxs)($e,{children:[(0,J.jsxs)(Ze,{render:(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`}),children:[(0,J.jsx)(`span`,{className:`min-w-0 max-w-48 truncate`,children:Q.headRef??`HEAD`}),(0,J.jsx)(h,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,J.jsx)(Qe,{side:`top`,children:`${Q.headRef??`HEAD`} → ${Q.baseRef}`})]}),(0,J.jsxs)(lt,{items:nn,filteredItems:rn,value:xt??Ut,onOpenChange:e=>{e||ie(``)},onValueChange:e=>{e&&Gn(e===Ut?null:e)},children:[(0,J.jsxs)(it,{render:(0,J.jsx)(T,{variant:`ghost-muted`,size:`xs`}),className:`min-w-0 max-w-48`,"aria-label":`Change comparison target. Currently ${Q.baseRef}`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:Q.baseRef}),(0,J.jsx)(M,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,J.jsxs)(ot,{align:`start`,className:`w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden`,children:[(0,J.jsx)(ct,{placeholder:`Search refs...`,value:w,onChange:e=>ie(e.target.value)}),(0,J.jsxs)(`div`,{className:`grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-3xs text-muted-foreground uppercase tracking-wide`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center`,children:[(0,J.jsx)(`span`,{children:`Branch`}),(0,J.jsx)(`span`,{className:`text-right`,children:`Remote`})]})]}),(0,J.jsx)(at,{children:`No matching refs.`}),(0,J.jsxs)(rt,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,J.jsx)(st,{className:`w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)]`,value:Ut,children:(0,J.jsx)(`span`,{className:`block min-w-0 truncate`,children:`Automatic`})}),$t.map(e=>{let t=tn(e),n=e.local!==null&&e.remote!==null,r=e.remote?.name===t;return(0,J.jsx)(st,{className:`w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)]`,value:t,children:(0,J.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden`,children:[(0,J.jsx)(`span`,{className:`block min-w-0 truncate pe-2`,children:e.label}),n?(0,J.jsx)(`div`,{className:`flex justify-end`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,J.jsx)(pt,{"aria-label":`Use remote version of ${e.label}`,checked:r,className:`[--thumb-size:--spacing(3)]`,onCheckedChange:t=>{let n=t?e.remote?.name:e.local?.name;n&&Gn(n)}})}):e.remote?(0,J.jsxs)($e,{children:[(0,J.jsx)(Ze,{render:(0,J.jsx)(`span`,{className:`flex justify-end text-muted-foreground`,children:(0,J.jsx)(te,{role:`img`,"aria-label":`Remote only`,className:`size-3`})})}),(0,J.jsx)(Qe,{side:`top`,children:`Remote only`})]}):null]})},e.id)})]})]})]})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[On.length>0||!Y&&Q?.files?.length?(0,J.jsx)(yt,{additions:jn.additions,deletions:jn.deletions,className:`mr-1 text-2xs`,layout:`inline`}):null,Lt&&(0,J.jsxs)($e,{children:[(0,J.jsx)(Ze,{render:(0,J.jsx)(T,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":Cn?`Refreshing diff`:`Refresh diff`,onClick:Vt}),children:(0,J.jsx)(ut,{size:`sm`,refreshing:Cn})}),(0,J.jsx)(Qe,{side:`top`,children:Cn?`Refreshing diff…`:`Refresh diff`})]}),kn.length>0&&(0,J.jsx)(T,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":An?`Expand all files`:`Collapse all files`,onClick:Hn,children:(0,J.jsx)(ve,{className:`size-3.5`,icon:An?ge:_e})}),(0,J.jsxs)(tt,{"aria-label":`Diff layout`,className:`shrink-0`,variant:`segmented`,value:[d],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&f({diffLayout:t})},children:[(0,J.jsx)(nt,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,J.jsx)(S,{className:`size-3.5`})}),(0,J.jsx)(nt,{"aria-label":`Split diff view`,value:`split`,children:(0,J.jsx)(v,{className:`size-3.5`})})]}),(0,J.jsxs)($e,{children:[(0,J.jsx)(Ze,{render:(0,J.jsx)(nt,{"aria-label":p?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`ghost`,size:`sm`,pressed:p,onPressedChange:e=>{g(!!e)}}),children:(0,J.jsx)(s,{className:`size-3.5`})}),(0,J.jsx)(Qe,{side:`top`,children:p?`Disable line wrapping`:`Enable line wrapping`})]}),(0,J.jsxs)($e,{children:[(0,J.jsx)(Ze,{render:(0,J.jsx)(nt,{"aria-label":_?`Show whitespace changes`:`Hide whitespace changes`,variant:`ghost`,size:`sm`,pressed:_,onPressedChange:e=>{y(!!e)}}),children:(0,J.jsx)(m,{className:`size-3.5`})}),(0,J.jsx)(Qe,{side:`top`,children:_?`Show whitespace changes`:`Hide whitespace changes`})]}),kn.length>0&&(0,J.jsxs)($e,{children:[(0,J.jsx)(Ze,{render:(0,J.jsx)(nt,{"aria-label":b?`Hide file tree`:`Show file tree`,variant:`ghost`,size:`sm`,pressed:b,onPressedChange:e=>x(!!e)}),children:(0,J.jsx)(ee,{className:`size-3.5`})}),(0,J.jsx)(Qe,{side:`top`,children:b?`Hide file tree`:`Show file tree`})]})]})]});return(0,J.jsx)(qe,{mode:e,header:Yn,children:L?Ye?G!==null&&W.length===0?(0,J.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):G===null&&!me?pe.isPending?(0,J.jsx)(Ke,{label:`Checking file access...`}):(0,J.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:pe.error??`This connection cannot read local diffs.`}):(0,J.jsx)(J.Fragment,{children:(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background`,children:[sn&&!$&&(0,J.jsxs)(`p`,{className:`shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-2xs text-muted-foreground`,children:[`This preview exceeds the size limit. Changes shown are incomplete.`,Q?.files?` Totals include all changes.`:``]}),ln&&!dn&&(0,J.jsx)(`div`,{className:`px-3`,children:(0,J.jsx)(`p`,{className:`mb-2 text-2xs text-error/80`,children:ln})}),!dn&&!$?cn?(0,J.jsx)(Ke,{label:Y?`Loading checkpoint diff...`:q===`unstaged`?`Loading uncommitted changes...`:`Loading changes...`}):(0,J.jsx)(`div`,{className:`flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,J.jsx)(`p`,{children:un?`No net changes in this selection.`:`No patch available for this selection.`})}):$||dn?.kind===`files`?(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,onClickCapture:e=>{let t=e.nativeEvent.composedPath?.()??[];for(let e of t)if(e instanceof HTMLElement&&(e instanceof HTMLButtonElement||e instanceof HTMLAnchorElement))return;let n=t.find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent;if(n){Rn(n);return}let r=t.find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-diffs-header`))?.querySelector(`[data-title]`)?.textContent;if(!r)return;let i=On.find(e=>e.filePath===r);i&&Bn(i.fileKey)},onContextMenuCapture:e=>{let t=(e.nativeEvent.composedPath?.()??[]).find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent?.trim();t&&(e.preventDefault(),Re({environmentId:L?.environmentId??null,filePath:t,workspaceRoot:V,repositoryRoot:Se},e))},children:(0,J.jsx)(wt,{viewerRef:N,codeViewKey:`${kt}:${$?pn:`preview`}`,className:`h-full min-h-0 overflow-auto`,files:On,renderCodeViewFooter:Dn,sectionId:Ot,sectionTitle:At,composerDraftTarget:t,renderHeaderFilenameSuffix:e=>{let t=H(e),n=hn.get(t);return(0,J.jsx)(Yt,{filePath:t,hasStat:fn.has(t),error:n?.error??!1,truncated:n?.truncated??!1,onRetry:gn})},...$?{unsafeCSSExtra:`[data-additions-count], [data-deletions-count] { display: none; }`,renderHeaderMetadata:e=>{let t=fn.get(H(e));return t?(0,J.jsx)(yt,{additions:t.additions,deletions:t.deletions}):null}}:{},onRevealSearchMatch:Vn,renderHeaderPrefix:(e,t)=>{let n=e.cacheKey?.endsWith(`:pending`)===!0;return(0,J.jsx)(Jt,{filePath:H(e),fileKey:t,collapsed:n||En.has(t),unavailable:n,iconClassName:He(e),onToggle:Bn})},options:{diffStyle:d===`split`?`split`:`unified`,lineDiffType:`none`,overflow:p?`wrap`:`scroll`,theme:Be(o),preferredHighlighter:ft,themeType:o,stickyHeaders:!0,...Ht?{loadDiffFiles:Xt}:{}}},X??Ot)}),b?(0,J.jsx)(`aside`,{className:`flex w-[min(16rem,40%)] min-w-40 shrink-0 border-l border-border/60`,children:(0,J.jsx)(De,{ariaLabel:`${At} files`,entries:Mn,selectedPath:St,revealRequestId:Ct,onSelectFile:In})}):null]}):(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(`p`,{className:`text-2xs text-muted-foreground/75`,children:dn?.kind===`raw`?dn.reason:null}),(0,J.jsx)(`pre`,{className:A(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-2xs leading-relaxed text-muted-foreground/90`,p?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:dn?.kind===`raw`?dn.text:null})]})})]})}):(0,J.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,J.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`})})}export{Xt as default};
2
- //# sourceMappingURL=DiffPanel-3G1enpU9.js.map
1
+ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$n as n,$o as r,A as i,As as a,D as o,Em as s,Ey as c,I as l,Jb as u,Lf as d,Nx as f,Ox as p,Pp as m,Qu as h,RE as g,Rv as _,Ud as v,Vc as y,WS as b,Yp as x,Zp as S,_f as ee,ar as C,as as w,bd as te,cr as ne,er as re,es as ie,lr as T,mE as E,ng as D,or as ae,qn as O,rs as oe,sr as k,t as A,tr as se,ts as ce,ws as j,xd as M}from"./utils-hgbJ2TVM.js";import{M as N,N as P,R as F,W as I,Z as le,_t as ue,j as L,k as R}from"./runtime-Cj24N7je.js";import{s as z}from"./vcsRefInvalidation-hPKz3TmL.js";import{C as B,D as de,k as fe}from"./entities-BJgMc8pv.js";import{t as pe}from"./runtime-CArTL2GH.js";import{d as me,f as he,g as ge,h as _e,l as ve,p as ye,x as V}from"./TooltipViewport-DJ2VRKCt.js";import{t as be}from"./useParams-Br7l7qPU.js";import{l as xe,p as Se}from"./toast-B3hjhWRf.js";import{a as Ce,i as we,n as Te,r as Ee,t as De}from"./DiffFileTree-BgjyfH71.js";import{K as Oe,s as ke,v as Ae}from"./useSettings-BcmuuiTp.js";import{f as je}from"./server-Vynm5NwP.js";import{n as Me}from"./query-BFP47tsD.js";import{t as Ne}from"./use-atom-command-D34CFqu3.js";import{d as Pe,f as Fe}from"./providerSkills-Ct4SZ-mY.js";import{t as Ie,u as Le}from"./queries-BWcz-n4a.js";import{a as Re,c as ze,l as Be,n as Ve,o as He,r as Ue,s as We,u as H}from"./diffRendering-BWY0g219.js";import{F as Ge,I as Ke,L as qe,M as Je,P as U}from"./PanelLayoutControls-C2deQDB2.js";import{t as Ye}from"./DiffCommentAnnotation-Dx-VhoLU.js";import{c as Xe}from"./timestampFormat-wac2e_Jz.js";import{a as Ze,n as Qe,t as $e}from"./tooltip-D-SzZpgJ.js";import{n as et}from"./fileCommentAnnotations-BgdL_7u9.js";import{n as tt,t as nt}from"./toggle-group-Clz6KDtW.js";import{i as rt,l as it,n as at,o as ot,r as st,s as ct,t as lt}from"./combobox-BdGKdc6i.js";import{Ca as ut,ba as dt,ma as ft,pa as pt}from"./main-4dRVuXx2.js";import{A as mt,D as ht,E as W,O as gt,T as G,j as _t,k as vt,w as yt}from"./_chat-C0vR23gu.js";var K=e(t(),1),q=g();function bt(e,t){let n=(0,q.c)(4),r=Ie(e,t),i;return n[0]!==r.data||n[1]!==r.error||n[2]!==r.isPending?(i={data:r.data,error:r.error,isPending:r.isPending},n[0]=r.data,n[1]=r.error,n[2]=r.isPending,n[3]=i):i=n[3],i}var J=e(E(),1);function xt(e){let t=(0,q.c)(17),{filePath:n}=e,r=(0,K.useRef)(null),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={onCopy:()=>ht(r),onError:e=>W(r,e),timeout:G},t[0]=i):i=t[0];let{copyToClipboard:a,isCopied:o}=Se(i),s;t[1]!==a||t[2]!==n?(s=(0,J.jsx)(T,{ref:r,size:`icon-micro`,variant:`ghost-muted`,"aria-label":`Copy file path`,onClick:()=>a(n,void 0)}),t[1]=a,t[2]=n,t[3]=s):s=t[3];let c=o&&`text-success`,l;t[4]===c?l=t[5]:(l=A(`size-3`,c),t[4]=c,t[5]=l);let u=o?me:V,d;t[6]!==l||t[7]!==u?(d=(0,J.jsx)(ve,{className:l,icon:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]!==s||t[10]!==d?(f=(0,J.jsx)(Ze,{render:s,children:d}),t[9]=s,t[10]=d,t[11]=f):f=t[11];let p=o?`Copied`:`Copy path`,m;t[12]===p?m=t[13]:(m=(0,J.jsx)(Qe,{children:(0,J.jsx)(`p`,{children:p})}),t[12]=p,t[13]=m);let h;return t[14]!==f||t[15]!==m?(h=(0,J.jsxs)($e,{children:[f,m]}),t[14]=f,t[15]=m,t[16]=h):h=t[16],h}var St=[];function Ct(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function Y(e,t,n){let r=Ct(t),i=e.findIndex(e=>e.side===r&&e.lineNumber===t.end);return i<0?[...e,{side:r,lineNumber:t.end,metadata:{entries:[n]}}]:e.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,n]}}:e)}function wt(e){let t=(0,q.c)(66),{codeViewKey:n,files:r,sectionId:a,sectionTitle:s,composerDraftTarget:c,options:u,viewerRef:d,className:f,renderCodeViewFooter:p,unsafeCSSExtra:m,renderHeaderMetadata:h,renderHeaderFilenameSuffix:g,renderHeaderPrefix:_,onRevealSearchMatch:v}=e,y=o(kt),b=o(X),x;t[0]===c?x=t[1]:(x=e=>e.getComposerDraft(c)?.reviewComments??St,t[0]=c,t[1]=x);let S=o(x),[ee,C]=(0,K.useState)(null),[w,te]=(0,K.useState)(null),[ne,re]=(0,K.useState)(``),ie;t[2]===r?ie=t[3]:(ie=new Map(r.map(Ot)),t[2]=r,t[3]=ie);let T=ie,E;if(t[4]!==w||t[5]!==r||t[6]!==S||t[7]!==a){let e;t[9]!==w||t[10]!==S||t[11]!==a?(e=e=>{let{fileDiff:t,filePath:n,fileKey:r,fileVersion:i,collapsed:o}=e,s=S.filter(e=>e.sectionId===a&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=l(t,n);return r?Y(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),c=w?.fileKey===r?[...s,w.annotation]:s;return{id:r,type:`diff`,fileDiff:t,annotations:c,collapsed:o,version:Re(`${i}:${o?`1`:`0`}:${c.flatMap(Et).join(`:`)}`)}},t[9]=w,t[10]=S,t[11]=a,t[12]=e):e=t[12],E=r.map(e),t[4]=w,t[5]=r,t[6]=S,t[7]=a,t[8]=E}else E=t[8];let D=E,ae;t[13]!==c||t[14]!==w?.annotation||t[15]!==b?(ae=e=>{C(null),w?.annotation.metadata.entries.some(t=>t.id===e)?(te(null),re(``)):b(c,e)},t[13]=c,t[14]=w?.annotation,t[15]=b,t[16]=ae):ae=t[16];let O=ae,oe;t[17]!==y||t[18]!==c||t[19]!==w||t[20]!==T||t[21]!==a||t[22]!==s?(oe=(e,t)=>{let n=w?.annotation.metadata.entries.find(t=>t.id===e),r=w?T.get(w.fileKey):void 0;if(!n||!r)return;let o=i({id:n.id,sectionId:a,sectionTitle:s,filePath:r.filePath,fileDiff:r.fileDiff,range:n.range,text:t});o&&y(c,o),C(null),te(null),re(``)},t[17]=y,t[18]=c,t[19]=w,t[20]=T,t[21]=a,t[22]=s,t[23]=oe):oe=t[23];let k=oe,A;t[24]!==a||t[25]!==s?(A=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let r=et(),o=i({id:r,sectionId:a,sectionTitle:s,filePath:H(n.fileDiff),fileDiff:n.fileDiff,range:e,text:``});o&&(re(``),te({fileKey:n.id,annotation:{side:Ct(e),lineNumber:e.end,metadata:{entries:[{id:r,kind:`draft`,range:e,rangeLabel:o.rangeLabel,text:``}]}}}))},t[24]=a,t[25]=s,t[26]=A):A=t[26];let se=A,ce=w!==null,j;t[27]===d?j=t[28]:(j=d?{viewerRef:d}:{},t[27]=d,t[28]=j);let M;t[29]===f?M=t[30]:(M=f?{className:f}:{},t[29]=f,t[30]=M);let N;t[31]===m?N=t[32]:(N=m?{unsafeCSSExtra:m}:{},t[31]=m,t[32]=N);let P;t[33]===h?P=t[34]:(P=h?{renderHeaderMetadata:e=>e.type===`diff`?h(e.fileDiff):null}:{},t[33]=h,t[34]=P);let F;t[35]===p?F=t[36]:(F=p?{renderCodeViewFooter:p}:{},t[35]=p,t[36]=F);let I;t[37]===v?I=t[38]:(I=e=>v(e.id),t[37]=v,t[38]=I);let le=!ce,ue=!ce,L;t[39]!==se||t[40]!==u||t[41]!==le||t[42]!==ue?(L={...u,enableGutterUtility:le,enableLineSelection:ue,onGutterUtilityClick:se},t[39]=se,t[40]=u,t[41]=le,t[42]=ue,t[43]=L):L=t[43];let R;t[44]===g?R=t[45]:(R=e=>e.type===`diff`?g(e.fileDiff):null,t[44]=g,t[45]=R);let z;t[46]===_?z=t[47]:(z=e=>e.type===`diff`?_(e.fileDiff,e.id,e.collapsed===!0):null,t[46]=_,t[47]=z);let B;t[48]!==ne||t[49]!==O||t[50]!==k?(B=e=>{let t=e.metadata.entries.some(Tt);return(0,J.jsx)(`div`,{className:t?`py-1`:`divide-y divide-border/30 border-y border-border/30`,children:e.metadata.entries.map(e=>(0,J.jsx)(Ye,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.kind===`draft`?ne:e.text,onTextChange:re,onCancel:()=>O(e.id),onComment:t=>k(e.id,t),onDelete:()=>O(e.id)},e.id))})},t[48]=ne,t[49]=O,t[50]=k,t[51]=B):B=t[51];let de;return t[52]!==n||t[53]!==D||t[54]!==ee||t[55]!==P||t[56]!==F||t[57]!==I||t[58]!==L||t[59]!==R||t[60]!==z||t[61]!==B||t[62]!==j||t[63]!==M||t[64]!==N?(de=(0,J.jsx)(U,{...j,...M,...N,...P,...F,items:D,selectedLines:ee,onSelectedLinesChange:C,onRevealSearchMatch:I,options:L,renderHeaderFilenameSuffix:R,renderHeaderPrefix:z,renderAnnotation:B},n),t[52]=n,t[53]=D,t[54]=ee,t[55]=P,t[56]=F,t[57]=I,t[58]=L,t[59]=R,t[60]=z,t[61]=B,t[62]=j,t[63]=M,t[64]=N,t[65]=de):de=t[65],de}function Tt(e){return e.kind===`draft`}function Et(e){return e.metadata.entries.map(Dt)}function Dt(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Ot(e){return[e.fileKey,e]}function X(e){return e.removeReviewComment}function kt(e){return e.addReviewComment}function At(e){let t=_(4),n=R();return{diffPreview:P(e,{label:`environment-data:review:diff-preview`,tag:y.reviewGetDiffPreview,staleTimeMs:5e3}),diffFilePatch:L(e,{label:`environment-data:review:diff-file-patch`,staleTimeMs:3e5,execute:e=>le(y.reviewGetDiffPreview,e.request).pipe(t.withPermit,f(t=>{let n=t.sources.find(t=>t.kind===e.request.file.sourceKind);return n?b(n):p(new D({operation:`review.diffFilePatch`,kind:`git`,detail:`Diff no longer available. Refresh the comparison.`}))}))}),diffFileContents:N(e,{label:`environment-data:review:diff-file-contents`,tag:y.reviewGetDiffFileContents,scheduler:n,concurrency:{mode:`singleFlight`,key:({environmentId:e,input:t})=>JSON.stringify([e,t.cwd,t.sourceKind,t.baseRef,t.headRef,t.oldPath,t.newPath,t.changeType])}})}}var jt=At(pe);function Mt(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function Nt(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&Mt(t)===e.name),i=r.find(e=>e.remoteName===`origin`)??r[0]??null;return i&&n.delete(i),{id:`local:${e.name}`,label:e.name,local:e,remote:i}}),i=t.filter(e=>n.has(e)).map(e=>({id:`remote:${e.name}`,label:e.name,local:null,remote:e}));return[...r,...i]}function Pt(e,t){let n=t.trim().toLocaleLowerCase();return n.length===0?e:e.filter(e=>e.label.toLocaleLowerCase().includes(n)||e.local?.name.toLocaleLowerCase().includes(n)===!0||e.remote?.name.toLocaleLowerCase().includes(n)===!0)}var Ft=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function It(e){let t=(0,q.c)(86),{environmentId:n,cwd:i,source:a,baseRef:o,ignoreWhitespace:s,theme:c,revision:l,preview:u}=e,d=(0,K.useContext)(ie),f;t[0]!==o||t[1]!==i||t[2]!==n||t[3]!==s||t[4]!==a?.diffHash||t[5]!==a?.kind?(f=JSON.stringify([n,i,a?.kind,a?.diffHash,o,s]),t[0]=o,t[1]=i,t[2]=n,t[3]=s,t[4]=a?.diffHash,t[5]=a?.kind,t[6]=f):f=t[6];let p=f,m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=[0,1,2,3],t[7]=m):m=t[7];let h;t[8]===p?h=t[9]:(h={scope:p,indices:m},t[8]=p,t[9]=h);let[g,_]=(0,K.useState)(h),v;t[10]!==g.indices||t[11]!==g.scope||t[12]!==p?(v=g.scope===p?g.indices:[0,1,2,3],t[10]=g.indices,t[11]=g.scope,t[12]=p,t[13]=v):v=t[13];let y=v,b;t[14]===a?.files?b=t[15]:(b=()=>a?.files?.toSorted(Q)??[],t[14]=a?.files,t[15]=b),a?.files;let x;t[16]===b?x=t[17]:(x=b(),t[16]=b,t[17]=x);let S=x,ee;t[18]!==o||t[19]!==i||t[20]!==n||t[21]!==S||t[22]!==s||t[23]!==y||t[24]!==p||t[25]!==a?(ee=!n||!i||!a?[]:y.filter(e=>e<S.length).map(e=>{let t=S[e];return{index:e,query:jt.diffFilePatch({environmentId:n,input:{cacheKey:p,request:{cwd:i,...o?{baseRef:o}:{},ignoreWhitespace:s,file:{path:t.path,previousPath:t.previousPath,sourceKind:a.kind}}}})}}),t[18]=o,t[19]=i,t[20]=n,t[21]=S,t[22]=s,t[23]=y,t[24]=p,t[25]=a,t[26]=ee):ee=t[26];let C=ee,te;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(te=[],t[27]=te):te=t[27];let ne;t[28]!==l||t[29]!==p?(ne={scope:p,revision:l,queries:te},t[28]=l,t[29]=p,t[30]=ne):ne=t[30];let re=(0,K.useRef)(ne),T,E;t[31]!==C||t[32]!==d||t[33]!==l||t[34]!==p?(T=()=>{let e=re.current;re.current={scope:p,revision:l,queries:C};for(let{query:t}of C){let n=e.scope===p&&e.revision!==l,r=!e.queries.some(e=>e.query===t)&&d.get(t)._tag!==`Initial`&&!d.get(t).waiting;(n||r)&&d.refresh(t)}},E=[p,l,C,d],t[31]=C,t[32]=d,t[33]=l,t[34]=p,t[35]=T,t[36]=E):(T=t[35],E=t[36]),(0,K.useEffect)(T,E);let D;t[37]===c?D=t[38]:(D=ce(e=>w(e,e=>j(e,e=>{let t=ze(e.diff,`diff-panel:${c}`,{compactPartialHunkOffsets:!0});if(t?.kind===`files`&&t.files.length===1&&e.files?.length===1){let n=e.files[0],r={...t.files[0],name:n.path};n.previousPath===null?delete r.prevName:r.prevName=n.previousPath,t={...t,files:[r]}}return{source:e,patch:t}}))),t[37]=c,t[38]=D);let ae=D,O;t[39]!==ae||t[40]!==C?(O=oe(e=>new Map(C.map(t=>{let{index:n,query:r}=t;return[n,e(ae(r))]}))),t[39]=ae,t[40]=C,t[41]=O):O=t[41];let k=r(O),A;t[42]===k?A=t[43]:(A=(e,t)=>{let n=k.get(t);return!n||n._tag===`Initial`},t[42]=k,t[43]=A);let se=S.findIndex(A),M=a?se<0?S.length:se:u?.kind===`files`?u.files.length:0,N;t[44]===p?N=t[45]:(N=e=>_(t=>{let n=t.scope===p?t.indices:[0,1,2,3],r=e.filter(e=>!n.includes(e));return r.length===0?t:{scope:p,indices:[...n,...r]}}),t[44]=p,t[45]=N);let P=N,F;t[46]!==P||t[47]!==M?(F=()=>P(Array.from({length:4},(e,t)=>M+t)),t[46]=P,t[47]=M,t[48]=F):F=t[48];let I=F,le;t[49]===P?le=t[50]:(le=e=>P([e]),t[49]=P,t[50]=le);let ue=le,L;t[51]!==S||t[52]!==C?(L={queries:C,files:S},t[51]=S,t[52]=C,t[53]=L):L=t[53];let R=(0,K.useRef)(L),z,B;t[54]!==S||t[55]!==C?(z=()=>{R.current={queries:C,files:S}},B=[C,S],t[54]=S,t[55]=C,t[56]=z,t[57]=B):(z=t[56],B=t[57]),(0,K.useLayoutEffect)(z,B);let de;t[58]===d?de=t[59]:(de=e=>{let{queries:t,files:n}=R.current,r=t.find(t=>{let{index:r}=t;return n[r]?.path===e})?.query;r&&d.refresh(r)},t[58]=d,t[59]=de);let fe=de,pe;t[60]!==S||t[61]!==k||t[62]!==u||t[63]!==p||t[64]!==a?(pe=a?S.map((e,t)=>{let n=k.get(t);if(n?._tag===`Success`&&n.value.patch?.kind===`files`){let t=n.value.patch.files.find(t=>H(t)===e.path);if(t)return t}return{name:e.path,...e.previousPath?{prevName:e.previousPath}:{},type:e.previousPath?`rename-changed`:`change`,hunks:[],additionLines:[],deletionLines:[],splitLineCount:0,unifiedLineCount:0,isPartial:!0,cacheKey:`${p}:${e.path}:pending`}}):(u?.kind===`files`?u.files:[]).toSorted(Rt),t[60]=S,t[61]=k,t[62]=u,t[63]=p,t[64]=a,t[65]=pe):pe=t[65];let me=pe,he;if(t[66]!==S||t[67]!==k){let e;t[69]===k?e=t[70]:(e=(e,t)=>{let n=k.get(t);return[e.path,{error:n?._tag===`Failure`||n?._tag===`Success`&&(n.value.patch?.kind!==`files`||!n.value.patch.files.some(t=>H(t)===e.path)),truncated:n?._tag===`Success`&&n.value.source.truncated}]},t[69]=k,t[70]=e),he=new Map(S.map(e)),t[66]=S,t[67]=k,t[68]=he}else he=t[68];let ge=he,_e;if(t[71]!==S||t[72]!==k){let e;t[74]===k?e=t[75]:(e=(e,t)=>{let n=k.get(t);return n&&n._tag!==`Initial`},t[74]=k,t[75]=e),_e=new Set(S.filter(e).map(Lt)),t[71]=S,t[72]=k,t[73]=_e}else _e=t[73];let ve=_e,ye=[...k.values()].some(Z),V;return t[76]!==ge||t[77]!==I||t[78]!==ve||t[79]!==me||t[80]!==ue||t[81]!==fe||t[82]!==p||t[83]!==M||t[84]!==ye?(V={scope:p,fileStates:ge,isPending:ye,retry:fe,requestFile:ue,readyFilePaths:ve,renderableFiles:me,settledFileCount:M,loadNextFiles:I},t[76]=ge,t[77]=I,t[78]=ve,t[79]=me,t[80]=ue,t[81]=fe,t[82]=p,t[83]=M,t[84]=ye,t[85]=V):V=t[85],V}function Z(e){return e._tag===`Initial`||e.waiting}function Lt(e){return e.path}function Rt(e,t){return Ft.compare(H(e),H(t))}function Q(e,t){return Ft.compare(e.path,t.path)}function zt(e){let t=(0,q.c)(5),{load:n,count:r}=e,i=(0,K.useRef)(null),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{if(!i.current)return;let e=new IntersectionObserver(e=>{e.some(Vt)&&n()},{rootMargin:`600px`});return e.observe(i.current),()=>e.disconnect()},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,K.useEffect)(a,o);let s;return t[3]===r?s=t[4]:(s=(0,J.jsx)(`div`,{ref:i,role:`status`,"aria-label":`Loading diff…`,children:Array.from({length:Math.min(r,4)},Bt)}),t[3]=r,t[4]=s),s}function Bt(e,t){return(0,J.jsx)(`div`,{"aria-hidden":!0,className:`border-b border-border/40`,children:(0,J.jsx)(Ge,{titleWidth:`medium`})},t)}function Vt(e){return e.isIntersecting}function Ht(e){let t=(0,q.c)(16),{error:n,truncated:r,retry:i}=e;if(!n&&!r)return null;let a=n?`Retry loading diff`:`Partial diff preview`,o;t[0]!==n||t[1]!==i?(o=e=>{e.stopPropagation(),n&&i()},t[0]=n,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==a||t[4]!==o?(s=(0,J.jsx)(T,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":a,onClick:o}),t[3]=a,t[4]=o,t[5]=s):s=t[5];let c;t[6]===n?c=t[7]:(c=n?(0,J.jsx)(x,{className:`size-3`}):(0,J.jsx)(d,{className:`size-3`}),t[6]=n,t[7]=c);let l;t[8]!==s||t[9]!==c?(l=(0,J.jsx)(Ze,{render:s,children:c}),t[8]=s,t[9]=c,t[10]=l):l=t[10];let u=n?`Retry loading diff`:`This file is too large to show in full. Counts include all changes.`,f;t[11]===u?f=t[12]:(f=(0,J.jsx)(Qe,{children:u}),t[11]=u,t[12]=f);let p;return t[13]!==l||t[14]!==f?(p=(0,J.jsxs)($e,{children:[l,f]}),t[13]=l,t[14]=f,t[15]=p):p=t[15],p}var Ut=`__automatic_base_ref__`,Wt=`p4code.diffFileTreeOpen`,Gt=new WeakMap;function Kt(e){let t=Gt.get(e);if(t)return t;let n={fileDiff:e,fileKey:Ue(e),fileVersion:Ve(e)};return Gt.set(e,n),n}var qt=new Set;function Jt(e){let t=(0,q.c)(21),{filePath:n,fileKey:r,collapsed:i,unavailable:a,iconClassName:o,onToggle:s}=e,c=i?`Expand ${n}`:`Collapse ${n}`,l=!i,u;t[0]!==r||t[1]!==s?(u=e=>{e.stopPropagation(),s(r)},t[0]=r,t[1]=s,t[2]=u):u=t[2];let d;t[3]!==c||t[4]!==l||t[5]!==u||t[6]!==a?(d=(0,J.jsx)(T,{size:`icon-micro`,variant:`ghost`,className:`-ms-0.5`,"aria-label":c,"aria-expanded":l,disabled:a,onClick:u}),t[3]=c,t[4]=l,t[5]=u,t[6]=a,t[7]=d):d=t[7];let f;t[8]===o?f=t[9]:(f=A(`size-4`,o),t[8]=o,t[9]=f);let p=i?ye:he,m;t[10]!==f||t[11]!==p?(m=(0,J.jsx)(ve,{className:f,icon:p}),t[10]=f,t[11]=p,t[12]=m):m=t[12];let h;t[13]!==d||t[14]!==m?(h=(0,J.jsx)(Ze,{render:d,children:m}),t[13]=d,t[14]=m,t[15]=h):h=t[15];let g=i?`Expand diff`:`Collapse diff`,_;t[16]===g?_=t[17]:(_=(0,J.jsx)(Qe,{side:`top`,children:g}),t[16]=g,t[17]=_);let v;return t[18]!==_||t[19]!==h?(v=(0,J.jsxs)($e,{children:[h,_]}),t[18]=_,t[19]=h,t[20]=v):v=t[20],v}function Yt(e){let t=(0,q.c)(11),{filePath:n,hasStat:r,error:i,truncated:a,onRetry:o}=e,s;t[0]===n?s=t[1]:(s=(0,J.jsx)(xt,{filePath:n}),t[0]=n,t[1]=s);let c;t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==o||t[6]!==a?(c=r?(0,J.jsx)(Ht,{error:i,truncated:a,retry:()=>o(n)}):null,t[2]=i,t[3]=n,t[4]=r,t[5]=o,t[6]=a,t[7]=c):c=t[7];let l;return t[8]!==s||t[9]!==c?(l=(0,J.jsxs)(J.Fragment,{children:[s,c]}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function Xt({mode:e=`inline`,composerDraftTarget:t,workspaceMutationId:i}){let{resolvedTheme:o}=Oe(),l=ke(),d=l.diffLayout,f=Ae(),[p,g]=(0,K.useState)(l.wordWrap),[_,y]=(0,K.useState)(l.diffIgnoreWhitespace),[b,x]=a(Wt,!1,c),[w,ie]=(0,K.useState)(``),[E,D]=(0,K.useState)(()=>({scopeKey:null,fileKeys:qt})),[oe,ce]=(0,K.useState)(0),[j,N]=(0,K.useState)(null),P=be({strict:!1,select:e=>xe(e)}),le=P?.threadId??null,L=fe(P),R=de(P)?.projection??null,pe=z(L?.environmentId??null),{canReadFiles:me}=pe,he=L?.projectId??null,ye=B(L&&he?{environmentId:L.environmentId,projectId:he}:null),V=L?.worktreePath??ye?.workspaceRoot,Se=L?.worktreePath?void 0:ye?.repositoryIdentity?.rootPath,Ie=r(je.configValueAtom(L?.environmentId??null)),Re=Pe(L?.environmentId??null),Ve=dt(L?.environmentId??null,Ie?.availableEditors??[]),Ue=Ne(jt.diffFileContents),Ge=Me(L!=null&&V!=null?Le.status({environmentId:L.environmentId,input:{cwd:V}}):null),U=_t(e=>mt(e.byThreadKey,P)),Ye=Ge.data?.isRepo??!0,{turnDiffSummaries:et,inferredCheckpointTurnCountByRunId:ht}=vt(R),W=(0,K.useMemo)(()=>[...et].toSorted((e,t)=>{let n=e.checkpointTurnCount??ht[e.runId]??0,r=t.checkpointTurnCount??ht[t.runId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n}),[ht,et]);(0,K.useEffect)(()=>{P&&U.kind===`turn`&&_t.getState().reconcileTurnSelection(P,W.map(e=>e.runId))},[U,W,P]);let G=U.kind===`turn`?U.turnId:null,q=U.kind===`unstaged`?`unstaged`:`branch`,xt=U.kind===`branch`?U.baseRef:null,St=U.kind===`turn`?U.filePath:null,Ct=U.kind===`turn`?U.revealRequestId:0,Y=G===null?void 0:W.find(e=>e.runId===G)??W[0],Tt=Y&&(Y.checkpointTurnCount??ht[Y.runId]),Et=W[0],Dt=G===null?q===`unstaged`?`Uncommitted`:`Changes`:Y?.runId===Et?.runId?`Latest turn`:`Turn ${Tt??`?`}`,Ot=Y?`turn:${Y.runId}`:q,X=P?`${P.environmentId}:${P.threadId}:${Ot}`:null,kt=`${X??Ot}:${oe}`,At=Y?`Turn ${Tt??`?`}`:q===`unstaged`?`Uncommitted`:`Changes`,Mt=(0,K.useMemo)(()=>typeof Tt==`number`?{fromTurnCount:Math.max(0,Tt-1),toTurnCount:Tt}:null,[Tt]),Ft=bt({environmentId:L?.environmentId??null,threadId:le,fromTurnCount:Mt?.fromTurnCount??null,toTurnCount:Mt?.toTurnCount??null,ignoreWhitespace:_,cacheScope:Y?`turn:${Y.runId}`:null},{enabled:Ye&&Y!==void 0}),Z=Me(me&&G===null&&L&&V?jt.diffPreview({environmentId:L.environmentId,input:{cwd:V,...xt?{baseRef:xt}:{},ignoreWhitespace:_}}):null),Lt=Ye&&G===null&&L!=null&&V!=null,Rt=P?`${P.environmentId}:${P.threadId}`:null,Q=Z.data?.sources.find(e=>e.kind===(q===`unstaged`?`working-tree`:`branch-range`)),Bt=Z.refresh,Vt=Bt,Ht=(0,K.useMemo)(()=>{let e=Z.data;if(G===null&&L&&e&&Q&&me)return Je(Ue,{environmentId:L.environmentId,cwd:e.cwd,sourceKind:Q.kind,baseRef:Q.baseRef,headRef:Q.headRef,cacheKey:Q.diffHash})},[L,Z.data,Ue,me,Q,G]),Gt=(0,K.useRef)(Ht);Gt.current=Ht;let Xt=(0,K.useCallback)(async e=>{let t=Gt.current;if(!t)throw Error(`Diff file contents are unavailable for this selection.`);return t(e)},[]),Zt=Me(G===null&&q===`branch`&&L&&Z.data?.cwd?Le.listRefs({environmentId:L.environmentId,input:{cwd:Z.data.cwd,includeMatchingRemoteRefs:!0,refKind:`local`,...w.trim().length>0?{query:w.trim()}:{},limit:100}}):null),Qt=Me(G===null&&q===`branch`&&L&&Z.data?.cwd?Le.listRefs({environmentId:L.environmentId,input:{cwd:Z.data.cwd,includeMatchingRemoteRefs:!0,refKind:`remote`,...w.trim().length>0?{query:w.trim()}:{},limit:100}}):null),$t=Nt(Zt.data?.refs.filter(e=>e.name!==Q?.headRef)??[],Qt.data?.refs??[]),en=Pt($t,w),tn=e=>xt&&xt===e.remote?.name?xt:e.local?.name??e.remote?.name??e.id,nn=[Ut,...$t.map(tn)],rn=[...w.trim().length===0?[Ut]:[],...en.map(tn)],an=Q?.diff,on=Y?Ft.data?.diff:an,sn=!Y&&Q?.truncated===!0,cn=Y?Ft.isPending:Z.isPending,ln=Y?Ft.error:Z.error,un=typeof on==`string`&&on.trim().length===0,$=!Y&&Q?.truncated&&Q.files?Q:null,dn=(0,K.useMemo)(()=>$?null:ze(on,`diff-panel:${o}`,{compactPartialHunkOffsets:G===null}),[$,o,on,G]),fn=(0,K.useMemo)(()=>new Map($?.files?.map(e=>[e.path,e])),[$?.files]),{scope:pn,isPending:mn,fileStates:hn,retry:gn,requestFile:_n,readyFilePaths:vn,renderableFiles:yn,settledFileCount:bn,loadNextFiles:xn}=It({environmentId:L?.environmentId,cwd:Z.data?.cwd,source:$,baseRef:$?.baseRef??xt,ignoreWhitespace:_,theme:o,revision:Z.data?u(Z.data.generatedAt):void 0,preview:dn}),Sn=Bt;(0,K.useEffect)(()=>{if(!Lt)return;let e=()=>Sn();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[Lt,Sn]),gt({enabled:Lt,mutationId:i,refresh:Sn,resourceKey:`diff:${Rt??``}`});let Cn=Z.isPending||mn,wn=(0,K.useMemo)(()=>yn.map(Kt),[yn]),Tn=(0,K.useMemo)(()=>l.diffFilesCollapsed?new Set(wn.map(e=>e.fileKey)):qt,[wn,l.diffFilesCollapsed]),En=E.scopeKey===X?E.fileKeys:Tn,Dn=(0,K.useCallback)(()=>bn<yn.length?(0,J.jsx)(zt,{load:xn,count:yn.length-bn}):null,[bn,yn.length,xn]),On=(0,K.useMemo)(()=>wn.filter(({fileDiff:e})=>!$||vn.has(H(e))).map(({fileDiff:e,fileKey:t,fileVersion:n})=>({fileDiff:e,filePath:H(e),fileKey:t,fileVersion:n,collapsed:En.has(t)||e.cacheKey?.endsWith(`:pending`)===!0})),[En,wn,$,vn]),kn=(0,K.useMemo)(()=>wn.map(e=>e.fileKey),[wn]),An=Ee(kn,En),jn=(0,K.useMemo)(()=>!Y&&Q?.files?Q.files.reduce((e,t)=>({additions:e.additions+t.additions,deletions:e.deletions+t.deletions}),{additions:0,deletions:0}):We(yn),[yn,Q,Y]),Mn=(0,K.useMemo)(()=>Te(yn),[yn]),Nn=St?On.find(e=>e.filePath===St)?.fileKey??null:null;(0,K.useEffect)(()=>{Nn&&j?.getInstance()&&j.scrollTo({type:`item`,id:Nn,align:`start`})},[j,kt,Nn,Ct]);let Pn=(0,K.useMemo)(()=>({collapseScopeKey:X,diffSelection:U}),[X,U]),Fn=Ce(j,Pn,On.map(e=>e.fileKey)),In=(0,K.useCallback)(e=>{let t=wn.findIndex(t=>H(t.fileDiff)===e),n=wn[t];n&&(D(e=>{let t=new Set(e.scopeKey===X?e.fileKeys:Tn);return t.delete(n.fileKey),{scopeKey:X,fileKeys:t}}),$&&t>=bn&&_n(t),Fn(n.fileKey))},[wn,X,Tn,Fn,$,bn,_n]),Ln=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!$||!St)return;let e=`${St}:${Ct}`;(Ln.current?.cache!==pn||Ln.current.key!==e)&&(Ln.current={cache:pn,key:e},In(St))},[$,St,Ct,pn,In]);let Rn=(0,K.useCallback)(e=>{Fe({threadRef:P,filePath:e,activeCwd:V,repositoryRoot:Se,openInEditor:e=>{(async()=>{let t=await Ve(e);t._tag===`Failure`&&!F(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,...P?{environmentId:P.environmentId,threadId:P.threadId}:{},...ue(I(t))})})()}})},[V,Se,Ve,P]),zn=(0,K.useRef)({collapseScopeKey:X,defaultCollapsedDiffFileKeys:Tn});(0,K.useLayoutEffect)(()=>{zn.current={collapseScopeKey:X,defaultCollapsedDiffFileKeys:Tn}},[X,Tn]);let Bn=(0,K.useCallback)(e=>{let{collapseScopeKey:t,defaultCollapsedDiffFileKeys:n}=zn.current;D(r=>{let i=new Set(r.scopeKey===t?r.fileKeys:n);return i.has(e)?i.delete(e):i.add(e),{scopeKey:t,fileKeys:i}})},[]),Vn=(0,K.useCallback)(e=>{let{collapseScopeKey:t,defaultCollapsedDiffFileKeys:n}=zn.current;D(r=>{let i=r.scopeKey===t?r.fileKeys:n;if(!i.has(e))return r;let a=new Set(i);return a.delete(e),{scopeKey:t,fileKeys:a}})},[]),Hn=(0,K.useCallback)(()=>{ce(e=>e+1),D(e=>{let t=e.scopeKey===X?e.fileKeys:Tn;return{scopeKey:X,fileKeys:we(kn,t)}})},[X,Tn,kn]),Un=e=>{P&&_t.getState().selectTurn(P,e)},Wn=e=>{P&&_t.getState().selectGitScope(P,e)},Gn=e=>{P&&_t.getState().selectBranchBaseRef(P,e)},Kn=Y?`turn:${Y.runId}`:``,qn=G===null?q:Y?.runId===Et?.runId?`latest`:Kn,Jn=e=>{if(e===`unstaged`||e===`branch`)Wn(e);else if(e===`latest`)Et&&Un(Et.runId);else{let t=W.find(t=>`turn:${t.runId}`===e);t&&Un(t.runId)}},Yn=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]`,children:[(0,J.jsxs)(O,{children:[(0,J.jsxs)(ne,{render:(0,J.jsx)(T,{size:`xs`,variant:`secondary`}),className:`max-w-full`,"aria-label":`Diff scope: ${Dt}`,children:[(0,J.jsx)(`span`,{className:`truncate`,children:Dt}),(0,J.jsx)(M,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,J.jsxs)(n,{align:`start`,children:[(0,J.jsxs)(re,{value:qn,onValueChange:Jn,children:[(0,J.jsx)(se,{value:`branch`,closeOnClick:!0,children:(0,J.jsx)(`span`,{children:`Changes`})}),(0,J.jsx)(se,{value:`unstaged`,closeOnClick:!0,children:(0,J.jsx)(`span`,{children:`Uncommitted`})}),(0,J.jsx)(se,{value:`latest`,closeOnClick:!0,children:(0,J.jsx)(`span`,{children:`Latest turn`})})]}),(0,J.jsxs)(C,{children:[(0,J.jsx)(k,{children:`Turn`}),(0,J.jsx)(ae,{children:(0,J.jsx)(re,{value:Kn,onValueChange:Jn,children:W.map(e=>{let t=e.checkpointTurnCount??ht[e.runId]??`?`;return(0,J.jsx)(se,{value:`turn:${e.runId}`,closeOnClick:!0,children:(0,J.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`span`,{children:[`Turn `,t]}),(0,J.jsx)(`span`,{className:`ml-auto text-xs tabular-nums text-muted-foreground`,children:Xe(e.completedAt,l.timestampFormat)})]})},e.runId)})})})]})]})]}),G===null&&q===`branch`&&Q?.baseRef&&(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-2 overflow-hidden text-xs text-muted-foreground`,"aria-label":`Comparing ${Q.headRef??`HEAD`} against ${Q.baseRef}`,children:[(0,J.jsxs)($e,{children:[(0,J.jsxs)(Ze,{render:(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`}),children:[(0,J.jsx)(`span`,{className:`min-w-0 max-w-48 truncate`,children:Q.headRef??`HEAD`}),(0,J.jsx)(h,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,J.jsx)(Qe,{side:`top`,children:`${Q.headRef??`HEAD`} → ${Q.baseRef}`})]}),(0,J.jsxs)(lt,{items:nn,filteredItems:rn,value:xt??Ut,onOpenChange:e=>{e||ie(``)},onValueChange:e=>{e&&Gn(e===Ut?null:e)},children:[(0,J.jsxs)(it,{render:(0,J.jsx)(T,{variant:`ghost-muted`,size:`xs`}),className:`min-w-0 max-w-48`,"aria-label":`Change comparison target. Currently ${Q.baseRef}`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:Q.baseRef}),(0,J.jsx)(M,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,J.jsxs)(ot,{align:`start`,className:`w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden`,children:[(0,J.jsx)(ct,{placeholder:`Search refs...`,value:w,onChange:e=>ie(e.target.value)}),(0,J.jsxs)(`div`,{className:`grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-3xs text-muted-foreground uppercase tracking-wide`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center`,children:[(0,J.jsx)(`span`,{children:`Branch`}),(0,J.jsx)(`span`,{className:`text-right`,children:`Remote`})]})]}),(0,J.jsx)(at,{children:`No matching refs.`}),(0,J.jsxs)(rt,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,J.jsx)(st,{className:`w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)]`,value:Ut,children:(0,J.jsx)(`span`,{className:`block min-w-0 truncate`,children:`Automatic`})}),$t.map(e=>{let t=tn(e),n=e.local!==null&&e.remote!==null,r=e.remote?.name===t;return(0,J.jsx)(st,{className:`w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)]`,value:t,children:(0,J.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden`,children:[(0,J.jsx)(`span`,{className:`block min-w-0 truncate pe-2`,children:e.label}),n?(0,J.jsx)(`div`,{className:`flex justify-end`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,J.jsx)(pt,{"aria-label":`Use remote version of ${e.label}`,checked:r,className:`[--thumb-size:--spacing(3)]`,onCheckedChange:t=>{let n=t?e.remote?.name:e.local?.name;n&&Gn(n)}})}):e.remote?(0,J.jsxs)($e,{children:[(0,J.jsx)(Ze,{render:(0,J.jsx)(`span`,{className:`flex justify-end text-muted-foreground`,children:(0,J.jsx)(te,{role:`img`,"aria-label":`Remote only`,className:`size-3`})})}),(0,J.jsx)(Qe,{side:`top`,children:`Remote only`})]}):null]})},e.id)})]})]})]})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[On.length>0||!Y&&Q?.files?.length?(0,J.jsx)(yt,{additions:jn.additions,deletions:jn.deletions,className:`mr-1 text-2xs`,layout:`inline`}):null,Lt&&(0,J.jsxs)($e,{children:[(0,J.jsx)(Ze,{render:(0,J.jsx)(T,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":Cn?`Refreshing diff`:`Refresh diff`,onClick:Vt}),children:(0,J.jsx)(ut,{size:`sm`,refreshing:Cn})}),(0,J.jsx)(Qe,{side:`top`,children:Cn?`Refreshing diff…`:`Refresh diff`})]}),kn.length>0&&(0,J.jsx)(T,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":An?`Expand all files`:`Collapse all files`,onClick:Hn,children:(0,J.jsx)(ve,{className:`size-3.5`,icon:An?ge:_e})}),(0,J.jsxs)(tt,{"aria-label":`Diff layout`,className:`shrink-0`,variant:`segmented`,value:[d],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&f({diffLayout:t})},children:[(0,J.jsx)(nt,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,J.jsx)(S,{className:`size-3.5`})}),(0,J.jsx)(nt,{"aria-label":`Split diff view`,value:`split`,children:(0,J.jsx)(v,{className:`size-3.5`})})]}),(0,J.jsxs)($e,{children:[(0,J.jsx)(Ze,{render:(0,J.jsx)(nt,{"aria-label":p?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`ghost`,size:`sm`,pressed:p,onPressedChange:e=>{g(!!e)}}),children:(0,J.jsx)(s,{className:`size-3.5`})}),(0,J.jsx)(Qe,{side:`top`,children:p?`Disable line wrapping`:`Enable line wrapping`})]}),(0,J.jsxs)($e,{children:[(0,J.jsx)(Ze,{render:(0,J.jsx)(nt,{"aria-label":_?`Show whitespace changes`:`Hide whitespace changes`,variant:`ghost`,size:`sm`,pressed:_,onPressedChange:e=>{y(!!e)}}),children:(0,J.jsx)(m,{className:`size-3.5`})}),(0,J.jsx)(Qe,{side:`top`,children:_?`Show whitespace changes`:`Hide whitespace changes`})]}),kn.length>0&&(0,J.jsxs)($e,{children:[(0,J.jsx)(Ze,{render:(0,J.jsx)(nt,{"aria-label":b?`Hide file tree`:`Show file tree`,variant:`ghost`,size:`sm`,pressed:b,onPressedChange:e=>x(!!e)}),children:(0,J.jsx)(ee,{className:`size-3.5`})}),(0,J.jsx)(Qe,{side:`top`,children:b?`Hide file tree`:`Show file tree`})]})]})]});return(0,J.jsx)(qe,{mode:e,header:Yn,children:L?Ye?G!==null&&W.length===0?(0,J.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):G===null&&!me?pe.isPending?(0,J.jsx)(Ke,{label:`Checking file access...`}):(0,J.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:pe.error??`This connection cannot read local diffs.`}):(0,J.jsx)(J.Fragment,{children:(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background`,children:[sn&&!$&&(0,J.jsxs)(`p`,{className:`shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-2xs text-muted-foreground`,children:[`This preview exceeds the size limit. Changes shown are incomplete.`,Q?.files?` Totals include all changes.`:``]}),ln&&!dn&&(0,J.jsx)(`div`,{className:`px-3`,children:(0,J.jsx)(`p`,{className:`mb-2 text-2xs text-error/80`,children:ln})}),!dn&&!$?cn?(0,J.jsx)(Ke,{label:Y?`Loading checkpoint diff...`:q===`unstaged`?`Loading uncommitted changes...`:`Loading changes...`}):(0,J.jsx)(`div`,{className:`flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,J.jsx)(`p`,{children:un?`No net changes in this selection.`:`No patch available for this selection.`})}):$||dn?.kind===`files`?(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,onClickCapture:e=>{let t=e.nativeEvent.composedPath?.()??[];for(let e of t)if(e instanceof HTMLElement&&(e instanceof HTMLButtonElement||e instanceof HTMLAnchorElement))return;let n=t.find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent;if(n){Rn(n);return}let r=t.find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-diffs-header`))?.querySelector(`[data-title]`)?.textContent;if(!r)return;let i=On.find(e=>e.filePath===r);i&&Bn(i.fileKey)},onContextMenuCapture:e=>{let t=(e.nativeEvent.composedPath?.()??[]).find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent?.trim();t&&(e.preventDefault(),Re({environmentId:L?.environmentId??null,filePath:t,workspaceRoot:V,repositoryRoot:Se},e))},children:(0,J.jsx)(wt,{viewerRef:N,codeViewKey:`${kt}:${$?pn:`preview`}`,className:`h-full min-h-0 overflow-auto`,files:On,renderCodeViewFooter:Dn,sectionId:Ot,sectionTitle:At,composerDraftTarget:t,renderHeaderFilenameSuffix:e=>{let t=H(e),n=hn.get(t);return(0,J.jsx)(Yt,{filePath:t,hasStat:fn.has(t),error:n?.error??!1,truncated:n?.truncated??!1,onRetry:gn})},...$?{unsafeCSSExtra:`[data-additions-count], [data-deletions-count] { display: none; }`,renderHeaderMetadata:e=>{let t=fn.get(H(e));return t?(0,J.jsx)(yt,{additions:t.additions,deletions:t.deletions}):null}}:{},onRevealSearchMatch:Vn,renderHeaderPrefix:(e,t)=>{let n=e.cacheKey?.endsWith(`:pending`)===!0;return(0,J.jsx)(Jt,{filePath:H(e),fileKey:t,collapsed:n||En.has(t),unavailable:n,iconClassName:He(e),onToggle:Bn})},options:{diffStyle:d===`split`?`split`:`unified`,lineDiffType:`none`,overflow:p?`wrap`:`scroll`,theme:Be(o),preferredHighlighter:ft,themeType:o,stickyHeaders:!0,...Ht?{loadDiffFiles:Xt}:{}}},X??Ot)}),b?(0,J.jsx)(`aside`,{className:`flex w-[min(16rem,40%)] min-w-40 shrink-0 border-l border-border/60`,children:(0,J.jsx)(De,{ariaLabel:`${At} files`,entries:Mn,selectedPath:St,revealRequestId:Ct,onSelectFile:In})}):null]}):(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(`p`,{className:`text-2xs text-muted-foreground/75`,children:dn?.kind===`raw`?dn.reason:null}),(0,J.jsx)(`pre`,{className:A(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-2xs leading-relaxed text-muted-foreground/90`,p?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:dn?.kind===`raw`?dn.text:null})]})})]})}):(0,J.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,J.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`})})}export{Xt as default};
2
+ //# sourceMappingURL=DiffPanel-tZN29mdM.js.map