@runeya/runeya 2.0.159 → 2.0.160

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 (165) hide show
  1. package/agent/index.js +109 -21
  2. package/agent/index.js.map +1 -1
  3. package/agent-manager-KMVSAAEZ.js +13 -0
  4. package/chat-2XMACPWG.js +28 -0
  5. package/{chunk-UYOJZ34Z.js → chunk-7QWHH56G.js} +2 -2
  6. package/{chunk-KNWWJND3.js → chunk-AKBRIK4Z.js} +4 -4
  7. package/{chunk-C3KBWZ24.js → chunk-CM5OCVUF.js} +4 -4
  8. package/{chunk-KWKSPNGO.js → chunk-DFUOLMOH.js} +5 -5
  9. package/{chunk-JJTSWJXV.js → chunk-EONEQJPD.js} +5 -5
  10. package/{chunk-ZW4GRZRF.js → chunk-ETVH3KQN.js} +6 -6
  11. package/{chunk-V7BOVXZI.js → chunk-KPWYNT4N.js} +215 -24
  12. package/chunk-KPWYNT4N.js.map +1 -0
  13. package/{chunk-GJ5KN2LL.js → chunk-L5M653DB.js} +6 -6
  14. package/{chunk-LY4HARY5.js → chunk-LQSGSTGA.js} +30 -5
  15. package/chunk-LQSGSTGA.js.map +1 -0
  16. package/{chunk-ZZZQMQWF.js → chunk-VMRDER22.js} +5 -5
  17. package/chunk-VMRDER22.js.map +1 -0
  18. package/{chunk-YEZOV6GP.js → chunk-YRX375BB.js} +2 -2
  19. package/{chunk-YEFYRGSP.js → chunk-Z3HMLODE.js} +2 -2
  20. package/{chunk-GPSTFDKW.js → chunk-ZULN5CM7.js} +35 -19
  21. package/chunk-ZULN5CM7.js.map +1 -0
  22. package/{companion-CGBD5O6Y.js → companion-UNWSLQCL.js} +17 -9
  23. package/{desktop-installer-page-54PKY3L3.js → desktop-installer-page-N4JMRAAJ.js} +3 -3
  24. package/{desktop-launcher-2DWKSS6V.js → desktop-launcher-O7LFXEYZ.js} +3 -3
  25. package/{environment-resolver-E7JDNTRO.js → environment-resolver-S3QD7UJH.js} +6 -6
  26. package/{external-5I5BUT44.js → external-5XDY2FMV.js} +3 -3
  27. package/index.js +12 -12
  28. package/{install-gate-W5D4ZOZK.js → install-gate-MXRFIBIH.js} +2 -2
  29. package/mcp-server/external.js +19 -7
  30. package/mcp-server/external.js.map +1 -1
  31. package/mcp-server/index.js +19 -7
  32. package/mcp-server/index.js.map +1 -1
  33. package/package.json +1 -1
  34. package/{project-store-67M34SNQ.js → project-store-HHMB2DIU.js} +7 -7
  35. package/settings-manager-SK7BDCQO.js +10 -0
  36. package/{src-UZX6XOIK.js → src-4XOEKUXK.js} +93 -20
  37. package/src-4XOEKUXK.js.map +1 -0
  38. package/{src-FTYC7P2P.js → src-LBTF5RDR.js} +12 -2
  39. package/{vault-resolver-5Q25S6NI.js → vault-resolver-DL5FWIGZ.js} +3 -3
  40. package/web/assets/{AgentScalarChatInterface.vue-DLtiWyFa.js → AgentScalarChatInterface.vue-DlQ9QbMY.js} +1 -1
  41. package/web/assets/{AgentTerminalPage-Ds4QAs67.js → AgentTerminalPage-BJqwsAx7.js} +1 -1
  42. package/web/assets/{AiChatModals-Ccx5-MPb.js → AiChatModals-BDUz4ayE.js} +2 -2
  43. package/web/assets/AppLayout-B371VSKT.js +1 -0
  44. package/web/assets/{AppLayout-Pi8OZrHN.css → AppLayout-iUAYhMxU.css} +1 -1
  45. package/web/assets/{AuditPage-TlsfnK1U.js → AuditPage-CDmWtBlr.js} +1 -1
  46. package/web/assets/{CloudAccountPage-BuFn-iaB.js → CloudAccountPage-Bk8QoNat.js} +1 -1
  47. package/web/assets/{CloudMessagingPage-BcOTKWP1.js → CloudMessagingPage-BYFfDa7H.js} +2 -2
  48. package/web/assets/{DashboardPage-BLw_tc_p.js → DashboardPage-BnmqlmJ6.js} +1 -1
  49. package/web/assets/{DirectoryPickerDialog-X6P-Gl27.js → DirectoryPickerDialog-BwBzq-Ib.js} +1 -1
  50. package/web/assets/{EnvironmentForm-CNxgYejU.js → EnvironmentForm-D5thrtnK.js} +1 -1
  51. package/web/assets/{EnvironmentFormPage-Cu9tmfeS.js → EnvironmentFormPage-BvS6f3_v.js} +1 -1
  52. package/web/assets/{EnvironmentListPage-RJc8Noj0.js → EnvironmentListPage-BMpha28O.js} +1 -1
  53. package/web/assets/KanbanListPage-CsTOrPbp.js +1 -0
  54. package/web/assets/{KnowledgeListPage-8asAbOWR.js → KnowledgeListPage-CGLjHGEt.js} +1 -1
  55. package/web/assets/{KnowledgePagePage-CH8ErT7E.js → KnowledgePagePage-Dqu2hdSi.js} +1 -1
  56. package/web/assets/{LaunchProjectPage-Cj4zIh-L.js → LaunchProjectPage-_FRQApLZ.js} +1 -1
  57. package/web/assets/{LaunchServicesPage-C5yBRgjj.js → LaunchServicesPage-ClyWpgrZ.js} +1 -1
  58. package/web/assets/{LaunchShell-BHRT0Iyo.js → LaunchShell-DazwHw9x.js} +1 -1
  59. package/web/assets/LogViewer-BGpxumRk.js +3 -0
  60. package/web/assets/{OrgKeyPrompt-U4dh8VYn.js → OrgKeyPrompt-CJNrQ_wO.js} +1 -1
  61. package/web/assets/{ProcessControls-DR2mGg4A.js → ProcessControls-jj09aiTP.js} +1 -1
  62. package/web/assets/{ProcessDetailPage-UdlOtobk.js → ProcessDetailPage-A-7cwr0N.js} +1 -1
  63. package/web/assets/{ProjectCreateDialog-JJ_UgVSV.js → ProjectCreateDialog-LOK2KCbC.js} +1 -1
  64. package/web/assets/{ProjectLocationGate-RpWuVQOx.js → ProjectLocationGate-Cycmx3Qp.js} +1 -1
  65. package/web/assets/{ProjectPublishDialog-DXBAZVgF.js → ProjectPublishDialog-BK3lQrM5.js} +1 -1
  66. package/web/assets/{RandomJobTestPage-BTyZOdQT.js → RandomJobTestPage-D96PVnUs.js} +1 -1
  67. package/web/assets/{ScenarioEditorPage-DO5s-Rb3.js → ScenarioEditorPage-Dr-vIMo-.js} +1 -1
  68. package/web/assets/{SendToChatDialog-jghvXDZk.js → SendToChatDialog-D4jRJpo9.js} +1 -1
  69. package/web/assets/{ServiceControlsBar-Bjv9tyyt.js → ServiceControlsBar-CMMqc5Aj.js} +1 -1
  70. package/web/assets/{ServiceDetailPage-DHYpDCfp.js → ServiceDetailPage-mvyj5ljn.js} +1 -1
  71. package/web/assets/{ServiceFormPage-CCXaIoow.js → ServiceFormPage-CRPYTrvA.js} +1 -1
  72. package/web/assets/{SettingsPage-s-668z6W.js → SettingsPage-BzvQ7QFy.js} +39 -39
  73. package/web/assets/{SettingsPage-x-Rev6ea.css → SettingsPage-eID2nZZb.css} +1 -1
  74. package/web/assets/{UnlockPage-BNdzhO5C.js → UnlockPage-BOtVWFNI.js} +1 -1
  75. package/web/assets/{VaultMigrationPage-RWmGEMLC.js → VaultMigrationPage-B-0XeVkC.js} +1 -1
  76. package/web/assets/{VersionBadge-Crpf2R7o.js → VersionBadge-Df5nYt5K.js} +1 -1
  77. package/web/assets/{WikiPage-BlemtaAo.js → WikiPage-ZZ9OOPF3.js} +1 -1
  78. package/web/assets/WikiView-CR-7T69N.js +1 -0
  79. package/web/assets/{add-scalar-classes-B5tjvEi-.js → add-scalar-classes--DG4NWe_.js} +2 -2
  80. package/web/assets/{agent.store-5ggNQfb3.js → agent.store-B1T86nA6.js} +1 -1
  81. package/web/assets/auth-BBPhEkWy.js +2 -0
  82. package/web/assets/cloud-chat.store-CcnZa3kG.js +1 -0
  83. package/web/assets/cloud-client-DuiKxuIt.js +2 -0
  84. package/web/assets/{cloud-session-CHtF1SMt.js → cloud-session-Dj2fMKcz.js} +2 -2
  85. package/web/assets/dist-DWtN-uEL.js +1 -0
  86. package/web/assets/i18n-D9syaX83.js +17 -0
  87. package/web/assets/{index-DiXnhxxp.css → index-CchrQcOP.css} +1 -1
  88. package/web/assets/index-CoCePqYs.js +50 -0
  89. package/web/assets/knowledge-host-CRRuuH04.js +7 -0
  90. package/web/assets/knowledge-host-Dcy_zpf6.css +1 -0
  91. package/web/assets/{modal-Bomcd8xq.js → modal-CiY8ERvc.js} +1 -1
  92. package/web/assets/{notification.store-C8qNYGB5.js → notification.store-GxozJ0Vy.js} +1 -1
  93. package/web/assets/pdf-BHDyQiZ-.js +54 -0
  94. package/web/assets/pdf.worker.min-CuFqICzs.js +51 -0
  95. package/web/assets/{project-launch.store-DBuxvZJr.js → project-launch.store-CNT8Buo8.js} +1 -1
  96. package/web/assets/{project.store-CXP-Oq1W.js → project.store-C8ckld_2.js} +1 -1
  97. package/web/assets/scenario.store-DgrGUEgB.js +7 -0
  98. package/web/assets/{service.store-oNOqRX_s.js → service.store-C9J8abIo.js} +1 -1
  99. package/web/assets/{settings-scope-EYddCMQs.js → settings-scope-CI0lqhdd.js} +1 -1
  100. package/web/assets/{settings.store-Dbe4N-TD.js → settings.store-9PqM27KN.js} +1 -1
  101. package/web/assets/src-C1M5hNGI.css +1 -0
  102. package/web/assets/{src-BMnPg9V0.js → src-C1pDBhwJ.js} +89 -24
  103. package/web/assets/src-D_HTzAKM.js +185 -0
  104. package/web/assets/src-DwxqtlGt.js +1 -0
  105. package/web/assets/src-ZDBDx6hs.css +1 -0
  106. package/web/assets/src-dOj6pCsH.css +1 -0
  107. package/web/assets/{trpc-CFd5DIpB.js → trpc-hVn9TTl9.js} +3 -3
  108. package/web/assets/useEnvVarAutocomplete-CokYA4JJ.js +1 -0
  109. package/web/assets/{useProjectCatalog-DT8MiHr7.js → useProjectCatalog-CYjZYzEn.js} +1 -1
  110. package/web/assets/{useProjectCloudOrg-BgBNXoL1.js → useProjectCloudOrg-GSxgZBKD.js} +1 -1
  111. package/web/assets/{useServiceUrlHost-CzDrWXfO.js → useServiceUrlHost-gLOpBQz6.js} +1 -1
  112. package/web/assets/w3c-keyname-BOAvb0qz.js +1 -0
  113. package/web/index.html +27 -17
  114. package/agent-manager-NR24TCUQ.js +0 -13
  115. package/chat-MRS24DL3.js +0 -28
  116. package/chunk-GPSTFDKW.js.map +0 -1
  117. package/chunk-LY4HARY5.js.map +0 -1
  118. package/chunk-V7BOVXZI.js.map +0 -1
  119. package/chunk-ZZZQMQWF.js.map +0 -1
  120. package/settings-manager-M5RS5WRM.js +0 -10
  121. package/src-UZX6XOIK.js.map +0 -1
  122. package/web/assets/AppLayout--wQ4AU4i.js +0 -1
  123. package/web/assets/KanbanBoardPage-CfeFN-sn.js +0 -4
  124. package/web/assets/KanbanBoardPage-Cy1VPXZs.css +0 -1
  125. package/web/assets/KanbanListPage-Bvf_6sKr.js +0 -1
  126. package/web/assets/LogViewer-B-iEIEx5.js +0 -3
  127. package/web/assets/WikiView-Du6Adpd-.js +0 -1
  128. package/web/assets/auth-ArDkSMsT.js +0 -2
  129. package/web/assets/cloud-chat.store-XJxdooyL.js +0 -1
  130. package/web/assets/cloud-client-CMfTrHgZ.js +0 -2
  131. package/web/assets/composables-CCbqJqnd.js +0 -1
  132. package/web/assets/dist-CjS_rxe9.js +0 -1
  133. package/web/assets/i18n-f_6x1GJ8.js +0 -17
  134. package/web/assets/index-Z4n9BqGD.js +0 -297
  135. package/web/assets/knowledge-host-D3fiBt2z.css +0 -1
  136. package/web/assets/knowledge-host-DeJwAH8b.js +0 -7
  137. package/web/assets/scenario-run-overrides-BqTAaZZz.js +0 -1
  138. package/web/assets/scenario.store-B6TiJlpU.js +0 -7
  139. package/web/assets/shared-sse-Dcj_cNvF.js +0 -1
  140. package/web/assets/src-B-YFvUDL.css +0 -1
  141. package/web/assets/src-BY3QUJ9Z.css +0 -1
  142. package/web/assets/src-Cpewe6v-.js +0 -1
  143. package/web/assets/useCloudOrg-_oj_ijeT.js +0 -1
  144. package/web/assets/useEnvVarAutocomplete-IIpGvDLc.js +0 -1
  145. /package/{agent-manager-NR24TCUQ.js.map → agent-manager-KMVSAAEZ.js.map} +0 -0
  146. /package/{chat-MRS24DL3.js.map → chat-2XMACPWG.js.map} +0 -0
  147. /package/{chunk-UYOJZ34Z.js.map → chunk-7QWHH56G.js.map} +0 -0
  148. /package/{chunk-KNWWJND3.js.map → chunk-AKBRIK4Z.js.map} +0 -0
  149. /package/{chunk-C3KBWZ24.js.map → chunk-CM5OCVUF.js.map} +0 -0
  150. /package/{chunk-KWKSPNGO.js.map → chunk-DFUOLMOH.js.map} +0 -0
  151. /package/{chunk-JJTSWJXV.js.map → chunk-EONEQJPD.js.map} +0 -0
  152. /package/{chunk-ZW4GRZRF.js.map → chunk-ETVH3KQN.js.map} +0 -0
  153. /package/{chunk-GJ5KN2LL.js.map → chunk-L5M653DB.js.map} +0 -0
  154. /package/{chunk-YEZOV6GP.js.map → chunk-YRX375BB.js.map} +0 -0
  155. /package/{chunk-YEFYRGSP.js.map → chunk-Z3HMLODE.js.map} +0 -0
  156. /package/{companion-CGBD5O6Y.js.map → companion-UNWSLQCL.js.map} +0 -0
  157. /package/{desktop-installer-page-54PKY3L3.js.map → desktop-installer-page-N4JMRAAJ.js.map} +0 -0
  158. /package/{desktop-launcher-2DWKSS6V.js.map → desktop-launcher-O7LFXEYZ.js.map} +0 -0
  159. /package/{environment-resolver-E7JDNTRO.js.map → environment-resolver-S3QD7UJH.js.map} +0 -0
  160. /package/{external-5I5BUT44.js.map → external-5XDY2FMV.js.map} +0 -0
  161. /package/{install-gate-W5D4ZOZK.js.map → install-gate-MXRFIBIH.js.map} +0 -0
  162. /package/{project-store-67M34SNQ.js.map → project-store-HHMB2DIU.js.map} +0 -0
  163. /package/{settings-manager-M5RS5WRM.js.map → settings-manager-SK7BDCQO.js.map} +0 -0
  164. /package/{src-FTYC7P2P.js.map → src-LBTF5RDR.js.map} +0 -0
  165. /package/{vault-resolver-5Q25S6NI.js.map → vault-resolver-DL5FWIGZ.js.map} +0 -0
@@ -0,0 +1,50 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/trpc-hVn9TTl9.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/reactivity.esm-bundler-BQ9SB2vv.js","assets/runtime-core.esm-bundler-DujKY9QV.js","assets/preload-helper-BZ1Pz5am.js","assets/auth-BBPhEkWy.js","assets/settings-scope-CI0lqhdd.js","assets/project.store-C8ckld_2.js","assets/project-launch.store-CNT8Buo8.js","assets/error-DpF7X5iu.js","assets/UnlockPage-BOtVWFNI.js","assets/runtime-dom.esm-bundler-CyEVRK6B.js","assets/vue-i18n-o7yraQpR.js","assets/useApi-s_02lHjl-DZYO2tHU.js","assets/src-B1nAsOcw.js","assets/floating-ui.dom-DF3oyfHd.js","assets/src-BR35jQnn.css","assets/notification.store-GxozJ0Vy.js","assets/VersionBadge-Df5nYt5K.js","assets/VersionBadge-CtFji3sv.css","assets/UnlockPage-Ce0qsHfn.css","assets/VaultMigrationPage-B-0XeVkC.js","assets/VaultMigrationPage-DMiPJOSR.css","assets/LaunchProjectPage-_FRQApLZ.js","assets/useProjectCatalog-CYjZYzEn.js","assets/cloud-auth-D_am4FlK.js","assets/cloud-session-Dj2fMKcz.js","assets/open-project-org-BNDadG2_.js","assets/cloud-client-DuiKxuIt.js","assets/OrgKeyPrompt-CJNrQ_wO.js","assets/OrgKeyPrompt-FmlWgsj4.css","assets/DirectoryPickerDialog-BwBzq-Ib.js","assets/DirectoryPickerDialog-3lnhU2DU.css","assets/ProjectCreateDialog-LOK2KCbC.js","assets/ProjectCreateDialog-BfY7qA0G.css","assets/LaunchShell-DazwHw9x.js","assets/LaunchShell-y_3rrtGa.css","assets/LaunchProjectPage-CyKA9pY5.css","assets/LaunchServicesPage-ClyWpgrZ.js","assets/app-mode-BVpTuh0i.js","assets/service.store-C9J8abIo.js","assets/agent.store-B1T86nA6.js","assets/dist-DWtN-uEL.js","assets/schemas-68I2iCLF.js","assets/process-BWkHpZOM.js","assets/ProjectLocationGate-Cycmx3Qp.js","assets/LaunchServicesPage-h5o3zLcy.css","assets/AppLayout-B371VSKT.js","assets/vue-router--yRg_Dd_.js","assets/devtools-DCoWQoU_-D2vs4YXr.js","assets/src-C1pDBhwJ.js","assets/uuid-B2pLMyOM.js","assets/src-D_HTzAKM.js","assets/w3c-keyname-BOAvb0qz.js","assets/src-C1M5hNGI.css","assets/src-ZDBDx6hs.css","assets/useAiChatDrawer-D_ofn8Eo.js","assets/src-DwxqtlGt.js","assets/src-dOj6pCsH.css","assets/cloud-chat.store-CcnZa3kG.js","assets/page-actions-CSvO7j9F.js","assets/EditorIcon-DYGui0zm.js","assets/EditorIcon-84kLQJ1r.css","assets/useServiceUrlHost-gLOpBQz6.js","assets/ServiceControlsBar-CMMqc5Aj.js","assets/ProcessControls-jj09aiTP.js","assets/ProcessControls-B7hWVqiR.css","assets/ServiceControlsBar-CRwt-Xry.css","assets/ProjectPublishDialog-BK3lQrM5.js","assets/ProjectPublishDialog-Cd-9yn6d.css","assets/AppLayout-iUAYhMxU.css","assets/DashboardPage-BnmqlmJ6.js","assets/DashboardPage-FvNuC_e4.css","assets/CloudAccountPage-Bk8QoNat.js","assets/use-polling-CEkhIY_9.js","assets/CloudAccountPage-CYcW_3tO.css","assets/CloudMessagingPage-BYFfDa7H.js","assets/scenario.store-DgrGUEgB.js","assets/i18n-D9syaX83.js","assets/scenario-DOeZsRCE.css","assets/AiChatModals-BDUz4ayE.js","assets/editor.api-Bef3xeth.js","assets/editor-8AbsNvUX.css","assets/toggleHighContrast-Dqz1Qao1.js","assets/toggleHighContrast--ixms01u.css","assets/register-BLGIM2pN.js","assets/AiChatModals-DS5R3Oz1.css","assets/CloudMessagingPage-grbGyoki.css","assets/KnowledgeListPage-CGLjHGEt.js","assets/knowledge-host-CRRuuH04.js","assets/knowledge-host-Dcy_zpf6.css","assets/KnowledgeListPage-BjfZa5Wu.css","assets/KnowledgePagePage-Dqu2hdSi.js","assets/KnowledgePagePage-qnvlYhD5.css","assets/KanbanListPage-CsTOrPbp.js","assets/KanbanListPage-DCK-N3nw.css","assets/AgentTerminalPage-BJqwsAx7.js","assets/uuid-D2uso58z.js","assets/AgentTerminalPage-DbPtGy0f.css","assets/AuditPage-CDmWtBlr.js","assets/AuditPage-DRnnuzwq.css","assets/SettingsPage-BzvQ7QFy.js","assets/FlagChip-DBj0fpJC.js","assets/FlagChip-hKL2frzh.css","assets/LogViewer-BGpxumRk.js","assets/useProjectCloudOrg-GSxgZBKD.js","assets/SendToChatDialog-D4jRJpo9.js","assets/LogViewer-nXZtMJDA.css","assets/settings.store-9PqM27KN.js","assets/add-scalar-classes--DG4NWe_.js","assets/interface-content-folder.svg-CnsmgXBU.js","assets/browser-BpWB_ayN.js","assets/SettingsPage-eID2nZZb.css","assets/ScenarioEditorPage-Dr-vIMo-.js","assets/ScenarioEditorPage-BwLBCVeS.css","assets/ServiceFormPage-CRPYTrvA.js","assets/ServiceFormPage-CQ6xL0Rr.css","assets/ServiceDetailPage-mvyj5ljn.js","assets/useEnvVarAutocomplete-CokYA4JJ.js","assets/useEnvVarAutocomplete-gV2loQYv.css","assets/ProcessMetrics-CAiB2nbb.js","assets/ProcessMetrics-kCY31aHV.css","assets/WikiView-CR-7T69N.js","assets/WikiView-CGsHxjvn.css","assets/ServiceDetailPage-DuXvqXk4.css","assets/EnvironmentListPage-BMpha28O.js","assets/EnvironmentForm-D5thrtnK.js","assets/EnvironmentForm-BnTLokUw.css","assets/EnvironmentListPage-BKhq_xXN.css","assets/EnvironmentFormPage-BvS6f3_v.js","assets/EnvironmentFormPage-C1gS0BI_.css","assets/ProcessDetailPage-A-7cwr0N.js","assets/ProcessDetailPage-B7bD2jmj.css","assets/WikiPage-ZZ9OOPF3.js","assets/RandomJobTestPage-D96PVnUs.js","assets/RandomJobTestPage-ES23jzac.css"])))=>i.map(i=>d[i]);
2
+ import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{B as n,C as r,F as i,N as a,O as o,P as s,S as c,_ as l,c as u,g as d,l as f,m as p,o as m,x as h}from"./reactivity.esm-bundler-BQ9SB2vv.js";import{$ as g,B as _,Ct as v,D as y,E as b,Ft as x,Ht as S,J as C,L as w,Lt as T,Nt as E,S as D,St as ee,Y as O,Yt as k,_ as A,b as j,bt as M,ct as N,en as P,et as F,ft as I,g as L,gt as te,it as ne,k as R,mt as z,nn as B,o as V,pt as re,qt as H,rn as U,rt as ie,st as ae,tn as oe,tt as se,u as ce,v as W,wt as G,xt as le,y as K,z as ue}from"./runtime-core.esm-bundler-DujKY9QV.js";import{C as de,S as fe,i as pe,t as me,w as he}from"./runtime-dom.esm-bundler-CyEVRK6B.js";import{n as ge}from"./vue-i18n-o7yraQpR.js";import{a as _e,i as ve,n as ye,r as be}from"./project-launch.store-CNT8Buo8.js";import{r as xe}from"./i18n-D9syaX83.js";import{g as Se,h as Ce}from"./useApi-s_02lHjl-DZYO2tHU.js";import{i as we,n as Te,r as Ee}from"./vue-router--yRg_Dd_.js";import{$ as De,A as Oe,C as ke,H as Ae,J as je,L as Me,M as Ne,N as Pe,P as Fe,Q as Ie,S as Le,U as Re,W as ze,X as Be,Y as Ve,at as He,ct as Ue,d as We,dt as q,et as Ge,ft as Ke,it as qe,j as Je,lt as Ye,nt as Xe,o as Ze,ot as Qe,q as $e,rt as et,st as tt,t as nt,tt as rt,u as it,ut as at,w as ot}from"./src-B1nAsOcw.js";import{a as st,i as ct,o as lt,r as ut,t as dt}from"./scenario.store-DgrGUEgB.js";import{a as ft,i as pt,n as mt,r as ht,t as gt}from"./app-mode-BVpTuh0i.js";import{n as _t,o as vt,r as J,t as yt}from"./trpc-hVn9TTl9.js";import{t as bt}from"./preload-helper-BZ1Pz5am.js";import{c as xt,i as St,n as Ct,r as wt,s as Tt}from"./auth-BBPhEkWy.js";import{t as Et}from"./src-D_HTzAKM.js";import{n as Dt,r as Ot}from"./project.store-C8ckld_2.js";import{a as kt,r as At,t as jt}from"./cloud-auth-D_am4FlK.js";import{i as Mt,n as Nt,r as Pt,t as Ft}from"./useProjectCatalog-CYjZYzEn.js";import{n as It,r as Lt}from"./error-DpF7X5iu.js";import{l as Rt,n as zt,o as Bt,r as Vt,s as Ht}from"./cloud-client-DuiKxuIt.js";import{d as Ut,f as Wt,g as Gt,h as Kt,i as qt,l as Jt,m as Yt,r as Xt,t as Zt,u as Qt,v as $t}from"./src-C1pDBhwJ.js";import{t as en}from"./use-polling-CEkhIY_9.js";import{o as tn}from"./editor.api-Bef3xeth.js";import{a as nn,i as rn,r as an,t as on}from"./AiChatModals-BDUz4ayE.js";import{t as sn}from"./useAiChatDrawer-D_ofn8Eo.js";import{g as cn,n as ln}from"./schemas-68I2iCLF.js";import{a as un,n as dn,r as fn}from"./dist-DWtN-uEL.js";import{t as pn}from"./service.store-C9J8abIo.js";import{t as mn}from"./notification.store-GxozJ0Vy.js";import{t as hn}from"./agent.store-B1T86nA6.js";import{t as gn}from"./useProjectCloudOrg-GSxgZBKD.js";import{t as _n}from"./SendToChatDialog-D4jRJpo9.js";import{n as vn}from"./process-BWkHpZOM.js";import{a as yn,c as bn,d as xn,f as Sn,i as Cn,l as wn,n as Tn,o as En,p as Dn,r as On,s as kn,t as An,u as jn}from"./theme-BZCAxfJD.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Mn=t((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){for(var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),Nn=t((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),Pn=t((e=>{var t=Mn(),n=Nn(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(de(e,ArrayBuffer)||e&&de(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(de(e,SharedArrayBuffer)||e&&de(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(de(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||fe(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(de(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),de(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(de(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||de(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return W(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return K(e).length;default:if(i)return r?-1:W(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return P(this,t,n);case`utf8`:case`utf-8`:return k(this,t,n);case`ascii`:return M(this,t,n);case`latin1`:case`binary`:return N(this,t,n);case`base64`:return O(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return F(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?k(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(de(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,fe(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o=0;for(;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(fe(r))return o;e[n+o]=r}return o}function T(e,t,n,r){return ue(W(t,e.length-n),e,n,r)}function E(e,t,n,r){return ue(G(t),e,n,r)}function D(e,t,n,r){return ue(K(t),e,n,r)}function ee(e,t,n,r){return ue(le(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return E(this,e,t,n);case`base64`:return D(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ee(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function O(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function k(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return j(r)}var A=4096;function j(e){let t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=A));return n}function M(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function N(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function P(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=pe[e[r]];return i}function F(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function I(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=me(function(e){e>>>=0,ae(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&oe(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!1,52,8)};function L(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function te(e,t,n,r,i){ie(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function ne(e,t,n,r,i){ie(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=me(function(e,t=0){return te(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=me(function(e,t=0){return ne(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=me(function(e,t=0){return te(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=me(function(e,t=0){return ne(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function R(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function z(e,t,r,i,a){return t=+t,r>>>=0,a||R(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return z(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return z(this,e,t,!1,n)};function B(e,t,r,i,a){return t=+t,r>>>=0,a||R(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var V={};function re(e,t,n){V[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}re(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),re(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),re(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=H(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function H(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function U(e,t,n){ae(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&oe(t,e.length-(n+1))}function ie(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new V.ERR_OUT_OF_RANGE(`value`,i,e)}U(r,i,a)}function ae(e,t){if(typeof e!=`number`)throw new V.ERR_INVALID_ARG_TYPE(t,`number`,e)}function oe(e,t,n){throw Math.floor(e)===e?t<0?new V.ERR_BUFFER_OUT_OF_BOUNDS:new V.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(ae(e,n),new V.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var se=/[^+/0-9A-Za-z-_]/g;function ce(e){if(e=e.split(`=`)[0],e=e.trim().replace(se,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function W(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function G(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function le(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function K(e){return t.toByteArray(ce(e))}function ue(e,t,n,r){let i=0;for(;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function de(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function fe(e){return e!==e}var pe=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function me(e){return typeof BigInt>`u`?he:e}function he(){throw Error(`BigInt not supported`)}}))(),Fn=R({__name:`PopoverTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e,r=et(),{forwardRef:i,currentElement:a}=at();return r.triggerId||=Ye(void 0,`reka-popover-trigger`),r.contentId||=Ye(void 0,`reka-popover-content`),N(()=>{r.triggerElement.value=a.value}),(e,a)=>(z(),W(G(n(r).hasCustomAnchor.value?n(Ue):n(tt)),{"as-child":``},{default:H(()=>[y(n(Ue),{id:n(r).triggerId,ref:n(i),type:e.as===`button`?`button`:void 0,"aria-haspopup":`dialog`,"aria-expanded":n(r).open.value,"aria-controls":n(r).open.value?n(r).contentId:void 0,"data-state":n(r).open.value?`open`:`closed`,as:e.as,"as-child":t.asChild,onClick:n(r).onOpenToggle},{default:H(()=>[le(e.$slots,`default`)]),_:3},8,[`id`,`type`,`aria-expanded`,`aria-controls`,`data-state`,`as`,`as-child`,`onClick`])]),_:3}))}}),In={key:0,class:`error-boundary`},Ln={class:`error-content`},Rn={class:`error-message`},zn=Ke(R({__name:`ErrorBoundary`,setup(e){let{t}=ge(),i=r(null);ae(e=>(i.value=e instanceof Error?e:Error(String(e)),console.error(`[ErrorBoundary]`,e),!1));function a(){i.value=null}return(e,r)=>i.value?(z(),j(`div`,In,[A(`div`,Ln,[r[0]||=A(`i`,{class:`ti ti-alert-triangle error-icon`},null,-1),A(`h3`,null,U(n(t)(`errorBoundary.title`)),1),A(`p`,Rn,U(i.value.message),1),y(n(q),{label:n(t)(`errorBoundary.tryAgain`),icon:`ti ti-refresh`,onClick:a},null,8,[`label`])])])):le(e.$slots,`default`,{key:1},void 0,!0)}}),[[`__scopeId`,`data-v-1e77a5b4`]]),Bn=r(null),Vn=r(null),Hn=r(`unknown`),Un=r(!0),Wn=null;async function Gn(e){Un.value=!0;try{let t=await J.health.versionInfo.query(e?{force:!0}:void 0);Bn.value=t.current,Vn.value=t.latest,Hn.value=t.status}catch{Hn.value=`unknown`}finally{Un.value=!1}}async function Kn(e={}){e.force?Wn=Gn(!0):Wn??=Gn(!1);let t=Wn;try{await t}finally{Wn===t&&(Wn=null)}}function qn(){return{current:Bn,latest:Vn,status:Hn,loading:Un,outdated:L(()=>Hn.value===`outdated`),check:Kn}}var Jn={class:`update-dialog__lead`},Yn={key:0,class:`update-dialog__row`},Xn={key:1,class:`update-dialog__prereqs`},Zn={class:`update-dialog__prereq`},Qn={class:`update-dialog__prereq`},$n={key:0},er={key:1},tr={key:0,class:`update-dialog__prereq`},nr={key:4,class:`update-dialog__row`},rr={key:7,class:`update-dialog__output`},ir=Ke(R({__name:`AppUpdateDialog`,props:{visible:{type:Boolean},currentVersion:{},latestVersion:{}},emits:[`update:visible`,`updated`],setup(e,{emit:t}){let{t:i}=ge(),a=e,o=t,s=r(`checking`),c=r(null),l=r(``),u=r(null),d=r(``);async function f(){s.value=`checking`,l.value=``,d.value=``;try{let e=await J.appUpdate.prerequisites.query();c.value=e,s.value=e.ready?`ready`:`blocked`}catch(e){d.value=e.message,s.value=`blocked`}}async function p(){s.value=`installing`;try{let e=await J.appUpdate.install.mutate();l.value=e.output,u.value=e.installedVersion,s.value=e.ok?`installed`:`failed`,e.ok&&o(`updated`)}catch(e){d.value=e.message,s.value=`failed`}}async function m(){s.value=`restarting`;try{await J.appUpdate.restart.mutate()}catch{}}return S(()=>a.visible,e=>{e&&f()}),(t,r)=>(z(),W(n(Ve),{visible:e.visible,header:n(i)(`appUpdate.dialogTitle`),modal:``,closable:s.value!==`installing`&&s.value!==`restarting`,style:{width:`34rem`},"onUpdate:visible":r[1]||=e=>o(`update:visible`,e)},{footer:H(()=>[s.value===`blocked`||s.value===`failed`?(z(),W(n(q),{key:0,label:n(i)(`appUpdate.retry`),severity:`secondary`,onClick:f},null,8,[`label`])):K(``,!0),s.value===`ready`?(z(),W(n(q),{key:1,label:n(i)(`appUpdate.install`),icon:`ti ti-download`,onClick:p},null,8,[`label`])):K(``,!0),s.value===`installed`?(z(),W(n(q),{key:2,label:n(i)(`appUpdate.restartLater`),severity:`secondary`,onClick:r[0]||=e=>o(`update:visible`,!1)},null,8,[`label`])):K(``,!0),s.value===`installed`?(z(),W(n(q),{key:3,label:n(i)(`appUpdate.restartNow`),icon:`ti ti-refresh`,onClick:m},null,8,[`label`])):K(``,!0),s.value===`restarting`?(z(),W(n(q),{key:4,label:n(i)(`appUpdate.restarting`),icon:`ti ti-spin ti-loader-2`,disabled:``},null,8,[`label`])):K(``,!0)]),default:H(()=>[A(`p`,Jn,U(n(i)(`appUpdate.dialogLead`,{current:e.currentVersion??`—`,latest:e.latestVersion??`—`})),1),s.value===`checking`?(z(),j(`div`,Yn,[y(n(Ae),{style:{width:`1.5rem`,height:`1.5rem`},strokeWidth:`6`}),A(`span`,null,U(n(i)(`appUpdate.checking`)),1)])):c.value?(z(),j(`div`,Xn,[A(`div`,Zn,[r[2]||=A(`i`,{class:`ti ti-circle-check update-dialog__ok`},null,-1),A(`span`,null,U(n(i)(`appUpdate.nodeFound`,{version:c.value.nodeVersion})),1)]),A(`div`,Qn,[A(`i`,{class:P(c.value.npmVersion?`ti ti-circle-check update-dialog__ok`:`ti ti-circle-x update-dialog__ko`)},null,2),c.value.npmVersion?(z(),j(`span`,$n,U(n(i)(`appUpdate.npmFound`,{version:c.value.npmVersion,path:c.value.npmPath})),1)):(z(),j(`span`,er,U(n(i)(`appUpdate.npmMissing`)),1))]),c.value.globalPrefix?(z(),j(`div`,tr,[r[3]||=A(`i`,{class:`ti ti-folder update-dialog__info`},null,-1),A(`span`,null,U(n(i)(`appUpdate.installTarget`,{prefix:c.value.globalPrefix})),1)])):K(``,!0)])):K(``,!0),s.value===`blocked`&&!c.value?.npmVersion?(z(),W(n(ze),{key:2,severity:`warn`},{default:H(()=>[b(U(n(i)(`appUpdate.npmMissingHelp`)),1)]),_:1})):K(``,!0),d.value?(z(),W(n(ze),{key:3,severity:`error`},{default:H(()=>[b(U(d.value),1)]),_:1})):K(``,!0),s.value===`installing`?(z(),j(`div`,nr,[y(n(Ae),{style:{width:`1.5rem`,height:`1.5rem`},strokeWidth:`6`}),A(`span`,null,U(n(i)(`appUpdate.installing`)),1)])):K(``,!0),s.value===`installed`?(z(),W(n(ze),{key:5,severity:`success`},{default:H(()=>[b(U(n(i)(`appUpdate.installed`,{version:u.value??e.latestVersion??``})),1)]),_:1})):K(``,!0),s.value===`failed`?(z(),W(n(ze),{key:6,severity:`error`},{default:H(()=>[b(U(n(i)(`appUpdate.installFailed`)),1)]),_:1})):K(``,!0),l.value?(z(),j(`pre`,rr,U(l.value),1)):K(``,!0),s.value===`installed`?(z(),W(n(ze),{key:8,severity:`info`},{default:H(()=>[b(U(n(i)(`appUpdate.restartNeeded`)),1)]),_:1})):K(``,!0)]),_:1},8,[`visible`,`header`,`closable`]))}}),[[`__scopeId`,`data-v-bcce910d`]]),ar={key:0,class:`update-banner`},or=3e5,sr=Ke(R({__name:`AppUpdateBanner`,setup(e){let{t}=ge(),{isDesktop:i}=ft(),{current:a,latest:o,outdated:s,check:c}=qn(),l=r(!1),u=null;function d(){document.visibilityState===`visible`&&c()}return N(()=>{i.value&&(c(),u=setInterval(()=>void c(),or),document.addEventListener(`visibilitychange`,d))}),I(()=>{u!==null&&clearInterval(u),document.removeEventListener(`visibilitychange`,d)}),(e,r)=>(z(),j(V,null,[n(i)&&n(s)?(z(),j(`div`,ar,[r[3]||=A(`i`,{class:`ti ti-circle-arrow-up update-banner__icon`},null,-1),A(`span`,null,U(n(t)(`appUpdate.bannerText`,{current:n(a),latest:n(o)})),1),y(n(q),{label:n(t)(`appUpdate.bannerAction`),size:`small`,severity:`contrast`,onClick:r[0]||=e=>l.value=!0},null,8,[`label`])])):K(``,!0),y(ir,{visible:l.value,"onUpdate:visible":r[1]||=e=>l.value=e,"current-version":n(a),"latest-version":n(o),onUpdated:r[2]||=()=>n(c)({force:!0})},null,8,[`visible`,`current-version`,`latest-version`])],64))}}),[[`__scopeId`,`data-v-23af4c89`]]),cr=`runeya:changelog-seen:`;function lr(e){return`${cr}${e}`}function ur(e){try{return localStorage.getItem(lr(e))}catch{return null}}function dr(e,t){try{localStorage.setItem(lr(e),t)}catch{}}async function fr(){let e=ur(`app`);try{if(e===null){let{releases:e}=await J.changelog.index.query({surface:`app`,since:null});return dr(`app`,e[0]?.version??`0`),[]}let{releases:t}=await J.changelog.releases.query({surface:`app`,since:e});return t}catch{return[]}}function pr(e){let t=r([]),n=r(!1),i=r(!1);async function a(){n.value=!0,i.value=!1;try{let n=await J.changelog.releases.query({surface:e,since:null});t.value=n.releases}catch{i.value=!0,t.value=[]}finally{n.value=!1}}return{releases:t,loading:n,failed:i,load:a}}var mr={class:`changelog`},hr={class:`release__head`},gr={key:0,class:`release__version`},_r={key:0,class:`release__title`},vr={class:`release__changes`},yr=Ke(R({__name:`ChangelogReleases`,props:{releases:{}},setup(e){let{t,locale:r}=ge(),i={feature:`changelog.kindFeature`,improvement:`changelog.kindImprovement`,fix:`changelog.kindFix`,breaking:`changelog.kindBreaking`};function a(e){return e.version.startsWith(e.date)?null:e.version}function o(e){return r.value===`fr`?e.fr:e.en}return(r,s)=>(z(),j(`ol`,mr,[(z(!0),j(V,null,M(e.releases,e=>(z(),j(`li`,{key:`${e.surface}-${e.version}`,class:`release`},[A(`header`,hr,[a(e)?(z(),j(`span`,gr,U(a(e)),1)):K(``,!0),A(`span`,{class:P([`release__date`,{"release__date--lead":!a(e)}])},U(e.date),3)]),e.title?(z(),j(`h4`,_r,U(o(e.title)),1)):K(``,!0),A(`ul`,vr,[(z(!0),j(V,null,M(e.changes,(e,r)=>(z(),j(`li`,{key:r,class:`change`},[A(`span`,{class:P([`change__kind`,`change__kind--${e.kind}`])},U(n(t)(i[e.kind])),3),A(`span`,null,U(o(e.text)),1)]))),128))])]))),128))]))}}),[[`__scopeId`,`data-v-ad6af3bd`]]),br={class:`lead`},xr=Ke(R({__name:`AppChangelogDialog`,setup(e){let{t}=ge(),i=r(!1),a=r([]);return N(async()=>{let e=await fr(),t=e[0];t&&(a.value=e,i.value=!0,dr(`app`,t.version))}),(e,r)=>(z(),W(n(Ve),{visible:i.value,"onUpdate:visible":r[1]||=e=>i.value=e,modal:``,"dismissable-mask":``,header:n(t)(`changelog.title`),style:{width:`38rem`,maxWidth:`95vw`}},{footer:H(()=>[y(n(q),{label:n(t)(`changelog.close`),onClick:r[0]||=e=>i.value=!1},null,8,[`label`])]),default:H(()=>[A(`p`,br,U(n(t)(`changelog.dialogLead`)),1),y(yr,{releases:a.value},null,8,[`releases`])]),_:1},8,[`visible`,`header`]))}}),[[`__scopeId`,`data-v-fd0c0bd5`]]);function Sr(e){return/^(https?:|mailto:)/i.test(e)?(window.open(e,`_blank`,`noopener,noreferrer`),!0):!1}var Cr={class:`wizard-intro`},wr={class:`wizard-steps`},Tr={class:`wizard-step__head`},Er={class:`wizard-step__index`},Dr={class:`wizard-step__key`},Or={class:`wizard-step__origin`},kr={key:0},Ar=[`onClick`],jr=Ke(R({__name:`MissingVariablesWizard`,props:{visible:{type:Boolean},missing:{}},emits:[`update:visible`],setup(e,{emit:t}){let i=e,a=t,{t:o}=ge(),s=Fe(),c=Ot(),l=h({}),u=h({}),d=r(!1);S(()=>i.missing,e=>{for(let e of Object.keys(l))delete l[e];for(let e of Object.keys(u))delete u[e];for(let t of e)l[t.variableId]=``},{immediate:!0});let f=L(()=>i.missing.length>0&&i.missing.every(e=>(l[e.variableId]??``).trim()!==``));function p(e){d.value||a(`update:visible`,e)}async function m(){if(f.value&&!d.value){d.value=!0;try{for(let e of i.missing)await c.fillVariable(e.environmentId,e.variableId,l[e.variableId],e.reason);a(`update:visible`,!1)}catch(e){s.add({severity:`error`,summary:o(`common.error`),detail:e.message??o(`missingVariables.saveError`),life:5e3})}finally{d.value=!1}}}return(t,r)=>(z(),W(n(Ve),{visible:e.visible,modal:``,closable:!d.value,header:n(o)(`missingVariables.title`),style:{width:`38rem`,maxWidth:`95vw`},"onUpdate:visible":p},{footer:H(()=>[y(n(q),{label:n(o)(`actions.cancel`),variant:`text`,disabled:d.value,onClick:r[0]||=e=>p(!1)},null,8,[`label`,`disabled`]),y(n(q),{label:n(o)(`missingVariables.save`),loading:d.value,disabled:!f.value,onClick:m},null,8,[`label`,`loading`,`disabled`])]),default:H(()=>[A(`p`,Cr,U(n(o)(`missingVariables.intro`,{count:e.missing.length})),1),A(`div`,wr,[(z(!0),j(V,null,M(e.missing,(t,r)=>(z(),j(`div`,{key:t.variableId,class:`wizard-step`},[A(`div`,Tr,[A(`span`,Er,U(r+1)+`/`+U(e.missing.length),1),A(`code`,Dr,U(t.key),1),y(n(Re),{value:t.reason===`overrideOnly`?n(o)(`missingVariables.reasonOverrideOnly`):n(o)(`missingVariables.reasonRequired`),severity:t.reason===`overrideOnly`?`info`:`warn`},null,8,[`value`,`severity`])]),t.description?(z(),W(n(Et),{key:0,class:`wizard-step__description`,"model-value":t.description,markdown:``,editable:!1,"min-height":`0`,"max-height":`none`,onLinkClick:n(Sr)},null,8,[`model-value`,`onLinkClick`])):K(``,!0),A(`p`,Or,[b(U(n(o)(`missingVariables.definedIn`,{environment:t.environmentName}))+` `,1),t.reason===`overrideOnly`?(z(),j(`span`,kr,` — `+U(n(o)(`missingVariables.machineOnly`)),1)):K(``,!0)]),y(n(je),{modelValue:l[t.variableId],"onUpdate:modelValue":e=>l[t.variableId]=e,type:t.isSecret&&!u[t.variableId]?`password`:`text`,class:`wizard-step__input`,disabled:d.value,placeholder:n(o)(`missingVariables.valuePlaceholder`),onKeydown:de(m,[`enter`])},null,8,[`modelValue`,`onUpdate:modelValue`,`type`,`disabled`,`placeholder`]),t.isSecret?(z(),j(`button`,{key:1,type:`button`,class:`wizard-step__reveal`,onClick:e=>u[t.variableId]=!u[t.variableId]},[A(`i`,{class:P(u[t.variableId]?`ti ti-eye-off`:`ti ti-eye`)},null,2),b(` `+U(u[t.variableId]?n(o)(`missingVariables.hide`):n(o)(`missingVariables.reveal`)),1)],8,Ar)):K(``,!0)]))),128))])]),_:1},8,[`visible`,`closable`,`header`]))}}),[[`__scopeId`,`data-v-ada005d3`]]),Mr=[`src`],Nr=Ke(R({__name:`OrgLogo`,props:{orgId:{},name:{default:``},size:{default:20}},setup(e){let t=e,n=r(!1),i=Pt(),a=Mt(),o=L(()=>a.value[t.orgId]??Nt(t.orgId,i.value[t.orgId])),s=L(()=>(t.name||`?`).charAt(0).toUpperCase());return S(o,()=>{n.value=!1}),(t,r)=>(z(),j(`span`,{class:`org-logo`,style:B({"--org-logo-size":`${e.size}px`})},[n.value?(z(),j(V,{key:1},[b(U(s.value),1)],64)):(z(),j(`img`,{key:0,src:o.value,alt:``,onError:r[0]||=e=>n.value=!0},null,40,Mr))],4))}}),[[`__scopeId`,`data-v-53f6181c`]]);function Pr(e){let t=Dt(),n=ye(),r=L(()=>{let n=t.projects.filter(e=>!e.orgId).map(e=>({id:e.id,orgId:null,name:e.name}));for(let t of e.orgGroups.value)for(let e of t.projects)n.push({id:e.projectId,orgId:t.orgId,...t.accountId?{accountId:t.accountId}:{},name:e.name,orgName:t.name});return n});return{all:r,recent:L(()=>n.recentProjects.filter(e=>e.id!==n.activeProjectId||e.orgId!==n.activeOrgId).map(e=>r.value.find(t=>t.id===e.id&&t.orgId===e.orgId)).filter(e=>!!e))}}var Fr={key:1,class:`palette__section`},Ir=[`aria-label`],Lr=[`aria-selected`,`onMouseenter`,`onClick`],Rr={key:1,class:`ti ti-folder`,"aria-hidden":`true`},zr={class:`palette__name`},Br={class:`palette__org`},Vr={key:2,class:`ti ti-spin ti-loader-2`,"aria-hidden":`true`},Hr={key:3,class:`palette__empty`},Ur=Ke(R({__name:`ProjectPalette`,setup(e){let{t}=ge(),i=Se(),a=ye(),o=Ft(),{all:s,recent:c}=Pr(o),l=r(!1),u=r(``),d=r(0),f=r(!1),p=r(``),m=r(null),h=L(()=>{let e=u.value.trim().toLowerCase();if(!e)return c.value;let t=s.value.filter(t=>t.name.toLowerCase().includes(e)||t.orgName?.toLowerCase().includes(e)),n=e=>{let t=c.value.indexOf(e);return t===-1?c.value.length:t};return t.sort((e,t)=>n(e)-n(t)||e.name.localeCompare(t.name))});S(h,()=>{d.value=0});function g(){u.value=``,p.value=``,d.value=0,l.value=!0,o.refreshCloud()}function _(){(m.value?.$el)?.focus()}async function v(e){if(e&&!f.value){f.value=!0,p.value=``;try{e.orgId&&await o.pullProject(e.orgId,e.id,e.accountId),a.setActiveProject(e.id,e.orgId),l.value=!1;let t=i.currentRoute.value.path.startsWith(`/launch`);i.push(t?{name:`launch-services`}:{name:`dashboard`})}catch(e){p.value=Lt(e,t)}finally{f.value=!1}}}function x(e){let t=h.value.length;e.key===`ArrowDown`&&t?(e.preventDefault(),d.value=(d.value+1)%t):e.key===`ArrowUp`&&t?(e.preventDefault(),d.value=(d.value-1+t)%t):e.key===`Enter`&&(e.preventDefault(),v(h.value[d.value]))}function C(e){!(e.ctrlKey||e.metaKey)||e.shiftKey||e.altKey||e.key.toLowerCase()!==`k`||(e.preventDefault(),e.stopPropagation(),l.value?l.value=!1:g())}return N(()=>window.addEventListener(`keydown`,C,{capture:!0})),I(()=>window.removeEventListener(`keydown`,C,{capture:!0})),(e,r)=>(z(),W(n(Ve),{visible:l.value,"onUpdate:visible":r[1]||=e=>l.value=e,header:n(t)(`projectPalette.title`),"show-header":!1,"dismissable-mask":``,width:`32rem`,onShow:_},{default:H(()=>[y(n(je),{ref_key:`input`,ref:m,modelValue:u.value,"onUpdate:modelValue":r[0]||=e=>u.value=e,class:`palette__input`,placeholder:n(t)(`projectPalette.placeholder`),"aria-label":n(t)(`projectPalette.placeholder`),fluid:``,onKeydown:x},null,8,[`modelValue`,`placeholder`,`aria-label`]),p.value?(z(),W(n(ze),{key:0,severity:`error`,class:`palette__error`},{default:H(()=>[b(U(p.value),1)]),_:1})):K(``,!0),!u.value.trim()&&h.value.length?(z(),j(`p`,Fr,U(n(t)(`projectPalette.recent`)),1)):K(``,!0),h.value.length?(z(),j(`ul`,{key:2,class:`palette__list`,role:`listbox`,"aria-label":n(t)(`projectPalette.title`)},[(z(!0),j(V,null,M(h.value,(e,r)=>(z(),j(`li`,{key:`${e.orgId??`local`}:${e.id}`,role:`option`,class:P([`palette__item`,{"is-highlighted":r===d.value}]),"aria-selected":r===d.value,onMouseenter:e=>d.value=r,onClick:t=>v(e)},[e.orgId?(z(),W(Nr,{key:0,"org-id":e.orgId,name:e.orgName??``,size:18},null,8,[`org-id`,`name`])):(z(),j(`i`,Rr)),A(`span`,zr,U(e.name),1),A(`span`,Br,U(e.orgName??n(t)(`projectSwitcher.local`)),1),f.value&&r===d.value?(z(),j(`i`,Vr)):K(``,!0)],42,Lr))),128))],8,Ir)):(z(),j(`p`,Hr,U(u.value.trim()?n(t)(`projectPalette.noMatch`):n(t)(`projectPalette.noRecent`)),1))]),_:1},8,[`visible`,`header`]))}}),[[`__scopeId`,`data-v-b4b12b37`]]),Wr={class:`mcp-pairing__cwd`},Gr={class:`mcp-pairing__code`},Kr={class:`mcp-pairing__hint`},qr=3e3,Jr=Ke(R({__name:`McpPairingPrompt`,setup(e){let{t}=ge(),i=Fe(),a=r(null),o=r(!1),s=null,c=L(()=>a.value!==null);async function l(){if(!(document.visibilityState!==`visible`||o.value))try{let[e]=await J.mcpPairing.pending.query();a.value=e??null}catch{}}async function u(e){let n=a.value;if(n){o.value=!0;try{await J.mcpPairing.decide.mutate({requestId:n.id,approve:e}),e&&i.add({severity:`success`,summary:t(`mcpPairing.approved`,{name:n.name}),life:4e3})}catch{i.add({severity:`error`,summary:t(`mcpPairing.failed`),life:5e3})}finally{a.value=null,o.value=!1}}}return N(()=>{l(),s=setInterval(()=>{l()},qr)}),I(()=>{s&&clearInterval(s)}),(e,r)=>(z(),W(n(Ve),{visible:c.value,modal:``,closable:!1,header:n(t)(`mcpPairing.title`),style:{width:`32rem`,maxWidth:`95vw`}},{footer:H(()=>[y(n(q),{label:n(t)(`mcpPairing.deny`),variant:`text`,disabled:o.value,onClick:r[0]||=e=>u(!1)},null,8,[`label`,`disabled`]),y(n(q),{label:n(t)(`mcpPairing.approve`),loading:o.value,onClick:r[1]||=e=>u(!0)},null,8,[`label`,`loading`])]),default:H(()=>[a.value?(z(),j(V,{key:0},[A(`p`,null,U(n(t)(`mcpPairing.intro`,{name:a.value.name})),1),A(`code`,Wr,U(a.value.cwd),1),A(`div`,Gr,[A(`span`,null,U(n(t)(`mcpPairing.code`)),1),A(`strong`,null,U(a.value.code),1)]),A(`p`,Kr,U(n(t)(`mcpPairing.codeHint`))+` `+U(n(t)(`mcpPairing.unknownHint`)),1)],64)):K(``,!0)]),_:1},8,[`visible`,`header`]))}}),[[`__scopeId`,`data-v-9fb41eab`]]),Yr=r([]),Xr=r(!1);function Zr(e){let t=e,n=t?.data?.cause??t?.cause;return n&&typeof n==`object`?n:null}function Qr(){async function e(e){if(!e)return!1;try{let t=await Ot().missingVariables(e);return t.length!==0&&(Yr.value=t,Xr.value=!0,!0)}catch(t){return console.warn(`[missing-variables] Lecture impossible pour`,e,t),!1}}function t(e){let t=Zr(e)?.missingVariables;return!Array.isArray(t)||t.length===0?!1:(Yr.value=t,Xr.value=!0,!0)}return{missing:Yr,visible:Xr,checkEnvironment:e,openFromError:t}}function $r(e,t){return e.workflowType===`scenario`?!e.scenarioRunning&&(e.messages?.length??0)===0:!t}function ei(e,t){let n=null,r=null;async function i(){let e=r;if(!e){t(null);return}try{let n=await J.git.status.query(e);e===r&&t(n)}catch{e===r&&t(null)}}let a=en(i,6e4,`git-status-watch`);function o(){n?.unsubscribe(),n=null,a.stop()}return S(e,e=>{JSON.stringify(e??null)!==JSON.stringify(r)&&(o(),r=e?{...e}:null,i(),r&&(n=J.git.onStatusChange.subscribe(r,{onData:e=>t(e),onError(e){let t=e?.message??``;t.includes(`PRECONDITION_FAILED`)||t.includes(`Unresolved variables`)||i()}}),a.start()))},{immediate:!0}),l(o),{refresh:i}}var ti=Ke(R({__name:`MonacoDiffEditor`,props:{original:{},modified:{},language:{default:`plaintext`},height:{default:`100%`},theme:{default:`monokai`}},setup(e){window.MonacoEnvironment||(window.MonacoEnvironment={getWorker(){return new nn}}),tn.defineTheme(`monokai`,{base:`vs-dark`,inherit:!0,rules:[{token:`comment`,foreground:`75715E`,fontStyle:`italic`},{token:`string`,foreground:`E6DB74`},{token:`keyword`,foreground:`F92672`},{token:`number`,foreground:`AE81FF`},{token:`regexp`,foreground:`E6DB74`},{token:`type`,foreground:`66D9EF`,fontStyle:`italic`},{token:`type.identifier`,foreground:`A6E22E`},{token:`delimiter`,foreground:`F8F8F2`},{token:`delimiter.bracket`,foreground:`F8F8F2`},{token:`tag`,foreground:`F92672`},{token:`attribute.name`,foreground:`A6E22E`},{token:`attribute.value`,foreground:`E6DB74`},{token:`variable`,foreground:`F8F8F2`},{token:`variable.predefined`,foreground:`66D9EF`},{token:`constant`,foreground:`AE81FF`},{token:`function`,foreground:`A6E22E`},{token:`operator`,foreground:`F92672`},{token:`identifier`,foreground:`F8F8F2`},{token:`meta.tag`,foreground:`F92672`}],colors:{"editor.background":`#272822`,"editor.foreground":`#F8F8F2`,"editor.lineHighlightBackground":`#3E3D32`,"editor.selectionBackground":`#49483E`,"editorCursor.foreground":`#F8F8F0`,"editorWhitespace.foreground":`#464741`,"editorIndentGuide.background":`#464741`,"editorLineNumber.foreground":`#90908A`,"editorLineNumber.activeForeground":`#F8F8F2`,"diffEditor.insertedTextBackground":`#A6E22E26`,"diffEditor.removedTextBackground":`#F9267226`,"diffEditor.insertedLineBackground":`#A6E22E15`,"diffEditor.removedLineBackground":`#F9267215`}});let t=e,n=r(),i=null,a=null,o=null;return N(()=>{n.value&&(a=tn.createModel(t.original,t.language),o=tn.createModel(t.modified,t.language),i=tn.createDiffEditor(n.value,{theme:t.theme,readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,automaticLayout:!0,fontSize:13,fontFamily:`'Monaco', 'Menlo', 'Ubuntu Mono', Courier, monospace`,renderSideBySide:!0,overviewRulerLanes:0,scrollbar:{verticalScrollbarSize:8,horizontalScrollbarSize:8},originalEditable:!1,ignoreTrimWhitespace:!1}),i.setModel({original:a,modified:o}))}),ne(()=>{a?.dispose(),o?.dispose(),i?.dispose(),a=null,o=null,i=null}),(t,r)=>(z(),j(`div`,{ref_key:`editorContainer`,ref:n,style:B({height:e.height,width:`100%`}),class:`monaco-diff-container`},null,4))}}),[[`__scopeId`,`data-v-ef18ae8b`]]),ni=ve(`editor`,()=>{let e=Fe(),t=ye(),n=r([]),i=r({}),a=r(!1),o=L(()=>n.value.filter(e=>e.installed)),s=L(()=>{let e=i.value.default;return e?n.value.find(t=>t.key===e)??null:null});function c(e){let t=i.value[e];return t?n.value.find(e=>e.key===t)??null:null}function l(e){return c(e)??s.value}async function u(){try{n.value=await J.editor.listAvailable.query()}catch(t){e.add({severity:`error`,summary:`Error`,detail:t instanceof Error?t.message:`Failed to detect editors`,life:3e3})}}async function d(){let n=t.activeProjectId,r=t.activeOrgId;if(n)try{i.value=await J.editor.getPreferences.query({projectId:n,orgId:r})}catch(t){e.add({severity:`error`,summary:`Error`,detail:t instanceof Error?t.message:`Failed to load editor preferences`,life:3e3})}}async function f(n){let r=t.activeProjectId,o=t.activeOrgId;if(r){a.value=!0;try{await J.editor.setDefault.mutate({projectId:r,orgId:o,editorKey:n}),i.value={...i.value,default:n},e.add({severity:`success`,summary:`Default editor updated`,life:2e3})}catch(t){e.add({severity:`error`,summary:`Error`,detail:t instanceof Error?t.message:`Failed to set default editor`,life:3e3})}finally{a.value=!1}}}async function p(n,r){let o=t.activeProjectId,s=t.activeOrgId;if(o){a.value=!0;try{await J.editor.setServiceEditor.mutate({projectId:o,orgId:s,serviceId:n,editorKey:r}),i.value={...i.value,[n]:r}}catch(t){e.add({severity:`error`,summary:`Error`,detail:t instanceof Error?t.message:`Failed to set service editor`,life:3e3})}finally{a.value=!1}}}async function m(n){let r=t.activeProjectId,o=t.activeOrgId;if(r){a.value=!0;try{await J.editor.removeServiceEditor.mutate({projectId:r,orgId:o,serviceId:n});let e={...i.value};delete e[n],i.value=e}catch(t){e.add({severity:`error`,summary:`Error`,detail:t instanceof Error?t.message:`Failed to remove service editor override`,life:3e3})}finally{a.value=!1}}}async function h(t,n){try{await J.editor.open.mutate({editorKey:t,path:n})}catch(t){e.add({severity:`error`,summary:`Error`,detail:t instanceof Error?t.message:`Failed to open editor`,life:3e3})}}return{availableEditors:n,preferences:i,loading:a,installedEditors:o,defaultEditor:s,getServiceEditor:c,getEffectiveEditor:l,fetchAvailable:u,fetchPreferences:d,setDefault:f,setServiceEditor:p,removeServiceEditor:m,openEditor:h}}),ri={class:`git-panel`},ii={key:0,class:`git-panel__unavailable`},ai={class:`git-panel__unavailable-title`},oi={class:`git-panel__unavailable-detail`},si={key:1,class:`git-panel__header`},ci={class:`git-panel__branch`},li={class:`branch-name`},ui={key:2,class:`upstream-label`},di={class:`git-panel__actions`},fi={class:`git-actions-menu`,role:`menu`},pi=[`disabled`],mi={class:`git-panel__tabs`},hi={key:0,class:`tab-badge`},gi={key:0,class:`tab-badge`},_i={class:`git-panel__file-list`},vi={class:`git-commit-area`},yi={class:`commit-actions`},bi={class:`generate-popover`},xi={key:0,class:`git-empty`},Si={class:`git-section-header`},Ci=[`onClick`],wi={class:`file-name`},Ti={class:`git-section-header`},Ei=[`onClick`],Di={class:`file-name`},Oi={class:`file-actions`},ki={class:`git-section-header`},Ai=[`onClick`],ji={class:`file-name`},Mi={class:`git-panel__diff-pane`},Ni={class:`git-section-header diff-header`},Pi={class:`diff-header-actions`},Fi={key:1,class:`diff-placeholder`},Ii={key:1,class:`git-panel__content`},Li={key:0,class:`git-empty`},Ri={class:`commit-hash`},zi={class:`commit-info`},Bi={class:`commit-subject`},Vi={class:`commit-meta`},Hi={key:2,class:`git-panel__content`},Ui={class:`git-section-header`},Wi={class:`create-branch`},Gi={class:`git-section-header`},Ki={class:`branch-label`},qi={class:`git-section-header`},Ji={class:`branch-label`},Yi={key:3,class:`git-panel__content`},Xi={class:`git-section-header`},Zi={key:0,class:`git-stash-empty`},Qi=[`title`],$i={class:`stash-ref`},ea=Ke(R({__name:`ServiceConfigGit`,props:{serviceId:{},agentId:{},projectId:{},orgId:{}},setup(e){let t=e,i=Fe(),a=Se(),{t:o}=ge(),s=ni(),c=r(),l=r(null),u=r(null),d=r(!1),f=L(()=>t.serviceId?{serviceId:t.serviceId}:{agentId:t.agentId,projectId:t.projectId,orgId:t.orgId}),p=L(()=>t.serviceId?s.getEffectiveEditor(t.serviceId):void 0),{openWithDiffContext:m}=sn();function h(){if(!D.value||!k.value)return;let e=`\`\`\`diff\n// ${k.value}\n${D.value}\n\`\`\``;m(e)}async function g(){let e=p.value;if(e&&k.value&&t.serviceId)try{await J.editor.openFile.mutate({editorKey:e.key,serviceId:t.serviceId,relativePath:k.value})}catch(e){i.add({severity:`error`,summary:o(`git.errorTitle`),detail:e instanceof Error?e.message:String(e),life:4e3})}}let _=r(!1),v=r(!1),x=r(null),S=r([]),C=r({current:``,branches:[]}),w=r([]),T=r(``),E=r(``),D=r(``),ee=r(``),O=r(``),k=r(``),F=r(!1),te=r(`status`),ne=r(`origin`),R=r(``),B=r(null);function re(e){B.value?.hide(),e()}let ie=r([]);function ae(e){let t=e.toLowerCase();return t.includes(`fetch failed`)||t.includes(`http 404`)||t.includes(`agent`)&&(t.includes(`not found`)||t.includes(`not connected`))}let oe=L(()=>w.value.map(e=>({label:e.name,value:e.name}))),se=L(()=>!!x.value?.upstream),ce=L(()=>C.value.branches.filter(e=>!e.remote));async function G(e,t){R.value=e;try{await t()}catch(e){let t=e instanceof Error?e.message:String(e);i.add({severity:`error`,summary:o(`git.errorTitle`),detail:t,life:6e3})}finally{R.value=``}}async function le(){_.value=!0;try{let[e,t,n]=await Promise.all([J.git.status.query({...f.value}),J.git.branches.query({...f.value}),J.git.remotes.query({...f.value})]);v.value=!1,x.value=e,C.value=t,w.value=n,Ie(),w.value.length&&!w.value.find(e=>e.name===ne.value)&&(ne.value=w.value[0]?.name??`origin`)}catch(e){let t=e instanceof Error?e.message:String(e);x.value=null,ae(t)?v.value=!0:(v.value=!1,i.add({severity:`error`,summary:o(`git.errorTitle`),detail:t,life:6e3}))}finally{_.value=!1}}async function ue(){try{let e=await J.git.status.query({...f.value});v.value=!1,x.value=e}catch(e){ae(e instanceof Error?e.message:String(e))&&(v.value=!0)}}async function de(){try{let e=await J.git.log.query({...f.value,limit:50});S.value=e}catch(e){let t=e instanceof Error?e.message:String(e);ae(t)||i.add({severity:`error`,summary:o(`git.errorTitle`),detail:t,life:6e3})}}function fe(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,less:`less`,html:`html`,vue:`html`,xml:`xml`,yaml:`yaml`,yml:`yaml`,py:`python`,rs:`rust`,go:`go`,java:`java`,sh:`shell`,sql:`sql`,toml:`ini`,php:`php`,rb:`ruby`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,swift:`swift`,kt:`kotlin`,lua:`lua`,r:`r`,pl:`perl`,bat:`bat`,ps1:`powershell`}[e.split(`.`).pop()?.toLowerCase()??``]||`plaintext`}let pe=L(()=>k.value?fe(k.value):`plaintext`);async function me(e,t=!1,n=!1){let r=await J.git.diff.query({...f.value,path:e,staged:t,untracked:n});D.value=r.diff,ee.value=r.original,O.value=r.modified,k.value=e??``,F.value=t}async function _e(e){await G(`stage:`+e,async()=>{await J.git.stage.mutate({...f.value,paths:[e]}),await ue()})}async function ve(){await G(`stageAll`,async()=>{await J.git.stageAll.mutate({...f.value}),await ue()})}async function ye(e){await G(`unstage:`+e,async()=>{await J.git.unstage.mutate({...f.value,paths:[e]}),await ue()})}async function be(){await G(`unstageAll`,async()=>{await J.git.unstageAll.mutate({...f.value}),await ue()})}async function xe(e){await G(`discard:`+e,async()=>{await J.git.discard.mutate({...f.value,paths:[e]}),await ue()})}async function Ce(){await G(`generateCommit`,async()=>{let e=await J.git.generateCommitMessage.mutate({...f.value,providerId:l.value??void 0,model:u.value??void 0});T.value=e.message})}async function we(){if(!T.value.trim()){i.add({severity:`warn`,summary:o(`git.errorTitle`),detail:o(`git.commitRequired`),life:3e3});return}await G(`commit`,async()=>{let e=await J.git.commit.mutate({...f.value,message:T.value});i.add({severity:`success`,summary:o(`git.committed`),detail:e.output,life:4e3}),T.value=``,await ue()})}async function Te(){await G(`push`,async()=>{let e=await J.git.push.mutate({...f.value,remote:ne.value,setUpstream:!se.value});i.add({severity:`success`,summary:o(`git.pushed`),detail:e.output||o(`git.done`),life:4e3}),await le()})}async function Ee(){await G(`pull`,async()=>{let e=await J.git.pull.mutate({...f.value,remote:ne.value});i.add({severity:`success`,summary:o(`git.pulled`),detail:e.output||o(`git.done`),life:4e3}),await le()})}async function De(){await G(`fetch`,async()=>{await J.git.fetch.mutate({...f.value,remote:ne.value}),i.add({severity:`success`,summary:o(`git.fetched`),detail:o(`git.fetchedDetail`),life:3e3}),await le()})}async function Oe(e){await G(`checkout`,async()=>{await J.git.checkout.mutate({...f.value,branch:e}),i.add({severity:`success`,summary:o(`git.checkedOut`),detail:e,life:3e3}),await le()})}async function Ae(e){await G(`merge-${e}`,async()=>{let t=await J.git.merge.mutate({...f.value,branch:e});i.add({severity:`success`,summary:o(`git.merged`),detail:t.output||o(`git.done`),life:4e3}),await le()})}async function Me(e){await G(`rebase-${e}`,async()=>{let t=await J.git.rebase.mutate({...f.value,branch:e});i.add({severity:`success`,summary:o(`git.rebased`),detail:t.output||o(`git.done`),life:4e3}),await le()})}async function Ne(){E.value.trim()&&await G(`create-branch`,async()=>{await J.git.checkout.mutate({...f.value,branch:E.value,create:!0}),i.add({severity:`success`,summary:o(`git.branchCreated`),detail:E.value,life:3e3}),E.value=``,await le()})}let Pe=L(()=>!!x.value&&x.value.staged.length+x.value.unstaged.length+x.value.untracked.length>0);async function Ie(){try{ie.value=await J.git.stashList.query({...f.value})}catch{ie.value=[]}}async function ze(){await G(`stash`,async()=>{let e=await J.git.stashPush.mutate({...f.value});i.add({severity:`success`,summary:o(`git.stashed`),detail:e.output||o(`git.done`),life:3e3}),await le(),await Ie()})}async function Be(e){await G(`stash-pop-${e}`,async()=>{let t=await J.git.stashPop.mutate({...f.value,index:e});i.add({severity:`success`,summary:o(`git.stashPopped`),detail:t.output||o(`git.done`),life:3e3}),await le(),await Ie()})}async function Ve(e){await G(`stash-apply-${e}`,async()=>{let t=await J.git.stashApply.mutate({...f.value,index:e});i.add({severity:`success`,summary:o(`git.stashApplied`),detail:t.output||o(`git.done`),life:3e3}),await le(),await Ie()})}async function He(e){await G(`stash-drop-${e}`,async()=>{await J.git.stashDrop.mutate({...f.value,index:e}),i.add({severity:`success`,summary:o(`git.stashDropped`),life:3e3}),await Ie()})}let Ue=null,Ge=en(le,1e4,`service-git:refresh`);function Ke(e){d.value=e>0,lt()&&console.log(`[git] AI providers:`,e,`→ selected:`,l.value)}return N(()=>{le(),Ue=J.git.onStatusChange.subscribe({...f.value},{onData(e){x.value=e,v.value=!1},onError(e){let t=e?.message??``;t.includes(`PRECONDITION_FAILED`)||t.includes(`Unresolved variables`)}}),Ge.start()}),I(()=>{Ue?.unsubscribe(),Ue=null,Ge.stop()}),(e,t)=>(z(),j(`div`,ri,[v.value?(z(),j(`div`,ii,[t[19]||=A(`i`,{class:`ti ti-server git-panel__unavailable-icon`},null,-1),A(`span`,ai,U(n(o)(`git.agentUnavailable`)),1),A(`span`,oi,U(n(o)(`git.agentUnavailableDetail`)),1),y(n(q),{label:n(o)(`git.retry`),icon:`ti ti-refresh`,size:`small`,onClick:le},null,8,[`label`])])):K(``,!0),v.value?K(``,!0):(z(),j(`div`,si,[A(`div`,ci,[t[20]||=A(`i`,{class:`ti ti-brand-github`},null,-1),A(`span`,li,U(x.value?.branch??`…`),1),x.value&&x.value.ahead>0?(z(),W(n(Re),{key:0,value:`↑${x.value.ahead}`,severity:`info`,class:`ahead-tag`},null,8,[`value`])):K(``,!0),x.value&&x.value.behind>0?(z(),W(n(Re),{key:1,value:`↓${x.value.behind}`,severity:`warn`,class:`behind-tag`},null,8,[`value`])):K(``,!0),x.value?.upstream?(z(),j(`span`,ui,`→ `+U(x.value.upstream),1)):K(``,!0)]),A(`div`,di,[oe.value.length?(z(),W(n(Le),{key:0,modelValue:ne.value,"onUpdate:modelValue":t[0]||=e=>ne.value=e,options:oe.value,"option-label":`label`,"option-value":`value`,size:`small`,class:`remote-select`},null,8,[`modelValue`,`options`])):K(``,!0),y(n(q),{icon:`ti ti-refresh`,size:`small`,variant:`text`,title:n(o)(`git.refresh`),"aria-label":n(o)(`git.refresh`),loading:_.value,onClick:le},null,8,[`title`,`aria-label`,`loading`]),y(n(q),{icon:`ti ti-chevron-down`,"icon-pos":`right`,label:n(o)(`git.actionsMenu`),size:`small`,variant:`outlined`,loading:!!R.value,"aria-haspopup":`menu`,onClick:t[1]||=e=>B.value?.toggle(e)},null,8,[`label`,`loading`]),y(n(ke),{ref_key:`actionsMenu`,ref:B},{default:H(()=>[A(`div`,fi,[A(`button`,{type:`button`,role:`menuitem`,class:`git-actions-menu__item`,onClick:t[2]||=e=>re(Ee)},[t[21]||=A(`i`,{class:`ti ti-download`,"aria-hidden":`true`},null,-1),A(`span`,null,U(n(o)(`git.pull`)),1)]),A(`button`,{type:`button`,role:`menuitem`,class:`git-actions-menu__item`,onClick:t[3]||=e=>re(Te)},[t[22]||=A(`i`,{class:`ti ti-cloud-upload`,"aria-hidden":`true`},null,-1),A(`span`,null,U(n(o)(`git.push`)),1)]),A(`button`,{type:`button`,role:`menuitem`,class:`git-actions-menu__item`,onClick:t[4]||=e=>re(De)},[t[23]||=A(`i`,{class:`ti ti-refresh`,"aria-hidden":`true`},null,-1),A(`span`,null,U(n(o)(`git.fetch`)),1)]),A(`button`,{type:`button`,role:`menuitem`,class:`git-actions-menu__item`,disabled:!Pe.value,onClick:t[5]||=e=>re(ze)},[t[24]||=A(`i`,{class:`ti ti-inbox`,"aria-hidden":`true`},null,-1),A(`span`,null,U(n(o)(`git.stash`)),1)],8,pi)])]),_:1},512)])])),v.value?K(``,!0):(z(),j(V,{key:2},[A(`div`,mi,[A(`button`,{class:P([`git-tab`,{active:te.value===`status`}]),onClick:t[6]||=e=>te.value=`status`},[t[25]||=A(`i`,{class:`ti ti-file-pencil`},null,-1),b(` `+U(n(o)(`git.tabChanges`))+` `,1),x.value?(z(),j(`span`,hi,U(x.value.staged.length+x.value.unstaged.length+x.value.untracked.length),1)):K(``,!0)],2),A(`button`,{class:P([`git-tab`,{active:te.value===`log`}]),onClick:t[7]||=e=>{te.value=`log`,de()}},[t[26]||=A(`i`,{class:`ti ti-history`},null,-1),b(` `+U(n(o)(`git.tabHistory`)),1)],2),A(`button`,{class:P([`git-tab`,{active:te.value===`branches`}]),onClick:t[8]||=e=>te.value=`branches`},[t[27]||=A(`i`,{class:`ti ti-brand-github`},null,-1),b(` `+U(n(o)(`git.tabBranches`)),1)],2),A(`button`,{class:P([`git-tab`,{active:te.value===`stash`}]),onClick:t[9]||=e=>{te.value=`stash`,Ie()}},[t[28]||=A(`i`,{class:`ti ti-inbox`},null,-1),b(` `+U(n(o)(`git.tabStash`))+` `,1),ie.value.length?(z(),j(`span`,gi,U(ie.value.length),1)):K(``,!0)],2)]),te.value===`status`?(z(),W(n(We),{key:0,class:`git-panel__status-split`,"gutter-size":6},{default:H(()=>[y(n(it),{size:30,"min-size":15,class:`git-panel__file-list-panel`},{default:H(()=>[A(`div`,_i,[A(`div`,vi,[y(n($e),{modelValue:T.value,"onUpdate:modelValue":t[10]||=e=>T.value=e,placeholder:n(o)(`git.commitPlaceholder`),rows:`3`,class:`commit-message`,"auto-resize":``},null,8,[`modelValue`,`placeholder`]),A(`div`,yi,[y(st,{modelValue:l.value,"onUpdate:modelValue":t[11]||=e=>l.value=e,model:u.value,"onUpdate:model":t[12]||=e=>u.value=e,"storage-key":`runeya.git.commitAi`,class:`commit-provider-select`,onLoaded:Ke},null,8,[`modelValue`,`model`]),y(n(q),{icon:`ti ti-sparkles`,label:n(o)(`git.generateMessage`),size:`small`,variant:`outlined`,disabled:!x.value?.staged.length||!d.value,loading:R.value===`generateCommit`,onClick:t[13]||=e=>d.value?Ce():void 0,onMouseenter:t[14]||=e=>d.value?void 0:c.value?.show(e),onMouseleave:t[15]||=e=>d.value?void 0:c.value?.hide()},null,8,[`label`,`disabled`,`loading`]),y(n(ke),{ref_key:`generatePopover`,ref:c},{default:H(()=>[A(`div`,bi,[A(`p`,null,U(n(o)(`git.noProviderMessage`)),1),y(n(q),{label:n(o)(`git.goToSettings`),icon:`ti ti-settings`,size:`small`,variant:`text`,onClick:t[16]||=e=>{n(a).push({name:`settings`,query:{section:`ai`}}),c.value?.hide()}},null,8,[`label`])])]),_:1},512),y(n(q),{label:n(o)(`git.commit`),icon:`ti ti-check`,size:`small`,disabled:!T.value.trim()||!x.value?.staged.length,loading:R.value===`commit`,onClick:we},null,8,[`label`,`disabled`,`loading`])])]),x.value&&x.value.staged.length===0&&x.value.unstaged.length===0&&x.value.untracked.length===0?(z(),j(`div`,xi,[t[29]||=A(`i`,{class:`ti ti-circle-check`},null,-1),A(`span`,null,U(n(o)(`git.workingTreeClean`)),1)])):K(``,!0),x.value&&x.value.staged.length>0?(z(),j(V,{key:1},[A(`div`,Si,[A(`span`,null,U(n(o)(`git.staged`,{count:x.value.staged.length})),1),y(n(q),{size:`small`,variant:`text`,label:n(o)(`git.unstageAll`),onClick:be},null,8,[`label`])]),(z(!0),j(V,null,M(x.value.staged,e=>(z(),j(`div`,{key:`staged-`+e,class:P([`git-file staged`,{selected:k.value===e&&F.value}]),onClick:t=>me(e,!0)},[t[30]||=A(`i`,{class:`ti ti-plus file-icon`},null,-1),A(`span`,wi,U(e),1),y(n(q),{icon:`ti ti-minus`,size:`small`,variant:`text`,severity:`secondary`,class:`file-action`,title:n(o)(`git.unstage`),onClick:he(t=>ye(e),[`stop`])},null,8,[`title`,`onClick`])],10,Ci))),128))],64)):K(``,!0),x.value&&x.value.unstaged.length>0?(z(),j(V,{key:2},[A(`div`,Ti,[A(`span`,null,U(n(o)(`git.unstaged`,{count:x.value.unstaged.length})),1),y(n(q),{size:`small`,variant:`text`,label:n(o)(`git.stageAll`),onClick:ve},null,8,[`label`])]),(z(!0),j(V,null,M(x.value.unstaged,e=>(z(),j(`div`,{key:`unstaged-`+e,class:P([`git-file unstaged`,{selected:k.value===e&&!F.value}]),onClick:t=>me(e,!1)},[t[31]||=A(`i`,{class:`ti ti-pencil file-icon`},null,-1),A(`span`,Di,U(e),1),A(`div`,Oi,[y(n(q),{icon:`ti ti-plus`,size:`small`,variant:`text`,title:n(o)(`git.stage`),class:`file-action`,onClick:he(t=>_e(e),[`stop`])},null,8,[`title`,`onClick`]),y(n(q),{icon:`ti ti-trash`,size:`small`,variant:`text`,severity:`danger`,title:n(o)(`git.discard`),class:`file-action`,onClick:he(t=>xe(e),[`stop`])},null,8,[`title`,`onClick`])])],10,Ei))),128))],64)):K(``,!0),x.value&&x.value.untracked.length>0?(z(),j(V,{key:3},[A(`div`,ki,[A(`span`,null,U(n(o)(`git.untracked`,{count:x.value.untracked.length})),1)]),(z(!0),j(V,null,M(x.value.untracked,e=>(z(),j(`div`,{key:`untracked-`+e,class:`git-file untracked`,onClick:t=>me(e,!1,!0)},[t[32]||=A(`i`,{class:`ti ti-help-circle file-icon`},null,-1),A(`span`,ji,U(e),1),y(n(q),{icon:`ti ti-plus`,size:`small`,variant:`text`,title:n(o)(`git.stage`),class:`file-action`,onClick:he(t=>_e(e),[`stop`])},null,8,[`title`,`onClick`])],8,Ai))),128))],64)):K(``,!0)])]),_:1}),y(n(it),{size:70,"min-size":30,class:`git-panel__diff-pane-panel`},{default:H(()=>[A(`div`,Mi,[k.value?(z(),j(V,{key:0},[A(`div`,Ni,[A(`span`,null,U(n(o)(`git.diff`,{path:k.value||`all`})),1),A(`div`,Pi,[y(n(q),{icon:`ti ti-message`,size:`small`,variant:`text`,title:n(o)(`git.askAiAboutDiff`),onClick:h},null,8,[`title`]),p.value?(z(),W(n(q),{key:0,icon:`ti ti-external-link`,size:`small`,variant:`text`,title:n(o)(`git.openInEditor`,{editor:p.value.name}),onClick:g},null,8,[`title`])):K(``,!0),y(n(q),{icon:`ti ti-x`,size:`small`,variant:`text`,onClick:t[17]||=e=>{k.value=``,D.value=``,ee.value=``,O.value=``}})])]),(z(),W(ti,{key:k.value+`:`+F.value,original:ee.value,modified:O.value,language:pe.value,height:`100%`},null,8,[`original`,`modified`,`language`]))],64)):(z(),j(`div`,Fi,[t[33]||=A(`i`,{class:`ti ti-code`},null,-1),A(`span`,null,U(n(o)(`git.selectFileForDiff`)),1)]))])]),_:1})]),_:1})):te.value===`log`?(z(),j(`div`,Ii,[S.value.length===0?(z(),j(`div`,Li,[t[34]||=A(`i`,{class:`ti ti-history`},null,-1),A(`span`,null,U(n(o)(`git.noCommits`)),1)])):K(``,!0),(z(!0),j(V,null,M(S.value,e=>(z(),j(`div`,{key:e.hash,class:`git-commit-entry`},[A(`div`,Ri,U(e.shortHash),1),A(`div`,zi,[A(`div`,Bi,U(e.subject),1),A(`div`,Vi,U(e.author)+` · `+U(new Date(e.date).toLocaleString()),1)])]))),128))])):te.value===`branches`?(z(),j(`div`,Hi,[A(`div`,Ui,U(n(o)(`git.newBranch`)),1),A(`div`,Wi,[y(n(je),{modelValue:E.value,"onUpdate:modelValue":t[18]||=e=>E.value=e,placeholder:n(o)(`git.branchNamePlaceholder`),size:`small`,class:`branch-input`},null,8,[`modelValue`,`placeholder`]),y(n(q),{label:n(o)(`git.createAndCheckout`),icon:`ti ti-plus`,size:`small`,disabled:!E.value.trim(),loading:R.value===`create-branch`,onClick:Ne},null,8,[`label`,`disabled`,`loading`])]),A(`div`,Gi,U(n(o)(`git.localBranches`,{count:ce.value.length})),1),(z(!0),j(V,null,M(ce.value,e=>(z(),j(`div`,{key:e.name,class:P([`git-branch-entry`,{current:e.current}])},[t[35]||=A(`i`,{class:`ti ti-brand-github branch-icon`},null,-1),A(`span`,Ki,U(e.name),1),e.current?(z(),W(n(Re),{key:0,value:n(o)(`git.current`),severity:`success`,class:`current-tag`},null,8,[`value`])):(z(),W(n(q),{key:1,label:n(o)(`git.checkout`),size:`small`,variant:`text`,loading:R.value===`checkout`,class:`checkout-btn`,onClick:t=>Oe(e.name)},null,8,[`label`,`loading`,`onClick`])),e.current?K(``,!0):(z(),W(n(q),{key:2,label:n(o)(`git.merge`),size:`small`,variant:`text`,severity:`secondary`,loading:R.value===`merge-${e.name}`,class:`checkout-btn`,onClick:t=>Ae(e.name)},null,8,[`label`,`loading`,`onClick`])),e.current?K(``,!0):(z(),W(n(q),{key:3,label:n(o)(`git.rebase`),size:`small`,variant:`text`,severity:`secondary`,loading:R.value===`rebase-${e.name}`,class:`checkout-btn`,onClick:t=>Me(e.name)},null,8,[`label`,`loading`,`onClick`]))],2))),128)),C.value.branches.filter(e=>e.remote).length?(z(),j(V,{key:0},[A(`div`,qi,U(n(o)(`git.remoteBranches`)),1),(z(!0),j(V,null,M(C.value.branches.filter(e=>e.remote),e=>(z(),j(`div`,{key:e.name,class:`git-branch-entry remote`},[t[36]||=A(`i`,{class:`ti ti-world branch-icon`},null,-1),A(`span`,Ji,U(e.name.replace(/^remotes\//,``)),1)]))),128))],64)):K(``,!0)])):te.value===`stash`?(z(),j(`div`,Yi,[A(`div`,Xi,U(n(o)(`git.stashes`,{count:ie.value.length})),1),ie.value.length?K(``,!0):(z(),j(`div`,Zi,U(n(o)(`git.noStashes`)),1)),(z(!0),j(V,null,M(ie.value,e=>(z(),j(`div`,{key:e.ref,class:`git-stash-entry`},[t[37]||=A(`i`,{class:`ti ti-inbox stash-icon`},null,-1),A(`span`,{class:`stash-label`,title:e.message},[A(`span`,$i,`stash@`+U(`{`)+U(e.index)+U(`}`),1),b(` `+U(e.message),1)],8,Qi),y(n(q),{label:n(o)(`git.stashPop`),size:`small`,variant:`text`,loading:R.value===`stash-pop-${e.index}`,class:`checkout-btn`,onClick:t=>Be(e.index)},null,8,[`label`,`loading`,`onClick`]),y(n(q),{label:n(o)(`git.stashApply`),size:`small`,variant:`text`,severity:`secondary`,loading:R.value===`stash-apply-${e.index}`,class:`checkout-btn`,onClick:t=>Ve(e.index)},null,8,[`label`,`loading`,`onClick`]),y(n(q),{label:n(o)(`git.stashDrop`),size:`small`,variant:`text`,severity:`danger`,loading:R.value===`stash-drop-${e.index}`,class:`checkout-btn`,onClick:t=>He(e.index)},null,8,[`label`,`loading`,`onClick`])]))),128))])):K(``,!0)],64))]))}}),[[`__scopeId`,`data-v-3eb1f17d`]]),ta=Object.defineProperty,na=Object.getOwnPropertySymbols,ra=Object.prototype.hasOwnProperty,ia=Object.prototype.propertyIsEnumerable,aa=(e,t,n)=>t in e?ta(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oa=(e,t)=>{for(var n in t||={})ra.call(t,n)&&aa(e,n,t[n]);if(na)for(var n of na(t))ia.call(t,n)&&aa(e,n,t[n]);return e},sa=(e,t)=>{var n={};for(var r in e)ra.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&na)for(var r of na(e))t.indexOf(r)<0&&ia.call(e,r)&&(n[r]=e[r]);return n},ca=`[vue-draggable-plus]: `;function la(e){console.warn(ca+e)}function ua(e){console.error(ca+e)}function da(e,t,n){return n>=0&&n<e.length&&e.splice(n,0,e.splice(t,1)[0]),e}function fa(e){return e.replace(/-(\w)/g,(e,t)=>t?t.toUpperCase():``)}function pa(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[fa(n)]=e[n]),t),{})}function ma(e,t){return Array.isArray(e)&&e.splice(t,1),e}function ha(e,t,n){return Array.isArray(e)&&e.splice(t,0,n),e}function ga(e){return e===void 0}function _a(e){return typeof e==`string`}function va(e,t,n){let r=e.children[n];e.insertBefore(t,r)}function ya(e){e.parentNode&&e.parentNode.removeChild(e)}function ba(e,t=document){let n=null;return n=typeof t?.querySelector==`function`?(t?.querySelector)?.call(t,e):document.querySelector(e),n||la(`Element not found: ${e}`),n}function xa(e,t,n=null){return function(...r){return e.apply(n,r),t.apply(n,r)}}function Sa(e,t){let n=oa({},e);return Object.keys(t).forEach(r=>{n[r]?n[r]=xa(e[r],t[r]):n[r]=t[r]}),n}function Ca(e){return e instanceof HTMLElement}function wa(e,t){Object.keys(e).forEach(n=>{t(n,e[n])})}function Ta(e){return e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97)}var Ea=Object.assign;function Da(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Oa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Da(Object(n),!0).forEach(function(t){Aa(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Da(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ka(e){"@babel/helpers - typeof";return ka=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ka(e)}function Aa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ja(){return ja=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ja.apply(this,arguments)}function Ma(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Na(e,t){if(e==null)return{};var n=Ma(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var Pa=`1.15.2`;function Fa(e){if(typeof window<`u`&&window.navigator)return!!navigator.userAgent.match(e)}var Ia=Fa(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),La=Fa(/Edge/i),Ra=Fa(/firefox/i),za=Fa(/safari/i)&&!Fa(/chrome/i)&&!Fa(/android/i),Ba=Fa(/iP(ad|od|hone)/i),Va=Fa(/chrome/i)&&Fa(/android/i),Ha={capture:!1,passive:!1};function Ua(e,t,n){e.addEventListener(t,n,!Ia&&Ha)}function Wa(e,t,n){e.removeEventListener(t,n,!Ia&&Ha)}function Ga(e,t){if(t){if(t[0]===`>`&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch{return!1}return!1}}function Ka(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function qa(e,t,n,r){if(e){n||=document;do{if(t!=null&&(t[0]===`>`?e.parentNode===n&&Ga(e,t):Ga(e,t))||r&&e===n)return e;if(e===n)break}while(e=Ka(e))}return null}var Ja=/\s+/g;function Ya(e,t,n){e&&t&&(e.classList?e.classList[n?`add`:`remove`](t):e.className=((` `+e.className+` `).replace(Ja,` `).replace(` `+t+` `,` `)+(n?` `+t:``)).replace(Ja,` `))}function Xa(e,t,n){var r=e&&e.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,``):e.currentStyle&&(n=e.currentStyle),t===void 0?n:n[t];!(t in r)&&t.indexOf(`webkit`)===-1&&(t=`-webkit-`+t),r[t]=n+(typeof n==`string`?``:`px`)}}function Za(e,t){var n=``;if(typeof e==`string`)n=e;else do{var r=Xa(e,`transform`);r&&r!==`none`&&(n=r+` `+n)}while(!t&&(e=e.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function Qa(e,t,n){if(e){var r=e.getElementsByTagName(t),i=0,a=r.length;if(n)for(;i<a;i++)n(r[i],i);return r}return[]}function $a(){return document.scrollingElement||document.documentElement}function eo(e,t,n,r,i){if(e.getBoundingClientRect||e===window){var a,o,s,c,l,u,d;if(e!==window&&e.parentNode&&e!==$a()?(a=e.getBoundingClientRect(),o=a.top,s=a.left,c=a.bottom,l=a.right,u=a.height,d=a.width):(o=0,s=0,c=window.innerHeight,l=window.innerWidth,u=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(i||=e.parentNode,!Ia))do if(i&&i.getBoundingClientRect&&(Xa(i,`transform`)!==`none`||n&&Xa(i,`position`)!==`static`)){var f=i.getBoundingClientRect();o-=f.top+parseInt(Xa(i,`border-top-width`)),s-=f.left+parseInt(Xa(i,`border-left-width`)),c=o+a.height,l=s+a.width;break}while(i=i.parentNode);if(r&&e!==window){var p=Za(i||e),m=p&&p.a,h=p&&p.d;p&&(o/=h,s/=m,d/=m,u/=h,c=o+u,l=s+d)}return{top:o,left:s,bottom:c,right:l,width:d,height:u}}}function to(e,t,n){for(var r=so(e,!0),i=eo(e)[t];r;){var a=eo(r)[n],o=void 0;if(o=i>=a,!o)return r;if(r===$a())break;r=so(r,!1)}return!1}function no(e,t,n,r){for(var i=0,a=0,o=e.children;a<o.length;){if(o[a].style.display!==`none`&&o[a]!==ys.ghost&&(r||o[a]!==ys.dragged)&&qa(o[a],n.draggable,e,!1)){if(i===t)return o[a];i++}a++}return null}function ro(e,t){for(var n=e.lastElementChild;n&&(n===ys.ghost||Xa(n,`display`)===`none`||t&&!Ga(n,t));)n=n.previousElementSibling;return n||null}function io(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)e.nodeName.toUpperCase()!==`TEMPLATE`&&e!==ys.clone&&(!t||Ga(e,t))&&n++;return n}function ao(e){var t=0,n=0,r=$a();if(e)do{var i=Za(e),a=i.a,o=i.d;t+=e.scrollLeft*a,n+=e.scrollTop*o}while(e!==r&&(e=e.parentNode));return[t,n]}function oo(e,t){for(var n in e)if(e.hasOwnProperty(n)){for(var r in t)if(t.hasOwnProperty(r)&&t[r]===e[n][r])return Number(n)}return-1}function so(e,t){if(!e||!e.getBoundingClientRect)return $a();var n=e,r=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=Xa(n);if(n.clientWidth<n.scrollWidth&&(i.overflowX==`auto`||i.overflowX==`scroll`)||n.clientHeight<n.scrollHeight&&(i.overflowY==`auto`||i.overflowY==`scroll`)){if(!n.getBoundingClientRect||n===document.body)return $a();if(r||t)return n;r=!0}}while(n=n.parentNode);return $a()}function co(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function lo(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}var uo;function fo(e,t){return function(){if(!uo){var n=arguments,r=this;n.length===1?e.call(r,n[0]):e.apply(r,n),uo=setTimeout(function(){uo=void 0},t)}}}function po(){clearTimeout(uo),uo=void 0}function mo(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function ho(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}function go(e,t,n){var r={};return Array.from(e.children).forEach(function(i){if(qa(i,t.draggable,e,!1)&&!i.animated&&i!==n){var a=eo(i);r.left=Math.min(r.left??1/0,a.left),r.top=Math.min(r.top??1/0,a.top),r.right=Math.max(r.right??-1/0,a.right),r.bottom=Math.max(r.bottom??-1/0,a.bottom)}}),r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}var _o=`Sortable`+new Date().getTime();function vo(){var e=[],t;return{captureAnimationState:function(){e=[],this.options.animation&&[].slice.call(this.el.children).forEach(function(t){if(Xa(t,`display`)!==`none`&&t!==ys.ghost){e.push({target:t,rect:eo(t)});var n=Oa({},e[e.length-1].rect);if(t.thisAnimationDuration){var r=Za(t,!0);r&&(n.top-=r.f,n.left-=r.e)}t.fromRect=n}})},addAnimationState:function(t){e.push(t)},removeAnimationState:function(t){e.splice(oo(e,{target:t}),1)},animateAll:function(n){var r=this;if(!this.options.animation){clearTimeout(t),typeof n==`function`&&n();return}var i=!1,a=0;e.forEach(function(e){var t=0,n=e.target,o=n.fromRect,s=eo(n),c=n.prevFromRect,l=n.prevToRect,u=e.rect,d=Za(n,!0);d&&(s.top-=d.f,s.left-=d.e),n.toRect=s,n.thisAnimationDuration&&lo(c,s)&&!lo(o,s)&&(u.top-s.top)/(u.left-s.left)===(o.top-s.top)/(o.left-s.left)&&(t=bo(u,c,l,r.options)),lo(s,o)||(n.prevFromRect=o,n.prevToRect=s,t||=r.options.animation,r.animate(n,u,s,t)),t&&(i=!0,a=Math.max(a,t),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout(function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null},t),n.thisAnimationDuration=t)}),clearTimeout(t),i?t=setTimeout(function(){typeof n==`function`&&n()},a):typeof n==`function`&&n(),e=[]},animate:function(e,t,n,r){if(r){Xa(e,`transition`,``),Xa(e,`transform`,``);var i=Za(this.el),a=i&&i.a,o=i&&i.d,s=(t.left-n.left)/(a||1),c=(t.top-n.top)/(o||1);e.animatingX=!!s,e.animatingY=!!c,Xa(e,`transform`,`translate3d(`+s+`px,`+c+`px,0)`),this.forRepaintDummy=yo(e),Xa(e,`transition`,`transform `+r+`ms`+(this.options.easing?` `+this.options.easing:``)),Xa(e,`transform`,`translate3d(0,0,0)`),typeof e.animated==`number`&&clearTimeout(e.animated),e.animated=setTimeout(function(){Xa(e,`transition`,``),Xa(e,`transform`,``),e.animated=!1,e.animatingX=!1,e.animatingY=!1},r)}}}}function yo(e){return e.offsetWidth}function bo(e,t,n,r){return Math.sqrt((t.top-e.top)**2+(t.left-e.left)**2)/Math.sqrt((t.top-n.top)**2+(t.left-n.left)**2)*r.animation}var xo=[],So={initializeByDefault:!0},Co={mount:function(e){for(var t in So)So.hasOwnProperty(t)&&!(t in e)&&(e[t]=So[t]);xo.forEach(function(t){if(t.pluginName===e.pluginName)throw`Sortable: Cannot mount plugin ${e.pluginName} more than once`}),xo.push(e)},pluginEvent:function(e,t,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var i=e+`Global`;xo.forEach(function(r){t[r.pluginName]&&(t[r.pluginName][i]&&t[r.pluginName][i](Oa({sortable:t},n)),t.options[r.pluginName]&&t[r.pluginName][e]&&t[r.pluginName][e](Oa({sortable:t},n)))})},initializePlugins:function(e,t,n,r){for(var i in xo.forEach(function(r){var i=r.pluginName;if(e.options[i]||r.initializeByDefault){var a=new r(e,t,e.options);a.sortable=e,a.options=e.options,e[i]=a,ja(n,a.defaults)}}),e.options)if(e.options.hasOwnProperty(i)){var a=this.modifyOption(e,i,e.options[i]);a!==void 0&&(e.options[i]=a)}},getEventProperties:function(e,t){var n={};return xo.forEach(function(r){typeof r.eventProperties==`function`&&ja(n,r.eventProperties.call(t[r.pluginName],e))}),n},modifyOption:function(e,t,n){var r;return xo.forEach(function(i){e[i.pluginName]&&i.optionListeners&&typeof i.optionListeners[t]==`function`&&(r=i.optionListeners[t].call(e[i.pluginName],n))}),r}};function wo(e){var t=e.sortable,n=e.rootEl,r=e.name,i=e.targetEl,a=e.cloneEl,o=e.toEl,s=e.fromEl,c=e.oldIndex,l=e.newIndex,u=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,p=e.putSortable,m=e.extraEventProperties;if(t||=n&&n[_o],t){var h,g=t.options,_=`on`+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!Ia&&!La?h=new CustomEvent(r,{bubbles:!0,cancelable:!0}):(h=document.createEvent(`Event`),h.initEvent(r,!0,!0)),h.to=o||n,h.from=s||n,h.item=i||n,h.clone=a,h.oldIndex=c,h.newIndex=l,h.oldDraggableIndex=u,h.newDraggableIndex=d,h.originalEvent=f,h.pullMode=p?p.lastPutMode:void 0;var v=Oa(Oa({},m),Co.getEventProperties(r,t));for(var y in v)h[y]=v[y];n&&n.dispatchEvent(h),g[_]&&g[_].call(t,h)}}var To=[`evt`],Eo=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.evt,i=Na(n,To);Co.pluginEvent.bind(ys)(e,t,Oa({dragEl:Y,parentEl:Oo,ghostEl:ko,rootEl:Ao,nextEl:jo,lastDownEl:Mo,cloneEl:No,cloneHidden:Po,dragStarted:Xo,putSortable:Bo,activeSortable:ys.active,originalEvent:r,oldIndex:Fo,oldDraggableIndex:Lo,newIndex:Io,newDraggableIndex:Ro,hideGhostForTarget:hs,unhideGhostForTarget:gs,cloneNowHidden:function(){Po=!0},cloneNowShown:function(){Po=!1},dispatchSortableEvent:function(e){Do({sortable:t,name:e,originalEvent:r})}},i))};function Do(e){wo(Oa({putSortable:Bo,cloneEl:No,targetEl:Y,rootEl:Ao,oldIndex:Fo,oldDraggableIndex:Lo,newIndex:Io,newDraggableIndex:Ro},e))}var Y,Oo,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,Bo,Vo=!1,Ho=!1,Uo=[],Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o=!1,es=!1,ts,ns,rs=[],is=!1,as=[],os=typeof document<`u`,ss=Ba,cs=La||Ia?`cssFloat`:`float`,ls=os&&!Va&&!Ba&&`draggable`in document.createElement(`div`),us=function(){if(os){if(Ia)return!1;var e=document.createElement(`x`);return e.style.cssText=`pointer-events:auto`,e.style.pointerEvents===`auto`}}(),ds=function(e,t){var n=Xa(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=no(e,0,t),a=no(e,1,t),o=i&&Xa(i),s=a&&Xa(a),c=o&&parseInt(o.marginLeft)+parseInt(o.marginRight)+eo(i).width,l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+eo(a).width;if(n.display===`flex`)return n.flexDirection===`column`||n.flexDirection===`column-reverse`?`vertical`:`horizontal`;if(n.display===`grid`)return n.gridTemplateColumns.split(` `).length<=1?`vertical`:`horizontal`;if(i&&o.float&&o.float!==`none`){var u=o.float===`left`?`left`:`right`;return a&&(s.clear===`both`||s.clear===u)?`vertical`:`horizontal`}return i&&(o.display===`block`||o.display===`flex`||o.display===`table`||o.display===`grid`||c>=r&&n[cs]===`none`||a&&n[cs]===`none`&&c+l>r)?`vertical`:`horizontal`},fs=function(e,t,n){var r=n?e.left:e.top,i=n?e.right:e.bottom,a=n?e.width:e.height,o=n?t.left:t.top,s=n?t.right:t.bottom,c=n?t.width:t.height;return r===o||i===s||r+a/2===o+c/2},ps=function(e,t){var n;return Uo.some(function(r){var i=r[_o].options.emptyInsertThreshold;if(i&&!ro(r)){var a=eo(r),o=e>=a.left-i&&e<=a.right+i,s=t>=a.top-i&&t<=a.bottom+i;if(o&&s)return n=r}}),n},ms=function(e){function t(e,n){return function(r,i,a,o){var s=r.options.group.name&&i.options.group.name&&r.options.group.name===i.options.group.name;if(e==null&&(n||s))return!0;if(e==null||e===!1)return!1;if(n&&e===`clone`)return e;if(typeof e==`function`)return t(e(r,i,a,o),n)(r,i,a,o);var c=(n?r:i).options.group.name;return e===!0||typeof e==`string`&&e===c||e.join&&e.indexOf(c)>-1}}var n={},r=e.group;(!r||ka(r)!=`object`)&&(r={name:r}),n.name=r.name,n.checkPull=t(r.pull,!0),n.checkPut=t(r.put),n.revertClone=r.revertClone,e.group=n},hs=function(){!us&&ko&&Xa(ko,`display`,`none`)},gs=function(){!us&&ko&&Xa(ko,`display`,``)};os&&!Va&&document.addEventListener(`click`,function(e){if(Ho)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ho=!1,!1},!0);var _s=function(e){if(Y){e=e.touches?e.touches[0]:e;var t=ps(e.clientX,e.clientY);if(t){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[_o]._onDragOver(n)}}},vs=function(e){Y&&Y.parentNode[_o]._isOutsideThisEl(e.target)};function ys(e,t){if(!(e&&e.nodeType&&e.nodeType===1))throw`Sortable: \`el\` must be an HTMLElement, not ${{}.toString.call(e)}`;this.el=e,this.options=t=ja({},t),e[_o]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?`>li`:`>*`,swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return ds(e,this.options)},ghostClass:`sortable-ghost`,chosenClass:`sortable-chosen`,dragClass:`sortable-drag`,ignore:`a, img`,filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData(`Text`,t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:`data-id`,delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:`sortable-fallback`,fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:ys.supportPointer!==!1&&`PointerEvent`in window&&!za,emptyInsertThreshold:5};for(var r in Co.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var i in ms(t),this)i.charAt(0)===`_`&&typeof this[i]==`function`&&(this[i]=this[i].bind(this));this.nativeDraggable=!t.forceFallback&&ls,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?Ua(e,`pointerdown`,this._onTapStart):(Ua(e,`mousedown`,this._onTapStart),Ua(e,`touchstart`,this._onTapStart)),this.nativeDraggable&&(Ua(e,`dragover`,this),Ua(e,`dragenter`,this)),Uo.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),ja(this,vo())}ys.prototype={constructor:ys,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(Zo=null)},_getDirection:function(e,t){return typeof this.options.direction==`function`?this.options.direction.call(this,e,t,Y):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,i=r.preventOnFilter,a=e.type,o=e.touches&&e.touches[0]||e.pointerType&&e.pointerType===`touch`&&e,s=(o||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,l=r.filter;if(ks(n),!Y&&!(/mousedown|pointerdown/.test(a)&&e.button!==0||r.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&za&&s&&s.tagName.toUpperCase()===`SELECT`)&&(s=qa(s,r.draggable,n,!1),!(s&&s.animated)&&Mo!==s)){if(Fo=io(s),Lo=io(s,r.draggable),typeof l==`function`){if(l.call(this,e,s,this)){Do({sortable:t,rootEl:c,name:`filter`,targetEl:s,toEl:n,fromEl:n}),Eo(`filter`,t,{evt:e}),i&&e.cancelable&&e.preventDefault();return}}else if(l&&(l=l.split(`,`).some(function(r){if(r=qa(c,r.trim(),n,!1),r)return Do({sortable:t,rootEl:r,name:`filter`,targetEl:s,fromEl:n,toEl:n}),Eo(`filter`,t,{evt:e}),!0}),l)){i&&e.cancelable&&e.preventDefault();return}r.handle&&!qa(c,r.handle,n,!1)||this._prepareDragStart(e,o,s)}}},_prepareDragStart:function(e,t,n){var r=this,i=r.el,a=r.options,o=i.ownerDocument,s;if(n&&!Y&&n.parentNode===i){var c=eo(n);if(Ao=i,Y=n,Oo=Y.parentNode,jo=Y.nextSibling,Mo=n,zo=a.group,ys.dragged=Y,Wo={target:Y,clientX:(t||e).clientX,clientY:(t||e).clientY},Jo=Wo.clientX-c.left,Yo=Wo.clientY-c.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Y.style[`will-change`]=`all`,s=function(){if(Eo(`delayEnded`,r,{evt:e}),ys.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!Ra&&r.nativeDraggable&&(Y.draggable=!0),r._triggerDragStart(e,t),Do({sortable:r,name:`choose`,originalEvent:e}),Ya(Y,a.chosenClass,!0)},a.ignore.split(`,`).forEach(function(e){Qa(Y,e.trim(),Ss)}),Ua(o,`dragover`,_s),Ua(o,`mousemove`,_s),Ua(o,`touchmove`,_s),Ua(o,`mouseup`,r._onDrop),Ua(o,`touchend`,r._onDrop),Ua(o,`touchcancel`,r._onDrop),Ra&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Y.draggable=!0),Eo(`delayStart`,this,{evt:e}),a.delay&&(!a.delayOnTouchOnly||t)&&(!this.nativeDraggable||!(La||Ia))){if(ys.eventCanceled){this._onDrop();return}Ua(o,`mouseup`,r._disableDelayedDrag),Ua(o,`touchend`,r._disableDelayedDrag),Ua(o,`touchcancel`,r._disableDelayedDrag),Ua(o,`mousemove`,r._delayedDragTouchMoveHandler),Ua(o,`touchmove`,r._delayedDragTouchMoveHandler),a.supportPointer&&Ua(o,`pointermove`,r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(s,a.delay)}else s()}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Y&&Ss(Y),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Wa(e,`mouseup`,this._disableDelayedDrag),Wa(e,`touchend`,this._disableDelayedDrag),Wa(e,`touchcancel`,this._disableDelayedDrag),Wa(e,`mousemove`,this._delayedDragTouchMoveHandler),Wa(e,`touchmove`,this._delayedDragTouchMoveHandler),Wa(e,`pointermove`,this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t||=e.pointerType==`touch`&&e,!this.nativeDraggable||t?this.options.supportPointer?Ua(document,`pointermove`,this._onTouchMove):t?Ua(document,`touchmove`,this._onTouchMove):Ua(document,`mousemove`,this._onTouchMove):(Ua(Y,`dragend`,this),Ua(Ao,`dragstart`,this._onDragStart));try{document.selection?As(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,t){if(Vo=!1,Ao&&Y){Eo(`dragStarted`,this,{evt:t}),this.nativeDraggable&&Ua(document,`dragover`,vs);var n=this.options;!e&&Ya(Y,n.dragClass,!1),Ya(Y,n.ghostClass,!0),ys.active=this,e&&this._appendGhost(),Do({sortable:this,name:`start`,originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(Go){this._lastX=Go.clientX,this._lastY=Go.clientY,hs();for(var e=document.elementFromPoint(Go.clientX,Go.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Go.clientX,Go.clientY),e!==t);)t=e;if(Y.parentNode[_o]._isOutsideThisEl(e),t)do{if(t[_o]){var n=void 0;if(n=t[_o]._onDragOver({clientX:Go.clientX,clientY:Go.clientY,target:e,rootEl:t}),n&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);gs()}},_onTouchMove:function(e){if(Wo){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,i=e.touches?e.touches[0]:e,a=ko&&Za(ko,!0),o=ko&&a&&a.a,s=ko&&a&&a.d,c=ss&&ns&&ao(ns),l=(i.clientX-Wo.clientX+r.x)/(o||1)+(c?c[0]-rs[0]:0)/(o||1),u=(i.clientY-Wo.clientY+r.y)/(s||1)+(c?c[1]-rs[1]:0)/(s||1);if(!ys.active&&!Vo){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(ko){a?(a.e+=l-(Ko||0),a.f+=u-(qo||0)):a={a:1,b:0,c:0,d:1,e:l,f:u};var d=`matrix(${a.a},${a.b},${a.c},${a.d},${a.e},${a.f})`;Xa(ko,`webkitTransform`,d),Xa(ko,`mozTransform`,d),Xa(ko,`msTransform`,d),Xa(ko,`transform`,d),Ko=l,qo=u,Go=i}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!ko){var e=this.options.fallbackOnBody?document.body:Ao,t=eo(Y,!0,ss,!0,e),n=this.options;if(ss){for(ns=e;Xa(ns,`position`)===`static`&&Xa(ns,`transform`)===`none`&&ns!==document;)ns=ns.parentNode;ns!==document.body&&ns!==document.documentElement?(ns===document&&(ns=$a()),t.top+=ns.scrollTop,t.left+=ns.scrollLeft):ns=$a(),rs=ao(ns)}ko=Y.cloneNode(!0),Ya(ko,n.ghostClass,!1),Ya(ko,n.fallbackClass,!0),Ya(ko,n.dragClass,!0),Xa(ko,`transition`,``),Xa(ko,`transform`,``),Xa(ko,`box-sizing`,`border-box`),Xa(ko,`margin`,0),Xa(ko,`top`,t.top),Xa(ko,`left`,t.left),Xa(ko,`width`,t.width),Xa(ko,`height`,t.height),Xa(ko,`opacity`,`0.8`),Xa(ko,`position`,ss?`absolute`:`fixed`),Xa(ko,`zIndex`,`100000`),Xa(ko,`pointerEvents`,`none`),ys.ghost=ko,e.appendChild(ko),Xa(ko,`transform-origin`,Jo/parseInt(ko.style.width)*100+`% `+Yo/parseInt(ko.style.height)*100+`%`)}},_onDragStart:function(e,t){var n=this,r=e.dataTransfer,i=n.options;if(Eo(`dragStart`,this,{evt:e}),ys.eventCanceled){this._onDrop();return}Eo(`setupClone`,this),ys.eventCanceled||(No=ho(Y),No.removeAttribute(`id`),No.draggable=!1,No.style[`will-change`]=``,this._hideClone(),Ya(No,this.options.chosenClass,!1),ys.clone=No),n.cloneId=As(function(){Eo(`clone`,n),!ys.eventCanceled&&(n.options.removeCloneOnHide||Ao.insertBefore(No,Y),n._hideClone(),Do({sortable:n,name:`clone`}))}),!t&&Ya(Y,i.dragClass,!0),t?(Ho=!0,n._loopId=setInterval(n._emulateDragOver,50)):(Wa(document,`mouseup`,n._onDrop),Wa(document,`touchend`,n._onDrop),Wa(document,`touchcancel`,n._onDrop),r&&(r.effectAllowed=`move`,i.setData&&i.setData.call(n,r,Y)),Ua(document,`drop`,n),Xa(Y,`transform`,`translateZ(0)`)),Vo=!0,n._dragStartId=As(n._dragStarted.bind(n,t,e)),Ua(document,`selectstart`,n),Xo=!0,za&&Xa(document.body,`user-select`,`none`)},_onDragOver:function(e){var t=this.el,n=e.target,r,i,a,o=this.options,s=o.group,c=ys.active,l=zo===s,u=o.sort,d=Bo||c,f,p=this,m=!1;if(is)return;function h(o,s){Eo(o,p,Oa({evt:e,isOwner:l,axis:f?`vertical`:`horizontal`,revert:a,dragRect:r,targetRect:i,canSort:u,fromSortable:d,target:n,completed:_,onMove:function(n,i){return xs(Ao,t,Y,r,n,eo(n),e,i)},changed:v},s))}function g(){h(`dragOverAnimationCapture`),p.captureAnimationState(),p!==d&&d.captureAnimationState()}function _(r){return h(`dragOverCompleted`,{insertion:r}),r&&(l?c._hideClone():c._showClone(p),p!==d&&(Ya(Y,Bo?Bo.options.ghostClass:c.options.ghostClass,!1),Ya(Y,o.ghostClass,!0)),Bo!==p&&p!==ys.active?Bo=p:p===ys.active&&Bo&&(Bo=null),d===p&&(p._ignoreWhileAnimating=n),p.animateAll(function(){h(`dragOverAnimationComplete`),p._ignoreWhileAnimating=null}),p!==d&&(d.animateAll(),d._ignoreWhileAnimating=null)),(n===Y&&!Y.animated||n===t&&!n.animated)&&(Zo=null),!o.dragoverBubble&&!e.rootEl&&n!==document&&(Y.parentNode[_o]._isOutsideThisEl(e.target),!r&&_s(e)),!o.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),m=!0}function v(){Io=io(Y),Ro=io(Y,o.draggable),Do({sortable:p,name:`change`,toEl:t,newIndex:Io,newDraggableIndex:Ro,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),n=qa(n,o.draggable,t,!0),h(`dragOver`),ys.eventCanceled)return m;if(Y.contains(e.target)||n.animated&&n.animatingX&&n.animatingY||p._ignoreWhileAnimating===n)return _(!1);if(Ho=!1,c&&!o.disabled&&(l?u||(a=Oo!==Ao):Bo===this||(this.lastPutMode=zo.checkPull(this,c,Y,e))&&s.checkPut(this,c,Y,e))){if(f=this._getDirection(e,n)===`vertical`,r=eo(Y),h(`dragOverValid`),ys.eventCanceled)return m;if(a)return Oo=Ao,g(),this._hideClone(),h(`revert`),ys.eventCanceled||(jo?Ao.insertBefore(Y,jo):Ao.appendChild(Y)),_(!0);var y=ro(t,o.draggable);if(!y||Ts(e,f,this)&&!y.animated){if(y===Y)return _(!1);if(y&&t===e.target&&(n=y),n&&(i=eo(n)),xs(Ao,t,Y,r,n,i,e,!!n)!==!1)return g(),y&&y.nextSibling?t.insertBefore(Y,y.nextSibling):t.appendChild(Y),Oo=t,v(),_(!0)}else if(y&&ws(e,f,this)){var b=no(t,0,o,!0);if(b===Y)return _(!1);if(n=b,i=eo(n),xs(Ao,t,Y,r,n,i,e,!1)!==!1)return g(),t.insertBefore(Y,b),Oo=t,v(),_(!0)}else if(n.parentNode===t){i=eo(n);var x=0,S,C=Y.parentNode!==t,w=!fs(Y.animated&&Y.toRect||r,n.animated&&n.toRect||i,f),T=f?`top`:`left`,E=to(n,`top`,`top`)||to(Y,`top`,`top`),D=E?E.scrollTop:void 0;Zo!==n&&(S=i[T],$o=!1,es=!w&&o.invertSwap||C),x=Es(e,n,i,f,w?1:o.swapThreshold,o.invertedSwapThreshold==null?o.swapThreshold:o.invertedSwapThreshold,es,Zo===n);var ee;if(x!==0){var O=io(Y);do O-=x,ee=Oo.children[O];while(ee&&(Xa(ee,`display`)===`none`||ee===ko))}if(x===0||ee===n)return _(!1);Zo=n,Qo=x;var k=n.nextElementSibling,A=!1;A=x===1;var j=xs(Ao,t,Y,r,n,i,e,A);if(j!==!1)return(j===1||j===-1)&&(A=j===1),is=!0,setTimeout(Cs,30),g(),A&&!k?t.appendChild(Y):n.parentNode.insertBefore(Y,A?k:n),E&&mo(E,0,D-E.scrollTop),Oo=Y.parentNode,S!==void 0&&!es&&(ts=Math.abs(S-eo(n)[T])),v(),_(!0)}if(t.contains(Y))return _(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){Wa(document,`mousemove`,this._onTouchMove),Wa(document,`touchmove`,this._onTouchMove),Wa(document,`pointermove`,this._onTouchMove),Wa(document,`dragover`,_s),Wa(document,`mousemove`,_s),Wa(document,`touchmove`,_s)},_offUpEvents:function(){var e=this.el.ownerDocument;Wa(e,`mouseup`,this._onDrop),Wa(e,`touchend`,this._onDrop),Wa(e,`pointerup`,this._onDrop),Wa(e,`touchcancel`,this._onDrop),Wa(document,`selectstart`,this)},_onDrop:function(e){var t=this.el,n=this.options;if(Io=io(Y),Ro=io(Y,n.draggable),Eo(`drop`,this,{evt:e}),Oo=Y&&Y.parentNode,Io=io(Y),Ro=io(Y,n.draggable),ys.eventCanceled){this._nulling();return}Vo=!1,es=!1,$o=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),js(this.cloneId),js(this._dragStartId),this.nativeDraggable&&(Wa(document,`drop`,this),Wa(t,`dragstart`,this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),za&&Xa(document.body,`user-select`,``),Xa(Y,`transform`,``),e&&(Xo&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),ko&&ko.parentNode&&ko.parentNode.removeChild(ko),(Ao===Oo||Bo&&Bo.lastPutMode!==`clone`)&&No&&No.parentNode&&No.parentNode.removeChild(No),Y&&(this.nativeDraggable&&Wa(Y,`dragend`,this),Ss(Y),Y.style[`will-change`]=``,Xo&&!Vo&&Ya(Y,Bo?Bo.options.ghostClass:this.options.ghostClass,!1),Ya(Y,this.options.chosenClass,!1),Do({sortable:this,name:`unchoose`,toEl:Oo,newIndex:null,newDraggableIndex:null,originalEvent:e}),Ao===Oo?Io!==Fo&&Io>=0&&(Do({sortable:this,name:`update`,toEl:Oo,originalEvent:e}),Do({sortable:this,name:`sort`,toEl:Oo,originalEvent:e})):(Io>=0&&(Do({rootEl:Oo,name:`add`,toEl:Oo,fromEl:Ao,originalEvent:e}),Do({sortable:this,name:`remove`,toEl:Oo,originalEvent:e}),Do({rootEl:Oo,name:`sort`,toEl:Oo,fromEl:Ao,originalEvent:e}),Do({sortable:this,name:`sort`,toEl:Oo,originalEvent:e})),Bo&&Bo.save()),ys.active&&((Io==null||Io===-1)&&(Io=Fo,Ro=Lo),Do({sortable:this,name:`end`,toEl:Oo,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){Eo(`nulling`,this),Ao=Y=Oo=ko=jo=No=Mo=Po=Wo=Go=Xo=Io=Ro=Fo=Lo=Zo=Qo=Bo=zo=ys.dragged=ys.ghost=ys.clone=ys.active=null,as.forEach(function(e){e.checked=!0}),as.length=Ko=qo=0},handleEvent:function(e){switch(e.type){case`drop`:case`dragend`:this._onDrop(e);break;case`dragenter`:case`dragover`:Y&&(this._onDragOver(e),bs(e));break;case`selectstart`:e.preventDefault()}},toArray:function(){for(var e=[],t,n=this.el.children,r=0,i=n.length,a=this.options;r<i;r++)t=n[r],qa(t,a.draggable,this.el,!1)&&e.push(t.getAttribute(a.dataIdAttr)||Os(t));return e},sort:function(e,t){var n={},r=this.el;this.toArray().forEach(function(e,t){var i=r.children[t];qa(i,this.options.draggable,r,!1)&&(n[e]=i)},this),t&&this.captureAnimationState(),e.forEach(function(e){n[e]&&(r.removeChild(n[e]),r.appendChild(n[e]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return qa(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(t===void 0)return n[e];var r=Co.modifyOption(this,e,t);n[e]=r===void 0?t:r,e===`group`&&ms(n)},destroy:function(){Eo(`destroy`,this);var e=this.el;e[_o]=null,Wa(e,`mousedown`,this._onTapStart),Wa(e,`touchstart`,this._onTapStart),Wa(e,`pointerdown`,this._onTapStart),this.nativeDraggable&&(Wa(e,`dragover`,this),Wa(e,`dragenter`,this)),Array.prototype.forEach.call(e.querySelectorAll(`[draggable]`),function(e){e.removeAttribute(`draggable`)}),this._onDrop(),this._disableDelayedDragEvents(),Uo.splice(Uo.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Po){if(Eo(`hideClone`,this),ys.eventCanceled)return;Xa(No,`display`,`none`),this.options.removeCloneOnHide&&No.parentNode&&No.parentNode.removeChild(No),Po=!0}},_showClone:function(e){if(e.lastPutMode!==`clone`){this._hideClone();return}if(Po){if(Eo(`showClone`,this),ys.eventCanceled)return;Y.parentNode==Ao&&!this.options.group.revertClone?Ao.insertBefore(No,Y):jo?Ao.insertBefore(No,jo):Ao.appendChild(No),this.options.group.revertClone&&this.animate(Y,No),Xa(No,`display`,``),Po=!1}}};function bs(e){e.dataTransfer&&(e.dataTransfer.dropEffect=`move`),e.cancelable&&e.preventDefault()}function xs(e,t,n,r,i,a,o,s){var c,l=e[_o],u=l.options.onMove,d;return window.CustomEvent&&!Ia&&!La?c=new CustomEvent(`move`,{bubbles:!0,cancelable:!0}):(c=document.createEvent(`Event`),c.initEvent(`move`,!0,!0)),c.to=t,c.from=e,c.dragged=n,c.draggedRect=r,c.related=i||t,c.relatedRect=a||eo(t),c.willInsertAfter=s,c.originalEvent=o,e.dispatchEvent(c),u&&(d=u.call(l,c,o)),d}function Ss(e){e.draggable=!1}function Cs(){is=!1}function ws(e,t,n){var r=eo(no(n.el,0,n.options,!0)),i=go(n.el,n.options,ko),a=10;return t?e.clientX<i.left-a||e.clientY<r.top&&e.clientX<r.right:e.clientY<i.top-a||e.clientY<r.bottom&&e.clientX<r.left}function Ts(e,t,n){var r=eo(ro(n.el,n.options.draggable)),i=go(n.el,n.options,ko),a=10;return t?e.clientX>i.right+a||e.clientY>r.bottom&&e.clientX>r.left:e.clientY>i.bottom+a||e.clientX>r.right&&e.clientY>r.top}function Es(e,t,n,r,i,a,o,s){var c=r?e.clientY:e.clientX,l=r?n.height:n.width,u=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!o){if(s&&ts<l*i){if(!$o&&(Qo===1?c>u+l*a/2:c<d-l*a/2)&&($o=!0),$o)f=!0;else if(Qo===1?c<u+ts:c>d-ts)return-Qo}else if(c>u+l*(1-i)/2&&c<d-l*(1-i)/2)return Ds(t)}return f||=o,f&&(c<u+l*a/2||c>d-l*a/2)?c>u+l/2?1:-1:0}function Ds(e){return io(Y)<io(e)?1:-1}function Os(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,r=0;n--;)r+=t.charCodeAt(n);return r.toString(36)}function ks(e){as.length=0;for(var t=e.getElementsByTagName(`input`),n=t.length;n--;){var r=t[n];r.checked&&as.push(r)}}function As(e){return setTimeout(e,0)}function js(e){return clearTimeout(e)}os&&Ua(document,`touchmove`,function(e){(ys.active||Vo)&&e.cancelable&&e.preventDefault()}),ys.utils={on:Ua,off:Wa,css:Xa,find:Qa,is:function(e,t){return!!qa(e,t,e,!1)},extend:co,throttle:fo,closest:qa,toggleClass:Ya,clone:ho,index:io,nextTick:As,cancelNextTick:js,detectDirection:ds,getChild:no},ys.get=function(e){return e[_o]},ys.mount=function(){var e=[...arguments];e[0].constructor===Array&&(e=e[0]),e.forEach(function(e){if(!e.prototype||!e.prototype.constructor)throw`Sortable: Mounted plugin must be a constructor function, not ${{}.toString.call(e)}`;e.utils&&(ys.utils=Oa(Oa({},ys.utils),e.utils)),Co.mount(e)})},ys.create=function(e,t){return new ys(e,t)},ys.version=Pa;var Ms=[],Ns,Ps,Fs=!1,Is,Ls,Rs,zs;function Bs(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)e.charAt(0)===`_`&&typeof this[e]==`function`&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?Ua(document,`dragover`,this._handleAutoScroll):this.options.supportPointer?Ua(document,`pointermove`,this._handleFallbackAutoScroll):t.touches?Ua(document,`touchmove`,this._handleFallbackAutoScroll):Ua(document,`mousemove`,this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;!this.options.dragOverBubble&&!t.rootEl&&this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?Wa(document,`dragover`,this._handleAutoScroll):(Wa(document,`pointermove`,this._handleFallbackAutoScroll),Wa(document,`touchmove`,this._handleFallbackAutoScroll),Wa(document,`mousemove`,this._handleFallbackAutoScroll)),Hs(),Vs(),po()},nulling:function(){Rs=Ps=Ns=Fs=zs=Is=Ls=null,Ms.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,r=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,a=document.elementFromPoint(r,i);if(Rs=e,t||this.options.forceAutoScrollFallback||La||Ia||za){Us(e,this.options,a,t);var o=so(a,!0);Fs&&(!zs||r!==Is||i!==Ls)&&(zs&&Hs(),zs=setInterval(function(){var a=so(document.elementFromPoint(r,i),!0);a!==o&&(o=a,Vs()),Us(e,n.options,a,t)},10),Is=r,Ls=i)}else{if(!this.options.bubbleScroll||so(a,!0)===$a()){Vs();return}Us(e,this.options,so(a,!1),!1)}}},ja(e,{pluginName:`scroll`,initializeByDefault:!0})}function Vs(){Ms.forEach(function(e){clearInterval(e.pid)}),Ms=[]}function Hs(){clearInterval(zs)}var Us=fo(function(e,t,n,r){if(t.scroll){var i=(e.touches?e.touches[0]:e).clientX,a=(e.touches?e.touches[0]:e).clientY,o=t.scrollSensitivity,s=t.scrollSpeed,c=$a(),l=!1,u;Ps!==n&&(Ps=n,Vs(),Ns=t.scroll,u=t.scrollFn,Ns===!0&&(Ns=so(n,!0)));var d=0,f=Ns;do{var p=f,m=eo(p),h=m.top,g=m.bottom,_=m.left,v=m.right,y=m.width,b=m.height,x=void 0,S=void 0,C=p.scrollWidth,w=p.scrollHeight,T=Xa(p),E=p.scrollLeft,D=p.scrollTop;p===c?(x=y<C&&(T.overflowX===`auto`||T.overflowX===`scroll`||T.overflowX===`visible`),S=b<w&&(T.overflowY===`auto`||T.overflowY===`scroll`||T.overflowY===`visible`)):(x=y<C&&(T.overflowX===`auto`||T.overflowX===`scroll`),S=b<w&&(T.overflowY===`auto`||T.overflowY===`scroll`));var ee=x&&(Math.abs(v-i)<=o&&E+y<C)-(Math.abs(_-i)<=o&&!!E),O=S&&(Math.abs(g-a)<=o&&D+b<w)-(Math.abs(h-a)<=o&&!!D);if(!Ms[d])for(var k=0;k<=d;k++)Ms[k]||(Ms[k]={});(Ms[d].vx!=ee||Ms[d].vy!=O||Ms[d].el!==p)&&(Ms[d].el=p,Ms[d].vx=ee,Ms[d].vy=O,clearInterval(Ms[d].pid),(ee!=0||O!=0)&&(l=!0,Ms[d].pid=setInterval(function(){r&&this.layer===0&&ys.active._onTouchMove(Rs);var t=Ms[this.layer].vy?Ms[this.layer].vy*s:0,n=Ms[this.layer].vx?Ms[this.layer].vx*s:0;typeof u==`function`&&u.call(ys.dragged.parentNode[_o],n,t,e,Rs,Ms[this.layer].el)!==`continue`||mo(Ms[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&f!==c&&(f=so(f,!1)));Fs=l}},30),Ws=function(e){var t=e.originalEvent,n=e.putSortable,r=e.dragEl,i=e.activeSortable,a=e.dispatchSortableEvent,o=e.hideGhostForTarget,s=e.unhideGhostForTarget;if(t){var c=n||i;o();var l=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,u=document.elementFromPoint(l.clientX,l.clientY);s(),c&&!c.el.contains(u)&&(a(`spill`),this.onSpill({dragEl:r,putSortable:n}))}};function Gs(){}Gs.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var r=no(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(t,r):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:Ws},ja(Gs,{pluginName:`revertOnSpill`});function Ks(){}Ks.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:Ws},ja(Ks,{pluginName:`removeOnSpill`}),ys.mount(new Bs),ys.mount(Ks,Gs);function qs(e){return e==null?e:JSON.parse(JSON.stringify(e))}function Js(e){w()&&I(e)}function Ys(e){w()?N(e):se(e)}var Xs=null,Zs=null;function Qs(e=null,t=null){Xs=e,Zs=t}function $s(){return{data:Xs,clonedData:Zs}}var ec=Symbol(`cloneElement`);function tc(...e){let t=w()?.proxy,r=null,i=e[0],[,a,o]=e;Array.isArray(n(a))||(o=a,a=null);let s=null,{immediate:c=!0,clone:l=qs,forceFallback:u,fallbackOnBody:d,customUpdate:f}=n(o)??{};function m(e){let{from:t,oldIndex:i,item:o}=e,s=Array.from(t.childNodes);r=u&&!d?s.slice(0,-1):s;let c=n(n(a)?.[i]),f=l(c);Qs(c,f),o[ec]=f}function h(e){let t=e.item[ec];if(!ga(t)){if(ya(e.item),p(a)){let r=[...n(a)];a.value=ha(r,e.newDraggableIndex,t);return}ha(n(a),e.newDraggableIndex,t)}}function g(e){let{from:t,item:r,oldIndex:i,oldDraggableIndex:o,pullMode:s,clone:c}=e;if(va(t,r,i),s===`clone`){ya(c);return}if(p(a)){let e=[...n(a)];a.value=ma(e,o);return}ma(n(a),o)}function _(e){if(f){f(e);return}let{from:t,item:r,oldIndex:i,oldDraggableIndex:o,newDraggableIndex:s}=e;if(ya(r),va(t,r,i),p(a)){let e=[...n(a)];a.value=da(e,o,s);return}da(n(a),o,s)}function v(e){let{newIndex:t,oldIndex:n,from:i,to:a}=e,o=null,s=t===n&&i===a;try{if(s){let e=null;r?.some((t,n)=>{if(e&&r?.length!==a.childNodes.length)return i.insertBefore(e,t.nextSibling),!0;let o=a.childNodes[n];e=a?.replaceChild(t,o)})}}catch(e){o=e}finally{r=null}se(()=>{if(Qs(),o)throw o})}let y={onUpdate:_,onStart:m,onAdd:h,onRemove:g,onEnd:v};function b(e){let r=n(i);return e||=_a(r)?ba(r,t?.$el):r,e&&!Ca(e)&&(e=e.$el),e||ua(`Root element not found`),e}function x(){let e=n(o)??{},{immediate:t,clone:r}=e,i=sa(e,[`immediate`,`clone`]);return wa(i,(e,t)=>{Ta(e)&&(i[e]=(e,...n)=>(Ea(e,$s()),t(e,...n)))}),Sa(a===null?{}:y,i)}let C=e=>{e=b(e),s&&T.destroy(),s=new ys(e,x())};S(()=>o,()=>{s&&wa(x(),(e,t)=>{s?.option(e,t)})},{deep:!0});let T={option:(e,t)=>s?.option(e,t),destroy:()=>{s?.destroy(),s=null},save:()=>s?.save(),toArray:()=>s?.toArray(),closest:(...e)=>s?.closest(...e)};return Ys(()=>{c&&C()}),Js(T.destroy),oa({start:C,pause:()=>T?.option(`disabled`,!0),resume:()=>T?.option(`disabled`,!1)},T)}var nc=[`update`,`start`,`add`,`remove`,`choose`,`unchoose`,`end`,`sort`,`filter`,`clone`,`move`,`change`],rc=[`clone`,`animation`,`ghostClass`,`group`,`sort`,`disabled`,`store`,`handle`,`draggable`,`swapThreshold`,`invertSwap`,`invertedSwapThreshold`,`removeCloneOnHide`,`direction`,`chosenClass`,`dragClass`,`ignore`,`filter`,`preventOnFilter`,`easing`,`setData`,`dropBubble`,`dragoverBubble`,`dataIdAttr`,`delay`,`delayOnTouchOnly`,`touchStartThreshold`,`forceFallback`,`fallbackClass`,`fallbackOnBody`,`fallbackTolerance`,`fallbackOffset`,`supportPointer`,`emptyInsertThreshold`,`scroll`,`forceAutoScrollFallback`,`scrollSensitivity`,`scrollSpeed`,`bubbleScroll`,`modelValue`,`tag`,`target`,`customUpdate`,...nc.map(e=>`on${e.replace(/^\S/,e=>e.toUpperCase())}`)],ic=R({name:`VueDraggable`,model:{prop:`modelValue`,event:`update:modelValue`},props:rc,emits:[`update:modelValue`,...nc],setup(e,{slots:t,emit:i,expose:a,attrs:o}){let c=nc.reduce((e,t)=>{let n=`on${t.replace(/^\S/,e=>e.toUpperCase())}`;return e[n]=(...e)=>i(t,...e),e},{}),l=L(()=>{let t=s(e),{modelValue:r}=t,i=sa(t,[`modelValue`]),a=Object.entries(i).reduce((e,[t,r])=>{let i=n(r);return i!==void 0&&(e[t]=i),e},{});return oa(oa({},c),pa(oa(oa({},o),a)))}),u=L({get:()=>e.modelValue,set:e=>i(`update:modelValue`,e)}),d=r(),f=h(tc(e.target||d,u,l));return a(f),()=>_(e.tag||`div`,{ref:d},(t?.default)?.call(t,f))}}),ac={mounted:`mounted`,unmounted:`unmounted`};ac.mounted,ac.unmounted;var oc=ve(`kanban-queue`,()=>{let e=ye();function t(){return{projectId:e.activeProjectId??void 0,orgId:e.activeOrgId}}let n=r({items:[],running:[],maxConcurrent:1}),i=null,a=0;async function o(){a+=1,!i&&(i=J.kanbanQueue.onChanged.subscribe(void 0,{onData(e){n.value=e}}))}function s(){a=Math.max(0,a-1),!(a>0)&&(i?.unsubscribe(),i=null)}function c(e,t){return n.value.items.some(n=>n.boardId===e&&n.cardId===t)||n.value.running.some(n=>n.boardId===e&&n.cardId===t)}function l(e,t){let r=n.value.items.find(n=>n.boardId===e&&n.cardId===t);return r?r.id:n.value.running.find(n=>n.boardId===e&&n.cardId===t)?.id??null}async function u(e){await J.kanbanQueue.add.mutate({...e,...t()})}async function d(e){await J.kanbanQueue.addColumn.mutate({...e,...t()})}async function f(e){await J.kanbanQueue.remove.mutate({itemId:e})}async function p(){await J.kanbanQueue.stopAll.mutate()}async function m(e){await J.kanbanQueue.setMaxConcurrent.mutate({max:e})}return{state:n,init:o,destroy:s,isCardInQueue:c,getCardQueueItemId:l,addCard:u,addColumn:d,removeItem:f,stopAll:p,setMaxConcurrent:m}});function sc(){let e=Ce(),t=Se(),{orgId:n,available:i,unavailability:a,cloudUser:o}=gn(),s=r(``),c=r(``),l=r([]);return S(n,e=>{s.value=e},{immediate:!0}),S(s,async n=>{if(t.replace({query:{...e.query,...n?{org:n}:{org:void 0}}}),l.value=[],c.value=``,!n)return;let r=await zt.organization.getFullOrganization({query:{organizationId:n}});if(r.error||!r.data)return;let i=r.data;c.value=i.slug??``,l.value=(i.members??[]).map(e=>({userId:e.userId,name:e.user?.name||e.user?.email||`?`,email:e.user?.email??``,role:e.role??``}))},{immediate:!0}),{orgId:s,orgSlug:c,members:l,available:i,unavailability:a,cloudUser:o}}var cc=[`conversation`];function lc(){return navigator.locks??null}function uc(){return typeof BroadcastChannel<`u`&&lc()!==null}function dc(e){try{let t=new URL(e,location.origin);return`runeya:sse:${t.pathname}:${t.searchParams.get(`organizationId`)??``}`}catch{return`runeya:sse:${e}`}}function fc(e,t){if(!uc())return new EventSource(e,t);let n=dc(e),r=new BroadcastChannel(n),i={onopen:null,onmessage:null,onerror:null,onnamed:null,close:c},a=null,o=!1,s=null;r.onmessage=e=>{let t=e.data;t.kind===`message`?i.onmessage?.({data:t.data}):t.kind===`named`?i.onnamed?.(t.name,{data:t.data}):t.kind===`open`?i.onopen?.(null):i.onerror?.(null)},lc().request(n,{mode:`exclusive`},()=>new Promise(n=>{if(o){n();return}s=n,a=new EventSource(e,t),a.onopen=()=>{i.onopen?.(null),r.postMessage({kind:`open`})},a.onmessage=e=>{i.onmessage?.({data:e.data}),r.postMessage({kind:`message`,data:e.data})};for(let e of cc)a.addEventListener(e,t=>{i.onnamed?.(e,{data:t.data}),r.postMessage({kind:`named`,name:e,data:t.data})});a.onerror=()=>{i.onerror?.(null),r.postMessage({kind:`error`})}}));function c(){o=!0,a?.close(),a=null,r.close(),s?.(),s=null}return i}var pc={class:`kb-boardmenu`},mc={class:`upgrade-banner__cta`},hc=[`onClick`],gc={key:0,class:`kb-card__ai-badge kb-card__ai-badge--companion`},_c={key:1,class:`kb-card__ai-badge kb-card__ai-badge--streaming`},vc={key:2,class:`kb-card__ai-badge kb-card__ai-badge--unread`},yc={class:`kb-boardform`},bc={class:`kb-boardform__field`},xc={for:`kb-board-name`},Sc={class:`kb-boardform__field`},Cc={for:`kb-board-desc`},wc={class:`kb-boardform__field`},Tc={for:`kb-board-instructions`},Ec={class:`kb-boardform__hint`},Dc={class:`kb-dialog__footer`},Oc={class:`kb-populate`},kc={class:`kb-populate__hint`},Ac={class:`kb-dialog__footer`},jc={class:`kb-populate`},Mc={class:`kb-populate__hint`},Nc={class:`kb-dialog__footer`},Pc={key:0,class:`kb-queue-panel`},Fc={class:`kb-queue-panel__header`},Ic={class:`kb-queue-panel__title`},Lc={class:`kb-queue-panel__concurrency`},Rc={class:`kb-queue-panel__concurrency-label`},zc={class:`kb-queue-panel__concurrency-ctrl`},Bc={key:0,class:`kb-queue-panel__section`},Vc={class:`kb-queue-panel__section-title`},Hc={class:`kb-queue-item__title`},Uc={key:1,class:`kb-queue-panel__section`},Wc={class:`kb-queue-panel__section-title`},Gc={class:`kb-queue-item__title`},Kc={key:2,class:`kb-queue-panel__empty`},qc={class:`kb-queue-panel__footer`},Jc={class:`kb-queue-col-dialog`},Yc={class:`kb-queue-col-dialog__field`},Xc={for:`kanban-queue-runner`},Zc={class:`kb-queue-col-dialog__field`},Qc={for:`kanban-queue-scenario`},$c={class:`kb-dialog__footer`},el={key:1,class:`kanban-board-loading`},tl=R({__name:`KanbanBoardPage`,props:{id:{},cardId:{}},emits:[`close`,`open-card`],setup(e,{emit:t}){let i=e,a=t,o=L(()=>!!i.cardId),{t:s}=ge(),c=Se(),l=Ce(),{orgId:u,orgSlug:d,cloudUser:f,members:p,available:m}=sc(),h=Je();function g(e,t){return u.value?Rt(u.value,e,t):Promise.resolve(null)}function _(e){return Bt(e.id,u.value??``)}function b(e){return Ht(e.id,e.contentType,u.value??``)}function x(e){return jt(e,{orgId:u.value})}let C=L(()=>p.value.map(e=>({userId:e.userId,name:e.name})));function w(e,t){return t?s(`kanban.board.${e}`,t):s(`kanban.board.${e}`)}let T=Yt(zt,u,{streamUrl:Vt,streamFactory:fc,onConversationChanged:D}),E=Wt(zt,u);function D(e){for(let t of e.cardIds)E.byCard.value[t]&&E.load(e.boardId,t)}function ee(e){let t=T.activeBoard.value?.id;return t?E.load(t,e):Promise.resolve([])}function O(e,t,n){let r=T.activeBoard.value?.id;return r?E.link(r,e,t,n):Promise.resolve(!1)}function F(e,t){let n=T.activeBoard.value?.id;return n?E.resync(n,e,t):Promise.resolve(!1)}function te(e,t){let n=T.activeBoard.value?.id;return n?E.unlink(n,e,t):Promise.resolve(!1)}let ne=Gt(zt,u),{teams:R,myTeamIds:B,refresh:re,refreshMine:ie}=$t(zt);S(u,e=>{e&&(re(e),ie(e))},{immediate:!0});let ae=L(()=>{let e=p.value.find(e=>e.userId===f.value?.id)?.role;return Ut(e)?R.value.map(e=>e.id):B.value}),oe=L(()=>ne.templates.value.map(e=>({id:e.id,name:e.name,content:e.content}))),ce=r(null),G=L(()=>T.activeBoard.value),le=L(()=>o.value?G.value?.defaultView===`list`?`issues`:`kanban`:l.path.startsWith(`/issues/`)?`issues`:`kanban`),ue=L(()=>`/${le.value}`),fe=L(()=>`${le.value}-board`),pe=L(()=>`${le.value}-card`),me=L(()=>G.value?.columns??[]),ve=L(()=>!T.canWrite.value||!!G.value?.archived);S(m,e=>{e||(o.value?a(`close`):c.push(ue.value))},{immediate:!0}),S([u,()=>i.id],async([e,t])=>{if(!e||!t)return;if(await T.openBoard(t),o.value){if(!T.activeBoard.value){a(`close`);return}await se(),Ee();return}if(!T.activeBoard.value){c.push(ue.value);return}let n=T.activeBoard.value.defaultView===`list`?`issues`:`kanban`;if(n!==le.value){let e=typeof l.params.cardId==`string`?l.params.cardId:``;c.replace({name:e?`${n}-card`:`${n}-board`,params:e?{id:t,cardId:e}:{id:t},query:l.query});return}await se(),Ee()},{immediate:!0});let ye=L(()=>i.cardId?i.cardId:typeof l.params.cardId==`string`?l.params.cardId:``),be=!1,xe=!1;function we(e){for(let t of me.value){let n=t.cards.find(t=>t.id===e);if(n)return{colId:t.id,card:n}}return null}async function Te(e){let t=await T.loadCard(e);if(!t&&o.value&&ye.value===e){a(`close`);return}if(t&&ye.value===e){be=!0;try{let e=t.card.archivedAt?t.card.archivedFrom?.columnId??``:t.columnId;ce.value?.openCardEditor(e,t.card)}finally{be=!1}}}function Ee(){let e=!o.value&&typeof l.query.card==`string`?l.query.card:``;if(e){c.replace({name:pe.value,params:{id:i.id,cardId:e},query:{...l.query,card:void 0}});return}let t=ye.value;if(t!==(ce.value?.editingCard?.card.id??``)){be=!0;try{if(!t){ce.value?.closeCardEditor();return}let e=we(t);if(e){ce.value?.openCardEditor(e.colId,e.card);return}Te(t)}finally{be=!1}}}function De(e){if(be)return;let t=e?.card.id??``;if(t!==ye.value){if(o.value){t?a(`open-card`,{boardId:i.id,cardId:t}):a(`close`);return}if(t){xe=!0,c.push({name:pe.value,params:{id:i.id,cardId:t}});return}if(xe){xe=!1,c.back();return}c.replace({name:fe.value,params:{id:i.id}})}}S(ye,()=>Ee());function Oe(e,t,n){return T.addComment(e,t,n)}async function Ae(e){T.markDirty(),await Me(e)||await T.discardLocalEdits()}async function Me(e){switch(e.kind){case`column-add`:return T.addColumn(e.title);case`column-rename`:return T.renameColumn(e.columnId,e.title);case`column-set-done`:return T.setColumnDone(e.columnId,e.done);case`column-delete`:return T.deleteColumn(e.columnId);case`columns-reorder`:return T.reorderColumns(e.columnIds);case`column-move`:return T.assignToColumnGroup({kind:`column`,id:e.columnId},e.groupId,e.columnIds);case`group-add`:return!!await T.addColumnGroup(e.title,{...e.color?{color:e.color}:{},...e.parentId?{parentId:e.parentId}:{}});case`group-update`:return T.updateColumnGroup(e.groupId,e.patch);case`card-group-color`:return T.setCardGroupColor(e.group,e.color);case`group-delete`:return T.deleteColumnGroup(e.groupId);case`group-assign`:return T.assignToColumnGroup(e.member,e.groupId);case`card-add`:return!!await T.addCard(e.columnId,{id:e.card.id,title:e.card.title,markdown:e.card.markdown,...e.card.priority===void 0?{}:{priority:e.card.priority},...e.card.groups?.length?{groups:e.card.groups}:{},...e.card.color?{color:e.card.color}:{},...e.card.deadline?{deadline:e.card.deadline}:{},...e.card.attachments?.length?{attachments:e.card.attachments}:{},...e.card.assignees?.length?{assignees:e.card.assignees.map(e=>e.id)}:{},placement:e.placement});case`card-update`:return T.updateCard(e.cardId,e.patch);case`card-delete`:return T.deleteCard(e.cardId);case`card-archive`:return T.archiveCard(e.cardId);case`card-unarchive`:return T.unarchiveCard(e.cardId,e.toColumnId);case`card-move`:return T.moveCard(e.cardId,e.toColumnId,e.toIndex);case`card-history`:return!0}}async function Ne(e){G.value&&await T.setColumnSubscription(G.value.id,e.columnId,e.subscription,e.teamId)}function Pe(){d.value&&window.open(`${At()}/app/${d.value}/settings/org/billing`,`_blank`,`noopener`)}let Fe=ut(),{claudeCodeAvailable:Ie,codexAvailable:Re}=_e(Fe),ze=sn(),Be=r(!1),He=r(null),Ue=r(null),We=``,Ge=null;N(()=>{Fe.init()});function Ke(e){return(e.conversationEvents??e.history??[]).filter(e=>e.type===`conversation_started`||e.type===`scenario_started`).map(e=>{let t=e.detail??``;return t.includes(` — `)?t.split(` — `).pop():t}).filter(Boolean)}function qe(e){return e&&Fe.conversations.some(t=>t.id===e)?e:null}function Ye(e){return e.type===`comment`?qe(e.conversationId):e.type!==`conversation_started`&&e.type!==`scenario_started`||!e.detail?null:qe(e.detail.includes(` — `)?e.detail.split(` — `).pop():e.detail)}function Xe(e){if(!G.value)return null;let t=Ke(e),n=st.state.running.filter(t=>t.cardId===e.id);return[...t,...n.map(e=>e.conversationId)].some(e=>Fe.isCompanionThinkingFor(e))?`companion`:n.length>0?`streaming`:st.state.items.some(t=>t.cardId===e.id)?`unread`:t.some(e=>Fe.streamingConvIds.has(e))?`streaming`:t.some(e=>Fe.unreadConvIds.has(e))?`unread`:null}function Ze(e){Fe.selectConversation(e),ce.value?.closeCardEditor(),ze.open()}async function Qe(e,t,n){Ge&&await T.addCardEvent(Ge.card.id,t,n??e)}function et(e){Ge={colId:e.colId,card:e.card};let t=e.draft.title||e.card.title||``,n=e.draft.markdown||e.card.markdown||``;We=n?`${t}\n\n${n}`:t,ce.value?.saveCard(),Be.value=!0}function tt(e){if(!G.value)return;let t=e.draft.title||e.card.title||s(`kanban.board.card.untitled`),n=me.value.find(t=>t.id===e.colId)?.title??``,r=(e.draft.markdown??``).trim(),i=d.value?`${At()}/app/${d.value}/${le.value}/${G.value.id}/card/${e.card.id}`:`${window.location.origin}/${le.value}/${G.value.id}/card/${e.card.id}`,a=[`📋 ${t}`];n&&a.push(`📍 ${s(`kanban.board.editor.columnLabel`,{column:n})}`),r&&a.push(r),a.push(`🔗 [${s(`kanban.board.editor.openCardLink`)}](${i})`),Ue.value?.open(a.join(`
3
+
4
+ `))}function nt(){return{kanbanBoardId:G.value?.id,kanbanCardId:Ge?.card.id}}async function rt(e,t){let n=We,r=await Fe.createConversation({title:`Kanban: ${Ge?.card.title||`Card`}`,runner:e,providerId:t,...nt()}),i=r?Qe(r.id,`conversation_started`):null;ce.value?.closeCardEditor(),n?ze.openWithKanbanContext(n):ze.open(),await i}function it(e,t,n){Be.value=!1,He.value?.showScenarioDialog(e,We,t,n??void 0)}async function at(e,t){Be.value=!1,await rt(e===`keep`?void 0:e,t??void 0)}async function ot(e,t,n,r){let i=t||We,a=await an(Fe,e,i,n,r,{title:`Kanban: ${Ge?.card.title||`Card`}`,...nt()}),o=i&&a?Qe(a.id,`scenario_started`,`Scenario run — ${a.id}`):null;ce.value?.closeCardEditor(),ze.open(),await o}let st=oc(),ct=r(!1),lt=r(!1),dt=r(``),ft=r([]),pt=r(``),mt=r(``),ht=r([]),gt=L(()=>st.state.items.length+st.state.running.length);N(async()=>{st.init();try{let{trpc:e}=await bt(async()=>{let{trpc:e}=await import(`./trpc-hVn9TTl9.js`).then(e=>e.i);return{trpc:e}},__vite__mapDeps([0,1,2,3,4,5])),{settingsScope:t}=await bt(async()=>{let{settingsScope:e}=await import(`./settings-scope-CI0lqhdd.js`).then(e=>e.n);return{settingsScope:e}},__vite__mapDeps([6,1,3,2,7,8,0,4,5,9])),n=await e.scenario.list.query(t());ht.value=n.map(e=>({id:e.id,name:e.name}))}catch{}}),I(()=>st.destroy());function _t(e){dt.value=e.id,ft.value=e.cards.map(e=>e.id),pt.value=``,mt.value=``,lt.value=!0}async function vt(){G.value&&(await st.addColumn({boardId:G.value.id,columnId:dt.value,cardIds:ft.value,runner:pt.value||void 0,scenarioId:mt.value||void 0}),lt.value=!1)}async function J(e){if(!G.value)return;let t=st.getCardQueueItemId(G.value.id,e.id);t?await st.removeItem(t):await st.addCard({boardId:G.value.id,cardId:e.id})}function yt(e){return me.value.flatMap(e=>e.cards).find(t=>t.id===e)?.title??e}let xt=r(!1),St=r(!1),Ct=r(``);async function wt(e,t){if(!G.value||!Ct.value.trim())return;let n=Ct.value.trim(),r=await Fe.createConversation({title:`Kanban populate: ${G.value.name.slice(0,30)}`,runner:e,providerId:t,kanbanBoardId:G.value.id});if(St.value=!1,Ct.value=``,r){if(e===`claude-code`||e===`codex`){ze.openWithPopulateContext(n);return}ze.openPopulate(),await se(),Fe.send(n,()=>{})}}async function Tt(e,t,n){if(!G.value||!Ct.value.trim())return;let r=Ct.value.trim(),i=await Fe.createConversation({title:`Kanban populate: ${G.value.name.slice(0,30)}`,scenarioId:e,scenarioInput:r,...t===`keep`?{}:{runner:t},...n?{providerId:n}:{},kanbanBoardId:G.value.id});St.value=!1,Ct.value=``,i&&(Fe.startScenarioRun(i.id,e,r,void 0,t===`keep`?void 0:{runnerOverride:t}),ze.open())}let Et=r([]);async function Dt(){let e=await T.loadBoardColumns();Et.value=e.filter(e=>e.id!==G.value?.id)}S(()=>[u.value,G.value?.id].join(`:`),()=>{Dt()},{immediate:!0});async function Ot(e,t,n){let r=await T.moveCardToBoard(e,t,n);return r&&Dt(),r}function kt(e){if(o.value){a(`open-card`,e);return}c.push({name:`kanban-card`,params:{id:e.boardId,cardId:e.cardId}})}async function Mt(e,t){return T.setCardParent(e,t?{boardId:i.id,cardId:t}:null)}let Nt=r(!1),Pt=r({name:``,description:``,instructions:``});function Ft(){let e=G.value;e&&(Pt.value={name:e.name,description:e.description??``,instructions:e.instructions??``},Nt.value=!0)}async function It(){let e=G.value;e&&Pt.value.name.trim()&&await T.updateBoardById(e.id,{name:Pt.value.name.trim(),description:Pt.value.description.trim(),instructions:Pt.value.instructions.trim()})&&(Nt.value=!1)}function Lt(){let e=G.value;if(!e)return;let t=!e.archived;h.require({message:s(t?`kanban.board.archiveBoard.confirm`:`kanban.board.archiveBoard.restoreConfirm`,{name:e.name}),header:s(t?`kanban.board.archiveBoard.header`:`kanban.board.archiveBoard.restoreHeader`),icon:`ti ti-inbox`,accept:async()=>{await T.updateBoardById(e.id,{archived:t})&&t&&await c.push(ue.value)}})}function Jt(){let e=G.value;if(!e)return;let t=ue.value;h.require({message:s(`kanban.list.dialogs.confirmDeleteMessage`,{name:e.name}),header:s(`kanban.list.dialogs.confirmDeleteHeader`),icon:`ti ti-trash`,acceptProps:{severity:`danger`},accept:async()=>{await T.deleteBoard(e.id)&&await c.push(t)}})}let Qt=Kt(zt,u),en=r(!1),tn=r(``),nn=r(!1);function cn(){tn.value=G.value?.name??``,nn.value=!1,en.value=!0}async function ln(){let e=G.value;e&&tn.value.trim()&&await Qt.createTemplate(tn.value.trim(),e.instructions??``,[...e.columns].sort((e,t)=>e.order-t.order).map(e=>({title:e.title,...e.groupId?{groupId:e.groupId}:{}})),(e.columnGroups??[]).map(e=>({id:e.id,title:e.title,...e.color?{color:e.color}:{},...e.parentId?{parentId:e.parentId}:{}})))&&(nn.value=!0,en.value=!1)}let un=r(null),dn=r(null),fn=(e,t)=>t?s(`kanban.list.${e}`,t):s(`kanban.list.${e}`),pn=r(null),mn=(e,t)=>t?s(`kanban.${e}`,t):s(`kanban.${e}`);function hn(e){c.push({name:pe.value,params:{id:i.id,cardId:e}})}function gn(e){pn.value=null,hn(e)}function vn(e){un.value?.hide(),e()}function yn(){Ct.value=``,xt.value=!0}function bn(){Ct.value.trim()&&(xt.value=!1,Fe.fetchProviders(),Fe.checkCliAvailability(),St.value=!0)}async function xn(e,t){await wt(e===`keep`?void 0:e,t??void 0)}async function Sn(e,t,n){await Tt(e,t,n)}return S(()=>Fe.streamingConvIds.size,()=>{T.refreshActiveBoard()}),(e,t)=>{let r=v(`tooltip`);return G.value?(z(),j(`div`,{key:0,class:P([`kanban-board-host`,{"kanban-board-host--card-only":o.value}])},[y(n(qt),{ref_key:`boardRef`,ref:ce,"card-only":o.value,columns:me.value,"column-groups":G.value.columnGroups??[],"card-group-colors":G.value.cardGroupColors??[],name:G.value.name,"board-id":G.value.id,view:G.value.defaultView,"read-only":ve.value,templates:oe.value,t:w,"resolve-conversation-id":Ye,"current-user-id":n(f)?.id,members:C.value,"column-subscriptions":G.value.columnSubscriptions??{},teams:n(R),"manageable-team-ids":ae.value,"column-team-subscriptions":G.value.columnTeamSubscriptions??{},"avatar-url":x,"upload-image":g,"fetch-attachment":b,"delete-attachment":_,"load-history":n(T).loadCardHistory,histories:n(T).cardHistories.value,"add-comment":Oe,"edit-comment":n(T).updateComment,"remove-comment":n(T).deleteComment,"move-card":n(T).moveCard,"move-cards":n(T).moveCards,"other-boards":Et.value,"move-card-to-board":Ot,"card-links":n(T).cardLinks.value,"linked-cards":n(T).linkedCards.value,"set-card-parent":Mt,"load-placements":n(T).loadCardPlacements,"place-card":n(T).addCardPlacement,"unplace-card":n(T).removeCardPlacement,"search-org-cards":n(T).searchOrgCards,"can-place":n(T).canWrite.value,"conversation-integrations":n(E).integrations.value,"card-conversations":n(E).byCard.value,"load-conversations":ee,"search-conversations":n(E).search,"link-conversation":O,"unlink-conversation":te,"resync-conversation":F,"archived-cards":n(T).archivedCards.value,"loading-archive":n(T).loadingArchive.value,"archive-truncated":n(T).archiveTruncated.value,"search-matches":n(T).searchMatches.value,"search-truncated":n(T).searchTruncated.value,onIntent:Ae,onLoadArchive:n(T).loadArchivedCards,onSearchCards:n(T).searchCards,onBack:t[11]||=e=>n(c).push(ue.value),onOpenConversation:Ze,onCardOpen:De,onUpdateColumnSubscription:Ne,onOpenLinkedCard:kt},{"header-actions":H(()=>[gt.value>0?(z(),W(n(q),{key:0,label:n(s)(`kanban.board.queue.panelHeader`),icon:`ti ti-list`,severity:`secondary`,variant:`outlined`,size:`small`,badge:String(gt.value),"badge-severity":`warn`,onClick:t[0]||=e=>ct.value=!ct.value},null,8,[`label`,`badge`])):K(``,!0),G.value?k((z(),W(n(q),{key:1,icon:`ti ti-chart-line`,variant:`text`,rounded:``,size:`small`,"aria-label":n(s)(`kanban.list.flow.open`),onClick:t[1]||=e=>dn.value=G.value},null,8,[`aria-label`])),[[r,n(s)(`kanban.list.flow.open`),void 0,{bottom:!0}]]):K(``,!0),G.value?k((z(),W(n(q),{key:2,icon:`ti ti-history`,variant:`text`,rounded:``,size:`small`,"aria-label":n(s)(`kanban.list.history.open`),onClick:t[2]||=e=>pn.value=G.value},null,8,[`aria-label`])),[[r,n(s)(`kanban.list.history.open`),void 0,{bottom:!0}]]):K(``,!0),n(T).canWrite.value?(z(),W(n(q),{key:3,icon:`ti ti-dots-vertical`,severity:`secondary`,variant:`outlined`,size:`small`,title:n(s)(`kanban.board.actions.menu`),"aria-label":n(s)(`kanban.board.actions.menu`),onClick:t[3]||=e=>un.value?.toggle(e)},null,8,[`title`,`aria-label`])):K(``,!0),y(n(ke),{ref_key:`boardMenu`,ref:un},{default:H(()=>[A(`div`,pc,[ve.value?K(``,!0):(z(),j(`button`,{key:0,class:`kb-boardmenu__item`,onClick:t[4]||=e=>vn(Ft)},[t[33]||=A(`i`,{class:`ti ti-pencil`},null,-1),A(`span`,null,U(n(s)(`kanban.board.editBoard.action`)),1)])),ve.value?K(``,!0):(z(),j(`button`,{key:1,class:`kb-boardmenu__item`,onClick:t[5]||=e=>vn(yn)},[t[34]||=A(`i`,{class:`ti ti-sparkles`},null,-1),A(`span`,null,U(n(s)(`kanban.board.aiPopulate`)),1)])),!ve.value&&G.value?.defaultView!==`list`?(z(),j(`button`,{key:2,class:`kb-boardmenu__item`,onClick:t[6]||=e=>vn(cn)},[t[35]||=A(`i`,{class:`ti ti-bookmark`},null,-1),A(`span`,null,U(n(s)(`kanban.board.saveTemplate.action`)),1)])):K(``,!0),A(`button`,{class:`kb-boardmenu__item`,onClick:t[7]||=e=>vn(Lt)},[t[36]||=A(`i`,{class:`ti ti-inbox`},null,-1),A(`span`,null,U(G.value?.archived?n(s)(`kanban.list.restore`):n(s)(`kanban.list.archive`)),1)]),A(`button`,{class:`kb-boardmenu__item kb-boardmenu__item--danger`,onClick:t[8]||=e=>vn(Jt)},[t[37]||=A(`i`,{class:`ti ti-trash`},null,-1),A(`span`,null,U(n(s)(`kanban.board.deleteBoard.action`)),1)])])]),_:1},512),y(n(Xt),{board:dn.value,load:n(T).boardFlow,t:fn,"avatar-url":x,"cards-openable":``,onClose:t[9]||=e=>dn.value=null,onOpenCard:hn},null,8,[`board`,`load`]),y(n(Zt),{board:pn.value,load:n(T).boardHistory,t:mn,onClose:t[10]||=e=>pn.value=null,onOpenCard:gn},null,8,[`board`,`load`])]),banner:H(()=>[n(T).planLocked.value?(z(),j(`a`,{key:0,class:`upgrade-banner`,href:`#`,onClick:he(Pe,[`prevent`])},[A(`span`,null,U(n(s)(`kanban.cloud.readOnlyNotice`)),1),A(`span`,mc,U(n(s)(`kanban.cloud.upgradeCta`)),1)])):K(``,!0)]),"column-actions":H(({column:e})=>[ve.value?K(``,!0):k((z(),W(n(q),{key:0,icon:`ti ti-list`,variant:`text`,rounded:``,size:`small`,onClick:he(t=>_t(e),[`stop`])},null,8,[`onClick`])),[[r,n(s)(`kanban.board.queue.addColumnTooltip`),void 0,{bottom:!0}]])]),"card-actions":H(({card:e})=>[ve.value?K(``,!0):k((z(),j(`button`,{key:0,class:P([`kb-card__queue-btn`,{"kb-card__queue-btn--active":G.value&&n(st).isCardInQueue(G.value.id,e.id)}]),onClick:he(t=>J(e),[`stop`])},[...t[38]||=[A(`i`,{class:`ti ti-list`},null,-1)]],10,hc)),[[r,G.value&&n(st).isCardInQueue(G.value.id,e.id)?n(s)(`kanban.board.queue.tooltipInQueue`):n(s)(`kanban.board.queue.tooltip`),void 0,{bottom:!0}]])]),"card-badges":H(({card:e})=>[Xe(e)===`companion`?k((z(),j(`span`,gc,null,512)),[[r,n(s)(`kanban.board.aiStatus.companion`),void 0,{bottom:!0}]]):Xe(e)===`streaming`?k((z(),j(`span`,_c,null,512)),[[r,n(s)(`kanban.board.aiStatus.streaming`),void 0,{bottom:!0}]]):Xe(e)===`unread`?k((z(),j(`span`,vc,null,512)),[[r,n(s)(`kanban.board.aiStatus.unread`),void 0,{bottom:!0}]]):K(``,!0)]),"card-editor-actions":H(({card:e,colId:t,draft:r})=>[y(n(q),{label:n(s)(`kanban.board.editor.launchAi`),icon:`ti ti-sparkles`,severity:`secondary`,variant:`outlined`,size:`small`,disabled:ve.value,onClick:n=>et({card:e,colId:t,draft:r})},null,8,[`label`,`disabled`,`onClick`]),y(n(q),{label:n(s)(`kanban.board.editor.sendToChat`),icon:`ti ti-messages`,severity:`secondary`,variant:`outlined`,size:`small`,onClick:n=>tt({card:e,colId:t,draft:r})},null,8,[`label`,`onClick`])]),_:1},8,`card-only.columns.column-groups.card-group-colors.name.board-id.view.read-only.templates.current-user-id.members.column-subscriptions.teams.manageable-team-ids.column-team-subscriptions.load-history.histories.edit-comment.remove-comment.move-card.move-cards.other-boards.card-links.linked-cards.load-placements.place-card.unplace-card.search-org-cards.can-place.conversation-integrations.card-conversations.search-conversations.archived-cards.loading-archive.archive-truncated.search-matches.search-truncated.onLoadArchive.onSearchCards`.split(`.`)),y(n(Ve),{visible:Be.value,header:n(s)(`kanban.board.launchAiDialog.header`),modal:!0,style:{width:`700px`,maxHeight:`80vh`},"onUpdate:visible":t[12]||=e=>{e||(Be.value=!1)}},{default:H(()=>[y(rn,{compact:``,onSelectScenario:it,onSkip:at})]),_:1},8,[`visible`,`header`]),y(on,{ref_key:`launchModalsRef`,ref:He,onConfirmScenarioStart:ot},null,512),y(_n,{ref_key:`sendToChatRef`,ref:Ue},null,512),y(n(Ve),{visible:Nt.value,header:n(s)(`kanban.board.editBoard.header`),modal:!0,style:{width:`550px`},"onUpdate:visible":t[17]||=e=>{e||(Nt.value=!1)}},{footer:H(()=>[A(`div`,Dc,[y(n(q),{label:n(s)(`actions.cancel`),variant:`text`,onClick:t[16]||=e=>Nt.value=!1},null,8,[`label`]),y(n(q),{label:n(s)(`kanban.board.editBoard.save`),icon:`ti ti-check`,disabled:!Pt.value.name.trim(),onClick:It},null,8,[`label`,`disabled`])])]),default:H(()=>[A(`div`,yc,[A(`div`,bc,[A(`label`,xc,U(n(s)(`kanban.list.nameLabel`)),1),y(n(je),{id:`kb-board-name`,modelValue:Pt.value.name,"onUpdate:modelValue":t[13]||=e=>Pt.value.name=e,autofocus:``,class:`w-full`},null,8,[`modelValue`])]),A(`div`,Sc,[A(`label`,Cc,U(n(s)(`kanban.list.descriptionLabel`)),1),y(n($e),{id:`kb-board-desc`,modelValue:Pt.value.description,"onUpdate:modelValue":t[14]||=e=>Pt.value.description=e,rows:`3`,class:`w-full`},null,8,[`modelValue`])]),A(`div`,wc,[A(`label`,Tc,U(n(s)(`kanban.list.instructionsLabel`)),1),y(n($e),{id:`kb-board-instructions`,modelValue:Pt.value.instructions,"onUpdate:modelValue":t[15]||=e=>Pt.value.instructions=e,rows:`6`,class:`w-full`,placeholder:n(s)(`kanban.list.instructionsPlaceholder`)},null,8,[`modelValue`,`placeholder`]),A(`small`,Ec,U(n(s)(`kanban.list.instructionsHint`)),1)])])]),_:1},8,[`visible`,`header`]),y(n(Ve),{visible:en.value,header:n(s)(`kanban.board.saveTemplate.header`),modal:!0,style:{width:`450px`},"onUpdate:visible":t[20]||=e=>{e||(en.value=!1)}},{footer:H(()=>[A(`div`,Ac,[y(n(q),{label:n(s)(`actions.cancel`),variant:`text`,onClick:t[19]||=e=>en.value=!1},null,8,[`label`]),y(n(q),{label:n(s)(`kanban.board.saveTemplate.save`),icon:`ti ti-bookmark`,disabled:!tn.value.trim(),onClick:ln},null,8,[`label`,`disabled`])])]),default:H(()=>[A(`div`,Oc,[A(`p`,kc,U(n(s)(`kanban.board.saveTemplate.hint`,{count:G.value?.columns.length??0})),1),y(n(je),{modelValue:tn.value,"onUpdate:modelValue":t[18]||=e=>tn.value=e,class:`w-full`,autofocus:``,placeholder:n(s)(`kanban.board.saveTemplate.namePlaceholder`),onKeyup:de(ln,[`enter`])},null,8,[`modelValue`,`placeholder`])])]),_:1},8,[`visible`,`header`]),y(n(Ve),{visible:xt.value,header:n(s)(`kanban.board.populateDialog.header`),modal:!0,style:{width:`550px`},"onUpdate:visible":t[23]||=e=>{e||(xt.value=!1)}},{footer:H(()=>[A(`div`,Nc,[y(n(q),{label:n(s)(`actions.cancel`),variant:`text`,onClick:t[22]||=e=>xt.value=!1},null,8,[`label`]),y(n(q),{label:n(s)(`kanban.board.populateDialog.generate`),icon:`ti ti-sparkles`,disabled:!Ct.value.trim(),onClick:bn},null,8,[`label`,`disabled`])])]),default:H(()=>[A(`div`,jc,[A(`p`,Mc,U(n(s)(`kanban.board.populateDialog.hint`)),1),y(n($e),{modelValue:Ct.value,"onUpdate:modelValue":t[21]||=e=>Ct.value=e,placeholder:n(s)(`kanban.board.populateDialog.placeholder`),autoResize:!0,rows:`4`,class:`w-full`,onKeydown:[de(he(bn,[`ctrl`]),[`enter`]),de(he(bn,[`meta`]),[`enter`])]},null,8,[`modelValue`,`placeholder`,`onKeydown`])])]),_:1},8,[`visible`,`header`]),y(n(Ve),{visible:St.value,header:n(s)(`kanban.board.populateDialog.header`),modal:!0,style:{width:`700px`,maxHeight:`80vh`},"onUpdate:visible":t[24]||=e=>{e||(St.value=!1)}},{default:H(()=>[y(rn,{compact:``,onSelectScenario:Sn,onSkip:xn})]),_:1},8,[`visible`,`header`]),ct.value?(z(),j(`div`,Pc,[A(`div`,Fc,[A(`span`,Ic,U(n(s)(`kanban.board.queue.panelHeader`)),1),y(n(q),{icon:`ti ti-x`,variant:`text`,rounded:``,size:`small`,onClick:t[25]||=e=>ct.value=!1})]),A(`div`,Lc,[A(`span`,Rc,U(n(s)(`kanban.board.queue.concurrency`)),1),A(`div`,zc,[y(n(q),{icon:`ti ti-minus`,variant:`text`,rounded:``,size:`small`,disabled:n(st).state.maxConcurrent<=1,onClick:t[26]||=e=>n(st).setMaxConcurrent(n(st).state.maxConcurrent-1)},null,8,[`disabled`]),A(`span`,null,U(n(st).state.maxConcurrent),1),y(n(q),{icon:`ti ti-plus`,variant:`text`,rounded:``,size:`small`,onClick:t[27]||=e=>n(st).setMaxConcurrent(n(st).state.maxConcurrent+1)})])]),n(st).state.running.length>0?(z(),j(`div`,Bc,[A(`div`,Vc,U(n(s)(`kanban.board.queue.runningSection`,{count:n(st).state.running.length})),1),(z(!0),j(V,null,M(n(st).state.running.filter(e=>e.boardId===G.value?.id),e=>(z(),j(`div`,{key:e.id,class:`kb-queue-item kb-queue-item--running`},[t[39]||=A(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),A(`span`,Hc,U(yt(e.cardId)),1),y(n(q),{icon:`ti ti-player-stop`,variant:`text`,rounded:``,size:`small`,severity:`danger`,onClick:t=>n(st).removeItem(e.id)},null,8,[`onClick`])]))),128))])):K(``,!0),n(st).state.items.length>0?(z(),j(`div`,Uc,[A(`div`,Wc,U(n(s)(`kanban.board.queue.waitingSection`,{count:n(st).state.items.length})),1),(z(!0),j(V,null,M(n(st).state.items.filter(e=>e.boardId===G.value?.id),e=>(z(),j(`div`,{key:e.id,class:`kb-queue-item`},[t[40]||=A(`i`,{class:`ti ti-clock`},null,-1),A(`span`,Gc,U(yt(e.cardId)),1),y(n(q),{icon:`ti ti-x`,variant:`text`,rounded:``,size:`small`,onClick:t=>n(st).removeItem(e.id)},null,8,[`onClick`])]))),128))])):K(``,!0),gt.value===0?(z(),j(`div`,Kc,U(n(s)(`kanban.board.queue.empty`)),1)):K(``,!0),A(`div`,qc,[y(n(q),{label:n(s)(`kanban.board.queue.stopAll`),icon:`ti ti-player-stop`,severity:`danger`,variant:`text`,size:`small`,disabled:gt.value===0,onClick:t[28]||=e=>n(st).stopAll()},null,8,[`label`,`disabled`])])])):K(``,!0),y(n(Ve),{visible:lt.value,header:n(s)(`kanban.board.queue.addColumnDialog.header`),modal:!0,style:{width:`420px`},"onUpdate:visible":t[32]||=e=>{e||(lt.value=!1)}},{footer:H(()=>[A(`div`,$c,[y(n(q),{label:n(s)(`actions.cancel`),variant:`text`,onClick:t[31]||=e=>lt.value=!1},null,8,[`label`]),y(n(q),{label:n(s)(`kanban.board.queue.addColumnDialog.confirm`),icon:`ti ti-list`,onClick:vt},null,8,[`label`])])]),default:H(()=>[A(`div`,Jc,[A(`div`,Yc,[A(`label`,Xc,U(n(s)(`kanban.board.queue.addColumnDialog.runner`)),1),y(n(Le),{modelValue:pt.value,"onUpdate:modelValue":t[29]||=e=>pt.value=e,"input-id":`kanban-queue-runner`,options:[{value:``,label:`Auto`},{value:`claude-code`,label:`Claude Code${n(Ie)?``:` (non installé)`}`,disabled:!n(Ie)},{value:`codex`,label:`Codex${n(Re)?``:` (non installé)`}`,disabled:!n(Re)}],"option-label":`label`,"option-value":`value`,"option-disabled":`disabled`,fluid:``},null,8,[`modelValue`,`options`])]),A(`div`,Zc,[A(`label`,Qc,U(n(s)(`kanban.board.queue.addColumnDialog.scenario`)),1),y(n(Le),{modelValue:mt.value,"onUpdate:modelValue":t[30]||=e=>mt.value=e,"input-id":`kanban-queue-scenario`,options:[{id:``,name:n(s)(`kanban.board.queue.addColumnDialog.noScenario`)},...ht.value],"option-label":`name`,"option-value":`id`,fluid:``},null,8,[`modelValue`,`options`])])])]),_:1},8,[`visible`,`header`])],2)):n(T).loading.value&&!o.value?(z(),j(`div`,el,[...t[41]||=[A(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]])):K(``,!0)}}}),nl=e({default:()=>rl}),rl=Ke(tl,[[`__scopeId`,`data-v-631a707b`]]);function il(){let e=Se(),t=r(null);function n(n,r){if(r){t.value={boardId:n,cardId:r};return}e.push({name:`kanban-board`,params:{id:n}})}return{openedCard:t,openKanban:n}}var al=[`title`],ol=[`title`],sl=[`title`],cl=[`title`],ll=[`title`],ul=[`title`],dl={key:0,class:`ti ti-sitemap`,style:{"font-size":`0.7rem`,opacity:`0.6`,"margin-right":`4px`}},fl={key:1,class:`ti ti-table`,style:{"font-size":`0.7rem`,opacity:`0.6`,"margin-right":`4px`}},pl={class:`ai-chat-conv-item__actions`},ml=[`title`,`aria-label`],hl=[`title`],gl=[`title`],_l=Ke(R({__name:`AiChatConvItem`,props:{conv:{},active:{type:Boolean},archived:{type:Boolean},streaming:{type:Boolean},unread:{type:Boolean},companionThinking:{type:Boolean}},emits:[`select`,`rename`,`set-archived`,`delete`],setup(e,{emit:t}){let{t:i}=ge(),a=e,{openedCard:o,openKanban:s}=il(),c=t,l=r(!1),u=r(``),d=r(null);function f(){u.value=a.conv.title,l.value=!0,se(()=>d.value?.$el?.select())}function p(){if(!l.value)return;l.value=!1;let e=u.value.trim();e&&e!==a.conv.title&&c(`rename`,a.conv.id,e)}return(t,r)=>(z(),j(`div`,{class:P([`ai-chat-conv-item`,{"ai-chat-conv-item--active":e.active}]),onClick:r[8]||=t=>c(`select`,e.conv.id)},[l.value?(z(),W(n(je),{key:0,ref_key:`inputEl`,ref:d,modelValue:u.value,"onUpdate:modelValue":r[0]||=e=>u.value=e,size:`small`,class:`ai-chat-conv-item__rename-input`,autofocus:``,onBlur:p,onKeydown:[de(he(p,[`prevent`]),[`enter`]),r[1]||=de(e=>l.value=!1,[`esc`])],onClick:r[2]||=he(()=>{},[`stop`])},null,8,[`modelValue`,`onKeydown`])):(z(),j(V,{key:1},[e.archived?K(``,!0):(z(),j(V,{key:0},[e.companionThinking?(z(),j(`span`,{key:0,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--companion`,title:n(i)(`aiChat.companionReadingNow`)},null,8,al)):e.streaming?(z(),j(`span`,{key:1,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--streaming`,title:n(i)(`aiChatPage.generating`)},null,8,ol)):e.conv.workflowType===`scenario`&&e.conv.scenarioWaitingInputs&&Object.keys(e.conv.scenarioWaitingInputs).length>0?(z(),j(`span`,{key:2,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--scenario-waiting`,title:n(i)(`aiChatPage.waitingForResponse`)},null,8,sl)):e.conv.workflowType===`scenario`&&e.conv.scenarioRunning?(z(),j(`span`,{key:3,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--scenario-running`,title:n(i)(`aiChatPage.scenarioRunning`)},null,8,cl)):e.unread?(z(),j(`span`,{key:4,class:`ai-chat-conv-item__badge ai-chat-conv-item__badge--unread`,title:n(i)(`aiChatPage.unreadMessages`)},null,8,ll)):K(``,!0)],64)),A(`span`,{class:`ai-chat-conv-item__title`,title:n(i)(`aiChat.rename`),onDblclick:he(f,[`stop`])},[e.conv.workflowType===`scenario`?(z(),j(`i`,dl)):!e.archived&&e.conv.kanbanBoardId?(z(),j(`i`,fl)):K(``,!0),b(` `+U(e.conv.title),1)],40,ul),A(`div`,pl,[!e.archived&&e.conv.kanbanBoardId?(z(),j(`button`,{key:0,class:`ai-chat-conv-item__icon-btn`,title:e.conv.kanbanCardId?n(i)(`aiChat.openKanbanCard`):n(i)(`aiChat.openKanbanBoard`),"aria-label":e.conv.kanbanCardId?n(i)(`aiChat.openKanbanCard`):n(i)(`aiChat.openKanbanBoard`),onClick:r[3]||=he(t=>n(s)(e.conv.kanbanBoardId,e.conv.kanbanCardId),[`stop`])},[...r[9]||=[A(`i`,{class:`ti ti-arrow-up-right`},null,-1)]],8,ml)):K(``,!0),A(`button`,{class:`ai-chat-conv-item__icon-btn`,title:e.archived?n(i)(`aiChatPage.unarchive`):n(i)(`aiChatPage.archive`),onClick:r[4]||=he(t=>c(`set-archived`,e.conv.id,!e.archived),[`stop`])},[A(`i`,{class:`ti ti-inbox`,style:B(e.archived?`opacity:0.5`:void 0)},null,4)],8,hl),A(`button`,{class:`ai-chat-conv-item__icon-btn ai-chat-conv-item__icon-btn--danger`,title:n(i)(`actions.delete`),onClick:r[5]||=he(t=>c(`delete`,e.conv.id),[`stop`])},[...r[10]||=[A(`i`,{class:`ti ti-trash`},null,-1)]],8,gl)])],64)),n(o)?(z(),W(rl,{key:n(o).boardId,id:n(o).boardId,"card-id":n(o).cardId,onClose:r[6]||=e=>o.value=null,onOpenCard:r[7]||=e=>o.value=e},null,8,[`id`,`card-id`])):K(``,!0)],2))}}),[[`__scopeId`,`data-v-13d598a8`]]),vl=`ti ti-sparkles`,yl=`ti ti-messages`,bl={class:`ai-chat-sidebar`},xl={class:`ai-chat-sidebar__header`},Sl={class:`ai-chat-sidebar__title`},Cl={class:`ai-chat-sidebar__search`},wl={class:`ai-chat-sidebar__api-key-wrap`},Tl={key:0,class:`ai-chat-sidebar__no-provider`},El={class:`ai-chat-sidebar__conv-list`},Dl={class:`ai-chat-sidebar__pinned-card-title`},Ol={class:`ai-chat-sidebar__drop-wrap`},kl={key:0,class:`ai-chat-sidebar__pinned-hint`},Al=[`data-testid`],jl={class:`ai-chat-sidebar__section-header`},Ml=[`title`],Nl=[`onDblclick`],Pl=[`title`,`aria-label`,`onClick`],Fl={class:`ai-chat-sidebar__drop-wrap`},Il={key:0,class:`ai-chat-sidebar__pinned-hint`},Ll={key:0,class:`ai-chat-sidebar__menu`},Rl={class:`ai-chat-sidebar__drop-wrap ai-chat-sidebar__unpin-zone`},zl={class:`ai-chat-sidebar__pinned-hint`},Bl={key:1,class:`ai-chat-sidebar__group-title`},Vl={key:2,class:`ai-chat-sidebar__group-title`},Hl={key:3,class:`ai-chat-sidebar__empty-list`},Ul={key:0,class:`ai-chat-sidebar__archive-section`},Wl={key:0,class:`ai-chat-sidebar__archive-matches`},Gl={key:0,class:`ai-chat-sidebar__archive-body`},Kl={class:`ai-chat-sidebar__conv-list ai-chat-sidebar__conv-list--archive`},ql={key:0,class:`ai-chat-sidebar__empty-list`},Jl=Ke(R({__name:`AiChatSidebar`,emits:[`start-new`,`select-conversation`,`delete-conversation`],setup(e,{emit:t}){let{t:i}=ge(),a=ut(),{activeId:o,filteredConversations:s,pinnedConversations:c,sections:l,sectionConversations:u,archivedConversations:d,streamingConvIds:f,unreadConvIds:p,claudeCodeAvailable:m,codexAvailable:h,providers:g}=_e(a),_=r(``),v=L(()=>_.value.trim().length>0),x=r(!1),C=0,w=()=>new Date().toISOString();function T(e){let t=_.value.trim().toLowerCase();return!t||e.title.toLowerCase().includes(t)}let E=L(()=>d.value.filter(T));function D(e,t){a.renameConversation(e,t)}let O=L(()=>s.value.filter(T)),te=L(()=>O.value.filter(ct)),ne=L(()=>O.value.filter(e=>!ct(e))),R={animation:150,delay:300,delayOnTouchOnly:!0},B=r([]),ie=r([]),ae=r([]),oe=r([]),ce=L(()=>c.value.filter(T));S(ce,e=>{B.value=[...e]},{immediate:!0}),S(te,e=>{ie.value=[...e]},{immediate:!0}),S(ne,e=>{ae.value=[...e]},{immediate:!0});let G=r([]),le=r({});S(l,e=>{G.value=[...e]},{immediate:!0});let ue=L(()=>{let e={};for(let[t,n]of Object.entries(u.value))e[t]=n.filter(T);return e});S(ue,e=>{le.value={...e}},{immediate:!0});let pe=r(!1),me=L(()=>pe.value&&te.value.length===0&&ne.value.length===0);function ve(){if(pe.value=!1,oe.value=[],v.value)return;let e={};for(let[t,n]of Object.entries(le.value))e[t]=n.map(e=>e.id);a.applyLayout({pinned:B.value.map(e=>e.id),sections:e})}function ye(){v.value||a.reorderSections(G.value.map(e=>e.id))}let be=r(null),xe=r(``);function Se(e){be.value=e.id,xe.value=e.name,se(()=>{let t=document.querySelector(`[data-section-input="${e.id}"]`);t?.focus(),t?.select()})}function Ce(){let e=be.value;if(!e)return;be.value=null;let t=xe.value.trim(),n=l.value.find(t=>t.id===e);t&&n&&t!==n.name&&a.renameSection(e,t)}function we(){be.value=null}async function Te(){let e=await a.createSection(i(`aiChat.newSectionName`));e&&Se(e)}let Ee=r(null),De=r(null);function Oe(e,t){De.value=e,Ee.value?.toggle(t)}function Ae(e){let t=De.value;Ee.value?.hide(),t&&e(t)}let Me=r(!1);S([v,E],([e,t])=>{x.value=e?Me.value||t.length>0:Me.value});function Ne(){Me.value=!x.value,x.value=!x.value}let Pe=t;function Fe(){Pe(`start-new`)}function Ie(e){Pe(`select-conversation`,e)}function Le(e){Pe(`delete-conversation`,e)}return N(()=>{lt()&&console.log(`[ai-chat][sidebar]`,w(),`mounted`,{activeId:o.value,visible:s.value.length,archived:d.value.length,unread:p.value.size,streaming:f.value.size,visibleOrder:s.value.map(e=>e.id.slice(0,8))})}),re(()=>{C+=1,lt()&&console.log(`[ai-chat][sidebar]`,w(),`updated`,{count:C,activeId:o.value,visible:s.value.length,archived:d.value.length,unread:p.value.size,streaming:f.value.size})}),I(()=>{lt()&&console.log(`[ai-chat][sidebar]`,w(),`unmounted`,{updates:C})}),(e,t)=>{let r=ee(`router-link`);return z(),j(`aside`,bl,[A(`div`,xl,[A(`span`,Sl,[A(`i`,{class:P(n(vl))},null,2),b(` `+U(n(i)(`aiChat.title`)),1)]),y(n(q),{icon:`ti ti-plus`,variant:`text`,rounded:``,size:`small`,title:n(i)(`aiChat.newConversation`),onClick:Fe},null,8,[`title`])]),A(`div`,Cl,[t[20]||=A(`i`,{class:`ti ti-search ai-chat-sidebar__search-icon`},null,-1),y(n(je),{modelValue:_.value,"onUpdate:modelValue":t[0]||=e=>_.value=e,type:`search`,placeholder:n(i)(`aiChat.searchPlaceholder`),class:`ai-chat-sidebar__search-input`,"data-testid":`ai-chat-search`},null,8,[`modelValue`,`placeholder`])]),A(`div`,wl,[!n(m)&&!n(h)&&n(g).length===0?(z(),j(`div`,Tl,[t[21]||=A(`i`,{class:`ti ti-alert-triangle`},null,-1),A(`span`,null,[b(U(n(i)(`aiChatPage.configureProviderPrefix`))+` `,1),y(r,{to:{name:`settings`,query:{section:`ai`}}},{default:H(()=>[b(U(n(i)(`settings.title`)),1)]),_:1})])])):K(``,!0)]),A(`div`,El,[A(`section`,{class:P([`ai-chat-sidebar__pinned-card`,{"ai-chat-sidebar__pinned-card--awaiting":B.value.length===0}])},[A(`div`,Dl,[t[22]||=A(`i`,{class:`ti ti-pin`},null,-1),b(` `+U(n(i)(`aiChat.pinnedGroup`)),1)]),A(`div`,Ol,[y(n(ic),F({modelValue:B.value,"onUpdate:modelValue":t[2]||=e=>B.value=e,group:{name:`ai-chat-conversations`},disabled:v.value},R,{class:`ai-chat-sidebar__pinned-drop`,onStart:t[3]||=e=>pe.value=!0,onEnd:ve,onAdd:ve}),{default:H(()=>[(z(!0),j(V,null,M(B.value,e=>(z(),W(_l,{key:e.id,conv:e,active:e.id===n(o),streaming:n(f).has(e.id),unread:n(p).has(e.id),"companion-thinking":n(a).isCompanionThinkingFor(e.id),onSelect:Ie,onRename:D,onSetArchived:t[1]||=(e,t)=>n(a).archiveConversation(e,t),onDelete:Le},null,8,[`conv`,`active`,`streaming`,`unread`,`companion-thinking`]))),128))]),_:1},16,[`modelValue`,`disabled`]),B.value.length===0?(z(),j(`div`,kl,U(n(i)(`aiChat.pinnedDropHint`)),1)):K(``,!0)])],2),y(n(ic),F({modelValue:G.value,"onUpdate:modelValue":t[7]||=e=>G.value=e,disabled:v.value},R,{handle:`.ai-chat-sidebar__section-handle`,class:`ai-chat-sidebar__sections`,onEnd:ye}),{default:H(()=>[(z(!0),j(V,null,M(G.value,e=>(z(),j(`section`,{key:e.id,class:`ai-chat-sidebar__section-card`,"data-testid":`ai-chat-section-${e.id}`},[A(`div`,jl,[A(`i`,{class:`ti ti-menu-2 ai-chat-sidebar__section-handle`,title:n(i)(`aiChat.sectionMove`)},null,8,Ml),be.value===e.id?(z(),W(n(je),{key:0,modelValue:xe.value,"onUpdate:modelValue":t[4]||=e=>xe.value=e,"data-section-input":e.id,maxlength:`80`,class:`ai-chat-sidebar__section-input`,onKeydown:[de(he(Ce,[`prevent`]),[`enter`]),de(he(we,[`prevent`]),[`esc`])],onBlur:Ce},null,8,[`modelValue`,`data-section-input`,`onKeydown`])):(z(),j(`span`,{key:1,class:`ai-chat-sidebar__section-name`,onDblclick:t=>Se(e)},U(e.name),41,Nl)),A(`button`,{class:`ai-chat-sidebar__section-menu`,title:n(i)(`aiChat.sectionMenu`),"aria-label":n(i)(`aiChat.sectionMenu`),onClick:t=>Oe(e,t)},[...t[23]||=[A(`i`,{class:`ti ti-dots-vertical`},null,-1)]],8,Pl)]),A(`div`,Fl,[y(n(ic),F({modelValue:le.value[e.id],"onUpdate:modelValue":t=>le.value[e.id]=t,group:{name:`ai-chat-conversations`},disabled:v.value},{ref_for:!0},R,{class:`ai-chat-sidebar__pinned-drop`,onStart:t[6]||=e=>pe.value=!0,onEnd:ve,onAdd:ve}),{default:H(()=>[(z(!0),j(V,null,M(le.value[e.id]??[],e=>(z(),W(_l,{key:e.id,conv:e,active:e.id===n(o),streaming:n(f).has(e.id),unread:n(p).has(e.id),"companion-thinking":n(a).isCompanionThinkingFor(e.id),onSelect:Ie,onRename:D,onSetArchived:t[5]||=(e,t)=>n(a).archiveConversation(e,t),onDelete:Le},null,8,[`conv`,`active`,`streaming`,`unread`,`companion-thinking`]))),128))]),_:2},1040,[`modelValue`,`onUpdate:modelValue`,`disabled`]),(le.value[e.id]??[]).length===0?(z(),j(`div`,Il,U(n(i)(`aiChat.sectionDropHint`)),1)):K(``,!0)])],8,Al))),128))]),_:1},16,[`modelValue`,`disabled`]),v.value?K(``,!0):(z(),j(`button`,{key:0,class:`ai-chat-sidebar__new-section`,"data-testid":`ai-chat-new-section`,onClick:Te},[t[24]||=A(`i`,{class:`ti ti-plus`},null,-1),b(` `+U(n(i)(`aiChat.newSection`)),1)])),y(n(ke),{ref_key:`sectionMenu`,ref:Ee},{default:H(()=>[De.value?(z(),j(`div`,Ll,[A(`button`,{class:`ai-chat-sidebar__menu-item`,onClick:t[8]||=e=>Ae(Se)},[t[25]||=A(`i`,{class:`ti ti-pencil`},null,-1),A(`span`,null,U(n(i)(`aiChat.sectionRename`)),1)]),A(`button`,{class:`ai-chat-sidebar__menu-item ai-chat-sidebar__menu-item--danger`,onClick:t[9]||=e=>Ae(e=>n(a).deleteSection(e.id))},[t[26]||=A(`i`,{class:`ti ti-trash`},null,-1),A(`span`,null,U(n(i)(`aiChat.sectionDelete`)),1)])])):K(``,!0)]),_:1},512),k(A(`div`,Rl,[y(n(ic),F({modelValue:oe.value,"onUpdate:modelValue":t[10]||=e=>oe.value=e,group:{name:`ai-chat-conversations`},disabled:v.value,sort:!1},R,{class:`ai-chat-sidebar__unpinned-drop ai-chat-sidebar__unpin-drop`,onAdd:ve}),null,16,[`modelValue`,`disabled`]),A(`div`,zl,U(n(i)(`aiChat.unpinDropHint`)),1)],512),[[fe,me.value]]),te.value.length>0&&ne.value.length>0?(z(),j(`div`,Bl,[t[27]||=A(`i`,{class:`ti ti-device-desktop`},null,-1),b(` `+U(n(i)(`scenarioSelector.cliGroup`)),1)])):K(``,!0),k(y(n(ic),F({modelValue:ie.value,"onUpdate:modelValue":t[12]||=e=>ie.value=e,group:{name:`ai-chat-conversations`},disabled:v.value,sort:!1},R,{class:`ai-chat-sidebar__unpinned-drop`,onStart:t[13]||=e=>pe.value=!0,onEnd:t[14]||=e=>pe.value=!1,onAdd:ve}),{default:H(()=>[(z(!0),j(V,null,M(ie.value,e=>(z(),W(_l,{key:e.id,conv:e,active:e.id===n(o),streaming:n(f).has(e.id),unread:n(p).has(e.id),"companion-thinking":n(a).isCompanionThinkingFor(e.id),onSelect:Ie,onRename:D,onSetArchived:t[11]||=(e,t)=>n(a).archiveConversation(e,t),onDelete:Le},null,8,[`conv`,`active`,`streaming`,`unread`,`companion-thinking`]))),128))]),_:1},16,[`modelValue`,`disabled`]),[[fe,te.value.length>0]]),ne.value.length>0&&te.value.length>0?(z(),j(`div`,Vl,[t[28]||=A(`i`,{class:`ti ti-cloud`},null,-1),b(` `+U(n(i)(`scenarioSelector.apiGroup`)),1)])):K(``,!0),k(y(n(ic),F({modelValue:ae.value,"onUpdate:modelValue":t[16]||=e=>ae.value=e,group:{name:`ai-chat-conversations`},disabled:v.value,sort:!1},R,{class:`ai-chat-sidebar__unpinned-drop`,onStart:t[17]||=e=>pe.value=!0,onEnd:t[18]||=e=>pe.value=!1,onAdd:ve}),{default:H(()=>[(z(!0),j(V,null,M(ae.value,e=>(z(),W(_l,{key:e.id,conv:e,active:e.id===n(o),streaming:n(f).has(e.id),unread:n(p).has(e.id),"companion-thinking":n(a).isCompanionThinkingFor(e.id),onSelect:Ie,onRename:D,onSetArchived:t[15]||=(e,t)=>n(a).archiveConversation(e,t),onDelete:Le},null,8,[`conv`,`active`,`streaming`,`unread`,`companion-thinking`]))),128))]),_:1},16,[`modelValue`,`disabled`]),[[fe,ne.value.length>0]]),O.value.length===0&&B.value.length===0?(z(),j(`div`,Hl,U(v.value?n(i)(`aiChat.searchNoMatch`):n(i)(`aiChat.noConversations`)),1)):K(``,!0)]),n(d).length>0?(z(),j(`div`,Ul,[A(`button`,{class:`ai-chat-sidebar__archive-toggle`,onClick:Ne},[t[29]||=A(`i`,{class:`ti ti-inbox`},null,-1),A(`span`,null,U(n(i)(`aiChatPage.archives`,{count:n(d).length})),1),v.value?(z(),j(`span`,Wl,U(n(i)(`aiChat.searchArchivedCount`,{count:E.value.length})),1)):K(``,!0),A(`i`,{class:P([x.value?`ti ti-chevron-up`:`ti ti-chevron-down`,`ai-chat-sidebar__archive-chevron`])},null,2)]),x.value?(z(),j(`div`,Gl,[A(`div`,Kl,[(z(!0),j(V,null,M(E.value,e=>(z(),W(_l,{key:e.id,conv:e,archived:``,active:e.id===n(o),onSelect:Ie,onRename:D,onSetArchived:t[19]||=(e,t)=>n(a).archiveConversation(e,t),onDelete:Le},null,8,[`conv`,`active`]))),128)),E.value.length===0?(z(),j(`div`,ql,U(v.value?n(i)(`aiChat.searchNoMatch`):n(i)(`aiChat.noConversations`)),1)):K(``,!0)])])):K(``,!0)])):K(``,!0)])}}}),[[`__scopeId`,`data-v-e60b3dad`]]),Yl={class:`kanban-preview-dialog`},Xl={class:`kanban-preview-header`},Zl={class:`kanban-preview-body`},Ql={class:`ai-chat-message-list__msg-role`},$l={key:0,class:`ai-chat-message-list__context-note`},eu=[`onClick`],tu=[`innerHTML`],nu={key:0,class:`ai-chat-message-list__thinking-block`},ru=[`onClick`],iu={key:0,class:`ai-chat-message-list__thinking-content`},au=[`onClick`],ou={class:`ai-chat-message-list__tool-event-name`},su={key:0,class:`ai-chat-message-list__tool-event-args ai-chat-message-list__tool-event-args--streaming`},cu={key:1,class:`ai-chat-message-list__tool-event-args`},lu={class:`ai-chat-message-list__tool-param-key`},uu={class:`ai-chat-message-list__tool-param-value`},du=[`onClick`],fu={key:0,class:`ai-chat-message-list__tool-diff-path`},pu={class:`ai-chat-message-list__tool-diff-body`},mu={class:`ai-chat-message-list__tool-diff-sign`},hu=[`onClick`],gu={key:2,class:`ai-chat-message-list__user-text`},_u=[`innerHTML`],vu={key:4,class:`ai-chat-message-list__image-part`},yu=[`src`,`alt`,`onClick`],bu=[`aria-label`],xu={key:0,class:`ai-chat-message-list__status`},Su={key:1,class:`ai-chat-message-list__cursor`},Cu={key:0,class:`ai-chat-message-list__status`},wu=[`innerHTML`],Tu={key:2,class:`ai-chat-message-list__user-text`},Eu={key:3,class:`ai-chat-message-list__cursor`},Du={key:0,class:`ai-chat-message-list__empty-chat`},Ou=524288,ku=Ke(R({__name:`AiChatMessageList`,props:{messages:{},isStreaming:{type:Boolean}},emits:[`open-image-preview`],setup(e,{expose:t,emit:i}){let a=e,o=i,{t:s}=ge(),c=r(null);t({messagesEl:c});let l=new Map;function u(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`"`,`&quot;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}function d(e){return e.replace(/<pass\s+branch="(\d+)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--pass">PASS ${t}</span>`).replace(/<pass\s*\/>/g,`<span class="scenario-flag scenario-flag--pass">PASS</span>`).replace(/<error>([\s\S]*?)<\/error>/g,(e,t)=>`<span class="scenario-flag scenario-flag--error">ERROR: ${t.trim()}</span>`).replace(/<ask_user>([\s\S]*?)<\/ask_user>/g,(e,t)=>`<span class="scenario-flag scenario-flag--ask">${t.trim()}</span>`).replace(/<kanban_move\s+column="([^"]*?)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--kanban">📋 Move → ${t}</span>`).replace(/<kanban_comment>([\s\S]*?)<\/kanban_comment>/g,(e,t)=>`<span class="scenario-flag scenario-flag--kanban-comment">💬 ${t.trim()}</span>`).replace(/<kanban_add_card\s+column="([^"]*?)"\s+title="([^"]*?)">([\s\S]*?)<\/kanban_add_card>/g,(e,t,n,r)=>`<span class="scenario-flag scenario-flag--kanban" data-kanban-content="${u(r.trim())}" style="cursor:pointer" title="Cliquer pour voir le contenu">➕ Card "${n}" → ${t}</span>`).replace(/<next_person\s+name="([^"]*?)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--delegate">🔀 ${t}</span>`).replace(/<next_person\s+name="([^"]*?)">([\s\S]*?)<\/next_person>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--delegate">🔀 <strong>${t}</strong> — ${n.trim()}</span>`).replace(/<hire_person\s+label="([^"]*?)"\s+role="([^"]*?)">([\s\S]*?)<\/hire_person>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--hire">🧑‍💼 Hire ${t} (${n})</span>`)}function f(e){let t=l.get(e);return t===void 0&&(t=Jt.sanitize(Qt.parse(d(e),{async:!1}),{ALLOW_DATA_ATTR:!0}),l.set(e,t)),t}let p=r(null);function m(e){let t=e.target.closest(`[data-kanban-content]`);t&&(p.value=t.dataset.kanbanContent??``)}let h=r(new Set),g=r(new Set),_=r(new Set);S(()=>a.messages,e=>{if(e.length===0)return;let t=e[e.length-1];for(let e of t.parts??[])e.type===`tool`&&!e.pending&&ee(e)&&(h.value=new Set([...h.value,e.id]))});function v(e){let t=new Set(_.value);t.has(e)?t.delete(e):t.add(e),_.value=t}function y(e){let t=new Set(g.value);t.has(e)?t.delete(e):t.add(e),g.value=t}function x(e){let t=new Set(h.value);t.has(e)?t.delete(e):t.add(e),h.value=t}function C(e,t){let n;if(typeof e==`string`)n=e;else try{n=JSON.stringify(e,null,2)}catch{n=`[unserializable result]`}return n.length>Ou&&(n=n.slice(-524288)),n.split(`
5
+ `).slice(-t).join(`
6
+ `)}function w(e){let t=e.target;t.style.display=`none`;let n=t.nextElementSibling;n&&(n.style.display=`flex`)}function T(e,t){let n=e.split(`
7
+ `),r=t.split(`
8
+ `),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array.from({length:a+1},()=>0));for(let e=i-1;e>=0;e--)for(let t=a-1;t>=0;t--)o[e][t]=n[e]===r[t]?o[e+1][t+1]+1:Math.max(o[e+1][t],o[e][t+1]);let s=[],c=0,l=0;for(;c<i||l<a;)c<i&&l<a&&n[c]===r[l]?(s.push({type:`context`,text:n[c]}),c++,l++):l<a&&(c>=i||o[c][l+1]>=o[c+1][l])?(s.push({type:`add`,text:r[l]}),l++):(s.push({type:`remove`,text:n[c]}),c++);return s}function E(e){return[`Edit`,`str_replace_based_edit_tool`,`str_replace_editor`,`Write`,`create_file`].includes(e)}function D(e){return e.name===`command_execution`&&typeof e.input?.command==`string`}function ee(e){return E(e.name)||D(e)}function O(e){return D(e)?`shell`:e.name}function k(e){return!e.input||Object.keys(e.input).length===0?``:D(e)?String(e.input.command??``):Object.entries(e.input).map(([e,t])=>`${e}=${t}`).join(`, `)}function N(e){if(!E(e.name)||!e.input)return null;let t=e.input.old_string??``,n=e.input.new_string??e.input.content??``;return n?T(t,n):null}return(t,r)=>(z(),j(V,null,[(z(),W(ce,{to:`body`},[p.value===null?K(``,!0):(z(),j(`div`,{key:0,class:`kanban-preview-overlay`,onClick:r[1]||=he(e=>p.value=null,[`self`])},[A(`div`,Yl,[A(`div`,Xl,[r[3]||=A(`span`,null,`Contenu de la carte`,-1),A(`button`,{class:`kanban-preview-close`,onClick:r[0]||=e=>p.value=null},`✕`)]),A(`pre`,Zl,U(p.value||`(vide)`),1)])]))])),A(`div`,{ref_key:`messagesEl`,ref:c,class:`ai-chat-message-list`,onClick:m},[(z(!0),j(V,null,M(e.messages,(t,i)=>(z(),j(`div`,{key:i,class:P([`ai-chat-message-list__msg`,`is-${t.role}`])},[A(`div`,Ql,U(t.role===`user`?n(s)(`aiChatPage.you`):n(s)(`aiChatPage.assistant`)),1),t.contextNote?(z(),j(`div`,$l,[A(`div`,{class:`ai-chat-message-list__context-note-header`,onClick:e=>v(i)},[r[4]||=A(`i`,{class:`ti ti-paperclip`},null,-1),A(`span`,null,U(n(s)(`aiChat.attachedContext`)),1),A(`i`,{class:P([`ti`,_.value.has(i)?`ti-chevron-up`:`ti-chevron-down`])},null,2)],8,eu),_.value.has(i)?(z(),j(`div`,{key:0,class:`ai-chat-message-list__context-note-body`,innerHTML:n(Jt).sanitize(t.contextNote??``)},null,8,tu)):K(``,!0)])):K(``,!0),t.parts?.length?(z(),j(V,{key:1},[(z(!0),j(V,null,M(t.parts,(a,c)=>(z(),j(V,{key:c},[a.type===`thinking`?(z(),j(`div`,nu,[A(`div`,{class:`ai-chat-message-list__thinking-header`,onClick:e=>y(`${i}-${c}`)},[r[5]||=A(`i`,{class:`ti ti-sparkles`},null,-1),A(`span`,null,U(n(s)(`aiChatPage.thinking`)),1),A(`i`,{class:P([`ti`,g.value.has(`${i}-${c}`)?`ti-chevron-up`:`ti-chevron-down`])},null,2)],8,ru),g.value.has(`${i}-${c}`)||e.isStreaming&&i===e.messages.length-1&&c===t.parts.length-1?(z(),j(`pre`,iu,U(a.text),1)):K(``,!0)])):a.type===`tool`?(z(),j(`div`,{key:1,class:P([`ai-chat-message-list__tool-event`,{"ai-chat-message-list__tool-event--pending":a.pending,"ai-chat-message-list__tool-event--error":!a.pending&&a.isError,"ai-chat-message-list__tool-event--ok":!a.pending&&!a.isError}])},[A(`div`,{class:`ai-chat-message-list__tool-event-header`,onClick:e=>!a.pending&&x(a.id)},[A(`i`,{class:P(a.pending?`ti ti-spin ti-loader-2`:a.isError?`ti ti-circle-x`:`ti ti-circle-check`)},null,2),A(`span`,ou,U(O(a)),1),a.pending&&a.rawInput?(z(),j(`span`,su,[b(U(a.rawInput),1),r[6]||=A(`span`,{class:`ai-chat-message-list__cursor`},null,-1)])):k(a)?(z(),j(`span`,cu,U(k(a)),1)):K(``,!0),a.pending?K(``,!0):(z(),j(`i`,{key:2,class:P([`ai-chat-message-list__tool-event-chevron ti`,h.value.has(a.id)?`ti-chevron-up`:`ti-chevron-down`])},null,2))],8,au),!a.pending&&h.value.has(a.id)?(z(),j(V,{key:0},[a.input&&Object.keys(a.input).length>0&&!E(a.name)?(z(),j(`div`,{key:0,class:`ai-chat-message-list__tool-params`,onClick:r[2]||=he(()=>{},[`stop`])},[(z(!0),j(V,null,M(Object.entries(a.input),([e,t])=>(z(),j(`div`,{key:e,class:`ai-chat-message-list__tool-param-row`},[A(`span`,lu,U(e),1),A(`span`,uu,U(typeof t==`object`?JSON.stringify(t):String(t)),1)]))),128))])):K(``,!0),N(a)?(z(),j(`div`,{key:1,class:`ai-chat-message-list__tool-diff`,onClick:he(e=>x(a.id),[`stop`])},[a.input?.file_path?(z(),j(`div`,fu,U(a.input.file_path),1)):K(``,!0),A(`div`,pu,[(z(!0),j(V,null,M(N(a),(e,t)=>(z(),j(`div`,{key:t,class:P([`ai-chat-message-list__tool-diff-line`,`ai-chat-message-list__tool-diff-line--${e.type}`])},[A(`span`,mu,U(e.type===`add`?`+`:e.type===`remove`?`-`:` `),1),b(U(e.text),1)],2))),128))])],8,du)):a.result===void 0?K(``,!0):(z(),j(`pre`,{key:2,class:`ai-chat-message-list__tool-event-result ai-chat-message-list__tool-event-result--expanded`,onClick:he(e=>x(a.id),[`stop`])},U(C(a.result,20)),9,hu))],64)):K(``,!0)],2)):a.type===`text`&&t.role===`user`?(z(),j(`div`,gu,U(a.text),1)):a.type===`text`?(z(),j(`div`,{key:3,class:`ai-chat-message-list__markdown`,innerHTML:f(a.text)},null,8,_u)):a.type===`image`?(z(),j(`div`,vu,[A(`img`,{src:a.url,alt:a.altText||n(s)(`imageHistory.expired`),class:`ai-chat-message-list__image-thumb`,onClick:e=>o(`open-image-preview`,a.url,a.altText||`image`),onError:w},null,40,yu),A(`div`,{class:`ai-chat-message-list__image-expired`,role:`img`,"aria-label":n(s)(`imageHistory.expired`),style:{display:`none`}},[r[7]||=A(`i`,{class:`ti ti-photo`},null,-1),r[8]||=A(`i`,{class:`ti ti-alert-triangle`},null,-1),A(`span`,null,U(n(s)(`imageHistory.expired`)),1)],8,bu)])):K(``,!0)],64))),128)),t.status&&e.isStreaming&&i===e.messages.length-1?(z(),j(`div`,xu,[r[9]||=A(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),A(`span`,null,U(t.status),1)])):K(``,!0),e.isStreaming&&i===e.messages.length-1&&t.role===`assistant`?(z(),j(`span`,Su)):K(``,!0)],64)):(z(),j(V,{key:2},[t.status&&e.isStreaming&&i===e.messages.length-1?(z(),j(`div`,Cu,[r[10]||=A(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),A(`span`,null,U(t.status),1)])):K(``,!0),t.role===`assistant`?(z(),j(`div`,{key:1,class:`ai-chat-message-list__markdown`,innerHTML:f(t.content)},null,8,wu)):(z(),j(`div`,Tu,U(t.content),1)),e.isStreaming&&i===e.messages.length-1&&t.role===`assistant`?(z(),j(`span`,Eu)):K(``,!0)],64))],2))),128)),e.messages.length===0?(z(),j(`div`,Du,[...r[11]||=[A(`i`,{class:`ti ti-send`,style:{"font-size":`2rem`,opacity:`0.2`}},null,-1)]])):K(``,!0)],512)],64))}}),[[`__scopeId`,`data-v-dc6da04d`]]),Au={class:`image-upload-bar`},ju=[`aria-label`],Mu={key:2,class:`image-upload-bar__spinner-slot`},Nu=[`onClick`],Pu=[`src`,`alt`],Fu={key:3,class:`image-upload-bar__limit-msg`},Iu=Ke(R({__name:`ImageUploadBar`,emits:[`preview`],setup(e,{emit:t}){let{t:i}=ge(),a=ut(),{pendingImages:o,isUploadingImage:s}=_e(a),c=r(null);function l(){c.value?.click()}async function u(e){let t=e.target;if(!t.files)return;let n=Array.from(t.files);for(let e of n)await a.uploadImage(e);t.value=``}let d=t;return(e,t)=>{let r=v(`tooltip`);return z(),j(`div`,Au,[A(`input`,{ref_key:`fileInput`,ref:c,type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif`,multiple:``,"aria-label":n(i)(`imageUpload.selectImages`),style:{display:`none`},onChange:u},null,40,ju),n(o).length>0?(z(),W(n(Me),{key:0,value:n(o).length,severity:`contrast`},{default:H(()=>[y(n(q),{icon:`ti ti-paperclip`,label:n(i)(`imageUpload.attachButton`),size:`small`,severity:`secondary`,variant:`text`,disabled:n(s)||n(o).length>=5,onClick:l},null,8,[`label`,`disabled`])]),_:1},8,[`value`])):(z(),W(n(q),{key:1,icon:`ti ti-paperclip`,label:n(i)(`imageUpload.attachButton`),size:`small`,severity:`secondary`,variant:`text`,disabled:n(s),onClick:l},null,8,[`label`,`disabled`])),n(s)?(z(),j(`div`,Mu,[y(n(Ae),{style:{width:`40px`,height:`40px`}})])):K(``,!0),(z(!0),j(V,null,M(n(o),e=>k((z(),j(`div`,{key:e.imageId,class:`image-upload-bar__thumb`,onClick:t=>d(`preview`,e.localPreviewUrl||e.url,e.fileName)},[A(`img`,{src:e.localPreviewUrl||e.url,alt:e.fileName,class:`image-upload-bar__thumb-img`},null,8,Pu),y(n(q),{icon:`ti ti-x`,severity:`danger`,variant:`text`,rounded:``,size:`small`,class:`image-upload-bar__thumb-remove`,"aria-label":n(i)(`imageUpload.removeImage`,{name:e.fileName}),onClick:he(t=>n(a).removePendingImage(e.imageId),[`stop`])},null,8,[`aria-label`,`onClick`])],8,Nu)),[[r,e.fileName,void 0,{top:!0}]])),128)),n(o).length>=5?(z(),j(`span`,Fu,U(n(i)(`imageUpload.limitReached`)),1)):K(``,!0)])}}}),[[`__scopeId`,`data-v-a23dc663`]]),Lu={class:`ai-chat-composer__context-preview`},Ru=Ke(R({__name:`ContextBadge`,props:{label:{},icon:{},text:{},removable:{type:Boolean},variant:{}},emits:[`remove`],setup(e,{emit:t}){let i=e,a=t,o=r(null);function s(e){i.text&&o.value?.toggle(e)}function c(){o.value?.hide(),a(`remove`)}return(t,r)=>(z(),j(V,null,[A(`div`,{class:P([`ai-chat-composer__context-badge`,{"ai-chat-composer__context-badge--service":e.variant===`service`}]),onClick:s},[A(`i`,{class:P(`ti ${e.icon}`)},null,2),A(`span`,null,U(e.label),1),e.removable?(z(),j(`button`,{key:0,class:`ai-chat-composer__context-remove`,title:`Remove`,onClick:he(c,[`stop`])},[...r[0]||=[A(`i`,{class:`ti ti-x`},null,-1)]])):K(``,!0)],2),e.text?(z(),W(n(ke),{key:0,ref_key:`popover`,ref:o},{default:H(()=>[A(`pre`,Lu,U(e.text),1)]),_:1},512)):K(``,!0)],64))}}),[[`__scopeId`,`data-v-b6f5b293`]]),zu={class:`ai-chat-composer`},Bu={class:`ai-chat-composer__row`},Vu=[`title`],Hu={class:`ai-chat-composer__model-picker`},Uu=[`onClick`],Wu=Ke(R({__name:`AiChatComposer`,props:g({isStreaming:{type:Boolean},isStreamingCurrentConv:{type:Boolean},activeConversationId:{}},{input:{default:``},inputModifiers:{}}),emits:g([`submit`,`open-image-preview`],[`update:input`]),setup(e,{emit:t}){let i=t,a=ut(),{t:o}=ge(),{claudeCodeAvailable:s,claudeCodeModel:c,selectedModel:l,availableModels:u,isUploadingImage:d}=_e(a),f=x(e,`input`),p=L(()=>a.activeConversation?.runner===`codex`),m=L(()=>{let e=a.activeConversation;return e?.runner===`claude-code`||e?.isCli===!0&&!e.runner&&!e.providerId}),h=L(()=>p.value?[]:m.value?[``,...dn]:u.value),g=L({get:()=>m.value?c.value??``:l.value,set:e=>{m.value?c.value=e||null:l.value=e}}),_=r(null);function v(e){_.value?.toggle(e)}function b(e){g.value=e,_.value?.hide()}function C(e){return e||o(`aiChatPage.modelDefault`)}let{pendingDiffContext:w,pendingInput:T,pendingContext:E,pendingPopulateContext:D,contextServiceId:ee}=sn(),O=pn(),k=L(()=>ee.value?O.getById(ee.value):null);async function N(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(e=>e.type.startsWith(`image/`));if(n.length!==0){e.preventDefault();for(let e of n){let t=e.getAsFile();t&&await a.uploadImage(t)}}}S(T,e=>{e&&(f.value=e,T.value=null)},{immediate:!0});function F(){w.value=null}function I(){E.value=null}return(t,r)=>(z(),j(`footer`,zu,[y(Iu,{class:`ai-chat-composer__image-upload-bar`,onPreview:r[0]||=(e,t)=>i(`open-image-preview`,e,t)}),k.value?(z(),W(Ru,{key:0,variant:`service`,icon:`ti-server`,label:k.value.name},null,8,[`label`])):K(``,!0),n(w)?(z(),W(Ru,{key:1,icon:`ti-code`,label:n(o)(`aiChatPage.diffContextAttached`),text:n(w),removable:``,onRemove:F},null,8,[`label`,`text`])):K(``,!0),n(E)?(z(),W(Ru,{key:2,icon:n(E).icon,label:n(E).label,text:n(E).text,removable:``,onRemove:I},null,8,[`icon`,`label`,`text`])):K(``,!0),A(`div`,Bu,[y(n($e),{modelValue:f.value,"onUpdate:modelValue":r[1]||=e=>f.value=e,rows:`1`,"auto-resize":``,disabled:e.isStreamingCurrentConv,placeholder:n(o)(`aiChatPage.messagePlaceholder`),class:`ai-chat-composer__input`,onKeydown:r[2]||=de(he(e=>i(`submit`),[`exact`,`prevent`]),[`enter`]),onPaste:N},null,8,[`modelValue`,`disabled`,`placeholder`]),!p.value&&h.value.length>0?(z(),j(V,{key:0},[A(`button`,{class:`ai-chat-composer__model-btn`,title:C(g.value),onClick:v},[r[5]||=A(`i`,{class:`ti ti-brain`},null,-1),A(`span`,null,U(C(g.value)),1)],8,Vu),y(n(ke),{ref_key:`modelPopover`,ref:_},{default:H(()=>[A(`div`,Hu,[(z(!0),j(V,null,M(h.value,e=>(z(),j(`div`,{key:e,class:P([`ai-chat-composer__model-option`,{"ai-chat-composer__model-option--active":e===g.value}]),onClick:t=>b(e)},U(C(e)),11,Uu))),128))])]),_:1},512)],64)):K(``,!0),e.isStreamingCurrentConv?(z(),W(n(q),{key:1,icon:`ti ti-player-stop`,severity:`danger`,onClick:r[3]||=e=>n(a).stopStreaming()})):(z(),W(n(q),{key:2,icon:`ti ti-send`,disabled:n(d),onClick:r[4]||=e=>i(`submit`)},null,8,[`disabled`]))])]))}}),[[`__scopeId`,`data-v-a566dcbd`]]),Gu=Object.defineProperty,Ku=Object.getOwnPropertyDescriptor,qu=(e,t)=>{for(var n in t)Gu(e,n,{get:t[n],enumerable:!0})},Ju=(e,t,n,r)=>{for(var i=r>1?void 0:r?Ku(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Gu(t,n,i),i},X=(e,t)=>(n,r)=>t(n,r,e),Yu=`Terminal input`,Xu={get:()=>Yu,set:e=>Yu=e},Zu=`Too much output to announce, navigate to rows manually to read`,Qu={get:()=>Zu,set:e=>Zu=e};function $u(e){return e.replace(/\r?\n/g,`\r`)}function ed(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function td(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function nd(e,t,n,r){e.stopPropagation(),e.clipboardData&&rd(e.clipboardData.getData(`text/plain`),t,n,r)}function rd(e,t,n,r){e=$u(e),e=ed(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function id(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ad(e,t,n,r,i){id(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function od(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function sd(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var cd=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ld=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},ud=``,dd=` `,fd=class e{constructor(){this.fg=0,this.bg=0,this.extended=new pd}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},pd=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},md=class e extends fd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new pd,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?od(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},hd=`di$target`,gd=`di$dependencies`,_d=new Map;function vd(e){return e[gd]||[]}function yd(e){if(_d.has(e))return _d.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);bd(t,e,r)};return t._id=e,_d.set(e,t),t}function bd(e,t,n){t[hd]===t?t[gd].push({id:e,index:n}):(t[gd]=[{id:e,index:n}],t[hd]=t)}var xd=yd(`BufferService`),Sd=yd(`CoreMouseService`),Cd=yd(`CoreService`),wd=yd(`CharsetService`),Td=yd(`InstantiationService`),Ed=yd(`LogService`),Dd=yd(`OptionsService`),Od=yd(`OscLinkService`),kd=yd(`UnicodeService`),Ad=yd(`DecorationService`),jd=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new md,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Md(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};jd=Ju([X(0,xd),X(1,Dd),X(2,Od)],jd);function Md(e,t){if(confirm(`Do you want to navigate to ${t}?
9
+
10
+ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Nd=yd(`CharSizeService`),Pd=yd(`CoreBrowserService`),Fd=yd(`MouseService`),Id=yd(`RenderService`),Ld=yd(`SelectionService`),Rd=yd(`CharacterJoinerService`),zd=yd(`ThemeService`),Bd=yd(`LinkProviderService`),Vd=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?qd.isErrorNoTelemetry(e)?new qd(e.message+`
11
+
12
+ `+e.stack):Error(e.message+`
13
+
14
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function Hd(e){Wd(e)||Vd.onUnexpectedError(e)}var Ud=`Canceled`;function Wd(e){return e instanceof Gd||e instanceof Error&&e.name===Ud&&e.message===Ud}var Gd=class extends Error{constructor(){super(Ud),this.name=this.message}};function Kd(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var qd=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Jd=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function Yd(e,t=0){return e[e.length-(1+t)]}var Xd;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Xd||={});var Zd=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Xd.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Zd.empty=new Zd(e=>{});function Qd(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var $d;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})($d||={});var ef=null;function tf(e){return ef?.trackDisposable(e),e}function nf(e){ef?.markAsDisposed(e)}function rf(e,t){ef?.setParent(e,t)}function af(e){return ef?.markAsSingleton(e),e}function of(e){if($d.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function sf(...e){return cf(()=>of(e))}function cf(e){let t=tf({dispose:Qd(()=>{nf(t),e()})});return t}var lf=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,tf(this)}dispose(){this._isDisposed||(nf(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{of(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return rf(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),rf(e,null))}};lf.DISABLE_DISPOSED_WARNING=!1;var uf=lf,df=class{constructor(){this._store=new uf,tf(this),rf(this._store,this)}dispose(){nf(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};df.None=Object.freeze({dispose(){}});var ff=class{constructor(){this._isDisposed=!1,tf(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&rf(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,nf(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&rf(e,null),e}},pf=typeof window==`object`?window:globalThis,mf=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};mf.Undefined=new mf(void 0);var hf=mf,gf=class{constructor(){this._first=hf.Undefined,this._last=hf.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===hf.Undefined}clear(){let e=this._first;for(;e!==hf.Undefined;){let t=e.next;e.prev=hf.Undefined,e.next=hf.Undefined,e=t}this._first=hf.Undefined,this._last=hf.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new hf(e);if(this._first===hf.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==hf.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==hf.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==hf.Undefined&&e.next!==hf.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===hf.Undefined&&e.next===hf.Undefined?(this._first=hf.Undefined,this._last=hf.Undefined):e.next===hf.Undefined?(this._last=this._last.prev,this._last.next=hf.Undefined):e.prev===hf.Undefined&&(this._first=this._first.next,this._first.prev=hf.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==hf.Undefined;)yield e.element,e=e.next}},_f=globalThis.performance&&typeof globalThis.performance.now==`function`,vf=class e{static create(t){return new e(t)}constructor(e){this._now=_f&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},yf;(e=>{e.None=()=>df.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(sf(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new Z({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new Z({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Z({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Z({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Z({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new Z;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new Z(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof uf?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(yf||={});var bf=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new vf,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};bf.all=new Set,bf._idPool=0;var xf=bf,Sf=-1,Cf=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new Ef(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};Cf._idPool=1;var wf=Cf,Tf=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
15
+ `).slice(2).join(`
16
+ `))}},Ef=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},Df=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},Of=0,kf=class{constructor(e){this.value=e,this.id=Of++}},Af=2,Z=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Sf>0||this._options?.leakWarningThreshold?new wf(e?.onListenerError??Hd,this._options?.leakWarningThreshold??Sf):void 0,this._perfMon=this._options?._profName?new xf(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Df(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Hd)(n),df.None}if(this._disposed)return df.None;t&&(e=e.bind(t));let r=new kf(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Tf.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof kf?(this._deliveryQueue??=new jf,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=cf(()=>{i?.(),this._removeListener(r)});return n instanceof uf?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Af<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Hd;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof kf)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},jf=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Mf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Z,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Z,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Mf.INSTANCE=new Mf;var Nf=Mf;function Pf(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}Nf.INSTANCE.onDidChangeZoomLevel;function Ff(e){return Nf.INSTANCE.getZoomFactor(e)}Nf.INSTANCE.onDidChangeFullscreen;var If=typeof navigator==`object`?navigator.userAgent:``,Lf=If.indexOf(`Firefox`)>=0,Rf=If.indexOf(`AppleWebKit`)>=0,zf=If.indexOf(`Chrome`)>=0,Bf=!zf&&If.indexOf(`Safari`)>=0;If.indexOf(`Electron/`),If.indexOf(`Android`);var Vf=!1;if(typeof pf.matchMedia==`function`){let e=pf.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=pf.matchMedia(`(display-mode: fullscreen)`);Vf=e.matches,Pf(pf,e,({matches:e})=>{Vf&&t.matches||(Vf=e)})}function Hf(){return Vf}var Uf=`en`,Wf=!1,Gf=!1,Kf=!1,qf=!1,Jf=!1,Yf=Uf,Xf,Zf=globalThis,Qf;typeof Zf.vscode<`u`&&typeof Zf.vscode.process<`u`?Qf=Zf.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(Qf=process);var $f=typeof Qf?.versions?.electron==`string`&&Qf?.type===`renderer`;if(typeof Qf==`object`){Wf=Qf.platform===`win32`,Gf=Qf.platform===`darwin`,Kf=Qf.platform===`linux`,Kf&&Qf.env.SNAP&&Qf.env.SNAP_REVISION,Qf.env.CI||Qf.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Yf=Uf;let e=Qf.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,Yf=t.resolvedLanguage||Uf,t.languagePack?.translationsConfigFile}catch{}qf=!0}else typeof navigator==`object`&&!$f?(Xf=navigator.userAgent,Wf=Xf.indexOf(`Windows`)>=0,Gf=Xf.indexOf(`Macintosh`)>=0,(Xf.indexOf(`Macintosh`)>=0||Xf.indexOf(`iPad`)>=0||Xf.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Kf=Xf.indexOf(`Linux`)>=0,Xf?.indexOf(`Mobi`),Jf=!0,Yf=globalThis._VSCODE_NLS_LANGUAGE||Uf,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var ep=Wf,tp=Gf,np=Kf,rp=qf;Jf&&typeof Zf.importScripts==`function`&&Zf.origin;var ip=Xf,ap=Yf,op;(e=>{function t(){return ap}e.value=t;function n(){return ap.length===2?ap===`en`:ap.length>=3&&ap[0]===`e`&&ap[1]===`n`&&ap[2]===`-`}e.isDefaultVariant=n;function r(){return ap===`en`}e.isDefault=r})(op||={});var sp=typeof Zf.postMessage==`function`&&!Zf.importScripts;(()=>{if(sp){let e=[];Zf.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Zf.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var cp=!!(ip&&ip.indexOf(`Chrome`)>=0);ip&&ip.indexOf(`Firefox`),!cp&&ip&&ip.indexOf(`Safari`),ip&&ip.indexOf(`Edg/`),ip&&ip.indexOf(`Android`);var lp=typeof navigator==`object`?navigator:{};rp||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||lp&&lp.clipboard&&lp.clipboard.writeText,rp||lp&&lp.clipboard&&lp.clipboard.readText,rp||Hf()||lp.keyboard,`ontouchstart`in pf||lp.maxTouchPoints,pf.PointerEvent&&(`ontouchstart`in pf||navigator.maxTouchPoints);var up=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},dp=new up,fp=new up,pp=new up,mp=Array(230),hp;(e=>{function t(e){return dp.keyCodeToStr(e)}e.toString=t;function n(e){return dp.strToKeyCode(e)}e.fromString=n;function r(e){return fp.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return pp.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return fp.strToKeyCode(e)||pp.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return dp.keyCodeToStr(e)}e.toElectronAccelerator=o})(hp||={});var gp=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new _p([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},_p=class{constructor(e){if(e.length===0)throw Kd(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function vp(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return hp.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(Lf)switch(t){case 59:return 85;case 60:if(np)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(tp)return 57}else if(Rf&&(tp&&t===93||!tp&&t===92))return 57;return mp[t]||0}var yp=tp?256:2048,bp=512,xp=1024,Sp=tp?2048:256,Cp=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=vp(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=yp),this.altKey&&(t|=bp),this.shiftKey&&(t|=xp),this.metaKey&&(t|=Sp),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new gp(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},wp=new WeakMap;function Tp(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var Ep=class{static getSameOriginWindowChain(e){let t=wp.get(e);if(!t){t=[],wp.set(e,t);let n=e,r;do r=Tp(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},Dp=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=Ep.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Op=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(zf){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?Lf&&!tp?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=Bf&&ep?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?Lf&&!tp?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},kp=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Ap;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof jp?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:yf.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:kp})})(Ap||={});var jp=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?kp:(this._emitter||=new Z,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},Mp=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Jd(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Jd(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Np=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Jd(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=cf(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Pp;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Pp||={});var Fp=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Z,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await yf.toPromise(this._onStateChanged.event)}while(1)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Fp.EMPTY=Fp.fromArray([]);function Ip(e){return Lp(e,0)}function Lp(e,t){switch(typeof e){case`object`:return e===null?Rp(349,t):Array.isArray(e)?Vp(e,t):Hp(e,t);case`string`:return Bp(e,t);case`boolean`:return zp(e,t);case`number`:return Rp(e,t);case`undefined`:return Rp(937,t);default:return Rp(617,t)}}function Rp(e,t){return(t<<5)-t+e|0}function zp(e,t){return Rp(e?433:863,t)}function Bp(e,t){t=Rp(149417,t);for(let n=0,r=e.length;n<r;n++)t=Rp(e.charCodeAt(n),t);return t}function Vp(e,t){return t=Rp(104579,t),e.reduce((e,t)=>Lp(t,e),t)}function Hp(e,t){return t=Rp(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Bp(n,t),Lp(e[n],t)),t)}var{registerWindow:Up,getWindow:Wp,getDocument:Gp,getWindows:Kp,getWindowsCount:qp,getWindowId:Jp,getWindowById:Yp,hasWindow:Xp,onDidRegisterWindow:Zp,onWillUnregisterWindow:Qp,onDidUnregisterWindow:$p}=function(){let e=new Map,t={window:pf,disposables:new uf};e.set(pf.vscodeWindowId,t);let n=new Z,r=new Z,i=new Z;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return df.None;let a=new uf,o={window:t,disposables:a.add(new uf)};return e.set(t.vscodeWindowId,o),a.add(cf(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(tm(t,um.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:pf},getDocument(e){return Wp(e).document}}}(),em=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function tm(e,t,n,r){return new em(e,t,n,r)}function nm(e,t){return function(n){return t(new Dp(e,n))}}function rm(e){return function(t){return e(new Cp(t))}}var im=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=nm(Wp(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=rm(n)),tm(e,t,i,r)},am,om=class extends Np{constructor(e){super(),this.defaultTarget=e&&Wp(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},sm=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Hd(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(sm.sort),a.shift().execute();r.set(i,!1)};am=(t,r,a=0)=>{let o=Jp(t),s=new sm(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var cm=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};cm.None=new cm(0,0);function lm(e){let t=e.getBoundingClientRect(),n=Wp(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Ip(n),a=r.get(i);if(a)a.users+=1;else{let o=new Z,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(cf(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var um={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:Rf?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Rf?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Rf?`webkitAnimationIteration`:`animationiteration`},dm=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=fm(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=fm(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=fm(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=fm(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=fm(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=fm(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=fm(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=fm(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=fm(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=fm(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=fm(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=fm(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=fm(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=fm(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function fm(e){return typeof e==`number`?`${e}px`:e}function pm(e){return new dm(e)}var mm=class{constructor(){this._hooks=new uf,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(cf(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=Wp(e)}this._hooks.add(tm(a,um.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(tm(a,um.POINTER_UP,e=>this.stopMonitoring(!0)))}};function hm(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var gm;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(gm||={});var _m=class e extends df{constructor(){super(),this.dispatched=!1,this.targets=new gf,this.ignoreTargets=new gf,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(yf.runAndSubscribe(Zp,({window:e,disposables:t})=>{t.add(tm(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(tm(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(tm(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:pf,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=af(new e),cf(e.INSTANCE.targets.push(t))):df.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=af(new e),cf(e.INSTANCE.ignoreTargets.push(t))):df.None}static isTouchDevice(){return`ontouchstart`in pf||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(gm.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-Yd(s.rollingPageX))<30&&Math.abs(s.initialPageY-Yd(s.rollingPageY))<30){let e=this.newGestureEvent(gm.Tap,s.initialTarget);e.pageX=Yd(s.rollingPageX),e.pageY=Yd(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-Yd(s.rollingPageX))<30&&Math.abs(s.initialPageY-Yd(s.rollingPageY))<30){let e=this.newGestureEvent(gm.Contextmenu,s.initialTarget);e.pageX=Yd(s.rollingPageX),e.pageY=Yd(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=Yd(s.rollingPageX),n=Yd(s.rollingPageY),i=Yd(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(gm.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===gm.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===gm.Change||t.type===gm.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=am(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(gm.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(gm.Change,i.initialTarget);a.translationX=r.pageX-Yd(i.rollingPageX),a.translationY=r.pageY-Yd(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};_m.SCROLL_FRICTION=-.005,_m.HOLD_DELAY=700,_m.CLEAR_TAP_COUNT_TIME=400,Ju([hm],_m,`isTouchDevice`,1);var vm=_m,ym=class extends df{onclick(e,t){this._register(tm(e,um.CLICK,n=>t(new Dp(Wp(e),n))))}onmousedown(e,t){this._register(tm(e,um.MOUSE_DOWN,n=>t(new Dp(Wp(e),n))))}onmouseover(e,t){this._register(tm(e,um.MOUSE_OVER,n=>t(new Dp(Wp(e),n))))}onmouseleave(e,t){this._register(tm(e,um.MOUSE_LEAVE,n=>t(new Dp(Wp(e),n))))}onkeydown(e,t){this._register(tm(e,um.KEY_DOWN,e=>t(new Cp(e))))}onkeyup(e,t){this._register(tm(e,um.KEY_UP,e=>t(new Cp(e))))}oninput(e,t){this._register(tm(e,um.INPUT,t))}onblur(e,t){this._register(tm(e,um.BLUR,t))}onfocus(e,t){this._register(tm(e,um.FOCUS,t))}onchange(e,t){this._register(tm(e,um.CHANGE,t))}ignoreGesture(e){return vm.ignoreTarget(e)}},bm=11,xm=class extends ym{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=bm+`px`,this.domNode.style.height=bm+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new mm),this._register(im(this.bgDomNode,um.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(im(this.domNode,um.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new om),this._pointerdownScheduleRepeatTimer=this._register(new Mp)}_arrowPointerDown(e){e.target&&e.target instanceof Element&&(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Wp(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},Sm=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},Cm=class extends df{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Z),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Sm(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Dm(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Dm.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},wm=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Tm(e,t){let n=t-e;return function(t){return e+n*km(t)}}function Em(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Dm=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),Em(Tm(e,r),Tm(i,t),.33)}return Tm(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new wm(this.scrollLeft(t),this.scrollTop(t),!1):new wm(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function Om(e){return e**3}function km(e){return 1-Om(1-e)}var Am=class extends df{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Mp)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},jm=140,Mm=class extends ym{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Am(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new mm),this._shouldRender=!0,this.domNode=pm(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(tm(this.domNode.domNode,um.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new xm(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=pm(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(tm(this.slider.domNode,um.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=lm(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(ep&&a>jm){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Nm=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},Pm=class extends Mm{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Nm(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Fm=class extends Mm{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Nm(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Im=500,Lm=50,Rm=!0,zm=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Bm=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(1);return t<=.5}acceptStandardWheelEvent(e){if(zf){let t=Ff(Wp(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new zm(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Bm.INSTANCE=new Bm;var Vm=Bm,Hm=class extends ym{constructor(e,t,n){super(),this._onScroll=this._register(new Z),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Z),this.onWillScroll=this._onWillScroll.event,this._options=Wm(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Fm(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Pm(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=pm(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=pm(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=pm(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new Mp),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=of(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,tp&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Op(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=of(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(tm(this._listenOnDomNode,um.MOUSE_WHEEL,e=>{this._onMouseWheel(new Op(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Vm.INSTANCE;Rm&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!tp&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=Lm*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=Lm*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Rm&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Im)}},Um=class extends Hm{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Wm(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,tp&&(t.className+=` mac`),t}var Gm=class extends df{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new Z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new Cm({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>am(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Um(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(yf.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(cf(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(cf(()=>this._styleElement.remove())),this._register(yf.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
17
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Gm=Ju([X(2,xd),X(3,Pd),X(4,Sd),X(5,zd),X(6,Dd),X(7,Id)],Gm);var Km=class extends df{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(cf(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Km=Ju([X(1,xd),X(2,Pd),X(3,Ad),X(4,Id)],Km);var qm=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Jm={full:0,left:0,center:0,right:0},Ym={full:0,left:0,center:0,right:0},Xm={full:0,left:0,center:0,right:0},Zm=class extends df{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new qm,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(cf(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Ym.full=this._canvas.width,Ym.left=e,Ym.center=t,Ym.right=e,this._refreshDrawHeightConstants(),Xm.full=1,Xm.left=1,Xm.center=1+Ym.left,Xm.right=1+Ym.left+Ym.center}_refreshDrawHeightConstants(){Jm.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Jm.left=t,Jm.center=t,Jm.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Jm.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Jm.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Jm.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Jm.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Xm[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Jm[e.position||`full`]/2),Ym[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Jm[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Zm=Ju([X(2,xd),X(3,Ad),X(4,Id),X(5,Dd),X(6,zd),X(7,Pd)],Zm);var Q;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
18
+ `,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(Q||={});var Qm;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(Qm||={});var $m;(e=>e.ST=`${Q.ESC}\\`)($m||={});var eh=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Q.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};eh=Ju([X(2,xd),X(3,Dd),X(4,Cd),X(5,Id)],eh);var th=0,nh=0,rh=0,ih=0,ah={css:`#00000000`,rgba:0},oh;(e=>{function t(e,t,n,r){return r===void 0?`#${dh(e)}${dh(t)}${dh(n)}`:`#${dh(e)}${dh(t)}${dh(n)}${dh(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(oh||={});var sh;(e=>{function t(e,t){if(ih=(t.rgba&255)/255,ih===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return th=a+Math.round((n-a)*ih),nh=o+Math.round((r-o)*ih),rh=s+Math.round((i-s)*ih),{css:oh.toCss(th,nh,rh),rgba:oh.toRgba(th,nh,rh)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=uh.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return oh.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[th,nh,rh]=uh.toChannels(t),{css:oh.toCss(th,nh,rh),rgba:t}}e.opaque=i;function a(e,t){return ih=Math.round(t*255),[th,nh,rh]=uh.toChannels(e.rgba),{css:oh.toCss(th,nh,rh,ih),rgba:oh.toRgba(th,nh,rh,ih)}}e.opacity=a;function o(e,t){return ih=e.rgba&255,a(e,ih*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(sh||={});var ch;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return th=parseInt(e.slice(1,2).repeat(2),16),nh=parseInt(e.slice(2,3).repeat(2),16),rh=parseInt(e.slice(3,4).repeat(2),16),oh.toColor(th,nh,rh);case 5:return th=parseInt(e.slice(1,2).repeat(2),16),nh=parseInt(e.slice(2,3).repeat(2),16),rh=parseInt(e.slice(3,4).repeat(2),16),ih=parseInt(e.slice(4,5).repeat(2),16),oh.toColor(th,nh,rh,ih);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return th=parseInt(r[1]),nh=parseInt(r[2]),rh=parseInt(r[3]),ih=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),oh.toColor(th,nh,rh,ih);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[th,nh,rh,ih]=t.getImageData(0,0,1,1).data,ih!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:oh.toRgba(th,nh,rh,ih),css:e}}e.toColor=r})(ch||={});var lh;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(lh||={});var uh;(e=>{function t(e,t){if(ih=(t&255)/255,ih===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return th=a+Math.round((n-a)*ih),nh=o+Math.round((r-o)*ih),rh=s+Math.round((i-s)*ih),oh.toRgba(th,nh,rh)}e.blend=t;function n(e,t,n){let a=lh.relativeLuminance(e>>8),o=lh.relativeLuminance(t>>8);if(fh(a,o)<n){if(o<a){let o=r(e,t,n),s=fh(a,lh.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>fh(a,lh.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=fh(a,lh.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>fh(a,lh.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=fh(lh.relativeLuminance2(o,s,c),lh.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=fh(lh.relativeLuminance2(o,s,c),lh.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=fh(lh.relativeLuminance2(o,s,c),lh.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=fh(lh.relativeLuminance2(o,s,c),lh.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(uh||={});function dh(e){let t=e.toString(16);return t.length<2?`0`+t:t}function fh(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var ph=class extends fd{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},mh=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new md}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||dd.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)mh._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||dd.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};mh=Ju([X(0,xd)],mh);function hh(e){return 57508<=e&&e<=57558}function gh(e){return 9472<=e&&e<=9631}function _h(e){return hh(e)||gh(e)}function vh(){return{css:{canvas:yh(),cell:yh()},device:{canvas:yh(),cell:yh(),char:{width:0,height:0,left:0,top:0}}}}function yh(){return{width:0,height:0}}var bh=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new md,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],ee=l!==-1&&u!==-1;for(let O=0;O<m;O++){e.loadCell(O,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let k=!1,A=O>=E,j=O,M=this._workCell;if(f.length>0&&O===f[0][0]&&A){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)A&&=i===this._isCellInSelection(v,t);A&&=!n||a<r[0]||a>=r[1],A?(k=!0,M=new ph(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),j=r[1]-1,m=M.getWidth()):E=r[1]}let N=this._isCellInSelection(O,t),P=n&&O===a,F=ee&&O>=l&&O<=u,I=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{I=!0});let L=M.getChars()||dd;if(L===` `&&(M.isUnderline()||M.isOverline())&&(L=`\xA0`),T=m*s-c.get(L,M.isBold(),M.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(N&&w||!N&&!w&&M.bg===y)&&(N&&w&&p.selectionForeground||M.fg===b)&&M.extended.ext===x&&F===S&&T===C&&!P&&!k&&!I&&A){M.isInvisible()?_+=dd:_+=L,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=M.bg,b=M.fg,x=M.extended.ext,S=F,C=T,w=N,k&&a>=O&&a<=j&&(a=O),!this._coreService.isCursorHidden&&P&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`)}}if(M.isBold()&&D.push(`xterm-bold`),M.isItalic()&&D.push(`xterm-italic`),M.isDim()&&D.push(`xterm-dim`),_=M.isInvisible()?dd:M.getChars()||dd,M.isUnderline()&&(D.push(`xterm-underline-${M.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!M.isUnderlineColorDefault())){if(M.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${fd.toColorRGB(M.getUnderlineColor()).join(`,`)})`;else{let e=M.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&M.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}M.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),M.isStrikethrough()&&D.push(`xterm-strikethrough`),F&&(h.style.textDecoration=`underline`);let te=M.getFgColor(),ne=M.getFgColorMode(),R=M.getBgColor(),z=M.getBgColorMode(),B=!!M.isInverse();if(B){let e=te;te=R,R=e;let t=ne;ne=z,z=t}let V,re,H=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{e.options.layer!==`top`&&H||(e.backgroundColorRGB&&(z=50331648,R=e.backgroundColorRGB.rgba>>8&16777215,V=e.backgroundColorRGB),e.foregroundColorRGB&&(ne=50331648,te=e.foregroundColorRGB.rgba>>8&16777215,re=e.foregroundColorRGB),H=e.options.layer===`top`)}),!H&&N&&(V=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,R=V.rgba>>8&16777215,z=50331648,H=!0,p.selectionForeground&&(ne=50331648,te=p.selectionForeground.rgba>>8&16777215,re=p.selectionForeground)),H&&D.push(`xterm-decoration-top`);let U;switch(z){case 16777216:case 33554432:U=p.ansi[R],D.push(`xterm-bg-${R}`);break;case 50331648:U=oh.toColor(R>>16,R>>8&255,R&255),this._addStyle(h,`background-color:#${xh((R>>>0).toString(16),`0`,6)}`);break;default:B?(U=p.foreground,D.push(`xterm-bg-257`)):U=p.background}switch(V||M.isDim()&&(V=sh.multiplyOpacity(U,.5)),ne){case 16777216:case 33554432:M.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(h,U,p.ansi[te],M,V,void 0)||D.push(`xterm-fg-${te}`);break;case 50331648:let e=oh.toColor(te>>16&255,te>>8&255,te&255);this._applyMinimumContrast(h,U,e,M,V,re)||this._addStyle(h,`color:#${xh(te.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,U,p.foreground,M,V,re)||B&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!P&&!k&&!I&&A?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),O=j}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||_h(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=sh.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};bh=Ju([X(1,Rd),X(2,Dd),X(3,Pd),X(4,Cd),X(5,Ad),X(6,zd)],bh);function xh(e,t,n){for(;e.length<n;)e=t+e;return e}var Sh=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},Ch=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function wh(){return new Ch}var Th=`xterm-dom-renderer-owner-`,Eh=`xterm-rows`,Dh=`xterm-fg-`,Oh=`xterm-bg-`,kh=`xterm-focus`,Ah=`xterm-selection`,jh=1,Mh=class extends df{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=jh++,this._rowElements=[],this._selectionRenderModel=wh(),this.onRequestRedraw=this._register(new Z).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(Eh),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(Ah),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=vh(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(bh,document),this._element.classList.add(Th+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(cf(()=>{this._element.classList.remove(Th+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Sh(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Eh} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Eh} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Eh} .xterm-dim { color: ${sh.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Eh}.${kh} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Eh}.${kh} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Eh}.${kh} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Eh} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Eh} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Eh} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Eh} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Eh} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Ah} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ah} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ah} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${Dh}${n} { color: ${r.css}; }${this._terminalSelector} .${Dh}${n}.xterm-dim { color: ${sh.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${Oh}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${Dh}257 { color: ${sh.opaque(e.background).css}; }${this._terminalSelector} .${Dh}257.xterm-dim { color: ${sh.multiplyOpacity(sh.opaque(e.background),.5).css}; }${this._terminalSelector} .${Oh}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(kh),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(kh),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Th}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};Mh=Ju([X(7,Td),X(8,Nd),X(9,Dd),X(10,xd),X(11,Cd),X(12,Pd),X(13,zd)],Mh);var Nh=class extends df{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Z),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Ih(this._optionsService))}catch{this._measureStrategy=this._register(new Fh(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Nh=Ju([X(2,Dd)],Nh);var Ph=class extends df{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},Fh=class extends Ph{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},Ih=class extends Ph{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Lh=class extends df{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Rh(this._window)),this._onDprChange=this._register(new Z),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Z),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(yf.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(tm(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(tm(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Rh=class extends df{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new ff),this._onDprChange=this._register(new Z),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(cf(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=tm(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},zh=class extends df{constructor(){super(),this.linkProviders=[],this._register(cf(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Bh(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function Vh(e,t,n,r,i,a,o,s,c){if(!a)return;let l=Bh(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var Hh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return Vh(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=Bh(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Hh=Ju([X(0,Id),X(1,Nd)],Hh);var Uh=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Wh={};qu(Wh,{getSafariVersion:()=>Zh,isChromeOS:()=>rg,isFirefox:()=>Jh,isIpad:()=>$h,isIphone:()=>eg,isLegacyEdge:()=>Yh,isLinux:()=>ng,isMac:()=>Qh,isNode:()=>Gh,isSafari:()=>Xh,isWindows:()=>tg});var Gh=typeof process<`u`&&`title`in process,Kh=Gh?`node`:navigator.userAgent,qh=Gh?`node`:navigator.platform,Jh=Kh.includes(`Firefox`),Yh=Kh.includes(`Edge`),Xh=/^((?!chrome|android).)*safari/i.test(Kh);function Zh(){if(!Xh)return 0;let e=Kh.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Qh=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(qh),$h=qh===`iPad`,eg=qh===`iPhone`,tg=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(qh),ng=qh.indexOf(`Linux`)>=0,rg=/\bCrOS\b/.test(Kh),ig=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},ag=class extends ig{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},og=class extends ig{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},sg=!Gh&&`requestIdleCallback`in window?og:ag,cg=class{constructor(){this._queue=new sg}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},lg=class extends df{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new ff),this._pausedResizeTask=new cg,this._observerDisposable=this._register(new ff),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Z),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Z),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Z),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Z),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Uh((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new ug(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(cf(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=cf(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};lg=Ju([X(2,Dd),X(3,Nd),X(4,Cd),X(5,Ad),X(6,xd),X(7,Pd),X(8,zd)],lg);var ug=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function dg(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return mg(i,a,e,t,n,r)+hg(a,t,n,r)+gg(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,Cg(Math.abs(i-e),Sg(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return Cg(pg(a>t?e:i,n)+(s-1)*n.cols+1+fg(a>t?i:e,n),Sg(o,r))}function fg(e,t){return e-1}function pg(e,t){return t.cols-e}function mg(e,t,n,r,i,a){return hg(t,r,i,a).length===0?``:Cg(xg(e,t,e,t-vg(t,i),!1,i).length,Sg(`D`,a))}function hg(e,t,n,r){let i=e-vg(e,n),a=t-vg(t,n);return Cg(Math.abs(i-a)-_g(e,t,n),Sg(bg(e,t),r))}function gg(e,t,n,r,i,a){let o;o=hg(t,r,i,a).length>0?r-vg(r,i):t;let s=r,c=yg(e,t,n,r,i,a);return Cg(xg(e,o,n,s,c===`C`,i).length,Sg(c,a))}function _g(e,t,n){let r=0,i=e-vg(e,n),a=t-vg(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=bg(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function vg(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function yg(e,t,n,r,i,a){let o;return o=hg(n,r,i,a).length>0?r-vg(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function bg(e,t){return e>t?`A`:`B`}function xg(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function Sg(e,t){let n=t?`O`:`[`;return Q.ESC+n+e}function Cg(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var wg=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Tg(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Eg=50,Dg=15,Og=50,kg=500,Ag=RegExp(`\xA0`,`g`),jg=class extends df{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new md,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Z),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Z),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Z),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new wg(this._bufferService),this._activeSelectionMode=0,this._register(cf(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(Ag,` `)).join(tg?`\r
19
+ `:`
20
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),ng&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Tg(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Bh(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Eg),Eg),t/=Eg,t/Math.abs(t)+Math.round(t*(Dg-1)))}shouldForceSelection(e){return Qh?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),Og)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Qh&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<kg&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=dg(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(t||o.slice(s,c).trim()!==``){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Tg(n,this._bufferService.cols)}};jg=Ju([X(3,xd),X(4,Cd),X(5,Fd),X(6,Dd),X(7,Id),X(8,Pd)],jg);var Mg=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Ng=class{constructor(){this._color=new Mg,this._css=new Mg}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Pg=Object.freeze((()=>{let e=[ch.toColor(`#2e3436`),ch.toColor(`#cc0000`),ch.toColor(`#4e9a06`),ch.toColor(`#c4a000`),ch.toColor(`#3465a4`),ch.toColor(`#75507b`),ch.toColor(`#06989a`),ch.toColor(`#d3d7cf`),ch.toColor(`#555753`),ch.toColor(`#ef2929`),ch.toColor(`#8ae234`),ch.toColor(`#fce94f`),ch.toColor(`#729fcf`),ch.toColor(`#ad7fa8`),ch.toColor(`#34e2e2`),ch.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:oh.toCss(r,i,a),rgba:oh.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:oh.toCss(n,n,n),rgba:oh.toRgba(n,n,n)})}return e})()),Fg=ch.toColor(`#ffffff`),Ig=ch.toColor(`#000000`),Lg=ch.toColor(`#ffffff`),Rg=Ig,zg={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},Bg=Fg,Vg=class extends df{constructor(e){super(),this._optionsService=e,this._contrastCache=new Ng,this._halfContrastCache=new Ng,this._onChangeColors=this._register(new Z),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Fg,background:Ig,cursor:Lg,cursorAccent:Rg,selectionForeground:void 0,selectionBackgroundTransparent:zg,selectionBackgroundOpaque:sh.blend(Ig,zg),selectionInactiveBackgroundTransparent:zg,selectionInactiveBackgroundOpaque:sh.blend(Ig,zg),scrollbarSliderBackground:sh.opacity(Fg,.2),scrollbarSliderHoverBackground:sh.opacity(Fg,.4),scrollbarSliderActiveBackground:sh.opacity(Fg,.5),overviewRulerBorder:Fg,ansi:Pg.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Hg(e.foreground,Fg),t.background=Hg(e.background,Ig),t.cursor=sh.blend(t.background,Hg(e.cursor,Lg)),t.cursorAccent=sh.blend(t.background,Hg(e.cursorAccent,Rg)),t.selectionBackgroundTransparent=Hg(e.selectionBackground,zg),t.selectionBackgroundOpaque=sh.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Hg(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=sh.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Hg(e.selectionForeground,ah):void 0,t.selectionForeground===ah&&(t.selectionForeground=void 0),sh.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=sh.opacity(t.selectionBackgroundTransparent,.3)),sh.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=sh.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Hg(e.scrollbarSliderBackground,sh.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Hg(e.scrollbarSliderHoverBackground,sh.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Hg(e.scrollbarSliderActiveBackground,sh.opacity(t.foreground,.5)),t.overviewRulerBorder=Hg(e.overviewRulerBorder,Bg),t.ansi=Pg.slice(),t.ansi[0]=Hg(e.black,Pg[0]),t.ansi[1]=Hg(e.red,Pg[1]),t.ansi[2]=Hg(e.green,Pg[2]),t.ansi[3]=Hg(e.yellow,Pg[3]),t.ansi[4]=Hg(e.blue,Pg[4]),t.ansi[5]=Hg(e.magenta,Pg[5]),t.ansi[6]=Hg(e.cyan,Pg[6]),t.ansi[7]=Hg(e.white,Pg[7]),t.ansi[8]=Hg(e.brightBlack,Pg[8]),t.ansi[9]=Hg(e.brightRed,Pg[9]),t.ansi[10]=Hg(e.brightGreen,Pg[10]),t.ansi[11]=Hg(e.brightYellow,Pg[11]),t.ansi[12]=Hg(e.brightBlue,Pg[12]),t.ansi[13]=Hg(e.brightMagenta,Pg[13]),t.ansi[14]=Hg(e.brightCyan,Pg[14]),t.ansi[15]=Hg(e.brightWhite,Pg[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=Hg(e.extendedAnsi[r],Pg[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Vg=Ju([X(0,Dd)],Vg);function Hg(e,t){if(e!==void 0)try{return ch.toColor(e)}catch{}return t}var Ug=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Wg=class{constructor(){this._services=new Ug,this._services.set(Td,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=vd(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},Gg={trace:0,debug:1,info:2,warn:3,error:4,off:5},Kg=`xterm.js: `,qg=class extends df{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Jg=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Gg[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:Kg)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};qg=Ju([X(0,Dd)],qg);var Jg,Yg=class extends df{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Z),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Z),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Z),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Xg=3,Zg=Object.freeze(new fd),Qg=0,$g=2,e_=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Xg);let r=t||md.fromCharData([0,ud,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*Xg+0],n=t&2097151;return[this._data[e*Xg+1],t&2097152?this._combined[e]:n?od(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*Xg+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*Xg+0]=e|2097152|t[2]<<22):this._data[e*Xg+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*Xg+0]>>22}hasWidth(e){return this._data[e*Xg+0]&12582912}getFg(e){return this._data[e*Xg+1]}getBg(e){return this._data[e*Xg+2]}hasContent(e){return this._data[e*Xg+0]&4194303}getCodePoint(e){let t=this._data[e*Xg+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*Xg+0]&2097152}getString(e){let t=this._data[e*Xg+0];return t&2097152?this._combined[e]:t&2097151?od(t&2097151):``}isProtected(e){return this._data[e*Xg+2]&536870912}loadCell(e,t){return Qg=e*Xg,t.content=this._data[Qg+0],t.fg=this._data[Qg+1],t.bg=this._data[Qg+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*Xg+0]=t.content,this._data[e*Xg+1]=t.fg,this._data[e*Xg+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*Xg+0]=t|n<<22,this._data[e*Xg+1]=r.fg,this._data[e*Xg+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*Xg+0];r&2097152?this._combined[e]+=od(t):r&2097151?(this._combined[e]=od(r&2097151)+od(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*Xg+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new md;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new md;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*$g<this._data.buffer.byteLength;let n=e*Xg;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*$g<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*$g<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Xg+0]&4194303)return e+(this._data[e*Xg+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Xg+0]&4194303||this._data[e*Xg+2]&50331648)return e+(this._data[e*Xg+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<Xg;e++)this._data[(n+i)*Xg+e]=a[(t+i)*Xg+e];a[(t+i)*Xg+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<Xg;e++)this._data[(n+i)*Xg+e]=a[(t+i)*Xg+e];a[(t+i)*Xg+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*Xg+0],n=e&2097151,a=e&2097152?this._combined[t]:n?od(n):dd;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function t_(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=a_(u,d,t),p=1,m=0;for(;p<u.length;){let e=a_(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function n_(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function r_(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function i_(e,t,n){let r=[],i=e.map((n,r)=>a_(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=a_(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function a_(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var o_=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Z),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),of(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};o_._nextId=1;var s_=o_,c_={},l_=c_.B;c_[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},c_.A={"#":`£`},c_.B=void 0,c_[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},c_.C=c_[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},c_.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},c_.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},c_.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},c_.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},c_.E=c_[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},c_.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},c_.H=c_[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},c_[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var u_=4294967295,d_=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Zg.clone(),this.savedCharset=l_,this.markers=[],this._nullCell=md.fromCharData([0,ud,1,0]),this._whitespaceCell=md.fromCharData([0,dd,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new sg,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Yg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new pd),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new pd),this._whitespaceCell}getBlankLine(e,t){return new e_(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>u_?u_:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Zg);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Yg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Zg),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new e_(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new e_(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=t_(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Zg),n);if(r.length>0){let n=n_(this.lines,r);r_(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Zg),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new e_(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Zg),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=i_(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(Zg,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=a_(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new s_(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},f_=class extends df{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Z),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new d_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d_(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},p_=2,m_=1,h_=class extends df{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Z),this.onResize=this._onResize.event,this._onScroll=this._register(new Z),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,p_),this.rows=Math.max(e.rawOptions.rows||0,m_),this.buffers=this._register(new f_(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};h_=Ju([X(0,Dd)],h_);var g_={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Qh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},__=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],v_=class extends df{constructor(e){super(),this._onOptionChange=this._register(new Z),this.onOptionChange=this._onOptionChange.event;let t={...g_};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(cf(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in g_))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in g_))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=g_[e],!y_(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=g_[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=__.includes(t)?t:g_[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function y_(e){return e===`block`||e===`underline`||e===`bar`}function b_(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&b_(e[r],t-1);return n}var x_=Object.freeze({insertMode:!1}),S_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),C_=class extends df{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Z),this.onData=this._onData.event,this._onUserInput=this._register(new Z),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Z),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Z),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=b_(x_),this.decPrivateModes=b_(S_)}reset(){this.modes=b_(x_),this.decPrivateModes=b_(S_)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};C_=Ju([X(0,xd),X(1,Ed),X(2,Dd)],C_);var w_={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function T_(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var E_=String.fromCharCode,D_={DEFAULT:e=>{let t=[T_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${E_(t[0])}${E_(t[1])}${E_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${T_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${T_(e,!0)};${e.x};${e.y}${t}`}},O_=class extends df{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Z),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(w_))this.addProtocol(e,w_[e]);for(let e of Object.keys(D_))this.addEncoding(e,D_[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};O_=Ju([X(0,xd),X(1,Cd),X(2,Dd)],O_);var k_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],A_=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],j_;function M_(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var N_=class{constructor(){if(this.version=`6`,!j_){j_=new Uint8Array(65536),j_.fill(1),j_[0]=0,j_.fill(0,1,32),j_.fill(0,127,160),j_.fill(2,4352,4448),j_[9001]=2,j_[9002]=2,j_.fill(2,11904,42192),j_[12351]=1,j_.fill(2,44032,55204),j_.fill(2,63744,64256),j_.fill(2,65040,65050),j_.fill(2,65072,65136),j_.fill(2,65280,65377),j_.fill(2,65504,65511);for(let e=0;e<k_.length;++e)j_.fill(0,k_[e][0],k_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?j_[e]:M_(e,A_)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=P_.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return P_.createPropertyValue(0,n,r)}},P_=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Z,this.onChange=this._onChange.event;let e=new N_;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},F_=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function I_(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var L_=2147483647,R_=256,z_=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>R_)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>L_?L_:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>L_?L_:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,L_):e}},B_=[],V_=class{constructor(){this._state=0,this._active=B_,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=B_}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=B_,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||B_,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,sd(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3){if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=B_,this._id=-1,this._state=0}}},H_=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=sd(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},U_=[],W_=class{constructor(){this._handlers=Object.create(null),this._active=U_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=U_}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=U_,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||U_,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,sd(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=U_,this._ident=0}},G_=new z_;G_.addParam(0);var K_=class{constructor(e){this._handler=e,this._data=``,this._params=G_,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():G_,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=sd(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=G_,this._data=``,this._hitLimit=!1,e));return this._params=G_,this._data=``,this._hitLimit=!1,t}},q_=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},J_=160,Y_=function(){let e=new q_(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(J_,0,2,0),e.add(J_,8,5,8),e.add(J_,6,0,6),e.add(J_,11,0,11),e.add(J_,13,13,13),e}(),X_=class extends df{constructor(e=Y_){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new z_,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(cf(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new V_),this._dcsParser=this._register(new W_),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:J_)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<J_){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<J_){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<J_){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<J_){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<J_){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<J_){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},Z_=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,Q_=/^[\da-f]+$/;function $_(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=Z_.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),Q_.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function ev(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function tv(e,t=16){let[n,r,i]=e;return`rgb:${ev(n,t)}/${ev(r,t)}/${ev(i,t)}`}var nv={"(":0,")":1,"*":2,"+":3,"-":1,".":2},rv=131072,iv=10;function av(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var ov=5e3,sv=0,cv=class extends df{constructor(e,t,n,r,i,a,o,s,c=new X_){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new cd,this._utf8Decoder=new ld,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Zg.clone(),this._eraseAttrDataInternal=Zg.clone(),this._onRequestBell=this._register(new Z),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Z),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Z),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Z),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Z),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Z),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Z),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Z),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Z),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Z),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Z),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Z),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Z),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new lv(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Q.BEL,()=>this.bell()),this._parser.setExecuteHandler(Q.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Q.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Q.BS,()=>this.backspace()),this._parser.setExecuteHandler(Q.HT,()=>this.tab()),this._parser.setExecuteHandler(Q.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Q.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Qm.IND,()=>this.index()),this._parser.setExecuteHandler(Qm.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Qm.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new H_(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new H_(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new H_(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new H_(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new H_(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new H_(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new H_(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new H_(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new H_(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new H_(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new H_(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new H_(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in c_)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new K_((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),ov))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${ov} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>rv&&(a=this._parseStack.position+rv)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<rv&&(this._parseBuffer=new Uint32Array(Math.min(e.length,rv))),o||this._dirtyRowTracker.clearRange(),e.length>rv)for(let t=a;t<e.length;t+=rv){let a=t+rv<e.length?t+rv:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=P_.extractWidth(t);let n=P_.extractShouldJoin(t),m=n?P_.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(od(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof e_&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!av(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new K_(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new H_(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Zg));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=P_.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Q.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Q.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Q.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Q.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Q.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,l_),this._charsetService.setgCharset(1,l_),this._charsetService.setgCharset(2,l_),this._charsetService.setgCharset(3,l_);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Q.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=fd.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Zg.fg,e.bg=Zg.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Zg.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Zg.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Zg.fg&16777215,r.bg&=-67108864,r.bg|=Zg.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Q.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Q.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Zg.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!av(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Q.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>iv&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>iv&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(uv(n)){if(r===`?`)t.push({type:0,index:n});else{let e=$_(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=$_(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);uv(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,l_),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(nv[e[0]],c_[e[1]]||l_),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Zg.clone(),this._eraseAttrDataInternal=Zg.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new md;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Q.ESC}${e}${Q.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},lv=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(sv=e,e=t,t=sv),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};lv=Ju([X(0,xd)],lv);function uv(e){return 0<=e&&e<256}var dv=5e7,fv=12,pv=50,mv=class extends df{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Z),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>dv)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=fv?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=fv)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>pv&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},hv=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};hv=Ju([X(0,xd)],hv);var gv=!1,_v=class extends df{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ff),this._onBinary=this._register(new Z),this.onBinary=this._onBinary.event,this._onData=this._register(new Z),this.onData=this._onData.event,this._onLineFeed=this._register(new Z),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Z),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Z),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Z),this._instantiationService=new Wg,this.optionsService=this._register(new v_(e)),this._instantiationService.setService(Dd,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(h_)),this._instantiationService.setService(xd,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(qg)),this._instantiationService.setService(Ed,this._logService),this.coreService=this._register(this._instantiationService.createInstance(C_)),this._instantiationService.setService(Cd,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(O_)),this._instantiationService.setService(Sd,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(P_)),this._instantiationService.setService(kd,this.unicodeService),this._charsetService=this._instantiationService.createInstance(F_),this._instantiationService.setService(wd,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(hv),this._instantiationService.setService(Od,this._oscLinkService),this._inputHandler=this._register(new cv(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(yf.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(yf.forward(this._bufferService.onResize,this._onResize)),this._register(yf.forward(this.coreService.onData,this._onData)),this._register(yf.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new mv((e,t)=>this._inputHandler.parse(e,t))),this._register(yf.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Z),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!gv&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),gv=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,p_),t=Math.max(t,m_),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(I_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(I_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=cf(()=>{for(let t of e)t.dispose()})}}},vv={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function yv(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?Q.ESC+`OA`:Q.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?Q.ESC+`OD`:Q.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?Q.ESC+`OC`:Q.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?Q.ESC+`OB`:Q.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Q.DEL,e.altKey&&(i.key=Q.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Q.ESC+`[Z`;break}i.key=Q.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Q.ESC+Q.CR:Q.CR,i.cancel=!0;break;case 27:i.key=Q.ESC,e.altKey&&(i.key=Q.ESC+Q.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`D`:t?Q.ESC+`OD`:Q.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`C`:t?Q.ESC+`OC`:Q.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`A`:t?Q.ESC+`OA`:Q.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?Q.ESC+`[1;`+(a+1)+`B`:t?Q.ESC+`OB`:Q.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Q.ESC+`[2~`);break;case 46:i.key=a?Q.ESC+`[3;`+(a+1)+`~`:Q.ESC+`[3~`;break;case 36:i.key=a?Q.ESC+`[1;`+(a+1)+`H`:t?Q.ESC+`OH`:Q.ESC+`[H`;break;case 35:i.key=a?Q.ESC+`[1;`+(a+1)+`F`:t?Q.ESC+`OF`:Q.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?Q.ESC+`[5;`+(a+1)+`~`:Q.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?Q.ESC+`[6;`+(a+1)+`~`:Q.ESC+`[6~`;break;case 112:i.key=a?Q.ESC+`[1;`+(a+1)+`P`:Q.ESC+`OP`;break;case 113:i.key=a?Q.ESC+`[1;`+(a+1)+`Q`:Q.ESC+`OQ`;break;case 114:i.key=a?Q.ESC+`[1;`+(a+1)+`R`:Q.ESC+`OR`;break;case 115:i.key=a?Q.ESC+`[1;`+(a+1)+`S`:Q.ESC+`OS`;break;case 116:i.key=a?Q.ESC+`[15;`+(a+1)+`~`:Q.ESC+`[15~`;break;case 117:i.key=a?Q.ESC+`[17;`+(a+1)+`~`:Q.ESC+`[17~`;break;case 118:i.key=a?Q.ESC+`[18;`+(a+1)+`~`:Q.ESC+`[18~`;break;case 119:i.key=a?Q.ESC+`[19;`+(a+1)+`~`:Q.ESC+`[19~`;break;case 120:i.key=a?Q.ESC+`[20;`+(a+1)+`~`:Q.ESC+`[20~`;break;case 121:i.key=a?Q.ESC+`[21;`+(a+1)+`~`:Q.ESC+`[21~`;break;case 122:i.key=a?Q.ESC+`[23;`+(a+1)+`~`:Q.ESC+`[23~`;break;case 123:i.key=a?Q.ESC+`[24;`+(a+1)+`~`:Q.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Q.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Q.DEL:e.keyCode===219?i.key=Q.ESC:e.keyCode===220?i.key=Q.FS:e.keyCode===221&&(i.key=Q.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=vv[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Q.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Q.ESC+n}else if(e.keyCode===32)i.key=Q.ESC+(e.ctrlKey?Q.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Q.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Q.US),e.key===`@`&&(i.key=Q.NUL))}return i}var bv=0,xv=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new sg,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new sg,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(bv=this._search(t),bv===-1)||this._getKey(this._array[bv])!==t)return!1;do if(this._array[bv]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(bv),!0;while(++bv<this._array.length&&this._getKey(this._array[bv])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(bv=this._search(e),!(bv<0||bv>=this._array.length)&&this._getKey(this._array[bv])===e))do yield this._array[bv];while(++bv<this._array.length&&this._getKey(this._array[bv])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(bv=this._search(e),!(bv<0||bv>=this._array.length)&&this._getKey(this._array[bv])===e))do t(this._array[bv]);while(++bv<this._array.length&&this._getKey(this._array[bv])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Sv=0,Cv=0,wv=class extends df{constructor(){super(),this._decorations=new xv(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Z),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Z),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(cf(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Tv(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{Sv=t.options.x??0,Cv=Sv+(t.options.width??1),e>=Sv&&e<Cv&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},Tv=class extends uf{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Z),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Z),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?ch.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?ch.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Ev=1e3,Dv=class{constructor(e,t=Ev){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Ov=20,kv=class extends df{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Dv(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
21
+ `))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(tm(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(cf(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<Ov+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
22
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Ov+1&&(this._liveRegion.textContent+=Qu.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};kv=Ju([X(1,Td),X(2,Pd),X(3,Id)],kv);var Av=class extends df{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Z),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Z),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(cf(()=>{of(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(tm(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(tm(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(tm(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(tm(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&jv(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,of(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Av=Ju([X(1,Fd),X(2,Id),X(3,xd),X(4,Bd)],Av);function jv(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Mv=class extends _v{constructor(e={}){super(e),this._linkifier=this._register(new ff),this.browser=Wh,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ff),this._onCursorMove=this._register(new Z),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Z),this.onKey=this._onKey.event,this._onRender=this._register(new Z),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Z),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Z),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Z),this.onBell=this._onBell.event,this._onFocus=this._register(new Z),this._onBlur=this._register(new Z),this._onA11yCharEmitter=this._register(new Z),this._onA11yTabEmitter=this._register(new Z),this._onWillOpen=this._register(new Z),this._setup(),this._decorationService=this._instantiationService.createInstance(wv),this._instantiationService.setService(Ad,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(zh),this._instantiationService.setService(Bd,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(jd)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(yf.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(yf.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(yf.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(yf.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(cf(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=sh.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Q.ESC}]${n};${tv(r)}${$m.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=oh.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=oh.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(kv,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(tm(this.element,`copy`,e=>{this.hasSelection()&&td(e,this._selectionService)}));let e=e=>nd(e,this.textarea,this.coreService,this.optionsService);this._register(tm(this.textarea,`paste`,e)),this._register(tm(this.element,`paste`,e)),Jh?this._register(tm(this.element,`mousedown`,e=>{e.button===2&&ad(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(tm(this.element,`contextmenu`,e=>{ad(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),ng&&this._register(tm(this.element,`auxclick`,e=>{e.button===1&&id(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(tm(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(tm(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(tm(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(tm(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(tm(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(tm(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(tm(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(tm(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,Xu.get()),rg||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Lh,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(Pd,this._coreBrowserService),this._register(tm(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(tm(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Nh,this._document,this._helperContainer),this._instantiationService.setService(Nd,this._charSizeService),this._themeService=this._instantiationService.createInstance(Vg),this._instantiationService.setService(zd,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(mh),this._instantiationService.setService(Rd,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(lg,this.rows,this.screenElement)),this._instantiationService.setService(Id,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(eh,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Hh),this._instantiationService.setService(Fd,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Av,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Gm,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(jg,this.element,this.screenElement,r)),this._instantiationService.setService(Ld,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(yf.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Km,this.screenElement)),this._register(tm(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(kv,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Zm,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Zm,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Mh,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(tm(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(tm(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Q.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){rd(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=yv(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Q.ETX||n.key===Q.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Nv(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Zg));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(Q.ESC+`[I`):this.coreService.triggerDataEvent(Q.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}};function Nv(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Pv=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Fv=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new md)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Iv=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new Fv(t)}getNullCell(){return new md}},Lv=class extends df{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Z),this.onBufferChange=this._onBufferChange.event,this._normal=new Iv(this._core.buffers.normal,`normal`),this._alternate=new Iv(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},Rv=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},zv=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Bv=[`cols`,`rows`],Vv=0,Hv=class extends df{constructor(e){super(),this._core=this._register(new Mv(e)),this._addonManager=this._register(new Pv),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(Bv.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new Rv(this._core),this._parser}get unicode(){return this._checkProposedApi(),new zv(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new Lv(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
23
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Xu.get()},set promptLabel(e){Xu.set(e)},get tooMuchOutput(){return Qu.get()},set tooMuchOutput(e){Qu.set(e)}}}_verifyIntegers(...e){for(Vv of e)if(Vv===1/0||isNaN(Vv)||Vv%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Vv of e)if(Vv&&(Vv===1/0||isNaN(Vv)||Vv%1!=0||Vv<0))throw Error(`This API only accepts positive integers`)}},Uv=2,Wv=1,Gv=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Uv,Math.floor(u/e.css.cell.width)),rows:Math.max(Wv,Math.floor(l/e.css.cell.height))}}},Kv={key:0,class:`pty-context-bar`},qv=Ke(R({__name:`PtyContextBar`,setup(e){let{attachedContexts:t,removeAttachedContext:r}=sn();return(e,i)=>n(t).length>0?(z(),j(`div`,Kv,[(z(!0),j(V,null,M(n(t),(e,t)=>(z(),W(Ru,{key:t,icon:e.icon,label:e.label,text:e.text,removable:``,onRemove:e=>n(r)(t)},null,8,[`icon`,`label`,`text`,`onRemove`]))),128))])):K(``,!0)}}),[[`__scopeId`,`data-v-cfcb3a01`]]);function Jv(e,t){let n=e.textarea;if(!n)return()=>{};let r=!1,i=!1,a=e=>{r=e.keyCode===229||e.key===`Process`},o=()=>{i=!0},s=()=>{setTimeout(()=>{i=!1},0)},c=e=>{let a=e;r&&!i&&a.inputType===`insertText`&&a.data&&!a.isComposing?(r=!1,n.value=``,t(a.data)):a.inputType===`insertText`&&(r=!1)};return n.addEventListener(`keydown`,a,!0),n.addEventListener(`compositionstart`,o,!0),n.addEventListener(`compositionend`,s,!0),n.addEventListener(`input`,c,!0),()=>{n.removeEventListener(`keydown`,a,!0),n.removeEventListener(`compositionstart`,o,!0),n.removeEventListener(`compositionend`,s,!0),n.removeEventListener(`input`,c,!0)}}var Yv=[`#2e3436`,`#cc0000`,`#4e9a06`,`#c4a000`,`#3465a4`,`#75507b`,`#06989a`,`#d3d7cf`,`#555753`,`#ef2929`,`#8ae234`,`#fce94f`,`#729fcf`,`#ad7fa8`,`#34e2e2`,`#eeeeec`],Xv=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`];function Zv(e){return e.toString(16).padStart(2,`0`)}function Qv(e,t={}){if(e<16)return t[Xv[e]]??Yv[e];if(e<232){let t=[0,95,135,175,215,255],n=e-16;return`#${Zv(t[Math.floor(n/36)])}${Zv(t[Math.floor(n/6)%6])}${Zv(t[n%6])}`}let n=8+(e-232)*10;return`#${Zv(n)}${Zv(n)}${Zv(n)}`}function $v(e,t,n,r){let i=e===`fg`;if(i?t.isFgDefault():t.isBgDefault())return null;let a=i?t.getFgColor():t.getBgColor();return(i?t.isFgRGB():t.isBgRGB())?`#${a.toString(16).padStart(6,`0`)}`:Qv(i&&r&&a<8?a+8:a,n)}function ey(e,t){let n=e.isBold()!==0,r=$v(`fg`,e,t,n),i=$v(`bg`,e,t,!1);e.isInverse()&&([r,i]=[i??t.background??`#000`,r??t.foreground??`#fff`]);let a=[];r&&a.push(`color:${r}`),i&&a.push(`background:${i}`),n&&a.push(`font-weight:bold`),e.isItalic()&&a.push(`font-style:italic`),e.isDim()&&a.push(`opacity:0.5`);let o=[e.isUnderline()?`underline`:``,e.isStrikethrough()?`line-through`:``,e.isOverline()?`overline`:``].filter(Boolean);return o.length&&a.push(`text-decoration:${o.join(` `)}`),e.isInvisible()&&a.push(`visibility:hidden`),a.join(`;`)}function ty(e,t,n,r){let i=[],a=r;for(let r=0;r<t&&(a=e.getCell(r,a),a);r+=1){if(a.getWidth()===0)continue;let e=a.getChars()||` `,t=ey(a,n),r=i[i.length-1];r&&r.style===t?r.text+=e:i.push({text:e,style:t})}for(;i.length;){let e=i[i.length-1];if(e.style.includes(`background`)||e.style.includes(`text-decoration`)||(e.text=e.text.trimEnd(),e.text))break;i.pop()}return i}function ny(e,t,n,r,i){let a=(t.querySelector(`.xterm-screen`)??t).getBoundingClientRect(),o=t.getBoundingClientRect(),s=a.height/(e.rows||24),c=document.createElement(`div`);c.className=`terminal-native-selection`,c.contentEditable=`true`,c.spellcheck=!1,c.setAttribute(`inputmode`,`none`),c.setAttribute(`autocapitalize`,`off`),c.setAttribute(`autocorrect`,`off`),c.setAttribute(`aria-label`,xe.global.t(`terminal.nativeSelection`)),Object.assign(c.style,{position:`absolute`,left:`${a.left-o.left}px`,top:`${a.top-o.top}px`,width:`${a.width}px`,height:`${a.height}px`,zIndex:`6`,margin:`0`,overflowX:`hidden`,overflowY:`auto`,overscrollBehavior:`contain`,whiteSpace:`pre`,outline:`none`,caretColor:`transparent`,fontFamily:e.options.fontFamily??`monospace`,fontSize:`${e.options.fontSize??14}px`,lineHeight:`${s}px`,background:e.options.theme?.background??`#000`,color:e.options.theme?.foreground??`#fff`,userSelect:`text`,webkitUserSelect:`text`,touchAction:`auto`});let l=e.options.theme??{},u=e.buffer.active,d=u.getNullCell();for(let t=0;t<u.length;t+=1){let n=document.createElement(`div`),r=u.getLine(t),i=r?ty(r,e.cols,l,d):[];for(let e of i){let t=document.createElement(`span`);t.textContent=e.text,e.style&&(t.style.cssText=e.style),n.appendChild(t)}i.length||(n.textContent=`\xA0`),c.appendChild(n)}let f=document.createElement(`button`);f.type=`button`,f.textContent=xe.global.t(`terminal.closeSelection`),Object.assign(f.style,{position:`absolute`,top:`8px`,right:`8px`,zIndex:`7`,padding:`6px 12px`,border:`0`,borderRadius:`6px`,font:`inherit`,fontSize:`14px`,background:`var(--r-primary)`,color:`var(--r-primary-contrast)`});let p=e=>e.stopPropagation(),m=e=>e.preventDefault(),h=t=>{t.preventDefault();let n=t.clipboardData?.getData(`text/plain`);y(),n&&(e.paste(n),e.focus())},g=()=>{setTimeout(y,0)},_=e=>{e.key===`Escape`&&y()},v=!1;function y(){v||(v=!0,c.remove(),f.remove(),i())}return c.addEventListener(`touchstart`,p,{passive:!0}),c.addEventListener(`touchmove`,p,{passive:!0}),c.addEventListener(`touchend`,p,{passive:!0}),c.addEventListener(`beforeinput`,m),c.addEventListener(`paste`,h),c.addEventListener(`copy`,g),c.addEventListener(`keydown`,_),f.addEventListener(`touchstart`,p,{passive:!0}),f.addEventListener(`click`,e=>{e.preventDefault(),y()}),getComputedStyle(t).position===`static`&&(t.style.position=`relative`),t.appendChild(c),t.appendChild(f),c.scrollTop=e.buffer.active.viewportY*s,c.focus({preventScroll:!0}),ry(c,n,r),y}function ry(e,t,n){let r=window.getSelection(),i=document.caretRangeFromPoint?.(t,n);if(!r||!i||!e.contains(i.startContainer))return;r.removeAllRanges(),r.addRange(i);let a=r;a.modify&&(a.modify(`move`,`backward`,`word`),a.modify(`extend`,`forward`,`word`))}var iy=450;function ay(e,t){let n=null,r=0,i=0,a=`none`,o=0,s=0,c=0,l=null,u=null,d=!1,f=null;function p(){u!==null&&(clearTimeout(u),u=null)}let m=()=>{let n=e.rows||24,r=t.querySelector(`.xterm-viewport`)?.clientHeight??t.clientHeight;return r>0?r/n:17},h=1,g=1;function _(n,r){let i=t.querySelector(`.xterm-screen`);if(!i)return;let a=i.getBoundingClientRect();if(a.width<=0||a.height<=0)return;let o=Math.floor((n-a.left)/a.width*e.cols)+1,s=Math.floor((r-a.top)/a.height*e.rows)+1;h=Math.min(Math.max(o,1),e.cols),g=Math.min(Math.max(s,1),e.rows)}function v(t){let n=t>0,r=Math.min(Math.abs(t),12),i=e.modes.mouseTrackingMode===`none`?`\x1b${e.modes.applicationCursorKeysMode?`O`:`[`}${n?`B`:`A`}`:`\x1b[<${n?65:64};${h};${g}M`;for(let t=0;t<r;t+=1)e.input(i,!0)}function y(){l!==null&&(cancelAnimationFrame(l),l=null)}function b(){if(e.buffer.active.type===`alternate`||Math.abs(s)<.004)return;let t=performance.now(),n=r=>{let i=r-t;t=r,o+=s*i;let a=Math.trunc(o);a!==0&&(o-=a,e.scrollLines(a)),s*=Math.exp(-.005*i),l=Math.abs(s)<.002?null:requestAnimationFrame(n)};l=requestAnimationFrame(n)}let x=l=>{if(y(),p(),d=!1,l.touches.length!==1){n=null;return}n=l.touches[0].clientY,r=l.touches[0].clientX,_(r,n),i=n,a=`none`,o=0,s=0,c=performance.now();let m=r,h=i;u=setTimeout(()=>{u=null,!(a!==`none`||f)&&(d=!0,n=null,f=ny(e,t,m,h,()=>{f=null}),navigator.vibrate?.(10))},iy)},S=t=>{if(n===null||t.touches.length!==1)return;t.preventDefault();let l=t.touches[0].clientY;if(a===`none`){let e=Math.abs(t.touches[0].clientX-r),n=Math.abs(l-i);if(Math.max(e,n)<8)return;if(p(),e>n){a=`horizontal`;return}a=`vertical`}if(a!==`vertical`)return;let u=n-l;n=l;let d=u/m(),f=performance.now(),h=f-c;c=f,h>0&&h<100&&(s=s*.7+d/h*.3),o+=d;let g=Math.trunc(o);g!==0&&(o-=g,e.buffer.active.type===`alternate`?v(g):e.scrollLines(g))},C=e=>{if(p(),d){d=!1,e.cancelable&&e.preventDefault();return}a===`vertical`&&b(),n=null,a=`none`};t.addEventListener(`touchstart`,x,{passive:!0}),t.addEventListener(`touchmove`,S,{passive:!1}),t.addEventListener(`touchend`,C,{passive:!1}),t.addEventListener(`touchcancel`,C,{passive:!0});let w=e=>{d&&e.preventDefault()};return t.addEventListener(`contextmenu`,w),()=>{y(),p(),f?.(),t.removeEventListener(`contextmenu`,w),t.removeEventListener(`touchstart`,x),t.removeEventListener(`touchmove`,S),t.removeEventListener(`touchend`,C),t.removeEventListener(`touchcancel`,C)}}function oy(e,t){let n=e+(t>0?-1:1);return Math.min(Math.max(n,8),32)}function sy(e,t){try{let t=Number(localStorage.getItem(e));if(Number.isFinite(t)&&t>=8&&t<=32)return t}catch{}return t}function cy(e){let{terminal:t,container:n,storageKey:r,onResize:i}=e,a=e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault(),e.stopPropagation();let n=oy(t.options.fontSize??14,e.deltaY);if(n!==t.options.fontSize){t.options.fontSize=n;try{localStorage.setItem(r,String(n))}catch{}i()}};return n.addEventListener(`wheel`,a,{capture:!0,passive:!1}),()=>n.removeEventListener(`wheel`,a,{capture:!0})}function ly(e,t={}){let n=t.schedule??requestAnimationFrame,r=t.cancel??cancelAnimationFrame,i=[],a=null,o=!0;function s(){if(a!==null&&(r(a),a=null),i.length===0)return;let t=i.join(``);i=[],o?(o=!1,e.write(t,()=>e.scrollToBottom())):e.write(t)}return{write(e){i.push(e),a===null&&(a=n(s))},dispose(){a!==null&&(r(a),a=null),i=[]}}}var uy=150,dy=1.01,fy=r(!1),py=0,my=0;function hy(){let e=document.activeElement;return e?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable:!1}var gy=0,_y=null;function vy(){return typeof window>`u`?!1:window.matchMedia?.(`(pointer: coarse)`).matches?!0:(navigator.maxTouchPoints??0)>0}function yy(e){return!e.editing||e.scale>dy?{visible:!1}:{visible:Math.max(e.maxHeight-e.innerHeight,e.innerHeight-e.viewportHeight)>=uy}}function by(e=!1){let t=window.visualViewport;if(!t){fy.value=!1;return}let n=hy();(window.innerWidth!==my||e&&!n)&&(my=window.innerWidth,py=0),py=Math.max(py,window.innerHeight),fy.value=yy({innerHeight:window.innerHeight,viewportHeight:t.height,maxHeight:py,scale:t.scale,editing:n}).visible}function xy(){if(!vy()||(gy+=1,_y))return;let e=window.visualViewport;if(!e)return;let t=()=>by(!0),n=()=>by(!1);e.addEventListener(`resize`,t),e.addEventListener(`scroll`,n),window.addEventListener(`resize`,t),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),_y=()=>{e.removeEventListener(`resize`,t),e.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,t),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)},by()}function Sy(){gy=Math.max(0,gy-1),!(gy>0||!_y)&&(_y(),_y=null,fy.value=!1)}function Cy(){return N(xy),I(Sy),{keyboardVisible:c(fy)}}var wy=`\x1B`,Ty={up:`A`,down:`B`,right:`C`,left:`D`};function Ey(e,t){switch(e){case`up`:case`down`:case`left`:case`right`:return`${wy}${t?`O`:`[`}${Ty[e]}`;case`esc`:return wy;case`tab`:return` `;case`enter`:return`\r`;case`ctrl-c`:return``}}var Dy=[`aria-label`],Oy=[`title`,`aria-label`,`onPointerdown`],ky={class:`terminal-key-bar__cap`},Ay=Ke(R({__name:`TerminalKeyBar`,props:{terminal:{}},setup(e){let t=e,{t:i}=ge(),{keyboardVisible:a}=Cy(),o=vy(),s=typeof window<`u`&&(window.matchMedia?.(`(pointer: coarse)`).matches??!1),c=r(!1);function l(){let e=t.terminal?.element;c.value=e!=null&&e.contains(document.activeElement)}N(()=>{document.addEventListener(`focusin`,l),document.addEventListener(`focusout`,l),l()}),I(()=>{document.removeEventListener(`focusin`,l),document.removeEventListener(`focusout`,l)});let u=L(()=>o&&c.value&&(a.value||s)),d=L(()=>a.value);function f(e){return Ey(e,t.terminal?.modes.applicationCursorKeysMode===!0)}let p=L(()=>[{id:`up`,label:`↑`,title:i(`terminal.keyBar.up`)},{id:`down`,label:`↓`,title:i(`terminal.keyBar.down`)},{id:`left`,label:`←`,title:i(`terminal.keyBar.left`)},{id:`right`,label:`→`,title:i(`terminal.keyBar.right`)},{id:`esc`,label:`Esc`,title:i(`terminal.keyBar.escape`),wide:!0},{id:`tab`,label:`⇥`,title:i(`terminal.keyBar.tab`)},{id:`enter`,label:`⏎`,title:i(`terminal.keyBar.enter`)},{id:`ctrl-c`,label:`^C`,title:i(`terminal.keyBar.interrupt`),wide:!0}]);function m(e,n){n.preventDefault(),t.terminal?.input(f(e.id),!0),t.terminal?.focus()}return(e,t)=>(z(),W(ce,{to:`body`,disabled:!d.value},[u.value?(z(),j(`div`,{key:0,class:P([`terminal-key-bar`,{"terminal-key-bar--inline":!d.value}]),role:`toolbar`,"aria-label":n(i)(`terminal.keyBar.label`)},[(z(!0),j(V,null,M(p.value,e=>(z(),j(`button`,{key:e.id,type:`button`,class:P([`terminal-key-bar__key`,{"terminal-key-bar__key--wide":e.wide}]),title:e.title,"aria-label":e.title,onPointerdown:t=>m(e,t)},[A(`kbd`,ky,U(e.label),1)],42,Oy))),128))],10,Dy)):K(``,!0)],8,[`disabled`]))}}),[[`__scopeId`,`data-v-3b0a8150`]]),jy={key:0,class:`claude-terminal__error`},My=`runeya:ai-terminal-font-size`,Ny=Ke(R({__name:`ClaudeTerminal`,props:{sessionId:{},resume:{type:Boolean},model:{},cwd:{},agentId:{},runner:{},attachSpawnId:{}},setup(e){let t=e,n=r(null),i=r(!1),a=r(null),s=null,c=o(null),l=null,u=null,d=null,f=null,p=null,m=null,h=null,g=null,_=null,v=null,x=null,C=-1,w=!1,T=null;function E(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`FileReader error`)),r.onload=()=>{let e=r.result,n=e.indexOf(`,`);t(n>=0?e.slice(n+1):e)},r.readAsDataURL(e)})}async function D(e,t){if(p&&f)try{let n=await E(e),r=await J.chat.pty.pasteImage.mutate({agentId:p,sessionId:t,mimeType:e.type||`image/png`,base64:n});r.clipboardMethod?await J.chat.pty.write.mutate({agentId:p,spawnId:f,data:``}):await J.chat.pty.write.mutate({agentId:p,spawnId:f,data:`@${r.tmpPath} `})}catch(e){console.error(`[ClaudeTerminal] image paste failed:`,e)}}let{attachedContexts:ee,clearAttachedContexts:O,contextServiceId:k,pendingDiffContext:M,pendingContext:F,pendingPopulateContext:L,autoSendPending:te,setDiffContext:ne}=sn(),R=pn(),B=Dt(),V=ye();function re(){let e=[];if(k.value){let t=R.getById(k.value);t&&e.push({label:`Service: ${t.name}`,icon:`ti-server`,text:`Service attached: ${t.name}\nID: ${t.id}\nCommands: ${t.commands.map(e=>e.command).join(` ; `)||`(none)`}\nCwd: ${t.cwd??`(none)`}`})}M.value&&e.push({label:`Diff`,icon:`ti-code`,text:M.value}),F.value&&e.push(F.value);for(let t of ee.value)e.push(t);return e}function H(){l?.fit(),p&&f&&s&&J.chat.pty.resize.mutate({agentId:p,spawnId:f,cols:s.cols,rows:s.rows}).catch(()=>{})}async function ie(){if(!n.value)return;if(await oe(),a.value=null,s=new Hv({cursorBlink:!0,fontFamily:`monospace`,fontSize:sy(My,13),theme:{background:`#1a1b1e`,foreground:`#d4d4d4`,cursor:`#d4d4d4`},allowProposedApi:!1}),l=new Gv,s.loadAddon(l),s.open(n.value),c.value=s,x=ly(s),_=ay(s,n.value),v=cy({terminal:s,container:n.value,storageKey:My,onResize:()=>H()}),s.attachCustomKeyEventHandler(e=>{if(e.type!==`keydown`||e.altKey||!(e.ctrlKey||e.metaKey))return!0;let t=e.key.toLowerCase();if(t===`v`)return!1;if(e.shiftKey&&t===`c`){e.preventDefault();let t=s?.getSelection();return t&&navigator.clipboard.writeText(t).catch(()=>{}),!1}return!0}),await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(()=>e()))),l.fit(),t.attachSpawnId&&t.agentId)f=t.attachSpawnId,p=t.agentId;else try{let e=re().map(e=>({label:e.label,text:e.text})),n=te.value&&L.value?L.value:void 0,r=await J.chat.pty.start.mutate({agentId:t.agentId,sessionId:t.sessionId,runner:t.runner??`claude-code`,resume:t.resume??!1,model:t.model,cwd:t.cwd,...V.activeProjectId?{projectId:V.activeProjectId,orgId:V.activeOrgId}:{},cols:s.cols,rows:s.rows,enableMcp:!0,environmentId:B.currentProject?.activeEnvironmentId,attachedContexts:e.length>0?e:void 0,initialPrompt:n});f=r.spawnId,p=r.agentId,!r.reattached&&n&&(te.value=!1,L.value=null),e.length>0&&(O(),ne(null),F.value=null)}catch(e){w=!0,a.value=e.message,s.dispose(),s=null,c.value=null;return}d=J.chat.pty.stream.subscribe({agentId:p,spawnId:f,fromOffset:0},{onData(e){if(e.offset<=C)return;C=e.offset;let{chunk:n}=e;n.type===`pty-data`?x?.write(n.data):n.type===`exit`&&x?.write(`\r\n\x1b[90m[${t.runner===`codex`?`codex`:`claude`} exited with code ${n.code??0}]\x1b[0m\r\n`)},onError(e){w=!0,a.value=e.message}});let e=e=>{p&&f&&J.chat.pty.write.mutate({agentId:p,spawnId:f,data:e}).catch(()=>{})};s.onData(e),g=Jv(s,e),u=new ResizeObserver(()=>H()),u.observe(n.value),h=s.textarea??null,h&&(m=e=>{let n=e.clipboardData?.items;if(n){for(let r of n)if(r.kind===`file`&&r.type.startsWith(`image/`)){let n=r.getAsFile();if(n){e.preventDefault(),e.stopPropagation(),D(n,t.sessionId);return}}}},h.addEventListener(`paste`,m,!0)),i.value=!0,requestAnimationFrame(()=>{requestAnimationFrame(()=>s?.focus())})}function ae(){s?.focus()}async function oe(){u?.disconnect(),u=null,g?.(),g=null,_?.(),_=null,v?.(),v=null,x?.dispose(),x=null,h&&m&&h.removeEventListener(`paste`,m,!0),h=null,m=null,d?.unsubscribe(),d=null,C=-1,w=!1,p=null,f=null,s?.dispose(),s=null,c.value=null,l=null,i.value=!1}return S(()=>[t.sessionId,t.resume,t.model,t.cwd,t.agentId,t.runner],()=>{ie()}),N(()=>{ie(),T=_t(()=>{a.value=null,w&&ie()})}),I(()=>{T?.(),T=null,oe()}),(e,t)=>(z(),j(`div`,{class:`claude-terminal`,onClick:ae},[y(qv),y(Ay,{terminal:c.value},null,8,[`terminal`]),a.value?(z(),j(`div`,jy,[t[0]||=A(`i`,{class:`ti ti-alert-triangle`},null,-1),b(` `+U(a.value),1)])):K(``,!0),A(`div`,{ref_key:`terminalEl`,ref:n,class:P([`claude-terminal__xterm`,{"claude-terminal__xterm--hidden":!i.value}])},null,2)]))}}),[[`__scopeId`,`data-v-f2640e3e`]]),Py={class:`secret-env__intro`},Fy={key:0,class:`secret-env__empty`},Iy={key:1,class:`secret-env__empty`},Ly={class:`secret-env__fields`},Ry={key:0,class:`secret-env__error`},zy=Ke(R({__name:`ConversationSecretEnvDialog`,props:g({conversationId:{}},{visible:{type:Boolean,required:!0},visibleModifiers:{}}),emits:g([`saved`],[`update:visible`]),setup(e,{emit:t}){let i=e,a=x(e,`visible`),o=t,{t:s}=ge(),c=Fe(),l=r([]),u=r(!1),d=r(!1),f=r(!1),p=/^[A-Za-z_][A-Za-z0-9_]*$/;async function m(){u.value=!0,d.value=!1;try{let e=await J.chat.conversations.secretEnvKeys.query({id:i.conversationId});l.value=e.map(e=>({key:e,value:``,stored:!0})),d.value=!0}catch(e){c.add({severity:`error`,summary:s(`aiChat.secretEnv.loadFailed`),detail:e.message,life:4e3}),l.value=[]}finally{u.value=!1}}S(a,e=>{e&&m()});function h(){l.value=[...l.value,{key:``,value:``,stored:!1}]}function g(e){l.value=l.value.filter((t,n)=>n!==e)}function _(e,t){return p.test(e.key)?l.value.findIndex(t=>t.key===e.key)===t?!e.stored&&e.value===``?s(`aiChat.secretEnv.missingValue`):null:s(`aiChat.secretEnv.duplicateName`):s(`aiChat.secretEnv.invalidName`)}let v=()=>l.value.some((e,t)=>_(e,t)!==null);async function C(){if(d.value&&!v()){f.value=!0;try{await J.chat.conversations.setSecretEnv.mutate({id:i.conversationId,entries:l.value.map(e=>({key:e.key,...e.value===``?{}:{value:e.value}}))}),c.add({severity:`success`,summary:s(`aiChat.secretEnv.saved`),life:3e3}),a.value=!1,o(`saved`)}catch(e){c.add({severity:`error`,summary:s(`aiChat.secretEnv.saveFailed`),detail:e.message,life:5e3})}finally{f.value=!1}}}return(e,t)=>(z(),W(n(Ve),{visible:a.value,"onUpdate:visible":t[1]||=e=>a.value=e,modal:``,header:n(s)(`aiChat.secretEnv.title`),style:{width:`640px`,maxWidth:`95vw`}},{footer:H(()=>[y(n(q),{variant:`text`,label:n(s)(`actions.cancel`),onClick:t[0]||=e=>a.value=!1},null,8,[`label`]),y(n(q),{label:n(s)(`aiChat.secretEnv.save`),loading:f.value,disabled:f.value||!d.value||v(),onClick:C},null,8,[`label`,`loading`,`disabled`])]),default:H(()=>[A(`p`,Py,U(n(s)(`aiChat.secretEnv.intro`)),1),y(n(ze),{severity:`warn`,class:`secret-env__warn`},{default:H(()=>[b(U(n(s)(`aiChat.secretEnv.restartNotice`)),1)]),_:1}),u.value?(z(),j(`div`,Fy,U(n(s)(`aiChat.secretEnv.loading`)),1)):l.value.length===0?(z(),j(`div`,Iy,U(n(s)(`aiChat.secretEnv.empty`)),1)):K(``,!0),(z(!0),j(V,null,M(l.value,(e,t)=>(z(),j(`div`,{key:t,class:`secret-env__row`},[A(`div`,Ly,[y(n(je),{modelValue:e.key,"onUpdate:modelValue":t=>e.key=t,class:`secret-env__key`,placeholder:n(s)(`aiChat.secretEnv.namePlaceholder`),"aria-label":n(s)(`aiChat.secretEnv.name`),disabled:e.stored,spellcheck:`false`,autocomplete:`off`},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`,`aria-label`,`disabled`]),y(n(ot),{modelValue:e.value,"onUpdate:modelValue":t=>e.value=t,class:`secret-env__value`,feedback:!1,"toggle-mask":``,autocomplete:`new-password`,placeholder:e.stored?n(s)(`aiChat.secretEnv.storedPlaceholder`):n(s)(`aiChat.secretEnv.valuePlaceholder`),"aria-label":n(s)(`aiChat.secretEnv.value`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`,`aria-label`]),y(n(q),{size:`small`,variant:`text`,icon:`ti ti-trash`,title:n(s)(`aiChat.secretEnv.remove`),"aria-label":n(s)(`aiChat.secretEnv.remove`),onClick:e=>g(t)},null,8,[`title`,`aria-label`,`onClick`])]),_(e,t)&&(e.key!==``||e.value!==``)?(z(),j(`small`,Ry,U(_(e,t)),1)):K(``,!0)]))),128)),y(n(q),{size:`small`,variant:`outlined`,disabled:!d.value,icon:`ti ti-plus`,label:n(s)(`aiChat.secretEnv.add`),onClick:h},null,8,[`disabled`,`label`])]),_:1},8,[`visible`,`header`]))}}),[[`__scopeId`,`data-v-ccb5fce5`]]);function By(e){return f()?(l(e),!0):!1}function Vy(e){return typeof e==`function`?e():n(e)}var Hy=typeof window<`u`&&typeof document<`u`,Uy=e=>e!==void 0,Wy=Object.prototype.toString,Gy=e=>Wy.call(e)===`[object Object]`,Ky=()=>{};function qy(e,t){function n(...n){return new Promise((r,i)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(r).catch(i)})}return n}var Jy=e=>e();function Yy(e=Jy){let t=r(!0);function n(){t.value=!1}function i(){t.value=!0}return{isActive:c(t),pause:n,resume:i,eventFilter:(...n)=>{t.value&&e(...n)}}}function Xy(e,t=!1,n=`Timeout`){return new Promise((r,i)=>{setTimeout(t?()=>i(n):r,e)})}function Zy(e,t,n={}){let{eventFilter:r=Jy,...i}=n;return S(e,qy(r,t),i)}function Qy(e,t,n={}){let{eventFilter:r,...i}=n,{eventFilter:a,pause:o,resume:s,isActive:c}=Yy(r);return{stop:Zy(e,t,{...i,eventFilter:a}),pause:o,resume:s,isActive:c}}function $y(e,t={}){if(!p(e))return s(e);let n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(let r in e.value)n[r]=m(()=>({get(){return e.value[r]},set(n){if(Vy(t.replaceRef)??!0){if(Array.isArray(e.value)){let t=[...e.value];t[r]=n,e.value=t}else{let t={...e.value,[r]:n};Object.setPrototypeOf(t,Object.getPrototypeOf(e.value)),e.value=t}}else e.value[r]=n}}));return n}function eb(e,t=!1){function n(n,{flush:r=`sync`,deep:i=!1,timeout:a,throwOnTimeout:o}={}){let s=null,c=[new Promise(a=>{s=S(e,e=>{n(e)!==t&&(s?.(),a(e))},{flush:r,deep:i,immediate:!0})})];return a!=null&&c.push(Xy(a,o).then(()=>Vy(e)).finally(()=>s?.())),Promise.race(c)}function r(r,i){if(!p(r))return n(e=>e===r,i);let{flush:a=`sync`,deep:o=!1,timeout:s,throwOnTimeout:c}=i??{},l=null,u=[new Promise(n=>{l=S([e,r],([e,r])=>{t!==(e===r)&&(l?.(),n(e))},{flush:a,deep:o,immediate:!0})})];return s!=null&&u.push(Xy(s,c).then(()=>Vy(e)).finally(()=>(l?.(),Vy(e)))),Promise.race(u)}function i(e){return n(e=>!!e,e)}function a(e){return r(null,e)}function o(e){return r(void 0,e)}function s(e){return n(Number.isNaN,e)}function c(e,t){return n(t=>{let n=Array.from(t);return n.includes(e)||n.includes(Vy(e))},t)}function l(e){return u(1,e)}function u(e=1,t){let r=-1;return n(()=>(r+=1,r>=e),t)}return Array.isArray(Vy(e))?{toMatch:n,toContains:c,changed:l,changedTimes:u,get not(){return eb(e,!t)}}:{toMatch:n,toBe:r,toBeTruthy:i,toBeNull:a,toBeNaN:s,toBeUndefined:o,changed:l,changedTimes:u,get not(){return eb(e,!t)}}}function tb(e){return eb(e)}function nb(e){let t=Vy(e);return t?.$el??t}var rb=Hy?window:void 0;function ib(...e){let t,n,r,i;if(typeof e[0]==`string`||Array.isArray(e[0])?([n,r,i]=e,t=rb):[t,n,r,i]=e,!t)return Ky;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);let a=[],o=()=>{a.forEach(e=>e()),a.length=0},s=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),c=S(()=>[nb(t),Vy(i)],([e,t])=>{if(o(),!e)return;let i=Gy(t)?{...t}:t;a.push(...n.flatMap(t=>r.map(n=>s(e,t,n,i))))},{immediate:!0,flush:`post`}),l=()=>{c(),o()};return By(l),l}function ab(e){return typeof e==`function`?e:typeof e==`string`?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function ob(...e){let t,n,r={};e.length===3?(t=e[0],n=e[1],r=e[2]):e.length===2?typeof e[1]==`object`?(t=!0,n=e[0],r=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);let{target:i=rb,eventName:a=`keydown`,passive:o=!1,dedupe:s=!1}=r,c=ab(t);return ib(i,a,e=>{e.repeat&&Vy(s)||c(e)&&n(e)},o)}function sb(e){return JSON.parse(JSON.stringify(e))}function cb(e,t,n,i={}){let{clone:a=!1,passive:o=!1,eventName:s,deep:c=!1,defaultValue:l,shouldEmit:u}=i,d=w(),f=n||d?.emit||(d?.$emit)?.bind(d)||(d?.proxy?.$emit)?.bind(d?.proxy),p=s;t||=`modelValue`,p||=`update:${t.toString()}`;let m=e=>a?typeof a==`function`?a(e):sb(e):e,h=()=>Uy(e[t])?m(e[t]):l,g=e=>{u?u(e)&&f(p,e):f(p,e)};if(o){let n=h(),i=r(n),a=!1;return S(()=>e[t],e=>{a||(a=!0,i.value=m(e),se(()=>a=!1))}),S(i,n=>{!a&&(n!==e[t]||c)&&g(n)},{deep:c}),i}return L({get(){return h()},set(e){g(e)}})}var lb={value:()=>{}};function ub(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new db(n)}function db(e){this._=e}function fb(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}db.prototype=ub.prototype={constructor:db,on:function(e,t){var n=this._,r=fb(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=pb(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=mb(n[i],e.name,t);else if(t==null)for(i in n)n[i]=mb(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new db(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function pb(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function mb(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=lb,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var hb=`http://www.w3.org/1999/xhtml`,gb={svg:`http://www.w3.org/2000/svg`,xhtml:hb,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function _b(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),gb.hasOwnProperty(t)?{space:gb[t],local:e}:e}function vb(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===hb&&t.documentElement.namespaceURI===hb?t.createElement(e):t.createElementNS(n,e)}}function yb(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function bb(e){var t=_b(e);return(t.local?yb:vb)(t)}function xb(){}function Sb(e){return e==null?xb:function(){return this.querySelector(e)}}function Cb(e){typeof e!=`function`&&(e=Sb(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new dS(r,this._parents)}function wb(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Tb(){return[]}function Eb(e){return e==null?Tb:function(){return this.querySelectorAll(e)}}function Db(e){return function(){return wb(e.apply(this,arguments))}}function Ob(e){e=typeof e==`function`?Db(e):Eb(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new dS(r,i)}function kb(e){return function(){return this.matches(e)}}function Ab(e){return function(t){return t.matches(e)}}var jb=Array.prototype.find;function Mb(e){return function(){return jb.call(this.children,e)}}function Nb(){return this.firstElementChild}function Pb(e){return this.select(e==null?Nb:Mb(typeof e==`function`?e:Ab(e)))}var Fb=Array.prototype.filter;function Ib(){return Array.from(this.children)}function Lb(e){return function(){return Fb.call(this.children,e)}}function Rb(e){return this.selectAll(e==null?Ib:Lb(typeof e==`function`?e:Ab(e)))}function zb(e){typeof e!=`function`&&(e=kb(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new dS(r,this._parents)}function Bb(e){return Array(e.length)}function Vb(){return new dS(this._enter||this._groups.map(Bb),this._parents)}function Hb(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Hb.prototype={constructor:Hb,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Ub(e){return function(){return e}}function Wb(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Hb(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Gb(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Hb(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Kb(e){return e.__data__}function qb(e,t){if(!arguments.length)return Array.from(this,Kb);var n=t?Gb:Wb,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Ub(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Jb(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new dS(o,r),o._enter=s,o._exit=c,o}function Jb(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Yb(){return new dS(this._exit||this._groups.map(Bb),this._parents)}function Xb(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Zb(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new dS(s,this._parents)}function Qb(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function $b(e){e||=ex;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new dS(i,this._parents).order()}function ex(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function tx(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function nx(){return Array.from(this)}function rx(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function ix(){let e=0;for(let t of this)++e;return e}function ax(){return!this.node()}function ox(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function sx(e){return function(){this.removeAttribute(e)}}function cx(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lx(e,t){return function(){this.setAttribute(e,t)}}function ux(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function dx(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function fx(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function px(e,t){var n=_b(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?cx:sx:typeof t==`function`?n.local?fx:dx:n.local?ux:lx)(n,t))}function mx(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function hx(e){return function(){this.style.removeProperty(e)}}function gx(e,t,n){return function(){this.style.setProperty(e,t,n)}}function _x(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function vx(e,t,n){return arguments.length>1?this.each((t==null?hx:typeof t==`function`?_x:gx)(e,t,n??``)):yx(this.node(),e)}function yx(e,t){return e.style.getPropertyValue(t)||mx(e).getComputedStyle(e,null).getPropertyValue(t)}function bx(e){return function(){delete this[e]}}function xx(e,t){return function(){this[e]=t}}function Sx(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Cx(e,t){return arguments.length>1?this.each((t==null?bx:typeof t==`function`?Sx:xx)(e,t)):this.node()[e]}function wx(e){return e.trim().split(/^|\s+/)}function Tx(e){return e.classList||new Ex(e)}function Ex(e){this._node=e,this._names=wx(e.getAttribute(`class`)||``)}Ex.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function Dx(e,t){for(var n=Tx(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Ox(e,t){for(var n=Tx(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function kx(e){return function(){Dx(this,e)}}function Ax(e){return function(){Ox(this,e)}}function jx(e,t){return function(){(t.apply(this,arguments)?Dx:Ox)(this,e)}}function Mx(e,t){var n=wx(e+``);if(arguments.length<2){for(var r=Tx(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?jx:t?kx:Ax)(n,t))}function Nx(){this.textContent=``}function Px(e){return function(){this.textContent=e}}function Fx(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Ix(e){return arguments.length?this.each(e==null?Nx:(typeof e==`function`?Fx:Px)(e)):this.node().textContent}function Lx(){this.innerHTML=``}function Rx(e){return function(){this.innerHTML=e}}function zx(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Bx(e){return arguments.length?this.each(e==null?Lx:(typeof e==`function`?zx:Rx)(e)):this.node().innerHTML}function Vx(){this.nextSibling&&this.parentNode.appendChild(this)}function Hx(){return this.each(Vx)}function Ux(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Wx(){return this.each(Ux)}function Gx(e){var t=typeof e==`function`?e:bb(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Kx(){return null}function qx(e,t){var n=typeof e==`function`?e:bb(e),r=t==null?Kx:typeof t==`function`?t:Sb(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Jx(){var e=this.parentNode;e&&e.removeChild(this)}function Yx(){return this.each(Jx)}function Xx(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Zx(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Qx(e){return this.select(e?Zx:Xx)}function $x(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function eS(e){return function(t){e.call(this,t,this.__data__)}}function tS(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function nS(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function rS(e,t,n){return function(){var r=this.__on,i,a=eS(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function iS(e,t,n){var r=tS(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?rS:nS,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function aS(e,t,n){var r=mx(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function oS(e,t){return function(){return aS(this,e,t)}}function sS(e,t){return function(){return aS(this,e,t.apply(this,arguments))}}function cS(e,t){return this.each((typeof t==`function`?sS:oS)(e,t))}function*lS(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var uS=[null];function dS(e,t){this._groups=e,this._parents=t}function fS(){return new dS([[document.documentElement]],uS)}function pS(){return this}dS.prototype=fS.prototype={constructor:dS,select:Cb,selectAll:Ob,selectChild:Pb,selectChildren:Rb,filter:zb,data:qb,enter:Vb,exit:Yb,join:Xb,merge:Zb,selection:pS,order:Qb,sort:$b,call:tx,nodes:nx,node:rx,size:ix,empty:ax,each:ox,attr:px,style:vx,property:Cx,classed:Mx,text:Ix,html:Bx,raise:Hx,lower:Wx,append:Gx,insert:qx,remove:Yx,clone:Qx,datum:$x,on:iS,dispatch:cS,[Symbol.iterator]:lS};function mS(e){return typeof e==`string`?new dS([[document.querySelector(e)]],[document.documentElement]):new dS([[e]],uS)}function hS(e){let t;for(;t=e.sourceEvent;)e=t;return e}function gS(e,t){if(e=hS(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var _S={passive:!1},vS={capture:!0,passive:!1};function yS(e){e.stopImmediatePropagation()}function bS(e){e.preventDefault(),e.stopImmediatePropagation()}function xS(e){var t=e.document.documentElement,n=mS(e).on(`dragstart.drag`,bS,vS);`onselectstart`in t?n.on(`selectstart.drag`,bS,vS):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function SS(e,t){var n=e.document.documentElement,r=mS(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,bS,vS),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var CS=e=>()=>e;function wS(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}wS.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function TS(e){return!e.ctrlKey&&!e.button}function ES(){return this.parentNode}function DS(e,t){return t??{x:e.x,y:e.y}}function OS(){return navigator.maxTouchPoints||`ontouchstart`in this}function kS(){var e=TS,t=ES,n=DS,r=OS,i={},a=ub(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,_S).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!u&&e.call(this,n,r)){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(mS(n.view).on(`mousemove.drag`,m,vS).on(`mouseup.drag`,h,vS),xS(n.view),yS(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(bS(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){mS(e.view).on(`mousemove.drag mouseup.drag`,null),SS(e.view,l),bS(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(yS(n),c(`start`,n,i[s]))}function _(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(bS(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(yS(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=gS(l||r,t),p,m,h;if((h=n.call(e,new wS(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=gS(l||a,t),_=o}u.call(r,e,new wS(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:CS(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:CS(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:CS(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:CS(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function AS(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function jS(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function MS(){}var NS=.7,PS=1/NS,FS=`\\s*([+-]?\\d+)\\s*`,IS=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,LS=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,RS=/^#([0-9a-f]{3,8})$/,zS=RegExp(`^rgb\\(${FS},${FS},${FS}\\)$`),BS=RegExp(`^rgb\\(${LS},${LS},${LS}\\)$`),VS=RegExp(`^rgba\\(${FS},${FS},${FS},${IS}\\)$`),HS=RegExp(`^rgba\\(${LS},${LS},${LS},${IS}\\)$`),US=RegExp(`^hsl\\(${IS},${LS},${LS}\\)$`),WS=RegExp(`^hsla\\(${IS},${LS},${LS},${IS}\\)$`),GS={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};AS(MS,XS,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:KS,formatHex:KS,formatHex8:qS,formatHsl:JS,formatRgb:YS,toString:YS});function KS(){return this.rgb().formatHex()}function qS(){return this.rgb().formatHex8()}function JS(){return lC(this).formatHsl()}function YS(){return this.rgb().formatRgb()}function XS(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=RS.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ZS(t):n===3?new tC(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?QS(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?QS(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=zS.exec(e))?new tC(t[1],t[2],t[3],1):(t=BS.exec(e))?new tC(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=VS.exec(e))?QS(t[1],t[2],t[3],t[4]):(t=HS.exec(e))?QS(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=US.exec(e))?cC(t[1],t[2]/100,t[3]/100,1):(t=WS.exec(e))?cC(t[1],t[2]/100,t[3]/100,t[4]):GS.hasOwnProperty(e)?ZS(GS[e]):e===`transparent`?new tC(NaN,NaN,NaN,0):null}function ZS(e){return new tC(e>>16&255,e>>8&255,e&255,1)}function QS(e,t,n,r){return r<=0&&(e=t=n=NaN),new tC(e,t,n,r)}function $S(e){return e instanceof MS||(e=XS(e)),e?(e=e.rgb(),new tC(e.r,e.g,e.b,e.opacity)):new tC}function eC(e,t,n,r){return arguments.length===1?$S(e):new tC(e,t,n,r??1)}function tC(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}AS(tC,eC,jS(MS,{brighter(e){return e=e==null?PS:PS**+e,new tC(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?NS:NS**+e,new tC(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new tC(oC(this.r),oC(this.g),oC(this.b),aC(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:nC,formatHex:nC,formatHex8:rC,formatRgb:iC,toString:iC}));function nC(){return`#${sC(this.r)}${sC(this.g)}${sC(this.b)}`}function rC(){return`#${sC(this.r)}${sC(this.g)}${sC(this.b)}${sC((isNaN(this.opacity)?1:this.opacity)*255)}`}function iC(){let e=aC(this.opacity);return`${e===1?`rgb(`:`rgba(`}${oC(this.r)}, ${oC(this.g)}, ${oC(this.b)}${e===1?`)`:`, ${e})`}`}function aC(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function oC(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function sC(e){return e=oC(e),(e<16?`0`:``)+e.toString(16)}function cC(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new dC(e,t,n,r)}function lC(e){if(e instanceof dC)return new dC(e.h,e.s,e.l,e.opacity);if(e instanceof MS||(e=XS(e)),!e)return new dC;if(e instanceof dC)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new dC(o,s,c,e.opacity)}function uC(e,t,n,r){return arguments.length===1?lC(e):new dC(e,t,n,r??1)}function dC(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}AS(dC,uC,jS(MS,{brighter(e){return e=e==null?PS:PS**+e,new dC(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?NS:NS**+e,new dC(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new tC(mC(e>=240?e-240:e+120,i,r),mC(e,i,r),mC(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new dC(fC(this.h),pC(this.s),pC(this.l),aC(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=aC(this.opacity);return`${e===1?`hsl(`:`hsla(`}${fC(this.h)}, ${pC(this.s)*100}%, ${pC(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function fC(e){return e=(e||0)%360,e<0?e+360:e}function pC(e){return Math.max(0,Math.min(1,e||0))}function mC(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var hC=e=>()=>e;function gC(e,t){return function(n){return e+n*t}}function _C(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function vC(e){return(e=+e)==1?yC:function(t,n){return n-t?_C(t,n,e):hC(isNaN(t)?n:t)}}function yC(e,t){var n=t-e;return n?gC(e,n):hC(isNaN(e)?t:e)}var bC=function e(t){var n=vC(t);function r(e,t){var r=n((e=eC(e)).r,(t=eC(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=yC(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r}(1);function xC(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function SC(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function CC(e,t){for(var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o=0;o<r;++o)i[o]=MC(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function wC(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function TC(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function EC(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=MC(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var DC=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,OC=new RegExp(DC.source,`g`);function kC(e){return function(){return e}}function AC(e){return function(t){return e(t)+``}}function jC(e,t){var n=DC.lastIndex=OC.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=DC.exec(e))&&(i=OC.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:TC(r,i)})),n=OC.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?AC(c[0].x):kC(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function MC(e,t){var n=typeof t,r;return t==null||n===`boolean`?hC(t):(n===`number`?TC:n===`string`?(r=XS(t))?(t=r,bC):jC:t instanceof XS?bC:t instanceof Date?wC:SC(t)?xC:Array.isArray(t)?CC:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?EC:TC)(e,t)}var NC=180/Math.PI,PC={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function FC(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*NC,skewX:Math.atan(c)*NC,scaleX:o,scaleY:s}}var IC;function LC(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?PC:FC(t.a,t.b,t.c,t.d,t.e,t.f)}function RC(e){return e==null||(IC||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),IC.setAttribute(`transform`,e),!(e=IC.transform.baseVal.consolidate()))?PC:(e=e.matrix,FC(e.a,e.b,e.c,e.d,e.e,e.f))}function zC(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:TC(e,i)},{i:c-2,x:TC(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:TC(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:TC(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:TC(e,n)},{i:s-2,x:TC(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var BC=zC(LC,`px, `,`px)`,`deg)`),VC=zC(RC,`, `,`)`,`)`),HC=1e-12;function UC(e){return((e=Math.exp(e))+1/e)/2}function WC(e){return((e=Math.exp(e))-1/e)/2}function GC(e){return((e=Math.exp(2*e))-1)/(e+1)}var KC=function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<HC)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=UC(y),c=s/(n*g)*(i*GC(t*r+y)-WC(y));return[a+c*d,o+c*f,s*i/UC(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i}(Math.SQRT2,2,4),qC=0,JC=0,YC=0,XC=1e3,ZC,QC,$C=0,ew=0,tw=0,nw=typeof performance==`object`&&performance.now?performance:Date,rw=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function iw(){return ew||=(rw(aw),nw.now()+tw)}function aw(){ew=0}function ow(){this._call=this._time=this._next=null}ow.prototype=sw.prototype={constructor:ow,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?iw():+n)+(t==null?0:+t),!this._next&&QC!==this&&(QC?QC._next=this:ZC=this,QC=this),this._call=e,this._time=n,fw()},stop:function(){this._call&&(this._call=null,this._time=1/0,fw())}};function sw(e,t,n){var r=new ow;return r.restart(e,t,n),r}function cw(){iw(),++qC;for(var e=ZC,t;e;)(t=ew-e._time)>=0&&e._call.call(void 0,t),e=e._next;--qC}function lw(){ew=($C=nw.now())+tw,qC=JC=0;try{cw()}finally{qC=0,dw(),ew=0}}function uw(){var e=nw.now(),t=e-$C;t>XC&&(tw-=t,$C=e)}function dw(){for(var e,t=ZC,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ZC=n);QC=e,fw(r)}function fw(e){qC||(JC&&=clearTimeout(JC),e-ew>24?(e<1/0&&(JC=setTimeout(lw,e-nw.now()-tw)),YC&&=clearInterval(YC)):(YC||=($C=nw.now(),setInterval(uw,XC)),qC=1,rw(lw)))}function pw(e,t,n){var r=new ow;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var mw=ub(`start`,`end`,`cancel`,`interrupt`),hw=[],gw=0,_w=1,vw=2,yw=3,bw=4,xw=5,Sw=6;function Cw(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Dw(e,n,{name:t,index:r,group:i,on:mw,tween:hw,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:gw})}function ww(e,t){var n=Ew(e,t);if(n.state>gw)throw Error(`too late; already scheduled`);return n}function Tw(e,t){var n=Ew(e,t);if(n.state>yw)throw Error(`too late; already running`);return n}function Ew(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Dw(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=sw(a,0,n.time);function a(e){n.state=_w,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==_w)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===yw)return pw(o);f.state===bw?(f.state=Sw,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=Sw,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(pw(function(){n.state===yw&&(n.state=bw,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=vw,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===vw){for(n.state=yw,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=xw,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===xw&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=Sw,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Ow(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>vw&&r.state<xw,r.state=Sw,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function kw(e){return this.each(function(){Ow(this,e)})}function Aw(e,t){var n,r;return function(){var i=Tw(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function jw(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=Tw(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Mw(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=Ew(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?Aw:jw)(n,e,t))}function Nw(e,t,n){var r=e._id;return e.each(function(){var e=Tw(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return Ew(e,r).value[t]}}function Pw(e,t){var n;return(typeof t==`number`?TC:t instanceof XS?bC:(n=XS(t))?(t=n,bC):jC)(e,t)}function Fw(e){return function(){this.removeAttribute(e)}}function Iw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Lw(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Rw(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function zw(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Bw(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Vw(e,t){var n=_b(e),r=n===`transform`?VC:Pw;return this.attrTween(e,typeof t==`function`?(n.local?Bw:zw)(n,r,Nw(this,`attr.`+e,t)):t==null?(n.local?Iw:Fw)(n):(n.local?Rw:Lw)(n,r,t))}function Hw(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Uw(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ww(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Uw(e,i)),n}return i._value=t,i}function Gw(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Hw(e,i)),n}return i._value=t,i}function Kw(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=_b(e);return this.tween(n,(r.local?Ww:Gw)(r,t))}function qw(e,t){return function(){ww(this,e).delay=+t.apply(this,arguments)}}function Jw(e,t){return t=+t,function(){ww(this,e).delay=t}}function Yw(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?qw:Jw)(t,e)):Ew(this.node(),t).delay}function Xw(e,t){return function(){Tw(this,e).duration=+t.apply(this,arguments)}}function Zw(e,t){return t=+t,function(){Tw(this,e).duration=t}}function Qw(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Xw:Zw)(t,e)):Ew(this.node(),t).duration}function $w(e,t){if(typeof t!=`function`)throw Error();return function(){Tw(this,e).ease=t}}function eT(e){var t=this._id;return arguments.length?this.each($w(t,e)):Ew(this.node(),t).ease}function tT(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();Tw(this,e).ease=n}}function nT(e){if(typeof e!=`function`)throw Error();return this.each(tT(this._id,e))}function rT(e){typeof e!=`function`&&(e=kb(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new MT(r,this._parents,this._name,this._id)}function iT(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new MT(o,this._parents,this._name,this._id)}function aT(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function oT(e,t,n){var r,i,a=aT(t)?ww:Tw;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function sT(e,t){var n=this._id;return arguments.length<2?Ew(this.node(),n).on.on(e):this.each(oT(n,e,t))}function cT(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function lT(){return this.on(`end.remove`,cT(this._id))}function uT(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Sb(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,Cw(l[f],t,n,f,l,Ew(u,n)));return new MT(a,this._parents,t,n)}function dT(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Eb(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=Ew(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Cw(p,t,n,h,f,m);a.push(f),o.push(u)}return new MT(a,o,t,n)}var fT=fS.prototype.constructor;function pT(){return new fT(this._groups,this._parents)}function mT(e,t){var n,r,i;return function(){var a=yx(this,e),o=(this.style.removeProperty(e),yx(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function hT(e){return function(){this.style.removeProperty(e)}}function gT(e,t,n){var r,i=n+``,a;return function(){var o=yx(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function _T(e,t,n){var r,i,a;return function(){var o=yx(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),yx(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function vT(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=Tw(this,e),l=c.on,u=c.value[a]==null?s||=hT(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function yT(e,t,n){var r=(e+=``)==`transform`?BC:Pw;return t==null?this.styleTween(e,mT(e,r)).on(`end.style.`+e,hT(e)):typeof t==`function`?this.styleTween(e,_T(e,r,Nw(this,`style.`+e,t))).each(vT(this._id,e)):this.styleTween(e,gT(e,r,t),n).on(`end.style.`+e,null)}function bT(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function xT(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&bT(e,a,n)),r}return a._value=t,a}function ST(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,xT(e,t,n??``))}function CT(e){return function(){this.textContent=e}}function wT(e){return function(){var t=e(this);this.textContent=t??``}}function TT(e){return this.tween(`text`,typeof e==`function`?wT(Nw(this,`text`,e)):CT(e==null?``:e+``))}function ET(e){return function(t){this.textContent=e.call(this,t)}}function DT(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&ET(r)),t}return r._value=e,r}function OT(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,DT(e))}function kT(){for(var e=this._name,t=this._id,n=NT(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=Ew(c,t);Cw(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new MT(r,this._parents,e,n)}function AT(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=Tw(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var jT=0;function MT(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function NT(){return++jT}var PT=fS.prototype;MT.prototype={constructor:MT,select:uT,selectAll:dT,selectChild:PT.selectChild,selectChildren:PT.selectChildren,filter:rT,merge:iT,selection:pT,transition:kT,call:PT.call,nodes:PT.nodes,node:PT.node,size:PT.size,empty:PT.empty,each:PT.each,on:sT,attr:Vw,attrTween:Kw,style:yT,styleTween:ST,text:TT,textTween:OT,remove:lT,tween:Mw,delay:Yw,duration:Qw,ease:eT,easeVarying:nT,end:AT,[Symbol.iterator]:PT[Symbol.iterator]};function FT(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var IT={time:null,delay:0,duration:250,ease:FT};function LT(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function RT(e){var t,n;e instanceof MT?(t=e._id,e=e._name):(t=NT(),(n=IT).time=iw(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&Cw(c,e,t,l,o,n||LT(c,t));return new MT(r,this._parents,e,t)}fS.prototype.interrupt=kw,fS.prototype.transition=RT;var zT=e=>()=>e;function BT(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function VT(e,t,n){this.k=e,this.x=t,this.y=n}VT.prototype={constructor:VT,scale:function(e){return e===1?this:new VT(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new VT(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var HT=new VT(1,0,0);VT.prototype;function UT(e){e.stopImmediatePropagation()}function WT(e){e.preventDefault(),e.stopImmediatePropagation()}function GT(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function KT(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function qT(){return this.__zoom||HT}function JT(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function YT(){return navigator.maxTouchPoints||`ontouchstart`in this}function XT(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function ZT(){var e=GT,t=KT,n=XT,r=JT,i=YT,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=KC,l=ub(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,qT).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,ee).on(`touchend.zoom touchcancel.zoom`,O).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,qT),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(HT.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new VT(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new VT(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new VT(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=mS(this.that).datum();l.call(e,this.that,new BT(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=gS(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Ow(this),s.start();WT(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=mS(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=gS(t,i),l=t.clientX,u=t.clientY;xS(t.view),UT(t),a.mouse=[c,this.__zoom.invert(c)],Ow(this),a.start();function d(e){if(WT(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=gS(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),SS(e.view,a.moved),WT(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=gS(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);WT(r),s>0?mS(this).transition().duration(s).call(x,d,c,r):mS(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(UT(t),s=0;s<i;++s)c=r[s],l=gS(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),Ow(this),a.start())}}function ee(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(WT(e),s=0;s<a;++s)c=i[s],l=gS(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function O(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(UT(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=gS(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=mS(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:zT(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:zT(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:zT(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:zT([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var QT=(e=>(e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`,e))(QT||{}),$T=(e=>(e.Partial=`partial`,e.Full=`full`,e))($T||{}),eE=(e=>(e.Bezier=`default`,e.SimpleBezier=`simple-bezier`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e))(eE||{}),tE=(e=>(e.Strict=`strict`,e.Loose=`loose`,e))(tE||{}),nE=(e=>(e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`,e))(nE||{}),rE=(e=>(e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`,e))(rE||{}),iE=(e=>(e.TopLeft=`top-left`,e.TopCenter=`top-center`,e.TopRight=`top-right`,e.BottomLeft=`bottom-left`,e.BottomCenter=`bottom-center`,e.BottomRight=`bottom-right`,e))(iE||{}),aE=[`INPUT`,`SELECT`,`TEXTAREA`],oE=typeof document<`u`?document:null;function sE(e){let t=e.composedPath?.call(e)?.[0]||e.target,n=typeof t?.hasAttribute==`function`&&t.hasAttribute(`contenteditable`),r=typeof t?.closest==`function`?t.closest(`.nokey`):null;return aE.includes(t?.nodeName)||n||!!r}function cE(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function lE(e,t,n,r){let i=t.replace(`+`,`
24
+ `).replace(`
25
+
26
+ `,`
27
+ +`).split(`
28
+ `).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function uE(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=dE(n.code,e);return Array.isArray(e)?e.some(e=>lE(n[r],e,t,n.type===`keyup`)):lE(n[r],e,t,n.type===`keyup`)}}function dE(e,t){return t.includes(e)?`code`:`key`}function fE(e,t){let n=L(()=>i(t?.target)??oE),r=o(i(e)===!0),a=!1,s=new Set,c=u(i(e));S(()=>i(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&l(),c=u(e)},{immediate:!0}),ib([`blur`,`contextmenu`],l),ob((...e)=>c(...e),e=>{let n=i(t?.actInsideInputWithModifier)??!0,o=i(t?.preventDefault)??!1;if(a=cE(e),(!a||a&&!n)&&sE(e))return;let s=e.composedPath?.call(e)?.[0]||e.target,c=s?.nodeName===`BUTTON`||s?.nodeName===`A`;!o&&(a||!c)&&e.preventDefault(),r.value=!0},{eventName:`keydown`,target:n}),ob((...e)=>c(...e),e=>{let n=i(t?.actInsideInputWithModifier)??!0;if(r.value){if((!a||a&&!n)&&sE(e))return;a=!1,r.value=!1}},{eventName:`keyup`,target:n});function l(){a=!1,s.clear(),r.value=i(e)===!0}function u(e){return e===null?(l(),()=>!1):typeof e==`boolean`?(l(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?uE(e,s):e}return r}var pE=`vue-flow__node-desc`,mE=`vue-flow__edge-desc`,hE=`vue-flow__aria-live`,gE=[`Enter`,` `,`Escape`],_E={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function vE(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function yE(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)}function bE(e){return{width:e.offsetWidth,height:e.offsetHeight}}function xE(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function SE(e,t){return{x:xE(e.x,t[0][0],t[1][0]),y:xE(e.y,t[0][1],t[1][1])}}function CE(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function wE(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function TE(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!wE(e)}function EE(e){return TE(e)&&`computedPosition`in e}function DE(e){return!Number.isNaN(e)&&Number.isFinite(e)}function OE(e){return DE(e.width)&&DE(e.height)&&DE(e.x)&&DE(e.y)}function kE(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:d({width:0,height:0}),computedPosition:d({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:KD(e.data)?e.data:{},events:d(KD(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function AE(e,t,n){let r={id:e.id.toString(),type:e.type??t?.type??`default`,source:e.source.toString(),target:e.target.toString(),sourceHandle:e.sourceHandle?.toString(),targetHandle:e.targetHandle?.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:KD(e.data)?e.data:{},events:d(KD(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function jE(e,t,n,r){let i=typeof e==`string`?e:e.id,a=new Set,o=r===`source`?`target`:`source`;for(let e of n)e[o]===i&&a.add(e[r]);return t.filter(e=>a.has(e.id))}function ME(...e){if(e.length===3){let[t,n,r]=e;return jE(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>wE(e)&&e.source===r).map(e=>n.find(t=>TE(t)&&t.id===e.target))}function NE(...e){if(e.length===3){let[t,n,r]=e;return jE(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>wE(e)&&e.target===r).map(e=>n.find(t=>TE(t)&&t.id===e.source))}function PE({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function FE(e,t){return t.some(t=>wE(t)&&t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle))}function IE({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function LE({x:e,y:t},{x:n,y:r,zoom:i},a=!1,o=[1,1]){let s={x:(e-n)/i,y:(t-r)/i};return a?kD(s,o):s}function RE(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function zE({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function BE({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function VE(e,t){return BE(RE(zE(e),zE(t)))}function HE(e){let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};for(let n=0;n<e.length;n++){let r=e[n];t=RE(t,zE({...r.computedPosition,...r.dimensions}))}return BE(t)}function UE(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...LE(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s=!1}=t,c=e.width??t.width??null,l=e.height??t.height??null;if(i&&!n||s)continue;let u=yE(a,vE(t)),d=c===null||l===null,f=r&&u>0,p=(c??0)*(l??0);(d||f||u>=p||t.dragging)&&o.push(t)}return o}function WE(e,t){let n=new Set;if(typeof e==`string`)n.add(e);else if(e.length>=1)for(let t of e)n.add(t.id);return t.filter(e=>n.has(e.source)||n.has(e.target))}function GE(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=Number.parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return HD(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function KE(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=GE(e,n),i=GE(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=GE(e.top??e.y??0,n),i=GE(e.bottom??e.y??0,n),a=GE(e.left??e.x??0,t),o=GE(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function qE(e,t,n,r,i,a){let{x:o,y:s}=IE(e,{x:t,y:n,zoom:r}),{x:c,y:l}=IE({x:e.x+e.width,y:e.y+e.height},{x:t,y:n,zoom:r}),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}function JE(e,t,n,r,i,a=.1){let o=KE(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=xE(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=qE(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}}function YE(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function XE(e,t){if(!e.parentNode)return!1;let n=t.get(e.parentNode);return n?n.selected?!0:XE(n,t):!1}function ZE(e,t){return e===void 0?``:typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`}function QE(e){let t=e.ctrlKey&&DD()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function $E(e,t,n){return e<t?xE(Math.abs(e-t),1,t)/t:e>n?-xE(Math.abs(e-n),1,t)/t:0}function eD(e,t,n=15,r=40){return[$E(e.x,r,t.width-r)*n,$E(e.y,r,t.height-r)*n]}function tD(e,t){if(t){let n=e.position.x+e.dimensions.width-t.dimensions.width,r=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||r>0||e.position.x<0||e.position.y<0){let i={};if(typeof t.style==`function`?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0){if(typeof i.width==`string`){let e=Number(i.width.replace(`px`,``));i.width=`${e+n}px`}else i.width+=n}if(r>0){if(typeof i.height==`string`){let e=Number(i.height.replace(`px`,``));i.height=`${e+r}px`}else i.height+=r}if(e.position.x<0){let n=Math.abs(e.position.x);if(t.position.x=t.position.x-n,typeof i.width==`string`){let e=Number(i.width.replace(`px`,``));i.width=`${e+n}px`}else i.width+=n;e.position.x=0}if(e.position.y<0){let n=Math.abs(e.position.y);if(t.position.y=t.position.y-n,typeof i.height==`string`){let e=Number(i.height.replace(`px`,``));i.height=`${e+n}px`}else i.height+=n;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace(`px`,``)),t.dimensions.height=Number(i.height.toString().replace(`px`,``)),t.style=typeof t.style==`function`?e=>{let n=t.style;return{...n(e),...i}}:{...t.style,...i}}}}function nD(e,t){let n=e.filter(e=>e.type===`add`||e.type===`remove`);for(let e of n)if(e.type===`add`)t.findIndex(t=>t.id===e.item.id)===-1&&t.push(e.item);else if(e.type===`remove`){let n=t.findIndex(t=>t.id===e.id);n!==-1&&t.splice(n,1)}let r=t.map(e=>e.id);for(let n of t)for(let i of e)if(i.id===n.id)switch(i.type){case`select`:n.selected=i.selected;break;case`position`:if(EE(n)&&(i.position!==void 0&&(n.position=i.position),i.dragging!==void 0&&(n.dragging=i.dragging),n.expandParent&&n.parentNode)){let e=t[r.indexOf(n.parentNode)];e&&EE(e)&&tD(n,e)}break;case`dimensions`:if(EE(n)&&(i.dimensions!==void 0&&(n.dimensions=i.dimensions),i.updateStyle!==void 0&&i.updateStyle&&(n.style={...n.style||{},width:`${i.dimensions?.width}px`,height:`${i.dimensions?.height}px`}),i.resizing!==void 0&&(n.resizing=i.resizing),n.expandParent&&n.parentNode)){let e=t[r.indexOf(n.parentNode)];e&&EE(e)&&(e.dimensions.width&&e.dimensions.height?tD(n,e):se(()=>{tD(n,e)}))}}return t}function rD(e,t){return{id:e,type:`select`,selected:t}}function iD(e){return{item:e,type:`add`}}function aD(e){return{id:e,type:`remove`}}function oD(e,t,n,r,i){return{id:e,source:t,target:n,sourceHandle:r||null,targetHandle:i||null,type:`remove`}}function sD(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);(a.selected!==void 0||e)&&a.selected!==e&&(n&&(a.selected=e),r.push(rD(a.id,e)))}return r}var cD=()=>{};function $(e){let t=new Set,n=cD,r=()=>!1,i=()=>t.size>0||r(),a=e=>{n=e},o=()=>{n=cD},s=e=>{r=e},c=()=>{r=()=>!1},l=e=>{t.delete(e)};return{on:e=>{t.add(e);let n=()=>l(e);return By(n),{off:n}},off:l,trigger:r=>{let a=[n];return i()?a.push(...t):e&&a.push(e),Promise.allSettled(a.map(e=>e(r)))},hasListeners:i,listeners:t,setEmitter:a,removeEmitter:o,setHasEmitListeners:s,removeHasEmitListeners:c}}function lD(e,t,n){let r=e;do{if(r&&r.matches(t))return!0;if(r===n)return!1;r=r.parentElement}while(r);return!1}function uD(e,t,n,r){let i=new Map;for(let[a,o]of e)(o.selected||o.id===r)&&(!o.parentNode||!XE(o,e))&&(o.draggable||t&&o.draggable===void 0)&&e.get(a)&&i.set(a,{id:o.id,position:o.position||{x:0,y:0},distance:{x:n.x-o.computedPosition?.x||0,y:n.y-o.computedPosition?.y||0},from:{x:o.computedPosition.x,y:o.computedPosition.y},extent:o.extent,parentNode:o.parentNode,dimensions:{...o.dimensions},expandParent:o.expandParent});return Array.from(i.values())}function dD({id:e,dragItems:t,findNode:n}){let r=[];for(let e of t){let t=n(e.id);t&&r.push(t)}return[e?r.find(t=>t.id===e):r[0],r]}function fD(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function pD(e,t,n){let[r,i,a,o]=typeof e==`string`?[0,0,0,0]:fD(e.padding);return n&&n.computedPosition.x!==void 0&&n.computedPosition.y!==void 0&&n.dimensions.width!==void 0&&n.dimensions.height!==void 0?[[n.computedPosition.x+o,n.computedPosition.y+r],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-a]]:!1}function mD(e,t,n,r){let i=e.extent||n;if((i===`parent`||!Array.isArray(i)&&i?.range===`parent`)&&!e.expandParent){if(e.parentNode&&r&&e.dimensions.width&&e.dimensions.height){let t=pD(i,e,r);t&&(i=t)}else t(new CD(xD.NODE_EXTENT_INVALID,e.id)),i=n}else if(Array.isArray(i)){let e=r?.computedPosition.x||0,t=r?.computedPosition.y||0;i=[[i[0][0]+e,i[0][1]+t],[i[1][0]+e,i[1][1]+t]]}else if(i!==`parent`&&i?.range&&Array.isArray(i.range)){let[e,t,n,a]=fD(i.padding),o=r?.computedPosition.x||0,s=r?.computedPosition.y||0;i=[[i.range[0][0]+o+a,i.range[0][1]+s+e],[i.range[1][0]+o-t,i.range[1][1]+s-n]]}return i===`parent`?[[-1/0,-1/0],[1/0,1/0]]:i}function hD({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function gD(e,t,n,r,i){let a=SE(t,hD(e.dimensions,mD(e,n,r,i)));return{position:{x:a.x-(i?.computedPosition.x||0),y:a.y-(i?.computedPosition.y||0)},computedPosition:a}}function _D(e,t,n=QT.Left,r=!1){let i=(t?.x??0)+e.computedPosition.x,a=(t?.y??0)+e.computedPosition.y,{width:o,height:s}=t??OD(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case QT.Top:return{x:i+o/2,y:a};case QT.Right:return{x:i+o,y:a+s/2};case QT.Bottom:return{x:i+o/2,y:a+s};case QT.Left:return{x:i,y:a+s/2}}}function vD(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function yD({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:a,width:o,height:s,viewport:c}){let l={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+a)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);let u=zE({x:(0-c.x)/c.zoom,y:(0-c.y)/c.zoom,width:o/c.zoom,height:s/c.zoom}),d=Math.max(0,Math.min(u.x2,l.x2)-Math.max(u.x,l.x)),f=Math.max(0,Math.min(u.y2,l.y2)-Math.max(u.y,l.y));return Math.ceil(d*f)>0}function bD(e,t,n=!1){let r=typeof e.zIndex==`number`,i=r?e.zIndex:0,a=t(e.source),o=t(e.target);return!a||!o?0:(n&&(i=r?e.zIndex:Math.max(a.computedPosition.z||0,o.computedPosition.z||0)),i)}var xD=(e=>(e.MISSING_STYLES=`MISSING_STYLES`,e.MISSING_VIEWPORT_DIMENSIONS=`MISSING_VIEWPORT_DIMENSIONS`,e.NODE_INVALID=`NODE_INVALID`,e.NODE_NOT_FOUND=`NODE_NOT_FOUND`,e.NODE_MISSING_PARENT=`NODE_MISSING_PARENT`,e.NODE_TYPE_MISSING=`NODE_TYPE_MISSING`,e.NODE_EXTENT_INVALID=`NODE_EXTENT_INVALID`,e.EDGE_INVALID=`EDGE_INVALID`,e.EDGE_NOT_FOUND=`EDGE_NOT_FOUND`,e.EDGE_SOURCE_MISSING=`EDGE_SOURCE_MISSING`,e.EDGE_TARGET_MISSING=`EDGE_TARGET_MISSING`,e.EDGE_TYPE_MISSING=`EDGE_TYPE_MISSING`,e.EDGE_SOURCE_TARGET_SAME=`EDGE_SOURCE_TARGET_SAME`,e.EDGE_SOURCE_TARGET_MISSING=`EDGE_SOURCE_TARGET_MISSING`,e.EDGE_ORPHANED=`EDGE_ORPHANED`,e.USEVUEFLOW_OPTIONS=`USEVUEFLOW_OPTIONS`,e))(xD||{}),SD={MISSING_STYLES:()=>`It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly`,MISSING_VIEWPORT_DIMENSIONS:()=>`The Vue Flow parent container needs a width and a height to render the graph`,NODE_INVALID:e=>`Node is invalid
29
+ Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
30
+ Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
31
+ Node: ${e}
32
+ Parent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing
33
+ Type: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent
34
+ Node: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target
35
+ Edge: ${e}`,EDGE_SOURCE_MISSING:(e,t)=>`Edge source is missing
36
+ Edge: ${e}
37
+ Source: ${t}`,EDGE_TARGET_MISSING:(e,t)=>`Edge target is missing
38
+ Edge: ${e}
39
+ Target: ${t}`,EDGE_TYPE_MISSING:e=>`Edge type is missing
40
+ Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,t,n)=>`Edge source and target are the same
41
+ Edge: ${e}
42
+ Source: ${t}
43
+ Target: ${n}`,EDGE_SOURCE_TARGET_MISSING:(e,t,n)=>`Edge source or target is missing
44
+ Edge: ${e}
45
+ Source: ${t}
46
+ Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
47
+ Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
48
+ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},CD=class extends Error{constructor(e,...t){super(SD[e]?.call(SD,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function wD(e){return`clientX`in e}function TD(e){return`sourceEvent`in e}function ED(e,t){let n=wD(e),r,i;return n?(r=e.clientX,i=e.clientY):`touches`in e&&e.touches.length>0?(r=e.touches[0].clientX,i=e.touches[0].clientY):`changedTouches`in e&&e.changedTouches.length>0?(r=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(r=0,i=0),{x:r-(t?.left??0),y:i-(t?.top??0)}}var DD=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function OD(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function kD(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var AD=()=>!0;function jD(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function MD(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())yE(i,vE(e))>0&&r.push(e);return r}var ND=250;function PD(e,t,n,r){let i=[],a=1/0,o=MD(e,n,t+ND);for(let n of o){let o=[...n.handleBounds?.source??[],...n.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=_D(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function FD(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=AD},u,d,f,p){let m=a===`target`,h=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:_}=ED(e),v=o.elementFromPoint(g,_),y=v?.classList.contains(`${s}-flow__handle`)?v:h,b={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){let e=ID(void 0,y),t=y.getAttribute(`data-nodeid`),a=y.getAttribute(`data-handleid`),o=y.classList.contains(`connectable`),s=y.classList.contains(`connectableend`);if(!t||!e)return b;let c={source:m?t:r,sourceHandle:m?a:i,target:m?r:t,targetHandle:m?i:a};b.connection=c,b.isValid=o&&s&&(n===tE.Strict?m&&e===`source`||!m&&e===`target`:t!==r||a!==i)&&l(c,{nodes:d,edges:u,sourceNode:f(c.source),targetNode:f(c.target)}),b.toHandle=zD(t,e,a,p,n,!0)}return b}function ID(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function LD(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function RD(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function zD(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===tE.Strict?o.handleBounds?.[t]:[...o.handleBounds?.source??[],...o.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,..._D(o,c,c.position,!0)}:c}var BD={[QT.Left]:QT.Right,[QT.Right]:QT.Left,[QT.Top]:QT.Bottom,[QT.Bottom]:QT.Top},VD=[`production`,`prod`];function HD(e,...t){UD()&&console.warn(`[Vue Flow]: ${e}`,...t)}function UD(){return!VD.includes(`production`)}function WD(e,t,n,r,i){let a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a?.length?Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...bE(t)}}):null}function GD(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),se(()=>{o.blur()})):n([e])}function KD(e){return n(e)!==void 0}function qD(e,t,n,r){if(!e||!e.source||!e.target)return n(new CD(xD.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=wE(e)?e:{...e,id:PE(e)},i=AE(i,void 0,r),!FE(i,t)&&i}function JD(e,t,n,r,i){if(!t.source||!t.target)return i(new CD(xD.EDGE_INVALID,e.id)),!1;if(!n)return i(new CD(xD.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?PE(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function YD(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!TE(o)){n(new CD(xD.NODE_INVALID,o?.id));continue}let s=kE(o,t(o.id),o.parentNode);o.parentNode&&(r[o.parentNode]=!0),i[a]=s}for(let e of i){let a=t(e.parentNode)||i.find(t=>t.id===e.parentNode);e.parentNode&&!a&&n(new CD(xD.NODE_MISSING_PARENT,e.id,e.parentNode)),(e.parentNode||r[e.id])&&(r[e.id]&&(e.isParent=!0),a&&(a.isParent=!0))}return i}function XD(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function ZD(e,t,n){e.clear();for(let t of n){let{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=t,o={edgeId:t.id,source:n,target:r,sourceHandle:i,targetHandle:a},s=`${n}-${i}--${r}-${a}`;XD(`source`,o,`${r}-${a}--${n}-${i}`,e,n,i),XD(`target`,o,s,e,r,a)}}function QD(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function $D(e,t,n,r,i,a,o,s){let c=[];for(let l of e){let e=wE(l)?l:qD(l,s,i,a);if(!e)continue;let u=n(e.source),d=n(e.target);if(!u||!d){i(new CD(xD.EDGE_SOURCE_TARGET_MISSING,e.id,e.source,e.target));continue}if(!u){i(new CD(xD.EDGE_SOURCE_MISSING,e.id,e.source));continue}if(!d){i(new CD(xD.EDGE_TARGET_MISSING,e.id,e.target));continue}if(t&&!t(e,{edges:s,nodes:o,sourceNode:u,targetNode:d})){i(new CD(xD.EDGE_INVALID,e.id));continue}let f=r(e.id);c.push({...AE(e,f,a),sourceNode:u,targetNode:d})}return c}var eO=Symbol(`vueFlow`),tO=Symbol(`nodeId`),nO=Symbol(`nodeRef`),rO=Symbol(`edgeId`),iO=Symbol(`edgeRef`),aO=Symbol(`slots`);function oO(e){let{vueFlowRef:t,snapToGrid:n,snapGrid:r,noDragClassName:a,nodeLookup:s,nodeExtent:c,nodeDragThreshold:l,viewport:u,autoPanOnNodeDrag:d,autoPanSpeed:f,nodesDraggable:p,panBy:m,findNode:h,multiSelectionActive:g,nodesSelectionActive:_,selectNodesOnDrag:v,removeSelectedElements:y,addSelectedNodes:b,updateNodePositions:x,emits:C}=mk(),{onStart:w,onDrag:T,onStop:E,onClick:D,el:ee,disabled:O,id:k,selectable:A,dragHandle:j}=e,M=o(!1),N=[],P,F=null,I={x:void 0,y:void 0},L={x:0,y:0},te=null,ne=!1,R=!1,z=0,B=!1,V=lO(),re=({x:e,y:t})=>{I={x:e,y:t};let i=!1;if(N=N.map(a=>{let o={x:e-a.distance.x,y:t-a.distance.y},{computedPosition:s}=gD(a,n.value?kD(o,r.value):o,C.error,c.value,a.parentNode?h(a.parentNode):void 0);return i=i||a.position.x!==s.x||a.position.y!==s.y,a.position=s,a}),R||=i,i&&(x(N,!0,!0),M.value=!0,te)){let[e,t]=dD({id:k,dragItems:N,findNode:h});T({event:te,node:e,nodes:t})}},H=()=>{if(!F)return;let[e,t]=eD(L,F,f.value);if(e!==0||t!==0){let n={x:(I.x??0)-e/u.value.zoom,y:(I.y??0)-t/u.value.zoom};m({x:e,y:t})&&re(n)}z=requestAnimationFrame(H)},U=(e,t)=>{ne=!0;let n=h(k);!v.value&&!g.value&&n&&(n.selected||y()),n&&i(A)&&v.value&&GD(n,g.value,b,y,_,!1,t);let r=V(e.sourceEvent);if(I=r,N=uD(s.value,p.value,r,k),N.length){let[t,n]=dD({id:k,dragItems:N,findNode:h});w({event:e.sourceEvent,node:t,nodes:n})}},ie=(e,n)=>{e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||(R=!1,l.value===0&&U(e,n),I=V(e.sourceEvent),F=t.value?.getBoundingClientRect()||null,L=ED(e.sourceEvent,F))},ae=(e,t)=>{let n=V(e.sourceEvent);if(!B&&ne&&d.value&&(B=!0,H()),!ne){let r=n.xSnapped-(I.x??0),i=n.ySnapped-(I.y??0);Math.sqrt(r*r+i*i)>l.value&&U(e,t)}(I.x!==n.xSnapped||I.y!==n.ySnapped)&&N.length&&ne&&(te=e.sourceEvent,L=ED(e.sourceEvent,F),re(n))},oe=e=>{let t=!1;if(!ne&&!M.value&&!g.value){let n=e.sourceEvent,r=V(n),i=r.xSnapped-(I.x??0),a=r.ySnapped-(I.y??0),o=Math.sqrt(i*i+a*a);o!==0&&o<=l.value&&(D?.(n),t=!0)}if(N.length&&!t){R&&=(x(N,!1,!1),!1);let[t,n]=dD({id:k,dragItems:N,findNode:h});E({event:e.sourceEvent,node:t,nodes:n})}N=[],M.value=!1,B=!1,ne=!1,I={x:void 0,y:void 0},cancelAnimationFrame(z)};return S([()=>i(O),ee],([e,t],n,r)=>{if(t){let n=mS(t);e||(P=kS().on(`start`,e=>ie(e,t)).on(`drag`,e=>ae(e,t)).on(`end`,e=>oe(e)).filter(e=>{let n=e.target,r=i(j);return!e.button&&(!a.value||!lD(n,`.${a.value}`,t)&&(!r||lD(n,r,t)))}),n.call(P)),r(()=>{n.on(`.drag`,null),P&&(P.on(`start`,null),P.on(`drag`,null),P.on(`end`,null))})}}),M}function sO(){return{doubleClick:$(),click:$(),mouseEnter:$(),mouseMove:$(),mouseLeave:$(),contextMenu:$(),updateStart:$(),update:$(),updateEnd:$()}}function cO(e,t){let n=sO();return n.doubleClick.on(n=>{var r,i;t.edgeDoubleClick(n),(i=(r=e.events)?.doubleClick)==null||i.call(r,n)}),n.click.on(n=>{var r,i;t.edgeClick(n),(i=(r=e.events)?.click)==null||i.call(r,n)}),n.mouseEnter.on(n=>{var r,i;t.edgeMouseEnter(n),(i=(r=e.events)?.mouseEnter)==null||i.call(r,n)}),n.mouseMove.on(n=>{var r,i;t.edgeMouseMove(n),(i=(r=e.events)?.mouseMove)==null||i.call(r,n)}),n.mouseLeave.on(n=>{var r,i;t.edgeMouseLeave(n),(i=(r=e.events)?.mouseLeave)==null||i.call(r,n)}),n.contextMenu.on(n=>{var r,i;t.edgeContextMenu(n),(i=(r=e.events)?.contextMenu)==null||i.call(r,n)}),n.updateStart.on(n=>{var r,i;t.edgeUpdateStart(n),(i=(r=e.events)?.updateStart)==null||i.call(r,n)}),n.update.on(n=>{var r,i;t.edgeUpdate(n),(i=(r=e.events)?.update)==null||i.call(r,n)}),n.updateEnd.on(n=>{var r,i;t.edgeUpdateEnd(n),(i=(r=e.events)?.updateEnd)==null||i.call(r,n)}),Object.entries(n).reduce((e,[t,n])=>(e.emit[t]=n.trigger,e.on[t]=n.on,e),{emit:{},on:{}})}function lO(){let{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:r}=mk();return i=>{let a=r.value?.getBoundingClientRect()??{left:0,top:0},{x:o,y:s}=ED(TD(i)?i.sourceEvent:i,a),c=LE({x:o,y:s},e.value),{x:l,y:u}=n.value?kD(c,t.value):c;return{xSnapped:l,ySnapped:u,...c}}}function uO(){return!0}function dO({handleId:e,nodeId:t,type:n,isValidConnection:r,edgeUpdaterType:a,onEdgeUpdate:o,onEdgeUpdateEnd:s}){let{id:c,vueFlowRef:l,connectionMode:u,connectionRadius:d,connectOnClick:f,connectionClickStartHandle:p,nodesConnectable:m,autoPanOnConnect:h,autoPanSpeed:g,findNode:_,panBy:v,startConnection:y,updateConnection:b,endConnection:x,emits:S,viewport:C,edges:w,nodes:T,isValidConnection:E,nodeLookup:D}=mk(),ee=null,O=!1,k=null;function A(f){let p=i(n)===`target`,m=wD(f),A=CE(f.target),j=f.currentTarget;if(j&&(m&&f.button===0||!m)){let n=function(n){B=ED(n,ne),P=PD(LE(B,C.value,!1,[1,1]),d.value,D.value,H),V||=(re(),!0);let r=FD(n,{handle:P,connectionMode:u.value,fromNodeId:i(t),fromHandleId:i(e),fromType:p?`target`:`source`,isValidConnection:N,doc:A,lib:`vue`,flowId:c,nodeLookup:D.value},w.value,T.value,_,D.value);k=r.handleDomNode,ee=r.connection,O=RD(!!P,r.isValid);let a={...ae,isValid:O,to:r.toHandle&&O?IE({x:r.toHandle.x,y:r.toHandle.y},C.value):B,toHandle:r.toHandle,toPosition:O&&r.toHandle?r.toHandle.position:BD[H.position],toNode:r.toHandle?D.value.get(r.toHandle.nodeId):null};if(O&&P&&ae?.toHandle&&a.toHandle&&ae.toHandle.type===a.toHandle.type&&ae.toHandle.nodeId===a.toHandle.nodeId&&ae.toHandle.id===a.toHandle.id&&ae.to.x===a.to.x&&ae.to.y===a.to.y)return;let o=P??r.toHandle;if(b(o&&O?IE({x:o.x,y:o.y},C.value):B,o,LD(!!o,O)),ae=a,!P&&!O&&!k)return jD(z);ee&&ee.source!==ee.target&&k&&(jD(z),z=k,k.classList.add(`connecting`,`vue-flow__handle-connecting`),k.classList.toggle(`valid`,!!O),k.classList.toggle(`vue-flow__handle-valid`,!!O))},m=function(e){`touches`in e&&e.touches.length>0||((P||k)&&ee&&O&&(o?o(e,ee):S.connect(ee)),S.connectEnd(e),a&&s?.(e),jD(z),cancelAnimationFrame(F),x(e),V=!1,O=!1,ee=null,k=null,A.removeEventListener(`mousemove`,n),A.removeEventListener(`mouseup`,m),A.removeEventListener(`touchmove`,n),A.removeEventListener(`touchend`,m))},M=_(i(t)),N=i(r)||E.value||uO;!N&&M&&(N=(p?M.isValidSourcePos:M.isValidTargetPos)||uO);let P,F=0,{x:I,y:L}=ED(f),te=ID(i(a),j),ne=l.value?.getBoundingClientRect();if(!ne||!te)return;let R=zD(i(t),te,i(e),D.value,u.value);if(!R)return;let z,B=ED(f,ne),V=!1,re=()=>{if(!h.value)return;let[e,t]=eD(B,ne,g.value);v({x:e,y:t}),F=requestAnimationFrame(re)},H={...R,nodeId:i(t),type:te,position:R.position},U=D.value.get(i(t)),ie={inProgress:!0,isValid:null,from:_D(U,H,QT.Left,!0),fromHandle:H,fromPosition:H.position,fromNode:U,to:B,toHandle:null,toPosition:BD[H.position],toNode:null};y({nodeId:i(t),id:i(e),type:te,position:j?.getAttribute(`data-handlepos`)||QT.Top,...B},{x:I-ne.left,y:L-ne.top}),S.connectStart({event:f,nodeId:i(t),handleId:i(e),handleType:te});let ae=ie;A.addEventListener(`mousemove`,n),A.addEventListener(`mouseup`,m),A.addEventListener(`touchmove`,n),A.addEventListener(`touchend`,m)}}function j(a){if(!f.value)return;let o=i(n)===`target`;if(!p.value){S.clickConnectStart({event:a,nodeId:i(t),handleId:i(e)}),y({nodeId:i(t),type:i(n),id:i(e),position:QT.Top,...ED(a)},void 0,!0);return}let s=i(r)||E.value||uO,l=_(i(t));if(!s&&l&&(s=(o?l.isValidSourcePos:l.isValidTargetPos)||uO),l&&(l.connectable===void 0?m.value:l.connectable)===!1)return;let d=CE(a.target),h=FD(a,{handle:{nodeId:i(t),id:i(e),type:i(n),position:QT.Top,...ED(a)},connectionMode:u.value,fromNodeId:p.value.nodeId,fromHandleId:p.value.id??null,fromType:p.value.type,isValidConnection:s,doc:d,lib:`vue`,flowId:c,nodeLookup:D.value},w.value,T.value,_,D.value),g=h.connection?.source===h.connection?.target;h.isValid&&h.connection&&!g&&S.connect(h.connection),S.clickConnectEnd(a),x(a,!0)}return{handlePointerDown:A,handleClick:j}}function fO(){return C(tO,``)}function pO(e){let t=e??fO()??``,n=C(nO,r(null)),{findNode:i,edges:a,emits:o}=mk(),s=i(t);return s||o.error(new CD(xD.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:s,parentNode:L(()=>i(s.parentNode)),connectedEdges:L(()=>WE([s],a.value))}}function mO(){return{doubleClick:$(),click:$(),mouseEnter:$(),mouseMove:$(),mouseLeave:$(),contextMenu:$(),dragStart:$(),drag:$(),dragStop:$()}}function hO(e,t){let n=mO();return n.doubleClick.on(n=>{var r,i;t.nodeDoubleClick(n),(i=(r=e.events)?.doubleClick)==null||i.call(r,n)}),n.click.on(n=>{var r,i;t.nodeClick(n),(i=(r=e.events)?.click)==null||i.call(r,n)}),n.mouseEnter.on(n=>{var r,i;t.nodeMouseEnter(n),(i=(r=e.events)?.mouseEnter)==null||i.call(r,n)}),n.mouseMove.on(n=>{var r,i;t.nodeMouseMove(n),(i=(r=e.events)?.mouseMove)==null||i.call(r,n)}),n.mouseLeave.on(n=>{var r,i;t.nodeMouseLeave(n),(i=(r=e.events)?.mouseLeave)==null||i.call(r,n)}),n.contextMenu.on(n=>{var r,i;t.nodeContextMenu(n),(i=(r=e.events)?.contextMenu)==null||i.call(r,n)}),n.dragStart.on(n=>{var r,i;t.nodeDragStart(n),(i=(r=e.events)?.dragStart)==null||i.call(r,n)}),n.drag.on(n=>{var r,i;t.nodeDrag(n),(i=(r=e.events)?.drag)==null||i.call(r,n)}),n.dragStop.on(n=>{var r,i;t.nodeDragStop(n),(i=(r=e.events)?.dragStop)==null||i.call(r,n)}),Object.entries(n).reduce((e,[t,n])=>(e.emit[t]=n.trigger,e.on[t]=n.on,e),{emit:{},on:{}})}function gO(){let{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:r,snapGrid:i,snapToGrid:a,nodesDraggable:o,emits:s}=mk();return(c,l=!1)=>{let u=a.value?i.value[0]:5,d=a.value?i.value[1]:5,f=l?4:1,p=c.x*u*f,m=c.y*d*f,h=[];for(let n of e.value)if(n.draggable||o&&n.draggable===void 0){let{position:e}=gD(n,{x:n.computedPosition.x+p,y:n.computedPosition.y+m},s.error,t.value,n.parentNode?r(n.parentNode):void 0);h.push({id:n.id,position:e,from:n.position,distance:{x:c.x,y:c.y},dimensions:n.dimensions})}n(h,!0,!1)}}var _O=.1,vO=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function yO(){return HD(`Viewport not initialized yet.`),Promise.resolve(!1)}var bO={zoomIn:yO,zoomOut:yO,zoomTo:yO,fitView:yO,setCenter:yO,fitBounds:yO,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:yO,setTransform:yO,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function xO(e){function t(t,n){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(n?.interpolate===`linear`?MC:KC).scaleBy(SO(e.d3Selection,n?.duration,n?.ease,()=>{r(!0)}),t):r(!1)})}function n(t,n,r,i){return new Promise(a=>{var o;let{x:s,y:c}=SE({x:-t,y:-n},e.translateExtent),l=HT.translate(-s,-c).scale(r);e.d3Selection&&e.d3Zoom?(o=e.d3Zoom)==null||o.interpolate(i?.interpolate===`linear`?MC:KC).transform(SO(e.d3Selection,i?.duration,i?.ease,()=>{a(!0)}),l):a(!1)})}return L(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:e=>t(1.2,e),zoomOut:e=>t(1/1.2,e),zoomTo:(t,n)=>new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(n?.interpolate===`linear`?MC:KC).scaleTo(SO(e.d3Selection,n?.duration,n?.ease,()=>{r(!0)}),t):r(!1)}),setViewport:(e,t)=>n(e.x,e.y,e.zoom,t),setTransform:(e,t)=>n(e.x,e.y,e.zoom,t),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(t={padding:_O,includeHiddenNodes:!1,duration:0})=>{let r=[];for(let n of e.nodes)n.dimensions.width&&n.dimensions.height&&(t?.includeHiddenNodes||!n.hidden)&&(!t.nodes?.length||t.nodes?.length&&t.nodes.includes(n.id))&&r.push(n);if(!r.length)return Promise.resolve(!1);let{x:i,y:a,zoom:o}=JE(HE(r),e.dimensions.width,e.dimensions.height,t.minZoom??e.minZoom,t.maxZoom??e.maxZoom,t.padding??_O);return n(i,a,o,t)},setCenter:(t,r,i)=>{let a=i?.zoom===void 0?e.maxZoom:i.zoom;return n(e.dimensions.width/2-t*a,e.dimensions.height/2-r*a,a,i)},fitBounds:(t,r={padding:_O})=>{let{x:i,y:a,zoom:o}=JE(t,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??_O);return n(i,a,o,r)},project:t=>LE(t,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:t=>{if(e.vueFlowRef){let{x:n,y:r}=e.vueFlowRef.getBoundingClientRect();return LE({x:t.x-n,y:t.y-r},e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:t=>{if(e.vueFlowRef){let{x:n,y:r}=e.vueFlowRef.getBoundingClientRect();return IE({x:t.x+n,y:t.y+r},e.viewport)}return{x:0,y:0}}}:bO)}function SO(e,t=0,n=vO,r=()=>{}){let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e}function CO(e,t,n){let r=u(!0);return r.run(()=>{r.run(()=>{let t,r,i=!!(n.nodes.value.length||n.edges.value.length);t=Qy([e.modelValue,()=>e.modelValue?.value?.length],([e])=>{e&&Array.isArray(e)&&(r?.pause(),n.setElements(e),!r&&!i&&e.length?i=!0:r?.resume())}),r=Qy([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([n,r])=>{e.modelValue?.value&&Array.isArray(e.modelValue.value)&&(t?.pause(),e.modelValue.value=[...n,...r],se(()=>{t?.resume()}))},{immediate:i}),l(()=>{t?.stop(),r?.stop()})}),r.run(()=>{let t,r,i=!!n.nodes.value.length;t=Qy([e.nodes,()=>e.nodes?.value?.length],([e])=>{e&&Array.isArray(e)&&(r?.pause(),n.setNodes(e),!r&&!i&&e.length?i=!0:r?.resume())}),r=Qy([n.nodes,()=>n.nodes.value.length],([n])=>{e.nodes?.value&&Array.isArray(e.nodes.value)&&(t?.pause(),e.nodes.value=[...n],se(()=>{t?.resume()}))},{immediate:i}),l(()=>{t?.stop(),r?.stop()})}),r.run(()=>{let t,r,i=!!n.edges.value.length;t=Qy([e.edges,()=>e.edges?.value?.length],([e])=>{e&&Array.isArray(e)&&(r?.pause(),n.setEdges(e),!r&&!i&&e.length?i=!0:r?.resume())}),r=Qy([n.edges,()=>n.edges.value.length],([n])=>{e.edges?.value&&Array.isArray(e.edges.value)&&(t?.pause(),e.edges.value=[...n],se(()=>{t?.resume()}))},{immediate:i}),l(()=>{t?.stop(),r?.stop()})}),r.run(()=>{S(()=>t.minZoom,()=>{t.minZoom&&KD(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})}),r.run(()=>{S(()=>t.maxZoom,()=>{t.maxZoom&&KD(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})}),r.run(()=>{S(()=>t.translateExtent,()=>{t.translateExtent&&KD(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})}),r.run(()=>{S(()=>t.nodeExtent,()=>{t.nodeExtent&&KD(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})}),r.run(()=>{S(()=>t.applyDefault,()=>{KD(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})}),r.run(()=>{let e=async e=>{let r=e;typeof t.autoConnect==`function`&&(r=await t.autoConnect(e)),r!==!1&&n.addEdges([r])};S(()=>t.autoConnect,()=>{KD(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),S(n.autoConnect,(t,r,i)=>{t?n.onConnect(e):n.hooks.value.connect.off(e),i(()=>{n.hooks.value.connect.off(e)})},{immediate:!0})}),(()=>{let e=[`id`,`modelValue`,`translateExtent`,`nodeExtent`,`edges`,`nodes`,`maxZoom`,`minZoom`,`applyDefault`,`autoConnect`];for(let i of Object.keys(t)){let o=i;if(!e.includes(o)){let e=a(()=>t[o]),i=n[o];p(i)&&r.run(()=>{S(e,e=>{KD(e)&&(i.value=e)},{immediate:!0})})}}})()}),()=>r.stop()}function wO(){return{edgesChange:$(),nodesChange:$(),nodeDoubleClick:$(),nodeClick:$(),nodeMouseEnter:$(),nodeMouseMove:$(),nodeMouseLeave:$(),nodeContextMenu:$(),nodeDragStart:$(),nodeDrag:$(),nodeDragStop:$(),nodesInitialized:$(),miniMapNodeClick:$(),miniMapNodeDoubleClick:$(),miniMapNodeMouseEnter:$(),miniMapNodeMouseMove:$(),miniMapNodeMouseLeave:$(),connect:$(),connectStart:$(),connectEnd:$(),clickConnectStart:$(),clickConnectEnd:$(),paneReady:$(),init:$(),move:$(),moveStart:$(),moveEnd:$(),selectionDragStart:$(),selectionDrag:$(),selectionDragStop:$(),selectionContextMenu:$(),selectionStart:$(),selectionEnd:$(),viewportChangeStart:$(),viewportChange:$(),viewportChangeEnd:$(),paneScroll:$(),paneClick:$(),paneContextMenu:$(),paneMouseEnter:$(),paneMouseMove:$(),paneMouseLeave:$(),edgeContextMenu:$(),edgeMouseEnter:$(),edgeMouseMove:$(),edgeMouseLeave:$(),edgeDoubleClick:$(),edgeClick:$(),edgeUpdateStart:$(),edgeUpdate:$(),edgeUpdateEnd:$(),updateNodeInternals:$(),error:$(e=>HD(e.message))}}function TO(e,t){let n=w();ie(()=>{for(let[n,i]of Object.entries(t.value))i.setEmitter(t=>{e(n,t)}),By(i.removeEmitter),i.setHasEmitListeners(()=>r(n)),By(i.removeHasEmitListeners)});function r(e){let t=EO(e);return!!n?.vnode.props?.[t]}}function EO(e){let[t,...n]=e.split(`:`);return`on${t.replace(/(?:^|-)(\w)/g,(e,t)=>t.toUpperCase())}${n.length?`:${n.join(`:`)}`:``}`}function DO(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[-1/0,-1/0],[1/0,1/0]],nodeExtent:[[-1/0,-1/0],[1/0,1/0]],selectionMode:$T.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:rE.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:`#b1b1b7`,connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:eE.Bezier,style:{}},connectionMode:tE.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:NaN,y:NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:`Shift`,multiSelectionKeyCode:DD()?`Meta`:`Control`,zoomActivationKeyCode:DD()?`Meta`:`Control`,deleteKeyCode:`Backspace`,panActivationKeyCode:`Space`,hooks:wO(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:`nodrag`,noWheelClassName:`nowheel`,noPanClassName:`nopan`,defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:``}}var OO=[`id`,`vueFlowRef`,`viewportRef`,`initialized`,`modelValue`,`nodes`,`edges`,`maxZoom`,`minZoom`,`translateExtent`,`hooks`,`defaultEdgeOptions`];function kO(e,t,n){let r=xO(e),i=t=>{let n=t??[];e.hooks.updateNodeInternals.trigger(n)},a=t=>NE(t,e.nodes,e.edges),o=t=>ME(t,e.nodes,e.edges),s=t=>WE(t,e.edges),c=({id:t,type:n,nodeId:r})=>{let i=t?`-${n}-${t}`:`-${n}`;return Array.from(e.connectionLookup.get(`${r}${i}`)?.values()??[])},l=e=>{if(e)return t.value.get(e)},u=e=>{if(e)return n.value.get(e)},d=(t,n,r)=>{let i=[];for(let e of t){let t={id:e.id,type:`position`,dragging:r,from:e.from};if(n&&(t.position=e.position,e.parentNode)){let n=l(e.parentNode);t.position={x:t.position.x-(n?.computedPosition?.x??0),y:t.position.y-(n?.computedPosition?.y??0)}}i.push(t)}i?.length&&e.hooks.nodesChange.trigger(i)},f=t=>{if(!e.vueFlowRef)return;let n=e.vueFlowRef.querySelector(`.vue-flow__transformationpane`);if(!n)return;let i=window.getComputedStyle(n),{m22:a}=new window.DOMMatrixReadOnly(i.transform),o=[];for(let e of t){let t=e,n=l(t.id);if(n){let e=bE(t.nodeElement);if(e.width&&e.height&&(n.dimensions.width!==e.width||n.dimensions.height!==e.height||t.forceUpdate)){let r=t.nodeElement.getBoundingClientRect();n.dimensions=e,n.handleBounds.source=WD(`source`,t.nodeElement,r,a,n.id),n.handleBounds.target=WD(`target`,t.nodeElement,r,a,n.id),o.push({id:n.id,type:`dimensions`,dimensions:e})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&r.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),o.length&&e.hooks.nodesChange.trigger(o)},p=(r,i)=>{let a=new Set,o=new Set;for(let e of r)TE(e)?a.add(e.id):wE(e)&&o.add(e.id);let s=sD(t.value,a,!0),c=sD(n.value,o);if(e.multiSelectionActive){for(let e of a)s.push(rD(e,i));for(let e of o)c.push(rD(e,i))}s.length&&e.hooks.nodesChange.trigger(s),c.length&&e.hooks.edgesChange.trigger(c)},m=r=>{if(e.multiSelectionActive){let t=r.map(e=>rD(e.id,!0));e.hooks.nodesChange.trigger(t);return}e.hooks.nodesChange.trigger(sD(t.value,new Set(r.map(e=>e.id)),!0)),e.hooks.edgesChange.trigger(sD(n.value))},h=r=>{if(e.multiSelectionActive){let t=r.map(e=>rD(e.id,!0));e.hooks.edgesChange.trigger(t);return}e.hooks.edgesChange.trigger(sD(n.value,new Set(r.map(e=>e.id)))),e.hooks.nodesChange.trigger(sD(t.value,new Set,!0))},g=e=>{p(e,!0)},_=t=>{let n=(t||e.nodes).map(e=>(e.selected=!1,rD(e.id,!1)));e.hooks.nodesChange.trigger(n)},v=t=>{let n=(t||e.edges).map(e=>(e.selected=!1,rD(e.id,!1)));e.hooks.edgesChange.trigger(n)},y=t=>{if(!t||!t.length)return p([],!1);let n=t.reduce((e,t)=>{let n=rD(t.id,!1);return TE(t)?e.nodes.push(n):e.edges.push(n),e},{nodes:[],edges:[]});n.nodes.length&&e.hooks.nodesChange.trigger(n.nodes),n.edges.length&&e.hooks.edgesChange.trigger(n.edges)},b=t=>{var n;(n=e.d3Zoom)==null||n.scaleExtent([t,e.maxZoom]),e.minZoom=t},x=t=>{var n;(n=e.d3Zoom)==null||n.scaleExtent([e.minZoom,t]),e.maxZoom=t},S=t=>{var n;(n=e.d3Zoom)==null||n.translateExtent(t),e.translateExtent=t},C=t=>{e.nodeExtent=t,i()},w=t=>{var n;(n=e.d3Zoom)==null||n.clickDistance(t)},T=t=>{e.nodesDraggable=t,e.nodesConnectable=t,e.elementsSelectable=t},E=t=>{let n=t instanceof Function?t(e.nodes):t;(e.initialized||n.length)&&(e.nodes=YD(n,l,e.hooks.error.trigger))},D=t=>{let r=t instanceof Function?t(e.edges):t;if(!e.initialized&&!r.length)return;let i=$D(r,e.isValidConnection,l,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ZD(e.connectionLookup,n.value,i),e.edges=i},ee=t=>{let n=t instanceof Function?t([...e.nodes,...e.edges]):t;(e.initialized||n.length)&&(E(n.filter(TE)),D(n.filter(wE)))},O=t=>{let n=t instanceof Function?t(e.nodes):t;n=Array.isArray(n)?n:[n];let r=YD(n,l,e.hooks.error.trigger),i=[];for(let e of r)i.push(iD(e));i.length&&e.hooks.nodesChange.trigger(i)},k=t=>{let n=t instanceof Function?t(e.edges):t;n=Array.isArray(n)?n:[n];let r=$D(n,e.isValidConnection,l,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),i=[];for(let e of r)i.push(iD(e));i.length&&e.hooks.edgesChange.trigger(i)},A=(t,n=!0,r=!1)=>{let i=t instanceof Function?t(e.nodes):t,a=Array.isArray(i)?i:[i],o=[],c=[];function u(e){let t=s(e);for(let e of t)(!KD(e.deletable)||e.deletable)&&c.push(oD(e.id,e.source,e.target,e.sourceHandle,e.targetHandle))}function d(t){let r=[];for(let n of e.nodes)n.parentNode===t&&r.push(n);if(r.length){for(let e of r)o.push(aD(e.id));n&&u(r);for(let e of r)d(e.id)}}for(let e of a){let t=typeof e==`string`?l(e):e;t&&(!KD(t.deletable)||t.deletable)&&(o.push(aD(t.id)),n&&u([t]),r&&d(t.id))}c.length&&e.hooks.edgesChange.trigger(c),o.length&&e.hooks.nodesChange.trigger(o)},j=t=>{let n=t instanceof Function?t(e.edges):t,r=Array.isArray(n)?n:[n],i=[];for(let e of r){let t=typeof e==`string`?u(e):e;t&&(!KD(t.deletable)||t.deletable)&&i.push(oD(typeof e==`string`?e:e.id,t.source,t.target,t.sourceHandle,t.targetHandle))}e.hooks.edgesChange.trigger(i)},M=(t,r,i=!0)=>{let a=u(t.id);if(!a)return!1;let o=e.edges.indexOf(a),s=JD(t,r,a,i,e.hooks.error.trigger);if(s){let[t]=$D([s],e.isValidConnection,l,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((e,n)=>n===o?t:e),ZD(e.connectionLookup,n.value,[t]),t}return!1},N=(e,t,n={replace:!1})=>{let r=u(e);if(!r)return;let i=typeof t==`function`?t(r):t;r.data=n.replace?i:{...r.data,...i}},P=t=>nD(t,e.nodes),F=t=>{let r=nD(t,e.edges);return ZD(e.connectionLookup,n.value,r),r},I=(t,n,r={replace:!1})=>{let i=l(t);if(!i)return;let a=typeof n==`function`?n(i):n;r.replace?e.nodes.splice(e.nodes.indexOf(i),1,a):Object.assign(i,a)},L=(e,t,n={replace:!1})=>{let r=l(e);if(!r)return;let i=typeof t==`function`?t(r):t;r.data=n.replace?i:{...r.data,...i}},te=(t,n,r=!1)=>{r?e.connectionClickStartHandle=t:e.connectionStartHandle=t,e.connectionEndHandle=null,e.connectionStatus=null,n&&(e.connectionPosition=n)},ne=(t,n=null,r=null)=>{e.connectionStartHandle&&(e.connectionPosition=t,e.connectionEndHandle=n,e.connectionStatus=r)},R=(t,n)=>{e.connectionPosition={x:NaN,y:NaN},e.connectionEndHandle=null,e.connectionStatus=null,n?e.connectionClickStartHandle=null:e.connectionStartHandle=null},z=e=>{let t=OE(e),n=t?null:EE(e)?e:l(e.id);return!t&&!n?[null,null,t]:[t?e:vE(n),n,t]},B=(t,n=!0,r=e.nodes)=>{let[i,a,o]=z(t);if(!i)return[];let s=[];for(let t of r||e.nodes){if(!o&&(t.id===a.id||!t.computedPosition))continue;let e=vE(t),r=yE(e,i);(n&&r>0||r>=e.width*e.height||r>=Number(i.width)*Number(i.height))&&s.push(t)}return s},V=(e,t,n=!0)=>{let[r]=z(e);if(!r)return!1;let i=yE(r,t);return n&&i>0||i>=Number(r.width)*Number(r.height)},re=t=>{let{viewport:n,dimensions:r,d3Zoom:i,d3Selection:a,translateExtent:o}=e;if(!i||!a||!t.x&&!t.y)return!1;let s=HT.translate(n.x+t.x,n.y+t.y).scale(n.zoom),c=[[0,0],[r.width,r.height]],l=i.constrain()(s,c,o),u=e.viewport.x!==l.x||e.viewport.y!==l.y||e.viewport.zoom!==l.k;return i.transform(a,l),u},H=t=>{let n=t instanceof Function?t(e):t,r=[`d3Zoom`,`d3Selection`,`d3ZoomHandler`,`viewportRef`,`vueFlowRef`,`dimensions`,`hooks`];KD(n.defaultEdgeOptions)&&(e.defaultEdgeOptions=n.defaultEdgeOptions);let i=n.modelValue||n.nodes||n.edges?[]:void 0;i&&(n.modelValue&&i.push(...n.modelValue),n.nodes&&i.push(...n.nodes),n.edges&&i.push(...n.edges),ee(i));let a=()=>{KD(n.maxZoom)&&x(n.maxZoom),KD(n.minZoom)&&b(n.minZoom),KD(n.translateExtent)&&S(n.translateExtent)};for(let t of Object.keys(n)){let i=t,a=n[i];![...OO,...r].includes(i)&&KD(a)&&(e[i]=a)}tb(()=>e.d3Zoom).not.toBeNull().then(a),e.initialized||=!0};return{updateNodePositions:d,updateNodeDimensions:f,setElements:ee,setNodes:E,setEdges:D,addNodes:O,addEdges:k,removeNodes:A,removeEdges:j,findNode:l,findEdge:u,updateEdge:M,updateEdgeData:N,updateNode:I,updateNodeData:L,applyEdgeChanges:F,applyNodeChanges:P,addSelectedElements:g,addSelectedNodes:m,addSelectedEdges:h,setMinZoom:b,setMaxZoom:x,setTranslateExtent:S,setNodeExtent:C,setPaneClickDistance:w,removeSelectedElements:y,removeSelectedNodes:_,removeSelectedEdges:v,startConnection:te,updateConnection:ne,endConnection:R,setInteractive:T,setState:H,getIntersectingNodes:B,getIncomers:a,getOutgoers:o,getConnectedEdges:s,getHandleConnections:c,isNodeIntersecting:V,panBy:re,fitView:e=>r.value.fitView(e),zoomIn:e=>r.value.zoomIn(e),zoomOut:e=>r.value.zoomOut(e),zoomTo:(e,t)=>r.value.zoomTo(e,t),setViewport:(e,t)=>r.value.setViewport(e,t),setTransform:(e,t)=>r.value.setTransform(e,t),getViewport:()=>r.value.getViewport(),getTransform:()=>r.value.getTransform(),setCenter:(e,t,n)=>r.value.setCenter(e,t,n),fitBounds:(e,t)=>r.value.fitBounds(e,t),project:e=>r.value.project(e),screenToFlowCoordinate:e=>r.value.screenToFlowCoordinate(e),flowToScreenCoordinate:e=>r.value.flowToScreenCoordinate(e),toObject:()=>{let t=[],n=[];for(let n of e.nodes){let{computedPosition:e,handleBounds:r,selected:i,dimensions:a,isParent:o,resizing:s,dragging:c,events:l,...u}=n;t.push(u)}for(let t of e.edges){let{selected:e,sourceNode:r,targetNode:i,events:a,...o}=t;n.push(o)}return JSON.parse(JSON.stringify({nodes:t,edges:n,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:t=>new Promise(n=>{let{nodes:i,edges:a,position:o,zoom:s,viewport:c}=t;i&&E(i),a&&D(a);let[l,u]=c?.x&&c?.y?[c.x,c.y]:o??[null,null];if(l&&u){let t=c?.zoom||s||e.viewport.zoom;return tb(()=>r.value.viewportInitialized).toBe(!0).then(()=>{r.value.setViewport({x:l,y:u,zoom:t}).then(()=>{n(!0)})})}n(!0)}),updateNodeInternals:i,viewportHelper:r,$reset:()=>{let t=DO();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){let n=HT.translate(t.defaultViewport.x??0,t.defaultViewport.y??0).scale(xE(t.defaultViewport.zoom??1,t.minZoom,t.maxZoom)),r=e.viewportRef.getBoundingClientRect(),i=[[0,0],[r.width,r.height]],a=e.d3Zoom.constrain()(n,i,t.translateExtent);e.d3Zoom.transform(e.d3Selection,a)}H(t)},$destroy:()=>{}}}var AO=[`data-id`,`data-handleid`,`data-nodeid`,`data-handlepos`],jO=R({name:`Handle`,compatConfig:{MODE:3},props:{id:{default:null},type:{},position:{default:()=>QT.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){let i=D(e,[`position`,`connectable`,`connectableStart`,`connectableEnd`,`id`]),o=a(()=>i.type??`source`),s=a(()=>i.isValidConnection??null),{id:c,connectionStartHandle:l,connectionClickStartHandle:u,connectionEndHandle:d,vueFlowRef:f,nodesConnectable:p,noDragClassName:m,noPanClassName:h}=mk(),{id:g,node:_,nodeEl:v,connectedEdges:y}=pO(),b=r(),x=a(()=>e.connectableStart===void 0||e.connectableStart),S=a(()=>e.connectableEnd===void 0||e.connectableEnd),C=a(()=>l.value?.nodeId===g&&l.value?.id===e.id&&l.value?.type===o.value||d.value?.nodeId===g&&d.value?.id===e.id&&d.value?.type===o.value),w=a(()=>u.value?.nodeId===g&&u.value?.id===e.id&&u.value?.type===o.value),{handlePointerDown:T,handleClick:E}=dO({nodeId:g,handleId:e.id,isValidConnection:s,type:o}),ee=L(()=>typeof e.connectable==`string`&&e.connectable===`single`?!y.value.some(t=>{let n=t[`${o.value}Handle`];return t[o.value]===g?!n||n===e.id:!1}):typeof e.connectable==`number`?y.value.filter(t=>{let n=t[`${o.value}Handle`];return t[o.value]===g?!n||n===e.id:!1}).length<e.connectable:typeof e.connectable==`function`?e.connectable(_,y.value):KD(e.connectable)?e.connectable:p.value);N(()=>{if(!_.dimensions.width||!_.dimensions.height)return;let t=_.handleBounds[o.value]?.find(t=>t.id===e.id);if(!f.value||t)return;let n=f.value.querySelector(`.vue-flow__transformationpane`);if(!v.value||!b.value||!n||!e.id)return;let r=v.value.getBoundingClientRect(),i=b.value.getBoundingClientRect(),a=window.getComputedStyle(n),{m22:s}=new window.DOMMatrixReadOnly(a.transform),c={id:e.id,position:e.position,x:(i.left-r.left)/s,y:(i.top-r.top)/s,type:o.value,nodeId:g,...bE(b.value)};_.handleBounds[o.value]=[..._.handleBounds[o.value]??[],c]});function O(e){let t=wD(e);ee.value&&x.value&&(t&&e.button===0||!t)&&T(e)}function k(e){g&&(u.value||x.value)&&ee.value&&E(e)}return t({handleClick:E,handlePointerDown:T,onClick:k,onPointerDown:O}),(t,r)=>(z(),j(`div`,{ref_key:`handle`,ref:b,"data-id":`${n(c)}-${n(g)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":n(g),"data-handlepos":t.position,class:P([`vue-flow__handle`,[`vue-flow__handle-${t.position}`,`vue-flow__handle-${e.id}`,n(m),n(h),o.value,{connectable:ee.value,connecting:w.value,connectablestart:x.value,connectableend:S.value,connectionindicator:ee.value&&(x.value&&!C.value||S.value&&C.value)}]]),onMousedown:O,onTouchstartPassive:O,onClick:k},[le(t.$slots,`default`,{id:t.id})],42,AO))}}),MO=function({sourcePosition:e=QT.Bottom,targetPosition:t=QT.Top,label:n,connectable:r=!0,isValidTargetPos:i,isValidSourcePos:a,data:o}){let s=o.label??n;return[_(jO,{type:`target`,position:t,connectable:r,isValidConnection:i}),typeof s!=`string`&&s?_(s):_(V,[s]),_(jO,{type:`source`,position:e,connectable:r,isValidConnection:a})]};MO.props=[`sourcePosition`,`targetPosition`,`label`,`isValidTargetPos`,`isValidSourcePos`,`connectable`,`data`],MO.inheritAttrs=!1,MO.compatConfig={MODE:3};var NO=MO,PO=function({targetPosition:e=QT.Top,label:t,connectable:n=!0,isValidTargetPos:r,data:i}){let a=i.label??t;return[_(jO,{type:`target`,position:e,connectable:n,isValidConnection:r}),typeof a!=`string`&&a?_(a):_(V,[a])]};PO.props=[`targetPosition`,`label`,`isValidTargetPos`,`connectable`,`data`],PO.inheritAttrs=!1,PO.compatConfig={MODE:3};var FO=PO,IO=function({sourcePosition:e=QT.Bottom,label:t,connectable:n=!0,isValidSourcePos:r,data:i}){let a=i.label??t;return[typeof a!=`string`&&a?_(a):_(V,[a]),_(jO,{type:`source`,position:e,connectable:n,isValidConnection:r})]};IO.props=[`sourcePosition`,`label`,`isValidSourcePos`,`connectable`,`data`],IO.inheritAttrs=!1,IO.compatConfig={MODE:3};var LO=IO,RO=[`transform`],zO=[`width`,`height`,`x`,`y`,`rx`,`ry`],BO=[`y`],VO=R({name:`EdgeText`,compatConfig:{MODE:3},props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){let t=r({x:0,y:0,width:0,height:0}),n=r(null),i=L(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);N(a),S([()=>e.x,()=>e.y,n,()=>e.label],a);function a(){if(!n.value)return;let e=n.value.getBBox();(e.width!==t.value.width||e.height!==t.value.height)&&(t.value=e)}return(e,r)=>(z(),j(`g`,{transform:i.value,class:`vue-flow__edge-textwrapper`},[e.labelShowBg?(z(),j(`rect`,{key:0,class:`vue-flow__edge-textbg`,width:`${t.value.width+2*e.labelBgPadding[0]}px`,height:`${t.value.height+2*e.labelBgPadding[1]}px`,x:-e.labelBgPadding[0],y:-e.labelBgPadding[1],style:B(e.labelBgStyle),rx:e.labelBgBorderRadius,ry:e.labelBgBorderRadius},null,12,zO)):K(``,!0),A(`text`,F(e.$attrs,{ref_key:`el`,ref:n,class:`vue-flow__edge-text`,y:t.value.height/2,dy:`0.3em`,style:e.labelStyle}),[le(e.$slots,`default`,{},()=>[typeof e.label==`string`?(z(),j(V,{key:1},[b(U(e.label),1)],64)):(z(),W(G(e.label),{key:0}))])],16,BO)],8,RO))}}),HO=[`id`,`d`,`marker-end`,`marker-start`],UO=[`d`,`stroke-width`],WO=R({name:`BaseEdge`,inheritAttrs:!1,compatConfig:{MODE:3},props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){let i=r(null),a=r(null),o=r(null),s=E();return t({pathEl:i,interactionEl:a,labelEl:o}),(e,t)=>(z(),j(V,null,[A(`path`,F(n(s),{id:e.id,ref_key:`pathEl`,ref:i,d:e.path,class:`vue-flow__edge-path`,"marker-end":e.markerEnd,"marker-start":e.markerStart}),null,16,HO),e.interactionWidth?(z(),j(`path`,{key:0,ref_key:`interactionEl`,ref:a,fill:`none`,d:e.path,"stroke-width":e.interactionWidth,"stroke-opacity":0,class:`vue-flow__edge-interaction`},null,8,UO)):K(``,!0),e.label&&e.labelX&&e.labelY?(z(),W(VO,{key:1,ref_key:`labelEl`,ref:o,x:e.labelX,y:e.labelY,label:e.label,"label-show-bg":e.labelShowBg,"label-bg-style":e.labelBgStyle,"label-bg-padding":e.labelBgPadding,"label-bg-border-radius":e.labelBgBorderRadius,"label-style":e.labelStyle},null,8,[`x`,`y`,`label`,`label-show-bg`,`label-bg-style`,`label-bg-padding`,`label-bg-border-radius`,`label-style`])):K(``,!0)],64))}});function GO({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function KO({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function qO(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function JO({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){let o,s;switch(e){case QT.Left:o=t-qO(t-r,a),s=n;break;case QT.Right:o=t+qO(r-t,a),s=n;break;case QT.Top:o=t,s=n-qO(n-i,a);break;case QT.Bottom:o=t,s=n+qO(i-n,a)}return[o,s]}function YO(e){let{sourceX:t,sourceY:n,sourcePosition:r=QT.Bottom,targetX:i,targetY:a,targetPosition:o=QT.Top,curvature:s=.25}=e,[c,l]=JO({pos:r,x1:t,y1:n,x2:i,y2:a,c:s}),[u,d]=JO({pos:o,x1:i,y1:a,x2:t,y2:n,c:s}),[f,p,m,h]=KO({sourceX:t,sourceY:n,targetX:i,targetY:a,sourceControlX:c,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${t},${n} C${c},${l} ${u},${d} ${i},${a}`,f,p,m,h]}function XO({pos:e,x1:t,y1:n,x2:r,y2:i}){let a,o;switch(e){case QT.Left:case QT.Right:a=.5*(t+r),o=n;break;case QT.Top:case QT.Bottom:a=t,o=.5*(n+i)}return[a,o]}function ZO(e){let{sourceX:t,sourceY:n,sourcePosition:r=QT.Bottom,targetX:i,targetY:a,targetPosition:o=QT.Top}=e,[s,c]=XO({pos:r,x1:t,y1:n,x2:i,y2:a}),[l,u]=XO({pos:o,x1:i,y1:a,x2:t,y2:n}),[d,f,p,m]=KO({sourceX:t,sourceY:n,targetX:i,targetY:a,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${t},${n} C${s},${c} ${l},${u} ${i},${a}`,d,f,p,m]}var QO={[QT.Left]:{x:-1,y:0},[QT.Right]:{x:1,y:0},[QT.Top]:{x:0,y:-1},[QT.Bottom]:{x:0,y:1}};function $O({source:e,sourcePosition:t=QT.Bottom,target:n}){return t===QT.Left||t===QT.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1}}function ek(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function tk({source:e,sourcePosition:t=QT.Bottom,target:n,targetPosition:r=QT.Top,center:i,offset:a}){let o=QO[t],s=QO[r],c={x:e.x+o.x*a,y:e.y+o.y*a},l={x:n.x+s.x*a,y:n.y+s.y*a},u=$O({source:c,sourcePosition:t,target:l}),d=u.x===0?`y`:`x`,f=u[d],p,m,h,g={x:0,y:0},_={x:0,y:0},[v,y,b,x]=GO({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[d]*s[d]===-1){m=i.x??v,h=i.y??y;let e=[{x:m,y:c.y},{x:m,y:l.y}],t=[{x:c.x,y:h},{x:l.x,y:h}];p=o[d]===f?d===`x`?e:t:d===`x`?t:e}else{let i=[{x:c.x,y:l.y}],u=[{x:l.x,y:c.y}];if(p=d===`x`?o.x===f?u:i:o.y===f?i:u,t===r){let t=Math.abs(e[d]-n[d]);if(t<=a){let r=Math.min(a-1,a-t);o[d]===f?g[d]=(c[d]>e[d]?-1:1)*r:_[d]=(l[d]>n[d]?-1:1)*r}}if(t!==r){let e=d===`x`?`y`:`x`,t=o[d]===s[e],n=c[e]>l[e],r=c[e]<l[e];(o[d]===1&&(!t&&n||t&&r)||o[d]!==1&&(!t&&r||t&&n))&&(p=d===`x`?i:u)}let v={x:c.x+g.x,y:c.y+g.y},y={x:l.x+_.x,y:l.y+_.y};Math.max(Math.abs(v.x-p[0].x),Math.abs(y.x-p[0].x))>=Math.max(Math.abs(v.y-p[0].y),Math.abs(y.y-p[0].y))?(m=(v.x+y.x)/2,h=p[0].y):(m=p[0].x,h=(v.y+y.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...p,{x:l.x+_.x,y:l.y+_.y},n],m,h,b,x]}function nk(e,t,n,r){let i=Math.min(ek(e,t)/2,ek(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function rk(e){let{sourceX:t,sourceY:n,sourcePosition:r=QT.Bottom,targetX:i,targetY:a,targetPosition:o=QT.Top,borderRadius:s=5,centerX:c,centerY:l,offset:u=20}=e,[d,f,p,m,h]=tk({source:{x:t,y:n},sourcePosition:r,target:{x:i,y:a},targetPosition:o,center:{x:c,y:l},offset:u});return[d.reduce((e,t,n)=>{let r;return r=n>0&&n<d.length-1?nk(d[n-1],t,d[n+1],s):`${n===0?`M`:`L`}${t.x} ${t.y}`,e+=r,e},``),f,p,m,h]}function ik(e){let{sourceX:t,sourceY:n,targetX:r,targetY:i}=e,[a,o,s,c]=GO({sourceX:t,sourceY:n,targetX:r,targetY:i});return[`M ${t},${n}L ${r},${i}`,a,o,s,c]}var ak=R({name:`StraightEdge`,props:[`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`markerEnd`,`markerStart`,`interactionWidth`],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{let[n,r,i]=ik(e);return _(WO,{path:n,labelX:r,labelY:i,...t,...e})}}}),ok=R({name:`SmoothStepEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`borderRadius`,`markerEnd`,`markerStart`,`interactionWidth`,`offset`],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{let[n,r,i]=rk({...e,sourcePosition:e.sourcePosition??QT.Bottom,targetPosition:e.targetPosition??QT.Top});return _(WO,{path:n,labelX:r,labelY:i,...t,...e})}}}),sk=R({name:`StepEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`markerEnd`,`markerStart`,`interactionWidth`],setup(e,{attrs:t}){return()=>_(ok,{...e,...t,borderRadius:0})}}),ck=R({name:`BezierEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`curvature`,`markerEnd`,`markerStart`,`interactionWidth`],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{let[n,r,i]=YO({...e,sourcePosition:e.sourcePosition??QT.Bottom,targetPosition:e.targetPosition??QT.Top});return _(WO,{path:n,labelX:r,labelY:i,...t,...e})}}}),lk=R({name:`SimpleBezierEdge`,props:[`sourcePosition`,`targetPosition`,`label`,`labelStyle`,`labelShowBg`,`labelBgStyle`,`labelBgPadding`,`labelBgBorderRadius`,`sourceY`,`sourceX`,`targetX`,`targetY`,`markerEnd`,`markerStart`,`interactionWidth`],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{let[n,r,i]=ZO({...e,sourcePosition:e.sourcePosition??QT.Bottom,targetPosition:e.targetPosition??QT.Top});return _(WO,{path:n,labelX:r,labelY:i,...t,...e})}}}),uk={input:LO,default:NO,output:FO},dk={default:ck,straight:ak,step:sk,smoothstep:ok,simplebezier:lk};function fk(e,t,n){let r=L(()=>e=>t.value.get(e)),i=L(()=>e=>n.value.get(e)),a=L(()=>{let t={...dk,...e.edgeTypes},n=Object.keys(t);for(let r of e.edges)r.type&&!n.includes(r.type)&&(t[r.type]=r.type);return t}),o=L(()=>{let t={...uk,...e.nodeTypes},n=Object.keys(t);for(let r of e.nodes)r.type&&!n.includes(r.type)&&(t[r.type]=r.type);return t}),s=L(()=>e.onlyRenderVisibleElements?UE(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),c=L(()=>{if(e.onlyRenderVisibleElements){let n=[];for(let r of e.edges){let i=t.value.get(r.source),a=t.value.get(r.target);yD({sourcePos:i.computedPosition||{x:0,y:0},targetPos:a.computedPosition||{x:0,y:0},sourceWidth:i.dimensions.width,sourceHeight:i.dimensions.height,targetWidth:a.dimensions.width,targetHeight:a.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&n.push(r)}return n}return e.edges}),l=L(()=>[...s.value,...c.value]),u=L(()=>{let t=[];for(let n of e.nodes)n.selected&&t.push(n);return t}),d=L(()=>{let t=[];for(let n of e.edges)n.selected&&t.push(n);return t}),f=L(()=>[...u.value,...d.value]),p=L(()=>{let t=[];for(let n of e.nodes)n.dimensions.width&&n.dimensions.height&&n.handleBounds!==void 0&&t.push(n);return t});return{getNode:r,getEdge:i,getElements:l,getEdgeTypes:a,getNodeTypes:o,getEdges:c,getNodes:s,getSelectedElements:f,getSelectedNodes:u,getSelectedEdges:d,getNodesInitialized:p,areNodesInitialized:L(()=>s.value.length>0&&p.value.length===s.value.length)}}var pk=class e{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){let t=w()?.appContext.app,n=t?.config.globalProperties.$vueFlowStorage??e.instance;return e.instance=n??new e,t&&(t.config.globalProperties.$vueFlowStorage=e.instance),e.instance}set(e,t){return this.flows.set(e,t)}get(e){return this.flows.get(e)}remove(e){return this.flows.delete(e)}create(e,t){let n=DO(),r=h(n),i={};for(let[e,t]of Object.entries(r.hooks)){let n=`on${e.charAt(0).toUpperCase()+e.slice(1)}`;i[n]=t.on}let a={};for(let[e,t]of Object.entries(r.hooks))a[e]=t.trigger;let o=L(()=>{let e=new Map;for(let t of r.nodes)e.set(t.id,t);return e}),s=L(()=>{let e=new Map;for(let t of r.edges)e.set(t.id,t);return e}),c=fk(r,o,s),l=kO(r,o,s);l.setState({...r,...t});let u={...i,...c,...l,...$y(r),nodeLookup:o,edgeLookup:s,emits:a,id:e,vueFlowVersion:`1.48.2`,$destroy:()=>{this.remove(e)}};return this.set(e,u),u}getId(){return`vue-flow-${this.currentId++}`}};function mk(e){let t=pk.getInstance(),n=f(),r=typeof e==`object`,i=r?e:{id:e},a=i.id,o=a??n?.vueFlowId,s;if(n){let e=C(eO,null);e!=null&&(!o||e.id===o)&&(s=e)}if(s||o&&(s=t.get(o)),!s||o&&s.id!==o){let e=a??t.getId(),r=t.create(e,i);s=r,(n??u(!0)).run(()=>{S(r.applyDefault,(e,t,n)=>{let i=e=>{r.applyNodeChanges(e)},a=e=>{r.applyEdgeChanges(e)};e?(r.onNodesChange(i),r.onEdgesChange(a)):(r.hooks.value.nodesChange.off(i),r.hooks.value.edgesChange.off(a)),n(()=>{r.hooks.value.nodesChange.off(i),r.hooks.value.edgesChange.off(a)})},{immediate:!0}),By(()=>{if(s){let e=t.get(s.id);e?e.$destroy():HD(`No store instance found for id ${s.id} in storage.`)}})})}else r&&s.setState(i);return n&&(te(eO,s),n.vueFlowId=s.id),r&&w()?.type.name!==`VueFlow`&&s.emits.error(new CD(xD.USEVUEFLOW_OPTIONS)),s}function hk(e){let{emits:t,dimensions:n}=mk(),r;N(()=>{let i=()=>{var r;if(!e.value||!((r=e.value).checkVisibility?.call(r)??!0))return;let i=bE(e.value);(i.width===0||i.height===0)&&t.error(new CD(xD.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:i.width||500,height:i.height||500}};i(),window.addEventListener(`resize`,i),e.value&&(r=new ResizeObserver(()=>i()),r.observe(e.value)),ne(()=>{window.removeEventListener(`resize`,i),r&&e.value&&r.unobserve(e.value)})})}var gk=R({name:`UserSelection`,compatConfig:{MODE:3},props:{userSelectionRect:{}},setup(e){return(e,t)=>(z(),j(`div`,{class:`vue-flow__selection vue-flow__container`,style:B({width:`${e.userSelectionRect.width}px`,height:`${e.userSelectionRect.height}px`,transform:`translate(${e.userSelectionRect.x}px, ${e.userSelectionRect.y}px)`})},null,4))}}),_k=[`tabIndex`],vk=R({name:`NodesSelection`,compatConfig:{MODE:3},setup(e){let{emits:t,viewport:i,getSelectedNodes:a,noPanClassName:o,disableKeyboardA11y:s,userSelectionActive:c}=mk(),l=gO(),u=r(null),d=oO({el:u,onStart(e){t.selectionDragStart(e),t.nodeDragStart(e)},onDrag(e){t.selectionDrag(e),t.nodeDrag(e)},onStop(e){t.selectionDragStop(e),t.nodeDragStop(e)}});N(()=>{var e;s.value||(e=u.value)==null||e.focus({preventScroll:!0})});let f=L(()=>HE(a.value)),p=L(()=>({width:`${f.value.width}px`,height:`${f.value.height}px`,top:`${f.value.y}px`,left:`${f.value.x}px`}));function m(e){t.selectionContextMenu({event:e,nodes:a.value})}function h(e){s.value||_E[e.key]&&(e.preventDefault(),l({x:_E[e.key].x,y:_E[e.key].y},e.shiftKey))}return(e,t)=>!n(c)&&f.value.width&&f.value.height?(z(),j(`div`,{key:0,class:P([`vue-flow__nodesselection vue-flow__container`,n(o)]),style:B({transform:`translate(${n(i).x}px,${n(i).y}px) scale(${n(i).zoom})`})},[A(`div`,{ref_key:`el`,ref:u,class:P([{dragging:n(d)},`vue-flow__nodesselection-rect`]),style:B(p.value),tabIndex:n(s)?void 0:-1,onContextmenu:m,onKeydown:h},null,46,_k)],6)):K(``,!0)}});function yk(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}var bk=R({name:`Pane`,compatConfig:{MODE:3},props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){let{vueFlowRef:t,nodes:r,viewport:i,emits:s,userSelectionActive:c,removeSelectedElements:l,userSelectionRect:u,elementsSelectable:d,nodesSelectionActive:f,getSelectedEdges:p,getSelectedNodes:m,removeNodes:h,removeEdges:g,selectionMode:_,deleteKeyCode:v,multiSelectionKeyCode:y,multiSelectionActive:b,edgeLookup:x,nodeLookup:C,connectionLookup:w,defaultEdgeOptions:T,connectionStartHandle:E,panOnDrag:D}=mk(),ee=o(null),O=o(new Set),k=o(new Set),A=o(null),M=a(()=>d.value&&(e.isSelecting||c.value)),N=a(()=>E.value!==null),F=!1,I=!1,L=fE(v,{actInsideInputWithModifier:!1}),te=fE(y);S(L,e=>{e&&(h(m.value),g(p.value),f.value=!1)}),S(te,e=>{b.value=e});function ne(e,t){return n=>{n.target===t&&e?.(n)}}function R(e){if(F||N.value){F=!1;return}s.paneClick(e),l(),f.value=!1}function B(e){if(Array.isArray(D.value)&&D.value?.includes(2)){e.preventDefault();return}s.paneContextMenu(e)}function V(e){s.paneScroll(e)}function re(n){var r,i;if(A.value=t.value?.getBoundingClientRect()??null,!d.value||!e.isSelecting||n.button!==0||n.target!==ee.value||!A.value)return;(i=(r=n.target)?.setPointerCapture)==null||i.call(r,n.pointerId);let{x:a,y:o}=yk(n,A.value);I=!0,F=!1,l(),u.value={width:0,height:0,startX:a,startY:o,x:a,y:o},s.selectionStart(n)}function H(e){if(!A.value||!u.value)return;F=!0;let{x:t,y:n}=ED(e,A.value),{startX:a=0,startY:o=0}=u.value,l={startX:a,startY:o,x:t<a?t:a,y:n<o?n:o,width:Math.abs(t-a),height:Math.abs(n-o)},d=O.value,p=k.value;O.value=new Set(UE(r.value,l,i.value,_.value===$T.Partial,!0).map(e=>e.id)),k.value=new Set;let m=T.value?.selectable??!0;for(let e of O.value){let t=w.value.get(e);if(t)for(let{edgeId:e}of t.values()){let t=x.value.get(e);t&&(t.selectable??m)&&k.value.add(e)}}if(!QD(d,O.value)){let e=sD(C.value,O.value,!0);s.nodesChange(e)}if(!QD(p,k.value)){let e=sD(x.value,k.value);s.edgesChange(e)}u.value=l,c.value=!0,f.value=!1}function U(t){var n;t.button===0&&I&&((n=t.target)==null||n.releasePointerCapture(t.pointerId),!c.value&&u.value&&t.target===ee.value&&R(t),c.value=!1,u.value=null,f.value=O.value.size>0,s.selectionEnd(t),e.selectionKeyPressed&&(F=!1),I=!1)}return(e,t)=>(z(),j(`div`,{ref_key:`container`,ref:ee,class:P([`vue-flow__pane vue-flow__container`,{selection:e.isSelecting}]),onClick:t[0]||=e=>M.value?void 0:ne(R,ee.value)(e),onContextmenu:t[1]||=e=>ne(B,ee.value)(e),onWheelPassive:t[2]||=e=>ne(V,ee.value)(e),onPointerenter:t[3]||=e=>M.value?void 0:n(s).paneMouseEnter(e),onPointerdown:t[4]||=e=>M.value?re(e):n(s).paneMouseMove(e),onPointermove:t[5]||=e=>M.value?H(e):n(s).paneMouseMove(e),onPointerup:t[6]||=e=>M.value?U(e):void 0,onPointerleave:t[7]||=e=>n(s).paneMouseLeave(e)},[le(e.$slots,`default`),n(c)&&n(u)?(z(),W(gk,{key:0,"user-selection-rect":n(u)},null,8,[`user-selection-rect`])):K(``,!0),n(f)&&n(m).length?(z(),W(vk,{key:1})):K(``,!0)],34))}}),xk=R({name:`Transform`,compatConfig:{MODE:3},setup(e){let{viewport:t,fitViewOnInit:n,fitViewOnInitDone:r}=mk(),i=L(()=>n.value?!r.value:!1),a=L(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(e,t)=>(z(),j(`div`,{class:`vue-flow__transformationpane vue-flow__container`,style:B({transform:a.value,opacity:i.value?0:void 0})},[le(e.$slots,`default`)],4))}}),Sk=R({name:`Viewport`,compatConfig:{MODE:3},setup(e){let{minZoom:t,maxZoom:r,defaultViewport:i,translateExtent:s,zoomActivationKeyCode:c,selectionKeyCode:l,panActivationKeyCode:u,panOnScroll:d,panOnScrollMode:f,panOnScrollSpeed:p,panOnDrag:m,zoomOnDoubleClick:h,zoomOnPinch:g,zoomOnScroll:_,preventScrolling:v,noWheelClassName:b,noPanClassName:x,emits:C,connectionStartHandle:w,userSelectionActive:T,paneDragging:E,d3Zoom:D,d3Selection:ee,d3ZoomHandler:O,viewport:k,viewportRef:A,paneClickDistance:M}=mk();hk(A);let F=o(!1),I=o(!1),L=null,te=!1,ne=0,R={x:0,y:0,zoom:0},B=fE(u),V=fE(l),re=fE(c),U=a(()=>(!V.value||V.value&&l.value===!0)&&(B.value||m.value)),ie=a(()=>B.value||d.value),ae=a(()=>l.value===!0&&U.value!==!0),oe=a(()=>V.value&&l.value!==!0||T.value||ae.value),se=a(()=>w.value!==null);N(()=>{if(!A.value){HD(`Viewport element is missing`);return}let e=A.value,n=e.getBoundingClientRect(),a=ZT().clickDistance(M.value).scaleExtent([t.value,r.value]).translateExtent(s.value),o=mS(e).call(a),c=o.on(`wheel.zoom`),u=HT.translate(i.value.x??0,i.value.y??0).scale(xE(i.value.zoom??1,t.value,r.value)),y=[[0,0],[n.width,n.height]],w=a.constrain()(u,y,s.value);a.transform(o,w),a.wheelDelta(QE),D.value=a,ee.value=o,O.value=c,k.value={x:w.x,y:w.y,zoom:w.k},a.on(`start`,e=>{if(!e.sourceEvent)return null;ne=e.sourceEvent.button,F.value=!0;let t=G(e.transform);e.sourceEvent?.type===`mousedown`&&(E.value=!0),R=t,C.viewportChangeStart(t),C.moveStart({event:e,flowTransform:t})}),a.on(`end`,e=>{if(!e.sourceEvent)return null;if(F.value=!1,E.value=!1,ce(U.value,ne??0)&&!te&&C.paneContextMenu(e.sourceEvent),te=!1,W(R,e.transform)){let t=G(e.transform);R=t,C.viewportChangeEnd(t),C.moveEnd({event:e,flowTransform:t})}}),a.filter(e=>{let t=re.value||_.value,n=g.value&&e.ctrlKey,r=e.button,i=e.type===`wheel`;if(r===1&&e.type===`mousedown`&&(K(e,`vue-flow__node`)||K(e,`vue-flow__edge`)))return!0;if(!U.value&&!t&&!ie.value&&!h.value&&!g.value||T.value||se.value&&!i||!h.value&&e.type===`dblclick`||K(e,b.value)&&i||K(e,x.value)&&(!i||ie.value&&i&&!re.value)||!g.value&&e.ctrlKey&&i||!t&&!ie.value&&!n&&i)return!1;if(!g&&e.type===`touchstart`&&e.touches?.length>1)return e.preventDefault(),!1;if(!U.value&&(e.type===`mousedown`||e.type===`touchstart`)||ae.value&&Array.isArray(m.value)&&m.value.includes(0)&&r===0||Array.isArray(m.value)&&!m.value.includes(r)&&(e.type===`mousedown`||e.type===`touchstart`))return!1;let a=Array.isArray(m.value)&&m.value.includes(r)||l.value===!0&&Array.isArray(m.value)&&!m.value.includes(0)||!r||r<=1;return(!e.ctrlKey||B.value||i)&&a}),S([T,U],()=>{T.value&&!F.value?a.on(`zoom`,null):T.value||a.on(`zoom`,e=>{k.value={x:e.transform.x,y:e.transform.y,zoom:e.transform.k};let t=G(e.transform);te=ce(U.value,ne??0),C.viewportChange(t),C.move({event:e,flowTransform:t})})},{immediate:!0}),S([T,ie,f,re,g,v,b],()=>{ie.value&&!re.value&&!T.value?o.on(`wheel.zoom`,e=>{if(K(e,b.value))return!1;let t=re.value||_.value,n=g.value&&e.ctrlKey;if(!(!v.value||ie.value||t||n))return!1;e.preventDefault(),e.stopImmediatePropagation();let r=o.property(`__zoom`).k||1,i=DD();if(!B.value&&e.ctrlKey&&g.value&&i){let t=gS(e),n=r*2**QE(e);a.scaleTo(o,n,t,e);return}let s=e.deltaMode===1?20:1,c=f.value===rE.Vertical?0:e.deltaX*s,l=f.value===rE.Horizontal?0:e.deltaY*s;!i&&e.shiftKey&&f.value!==rE.Vertical&&!c&&l&&(c=l,l=0),a.translateBy(o,-(c/r)*p.value,-(l/r)*p.value);let u=G(o.property(`__zoom`));L&&clearTimeout(L),I.value?(C.move({event:e,flowTransform:u}),C.viewportChange(u),L=setTimeout(()=>{C.moveEnd({event:e,flowTransform:u}),C.viewportChangeEnd(u),I.value=!1},150)):(I.value=!0,C.moveStart({event:e,flowTransform:u}),C.viewportChangeStart(u))},{passive:!1}):c!==void 0&&o.on(`wheel.zoom`,function(e,t){let n=!v.value&&e.type===`wheel`&&!e.ctrlKey,r=re.value||_.value,i=g.value&&e.ctrlKey;if(!r&&!d.value&&!i&&e.type===`wheel`||n||K(e,b.value))return null;e.preventDefault(),c.call(this,e,t)},{passive:!1})},{immediate:!0})});function ce(e,t){return t===2&&Array.isArray(e)&&e.includes(2)}function W(e,t){return e.x!==t.x&&!Number.isNaN(t.x)||e.y!==t.y&&!Number.isNaN(t.y)||e.zoom!==t.k&&!Number.isNaN(t.k)}function G(e){return{x:e.x,y:e.y,zoom:e.k}}function K(e,t){return e.target.closest(`.${t}`)}return(e,t)=>(z(),j(`div`,{ref_key:`viewportRef`,ref:A,class:`vue-flow__viewport vue-flow__container`},[y(bk,{"is-selecting":oe.value,"selection-key-pressed":n(V),class:P({connecting:se.value,dragging:n(E),draggable:n(m)===!0||Array.isArray(n(m))&&n(m).includes(0)})},{default:H(()=>[y(xk,null,{default:H(()=>[le(e.$slots,`default`)]),_:3})]),_:3},8,[`is-selecting`,`selection-key-pressed`,`class`])],512))}}),Ck=[`id`],wk=[`id`],Tk=[`id`],Ek=R({name:`A11yDescriptions`,compatConfig:{MODE:3},setup(e){let{id:t,disableKeyboardA11y:r,ariaLiveMessage:i}=mk();return(e,a)=>(z(),j(V,null,[A(`div`,{id:`${n(pE)}-${n(t)}`,style:{display:`none`}},` Press enter or space to select a node. `+U(n(r)?``:`You can then use the arrow keys to move the node around.`)+` You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. `,9,Ck),A(`div`,{id:`${n(mE)}-${n(t)}`,style:{display:`none`}},` Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. `,8,wk),n(r)?K(``,!0):(z(),j(`div`,{key:0,id:`${n(hE)}-${n(t)}`,"aria-live":`assertive`,"aria-atomic":`true`,style:{position:`absolute`,width:`1px`,height:`1px`,margin:`-1px`,border:`0`,padding:`0`,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,"clip-path":`inset(100%)`}},U(n(i)),9,Tk))],64))}});function Dk(){let e=mk();S(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Ok(e,t,n){return n===QT.Left?e-t:n===QT.Right?e+t:e}function kk(e,t,n){return n===QT.Top?e-t:n===QT.Bottom?e+t:e}var Ak=function({radius:e=10,centerX:t=0,centerY:n=0,position:r=QT.Top,type:i}){return _(`circle`,{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:Ok(t,e,r),cy:kk(n,e,r),r:e,stroke:`transparent`,fill:`transparent`})};Ak.props=[`radius`,`centerX`,`centerY`,`position`,`type`],Ak.compatConfig={MODE:3};var jk=Ak,Mk=R({name:`Edge`,compatConfig:{MODE:3},props:[`id`],setup(e){let{id:t,addSelectedEdges:n,connectionMode:i,edgeUpdaterRadius:o,emits:s,nodesSelectionActive:c,noPanClassName:l,getEdgeTypes:u,removeSelectedEdges:d,findEdge:f,findNode:p,isValidConnection:m,multiSelectionActive:h,disableKeyboardA11y:g,elementsSelectable:v,edgesUpdatable:y,edgesFocusable:b,hooks:x}=mk(),S=L(()=>f(e.id)),{emit:T,on:E}=cO(S.value,s),D=C(aO),O=w(),k=r(!1),A=r(!1),j=r(``),M=r(null),N=r(`source`),P=r(null),F=a(()=>S.value.selectable===void 0?v.value:S.value.selectable),I=a(()=>S.value.updatable===void 0?y.value:S.value.updatable),ne=a(()=>S.value.focusable===void 0?b.value:S.value.focusable);te(rO,e.id),te(iO,P);let R=L(()=>S.value.class instanceof Function?S.value.class(S.value):S.value.class),z=L(()=>S.value.style instanceof Function?S.value.style(S.value):S.value.style),B=L(()=>{let e=S.value.type||`default`,t=D?.[`edge-${e}`];if(t)return t;let n=S.value.template??u.value[e];if(typeof n==`string`&&O){let t=Object.keys(O.appContext.components);t&&t.includes(e)&&(n=ee(e,!1))}return n&&typeof n!=`string`?n:(s.error(new CD(xD.EDGE_TYPE_MISSING,n)),!1)}),{handlePointerDown:V}=dO({nodeId:j,handleId:M,type:N,isValidConnection:m,edgeUpdaterType:N,onEdgeUpdate:U,onEdgeUpdateEnd:ie});return()=>{let n=p(S.value.source),r=p(S.value.target),a=`pathOptions`in S.value?S.value.pathOptions:{};if(!n&&!r)return s.error(new CD(xD.EDGE_SOURCE_TARGET_MISSING,S.value.id,S.value.source,S.value.target)),null;if(!n)return s.error(new CD(xD.EDGE_SOURCE_MISSING,S.value.id,S.value.source)),null;if(!r)return s.error(new CD(xD.EDGE_TARGET_MISSING,S.value.id,S.value.target)),null;if(!S.value||S.value.hidden||n.hidden||r.hidden)return null;let c;c=i.value===tE.Strict?n.handleBounds.source:[...n.handleBounds.source||[],...n.handleBounds.target||[]];let d=vD(c,S.value.sourceHandle),f;f=i.value===tE.Strict?r.handleBounds.target:[...r.handleBounds.target||[],...r.handleBounds.source||[]];let m=vD(f,S.value.targetHandle),h=d?.position||QT.Bottom,g=m?.position||QT.Top,{x:v,y}=_D(n,d,h),{x:b,y:C}=_D(r,m,g);return S.value.sourceX=v,S.value.sourceY=y,S.value.targetX=b,S.value.targetY=C,_(`g`,{ref:P,key:e.id,"data-id":e.id,class:[`vue-flow__edge`,`vue-flow__edge-${B.value===!1?`default`:S.value.type||`default`}`,l.value,R.value,{updating:k.value,selected:S.value.selected,animated:S.value.animated,inactive:!F.value&&!x.value.edgeClick.hasListeners()}],tabIndex:ne.value?0:void 0,"aria-label":S.value.ariaLabel===null?void 0:S.value.ariaLabel??`Edge from ${S.value.source} to ${S.value.target}`,"aria-describedby":ne.value?`${mE}-${t}`:void 0,"aria-roledescription":`edge`,role:ne.value?`group`:`img`,...S.value.domAttributes,onClick:oe,onContextmenu:se,onDblclick:ce,onMouseenter:W,onMousemove:G,onMouseleave:le,onKeyDown:ne.value?de:void 0},[A.value?null:_(B.value===!1?u.value.default:B.value,{id:e.id,sourceNode:n,targetNode:r,source:S.value.source,target:S.value.target,type:S.value.type,updatable:I.value,selected:S.value.selected,animated:S.value.animated,label:S.value.label,labelStyle:S.value.labelStyle,labelShowBg:S.value.labelShowBg,labelBgStyle:S.value.labelBgStyle,labelBgPadding:S.value.labelBgPadding,labelBgBorderRadius:S.value.labelBgBorderRadius,data:S.value.data,events:{...S.value.events,...E},style:z.value,markerStart:`url('#${ZE(S.value.markerStart,t)}')`,markerEnd:`url('#${ZE(S.value.markerEnd,t)}')`,sourcePosition:h,targetPosition:g,sourceX:v,sourceY:y,targetX:b,targetY:C,sourceHandleId:S.value.sourceHandle,targetHandleId:S.value.targetHandle,interactionWidth:S.value.interactionWidth,...a}),[I.value===`source`||I.value===!0?[_(`g`,{onMousedown:K,onMouseenter:re,onMouseout:H},_(jk,{position:h,centerX:v,centerY:y,radius:o.value,type:`source`,"data-type":`source`}))]:null,I.value===`target`||I.value===!0?[_(`g`,{onMousedown:ue,onMouseenter:re,onMouseout:H},_(jk,{position:g,centerX:b,centerY:C,radius:o.value,type:`target`,"data-type":`target`}))]:null]])};function re(){k.value=!0}function H(){k.value=!1}function U(e,t){T.update({event:e,edge:S.value,connection:t})}function ie(e){T.updateEnd({event:e,edge:S.value}),A.value=!1}function ae(e,t){e.button===0&&(A.value=!0,j.value=t?S.value.target:S.value.source,M.value=(t?S.value.targetHandle:S.value.sourceHandle)??null,N.value=t?`target`:`source`,T.updateStart({event:e,edge:S.value}),V(e))}function oe(e){var t;let r={event:e,edge:S.value};F.value&&(c.value=!1,S.value.selected&&h.value?(d([S.value]),(t=P.value)==null||t.blur()):n([S.value])),T.click(r)}function se(e){T.contextMenu({event:e,edge:S.value})}function ce(e){T.doubleClick({event:e,edge:S.value})}function W(e){T.mouseEnter({event:e,edge:S.value})}function G(e){T.mouseMove({event:e,edge:S.value})}function le(e){T.mouseLeave({event:e,edge:S.value})}function K(e){ae(e,!0)}function ue(e){ae(e,!1)}function de(t){var r;!g.value&&gE.includes(t.key)&&F.value&&(t.key===`Escape`?((r=P.value)==null||r.blur(),d([f(e.id)])):n([f(e.id)]))}}}),Nk=R({name:`ConnectionLine`,compatConfig:{MODE:3},setup(){let{id:e,connectionMode:t,connectionStartHandle:n,connectionEndHandle:r,connectionPosition:i,connectionLineType:a,connectionLineStyle:o,connectionLineOptions:s,connectionStatus:c,viewport:l,findNode:u}=mk(),d=C(aO)?.[`connection-line`],f=L(()=>u(n.value?.nodeId)),p=L(()=>u(r.value?.nodeId)??null),m=L(()=>({x:(i.value.x-l.value.x)/l.value.zoom,y:(i.value.y-l.value.y)/l.value.zoom})),h=L(()=>s.value.markerStart?`url(#${ZE(s.value.markerStart,e)})`:``),g=L(()=>s.value.markerEnd?`url(#${ZE(s.value.markerEnd,e)})`:``);return()=>{if(!f.value||!n.value)return null;let e=n.value.id,i=n.value.type,l=f.value.handleBounds,u=l?.[i]??[];if(t.value===tE.Loose){let e=l?.[i===`source`?`target`:`source`]??[];u=[...u,...e]}if(!u)return null;let v=(e?u.find(t=>t.id===e):u[0])??null,y=v?.position??QT.Top,{x:b,y:x}=_D(f.value,v,y),S=null;p.value&&(S=t.value===tE.Strict?p.value.handleBounds[i===`source`?`target`:`source`]?.find(e=>e.id===r.value?.id)||null:[...p.value.handleBounds.source??[],...p.value.handleBounds.target??[]].find(e=>e.id===r.value?.id)||null);let C=r.value?.position??(y?BD[y]:null);if(!y||!C)return null;let w=a.value??s.value.type??eE.Bezier,T=``,E={sourceX:b,sourceY:x,sourcePosition:y,targetX:m.value.x,targetY:m.value.y,targetPosition:C};return w===eE.Bezier?[T]=YO(E):w===eE.Step?[T]=rk({...E,borderRadius:0}):w===eE.SmoothStep?[T]=rk(E):w===eE.SimpleBezier?[T]=ZO(E):T=`M${b},${x} ${m.value.x},${m.value.y}`,_(`svg`,{class:`vue-flow__edges vue-flow__connectionline vue-flow__container`},_(`g`,{class:`vue-flow__connection`},d?_(d,{sourceX:b,sourceY:x,sourcePosition:y,targetX:m.value.x,targetY:m.value.y,targetPosition:C,sourceNode:f.value,sourceHandle:v,targetNode:p.value,targetHandle:S,markerEnd:g.value,markerStart:h.value,connectionStatus:c.value}):_(`path`,{d:T,class:[s.value.class,c.value,`vue-flow__connection-path`],style:{...o.value,...s.value.style},"marker-end":g.value,"marker-start":h.value})))}}}),Pk=[`id`,`markerWidth`,`markerHeight`,`markerUnits`,`orient`],Fk=R({name:`MarkerType`,compatConfig:{MODE:3},props:{id:{},type:{},color:{default:`none`},width:{default:12.5},height:{default:12.5},markerUnits:{default:`strokeWidth`},orient:{default:`auto-start-reverse`},strokeWidth:{default:1}},setup(e){return(e,t)=>(z(),j(`marker`,{id:e.id,class:`vue-flow__arrowhead`,viewBox:`-10 -10 20 20`,refX:`0`,refY:`0`,markerWidth:`${e.width}`,markerHeight:`${e.height}`,markerUnits:e.markerUnits,orient:e.orient},[e.type===n(nE).ArrowClosed?(z(),j(`polyline`,{key:0,style:B({stroke:e.color,fill:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":`round`,"stroke-linejoin":`round`,points:`-5,-4 0,0 -5,4 -5,-4`},null,4)):K(``,!0),e.type===n(nE).Arrow?(z(),j(`polyline`,{key:1,style:B({stroke:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":`round`,"stroke-linejoin":`round`,fill:`none`,points:`-5,-4 0,0 -5,4`},null,4)):K(``,!0)],8,Pk))}}),Ik={class:`vue-flow__marker vue-flow__container`,"aria-hidden":`true`},Lk=R({name:`MarkerDefinitions`,compatConfig:{MODE:3},setup(e){let{id:t,edges:n,connectionLineOptions:r,defaultMarkerColor:i}=mk(),a=L(()=>{let e=new Set,a=[],o=n=>{if(n){let r=ZE(n,t);e.has(r)||(typeof n==`object`?a.push({...n,id:r,color:n.color||i.value}):a.push({id:r,color:i.value,type:n}),e.add(r))}};for(let e of[r.value.markerEnd,r.value.markerStart])o(e);for(let e of n.value)for(let t of[e.markerStart,e.markerEnd])o(t);return a.sort((e,t)=>e.id.localeCompare(t.id))});return(e,t)=>(z(),j(`svg`,Ik,[A(`defs`,null,[(z(!0),j(V,null,M(a.value,e=>(z(),W(Fk,{id:e.id,key:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,"stroke-width":e.strokeWidth,orient:e.orient},null,8,[`id`,`type`,`color`,`width`,`height`,`markerUnits`,`stroke-width`,`orient`]))),128))])]))}}),Rk=R({name:`Edges`,compatConfig:{MODE:3},setup(e){let{findNode:t,getEdges:r,elevateEdgesOnSelect:i}=mk();return(e,a)=>(z(),j(V,null,[y(Lk),(z(!0),j(V,null,M(n(r),e=>(z(),j(`svg`,{key:e.id,class:`vue-flow__edges vue-flow__container`,style:B({zIndex:n(bD)(e,n(t),n(i))})},[y(n(Mk),{id:e.id},null,8,[`id`])],4))),128)),y(n(Nk))],64))}}),zk=R({name:`Node`,compatConfig:{MODE:3},props:[`id`,`resizeObserver`],setup(e){let{id:t,noPanClassName:n,selectNodesOnDrag:i,nodesSelectionActive:o,multiSelectionActive:s,emits:c,removeSelectedNodes:l,addSelectedNodes:u,updateNodeDimensions:d,onUpdateNodeInternals:f,getNodeTypes:p,nodeExtent:m,elevateNodesOnSelect:h,disableKeyboardA11y:g,ariaLiveMessage:v,snapToGrid:y,snapGrid:b,nodeDragThreshold:x,nodesDraggable:T,elementsSelectable:E,nodesConnectable:D,nodesFocusable:O,hooks:k}=mk(),A=r(null);te(nO,A),te(tO,e.id);let j=C(aO),M=w(),P=gO(),{node:F,parentNode:I}=pO(e.id),{emit:ne,on:R}=hO(F,c),z=a(()=>F.draggable===void 0?T.value:F.draggable),B=a(()=>F.selectable===void 0?E.value:F.selectable),V=a(()=>F.connectable===void 0?D.value:F.connectable),re=a(()=>F.focusable===void 0?O.value:F.focusable),H=L(()=>B.value||z.value||k.value.nodeClick.hasListeners()||k.value.nodeDoubleClick.hasListeners()||k.value.nodeMouseEnter.hasListeners()||k.value.nodeMouseMove.hasListeners()||k.value.nodeMouseLeave.hasListeners()),U=a(()=>!!F.dimensions.width&&!!F.dimensions.height),ie=L(()=>{let e=F.type||`default`,t=j?.[`node-${e}`];if(t)return t;let n=F.template||p.value[e];if(typeof n==`string`&&M){let t=Object.keys(M.appContext.components);t&&t.includes(e)&&(n=ee(e,!1))}return n&&typeof n!=`string`?n:(c.error(new CD(xD.NODE_TYPE_MISSING,n)),!1)}),ae=oO({id:e.id,el:A,disabled:()=>!z.value,selectable:B,dragHandle:()=>F.dragHandle,onStart(e){ne.dragStart(e)},onDrag(e){ne.drag(e)},onStop(e){ne.dragStop(e)},onClick(e){me(e)}}),oe=L(()=>F.class instanceof Function?F.class(F):F.class),ce=L(()=>{let e=(F.style instanceof Function?F.style(F):F.style)||{},t=F.width instanceof Function?F.width(F):F.width,n=F.height instanceof Function?F.height(F):F.height;return!e.width&&t&&(e.width=typeof t==`string`?t:`${t}px`),!e.height&&n&&(e.height=typeof n==`string`?n:`${n}px`),e}),W=a(()=>Number(F.zIndex??ce.value.zIndex??0));return f(t=>{(t.includes(e.id)||!t.length)&&le()}),N(()=>{S(()=>F.hidden,(t=!1,n,r)=>{!t&&A.value&&(e.resizeObserver.observe(A.value),r(()=>{A.value&&e.resizeObserver.unobserve(A.value)}))},{immediate:!0,flush:`post`})}),S([()=>F.type,()=>F.sourcePosition,()=>F.targetPosition],()=>{se(()=>{d([{id:e.id,nodeElement:A.value,forceUpdate:!0}])})}),S([()=>F.position.x,()=>F.position.y,()=>I.value?.computedPosition.x,()=>I.value?.computedPosition.y,()=>I.value?.computedPosition.z,W,()=>F.selected,()=>F.dimensions.height,()=>F.dimensions.width,()=>I.value?.dimensions.height,()=>I.value?.dimensions.width],([e,t,n,r,i,a])=>{let o={x:e,y:t,z:a+(h.value&&F.selected?1e3:0)};n!==void 0&&r!==void 0?F.computedPosition=YE({x:n,y:r,z:i},o):F.computedPosition=o},{flush:`post`,immediate:!0}),S([()=>F.extent,m],([e,t],[n,r])=>{(e!==n||t!==r)&&G()}),F.extent===`parent`||typeof F.extent==`object`&&`range`in F.extent&&F.extent.range===`parent`?tb(()=>U).toBe(!0).then(G):G(),()=>F.hidden?null:_(`div`,{ref:A,"data-id":F.id,class:[`vue-flow__node`,`vue-flow__node-${ie.value===!1?`default`:F.type||`default`}`,{[n.value]:z.value,dragging:ae?.value,draggable:z.value,selected:F.selected,selectable:B.value,parent:F.isParent},oe.value],style:{visibility:U.value?`visible`:`hidden`,zIndex:F.computedPosition.z??W.value,transform:`translate(${F.computedPosition.x}px,${F.computedPosition.y}px)`,pointerEvents:H.value?`all`:`none`,...ce.value},tabIndex:re.value?0:void 0,role:re.value?`group`:void 0,"aria-describedby":g.value?void 0:`${pE}-${t}`,"aria-label":F.ariaLabel,"aria-roledescription":`node`,...F.domAttributes,onMouseenter:K,onMousemove:ue,onMouseleave:de,onContextmenu:fe,onClick:me,onDblclick:pe,onKeydown:he},[_(ie.value===!1?p.value.default:ie.value,{id:F.id,type:F.type,data:F.data,events:{...F.events,...R},selected:F.selected,resizing:F.resizing,dragging:ae.value,connectable:V.value,position:F.computedPosition,dimensions:F.dimensions,isValidTargetPos:F.isValidTargetPos,isValidSourcePos:F.isValidSourcePos,parent:F.parentNode,parentNodeId:F.parentNode,zIndex:F.computedPosition.z??W.value,targetPosition:F.targetPosition,sourcePosition:F.sourcePosition,label:F.label,dragHandle:F.dragHandle,onUpdateNodeInternals:le})]);function G(){let e=F.computedPosition,{computedPosition:t,position:n}=gD(F,y.value?kD(e,b.value):e,c.error,m.value,I.value);(F.computedPosition.x!==t.x||F.computedPosition.y!==t.y)&&(F.computedPosition={...F.computedPosition,...t}),(F.position.x!==n.x||F.position.y!==n.y)&&(F.position=n)}function le(){A.value&&d([{id:e.id,nodeElement:A.value,forceUpdate:!0}])}function K(e){ae?.value||ne.mouseEnter({event:e,node:F})}function ue(e){ae?.value||ne.mouseMove({event:e,node:F})}function de(e){ae?.value||ne.mouseLeave({event:e,node:F})}function fe(e){return ne.contextMenu({event:e,node:F})}function pe(e){return ne.doubleClick({event:e,node:F})}function me(e){B.value&&(!i.value||!z.value||x.value>0)&&GD(F,s.value,u,l,o,!1,A.value),ne.click({event:e,node:F})}function he(e){if(!(sE(e)||g.value)){if(gE.includes(e.key)&&B.value){let t=e.key===`Escape`;GD(F,s.value,u,l,o,t,A.value)}else z.value&&F.selected&&_E[e.key]&&(e.preventDefault(),v.value=`Moved selected node ${e.key.replace(`Arrow`,``).toLowerCase()}. New position, x: ${~~F.position.x}, y: ${~~F.position.y}`,P({x:_E[e.key].x,y:_E[e.key].y},e.shiftKey))}}}});function Bk(e={includeHiddenNodes:!1}){let{nodes:t}=mk();return L(()=>{if(t.value.length===0)return!1;for(let n of t.value)if((e.includeHiddenNodes||!n.hidden)&&(n?.handleBounds===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}var Vk={class:`vue-flow__nodes vue-flow__container`},Hk=R({name:`Nodes`,compatConfig:{MODE:3},setup(e){let{getNodes:t,updateNodeDimensions:i,emits:a}=mk(),o=Bk(),s=r();return S(o,e=>{e&&se(()=>{a.nodesInitialized(t.value)})},{immediate:!0}),N(()=>{s.value=new ResizeObserver(e=>{let t=e.map(e=>({id:e.target.getAttribute(`data-id`),nodeElement:e.target,forceUpdate:!0}));se(()=>i(t))})}),ne(()=>s.value?.disconnect()),(e,r)=>(z(),j(`div`,Vk,[s.value?(z(!0),j(V,{key:0},M(n(t),(e,t,r,i)=>{let a=[e.id];if(i&&i.key===e.id&&O(i,a))return i;let o=(z(),W(n(zk),{id:e.id,key:e.id,"resize-observer":s.value},null,8,[`id`,`resize-observer`]));return o.memo=a,o},r,0),128)):K(``,!0)]))}});function Uk(){let{emits:e}=mk();N(()=>{if(UD()){let t=document.querySelector(`.vue-flow__pane`);t&&window.getComputedStyle(t).zIndex!==`1`&&e.error(new CD(xD.MISSING_STYLES))}})}var Wk=A(`div`,{class:`vue-flow__edge-labels`},null,-1),Gk=R({name:`VueFlow`,compatConfig:{MODE:3},props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:`nodesChange.edgesChange.nodesInitialized.paneReady.init.updateNodeInternals.error.connect.connectStart.connectEnd.clickConnectStart.clickConnectEnd.moveStart.move.moveEnd.selectionDragStart.selectionDrag.selectionDragStop.selectionContextMenu.selectionStart.selectionEnd.viewportChangeStart.viewportChange.viewportChangeEnd.paneScroll.paneClick.paneContextMenu.paneMouseEnter.paneMouseMove.paneMouseLeave.edgeUpdate.edgeContextMenu.edgeMouseEnter.edgeMouseMove.edgeMouseLeave.edgeDoubleClick.edgeClick.edgeUpdateStart.edgeUpdateEnd.nodeContextMenu.nodeMouseEnter.nodeMouseMove.nodeMouseLeave.nodeDoubleClick.nodeClick.nodeDragStart.nodeDrag.nodeDragStop.miniMapNodeClick.miniMapNodeDoubleClick.miniMapNodeMouseEnter.miniMapNodeMouseMove.miniMapNodeMouseLeave.update:modelValue.update:nodes.update:edges`.split(`.`),setup(e,{expose:t,emit:r}){let i=e,a=T(),o=cb(i,`modelValue`,r),s=cb(i,`nodes`,r),c=cb(i,`edges`,r),l=mk(i),u=CO({modelValue:o,nodes:s,edges:c},i,l);return TO(r,l.hooks),Dk(),Uk(),te(aO,a),I(u),t(l),(e,t)=>(z(),j(`div`,{ref:n(l).vueFlowRef,class:`vue-flow`},[y(Sk,null,{default:H(()=>[y(Rk),Wk,y(Hk),le(e.$slots,`zoom-pane`)]),_:3}),le(e.$slots,`default`),y(Ek)],512))}}),Kk=R({name:`Panel`,compatConfig:{MODE:3},props:{position:{}},setup(e){let t=e,{userSelectionActive:r}=mk(),i=L(()=>`${t.position}`.split(`-`));return(e,t)=>(z(),j(`div`,{class:P([`vue-flow__panel`,i.value]),style:B({pointerEvents:n(r)?`none`:`all`})},[le(e.$slots,`default`)],6))}}),qk=`#818cf8`,Jk=Ke(R({inheritAttrs:!1,__name:`ScenarioGroupNode`,props:{id:{},data:{},selected:{type:Boolean},readonly:{type:Boolean}},emits:[`updateLabel`,`updateNodeInternals`,`remove`],setup(e,{emit:t}){let i=e,a=t,o=r(!1),s=r(``);function c(e){e.stopPropagation(),s.value=i.data.label,o.value=!0}function l(){o.value=!1,a(`updateLabel`,i.id,s.value)}function u(e){e.key===`Enter`&&l(),e.key===`Escape`&&(o.value=!1)}S(()=>i.data.label,e=>{o.value||(s.value=e)});let d=L(()=>i.data.color??qk),f=L(()=>i.selected?d.value:`${d.value}90`),p=L(()=>i.selected?`color-mix(in srgb, ${d.value} 28%, transparent)`:`color-mix(in srgb, ${d.value} 14%, transparent)`),m=L(()=>i.selected?d.value:`${d.value}cc`),h=L(()=>`${d.value}55`),g=L(()=>({borderColor:f.value,background:p.value,boxShadow:i.selected?`0 0 0 1px ${f.value}, 0 0 28px ${h.value}`:`0 0 0 0 transparent`})),_=L(()=>({color:m.value}));return L(()=>({borderColor:d.value})),(t,r)=>(z(),j(`div`,{class:`group-node`,style:B(g.value)},[A(`div`,{class:`group-node__header`,onDblclick:r[3]||=t=>!e.readonly&&c(t)},[o.value?(z(),W(n(je),{key:0,modelValue:s.value,"onUpdate:modelValue":r[0]||=e=>s.value=e,class:`group-node__label-input`,style:B({color:d.value,outlineColor:d.value}),autofocus:``,onBlur:l,onKeydown:u,onClick:r[1]||=he(()=>{},[`stop`])},null,8,[`modelValue`,`style`])):(z(),j(`span`,{key:1,class:`group-node__label`,style:B(_.value)},U(e.data.label||`Team`),5)),e.selected&&!e.readonly?(z(),W(n(q),{key:2,icon:`ti ti-trash`,variant:`text`,rounded:``,size:`small`,severity:`danger`,class:`group-node__remove`,onClick:r[2]||=he(t=>a(`remove`,e.id),[`stop`])})):K(``,!0)],32)],4))}}),[[`__scopeId`,`data-v-81199534`]]),Yk={class:`efn__inner`},Xk={class:`efn__icon-wrap`},Zk={class:`efn__content`},Qk={class:`efn__label`},$k={class:`efn__meta`},eA={key:1,class:`efn__spinner`},tA={key:2,class:`efn__spinner efn__spinner--waiting-input`},nA={key:3,class:`efn__spinner efn__spinner--waiting`},rA=Ke(R({inheritAttrs:!1,__name:`ScenarioFlowNode`,props:{id:{},data:{},selected:{type:Boolean}},emits:[`updateNodeInternals`],setup(e){let t=e,{updateNodeInternals:i}=mk();N(()=>i([t.id]));let a=C(`efn-selected-node-id`,r(void 0)),o=C(`efn-node-states`,r({})),s=L(()=>o.value[t.id]??t.data.state??`idle`),c=L(()=>t.selected||a.value===t.id),l=L(()=>t.data.label||t.id),u=L(()=>t.data.isLeader??!1),d=L(()=>u.value?`ti ti-crown`:t.data.type===`ask`?`ti ti-message`:`ti ti-brain`),f=L(()=>(t.data.aiCli??`claude-code`)===`codex`?`Codex`:`Claude`),p=L(()=>t.data.model?.trim()||``),m=L(()=>{let e=p.value?`${f.value} · ${p.value}`:f.value;return t.data.roleName?`${t.data.roleName} · ${e}`:e}),h=C(`efn-open-pty-debug`,null),g=L(()=>!h||t.data.type===`ask`||(t.data.aiCli??`claude-code`)!==`claude-code`?!1:s.value===`done`||s.value===`synthesized`);function _(e){e.stopPropagation(),h?.(t.id)}return(t,r)=>(z(),j(V,null,[y(n(jO),{type:`target`,position:n(QT).Left,class:`efn-handle efn-handle--target`},null,8,[`position`]),A(`div`,{class:P([`efn`,u.value?`efn--leader`:`efn--node`,c.value&&`efn--selected`,s.value!==`idle`&&`efn--${s.value}`])},[r[6]||=A(`div`,{class:`efn__border`},null,-1),A(`div`,Yk,[A(`div`,Xk,[A(`i`,{class:P([d.value,`efn__icon`])},null,2)]),A(`div`,Zk,[A(`span`,Qk,U(l.value),1),A(`span`,$k,U(m.value),1)])]),g.value?(z(),j(`button`,{key:0,class:`efn__badge efn__badge--debug`,title:`Reprendre dans un terminal Claude (--resume)`,onClick:_,onMousedown:r[0]||=he(()=>{},[`stop`]),onPointerdown:r[1]||=he(()=>{},[`stop`])},[...r[2]||=[A(`i`,{class:`ti ti-device-desktop`},null,-1)]],32)):K(``,!0),s.value===`running`?(z(),j(`div`,eA,[...r[3]||=[A(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]])):s.value===`waiting_input`?(z(),j(`div`,tA,[...r[4]||=[A(`i`,{class:`ti ti-help-circle`},null,-1)]])):s.value===`waiting`?(z(),j(`div`,nA,[...r[5]||=[A(`i`,{class:`ti ti-clock`},null,-1)]])):K(``,!0)],2),e.data.showBottomHandle===!1?K(``,!0):(z(),W(n(jO),{key:0,id:`source-bottom`,type:`source`,position:n(QT).Bottom,class:`efn-handle efn-handle--source efn-handle--source-bottom`,style:{left:`10px`}},null,8,[`position`])),e.data.showTopHandle?(z(),W(n(jO),{key:1,id:`source-top`,type:`source`,position:n(QT).Top,class:`efn-handle efn-handle--source efn-handle--source-top`,style:{left:`10px`}},null,8,[`position`])):K(``,!0)],64))}}),[[`__scopeId`,`data-v-53195966`]]),iA={class:`scenario-run-view`},aA={key:0,class:`scenario-run-view__loading`},oA=`scenario-run-view`,sA=Ke(R({__name:`ScenarioRunView`,props:{scenario:{},nodeStates:{},selectedNodeId:{},preset:{}},emits:[`node-click`],setup(e,{emit:t}){let r=e,i=t;te(`efn-selected-node-id`,a(r,`selectedNodeId`)),te(`efn-node-states`,a(r,`nodeStates`));let{getEdges:o}=mk(oA),s=L(()=>r.scenario),c=L(()=>{if(!s.value)return[];let e=(s.value.groups??[]).map(e=>({id:e.id,type:`group`,position:{...e.position},style:{width:`${e.width}px`,height:`${e.height}px`},data:{label:e.name,color:e.color??void 0},draggable:!1,selectable:!1})),t=s.value.nodes.map(e=>({id:e.id,position:{...e.position},label:e.label,data:{label:e.label,isLeader:e.id===s.value.leaderId,type:e.type,aiCli:e.aiCli,model:e.model,roleName:r.preset?.roles.find(t=>t.id===e.role)?.name},...e.groupId?{parentNode:e.groupId,extent:`parent`}:{}}));return[...e,...t]}),l=L(()=>{if(!s.value)return[];let e=[];for(let t of s.value.nodes)for(let n of t.parentIds??[])e.push({id:`e-${n}-${t.id}`,source:n,target:t.id,type:`step`,animated:!1,zIndex:1500,style:{stroke:`rgba(99,102,241,0.55)`,strokeWidth:2.5}});return e});return S(()=>r.nodeStates,e=>{let t=Object.values(e).some(e=>e===`running`);for(let e of o.value)e.animated=t},{deep:!0}),(e,t)=>(z(),j(`div`,iA,[s.value?(z(),W(n(Gk),{key:1,id:oA,nodes:c.value,edges:l.value,"nodes-draggable":!0,"nodes-connectable":!1,"elements-selectable":!1,"fit-view-on-init":``,class:`scenario-run-view__flow scenario-flow-canvas`,onNodeClick:t[0]||=e=>i(`node-click`,e.node.id)},{"node-default":H(e=>[y(rA,oe(ue(e)),null,16)]),"node-group":H(e=>[y(Jk,F(e,{readonly:!0}),null,16)]),_:1},8,[`nodes`,`edges`])):(z(),j(`div`,aA,[...t[1]||=[A(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]]))]))}}),[[`__scopeId`,`data-v-0388d65e`]]),cA={class:`ai-chat-scenario-view`},lA={class:`ai-chat-scenario-view__graph`},uA={key:0,class:`ai-chat-scenario-view__synthesis-banner`},dA={class:`ai-chat-scenario-view__detail`},fA={key:0,class:`ai-chat-scenario-view__stop-bar`},pA={key:1,class:`ai-chat-scenario-view__stop-bar`},mA={style:{"font-size":`0.875rem`}},hA={class:`ai-chat-scenario-view__input-request-header`},gA={class:`ai-chat-scenario-view__input-request-name`},_A={class:`ai-chat-scenario-view__input-request-question`},vA={class:`ai-chat-scenario-view__input-request-form`},yA={class:`ai-chat-scenario-view__tabs`},bA={key:0,class:`ai-chat-scenario-view__tab-dot`},xA={key:0,class:P([`ai-chat-scenario-view__tab`,`ai-chat-scenario-view__tab--active`])},SA={key:0,class:`ai-chat-scenario-view__hint`},CA={key:1,class:`ai-chat-scenario-view__accordion`},wA={key:0,class:`ai-chat-scenario-view__accordion-item`},TA=[`innerHTML`],EA={key:1,class:`ai-chat-scenario-view__accordion-item`},DA=[`innerHTML`],OA={key:2,class:`ai-chat-scenario-view__cursor`},kA={key:0,class:`ai-chat-scenario-view__node-meta`},AA={class:`ai-chat-scenario-view__chip`},jA={key:0,class:`ai-chat-scenario-view__chip ai-chat-scenario-view__chip--model`},MA={key:1,class:`ai-chat-scenario-view__node-status`},NA={key:2,class:`ai-chat-scenario-view__thinking-block`},PA={key:0,class:`ai-chat-scenario-view__thinking-content`},FA={key:3,class:`ai-chat-scenario-view__tool-events`},IA={class:`ai-chat-scenario-view__tool-event-name`},LA={key:0,class:`ai-chat-scenario-view__tool-event-args ai-chat-scenario-view__tool-event-args--streaming`},RA={key:1,class:`ai-chat-scenario-view__tool-event-args`},zA={key:2,class:`ai-chat-scenario-view__tool-event-result`},BA=[`innerHTML`],VA={key:5,class:`ai-chat-scenario-view__node-empty`},HA={key:6,class:`ai-chat-scenario-view__node-duration`},UA={key:0,style:{padding:`1rem`,color:`#d4d4d4`}},WA={key:1,style:{padding:`1rem`,color:`#f87171`}},GA=Ke(R({__name:`AiChatScenarioView`,props:{availablePresets:{}},emits:[`click-resume`],setup(e,{expose:t,emit:i}){let a=e,o=i,{t:s}=ge(),c=Fe(),l=ut(),u=dt(),{activeConversation:d}=_e(l),f=r(null);t({messagesEl:f,resetNodeSelection:we,syncScenarioAccordionState:ue});let p=r(null),m=r(!0),h=r(!1),g=r(null),_=r(null),v=r(!1),x=r(null);te(`efn-open-pty-debug`,e=>{S(e)});async function S(e){let t=d.value;if(t){g.value=e,_.value=null,x.value=null,v.value=!0;try{let n=await J.scenario.getNodeSession.query({conversationId:t.id,nodeId:e});n?_.value=n:x.value=`Ce nœud n'a pas encore de session Claude (jamais exécuté ?).`}catch(e){x.value=e.message}finally{v.value=!1}}}let C=/##\s*(?:✅\s*)?FINAL REPORT/i,w=L(()=>d.value?.scenarioNodeStates??{}),T=L(()=>d.value?.scenarioNodeOutputs??{}),E=L(()=>d.value?.scenarioRunning??!1),D=L(()=>d.value?.scenarioSynthesisRunning??!1),ee=L(()=>{let e=d.value;if(!e||e.workflowType!==`scenario`||E.value)return!1;let t=e.scenarioNodeStates??{};return Object.keys(t).length>0&&Object.values(t).some(e=>e!==`done`&&e!==`synthesized`)}),O=L(()=>d.value?.scenarioReadme??``),k=L(()=>{let e=O.value??``,t=C.exec(e);if(!t)return{runLog:e,finalReport:``};let n=t.index??0;return{runLog:e.slice(0,n).trim(),finalReport:e.slice(n).trim()}}),N=L(()=>{let e=d.value;return!e||e.workflowType!==`scenario`?null:e.scenarioSnapshot??u.scenarios.find(t=>t.id===e.workflowId)??null}),F=L(()=>a.availablePresets.find(e=>e.id===N.value?.presetId)),I=L(()=>!p.value||!N.value?null:N.value.nodes.find(e=>e.id===p.value)??null),ne=L(()=>(I.value?.aiCli??`claude-code`)===`codex`?`Codex`:`Claude Code`),R=L(()=>{let e=I.value;return e&&e.model?.trim()||``}),B=L(()=>d.value?.scenarioWaitingInputs??{}),re=L(()=>d.value?.scenarioNodeStatuses??{}),ie=L(()=>d.value?.scenarioNodeThinking??{}),ae=L(()=>d.value?.scenarioNodeToolEvents??{}),oe=L(()=>d.value?.scenarioNodeDurations??{}),se=r(new Set),ce=L(()=>p.value),G=r({});async function le(e){let t=d.value;if(!t)return;let n=G.value[e]?.trim();if(n)try{await l.sendNodeInput(t.id,e,n);let{[e]:r,...i}=G.value;G.value=i}catch(e){c.add({severity:`error`,summary:s(`common.error`),detail:e.message,life:4e3})}}function ue(){let e=k.value.finalReport.length>0;m.value=!e,h.value=e}function fe(e){if(e===`run`){let e=!m.value;m.value=e,e&&(h.value=!1);return}let t=!h.value;h.value=t,t&&(m.value=!1)}let pe=new Map;function me(e){return e.replace(/<pass\s+branch="(\d+)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--pass">PASS ${t}</span>`).replace(/<pass\s*\/>/g,`<span class="scenario-flag scenario-flag--pass">PASS</span>`).replace(/<error>([\s\S]*?)<\/error>/g,(e,t)=>`<span class="scenario-flag scenario-flag--error">ERROR: ${t.trim()}</span>`).replace(/<ask_user>([\s\S]*?)<\/ask_user>/g,(e,t)=>`<span class="scenario-flag scenario-flag--ask">${t.trim()}</span>`).replace(/<kanban_move\s+column="([^"]*?)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--kanban">📋 Move → ${t}</span>`).replace(/<kanban_comment>([\s\S]*?)<\/kanban_comment>/g,(e,t)=>`<span class="scenario-flag scenario-flag--kanban-comment">💬 ${t.trim()}</span>`).replace(/<kanban_add_card\s+column="([^"]*?)"\s+title="([^"]*?)">([\s\S]*?)<\/kanban_add_card>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--kanban">➕ Card "${n}" → ${t}</span>`).replace(/<next_person\s+name="([^"]*?)"\s*\/>/g,(e,t)=>`<span class="scenario-flag scenario-flag--delegate">🔀 ${t}</span>`).replace(/<next_person\s+name="([^"]*?)">([\s\S]*?)<\/next_person>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--delegate">🔀 <strong>${t}</strong> — ${n.trim()}</span>`).replace(/<hire_person\s+label="([^"]*?)"\s+role="([^"]*?)">([\s\S]*?)<\/hire_person>/g,(e,t,n)=>`<span class="scenario-flag scenario-flag--hire">🧑‍💼 Hire ${t} (${n})</span>`)}function ve(e){let t=pe.get(e);return t===void 0&&(t=Jt.sanitize(Qt.parse(me(e),{async:!1})),pe.set(e,t)),t}function ye(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function be(e){return e.name===`command_execution`&&typeof e.input?.command==`string`}function xe(e){return be(e)?`shell`:e.name}function Se(e){return!e.input||Object.keys(e.input).length===0?``:be(e)?String(e.input.command??``):Object.entries(e.input).map(([e,t])=>`${e}=${t}`).join(`, `)}function Ce(e,t){let n;if(typeof e==`string`)n=e;else try{n=JSON.stringify(e,null,2)}catch{n=`[unserializable result]`}return n.split(`
49
+ `).slice(-t).join(`
50
+ `)}function we(){p.value=null,ue()}return(e,t)=>(z(),j(`div`,cA,[y(n(We),{layout:`horizontal`,"gutter-size":6,class:`ai-chat-scenario-view__splitter`},{default:H(()=>[y(n(it),{size:45,"min-size":0},{default:H(()=>[A(`div`,lA,[D.value?(z(),j(`div`,uA,[t[8]||=A(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),A(`span`,null,U(n(s)(`aiChatPage.scenario.synthesisInProgress`)),1)])):K(``,!0),(z(),W(sA,{key:`scenario-graph-${n(d)?.id}`,scenario:N.value,"node-states":w.value,"selected-node-id":p.value??void 0,preset:F.value,onNodeClick:t[0]||=e=>p.value=p.value===e?null:e},null,8,[`scenario`,`node-states`,`selected-node-id`,`preset`]))])]),_:1}),y(n(it),{size:55,"min-size":35},{default:H(()=>[A(`div`,dA,[E.value?(z(),j(`div`,fA,[...t[9]||=[A(`i`,{class:`ti ti-spin ti-loader-2`},null,-1),A(`span`,null,`Scenario running...`,-1)]])):ee.value?(z(),j(`div`,pA,[t[10]||=A(`i`,{class:`ti ti-alert-triangle`,style:{color:`var(--r-orange-500, #f97316)`}},null,-1),A(`span`,mA,U(n(s)(`aiChatPage.scenario.interrupted`)),1),y(n(q),{label:n(s)(`aiChatPage.resume`),icon:`ti ti-player-play`,size:`small`,onClick:t[1]||=e=>o(`click-resume`)},null,8,[`label`])])):K(``,!0),(z(!0),j(V,null,M(B.value,(e,r)=>(z(),j(`div`,{key:r,class:`ai-chat-scenario-view__input-request`},[A(`div`,hA,[t[11]||=A(`i`,{class:`ti ti-help-circle`},null,-1),A(`span`,gA,U(N.value?.nodes.find(e=>e.id===r)?.label||r)+` asks: `,1)]),A(`p`,_A,U(e),1),A(`div`,vA,[y(n($e),{modelValue:G.value[r],"onUpdate:modelValue":e=>G.value[r]=e,class:`ai-chat-scenario-view__input-request-field`,placeholder:`Your answer...`,disabled:!E.value,rows:3,"auto-resize":``,onKeydown:de(he(e=>E.value&&le(r),[`exact`,`prevent`]),[`enter`])},null,8,[`modelValue`,`onUpdate:modelValue`,`disabled`,`onKeydown`]),y(n(q),{icon:`ti ti-send`,size:`small`,disabled:!G.value[r]?.trim()||!E.value,title:E.value?void 0:n(s)(`aiChatPage.scenario.resumeToAnswer`),onClick:e=>le(r)},null,8,[`disabled`,`title`,`onClick`])])]))),128)),A(`div`,yA,[A(`button`,{class:P([`ai-chat-scenario-view__tab`,{"ai-chat-scenario-view__tab--active":!p.value}]),onClick:t[2]||=e=>p.value=null},[t[12]||=A(`i`,{class:`ti ti-file`},null,-1),b(` `+U(n(s)(`aiChatPage.runLog`))+` `,1),E.value?(z(),j(`span`,bA)):K(``,!0)],2),p.value?(z(),j(`button`,xA,[t[13]||=A(`i`,{class:`ti ti-user`},null,-1),b(` `+U(I.value?.label||I.value?.id)+` `,1),A(`span`,{class:P([`ai-chat-scenario-view__node-state`,`ai-chat-scenario-view__node-state--${w.value[ce.value]??`idle`}`])},U(w.value[ce.value]??`idle`),3),A(`button`,{class:`ai-chat-scenario-view__tab-close`,onClick:t[3]||=he(e=>p.value=null,[`stop`])},`x`)])):K(``,!0)]),p.value?(z(),j(`div`,{key:`scenario-node-${n(d)?.id}-${ce.value}`,class:`ai-chat-scenario-view__node-output`},[I.value?(z(),j(`div`,kA,[A(`span`,AA,U(ne.value),1),R.value?(z(),j(`span`,jA,U(R.value),1)):K(``,!0)])):K(``,!0),re.value[ce.value]&&w.value[ce.value]===`running`?(z(),j(`div`,MA,[t[17]||=A(`i`,{class:`ti ti-spin ti-settings`},null,-1),A(`span`,null,U(re.value[ce.value]),1)])):K(``,!0),ie.value[ce.value]?.length?(z(),j(`div`,NA,[A(`div`,{class:`ai-chat-scenario-view__thinking-header`,onClick:t[6]||=e=>se.value.has(ce.value)?se.value.delete(ce.value):se.value.add(ce.value)},[t[18]||=A(`i`,{class:`ti ti-sparkles`},null,-1),A(`span`,null,U(n(s)(`aiChatPage.thinking`)),1),A(`i`,{class:P([`ti`,se.value.has(ce.value)?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),se.value.has(ce.value)?(z(),j(`pre`,PA,U(ie.value[ce.value].join(``)),1)):K(``,!0)])):K(``,!0),ae.value[ce.value]?.length?(z(),j(`div`,FA,[(z(!0),j(V,null,M(ae.value[ce.value],e=>(z(),j(`div`,{key:e.id,class:P([`ai-chat-scenario-view__tool-event`,{"ai-chat-scenario-view__tool-event--pending":e.pending,"ai-chat-scenario-view__tool-event--error":e.isError}])},[A(`i`,{class:P(e.pending?`ti ti-spin ti-loader-2`:e.isError?`ti ti-circle-x`:`ti ti-circle-check`)},null,2),A(`span`,IA,U(xe(e)),1),e.pending&&e.rawInput?(z(),j(`span`,LA,[b(U(e.rawInput),1),t[19]||=A(`span`,{class:`ai-chat-scenario-view__cursor`},null,-1)])):Se(e)?(z(),j(`span`,RA,U(Se(e)),1)):K(``,!0),!e.pending&&e.result?(z(),j(`pre`,zA,U(Ce(e.result,20)),1)):K(``,!0)],2))),128))])):K(``,!0),T.value[ce.value]?(z(),j(`div`,{key:4,class:`ai-chat-scenario-view__node-content ai-chat-scenario-view__markdown`,innerHTML:ve(T.value[ce.value])},null,8,BA)):(z(),j(`div`,VA,[t[20]||=A(`i`,{class:`ti ti-clock`},null,-1),A(`span`,null,U(w.value[ce.value]===`running`?`Running...`:`Waiting...`),1)])),oe.value[ce.value]===void 0?K(``,!0):(z(),j(`div`,HA,[t[21]||=A(`i`,{class:`ti ti-clock`},null,-1),A(`span`,null,U(ye(oe.value[ce.value])),1)]))])):(z(),j(`div`,{key:`scenario-readme-${n(d)?.id}`,ref_key:`messagesEl`,ref:f,class:`ai-chat-scenario-view__readme`},[O.value?(z(),j(`div`,CA,[k.value.runLog?(z(),j(`div`,wA,[A(`button`,{class:`ai-chat-scenario-view__accordion-header`,onClick:t[4]||=e=>fe(`run`)},[A(`span`,null,[t[15]||=A(`i`,{class:`ti ti-file`},null,-1),b(` `+U(n(s)(`aiChatPage.runLog`)),1)]),A(`i`,{class:P([`ti`,m.value?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),m.value?(z(),j(`div`,{key:0,class:`ai-chat-scenario-view__accordion-content ai-chat-scenario-view__readme-content ai-chat-scenario-view__markdown`,innerHTML:ve(k.value.runLog)},null,8,TA)):K(``,!0)])):K(``,!0),k.value.finalReport?(z(),j(`div`,EA,[A(`button`,{class:`ai-chat-scenario-view__accordion-header`,onClick:t[5]||=e=>fe(`final`)},[A(`span`,null,[t[16]||=A(`i`,{class:`ti ti-file-check`},null,-1),b(` `+U(n(s)(`aiChatPage.finalReport`)),1)]),A(`i`,{class:P([`ti`,h.value?`ti-chevron-up`:`ti-chevron-down`])},null,2)]),h.value?(z(),j(`div`,{key:0,class:`ai-chat-scenario-view__accordion-content ai-chat-scenario-view__final-report ai-chat-scenario-view__markdown`,innerHTML:ve(k.value.finalReport)},null,8,DA)):K(``,!0)])):K(``,!0)])):(z(),j(`div`,SA,[t[14]||=A(`i`,{class:`ti ti-building`,style:{"font-size":`1.5rem`,opacity:`0.2`}},null,-1),A(`p`,null,U(n(s)(`aiChatPage.typeATask`)),1),A(`p`,null,U(n(s)(`aiChatPage.clickOrgChartHint`)),1)])),E.value?(z(),j(`span`,OA)):K(``,!0)]))])]),_:1})]),_:1}),y(n(Ve),{visible:!!g.value,modal:``,"dismissable-mask":``,header:`Claude · resume ${g.value??``}`,style:{width:`80vw`,height:`70vh`},"content-style":{padding:0,height:`100%`},"onUpdate:visible":t[7]||=e=>{e||(g.value=null,_.value=null,x.value=null)}},{default:H(()=>[v.value?(z(),j(`div`,UA,`Chargement…`)):x.value?(z(),j(`div`,WA,[t[22]||=A(`i`,{class:`ti ti-alert-triangle`},null,-1),b(` `+U(x.value),1)])):_.value?(z(),W(Ny,{key:2,"session-id":_.value.sessionId,"agent-id":_.value.agentId,resume:!0},null,8,[`session-id`,`agent-id`])):K(``,!0)]),_:1},8,[`visible`,`header`])]))}}),[[`__scopeId`,`data-v-531a3e9c`]]),KA={"claude-code":`Claude Code`,codex:`Codex`};function qA(e,t,n){return Object.keys(KA).map(r=>{let i=KA[r],a=!e[r]&&t!==r;return{value:r,disabled:a,label:a?n(i):i}})}function JA(e,t,n){let r=[{value:``,label:e},...t];return n&&!t.some(e=>e.value===n)&&r.push({value:n,label:n}),r}function YA(e,t){return[{value:``,label:e},...fn.map(e=>({value:e,label:t(e)}))]}function XA(e,t,n,r,i=1){return Math.max(n,Math.min(Math.max(n,r),e+t*i))}function ZA(e){let{axis:t,min:n,initial:i,storageKey:a,direction:o=1}=e,s=()=>typeof e.max==`function`?e.max():e.max,c=r(p()),u=r(!1),d=0,f=0;function p(){if(!a)return i;try{let e=Number(localStorage.getItem(a));if(Number.isFinite(e)&&e>=n&&e<=s())return e}catch{}return i}function m(){if(a)try{localStorage.setItem(a,String(c.value))}catch{}}let h=e=>{let r=(t===`x`?e.clientX:e.clientY)-d;c.value=XA(f,r,n,s(),o)},g=()=>{u.value=!1,document.removeEventListener(`pointermove`,h),document.removeEventListener(`pointerup`,g),document.removeEventListener(`pointercancel`,g),document.body.style.userSelect=``,document.body.style.cursor=``,m()};function _(e){u.value=!0,d=t===`x`?e.clientX:e.clientY,f=c.value,document.body.style.userSelect=`none`,document.body.style.cursor=t===`x`?`col-resize`:`row-resize`,document.addEventListener(`pointermove`,h),document.addEventListener(`pointerup`,g),document.addEventListener(`pointercancel`,g)}return l(()=>{u.value&&g()}),{size:c,isResizing:u,start:_}}var QA={class:`companion-panel__header`},$A={class:`companion-panel__title`},ej={key:0,class:`companion-panel__state companion-panel__state--reading`},tj=[`title`],nj={key:2,class:`companion-panel__state`},rj={class:`companion-panel__header-actions`},ij={class:`companion-panel__menu`},aj=[`title`],oj=[`title`,`disabled`],sj=[`title`,`disabled`],cj={class:`companion-panel__hint`},lj={key:2,class:`companion-panel__empty`},uj=[`title`],dj=Ke(R({__name:`CompanionPanel`,props:{enabled:{type:Boolean},runner:{},model:{},effort:{},companionConversationId:{},mainConversationId:{}},emits:[`enable`,`disable`,`update:runner`,`update:model`,`update:effort`],setup(e,{emit:t}){let i=e,a=t,{t:o}=ge(),s=ut(),{claudeCodeAvailable:c,codexAvailable:l,cliModels:u}=_e(s),d=L(()=>qA({"claude-code":c.value,codex:l.value},i.runner,e=>o(`aiChatPage.runnerNotInstalled`,{runner:e}))),f=L(()=>JA(o(`aiChat.companionModelDefault`),u.value[i.runner],i.model));S(()=>i.runner,e=>{s.loadCliModels(e)},{immediate:!0});let p=L(()=>YA(o(`aiChat.companionEffortDefault`),e=>o(`aiChat.companionEffort_${e}`))),m=L(()=>i.companionConversationId?s.conversations.find(e=>e.id===i.companionConversationId)??null:null);S(()=>m.value?.messagesOmitted?m.value.id:null,e=>{e&&s.ensureConversationLoaded(e)},{immediate:!0});let h=r(!1),g=L(()=>i.enabled&&h.value),_=L(()=>(m.value?.messages??[]).filter(e=>e.role===`assistant`&&e.content.trim()).length),{size:v,isResizing:x,start:C}=ZA({axis:`y`,min:180,max:()=>Math.round(window.innerHeight*.75),initial:380,storageKey:`runeya:companion-height`}),w=r();function T(e){w.value?.toggle(e)}let E=L(()=>m.value?.messages??[]),D=L(()=>s.isCompanionThinkingFor(i.mainConversationId)),ee=L(()=>s.companionSkipFor(i.mainConversationId)),O=L(()=>D.value||!!i.companionConversationId&&s.isConversationStreaming(i.companionConversationId));function k(e){a(`update:runner`,e===`codex`?`codex`:`claude-code`)}let M=r(!1),N=r(null);async function F(){if(!i.mainConversationId||!g.value){N.value=null;return}try{let e=await J.chat.conversations.companionDelivery.query({id:i.mainConversationId});N.value=e.delivery}catch{N.value=null}}S(D,(e,t)=>{e&&!t&&s.refreshStreamingSessions()});let te=en(F,1500,`companion-delivery`);S(()=>[i.mainConversationId,g.value],([,e])=>{N.value=null,e?(te.start(),te.trigger()):te.stop()},{immediate:!0}),I(()=>te.stop());async function ne(){if(i.mainConversationId){M.value=!0;try{await J.chat.conversations.testCompanionBridge.mutate({id:i.mainConversationId})}catch{}finally{M.value=!1,await F()}}}let R=r(!1);async function re(){if(i.mainConversationId){R.value=!0;try{await J.chat.conversations.runCompanionNow.mutate({id:i.mainConversationId})}catch{}finally{R.value=!1}}}return(t,r)=>(z(),j(`section`,{class:P([`companion-panel`,{"companion-panel--resizing":n(x),"companion-panel--collapsed":!g.value}]),style:B(g.value?{height:n(v)+`px`}:void 0)},[A(`header`,QA,[A(`span`,$A,[A(`i`,{class:P(e.enabled?`ti ti-eye`:`ti ti-eye-off`)},null,2),b(` `+U(n(o)(`aiChat.companionPanelTitle`)),1)]),e.enabled&&O.value?(z(),j(`span`,ej,[r[6]||=A(`i`,{class:`companion-panel__pulse`},null,-1),b(U(n(o)(`aiChat.companionReading`)),1)])):e.enabled&&ee.value?(z(),j(`span`,{key:1,class:`companion-panel__state companion-panel__state--skipped`,title:ee.value.detail},[r[7]||=A(`i`,{class:`ti ti-info-circle`},null,-1),b(U(n(o)(`aiChat.companionSkip_${ee.value.reason}`)),1)],8,tj)):e.enabled?K(``,!0):(z(),j(`span`,nj,U(n(o)(`aiChat.companionPitchLead`)),1)),A(`div`,rj,[y(n(Le),{class:`companion-panel__runner`,"model-value":e.runner,options:d.value,"option-label":`label`,"option-value":`value`,"option-disabled":`disabled`,size:`small`,title:n(o)(`aiChat.companionRunner`),"onUpdate:modelValue":k},null,8,[`model-value`,`options`,`title`]),f.value.length>1?(z(),W(n(Le),{key:0,class:`companion-panel__runner companion-panel__model`,"model-value":e.model,options:f.value,"option-label":`label`,"option-value":`value`,size:`small`,title:n(o)(`aiChat.companionModel`),"aria-label":n(o)(`aiChat.companionModel`),"onUpdate:modelValue":r[0]||=e=>a(`update:model`,String(e??``))},null,8,[`model-value`,`options`,`title`,`aria-label`])):K(``,!0),y(n(Le),{class:`companion-panel__runner companion-panel__effort`,"model-value":e.effort,options:p.value,"option-label":`label`,"option-value":`value`,size:`small`,title:n(o)(`aiChat.companionEffort`),"aria-label":n(o)(`aiChat.companionEffort`),"onUpdate:modelValue":r[1]||=e=>a(`update:effort`,String(e??``))},null,8,[`model-value`,`options`,`title`,`aria-label`]),e.enabled?(z(),j(V,{key:2},[y(n(q),{size:`small`,variant:`text`,severity:`danger`,icon:`ti ti-eye-off`,label:n(o)(`aiChat.companionDisable`),onClick:r[3]||=e=>a(`disable`)},null,8,[`label`]),y(n(q),{class:`companion-panel__menu-btn`,size:`small`,variant:`text`,rounded:``,icon:`ti ti-dots-vertical`,title:n(o)(`aiChat.companionMore`),onClick:T},null,8,[`title`]),y(n(ke),{ref_key:`menu`,ref:w},{default:H(()=>[A(`div`,ij,[A(`button`,{type:`button`,class:`companion-panel__menu-item`,title:n(o)(`aiChat.companionRawHint`),onClick:r[4]||=e=>h.value=!h.value},[r[8]||=A(`i`,{class:`ti ti-code`},null,-1),b(` `+U(h.value?n(o)(`aiChat.companionRawOff`):n(o)(`aiChat.companionRaw`)),1)],8,aj),A(`button`,{type:`button`,class:`companion-panel__menu-item`,title:n(o)(`aiChat.companionRunNowHint`),disabled:R.value||O.value,onClick:re},[A(`i`,{class:P(R.value||O.value?`ti ti-spin ti-loader-2`:`ti ti-player-play`)},null,2),b(` `+U(n(o)(`aiChat.companionRunNow`)),1)],8,oj),A(`button`,{type:`button`,class:`companion-panel__menu-item`,title:n(o)(`aiChat.companionTestBridgeHint`),disabled:M.value,onClick:ne},[A(`i`,{class:P(M.value?`ti ti-spin ti-loader-2`:`ti ti-send`)},null,2),b(` `+U(n(o)(`aiChat.companionTestBridge`)),1)],8,sj)])]),_:1},512)],64)):(z(),W(n(q),{key:1,size:`small`,icon:`ti ti-eye`,label:n(o)(`aiChat.companionEnable`),onClick:r[2]||=e=>a(`enable`)},null,8,[`label`]))])]),g.value?(z(),j(V,{key:0},[A(`p`,cj,U(n(o)(`aiChat.companionRawNotice`,{n:_.value})),1),N.value?(z(),j(`p`,{key:0,class:P([`companion-panel__delivery`,`companion-panel__delivery--${N.value.route}`])},U(n(o)(`aiChat.companionDelivery_${N.value.route}`)),3)):K(``,!0),E.value.length?(z(),W(ku,{key:1,class:`companion-panel__messages`,messages:E.value,"is-streaming":O.value},null,8,[`messages`,`is-streaming`])):(z(),j(`p`,lj,U(O.value?n(o)(`aiChat.companionReadingNow`):n(o)(`aiChat.companionNoRunYet`)),1)),A(`div`,{class:`companion-panel__grip`,role:`separator`,title:n(o)(`aiChat.companionResize`),onPointerdown:r[5]||=he((...e)=>n(C)&&n(C)(...e),[`prevent`])},null,40,uj)],64)):K(``,!0)],6))}}),[[`__scopeId`,`data-v-25278c84`]]),fj=[`aria-label`],pj={class:`companion-queue__header`},mj={class:`companion-queue__count`},hj={class:`companion-queue__hint`},gj={class:`companion-queue__list`},_j={class:`companion-queue__text`},vj={class:`companion-queue__actions`},yj=Ke(R({__name:`CompanionQueue`,props:{conversationId:{}},setup(e){let t=e,{t:i}=ge(),a=ut(),o=Fe(),s=L(()=>a.companionPendingFor(t.conversationId)),c=r(null);async function l(e,n){c.value=e;try{let r={id:t.conversationId,findingId:e};n===`send`?await J.chat.conversations.sendCompanionFinding.mutate(r):await J.chat.conversations.discardCompanionFinding.mutate(r)}catch(e){o.add({severity:`error`,summary:i(`common.error`),detail:e.message,life:4e3})}finally{c.value=null}}return(e,t)=>{let r=v(`tooltip`);return s.value.length?(z(),j(`aside`,{key:0,class:`companion-queue`,"aria-label":n(i)(`aiChat.companionQueueTitle`)},[A(`header`,pj,[t[0]||=A(`i`,{class:`ti ti-clock`,"aria-hidden":`true`},null,-1),A(`span`,null,U(n(i)(`aiChat.companionQueueTitle`)),1),A(`span`,mj,U(s.value.length),1)]),A(`p`,hj,U(n(i)(`aiChat.companionQueueHint`)),1),A(`ul`,gj,[(z(!0),j(V,null,M(s.value,e=>(z(),j(`li`,{key:e.id,class:`companion-queue__item`},[A(`p`,_j,U(e.text),1),A(`div`,vj,[k(y(n(q),{label:n(i)(`aiChat.companionQueueSend`),icon:`ti ti-send`,size:`small`,variant:`outlined`,disabled:c.value===e.id,onClick:t=>l(e.id,`send`)},null,8,[`label`,`disabled`,`onClick`]),[[r,n(i)(`aiChat.companionQueueSendHint`),void 0,{top:!0}]]),k(y(n(q),{"aria-label":n(i)(`aiChat.companionQueueDiscard`),icon:`ti ti-x`,size:`small`,variant:`text`,disabled:c.value===e.id,onClick:t=>l(e.id,`discard`)},null,8,[`aria-label`,`disabled`,`onClick`]),[[r,n(i)(`aiChat.companionQueueDiscard`),void 0,{top:!0}]])])]))),128))])],8,fj)):K(``,!0)}}}),[[`__scopeId`,`data-v-d5c3495f`]]),bj=`runeya:terminal-font-size`;function xj(e){let{sessionId:t,agentId:n,replay:r,onError:i}=e,a=document.createElement(`div`);a.style.width=`100%`,a.style.height=`100%`;let o=new Hv({cursorBlink:!0,fontFamily:`monospace`,fontSize:sy(bj,14),theme:{background:`#1a1b1e`,foreground:`#d4d4d4`,cursor:`#d4d4d4`},allowProposedApi:!1}),s=new Gv;o.loadAddon(s),o.open(a);let c=e=>{J.terminal.write.mutate({agentId:n,sessionId:t,data:e}).catch(()=>{})};o.onData(c);let l=Jv(o,c),u=ay(o,a),d=ly(o),f={terminal:o,fitAddon:s,container:a,subscription:J.terminal.onData.subscribe({agentId:n,sessionId:t,replay:r},{onData(e){d.write(e)},onError(e){i?.(e.message)}}),detachDeadKeyFix:l,detachTouchScroll:u,detachZoom:null,writer:d};return f.detachZoom=cy({terminal:o,container:a,storageKey:bj,onResize:()=>wj(f,n,t)}),f}function Sj(e){e.detachDeadKeyFix?.(),e.detachTouchScroll?.(),e.detachZoom?.(),e.writer.dispose(),e.subscription?.unsubscribe(),e.terminal.dispose(),e.container.remove()}function Cj(e,t){e.container.parentElement!==t&&t.appendChild(e.container)}function wj(e,t,n){if(e.container.isConnected){try{e.fitAddon.fit()}catch{return}J.terminal.resize.mutate({agentId:t,sessionId:n,cols:e.terminal.cols,rows:e.terminal.rows}).catch(()=>{})}}var Tj=`runeya.conversation-terminals`,Ej=new Map;function Dj(){try{let e=localStorage.getItem(Tj);if(!e)return{};let t=JSON.parse(e);return t?.version!==1||typeof t.sessions!=`object`||!t.sessions?{}:t.sessions}catch{return{}}}function Oj(e){try{let t={version:1,sessions:e};localStorage.setItem(Tj,JSON.stringify(t))}catch{}}function kj(e,t){let n=Dj();t?n[e]=t:delete n[e],Oj(n)}var Aj=r(null),jj=r(!1);function Mj(){async function e(e,t,n){if(Aj.value=null,Ej.has(e))return!0;jj.value=!0;try{let r=Dj()[e];if(r&&r.agentId===t){let{sessions:n}=await J.terminal.list.query({agentId:t});if(n.some(e=>e.sessionId===r.sessionId))return Ej.set(e,xj({sessionId:r.sessionId,agentId:t,replay:!0,onError:e=>{Aj.value=e}})),!0}let i=await J.terminal.create.mutate({agentId:t,...n?.projectId?{projectId:n.projectId,orgId:n.orgId??null}:{},cols:80,rows:24,title:`Chat ${e.slice(0,8)}`});return kj(e,{agentId:t,sessionId:i.sessionId}),Ej.set(e,xj({sessionId:i.sessionId,agentId:t,replay:!1,onError:e=>{Aj.value=e}})),!0}catch(e){return Aj.value=e.message,!1}finally{jj.value=!1}}function t(e,t){let n=Ej.get(e);n&&(Cj(n,t),r(e),n.terminal.focus())}function n(e){return Ej.get(e)?.terminal??null}function r(e){let t=Ej.get(e),n=Dj()[e];t&&n&&wj(t,n.agentId,n.sessionId)}async function i(e){let t=Ej.get(e);t&&(Sj(t),Ej.delete(e));let n=Dj()[e];kj(e,null),n&&await J.terminal.destroy.mutate({agentId:n.agentId,sessionId:n.sessionId}).catch(()=>{})}return{open:e,attach:t,fit:r,destroy:i,getTerminal:n,errorMsg:Aj,loading:jj}}var Nj={class:`terminal-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Pj=Ke(R({__name:`TerminalIcon`,setup(e){return(e,t)=>(z(),j(`svg`,Nj,[...t[0]||=[A(`polyline`,{points:`4 17 10 11 4 5`},null,-1),A(`line`,{x1:`12`,y1:`19`,x2:`20`,y2:`19`},null,-1)]]))}}),[[`__scopeId`,`data-v-cb1db4b3`]]),Fj={class:`conversation-terminal__header`},Ij={class:`conversation-terminal__title`},Lj={key:0,class:`conversation-terminal__error`},Rj={key:1,class:`conversation-terminal__error`},zj=Ke(R({__name:`ConversationTerminalDialog`,props:g({conversationId:{},agentId:{}},{visible:{type:Boolean,required:!0},visibleModifiers:{}}),emits:[`update:visible`],setup(e){let t=e,i=x(e,`visible`),{t:a}=ge(),s=ye(),{open:c,attach:l,fit:u,destroy:d,getTerminal:f,errorMsg:p,loading:m}=Mj(),h=r(null),g=o(null),_=null;async function v(){await c(t.conversationId,t.agentId,s.activeProjectId?{projectId:s.activeProjectId,orgId:s.activeOrgId}:void 0)&&h.value&&(h.value.replaceChildren(),l(t.conversationId,h.value),g.value=f(t.conversationId),_?.disconnect(),_=new ResizeObserver(()=>u(t.conversationId)),_.observe(h.value))}function C(){_?.disconnect(),_=null,g.value=null}async function w(){C(),await d(t.conversationId),i.value=!1}return S(i,e=>{e||C()}),S(()=>t.conversationId,()=>{i.value&&v()}),ne(C),(e,t)=>(z(),W(n(Ve),{visible:i.value,"onUpdate:visible":t[0]||=e=>i.value=e,modal:``,maximizable:``,"dismissable-mask":``,style:{width:`70vw`,height:`70vh`},"content-class":`conversation-terminal__content`,onShow:v},{header:H(()=>[A(`div`,Fj,[A(`span`,Ij,[y(Pj),b(` `+U(n(a)(`aiChat.terminalTitle`)),1)]),y(n(q),{size:`small`,variant:`text`,severity:`danger`,icon:`ti ti-power`,title:n(a)(`aiChat.terminalKill`),onClick:w},null,8,[`title`])])]),default:H(()=>[n(p)?(z(),j(`div`,Lj,[t[1]||=A(`i`,{class:`ti ti-alert-triangle`},null,-1),b(` `+U(n(p)),1)])):n(m)?(z(),j(`div`,Rj,[...t[2]||=[A(`i`,{class:`ti ti-spin ti-loader-2`},null,-1)]])):K(``,!0),y(Ay,{terminal:g.value},null,8,[`terminal`]),A(`div`,{ref_key:`hostEl`,ref:h,class:`conversation-terminal__host`},null,512)]),_:1},8,[`visible`]))}}),[[`__scopeId`,`data-v-b1e2454e`]]);function Bj(e,t){return`${e}:${t}`}function Vj(e){let t=r({}),n=new Map,i=new Set,a=L(()=>{let n={};for(let r of e.value){let e=t.value[r.boardId];if(!e)continue;let i=(e.columns??[]).find(e=>e.cards.some(e=>e.id===r.cardId));i&&(n[Bj(r.boardId,r.cardId)]=i.title)}return n}),o=L(()=>{let e={};for(let[n,r]of Object.entries(t.value))e[n]=r.name;return e});async function s(e){if(!i.has(e)){i.add(e);try{let n=(await zt.$fetch(`/kanban/board/get`,{method:`GET`,query:{id:e}}))?.data?.board??null;if(!n)return;t.value={...t.value,[e]:n},n.organizationId&&c(n.organizationId)}catch{}finally{i.delete(e)}}}function c(e){if(n.has(e)||typeof EventSource>`u`)return;let r=new EventSource(Vt(e));r.onmessage=e=>{try{let n=JSON.parse(e.data),r=t.value[n.boardId];if(!r||n.type===`board.changed`&&n.updatedAt===r.updatedAt)return;s(n.boardId)}catch{}},n.set(e,r)}return S(e,e=>{for(let n of new Set(e.map(e=>e.boardId)))t.value[n]||s(n)},{immediate:!0,deep:!0}),l(()=>{for(let e of n.values())e.close();n.clear()}),{columnTitles:a,boardNames:o}}function Hj(e,t){let{columnTitles:n,boardNames:r}=Vj(L(()=>e.value&&t.value?[{boardId:e.value,cardId:t.value}]:[]));return{columnTitle:L(()=>e.value&&t.value?n.value[Bj(e.value,t.value)]??``:``),boardName:L(()=>e.value?r.value[e.value]??``:``)}}var Uj=r(null),Wj=r(null);function Gj(){function e(e){Uj.value=e,Wj.value=null}function t(e){Wj.value=e}function n(){Uj.value=null}function r(){Wj.value=null}return{pendingConvId:Uj,generatedCode:Wj,setPendingConv:e,setGeneratedCode:t,clear:n,clearResult:r}}var Kj={class:`ai-chat-page__main`},qj={key:0,class:`ai-chat-page__empty`},Jj={class:`ai-chat-page__header`},Yj={class:`ai-chat-page__header-left`},Xj={class:`ai-chat-page__header-title`},Zj=[`title`],Qj={class:`ai-chat-page__title-text`},$j={class:`ai-chat-page__conv-meta`},eM={key:0,class:`ai-chat-page__runner-badge`},tM={key:1,class:`ai-chat-page__claude-thinking`,title:`Claude est en train de générer une réponse`},nM={key:2,class:`ai-chat-page__claude-idle`,title:`Le process Claude est actif (en attente de saisie)`},rM=[`title`],iM={class:`ai-chat-page__context-progress-bar`},aM={class:`ai-chat-page__context-progress-label`},oM={key:0,class:`ai-chat-page__kanban-column`},sM=[`title`],cM={class:`ai-chat-page__header-actions`},lM={class:`ai-chat-page__git-add`},uM={class:`ai-chat-page__git-del`},dM={key:1,class:`ti ti-code`},fM={class:`conv-menu`},pM=[`disabled`],mM={key:3,class:`ai-chat-page__terminal-row`},hM={class:`ai-chat-page__git-notice`},gM={key:0,class:`ai-chat-page__pty-debug`},_M={class:`ai-chat-page__pty-debug-header`},vM=R({__name:`AiChatPage`,setup(e){let{t}=ge(),i=Ce(),a=Fe(),o=ut(),s=dt(),{activeId:c,activeConversation:l,isStreaming:u,streamingConvId:d,activeContextUsage:f,contextPercent:p}=_e(o),m=r(!1);async function h(){let e=l.value;if(e&&!m.value){m.value=!0;try{await J.chat.pty.syncTranscript.mutate({conversationId:e.id})}catch(e){a.add({severity:`warn`,summary:`Sync failed`,detail:e.message,life:4e3})}finally{m.value=!1}}}let g=L(()=>new URLSearchParams(window.location.search).has(`debugPty`)),_=r(!1),v=r(null),x=r(void 0),C=r(0);async function w(){let e=l.value;if(!e)return;let t=window.prompt(`PTY stress: bytes per second?`,`200000`);if(!t)return;let n=Number(t);try{let t=await J.chat.pty.debugStress.mutate({sessionId:e.id,agentId:e.agentId,bytesPerSec:n,chunkSize:512,durationMs:3e4});v.value=t.spawnId,x.value=t.agentId,C.value=n,_.value=!0,a.add({severity:`info`,summary:`PTY stress started`,detail:`${n.toLocaleString()} B/s for 30s`,life:3e3})}catch(e){a.add({severity:`error`,summary:`Stress failed`,detail:e.message,life:4e3})}}function T(){_.value=!1,v.value=null}let E=L(()=>{let e=l.value;return e?e.runner??(e.isCli&&!e.providerId?`claude-code`:null):null}),D=L(()=>E.value===`claude-code`),ee=L(()=>E.value===`codex`),O=L(()=>D.value||ee.value),k=r(!1),M=r(null),F=r(Date.now()),te=null,ne=L(()=>!k.value||!M.value?!1:F.value-M.value<1500);async function R(){let e=l.value;if(!e||!D.value){k.value=!1,M.value=null;return}try{let t=await J.chat.pty.activity.query({sessionId:e.id,agentId:e.agentId});k.value=t.running,M.value=t.idleMs===null?null:Date.now()-t.idleMs}catch{k.value=!1}}let ie=en(R,1e3,`ai-chat-page:activity`);function ae(){ie.stop(),te&&=(clearInterval(te),null),k.value=!1,M.value=null}function oe(){ae(),te||=setInterval(()=>{F.value=Date.now()},500),ie.start(),ie.trigger()}S([()=>l.value?.id,D],([e,t])=>{e&&t?oe():ae()},{immediate:!0}),I(()=>ae());let ce=L(()=>{let e=l.value;if(!e||e.workflowType===`scenario`)return null;let t=e.runner??(e.isCli&&!e.providerId?`claude-code`:null);if(t===`codex`)return`Codex`;if(t===`claude-code`)return`Claude Code`;if(e.providerId){let t=o.providers.find(t=>t.id===e.providerId);if(t)return t.label}return null}),G=r(``),le=r(!1),ue=r(!1),fe=r(!1),pe=r(``),me=r(null),ve=L(()=>l.value?.companionRunner??E.value??`claude-code`);function be(){let e=l.value;e&&o.setCompanion(e.id,!0)}function xe(){let e=l.value;e&&o.setCompanion(e.id,!1)}function Se(e){let t=l.value;if(!t)return;let n=e===`codex`?`codex`:`claude-code`,r=n===ve.value?void 0:``;o.setCompanion(t.id,!!t.companionEnabled,{runner:n,model:r})}function we(e){let t=l.value;if(!t)return;let n=e===`low`||e===`normal`||e===`high`?e:``;o.setCompanion(t.id,!!t.companionEnabled,{effort:n})}function Te(e){let t=l.value;t&&o.setCompanion(t.id,!!t.companionEnabled,{model:typeof e==`string`?e:``})}function Ee(){l.value&&(pe.value=l.value.title,fe.value=!0,se(()=>me.value?.$el?.select()))}async function De(){if(!l.value)return;let e=pe.value.trim();e&&await o.renameConversation(l.value.id,e),fe.value=!1}function Oe(){fe.value=!1}function Ae(e){return e.messagesOmitted?(e.messageCount??0)>0:(e.messages?.length??0)>0}function Me(e){navigator.clipboard.writeText(e),a.add({severity:`success`,summary:t(`aiChat.conversationIdCopied`),life:2e3})}let Ne=r(null),Pe=r(null),Ie=r(null),Le=r([]),Re=0,ze=()=>new Date().toISOString(),Be=en(async()=>{let e=o.refreshStreamingSessions;typeof e==`function`?await e():await o.init()},1500,`ai-chat-page:streaming-refresh`),He=L(()=>u.value&&d.value===c.value);function Ue(){return l.value?.workflowType===`scenario`?Pe.value?.messagesEl??null:Ne.value?.messagesEl??null}function We(){let e=Ue();if(!e)return!0;let{scrollTop:t,scrollHeight:n,clientHeight:r}=e;return n-t-r<80}async function Ge(e=!1){if(!e&&!We())return;await se();let t=Ue();t&&(t.scrollTop=t.scrollHeight),t?.querySelectorAll(`.ai-chat-scenario-view__thinking-content, .ai-chat-message-list__thinking-content`).forEach(e=>{e.scrollTop=e.scrollHeight})}function Ke(){c.value=null,le.value=!0,o.pendingNewConversation=!0,ue.value=!1}function qe(e){o.pendingNewConversation=!1,o.selectConversation(e),ue.value=!1,le.value=!1,Pe.value?.resetNodeSelection()}async function Je(e){o.deleteConversation(e)}async function Ye(e=`keep`,t,n,r){le.value=!1,o.pendingNewConversation=!1,await o.createConversation({runner:e===`keep`?void 0:e,providerId:e===`keep`?t??void 0:void 0,agentId:n,cliModel:r}),G.value=``}function Xe(e,t,n,r){le.value=!1,o.pendingNewConversation=!1,Ie.value?.showScenarioDialog(e,void 0,t,n??void 0,r)}async function Ze(e,n,r,i,s,c){try{let t=await o.createConversation({scenarioId:e,scenarioInput:n,title:n?`Scenario: ${n}`:`Scenario conversation`,providerId:s,agentId:c});if(await Ge(!0),n&&t){let a=r===`codex`?``:i.trim(),s=r!==`keep`||a||c?{...r===`keep`?{}:{runnerOverride:r},...a?{modelOverride:a}:{},...c?{agentId:c}:{}}:void 0;o.startScenarioRun(t.id,e,n,()=>Ge(!1),s)}}catch(e){a.add({severity:`error`,summary:t(`common.error`),detail:e.message,life:4e3})}}async function Qe(){let e=l.value;e&&e.workflowType===`scenario`&&await o.stopScenario(e.id)}function $e(){Ie.value?.showResumeScenarioDialog()}async function et(e,n){let r=l.value;if(!r)return;let i=e===`keep`?void 0:e;try{await o.resumeScenario(r.id,()=>Ge(!1),{...i?{runnerOverride:i}:{},...n?{agentId:n}:{}})}catch(e){a.add({severity:`error`,summary:t(`common.error`),detail:e.message,life:4e3})}}async function tt(){let e=G.value,n=G.value.trim(),{pendingContext:r,pendingPopulateContext:i}=sn();if(!n&&o.pendingImages.length===0&&!r.value&&!i.value||(!n&&r.value&&(n=`Voici le contexte ci-joint, aide-moi à avancer.`),!n&&i.value&&(n=i.value),!l.value&&(await Ye(),!l.value)))return;let s=l.value;try{if(s.workflowType===`scenario`){if(s.scenarioRunning)return;G.value=``,o.startScenarioRun(s.id,s.workflowId,n,()=>Ge(!1),s.scenarioRunOverrides),await Ge(!0);return}G.value=``,i.value=null,await o.send(n,Ge)}catch(n){G.value||=e,a.add({severity:`error`,summary:t(`common.error`),detail:n.message,life:3500})}}function nt(e,t){let n=null;S(d,t=>{t&&e(t)&&(n=t)}),S(u,async e=>{if(e||!n)return;let r=n;n=null,await t(r),await o.deleteConversation(r),sn().close()})}let{columnTitle:rt}=Hj(L(()=>l.value?.kanbanBoardId),L(()=>l.value?.kanbanCardId)),{openedCard:it,openKanban:at}=il();nt(e=>{let t=o.conversations.find(t=>t.id===e);return!(!t?.kanbanBoardId||t.kanbanCardId)},async()=>{});let ot=Gj();nt(e=>e===ot.pendingConvId.value,async e=>{ot.clear();let t=o.conversations.find(t=>t.id===e);if(!t)return;let n=t.messages.filter(e=>e.role===`assistant`),r=n[n.length-1];if(r?.content){let e=r.content.match(/```(?:javascript|js|typescript|ts)?\n([\s\S]+?)```/);e&&ot.setGeneratedCode(e[1].trim())}}),S(()=>l.value?.id,async e=>{if(Pe.value?.resetNodeSelection(),e&&l.value?.workflowType===`scenario`&&await s.fetchScenarios(),e&&D.value)try{await J.chat.pty.syncTranscript.mutate({conversationId:e})}catch{}}),S(c,e=>{e&&(le.value=!1),se(()=>Ge(!0))},{flush:`sync`});let st=!0;S(()=>{let e=l.value?.messages;if(!e||e.length===0)return``;let t=e[e.length-1];return`${e.length}|${t?.content?.length??0}|${t?.parts?.length??0}`},()=>{st=We()},{flush:`pre`}),S(()=>{let e=l.value?.messages;if(!e||e.length===0)return``;let t=e[e.length-1];return`${e.length}|${t?.content?.length??0}|${t?.parts?.length??0}`},()=>{if(!st)return;let e=Ue();e&&(e.scrollTop=e.scrollHeight)},{flush:`post`});let{autoSendPending:ct,hideSidebar:ft}=sn(),pt=r(!1),mt=hn(),ht=ye(),gt=r(!1),_t=r(!1),vt=r(0),{size:yt,isResizing:bt,start:xt}=ZA({axis:`x`,min:180,max:()=>Math.min(560,window.innerWidth-320),initial:280,storageKey:`runeya.ai-chat.sidebar-width`}),St=r(null);function Ct(e){St.value?.hide(),e()}let wt=L(()=>l.value?.agentId??mt.connectedAgents[0]?.config.id??null),Tt=r(null),Et=r(!1),Dt=L(()=>{let e=l.value;if(!e)return null;let t=e.projectId&&e.projectId===ht.activeProjectId?ht.activeOrgId:void 0;return{agentId:e.agentId,projectId:e.projectId,orgId:t}}),Ot=L(()=>{let e=Dt.value?.agentId;return e?mt.getById(e)?.config.name??null:null}),kt=L(()=>Ot.value?`${t(`aiChat.viewGitChanges`)} — ${Ot.value}`:t(`aiChat.viewGitChanges`)),{refresh:At}=ei(()=>Dt.value,e=>{Tt.value=e?{additions:e.additions??0,deletions:e.deletions??0}:null,Et.value=!!e});S(pt,e=>{e||At()});async function jt(){ct.value&&l.value&&(O.value||(ct.value=!1,await se(),tt()))}S([ct,l],()=>jt());function Mt(){let e=i.query.conversation;typeof e==`string`&&e&&o.conversations.some(t=>t.id===e)&&o.selectConversation(e)}return S(()=>i.query.conversation,()=>Mt()),N(async()=>{lt()&&console.time(`[ai-chat][page] mount`),lt()&&console.log(`[ai-chat][page]`,ze(),`mounted`,{drawerHideSidebar:ft.value,activeId:c.value}),o.isChatPageVisible=!0,await o.init(),o.setScrollCallback(Ge),s.fetchScenarios(),J.scenario.listPresets.query().then(e=>{Le.value=e}).catch(()=>{}),se(()=>Ge(!0)),jt(),Mt(),Be.start(),lt()&&console.timeEnd(`[ai-chat][page] mount`)}),re(()=>{Re+=1,lt()&&console.log(`[ai-chat][page]`,ze(),`updated`,{count:Re,activeId:c.value,hasConversation:!!l.value,isStreaming:u.value,drawerHideSidebar:ft.value})}),I(()=>{lt()&&console.log(`[ai-chat][page]`,ze(),`unmounted`,{updates:Re,activeId:c.value}),Be.stop(),o.isChatPageVisible=!1,o.setScrollCallback(()=>{})}),(e,r)=>(z(),j(V,null,[A(`div`,{class:P([`ai-chat-page`,{"ai-chat-page--no-sidebar":n(ft)}]),style:B(n(ft)?void 0:{gridTemplateColumns:`${n(yt)}px 0 1fr`})},[n(ft)?K(``,!0):(z(),j(`div`,{key:0,class:P([`ai-chat-page__sidebar-wrap`,{"ai-chat-page__sidebar-wrap--open":ue.value}])},[y(Jl,{onStartNew:Ke,onSelectConversation:qe,onDeleteConversation:Je})],2)),n(ft)?K(``,!0):(z(),j(`div`,{key:1,class:P([`ai-chat-page__resizer`,{"ai-chat-page__resizer--active":n(bt)}]),onPointerdown:r[0]||=he((...e)=>n(xt)&&n(xt)(...e),[`prevent`])},null,34)),ue.value&&!n(ft)?(z(),j(`div`,{key:2,class:`ai-chat-page__backdrop`,onClick:r[1]||=e=>ue.value=!1})):K(``,!0),A(`section`,Kj,[le.value||!n(l)?(z(),j(`div`,qj,[y(n(q),{class:`ai-chat-page__menu-btn ai-chat-page__menu-btn--empty`,icon:`ti ti-menu-2`,variant:`text`,rounded:``,size:`small`,onClick:r[2]||=e=>ue.value=!ue.value}),y(rn,{onSelectScenario:Xe,onSkip:Ye})])):(z(),j(V,{key:1},[A(`header`,Jj,[A(`div`,Yj,[y(n(q),{class:`ai-chat-page__menu-btn`,icon:`ti ti-menu-2`,variant:`text`,rounded:``,size:`small`,onClick:r[3]||=e=>ue.value=!ue.value}),A(`div`,Xj,[fe.value?(z(),W(n(je),{key:0,ref_key:`renameInputEl`,ref:me,modelValue:pe.value,"onUpdate:modelValue":r[4]||=e=>pe.value=e,class:`ai-chat-page__rename-input`,size:`small`,onKeydown:[de(De,[`enter`]),de(Oe,[`escape`])],onBlur:De},null,8,[`modelValue`])):(z(),j(`h2`,{key:1,class:`ai-chat-page__title`,role:`button`,tabindex:`0`,title:n(t)(`aiChat.rename`),onClick:Ee,onKeydown:de(Ee,[`enter`])},[A(`span`,Qj,U(n(l).title),1),r[24]||=A(`i`,{class:`ti ti-pencil ai-chat-page__title-pencil`},null,-1)],40,Zj)),A(`div`,$j,[ce.value?(z(),j(`span`,eM,U(ce.value),1)):K(``,!0),D.value&&ne.value?(z(),j(`span`,tM,[...r[25]||=[A(`i`,{class:`ti ti-spin ti-circle-filled`},null,-1),b(` Claude réfléchit… `,-1)]])):D.value&&k.value?(z(),j(`span`,nM,[...r[26]||=[A(`i`,{class:`ti ti-circle-filled`},null,-1),b(` Actif `,-1)]])):K(``,!0),n(f)&&n(p)!==null?(z(),j(`div`,{key:3,class:`ai-chat-page__context-progress`,title:`Context: ${n(f).inputTokens.toLocaleString()} / ${n(f).contextWindow.toLocaleString()} tokens`},[A(`div`,iM,[A(`div`,{class:P([`ai-chat-page__context-progress-fill`,{"ai-chat-page__context-progress-fill--warn":n(p)>=70,"ai-chat-page__context-progress-fill--danger":n(p)>=90}]),style:B({width:n(p)+`%`})},null,6)]),A(`span`,aM,U(n(p))+`%`,1)],8,rM)):K(``,!0),n(l).kanbanBoardId?(z(),j(`a`,{key:4,class:`ai-chat-page__kanban-link`,title:`Ouvrir le tableau Kanban`,onClick:r[5]||=e=>n(at)(n(l).kanbanBoardId,n(l).kanbanCardId)},[r[27]||=A(`i`,{class:`ti ti-table`,style:{"font-size":`0.7rem`}},null,-1),r[28]||=b(` Kanban `,-1),n(rt)?(z(),j(`span`,oM,`· `+U(n(rt)),1)):K(``,!0)])):K(``,!0),n(l).id?(z(),j(`span`,{key:5,class:`ai-chat-page__conv-id`,title:n(l).id,onClick:r[6]||=e=>Me(n(l).id)},`ID: `+U(n(l).id.slice(0,8))+`…`,9,sM)):K(``,!0)])])]),A(`div`,cM,[Dt.value&&Et.value?(z(),W(n(q),{key:0,class:`ai-chat-page__git-btn`,size:`small`,variant:`text`,title:kt.value,onClick:r[7]||=e=>pt.value=!0},{default:H(()=>[Tt.value&&(Tt.value.additions||Tt.value.deletions)?(z(),j(V,{key:0},[A(`span`,lM,`+`+U(Tt.value.additions),1),A(`span`,uM,`-`+U(Tt.value.deletions),1)],64)):(z(),j(`i`,dM))]),_:1},8,[`title`])):K(``,!0),n(l).workflowType===`scenario`&&n(l).scenarioRunning?(z(),W(n(q),{key:1,size:`small`,severity:`danger`,icon:`ti ti-player-stop`,label:`Stop`,onClick:Qe})):K(``,!0),g.value&&D.value?(z(),W(n(q),{key:2,size:`small`,variant:`text`,severity:`warn`,icon:`ti ti-bolt`,title:`Debug: lance un PTY de stress (random data) sur cette session`,onClick:w})):K(``,!0),wt.value?(z(),W(n(q),{key:3,size:`small`,variant:`text`,title:n(t)(`aiChat.openTerminal`),onClick:r[8]||=e=>gt.value=!0},{default:H(()=>[y(Pj)]),_:1},8,[`title`])):K(``,!0),y(n(q),{size:`small`,variant:`text`,icon:`ti ti-dots-vertical`,title:n(t)(`aiChat.menu`),"aria-label":n(t)(`aiChat.menu`),onClick:r[9]||=e=>St.value?.toggle(e)},null,8,[`title`,`aria-label`]),y(n(ke),{ref_key:`convMenu`,ref:St},{default:H(()=>[A(`div`,fM,[D.value?(z(),j(`button`,{key:0,class:`conv-menu__item`,disabled:m.value,onClick:r[10]||=e=>Ct(h)},[A(`i`,{class:P(m.value?`ti ti-spin ti-loader-2`:`ti ti-refresh`)},null,2),A(`span`,null,U(n(t)(`aiChat.syncTranscript`)),1)],8,pM)):K(``,!0),O.value&&!n(l).isCompanion?(z(),j(`button`,{key:1,class:`conv-menu__item`,onClick:r[11]||=e=>{Ct(()=>{_t.value=!0})}},[r[29]||=A(`i`,{class:`ti ti-key`},null,-1),A(`span`,null,U(n(t)(`aiChat.secretEnv.menu`)),1)])):K(``,!0),A(`button`,{class:`conv-menu__item`,onClick:r[12]||=e=>Ct(()=>n(o).pinConversation(n(l).id,n(l).pinOrder===void 0))},[A(`i`,{class:`ti ti-pin`,style:B(n(l).pinOrder===void 0?void 0:`opacity:0.5`)},null,4),A(`span`,null,U(n(l).pinOrder===void 0?n(t)(`aiChatPage.pin`):n(t)(`aiChatPage.unpin`)),1)]),A(`button`,{class:`conv-menu__item`,onClick:r[13]||=e=>Ct(()=>n(o).archiveConversation(n(l).id,!n(l).archived))},[A(`i`,{class:`ti ti-inbox`,style:B(n(l).archived?`opacity:0.5`:void 0)},null,4),A(`span`,null,U(n(l).archived?n(t)(`aiChatPage.unarchive`):n(t)(`aiChatPage.archive`)),1)]),A(`button`,{class:`conv-menu__item conv-menu__item--danger`,onClick:r[14]||=e=>Ct(()=>n(o).deleteConversation(n(l).id))},[r[30]||=A(`i`,{class:`ti ti-trash`},null,-1),A(`span`,null,U(n(t)(`aiChat.deleteConversation`)),1)])])]),_:1},512)])]),wt.value?(z(),W(zj,{key:0,visible:gt.value,"onUpdate:visible":r[15]||=e=>gt.value=e,"conversation-id":n(l).id,"agent-id":wt.value},null,8,[`visible`,`conversation-id`,`agent-id`])):K(``,!0),y(zy,{visible:_t.value,"onUpdate:visible":r[16]||=e=>_t.value=e,"conversation-id":n(l).id,onSaved:r[17]||=e=>vt.value++},null,8,[`visible`,`conversation-id`]),!n(l).isCompanion&&n(l).workflowType!==`scenario`?(z(),W(dj,{key:1,enabled:!!n(l).companionEnabled,runner:ve.value,model:n(l).companionModel??``,effort:n(l).companionEffort??``,"companion-conversation-id":n(l).companionConversationId,"main-conversation-id":n(l).id,onEnable:be,onDisable:xe,"onUpdate:runner":Se,"onUpdate:model":Te,"onUpdate:effort":we},null,8,[`enabled`,`runner`,`model`,`effort`,`companion-conversation-id`,`main-conversation-id`])):K(``,!0),n(l).workflowType===`scenario`?(z(),W(GA,{key:2,ref_key:`scenarioViewRef`,ref:Pe,"available-presets":Le.value,onClickResume:$e},null,8,[`available-presets`])):O.value?(z(),j(`div`,mM,[(z(),W(Ny,{key:vt.value,"session-id":n(l).id,runner:E.value??`claude-code`,resume:Ae(n(l)),"agent-id":n(l).agentId},null,8,[`session-id`,`runner`,`resume`,`agent-id`])),y(yj,{"conversation-id":n(l).id},null,8,[`conversation-id`])])):(z(),W(ku,{key:4,ref_key:`messageListRef`,ref:Ne,messages:n(l).messages,"is-streaming":n(u),onOpenImagePreview:r[18]||=(e,t)=>Ie.value?.openImagePreview(e,t)},null,8,[`messages`,`is-streaming`])),n($r)(n(l),O.value)?(z(),W(Wu,{key:5,input:G.value,"onUpdate:input":r[19]||=e=>G.value=e,"is-streaming":n(u),"is-streaming-current-conv":He.value,"active-conversation-id":n(l).id,onSubmit:tt,onOpenImagePreview:r[20]||=(e,t)=>Ie.value?.openImagePreview(e,t)},null,8,[`input`,`is-streaming`,`is-streaming-current-conv`,`active-conversation-id`])):K(``,!0)],64))])],6),y(on,{ref_key:`modalsRef`,ref:Ie,onConfirmScenarioStart:Ze,onConfirmResumeScenario:et},null,512),y(n(Ve),{visible:pt.value,"onUpdate:visible":r[21]||=e=>pt.value=e,header:kt.value,modal:``,"dismissable-mask":``,maximizable:``,style:{width:`85vw`,height:`85vh`},"content-style":{padding:0,height:`100%`,display:`flex`,flexDirection:`column`,overflow:`hidden`}},{default:H(()=>[A(`div`,hM,[r[31]||=A(`i`,{class:`ti ti-info-circle`},null,-1),A(`span`,null,U(n(t)(`aiChat.gitChangesNotice`)),1)]),Dt.value&&pt.value?(z(),W(ea,{key:0,"agent-id":Dt.value.agentId,"project-id":Dt.value.projectId,"org-id":Dt.value.orgId},null,8,[`agent-id`,`project-id`,`org-id`])):K(``,!0)]),_:1},8,[`visible`,`header`]),_.value&&v.value?(z(),j(`div`,gM,[A(`div`,_M,[r[32]||=A(`i`,{class:`ti ti-bolt`},null,-1),A(`span`,null,`PTY stress · `+U(C.value.toLocaleString())+` B/s`,1),A(`button`,{type:`button`,class:`ai-chat-page__pty-debug-close`,onClick:T},`×`)]),(z(),W(Ny,{key:v.value,"attach-spawn-id":v.value,"agent-id":x.value,resume:!1},null,8,[`attach-spawn-id`,`agent-id`]))])):K(``,!0),n(it)?(z(),W(rl,{key:n(it).boardId,id:n(it).boardId,"card-id":n(it).cardId,onClose:r[22]||=e=>it.value=null,onOpenCard:r[23]||=e=>it.value=e},null,8,[`id`,`card-id`])):K(``,!0)],64))}}),yM=e({default:()=>bM}),bM=Ke(vM,[[`__scopeId`,`data-v-5bbf014c`]]),xM=e({useProcessStore:()=>DM}),SM=5,CM=un,wM=`runeya:ws-debug`;function TM(){try{return localStorage.getItem(wM)===`1`}catch{return!1}}function EM(...e){TM()&&console.log(`[process.store][ws]`,new Date().toISOString(),...e)}var DM=ve(`process`,()=>{let e=r([]),t=r(!1),n=r(null),i=r({}),a=null,o=0,s=null,c=null,l=new Map,u=L(()=>e.value.length),d=L(()=>e.value.filter(e=>e.state===`running`)),f=L(()=>(t,n)=>e.value.find(e=>e.agentId===t&&e.id===n)??null),p=L(()=>t=>e.value.filter(e=>e.serviceId===t));function m(e,t){return`${e}::${t}`}function h(e,t){return`/process/${e}/${t}`}function g(e){return pn().getById(e)?.name??e}function _(e,t){if(e.state===t.state)return;let n=mn(),r=g(t.serviceId),i=t.state===`errored`;n.add({type:i?`error`:`info`,category:`service_status_changed`,title:i?xe.global.t(`notifications.serviceErrored`):xe.global.t(`notifications.serviceStatusChanged`),message:`${r}: ${e.state} -> ${t.state}`,link:h(t.agentId,t.id),linkLabel:xe.global.t(`notifications.openService`,{name:r}),serviceId:t.serviceId})}function v(e,t){if(e.healthStatus===t.healthStatus)return;let n=mn(),r=g(t.serviceId),i=t.healthStatus===`unhealthy`?`warn`:t.healthStatus===`healthy`?`success`:`info`;n.add({type:i,category:`service_health_changed`,title:xe.global.t(`notifications.serviceHealthChanged`),message:`${r}: ${e.healthStatus} -> ${t.healthStatus}`,link:h(t.agentId,t.id),linkLabel:xe.global.t(`notifications.openService`,{name:r}),serviceId:t.serviceId})}function y(t){let n=e.value.find(e=>e.id===t.id&&e.agentId===t.agentId),r=e.value.findIndex(e=>e.id===t.id&&e.agentId===t.agentId);if(r>=0){let n=[...e.value];n[r]=t,e.value=n}else e.value=[...e.value,t];i.value={...i.value,[m(t.agentId,t.id)]:Date.now()},n&&(_(n,t),v(n,t))}function b(e,t){let n=m(e.agentId,e.id),r=l.get(n);r&&(clearTimeout(r),l.delete(n));let a=setTimeout(()=>{l.delete(n),(i.value[n]??0)<=t&&y(e)},900);l.set(n,a)}function x(){EM(`subscribeStatus()`),a=J.process.onStatus.subscribe({},{onData(e){o=0,EM(`onStatus data`,{id:e.id,agentId:e.agentId,state:e.state}),y(e)},onError(e){a=null,console.error(`[process.store] Status subscription error:`,e.message),EM(`onStatus error`,e.message,{retryCount:o}),S()}})}function S(){if(o>=SM){console.warn(`[process.store] Max retries (${SM}) reached for status subscription`),EM(`scheduleRetry max reached`,{retryCount:o});return}let e=CM*2**o+Math.random()*300;EM(`scheduleRetry`,{retryCount:o,delay:e}),o++,s=setTimeout(()=>{s=null,EM(`retry timer fired`),x()},e)}function C(e=!1){EM(`startStatusStream()`,{force:e,hasSub:!!a,hasRetryTimer:!!s}),c||=_t(()=>{EM(`onWsReopen — forcing status stream restart`),o=0,C(!0)}),s&&(clearTimeout(s),s=null,EM(`cleared pending retry timer`)),e&&a&&(a.unsubscribe(),a=null,EM(`forced unsubscribe existing statusSub`)),!a&&(o=0,x())}function w(){EM(`stopStatusStream()`),c&&=(c(),null),l.forEach(e=>clearTimeout(e)),l.clear(),s&&=(clearTimeout(s),null),a&&=(a.unsubscribe(),null),o=0}async function T(){t.value=!0,n.value=null;try{e.value=await J.process.list.query()}catch(e){n.value=It(e)??`Failed to fetch processes`}finally{t.value=!1}}async function E(e,t){n.value=null;try{let n=Date.now(),r=await J.process.start.mutate({agentId:e,processId:t});b(r,n);let i=ye();return i.activeProjectId&&r.serviceId&&i.addServiceToSelection({id:i.activeProjectId,orgId:i.activeOrgId},r.serviceId),r}catch(e){throw Qr().openFromError(e)||(n.value=It(e)??`Failed to start process`),e}}async function D(e,t){n.value=null;try{let n=Date.now(),r=await J.process.stop.mutate({agentId:e,processId:t});b(r,n);let i=ye();return i.activeProjectId&&r.serviceId&&i.removeServiceFromSelection({id:i.activeProjectId,orgId:i.activeOrgId},r.serviceId),r}catch(e){throw n.value=It(e)??`Failed to stop process`,e}}async function ee(e,t){n.value=null;try{let n=Date.now(),r=await J.process.restart.mutate({agentId:e,processId:t});return b(r,n),r}catch(e){throw Qr().openFromError(e)||(n.value=It(e)??`Failed to restart process`),e}}return{processes:e,loading:t,error:n,processCount:u,runningProcesses:d,getById:f,getByService:p,fetchAll:T,start:E,stop:D,restart:ee,startStatusStream:C,stopStatusStream:w}});async function OM(e){e.initTrpcWs(),await e.loadPreferences().catch(()=>{}),e.startStatusStream(),e.startDataStream()}var kM=null;function AM(){kM||=J.project.onDataChanged.subscribe(void 0,{onData({collections:e}){if(e.includes(`projects`)&&Dt().fetchAll(),e.includes(`services`)&&pn().fetchAll(),e.includes(`environments`)){let e=Ot(),t=e.currentProjectId;t&&e.fetchAll(t,!0)}},onError(){kM=null}})}function jM(){kM?.unsubscribe(),kM=null}var MM={class:`app-root`},NM={class:`app-root__view`},PM=[`title`],FM={key:0,class:`disconnected-overlay`},IM={class:`disconnected-box`},LM={class:`disconnected-title`},RM={class:`disconnected-subtitle`},zM=5e3,BM=Ke(R({__name:`App`,setup(e){let{missing:t,visible:r,checkEnvironment:i}=Qr(),a={"runeya:locale":ln([`fr`,`en`]),"runeya-dark-mode":ln([`0`,`1`]),"runeya-theme-color":ln([`slate`,`orange`,`amber`,`emerald`,`teal`,`sky`,`blue`,`violet`,`pink`,`custom`]),"runeya-theme-gradient":ln([`0`,`1`]),"runeya:mode":ln([`local-simple`,`cloud`]),"runeya:cloudUrl":cn().url().max(2048),"runeya:ai-chat-model":cn().max(200),"runeya:ai-chat-effort":ln([`low`,`medium`,`high`]),[lr(`app`)]:cn().max(32),[lr(`cloud`)]:cn().max(32)},o=[`runeya-mode`,`runeya-cloud-url`,`runeya-setup-complete`,`runeya-theme-preset`];function s(){for(let e of o)localStorage.removeItem(e);for(let[e,t]of Object.entries(a)){let n=localStorage.getItem(e);n!==null&&(t.safeParse(n).success||(console.warn(`[localStorage] Invalid value for "${e}", clearing:`,n),localStorage.removeItem(e)))}}s();let{t:c}=ge(),l=Fe(),u=Se(),d=qn();async function f(){await d.check();let{status:e,current:t,latest:n}=d;e.value===`outdated`&&n.value&&l.add({severity:`warn`,summary:c(`settingsPage.updateAvailable`),detail:c(`settingsPage.updateAvailableDetail`,{current:t.value,latest:n.value}),life:8e3})}let m=DM(),h=mn(),{state:g}=vt(),{isOpen:_,isExpanded:v,toggle:b,close:x}=sn(),C=()=>new Date().toISOString();function w(){lt()&&console.log(`[ai-chat][drawer]`,C(),`show`,{expanded:v.value,route:u.currentRoute.value.fullPath})}function T(){lt()&&console.log(`[ai-chat][drawer]`,C(),`hide`,{expanded:v.value,route:u.currentRoute.value.fullPath})}function E(e){e.ctrlKey&&e.shiftKey&&e.code===`Space`&&e.preventDefault()}function D(e){e.ctrlKey&&e.shiftKey&&e.code===`Space`&&b()}let ee=new Set([`unlock`,`setup`]),O=L(()=>ee.has(u.currentRoute.value.name)),{lockedProjectId:k}=ft(),M=L(()=>!k.value&&!O.value&&u.currentRoute.value.name!==`migrate-vault`),F=ye();function te(e){return e===`launch-services`?`launch-services:${F.activeOrgId??`local`}:${F.activeProjectId}`:void 0}let ne=!1,R=null;S(g,(e,t)=>{if(e!==`connected`){R===null&&(R=Date.now());return}let n=R===null?0:Date.now()-R;if(R=null,!ne){ne=!0;return}t!==`connected`&&!O.value&&n>=zM&&window.location.reload()}),N(()=>{window.addEventListener(`keydown`,E),window.addEventListener(`keyup`,D),f(),!O.value&&St()&&OM({loadPreferences:()=>h.loadPreferences(),initTrpcWs:yt,startStatusStream:()=>m.startStatusStream(),startDataStream:()=>AM()})}),I(()=>{m.stopStatusStream(),jM(),window.removeEventListener(`keydown`,E),window.removeEventListener(`keyup`,D)}),S(()=>u.currentRoute.value.name,(e,t)=>{let n=ee.has(t??``),r=ee.has(e??``);n&&!r&&St()&&OM({loadPreferences:()=>h.loadPreferences(),initTrpcWs:yt,startStatusStream:()=>m.startStatusStream(),startDataStream:()=>AM()})});let re=Dt();return S(()=>re.currentProject?.name,e=>{document.title=e?`${e} · Runeya`:`Runeya`},{immediate:!0}),S(()=>`${re.currentProject?.id??``}::${re.currentProject?.activeEnvironmentId??``}`,()=>{let e=re.currentProject?.activeEnvironmentId;e&&i(e)},{immediate:!0}),(e,i)=>(z(),j(V,null,[y(n(Ne)),y(n(Oe)),y(jr,{visible:n(r),"onUpdate:visible":i[0]||=e=>p(r)?r.value=e:null,missing:n(t)},null,8,[`visible`,`missing`]),M.value?(z(),W(Ur,{key:0})):K(``,!0),!O.value&&n(St)()?(z(),W(Jr,{key:1})):K(``,!0),A(`div`,MM,[y(sr),y(xr),A(`div`,NM,[y(zn,null,{default:H(()=>[y(n(Te),null,{default:H(({Component:e,route:t})=>[(z(),W(G(e),{key:te(t.name)}))]),_:1})]),_:1})])]),y(n(Ze),{visible:n(_),"onUpdate:visible":i[2]||=e=>p(_)?_.value=e:null,position:`right`,"show-close-icon":!1,onShow:w,onHide:T,header:n(c)(`drawer.aiChatTitle`),"show-header":!1,class:`ai-chat-drawer`,style:B({width:n(v)?`calc(100vw - 70px)`:`560px`})},{default:H(()=>[A(`button`,{class:`ai-drawer-expand-btn`,title:n(v)?n(c)(`drawer.collapse`):n(c)(`drawer.expand`),onClick:i[1]||=e=>v.value=!n(v)},[A(`i`,{class:P([`ti`,n(v)?`ti-chevron-right`:`ti-chevron-left`])},null,2)],8,PM),y(bM)]),_:1},8,[`visible`,`header`,`style`]),y(me,{name:`overlay`},{default:H(()=>[n(g)!==`connected`&&!O.value?(z(),j(`div`,FM,[A(`div`,IM,[i[3]||=A(`i`,{class:`ti ti-cloud-off disconnected-icon`},null,-1),A(`h1`,LM,U(n(c)(`connection.unreachable`)),1),A(`p`,RM,U(n(c)(`connection.reconnecting`)),1),i[4]||=A(`i`,{class:`ti ti-spin ti-loader-2 disconnected-spinner`},null,-1)])])):K(``,!0)]),_:1})],64))}}),[[`__scopeId`,`data-v-52960071`]]),VM=e({router:()=>HM}),HM=Ee({history:we(),routes:[{path:`/unlock`,name:`unlock`,component:()=>bt(()=>import(`./UnlockPage-BOtVWFNI.js`),__vite__mapDeps([10,2,3,11,12,1,13,14,15,16,0,4,5,17,8,6,7,9,18,19,20]))},{path:`/migrate-vault`,name:`migrate-vault`,component:()=>bt(()=>import(`./VaultMigrationPage-B-0XeVkC.js`),__vite__mapDeps([21,2,3,11,12,1,13,14,15,16,5,4,9,22]))},{path:`/launch/project`,name:`launch-project`,component:()=>bt(()=>import(`./LaunchProjectPage-_FRQApLZ.js`),__vite__mapDeps([23,2,3,12,1,11,8,0,4,5,13,14,15,16,7,9,24,25,26,27,28,29,30,31,32,33,34,35,18,19,36,37]))},{path:`/launch/services`,name:`launch-services`,component:()=>bt(()=>import(`./LaunchServicesPage-ClyWpgrZ.js`),__vite__mapDeps([38,2,3,12,1,11,8,0,4,5,13,14,15,16,39,7,9,40,41,42,43,44,45,31,32,35,18,19,36,46]))},{path:`/`,component:()=>bt(()=>import(`./AppLayout-B371VSKT.js`),__vite__mapDeps([47,2,3,11,12,1,8,0,4,5,13,48,49,14,15,16,39,7,9,25,24,26,27,28,50,51,52,53,54,55,56,42,43,40,17,6,41,57,58,44,59,60,61,62,63,64,65,66,67,29,30,33,31,32,34,68,69,45,70])),children:[{path:``,name:`dashboard`,component:()=>bt(()=>import(`./DashboardPage-BnmqlmJ6.js`),__vite__mapDeps([71,2,3,11,12,1,8,0,4,5,13,14,15,16,39,7,9,26,27,40,41,42,43,44,65,66,31,32,33,25,24,28,29,30,34,68,69,72])),meta:{titleKey:`dashboard.title`}},{path:`cloud`,name:`cloud-account`,component:()=>bt(()=>import(`./CloudAccountPage-Bk8QoNat.js`).then(e=>e.n),__vite__mapDeps([73,1,2,3,12,11,14,15,16,0,4,5,7,8,9,25,26,27,28,74,29,30,75]))},{path:`cloud/messaging`,name:`cloud-messaging`,component:()=>bt(()=>import(`./CloudMessagingPage-BYFfDa7H.js`),__vite__mapDeps([76,2,3,12,1,11,13,14,15,16,77,8,0,4,5,78,7,9,74,56,6,42,43,40,17,79,25,26,27,28,80,81,82,83,84,85,41,86,57,52,53,54,50,51,55,58,59,87])),meta:{titleKey:`cloudMessaging.title`}},{path:`agents`,name:`agents`,redirect:{path:`/settings`,query:{section:`agents`}}},{path:`knowledge`,name:`knowledge-list`,component:()=>bt(()=>import(`./KnowledgeListPage-CGLjHGEt.js`),__vite__mapDeps([88,2,3,12,1,11,14,15,16,89,13,49,77,8,0,4,5,78,7,9,74,56,6,42,43,40,17,79,51,52,53,54,26,27,28,80,81,82,83,84,85,41,86,90,91])),meta:{titleKey:`knowledge.title`}},{path:`knowledge/page/:pageId`,name:`knowledge-page`,component:()=>bt(()=>import(`./KnowledgePagePage-Dqu2hdSi.js`),__vite__mapDeps([92,2,3,12,1,11,13,14,15,16,89,49,77,8,0,4,5,78,7,9,74,56,6,42,43,40,17,79,51,52,53,54,26,27,28,80,81,82,83,84,85,41,86,90,93])),meta:{titleKey:`knowledge.title`}},{path:`kanban`,name:`kanban-list`,component:()=>bt(()=>import(`./KanbanListPage-CsTOrPbp.js`),__vite__mapDeps([94,2,3,11,12,1,13,14,15,16,7,8,0,4,5,9,25,28,50,51,52,53,54,55,60,95])),meta:{titleKey:`kanban.list.title`}},{path:`issues`,name:`issues-list`,component:()=>bt(()=>import(`./KanbanListPage-CsTOrPbp.js`),__vite__mapDeps([94,2,3,11,12,1,13,14,15,16,7,8,0,4,5,9,25,28,50,51,52,53,54,55,60,95])),props:{mode:`list`},meta:{titleKey:`kanban.issues.title`}},{path:`kanban/:id`,name:`kanban-board`,component:()=>bt(()=>Promise.resolve().then(()=>nl),void 0),props:!0,meta:{pageKey:`kanban-board`}},{path:`kanban/:id/card/:cardId`,name:`kanban-card`,component:()=>bt(()=>Promise.resolve().then(()=>nl),void 0),props:!0,meta:{pageKey:`kanban-board`}},{path:`issues/:id`,name:`issues-board`,component:()=>bt(()=>Promise.resolve().then(()=>nl),void 0),props:!0,meta:{pageKey:`kanban-board`}},{path:`issues/:id/card/:cardId`,name:`issues-card`,component:()=>bt(()=>Promise.resolve().then(()=>nl),void 0),props:!0,meta:{pageKey:`kanban-board`}},{path:`agent-terminal`,name:`agent-terminal`,component:()=>bt(()=>import(`./AgentTerminalPage-BJqwsAx7.js`),__vite__mapDeps([96,2,3,11,12,1,8,0,4,5,14,15,16,51,41,9,42,43,97,98]))},{path:`audit`,name:`audit`,component:()=>bt(()=>import(`./AuditPage-CDmWtBlr.js`),__vite__mapDeps([99,2,3,12,1,11,14,15,16,0,4,5,100]))},{path:`settings`,name:`settings`,component:()=>bt(()=>import(`./SettingsPage-BzvQ7QFy.js`).then(e=>e.t),__vite__mapDeps([101,1,2,3,11,12,8,0,4,5,78,13,14,15,16,77,7,9,74,56,6,42,43,40,17,79,26,27,28,50,51,52,53,54,55,80,81,82,83,84,85,41,86,57,58,61,62,29,30,73,25,75,102,103,104,105,106,107,108,109,110,111,112])),meta:{titleKey:`settingsPage.title`}},{path:`api-keys`,name:`api-keys`,redirect:{path:`/settings`,query:{section:`api-keys`}}},{path:`api-docs`,name:`api-docs`,redirect:{path:`/settings`,query:{section:`api-docs`}}},{path:`ai-chat`,name:`ai-chat`,component:()=>bt(()=>Promise.resolve().then(()=>yM),void 0)},{path:`scenario/new`,name:`scenario-new`,component:()=>bt(()=>import(`./ScenarioEditorPage-Dr-vIMo-.js`),__vite__mapDeps([113,2,3,11,12,1,8,0,4,5,13,14,15,16,77,78,7,9,74,56,6,42,43,40,17,79,51,97,114]))},{path:`scenario/:id/edit`,name:`scenario-edit`,component:()=>bt(()=>import(`./ScenarioEditorPage-Dr-vIMo-.js`),__vite__mapDeps([113,2,3,11,12,1,8,0,4,5,13,14,15,16,77,78,7,9,74,56,6,42,43,40,17,79,51,97,114])),props:!0},{path:`services/new`,name:`service-create`,component:()=>bt(()=>import(`./ServiceFormPage-CRPYTrvA.js`),__vite__mapDeps([115,2,3,11,12,1,8,0,4,5,13,14,15,16,7,9,40,41,42,43,116]))},{path:`services/:id/edit`,name:`service-edit`,component:()=>bt(()=>import(`./ServiceFormPage-CRPYTrvA.js`),__vite__mapDeps([115,2,3,11,12,1,8,0,4,5,13,14,15,16,7,9,40,41,42,43,116])),props:!0},{path:`services/:id/:tab?`,name:`service-detail`,component:()=>bt(()=>import(`./ServiceDetailPage-mvyj5ljn.js`),__vite__mapDeps([117,2,3,11,12,1,8,0,4,5,13,48,49,14,15,16,51,7,9,80,77,78,74,56,6,42,43,40,17,79,81,82,83,84,85,41,86,44,64,65,66,67,97,118,52,53,54,63,102,103,119,120,121,104,50,55,105,27,26,106,28,57,58,107,108,122,123,124]))},{path:`projects`,name:`projects`,redirect:{name:`dashboard`}},{path:`projects/:projectId`,name:`project-detail`,component:()=>bt(()=>import(`./DashboardPage-BnmqlmJ6.js`),__vite__mapDeps([71,2,3,11,12,1,8,0,4,5,13,14,15,16,39,7,9,26,27,40,41,42,43,44,65,66,31,32,33,25,24,28,29,30,34,68,69,72])),beforeEnter:async e=>{let{useProjectLaunchStore:t}=await bt(async()=>{let{useProjectLaunchStore:e}=await import(`./project-launch.store-CNT8Buo8.js`).then(e=>e.t);return{useProjectLaunchStore:e}},__vite__mapDeps([8,1,2,3,0,4,5])),{useProjectStore:n}=await bt(async()=>{let{useProjectStore:e}=await import(`./project.store-C8ckld_2.js`).then(e=>e.t);return{useProjectStore:e}},__vite__mapDeps([7,1,2,3,8,0,4,5,9])),r=t(),i=n(),{selectProjectById:a}=await bt(async()=>{let{selectProjectById:e}=await import(`./open-project-org-BNDadG2_.js`).then(e=>e.n);return{selectProjectById:e}},__vite__mapDeps([27,1]));return{name:await a(r,i,e.params.projectId)?`dashboard`:`launch-project`}}},{path:`projects/:projectId/environments`,name:`environments`,component:()=>bt(()=>import(`./EnvironmentListPage-BMpha28O.js`),__vite__mapDeps([125,2,3,11,12,1,8,0,4,5,13,14,15,16,7,9,60,126,41,42,43,118,51,52,53,54,40,63,97,102,103,119,127,128])),meta:{titleKey:`environmentList.title`}},{path:`projects/:projectId/environments/:id/edit`,name:`environment-edit`,component:()=>bt(()=>import(`./EnvironmentFormPage-BvS6f3_v.js`),__vite__mapDeps([129,2,3,12,1,11,13,14,15,16,7,8,0,4,5,9,126,41,42,43,118,51,52,53,54,40,63,97,102,103,119,127,130])),meta:{titleKey:`environmentFormPage.editTitle`,backTo:`environments`}},{path:`process/:agentId/:processId`,name:`process-detail`,component:()=>bt(()=>import(`./ProcessDetailPage-A-7cwr0N.js`),__vite__mapDeps([131,2,3,12,1,11,13,14,15,16,0,4,5,41,8,9,42,43,65,66,120,121,104,77,78,7,74,56,6,40,17,79,50,51,52,53,54,55,80,81,82,83,84,85,86,105,27,26,106,28,57,58,107,132])),props:!0},{path:`wiki`,name:`wiki-global`,component:()=>bt(()=>import(`./WikiPage-ZZ9OOPF3.js`),__vite__mapDeps([133,3,2,122,11,13,14,12,1,15,16,0,4,5,52,53,54,123]))},{path:`dev/random-job-test`,name:`dev-random-job-test`,component:()=>bt(()=>import(`./RandomJobTestPage-D96PVnUs.js`),__vite__mapDeps([134,2,3,14,11,12,1,15,16,0,4,5,135]))}]}]}),UM=new Set([`launch-project`,`launch-services`]),WM=!1,GM=!1,KM=!1;async function qM(){if(KM)return!1;KM=!0;let e=ye();try{let t=await J.process.list.query(),n=vn(t);if(n.size===0)return!1;let r=await J.project.list.query(),i=null,a=0;for(let e of r){let t=e.serviceIds.filter(e=>n.has(e)).length;t>a&&(a=t,i=e)}return i?(e.setActiveProject(i.id,i.orgId??null),e.completeLaunch(),!0):!1}catch(e){return console.error(`[router] Failed to detect running services:`,e),!1}}var JM=null;async function YM(e){if(JM!==null)return JM;try{let t=(await J.project.list.query()).find(t=>t.id===e);JM=t?{id:t.id,orgId:t.orgId??null}:!1,t||console.warn(`[router] Projet ${e} (--project) introuvable : liste des projets affichée.`)}catch(e){return console.error(`[router] Failed to resolve locked project:`,e),!1}return JM}async function XM(e){let t=mt();if(!t)return;let n=await YM(t);if(!n)return;let r=ye();if((r.activeProjectId!==n.id||r.activeOrgId!==n.orgId)&&(r.setActiveProject(n.id,n.orgId),r.launchCompleted=!1,e.name!==`launch-services`)||e.name===`launch-project`)return{name:`launch-services`,replace:!0};let i=e.params.projectId;if(typeof i==`string`&&i!==n.id)return{name:`dashboard`,replace:!0}}HM.beforeEach(async e=>{if(e.name===`unlock`)return;if(!WM){WM=!0;try{let t=await Ct();if(xt(t.ciMode===!0),t.state!==`unlocked`||!t.ciMode&&!wt())return{name:`unlock`,replace:!0};if(t.legacyVault&&e.name!==`migrate-vault`)return{name:`migrate-vault`,replace:!0}}catch{return{name:`unlock`,replace:!0}}}if(!wt())try{let e=await Ct();if(xt(e.ciMode===!0),e.state!==`unlocked`||!e.ciMode)return{name:`unlock`,replace:!0}}catch{return{name:`unlock`,replace:!0}}if(e.name===`migrate-vault`)return;await gt();let t=await XM(e);if(t)return t;if(UM.has(e.name))return;let n=ye();if(!n.launchCompleted&&!n.activeProjectId&&!await qM())return{name:`launch-project`};if(!GM&&n.activeProjectId){GM=!0;try{if(!(await J.project.list.query()).some(e=>e.id===n.activeProjectId&&(e.orgId??null)===n.activeOrgId))return n.resetLaunch(),{name:`launch-project`}}catch(e){return console.error(`[router] Failed to validate current project:`,e),n.resetLaunch(),{name:`launch-project`}}}});var ZM={class:`trigger-blob`},QM={class:`theme-layer`},$M={class:`theme-picker`},eN={class:`theme-section theme-section--row`},tN={class:`section-label`},nN={class:`theme-section theme-section--row`},rN={class:`section-label`},iN={class:`theme-section`},aN={class:`section-label`},oN={class:`swatches`},sN=[`title`,`aria-label`,`aria-pressed`,`onClick`],cN={class:`custom-hue-header`},lN={class:`section-label`},uN={class:`custom-hue-track-wrap`},dN=`#18181b`,fN=`#f8fafc`,pN=Ke(R({__name:`ThemePicker`,setup(e){let t=An.map(e=>({id:e,label:e[0].toUpperCase()+e.slice(1)}));function i(e){let t=Sn(e);return[t[700],t[500],t[300],t[100]]}function a(e){let t=Number.parseInt(e.slice(1,3),16)/255,n=Number.parseInt(e.slice(3,5),16)/255,r=Number.parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r);if(i===a)return 0;let o=i-a,s=0;return s=i===t?((n-r)/o+(n<r?6:0))/6:i===n?((r-t)/o+2)/6:((t-n)/o+4)/6,Math.round(s*360)}let o=localStorage.getItem(`runeya-theme-color`)??`emerald`,s=localStorage.getItem(`runeya-theme-custom`)??`#10b981`,c=localStorage.getItem(`runeya-dark-mode`)===`1`,l=localStorage.getItem(`runeya-theme-gradient`)===`1`,u=r(o),d=r(s),f=r(a(s)),p=r(c),m=r(l),{t:h}=ge(),g=L(()=>{if(u.value===`custom`)return d.value;let e=t.find(e=>e.id===u.value)??t[3];return xn[e.id][500]}),_=L(()=>i(g.value));function v(e){m.value=e,localStorage.setItem(`runeya-theme-gradient`,e?`1`:`0`),On(e)}function x(e){u.value=e,localStorage.setItem(`runeya-theme-color`,e),Cn(e,p.value,d.value)}function C(e){p.value=e,localStorage.setItem(`runeya-dark-mode`,e?`1`:`0`),Cn(u.value,e,d.value)}function w(e){let t=e?.[0];t!==void 0&&(f.value=t,d.value=Dn(t),localStorage.setItem(`runeya-theme-custom`,d.value),u.value=Tn,localStorage.setItem(`runeya-theme-color`,Tn),Cn(Tn,p.value,d.value))}return S(d,e=>{/^#[0-9a-f]{6}$/i.test(e)&&(f.value=a(e))}),(e,r)=>(z(),W(n(Xe),null,{default:H(()=>[y(n(Fn),{class:`theme-trigger`,title:n(h)(`themePicker.title`),"aria-label":n(h)(`themePicker.title`)},{default:H(()=>[A(`span`,ZM,[(z(!0),j(V,null,M(_.value,(e,t)=>(z(),j(`span`,{key:t,class:`rad`,style:B({backgroundColor:e})},null,4))),128))])]),_:1},8,[`title`,`aria-label`]),(z(),W(ce,{to:`body`},[A(`div`,QM,[y(n(rt),{class:`theme-popover`,side:`bottom`,align:`end`,"side-offset":6,"collision-padding":8},{default:H(()=>[A(`div`,$M,[A(`div`,eN,[A(`span`,tN,U(n(h)(`themePicker.gradient`)),1),y(n(Ge),{class:`gradient-toggle`,"model-value":m.value,"aria-label":m.value?n(h)(`themePicker.disableGradient`):n(h)(`themePicker.enableGradient`),"onUpdate:modelValue":v},{default:H(()=>[y(n(De),{class:`gradient-toggle__thumb`})]),_:1},8,[`model-value`,`aria-label`])]),r[3]||=A(`div`,{class:`theme-divider`},null,-1),A(`div`,nN,[A(`span`,rN,U(n(h)(`themePicker.mode`)),1),y(n(Ie),{type:`single`,class:`mode-toggle`,"model-value":p.value?`dark`:`light`,"aria-label":n(h)(`themePicker.mode`),"onUpdate:modelValue":r[0]||=e=>e&&C(e===`dark`)},{default:H(()=>[y(n(Be),{value:`dark`,class:`mode-btn`},{default:H(()=>[r[1]||=A(`i`,{class:`ti ti-moon`,"aria-hidden":`true`},null,-1),b(` `+U(n(h)(`themePicker.dark`)),1)]),_:1}),y(n(Be),{value:`light`,class:`mode-btn`},{default:H(()=>[r[2]||=A(`i`,{class:`ti ti-sun`,"aria-hidden":`true`},null,-1),b(` `+U(n(h)(`themePicker.light`)),1)]),_:1})]),_:1},8,[`model-value`,`aria-label`])]),r[4]||=A(`div`,{class:`theme-divider`},null,-1),A(`div`,iN,[A(`span`,aN,U(n(h)(`themePicker.accentColor`)),1),A(`div`,oN,[(z(!0),j(V,null,M(n(t),e=>(z(),j(`button`,{key:e.id,type:`button`,class:P([`swatch`,{active:u.value===e.id}]),title:e.label,"aria-label":e.label,"aria-pressed":u.value===e.id,style:B({"--swatch-bg":p.value?dN:fN}),onClick:t=>x(e.id)},[A(`span`,{class:`viewwindow`,style:B({backgroundColor:p.value?dN:fN})},[(z(!0),j(V,null,M(i(n(xn)[e.id][500]),(e,t)=>(z(),j(`span`,{key:t,class:`rad`,style:B({backgroundColor:e})},null,4))),128))],4)],14,sN))),128))])]),A(`div`,{class:P([`theme-section custom-hue-section`,{"custom-hue-section--active":u.value===n(Tn)}])},[A(`div`,cN,[A(`span`,lN,U(n(h)(`themePicker.customColor`)),1),A(`span`,{class:`custom-hue-preview`,style:B({backgroundColor:d.value})},null,4)]),A(`div`,uN,[y(n(Qe),{class:`custom-hue-slider`,"model-value":[f.value],min:0,max:359,"aria-label":n(h)(`themePicker.customColor`),"onUpdate:modelValue":w},{default:H(()=>[y(n(qe),{class:`custom-hue-slider__track`}),y(n(He),{class:`custom-hue-slider__thumb`})]),_:1},8,[`model-value`,`aria-label`])])],2)])]),_:1})])]))]),_:1}))}}),[[`__scopeId`,`data-v-53186dc2`]]),mN=[`width`,`height`],hN=[`rx`],gN=[`transform`],_N=[`d`,`stroke-width`],vN=[`cx`,`cy`,`r`],yN=Ke(R({__name:`RuneyaLogo`,props:{size:{default:28}},setup(e){return(t,r)=>(z(),j(`svg`,{class:`runeya-logo`,viewBox:`0 0 100 100`,width:e.size,height:e.size,"aria-hidden":`true`},[A(`rect`,{class:`runeya-logo__bg`,width:`100`,height:`100`,rx:n(bn).radius},null,8,hN),A(`g`,{transform:`translate(50 50) scale(${n(wn)}) translate(-50 -50)`},[A(`path`,{class:`runeya-logo__stroke`,d:n(jn).path,fill:`none`,"stroke-width":n(jn).stroke,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,8,_N),(z(!0),j(V,null,M(n(jn).dots,([e,t],r)=>(z(),j(`circle`,{key:r,class:`runeya-logo__fill`,cx:e,cy:t,r:n(jn).dotRadius},null,8,vN))),128))],8,gN)],8,mN))}}),[[`__scopeId`,`data-v-85f26936`]]),bN=e({announceThemeToServer:()=>xN});async function xN(){try{await J.desktop.setTrayAccent.mutate({color:kn()})}catch{}}globalThis.Buffer=Pn.Buffer;async function SN(){try{let e=await J.config.cloud.query();kt(e)}catch(e){console.warn(`[cloud] Failed to fetch cloud config, using defaults:`,e)}}async function CN(){try{ht(await J.config.app.query())}catch(e){console.warn(`[app] Failed to fetch app mode:`,e)}finally{pt()}}var wN=pe(BM);wN.use(be()),wN.use(HM),wN.use(xe),En(()=>{xN()}),yn(),_t(()=>{xN()}),wN.directive(`tooltip`,nt),Pe(e=>{try{let t=mn(),n={info:`info`,warn:`warn`,error:`error`,success:`success`,secondary:`info`}[e.severity??`info`]??`info`;t.add({type:n,title:String(e.summary??``),message:String(e.detail??``),category:`service_status_changed`})}catch{}}),wN.config.errorHandler=(e,t,n)=>{console.error(`[Vue Error]`,e,n);let r=e instanceof Error?e.message:`An unexpected error occurred`;Fe().add({severity:`error`,summary:`Unexpected Error`,detail:r,life:5e3})};async function TN(){if(wt()){Tt(),yt();return}try{let e=await Ct();xt(e.ciMode===!0),e.state===`unlocked`&&e.ciMode&&yt()}catch{}}Promise.all([SN(),CN(),TN()]).finally(()=>{wN.mount(`#app`)});export{mk as A,ei as B,iE as C,WE as D,VE as E,fc as F,pr as G,Nr as H,sc as I,qn as K,ic as L,Ay as M,vl as N,HE as O,yl as P,ea as R,Jk as S,Gk as T,Sr as U,Pr as V,yr as W,ZA as _,AM as a,qA as b,DM as c,Vj as d,Pj as f,wj as g,Sj as h,VM as i,QE as j,DD as k,Gj as l,xj as m,yN as n,OM as o,Cj as p,pN as r,xM as s,bN as t,Bj as u,YA as v,Kk as w,rA as x,JA as y,ni as z};