@p4code/cli 0.9.24 → 0.9.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/dist/{AcpMcpStdioBridge-BNuxv1nx.mjs → AcpMcpStdioBridge-DLEEBpNR.mjs} +4 -4
  2. package/dist/AcpMcpStdioBridge-Dozbm_3J.mjs +3 -0
  3. package/dist/{Effect-BrI3bavz.mjs → Effect-DwQPN8rO.mjs} +35 -2
  4. package/dist/{Schema-06GeVid5.mjs → Schema-CdYZrGX6.mjs} +24 -3
  5. package/dist/{Stream-DKSvHopl.mjs → Stream-F-Z4HJeD.mjs} +2 -2
  6. package/dist/{TraceDiagnostics-Dk5M3WAT.mjs → TraceDiagnostics-D1Qz3qce.mjs} +18 -7
  7. package/dist/bin.mjs +2 -2
  8. package/dist/{binCli-CBzw8eZx.mjs → binCli-CcEaWLAR.mjs} +11 -11
  9. package/dist/claude-history-worker.mjs +1 -1
  10. package/dist/{claudeHistoryWorker-BZBBGtSw.mjs → claudeHistoryWorker-Bf24F_k8.mjs} +1 -1
  11. package/dist/{claudeHistoryWorker-DlhW7K2f.mjs → claudeHistoryWorker-DOjYf4xB.mjs} +4 -4
  12. package/dist/client/.vite/manifest.json +2259 -2257
  13. package/dist/client/assets/{2NI2N5EU-Dz1H18lO.js → 2NI2N5EU--LXjbTE-.js} +2 -2
  14. package/dist/client/assets/{4UO7MD6I-DxZW-JIQ.js → 4UO7MD6I-D_jr6_IV.js} +2 -2
  15. package/dist/client/assets/{5B3SVYGG-Cl2owg_V.js → 5B3SVYGG-tThUTA_S.js} +2 -2
  16. package/dist/client/assets/{5GK6JWQ2-A0G_mE3E.js → 5GK6JWQ2-BCuuAhKJ.js} +2 -2
  17. package/dist/client/assets/{5N7A7DKN-Bd00cghV.js → 5N7A7DKN-rdPMRoZL.js} +2 -2
  18. package/dist/client/assets/{5OC2THR4-ytZLjDMp.js → 5OC2THR4-gvpm3IL0.js} +2 -2
  19. package/dist/client/assets/{5S6HY5KT-XbqbgHxv.js → 5S6HY5KT-CWanNmdR.js} +2 -2
  20. package/dist/client/assets/{6IMQ5BUJ-BtndAY2_.js → 6IMQ5BUJ-1sguTKZ9.js} +2 -2
  21. package/dist/client/assets/{6OLKWJ4F-DNXmh00R.js → 6OLKWJ4F-9loy41nw.js} +2 -2
  22. package/dist/client/assets/{74OO7NKP-DbprmlDc.js → 74OO7NKP-ukQR6jKi.js} +2 -2
  23. package/dist/client/assets/{75O6YZUN-DZ_5zRwt.js → 75O6YZUN-BjBd5LQ0.js} +2 -2
  24. package/dist/client/assets/{77XECAW3-CgSkQSMJ.js → 77XECAW3-Ccw2Y7VD.js} +2 -2
  25. package/dist/client/assets/{ABYRPUBD-ucE-F8EO.js → ABYRPUBD-CvqVJLPf.js} +2 -2
  26. package/dist/client/assets/AlertDialogRoot-CimqRgXh.js +2 -0
  27. package/dist/client/assets/{AnimatedHeight-B2j_NXft.js → AnimatedHeight-Dwarin_V.js} +2 -2
  28. package/dist/client/assets/{AuthSurfaceShell-DqI-KrrY.js → AuthSurfaceShell-BvGaTutU.js} +2 -2
  29. package/dist/client/assets/{BB2UYUI2-CXw0vAgW.js → BB2UYUI2-Drnmium_.js} +2 -2
  30. package/dist/client/assets/{BUM34MOA-DBHGisGU.js → BUM34MOA-AkPmeijf.js} +2 -2
  31. package/dist/client/assets/{CEQABKGZ-MGn88wbo.js → CEQABKGZ-BNUlDSIK.js} +2 -2
  32. package/dist/client/assets/{CXAC5362-C1Fk1A6g.js → CXAC5362-Bmar3Iii.js} +2 -2
  33. package/dist/client/assets/{ChatGptUsageButton-_JZfpkEi.js → ChatGptUsageButton-D6Iy8SVv.js} +2 -2
  34. package/dist/client/assets/ChatMarkdown-DHhJpg3q.js +49 -0
  35. package/dist/client/assets/{CheckboxIndicator-DFCs5GRD.js → CheckboxIndicator-DbA95VlZ.js} +2 -2
  36. package/dist/client/assets/{ClippedText-BIwvWMlV.js → ClippedText-UM8CaEu4.js} +2 -2
  37. package/dist/client/assets/{CodexSetupSection.logic-B8uhmM78.js → CodexSetupSection.logic-kKJPABQZ.js} +2 -2
  38. package/dist/client/assets/{CollapsiblePanel-CsWNZ7jo.js → CollapsiblePanel-C1iRr4kZ.js} +2 -2
  39. package/dist/client/assets/{ComboboxClear-Cv9NZFNr.js → ComboboxClear-DaifQLU5.js} +2 -2
  40. package/dist/client/assets/{ComboboxGroupLabel-BPe0M6wJ.js → ComboboxGroupLabel-C03JGZRD.js} +2 -2
  41. package/dist/client/assets/{CommandBlock-BJ2nHWe_.js → CommandBlock-DH_L_Tgo.js} +2 -2
  42. package/dist/client/assets/{CompositeRoot-RcqGhRAf.js → CompositeRoot-B1DTZCNU.js} +2 -2
  43. package/dist/client/assets/{ConnectAgentSurface-kcWh3f_f.js → ConnectAgentSurface-C5bZc2ZR.js} +2 -2
  44. package/dist/client/assets/{ConnectionStatusDot-DIUevPBM.js → ConnectionStatusDot-CCTiSlHA.js} +2 -2
  45. package/dist/client/assets/{DRLTVNUE-CmpBRyx_.js → DRLTVNUE-BqWUfmRf.js} +2 -2
  46. package/dist/client/assets/{DYY6UVD2-rvY-xhxe.js → DYY6UVD2-CyRsghfa.js} +2 -2
  47. package/dist/client/assets/{DevicePanel-Bkrn90hU.js → DevicePanel-DocID7hH.js} +2 -2
  48. package/dist/client/assets/{DeviceSetup-BQvNWMm0.js → DeviceSetup-CX2OWVB9.js} +2 -2
  49. package/dist/client/assets/{DialogRoot-Dg58-QOq.js → DialogRoot-D64NsaiW.js} +2 -2
  50. package/dist/client/assets/{DialogTitle-CSaaIBpP.js → DialogTitle-CYefNdHm.js} +2 -2
  51. package/dist/client/assets/{DiffCommentAnnotation-eHSeIufV.js → DiffCommentAnnotation-ChKqFxt5.js} +2 -2
  52. package/dist/client/assets/{DiffFileTree-opfyNeFz.js → DiffFileTree-B6AgzOXX.js} +2 -2
  53. package/dist/client/assets/{DiffPanel-C4ySgbUg.js → DiffPanel-DKAHtq5x.js} +2 -2
  54. package/dist/client/assets/{DiffWorkerPoolProvider-BwOTmWKP.js → DiffWorkerPoolProvider-CK3y5UA1.js} +3 -3
  55. package/dist/client/assets/{EmbeddedDesign-BW5Rcxmc.js → EmbeddedDesign-Bj-kkArq.js} +5 -5
  56. package/dist/client/assets/{EnvironmentMachineIcon-DM48TG2x.js → EnvironmentMachineIcon-CJ30kzSK.js} +2 -2
  57. package/dist/client/assets/{ExpandableText-CYFNBBpY.js → ExpandableText-CBPvhWvZ.js} +2 -2
  58. package/dist/client/assets/{FNOVOB4O-B8vuCGFt.js → FNOVOB4O-DYXYw-b1.js} +2 -2
  59. package/dist/client/assets/{FieldControl-DHSVFpKc.js → FieldControl-CkgERQaU.js} +2 -2
  60. package/dist/client/assets/{FileDiff-CZk9prBc.js → FileDiff-BLuBewdN.js} +2 -2
  61. package/dist/client/assets/{FilePreviewPanel-BcCGkQ__.js → FilePreviewPanel-DWNimHTU.js} +4 -4
  62. package/dist/client/assets/{FoldedSettingsSection-COBhgfnb.js → FoldedSettingsSection-C3cuD_W9.js} +2 -2
  63. package/dist/client/assets/{HDGCDEEZ-DRcTM9ws.js → HDGCDEEZ-7WPyPcLr.js} +2 -2
  64. package/dist/client/assets/{HSJLKHB7-Dh4X6CJ4.js → HSJLKHB7-t8_OkffK.js} +2 -2
  65. package/dist/client/assets/{Icons-DpgbzNj8.js → Icons-BUrn1Fzo.js} +2 -2
  66. package/dist/client/assets/Input-Gb8KV9DV.js +2 -0
  67. package/dist/client/assets/{IntervalSecondsField-D0j2uU5s.js → IntervalSecondsField-D9JXVV-s.js} +2 -2
  68. package/dist/client/assets/JZOYTAAL-BzA5Kg5m.js +1 -0
  69. package/dist/client/assets/{K3MD6TGW-uz2CK9vb.js → K3MD6TGW-DoqPvoaq.js} +2 -2
  70. package/dist/client/assets/{K7RP3OMA-uWbuKqQP.js → K7RP3OMA--ZFOkyEG.js} +2 -2
  71. package/dist/client/assets/KeybindingsSettings.logic-CMs7OPcH.js +2 -0
  72. package/dist/client/assets/{LHDIQX7Q-BaUgpa7I.js → LHDIQX7Q-hUqw2I9B.js} +2 -2
  73. package/dist/client/assets/{LUXOKEGN-C-Usmwyz.js → LUXOKEGN-Dvu_mp-q.js} +2 -2
  74. package/dist/client/assets/{LinkMachineSelect-CB99X8v3.js → LinkMachineSelect-SHXPDP_g.js} +2 -2
  75. package/dist/client/assets/MathTypeset-C02HYdjx.css +1 -0
  76. package/dist/client/assets/{MathTypeset-Dv2b-uiV.js → MathTypeset-TM-3r0WA.js} +2 -2
  77. package/dist/client/assets/{ModelLiveLayer-DIrV--mW.js → ModelLiveLayer-Bb-7OhJ9.js} +3 -3
  78. package/dist/client/assets/{N3JZAHOW-CLD7n6Za.js → N3JZAHOW-LjhhJ-00.js} +2 -2
  79. package/dist/client/assets/{NUIALGQ3-CVI_F8c-.js → NUIALGQ3-Dg1KXz02.js} +2 -2
  80. package/dist/client/assets/{NoProjectsHero-CAoW0Xej.js → NoProjectsHero-D0OPZtzO.js} +2 -2
  81. package/dist/client/assets/{O65XPQGZ-g6xpsO0r.js → O65XPQGZ-BxaJR80d.js} +2 -2
  82. package/dist/client/assets/{O7XIQ6OM-CBkPdCIB.js → O7XIQ6OM-CCXPxMuU.js} +2 -2
  83. package/dist/client/assets/{OFQON5FD-DpM-bsDn.js → OFQON5FD-WUMBXQkX.js} +2 -2
  84. package/dist/client/assets/{P4ConnectAccountPages-CCjWOetO.js → P4ConnectAccountPages-BNK6s-RS.js} +2 -2
  85. package/dist/client/assets/{P4ConnectSidebarSignIn-CfEPRRB6.js → P4ConnectSidebarSignIn-CWW40SMl.js} +2 -2
  86. package/dist/client/assets/{PJQHF43J-Sp1j42CR.js → PJQHF43J-BrNjCaLl.js} +2 -2
  87. package/dist/client/assets/{PanelLayoutControls-CcdUv-ij.js → PanelLayoutControls-DiXjRWIw.js} +7 -7
  88. package/dist/client/assets/{PierreEntryIcon-vf9Z0_eJ.js → PierreEntryIcon-D29_Ylm_.js} +2 -2
  89. package/dist/client/assets/{PopoverHandle-s36xVlsK.js → PopoverHandle-BgggGdpn.js} +2 -2
  90. package/dist/client/assets/PreviewPanel-DutKwWE7.js +2 -0
  91. package/dist/client/assets/{ProjectDefaultsSettings-TlEARfjk.js → ProjectDefaultsSettings-DMfJN66D.js} +2 -2
  92. package/dist/client/assets/{ProjectFavicon-Dd4p_a9n.js → ProjectFavicon-DFI1NI3D.js} +3 -3
  93. package/dist/client/assets/{ProjectIconPickerDialog-D5UkwTkD.js → ProjectIconPickerDialog-BqGWzrTc.js} +2 -2
  94. package/dist/client/assets/{ProjectMonogram-Aw_ZBtDB.js → ProjectMonogram-D4xxVtw8.js} +2 -2
  95. package/dist/client/assets/{ProviderAuthTerminal-Cw2WcQr1.js → ProviderAuthTerminal-CRSvI-Og.js} +2 -2
  96. package/dist/client/assets/ProviderModelPicker-D73G0AKf.js +2 -0
  97. package/dist/client/assets/{ProviderSettingsForm-DaeugImp.js → ProviderSettingsForm-DchD8HSN.js} +2 -2
  98. package/dist/client/assets/{PullRequestCodeTab-DdfQeIIl.js → PullRequestCodeTab-BdXdTg-d.js} +3 -3
  99. package/dist/client/assets/{RHNBAITX-DQfv99hf.js → RHNBAITX-PsYrngSs.js} +2 -2
  100. package/dist/client/assets/{ReadOnlySourcePreview-Vvv9UVOM.js → ReadOnlySourcePreview-8jLKmc3M.js} +2 -2
  101. package/dist/client/assets/{RedactedSensitiveText-bQSbv34p.js → RedactedSensitiveText-DhV2Jdu8.js} +2 -2
  102. package/dist/client/assets/{RenderErrorBoundary-4-dgp9K8.js → RenderErrorBoundary-56lc2IQ3.js} +3 -3
  103. package/dist/client/assets/{RightPanelResizeHandle-B6vIzqA0.js → RightPanelResizeHandle-ClzdYxWw.js} +2 -2
  104. package/dist/client/assets/{SLD4V6NK-BKBt5rH4.js → SLD4V6NK-CxidvPXU.js} +2 -2
  105. package/dist/client/assets/{ScheduledTasksSettings-Dbz9TZ6o.js → ScheduledTasksSettings-BdMCgBm5.js} +5 -5
  106. package/dist/client/assets/{ScopedSwitch-D1e9m-dH.js → ScopedSwitch-CwnjCta_.js} +2 -2
  107. package/dist/client/assets/{ScrollAreaCorner-Cn2VDisz.js → ScrollAreaCorner-CfTQYjCW.js} +2 -2
  108. package/dist/client/assets/{SecretInput-C6zW-8wI.js → SecretInput-BYfVbTLh.js} +2 -2
  109. package/dist/client/assets/{SelectScrollUpArrow-C40FP3vq.js → SelectScrollUpArrow-BE0-tVtP.js} +2 -2
  110. package/dist/client/assets/{SelfImproveSettingsSection-WXBG9l_4.js → SelfImproveSettingsSection-DsqFeICK.js} +2 -2
  111. package/dist/client/assets/{SettingsPanels-BEtJwC6n.js → SettingsPanels-D_rJsyjt.js} +14 -14
  112. package/dist/client/assets/{SettingsPanels.logic-y95n8OOO.js → SettingsPanels.logic-BTJUBh-T.js} +2 -2
  113. package/dist/client/assets/{SettingsScopeNotice-DE1t1kw-.js → SettingsScopeNotice-CAVvn3pQ.js} +2 -2
  114. package/dist/client/assets/{SidebarStageBackdrop-CYLpofvt.js → SidebarStageBackdrop-DdxWuxIk.js} +2 -2
  115. package/dist/client/assets/{T3PCR2KE-BryFgp5Q.js → T3PCR2KE-BtQsKjM5.js} +2 -2
  116. package/dist/client/assets/{TKWO2OVW-DcRjYaVG.js → TKWO2OVW-CeYF-suq.js} +2 -2
  117. package/dist/client/assets/{TSHNXIZL-hAylFob1.js → TSHNXIZL-FQ7ZWHEn.js} +2 -2
  118. package/dist/client/assets/{ThemeEditorPanel-DeGNehj1.js → ThemeEditorPanel-BJucNhy-.js} +2 -2
  119. package/dist/client/assets/{ThreadDetailsItemsMenu-D0mfEKtW.js → ThreadDetailsItemsMenu-CRBBIuc7.js} +10 -10
  120. package/dist/client/assets/ThreadTerminalDrawer-Ci0mbLzJ.js +5 -0
  121. package/dist/client/assets/{TooltipProvider-DQ0TF9NB.js → TooltipProvider-BH5ni_Lo.js} +2 -2
  122. package/dist/client/assets/{UQJE5E4I-BfaZIz58.js → UQJE5E4I-CeqBk-r6.js} +2 -2
  123. package/dist/client/assets/{USNYFO5S-jOq8Kcgw.js → USNYFO5S-_1m41tJt.js} +2 -2
  124. package/dist/client/assets/{Virtualizer-B3FSTwJv.js → Virtualizer-DLB0FYm-.js} +2 -2
  125. package/dist/client/assets/{WEVWDWVA-1T3GTRY3.js → WEVWDWVA-DmSV8HLL.js} +2 -2
  126. package/dist/client/assets/{WorkspaceBreadcrumb-Dno2N8Xd.js → WorkspaceBreadcrumb-DQkeBQUl.js} +2 -2
  127. package/dist/client/assets/{WorkspacePageContainer-OLpcgD_f.js → WorkspacePageContainer-D2rx9iDg.js} +2 -2
  128. package/dist/client/assets/{WorkspacePageHeader-Bn0m4gpR.js → WorkspacePageHeader-D8-RIRjQ.js} +2 -2
  129. package/dist/client/assets/{X5RFHQXM-CaiE8-NB.js → X5RFHQXM-BUdDYXox.js} +2 -2
  130. package/dist/client/assets/{X62E3GBT-CKnjYZvp.js → X62E3GBT-BbQ7FmNB.js} +2 -2
  131. package/dist/client/assets/{XBNEOJTC-DF-d22o-.js → XBNEOJTC-BLEZA-vx.js} +2 -2
  132. package/dist/client/assets/{YHV2MVVZ-VSj4WI2u.js → YHV2MVVZ-DM2RTtkR.js} +2 -2
  133. package/dist/client/assets/{YURCZMG2-C9wxlavt.js → YURCZMG2-D5w6cPMY.js} +2 -2
  134. package/dist/client/assets/{YVG2LODB-JRtigNQC.js → YVG2LODB-BkLbsaCo.js} +2 -2
  135. package/dist/client/assets/_chat-CKMs-ajx.js +47 -0
  136. package/dist/client/assets/{_chat.design-DxTdYmIe.js → _chat.design-CpqXODBn.js} +2 -2
  137. package/dist/client/assets/{_chat.index-CNIRuBqG.js → _chat.index-B0eOfZAf.js} +2 -2
  138. package/dist/client/assets/_chat.new-CqLuDynd.js +4 -0
  139. package/dist/client/assets/{_chat.pull-requests-C6rdgLS9.js → _chat.pull-requests-C4Eo8GDQ.js} +2 -2
  140. package/dist/client/assets/{alert-CfhQnxcL.js → alert-D1O9oex3.js} +2 -2
  141. package/dist/client/assets/{alert-dialog-Dn_PRSFU.js → alert-dialog-3XDceRWv.js} +2 -2
  142. package/dist/client/assets/{assetUrls-BMizLezw.js → assetUrls-Dq0gsqWs.js} +2 -2
  143. package/dist/client/assets/{assets-DT0KoRIr.js → assets-C3_UZib9.js} +2 -2
  144. package/dist/client/assets/{browserHistoryStore-xnY5QhfE.js → browserHistoryStore-CVCo7qfb.js} +2 -2
  145. package/dist/client/assets/{browserLinkTarget-CH-4nkAf.js → browserLinkTarget-CopcRHna.js} +2 -2
  146. package/dist/client/assets/{checkbox-iFzfBLKr.js → checkbox-CxRqp4sO.js} +2 -2
  147. package/dist/client/assets/{color-picker-W1NtR7ha.js → color-picker-CvbP7BS3.js} +2 -2
  148. package/dist/client/assets/{combobox-B0IMIA-1.js → combobox-CuyUAuiC.js} +2 -2
  149. package/dist/client/assets/command-4bqVdX0m.js +2 -0
  150. package/dist/client/assets/{connect-BflmwHyv.js → connect-DFGquf-O.js} +2 -2
  151. package/dist/client/assets/connect-agent-Db5rxxY1.js +2 -0
  152. package/dist/client/assets/{design-B_bv-H7n.js → design-DzoN9JgQ.js} +2 -2
  153. package/dist/client/assets/{device-i4SkE05R.js → device-H2MyT_kA.js} +2 -2
  154. package/dist/client/assets/{dialog-DFlZvvht.js → dialog-CrLVN_m6.js} +2 -2
  155. package/dist/client/assets/{diffPanelStore-CGdPbp5I.js → diffPanelStore-CxnPNigi.js} +2 -2
  156. package/dist/client/assets/{diffRendering-B7lkQ5_O.js → diffRendering-cyTQV5bk.js} +2 -2
  157. package/dist/client/assets/{dist-BvS7KgJD.js → dist-J7s-H61h.js} +3 -3
  158. package/dist/client/assets/{draft-input-1HTN8QVo.js → draft-input-UuEBPJE8.js} +2 -2
  159. package/dist/client/assets/{duoViewer-DbnFva5H.js → duoViewer-C3DQnADY.js} +2 -2
  160. package/dist/client/assets/{dynamic-DmVpEfW3.js → dynamic-PDa6LTqb.js} +2 -2
  161. package/dist/client/assets/{embeddedScripts-D0-ABFFC.js → embeddedScripts-BDzRNXSL.js} +2 -2
  162. package/dist/client/assets/{empty-Dn5VI2Xk.js → empty-YMXgQbNI.js} +2 -2
  163. package/dist/client/assets/entities-HOBDIiHK.js +2 -0
  164. package/dist/client/assets/fileLinks-BlT4My6t.js +2 -0
  165. package/dist/client/assets/{fileTreeExpansion-Bp5eLBXI.js → fileTreeExpansion-D5nN-Oqd.js} +2 -2
  166. package/dist/client/assets/{getDiffFileInput-CKgGUEGl.js → getDiffFileInput-4gToQuSl.js} +2 -2
  167. package/dist/client/assets/{htmlRender-BdsR_7vV.js → htmlRender-CUGVJXGf.js} +2 -2
  168. package/dist/client/assets/{index-DQKD4Lk2.js → index-C04a0SKq.js} +3 -3
  169. package/dist/client/assets/{input-yaZxaTds.js → input-DxHa9qj5.js} +2 -2
  170. package/dist/client/assets/{input-group-B1TOCtDG.js → input-group-_rAbDbys.js} +2 -2
  171. package/dist/client/assets/katex-B940_AAO.js +258 -0
  172. package/dist/client/assets/{kbd-R7rkirqT.js → kbd-DjUfNaix.js} +2 -2
  173. package/dist/client/assets/{keybindings-CrlWqd5q.js → keybindings-8_1sqf8s.js} +2 -2
  174. package/dist/client/assets/{lazy-C5ansoaW.js → lazy-C1dqAep6.js} +4 -4
  175. package/dist/client/assets/{lazyRouteComponent-BxpFJiXB.js → lazyRouteComponent-DLamKhHF.js} +2 -2
  176. package/dist/client/assets/{link-2ZiGGBbw.js → link-D1nkgCv7.js} +2 -2
  177. package/dist/client/assets/{linkedPrompt-CwNmoWmu.js → linkedPrompt-Quysf0mk.js} +2 -2
  178. package/dist/client/assets/main-BFdCLmkY.js +39 -0
  179. package/dist/client/assets/main-BQBpA03z.css +2 -0
  180. package/dist/client/assets/mediaReference-D19Dzoh3.js +2 -0
  181. package/dist/client/assets/mediaSource-DfsR3T70.js +2 -0
  182. package/dist/client/assets/{modelScene-D8CdQkcp.js → modelScene-CcF-Uii-.js} +2 -2
  183. package/dist/client/assets/{number-field-DNna9ps3.js → number-field-CALZZPio.js} +2 -2
  184. package/dist/client/assets/{observeResize-Cz6dJUG2.js → observeResize-DLmefMqO.js} +2 -2
  185. package/dist/client/assets/{onboarding-BG6FdUUU.js → onboarding-plATuZco.js} +2 -2
  186. package/dist/client/assets/{openFileInPreview-BaemzSTr.js → openFileInPreview-BCGQQ_Ia.js} +2 -2
  187. package/dist/client/assets/{p4ProjectFile-O_tvpvNW.js → p4ProjectFile-DCNJ4pTp.js} +2 -2
  188. package/dist/client/assets/{pair-BNIczJXa.js → pair-umv6-haX.js} +2 -2
  189. package/dist/client/assets/{pendingSendStore-Cc6n4Xji.js → pendingSendStore-CgfQk4GV.js} +2 -2
  190. package/dist/client/assets/{phoneViewer-CqawjVDW.js → phoneViewer-DJWjzgFc.js} +2 -2
  191. package/dist/client/assets/{pierre-icons-BfZ11Q2h.js → pierre-icons-fv1goMS6.js} +2 -2
  192. package/dist/client/assets/{popover-DnYfrQly.js → popover-DxCAIK62.js} +2 -2
  193. package/dist/client/assets/preview-Ce5ECOHv.js +2 -0
  194. package/dist/client/assets/{preview-Bi-hPWTp.js → preview-x1tmlUez.js} +2 -2
  195. package/dist/client/assets/{previewMiniPlayerStore-W10VSM09.js → previewMiniPlayerStore-CEd7VI6J.js} +2 -2
  196. package/dist/client/assets/{primary-CDuW5QwW.js → primary-DcnaBKM0.js} +2 -2
  197. package/dist/client/assets/{primaryCloudLinkState-BONYlcei.js → primaryCloudLinkState-TS0IW37f.js} +2 -2
  198. package/dist/client/assets/{projectFilesQueryState-Ck4wjfaq.js → projectFilesQueryState-DKw9S3nn.js} +2 -2
  199. package/dist/client/assets/{projectScriptEditor-DgVU8tRa.js → projectScriptEditor-DT7-Ivvb.js} +2 -2
  200. package/dist/client/assets/{providerSkills-Dfc0PY_E.js → providerSkills-G8ld9nNp.js} +2 -2
  201. package/dist/client/assets/pullRequestDetail.logic-Dm3mx1US.js +10 -0
  202. package/dist/client/assets/{pullRequestIcons-DwblWS4R.js → pullRequestIcons-D8rnFTkk.js} +2 -2
  203. package/dist/client/assets/{pullRequestReviewStore-Cc4bHb4o.js → pullRequestReviewStore-C45fih_P.js} +2 -2
  204. package/dist/client/assets/{pullRequests-BSjV3BBU.js → pullRequests-euX1Ch2G.js} +2 -2
  205. package/dist/client/assets/queries-DNRXml7d.js +2 -0
  206. package/dist/client/assets/query-Bw8YoCbO.js +2 -0
  207. package/dist/client/assets/{radio-group-EK7EPCn2.js → radio-group-DpD3XHAp.js} +2 -2
  208. package/dist/client/assets/{relay-Ceq0htTl.js → relay-YiJpGyaO.js} +2 -2
  209. package/dist/client/assets/{relayFailureReason-DfHD60Z_.js → relayFailureReason-Baxcpnas.js} +2 -2
  210. package/dist/client/assets/{renderScheduler-BGJGU9W9.js → renderScheduler-BuGbk7RK.js} +2 -2
  211. package/dist/client/assets/{rightPanelStore-AjYoRisO.js → rightPanelStore-BF1zmmXM.js} +2 -2
  212. package/dist/client/assets/runtime-DIAcbMTc.js +9 -0
  213. package/dist/client/assets/{runtimeModeConfig-Oh86kRYJ.js → runtimeModeConfig-4g_-_dE2.js} +2 -2
  214. package/dist/client/assets/{scheduledTasksSettings.logic-h-rZbNI3.js → scheduledTasksSettings.logic-BOrkdeD3.js} +3 -3
  215. package/dist/client/assets/{scroll-area-DhDCLqyU.js → scroll-area-CokPD3-i.js} +2 -2
  216. package/dist/client/assets/{select-CNcZzYBl.js → select-CxYi0YMi.js} +2 -2
  217. package/dist/client/assets/{selfImproveFindings-CvQXlaMJ.js → selfImproveFindings-CE-lxRTw.js} +2 -2
  218. package/dist/client/assets/{server-Bw1ZPPkk.js → server-BNjk2K1j.js} +2 -2
  219. package/dist/client/assets/{session-YEQs2e4k.js → session-DMNo4Bh3.js} +2 -2
  220. package/dist/client/assets/{session-logic-BOQRidTa.js → session-logic-CELyWJ1v.js} +4 -4
  221. package/dist/client/assets/{settings-Dj9xov5g.js → settings-Bt6o5coA.js} +2 -2
  222. package/dist/client/assets/{settings.appearance-BFkpCG_N.js → settings.appearance-pkRxkhgs.js} +2 -2
  223. package/dist/client/assets/settings.archived-OjOh5b0A.js +2 -0
  224. package/dist/client/assets/{settings.computer-use-Bi6Yznts.js → settings.computer-use-Dh6Z2-Jg.js} +2 -2
  225. package/dist/client/assets/settings.connections-F3LWiK8-.js +2 -0
  226. package/dist/client/assets/{settings.data-controls-CMPajamk.js → settings.data-controls-DgOo9a4b.js} +2 -2
  227. package/dist/client/assets/{settings.decisions-BaYWexvw.js → settings.decisions-lQFEkC9t.js} +2 -2
  228. package/dist/client/assets/settings.designs-C1tyiETD.js +2 -0
  229. package/dist/client/assets/settings.diagnostics-kp_wJw6e.js +2 -0
  230. package/dist/client/assets/{settings.general-BqeVFfxZ.js → settings.general-B5Kke4t3.js} +2 -2
  231. package/dist/client/assets/{settings.integrations-CYmWtYZT.js → settings.integrations-CjiKCDy_.js} +2 -2
  232. package/dist/client/assets/{settings.keybindings-Rdl8b88k.js → settings.keybindings-CouYSmxE.js} +2 -2
  233. package/dist/client/assets/{settings.open-source-licenses-C-Brz8iy.js → settings.open-source-licenses-CHFTLx1q.js} +2 -2
  234. package/dist/client/assets/settings.plugins-StUBBho3.js +5 -0
  235. package/dist/client/assets/{settings.projects-BTKNVvto.js → settings.projects-B_SxK9Cl.js} +4 -4
  236. package/dist/client/assets/settings.providers-Ch16WkgV.js +3 -0
  237. package/dist/client/assets/{settings.scheduled-tasks-Da_-twWT.js → settings.scheduled-tasks-KNcUc94O.js} +2 -2
  238. package/dist/client/assets/{settings.secrets-B_ZY_xsv.js → settings.secrets-2aMmfgKR.js} +2 -2
  239. package/dist/client/assets/{settings.snap-shot-lnIAMmUa.js → settings.snap-shot-B5cEBXZD.js} +2 -2
  240. package/dist/client/assets/settings.source-control-G_TX95re.js +2 -0
  241. package/dist/client/assets/settings.storage-BdNNKm9m.js +2 -0
  242. package/dist/client/assets/settingsLayout-CzGbLP4v.js +3 -0
  243. package/dist/client/assets/{sidebar-BUDllWET.js → sidebar-ovj9EiR4.js} +2 -2
  244. package/dist/client/assets/{sidebarProjectGrouping-xYoX3lLq.js → sidebarProjectGrouping-DT6LCDEX.js} +2 -2
  245. package/dist/client/assets/{skeleton-C6O21cqb.js → skeleton-0IEb3e4e.js} +2 -2
  246. package/dist/client/assets/sourceControl-CPobWWHq.js +2 -0
  247. package/dist/client/assets/{sourceControlClients-C3cHOUoL.js → sourceControlClients-4PlkytxQ.js} +2 -2
  248. package/dist/client/assets/{spinner-m1uNq_wW.js → spinner-7CSKKESP.js} +2 -2
  249. package/dist/client/assets/src-BVovWpja.js +15 -0
  250. package/dist/client/assets/{terminal-links-CxLXIwP1.js → terminal-links-BTdovUFa.js} +2 -2
  251. package/dist/client/assets/{terminalSessions-CXGA3pch.js → terminalSessions-EUiRWJti.js} +2 -2
  252. package/dist/client/assets/{textarea-xZYMC9X5.js → textarea-DMmmmGA1.js} +2 -2
  253. package/dist/client/assets/{themePalette-BcMO2M90.js → themePalette-C7ZOgucT.js} +2 -2
  254. package/dist/client/assets/{threadCheckpoints-DUorxvL1.js → threadCheckpoints-DjIk4Kvg.js} +2 -2
  255. package/dist/client/assets/{toggle-DumCe7R7.js → toggle-4vFx94TS.js} +2 -2
  256. package/dist/client/assets/{toggle-group-CzE2mG-B.js → toggle-group-d6H735Xi.js} +2 -2
  257. package/dist/client/assets/{tooltip-BhCWnsdW.js → tooltip-CGvxq8k3.js} +2 -2
  258. package/dist/client/assets/{uiStateStore-JOwhQqDV.js → uiStateStore-MbQdhAPp.js} +2 -2
  259. package/dist/client/assets/{usage-Blib8u_-.js → usage-Da_tm2dn.js} +2 -2
  260. package/dist/client/assets/{usageAccess-COKmar79.js → usageAccess-B-HGPPkp.js} +2 -2
  261. package/dist/client/assets/{usageFormat-2913AogD.js → usageFormat-DcON9Kz_.js} +2 -2
  262. package/dist/client/assets/{usageShortcuts-U_aRtpf7.js → usageShortcuts-B_o9XxKX.js} +2 -2
  263. package/dist/client/assets/{use-atom-command-DkmE-pw9.js → use-atom-command-C4Tyb1VL.js} +2 -2
  264. package/dist/client/assets/{useAriaLabelledBy-BiZIzNf7.js → useAriaLabelledBy-CcwjH1QH.js} +2 -2
  265. package/dist/client/assets/useHandleNewThread-Qb_yy6KY.js +2 -0
  266. package/dist/client/assets/{useLocation-BXwb7I1F.js → useLocation-CIvcNoeU.js} +2 -2
  267. package/dist/client/assets/{useNavigate-P1p3Es15.js → useNavigate-DVrOlf8m.js} +2 -2
  268. package/dist/client/assets/{useNavigateBack-D02Al7yk.js → useNavigateBack-Dmf0SIc3.js} +2 -2
  269. package/dist/client/assets/{useP4ConnectAuthPrompt-4l_tJOsn.js → useP4ConnectAuthPrompt-BPXqJdyY.js} +2 -2
  270. package/dist/client/assets/{useParams-DsmZTF__.js → useParams-BeJIRxxE.js} +2 -2
  271. package/dist/client/assets/{usePermissionStatus-DeJYBk6u.js → usePermissionStatus-Cx1Wuwk0.js} +2 -2
  272. package/dist/client/assets/{usePopupViewport-BBKn7x_4.js → usePopupViewport-OR_PF2s-.js} +2 -2
  273. package/dist/client/assets/{usePullRequestActions-DtDOHLgX.js → usePullRequestActions-B_Nrg846.js} +2 -2
  274. package/dist/client/assets/{useRegisterFieldControl-DkFmgEzw.js → useRegisterFieldControl-B72Afmil.js} +2 -2
  275. package/dist/client/assets/{useScopedModelAvailability-B-vTMNh_.js → useScopedModelAvailability-DVQ42jT4.js} +2 -2
  276. package/dist/client/assets/{useSettings-Dp27sUML.js → useSettings-BWMcQzC-.js} +2 -2
  277. package/dist/client/assets/{utils-BVnIIHXP.js → utils-DFNDxNZi.js} +21 -21
  278. package/dist/client/assets/{vcsRefInvalidation-DU1ipBl9.js → vcsRefInvalidation-CV8dYgi0.js} +2 -2
  279. package/dist/client/assets/{welcome-CmsT2lJW.js → welcome-BxhPM21H.js} +2 -2
  280. package/dist/client/index.html +1 -1
  281. package/dist/client/third-party-licenses.json +1 -1
  282. package/dist/{mcpResponsePayloads-C8W7Qyxk.mjs → mcpResponsePayloads-SwQXsZoI.mjs} +3 -3
  283. package/dist/{preview-iNdhUsAa.mjs → preview-BGylKXB6.mjs} +235 -101
  284. package/dist/{renderer-DKOOIEoX.mjs → renderer-CQkeNW9b.mjs} +2 -2
  285. package/dist/{runtime-Bm_EVnst.mjs → runtime-O5AWAEzD.mjs} +3 -3
  286. package/dist/{runtimeLayer-hDhX2kHB.mjs → runtimeLayer-C-Fo4HWH.mjs} +1 -1
  287. package/dist/{runtimeLayer-CZ8Ru7Ia.mjs → runtimeLayer-ChPBglJB.mjs} +2298 -1209
  288. package/dist/{sdk-CcrYY4k4.mjs → sdk-C8tgjyIq.mjs} +29609 -23199
  289. package/dist/{server-qfCj2NpU.mjs → server-CsS0d2BE.mjs} +358 -88
  290. package/dist/{sha2-Daa2Fiv1.mjs → sha2-BjjJcoUu.mjs} +449 -24
  291. package/package.json +1 -1
  292. package/dist/AcpMcpStdioBridge-C9Ry_oCI.mjs +0 -3
  293. package/dist/client/assets/AlertDialogRoot-CNpt8h9w.js +0 -2
  294. package/dist/client/assets/ChatMarkdown-DO_2fTqM.js +0 -49
  295. package/dist/client/assets/Input-BT2VVALp.js +0 -2
  296. package/dist/client/assets/JZOYTAAL-BCzM9Qh2.js +0 -1
  297. package/dist/client/assets/KeybindingsSettings.logic-oAUXQqts.js +0 -2
  298. package/dist/client/assets/MathTypeset-DEcVZfaU.css +0 -1
  299. package/dist/client/assets/PreviewPanel-DIVx5x1H.js +0 -2
  300. package/dist/client/assets/ProviderModelPicker-rRVcFLyP.js +0 -2
  301. package/dist/client/assets/ThreadTerminalDrawer-B77-xYz_.js +0 -5
  302. package/dist/client/assets/_chat-BA5cbHxE.js +0 -47
  303. package/dist/client/assets/_chat.new-Bw2VR60x.js +0 -4
  304. package/dist/client/assets/command-BdVxwZ8D.js +0 -2
  305. package/dist/client/assets/connect-agent-AVHGyda5.js +0 -2
  306. package/dist/client/assets/entities-JWl3bvMT.js +0 -2
  307. package/dist/client/assets/fileLinks-Y3tOmcmb.js +0 -2
  308. package/dist/client/assets/katex-DJhrJSbw.js +0 -258
  309. package/dist/client/assets/main-43D2LVmx.js +0 -38
  310. package/dist/client/assets/main-Rpw_0nEx.css +0 -2
  311. package/dist/client/assets/mediaReference-Bh7Pydqp.js +0 -2
  312. package/dist/client/assets/mediaSource-Do7lCSv7.js +0 -2
  313. package/dist/client/assets/preview-Dd9kGZBH.js +0 -2
  314. package/dist/client/assets/pullRequestDetail.logic-Dy7e4vh2.js +0 -10
  315. package/dist/client/assets/queries-BQAICaPF.js +0 -2
  316. package/dist/client/assets/query-DFSffMGJ.js +0 -2
  317. package/dist/client/assets/runtime-vb0YwEUc.js +0 -9
  318. package/dist/client/assets/settings.archived-D96oQP2t.js +0 -2
  319. package/dist/client/assets/settings.connections-C7OGFqf1.js +0 -2
  320. package/dist/client/assets/settings.designs-t7-jewWy.js +0 -2
  321. package/dist/client/assets/settings.diagnostics-qkp4kADk.js +0 -2
  322. package/dist/client/assets/settings.plugins-DAvzBYum.js +0 -5
  323. package/dist/client/assets/settings.providers-r89DCT90.js +0 -3
  324. package/dist/client/assets/settings.source-control-BIPVuyIo.js +0 -2
  325. package/dist/client/assets/settings.storage-vvoP_prr.js +0 -2
  326. package/dist/client/assets/settingsLayout-DaKDuaST.js +0 -3
  327. package/dist/client/assets/sourceControl-gh0Nj17P.js +0 -2
  328. package/dist/client/assets/src-DHn7yNZx.js +0 -15
  329. package/dist/client/assets/useHandleNewThread-C1YHLGL_.js +0 -2
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{t as n}from"./jsx-runtime-DJeoFXNw.js";import{t as r}from"./FieldControl-DHSVFpKc.js";var i=e(t()),a=e(n()),o=i.forwardRef(function(e,t){return(0,a.jsx)(r,{ref:t,...e})});export{o as t};
2
- //# sourceMappingURL=Input-BT2VVALp.js.map
@@ -1 +0,0 @@
1
- export{t as flowchart}from"./O65XPQGZ-g6xpsO0r.js";
@@ -1,2 +0,0 @@
1
- import{Bc as e,Hc as t,Mc as n,Pc as r,zc as i}from"./utils-BVnIIHXP.js";import{wi as a}from"./src-DHn7yNZx.js";import{v as o}from"./keybindings-CrlWqd5q.js";import{n as s,t as c}from"./usageShortcuts-U_aRtpf7.js";var l=new Map([`usage.open`,...[...c,...s].map(e=>e.command)].map((e,t)=>[e,t])),u=c[0].command;function d(e,t,n){let r=l.get(e),i=l.get(t);return r!==void 0&&i!==void 0?r-i:n(r===void 0?e:u).localeCompare(n(i===void 0?t:u))}var f=[`terminalFocus`,`terminalOpen`,`isWeb`,`isDesktop`,`true`,`false`],p=new Set(f);for(let e of n)j(e.whenAst,p);var m=[...p].find(e=>e!==`true`&&e!==`false`)??`terminalFocus`,h=new Set(p);function g(e){let t=[];return e.modKey&&t.push(`mod`),e.metaKey&&t.push(`meta`),e.ctrlKey&&t.push(`ctrl`),e.altKey&&t.push(`alt`),e.shiftKey&&t.push(`shift`),t.push(e.key===` `?`space`:e.key===`escape`?`esc`:e.key),t.join(`+`)}function _(e){if(!e)return``;switch(e.type){case`identifier`:return e.name;case`not`:return`!${y(e.node)}`;case`and`:return`${y(e.left)} && ${y(e.right)}`;case`or`:return`${y(e.left)} || ${y(e.right)}`}}function v(e,t){return t===0?`Clear all conditions`:e.type===`identifier`||e.type===`not`&&e.node.type===`identifier`?`Remove condition`:`Remove group and its conditions`}function y(e){return e.type===`identifier`||e.type===`not`?_(e):`(${_(e)})`}function b(t){let n=t.trim();if(n.length===0)return{ok:!0,value:void 0};let r=e(n);return r?{ok:!0,value:r}:{ok:!1,message:`Use variables with !, &&, ||, and parentheses.`}}function x(e){if(String(e.command).startsWith(`script.`))return`Project`;let t=g(e.shortcut),r=_(e.whenAst);return n.some(n=>n.command===e.command&&g(n.shortcut)===t&&_(n.whenAst)===r)?`Default`:`Custom`}function S(e){let t=g(e.shortcut),r=_(e.whenAst);return n.find(n=>n.command===e.command&&g(n.shortcut)===t&&_(n.whenAst)===r)??n.find(t=>t.command===e.command&&_(t.whenAst)===r)??n.find(t=>t.command===e.command)}function C(e,t,n){return`${e}\u0000${t}\u0000${n}`}function w(e,t){return e.length===0||t.length===0||e===t}function T(e,t,n=navigator.platform){if(t.key.trim().length===0)return[];let r=i(t.key);if(!r)return[];let a=o(r,n),s=[];for(let r of e)r.id!==t.rowId&&o(r.binding.shortcut,n)===a&&w(r.when,t.when)&&s.push(I(r.command));return[...new Set(s)].toSorted()}var E=[{id:`navigation`,title:`Navigation`,prefixes:[`sidebar`,`rightPanel`,`commandPalette`,`filePicker`,`projectSearch`,`editor`]},{id:`threads`,title:`Threads`,prefixes:[`thread`,`chat`,`pullRequest`]},{id:`composer`,title:`Composer`,prefixes:[`composer`,`modelPicker`]},{id:`terminal`,title:`Terminal`,prefixes:[`terminal`]},{id:`preview`,title:`Preview & diff`,prefixes:[`preview`,`diff`]},{id:`appearance`,title:`Appearance`,prefixes:[`theme`,`appearance`,`themeEditor`]},{id:`scripts`,title:`Project scripts`,prefixes:[`script`]}],D={id:`other`,title:`Other`};function O(e){let t=String(e).split(`.`)[0]??``;return E.find(e=>e.prefixes.includes(t))??D}function k(e){let t=new Map;for(let n of e){let e=O(n.command),r=t.get(e.id);r?r.push(n):t.set(e.id,[n])}return[...E,D].flatMap(e=>{let n=t.get(e.id);return n?[{id:e.id,title:e.title,rows:n}]:[]})}function A(e,t,n=navigator.platform){let r=t.trim().toLowerCase(),i=e.map((e,t)=>{let n=S(e),r=g(e.shortcut),i=_(e.whenAst);return{id:`${C(e.command,r,i)}\u0000${t}`,command:e.command,key:r,when:i,source:x(e),defaultKey:n?g(n.shortcut):null,defaultWhen:_(n?.whenAst),binding:e,conflicts:[]}}),a=i.map(e=>{let t=T(i,{rowId:e.id,key:e.key,when:e.when},n);return t.length>0?Object.assign({},e,{conflicts:[...new Set(t)].toSorted()}):e});return a.sort((e,t)=>{let n=d(e.command,t.command,e=>e);return n===0?e.key.localeCompare(t.key):n}),r.length===0?a:a.filter(e=>e.command.toLowerCase().includes(r)||I(e.command).toLowerCase().includes(r)||e.key.toLowerCase().includes(r)||e.when.toLowerCase().includes(r)||e.source.toLowerCase().includes(r))}function j(e,t){if(e)switch(e.type){case`identifier`:t.add(e.name);return;case`not`:j(e.node,t);return;case`and`:case`or`:j(e.left,t),j(e.right,t);return}}function M(e){return h.has(e)}function N(e){let t=new Set;return j(e,t),[...t].filter(e=>!M(e)).toSorted()}function P(){return[...h].toSorted((e,t)=>{let n=f.indexOf(e),r=f.indexOf(t);return n!==-1||r!==-1?(n===-1?2**53-1:n)-(r===-1?2**53-1:r):e.localeCompare(t)})}function F(e){let t=new Set(a);for(let n of e)t.add(n.command);return[...t].toSorted((e,t)=>d(e,t,I))}function I(e){if(e===`composer.sendAlternate`)return`Composer: Opposite Queue or Steer Action`;if(e===`composer.sendBackground`)return`Composer: Start in Background`;if(e===`composer.sendAndNewThread`)return`Composer: Send and Start New Thread`;if(e===`thread.steerQueuedMessage`)return`Queue: Send First Queued Message as Steer`;if(e===`thread.editQueuedMessage`)return`Queue: Edit Last Queued Message`;if(e===`thread.sideChat`)return`Side Chat: Open or Start`;if(e===`thread.copyReference`)return`Pull Request: Copy Link or Thread`;let t=c.find(t=>t.command===e);if(t)return`Usage: ${t.label}`;let n=s.find(t=>t.command===e);if(n)return`Usage: Period: ${n.label}`;if(e===`view.reopenClosed`)return`Reopen Closed Tab`;if(e===`preview.focusUrl`)return`Preview: Focus URL`;let r=String(e);return r.startsWith(`script.`)&&r.endsWith(`.run`)?`Run Script: ${L(r.slice(7,-4))}`:r.split(`.`).map(L).join(`: `)}function L(e){let t=[];for(let n of e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).split(/[-_\s]+/))n.length>0&&t.push(n.slice(0,1).toUpperCase()+n.slice(1));return t.join(` `)}function R(e){let t=e.toLowerCase();return t===`meta`||t===`control`||t===`ctrl`||t===`shift`||t===`alt`||t===`option`?null:t===` `?`space`:t===`escape`?`esc`:t===`arrowup`?`arrowup`:t===`arrowdown`?`arrowdown`:t===`arrowleft`?`arrowleft`:t===`arrowright`?`arrowright`:t.length===1||/^f\d{1,2}$/.test(t)||t===`enter`||t===`tab`||t===`backspace`||t===`delete`||t===`home`||t===`end`||t===`pageup`||t===`pagedown`?t:null}function z(e,n){let i=R(t(e));if(!i)return null;let a=[];return r(n)?(e.metaKey&&a.push(`mod`),e.ctrlKey&&a.push(`ctrl`)):(e.ctrlKey&&a.push(`mod`),e.metaKey&&a.push(`meta`)),e.altKey&&a.push(`alt`),e.shiftKey&&a.push(`shift`),a.push(i),a.join(`+`)}export{I as a,T as c,g as d,N as f,P as i,z as l,v as m,F as n,k as o,_ as p,A as r,M as s,m as t,b as u};
2
- //# sourceMappingURL=KeybindingsSettings.logic-oAUXQqts.js.map
@@ -1 +0,0 @@
1
- @font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2)format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff)format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2)format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff)format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2)format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff)format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2)format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff)format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2)format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff)format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2)format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff)format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2)format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff)format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2)format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff)format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2)format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff)format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2)format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff)format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2)format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff)format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2)format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff)format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2)format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff)format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2)format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff)format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2)format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff)format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2)format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff)format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2)format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff)format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC)format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff)format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2)format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff)format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2)format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff)format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf)format("truetype")}.katex{text-indent:0;text-rendering:auto;font:1.21em/1.2 KaTeX_Main,Times New Roman,serif;position:relative}.katex *{border-color:currentColor;-ms-high-contrast-adjust:none!important}.katex .katex-version:after{content:"0.16.47"}.katex .katex-mathml{clip-path:inset(50%);border:0;width:1px;height:1px;padding:0;position:absolute;overflow:hidden}.katex .katex-html>.newline{display:block}.katex .base{white-space:nowrap;width:min-content;position:relative}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;table-layout:fixed;display:inline-table}.katex .vlist-r{display:table-row}.katex .vlist{vertical-align:bottom;display:table-cell;position:relative}.katex .vlist>span{height:0;display:block;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{width:0;overflow:hidden}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{vertical-align:bottom;width:2px;min-width:2px;font-size:1px;display:table-cell}.katex .vbox{flex-direction:column;align-items:baseline;display:inline-flex}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{flex-direction:row;display:inline-flex}.katex .thinbox{width:0;max-width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;width:100%;display:inline-block}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .smash{line-height:0;display:inline}.katex .clap,.katex .llap,.katex .rlap{width:0;position:relative}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;width:100%;display:inline-block}.katex .hdashline{border-bottom-style:dashed;width:100%;display:inline-block}.katex .sqrt>.root{margin-left:.277778em;margin-right:-.555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.833333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.16667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.33333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.66667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.45667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.14667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.714286em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.857143em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.14286em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.28571em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.42857em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.71429em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.05714em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.46857em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.96286em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.55429em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.11111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.33333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.30444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.76444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.416667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.583333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.833333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72833em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.07333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.347222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.416667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.486111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.694444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.833333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.44028em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.72778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.289352em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.347222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.405093em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.520833em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.578704em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.694444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.833333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20023em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.43981em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.24108em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.289296em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.385728em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.433944em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48216em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.578592em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.694311em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.833173em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.19961em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.200965em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.241158em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.281351em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.321543em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.361736em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.401929em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.482315em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.694534em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.833601em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{width:.12em;display:inline-block}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{min-width:1px;display:inline-block}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;height:inherit;width:100%;display:block;position:absolute}.katex svg path{stroke:none}.katex svg{fill-rule:nonzero;fill-opacity:1;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1}.katex img{border-style:none;min-width:0;max-width:none;min-height:0;max-height:none}.katex .stretchy{width:100%;display:block;position:relative;overflow:hidden}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{width:100%;position:relative;overflow:hidden}.katex .halfarrow-left{width:50.2%;position:absolute;left:0;overflow:hidden}.katex .halfarrow-right{width:50.2%;position:absolute;right:0;overflow:hidden}.katex .brace-left{width:25.1%;position:absolute;left:0;overflow:hidden}.katex .brace-center{width:50%;position:absolute;left:25%;overflow:hidden}.katex .brace-right{width:25.1%;position:absolute;right:0;overflow:hidden}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{box-sizing:border-box;border:.04em solid}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{box-sizing:border-box;border-top:.049em solid;border-right:.049em solid;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{text-align:left;display:inline-block;position:absolute;right:calc(50% + .3em)}.katex .cd-label-right{text-align:right;display:inline-block;position:absolute;left:calc(50% + .3em)}.katex-display{text-align:center;margin:1em 0;display:block}.katex-display>.katex{text-align:center;white-space:nowrap;display:block}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{text-align:left;padding-left:2em}body{counter-reset:katexEqnNo mmlEqnNo}
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$n as i,Ad as a,D as o,Dd as s,El as c,Go as l,Lo as u,Uu as d,Vo as f,Wu as p,Xn as m,Zd as h,Zn as g,Zs as _,ar as v,dr as y,er as b,fr as x,ir as S,lr as C,mr as w,nl as T,of as E,ol as D,op as O,ou as ee,rf as k,rr as te,sl as A,sr as j,t as M,tr as N,ur as P,wd as ne,zo as re,zu as F}from"./utils-BVnIIHXP.js";import{Rr as I,Wr as L,aa as R}from"./src-DHn7yNZx.js";import{Dr as z,Sr as B}from"./runtime-vb0YwEUc.js";import{y as ie}from"./entities-JWl3bvMT.js";import{nt as V}from"./ChatMarkdown-DO_2fTqM.js";import{a as H}from"./relay-Ceq0htTl.js";import{C as ae,S as oe,k as U,q as W,r as se}from"./useSettings-Dp27sUML.js";import{i as ce,n as G}from"./session-YEQs2e4k.js";import{t as le}from"./use-atom-command-DkmE-pw9.js";import{u as ue}from"./rightPanelStore-AjYoRisO.js";import{t as de}from"./toastHelpers-DxXYm50b.js";import{M as K,N as q}from"./PanelLayoutControls-CcdUv-ij.js";import{o as fe}from"./timestampFormat-Dq7sHZpd.js";import{a as pe,n as me,t as he}from"./tooltip-BhCWnsdW.js";import{a as ge,o as _e,r as ve,t as ye}from"./empty-Dn5VI2Xk.js";import{n as be,t as xe}from"./discovery-list-VELXPQtS.js";import{t as Se}from"./observeResize-Cz6dJUG2.js";import{T as Ce,a as we,b as Te,f as Ee,i as De,n as Oe,o as ke,r as Ae,t as je,u as Me,w as Ne}from"./browserHistoryStore-xnY5QhfE.js";import{n as Pe}from"./openFileInPreview-BaemzSTr.js";import{t as Fe}from"./preview-Dd9kGZBH.js";import{a as Ie,i as Le,n as Re,o as ze,t as Be}from"./preview-Bi-hPWTp.js";import{u as Ve}from"./LinkMachineSelect-CB99X8v3.js";import{Ao as J,Ga as He,Ha as Ue,Ka as We,Ua as Ge,Uo as Y,Wa as Ke,Xa as qe,Ya as Je,Za as Ye,ao as Xe,eo as Ze,jo as Qe,no as $e,oo as X,to as et,uo as tt}from"./main-43D2LVmx.js";import{a as nt,c as rt,d as it,i as at,l as ot,n as st,o as ct,r as lt,s as ut,u as dt}from"./_chat-BA5cbHxE.js";var Z=e(t(),1),Q=n(),ft=`data:image/png;base64,`;function pt(e){if(!e.screenshot)return{status:`none`};try{let{dataUrl:t}=e.screenshot;if(!t.startsWith(ft))return{status:`failed`};let n=tt(t,`preview-annotation-${e.id}.png`,`image/png`);return n.size>0?{status:`captured`,file:n}:{status:`failed`}}catch{return{status:`failed`}}}var $=e(r(),1),mt=()=>{};function ht(e){let t=(0,Q.c)(79),{url:n,loading:r,canGoBack:i,canGoForward:o,refreshDisabled:s,inputDisabled:l,focusUrlNonce:u,onBack:d,onForward:f,onRefresh:p,onSubmit:m,onOpenInBrowser:h,onCapture:g,captureDisabled:_,recording:v,onSeparateWindow:y,separateWindow:b,separateWindowDisabled:x,onPickElement:S,pickActive:C,pickDisabled:E,pickDisabledReason:O,trailingActions:k,leadingActions:te}=e,j=(0,Z.useRef)(null),[N,P]=(0,Z.useState)(n),[ne,re]=(0,Z.useState)(!1),F,I;t[0]===u?(F=t[1],I=t[2]):(F=()=>{if(u==null)return;let e=j.current;e&&e.focus()},I=[u],t[0]=u,t[1]=F,t[2]=I),(0,Z.useEffect)(F,I);let L;t[3]!==N||t[4]!==m?(L=e=>{e?.preventDefault();let t=N.trim();t.length!==0&&(m(t),j.current?.blur())},t[3]=N,t[4]=m,t[5]=L):L=t[5];let R=L,z=i?d:mt,B=!i,ie;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(D,{}),t[6]=ie):ie=t[6];let V;t[7]!==z||t[8]!==B?(V=(0,$.jsx)(w,{variant:`ghost`,size:`icon-xs`,onClick:z,disabled:B,"aria-label":`Back`,type:`button`,children:ie}),t[7]=z,t[8]=B,t[9]=V):V=t[9];let H=o?f:mt,ae=!o,oe;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(A,{}),t[10]=oe):oe=t[10];let U;t[11]!==H||t[12]!==ae?(U=(0,$.jsx)(w,{variant:`ghost`,size:`icon-xs`,onClick:H,disabled:ae,"aria-label":`Forward`,type:`button`,children:oe}),t[11]=H,t[12]=ae,t[13]=U):U=t[13];let W;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`mx-0.5 h-4 w-px bg-border`}),t[14]=W):W=t[14];let se=s?mt:p,ce=r?`Stop`:`Refresh`,G;t[15]!==s||t[16]!==se||t[17]!==ce?(G=(0,$.jsx)(w,{variant:`ghost`,size:`icon-xs`,onClick:se,disabled:s,"aria-label":ce,type:`button`}),t[15]=s,t[16]=se,t[17]=ce,t[18]=G):G=t[18];let le;t[19]===r?le=t[20]:(le=(0,$.jsx)(Y,{refreshing:r}),t[19]=r,t[20]=le);let ue;t[21]!==G||t[22]!==le?(ue=(0,$.jsx)(pe,{render:G,children:le}),t[21]=G,t[22]=le,t[23]=ue):ue=t[23];let de=r?`Loading…`:`Refresh`,K;t[24]===de?K=t[25]:(K=(0,$.jsx)(me,{children:de}),t[24]=de,t[25]=K);let q;t[26]!==ue||t[27]!==K?(q=(0,$.jsxs)(he,{children:[ue,K]}),t[26]=ue,t[27]=K,t[28]=q):q=t[28];let fe;t[29]!==U||t[30]!==q||t[31]!==V?(fe=(0,$.jsxs)(`div`,{className:`surface-glass flex h-8 shrink-0 items-center gap-0.5 rounded-full border border-border/60 px-1 shadow-sm [&_button]:rounded-full`,role:`group`,"aria-label":`Navigation`,children:[V,U,W,q]}),t[29]=U,t[30]=q,t[31]=V,t[32]=fe):fe=t[32];let ge=ne?N:n,_e;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>P(e.target.value),t[33]=_e):_e=t[33];let ve;t[34]===n?ve=t[35]:(ve=()=>{P(n),re(!0),queueMicrotask(()=>j.current?.select())},t[34]=n,t[35]=ve);let ye;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ye=()=>{re(!1)},t[36]=ye):ye=t[36];let be;t[37]!==R||t[38]!==n?(be=e=>{e.key===`Enter`&&R(e),e.key===`Escape`&&(e.preventDefault(),P(n),j.current?.blur())},t[37]=R,t[38]=n,t[39]=be):be=t[39];let xe;t[40]!==l||t[41]!==ge||t[42]!==ve||t[43]!==be?(xe=(0,$.jsx)(`input`,{ref:j,value:ge,onChange:_e,onFocus:ve,onBlur:ye,onKeyDown:be,"aria-label":`Address`,placeholder:`Search or enter URL`,spellCheck:!1,disabled:l,"data-preview-url-input":!0,className:`w-full min-w-0 truncate bg-transparent text-center text-sm text-foreground outline-none placeholder:text-muted-foreground focus:text-left`}),t[40]=l,t[41]=ge,t[42]=ve,t[43]=be,t[44]=xe):xe=t[44];let Se;t[45]!==ne||t[46]!==h?(Se=h&&!ne?(0,$.jsx)(`span`,{className:`pointer-events-none absolute right-1 flex opacity-0 transition-opacity focus-within:pointer-events-auto focus-within:opacity-100 group-hover/address:pointer-events-auto group-hover/address:opacity-100 [&_button]:rounded-full`,children:(0,$.jsxs)(he,{children:[(0,$.jsx)(pe,{render:(0,$.jsx)(w,{variant:`ghost`,size:`icon-xs`,onClick:h,"aria-label":`Open in system browser`,type:`button`}),children:(0,$.jsx)(ee,{})}),(0,$.jsx)(me,{children:`Open in system browser`})]})}):null,t[45]=ne,t[46]=h,t[47]=Se):Se=t[47];let Ce;t[48]!==xe||t[49]!==Se?(Ce=(0,$.jsxs)(`div`,{className:`surface-glass group/address relative flex h-8 min-w-0 flex-1 items-center rounded-full border border-border/60 px-8 shadow-sm transition-colors focus-within:border-ring has-disabled:opacity-64`,children:[xe,Se]}),t[48]=xe,t[49]=Se,t[50]=Ce):Ce=t[50];let we;t[51]!==S||t[52]!==C||t[53]!==E||t[54]!==O?(we=S?(0,$.jsxs)(he,{children:[(0,$.jsx)(pe,{render:(0,$.jsx)(w,{variant:`glass`,size:`icon`,onClick:S,disabled:E,"aria-label":C?`Cancel annotation`:`Annotate preview`,"aria-pressed":C?`true`:`false`,type:`button`}),children:(0,$.jsx)(a,{className:M(C&&`text-primary`)})}),(0,$.jsx)(me,{children:E&&O?O:C?`Cancel annotation (Esc)`:`Annotate elements, regions, and drawings`})]}):null,t[51]=S,t[52]=C,t[53]=E,t[54]=O,t[55]=we):we=t[55];let Te;t[56]!==_||t[57]!==g||t[58]!==v?(Te=g?(0,$.jsxs)(he,{children:[(0,$.jsxs)(pe,{render:(0,$.jsx)(w,{variant:`glass`,size:`icon`,onClick:e=>g(e.shiftKey),"aria-label":v?`Stop recording`:`Capture screenshot`,type:`button`,className:`relative`,disabled:_}),children:[(0,$.jsx)(c,{className:M(v&&`text-destructive`)}),v?(0,$.jsx)(`span`,{className:`absolute right-0.5 top-0.5 size-1.5 animate-status-pulse rounded-full bg-destructive`}):null]}),(0,$.jsx)(me,{children:v?`Stop recording`:`Screenshot · Shift-click to record`})]}):null,t[56]=_,t[57]=g,t[58]=v,t[59]=Te):Te=t[59];let Ee;t[60]!==y||t[61]!==b||t[62]!==x?(Ee=y?(0,$.jsxs)(he,{children:[(0,$.jsx)(pe,{render:(0,$.jsx)(w,{variant:`glass`,size:`icon`,onClick:y,"aria-label":b?`Bring preview back from its window`:`Open preview in a window`,"aria-pressed":b?`true`:`false`,type:`button`,disabled:x}),children:(0,$.jsx)(T,{className:M(b&&`text-primary`)})}),(0,$.jsx)(me,{children:b?`Bring back`:`Open in separate window`})]}):null,t[60]=y,t[61]=b,t[62]=x,t[63]=Ee):Ee=t[63];let De;t[64]!==te||t[65]!==R||t[66]!==fe||t[67]!==Ce||t[68]!==we||t[69]!==Te||t[70]!==Ee||t[71]!==k?(De=(0,$.jsxs)(`form`,{onSubmit:R,className:`flex h-12 min-h-12 shrink-0 items-center gap-2 border-b border-border/60 bg-background px-2.5 in-data-[preview-panel-mode=inline]:border-b-transparent`,"data-surface-subheader":!0,children:[fe,te,Ce,we,Te,Ee,k]}),t[64]=te,t[65]=R,t[66]=fe,t[67]=Ce,t[68]=we,t[69]=Te,t[70]=Ee,t[71]=k,t[72]=De):De=t[72];let Oe;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(Oe={boxShadow:`0 0 6px 1px var(--color-ring)`},t[73]=Oe):Oe=t[73];let ke;t[74]===r?ke=t[75]:(ke=(0,$.jsx)(`div`,{"aria-hidden":!0,"data-loading":r,className:`preview-loading-progress pointer-events-none absolute bottom-0 left-0 z-10 h-0.5 w-full origin-left rounded-r-full bg-primary`,style:Oe}),t[74]=r,t[75]=ke);let Ae;return t[76]!==De||t[77]!==ke?(Ae=(0,$.jsxs)(`div`,{className:`relative`,children:[De,ke]}),t[76]=De,t[77]=ke,t[78]=Ae):Ae=t[78],Ae}function gt(e){let t=(0,Q.c)(10),{threadRef:n,server:r,onOpen:i}=e,a;t[0]===r?a=t[1]:(a=_t(r),t[0]=r,t[1]=a);let o=a,s;t[2]!==r.requestedUrl||t[3]!==n?(s=(0,$.jsx)(K,{threadRef:n,url:r.requestedUrl}),t[2]=r.requestedUrl,t[3]=n,t[4]=s):s=t[4];let c=`${r.host}:${r.port}`,l;return t[5]!==i||t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,$.jsx)(be,{onClick:i,icon:s,title:o,description:c}),t[5]=i,t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function _t(e){return e.processName?e.processName:`Listening`}function vt(e){let t=(0,Q.c)(26),{threadRef:n,entry:r,onOpen:i,onRemove:a}=e,o;t[0]===r.url?o=t[1]:(o=new URL(r.url),t[0]=r.url,t[1]=o);let s=o,c=s.pathname===`/`?``:s.pathname,l=`${s.host}${c}${s.search}${s.hash}`,u;t[2]===r.lastVisitedAt?u=t[3]:(u=je(r.lastVisitedAt)?fe(new Date(r.lastVisitedAt).toISOString()):``,t[2]=r.lastVisitedAt,t[3]=u);let d=u;Ve();let f;t[4]!==r.url||t[5]!==n?(f=(0,$.jsx)(K,{threadRef:n,url:r.url}),t[4]=r.url,t[5]=n,t[6]=f):f=t[6];let p=r.title??l,m;t[7]===p?m=t[8]:(m=(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:p}),t[7]=p,t[8]=m);let h=r.title?`${l} · `:``,g;t[9]!==h||t[10]!==d?(g=(0,$.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[h,d]}),t[9]=h,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==m||t[13]!==g?(_=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[m,g]}),t[12]=m,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==i||t[16]!==f||t[17]!==_?(v=(0,$.jsxs)(`button`,{type:`button`,onClick:i,className:`flex w-full items-center gap-3 px-3 py-3 pr-10 text-left hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:[f,_]}),t[15]=i,t[16]=f,t[17]=_,t[18]=v):v=t[18];let y=`Remove ${l} from history`,b;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(O,{className:`size-3.5`}),t[19]=b):b=t[19];let x;t[20]!==a||t[21]!==y?(x=(0,$.jsx)(`button`,{type:`button`,"aria-label":y,onClick:a,className:`absolute right-3 rounded p-1 text-muted-foreground opacity-0 hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring group-hover:opacity-100`,children:b}),t[20]=a,t[21]=y,t[22]=x):x=t[22];let S;return t[23]!==x||t[24]!==v?(S=(0,$.jsxs)(`div`,{className:`group relative flex w-full items-center`,children:[v,x]}),t[23]=x,t[24]=v,t[25]=S):S=t[25],S}function yt(e){let t=(0,Q.c)(7),n=$e(e.environmentId,e.configuredUrls),r;if(t[0]!==e.configuredUrls||t[1]!==e.environmentId||t[2]!==n.configuredUrlProbing||t[3]!==n.servers){let i;t[5]===e.environmentId?i=t[6]:(i=t=>({...t,url:ke(e.environmentId,t.url),requestedUrl:t.url}),t[5]=e.environmentId,t[6]=i),r=bt({scanner:n.servers.map(i),configuredUrls:e.configuredUrls??[],configuredUrlProbing:n.configuredUrlProbing}),t[0]=e.configuredUrls,t[1]=e.environmentId,t[2]=n.configuredUrlProbing,t[3]=n.servers,t[4]=r}else r=t[4];return r}function bt(e){let t=new Map;for(let n of e.configuredUrls){let e=St(n);if(!e)continue;let r=xt(e.host,e.port);t.has(r)||t.set(r,e)}let n=[];for(let r of e.scanner){let i=xt(r.host,r.port),a=t.get(i);n.push({...r,requestedUrl:a&&e.configuredUrlProbing===!1?a.url:r.requestedUrl,source:a?`configured`:`scanner`})}return n.toSorted((e,t)=>{let n={configured:0,scanner:1};return n[e.source]===n[t.source]?e.port-t.port:n[e.source]-n[t.source]})}function xt(e,t){let n=e.toLowerCase();return`${Be(n)?`loopback`:n}:${t}`}function St(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`||!Be(t.hostname))return null;let n=t.port?Number.parseInt(t.port,10):t.protocol===`http:`?80:443;return!Number.isFinite(n)||n<=0?null:{host:t.hostname,port:n,url:t.href}}catch{return null}}function Ct(e){let t=(0,Q.c)(24),{threadRef:n,environmentId:r,configuredUrls:i,recentEntries:a,onRemoveRecent:o,onOpenUrl:s}=e,c;t[0]!==i||t[1]!==r?(c={environmentId:r,configuredUrls:i},t[0]=i,t[1]=r,t[2]=c):c=t[2];let l=yt(c),u,d,f,m;if(t[3]!==s||t[4]!==o||t[5]!==a||t[6]!==l.length||t[7]!==n){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e=a.filter(wt).slice(0,8);if(l.length===0&&e.length===0){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(ye,{children:[(0,$.jsx)(ge,{variant:`icon`,children:(0,$.jsx)(F,{className:`size-4.5 text-muted-foreground`})}),(0,$.jsx)(_e,{children:`No preview yet`}),(0,$.jsx)(ve,{children:`Type a URL above, or run a dev script. Browser-ready localhost servers will show up here automatically.`})]}),t[12]=e):e=t[12],m=e;break bb0}f=`scrollbar-gutter-both flex h-full min-h-0 overflow-y-auto px-5 py-8`,u=`mx-auto flex w-full max-w-xl flex-col gap-6`,d=e.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(p,{className:`size-4 shrink-0`}),(0,$.jsx)(`h2`,{className:`font-medium`,children:`Recently used`})]}),(0,$.jsx)(xe,{children:e.map(e=>(0,$.jsx)(vt,{threadRef:n,entry:e,onOpen:()=>s(e.url),onRemove:()=>o(e.url)},e.url))})]}):null}t[3]=s,t[4]=o,t[5]=a,t[6]=l.length,t[7]=n,t[8]=u,t[9]=d,t[10]=f,t[11]=m}else u=t[8],d=t[9],f=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[13]!==s||t[14]!==l||t[15]!==n?(h=l.length>0?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,$.jsx)(k,{className:`size-4 shrink-0`}),(0,$.jsx)(`h2`,{className:`font-medium`,children:`Local servers`})]}),(0,$.jsx)(xe,{children:l.map(e=>(0,$.jsx)(gt,{threadRef:n,server:e,onOpen:()=>s(e.requestedUrl)},`${e.host}:${e.port}`))}),(0,$.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:`Select a live local server to open it in this browser tab.`})]}):null,t[13]=s,t[14]=l,t[15]=n,t[16]=h):h=t[16];let g;t[17]!==u||t[18]!==d||t[19]!==h?(g=(0,$.jsxs)(`div`,{className:u,children:[d,h]}),t[17]=u,t[18]=d,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==f||t[22]!==g?(_=(0,$.jsx)(`div`,{className:f,children:g}),t[21]=f,t[22]=g,t[23]=_):_=t[23],_}function wt(e){return URL.canParse(e.url)}var Tt=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],Et=()=>{let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(he,{children:[(0,$.jsx)(pe,{render:(0,$.jsx)(x,{render:(0,$.jsx)(w,{variant:`glass`,size:`icon`,type:`button`,"aria-label":`Preview menu`})}),children:(0,$.jsx)(s,{})}),(0,$.jsx)(me,{children:`More`})]}),e[0]=t):t=e[0],t};function Dt(e){let t=(0,Q.c)(69),{enabled:n,actions:r,zoomFactor:a,colorScheme:o,deviceToolbarVisible:s,onToggleDeviceToolbar:c,profileName:l,move:u}=e,d;t[0]===a?d=t[1]:(d=Math.round(a*100),t[0]=a,t[1]=d);let f=`${d}%`,p=!n,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(Et,{}),t[2]=m):m=t[2];let _;t[3]!==r.hardReload||t[4]!==p?(_=(0,$.jsx)(N,{onClick:r.hardReload,disabled:p,children:`Hard reload`}),t[3]=r.hardReload,t[4]=p,t[5]=_):_=t[5];let v;t[6]!==r.openDevTools||t[7]!==p?(v=r.openDevTools?(0,$.jsx)(N,{onClick:r.openDevTools,disabled:p,children:`Open DevTools`}):null,t[6]=r.openDevTools,t[7]=p,t[8]=v):v=t[8];let x;t[9]===u?x=t[10]:(x=u?(0,$.jsx)(N,{onClick:u.onMove,children:u.label}):null,t[9]=u,t[10]=x);let T=s?`Hide device toolbar`:`Show device toolbar`,D;t[11]!==p||t[12]!==c||t[13]!==T?(D=(0,$.jsx)(N,{onClick:c,disabled:p,children:T}),t[11]=p,t[12]=c,t[13]=T,t[14]=D):D=t[14];let O;t[15]===p?O=t[16]:(O=(0,$.jsx)(y,{disabled:p,children:`Appearance`}),t[15]=p,t[16]=O);let ee;t[17]===r?ee=t[18]:(ee=e=>r.setColorScheme(e),t[17]=r,t[18]=ee);let k;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=Tt.map(kt),t[19]=k):k=t[19];let A;t[20]!==o||t[21]!==ee?(A=(0,$.jsx)(P,{children:(0,$.jsx)(S,{value:o,onValueChange:ee,children:k})}),t[20]=o,t[21]=ee,t[22]=A):A=t[22];let M;t[23]!==A||t[24]!==O?(M=(0,$.jsxs)(C,{children:[O,A]}),t[23]=A,t[24]=O,t[25]=M):M=t[25];let re;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(j,{}),t[26]=re):re=t[26];let F;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(`span`,{children:`Zoom`}),t[27]=F):F=t[27];let I;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(ne,{}),t[28]=I):I=t[28];let L;t[29]!==r.zoomOut||t[30]!==p?(L=(0,$.jsx)(w,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:r.zoomOut,"aria-label":`Zoom out`,disabled:p,children:I}),t[29]=r.zoomOut,t[30]=p,t[31]=L):L=t[31];let R;t[32]===f?R=t[33]:(R=(0,$.jsx)(`span`,{className:`min-w-12 text-center text-xs tabular-nums text-muted-foreground`,children:f}),t[32]=f,t[33]=R);let z;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(h,{}),t[34]=z):z=t[34];let B;t[35]!==r.zoomIn||t[36]!==p?(B=(0,$.jsx)(w,{variant:`outline`,size:`icon-xs`,type:`button`,onClick:r.zoomIn,"aria-label":`Zoom in`,disabled:p,children:z}),t[35]=r.zoomIn,t[36]=p,t[37]=B):B=t[37];let ie;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(E,{}),t[38]=ie):ie=t[38];let V;t[39]!==r.resetZoom||t[40]!==p?(V=(0,$.jsx)(w,{variant:`ghost`,size:`icon-xs`,type:`button`,onClick:r.resetZoom,"aria-label":`Reset zoom`,disabled:p,children:ie}),t[39]=r.resetZoom,t[40]=p,t[41]=V):V=t[41];let H;t[42]!==L||t[43]!==R||t[44]!==B||t[45]!==V?(H=(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[L,R,B,V]}),t[42]=L,t[43]=R,t[44]=B,t[45]=V,t[46]=H):H=t[46];let ae;t[47]!==p||t[48]!==H?(ae=(0,$.jsxs)(N,{closeOnClick:!1,onClick:Ot,className:`justify-between`,disabled:p,children:[F,H]}),t[47]=p,t[48]=H,t[49]=ae):ae=t[49];let oe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(j,{}),t[50]=oe):oe=t[50];let U;t[51]===l?U=t[52]:(U=l?(0,$.jsx)(b,{className:`max-w-64`,children:(0,$.jsxs)(`span`,{className:`block truncate`,children:[`Profile: `,l]})}):null,t[51]=l,t[52]=U);let W;t[53]===r.clearCookies?W=t[54]:(W=(0,$.jsx)(N,{onClick:r.clearCookies,children:`Clear cookies`}),t[53]=r.clearCookies,t[54]=W);let se;t[55]===r.clearCache?se=t[56]:(se=(0,$.jsx)(N,{onClick:r.clearCache,children:`Clear cache`}),t[55]=r.clearCache,t[56]=se);let ce;t[57]!==U||t[58]!==W||t[59]!==se?(ce=(0,$.jsxs)(i,{children:[U,W,se]}),t[57]=U,t[58]=W,t[59]=se,t[60]=ce):ce=t[60];let G;return t[61]!==M||t[62]!==ae||t[63]!==ce||t[64]!==_||t[65]!==v||t[66]!==x||t[67]!==D?(G=(0,$.jsxs)(g,{children:[m,(0,$.jsxs)(te,{align:`end`,sideOffset:6,children:[_,v,x,D,M,re,ae,oe,ce]})]}),t[61]=M,t[62]=ae,t[63]=ce,t[64]=_,t[65]=v,t[66]=x,t[67]=D,t[68]=G):G=t[68],G}function Ot(e){return e.preventDefault()}function kt(e){return(0,$.jsx)(v,{value:e.value,children:e.label},e.value)}function At(e){return l[e]||(e.length>0?e:`Network error`)}function jt(e){let t=(0,Q.c)(21),{url:n,fileName:r,downloadUrl:i,onOpen:a}=e,o;t[0]===n?o=t[1]:(o=Ft(n)??n,t[0]=n,t[1]=o);let s=o,c,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(Pt,{className:`mb-6 size-12 text-muted-foreground/70`}),l=(0,$.jsx)(`h1`,{className:`mb-3 text-2xl font-semibold leading-tight text-foreground`,children:`This file can’t be shown here`}),t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u;t[4]===r?u=t[5]:(u=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:r}),t[4]=r,t[5]=u);let d;t[6]!==s||t[7]!==u?(d=(0,$.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[u,` from `,s,` was downloaded instead.`]}),t[6]=s,t[7]=u,t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`div`,{className:`flex-1`}),t[9]=f):f=t[9];let p;t[10]===a?p=t[11]:(p=(0,$.jsx)(w,{type:`button`,variant:`outline`,size:`sm`,onClick:a,children:`Open in browser`}),t[10]=a,t[11]=p);let m;t[12]!==i||t[13]!==r?(m=i?(0,$.jsx)(w,{type:`button`,size:`sm`,render:(0,$.jsx)(`a`,{href:i,download:r}),children:`Download`}):null,t[12]=i,t[13]=r,t[14]=m):m=t[14];let h;t[15]!==p||t[16]!==m?(h=(0,$.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 pt-8`,children:[f,p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17];let g;return t[18]!==d||t[19]!==h?(g=(0,$.jsx)(`div`,{className:`scrollbar-gutter-both relative flex h-full min-h-0 w-full overflow-y-auto bg-background`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-1 flex-col px-8 py-12 sm:py-16`,children:[c,l,d,h]})}),t[18]=d,t[19]=h,t[20]=g):g=t[20],g}function Mt(e){let t=(0,Q.c)(44),{url:n,code:r,description:i,onReload:a,move:o}=e,[s,c]=(0,Z.useState)(!1),l;t[0]===n?l=t[1]:(l=Ft(n)??n,t[0]=n,t[1]=l);let u=l,d;t[2]===i?d=t[3]:(d=At(i),t[2]=i,t[3]=d);let f=d,p;t[4]!==r||t[5]!==i?(p=i.length>0?i:`ERR_${Math.abs(r)||`FAILED`}`,t[4]=r,t[5]=i,t[6]=p):p=t[6];let m=p,h,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(Pt,{className:`mb-6 size-12 text-muted-foreground/70`}),g=(0,$.jsx)(`h1`,{className:`mb-3 text-2xl font-semibold leading-tight text-foreground`,children:`This site can’t be reached`}),t[7]=h,t[8]=g):(h=t[7],g=t[8]);let _;t[9]===u?_=t[10]:(_=(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:u}),t[9]=u,t[10]=_);let v;t[11]!==f||t[12]!==_?(v=(0,$.jsxs)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:[_,`: `,f,`.`]}),t[11]=f,t[12]=_,t[13]=v):v=t[13];let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(`p`,{className:`mb-2 font-medium text-foreground`,children:`Try:`}),t[14]=y):y=t[14];let b,x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`li`,{children:`Checking your connection`}),b=(0,$.jsx)(`li`,{children:`Confirming the dev server is running`}),t[15]=b,t[16]=x):(b=t[15],x=t[16]);let S;t[17]===o?S=t[18]:(S=o?(0,$.jsx)(`li`,{children:`Opening it in the environment’s browser, which reaches its network`}):null,t[17]=o,t[18]=S);let C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(`li`,{children:`Checking the proxy and the firewall`}),t[19]=C):C=t[19];let T;t[20]===S?T=t[21]:(T=(0,$.jsx)(Qe,{children:(0,$.jsxs)(`div`,{className:`mt-6 rounded-lg border border-border bg-muted/40 p-4 text-sm`,children:[y,(0,$.jsxs)(`ul`,{className:`list-disc space-y-1 pl-5 text-muted-foreground`,children:[x,b,S,C]})]})}),t[20]=S,t[21]=T);let E;t[22]!==s||t[23]!==T?(E=(0,$.jsx)(J,{open:s,children:T}),t[22]=s,t[23]=T,t[24]=E):E=t[24];let D;t[25]===m?D=t[26]:(D=(0,$.jsx)(`div`,{className:`mt-8 text-xs uppercase tracking-wide text-muted-foreground/70`,children:m}),t[25]=m,t[26]=D);let O;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>c(Nt),t[27]=O):O=t[27];let ee=s?`Hide details`:`Details`,k;t[28]===ee?k=t[29]:(k=(0,$.jsx)(w,{type:`button`,variant:`outline`,size:`sm`,onClick:O,children:ee}),t[28]=ee,t[29]=k);let te;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(`div`,{className:`flex-1`}),t[30]=te):te=t[30];let A;t[31]===o?A=t[32]:(A=o?(0,$.jsx)(w,{type:`button`,variant:`outline`,size:`sm`,onClick:o.onMove,children:o.label}):null,t[31]=o,t[32]=A);let j;t[33]===a?j=t[34]:(j=(0,$.jsx)(w,{type:`button`,size:`sm`,onClick:a,children:`Reload`}),t[33]=a,t[34]=j);let M;t[35]!==k||t[36]!==A||t[37]!==j?(M=(0,$.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 pt-8`,children:[k,te,A,j]}),t[35]=k,t[36]=A,t[37]=j,t[38]=M):M=t[38];let N;return t[39]!==E||t[40]!==D||t[41]!==M||t[42]!==v?(N=(0,$.jsx)(`div`,{className:`scrollbar-gutter-both relative flex h-full min-h-0 w-full overflow-y-auto bg-background`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-1 flex-col px-8 py-12 sm:py-16`,children:[h,g,v,E,D,M]})}),t[39]=E,t[40]=D,t[41]=M,t[42]=v,t[43]=N):N=t[43],N}function Nt(e){return!e}function Pt(e){let t=(0,Q.c)(5),{className:n}=e,r,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`path`,{d:`M16 12 L48 12 L48 52 L16 52 Z`}),i=(0,$.jsx)(`path`,{d:`M22 22 L42 22 M22 30 L36 30 M22 38 L40 38`,strokeLinecap:`round`}),a=(0,$.jsx)(`path`,{d:`M52 8 L12 56`,strokeLinecap:`round`}),t[0]=r,t[1]=i,t[2]=a):(r=t[0],i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,$.jsxs)(`svg`,{viewBox:`0 0 64 64`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,className:n,children:[r,i,a]}),t[3]=n,t[4]=o),o}function Ft(e){try{return new URL(e).host}catch{return null}}var It=1500,Lt=.001;function Rt(e){let t=(0,Q.c)(11),{zoomFactor:n}=e,[r,i]=(0,Z.useState)(!1),a=(0,Z.useRef)(n),o=(0,Z.useRef)(null),s,c;t[0]===n?(s=t[1],c=t[2]):(s=()=>{if(!(Math.abs(a.current-n)<Lt))return a.current=n,i(!0),o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{i(!1),o.current=null},It),()=>{o.current!==null&&(window.clearTimeout(o.current),o.current=null)}},c=[n],t[0]=n,t[1]=s,t[2]=c),(0,Z.useEffect)(s,c);let l;t[3]===n?l=t[4]:(l=Math.round(n*100),t[3]=n,t[4]=l);let u=`${l}%`,d=!r,f=r?`opacity-100 translate-y-0`:`opacity-0 -translate-y-1`,p;t[5]===f?p=t[6]:(p=M(`pointer-events-none absolute top-3 right-3 z-20 select-none rounded-full border border-border/70 bg-popover/95 px-2.5 py-1 text-xs font-medium text-foreground shadow-md/10 backdrop-blur transition-all duration-200 ease-out`,f),t[5]=f,t[6]=p);let m;return t[7]!==u||t[8]!==d||t[9]!==p?(m=(0,$.jsx)(`div`,{"aria-hidden":d,className:p,children:u}),t[7]=u,t[8]=d,t[9]=p,t[10]=m):m=t[10],m}function zt(e,t){return e.find(e=>e.id===t)?.name??`Removed profile`}var Bt=typeof window>`u`?null:W();function Vt(e){let t=(0,Q.c)(12),n=dt(e.threadRef.environmentId),r;t[0]!==n||t[1]!==e.download.id||t[2]!==e.tabId||t[3]!==e.threadRef.threadId?(r=n?it({access:n,threadId:e.threadRef.threadId,tabId:e.tabId},e.download.id):null,t[0]=n,t[1]=e.download.id,t[2]=e.tabId,t[3]=e.threadRef.threadId,t[4]=r):r=t[4];let i;t[5]===e.url?i=t[6]:(i=()=>void Bt?.shell.openExternal(e.url).catch(Ht),t[5]=e.url,t[6]=i);let a;return t[7]!==e.download.fileName||t[8]!==e.url||t[9]!==r||t[10]!==i?(a=(0,$.jsx)(jt,{url:e.url,fileName:e.download.fileName,downloadUrl:r,onOpen:i}),t[7]=e.download.fileName,t[8]=e.url,t[9]=r,t[10]=i,t[11]=a):a=t[11],a}function Ht(){}function Ut({threadRef:e,tabId:t,configuredUrls:n,visible:r,onSendAnnotation:i}){let[a,s]=(0,Z.useState)(void 0),[c,l]=(0,Z.useState)(!1),p=ce(e.environmentId,`orchestration:operate`)&&!!i,h=We(),g=(0,Z.useRef)(null),v=(0,Z.useRef)(!0),y=(0,Z.useRef)(e);y.current=e;let b=f(e),x=we(e,50),S=o(e=>e.addPreviewAnnotation),C=o(e=>e.addImage),T=ae(e.environmentId),E=T?new URL(T).hostname:null,D=le(Fe.open),O=le(Fe.close,`preview close`),ee=oe(e.environmentId)?.label??`the environment`,k=U(),te=ie(e.environmentId),A=le(Fe.resize,`preview viewport resize`),j=le(Fe.adjust,`preview appearance or zoom`);st(e),(0,Z.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]);let N=t??b.activeTabId,P=N?qe(e,b.serverEpoch,N):null,ne=N&&P?h.has(P)?P:Ue(e,N):null,F=N?b.sessions[N]??null:null,R=Ce(e.environmentId,F),W=F?.runtime===`server`&&!R,K=F?.runtime===`server`,q=(0,Z.useRef)(null),[fe,ge]=(0,Z.useState)(!1),_e=(0,Z.useRef)(null),[ve,ye]=(0,Z.useState)(0),be=F?.runtime===`server`&&(F.viewport??I)._tag!==`fill`;(0,Z.useEffect)(()=>{let e=_e.current;if(e&&be)return Se(e,([e])=>ye(Math.max(1,Math.round(e?.contentRect.width??0))))},[be]);let[xe,je]=(0,Z.useState)(null),Ne=W&&xe!==P,[Be,Ve]=(0,Z.useState)(null),J=N&&!W?b.desktopByTabId[N]??null:null,Y=F?.navStatus??{_tag:`Idle`},Qe=Y._tag===`Idle`?``:Y.url,$e=J?.loading??Y._tag===`Loading`,tt=J?.canGoBack??F?.canGoBack??!1,it=J?.canGoForward??F?.canGoForward??!1,dt=Y._tag===`Idle`,Q=Y._tag===`LoadFailed`,ft=ct(F),mt=W&&!ft&&!Q&&Be!==P,gt=J?.controller??`none`,_t=F?.viewport??I,vt=Ee(),yt=F?.profileId??`default`,bt=zt(vt.profiles,yt),xt=Je(e=>P?e.byTabId[P]?.rect??null:null),St=Y._tag===`Success`?Y.url:null,wt=Y._tag===`Success`?Y.title:null,Tt=x[0]?.url,Et=_(e);(0,Z.useEffect)(()=>{St&&wt&&Tt&&De(y.current,St,wt,E)},[E,Tt,wt,St,Et]);let Ot=(0,Z.useCallback)(async t=>{if(W&&q.current)return!Ne&&(q.current.navigate(t),u(e,t),!0);if(P&&X)return await X.navigate(P,t),u(e,t),!0;let n=await Xe({openPreview:D,threadRef:e,url:t});if(n._tag===`Failure`&&!B(n)){let e=z(n);e instanceof Pe&&H.add({type:`error`,title:`Unable to open browser`,description:e.message})}return n._tag===`Success`},[W,D,P,Ne,e]),kt=(0,Z.useCallback)(async t=>{try{let n=Ie(t,ze(se()));await Ot(n)&&Oe(e,n)}catch(e){H.add({type:`error`,title:`Could not open this address`,description:Re(e)?`Enter an http or https URL.`:e instanceof Error?e.message:`An error occurred.`})}},[Ot,e]),At=(0,Z.useCallback)(async t=>{try{let n=W||!X?Le(t):ke(e.environmentId,t);await Ot(n)&&Oe(e,t)}catch(e){H.add({type:`error`,title:`Could not open this address`,description:Re(e)?`Enter an http or https URL.`:e instanceof Error?e.message:`An error occurred.`})}},[W,Ot,e]),jt=(0,Z.useCallback)(()=>{W?q.current?.reload():X&&P&&X.refresh(P)},[W,P]),Nt=(0,Z.useCallback)(async t=>{if(!N)return;let n=await j({environmentId:e.environmentId,input:{threadId:e.threadId,tabId:N,...t}});if(n._tag===`Failure`){let e=z(n);H.add({type:`error`,title:`Unable to change the browser tab`,description:e instanceof Error?e.message:`An error occurred.`})}else re(e,n.value)},[j,N,e]),Pt=F?.zoomFactor??1,Ft=(0,Z.useCallback)(e=>{let t=L.indexOf(Pt),n=e===0?1:L[Math.min(Math.max((t<0?7:t)+e,0),L.length-1)];n!==Pt&&Nt({zoomFactor:n})},[Nt,Pt]),It=(0,Z.useCallback)(()=>{K?Ft(1):X&&P&&X.zoomIn(P)},[P,K,Ft]),Lt=(0,Z.useCallback)(()=>{K?Ft(-1):X&&P&&X.zoomOut(P)},[P,K,Ft]),Ht=(0,Z.useCallback)(()=>{K?Ft(0):X&&P&&X.resetZoom(P)},[P,K,Ft]),Ut=(0,Z.useCallback)(async t=>{if(!N)return;let n=await A({environmentId:e.environmentId,input:{threadId:e.threadId,tabId:N,viewport:t}});if(n._tag===`Failure`){let e=z(n);throw H.add({type:`error`,title:`Unable to resize browser viewport`,description:e instanceof Error?e.message:`An error occurred.`}),e}re(e,n.value)},[A,N,e]),Wt=()=>{P&&(_t._tag===`fill`?Ze(P,Me({defaults:vt,panelRect:xt,zoomFactor:K?Pt:J?.zoomFactor})).catch(()=>void 0):Ze(P,I).catch(()=>void 0))};(0,Z.useEffect)(()=>{if(P)return et(P,Ut)},[Ut,P]);let Gt=(0,Z.useCallback)(()=>{W?q.current?.history(-1):X&&P&&X.goBack(P)},[W,P]),Kt=(0,Z.useCallback)(()=>{W?q.current?.history(1):X&&P&&X.goForward(P)},[W,P]),qt=(0,Z.useCallback)(()=>{Bt&&Qe&&Bt.shell.openExternal(Qe).catch(()=>void 0)},[Qe]),Jt=Te(e.environmentId,k,te,F),Yt=Jt===`server`?`Open in ${ee}'s browser`:`Open on this computer`,Xt=(0,Z.useCallback)(async()=>{if(!Jt||!N||!F)return;let t=await Xe({openPreview:D,threadRef:e,...Qe?{url:Jt===`desktop`?ke(e.environmentId,Qe):Qe}:{},viewport:_t,...F.profileId===void 0?{}:{profileId:F.profileId},runtime:Jt});if(t._tag===`Failure`){if(B(t))return;let e=z(t);H.add({type:`error`,title:`Unable to move the browser tab`,description:e instanceof Error?e.message:`An error occurred.`})}else ue.getState().openBrowser(e,t.value.tabId),await rt({closePreview:O,snapshot:F,tabId:N,threadRef:e})},[O,Jt,D,F,N,e,Qe,_t]),Zt=e=>()=>{e&&P&&e(P).catch(()=>void 0)},Qt=K?{hardReload:()=>void Nt({hardReload:!0}),setColorScheme:e=>void Nt({colorScheme:e}),zoomIn:It,zoomOut:Lt,resetZoom:Ht,clearCookies:()=>void Nt({clear:`cookies`}),clearCache:()=>void Nt({clear:`cache`}),...R&&X?{openDevTools:Zt(X.openDevTools)}:{}}:X?{hardReload:Zt(X.hardReload),setColorScheme:e=>{P&&X?.setColorScheme(P,e).catch(()=>void 0)},zoomIn:It,zoomOut:Lt,resetZoom:Ht,clearCookies:()=>void X?.clearCookies(e.environmentId,yt).catch(()=>void 0),clearCache:()=>void X?.clearCache(e.environmentId,yt).catch(()=>void 0),openDevTools:Zt(X.openDevTools)}:null,$t=(0,Z.useCallback)(()=>{X&&P&&(J?.pictureInPicture?X.pictureInPicture.close:X.pictureInPicture.open)(P).catch(e=>{H.add({type:`error`,title:`Unable to update popped-out preview`,description:e instanceof Error?e.message:`An error occurred.`})})},[J?.pictureInPicture,P]),en=(0,Z.useCallback)(t=>{if(!X||!P||!N)return;let n=X;ne?He(ne).then(e=>{if(!e)return;let t=!1,r,i=()=>{navigator.clipboard?.writeText?navigator.clipboard.writeText(e.path).then(()=>{t=!0,o(),window.setTimeout(()=>{t=!1,o()},2e3)},e=>{H.update(r,de({type:`error`,title:`Unable to copy recording path`,description:e instanceof Error?e.message:`An error occurred.`,actionProps:a}))}):H.update(r,de({type:`error`,title:`Unable to copy recording path`,description:`Clipboard API unavailable.`,actionProps:a}))},a={children:V(navigator.platform),onClick:()=>void n.revealArtifact(e.path)},o=()=>{H.update(r,de({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:t?`Copied!`:`Copy path`,disabled:t,onClick:i}}}))};r=H.add(de({type:`success`,title:`Recording saved`,actionProps:a,data:{secondaryActionProps:{children:`Copy path`,onClick:i}}}))},e=>{H.add({type:`error`,title:`Unable to stop recording`,description:e instanceof Error?e.message:`An error occurred.`})}):t?Ke(P,e,N).catch(e=>{let t=e instanceof Error?e.message:`An error occurred.`;Ge(e)||H.add({type:`error`,title:`Unable to start recording`,description:t})}):n.captureScreenshot(P).then(e=>{let t={children:V(navigator.platform),onClick:()=>void n.revealArtifact(e.path)},r=!1,i=!1,a,o=(e=`success`,n=`Screenshot saved`,o)=>{H.update(a,de({type:e,title:n,description:o,actionProps:{children:i?`Copied!`:`Copy image`,disabled:i,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:r?`Copied!`:`Copy path`,disabled:r,onClick:s}}],secondaryActionProps:{...t}}}))},s=()=>{navigator.clipboard?.writeText?navigator.clipboard.writeText(e.path).then(()=>{r=!0,o(),window.setTimeout(()=>{r=!1,o()},2e3)},e=>{o(`error`,`Unable to copy screenshot path`,e instanceof Error?e.message:`An error occurred.`)}):o(`error`,`Unable to copy screenshot path`,`Clipboard API unavailable.`)},c=()=>{n.copyArtifactToClipboard(e.path).then(()=>{i=!0,o(),window.setTimeout(()=>{i=!1,o()},2e3)},e=>{o(`error`,`Unable to copy screenshot`,e instanceof Error?e.message:`An error occurred.`)})};a=H.add(de({type:`success`,title:`Screenshot saved`,actionProps:{children:`Copy image`,onClick:c},data:{additionalActions:[{id:`copy-path`,props:{children:`Copy path`,onClick:s}}],secondaryActionProps:{...t}}}))},e=>{H.add({type:`error`,title:`Unable to capture screenshot`,description:e instanceof Error?e.message:`An error occurred.`})})},[ne,P,N,e]),tn=(0,Z.useCallback)(()=>{if(!X||!P)return;if(g.current){g.current.cancelled=!0,X.cancelPickElement(P).catch(()=>void 0);return}let t=typeof document<`u`?document.activeElement:null,n={cancelled:!1},r=!1;g.current=n,l(!0),(async()=>{try{if(await X.setAnnotationSendEnabled?.(P,!!i&&G(e.environmentId,`orchestration:operate`)),n.cancelled)return;let t=await X.pickElement(P);if(!t||n.cancelled)return;g.current===n&&(g.current=null,v.current&&l(!1),r=!0);let{annotation:a,submission:o,screenshotFailed:s=!1}=t,c=pt(a),u=s||c.status===`failed`,d=c.status===`failed`?{...a,screenshot:null}:a;S(e,d),u&&H.add(de({type:`error`,title:`Could not capture the picked element`,description:`The annotation was kept without the screenshot.`}));let f=c.status===`captured`?c.file:null,p=f&&d.screenshot?{type:`image`,id:d.id,name:f.name,mimeType:f.type,sizeBytes:f.size,previewUrl:d.screenshot.dataUrl,file:f}:null;p&&C(e,p),o===`send`&&G(e.environmentId,`orchestration:operate`)&&i?.(d,p)}catch{}finally{let e=g.current===n;if(e&&(g.current=null,v.current&&l(!1)),(e||r)&&t&&t.isConnected&&typeof t.focus==`function`)try{t.focus({preventScroll:!0})}catch{}}})()},[C,S,i,P,e]);return(0,Z.useEffect)(()=>{c&&X&&P&&X.setAnnotationSendEnabled?.(P,p).catch(()=>void 0)},[p,c,P]),(0,Z.useEffect)(()=>()=>{g.current&&(g.current.cancelled=!0,g.current=null,X&&P&&X.cancelPickElement(P).catch(()=>void 0),v.current&&l(!1))},[P]),(0,Z.useEffect)(()=>{if(!r)return;let e=ot(e=>{switch(e){case`refresh`:jt();return;case`focus-url`:s(e=>(e??0)+1);return;case`zoom-in`:It();return;case`zoom-out`:Lt();return;case`reset-zoom`:Ht();return;case`toggle-panel`:return}}),t=window.desktopBridge?.onMenuAction(e=>{e===`preview.focusUrl`&&s(e=>(e??0)+1)});return()=>{e(),t?.()}},[jt,Ht,It,Lt,r]),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,"data-thread-key":_(e),children:[(0,$.jsx)(ht,{url:Qe,loading:$e||mt,canGoBack:tt&&!Ne,canGoForward:it&&!Ne,refreshDisabled:dt||Ne,inputDisabled:Ne,focusUrlNonce:a,onBack:Gt,onForward:Kt,onRefresh:jt,onSubmit:e=>void kt(e),onOpenInBrowser:N?qt:void 0,onCapture:X&&N&&!W?en:void 0,captureDisabled:!J||Q||J.pictureInPicture,recording:ne!==null,onSeparateWindow:X&&N&&(!K||R)?$t:void 0,separateWindow:J?.pictureInPicture??!1,separateWindowDisabled:P===null||!K&&!(J?.hasWebContents??!1),onPickElement:X&&N&&!W?tn:void 0,pickActive:c,pickDisabled:!N||Q,pickDisabledReason:Q?`Page didn't load — pick unavailable until the page renders`:void 0,leadingActions:yt===vt.profileId?null:(0,$.jsxs)(he,{children:[yt===`incognito`?(0,$.jsx)(pe,{render:(0,$.jsx)(`span`,{role:`img`,"aria-label":bt,className:`flex shrink-0 text-muted-foreground`}),children:(0,$.jsx)(d,{className:`size-4`})}):(0,$.jsx)(pe,{render:(0,$.jsx)(m,{variant:`outline`,className:`max-w-28 shrink-0`}),children:(0,$.jsx)(`span`,{className:`truncate`,children:bt})}),(0,$.jsx)(me,{side:`top`,children:bt})]}),trailingActions:Qt?(0,$.jsx)(Dt,{enabled:P!==null&&(K||(J?.hasWebContents??!1)),actions:Qt,...Jt?{move:{label:Yt,onMove:()=>void Xt()}}:{},profileName:bt,zoomFactor:K?Pt:J?.zoomFactor??1,colorScheme:K?F?.colorScheme??`system`:J?.colorScheme??`system`,deviceToolbarVisible:_t._tag!==`fill`,onToggleDeviceToolbar:Wt}):null}),(0,$.jsxs)(`div`,{ref:_e,className:`relative min-h-0 flex-1 overflow-hidden`,children:[P&&F&&W?(0,$.jsxs)($.Fragment,{children:[_t._tag!==`fill`&&!ft&&!Q?(0,$.jsx)(`div`,{className:`absolute inset-x-0 top-0 z-10`,children:(0,$.jsx)(Ye,{setting:_t,width:ve,aspectRatio:fe?_t.width/_t.height:null,onAspectRatioChange:e=>ge(e!==null),onChange:e=>Ze(P,e)})}):null,(0,$.jsx)(`div`,{className:`absolute inset-x-0 bottom-0`,style:{top:_t._tag===`fill`?0:38},children:(0,$.jsx)(lt,{ref:q,environmentId:e.environmentId,threadId:e.threadId,tabId:F.tabId,visible:r,onFirstFrame:()=>Ve(P),onControl:e=>je(e?.controller===`you`?P:null),onPopup:t=>ut(e,t,`panel`),className:M(`absolute inset-0 h-full w-full`,(ft||Q)&&`invisible`)},P)})]}):P&&F&&!ft?X&&J?.pictureInPicture?(0,$.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,$.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:`Showing in a separate window.`}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(w,{size:`sm`,variant:`outline`,onClick:$t,children:`Bring back`}),(0,$.jsx)(w,{size:`sm`,variant:`ghost`,onClick:()=>void X?.pictureInPicture.open(P),children:`Show window`})]})]}):X?(0,$.jsx)(nt,{tabId:P,visible:r&&!Q,className:`absolute inset-0 h-full w-full`},P):(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center p-8 text-center`,children:(0,$.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:`This tab is open in the P4 Code desktop app.`})}):null,ft?(0,$.jsx)(Ct,{threadRef:e,environmentId:e.environmentId,configuredUrls:n,recentEntries:x,onRemoveRecent:t=>Ae(e,t),onOpenUrl:e=>void At(e)}):null,F&&J?(0,$.jsx)(Rt,{zoomFactor:J.zoomFactor}):null,P&&J&&!ft&&!Q&&!h.has(P)?(0,$.jsx)(at,{tabId:P,zoomFactor:J.zoomFactor,controller:gt}):null,Y._tag===`LoadFailed`&&Y.download?(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,$.jsx)(Vt,{threadRef:e,tabId:F?.tabId??``,url:Y.url,download:Y.download})}):Y._tag===`LoadFailed`?(0,$.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,$.jsx)(Mt,{url:Y.url,code:Y.code,description:Y.description,onReload:jt,...Jt===`server`?{move:{label:Yt,onMove:()=>void Xt()}}:{}})}):null]})]})}function Wt(e){let t=(0,Q.c)(18),{mode:n,threadRef:r,tabId:i,configuredUrls:a,visible:o,onSendAnnotation:s}=e,c=Ne(r.environmentId),l=ce(r.environmentId,R);if(!l||!c){let e=l?`Preview is only available in the P4 Code desktop app.`:`Pair this client again with preview access to control browser previews.`,r;t[0]===e?r=t[1]:(r=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-8 text-center`,children:(0,$.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:e})}),t[0]=e,t[1]=r);let i;return t[2]!==n||t[3]!==r?(i=(0,$.jsx)(q,{mode:n,children:r}),t[2]=n,t[3]=r,t[4]=i):i=t[4],i}let u;t[5]===i?u=t[6]:(u=i===void 0?{}:{tabId:i},t[5]=i,t[6]=u);let d;t[7]===s?d=t[8]:(d=s?{onSendAnnotation:s}:{},t[7]=s,t[8]=d);let f;t[9]!==a||t[10]!==u||t[11]!==d||t[12]!==r||t[13]!==o?(f=(0,$.jsx)(Ut,{threadRef:r,...u,configuredUrls:a,visible:o,...d}),t[9]=a,t[10]=u,t[11]=d,t[12]=r,t[13]=o,t[14]=f):f=t[14];let p;return t[15]!==n||t[16]!==f?(p=(0,$.jsx)(q,{mode:n,children:f}),t[15]=n,t[16]=f,t[17]=p):p=t[17],p}export{Wt as PreviewPanel};
2
- //# sourceMappingURL=PreviewPanel-DIVx5x1H.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$t as i,Eo as a,Jo as o,Ju as s,Kt as c,Ol as l,Sf as u,Us as d,Va as f,Vs as p,Vt as m,Xn as h,_n as g,ai as _,hr as v,ii as y,jl as b,kf as x,mn as S,mr as ee,ol as C,op as w,qt as T,sp as E,t as D,vn as O,xr as k,zt as A}from"./utils-BVnIIHXP.js";import{yi as j}from"./src-DHn7yNZx.js";import{f as M}from"./useRender-BP5vR6yH.js";import{t as N}from"./CompositeRoot-RcqGhRAf.js";import{t as P}from"./useNavigate-P1p3Es15.js";import{_ as F,d as I}from"./useSettings-Dp27sUML.js";import{f as L,s as R}from"./server-Bw1ZPPkk.js";import{t as te}from"./use-atom-command-DkmE-pw9.js";import{a as z,n as B,r as ne,t as V}from"./tooltip-BhCWnsdW.js";import{a as re,n as H,r as U,s as ie,t as ae}from"./combobox-B0IMIA-1.js";import{n as oe}from"./scroll-area-DhDCLqyU.js";import{i as se,o as ce,t as le}from"./popover-DnYfrQly.js";import{t as ue}from"./AnimatedHeight-B2j_NXft.js";import{_ as de,h as fe,m as pe,y as me}from"./keybindings-CrlWqd5q.js";import{S as W}from"./Icons-DpgbzNj8.js";import{i as G,n as K,r as he,t as q}from"./alert-CfhQnxcL.js";import{t as J}from"./semver-BoU8Be_3.js";import{S as Y,n as ge,t as _e}from"./ChatGptUsageButton-_JZfpkEi.js";import{t as ve}from"./kbd-R7rkirqT.js";import{En as ye,Na as be,Tn as X,Uo as Z,jn as xe,mi as Se}from"./main-43D2LVmx.js";var Q=e(t(),1),Ce=n(),$=e(r(),1);function we(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Te(e,t){let n=t?.trim();if(!n)return e;let r=RegExp(`^${we(n)}(?:\\s*[.:/-]\\s*|\\s+)`,`iu`);return e.replace(r,``).trim()||e}function Ee(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return p(Te(n,e.subProvider))}function De(e,t){let n=e.trim(),r=t?.trim();return r?n&&RegExp(`^${we(n)}\\s+\\S`,`i`).test(r)?r:`${e} · ${r}`:e}function Oe(e){return Ee(e,{preferShortName:!0})}function ke(e){return Oe(e)}var Ae={claudeAgent:`Claude Code`,codex:`the Codex CLI`};function je(e){return e.length<=2?e.join(` and `):`${e.slice(0,-1).join(`, `)}, and ${e[e.length-1]}`}function Me(e,t=``){let n=t.trim().toLocaleLowerCase(),r=(e.updateRequiredModels??[]).filter(e=>n.length===0||e.name.toLocaleLowerCase().includes(n)||e.slug.toLocaleLowerCase().includes(n));if(r.length===0)return null;let i=r.map(e=>e.minVersion).reduce((e,t)=>J(t,e)>0?t:e);return`Update ${Ae[e.driver]??j[e.driver]??e.driver} to ${i.startsWith(`v`)?i:`v${i}`} or newer to use ${je(r.map(e=>e.name))}.`}var Ne=`model:`,Pe=`legacy-models:`;function Fe(e,t){return`${Ne}${e.length}:${e}${t}`}function Ie(e){if(!e.startsWith(Ne))return null;let t=e.slice(6),n=t.indexOf(`:`);if(n===-1)return null;let r=t.slice(0,n);if(!/^\d+$/.test(r))return null;let i=Number(r),a=t.slice(n+1);return!Number.isSafeInteger(i)||i>a.length?null:{instanceId:a.slice(0,i),slug:a.slice(i)}}function Le(e){return`${Pe}${e}`}function Re(e){return e.startsWith(Pe)?e.slice(14):null}var ze=(0,Q.memo)(function(e){let t=(0,Ce.c)(71),n;t[0]!==e.model.subProvider||t[1]!==e.providerDisplayName?(n=De(e.providerDisplayName,e.model.subProvider),t[0]=e.model.subProvider,t[1]=e.providerDisplayName,t[2]=n):n=t[2];let r=n,i=e.index,a;t[3]!==e.instanceId||t[4]!==e.model.slug?(a=Fe(e.instanceId,e.model.slug),t[3]=e.instanceId,t[4]=e.model.slug,t[5]=a):a=t[5];let o=!!e.disabledReason,s=e.disabledReason&&`data-disabled:pointer-events-auto data-disabled:cursor-not-allowed`,c;t[6]===s?c=t[7]:(c=D(`group relative w-full !min-w-0 max-w-full cursor-pointer`,s),t[6]=s,t[7]=c);let u;t[8]!==e.model||t[9]!==e.preferShortName||t[10]!==e.useTriggerLabel?(u=e.useTriggerLabel?ke(e.model):Ee(e.model,e.preferShortName?{preferShortName:!0}:void 0),t[8]=e.model,t[9]=e.preferShortName,t[10]=e.useTriggerLabel,t[11]=u):u=t[11];let d;t[12]===u?d=t[13]:(d=(0,$.jsx)(`div`,{className:`min-w-0 truncate text-xs font-medium leading-snug`,children:u}),t[12]=u,t[13]=d);let f;t[14]===e.showNewBadge?f=t[15]:(f=e.showNewBadge?(0,$.jsx)(`span`,{className:`shrink-0 rounded border border-update/35 bg-update/15 px-0.5 py-px text-3xs font-bold uppercase leading-none tracking-wide text-update-foreground`,"aria-label":`New model`,children:`New`}):null,t[14]=e.showNewBadge,t[15]=f);let p;t[16]===e.unavailable?p=t[17]:(p=e.unavailable?(0,$.jsx)(h,{variant:`outline`,size:`sm`,children:`Unavailable`}):null,t[16]=e.unavailable,t[17]=p);let m;t[18]!==d||t[19]!==f||t[20]!==p?(m=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[d,f,p]}),t[18]=d,t[19]=f,t[20]=p,t[21]=m):m=t[21];let g;t[22]!==e.acpRegistryAgentId||t[23]!==e.acpRegistryIconUrl||t[24]!==e.driverKind||t[25]!==e.providerDisplayName||t[26]!==e.showProvider||t[27]!==r?(g=e.showProvider&&(0,$.jsxs)(`div`,{className:`mt-1 flex items-center gap-1.5`,children:[(0,$.jsx)(ge,{driverKind:e.driverKind,displayName:e.providerDisplayName,acpRegistryAgentId:e.acpRegistryAgentId,acpRegistryIconUrl:e.acpRegistryIconUrl,className:`size-3`,iconClassName:`size-3`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-normal leading-snug text-muted-foreground/70`,children:r})]}),t[22]=e.acpRegistryAgentId,t[23]=e.acpRegistryIconUrl,t[24]=e.driverKind,t[25]=e.providerDisplayName,t[26]=e.showProvider,t[27]=r,t[28]=g):g=t[28];let _;t[29]!==m||t[30]!==g?(_=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 text-left`,children:[m,g]}),t[29]=m,t[30]=g,t[31]=_):_=t[31];let v;t[32]!==e.isSelected||t[33]!==e.showSelection?(v=e.showSelection&&e.isSelected?(0,$.jsx)(l,{className:`size-3.5`,"aria-hidden":`true`}):null,t[32]=e.isSelected,t[33]=e.showSelection,t[34]=v):v=t[34];let y;t[35]===e.jumpLabel?y=t[36]:(y=e.jumpLabel?(0,$.jsx)(ve,{children:e.jumpLabel}):null,t[35]=e.jumpLabel,t[36]=y);let b;t[37]===e?b=t[38]:(b=t=>{t.stopPropagation(),e.onToggleFavorite()},t[37]=e,t[38]=b);let S=!!e.disabledReason,C=e.isFavorite?`Remove from favorites`:`Add to favorites`,w=e.isFavorite&&`fill-current text-warning`,T;t[39]===w?T=t[40]:(T=D(`size-3.5 sm:size-3`,w),t[39]=w,t[40]=T);let E;t[41]===T?E=t[42]:(E=(0,$.jsx)(x,{className:T}),t[41]=T,t[42]=E);let O;t[43]!==b||t[44]!==S||t[45]!==C||t[46]!==E?(O=(0,$.jsx)(z,{render:(0,$.jsx)(ee,{size:`icon-xs`,variant:`ghost-muted`,className:`-mr-1 shrink-0`,onClick:b,onKeyDown:Be,disabled:S,"aria-label":C,children:E})}),t[43]=b,t[44]=S,t[45]=C,t[46]=E,t[47]=O):O=t[47];let k=e.isFavorite?`Remove from favorites`:`Add to favorites`,A;t[48]===k?A=t[49]:(A=(0,$.jsx)(B,{side:`top`,align:`center`,children:k}),t[48]=k,t[49]=A);let j;t[50]!==O||t[51]!==A?(j=(0,$.jsxs)(V,{children:[O,A]}),t[50]=O,t[51]=A,t[52]=j):j=t[52];let M;t[53]!==v||t[54]!==y||t[55]!==j?(M=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[v,y,j]}),t[53]=v,t[54]=y,t[55]=j,t[56]=M):M=t[56];let N;t[57]!==e.index||t[58]!==_||t[59]!==a||t[60]!==M||t[61]!==o||t[62]!==c?(N=(0,$.jsxs)(U,{hideIndicator:!0,index:i,value:a,disabled:o,className:c,children:[_,M]}),t[57]=e.index,t[58]=_,t[59]=a,t[60]=M,t[61]=o,t[62]=c,t[63]=N):N=t[63];let P=N;if(!e.disabledReason)return P;let F;t[64]===P?F=t[65]:(F=(0,$.jsx)(z,{render:P}),t[64]=P,t[65]=F);let I;t[66]===e.disabledReason?I=t[67]:(I=(0,$.jsx)(B,{side:`left`,align:`center`,children:e.disabledReason}),t[66]=e.disabledReason,t[67]=I);let L;return t[68]!==F||t[69]!==I?(L=(0,$.jsxs)(V,{children:[F,I]}),t[68]=F,t[69]=I,t[70]=L):L=t[70],L});function Be(e){e.stopPropagation()}var Ve=Q.forwardRef(function(e,t){let{disabled:n=!1,loopFocus:r=!0,orientation:i=`horizontal`,className:a,render:o,style:s,...c}=e,[l,u]=Q.useState(()=>new Map),d=Q.useMemo(()=>{let e=[];for(let t of l.values())t?.index&&!t.focusableWhenDisabled&&e.push(t.index);return e},[l]),f=Q.useMemo(()=>({disabled:n,orientation:i,setItemMap:u}),[n,i,u]),p={disabled:n,orientation:i},m={"aria-orientation":i,role:`toolbar`};return(0,$.jsx)(y.Provider,{value:f,children:(0,$.jsx)(N,{render:o,className:a,style:s,state:p,refs:[t],props:[m,c],disabledIndices:d,loopFocus:r,onMapChange:u,orientation:i})})}),He=Q.createContext(void 0);function Ue(e){let t=Q.useContext(He);if(t===void 0&&!e)throw Error(M(68));return t}var We=Q.forwardRef(function(e,t){let{className:n,disabled:r=!1,focusableWhenDisabled:i=!0,render:a,nativeButton:o=!0,style:s,...c}=e,l=Q.useMemo(()=>({focusableWhenDisabled:i}),[i]),{disabled:u,orientation:d}=_(),p=Ue(!0),m=u||(p?.disabled??!1)||r,{getButtonProps:h,buttonRef:g}=f({disabled:m,focusableWhenDisabled:i,native:o});return(0,$.jsx)(k,{tag:`button`,render:a,className:n,style:s,metadata:l,state:{disabled:m,orientation:d,focusable:i},refs:[t,g],props:[c,{disabled:m},h]})});function Ge(e){let t=e.displayName;if(!e.enabled||e.status===`disabled`)return`${t} — Disabled in settings.`;if(e.status===`ready`&&e.isAvailable)return t;let n=e.status===`error`?`Unavailable`:e.status===`warning`?`Limited`:`Not ready`,r=e.snapshot.message?.trim();return r?`${t} — ${n}. ${r}`:`${t} — ${n}.`}var Ke=`pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary`,qe=`pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm text-update-foreground `,Je=`left`,Ye=8,Xe=(0,Q.memo)(function(e){let t=(0,Ce.c)(27),n;t[0]===e?n=t[1]:(n=t=>{e.onSelectInstance(t)},t[0]=e,t[1]=n);let r=n,a=e.showFavorites??!0,[o,s]=(0,Q.useState)(null),l=(0,Q.useRef)(null),[d,f]=(0,Q.useState)(null),p;t[2]===e.selectedInstanceId?p=t[3]:(p=()=>{let t=l.current;if(!t)return;let n=Array.from(t.querySelectorAll(`[data-model-picker-provider]`)).find(t=>t.dataset.modelPickerProvider===e.selectedInstanceId);f(n?n.offsetTop+n.offsetHeight/2-10:null)},t[2]=e.selectedInstanceId,t[3]=p);let m;t[4]!==e.instanceEntries||t[5]!==e.selectedInstanceId||t[6]!==a?(m=[e.instanceEntries,e.selectedInstanceId,a],t[4]=e.instanceEntries,t[5]=e.selectedInstanceId,t[6]=a,t[7]=m):m=t[7],(0,Q.useLayoutEffect)(p,m);let h;t[8]===e?h=t[9]:(h=t=>{t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||t.key===`ArrowRight`&&(t.preventDefault(),e.onFocusSearch())},t[8]=e,t[9]=h);let g;t[10]===d?g=t[11]:(g=d===null?null:(0,$.jsx)(`div`,{"data-model-picker-selected-indicator":`true`,className:D(Ke,`right-0 translate-y-0 transition-[top] duration-200 ease-out`),style:{top:d}}),t[10]=d,t[11]=g);let _;t[12]!==r||t[13]!==e.selectedInstanceId||t[14]!==a?(_=a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`relative w-full`,"data-model-picker-provider":`favorites`,children:(0,$.jsxs)(V,{children:[(0,$.jsx)(z,{render:(0,$.jsx)(We,{className:D(`relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-foreground/10 focus-visible:bg-foreground/10 focus-visible:outline-none`),onClick:()=>r(`favorites`),type:`button`,"aria-label":`Favorites`,"aria-pressed":e.selectedInstanceId===`favorites`,children:(0,$.jsx)(x,{className:`size-5 fill-current shrink-0`,"aria-hidden":!0})})}),(0,$.jsx)(B,{side:Je,sideOffset:Ye,align:`center`,children:`Favorites`})]})}),(0,$.jsx)(`div`,{className:`border-b border-border/70`,"aria-hidden":`true`})]}):null,t[12]=r,t[13]=e.selectedInstanceId,t[14]=a,t[15]=_):_=t[15];let v;t[16]!==r||t[17]!==o||t[18]!==e?(v=e.instanceEntries.map(t=>{let n=!c(t),a=e.disabledInstanceIds?.has(t.instanceId)??!1,l=e.selectableUnavailableInstanceIds?.has(t.instanceId)??!1,d=n&&!l||a,f=e.selectedInstanceId===t.instanceId,p=o===t.instanceId,m=e.newBadgeInstanceIds?.has(t.instanceId)??!1,h=i(t,e.instanceEntries),g=n?Ge(t):a?e.getDisabledInstanceTooltip?.(t)??t.displayName:m?`${t.displayName} — New`:t.displayName,_=(0,$.jsxs)(We,{className:D(`relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-foreground/10 focus-visible:bg-foreground/10 focus-visible:outline-none`,d&&`opacity-50 cursor-not-allowed hover:bg-transparent`),"data-provider-accent-color":t.accentColor,onClick:()=>!d&&r(t.instanceId),onMouseEnter:()=>s(t.instanceId),onMouseLeave:()=>s(e=>e===t.instanceId?null:e),onFocus:()=>s(t.instanceId),onBlur:()=>s(e=>e===t.instanceId?null:e),disabled:d,focusableWhenDisabled:!d,"aria-pressed":f,type:`button`,"aria-label":n||a?g:m?`${t.displayName}, new`:t.displayName,children:[(0,$.jsx)(ge,{driverKind:t.driverKind,displayName:t.displayName,accentColor:t.accentColor,acpRegistryAgentId:t.acpRegistryAgentId,acpRegistryIconUrl:t.acpRegistryIconUrl,showBadge:h,className:`size-6 z-30`,iconClassName:`size-5`,indicatorBackground:p&&!d?`var(--muted)`:f?`var(--background)`:`color-mix(in oklab, var(--muted) 30%, transparent)`,...t.accentColor?{badgeClassName:`h-3 min-w-3 px-0.5 text-5xs`}:{}}),m?(0,$.jsx)(`span`,{className:qe,"aria-hidden":!0,children:(0,$.jsx)(u,{className:`size-2`})}):null]}),v=d?(0,$.jsx)(`span`,{className:`relative block w-full`,children:_}):_;return(0,$.jsx)(`div`,{className:`relative w-full`,"data-model-picker-provider":t.instanceId,children:(0,$.jsxs)(V,{children:[(0,$.jsx)(z,{render:v}),(0,$.jsx)(B,{side:Je,sideOffset:Ye,align:`center`,children:g})]})},t.instanceId)}),t[16]=r,t[17]=o,t[18]=e,t[19]=v):v=t[19];let y;t[20]!==g||t[21]!==_||t[22]!==v?(y=(0,$.jsx)(`div`,{className:`h-full overflow-y-auto overscroll-contain [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:(0,$.jsxs)(`div`,{ref:l,className:`relative flex min-h-full flex-col gap-1 p-1`,children:[g,_,v]})}),t[20]=g,t[21]=_,t[22]=v,t[23]=y):y=t[23];let b;return t[24]!==h||t[25]!==y?(b=(0,$.jsx)(Ve,{className:`w-11 shrink-0 overflow-hidden bg-muted/30`,"data-model-picker-sidebar":`true`,"aria-label":`Providers`,orientation:`vertical`,onKeyDown:h,children:y}),t[24]=h,t[25]=y,t[26]=b):b=t[26],b});function Ze(e){let t=e.compatibilityAdvisory;return e.status===`error`&&e.auth.status===`unauthenticated`?null:t?.status===`broken`||e.status===`ready`&&t?.status===`unsupported`?t:null}function Qe(e){if(!e||e.status===`disabled`)return null;let t=Ze(e);return t?[e.instanceId,t.status,e.version??``,t.message??``].join(`\0`):e.status===`ready`||e.driver===`antigravity`&&e.installed&&e.status===`warning`&&e.auth.status===`unknown`?null:[e.instanceId,e.status,e.auth.status,e.message??``].join(`\0`)}function $e(e,t){let n=Qe(e);return n!==null&&n!==t}function et(e){return e.driver===`antigravity`||e.setup?.canAuthenticate===!0||e.setup?.canInstall===!0}function tt(e){if(e.auth.status!==`unauthenticated`&&e.compatibilityAdvisory?.status===`broken`&&e.compatibilityAdvisory.message)return e.compatibilityAdvisory.message;if(e.message)return e.message;let t=e.displayName?.trim()||a(e.driver);return!e.installed&&et(e)?`Open provider setup to install ${a(e.driver)} on this environment.`:e.auth.status===`unauthenticated`?et(e)?e.driver===`antigravity`?`Open provider setup to sign in with Google.`:`Open provider setup to sign in.`:`Sign in via the CLI to authenticate again.`:e.status===`ready`?`No models are available for this provider.`:e.status===`error`?`${t} provider is unavailable.`:`${t} provider has limited availability.`}var nt=(0,Q.memo)(function(e){let t=(0,Ce.c)(49),{environmentId:n,onDismiss:r,onOpenProviderSetup:i,status:c}=e,l;t[0]===n?l=t[1]:(l=L.refreshProviders.permissionAtom(n),t[0]=n,t[1]=l);let u=o(l),d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d={label:`Refresh provider status`},t[2]=d):d=t[2];let f=te(L.refreshProviders,d),p=(0,Q.useRef)(!1),[m,h]=(0,Q.useState)(!1),g;t[3]!==u||t[4]!==n||t[5]!==f||t[6]!==c?(g=async()=>{c&&u&&!p.current&&(p.current=!0,h(!0),await f({environmentId:n,input:{instanceId:c.instanceId,refreshModels:!0}}),p.current=!1,h(!1))},t[3]=u,t[4]=n,t[5]=f,t[6]=c,t[7]=g):g=t[7];let _=g;if(!c||Qe(c)===null)return null;let y;t[8]!==c.displayName||t[9]!==c.driver?(y=c.displayName?.trim()||a(c.driver),t[8]=c.displayName,t[9]=c.driver,t[10]=y):y=t[10];let b=y,x=c.status===`error`&&c.auth.status===`unauthenticated`,S;t[11]===c?S=t[12]:(S=Ze(c),t[11]=c,t[12]=S);let C=S,T=x?`${b} is unauthenticated`:C?`${b} ${c.version??``} is ${C.status===`broken`?`known to be broken`:`unsupported`}`:`${b} provider status`,E;t[13]!==C?.message||t[14]!==c?(E=C?.message??tt(c),t[13]=C?.message,t[14]=c,t[15]=E):E=t[15];let D=E,O=C?.status!==`broken`&&(c.status===`warning`||C!==null)?`warning`:`error`,k=C&&C.status!==`broken`?`status`:`alert`,A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(s,{}),t[16]=A):A=t[16];let j;t[17]===T?j=t[18]:(j=(0,$.jsx)(G,{children:T}),t[17]=T,t[18]=j);let M;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(`div`,{className:`line-clamp-3`}),t[19]=M):M=t[19];let N;t[20]===D?N=t[21]:(N=(0,$.jsxs)(V,{children:[(0,$.jsx)(z,{render:M,children:D}),(0,$.jsx)(B,{side:`top`,className:`whitespace-pre-wrap`,children:D})]}),t[20]=D,t[21]=N);let P;t[22]!==i||t[23]!==c?(P=i&&et(c)?(0,$.jsx)(v,{onClick:()=>i(c.instanceId),children:`Open provider setup`}):null,t[22]=i,t[23]=c,t[24]=P):P=t[24];let F=`Refresh ${b} provider status`,I=!u||m,R;t[25]===_?R=t[26]:(R=()=>void _(),t[25]=_,t[26]=R);let ne;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(Z,{}),t[27]=ne):ne=t[27];let re=m?`Refreshing...`:`Refresh`,H;t[28]!==F||t[29]!==I||t[30]!==R||t[31]!==re?(H=(0,$.jsxs)(ee,{"aria-label":F,disabled:I,onClick:R,size:`xs`,variant:`outline`,children:[ne,re]}),t[28]=F,t[29]=I,t[30]=R,t[31]=re,t[32]=H):H=t[32];let U;t[33]!==P||t[34]!==H?(U=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-3`,children:[P,H]}),t[33]=P,t[34]=H,t[35]=U):U=t[35];let ie;t[36]!==N||t[37]!==U?(ie=(0,$.jsx)(he,{children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[N,U]})}),t[36]=N,t[37]=U,t[38]=ie):ie=t[38];let ae=`Dismiss ${b} provider ${c.status}`,oe;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(w,{}),t[39]=oe):oe=t[39];let se;t[40]!==r||t[41]!==ae?(se=(0,$.jsx)(K,{children:(0,$.jsx)(ee,{"aria-label":ae,onClick:r,size:`icon-xs`,variant:`ghost-muted`,children:oe})}),t[40]=r,t[41]=ae,t[42]=se):se=t[42];let ce;return t[43]!==j||t[44]!==ie||t[45]!==se||t[46]!==O||t[47]!==k?(ce=(0,$.jsx)(`div`,{className:`pointer-events-auto mx-auto w-fit max-w-[calc(100%-2rem)] pt-3`,children:(0,$.jsxs)(q,{variant:O,role:k,surface:`glass`,controlAlignment:`first-line`,children:[A,j,ie,se]})}),t[43]=j,t[44]=ie,t[45]=se,t[46]=O,t[47]=k,t[48]=ce):ce=t[48],ce}),rt=24;function it(e){return[X(e.name),...e.shortName?[X(e.shortName)]:[],...e.subProvider?[X(e.subProvider)]:[],X(e.driverKind),X(e.providerDisplayName),ot(e)]}function at(e,t,n){return ye({value:e,query:t,exactBase:n,prefixBase:n+2,boundaryBase:n+4,includesBase:n+6,...t.length>=3?{fuzzyBase:n+100}:{}})}function ot(e){return X([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName].filter(e=>typeof e==`string`&&e.length>0).join(` `))}function st(e,t){let n=X(t).split(/\s+/u).filter(e=>e.length>0);if(n.length===0)return 0;let r=it(e),i=0;for(let e of n){let t=[];for(let n=0;n<r.length;n+=1){let i=at(r[n],e,n*10);i!==null&&t.push(i)}if(t.length===0)return null;i+=Math.min(...t)}return e.isFavorite?i-rt:i}function ct(e){if(e.driverKind===`antigravity`&&e.model===`antigravity-default`){let t=e.options.filter(e=>e.slug!==`antigravity-default`&&!e.isUnavailable);return t.find(e=>e.aliases?.includes(`antigravity-default`))??t.find(e=>e.isDefault)}return e.options.find(t=>t.slug===e.model)}function lt(e){return e.entry.driverKind===`antigravity`&&e.option.slug===`antigravity-default`?!1:c(e.entry)?!0:e.entry.enabled&&(e.entry.driverKind===`opencode`||e.entry.driverKind===`antigravity`)&&e.entry.instanceId===e.activeInstanceId&&e.option.slug===e.activeModel&&e.option.isUnavailable===!0}function ut(e,t){return e.enabled&&e.status!==`disabled`&&et(e.snapshot)&&(!c(e)||!e.installed||e.snapshot.auth.status===`unauthenticated`||!t.some(e=>!e.isUnavailable))}function dt(e){let t=[`favorites`,...e.entries.filter(t=>!e.disabledInstanceIds?.has(t.instanceId)&&(c(t)||e.selectableUnavailableInstanceIds?.has(t.instanceId))).map(e=>e.instanceId)],n=t.indexOf(e.selectedInstanceId);return t[n<0?e.direction===1?0:t.length-1:(n+e.direction+t.length)%t.length]}var ft=new Map,pt=52;function mt(){let e=(0,Ce.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`h-0.5`}),e[0]=t):t=e[0],t}var ht=(0,Q.memo)(function(e){let{keybindings:t,modelOptionsByInstance:n,instanceEntries:r,getModelDisabledReason:i,onInstanceModelChange:a,onToggleModel:s}=e,[l,u]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_=(0,Q.useRef)(null),y=(0,Q.useRef)(null),x=(0,Q.useRef)(null);(0,Q.useLayoutEffect)(()=>be(),[]);let S=(0,Q.useRef)(null),{favorites:ee}=I(e.environmentId),C=e.instanceEntries.find(t=>t.instanceId===e.activeInstanceId),w=ct({driverKind:C?.driverKind,model:e.model,options:n.get(e.activeInstanceId)??[]})?.slug??(e.model===`antigravity-default`?``:e.model),E=w?Fe(e.activeInstanceId,w):null,O=(0,Q.useMemo)(()=>e.selectedModels?.map(e=>{let t=ct({driverKind:r.find(t=>t.instanceId===e.instanceId)?.driverKind,model:e.model,options:n.get(e.instanceId)??[]});return Fe(e.instanceId,t?.slug??e.model)}),[r,n,e.selectedModels]),k=(0,Q.useMemo)(()=>new Set(O??(E?[E]:[])),[O,E]),j=C!==void 0&&(n.get(e.activeInstanceId)??[]).some(t=>lt({entry:C,option:t,activeInstanceId:e.activeInstanceId,activeModel:w}))&&!c(C),M=e.onOpenProviderSetup!==void 0&&C!==void 0&&ut(C,n.get(e.activeInstanceId)??[]),[N,L]=(0,Q.useState)(()=>e.lockedProvider!==null||j||M?e.activeInstanceId:ee.length>0?`favorites`:e.activeInstanceId),[te,z]=(0,Q.useState)(()=>new Set(n.get(e.activeInstanceId)?.some(e=>e.slug===w&&e.isLegacy)?[e.activeInstanceId]:[])),B=o(R),V=t??B,se=P(),ce=F(e.environmentId),le=(0,Q.useCallback)(()=>{_.current?.focus({preventScroll:!0})},[]),ue=(0,Q.useCallback)(e=>{L(e),window.requestAnimationFrame(()=>{le()})},[le]);(0,Q.useLayoutEffect)(()=>{le();let e=window.requestAnimationFrame(()=>{le()}),t=window.setTimeout(()=>{le()},0);return()=>{window.cancelAnimationFrame(e),window.clearTimeout(t)}},[le]);let W=(0,Q.useMemo)(()=>new Set(ee.map(e=>A(e.provider,e.model))),[ee]),G=(0,Q.useMemo)(()=>new Map(r.map(e=>[e.instanceId,e])),[r]),K=(0,Q.useCallback)(t=>e.lockedProvider===null?!0:t.driverKind===e.lockedProvider?!e.lockedContinuationGroupKey||t.continuationGroupKey===e.lockedContinuationGroupKey:!1,[e.lockedContinuationGroupKey,e.lockedProvider]),he=(0,Q.useMemo)(()=>{let t=new Set;if(j&&t.add(e.activeInstanceId),e.onOpenProviderSetup)for(let e of r)ut(e,n.get(e.instanceId)??[])&&t.add(e.instanceId);return t.size>0?t:void 0},[j,r,n,e.activeInstanceId,e.onOpenProviderSetup]),q=(0,Q.useMemo)(()=>{let t=[];for(let[r,i]of n){let n=G.get(r);if(n)for(let a of i)lt({entry:n,option:a,activeInstanceId:e.activeInstanceId,activeModel:w})&&t.push({slug:a.slug,name:a.name,...a.shortName?{shortName:a.shortName}:{},...a.subProvider?{subProvider:a.subProvider}:{},...a.badge?{badge:a.badge}:{},...a.isLegacy?{isLegacy:!0}:{},...a.isUnavailable?{isUnavailable:!0}:{},instanceId:r,driverKind:n.driverKind,instanceDisplayName:n.displayName,...n.accentColor?{instanceAccentColor:n.accentColor}:{},...n.acpRegistryAgentId?{acpRegistryAgentId:n.acpRegistryAgentId}:{},...n.acpRegistryIconUrl?{acpRegistryIconUrl:n.acpRegistryIconUrl}:{},...n.continuationGroupKey?{continuationGroupKey:n.continuationGroupKey}:{}})}return t},[n,G,e.activeInstanceId,w]),J=e.lockedProvider!==null,Y=l.trim().length>0,ge=(0,Q.useMemo)(()=>{if(!J)return;let e=new Set;for(let t of r)K(t)||e.add(t.instanceId);return e},[r,J,K]),_e=(0,Q.useMemo)(()=>{let e=r.filter(T);if(!J)return e;let t=[],n=[];for(let r of e)K(r)?t.push(r):n.push(r);return[...t,...n]},[r,J,K]),ve=!Y&&_e.length>0,ye=(0,Q.useMemo)(()=>r.map(e=>e.instanceId),[r]),X=(0,Q.useMemo)(()=>{let t=q;if(l.trim()){let n=t.map(e=>({model:e,score:st({name:e.name,...e.shortName?{shortName:e.shortName}:{},...e.subProvider?{subProvider:e.subProvider}:{},driverKind:e.driverKind,providerDisplayName:e.instanceDisplayName,isFavorite:W.has(A(e.instanceId,e.slug))},l),isFavorite:W.has(A(e.instanceId,e.slug)),tieBreaker:ot({name:e.name,...e.shortName?{shortName:e.shortName}:{},...e.subProvider?{subProvider:e.subProvider}:{},driverKind:e.driverKind,providerDisplayName:e.instanceDisplayName})})).filter(e=>e.score!==null);if(e.lockedProvider!==null){let e=[];for(let t of n)K(t.model)&&e.push(t);return e.toSorted((e,t)=>{let n=e.score-t.score;return n===0?e.isFavorite===t.isFavorite?e.tieBreaker.localeCompare(t.tieBreaker):e.isFavorite?-1:1:n}).map(e=>e.model)}return n.toSorted((e,t)=>{let n=e.score-t.score;return n===0?e.isFavorite===t.isFavorite?e.tieBreaker.localeCompare(t.tieBreaker):e.isFavorite?-1:1:n}).map(e=>e.model)}return e.lockedProvider===null?t=N===`favorites`?t.filter(e=>W.has(A(e.instanceId,e.slug))):t.filter(e=>e.instanceId===N):(t=t.filter(e=>K(e)),t=N===`favorites`?t.filter(e=>W.has(A(e.instanceId,e.slug))):t.filter(e=>e.instanceId===N)),m(t,{favoriteModelKeys:W,groupFavorites:N!==`favorites`,instanceOrder:N===`favorites`?ye:[]})},[W,q,ye,K,e.lockedProvider,l,N]),Z=(0,Q.useMemo)(()=>{if(Y||N===`favorites`)return null;let e=X.filter(e=>!e.isLegacy),t=X.filter(e=>e.isLegacy);return t.length===0?null:{key:Le(N),currentModels:e,legacyModels:t,isExpanded:te.has(N)}},[te,X,Y,N]),Ce=(0,Q.useMemo)(()=>Z?[...Z.currentModels,...Z.isExpanded?Z.legacyModels:[]]:X,[X,Z]),we=N===`favorites`?void 0:G.get(N),Te=!Y&&e.onOpenProviderSetup?r.filter(e=>K(e)&&ut(e,n.get(e.instanceId)??[])&&(we?e.instanceId===we.instanceId:X.length===0)):[],Ee=(Y?r.filter(K):we?[we]:[]).flatMap(e=>{let t=Me(e.snapshot,l);return t?[{instanceId:e.instanceId,notice:t}]:[]}),De=(0,Q.useCallback)(e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Oe=(0,Q.useCallback)((e,t,r=!1)=>{if(i?.(t,e))return;let o=n.get(t);if(!o)return;let c=G.get(t);if(!c)return;let l=d(c.driverKind,e,o);l&&(r&&s?s(t,l):a(t,l))},[G,i,n,a,s]),ke=(0,Q.useMemo)(()=>{let e=new Map,t=0;for(let n of Ce){if(i?.(n.instanceId,n.slug))continue;let r=pe(t);if(!r)return e;e.set(Fe(n.instanceId,n.slug),r),t+=1}return e},[i,Ce]),Ae=(0,Q.useMemo)(()=>[...ke.keys()],[ke]),je=(0,Q.useMemo)(()=>[...q.map(e=>Fe(e.instanceId,e.slug)),...new Set(q.filter(e=>e.isLegacy).map(e=>Le(e.instanceId)))],[q]),Ne=(0,Q.useMemo)(()=>{let e=Ce.map(e=>Fe(e.instanceId,e.slug));return Z&&e.splice(Z.currentModels.length,0,Z.key),e},[Z,Ce]),Pe=(0,Q.useMemo)(()=>new Map(Ce.map(e=>[Fe(e.instanceId,e.slug),e])),[Ce]),[Be,Ve]=(0,Q.useState)(()=>Ne.length*pt),[He,Ue]=(0,Q.useState)(0);(0,Q.useLayoutEffect)(()=>y.current?.getState().listen(`totalSize`,Ve),[]);let We=Ne.length===0?0:`calc(${Be}px + var(--spacing) * 5)`,Ge=(0,Q.useCallback)(()=>{let e=y.current?.getScrollableNode();if(!(e instanceof HTMLElement))return;let t=Math.max(0,e.scrollHeight-e.clientHeight);p(e.scrollTop>1),g(t-e.scrollTop>1)},[]),Ke=(0,Q.useMemo)(()=>({terminalFocus:!1,terminalOpen:e.terminalOpen,modelPickerOpen:!0}),[e.terminalOpen]),qe=(0,Q.useMemo)(()=>{if(ke.size===0)return ft;let e={platform:navigator.platform,context:Ke},t=new Map;for(let[n,r]of ke){let i=me(V,r,e);i&&t.set(n,i)}return t.size>0?t:ft},[V,ke,Ke]),Je=(0,Q.useMemo)(()=>({favoritesSet:W,modelJumpLabelByKey:qe,activeModelKey:E,selectedModelKeySet:k}),[W,qe,E,k]);return(0,Q.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||e.repeat||e.isComposing||e.keyCode===229||Se())return;let t=de(e,V,{platform:navigator.platform,context:Ke});if(t===`modelPicker.previousProvider`||t===`modelPicker.nextProvider`){e.preventDefault(),e.stopPropagation();let n=dt({entries:_e,selectedInstanceId:N,direction:t===`modelPicker.nextProvider`?1:-1,disabledInstanceIds:ge,selectableUnavailableInstanceIds:he});u(``),ue(n);return}let n=fe(t??``);if(n===null)return;e.preventDefault(),e.stopPropagation();let r=Ae[n];if(!r)return;let i=Ie(r);i&&Oe(i.slug,i.instanceId)};return window.addEventListener(`keydown`,e,!0),()=>{window.removeEventListener(`keydown`,e,!0)}},[Oe,ue,V,ge,Ae,Ke,he,N,_e]),(0,Q.useLayoutEffect)(()=>{p(!1),g(Ne.length>5);let e=0,t=window.requestAnimationFrame(()=>{Ge(),e=window.requestAnimationFrame(Ge)});return()=>{window.cancelAnimationFrame(t),window.cancelAnimationFrame(e)}},[Ne,Ge]),(0,$.jsx)(ne,{delay:0,children:(0,$.jsxs)(`div`,{ref:x,className:`relative flex max-h-86.5 w-90 max-w-full flex-row overflow-hidden`,style:Y?{height:He}:void 0,"data-model-picker-content":`true`,children:[ve&&(0,$.jsx)(Xe,{selectedInstanceId:N,onSelectInstance:ue,onFocusSearch:le,instanceEntries:_e,showFavorites:!0,...he?{selectableUnavailableInstanceIds:he}:{},...ge?{disabledInstanceIds:ge,getDisabledInstanceTooltip:e=>`${e.displayName} is unavailable in this thread. Start a new thread to switch providers.`}:{}}),(0,$.jsx)(ae,{inline:!0,items:je,filteredItems:Ne,filter:null,autoHighlight:!0,open:!0,virtualized:!0,multiple:s!==void 0,value:s?[...k]:E,onItemHighlighted:(e,t)=>{S.current=typeof e==`string`?e:null,t.reason===`keyboard`&&t.index>=0&&y.current?.scrollIndexIntoView?.({index:t.index,animated:!1})},onValueChange:(e,t)=>{let n=Array.isArray(e)?e.find(e=>!k.has(e))??[...k].find(t=>!e.includes(t)):e;if(typeof n!=`string`)return;let r=Re(n);if(r){De(r);return}let i=Ie(n);i&&Oe(i.slug,i.instanceId,`shiftKey`in t.event&&t.event.shiftKey===!0)},children:(0,$.jsxs)(`div`,{className:D(`flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40`,ve&&`border-l border-border/70`),children:[(0,$.jsx)(ie,{ref:_,placeholder:`Search models...`,value:l,onChange:e=>{Y||Ue(x.current?.offsetHeight??0),u(e.target.value)},onKeyDown:t=>{if(t.nativeEvent.isComposing||t.keyCode===229)t.preventBaseUIHandler?.(),t.stopPropagation();else{if(ve&&!t.altKey&&!t.ctrlKey&&!t.metaKey&&(t.key===`ArrowLeft`&&!t.shiftKey&&l.length===0||t.key===`Tab`&&t.shiftKey)){let e=t.currentTarget.closest(`[data-model-picker-content]`)?.querySelector(`[data-model-picker-sidebar]`),n=e?.querySelector(`button[aria-pressed="true"]:not(:disabled)`)??e?.querySelector(`button:not(:disabled)`);if(n){t.preventDefault(),t.stopPropagation(),n.focus();return}}if(t.key===`Escape`)t.preventDefault(),t.stopPropagation(),e.onRequestClose?.();else if(t.key===`Enter`&&S.current){t.preventBaseUIHandler?.(),t.preventDefault(),t.stopPropagation();let e=Re(S.current);if(e){De(e);return}let n=Ie(S.current);n&&Oe(n.slug,n.instanceId,t.shiftKey)}else t.stopPropagation()}},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation()}),(0,$.jsx)(`div`,{className:`relative min-h-0 overflow-hidden pr-px`,style:{height:We},children:(0,$.jsx)(re,{children:(0,$.jsx)(xe,{ref:y,data:Ne,extraData:Je,keyExtractor:e=>e,renderItem:({item:e,index:t})=>{if(Z?.key===e)return(0,$.jsxs)(U,{hideIndicator:!0,index:t,value:e,"aria-expanded":Z.isExpanded,className:`group w-full cursor-pointer`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 text-left`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium leading-snug`,children:`Legacy models`}),(0,$.jsxs)(`div`,{className:`mt-1 text-xs font-normal leading-snug text-muted-foreground/70`,children:[Z.legacyModels.length,` models`]})]}),(0,$.jsx)(b,{className:D(`size-4 transition-transform`,Z.isExpanded&&`rotate-90`)})]});let n=Pe.get(e);if(!n)return null;let r=i?.(n.instanceId,n.slug)??null;return(0,$.jsx)(ze,{index:t,model:n,instanceId:n.instanceId,driverKind:n.driverKind,providerDisplayName:n.instanceDisplayName,providerAccentColor:n.instanceAccentColor,acpRegistryAgentId:n.acpRegistryAgentId,acpRegistryIconUrl:n.acpRegistryIconUrl,isFavorite:W.has(A(n.instanceId,n.slug)),isSelected:O===void 0?e===E:k.has(e),showSelection:O!==void 0,showProvider:!0,preferShortName:!J,useTriggerLabel:!1,showNewBadge:n.badge===`new`,unavailable:n.isUnavailable===!0,jumpLabel:qe.get(e)??null,disabledReason:r,onToggleFavorite:()=>ce(n.instanceId,n.slug)},e)},estimatedItemSize:pt,drawDistance:480,recycleItems:!0,contentContainerClassName:`pl-2 pr-px`,ItemSeparatorComponent:mt,onLayout:Ge,onScroll:Ge,className:D(`scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2`,oe({top:f,bottom:h}))})})}),Te.length>0?(0,$.jsx)(`div`,{className:`max-h-44 shrink-0 overflow-y-auto border-t border-border/70 p-2`,children:Te.map(t=>(0,$.jsxs)(`div`,{className:`px-1 py-1.5 text-xs leading-snug`,children:[(0,$.jsx)(`p`,{className:`line-clamp-3 text-muted-foreground`,children:tt(t.snapshot)}),(0,$.jsx)(v,{className:`mt-1`,onClick:()=>{e.onRequestClose?.(),e.onOpenProviderSetup?.(t.instanceId)},children:Te.length>1?`Set up ${t.displayName}`:`Open provider setup`})]},t.instanceId))}):(0,$.jsx)(H,{className:`empty:h-0`,children:`No models found`}),Ee.map(({instanceId:t,notice:n})=>(0,$.jsxs)(`p`,{className:`shrink-0 border-t border-border/70 px-3 py-2 text-xs leading-snug text-muted-foreground`,children:[n,` `,(0,$.jsx)(v,{onClick:()=>{e.onRequestClose?.(),se({to:`/settings/providers`})},children:`Provider settings`})]},t))]})})]})})}),gt=`Fast and Ultrafast are unavailable with this ChatGPT connection. Use an existing Codex CLI login for speed options your account supports.`;function _t(e){let t=(0,Ce.c)(14),{provider:n}=e,r=(0,Q.useId)();if(!Y(n))return null;let i;t[0]===r?i=t[1]:(i=(0,$.jsx)(`span`,{"aria-describedby":r,tabIndex:0,className:`flex items-center gap-2 rounded-sm text-xs text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`}),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(W,{className:`size-3.5`,"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,$.jsxs)(z,{render:i,children:[a,`Using ChatGPT plan`]}),t[3]=i,t[4]=o);let s;t[5]===r?s=t[6]:(s=(0,$.jsx)(`span`,{id:r,className:`sr-only`,children:gt}),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(B,{side:`top`,children:gt}),t[7]=c):c=t[7];let l;t[8]!==o||t[9]!==s?(l=(0,$.jsxs)(V,{children:[o,s,c]}),t[8]=o,t[9]=s,t[10]=l):l=t[10];let u;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(_e,{size:`xs`}),t[11]=u):u=t[11];let d;return t[12]===l?d=t[13]:(d=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-t px-3 py-2`,children:[l,u]}),t[12]=l,t[13]=d),d}var vt=(0,Q.memo)(function(e){let t=(0,Ce.c)(120),n=S(),[r,a]=(0,Q.useState)(!1),o=e.open??r,s=e.size??`sm`,[c,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(null),d=(0,Q.useRef)(!!e.renderSettings),f;t[0]!==o||t[1]!==e?(f=()=>{let t=d.current&&!e.renderSettings;d.current=!!e.renderSettings,o&&t&&(l(!1),e.onOpenChange?.(!1),e.open===void 0&&a(!1))},t[0]=o,t[1]=e,t[2]=f):f=t[2];let p;t[3]!==o||t[4]!==e.onOpenChange||t[5]!==e.open||t[6]!==e.renderSettings?(p=[o,e.renderSettings,e.onOpenChange,e.open],t[3]=o,t[4]=e.onOpenChange,t[5]=e.open,t[6]=e.renderSettings,t[7]=p):p=t[7],(0,Q.useLayoutEffect)(f,p);let m,_;t[8]!==o||t[9]!==c?(m=()=>{o&&!c&&u.current?.querySelector(`[data-composer-model-settings] button:not(:disabled)`)?.focus({preventScroll:!0})},_=[o,c],t[8]=o,t[9]=c,t[10]=m,t[11]=_):(m=t[10],_=t[11]),(0,Q.useLayoutEffect)(m,_);let v;t[12]!==e.activeInstanceId||t[13]!==e.instanceEntries?(v=e.instanceEntries.find(t=>t.instanceId===e.activeInstanceId)??null,t[12]=e.activeInstanceId,t[13]=e.instanceEntries,t[14]=v):v=t[14];let y=v,b=e.activeInstanceId,x,w;if(t[15]!==y?.driverKind||t[16]!==b||t[17]!==e.model||t[18]!==e.modelOptionsByInstance){let n=e.modelOptionsByInstance.get(b)??[];x=ct({driverKind:y?.driverKind,model:e.model,options:n})??(y?.driverKind===`opencode`||y?.driverKind===`antigravity`?void 0:n[0]),w=x?Oe(x):e.model===`antigravity-default`?`Choose model`:e.model||`Choose model`,t[15]=y?.driverKind,t[16]=b,t[17]=e.model,t[18]=e.modelOptionsByInstance,t[19]=x,t[20]=w}else x=t[19],w=t[20];let T=w,k;t[21]!==y||t[22]!==e.instanceEntries?(k=y!==null&&i(y,e.instanceEntries),t[21]=y,t[22]=e.instanceEntries,t[23]=k):k=t[23];let A=k,j;t[24]===e?j=t[25]:(j=t=>{t||l(!1),e.onOpenChange?.(t),e.open===void 0&&a(t)},t[24]=e,t[25]=j);let M=j,N,P;t[26]===o?(N=t[27],P=t[28]):(N=()=>{if(!o)return;let{documentElement:e,body:t}=document,n=e.style.overscrollBehavior,r=t.style.overflow,i=t.style.paddingRight,a=window.innerWidth-e.clientWidth;e.style.overscrollBehavior=`contain`,t.style.overflow=`hidden`,a>0&&(t.style.paddingRight=`${a}px`);let s=yt,c=e=>{s(e.target)||e.preventDefault()},l=e=>{s(e.target)||e.preventDefault()};return document.addEventListener(`wheel`,c,{capture:!0,passive:!1}),document.addEventListener(`touchmove`,l,{capture:!0,passive:!1}),()=>{document.removeEventListener(`wheel`,c,{capture:!0}),document.removeEventListener(`touchmove`,l,{capture:!0}),e.style.overscrollBehavior=n,t.style.overflow=r,t.style.paddingRight=i}},P=[o],t[26]=o,t[27]=N,t[28]=P),(0,Q.useEffect)(N,P);let F;t[29]!==e||t[30]!==M?(F=(t,n)=>{e.disabled||(e.onInstanceModelChange(t,n),e.renderSettings?l(!1):M(!1))},t[29]=e,t[30]=M,t[31]=F):F=t[31];let I=F,L,R,te,z,B,ne,V,re,H;if(t[32]!==y||t[33]!==o||t[34]!==e.activeProviderIconClassName||t[35]!==e.compact||t[36]!==e.disabled||t[37]!==e.instanceEntries||t[38]!==e.instanceIndicatorBackground||t[39]!==e.isComposerOwned||t[40]!==e.modelOptionsByInstance||t[41]!==e.renderSettings||t[42]!==e.selectedModels||t[43]!==e.triggerAriaLabel||t[44]!==e.triggerClassName||t[45]!==e.triggerLabel||t[46]!==M||t[47]!==A||t[48]!==s){z=e.selectedModels?.map(t=>{let n=e.instanceEntries.find(e=>e.instanceId===t.instanceId),r=ct({driverKind:n?.driverKind,model:t.model,options:e.modelOptionsByInstance.get(t.instanceId)??[]});return{...t,entry:n,label:r?`${Oe(r)}${r.isUnavailable?` (Unavailable)`:``}`:t.model}}),te=z?z.length===0?`Choose models`:`${z.slice(0,2).map(bt).join(`, `)}${z.length>2?`, ${z.length-2} more`:``}`:void 0;let n=z?z.map(xt).join(`, `)||`Choose models`:void 0;R=le,re=o,t[58]!==e.disabled||t[59]!==M?(H=t=>{e.disabled?M(!1):M(t)},t[58]=e.disabled,t[59]=M,t[60]=H):H=t[60],L=ce;let r=e.compact?`max-w-42 shrink-0`:!e.isComposerOwned&&`max-w-48 sm:max-w-56`,i;t[61]!==e.triggerClassName||t[62]!==r?(i=D(`min-w-0 shrink justify-between whitespace-nowrap`,r,e.triggerClassName),t[61]=e.triggerClassName,t[62]=r,t[63]=i):i=t[63],V=(0,$.jsx)(g,{"aria-label":e.triggerAriaLabel??n,size:s,"data-chat-provider-model-picker":`true`,"data-composer-shortcut":e.renderSettings?`composer.effort`:void 0,className:i,disabled:e.disabled});let a=s===`xs`?`gap-1`:`gap-1.5`;t[64]===a?B=t[65]:(B=D(`flex min-w-0 flex-1 items-center`,a),t[64]=a,t[65]=B),ne=z&&e.triggerLabel===void 0?(0,$.jsxs)(`span`,{className:`flex shrink-0 items-center -space-x-1`,"aria-hidden":`true`,children:[z.slice(0,3).map(St),z.length>3?(0,$.jsxs)(`span`,{className:`relative z-30 flex size-4 items-center justify-center rounded-full bg-(--chat-composer-glass-surface,var(--background)) text-3xs ring-2 ring-(--chat-composer-glass-surface,var(--background))`,children:[`+`,z.length-3]}):null]}):y&&e.triggerLabel===void 0?(0,$.jsx)(ge,{driverKind:y.driverKind,displayName:y.displayName,accentColor:y.accentColor,acpRegistryAgentId:y.acpRegistryAgentId,acpRegistryIconUrl:y.acpRegistryIconUrl,showBadge:A,className:`size-4`,iconClassName:D(`size-4`,e.activeProviderIconClassName),indicatorBackground:e.instanceIndicatorBackground??`var(--contrast-input)`,badgeClassName:D(`right-[-0.125rem] bottom-[-0.125rem] h-3 min-w-3 px-0.5 text-5xs`,s===`xs`&&`shadow-none`)}):null,t[32]=y,t[33]=o,t[34]=e.activeProviderIconClassName,t[35]=e.compact,t[36]=e.disabled,t[37]=e.instanceEntries,t[38]=e.instanceIndicatorBackground,t[39]=e.isComposerOwned,t[40]=e.modelOptionsByInstance,t[41]=e.renderSettings,t[42]=e.selectedModels,t[43]=e.triggerAriaLabel,t[44]=e.triggerClassName,t[45]=e.triggerLabel,t[46]=M,t[47]=A,t[48]=s,t[49]=L,t[50]=R,t[51]=te,t[52]=z,t[53]=B,t[54]=ne,t[55]=V,t[56]=re,t[57]=H}else L=t[49],R=t[50],te=t[51],z=t[52],B=t[53],ne=t[54],V=t[55],re=t[56],H=t[57];let U;t[66]!==e.fastMode||t[67]!==e.isComposerOwned?(U=e.isComposerOwned&&e.fastMode?(0,$.jsx)(E,{"aria-hidden":!0,className:`size-4 shrink-0 fill-current text-foreground`}):null,t[66]=e.fastMode,t[67]=e.isComposerOwned,t[68]=U):U=t[68];let ie=e.triggerLabel??te??T,ae;t[69]===ie?ae=t[70]:(ae=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,"data-chat-provider-model-picker-label":`true`,children:ie}),t[69]=ie,t[70]=ae);let oe;t[71]===e.settingsLabel?oe=t[72]:(oe=e.settingsLabel?(0,$.jsx)(`span`,{className:`shrink-0 font-normal text-muted-foreground`,children:e.settingsLabel}):null,t[71]=e.settingsLabel,t[72]=oe);let de;t[73]!==e.triggerLabel||t[74]!==z||t[75]!==x?.isUnavailable?(de=x?.isUnavailable&&!z&&e.triggerLabel===void 0?(0,$.jsx)(h,{variant:`outline`,size:`sm`,children:`Unavailable`}):null,t[73]=e.triggerLabel,t[74]=z,t[75]=x?.isUnavailable,t[76]=de):de=t[76];let fe;t[77]!==B||t[78]!==ne||t[79]!==U||t[80]!==ae||t[81]!==oe||t[82]!==de?(fe=(0,$.jsxs)(`span`,{className:B,children:[ne,U,ae,oe,de]}),t[77]=B,t[78]=ne,t[79]=U,t[80]=ae,t[81]=oe,t[82]=de,t[83]=fe):fe=t[83];let pe;t[84]===s?pe=t[85]:(pe=(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`flex items-center`,children:(0,$.jsx)(O,{size:s})}),t[84]=s,t[85]=pe);let me;t[86]!==L||t[87]!==V||t[88]!==fe||t[89]!==pe?(me=(0,$.jsxs)(L,{render:V,children:[fe,pe]}),t[86]=L,t[87]=V,t[88]=fe,t[89]=pe,t[90]=me):me=t[90];let W;t[91]!==n||t[92]!==e.isComposerOwned?(W=e.isComposerOwned?n:{},t[91]=n,t[92]=e.isComposerOwned,t[93]=W):W=t[93];let G;t[94]!==e.renderSettings||t[95]!==c?(G=e.renderSettings?{width:`calc(${c?360:288}px + 2px)`,maxWidth:`calc(100vw - 2rem)`}:void 0,t[94]=e.renderSettings,t[95]=c,t[96]=G):G=t[96];let K=c?`models`:`settings`,he=e.renderSettings?c?`composer-models-enter`:`composer-effort-enter`:void 0,q;t[97]!==y?.snapshot||t[98]!==b||t[99]!==I||t[100]!==te||t[101]!==e||t[102]!==M||t[103]!==c||t[104]!==T?(q=e.renderSettings&&!c?e.renderSettings(te??T,()=>l(!0)):(0,$.jsxs)($.Fragment,{children:[e.renderSettings?(0,$.jsx)(`div`,{className:`px-2 pt-2`,children:(0,$.jsxs)(ee,{variant:`ghost-muted`,size:`sm`,onClick:()=>l(!1),children:[(0,$.jsx)(C,{}),` Model settings`]})}):null,(0,$.jsx)(ht,{environmentId:e.environmentId,activeInstanceId:b,model:e.model,...e.selectedModels===void 0?{}:{selectedModels:e.selectedModels},...e.onToggleModel?{onToggleModel:(t,n)=>{e.disabled||e.onToggleModel?.(t,n)}}:{},lockedProvider:e.lockedProvider,lockedContinuationGroupKey:e.lockedContinuationGroupKey??null,instanceEntries:e.instanceEntries,...e.keybindings?{keybindings:e.keybindings}:{},modelOptionsByInstance:e.modelOptionsByInstance,terminalOpen:e.terminalOpen??!1,onRequestClose:()=>M(!1),...e.onOpenProviderSetup?{onOpenProviderSetup:e.onOpenProviderSetup}:{},...e.getModelDisabledReason?{getModelDisabledReason:e.getModelDisabledReason}:{},onInstanceModelChange:I}),e.selectedModels===void 0?(0,$.jsx)(_t,{provider:y?.snapshot??null}):null]}),t[97]=y?.snapshot,t[98]=b,t[99]=I,t[100]=te,t[101]=e,t[102]=M,t[103]=c,t[104]=T,t[105]=q):q=t[105];let J;t[106]!==K||t[107]!==he||t[108]!==q?(J=(0,$.jsx)(`div`,{ref:u,className:`max-w-[calc(100vw-2rem)]`,children:(0,$.jsx)(ue,{children:(0,$.jsx)(`div`,{className:he,children:q},K)})}),t[106]=K,t[107]=he,t[108]=q,t[109]=J):J=t[109];let Y;t[110]!==W||t[111]!==G||t[112]!==J?(Y=(0,$.jsx)(se,{...W,align:`start`,className:`before:hidden`,padding:`none`,scrollbar:`hidden`,style:G,children:J}),t[110]=W,t[111]=G,t[112]=J,t[113]=Y):Y=t[113];let _e;return t[114]!==R||t[115]!==re||t[116]!==H||t[117]!==me||t[118]!==Y?(_e=(0,$.jsxs)(R,{open:re,onOpenChange:H,children:[me,Y]}),t[114]=R,t[115]=re,t[116]=H,t[117]=me,t[118]=Y,t[119]=_e):_e=t[119],_e});function yt(e){return e instanceof Element&&e.closest(`[data-model-picker-content]`)}function bt(e){return e.label}function xt(e){return e.label}function St(e){return e.entry?(0,$.jsx)(ge,{driverKind:e.entry.driverKind,displayName:e.entry.displayName,accentColor:e.entry.accentColor,acpRegistryAgentId:e.entry.acpRegistryAgentId,acpRegistryIconUrl:e.entry.acpRegistryIconUrl,className:`size-4 rounded-full bg-(--chat-composer-glass-surface,var(--background)) ring-2 ring-(--chat-composer-glass-surface,var(--background))`,iconClassName:`size-4`},`${e.instanceId}:${e.model}`):null}export{et as a,Qe as i,ct as n,$e as o,nt as r,Oe as s,vt as t};
2
- //# sourceMappingURL=ProviderModelPicker-rRVcFLyP.js.map
@@ -1,5 +0,0 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Ao as i,Df as a,Ef as o,Jo as s,Os as c,Pc as l,Pf as u,Wo as d,Zd as f,mr as p,op as m,t as h,wf as g,ys as _,zf as ee}from"./utils-BVnIIHXP.js";import{$i as te,Ec as v,Gc as y,Xc as b,fa as ne,kc as re,ra as ie}from"./src-DHn7yNZx.js";import{Dr as ae,Sr as oe,xr as se}from"./runtime-vb0YwEUc.js";import{a as ce,h as le,p as ue}from"./relay-Ceq0htTl.js";import{J as de,s as x}from"./useSettings-Dp27sUML.js";import{f as fe}from"./server-Bw1ZPPkk.js";import{i as pe,n as me}from"./session-YEQs2e4k.js";import{t as he}from"./use-atom-command-DkmE-pw9.js";import{u as S}from"./rightPanelStore-AjYoRisO.js";import{a as ge}from"./fileLinks-Y3tOmcmb.js";import{t as _e}from"./toastHelpers-DxXYm50b.js";import{a as C,n as w,t as T}from"./tooltip-BhCWnsdW.js";import{i as E,o as D,t as ve}from"./popover-DnYfrQly.js";import{t as O}from"./observeResize-Cz6dJUG2.js";import{S as ye,c as be,d as xe,n as Se,s as Ce,x as we}from"./browserHistoryStore-xnY5QhfE.js";import{S as Te,a as k,c as Ee,d as De,f as Oe,l as ke,p as A,u as Ae,x as je}from"./keybindings-CrlWqd5q.js";import{t as Me}from"./preview-Dd9kGZBH.js";import{n as Ne,r as Pe}from"./browserLinkTarget-CH-4nkAf.js";import{a as Fe,i as j,n as M,s as Ie,t as N}from"./terminal-links-CxLXIwP1.js";import{a as Le,i as Re,o as ze,t as Be}from"./terminalSessions-CXGA3pch.js";import{t as Ve}from"./terminalLabels-BgLOlb2G.js";import{Bo as He,Co as Ue,_o as We,bo as Ge,wo as Ke}from"./main-43D2LVmx.js";var P=e(t(),1),qe=n(),F=e(r(),1);function Je(e){let{bounds:t,selectionRect:n,pointer:r,viewport:i}=e,a=r??{x:n?.right??t.left+t.width-140,y:n?n.bottom+4:t.top+12};return{x:Math.max(8,Math.min(Math.max(t.left,a.x),t.left+t.width,i.width-8)),y:Math.max(8,Math.min(Math.max(t.top,a.y),t.top+t.height,i.height-8))}}function I({element:e,getActionElement:t,onSelection:n,onDismiss:r}){let i=e.ownerDocument,a=i.defaultView,o=!1,s=!1,c=!1,l=null,u=null,d=null,f=e=>e!==null&&(t?.()?.contains(e)??!1),p=()=>{u!==null&&a.clearTimeout(u),d!==null&&a.cancelAnimationFrame(d),u=d=null},m=()=>{p(),o=s=!1,l=null,c=!0},h=()=>{m(),r(`cancel`)},g=()=>{m(),r(`interaction`)},_=e=>{p(),u=a.setTimeout(()=>{u=null,d=a.requestAnimationFrame(()=>{d=null,n(l)})},e)},ee=n=>{if(!n.isPrimary)return;if(f(n.target)){m();return}p(),o=n.button===0;let i=e.contains(n.target);s=!1,c=!0,l=null,i?r(`interaction`):t?.()&&r(`cancel`)},te=e=>{e.isPrimary&&(e.target?.closest(`button, [role=button]`)||(s=e.button===0&&!e.defaultPrevented,c=!s))},v=e=>{e.isPrimary&&e.button===0&&(o=!1)},y=e=>{e.button===0&&(o=!1,s&&(s=!1,l={x:e.clientX,y:e.clientY},_(e.detail>=2?500:0)))},b=e=>{f(e.target)&&e.key!==`Escape`||(e.key===`Escape`?h():o||(p(),s=!1,l=null,c=!1))},ne=e=>{f(e.target)?m():!o&&t?.()&&h()},re=()=>{p(),o||(l=null,c=!0),r(`cancel`)};return i.addEventListener(`pointerdown`,ee,!0),e.addEventListener(`pointerdown`,te),a.addEventListener(`pointerup`,v),a.addEventListener(`mouseup`,y),a.addEventListener(`pointercancel`,h),i.addEventListener(`keydown`,b),i.addEventListener(`focusin`,ne),e.addEventListener(`contextmenu`,g,!0),e.addEventListener(`scroll`,re,!0),a.addEventListener(`blur`,h),a.addEventListener(`resize`,h),{get pending(){return u!==null||d!==null},cancel:m,selectionChanged(){f(i.activeElement)||(o||s?r(`cancel`):!c&&u===null&&d===null&&_(0))},dispose(){m(),i.removeEventListener(`pointerdown`,ee,!0),e.removeEventListener(`pointerdown`,te),a.removeEventListener(`pointerup`,v),a.removeEventListener(`mouseup`,y),a.removeEventListener(`pointercancel`,h),i.removeEventListener(`keydown`,b),i.removeEventListener(`focusin`,ne),e.removeEventListener(`contextmenu`,g,!0),e.removeEventListener(`scroll`,re,!0),a.removeEventListener(`blur`,h),a.removeEventListener(`resize`,h)}}}var Ye=new Map(`Unidentified.Backquote.Backslash.BracketLeft.BracketRight.Comma.Digit0.Digit1.Digit2.Digit3.Digit4.Digit5.Digit6.Digit7.Digit8.Digit9.Equal.IntlBackslash.IntlRo.IntlYen.KeyA.KeyB.KeyC.KeyD.KeyE.KeyF.KeyG.KeyH.KeyI.KeyJ.KeyK.KeyL.KeyM.KeyN.KeyO.KeyP.KeyQ.KeyR.KeyS.KeyT.KeyU.KeyV.KeyW.KeyX.KeyY.KeyZ.Minus.Period.Quote.Semicolon.Slash.AltLeft.AltRight.Backspace.CapsLock.ContextMenu.ControlLeft.ControlRight.Enter.MetaLeft.MetaRight.ShiftLeft.ShiftRight.Space.Tab.Convert.KanaMode.NonConvert.Delete.End.Help.Home.Insert.PageDown.PageUp.ArrowDown.ArrowLeft.ArrowRight.ArrowUp.NumLock.Numpad0.Numpad1.Numpad2.Numpad3.Numpad4.Numpad5.Numpad6.Numpad7.Numpad8.Numpad9.NumpadAdd.NumpadBackspace.NumpadClear.NumpadClearEntry.NumpadComma.NumpadDecimal.NumpadDivide.NumpadEnter.NumpadEqual.NumpadMemoryAdd.NumpadMemoryClear.NumpadMemoryRecall.NumpadMemoryStore.NumpadMemorySubtract.NumpadMultiply.NumpadParenLeft.NumpadParenRight.NumpadSubtract.NumpadSeparator.NumpadArrowUp.NumpadArrowDown.NumpadArrowRight.NumpadArrowLeft.NumpadBegin.NumpadHome.NumpadEnd.NumpadInsert.NumpadDelete.NumpadPageUp.NumpadPageDown.Escape.F1.F2.F3.F4.F5.F6.F7.F8.F9.F10.F11.F12.F13.F14.F15.F16.F17.F18.F19.F20.F21.F22.F23.F24.F25.Fn.FnLock.PrintScreen.ScrollLock.Pause.BrowserBack.BrowserFavorites.BrowserForward.BrowserHome.BrowserRefresh.BrowserSearch.BrowserStop.Eject.LaunchApp1.LaunchApp2.LaunchMail.MediaPlayPause.MediaSelect.MediaStop.MediaTrackNext.MediaTrackPrevious.Power.Sleep.AudioVolumeDown.AudioVolumeMute.AudioVolumeUp.WakeUp.Copy.Cut.Paste`.split(`.`).map((e,t)=>[e,t]));function L(e){return Ye.get(e)??0}var Xe=new Map([[`!`,`1`],[`@`,`2`],[`#`,`3`],[`$`,`4`],[`%`,`5`],[`^`,`6`],[`&`,`7`],[`*`,`8`],[`(`,`9`],[`)`,`0`],[`~`,"`"],[`_`,`-`],[`+`,`=`],[`{`,`[`],[`}`,`]`],[`|`,`\\`],[`:`,`;`],[`"`,`'`],[`<`,`,`],[`>`,`.`],[`?`,`/`]]),R;function z(){if(R)return R;let e=(globalThis.navigator?.keyboard)?.getLayoutMap().catch(()=>void 0)??Promise.resolve(void 0);return R=e,e}function B(e,t=navigator.platform){return e.ctrlKey||e.metaKey||[...e.key].length!==1||e.altKey&&!l(t)?0:+!!e.shiftKey|(e.altKey?4:0)}function V(e,t){if([...e.key].length!==1)return 0;let n=t?.get(e.code);if(n&&[...n].length===1)return n.codePointAt(0)??0;if(/^[A-Z]$/u.test(e.key))return e.key.charCodeAt(0)+32;if(e.shiftKey){let t=Xe.get(e.key);if(t)return t.codePointAt(0)??0;let n=e.key.toLowerCase();return n!==e.key&&[...n].length===1?n.codePointAt(0)??0:0}return e.key.codePointAt(0)??0}var Ze=`/assets/ghostty-vt-DdA0Zryv.wasm`,Qe=`/assets/ghostty-write-pty-BWDOU6dy.wasm`,H=new TextDecoder,$e=class e{memory;layouts;exports;memoryView;memoryU8;ptyWriters=new Map;nextPtyWriterId=1;writePtyFunctionIndex=0;constructor(e){this.exports=e.exports;let t=e.exports.memory;if(!(t instanceof WebAssembly.Memory))throw Error(`libghostty-vt did not export WebAssembly memory`);this.memory=t,this.memoryView=new DataView(t.buffer),this.memoryU8=new Uint8Array(t.buffer);let n=this.call(`ghostty_type_json`),r=new Uint8Array(t.buffer),i=n;for(;i<r.length&&r[i]!==0;)i+=1;this.layouts=JSON.parse(H.decode(r.subarray(n,i)))}static async load(){let t=await fetch(Ze);if(!t.ok)throw Error(`Unable to load libghostty-vt (${t.status})`);let n,r=await WebAssembly.instantiate(await t.arrayBuffer(),{env:{log:(e,t)=>{if(!n)return;let r=n.exports.memory;if(!(r instanceof WebAssembly.Memory))return;let i=H.decode(new Uint8Array(r.buffer,e,t));console.debug(`[libghostty-vt]`,i)}}});n=r.instance;let i=new e(r.instance);return await i.installWritePtyTrampoline(),i}call(e,...t){return this.fn(e)(...t)}fn(e){let t=this.exports[e];if(typeof t!=`function`)throw Error(`libghostty-vt export is unavailable: ${e}`);return t}layout(e){let t=this.layouts[e];if(!t)throw Error(`libghostty-vt type layout is unavailable: ${e}`);return t}alloc(e){let t=this.call(`ghostty_wasm_alloc_u8_array`,e);if(t===0)throw Error(`libghostty-vt failed to allocate ${e} bytes`);return new Uint8Array(this.memory.buffer,t,e).fill(0),t}free(e,t){e!==0&&this.call(`ghostty_wasm_free_u8_array`,e,t)}allocOpaque(){let e=this.call(`ghostty_wasm_alloc_opaque`);if(e===0)throw Error(`libghostty-vt failed to allocate an opaque pointer`);return new DataView(this.memory.buffer).setUint32(e,0,!0),e}freeOpaque(e){e!==0&&this.call(`ghostty_wasm_free_opaque`,e)}readPointer(e){return this.memoryDataView().getUint32(e,!0)}attachPtyWriter(e,t){if(this.writePtyFunctionIndex===0)throw Error(`libghostty-vt PTY callback trampoline is unavailable`);let n=this.nextPtyWriterId++;return this.ptyWriters.set(n,t),this.call(`ghostty_terminal_set`,e,0,n),this.call(`ghostty_terminal_set`,e,1,this.writePtyFunctionIndex),n}detachPtyWriter(e,t){this.call(`ghostty_terminal_set`,e,1,0),this.call(`ghostty_terminal_set`,e,0,0),this.ptyWriters.delete(t)}view(e,t){return new DataView(this.memoryDataView().buffer,e,t)}bytes(e,t){return new Uint8Array(this.memoryDataView().buffer,e,t)}memoryDataView(){return this.refreshMemoryViews(),this.memoryView}memoryBytes(){return this.refreshMemoryViews(),this.memoryU8}refreshMemoryViews(){this.memoryU8.byteLength===0&&(this.memoryView=new DataView(this.memory.buffer),this.memoryU8=new Uint8Array(this.memory.buffer))}setField(e,t,n,r){let i=this.layout(t).fields[n];if(!i)throw Error(`libghostty-vt field is unavailable: ${t}.${n}`);let a=this.memoryDataView(),o=e+i.offset;switch(i.type){case`bool`:case`u8`:a.setUint8(o,r);return;case`u16`:a.setUint16(o,r,!0);return;case`i32`:a.setInt32(o,r,!0);return;case`u32`:case`enum`:a.setUint32(o,r,!0);return;case`u64`:a.setBigUint64(o,BigInt(r),!0);return;default:throw Error(`Unsupported libghostty-vt field type: ${i.type}`)}}readField(e,t,n){let r=this.layout(t).fields[n];if(!r)throw Error(`libghostty-vt field is unavailable: ${t}.${n}`);let i=this.memoryDataView(),a=e+r.offset;switch(r.type){case`bool`:case`u8`:return i.getUint8(a);case`u16`:return i.getUint16(a,!0);case`i32`:return i.getInt32(a,!0);case`u32`:case`enum`:return i.getUint32(a,!0);case`u64`:return Number(i.getBigUint64(a,!0));default:throw Error(`Unsupported libghostty-vt field type: ${r.type}`)}}async installWritePtyTrampoline(){let e=await fetch(Qe);if(!e.ok)throw Error(`Unable to load the libghostty-vt PTY trampoline (${e.status})`);let t=(await WebAssembly.instantiate(await e.arrayBuffer(),{env:{p4_write_pty:(e,t,n,r)=>{let i=this.ptyWriters.get(t);i&&r!==0&&i(H.decode(new Uint8Array(this.memory.buffer,n,r)))}}})).instance.exports.ghostty_write_pty,n=this.exports.__indirect_function_table;if(typeof t!=`function`||!(n instanceof WebAssembly.Table))throw Error(`libghostty-vt did not expose its callback table`);let r=n.length;n.grow(1),n.set(r,t),this.writePtyFunctionIndex=r}},U=null;function et(){return U??=$e.load().catch(e=>{throw U=null,e}),U}var W=0,G=-3,tt=1e4,K=16,nt=768,q={cols:1,rows:2,dirty:3,rowIterator:4,background:5,foreground:6,cursor:7,cursorHasValue:8,cursorStyle:10,cursorVisible:11,cursorBlinking:12,cursorInViewport:14,cursorX:15,cursorY:16},J={dirty:1,raw:2,cells:3},Y={raw:1,style:2,graphemesLength:3,graphemes:4,background:5,foreground:6,selected:7},X={keys:0,values:20,graphemesLength:40,selected:44,background:48,foreground:52,written:56,size:60},rt={wide:3},it={narrow:0,wide:1,spacerTail:2,spacerHead:3},at=new TextDecoder,ot=new TextEncoder;function st(e,t){let n=(e,t)=>Math.floor((e*155+t*100)/255);return{r:n(e.r,t.r),g:n(e.g,t.g),b:n(e.b,t.b)}}function ct(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b}function lt(e,t,n=0){if(t===1)return String.fromCodePoint(e.getUint32(n,!0));let r=4096,i=``;for(let a=0;a<t;a+=r){let o=Math.min(r,t-a),s=Array(o);for(let t=0;t<o;t+=1)s[t]=e.getUint32(n+(a+t)*4,!0);i+=String.fromCodePoint(...s)}return i}var ut=class e{runtime;terminalSlot=0;terminal=0;renderStateSlot=0;renderState=0;rowIteratorSlot=0;rowCellsSlot=0;keyEncoderSlot=0;keyEncoder=0;keyEventSlot=0;keyEvent=0;mouseEncoderSlot=0;mouseEncoder=0;mouseEventSlot=0;mouseEvent=0;ptyWriterId=0;ptyWriter=null;scratch=0;graphemes=0;graphemeCapacity=0;style=0;cellQuery=0;scrollbar=0;rows=[];disposed=!1;keyboardLayoutMap;constructor(e){this.runtime=e,z().then(e=>{this.disposed||(this.keyboardLayoutMap=e)})}static async create(t,n,r,i,a,o){let s=new e(await et());try{return s.initialize(t,n,r,i,a,o),s}catch(e){throw s.dispose(),e}}initialize(e,t,n,r,i,a){let o=this.runtime.layout(`GhosttyTerminalOptions`).size,s=this.runtime.alloc(o);this.runtime.setField(s,`GhosttyTerminalOptions`,`cols`,e),this.runtime.setField(s,`GhosttyTerminalOptions`,`rows`,t),this.runtime.setField(s,`GhosttyTerminalOptions`,`max_scrollback`,tt),this.terminalSlot=this.runtime.allocOpaque();let c=this.runtime.call(`ghostty_terminal_new`,0,this.terminalSlot,s);this.runtime.free(s,o),this.assertSuccess(`ghostty_terminal_new`,c),this.terminal=this.runtime.readPointer(this.terminalSlot),this.applyDefaultCursorBlink(),this.ptyWriter=a,this.ptyWriterId=this.runtime.attachPtyWriter(this.terminal,a),this.renderStateSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_render_state_new`,this.runtime.call(`ghostty_render_state_new`,0,this.renderStateSlot)),this.renderState=this.runtime.readPointer(this.renderStateSlot),this.rowIteratorSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_render_state_row_iterator_new`,this.runtime.call(`ghostty_render_state_row_iterator_new`,0,this.rowIteratorSlot)),this.rowCellsSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_render_state_row_cells_new`,this.runtime.call(`ghostty_render_state_row_cells_new`,0,this.rowCellsSlot)),this.keyEncoderSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_key_encoder_new`,this.runtime.call(`ghostty_key_encoder_new`,0,this.keyEncoderSlot)),this.keyEncoder=this.runtime.readPointer(this.keyEncoderSlot),this.keyEventSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_key_event_new`,this.runtime.call(`ghostty_key_event_new`,0,this.keyEventSlot)),this.keyEvent=this.runtime.readPointer(this.keyEventSlot),this.mouseEncoderSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_mouse_encoder_new`,this.runtime.call(`ghostty_mouse_encoder_new`,0,this.mouseEncoderSlot)),this.mouseEncoder=this.runtime.readPointer(this.mouseEncoderSlot),this.mouseEventSlot=this.runtime.allocOpaque(),this.assertSuccess(`ghostty_mouse_event_new`,this.runtime.call(`ghostty_mouse_event_new`,0,this.mouseEventSlot)),this.mouseEvent=this.runtime.readPointer(this.mouseEventSlot),this.scratch=this.runtime.alloc(16);let l=this.runtime.layout(`GhosttyStyle`).size;this.style=this.runtime.alloc(l),this.runtime.setField(this.style,`GhosttyStyle`,`size`,l),this.cellQuery=this.runtime.alloc(X.size);let u=this.runtime.memoryDataView(),d=[[Y.style,this.style],[Y.graphemesLength,this.cellQuery+X.graphemesLength],[Y.selected,this.cellQuery+X.selected],[Y.background,this.cellQuery+X.background],[Y.foreground,this.cellQuery+X.foreground]];for(let[e,[t,n]]of d.entries())u.setUint32(this.cellQuery+X.keys+e*4,t,!0),u.setUint32(this.cellQuery+X.values+e*4,n,!0);this.scrollbar=this.runtime.alloc(this.runtime.layout(`GhosttyTerminalScrollbar`).size),this.setTheme(i),this.resize(e,t,n,r)}write(e){this.ensureActive();let t=typeof e==`string`?ot.encode(e):e;if(t.length===0)return;let n=this.runtime.alloc(t.length);this.runtime.bytes(n,t.length).set(t),this.runtime.call(`ghostty_terminal_vt_write`,this.terminal,n,t.length),this.runtime.free(n,t.length)}resetAndWrite(e){if(this.ensureActive(),this.runtime.call(`ghostty_terminal_reset`,this.terminal),this.applyDefaultCursorBlink(),this.rows=[],e.length===0)return;let t=this.ptyWriter;this.ptyWriterId!==0&&(this.runtime.detachPtyWriter(this.terminal,this.ptyWriterId),this.ptyWriterId=0);try{this.write(e)}finally{t!==null&&!this.disposed&&(this.ptyWriterId=this.runtime.attachPtyWriter(this.terminal,t))}}resize(e,t,n,r){this.ensureActive(),this.assertSuccess(`ghostty_terminal_resize`,this.runtime.call(`ghostty_terminal_resize`,this.terminal,Math.max(1,Math.min(65535,e)),Math.max(1,Math.min(65535,t)),Math.max(1,Math.round(n)),Math.max(1,Math.round(r))))}applyDefaultCursorBlink(){let e=this.runtime.alloc(1);this.runtime.bytes(e,1)[0]=1,this.runtime.call(`ghostty_terminal_set`,this.terminal,23,e),this.runtime.free(e,1)}setTheme(e){this.ensureActive();let t=this.runtime.alloc(3);for(let[n,r]of[[11,e.foreground],[12,e.background],[13,e.cursor]])this.runtime.bytes(t,3).set([r.r,r.g,r.b]),this.runtime.call(`ghostty_terminal_set`,this.terminal,n,t);this.runtime.free(t,3),e.palette&&this.setPalette(e.palette)}setPalette(e){let t=this.runtime.alloc(nt);this.runtime.call(`ghostty_terminal_get`,this.terminal,25,t);let n=this.runtime.bytes(t,nt);e.slice(0,16).forEach((e,t)=>{n.set([e.r,e.g,e.b],t*3)}),this.runtime.call(`ghostty_terminal_set`,this.terminal,14,t),this.runtime.free(t,nt)}scroll(e){this.ensureActive();let t=this.runtime.layout(`GhosttyTerminalScrollViewport`),n=this.runtime.alloc(t.size);this.runtime.setField(n,`GhosttyTerminalScrollViewport`,`tag`,2);let r=t.fields.value;this.runtime.view(n+r.offset,r.size).setInt32(0,e,!0),this.runtime.call(`ghostty_terminal_scroll_viewport`,this.terminal,n),this.runtime.free(n,t.size)}scrollToBottom(){this.ensureActive();let e=this.runtime.layout(`GhosttyTerminalScrollViewport`),t=this.runtime.alloc(e.size);this.runtime.setField(t,`GhosttyTerminalScrollViewport`,`tag`,1),this.runtime.call(`ghostty_terminal_scroll_viewport`,this.terminal,t),this.runtime.free(t,e.size)}isViewportActive(){return this.ensureActive(),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_terminal_get`,this.terminal,32,this.scratch)===W&&this.runtime.bytes(this.scratch,1)[0]!==0}scrollbarState(){this.ensureActive();let e=this.runtime.layout(`GhosttyTerminalScrollbar`);return this.runtime.bytes(this.scrollbar,e.size).fill(0),this.runtime.call(`ghostty_terminal_get`,this.terminal,9,this.scrollbar)===W?{total:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`total`),offset:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`offset`),len:this.runtime.readField(this.scrollbar,`GhosttyTerminalScrollbar`,`len`)}:null}isMouseTracking(){return this.ensureActive(),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_terminal_get`,this.terminal,11,this.scratch)===W&&this.runtime.bytes(this.scratch,1)[0]!==0}isMouseAnyEventTracking(){return this.ensureActive(),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_terminal_mode_get`,this.terminal,1003,this.scratch)===W&&this.runtime.bytes(this.scratch,1)[0]!==0}isAlternateScreen(){return this.ensureActive(),this.runtime.bytes(this.scratch,4).fill(0),this.runtime.call(`ghostty_terminal_get`,this.terminal,6,this.scratch)===W&&this.runtime.view(this.scratch,4).getUint32(0,!0)===1}isApplicationCursorKeys(){return this.ensureActive(),this.runtime.bytes(this.scratch,1)[0]=0,this.runtime.call(`ghostty_terminal_mode_get`,this.terminal,1,this.scratch)===W&&this.runtime.bytes(this.scratch,1)[0]!==0}encodeKey(e,t=`press`){this.ensureActive(),this.runtime.call(`ghostty_key_encoder_setopt_from_terminal`,this.keyEncoder,this.terminal),this.runtime.call(`ghostty_key_event_set_action`,this.keyEvent,t===`release`?0:e.repeat?2:1),this.runtime.call(`ghostty_key_event_set_key`,this.keyEvent,L(e.code));let n=+!!e.shiftKey|(e.ctrlKey?2:0)|(e.altKey?4:0)|(e.metaKey?8:0)|(e.getModifierState(`CapsLock`)?16:0)|(e.getModifierState(`NumLock`)?32:0);this.runtime.call(`ghostty_key_event_set_mods`,this.keyEvent,n),this.runtime.call(`ghostty_key_event_set_consumed_mods`,this.keyEvent,B(e)),this.runtime.call(`ghostty_key_event_set_composing`,this.keyEvent,+!!e.isComposing),this.runtime.call(`ghostty_key_event_set_unshifted_codepoint`,this.keyEvent,V(e,this.keyboardLayoutMap));let r=e.key.length===1?e.key:``,i=ot.encode(r),a=i.length===0?0:this.runtime.alloc(i.length);a!==0&&this.runtime.bytes(a,i.length).set(i),this.runtime.call(`ghostty_key_event_set_utf8`,this.keyEvent,a,i.length);let o=this.runtime.call(`ghostty_wasm_alloc_usize`),s=this.encodeOutput(o,(e,t)=>this.runtime.call(`ghostty_key_encoder_encode`,this.keyEncoder,this.keyEvent,e,t,o));return this.runtime.call(`ghostty_wasm_free_usize`,o),a!==0&&this.runtime.free(a,i.length),s}encodePaste(e){this.ensureActive();let t=ot.encode(e);if(t.length===0)return``;let n=this.runtime.alloc(t.length);this.runtime.bytes(n,t.length).set(t),this.runtime.bytes(this.scratch,1)[0]=0;let r=this.runtime.call(`ghostty_terminal_mode_get`,this.terminal,2004,this.scratch)===W&&this.runtime.bytes(this.scratch,1)[0]!==0,i=this.runtime.call(`ghostty_wasm_alloc_usize`),a=``,o=this.runtime.call(`ghostty_paste_encode`,n,t.length,+!!r,0,0,i),s=this.runtime.view(i,4).getUint32(0,!0);if(o===G&&s>0){let e=this.runtime.alloc(s),o=this.runtime.call(`ghostty_paste_encode`,n,t.length,+!!r,e,s,i),c=this.runtime.view(i,4).getUint32(0,!0);a=o===W?at.decode(this.runtime.bytes(e,c)):``,this.runtime.free(e,s)}return this.runtime.call(`ghostty_wasm_free_usize`,i),this.runtime.free(n,t.length),a}encodeMouse(e){this.ensureActive(),this.runtime.call(`ghostty_mouse_encoder_setopt_from_terminal`,this.mouseEncoder,this.terminal);let t=this.runtime.layout(`GhosttyMouseEncoderSize`),n=this.runtime.alloc(t.size);for(let[r,i]of[[`size`,t.size],[`screen_width`,e.screenWidth],[`screen_height`,e.screenHeight],[`cell_width`,e.cellWidth],[`cell_height`,e.cellHeight],[`padding_top`,e.paddingTop],[`padding_bottom`,e.paddingBottom],[`padding_right`,e.paddingRight],[`padding_left`,e.paddingLeft]])this.runtime.setField(n,`GhosttyMouseEncoderSize`,r,Math.max(0,Math.round(i)));this.runtime.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,2,n),this.runtime.free(n,t.size),this.runtime.bytes(this.scratch,1)[0]=+!!e.anyButtonPressed,this.runtime.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,3,this.scratch),this.runtime.bytes(this.scratch,1)[0]=1,this.runtime.call(`ghostty_mouse_encoder_setopt`,this.mouseEncoder,4,this.scratch),this.runtime.call(`ghostty_mouse_event_set_action`,this.mouseEvent,e.action===`press`?0:e.action===`release`?1:2),e.button===null?this.runtime.call(`ghostty_mouse_event_clear_button`,this.mouseEvent):this.runtime.call(`ghostty_mouse_event_set_button`,this.mouseEvent,e.button),this.runtime.call(`ghostty_mouse_event_set_mods`,this.mouseEvent,e.mods);let r=this.runtime.layout(`GhosttyMousePosition`),i=this.runtime.alloc(r.size),a=this.runtime.view(i,r.size);a.setFloat32(r.fields.x.offset,e.x,!0),a.setFloat32(r.fields.y.offset,e.y,!0),this.runtime.call(`ghostty_mouse_event_set_position`,this.mouseEvent,i),this.runtime.free(i,r.size);let o=this.runtime.call(`ghostty_wasm_alloc_usize`),s=this.encodeOutput(o,(e,t)=>this.runtime.call(`ghostty_mouse_encoder_encode`,this.mouseEncoder,this.mouseEvent,e,t,o));return this.runtime.call(`ghostty_wasm_free_usize`,o),s}setSelection(e,t){this.ensureActive();let n=this.runtime.layout(`GhosttySelection`),r=this.runtime.layout(`GhosttyGridRef`).size,i=this.runtime.alloc(n.size),a=0,o=0;try{this.runtime.setField(i,`GhosttySelection`,`size`,n.size),a=this.gridRef(e.x,e.y,e.tag??1),o=this.gridRef(t.x,t.y,t.tag??1);let r=n.fields.start,s=n.fields.end;this.runtime.bytes(i+r.offset,r.size).set(this.runtime.bytes(a,r.size)),this.runtime.bytes(i+s.offset,s.size).set(this.runtime.bytes(o,s.size)),this.runtime.call(`ghostty_terminal_set`,this.terminal,21,i)}finally{this.runtime.free(a,r),this.runtime.free(o,r),this.runtime.free(i,n.size)}}selectAll(){this.ensureActive();let e=this.runtime.layout(`GhosttySelection`),t=this.runtime.alloc(e.size);try{if(this.runtime.setField(t,`GhosttySelection`,`size`,e.size),this.runtime.call(`ghostty_terminal_select_all`,this.terminal,t)!==W)return null;let n=this.pointFromGridRef(t+e.fields.start.offset,2),r=this.pointFromGridRef(t+e.fields.end.offset,2);return!n||!r?null:(this.runtime.call(`ghostty_terminal_set`,this.terminal,21,t),{start:n,end:r})}finally{this.runtime.free(t,e.size)}}selectionRange(){this.ensureActive();let e=this.runtime.layout(`GhosttySelection`),t=this.runtime.alloc(e.size);try{if(this.runtime.setField(t,`GhosttySelection`,`size`,e.size),this.runtime.call(`ghostty_terminal_get`,this.terminal,31,t)!==W)return null;let n=this.pointFromGridRef(t+e.fields.start.offset,2),r=this.pointFromGridRef(t+e.fields.end.offset,2);return n&&r?{start:n,end:r}:null}finally{this.runtime.free(t,e.size)}}selectWord(e,t){return this.selectAt(`GhosttyTerminalSelectWordOptions`,`ghostty_terminal_select_word`,e,t)}selectLine(e,t){return this.selectAt(`GhosttyTerminalSelectLineOptions`,`ghostty_terminal_select_line`,e,t)}hyperlinkAt(e,t){this.ensureActive();let n=this.gridRef(e,t),r=this.runtime.call(`ghostty_wasm_alloc_usize`),i=this.runtime.call(`ghostty_grid_ref_hyperlink_uri`,n,0,0,r),a=this.runtime.view(r,4).getUint32(0,!0),o=null;if(i===G&&a>0){let e=this.runtime.alloc(a),t=this.runtime.call(`ghostty_grid_ref_hyperlink_uri`,n,e,a,r),i=this.runtime.view(r,4).getUint32(0,!0);t===W&&i>0&&(o=at.decode(this.runtime.bytes(e,i))),this.runtime.free(e,a)}return this.runtime.call(`ghostty_wasm_free_usize`,r),this.runtime.free(n,this.runtime.layout(`GhosttyGridRef`).size),o}clearSelection(){this.ensureActive(),this.runtime.call(`ghostty_terminal_set`,this.terminal,21,0)}snapshot(){this.ensureActive(),this.assertSuccess(`ghostty_render_state_update`,this.runtime.call(`ghostty_render_state_update`,this.renderState,this.terminal));let e=this.getU16(q.cols),t=this.getU16(q.rows),n=this.getU32(q.dirty),r=this.getColor(q.foreground,{r:229,g:231,b:235}),i=this.getColor(q.background,{r:0,g:0,b:0}),a=this.getBool(q.cursorHasValue)?this.getColor(q.cursor,r):r,o=this.getBool(q.cursorInViewport),s=this.getBool(q.cursorVisible)&&o,c=o?this.getU16(q.cursorX):-1,l=o?this.getU16(q.cursorY):-1;(this.rows.length!==t||this.rows.some(t=>t.cells.length!==e))&&(this.rows=Array.from({length:t},()=>({cells:Array.from({length:e},()=>this.emptyCell(r,i)),text:``,isWrapContinuation:!1,wrapsToNext:!1})));let u=new Set;if(n!==0){this.assertSuccess(`ghostty_render_state_get(row iterator)`,this.runtime.call(`ghostty_render_state_get`,this.renderState,q.rowIterator,this.rowIteratorSlot));let a=this.runtime.readPointer(this.rowIteratorSlot),o=0;for(;o<t&&this.runtime.call(`ghostty_render_state_row_iterator_next`,a)!==0;)(n===2||this.getRowBool(a,J.dirty))&&(this.rows[o]=this.readRow(a,e,r,i),u.add(o),this.runtime.memoryBytes()[this.scratch]=0,this.runtime.call(`ghostty_render_state_row_set`,a,0,this.scratch)),o+=1;this.runtime.memoryDataView().setUint32(this.scratch,0,!0),this.runtime.call(`ghostty_render_state_set`,this.renderState,0,this.scratch)}return{cols:e,rows:t,foreground:r,background:i,cursor:a,cursorX:c,cursorY:l,cursorVisible:s,cursorBlinking:this.getBool(q.cursorBlinking),cursorStyle:this.getU32(q.cursorStyle),dirtyRows:u,rowData:this.rows}}selectionText(){this.ensureActive();let e=this.runtime.alloc(K),t=this.runtime.view(e,K);t.setUint32(0,K,!0),t.setUint32(4,0,!0),t.setUint8(8,1),t.setUint8(9,1),t.setUint32(12,0,!0);let n=this.runtime.call(`ghostty_wasm_alloc_usize`),r=this.runtime.call(`ghostty_terminal_selection_format_buf`,this.terminal,e,0,0,n),i=this.runtime.view(n,4).getUint32(0,!0),a=``;if(r===G&&i>0){let t=this.runtime.alloc(i),r=this.runtime.call(`ghostty_terminal_selection_format_buf`,this.terminal,e,t,i,n),o=this.runtime.view(n,4).getUint32(0,!0);r===W&&(a=at.decode(this.runtime.bytes(t,o))),this.runtime.free(t,i)}return this.runtime.call(`ghostty_wasm_free_usize`,n),this.runtime.free(e,K),a}viewportPointToScreen(e,t){return this.convertPoint(e,t,1,2)}screenPointToViewport(e,t){return this.convertPoint(e,t,2,1)}convertPoint(e,t,n,r){this.ensureActive();let i=this.gridRef(e,t,n),a=this.pointFromGridRef(i,r);return this.runtime.free(i,this.runtime.layout(`GhosttyGridRef`).size),a}dispose(){if(!this.disposed){if(this.disposed=!0,this.mouseEvent&&this.runtime.call(`ghostty_mouse_event_free`,this.mouseEvent),this.mouseEncoder&&this.runtime.call(`ghostty_mouse_encoder_free`,this.mouseEncoder),this.keyEvent&&this.runtime.call(`ghostty_key_event_free`,this.keyEvent),this.keyEncoder&&this.runtime.call(`ghostty_key_encoder_free`,this.keyEncoder),this.rowCellsSlot){let e=this.runtime.readPointer(this.rowCellsSlot);e&&this.runtime.call(`ghostty_render_state_row_cells_free`,e)}if(this.rowIteratorSlot){let e=this.runtime.readPointer(this.rowIteratorSlot);e&&this.runtime.call(`ghostty_render_state_row_iterator_free`,e)}this.renderState&&this.runtime.call(`ghostty_render_state_free`,this.renderState),this.terminal&&(this.ptyWriterId&&this.runtime.detachPtyWriter(this.terminal,this.ptyWriterId),this.runtime.call(`ghostty_terminal_free`,this.terminal)),this.style&&this.runtime.free(this.style,this.runtime.layout(`GhosttyStyle`).size),this.cellQuery&&this.runtime.free(this.cellQuery,X.size),this.scrollbar&&this.runtime.free(this.scrollbar,this.runtime.layout(`GhosttyTerminalScrollbar`).size),this.scratch&&this.runtime.free(this.scratch,16),this.graphemes&&this.runtime.free(this.graphemes,this.graphemeCapacity);for(let e of[this.mouseEventSlot,this.mouseEncoderSlot,this.keyEventSlot,this.keyEncoderSlot,this.rowCellsSlot,this.rowIteratorSlot,this.renderStateSlot,this.terminalSlot])this.runtime.freeOpaque(e)}}encodeOutput(e,t){let n=t(0,0),r=this.runtime.view(e,4).getUint32(0,!0);if(n===W&&r===0||n!==G||r===0)return``;let i=this.runtime.alloc(r),a=t(i,r),o=this.runtime.view(e,4).getUint32(0,!0),s=a===W?at.decode(this.runtime.bytes(i,o)):``;return this.runtime.free(i,r),s}readRow(e,t,n,r){this.assertSuccess(`ghostty_render_state_row_get(raw)`,this.runtime.call(`ghostty_render_state_row_get`,e,J.raw,this.scratch));let i=this.runtime.memoryDataView().getBigUint64(this.scratch,!0);this.runtime.memoryBytes()[this.scratch+8]=0,this.assertSuccess(`ghostty_row_get(wrap continuation)`,this.runtime.call(`ghostty_row_get`,i,2,this.scratch+8));let a=this.runtime.memoryBytes()[this.scratch+8]!==0;this.runtime.memoryBytes()[this.scratch+8]=0,this.assertSuccess(`ghostty_row_get(wrap)`,this.runtime.call(`ghostty_row_get`,i,1,this.scratch+8));let o=this.runtime.memoryBytes()[this.scratch+8]!==0;this.assertSuccess(`ghostty_render_state_row_get(cells)`,this.runtime.call(`ghostty_render_state_row_get`,e,J.cells,this.rowCellsSlot));let s=this.runtime.readPointer(this.rowCellsSlot),{size:c,fields:l}=this.runtime.layout(`GhosttyStyle`),u=this.runtime.fn(`ghostty_render_state_row_cells_next`),d=this.runtime.fn(`ghostty_render_state_row_cells_get_multi`),f=[];for(;f.length<t&&u(s)!==0;){this.runtime.memoryBytes().fill(0,this.style,this.style+c),this.runtime.setField(this.style,`GhosttyStyle`,`size`,c);let e=d(s,5,this.cellQuery+X.keys,this.cellQuery+X.values,this.cellQuery+X.written),i=this.runtime.memoryDataView(),a=i.getUint32(this.cellQuery+X.written,!0);a<3&&this.assertSuccess(`ghostty_render_state_row_cells_get_multi`,e);let o=i.getUint32(this.cellQuery+X.graphemesLength,!0),u=i.getUint8(this.cellQuery+X.selected)!==0,p=a>=4?this.readColor(this.cellQuery+X.background):r,m=a===5?this.readColor(this.cellQuery+X.foreground):a===3?this.getCellColor(s,Y.foreground,n):n,h=``;if(o>0){let e=o*4;if(e>this.graphemeCapacity){let t=Math.max(e,this.graphemeCapacity*2),n=this.runtime.alloc(t);this.runtime.free(this.graphemes,this.graphemeCapacity),this.graphemes=n,this.graphemeCapacity=t}this.runtime.call(`ghostty_render_state_row_cells_get`,s,Y.graphemes,this.graphemes)===W&&(h=lt(this.runtime.memoryDataView(),o,this.graphemes))}let g=0;if(h.length===0&&(f.at(-1)?.text.length||f.length===t-1)){this.assertSuccess(`ghostty_render_state_row_cells_get(raw)`,this.runtime.call(`ghostty_render_state_row_cells_get`,s,Y.raw,this.scratch));let e=this.runtime.memoryDataView().getBigUint64(this.scratch,!0);this.runtime.memoryDataView().setUint32(this.scratch+8,0,!0),this.assertSuccess(`ghostty_cell_get(wide)`,this.runtime.call(`ghostty_cell_get`,e,rt.wide,this.scratch+8)),g=this.runtime.memoryDataView().getUint32(this.scratch+8,!0)}let _=this.runtime.memoryDataView();_.getUint8(this.style+l.inverse.offset)!==0&&([m,p]=[p,m]),_.getUint8(this.style+l.faint.offset)!==0&&(m=st(m,p)),f.push({text:h,wide:g,foreground:m,background:p,bold:_.getUint8(this.style+l.bold.offset)!==0,italic:_.getUint8(this.style+l.italic.offset)!==0,invisible:_.getUint8(this.style+l.invisible.offset)!==0,strikethrough:_.getUint8(this.style+l.strikethrough.offset)!==0,overline:_.getUint8(this.style+l.overline.offset)!==0,underline:_.getInt32(this.style+l.underline.offset,!0)!==0,selected:u})}for(;f.length<t;)f.push(this.emptyCell(n,r));return{cells:f,text:f.map(e=>e.text||` `).join(``).trimEnd(),isWrapContinuation:a,wrapsToNext:o}}gridRef(e,t,n=1){let r=this.runtime.layout(`GhosttyPoint`),i=this.runtime.alloc(r.size);this.runtime.setField(i,`GhosttyPoint`,`tag`,n);let a=r.fields.value,o=a.offset,s=this.runtime.view(i+o,a.size);s.setUint16(0,Math.max(0,e),!0),s.setUint32(4,Math.max(0,t),!0);let c=this.runtime.layout(`GhosttyGridRef`).size,l=this.runtime.alloc(c);this.runtime.setField(l,`GhosttyGridRef`,`size`,c);let u=this.runtime.call(`ghostty_terminal_grid_ref`,this.terminal,i,l);return this.runtime.free(i,r.size),u!==W&&(this.runtime.free(l,c),this.assertSuccess(`ghostty_terminal_grid_ref`,u)),l}selectAt(e,t,n,r){this.ensureActive();let i=this.runtime.layout(e),a=this.runtime.layout(`GhosttySelection`),o=this.runtime.alloc(i.size),s=0,c=0,l=null;try{this.runtime.setField(o,e,`size`,i.size),s=this.gridRef(n,r);let u=i.fields.ref;if(this.runtime.bytes(o+u.offset,u.size).set(this.runtime.bytes(s,u.size)),c=this.runtime.alloc(a.size),this.runtime.setField(c,`GhosttySelection`,`size`,a.size),this.runtime.call(t,this.terminal,o,c)===W){let e=c+a.fields.start.offset,t=c+a.fields.end.offset,n=this.pointFromGridRef(e,1),r=this.pointFromGridRef(t,1),i=this.pointFromGridRef(e,2),o=this.pointFromGridRef(t,2);n&&r&&i&&o&&(l={viewport:{start:n,end:r},screen:{start:i,end:o}}),this.runtime.call(`ghostty_terminal_set`,this.terminal,21,c)}}finally{this.runtime.free(c,a.size),this.runtime.free(s,this.runtime.layout(`GhosttyGridRef`).size),this.runtime.free(o,i.size)}return l}pointFromGridRef(e,t){let n=this.runtime.layout(`GhosttyPointCoordinate`),r=this.runtime.alloc(n.size),i=this.runtime.call(`ghostty_terminal_point_from_grid_ref`,this.terminal,e,t,r)===W?{x:this.runtime.readField(r,`GhosttyPointCoordinate`,`x`),y:this.runtime.readField(r,`GhosttyPointCoordinate`,`y`)}:null;return this.runtime.free(r,n.size),i}getU16(e){return this.runtime.memoryDataView().setUint16(this.scratch,0,!0),this.assertSuccess(`ghostty_render_state_get`,this.runtime.call(`ghostty_render_state_get`,this.renderState,e,this.scratch)),this.runtime.memoryDataView().getUint16(this.scratch,!0)}getU32(e){return this.runtime.memoryDataView().setUint32(this.scratch,0,!0),this.assertSuccess(`ghostty_render_state_get`,this.runtime.call(`ghostty_render_state_get`,this.renderState,e,this.scratch)),this.runtime.memoryDataView().getUint32(this.scratch,!0)}getBool(e){return this.runtime.memoryBytes()[this.scratch]=0,this.assertSuccess(`ghostty_render_state_get`,this.runtime.call(`ghostty_render_state_get`,this.renderState,e,this.scratch)),this.runtime.memoryBytes()[this.scratch]!==0}getColor(e,t){return this.runtime.memoryBytes().fill(0,this.scratch,this.scratch+3),this.runtime.call(`ghostty_render_state_get`,this.renderState,e,this.scratch)===W?this.readColor(this.scratch):t}getRowBool(e,t){return this.runtime.memoryBytes()[this.scratch]=0,this.runtime.call(`ghostty_render_state_row_get`,e,t,this.scratch)===W&&this.runtime.memoryBytes()[this.scratch]!==0}getCellColor(e,t,n){return this.runtime.memoryBytes().fill(0,this.scratch,this.scratch+3),this.runtime.call(`ghostty_render_state_row_cells_get`,e,t,this.scratch)===W?this.readColor(this.scratch):n}readColor(e){let t=this.runtime.memoryDataView();return{r:t.getUint8(e),g:t.getUint8(e+1),b:t.getUint8(e+2)}}emptyCell(e,t){return{text:``,wide:0,foreground:e,background:t,bold:!1,italic:!1,invisible:!1,strikethrough:!1,overline:!1,underline:!1,selected:!1}}assertSuccess(e,t){if(t!==W)throw Error(`${e} failed with result ${t}`)}ensureActive(){if(this.disposed)throw Error(`libghostty-vt terminal has been disposed`)}};function dt(e,t){return ct(e,t)}var Z=`rgba(72, 122, 191, 0.35)`;function Q(e){return`rgb(${e.r}, ${e.g}, ${e.b})`}function ft(e,t){return dt(e.foreground,t.foreground)&&e.bold===t.bold&&e.italic===t.italic&&e.invisible===t.invisible}function pt(e,t,n){let r=t+1;for(;r<e.length;){let t=e[r];if(!t)break;if(t.wide===it.spacerTail)r+=1;else{if(t.text.length===0||!n(t))break;r+=1}}return r}function mt(e,t,n){return`${e.italic?`italic`:`normal`} ${e.bold?`700`:`400`} ${t}px ${n}`}function ht(e,t,n){e.font=`normal 400 ${t}px ${n}`;let r=e.measureText(`M`),i=e.measureText(`Mg`),a=i.actualBoundingBoxAscent||t,o=a+i.actualBoundingBoxDescent,s=Math.max(1,Math.round(t*1.35),Math.ceil(o));return{width:Math.max(1,r.width),height:s,baseline:Math.round((s-o)/2+a)}}function gt(e,t,n,r){return{cols:Math.max(1,Math.floor((e-r*2)/n.width)),rows:Math.max(1,Math.floor((t-r*2)/n.height))}}function _t(e){let{context:t,snapshot:n,metrics:r,fontSize:i,fontFamily:a,padding:o,forceFull:s,cursorOn:c,previousCursorY:l}=e,u=e.focused??!0,d=e.selectionBackground??Z,f=e.hoveredLinkRange??null,p=e.originY??o,m=s?Array.from({length:n.rows},(e,t)=>t):[...n.dirtyRows];l!=null&&l>=0&&!m.includes(l)&&m.push(l),n.cursorVisible&&n.cursorY>=0&&!m.includes(n.cursorY)&&m.push(n.cursorY),s&&(t.save(),t.resetTransform(),t.fillStyle=Q(n.background),t.fillRect(0,0,t.canvas.width,t.canvas.height),t.restore()),t.textBaseline=`alphabetic`;for(let e of m){let s=n.rowData[e];if(!s)continue;let c=p+e*r.height;t.fillStyle=Q(n.background),t.fillRect(o,c,n.cols*r.width,r.height);let l=0;for(;l<s.cells.length;){let e=s.cells[l];if(!e)break;let i=l+1;for(;i<s.cells.length;){let t=s.cells[i];if(!t||t.selected!==e.selected||!dt(t.background,e.background))break;i+=1}if(e.selected||!dt(e.background,n.background)){let a=o+l*r.width,s=(i-l)*r.width;dt(e.background,n.background)||(t.fillStyle=Q(e.background),t.fillRect(a,c,s,r.height)),e.selected&&(t.fillStyle=d,t.fillRect(a,c,s,r.height))}l=i}let u=0;for(;u<s.cells.length;){let e=s.cells[u];if(!e)break;if(e.text.length===0){u+=1;continue}let n=pt(s.cells,u,t=>ft(t,e)),l=s.cells.slice(u,n).map(e=>e.text).join(``);!e.invisible&&l.trim().length>0&&(t.save(),t.beginPath(),t.rect(o+u*r.width,c,(n-u)*r.width,r.height),t.clip(),t.font=mt(e,i,a),t.fillStyle=Q(e.foreground),t.fillText(l,o+u*r.width,c+r.baseline,(n-u)*r.width),t.restore()),u=n}for(let n=0;n<s.cells.length;n+=1){let i=s.cells[n],a=f!==null&&e>=f.start.y&&e<=f.end.y&&(e>f.start.y||n>=f.start.x)&&(e<f.end.y||n<=f.end.x);if(!i||!i.underline&&!i.strikethrough&&!i.overline&&!a)continue;t.fillStyle=Q(i.foreground);let l=o+n*r.width;(i.underline||a)&&t.fillRect(l,c+r.height-2,r.width,1),i.strikethrough&&t.fillRect(l,c+Math.floor(r.height*.55),r.width,1),i.overline&&t.fillRect(l,c+1,r.width,1)}}if(c&&n.cursorVisible&&n.cursorX>=0&&n.cursorY>=0){let e=o+n.cursorX*r.width,s=p+n.cursorY*r.height;if(t.fillStyle=Q(n.cursor),!u)t.strokeStyle=Q(n.cursor),t.strokeRect(e+.5,s+.5,r.width-1,r.height-1);else if(n.cursorStyle===0)t.fillRect(e,s,2,r.height);else if(n.cursorStyle===2)t.fillRect(e,s+r.height-2,r.width,2);else if(n.cursorStyle===3)t.strokeStyle=Q(n.cursor),t.strokeRect(e+.5,s+.5,r.width-1,r.height-1);else{t.fillRect(e,s,r.width,r.height);let o=n.rowData[n.cursorY]?.cells[n.cursorX];o?.text&&(t.font=mt(o,i,a),t.fillStyle=Q(n.background),t.fillText(o.text,e,s+r.baseline,r.width))}}}var vt=`/assets/SymbolsNerdFontMono-Regular-aK5vsLov.woff2`,yt=6,bt=32,xt=`"Symbols Nerd Font Mono", "Symbols Nerd Font", "JetBrainsMono Nerd Font", "JetBrainsMono NF", "FiraCode Nerd Font", "Hack Nerd Font", "MesloLGS NF", "CaskaydiaCove Nerd Font", "PowerlineSymbols", monospace`,St=`"SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", `+xt,$=4,Ct=18,wt=500,Tt=250,Et=`iMW0@# .`,Dt=[`normal 400`,`normal 700`,`italic 400`,`italic 700`],Ot=null;function kt(){return Ot===null&&(Ot=(async()=>{try{let e=new FontFace(`Symbols Nerd Font Mono`,`url(${vt})`);document.fonts.add(await e.load())}catch{}})()),Ot}function At(e){return e.split(`,`).map(e=>{let t=e.trim();return t.length===0?``:/^(['"]).*\1$/.test(t)||/^[a-zA-Z][a-zA-Z0-9-]*$/.test(t)?t:`"${t.replaceAll(`"`,``)}"`}).filter(e=>e.length>0).join(`, `)}function jt(e){let t=e===void 0?``:At(e);return t.length===0?St:`${t}, ${xt}`}function Mt(e){let t=e===void 0?``:At(e);return t.length===0||!Ge(t)?St:jt(t)}async function Nt(e,t,n){let r=jt(e),i=n?.load??((e,t)=>document.fonts.load(e,t));try{await Promise.all(Dt.map(e=>i(`${e} ${t}px ${r}`,Et)))}catch{}return(n?.resolve??Mt)(e)}function Pt(e){return e===void 0||!Number.isFinite(e)?12:Math.max(yt,Math.min(bt,Math.round(e)))}function Ft(e){return e.focused&&e.cursorBlinking&&e.cursorVisible&&!e.reducedMotion}function It(e,t,n,r,i){if(!i)return t;let a=e-t*2-n*r;return t+Math.max(0,a)}function Lt(e,t){let n=Math.max(0,e.total),r=Math.max(0,Math.min(e.len,n)),i=Math.max(0,n-r);if(t<=0||r<=0||i===0)return null;let a=Math.min(t,Math.max(Ct,t*r/n));return{thumbHeight:a,thumbTop:Math.max(0,t-a)*(Math.max(0,Math.min(e.offset,i))/i),maxOffset:i}}function Rt(e,t,n,r){let i=Lt(e,t);if(i===null)return 0;let a=Math.max(0,t-i.thumbHeight);if(a===0)return 0;let o=Math.max(0,Math.min(n-r,a));return Math.round(o/a*i.maxOffset)}function zt(e){let{bounds:t,clientX:n,clientY:r,cols:i,rows:a,metrics:o,padding:s,originY:c}=e,l=n-t.left-s,u=r-t.top-c;return l<0||u<0||l>=i*o.width||u>=a*o.height?null:{x:Math.floor(l/o.width),y:Math.floor(u/o.height)}}function Bt(e){return e.wide===it.spacerTail||e.wide===it.spacerHead?``:e.text||` `}function Vt(e,t){let n=e.cells.map(Bt).join(``);return t?n.trimEnd():n}function Ht(e,t){let n=0;for(let r=0;r<t;r+=1){let t=e.cells[r];n+=t?Bt(t).length:1}return n}function Ut(e,t){return t?.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}function Wt(e,t){for(let n=0;n<e.cells.length;n+=1)if(t<Ht(e,n+1))return n;return Math.max(0,e.cells.length-1)}function Gt(e,t,n){let r=N(t+1,t=>{let n=e[t];return n?{isWrapped:n.isWrapContinuation,translateToString:(e=!1)=>Vt(n,e)}:null});if(!r)return null;let i=r.segments[0];if(i&&e[i.bufferLineNumber-1]?.isWrapContinuation)return null;let a=r.segments.find(e=>e.bufferLineNumber===t+1),o=e[t];if(!a||!o)return null;let s=r.segments.at(-1),c=s?e[s.bufferLineNumber-1]:void 0,l=c!==void 0&&c.wrapsToNext,u=o.cells[n]?.wide===it.spacerTail?n-1:n,d=a.startIndex+Ht(o,u);for(let t of M(r.text))if(d>=t.start&&d<t.end){if(t.end===r.text.length&&l)return null;let n=r.segments.find(e=>t.start>=e.startIndex&&t.start<e.endIndex),i=r.segments.find(e=>t.end-1>=e.startIndex&&t.end-1<e.endIndex),a=n?e[n.bufferLineNumber-1]:void 0,o=i?e[i.bufferLineNumber-1]:void 0;if(!n||!i||!a||!o)return null;let s=Wt(o,t.end-1-i.startIndex);return{text:t.text,range:{start:{x:Wt(a,t.start-n.startIndex),y:n.bufferLineNumber-1},end:{x:o.cells[s+1]?.wide===it.spacerTail?s+1:s,y:i.bufferLineNumber-1}}}}return null}function Kt(e,t=navigator.platform){let n=e.key.toLowerCase();return n===`insert`&&!l(t)?e.ctrlKey&&!e.shiftKey&&!e.metaKey:n===`c`?l(t)?e.metaKey:e.ctrlKey:!1}function qt(e,t){e.value=t,t.length!==0&&e.select()}function Jt(e,t){t.length!==0&&e.value===t&&(e.value=``)}function Yt(e,t){return e.length===0||!t?{preventDefault:!1,claimWriteFallback:!1}:(t.setData(`text/plain`,e),{preventDefault:!0,claimWriteFallback:!0})}function Xt(e,t=navigator.platform){let n=e.key.toLowerCase();return n===`insert`&&!l(t)?e.shiftKey&&!e.ctrlKey&&!e.metaKey:n===`v`?l(t)?e.metaKey:e.ctrlKey&&e.shiftKey:!1}function Zt(){return/linux|bsd/i.test(navigator.platform)}function Qt(e){return e.inputType===``||e.inputType===`insertCompositionText`||e.inputType===`insertFromComposition`}function $t(e,t){return e.isComposing||t||e.key===`Process`||e.keyCode===229}function en(e){return e.getModifierState(`AltGraph`)&&[...e.key].length===1}function tn(e,t){return e&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey}function nn(e,t,n){let r=e===`motion`?t:``;return{send:t.length>0&&(e!==`motion`||t!==n),nextMotionData:r}}function rn(e,t,n){return{tracking:t,motionData:e===t?n:``}}function an(e,t,n,r){let i=r+(e.deltaMode===1?e.deltaY*t:e.deltaMode===2?e.deltaY*n*t:e.deltaY)/t,a=Math.trunc(i);return{rows:a,remainder:i-a}}var on=50;function sn(e,t,n){let r=e<t?e-t:e>n?e-n:0;if(r===0)return 0;let i=Math.max(-1,Math.min(1,r/on));return Math.sign(i)+Math.round(i*14)}function cn(e,t){return e===0?``:(e<0?t?`\x1BOA`:`\x1B[A`:t?`\x1BOB`:`\x1B[B`).repeat(Math.abs(e))}function ln(e){switch(e){case 0:return 1;case 1:return 3;case 2:return 2;case 3:return 4;case 4:return 5;default:return null}}var un=4;function dn(e,t){return{count:e!==null&&t.timeStamp-e.time<=500&&Math.hypot(t.clientX-e.x,t.clientY-e.y)<=un?e.count>=3?1:e.count+1:1,time:t.timeStamp,x:t.clientX,y:t.clientY}}var fn=class e{canvas;input;scrollbar;cols=1;rows=1;mount;measuredCols=1;measuredRows=1;sharedGrid=null;context;core;options;visible;hasSize=!1;metrics;fontFamily;requestedFontFamily;fontSize;fontEpoch=0;pendingFontEpoch=null;stopObservingResize;scrollbarThumb;snapshot=null;frame=0;cursorTimer=null;compositionInputToSuppress=null;compositionSuppressionTimer=null;cursorOn=!0;renderedCursorY=null;forceFullRender=!0;canvasResizedSinceRender=!1;scrollbarDirty=!0;scrollbarState=null;scrollbarPointerId=null;scrollbarPointerOffset=0;disposed=!1;resizeNotifyTimer=null;originY=$;mountHeight=0;selectionEnd=null;selectionAnchorScreen=null;selectionMode=`cell`;selectionBase=null;selectionScrollTimer=null;selectionScrollDelta=0;selectionPointer=null;mouseReportingPointerId=null;mouseReportingButton=null;linkActivationPointerId=null;linkActivationLink=null;linkActivationValidation;linkActivationRequestId=0;linkActivationOrigin=null;hoveredLink=null;hoverPointer=null;linkHoverCandidate=null;linkHoverTimer=null;linkRowStability=[];selectionClickSequence=null;selectionMoved=!1;composing=!1;focused=!1;resizeNotified=!1;canvasConfigured=!1;theme;suppressedKeyCodes=new Set;pasteShortcutToken=0;copyShortcutToken=0;clearSelectionAfterCopy=!1;primedCopySelection=``;wheelRemainder=0;touchScroll=null;lastMouseMotionData=``;mouseAnyEventTracking=!1;dprMedia=null;reducedMotionMedia=window.matchMedia?.(`(prefers-reduced-motion: reduce)`);inputLeft=-1;inputTop=-1;constructor(e,t,n,r,i,a,o,s,c,l){this.mount=e,this.canvas=t,this.input=n,this.scrollbar=r,this.scrollbarThumb=i,this.context=a,this.core=o,this.mouseAnyEventTracking=o.isMouseAnyEventTracking(),this.metrics=s,this.options=l,this.visible=l.visible??!0,this.theme=l.theme,this.fontFamily=c,this.requestedFontFamily=l.font?.family,this.fontSize=Pt(l.font?.size),this.installEvents(),this.watchDevicePixelRatio(),this.reducedMotionMedia?.addEventListener(`change`,this.onReducedMotionChange),document.fonts.addEventListener(`loadingdone`,this.onFontsLoaded),this.stopObservingResize=O(e,()=>this.fit())}static async create(t,n){let r=document.createElement(`canvas`);r.className=`block size-full cursor-text`,r.style.touchAction=`pan-x pinch-zoom`,r.setAttribute(`aria-hidden`,`true`);let i=document.createElement(`textarea`);i.className=`p4-ghostty-input`,i.setAttribute(`aria-label`,`Terminal input`),i.autocapitalize=`off`,i.autocomplete=`off`,i.spellcheck=!1,i.style.cssText=`position:absolute;left:4px;top:4px;width:1px;height:1px;opacity:0;padding:0;border:0;resize:none;pointer-events:none;`;let a=document.createElement(`div`);a.className=`group absolute top-1 right-px bottom-1 z-1 w-[var(--app-scrollbar-width)] cursor-default touch-none`,a.setAttribute(`role`,`scrollbar`),a.setAttribute(`aria-label`,`Terminal scrollback`),a.setAttribute(`aria-orientation`,`vertical`),a.tabIndex=0,a.hidden=!0;let o=document.createElement(`div`);o.className=`absolute inset-x-px top-0 rounded-[3px] bg-[var(--app-scrollbar-thumb)] transition-[background-color] duration-[120ms] ease-[ease-out] group-hover:bg-[var(--app-scrollbar-thumb-hover)] group-focus-visible:bg-[var(--app-scrollbar-thumb-hover)]`,a.append(o),t.replaceChildren(r,i,a);let s=r.getContext(`2d`,{alpha:!1});if(!s)throw Error(`Canvas 2D is unavailable`);s.fillStyle=`rgb(${n.theme.background.r}, ${n.theme.background.g}, ${n.theme.background.b})`,s.fillRect(0,0,r.width,r.height);let c=Pt(n.font?.size);try{await kt()}catch{}let l=await Nt(n.font?.family,c),u=ht(s,c,l),d=gt(t.clientWidth,t.clientHeight,u,$),f=await ut.create(d.cols,d.rows,u.width,u.height,n.theme,n.onData),p=new e(t,r,i,a,o,s,f,u,l,n);return p.fit(),p}setVisible(e){this.disposed||this.visible===e||(this.visible=e,this.cursorOn=!0,this.forceFullRender=!0,this.scrollbarDirty=!0,e?this.fit():(this.linkActivationRequestId+=1,this.clearHoveredLink(),this.linkRowStability=[],this.cancelRender(),this.setSelectionAutoscroll(0)))}write(e){this.disposed||(this.core.write(e),this.synchronizeMouseTrackingState(),this.cursorOn=!0,this.scrollbarDirty=!0,this.requestRender())}resetAndWrite(e){this.disposed||(this.lastMouseMotionData=``,this.core.resetAndWrite(e),this.synchronizeMouseTrackingState(),this.cursorOn=!0,this.forceFullRender=!0,this.scrollbarDirty=!0,this.requestRender())}setTheme(e){this.disposed||(this.theme=e,this.core.setTheme(e),this.forceFullRender=!0,this.requestRender())}refreshLinkActivation(){this.disposed||this.refreshHoveredLink()}async setFont(e){if(this.disposed)return;let t=Pt(e.size),n=++this.fontEpoch;this.pendingFontEpoch=n;let r=await Nt(e.family,t);this.disposed||n!==this.fontEpoch||(this.pendingFontEpoch=null,this.fontFamily=r,this.requestedFontFamily=e.family,this.fontSize=t,this.applyFontMetrics())}applyFontMetrics(){this.metrics=ht(this.context,this.fontSize,this.fontFamily),this.core.resize(this.cols,this.rows,this.metrics.width,this.metrics.height),this.inputLeft=-1,this.inputTop=-1,this.forceFullRender=!0,this.scrollbarDirty=!0,this.fit(),this.requestRender()}onReducedMotionChange=()=>{this.disposed||(this.cursorOn=!0,this.requestRender())};onFontsLoaded=()=>{if(this.disposed||this.pendingFontEpoch!==null)return;let e=Mt(this.requestedFontFamily);if(e!==this.fontFamily){this.fontFamily=e,this.applyFontMetrics();return}let t=ht(this.context,this.fontSize,this.fontFamily);(t.width!==this.metrics.width||t.height!==this.metrics.height||t.baseline!==this.metrics.baseline)&&this.applyFontMetrics()};resendSize(){this.resizeNotified=!1,this.fit()}fit(){if(this.disposed||!this.visible)return!1;let e=this.mount.clientWidth,t=this.mount.clientHeight;if(e<=0||t<=0)return this.hasSize=!1,this.forceFullRender=!0,this.cancelRender(),!1;this.hasSize=!0;let n=window.devicePixelRatio||1,r=Math.max(1,Math.round(e*n)),i=Math.max(1,Math.round(t*n)),a=!1;this.canvas.width===r&&this.canvas.height===i&&this.canvasConfigured||(this.canvas.width=r,this.canvas.height=i,this.context.setTransform(n,0,0,n,0,0),this.canvasConfigured=!0,this.canvasResizedSinceRender=!0,this.forceFullRender=!0,this.scrollbarDirty=!0,a=!0);let o=gt(e,t,this.metrics,$);return this.mountHeight=t,o.cols===this.measuredCols&&o.rows===this.measuredRows&&this.resizeNotified||(this.measuredCols=o.cols,this.measuredRows=o.rows,this.notifyResize()),this.applyGrid()&&(a=!0),(a||this.forceFullRender)&&this.renderFrame(),!0}setSharedGrid(e){this.disposed||(this.sharedGrid?.cols!==e?.cols||this.sharedGrid?.rows!==e?.rows)&&(this.sharedGrid=e,this.hasSize&&this.applyGrid()&&this.requestRender())}applyGrid(){let e=Math.min(this.sharedGrid?.cols??this.measuredCols,this.measuredCols),t=Math.min(this.sharedGrid?.rows??this.measuredRows,this.measuredRows);return e===this.cols&&t===this.rows?!1:(this.cols=e,this.rows=t,this.core.resize(e,t,this.metrics.width,this.metrics.height),this.forceFullRender=!0,this.scrollbarDirty=!0,!0)}notifyResize(){this.resizeNotified=!0,this.resizeNotifyTimer!==null&&window.clearTimeout(this.resizeNotifyTimer),this.resizeNotifyTimer=window.setTimeout(()=>{this.resizeNotifyTimer=null,this.disposed||this.options.onResize(this.measuredCols,this.measuredRows)},150)}onWindowPointerRelease=()=>{this.disposed||this.resizeNotifyTimer===null||(this.fit(),this.resizeNotifyTimer!==null&&(window.clearTimeout(this.resizeNotifyTimer),this.resizeNotifyTimer=null,this.options.onResize(this.measuredCols,this.measuredRows)))};focus(){!this.disposed&&this.visible&&this.input.focus({preventScroll:!0})}async pasteFromClipboard(e,t=()=>!0){let n=++this.pasteShortcutToken,r=await e();if(this.disposed||this.pasteShortcutToken!==n||!t()||(this.pasteShortcutToken+=1,r.length===0))return;let i=this.core.encodePaste(r);i.length>0&&this.options.onData(i)}pasteTerminalSelection(){let e=this.getSelection();e.length!==0&&this.pasteFromClipboard(()=>Promise.resolve(e))}hasSelection(){return this.core.selectionText().length>0}getSelection(){return this.core.selectionText()}getSelectionCellCount(){let e=this.core.selectionRange();return e?(Math.abs(e.end.y-e.start.y)+1)*this.cols:0}selectAll(){this.linkActivationRequestId+=1,this.clearPrimedCopy();let e=this.core.selectAll();this.selectionAnchorScreen=e?.start??null,this.selectionEnd=e?this.core.screenPointToViewport(e.end.x,e.end.y):null,this.selectionMode=`cell`,this.selectionBase=null,this.setSelectionAutoscroll(0),this.options.onSelectionChange(),this.forceFullRender=!0,this.requestRender()}getSelectionPosition(){let e=this.hasSelection()?this.core.selectionRange():null;if(!e)return null;let{start:t,end:n}=e;return t.y<n.y||t.y===n.y&&t.x<=n.x?{start:t,end:n}:{start:n,end:t}}getSelectionEndClientRect(){let e=this.getSelectionPosition();if(!e)return null;let t=this.core.screenPointToViewport(e.end.x,e.end.y);if(!t||t.x<0||t.x>=this.cols||t.y<0||t.y>=this.rows)return null;let n=this.canvas.getBoundingClientRect();return{right:n.left+$+(t.x+1)*this.metrics.width,bottom:n.top+this.originY+(t.y+1)*this.metrics.height}}clearSelection({source:e=`user`}={}){e===`user`&&(this.linkActivationRequestId+=1),this.clearPrimedCopy(),this.core.clearSelection(),this.selectionEnd=null,this.selectionAnchorScreen=null,this.selectionMode=`cell`,this.selectionBase=null,this.setSelectionAutoscroll(0),this.options.onSelectionChange(),this.forceFullRender=!0,this.requestRender()}scrollToBottom(){this.core.scrollToBottom(),this.forceFullRender=!0,this.scrollbarDirty=!0,this.requestRender()}isAtBottom(){return this.core.isViewportActive()}dispose(){this.disposed||(this.disposed=!0,this.clearHoveredLink(),this.stopObservingResize(),document.fonts.removeEventListener(`loadingdone`,this.onFontsLoaded),this.dprMedia?.removeEventListener(`change`,this.onDevicePixelRatioChange),this.dprMedia=null,this.reducedMotionMedia?.removeEventListener(`change`,this.onReducedMotionChange),this.selectionScrollTimer!==null&&window.clearInterval(this.selectionScrollTimer),this.resizeNotifyTimer!==null&&(window.clearTimeout(this.resizeNotifyTimer),this.resizeNotifyTimer=null,this.options.onResize(this.measuredCols,this.measuredRows)),this.cancelRender(),this.compositionSuppressionTimer!==null&&window.clearTimeout(this.compositionSuppressionTimer),this.removeEvents(),this.core.dispose(),(this.canvas.parentElement===this.mount||this.input.parentElement===this.mount||this.scrollbar.parentElement===this.mount)&&(this.canvas.remove(),this.input.remove(),this.scrollbar.remove()))}onKeyDown=e=>{if(en(e)||!this.options.beforeKey(e)||$t(e,this.composing)){this.suppressedKeyCodes.add(e.code);return}let t=l(navigator.platform),n=t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey;if(e.key.toLowerCase()===`a`&&n&&!e.altKey&&(t?!e.shiftKey:e.shiftKey)){e.preventDefault(),e.stopPropagation(),this.suppressedKeyCodes.add(e.code),this.selectAll();return}let r=e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&(e.key===`PageUp`||e.key===`PageDown`),i=e.shiftKey&&!e.altKey&&n&&(e.key===`Home`||e.key===`End`);if((r||i)&&!this.core.isAlternateScreen()){let t=this.readScrollbarState();if(t!==null){e.preventDefault(),e.stopPropagation(),this.suppressedKeyCodes.add(e.code);let n=e.key===`Home`?-t.offset:e.key===`End`?t.total-t.len-t.offset:Math.max(1,t.len)*(e.key===`PageUp`?-1:1);this.scrollViewport(n);return}}if(Kt(e)&&this.hasSelection()){let t=this.getSelection();if(this.primeCopy(t),e.shiftKey||e.key.toLowerCase()===`insert`)e.preventDefault(),document.execCommand(`copy`);else{this.clearSelectionAfterCopy=!e.shiftKey&&!l(navigator.platform);let n=navigator.clipboard;if(typeof n?.writeText==`function`){let e=++this.copyShortcutToken;Promise.resolve().then(()=>{this.disposed||this.copyShortcutToken!==e||n.writeText(t).then(()=>{this.disposed||this.copyShortcutToken!==e||this.clearSelectionAfterCopy&&(this.clearSelectionAfterCopy=!1,this.clearSelection())},()=>{this.copyShortcutToken===e&&(this.clearSelectionAfterCopy=!1)})})}}this.suppressedKeyCodes.add(e.code);return}if(Xt(e)){this.suppressedKeyCodes.add(e.code);let t=navigator.clipboard;if(typeof t?.readText==`function`){let e=++this.pasteShortcutToken;t.readText().then(t=>{this.disposed||this.pasteShortcutToken!==e||(this.pasteShortcutToken+=1,t.length>0&&this.options.onData(this.core.encodePaste(t)))},()=>{})}return}this.clearPrimedCopy();let a=this.core.encodeKey(e);a.length!==0&&(this.suppressedKeyCodes.delete(e.code),e.preventDefault(),e.stopPropagation(),this.options.onData(a))};onKeyUp=e=>{if(this.suppressedKeyCodes.delete(e.code)||$t(e,this.composing))return;let t=this.core.encodeKey(e,`release`);t.length!==0&&(e.preventDefault(),e.stopPropagation(),this.options.onData(t))};onFocus=()=>{this.focused=!0,this.cursorOn=!0,this.requestRender()};onBlur=()=>{this.focused=!1,this.refreshHoveredLink(),this.cursorOn=!0,this.requestRender()};onDevicePixelRatioChange=()=>{this.watchDevicePixelRatio(),this.fit()};watchDevicePixelRatio(){this.dprMedia?.removeEventListener(`change`,this.onDevicePixelRatioChange),this.dprMedia=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this.dprMedia.addEventListener(`change`,this.onDevicePixelRatioChange)}primeCopy(e){this.primedCopySelection=e,qt(this.input,e)}clearPrimedCopy(){Jt(this.input,this.primedCopySelection),this.primedCopySelection=``}onCopyEvent=e=>{let t=this.hasSelection()?this.getSelection():this.input.value;this.primeCopy(t);let n=Yt(t,e.clipboardData);n.preventDefault&&e.preventDefault(),n.claimWriteFallback&&(this.copyShortcutToken+=1,this.clearSelectionAfterCopy&&(this.clearSelectionAfterCopy=!1,this.clearSelection()))};onPaste=e=>{e.preventDefault();let t=e.clipboardData?.getData(`text/plain`)??``;t.length!==0&&(this.pasteShortcutToken+=1,this.options.onData(this.core.encodePaste(t)))};onCompositionStart=()=>{this.clearPrimedCopy(),this.clearCompositionInputSuppression(),this.composing=!0};onCompositionEnd=e=>{this.composing=!1;let t=this.input.value||e.data;t.length>0&&this.options.onData(t),this.input.value=``,this.compositionInputToSuppress=t,this.compositionSuppressionTimer=window.setTimeout(()=>{this.compositionInputToSuppress=null,this.compositionSuppressionTimer=null},100)};onInput=e=>{let t=e;if(this.composing||t.isComposing)return;let n=this.input.value||t.data||``;n===this.compositionInputToSuppress&&Qt(t)?(this.clearCompositionInputSuppression(),this.input.value=``):(this.clearCompositionInputSuppression(),n.length>0&&this.options.onData(n),this.input.value=``)};clearCompositionInputSuppression(){this.compositionSuppressionTimer!==null&&(window.clearTimeout(this.compositionSuppressionTimer),this.compositionSuppressionTimer=null),this.compositionInputToSuppress=null}onPointerDown=e=>{if(this.linkActivationRequestId+=1,e.pointerType===`touch`){if(e.preventDefault(),!e.isPrimary||this.touchScroll!==null)return;this.touchScroll={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,lastY:e.clientY,remainder:0,moved:!1},this.clearHoveredLink(),this.canvas.setPointerCapture(e.pointerId);return}if(this.focus(),tn(this.core.isMouseTracking(),e)){let t=ln(e.button);if(t===null)return;e.preventDefault(),e.stopPropagation(),this.clearHoveredLink(`default`),this.mouseReportingPointerId=e.pointerId,this.mouseReportingButton=t,this.sendMouse(`press`,t,e),this.canvas.setPointerCapture(e.pointerId);return}if(e.button===1&&Zt()){this.pasteTerminalSelection();return}if(e.button!==0)return;let t=this.recordSelectionClick(e),n=this.linkAt(e.clientX,e.clientY,!0);n&&!e.shiftKey&&t===1?(e.preventDefault(),e.stopPropagation(),this.linkActivationPointerId=e.pointerId,this.linkActivationLink=n,this.linkActivationValidation=this.validateLink(n.text),this.linkActivationOrigin={x:e.clientX,y:e.clientY,clickCount:t},this.canvas.setPointerCapture(e.pointerId)):(this.clearHoveredLink(),this.beginSelection(e,t),this.canvas.setPointerCapture(e.pointerId))};recordSelectionClick(e){return this.selectionClickSequence=dn(this.selectionClickSequence,e),this.selectionClickSequence.count}beginSelection(e,t){let n=this.cellAt(e.clientX,e.clientY);this.selectionMoved=!1,this.selectionMode=t>=3?`line`:t===2?`word`:`cell`;let r=this.selectionMode===`line`?this.core.selectLine(n.x,n.y):this.selectionMode===`word`?this.core.selectWord(n.x,n.y):null;if(r)this.selectionBase=r.screen,this.selectionEnd=r.viewport.end,this.selectionAnchorScreen=r.screen.start,this.options.onSelectionChange();else{this.selectionMode=`cell`,this.selectionBase=null,this.selectionEnd=n;let e=this.core.viewportPointToScreen(n.x,n.y);this.selectionAnchorScreen=e,e?this.core.setSelection({...e,tag:2},{...e,tag:2}):this.core.setSelection(n,n)}this.forceFullRender=!0,this.requestRender()}onPointerMove=e=>{if(e.pointerType===`touch`){let t=this.touchScroll;if(t?.pointerId!==e.pointerId||(e.preventDefault(),t.moved||=Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>un,!t.moved))return;let n=an({deltaY:t.lastY-e.clientY,deltaMode:0},this.metrics.height,this.rows,t.remainder);t.lastY=e.clientY,t.remainder=n.remainder,this.scrollRows(n.rows,e);return}if(this.linkActivationPointerId===e.pointerId){let t=this.linkActivationOrigin;if(t===null||Math.hypot(e.clientX-t.x,e.clientY-t.y)<=un)return;this.linkActivationPointerId=null,this.linkActivationLink=null,this.linkActivationValidation=void 0,this.linkActivationOrigin=null,this.clearHoveredLink(),this.beginSelection({clientX:t.x,clientY:t.y},t.clickCount)}let t=this.synchronizeMouseTrackingState();if(this.mouseReportingPointerId===e.pointerId||tn(t,e)){e.preventDefault(),this.hoverPointer={x:e.clientX,y:e.clientY},this.setHoveredLink(null),this.canvas.style.cursor=`default`,this.sendMouse(`motion`,this.buttonFromButtons(e.buttons),e);return}if(this.lastMouseMotionData=``,!this.selectionAnchorScreen||!this.canvas.hasPointerCapture(e.pointerId)){this.updateHoverCursor(e);return}this.clearHoveredLink(),this.selectionPointer={x:e.clientX,y:e.clientY};let n=this.canvas.getBoundingClientRect(),r=Math.max(n.top,0)+$,i=Math.min(n.bottom,window.innerHeight)-$;this.setSelectionAutoscroll(sn(e.clientY,r,i));let a=this.cellAt(e.clientX,e.clientY);(a.x!==this.selectionEnd?.x||a.y!==this.selectionEnd.y)&&this.extendSelectionTo(e.clientX,e.clientY)};extendSelectionTo(e,t){if(this.selectionAnchorScreen===null)return;let n=this.core.selectionRange()?.start;if(!n)return;let r=n.y-this.selectionAnchorScreen.y;if(this.selectionBase&&r!==0){let{start:e,end:t}=this.selectionBase;this.selectionBase={start:{x:e.x,y:e.y+r},end:{x:t.x,y:t.y+r}}}let i=this.cellAt(e,t);this.selectionMoved=!0,this.selectionEnd=i;let a=this.selectionMode===`line`?this.core.selectLine(i.x,i.y):this.selectionMode===`word`?this.core.selectWord(i.x,i.y):null,o=this.core.viewportPointToScreen(i.x,i.y);if(o===null)return;let s=this.selectionBase,c=s!==null&&(o.y<s.start.y||o.y===s.start.y&&o.x<s.start.x),l=s===null?n:c?s.end:s.start,u=a===null?o:c?a.screen.start:a.screen.end;this.selectionAnchorScreen=l,this.core.setSelection({...l,tag:2},{...u,tag:2}),this.options.onSelectionChange(),this.forceFullRender=!0,this.requestRender()}setSelectionAutoscroll(e){this.selectionScrollDelta=e,e===0?this.selectionScrollTimer!==null&&(window.clearInterval(this.selectionScrollTimer),this.selectionScrollTimer=null):this.selectionScrollTimer===null&&(this.selectionScrollTimer=window.setInterval(()=>{if(this.disposed||this.selectionScrollDelta===0)return;this.scrollViewport(this.selectionScrollDelta);let e=this.selectionPointer;e&&this.extendSelectionTo(e.x,e.y)},80))}updateHoverCursor(e){this.hoverPointer={x:e.clientX,y:e.clientY},this.refreshHoveredLink()}onPointerLeave=()=>{this.lastMouseMotionData=``,this.clearHoveredLink()};clearHoveredLink(e=``){this.hoverPointer=null,this.updateLinkHover(null),this.setHoveredLink(null),this.canvas.style.cursor=e}refreshHoveredLink(){let e=this.hoverPointer,t=e?this.findLinkAt(e.x,e.y):null;this.updateLinkHover(t),this.setHoveredLink(t&&this.options.canActivateLink?.(t.text)!==!1?t:null)}updateLinkHover(e){if(this.options.onLinkHover&&!(e?Ut(e,this.linkHoverCandidate):this.linkHoverCandidate===null)&&(this.linkHoverCandidate=e,this.linkHoverTimer!==null&&(window.clearTimeout(this.linkHoverTimer),this.linkHoverTimer=null),this.options.onLinkHover(null),e!==null)){let t=performance.now(),n=0;for(let r=e.range.start.y;r<=e.range.end.y;r++)n=Math.max(n,this.linkRowStability[r]?.changedAt??t);let r=Math.max(0,Tt-(t-n));if(r===0){this.options.onLinkHover(e.text);return}this.linkHoverTimer=window.setTimeout(()=>{this.linkHoverTimer=null,this.options.onLinkHover?.(e.text)},r)}}updateLinkRowStability(e){if(!this.options.onLinkHover||!this.snapshot)return;e&&(this.updateLinkHover(null),this.linkRowStability=[]);let t=performance.now();this.snapshot.rowData.forEach((e,n)=>{let r=this.linkRowStability[n]?.row;r&&r.text===e.text&&r.cells.length===e.cells.length&&r.isWrapContinuation===e.isWrapContinuation&&r.wrapsToNext===e.wrapsToNext||(this.linkRowStability[n]={row:e,changedAt:t})}),this.linkRowStability.length=this.snapshot.rows}setHoveredLink(e){let t=this.hoveredLink,n=t?.text===e?.text&&t?.range.start.x===e?.range.start.x&&t?.range.start.y===e?.range.start.y&&t?.range.end.x===e?.range.end.x&&t?.range.end.y===e?.range.end.y;this.canvas.style.cursor=e?`pointer`:``,!n&&(this.hoveredLink=e,this.forceFullRender=!0,this.requestRender())}onPointerUp=e=>{if(e.pointerType===`touch`){let t=this.touchScroll;if(t?.pointerId!==e.pointerId||(this.touchScroll=null,e.preventDefault(),this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId),e.type===`pointercancel`||t.moved))return;if(this.focus(),tn(this.core.isMouseTracking(),e))this.sendMouse(`press`,ln(0),e),this.sendMouse(`release`,ln(0),e);else{let t=this.linkAt(e.clientX,e.clientY,!0);t?this.activateLink(t,e):this.clearSelection()}}else if(this.setSelectionAutoscroll(0),this.linkActivationPointerId===e.pointerId){e.preventDefault(),e.stopPropagation();let t=this.linkActivationLink,n=this.linkActivationValidation;this.linkActivationPointerId=null,this.linkActivationLink=null,this.linkActivationValidation=void 0,this.linkActivationOrigin=null,this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId),e.type!==`pointercancel`&&t&&Ut(t,this.linkAt(e.clientX,e.clientY,!0))&&this.activateLink(t,e,n)}else this.mouseReportingPointerId===e.pointerId?(e.preventDefault(),e.stopPropagation(),this.sendMouse(`release`,this.mouseReportingButton,e),this.mouseReportingPointerId=null,this.mouseReportingButton=null,this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId),e.type===`pointercancel`?this.clearHoveredLink():(this.hoverPointer={x:e.clientX,y:e.clientY},this.refreshHoveredLink())):(this.canvas.hasPointerCapture(e.pointerId)&&this.canvas.releasePointerCapture(e.pointerId),e.button===1&&Zt()?e.preventDefault():e.button===0&&(!this.selectionMoved&&this.selectionMode===`cell`&&this.clearSelection(),this.options.onSelectionChange()))};onWheel=e=>{if(e.deltaY===0)return;e.preventDefault();let t=an(e,this.metrics.height,this.rows,this.wheelRemainder);this.wheelRemainder=t.remainder,this.scrollRows(t.rows,e)};scrollRows(e,t){if(e===0)return;let n=Math.abs(e);if(tn(this.core.isMouseTracking(),t)){let r=e<0?4:5;for(let e=0;e<n;e+=1)this.sendMouse(`press`,r,t)}else this.core.isAlternateScreen()?this.options.onData(cn(e,this.core.isApplicationCursorKeys())):this.scrollViewport(e)}onMouseDown=e=>{(e.button===0||e.button===1&&Zt())&&e.preventDefault(),this.focus()};onMouseUp=e=>{e.button===1&&Zt()&&e.preventDefault()};onContextMenu=e=>{tn(this.core.isMouseTracking(),e)?e.preventDefault():this.options.onContextMenu?.(e)};onScrollbarPointerDown=e=>{if(e.button!==0)return;let t=this.readScrollbarState();if(t===null)return;let n=this.scrollbar.getBoundingClientRect(),r=Lt(t,n.height);r!==null&&(e.preventDefault(),e.stopPropagation(),this.scrollbarPointerId=e.pointerId,this.scrollbarPointerOffset=e.target===this.scrollbarThumb?e.clientY-n.top-r.thumbTop:r.thumbHeight/2,this.scrollbar.setPointerCapture(e.pointerId),this.scrollbarToPointer(e.clientY,n))};onScrollbarPointerMove=e=>{e.pointerId===this.scrollbarPointerId&&this.scrollbarState!==null&&(e.preventDefault(),this.scrollbarToPointer(e.clientY,this.scrollbar.getBoundingClientRect()))};onScrollbarPointerUp=e=>{e.pointerId===this.scrollbarPointerId&&(e.preventDefault(),this.scrollbarPointerId=null,this.scrollbar.hasPointerCapture(e.pointerId)&&this.scrollbar.releasePointerCapture(e.pointerId))};onScrollbarKeyDown=e=>{let t=this.readScrollbarState();if(t===null)return;let n=0;switch(e.key){case`ArrowUp`:n=-1;break;case`ArrowDown`:n=1;break;case`PageUp`:n=-Math.max(1,t.len);break;case`PageDown`:n=Math.max(1,t.len);break;case`Home`:n=-t.offset;break;case`End`:n=t.total-t.len-t.offset;break;default:return}e.preventDefault(),e.stopPropagation(),this.scrollViewport(n)};installEvents(){this.input.addEventListener(`keydown`,this.onKeyDown),this.input.addEventListener(`keyup`,this.onKeyUp),this.input.addEventListener(`focus`,this.onFocus),this.input.addEventListener(`blur`,this.onBlur),this.input.addEventListener(`input`,this.onInput),this.input.addEventListener(`paste`,this.onPaste),this.input.addEventListener(`copy`,this.onCopyEvent),this.input.addEventListener(`compositionstart`,this.onCompositionStart),this.input.addEventListener(`compositionend`,this.onCompositionEnd),this.canvas.addEventListener(`pointerdown`,this.onPointerDown),this.canvas.addEventListener(`pointermove`,this.onPointerMove),this.canvas.addEventListener(`pointerleave`,this.onPointerLeave),this.canvas.addEventListener(`pointerup`,this.onPointerUp),this.canvas.addEventListener(`pointercancel`,this.onPointerUp),this.canvas.addEventListener(`wheel`,this.onWheel,{passive:!1}),this.canvas.addEventListener(`mousedown`,this.onMouseDown),this.canvas.addEventListener(`mouseup`,this.onMouseUp),this.canvas.addEventListener(`contextmenu`,this.onContextMenu),this.scrollbar.addEventListener(`pointerdown`,this.onScrollbarPointerDown),this.scrollbar.addEventListener(`pointermove`,this.onScrollbarPointerMove),this.scrollbar.addEventListener(`pointerup`,this.onScrollbarPointerUp),this.scrollbar.addEventListener(`pointercancel`,this.onScrollbarPointerUp),this.scrollbar.addEventListener(`keydown`,this.onScrollbarKeyDown),window.addEventListener(`pointerup`,this.onWindowPointerRelease),window.addEventListener(`pointercancel`,this.onWindowPointerRelease)}removeEvents(){this.input.removeEventListener(`keydown`,this.onKeyDown),this.input.removeEventListener(`keyup`,this.onKeyUp),this.input.removeEventListener(`focus`,this.onFocus),this.input.removeEventListener(`blur`,this.onBlur),this.input.removeEventListener(`input`,this.onInput),this.input.removeEventListener(`paste`,this.onPaste),this.input.removeEventListener(`copy`,this.onCopyEvent),this.input.removeEventListener(`compositionstart`,this.onCompositionStart),this.input.removeEventListener(`compositionend`,this.onCompositionEnd),this.canvas.removeEventListener(`pointerdown`,this.onPointerDown),this.canvas.removeEventListener(`pointermove`,this.onPointerMove),this.canvas.removeEventListener(`pointerleave`,this.onPointerLeave),this.canvas.removeEventListener(`pointerup`,this.onPointerUp),this.canvas.removeEventListener(`pointercancel`,this.onPointerUp),this.canvas.removeEventListener(`wheel`,this.onWheel),this.canvas.removeEventListener(`mousedown`,this.onMouseDown),this.canvas.removeEventListener(`mouseup`,this.onMouseUp),this.canvas.removeEventListener(`contextmenu`,this.onContextMenu),this.scrollbar.removeEventListener(`pointerdown`,this.onScrollbarPointerDown),this.scrollbar.removeEventListener(`pointermove`,this.onScrollbarPointerMove),this.scrollbar.removeEventListener(`pointerup`,this.onScrollbarPointerUp),this.scrollbar.removeEventListener(`pointercancel`,this.onScrollbarPointerUp),this.scrollbar.removeEventListener(`keydown`,this.onScrollbarKeyDown),window.removeEventListener(`pointerup`,this.onWindowPointerRelease),window.removeEventListener(`pointercancel`,this.onWindowPointerRelease)}scrollViewport(e){let t=Math.trunc(e),n=this.readScrollbarState();if(n!==null){let e=Math.max(0,n.total-n.len),r=Math.max(0,Math.min(n.offset+t,e));t=r-n.offset,this.scrollbarState={...n,offset:r}}t!==0&&(this.core.scroll(t),this.forceFullRender=!0,this.scrollbarDirty=!0,this.requestRender())}scrollbarToPointer(e,t){let n=this.scrollbarState;if(n===null)return;let r=Rt(n,t.height,e-t.top,this.scrollbarPointerOffset);this.scrollViewport(r-n.offset)}updateScrollbar(){let e=this.readScrollbarState(),t=e===null?null:Lt(e,Math.max(0,this.mount.clientHeight-8));this.scrollbar.hidden=t===null,e!==null&&t!==null&&(this.scrollbar.setAttribute(`aria-valuemin`,`0`),this.scrollbar.setAttribute(`aria-valuemax`,String(t.maxOffset)),this.scrollbar.setAttribute(`aria-valuenow`,String(Math.max(0,Math.min(e.offset,t.maxOffset)))),this.scrollbarThumb.style.height=`${t.thumbHeight}px`,this.scrollbarThumb.style.transform=`translateY(${t.thumbTop}px)`)}readScrollbarState(){let e=this.core.scrollbarState();return this.scrollbarState=e,e}requestRender(){!this.disposed&&this.visible&&this.hasSize&&this.frame===0&&(this.frame=window.requestAnimationFrame(()=>{this.frame=0,this.renderFrame()}))}cancelRender(){this.frame!==0&&(window.cancelAnimationFrame(this.frame),this.frame=0),this.cursorTimer!==null&&(window.clearTimeout(this.cursorTimer),this.cursorTimer=null)}renderFrame(){if(this.disposed||!this.visible)return;if(this.frame!==0&&(window.cancelAnimationFrame(this.frame),this.frame=0),this.mount.clientWidth===0||this.mount.clientHeight===0){this.hasSize=!1,this.forceFullRender=!0,this.cancelRender();return}this.snapshot=this.core.snapshot(),this.blinkEnabled()||(this.cursorOn=!0);let e=this.readScrollbarState(),t=e!==null&&e.total>e.len,n=It(this.mountHeight,$,this.rows,this.metrics.height,t),r=this.canvasResizedSinceRender||n!==this.originY;this.canvasResizedSinceRender=!1,n!==this.originY&&(this.originY=n,this.forceFullRender=!0),this.updateLinkRowStability(r),this.refreshHoveredLink(),_t({context:this.context,snapshot:this.snapshot,metrics:this.metrics,fontSize:this.fontSize,fontFamily:this.fontFamily,padding:$,originY:this.originY,forceFull:this.forceFullRender,cursorOn:this.cursorOn,previousCursorY:this.renderedCursorY,focused:this.focused,hoveredLinkRange:this.hoveredLink?.range??null,...this.theme.selectionBackground===void 0?{}:{selectionBackground:this.theme.selectionBackground}}),this.positionInput(),this.renderedCursorY=this.cursorOn&&this.snapshot.cursorVisible&&this.snapshot.cursorY>=0?this.snapshot.cursorY:null,this.scrollbarDirty&&(this.scrollbarDirty=!1,this.updateScrollbar()),this.forceFullRender=!1,this.scheduleCursorBlink()}scheduleCursorBlink(){this.cursorTimer!==null&&window.clearTimeout(this.cursorTimer),this.cursorTimer=null,this.blinkEnabled()&&(this.cursorTimer=window.setTimeout(()=>{this.cursorTimer=null,this.cursorOn=!this.cursorOn,this.requestRender()},wt))}blinkEnabled(){let e=this.snapshot;return!e||!this.visible||!this.hasSize?!1:Ft({focused:this.focused,cursorBlinking:e.cursorBlinking,cursorVisible:e.cursorVisible,reducedMotion:this.reducedMotionMedia?.matches??!1})}positionInput(){let e=this.snapshot;if(!e||!e.cursorVisible||e.cursorX<0||e.cursorY<0)return;let t=$+e.cursorX*this.metrics.width,n=this.originY+e.cursorY*this.metrics.height;(t!==this.inputLeft||n!==this.inputTop)&&(this.inputLeft=t,this.inputTop=n,this.input.style.left=`${t}px`,this.input.style.top=`${n}px`,this.input.style.height=`${this.metrics.height}px`)}cellAt(e,t){let n=this.canvas.getBoundingClientRect();return{x:Math.max(0,Math.min(this.cols-1,Math.floor((e-n.left-$)/this.metrics.width))),y:Math.max(0,Math.min(this.rows-1,Math.floor((t-n.top-this.originY)/this.metrics.height)))}}validateLink(e){if(this.options.canActivateLink?.(e)!==!1)return;let t=this.options.validateLink?.(e);return t?.catch(()=>{}),t}activateLink(e,t,n=this.validateLink(e.text)){if(!n){this.options.onLinkActivate(e.text,t);return}let r=this.linkActivationRequestId;n.then(n=>{!this.disposed&&this.visible&&r===this.linkActivationRequestId&&Ut(e,this.findLinkAt(t.clientX,t.clientY))&&(n?this.options.onLinkActivate(e.text,t):this.clearSelection())},()=>{})}linkAt(e,t,n=!1){let r=this.findLinkAt(e,t);return r&&(n&&this.options.validateLink||this.options.canActivateLink?.(r.text)!==!1)?r:null}findLinkAt(e,t){if(!this.snapshot)return null;let n=zt({bounds:this.canvas.getBoundingClientRect(),clientX:e,clientY:t,cols:this.cols,rows:this.rows,metrics:this.metrics,padding:$,originY:this.originY});if(!n)return null;let r=this.core.hyperlinkAt(n.x,n.y);if(r){let e={...n},t={...n};for(;;){let t=e.x>0?{x:e.x-1,y:e.y}:e.y>0&&this.snapshot.rowData[e.y]?.isWrapContinuation?{x:this.cols-1,y:e.y-1}:null;if(!t||this.core.hyperlinkAt(t.x,t.y)!==r)break;e.x=t.x,e.y=t.y}for(;;){let e=t.x+1<this.cols?{x:t.x+1,y:t.y}:t.y+1<this.rows&&this.snapshot.rowData[t.y]?.wrapsToNext?{x:0,y:t.y+1}:null;if(!e||this.core.hyperlinkAt(e.x,e.y)!==r)break;t.x=e.x,t.y=e.y}return{text:r,range:{start:e,end:t}}}return Gt(this.snapshot.rowData,n.y,n.x)}sendMouse(e,t,n){let r=this.canvas.getBoundingClientRect(),i=this.core.encodeMouse({action:e,button:t,mods:+!!n.shiftKey|(n.ctrlKey?2:0)|(n.altKey?4:0)|(n.metaKey?8:0),x:Math.max(0,n.clientX-r.left),y:Math.max(0,n.clientY-r.top),screenWidth:r.width,screenHeight:r.height,cellWidth:this.metrics.width,cellHeight:this.metrics.height,paddingLeft:$,paddingRight:$,paddingTop:this.originY,paddingBottom:Math.max(0,r.height-this.originY-this.rows*this.metrics.height),anyButtonPressed:n.buttons!==0}),a=nn(e,i,this.lastMouseMotionData);this.lastMouseMotionData=a.nextMotionData,a.send&&this.options.onData(i)}synchronizeMouseTrackingState(){let e=this.core.isMouseAnyEventTracking(),t=rn(this.mouseAnyEventTracking,e,this.lastMouseMotionData);return this.mouseAnyEventTracking=t.tracking,this.lastMouseMotionData=t.motionData,e}buttonFromButtons(e){return e&1?1:e&4?3:e&2?2:e&8?4:e&16?5:null}};function pn(e){let t=(0,qe.c)(14),{children:n,label:r,onClick:i,tooltip:a}=e,o;t[0]===n?o=t[1]:(o=(0,F.jsx)(`span`,{className:`relative flex size-3 items-center justify-center group-hover/tab:hidden group-focus-visible/close:hidden`,children:n}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(m,{className:`hidden size-3 group-hover/tab:block group-focus-visible/close:block`}),t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==i||t[5]!==o?(c=(0,F.jsxs)(`button`,{type:`button`,className:`cursor-pointer group/close relative flex size-4 shrink-0 items-center justify-center rounded-sm hover:bg-muted`,"aria-label":r,onClick:i,children:[o,s]}),t[3]=r,t[4]=i,t[5]=o,t[6]=c):c=t[6];let l=c;if(!a)return l;let u;t[7]===l?u=t[8]:(u=(0,F.jsx)(C,{render:l}),t[7]=l,t[8]=u);let d;t[9]===a?d=t[10]:(d=(0,F.jsx)(w,{children:a}),t[9]=a,t[10]=d);let f;return t[11]!==u||t[12]!==d?(f=(0,F.jsxs)(T,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13],f}var mn=0;function hn(){return mn>0}async function gn(e){let t=de();if(!t)return!0;mn+=1;try{return await t.dialogs.confirm(e.length===1?[`Close terminal "${e[0]}"?`,`This stops the running process and clears its history.`].join(`
2
- `):[`Close ${e.length} terminals?`,`This stops their running processes and clears their histories: ${e.map(e=>`"${e}"`).join(`, `)}.`].join(`
3
- `),{variant:`destructive`})}catch{return!1}finally{--mn}}var _n={environmentId:y,threadId:y,targetOrigin:y,cause:re()},vn=class extends b()(`TerminalLinkPreviewOpenError`,_n){get message(){return`Failed to open terminal link ${this.targetOrigin} in preview for thread ${this.threadId}.`}};async function yn(e){if(!(!e.forceBrowser&&Ne(e.url)&&we(e.threadRef.environmentId)&&e.threadRef.threadId.length>0&&await Pe()===`app`)){e.fallbackToBrowser();return}let t={environmentId:e.threadRef.environmentId,threadId:e.threadRef.threadId,targetOrigin:new URL(e.url).origin},n=await xe(),r=ye(e.threadRef.environmentId),a=await e.openPreview({environmentId:e.threadRef.environmentId,input:{threadId:e.threadRef.threadId,url:e.url,viewport:be(n),profileId:Ce(n),...r===void 0?{}:{runtime:r}}});if(a._tag===`Failure`){if(oe(a))return;console.error(new vn({...t,cause:a.cause})),e.fallbackToBrowser()}else Se(e.threadRef,e.url),i(e.threadRef,a.value),S.getState().openBrowser(e.threadRef,a.value.tabId)}function bn(e){return{...e===void 0?{}:{platform:e},context:{terminalFocus:!0,terminalOpen:!0}}}function xn(e,t,n){return ke(e,t,bn(n))?(e.preventDefault(),!0):!1}function Sn(e,t,n){return e.repeat?xn(e,t,n):!1}var Cn=180,wn=.75;function Tn(){return typeof window>`u`?280:Math.max(Cn,Math.floor(window.innerHeight*wn))}function En(e,t=Tn()){return Math.min(Math.max(Math.round(Number.isFinite(e)?e:280),Cn),t)}function Dn(e,t){e.write(`\r\n[terminal] ${t}\r\n`)}function On(e,t){t.type===`reset`?e.resetAndWrite(t.data):t.type===`append`&&e.write(t.data)}var kn=3e3;function An(e,t,n){if(t.version===0)return n;let r=ze(t.output,n);if(r.type===`none`)return r.cursor;let i=e.getSelectionCellCount(),a=i<=kn,o=i>0&&a?e.getSelection():``;return On(e,r),(!a||i>0&&e.getSelection()!==o)&&e.clearSelection({source:`output`}),r.cursor}function jn(e,t){if(typeof document>`u`)return t;let n=document.createElement(`canvas`);n.width=1,n.height=1;let r=n.getContext(`2d`,{willReadFrequently:!0});if(!r)return t;r.clearRect(0,0,1,1),r.fillStyle=e,r.fillRect(0,0,1,1);let[i,a,o,s]=r.getImageData(0,0,1,1).data;return s===0?t:{r:i??t.r,g:a??t.g,b:o??t.b}}function Mn(e){let t=Number.parseInt(e.slice(1),16);return{r:t>>16&255,g:t>>8&255,b:t&255}}var Nn={light:[`#000000`,`#cd3131`,`#107c10`,`#949800`,`#0451a5`,`#bc05bc`,`#0598bc`,`#555555`,`#666666`,`#cd3131`,`#14ce14`,`#b5ba00`,`#0451a5`,`#bc05bc`,`#0598bc`,`#a5a5a5`].map(Mn),dark:[`#000000`,`#cd3131`,`#0dbc79`,`#e5e510`,`#2472c8`,`#bc3fbc`,`#11a8cd`,`#e5e5e5`,`#666666`,`#f14c4c`,`#23d18b`,`#f5f543`,`#3b8eea`,`#d670d6`,`#29b8db`,`#e5e5e5`].map(Mn)};function Pn(e){return e?JSON.stringify(Object.entries(e).filter(([e,t])=>e.length>0&&typeof t==`string`).sort(([e],[t])=>e.localeCompare(t))):``}function Fn(e,t){let n=e?.trim().toLowerCase();return!n||n===`transparent`||n===`rgba(0, 0, 0, 0)`||n===`rgba(0 0 0 / 0)`?t:e??t}function In(e,t,n){return Fn(e.getPropertyValue(t),n)}function Ln(e,t){let n=e.trim();return n.length>0?{family:n,size:t}:{size:t}}function Rn(e){let t=e?.closest(`[data-thread-terminal-drawer]`)??document.querySelector(`[data-thread-terminal-drawer]`)??document.body,n=getComputedStyle(t),r=e?getComputedStyle(e):n,i=r.colorScheme,a=i===`dark`||i!==`light`&&document.documentElement.classList.contains(`dark`),o=a?`rgb(14, 18, 24)`:`rgb(255, 255, 255)`,s=a?`rgb(237, 241, 247)`:`rgb(28, 33, 41)`,c=getComputedStyle(document.body),l=getComputedStyle(document.documentElement),u=Fn(n.backgroundColor,Fn(c.backgroundColor,o)),d=Fn(n.color,Fn(c.color,s)),f=In(r,`--terminal-background`,In(l,`--terminal-background`,u)),p=In(r,`--terminal-foreground`,In(l,`--terminal-foreground`,d)),m=In(r,`--terminal-cursor`,a?`rgb(180, 203, 255)`:`rgb(38, 56, 78)`),h=In(r,`--terminal-selection-background`,a?`rgba(180, 203, 255, 0.25)`:`rgba(37, 63, 99, 0.2)`);return{background:jn(f,a?{r:14,g:18,b:24}:{r:255,g:255,b:255}),foreground:jn(p,a?{r:237,g:241,b:247}:{r:28,g:33,b:41}),cursor:jn(m,a?{r:180,g:203,b:255}:{r:38,g:56,b:78}),palette:Nn[a?`dark`:`light`],selectionBackground:h}}function zn(e){let t=e.start.y+1;return{lineStart:t,lineEnd:Math.max(t,e.end.y+1)}}function Bn(e){return[...e?.canAddToChat===!1?[]:[{id:`add-to-chat`,label:`Add to chat`}],{id:`copy`,label:`Copy`}]}function Vn(e){let{hasSelection:t,canAddToChat:n=!0}=e;return[...Bn({canAddToChat:n}).map(e=>({...e,disabled:!t})),{id:`paste`,label:`Paste`,...e.readOnly?{disabled:!0}:{}},{id:`select-all`,label:`Select all`},{id:`scroll-to-bottom`,label:`Jump to latest`}]}function Hn(e){return e.actionPending||e.openMenuRequestId===e.currentRequestId}function Un(e,t,n,r){return r>0&&(e===`closed`||e===`exited`)&&e!==t&&!n}function Wn({advancedTypography:e,threadRef:t,threadId:n,terminalId:r,terminalLabel:i,cwd:a,worktreePath:o,runtimeEnv:c,providerInstanceId:l,onSessionExited:u,onAddTerminalContext:f,focusRequestId:p,autoFocus:m,visible:h,resizeEpoch:g,drawerHeight:ee,keybindings:v}){let y=(0,P.useRef)(null),b=(0,P.useRef)(null),re=(0,P.useRef)(h),S=t.environmentId,C=pe(S,ne),w=(0,P.useEffectEvent)(()=>me(S,ne)),T=pe(S,ie),E=pe(S,te),[D,ve]=(0,P.useState)(null),O=(0,P.useContext)(Ie),ye=D!==null&&T&&E?Fe(S,ge(D,a),a,O):null,be=(0,P.useEffectEvent)(e=>{if(j(e))return!0;if(!me(S,`orchestration:operate`)||e!==D||!ye)return!1;let t=_(d.get(ye),()=>null);return t?.kind===`file`||t?.kind===`directory`}),xe=(0,P.useEffectEvent)(async e=>{if(j(e))return!0;if(!me(S,`orchestration:operate`)||!me(S,`filesystem:read`))return!1;let t=Fe(S,ge(e,a),a,O);if(!t)return!1;let n=await se(d,t,{reportFailure:!1});return n._tag===`Success`&&(n.value?.kind===`file`||n.value?.kind===`directory`)}),Se=s(fe.configValueAtom(S)),Ce=He(S,Se?.availableEditors??[]),we=(0,P.useEffectEvent)(e=>Ce(e)),ke=he(Me.open,{reportFailure:!1}),Ne=he(Re.write,{reportFailure:!1}),Pe=he(Re.resize,{reportFailure:!1}),M=(0,P.useRef)(!1),N=(0,P.useRef)(0),Ve=(0,P.useRef)(null),We=(0,P.useRef)(v),Ge=(0,P.useMemo)(()=>Pn(c),[c]),qe=(0,P.useEffectEvent)(()=>{w()&&u()}),Ye=(0,P.useEffectEvent)(e=>{f?.(e)}),L=(0,P.useEffectEvent)(()=>f!==void 0),Xe=(0,P.useEffectEvent)(()=>i),R=x(t=>Ue({advanced:e,code:t.fontFamilyCode,terminal:t.fontFamilyTerminal})),z=x(t=>Ke({advanced:e,code:t.fontSizeCode,terminal:t.fontSizeTerminal})),B=(0,P.useRef)({family:R,size:z}),V=Be({environmentId:S,terminal:{threadId:n,terminalId:r,cwd:a,...o===void 0?{}:{worktreePath:o},...c?{env:c}:{},...l?{providerInstanceId:l}:{}}}),Ze=C&&V.version>0&&V.status===`running`,Qe=Ze?V.output.generation:null,H=(0,P.useEffectEvent)(e=>Ne({environmentId:S,input:{threadId:n,terminalId:r,data:e}})),$e=(0,P.useEffectEvent)((e,t)=>{if(Ze&&w())return Pe({environmentId:S,input:{threadId:n,terminalId:r,cols:e,rows:t}})}),U=V.output,et=V.error,W=V.status,G=V.grid,tt=(0,P.useRef)(G);tt.current=G;let K=(0,P.useRef)(Le),nt=(0,P.useRef)(`closed`),q=(0,P.useEffectEvent)((e,t,n)=>{let r=nt.current;n>0&&t===`running`?M.current=!1:Un(t,r,M.current,n)&&(M.current=!0,Dn(e,t===`closed`?`Terminal closed`:`Process exited`),window.setTimeout(()=>{M.current&&qe()},0)),n>0&&(nt.current=t)}),J=V.version,Y=(0,P.useRef)({output:U,error:et,status:W,version:J}),X=(0,P.useRef)(Y.current);return X.current={output:U,error:et,status:W,version:J},(0,P.useEffect)(()=>{We.current=v},[v]),(0,P.useLayoutEffect)(()=>{b.current&&(b.current.input.readOnly=!C)},[C]),(0,P.useEffect)(()=>{if(!ye)b.current?.refreshLinkActivation();else return d.subscribe(ye,()=>b.current?.refreshLinkActivation(),{immediate:!0})},[ye]),(0,P.useEffect)(()=>{Qe!==null&&b.current?.resendSize()},[Qe]),(0,P.useLayoutEffect)(()=>{re.current=h,b.current?.setVisible(h)},[h]),(0,P.useEffect)(()=>{let e=B.current;(e.family!==R||e.size!==z)&&(B.current={family:R,size:z},b.current?.setFont(Ln(R,z)))},[R,z]),(0,P.useEffect)(()=>{let e=y.current;if(!e)return;let n=de(),i=!1,o=null,s=null,c=[],l=null;return(async()=>{let o=B.current,u={theme:Rn(e),font:Ln(o.family,o.size),get visible(){return re.current},onData:e=>he(e),onResize:(e,t)=>void $e(e,t),onSelectionChange:()=>C(),beforeKey:e=>fe(e),onLinkActivate:(e,t)=>pe(e,t),canActivateLink:e=>be(e),validateLink:e=>xe(e),onLinkHover:e=>ve(e!==null&&!j(e)?e:null),onContextMenu:e=>{b.current&&se(e)}},d=await fn.create(e,u);if(i)return d.dispose(),null;d.setVisible(re.current),d.setTheme(Rn(e)),s=d,b.current=d,d.input.readOnly=!w();let f=B.current;(f.family!==o.family||f.size!==o.size)&&d.setFont(Ln(f.family,f.size));let p=X.current;Y.current=p,d.setSharedGrid(tt.current);let m=ze(p.output,Le);m.type===`reset`&&m.data.length>0&&On(d,m),K.current=m.cursor,p.error!==null&&Dn(d,p.error),nt.current=`closed`,q(d,p.status,p.version),w()&&re.current&&e.contains(document.activeElement)&&d.focus();let h=(e=!1)=>{let t=Ve.current===N.current;(e||t)&&(N.current+=1),t&&n?.contextMenu.close()},g=()=>{l?.cancel(),h(!0)};c.push(g);let _=(e=null)=>{let t=b.current,n=y.current;if(!t||!n||!t.hasSelection())return null;let i=t.getSelection(),a=t.getSelectionPosition(),o=i.replace(/\r\n/g,`
4
- `).replace(/^\n+|\n+$/g,``);if(!a||o.length===0)return null;let{lineStart:s,lineEnd:c}=zn(a);return{position:Je({bounds:n.getBoundingClientRect(),selectionRect:t.getSelectionEndClientRect(),pointer:e,viewport:{width:window.innerWidth,height:window.innerHeight}}),clipboardText:i,selection:{terminalId:r,terminalLabel:Xe(),lineStart:s,lineEnd:c,text:o}}},ee=e=>{let t=_();t?.clipboardText===e&&(Ye(t.selection),b.current?.clearSelection(),b.current?.focus())},te=(e,t,n)=>{if(e!==N.current)return;let r=b.current;r&&Dn(r,t instanceof Error?t.message:n)},v=e=>{e===N.current&&b.current?.focus()},ne=async(e,t)=>{try{await le(e,`terminal selection`)}catch(e){te(t,e,`Unable to copy terminal selection`)}v(t)},ie=async e=>{if(!w())return;let t=b.current;if(t){try{await t.pasteFromClipboard(()=>ue(`terminal input`),()=>e===N.current)}catch(t){te(e,t,`Unable to read the clipboard`);return}v(e)}},se=async e=>{if(!n||!b.current)return;e.preventDefault(),g();let t=_(),r=N.current,i;try{i=await n.contextMenu.show(Vn({hasSelection:t!==null,canAddToChat:L(),readOnly:!w()}),{x:e.clientX,y:e.clientY})}catch(e){te(r,e,`Unable to open the terminal context menu`),v(r);return}if(r===N.current&&i!==null)switch(i){case`add-to-chat`:t&&L()&&ee(t.clipboardText);return;case`copy`:t&&await ne(t.clipboardText,r);return;case`paste`:await ie(r);return;case`select-all`:b.current?.selectAll(),v(r);return;case`scroll-to-bottom`:b.current?.scrollToBottom(),v(r);return}},de=async e=>{if(!n){g();return}if(Ve.current===N.current)return;let t=_(e);if(!t){g();return}let r=++N.current;Ve.current=r;let i=await n.contextMenu.show(Bn({canAddToChat:L()}),t.position).finally(()=>{Ve.current===r&&(Ve.current=null)});if(r===N.current&&i!==null)switch(i){case`add-to-chat`:L()&&ee(t.clipboardText);return;case`copy`:await ne(t.clipboardText,r);return}},x=async(e,t)=>{if(!w())return;let n=b.current;if(!n)return;let r=await H(e);if(r._tag===`Failure`&&!oe(r)){let e=ae(r);Dn(n,e instanceof Error?e.message:t)}};function fe(e){let t=We.current,n={context:{terminalFocus:!0,terminalOpen:!0}};if(xn(e,t)||A(e,t,n)||De(e,t,n)||Oe(e,t,n)||Ae(e,t,n)||k(e,t,n))return!1;let r=Te(e);if(r!==null)return e.preventDefault(),e.stopPropagation(),x(r,`Failed to move cursor`),!1;let i=je(e);return i===null?!Ee(e)||(e.preventDefault(),e.stopPropagation(),x(`\f`,`Failed to clear terminal`),!1):(e.preventDefault(),e.stopPropagation(),x(i,`Failed to delete terminal input`),!1)}function pe(e,r){if(!j(e)&&!me(S,`orchestration:operate`))return;let i=b.current;if(!i)return;if(j(e)){if(!n){Dn(i,`Opening links is unavailable in this browser.`);return}let a=()=>{n.shell.openExternal(e).catch(e=>{Dn(i,e instanceof Error?e.message:`Unable to open link`)})};if(!me(S,`preview:operate`)){a();return}yn({url:e,threadRef:t,openPreview:ke,fallbackToBrowser:a,forceBrowser:r.metaKey||r.ctrlKey}).catch(e=>{ce.add(_e({type:`error`,title:`Unable to open link`,description:e instanceof Error?e.message:`An error occurred.`}))});return}let o=ge(e,a);(async()=>{let e=await we(o);if(e._tag===`Success`||oe(e))return;let t=ae(e);Dn(i,t instanceof Error?t.message:`Unable to open path`)})()}function he(e){w()&&(async()=>{let t=await H(e);if(t._tag===`Success`||oe(t))return;let n=ae(t);Dn(d,n instanceof Error?n.message:`Terminal write failed`)})()}function C(){b.current?.hasSelection()||Hn({actionPending:l?.pending??!1,openMenuRequestId:Ve.current,currentRequestId:N.current})&&g()}l=I({element:e,onSelection:e=>{de(e)},onDismiss:e=>h(e===`interaction`)}),c.push(()=>l?.dispose());let T=new MutationObserver(()=>{let e=b.current;e&&e.setTheme(Rn(y.current))});T.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`]}),c.push(()=>T.disconnect());let E=window.setTimeout(()=>{let e=b.current;if(!e)return;let t=e.isAtBottom();e.fit(),t&&e.scrollToBottom()},30);c.push(()=>window.clearTimeout(E));let D=c;return c=[],s=null,()=>{for(let e of D.toReversed())e();b.current===d&&(b.current=null),d.dispose()}})().then(e=>{i?e?.():o=e}).catch(t=>{for(let e of c.toReversed())e();if(c=[],b.current===s&&(b.current=null),s?.dispose(),s=null,i)return;let n=t instanceof Error?t.message:`Unable to initialize libghostty-vt`;e.textContent=`${n} — close and reopen the terminal to retry.`}),()=>{i=!0;let t=e.contains(document.activeElement);o?.(),w()&&t&&e.isConnected&&e.focus({preventScroll:!0})}},[a,S,Ge,r,n,o]),(0,P.useEffect)(()=>{b.current?.setSharedGrid(G)},[G]),(0,P.useEffect)(()=>{let e=b.current,t={output:U,error:et,status:W,version:J};if(!e){Y.current=t;return}let n=Y.current;q(e,t.status,t.version),(t.version!==n.version||t.output!==n.output)&&(K.current=An(e,t,K.current),t.error!==null&&t.error!==n.error&&Dn(e,t.error),Y.current=t)},[U,et,W,J]),(0,P.useEffect)(()=>{m&&C&&h&&(b.current??y.current)?.focus()},[m,C,p,h]),(0,P.useEffect)(()=>{let e=b.current;if(!e||!re.current)return;let t=e.isAtBottom(),n=window.requestAnimationFrame(()=>{re.current&&(e.fit(),t&&e.scrollToBottom())});return()=>{window.cancelAnimationFrame(n)}},[ee,S,g,r,n]),(0,F.jsx)(`div`,{ref:y,tabIndex:-1,className:`relative h-full w-full overflow-hidden bg-(--terminal-background)`})}function Gn(e){let t=(0,qe.c)(16),{label:n,className:r,onClick:i,children:a,disabled:o}=e,s=o&&`opacity-64 cursor-not-allowed`,c;t[0]!==r||t[1]!==s?(c=h(r,s),t[0]=r,t[1]=s,t[2]=c):c=t[2];let l=o?void 0:i,u;t[3]!==o||t[4]!==n||t[5]!==c||t[6]!==l?(u=(0,F.jsx)(`button`,{type:`button`,className:c,onClick:l,"aria-label":n,"aria-disabled":o}),t[3]=o,t[4]=n,t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]!==a||t[9]!==u?(d=(0,F.jsx)(D,{openOnHover:!0,render:u,children:a}),t[8]=a,t[9]=u,t[10]=d):d=t[10];let f;t[11]===n?f=t[12]:(f=(0,F.jsx)(E,{tooltipStyle:!0,side:`bottom`,sideOffset:6,align:`center`,className:`pointer-events-none select-none`,children:n}),t[11]=n,t[12]=f);let p;return t[13]!==d||t[14]!==f?(p=(0,F.jsxs)(ve,{children:[d,f]}),t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function Kn(e){let t=(0,qe.c)(169),{mode:n,threadRef:r,threadId:i,cwd:s,worktreePath:l,runtimeEnv:d,visible:m,height:_,terminalIds:te,activeTerminalId:y,terminalGroups:b,activeTerminalGroupId:re,focusRequestId:ie,onSplitTerminal:ae,onSplitTerminalVertical:oe,onNewTerminal:se,splitShortcutLabel:ce,splitVerticalShortcutLabel:le,newShortcutLabel:ue,closeShortcutLabel:de,onActiveTerminalChange:x,onCloseTerminal:fe,onHeightChange:he,onAddTerminalContext:S,keybindings:ge,terminalLabelsById:_e,terminalLaunchLocationsById:C}=e,w=n===void 0?`drawer`:n,T=m===void 0||m,E=pe(r.environmentId,ne),D=w===`panel`,[ve]=c(We,!1,v),O=_,[ye,be]=(0,P.useState)(Tn),xe;t[0]!==O||t[1]!==i?(xe=()=>({threadId:i,height:O}),t[0]=O,t[1]=i,t[2]=xe):xe=t[2];let[Se,Ce]=(0,P.useState)(xe),we=Se.threadId===i?Se.height:O,Te;t[3]!==we||t[4]!==ye?(Te=En(we,ye),t[3]=we,t[4]=ye,t[5]=Te):Te=t[5];let k=Te,Ee;t[6]!==O||t[7]!==i?(Ee=e=>{Ce(t=>{let n=t.threadId===i?t.height:O,r=typeof e==`function`?e(n):e;return r===n&&t.threadId===i?t:{threadId:i,height:r}})},t[6]=O,t[7]=i,t[8]=Ee):Ee=t[8];let De=Ee,[Oe,ke]=(0,P.useState)(0),A=(0,P.useRef)(k),Ae=(0,P.useRef)(we),je=(0,P.useRef)(O),Me=(0,P.useRef)(he),Ne=(0,P.useRef)(null),Pe=(0,P.useRef)(!1),Fe;if(t[9]!==te){Fe=[];let e=new Set;for(let t of te){let n=t.trim();n.length===0||e.has(n)||(e.add(n),Fe.push(n))}t[9]=te,t[10]=Fe}else Fe=t[10];let j=Fe,M=j.length===0?``:j.includes(y)?y:j[0]??``,Ie;bb0:{if(j.length===0){let e;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[11]=e):e=t[11],Ie=e;break bb0}let e;t[12]===j?e=t[13]:(e=new Set(j),t[12]=j,t[13]=e);let n=e,r;if(t[14]!==j||t[15]!==b||t[16]!==n){let e=new Set,i=new Set;r=[];let a=e=>{if(!i.has(e))return i.add(e),e;let t=2;for(;i.has(`${e}-${t}`);)t+=1;let n=`${e}-${t}`;return i.add(n),n};for(let t of b){let i=[],o=new Set;for(let r of t.terminalIds){let t=r.trim();t.length!==0&&(o.has(t)||(o.add(t),n.has(t)&&(e.has(t)||i.push(t))))}if(i.length===0)continue;for(let t of i)e.add(t);let s=t.id.trim().length>0?t.id.trim():`group-${i[0]??j[0]??``}`;r.push({id:a(s),terminalIds:i,...t.splitDirection===`vertical`?{splitDirection:`vertical`}:{}})}for(let t of j)e.has(t)||r.push({id:a(`group-${t}`),terminalIds:[t]});let o=new Map(j.map(Zn));r.sort((e,t)=>{let n=e=>Math.min(...e.map(e=>o.get(e)??1/0));return n(e.terminalIds)-n(t.terminalIds)}),t[14]=j,t[15]=b,t[16]=n,t[17]=r}else r=t[17];Ie=r}let N=Ie,Le;bb1:{let e=N.findIndex(e=>e.id===re);if(e>=0){Le=e;break bb1}let t=N.findIndex(e=>e.terminalIds.includes(M));Le=t>=0?t:0}let Re=Le,ze;t[18]!==j.length||t[19]!==Re||t[20]!==M||t[21]!==N?(ze=N[Re]?.terminalIds??(j.length>0?[M]:[]),t[18]=j.length,t[19]=Re,t[20]=M,t[21]=N,t[22]=ze):ze=t[22];let Be=ze,He=N[Re]?.splitDirection??`horizontal`,Ue=j.length>1,Ge=Be.length>1,Ke;t[23]===N?Ke=t[24]:(Ke=N.length>1||N.some(Xn),t[23]=N,t[24]=Ke);let Je=Ke,I=Be.length>=4,Ye;if(t[25]!==j||t[26]!==_e){Ye=new Map;for(let e of j)Ye.set(e,_e?.get(e)??Ve(e));t[25]=j,t[26]=_e,t[27]=Ye}else Ye=t[27];let L=Ye,Xe;t[28]!==s||t[29]!==d||t[30]!==C||t[31]!==l?(Xe=e=>C?.get(e)??{cwd:s,...l===void 0?{}:{worktreePath:l},...d?{runtimeEnv:d}:{}},t[28]=s,t[29]=d,t[30]=C,t[31]=l,t[32]=Xe):Xe=t[32];let R=Xe,z=I?`Split Terminal Horizontally (max 4 per group)`:ce?`Split Terminal Horizontally (${ce})`:`Split Terminal Horizontally`,B=I?`Split Terminal Vertically (max 4 per group)`:le?`Split Terminal Vertically (${le})`:`Split Terminal Vertically`,V=ue?`New Terminal (${ue})`:`New Terminal`,Ze=de?`Close Terminal (${de})`:`Close Terminal`,Qe;t[33]!==E||t[34]!==I||t[35]!==ae?(Qe=()=>{E&&!I&&ae()},t[33]=E,t[34]=I,t[35]=ae,t[36]=Qe):Qe=t[36];let H=Qe,$e;t[37]!==E||t[38]!==I||t[39]!==oe?($e=()=>{E&&!I&&oe()},t[37]=E,t[38]=I,t[39]=oe,t[40]=$e):$e=t[40];let U=$e,et;t[41]!==E||t[42]!==se?(et=()=>{E&&se()},t[41]=E,t[42]=se,t[43]=et):et=t[43];let W=et,G;t[44]!==E||t[45]!==fe||t[46]!==L||t[47]!==r.environmentId?(G=e=>{E&&gn([L.get(e)??Ve(e)]).then(t=>{t&&me(r.environmentId,`terminal:operate`)&&fe(e)})},t[44]=E,t[45]=fe,t[46]=L,t[47]=r.environmentId,t[48]=G):G=t[48];let tt=G,K,nt;t[49]===he?(K=t[50],nt=t[51]):(K=()=>{Me.current=he},nt=[he],t[49]=he,t[50]=K,t[51]=nt),(0,P.useEffect)(K,nt);let q,J;t[52]===k?(q=t[53],J=t[54]):(q=()=>{let e=Ne.current;e?e.drawer?.style.setProperty(`height`,`${A.current}px`):A.current=k},J=[k],t[52]=k,t[53]=q,t[54]=J),(0,P.useLayoutEffect)(q,J);let Y,X;t[55]===we?(Y=t[56],X=t[57]):(Y=()=>{Ae.current=we},X=[we],t[55]=we,t[56]=Y,t[57]=X),(0,P.useEffect)(Y,X);let rt;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(rt=e=>{je.current!==e&&(je.current=e,Me.current(e))},t[58]=rt):rt=t[58];let it=rt,at;t[59]===O?at=t[60]:(at=()=>{je.current=O},t[59]=O,t[60]=at);let ot;t[61]!==O||t[62]!==i?(ot=[O,i],t[61]=O,t[62]=i,t[63]=ot):ot=t[63],(0,P.useEffect)(at,ot);let st;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(st=e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),Pe.current=!1,Ne.current={pointerId:e.pointerId,startY:e.clientY,startHeight:A.current,drawer:e.currentTarget.parentElement})},t[64]=st):st=t[64];let ct=st,lt;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(lt=e=>{let t=Ne.current;if(!t||t.pointerId!==e.pointerId)return;e.preventDefault();let n=En(t.startHeight+(t.startY-e.clientY));n!==A.current&&(Pe.current=!0,A.current=n,t.drawer?.style.setProperty(`height`,`${n}px`))},t[65]=lt):lt=t[65];let ut=lt,dt;t[66]===De?dt=t[67]:(dt=e=>{let t=Ne.current;if(t&&t.pointerId===e.pointerId){if(Ne.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),!Pe.current||A.current===t.startHeight){let e=En(Ae.current);A.current=e,t.drawer?.style.setProperty(`height`,`${e}px`)}else De(A.current),it(A.current),ke(Yn)}},t[66]=De,t[67]=dt);let Z=dt,Q,ft;t[68]===T?(Q=t[69],ft=t[70]):(Q=()=>{if(!T)return;let e=()=>{let e=Ne.current,t=En(A.current);e&&t!==A.current&&(A.current=t,e.drawer?.style.setProperty(`height`,`${t}px`)),be(Tn()),ke(Jn)};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},ft=[T],t[68]=T,t[69]=Q,t[70]=ft),(0,P.useEffect)(Q,ft);let pt,mt;t[71]===T?(pt=t[72],mt=t[73]):(pt=()=>{T&&(be(Tn()),ke(qn))},mt=[T],t[71]=T,t[72]=pt,t[73]=mt),(0,P.useEffect)(pt,mt);let ht,gt;if(t[74]===Symbol.for(`react.memo_cache_sentinel`)?(ht=()=>()=>{it(Ae.current)},gt=[it],t[74]=ht,t[75]=gt):(ht=t[74],gt=t[75]),(0,P.useEffect)(ht,gt),j.length===0){let e=D?`right-panel`:`drawer`,n=D?`h-full flex-1`:`shrink-0 border-t border-border/80`,r;t[76]===n?r=t[77]:(r=h(`relative flex min-w-0 flex-col overflow-hidden bg-background`,n),t[76]=n,t[77]=r);let i;t[78]!==k||t[79]!==D?(i=D?void 0:{height:`${k}px`},t[78]=k,t[79]=D,t[80]=i):i=t[80];let a;t[81]!==Z||t[82]!==D?(a=D?null:(0,F.jsx)(`div`,{className:`absolute inset-x-0 top-0 z-20 h-1.5 cursor-row-resize`,onPointerDown:ct,onPointerMove:ut,onPointerUp:Z,onPointerCancel:Z,onLostPointerCapture:Z}),t[81]=Z,t[82]=D,t[83]=a):a=t[83];let o;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,F.jsx)(`p`,{children:`No terminal sessions for this thread yet.`}),t[84]=o):o=t[84];let s=!E,c;t[85]!==V||t[86]!==W||t[87]!==s?(c=(0,F.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-4 py-6 text-center text-sm text-muted-foreground`,children:[o,(0,F.jsx)(p,{size:`xs`,variant:`outline`,onClick:W,disabled:s,children:V})]}),t[85]=V,t[86]=W,t[87]=s,t[88]=c):c=t[88];let l;return t[89]!==e||t[90]!==r||t[91]!==i||t[92]!==a||t[93]!==c?(l=(0,F.jsxs)(`aside`,{"data-thread-terminal-drawer":!0,"data-terminal-owner":e,className:r,style:i,children:[a,c]}),t[89]=e,t[90]=r,t[91]=i,t[92]=a,t[93]=c,t[94]=l):l=t[94],l}let _t;t[95]!==R||t[96]!==M?(_t=R(M),t[95]=R,t[96]=M,t[97]=_t):_t=t[97];let vt=_t,yt=D?`right-panel`:`drawer`,bt=D?`h-full flex-1`:`shrink-0 border-t border-border/80`,xt;t[98]===bt?xt=t[99]:(xt=h(`relative flex min-w-0 flex-col overflow-hidden bg-background`,bt),t[98]=bt,t[99]=xt);let St;t[100]!==k||t[101]!==D?(St=D?void 0:{height:`${k}px`},t[100]=k,t[101]=D,t[102]=St):St=t[102];let $;t[103]!==Z||t[104]!==D?($=D?null:(0,F.jsx)(`div`,{className:`absolute inset-x-0 top-0 z-20 h-1.5 cursor-row-resize`,onPointerDown:ct,onPointerMove:ut,onPointerUp:Z,onPointerCancel:Z,onLostPointerCapture:Z}),t[103]=Z,t[104]=D,t[105]=$):$=t[105];let Ct;t[106]!==E||t[107]!==Ze||t[108]!==tt||t[109]!==I||t[110]!==Ue||t[111]!==V||t[112]!==W||t[113]!==H||t[114]!==U||t[115]!==M||t[116]!==z||t[117]!==B?(Ct=!Ue&&(0,F.jsx)(`div`,{className:`pointer-events-none absolute right-2 top-2 z-20`,children:(0,F.jsxs)(`div`,{className:`pointer-events-auto inline-flex items-center overflow-hidden rounded-md border border-border/80 bg-background shadow-xs`,children:[(0,F.jsx)(Gn,{disabled:!E,className:`p-1 text-foreground/90 transition-colors ${I?`cursor-not-allowed opacity-64 hover:bg-transparent`:`hover:bg-accent`}`,onClick:H,label:z,children:(0,F.jsx)(o,{className:`size-3.25`})}),(0,F.jsx)(`div`,{className:`h-4 w-px bg-border/80`}),(0,F.jsx)(Gn,{disabled:!E,className:`p-1 text-foreground/90 transition-colors ${I?`cursor-not-allowed opacity-64 hover:bg-transparent`:`hover:bg-accent`}`,onClick:U,label:B,children:(0,F.jsx)(a,{className:`size-3.25`})}),(0,F.jsx)(`div`,{className:`h-4 w-px bg-border/80`}),(0,F.jsx)(Gn,{disabled:!E,className:`p-1 text-foreground/90 transition-colors hover:bg-accent`,onClick:W,label:V,children:(0,F.jsx)(f,{className:`size-3.25`})}),(0,F.jsx)(`div`,{className:`h-4 w-px bg-border/80`}),(0,F.jsx)(Gn,{disabled:!E,className:`p-1 text-foreground/90 transition-colors hover:bg-accent`,onClick:()=>tt(M),label:Ze,children:(0,F.jsx)(ee,{className:`size-3.25`})})]})}),t[106]=E,t[107]=Ze,t[108]=tt,t[109]=I,t[110]=Ue,t[111]=V,t[112]=W,t[113]=H,t[114]=U,t[115]=M,t[116]=z,t[117]=B,t[118]=Ct):Ct=t[118];let wt=Ue&&`gap-1.5`,Tt;t[119]===wt?Tt=t[120]:(Tt=h(`flex h-full min-h-0 bg-(--terminal-background)`,wt),t[119]=wt,t[120]=Tt);let Et;t[121]!==vt||t[122]!==ve||t[123]!==k||t[124]!==ie||t[125]!==Ge||t[126]!==ge||t[127]!==x||t[128]!==S||t[129]!==fe||t[130]!==Oe||t[131]!==R||t[132]!==M||t[133]!==He||t[134]!==L||t[135]!==i||t[136]!==r||t[137]!==T||t[138]!==Be?(Et=(0,F.jsx)(`div`,{className:`min-w-0 flex-1`,children:Ge?(0,F.jsx)(`div`,{className:`grid h-full w-full min-w-0 gap-0 overflow-hidden`,style:He===`vertical`?{gridTemplateRows:`repeat(${Be.length}, minmax(0, 1fr))`}:{gridTemplateColumns:`repeat(${Be.length}, minmax(0, 1fr))`},children:Be.map(e=>{let t=R(e);return(0,F.jsx)(`div`,{className:`min-h-0 min-w-0 ${He===`vertical`?`border-t first:border-t-0`:`border-l first:border-l-0`} ${e===M?`border-border`:`border-border/70`}`,onPointerDown:()=>{e!==M&&x(e)},children:(0,F.jsx)(`div`,{className:`h-full`,children:(0,F.jsx)(Wn,{advancedTypography:ve,threadRef:r,threadId:i,terminalId:e,terminalLabel:L.get(e)??`Terminal`,cwd:t.cwd,...t.worktreePath===void 0?{}:{worktreePath:t.worktreePath},...t.runtimeEnv?{runtimeEnv:t.runtimeEnv}:{},onSessionExited:()=>fe(e),onAddTerminalContext:S,focusRequestId:ie,autoFocus:e===M,visible:T,resizeEpoch:Oe,drawerHeight:k,keybindings:ge})})},e)})}):(0,F.jsx)(`div`,{className:`h-full`,children:(0,F.jsx)(Wn,{advancedTypography:ve,threadRef:r,threadId:i,terminalId:M,terminalLabel:L.get(M)??`Terminal`,cwd:vt.cwd,...vt.worktreePath===void 0?{}:{worktreePath:vt.worktreePath},...vt.runtimeEnv?{runtimeEnv:vt.runtimeEnv}:{},onSessionExited:()=>fe(M),onAddTerminalContext:S,focusRequestId:ie,autoFocus:!0,visible:T,resizeEpoch:Oe,drawerHeight:k,keybindings:ge},M)})}),t[121]=vt,t[122]=ve,t[123]=k,t[124]=ie,t[125]=Ge,t[126]=ge,t[127]=x,t[128]=S,t[129]=fe,t[130]=Oe,t[131]=R,t[132]=M,t[133]=He,t[134]=L,t[135]=i,t[136]=r,t[137]=T,t[138]=Be,t[139]=Et):Et=t[139];let Dt;t[140]!==E||t[141]!==de||t[142]!==Ze||t[143]!==tt||t[144]!==I||t[145]!==Ue||t[146]!==V||t[147]!==x||t[148]!==W||t[149]!==H||t[150]!==U||t[151]!==M||t[152]!==N||t[153]!==Je||t[154]!==z||t[155]!==B||t[156]!==L?(Dt=Ue&&(0,F.jsxs)(`aside`,{className:`flex w-36 min-w-36 flex-col border border-border/70 bg-muted/10`,children:[(0,F.jsx)(`div`,{className:`flex h-[22px] items-stretch justify-end border-b border-border/70`,children:(0,F.jsxs)(`div`,{className:`inline-flex h-full items-stretch`,children:[(0,F.jsx)(Gn,{disabled:!E,className:`inline-flex h-full items-center px-1 text-foreground/90 transition-colors ${I?`cursor-not-allowed opacity-64 hover:bg-transparent`:`hover:bg-accent/70`}`,onClick:H,label:z,children:(0,F.jsx)(o,{className:`size-3.25`})}),(0,F.jsx)(Gn,{disabled:!E,className:`inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors ${I?`cursor-not-allowed opacity-64 hover:bg-transparent`:`hover:bg-accent/70`}`,onClick:U,label:B,children:(0,F.jsx)(a,{className:`size-3.25`})}),(0,F.jsx)(Gn,{disabled:!E,className:`inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors hover:bg-accent/70`,onClick:W,label:V,children:(0,F.jsx)(f,{className:`size-3.25`})}),(0,F.jsx)(Gn,{disabled:!E,className:`inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors hover:bg-accent/70`,onClick:()=>tt(M),label:Ze,children:(0,F.jsx)(ee,{className:`size-3.25`})})]})}),(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 py-1`,children:N.map(e=>{let t=e.terminalIds.includes(M),n=t?M:e.terminalIds[0]??M,r=e.terminalIds.length,i=r>1,s=i?e.splitDirection===`vertical`?`Stacked`:`Side by side`:`Single`,c=i?e.splitDirection===`vertical`?a:o:g;return(0,F.jsxs)(`div`,{className:`pb-0.5`,children:[Je&&(0,F.jsxs)(`button`,{type:`button`,className:`flex h-[22px] w-full cursor-pointer items-center gap-1 rounded px-1.5 text-2xs ${t?`bg-accent/50 text-foreground`:`text-muted-foreground hover:bg-accent/40 hover:text-foreground`}`,onClick:()=>x(n),children:[(0,F.jsx)(c,{className:`size-3 shrink-0`}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:s}),(0,F.jsx)(`span`,{className:`text-muted-foreground/70 text-3xs tabular-nums`,children:r})]}),(0,F.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.terminalIds.map(e=>{let t=e===M,n=L.get(e)??`Terminal`,r=`Close ${n}${t&&de?` (${de})`:``}`;return(0,F.jsxs)(`div`,{className:h(`group/tab flex h-6 w-full items-center gap-0.5 rounded-md pr-2 pl-1.5 text-xs`,t?`bg-accent text-foreground`:`text-muted-foreground hover:bg-accent/60 hover:text-foreground`),children:[E?(0,F.jsx)(pn,{label:r,onClick:()=>tt(e),tooltip:r,children:(0,F.jsx)(u,{className:`size-3 shrink-0`})}):(0,F.jsx)(u,{className:`size-3 shrink-0`}),(0,F.jsx)(`button`,{type:`button`,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-1 text-left`,onClick:()=>x(e),children:(0,F.jsx)(`span`,{className:`truncate`,children:n})})]},e)})})]},e.id)})})]}),t[140]=E,t[141]=de,t[142]=Ze,t[143]=tt,t[144]=I,t[145]=Ue,t[146]=V,t[147]=x,t[148]=W,t[149]=H,t[150]=U,t[151]=M,t[152]=N,t[153]=Je,t[154]=z,t[155]=B,t[156]=L,t[157]=Dt):Dt=t[157];let Ot;t[158]!==Tt||t[159]!==Et||t[160]!==Dt?(Ot=(0,F.jsx)(`div`,{className:`min-h-0 w-full flex-1`,children:(0,F.jsxs)(`div`,{className:Tt,children:[Et,Dt]})}),t[158]=Tt,t[159]=Et,t[160]=Dt,t[161]=Ot):Ot=t[161];let kt;return t[162]!==yt||t[163]!==xt||t[164]!==St||t[165]!==$||t[166]!==Ct||t[167]!==Ot?(kt=(0,F.jsxs)(`aside`,{"data-thread-terminal-drawer":!0,"data-terminal-owner":yt,className:xt,style:St,children:[$,Ct,Ot]}),t[162]=yt,t[163]=xt,t[164]=St,t[165]=$,t[166]=Ct,t[167]=Ot,t[168]=kt):kt=t[168],kt}function qn(e){return e+1}function Jn(e){return e+1}function Yn(e){return e+1}function Xn(e){return e.terminalIds.length>1}function Zn(e,t){return[e,t]}export{xn as a,fn as c,Sn as i,I as l,Kn as n,gn as o,Rn as r,hn as s,Wn as t,Je as u};
5
- //# sourceMappingURL=ThreadTerminalDrawer-B77-xYz_.js.map