@agent-spaces/server 0.3.4 → 0.3.5

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 (288) hide show
  1. package/dist/adapters/claude-code-runtime/index.js +19 -1
  2. package/dist/adapters/codex-runtime.js +13 -3
  3. package/dist/agents/agent-message-parts.js +9 -1
  4. package/dist/agents/commit-agent.js +7 -15
  5. package/dist/app.js +26 -0
  6. package/dist/package.json +2 -0
  7. package/dist/routes/code-favorites.js +60 -0
  8. package/dist/routes/file.js +13 -0
  9. package/dist/routes/prompt-template.js +48 -0
  10. package/dist/services/agent.js +45 -3
  11. package/dist/services/code-favorites.js +23 -0
  12. package/dist/services/file.js +4 -0
  13. package/dist/services/persistent-agent-context.js +3 -2
  14. package/dist/services/prompt-template.js +93 -0
  15. package/dist/services/pty.js +18 -1
  16. package/dist/storage/code-favorites-store.js +15 -0
  17. package/dist/web/404.html +1 -1
  18. package/dist/web/__next.__PAGE__.txt +4 -4
  19. package/dist/web/__next._full.txt +21 -21
  20. package/dist/web/__next._head.txt +4 -4
  21. package/dist/web/__next._index.txt +13 -13
  22. package/dist/web/__next._tree.txt +2 -2
  23. package/dist/web/_next/static/chunks/0-1pn22sg~67u.js +2 -0
  24. package/dist/web/_next/static/chunks/0-lseun2l1m_t.js +2 -0
  25. package/dist/web/_next/static/chunks/0-wkj-hzh444r.css +4 -0
  26. package/dist/web/_next/static/chunks/{0f6vrjsdauiwl.js → 0-~4vw4_9z_0_.js} +2 -2
  27. package/dist/web/_next/static/chunks/0..g0jl-8qup7.js +1 -0
  28. package/dist/web/_next/static/chunks/0.006.ycpe92w.js +496 -0
  29. package/dist/web/_next/static/chunks/0.6x8f.mb-1qf.js +1 -0
  30. package/dist/web/_next/static/chunks/{0qe5wvs8fe9ip.js → 004wt62de8617.js} +1 -1
  31. package/dist/web/_next/static/chunks/016xz2o-hv3am.js +1 -0
  32. package/dist/web/_next/static/chunks/01gi~q0c6ez6..js +1 -0
  33. package/dist/web/_next/static/chunks/023lpc7n70tav.css +1 -0
  34. package/dist/web/_next/static/chunks/03me5_ir..2ix.js +1 -0
  35. package/dist/web/_next/static/chunks/04fk~8rnrvs44.js +1 -0
  36. package/dist/web/_next/static/chunks/05eu2fdixf7c9.js +1 -0
  37. package/dist/web/_next/static/chunks/05gt_g_vbzh-5.css +1 -0
  38. package/dist/web/_next/static/chunks/06vadtvw631k5.css +1 -0
  39. package/dist/web/_next/static/chunks/07ge_85i__6pb.js +1 -0
  40. package/dist/web/_next/static/chunks/07ne4g8zopykv.js +1 -0
  41. package/dist/web/_next/static/chunks/07xvadmf~8bow.js +1 -0
  42. package/dist/web/_next/static/chunks/08.u~dmq20cak.css +23 -0
  43. package/dist/web/_next/static/chunks/08ag2f8y6f8cr.js +1 -0
  44. package/dist/web/_next/static/chunks/{03sd~wmqw.9gc.js → 08kpa0nox.bb1.js} +2 -2
  45. package/dist/web/_next/static/chunks/08o-zmr-40r5g.js +1 -0
  46. package/dist/web/_next/static/chunks/0_-c.y2qq4ax4.js +270 -0
  47. package/dist/web/_next/static/chunks/0a1rewz7xr-xi.js +1 -0
  48. package/dist/web/_next/static/chunks/0amcocbojo4v2.js +1 -0
  49. package/dist/web/_next/static/chunks/0brrgp3ki5w4_.css +17 -0
  50. package/dist/web/_next/static/chunks/0bzmgi.ynrn.0.css +3 -0
  51. package/dist/web/_next/static/chunks/0c_vfzf1z7-rt.js +2 -0
  52. package/dist/web/_next/static/chunks/0cjmfclopcxho.css +1 -0
  53. package/dist/web/_next/static/chunks/0cs830n97dgjy.js +1 -0
  54. package/dist/web/_next/static/chunks/0d_dp_4ofz0l3.css +3 -0
  55. package/dist/web/_next/static/chunks/0dws-faof-ryx.css +13 -0
  56. package/dist/web/_next/static/chunks/0ejc_zlyocy_r.css +1 -0
  57. package/dist/web/_next/static/chunks/0esty_4gmxfq3.js +1 -0
  58. package/dist/web/_next/static/chunks/0evjw7bao5_e~.js +1 -0
  59. package/dist/web/_next/static/chunks/{0ag4p6m9rze~n.js → 0g-0n6glz_z6w.js} +1 -1
  60. package/dist/web/_next/static/chunks/{145qu5b0tgm9w.js → 0gig.k.rq8d0x.js} +1 -1
  61. package/dist/web/_next/static/chunks/0hl_7y464qll6.css +2 -0
  62. package/dist/web/_next/static/chunks/0hrbuvzuxrjfl.js +1 -0
  63. package/dist/web/_next/static/chunks/0i_3.3rdsu2mw.js +2 -0
  64. package/dist/web/_next/static/chunks/0i_gi.kq2dau8.css +1 -0
  65. package/dist/web/_next/static/chunks/0j00r2f_n-.lx.js +1 -0
  66. package/dist/web/_next/static/chunks/0jh9xnkimjkyh.js +1 -0
  67. package/dist/web/_next/static/chunks/0jokpgh485~28.js +167 -0
  68. package/dist/web/_next/static/chunks/0kvsjgpj7zcb9.css +9 -0
  69. package/dist/web/_next/static/chunks/0l5ab99s37x5f.js +1 -0
  70. package/dist/web/_next/static/chunks/0lcc9r.o.p.sc.js +1 -0
  71. package/dist/web/_next/static/chunks/0lh~x2tf~i1hd.css +2 -0
  72. package/dist/web/_next/static/chunks/0me8ho8j4tq7_.css +2 -0
  73. package/dist/web/_next/static/chunks/0mny8i81aenx3.js +1 -0
  74. package/dist/web/_next/static/chunks/0mt-7av8yrg0o.css +3 -0
  75. package/dist/web/_next/static/chunks/0njy89g5coeyi.js +60 -0
  76. package/dist/web/_next/static/chunks/0nsu~f3voe~0i.js +5 -0
  77. package/dist/web/_next/static/chunks/0ow~co9wcleka.js +173 -0
  78. package/dist/web/_next/static/chunks/0pldvk5_h__t7.css +3 -0
  79. package/dist/web/_next/static/chunks/0qad.lgvtlt0b.css +16 -0
  80. package/dist/web/_next/static/chunks/0qpq0~_58fe9a.js +18 -0
  81. package/dist/web/_next/static/chunks/{0.335m_d-cd_g.js → 0qtc_rbo1oghu.js} +1 -1
  82. package/dist/web/_next/static/chunks/0qz5~3wquy~3q.css +2 -0
  83. package/dist/web/_next/static/chunks/0rv0nj__24y60.js +10 -0
  84. package/dist/web/_next/static/chunks/{145gbwitjxamg.js → 0sz8_nijfiz0p.js} +1 -1
  85. package/dist/web/_next/static/chunks/0tvd~rxgf0oh_.js +1 -0
  86. package/dist/web/_next/static/chunks/0wv0h27jafag4.js +1 -0
  87. package/dist/web/_next/static/chunks/0wwvc4zc2q6bn.js +1 -0
  88. package/dist/web/_next/static/chunks/0x4b-a2ixww6m.js +1 -0
  89. package/dist/web/_next/static/chunks/0z8ipjj2z-3al.css +8 -0
  90. package/dist/web/_next/static/chunks/0zd1o3u04~qvo.js +127 -0
  91. package/dist/web/_next/static/chunks/0~2l1-8o4delc.js +1 -0
  92. package/dist/web/_next/static/chunks/0~w6ugk9s5p-h.css +1 -0
  93. package/dist/web/_next/static/chunks/10jfi.9fw5g48.js +1 -0
  94. package/dist/web/_next/static/chunks/11_tltlhc8.sj.js +1 -0
  95. package/dist/web/_next/static/chunks/125nunjfj2fj0.js +1 -0
  96. package/dist/web/_next/static/chunks/12md9ajfx2o85.css +1 -0
  97. package/dist/web/_next/static/chunks/12odetnu-lyrr.js +167 -0
  98. package/dist/web/_next/static/chunks/12u4g4uzrlten.js +2 -0
  99. package/dist/web/_next/static/chunks/134ozsnbd~0qw.js +1 -0
  100. package/dist/web/_next/static/chunks/13ess~4pdmxma.js +1 -0
  101. package/dist/web/_next/static/chunks/13xfagjq0q~tf.js +1 -0
  102. package/dist/web/_next/static/chunks/143.pbs8a1ivm.js +1 -0
  103. package/dist/web/_next/static/chunks/14_y_s_5rhsd1.css +5 -0
  104. package/dist/web/_next/static/chunks/15hca2.5le07..js +3 -0
  105. package/dist/web/_next/static/chunks/15rf3~h7sugz4.css +19 -0
  106. package/dist/web/_next/static/chunks/16i87txo0qh0h.css +6 -0
  107. package/dist/web/_next/static/chunks/16~udgv7eel6a.css +2 -0
  108. package/dist/web/_next/static/chunks/{turbopack-0-j2hpomozegf.js → turbopack-000x5q9w-wx10.js} +1 -1
  109. package/dist/web/_next/static/chunks/{turbopack-0rrhp9pbrv0p3.js → turbopack-0hrx111grzq49.js} +1 -1
  110. package/dist/web/_next/static/chunks/{turbopack-0_zn00zg5kmqz.js → turbopack-0w-kua.9ymd0x.js} +1 -1
  111. package/dist/web/_next/static/chunks/{turbopack-0l~pq1hytx49z.js → turbopack-15zqm_4ixj.18.js} +1 -1
  112. package/dist/web/_next/static/media/code-icon.0g3wskzlr7oxf.svg +1 -0
  113. package/dist/web/_next/static/media/codicon.0pqe-t5rtghj8.ttf +0 -0
  114. package/dist/web/_next/static/media/continue-tb.0qei4mru4tzd2.png +0 -0
  115. package/dist/web/_next/static/media/dark_modern.09.uq6bp373zs.json +1 -0
  116. package/dist/web/_next/static/media/dark_plus.187umr0~d1_r7.json +1 -0
  117. package/dist/web/_next/static/media/dark_vs.12ju8ocr7rg--.json +1 -0
  118. package/dist/web/_next/static/media/document-dark.0vvlbsi_fdy~4.svg +3 -0
  119. package/dist/web/_next/static/media/document-light.0bfi_yt9e~vk7.svg +3 -0
  120. package/dist/web/_next/static/media/editor.worker.0ffjdaaj15t6e.js +1 -0
  121. package/dist/web/_next/static/media/extensionHost.worker.14sz5xf8-1efr.js +2 -0
  122. package/dist/web/_next/static/media/fake.16yx0-xxqj4pc.html +10 -0
  123. package/dist/web/_next/static/media/folder-dark.02kdicw3013tb.svg +3 -0
  124. package/dist/web/_next/static/media/folder-light.0s165k4fp3.53.svg +3 -0
  125. package/dist/web/_next/static/media/folder-open-dark.0sk6.yh45uqs3.svg +4 -0
  126. package/dist/web/_next/static/media/folder-open-light.10k1v_ugaq8ic.svg +4 -0
  127. package/dist/web/_next/static/media/hc_black.0-ul9e2oc5twb.json +1 -0
  128. package/dist/web/_next/static/media/hc_light.0vi.a7fr.z4gy.json +1 -0
  129. package/dist/web/_next/static/media/index.0jmafs_mwcjgg.html +1341 -0
  130. package/dist/web/_next/static/media/keyboard-dark.0t86n~1rrhj2-.svg +10 -0
  131. package/dist/web/_next/static/media/keyboard-light.0abw0ukjcd9ox.svg +10 -0
  132. package/dist/web/_next/static/media/letterpress-dark.181s2xkw~lfyo.svg +3 -0
  133. package/dist/web/_next/static/media/letterpress-hcDark.0ftfw8fess-5y.svg +3 -0
  134. package/dist/web/_next/static/media/letterpress-hcLight.06x23d0.aixf_.svg +3 -0
  135. package/dist/web/_next/static/media/letterpress-light.0xb1bapis~iw7.svg +3 -0
  136. package/dist/web/_next/static/media/light_modern.00ps-apoc9ph7.json +1 -0
  137. package/dist/web/_next/static/media/light_plus.0ow37ouyuazdz.json +1 -0
  138. package/dist/web/_next/static/media/light_vs.0fdbve5sxkgq1.json +1 -0
  139. package/dist/web/_next/static/media/onig.0dk~55st~1x8..wasm +0 -0
  140. package/dist/web/_next/static/media/opacity-background.0-9.t0ta0ko23.png +0 -0
  141. package/dist/web/_next/static/media/package.0_p8a~hpmb_uj.json +1 -0
  142. package/dist/web/_next/static/media/package.nls.0e5hn-g497b64.json +1 -0
  143. package/dist/web/_next/static/media/pause-tb.0ttrm1r1uuz_c.png +0 -0
  144. package/dist/web/_next/static/media/restart-tb.086872s_sc2qv.png +0 -0
  145. package/dist/web/_next/static/media/root-folder-dark.14iwnfb7p2na~.svg +5 -0
  146. package/dist/web/_next/static/media/root-folder-light.0ljk9fi7sw3.2.svg +5 -0
  147. package/dist/web/_next/static/media/root-folder-open-dark.08vw3g9zvki33.svg +5 -0
  148. package/dist/web/_next/static/media/root-folder-open-light.0f46.ahns5c~..svg +5 -0
  149. package/dist/web/_next/static/media/run-with-debugging-tb.0j1h52k~h~72z.png +0 -0
  150. package/dist/web/_next/static/media/service-worker.0_udu6mraxn4k.js +543 -0
  151. package/dist/web/_next/static/media/stepinto-tb.0cl87yt4ub_j8.png +0 -0
  152. package/dist/web/_next/static/media/stepout-tb.0vjib_bn-_xax.png +0 -0
  153. package/dist/web/_next/static/media/stepover-tb.04beeu~7cxr4l.png +0 -0
  154. package/dist/web/_next/static/media/stop-tb.1498tmu97_y9j.png +0 -0
  155. package/dist/web/_next/static/media/vs_minimal-icon-theme.0-qs73lvw4voi.json +1 -0
  156. package/dist/web/_next/static/media/webWorkerExtensionHostIframe.0x2r1o97s.m0m.html +156 -0
  157. package/dist/web/_next/static/media/worker.081j0x4avp1l1.js +2 -0
  158. package/dist/web/_not-found/__next._full.txt +19 -19
  159. package/dist/web/_not-found/__next._head.txt +4 -4
  160. package/dist/web/_not-found/__next._index.txt +13 -13
  161. package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
  162. package/dist/web/_not-found/__next._not-found.txt +3 -3
  163. package/dist/web/_not-found/__next._tree.txt +2 -2
  164. package/dist/web/_not-found.html +1 -1
  165. package/dist/web/_not-found.txt +19 -19
  166. package/dist/web/index.html +1 -1
  167. package/dist/web/index.txt +21 -21
  168. package/dist/web/login/__next._full.txt +21 -21
  169. package/dist/web/login/__next._head.txt +4 -4
  170. package/dist/web/login/__next._index.txt +13 -13
  171. package/dist/web/login/__next._tree.txt +2 -2
  172. package/dist/web/login/__next.login.__PAGE__.txt +4 -4
  173. package/dist/web/login/__next.login.txt +3 -3
  174. package/dist/web/login.html +1 -1
  175. package/dist/web/login.txt +21 -21
  176. package/dist/web/settings/__next._full.txt +23 -23
  177. package/dist/web/settings/__next._head.txt +4 -4
  178. package/dist/web/settings/__next._index.txt +13 -13
  179. package/dist/web/settings/__next._tree.txt +2 -2
  180. package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
  181. package/dist/web/settings/__next.settings.txt +5 -5
  182. package/dist/web/settings/agents/__next._full.txt +23 -23
  183. package/dist/web/settings/agents/__next._head.txt +4 -4
  184. package/dist/web/settings/agents/__next._index.txt +13 -13
  185. package/dist/web/settings/agents/__next._tree.txt +2 -2
  186. package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
  187. package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
  188. package/dist/web/settings/agents/__next.settings.txt +5 -5
  189. package/dist/web/settings/agents.html +1 -1
  190. package/dist/web/settings/agents.txt +23 -23
  191. package/dist/web/settings/mcps/__next._full.txt +23 -23
  192. package/dist/web/settings/mcps/__next._head.txt +4 -4
  193. package/dist/web/settings/mcps/__next._index.txt +13 -13
  194. package/dist/web/settings/mcps/__next._tree.txt +2 -2
  195. package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
  196. package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
  197. package/dist/web/settings/mcps/__next.settings.txt +5 -5
  198. package/dist/web/settings/mcps.html +1 -1
  199. package/dist/web/settings/mcps.txt +23 -23
  200. package/dist/web/settings/models/__next._full.txt +23 -23
  201. package/dist/web/settings/models/__next._head.txt +4 -4
  202. package/dist/web/settings/models/__next._index.txt +13 -13
  203. package/dist/web/settings/models/__next._tree.txt +2 -2
  204. package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
  205. package/dist/web/settings/models/__next.settings.models.txt +3 -3
  206. package/dist/web/settings/models/__next.settings.txt +5 -5
  207. package/dist/web/settings/models.html +1 -1
  208. package/dist/web/settings/models.txt +23 -23
  209. package/dist/web/settings/prompts/__next._full.txt +42 -0
  210. package/dist/web/settings/prompts/__next._head.txt +6 -0
  211. package/dist/web/settings/prompts/__next._index.txt +15 -0
  212. package/dist/web/settings/prompts/__next._tree.txt +8 -0
  213. package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +9 -0
  214. package/dist/web/settings/prompts/__next.settings.prompts.txt +5 -0
  215. package/dist/web/settings/prompts/__next.settings.txt +7 -0
  216. package/dist/web/settings/prompts.html +1 -0
  217. package/dist/web/settings/prompts.txt +42 -0
  218. package/dist/web/settings/providers/__next._full.txt +23 -23
  219. package/dist/web/settings/providers/__next._head.txt +4 -4
  220. package/dist/web/settings/providers/__next._index.txt +13 -13
  221. package/dist/web/settings/providers/__next._tree.txt +2 -2
  222. package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
  223. package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
  224. package/dist/web/settings/providers/__next.settings.txt +5 -5
  225. package/dist/web/settings/providers.html +1 -1
  226. package/dist/web/settings/providers.txt +23 -23
  227. package/dist/web/settings/skills/__next._full.txt +23 -23
  228. package/dist/web/settings/skills/__next._head.txt +4 -4
  229. package/dist/web/settings/skills/__next._index.txt +13 -13
  230. package/dist/web/settings/skills/__next._tree.txt +2 -2
  231. package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
  232. package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
  233. package/dist/web/settings/skills/__next.settings.txt +5 -5
  234. package/dist/web/settings/skills.html +1 -1
  235. package/dist/web/settings/skills.txt +23 -23
  236. package/dist/web/settings.html +1 -1
  237. package/dist/web/settings.txt +23 -23
  238. package/dist/web/workflows/__next._full.txt +21 -21
  239. package/dist/web/workflows/__next._head.txt +4 -4
  240. package/dist/web/workflows/__next._index.txt +13 -13
  241. package/dist/web/workflows/__next._tree.txt +2 -2
  242. package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
  243. package/dist/web/workflows/__next.workflows.txt +3 -3
  244. package/dist/web/workflows.html +1 -1
  245. package/dist/web/workflows.txt +21 -21
  246. package/dist/web/workspace/_/__next._full.txt +68 -35
  247. package/dist/web/workspace/_/__next._head.txt +4 -4
  248. package/dist/web/workspace/_/__next._index.txt +13 -13
  249. package/dist/web/workspace/_/__next._tree.txt +15 -3
  250. package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +16 -4
  251. package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
  252. package/dist/web/workspace/_/__next.workspace.txt +3 -3
  253. package/dist/web/workspace/_.html +1 -1
  254. package/dist/web/workspace/_.txt +68 -35
  255. package/dist/web/workspaces/__next._full.txt +21 -21
  256. package/dist/web/workspaces/__next._head.txt +4 -4
  257. package/dist/web/workspaces/__next._index.txt +13 -13
  258. package/dist/web/workspaces/__next._tree.txt +2 -2
  259. package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
  260. package/dist/web/workspaces/__next.workspaces.txt +3 -3
  261. package/dist/web/workspaces.html +1 -1
  262. package/dist/web/workspaces.txt +21 -21
  263. package/dist/ws/agent-runner.js +158 -20
  264. package/dist/ws/handler.js +6 -1
  265. package/dist/ws/message-parts.js +20 -1
  266. package/dist/ws/terminal-handler.js +12 -7
  267. package/dist/ws/typescript-lsp.js +78 -0
  268. package/package.json +3 -1
  269. package/dist/web/_next/static/chunks/0-a17~4piefz_.js +0 -1
  270. package/dist/web/_next/static/chunks/01tyftu_-l7tm.css +0 -1
  271. package/dist/web/_next/static/chunks/028b9_5cyq-_m.js +0 -1
  272. package/dist/web/_next/static/chunks/0anuxr11yn5iv.js +0 -2
  273. package/dist/web/_next/static/chunks/0e.z4v3cd78dx.js +0 -1
  274. package/dist/web/_next/static/chunks/0egot8y~i-ge3.js +0 -1
  275. package/dist/web/_next/static/chunks/0eq7wt-l.fetc.js +0 -1
  276. package/dist/web/_next/static/chunks/0gtbd3yt7y1gx.js +0 -1
  277. package/dist/web/_next/static/chunks/0j2w71psq6w9u.js +0 -1
  278. package/dist/web/_next/static/chunks/0kyv5yika-41a.js +0 -1
  279. package/dist/web/_next/static/chunks/0ms3tsu4men_j.js +0 -204
  280. package/dist/web/_next/static/chunks/0plreh4_gkxf9.js +0 -1
  281. package/dist/web/_next/static/chunks/0qxk21zejhdbm.js +0 -1
  282. package/dist/web/_next/static/chunks/12gvpt~z9mn8w.js +0 -1
  283. package/dist/web/_next/static/chunks/14iaqoj9-09g..js +0 -2
  284. package/dist/web/_next/static/chunks/15dyaigebtnwg.js +0 -5
  285. package/dist/web/_next/static/chunks/17oc2l.ekcs8b.css +0 -1
  286. /package/dist/web/_next/static/{O5-QCW1u2YNyAUyaoYh6s → Pf6ZjtN82szw-ZzU9lITd}/_buildManifest.js +0 -0
  287. /package/dist/web/_next/static/{O5-QCW1u2YNyAUyaoYh6s → Pf6ZjtN82szw-ZzU9lITd}/_clientMiddlewareManifest.js +0 -0
  288. /package/dist/web/_next/static/{O5-QCW1u2YNyAUyaoYh6s → Pf6ZjtN82szw-ZzU9lITd}/_ssgManifest.js +0 -0
@@ -0,0 +1,167 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,190379,e=>{"use strict";var t=e.i(654295),i=e.i(388064),o=e.i(428521),r=e.i(354244),s=e.i(850887),n=e.i(322193);e.i(575129);var a=e.i(698014);e.i(140331),e.i(471999),e.i(900329),e.i(785266),e.i(181268),e.i(70177),e.i(575210),e.i(890787),e.i(67920);var d=e.i(865562);(0,t.registerCss)(void 0),(0,i.registerThemingParticipant)((e,t)=>{let i=(0,o.WORKBENCH_BACKGROUND)(e);t.addRule(`.monaco-workbench-part { background-color: ${i}; }`);let l=e.getColor(a.selectionBackground);if(l&&t.addRule(`.monaco-workbench-part ::selection { background-color: ${l}; }`),r.isWeb){let t=e.getColor(o.TITLE_BAR_ACTIVE_BACKGROUND);if(t){let e="monaco-workbench-meta-theme-color",i=d.mainWindow.document.getElementById(e);i||((i=(0,s.createMetaElement)()).name="theme-color",i.id=e),i.content=t.toString()}}n.isSafari&&t.addRule(`
2
+ .monaco-workbench-part.web {
3
+ touch-action: none;
4
+ }
5
+ .monaco-workbench-part .monaco-editor .view-lines {
6
+ user-select: text;
7
+ -webkit-user-select: text;
8
+ }
9
+ `),r.isIOS&&(0,n.isStandalone)()&&t.addRule(`.monaco-workbench-part { background-color: ${i}; }`)}),e.s([])},523183,938676,e=>{"use strict";var t,i,o,r,s=e.i(654295),n=e.i(430807),a=e.i(454514),d=e.i(611130),l=e.i(850887),c=e.i(976098),h=e.i(144881),u=e.i(781808),p=e.i(57660),g=e.i(535567);(0,s.registerCss)(void 0);let m={separatorBorder:h.Color.transparent};function v(e){return e===n.Orientation.VERTICAL?n.Orientation.HORIZONTAL:n.Orientation.VERTICAL}class y{constructor(e){this.isLayoutEnabled=e}}function C(e,t){if(Math.abs(e)>t)throw Error("Invalid index");return(0,p.rot)(e,t+1)}class b{get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}get absoluteOffset(){return this._absoluteOffset}get absoluteOrthogonalOffset(){return this._absoluteOrthogonalOffset}get styles(){return this._styles}get width(){return this.orientation===n.Orientation.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===n.Orientation.HORIZONTAL?this.orthogonalSize:this.size}get top(){return this.orientation===n.Orientation.HORIZONTAL?this._absoluteOffset:this._absoluteOrthogonalOffset}get left(){return this.orientation===n.Orientation.HORIZONTAL?this._absoluteOrthogonalOffset:this._absoluteOffset}get minimumSize(){return 0===this.children.length?0:Math.max(...this.children.map((e,t)=>this.splitview.isViewVisible(t)?e.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((e,t)=>this.splitview.isViewVisible(t)?e.maximumOrthogonalSize:1/0))}get priority(){if(0===this.children.length)return c.LayoutPriority.Normal;let e=this.children.map(e=>void 0===e.priority?c.LayoutPriority.Normal:e.priority);return e.some(e=>e===c.LayoutPriority.High)?c.LayoutPriority.High:e.some(e=>e===c.LayoutPriority.Low)?c.LayoutPriority.Low:c.LayoutPriority.Normal}get proportionalLayout(){return 0===this.children.length||this.children.every(e=>e.proportionalLayout)}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get minimumWidth(){return this.orientation===n.Orientation.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===n.Orientation.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===n.Orientation.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===n.Orientation.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get boundarySashes(){return this._boundarySashes}set boundarySashes(e){if(this._boundarySashes.start!==e.start||this._boundarySashes.end!==e.end||this._boundarySashes.orthogonalStart!==e.orthogonalStart||this._boundarySashes.orthogonalEnd!==e.orthogonalEnd){this._boundarySashes=e,this.splitview.orthogonalStartSash=e.orthogonalStart,this.splitview.orthogonalEndSash=e.orthogonalEnd;for(let t=0;t<this.children.length;t++){let i=this.children[t],o=0===t,r=t===this.children.length-1;i.boundarySashes={start:e.orthogonalStart,end:e.orthogonalEnd,orthogonalStart:o?e.start:i.boundarySashes.orthogonalStart,orthogonalEnd:r?e.end:i.boundarySashes.orthogonalEnd}}}}get edgeSnapping(){return this._edgeSnapping}set edgeSnapping(e){if(this._edgeSnapping!==e){for(let t of(this._edgeSnapping=e,this.children))t instanceof b&&(t.edgeSnapping=e);this.updateSplitviewEdgeSnappingEnablement()}}constructor(e,t,i,o,r=0,s=0,n=!1,a){if(this.orientation=e,this.layoutController=t,this.splitviewProportionalLayout=o,this.children=[],this._absoluteOffset=0,this._absoluteOrthogonalOffset=0,this.absoluteOrthogonalSize=0,this._onDidChange=new u.Emitter,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new u.Emitter,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this.childrenVisibilityChangeDisposable=new d.DisposableStore,this._onDidScroll=new u.Emitter,this.onDidScrollDisposable=d.Disposable.None,this.onDidScroll=this._onDidScroll.event,this.childrenChangeDisposable=d.Disposable.None,this._onDidSashReset=new u.Emitter,this.onDidSashReset=this._onDidSashReset.event,this.splitviewSashResetDisposable=d.Disposable.None,this.childrenSashResetDisposable=d.Disposable.None,this._boundarySashes={},this._edgeSnapping=!1,this._styles=i,this._size=r,this._orthogonalSize=s,this.element=(0,l.$)(".monaco-grid-branch-node"),a){const t={views:a.map(e=>({view:e.node,size:e.node.size,visible:!1!==e.visible})),size:this.orthogonalSize};this.children=a.map(e=>e.node),this.splitview=new c.SplitView(this.element,{proportionalLayout:o,orientation:e,styles:i,descriptor:t}),this.children.forEach((e,t)=>{let i=t===this.children.length;e.boundarySashes={start:this.boundarySashes.orthogonalStart,end:this.boundarySashes.orthogonalEnd,orthogonalStart:0===t?this.boundarySashes.start:this.splitview.sashes[t-1],orthogonalEnd:i?this.boundarySashes.end:this.splitview.sashes[t]}})}else this.splitview=new c.SplitView(this.element,{orientation:e,styles:i,proportionalLayout:o}),this.splitview.layout(r,{orthogonalSize:s,absoluteOffset:0,absoluteOrthogonalOffset:0,absoluteSize:r,absoluteOrthogonalSize:s});const h=u.Event.map(this.splitview.onDidSashReset,e=>[e]);this.splitviewSashResetDisposable=h(this._onDidSashReset.fire,this._onDidSashReset),this.updateChildrenEvents()}style(e){for(let t of(this._styles=e,this.splitview.style(e),this.children))t instanceof b&&t.style(e)}layout(e,t,i){if(this.layoutController.isLayoutEnabled){if(void 0===i)throw Error("Invalid state");this._size=i.orthogonalSize,this._orthogonalSize=e,this._absoluteOffset=i.absoluteOffset+t,this._absoluteOrthogonalOffset=i.absoluteOrthogonalOffset,this.absoluteOrthogonalSize=i.absoluteOrthogonalSize,this.splitview.layout(i.orthogonalSize,{orthogonalSize:e,absoluteOffset:this._absoluteOrthogonalOffset,absoluteOrthogonalOffset:this._absoluteOffset,absoluteSize:i.absoluteOrthogonalSize,absoluteOrthogonalSize:i.absoluteSize}),this.updateSplitviewEdgeSnappingEnablement()}}setVisible(e){for(let t of this.children)t.setVisible(e)}addChild(e,t,i,o){i=C(i,this.children.length),this.splitview.addView(e,t,i,o),this.children.splice(i,0,e),this.updateBoundarySashes(),this.onDidChildrenChange()}removeChild(e,t){e=C(e,this.children.length);let i=this.splitview.removeView(e,t);return this.children.splice(e,1),this.updateBoundarySashes(),this.onDidChildrenChange(),i}removeAllChildren(){let e=this.splitview.removeAllViews();return this.children.splice(0,this.children.length),this.updateBoundarySashes(),this.onDidChildrenChange(),e}moveChild(e,t){e=C(e,this.children.length),t=C(t,this.children.length),e!==t&&(e<t&&(t-=1),this.splitview.moveView(e,t),this.children.splice(t,0,this.children.splice(e,1)[0]),this.updateBoundarySashes(),this.onDidChildrenChange())}swapChildren(e,t){e=C(e,this.children.length),t=C(t,this.children.length),e!==t&&(this.splitview.swapViews(e,t),[this.children[e].boundarySashes,this.children[t].boundarySashes]=[this.children[e].boundarySashes,this.children[t].boundarySashes],[this.children[e],this.children[t]]=[this.children[t],this.children[e]],this.onDidChildrenChange())}resizeChild(e,t){e=C(e,this.children.length),this.splitview.resizeView(e,t)}isChildExpanded(e){return this.splitview.isViewExpanded(e)}distributeViewSizes(e=!1){if(this.splitview.distributeViewSizes(),e)for(let e of this.children)e instanceof b&&e.distributeViewSizes(!0)}getChildSize(e){return e=C(e,this.children.length),this.splitview.getViewSize(e)}isChildVisible(e){return e=C(e,this.children.length),this.splitview.isViewVisible(e)}setChildVisible(e,t){if(e=C(e,this.children.length),this.splitview.isViewVisible(e)===t)return;let i=0===this.splitview.contentSize;this.splitview.setViewVisible(e,t);let o=0===this.splitview.contentSize;(t&&i||!t&&o)&&this._onDidVisibilityChange.fire(t)}getChildCachedVisibleSize(e){return e=C(e,this.children.length),this.splitview.getViewCachedVisibleSize(e)}updateBoundarySashes(){for(let e=0;e<this.children.length;e++)this.children[e].boundarySashes={start:this.boundarySashes.orthogonalStart,end:this.boundarySashes.orthogonalEnd,orthogonalStart:0===e?this.boundarySashes.start:this.splitview.sashes[e-1],orthogonalEnd:e===this.children.length-1?this.boundarySashes.end:this.splitview.sashes[e]}}onDidChildrenChange(){this.updateChildrenEvents(),this._onDidChange.fire(void 0)}updateChildrenEvents(){let e=u.Event.map(u.Event.any(...this.children.map(e=>e.onDidChange)),()=>void 0);this.childrenChangeDisposable.dispose(),this.childrenChangeDisposable=e(this._onDidChange.fire,this._onDidChange);let t=u.Event.any(...this.children.map((e,t)=>u.Event.map(e.onDidSashReset,e=>[t,...e])));this.childrenSashResetDisposable.dispose(),this.childrenSashResetDisposable=t(this._onDidSashReset.fire,this._onDidSashReset);let i=u.Event.any(u.Event.signal(this.splitview.onDidScroll),...this.children.map(e=>e.onDidScroll));this.onDidScrollDisposable.dispose(),this.onDidScrollDisposable=i(this._onDidScroll.fire,this._onDidScroll),this.childrenVisibilityChangeDisposable.clear(),this.children.forEach((e,t)=>{e instanceof b&&this.childrenVisibilityChangeDisposable.add(e.onDidVisibilityChange(e=>{this.setChildVisible(t,e)}))})}trySet2x2(e){if(2!==this.children.length||2!==e.children.length||this.getChildSize(0)!==e.getChildSize(0))return d.Disposable.None;let[t,i]=this.children,[o,r]=e.children;if(!(t instanceof w)||!(i instanceof w)||!(o instanceof w)||!(r instanceof w))return d.Disposable.None;this.orientation===n.Orientation.VERTICAL?(i.linkedWidthNode=o.linkedHeightNode=t,t.linkedWidthNode=r.linkedHeightNode=i,r.linkedWidthNode=t.linkedHeightNode=o,o.linkedWidthNode=i.linkedHeightNode=r):(o.linkedWidthNode=i.linkedHeightNode=t,r.linkedWidthNode=t.linkedHeightNode=i,t.linkedWidthNode=r.linkedHeightNode=o,i.linkedWidthNode=o.linkedHeightNode=r);let s=this.splitview.sashes[0],a=e.splitview.sashes[0];return s.linkedSash=a,a.linkedSash=s,this._onDidChange.fire(void 0),e._onDidChange.fire(void 0),(0,d.toDisposable)(()=>{s.linkedSash=a.linkedSash=void 0,t.linkedHeightNode=t.linkedWidthNode=void 0,i.linkedHeightNode=i.linkedWidthNode=void 0,o.linkedHeightNode=o.linkedWidthNode=void 0,r.linkedHeightNode=r.linkedWidthNode=void 0})}updateSplitviewEdgeSnappingEnablement(){this.splitview.startSnappingEnabled=this._edgeSnapping||this._absoluteOrthogonalOffset>0,this.splitview.endSnappingEnabled=this._edgeSnapping||this._absoluteOrthogonalOffset+this._size<this.absoluteOrthogonalSize}dispose(){for(let e of this.children)e.dispose();this._onDidChange.dispose(),this._onDidSashReset.dispose(),this._onDidVisibilityChange.dispose(),this.childrenVisibilityChangeDisposable.dispose(),this.splitviewSashResetDisposable.dispose(),this.childrenSashResetDisposable.dispose(),this.childrenChangeDisposable.dispose(),this.onDidScrollDisposable.dispose(),this.splitview.dispose()}}class w{get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}get linkedWidthNode(){return this._linkedWidthNode}set linkedWidthNode(e){this._onDidLinkedWidthNodeChange.input=e?e._onDidViewChange:u.Event.None,this._linkedWidthNode=e,this._onDidSetLinkedNode.fire(void 0)}get linkedHeightNode(){return this._linkedHeightNode}set linkedHeightNode(e){this._onDidLinkedHeightNodeChange.input=e?e._onDidViewChange:u.Event.None,this._linkedHeightNode=e,this._onDidSetLinkedNode.fire(void 0)}constructor(e,t,i,o,r=0){this.view=e,this.orientation=t,this.layoutController=i,this._size=0,this.absoluteOffset=0,this.absoluteOrthogonalOffset=0,this.onDidScroll=u.Event.None,this.onDidSashReset=u.Event.None,this._onDidLinkedWidthNodeChange=new u.Relay,this._linkedWidthNode=void 0,this._onDidLinkedHeightNodeChange=new u.Relay,this._linkedHeightNode=void 0,this._onDidSetLinkedNode=new u.Emitter,this.disposables=new d.DisposableStore,this._boundarySashes={},this.cachedWidth=0,this.cachedHeight=0,this.cachedTop=0,this.cachedLeft=0,this._orthogonalSize=o,this._size=r;const s=function(e){let[t,i]=u.Event.split(e.onDidChange,g.isUndefined);return u.Event.any(i,u.Event.map(u.Event.latch(u.Event.map(t,t=>[e.minimumWidth,e.maximumWidth,e.minimumHeight,e.maximumHeight]),a.equals),e=>void 0))}(e);this._onDidViewChange=u.Event.map(s,e=>e&&(this.orientation===n.Orientation.VERTICAL?e.width:e.height),this.disposables),this.onDidChange=u.Event.any(this._onDidViewChange,this._onDidSetLinkedNode.event,this._onDidLinkedWidthNodeChange.event,this._onDidLinkedHeightNodeChange.event)}get width(){return this.orientation===n.Orientation.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===n.Orientation.HORIZONTAL?this.size:this.orthogonalSize}get top(){return this.orientation===n.Orientation.HORIZONTAL?this.absoluteOffset:this.absoluteOrthogonalOffset}get left(){return this.orientation===n.Orientation.HORIZONTAL?this.absoluteOrthogonalOffset:this.absoluteOffset}get element(){return this.view.element}get minimumWidth(){return this.linkedWidthNode?Math.max(this.linkedWidthNode.view.minimumWidth,this.view.minimumWidth):this.view.minimumWidth}get maximumWidth(){return this.linkedWidthNode?Math.min(this.linkedWidthNode.view.maximumWidth,this.view.maximumWidth):this.view.maximumWidth}get minimumHeight(){return this.linkedHeightNode?Math.max(this.linkedHeightNode.view.minimumHeight,this.view.minimumHeight):this.view.minimumHeight}get maximumHeight(){return this.linkedHeightNode?Math.min(this.linkedHeightNode.view.maximumHeight,this.view.maximumHeight):this.view.maximumHeight}get minimumSize(){return this.orientation===n.Orientation.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===n.Orientation.HORIZONTAL?this.maximumHeight:this.maximumWidth}get priority(){return this.view.priority}get proportionalLayout(){return this.view.proportionalLayout??!0}get snap(){return this.view.snap}get minimumOrthogonalSize(){return this.orientation===n.Orientation.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===n.Orientation.HORIZONTAL?this.maximumWidth:this.maximumHeight}get boundarySashes(){return this._boundarySashes}set boundarySashes(e){this._boundarySashes=e,this.view.setBoundarySashes?.(this.orientation===n.Orientation.HORIZONTAL?{left:e.start,right:e.end,top:e.orthogonalStart,bottom:e.orthogonalEnd}:{top:e.start,bottom:e.end,left:e.orthogonalStart,right:e.orthogonalEnd})}layout(e,t,i){if(this.layoutController.isLayoutEnabled){if(void 0===i)throw Error("Invalid state");this._size=e,this._orthogonalSize=i.orthogonalSize,this.absoluteOffset=i.absoluteOffset+t,this.absoluteOrthogonalOffset=i.absoluteOrthogonalOffset,this._layout(this.width,this.height,this.top,this.left)}}_layout(e,t,i,o){(this.cachedWidth!==e||this.cachedHeight!==t||this.cachedTop!==i||this.cachedLeft!==o)&&(this.cachedWidth=e,this.cachedHeight=t,this.cachedTop=i,this.cachedLeft=o,this.view.layout(e,t,i,o))}setVisible(e){this.view.setVisible?.(e)}dispose(){this.disposables.dispose()}}class f{get root(){return this._root}set root(e){let t=this._root;t&&(t.element.remove(),t.dispose()),this._root=e,this.element.appendChild(e.element),this.onDidSashResetRelay.input=e.onDidSashReset,this._onDidChange.input=u.Event.map(e.onDidChange,()=>void 0),this._onDidScroll.input=e.onDidScroll}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get orientation(){return this._root.orientation}get boundarySashes(){return this._boundarySashes}set orientation(e){if(this._root.orientation===e)return;let{size:t,orthogonalSize:i,absoluteOffset:o,absoluteOrthogonalOffset:r}=this._root;this.root=function e(t,i,o){if(t instanceof b){let r=new b(v(t.orientation),t.layoutController,t.styles,t.splitviewProportionalLayout,i,o,t.edgeSnapping),s=0;for(let n=t.children.length-1;n>=0;n--){let a=t.children[n],d=a instanceof b?a.orthogonalSize:a.size,l=0===t.size?0:Math.round(i*d/t.size);s+=l,0===n&&(l+=i-s),r.addChild(e(a,o,l),l,0,!0)}return t.dispose(),r}{let e=new w(t.view,v(t.orientation),t.layoutController,o);return t.dispose(),e}}(this._root,i,t),this.root.layout(t,0,{orthogonalSize:i,absoluteOffset:r,absoluteOrthogonalOffset:o,absoluteSize:t,absoluteOrthogonalSize:i}),this.boundarySashes=this.boundarySashes}set boundarySashes(e){this._boundarySashes=e,this.root.boundarySashes=this.orientation===n.Orientation.HORIZONTAL?{start:e.left,end:e.right,orthogonalStart:e.top,orthogonalEnd:e.bottom}:{start:e.top,end:e.bottom,orthogonalStart:e.left,orthogonalEnd:e.right}}set edgeSnapping(e){this.root.edgeSnapping=e}constructor(e={}){this.onDidSashResetRelay=new u.Relay,this._onDidScroll=new u.Relay,this._onDidChange=new u.Relay,this._boundarySashes={},this.disposable2x2=d.Disposable.None,this.onDidSashReset=this.onDidSashResetRelay.event,this.onDidScroll=this._onDidScroll.event,this.onDidChange=this._onDidChange.event,this.maximizedNode=void 0,this._onDidChangeViewMaximized=new u.Emitter,this.onDidChangeViewMaximized=this._onDidChangeViewMaximized.event,this.element=(0,l.$)(".monaco-grid-view"),this.styles=e.styles||m,this.proportionalLayout=void 0===e.proportionalLayout||!!e.proportionalLayout,this.layoutController=new y(!1),this.root=new b(n.Orientation.VERTICAL,this.layoutController,this.styles,this.proportionalLayout)}style(e){this.styles=e,this.root.style(e)}layout(e,t,i=0,o=0){this.layoutController.isLayoutEnabled=!0;let[r,s,a,d]=this.root.orientation===n.Orientation.HORIZONTAL?[t,e,i,o]:[e,t,o,i];this.root.layout(r,0,{orthogonalSize:s,absoluteOffset:a,absoluteOrthogonalOffset:d,absoluteSize:r,absoluteOrthogonalSize:s})}addView(e,t,i){this.hasMaximizedView()&&this.exitMaximizedView(),this.disposable2x2.dispose(),this.disposable2x2=d.Disposable.None;let[o,r]=(0,a.tail)(i),[s,n]=this.getNode(o);if(n instanceof b){let i=new w(e,v(n.orientation),this.layoutController,n.orthogonalSize);try{n.addChild(i,t,r)}catch(e){throw i.dispose(),e}}else{let[,i]=(0,a.tail)(s),[,d]=(0,a.tail)(o),l=0,h=i.getChildCachedVisibleSize(d);"number"==typeof h&&(l=c.Sizing.Invisible(h)),i.removeChild(d).dispose();let u=new b(n.orientation,n.layoutController,this.styles,this.proportionalLayout,n.size,n.orthogonalSize,i.edgeSnapping);i.addChild(u,n.size,d);let p=new w(n.view,i.orientation,this.layoutController,n.size);u.addChild(p,l,0),"number"!=typeof t&&"split"===t.type&&(t=c.Sizing.Split(0));let g=new w(e,i.orientation,this.layoutController,n.size);u.addChild(g,t,r)}this.trySet2x2()}removeView(e,t){this.hasMaximizedView()&&this.exitMaximizedView(),this.disposable2x2.dispose(),this.disposable2x2=d.Disposable.None;let[i,o]=(0,a.tail)(e),[r,s]=this.getNode(i);if(!(s instanceof b))throw Error("Invalid location");let n=s.children[o];if(!(n instanceof w))throw Error("Invalid location");if(s.removeChild(o,t),n.dispose(),0===s.children.length)throw Error("Invalid grid state");if(s.children.length>1)return this.trySet2x2(),n.view;if(0===r.length){let e=s.children[0];return e instanceof w||(s.removeChild(0),s.dispose(),this.root=e,this.boundarySashes=this.boundarySashes,this.trySet2x2()),n.view}let[,l]=(0,a.tail)(r),[,h]=(0,a.tail)(i),u=s.isChildVisible(0),p=s.removeChild(0),g=l.children.map((e,t)=>l.getChildSize(t));if(l.removeChild(h,t),s.dispose(),p instanceof b){g.splice(h,1,...p.children.map(e=>e.size));let e=p.removeAllChildren();for(let t=0;t<e.length;t++)l.addChild(e[t],e[t].size,h+t)}else{let e=new w(p.view,v(p.orientation),this.layoutController,p.size),t=u?p.orthogonalSize:c.Sizing.Invisible(p.orthogonalSize);l.addChild(e,t,h)}p.dispose();for(let e=0;e<g.length;e++)l.resizeChild(e,g[e]);return this.trySet2x2(),n.view}moveView(e,t,i){this.hasMaximizedView()&&this.exitMaximizedView();let[,o]=this.getNode(e);if(!(o instanceof b))throw Error("Invalid location");o.moveChild(t,i),this.trySet2x2()}swapViews(e,t){this.hasMaximizedView()&&this.exitMaximizedView();let[i,o]=(0,a.tail)(e),[,r]=this.getNode(i);if(!(r instanceof b))throw Error("Invalid from location");let s=r.getChildSize(o),n=r.children[o];if(!(n instanceof w))throw Error("Invalid from location");let[d,l]=(0,a.tail)(t),[,c]=this.getNode(d);if(!(c instanceof b))throw Error("Invalid to location");let h=c.getChildSize(l),u=c.children[l];if(!(u instanceof w))throw Error("Invalid to location");r===c?r.swapChildren(o,l):(r.removeChild(o),c.removeChild(l),r.addChild(u,s,o),c.addChild(n,h,l)),this.trySet2x2()}resizeView(e,t){this.hasMaximizedView()&&this.exitMaximizedView();let[i,o]=(0,a.tail)(e),[r,s]=this.getNode(i);if(!(s instanceof b))throw Error("Invalid location");if(!t.width&&!t.height)return;let[d,l]=s.orientation===n.Orientation.HORIZONTAL?[t.width,t.height]:[t.height,t.width];if("number"==typeof l&&r.length>0){let[,e]=(0,a.tail)(r),[,t]=(0,a.tail)(i);e.resizeChild(t,l)}"number"==typeof d&&s.resizeChild(o,d),this.trySet2x2()}getViewSize(e){if(!e)return{width:this.root.width,height:this.root.height};let[,t]=this.getNode(e);return{width:t.width,height:t.height}}getViewCachedVisibleSize(e){let[t,i]=(0,a.tail)(e),[,o]=this.getNode(t);if(!(o instanceof b))throw Error("Invalid location");return o.getChildCachedVisibleSize(i)}expandView(e){this.hasMaximizedView()&&this.exitMaximizedView();let[t,i]=this.getNode(e);if(!(i instanceof w))throw Error("Invalid location");for(let i=0;i<t.length;i++)t[i].resizeChild(e[i],1/0)}isViewExpanded(e){if(this.hasMaximizedView())return!1;let[t,i]=this.getNode(e);if(!(i instanceof w))throw Error("Invalid location");for(let i=0;i<t.length;i++)if(!t[i].isChildExpanded(e[i]))return!1;return!0}maximizeView(e){let[,t]=this.getNode(e);if(!(t instanceof w))throw Error("Location is not a LeafNode");this.maximizedNode!==t&&(this.hasMaximizedView()&&this.exitMaximizedView(),function e(t,i){for(let o=0;o<t.children.length;o++){let r=t.children[o];r instanceof w?r!==i&&t.setChildVisible(o,!1):e(r,i)}}(this.root,t),this.maximizedNode=t,this._onDidChangeViewMaximized.fire(!0))}exitMaximizedView(){this.maximizedNode&&(this.maximizedNode=void 0,function e(t){for(let i=t.children.length-1;i>=0;i--){let o=t.children[i];o instanceof w?t.setChildVisible(i,!0):e(o)}}(this.root),this._onDidChangeViewMaximized.fire(!1))}hasMaximizedView(){return void 0!==this.maximizedNode}isViewMaximized(e){let[,t]=this.getNode(e);if(!(t instanceof w))throw Error("Location is not a LeafNode");return t===this.maximizedNode}distributeViewSizes(e){if(this.hasMaximizedView()&&this.exitMaximizedView(),!e)return void this.root.distributeViewSizes(!0);let[,t]=this.getNode(e);if(!(t instanceof b))throw Error("Invalid location");t.distributeViewSizes(),this.trySet2x2()}isViewVisible(e){let[t,i]=(0,a.tail)(e),[,o]=this.getNode(t);if(!(o instanceof b))throw Error("Invalid from location");return o.isChildVisible(i)}setViewVisible(e,t){if(this.hasMaximizedView())return void this.exitMaximizedView();let[i,o]=(0,a.tail)(e),[,r]=this.getNode(i);if(!(r instanceof b))throw Error("Invalid from location");r.setChildVisible(o,t)}getView(e){let t=e?this.getNode(e)[1]:this._root;return this._getViews(t,this.orientation)}static deserialize(e,t,i={}){if("number"!=typeof e.orientation)throw Error("Invalid JSON: 'orientation' property must be a number.");if("number"!=typeof e.width)throw Error("Invalid JSON: 'width' property must be a number.");if("number"!=typeof e.height)throw Error("Invalid JSON: 'height' property must be a number.");if(e.root?.type!=="branch")throw Error("Invalid JSON: 'root' property must have 'type' value of branch.");let o=e.orientation,r=e.height,s=new f(i);return s._deserialize(e.root,o,t,r),s}_deserialize(e,t,i,o){this.root=this._deserializeNode(e,t,i,o)}_deserializeNode(e,t,i,o){let r;if("branch"===e.type){let s=e.data.map(o=>({node:this._deserializeNode(o,v(t),i,e.size),visible:o.visible}));r=new b(t,this.layoutController,this.styles,this.proportionalLayout,e.size,o,void 0,s)}else r=new w(i.fromJSON(e.data),t,this.layoutController,o,e.size),e.maximized&&!this.maximizedNode&&(this.maximizedNode=r,this._onDidChangeViewMaximized.fire(!0));return r}_getViews(e,t,i){let o={top:e.top,left:e.left,width:e.width,height:e.height};if(e instanceof w)return{view:e.view,box:o,cachedVisibleSize:i,maximized:this.maximizedNode===e};let r=[];for(let i=0;i<e.children.length;i++){let o=e.children[i],s=e.getChildCachedVisibleSize(i);r.push(this._getViews(o,v(t),s))}return{children:r,box:o}}getNode(e,t=this.root,i=[]){if(0===e.length)return[i,t];if(!(t instanceof b))throw Error("Invalid location");let[o,...r]=e;if(o<0||o>=t.children.length)throw Error("Invalid location");let s=t.children[o];return i.push(t),this.getNode(r,s,i)}trySet2x2(){if(this.disposable2x2.dispose(),this.disposable2x2=d.Disposable.None,2!==this.root.children.length)return;let[e,t]=this.root.children;e instanceof b&&t instanceof b&&(this.disposable2x2=e.trySet2x2(t))}getViewMap(e,t){t||(t=this.root),t instanceof b?t.children.forEach(t=>this.getViewMap(e,t)):e.set(t.view,t.element)}dispose(){this.onDidSashResetRelay.dispose(),this.root.dispose(),this.element.remove()}}function S(e){return!!e.children}function _(e,t){let i=I(t);return{offset:t===o.Up?e.top:t===o.Right?e.left+e.width:t===o.Down?e.top+e.height:e.left,range:{start:i===n.Orientation.HORIZONTAL?e.top:e.left,end:i===n.Orientation.HORIZONTAL?e.top+e.height:e.left+e.width}}}function E(e,t){return t.length%2==0?v(e):e}function I(e){return e===o.Up||e===o.Down?n.Orientation.VERTICAL:n.Orientation.HORIZONTAL}function D(e,t,i){if(E(e,t)!==I(i))return[...t,+(i===o.Right||i===o.Down)];{let[e,r]=(0,a.tail)(t);return(i===o.Right||i===o.Down)&&(r+=1),[...e,r]}}e.s(["GridView",0,f,"orthogonal",0,v],938676),(0,s.registerCss)(void 0),(t=o||(o={}))[t.Up=0]="Up",t[t.Down=1]="Down",t[t.Left=2]="Left",t[t.Right=3]="Right",(i=r||(r={})).Distribute={type:"distribute"},i.Split={type:"split"},i.Auto={type:"auto"},i.Invisible=function(e){return{type:"invisible",cachedVisibleSize:e}};class T extends d.Disposable{get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumWidth(){return this.gridview.minimumWidth}get minimumHeight(){return this.gridview.minimumHeight}get maximumWidth(){return this.gridview.maximumWidth}get maximumHeight(){return this.gridview.maximumHeight}get boundarySashes(){return this.gridview.boundarySashes}set boundarySashes(e){this.gridview.boundarySashes=e}set edgeSnapping(e){this.gridview.edgeSnapping=e}get element(){return this.gridview.element}constructor(e,t={}){super(),this.views=new Map,this.didLayout=!1,e instanceof f?(this.gridview=e,this.gridview.getViewMap(this.views)):this.gridview=new f(t),this._register(this.gridview),this._register(this.gridview.onDidSashReset(this.onDidSashReset,this)),e instanceof f||this._addView(e,0,[0]),this.onDidChange=this.gridview.onDidChange,this.onDidScroll=this.gridview.onDidScroll,this.onDidChangeViewMaximized=this.gridview.onDidChangeViewMaximized}style(e){this.gridview.style(e)}layout(e,t,i=0,o=0){this.gridview.layout(e,t,i,o),this.didLayout=!0}addView(e,t,i,o){let r;if(this.views.has(e))throw Error("Can't add same view twice");let s=I(o);1===this.views.size&&this.orientation!==s&&(this.orientation=s);let n=this.getViewLocation(i),d=D(this.gridview.orientation,n,o);if("number"==typeof t)r=t;else if("split"===t.type){let[,e]=(0,a.tail)(n);r=c.Sizing.Split(e)}else if("distribute"===t.type)r=c.Sizing.Distribute;else if("auto"===t.type){let[,e]=(0,a.tail)(n);r=c.Sizing.Auto(e)}else r=t;this._addView(e,r,d)}addViewAt(e,t,i){let o;if(this.views.has(e))throw Error("Can't add same view twice");o="number"==typeof t?t:"distribute"===t.type?c.Sizing.Distribute:t,this._addView(e,o,i)}_addView(e,t,i){this.views.set(e,e.element),this.gridview.addView(e,t,i)}removeView(e,t){let i;if(1===this.views.size)throw Error("Can't remove last view");let o=this.getViewLocation(e);if(t?.type==="distribute")i=c.Sizing.Distribute;else if(t?.type==="auto"){let e=o[o.length-1];i=c.Sizing.Auto(0===e?1:e-1)}this.gridview.removeView(o,i),this.views.delete(e)}moveView(e,t,i,o){let r=this.getViewLocation(e),[s,n]=(0,a.tail)(r),d=this.getViewLocation(i),l=D(this.gridview.orientation,d,o),[c,h]=(0,a.tail)(l);(0,a.equals)(s,c)?this.gridview.moveView(s,n,h):(this.removeView(e,"number"==typeof t?void 0:t),this.addView(e,t,i,o))}moveViewTo(e,t){let i=this.getViewLocation(e),[o,s]=(0,a.tail)(i),[d,l]=(0,a.tail)(t);if((0,a.equals)(o,d))this.gridview.moveView(o,s,l);else{let o=this.getViewSize(e),s=E(this.gridview.orientation,i),a=this.getViewCachedVisibleSize(e),d=void 0===a?s===n.Orientation.HORIZONTAL?o.width:o.height:r.Invisible(a);this.removeView(e),this.addViewAt(e,d,t)}}swapViews(e,t){let i=this.getViewLocation(e),o=this.getViewLocation(t);return this.gridview.swapViews(i,o)}resizeView(e,t){let i=this.getViewLocation(e);return this.gridview.resizeView(i,t)}isViewExpanded(e){let t=this.getViewLocation(e);return this.gridview.isViewExpanded(t)}isViewMaximized(e){let t=this.getViewLocation(e);return this.gridview.isViewMaximized(t)}hasMaximizedView(){return this.gridview.hasMaximizedView()}getViewSize(e){if(!e)return this.gridview.getViewSize();let t=this.getViewLocation(e);return this.gridview.getViewSize(t)}getViewCachedVisibleSize(e){let t=this.getViewLocation(e);return this.gridview.getViewCachedVisibleSize(t)}maximizeView(e){if(this.views.size<2)throw Error("At least two views are required to maximize a view");let t=this.getViewLocation(e);this.gridview.maximizeView(t)}exitMaximizedView(){this.gridview.exitMaximizedView()}expandView(e){let t=this.getViewLocation(e);this.gridview.expandView(t)}distributeViewSizes(){this.gridview.distributeViewSizes()}isViewVisible(e){let t=this.getViewLocation(e);return this.gridview.isViewVisible(t)}setViewVisible(e,t){let i=this.getViewLocation(e);this.gridview.setViewVisible(i,t)}getViews(){return this.gridview.getView()}getNeighborViews(e,t,i=!1){var r;let s;if(!this.didLayout)throw Error("Can't call getNeighborViews before first layout");let n=this.getViewLocation(e),a=this.getViews(),d=function e(t,i){if(0===i.length)return t;if(!S(t))throw Error("Invalid location");let[o,...r]=i;return e(t.children[o],r)}(a,n),l=_(d.box,t);return i&&(t===o.Up&&0===d.box.top?l={offset:a.box.top+a.box.height,range:l.range}:t===o.Right&&d.box.left+d.box.width===a.box.width||t===o.Down&&d.box.top+d.box.height===a.box.height?l={offset:0,range:l.range}:t===o.Left&&0===d.box.left&&(l={offset:a.box.left+a.box.width,range:l.range})),(r=function(e){switch(e){case o.Up:return o.Down;case o.Down:return o.Up;case o.Left:return o.Right;case o.Right:return o.Left}}(t),s=[],!function e(t,i,o){if(S(t))for(let r of t.children)e(r,i,o);else{var r;let{offset:e,range:n}=_(t.box,i);e!==o.offset||(r=o.range,n.start>=r.end||r.start>=n.end)||s.push(t)}}(a,r,l),s).map(e=>e.view)}getViewLocation(e){let t=this.views.get(e);if(!t)throw Error("View not found");return function e(t){let i=t.parentElement;if(!i)throw Error("Invalid grid element");if(/\bmonaco-grid-view\b/.test(i.className))return[];let o=function(e){let t=e.parentElement;if(!t)throw Error("Invalid grid element");let i=t.firstElementChild,o=0;for(;i!==e&&i!==t.lastElementChild&&i;)i=i.nextElementSibling,o++;return o}(i);return[...e(i.parentElement.parentElement.parentElement.parentElement),o]}(t)}onDidSashReset(e){let t=e=>{let t=this.gridview.getView(e);if(S(t))return!1;let i=E(this.orientation,e),o=i===n.Orientation.HORIZONTAL?t.view.preferredWidth:t.view.preferredHeight;if("number"!=typeof o)return!1;let r=i===n.Orientation.HORIZONTAL?{width:Math.round(o)}:{height:Math.round(o)};return this.gridview.resizeView(e,r),!0};if(t(e))return;let[i,o]=(0,a.tail)(e);t([...i,o+1])||this.gridview.distributeViewSizes(i)}}class A extends T{constructor(){super(...arguments),this.initialLayoutContext=!0}static serializeNode(e,t){let i=t===n.Orientation.VERTICAL?e.box.width:e.box.height;if(!S(e)){let t={type:"leaf",data:e.view.toJSON(),size:i};return"number"==typeof e.cachedVisibleSize?(t.size=e.cachedVisibleSize,t.visible=!1):e.maximized&&(t.maximized=!0),t}let o=e.children.map(e=>A.serializeNode(e,v(t)));return o.some(e=>!1!==e.visible)?{type:"branch",data:o,size:i}:{type:"branch",data:o,size:i,visible:!1}}static deserialize(e,t,i={}){if("number"!=typeof e.orientation)throw Error("Invalid JSON: 'orientation' property must be a number.");if("number"!=typeof e.width)throw Error("Invalid JSON: 'width' property must be a number.");if("number"!=typeof e.height)throw Error("Invalid JSON: 'height' property must be a number.");return new A(f.deserialize(e,t,i),i)}static from(e,t={}){return A.deserialize(x(e),{fromJSON:e=>e},t)}serialize(){return{root:A.serializeNode(this.getViews(),this.orientation),orientation:this.orientation,width:this.width,height:this.height}}layout(e,t,i=0,o=0){super.layout(e,t,i,o),this.initialLayoutContext&&(this.initialLayoutContext=!1,this.gridview.trySet2x2())}}function x(e){!function e(t,i){if(!i&&t.groups&&t.groups.length<=1&&(t.groups=void 0),!t.groups)return;let o=0,r=0;for(let i of t.groups)e(i,!1),i.size&&(o+=i.size,r++);let s=(r>0?o:1)/(t.groups.length-r);for(let e of t.groups)e.size||(e.size=s)}(e,!0);let t=function e(t){return t.groups?{type:"branch",data:t.groups.map(t=>e(t)),size:t.size}:{type:"leaf",data:t.data,size:t.size}}(e),{width:i,height:o}=function e(t,i){if("branch"===t.type){let o=t.data.map(t=>e(t,v(i)));return i===n.Orientation.VERTICAL?{width:t.size||(0===o.length?void 0:Math.max(...o.map(e=>e.width||0))),height:0===o.length?void 0:o.reduce((e,t)=>e+(t.height||0),0)}:{width:0===o.length?void 0:o.reduce((e,t)=>e+(t.width||0),0),height:t.size||(0===o.length?void 0:Math.max(...o.map(e=>e.height||0)))}}return{width:i===n.Orientation.VERTICAL?t.size:void 0,height:i===n.Orientation.VERTICAL?void 0:t.size}}(t,e.orientation);return{root:t,orientation:e.orientation,width:i||1,height:o||1}}e.s(["Direction",0,o,"SerializableGrid",0,A,"Sizing",0,r,"createSerializedGrid",0,x,"isGridBranchNode",0,S],523183)},244416,740932,391613,e=>{"use strict";var t,i,o,r,s=e.i(654295),n=e.i(281482),a=e.i(650289),d=e.i(9753),l=e.i(919101),c=e.i(488259),h=e.i(84513),u=e.i(975445),p=e.i(140889);e.i(575129);var g=e.i(698014);e.i(140331),e.i(471999),e.i(900329),e.i(785266),e.i(181268),e.i(70177),e.i(575210),e.i(890787),e.i(67920);var m=e.i(970672),v=e.i(856884),y=e.i(428521),C=e.i(447186),b=e.i(981399),w=e.i(536561),f=e.i(957994),S=e.i(93153),_=e.i(701898),E=e.i(91198),I=e.i(535567),D=e.i(976098),T=e.i(508267),A=e.i(846960),x=e.i(781808),R=e.i(621826),k=e.i(360668),M=e.i(686380),L=e.i(536766),O=e.i(399362),P=e.i(443483),V=e.i(502930);let K=class extends k.Composite{constructor(e,t,i,o,r,s,n,a){super(e,t,r,i),this.storageService=i,this.instantiationService=o,this.contextMenuService=s,this.extensionService=n,this.contextService=a}create(e){super.create(e),this.viewPaneContainer=this._register(this.createViewPaneContainer(e)),this._register(this.viewPaneContainer.onTitleAreaUpdate(()=>this.updateTitleArea())),this.viewPaneContainer.create(e)}setVisible(e){super.setVisible(e),this.viewPaneContainer?.setVisible(e)}layout(e){this.viewPaneContainer?.layout(e)}setBoundarySashes(e){this.viewPaneContainer?.setBoundarySashes(e)}getOptimalWidth(){return this.viewPaneContainer?.getOptimalWidth()??0}openView(e,t){return this.viewPaneContainer?.openView(e,t)}getViewPaneContainer(){return this.viewPaneContainer}getActionsContext(){return this.getViewPaneContainer()?.getActionsContext()}getContextMenuActions(){return this.viewPaneContainer?.menuActions?.getContextMenuActions()??[]}getMenuIds(){let e=[];return this.viewPaneContainer?.menuActions&&(e.push(this.viewPaneContainer.menuActions.menuId),this.viewPaneContainer.isViewMergedWithContainer()&&e.push(this.viewPaneContainer.panes[0].menuActions.menuId)),e}getActions(){let e=[];if(this.viewPaneContainer?.menuActions&&(e.push(...this.viewPaneContainer.menuActions.getPrimaryActions()),this.viewPaneContainer.isViewMergedWithContainer())){let t=this.viewPaneContainer.panes[0];t.shouldShowFilterInHeader()&&e.push(V.VIEWPANE_FILTER_ACTION),e.push(...t.menuActions.getPrimaryActions())}return e}getSecondaryActions(){if(!this.viewPaneContainer?.menuActions)return[];let e=this.viewPaneContainer.isViewMergedWithContainer()?this.viewPaneContainer.panes[0].menuActions.getSecondaryActions():[],t=this.viewPaneContainer.menuActions.getSecondaryActions(),i=t.findIndex(e=>e instanceof M.SubmenuItemAction&&e.item.submenu===P.ViewsSubMenu);if(-1!==i){let o=t[i];o.actions.some(({enabled:e})=>e)?1===t.length&&0===e.length?t=o.actions.slice():0!==i&&(t=[o,...t.slice(0,i),...t.slice(i+1)]):t.splice(i,1)}return t.length&&e.length?[...t,new _.Separator,...e]:t.length?t:e}getActionViewItem(e,t){return this.viewPaneContainer?.getActionViewItem(e,t)}getTitle(){return this.viewPaneContainer?.getTitle()??""}focus(){super.focus(),this.viewPaneContainer?.focus()}};K=(0,n.__decorate)([(0,n.__param)(1,L.ITelemetryService),(0,n.__param)(2,p.IStorageService),(0,n.__param)(3,c.IInstantiationService),(0,n.__param)(4,m.IThemeService),(0,n.__param)(5,l.IContextMenuService),(0,n.__param)(6,b.IExtensionService),(0,n.__param)(7,O.IWorkspaceContextService)],K);class N extends k.CompositeDescriptor{static create(e,t,i,o,r,s,n){return new N(e,t,i,o,r,s,n)}constructor(e,t,i,o,r,s,n){super(e,t,i,o,r,s),this.iconUrl=n}}let G={Viewlets:"workbench.contributions.viewlets",Panels:"workbench.contributions.panels",Auxiliary:"workbench.contributions.auxiliary"};class F extends k.CompositeRegistry{registerPaneComposite(e){super.registerComposite(e)}deregisterPaneComposite(e){super.deregisterComposite(e)}getPaneComposite(e){return this.getComposite(e)}getPaneComposites(){return this.getComposites()}}R.Registry.add(G.Viewlets,new F),R.Registry.add(G.Panels,new F),R.Registry.add(G.Auxiliary,new F),e.s(["Extensions",0,G,"PaneComposite",0,K,"PaneCompositeDescriptor",0,N],740932);var W=e.i(305063),z=e.i(611130),B=e.i(773507),U=e.i(619122),H=e.i(32637),$=e.i(555322),q=e.i(292663),Y=e.i(701575),j=e.i(299051),X=e.i(927842),J=e.i(850887),Z=e.i(895737),Q=e.i(2301),ee=e.i(396195),et=e.i(159868),ei=e.i(490819),eo=e.i(841203);(0,s.registerCss)(void 0);class er extends q.Part{constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p,g,m,v){super(m,v,a,t,o),this.notificationService=e,this.storageService=t,this.contextMenuService=i,this.keybindingService=r,this.hoverService=s,this.instantiationService=n,this.registry=d,this.activeCompositeSettingsKey=l,this.defaultCompositeId=c,this.nameForTelemetry=h,this.compositeCSSClass=u,this.titleForegroundColor=p,this.titleBorderColor=g,this.onDidCompositeOpen=this._register(new x.Emitter),this.onDidCompositeClose=this._register(new x.Emitter),this.mapCompositeToCompositeContainer=new Map,this.mapActionsBindingToComposite=new Map,this.instantiatedCompositeItems=new Map,this.actionsListener=this._register(new z.MutableDisposable),this.lastActiveCompositeId=t.get(l,Y.StorageScope.WORKSPACE,this.defaultCompositeId),this.toolbarHoverDelegate=this._register((0,eo.createInstantHoverDelegate)()),this.trailingSeparator=v.trailingSeparator??!1}openComposite(e,t){return this.activeComposite?.getId()===e?(t&&this.activeComposite.focus(),this.activeComposite):this.element?this.doOpenComposite(e,t):void 0}doOpenComposite(e,t=!1){let i=B.defaultGenerator.nextId();this.currentCompositeOpenToken=i,this.activeComposite&&this.hideActiveComposite(),this.updateTitle(e);let o=this.createComposite(e,!0);if(this.currentCompositeOpenToken===i&&(!this.activeComposite||this.activeComposite.getId()===o.getId()))return this.activeComposite?.getId()===o.getId()?(t&&o.focus(),this.onDidCompositeOpen.fire({composite:o,focus:t})):(this.showComposite(o),t&&o.focus(),o&&this.onDidCompositeOpen.fire({composite:o,focus:t})),o}createComposite(e,t){let i=this.instantiatedCompositeItems.get(e);if(i)return i.composite;let o=this.registry.getComposite(e);if(o){let i=this,r=new ee.ScopedProgressIndicator((0,I.assertReturnsDefined)(this.progressBar),this._register(new class extends ee.AbstractProgressScope{constructor(){super(o.id,!!t),this._register(i.onDidCompositeOpen.event(e=>this.onScopeOpened(e.composite.getId()))),this._register(i.onDidCompositeClose.event(e=>this.onScopeClosed(e.getId())))}})),s=this._register(this.instantiationService.createChild(new j.ServiceCollection([X.IEditorProgressService,r]))),n=o.instantiate(s),a=new z.DisposableStore;return this.instantiatedCompositeItems.set(e,{composite:n,disposable:a,progress:r}),a.add(n.onTitleAreaUpdate(()=>this.onTitleAreaUpdate(n.getId()),this)),a.add(s),n}throw Error(`Unable to find composite with id ${e}`)}showComposite(e){this.activeComposite=e;let t=this.activeComposite.getId();t!==this.defaultCompositeId?this.storageService.store(this.activeCompositeSettingsKey,t,Y.StorageScope.WORKSPACE,Y.StorageTarget.MACHINE):this.storageService.remove(this.activeCompositeSettingsKey,Y.StorageScope.WORKSPACE),this.lastActiveCompositeId=this.activeComposite.getId();let i=this.mapCompositeToCompositeContainer.get(e.getId());if(i||((i=(0,J.$)(".composite")).classList.add(...this.compositeCSSClass.split(" ")),i.id=e.getId(),e.create(i),e.updateStyles(),this.mapCompositeToCompositeContainer.set(e.getId(),i)),!this.activeComposite||e.getId()!==this.activeComposite.getId())return;this.contentArea?.appendChild(i),(0,J.show)(i);let o=(0,I.assertReturnsDefined)(this.toolBar);o.actionRunner=e.getActionRunner();let r=this.registry.getComposite(e.getId());r&&r.name!==e.getTitle()&&this.updateTitle(e.getId(),e.getTitle());let s=this.mapActionsBindingToComposite.get(e.getId());s||(s=this.collectCompositeActions(e),this.mapActionsBindingToComposite.set(e.getId(),s)),s(),this.actionsListener.value=o.actionRunner.onDidRun(e=>{e.error&&!(0,U.isCancellationError)(e.error)&&this.notificationService.error(e.error)}),e.setVisible(!0),this.activeComposite&&e.getId()===this.activeComposite.getId()&&(this.contentAreaSize&&e.layout(this.contentAreaSize),this.boundarySashes&&e.setBoundarySashes(this.boundarySashes))}onTitleAreaUpdate(e){let t=this.instantiatedCompositeItems.get(e);if(t&&this.updateTitle(e,t.composite.getTitle()),this.activeComposite?.getId()===e){let e=this.collectCompositeActions(this.activeComposite);this.mapActionsBindingToComposite.set(this.activeComposite.getId(),e),e()}else this.mapActionsBindingToComposite.delete(e)}updateTitle(e,t){let i=this.registry.getComposite(e);if(!i||!this.titleLabel)return;t||(t=i.name);let o=this.keybindingService.lookupKeybinding(e);this.titleLabel.updateTitle(e,t,o?.getLabel()??void 0),(0,I.assertReturnsDefined)(this.toolBar).setAriaLabel((0,a.localize)(3044,"{0} actions",t))}collectCompositeActions(e){let t=e?.getMenuIds(),i=e?.getActions().slice(0)||[],o=e?.getSecondaryActions().slice(0)||[],r=(0,I.assertReturnsDefined)(this.toolBar);return r.context=this.actionsContextProvider(),()=>{r.setActions((0,H.prepareActions)(i),(0,H.prepareActions)(o),t),this.titleArea?.classList.toggle("has-actions",i.length>0||o.length>0)}}getActiveComposite(){return this.activeComposite}getLastActiveCompositeId(){return this.lastActiveCompositeId}hideActiveComposite(){if(!this.activeComposite)return;let e=this.activeComposite;this.activeComposite=void 0;let t=this.mapCompositeToCompositeContainer.get(e.getId());return e.setVisible(!1),t&&(t.remove(),(0,J.hide)(t)),this.progressBar?.stop().hide(),this.toolBar&&this.collectCompositeActions()(),this.onDidCompositeClose.fire(e),e}createTitleArea(e){let t=(0,J.append)(e,(0,J.$)(".composite"));t.classList.add("title"),this.titleLabel=this.createTitleLabel(t);let i=(0,J.append)(t,(0,J.$)(".title-actions"));return this.toolBar=this._register(this.instantiationService.createInstance(et.WorkbenchToolBar,i,{actionViewItemProvider:(e,t)=>this.actionViewItemProvider(e,t),orientation:H.ActionsOrientation.HORIZONTAL,getKeyBinding:e=>this.keybindingService.lookupKeybinding(e.id),anchorAlignmentProvider:()=>this.getTitleAreaDropDownAnchorAlignment(),toggleMenuTitle:(0,a.localize)(3045,"Views and More Actions..."),telemetrySource:this.nameForTelemetry,hoverDelegate:this.toolbarHoverDelegate,trailingSeparator:this.trailingSeparator})),this.collectCompositeActions()(),t}createTitleLabel(e){let t=(0,J.append)(e,(0,J.$)(".title-label")),i=(0,J.append)(t,(0,J.$)("h2"));this.titleLabelElement=i;let o=this._register(this.hoverService.setupManagedHover((0,eo.getDefaultHoverDelegate)("mouse"),i,"")),r=this;return{updateTitle:(e,t,r)=>{this.activeComposite&&this.activeComposite.getId()!==e||(i.textContent=t,o.update(r?(0,a.localize)(3046,"{0} ({1})",t,r):t))},updateStyles:()=>{i.style.color=r.titleForegroundColor&&r.getColor(r.titleForegroundColor)||"";let t=r.titleBorderColor?r.getColor(r.titleBorderColor):void 0;e.style.borderBottom=t?`1px solid ${t}`:""}}}createHeaderArea(){return(0,J.$)(".composite")}createFooterArea(){return(0,J.$)(".composite")}updateStyles(){super.updateStyles(),(0,I.assertReturnsDefined)(this.titleLabel).updateStyles()}actionViewItemProvider(e,t){return this.activeComposite?this.activeComposite.getActionViewItem(e,t):(0,Q.createActionViewItem)(this.instantiationService,e,t)}actionsContextProvider(){return this.activeComposite?this.activeComposite.getActionsContext():null}createContentArea(e){let t=(0,J.append)(e,(0,J.$)(".content"));return this.progressBar=this._register(new $.ProgressBar(t,ei.defaultProgressBarStyles)),this.progressBar.hide(),t}getProgressIndicator(e){let t=this.instantiatedCompositeItems.get(e);return t?t.progress:void 0}getTitleAreaDropDownAnchorAlignment(){return Z.AnchorAlignment.RIGHT}layout(e,t,i,o){super.layout(e,t,i,o),this.contentAreaSize=J.Dimension.lift(super.layoutContents(e,t).contentSize),this.activeComposite?.layout(this.contentAreaSize)}setBoundarySashes(e){this.boundarySashes=e,this.activeComposite?.setBoundarySashes(e)}removeComposite(e){if(this.activeComposite?.getId()===e)return!1;this.mapCompositeToCompositeContainer.delete(e),this.mapActionsBindingToComposite.delete(e);let t=this.instantiatedCompositeItems.get(e);return t&&(t.composite.dispose(),(0,z.dispose)(t.disposable),this.instantiatedCompositeItems.delete(e)),!0}dispose(){this.mapCompositeToCompositeContainer.clear(),this.mapActionsBindingToComposite.clear(),this.instantiatedCompositeItems.forEach(e=>{e.composite.dispose(),(0,z.dispose)(e.disposable)}),this.instantiatedCompositeItems.clear(),super.dispose()}}var es=e.i(44383),en=e.i(134939),ea=e.i(94361),ed=e.i(660284),el=e.i(828318),ec=e.i(487495),eh=e.i(590746);(0,s.registerCss)(void 0),(t=o||(o={}))[t.TOP=0]="TOP",t[t.TITLE=1]="TITLE",t[t.BOTTOM=2]="BOTTOM";let eu=class extends er{static{i=this}static{this.MIN_COMPOSITE_BAR_WIDTH=50}get snap(){return this.layoutService.isVisible(this.partId)||!!this.paneCompositeBar.value?.getVisiblePaneCompositeIds().length}get onDidPaneCompositeOpen(){return x.Event.map(this.onDidCompositeOpen.event,e=>e.composite)}constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p,g,m,v,y,C,b,f){let S=W.ViewContainerLocation.Sidebar,_=G.Viewlets,E=M.MenuId.SidebarTitle;e===w.Parts.PANEL_PART?(S=W.ViewContainerLocation.Panel,_=G.Panels,E=M.MenuId.PanelTitle):e===w.Parts.AUXILIARYBAR_PART&&(S=W.ViewContainerLocation.AuxiliaryBar,_=G.Auxiliary,E=M.MenuId.AuxiliaryBarTitle),super(l,c,h,u,p,g,m,v,R.Registry.as(_),i,y.getDefaultViewContainer(S)?.id||"",s,n,a,d,e,t),this.partId=e,this.activePaneContextKey=o,this.paneFocusContextKey=r,this.viewDescriptorService=y,this.contextKeyService=C,this.extensionService=b,this.menuService=f,this.onDidPaneCompositeClose=this.onDidCompositeClose.event,this.headerFooterCompositeBarDispoables=this._register(new z.DisposableStore),this.paneCompositeBar=this._register(new z.MutableDisposable),this.compositeBarPosition=void 0,this.blockOpening=void 0,this.location=S,this.globalActionsMenuId=E,this.registerListeners()}registerListeners(){this._register(this.onDidPaneCompositeOpen(e=>this.onDidOpen(e))),this._register(this.onDidPaneCompositeClose(this.onDidClose,this)),this._register(this.registry.onDidDeregister(e=>{let t=this.viewDescriptorService.getViewContainersByLocation(this.location).filter(e=>this.viewDescriptorService.getViewContainerModel(e).activeViewDescriptors.length>0);if(t.length){if(this.getActiveComposite()?.getId()===e.id){let e=this.viewDescriptorService.getDefaultViewContainer(this.location)?.id,i=t.filter(t=>t.id===e)[0]||t[0];this.doOpenPaneComposite(i.id)}}else this.layoutService.setPartHidden(!0,this.partId);this.removeComposite(e.id)})),this._register(this.extensionService.onDidRegisterExtensions(()=>{this.layoutCompositeBar()}))}onDidOpen(e){this.activePaneContextKey.set(e.getId())}onDidClose(e){let t=e.getId();this.activePaneContextKey.get()===t&&this.activePaneContextKey.reset()}showComposite(e){this.layoutEmptyMessage(!1),super.showComposite(e),this.layoutCompositeBar()}hideActiveComposite(){let e=super.hideActiveComposite();return this.layoutCompositeBar(),this.layoutEmptyMessage(!0),e}create(e){this.element=e,this.element.classList.add("pane-composite-part"),super.create(e),this.contentArea&&this.createEmptyPaneMessage(this.contentArea),this.updateCompositeBar();let t=this._register((0,J.trackFocus)(e));this._register(t.onDidFocus(()=>this.paneFocusContextKey.set(!0))),this._register(t.onDidBlur(()=>this.paneFocusContextKey.set(!1)))}createEmptyPaneMessage(e){this.emptyPaneMessageElement=(0,J.$)(".empty-pane-message-area");let t=(0,J.$)(".empty-pane-message");t.textContent=(0,a.localize)(3593,"Drag a view here to display."),this.emptyPaneMessageElement.appendChild(t),e.appendChild(this.emptyPaneMessageElement);let i=e=>{let t=!this.getActiveComposite()||!e,i=e&&this.theme.getColor(y.EDITOR_DRAG_AND_DROP_BACKGROUND)?.toString()||"";this.titleContainer&&t&&(this.titleContainer.style.backgroundColor=i),this.headerFooterCompositeBarContainer&&t&&(this.headerFooterCompositeBarContainer.style.backgroundColor=i),this.emptyPaneMessageElement.style.backgroundColor=i};this._register(en.CompositeDragAndDropObserver.INSTANCE.registerTarget(this.element,{onDragOver:e=>{if(J.EventHelper.stop(e.eventData,!0),this.paneCompositeBar.value){let t=this.paneCompositeBar.value.dndHandler.onDragEnter(e.dragAndDropData,void 0,e.eventData);(0,en.toggleDropEffect)(e.eventData.dataTransfer,"move",t)}},onDragEnter:e=>{J.EventHelper.stop(e.eventData,!0),this.paneCompositeBar.value&&i(this.paneCompositeBar.value.dndHandler.onDragEnter(e.dragAndDropData,void 0,e.eventData))},onDragLeave:e=>{J.EventHelper.stop(e.eventData,!0),i(!1)},onDragEnd:e=>{J.EventHelper.stop(e.eventData,!0),i(!1)},onDrop:e=>{if(J.EventHelper.stop(e.eventData,!0),i(!1),this.paneCompositeBar.value)this.paneCompositeBar.value.dndHandler.drop(e.dragAndDropData,void 0,e.eventData);else{let t=e.dragAndDropData.getData();if("composite"===t.type){let e=this.viewDescriptorService.getViewContainerById(t.id);this.viewDescriptorService.moveViewContainerToLocation(e,this.location,void 0,"dnd"),this.openPaneComposite(e.id,!0)}else if("view"===t.type){let e=this.viewDescriptorService.getViewDescriptorById(t.id);if(e.canMoveView){this.viewDescriptorService.moveViewToLocation(e,this.location,"dnd");let t=this.viewDescriptorService.getViewContainerByViewId(e.id);this.openPaneComposite(t.id,!0).then(t=>{t?.openView(e.id,!0)})}}}}}))}createTitleArea(e){let t=super.createTitleArea(e);this._register((0,J.addDisposableListener)(t,J.EventType.CONTEXT_MENU,e=>{this.onTitleAreaContextMenu(new el.StandardMouseEvent((0,J.getWindow)(t),e))})),this._register(ed.Gesture.addTarget(t)),this._register((0,J.addDisposableListener)(t,ed.EventType.Contextmenu,e=>{this.onTitleAreaContextMenu(new el.StandardMouseEvent((0,J.getWindow)(t),e))}));let i=t.appendChild((0,J.$)(".global-actions"));return this.globalToolBar=this._register(this.instantiationService.createInstance(et.MenuWorkbenchToolBar,i,this.globalActionsMenuId,{actionViewItemProvider:(e,t)=>this.actionViewItemProvider(e,t),orientation:H.ActionsOrientation.HORIZONTAL,getKeyBinding:e=>this.keybindingService.lookupKeybinding(e.id),anchorAlignmentProvider:()=>this.getTitleAreaDropDownAnchorAlignment(),toggleMenuTitle:(0,a.localize)(3594,"More Actions..."),hoverDelegate:this.toolbarHoverDelegate,hiddenItemStrategy:et.HiddenItemStrategy.NoHide,highlightToggledItems:!0,telemetrySource:this.nameForTelemetry})),t}createTitleLabel(e){this.titleContainer=e;let t=super.createTitleLabel(e);this.titleLabelElement.draggable=!0;let i=()=>({type:"composite",id:this.getActivePaneComposite().getId()});return this._register(en.CompositeDragAndDropObserver.INSTANCE.registerDraggable(this.titleLabelElement,i,{})),t}updateCompositeBar(e=!1){let t,i=void 0!==this.compositeBarPosition,r=this.shouldShowCompositeBar(),s=this.compositeBarPosition,n=r?this.getCompositeBarPosition():void 0;if(e||s!==n){if(i){let e=s===o.TITLE?this.titleContainer:this.headerFooterCompositeBarContainer;if(!this.paneCompositeBarContainer||!this.paneCompositeBar.value||!e)throw Error("Composite bar containers should exist when removing the previous composite bar");this.paneCompositeBarContainer.remove(),this.paneCompositeBarContainer=void 0,this.paneCompositeBar.value=void 0,e.classList.remove("has-composite-bar"),s===o.TOP?this.removeFooterHeaderArea(!0):s===o.BOTTOM&&this.removeFooterHeaderArea(!1)}switch(n){case o.TOP:t=this.createHeaderArea();break;case o.TITLE:t=this.titleContainer;break;case o.BOTTOM:t=this.createFooterArea()}if(r){if(this.paneCompositeBarContainer||this.paneCompositeBar.value||!t)throw Error("Invalid composite bar state when creating the new composite bar");t.classList.add("has-composite-bar"),this.paneCompositeBarContainer=(0,J.prepend)(t,(0,J.$)(".composite-bar-container")),this.paneCompositeBar.value=this.createCompositeBar(),this.paneCompositeBar.value.create(this.paneCompositeBarContainer),n===o.TOP?this.setHeaderArea(t):n===o.BOTTOM&&this.setFooterArea(t)}this.compositeBarPosition=n,e&&this.layoutCompositeBar()}}createHeaderArea(){let e=super.createHeaderArea();return this.createHeaderFooterCompositeBarArea(e)}createFooterArea(){let e=super.createFooterArea();return this.createHeaderFooterCompositeBarArea(e)}createHeaderFooterCompositeBarArea(e){if(this.headerFooterCompositeBarContainer)throw Error("Header or Footer composite bar already exists");return this.headerFooterCompositeBarContainer=e,this.headerFooterCompositeBarDispoables.add((0,J.addDisposableListener)(e,J.EventType.CONTEXT_MENU,t=>{this.onCompositeBarAreaContextMenu(new el.StandardMouseEvent((0,J.getWindow)(e),t))})),this.headerFooterCompositeBarDispoables.add(ed.Gesture.addTarget(e)),this.headerFooterCompositeBarDispoables.add((0,J.addDisposableListener)(e,ed.EventType.Contextmenu,t=>{this.onCompositeBarAreaContextMenu(new el.StandardMouseEvent((0,J.getWindow)(e),t))})),e}removeFooterHeaderArea(e){this.headerFooterCompositeBarContainer=void 0,this.headerFooterCompositeBarDispoables.clear(),e?this.removeHeaderArea():this.removeFooterArea()}createCompositeBar(){return this.instantiationService.createInstance(es.PaneCompositeBar,this.getCompositeBarOptions(),this.partId,this)}onTitleAreaUpdate(e){super.onTitleAreaUpdate(e),this.layoutCompositeBar()}async openPaneComposite(e,t){return"string"==typeof e&&this.getPaneComposite(e)||(await this.extensionService.whenInstalledExtensionsRegistered(),"string"==typeof e&&this.getPaneComposite(e))?this.doOpenPaneComposite(e,t):void 0}async doOpenPaneComposite(e,t){let i;if(this.blockOpening)return this.blockOpening.p;if(!this.layoutService.isVisible(this.partId))try{i=this.blockOpening=new eh.DeferredPromise,this.layoutService.setPartHidden(!1,this.partId)}finally{this.blockOpening=void 0}try{let o=this.openComposite(e,t);return i?.complete(o),o}catch(e){throw i?.error(e),e}}getPaneComposite(e){return this.registry.getPaneComposite(e)}getPaneComposites(){return this.registry.getPaneComposites().sort((e,t)=>"number"!=typeof e.order?1:"number"!=typeof t.order?-1:e.order-t.order)}getPinnedPaneCompositeIds(){return this.paneCompositeBar.value?.getPinnedPaneCompositeIds()??[]}getVisiblePaneCompositeIds(){return this.paneCompositeBar.value?.getVisiblePaneCompositeIds()??[]}getPaneCompositeIds(){return this.paneCompositeBar.value?.getPaneCompositeIds()??[]}getActivePaneComposite(){return this.getActiveComposite()}getLastActivePaneCompositeId(){return this.getLastActiveCompositeId()}hideActivePaneComposite(){this.layoutService.isVisible(this.partId)&&this.layoutService.setPartHidden(!0,this.partId),this.hideActiveComposite()}focusCompositeBar(){this.paneCompositeBar.value?.focus()}layout(e,t,i,o){this.layoutService.isVisible(this.partId)&&(this.contentDimension=new J.Dimension(e,t),super.layout(this.contentDimension.width,this.contentDimension.height,i,o),this.layoutCompositeBar(),this.layoutEmptyMessage())}layoutCompositeBar(){if(this.contentDimension&&this.dimension&&this.paneCompositeBar.value){let e=this.compositeBarPosition===o.TITLE?16:8,t=+(this.partId!==w.Parts.PANEL_PART),r=this.contentDimension.width-e-t;r=Math.max(i.MIN_COMPOSITE_BAR_WIDTH,r-this.getToolbarWidth()),this.paneCompositeBar.value.layout(r,this.dimension.height)}}layoutEmptyMessage(e=!this.getActiveComposite()){this.element.classList.toggle("empty",e),e&&this.titleLabel?.updateTitle("","")}getToolbarWidth(){return this.toolBar&&this.compositeBarPosition===o.TITLE&&this.getActivePaneComposite()?this.toolBar.getItemsWidth()+4*this.toolBar.getItemsLength()+(this.globalToolBar?this.globalToolBar.getItemsWidth()+4*this.globalToolBar.getItemsLength():0)+8:0}onTitleAreaContextMenu(e){if(this.shouldShowCompositeBar()&&this.getCompositeBarPosition()===o.TITLE)return this.onCompositeBarContextMenu(e);{let t=this.getActivePaneComposite(),i=t?t.getContextMenuActions():[];i.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>i,getActionViewItem:(e,t)=>this.actionViewItemProvider(e,t),actionRunner:t.getActionRunner(),skipTelemetry:!0})}}onCompositeBarAreaContextMenu(e){return this.onCompositeBarContextMenu(e)}onCompositeBarContextMenu(e){if(this.paneCompositeBar.value){let t=[...this.paneCompositeBar.value.getContextMenuActions()];t.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>t,skipTelemetry:!0})}}getViewsSubmenuAction(){let e=this.getActivePaneComposite()?.getViewPaneContainer();if(e){let t=new z.DisposableStore,i=t.add(this.contextKeyService.createScoped(this.element));i.createKey("viewContainer",e.viewContainer.id);let o=this.menuService.getMenuActions(P.ViewsSubMenu,i,{shouldForwardArgs:!0,renderShortTitle:!0}),r=(0,Q.getActionBarActions)(o,()=>!0).primary;return t.dispose(),r.length>1&&r.some(e=>e.enabled)?new _.SubmenuAction("views",(0,a.localize)(3595,"Views"),r):void 0}}};eu=i=(0,n.__decorate)([(0,n.__param)(9,u.INotificationService),(0,n.__param)(10,p.IStorageService),(0,n.__param)(11,l.IContextMenuService),(0,n.__param)(12,f.IWorkbenchLayoutService),(0,n.__param)(13,h.IKeybindingService),(0,n.__param)(14,ec.IHoverService),(0,n.__param)(15,c.IInstantiationService),(0,n.__param)(16,m.IThemeService),(0,n.__param)(17,C.IViewDescriptorService),(0,n.__param)(18,d.IContextKeyService),(0,n.__param)(19,b.IExtensionService),(0,n.__param)(20,ea.IMenuService)],eu),e.s(["AbstractPaneCompositePart",0,eu,"CompositeBarPosition",0,o],391613);var ep=e.i(731931);(0,s.registerCss)(void 0);let eg=class extends eu{static{r=this}static{this.activeViewSettingsKey="workbench.auxiliarybar.activepanelid"}static{this.pinnedViewsKey="workbench.auxiliarybar.pinnedPanels"}static{this.placeholdeViewContainersKey="workbench.auxiliarybar.placeholderPanels"}static{this.viewContainersWorkspaceStateKey="workbench.auxiliarybar.viewContainersWorkspaceState"}get preferredHeight(){return .4*this.layoutService.mainContainerDimension.height}get preferredWidth(){let e=this.getActivePaneComposite();if(!e)return;let t=e.getOptimalWidth();if("number"==typeof t)return Math.max(t,300)}constructor(e,t,i,o,s,n,a,d,l,c,h,u,p,m){super(w.Parts.AUXILIARYBAR_PART,{hasTitle:!0,trailingSeparator:!0,borderWidth:()=>this.getColor(y.SIDE_BAR_BORDER)||this.getColor(g.contrastBorder)?1:0},r.activeViewSettingsKey,v.ActiveAuxiliaryContext.bindTo(c),v.AuxiliaryBarFocusContext.bindTo(c),"auxiliarybar","auxiliarybar",void 0,y.SIDE_BAR_TITLE_BORDER,e,t,i,o,s,n,a,d,l,c,h,p),this.commandService=u,this.configurationService=m,this.minimumWidth=170,this.maximumWidth=1/0,this.minimumHeight=0,this.maximumHeight=1/0,this.priority=D.LayoutPriority.Low,this.configuration=this.resolveConfiguration(),this._register(m.onDidChangeConfiguration(e=>{e.affectsConfiguration(w.LayoutSettings.ACTIVITY_BAR_LOCATION)?(this.configuration=this.resolveConfiguration(),this.onDidChangeActivityBarLocation()):e.affectsConfiguration("workbench.secondarySideBar.showLabels")&&(this.configuration=this.resolveConfiguration(),this.updateCompositeBar(!0))}))}resolveConfiguration(){let e=this.configurationService.getValue(w.LayoutSettings.ACTIVITY_BAR_LOCATION),t=e!==w.ActivityBarPosition.TOP&&e!==w.ActivityBarPosition.BOTTOM,i=t&&!1!==this.configurationService.getValue("workbench.secondarySideBar.showLabels");return{position:e,canShowLabels:t,showLabels:i}}onDidChangeActivityBarLocation(){this.updateCompositeBar();let e=this.getActiveComposite()?.getId();e&&this.onTitleAreaUpdate(e)}updateStyles(){super.updateStyles();let e=(0,I.assertReturnsDefined)(this.getContainer());e.style.backgroundColor=this.getColor(y.SIDE_BAR_BACKGROUND)||"";let t=this.getColor(y.SIDE_BAR_BORDER)||this.getColor(g.contrastBorder),i=this.layoutService.getSideBarPosition()===w.Position.RIGHT;e.style.color=this.getColor(y.SIDE_BAR_FOREGROUND)||"",e.style.borderLeftColor=t??"",e.style.borderRightColor=t??"",e.style.borderLeftStyle=t&&!i?"solid":"none",e.style.borderRightStyle=t&&i?"solid":"none",e.style.borderLeftWidth=t&&!i?"1px":"0px",e.style.borderRightWidth=t&&i?"1px":"0px"}getCompositeBarOptions(){let e=this;return{partContainerClass:"auxiliarybar",pinnedViewContainersKey:r.pinnedViewsKey,placeholderViewContainersKey:r.placeholdeViewContainersKey,viewContainersWorkspaceStateKey:r.viewContainersWorkspaceStateKey,icon:!this.configuration.showLabels,orientation:H.ActionsOrientation.HORIZONTAL,recomputeSizes:!0,activityHoverOptions:{position:()=>this.getCompositeBarPosition()===o.BOTTOM?S.HoverPosition.ABOVE:S.HoverPosition.BELOW},fillExtraContextMenuActions:e=>this.fillExtraContextMenuActions(e),compositeSize:0,iconSize:16,get overflowActionSize(){return e.getCompositeBarPosition()===o.TITLE?40:30},colors:t=>({activeBackgroundColor:t.getColor(y.SIDE_BAR_BACKGROUND),inactiveBackgroundColor:t.getColor(y.SIDE_BAR_BACKGROUND),get activeBorderBottomColor(){return e.getCompositeBarPosition()===o.TITLE?t.getColor(y.PANEL_ACTIVE_TITLE_BORDER):t.getColor(y.ACTIVITY_BAR_TOP_ACTIVE_BORDER)},get activeForegroundColor(){return e.getCompositeBarPosition()===o.TITLE?t.getColor(y.PANEL_ACTIVE_TITLE_FOREGROUND):t.getColor(y.ACTIVITY_BAR_TOP_FOREGROUND)},get inactiveForegroundColor(){return e.getCompositeBarPosition()===o.TITLE?t.getColor(y.PANEL_INACTIVE_TITLE_FOREGROUND):t.getColor(y.ACTIVITY_BAR_TOP_INACTIVE_FOREGROUND)},badgeBackground:t.getColor(y.ACTIVITY_BAR_BADGE_BACKGROUND),badgeForeground:t.getColor(y.ACTIVITY_BAR_BADGE_FOREGROUND),get dragAndDropBorder(){return e.getCompositeBarPosition()===o.TITLE?t.getColor(y.PANEL_DRAG_AND_DROP_BORDER):t.getColor(y.ACTIVITY_BAR_TOP_DRAG_AND_DROP_BORDER)}}),compact:!0}}fillExtraContextMenuActions(e){let t=this.layoutService.getSideBarPosition()===w.Position.LEFT;if(this.getCompositeBarPosition()===o.TITLE){let t=this.getViewsSubmenuAction();t&&(e.push(new _.Separator),e.push(t))}let i=this.menuService.getMenuActions(M.MenuId.ActivityBarPositionMenu,this.contextKeyService,{shouldForwardArgs:!0,renderShortTitle:!0}),r=(0,Q.getContextMenuActions)(i).secondary,s=(0,_.toAction)({id:"workbench.action.auxiliarybar.toggleShowLabels",label:this.configuration.showLabels?(0,a.localize)(3026,"Show Icons"):(0,a.localize)(3027,"Show Labels"),enabled:this.configuration.canShowLabels,run:()=>this.configurationService.updateValue("workbench.secondarySideBar.showLabels",!this.configuration.showLabels)});e.push(new _.Separator,new _.SubmenuAction("workbench.action.panel.position",(0,a.localize)(3028,"Activity Bar Position"),r),(0,_.toAction)({id:T.ToggleSidebarPositionAction.ID,label:t?(0,a.localize)(3029,"Move Secondary Side Bar Left"):(0,a.localize)(3030,"Move Secondary Side Bar Right"),run:()=>this.commandService.executeCommand(T.ToggleSidebarPositionAction.ID)}),s,(0,_.toAction)({id:E.ToggleAuxiliaryBarAction.ID,label:(0,a.localize)(3031,"Hide Secondary Side Bar"),run:()=>this.commandService.executeCommand(E.ToggleAuxiliaryBarAction.ID)}))}shouldShowCompositeBar(){return this.configuration.position!==w.ActivityBarPosition.HIDDEN}getCompositeBarPosition(){switch(this.configuration.position){case w.ActivityBarPosition.TOP:return o.TOP;case w.ActivityBarPosition.BOTTOM:return o.BOTTOM;case w.ActivityBarPosition.HIDDEN:case w.ActivityBarPosition.DEFAULT:default:return o.TITLE}}toJSON(){return{type:w.Parts.AUXILIARYBAR_PART}}};eg=r=(0,n.__decorate)([(0,n.__param)(0,u.INotificationService),(0,n.__param)(1,p.IStorageService),(0,n.__param)(2,l.IContextMenuService),(0,n.__param)(3,f.IWorkbenchLayoutService),(0,n.__param)(4,h.IKeybindingService),(0,n.__param)(5,ec.IHoverService),(0,n.__param)(6,c.IInstantiationService),(0,n.__param)(7,m.IThemeService),(0,n.__param)(8,C.IViewDescriptorService),(0,n.__param)(9,d.IContextKeyService),(0,n.__param)(10,b.IExtensionService),(0,n.__param)(11,A.ICommandService),(0,n.__param)(12,ea.IMenuService),(0,n.__param)(13,ep.IConfigurationService)],eg),e.s(["AuxiliaryBarPart",0,eg],244416)},410676,681874,e=>{"use strict";var t,i,o=e.i(654295),r=e.i(281482),s=e.i(650289),n=e.i(701898),a=e.i(32637),d=e.i(856884),l=e.i(536561),c=e.i(957994),h=e.i(140889),u=e.i(919101),p=e.i(84513),g=e.i(488259),m=e.i(694956),v=e.i(970672),y=e.i(428521);e.i(575129);var C=e.i(698014);e.i(140331),e.i(471999),e.i(900329),e.i(785266),e.i(181268),e.i(70177),e.i(575210),e.i(890787),e.i(67920);var b=e.i(975445),w=e.i(850887),f=e.i(9753),S=e.i(535567),_=e.i(981399),E=e.i(447186),I=e.i(93153),D=e.i(686380),T=e.i(94361),A=e.i(391613),x=e.i(846960),R=e.i(2301),k=e.i(487495),M=e.i(731931);(0,o.registerCss)(void 0);let L=class extends A.AbstractPaneCompositePart{static{t=this}get preferredHeight(){return .4*this.layoutService.mainContainerDimension.height}get preferredWidth(){let e=this.getActivePaneComposite();if(!e)return;let t=e.getOptimalWidth();if("number"==typeof t)return Math.max(t,300)}static{this.activePanelSettingsKey="workbench.panelpart.activepanelid"}constructor(e,i,o,r,s,n,a,c,h,u,p,g,m,v){super(l.Parts.PANEL_PART,{hasTitle:!0,trailingSeparator:!0},t.activePanelSettingsKey,d.ActivePanelContext.bindTo(u),d.PanelFocusContext.bindTo(u),"panel","panel",void 0,y.PANEL_TITLE_BORDER,e,i,o,r,s,n,a,c,h,u,p,m),this.commandService=g,this.configurationService=v,this.minimumWidth=300,this.maximumWidth=1/0,this.minimumHeight=77,this.maximumHeight=1/0,this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("workbench.panel.showLabels")&&this.updateCompositeBar(!0)}))}updateStyles(){super.updateStyles();let e=(0,S.assertReturnsDefined)(this.getContainer());e.style.backgroundColor=this.getColor(y.PANEL_BACKGROUND)||"";let t=this.getColor(y.PANEL_BORDER)||this.getColor(C.contrastBorder)||"";e.style.borderLeftColor=t,e.style.borderRightColor=t,e.style.borderBottomColor=t,this.titleArea&&(this.titleArea.style.borderTopColor=this.getColor(y.PANEL_BORDER)||this.getColor(C.contrastBorder)||"")}getCompositeBarOptions(){return{partContainerClass:"panel",pinnedViewContainersKey:"workbench.panel.pinnedPanels",placeholderViewContainersKey:"workbench.panel.placeholderPanels",viewContainersWorkspaceStateKey:"workbench.panel.viewContainersWorkspaceState",icon:!1===this.configurationService.getValue("workbench.panel.showLabels"),orientation:a.ActionsOrientation.HORIZONTAL,recomputeSizes:!0,activityHoverOptions:{position:()=>this.layoutService.getPanelPosition()!==l.Position.BOTTOM||this.layoutService.isPanelMaximized()?I.HoverPosition.BELOW:I.HoverPosition.ABOVE},fillExtraContextMenuActions:e=>this.fillExtraContextMenuActions(e),compositeSize:0,iconSize:16,compact:!0,overflowActionSize:44,colors:e=>({activeBackgroundColor:e.getColor(y.PANEL_BACKGROUND),inactiveBackgroundColor:e.getColor(y.PANEL_BACKGROUND),activeBorderBottomColor:e.getColor(y.PANEL_ACTIVE_TITLE_BORDER),activeForegroundColor:e.getColor(y.PANEL_ACTIVE_TITLE_FOREGROUND),inactiveForegroundColor:e.getColor(y.PANEL_INACTIVE_TITLE_FOREGROUND),badgeBackground:e.getColor(y.PANEL_TITLE_BADGE_BACKGROUND),badgeForeground:e.getColor(y.PANEL_TITLE_BADGE_FOREGROUND),dragAndDropBorder:e.getColor(y.PANEL_DRAG_AND_DROP_BORDER)})}}fillExtraContextMenuActions(e){if(this.getCompositeBarPosition()===A.CompositeBarPosition.TITLE){let t=this.getViewsSubmenuAction();t&&(e.push(new n.Separator),e.push(t))}let t=this.menuService.getMenuActions(D.MenuId.PanelPositionMenu,this.contextKeyService,{shouldForwardArgs:!0}),i=this.menuService.getMenuActions(D.MenuId.PanelAlignmentMenu,this.contextKeyService,{shouldForwardArgs:!0}),o=(0,R.getContextMenuActions)(t).secondary,r=(0,R.getContextMenuActions)(i).secondary,a=this.configurationService.getValue("workbench.panel.showLabels"),d=(0,n.toAction)({id:"workbench.action.panel.toggleShowLabels",label:a?(0,s.localize)(3632,"Show Icons"):(0,s.localize)(3633,"Show Labels"),run:()=>this.configurationService.updateValue("workbench.panel.showLabels",!a)});e.push(new n.Separator,new n.SubmenuAction("workbench.action.panel.position",(0,s.localize)(3634,"Panel Position"),o),new n.SubmenuAction("workbench.action.panel.align",(0,s.localize)(3635,"Align Panel"),r),d,(0,n.toAction)({id:m.TogglePanelAction.ID,label:(0,s.localize)(3636,"Hide Panel"),run:()=>this.commandService.executeCommand(m.TogglePanelAction.ID)}))}layout(e,t,i,o){let r;switch(this.layoutService.getPanelPosition()){case l.Position.RIGHT:r=new w.Dimension(e-1,t);break;case l.Position.TOP:r=new w.Dimension(e,t-1);break;default:r=new w.Dimension(e,t)}super.layout(r.width,r.height,i,o)}shouldShowCompositeBar(){return!0}getCompositeBarPosition(){return A.CompositeBarPosition.TITLE}toJSON(){return{type:l.Parts.PANEL_PART}}};L=t=(0,r.__decorate)([(0,r.__param)(0,b.INotificationService),(0,r.__param)(1,h.IStorageService),(0,r.__param)(2,u.IContextMenuService),(0,r.__param)(3,c.IWorkbenchLayoutService),(0,r.__param)(4,p.IKeybindingService),(0,r.__param)(5,k.IHoverService),(0,r.__param)(6,g.IInstantiationService),(0,r.__param)(7,v.IThemeService),(0,r.__param)(8,E.IViewDescriptorService),(0,r.__param)(9,f.IContextKeyService),(0,r.__param)(10,_.IExtensionService),(0,r.__param)(11,x.ICommandService),(0,r.__param)(12,T.IMenuService),(0,r.__param)(13,M.IConfigurationService)],L),e.s(["PanelPart",0,L],410676);var O=D,P=e.i(83823),V=e.i(718596),K=e.i(262072),N=e.i(34422),G=e.i(305063);(0,o.registerCss)(void 0),(0,O.registerAction2)(class extends O.Action2{constructor(){super({id:"workbench.action.closeSidebar",title:(0,s.localize2)(3637,"Close Primary Side Bar"),category:K.Categories.View,f1:!0,precondition:d.SideBarVisibleContext})}run(e){e.get(c.IWorkbenchLayoutService).setPartHidden(!0,l.Parts.SIDEBAR_PART)}});class F extends O.Action2{constructor(){super({id:"workbench.action.focusSideBar",title:(0,s.localize2)(3638,"Focus into Primary Side Bar"),category:K.Categories.View,f1:!0,keybinding:{weight:V.KeybindingWeight.WorkbenchContrib,when:null,primary:P.KeyMod.CtrlCmd|P.KeyCode.Digit0}})}async run(e){let t=e.get(c.IWorkbenchLayoutService),i=e.get(N.IPaneCompositePartService);t.isVisible(l.Parts.SIDEBAR_PART)||t.setPartHidden(!1,l.Parts.SIDEBAR_PART);let o=i.getActivePaneComposite(G.ViewContainerLocation.Sidebar);o?.focus()}}(0,O.registerAction2)(F);var W=e.i(701575),z=e.i(895737);e.i(523183);var B=A,U=e.i(786896),H=D,$=e.i(508267),q=e.i(976098);e.i(938676),(0,o.registerCss)(void 0);let Y=class extends B.AbstractPaneCompositePart{static{i=this}static{this.activeViewletSettingsKey="workbench.sidebar.activeviewletid"}get snap(){return!0}get preferredWidth(){let e=this.getActivePaneComposite();if(!e)return;let t=e.getOptimalWidth();if("number"==typeof t)return Math.max(t,300)}constructor(e,t,o,r,s,n,a,c,h,u,p,g,m){super(l.Parts.SIDEBAR_PART,{hasTitle:!0,trailingSeparator:!1,borderWidth:()=>this.getColor(y.SIDE_BAR_BORDER)||this.getColor(C.contrastBorder)?1:0},i.activeViewletSettingsKey,d.ActiveViewletContext.bindTo(u),d.SidebarFocusContext.bindTo(u),"sideBar","viewlet",y.SIDE_BAR_TITLE_FOREGROUND,y.SIDE_BAR_TITLE_BORDER,e,t,o,r,s,n,a,c,h,u,p,m),this.configurationService=g,this.minimumWidth=170,this.maximumWidth=1/0,this.minimumHeight=0,this.maximumHeight=1/0,this.priority=q.LayoutPriority.Low,this.activityBarPart=this._register(this.instantiationService.createInstance(U.ActivitybarPart,this)),this.rememberActivityBarVisiblePosition(),this._register(g.onDidChangeConfiguration(e=>{e.affectsConfiguration(l.LayoutSettings.ACTIVITY_BAR_LOCATION)&&this.onDidChangeActivityBarLocation()})),this.registerActions()}onDidChangeActivityBarLocation(){this.activityBarPart.hide(),this.updateCompositeBar();let e=this.getActiveComposite()?.getId();e&&this.onTitleAreaUpdate(e),this.shouldShowActivityBar()&&this.activityBarPart.show(),this.rememberActivityBarVisiblePosition()}updateStyles(){super.updateStyles();let e=(0,S.assertReturnsDefined)(this.getContainer());e.style.backgroundColor=this.getColor(y.SIDE_BAR_BACKGROUND)||"",e.style.color=this.getColor(y.SIDE_BAR_FOREGROUND)||"";let t=this.getColor(y.SIDE_BAR_BORDER)||this.getColor(C.contrastBorder),i=this.layoutService.getSideBarPosition()===l.Position.LEFT;e.style.borderRightWidth=t&&i?"1px":"",e.style.borderRightStyle=t&&i?"solid":"",e.style.borderRightColor=i&&t||"",e.style.borderLeftWidth=t&&!i?"1px":"",e.style.borderLeftStyle=t&&!i?"solid":"",e.style.borderLeftColor=!i&&t||"",e.style.outlineColor=this.getColor(y.SIDE_BAR_DRAG_AND_DROP_BACKGROUND)??""}layout(e,t,i,o){this.layoutService.isVisible(l.Parts.SIDEBAR_PART)&&super.layout(e,t,i,o)}getTitleAreaDropDownAnchorAlignment(){return this.layoutService.getSideBarPosition()===l.Position.LEFT?z.AnchorAlignment.LEFT:z.AnchorAlignment.RIGHT}createCompositeBar(){return this.instantiationService.createInstance(U.ActivityBarCompositeBar,this.getCompositeBarOptions(),this.partId,this,!1)}getCompositeBarOptions(){return{partContainerClass:"sidebar",pinnedViewContainersKey:U.ActivitybarPart.pinnedViewContainersKey,placeholderViewContainersKey:U.ActivitybarPart.placeholderViewContainersKey,viewContainersWorkspaceStateKey:U.ActivitybarPart.viewContainersWorkspaceStateKey,icon:!0,orientation:a.ActionsOrientation.HORIZONTAL,recomputeSizes:!0,activityHoverOptions:{position:()=>this.getCompositeBarPosition()===B.CompositeBarPosition.BOTTOM?I.HoverPosition.ABOVE:I.HoverPosition.BELOW},fillExtraContextMenuActions:e=>{if(this.getCompositeBarPosition()===B.CompositeBarPosition.TITLE){let t=this.getViewsSubmenuAction();t&&(e.push(new n.Separator),e.push(t))}},compositeSize:0,iconSize:16,overflowActionSize:30,colors:e=>({activeBackgroundColor:e.getColor(y.SIDE_BAR_BACKGROUND),inactiveBackgroundColor:e.getColor(y.SIDE_BAR_BACKGROUND),activeBorderBottomColor:e.getColor(y.ACTIVITY_BAR_TOP_ACTIVE_BORDER),activeForegroundColor:e.getColor(y.ACTIVITY_BAR_TOP_FOREGROUND),inactiveForegroundColor:e.getColor(y.ACTIVITY_BAR_TOP_INACTIVE_FOREGROUND),badgeBackground:e.getColor(y.ACTIVITY_BAR_BADGE_BACKGROUND),badgeForeground:e.getColor(y.ACTIVITY_BAR_BADGE_FOREGROUND),dragAndDropBorder:e.getColor(y.ACTIVITY_BAR_TOP_DRAG_AND_DROP_BORDER)}),compact:!0}}shouldShowCompositeBar(){let e=this.configurationService.getValue(l.LayoutSettings.ACTIVITY_BAR_LOCATION);return e===l.ActivityBarPosition.TOP||e===l.ActivityBarPosition.BOTTOM}shouldShowActivityBar(){return!this.shouldShowCompositeBar()&&this.configurationService.getValue(l.LayoutSettings.ACTIVITY_BAR_LOCATION)!==l.ActivityBarPosition.HIDDEN}getCompositeBarPosition(){switch(this.configurationService.getValue(l.LayoutSettings.ACTIVITY_BAR_LOCATION)){case l.ActivityBarPosition.TOP:return B.CompositeBarPosition.TOP;case l.ActivityBarPosition.BOTTOM:return B.CompositeBarPosition.BOTTOM;case l.ActivityBarPosition.HIDDEN:case l.ActivityBarPosition.DEFAULT:default:return B.CompositeBarPosition.TITLE}}rememberActivityBarVisiblePosition(){let e=this.configurationService.getValue(l.LayoutSettings.ACTIVITY_BAR_LOCATION);e!==l.ActivityBarPosition.HIDDEN&&this.storageService.store(l.LayoutSettings.ACTIVITY_BAR_LOCATION,e,W.StorageScope.PROFILE,W.StorageTarget.USER)}getRememberedActivityBarVisiblePosition(){switch(this.storageService.get(l.LayoutSettings.ACTIVITY_BAR_LOCATION,W.StorageScope.PROFILE)){case l.ActivityBarPosition.TOP:return l.ActivityBarPosition.TOP;case l.ActivityBarPosition.BOTTOM:return l.ActivityBarPosition.BOTTOM;default:return l.ActivityBarPosition.DEFAULT}}getPinnedPaneCompositeIds(){return this.shouldShowCompositeBar()?super.getPinnedPaneCompositeIds():this.activityBarPart.getPinnedPaneCompositeIds()}getVisiblePaneCompositeIds(){return this.shouldShowCompositeBar()?super.getVisiblePaneCompositeIds():this.activityBarPart.getVisiblePaneCompositeIds()}getPaneCompositeIds(){return this.shouldShowCompositeBar()?super.getPaneCompositeIds():this.activityBarPart.getPaneCompositeIds()}async focusActivityBar(){this.configurationService.getValue(l.LayoutSettings.ACTIVITY_BAR_LOCATION)===l.ActivityBarPosition.HIDDEN&&(await this.configurationService.updateValue(l.LayoutSettings.ACTIVITY_BAR_LOCATION,this.getRememberedActivityBarVisiblePosition()),this.onDidChangeActivityBarLocation()),this.shouldShowCompositeBar()?this.focusCompositeBar():(this.layoutService.isVisible(l.Parts.ACTIVITYBAR_PART)||this.layoutService.setPartHidden(!1,l.Parts.ACTIVITYBAR_PART),this.activityBarPart.show(!0))}registerActions(){let e=this;this._register((0,H.registerAction2)(class extends H.Action2{constructor(){super({id:$.ToggleActivityBarVisibilityActionId,title:(0,s.localize2)(3639,"Toggle Activity Bar Visibility")})}run(){let t=e.configurationService.getValue(l.LayoutSettings.ACTIVITY_BAR_LOCATION)===l.ActivityBarPosition.HIDDEN?e.getRememberedActivityBarVisiblePosition():l.ActivityBarPosition.HIDDEN;return e.configurationService.updateValue(l.LayoutSettings.ACTIVITY_BAR_LOCATION,t)}}))}toJSON(){return{type:l.Parts.SIDEBAR_PART}}};Y=i=(0,r.__decorate)([(0,r.__param)(0,b.INotificationService),(0,r.__param)(1,h.IStorageService),(0,r.__param)(2,u.IContextMenuService),(0,r.__param)(3,c.IWorkbenchLayoutService),(0,r.__param)(4,p.IKeybindingService),(0,r.__param)(5,k.IHoverService),(0,r.__param)(6,g.IInstantiationService),(0,r.__param)(7,v.IThemeService),(0,r.__param)(8,E.IViewDescriptorService),(0,r.__param)(9,f.IContextKeyService),(0,r.__param)(10,_.IExtensionService),(0,r.__param)(11,M.IConfigurationService),(0,r.__param)(12,T.IMenuService)],Y),e.s(["SidebarPart",0,Y],681874)},900340,737233,336166,558364,988198,979534,728489,199466,113535,211748,602731,139359,e=>{"use strict";var t,i,o,r,s,n,a,d,l,c,h,u,p,g,m,v,y,C,b,w,f=e.i(281482),S=e.i(650289),_=e.i(1391),E=e.i(488259),I=e.i(781808),D=e.i(611130),T=e.i(970672),A=e.i(292663),x=e.i(850887);e.i(575129);var R=e.i(698014);e.i(140331);var k=e.i(471999);e.i(900329),e.i(785266),e.i(181268),e.i(70177),e.i(575210),e.i(890787),e.i(67920);var M=e.i(523183),L=e.i(193391),O=e.i(428521),P=e.i(454514),V=e.i(597556),K=e.i(654295),N=e.i(47635),G=e.i(856884),F=e.i(460096),W=e.i(299051),z=e.i(9753),B=e.i(555322),U=e.i(388064),H=e.i(770326),$=D,q=e.i(621826),Y=e.i(957994),j=e.i(34487),X=e.i(927842),J=e.i(535567),Z=e.i(168363),Q=e.i(693205),ee=e.i(739942),et=e.i(536766),ei=e.i(46373),eo=e.i(920042),er=e.i(140889),es=e.i(846960),en=e.i(578953),ea=e.i(399362),ed=e.i(16046),el=e.i(93114),ec=e.i(984004),eh=e.i(490819),eu=e.i(815378),ep=e.i(841203),eg=e.i(203037);class em{constructor(e){this._container=e}set text(e){(0,x.reset)(this._container,...(0,eg.renderLabelWithIcons)(e??""))}set title(e){!this.hover&&e?this.hover=(0,eu.getBaseLayerHoverDelegate)().setupManagedHover((0,ep.getDefaultHoverDelegate)("mouse"),this._container,e):this.hover&&this.hover.update(e)}dispose(){this.hover?.dispose()}}e.s(["SimpleIconLabel",0,em],737233);var ev=e.i(652731),ey=e.i(553638),eC=e.i(431110),eb=e.i(324726),ew=e.i(753062);(0,K.registerCss)(void 0);let ef=class extends ee.EditorPane{static{t=this}static{this.PLACEHOLDER_LABEL_MAX_LENGTH=1024}constructor(e,t,i,o,r){super(e,t,i,o,r),this.inputDisposable=this._register(new D.MutableDisposable)}createEditor(e){this.container=(0,x.$)(".monaco-editor-pane-placeholder",{tabIndex:0}),this.container.style.outline="none",this.scrollbar=this._register(new ei.DomScrollableElement(this.container,{horizontal:eo.ScrollbarVisibility.Auto,vertical:eo.ScrollbarVisibility.Auto})),e.appendChild(this.scrollbar.getDomNode())}async setInput(e,t,i,o){await super.setInput(e,t,i,o),o.isCancellationRequested||(this.inputDisposable.value=await this.renderInput(e,t))}async renderInput(e,i){let[o,r]=(0,J.assertReturnsAllDefined)(this.container,this.scrollbar);(0,x.clearNode)(o);let s=new D.DisposableStore,{icon:n,label:a,actions:d}=await this.getContents(e,i,s),l=(0,Q.truncate)(a,t.PLACEHOLDER_LABEL_MAX_LENGTH),c=o.appendChild((0,x.$)(".editor-placeholder-icon-container"));s.add(new em(c)).text=n;let h=o.appendChild((0,x.$)(".editor-placeholder-label-container")),u=(0,x.$)("span");if(u.textContent=l,h.appendChild(u),o.setAttribute("aria-label",`${(0,el.computeEditorAriaLabel)(e,void 0,this.group,void 0)}, ${l}`),d.length){let e=o.appendChild((0,x.$)(".editor-placeholder-buttons-container")),t=s.add(new ec.ButtonBar(e));for(let e=0;e<d.length;e++){let i=s.add(t.addButton({...eh.defaultButtonStyles,secondary:0!==e}));i.label=d[e].label,s.add(i.onDidClick(t=>{t&&x.EventHelper.stop(t,!0),d[e].run()}))}}return r.scanDomNode(),s}clearInput(){this.container&&(0,x.clearNode)(this.container),this.inputDisposable.clear(),super.clearInput()}layout(e){let[t,i]=(0,J.assertReturnsAllDefined)(this.container,this.scrollbar);(0,x.size)(t,e.width,e.height),i.scanDomNode(),t.classList.toggle("max-height-200px",e.height<=200)}focus(){super.focus(),this.container?.focus()}dispose(){this.container?.remove(),super.dispose()}};ef=t=(0,f.__decorate)([(0,f.__param)(2,et.ITelemetryService),(0,f.__param)(3,T.IThemeService),(0,f.__param)(4,er.IStorageService)],ef);let eS=class extends ef{static{i=this}static{this.ID="workbench.editors.workspaceTrustRequiredEditor"}static{this.LABEL=(0,S.localize)(3429,"Workspace Trust Required")}static{this.DESCRIPTOR=el.EditorPaneDescriptor.create(this,this.ID,this.LABEL)}constructor(e,t,o,r,s,n){super(i.ID,e,t,o,n),this.commandService=r,this.workspaceService=s}getTitle(){return i.LABEL}async getContents(){return{icon:"$(workspace-untrusted)",label:(0,en.isSingleFolderWorkspaceIdentifier)((0,en.toWorkspaceIdentifier)(this.workspaceService.getWorkspace()))?(0,S.localize)(3430,"The file is not displayed in the editor because trust has not been granted to the folder."):(0,S.localize)(3431,"The file is not displayed in the editor because trust has not been granted to the workspace."),actions:[{label:(0,S.localize)(3432,"Manage Workspace Trust"),run:()=>this.commandService.executeCommand("workbench.trust.manage")}]}}};eS=i=(0,f.__decorate)([(0,f.__param)(1,et.ITelemetryService),(0,f.__param)(2,T.IThemeService),(0,f.__param)(3,es.ICommandService),(0,f.__param)(4,ea.IWorkspaceContextService),(0,f.__param)(5,er.IStorageService)],eS);let e_=class extends ef{static{o=this}static{this.ID="workbench.editors.errorEditor"}static{this.LABEL=(0,S.localize)(3433,"Error Editor")}static{this.DESCRIPTOR=el.EditorPaneDescriptor.create(this,this.ID,this.LABEL)}constructor(e,t,i,r,s,n,a){super(o.ID,e,t,i,r),this.fileService=s,this.dialogService=n,this.commandService=a}async getContents(e,t,i){let o,r,s=e.resource,n=t.error,a=n?.fileOperationResult===ev.FileOperationResult.FILE_NOT_FOUND;o=a?(0,S.localize)(3434,"The editor could not be opened because the file was not found."):(0,L.isEditorOpenError)(n)&&n.forceMessage?n.message:n?(0,S.localize)(3435,"The editor could not be opened due to an unexpected error. Please consult the log for more details."):(0,S.localize)(3436,"The editor could not be opened due to an unexpected error.");let d="$(error)";return(0,L.isEditorOpenError)(n)&&(n.forceSeverity===H.default.Info?d="$(info)":n.forceSeverity===H.default.Warning&&(d="$(warning)")),r=(0,L.isEditorOpenError)(n)&&n.actions.length>0?n.actions.map(e=>({label:e.label,run:()=>{let t=e.run();t instanceof Promise&&t.catch(e=>this.dialogService.error((0,eC.toErrorMessage)(e)))}})):[{label:(0,S.localize)(3437,"Try Again"),run:()=>this.group.openEditor(e,{...t,source:ed.EditorOpenSource.USER})},{label:(0,S.localize)(3438,"Show Logs"),run:()=>this.commandService.executeCommand(ew.showWindowLogActionId)}],a&&s&&this.fileService.hasProvider(s)&&i.add(this.fileService.onDidFilesChange(i=>{i.contains(s,ev.FileChangeType.ADDED,ev.FileChangeType.UPDATED)&&this.group.openEditor(e,t)})),{icon:d,label:o,actions:r??[]}}};e_=o=(0,f.__decorate)([(0,f.__param)(1,et.ITelemetryService),(0,f.__param)(2,T.IThemeService),(0,f.__param)(3,er.IStorageService),(0,f.__param)(4,ey.IFileService),(0,f.__param)(5,eb.IDialogService),(0,f.__param)(6,es.ICommandService)],e_),e.s(["EditorPlaceholder",0,ef,"ErrorPlaceholderEditor",0,e_,"WorkspaceTrustRequiredPlaceholderEditor",0,eS],336166);var eE=e.i(619122),eI=e.i(853457),eD=e.i(74304);let eT=class extends $.Disposable{get minimumWidth(){return this._activeEditorPane?.minimumWidth??V.DEFAULT_EDITOR_MIN_DIMENSIONS.width}get minimumHeight(){return this._activeEditorPane?.minimumHeight??V.DEFAULT_EDITOR_MIN_DIMENSIONS.height}get maximumWidth(){return this._activeEditorPane?.maximumWidth??V.DEFAULT_EDITOR_MAX_DIMENSIONS.width}get maximumHeight(){return this._activeEditorPane?.maximumHeight??V.DEFAULT_EDITOR_MAX_DIMENSIONS.height}get activeEditorPane(){return this._activeEditorPane}constructor(e,t,i,o,r,s,n,a,d,l){super(),this.editorGroupParent=e,this.editorPanesParent=t,this.groupView=i,this.layoutService=o,this.instantiationService=r,this.workspaceTrustService=n,this.logService=a,this.dialogService=d,this.hostService=l,this._onDidFocus=this._register(new I.Emitter),this.onDidFocus=this._onDidFocus.event,this._onDidChangeSizeConstraints=this._register(new I.Emitter),this.onDidChangeSizeConstraints=this._onDidChangeSizeConstraints.event,this._activeEditorPane=null,this.editorPanes=[],this.mapEditorPaneToPendingSetInput=new Map,this.activeEditorPaneDisposables=this._register(new $.DisposableStore),this.editorPanesRegistry=q.Registry.as(L.EditorExtensions.EditorPane),this.editorOperation=this._register(new j.LongRunningOperation(s)),this.registerListeners()}registerListeners(){this._register(this.workspaceTrustService.onDidChangeTrust(()=>this.onDidChangeWorkspaceTrust()))}onDidChangeWorkspaceTrust(){let e=this._activeEditorPane?.input,t=this._activeEditorPane?.options;e?.hasCapability(L.EditorInputCapabilities.RequiresTrust)&&this.groupView.openEditor(e,t)}async openEditor(e,t,i,o=Object.create(null)){try{return await this.doOpenEditor(this.getEditorPaneDescriptor(e),e,t,i,o)}catch(r){if(t?.ignoreError)return{error:r};return this.doShowError(r,e,t,i,o)}}async doShowError(e,t,i,o,r){this.logService.error(e);let s=!1;if(i?.source===ed.EditorOpenSource.USER&&(!(0,L.isEditorOpenError)(e)||e.allowDialog)&&(s=await this.doShowErrorDialog(e,t)),s)return{error:e};let n={...i};return(0,eE.isCancellationError)(e)||(n.error=e),{...await this.doOpenEditor(e_.DESCRIPTOR,t,n,o,r),error:e}}async doShowErrorDialog(e,t){let i,o,r,s=H.default.Error,n=(0,eC.toErrorMessage)(e);(0,L.isEditorOpenError)(e)&&(o=e.actions,s=e.forceSeverity??H.default.Error,e.forceMessage&&(i=e.message,n=void 0)),i||(i=(0,S.localize)(3426,"Unable to open '{0}'",t.getName()));let a=[];if(o&&o.length>0)for(let e of o)a.push({label:e.label,run:()=>e});else a.push({label:(0,S.localize)(3427,"&&OK"),run:()=>void 0});1===a.length&&(r={run:()=>{d=!0}});let d=!1,{result:l}=await this.dialogService.prompt({type:s,message:i,detail:n,buttons:a,cancelButton:r});if(l){let e=l.run();e instanceof Promise&&e.catch(e=>this.dialogService.error((0,eC.toErrorMessage)(e))),d=!0}return d}async doOpenEditor(e,t,i,o,r=Object.create(null)){let s=this.doShowEditorPane(e),n=(0,x.getActiveElement)(),{changed:a,cancelled:d}=await this.doSetInput(s,t,i,r);return!d&&(!i?.preserveFocus&&this.shouldRestoreFocus(n)?s.focus():o?.preserveWindowOrder||this.hostService.moveTop((0,x.getWindowById)(this.groupView.windowId,!0).window)),{pane:s,changed:a,cancelled:d}}shouldRestoreFocus(e){if(!this.layoutService.isRestored()||!e)return!0;let t=(0,x.getActiveElement)();return!!(!t||t===e.ownerDocument.body||e===t||!(0,x.isEditableElement)(t)||(0,x.isAncestor)(t,this.editorGroupParent))}getEditorPaneDescriptor(e){return e.hasCapability(L.EditorInputCapabilities.RequiresTrust)&&!this.workspaceTrustService.isWorkspaceTrusted()?eS.DESCRIPTOR:(0,J.assertReturnsDefined)(this.editorPanesRegistry.getEditorPane(e))}doShowEditorPane(e){if(this._activeEditorPane&&e.describes(this._activeEditorPane))return this._activeEditorPane;this.doHideActiveEditorPane();let t=this.doCreateEditorPane(e);this.doSetActiveEditorPane(t);let i=(0,J.assertReturnsDefined)(t.getContainer());return this.editorPanesParent.appendChild(i),(0,x.show)(i),t.setVisible(!0),this.pagePosition&&t.layout(new x.Dimension(this.pagePosition.width,this.pagePosition.height),{top:this.pagePosition.top,left:this.pagePosition.left}),this.boundarySashes&&t.setBoundarySashes(this.boundarySashes),t}doCreateEditorPane(e){let t=this.doInstantiateEditorPane(e);if(!t.getContainer()){let e=(0,x.$)(".editor-instance");this.editorPanesParent.appendChild(e);try{t.create(e)}catch(t){throw e.remove(),(0,x.hide)(e),t}}return t}doInstantiateEditorPane(e){let t=this.editorPanes.find(t=>e.describes(t));if(t)return t;let i=this._register(e.instantiate(this.instantiationService,this.groupView));return this.editorPanes.push(i),i}doSetActiveEditorPane(e){this._activeEditorPane=e,this.activeEditorPaneDisposables.clear(),e&&(this.activeEditorPaneDisposables.add(e.onDidChangeSizeConstraints(e=>this._onDidChangeSizeConstraints.fire(e))),this.activeEditorPaneDisposables.add(e.onDidFocus(()=>this._onDidFocus.fire()))),this._onDidChangeSizeConstraints.fire(void 0)}async doSetInput(e,t,i,o){let r=e.input?.matches(t);if(r&&!i?.forceReload)return this.mapEditorPaneToPendingSetInput.has(e)&&await this.mapEditorPaneToPendingSetInput.get(e),(r=e.input?.matches(t))&&e.setOptions(i),{changed:!1,cancelled:!r};let s=this.editorOperation.start(this.layoutService.isRestored()?800:3200),n=!1;try{e.clearInput();let r=e.setInput(t,i,o,s.token);this.mapEditorPaneToPendingSetInput.set(e,r),await r,s.isCurrent()||(n=!0)}catch(e){if(s.isCurrent())throw e;n=!0}finally{s.isCurrent()&&this.mapEditorPaneToPendingSetInput.delete(e),s.stop()}return{changed:!r,cancelled:n}}doHideActiveEditorPane(){if(!this._activeEditorPane)return;this.editorOperation.stop(),this.safeRun(()=>this._activeEditorPane?.clearInput()),this.safeRun(()=>this._activeEditorPane?.setVisible(!1)),this.mapEditorPaneToPendingSetInput.delete(this._activeEditorPane);let e=this._activeEditorPane.getContainer();e&&(e.remove(),(0,x.hide)(e)),this.doSetActiveEditorPane(null)}closeEditor(e){this._activeEditorPane?.input&&e.matches(this._activeEditorPane.input)&&this.doHideActiveEditorPane()}setVisible(e){this.safeRun(()=>this._activeEditorPane?.setVisible(e))}layout(e){this.pagePosition=e,this.safeRun(()=>this._activeEditorPane?.layout(new x.Dimension(e.width,e.height),e))}setBoundarySashes(e){this.boundarySashes=e,this.safeRun(()=>this._activeEditorPane?.setBoundarySashes(e))}safeRun(e){try{e()}catch(e){this.logService.error(e)}}};eT=(0,f.__decorate)([(0,f.__param)(3,Y.IWorkbenchLayoutService),(0,f.__param)(4,E.IInstantiationService),(0,f.__param)(5,X.IEditorProgressService),(0,f.__param)(6,Z.IWorkspaceTrustManagementService),(0,f.__param)(7,eI.ILogService),(0,f.__param)(8,eb.IDialogService),(0,f.__param)(9,eD.IHostService)],eT);var eA=e.i(396195),ex=e.i(590746),eR=e.i(660284),ek=e.i(32637),eM=e.i(84513),eL=e.i(686380),eO=e.i(94361),eP=e.i(828318),eV=e.i(2301),eK=e.i(919101),eN=e.i(362361),eG=e.i(182504),eF=e.i(642897),eW=e.i(693162),ez=e.i(702320),eB=e.i(240159),eU=e.i(836545),eH=e.i(951129),e$=e.i(802136),eq=e.i(474320),eY=e.i(354244),ej=e.i(620943),eX=e.i(413003),eJ=D,eZ=e.i(318581),eQ=e.i(731931),e0=e.i(568101),e1=e.i(701575);let e2=e0.ContextKeyExpr.and(e0.ContextKeyExpr.equals("chatSetupHidden",!1),e0.ContextKeyExpr.equals("chatSetupDisabled",!1)),e3={text:(0,S.localize)(3414,"Open Chat"),id:"workbench.action.chat.open",when:{native:e2,web:e2}},e5={text:(0,S.localize)(3415,"Show All Commands"),id:"workbench.action.showCommands"},e6={text:(0,S.localize)(3416,"Go to File"),id:"workbench.action.quickOpen"},e4={text:(0,S.localize)(3417,"Open File"),id:"workbench.action.files.openFile"},e9={text:(0,S.localize)(3418,"Open Folder"),id:"workbench.action.files.openFolder"},e8={text:(0,S.localize)(3419,"Open File or Folder"),id:"workbench.action.files.openFileFolder"},e7={text:(0,S.localize)(3420,"Open Recent"),id:"workbench.action.openRecent"},te={text:(0,S.localize)(3421,"New Untitled Text File"),id:"workbench.action.files.newUntitledFile"},tt={text:(0,S.localize)(3422,"Find in Files"),id:"workbench.action.findInFiles"},ti={text:(0,S.localize)(3423,"Toggle Terminal"),id:"workbench.action.terminal.toggleTerminal",when:{web:e0.ContextKeyExpr.equals("terminalProcessSupported",!0)}},to={text:(0,S.localize)(3424,"Start Debugging"),id:"workbench.action.debug.start",when:{web:e0.ContextKeyExpr.equals("terminalProcessSupported",!0)}},tr={text:(0,S.localize)(3425,"Open Settings"),id:"workbench.action.openSettings"},ts=[e3,e5],tn=(0,P.coalesce)([...ts,...eY.isMacintosh&&!eY.isWeb?[e8]:[e4,e9],e7,eY.isMacintosh&&!eY.isWeb?te:void 0]),ta=[...ts],td=[e6,tt,to,ti,tr],tl=class extends eJ.Disposable{static{r=this}static{this.CACHED_WHEN="editorGroupWatermark.whenConditions"}static{this.SETTINGS_KEY="workbench.tips.enabled"}static{this.MINIMUM_ENTRIES=3}constructor(e,t,i,o,s,n){super(),this.keybindingService=t,this.contextService=i,this.contextKeyService=o,this.configurationService=s,this.storageService=n,this.transientDisposables=this._register(new eJ.DisposableStore),this.keybindingLabels=this._register(new eJ.DisposableStore),this.enabled=!1,this.cachedWhen=this.storageService.getObject(r.CACHED_WHEN,e1.StorageScope.PROFILE,Object.create(null)),this.workbenchState=this.contextService.getWorkbenchState();const a=(0,x.h)(".editor-group-watermark",[(0,x.h)(".watermark-container",[(0,x.h)(".letterpress"),(0,x.h)(".shortcuts@shortcuts")])]);(0,x.append)(e,a.root),this.shortcuts=a.shortcuts,this.registerListeners(),this.render()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(r.SETTINGS_KEY)&&this.enabled!==this.configurationService.getValue(r.SETTINGS_KEY)&&this.render()})),this._register(this.contextService.onDidChangeWorkbenchState(e=>{this.workbenchState!==e&&(this.workbenchState=e,this.render())})),this._register(this.storageService.onWillSaveState(e=>{if(e.reason===e1.WillSaveStateReason.SHUTDOWN){for(let e of[...tn,...ta,...td]){let t=eY.isWeb?e.when?.web:e.when?.native;t&&(this.cachedWhen[e.id]=this.contextKeyService.contextMatchesRules(t))}this.storageService.store(r.CACHED_WHEN,JSON.stringify(this.cachedWhen),e1.StorageScope.PROFILE,e1.StorageTarget.MACHINE)}}))}render(){if(this.enabled=this.configurationService.getValue(r.SETTINGS_KEY),(0,x.clearNode)(this.shortcuts),this.transientDisposables.clear(),!this.enabled)return;let e=this.filterEntries(this.workbenchState!==en.WorkbenchState.EMPTY?ta:tn);if(e.length<r.MINIMUM_ENTRIES){let t=this.filterEntries(td);(0,P.shuffle)(t),e.push(...t.slice(0,r.MINIMUM_ENTRIES-e.length))}let t=(0,x.append)(this.shortcuts,(0,x.$)(".watermark-box")),i=()=>{for(let i of((0,x.clearNode)(t),this.keybindingLabels.clear(),e)){let e=this.keybindingService.lookupKeybinding(i.id);if(!e)continue;let o=(0,x.append)(t,(0,x.$)("dl"));(0,x.append)(o,(0,x.$)("dt")).textContent=i.text;let r=(0,x.append)(o,(0,x.$)("dd"));this.keybindingLabels.add(new eX.KeybindingLabel(r,eY.OS,{renderUnboundKeybindings:!0,...eh.defaultKeybindingLabelStyles})).set(e)}};i(),this.transientDisposables.add(this.keybindingService.onDidUpdateKeybindings(i))}filterEntries(e){return e.filter(e=>{if(this.cachedWhen[e.id])return!0;let t=eY.isWeb?e.when?.web:e.when?.native;return!t||this.contextKeyService.contextMatchesRules(t)}).filter(e=>!!eZ.CommandsRegistry.getCommand(e.id)).filter(e=>!!this.keybindingService.lookupKeybinding(e.id))}};tl=r=(0,f.__decorate)([(0,f.__param)(1,eM.IKeybindingService),(0,f.__param)(2,ea.IWorkspaceContextService),(0,f.__param)(3,z.IContextKeyService),(0,f.__param)(4,eQ.IConfigurationService),(0,f.__param)(5,er.IStorageService)],tl);var tc=U,th=e.i(254576),tu=e.i(325438),tp=e.i(536367);(0,K.registerCss)(void 0);class tg{}class tm{constructor(e,t,i=eo.ScrollbarVisibility.Auto,o,r){this._disposables=new D.DisposableStore,this._onDidSelectItem=new I.Emitter,this._onDidFocusItem=new I.Emitter,this._onDidChangeFocus=new I.Emitter,this.onDidSelectItem=this._onDidSelectItem.event,this.onDidFocusItem=this._onDidFocusItem.event,this.onDidChangeFocus=this._onDidChangeFocus.event,this._items=[],this._nodes=[],this._freeNodes=[],this._enabled=!0,this._focusedItemIdx=-1,this._selectedItemIdx=-1,this._domNode=(0,x.createElement)("div"),this._domNode.className="monaco-breadcrumbs",this._domNode.tabIndex=0,this._domNode.setAttribute("role","list"),this._scrollable=new ei.DomScrollableElement(this._domNode,{vertical:eo.ScrollbarVisibility.Hidden,horizontal:i,horizontalScrollbarSize:t,useShadows:!1,scrollYToX:!0}),this._separatorIcon=o,this._disposables.add(this._scrollable),this._disposables.add((0,x.addStandardDisposableListener)(this._domNode,"click",e=>this._onClick(e))),e.appendChild(this._scrollable.getDomNode());const s=(0,tu.createStyleSheet)(this._domNode);this._style(s,r);const n=(0,x.trackFocus)(this._domNode);this._disposables.add(n),this._disposables.add(n.onDidBlur(e=>this._onDidChangeFocus.fire(!1))),this._disposables.add(n.onDidFocus(e=>this._onDidChangeFocus.fire(!0)))}setHorizontalScrollbarSize(e){this._scrollable.updateOptions({horizontalScrollbarSize:e})}setHorizontalScrollbarVisibility(e){this._scrollable.updateOptions({horizontal:e})}dispose(){this._disposables.dispose(),this._pendingLayout?.dispose(),this._pendingDimLayout?.dispose(),this._onDidSelectItem.dispose(),this._onDidFocusItem.dispose(),this._onDidChangeFocus.dispose(),this._domNode.remove(),this._nodes.length=0,this._freeNodes.length=0}layout(e){e&&x.Dimension.equals(e,this._dimension)||(e?(this._pendingDimLayout?.dispose(),this._pendingDimLayout=this._updateDimensions(e)):(this._pendingLayout?.dispose(),this._pendingLayout=this._updateScrollbar()))}_updateDimensions(e){let t=new D.DisposableStore;return t.add((0,x.modify)((0,x.getWindow)(this._domNode),()=>{this._dimension=e,this._domNode.style.width=`${e.width}px`,this._domNode.style.height=`${e.height}px`,t.add(this._updateScrollbar())})),t}_updateScrollbar(){return(0,x.measure)((0,x.getWindow)(this._domNode),()=>{(0,x.measure)((0,x.getWindow)(this._domNode),()=>{this._scrollable.setRevealOnScroll(!1),this._scrollable.scanDomNode(),this._scrollable.setRevealOnScroll(!0)})})}_style(e,t){let i="";t.breadcrumbsBackground&&(i+=`.monaco-breadcrumbs { background-color: ${t.breadcrumbsBackground}}`),t.breadcrumbsForeground&&(i+=`.monaco-breadcrumbs .monaco-breadcrumb-item { color: ${t.breadcrumbsForeground}}
10
+ `),t.breadcrumbsFocusForeground&&(i+=`.monaco-breadcrumbs .monaco-breadcrumb-item.focused { color: ${t.breadcrumbsFocusForeground}}
11
+ `),t.breadcrumbsFocusAndSelectionForeground&&(i+=`.monaco-breadcrumbs .monaco-breadcrumb-item.focused.selected { color: ${t.breadcrumbsFocusAndSelectionForeground}}
12
+ `),t.breadcrumbsHoverForeground&&(i+=`.monaco-breadcrumbs:not(.disabled ) .monaco-breadcrumb-item:hover:not(.focused):not(.selected) { color: ${t.breadcrumbsHoverForeground}}
13
+ `),e.textContent=i}setEnabled(e){this._enabled=e,this._domNode.classList.toggle("disabled",!this._enabled)}domFocus(){let e=this._focusedItemIdx>=0?this._focusedItemIdx:this._items.length-1;e>=0&&e<this._items.length?this._focus(e,void 0):this._domNode.focus()}isDOMFocused(){return(0,x.isAncestorOfActiveElement)(this._domNode)}getFocused(){return this._items[this._focusedItemIdx]}setFocused(e,t){this._focus(this._items.indexOf(e),t)}focusPrev(e){this._focusedItemIdx>0&&this._focus(this._focusedItemIdx-1,e)}focusNext(e){this._focusedItemIdx+1<this._nodes.length&&this._focus(this._focusedItemIdx+1,e)}_focus(e,t){this._focusedItemIdx=-1;for(let t=0;t<this._nodes.length;t++){let i=this._nodes[t];t!==e?i.classList.remove("focused"):(this._focusedItemIdx=t,i.classList.add("focused"),i.focus())}this._reveal(this._focusedItemIdx,!0),this._onDidFocusItem.fire({type:"focus",item:this._items[this._focusedItemIdx],node:this._nodes[this._focusedItemIdx],payload:t})}reveal(e){let t=this._items.indexOf(e);t>=0&&this._reveal(t,!1)}revealLast(){this._reveal(this._items.length-1,!1)}_reveal(e,t){if(e<0||e>=this._nodes.length)return;let i=this._nodes[e];if(!i)return;let{width:o}=this._scrollable.getScrollDimensions(),{scrollLeft:r}=this._scrollable.getScrollPosition();(!t||i.offsetLeft>r+o||i.offsetLeft<r)&&(this._scrollable.setRevealOnScroll(!1),this._scrollable.setScrollPosition({scrollLeft:i.offsetLeft}),this._scrollable.setRevealOnScroll(!0))}getSelection(){return this._items[this._selectedItemIdx]}setSelection(e,t){this._select(this._items.indexOf(e),t)}_select(e,t){this._selectedItemIdx=-1;for(let t=0;t<this._nodes.length;t++){let i=this._nodes[t];t!==e?i.classList.remove("selected"):(this._selectedItemIdx=t,i.classList.add("selected"))}this._onDidSelectItem.fire({type:"select",item:this._items[this._selectedItemIdx],node:this._nodes[this._selectedItemIdx],payload:t})}getItems(){return this._items}setItems(e){let t,i=[];try{t=(0,P.commonPrefixLength)(this._items,e,(e,t)=>e.equals(t)),i=this._items.splice(t,this._items.length-t,...e.slice(t)),this._render(t),(0,D.dispose)(i),(0,D.dispose)(e.slice(0,t)),this._focus(-1,void 0)}catch(r){let o=Error(`BreadcrumbsItem#setItems: newItems: ${e.length}, prefix: ${t}, removed: ${i.length}`);throw o.name=r.name,o.stack=r.stack,o}}_render(e){let t=!1;for(;e<this._items.length&&e<this._nodes.length;e++){let i=this._items[e],o=this._nodes[e];this._renderItem(i,o),t=!0}for(;e<this._nodes.length;){let e=this._nodes.pop();e&&(this._freeNodes.push(e),e.remove(),t=!0)}for(;e<this._items.length;e++){let i=this._items[e],o=this._freeNodes.length>0?this._freeNodes.pop():(0,x.createElement)("div");o&&(this._renderItem(i,o),this._domNode.appendChild(o),this._nodes.push(o),t=!0)}t&&this.layout(void 0)}_renderItem(e,t){(0,x.clearNode)(t),t.className="";try{e.render(t)}catch(e){t.textContent="<<RENDER ERROR>>",console.error(e)}t.tabIndex=-1,t.setAttribute("role","listitem"),t.classList.add("monaco-breadcrumb-item");let i=(0,x.$)(tp.ThemeIcon.asCSSSelector(this._separatorIcon));t.appendChild(i)}_onClick(e){if(this._enabled)for(let t=e.target;t;t=t.parentElement){let i=this._nodes.indexOf(t);if(i>=0){this._focus(i,e),this._select(i,e);break}}}}var tv=e.i(511767),ty=e.i(155652),tC=e.i(83823),tb=e.i(380016),tw=e.i(262072),tf=eL,tS=e.i(95526),t_=e.i(827401),tE=e.i(718596),tI=e.i(370973),tD=e.i(441340),tT=e.i(122667),tA=e.i(428048),tx=e.i(321012),tR=e.i(891110),tk=e.i(589377),tM=e.i(815411),tL=e.i(241006),tO=e.i(134939),tP=e.i(599645),tV=e.i(2267);e.i(157255);class tK{static{this.IsEnabled=tK._stub("breadcrumbs.enabled")}static{this.UseQuickPick=tK._stub("breadcrumbs.useQuickPick")}static{this.FilePath=tK._stub("breadcrumbs.filePath")}static{this.SymbolPath=tK._stub("breadcrumbs.symbolPath")}static{this.SymbolSortOrder=tK._stub("breadcrumbs.symbolSortOrder")}static{this.SymbolPathSeparator=tK._stub("breadcrumbs.symbolPathSeparator")}static{this.Icons=tK._stub("breadcrumbs.icons")}static{this.TitleScrollbarSizing=tK._stub("workbench.editor.titleScrollbarSizing")}static{this.TitleScrollbarVisibility=tK._stub("workbench.editor.titleScrollbarVisibility")}static{this.FileExcludes=tK._stub("files.exclude")}static _stub(e){return{bindTo(t){let i=new I.Emitter,o=t.onDidChangeConfiguration(t=>{t.affectsConfiguration(e)&&i.fire(void 0)});return new class{constructor(){this.name=e,this.onDidChange=i.event}getValue(i){return i?t.getValue(e,i):t.getValue(e)}updateValue(i,o){return o?t.updateValue(e,i,o):t.updateValue(e,i)}dispose(){o.dispose(),i.dispose()}}}}}}q.Registry.as(tV.Extensions.Configuration).registerConfiguration({id:"breadcrumbs",title:(0,S.localize)(3056,"Breadcrumb Navigation"),order:101,type:"object",properties:{"breadcrumbs.enabled":{description:(0,S.localize)(3057,"Enable/disable navigation breadcrumbs."),type:"boolean",default:!0},"breadcrumbs.filePath":{description:(0,S.localize)(3058,"Controls whether and how file paths are shown in the breadcrumbs view."),type:"string",default:"on",enum:["on","off","last"],enumDescriptions:[(0,S.localize)(3059,"Show the file path in the breadcrumbs view."),(0,S.localize)(3060,"Do not show the file path in the breadcrumbs view."),(0,S.localize)(3061,"Only show the last element of the file path in the breadcrumbs view.")]},"breadcrumbs.symbolPath":{description:(0,S.localize)(3062,"Controls whether and how symbols are shown in the breadcrumbs view."),type:"string",default:"on",enum:["on","off","last"],enumDescriptions:[(0,S.localize)(3063,"Show all symbols in the breadcrumbs view."),(0,S.localize)(3064,"Do not show symbols in the breadcrumbs view."),(0,S.localize)(3065,"Only show the current symbol in the breadcrumbs view.")]},"breadcrumbs.symbolSortOrder":{description:(0,S.localize)(3066,"Controls how symbols are sorted in the breadcrumbs outline view."),type:"string",default:"position",scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,enum:["position","name","type"],enumDescriptions:[(0,S.localize)(3067,"Show symbol outline in file position order."),(0,S.localize)(3068,"Show symbol outline in alphabetical order."),(0,S.localize)(3069,"Show symbol outline in symbol type order.")]},"breadcrumbs.icons":{description:(0,S.localize)(3070,"Render breadcrumb items with icons."),type:"boolean",default:!0},"breadcrumbs.symbolPathSeparator":{description:(0,S.localize)(3071,"The separator used when copying the breadcrumb symbol path."),type:"string",default:".",scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE},"breadcrumbs.showFiles":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3072,"When enabled breadcrumbs show `file`-symbols.")},"breadcrumbs.showModules":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3073,"When enabled breadcrumbs show `module`-symbols.")},"breadcrumbs.showNamespaces":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3074,"When enabled breadcrumbs show `namespace`-symbols.")},"breadcrumbs.showPackages":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3075,"When enabled breadcrumbs show `package`-symbols.")},"breadcrumbs.showClasses":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3076,"When enabled breadcrumbs show `class`-symbols.")},"breadcrumbs.showMethods":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3077,"When enabled breadcrumbs show `method`-symbols.")},"breadcrumbs.showProperties":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3078,"When enabled breadcrumbs show `property`-symbols.")},"breadcrumbs.showFields":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3079,"When enabled breadcrumbs show `field`-symbols.")},"breadcrumbs.showConstructors":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3080,"When enabled breadcrumbs show `constructor`-symbols.")},"breadcrumbs.showEnums":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3081,"When enabled breadcrumbs show `enum`-symbols.")},"breadcrumbs.showInterfaces":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3082,"When enabled breadcrumbs show `interface`-symbols.")},"breadcrumbs.showFunctions":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3083,"When enabled breadcrumbs show `function`-symbols.")},"breadcrumbs.showVariables":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3084,"When enabled breadcrumbs show `variable`-symbols.")},"breadcrumbs.showConstants":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3085,"When enabled breadcrumbs show `constant`-symbols.")},"breadcrumbs.showStrings":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3086,"When enabled breadcrumbs show `string`-symbols.")},"breadcrumbs.showNumbers":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3087,"When enabled breadcrumbs show `number`-symbols.")},"breadcrumbs.showBooleans":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3088,"When enabled breadcrumbs show `boolean`-symbols.")},"breadcrumbs.showArrays":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3089,"When enabled breadcrumbs show `array`-symbols.")},"breadcrumbs.showObjects":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3090,"When enabled breadcrumbs show `object`-symbols.")},"breadcrumbs.showKeys":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3091,"When enabled breadcrumbs show `key`-symbols.")},"breadcrumbs.showNull":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3092,"When enabled breadcrumbs show `null`-symbols.")},"breadcrumbs.showEnumMembers":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3093,"When enabled breadcrumbs show `enumMember`-symbols.")},"breadcrumbs.showStructs":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3094,"When enabled breadcrumbs show `struct`-symbols.")},"breadcrumbs.showEvents":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3095,"When enabled breadcrumbs show `event`-symbols.")},"breadcrumbs.showOperators":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3096,"When enabled breadcrumbs show `operator`-symbols.")},"breadcrumbs.showTypeParameters":{type:"boolean",default:!0,scope:tV.ConfigurationScope.LANGUAGE_OVERRIDABLE,markdownDescription:(0,S.localize)(3097,"When enabled breadcrumbs show `typeParameter`-symbols.")}}}),e.s(["BreadcrumbsConfig",0,tK,"BreadcrumbsService",0,class{constructor(){this._map=new Map}register(e,t){if(this._map.has(e))throw Error(`group (${e}) has already a widget`);return this._map.set(e,t),{dispose:()=>this._map.delete(e)}}getWidget(e){return this._map.get(e)}}],558364);var tN=e.i(613036),tG=e.i(704994);class tF{constructor(e,t){this.uri=e,this.kind=t}}class tW{constructor(e,t){this.element=e,this.outline=t}}let tz=class{constructor(e,t,i,o,r){this.resource=e,this.editor=t,this._workspaceService=o,this._outlineService=r,this._disposables=new D.DisposableStore,this._currentOutline=new D.MutableDisposable,this._outlineDisposables=new D.DisposableStore,this._onDidUpdate=new I.Emitter,this.onDidUpdate=this._onDidUpdate.event,this._cfgFilePath=tK.FilePath.bindTo(i),this._cfgSymbolPath=tK.SymbolPath.bindTo(i),this._disposables.add(this._cfgFilePath.onDidChange(e=>this._onDidUpdate.fire(this))),this._disposables.add(this._cfgSymbolPath.onDidChange(e=>this._onDidUpdate.fire(this))),this._workspaceService.onDidChangeWorkspaceFolders(this._onDidChangeWorkspaceFolders,this,this._disposables),this._fileInfo=this._initFilePathInfo(e),t&&(this._bindToEditor(t),this._disposables.add(r.onDidChange(()=>this._bindToEditor(t))),this._disposables.add(t.onDidChangeControl(()=>this._bindToEditor(t)))),this._onDidUpdate.fire(this)}dispose(){this._disposables.dispose(),this._cfgFilePath.dispose(),this._cfgSymbolPath.dispose(),this._currentOutline.dispose(),this._outlineDisposables.dispose(),this._onDidUpdate.dispose()}isRelative(){return!!this._fileInfo.folder}getElements(){let e=[];if("on"===this._cfgFilePath.getValue()?e=e.concat(this._fileInfo.path):"last"===this._cfgFilePath.getValue()&&this._fileInfo.path.length>0&&(e=e.concat(this._fileInfo.path.slice(-1))),"off"===this._cfgSymbolPath.getValue()||!this._currentOutline.value)return e;let t=this._currentOutline.value.config.breadcrumbsDataSource.getBreadcrumbElements();for(let i="last"===this._cfgSymbolPath.getValue()&&t.length>0?t.length-1:0;i<t.length;i++)e.push(new tW(t[i].element,this._currentOutline.value));return 0!==t.length||this._currentOutline.value.isEmpty||e.push(new tW(this._currentOutline.value,this._currentOutline.value)),e}_initFilePathInfo(e){if((0,ez.matchesSomeScheme)(e,ez.Schemas.untitled,ez.Schemas.data))return{folder:void 0,path:[]};let t={folder:this._workspaceService.getWorkspaceFolder(e)??void 0,path:[]},i=e;for(;i&&"/"!==i.path&&!(t.folder&&(0,eW.isEqual)(t.folder.uri,i));){t.path.unshift(new tF(i,0===t.path.length?ev.FileKind.FILE:ev.FileKind.FOLDER));let e=i.path.length;if((i=(0,eW.dirname)(i)).path.length===e)break}return t.folder&&this._workspaceService.getWorkbenchState()===en.WorkbenchState.WORKSPACE&&t.path.unshift(new tF(t.folder.uri,ev.FileKind.ROOT_FOLDER)),t}_onDidChangeWorkspaceFolders(){this._fileInfo=this._initFilePathInfo(this.resource),this._onDidUpdate.fire(this)}_bindToEditor(e){let t=new tG.CancellationTokenSource;this._currentOutline.clear(),this._outlineDisposables.clear(),this._outlineDisposables.add((0,D.toDisposable)(()=>t.dispose(!0))),this._outlineService.createOutline(e,tM.OutlineTarget.Breadcrumbs,t.token).then(e=>{t.token.isCancellationRequested&&(e?.dispose(),e=void 0),this._currentOutline.value=e,this._onDidUpdate.fire(this),e&&this._outlineDisposables.add(e.onDidChange(()=>this._onDidUpdate.fire(this)))}).catch(e=>{this._onDidUpdate.fire(this),(0,eE.onUnexpectedError)(e)})}};tz=(0,f.__decorate)([(0,f.__param)(2,eQ.IConfigurationService),(0,f.__param)(3,ea.IWorkspaceContextService),(0,f.__param)(4,tL.IOutlineService)],tz);var tB=e.i(97514),tU=e.i(546198),tH=e.i(786091),t$=e.i(771275),tq=e.i(554250);(0,K.registerCss)(void 0);let tY=class{constructor(e,t,i,o,r){this.resource=t,this._instantiationService=i,this._themeService=o,this._configurationService=r,this._disposables=new D.DisposableStore,this._fakeEvent=new UIEvent("fakeEvent"),this._onWillPickElement=new I.Emitter,this.onWillPickElement=this._onWillPickElement.event,this._previewDispoables=new D.MutableDisposable,this._domNode=(0,x.createElement)("div"),this._domNode.className="monaco-breadcrumbs-picker show-file-icons",e.appendChild(this._domNode)}dispose(){this._disposables.dispose(),this._previewDispoables.dispose(),this._onWillPickElement.dispose(),this._domNode.remove(),setTimeout(()=>this._tree.dispose(),0)}async show(e,t,i,o,r){let s=this._themeService.getColorTheme().getColor(k.breadcrumbsPickerBackground);this._arrow=(0,x.createElement)("div"),this._arrow.className="arrow",this._arrow.style.borderColor=`transparent transparent ${s?s.toString():""}`,this._domNode.appendChild(this._arrow),this._treeContainer=(0,x.createElement)("div"),this._treeContainer.style.background=s?s.toString():"",this._treeContainer.style.paddingTop="2px",this._treeContainer.style.borderRadius="3px",this._treeContainer.style.boxShadow=`0 0 8px 2px ${this._themeService.getColorTheme().getColor(k.widgetShadow)}`,this._treeContainer.style.border=`1px solid ${this._themeService.getColorTheme().getColor(k.widgetBorder)}`,this._domNode.appendChild(this._treeContainer),this._layoutInfo={maxHeight:t,width:i,arrowSize:o,arrowOffset:r,inputHeight:0},this._tree=this._createTree(this._treeContainer,e),this._disposables.add(this._tree.onDidOpen(async e=>{let{element:t,editorOptions:i,sideBySide:o}=e;if(!await this._revealElement(t,{...i,preserveFocus:!1},o))return})),this._disposables.add(this._tree.onDidChangeFocus(e=>{this._previewDispoables.value=this._previewElement(e.elements[0])})),this._disposables.add(this._tree.onDidChangeContentHeight(()=>{this._layout()})),this._domNode.focus();try{await this._setInput(e),this._layout()}catch(e){(0,eE.onUnexpectedError)(e)}}_layout(){let e=2*this._layoutInfo.arrowSize,t=Math.min(this._layoutInfo.maxHeight-e,this._tree.contentHeight),i=t+e;this._domNode.style.height=`${i}px`,this._domNode.style.width=`${this._layoutInfo.width}px`,this._arrow.style.top=`-${2*this._layoutInfo.arrowSize}px`,this._arrow.style.borderWidth=`${this._layoutInfo.arrowSize}px`,this._arrow.style.marginLeft=`${this._layoutInfo.arrowOffset}px`,this._treeContainer.style.height=`${t}px`,this._treeContainer.style.width=`${this._layoutInfo.width}px`,this._tree.layout(t,this._layoutInfo.width)}restoreViewState(){}};tY=(0,f.__decorate)([(0,f.__param)(2,E.IInstantiationService),(0,f.__param)(3,T.IThemeService),(0,f.__param)(4,eQ.IConfigurationService)],tY);class tj{getHeight(e){return 22}getTemplateId(e){return"FileStat"}}class tX{getId(e){return e$.URI.isUri(e)?e.toString():(0,en.isWorkspace)(e)?e.id:(0,en.isWorkspaceFolder)(e)?e.uri.toString():e.resource.toString()}}let tJ=class{constructor(e){this._fileService=e}hasChildren(e){return e$.URI.isUri(e)||(0,en.isWorkspace)(e)||(0,en.isWorkspaceFolder)(e)||e.isDirectory}async getChildren(e){let t;return(0,en.isWorkspace)(e)?e.folders:(t=(0,en.isWorkspaceFolder)(e)?e.uri:e$.URI.isUri(e)?e:e.resource,(await this._fileService.resolve(t)).children??[])}};tJ=(0,f.__decorate)([(0,f.__param)(0,ey.IFileService)],tJ);let tZ=class{constructor(e,t){this._labels=e,this._configService=t,this.templateId="FileStat"}renderTemplate(e){return this._labels.create(e,{supportHighlights:!0})}renderElement(e,t,i){let o,r,s=this._configService.getValue("explorer.decorations"),{element:n}=e;(0,en.isWorkspaceFolder)(n)?(o=n.uri,r=ev.FileKind.ROOT_FOLDER):(o=n.resource,r=n.isDirectory?ev.FileKind.FOLDER:ev.FileKind.FILE),i.setFile(o,{fileKind:r,hidePath:!0,fileDecorations:s,matches:(0,tU.createMatches)(e.filterData),extraClasses:["picker-item"]})}disposeTemplate(e){e.dispose()}};tZ=(0,f.__decorate)([(0,f.__param)(1,eQ.IConfigurationService)],tZ);class tQ{getKeyboardNavigationLabel(e){return e.name}}class t0{getWidgetAriaLabel(){return(0,S.localize)(3110,"Breadcrumbs")}getAriaLabel(e){return e.name}}let t1=class{constructor(e,t,i){this._workspaceService=e,this._cachedExpressions=new Map,this._disposables=new D.DisposableStore;const o=tK.FileExcludes.bindTo(t),r=()=>{e.getWorkspace().folders.forEach(e=>{let t=o.getValue({resource:e.uri});if(!t)return;let r={};for(let i in t)"boolean"==typeof t[i]&&(r[0!==i.indexOf("**/")?t$.posix.join(e.uri.path,i):i]=t[i]);let s=!i.hasCapability(e.uri,ev.FileSystemProviderCapabilities.PathCaseSensitive);this._cachedExpressions.set(e.uri.toString(),(0,tH.parse)(r,{ignoreCase:s}))})};r(),this._disposables.add(o),this._disposables.add(o.onDidChange(r)),this._disposables.add(e.onDidChangeWorkspaceFolders(r))}dispose(){this._disposables.dispose()}filter(e,t){if((0,en.isWorkspaceFolder)(e))return!0;let i=this._workspaceService.getWorkspaceFolder(e.resource);return!(i&&this._cachedExpressions.has(i.uri.toString()))||!this._cachedExpressions.get(i.uri.toString())((0,t$.relative)(i.uri.path,e.resource.path),(0,eW.basename)(e.resource))}};t1=(0,f.__decorate)([(0,f.__param)(0,ea.IWorkspaceContextService),(0,f.__param)(1,eQ.IConfigurationService),(0,f.__param)(2,ey.IFileService)],t1);class t2{compare(e,t){return(0,en.isWorkspaceFolder)(e)&&(0,en.isWorkspaceFolder)(t)?e.index-t.index:e.isDirectory===t.isDirectory?(0,tB.compareFileNames)(e.name,t.name):e.isDirectory?-1:1}}let t3=class extends tY{constructor(e,t,i,o,r,s,n){super(e,t,i,o,r),this._workspaceService=s,this._editorService=n}_createTree(e){this._treeContainer.classList.add("file-icon-themable-tree"),this._treeContainer.classList.add("show-file-icons");let t=e=>{this._treeContainer.classList.toggle("align-icons-and-twisties",e.hasFileIcons&&!e.hasFolderIcons),this._treeContainer.classList.toggle("hide-arrows",!0===e.hidesExplorerArrows)};this._disposables.add(this._themeService.onDidFileIconThemeChange(t)),t(this._themeService.getFileIconTheme());let i=this._instantiationService.createInstance(tP.ResourceLabels,tP.DEFAULT_LABELS_CONTAINER);return this._disposables.add(i),this._instantiationService.createInstance(tD.WorkbenchAsyncDataTree,"BreadcrumbsFilePicker",e,new tj,[this._instantiationService.createInstance(tZ,i)],this._instantiationService.createInstance(tJ),{multipleSelectionSupport:!1,sorter:new t2,filter:this._instantiationService.createInstance(t1),identityProvider:new tX,keyboardNavigationLabelProvider:new tQ,accessibilityProvider:this._instantiationService.createInstance(t0),showNotFoundMessage:!1,overrideStyles:{listBackground:k.breadcrumbsPickerBackground}})}async _setInput(e){let t,i,{uri:o,kind:r}=e;t=r===ev.FileKind.ROOT_FOLDER?this._workspaceService.getWorkspace():(0,eW.dirname)(o);let s=this._tree;for(let{element:e}of(await s.setInput(t),s.getNode().children))if((0,en.isWorkspaceFolder)(e)&&(0,eW.isEqual)(e.uri,o)){i=e;break}else if((0,eW.isEqual)(e.resource,o)){i=e;break}i&&(s.reveal(i,.5),s.setFocus([i],this._fakeEvent)),s.domFocus()}_previewElement(e){return D.Disposable.None}async _revealElement(e,t,i){return!(0,en.isWorkspaceFolder)(e)&&!!e.isFile&&(this._onWillPickElement.fire(),await this._editorService.openEditor({resource:e.resource,options:t},i?tk.SIDE_GROUP:void 0),!0)}};t3=(0,f.__decorate)([(0,f.__param)(2,E.IInstantiationService),(0,f.__param)(3,T.IThemeService),(0,f.__param)(4,eQ.IConfigurationService),(0,f.__param)(5,ea.IWorkspaceContextService),(0,f.__param)(6,eN.IEditorService)],t3);let t5=class{constructor(e,t,i){this.comparator=e,this._order=i.getValue(t,"breadcrumbs.symbolSortOrder")}compare(e,t){return"name"===this._order?this.comparator.compareByName(e,t):"type"===this._order?this.comparator.compareByType(e,t):this.comparator.compareByPosition(e,t)}};t5=(0,f.__decorate)([(0,f.__param)(2,tq.ITextResourceConfigurationService)],t5);class t6 extends tY{_createTree(e,t){let{config:i}=t.outline;return this._instantiationService.createInstance(tD.WorkbenchDataTree,"BreadcrumbsOutlinePicker",e,i.delegate,i.renderers,i.treeDataSource,{...i.options,sorter:this._instantiationService.createInstance(t5,i.comparator,void 0),collapseByDefault:!0,expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,showNotFoundMessage:!1})}_setInput(e){let t=e.outline.captureViewState();this.restoreViewState=()=>{t.dispose()};let i=this._tree;return i.setInput(e.outline),e.element!==e.outline&&(i.reveal(e.element,.5),i.setFocus([e.element],this._fakeEvent)),i.domFocus(),Promise.resolve()}_previewElement(e){return this._tree.getInput().preview(e)}async _revealElement(e,t,i){this._onWillPickElement.fire();let o=this._tree.getInput();return await o.reveal(e,t,i,!1),!0}}(0,K.registerCss)(void 0);let t4=s=class extends tg{constructor(e,t,i,o){super(),this.model=e,this.element=t,this.options=i,this._instantiationService=o,this._disposables=new D.DisposableStore}dispose(){this._disposables.dispose()}equals(e){return e instanceof s&&this.element.element===e.element.element&&this.options.showFileIcons===e.options.showFileIcons&&this.options.showSymbolIcons===e.options.showSymbolIcons}render(e){let{element:t,outline:i}=this.element;if(t===i){let t=(0,x.$)("span",void 0,"…");e.appendChild(t);return}let o=i.config.delegate.getTemplateId(t),r=i.config.renderers.find(e=>e.templateId===o);if(!r){e.textContent="<<NO RENDERER>>";return}let s=r.renderTemplate(e);r.renderElement({element:t,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:0,collapsible:!1,collapsed:!1,visible:!0,filterData:void 0},0,s,void 0),this.options.showSymbolIcons||(0,x.hide)(s.iconClass),this._disposables.add((0,D.toDisposable)(()=>{r.disposeTemplate(s)})),t instanceof tb.OutlineElement&&i.uri&&this._disposables.add(this._instantiationService.invokeFunction(o=>t8(o,e,t.symbol.name,{symbol:t.symbol,uri:i.uri},this.model,this.options.dragEditor)))}};t4=s=(0,f.__decorate)([(0,f.__param)(3,E.IInstantiationService)],t4);let t9=n=class extends tg{constructor(e,t,i,o,r,s){super(),this.model=e,this.element=t,this.options=i,this._labels=o,this._hoverDelegate=r,this._instantiationService=s,this._disposables=new D.DisposableStore}dispose(){this._disposables.dispose()}equals(e){return e instanceof n&&eW.extUri.isEqual(this.element.uri,e.element.uri)&&this.options.showFileIcons===e.options.showFileIcons&&this.options.showSymbolIcons===e.options.showSymbolIcons}render(e){let t=this._labels.create(e,{hoverDelegate:this._hoverDelegate});t.setFile(this.element.uri,{hidePath:!0,hideIcon:this.element.kind===ev.FileKind.FOLDER||!this.options.showFileIcons,fileKind:this.element.kind,fileDecorations:{colors:this.options.showDecorationColors,badges:!1}}),e.classList.add(ev.FileKind[this.element.kind].toLowerCase()),this._disposables.add(t),this._disposables.add(this._instantiationService.invokeFunction(t=>t8(t,e,(0,eW.basename)(this.element.uri),this.element.uri,this.model,this.options.dragEditor)))}};function t8(e,t,i,o,r,s){let n=e.get(E.IInstantiationService);return t.draggable=!0,new x.DragAndDropObserver(t,{onDragStart:e=>{e.dataTransfer&&(e.dataTransfer.effectAllowed="copyMove",n.invokeFunction(t=>{e$.URI.isUri(o)?(0,tO.fillEditorsDragData)(t,[o],e):((0,tO.fillEditorsDragData)(t,[{resource:o.uri,selection:o.symbol.range}],e),(0,t_.fillInSymbolsDragData)([{name:o.symbol.name,fsPath:o.uri.fsPath,range:o.symbol.range,kind:o.symbol.kind}],e)),s&&r.editor?.input&&t_.LocalSelectionTransfer.getInstance().setData([new tO.DraggedEditorIdentifier({editor:r.editor.input,groupId:r.editor.group.id})],tO.DraggedEditorIdentifier.prototype)}),(0,tv.applyDragImage)(e,t,i))}})}t9=n=(0,f.__decorate)([(0,f.__param)(5,E.IInstantiationService)],t9);let t7=(0,tx.registerIcon)("breadcrumb-separator",ty.Codicon.chevronRight,(0,S.localize)(3098,"Icon for the separator in the breadcrumbs.")),ie=class{static{a=this}static{this.HEIGHT=22}static{this.SCROLLBAR_SIZES={default:3,large:8}}static{this.SCROLLBAR_VISIBILITY={auto:eo.ScrollbarVisibility.Auto,visible:eo.ScrollbarVisibility.Visible,hidden:eo.ScrollbarVisibility.Hidden}}static{this.Payload_Reveal={}}static{this.Payload_RevealAside={}}static{this.Payload_Pick={}}static{this.CK_BreadcrumbsPossible=new e0.RawContextKey("breadcrumbsPossible",!1,(0,S.localize)(3099,"Whether the editor can show breadcrumbs"))}static{this.CK_BreadcrumbsVisible=new e0.RawContextKey("breadcrumbsVisible",!1,(0,S.localize)(3100,"Whether breadcrumbs are currently visible"))}static{this.CK_BreadcrumbsActive=new e0.RawContextKey("breadcrumbsActive",!1,(0,S.localize)(3101,"Whether breadcrumbs have focus"))}get onDidVisibilityChange(){return this._onDidVisibilityChange.event}constructor(e,t,i,o,r,s,n,d,l,c,h,u){this._options=t,this._editorGroup=i,this._contextKeyService=o,this._contextViewService=r,this._instantiationService=s,this._quickInputService=n,this._fileService=d,this._editorService=l,this._labelService=c,this._disposables=new D.DisposableStore,this._breadcrumbsDisposables=new D.DisposableStore,this._model=new D.MutableDisposable,this._breadcrumbsPickerShowing=!1,this._onDidVisibilityChange=this._disposables.add(new I.Emitter),this.domNode=(0,x.createElement)("div"),this.domNode.classList.add("breadcrumbs-control"),(0,x.append)(e,this.domNode),this._cfUseQuickPick=tK.UseQuickPick.bindTo(h),this._cfShowIcons=tK.Icons.bindTo(h),this._cfTitleScrollbarSizing=tK.TitleScrollbarSizing.bindTo(h),this._cfTitleScrollbarVisibility=tK.TitleScrollbarVisibility.bindTo(h),this._labels=this._instantiationService.createInstance(tP.ResourceLabels,tP.DEFAULT_LABELS_CONTAINER);const p=this._cfTitleScrollbarSizing.getValue()??"default",g=t.widgetStyles??eh.defaultBreadcrumbsWidgetStyles,m=this._cfTitleScrollbarVisibility?.getValue()??"auto";this._widget=new tm(this.domNode,a.SCROLLBAR_SIZES[p],a.SCROLLBAR_VISIBILITY[m],t7,g),this._widget.onDidSelectItem(this._onSelectEvent,this,this._disposables),this._widget.onDidFocusItem(this._onFocusEvent,this,this._disposables),this._widget.onDidChangeFocus(this._updateCkBreadcrumbsActive,this,this._disposables),this._ckBreadcrumbsPossible=a.CK_BreadcrumbsPossible.bindTo(this._contextKeyService),this._ckBreadcrumbsVisible=a.CK_BreadcrumbsVisible.bindTo(this._contextKeyService),this._ckBreadcrumbsActive=a.CK_BreadcrumbsActive.bindTo(this._contextKeyService),this._hoverDelegate=(0,ep.getDefaultHoverDelegate)("mouse"),this._disposables.add(u.register(this._editorGroup.id,this._widget)),this.hide()}dispose(){this._disposables.dispose(),this._breadcrumbsDisposables.dispose(),this._model.dispose(),this._ckBreadcrumbsPossible.reset(),this._ckBreadcrumbsVisible.reset(),this._ckBreadcrumbsActive.reset(),this._cfUseQuickPick.dispose(),this._cfShowIcons.dispose(),this._cfTitleScrollbarSizing.dispose(),this._cfTitleScrollbarVisibility.dispose(),this._widget.dispose(),this._labels.dispose(),this.domNode.remove()}get model(){return this._model.value}layout(e){this._widget.layout(e)}isHidden(){return this.domNode.classList.contains("hidden")}hide(){let e=this.isHidden();this._breadcrumbsDisposables.clear(),this._ckBreadcrumbsVisible.set(!1),this.domNode.classList.toggle("hidden",!0),e||this._onDidVisibilityChange.fire()}show(){let e=this.isHidden();this._ckBreadcrumbsVisible.set(!0),this.domNode.classList.toggle("hidden",!1),e&&this._onDidVisibilityChange.fire()}revealLast(){this._widget.revealLast()}update(){this._breadcrumbsDisposables.clear();let e=L.EditorResourceAccessor.getCanonicalUri(this._editorGroup.activeEditor,{supportSideBySide:L.SideBySideEditor.PRIMARY}),t=this.isHidden();if(!e||!this._fileService.hasProvider(e))return this._ckBreadcrumbsPossible.set(!1),!t&&(this.hide(),!0);let i=L.EditorResourceAccessor.getOriginalUri(this._editorGroup.activeEditor,{supportSideBySide:L.SideBySideEditor.PRIMARY});this.show(),this._ckBreadcrumbsPossible.set(!0);let o=this._instantiationService.createInstance(tz,i??e,this._editorGroup.activeEditorPane);this._model.value=o,this.domNode.classList.toggle("backslash-path","\\"===this._labelService.getSeparator(e.scheme,e.authority));let r=()=>{this.domNode.classList.toggle("relative-path",o.isRelative());let e=this._cfShowIcons.getValue(),t={...this._options,showFileIcons:this._options.showFileIcons&&e,showSymbolIcons:this._options.showSymbolIcons&&e},i=o.getElements().map(e=>e instanceof tF?this._instantiationService.createInstance(t9,o,e,t,this._labels,this._hoverDelegate):this._instantiationService.createInstance(t4,o,e,t));0===i.length?(this._widget.setEnabled(!1),this._widget.setItems([new class extends tg{render(e){e.textContent=(0,S.localize)(3102,"no elements")}equals(e){return e===this}dispose(){}}])):(this._widget.setEnabled(!0),this._widget.setItems(i),this._widget.reveal(i[i.length-1]))},s=o.onDidUpdate(r),n=this._cfShowIcons.onDidChange(r);r(),this._breadcrumbsDisposables.clear(),this._breadcrumbsDisposables.add(s),this._breadcrumbsDisposables.add((0,D.toDisposable)(()=>this._model.clear())),this._breadcrumbsDisposables.add(n),this._breadcrumbsDisposables.add((0,D.toDisposable)(()=>this._widget.setItems([])));let d=()=>{let e=this._cfTitleScrollbarSizing.getValue()??"default",t=this._cfTitleScrollbarVisibility?.getValue()??"auto";this._widget.setHorizontalScrollbarSize(a.SCROLLBAR_SIZES[e]),this._widget.setHorizontalScrollbarVisibility(a.SCROLLBAR_VISIBILITY[t])};d();let l=this._cfTitleScrollbarSizing.onDidChange(d),c=this._cfTitleScrollbarVisibility.onDidChange(d);return this._breadcrumbsDisposables.add(l),this._breadcrumbsDisposables.add(c),this._breadcrumbsDisposables.add({dispose:()=>{this._breadcrumbsPickerShowing&&this._contextViewService.hideContextView({source:this})}}),t!==this.isHidden()}_onFocusEvent(e){e.item&&this._breadcrumbsPickerShowing&&(this._breadcrumbsPickerIgnoreOnceItem=void 0,this._widget.setSelection(e.item))}_onSelectEvent(e){let t,i;if(!e.item)return;if(e.item===this._breadcrumbsPickerIgnoreOnceItem){this._breadcrumbsPickerIgnoreOnceItem=void 0,this._widget.setFocused(void 0),this._widget.setSelection(void 0);return}let{element:o}=e.item;this._editorGroup.focus();let r=this._getEditorGroup(e.payload);if(void 0!==r){this._widget.setFocused(void 0),this._widget.setSelection(void 0),this._revealInEditor(e,o,r);return}if(this._cfUseQuickPick.getValue()){this._widget.setFocused(void 0),this._widget.setSelection(void 0),this._quickInputService.quickAccess.show(o instanceof tW?"@":"");return}this._contextViewService.showContextView({render:i=>{e.item instanceof t9?t=this._instantiationService.createInstance(t3,i,e.item.model.resource):e.item instanceof t4&&(t=this._instantiationService.createInstance(t6,i,e.item.model.resource));let o=t.onWillPickElement(()=>this._contextViewService.hideContextView({source:this,didPick:!0})),r=th.PixelRatio.getInstance((0,x.getWindow)(this.domNode)).onDidChange(()=>this._contextViewService.hideContextView({source:this})),s=(0,x.trackFocus)(i),n=s.onDidBlur(()=>{this._breadcrumbsPickerIgnoreOnceItem=this._widget.isDOMFocused()?e.item:void 0,this._contextViewService.hideContextView({source:this})});return this._breadcrumbsPickerShowing=!0,this._updateCkBreadcrumbsActive(),(0,D.combinedDisposable)(t,o,r,s,n)},getAnchor:()=>{if(!i){let r,s=(0,x.getWindow)(this.domNode),n=s.innerWidth-8,a=Math.min(.7*s.innerHeight,300),d=Math.min(n,Math.max(240,n/4.17)),l=(0,x.getDomNodePagePosition)(e.node.firstChild),c=l.top+l.height+8;c+a>=s.innerHeight&&(a=s.innerHeight-c-30);let h=l.left;if(h+d>=n&&(h=n-d),e.payload instanceof eP.StandardMouseEvent){let t=d-16;(r=e.payload.posx-h)>t&&(h=Math.min(n-d,h+r-t),r=t)}else r=l.left+.3*l.width-h;t.show(o,a,d,8,Math.max(0,r)),i={x:h,y:c}}return i},onHide:e=>{e?.didPick||t.restoreViewState(),this._breadcrumbsPickerShowing=!1,this._updateCkBreadcrumbsActive(),e?.source===this&&(this._widget.setFocused(void 0),this._widget.setSelection(void 0)),t.dispose()}})}_updateCkBreadcrumbsActive(){let e=this._widget.isDOMFocused()||this._breadcrumbsPickerShowing;this._ckBreadcrumbsActive.set(e)}async _revealInEditor(e,t,i,o=!1){if(t instanceof tF)if(t.kind===ev.FileKind.FILE)await this._editorService.openEditor({resource:t.uri,options:{pinned:o}},i);else{let t=this._widget.getItems(),i=t.indexOf(e.item);this._widget.setFocused(t[i+1]),this._widget.setSelection(t[i+1],a.Payload_Pick)}else t.outline.reveal(t,{pinned:o},i===tk.SIDE_GROUP,!1)}_getEditorGroup(e){return e===a.Payload_RevealAside?tk.SIDE_GROUP:e===a.Payload_Reveal?tk.ACTIVE_GROUP:void 0}};ie=a=(0,f.__decorate)([(0,f.__param)(3,z.IContextKeyService),(0,f.__param)(4,eK.IContextViewService),(0,f.__param)(5,E.IInstantiationService),(0,f.__param)(6,tA.IQuickInputService),(0,f.__param)(7,ey.IFileService),(0,f.__param)(8,eN.IEditorService),(0,f.__param)(9,tI.ILabelService),(0,f.__param)(10,eQ.IConfigurationService),(0,f.__param)(11,tN.IBreadcrumbsService)],ie);let it=class{get control(){return this._control}get onDidEnablementChange(){return this._onDidEnablementChange.event}get onDidVisibilityChange(){return this._onDidVisibilityChange.event}constructor(e,t,i,o,r,s){this._container=e,this._editorGroup=t,this._options=i,this._instantiationService=r,this._disposables=new D.DisposableStore,this._controlDisposables=new D.DisposableStore,this._onDidEnablementChange=this._disposables.add(new I.Emitter),this._onDidVisibilityChange=this._disposables.add(new I.Emitter);const n=this._disposables.add(tK.IsEnabled.bindTo(o));this._disposables.add(n.onDidChange(()=>{let e=n.getValue();!e&&this._control?(this._controlDisposables.clear(),this._control=void 0,this._onDidEnablementChange.fire()):e&&!this._control&&(this._control=this.createControl(),this._control.update(),this._onDidEnablementChange.fire())})),n.getValue()&&(this._control=this.createControl()),this._disposables.add(s.onDidChangeFileSystemProviderRegistrations(e=>{(!this._control?.model||this._control.model.resource.scheme===e.scheme)&&this._control?.update()&&this._onDidEnablementChange.fire()}))}createControl(){let e=this._controlDisposables.add(this._instantiationService.createInstance(ie,this._container,this._options,this._editorGroup));return this._controlDisposables.add(e.onDidVisibilityChange(()=>this._onDidVisibilityChange.fire())),e}dispose(){this._disposables.dispose(),this._controlDisposables.dispose()}};function ii(e,t){let i=e.get(tR.IEditorGroupsService),o=e.get(tN.IBreadcrumbsService).getWidget(i.activeGroup.id);if(o){let e=o.getItems().at(-1);o.setFocused(e),t&&o.setSelection(e,ie.Payload_Pick)}}it=(0,f.__decorate)([(0,f.__param)(3,eQ.IConfigurationService),(0,f.__param)(4,E.IInstantiationService),(0,f.__param)(5,ey.IFileService)],it),(0,tf.registerAction2)(class extends tf.Action2{constructor(){super({id:"breadcrumbs.toggle",title:(0,S.localize2)(3103,"Toggle Breadcrumbs"),shortTitle:(0,S.localize2)(3104,"Breadcrumbs"),category:tw.Categories.View,toggled:{condition:e0.ContextKeyExpr.equals("config.breadcrumbs.enabled",!0),title:(0,S.localize)(3105,"Breadcrumbs"),mnemonicTitle:(0,S.localize)(3106,"&&Breadcrumbs")},menu:[{id:tf.MenuId.CommandPalette},{id:tf.MenuId.MenubarAppearanceMenu,group:"4_editor",order:2},{id:tf.MenuId.NotebookToolbar,group:"notebookLayout",order:2},{id:tf.MenuId.StickyScrollContext},{id:tf.MenuId.NotebookStickyScrollContext,group:"notebookView",order:2},{id:tf.MenuId.NotebookToolbarContext,group:"notebookView",order:2}]})}run(e){let t=e.get(eQ.IConfigurationService),i=tK.IsEnabled.bindTo(t),o=i.getValue();i.updateValue(!o),i.dispose()}}),(0,tf.registerAction2)(class extends tf.Action2{constructor(){super({id:"breadcrumbs.focusAndSelect",title:(0,S.localize2)(3107,"Focus and Select Breadcrumbs"),precondition:ie.CK_BreadcrumbsVisible,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.Period,when:ie.CK_BreadcrumbsPossible},f1:!0})}run(e){ii(e,!0)}}),(0,tf.registerAction2)(class extends tf.Action2{constructor(){super({id:"breadcrumbs.focus",title:(0,S.localize2)(3108,"Focus Breadcrumbs"),precondition:ie.CK_BreadcrumbsVisible,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.Semicolon,when:ie.CK_BreadcrumbsPossible},f1:!0})}run(e){ii(e,!1)}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"breadcrumbs.toggleToOn",weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.Period,when:e0.ContextKeyExpr.not("config.breadcrumbs.enabled"),handler:async e=>{let t=e.get(E.IInstantiationService),i=e.get(eQ.IConfigurationService),o=tK.IsEnabled.bindTo(i);return o.getValue()||(await o.updateValue(!0),await (0,ex.timeout)(50)),o.dispose(),t.invokeFunction(ii,!0)}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"breadcrumbs.focusNext",weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyCode.RightArrow,secondary:[tC.KeyMod.CtrlCmd|tC.KeyCode.RightArrow],mac:{primary:tC.KeyCode.RightArrow,secondary:[tC.KeyMod.Alt|tC.KeyCode.RightArrow]},when:e0.ContextKeyExpr.and(ie.CK_BreadcrumbsVisible,ie.CK_BreadcrumbsActive),handler(e){let t=e.get(tR.IEditorGroupsService),i=e.get(tN.IBreadcrumbsService).getWidget(t.activeGroup.id);i&&i.focusNext()}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"breadcrumbs.focusPrevious",weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyCode.LeftArrow,secondary:[tC.KeyMod.CtrlCmd|tC.KeyCode.LeftArrow],mac:{primary:tC.KeyCode.LeftArrow,secondary:[tC.KeyMod.Alt|tC.KeyCode.LeftArrow]},when:e0.ContextKeyExpr.and(ie.CK_BreadcrumbsVisible,ie.CK_BreadcrumbsActive),handler(e){let t=e.get(tR.IEditorGroupsService),i=e.get(tN.IBreadcrumbsService).getWidget(t.activeGroup.id);i&&i.focusPrev()}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"breadcrumbs.focusNextWithPicker",weight:tE.KeybindingWeight.WorkbenchContrib+1,primary:tC.KeyMod.CtrlCmd|tC.KeyCode.RightArrow,mac:{primary:tC.KeyMod.Alt|tC.KeyCode.RightArrow},when:e0.ContextKeyExpr.and(ie.CK_BreadcrumbsVisible,ie.CK_BreadcrumbsActive,tD.WorkbenchListFocusContextKey),handler(e){let t=e.get(tR.IEditorGroupsService),i=e.get(tN.IBreadcrumbsService).getWidget(t.activeGroup.id);i&&i.focusNext()}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"breadcrumbs.focusPreviousWithPicker",weight:tE.KeybindingWeight.WorkbenchContrib+1,primary:tC.KeyMod.CtrlCmd|tC.KeyCode.LeftArrow,mac:{primary:tC.KeyMod.Alt|tC.KeyCode.LeftArrow},when:e0.ContextKeyExpr.and(ie.CK_BreadcrumbsVisible,ie.CK_BreadcrumbsActive,tD.WorkbenchListFocusContextKey),handler(e){let t=e.get(tR.IEditorGroupsService),i=e.get(tN.IBreadcrumbsService).getWidget(t.activeGroup.id);i&&i.focusPrev()}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"breadcrumbs.selectFocused",weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyCode.Enter,secondary:[tC.KeyCode.DownArrow],when:e0.ContextKeyExpr.and(ie.CK_BreadcrumbsVisible,ie.CK_BreadcrumbsActive),handler(e){let t=e.get(tR.IEditorGroupsService),i=e.get(tN.IBreadcrumbsService).getWidget(t.activeGroup.id);i&&i.setSelection(i.getFocused(),ie.Payload_Pick)}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"breadcrumbs.revealFocused",weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyCode.Space,secondary:[tC.KeyMod.CtrlCmd|tC.KeyCode.Enter],when:e0.ContextKeyExpr.and(ie.CK_BreadcrumbsVisible,ie.CK_BreadcrumbsActive),handler(e){let t=e.get(tR.IEditorGroupsService),i=e.get(tN.IBreadcrumbsService).getWidget(t.activeGroup.id);i&&i.setSelection(i.getFocused(),ie.Payload_Reveal)}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"breadcrumbs.selectEditor",weight:tE.KeybindingWeight.WorkbenchContrib+1,primary:tC.KeyCode.Escape,when:e0.ContextKeyExpr.and(ie.CK_BreadcrumbsVisible,ie.CK_BreadcrumbsActive),handler(e){let t=e.get(tR.IEditorGroupsService),i=e.get(tN.IBreadcrumbsService).getWidget(t.activeGroup.id);i&&(i.setFocused(void 0),i.setSelection(void 0),t.activeGroup.activeEditorPane?.focus())}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"breadcrumbs.revealFocusedFromTreeAside",weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyCode.Enter,when:e0.ContextKeyExpr.and(ie.CK_BreadcrumbsVisible,ie.CK_BreadcrumbsActive,tD.WorkbenchListFocusContextKey),handler(e){let t=e.get(eN.IEditorService),i=e.get(tT.IListService).lastFocusedList;if(!(i instanceof tD.WorkbenchDataTree)&&!(i instanceof tD.WorkbenchAsyncDataTree))return;let o=i.getFocus()[0];if(e$.URI.isUri(o?.resource))return t.openEditor({resource:o.resource,options:{pinned:!0}},tk.SIDE_GROUP);let r=i.getInput();if(r&&"string"==typeof r.outlineKind)return r.reveal(o,{pinned:!0,preserveFocus:!1},!0,!1)}}),(0,tf.registerAction2)(class extends tf.Action2{constructor(){super({id:"breadcrumbs.copyPath",title:(0,S.localize2)(3109,"Copy Breadcrumbs Path"),category:tw.Categories.View,precondition:ie.CK_BreadcrumbsVisible,f1:!0,menu:[{id:tf.MenuId.EditorTitleContext,group:"1_cutcopypaste",order:100,when:ie.CK_BreadcrumbsPossible}]})}async run(e){let t=e.get(tR.IEditorGroupsService),i=e.get(tS.IClipboardService),o=e.get(eQ.IConfigurationService),r=e.get(tL.IOutlineService);if(!t.activeGroup.activeEditorPane)return;let s=await r.createOutline(t.activeGroup.activeEditorPane,tM.OutlineTarget.Breadcrumbs,tG.CancellationToken.None);if(!s)return;let n=s.config.breadcrumbsDataSource.getBreadcrumbElements().map(e=>e.label).filter(Boolean);if(s.dispose(),0===n.length)return;let a=t.activeGroup.activeEditorPane.input.resource,d=tK.SymbolPathSeparator.bindTo(o),l=d.getValue(a&&{resource:a})??".";d.dispose();let c=n.join(l);await i.writeText(c)}});var io=e.i(82648),ir=e.i(842577),is=e.i(250147),ia=e.i(701898),id=e.i(975445),il=U,ic=e.i(895737),ih=e.i(322193),iu=e.i(159868),ip=e.i(865384),ig=e.i(704409),im=eL,iv=e.i(65579),iy=e.i(828730),iC=e.i(226235),ib=e.i(326659),iw=e.i(58762),iS=e.i(633450),i_=e.i(193667);(0,K.registerCss)(void 0);let iE=class extends iC.PickerQuickAccessProvider{constructor(e,t,i,o,r){super(e,{canAcceptInBackground:!0,noResultsPick:{label:(0,S.localize)(3439,"No matching editors"),groupId:-1}}),this.editorGroupService=t,this.editorService=i,this.modelService=o,this.languageService=r,this.pickState=new class{constructor(){this.scorerCache=Object.create(null),this.isQuickNavigating=void 0}reset(e){e||(this.scorerCache=Object.create(null)),this.isQuickNavigating=e}}}provide(e,t){return this.pickState.reset(!!e.quickNavigate),super.provide(e,t)}_getPicks(e){let t=(0,i_.prepareQuery)(e),i=this.doGetEditorPickItems().filter(e=>{if(!t.normalized)return!0;let i=(0,i_.scoreItemFuzzy)(e,t,!0,iy.quickPickItemScorerAccessor,this.pickState.scorerCache);return!!i.score&&(e.highlights={label:i.labelMatch,description:i.descriptionMatch},!0)});if(t.normalized){let e=this.editorGroupService.getGroups(_.GroupsOrder.GRID_APPEARANCE).map(e=>e.id);i.sort((i,o)=>i.groupId!==o.groupId?e.indexOf(i.groupId)-e.indexOf(o.groupId):(0,i_.compareItemsByFuzzyScore)(i,o,t,!0,iy.quickPickItemScorerAccessor,this.pickState.scorerCache))}let o=[];if(this.editorGroupService.count>1){let e;for(let t of i){if("number"!=typeof e||e!==t.groupId){let i=this.editorGroupService.getGroup(t.groupId);i&&o.push({type:"separator",label:i.label}),e=t.groupId}o.push(t)}}else o.push(...i);return o}doGetEditorPickItems(){let e=this.doGetEditors(),t=new Map;for(let{groupId:i}of e)if(!t.has(i)){let e=this.editorGroupService.getGroup(i);e&&t.set(i,e.ariaLabel)}return this.doGetEditors().map(({editor:e,groupId:i})=>{let o=L.EditorResourceAccessor.getOriginalUri(e,{supportSideBySide:L.SideBySideEditor.PRIMARY}),r=e.isDirty()&&!e.isSaving(),s=e.getDescription(),n=s?`${e.getName()} ${s}`:e.getName();return{groupId:i,resource:o,label:e.getName(),ariaLabel:t.size>1?r?(0,S.localize)(3440,"{0}, unsaved changes, {1}",n,t.get(i)):(0,S.localize)(3441,"{0}, {1}",n,t.get(i)):r?(0,S.localize)(3442,"{0}, unsaved changes",n):n,description:s,iconClasses:(0,iS.getIconClasses)(this.modelService,this.languageService,o,void 0,e.getIcon()).concat(e.getLabelExtraClasses()),italic:!this.editorGroupService.getGroup(i)?.isPinned(e),buttons:[{iconClass:r?"dirty-editor "+tp.ThemeIcon.asClassName(ty.Codicon.closeDirty):tp.ThemeIcon.asClassName(ty.Codicon.close),tooltip:(0,S.localize)(3443,"Close Editor"),alwaysVisible:r}],trigger:async()=>{let t=this.editorGroupService.getGroup(i);return t&&(await t.closeEditor(e,{preserveFocus:!0}),!t.contains(e))?iC.TriggerAction.REMOVE_ITEM:iC.TriggerAction.NO_ACTION},accept:(t,o)=>this.editorGroupService.getGroup(i)?.openEditor(e,{preserveFocus:o.inBackground})}})}};iE=(0,f.__decorate)([(0,f.__param)(1,tR.IEditorGroupsService),(0,f.__param)(2,eN.IEditorService),(0,f.__param)(3,ib.IModelService),(0,f.__param)(4,iw.ILanguageService)],iE);let iI=class extends iE{static{d=this}static{this.PREFIX="edt active "}constructor(e,t,i,o){super(d.PREFIX,e,t,i,o)}doGetEditors(){let e=this.editorGroupService.activeGroup;return e.getEditors(L.EditorsOrder.MOST_RECENTLY_ACTIVE).map(t=>({editor:t,groupId:e.id}))}};iI=d=(0,f.__decorate)([(0,f.__param)(0,tR.IEditorGroupsService),(0,f.__param)(1,eN.IEditorService),(0,f.__param)(2,ib.IModelService),(0,f.__param)(3,iw.ILanguageService)],iI);let iD=class extends iE{static{l=this}static{this.PREFIX="edt "}constructor(e,t,i,o){super(l.PREFIX,e,t,i,o)}doGetEditors(){let e=[];for(let t of this.editorGroupService.getGroups(_.GroupsOrder.GRID_APPEARANCE))for(let i of t.getEditors(L.EditorsOrder.SEQUENTIAL))e.push({editor:i,groupId:t.id});return e}};iD=l=(0,f.__decorate)([(0,f.__param)(0,tR.IEditorGroupsService),(0,f.__param)(1,eN.IEditorService),(0,f.__param)(2,ib.IModelService),(0,f.__param)(3,iw.ILanguageService)],iD);let iT=class extends iE{static{c=this}static{this.PREFIX="edt mru "}constructor(e,t,i,o){super(c.PREFIX,e,t,i,o)}doGetEditors(){let e=[];for(let t of this.editorService.getEditors(L.EditorsOrder.MOST_RECENTLY_ACTIVE))e.push(t);return e}};iT=c=(0,f.__decorate)([(0,f.__param)(0,tR.IEditorGroupsService),(0,f.__param)(1,eN.IEditorService),(0,f.__param)(2,ib.IModelService),(0,f.__param)(3,iw.ILanguageService)],iT),e.s(["ActiveGroupEditorsByMostRecentlyUsedQuickAccess",0,iI,"AllEditorsByAppearanceQuickAccess",0,iD,"AllEditorsByMostRecentlyUsedQuickAccess",0,iT],988198);var iA=e.i(308271),ix=e.i(107700),iR=e.i(193653);let ik=class extends iR.AbstractEditorWithViewState{static{h=this}static{this.VIEW_STATE_PREFERENCE_KEY="textEditorViewState"}constructor(e,t,i,o,r,s,n,a,d,l){super(e,t,h.VIEW_STATE_PREFERENCE_KEY,i,o,r,s,n,a,d),this.fileService=l,this._onDidChangeSelection=this._register(new I.Emitter),this.onDidChangeSelection=this._onDidChangeSelection.event,this._onDidChangeScroll=this._register(new I.Emitter),this.onDidChangeScroll=this._onDidChangeScroll.event,this.inputListener=this._register(new D.MutableDisposable),this._register(this.textResourceConfigurationService.onDidChangeConfiguration(e=>this.handleConfigurationChangeEvent(e))),this._register(I.Event.any(this.editorGroupService.onDidAddGroup,this.editorGroupService.onDidRemoveGroup)(()=>{let e=this.computeAriaLabel();this.editorContainer?.setAttribute("aria-label",e),this.updateEditorControlOptions({ariaLabel:e})})),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e=>this.onDidChangeFileSystemProvider(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e=>this.onDidChangeFileSystemProvider(e.scheme)))}handleConfigurationChangeEvent(e){let t=this.getActiveResource();this.shouldHandleConfigurationChangeEvent(e,t)&&(this.isVisible()?this.updateEditorConfiguration(t):this.hasPendingConfigurationChange=!0)}shouldHandleConfigurationChangeEvent(e,t){return e.affectsConfiguration(t,"editor")||e.affectsConfiguration(t,"problems.visibility")}consumePendingConfigurationChangeEvent(){this.hasPendingConfigurationChange&&(this.updateEditorConfiguration(),this.hasPendingConfigurationChange=!1)}computeConfiguration(e){let t=(0,J.isObject)(e.editor)?(0,ix.deepClone)(e.editor):Object.create(null);return Object.assign(t,this.getConfigurationOverrides(e)),t.ariaLabel=this.computeAriaLabel(),t}computeAriaLabel(){return this.input?(0,el.computeEditorAriaLabel)(this.input,void 0,this.group,this.editorGroupService.count):(0,S.localize)(3512,"Editor")}onDidChangeFileSystemProvider(e){this.input&&this.getActiveResource()?.scheme===e&&this.updateReadonly(this.input)}onDidChangeInputCapabilities(e){this.input===e&&this.updateReadonly(e)}updateReadonly(e){this.updateEditorControlOptions({...this.getReadonlyConfiguration(e.isReadonly())})}getReadonlyConfiguration(e){return{readOnly:!!e,readOnlyMessage:"boolean"!=typeof e?e:void 0}}getConfigurationOverrides(e){return{overviewRulerLanes:3,lineNumbersMinChars:3,fixedOverflowWidgets:!0,...this.getReadonlyConfiguration(this.input?.isReadonly()),renderValidationDecorations:e.problems?.visibility!==!1?"on":"off"}}createEditor(e){this.editorContainer=e,this.createEditorControl(e,this.computeConfiguration(this.textResourceConfigurationService.getValue(this.getActiveResource()))),this.registerCodeEditorListeners()}registerCodeEditorListeners(){let e=this.getMainControl();e&&(this._register(e.onDidChangeModelLanguage(()=>this.updateEditorConfiguration())),this._register(e.onDidChangeModel(()=>this.updateEditorConfiguration())),this._register(e.onDidChangeCursorPosition(e=>this._onDidChangeSelection.fire({reason:this.toEditorPaneSelectionChangeReason(e)}))),this._register(e.onDidChangeModelContent(()=>this._onDidChangeSelection.fire({reason:L.EditorPaneSelectionChangeReason.EDIT}))),this._register(e.onDidScrollChange(()=>this._onDidChangeScroll.fire())))}toEditorPaneSelectionChangeReason(e){switch(e.source){case ed.TextEditorSelectionSource.PROGRAMMATIC:return L.EditorPaneSelectionChangeReason.PROGRAMMATIC;case ed.TextEditorSelectionSource.NAVIGATION:return L.EditorPaneSelectionChangeReason.NAVIGATION;case ed.TextEditorSelectionSource.JUMP:return L.EditorPaneSelectionChangeReason.JUMP;default:return L.EditorPaneSelectionChangeReason.USER}}getSelection(){let e=this.getMainControl();if(e){let t=e.getSelection();if(t)return new iM(t)}}async setInput(e,t,i,o){await super.setInput(e,t,i,o),this.inputListener.value=e.onDidChangeCapabilities(()=>this.onDidChangeInputCapabilities(e)),this.updateEditorConfiguration(),(0,J.assertReturnsDefined)(this.editorContainer).setAttribute("aria-label",this.computeAriaLabel())}clearInput(){this.inputListener.clear(),super.clearInput()}getScrollPosition(){let e=this.getMainControl();if(!e)throw Error("Control has not yet been initialized");return{scrollTop:e.getScrollTop()-e.getTopForLineNumber(1),scrollLeft:e.getScrollLeft()}}setScrollPosition(e){let t=this.getMainControl();if(!t)throw Error("Control has not yet been initialized");t.setScrollTop(e.scrollTop),e.scrollLeft&&t.setScrollLeft(e.scrollLeft)}setEditorVisible(e){e&&this.consumePendingConfigurationChangeEvent(),super.setEditorVisible(e)}toEditorViewStateResource(e){return e.resource}updateEditorConfiguration(e=this.getActiveResource()){let t;if(e&&(t=this.textResourceConfigurationService.getValue(e)),!t)return;let i=this.computeConfiguration(t),o=i;this.lastAppliedEditorOptions&&(o=(0,ix.distinct)(this.lastAppliedEditorOptions,o)),Object.keys(o).length>0&&(this.lastAppliedEditorOptions=i,this.updateEditorControlOptions(o))}getActiveResource(){let e=this.getMainControl();if(e){let t=e.getModel();if(t)return t.uri}if(this.input)return this.input.resource}dispose(){this.lastAppliedEditorOptions=void 0,super.dispose()}};ik=h=(0,f.__decorate)([(0,f.__param)(2,et.ITelemetryService),(0,f.__param)(3,E.IInstantiationService),(0,f.__param)(4,er.IStorageService),(0,f.__param)(5,tq.ITextResourceConfigurationService),(0,f.__param)(6,T.IThemeService),(0,f.__param)(7,eN.IEditorService),(0,f.__param)(8,tR.IEditorGroupsService),(0,f.__param)(9,ey.IFileService)],ik);class iM{static{this.TEXT_EDITOR_SELECTION_THRESHOLD=10}constructor(e){this.textSelection=e}compare(e){if(!(e instanceof iM))return L.EditorPaneSelectionCompareResult.DIFFERENT;let t=Math.min(this.textSelection.selectionStartLineNumber,this.textSelection.positionLineNumber),i=Math.min(e.textSelection.selectionStartLineNumber,e.textSelection.positionLineNumber);return t===i?L.EditorPaneSelectionCompareResult.IDENTICAL:Math.abs(t-i)<iM.TEXT_EDITOR_SELECTION_THRESHOLD?L.EditorPaneSelectionCompareResult.SIMILAR:L.EditorPaneSelectionCompareResult.DIFFERENT}restore(e){return{...e,selection:this.textSelection,selectionRevealType:ed.TextEditorSelectionRevealType.CenterIfOutsideViewport}}log(){return`line: ${this.textSelection.startLineNumber}-${this.textSelection.endLineNumber}, col: ${this.textSelection.startColumn}-${this.textSelection.endColumn}`}}e.s(["AbstractTextEditor",0,ik],979534);var iL=e.i(323249),iO=e.i(350803),iP=e.i(57967),iV=e.i(445152),iK=e.i(600345),iN=e.i(509046),iG=e.i(85280),iF=e.i(631524);let iW=class extends ik{static{u=this}static{this.ID=L.TEXT_DIFF_EDITOR_ID}get scopedContextKeyService(){if(!this.diffEditorControl)return;let e=this.diffEditorControl.getOriginalEditor(),t=this.diffEditorControl.getModifiedEditor();return(e.hasTextFocus()?e:t).invokeWithinContext(e=>e.get(z.IContextKeyService))}constructor(e,t,i,o,r,s,n,a,d,l){super(u.ID,e,t,i,o,r,n,s,a,d),this.preferencesService=l,this.diffEditorControl=void 0,this.inputLifecycleStopWatch=void 0,this._previousViewModel=null}getTitle(){return this.input?this.input.getName():(0,S.localize)(3509,"Text Diff Editor")}createEditorControl(e,t){this.diffEditorControl=this._register(this.instantiationService.createInstance(iF.DiffEditorWidget,e,t,{}))}updateEditorControlOptions(e){this.diffEditorControl?.updateOptions(e)}getMainControl(){return this.diffEditorControl?.getModifiedEditor()}async setInput(e,t,i,o){this._previousViewModel&&(this._previousViewModel.dispose(),this._previousViewModel=null),this.inputLifecycleStopWatch=void 0,await super.setInput(e,t,i,o);try{let r=await e.resolve();if(o.isCancellationRequested)return;if(!(r instanceof iP.TextDiffEditorModel))return void this.openAsBinary(e,t);let s=(0,J.assertReturnsDefined)(this.diffEditorControl),n=r.textDiffEditorModel?s.createViewModel(r.textDiffEditorModel):null;this._previousViewModel=n,await n?.waitForDiff(),s.setModel(n);let a=!1;(0,L.isTextEditorViewState)(t?.viewState)||(a=this.restoreTextDiffEditorViewState(e,t,i,s));let d=!1;t&&(d=(0,iL.applyTextEditorOptions)(t,s,iK.ScrollType.Immediate)),d||a||s.revealFirstDiff(),s.updateOptions({...this.getReadonlyConfiguration(r.modifiedModel?.isReadonly()),originalEditable:!r.originalModel?.isReadonly()}),s.handleInitialized(),this.inputLifecycleStopWatch=new iG.StopWatch(!1)}catch(i){await this.handleSetInputError(i,e,t)}}async handleSetInputError(e,t,i){if(this.isFileBinaryError(e))return this.openAsBinary(t,i);if(e.fileOperationResult===ev.FileOperationResult.FILE_TOO_LARGE){let o;throw o=e instanceof ev.TooLargeFileOperationError?(0,S.localize)(3510,"At least one file is not displayed in the text compare editor because it is very large ({0}).",ev.ByteSize.formatSize(e.size)):(0,S.localize)(3511,"At least one file is not displayed in the text compare editor because it is very large."),(0,L.createTooLargeFileError)(this.group,t,i,o,this.preferencesService)}throw e}restoreTextDiffEditorViewState(e,t,i,o){let r=this.loadEditorViewState(e,i);return!!r&&(t?.selection&&r.modified&&(r.modified.cursorState=[]),o.restoreViewState(r),t?.revealIfVisible&&o.revealFirstDiff(),!0)}openAsBinary(e,t){let i=e.original,o=e.modified,r=this.instantiationService.createInstance(iO.DiffEditorInput,e.getName(),e.getDescription(),i,o,!0),s=q.Registry.as(L.EditorExtensions.EditorFactory).getFileEditorFactory();s.isFileEditor(i)&&i.setForceOpenAsBinary(),s.isFileEditor(o)&&o.setForceOpenAsBinary(),this.group.replaceEditors([{editor:e,replacement:r,options:{...t,activation:ed.EditorActivation.PRESERVE,pinned:this.group.isPinned(e),sticky:this.group.isSticky(e)}}])}setOptions(e){super.setOptions(e),e&&(0,iL.applyTextEditorOptions)(e,(0,J.assertReturnsDefined)(this.diffEditorControl),iK.ScrollType.Smooth)}shouldHandleConfigurationChangeEvent(e,t){return!!super.shouldHandleConfigurationChangeEvent(e,t)||e.affectsConfiguration(t,"diffEditor")||e.affectsConfiguration(t,"accessibility.verbosity.diffEditor")}computeConfiguration(e){let t=super.computeConfiguration(e);if((0,J.isObject)(e.diffEditor)){let i=(0,ix.deepClone)(e.diffEditor);i.diffCodeLens=i.codeLens,delete i.codeLens,i.diffWordWrap=i.wordWrap,delete i.wordWrap,Object.assign(t,i)}return t.accessibilityVerbose=e.accessibility?.verbosity?.diffEditor??!1,t}getConfigurationOverrides(e){return{...super.getConfigurationOverrides(e),...this.getReadonlyConfiguration(this.input?.isReadonly()),originalEditable:this.input instanceof iO.DiffEditorInput&&!this.input.original.isReadonly(),lineDecorationsWidth:"2ch"}}updateReadonly(e){e instanceof iO.DiffEditorInput?this.diffEditorControl?.updateOptions({...this.getReadonlyConfiguration(e.isReadonly()),originalEditable:!e.original.isReadonly()}):super.updateReadonly(e)}isFileBinaryError(e){return Array.isArray(e)?e.some(e=>this.isFileBinaryError(e)):e.textFileOperationResult===iV.TextFileOperationResult.FILE_IS_BINARY}clearInput(){this._previousViewModel&&(this._previousViewModel.dispose(),this._previousViewModel=null),super.clearInput();let e=this.inputLifecycleStopWatch?.elapsed();this.inputLifecycleStopWatch=void 0,"number"==typeof e&&this.logInputLifecycleTelemetry(e,this.getControl()?.getModel()?.modified?.getLanguageId()),this.diffEditorControl?.setModel(null)}logInputLifecycleTelemetry(e,t){let i=!1;this.diffEditorControl instanceof iF.DiffEditorWidget&&(i=this.diffEditorControl.collapseUnchangedRegions),this.telemetryService.publicLog2("diffEditor.editorVisibleTime",{editorVisibleTimeMs:e,languageId:t??"",collapseUnchangedRegions:i})}getControl(){return this.diffEditorControl}focus(){super.focus(),this.diffEditorControl?.focus()}hasFocus(){return this.diffEditorControl?.hasTextFocus()||super.hasFocus()}setEditorVisible(e){super.setEditorVisible(e),e?this.diffEditorControl?.onVisible():this.diffEditorControl?.onHide()}layout(e){this.diffEditorControl?.layout(e)}setBoundarySashes(e){this.diffEditorControl?.setBoundarySashes(e)}tracksEditorViewState(e){return e instanceof iO.DiffEditorInput}computeEditorViewState(e){if(!this.diffEditorControl)return;let t=this.diffEditorControl.getModel();if(!t?.modified||!t.original)return;let i=this.toEditorViewStateResource(t);if(i&&(0,eW.isEqual)(i,e))return this.diffEditorControl.saveViewState()??void 0}toEditorViewStateResource(e){let t,i;if(e instanceof iO.DiffEditorInput?(t=e.original.resource,i=e.modified.resource):(0,L.isEditorInput)(e)||(t=e.original.uri,i=e.modified.uri),t&&i)return e$.URI.from({scheme:"diff",path:`${(0,Q.multibyteAwareBtoa)(t.toString())}${(0,Q.multibyteAwareBtoa)(i.toString())}`})}};iW=u=(0,f.__decorate)([(0,f.__param)(1,et.ITelemetryService),(0,f.__param)(2,E.IInstantiationService),(0,f.__param)(3,er.IStorageService),(0,f.__param)(4,tq.ITextResourceConfigurationService),(0,f.__param)(5,eN.IEditorService),(0,f.__param)(6,T.IThemeService),(0,f.__param)(7,tR.IEditorGroupsService),(0,f.__param)(8,ey.IFileService),(0,f.__param)(9,iN.IPreferencesService)],iW),e.s(["TextDiffEditor",0,iW],728489);var iz=e.i(320155),iB=e.i(292035),iU=e.i(219170),iH=e.i(163731);let i$="toggle.diff.renderSideBySide",iq="workbench.action.compareEditor.nextChange",iY="workbench.action.compareEditor.previousChange",ij="workbench.action.compareEditor.focusPrimarySide",iX="workbench.action.compareEditor.focusSecondarySide",iJ="workbench.action.compareEditor.focusOtherSide",iZ="workbench.action.compareEditor.openSide",iQ="toggle.diff.ignoreTrimWhitespace",i0="workbench.action.compareEditor.swapSides";function i1(){var e;let t;function i(e,t){let i=e.get(eN.IEditorService),o=t.length>0&&t[0]instanceof e$.URI?t[0]:void 0;for(let e of[i.activeEditorPane,...i.visibleEditorPanes])if(e instanceof iW&&(!o||e.input instanceof iO.DiffEditorInput&&(0,eW.isEqual)(e.input.primary.resource,o)))return e}function o(e,t,o){let r=i(e,t);r&&r.getControl()?.goToDiff(o?"next":"previous")}function r(e,o,s){let n=i(e,o);if(n)switch(s){case t.Original:n.getControl()?.getOriginalEditor().focus();break;case t.Modified:n.getControl()?.getModifiedEditor().focus();break;case t.Toggle:if(n.getControl()?.getModifiedEditor().hasWidgetFocus())return r(e,o,t.Original);return r(e,o,t.Modified)}}async function s(e,t){let o=e.get(eN.IEditorService),r=i(e,t),s=r?.group,n=r?.input;if(!r||void 0===s||!(n instanceof iO.DiffEditorInput)||!n.modified.resource)return;let a=n.toUntyped({preserveViewState:s.id,preserveResource:!0});if(a){if(n.modified.isModified()&&0===o.findEditors({resource:n.modified.resource,typeId:n.modified.typeId,editorId:n.modified.editorId}).length){let e={...a.modified};e.options||(e.options={}),e.options.pinned=!0,e.options.inactive=!0,await o.openEditor(e,s)}await o.replaceEditors([{editor:n,replacement:{...a,original:a.modified,modified:a.original,options:{...a.options,pinned:!0}}}],s)}}tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:iZ,weight:tE.KeybindingWeight.WorkbenchContrib,when:ig.EditorContextKeys.inDiffEditor,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.Shift|tC.KeyCode.KeyO),handler:async e=>{let t,i=e.get(eN.IEditorService),o=e.get(tR.IEditorGroupsService),r=i.activeEditor,s=i.activeTextEditorControl;if((0,iH.isDiffEditor)(s)&&r instanceof iO.DiffEditorInput)return t=s.getOriginalEditor().hasTextFocus()?r.original:r.modified,o.activeGroup.openEditor(t)}}),eL.MenuRegistry.appendMenuItem(eL.MenuId.CommandPalette,{command:{id:iZ,title:(0,S.localize2)(3111,"Open Active Diff Side")}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:iq,weight:tE.KeybindingWeight.WorkbenchContrib,when:G.TextCompareEditorVisibleContext,primary:tC.KeyMod.Alt|tC.KeyCode.F5,handler:(e,...t)=>o(e,t,!0)}),eL.MenuRegistry.appendMenuItem(eL.MenuId.CommandPalette,{command:{id:iq,title:(0,S.localize2)(3112,"Go to Next Change")}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:iY,weight:tE.KeybindingWeight.WorkbenchContrib,when:G.TextCompareEditorVisibleContext,primary:tC.KeyMod.Alt|tC.KeyMod.Shift|tC.KeyCode.F5,handler:(e,...t)=>o(e,t,!1)}),eL.MenuRegistry.appendMenuItem(eL.MenuId.CommandPalette,{command:{id:iY,title:(0,S.localize2)(3113,"Go to Previous Change")}}),(e=t||(t={}))[e.Original=0]="Original",e[e.Modified=1]="Modified",e[e.Toggle=2]="Toggle",tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:i$,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:void 0,handler:(e,...t)=>(function(e,t){let o=e.get(tq.ITextResourceConfigurationService),r=i(e,t),s=r?.getControl()?.getModifiedEditor()?.getModel();if(!s)return;let n="diffEditor.renderSideBySide",a=o.getValue(s.uri,n);o.updateValue(s.uri,n,!a)})(e,t)}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:ij,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:void 0,handler:(e,...i)=>r(e,i,t.Modified)}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:iX,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:void 0,handler:(e,...i)=>r(e,i,t.Original)}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:iJ,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:void 0,handler:(e,...i)=>r(e,i,t.Toggle)}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:iQ,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:void 0,handler:(e,...t)=>(function(e,t){let o=e.get(tq.ITextResourceConfigurationService),r=i(e,t),s=r?.getControl()?.getModifiedEditor()?.getModel();if(!s)return;let n="diffEditor.ignoreTrimWhitespace",a=o.getValue(s.uri,n);o.updateValue(s.uri,n,!a)})(e,t)}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:i0,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:void 0,handler:(e,...t)=>s(e,t)}),eL.MenuRegistry.appendMenuItem(eL.MenuId.CommandPalette,{command:{id:i$,title:(0,S.localize2)(3114,"Toggle Inline View"),category:(0,S.localize)(3115,"Compare")},when:G.TextCompareEditorActiveContext}),eL.MenuRegistry.appendMenuItem(eL.MenuId.CommandPalette,{command:{id:i0,title:(0,S.localize2)(3116,"Swap Left and Right Editor Side"),category:(0,S.localize)(3115,"Compare")},when:e0.ContextKeyExpr.and(G.TextCompareEditorActiveContext,G.ActiveCompareEditorCanSwapContext)})}e.s(["DIFF_FOCUS_OTHER_SIDE",0,iJ,"DIFF_FOCUS_PRIMARY_SIDE",0,ij,"DIFF_FOCUS_SECONDARY_SIDE",0,iX,"DIFF_SWAP_SIDES",0,i0,"GOTO_NEXT_CHANGE",0,iq,"GOTO_PREVIOUS_CHANGE",0,iY,"TOGGLE_DIFF_IGNORE_TRIM_WHITESPACE",0,iQ,"TOGGLE_DIFF_SIDE_BY_SIDE",0,i$,"registerDiffEditorCommands",0,i1],199466);var i2=e.i(962747);let i3="workbench.action.closeUnmodifiedEditors",i5="workbench.action.closeEditorsInGroup",i6="workbench.action.closeEditorsAndGroup",i4="workbench.action.closeEditorsToTheRight",i9="workbench.action.closeActiveEditor",i8="workbench.action.closeActivePinnedEditor",i7="workbench.action.closeGroup",oe="workbench.action.closeOtherEditors",ot="moveActiveEditor",oi="copyActiveEditor",oo="layoutEditorGroups",or="workbench.action.keepEditor",os="workbench.action.toggleKeepEditors",on="workbench.action.toggleEditorGroupLock",oa="workbench.action.lockEditorGroup",od="workbench.action.unlockEditorGroup",ol="workbench.action.showEditorsInGroup",oc="workbench.action.reopenWithEditor",oh="workbench.action.pinEditor",ou="workbench.action.unpinEditor",op="workbench.action.splitEditor",og="workbench.action.splitEditorUp",om="workbench.action.splitEditorDown",ov="workbench.action.splitEditorLeft",oy="workbench.action.splitEditorRight",oC="workbench.action.moveEditorToAboveGroup",ob="workbench.action.moveEditorToBelowGroup",ow="workbench.action.moveEditorToLeftGroup",of="workbench.action.moveEditorToRightGroup",oS="workbench.action.toggleMaximizeEditorGroup",o_="workbench.action.splitEditorInGroup",oE="workbench.action.joinEditorInGroup",oI="workbench.action.toggleSplitEditorInGroupLayout",oD="workbench.action.focusFirstSideEditor",oT="workbench.action.focusSecondSideEditor",oA="workbench.action.openEditorAtIndex",ox="workbench.action.moveEditorToNewWindow",oR="workbench.action.copyEditorToNewWindow",ok="workbench.action.moveEditorGroupToNewWindow",oM="workbench.action.copyEditorGroupToNewWindow",oL="workbench.action.newEmptyEditorWindow",oO="_workbench.open",oP="_workbench.diff",oV=[op,i9,ou,od,oS],oK=function(e){return!!(0,J.isObject)(e)&&!!(0,J.isString)(e.to)&&(!!(0,J.isUndefined)(e.by)||!!(0,J.isString)(e.by))&&(!!(0,J.isUndefined)(e.value)||!!(0,J.isNumber)(e.value))};function oN(e,t,i){if(!i.groupedEditors.length)return;let{group:o,editors:r}=i.groupedEditors[0],s=i.preserveFocus,n=e.addGroup(o,t);for(let e of r)e&&!e.hasCapability(L.EditorInputCapabilities.Singleton)&&o.copyEditor(e,n,{preserveFocus:s});n.focus()}e.s(["API_OPEN_DIFF_EDITOR_COMMAND_ID",0,oP,"API_OPEN_EDITOR_COMMAND_ID",0,oO,"CLOSE_EDITORS_AND_GROUP_COMMAND_ID",0,i6,"CLOSE_EDITORS_IN_GROUP_COMMAND_ID",0,i5,"CLOSE_EDITORS_TO_THE_RIGHT_COMMAND_ID",0,i4,"CLOSE_EDITOR_COMMAND_ID",0,i9,"CLOSE_EDITOR_GROUP_COMMAND_ID",0,i7,"CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID",0,oe,"CLOSE_PINNED_EDITOR_COMMAND_ID",0,i8,"CLOSE_SAVED_EDITORS_COMMAND_ID",0,i3,"COPY_ACTIVE_EDITOR_COMMAND_ID",0,oi,"COPY_EDITOR_GROUP_INTO_NEW_WINDOW_COMMAND_ID",0,oM,"COPY_EDITOR_INTO_NEW_WINDOW_COMMAND_ID",0,oR,"EDITOR_CORE_NAVIGATION_COMMANDS",0,oV,"FOCUS_FIRST_SIDE_EDITOR",0,oD,"FOCUS_SECOND_SIDE_EDITOR",0,oT,"JOIN_EDITOR_IN_GROUP",0,oE,"KEEP_EDITOR_COMMAND_ID",0,or,"LAYOUT_EDITOR_GROUPS_COMMAND_ID",0,oo,"LOCK_GROUP_COMMAND_ID",0,oa,"MOVE_ACTIVE_EDITOR_COMMAND_ID",0,ot,"MOVE_EDITOR_GROUP_INTO_NEW_WINDOW_COMMAND_ID",0,ok,"MOVE_EDITOR_INTO_ABOVE_GROUP",0,oC,"MOVE_EDITOR_INTO_BELOW_GROUP",0,ob,"MOVE_EDITOR_INTO_LEFT_GROUP",0,ow,"MOVE_EDITOR_INTO_NEW_WINDOW_COMMAND_ID",0,ox,"MOVE_EDITOR_INTO_RIGHT_GROUP",0,of,"NEW_EMPTY_EDITOR_WINDOW_COMMAND_ID",0,oL,"PIN_EDITOR_COMMAND_ID",0,oh,"REOPEN_WITH_COMMAND_ID",0,oc,"SHOW_EDITORS_IN_GROUP",0,ol,"SPLIT_EDITOR",0,op,"SPLIT_EDITOR_DOWN",0,om,"SPLIT_EDITOR_IN_GROUP",0,o_,"SPLIT_EDITOR_LEFT",0,ov,"SPLIT_EDITOR_RIGHT",0,oy,"SPLIT_EDITOR_UP",0,og,"TOGGLE_KEEP_EDITORS_COMMAND_ID",0,os,"TOGGLE_LOCK_GROUP_COMMAND_ID",0,on,"TOGGLE_MAXIMIZE_EDITOR_GROUP",0,oS,"TOGGLE_SPLIT_EDITOR_IN_GROUP_LAYOUT",0,oI,"UNLOCK_GROUP_COMMAND_ID",0,od,"UNPIN_EDITOR_COMMAND_ID",0,ou,"setup",0,function(){let e={type:"object",required:["to"],properties:{to:{type:"string",enum:["left","right"]},by:{type:"string",enum:["tab","group"]},value:{type:"number"}}};function t(e,o=Object.create(null),r){o.to=o.to||"right",o.by=o.by||"tab",o.value="number"==typeof o.value?o.value:1;let s=r.get(tR.IEditorGroupsService).activeGroup,n=s.selectedEditors;if(n.length>0)switch(o.by){case"tab":if(e){var a=o,d=s,l=n;let e=a.to;for(let t of("first"===e||"right"===e?l=[...l].reverse():"position"===e&&(a.value??1)<d.getIndexOfEditor(l[0])&&(l=[...l].reverse()),l))!function(e,t,i){let o=t.getIndexOfEditor(i);switch(e.to){case"first":o=0;break;case"last":o=t.count-1;break;case"left":o-=e.value??1;break;case"right":o+=e.value??1;break;case"center":o=Math.round(t.count/2)-1;break;case"position":o=(e.value??1)-1}o=o<0?0:o>=t.count?t.count-1:o,t.moveEditor(i,t,{index:o})}(a,d,t);return}break;case"group":return i(e,o,s,n,r)}}function i(e,t,i,o,r){let s,n=r.get(tR.IEditorGroupsService),a=r.get(eQ.IConfigurationService);switch(t.to){case"left":(s=n.findGroup({direction:_.GroupDirection.LEFT},i))||(s=n.addGroup(i,_.GroupDirection.LEFT));break;case"right":(s=n.findGroup({direction:_.GroupDirection.RIGHT},i))||(s=n.addGroup(i,_.GroupDirection.RIGHT));break;case"up":(s=n.findGroup({direction:_.GroupDirection.UP},i))||(s=n.addGroup(i,_.GroupDirection.UP));break;case"down":(s=n.findGroup({direction:_.GroupDirection.DOWN},i))||(s=n.addGroup(i,_.GroupDirection.DOWN));break;case"first":s=n.findGroup({location:_.GroupLocation.FIRST},i);break;case"last":s=n.findGroup({location:_.GroupLocation.LAST},i);break;case"previous":if(!(s=n.findGroup({location:_.GroupLocation.PREVIOUS},i))){let e=(0,_.preferredSideBySideGroupDirection)(a)===_.GroupDirection.RIGHT?_.GroupDirection.LEFT:_.GroupDirection.UP;s=n.addGroup(i,e)}break;case"next":(s=n.findGroup({location:_.GroupLocation.NEXT},i))||(s=n.addGroup(i,(0,_.preferredSideBySideGroupDirection)(a)));break;case"center":s=n.getGroups(_.GroupsOrder.GRID_APPEARANCE)[n.count/2-1];break;case"position":s=n.getGroups(_.GroupsOrder.GRID_APPEARANCE)[(t.value??1)-1]}if(s){let t=(0,V.prepareMoveCopyEditors)(i,o);e?i.moveEditors(t,s):i.id!==s.id&&i.copyEditors(t,s),s.focus()}}function o(e,t){t&&"object"==typeof t&&e.get(tR.IEditorGroupsService).applyLayout(t)}function r(e,t,i){return e?[{...e.editorOptions,...t??Object.create(null)},e.sideBySide?tk.SIDE_GROUP:i]:[t,i]}function s(e,t,...i){let o,r=e.get(tR.IEditorGroupsService),n=e.get(eN.IEditorService);if(o=!t&&!i.length&&("keyboard"===r.partOptions.preventPinnedEditorClose||"keyboardAndMouse"===r.partOptions.preventPinnedEditorClose)){let e=r.activeGroup,t=e.activeEditor;if(t&&e.isSticky(t)){let t=e.getEditors(L.EditorsOrder.MOST_RECENTLY_ACTIVE,{excludeSticky:!0})[0];if(t)return e.openEditor(t);let i=n.getEditors(L.EditorsOrder.MOST_RECENTLY_ACTIVE,{excludeSticky:!0})[0];if(i)return Promise.resolve(r.getGroup(i.groupId)?.openEditor(i.editor))}}let a=(0,i2.resolveCommandsContext)(i,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService)),d=a.preserveFocus;return Promise.all(a.groupedEditors.map(async({group:e,editors:t})=>{let i=t.filter(t=>!o||!e.isSticky(t));await e.closeEditors(i,{preserveFocus:d})}))}async function n(e,t,...i){let o=e.get(eN.IEditorService),r=e.get(ip.IEditorResolverService),s=e.get(et.ITelemetryService),a=(0,i2.resolveCommandsContext)(i,o,e.get(tR.IEditorGroupsService),e.get(tT.IListService)),d=new Map;for(let{group:e,editors:i}of a.groupedEditors)for(let n of i){let i=n.toUntyped();if(!i)return;i.options={...o.activeEditorPane?.options,override:t};let a=await r.resolveEditor(i,e);if(!(0,L.isEditorInputWithOptionsAndGroup)(a))return;let l=d.get(e);l||(l=[],d.set(e,l)),l.push({editor:n,replacement:a.editor,forceReplaceDirty:n.resource?.scheme===ez.Schemas.untitled,options:a.options}),s.publicLog2("workbenchEditorReopen",{scheme:n.resource?.scheme??"",ext:n.resource?(0,eW.extname)(n.resource):"",from:n.editorId??"",to:a.editor.editorId??""})}for(let[e,t]of d)await e.replaceEditors(t),await e.openEditor(t[0].replacement)}function a(e,t,...i){let o=(0,i2.resolveCommandsContext)(i,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService)),r=o.groupedEditors[0]?.group;r?.lock(t??!r.isLocked)}async function d(e,t){let i=e.get(E.IInstantiationService);if(!t.groupedEditors.length)return;let{group:o,editors:r}=t.groupedEditors[0],s=r[0];s&&await o.replaceEditors([{editor:s,replacement:i.createInstance(F.SideBySideEditorInput,void 0,void 0,s,s),forceReplaceDirty:!0}])}async function l(e){let t;if(!e.groupedEditors.length)return;let{group:i,editors:o}=e.groupedEditors[0],r=o[0];if(!r||!(r instanceof F.SideBySideEditorInput))return;let s=i.activeEditorPane;if(s instanceof iA.SideBySideEditor&&i.activeEditor===r){for(let e of[s.getPrimaryEditorPane(),s.getSecondaryEditorPane()])if(e?.hasFocus()){t={viewState:e.getViewState()};break}}await i.replaceEditors([{editor:r,replacement:r.primary,options:t}])}tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:ot,weight:tE.KeybindingWeight.WorkbenchContrib,when:ig.EditorContextKeys.editorTextFocus,primary:0,handler:(e,i)=>t(!0,i,e),metadata:{description:(0,S.localize)(3380,"Move the active editor by tabs or groups"),args:[{name:(0,S.localize)(3381,"Active editor move argument"),description:(0,S.localize)(3382,"Argument Properties:\n * 'to': String value providing where to move.\n * 'by': String value providing the unit for move (by tab or by group).\n * 'value': Number value providing how many positions or an absolute position to move."),constraint:oK,schema:e}]}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:oi,weight:tE.KeybindingWeight.WorkbenchContrib,when:ig.EditorContextKeys.editorTextFocus,primary:0,handler:(e,i)=>t(!1,i,e),metadata:{description:(0,S.localize)(3383,"Copy the active editor by groups"),args:[{name:(0,S.localize)(3384,"Active editor copy argument"),description:(0,S.localize)(3385,"Argument Properties:\n * 'to': String value providing where to copy.\n * 'value': Number value providing how many positions or an absolute position to copy."),constraint:oK,schema:e}]}}),[{id:oC,to:"up"},{id:ob,to:"down"},{id:ow,to:"left"},{id:of,to:"right"}].forEach(({id:e,to:t})=>{eZ.CommandsRegistry.registerCommand(e,function(e,...o){let r=(0,i2.resolveCommandsContext)(o,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService));r.groupedEditors.length&&i(!0,{to:t},r.groupedEditors[0].group,r.groupedEditors[0].editors,e)})}),eZ.CommandsRegistry.registerCommand(oo,(e,t)=>{o(e,t)}),eZ.CommandsRegistry.registerCommand({id:"vscode.setEditorLayout",handler:(e,t)=>o(e,t),metadata:{description:`Set the editor layout. Editor layout is represented as a tree of groups in which the first group is the root group of the layout.
14
+ The orientation of the first group is 0 (horizontal) by default unless specified otherwise. The other orientations are 1 (vertical).
15
+ The orientation of subsequent groups is the opposite of the orientation of the group that contains it.
16
+ Here are some examples: A layout representing 1 row and 2 columns: { orientation: 0, groups: [{}, {}] }.
17
+ A layout representing 3 rows and 1 column: { orientation: 1, groups: [{}, {}, {}] }.
18
+ A layout representing 3 rows and 1 column in which the second row has 2 columns: { orientation: 1, groups: [{}, { groups: [{}, {}] }, {}] }
19
+ `,args:[{name:"args",schema:{type:"object",required:["groups"],properties:{orientation:{type:"number",default:0,description:"The orientation of the root group in the layout. 0 for horizontal, 1 for vertical.",enum:[0,1],enumDescriptions:[(0,S.localize)(3386,"Horizontal"),(0,S.localize)(3387,"Vertical")]},groups:{$ref:"#/definitions/editorGroupsSchema",default:[{},{}]}}}}]}}),eZ.CommandsRegistry.registerCommand({id:"vscode.getEditorLayout",handler:e=>e.get(tR.IEditorGroupsService).getLayout(),metadata:{description:"Get Editor Layout",args:[],returns:"An editor layout object, in the same format as vscode.setEditorLayout"}}),i1(),eZ.CommandsRegistry.registerCommand({id:"vscode.open",handler:(e,t)=>{e.get(es.ICommandService).executeCommand(oO,t)},metadata:{description:"Opens the provided resource in the editor.",args:[{name:"Uri"}]}}),eZ.CommandsRegistry.registerCommand(oO,async function(e,t,i,o,s){let n=e.get(eN.IEditorService),a=e.get(tR.IEditorGroupsService),d=e.get(iv.IOpenerService),l=e.get(iB.IPathService),c=e.get(eQ.IConfigurationService),h=e.get(iU.IUntitledTextEditorService),u="string"==typeof t?t:e$.URI.from(t,!0),[p,g]=i??[];if(g||"number"==typeof p||(0,ez.matchesScheme)(u,ez.Schemas.untitled)){let e,[t,i]=r(s,g,p),d=e$.URI.isUri(u)?u:e$.URI.parse(u);e=h.isUntitledWithAssociatedResource(d)?{resource:d.with({scheme:l.defaultUriScheme}),forceUntitled:!0,options:t,label:o}:{resource:d,options:t,label:o},await n.openEditor(e,(0,iz.columnToEditorGroup)(a,c,i))}else{if((0,ez.matchesScheme)(u,ez.Schemas.command))return;await d.open(u,{openToSide:s?.sideBySide,editorOptions:s?.editorOptions})}}),eZ.CommandsRegistry.registerCommand({id:"vscode.diff",handler:(e,t,i,o)=>{e.get(es.ICommandService).executeCommand(oP,t,i,o)},metadata:{description:"Opens the provided resources in the diff editor to compare their contents.",args:[{name:"left",description:"Left-hand side resource of the diff editor"},{name:"right",description:"Right-hand side resource of the diff editor"},{name:"title",description:"Human readable title for the diff editor"}]}}),eZ.CommandsRegistry.registerCommand(oP,async function(e,t,i,o,s,n){let a,d,l=e.get(eN.IEditorService),c=e.get(tR.IEditorGroupsService),h=e.get(eQ.IConfigurationService),[u,p]=s??[],[g,m]=r(n,p,u);"string"==typeof o?a=o:o&&(a=o.label,d=o.description),await l.openEditor({original:{resource:e$.URI.from(t,!0)},modified:{resource:e$.URI.from(i,!0)},label:a,description:d,options:g},(0,iz.columnToEditorGroup)(c,h,m))}),eZ.CommandsRegistry.registerCommand("_workbench.openWith",async(e,t,i,o)=>{let r=e.get(eN.IEditorService),s=e.get(tR.IEditorGroupsService),n=e.get(eQ.IConfigurationService),[a,d]=o??[];await r.openEditor({resource:e$.URI.from(t,!0),options:{pinned:!0,...d,override:i}},(0,iz.columnToEditorGroup)(s,n,a))}),eZ.CommandsRegistry.registerCommand({id:"vscode.changes",handler:(e,t,i)=>{e.get(es.ICommandService).executeCommand("_workbench.changes",t,i)},metadata:{description:"Opens a list of resources in the changes editor to compare their contents.",args:[{name:"title",description:"Human readable title for the diff editor"},{name:"resources",description:"List of resources to open in the changes editor"}]}}),eZ.CommandsRegistry.registerCommand("_workbench.changes",async(e,t,i)=>{let o=e.get(eN.IEditorService),r=[];for(let[e,t,o]of i)r.push({resource:e$.URI.revive(e),original:{resource:e$.URI.revive(t)},modified:{resource:e$.URI.revive(o)}});await o.openEditor({resources:r,label:t})}),eZ.CommandsRegistry.registerCommand("_workbench.openMultiDiffEditor",async(e,t)=>{let i=e.get(eN.IEditorService),o=t.resources?.map(e=>({original:{resource:e$.URI.revive(e.originalUri)},modified:{resource:e$.URI.revive(e.modifiedUri)}})),r=t.reveal?.modifiedUri?e$.URI.revive(t.reveal.modifiedUri):void 0,s=r&&o?o.find(e=>(0,eW.isEqual)(e.modified.resource,r)):void 0;t.reveal&&!s&&console.error("Reveal resource not found");let n={viewState:s?{revealData:{resource:{original:s.original.resource,modified:s.modified.resource},range:t.reveal?.range}}:void 0};await i.openEditor({multiDiffSource:t.multiDiffSourceUri?e$.URI.revive(t.multiDiffSourceUri):void 0,resources:o,label:t.title,options:n})}),function(){let e=(e,t)=>{let i=e.get(eN.IEditorService),o=i.activeEditorPane;if(o&&"number"==typeof t){let e=o.group.getEditorByIndex(t);e&&i.openEditor(e)}};eZ.CommandsRegistry.registerCommand({id:oA,handler:e});for(let i=0;i<9;i++){let o=i,r=i+1;tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:oA+r,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:tC.KeyMod.Alt|t(r),mac:{primary:tC.KeyMod.WinCtrl|t(r)},handler:t=>e(t,o)})}function t(e){switch(e){case 0:return tC.KeyCode.Digit0;case 1:return tC.KeyCode.Digit1;case 2:return tC.KeyCode.Digit2;case 3:return tC.KeyCode.Digit3;case 4:return tC.KeyCode.Digit4;case 5:return tC.KeyCode.Digit5;case 6:return tC.KeyCode.Digit6;case 7:return tC.KeyCode.Digit7;case 8:return tC.KeyCode.Digit8;case 9:return tC.KeyCode.Digit9}throw Error("invalid index")}}(),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:i9,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:tC.KeyMod.CtrlCmd|tC.KeyCode.KeyW,win:{primary:tC.KeyMod.CtrlCmd|tC.KeyCode.F4,secondary:[tC.KeyMod.CtrlCmd|tC.KeyCode.KeyW]},handler:(e,...t)=>s(e,!1,...t)}),eZ.CommandsRegistry.registerCommand(i8,(e,...t)=>s(e,!0,...t)),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:i5,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyCode.KeyW),handler:(e,...t)=>Promise.all((0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService)).groupedEditors.map(async({group:e})=>{await e.closeAllEditors({excludeSticky:!0})}))}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:i7,weight:tE.KeybindingWeight.WorkbenchContrib,when:e0.ContextKeyExpr.and(G.ActiveEditorGroupEmptyContext,G.MultipleEditorGroupsContext),primary:tC.KeyMod.CtrlCmd|tC.KeyCode.KeyW,win:{primary:tC.KeyMod.CtrlCmd|tC.KeyCode.F4,secondary:[tC.KeyMod.CtrlCmd|tC.KeyCode.KeyW]},handler:(e,...t)=>{let i=e.get(tR.IEditorGroupsService),o=(0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),i,e.get(tT.IListService));o.groupedEditors.length&&i.removeGroup(o.groupedEditors[0].group)}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:i3,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyCode.KeyU),handler:(e,...t)=>{let i=(0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService));return Promise.all(i.groupedEditors.map(async({group:e})=>{await e.closeEditors({savedOnly:!0,excludeSticky:!0},{preserveFocus:i.preserveFocus})}))}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:oe,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:void 0,mac:{primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Alt|tC.KeyCode.KeyT},handler:(e,...t)=>{let i=(0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService));return Promise.all(i.groupedEditors.map(async({group:e,editors:t})=>{let o=e.getEditors(L.EditorsOrder.SEQUENTIAL,{excludeSticky:!0}).filter(e=>!t.includes(e));for(let i of t)i&&e.pinEditor(i);await e.closeEditors(o,{preserveFocus:i.preserveFocus})}))}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:i4,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:void 0,handler:async(e,...t)=>{let i=(0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService));if(i.groupedEditors.length){let{group:e,editors:t}=i.groupedEditors[0];e.activeEditor&&e.pinEditor(e.activeEditor),await e.closeEditors({direction:L.CloseDirection.RIGHT,except:t[0],excludeSticky:!0},{preserveFocus:i.preserveFocus})}}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:oc,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:void 0,handler:(e,...t)=>n(e,ed.EditorResolution.PICK,...t)}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"reopenActiveEditorWith",weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:void 0,handler:(e,t,...i)=>n(e,t??ed.EditorResolution.PICK,...i)}),eZ.CommandsRegistry.registerCommand(i6,async(e,...t)=>{let i=e.get(tR.IEditorGroupsService),o=(0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),i,e.get(tT.IListService));if(o.groupedEditors.length){let{group:e}=o.groupedEditors[0];await e.closeAllEditors(),0===e.count&&i.getGroup(e.id)&&i.removeGroup(e)}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:or,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyCode.Enter),handler:async(e,...t)=>{for(let{group:i,editors:o}of(0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService)).groupedEditors)for(let e of o)i.pinEditor(e)}}),eZ.CommandsRegistry.registerCommand({id:os,handler:e=>{let t=e.get(eQ.IConfigurationService),i=t.getValue("workbench.editor.enablePreview");t.updateValue("workbench.editor.enablePreview",!0!==i)}}),(0,im.registerAction2)(class extends im.Action2{constructor(){super({id:on,title:(0,S.localize2)(3395,"Toggle Editor Group Lock"),category:tw.Categories.View,f1:!0})}async run(e,...t){a(e,void 0,...t)}}),(0,im.registerAction2)(class extends im.Action2{constructor(){super({id:oa,title:(0,S.localize2)(3396,"Lock Editor Group"),category:tw.Categories.View,precondition:G.ActiveEditorGroupLockedContext.toNegated(),f1:!0})}async run(e,...t){a(e,!0,...t)}}),(0,im.registerAction2)(class extends im.Action2{constructor(){super({id:od,title:(0,S.localize2)(3397,"Unlock Editor Group"),precondition:G.ActiveEditorGroupLockedContext,category:tw.Categories.View,f1:!0})}async run(e,...t){a(e,!1,...t)}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:oh,weight:tE.KeybindingWeight.WorkbenchContrib,when:G.ActiveEditorStickyContext.toNegated(),primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.Shift|tC.KeyCode.Enter),handler:async(e,...t)=>{for(let{group:i,editors:o}of(0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService)).groupedEditors)for(let e of o)i.stickEditor(e)}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:ou,weight:tE.KeybindingWeight.WorkbenchContrib,when:G.ActiveEditorStickyContext,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.Shift|tC.KeyCode.Enter),handler:async(e,...t)=>{for(let{group:i,editors:o}of(0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService)).groupedEditors)for(let e of o)i.unstickEditor(e)}}),tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:ol,weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:void 0,handler:(e,...t)=>{let i=e.get(tR.IEditorGroupsService),o=e.get(tA.IQuickInputService),r=(0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),i,e.get(tT.IListService)),s=r.groupedEditors[0]?.group;return s&&i.activateGroup(s),o.quickAccess.show(iI.PREFIX)}}),(0,im.registerAction2)(class extends im.Action2{constructor(){super({id:o_,title:(0,S.localize2)(3388,"Split Editor in Group"),category:tw.Categories.View,precondition:G.ActiveEditorCanSplitInGroupContext,f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,when:G.ActiveEditorCanSplitInGroupContext,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.Backslash)}})}run(e,...t){return d(e,(0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService)))}}),(0,im.registerAction2)(class extends im.Action2{constructor(){super({id:oE,title:(0,S.localize2)(3389,"Join Editor in Group"),category:tw.Categories.View,precondition:G.SideBySideEditorActiveContext,f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,when:G.SideBySideEditorActiveContext,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.Backslash)}})}run(e,...t){return l((0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService)))}}),(0,im.registerAction2)(class extends im.Action2{constructor(){super({id:"workbench.action.toggleSplitEditorInGroup",title:(0,S.localize2)(3390,"Toggle Split Editor in Group"),category:tw.Categories.View,precondition:e0.ContextKeyExpr.or(G.ActiveEditorCanSplitInGroupContext,G.SideBySideEditorActiveContext),f1:!0})}async run(e,...t){let i=(0,i2.resolveCommandsContext)(t,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService));if(!i.groupedEditors.length)return;let{editors:o}=i.groupedEditors[0];o[0]instanceof F.SideBySideEditorInput?await l(i):o[0]&&await d(e,i)}}),(0,im.registerAction2)(class extends im.Action2{constructor(){super({id:oI,title:(0,S.localize2)(3391,"Toggle Layout of Split Editor in Group"),category:tw.Categories.View,precondition:G.SideBySideEditorActiveContext,f1:!0})}async run(e){let t,i=e.get(eQ.IConfigurationService);return t="horizontal"!==i.getValue(iA.SideBySideEditor.SIDE_BY_SIDE_LAYOUT_SETTING)?"horizontal":"vertical",i.updateValue(iA.SideBySideEditor.SIDE_BY_SIDE_LAYOUT_SETTING,t)}}),(0,im.registerAction2)(class extends im.Action2{constructor(){super({id:oD,title:(0,S.localize2)(3392,"Focus First Side in Active Editor"),category:tw.Categories.View,precondition:e0.ContextKeyExpr.or(G.SideBySideEditorActiveContext,G.TextCompareEditorActiveContext),f1:!0})}async run(e){let t=e.get(eN.IEditorService),i=e.get(es.ICommandService),o=t.activeEditorPane;o instanceof iA.SideBySideEditor?o.getSecondaryEditorPane()?.focus():o instanceof iW&&await i.executeCommand(iX)}}),(0,im.registerAction2)(class extends im.Action2{constructor(){super({id:oT,title:(0,S.localize2)(3393,"Focus Second Side in Active Editor"),category:tw.Categories.View,precondition:e0.ContextKeyExpr.or(G.SideBySideEditorActiveContext,G.TextCompareEditorActiveContext),f1:!0})}async run(e){let t=e.get(eN.IEditorService),i=e.get(es.ICommandService),o=t.activeEditorPane;o instanceof iA.SideBySideEditor?o.getPrimaryEditorPane()?.focus():o instanceof iW&&await i.executeCommand(ij)}}),(0,im.registerAction2)(class extends im.Action2{constructor(){super({id:"workbench.action.focusOtherSideEditor",title:(0,S.localize2)(3394,"Focus Other Side in Active Editor"),category:tw.Categories.View,precondition:e0.ContextKeyExpr.or(G.SideBySideEditorActiveContext,G.TextCompareEditorActiveContext),f1:!0})}async run(e){let t=e.get(eN.IEditorService),i=e.get(es.ICommandService),o=t.activeEditorPane;o instanceof iA.SideBySideEditor?o.getPrimaryEditorPane()?.hasFocus()?o.getSecondaryEditorPane()?.focus():o.getPrimaryEditorPane()?.focus():o instanceof iW&&await i.executeCommand(iJ)}});for(let e=1;e<8;e++)tE.KeybindingsRegistry.registerCommandAndKeybindingRule({id:function(e){switch(e){case 1:return"workbench.action.focusSecondEditorGroup";case 2:return"workbench.action.focusThirdEditorGroup";case 3:return"workbench.action.focusFourthEditorGroup";case 4:return"workbench.action.focusFifthEditorGroup";case 5:return"workbench.action.focusSixthEditorGroup";case 6:return"workbench.action.focusSeventhEditorGroup";case 7:return"workbench.action.focusEighthEditorGroup"}throw Error("Invalid index")}(e),weight:tE.KeybindingWeight.WorkbenchContrib,when:void 0,primary:tC.KeyMod.CtrlCmd|function(e){switch(e){case 1:return tC.KeyCode.Digit2;case 2:return tC.KeyCode.Digit3;case 3:return tC.KeyCode.Digit4;case 4:return tC.KeyCode.Digit5;case 5:return tC.KeyCode.Digit6;case 6:return tC.KeyCode.Digit7;case 7:return tC.KeyCode.Digit8}throw Error("Invalid index")}(e),handler:t=>{let i=t.get(tR.IEditorGroupsService),o=t.get(eQ.IConfigurationService);if(e>i.count)return;let r=i.getGroups(_.GroupsOrder.GRID_APPEARANCE);if(r[e])return r[e].focus();let s=(0,_.preferredSideBySideGroupDirection)(o),n=i.findGroup({location:_.GroupLocation.LAST});n&&i.addGroup(n,s).focus()}});for(let e of([{id:og,direction:_.GroupDirection.UP},{id:om,direction:_.GroupDirection.DOWN},{id:ov,direction:_.GroupDirection.LEFT},{id:oy,direction:_.GroupDirection.RIGHT}].forEach(({id:e,direction:t})=>{eZ.CommandsRegistry.registerCommand(e,function(e,...i){let o=(0,i2.resolveCommandsContext)(i,e.get(eN.IEditorService),e.get(tR.IEditorGroupsService),e.get(tT.IListService));oN(e.get(tR.IEditorGroupsService),t,o)})}),[{id:"workbench.action.focusLeftGroupWithoutWrap",direction:_.GroupDirection.LEFT},{id:"workbench.action.focusRightGroupWithoutWrap",direction:_.GroupDirection.RIGHT},{id:"workbench.action.focusAboveGroupWithoutWrap",direction:_.GroupDirection.UP},{id:"workbench.action.focusBelowGroupWithoutWrap",direction:_.GroupDirection.DOWN}]))eZ.CommandsRegistry.registerCommand(e.id,async t=>{let i=t.get(tR.IEditorGroupsService);(i.findGroup({direction:e.direction},i.activeGroup,!1)??i.activeGroup).focus()})},"splitEditor",0,oN],113535);var oG=e.i(399119);(0,K.registerCss)(void 0);class oF extends ia.ActionRunner{constructor(e){super(),this.context=e}run(e,t){let i=this.context;return t?.preserveFocus&&(i={...this.context,preserveFocus:!0}),super.run(e,i)}}let oW=class extends il.Themable{static{p=this}static{this.EDITOR_TAB_HEIGHT={normal:35,compact:22}}constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p){super(h),this.parent=e,this.editorPartsView=t,this.groupsView=i,this.groupView=o,this.tabsModel=r,this.contextMenuService=s,this.instantiationService=n,this.contextKeyService=a,this.keybindingService=d,this.notificationService=l,this.quickInputService=c,this.editorResolverService=u,this.hostService=p,this.editorTransfer=t_.LocalSelectionTransfer.getInstance(),this.groupTransfer=t_.LocalSelectionTransfer.getInstance(),this.treeItemsTransfer=t_.LocalSelectionTransfer.getInstance(),this.editorActionsToolbarDisposables=this._register(new D.DisposableStore),this.editorActionsDisposables=this._register(new D.DisposableStore),this.renderDropdownAsChildElement=!1;const g=this.create(e);this.contextMenuContextKeyService=this._register(this.contextKeyService.createScoped(g));const m=this._register(this.instantiationService.createChild(new W.ServiceCollection([z.IContextKeyService,this.contextMenuContextKeyService])));this.resourceContext=this._register(m.createInstance(G.ResourceContextKey)),this.editorPinnedContext=G.ActiveEditorPinnedContext.bindTo(this.contextMenuContextKeyService),this.editorIsFirstContext=G.ActiveEditorFirstInGroupContext.bindTo(this.contextMenuContextKeyService),this.editorIsLastContext=G.ActiveEditorLastInGroupContext.bindTo(this.contextMenuContextKeyService),this.editorStickyContext=G.ActiveEditorStickyContext.bindTo(this.contextMenuContextKeyService),this.editorAvailableEditorIds=G.ActiveEditorAvailableEditorIdsContext.bindTo(this.contextMenuContextKeyService),this.editorCanSplitInGroupContext=G.ActiveEditorCanSplitInGroupContext.bindTo(this.contextMenuContextKeyService),this.sideBySideEditorContext=G.SideBySideEditorActiveContext.bindTo(this.contextMenuContextKeyService),this.groupLockedContext=G.ActiveEditorGroupLockedContext.bindTo(this.contextMenuContextKeyService)}create(e){return this.updateTabHeight(),e}get editorActionsEnabled(){return"default"===this.groupsView.partOptions.editorActionsLocation&&"none"!==this.groupsView.partOptions.showTabs}createEditorActionsToolBar(e,t){this.editorActionsToolbarContainer=(0,x.$)("div"),this.editorActionsToolbarContainer.classList.add(...t),e.appendChild(this.editorActionsToolbarContainer),this.handleEditorActionToolBarVisibility(this.editorActionsToolbarContainer)}handleEditorActionToolBarVisibility(e){let t=this.editorActionsEnabled,i=!!this.editorActionsToolbar;t&&!i?this.doCreateEditorActionsToolBar(e):!t&&i&&(this.editorActionsToolbar?.getElement().remove(),this.editorActionsToolbar=void 0,this.editorActionsToolbarDisposables.clear(),this.editorActionsDisposables.clear()),e.classList.toggle("hidden",!t)}doCreateEditorActionsToolBar(e){let t={groupId:this.groupView.id};this.editorActionsToolbar=this.editorActionsToolbarDisposables.add(this.instantiationService.createInstance(iu.WorkbenchToolBar,e,{actionViewItemProvider:(e,t)=>this.actionViewItemProvider(e,t),orientation:ek.ActionsOrientation.HORIZONTAL,ariaLabel:(0,S.localize)(3504,"Editor actions"),getKeyBinding:e=>this.getKeybinding(e),actionRunner:this.editorActionsToolbarDisposables.add(new oF(t)),anchorAlignmentProvider:()=>ic.AnchorAlignment.RIGHT,renderDropdownAsChildElement:this.renderDropdownAsChildElement,telemetrySource:"editorPart",resetMenu:eL.MenuId.EditorTitle,overflowBehavior:{maxItems:9,exempted:oV},highlightToggledItems:!0})),this.editorActionsToolbar.context=t,this.editorActionsToolbarDisposables.add(this.editorActionsToolbar.actionRunner.onDidRun(e=>{e.error&&!(0,eE.isCancellationError)(e.error)&&this.notificationService.error(e.error)}))}actionViewItemProvider(e,t){let i=this.groupView.activeEditorPane;if(i instanceof ee.EditorPane){let o=i.getActionViewItem(e,t);if(o)return o}return(0,eV.createActionViewItem)(this.instantiationService,e,{...t,menuAsChild:this.renderDropdownAsChildElement})}updateEditorActionsToolbar(){if(!this.editorActionsEnabled)return;this.editorActionsDisposables.clear();let e=this.groupView.createEditorActions(this.editorActionsDisposables);this.editorActionsDisposables.add(e.onDidChange(()=>this.updateEditorActionsToolbar()));let t=(0,J.assertReturnsDefined)(this.editorActionsToolbar),{primary:i,secondary:o}=this.prepareEditorActions(e.actions);t.setActions((0,ek.prepareActions)(i),(0,ek.prepareActions)(o))}getEditorPaneAwareContextKeyService(){return this.groupView.activeEditorPane?.scopedContextKeyService??this.contextKeyService}clearEditorActionsToolbar(){this.editorActionsEnabled&&(0,J.assertReturnsDefined)(this.editorActionsToolbar).setActions([],[])}onGroupDragStart(e,t){if(e.target!==t)return!1;let i=this.isNewWindowOperation(e);this.groupTransfer.setData([new tO.DraggedEditorGroupIdentifier(this.groupView.id)],tO.DraggedEditorGroupIdentifier.prototype),e.dataTransfer&&(e.dataTransfer.effectAllowed="copyMove");let o=!1;if("multiple"===this.groupsView.partOptions.showTabs?o=this.doFillResourceDataTransfers(this.groupView.getEditors(L.EditorsOrder.SEQUENTIAL),e,i):this.groupView.activeEditor&&(o=this.doFillResourceDataTransfers([this.groupView.activeEditor],e,i)),!o&&ih.isFirefox&&e.dataTransfer?.setData(is.DataTransfers.TEXT,String(this.groupView.label)),this.groupView.activeEditor){let i=this.groupView.activeEditor.getName();"multiple"===this.groupsView.partOptions.showTabs&&this.groupView.count>1&&(i=(0,S.localize)(3505,"{0} (+{1})",i,this.groupView.count-1)),(0,tv.applyDragImage)(e,t,i)}return i}async onGroupDragEnd(e,t,i,o){if(this.groupTransfer.clearData(tO.DraggedEditorGroupIdentifier.prototype),e.target!==i||!o||(0,tO.isWindowDraggedOver)())return;let r=await this.maybeCreateAuxiliaryEditorPartAt(e,i);if(!r)return;let s=r.activeGroup;this.groupsView.mergeGroup(this.groupView,s.id,{mode:this.isMoveOperation(t??e,s.id)?_.MergeGroupMode.MOVE_EDITORS:_.MergeGroupMode.COPY_EDITORS}),s.focus()}async maybeCreateAuxiliaryEditorPartAt(e,t){let{point:i,display:o}=await this.hostService.getCursorScreenPoint()??{point:{x:e.screenX,y:e.screenY}},r=(0,x.getActiveWindow)();if("visible"===r.document.visibilityState&&r.document.hasFocus()&&i.x>=r.screenX&&i.x<=r.screenX+r.outerWidth&&i.y>=r.screenY&&i.y<=r.screenY+r.outerHeight)return;let s=t.offsetWidth/2,n=30+t.offsetHeight/2,a={x:i.x-s,y:i.y-n};return o&&(a.x<o.x&&(a.x=o.x),a.y<o.y&&(a.y=o.y)),this.editorPartsView.createAuxiliaryEditorPart({bounds:a})}isNewWindowOperation(e){return this.groupsView.partOptions.dragToOpenWindow?!e.altKey:e.altKey}isMoveOperation(e,t,i){return!!i?.hasCapability(L.EditorInputCapabilities.Singleton)||!(e.ctrlKey&&!eY.isMacintosh||e.altKey&&eY.isMacintosh)||t===this.groupView.id}doFillResourceDataTransfers(e,t,i){return!!e.length&&(this.instantiationService.invokeFunction(tO.fillEditorsDragData,e.map(e=>({editor:e,groupId:this.groupView.id})),t,{disableStandardTransfer:i}),!0)}onTabContextMenu(e,t,i){this.resourceContext.set(L.EditorResourceAccessor.getOriginalUri(e,{supportSideBySide:L.SideBySideEditor.PRIMARY})),this.editorPinnedContext.set(this.tabsModel.isPinned(e)),this.editorIsFirstContext.set(this.tabsModel.isFirst(e)),this.editorIsLastContext.set(this.tabsModel.isLast(e)),this.editorStickyContext.set(this.tabsModel.isSticky(e)),this.groupLockedContext.set(this.tabsModel.isLocked),this.editorCanSplitInGroupContext.set(e.hasCapability(L.EditorInputCapabilities.CanSplitInGroup)),this.sideBySideEditorContext.set(e.typeId===F.SideBySideEditorInput.ID),(0,G.applyAvailableEditorIds)(this.editorAvailableEditorIds,e,this.editorResolverService);let o=i;(0,x.isMouseEvent)(t)&&(o=new eP.StandardMouseEvent((0,x.getWindow)(i),t)),this.contextMenuService.showContextMenu({getAnchor:()=>o,menuId:eL.MenuId.EditorTitleContext,menuActionOptions:{shouldForwardArgs:!0,arg:this.resourceContext.get()},contextKeyService:this.contextMenuContextKeyService,getActionsContext:()=>({groupId:this.groupView.id,editorIndex:this.groupView.getIndexOfEditor(e)}),getKeyBinding:e=>this.keybindingService.lookupKeybinding(e.id,this.contextMenuContextKeyService),onHide:()=>this.groupsView.activeGroup.focus()})}getKeybinding(e){return this.keybindingService.lookupKeybinding(e.id,this.getEditorPaneAwareContextKeyService())}getKeybindingLabel(e){let t=this.getKeybinding(e);return t?t.getLabel()??void 0:void 0}get tabHeight(){return"compact"!==this.groupsView.partOptions.tabHeight?p.EDITOR_TAB_HEIGHT.normal:p.EDITOR_TAB_HEIGHT.compact}getHoverTitle(e){let t=e.getTitle(L.Verbosity.LONG);return this.tabsModel.isPinned(e)?t:{markdown:new oG.MarkdownString("",{supportThemeIcons:!0,isTrusted:!0}).appendText(t).appendMarkdown(' (_preview_ [$(gear)](command:workbench.action.openSettings?%5B%22workbench.editor.enablePreview%22%5D "Configure Preview Mode"))'),markdownNotSupportedFallback:t+" (preview)"}}updateTabHeight(){this.parent.style.setProperty("--editor-group-tab-height",`${this.tabHeight}px`)}updateOptions(e,t){e.tabHeight!==t.tabHeight&&this.updateTabHeight(),(e.editorActionsLocation!==t.editorActionsLocation||e.showTabs!==t.showTabs)&&this.editorActionsToolbarContainer&&(this.handleEditorActionToolBarVisibility(this.editorActionsToolbarContainer),this.updateEditorActionsToolbar())}};oW=p=(0,f.__decorate)([(0,f.__param)(5,eK.IContextMenuService),(0,f.__param)(6,E.IInstantiationService),(0,f.__param)(7,z.IContextKeyService),(0,f.__param)(8,eM.IKeybindingService),(0,f.__param)(9,id.INotificationService),(0,f.__param)(10,tA.IQuickInputService),(0,f.__param)(11,T.IThemeService),(0,f.__param)(12,ip.IEditorResolverService),(0,f.__param)(13,eD.IHostService)],oW),e.s(["EditorCommandsContextActionRunner",0,oF,"EditorTabsControl",0,oW],211748);var oz=e.i(802186),oB=ia,oU=e.i(536561),oH=e.i(451062),o$=e.i(441201),oq=e.i(506986),oY=eL;class oj extends oY.Action2{constructor(e,t,i){super(e),this.commandId=t,this.commandArgs=i}run(e){return e.get(es.ICommandService).executeCommand(this.commandId,this.commandArgs)}}class oX extends oY.Action2{getDirection(e){return(0,_.preferredSideBySideGroupDirection)(e)}async run(e,...t){let i=e.get(tR.IEditorGroupsService),o=e.get(eQ.IConfigurationService),r=e.get(eN.IEditorService),s=e.get(tT.IListService),n=this.getDirection(o),a=(0,i2.resolveCommandsContext)(t,r,i,s);oN(i,n,a)}}class oJ extends oX{static{this.ID=op}constructor(){super({id:oJ.ID,title:(0,S.localize2)(3252,"Split Editor"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyCode.Backslash},category:tw.Categories.View})}}class oZ extends oj{static{this.LABEL=(0,S.localize)(3256,"Split Editor Up")}constructor(){super({id:og,title:(0,S.localize2)(3256,"Split Editor Up"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.Backslash)},category:tw.Categories.View},og)}}class oQ extends oj{static{this.LABEL=(0,S.localize)(3257,"Split Editor Down")}constructor(){super({id:om,title:(0,S.localize2)(3257,"Split Editor Down"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.Backslash)},category:tw.Categories.View},om)}}class o0 extends oY.Action2{constructor(){super({id:"workbench.action.joinTwoGroups",title:(0,S.localize2)(3258,"Join Editor Group with Next Group"),f1:!0,category:tw.Categories.View})}async run(e,t){let i,o=e.get(tR.IEditorGroupsService);if(i=t&&"number"==typeof t.groupId?o.getGroup(t.groupId):o.activeGroup)for(let e of[_.GroupDirection.RIGHT,_.GroupDirection.DOWN,_.GroupDirection.LEFT,_.GroupDirection.UP]){let t=o.findGroup({direction:e},i);if(t&&i!==t){o.mergeGroup(i,t);break}}}}class o1 extends oY.Action2{constructor(){super({id:"workbench.action.joinAllGroups",title:(0,S.localize2)(3259,"Join All Editor Groups"),f1:!0,category:tw.Categories.View})}async run(e){let t=e.get(tR.IEditorGroupsService);t.mergeAllGroups(t.activeGroup)}}class o2 extends oY.Action2{constructor(){super({id:"workbench.action.navigateEditorGroups",title:(0,S.localize2)(3260,"Navigate Between Editor Groups"),f1:!0,category:tw.Categories.View})}async run(e){let t=e.get(tR.IEditorGroupsService),i=t.findGroup({location:_.GroupLocation.NEXT},t.activeGroup,!0);i?.focus()}}class o3 extends oY.Action2{constructor(){super({id:"workbench.action.focusActiveEditorGroup",title:(0,S.localize2)(3261,"Focus Active Editor Group"),f1:!0,category:tw.Categories.View})}async run(e){e.get(tR.IEditorGroupsService).activeGroup.focus()}}class o5 extends oY.Action2{constructor(e,t){super(e),this.scope=t}async run(e){let t=e.get(tR.IEditorGroupsService),i=t.findGroup(this.scope,t.activeGroup,!0);i?.focus()}}let o6=class extends oB.Action{static{this.ID="workbench.action.closeActiveEditor"}static{this.LABEL=(0,S.localize)(3270,"Close Editor")}constructor(e,t,i){super(e,t,tp.ThemeIcon.asClassName(ty.Codicon.close)),this.commandService=i}run(e){return this.commandService.executeCommand(i9,void 0,e)}};o6=(0,f.__decorate)([(0,f.__param)(2,es.ICommandService)],o6);let o4=class extends oB.Action{static{this.ID="workbench.action.unpinActiveEditor"}static{this.LABEL=(0,S.localize)(3271,"Unpin Editor")}constructor(e,t,i){super(e,t,tp.ThemeIcon.asClassName(ty.Codicon.pinned)),this.commandService=i}run(e){return this.commandService.executeCommand(ou,void 0,e)}};o4=(0,f.__decorate)([(0,f.__param)(2,es.ICommandService)],o4);let o9=class extends oB.Action{static{this.ID="workbench.action.closeActiveEditor"}static{this.LABEL=(0,S.localize)(3272,"Close")}constructor(e,t,i){super(e,t,tp.ThemeIcon.asClassName(ty.Codicon.close)),this.editorGroupService=i}async run(e){let t=e?this.editorGroupService.getGroup(e.groupId):this.editorGroupService.activeGroup;if(!t)return;let i=e?.editorIndex!==void 0?t.getEditorByIndex(e.editorIndex):t.activeEditor;if(!i)return;let o=[];for(let r of(t.isSelected(i)?o.push(...t.selectedEditors):o.push(i),o))await t.closeEditor(r,{preserveFocus:e?.preserveFocus})}};o9=(0,f.__decorate)([(0,f.__param)(2,tR.IEditorGroupsService)],o9);class o8 extends oY.Action2{constructor(){super({id:"workbench.action.revertAndCloseActiveEditor",title:(0,S.localize2)(3273,"Revert and Close Editor"),f1:!0,category:tw.Categories.View})}async run(e){let t=e.get(eN.IEditorService),i=e.get(eI.ILogService),o=t.activeEditorPane;if(o){let e=o.input,r=o.group;try{await t.revert({editor:e,groupId:r.id})}catch(o){i.error(o),await t.revert({editor:e,groupId:r.id},{soft:!0})}await r.closeEditor(e)}}}class o7 extends oY.Action2{constructor(){super({id:"workbench.action.closeEditorsToTheLeft",title:(0,S.localize2)(3274,"Close Editors to the Left in Group"),f1:!0,category:tw.Categories.View})}async run(e,t){let i=e.get(tR.IEditorGroupsService),{group:o,editor:r}=this.getTarget(i,t);o&&r&&await o.closeEditors({direction:L.CloseDirection.LEFT,except:r,excludeSticky:!0})}getTarget(e,t){return t?{editor:t.editor,group:e.getGroup(t.groupId)}:{group:e.activeGroup,editor:e.activeGroup.activeEditor}}}class re extends oY.Action2{groupsToClose(e){let t=[],i=e.getGroups(_.GroupsOrder.GRID_APPEARANCE);for(let e=i.length-1;e>=0;e--)t.push(i[e]);return t}async run(e){let t=e.get(eN.IEditorService),i=e.get(eI.ILogService),o=e.get(X.IProgressService),r=e.get(tR.IEditorGroupsService),s=e.get(eH.IFilesConfigurationService),n=e.get(eb.IFileDialogService),a=new Set,d=new Set,l=new Set,c=new Map;for(let{editor:e,groupId:o}of t.getEditors(L.EditorsOrder.SEQUENTIAL,{excludeSticky:this.excludeSticky})){let t=!1,r=!1;if(e.closeHandler)try{t=e.closeHandler.showConfirm()}catch(e){i.error(e),r=!0}if((!e.closeHandler||r)&&(t=e.isDirty()&&!e.isSaving()),t)if("function"==typeof e.closeHandler?.confirm){let t=c.get(e.typeId);t||(t=new Set,c.set(e.typeId,t)),t.add({editor:e,groupId:o})}else e.hasCapability(L.EditorInputCapabilities.Untitled)||s.getAutoSaveMode(e).mode!==eU.AutoSaveMode.ON_FOCUS_CHANGE?eY.isNative&&(eY.isWindows||eY.isLinux)&&!e.hasCapability(L.EditorInputCapabilities.Untitled)&&s.getAutoSaveMode(e).mode===eU.AutoSaveMode.ON_WINDOW_CHANGE?l.add({editor:e,groupId:o}):a.add({editor:e,groupId:o}):d.add({editor:e,groupId:o})}if(a.size>0){let e=Array.from(a.values());switch(await this.revealEditorsToConfirm(e,r),await n.showSaveConfirm(e.map(({editor:e})=>e instanceof F.SideBySideEditorInput?e.primary.getName():e.getName()))){case eB.ConfirmResult.CANCEL:return;case eB.ConfirmResult.DONT_SAVE:await this.revertEditors(t,i,o,e);break;case eB.ConfirmResult.SAVE:await t.save(e,{reason:L.SaveReason.EXPLICIT})}}for(let[,e]of c){let s=Array.from(e.values());await this.revealEditorsToConfirm(s,r);let n=await s.at(0)?.editor.closeHandler?.confirm?.(s);if("number"==typeof n)switch(n){case eB.ConfirmResult.CANCEL:return;case eB.ConfirmResult.DONT_SAVE:await this.revertEditors(t,i,o,s);break;case eB.ConfirmResult.SAVE:await t.save(s,{reason:L.SaveReason.EXPLICIT})}}if(d.size>0){let e=Array.from(d.values());await t.save(e,{reason:L.SaveReason.FOCUS_CHANGE})}if(l.size>0){let e=Array.from(l.values());await t.save(e,{reason:L.SaveReason.WINDOW_CHANGE})}return this.doCloseAll(r)}revertEditors(e,t,i,o){return i.withProgress({location:j.ProgressLocation.Window,delay:800,title:(0,S.localize)(3275,"Reverting Editors...")},()=>this.doRevertEditors(e,t,o))}async doRevertEditors(e,t,i){try{await e.revert(i)}catch(o){t.error(o),await e.revert(i,{soft:!0})}}async revealEditorsToConfirm(e,t){try{let i=new Set;for(let{editor:o,groupId:r}of e){if(i.has(r))continue;i.add(r);let e=t.getGroup(r);await e?.openEditor(o)}}catch(e){}}async doCloseAll(e){await Promise.all(this.groupsToClose(e).map(e=>e.closeAllEditors({excludeSticky:this.excludeSticky})))}}class rt extends re{static{this.ID="workbench.action.closeAllEditors"}static{this.LABEL=(0,S.localize2)(3276,"Close All Editors")}constructor(){super({id:rt.ID,title:rt.LABEL,f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.KeyW)},icon:ty.Codicon.closeAll,category:tw.Categories.View})}get excludeSticky(){return!0}}class ri extends oY.Action2{constructor(){super({id:"workbench.action.closeEditorsInOtherGroups",title:(0,S.localize2)(3278,"Close Editors in Other Groups"),f1:!0,category:tw.Categories.View})}async run(e,t){let i=e.get(tR.IEditorGroupsService),o=t?i.getGroup(t.groupId):i.activeGroup;await Promise.all(i.getGroups(_.GroupsOrder.MOST_RECENTLY_ACTIVE).map(async e=>{if(!o||e.id!==o.id)return e.closeAllEditors({excludeSticky:!0})}))}}class ro extends oY.Action2{constructor(){super({id:"workbench.action.closeEditorInAllGroups",title:(0,S.localize2)(3279,"Close Editor in All Groups"),f1:!0,category:tw.Categories.View})}async run(e){let t=e.get(eN.IEditorService),i=e.get(tR.IEditorGroupsService),o=t.activeEditor;o&&await Promise.all(i.getGroups(_.GroupsOrder.MOST_RECENTLY_ACTIVE).map(e=>e.closeEditor(o)))}}class rr extends oY.Action2{constructor(e,t,i){super(e),this.direction=t,this.isMove=i}async run(e,t){let i,o=e.get(tR.IEditorGroupsService);if(i=t&&"number"==typeof t.groupId?o.getGroup(t.groupId):o.activeGroup){let e;if(this.isMove){let t=this.findTargetGroup(o,i);t&&(e=o.moveGroup(i,t,this.direction))}else e=o.copyGroup(i,i,this.direction);e&&o.activateGroup(e)}}findTargetGroup(e,t){let i=[this.direction];switch(this.direction){case _.GroupDirection.LEFT:case _.GroupDirection.RIGHT:i.push(_.GroupDirection.UP,_.GroupDirection.DOWN);break;case _.GroupDirection.UP:case _.GroupDirection.DOWN:i.push(_.GroupDirection.LEFT,_.GroupDirection.RIGHT)}for(let o of i){let i=e.findGroup({direction:o},t);if(i)return i}}}class rs extends rr{constructor(e,t){super(e,t,!0)}}class rn extends rr{constructor(e,t){super(e,t,!1)}}class ra extends oY.Action2{constructor(){super({id:"workbench.action.minimizeOtherEditors",title:(0,S.localize2)(3288,"Expand Editor Group"),f1:!0,category:tw.Categories.View,precondition:G.MultipleEditorGroupsContext})}async run(e){e.get(tR.IEditorGroupsService).arrangeGroups(_.GroupsArrangement.EXPAND)}}class rd extends oY.Action2{constructor(){super({id:"workbench.action.minimizeOtherEditorsHideSidebar",title:(0,S.localize2)(3289,"Expand Editor Group and Hide Side Bars"),f1:!0,category:tw.Categories.View,precondition:e0.ContextKeyExpr.or(G.MultipleEditorGroupsContext,G.SideBarVisibleContext,G.AuxiliaryBarVisibleContext)})}async run(e){let t=e.get(tR.IEditorGroupsService),i=e.get(Y.IWorkbenchLayoutService);i.setPartHidden(!0,oU.Parts.SIDEBAR_PART),i.setPartHidden(!0,oU.Parts.AUXILIARYBAR_PART),t.arrangeGroups(_.GroupsArrangement.EXPAND)}}class rl extends oY.Action2{constructor(){super({id:"workbench.action.evenEditorWidths",title:(0,S.localize2)(3290,"Reset Editor Group Sizes"),f1:!0,category:tw.Categories.View})}async run(e){e.get(tR.IEditorGroupsService).arrangeGroups(_.GroupsArrangement.EVEN)}}class rc extends oY.Action2{constructor(){super({id:"workbench.action.toggleEditorWidths",title:(0,S.localize2)(3291,"Toggle Editor Group Sizes"),f1:!0,category:tw.Categories.View})}async run(e){e.get(tR.IEditorGroupsService).toggleExpandGroup()}}class rh extends oY.Action2{constructor(){super({id:"workbench.action.maximizeEditorHideSidebar",title:(0,S.localize2)(3292,"Maximize Editor Group and Hide Side Bars"),f1:!0,category:tw.Categories.View,precondition:e0.ContextKeyExpr.or(e0.ContextKeyExpr.and(G.EditorPartMaximizedEditorGroupContext.negate(),G.EditorPartMultipleEditorGroupsContext),G.SideBarVisibleContext,G.AuxiliaryBarVisibleContext)})}async run(e){let t=e.get(Y.IWorkbenchLayoutService),i=e.get(tR.IEditorGroupsService);e.get(eN.IEditorService).activeEditor&&(t.setPartHidden(!0,oU.Parts.SIDEBAR_PART),t.setPartHidden(!0,oU.Parts.AUXILIARYBAR_PART),i.arrangeGroups(_.GroupsArrangement.MAXIMIZE))}}class ru extends oY.Action2{constructor(){super({id:oS,title:(0,S.localize2)(3293,"Toggle Maximize Editor Group"),f1:!0,category:tw.Categories.View,precondition:e0.ContextKeyExpr.or(G.EditorPartMultipleEditorGroupsContext,G.EditorPartMaximizedEditorGroupContext),keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.KeyM)},menu:[{id:oY.MenuId.EditorTitle,order:-1e4,group:"navigation",when:G.EditorPartMaximizedEditorGroupContext},{id:oY.MenuId.EmptyEditorGroup,order:-1e4,group:"navigation",when:G.EditorPartMaximizedEditorGroupContext}],icon:ty.Codicon.screenFull,toggled:{condition:G.EditorPartMaximizedEditorGroupContext,title:(0,S.localize)(3294,"Unmaximize Group")}})}async run(e,...t){let i=e.get(tR.IEditorGroupsService),o=e.get(eN.IEditorService),r=e.get(tT.IListService),s=(0,i2.resolveCommandsContext)(t,o,i,r);s.groupedEditors.length&&i.toggleMaximizeGroup(s.groupedEditors[0].group)}}class rp extends oY.Action2{async run(e){let t=e.get(tR.IEditorGroupsService),i=this.navigate(t);if(!i)return;let{groupId:o,editor:r}=i;if(!r)return;let s=t.getGroup(o);s&&await s.openEditor(r)}}class rg extends oY.Action2{static{this.ID="workbench.action.navigateForward"}static{this.LABEL=(0,S.localize)(3301,"Go Forward")}constructor(){super({id:rg.ID,title:{...(0,S.localize2)(3301,"Go Forward"),mnemonicTitle:(0,S.localize)(3302,"&&Forward")},f1:!0,icon:ty.Codicon.arrowRight,precondition:e0.ContextKeyExpr.has("canNavigateForward"),keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,win:{primary:tC.KeyMod.Alt|tC.KeyCode.RightArrow,secondary:[tC.KeyCode.BrowserForward]},mac:{primary:tC.KeyMod.WinCtrl|tC.KeyMod.Shift|tC.KeyCode.Minus,secondary:[tC.KeyCode.BrowserForward]},linux:{primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.Minus,secondary:[tC.KeyCode.BrowserForward]}},menu:[{id:oY.MenuId.MenubarGoMenu,group:"1_history_nav",order:2},{id:oY.MenuId.CommandCenter,order:2,when:e0.ContextKeyExpr.has("config.workbench.navigationControl.enabled")}]})}async run(e){let t=e.get(o$.IHistoryService);await t.goForward(oH.GoFilter.NONE)}}class rm extends oY.Action2{static{this.ID="workbench.action.navigateBack"}static{this.LABEL=(0,S.localize)(3303,"Go Back")}constructor(){super({id:rm.ID,title:{...(0,S.localize2)(3303,"Go Back"),mnemonicTitle:(0,S.localize)(3304,"&&Back")},f1:!0,precondition:e0.ContextKeyExpr.has("canNavigateBack"),icon:ty.Codicon.arrowLeft,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,win:{primary:tC.KeyMod.Alt|tC.KeyCode.LeftArrow,secondary:[tC.KeyCode.BrowserBack]},mac:{primary:tC.KeyMod.WinCtrl|tC.KeyCode.Minus,secondary:[tC.KeyCode.BrowserBack]},linux:{primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Alt|tC.KeyCode.Minus,secondary:[tC.KeyCode.BrowserBack]}},menu:[{id:oY.MenuId.MenubarGoMenu,group:"1_history_nav",order:1},{id:oY.MenuId.CommandCenter,order:1,when:e0.ContextKeyExpr.has("config.workbench.navigationControl.enabled")}]})}async run(e){let t=e.get(o$.IHistoryService);await t.goBack(oH.GoFilter.NONE)}}class rv extends oY.Action2{constructor(){super({id:"workbench.action.navigateLast",title:(0,S.localize2)(3305,"Go Previous"),f1:!0})}async run(e){let t=e.get(o$.IHistoryService);await t.goPrevious(oH.GoFilter.NONE)}}class ry extends oY.Action2{constructor(){super({id:"workbench.action.navigateForwardInEditLocations",title:(0,S.localize2)(3306,"Go Forward in Edit Locations"),f1:!0})}async run(e){let t=e.get(o$.IHistoryService);await t.goForward(oH.GoFilter.EDITS)}}class rC extends oY.Action2{constructor(){super({id:"workbench.action.navigateBackInEditLocations",title:(0,S.localize2)(3307,"Go Back in Edit Locations"),f1:!0})}async run(e){let t=e.get(o$.IHistoryService);await t.goBack(oH.GoFilter.EDITS)}}class rb extends oY.Action2{constructor(){super({id:"workbench.action.navigatePreviousInEditLocations",title:(0,S.localize2)(3308,"Go Previous in Edit Locations"),f1:!0})}async run(e){let t=e.get(o$.IHistoryService);await t.goPrevious(oH.GoFilter.EDITS)}}class rw extends oY.Action2{constructor(){super({id:"workbench.action.navigateToLastEditLocation",title:(0,S.localize2)(3309,"Go to Last Edit Location"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.KeyQ)}})}async run(e){let t=e.get(o$.IHistoryService);await t.goLast(oH.GoFilter.EDITS)}}class rf extends oY.Action2{constructor(){super({id:"workbench.action.navigateForwardInNavigationLocations",title:(0,S.localize2)(3310,"Go Forward in Navigation Locations"),f1:!0})}async run(e){let t=e.get(o$.IHistoryService);await t.goForward(oH.GoFilter.NAVIGATION)}}class rS extends oY.Action2{constructor(){super({id:"workbench.action.navigateBackInNavigationLocations",title:(0,S.localize2)(3311,"Go Back in Navigation Locations"),f1:!0})}async run(e){let t=e.get(o$.IHistoryService);await t.goBack(oH.GoFilter.NAVIGATION)}}class r_ extends oY.Action2{constructor(){super({id:"workbench.action.navigatePreviousInNavigationLocations",title:(0,S.localize2)(3312,"Go Previous in Navigation Locations"),f1:!0})}async run(e){let t=e.get(o$.IHistoryService);await t.goPrevious(oH.GoFilter.NAVIGATION)}}class rE extends oY.Action2{constructor(){super({id:"workbench.action.navigateToLastNavigationLocation",title:(0,S.localize2)(3313,"Go to Last Navigation Location"),f1:!0})}async run(e){let t=e.get(o$.IHistoryService);await t.goLast(oH.GoFilter.NAVIGATION)}}class rI extends oY.Action2{static{this.ID="workbench.action.reopenClosedEditor"}constructor(){super({id:rI.ID,title:(0,S.localize2)(3314,"Reopen Closed Editor"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.KeyT},category:tw.Categories.View})}async run(e){let t=e.get(o$.IHistoryService);await t.reopenLastClosedEditor()}}class rD extends oY.Action2{static{this.ID="workbench.action.clearRecentFiles"}constructor(){super({id:rD.ID,title:(0,S.localize2)(3315,"Clear Recently Opened..."),f1:!0,category:tw.Categories.File})}async run(e){let t=e.get(eb.IDialogService),i=e.get(oq.IWorkspacesService),o=e.get(o$.IHistoryService),{confirmed:r}=await t.confirm({type:"warning",message:(0,S.localize)(3316,"Do you want to clear all recently opened files and workspaces?"),detail:(0,S.localize)(3317,"This action is irreversible!"),primaryButton:(0,S.localize)(3318,"&&Clear")});r&&(i.clearRecentlyOpened(),o.clearRecentlyOpened())}}class rT extends oY.Action2{static{this.ID="workbench.action.showEditorsInActiveGroup"}constructor(){super({id:rT.ID,title:(0,S.localize2)(3319,"Show Editors in Active Group By Most Recently Used"),f1:!0,category:tw.Categories.View})}async run(e){e.get(tA.IQuickInputService).quickAccess.show(iI.PREFIX)}}class rA extends oY.Action2{static{this.ID="workbench.action.showAllEditors"}constructor(){super({id:rA.ID,title:(0,S.localize2)(3320,"Show All Editors By Appearance"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.KeyP),mac:{primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Alt|tC.KeyCode.Tab}},category:tw.Categories.File})}async run(e){e.get(tA.IQuickInputService).quickAccess.show(iD.PREFIX)}}class rx extends oY.Action2{static{this.ID="workbench.action.showAllEditorsByMostRecentlyUsed"}constructor(){super({id:rx.ID,title:(0,S.localize2)(3321,"Show All Editors By Most Recently Used"),f1:!0,category:tw.Categories.View})}async run(e){e.get(tA.IQuickInputService).quickAccess.show(iT.PREFIX)}}class rR extends oY.Action2{constructor(e,t,i){super(e),this.prefix=t,this.itemActivation=i}async run(e){let t=e.get(eM.IKeybindingService),i=e.get(tA.IQuickInputService),o=t.lookupKeybindings(this.desc.id);i.quickAccess.show(this.prefix,{quickNavigateConfiguration:{keybindings:o},itemActivation:this.itemActivation})}}class rk extends oY.Action2{static{this.ID="workbench.action.openPreviousEditorFromHistory"}constructor(){super({id:rk.ID,title:(0,S.localize2)(3326,"Quick Open Previous Editor from History"),f1:!0})}async run(e){let t,i=e.get(eM.IKeybindingService),o=e.get(tA.IQuickInputService),r=e.get(tR.IEditorGroupsService),s=i.lookupKeybindings(rk.ID);0===r.activeGroup.count&&(t=iy.ItemActivation.FIRST),o.quickAccess.show("",{quickNavigateConfiguration:{keybindings:s},itemActivation:t})}}class rM extends oY.Action2{constructor(){super({id:"workbench.action.openNextRecentlyUsedEditor",title:(0,S.localize2)(3327,"Open Next Recently Used Editor"),f1:!0,category:tw.Categories.View})}async run(e){e.get(o$.IHistoryService).openNextRecentlyUsedEditor()}}class rL extends oY.Action2{constructor(){super({id:"workbench.action.openPreviousRecentlyUsedEditor",title:(0,S.localize2)(3328,"Open Previous Recently Used Editor"),f1:!0,category:tw.Categories.View})}async run(e){e.get(o$.IHistoryService).openPreviouslyUsedEditor()}}class rO extends oY.Action2{constructor(){super({id:"workbench.action.openNextRecentlyUsedEditorInGroup",title:(0,S.localize2)(3329,"Open Next Recently Used Editor In Group"),f1:!0,category:tw.Categories.View})}async run(e){let t=e.get(o$.IHistoryService),i=e.get(tR.IEditorGroupsService);t.openNextRecentlyUsedEditor(i.activeGroup.id)}}class rP extends oY.Action2{constructor(){super({id:"workbench.action.openPreviousRecentlyUsedEditorInGroup",title:(0,S.localize2)(3330,"Open Previous Recently Used Editor In Group"),f1:!0,category:tw.Categories.View})}async run(e){let t=e.get(o$.IHistoryService),i=e.get(tR.IEditorGroupsService);t.openPreviouslyUsedEditor(i.activeGroup.id)}}class rV extends oY.Action2{constructor(){super({id:"workbench.action.clearEditorHistoryWithoutConfirm",title:(0,S.localize2)(3331,"Clear Editor History without Confirmation"),f1:!0,precondition:G.InAutomationContext})}async run(e){e.get(o$.IHistoryService).clear()}}class rK extends oY.Action2{constructor(){super({id:"workbench.action.clearEditorHistory",title:(0,S.localize2)(3332,"Clear Editor History"),f1:!0})}async run(e){let t=e.get(eb.IDialogService),i=e.get(o$.IHistoryService),{confirmed:o}=await t.confirm({type:"warning",message:(0,S.localize)(3333,"Do you want to clear the history of recently opened editors?"),detail:(0,S.localize)(3317,"This action is irreversible!"),primaryButton:(0,S.localize)(3318,"&&Clear")});o&&i.clear()}}class rN extends oj{static{this.ID="workbench.action.splitEditorToLeftGroup"}static{this.LABEL=(0,S.localize)(3350,"Split Editor into Left Group")}constructor(){super({id:"workbench.action.splitEditorToLeftGroup",title:(0,S.localize2)(3350,"Split Editor into Left Group"),f1:!0,category:tw.Categories.View},oi,{to:"left",by:"group"})}}class rG extends oj{static{this.ID="workbench.action.editorLayoutSingle"}constructor(){super({id:rG.ID,title:(0,S.localize2)(3354,"Single Column Editor Layout"),f1:!0,category:tw.Categories.View},oo,{groups:[{}],orientation:_.GroupOrientation.HORIZONTAL})}}class rF extends oj{static{this.ID="workbench.action.editorLayoutTwoColumns"}constructor(){super({id:rF.ID,title:(0,S.localize2)(3355,"Two Columns Editor Layout"),f1:!0,category:tw.Categories.View},oo,{groups:[{},{}],orientation:_.GroupOrientation.HORIZONTAL})}}class rW extends oj{static{this.ID="workbench.action.editorLayoutThreeColumns"}constructor(){super({id:rW.ID,title:(0,S.localize2)(3356,"Three Columns Editor Layout"),f1:!0,category:tw.Categories.View},oo,{groups:[{},{},{}],orientation:_.GroupOrientation.HORIZONTAL})}}class rz extends oj{static{this.ID="workbench.action.editorLayoutTwoRows"}constructor(){super({id:rz.ID,title:(0,S.localize2)(3357,"Two Rows Editor Layout"),f1:!0,category:tw.Categories.View},oo,{groups:[{},{}],orientation:_.GroupOrientation.VERTICAL})}}class rB extends oj{static{this.ID="workbench.action.editorLayoutThreeRows"}constructor(){super({id:rB.ID,title:(0,S.localize2)(3358,"Three Rows Editor Layout"),f1:!0,category:tw.Categories.View},oo,{groups:[{},{},{}],orientation:_.GroupOrientation.VERTICAL})}}class rU extends oj{static{this.ID="workbench.action.editorLayoutTwoByTwoGrid"}constructor(){super({id:rU.ID,title:(0,S.localize2)(3359,"Grid Editor Layout (2x2)"),f1:!0,category:tw.Categories.View},oo,{groups:[{groups:[{},{}]},{groups:[{},{}]}],orientation:_.GroupOrientation.HORIZONTAL})}}class rH extends oj{static{this.ID="workbench.action.editorLayoutTwoColumnsBottom"}constructor(){super({id:rH.ID,title:(0,S.localize2)(3360,"Two Columns Bottom Editor Layout"),f1:!0,category:tw.Categories.View},oo,{groups:[{},{groups:[{},{}]}],orientation:_.GroupOrientation.VERTICAL})}}class r$ extends oj{static{this.ID="workbench.action.editorLayoutTwoRowsRight"}constructor(){super({id:r$.ID,title:(0,S.localize2)(3361,"Two Rows Right Editor Layout"),f1:!0,category:tw.Categories.View},oo,{groups:[{},{groups:[{},{}]}],orientation:_.GroupOrientation.HORIZONTAL})}}class rq extends oY.Action2{constructor(e,t){super(e),this.direction=t}async run(e){let t=e.get(tR.IEditorGroupsService),i=e.get(Y.IWorkbenchLayoutService),o=(0,x.getActiveDocument)(),r=i.hasFocus(oU.Parts.EDITOR_PART)||o.activeElement===o.body,s=t.addGroup(t.activeGroup,this.direction);t.activateGroup(s),r&&s.focus()}}class rY extends oY.Action2{constructor(){super({id:"workbench.action.toggleEditorType",title:(0,S.localize2)(3366,"Toggle Editor Type"),f1:!0,category:tw.Categories.View,precondition:G.ActiveEditorAvailableEditorIdsContext})}async run(e){let t=e.get(eN.IEditorService),i=e.get(ip.IEditorResolverService),o=t.activeEditorPane;if(!o)return;let r=L.EditorResourceAccessor.getCanonicalUri(o.input);if(!r)return;let s=i.getEditors(r).map(e=>e.id).filter(e=>e!==o.input.editorId);0!==s.length&&await t.replaceEditors([{editor:o.input,replacement:{resource:r,options:{override:s[0]}}}],o.group)}}class rj extends oY.Action2{constructor(){super({id:"workbench.action.reopenTextEditor",title:(0,S.localize2)(3367,"Reopen Editor with Text Editor"),f1:!0,category:tw.Categories.View,precondition:G.ActiveEditorAvailableEditorIdsContext})}async run(e){let t=e.get(eN.IEditorService),i=t.activeEditorPane;if(!i)return;let o=L.EditorResourceAccessor.getCanonicalUri(i.input);o&&await t.replaceEditors([{editor:i.input,replacement:{resource:o,options:{override:L.DEFAULT_EDITOR_ASSOCIATION.id}}}],i.group)}}class rX extends oY.Action2{constructor(e,t,i,o){super({id:e,title:t,category:tw.Categories.View,precondition:G.ActiveEditorContext,keybinding:i,f1:!0}),this.move=o}async run(e,...t){let i=e.get(tR.IEditorGroupsService),o=e.get(eN.IEditorService),r=e.get(tT.IListService),s=(0,i2.resolveCommandsContext)(t,o,i,r);if(!s.groupedEditors.length)return;let n=await i.createAuxiliaryEditorPart(),{group:a,editors:d}=s.groupedEditors[0],l=(0,V.prepareMoveCopyEditors)(a,d,s.preserveFocus);this.move?a.moveEditors(l,n.activeGroup):a.copyEditors(l,n.activeGroup),n.activeGroup.focus()}}class rJ extends oY.Action2{constructor(e,t,i){super({id:e,title:t,category:tw.Categories.View,f1:!0}),this.move=i}async run(e){let t=e.get(tR.IEditorGroupsService),i=t.activeGroup,o=await t.createAuxiliaryEditorPart();t.mergeGroup(i,o.activeGroup,{mode:this.move?_.MergeGroupMode.MOVE_EDITORS:_.MergeGroupMode.COPY_EDITORS}),o.activeGroup.focus()}}class rZ extends oY.Action2{constructor(){super({id:"workbench.action.restoreEditorsToMainWindow",title:{...(0,S.localize2)(3376,"Restore Editors into Main Window"),mnemonicTitle:(0,S.localize)(3377,"&&Restore Editors into Main Window")},f1:!0,precondition:G.IsAuxiliaryWindowFocusedContext,category:tw.Categories.View})}async run(e){let t=e.get(tR.IEditorGroupsService);t.mergeAllGroups(t.mainPart.activeGroup)}}class rQ extends oY.Action2{constructor(){super({id:oL,title:{...(0,S.localize2)(3378,"New Empty Editor Window"),mnemonicTitle:(0,S.localize)(3379,"&&New Empty Editor Window")},f1:!0,category:tw.Categories.View})}async run(e){let t=e.get(tR.IEditorGroupsService);(await t.createAuxiliaryEditorPart()).activeGroup.focus()}}e.s(["ClearEditorHistoryAction",0,rK,"ClearEditorHistoryWithoutConfirmAction",0,rV,"ClearRecentFilesAction",0,rD,"CloseAllEditorGroupsAction",0,class extends re{constructor(){super({id:"workbench.action.closeAllGroups",title:(0,S.localize2)(3277,"Close All Editor Groups"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.KeyW)},category:tw.Categories.View})}get excludeSticky(){return!1}async doCloseAll(e){for(let t of(await super.doCloseAll(e),this.groupsToClose(e)))e.removeGroup(t)}},"CloseAllEditorsAction",0,rt,"CloseEditorInAllGroupsAction",0,ro,"CloseEditorTabAction",0,o9,"CloseEditorsInOtherGroupsAction",0,ri,"CloseLeftEditorsInGroupAction",0,o7,"CopyEditorGroupToNewWindowAction",0,class extends rJ{constructor(){super(oM,{...(0,S.localize2)(3374,"Copy Editor Group into New Window"),mnemonicTitle:(0,S.localize)(3375,"&&Copy Editor Group into New Window")},!1)}},"CopyEditorToNewindowAction",0,class extends rX{constructor(){super(oR,{...(0,S.localize2)(3370,"Copy Editor into New Window"),mnemonicTitle:(0,S.localize)(3371,"&&Copy Editor into New Window")},{primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyCode.KeyO),weight:tE.KeybindingWeight.WorkbenchContrib},!1)}},"DuplicateGroupDownAction",0,class extends rn{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupDown",title:(0,S.localize2)(3287,"Duplicate Editor Group Down"),f1:!0,category:tw.Categories.View},_.GroupDirection.DOWN)}},"DuplicateGroupLeftAction",0,class extends rn{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupLeft",title:(0,S.localize2)(3284,"Duplicate Editor Group Left"),f1:!0,category:tw.Categories.View},_.GroupDirection.LEFT)}},"DuplicateGroupRightAction",0,class extends rn{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupRight",title:(0,S.localize2)(3285,"Duplicate Editor Group Right"),f1:!0,category:tw.Categories.View},_.GroupDirection.RIGHT)}},"DuplicateGroupUpAction",0,class extends rn{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupUp",title:(0,S.localize2)(3286,"Duplicate Editor Group Up"),f1:!0,category:tw.Categories.View},_.GroupDirection.UP)}},"EditorLayoutSingleAction",0,rG,"EditorLayoutThreeColumnsAction",0,rW,"EditorLayoutThreeRowsAction",0,rB,"EditorLayoutTwoByTwoGridAction",0,rU,"EditorLayoutTwoColumnsAction",0,rF,"EditorLayoutTwoColumnsBottomAction",0,rH,"EditorLayoutTwoRowsAction",0,rz,"EditorLayoutTwoRowsRightAction",0,r$,"FocusAboveGroup",0,class extends o5{constructor(){super({id:"workbench.action.focusAboveGroup",title:(0,S.localize2)(3268,"Focus Editor Group Above"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.UpArrow)},category:tw.Categories.View},{direction:_.GroupDirection.UP})}},"FocusActiveGroupAction",0,o3,"FocusBelowGroup",0,class extends o5{constructor(){super({id:"workbench.action.focusBelowGroup",title:(0,S.localize2)(3269,"Focus Editor Group Below"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.DownArrow)},category:tw.Categories.View},{direction:_.GroupDirection.DOWN})}},"FocusFirstGroupAction",0,class extends o5{constructor(){super({id:"workbench.action.focusFirstEditorGroup",title:(0,S.localize2)(3262,"Focus First Editor Group"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyCode.Digit1},category:tw.Categories.View},{location:_.GroupLocation.FIRST})}},"FocusLastGroupAction",0,class extends o5{constructor(){super({id:"workbench.action.focusLastEditorGroup",title:(0,S.localize2)(3263,"Focus Last Editor Group"),f1:!0,category:tw.Categories.View},{location:_.GroupLocation.LAST})}},"FocusLeftGroup",0,class extends o5{constructor(){super({id:"workbench.action.focusLeftGroup",title:(0,S.localize2)(3266,"Focus Left Editor Group"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.LeftArrow)},category:tw.Categories.View},{direction:_.GroupDirection.LEFT})}},"FocusNextGroup",0,class extends o5{constructor(){super({id:"workbench.action.focusNextGroup",title:(0,S.localize2)(3264,"Focus Next Editor Group"),f1:!0,category:tw.Categories.View},{location:_.GroupLocation.NEXT})}},"FocusPreviousGroup",0,class extends o5{constructor(){super({id:"workbench.action.focusPreviousGroup",title:(0,S.localize2)(3265,"Focus Previous Editor Group"),f1:!0,category:tw.Categories.View},{location:_.GroupLocation.PREVIOUS})}},"FocusRightGroup",0,class extends o5{constructor(){super({id:"workbench.action.focusRightGroup",title:(0,S.localize2)(3267,"Focus Right Editor Group"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.RightArrow)},category:tw.Categories.View},{direction:_.GroupDirection.RIGHT})}},"JoinAllGroupsAction",0,o1,"JoinTwoGroupsAction",0,o0,"MaximizeGroupHideSidebarAction",0,rh,"MinimizeOtherGroupsAction",0,ra,"MinimizeOtherGroupsHideSidebarAction",0,rd,"MoveEditorGroupToNewWindowAction",0,class extends rJ{constructor(){super(ok,{...(0,S.localize2)(3372,"Move Editor Group into New Window"),mnemonicTitle:(0,S.localize)(3373,"&&Move Editor Group into New Window")},!0)}},"MoveEditorLeftInGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.moveEditorLeftInGroup",title:(0,S.localize2)(3334,"Move Editor Left"),keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.PageUp,mac:{primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.LeftArrow)}},f1:!0,category:tw.Categories.View},ot,{to:"left"})}},"MoveEditorRightInGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.moveEditorRightInGroup",title:(0,S.localize2)(3335,"Move Editor Right"),keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.PageDown,mac:{primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.RightArrow)}},f1:!0,category:tw.Categories.View},ot,{to:"right"})}},"MoveEditorToAboveGroupAction",0,class extends oj{constructor(){super({id:oC,title:(0,S.localize2)(3340,"Move Editor into Group Above"),f1:!0,category:tw.Categories.View},oC)}},"MoveEditorToBelowGroupAction",0,class extends oj{constructor(){super({id:ob,title:(0,S.localize2)(3341,"Move Editor into Group Below"),f1:!0,category:tw.Categories.View},ob)}},"MoveEditorToEndAction",0,class extends oj{constructor(){super({id:"workbench.action.moveEditorToEnd",title:(0,S.localize2)(3337,"Move Editor to End"),f1:!0,category:tw.Categories.View},ot,{to:"last"})}},"MoveEditorToFirstGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.moveEditorToFirstGroup",title:(0,S.localize2)(3344,"Move Editor into First Group"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.Shift|tC.KeyMod.Alt|tC.KeyCode.Digit1,mac:{primary:tC.KeyMod.CtrlCmd|tC.KeyMod.WinCtrl|tC.KeyCode.Digit1}},category:tw.Categories.View},ot,{to:"first",by:"group"})}},"MoveEditorToLastGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.moveEditorToLastGroup",title:(0,S.localize2)(3345,"Move Editor into Last Group"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.Shift|tC.KeyMod.Alt|tC.KeyCode.Digit9,mac:{primary:tC.KeyMod.CtrlCmd|tC.KeyMod.WinCtrl|tC.KeyCode.Digit9}},category:tw.Categories.View},ot,{to:"last",by:"group"})}},"MoveEditorToLeftGroupAction",0,class extends oj{constructor(){super({id:ow,title:(0,S.localize2)(3342,"Move Editor into Left Group"),f1:!0,category:tw.Categories.View},ow)}},"MoveEditorToNewWindowAction",0,class extends rX{constructor(){super(ox,{...(0,S.localize2)(3368,"Move Editor into New Window"),mnemonicTitle:(0,S.localize)(3369,"&&Move Editor into New Window")},void 0,!0)}},"MoveEditorToNextGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.moveEditorToNextGroup",title:(0,S.localize2)(3339,"Move Editor into Next Group"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Alt|tC.KeyCode.RightArrow,mac:{primary:tC.KeyMod.CtrlCmd|tC.KeyMod.WinCtrl|tC.KeyCode.RightArrow}},category:tw.Categories.View},ot,{to:"next",by:"group"})}},"MoveEditorToPreviousGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.moveEditorToPreviousGroup",title:(0,S.localize2)(3338,"Move Editor into Previous Group"),keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Alt|tC.KeyCode.LeftArrow,mac:{primary:tC.KeyMod.CtrlCmd|tC.KeyMod.WinCtrl|tC.KeyCode.LeftArrow}},f1:!0,category:tw.Categories.View},ot,{to:"previous",by:"group"})}},"MoveEditorToRightGroupAction",0,class extends oj{constructor(){super({id:of,title:(0,S.localize2)(3343,"Move Editor into Right Group"),f1:!0,category:tw.Categories.View},of)}},"MoveEditorToStartAction",0,class extends oj{constructor(){super({id:"workbench.action.moveEditorToStart",title:(0,S.localize2)(3336,"Move Editor to Start"),f1:!0,category:tw.Categories.View},ot,{to:"first"})}},"MoveGroupDownAction",0,class extends rs{constructor(){super({id:"workbench.action.moveActiveEditorGroupDown",title:(0,S.localize2)(3283,"Move Editor Group Down"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyCode.DownArrow)},category:tw.Categories.View},_.GroupDirection.DOWN)}},"MoveGroupLeftAction",0,class extends rs{constructor(){super({id:"workbench.action.moveActiveEditorGroupLeft",title:(0,S.localize2)(3280,"Move Editor Group Left"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyCode.LeftArrow)},category:tw.Categories.View},_.GroupDirection.LEFT)}},"MoveGroupRightAction",0,class extends rs{constructor(){super({id:"workbench.action.moveActiveEditorGroupRight",title:(0,S.localize2)(3281,"Move Editor Group Right"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyCode.RightArrow)},category:tw.Categories.View},_.GroupDirection.RIGHT)}},"MoveGroupUpAction",0,class extends rs{constructor(){super({id:"workbench.action.moveActiveEditorGroupUp",title:(0,S.localize2)(3282,"Move Editor Group Up"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyCode.UpArrow)},category:tw.Categories.View},_.GroupDirection.UP)}},"NavigateBackwardsAction",0,rm,"NavigateBackwardsInEditsAction",0,rC,"NavigateBackwardsInNavigationsAction",0,rS,"NavigateBetweenGroupsAction",0,o2,"NavigateForwardAction",0,rg,"NavigateForwardInEditsAction",0,ry,"NavigateForwardInNavigationsAction",0,rf,"NavigatePreviousAction",0,rv,"NavigatePreviousInEditsAction",0,rb,"NavigatePreviousInNavigationsAction",0,r_,"NavigateToLastEditLocationAction",0,rw,"NavigateToLastNavigationLocationAction",0,rE,"NewEditorGroupAboveAction",0,class extends rq{constructor(){super({id:"workbench.action.newGroupAbove",title:(0,S.localize2)(3364,"New Editor Group Above"),f1:!0,category:tw.Categories.View},_.GroupDirection.UP)}},"NewEditorGroupBelowAction",0,class extends rq{constructor(){super({id:"workbench.action.newGroupBelow",title:(0,S.localize2)(3365,"New Editor Group Below"),f1:!0,category:tw.Categories.View},_.GroupDirection.DOWN)}},"NewEditorGroupLeftAction",0,class extends rq{constructor(){super({id:"workbench.action.newGroupLeft",title:(0,S.localize2)(3362,"New Editor Group to the Left"),f1:!0,category:tw.Categories.View},_.GroupDirection.LEFT)}},"NewEditorGroupRightAction",0,class extends rq{constructor(){super({id:"workbench.action.newGroupRight",title:(0,S.localize2)(3363,"New Editor Group to the Right"),f1:!0,category:tw.Categories.View},_.GroupDirection.RIGHT)}},"NewEmptyEditorWindowAction",0,rQ,"OpenFirstEditorInGroup",0,class extends rp{constructor(){super({id:"workbench.action.firstEditorInGroup",title:(0,S.localize2)(3299,"Open First Editor in Group"),f1:!0,category:tw.Categories.View})}navigate(e){let t=e.activeGroup;return{editor:t.getEditors(L.EditorsOrder.SEQUENTIAL)[0],groupId:t.id}}},"OpenLastEditorInGroup",0,class extends rp{constructor(){super({id:"workbench.action.lastEditorInGroup",title:(0,S.localize2)(3300,"Open Last Editor in Group"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.Alt|tC.KeyCode.Digit0,secondary:[tC.KeyMod.CtrlCmd|tC.KeyCode.Digit9],mac:{primary:tC.KeyMod.WinCtrl|tC.KeyCode.Digit0,secondary:[tC.KeyMod.CtrlCmd|tC.KeyCode.Digit9]}},category:tw.Categories.View})}navigate(e){let t=e.activeGroup,i=t.getEditors(L.EditorsOrder.SEQUENTIAL);return{editor:i[i.length-1],groupId:t.id}}},"OpenNextEditor",0,class extends rp{constructor(){super({id:"workbench.action.nextEditor",title:(0,S.localize2)(3295,"Open Next Editor"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyCode.PageDown,mac:{primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Alt|tC.KeyCode.RightArrow,secondary:[tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.BracketRight]}},category:tw.Categories.View})}navigate(e){let t=e.activeGroup,i=t.getEditors(L.EditorsOrder.SEQUENTIAL),o=t.activeEditor?i.indexOf(t.activeEditor):-1;if(o+1<i.length)return{editor:i[o+1],groupId:t.id};let r=new Set,s=e.activeGroup;for(;s&&!r.has(s.id);)if(s=e.findGroup({location:_.GroupLocation.NEXT},s,!0)){r.add(s.id);let e=s.getEditors(L.EditorsOrder.SEQUENTIAL);if(e.length>0)return{editor:e[0],groupId:s.id}}}},"OpenNextEditorInGroup",0,class extends rp{constructor(){super({id:"workbench.action.nextEditorInGroup",title:(0,S.localize2)(3297,"Open Next Editor in Group"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.PageDown),mac:{primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyMod.Alt|tC.KeyCode.RightArrow)}},category:tw.Categories.View})}navigate(e){let t=e.activeGroup,i=t.getEditors(L.EditorsOrder.SEQUENTIAL),o=t.activeEditor?i.indexOf(t.activeEditor):-1;return{editor:o+1<i.length?i[o+1]:i[0],groupId:t.id}}},"OpenNextRecentlyUsedEditorAction",0,rM,"OpenNextRecentlyUsedEditorInGroupAction",0,rO,"OpenPreviousEditor",0,class extends rp{constructor(){super({id:"workbench.action.previousEditor",title:(0,S.localize2)(3296,"Open Previous Editor"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyCode.PageUp,mac:{primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Alt|tC.KeyCode.LeftArrow,secondary:[tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.BracketLeft]}},category:tw.Categories.View})}navigate(e){let t=e.activeGroup,i=t.getEditors(L.EditorsOrder.SEQUENTIAL),o=t.activeEditor?i.indexOf(t.activeEditor):-1;if(o>0)return{editor:i[o-1],groupId:t.id};let r=new Set,s=e.activeGroup;for(;s&&!r.has(s.id);)if(s=e.findGroup({location:_.GroupLocation.PREVIOUS},s,!0)){r.add(s.id);let e=s.getEditors(L.EditorsOrder.SEQUENTIAL);if(e.length>0)return{editor:e[e.length-1],groupId:s.id}}}},"OpenPreviousEditorInGroup",0,class extends rp{constructor(){super({id:"workbench.action.previousEditorInGroup",title:(0,S.localize2)(3298,"Open Previous Editor in Group"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.PageUp),mac:{primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyMod.Alt|tC.KeyCode.LeftArrow)}},category:tw.Categories.View})}navigate(e){let t=e.activeGroup,i=t.getEditors(L.EditorsOrder.SEQUENTIAL),o=t.activeEditor?i.indexOf(t.activeEditor):-1;return{editor:o>0?i[o-1]:i[i.length-1],groupId:t.id}}},"OpenPreviousRecentlyUsedEditorAction",0,rL,"OpenPreviousRecentlyUsedEditorInGroupAction",0,rP,"QuickAccessLeastRecentlyUsedEditorAction",0,class extends rR{constructor(){super({id:"workbench.action.quickOpenLeastRecentlyUsedEditor",title:(0,S.localize2)(3323,"Quick Open Least Recently Used Editor"),f1:!0,category:tw.Categories.View},iT.PREFIX,void 0)}},"QuickAccessLeastRecentlyUsedEditorInGroupAction",0,class extends rR{constructor(){super({id:"workbench.action.quickOpenLeastRecentlyUsedEditorInGroup",title:(0,S.localize2)(3325,"Quick Open Least Recently Used Editor in Group"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyMod.Shift|tC.KeyCode.Tab,mac:{primary:tC.KeyMod.WinCtrl|tC.KeyMod.Shift|tC.KeyCode.Tab}},precondition:G.ActiveEditorGroupEmptyContext.toNegated(),category:tw.Categories.View},iI.PREFIX,iy.ItemActivation.LAST)}},"QuickAccessPreviousEditorFromHistoryAction",0,rk,"QuickAccessPreviousRecentlyUsedEditorAction",0,class extends rR{constructor(){super({id:"workbench.action.quickOpenPreviousRecentlyUsedEditor",title:(0,S.localize2)(3322,"Quick Open Previous Recently Used Editor"),f1:!0,category:tw.Categories.View},iT.PREFIX,void 0)}},"QuickAccessPreviousRecentlyUsedEditorInGroupAction",0,class extends rR{constructor(){super({id:"workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",title:(0,S.localize2)(3324,"Quick Open Previous Recently Used Editor in Group"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:tC.KeyMod.CtrlCmd|tC.KeyCode.Tab,mac:{primary:tC.KeyMod.WinCtrl|tC.KeyCode.Tab}},precondition:G.ActiveEditorGroupEmptyContext.toNegated(),category:tw.Categories.View},iI.PREFIX,void 0)}},"ReOpenInTextEditorAction",0,rj,"ReopenClosedEditorAction",0,rI,"ResetGroupSizesAction",0,rl,"RestoreEditorsToMainWindowAction",0,rZ,"RevertAndCloseEditorAction",0,o8,"ShowAllEditorsByAppearanceAction",0,rA,"ShowAllEditorsByMostRecentlyUsedAction",0,rx,"ShowEditorsInActiveGroupByMostRecentlyUsedAction",0,rT,"SplitEditorAction",0,oJ,"SplitEditorDownAction",0,oQ,"SplitEditorLeftAction",0,class extends oj{constructor(){super({id:ov,title:(0,S.localize2)(3254,"Split Editor Left"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.Backslash)},category:tw.Categories.View},ov)}},"SplitEditorOrthogonalAction",0,class extends oX{constructor(){super({id:"workbench.action.splitEditorOrthogonal",title:(0,S.localize2)(3253,"Split Editor Orthogonal"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.Backslash)},category:tw.Categories.View})}getDirection(e){return(0,_.preferredSideBySideGroupDirection)(e)===_.GroupDirection.RIGHT?_.GroupDirection.DOWN:_.GroupDirection.RIGHT}},"SplitEditorRightAction",0,class extends oj{constructor(){super({id:oy,title:(0,S.localize2)(3255,"Split Editor Right"),f1:!0,keybinding:{weight:tE.KeybindingWeight.WorkbenchContrib,primary:(0,tC.KeyChord)(tC.KeyMod.CtrlCmd|tC.KeyCode.KeyK,tC.KeyMod.CtrlCmd|tC.KeyCode.Backslash)},category:tw.Categories.View},oy)}},"SplitEditorToAboveGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.splitEditorToAboveGroup",title:(0,S.localize2)(3348,"Split Editor into Group Above"),f1:!0,category:tw.Categories.View},oi,{to:"up",by:"group"})}},"SplitEditorToBelowGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.splitEditorToBelowGroup",title:(0,S.localize2)(3349,"Split Editor into Group Below"),f1:!0,category:tw.Categories.View},oi,{to:"down",by:"group"})}},"SplitEditorToFirstGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.splitEditorToFirstGroup",title:(0,S.localize2)(3352,"Split Editor into First Group"),f1:!0,category:tw.Categories.View},oi,{to:"first",by:"group"})}},"SplitEditorToLastGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.splitEditorToLastGroup",title:(0,S.localize2)(3353,"Split Editor into Last Group"),f1:!0,category:tw.Categories.View},oi,{to:"last",by:"group"})}},"SplitEditorToLeftGroupAction",0,rN,"SplitEditorToNextGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.splitEditorToNextGroup",title:(0,S.localize2)(3347,"Split Editor into Next Group"),f1:!0,category:tw.Categories.View},oi,{to:"next",by:"group"})}},"SplitEditorToPreviousGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.splitEditorToPreviousGroup",title:(0,S.localize2)(3346,"Split Editor into Previous Group"),f1:!0,category:tw.Categories.View},oi,{to:"previous",by:"group"})}},"SplitEditorToRightGroupAction",0,class extends oj{constructor(){super({id:"workbench.action.splitEditorToRightGroup",title:(0,S.localize2)(3351,"Split Editor into Right Group"),f1:!0,category:tw.Categories.View},oi,{to:"right",by:"group"})}},"SplitEditorUpAction",0,oZ,"ToggleEditorTypeAction",0,rY,"ToggleGroupSizesAction",0,rc,"ToggleMaximizeEditorGroupAction",0,ru,"UnpinEditorAction",0,o4],602731);var r0=e.i(232762),r1=e.i(744194),r2=e.i(334326),r3=D;class r5 extends r3.Disposable{constructor(e){super(),this.model=e,this._onDidModelChange=this._register(new I.Emitter),this.onDidModelChange=this._onDidModelChange.event,this._register(this.model.onDidModelChange(e=>{let t=e.editorIndex??e.editor;(void 0===t||this.filter(t))&&this._onDidModelChange.fire(e)}))}get id(){return this.model.id}get isLocked(){return this.model.isLocked}get stickyCount(){return this.model.stickyCount}get activeEditor(){return this.model.activeEditor&&this.filter(this.model.activeEditor)?this.model.activeEditor:null}get previewEditor(){return this.model.previewEditor&&this.filter(this.model.previewEditor)?this.model.previewEditor:null}get selectedEditors(){return this.model.selectedEditors.filter(e=>this.filter(e))}isPinned(e){return this.model.isPinned(e)}isTransient(e){return this.model.isTransient(e)}isSticky(e){return this.model.isSticky(e)}isActive(e){return this.model.isActive(e)}isSelected(e){return this.model.isSelected(e)}isFirst(e){return this.model.isFirst(e,this.getEditors(L.EditorsOrder.SEQUENTIAL))}isLast(e){return this.model.isLast(e,this.getEditors(L.EditorsOrder.SEQUENTIAL))}getEditors(e,t){return this.model.getEditors(e,t).filter(e=>this.filter(e))}findEditor(e,t){let i=this.model.findEditor(e,t);if(i)return this.filter(i[1])?i:void 0}}class r6 extends r5{get count(){return this.model.stickyCount}getEditors(e,t){return t?.excludeSticky?[]:e===L.EditorsOrder.SEQUENTIAL?this.model.getEditors(L.EditorsOrder.SEQUENTIAL).slice(0,this.model.stickyCount):super.getEditors(e,t)}isSticky(e){return!0}getEditorByIndex(e){return e<this.count?this.model.getEditorByIndex(e):void 0}indexOf(e,t,i){let o=this.model.indexOf(e,t,i);return o<0||o>=this.model.stickyCount?-1:o}contains(e,t){let i=this.model.indexOf(e,void 0,t);return i>=0&&i<this.model.stickyCount}filter(e){return this.model.isSticky(e)}}class r4 extends r5{get count(){return this.model.count-this.model.stickyCount}get stickyCount(){return 0}isSticky(e){return!1}getEditors(e,t){return e===L.EditorsOrder.SEQUENTIAL?this.model.getEditors(L.EditorsOrder.SEQUENTIAL).slice(this.model.stickyCount):super.getEditors(e,t)}getEditorByIndex(e){return e>=0?this.model.getEditorByIndex(e+this.model.stickyCount):void 0}indexOf(e,t,i){let o=this.model.indexOf(e,t,i);return o<this.model.stickyCount||o>=this.model.count?-1:o-this.model.stickyCount}contains(e,t){let i=this.model.indexOf(e,void 0,t);return i>=this.model.stickyCount&&i<this.model.count}filter(e){return!this.model.isSticky(e)}}(0,K.registerCss)(void 0);let r9=class extends oW{static{g=this}static{this.SCROLLBAR_SIZES={default:3,large:10}}static{this.TAB_WIDTH={compact:38,shrink:80,fit:120}}static{this.DRAG_OVER_OPEN_TAB_THRESHOLD=1500}static{this.MOUSE_WHEEL_EVENT_THRESHOLD=150}static{this.MOUSE_WHEEL_DISTANCE_THRESHOLD=1.5}constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p,g,m,v){super(e,t,i,o,r,s,n,a,d,l,c,h,m,v),this.editorService=u,this.pathService=p,this.treeViewsDragAndDropService=g,this.closeEditorAction=this._register(this.instantiationService.createInstance(o9,o9.ID,o9.LABEL)),this.unpinEditorAction=this._register(this.instantiationService.createInstance(o4,o4.ID,o4.LABEL)),this.tabResourceLabels=this._register(this.instantiationService.createInstance(tP.ResourceLabels,tP.DEFAULT_LABELS_CONTAINER)),this.tabLabels=[],this.tabActionBars=[],this.tabDisposables=[],this.dimensions={container:x.Dimension.None,available:x.Dimension.None},this.layoutScheduler=this._register(new D.MutableDisposable),this.path=eY.isWindows?t$.win32:t$.posix,this.lastMouseWheelEventTime=0,this.isMouseOverTabs=!1,this.updateEditorLabelScheduler=this._register(new ex.RunOnceScheduler(()=>this.doUpdateEditorLabels(),0)),(async()=>this.path=await this.pathService.path)(),this._register(this.tabResourceLabels.onDidChangeDecorations(()=>this.doHandleDecorationsChange()))}create(e){return super.create(e),this.titleContainer=e,this.tabsAndActionsContainer=(0,x.$)(".tabs-and-actions-container"),this.titleContainer.appendChild(this.tabsAndActionsContainer),this.tabsContainer=(0,x.$)(".tabs-container",{role:"tablist",draggable:!0}),this._register(eR.Gesture.addTarget(this.tabsContainer)),this.tabSizingFixedDisposables=this._register(new D.DisposableStore),this.updateTabSizing(!1),this.tabsScrollbar=this.createTabsScrollbar(this.tabsContainer),this.tabsAndActionsContainer.appendChild(this.tabsScrollbar.getDomNode()),this.registerTabsContainerListeners(this.tabsContainer,this.tabsScrollbar),this.createEditorActionsToolBar(this.tabsAndActionsContainer,["editor-actions"]),this.updateTabsControlVisibility(),this.tabsAndActionsContainer}createTabsScrollbar(e){let t=this._register(new ei.ScrollableElement(e,{horizontal:this.getTabsScrollbarVisibility(),horizontalScrollbarSize:this.getTabsScrollbarSizing(),vertical:eo.ScrollbarVisibility.Hidden,scrollYToX:!0,useShadows:!1}));return this._register(t.onScroll(t=>{t.scrollLeftChanged&&(e.scrollLeft=t.scrollLeft)})),t}updateTabsScrollbarSizing(){this.tabsScrollbar?.updateOptions({horizontalScrollbarSize:this.getTabsScrollbarSizing()})}updateTabsScrollbarVisibility(){this.tabsScrollbar?.updateOptions({horizontal:this.getTabsScrollbarVisibility()})}updateTabSizing(e){let[t,i]=(0,J.assertReturnsAllDefined)(this.tabsContainer,this.tabSizingFixedDisposables);i.clear();let o=this.groupsView.partOptions;"fixed"===o.tabSizing?(t.style.setProperty("--tab-sizing-fixed-min-width",`${o.tabSizingFixedMinWidth}px`),t.style.setProperty("--tab-sizing-fixed-max-width",`${o.tabSizingFixedMaxWidth}px`),i.add((0,x.addDisposableListener)(t,x.EventType.MOUSE_ENTER,()=>{this.isMouseOverTabs=!0})),i.add((0,x.addDisposableListener)(t,x.EventType.MOUSE_LEAVE,()=>{this.isMouseOverTabs=!1,this.updateTabsFixedWidth(!1)}))):e&&(t.style.removeProperty("--tab-sizing-fixed-min-width"),t.style.removeProperty("--tab-sizing-fixed-max-width"),this.updateTabsFixedWidth(!1))}updateTabsFixedWidth(e){this.forEachTab((t,i,o)=>{if(e){let{width:e}=o.getBoundingClientRect();o.style.setProperty("--tab-sizing-current-width",`${e}px`)}else o.style.removeProperty("--tab-sizing-current-width")})}getTabsScrollbarSizing(){return"large"!==this.groupsView.partOptions.titleScrollbarSizing?g.SCROLLBAR_SIZES.default:g.SCROLLBAR_SIZES.large}getTabsScrollbarVisibility(){switch(this.groupsView.partOptions.titleScrollbarVisibility){case"visible":return eo.ScrollbarVisibility.Visible;case"hidden":return eo.ScrollbarVisibility.Hidden;default:return eo.ScrollbarVisibility.Auto}}registerTabsContainerListeners(e,t){let i;for(let i of(this._register((0,x.addDisposableListener)(e,x.EventType.SCROLL,()=>{e.classList.contains("scroll")&&t.setScrollPosition({scrollLeft:e.scrollLeft})})),[eR.EventType.Tap,x.EventType.DBLCLICK]))this._register((0,x.addDisposableListener)(e,i,t=>{if(i===x.EventType.DBLCLICK){if(t.target!==e)return}else if(2!==t.tapCount||t.initialTarget!==e)return;x.EventHelper.stop(t),this.editorService.openEditor({resource:void 0,options:{pinned:!0,index:this.groupView.count,override:L.DEFAULT_EDITOR_ASSOCIATION.id}},this.groupView.id)}));this._register((0,x.addDisposableListener)(e,x.EventType.MOUSE_DOWN,e=>{1===e.button&&e.preventDefault()})),eY.isLinux&&this._register((0,x.addDisposableListener)(e,x.EventType.MOUSE_UP,e=>{1===e.button&&e.preventDefault()}));let o=!1;this._register(new x.DragAndDropObserver(e,{onDragStart:t=>{o=this.onGroupDragStart(t,e)},onDrag:e=>{i=e},onDragEnter:t=>{if(e.classList.add("scroll"),t.target===e){if(!this.isSupportedDropTransfer(t)){t.dataTransfer&&(t.dataTransfer.dropEffect="none");return}!this.editorTransfer.hasData(tO.DraggedEditorIdentifier.prototype)&&t.dataTransfer&&(t.dataTransfer.dropEffect="copy"),this.updateDropFeedback(e,!0,t)}},onDragLeave:t=>{this.updateDropFeedback(e,!1,t),e.classList.remove("scroll")},onDragEnd:t=>{this.updateDropFeedback(e,!1,t),e.classList.remove("scroll"),this.onGroupDragEnd(t,i,e,o)},onDrop:t=>{if(this.updateDropFeedback(e,!1,t),e.classList.remove("scroll"),t.target===e){let i=this.groupTransfer.hasData(tO.DraggedEditorGroupIdentifier.prototype);this.onDrop(t,i?this.groupView.count:this.tabsModel.count,e)}}})),this._register((0,x.addDisposableListener)(e,x.EventType.MOUSE_WHEEL,e=>{let t,i=this.groupView.activeEditor;if(!i||this.groupView.count<2)return;if(!0===this.groupsView.partOptions.scrollToSwitchTabs){if(e.shiftKey)return}else if(!e.shiftKey)return;let o=Date.now();if(o-this.lastMouseWheelEventTime<g.MOUSE_WHEEL_EVENT_THRESHOLD-2*(Math.abs(e.deltaX)+Math.abs(e.deltaY)))return;if(this.lastMouseWheelEventTime=o,e.deltaX+e.deltaY<-g.MOUSE_WHEEL_DISTANCE_THRESHOLD)t=-1;else{if(!(e.deltaX+e.deltaY>g.MOUSE_WHEEL_DISTANCE_THRESHOLD))return;t=1}let r=this.groupView.getEditorByIndex(this.groupView.getIndexOfEditor(i)+t);r&&(this.groupView.openEditor(r),x.EventHelper.stop(e,!0))}));let r=t=>{x.EventHelper.stop(t);let i=e;(0,x.isMouseEvent)(t)&&(i=new eP.StandardMouseEvent((0,x.getWindow)(this.parent),t)),this.contextMenuService.showContextMenu({getAnchor:()=>i,menuId:eL.MenuId.EditorTabsBarContext,contextKeyService:this.contextKeyService,menuActionOptions:{shouldForwardArgs:!0},getActionsContext:()=>({groupId:this.groupView.id}),getKeyBinding:e=>this.getKeybinding(e),onHide:()=>this.groupView.focus()})};this._register((0,x.addDisposableListener)(e,eR.EventType.Contextmenu,e=>r(e))),this._register((0,x.addDisposableListener)(e,x.EventType.CONTEXT_MENU,e=>r(e)))}doHandleDecorationsChange(){this.layout(this.dimensions)}updateEditorActionsToolbar(){super.updateEditorActionsToolbar(),this.layout(this.dimensions)}openEditor(e,t){let i=this.handleOpenedEditors();return t?.focusTabControl&&this.withTab(e,(e,t,i)=>i.focus()),i}openEditors(e){return this.handleOpenedEditors()}handleOpenedEditors(){this.updateTabsControlVisibility();let[e,t]=(0,J.assertReturnsAllDefined)(this.tabsContainer,this.tabsScrollbar);for(let i=e.children.length;i<this.tabsModel.count;i++)e.appendChild(this.createTab(i,e,t));let i=this.didActiveEditorChange(),o=this.tabLabels;this.computeTabLabels();let r=!1;return i||o.length!==this.tabLabels.length||o.some((e,t)=>!this.equalsEditorInputLabel(e,this.tabLabels.at(t)))?(this.redraw({forceRevealActiveTab:!0}),r=!0):this.layout(this.dimensions,{forceRevealActiveTab:!0}),r}didActiveEditorChange(){return!(!(!this.activeTabLabel?.editor&&this.tabsModel.activeEditor||this.activeTabLabel?.editor&&!this.tabsModel.activeEditor)&&this.activeTabLabel?.editor&&this.tabsModel.isActive(this.activeTabLabel.editor))}equalsEditorInputLabel(e,t){return e===t||!!e&&!!t&&e.name===t.name&&e.description===t.description&&e.forceDescription===t.forceDescription&&e.title===t.title&&e.ariaLabel===t.ariaLabel}beforeCloseEditor(e){if(this.isMouseOverTabs&&"fixed"===this.groupsView.partOptions.tabSizing){let t=this.tabsModel.isLast(e);this.updateTabsFixedWidth(!t)}}closeEditor(e){this.handleClosedEditors()}closeEditors(e){this.handleClosedEditors()}handleClosedEditors(){if(this.tabsModel.count){let e=(0,J.assertReturnsDefined)(this.tabsContainer);for(;e.children.length>this.tabsModel.count;)e.lastChild?.remove(),(0,D.dispose)(this.tabDisposables.pop());this.computeTabLabels(),this.redraw({forceRevealActiveTab:!0})}else this.tabsContainer&&(0,x.clearNode)(this.tabsContainer),this.tabDisposables=(0,D.dispose)(this.tabDisposables),this.tabResourceLabels.clear(),this.tabLabels=[],this.activeTabLabel=void 0,this.tabActionBars=[],this.clearEditorActionsToolbar(),this.updateTabsControlVisibility()}moveEditor(e,t,i){let o=this.tabLabels[t];this.tabLabels.splice(t,1),this.tabLabels.splice(i,0,o),this.forEachTab((e,t,i,o,r,s)=>{this.redrawTab(e,t,i,o,r,s)},Math.min(t,i),Math.max(t,i)),this.layout(this.dimensions,{forceRevealActiveTab:!0})}pinEditor(e){this.withTab(e,(e,t,i,o,r)=>this.redrawTabLabel(e,t,i,o,r))}stickEditor(e){this.doHandleStickyEditorChange(e)}unstickEditor(e){this.doHandleStickyEditorChange(e)}doHandleStickyEditorChange(e){this.withTab(e,(e,t,i,o,r,s)=>this.redrawTab(e,t,i,o,r,s)),this.forEachTab((e,t,i,o,r)=>{this.redrawTabBorders(t,i)}),this.layout(this.dimensions,{forceRevealActiveTab:!0})}setActive(e){this.forEachTab((t,i,o,r,s,n)=>{this.redrawTabSelectedActiveAndDirty(e,t,o,n)}),this.updateEditorActionsToolbar(),this.layout(this.dimensions,{forceRevealActiveTab:!0})}updateEditorSelections(){this.forEachTab((e,t,i,o,r,s)=>{this.redrawTabSelectedActiveAndDirty(this.groupsView.activeGroup===this.groupView,e,i,s)})}updateEditorLabel(e){this.updateEditorLabelScheduler.schedule()}doUpdateEditorLabels(){this.computeTabLabels(),this.forEachTab((e,t,i,o,r)=>{this.redrawTabLabel(e,t,i,o,r)}),this.layout(this.dimensions)}updateEditorDirty(e){this.withTab(e,(e,t,i,o,r,s)=>this.redrawTabSelectedActiveAndDirty(this.groupsView.activeGroup===this.groupView,e,i,s))}updateOptions(e,t){super.updateOptions(e,t),e.labelFormat!==t.labelFormat&&this.computeTabLabels(),e.titleScrollbarSizing!==t.titleScrollbarSizing&&this.updateTabsScrollbarSizing(),e.titleScrollbarVisibility!==t.titleScrollbarVisibility&&this.updateTabsScrollbarVisibility(),e.alwaysShowEditorActions!==t.alwaysShowEditorActions&&this.updateEditorActionsToolbar(),(e.tabSizingFixedMinWidth!==t.tabSizingFixedMinWidth||e.tabSizingFixedMaxWidth!==t.tabSizingFixedMaxWidth||e.tabSizing!==t.tabSizing)&&this.updateTabSizing(!0),e.labelFormat===t.labelFormat&&e.tabActionLocation===t.tabActionLocation&&e.tabActionCloseVisibility===t.tabActionCloseVisibility&&e.tabActionUnpinVisibility===t.tabActionUnpinVisibility&&e.tabSizing===t.tabSizing&&e.pinnedTabSizing===t.pinnedTabSizing&&e.showIcons===t.showIcons&&e.hasIcons===t.hasIcons&&e.highlightModifiedTabs===t.highlightModifiedTabs&&e.wrapTabs===t.wrapTabs&&e.showTabIndex===t.showTabIndex&&(0,ix.equals)(e.decorations,t.decorations)||this.redraw()}updateStyles(){this.redraw()}forEachTab(e,t,i){this.tabsModel.getEditors(L.EditorsOrder.SEQUENTIAL).forEach((o,r)=>{"number"==typeof t&&t>r||"number"==typeof i&&i<r||this.doWithTab(r,o,e)})}withTab(e,t){this.doWithTab(this.tabsModel.indexOf(e),e,t)}doWithTab(e,t,i){let o=(0,J.assertReturnsDefined)(this.tabsContainer).children[e],r=this.tabResourceLabels.get(e),s=this.tabLabels[e],n=this.tabActionBars[e];o&&r&&s&&i(t,e,o,r,s,n)}createTab(e,t,i){let o=(0,x.$)(".tab",{draggable:!0,role:"tab"}),r=eR.Gesture.addTarget(o),s=(0,x.$)(".tab-border-top-container");o.appendChild(s);let n=this.tabResourceLabels.create(o,{hoverTargetOverride:o}),a=(0,x.$)(".tab-actions");o.appendChild(a);let d=this,l=new oF({groupId:this.groupView.id,get editorIndex(){return d.toEditorIndex(e)}}),c=new ek.ActionBar(a,{ariaLabel:(0,S.localize)(3506,"Tab actions"),actionRunner:l}),h=c.onWillRun(e=>{e.action.id===this.closeEditorAction.id&&this.blockRevealActiveTabOnce()}),u=(0,D.combinedDisposable)(l,c,h,(0,D.toDisposable)((0,P.insert)(this.tabActionBars,c))),p=(0,x.$)(".tab-fade-hider");o.appendChild(p);let g=(0,x.$)(".tab-border-bottom-container");o.appendChild(g);let m=this.registerTabListeners(o,e,t,i);return this.tabDisposables.push((0,D.combinedDisposable)(r,m,u,n)),o}toEditorIndex(e){let t=(0,J.assertReturnsDefined)(this.tabsModel.getEditorByIndex(e));return this.groupView.getIndexOfEditor(t)}registerTabListeners(e,t,i,o){let r,s=new D.DisposableStore,n=async(i,o)=>{if(e.blur(),(0,x.isMouseEvent)(i)&&(0!==i.button||eY.isMacintosh&&i.ctrlKey)){1===i.button&&i.preventDefault();return}if(this.originatesFromTabActionBar(i))return;let r=this.tabsModel.getEditorByIndex(t);if(r)if(i.shiftKey){let e;if(this.lastSingleSelectSelectedEditor&&this.tabsModel.isSelected(this.lastSingleSelectSelectedEditor))e=this.lastSingleSelectSelectedEditor;else{let t=(0,J.assertReturnsDefined)(this.groupView.activeEditor);this.lastSingleSelectSelectedEditor=t,e=t}await this.selectEditorsBetween(r,e)}else if(i.ctrlKey&&!eY.isMacintosh||i.metaKey&&eY.isMacintosh)this.tabsModel.isSelected(r)?await this.unselectEditor(r):(await this.selectEditor(r),this.lastSingleSelectSelectedEditor=r);else{let e=this.tabsModel.isSelected(r)?this.groupView.selectedEditors.filter(e=>!e.matches(r)):[];await this.groupView.openEditor(r,{preserveFocus:o,activation:ed.EditorActivation.ACTIVATE},{inactiveSelection:e,focusTabControl:!0})}},a=i=>{x.EventHelper.stop(i);let o=this.tabsModel.getEditorByIndex(t);o&&this.onTabContextMenu(o,i,e)};for(let r of(s.add((0,x.addDisposableListener)(e,x.EventType.MOUSE_DOWN,e=>n(e,!1))),s.add((0,x.addDisposableListener)(e,eR.EventType.Tap,e=>n(e,!0))),s.add((0,x.addDisposableListener)(e,eR.EventType.Change,e=>{o.setScrollPosition({scrollLeft:o.getScrollPosition().scrollLeft-e.translationX})})),s.add((0,x.addDisposableListener)(e,x.EventType.MOUSE_UP,async t=>{x.EventHelper.stop(t),e.blur(),(0,x.isMouseEvent)(t)&&(0!==t.button||eY.isMacintosh&&t.ctrlKey)||this.originatesFromTabActionBar(t)||t.ctrlKey&&!eY.isMacintosh||t.metaKey&&eY.isMacintosh||t.shiftKey||!(this.groupView.selectedEditors.length>1)||await this.unselectAllEditors()})),s.add((0,x.addDisposableListener)(e,x.EventType.AUXCLICK,e=>{if(1===e.button){x.EventHelper.stop(e,!0);let i=this.tabsModel.getEditorByIndex(t);if(i){if((0,L.preventEditorClose)(this.tabsModel,i,L.EditorCloseMethod.MOUSE,this.groupsView.partOptions))return;this.blockRevealActiveTabOnce(),this.closeEditorAction.run({groupId:this.groupView.id,editorIndex:this.groupView.getIndexOfEditor(i)})}}})),s.add((0,x.addDisposableListener)(e,x.EventType.KEY_DOWN,e=>{let t=new ir.StandardKeyboardEvent(e);t.shiftKey&&t.keyCode===tC.KeyCode.F10&&a(e)})),s.add((0,x.addDisposableListener)(e,eR.EventType.Contextmenu,e=>{a(e)})),s.add((0,x.addDisposableListener)(e,x.EventType.KEY_UP,e=>{let r=new ir.StandardKeyboardEvent(e),s=!1;if(r.equals(tC.KeyCode.Enter)||r.equals(tC.KeyCode.Space)){s=!0;let e=this.tabsModel.getEditorByIndex(t);e&&this.groupView.openEditor(e)}else if([tC.KeyCode.LeftArrow,tC.KeyCode.RightArrow,tC.KeyCode.UpArrow,tC.KeyCode.DownArrow,tC.KeyCode.Home,tC.KeyCode.End].some(e=>r.equals(e))){let e=this.toEditorIndex(t);r.equals(tC.KeyCode.LeftArrow)||r.equals(tC.KeyCode.UpArrow)?e-=1:r.equals(tC.KeyCode.RightArrow)||r.equals(tC.KeyCode.DownArrow)?e+=1:e=r.equals(tC.KeyCode.Home)?0:this.groupView.count-1;let i=this.groupView.getEditorByIndex(e);i&&(s=!0,this.groupView.openEditor(i,{preserveFocus:!0},{focusTabControl:!0}))}s&&x.EventHelper.stop(e,!0),o.setScrollPosition({scrollLeft:i.scrollLeft})})),[eR.EventType.Tap,x.EventType.DBLCLICK]))s.add((0,x.addDisposableListener)(e,r,e=>{if(r===x.EventType.DBLCLICK)x.EventHelper.stop(e);else if(2!==e.tapCount)return;let i=this.tabsModel.getEditorByIndex(t);if(i&&this.tabsModel.isPinned(i))switch(this.groupsView.partOptions.doubleClickTabToToggleEditorGroupSizes){case"maximize":this.groupsView.toggleMaximizeGroup(this.groupView);break;case"expand":this.groupsView.toggleExpandGroup(this.groupView)}else this.groupView.pinEditor(i)}));s.add((0,x.addDisposableListener)(e,x.EventType.CONTEXT_MENU,i=>{x.EventHelper.stop(i,!0);let o=this.tabsModel.getEditorByIndex(t);o&&this.onTabContextMenu(o,i,e)},!0));let d=!1;return s.add(new x.DragAndDropObserver(e,{onDragStart:i=>{let o=this.tabsModel.getEditorByIndex(t);if(!o)return;d=this.isNewWindowOperation(i);let r=this.groupView.selectedEditors;if(this.editorTransfer.setData(r.map(e=>new tO.DraggedEditorIdentifier({editor:e,groupId:this.groupView.id})),tO.DraggedEditorIdentifier.prototype),i.dataTransfer)if(i.dataTransfer.effectAllowed="copyMove",r.length>1){let t=`${o.getName()} + ${r.length-1}`;(0,tv.applyDragImage)(i,e,t)}else i.dataTransfer.setDragImage(e,0,0);this.doFillResourceDataTransfers(r,i,d),(0,x.scheduleAtNextAnimationFrame)((0,x.getWindow)(this.parent),()=>this.updateDropFeedback(e,!1,i,t))},onDrag:e=>{r=e},onDragEnter:i=>{if(!this.isSupportedDropTransfer(i)){i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}!this.editorTransfer.hasData(tO.DraggedEditorIdentifier.prototype)&&i.dataTransfer&&(i.dataTransfer.dropEffect="copy"),this.updateDropFeedback(e,!0,i,t)},onDragOver:(i,o)=>{if(o>=g.DRAG_OVER_OPEN_TAB_THRESHOLD){let e=this.tabsModel.getEditorByIndex(t);e&&this.tabsModel.activeEditor!==e&&this.groupView.openEditor(e,{preserveFocus:!0})}this.updateDropFeedback(e,!0,i,t)},onDragEnd:async i=>{this.updateDropFeedback(e,!1,i,t);let o=this.editorTransfer.getData(tO.DraggedEditorIdentifier.prototype);if(this.editorTransfer.clearData(tO.DraggedEditorIdentifier.prototype),!d||(0,tO.isWindowDraggedOver)()||!o||0===o.length)return;let s=await this.maybeCreateAuxiliaryEditorPartAt(i,e);if(!s)return;let n=s.activeGroup,a=(0,V.prepareMoveCopyEditors)(this.groupView,o.map(e=>e.identifier.editor));this.isMoveOperation(r??i,n.id,o[0].identifier.editor)?this.groupView.moveEditors(a,n):this.groupView.copyEditors(a,n),n.focus()},onDrop:o=>{this.updateDropFeedback(e,!1,o,t);let r=t;"right"===this.getTabDragOverLocation(o,e)&&r++,this.onDrop(o,r,i)}})),s}isSupportedDropTransfer(e){if(this.groupTransfer.hasData(tO.DraggedEditorGroupIdentifier.prototype)){let e=this.groupTransfer.getData(tO.DraggedEditorGroupIdentifier.prototype);return(!Array.isArray(e)||!(e.length>0)||e[0].identifier!==this.groupView.id)&&!0}return!!this.editorTransfer.hasData(tO.DraggedEditorIdentifier.prototype)||!!e.dataTransfer&&!!(e.dataTransfer.types.length>0)}updateDropFeedback(e,t,i,o){let r,s="number"==typeof o;r=t?s?this.computeDropTarget(i,o,e):{leftElement:e.lastElementChild,rightElement:void 0}:void 0,this.updateDropTarget(r)}updateDropTarget(e){let t=this.dropTarget;if(t===e||t&&e&&t.leftElement===e.leftElement&&t.rightElement===e.rightElement)return;let i="drop-target-left",o="drop-target-right";t&&(t.leftElement?.classList.remove(i),t.rightElement?.classList.remove(o)),e&&(e.leftElement?.classList.add(i),e.rightElement?.classList.add(o)),this.dropTarget=e}getTabDragOverLocation(e,t){let i=t.getBoundingClientRect();return e.clientX-i.left<=i.width/2?"left":"right"}computeDropTarget(e,t,i){let o="left"===this.getTabDragOverLocation(e,i),r=t===this.tabsModel.count-1;return o&&0===t?{leftElement:void 0,rightElement:i}:!o&&r?{leftElement:i,rightElement:void 0}:{leftElement:o?i.previousElementSibling:i,rightElement:o?i:i.nextElementSibling}}async selectEditor(e){this.groupView.isActive(e)||await this.groupView.setSelection(e,this.groupView.selectedEditors)}async selectEditorsBetween(e,t){let i=this.groupView.getIndexOfEditor(e);if(-1===i)throw new eE.BugIndicatingError;let o=this.groupView.getIndexOfEditor(t);if(-1===o)throw new eE.BugIndicatingError;let r=this.groupView.selectedEditors,s=o;for(;s>=0&&s<=this.groupView.count-1;){s=o<i?s-1:s+1;let e=this.groupView.getEditorByIndex(s);if(!e||!this.groupView.isSelected(e))break;r=r.filter(t=>!t.matches(e))}let n=o<i?i:o;for(let e of this.groupView.getEditors(L.EditorsOrder.SEQUENTIAL).slice(o<i?o:i,n+1))this.groupView.isSelected(e)||r.push(e);let a=r.filter(t=>!t.matches(e));await this.groupView.setSelection(e,a)}async unselectEditor(e){let t=this.groupView.isActive(e);if(t&&1===this.groupView.selectedEditors.length)return;let i=(0,J.assertReturnsDefined)(this.groupView.activeEditor);if(t){let e=this.groupView.getEditors(L.EditorsOrder.MOST_RECENTLY_ACTIVE);for(let t=1;t<e.length;t++){let o=e[t];if(this.groupView.isSelected(o)){i=o;break}}}let o=this.groupView.selectedEditors.filter(t=>!t.matches(e)&&!t.matches(i));await this.groupView.setSelection(i,o)}async unselectAllEditors(){if(this.groupView.selectedEditors.length>1){let e=(0,J.assertReturnsDefined)(this.groupView.activeEditor);await this.groupView.setSelection(e,[])}}computeTabLabels(){let{labelFormat:e}=this.groupsView.partOptions,{verbosity:t,shortenDuplicates:i}=this.getLabelConfigFlags(e),o=[],r=-1;this.tabsModel.getEditors(L.EditorsOrder.SEQUENTIAL).forEach((e,i)=>{o.push({editor:e,name:e.getName(),description:e.getDescription(t),forceDescription:e.hasCapability(L.EditorInputCapabilities.ForceDescription),title:e.getTitle(L.Verbosity.LONG),ariaLabel:(0,el.computeEditorAriaLabel)(e,i,this.groupView,this.editorPartsView.count)}),e===this.tabsModel.activeEditor&&(r=i)}),i&&this.shortenTabLabels(o),this.tabLabels=o,this.activeTabLabel=o[r]}shortenTabLabels(e){let t=new Map;for(let i of e)"string"==typeof i.description?(0,oz.getOrSet)(t,i.name,[]).push(i):i.description="";for(let[,e]of t){if(1===e.length&&!e[0].forceDescription){e[0].description="";continue}let t=new Map;for(let i of e)(0,oz.getOrSet)(t,i.description,[]).push(i);let i=!1;for(let[,e]of t)if(!i&&e.length>1){let[t,...o]=e.map(({editor:e})=>e.getDescription(L.Verbosity.LONG));i=o.some(e=>e!==t)}if(i)for(let i of(t.clear(),e))i.description=i.editor.getDescription(L.Verbosity.LONG),(0,oz.getOrSet)(t,i.description,[]).push(i);let o=[];for(let[e]of t)o.push(e);if(1===o.length){for(let e of t.get(o[0])||[])e.forceDescription||(e.description="");continue}let r=(0,io.shorten)(o,this.path.sep);o.forEach((e,i)=>{for(let o of t.get(e)||[])o.description=r[i]})}}getLabelConfigFlags(e){switch(e){case"short":return{verbosity:L.Verbosity.SHORT,shortenDuplicates:!1};case"medium":return{verbosity:L.Verbosity.MEDIUM,shortenDuplicates:!1};case"long":return{verbosity:L.Verbosity.LONG,shortenDuplicates:!1};default:return{verbosity:L.Verbosity.MEDIUM,shortenDuplicates:!0}}}redraw(e){if(this.tabsAndActionsContainer){let e=this.getColor(O.EDITOR_GROUP_HEADER_TABS_BORDER);!e&&(0,r0.isHighContrast)(this.theme.type)&&(e=this.getColor(O.TAB_BORDER)||this.getColor(R.contrastBorder)),e?(this.tabsAndActionsContainer.classList.add("tabs-border-bottom"),this.tabsAndActionsContainer.style.setProperty("--tabs-border-bottom-color",e.toString())):(this.tabsAndActionsContainer.classList.remove("tabs-border-bottom"),this.tabsAndActionsContainer.style.removeProperty("--tabs-border-bottom-color"))}this.forEachTab((e,t,i,o,r,s)=>{this.redrawTab(e,t,i,o,r,s)}),this.updateEditorActionsToolbar(),this.layout(this.dimensions,e)}redrawTab(e,t,i,o,r,s){let n,a=this.tabsModel.isSticky(t),d=this.groupsView.partOptions;this.redrawTabLabel(e,t,i,o,r);let l=a&&d.tabActionUnpinVisibility,c=!l&&d.tabActionCloseVisibility,h=l||c;for(let e of(n=h?l?this.unpinEditorAction:this.closeEditorAction:a?this.unpinEditorAction:this.closeEditorAction,s.hasAction(n)||(s.isEmpty()||s.clear(),s.push(n,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(n)})),i.classList.toggle("pinned-action-off",a&&!l),i.classList.toggle("close-action-off",!l&&!c),["left","right"]))i.classList.toggle(`tab-actions-${e}`,h&&d.tabActionLocation===e);let u=a&&"shrink"===d.pinnedTabSizing?"shrink":d.tabSizing;for(let e of["fit","shrink","fixed"])i.classList.toggle(`sizing-${e}`,u===e);for(let e of(i.classList.toggle("has-icon",d.showIcons&&d.hasIcons),i.classList.toggle("sticky",a),["normal","compact","shrink"]))i.classList.toggle(`sticky-${e}`,a&&d.pinnedTabSizing===e);if(!d.wrapTabs&&a&&"normal"!==d.pinnedTabSizing){let e=0;switch(d.pinnedTabSizing){case"compact":e=g.TAB_WIDTH.compact;break;case"shrink":e=g.TAB_WIDTH.shrink}i.style.left=`${t*e}px`}else i.style.left="auto";this.redrawTabBorders(t,i),this.redrawTabSelectedActiveAndDirty(this.groupsView.activeGroup===this.groupView,e,i,s)}redrawTabLabel(e,t,i,o,r){let s,n,a,d=this.groupsView.partOptions,l=!1,c=!!d.decorations?.badges,h=!!d.decorations?.colors;"compact"===d.pinnedTabSizing&&this.tabsModel.isSticky(t)?(s=d.showIcons&&d.hasIcons?"":r.name?.charAt(0).toUpperCase(),a="",l=!0,c=!1):(s=r.name,n=d.showTabIndex?`${this.toEditorIndex(t)+1}: `:void 0,a=r.description||""),r.ariaLabel&&(i.setAttribute("aria-label",r.ariaLabel),i.setAttribute("aria-description","")),o.setResource({name:s,description:a,resource:L.EditorResourceAccessor.getOriginalUri(e,{supportSideBySide:L.SideBySideEditor.BOTH})},{title:this.getHoverTitle(e),extraClasses:(0,P.coalesce)(["tab-label",c?"tab-label-has-badge":void 0].concat(e.getLabelExtraClasses())),italic:!this.tabsModel.isPinned(e),forceLabel:l,fileDecorations:{colors:h,badges:c},icon:e.getIcon(),hideIcon:!1===d.showIcons,namePrefix:n});let u=L.EditorResourceAccessor.getOriginalUri(e,{supportSideBySide:L.SideBySideEditor.PRIMARY});u?i.setAttribute("data-resource-name",(0,eW.basenameOrAuthority)(u)):i.removeAttribute("data-resource-name")}redrawTabSelectedActiveAndDirty(e,t,i,o){let r=this.tabsModel.isActive(t),s=this.doRedrawTabDirty(e,r,t,i);this.doRedrawTabActive(e,!s,t,i,o)}doRedrawTabActive(e,t,i,o,r){let s=this.tabsModel.isActive(i),n=this.tabsModel.isSelected(i);if(o.classList.toggle("active",s),o.classList.toggle("selected",n),o.setAttribute("aria-selected",s?"true":"false"),o.tabIndex=s?0:-1,r.setFocusable(s),s){let t=this.getColor(e?O.TAB_ACTIVE_BORDER:O.TAB_UNFOCUSED_ACTIVE_BORDER);o.classList.toggle("tab-border-bottom",!!t),o.style.setProperty("--tab-border-bottom-color",t??"")}let a=null;t&&(s&&(a=this.getColor(e?O.TAB_ACTIVE_BORDER_TOP:O.TAB_UNFOCUSED_ACTIVE_BORDER_TOP)),null===a&&n&&(a=this.getColor(O.TAB_SELECTED_BORDER_TOP))),o.classList.toggle("tab-border-top",!!a),o.style.setProperty("--tab-border-top-color",a??"")}doRedrawTabDirty(e,t,i,o){let r=!1;if(i.isDirty()&&!i.isSaving())if(o.classList.add("dirty"),this.groupsView.partOptions.highlightModifiedTabs){let i;(i=e&&t?this.getColor(O.TAB_ACTIVE_MODIFIED_BORDER):e&&!t?this.getColor(O.TAB_INACTIVE_MODIFIED_BORDER):!e&&t?this.getColor(O.TAB_UNFOCUSED_ACTIVE_MODIFIED_BORDER):this.getColor(O.TAB_UNFOCUSED_INACTIVE_MODIFIED_BORDER))&&(r=!0,o.classList.add("dirty-border-top"),o.style.setProperty("--tab-dirty-border-top-color",i))}else o.classList.remove("dirty-border-top"),o.style.removeProperty("--tab-dirty-border-top-color");else o.classList.remove("dirty","dirty-border-top"),o.style.removeProperty("--tab-dirty-border-top-color");return r}redrawTabBorders(e,t){let i=this.tabsModel.isSticky(e)&&this.tabsModel.stickyCount===e+1,o=this.tabsModel.stickyCount!==this.tabsModel.count,r=(i&&o?this.getColor(O.TAB_LAST_PINNED_BORDER):void 0)||this.getColor(O.TAB_BORDER)||this.getColor(R.contrastBorder);t.style.borderRight=r?`1px solid ${r}`:"",t.style.outlineColor=this.getColor(R.activeContrastBorder)||""}prepareEditorActions(e){return this.groupsView.activeGroup===this.groupView?e:{primary:this.groupsView.partOptions.alwaysShowEditorActions?e.primary:e.primary.filter(e=>e.id===od),secondary:e.secondary}}getHeight(){return this.dimensions.used?this.dimensions.used.height:this.computeHeight()}computeHeight(){return this.visible?this.groupsView.partOptions.wrapTabs&&this.tabsAndActionsContainer?.classList.contains("wrapping")?this.tabsAndActionsContainer.offsetHeight:this.tabHeight:0}layout(e,t){if(Object.assign(this.dimensions,e),this.visible){if(!this.layoutScheduler.value){let e=(0,x.scheduleAtNextAnimationFrame)((0,x.getWindow)(this.parent),()=>{this.doLayout(this.dimensions,this.layoutScheduler.value?.options),this.layoutScheduler.clear()});this.layoutScheduler.value={options:t,dispose:()=>e.dispose()}}t?.forceRevealActiveTab&&(this.layoutScheduler.value.options={...this.layoutScheduler.value.options,forceRevealActiveTab:!0})}return this.dimensions.used||(this.dimensions.used=new x.Dimension(e.container.width,this.computeHeight())),this.dimensions.used}doLayout(e,t){e.container!==x.Dimension.None&&e.available!==x.Dimension.None&&this.doLayoutTabs(e,t);let i=this.dimensions.used,o=this.dimensions.used=new x.Dimension(e.container.width,this.computeHeight());i&&i.height!==o.height&&this.groupView.relayout()}doLayoutTabs(e,t){this.doLayoutTabsWrapping(e)||this.doLayoutTabsNonWrapping(t)}doLayoutTabsWrapping(e){let[t,i,o,r]=(0,J.assertReturnsAllDefined)(this.tabsAndActionsContainer,this.tabsContainer,this.editorActionsToolbarContainer,this.tabsScrollbar),s=t.classList.contains("wrapping"),n=s;function a(e){for(let r of(n=e,t.classList.toggle("wrapping",n),i.style.setProperty("--last-tab-margin-right",n?`${o.offsetWidth}px`:"0"),i.children))r.classList.remove("last-in-row")}if(this.groupsView.partOptions.wrapTabs){let t=i.offsetWidth,r=i.scrollWidth,s=()=>{let t=this.getLastTab();return!t||!(t.offsetWidth+o.offsetWidth-e.available.width>1)};(n||r>t&&s())&&a(!0),n&&(i.offsetHeight>e.available.height||r===t&&i.offsetHeight===this.tabHeight||!s())&&a(!1)}else s&&a(!1);if(n&&!s){let e=i.offsetWidth;r.setScrollDimensions({width:e,scrollWidth:e})}if(n){let e,t,o=new Map;for(let r of i.children){let i=r.offsetTop;i!==e&&(e=i,t&&o.set(t,!0)),t=r,o.set(r,!1)}for(let[e,i]of(t&&o.set(t,!0),o))e.classList.toggle("last-in-row",i)}return n}doLayoutTabsNonWrapping(e){let t,i,[o,r]=(0,J.assertReturnsAllDefined)(this.tabsContainer,this.tabsScrollbar),s=o.offsetWidth,n=o.scrollWidth,a=0;if(this.tabsModel.stickyCount>0){let e=0;switch(this.groupsView.partOptions.pinnedTabSizing){case"compact":e=g.TAB_WIDTH.compact;break;case"shrink":e=g.TAB_WIDTH.shrink}a=this.tabsModel.stickyCount*e}let[d,l]=(this.tabsModel.activeEditor?this.getTabAndIndex(this.tabsModel.activeEditor):void 0)??[void 0,void 0],c="normal"!==this.groupsView.partOptions.pinnedTabSizing&&"number"==typeof l&&this.tabsModel.isSticky(l),h=s-a;this.tabsModel.stickyCount>0&&h<g.TAB_WIDTH.fit?(o.classList.add("disable-sticky-tabs"),h=s,a=0,c=!1):o.classList.remove("disable-sticky-tabs"),!this.blockRevealActiveTab&&d&&(t=d.offsetLeft,i=d.offsetWidth);let{width:u,scrollWidth:p}=r.getScrollDimensions();r.setScrollDimensions({width:s,scrollWidth:n});let m=u!==s||p!==n;if(this.blockRevealActiveTab||"number"!=typeof t||"number"!=typeof i||c||!m&&!e?.forceRevealActiveTab){this.blockRevealActiveTab=!1;return}let v=r.getScrollPosition().scrollLeft,y=i<=h,C=t-a;y&&v+h<C+i?r.setScrollPosition({scrollLeft:v+(C+i-(v+h))}):(v>C||!y)&&r.setScrollPosition({scrollLeft:C})}updateTabsControlVisibility(){(0,J.assertReturnsDefined)(this.tabsAndActionsContainer).classList.toggle("empty",!this.visible),!this.visible&&this.dimensions&&(this.dimensions.used=void 0)}get visible(){return this.tabsModel.count>0}getTabAndIndex(e){let t=this.tabsModel.indexOf(e),i=this.getTabAtIndex(t);if(i)return[i,t]}getTabAtIndex(e){if(e>=0)return(0,J.assertReturnsDefined)(this.tabsContainer).children[e]}getLastTab(){return this.getTabAtIndex(this.tabsModel.count-1)}blockRevealActiveTabOnce(){this.blockRevealActiveTab=!0}originatesFromTabActionBar(e){let t;return t=(0,x.isMouseEvent)(e)?e.target||e.srcElement:e.initialTarget,!!(0,x.findParentWithClass)(t,"action-item","tab")}async onDrop(e,t,i){x.EventHelper.stop(e,!0),this.updateDropFeedback(i,!1,e,t),i.classList.remove("scroll");let o=this.tabsModel instanceof r4?t+this.groupView.stickyCount:t,r={sticky:this.tabsModel instanceof r6&&this.tabsModel.stickyCount===o,index:o};if(this.groupTransfer.hasData(tO.DraggedEditorGroupIdentifier.prototype)){let t=this.groupTransfer.getData(tO.DraggedEditorGroupIdentifier.prototype);if(Array.isArray(t)&&t.length>0){let i=this.editorPartsView.getGroup(t[0].identifier);if(i){let t={index:o};this.isMoveOperation(e,i.id)||(t.mode=_.MergeGroupMode.COPY_EDITORS),this.groupsView.mergeGroup(i,this.groupView,t)}this.groupView.focus(),this.groupTransfer.clearData(tO.DraggedEditorGroupIdentifier.prototype)}}else if(this.editorTransfer.hasData(tO.DraggedEditorIdentifier.prototype)){let t=this.editorTransfer.getData(tO.DraggedEditorIdentifier.prototype);if(Array.isArray(t)&&t.length>0){let i=this.editorPartsView.getGroup(t[0].identifier.groupId);if(i)for(let s of t){let t=s.identifier.editor;if(i.id!==s.identifier.groupId)continue;let n=i.getIndexOfEditor(t);i===this.groupView&&n<o&&o--,this.isMoveOperation(e,s.identifier.groupId,t)?i.moveEditor(t,this.groupView,{...r,index:o}):i.copyEditor(t,this.groupView,{...r,index:o}),o++}}this.groupView.focus(),this.editorTransfer.clearData(tO.DraggedEditorIdentifier.prototype)}else if(this.treeItemsTransfer.hasData(r2.DraggedTreeItemsIdentifier.prototype)){let e=this.treeItemsTransfer.getData(r2.DraggedTreeItemsIdentifier.prototype);if(Array.isArray(e)&&e.length>0){let t=[];for(let i of e){let e=await this.treeViewsDragAndDropService.removeDragOperationTransfer(i.identifier);if(e){let i=await (0,tO.extractTreeDropData)(e);t.push(...i.map(e=>({...e,options:{...e.options,pinned:!0,index:o}})))}}this.editorService.openEditors(t,this.groupView,{validateTrust:!0})}this.treeItemsTransfer.clearData(r2.DraggedTreeItemsIdentifier.prototype)}else this.instantiationService.createInstance(tO.ResourcesDropHandler,{allowWorkspaceOpen:!1}).handleDrop(e,(0,x.getWindow)(this.parent),()=>this.groupView,()=>this.groupView.focus(),r)}dispose(){super.dispose(),this.tabDisposables=(0,D.dispose)(this.tabDisposables)}};r9=g=(0,f.__decorate)([(0,f.__param)(5,eK.IContextMenuService),(0,f.__param)(6,E.IInstantiationService),(0,f.__param)(7,z.IContextKeyService),(0,f.__param)(8,eM.IKeybindingService),(0,f.__param)(9,id.INotificationService),(0,f.__param)(10,tA.IQuickInputService),(0,f.__param)(11,T.IThemeService),(0,f.__param)(12,eN.IEditorService),(0,f.__param)(13,iB.IPathService),(0,f.__param)(14,r1.ITreeViewsDnDService),(0,f.__param)(15,ip.IEditorResolverService),(0,f.__param)(16,eD.IHostService)],r9),(0,U.registerThemingParticipant)((e,t)=>{let i=e.getColor(O.TAB_BORDER);i&&t.addRule(`
20
+ .monaco-workbench .part.editor > .content .editor-group-container > .title > .tabs-and-actions-container.wrapping .tabs-container > .tab {
21
+ border-bottom: 1px solid ${i};
22
+ }
23
+ `);let o=e.getColor(R.activeContrastBorder);o&&t.addRule(`
24
+ .monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active,
25
+ .monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:hover {
26
+ outline: 1px solid;
27
+ outline-offset: -5px;
28
+ }
29
+
30
+ .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.selected:not(.active):not(:hover) {
31
+ outline: 1px dotted;
32
+ outline-offset: -5px;
33
+ }
34
+
35
+ .monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:focus {
36
+ outline-style: dashed;
37
+ }
38
+
39
+ .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active {
40
+ outline: 1px dotted;
41
+ outline-offset: -5px;
42
+ }
43
+
44
+ .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover {
45
+ outline: 1px dashed;
46
+ outline-offset: -5px;
47
+ }
48
+
49
+ .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active > .tab-actions .action-label,
50
+ .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active:hover > .tab-actions .action-label,
51
+ .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty > .tab-actions .action-label,
52
+ .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sticky > .tab-actions .action-label,
53
+ .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-actions .action-label {
54
+ opacity: 1 !important;
55
+ }
56
+ `);let r=e.getColor(R.contrastBorder);r&&t.addRule(`
57
+ .monaco-workbench .part.editor > .content .editor-group-container > .title .editor-actions {
58
+ outline: 1px solid ${r}
59
+ }
60
+ `);let s=e.getColor(O.TAB_HOVER_BACKGROUND);s&&t.addRule(`
61
+ .monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:not(.selected):hover {
62
+ background-color: ${s} !important;
63
+ }
64
+ `);let n=e.getColor(O.TAB_UNFOCUSED_HOVER_BACKGROUND);n&&t.addRule(`
65
+ .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:not(.selected):hover {
66
+ background-color: ${n} !important;
67
+ }
68
+ `);let a=e.getColor(O.TAB_HOVER_FOREGROUND);a&&t.addRule(`
69
+ .monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:not(.selected):hover {
70
+ color: ${a} !important;
71
+ }
72
+ `);let d=e.getColor(O.TAB_UNFOCUSED_HOVER_FOREGROUND);d&&t.addRule(`
73
+ .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:not(.selected):hover {
74
+ color: ${d} !important;
75
+ }
76
+ `);let l=e.getColor(O.TAB_HOVER_BORDER);l&&t.addRule(`
77
+ .monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover > .tab-border-bottom-container {
78
+ display: block;
79
+ position: absolute;
80
+ left: 0;
81
+ pointer-events: none;
82
+ width: 100%;
83
+ z-index: 10;
84
+ bottom: 0;
85
+ height: 1px;
86
+ background-color: ${l};
87
+ }
88
+ `);let c=e.getColor(O.TAB_UNFOCUSED_HOVER_BORDER);if(c&&t.addRule(`
89
+ .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-border-bottom-container {
90
+ display: block;
91
+ position: absolute;
92
+ left: 0;
93
+ pointer-events: none;
94
+ width: 100%;
95
+ z-index: 10;
96
+ bottom: 0;
97
+ height: 1px;
98
+ background-color: ${c};
99
+ }
100
+ `),!(0,r0.isHighContrast)(e.type)&&!ih.isSafari&&!o){let i,o,r=(0,O.WORKBENCH_BACKGROUND)(e),a=e.getColor(k.editorBackground),d=e.getColor(O.EDITOR_GROUP_HEADER_TABS_BACKGROUND),l=e.getColor(O.EDITOR_DRAG_AND_DROP_BACKGROUND);d&&a&&(i=d.flatten(a,a,r)),d&&a&&l&&a&&(o=d.flatten(a,l,a,r));let c=(e,t,i=!1)=>`
101
+ .monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${i?".active":""} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after,
102
+ .monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${i?".active":""} > .title .tabs-container > .tab.sizing-fixed:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after {
103
+ background: linear-gradient(to left, ${e}, transparent) !important;
104
+ }
105
+
106
+ .monaco-workbench .part.editor > .content.dragged-over .editor-group-container${i?".active":""} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after,
107
+ .monaco-workbench .part.editor > .content.dragged-over .editor-group-container${i?".active":""} > .title .tabs-container > .tab.sizing-fixed:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after {
108
+ background: linear-gradient(to left, ${t}, transparent) !important;
109
+ }
110
+ `;if(s&&i&&o){let e=s.flatten(i),r=s.flatten(o);t.addRule(c(e,r,!0))}if(n&&i&&o){let e=n.flatten(i),r=n.flatten(o);t.addRule(c(e,r))}if(l&&o){let e=l.flatten(o);t.addRule(`
111
+ .monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.active):not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
112
+ .monaco-workbench .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
113
+ .monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-fixed.dragged-over:not(.active):not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
114
+ .monaco-workbench .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-fixed.dragged-over:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
115
+ background: linear-gradient(to left, ${e}, transparent) !important;
116
+ }
117
+ `)}let h=(e,t,i,o)=>`
118
+ .monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${i?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-shrink${o?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
119
+ .monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${i?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-fixed${o?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
120
+ background: linear-gradient(to left, ${e}, transparent);
121
+ }
122
+
123
+ .monaco-workbench .part.editor > .content.dragged-over .editor-group-container${i?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-shrink${o?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
124
+ .monaco-workbench .part.editor > .content.dragged-over .editor-group-container${i?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-fixed${o?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
125
+ background: linear-gradient(to left, ${t}, transparent);
126
+ }
127
+ `,u=e.getColor(O.TAB_ACTIVE_BACKGROUND);if(u&&i&&o){let e=u.flatten(i),r=u.flatten(o);t.addRule(h(e,r,!0,!0))}let p=e.getColor(O.TAB_UNFOCUSED_ACTIVE_BACKGROUND);if(p&&i&&o){let e=p.flatten(i),r=p.flatten(o);t.addRule(h(e,r,!1,!0))}let g=e.getColor(O.TAB_INACTIVE_BACKGROUND);if(g&&i&&o){let e=g.flatten(i),r=g.flatten(o);t.addRule(h(e,r,!0,!1))}let m=e.getColor(O.TAB_UNFOCUSED_INACTIVE_BACKGROUND);if(m&&i&&o){let e=m.flatten(i),r=m.flatten(o);t.addRule(h(e,r,!1,!1))}}});var r8=e.i(144881);(0,K.registerCss)(void 0);class r7 extends oW{constructor(){super(...arguments),this.activeLabel=Object.create(null)}get breadcrumbsControl(){return this.breadcrumbsControlFactory?.control}create(e){super.create(e);let t=this.titleContainer=e;t.draggable=!0,this.registerContainerListeners(t),this._register(eR.Gesture.addTarget(t));let i=(0,x.$)(".label-container");return t.appendChild(i),this.editorLabel=this._register(this.instantiationService.createInstance(tP.ResourceLabel,i,{})).element,this._register((0,x.addDisposableListener)(this.editorLabel.element,x.EventType.CLICK,e=>this.onTitleLabelClick(e))),this.breadcrumbsControlFactory=this._register(this.instantiationService.createInstance(it,i,this.groupView,{showFileIcons:!1,showSymbolIcons:!0,showDecorationColors:!1,widgetStyles:{...eh.defaultBreadcrumbsWidgetStyles,breadcrumbsBackground:r8.Color.transparent.toString()},showPlaceholder:!1,dragEditor:!0})),this._register(this.breadcrumbsControlFactory.onDidEnablementChange(()=>this.handleBreadcrumbsEnablementChange())),t.classList.toggle("breadcrumbs",!!this.breadcrumbsControl),this._register((0,D.toDisposable)(()=>t.classList.remove("breadcrumbs"))),this.createEditorActionsToolBar(t,["title-actions"]),t}registerContainerListeners(e){let t,i=!1;for(let o of(this._register(new x.DragAndDropObserver(e,{onDragStart:t=>{i=this.onGroupDragStart(t,e)},onDrag:e=>{t=e},onDragEnd:o=>{this.onGroupDragEnd(o,t,e,i)}})),this._register((0,x.addDisposableListener)(e,x.EventType.DBLCLICK,e=>this.onTitleDoubleClick(e))),this._register((0,x.addDisposableListener)(e,x.EventType.AUXCLICK,e=>this.onTitleAuxClick(e))),this._register((0,x.addDisposableListener)(e,eR.EventType.Tap,e=>this.onTitleTap(e))),[x.EventType.CONTEXT_MENU,eR.EventType.Contextmenu]))this._register((0,x.addDisposableListener)(e,o,t=>{this.tabsModel.activeEditor&&this.onTabContextMenu(this.tabsModel.activeEditor,t,e)}))}onTitleLabelClick(e){x.EventHelper.stop(e,!1),setTimeout(()=>this.quickInputService.quickAccess.show())}onTitleDoubleClick(e){x.EventHelper.stop(e),this.groupView.pinEditor()}onTitleAuxClick(e){1===e.button&&this.tabsModel.activeEditor&&(x.EventHelper.stop(e,!0),(0,L.preventEditorClose)(this.tabsModel,this.tabsModel.activeEditor,L.EditorCloseMethod.MOUSE,this.groupsView.partOptions)||this.groupView.closeEditor(this.tabsModel.activeEditor))}onTitleTap(e){let t=e.initialTarget;(0,x.isHTMLElement)(t)&&this.editorLabel&&(0,x.isAncestor)(t,this.editorLabel.element)&&setTimeout(()=>this.quickInputService.quickAccess.show(),50)}openEditor(e){return this.doHandleOpenEditor()}openEditors(e){return this.doHandleOpenEditor()}doHandleOpenEditor(){let e=this.ifActiveEditorChanged(()=>this.redraw());return e||this.ifActiveEditorPropertiesChanged(()=>this.redraw()),e}beforeCloseEditor(e){}closeEditor(e){this.ifActiveEditorChanged(()=>this.redraw())}closeEditors(e){this.ifActiveEditorChanged(()=>this.redraw())}moveEditor(e,t,i){this.ifActiveEditorChanged(()=>this.redraw())}pinEditor(e){this.ifEditorIsActive(e,()=>this.redraw())}stickEditor(e){}unstickEditor(e){}setActive(e){this.redraw()}updateEditorSelections(){}updateEditorLabel(e){this.ifEditorIsActive(e,()=>this.redraw())}updateEditorDirty(e){this.ifEditorIsActive(e,()=>{let t=(0,J.assertReturnsDefined)(this.titleContainer);e.isDirty()&&!e.isSaving()?t.classList.add("dirty"):t.classList.remove("dirty")})}updateOptions(e,t){super.updateOptions(e,t),e.labelFormat===t.labelFormat&&(0,ix.equals)(e.decorations,t.decorations)||this.redraw()}updateStyles(){this.redraw()}handleBreadcrumbsEnablementChange(){(0,J.assertReturnsDefined)(this.titleContainer).classList.toggle("breadcrumbs",!!this.breadcrumbsControl),this.redraw()}ifActiveEditorChanged(e){return!((this.activeLabel.editor||!this.tabsModel.activeEditor)&&(!this.activeLabel.editor||this.tabsModel.activeEditor)&&this.activeLabel.editor&&this.tabsModel.isActive(this.activeLabel.editor))&&(e(),!0)}ifActiveEditorPropertiesChanged(e){this.activeLabel.editor&&this.tabsModel.activeEditor&&this.activeLabel.pinned!==this.tabsModel.isPinned(this.tabsModel.activeEditor)&&e()}ifEditorIsActive(e,t){this.tabsModel.isActive(e)&&t()}redraw(){let e=this.tabsModel.activeEditor??void 0,t=this.groupsView.partOptions,i=!!e&&this.tabsModel.isPinned(e),o=this.groupsView.activeGroup===this.groupView;this.activeLabel={editor:e,pinned:i},this.breadcrumbsControl&&(o?(this.breadcrumbsControl.update(),this.breadcrumbsControl.domNode.classList.toggle("preview",!i)):this.breadcrumbsControl.hide());let[r,s]=(0,J.assertReturnsAllDefined)(this.titleContainer,this.editorLabel);if(e){let n;this.updateEditorDirty(e);let{labelFormat:a}=this.groupsView.partOptions;n=this.breadcrumbsControl&&!this.breadcrumbsControl.isHidden()?"":("default"!==a||o)&&e.getDescription(this.getVerbosity(a))||"",s.setResource({resource:L.EditorResourceAccessor.getOriginalUri(e,{supportSideBySide:L.SideBySideEditor.BOTH}),name:e.getName(),description:n},{title:this.getHoverTitle(e),italic:!i,extraClasses:["single-tab","title-label"].concat(e.getLabelExtraClasses()),fileDecorations:{colors:!!t.decorations?.colors,badges:!!t.decorations?.badges},icon:e.getIcon(),hideIcon:!1===t.showIcons}),o?r.style.color=this.getColor(O.TAB_ACTIVE_FOREGROUND)||"":r.style.color=this.getColor(O.TAB_UNFOCUSED_ACTIVE_FOREGROUND)||"",this.updateEditorActionsToolbar()}else r.classList.remove("dirty"),s.clear(),this.clearEditorActionsToolbar()}getVerbosity(e){switch(e){case"short":return L.Verbosity.SHORT;case"long":return L.Verbosity.LONG;default:return L.Verbosity.MEDIUM}}prepareEditorActions(e){return this.groupsView.activeGroup===this.groupView?e:{primary:this.groupsView.partOptions.alwaysShowEditorActions?e.primary:e.primary.filter(e=>e.id===i9||e.id===od),secondary:e.secondary}}getHeight(){return this.tabHeight}layout(e){return this.breadcrumbsControl?.layout(void 0),new x.Dimension(e.container.width,this.getHeight())}}var se=D;let st=class extends se.Disposable{constructor(e,t,i,o,r,s){super(),this.parent=e,this.groupsView=i,this.groupView=o,this.model=r,this.instantiationService=s;const n=this._register(new r6(this.model)),a=this._register(new r4(this.model));this.stickyEditorTabsControl=this._register(this.instantiationService.createInstance(r9,this.parent,t,this.groupsView,this.groupView,n)),this.unstickyEditorTabsControl=this._register(this.instantiationService.createInstance(r9,this.parent,t,this.groupsView,this.groupView,a)),this.handleTabBarsStateChange()}handleTabBarsStateChange(){this.activeControl=this.model.activeEditor?this.getEditorTabsController(this.model.activeEditor):void 0,this.handleTabBarsLayoutChange()}handleTabBarsLayoutChange(){if(0===this.groupView.count)return;let e=this.parent.classList.contains("two-tab-bars"),t=this.groupView.count!==this.groupView.stickyCount&&this.groupView.stickyCount>0;this.parent.classList.toggle("two-tab-bars",t),e!==t&&this.groupView.relayout()}didActiveControlChange(){return this.activeControl!==(this.model.activeEditor?this.getEditorTabsController(this.model.activeEditor):void 0)}getEditorTabsController(e){return this.model.isSticky(e)?this.stickyEditorTabsControl:this.unstickyEditorTabsControl}openEditor(e,t){let i=this.didActiveControlChange(),o=this.getEditorTabsController(e).openEditor(e,t)||i;return o&&this.handleOpenedEditors(),o}openEditors(e){let t=e.filter(e=>this.model.isSticky(e)),i=e.filter(e=>!this.model.isSticky(e)),o=this.didActiveControlChange(),r=this.stickyEditorTabsControl.openEditors(t),s=this.unstickyEditorTabsControl.openEditors(i),n=r||s||o;return n&&this.handleOpenedEditors(),n}handleOpenedEditors(){this.handleTabBarsStateChange()}beforeCloseEditor(e){this.getEditorTabsController(e).beforeCloseEditor(e)}closeEditor(e){this.stickyEditorTabsControl.closeEditor(e),this.unstickyEditorTabsControl.closeEditor(e),this.handleClosedEditors()}closeEditors(e){let t=e.filter(e=>this.model.isSticky(e)),i=e.filter(e=>!this.model.isSticky(e));this.stickyEditorTabsControl.closeEditors(t),this.unstickyEditorTabsControl.closeEditors(i),this.handleClosedEditors()}handleClosedEditors(){this.handleTabBarsStateChange()}moveEditor(e,t,i,o){o?(this.model.isSticky(e)?(this.stickyEditorTabsControl.openEditor(e),this.unstickyEditorTabsControl.closeEditor(e)):(this.stickyEditorTabsControl.closeEditor(e),this.unstickyEditorTabsControl.openEditor(e)),this.handleTabBarsStateChange()):this.model.isSticky(e)?this.stickyEditorTabsControl.moveEditor(e,t,i,o):this.unstickyEditorTabsControl.moveEditor(e,t-this.model.stickyCount,i-this.model.stickyCount,o)}pinEditor(e){this.getEditorTabsController(e).pinEditor(e)}stickEditor(e){this.unstickyEditorTabsControl.closeEditor(e),this.stickyEditorTabsControl.openEditor(e),this.handleTabBarsStateChange()}unstickEditor(e){this.stickyEditorTabsControl.closeEditor(e),this.unstickyEditorTabsControl.openEditor(e),this.handleTabBarsStateChange()}setActive(e){this.stickyEditorTabsControl.setActive(e),this.unstickyEditorTabsControl.setActive(e)}updateEditorSelections(){this.stickyEditorTabsControl.updateEditorSelections(),this.unstickyEditorTabsControl.updateEditorSelections()}updateEditorLabel(e){this.getEditorTabsController(e).updateEditorLabel(e)}updateEditorDirty(e){this.getEditorTabsController(e).updateEditorDirty(e)}updateOptions(e,t){this.stickyEditorTabsControl.updateOptions(e,t),this.unstickyEditorTabsControl.updateOptions(e,t)}layout(e){let t=this.stickyEditorTabsControl.layout(e),i={container:e.container,available:new x.Dimension(e.available.width,e.available.height-t.height)},o=this.unstickyEditorTabsControl.layout(i);return new x.Dimension(e.container.width,t.height+o.height)}getHeight(){return this.stickyEditorTabsControl.getHeight()+this.unstickyEditorTabsControl.getHeight()}dispose(){this.parent.classList.toggle("two-tab-bars",!1),super.dispose()}};st=(0,f.__decorate)([(0,f.__param)(5,E.IInstantiationService)],st),(0,K.registerCss)(void 0);class si extends oW{constructor(){super(...arguments),this.activeEditor=null}prepareEditorActions(e){return{primary:[],secondary:[]}}openEditor(e){return this.handleOpenedEditors()}openEditors(e){return this.handleOpenedEditors()}handleOpenedEditors(){let e=this.activeEditorChanged();return this.activeEditor=this.tabsModel.activeEditor,e}activeEditorChanged(){return!((this.activeEditor||!this.tabsModel.activeEditor)&&(!this.activeEditor||this.tabsModel.activeEditor)&&this.activeEditor&&this.tabsModel.isActive(this.activeEditor))}beforeCloseEditor(e){}closeEditor(e){this.handleClosedEditors()}closeEditors(e){this.handleClosedEditors()}handleClosedEditors(){this.activeEditor=this.tabsModel.activeEditor}moveEditor(e,t,i){}pinEditor(e){}stickEditor(e){}unstickEditor(e){}setActive(e){}updateEditorSelections(){}updateEditorLabel(e){}updateEditorDirty(e){}getHeight(){return 0}layout(e){return new x.Dimension(e.container.width,this.getHeight())}}(0,K.registerCss)(void 0);let so=class extends tc.Themable{get breadcrumbsControl(){return this.breadcrumbsControlFactory?.control}constructor(e,t,i,o,r,s,n){super(n),this.parent=e,this.editorPartsView=t,this.groupsView=i,this.groupView=o,this.model=r,this.instantiationService=s,this.editorTabsControlDisposable=this._register(new D.DisposableStore),this.breadcrumbsControlDisposables=this._register(new D.DisposableStore),this.editorTabsControl=this.createEditorTabsControl(),this.breadcrumbsControlFactory=this.createBreadcrumbsControl()}createEditorTabsControl(){let e;switch(this.groupsView.partOptions.showTabs){case"none":e=si;break;case"single":e=r7;break;default:e=this.groupsView.partOptions.pinnedTabsOnSeparateRow?st:r9}let t=this.instantiationService.createInstance(e,this.parent,this.editorPartsView,this.groupsView,this.groupView,this.model);return this.editorTabsControlDisposable.add(t)}createBreadcrumbsControl(){if("single"===this.groupsView.partOptions.showTabs)return;let e=(0,x.$)(".breadcrumbs-below-tabs");this.parent.appendChild(e);let t=this.breadcrumbsControlDisposables.add(this.instantiationService.createInstance(it,e,this.groupView,{showFileIcons:!0,showSymbolIcons:!0,showDecorationColors:!1,showPlaceholder:!0,dragEditor:!1}));return this.breadcrumbsControlDisposables.add(t.onDidEnablementChange(()=>this.groupView.relayout())),this.breadcrumbsControlDisposables.add(t.onDidVisibilityChange(()=>this.groupView.relayout())),t}openEditor(e,t){let i=this.editorTabsControl.openEditor(e,t);this.handleOpenedEditors(i)}openEditors(e){let t=this.editorTabsControl.openEditors(e);this.handleOpenedEditors(t)}handleOpenedEditors(e){e?this.breadcrumbsControl?.update():this.breadcrumbsControl?.revealLast()}beforeCloseEditor(e){return this.editorTabsControl.beforeCloseEditor(e)}closeEditor(e){this.editorTabsControl.closeEditor(e),this.handleClosedEditors()}closeEditors(e){this.editorTabsControl.closeEditors(e),this.handleClosedEditors()}handleClosedEditors(){this.groupView.activeEditor||this.breadcrumbsControl?.update()}moveEditor(e,t,i,o){return this.editorTabsControl.moveEditor(e,t,i,o)}pinEditor(e){return this.editorTabsControl.pinEditor(e)}stickEditor(e){return this.editorTabsControl.stickEditor(e)}unstickEditor(e){return this.editorTabsControl.unstickEditor(e)}setActive(e){return this.editorTabsControl.setActive(e)}updateEditorSelections(){this.editorTabsControl.updateEditorSelections()}updateEditorLabel(e){return this.editorTabsControl.updateEditorLabel(e)}updateEditorDirty(e){return this.editorTabsControl.updateEditorDirty(e)}updateOptions(e,t){e.showTabs!==t.showTabs||"single"!==t.showTabs&&e.pinnedTabsOnSeparateRow!==t.pinnedTabsOnSeparateRow?(this.editorTabsControlDisposable.clear(),this.breadcrumbsControlDisposables.clear(),(0,x.clearNode)(this.parent),this.editorTabsControl=this.createEditorTabsControl(),this.breadcrumbsControlFactory=this.createBreadcrumbsControl()):this.editorTabsControl.updateOptions(e,t)}layout(e){let t,i=this.editorTabsControl.layout(e);return this.breadcrumbsControl?.isHidden()===!1&&(t=new x.Dimension(e.container.width,ie.HEIGHT),this.breadcrumbsControl.layout(t)),new x.Dimension(e.container.width,i.height+(t?t.height:0))}getHeight(){let e=this.editorTabsControl.getHeight();return{total:e+(this.breadcrumbsControl?.isHidden()===!1?ie.HEIGHT:0),offset:e}}};so=(0,f.__decorate)([(0,f.__param)(5,E.IInstantiationService),(0,f.__param)(6,T.IThemeService)],so),(0,K.registerCss)(void 0);let sr=m=class extends U.Themable{static createNew(e,t,i,o,r,s){return r.createInstance(m,null,e,t,i,o,s)}static createFromSerialized(e,t,i,o,r,s,n){return s.createInstance(m,e,t,i,o,r,n)}static createCopy(e,t,i,o,r,s,n){return s.createInstance(m,e,t,i,o,r,n)}constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p,g,v,y,C,b,w,f,S){super(d),this.editorPartsView=t,this.groupsView=i,this.groupsLabel=o,this._index=r,this.instantiationService=n,this.contextKeyService=a,this.telemetryService=l,this.keybindingService=c,this.menuService=h,this.contextMenuService=u,this.fileDialogService=p,this.editorService=g,this.filesConfigurationService=v,this.uriIdentityService=y,this.logService=C,this.editorResolverService=b,this.hostService=w,this.dialogService=f,this.fileService=S,this._onDidFocus=this._register(new I.Emitter),this.onDidFocus=this._onDidFocus.event,this._onWillDispose=this._register(new I.Emitter),this.onWillDispose=this._onWillDispose.event,this._onDidModelChange=this._register(new I.Emitter),this.onDidModelChange=this._onDidModelChange.event,this._onDidActiveEditorChange=this._register(new I.Emitter),this.onDidActiveEditorChange=this._onDidActiveEditorChange.event,this._onDidOpenEditorFail=this._register(new I.Emitter),this.onDidOpenEditorFail=this._onDidOpenEditorFail.event,this._onWillCloseEditor=this._register(new I.Emitter),this.onWillCloseEditor=this._onWillCloseEditor.event,this._onDidCloseEditor=this._register(new I.Emitter),this.onDidCloseEditor=this._onDidCloseEditor.event,this._onWillMoveEditor=this._register(new I.Emitter),this.onWillMoveEditor=this._onWillMoveEditor.event,this._onWillOpenEditor=this._register(new I.Emitter),this.onWillOpenEditor=this._onWillOpenEditor.event,this.disposedEditorsWorker=this._register(new ex.RunOnceWorker(e=>this.handleDisposedEditors(e),0)),this.mapEditorToPendingConfirmation=new Map,this.containerToolBarMenuDisposable=this._register(new D.MutableDisposable),this.whenRestoredPromise=new ex.DeferredPromise,this.whenRestored=this.whenRestoredPromise.p,this._disposed=!1,this.element=(0,x.$)("div"),this._onDidChange=this._register(new I.Relay),this.onDidChange=this._onDidChange.event,e instanceof m?this.model=this._register(e.model.clone()):(0,N.isSerializedEditorGroupModel)(e)?this.model=this._register(n.createInstance(N.EditorGroupModel,e)):this.model=this._register(n.createInstance(N.EditorGroupModel,void 0)),this.scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.element)),this.element.classList.add(...(0,P.coalesce)(["editor-group-container",this.model.isLocked?"locked":void 0])),this.registerContainerListeners(),this.createContainerToolbar(),this.createContainerContextMenu(),this._register(this.instantiationService.createInstance(tl,this.element)),this.progressBar=this._register(new B.ProgressBar(this.element,eh.defaultProgressBarStyles)),this.progressBar.hide(),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new W.ServiceCollection([z.IContextKeyService,this.scopedContextKeyService],[X.IEditorProgressService,this._register(new eA.EditorProgressIndicator(this.progressBar,this))]))),this.resourceContext=this._register(this.scopedInstantiationService.createInstance(G.ResourceContextKey)),this.handleGroupContextKeys(),this.titleContainer=(0,x.$)(".title"),this.element.appendChild(this.titleContainer),this.titleControl=this._register(this.scopedInstantiationService.createInstance(so,this.titleContainer,this.editorPartsView,this.groupsView,this,this.model)),this.editorContainer=(0,x.$)(".editor-container"),this.element.appendChild(this.editorContainer),this.editorPane=this._register(this.scopedInstantiationService.createInstance(eT,this.element,this.editorContainer,this)),this._onDidChange.input=this.editorPane.onDidChangeSizeConstraints,this.doTrackFocus(),this.updateTitleContainer(),this.updateContainer(),this.updateStyles(),(this.restoreEditors(e,s)??Promise.resolve()).finally(()=>{this.whenRestoredPromise.complete()}),this.registerListeners()}handleGroupContextKeys(){let e=this.editorPartsView.bind(G.ActiveEditorDirtyContext,this),t=this.editorPartsView.bind(G.ActiveEditorPinnedContext,this),i=this.editorPartsView.bind(G.ActiveEditorFirstInGroupContext,this),o=this.editorPartsView.bind(G.ActiveEditorLastInGroupContext,this),r=this.editorPartsView.bind(G.ActiveEditorStickyContext,this),s=this.editorPartsView.bind(G.EditorGroupEditorsCountContext,this),n=this.editorPartsView.bind(G.ActiveEditorGroupLockedContext,this),a=G.MultipleEditorsSelectedInGroupContext.bindTo(this.scopedContextKeyService),d=G.TwoEditorsSelectedInGroupContext.bindTo(this.scopedContextKeyService),l=G.SelectedEditorsInGroupFileOrUntitledResourceContextKey.bindTo(this.scopedContextKeyService),c=this.editorPartsView.bind(G.ActiveEditorContext,this),h=this.editorPartsView.bind(G.ActiveEditorReadonlyContext,this),u=this.editorPartsView.bind(G.ActiveEditorCanRevertContext,this),p=this.editorPartsView.bind(G.ActiveEditorCanToggleReadonlyContext,this),g=this.editorPartsView.bind(G.ActiveCompareEditorCanSwapContext,this),m=this.editorPartsView.bind(G.TextCompareEditorVisibleContext,this),v=this.editorPartsView.bind(G.TextCompareEditorActiveContext,this),y=this.editorPartsView.bind(G.ActiveEditorAvailableEditorIdsContext,this),C=this.editorPartsView.bind(G.ActiveEditorCanSplitInGroupContext,this),b=this.editorPartsView.bind(G.SideBySideEditorActiveContext,this),w=this._register(new D.MutableDisposable),f=()=>{w.clear(),this.scopedContextKeyService.bufferChangeEvents(()=>{let t=this.activeEditor,i=this.activeEditorPane;if(this.resourceContext.set(L.EditorResourceAccessor.getOriginalUri(t,{supportSideBySide:L.SideBySideEditor.PRIMARY})),(0,G.applyAvailableEditorIds)(y,t,this.editorResolverService),t?(C.set(t.hasCapability(L.EditorInputCapabilities.CanSplitInGroup)),b.set(t.typeId===F.SideBySideEditorInput.ID),e.set(t.isDirty()&&!t.isSaving()),w.value=t.onDidChangeDirty(()=>{e.set(t.isDirty()&&!t.isSaving())})):(C.set(!1),b.set(!1),e.set(!1)),i){c.set(i.getId()),u.set(!i.input.hasCapability(L.EditorInputCapabilities.Untitled)),h.set(!!i.input.isReadonly());let e=L.EditorResourceAccessor.getOriginalUri(i.input,{supportSideBySide:L.SideBySideEditor.PRIMARY}),t=L.EditorResourceAccessor.getOriginalUri(i.input,{supportSideBySide:L.SideBySideEditor.SECONDARY});g.set(i.input instanceof iO.DiffEditorInput&&!i.input.original.isReadonly()&&!!e&&(this.fileService.hasProvider(e)||e.scheme===ez.Schemas.untitled)&&!!t&&(this.fileService.hasProvider(t)||t.scheme===ez.Schemas.untitled)),p.set(!!e&&this.fileService.hasProvider(e)&&!this.fileService.hasCapability(e,ev.FileSystemProviderCapabilities.Readonly));let o=i?.getId()===L.TEXT_DIFF_EDITOR_ID;v.set(o),m.set(o)}else c.reset(),u.reset(),h.reset(),g.reset(),p.reset()})},S=e=>{switch(e.kind){case L.GroupModelChangeKind.GROUP_LOCKED:n.set(this.isLocked);break;case L.GroupModelChangeKind.EDITOR_ACTIVE:i.set(this.model.isFirst(this.model.activeEditor)),o.set(this.model.isLast(this.model.activeEditor)),t.set(!!this.model.activeEditor&&this.model.isPinned(this.model.activeEditor)),r.set(!!this.model.activeEditor&&this.model.isSticky(this.model.activeEditor));break;case L.GroupModelChangeKind.EDITOR_CLOSE:t.set(!!this.model.activeEditor&&this.model.isPinned(this.model.activeEditor)),r.set(!!this.model.activeEditor&&this.model.isSticky(this.model.activeEditor));break;case L.GroupModelChangeKind.EDITOR_OPEN:case L.GroupModelChangeKind.EDITOR_MOVE:i.set(this.model.isFirst(this.model.activeEditor)),o.set(this.model.isLast(this.model.activeEditor));break;case L.GroupModelChangeKind.EDITOR_PIN:e.editor&&e.editor===this.model.activeEditor&&t.set(this.model.isPinned(this.model.activeEditor));break;case L.GroupModelChangeKind.EDITOR_STICKY:e.editor&&e.editor===this.model.activeEditor&&r.set(this.model.isSticky(this.model.activeEditor));break;case L.GroupModelChangeKind.EDITORS_SELECTION:a.set(this.model.selectedEditors.length>1),d.set(2===this.model.selectedEditors.length),l.set(this.model.selectedEditors.every(e=>e.resource&&(this.fileService.hasProvider(e.resource)||e.resource.scheme===ez.Schemas.untitled)))}s.set(this.count)};this._register(this.onDidModelChange(e=>S(e))),this._register(this.onDidActiveEditorChange(()=>f())),f(),S({kind:L.GroupModelChangeKind.EDITOR_ACTIVE}),S({kind:L.GroupModelChangeKind.GROUP_LOCKED})}registerContainerListeners(){this._register((0,x.addDisposableListener)(this.element,x.EventType.DBLCLICK,e=>{this.isEmpty&&(x.EventHelper.stop(e),this.editorService.openEditor({resource:void 0,options:{pinned:!0,override:L.DEFAULT_EDITOR_ASSOCIATION.id}},this.id))})),this._register((0,x.addDisposableListener)(this.element,x.EventType.AUXCLICK,e=>{this.isEmpty&&1===e.button&&(x.EventHelper.stop(e,!0),this.groupsView.removeGroup(this))}))}createContainerToolbar(){let e=(0,x.$)(".editor-group-container-toolbar");this.element.appendChild(e);let t=this._register(new ek.ActionBar(e,{ariaLabel:(0,S.localize)(3407,"Empty editor group actions"),highlightToggledItems:!0})),i=this._register(this.menuService.createMenu(eL.MenuId.EmptyEditorGroup,this.scopedContextKeyService)),o=()=>{this.containerToolBarMenuDisposable.value=(0,D.toDisposable)(()=>t.clear());let e=(0,eV.getActionBarActions)(i.getActions({arg:{groupId:this.id},shouldForwardArgs:!0}),"navigation");for(let i of[...e.primary,...e.secondary]){let e=this.keybindingService.lookupKeybinding(i.id);t.push(i,{icon:!0,label:!1,keybinding:e?.getLabel()})}};o(),this._register(i.onDidChange(o))}createContainerContextMenu(){this._register((0,x.addDisposableListener)(this.element,x.EventType.CONTEXT_MENU,e=>this.onShowContainerContextMenu(e))),this._register((0,x.addDisposableListener)(this.element,eR.EventType.Contextmenu,()=>this.onShowContainerContextMenu()))}onShowContainerContextMenu(e){if(!this.isEmpty)return;let t=this.element;e&&(t=new eP.StandardMouseEvent((0,x.getWindow)(this.element),e)),this.contextMenuService.showContextMenu({menuId:eL.MenuId.EmptyEditorGroupContext,contextKeyService:this.contextKeyService,getAnchor:()=>t,onHide:()=>this.focus()})}doTrackFocus(){let e=this._register((0,x.trackFocus)(this.element));this._register(e.onDidFocus(()=>{this.isEmpty&&this._onDidFocus.fire()}));let t=e=>{let t;if((0,x.isMouseEvent)(e)){if(0!==e.button||eY.isMacintosh&&e.ctrlKey)return;t=e.target}else t=e.initialTarget;(0,x.findParentWithClass)(t,"monaco-action-bar",this.titleContainer)||(0,x.findParentWithClass)(t,"monaco-breadcrumb-item",this.titleContainer)||setTimeout(()=>{this.focus()})};this._register((0,x.addDisposableListener)(this.titleContainer,x.EventType.MOUSE_DOWN,e=>t(e))),this._register((0,x.addDisposableListener)(this.titleContainer,eR.EventType.Tap,e=>t(e))),this._register(this.editorPane.onDidFocus(()=>{this._onDidFocus.fire()}))}updateContainer(){this.isEmpty?(this.element.classList.add("empty"),this.element.tabIndex=0,this.element.setAttribute("aria-label",(0,S.localize)(3408,"{0} (empty)",this.ariaLabel))):(this.element.classList.remove("empty"),this.element.removeAttribute("tabIndex"),this.element.removeAttribute("aria-label")),this.updateStyles()}updateTitleContainer(){this.titleContainer.classList.toggle("tabs","multiple"===this.groupsView.partOptions.showTabs),this.titleContainer.classList.toggle("show-file-icons",this.groupsView.partOptions.showIcons)}restoreEditors(e,t){let i;if(0===this.count)return;i=e instanceof m?(0,V.fillActiveEditorViewState)(e):Object.create(null);let o=this.model.activeEditor;if(!o)return;i.pinned=this.model.isPinned(o),i.sticky=this.model.isSticky(o),i.preserveFocus=!0;let r=(0,x.getActiveElement)(),s=this.doShowEditor(o,{active:!0,isNew:!1},i,{preserveWindowOrder:!0,skipTitleUpdate:!0}).then(()=>{this.groupsView.activeGroup===this&&r&&(0,x.isActiveElement)(r)&&!t?.preserveFocus&&this.focus()});return this.titleControl.openEditors(this.editors),s}registerListeners(){this._register(this.model.onDidModelChange(e=>this.onDidGroupModelChange(e))),this._register(this.groupsView.onDidChangeEditorPartOptions(e=>this.onDidChangeEditorPartOptions(e))),this._register(this.groupsView.onDidVisibilityChange(e=>this.onDidVisibilityChange(e))),this._register(this.onDidFocus(()=>this.onDidGainFocus()))}onDidGroupModelChange(e){switch(this._onDidModelChange.fire(e),e.kind){case L.GroupModelChangeKind.GROUP_LOCKED:this.element.classList.toggle("locked",this.isLocked);break;case L.GroupModelChangeKind.EDITORS_SELECTION:this.onDidChangeEditorSelection()}if(e.editor)switch(e.kind){case L.GroupModelChangeKind.EDITOR_OPEN:(0,N.isGroupEditorOpenEvent)(e)&&this.onDidOpenEditor(e.editor,e.editorIndex);break;case L.GroupModelChangeKind.EDITOR_CLOSE:(0,N.isGroupEditorCloseEvent)(e)&&this.handleOnDidCloseEditor(e.editor,e.editorIndex,e.context,e.sticky);break;case L.GroupModelChangeKind.EDITOR_WILL_DISPOSE:this.onWillDisposeEditor(e.editor);break;case L.GroupModelChangeKind.EDITOR_DIRTY:this.onDidChangeEditorDirty(e.editor);break;case L.GroupModelChangeKind.EDITOR_TRANSIENT:this.onDidChangeEditorTransient(e.editor);break;case L.GroupModelChangeKind.EDITOR_LABEL:this.onDidChangeEditorLabel(e.editor)}}onDidOpenEditor(e,t){this.telemetryService.publicLog("editorOpened",this.toEditorTelemetryDescriptor(e)),this.updateContainer()}handleOnDidCloseEditor(e,t,i,o){this._onWillCloseEditor.fire({groupId:this.id,editor:e,context:i,index:t,sticky:o});let r=[e];for(let t of(e instanceof F.SideBySideEditorInput&&r.push(e.primary,e.secondary),r))this.canDispose(t)&&t.dispose();this.updateContainer(),this._onDidCloseEditor.fire({groupId:this.id,editor:e,context:i,index:t,sticky:o})}canDispose(e){for(let t of this.editorPartsView.groups)if(t instanceof m&&t.model.contains(e,{strictEquals:!0,supportSideBySide:L.SideBySideEditor.ANY}))return!1;return!0}toResourceTelemetryDescriptor(e){if(!e)return;let t=e?e.scheme===ez.Schemas.file?e.fsPath:e.path:void 0;if(!t)return;let i=(0,eW.extname)(e),o=i.indexOf("?");return i=-1!==o?i.substr(0,o):i,{mimeType:new ej.TelemetryTrustedValue((0,eF.getMimeTypes)(e).join(", ")),scheme:e.scheme,ext:i,path:(0,eG.hash)(t)}}toEditorTelemetryDescriptor(e){let t=e.getTelemetryDescriptor(),i=L.EditorResourceAccessor.getOriginalUri(e,{supportSideBySide:L.SideBySideEditor.BOTH});return e$.URI.isUri(i)?t.resource=this.toResourceTelemetryDescriptor(i):i&&(i.primary&&(t.resource=this.toResourceTelemetryDescriptor(i.primary)),i.secondary&&(t.resourceSecondary=this.toResourceTelemetryDescriptor(i.secondary))),t}onWillDisposeEditor(e){this.disposedEditorsWorker.work(e)}handleDisposedEditors(e){let t,i=[];for(let o of e){let e=this.model.findEditor(o);if(!e)continue;let r=e[0];r.isDisposed()&&(this.model.isActive(r)?t=r:i.push(r))}for(let e of i)this.doCloseEditor(e,!0);t&&this.doCloseEditor(t,!0)}onDidChangeEditorPartOptions(e){this.updateTitleContainer(),this.titleControl.updateOptions(e.oldPartOptions,e.newPartOptions),(e.oldPartOptions.showTabs!==e.newPartOptions.showTabs||e.oldPartOptions.tabHeight!==e.newPartOptions.tabHeight||"multiple"===e.oldPartOptions.showTabs&&e.oldPartOptions.pinnedTabsOnSeparateRow!==e.newPartOptions.pinnedTabsOnSeparateRow)&&(this.relayout(),this.model.activeEditor&&this.titleControl.openEditors(this.model.getEditors(L.EditorsOrder.SEQUENTIAL))),this.updateStyles(),e.oldPartOptions.enablePreview&&!e.newPartOptions.enablePreview&&this.model.previewEditor&&this.pinEditor(this.model.previewEditor)}onDidChangeEditorDirty(e){this.pinEditor(e),this.titleControl.updateEditorDirty(e)}onDidChangeEditorTransient(e){this.model.isTransient(e)||this.groupsView.partOptions.enablePreview||this.pinEditor(e)}onDidChangeEditorLabel(e){this.titleControl.updateEditorLabel(e)}onDidChangeEditorSelection(){this.titleControl.updateEditorSelections()}onDidVisibilityChange(e){this.editorPane.setVisible(e)}onDidGainFocus(){this.activeEditor&&this.model.setTransient(this.activeEditor,!1)}get index(){return this._index}get label(){return this.groupsLabel?(0,S.localize)(3409,"{0}: Group {1}",this.groupsLabel,this._index+1):(0,S.localize)(3410,"Group {0}",this._index+1)}get ariaLabel(){return this.groupsLabel?(0,S.localize)(3411,"{0}: Editor Group {1}",this.groupsLabel,this._index+1):(0,S.localize)(3412,"Editor Group {0}",this._index+1)}get disposed(){return this._disposed}get isEmpty(){return 0===this.count}get titleHeight(){return this.titleControl.getHeight()}notifyIndexChanged(e){this._index!==e&&(this._index=e,this.model.setIndex(e))}notifyLabelChanged(e){this.groupsLabel!==e&&(this.groupsLabel=e,this.model.setLabel(e))}setActive(e){this.active=e,!e&&this.activeEditor&&this.selectedEditors.length>1&&this.setSelection(this.activeEditor,[]),this.element.classList.toggle("active",e),this.element.classList.toggle("inactive",!e),this.titleControl.setActive(e),this.updateStyles(),this.model.setActive(void 0)}get id(){return this.model.id}get windowId(){return this.groupsView.windowId}get editors(){return this.model.getEditors(L.EditorsOrder.SEQUENTIAL)}get count(){return this.model.count}get stickyCount(){return this.model.stickyCount}get activeEditorPane(){return this.editorPane?this.editorPane.activeEditorPane??void 0:void 0}get activeEditor(){return this.model.activeEditor}get selectedEditors(){return this.model.selectedEditors}get previewEditor(){return this.model.previewEditor}isPinned(e){return this.model.isPinned(e)}isSticky(e){return this.model.isSticky(e)}isSelected(e){return this.model.isSelected(e)}isTransient(e){return this.model.isTransient(e)}isActive(e){return this.model.isActive(e)}async setSelection(e,t){this.isActive(e)?this.model.setSelection(e,t):await this.openEditor(e,{activation:ed.EditorActivation.ACTIVATE},{inactiveSelection:t})}contains(e,t){return this.model.contains(e,t)}getEditors(e,t){return this.model.getEditors(e,t)}findEditors(e,t){let i=this.uriIdentityService.asCanonicalUri(e);return this.getEditors(t?.order??L.EditorsOrder.SEQUENTIAL).filter(e=>{if(e.resource&&(0,eW.isEqual)(e.resource,i))return!0;if(t?.supportSideBySide===L.SideBySideEditor.PRIMARY||t?.supportSideBySide===L.SideBySideEditor.ANY){let t=L.EditorResourceAccessor.getCanonicalUri(e,{supportSideBySide:L.SideBySideEditor.PRIMARY});if(t&&(0,eW.isEqual)(t,i))return!0}if(t?.supportSideBySide===L.SideBySideEditor.SECONDARY||t?.supportSideBySide===L.SideBySideEditor.ANY){let t=L.EditorResourceAccessor.getCanonicalUri(e,{supportSideBySide:L.SideBySideEditor.SECONDARY});if(t&&(0,eW.isEqual)(t,i))return!0}return!1})}getEditorByIndex(e){return this.model.getEditorByIndex(e)}getIndexOfEditor(e){return this.model.indexOf(e)}isFirst(e){return this.model.isFirst(e)}isLast(e){return this.model.isLast(e)}focus(){this.activeEditorPane?this.activeEditorPane.focus():this.element.focus(),this._onDidFocus.fire()}pinEditor(e=this.activeEditor||void 0){if(e&&!this.model.isPinned(e)){let t=this.model.pin(e);t&&this.titleControl.pinEditor(t)}}stickEditor(e=this.activeEditor||void 0){this.doStickEditor(e,!0)}unstickEditor(e=this.activeEditor||void 0){this.doStickEditor(e,!1)}doStickEditor(e,t){if(e&&this.model.isSticky(e)!==t){let i=this.getIndexOfEditor(e),o=t?this.model.stick(e):this.model.unstick(e);if(!o)return;let r=this.getIndexOfEditor(o);r!==i&&this.titleControl.moveEditor(o,i,r,!0),t?this.titleControl.stickEditor(o):this.titleControl.unstickEditor(o)}}async openEditor(e,t,i){return this.doOpenEditor(e,t,{...i,supportSideBySide:L.SideBySideEditor.BOTH})}async doOpenEditor(e,t,i){if(!e||e.isDisposed())return;this._onWillOpenEditor.fire({editor:e,groupId:this.id});let o=t?.sticky||!this.groupsView.partOptions.enablePreview&&!t?.transient||e.isDirty()||(t?.pinned??"number"==typeof t?.index)||"number"==typeof t?.index&&this.model.isSticky(t.index)||e.hasCapability(L.EditorInputCapabilities.Scratchpad),r={index:t?t.index:void 0,pinned:o,sticky:t?.sticky||"number"==typeof t?.index&&this.model.isSticky(t.index),transient:!!t?.transient,inactiveSelection:i?.inactiveSelection,active:0===this.count||!t?.inactive,supportSideBySide:i?.supportSideBySide};r.active||r.pinned||!this.model.activeEditor||this.model.isPinned(this.model.activeEditor)||(r.active=!0);let s=!1,n=!1;if(t?.activation===ed.EditorActivation.ACTIVATE?s=!0:t?.activation===ed.EditorActivation.RESTORE?n=!0:t?.activation===ed.EditorActivation.PRESERVE?(s=!1,n=!1):r.active&&(n=!(s=!t?.preserveFocus)),"number"==typeof r.index){let t=this.model.indexOf(e);-1!==t&&t!==r.index&&this.doMoveEditorInsideGroup(e,r)}let{editor:a,isNew:d}=this.model.openEditor(e,r);d&&1===this.count&&this.editorPartsView.groups.length>1&&a.editorId&&this.groupsView.partOptions.autoLockGroups?.has(a.editorId)&&this.lock(!0);let l=this.doShowEditor(a,{active:!!r.active,isNew:d},t,i);return s?this.groupsView.activateGroup(this):n&&this.groupsView.restoreGroup(this),l}doShowEditor(e,t,i,o){let r;return r=t.active?(async()=>{let{pane:r,changed:s,cancelled:n,error:a}=await this.editorPane.openEditor(e,i,o,{newInGroup:t.isNew});if(!n)return s&&this._onDidActiveEditorChange.fire({editor:e}),a&&this._onDidOpenEditorFail.fire(e),r||this.activeEditor!==e||this.doCloseEditor(e,i?.preserveFocus,{fromError:!0}),r})():Promise.resolve(void 0),o?.skipTitleUpdate||this.titleControl.openEditor(e,o),r}async openEditors(e){let t=(0,P.coalesce)(e).filter(({editor:e})=>!e.isDisposed()),i=t.at(0);if(!i)return;let o={supportSideBySide:L.SideBySideEditor.BOTH};await this.doOpenEditor(i.editor,i.options,o);let r=t.slice(1),s=this.getIndexOfEditor(i.editor)+1;return await ex.Promises.settled(r.map(({editor:e,options:t},i)=>this.doOpenEditor(e,{...t,inactive:!0,pinned:!0,index:s+i},{...o,skipTitleUpdate:!0}))),this.titleControl.openEditors(r.map(({editor:e})=>e)),this.editorPane.activeEditorPane??void 0}moveEditors(e,t){let i={skipTitleUpdate:this!==t},o=!1,r=new Set;for(let{editor:s,options:n}of e)this.moveEditor(s,t,n,i)?r.add(s):o=!0;return i.skipTitleUpdate&&(t.titleControl.openEditors(Array.from(r)),this.titleControl.closeEditors(Array.from(r))),!o}moveEditor(e,t,i,o){return this===t?(this.doMoveEditorInsideGroup(e,i),!0):this.doMoveOrCopyEditorAcrossGroups(e,t,i,{...o,keepCopy:!1})}doMoveEditorInsideGroup(e,t){let i=t?t.index:void 0;if("number"!=typeof i)return;let o=this.model.indexOf(e),r=this.model.getEditorByIndex(o);if(r){if(o!==i){let e=this.model.stickyCount;this.model.moveEditor(r,i),this.model.pin(r),this.titleControl.moveEditor(r,o,i,e!==this.model.stickyCount),this.titleControl.pinEditor(r)}t?.sticky&&this.stickEditor(r)}}doMoveOrCopyEditorAcrossGroups(e,t,i,o){let r=o?.keepCopy;if(!r||e.hasCapability(L.EditorInputCapabilities.Singleton)){let i=e.canMove(this.id,t.id);if("string"==typeof i)return this.dialogService.error(i,(0,S.localize)(3413,"Try saving or reverting the editor first and then try again.")),!1}let s=(0,V.fillActiveEditorViewState)(this,e,{...i,pinned:!0,sticky:i?.sticky??(!r&&this.model.isSticky(e))});return r||this._onWillMoveEditor.fire({groupId:this.id,editor:e,target:t.id}),t.doOpenEditor(r?e.copy():e,s,o),r||this.doCloseEditor(e,!0,{...o,context:L.EditorCloseContext.MOVE}),!0}copyEditors(e,t){let i={skipTitleUpdate:this!==t};for(let{editor:o,options:r}of e)this.copyEditor(o,t,r,i);if(i.skipTitleUpdate){let i=e.map(({editor:e})=>e);t.titleControl.openEditors(i)}}copyEditor(e,t,i,o){this===t?this.doMoveEditorInsideGroup(e,i):this.doMoveOrCopyEditorAcrossGroups(e,t,i,{...o,keepCopy:!0})}async closeEditor(e=this.activeEditor||void 0,t){return this.doCloseEditorWithConfirmationHandling(e,t)}async doCloseEditorWithConfirmationHandling(e=this.activeEditor||void 0,t,i){return!(!e||await this.handleCloseConfirmation([e]))&&(this.doCloseEditor(e,t?.preserveFocus,i),!0)}doCloseEditor(e,t=this.groupsView.activeGroup!==this,i){i?.skipTitleUpdate||this.titleControl.beforeCloseEditor(e),this.model.isActive(e)?this.doCloseActiveEditor(t,i):this.doCloseInactiveEditor(e,i),i?.skipTitleUpdate||this.titleControl.closeEditor(e)}doCloseActiveEditor(e=this.groupsView.activeGroup!==this,t){let i=this.activeEditor,o=!e&&this.shouldRestoreFocus(this.element),r=this.groupsView.partOptions.closeEmptyGroups;if(r&&this.active&&1===this.count){let e=this.groupsView.getGroups(_.GroupsOrder.MOST_RECENTLY_ACTIVE)[1];e&&(o?e.focus():this.groupsView.activateGroup(e,!0))}i&&this.model.closeEditor(i,t?.context);let s=this.model.activeEditor;if(s){let i;e&&this.groupsView.activeGroup!==this&&(i=ed.EditorActivation.PRESERVE);let o={preserveFocus:e,activation:i,ignoreError:t?.fromError};this.doOpenEditor(s,o,{preserveWindowOrder:!0})}else i&&this.editorPane.closeEditor(i),o&&!r&&this.focus(),this._onDidActiveEditorChange.fire({editor:void 0}),r&&this.groupsView.removeGroup(this,e)}shouldRestoreFocus(e){let t=(0,x.getActiveElement)();return t===(0,x.getRootContainer)(e)||(0,x.isAncestor)(t,e)}doCloseInactiveEditor(e,t){this.model.closeEditor(e,t?.context)}async handleCloseConfirmation(e){let t;if(!e.length)return!1;let i=e.shift(),o=this.mapEditorToPendingConfirmation.get(i);o||(o=this.doHandleCloseConfirmation(i),this.mapEditorToPendingConfirmation.set(i,o));try{t=await o}finally{this.mapEditorToPendingConfirmation.delete(i)}return t||this.handleCloseConfirmation(e)}async doHandleCloseConfirmation(e,t){if(!this.shouldConfirmClose(e)||e instanceof F.SideBySideEditorInput&&this.model.contains(e.primary)||this.editorPartsView.groups.some(t=>t!==this&&!!(t.contains(e,{supportSideBySide:L.SideBySideEditor.BOTH})||e instanceof F.SideBySideEditorInput&&t.contains(e.primary))))return!1;let i=eB.ConfirmResult.CANCEL,o=L.SaveReason.EXPLICIT,r=!1;if(!e.hasCapability(L.EditorInputCapabilities.Untitled)&&!t?.skipAutoSave&&!e.closeHandler&&(this.filesConfigurationService.getAutoSaveMode(e).mode===eU.AutoSaveMode.ON_FOCUS_CHANGE?(r=!0,i=eB.ConfirmResult.SAVE,o=L.SaveReason.FOCUS_CHANGE):eY.isNative&&(eY.isWindows||eY.isLinux)&&this.filesConfigurationService.getAutoSaveMode(e).mode===eU.AutoSaveMode.ON_WINDOW_CHANGE&&(r=!0,i=eB.ConfirmResult.SAVE,o=L.SaveReason.WINDOW_CHANGE)),!r){this.activeEditor?.matches(e)||await this.doOpenEditor(e),await this.hostService.focus((0,x.getWindow)(this.element));let t=!1;if("function"==typeof e.closeHandler?.confirm)try{i=await e.closeHandler.confirm([{editor:e,groupId:this.id}])}catch(e){this.logService.error(e),t=!0}if("function"!=typeof e.closeHandler?.confirm||t){let t;t=e instanceof F.SideBySideEditorInput?e.primary.getName():e.getName(),i=await this.fileDialogService.showSaveConfirm([t])}}if(!e.closeHandler&&!this.shouldConfirmClose(e))return i===eB.ConfirmResult.CANCEL;switch(i){case eB.ConfirmResult.SAVE:if(!await e.save(this.id,{reason:o})&&r)return this.doHandleCloseConfirmation(e,{skipAutoSave:!0});return e.isDirty();case eB.ConfirmResult.DONT_SAVE:try{return await e.revert(this.id),e.isDirty()}catch(t){return this.logService.error(t),await e.revert(this.id,{soft:!0}),e.isDirty()}case eB.ConfirmResult.CANCEL:return!0}}shouldConfirmClose(e){if(e.closeHandler)try{return e.closeHandler.showConfirm()}catch(e){this.logService.error(e)}return e.isDirty()&&!e.isSaving()}async closeEditors(e,t){if(this.isEmpty)return!0;let i=this.doGetEditorsToClose(e);return!await this.handleCloseConfirmation(i.slice(0))&&(this.doCloseEditors(i,t),!0)}doGetEditorsToClose(e){if(Array.isArray(e))return e;let t="number"==typeof e.direction,i=this.model.getEditors(t?L.EditorsOrder.SEQUENTIAL:L.EditorsOrder.MOST_RECENTLY_ACTIVE,e);return e.savedOnly?i=i.filter(e=>!e.isDirty()||e.isSaving()):t&&e.except?i=e.direction===L.CloseDirection.LEFT?i.slice(0,this.model.indexOf(e.except,i)):i.slice(this.model.indexOf(e.except,i)+1):e.except&&(i=i.filter(t=>e.except&&!t.matches(e.except))),i}doCloseEditors(e,t){let i=!1;for(let t of e)this.isActive(t)?i=!0:this.doCloseInactiveEditor(t);i&&this.doCloseActiveEditor(t?.preserveFocus),e.length&&this.titleControl.closeEditors(e)}closeAllEditors(e){return this.isEmpty?(this.groupsView.partOptions.closeEmptyGroups&&this.groupsView.removeGroup(this),!0):e?.excludeConfirming?(this.doCloseAllEditors(e),!0):this.handleCloseConfirmation(this.model.getEditors(L.EditorsOrder.MOST_RECENTLY_ACTIVE,e)).then(t=>!t&&(this.doCloseAllEditors(e),!0))}doCloseAllEditors(e){let t=this.model.getEditors(L.EditorsOrder.SEQUENTIAL,e);e?.excludeConfirming&&(t=t.filter(e=>!this.shouldConfirmClose(e)));let i=[];for(let e of t)this.isActive(e)||this.doCloseInactiveEditor(e),i.push(e);this.activeEditor&&i.includes(this.activeEditor)&&this.doCloseActiveEditor(),i.length&&this.titleControl.closeEditors(i)}async replaceEditors(e){let t,i=[];for(let{editor:o,replacement:r,forceReplaceDirty:s,options:n}of e){let e=this.getIndexOfEditor(o);if(e>=0){let a=this.isActive(o);n?n.index=e:n={index:e},n.inactive=!a,n.pinned=n.pinned??!0;let d={editor:o,replacement:r,forceReplaceDirty:s,options:n};a?t=d:i.push(d)}}for(let{editor:e,replacement:t,forceReplaceDirty:o,options:r}of i)if(await this.doOpenEditor(t,r),!e.matches(t)){let t=!1;if(o?(this.doCloseEditor(e,!0,{context:L.EditorCloseContext.REPLACE}),t=!0):t=await this.doCloseEditorWithConfirmationHandling(e,{preserveFocus:!0},{context:L.EditorCloseContext.REPLACE}),!t)return}if(t){let e=this.doOpenEditor(t.replacement,t.options);t.editor.matches(t.replacement)||(t.forceReplaceDirty?this.doCloseEditor(t.editor,!0,{context:L.EditorCloseContext.REPLACE}):await this.doCloseEditorWithConfirmationHandling(t.editor,{preserveFocus:!0},{context:L.EditorCloseContext.REPLACE})),await e}}get isLocked(){return this.model.isLocked}lock(e){this.model.lock(e)}createEditorActions(e,t=eL.MenuId.EditorTitle){let i,o={primary:[],secondary:[]},r=this.activeEditorPane;if(r instanceof ee.EditorPane){let s=r.scopedContextKeyService??this.scopedContextKeyService,n=e.add(this.menuService.createMenu(t,s,{emitEventsForSubmenuChanges:!0,eventDebounceDelay:0}));i=n.onDidChange,o=(0,eV.getActionBarActions)(n.getActions({arg:this.resourceContext.get(),shouldForwardArgs:!0,renderShortTitle:!0}),"navigation",(e,t)=>"navigation"===t&&e.actions.length<=1)}else{let t=e.add(new I.Emitter);i=t.event,e.add(this.onDidActiveEditorChange(()=>t.fire()))}return{actions:o,onDidChange:i}}updateStyles(){let e=this.isEmpty;e?this.element.style.backgroundColor=this.getColor(O.EDITOR_GROUP_EMPTY_BACKGROUND)||"":this.element.style.backgroundColor="";let t=this.getColor(O.EDITOR_GROUP_HEADER_BORDER)||this.getColor(R.contrastBorder);!e&&t?(this.titleContainer.classList.add("title-border-bottom"),this.titleContainer.style.setProperty("--title-border-bottom-color",t)):(this.titleContainer.classList.remove("title-border-bottom"),this.titleContainer.style.removeProperty("--title-border-bottom-color"));let{showTabs:i}=this.groupsView.partOptions;this.titleContainer.style.backgroundColor=this.getColor("multiple"===i?O.EDITOR_GROUP_HEADER_TABS_BACKGROUND:O.EDITOR_GROUP_HEADER_NO_TABS_BACKGROUND)||"",this.editorContainer.style.backgroundColor=this.getColor(k.editorBackground)||""}get minimumWidth(){return this.editorPane.minimumWidth}get minimumHeight(){return this.editorPane.minimumHeight}get maximumWidth(){return this.editorPane.maximumWidth}get maximumHeight(){return this.editorPane.maximumHeight}get proportionalLayout(){return!this.lastLayout||this.lastLayout.width!==this.minimumWidth&&this.lastLayout.height!==this.minimumHeight}layout(e,t,i,o){this.lastLayout={width:e,height:t,top:i,left:o},this.element.classList.toggle("max-height-478px",t<=478);let r=this.titleControl.layout({container:new x.Dimension(e,t),available:new x.Dimension(e,t-this.editorPane.minimumHeight)});this.progressBar.getContainer().style.top=`${Math.max(this.titleHeight.offset-2,0)}px`;let s=Math.max(0,t-r.height);this.editorContainer.style.height=`${s}px`,this.editorPane.layout({width:e,height:s,top:i+r.height,left:o})}relayout(){if(this.lastLayout){let{width:e,height:t,top:i,left:o}=this.lastLayout;this.layout(e,t,i,o)}}setBoundarySashes(e){this.editorPane.setBoundarySashes(e)}toJSON(){return this.model.serialize()}dispose(){this._disposed=!0,this._onWillDispose.fire(),super.dispose()}};sr=m=(0,f.__decorate)([(0,f.__param)(6,E.IInstantiationService),(0,f.__param)(7,z.IContextKeyService),(0,f.__param)(8,T.IThemeService),(0,f.__param)(9,et.ITelemetryService),(0,f.__param)(10,eM.IKeybindingService),(0,f.__param)(11,eO.IMenuService),(0,f.__param)(12,eK.IContextMenuService),(0,f.__param)(13,eb.IFileDialogService),(0,f.__param)(14,eN.IEditorService),(0,f.__param)(15,eH.IFilesConfigurationService),(0,f.__param)(16,eq.IUriIdentityService),(0,f.__param)(17,eI.ILogService),(0,f.__param)(18,ip.IEditorResolverService),(0,f.__param)(19,eD.IHostService),(0,f.__param)(20,eb.IDialogService),(0,f.__param)(21,ey.IFileService)],sr);var ss=e.i(782740),sn=U;function sa(e){return e.getValue("editor.dropIntoEditor.enabled")}(0,K.registerCss)(void 0);let sd=class extends sn.Themable{static{v=this}static{this.OVERLAY_ID="monaco-workbench-editor-drop-overlay"}get disposed(){return!!this._disposed}constructor(e,t,i,o,r,s,n,a){super(t),this.groupView=e,this.configurationService=i,this.instantiationService=o,this.editorService=r,this.editorGroupService=s,this.treeViewsDragAndDropService=n,this.contextService=a,this.editorTransfer=t_.LocalSelectionTransfer.getInstance(),this.groupTransfer=t_.LocalSelectionTransfer.getInstance(),this.treeItemsTransfer=t_.LocalSelectionTransfer.getInstance(),this.cleanupOverlayScheduler=this._register(new ex.RunOnceScheduler(()=>this.dispose(),300)),this.enableDropIntoEditor=sa(this.configurationService)&&this.isDropIntoActiveEditorEnabled(),this.create()}create(){let e=this.getOverlayOffsetHeight(),t=this.container=(0,x.$)("div",{id:v.OVERLAY_ID});t.style.top=`${e}px`,this.groupView.element.appendChild(t),this.groupView.element.classList.add("dragged-over"),this._register((0,D.toDisposable)(()=>{t.remove(),this.groupView.element.classList.remove("dragged-over")})),this.overlay=(0,x.$)(".editor-group-overlay-indicator"),t.appendChild(this.overlay),this.enableDropIntoEditor&&(this.dropIntoPromptElement=(0,ss.renderFormattedText)((0,S.localize)(3406,"Hold __{0}__ to drop into editor",eY.isMacintosh?"⇧":"Shift"),{}),this.dropIntoPromptElement.classList.add("editor-group-overlay-drop-into-prompt"),this.overlay.appendChild(this.dropIntoPromptElement)),this.registerListeners(t),this.updateStyles()}updateStyles(){let e=(0,J.assertReturnsDefined)(this.overlay);e.style.backgroundColor=this.getColor(O.EDITOR_DRAG_AND_DROP_BACKGROUND)||"";let t=this.getColor(R.activeContrastBorder);if(e.style.outlineColor=t||"",e.style.outlineOffset=t?"-2px":"",e.style.outlineStyle=t?"dashed":"",e.style.outlineWidth=t?"2px":"",this.dropIntoPromptElement){this.dropIntoPromptElement.style.backgroundColor=this.getColor(O.EDITOR_DROP_INTO_PROMPT_BACKGROUND)??"",this.dropIntoPromptElement.style.color=this.getColor(O.EDITOR_DROP_INTO_PROMPT_FOREGROUND)??"";let e=this.getColor(O.EDITOR_DROP_INTO_PROMPT_BORDER);e?(this.dropIntoPromptElement.style.borderWidth="1px",this.dropIntoPromptElement.style.borderStyle="solid",this.dropIntoPromptElement.style.borderColor=e):this.dropIntoPromptElement.style.borderWidth="0"}}registerListeners(e){this._register(new x.DragAndDropObserver(e,{onDragOver:e=>{if(this.enableDropIntoEditor&&e.shiftKey)return void this.dispose();let t=this.groupTransfer.hasData(tO.DraggedEditorGroupIdentifier.prototype),i=this.editorTransfer.hasData(tO.DraggedEditorIdentifier.prototype);i||t||!e.dataTransfer||(e.dataTransfer.dropEffect="copy");let o=!0;if(t)o=this.isCopyOperation(e);else if(i){let t=this.editorTransfer.getData(tO.DraggedEditorIdentifier.prototype);Array.isArray(t)&&t.length>0&&(o=this.isCopyOperation(e,t[0].identifier))}if(!o){let e=this.findSourceGroupView();if(e===this.groupView&&(t||i&&e.count<2))return void this.hideOverlay()}let r=!!this.editorGroupService.partOptions.splitOnDragAndDrop;this.isToggleSplitOperation(e)&&(r=!r),this.positionOverlay(e.offsetX,e.offsetY,t,r),this.cleanupOverlayScheduler.isScheduled()&&this.cleanupOverlayScheduler.cancel()},onDragLeave:e=>this.dispose(),onDragEnd:e=>this.dispose(),onDrop:e=>{x.EventHelper.stop(e,!0),this.dispose(),this.currentDropOperation&&this.handleDrop(e,this.currentDropOperation.splitDirection)}})),this._register((0,x.addDisposableListener)(e,x.EventType.MOUSE_OVER,()=>{this.cleanupOverlayScheduler.isScheduled()||this.cleanupOverlayScheduler.schedule()}))}isDropIntoActiveEditorEnabled(){return!!this.groupView.activeEditor?.hasCapability(L.EditorInputCapabilities.CanDropIntoEditor)}findSourceGroupView(){if(this.groupTransfer.hasData(tO.DraggedEditorGroupIdentifier.prototype)){let e=this.groupTransfer.getData(tO.DraggedEditorGroupIdentifier.prototype);if(Array.isArray(e)&&e.length>0)return this.editorGroupService.getGroup(e[0].identifier)}else if(this.editorTransfer.hasData(tO.DraggedEditorIdentifier.prototype)){let e=this.editorTransfer.getData(tO.DraggedEditorIdentifier.prototype);if(Array.isArray(e)&&e.length>0)return this.editorGroupService.getGroup(e[0].identifier.groupId)}}async handleDrop(e,t){let i=()=>"number"==typeof t?this.editorGroupService.addGroup(this.groupView,t):this.groupView;if(this.groupTransfer.hasData(tO.DraggedEditorGroupIdentifier.prototype)){let i=this.groupTransfer.getData(tO.DraggedEditorGroupIdentifier.prototype);if(Array.isArray(i)&&i.length>0){let o=this.editorGroupService.getGroup(i[0].identifier);if(o){let i;if("number"!=typeof t&&o===this.groupView)return;if("number"==typeof t)i=this.isCopyOperation(e)?this.editorGroupService.copyGroup(o,this.groupView,t):this.editorGroupService.moveGroup(o,this.groupView,t);else{let t;this.isCopyOperation(e)&&(t={mode:_.MergeGroupMode.COPY_EDITORS}),this.editorGroupService.mergeGroup(o,this.groupView,t)}i&&this.editorGroupService.activateGroup(i)}this.groupTransfer.clearData(tO.DraggedEditorGroupIdentifier.prototype)}}else if(this.editorTransfer.hasData(tO.DraggedEditorIdentifier.prototype)){let o=this.editorTransfer.getData(tO.DraggedEditorIdentifier.prototype);if(Array.isArray(o)&&o.length>0){let r=o[0].identifier,s=this.editorGroupService.getGroup(r.groupId);if(s){let n,a=this.isCopyOperation(e,r);if(this.editorGroupService.partOptions.closeEmptyGroups&&1===s.count&&"number"==typeof t&&!a)n=this.editorGroupService.moveGroup(s,this.groupView,t);else{if(s===(n=i()))return;let e=(0,V.prepareMoveCopyEditors)(this.groupView,o.map(e=>e.identifier.editor));a?s.copyEditors(e,n):s.moveEditors(e,n)}n.focus()}this.editorTransfer.clearData(tO.DraggedEditorIdentifier.prototype)}}else if(this.treeItemsTransfer.hasData(r2.DraggedTreeItemsIdentifier.prototype)){let e=this.treeItemsTransfer.getData(r2.DraggedTreeItemsIdentifier.prototype);if(Array.isArray(e)&&e.length>0){let t=[];for(let i of e){let e=await this.treeViewsDragAndDropService.removeDragOperationTransfer(i.identifier);if(e){let i=await (0,tO.extractTreeDropData)(e);t.push(...i.map(e=>({...e,options:{...e.options,pinned:!0}})))}}t.length&&this.editorService.openEditors(t,i(),{validateTrust:!0})}this.treeItemsTransfer.clearData(r2.DraggedTreeItemsIdentifier.prototype)}else this.instantiationService.createInstance(tO.ResourcesDropHandler,{allowWorkspaceOpen:!eY.isWeb||(0,en.isTemporaryWorkspace)(this.contextService.getWorkspace())}).handleDrop(e,(0,x.getWindow)(this.groupView.element),()=>i(),e=>e?.focus())}isCopyOperation(e,t){return!t?.editor.hasCapability(L.EditorInputCapabilities.Singleton)&&(e.ctrlKey&&!eY.isMacintosh||e.altKey&&eY.isMacintosh)}isToggleSplitOperation(e){return e.altKey&&!eY.isMacintosh||e.shiftKey&&eY.isMacintosh}positionOverlay(e,t,i,o){let r,s,n,a="right"===this.editorGroupService.partOptions.openSideBySideDirection,d=this.groupView.element.clientWidth,l=this.groupView.element.clientHeight-this.getOverlayOffsetHeight();o?(r=i&&a?.3:.1,s=i?a?.1:.3:.1):(r=0,s=0);let c=d*r,h=l*s,u=d/3,p=l/3;switch(n=e>c&&e<d-c&&t>h&&t<l-h?void 0:a?e<u?_.GroupDirection.LEFT:e>2*u?_.GroupDirection.RIGHT:t<l/2?_.GroupDirection.UP:_.GroupDirection.DOWN:t<p?_.GroupDirection.UP:t>2*p?_.GroupDirection.DOWN:e<d/2?_.GroupDirection.LEFT:_.GroupDirection.RIGHT){case _.GroupDirection.UP:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"50%"}),this.toggleDropIntoPrompt(!1);break;case _.GroupDirection.DOWN:this.doPositionOverlay({top:"50%",left:"0",width:"100%",height:"50%"}),this.toggleDropIntoPrompt(!1);break;case _.GroupDirection.LEFT:this.doPositionOverlay({top:"0",left:"0",width:"50%",height:"100%"}),this.toggleDropIntoPrompt(!1);break;case _.GroupDirection.RIGHT:this.doPositionOverlay({top:"0",left:"50%",width:"50%",height:"100%"}),this.toggleDropIntoPrompt(!1);break;default:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"100%"}),this.toggleDropIntoPrompt(!0)}let g=(0,J.assertReturnsDefined)(this.overlay);g.style.opacity="1",setTimeout(()=>g.classList.add("overlay-move-transition"),0),this.currentDropOperation={splitDirection:n}}doPositionOverlay(e){let[t,i]=(0,J.assertReturnsAllDefined)(this.container,this.overlay),o=this.getOverlayOffsetHeight();o?t.style.height=`calc(100% - ${o}px)`:t.style.height="100%",i.style.top=e.top,i.style.left=e.left,i.style.width=e.width,i.style.height=e.height}getOverlayOffsetHeight(){return this.groupView.isEmpty||"multiple"!==this.editorGroupService.partOptions.showTabs?0:this.groupView.titleHeight.offset}hideOverlay(){let e=(0,J.assertReturnsDefined)(this.overlay);this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"100%"}),e.style.opacity="0",e.classList.remove("overlay-move-transition"),this.currentDropOperation=void 0}toggleDropIntoPrompt(e){this.dropIntoPromptElement&&(this.dropIntoPromptElement.style.opacity=e?"1":"0")}contains(e){return e===this.container||e===this.overlay}dispose(){super.dispose(),this._disposed=!0}};sd=v=(0,f.__decorate)([(0,f.__param)(1,T.IThemeService),(0,f.__param)(2,eQ.IConfigurationService),(0,f.__param)(3,E.IInstantiationService),(0,f.__param)(4,eN.IEditorService),(0,f.__param)(5,tR.IEditorGroupsService),(0,f.__param)(6,r1.ITreeViewsDnDService),(0,f.__param)(7,ea.IWorkspaceContextService)],sd);let sl=class extends sn.Themable{constructor(e,t,i,o,r,s){super(o),this.container=e,this.delegate=t,this.editorGroupService=i,this.configurationService=r,this.instantiationService=s,this.counter=0,this.editorTransfer=t_.LocalSelectionTransfer.getInstance(),this.groupTransfer=t_.LocalSelectionTransfer.getInstance(),this.registerListeners()}get overlay(){if(this._overlay&&!this._overlay.disposed)return this._overlay}registerListeners(){for(let e of(this._register((0,x.addDisposableListener)(this.container,x.EventType.DRAG_ENTER,e=>this.onDragEnter(e))),this._register((0,x.addDisposableListener)(this.container,x.EventType.DRAG_LEAVE,()=>this.onDragLeave())),[this.container,(0,x.getWindow)(this.container)]))this._register((0,x.addDisposableListener)(e,x.EventType.DRAG_END,()=>this.onDragEnd()))}onDragEnter(e){if(sa(this.configurationService)&&e.shiftKey)return;if(this.counter++,!this.editorTransfer.hasData(tO.DraggedEditorIdentifier.prototype)&&!this.groupTransfer.hasData(tO.DraggedEditorGroupIdentifier.prototype)&&e.dataTransfer){let t=Array.from(q.Registry.as(t_.Extensions.DragAndDropContribution).getAll()).map(e=>e.dataFormatKey);if(!(0,t_.containsDragType)(e,is.DataTransfers.FILES,t_.CodeDataTransfers.FILES,is.DataTransfers.RESOURCES,t_.CodeDataTransfers.EDITORS,...t)){e.dataTransfer.dropEffect="none";return}}this.updateContainer(!0);let t=e.target;if(t&&(this.overlay&&!this.overlay.contains(t)&&this.disposeOverlay(),!this.overlay)){let e=this.findTargetGroupView(t);e&&(this._overlay=this.instantiationService.createInstance(sd,e))}}onDragLeave(){this.counter--,0===this.counter&&this.updateContainer(!1)}onDragEnd(){this.counter=0,this.updateContainer(!1),this.disposeOverlay()}findTargetGroupView(e){return this.editorGroupService.groups.find(t=>(0,x.isAncestor)(e,t.element)||this.delegate.containsGroup?.(t))}updateContainer(e){this.container.classList.toggle("dragged-over",e)}dispose(){super.dispose(),this.disposeOverlay()}disposeOverlay(){this.overlay&&(this.overlay.dispose(),this._overlay=void 0)}};sl=(0,f.__decorate)([(0,f.__param)(2,tR.IEditorGroupsService),(0,f.__param)(3,T.IThemeService),(0,f.__param)(4,eQ.IConfigurationService),(0,f.__param)(5,E.IInstantiationService)],sl);var sc=e.i(976098),sh=e.i(430807);let su={targetWidth:900,leftMarginRatio:.1909,rightMarginRatio:.1909},sp={type:"distribute"};function sg(e){let t=(0,x.$)(".centered-layout-margin");return t.style.height="100%",e&&(t.style.backgroundColor=e.toString()),{element:t,layout:()=>void 0,minimumSize:60,maximumSize:1/0,onDidChange:I.Event.None}}class sm{constructor(e,t,i={...su},o=!1){this.container=e,this.view=t,this.state=i,this.centeredLayoutFixedWidth=o,this.lastLayoutPosition={width:0,height:0,left:0,top:0},this.didLayout=!1,this.splitViewDisposables=new D.DisposableStore,this._boundarySashes={},this.container.appendChild(this.view.element),this.container.style.overflow="hidden"}get minimumWidth(){return this.splitView?this.splitView.minimumSize:this.view.minimumWidth}get maximumWidth(){return this.splitView?this.splitView.maximumSize:this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get onDidChange(){return this.view.onDidChange}get boundarySashes(){return this._boundarySashes}set boundarySashes(e){this._boundarySashes=e,this.splitView&&(this.splitView.orthogonalStartSash=e.top,this.splitView.orthogonalEndSash=e.bottom)}layout(e,t,i,o){this.lastLayoutPosition={width:e,height:t,top:i,left:o},this.splitView?(this.splitView.layout(e,this.lastLayoutPosition),(!this.didLayout||this.centeredLayoutFixedWidth)&&this.resizeSplitViews()):this.view.layout(e,t,i,o),this.didLayout=!0}resizeSplitViews(){if(this.splitView)if(this.centeredLayoutFixedWidth){let e=Math.min(this.lastLayoutPosition.width,this.state.targetWidth),t=(this.lastLayoutPosition.width-e)/2;this.splitView.resizeView(0,Math.floor(t)),this.splitView.resizeView(1,e),this.splitView.resizeView(2,Math.ceil(t))}else{let e=this.state.leftMarginRatio*this.lastLayoutPosition.width,t=this.state.rightMarginRatio*this.lastLayoutPosition.width,i=this.lastLayoutPosition.width-e-t;this.splitView.resizeView(0,e),this.splitView.resizeView(1,i),this.splitView.resizeView(2,t)}}setFixedWidth(e){this.centeredLayoutFixedWidth=e,this.splitView&&(this.updateState(),this.resizeSplitViews())}updateState(){this.splitView&&(this.state.targetWidth=this.splitView.getViewSize(1),this.state.leftMarginRatio=this.splitView.getViewSize(0)/this.lastLayoutPosition.width,this.state.rightMarginRatio=this.splitView.getViewSize(2)/this.lastLayoutPosition.width)}isActive(){return!!this.splitView}styles(e){this.style=e,this.splitView&&this.emptyViews&&(this.splitView.style(this.style),this.emptyViews[0].element.style.backgroundColor=this.style.background.toString(),this.emptyViews[1].element.style.backgroundColor=this.style.background.toString())}activate(e){if(e!==this.isActive())if(e){var t,i;this.view.element.remove(),this.splitView=new sc.SplitView(this.container,{inverseAltBehavior:!0,orientation:sh.Orientation.HORIZONTAL,styles:this.style}),this.splitView.orthogonalStartSash=this.boundarySashes.top,this.splitView.orthogonalEndSash=this.boundarySashes.bottom,this.splitViewDisposables.add(this.splitView.onDidSashChange(()=>{this.splitView&&this.updateState()})),this.splitViewDisposables.add(this.splitView.onDidSashReset(()=>{this.state={...su},this.resizeSplitViews()})),this.splitView.layout(this.lastLayoutPosition.width,this.lastLayoutPosition);let e=this.style?this.style.background:void 0;this.emptyViews=[sg(e),sg(e)],this.splitView.addView(this.emptyViews[0],sp,0),this.splitView.addView((t=this.view,i=()=>this.lastLayoutPosition.height,{element:t.element,get maximumSize(){return t.maximumWidth},get minimumSize(){return t.minimumWidth},onDidChange:I.Event.map(t.onDidChange,e=>e&&e.width),layout:(e,o,r)=>t.layout(e,i(),r?.top??0,(r?.left??0)+o)}),sp,1),this.splitView.addView(this.emptyViews[1],sp,2),this.resizeSplitViews()}else this.splitView?.el.remove(),this.splitViewDisposables.clear(),this.splitView?.dispose(),this.splitView=void 0,this.emptyViews=void 0,this.container.appendChild(this.view.element),this.view.layout(this.lastLayoutPosition.width,this.lastLayoutPosition.height,this.lastLayoutPosition.top,this.lastLayoutPosition.left)}isDefault(e){return this.centeredLayoutFixedWidth?e.targetWidth===su.targetWidth:e.leftMarginRatio===su.leftMarginRatio&&e.rightMarginRatio===su.rightMarginRatio}dispose(){this.splitViewDisposables.dispose(),this.splitView&&(this.splitView.dispose(),this.splitView=void 0)}}var sv=e.i(559340),sy=e.i(865562),sC=e.i(938676);class sb{constructor(){this.element=(0,x.$)(".grid-view-container"),this._onDidChange=new I.Relay,this.onDidChange=this._onDidChange.event}get minimumWidth(){return this.gridWidget?this.gridWidget.minimumWidth:0}get maximumWidth(){return this.gridWidget?this.gridWidget.maximumWidth:1/0}get minimumHeight(){return this.gridWidget?this.gridWidget.minimumHeight:0}get maximumHeight(){return this.gridWidget?this.gridWidget.maximumHeight:1/0}get gridWidget(){return this._gridWidget}set gridWidget(e){this.element.textContent="",e?(this.element.appendChild(e.element),this._onDidChange.input=e.onDidChange):this._onDidChange.input=I.Event.None,this._gridWidget=e}layout(e,t,i,o){this.gridWidget?.layout(e,t,i,o)}dispose(){this._onDidChange.dispose()}}let sw=class extends A.Part{static{y=this}static{this.EDITOR_PART_UI_STATE_STORAGE_KEY="editorpart.state"}static{this.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY="editorpart.centeredview"}constructor(e,t,i,o,r,s,n,a,d,l,c){super(t,{hasTitle:!1},s,a,d),this.editorPartsView=e,this.groupsLabel=i,this.windowId=o,this.instantiationService=r,this.configurationService=n,this.hostService=l,this.contextKeyService=c,this._onDidFocus=this._register(new I.Emitter),this.onDidFocus=this._onDidFocus.event,this._onDidLayout=this._register(new I.Emitter),this.onDidLayout=this._onDidLayout.event,this._onDidChangeActiveGroup=this._register(new I.Emitter),this.onDidChangeActiveGroup=this._onDidChangeActiveGroup.event,this._onDidChangeGroupIndex=this._register(new I.Emitter),this.onDidChangeGroupIndex=this._onDidChangeGroupIndex.event,this._onDidChangeGroupLabel=this._register(new I.Emitter),this.onDidChangeGroupLabel=this._onDidChangeGroupLabel.event,this._onDidChangeGroupLocked=this._register(new I.Emitter),this.onDidChangeGroupLocked=this._onDidChangeGroupLocked.event,this._onDidChangeGroupMaximized=this._register(new I.Emitter),this.onDidChangeGroupMaximized=this._onDidChangeGroupMaximized.event,this._onDidActivateGroup=this._register(new I.Emitter),this.onDidActivateGroup=this._onDidActivateGroup.event,this._onDidAddGroup=this._register(new I.PauseableEmitter),this.onDidAddGroup=this._onDidAddGroup.event,this._onDidRemoveGroup=this._register(new I.PauseableEmitter),this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidMoveGroup=this._register(new I.Emitter),this.onDidMoveGroup=this._onDidMoveGroup.event,this.onDidSetGridWidget=this._register(new I.Emitter),this._onDidChangeSizeConstraints=this._register(new I.Relay),this.onDidChangeSizeConstraints=I.Event.any(this.onDidSetGridWidget.event,this._onDidChangeSizeConstraints.event),this._onDidScroll=this._register(new I.Relay),this.onDidScroll=I.Event.any(this.onDidSetGridWidget.event,this._onDidScroll.event),this._onDidChangeEditorPartOptions=this._register(new I.Emitter),this.onDidChangeEditorPartOptions=this._onDidChangeEditorPartOptions.event,this._onWillDispose=this._register(new I.Emitter),this.onWillDispose=this._onWillDispose.event,this.workspaceMemento=this.getMemento(e1.StorageScope.WORKSPACE,e1.StorageTarget.USER),this.profileMemento=this.getMemento(e1.StorageScope.PROFILE,e1.StorageTarget.MACHINE),this.groupViews=new Map,this.mostRecentActiveGroups=[],this.container=(0,x.$)(".content"),this.gridWidgetDisposables=this._register(new D.DisposableStore),this.gridWidgetView=this._register(new sb),this.enforcedPartOptions=[],this.top=0,this.left=0,this.sideGroup={openEditor:(e,t)=>{let[i]=this.scopedInstantiationService.invokeFunction(i=>(0,sv.findGroup)(i,{editor:e,options:t},tk.SIDE_GROUP));return i.openEditor(e,t)}},this._isReady=!1,this.whenReadyPromise=new ex.DeferredPromise,this.whenReady=this.whenReadyPromise.p,this.whenRestoredPromise=new ex.DeferredPromise,this.whenRestored=this.whenRestoredPromise.p,this._willRestoreState=!1,this.priority=sc.LayoutPriority.High,this.scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.container)),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new W.ServiceCollection([z.IContextKeyService,this.scopedContextKeyService]))),this._partOptions=(0,V.getEditorPartOptions)(this.configurationService,this.themeService),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e))),this._register(this.themeService.onDidFileIconThemeChange(()=>this.handleChangedPartOptions())),this._register(this.onDidChangeMementoValue(e1.StorageScope.WORKSPACE,this._store)(e=>this.onDidChangeMementoState(e)))}onConfigurationUpdated(e){(0,V.impactsEditorPartOptions)(e)&&this.handleChangedPartOptions()}handleChangedPartOptions(){let e=this._partOptions,t=(0,V.getEditorPartOptions)(this.configurationService,this.themeService);for(let e of this.enforcedPartOptions)Object.assign(t,e);this._partOptions=t,this._onDidChangeEditorPartOptions.fire({oldPartOptions:e,newPartOptions:t})}get partOptions(){return this._partOptions}enforcePartOptions(e){return this.enforcedPartOptions.push(e),this.handleChangedPartOptions(),(0,D.toDisposable)(()=>{this.enforcedPartOptions.splice(this.enforcedPartOptions.indexOf(e),1),this.handleChangedPartOptions()})}get contentDimension(){return this._contentDimension}get activeGroup(){return this._activeGroup}get groups(){return Array.from(this.groupViews.values())}get count(){return this.groupViews.size}get orientation(){return this.gridWidget&&this.gridWidget.orientation===sh.Orientation.VERTICAL?_.GroupOrientation.VERTICAL:_.GroupOrientation.HORIZONTAL}get isReady(){return this._isReady}get hasRestorableState(){return!!this.workspaceMemento[y.EDITOR_PART_UI_STATE_STORAGE_KEY]}get willRestoreState(){return this._willRestoreState}getGroups(e=_.GroupsOrder.CREATION_TIME){switch(e){case _.GroupsOrder.CREATION_TIME:return this.groups;case _.GroupsOrder.MOST_RECENTLY_ACTIVE:{let e=(0,P.coalesce)(this.mostRecentActiveGroups.map(e=>this.getGroup(e)));return(0,P.distinct)([...e,...this.groups])}case _.GroupsOrder.GRID_APPEARANCE:{let e=[];return this.gridWidget&&this.fillGridNodes(e,this.gridWidget.getViews()),e}}}fillGridNodes(e,t){(0,M.isGridBranchNode)(t)?t.children.forEach(t=>this.fillGridNodes(e,t)):e.push(t.view)}hasGroup(e){return this.groupViews.has(e)}getGroup(e){return this.groupViews.get(e)}findGroup(e,t=this.activeGroup,i){if("number"==typeof e.direction)return this.doFindGroupByDirection(e.direction,t,i);if("number"==typeof e.location)return this.doFindGroupByLocation(e.location,t,i);throw Error("invalid arguments")}doFindGroupByDirection(e,t,i){let o=this.assertGroupView(t),r=this.gridWidget.getNeighborViews(o,this.toGridViewDirection(e),i);return r.sort((e,t)=>this.mostRecentActiveGroups.indexOf(e.id)-this.mostRecentActiveGroups.indexOf(t.id)),r[0]}doFindGroupByLocation(e,t,i){let o=this.assertGroupView(t),r=this.getGroups(_.GroupsOrder.GRID_APPEARANCE),s=r.indexOf(o);switch(e){case _.GroupLocation.FIRST:return r[0];case _.GroupLocation.LAST:return r[r.length-1];case _.GroupLocation.NEXT:{let e=r[s+1];return!e&&i&&(e=this.doFindGroupByLocation(_.GroupLocation.FIRST,t)),e}case _.GroupLocation.PREVIOUS:{let e=r[s-1];return!e&&i&&(e=this.doFindGroupByLocation(_.GroupLocation.LAST,t)),e}}}activateGroup(e,t){let i=this.assertGroupView(e);return this.doSetGroupActive(i),t||this.hostService.moveTop((0,x.getWindow)(this.element)),i}restoreGroup(e){let t=this.assertGroupView(e);return this.doRestoreGroup(t),t}getSize(e){let t=this.assertGroupView(e);return this.gridWidget.getViewSize(t)}setSize(e,t){let i=this.assertGroupView(e);this.gridWidget.resizeView(i,t)}arrangeGroups(e,t=this.activeGroup){if(this.count<2||!this.gridWidget)return;let i=this.assertGroupView(t);switch(e){case _.GroupsArrangement.EVEN:this.gridWidget.distributeViewSizes();break;case _.GroupsArrangement.MAXIMIZE:if(this.groups.length<2)return;this.gridWidget.maximizeView(i),i.focus();break;case _.GroupsArrangement.EXPAND:this.gridWidget.expandView(i)}}toggleMaximizeGroup(e=this.activeGroup){this.hasMaximizedGroup()?this.unmaximizeGroup():this.arrangeGroups(_.GroupsArrangement.MAXIMIZE,e)}toggleExpandGroup(e=this.activeGroup){this.isGroupExpanded(this.activeGroup)?this.arrangeGroups(_.GroupsArrangement.EVEN):this.arrangeGroups(_.GroupsArrangement.EXPAND,e)}unmaximizeGroup(){this.gridWidget.exitMaximizedView(),this._activeGroup.focus()}hasMaximizedGroup(){return this.gridWidget.hasMaximizedView()}isGroupMaximized(e){return this.gridWidget.isViewMaximized(e)}isGroupExpanded(e){return this.gridWidget.isViewExpanded(e)}setGroupOrientation(e){if(!this.gridWidget)return;let t=e===_.GroupOrientation.HORIZONTAL?sh.Orientation.HORIZONTAL:sh.Orientation.VERTICAL;this.gridWidget.orientation!==t&&(this.gridWidget.orientation=t)}applyLayout(e){let t=this.shouldRestoreFocus(this.container),i=0;!function e(t){for(let o of t)Array.isArray(o.groups)?e(o.groups):i++}(e.groups);let o=this.getGroups(_.GroupsOrder.GRID_APPEARANCE);if(i<o.length){let e=o[i-1];o.forEach((t,o)=>{o>=i&&this.mergeGroup(t,e)}),o=this.getGroups(_.GroupsOrder.GRID_APPEARANCE)}let r=this.activeGroup,s=(0,M.createSerializedGrid)({orientation:this.toGridViewOrientation(e.orientation,this.isTwoDimensionalGrid()?this.gridWidget.orientation:(0,sC.orthogonal)(this.gridWidget.orientation)),groups:e.groups});this.doApplyGridState(s,r.id,o),t&&this._activeGroup.focus()}getLayout(){let e=this.gridWidget.serialize();return{orientation:e.orientation===sh.Orientation.HORIZONTAL?_.GroupOrientation.HORIZONTAL:_.GroupOrientation.VERTICAL,groups:this.serializedNodeToGroupLayoutArgument(e.root).groups}}serializedNodeToGroupLayoutArgument(e){return"branch"===e.type?{size:e.size,groups:e.data.map(e=>this.serializedNodeToGroupLayoutArgument(e))}:{size:e.size}}shouldRestoreFocus(e){return!!e&&((0,x.getActiveElement)()===e.ownerDocument.body||(0,x.isAncestorOfActiveElement)(e))}isTwoDimensionalGrid(){let e=this.gridWidget.getViews();return!!(0,M.isGridBranchNode)(e)&&e.children.some(e=>(0,M.isGridBranchNode)(e))}addGroup(e,t,i){let o,r=this.assertGroupView(e);if(r.groupsView===this){let e=this.shouldRestoreFocus(r.element),s=this.groupViews.size>1&&this.isGroupExpanded(r);o=this.doCreateGroupView(i),this.gridWidget.addView(o,this.getSplitSizingStyle(),r,this.toGridViewDirection(t)),this.updateContainer(),this._onDidAddGroup.fire(o),this.notifyGroupIndexChange(),s&&this.arrangeGroups(_.GroupsArrangement.EXPAND,o),e&&r.focus()}else o=r.groupsView.addGroup(r,t,i);return o}getSplitSizingStyle(){switch(this._partOptions.splitSizing){case"distribute":return M.Sizing.Distribute;case"split":return M.Sizing.Split;default:return M.Sizing.Auto}}doCreateGroupView(e,t){let i;i=e instanceof sr?sr.createCopy(e,this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t):(0,N.isSerializedEditorGroupModel)(e)?sr.createFromSerialized(e,this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t):sr.createNew(this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t),this.groupViews.set(i.id,i);let o=new D.DisposableStore;return o.add(i.onDidFocus(()=>{this.doSetGroupActive(i),this._onDidFocus.fire()})),o.add(i.onDidModelChange(e=>{switch(e.kind){case L.GroupModelChangeKind.GROUP_LOCKED:this._onDidChangeGroupLocked.fire(i);break;case L.GroupModelChangeKind.GROUP_INDEX:this._onDidChangeGroupIndex.fire(i);break;case L.GroupModelChangeKind.GROUP_LABEL:this._onDidChangeGroupLabel.fire(i)}})),o.add(i.onDidActiveEditorChange(()=>{this.updateContainer()})),I.Event.once(i.onWillDispose)(()=>{(0,D.dispose)(o),this.groupViews.delete(i.id),this.doUpdateMostRecentActive(i)}),i}doSetGroupActive(e){if(this._activeGroup!==e){let t=this._activeGroup;this._activeGroup=e,this.doUpdateMostRecentActive(e,!0),t&&!t.disposed&&t.setActive(!1),e.setActive(!0),this.doRestoreGroup(e),this._onDidChangeActiveGroup.fire(e)}this._onDidActivateGroup.fire(e)}doRestoreGroup(e){if(this.gridWidget)try{this.hasMaximizedGroup()&&!this.isGroupMaximized(e)&&this.unmaximizeGroup();let t=this.gridWidget.getViewSize(e);(t.width===e.minimumWidth||t.height===e.minimumHeight)&&this.arrangeGroups(_.GroupsArrangement.EXPAND,e)}catch(e){}}doUpdateMostRecentActive(e,t){let i=this.mostRecentActiveGroups.indexOf(e.id);-1!==i&&this.mostRecentActiveGroups.splice(i,1),t&&this.mostRecentActiveGroups.unshift(e.id)}toGridViewDirection(e){switch(e){case _.GroupDirection.UP:return M.Direction.Up;case _.GroupDirection.DOWN:return M.Direction.Down;case _.GroupDirection.LEFT:return M.Direction.Left;case _.GroupDirection.RIGHT:return M.Direction.Right}}toGridViewOrientation(e,t){return"number"==typeof e?e===_.GroupOrientation.HORIZONTAL?sh.Orientation.HORIZONTAL:sh.Orientation.VERTICAL:t}removeGroup(e,t){let i=this.assertGroupView(e);1!==this.count&&(i.isEmpty?this.doRemoveEmptyGroup(i,t):this.doRemoveGroupWithEditors(i))}doRemoveGroupWithEditors(e){let t,i=this.getGroups(_.GroupsOrder.MOST_RECENTLY_ACTIVE);t=this._activeGroup===e?i[1]:i[0],this.mergeGroup(e,t)}doRemoveEmptyGroup(e,t){let i=!t&&this.shouldRestoreFocus(this.container);if(this._activeGroup===e){let e=this.getGroups(_.GroupsOrder.MOST_RECENTLY_ACTIVE)[1];this.doSetGroupActive(e)}this.gridWidget.removeView(e,this.getSplitSizingStyle()),e.dispose(),i&&this._activeGroup.focus(),this.notifyGroupIndexChange(),this.updateContainer(),this._onDidRemoveGroup.fire(e)}moveGroup(e,t,i){let o,r=this.assertGroupView(e),s=this.assertGroupView(t);if(r.id===s.id)throw Error("Cannot move group into its own");let n=this.shouldRestoreFocus(r.element);return r.groupsView===s.groupsView?(this.gridWidget.moveView(r,this.getSplitSizingStyle(),s,this.toGridViewDirection(i)),o=r):(o=s.groupsView.addGroup(s,i,r),r.closeAllEditors(),this.removeGroup(r,n)),n&&o.focus(),this._onDidMoveGroup.fire(o),this.notifyGroupIndexChange(),o}copyGroup(e,t,i){let o=this.assertGroupView(e),r=this.assertGroupView(t),s=this.shouldRestoreFocus(o.element),n=this.addGroup(r,i,o);return s&&n.focus(),n}mergeGroup(e,t,i){let o=this.assertGroupView(e),r=this.assertGroupView(t),s=[],n=i&&"number"==typeof i.index?i.index:r.count;for(let e of o.editors){let t,a=!o.isActive(e)||this._activeGroup!==o;r.contains(e)&&(r.isSticky(e)||i?.preserveExistingIndex)||(t=n,n++),s.push({editor:e,options:{index:t,inactive:a,preserveFocus:a}})}let a=!0;return i?.mode===_.MergeGroupMode.COPY_EDITORS?o.copyEditors(s,r):a=o.moveEditors(s,r),o.isEmpty&&!o.disposed&&this.removeGroup(o,!0),a}mergeAllGroups(e,t){let i=this.assertGroupView(e),o=!0;for(let e of this.getGroups(_.GroupsOrder.MOST_RECENTLY_ACTIVE))e!==i&&(this.mergeGroup(e,i,t)||(o=!1));return o}assertGroupView(e){let t;if(!(t="number"==typeof e?this.editorPartsView.getGroup(e):e))throw Error("Invalid editor group provided!");return t}createEditorDropTarget(e,t){return(0,J.assertType)((0,x.isHTMLElement)(e)),this.scopedInstantiationService.createInstance(sl,e,t)}get minimumWidth(){return Math.min(this.centeredLayoutWidget.minimumWidth,this.layoutService.getMaximumEditorDimensions(this.layoutService.getContainer((0,x.getWindow)(this.container))).width)}get maximumWidth(){return this.centeredLayoutWidget.maximumWidth}get minimumHeight(){return Math.min(this.centeredLayoutWidget.minimumHeight,this.layoutService.getMaximumEditorDimensions(this.layoutService.getContainer((0,x.getWindow)(this.container))).height)}get maximumHeight(){return this.centeredLayoutWidget.maximumHeight}get snap(){return"center"===this.layoutService.getPanelAlignment()}get onDidChange(){return I.Event.any(this.centeredLayoutWidget.onDidChange,this.onDidSetGridWidget.event)}get gridSeparatorBorder(){return this.theme.getColor(O.EDITOR_GROUP_BORDER)||this.theme.getColor(R.contrastBorder)||r8.Color.transparent}updateStyles(){this.container.style.backgroundColor=this.getColor(k.editorBackground)||"";let e={separatorBorder:this.gridSeparatorBorder,background:this.theme.getColor(O.EDITOR_PANE_BACKGROUND)||r8.Color.transparent};this.gridWidget.style(e),this.centeredLayoutWidget.styles(e)}createContentArea(e,t){return this.element=e,this.windowId!==sy.mainWindow.vscodeWindowId&&this.container.classList.add("auxiliary"),e.appendChild(this.container),this._willRestoreState=!t||t.restorePreviousState,this.doCreateGridControl(),this.centeredLayoutWidget=this._register(new sm(this.container,this.gridWidgetView,this.profileMemento[y.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY],this._partOptions.centeredLayoutFixedWidth)),this._register(this.onDidChangeEditorPartOptions(e=>this.centeredLayoutWidget.setFixedWidth(e.newPartOptions.centeredLayoutFixedWidth??!1))),this.setupDragAndDropSupport(e,this.container),this.handleContextKeys(),this.whenReadyPromise.complete(),this._isReady=!0,ex.Promises.settled(this.groups.map(e=>e.whenRestored)).finally(()=>{this.whenRestoredPromise.complete()}),this.container}handleContextKeys(){G.IsAuxiliaryWindowContext.bindTo(this.scopedContextKeyService).set(this.windowId!==sy.mainWindow.vscodeWindowId);let e=G.EditorPartMultipleEditorGroupsContext.bindTo(this.scopedContextKeyService),t=G.EditorPartMaximizedEditorGroupContext.bindTo(this.scopedContextKeyService),i=()=>{this.count>1?e.set(!0):e.reset(),this.hasMaximizedGroup()?t.set(!0):t.reset()};i(),this._register(this.onDidAddGroup(()=>i())),this._register(this.onDidRemoveGroup(()=>i())),this._register(this.onDidChangeGroupMaximized(()=>i()))}setupDragAndDropSupport(e,t){let i,o,r,s;this._register(this.createEditorDropTarget(t,Object.create(null)));let n=(0,x.$)(".drop-block-overlay");e.appendChild(n),this._register((0,x.addDisposableGenericMouseDownListener)(n,()=>n.classList.remove("visible"))),this._register(tO.CompositeDragAndDropObserver.INSTANCE.registerTarget(this.element,{onDragStart:e=>n.classList.add("visible"),onDragEnd:e=>n.classList.remove("visible")}));let a=e=>{this.layoutService.isVisible(oU.Parts.PANEL_PART)||e!==this.layoutService.getPanelPosition()?this.layoutService.isVisible(oU.Parts.AUXILIARYBAR_PART)||e!==(this.layoutService.getSideBarPosition()===oU.Position.RIGHT?oU.Position.LEFT:oU.Position.RIGHT)||this.layoutService.setPartHidden(!1,oU.Parts.AUXILIARYBAR_PART):this.layoutService.setPartHidden(!1,oU.Parts.PANEL_PART)},d=()=>{i&&(clearTimeout(i),i=void 0),o&&(clearTimeout(o),o=void 0)};this._register(tO.CompositeDragAndDropObserver.INSTANCE.registerTarget(n,{onDragOver:e=>{let t,d;x.EventHelper.stop(e.eventData,!0),e.eventData.dataTransfer&&(e.eventData.dataTransfer.dropEffect="none");let l=n.getBoundingClientRect();e.eventData.clientX<l.left+100&&(t=oU.Position.LEFT),e.eventData.clientX>l.right-100&&(t=oU.Position.RIGHT),e.eventData.clientY>l.bottom-100&&(d=oU.Position.BOTTOM),e.eventData.clientY<l.top+100&&(d=oU.Position.TOP),i&&t!==r&&(clearTimeout(i),i=void 0),o&&d!==s&&(clearTimeout(o),o=void 0),i||void 0===t||(r=t,i=setTimeout(()=>a(t),200)),o||void 0===d||(s=d,o=setTimeout(()=>a(d),200))},onDragLeave:()=>d(),onDragEnd:()=>d(),onDrop:()=>d()}))}centerLayout(e){this.centeredLayoutWidget.activate(e)}isLayoutCentered(){return!!this.centeredLayoutWidget&&this.centeredLayoutWidget.isActive()}doCreateGridControl(){let e=!1;if(this._willRestoreState&&(e=!this.doCreateGridControlWithPreviousState()),!this.gridWidget||e){let e=this.doCreateGroupView();this.doSetGridWidget(new M.SerializableGrid(e)),this.doSetGroupActive(e)}this.updateContainer(),this.notifyGroupIndexChange()}doCreateGridControlWithPreviousState(){let e=this.loadState();if(e?.serializedGrid)try{this.mostRecentActiveGroups=e.mostRecentActiveGroups,this.doCreateGridControlWithState(e.serializedGrid,e.activeGroup)}catch(t){return(0,eE.onUnexpectedError)(Error(`Error restoring editor grid widget: ${t} (with state: ${JSON.stringify(e)})`)),this.disposeGroups(),!1}return!0}doCreateGridControlWithState(e,t,i,o){let r;r=i?i.slice(0):[];let s=[],n=M.SerializableGrid.deserialize(e,{fromJSON:e=>{let i;return i=r.length>0?r.shift():this.doCreateGroupView(e,o),s.push(i),i.id===t&&this.doSetGroupActive(i),i}},{styles:{separatorBorder:this.gridSeparatorBorder}});this._activeGroup||this.doSetGroupActive(s[0]),this.mostRecentActiveGroups.some(e=>!this.getGroup(e))&&(this.mostRecentActiveGroups=s.map(e=>e.id)),this.doSetGridWidget(n)}doSetGridWidget(e){let t={};this.gridWidget&&(t=this.gridWidget.boundarySashes,this.gridWidget.dispose()),this.gridWidget=e,this.gridWidget.boundarySashes=t,this.gridWidgetView.gridWidget=e,this._onDidChangeSizeConstraints.input=e.onDidChange,this._onDidScroll.input=e.onDidScroll,this.gridWidgetDisposables.clear(),this.gridWidgetDisposables.add(e.onDidChangeViewMaximized(e=>this._onDidChangeGroupMaximized.fire(e))),this.onDidSetGridWidget.fire(void 0)}updateContainer(){this.container.classList.toggle("empty",this.isEmpty)}notifyGroupIndexChange(){this.getGroups(_.GroupsOrder.GRID_APPEARANCE).forEach((e,t)=>e.notifyIndexChanged(t))}notifyGroupsLabelChange(e){for(let t of this.groups)t.notifyLabelChanged(e)}get isEmpty(){return 1===this.count&&this._activeGroup.isEmpty}setBoundarySashes(e){this.gridWidget.boundarySashes=e,this.centeredLayoutWidget.boundarySashes=e}layout(e,t,i,o){this.top=i,this.left=o;let r=super.layoutContents(e,t).contentSize;this.doLayout(x.Dimension.lift(r),i,o)}doLayout(e,t=this.top,i=this.left){this._contentDimension=e,this.centeredLayoutWidget.layout(this._contentDimension.width,this._contentDimension.height,t,i),this._onDidLayout.fire(e)}saveState(){if(this.gridWidget&&(this.isEmpty?delete this.workspaceMemento[y.EDITOR_PART_UI_STATE_STORAGE_KEY]:this.workspaceMemento[y.EDITOR_PART_UI_STATE_STORAGE_KEY]=this.createState()),this.centeredLayoutWidget){let e=this.centeredLayoutWidget.state;this.centeredLayoutWidget.isDefault(e)?delete this.profileMemento[y.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]:this.profileMemento[y.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]=e}super.saveState()}loadState(){return this.workspaceMemento[y.EDITOR_PART_UI_STATE_STORAGE_KEY]}createState(){return{serializedGrid:this.gridWidget.serialize(),activeGroup:this._activeGroup.id,mostRecentActiveGroups:this.mostRecentActiveGroups}}applyState(e,t){return"empty"===e?this.doApplyEmptyState():this.doApplyState(e,t)}async doApplyState(e,t){let i=await this.doPrepareApplyState();this._onDidAddGroup.pause(),this._onDidRemoveGroup.pause(),this.disposeGroups(),this.mostRecentActiveGroups=e.mostRecentActiveGroups;try{this.doApplyGridState(e.serializedGrid,e.activeGroup,void 0,t)}finally{this._onDidRemoveGroup.resume(),this._onDidAddGroup.resume()}await this.activeGroup.openEditors(i.flatMap(e=>e.editors).filter(e=>this.editorPartsView.groups.every(t=>!t.contains(e))).map(e=>({editor:e,options:{pinned:!0,preserveFocus:!0,inactive:!0}})))}async doApplyEmptyState(){await this.doPrepareApplyState(),this.mergeAllGroups(this.activeGroup)}async doPrepareApplyState(){let e=this.getGroups(_.GroupsOrder.MOST_RECENTLY_ACTIVE);for(let t of e)await t.closeAllEditors({excludeConfirming:!0});return e}doApplyGridState(e,t,i,o){for(let r of(this.doCreateGridControlWithState(e,t,i,o),this.doLayout(this._contentDimension),this.updateContainer(),this.getGroups(_.GroupsOrder.GRID_APPEARANCE)))i?.includes(r)||this._onDidAddGroup.fire(r);this.notifyGroupIndexChange()}onDidChangeMementoState(e){if(e.external&&e.scope===e1.StorageScope.WORKSPACE){this.reloadMemento(e.scope);let t=this.loadState();t&&this.applyState(t)}}toJSON(){return{type:oU.Parts.EDITOR_PART}}disposeGroups(){for(let e of this.groups)e.dispose(),this._onDidRemoveGroup.fire(e);this.groupViews.clear(),this.mostRecentActiveGroups=[]}dispose(){this._onWillDispose.fire(),this.disposeGroups(),this.gridWidget?.dispose(),super.dispose()}};sw=y=(0,f.__decorate)([(0,f.__param)(4,E.IInstantiationService),(0,f.__param)(5,T.IThemeService),(0,f.__param)(6,eQ.IConfigurationService),(0,f.__param)(7,er.IStorageService),(0,f.__param)(8,Y.IWorkbenchLayoutService),(0,f.__param)(9,eD.IHostService),(0,f.__param)(10,z.IContextKeyService)],sw);let sf=class extends sw{constructor(e,t,i,o,r,s,n,a){super(e,oU.Parts.EDITOR_PART,"",sy.mainWindow.vscodeWindowId,t,i,o,r,s,n,a)}};sf=(0,f.__decorate)([(0,f.__param)(1,E.IInstantiationService),(0,f.__param)(2,T.IThemeService),(0,f.__param)(3,eQ.IConfigurationService),(0,f.__param)(4,er.IStorageService),(0,f.__param)(5,Y.IWorkbenchLayoutService),(0,f.__param)(6,eD.IHostService),(0,f.__param)(7,z.IContextKeyService)],sf),e.s(["EditorPart",0,sw,"MainEditorPart",0,sf],139359);var sS=e.i(670913),s_=e.i(319475),sE=e.i(669414),sI=e.i(278725),sD=e.i(85282),sT=e.i(335563),sA=eL;let sx=(0,D.markAsSingleton)(new I.Emitter);(0,sA.registerAction2)(class extends sA.Action2{constructor(){super({id:"workbench.action.toggleCompactAuxiliaryWindow",title:(0,S.localize2)(3049,"Toggle Window Compact Mode"),category:tw.Categories.View,f1:!0,precondition:G.IsAuxiliaryWindowFocusedContext})}async run(){sx.fire({windowId:(0,x.getActiveWindow)().vscodeWindowId,compact:"toggle"})}}),(0,sA.registerAction2)(class extends sA.Action2{constructor(){super({id:"workbench.action.enableCompactAuxiliaryWindow",title:(0,S.localize)(3050,"Turn On Compact Mode"),icon:ty.Codicon.screenFull,menu:{id:sA.MenuId.LayoutControlMenu,when:e0.ContextKeyExpr.and(G.IsCompactTitleBarContext.toNegated(),G.IsAuxiliaryWindowContext),order:0}})}async run(){sx.fire({windowId:(0,x.getActiveWindow)().vscodeWindowId,compact:!0})}}),(0,sA.registerAction2)(class extends sA.Action2{constructor(){super({id:"workbench.action.disableCompactAuxiliaryWindow",title:(0,S.localize)(3051,"Turn Off Compact Mode"),icon:ty.Codicon.screenNormal,menu:{id:sA.MenuId.LayoutControlMenu,when:e0.ContextKeyExpr.and(G.IsCompactTitleBarContext,G.IsAuxiliaryWindowContext),order:0}})}async run(){sx.fire({windowId:(0,x.getActiveWindow)().vscodeWindowId,compact:!1})}});let sR=class{static{C=this}static{this.STATUS_BAR_VISIBILITY="workbench.statusBar.visible"}constructor(e,t,i,o,r,s,n,a,d){this.editorPartsView=e,this.instantiationService=t,this.auxiliaryWindowService=i,this.lifecycleService=o,this.configurationService=r,this.statusbarService=s,this.titleService=n,this.editorService=a,this.layoutService=d}async create(e,t){let i,o=this,r=new D.DisposableStore,s=!!t?.compact;function n(e){m?(0,x.show)(g.container):(0,x.hide)(g.container),e&&l.layout()}function a(e){i&&(p?(0,x.show)(i.container):(0,x.hide)(i.container),e&&l.layout())}function d(e){e===s||(s=e,l.updateOptions({compact:s}),i?.updateOptions({compact:s}),h.updateOptions({compact:s}),m!==(m=!s&&!1!==o.configurationService.getValue(C.STATUS_BAR_VISIBILITY))&&n(!0))}let l=r.add(await this.auxiliaryWindowService.open(t)),c=(0,x.$)(".part.editor",{role:"main"});c.style.position="relative",l.container.appendChild(c);let h=r.add(this.instantiationService.createInstance(sk,l.window.vscodeWindowId,this.editorPartsView,t?.state,e));h.updateOptions({compact:s}),r.add(this.editorPartsView.registerPart(h)),h.create(c);let u=r.add(h.scopedInstantiationService.createChild(new W.ServiceCollection([eN.IEditorService,this.editorService.createScoped(h,r)]))),p=!1;if(eY.isNative&&(0,sS.hasCustomTitlebar)()){(i=r.add(this.titleService.createAuxiliaryTitlebarPart(l.container,h,u))).updateOptions({compact:s}),p=(0,oU.shouldShowCustomTitleBar)(this.configurationService,l.window,void 0);let e=()=>{p!==(p=(0,oU.shouldShowCustomTitleBar)(this.configurationService,l.window,void 0))&&a(!0)};r.add(i.onDidChange(()=>l.layout())),r.add(this.layoutService.onDidChangePartVisibility(()=>e())),r.add((0,ih.onDidChangeFullscreen)(t=>{t===l.window.vscodeWindowId&&e()})),a(!1)}else r.add(u.createInstance(s_.WindowTitle,l.window));let g=r.add(this.statusbarService.createAuxiliaryStatusbarPart(l.container,u)),m=!s&&!1!==this.configurationService.getValue(C.STATUS_BAR_VISIBILITY);r.add(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(C.STATUS_BAR_VISIBILITY)&&(m=!s&&!1!==this.configurationService.getValue(C.STATUS_BAR_VISIBILITY),n(!0))})),n(!1);let v=r.add(I.Event.once(h.onWillClose)(()=>l.window.close()));return r.add(I.Event.once(l.onUnload)(()=>{r.isDisposed||(v.dispose(),h.close(),r.dispose())})),r.add(I.Event.once(this.lifecycleService.onDidShutdown)(()=>r.dispose())),r.add(l.onBeforeUnload(e=>{for(let t of h.groups)for(let i of t.editors){let o=i.canMove(t.id,this.editorPartsView.mainPart.activeGroup.id);if("string"==typeof o){t.openEditor(i),e.veto(o);return}}})),r.add(l.onWillLayout(e=>{let t,o=i?.height??0;i?.layout(e.width,o,0,0);let r=e.height-(t=0,m&&(t+=g.height),i&&p&&(t+=i.height),t);h.layout(e.width,r,o,0),g.layout(e.width,g.height,e.height-g.height,0)})),l.layout(),r.add(sx.event(e=>{e.windowId===l.window.vscodeWindowId&&d("boolean"==typeof e.compact?e.compact:!s)})),r.add(h.onDidAddGroup(e=>{d(!1),r.add(e.onDidActiveEditorChange(()=>{e.count>1&&d(!1)}))})),r.add(h.activeGroup.onDidActiveEditorChange(()=>{h.activeGroup.count>1&&d(!1)})),{part:h,instantiationService:r.add(u.createChild(new W.ServiceCollection([sD.IStatusbarService,this.statusbarService.createScoped(g,r)]))),disposables:r}}};sR=C=(0,f.__decorate)([(0,f.__param)(1,E.IInstantiationService),(0,f.__param)(2,sE.IAuxiliaryWindowService),(0,f.__param)(3,sI.ILifecycleService),(0,f.__param)(4,eQ.IConfigurationService),(0,f.__param)(5,sD.IStatusbarService),(0,f.__param)(6,sT.ITitleService),(0,f.__param)(7,eN.IEditorService),(0,f.__param)(8,Y.IWorkbenchLayoutService)],sR);let sk=class extends sw{static{b=this}static{this.COUNTER=1}constructor(e,t,i,o,r,s,n,a,d,l,c){const h=b.COUNTER++;super(t,`workbench.parts.auxiliaryEditor.${h}`,o,e,r,s,n,a,d,l,c),this.state=i,this._onWillClose=this._register(new I.Emitter),this.onWillClose=this._onWillClose.event,this.optionsDisposable=this._register(new D.MutableDisposable),this.isCompact=!1}updateOptions(e){this.isCompact=e.compact,e.compact?this.optionsDisposable.value||(this.optionsDisposable.value=this.enforcePartOptions({showTabs:"none",closeEmptyGroups:!0})):this.optionsDisposable.clear()}addGroup(e,t,i){return this.isCompact&&(e=this.editorPartsView.mainPart.activeGroup),super.addGroup(e,t,i)}removeGroup(e,t){let i=this.assertGroupView(e);1===this.count&&this.activeGroup===i?this.doRemoveLastGroup(t):super.removeGroup(e,t)}doRemoveLastGroup(e){let t=!e&&this.shouldRestoreFocus(this.container),i=this.editorPartsView.getGroups(_.GroupsOrder.MOST_RECENTLY_ACTIVE)[1];i&&(i.groupsView.activateGroup(i),t&&i.focus()),this.doClose(!1)}loadState(){return this.state}saveState(){}close(){return this.doClose(!0)}doClose(e){let t=!0;if(e){for(let e of this.groups)e.closeAllEditors({excludeConfirming:!0});t=this.mergeGroupsToMainPart()}return this._onWillClose.fire(),t}mergeGroupsToMainPart(){let e;if(!this.groups.some(e=>e.count>0))return!0;for(let t of this.editorPartsView.mainPart.getGroups(_.GroupsOrder.MOST_RECENTLY_ACTIVE))if(!t.isLocked){e=t;break}e||(e=this.editorPartsView.mainPart.addGroup(this.editorPartsView.mainPart.activeGroup,"right"===this.partOptions.openSideBySideDirection?_.GroupDirection.RIGHT:_.GroupDirection.DOWN));let t=this.mergeAllGroups(e,{preserveExistingIndex:!0});return e.focus(),t}};sk=b=(0,f.__decorate)([(0,f.__param)(4,E.IInstantiationService),(0,f.__param)(5,T.IThemeService),(0,f.__param)(6,eQ.IConfigurationService),(0,f.__param)(7,er.IStorageService),(0,f.__param)(8,Y.IWorkbenchLayoutService),(0,f.__param)(9,eD.IHostService),(0,f.__param)(10,z.IContextKeyService)],sk);var sM=A,sL=e.i(193409);let sO=class extends sM.MultiWindowParts{static{w=this}constructor(e,t,i,o,r){super("workbench.editorParts",i,t),this.instantiationService=e,this.storageService=t,this.auxiliaryWindowService=o,this.contextKeyService=r,this.mapPartToInstantiationService=new Map,this._onDidCreateAuxiliaryEditorPart=this._register(new I.Emitter),this.onDidCreateAuxiliaryEditorPart=this._onDidCreateAuxiliaryEditorPart.event,this.workspaceMemento=this.getMemento(e1.StorageScope.WORKSPACE,e1.StorageTarget.USER),this._isReady=!1,this.whenReadyPromise=new ex.DeferredPromise,this.whenReady=this.whenReadyPromise.p,this.whenRestoredPromise=new ex.DeferredPromise,this.whenRestored=this.whenRestoredPromise.p,this._onDidActiveGroupChange=this._register(new I.Emitter),this.onDidChangeActiveGroup=this._onDidActiveGroupChange.event,this._onDidAddGroup=this._register(new I.Emitter),this.onDidAddGroup=this._onDidAddGroup.event,this._onDidRemoveGroup=this._register(new I.Emitter),this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidMoveGroup=this._register(new I.Emitter),this.onDidMoveGroup=this._onDidMoveGroup.event,this._onDidActivateGroup=this._register(new I.Emitter),this.onDidActivateGroup=this._onDidActivateGroup.event,this._onDidChangeGroupIndex=this._register(new I.Emitter),this.onDidChangeGroupIndex=this._onDidChangeGroupIndex.event,this._onDidChangeGroupLocked=this._register(new I.Emitter),this.onDidChangeGroupLocked=this._onDidChangeGroupLocked.event,this._onDidChangeGroupMaximized=this._register(new I.Emitter),this.onDidChangeGroupMaximized=this._onDidChangeGroupMaximized.event,this.globalContextKeys=new Map,this.scopedContextKeys=new Map,this.contextKeyProviders=new Map,this.registeredContextKeys=new Map,this.contextKeyProviderDisposables=this._register(new D.DisposableMap),this.editorWorkingSets=(()=>{let e=this.storageService.get(w.EDITOR_WORKING_SETS_STORAGE_KEY,e1.StorageScope.WORKSPACE);return e?JSON.parse(e):[]})(),this.mainPart=this._register(this.createMainEditorPart()),this._register(this.registerPart(this.mainPart)),this.mostRecentActiveParts=[this.mainPart],this.restoreParts(),this.registerListeners()}registerListeners(){this._register(this.onDidChangeMementoValue(e1.StorageScope.WORKSPACE,this._store)(e=>this.onDidChangeMementoState(e))),this.whenReady.then(()=>this.registerGroupsContextKeyListeners())}createMainEditorPart(){return this.instantiationService.createInstance(sf,this)}getScopedInstantiationService(e){return e!==this.mainPart||this.mapPartToInstantiationService.has(e.windowId)||this.instantiationService.invokeFunction(t=>{let i=t.get(eN.IEditorService),o=t.get(sD.IStatusbarService);this.mapPartToInstantiationService.set(e.windowId,this._register(this.mainPart.scopedInstantiationService.createChild(new W.ServiceCollection([eN.IEditorService,i.createScoped(this.mainPart,this._store)],[sD.IStatusbarService,o.createScoped(o,this._store)]))))}),this.mapPartToInstantiationService.get(e.windowId)??this.instantiationService}async createAuxiliaryEditorPart(e){let{part:t,instantiationService:i,disposables:o}=await this.instantiationService.createInstance(sR,this).create(this.getGroupsLabel(this._parts.size),e);return this.mapPartToInstantiationService.set(t.windowId,i),o.add((0,D.toDisposable)(()=>this.mapPartToInstantiationService.delete(t.windowId))),this._onDidAddGroup.fire(t.activeGroup),this._onDidCreateAuxiliaryEditorPart.fire(t),t}registerPart(e){let t=this._register(new D.DisposableStore);return t.add(super.registerPart(e)),this.registerEditorPartListeners(e,t),t}unregisterPart(e){super.unregisterPart(e),this.parts.forEach((e,t)=>{e!==this.mainPart&&e.notifyGroupsLabelChange(this.getGroupsLabel(t))})}registerEditorPartListeners(e,t){t.add(e.onDidFocus(()=>{this.doUpdateMostRecentActive(e,!0),this._parts.size>1&&this._onDidActiveGroupChange.fire(this.activeGroup)})),t.add((0,D.toDisposable)(()=>{this.doUpdateMostRecentActive(e),e.windowId!==sy.mainWindow.vscodeWindowId&&this._onDidActiveGroupChange.fire(this.activeGroup)})),t.add(e.onDidChangeActiveGroup(e=>this._onDidActiveGroupChange.fire(e))),t.add(e.onDidAddGroup(e=>this._onDidAddGroup.fire(e))),t.add(e.onDidRemoveGroup(e=>this._onDidRemoveGroup.fire(e))),t.add(e.onDidMoveGroup(e=>this._onDidMoveGroup.fire(e))),t.add(e.onDidActivateGroup(e=>this._onDidActivateGroup.fire(e))),t.add(e.onDidChangeGroupMaximized(e=>this._onDidChangeGroupMaximized.fire(e))),t.add(e.onDidChangeGroupIndex(e=>this._onDidChangeGroupIndex.fire(e))),t.add(e.onDidChangeGroupLocked(e=>this._onDidChangeGroupLocked.fire(e)))}doUpdateMostRecentActive(e,t){let i=this.mostRecentActiveParts.indexOf(e);-1!==i&&this.mostRecentActiveParts.splice(i,1),t&&this.mostRecentActiveParts.unshift(e)}getGroupsLabel(e){return(0,S.localize)(3428,"Window {0}",e+1)}getPart(e){if(this._parts.size>1)if((0,x.isHTMLElement)(e))return this.getPartByDocument(e.ownerDocument);else{let t;for(let i of(t="number"==typeof e?e:e.id,this._parts))if(i.hasGroup(t))return i}return this.mainPart}static{this.EDITOR_PARTS_UI_STATE_STORAGE_KEY="editorparts.state"}get isReady(){return this._isReady}async restoreParts(){if(await this.mainPart.whenReady,this.mainPart.willRestoreState){let e=this.loadState();e&&await this.restoreState(e)}let e=this.mostRecentActiveParts.at(0);e?.activeGroup.focus(),this._isReady=!0,this.whenReadyPromise.complete(),await Promise.allSettled(this.parts.map(e=>e.whenRestored)),this.whenRestoredPromise.complete()}loadState(){return this.workspaceMemento[w.EDITOR_PARTS_UI_STATE_STORAGE_KEY]}saveState(){let e=this.createState();0===e.auxiliary.length?delete this.workspaceMemento[w.EDITOR_PARTS_UI_STATE_STORAGE_KEY]:this.workspaceMemento[w.EDITOR_PARTS_UI_STATE_STORAGE_KEY]=e}createState(){return{auxiliary:this.parts.filter(e=>e!==this.mainPart).map(e=>{let t=this.auxiliaryWindowService.getWindow(e.windowId);return{state:e.createState(),...t?.createState()}}),mru:this.mostRecentActiveParts.map(e=>this.parts.indexOf(e))}}async restoreState(e){if(e.auxiliary.length){let t=[];for(let i of e.auxiliary)t.push(this.createAuxiliaryEditorPart(i));await Promise.allSettled(t),e.mru.length===this.parts.length?this.mostRecentActiveParts=e.mru.map(e=>this.parts[e]):this.mostRecentActiveParts=[...this.parts],await Promise.allSettled(this.parts.map(e=>e.whenReady))}}get hasRestorableState(){return this.parts.some(e=>e.hasRestorableState)}onDidChangeMementoState(e){if(e.external&&e.scope===e1.StorageScope.WORKSPACE){this.reloadMemento(e.scope);let t=this.loadState();t&&this.applyState(t)}}async applyState(e){for(let e of this.parts)if(e!==this.mainPart){for(let t of e.getGroups(_.GroupsOrder.MOST_RECENTLY_ACTIVE))await t.closeAllEditors({excludeConfirming:!0});if(!e.close())return!1}return"empty"!==e&&await this.restoreState(e),!0}static{this.EDITOR_WORKING_SETS_STORAGE_KEY="editor.workingSets"}saveWorkingSet(e){let t={id:(0,sL.generateUuid)(),name:e,main:this.mainPart.createState(),auxiliary:this.createState()};return this.editorWorkingSets.push(t),this.saveWorkingSets(),{id:t.id,name:t.name}}getWorkingSets(){return this.editorWorkingSets.map(e=>({id:e.id,name:e.name}))}deleteWorkingSet(e){let t=this.indexOfWorkingSet(e);"number"==typeof t&&(this.editorWorkingSets.splice(t,1),this.saveWorkingSets())}async applyWorkingSet(e,t){let i;if(!(i="empty"===e?"empty":this.editorWorkingSets[this.indexOfWorkingSet(e)??-1])||!await this.applyState("empty"===i?i:i.auxiliary))return!1;if(await this.mainPart.applyState("empty"===i?i:i.main,t),!t?.preserveFocus){let e=this.mostRecentActiveParts.at(0);e&&(await e.whenReady,e.activeGroup.focus())}return!0}indexOfWorkingSet(e){for(let t=0;t<this.editorWorkingSets.length;t++)if(this.editorWorkingSets[t].id===e.id)return t}saveWorkingSets(){this.storageService.store(w.EDITOR_WORKING_SETS_STORAGE_KEY,JSON.stringify(this.editorWorkingSets),e1.StorageScope.WORKSPACE,e1.StorageTarget.MACHINE)}get activeGroup(){return this.activePart.activeGroup}get sideGroup(){return this.activePart.sideGroup}get groups(){return this.getGroups()}get count(){return this.groups.length}getGroups(e=_.GroupsOrder.CREATION_TIME){if(this._parts.size>1){let t;switch(e){case _.GroupsOrder.GRID_APPEARANCE:case _.GroupsOrder.CREATION_TIME:t=this.parts;break;case _.GroupsOrder.MOST_RECENTLY_ACTIVE:t=(0,P.distinct)([...this.mostRecentActiveParts,...this.parts])}return t.flatMap(t=>t.getGroups(e))}return this.mainPart.getGroups(e)}getGroup(e){if(this._parts.size>1)for(let t of this._parts){let i=t.getGroup(e);if(i)return i}return this.mainPart.getGroup(e)}assertGroupView(e){let t;if(!(t="number"==typeof e?this.getGroup(e):e))throw Error("Invalid editor group provided!");return t}activateGroup(e){return this.getPart(e).activateGroup(e)}getSize(e){return this.getPart(e).getSize(e)}setSize(e,t){this.getPart(e).setSize(e,t)}arrangeGroups(e,t=this.activePart.activeGroup){this.getPart(t).arrangeGroups(e,t)}toggleMaximizeGroup(e=this.activePart.activeGroup){this.getPart(e).toggleMaximizeGroup(e)}toggleExpandGroup(e=this.activePart.activeGroup){this.getPart(e).toggleExpandGroup(e)}restoreGroup(e){return this.getPart(e).restoreGroup(e)}applyLayout(e){this.activePart.applyLayout(e)}getLayout(){return this.activePart.getLayout()}get orientation(){return this.activePart.orientation}setGroupOrientation(e){this.activePart.setGroupOrientation(e)}findGroup(e,t=this.activeGroup,i){let o=this.getPart(t);if(this._parts.size>1){let r=this.getGroups(_.GroupsOrder.GRID_APPEARANCE);if(e.location===_.GroupLocation.FIRST||e.location===_.GroupLocation.LAST)return e.location===_.GroupLocation.FIRST?r[0]:r[r.length-1];let s=o.findGroup(e,t,!1);if(s)return s;if(e.location===_.GroupLocation.NEXT||e.location===_.GroupLocation.PREVIOUS){let o=this.assertGroupView(t),s=r.indexOf(o);if(e.location===_.GroupLocation.NEXT){let e=r[s+1];return!e&&i&&(e=r[0]),e}{let e=r[s-1];return!e&&i&&(e=r[r.length-1]),e}}}return o.findGroup(e,t,i)}addGroup(e,t){return this.getPart(e).addGroup(e,t)}removeGroup(e){this.getPart(e).removeGroup(e)}moveGroup(e,t,i){return this.getPart(e).moveGroup(e,t,i)}mergeGroup(e,t,i){return this.getPart(e).mergeGroup(e,t,i)}mergeAllGroups(e,t){return this.activePart.mergeAllGroups(e,t)}copyGroup(e,t,i){return this.getPart(e).copyGroup(e,t,i)}createEditorDropTarget(e,t){return this.getPart(e).createEditorDropTarget(e,t)}registerGroupsContextKeyListeners(){this._register(this.onDidChangeActiveGroup(()=>this.updateGlobalContextKeys())),this.groups.forEach(e=>this.registerGroupContextKeyProvidersListeners(e)),this._register(this.onDidAddGroup(e=>this.registerGroupContextKeyProvidersListeners(e))),this._register(this.onDidRemoveGroup(e=>{this.scopedContextKeys.delete(e.id),this.registeredContextKeys.delete(e.id),this.contextKeyProviderDisposables.deleteAndDispose(e.id)}))}updateGlobalContextKeys(){let e=this.scopedContextKeys.get(this.activeGroup.id);if(e)for(let[t,i]of this.globalContextKeys){let o=e.get(t);o?i.set(o.get()):i.reset()}}bind(e,t){let i=this.globalContextKeys.get(e.key);i||(i=e.bindTo(this.contextKeyService),this.globalContextKeys.set(e.key,i));let o=this.scopedContextKeys.get(t.id);o||(o=new Map,this.scopedContextKeys.set(t.id,o));let r=o.get(e.key);r||(r=e.bindTo(t.scopedContextKeyService),o.set(e.key,r));let s=this;return{get:()=>r.get(),set(e){s.activeGroup===t&&i.set(e),r.set(e)},reset(){s.activeGroup===t&&i.reset(),r.reset()}}}registerContextKeyProvider(e){if(this.contextKeyProviders.has(e.contextKey.key)||this.globalContextKeys.has(e.contextKey.key))throw Error(`A context key provider for key ${e.contextKey.key} already exists.`);this.contextKeyProviders.set(e.contextKey.key,e);let t=()=>{for(let t of this.groups)this.updateRegisteredContextKey(t,e)};t();let i=e.onDidChange?.(()=>t());return(0,D.toDisposable)(()=>{i?.dispose(),this.globalContextKeys.delete(e.contextKey.key),this.scopedContextKeys.forEach(t=>t.delete(e.contextKey.key)),this.contextKeyProviders.delete(e.contextKey.key),this.registeredContextKeys.forEach(t=>t.delete(e.contextKey.key))})}registerGroupContextKeyProvidersListeners(e){let t=e.onDidActiveEditorChange(()=>{for(let t of this.contextKeyProviders.values())this.updateRegisteredContextKey(e,t)});this.contextKeyProviderDisposables.set(e.id,t)}updateRegisteredContextKey(e,t){let i=this.registeredContextKeys.get(e.id);i||(i=new Map,this.registeredContextKeys.set(e.id,i));let o=i.get(t.contextKey.key);o||(o=this.bind(t.contextKey,e),i.set(t.contextKey.key,o)),o.set(t.getGroupContextKeyValue(e))}get partOptions(){return this.mainPart.partOptions}get onDidChangeEditorPartOptions(){return this.mainPart.onDidChangeEditorPartOptions}enforcePartOptions(e){return this.mainPart.enforcePartOptions(e)}};sO=w=(0,f.__decorate)([(0,f.__param)(0,E.IInstantiationService),(0,f.__param)(1,er.IStorageService),(0,f.__param)(2,T.IThemeService),(0,f.__param)(3,sE.IAuxiliaryWindowService),(0,f.__param)(4,z.IContextKeyService)],sO),e.s(["EditorParts",0,sO],900340)},377882,e=>{"use strict";var t,i=e.i(281482),o=e.i(322193),r=e.i(850887),s=e.i(105673);async function n(e){let t=navigator.usb;if(!t)return;let i=await t.requestDevice({filters:e?.filters??[]});if(i)return{deviceClass:i.deviceClass,deviceProtocol:i.deviceProtocol,deviceSubclass:i.deviceSubclass,deviceVersionMajor:i.deviceVersionMajor,deviceVersionMinor:i.deviceVersionMinor,deviceVersionSubminor:i.deviceVersionSubminor,manufacturerName:i.manufacturerName,productId:i.productId,productName:i.productName,serialNumber:i.serialNumber,usbVersionMajor:i.usbVersionMajor,usbVersionMinor:i.usbVersionMinor,usbVersionSubminor:i.usbVersionSubminor,vendorId:i.vendorId}}async function a(e){let t=navigator.serial;if(!t)return;let i=await t.requestPort({filters:e?.filters??[]});if(!i)return;let o=i.getInfo();return{usbVendorId:o.usbVendorId,usbProductId:o.usbProductId}}async function d(e){let t=navigator.hid;if(!t)return;let i=await t.requestDevice({filters:e?.filters??[]});if(!i.length)return;let o=i[0];return{opened:o.opened,vendorId:o.vendorId,productId:o.productId,productName:o.productName,collections:o.collections}}var l=e.i(590746),c=e.i(781808),h=e.i(611130),u=e.i(702320),p=e.i(354244),g=e.i(770326),m=e.i(802136),v=e.i(650289),y=e.i(318581),C=e.i(324726),b=e.i(488259),w=e.i(370973),f=e.i(65579),S=e.i(347589),_=e.i(176876),E=e.i(957994),I=e.i(683578),D=e.i(278725),T=e.i(74304),A=e.i(865562),x=e.i(454514),R=e.i(253642),k=e.i(553638);let M=(0,v.localize)(1956,"open"),L=(0,v.localize)(1957,"close"),O=(0,v.localize)(1958,"find");var P=e.i(842154),V=e.i(853457),K=e.i(621826),N=e.i(697786);let G=class{constructor(e,t,i,o){this.fileService=e,this.environmentService=t,this.lifecycleService=i,this.logService=o}async getLogs(){return(0,P.getLogs)(this.fileService,this.environmentService)}async whenWorkbenchRestored(){this.logService.info("[driver] Waiting for restored lifecycle phase..."),await this.lifecycleService.when(I.LifecyclePhase.Restored),this.logService.info("[driver] Restored lifecycle phase reached. Waiting for contributions..."),await K.Registry.as(N.Extensions.Workbench).whenRestored,this.logService.info("[driver] Workbench contributions created.")}async setValue(e,t){let i=A.mainWindow.document.querySelector(e);if(!i)return Promise.reject(Error(`Element not found: ${e}`));i.value=t;let o=new Event("input",{bubbles:!0,cancelable:!0});i.dispatchEvent(o)}async isActiveElement(e){if(A.mainWindow.document.querySelector(e)!==A.mainWindow.document.activeElement){let t=[],i=A.mainWindow.document.activeElement;for(;i;){let e=i.tagName,o=i.id?`#${i.id}`:"",r=(0,x.coalesce)(i.className.split(/\s+/g).map(e=>e.trim())).map(e=>`.${e}`).join("");t.unshift(`${e}${o}${r}`),i=i.parentElement}throw Error(`Active element not found. Current active element is '${t.join(" > ")}'. Looking for ${e}`)}return!0}async getElements(e,t){let i=A.mainWindow.document.querySelectorAll(e),o=[];for(let e=0;e<i.length;e++){let r=i.item(e);o.push(this.serializeElement(r,t))}return o}serializeElement(e,t){let i=Object.create(null);for(let t=0;t<e.attributes.length;t++){let o=e.attributes.item(t);o&&(i[o.name]=o.value)}let o=[];if(t)for(let t=0;t<e.children.length;t++){let i=e.children.item(t);i&&o.push(this.serializeElement(i,!0))}let{left:s,top:n}=(0,r.getTopLeftOffset)(e);return{tagName:e.tagName,className:e.className,textContent:e.textContent||"",attributes:i,children:o,left:s,top:n}}async getElementXY(e,t,i){return this._getElementXY(e,"number"==typeof t&&"number"==typeof i?{x:t,y:i}:void 0)}async typeInEditor(e,t){let i=A.mainWindow.document.querySelector(e);if(!i)throw Error(`Editor not found: ${e}`);if((0,r.isHTMLDivElement)(i)){let o=i.editContext;if(!o)throw Error(`Edit context not found: ${e}`);let r=o.selectionStart,s=new TextUpdateEvent("textupdate",{updateRangeStart:r,updateRangeEnd:o.selectionEnd,text:t,selectionStart:r+t.length,selectionEnd:r+t.length,compositionStart:0,compositionEnd:0});o.dispatchEvent(s)}else if((0,r.isHTMLTextAreaElement)(i)){let e=i.selectionStart,o=e+t.length,r=i.value;i.value=r.substr(0,e)+t+r.substr(e),i.setSelectionRange(o,o);let s=new Event("input",{bubbles:!0,cancelable:!0});i.dispatchEvent(s)}}async getEditorSelection(e){let t=A.mainWindow.document.querySelector(e);if(!t)throw Error(`Editor not found: ${e}`);if((0,r.isHTMLDivElement)(t)){let i=t.editContext;if(!i)throw Error(`Edit context not found: ${e}`);return{selectionStart:i.selectionStart,selectionEnd:i.selectionEnd}}if((0,r.isHTMLTextAreaElement)(t))return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd};throw Error(`Unknown type of element: ${e}`)}async getTerminalBuffer(e){let t=A.mainWindow.document.querySelector(e);if(!t)throw Error(`Terminal not found: ${e}`);let i=t.xterm;if(!i)throw Error(`Xterm not found: ${e}`);let o=[];for(let e=0;e<i.buffer.active.length;e++)o.push(i.buffer.active.getLine(e).translateToString(!0));return o}async writeInTerminal(e,t){let i=A.mainWindow.document.querySelector(e);if(!i)throw Error(`Element not found: ${e}`);let o=i.xterm;if(!o)throw Error(`Xterm not found: ${e}`);o.input(t)}getLocaleInfo(){return Promise.resolve({language:p.language,locale:p.locale})}getLocalizedStrings(){return Promise.resolve({open:M,close:L,find:O})}async _getElementXY(e,t){let i,o,s=A.mainWindow.document.querySelector(e);if(!s)return Promise.reject(Error(`Element not found: ${e}`));let{left:n,top:a}=(0,r.getTopLeftOffset)(s),{width:d,height:l}=(0,r.getClientArea)(s);return t?(i=n+t.x,o=a+t.y):(i=n+d/2,o=a+l/2),{x:i=Math.round(i),y:o=Math.round(o)}}};G=(0,i.__decorate)([(0,i.__param)(0,k.IFileService),(0,i.__param)(1,R.IEnvironmentService),(0,i.__param)(2,D.ILifecycleService),(0,i.__param)(3,V.ILogService)],G);var F=e.i(537080),W=e.i(731931),z=e.i(772383),B=e.i(399119),U=e.i(919101);let H=class extends h.Disposable{static{t=this}static{this.TIMEOUT_HANDLES=Number.MIN_SAFE_INTEGER}static{this.TIMEOUT_DISPOSABLES=new Map}constructor(e,t={getWindowsCount:r.getWindowsCount,getWindows:r.getWindows},i,o,s,n){super(),this.hostService=i,this.environmentService=o,this.contextMenuService=s,this.layoutService=n,this.enableWindowFocusOnElementFocus(e),this.enableMultiWindowAwareTimeout(e,t),this.registerFullScreenListeners(e.vscodeWindowId),this.registerContextMenuListeners(e)}enableWindowFocusOnElementFocus(e){let t=e.HTMLElement.prototype.focus,i=this;e.HTMLElement.prototype.focus=function(e){i.onElementFocus((0,r.getWindow)(this)),t.apply(this,[e])}}onElementFocus(e){let t=(0,r.getActiveWindow)();t!==e&&t.document.hasFocus()&&(e.focus(),this.environmentService.extensionTestsLocationURI||e.document.hasFocus()||this.hostService.focus(e))}enableMultiWindowAwareTimeout(e,i={getWindowsCount:r.getWindowsCount,getWindows:r.getWindows}){function o(e){return e===A.mainWindow?window:e}let s=o(e).setTimeout;Object.defineProperty(o(e),"vscodeOriginalSetTimeout",{get:()=>s});let n=o(e).clearTimeout;Object.defineProperty(o(e),"vscodeOriginalClearTimeout",{get:()=>n}),o(e).setTimeout=function(r,n=0,...a){if(1===i.getWindowsCount()||"string"==typeof r||0===n)return s.apply(this,[r,n,...a]);let d=new Set,l=t.TIMEOUT_HANDLES++;t.TIMEOUT_DISPOSABLES.set(l,d);let c=(0,F.createSingleCallFunction)(r,()=>{(0,h.dispose)(d),t.TIMEOUT_DISPOSABLES.delete(l)});for(let{window:t,disposables:r}of i.getWindows()){if((0,A.isAuxiliaryWindow)(t)&&"hidden"===t.document.visibilityState)continue;let i=!1,s=o(e).vscodeOriginalSetTimeout?.apply(this,[(...e)=>{i||c(...e)},n,...a]),l=(0,h.toDisposable)(()=>{i=!0,o(e).vscodeOriginalClearTimeout?.apply(this,[s]),d.delete(l)});r.add(l),d.add(l)}return l},o(e).clearTimeout=function(e){let i="number"==typeof e?t.TIMEOUT_DISPOSABLES.get(e):void 0;i?((0,h.dispose)(i),t.TIMEOUT_DISPOSABLES.delete(e)):n.apply(this,[e])}}static async confirmOnShutdown(e,t){let i=e.get(C.IDialogService),o=e.get(W.IConfigurationService),r=t===I.ShutdownReason.QUIT?p.isMacintosh?(0,v.localize)(3709,"Are you sure you want to quit?"):(0,v.localize)(3710,"Are you sure you want to exit?"):(0,v.localize)(3711,"Are you sure you want to close the window?"),s=t===I.ShutdownReason.QUIT?p.isMacintosh?(0,v.localize)(3712,"&&Quit"):(0,v.localize)(3713,"&&Exit"):(0,v.localize)(3714,"&&Close Window"),n=await i.confirm({message:r,primaryButton:s,checkbox:{label:(0,v.localize)(3715,"Do not ask me again")}});return n.confirmed&&n.checkboxChecked&&await o.updateValue("window.confirmBeforeClose","never"),n.confirmed}registerFullScreenListeners(e){this._register(this.hostService.onDidChangeFullScreen(({windowId:t,fullscreen:i})=>{if(t===e){let t=(0,r.getWindowById)(e);t&&(0,o.setFullscreen)(i,t.window)}}))}registerContextMenuListeners(e){if(e!==A.mainWindow)return;let t=e=>this.layoutService.activeContainer.classList.toggle("context-menu-visible",e);this._register(this.contextMenuService.onDidShowContextMenu(()=>t(!0))),this._register(this.contextMenuService.onDidHideContextMenu(()=>t(!1)))}};H=t=(0,i.__decorate)([(0,i.__param)(2,T.IHostService),(0,i.__param)(3,z.IWorkbenchEnvironmentService),(0,i.__param)(4,U.IContextMenuService),(0,i.__param)(5,E.IWorkbenchLayoutService)],H);let $=class extends H{constructor(e,t,i,o,r,s,n,a,d,l){super(A.mainWindow,void 0,d,s,l,n),this.openerService=e,this.lifecycleService=t,this.dialogService=i,this.labelService=o,this.productService=r,this.browserEnvironmentService=s,this.instantiationService=a,this.registerListeners(),this.create()}registerListeners(){this._register(this.lifecycleService.onWillShutdown(()=>this.onWillShutdown()));let e=p.isIOS&&A.mainWindow.visualViewport?A.mainWindow.visualViewport:A.mainWindow;this._register((0,r.addDisposableListener)(e,r.EventType.RESIZE,()=>{this.layoutService.layout(),p.isIOS&&A.mainWindow.scrollTo(0,0)})),this._register((0,r.addDisposableListener)(this.layoutService.mainContainer,r.EventType.WHEEL,e=>e.preventDefault(),{passive:!1})),this._register((0,r.addDisposableListener)(this.layoutService.mainContainer,r.EventType.CONTEXT_MENU,e=>r.EventHelper.stop(e,!0))),this._register((0,r.addDisposableListener)(this.layoutService.mainContainer,r.EventType.DROP,e=>r.EventHelper.stop(e,!0)))}onWillShutdown(){c.Event.toPromise(c.Event.any(c.Event.once(new s.DomEmitter(A.mainWindow.document.body,r.EventType.KEY_DOWN,!0).event),c.Event.once(new s.DomEmitter(A.mainWindow.document.body,r.EventType.MOUSE_DOWN,!0).event))).then(async()=>{await (0,l.timeout)(3e3),await this.dialogService.prompt({type:g.default.Error,message:(0,v.localize)(3716,"An unexpected error occurred that requires a reload of this page."),detail:(0,v.localize)(3717,"The workbench was unexpectedly disposed while running."),buttons:[{label:(0,v.localize)(3718,"&&Reload"),run:()=>A.mainWindow.location.reload()}]})})}create(){this.setupOpenHandlers(),this.registerLabelFormatters(),this.registerCommands(),this.setupDriver()}setupDriver(){var e;this.environmentService.enableSmokeTestDriver&&(e=this.instantiationService,Object.assign(A.mainWindow,{driver:e.createInstance(G)}))}setupOpenHandlers(){this.openerService.setDefaultExternalOpener({openExternal:async e=>{let t=!1;if(this.browserEnvironmentService.options?.openerAllowedExternalUrlPrefixes){for(let i of this.browserEnvironmentService.options.openerAllowedExternalUrlPrefixes)if(e.startsWith(i)){t=!0;break}}if((0,u.matchesScheme)(e,u.Schemas.http)||(0,u.matchesScheme)(e,u.Schemas.https))o.isSafari?(0,r.windowOpenWithSuccess)(e,!t)||await this.dialogService.prompt({type:g.default.Warning,message:(0,v.localize)(3719,"The browser blocked opening a new tab or window. Press 'Retry' to try again."),custom:{markdownDetails:[{markdown:new B.MarkdownString((0,v.localize)(3720,"Please allow pop-ups for this website in your [browser settings]({0}).","https://aka.ms/allow-vscode-popup"),!0)}]},buttons:[{label:(0,v.localize)(3721,"&&Retry"),run:()=>t?(0,r.windowOpenPopup)(e):(0,r.windowOpenNoOpener)(e)}],cancelButton:!0}):t?(0,r.windowOpenPopup)(e):(0,r.windowOpenNoOpener)(e);else{let t=()=>{this.lifecycleService.withExpectedShutdown({disableShutdownHandling:!0},()=>A.mainWindow.location.href=e)};t();let i=async()=>{let e,{downloadUrl:o}=this.productService,r=[{label:(0,v.localize)(3722,"&&Try Again"),run:()=>t()}];void 0!==o?(e=(0,v.localize)(3723,"We launched {0} on your computer.\n\nIf {1} did not launch, try again or install it below.",this.productService.nameLong,this.productService.nameLong),r.push({label:(0,v.localize)(3724,"&&Install"),run:async()=>{await this.openerService.open(m.URI.parse(o)),i()}})):e=(0,v.localize)(3725,"We launched {0} on your computer.\n\nIf {1} did not launch, try again below.",this.productService.nameLong,this.productService.nameLong),await this.hostService.withExpectedShutdown(()=>this.dialogService.prompt({type:g.default.Info,message:(0,v.localize)(3726,"All done. You can close this tab now."),detail:e,buttons:r,cancelButton:!0}))};(0,u.matchesScheme)(e,this.productService.urlProtocol)&&await i()}return!0}})}registerLabelFormatters(){this._register(this.labelService.registerFormatter({scheme:u.Schemas.vscodeUserData,priority:!0,formatting:{label:"(Settings) ${path}",separator:"/"}}))}registerCommands(){y.CommandsRegistry.registerCommand("workbench.experimental.requestUsbDevice",async(e,t)=>n(t)),y.CommandsRegistry.registerCommand("workbench.experimental.requestSerialPort",async(e,t)=>a(t)),y.CommandsRegistry.registerCommand("workbench.experimental.requestHidDevice",async(e,t)=>d(t))}};$=(0,i.__decorate)([(0,i.__param)(0,f.IOpenerService),(0,i.__param)(1,D.ILifecycleService),(0,i.__param)(2,C.IDialogService),(0,i.__param)(3,w.ILabelService),(0,i.__param)(4,S.IProductService),(0,i.__param)(5,_.IBrowserWorkbenchEnvironmentService),(0,i.__param)(6,E.IWorkbenchLayoutService),(0,i.__param)(7,b.IInstantiationService),(0,i.__param)(8,T.IHostService),(0,i.__param)(9,U.IContextMenuService)],$),e.s(["BaseWindow",0,H,"BrowserWindow",0,$],377882)},211971,434566,951264,e=>{"use strict";var t,i,o,r,s,n,a,d,l,c,h,u,p=e.i(281482),g=e.i(526097),m=e.i(650289),v=e.i(322193),y=e.i(915454),C=e.i(850887),b=e.i(842577),w=e.i(865562),f=e.i(590746),S=e.i(781808),_=e.i(292608),E=e.i(92835),I=e.i(83823),D=e.i(932956);class T{static _readModifiers(e){let t,i;e=e.toLowerCase().trim();let o=!1,r=!1,s=!1,n=!1;do t=!1,/^ctrl(\+|\-)/.test(e)&&(o=!0,e=e.substr(5),t=!0),/^shift(\+|\-)/.test(e)&&(r=!0,e=e.substr(6),t=!0),/^alt(\+|\-)/.test(e)&&(s=!0,e=e.substr(4),t=!0),/^meta(\+|\-)/.test(e)&&(n=!0,e=e.substr(5),t=!0),/^win(\+|\-)/.test(e)&&(n=!0,e=e.substr(4),t=!0),/^cmd(\+|\-)/.test(e)&&(n=!0,e=e.substr(4),t=!0);while(t)let a=e.indexOf(" ");return a>0?(i=e.substring(0,a),e=e.substring(a)):(i=e,e=""),{remains:e,ctrl:o,shift:r,alt:s,meta:n,key:i}}static parseChord(e){let t=this._readModifiers(e),i=t.key.match(/^\[([^\]]+)\]$/);if(i){let e=i[1],o=I.ScanCodeUtils.lowerCaseToEnum(e);return[new D.ScanCodeChord(t.ctrl,t.shift,t.alt,t.meta,o),t.remains]}let o=I.KeyCodeUtils.fromUserSettings(t.key);return[new D.KeyCodeChord(t.ctrl,t.shift,t.alt,t.meta,o),t.remains]}static parseKeybinding(e){let t;if(!e)return null;let i=[];for(;e.length>0;)[t,e]=this.parseChord(e),i.push(t);return i.length>0?new D.Keybinding(i):null}}var A=e.i(611130),x=e.i(107700),R=e.i(354244),k=e.i(693162),M=e.i(700820),L=e.i(686380),O=e.i(318581),P=e.i(846960),V=e.i(568101),K=e.i(9753),N=e.i(652731),G=e.i(553638);e.i(157255);var F=e.i(4160),W=e.i(390095),z=e.i(488259),B=e.i(899890),U=e.i(718596),H=e.i(261187),$=e.i(317679),q=e.i(853457),Y=e.i(975445),j=e.i(621826),X=e.i(536766),J=e.i(474320),Z=e.i(454514),Q=e.i(693205),ee=e.i(425024),et=A,ei=e.i(536367),eo=e.i(774260),er=e.i(888961),es=e.i(595996),en=e.i(399119),ea=e.i(84513);let ed=[{key:"commandPalette",id:L.MenuId.CommandPalette,description:(0,m.localize)(13586,"The Command Palette"),supportsSubmenus:!1},{key:"touchBar",id:L.MenuId.TouchBarContext,description:(0,m.localize)(13587,"The touch bar (macOS only)"),supportsSubmenus:!1},{key:"editor/title",id:L.MenuId.EditorTitle,description:(0,m.localize)(13588,"The editor title menu")},{key:"editor/title/run",id:L.MenuId.EditorTitleRun,description:(0,m.localize)(13589,"Run submenu inside the editor title menu")},{key:"editor/context",id:L.MenuId.EditorContext,description:(0,m.localize)(13590,"The editor context menu")},{key:"editor/context/copy",id:L.MenuId.EditorContextCopy,description:(0,m.localize)(13591,"'Copy as' submenu in the editor context menu")},{key:"editor/context/share",id:L.MenuId.EditorContextShare,description:(0,m.localize)(13592,"'Share' submenu in the editor context menu"),proposed:"contribShareMenu"},{key:"explorer/context",id:L.MenuId.ExplorerContext,description:(0,m.localize)(13593,"The file explorer context menu")},{key:"explorer/context/share",id:L.MenuId.ExplorerContextShare,description:(0,m.localize)(13594,"'Share' submenu in the file explorer context menu"),proposed:"contribShareMenu"},{key:"editor/title/context",id:L.MenuId.EditorTitleContext,description:(0,m.localize)(13595,"The editor tabs context menu")},{key:"editor/title/context/share",id:L.MenuId.EditorTitleContextShare,description:(0,m.localize)(13596,"'Share' submenu inside the editor title context menu"),proposed:"contribShareMenu"},{key:"debug/callstack/context",id:L.MenuId.DebugCallStackContext,description:(0,m.localize)(13597,"The debug callstack view context menu")},{key:"debug/variables/context",id:L.MenuId.DebugVariablesContext,description:(0,m.localize)(13598,"The debug variables view context menu")},{key:"debug/watch/context",id:L.MenuId.DebugWatchContext,description:(0,m.localize)(13599,"The debug watch view context menu")},{key:"debug/toolBar",id:L.MenuId.DebugToolBar,description:(0,m.localize)(13600,"The debug toolbar menu")},{key:"debug/createConfiguration",id:L.MenuId.DebugCreateConfiguration,proposed:"contribDebugCreateConfiguration",description:(0,m.localize)(13601,"The debug create configuration menu")},{key:"notebook/variables/context",id:L.MenuId.NotebookVariablesContext,description:(0,m.localize)(13602,"The notebook variables view context menu")},{key:"menuBar/home",id:L.MenuId.MenubarHomeMenu,description:(0,m.localize)(13603,"The home indicator context menu (web only)"),proposed:"contribMenuBarHome",supportsSubmenus:!1},{key:"menuBar/edit/copy",id:L.MenuId.MenubarCopy,description:(0,m.localize)(13604,"'Copy as' submenu in the top level Edit menu")},{key:"scm/title",id:L.MenuId.SCMTitle,description:(0,m.localize)(13605,"The Source Control title menu")},{key:"scm/sourceControl",id:L.MenuId.SCMSourceControl,description:(0,m.localize)(13606,"The Source Control menu")},{key:"scm/repositories/title",id:L.MenuId.SCMSourceControlTitle,description:(0,m.localize)(13607,"The Source Control Repositories title menu"),proposed:"contribSourceControlTitleMenu"},{key:"scm/repository",id:L.MenuId.SCMSourceControlInline,description:(0,m.localize)(13608,"The Source Control repository menu")},{key:"scm/resourceState/context",id:L.MenuId.SCMResourceContext,description:(0,m.localize)(13609,"The Source Control resource state context menu")},{key:"scm/resourceFolder/context",id:L.MenuId.SCMResourceFolderContext,description:(0,m.localize)(13610,"The Source Control resource folder context menu")},{key:"scm/resourceGroup/context",id:L.MenuId.SCMResourceGroupContext,description:(0,m.localize)(13611,"The Source Control resource group context menu")},{key:"scm/change/title",id:L.MenuId.SCMChangeContext,description:(0,m.localize)(13612,"The Source Control inline change menu")},{key:"scm/inputBox",id:L.MenuId.SCMInputBox,description:(0,m.localize)(13613,"The Source Control input box menu"),proposed:"contribSourceControlInputBoxMenu"},{key:"scm/history/title",id:L.MenuId.SCMHistoryTitle,description:(0,m.localize)(13614,"The Source Control History title menu"),proposed:"contribSourceControlHistoryTitleMenu"},{key:"scm/historyItem/context",id:L.MenuId.SCMHistoryItemContext,description:(0,m.localize)(13615,"The Source Control history item context menu"),proposed:"contribSourceControlHistoryItemMenu"},{key:"scm/historyItemRef/context",id:L.MenuId.SCMHistoryItemRefContext,description:(0,m.localize)(13616,"The Source Control history item reference context menu"),proposed:"contribSourceControlHistoryItemMenu"},{key:"scm/artifactGroup/context",id:L.MenuId.SCMArtifactGroupContext,description:(0,m.localize)(13617,"The Source Control artifact group context menu"),proposed:"contribSourceControlArtifactGroupMenu"},{key:"scm/artifact/context",id:L.MenuId.SCMArtifactContext,description:(0,m.localize)(13618,"The Source Control artifact context menu"),proposed:"contribSourceControlArtifactMenu"},{key:"statusBar/remoteIndicator",id:L.MenuId.StatusBarRemoteIndicatorMenu,description:(0,m.localize)(13619,"The remote indicator menu in the status bar"),supportsSubmenus:!1},{key:"terminal/context",id:L.MenuId.TerminalInstanceContext,description:(0,m.localize)(13620,"The terminal context menu")},{key:"terminal/title/context",id:L.MenuId.TerminalTabContext,description:(0,m.localize)(13621,"The terminal tabs context menu")},{key:"view/title",id:L.MenuId.ViewTitle,description:(0,m.localize)(13622,"The contributed view title menu")},{key:"viewContainer/title",id:L.MenuId.ViewContainerTitle,description:(0,m.localize)(13623,"The contributed view container title menu"),proposed:"contribViewContainerTitle"},{key:"view/item/context",id:L.MenuId.ViewItemContext,description:(0,m.localize)(13624,"The contributed view item context menu")},{key:"comments/comment/editorActions",id:L.MenuId.CommentEditorActions,description:(0,m.localize)(13625,"The contributed comment editor actions"),proposed:"contribCommentEditorActionsMenu"},{key:"comments/commentThread/title",id:L.MenuId.CommentThreadTitle,description:(0,m.localize)(13626,"The contributed comment thread title menu")},{key:"comments/commentThread/context",id:L.MenuId.CommentThreadActions,description:(0,m.localize)(13627,"The contributed comment thread context menu, rendered as buttons below the comment editor"),supportsSubmenus:!1},{key:"comments/commentThread/additionalActions",id:L.MenuId.CommentThreadAdditionalActions,description:(0,m.localize)(13627,"The contributed comment thread context menu, rendered as buttons below the comment editor"),supportsSubmenus:!0,proposed:"contribCommentThreadAdditionalMenu"},{key:"comments/commentThread/title/context",id:L.MenuId.CommentThreadTitleContext,description:(0,m.localize)(13628,"The contributed comment thread title's peek context menu, rendered as a right click menu on the comment thread's peek title."),proposed:"contribCommentPeekContext"},{key:"comments/comment/title",id:L.MenuId.CommentTitle,description:(0,m.localize)(13629,"The contributed comment title menu")},{key:"comments/comment/context",id:L.MenuId.CommentActions,description:(0,m.localize)(13630,"The contributed comment context menu, rendered as buttons below the comment editor"),supportsSubmenus:!1},{key:"comments/commentThread/comment/context",id:L.MenuId.CommentThreadCommentContext,description:(0,m.localize)(13631,"The contributed comment context menu, rendered as a right click menu on the an individual comment in the comment thread's peek view."),proposed:"contribCommentPeekContext"},{key:"commentsView/commentThread/context",id:L.MenuId.CommentsViewThreadActions,description:(0,m.localize)(13632,"The contributed comment thread context menu in the comments view"),proposed:"contribCommentsViewThreadMenus"},{key:"notebook/toolbar",id:L.MenuId.NotebookToolbar,description:(0,m.localize)(13633,"The contributed notebook toolbar menu")},{key:"notebook/kernelSource",id:L.MenuId.NotebookKernelSource,description:(0,m.localize)(13634,"The contributed notebook kernel sources menu"),proposed:"notebookKernelSource"},{key:"notebook/cell/title",id:L.MenuId.NotebookCellTitle,description:(0,m.localize)(13635,"The contributed notebook cell title menu")},{key:"notebook/cell/execute",id:L.MenuId.NotebookCellExecute,description:(0,m.localize)(13636,"The contributed notebook cell execution menu")},{key:"interactive/toolbar",id:L.MenuId.InteractiveToolbar,description:(0,m.localize)(13637,"The contributed interactive toolbar menu")},{key:"interactive/cell/title",id:L.MenuId.InteractiveCellTitle,description:(0,m.localize)(13638,"The contributed interactive cell title menu")},{key:"issue/reporter",id:L.MenuId.IssueReporter,description:(0,m.localize)(13639,"The contributed issue reporter menu")},{key:"testing/item/context",id:L.MenuId.TestItem,description:(0,m.localize)(13640,"The contributed test item menu")},{key:"testing/item/gutter",id:L.MenuId.TestItemGutter,description:(0,m.localize)(13641,"The menu for a gutter decoration for a test item")},{key:"testing/profiles/context",id:L.MenuId.TestProfilesContext,description:(0,m.localize)(13642,"The menu for configuring testing profiles.")},{key:"testing/item/result",id:L.MenuId.TestPeekElement,description:(0,m.localize)(13643,"The menu for an item in the Test Results view or peek.")},{key:"testing/message/context",id:L.MenuId.TestMessageContext,description:(0,m.localize)(13644,"A prominent button overlaying editor content where the message is displayed")},{key:"testing/message/content",id:L.MenuId.TestMessageContent,description:(0,m.localize)(13645,"Context menu for the message in the results tree")},{key:"extension/context",id:L.MenuId.ExtensionContext,description:(0,m.localize)(13646,"The extension context menu")},{key:"timeline/title",id:L.MenuId.TimelineTitle,description:(0,m.localize)(13647,"The Timeline view title menu")},{key:"timeline/item/context",id:L.MenuId.TimelineItemContext,description:(0,m.localize)(13648,"The Timeline view item context menu")},{key:"ports/item/context",id:L.MenuId.TunnelContext,description:(0,m.localize)(13649,"The Ports view item context menu")},{key:"ports/item/origin/inline",id:L.MenuId.TunnelOriginInline,description:(0,m.localize)(13650,"The Ports view item origin inline menu")},{key:"ports/item/port/inline",id:L.MenuId.TunnelPortInline,description:(0,m.localize)(13651,"The Ports view item port inline menu")},{key:"file/newFile",id:L.MenuId.NewFile,description:(0,m.localize)(13652,"The 'New File...' quick pick, shown on welcome page and File menu."),supportsSubmenus:!1},{key:"webview/context",id:L.MenuId.WebviewContext,description:(0,m.localize)(13653,"The webview context menu")},{key:"file/share",id:L.MenuId.MenubarShare,description:(0,m.localize)(13654,"Share submenu shown in the top level File menu."),proposed:"contribShareMenu"},{key:"editor/inlineCompletions/actions",id:L.MenuId.InlineCompletionsActions,description:(0,m.localize)(13655,"The actions shown when hovering on an inline completion"),supportsSubmenus:!1,proposed:"inlineCompletionsAdditions"},{key:"editor/content",id:L.MenuId.EditorContent,description:(0,m.localize)(13656,"The prominent button in an editor, overlays its content"),proposed:"contribEditorContentMenu"},{key:"editor/lineNumber/context",id:L.MenuId.EditorLineNumberContext,description:(0,m.localize)(13657,"The contributed editor line number context menu")},{key:"mergeEditor/result/title",id:L.MenuId.MergeInputResultToolbar,description:(0,m.localize)(13658,"The result toolbar of the merge editor"),proposed:"contribMergeEditorMenus"},{key:"multiDiffEditor/content",id:L.MenuId.MultiDiffEditorContent,description:(0,m.localize)(13659,"A prominent button overlaying the multi diff editor"),proposed:"contribEditorContentMenu"},{key:"multiDiffEditor/resource/title",id:L.MenuId.MultiDiffEditorFileToolbar,description:(0,m.localize)(13660,"The resource toolbar in the multi diff editor"),proposed:"contribMultiDiffEditorMenus"},{key:"diffEditor/gutter/hunk",id:L.MenuId.DiffEditorHunkToolbar,description:(0,m.localize)(13661,"The gutter toolbar in the diff editor"),proposed:"contribDiffEditorGutterToolBarMenus"},{key:"diffEditor/gutter/selection",id:L.MenuId.DiffEditorSelectionToolbar,description:(0,m.localize)(13661,"The gutter toolbar in the diff editor"),proposed:"contribDiffEditorGutterToolBarMenus"},{key:"searchPanel/aiResults/commands",id:L.MenuId.SearchActionMenu,description:(0,m.localize)(13662,"The commands that will contribute to the menu rendered as buttons next to the AI search title")},{key:"editor/context/chat",id:L.MenuId.ChatTextEditorMenu,description:(0,m.localize)(13663,"The Chat submenu in the text editor context menu."),supportsSubmenus:!1,proposed:"chatParticipantPrivate"},{key:"chat/input/editing/sessionToolbar",id:L.MenuId.ChatEditingSessionChangesToolbar,description:(0,m.localize)(13664,"The Chat Editing widget toolbar menu for session changes."),proposed:"chatSessionsProvider"},{key:"chat/chatSessions",id:L.MenuId.AgentSessionsContext,description:(0,m.localize)(13665,"The Chat Sessions menu."),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chatSessions/newSession",id:L.MenuId.AgentSessionsCreateSubMenu,description:(0,m.localize)(13666,"Menu for new chat sessions."),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chat/multiDiff/context",id:L.MenuId.ChatMultiDiffContext,description:(0,m.localize)(13667,"The Chat Multi-Diff context menu."),supportsSubmenus:!1,proposed:"chatSessionsProvider"}];!function(e){function t(e){return"string"==typeof e.command}function i(e,t){return"string"!=typeof e.command?(t.error((0,m.localize)(13668,"property `{0}` is mandatory and must be of type `string`","command")),!1):e.alt&&"string"!=typeof e.alt?(t.error((0,m.localize)(13669,"property `{0}` can be omitted or must be of type `string`","alt")),!1):e.when&&"string"!=typeof e.when?(t.error((0,m.localize)(13669,"property `{0}` can be omitted or must be of type `string`","when")),!1):!e.group||"string"==typeof e.group||(t.error((0,m.localize)(13669,"property `{0}` can be omitted or must be of type `string`","group")),!1)}function o(e,t){return"string"!=typeof e.submenu?(t.error((0,m.localize)(13668,"property `{0}` is mandatory and must be of type `string`","submenu")),!1):e.when&&"string"!=typeof e.when?(t.error((0,m.localize)(13669,"property `{0}` can be omitted or must be of type `string`","when")),!1):!e.group||"string"==typeof e.group||(t.error((0,m.localize)(13669,"property `{0}` can be omitted or must be of type `string`","group")),!1)}e.isMenuItem=t,e.isValidMenuItem=i,e.isValidSubmenuItem=o,e.isValidItems=function(e,r){if(!Array.isArray(e))return r.error((0,m.localize)(13670,"submenu items must be an array")),!1;for(let s of e)if(t(s)){if(!i(s,r))return!1}else if(!o(s,r))return!1;return!0},e.isValidSubmenu=function(e,t){return"object"!=typeof e?(t.error((0,m.localize)(13671,"submenu items must be an object")),!1):"string"!=typeof e.id?(t.error((0,m.localize)(13668,"property `{0}` is mandatory and must be of type `string`","id")),!1):"string"==typeof e.label||(t.error((0,m.localize)(13668,"property `{0}` is mandatory and must be of type `string`","label")),!1)};let r={type:"object",required:["command"],properties:{command:{description:(0,m.localize)(13672,"Identifier of the command to execute. The command must be declared in the 'commands'-section"),type:"string"},alt:{description:(0,m.localize)(13673,"Identifier of an alternative command to execute. The command must be declared in the 'commands'-section"),type:"string"},when:{description:(0,m.localize)(13674,"Condition which must be true to show this item"),type:"string"},group:{description:(0,m.localize)(13675,"Group into which this item belongs"),type:"string"}}},s={type:"object",required:["submenu"],properties:{submenu:{description:(0,m.localize)(13676,"Identifier of the submenu to display in this item."),type:"string"},when:{description:(0,m.localize)(13674,"Condition which must be true to show this item"),type:"string"},group:{description:(0,m.localize)(13675,"Group into which this item belongs"),type:"string"}}},n={type:"object",required:["id","label"],properties:{id:{description:(0,m.localize)(13677,"Identifier of the menu to display as a submenu."),type:"string"},label:{description:(0,m.localize)(13678,"The label of the menu item which leads to this submenu."),type:"string"},icon:{description:(0,m.localize)(13679,'(Optional) Icon which is used to represent the submenu in the UI. Either a file path, an object with file paths for dark and light themes, or a theme icon references, like "\\$(zap)"'),anyOf:[{type:"string"},{type:"object",properties:{light:{description:(0,m.localize)(13680,"Icon path when a light theme is used"),type:"string"},dark:{description:(0,m.localize)(13681,"Icon path when a dark theme is used"),type:"string"}}}]}}};function a(e,t,i){return void 0===e?(t.error((0,m.localize)(13687,"property `{0}` is mandatory and must be of type `string` or `object`",i)),!1):"string"==typeof e&&(0,Q.isFalsyOrWhitespace)(e)?(t.error((0,m.localize)(13668,"property `{0}` is mandatory and must be of type `string`",i)),!1):!("string"!=typeof e&&((0,Q.isFalsyOrWhitespace)(e.original)||(0,Q.isFalsyOrWhitespace)(e.value)))||(t.error((0,m.localize)(13688,"properties `{0}` and `{1}` are mandatory and must be of type `string`",`${i}.value`,`${i}.original`)),!1)}e.menusContribution={description:(0,m.localize)(13682,"Contributes menu items to the editor"),type:"object",properties:(0,Z.index)(ed,e=>e.key,e=>({markdownDescription:e.proposed?(0,m.localize)(13683,'Proposed API, requires `enabledApiProposal: ["{0}"]` - {1}',e.proposed,e.description):e.description,type:"array",items:!1===e.supportsSubmenus?r:{oneOf:[r,s]}})),additionalProperties:{description:"Submenu",type:"array",items:{oneOf:[r,s]}}},e.submenusContribution={description:(0,m.localize)(13684,"Contributes submenu items to the editor"),type:"array",items:n},e.isValidCommand=function(e,t){var i,o;return e?(0,Q.isFalsyOrWhitespace)(e.command)?(t.error((0,m.localize)(13668,"property `{0}` is mandatory and must be of type `string`","command")),!1):!!a(e.title,t,"title")&&(!e.shortTitle||!!a(e.shortTitle,t,"shortTitle"))&&(e.enablement&&"string"!=typeof e.enablement?(t.error((0,m.localize)(13669,"property `{0}` can be omitted or must be of type `string`","precondition")),!1):(!e.category||!!a(e.category,t,"category"))&&(i=e.icon,o=t,void 0===i||"string"==typeof i||"string"==typeof i.dark&&"string"==typeof i.light||(o.error((0,m.localize)(13686,"property `icon` can be omitted or must be either a string or a literal like `{dark, light}`")),!1))):(t.error((0,m.localize)(13685,"expected non-empty value.")),!1)};let d={type:"object",required:["command","title"],properties:{command:{description:(0,m.localize)(13689,"Identifier of the command to execute"),type:"string"},title:{description:(0,m.localize)(13690,"Title by which the command is represented in the UI"),type:"string"},shortTitle:{markdownDescription:(0,m.localize)(13691,"(Optional) Short title by which the command is represented in the UI. Menus pick either `title` or `shortTitle` depending on the context in which they show commands."),type:"string"},category:{description:(0,m.localize)(13692,"(Optional) Category string by which the command is grouped in the UI"),type:"string"},enablement:{description:(0,m.localize)(13693,"(Optional) Condition which must be true to enable the command in the UI (menu and keybindings). Does not prevent executing the command by other means, like the `executeCommand`-api."),type:"string"},icon:{description:(0,m.localize)(13694,'(Optional) Icon which is used to represent the command in the UI. Either a file path, an object with file paths for dark and light themes, or a theme icon references, like "\\$(zap)"'),anyOf:[{type:"string"},{type:"object",properties:{light:{description:(0,m.localize)(13695,"Icon path when a light theme is used"),type:"string"},dark:{description:(0,m.localize)(13696,"Icon path when a dark theme is used"),type:"string"}}}]}}};e.commandsContribution={description:(0,m.localize)(13697,"Contributes commands to the command palette."),oneOf:[d,{type:"array",items:d}]}}(r||(r={}));let el=new et.DisposableStore,ec=ee.ExtensionsRegistry.registerExtensionPoint({extensionPoint:"commands",jsonSchema:r.commandsContribution,activationEventsGenerator:function*(e){for(let t of e)t.command&&(yield`onCommand:${t.command}`)}});ec.setHandler(e=>{function t(e,t){let i;if(!r.isValidCommand(e,t.collector))return;let{icon:o,enablement:s,category:n,title:a,shortTitle:d,command:l}=e;o&&(i="string"==typeof o?ei.ThemeIcon.fromString(o)??{dark:(0,k.joinPath)(t.description.extensionLocation,o),light:(0,k.joinPath)(t.description.extensionLocation,o)}:{dark:(0,k.joinPath)(t.description.extensionLocation,o.dark),light:(0,k.joinPath)(t.description.extensionLocation,o.light)});let c=L.MenuRegistry.getCommand(l);c&&(c.source?t.collector.info((0,m.localize)(13698,"Command `{0}` already registered by {1} ({2})",e.command,c.source.title,c.source.id)):t.collector.info((0,m.localize)(13699,"Command `{0}` already registered",e.command))),el.add(L.MenuRegistry.addCommand({id:l,title:a,source:{id:t.description.identifier.value,title:t.description.displayName??t.description.name},shortTitle:d,tooltip:a,category:n,precondition:V.ContextKeyExpr.deserialize(s),icon:i}))}for(let i of(el.clear(),e)){let{value:e}=i;if(Array.isArray(e))for(let o of e)t(o,i);else t(e,i)}});let eh=new Map,eu=ee.ExtensionsRegistry.registerExtensionPoint({extensionPoint:"submenus",jsonSchema:r.submenusContribution});eu.setHandler(e=>{for(let t of(eh.clear(),e)){let{value:e,collector:i}=t;for(let[,o]of Object.entries(e)){let e;if(!r.isValidSubmenu(o,i))continue;if(!o.id){i.warn((0,m.localize)(13700,"`{0}` is not a valid submenu identifier",o.id));continue}if(eh.has(o.id)){i.info((0,m.localize)(13701,"The `{0}` submenu was already previously registered.",o.id));continue}if(!o.label){i.warn((0,m.localize)(13702,"`{0}` is not a valid submenu label",o.label));continue}o.icon&&(e="string"==typeof o.icon?ei.ThemeIcon.fromString(o.icon)||{dark:(0,k.joinPath)(t.description.extensionLocation,o.icon)}:{dark:(0,k.joinPath)(t.description.extensionLocation,o.icon.dark),light:(0,k.joinPath)(t.description.extensionLocation,o.icon.light)});let s={id:L.MenuId.for(`api:${o.id}`),label:o.label,icon:e};eh.set(o.id,s)}}});let ep=new Map(ed.map(e=>[e.key,e])),eg=new et.DisposableStore,em=new Map;ee.ExtensionsRegistry.registerExtensionPoint({extensionPoint:"menus",jsonSchema:r.menusContribution,deps:[eu]}).setHandler(e=>{for(let t of(eg.clear(),em.clear(),e)){let{value:e,collector:i}=t;for(let o of Object.entries(e)){if(!r.isValidItems(o[1],i))continue;let e=ep.get(o[0]);if(!e){let t=eh.get(o[0]);t&&(e={key:o[0],id:t.id,description:""})}if(e){if(e.proposed&&!(0,eo.isProposedApiEnabled)(t.description,e.proposed)){i.error((0,m.localize)(13703,"{0} is a proposed menu identifier. It requires 'package.json#enabledApiProposals: [\"{1}\"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api {2}",o[0],e.proposed,t.description.identifier.value));continue}for(let t of o[1]){let s;if(r.isMenuItem(t)){let e=L.MenuRegistry.getCommand(t.command),o=t.alt&&L.MenuRegistry.getCommand(t.alt)||void 0;if(!e){i.error((0,m.localize)(13704,"Menu item references a command `{0}` which is not defined in the 'commands' section.",t.command));continue}t.alt&&!o&&i.warn((0,m.localize)(13705,"Menu item references an alt-command `{0}` which is not defined in the 'commands' section.",t.alt)),t.command===t.alt&&i.info((0,m.localize)(13706,"Menu item references the same command as default and alt-command")),s={command:e,alt:o,group:void 0,order:void 0,when:void 0}}else{if(!1===e.supportsSubmenus){i.error((0,m.localize)(13707,"Menu item references a submenu for a menu which doesn't have submenu support."));continue}let r=eh.get(t.submenu);if(!r){i.error((0,m.localize)(13708,"Menu item references a submenu `{0}` which is not defined in the 'submenus' section.",t.submenu));continue}let n=em.get(e.id.id);if(n||(n=new Set,em.set(e.id.id,n)),n.has(r.id.id)){i.warn((0,m.localize)(13709,"The `{0}` submenu was already contributed to the `{1}` menu.",t.submenu,o[0]));continue}n.add(r.id.id),s={submenu:r.id,icon:r.icon,title:r.label,group:void 0,order:void 0,when:void 0}}if(t.group){let e=t.group.lastIndexOf("@");e>0?(s.group=t.group.substr(0,e),s.order=Number(t.group.substr(e+1))||void 0):s.group=t.group}if(e.id===L.MenuId.ViewContainerTitle&&!t.when?.includes("viewContainer == workbench.view.debug")){i.error((0,m.localize)(13710,"The {0} menu contribution must check {1} in its {2} clause.","`viewContainer/title`","`viewContainer == workbench.view.debug`",'"when"'));continue}s.when=V.ContextKeyExpr.deserialize(t.when),eg.add(L.MenuRegistry.appendMenuItem(e.id,s))}}}}});let ev=class extends et.Disposable{constructor(e){super(),this._keybindingService=e,this.type="table"}shouldRender(e){return!!e.contributes?.commands}render(e){let t=(e.contributes?.commands||[]).map(e=>({id:e.command,title:e.title,keybindings:[],menus:[]})),i=(0,Z.index)(t,e=>e.id),o=e.contributes?.menus||{},r=(0,Z.index)(t,e=>e.id);if(o.commandPalette)for(let e of o.commandPalette)delete r[e.command];if(Object.keys(r).length)for(let e in o.commandPalette||(o.commandPalette=[]),r)o.commandPalette.push({command:e});for(let e in o)for(let r of o[e])if("false"!==r.when&&r.command){let o=i[r.command];o?o.menus.includes(e)||o.menus.push(e):(i[(o={id:r.command,title:"",keybindings:[],menus:[e]}).id]=o,t.push(o))}return((e.contributes?.keybindings?Array.isArray(e.contributes.keybindings)?e.contributes.keybindings:[e.contributes.keybindings]:[]).forEach(e=>{let o=this.resolveKeybinding(e);if(!o)return;let r=i[e.command];r?r.keybindings.push(o):(i[(r={id:e.command,title:"",keybindings:[o],menus:[]}).id]=r,t.push(r))}),t.length)?{data:{headers:[(0,m.localize)(13711,"ID"),(0,m.localize)(13712,"Title"),(0,m.localize)(13713,"Keyboard Shortcuts"),(0,m.localize)(13714,"Menu Contexts")],rows:t.sort((e,t)=>e.id.localeCompare(t.id)).map(e=>[new en.MarkdownString().appendMarkdown(`\`${e.id}\``),"string"==typeof e.title?e.title:e.title.value,e.keybindings,new en.MarkdownString().appendMarkdown(`${e.menus.sort((e,t)=>e.localeCompare(t)).map(e=>`\`${e}\``).join("&nbsp;")}`)])},dispose:()=>{}}:{data:{headers:[],rows:[]},dispose:()=>{}}}resolveKeybinding(e){let t;switch(es.platform){case"win32":t=e.win;break;case"linux":t=e.linux;break;case"darwin":t=e.mac}return this._keybindingService.resolveUserBinding(t??e.key)[0]}};ev=(0,p.__decorate)([(0,p.__param)(0,ea.IKeybindingService)],ev),j.Registry.as(er.Extensions.ExtensionFeaturesRegistry).registerExtensionFeature({id:"commands",label:(0,m.localize)(13715,"Commands"),access:{canToggle:!1},renderer:new g.SyncDescriptor(ev)});var ey=e.i(981399),eC=e.i(74304),eb=e.i(17607);class ew{static writeKeybindingItem(e,t){var i;if(!t.resolvedKeybinding)return;let o=JSON.stringify(t.resolvedKeybinding.getUserSettingsLabel());e.write(`{ "key": ${(i=o+",").length<25?i+Array(25-i.length).join(" "):i} "command": `);let r=t.when?JSON.stringify(t.when.serialize()):"",s=JSON.stringify(t.command);r.length>0?(e.write(`${s},`),e.writeLine(),e.write(` "when": ${r}`)):e.write(`${s}`),t.commandArgs&&(e.write(","),e.writeLine(),e.write(` "args": ${JSON.stringify(t.commandArgs)}`)),e.write(" }")}static readUserKeybindingItem(e){let t="key"in e&&"string"==typeof e.key?T.parseKeybinding(e.key):null,i="when"in e&&"string"==typeof e.when?V.ContextKeyExpr.deserialize(e.when):void 0;return{keybinding:t,command:"command"in e&&"string"==typeof e.command?e.command:null,commandArgs:"args"in e&&void 0!==e.args?e.args:void 0,when:i,_sourceKey:"key"in e&&"string"==typeof e.key?e.key:void 0}}}class ef{constructor(){this._lines=[],this._currentLine=""}write(e){this._currentLine+=e}writeLine(e=""){this._lines.push(this._currentLine+e),this._currentLine=""}toString(){return this.writeLine(),this._lines.join("\n")}}var eS=e.i(752453);let e_={type:"object",default:{command:"",key:""},required:["command","key"],properties:{command:{description:(0,m.localize)(14119,"Identifier of the command to run when keybinding is triggered."),type:"string"},args:{description:(0,m.localize)(14120,"Arguments to pass to the command to execute.")},key:{description:(0,m.localize)(14121,"Key or key sequence (separate keys with plus-sign and sequences with space, e.g. Ctrl+O and Ctrl+L L for a chord)."),type:"string"},mac:{description:(0,m.localize)(14122,"Mac specific key or key sequence."),type:"string"},linux:{description:(0,m.localize)(14123,"Linux specific key or key sequence."),type:"string"},win:{description:(0,m.localize)(14124,"Windows specific key or key sequence."),type:"string"},when:{description:(0,m.localize)(14125,"Condition when the key is active."),type:"string"}}},eE=ee.ExtensionsRegistry.registerExtensionPoint({extensionPoint:"keybindings",deps:[ec],jsonSchema:{description:(0,m.localize)(14126,"Contributes keybindings."),oneOf:[e_,{type:"array",items:e_}]}}),eI=[I.ScanCode.NumpadDivide,I.ScanCode.NumpadMultiply,I.ScanCode.NumpadSubtract,I.ScanCode.NumpadAdd,I.ScanCode.Numpad1,I.ScanCode.Numpad2,I.ScanCode.Numpad3,I.ScanCode.Numpad4,I.ScanCode.Numpad5,I.ScanCode.Numpad6,I.ScanCode.Numpad7,I.ScanCode.Numpad8,I.ScanCode.Numpad9,I.ScanCode.Numpad0,I.ScanCode.NumpadDecimal],eD=new Map;eD.set(I.ScanCode.Numpad1,I.KeyCode.Digit1),eD.set(I.ScanCode.Numpad2,I.KeyCode.Digit2),eD.set(I.ScanCode.Numpad3,I.KeyCode.Digit3),eD.set(I.ScanCode.Numpad4,I.KeyCode.Digit4),eD.set(I.ScanCode.Numpad5,I.KeyCode.Digit5),eD.set(I.ScanCode.Numpad6,I.KeyCode.Digit6),eD.set(I.ScanCode.Numpad7,I.KeyCode.Digit7),eD.set(I.ScanCode.Numpad8,I.KeyCode.Digit8),eD.set(I.ScanCode.Numpad9,I.KeyCode.Digit9),eD.set(I.ScanCode.Numpad0,I.KeyCode.Digit0);let eT=s=class extends W.AbstractKeybindingService{constructor(e,t,i,o,r,s,n,a,d,l,c){super(e,t,i,o,l),this.hostService=s,this.keyboardLayoutService=c,this._contributions=[],this.isComposingGlobalContextKey=e.createKey("isComposing",!1),this.kbsJsonSchema=new ex,this.updateKeybindingsJsonSchema(),this._keyboardMapper=this.keyboardLayoutService.getKeyboardMapper(),this._register(this.keyboardLayoutService.onDidChangeKeyboardLayout(()=>{this._keyboardMapper=this.keyboardLayoutService.getKeyboardMapper(),this.updateResolver()})),this._keybindingHoldMode=null,this._cachedResolver=null,this.userKeybindings=this._register(new eA(r,d,a,l)),this.userKeybindings.initialize().then(()=>{this.userKeybindings.keybindings.length&&this.updateResolver()}),this._register(this.userKeybindings.onDidChange(()=>{l.debug("User keybindings changed"),this.updateResolver()})),eE.setHandler(e=>{let t=[];for(let i of e)this._handleKeybindingsExtensionPointUser(i.description.identifier,i.description.isBuiltin,i.value,i.collector,t);U.KeybindingsRegistry.setExtensionKeybindings(t),this.updateResolver()}),this.updateKeybindingsJsonSchema(),this._register(n.onDidRegisterExtensions(()=>this.updateKeybindingsJsonSchema())),this._register(S.Event.runAndSubscribe(C.onDidRegisterWindow,({window:e,disposables:t})=>t.add(this._registerKeyListeners(e)),{window:w.mainWindow,disposables:this._store})),this._register((0,v.onDidChangeFullscreen)(e=>{e!==w.mainWindow.vscodeWindowId||y.BrowserFeatures.keyboard!==y.KeyboardSupport.None&&(this.lockKeyCodes((0,v.isFullscreen)(w.mainWindow)?["Escape"]:[]),this._cachedResolver=null,this._onDidUpdateKeybindings.fire())}))}lockKeyCodes(e){let t=w.mainWindow.navigator.keyboard;e.length>0?t?.lock(e):t?.unlock()}dispose(){this._contributions.forEach(e=>e.listener?.dispose()),this._contributions.length=0,super.dispose()}_registerKeyListeners(e){let t=new A.DisposableStore;return t.add((0,C.addDisposableListener)(e,C.EventType.KEY_DOWN,e=>{if(this._keybindingHoldMode)return;this.isComposingGlobalContextKey.set(e.isComposing);let t=new b.StandardKeyboardEvent(e);this._log(`/ Received keydown event - ${(0,b.printKeyboardEvent)(e)}`),this._log(`| Converted keydown event - ${(0,b.printStandardKeyboardEvent)(t)}`),this._dispatch(t,t.target)&&t.preventDefault(),this.isComposingGlobalContextKey.set(!1)})),t.add((0,C.addDisposableListener)(e,C.EventType.KEY_UP,e=>{this._resetKeybindingHoldMode(),this.isComposingGlobalContextKey.set(e.isComposing);let t=new b.StandardKeyboardEvent(e);this._singleModifierDispatch(t,t.target)&&t.preventDefault(),this.isComposingGlobalContextKey.set(!1)})),t}registerSchemaContribution(e){let t=e.onDidChange?.(()=>this.updateKeybindingsJsonSchema()),i={listener:t,contribution:e};return this._contributions.push(i),this.updateKeybindingsJsonSchema(),(0,A.toDisposable)(()=>{t?.dispose(),(0,Z.remove)(this._contributions,i),this.updateKeybindingsJsonSchema()})}updateKeybindingsJsonSchema(){this.kbsJsonSchema.updateSchema(this._contributions.flatMap(e=>e.contribution.getSchemaAdditions()))}_printKeybinding(e){return E.UserSettingsLabelProvider.toLabel(R.OS,e.chords,e=>e instanceof D.KeyCodeChord?I.KeyCodeUtils.toString(e.keyCode):I.ScanCodeUtils.toString(e.scanCode))||"[null]"}_printResolvedKeybinding(e){return e.getDispatchChords().map(e=>e||"[null]").join(" ")}_printResolvedKeybindings(e,t,i){let o=`${t.padStart(35," ")} => `;if(0===i.length)return void e.push(`${o}${"[NO BINDING]".padStart(35," ")}`);for(let t of i)e.push(`${o}${this._printResolvedKeybinding(t).padStart(35," ")}`)}_dumpResolveKeybindingDebugInfo(){let e=new Set,t=[];for(let i of(t.push("Default Resolved Keybindings (unique only):"),U.KeybindingsRegistry.getDefaultKeybindings())){if(!i.keybinding)continue;let o=this._printKeybinding(i.keybinding);if(e.has(o))continue;e.add(o);let r=this._keyboardMapper.resolveKeybinding(i.keybinding);this._printResolvedKeybindings(t,o,r)}for(let i of(t.push("User Resolved Keybindings (unique only):"),this.userKeybindings.keybindings)){if(!i.keybinding)continue;let o=i._sourceKey??"Impossible: missing source key, but has keybinding";if(e.has(o))continue;e.add(o);let r=this._keyboardMapper.resolveKeybinding(i.keybinding);this._printResolvedKeybindings(t,o,r)}return t.join("\n")}_dumpDebugInfo(){let e=JSON.stringify(this.keyboardLayoutService.getCurrentKeyboardLayout(),null," "),t=this._keyboardMapper.dumpDebugInfo(),i=this._dumpResolveKeybindingDebugInfo(),o=JSON.stringify(this.keyboardLayoutService.getRawKeyboardMapping(),null," ");return`Layout info:
128
+ ${e}
129
+
130
+ ${i}
131
+
132
+ ${t}
133
+
134
+ Raw mapping:
135
+ ${o}`}_dumpDebugInfoJSON(){return JSON.stringify({layout:this.keyboardLayoutService.getCurrentKeyboardLayout(),rawMapping:this.keyboardLayoutService.getRawKeyboardMapping()},null," ")}enableKeybindingHoldMode(e){if(this._currentlyDispatchingCommandId!==e)return;this._keybindingHoldMode=new f.DeferredPromise;let t=(0,C.trackFocus)((0,C.getWindow)(void 0)),i=t.onDidBlur(()=>this._resetKeybindingHoldMode());return this._keybindingHoldMode.p.finally(()=>{i.dispose(),t.dispose()}),this._log(`+ Enabled hold-mode for ${e}.`),this._keybindingHoldMode.p}_resetKeybindingHoldMode(){this._keybindingHoldMode&&(this._keybindingHoldMode?.complete(),this._keybindingHoldMode=null)}customKeybindingsCount(){return this.userKeybindings.keybindings.length}updateResolver(){this._cachedResolver=null,this._onDidUpdateKeybindings.fire()}getUserKeybindingItems(){return this._resolveUserKeybindingItems(this.userKeybindings.keybindings,!1)}_getResolver(){if(!this._cachedResolver){let e=this._resolveKeybindingItems(U.KeybindingsRegistry.getDefaultKeybindings(),!0),t=this.getUserKeybindingItems();this._cachedResolver=new B.KeybindingResolver(e,t,e=>this._log(e))}return this._cachedResolver}_documentHasFocus(){return this.hostService.hasFocus}_resolveKeybindingItems(e,t){let i=[],o=0;for(let r of e){let e=r.when||void 0,s=r.keybinding;if(s){if(this._assertBrowserConflicts(s))continue;let n=this._keyboardMapper.resolveKeybinding(s);for(let s=n.length-1;s>=0;s--){let a=n[s];i[o++]=new H.ResolvedKeybindingItem(a,r.command,r.commandArgs,e,t,r.extensionId,r.isBuiltinExtension)}}else i[o++]=new H.ResolvedKeybindingItem(void 0,r.command,r.commandArgs,e,t,r.extensionId,r.isBuiltinExtension)}return i}_resolveUserKeybindingItems(e,t){let i=[],o=0;for(let r of e){let e=r.when||void 0;if(r.keybinding)for(let s of this._keyboardMapper.resolveKeybinding(r.keybinding))i[o++]=new H.ResolvedKeybindingItem(s,r.command,r.commandArgs,e,t,null,!1);else i[o++]=new H.ResolvedKeybindingItem(void 0,r.command,r.commandArgs,e,t,null,!1)}return i}_assertBrowserConflicts(e){if(y.BrowserFeatures.keyboard===y.KeyboardSupport.Always||y.BrowserFeatures.keyboard===y.KeyboardSupport.FullScreen&&(0,v.isFullscreen)(w.mainWindow))return!1;for(let t of e.chords){if(!t.metaKey&&!t.altKey&&!t.ctrlKey&&!t.shiftKey)continue;let e=I.KeyMod.CtrlCmd|I.KeyMod.Alt|I.KeyMod.Shift,i=0;if(t.metaKey&&(i|=I.KeyMod.CtrlCmd),t.shiftKey&&(i|=I.KeyMod.Shift),t.altKey&&(i|=I.KeyMod.Alt),t.ctrlKey&&R.OS===R.OperatingSystem.Macintosh&&(i|=I.KeyMod.WinCtrl),(i&e)==(I.KeyMod.CtrlCmd|I.KeyMod.Alt)&&(t instanceof D.ScanCodeChord&&(t.scanCode===I.ScanCode.ArrowLeft||t.scanCode===I.ScanCode.ArrowRight)||t instanceof D.KeyCodeChord&&(t.keyCode===I.KeyCode.LeftArrow||t.keyCode===I.KeyCode.RightArrow))||(i&e)===I.KeyMod.CtrlCmd&&(t instanceof D.ScanCodeChord&&t.scanCode>=I.ScanCode.Digit1&&t.scanCode<=I.ScanCode.Digit0||t instanceof D.KeyCodeChord&&t.keyCode>=I.KeyCode.Digit0&&t.keyCode<=I.KeyCode.Digit9))return!0}return!1}resolveKeybinding(e){return this._keyboardMapper.resolveKeybinding(e)}resolveKeyboardEvent(e){return this.keyboardLayoutService.validateCurrentKeyboardMapping(e),this._keyboardMapper.resolveKeyboardEvent(e)}resolveUserBinding(e){let t=T.parseKeybinding(e);return t?this._keyboardMapper.resolveKeybinding(t):[]}_handleKeybindingsExtensionPointUser(e,t,i,o,r){if(Array.isArray(i))for(let s=0,n=i.length;s<n;s++)this._handleKeybinding(e,t,s+1,i[s],o,r);else this._handleKeybinding(e,t,1,i,o,r)}_handleKeybinding(e,t,i,o,r,s){let n=[];if(o?"string"!=typeof o.command?(n.push((0,m.localize)(14117,"property `{0}` is mandatory and must be of type `string`","command")),!1):o.key&&"string"!=typeof o.key?(n.push((0,m.localize)(14118,"property `{0}` can be omitted or must be of type `string`","key")),!1):o.when&&"string"!=typeof o.when?(n.push((0,m.localize)(14118,"property `{0}` can be omitted or must be of type `string`","when")),!1):o.mac&&"string"!=typeof o.mac?(n.push((0,m.localize)(14118,"property `{0}` can be omitted or must be of type `string`","mac")),!1):o.linux&&"string"!=typeof o.linux?(n.push((0,m.localize)(14118,"property `{0}` can be omitted or must be of type `string`","linux")),!1):!o.win||"string"==typeof o.win||(n.push((0,m.localize)(14118,"property `{0}` can be omitted or must be of type `string`","win")),!1):(n.push((0,m.localize)(14116,"expected non-empty value.")),!1)){let r=this._asCommandRule(e,t,i++,o);r&&s.push(r)}n.length>0&&r.error((0,m.localize)(14127,"Invalid `contributes.{0}`: {1}",eE.name,n.join("\n")))}static bindToCurrentPlatform(e,t,i,o){if(R.OS===R.OperatingSystem.Windows&&o){if(o)return o}else if(R.OS===R.OperatingSystem.Macintosh){if(t)return t}else if(i)return i;return e}_asCommandRule(e,t,i,o){let r,n,{command:a,args:d,when:l,key:c,mac:h,linux:u,win:p}=o,g=s.bindToCurrentPlatform(c,h,u,p);if(!g)return;r=t?U.KeybindingWeight.BuiltinExtension+i:U.KeybindingWeight.ExternalExtension+i;let m=L.MenuRegistry.getCommand(a),v=m&&m.precondition;return l&&v?n=V.ContextKeyExpr.and(v,V.ContextKeyExpr.deserialize(l)):l?n=V.ContextKeyExpr.deserialize(l):v&&(n=v),{id:a,args:d,when:n,weight:r,keybinding:T.parseKeybinding(g),extensionId:e.value,isBuiltinExtension:t}}getDefaultKeybindingsContent(){let e=this._getResolver(),t=e.getDefaultKeybindings(),i=e.getDefaultBoundCommands();return s._getDefaultKeybindings(t)+"\n\n"+s._getAllCommandsAsComment(i)}static _getDefaultKeybindings(e){let t=new ef;t.writeLine("[");let i=e.length-1;return e.forEach((e,o)=>{ew.writeKeybindingItem(t,e),o!==i?t.writeLine(","):t.writeLine()}),t.writeLine("]"),t.toString()}static _getAllCommandsAsComment(e){let t=(0,eS.getAllUnboundCommands)(e).sort().join("\n// - ");return"// "+(0,m.localize)(14128,"Here are other available commands: ")+"\n// - "+t}mightProducePrintableCharacter(e){if(e.ctrlKey||e.metaKey||e.altKey)return!1;let t=I.ScanCodeUtils.toEnum(e.code);if(-1!==eI.indexOf(t))return e.keyCode===I.IMMUTABLE_CODE_TO_KEY_CODE[t]||!!R.isMacintosh&&e.keyCode===eD.get(t);if(-1!==I.IMMUTABLE_CODE_TO_KEY_CODE[t])return!1;let i=this.keyboardLayoutService.getRawKeyboardMapping();if(!i)return!1;let o=i[e.code];return!(!o||!o.value||/\s/.test(o.value))}};eT=s=(0,p.__decorate)([(0,p.__param)(0,K.IContextKeyService),(0,p.__param)(1,P.ICommandService),(0,p.__param)(2,X.ITelemetryService),(0,p.__param)(3,Y.INotificationService),(0,p.__param)(4,eb.IUserDataProfileService),(0,p.__param)(5,eC.IHostService),(0,p.__param)(6,ey.IExtensionService),(0,p.__param)(7,G.IFileService),(0,p.__param)(8,J.IUriIdentityService),(0,p.__param)(9,q.ILogService),(0,p.__param)(10,$.IKeyboardLayoutService)],eT);class eA extends A.Disposable{get keybindings(){return this._keybindings}constructor(e,t,i,o){super(),this.userDataProfileService=e,this.uriIdentityService=t,this.fileService=i,this._rawKeybindings=[],this._keybindings=[],this.watchDisposables=this._register(new A.DisposableStore),this._onDidChange=this._register(new S.Emitter),this.onDidChange=this._onDidChange.event,this.watch(),this.reloadConfigurationScheduler=this._register(new f.RunOnceScheduler(()=>this.reload().then(e=>{e&&this._onDidChange.fire()}),50)),this._register(S.Event.filter(this.fileService.onDidFilesChange,e=>e.contains(this.userDataProfileService.currentProfile.keybindingsResource))(()=>{o.debug("Keybindings file changed"),this.reloadConfigurationScheduler.schedule()})),this._register(this.fileService.onDidRunOperation(e=>{e.operation===N.FileOperation.WRITE&&e.resource.toString()===this.userDataProfileService.currentProfile.keybindingsResource.toString()&&(o.debug("Keybindings file written"),this.reloadConfigurationScheduler.schedule())})),this._register(e.onDidChangeCurrentProfile(e=>{this.uriIdentityService.extUri.isEqual(e.previous.keybindingsResource,e.profile.keybindingsResource)||e.join(this.whenCurrentProfileChanged())}))}async whenCurrentProfileChanged(){this.watch(),this.reloadConfigurationScheduler.schedule()}watch(){this.watchDisposables.clear(),this.watchDisposables.add(this.fileService.watch((0,k.dirname)(this.userDataProfileService.currentProfile.keybindingsResource))),this.watchDisposables.add(this.fileService.watch(this.userDataProfileService.currentProfile.keybindingsResource))}async initialize(){await this.reload()}async reload(){let e=await this.readUserKeybindings();return!(0,x.equals)(this._rawKeybindings,e)&&(this._rawKeybindings=e,this._keybindings=this._rawKeybindings.map(e=>ew.readUserKeybindingItem(e)),!0)}async readUserKeybindings(){try{let e=await this.fileService.readFile(this.userDataProfileService.currentProfile.keybindingsResource),t=(0,_.parse)(e.value.toString());return Array.isArray(t)?t.filter(e=>e&&"object"==typeof e):[]}catch(e){return[]}}}class ex{static{this.schemaId="vscode://schemas/keybindings"}constructor(){this.commandsSchemas=[],this.commandsEnum=[],this.removalCommandsEnum=[],this.commandsEnumDescriptions=[],this.schema={id:ex.schemaId,type:"array",title:(0,m.localize)(14129,"Keybindings configuration"),allowTrailingCommas:!0,allowComments:!0,definitions:{editorGroupsSchema:{type:"array",items:{type:"object",properties:{groups:{$ref:"#/definitions/editorGroupsSchema",default:[{},{}]},size:{type:"number",default:.5}}}},commandNames:{type:"string",enum:this.commandsEnum,enumDescriptions:this.commandsEnumDescriptions,description:(0,m.localize)(14130,"Name of the command to execute")},commandType:{anyOf:[{$ref:"#/definitions/commandNames"},{type:"string",enum:this.removalCommandsEnum,enumDescriptions:this.commandsEnumDescriptions,description:(0,m.localize)(14131,"Name of the command to remove keyboard shortcut for")},{type:"string"}]},commandsSchemas:{allOf:this.commandsSchemas}},items:{required:["key"],type:"object",defaultSnippets:[{body:{key:"$1",command:"$2",when:"$3"}}],properties:{key:{type:"string",description:(0,m.localize)(14132,"Key or key sequence (separated by space)")},command:{anyOf:[{if:{type:"array"},then:{not:{type:"array"},errorMessage:(0,m.localize)(14133,"Incorrect type. Expected \"{0}\". The field 'command' does not support running multiple commands. Use command 'runCommands' to pass it multiple commands to run.","string")},else:{$ref:"#/definitions/commandType"}},{$ref:"#/definitions/commandType"}]},when:{type:"string",description:(0,m.localize)(14134,"Condition when the key is active.")},args:{description:(0,m.localize)(14135,"Arguments to pass to the command to execute.")}},$ref:"#/definitions/commandsSchemas"}},this.schemaRegistry=j.Registry.as(F.Extensions.JSONContribution),this.schemaRegistry.registerSchema(ex.schemaId,this.schema)}updateSchema(e){this.commandsSchemas.length=0,this.commandsEnum.length=0,this.removalCommandsEnum.length=0,this.commandsEnumDescriptions.length=0;let t=new Set,i=(e,i)=>{/^_/.test(e)||t.has(e)||(t.add(e),this.commandsEnum.push(e),this.commandsEnumDescriptions.push(void 0===i?"":(0,M.isLocalizedString)(i)?i.value:i),this.removalCommandsEnum.push(`-${e}`))};for(let[e,t]of O.CommandsRegistry.getCommands()){let o=t.metadata;if(i(e,o?.description??L.MenuRegistry.getCommand(e)?.title),!o||!o.args||1!==o.args.length||!o.args[0].schema)continue;let r=o.args[0].schema,s={if:{required:["command"],properties:{command:{const:e}}},then:{required:[].concat((void 0!==o.args[0].isOptional?!o.args[0].isOptional:Array.isArray(r.required)&&r.required.length>0)?["args"]:[]),properties:{args:r}}};this.commandsSchemas.push(s)}for(let e of L.MenuRegistry.getCommands().keys())i(e);this.commandsSchemas.push(...e),this.schemaRegistry.notifySchemaChanged(ex.schemaId)}}e.i(107043),e.i(991307);var eR=A;function ek(e){return e.name?e.name:e.id?e.id:e.layout}e.s(["areKeyboardLayoutsEqual",0,function(e,t){return!!e&&!!t&&(!!e.name&&!!t.name&&e.name===t.name||!!e.id&&!!t.id&&e.id===t.id||!!e.model&&!!t.model&&e.model===t.model&&e.layout===t.layout)},"getKeyboardLayoutId",0,ek,"parseKeyboardLayoutDescription",0,function(e){return e?e.name?{label:e.text,description:""}:e.id?e.localizedName?{label:e.localizedName,description:""}:/^com\.apple\.keylayout\./.test(e.id)?{label:e.id.replace(/^com\.apple\.keylayout\./,"").replace(/-/," "),description:""}:/^.*inputmethod\./.test(e.id)?{label:e.id.replace(/^.*inputmethod\./,"").replace(/[-\.]/," "),description:`Input Method (${e.lang})`}:{label:e.lang,description:""}:{label:e.layout,description:""}:{label:"",description:""}}],434566);class eM{constructor(e,t,i,o){this.layout=e,this.secondaryLayouts=t,this.mapping=function(e){let t={};for(let i in e){let o=e[i];if(o.length){let e=o[0],r=o[1],s=o[2],n=o[3],a=Number(o[4]),d=6===o.length?o[5]:void 0;t[i]={value:e,vkey:d,withShift:r,withAltGr:s,withShiftAltGr:n,valueIsDeadKey:(1&a)>0,withShiftIsDeadKey:(2&a)>0,withAltGrIsDeadKey:(4&a)>0,withShiftAltGrIsDeadKey:(8&a)>0}}else t[i]={value:"",valueIsDeadKey:!1,withShift:"",withShiftIsDeadKey:!1,withAltGr:"",withAltGrIsDeadKey:!1,withShiftAltGr:"",withShiftAltGrIsDeadKey:!1}}return t}(i),this.isUserKeyboardLayout=!!o,this.layout.isUserKeyboardLayout=!!o}static createKeyboardLayoutFromDebugInfo(e,t,i){let o=new eM(e,[],{},!0);return o.mapping=t,o}update(e){this.layout=e.layout,this.secondaryLayouts=e.secondaryLayouts,this.mapping=e.mapping,this.isUserKeyboardLayout=e.isUserKeyboardLayout,this.layout.isUserKeyboardLayout=e.isUserKeyboardLayout}getScore(e){let t=0;for(let i in e){if(R.isWindows&&("Backslash"===i||"KeyQ"===i)||R.isLinux&&("Backspace"===i||"Escape"===i))continue;let o=this.mapping[i];void 0===o&&(t-=1);let r=e[i];o&&r&&o.value!==r.value&&(t-=1)}return t}equal(e){return this.isUserKeyboardLayout===e.isUserKeyboardLayout&&ek(this.layout)===ek(e.layout)&&this.fuzzyEqual(e.mapping)}fuzzyEqual(e){for(let t in e){if(R.isWindows&&("Backslash"===t||"KeyQ"===t))continue;if(void 0===this.mapping[t])return!1;let i=this.mapping[t],o=e[t];if(i.value!==o.value)return!1}return!0}}var eL=e.i(2267);(t=n||(n={}))[t.Code=0]="Code",t[t.KeyCode=1]="KeyCode";let eO=j.Registry.as(eL.Extensions.Configuration),eP={id:"keyboard",order:15,type:"object",title:(0,m.localize)(1952,"Keyboard"),properties:{"keyboard.dispatch":{scope:eL.ConfigurationScope.APPLICATION,type:"string",enum:["code","keyCode"],default:"code",markdownDescription:(0,m.localize)(1953,"Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."),included:R.OS===R.OperatingSystem.Macintosh||R.OS===R.OperatingSystem.Linux},"keyboard.mapAltGrToCtrlAlt":{scope:eL.ConfigurationScope.APPLICATION,type:"boolean",default:!1,markdownDescription:(0,m.localize)(1954,"Controls if the AltGraph+ modifier should be treated as Ctrl+Alt+."),included:R.OS===R.OperatingSystem.Windows}}};eO.registerConfiguration(eP);class eV{constructor(e){this._actual=e,this._cache=new Map}dumpDebugInfo(){return this._actual.dumpDebugInfo()}resolveKeyboardEvent(e){return this._actual.resolveKeyboardEvent(e)}resolveKeybinding(e){let t=e.getHashCode(),i=this._cache.get(t);if(!i){let i=this._actual.resolveKeybinding(e);return this._cache.set(t,i),i}return i}}var eK=e.i(601293),eN=e.i(602019);class eG extends eN.BaseResolvedKeybinding{constructor(e,t){super(R.OperatingSystem.Windows,t),this._mapper=e}_getLabel(e){return e.isDuplicateModifierCase()?"":this._mapper.getUILabelForKeyCode(e.keyCode)}_getUSLabelForKeybinding(e){return e.isDuplicateModifierCase()?"":I.KeyCodeUtils.toString(e.keyCode)}getUSLabel(){return E.UILabelProvider.toLabel(this._os,this._chords,e=>this._getUSLabelForKeybinding(e))}_getAriaLabel(e){return e.isDuplicateModifierCase()?"":this._mapper.getAriaLabelForKeyCode(e.keyCode)}_getElectronAccelerator(e){return this._mapper.getElectronAcceleratorForKeyBinding(e)}_getUserSettingsLabel(e){if(e.isDuplicateModifierCase())return"";let t=this._mapper.getUserSettingsLabelForKeyCode(e.keyCode);return t?t.toLowerCase():t}_isWYSIWYG(e){return this.__isWYSIWYG(e.keyCode)}__isWYSIWYG(e){return e===I.KeyCode.LeftArrow||e===I.KeyCode.UpArrow||e===I.KeyCode.RightArrow||e===I.KeyCode.DownArrow||this._mapper.getAriaLabelForKeyCode(e)===this._mapper.getUserSettingsLabelForKeyCode(e)}_getChordDispatch(e){if(e.isModifierKey())return null;let t="";return e.ctrlKey&&(t+="ctrl+"),e.shiftKey&&(t+="shift+"),e.altKey&&(t+="alt+"),e.metaKey&&(t+="meta+"),t+=I.KeyCodeUtils.toString(e.keyCode)}_getSingleModifierChordDispatch(e){return e.keyCode!==I.KeyCode.Ctrl||e.shiftKey||e.altKey||e.metaKey?e.keyCode!==I.KeyCode.Shift||e.ctrlKey||e.altKey||e.metaKey?e.keyCode!==I.KeyCode.Alt||e.ctrlKey||e.shiftKey||e.metaKey?e.keyCode!==I.KeyCode.Meta||e.ctrlKey||e.shiftKey||e.altKey?null:"meta":"alt":"shift":"ctrl"}static getProducedCharCode(e,t){return t?e.ctrlKey&&e.shiftKey&&e.altKey?t.withShiftAltGr:e.ctrlKey&&e.altKey?t.withAltGr:e.shiftKey?t.withShift:t.value:null}static getProducedChar(e,t){let i=this.getProducedCharCode(e,t);return null===i||0===i.length?" --- ":" "+i+" "}}class eF{constructor(e,t,i){this._isUSStandard=e,this._mapAltGrToCtrlAlt=i,this._keyCodeToLabel=[],this._scanCodeToKeyCode=[],this._keyCodeToLabel=[],this._keyCodeExists=[],this._keyCodeToLabel[I.KeyCode.Unknown]=I.KeyCodeUtils.toString(I.KeyCode.Unknown);for(let e=I.ScanCode.None;e<I.ScanCode.MAX_VALUE;e++){const t=I.IMMUTABLE_CODE_TO_KEY_CODE[e];t!==I.KeyCode.DependsOnKbLayout&&(this._scanCodeToKeyCode[e]=t,this._keyCodeToLabel[t]=I.KeyCodeUtils.toString(t),this._keyCodeExists[t]=!0)}const o=[];let r=!1;for(const e in this._codeInfo=[],t)if(t.hasOwnProperty(e)){const i=I.ScanCodeUtils.toEnum(e);if(i===I.ScanCode.None)continue;const s=t[e],n=I.IMMUTABLE_CODE_TO_KEY_CODE[i];if(n!==I.KeyCode.DependsOnKbLayout){const e=I.NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE[s.vkey]||I.KeyCode.Unknown;if(e===I.KeyCode.Unknown||n===e||i!==I.ScanCode.NumpadComma)continue}const a=s.value,d=s.withShift,l=s.withAltGr,c=s.withShiftAltGr,h=I.NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE[s.vkey]||I.KeyCode.Unknown,u={scanCode:i,keyCode:h,value:a,withShift:d,withAltGr:l,withShiftAltGr:c};if(this._codeInfo[i]=u,this._scanCodeToKeyCode[i]=h,h===I.KeyCode.Unknown)continue;if(this._keyCodeExists[h]=!0,0===a.length)this._keyCodeToLabel[h]=null;else if(a.length>1)this._keyCodeToLabel[h]=a;else{const e=a.charCodeAt(0);e>=eK.CharCode.a&&e<=eK.CharCode.z?(o[eK.CharCode.A+(e-eK.CharCode.a)]=!0,r=!0,this._keyCodeToLabel[h]=String.fromCharCode(eK.CharCode.A+(e-eK.CharCode.a))):(e>=eK.CharCode.A&&e<=eK.CharCode.Z&&(o[e]=!0,r=!0),this._keyCodeToLabel[h]=a)}}const s=(e,t)=>{o[e]||(this._keyCodeToLabel[t]=String.fromCharCode(e))};if(s(eK.CharCode.A,I.KeyCode.KeyA),s(eK.CharCode.B,I.KeyCode.KeyB),s(eK.CharCode.C,I.KeyCode.KeyC),s(eK.CharCode.D,I.KeyCode.KeyD),s(eK.CharCode.E,I.KeyCode.KeyE),s(eK.CharCode.F,I.KeyCode.KeyF),s(eK.CharCode.G,I.KeyCode.KeyG),s(eK.CharCode.H,I.KeyCode.KeyH),s(eK.CharCode.I,I.KeyCode.KeyI),s(eK.CharCode.J,I.KeyCode.KeyJ),s(eK.CharCode.K,I.KeyCode.KeyK),s(eK.CharCode.L,I.KeyCode.KeyL),s(eK.CharCode.M,I.KeyCode.KeyM),s(eK.CharCode.N,I.KeyCode.KeyN),s(eK.CharCode.O,I.KeyCode.KeyO),s(eK.CharCode.P,I.KeyCode.KeyP),s(eK.CharCode.Q,I.KeyCode.KeyQ),s(eK.CharCode.R,I.KeyCode.KeyR),s(eK.CharCode.S,I.KeyCode.KeyS),s(eK.CharCode.T,I.KeyCode.KeyT),s(eK.CharCode.U,I.KeyCode.KeyU),s(eK.CharCode.V,I.KeyCode.KeyV),s(eK.CharCode.W,I.KeyCode.KeyW),s(eK.CharCode.X,I.KeyCode.KeyX),s(eK.CharCode.Y,I.KeyCode.KeyY),s(eK.CharCode.Z,I.KeyCode.KeyZ),!r){const e=(e,t)=>{this._keyCodeToLabel[e]=String.fromCharCode(t)};e(I.KeyCode.Semicolon,eK.CharCode.Semicolon),e(I.KeyCode.Equal,eK.CharCode.Equals),e(I.KeyCode.Comma,eK.CharCode.Comma),e(I.KeyCode.Minus,eK.CharCode.Dash),e(I.KeyCode.Period,eK.CharCode.Period),e(I.KeyCode.Slash,eK.CharCode.Slash),e(I.KeyCode.Backquote,eK.CharCode.BackTick),e(I.KeyCode.BracketLeft,eK.CharCode.OpenSquareBracket),e(I.KeyCode.Backslash,eK.CharCode.Backslash),e(I.KeyCode.BracketRight,eK.CharCode.CloseSquareBracket),e(I.KeyCode.Quote,eK.CharCode.SingleQuote)}}dumpDebugInfo(){let e=[],t=[I.ScanCode.ArrowUp,I.ScanCode.Numpad0],i=0;e.push("-----------------------------------------------------------------------------------------------------------------------------------------");for(let o=I.ScanCode.None;o<I.ScanCode.MAX_VALUE;o++){if(I.IMMUTABLE_CODE_TO_KEY_CODE[o]!==I.KeyCode.DependsOnKbLayout&&-1===t.indexOf(o))continue;i%6==0&&(e.push("| HW Code combination | Key | KeyCode combination | UI label | User settings | WYSIWYG |"),e.push("-----------------------------------------------------------------------------------------------------------------------------------------")),i++;let r=this._codeInfo[o],s=I.ScanCodeUtils.toString(o);for(let t of[0,2,5,7]){let i=!!(1&t),n=!!(2&t),a=!!(4&t),d=new D.ScanCodeChord(i,n,a,!1,o),l=this._resolveChord(d),c=l?I.KeyCodeUtils.toString(l.keyCode):null,h=l?new eG(this,[l]):null,u=`${i?"Ctrl+":""}${n?"Shift+":""}${a?"Alt+":""}${s}`,p=h?h.getAriaLabel():null,g=p?p.replace(/Control\+/,"Ctrl+"):null,m=h?h.getUserSettingsLabel():null,v=eG.getProducedChar(d,r),y=c?`${i?"Ctrl+":""}${n?"Shift+":""}${a?"Alt+":""}${c}`:null,C=h&&h.isWYSIWYG()?" ":" NO ";e.push(`| ${this._leftPad(u,30)} | ${v} | ${this._leftPad(y,25)} | ${this._leftPad(g,25)} | ${this._leftPad(m,25)} | ${C} |`)}e.push("-----------------------------------------------------------------------------------------------------------------------------------------")}return e.join("\n")}_leftPad(e,t){for(null===e&&(e="null");e.length<t;)e=" "+e;return e}getUILabelForKeyCode(e){return this._getLabelForKeyCode(e)}getAriaLabelForKeyCode(e){return this._getLabelForKeyCode(e)}getUserSettingsLabelForKeyCode(e){return this._isUSStandard?I.KeyCodeUtils.toUserSettingsUS(e):I.KeyCodeUtils.toUserSettingsGeneral(e)}getElectronAcceleratorForKeyBinding(e){return I.KeyCodeUtils.toElectronAccelerator(e.keyCode)}_getLabelForKeyCode(e){return this._keyCodeToLabel[e]||I.KeyCodeUtils.toString(I.KeyCode.Unknown)}resolveKeyboardEvent(e){let t=e.ctrlKey||this._mapAltGrToCtrlAlt&&e.altGraphKey,i=e.altKey||this._mapAltGrToCtrlAlt&&e.altGraphKey;return new eG(this,[new D.KeyCodeChord(t,e.shiftKey,i,e.metaKey,e.keyCode)])}_resolveChord(e){if(!e)return null;if(e instanceof D.KeyCodeChord)return this._keyCodeExists[e.keyCode]?e:null;let t=this._scanCodeToKeyCode[e.scanCode]||I.KeyCode.Unknown;return t!==I.KeyCode.Unknown&&this._keyCodeExists[t]?new D.KeyCodeChord(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t):null}resolveKeybinding(e){let t=(0,H.toEmptyArrayIfContainsNull)(e.chords.map(e=>this._resolveChord(e)));return t.length>0?[new eG(this,t)]:[]}}var eW=e.i(248598),ez=eN;let eB=[];class eU extends ez.BaseResolvedKeybinding{constructor(e,t,i){super(t,i),this._mapper=e}_getLabel(e){return this._mapper.getUILabelForScanCodeChord(e)}_getAriaLabel(e){return this._mapper.getAriaLabelForScanCodeChord(e)}_getElectronAccelerator(e){return this._mapper.getElectronAcceleratorLabelForScanCodeChord(e)}_getUserSettingsLabel(e){return this._mapper.getUserSettingsLabelForScanCodeChord(e)}_isWYSIWYG(e){if(!e||I.IMMUTABLE_CODE_TO_KEY_CODE[e.scanCode]!==I.KeyCode.DependsOnKbLayout)return!0;let t=this._mapper.getAriaLabelForScanCodeChord(e),i=this._mapper.getUserSettingsLabelForScanCodeChord(e);return!t&&!i||!!t&&!!i&&t.toLowerCase()===i.toLowerCase()}_getChordDispatch(e){return this._mapper.getDispatchStrForScanCodeChord(e)}_getSingleModifierChordDispatch(e){return e.scanCode!==I.ScanCode.ControlLeft&&e.scanCode!==I.ScanCode.ControlRight||e.shiftKey||e.altKey||e.metaKey?e.scanCode!==I.ScanCode.AltLeft&&e.scanCode!==I.ScanCode.AltRight||e.ctrlKey||e.shiftKey||e.metaKey?e.scanCode!==I.ScanCode.ShiftLeft&&e.scanCode!==I.ScanCode.ShiftRight||e.ctrlKey||e.altKey||e.metaKey?e.scanCode!==I.ScanCode.MetaLeft&&e.scanCode!==I.ScanCode.MetaRight||e.ctrlKey||e.shiftKey||e.altKey?null:"meta":"shift":"alt":"ctrl"}}class eH{constructor(e,t,i,o){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.scanCode=o}toString(){return`${this.ctrlKey?"Ctrl+":""}${this.shiftKey?"Shift+":""}${this.altKey?"Alt+":""}${I.ScanCodeUtils.toString(this.scanCode)}`}equals(e){return this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.scanCode===e.scanCode}getProducedCharCode(e){return e?this.ctrlKey&&this.shiftKey&&this.altKey?e.withShiftAltGr:this.ctrlKey&&this.altKey?e.withAltGr:this.shiftKey?e.withShift:e.value:""}getProducedChar(e){let t=eY.getCharCode(this.getProducedCharCode(e));return 0===t?" --- ":t>=eK.CharCode.U_Combining_Grave_Accent&&t<=eK.CharCode.U_Combining_Latin_Small_Letter_X?"U+"+t.toString(16):" "+String.fromCharCode(t)+" "}}class e${constructor(e,t,i,o){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.keyCode=o}toString(){return`${this.ctrlKey?"Ctrl+":""}${this.shiftKey?"Shift+":""}${this.altKey?"Alt+":""}${I.KeyCodeUtils.toString(this.keyCode)}`}}class eq{constructor(){this._scanCodeToKeyCode=[],this._keyCodeToScanCode=[],this._scanCodeToKeyCode=[],this._keyCodeToScanCode=[]}registrationComplete(){this._moveToEnd(I.ScanCode.IntlHash),this._moveToEnd(I.ScanCode.IntlBackslash)}_moveToEnd(e){for(let t=0;t<8;t++){let i=this._scanCodeToKeyCode[(e<<3)+t];if(i)for(let t=0,o=i.length;t<o;t++){let o=this._keyCodeToScanCode[i[t]];if(1!==o.length)for(let t=0,i=o.length;t<i;t++){let r=o[t];if(r>>>3===e){for(let e=t+1;e<i;e++)o[e-1]=o[e];o[i-1]=r}}}}}registerIfUnknown(e,t){if(t.keyCode===I.KeyCode.Unknown)return;let i=this._encodeScanCodeCombo(e),o=this._encodeKeyCodeCombo(t),r=t.keyCode>=I.KeyCode.Digit0&&t.keyCode<=I.KeyCode.Digit9,s=t.keyCode>=I.KeyCode.KeyA&&t.keyCode<=I.KeyCode.KeyZ,n=this._scanCodeToKeyCode[i];if(r||s){if(n){for(let e=0,t=n.length;e<t;e++)if(n[e]===o)return}}else if(n&&0!==n.length)return;this._scanCodeToKeyCode[i]=this._scanCodeToKeyCode[i]||[],this._scanCodeToKeyCode[i].unshift(o),this._keyCodeToScanCode[o]=this._keyCodeToScanCode[o]||[],this._keyCodeToScanCode[o].unshift(i)}lookupKeyCodeCombo(e){let t=this._encodeKeyCodeCombo(e),i=this._keyCodeToScanCode[t];if(!i||0===i.length)return[];let o=[];for(let e=0,t=i.length;e<t;e++){let t=i[e],r=!!(1&t),s=!!(2&t),n=!!(4&t),a=t>>>3;o[e]=new eH(r,s,n,a)}return o}lookupScanCodeCombo(e){let t=this._encodeScanCodeCombo(e),i=this._scanCodeToKeyCode[t];if(!i||0===i.length)return[];let o=[];for(let e=0,t=i.length;e<t;e++){let t=i[e],r=!!(1&t),s=!!(2&t),n=!!(4&t),a=t>>>3;o[e]=new e$(r,s,n,a)}return o}guessStableKeyCode(e){if(e>=I.ScanCode.Digit1&&e<=I.ScanCode.Digit0)switch(e){case I.ScanCode.Digit1:return I.KeyCode.Digit1;case I.ScanCode.Digit2:return I.KeyCode.Digit2;case I.ScanCode.Digit3:return I.KeyCode.Digit3;case I.ScanCode.Digit4:return I.KeyCode.Digit4;case I.ScanCode.Digit5:return I.KeyCode.Digit5;case I.ScanCode.Digit6:return I.KeyCode.Digit6;case I.ScanCode.Digit7:return I.KeyCode.Digit7;case I.ScanCode.Digit8:return I.KeyCode.Digit8;case I.ScanCode.Digit9:return I.KeyCode.Digit9;case I.ScanCode.Digit0:return I.KeyCode.Digit0}let t=this.lookupScanCodeCombo(new eH(!1,!1,!1,e)),i=this.lookupScanCodeCombo(new eH(!1,!0,!1,e));if(1===t.length&&1===i.length){let e=t[0].shiftKey,o=t[0].keyCode,r=i[0].shiftKey;if(o===i[0].keyCode&&e!==r)return o}return I.KeyCode.DependsOnKbLayout}_encodeScanCodeCombo(e){return this._encode(e.ctrlKey,e.shiftKey,e.altKey,e.scanCode)}_encodeKeyCodeCombo(e){return this._encode(e.ctrlKey,e.shiftKey,e.altKey,e.keyCode)}_encode(e,t,i,o){return(!!e|!!t<<1|!!i<<2|o<<3)>>>0}}class eY{constructor(e,t,i,o){this._isUSStandard=e,this._mapAltGrToCtrlAlt=i,this._OS=o,this._scanCodeToLabel=[],this._scanCodeToDispatch=[],this._codeInfo=[],this._scanCodeKeyCodeMapper=new eq,this._scanCodeToLabel=[],this._scanCodeToDispatch=[];const r=(e,t,i,o,r,s,n,a)=>{this._scanCodeKeyCodeMapper.registerIfUnknown(new eH(!!e,!!t,!!i,o),new e$(!!r,!!s,!!n,a))},s=(e,t,i,o,s)=>{for(let n=e;n<=1;n++)for(let e=t;e<=1;e++)for(let t=i;t<=1;t++)r(n,e,t,o,n,e,t,s)};for(let e=I.ScanCode.None;e<I.ScanCode.MAX_VALUE;e++)this._scanCodeToLabel[e]=null;for(let e=I.ScanCode.None;e<I.ScanCode.MAX_VALUE;e++)this._scanCodeToDispatch[e]=null;for(let e=I.ScanCode.None;e<I.ScanCode.MAX_VALUE;e++){const t=I.IMMUTABLE_CODE_TO_KEY_CODE[e];t!==I.KeyCode.DependsOnKbLayout&&(s(0,0,0,e,t),this._scanCodeToLabel[e]=I.KeyCodeUtils.toString(t),t===I.KeyCode.Unknown||(0,I.isModifierKey)(t)?this._scanCodeToDispatch[e]=null:this._scanCodeToDispatch[e]=`[${I.ScanCodeUtils.toString(e)}]`)}const n={};{const e=[];for(const i in t)if(t.hasOwnProperty(i)){const o=I.ScanCodeUtils.toEnum(i);if(o===I.ScanCode.None||I.IMMUTABLE_CODE_TO_KEY_CODE[o]!==I.KeyCode.DependsOnKbLayout)continue;const r=t[i],s=eY.getCharCode(r.value);s>=eK.CharCode.a&&s<=eK.CharCode.z&&(e[eK.CharCode.A+(s-eK.CharCode.a)]=!0)}const i=(t,i,o,r)=>{e[t]||(n[I.ScanCodeUtils.toString(i)]={value:o,withShift:r,withAltGr:"",withShiftAltGr:""})};i(eK.CharCode.A,I.ScanCode.KeyA,"a","A"),i(eK.CharCode.B,I.ScanCode.KeyB,"b","B"),i(eK.CharCode.C,I.ScanCode.KeyC,"c","C"),i(eK.CharCode.D,I.ScanCode.KeyD,"d","D"),i(eK.CharCode.E,I.ScanCode.KeyE,"e","E"),i(eK.CharCode.F,I.ScanCode.KeyF,"f","F"),i(eK.CharCode.G,I.ScanCode.KeyG,"g","G"),i(eK.CharCode.H,I.ScanCode.KeyH,"h","H"),i(eK.CharCode.I,I.ScanCode.KeyI,"i","I"),i(eK.CharCode.J,I.ScanCode.KeyJ,"j","J"),i(eK.CharCode.K,I.ScanCode.KeyK,"k","K"),i(eK.CharCode.L,I.ScanCode.KeyL,"l","L"),i(eK.CharCode.M,I.ScanCode.KeyM,"m","M"),i(eK.CharCode.N,I.ScanCode.KeyN,"n","N"),i(eK.CharCode.O,I.ScanCode.KeyO,"o","O"),i(eK.CharCode.P,I.ScanCode.KeyP,"p","P"),i(eK.CharCode.Q,I.ScanCode.KeyQ,"q","Q"),i(eK.CharCode.R,I.ScanCode.KeyR,"r","R"),i(eK.CharCode.S,I.ScanCode.KeyS,"s","S"),i(eK.CharCode.T,I.ScanCode.KeyT,"t","T"),i(eK.CharCode.U,I.ScanCode.KeyU,"u","U"),i(eK.CharCode.V,I.ScanCode.KeyV,"v","V"),i(eK.CharCode.W,I.ScanCode.KeyW,"w","W"),i(eK.CharCode.X,I.ScanCode.KeyX,"x","X"),i(eK.CharCode.Y,I.ScanCode.KeyY,"y","Y"),i(eK.CharCode.Z,I.ScanCode.KeyZ,"z","Z")}const a=[];let d=0;for(const e in t)if(t.hasOwnProperty(e)){const i=I.ScanCodeUtils.toEnum(e);if(i===I.ScanCode.None||I.IMMUTABLE_CODE_TO_KEY_CODE[i]!==I.KeyCode.DependsOnKbLayout)continue;this._codeInfo[i]=t[e];const o=n[e]||t[e],r=eY.getCharCode(o.value),s=eY.getCharCode(o.withShift),l={scanCode:i,value:r,withShift:s,withAltGr:eY.getCharCode(o.withAltGr),withShiftAltGr:eY.getCharCode(o.withShiftAltGr)};if(a[d++]=l,this._scanCodeToDispatch[i]=`[${I.ScanCodeUtils.toString(i)}]`,r>=eK.CharCode.a&&r<=eK.CharCode.z){const e=eK.CharCode.A+(r-eK.CharCode.a);this._scanCodeToLabel[i]=String.fromCharCode(e)}else r>=eK.CharCode.A&&r<=eK.CharCode.Z||r?this._scanCodeToLabel[i]=String.fromCharCode(r):this._scanCodeToLabel[i]=null}for(let e=a.length-1;e>=0;e--){const t=a[e],i=t.scanCode,o=t.withShiftAltGr;if(o===t.withAltGr||o===t.withShift||o===t.value)continue;const s=eY._charCodeToKb(o);if(!s)continue;const n=s.shiftKey,d=s.keyCode;n?r(1,1,1,i,0,1,0,d):r(1,1,1,i,0,0,0,d)}for(let e=a.length-1;e>=0;e--){const t=a[e],i=t.scanCode,o=t.withAltGr;if(o===t.withShift||o===t.value)continue;const s=eY._charCodeToKb(o);if(!s)continue;const n=s.shiftKey,d=s.keyCode;n?r(1,0,1,i,0,1,0,d):r(1,0,1,i,0,0,0,d)}for(let e=a.length-1;e>=0;e--){const t=a[e],i=t.scanCode,o=t.withShift;if(o===t.value)continue;const s=eY._charCodeToKb(o);if(!s)continue;const n=s.shiftKey,d=s.keyCode;n?(r(0,1,0,i,0,1,0,d),r(0,1,1,i,0,1,1,d),r(1,1,0,i,1,1,0,d)):(r(0,1,0,i,0,0,0,d),r(0,1,0,i,0,1,0,d),r(0,1,1,i,0,0,1,d),r(0,1,1,i,0,1,1,d),r(1,1,0,i,1,0,0,d),r(1,1,0,i,1,1,0,d),r(1,1,1,i,1,0,1,d)),r(1,1,1,i,1,1,1,d)}for(let e=a.length-1;e>=0;e--){const t=a[e],i=t.scanCode,o=eY._charCodeToKb(t.value);if(!o)continue;const s=o.shiftKey,n=o.keyCode;s?(r(0,0,0,i,0,1,0,n),r(0,0,1,i,0,1,1,n),r(1,0,0,i,1,1,0,n),r(1,0,1,i,1,1,1,n)):(r(0,0,0,i,0,0,0,n),r(0,0,1,i,0,0,1,n),r(0,1,0,i,0,1,0,n),r(0,1,1,i,0,1,1,n),r(1,0,0,i,1,0,0,n),r(1,0,1,i,1,0,1,n),r(1,1,0,i,1,1,0,n),r(1,1,1,i,1,1,1,n))}s(0,0,0,I.ScanCode.Digit1,I.KeyCode.Digit1),s(0,0,0,I.ScanCode.Digit2,I.KeyCode.Digit2),s(0,0,0,I.ScanCode.Digit3,I.KeyCode.Digit3),s(0,0,0,I.ScanCode.Digit4,I.KeyCode.Digit4),s(0,0,0,I.ScanCode.Digit5,I.KeyCode.Digit5),s(0,0,0,I.ScanCode.Digit6,I.KeyCode.Digit6),s(0,0,0,I.ScanCode.Digit7,I.KeyCode.Digit7),s(0,0,0,I.ScanCode.Digit8,I.KeyCode.Digit8),s(0,0,0,I.ScanCode.Digit9,I.KeyCode.Digit9),s(0,0,0,I.ScanCode.Digit0,I.KeyCode.Digit0),this._scanCodeKeyCodeMapper.registrationComplete()}dumpDebugInfo(){let e=[],t=[I.ScanCode.ArrowUp,I.ScanCode.Numpad0],i=0;e.push(`isUSStandard: ${this._isUSStandard}`),e.push("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");for(let o=I.ScanCode.None;o<I.ScanCode.MAX_VALUE;o++){if(I.IMMUTABLE_CODE_TO_KEY_CODE[o]!==I.KeyCode.DependsOnKbLayout&&-1===t.indexOf(o))continue;i%4==0&&(e.push("| HW Code combination | Key | KeyCode combination | Pri | UI label | User settings | Electron accelerator | Dispatching string | WYSIWYG |"),e.push("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")),i++;let r=this._codeInfo[o];for(let t=0;t<8;t++){let i=new eH(!!(1&t),!!(2&t),!!(4&t),o),s=this.resolveKeyboardEvent({_standardKeyboardEventBrand:!0,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,metaKey:!1,altGraphKey:!1,keyCode:I.KeyCode.DependsOnKbLayout,code:I.ScanCodeUtils.toString(o)}),n=i.toString(),a=i.getProducedChar(r),d=s.getAriaLabel(),l=d?d.replace(/Control\+/,"Ctrl+"):null,c=s.getUserSettingsLabel(),h=s.getElectronAccelerator(),u=s.getDispatchChords()[0],p=s&&s.isWYSIWYG()?" ":" NO ",g=this._scanCodeKeyCodeMapper.lookupScanCodeCombo(i);if(0===g.length)e.push(`| ${this._leftPad(n,30)} | ${a} | ${this._leftPad("",25)} | ${this._leftPad("",3)} | ${this._leftPad(l,25)} | ${this._leftPad(c,30)} | ${this._leftPad(h,25)} | ${this._leftPad(u,30)} | ${p} |`);else for(let t=0,o=g.length;t<o;t++){let o,r=g[t],s=this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(r);if(1===s.length)o="";else{let e=-1;for(let t=0;t<s.length;t++)if(s[t].equals(i)){e=t+1;break}o=String(e)}let d=r.toString();0===t?e.push(`| ${this._leftPad(n,30)} | ${a} | ${this._leftPad(d,25)} | ${this._leftPad(o,3)} | ${this._leftPad(l,25)} | ${this._leftPad(c,30)} | ${this._leftPad(h,25)} | ${this._leftPad(u,30)} | ${p} |`):e.push(`| ${this._leftPad("",30)} | | ${this._leftPad(d,25)} | ${this._leftPad(o,3)} | ${this._leftPad("",25)} | ${this._leftPad("",30)} | ${this._leftPad("",25)} | ${this._leftPad("",30)} | |`)}}e.push("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")}return e.join("\n")}_leftPad(e,t){for(null===e&&(e="null");e.length<t;)e=" "+e;return e}keyCodeChordToScanCodeChord(e){if(e.keyCode===I.KeyCode.Enter)return[new D.ScanCodeChord(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,I.ScanCode.Enter)];let t=this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(new e$(e.ctrlKey,e.shiftKey,e.altKey,e.keyCode)),i=[];for(let o=0,r=t.length;o<r;o++){let r=t[o];i[o]=new D.ScanCodeChord(r.ctrlKey,r.shiftKey,r.altKey,e.metaKey,r.scanCode)}return i}getUILabelForScanCodeChord(e){if(!e)return null;if(e.isDuplicateModifierCase())return"";if(this._OS===R.OperatingSystem.Macintosh)switch(e.scanCode){case I.ScanCode.ArrowLeft:return"←";case I.ScanCode.ArrowUp:return"↑";case I.ScanCode.ArrowRight:return"→";case I.ScanCode.ArrowDown:return"↓"}return this._scanCodeToLabel[e.scanCode]}getAriaLabelForScanCodeChord(e){return e?e.isDuplicateModifierCase()?"":this._scanCodeToLabel[e.scanCode]:null}getDispatchStrForScanCodeChord(e){let t=this._scanCodeToDispatch[e.scanCode];if(!t)return null;let i="";return e.ctrlKey&&(i+="ctrl+"),e.shiftKey&&(i+="shift+"),e.altKey&&(i+="alt+"),e.metaKey&&(i+="meta+"),i+=t}getUserSettingsLabelForScanCodeChord(e){if(!e)return null;if(e.isDuplicateModifierCase())return"";let t=I.IMMUTABLE_CODE_TO_KEY_CODE[e.scanCode];if(t!==I.KeyCode.DependsOnKbLayout)return I.KeyCodeUtils.toUserSettingsUS(t).toLowerCase();let i=this._scanCodeKeyCodeMapper.guessStableKeyCode(e.scanCode);if(i!==I.KeyCode.DependsOnKbLayout){let t=this.keyCodeChordToScanCodeChord(new D.KeyCodeChord(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,i));for(let o=0,r=t.length;o<r;o++)if(t[o].scanCode===e.scanCode)return I.KeyCodeUtils.toUserSettingsUS(i).toLowerCase()}return this._scanCodeToDispatch[e.scanCode]}getElectronAcceleratorLabelForScanCodeChord(e){if(!e)return null;let t=I.IMMUTABLE_CODE_TO_KEY_CODE[e.scanCode];if(t!==I.KeyCode.DependsOnKbLayout)return I.KeyCodeUtils.toElectronAccelerator(t);let i=this._scanCodeKeyCodeMapper.guessStableKeyCode(e.scanCode);return this._OS!==R.OperatingSystem.Linux||this._isUSStandard||i!==I.KeyCode.Semicolon&&i!==I.KeyCode.Equal&&i!==I.KeyCode.Comma&&i!==I.KeyCode.Minus&&i!==I.KeyCode.Period&&i!==I.KeyCode.Slash&&i!==I.KeyCode.Backquote&&i!==I.KeyCode.BracketLeft&&i!==I.KeyCode.Backslash&&i!==I.KeyCode.BracketRight?i!==I.KeyCode.DependsOnKbLayout?I.KeyCodeUtils.toElectronAccelerator(i):null:null}_toResolvedKeybinding(e){if(0===e.length)return[];let t=[];return this._generateResolvedKeybindings(e,0,[],t),t}_generateResolvedKeybindings(e,t,i,o){let r=e[t],s=t===e.length-1;for(let n=0,a=r.length;n<a;n++){let a=[...i,r[n]];s?o.push(new eU(this,this._OS,a)):this._generateResolvedKeybindings(e,t+1,a,o)}}resolveKeyboardEvent(e){let t=I.ScanCodeUtils.toEnum(e.code);t===I.ScanCode.NumpadEnter&&(t=I.ScanCode.Enter);let i=e.keyCode;if(i===I.KeyCode.LeftArrow||i===I.KeyCode.UpArrow||i===I.KeyCode.RightArrow||i===I.KeyCode.DownArrow||i===I.KeyCode.Delete||i===I.KeyCode.Insert||i===I.KeyCode.Home||i===I.KeyCode.End||i===I.KeyCode.PageDown||i===I.KeyCode.PageUp||i===I.KeyCode.Backspace){let e=I.IMMUTABLE_KEY_CODE_TO_CODE[i];e!==I.ScanCode.DependsOnKbLayout&&(t=e)}else if((t===I.ScanCode.Numpad1||t===I.ScanCode.Numpad2||t===I.ScanCode.Numpad3||t===I.ScanCode.Numpad4||t===I.ScanCode.Numpad5||t===I.ScanCode.Numpad6||t===I.ScanCode.Numpad7||t===I.ScanCode.Numpad8||t===I.ScanCode.Numpad9||t===I.ScanCode.Numpad0||t===I.ScanCode.NumpadDecimal)&&i>=0){let e=I.IMMUTABLE_KEY_CODE_TO_CODE[i];e!==I.ScanCode.DependsOnKbLayout&&(t=e)}let o=e.ctrlKey||this._mapAltGrToCtrlAlt&&e.altGraphKey,r=e.altKey||this._mapAltGrToCtrlAlt&&e.altGraphKey,s=new D.ScanCodeChord(o,e.shiftKey,r,e.metaKey,t);return new eU(this,this._OS,[s])}_resolveChord(e){return e?e instanceof D.ScanCodeChord?[e]:this.keyCodeChordToScanCodeChord(e):[]}resolveKeybinding(e){let t=e.chords.map(e=>this._resolveChord(e));return this._toResolvedKeybinding(t)}static _redirectCharCode(e){switch(e){case eK.CharCode.U_IDEOGRAPHIC_FULL_STOP:return eK.CharCode.Period;case eK.CharCode.U_LEFT_CORNER_BRACKET:return eK.CharCode.OpenSquareBracket;case eK.CharCode.U_RIGHT_CORNER_BRACKET:return eK.CharCode.CloseSquareBracket;case eK.CharCode.U_LEFT_BLACK_LENTICULAR_BRACKET:return eK.CharCode.OpenSquareBracket;case eK.CharCode.U_RIGHT_BLACK_LENTICULAR_BRACKET:return eK.CharCode.CloseSquareBracket;case eK.CharCode.U_FULLWIDTH_SEMICOLON:return eK.CharCode.Semicolon;case eK.CharCode.U_FULLWIDTH_COMMA:return eK.CharCode.Comma}return e}static _charCodeToKb(e){return(e=this._redirectCharCode(e))<eB.length?eB[e]:null}static getCharCode(e){if(0===e.length)return 0;let t=e.charCodeAt(0);switch(t){case eK.CharCode.U_Combining_Grave_Accent:return eK.CharCode.U_GRAVE_ACCENT;case eK.CharCode.U_Combining_Acute_Accent:return eK.CharCode.U_ACUTE_ACCENT;case eK.CharCode.U_Combining_Circumflex_Accent:return eK.CharCode.U_CIRCUMFLEX;case eK.CharCode.U_Combining_Tilde:return eK.CharCode.U_SMALL_TILDE;case eK.CharCode.U_Combining_Macron:return eK.CharCode.U_MACRON;case eK.CharCode.U_Combining_Overline:return eK.CharCode.U_OVERLINE;case eK.CharCode.U_Combining_Breve:return eK.CharCode.U_BREVE;case eK.CharCode.U_Combining_Dot_Above:return eK.CharCode.U_DOT_ABOVE;case eK.CharCode.U_Combining_Diaeresis:return eK.CharCode.U_DIAERESIS;case eK.CharCode.U_Combining_Ring_Above:return eK.CharCode.U_RING_ABOVE;case eK.CharCode.U_Combining_Double_Acute_Accent:return eK.CharCode.U_DOUBLE_ACUTE_ACCENT}return t}}function ej(e,t,i){for(let t=eB.length;t<e;t++)eB[t]=null;eB[e]={keyCode:t,shiftKey:i}}for(let e=eK.CharCode.A;e<=eK.CharCode.Z;e++)ej(e,I.KeyCode.KeyA+(e-eK.CharCode.A),!0);for(let e=eK.CharCode.a;e<=eK.CharCode.z;e++)ej(e,I.KeyCode.KeyA+(e-eK.CharCode.a),!1);ej(eK.CharCode.Semicolon,I.KeyCode.Semicolon,!1),ej(eK.CharCode.Colon,I.KeyCode.Semicolon,!0),ej(eK.CharCode.Equals,I.KeyCode.Equal,!1),ej(eK.CharCode.Plus,I.KeyCode.Equal,!0),ej(eK.CharCode.Comma,I.KeyCode.Comma,!1),ej(eK.CharCode.LessThan,I.KeyCode.Comma,!0),ej(eK.CharCode.Dash,I.KeyCode.Minus,!1),ej(eK.CharCode.Underline,I.KeyCode.Minus,!0),ej(eK.CharCode.Period,I.KeyCode.Period,!1),ej(eK.CharCode.GreaterThan,I.KeyCode.Period,!0),ej(eK.CharCode.Slash,I.KeyCode.Slash,!1),ej(eK.CharCode.QuestionMark,I.KeyCode.Slash,!0),ej(eK.CharCode.BackTick,I.KeyCode.Backquote,!1),ej(eK.CharCode.Tilde,I.KeyCode.Backquote,!0),ej(eK.CharCode.OpenSquareBracket,I.KeyCode.BracketLeft,!1),ej(eK.CharCode.OpenCurlyBrace,I.KeyCode.BracketLeft,!0),ej(eK.CharCode.Backslash,I.KeyCode.Backslash,!1),ej(eK.CharCode.Pipe,I.KeyCode.Backslash,!0),ej(eK.CharCode.CloseSquareBracket,I.KeyCode.BracketRight,!1),ej(eK.CharCode.CloseCurlyBrace,I.KeyCode.BracketRight,!0),ej(eK.CharCode.SingleQuote,I.KeyCode.Quote,!1),ej(eK.CharCode.DoubleQuote,I.KeyCode.Quote,!0);var eX=e.i(253642),eJ=e.i(731931),eZ=e.i(140889);class eQ extends eR.Disposable{get activeKeymap(){return this._activeKeymapInfo}get keymapInfos(){return this._keymapInfos}get activeKeyboardLayout(){return this._initialized?this._activeKeymapInfo?.layout??null:null}get activeKeyMapping(){return this._initialized?this._activeKeymapInfo?.mapping??null:null}get keyboardLayouts(){return this._keymapInfos.map(e=>e.layout)}constructor(e){super(),this._configurationService=e,this._onDidChangeKeyboardMapper=new S.Emitter,this.onDidChangeKeyboardMapper=this._onDidChangeKeyboardMapper.event,this.keyboardLayoutMapAllowed=void 0!==navigator.keyboard,this._keyboardMapper=null,this._initialized=!1,this._keymapInfos=[],this._mru=[],this._activeKeymapInfo=null,navigator.keyboard&&navigator.keyboard.addEventListener&&navigator.keyboard.addEventListener("layoutchange",()=>{this._getBrowserKeyMapping().then(e=>{this.isKeyMappingActive(e)||this.setLayoutFromBrowserAPI()})}),this._register(this._configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("keyboard")&&(this._keyboardMapper=null,this._onDidChangeKeyboardMapper.fire())}))}registerKeyboardLayout(e){this._keymapInfos.push(e),this._mru=this._keymapInfos}removeKeyboardLayout(e){let t=this._mru.indexOf(e);this._mru.splice(t,1),t=this._keymapInfos.indexOf(e),this._keymapInfos.splice(t,1)}getMatchedKeymapInfo(e){if(!e)return null;let t=this.getUSStandardLayout();if(t){let i=t.getScore(e);if(0===i)return{result:t,score:0};let o=t;for(let t=0;t<this._mru.length;t++){let r=this._mru[t].getScore(e);if(r>i){if(0===r)return{result:this._mru[t],score:0};i=r,o=this._mru[t]}}return{result:o,score:i}}for(let t=0;t<this._mru.length;t++)if(this._mru[t].fuzzyEqual(e))return{result:this._mru[t],score:0};return null}getUSStandardLayout(){let e=this._mru.filter(e=>e.layout.isUSStandard);return e.length?e[0]:null}isKeyMappingActive(e){return this._activeKeymapInfo&&e&&this._activeKeymapInfo.fuzzyEqual(e)}setUSKeyboardLayout(){this._activeKeymapInfo=this.getUSStandardLayout()}setActiveKeyMapping(e){let t=!1,i=this.getMatchedKeymapInfo(e);if(i&&(this._activeKeymapInfo?e&&i.result.getScore(e)>this._activeKeymapInfo.getScore(e)&&(this._activeKeymapInfo=i.result,t=!0):(this._activeKeymapInfo=i.result,t=!0)),this._activeKeymapInfo||(this._activeKeymapInfo=this.getUSStandardLayout(),t=!0),!this._activeKeymapInfo||!t)return;let o=this._mru.indexOf(this._activeKeymapInfo);this._mru.splice(o,1),this._mru.unshift(this._activeKeymapInfo),this._setKeyboardData(this._activeKeymapInfo)}setActiveKeymapInfo(e){this._activeKeymapInfo=e;let t=this._mru.indexOf(this._activeKeymapInfo);0!==t&&(this._mru.splice(t,1),this._mru.unshift(this._activeKeymapInfo),this._setKeyboardData(this._activeKeymapInfo))}setLayoutFromBrowserAPI(){this._updateKeyboardLayoutAsync(this._initialized)}_updateKeyboardLayoutAsync(e,t){e&&this._getBrowserKeyMapping(t).then(e=>{this.isKeyMappingActive(e)||this.setActiveKeyMapping(e)})}getKeyboardMapper(){let e,t=(e=this._configurationService.getValue("keyboard"),{dispatch:e?.dispatch==="keyCode"?n.KeyCode:n.Code,mapAltGrToCtrlAlt:!!e?.mapAltGrToCtrlAlt});return t.dispatch!==n.KeyCode&&this._initialized&&this._activeKeymapInfo?(this._keyboardMapper||(this._keyboardMapper=new eV(e0._createKeyboardMapper(this._activeKeymapInfo,t.mapAltGrToCtrlAlt))),this._keyboardMapper):new eW.FallbackKeyboardMapper(t.mapAltGrToCtrlAlt,R.OS)}validateCurrentKeyboardMapping(e){!this._initialized||this._validateCurrentKeyboardMapping(e)||this._updateKeyboardLayoutAsync(!0,e)}setKeyboardLayout(e){let t=this.keymapInfos.filter(t=>ek(t.layout)===e);t.length>0&&this.setActiveKeymapInfo(t[0])}_setKeyboardData(e){this._initialized=!0,this._keyboardMapper=null,this._onDidChangeKeyboardMapper.fire()}static _createKeyboardMapper(e,t){let i=e.mapping,o=!!e.layout.isUSStandard;return R.OS===R.OperatingSystem.Windows?new eF(o,i,t):0===Object.keys(i).length?new eW.FallbackKeyboardMapper(t,R.OS):new eY(o,i,t,R.OS)}_validateCurrentKeyboardMapping(e){if(!this._initialized)return!0;let t=this._activeKeymapInfo;if(!t||"Dead"===e.browserEvent.key||e.browserEvent.isComposing)return!0;let i=t.mapping[e.code];if(!i)return!1;if(""===i.value)return(e.ctrlKey||e.metaKey)&&setTimeout(()=>{this._getBrowserKeyMapping().then(e=>{this.isKeyMappingActive(e)||this.setLayoutFromBrowserAPI()})},350),!0;let o=e.altKey&&e.shiftKey?i.withShiftAltGr:e.altKey?i.withAltGr:e.shiftKey?i.withShift:i.value,r=e.altKey&&e.shiftKey&&i.withShiftAltGrIsDeadKey||e.altKey&&i.withAltGrIsDeadKey||e.shiftKey&&i.withShiftIsDeadKey||i.valueIsDeadKey;return(!r||"Dead"===e.browserEvent.key)&&(!!r||e.browserEvent.key===o)}async _getBrowserKeyMapping(e){if(this.keyboardLayoutMapAllowed)try{return await navigator.keyboard.getLayoutMap().then(e=>{let t={};for(let i of e)t[i[0]]={value:i[1],withShift:"",withAltGr:"",withShiftAltGr:""};return t})}catch{this.keyboardLayoutMapAllowed=!1}if(e&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.metaKey){let t={};if(t[e.browserEvent.code]={value:e.browserEvent.key,withShift:"",withAltGr:"",withShiftAltGr:""},this.getMatchedKeymapInfo(t))return t}return null}}class e0 extends eQ{constructor(t,i,o,r){super(t);const s=R.isWindows?"win":R.isMacintosh?"darwin":"linux";(function(t){switch(t){case"./keyboardLayouts/layout.contribution.darwin.js":return e.A(576061);case"./keyboardLayouts/layout.contribution.linux.js":return e.A(510304);case"./keyboardLayouts/layout.contribution.win.js":return e.A(833255);default:return new Promise(function(e,i){("function"==typeof queueMicrotask?queueMicrotask:setTimeout)(i.bind(null,Error("Unknown variable dynamic import: "+t)))})}})(`./keyboardLayouts/layout.contribution.${s}.js`).then(e=>{let t=e.KeyboardLayoutContribution.INSTANCE.layoutInfos;this._keymapInfos.push(...t.map(e=>new eM(e.layout,e.secondaryLayouts,e.mapping,e.isUserKeyboardLayout))),this._mru=this._keymapInfos,this._initialized=!0,this.setLayoutFromBrowserAPI()})}}class e1 extends eR.Disposable{get keyboardLayout(){return this._keyboardLayout}constructor(e,t){super(),this.keyboardLayoutResource=e,this.fileService=t,this._onDidChange=this._register(new S.Emitter),this.onDidChange=this._onDidChange.event,this._keyboardLayout=null,this.reloadConfigurationScheduler=this._register(new f.RunOnceScheduler(()=>this.reload().then(e=>{e&&this._onDidChange.fire()}),50)),this._register(S.Event.filter(this.fileService.onDidFilesChange,e=>e.contains(this.keyboardLayoutResource))(()=>this.reloadConfigurationScheduler.schedule()))}async initialize(){await this.reload()}async reload(){let e=this._keyboardLayout;try{let e=await this.fileService.readFile(this.keyboardLayoutResource),t=(0,_.parse)(e.value.toString());if("object"===(0,_.getNodeType)(t)){let e=t.layout,i=t.rawMapping;this._keyboardLayout=eM.createKeyboardLayoutFromDebugInfo(e,i,!0)}else this._keyboardLayout=null}catch(e){this._keyboardLayout=null}return!e||!(0,x.equals)(e,this._keyboardLayout)}}let e2=class extends eR.Disposable{constructor(e,t,i,o,r,s){super(),this.configurationService=s,this._onDidChangeKeyboardLayout=new S.Emitter,this.onDidChangeKeyboardLayout=this._onDidChangeKeyboardLayout.event;const n=s.getValue("keyboard").layout;this._keyboardLayoutMode=n??"autodetect",this._factory=new e0(s,i,o,r),this._register(this._factory.onDidChangeKeyboardMapper(()=>{this._onDidChangeKeyboardLayout.fire()})),n&&"autodetect"!==n&&this._factory.setKeyboardLayout(n),this._register(s.onDidChangeConfiguration(e=>{if(e.affectsConfiguration("keyboard.layout")){let e=s.getValue("keyboard").layout;this._keyboardLayoutMode=e,"autodetect"===e?this._factory.setLayoutFromBrowserAPI():this._factory.setKeyboardLayout(e)}})),this._userKeyboardLayout=new e1(e.keyboardLayoutResource,t),this._userKeyboardLayout.initialize().then(()=>{this._userKeyboardLayout.keyboardLayout&&(this._factory.registerKeyboardLayout(this._userKeyboardLayout.keyboardLayout),this.setUserKeyboardLayoutIfMatched())}),this._register(this._userKeyboardLayout.onDidChange(()=>{let e=this._factory.keymapInfos.filter(e=>e.isUserKeyboardLayout);e.length?this._userKeyboardLayout.keyboardLayout?e[0].update(this._userKeyboardLayout.keyboardLayout):this._factory.removeKeyboardLayout(e[0]):this._userKeyboardLayout.keyboardLayout&&this._factory.registerKeyboardLayout(this._userKeyboardLayout.keyboardLayout),this.setUserKeyboardLayoutIfMatched()}))}setUserKeyboardLayoutIfMatched(){let e=this.configurationService.getValue("keyboard").layout;e&&this._userKeyboardLayout.keyboardLayout&&ek(this._userKeyboardLayout.keyboardLayout.layout)===e&&this._factory.activeKeymap&&!this._userKeyboardLayout.keyboardLayout.equal(this._factory.activeKeymap)&&this._factory.setActiveKeymapInfo(this._userKeyboardLayout.keyboardLayout)}getKeyboardMapper(){return this._factory.getKeyboardMapper()}getCurrentKeyboardLayout(){return this._factory.activeKeyboardLayout}getAllKeyboardLayouts(){return this._factory.keyboardLayouts}getRawKeyboardMapping(){return this._factory.activeKeyMapping}validateCurrentKeyboardMapping(e){"autodetect"===this._keyboardLayoutMode&&this._factory.validateCurrentKeyboardMapping(e)}};e2=(0,p.__decorate)([(0,p.__param)(0,eX.IEnvironmentService),(0,p.__param)(1,G.IFileService),(0,p.__param)(2,Y.INotificationService),(0,p.__param)(3,eZ.IStorageService),(0,p.__param)(4,P.ICommandService),(0,p.__param)(5,eJ.IConfigurationService)],e2);let e3=j.Registry.as(eL.Extensions.Configuration),e5={id:"keyboard",order:15,type:"object",title:(0,m.localize)(14136,"Keyboard"),properties:{"keyboard.layout":{type:"string",default:"autodetect",description:(0,m.localize)(14137,"Control the keyboard layout used in web.")}}};e3.registerConfiguration(e5);var e6=A;let e4=class extends e6.Disposable{constructor(e,t,i){super(),this._instantiationService=e,this._extensionService=t,this._logService=i,this._extensionHostIsReady=!1,this._onWillExecuteCommand=this._register(new S.Emitter),this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new S.Emitter,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this._extensionService.whenInstalledExtensionsRegistered().then(e=>this._extensionHostIsReady=e),this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=(0,f.raceCancellablePromises)([this._extensionService.activateByEvent("*"),(0,f.timeout)(3e4)])),(0,f.notCancellablePromise)(this._starActivation)}async executeCommand(e,...t){this._logService.trace("CommandService#executeCommand",e);let i=`onCommand:${e}`;return O.CommandsRegistry.getCommand(e)?(this._extensionService.activationEventIsDone(i)||(this._extensionHostIsReady?await this._extensionService.activateByEvent(i):this._extensionService.activateByEvent(i)),this._tryExecuteCommand(e,t)):(await Promise.all([this._extensionService.activateByEvent(i),(0,f.raceCancellablePromises)([this._activateStar(),S.Event.toPromise(S.Event.filter(O.CommandsRegistry.onDidRegisterCommand,t=>t===e))])]),this._tryExecuteCommand(e,t))}_tryExecuteCommand(e,t){let i=O.CommandsRegistry.getCommand(e);if(!i)return Promise.reject(Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let o=this._instantiationService.invokeFunction(i.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(o)}catch(e){return Promise.reject(e)}}dispose(){super.dispose(),this._starActivation?.cancel()}};e4=(0,p.__decorate)([(0,p.__param)(0,z.IInstantiationService),(0,p.__param)(1,ey.IExtensionService),(0,p.__param)(2,q.ILogService)],e4);var e9=e.i(702320),e8=e.i(802136),e7=e.i(68629);e.i(706925);var te=L,tt=e.i(262072),ti=e.i(753062),to=e.i(947278),tr=e.i(325438);class ts extends te.Action2{constructor(){super({id:"workbench.action.toggleKeybindingsLog",title:(0,m.localize2)(8502,"Toggle Keyboard Shortcuts Troubleshooting"),category:tt.Categories.Developer,f1:!0})}run(e){if(e.get(ea.IKeybindingService).toggleLogging()&&e.get(P.ICommandService).executeCommand(ti.showWindowLogActionId),ts.disposable){ts.disposable.dispose(),ts.disposable=void 0;return}let t=e.get(to.ILayoutService),i=new A.DisposableStore,o=t.activeContainer,r=(0,C.append)(o,(0,C.$)(".focus-troubleshooting-marker"));i.add((0,A.toDisposable)(()=>r.remove()));let s=(0,tr.createStyleSheet)(void 0,void 0,i);(0,tr.createCSSRule)(".focus-troubleshooting-marker",`
136
+ position: fixed;
137
+ pointer-events: none;
138
+ z-index: 100000;
139
+ background-color: rgba(255, 0, 0, 0.2);
140
+ border: 2px solid rgba(255, 0, 0, 0.8);
141
+ border-radius: 2px;
142
+ display: none;
143
+ `,s);let n=i.add(new S.Emitter);function a(e,t){t.add((0,C.addDisposableListener)(e,"keydown",e=>n.fire(e),!0))}for(let{window:e,disposables:t}of(0,C.getWindows)())a(e,t);i.add((0,C.onDidRegisterWindow)(({window:e,disposables:t})=>a(e,t))),i.add(t.onDidChangeActiveContainer(()=>{t.activeContainer.appendChild(r)})),i.add(n.event(e=>{let t=e.target;if(t){let e=(0,C.getDomNodePagePosition)(t);r.style.top=`${e.top}px`,r.style.left=`${e.left}px`,r.style.width=`${e.width}px`,r.style.height=`${e.height}px`,r.style.display="block",setTimeout(()=>{r.style.display="none"},800)}})),ts.disposable=i}}(0,te.registerAction2)(ts);var tn=A,ta=e.i(166969),td=e.i(478697),tl=e.i(725288),tc=e.i(819593);class th{static hasOpenBrace(e){for(;e.scan()!==_.SyntaxKind.EOF;)if(e.getToken()===_.SyntaxKind.OpenBraceToken)return!0;return!1}static offsetToPosition(e,t){let i=0,o=e.getEOL().length,r=e.getLineCount();for(let s=1;s<=r;s++){let r=i+(e.getLineLength(s)+o);if(r>t)return new tc.Position(s,t-i+1);i=r}return new tc.Position(r,e.getLineMaxColumn(r))}static insertSnippet(e,t){var i;let o,r=e.getValueLengthInRange(new ta.Range(1,1,t.lineNumber,t.column));(i=o||(o={}))[i.INVALID=0]="INVALID",i[i.AFTER_OBJECT=1]="AFTER_OBJECT",i[i.BEFORE_OBJECT=2]="BEFORE_OBJECT";let s=o.INVALID,n=-1,a=o.INVALID,d=(0,_.createScanner)(e.getValue()),l=0,c=0,h=(e,t)=>{t!==o.INVALID&&1===l&&0===c?(s=t,n=e,a=t):s!==o.INVALID&&(s=o.INVALID,n=d.getTokenOffset())};for(;d.scan()!==_.SyntaxKind.EOF;){let t=d.getPosition(),i=d.getToken(),u=!1;switch(i){case _.SyntaxKind.OpenBracketToken:u=!0,l++,h(t,o.BEFORE_OBJECT);break;case _.SyntaxKind.CloseBracketToken:u=!0,l--,h(t,o.INVALID);break;case _.SyntaxKind.CommaToken:u=!0,h(t,o.BEFORE_OBJECT);break;case _.SyntaxKind.OpenBraceToken:u=!0,c++,h(t,o.INVALID);break;case _.SyntaxKind.CloseBraceToken:u=!0,c--,h(t,o.AFTER_OBJECT);break;case _.SyntaxKind.Trivia:case _.SyntaxKind.LineBreakTrivia:u=!0}if(t>=r&&(s!==o.INVALID||-1!==n)){let i,r;if(s!==o.INVALID?(i=u?t:d.getTokenOffset(),r=s):(i=n,r=a),r===o.AFTER_OBJECT)return{position:this.offsetToPosition(e,i),prepend:",",append:""};return d.setPosition(i),{position:this.offsetToPosition(e,i),prepend:"",append:this.hasOpenBrace(d)?",":""}}}let u=e.getLineCount();return{position:new tc.Position(u,e.getLineMaxColumn(u)),prepend:"\n[",append:"]"}}}var tu=e.i(654295),tp=A,tg=e.i(413003),tm=e.i(598720),tv=e.i(323325),ty=e.i(452088),tC=e.i(919101),tb=e.i(575129),tw=e.i(698014);e.i(140331);var tf=e.i(471999);e.i(900329),e.i(785266),e.i(181268),e.i(70177);var tS=e.i(575210);e.i(890787),e.i(67920);var t_=e.i(600345),tE=e.i(32637),tI=e.i(527180),tD=e.i(841203),tT=tm,tA=e.i(701898),tx=(e.i(163731),e.i(58762)),tR=e.i(98342),tk=e.i(13306),tM=e.i(16198),tL=e.i(192514),tO=e.i(487495),tP=e.i(370973),tV=e.i(578953),tK=e.i(399362),tN=e.i(772383),tG=e.i(155652),tF=e.i(321012);let tW=(0,tF.registerIcon)("settings-folder-dropdown",tG.Codicon.chevronDown,(0,m.localize)(9932,"Icon for the folder dropdown button in the split JSON Settings editor."));(0,tF.registerIcon)("settings-more-action",tG.Codicon.gear,(0,m.localize)(9933,"Icon for the 'more actions' action in the Settings UI.")),(0,tF.registerIcon)("keybindings-record-keys",tG.Codicon.recordKeys,(0,m.localize)(9934,"Icon for the 'record keys' action in the keybinding UI.")),(0,tF.registerIcon)("keybindings-sort",tG.Codicon.sortPrecedence,(0,m.localize)(9935,"Icon for the 'sort by precedence' toggle in the keybinding UI.")),(0,tF.registerIcon)("keybindings-edit",tG.Codicon.edit,(0,m.localize)(9936,"Icon for the edit action in the keybinding UI.")),(0,tF.registerIcon)("keybindings-add",tG.Codicon.add,(0,m.localize)(9937,"Icon for the add action in the keybinding UI.")),(0,tF.registerIcon)("settings-edit",tG.Codicon.edit,(0,m.localize)(9938,"Icon for the edit action in the Settings UI.")),(0,tF.registerIcon)("settings-remove",tG.Codicon.close,(0,m.localize)(9939,"Icon for the remove action in the Settings UI.")),(0,tF.registerIcon)("settings-discard",tG.Codicon.discard,(0,m.localize)(9940,"Icon for the discard action in the Settings UI.")),(0,tF.registerIcon)("preferences-clear-input",tG.Codicon.clearAll,(0,m.localize)(9941,"Icon for clear input in the Settings and keybinding UI.")),(0,tF.registerIcon)("preferences-ai-results",tG.Codicon.sparkle,(0,m.localize)(9942,"Icon for showing AI results in the Settings UI.")),(0,tF.registerIcon)("preferences-filter",tG.Codicon.filter,(0,m.localize)(9943,"Icon for the button that suggests filters for the Settings UI.")),(0,tF.registerIcon)("preferences-open-settings",tG.Codicon.goToFile,(0,m.localize)(9944,"Icon for open settings commands."));let tz=class extends tI.BaseActionViewItem{constructor(e,t,i,o){super(null,e),this.contextService=t,this.contextMenuService=i,this.hoverService=o,this._folderSettingCounts=new Map;const r=this.contextService.getWorkspace();this._folder=1===r.folders.length?r.folders[0]:null,this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.onWorkspaceFoldersChanged()))}get folder(){return this._folder}set folder(e){this._folder=e,this.update()}setCount(e,t){let i=this.contextService.getWorkspaceFolder(e);if(!i)throw Error("unknown folder");let o=i.uri;this._folderSettingCounts.set(o.toString(),t),this.update()}render(e){this.element=e,this.container=e,this.labelElement=(0,C.$)(".action-title"),this.detailsElement=(0,C.$)(".action-details"),this.dropDownElement=(0,C.$)(".dropdown-icon.hide"+ei.ThemeIcon.asCSSSelector(tW)),this.anchorElement=(0,C.$)("a.action-label.folder-settings",{role:"button","aria-haspopup":"true",tabindex:"0"},this.labelElement,this.detailsElement,this.dropDownElement),this.anchorElementHover=this._register(this.hoverService.setupManagedHover((0,tD.getDefaultHoverDelegate)("mouse"),this.anchorElement,"")),this._register((0,C.addDisposableListener)(this.anchorElement,C.EventType.MOUSE_DOWN,e=>C.EventHelper.stop(e))),this._register((0,C.addDisposableListener)(this.anchorElement,C.EventType.CLICK,e=>this.onClick(e))),this._register((0,C.addDisposableListener)(this.container,C.EventType.KEY_UP,e=>this.onKeyUp(e))),(0,C.append)(this.container,this.anchorElement),this.update()}onKeyUp(e){switch(new b.StandardKeyboardEvent(e).keyCode){case I.KeyCode.Enter:case I.KeyCode.Space:this.onClick(e);return}}onClick(e){C.EventHelper.stop(e,!0),!this.folder||this._action.checked?this.showMenu():this._action.run(this._folder)}updateEnabled(){this.update()}updateChecked(){this.update()}onWorkspaceFoldersChanged(){let e=this._folder,t=this.contextService.getWorkspace();e&&(this._folder=t.folders.filter(t=>(0,k.isEqual)(t.uri,e.uri))[0]||t.folders[0]),this._folder=this._folder?this._folder:1===t.folders.length?t.folders[0]:null,this.update(),this._action.checked&&this._action.run(this._folder)}update(){let e=0;this._folderSettingCounts.forEach(t=>e+=t);let t=this.contextService.getWorkspace();if(this._folder){this.labelElement.textContent=this._folder.name,this.anchorElementHover.update(this._folder.name);let i=this.labelWithCount(this._action.label,e);this.detailsElement.textContent=i,this.dropDownElement.classList.toggle("hide",1===t.folders.length||!this._action.checked)}else{let t=this.labelWithCount(this._action.label,e);this.labelElement.textContent=t,this.detailsElement.textContent="",this.anchorElementHover.update(this._action.label),this.dropDownElement.classList.remove("hide")}this.anchorElement.classList.toggle("checked",this._action.checked),this.container.classList.toggle("disabled",!this._action.enabled)}showMenu(){this.contextMenuService.showContextMenu({getAnchor:()=>this.container,getActions:()=>this.getDropdownMenuActions(),getActionViewItem:()=>void 0,onHide:()=>{this.anchorElement.blur()}})}getDropdownMenuActions(){let e=[],t=this.contextService.getWorkspace().folders;return this.contextService.getWorkbenchState()===tV.WorkbenchState.WORKSPACE&&t.length>0&&e.push(...t.map((e,t)=>{let i=this._folderSettingCounts.get(e.uri.toString());return{id:"folderSettingsTarget"+t,label:this.labelWithCount(e.name,i),tooltip:this.labelWithCount(e.name,i),checked:!!this.folder&&(0,k.isEqual)(this.folder.uri,e.uri),enabled:!0,class:void 0,run:()=>this._action.run(e)}})),e}labelWithCount(e,t){return t&&(e+=` (${t})`),e}};tz=(0,p.__decorate)([(0,p.__param)(1,tK.IWorkspaceContextService),(0,p.__param)(2,tC.IContextMenuService),(0,p.__param)(3,tO.IHoverService)],tz);let tB=class extends tT.Widget{constructor(e,t,i,o,r,s,n){super(),this.contextService=i,this.instantiationService=o,this.environmentService=r,this.labelService=s,this.languageService=n,this._settingsTarget=null,this._onDidTargetChange=this._register(new S.Emitter),this.onDidTargetChange=this._onDidTargetChange.event,this.options=t??{},this.create(e),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onWorkbenchStateChanged())),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.update()))}resetLabels(){let e=this.environmentService.remoteAuthority,t=e&&this.labelService.getHostLabel(e9.Schemas.vscodeRemote,e);this.userLocalSettings.label=(0,m.localize)(9964,"User"),this.userRemoteSettings.label=(0,m.localize)(9965,"Remote")+(t?` [${t}]`:""),this.workspaceSettings.label=(0,m.localize)(9966,"Workspace"),this.folderSettingsAction.label=(0,m.localize)(9967,"Folder")}create(e){let t=(0,C.append)(e,(0,C.$)(".settings-tabs-widget"));this.settingsSwitcherBar=this._register(new tE.ActionBar(t,{orientation:tE.ActionsOrientation.HORIZONTAL,focusOnlyEnabledItems:!0,ariaLabel:(0,m.localize)(9968,"Settings Switcher"),ariaRole:"tablist",actionViewItemProvider:(e,t)=>"folderSettings"===e.id?this.folderSettings:void 0})),this.userLocalSettings=this._register(new tA.Action("userSettings","",".settings-tab",!0,()=>this.updateTarget(tk.ConfigurationTarget.USER_LOCAL))),this.userLocalSettings.tooltip=(0,m.localize)(9964,"User"),this.userRemoteSettings=this._register(new tA.Action("userSettingsRemote","",".settings-tab",!0,()=>this.updateTarget(tk.ConfigurationTarget.USER_REMOTE)));let i=this.environmentService.remoteAuthority,o=i&&this.labelService.getHostLabel(e9.Schemas.vscodeRemote,i);this.userRemoteSettings.tooltip=(0,m.localize)(9965,"Remote")+(o?` [${o}]`:""),this.workspaceSettings=this._register(new tA.Action("workspaceSettings","",".settings-tab",!1,()=>this.updateTarget(tk.ConfigurationTarget.WORKSPACE))),this.folderSettingsAction=this._register(new tA.Action("folderSettings","",".settings-tab",!1,async e=>{this.updateTarget((0,tV.isWorkspaceFolder)(e)?e.uri:tk.ConfigurationTarget.USER_LOCAL)})),this.folderSettings=this._register(this.instantiationService.createInstance(tz,this.folderSettingsAction)),this.resetLabels(),this.update(),this.settingsSwitcherBar.push([this.userLocalSettings,this.userRemoteSettings,this.workspaceSettings,this.folderSettingsAction])}get settingsTarget(){return this._settingsTarget}set settingsTarget(e){this._settingsTarget=e,this.userLocalSettings.checked=tk.ConfigurationTarget.USER_LOCAL===this.settingsTarget,this.userRemoteSettings.checked=tk.ConfigurationTarget.USER_REMOTE===this.settingsTarget,this.workspaceSettings.checked=tk.ConfigurationTarget.WORKSPACE===this.settingsTarget,this.settingsTarget instanceof e8.URI?(this.folderSettings.action.checked=!0,this.folderSettings.folder=this.contextService.getWorkspaceFolder(this.settingsTarget)):this.folderSettings.action.checked=!1}setResultCount(e,t){if(e===tk.ConfigurationTarget.WORKSPACE){let e=(0,m.localize)(9966,"Workspace");t&&(e+=` (${t})`),this.workspaceSettings.label=e}else if(e===tk.ConfigurationTarget.USER_LOCAL){let e=(0,m.localize)(9964,"User");t&&(e+=` (${t})`),this.userLocalSettings.label=e}else e instanceof e8.URI&&this.folderSettings.setCount(e,t)}updateLanguageFilterIndicators(e){if(this.resetLabels(),e){let t=this.languageService.getLanguageName(e);if(t){let e=` [${t}]`;this.userLocalSettings.label+=e,this.userRemoteSettings.label+=e,this.workspaceSettings.label+=e,this.folderSettingsAction.label+=e}}}onWorkbenchStateChanged(){this.folderSettings.folder=null,this.update(),this.settingsTarget===tk.ConfigurationTarget.WORKSPACE&&this.contextService.getWorkbenchState()===tV.WorkbenchState.WORKSPACE&&this.updateTarget(tk.ConfigurationTarget.USER_LOCAL)}updateTarget(e){return this.settingsTarget===e||e instanceof e8.URI&&this.settingsTarget instanceof e8.URI&&(0,k.isEqual)(this.settingsTarget,e)||(this.settingsTarget=e,this._onDidTargetChange.fire(this.settingsTarget)),Promise.resolve(void 0)}async update(){this.settingsSwitcherBar.domNode.classList.toggle("empty-workbench",this.contextService.getWorkbenchState()===tV.WorkbenchState.EMPTY),this.userRemoteSettings.enabled=!!(this.options.enableRemoteSettings&&this.environmentService.remoteAuthority),this.workspaceSettings.enabled=this.contextService.getWorkbenchState()!==tV.WorkbenchState.EMPTY,this.folderSettings.action.enabled=this.contextService.getWorkbenchState()===tV.WorkbenchState.WORKSPACE&&this.contextService.getWorkspace().folders.length>0,this.workspaceSettings.tooltip=(0,m.localize)(9966,"Workspace")}};tB=(0,p.__decorate)([(0,p.__param)(2,tK.IWorkspaceContextService),(0,p.__param)(3,z.IInstantiationService),(0,p.__param)(4,tN.IWorkbenchEnvironmentService),(0,p.__param)(5,tP.ILabelService),(0,p.__param)(6,tx.ILanguageService)],tB);let tU=class extends tT.Widget{get onDidChange(){return this._onDidChange.event}get onFocus(){return this._onFocus.event}constructor(e,t,i,o,r,s){super(),this.options=t,this.contextViewService=i,this.instantiationService=o,this.contextKeyService=r,this.keybindingService=s,this._onDidChange=this._register(new S.Emitter),this._onFocus=this._register(new S.Emitter),this.create(e)}create(e){this.domNode=(0,C.append)(e,(0,C.$)("div.settings-header-widget")),this.createSearchContainer((0,C.append)(this.domNode,(0,C.$)("div.settings-search-container"))),this.controlsDiv=(0,C.append)(this.domNode,(0,C.$)("div.settings-search-controls")),this.options.showResultCount&&(this.countElement=(0,C.append)(this.controlsDiv,(0,C.$)(".settings-count-widget")),this.countElement.style.backgroundColor=(0,tb.asCssVariable)(tS.badgeBackground),this.countElement.style.color=(0,tb.asCssVariable)(tS.badgeForeground),this.countElement.style.border=`1px solid ${(0,tb.asCssVariable)(tw.contrastBorder)}`),this.inputBox.inputElement.setAttribute("aria-live",this.options.ariaLive||"off"),this.options.ariaLabelledBy&&this.inputBox.inputElement.setAttribute("aria-labelledBy",this.options.ariaLabelledBy);let t=this._register((0,C.trackFocus)(this.inputBox.inputElement));this._register(t.onDidFocus(()=>this._onFocus.fire()));let i=this.options.focusKey;i&&(this._register(t.onDidFocus(()=>i.set(!0))),this._register(t.onDidBlur(()=>i.set(!1))))}createSearchContainer(e){this.searchContainer=e;let t=(0,C.append)(this.searchContainer,(0,C.$)("div.settings-search-input"));this.inputBox=this._register(this.createInputBox(t)),this._register(this.inputBox.onDidChange(e=>this._onDidChange.fire(e)))}createInputBox(e){let t=()=>(0,tL.showHistoryKeybindingHint)(this.keybindingService);return new tM.ContextScopedHistoryInputBox(e,this.contextViewService,{...this.options,showHistoryHint:t},this.contextKeyService)}showMessage(e){this.countElement&&e!==this.countElement.textContent&&(this.countElement.textContent=e,this.inputBox.inputElement.setAttribute("aria-label",e),this.inputBox.inputElement.style.paddingRight=this.getControlsWidth()+"px")}layout(e){e.width<400?(this.countElement?.classList.add("hide"),this.inputBox.inputElement.style.paddingRight="0px"):(this.countElement?.classList.remove("hide"),this.inputBox.inputElement.style.paddingRight=this.getControlsWidth()+"px")}getControlsWidth(){return(this.countElement?(0,C.getTotalWidth)(this.countElement):0)+20}focus(){this.inputBox.focus(),this.getValue()&&this.inputBox.select()}hasFocus(){return this.inputBox.hasFocus()}clear(){this.inputBox.value=""}getValue(){return this.inputBox.value}setValue(e){return this.inputBox.value=e}dispose(){this.options.focusKey?.set(!1),super.dispose()}};tU=(0,p.__decorate)([(0,p.__param)(2,tC.IContextViewService),(0,p.__param)(3,z.IInstantiationService),(0,p.__param)(4,K.IContextKeyService),(0,p.__param)(5,ea.IKeybindingService)],tU),A.Disposable;var tH=e.i(490819);(0,tu.registerCss)(void 0);let t$=class extends tU{constructor(e,t,i,o,r,s){super(e,t,i,o,r,s),this.recordDisposables=this._register(new tp.DisposableStore),this._onKeybinding=this._register(new S.Emitter),this.onKeybinding=this._onKeybinding.event,this._onEnter=this._register(new S.Emitter),this.onEnter=this._onEnter.event,this._onEscape=this._register(new S.Emitter),this.onEscape=this._onEscape.event,this._onBlur=this._register(new S.Emitter),this.onBlur=this._onBlur.event,this._register((0,tp.toDisposable)(()=>this.stopRecordingKeys())),this._chords=null,this._inputValue=""}clear(){this._chords=null,super.clear()}startRecordingKeys(){this.recordDisposables.add((0,C.addDisposableListener)(this.inputBox.inputElement,C.EventType.KEY_DOWN,e=>this._onKeyDown(new b.StandardKeyboardEvent(e)))),this.recordDisposables.add((0,C.addDisposableListener)(this.inputBox.inputElement,C.EventType.BLUR,()=>this._onBlur.fire())),this.recordDisposables.add((0,C.addDisposableListener)(this.inputBox.inputElement,C.EventType.INPUT,()=>{this.setInputValue(this._inputValue)}))}stopRecordingKeys(){this._chords=null,this.recordDisposables.clear()}setInputValue(e){this._inputValue=e,this.inputBox.value=this._inputValue}_onKeyDown(e){(e.preventDefault(),e.stopPropagation(),!this.options.recordEnter&&e.equals(I.KeyCode.Enter))?this._onEnter.fire():e.equals(I.KeyCode.Escape)?this._onEscape.fire():this.printKeybinding(e)}printKeybinding(e){let t=this.keybindingService.resolveKeyboardEvent(e),i=`code: ${e.browserEvent.code}, keyCode: ${e.browserEvent.keyCode}, key: ${e.browserEvent.key} => UI: ${t.getAriaLabel()}, user settings: ${t.getUserSettingsLabel()}, dispatch: ${t.getDispatchChords()[0]}`,o=this.options;this._chords||(this._chords=[]),this._chords.length>0&&null===this._chords[this._chords.length-1].getDispatchChords()[0]?this._chords[this._chords.length-1]=t:(2===this._chords.length&&(this._chords=[]),this._chords.push(t));let r=this._chords.map(e=>e.getUserSettingsLabel()||"").join(" ");this.setInputValue(o.quoteRecordedKeys?`"${r}"`:r),this.inputBox.inputElement.title=i,this._onKeybinding.fire(this._chords)}};t$=(0,p.__decorate)([(0,p.__param)(2,tC.IContextViewService),(0,p.__param)(3,z.IInstantiationService),(0,p.__param)(4,K.IContextKeyService),(0,p.__param)(5,ea.IKeybindingService)],t$);let tq=class extends tm.Widget{static{a=this}static{this.WIDTH=400}static{this.HEIGHT=110}constructor(e,t){super(),this.instantiationService=t,this._keybindingDisposables=this._register(new tp.DisposableStore),this._chords=null,this._isVisible=!1,this._onHide=this._register(new S.Emitter),this._onDidChange=this._register(new S.Emitter),this.onDidChange=this._onDidChange.event,this._onShowExistingKeybindings=this._register(new S.Emitter),this.onShowExistingKeybidings=this._onShowExistingKeybindings.event,this._domNode=(0,ty.createFastDomNode)((0,C.createElement)("div")),this._domNode.setDisplay("none"),this._domNode.setClassName("defineKeybindingWidget"),this._domNode.setWidth(a.WIDTH),this._domNode.setHeight(a.HEIGHT);const i=(0,m.localize)(9834,"Press desired key combination and then press ENTER.");(0,C.append)(this._domNode.domNode,(0,C.$)(".message",void 0,i)),this._domNode.domNode.style.backgroundColor=(0,tb.asCssVariable)(tf.editorWidgetBackground),this._domNode.domNode.style.color=(0,tb.asCssVariable)(tf.editorWidgetForeground),this._domNode.domNode.style.boxShadow=`0 2px 8px ${(0,tb.asCssVariable)(tf.widgetShadow)}`,this._keybindingInputWidget=this._register(this.instantiationService.createInstance(t$,this._domNode.domNode,{ariaLabel:i,history:new Set([]),inputBoxStyles:tH.defaultInputBoxStyles})),this._keybindingInputWidget.startRecordingKeys(),this._register(this._keybindingInputWidget.onKeybinding(e=>this.onKeybinding(e))),this._register(this._keybindingInputWidget.onEnter(()=>this.hide())),this._register(this._keybindingInputWidget.onEscape(()=>this.clearOrHide())),this._register(this._keybindingInputWidget.onBlur(()=>this.onCancel())),this._outputNode=(0,C.append)(this._domNode.domNode,(0,C.$)(".output")),this._showExistingKeybindingsNode=(0,C.append)(this._domNode.domNode,(0,C.$)(".existing")),e&&(0,C.append)(e,this._domNode.domNode)}get domNode(){return this._domNode.domNode}define(){return this._keybindingInputWidget.clear(),f.Promises.withAsyncBody(async e=>{this._isVisible||(this._isVisible=!0,this._domNode.setDisplay("block"),this._chords=null,this._keybindingInputWidget.setInputValue(""),(0,C.clearNode)(this._outputNode),(0,C.clearNode)(this._showExistingKeybindingsNode),await (0,f.timeout)(0),this._keybindingInputWidget.focus());let t=this._onHide.event(()=>{e(this.getUserSettingsLabel()),t.dispose()})})}layout(e){let t=Math.round((e.height-a.HEIGHT)/2);this._domNode.setTop(t);let i=Math.round((e.width-a.WIDTH)/2);this._domNode.setLeft(i)}printExisting(e){if(e>0){let t=(0,C.$)("span.existingText"),i=1===e?(0,m.localize)(9835,"1 existing command has this keybinding",e):(0,m.localize)(9836,"{0} existing commands have this keybinding",e);(0,C.append)(t,(0,C.createTextNode)(i)),(0,tv.alert)(i),this._showExistingKeybindingsNode.appendChild(t),t.onmousedown=e=>{e.preventDefault()},t.onmouseup=e=>{e.preventDefault()},t.onclick=()=>{this._onShowExistingKeybindings.fire(this.getUserSettingsLabel())}}}onKeybinding(e){if(this._keybindingDisposables.clear(),this._chords=e,(0,C.clearNode)(this._outputNode),(0,C.clearNode)(this._showExistingKeybindingsNode),this._keybindingDisposables.add(new tg.KeybindingLabel(this._outputNode,R.OS,tH.defaultKeybindingLabelStyles)).set(this._chords?.[0]??void 0),this._chords)for(let e=1;e<this._chords.length;e++)this._outputNode.appendChild((0,C.createTextNode)((0,m.localize)(9837,"chord to"))),this._keybindingDisposables.add(new tg.KeybindingLabel(this._outputNode,R.OS,tH.defaultKeybindingLabelStyles)).set(this._chords[e]);let t=this.getUserSettingsLabel();t&&this._onDidChange.fire(t)}getUserSettingsLabel(){let e=null;return this._chords&&(e=this._chords.map(e=>e.getUserSettingsLabel()).join(" ")),e}onCancel(){this._chords=null,this.hide()}clearOrHide(){null===this._chords?this.hide():(this._chords=null,this._keybindingInputWidget.clear(),(0,C.clearNode)(this._outputNode),(0,C.clearNode)(this._showExistingKeybindingsNode))}hide(){this._domNode.setDisplay("none"),this._isVisible=!1,this._onHide.fire()}};tq=a=(0,p.__decorate)([(0,p.__param)(1,z.IInstantiationService)],tq);let tY=class extends tp.Disposable{static{d=this}static{this.ID="editor.contrib.defineKeybindingWidget"}constructor(e,t){super(),this._editor=e,this._widget=this._register(t.createInstance(tq,null)),this._editor.addOverlayWidget(this)}getId(){return d.ID}getDomNode(){return this._widget.domNode}getPosition(){return{preference:null}}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}start(){this._editor.hasModel()&&this._editor.revealPositionInCenterIfOutsideViewport(this._editor.getPosition(),t_.ScrollType.Smooth);let e=this._editor.getLayoutInfo();return this._widget.layout(new C.Dimension(e.width,e.height)),this._widget.define()}};tY=d=(0,p.__decorate)([(0,p.__param)(1,z.IInstantiationService)],tY);var tj=e.i(388064),tX=e.i(815033),tJ=e.i(535567);e.i(193391),(i=l||(l={})).Null="null",i.Enum="enum",i.String="string",i.MultilineString="multiline-string",i.Integer="integer",i.Number="number",i.Boolean="boolean",i.Array="array",i.Exclude="exclude",i.Include="include",i.Complex="complex",i.NullableInteger="nullable-integer",i.NullableNumber="nullable-number",i.Object="object",i.BooleanObject="boolean-object",i.LanguageTag="language-tag",i.ExtensionToggle="extension-toggle",i.ComplexObject="complex-object",(o=c||(c={}))[o.None=0]="None",o[o.LanguageTagSettingMatch=1]="LanguageTagSettingMatch",o[o.RemoteMatch=2]="RemoteMatch",o[o.NonContiguousQueryInSettingId=4]="NonContiguousQueryInSettingId",o[o.DescriptionOrValueMatch=8]="DescriptionOrValueMatch",o[o.NonContiguousWordsInSettingsLabel=16]="NonContiguousWordsInSettingsLabel",o[o.ContiguousWordsInSettingsLabel=32]="ContiguousWordsInSettingsLabel",o[o.ContiguousQueryInSettingId=64]="ContiguousQueryInSettingId",o[o.AllWordsInSettingsLabel=128]="AllWordsInSettingsLabel",o[o.ExactMatch=256]="ExactMatch",c.AllWordsInSettingsLabel,c.ContiguousWordsInSettingsLabel,c.NonContiguousWordsInSettingsLabel,c.NonContiguousQueryInSettingId,c.ContiguousQueryInSettingId;let tZ=(0,m.localize)(9871,"You won't be able to produce this key combination under your current keyboard layout."),tQ=class extends tn.Disposable{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._userDataProfileService=i,this._keybindingDecorationRenderer=this._register(new tn.MutableDisposable),this._defineWidget=this._register(this._instantiationService.createInstance(tY,this._editor)),this._register(this._editor.onDidChangeModel(e=>this._update())),this._update()}_update(){this._keybindingDecorationRenderer.value=t1(this._editor,this._userDataProfileService)?this._instantiationService.createInstance(t0,this._editor):void 0}showDefineKeybindingWidget(){t1(this._editor,this._userDataProfileService)&&this._defineWidget.start().then(e=>this._onAccepted(e))}_onAccepted(e){if(this._editor.focus(),e&&this._editor.hasModel()){new RegExp(/\\/g).test(e)&&(e=e.slice(0,-1)+"\\\\");let t=["{",' "key": '+JSON.stringify(e)+",",' "command": "${1:commandId}",\n "when": "${2:editorTextFocus}"\n}$0'].join("\n"),i=th.insertSnippet(this._editor.getModel(),this._editor.getPosition());t=i.prepend+t+i.append,this._editor.setPosition(i.position),tl.SnippetController2.get(this._editor)?.insert(t,{overwriteBefore:0,overwriteAfter:0})}}};tQ=(0,p.__decorate)([(0,p.__param)(1,z.IInstantiationService),(0,p.__param)(2,eb.IUserDataProfileService)],tQ);let t0=h=class extends tn.Disposable{constructor(e,t){super(),this._editor=e,this._keybindingService=t,this._dec=this._editor.createDecorationsCollection(),this._updateDecorations=this._register(new f.RunOnceScheduler(()=>this._updateDecorationsNow(),500));const i=(0,tJ.assertReturnsDefined)(this._editor.getModel());this._register(i.onDidChangeContent(()=>this._updateDecorations.schedule())),this._register(this._keybindingService.onDidUpdateKeybindings(()=>this._updateDecorations.schedule())),this._register({dispose:()=>{this._dec.clear(),this._updateDecorations.cancel()}}),this._updateDecorations.schedule()}_updateDecorationsNow(){let e=(0,tJ.assertReturnsDefined)(this._editor.getModel()),t=[],i=(0,_.parseTree)(e.getValue());if(i&&Array.isArray(i.children))for(let o=0,r=i.children.length;o<r;o++){let r=i.children[o],s=this._getDecorationForEntry(e,r);null!==s&&t.push(s)}this._dec.set(t)}_getDecorationForEntry(e,t){if(!Array.isArray(t.children))return null;for(let i=0,o=t.children.length;i<o;i++){let o=t.children[i];if("property"!==o.type||!Array.isArray(o.children)||2!==o.children.length||"key"!==o.children[0].value)continue;let r=o.children[1];if("string"!==r.type)continue;let s=this._keybindingService.resolveUserBinding(r.value);if(0===s.length)return this._createDecoration(!0,null,null,e,r);let n=s[0],a=null;if(n instanceof eG&&(a=n.getUSLabel()),!n.isWYSIWYG()){let t=n.getLabel();if("string"==typeof t&&r.value.toLowerCase()===t.toLowerCase())return null;return this._createDecoration(!1,n.getLabel(),a,e,r)}if(/abnt_|oem_/.test(r.value))return this._createDecoration(!1,n.getLabel(),a,e,r);let d=n.getUserSettingsLabel();if("string"==typeof d&&!h._userSettingsFuzzyEquals(r.value,d))return this._createDecoration(!1,n.getLabel(),a,e,r);break}return null}static _userSettingsFuzzyEquals(e,t){if(e=e.trim().toLowerCase(),t=t.trim().toLowerCase(),e===t)return!0;let i=T.parseKeybinding(e),o=T.parseKeybinding(t);return null===i&&null===o||!!i&&!!o&&i.equals(o)}_createDecoration(e,t,i,o,r){let s,n,a;e?(s=new en.MarkdownString().appendText(tZ),n="keybindingError",a=(0,tj.themeColorFromId)(tX.overviewRulerError)):(s=new en.MarkdownString(i&&t!==i?(0,m.localize)(9872,"**{0}** for your current keyboard layout (**{1}** for US standard).",t,i):(0,m.localize)(9873,"**{0}** for your current keyboard layout.",t)),n="keybindingInfo",a=(0,tj.themeColorFromId)(tX.overviewRulerInfo));let d=o.getPositionAt(r.offset),l=o.getPositionAt(r.offset+r.length);return{range:new ta.Range(d.lineNumber,d.column,l.lineNumber,l.column),options:{description:"keybindings-widget",stickiness:tR.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,className:n,hoverMessage:s,overviewRuler:{color:a,position:tR.OverviewRulerLane.Right}}}}};function t1(e,t){let i=e.getModel();return!!i&&(0,k.isEqual)(i.uri,t.currentProfile.keybindingsResource)}t0=h=(0,p.__decorate)([(0,p.__param)(1,ea.IKeybindingService)],t0),(0,td.registerEditorContribution)("editor.contrib.defineKeybinding",tQ,td.EditorContributionInstantiation.AfterFirstRender);var t2=L;class t3 extends t2.Action2{constructor(){super({id:"runCommands",title:(0,m.localize2)(6279,"Run Commands"),f1:!1,metadata:{description:(0,m.localize)(6280,"Run several commands"),args:[{name:"args",schema:{type:"object",required:["commands"],properties:{commands:{type:"array",description:(0,m.localize)(6281,"Commands to run"),items:{anyOf:[{$ref:"vscode://schemas/keybindings#/definitions/commandNames"},{type:"string"},{type:"object",required:["command"],properties:{command:{anyOf:[{$ref:"vscode://schemas/keybindings#/definitions/commandNames"},{type:"string"}]}},$ref:"vscode://schemas/keybindings#/definitions/commandsSchemas"}]}}}}}]}})}async run(e,t){let i=e.get(Y.INotificationService);if(!this._isCommandArgs(t))return void i.error((0,m.localize)(6282,"'runCommands' has received an argument with incorrect type. Please, review the argument passed to the command."));if(0===t.commands.length)return void i.warn((0,m.localize)(6283,"'runCommands' has not received commands to run. Did you forget to pass commands in the 'runCommands' argument?"));let o=e.get(P.ICommandService),r=e.get(q.ILogService),s=0;try{for(;s<t.commands.length;++s){let e=t.commands[s];r.debug(`runCommands: executing ${s}-th command: ${(0,x.safeStringify)(e)}`),await this._runCommand(o,e),r.debug(`runCommands: executed ${s}-th command`)}}catch(e){r.debug(`runCommands: executing ${s}-th command resulted in an error: ${e instanceof Error?e.message:(0,x.safeStringify)(e)}`),i.error(e)}}_isCommandArgs(e){if(!e||"object"!=typeof e||!("commands"in e)||!Array.isArray(e.commands))return!1;for(let t of e.commands)if("string"!=typeof t&&("object"!=typeof t||"string"!=typeof t.command))return!1;return!0}_runCommand(e,t){let i,o;return("string"==typeof t?i=t:(i=t.command,o=t.args),void 0===o)?e.executeCommand(i):Array.isArray(o)?e.executeCommand(i,...o):e.executeCommand(i,o)}}(0,t2.registerAction2)(t3),e.i(861593),e8.URI.from({scheme:e9.Schemas.vscodeUserData,path:"/User/keybindings.json"});let t5=class extends eT{constructor(e,t,i,o,r,s,n,a,d,l,c,h,u){super(i,o,r,s,n,a,d,l,c,h,u),this.shouldUseGlobalKeybindings=e,this._lockKeyCodesOverride=t,this.keybindingProviders=[],this.authorizedContainers=[]}registerKeybindingProvider(e){this.keybindingProviders.push(e),this.updateResolver();let t=new A.DisposableStore;return t.add(e.onDidChangeKeybindings(()=>{this.updateResolver()})),t.add((0,A.toDisposable)(()=>{let t=this.keybindingProviders.indexOf(e);t>=0&&(this.keybindingProviders.splice(t,1),this.updateResolver())})),t}_getResolver(){return super._getResolver()}registerContainer(e){let t=new A.DisposableStore;return t.add(super.registerContainer(e)),this.authorizedContainers.push(e),t.add((0,A.toDisposable)(()=>{this.authorizedContainers=this.authorizedContainers.filter(t=>t!=e)})),t}_dispatch(e,t){return!(!this.shouldUseGlobalKeybindings()&&this.authorizedContainers.every(t=>!t.contains(e.target)))&&super._dispatch(e,t)}getUserKeybindingItems(){return[...super.getUserKeybindingItems(),...this.keybindingProviders.flatMap(e=>e.provideKeybindings())]}lockKeyCodes(e){this._lockKeyCodesOverride(e,e=>super.lockKeyCodes(e))}};t5=(0,p.__decorate)([(0,p.__param)(2,K.IContextKeyService),(0,p.__param)(3,P.ICommandService),(0,p.__param)(4,X.ITelemetryService),(0,p.__param)(5,Y.INotificationService),(0,p.__param)(6,eb.IUserDataProfileService),(0,p.__param)(7,eC.IHostService),(0,p.__param)(8,ey.IExtensionService),(0,p.__param)(9,G.IFileService),(0,p.__param)(10,J.IUriIdentityService),(0,p.__param)(11,q.ILogService),(0,p.__param)(12,$.IKeyboardLayoutService)],t5),e.s(["default",0,function({shouldUseGlobalKeybindings:e=()=>!1,lockKeyCodesOverride:t=(e,t)=>{t(e)}}={}){return{...(0,e7.default)(),[ea.IKeybindingService.toString()]:new g.SyncDescriptor(t5,[e,t],!1),[$.IKeyboardLayoutService.toString()]:new g.SyncDescriptor(e2,[],!0),[P.ICommandService.toString()]:new g.SyncDescriptor(e4,[],!0)}}],211971);var t6=e.i(305063),t4=e.i(701575),t9=A,t8=e.i(443483),t7=e.i(193409),ie=A,it=e.i(802186),ii=e.i(682807);function io(e){return`${e}.hidden`}let ir=class extends ie.Disposable{constructor(e,t,i,o){super(),this.viewContainerName=t,this.storageService=i,this._onDidChangeStoredState=this._register(new S.Emitter),this.onDidChangeStoredState=this._onDidChangeStoredState.event,this.logger=new ii.Lazy(()=>o.createLogger(t6.VIEWS_LOG_ID,{name:t6.VIEWS_LOG_NAME,group:ti.windowLogGroup})),this.globalViewsStateStorageId=io(e),this.workspaceViewsStateStorageId=e,this._register(this.storageService.onDidChangeValue(t4.StorageScope.PROFILE,this.globalViewsStateStorageId,this._store)(()=>this.onDidStorageChange())),this.state=this.initialize()}set(e,t){this.state.set(e,t)}get(e){return this.state.get(e)}updateState(e){this.updateWorkspaceState(e),this.updateGlobalState(e)}updateWorkspaceState(e){let t=this.getStoredWorkspaceState();for(let i of e){let e=this.get(i.id);e&&(t[i.id]={collapsed:!!e.collapsed,isHidden:!e.visibleWorkspace,size:e.size,order:i.workspace&&e?e.order:void 0})}Object.keys(t).length>0?this.storageService.store(this.workspaceViewsStateStorageId,JSON.stringify(t),t4.StorageScope.WORKSPACE,t4.StorageTarget.MACHINE):this.storageService.remove(this.workspaceViewsStateStorageId,t4.StorageScope.WORKSPACE)}updateGlobalState(e){let t=this.getStoredGlobalState();for(let i of e){let e=this.get(i.id);t.set(i.id,{id:i.id,isHidden:!!e&&!!i.canToggleVisibility&&!e.visibleGlobal,order:!i.workspace&&e?e.order:void 0})}this.setStoredGlobalState(t)}onDidStorageChange(){if(this.globalViewsStatesValue!==this.getStoredGlobalViewsStatesValue()){this._globalViewsStatesValue=void 0;let e=this.getStoredGlobalState(),t=this.getStoredWorkspaceState(),i=[];for(let[o,r]of e){let e=this.get(o);if(e)!r.isHidden!==e.visibleGlobal&&(r.isHidden||this.logger.value.trace(`View visibility state changed: ${o} is now visible`,this.viewContainerName),i.push({id:o,visible:!r.isHidden}));else{let e=t[o];this.set(o,{active:!1,visibleGlobal:!r.isHidden,visibleWorkspace:(0,tJ.isUndefined)(e?.isHidden)?void 0:!e?.isHidden,collapsed:e?.collapsed,order:e?.order,size:e?.size})}}if(i.length)for(let e of(this._onDidChangeStoredState.fire(i),i)){let t=this.get(e.id);t&&(t.visibleGlobal=e.visible)}}}initialize(){let e=new Map,t=this.getStoredWorkspaceState();for(let i of Object.keys(t)){let o=t[i];e.set(i,{active:!1,visibleGlobal:void 0,visibleWorkspace:(0,tJ.isUndefined)(o.isHidden)?void 0:!o.isHidden,collapsed:o.collapsed,order:o.order,size:o.size})}let i=this.storageService.get(this.globalViewsStateStorageId,t4.StorageScope.WORKSPACE,"[]"),{state:o}=this.parseStoredGlobalState(i);if(o.size>0){for(let{id:t,isHidden:i}of o.values()){let o=e.get(t);o?(0,tJ.isUndefined)(o.visibleWorkspace)&&(o.visibleWorkspace=!i):e.set(t,{active:!1,collapsed:void 0,visibleGlobal:void 0,visibleWorkspace:!i})}this.storageService.remove(this.globalViewsStateStorageId,t4.StorageScope.WORKSPACE)}let{state:r,hasDuplicates:s}=this.parseStoredGlobalState(this.globalViewsStatesValue);for(let{id:t,isHidden:i,order:o}of(s&&this.setStoredGlobalState(r),r.values())){let r=e.get(t);r?(r.visibleGlobal=!i,(0,tJ.isUndefined)(o)||(r.order=o)):e.set(t,{active:!1,visibleGlobal:!i,order:o,collapsed:void 0,visibleWorkspace:void 0})}return e}getStoredWorkspaceState(){return JSON.parse(this.storageService.get(this.workspaceViewsStateStorageId,t4.StorageScope.WORKSPACE,"{}"))}getStoredGlobalState(){return this.parseStoredGlobalState(this.globalViewsStatesValue).state}setStoredGlobalState(e){this.globalViewsStatesValue=JSON.stringify([...e.values()])}parseStoredGlobalState(e){let t=JSON.parse(e),i=!1;return{state:t.reduce((e,t)=>("string"==typeof t?(i=i||e.has(t),e.set(t,{id:t,isHidden:!0})):(i=i||e.has(t.id),e.set(t.id,t)),e),new Map),hasDuplicates:i}}get globalViewsStatesValue(){return this._globalViewsStatesValue||(this._globalViewsStatesValue=this.getStoredGlobalViewsStatesValue()),this._globalViewsStatesValue}set globalViewsStatesValue(e){this.globalViewsStatesValue!==e&&(this._globalViewsStatesValue=e,this.setStoredGlobalViewsStatesValue(e))}getStoredGlobalViewsStatesValue(){return this.storageService.get(this.globalViewsStateStorageId,t4.StorageScope.PROFILE,"[]")}setStoredGlobalViewsStatesValue(e){this.storageService.store(this.globalViewsStateStorageId,e,t4.StorageScope.PROFILE,t4.StorageTarget.USER)}};ir=(0,p.__decorate)([(0,p.__param)(2,eZ.IStorageService),(0,p.__param)(3,q.ILoggerService)],ir);let is=class extends ie.Disposable{get title(){return this._title}get icon(){return this._icon}get keybindingId(){return this._keybindingId}get allViewDescriptors(){return this.viewDescriptorItems.map(e=>e.viewDescriptor)}get activeViewDescriptors(){return this.viewDescriptorItems.filter(e=>e.state.active).map(e=>e.viewDescriptor)}get visibleViewDescriptors(){return this.viewDescriptorItems.filter(e=>this.isViewDescriptorVisible(e)).map(e=>e.viewDescriptor)}constructor(e,t,i,o){if(super(),this.viewContainer=e,this.contextKeyService=i,this.contextKeys=new it.CounterSet,this.viewDescriptorItems=[],this._onDidChangeContainerInfo=this._register(new S.Emitter),this.onDidChangeContainerInfo=this._onDidChangeContainerInfo.event,this._onDidChangeAllViewDescriptors=this._register(new S.Emitter),this.onDidChangeAllViewDescriptors=this._onDidChangeAllViewDescriptors.event,this._onDidChangeActiveViewDescriptors=this._register(new S.Emitter),this.onDidChangeActiveViewDescriptors=this._onDidChangeActiveViewDescriptors.event,this._onDidAddVisibleViewDescriptors=this._register(new S.Emitter),this.onDidAddVisibleViewDescriptors=this._onDidAddVisibleViewDescriptors.event,this._onDidRemoveVisibleViewDescriptors=this._register(new S.Emitter),this.onDidRemoveVisibleViewDescriptors=this._onDidRemoveVisibleViewDescriptors.event,this._onDidMoveVisibleViewDescriptors=this._register(new S.Emitter),this.onDidMoveVisibleViewDescriptors=this._onDidMoveVisibleViewDescriptors.event,this._onDidChangeEnablement=this._register(new S.Emitter),this.onDidChangeEnablement=this._onDidChangeEnablement.event,e.when){const t=new it.CounterSet;for(const i of e.when.keys())t.add(i);this._register(S.Event.filter(i.onDidChangeContext,e=>e.affectsSome(t))(()=>this._onDidChangeEnablement.fire()))}this.logger=new ii.Lazy(()=>o.createLogger(t6.VIEWS_LOG_ID,{name:t6.VIEWS_LOG_NAME,group:ti.windowLogGroup})),this._register(S.Event.filter(i.onDidChangeContext,e=>e.affectsSome(this.contextKeys))(()=>this.onDidChangeContext())),this.viewDescriptorsState=this._register(t.createInstance(ir,e.storageId||`${e.id}.state`,"string"==typeof e.title?e.title:e.title.original)),this._register(this.viewDescriptorsState.onDidChangeStoredState(e=>this.updateVisibility(e))),this.updateContainerInfo()}updateContainerInfo(){let e=this.viewContainer.alwaysUseContainerInfo||0===this.visibleViewDescriptors.length||this.visibleViewDescriptors.some(e=>j.Registry.as(t6.Extensions.ViewsRegistry).getViewContainer(e.id)===this.viewContainer),t=e?"string"==typeof this.viewContainer.title?this.viewContainer.title:this.viewContainer.title.value:this.visibleViewDescriptors[0]?.containerTitle||this.visibleViewDescriptors[0]?.name?.value||"",i=!1;this._title!==t&&(this._title=t,i=!0);let o=e?this.viewContainer.icon:this.visibleViewDescriptors[0]?.containerIcon||t6.defaultViewIcon,r=!1;this.isEqualIcon(o)||(this._icon=o,r=!0);let s=this.viewContainer.openCommandActionDescriptor?.id??this.activeViewDescriptors.find(e=>e.openCommandActionDescriptor)?.openCommandActionDescriptor?.id,n=!1;this._keybindingId!==s&&(this._keybindingId=s,n=!0),(i||r||n)&&this._onDidChangeContainerInfo.fire({title:i,icon:r,keybindingId:n})}isEqualIcon(e){return e8.URI.isUri(e)?e8.URI.isUri(this._icon)&&(0,k.isEqual)(e,this._icon):ei.ThemeIcon.isThemeIcon(e)?ei.ThemeIcon.isThemeIcon(this._icon)&&ei.ThemeIcon.isEqual(e,this._icon):e===this._icon}isVisible(e){let t=this.viewDescriptorItems.find(t=>t.viewDescriptor.id===e);if(!t)throw Error(`Unknown view ${e}`);return this.isViewDescriptorVisible(t)}setVisible(e,t){this.updateVisibility([{id:e,visible:t}])}updateVisibility(e){let t=(0,Z.coalesce)(e.filter(({visible:e})=>!e).map(({id:e})=>this.findAndIgnoreIfNotFound(e))),i=[];for(let{viewDescriptorItem:e,visibleIndex:o}of t)this.updateViewDescriptorItemVisibility(e,!1)&&i.push({viewDescriptor:e.viewDescriptor,index:o});i.length&&this.broadCastRemovedVisibleViewDescriptors(i);let o=[];for(let{id:t,visible:i}of e){if(!i)continue;let e=this.findAndIgnoreIfNotFound(t);if(!e)continue;let{viewDescriptorItem:r,visibleIndex:s}=e;this.updateViewDescriptorItemVisibility(r,!0)&&o.push({index:s,viewDescriptor:r.viewDescriptor,size:r.state.size,collapsed:!!r.state.collapsed})}o.length&&this.broadCastAddedVisibleViewDescriptors(o)}updateViewDescriptorItemVisibility(e,t){return!!e.viewDescriptor.canToggleVisibility&&this.isViewDescriptorVisibleWhenActive(e)!==t&&(e.viewDescriptor.workspace?e.state.visibleWorkspace=t:(e.state.visibleGlobal=t,t&&this.logger.value.trace(`Showing view ${e.viewDescriptor.id} in the container ${this.viewContainer.id}`)),this.isViewDescriptorVisible(e)===t)}isCollapsed(e){return!!this.find(e).viewDescriptorItem.state.collapsed}setCollapsed(e,t){let{viewDescriptorItem:i}=this.find(e);i.state.collapsed!==t&&(i.state.collapsed=t),this.viewDescriptorsState.updateState(this.allViewDescriptors)}getSize(e){return this.find(e).viewDescriptorItem.state.size}setSizes(e){for(let{id:t,size:i}of e){let{viewDescriptorItem:e}=this.find(t);e.state.size!==i&&(e.state.size=i)}this.viewDescriptorsState.updateState(this.allViewDescriptors)}move(e,t){let i=this.viewDescriptorItems.findIndex(t=>t.viewDescriptor.id===e),o=this.viewDescriptorItems.findIndex(e=>e.viewDescriptor.id===t),r=this.viewDescriptorItems[i],s=this.viewDescriptorItems[o];(0,Z.move)(this.viewDescriptorItems,i,o);for(let e=0;e<this.viewDescriptorItems.length;e++)this.viewDescriptorItems[e].state.order=e;this.broadCastMovedViewDescriptors({index:i,viewDescriptor:r.viewDescriptor},{index:o,viewDescriptor:s.viewDescriptor})}add(e){let t=[];for(let i of e){let e=i.viewDescriptor;if(e.when)for(let t of e.when.keys())this.contextKeys.add(t);let o=this.viewDescriptorsState.get(e.id);if(o){if(e.workspace)o.visibleWorkspace=(0,tJ.isUndefinedOrNull)(i.visible)?(0,tJ.isUndefinedOrNull)(o.visibleWorkspace)?!e.hideByDefault:o.visibleWorkspace:i.visible;else{let t=o.visibleGlobal;o.visibleGlobal=(0,tJ.isUndefinedOrNull)(i.visible)?(0,tJ.isUndefinedOrNull)(o.visibleGlobal)?!e.hideByDefault:o.visibleGlobal:i.visible,o.visibleGlobal&&!t&&this.logger.value.trace(`Added view ${e.id} in the container ${this.viewContainer.id} and showing it.`,`${t}`,`${e.hideByDefault}`,`${i.visible}`)}o.collapsed=(0,tJ.isUndefinedOrNull)(i.collapsed)?(0,tJ.isUndefinedOrNull)(o.collapsed)?!!e.collapsed:o.collapsed:i.collapsed}else o={active:!1,visibleGlobal:(0,tJ.isUndefinedOrNull)(i.visible)?!e.hideByDefault:i.visible,visibleWorkspace:(0,tJ.isUndefinedOrNull)(i.visible)?!e.hideByDefault:i.visible,collapsed:(0,tJ.isUndefinedOrNull)(i.collapsed)?!!e.collapsed:i.collapsed};this.viewDescriptorsState.set(e.id,o),o.active=this.contextKeyService.contextMatchesRules(e.when),t.push({viewDescriptor:e,state:o})}this.viewDescriptorItems.push(...t),this.viewDescriptorItems.sort(this.compareViewDescriptors.bind(this)),this._onDidChangeAllViewDescriptors.fire({added:t.map(({viewDescriptor:e})=>e),removed:[]});let i=[];for(let e of t)e.state.active&&i.push({viewDescriptorItem:e,visible:this.isViewDescriptorVisible(e)});i.length&&this._onDidChangeActiveViewDescriptors.fire({added:i.map(({viewDescriptorItem:e})=>e.viewDescriptor),removed:[]});let o=[];for(let{viewDescriptorItem:e,visible:t}of i)if(t&&this.isViewDescriptorVisible(e)){let{visibleIndex:t}=this.find(e.viewDescriptor.id);o.push({index:t,viewDescriptor:e.viewDescriptor,size:e.state.size,collapsed:!!e.state.collapsed})}this.broadCastAddedVisibleViewDescriptors(o)}remove(e){let t=[],i=[],o=[],r=[];for(let s of e){if(s.when)for(let e of s.when.keys())this.contextKeys.delete(e);let e=this.viewDescriptorItems.findIndex(e=>e.viewDescriptor.id===s.id);if(-1!==e){t.push(s);let n=this.viewDescriptorItems[e];if(n.state.active&&o.push(n.viewDescriptor),this.isViewDescriptorVisible(n)){let{visibleIndex:e}=this.find(n.viewDescriptor.id);r.push({index:e,viewDescriptor:n.viewDescriptor})}i.push(n)}}i.forEach(e=>this.viewDescriptorItems.splice(this.viewDescriptorItems.indexOf(e),1)),this.broadCastRemovedVisibleViewDescriptors(r),o.length&&this._onDidChangeActiveViewDescriptors.fire({added:[],removed:o}),t.length&&this._onDidChangeAllViewDescriptors.fire({added:[],removed:t})}onDidChangeContext(){let e=[],t=[];for(let i of this.viewDescriptorItems){let o=i.state.active,r=this.contextKeyService.contextMatchesRules(i.viewDescriptor.when);o!==r&&(r?e.push({item:i,visibleWhenActive:this.isViewDescriptorVisibleWhenActive(i)}):t.push(i))}let i=[];for(let e of t)if(this.isViewDescriptorVisible(e)){let{visibleIndex:t}=this.find(e.viewDescriptor.id);i.push({index:t,viewDescriptor:e.viewDescriptor})}t.forEach(e=>e.state.active=!1),e.forEach(({item:e})=>e.state.active=!0),this.broadCastRemovedVisibleViewDescriptors(i),(e.length||t.length)&&this._onDidChangeActiveViewDescriptors.fire({added:e.map(({item:e})=>e.viewDescriptor),removed:t.map(e=>e.viewDescriptor)});let o=[];for(let{item:t,visibleWhenActive:i}of e)if(i&&this.isViewDescriptorVisible(t)){let{visibleIndex:e}=this.find(t.viewDescriptor.id);o.push({index:e,viewDescriptor:t.viewDescriptor,size:t.state.size,collapsed:!!t.state.collapsed})}this.broadCastAddedVisibleViewDescriptors(o)}broadCastAddedVisibleViewDescriptors(e){e.length&&(this._onDidAddVisibleViewDescriptors.fire(e.sort((e,t)=>e.index-t.index)),this.updateState(`Added views:${e.map(e=>e.viewDescriptor.id).join(",")} in ${this.viewContainer.id}`))}broadCastRemovedVisibleViewDescriptors(e){e.length&&(this._onDidRemoveVisibleViewDescriptors.fire(e.sort((e,t)=>t.index-e.index)),this.updateState(`Removed views:${e.map(e=>e.viewDescriptor.id).join(",")} from ${this.viewContainer.id}`))}broadCastMovedViewDescriptors(e,t){this._onDidMoveVisibleViewDescriptors.fire({from:e,to:t}),this.updateState(`Moved view ${e.viewDescriptor.id} to ${t.viewDescriptor.id} in ${this.viewContainer.id}`)}updateState(e){this.logger.value.trace(e),this.viewDescriptorsState.updateState(this.allViewDescriptors),this.updateContainerInfo()}isViewDescriptorVisible(e){return!!e.state.active&&this.isViewDescriptorVisibleWhenActive(e)}isViewDescriptorVisibleWhenActive(e){return e.viewDescriptor.workspace?!!e.state.visibleWorkspace:!!e.state.visibleGlobal}find(e){let t=this.findAndIgnoreIfNotFound(e);if(t)return t;throw Error(`view descriptor ${e} not found`)}findAndIgnoreIfNotFound(e){for(let t=0,i=0;t<this.viewDescriptorItems.length;t++){let o=this.viewDescriptorItems[t];if(o.viewDescriptor.id===e)return{index:t,visibleIndex:i,viewDescriptorItem:o};this.isViewDescriptorVisible(o)&&i++}}compareViewDescriptors(e,t){return e.viewDescriptor.id===t.viewDescriptor.id?0:this.getViewOrder(e)-this.getViewOrder(t)||this.getGroupOrderResult(e.viewDescriptor,t.viewDescriptor)}getViewOrder(e){let t="number"==typeof e.state.order?e.state.order:e.viewDescriptor.order;return"number"==typeof t?t:Number.MAX_VALUE}getGroupOrderResult(e,t){return e.group&&t.group&&e.group!==t.group?e.group<t.group?-1:1:0}};is=(0,p.__decorate)([(0,p.__param)(1,z.IInstantiationService),(0,p.__param)(2,K.IContextKeyService),(0,p.__param)(3,q.ILoggerService)],is);var ia=L,id=e.i(99419);function il(e){return`${e}.state`}let ic=class extends t9.Disposable{static{u=this}static{this.VIEWS_CUSTOMIZATIONS="views.customizations"}static{this.COMMON_CONTAINER_ID_PREFIX="workbench.views.service"}get viewContainers(){return this.viewContainersRegistry.all}constructor(e,t,i,o,r,s){super(),this.instantiationService=e,this.contextKeyService=t,this.storageService=i,this.extensionService=o,this.telemetryService=r,this._onDidChangeContainer=this._register(new S.Emitter),this.onDidChangeContainer=this._onDidChangeContainer.event,this._onDidChangeLocation=this._register(new S.Emitter),this.onDidChangeLocation=this._onDidChangeLocation.event,this._onDidChangeContainerLocation=this._register(new S.Emitter),this.onDidChangeContainerLocation=this._onDidChangeContainerLocation.event,this.viewContainerModels=this._register(new t9.DisposableMap),this.viewsVisibilityActionDisposables=this._register(new t9.DisposableMap),this.canRegisterViewsVisibilityActions=!1,this._onDidChangeViewContainers=this._register(new S.Emitter),this.onDidChangeViewContainers=this._onDidChangeViewContainers.event,this.logger=new ii.Lazy(()=>s.createLogger(t6.VIEWS_LOG_ID,{name:t6.VIEWS_LOG_NAME,group:ti.windowLogGroup})),this.activeViewContextKeys=new Map,this.movableViewContextKeys=new Map,this.defaultViewLocationContextKeys=new Map,this.defaultViewContainerLocationContextKeys=new Map,this.viewContainersRegistry=j.Registry.as(t6.Extensions.ViewContainersRegistry),this.viewsRegistry=j.Registry.as(t6.Extensions.ViewsRegistry),this.migrateToViewsCustomizationsStorage(),this.viewContainersCustomLocations=new Map(Object.entries(this.viewCustomizations.viewContainerLocations)),this.viewDescriptorsCustomLocations=new Map(Object.entries(this.viewCustomizations.viewLocations)),this.viewContainerBadgeEnablementStates=new Map(Object.entries(this.viewCustomizations.viewContainerBadgeEnablementStates)),this.viewContainers.forEach(e=>this.onDidRegisterViewContainer(e)),this._register(this.viewsRegistry.onViewsRegistered(e=>this.onDidRegisterViews(e))),this._register(this.viewsRegistry.onViewsDeregistered(({views:e,viewContainer:t})=>this.onDidDeregisterViews(e,t))),this._register(this.viewsRegistry.onDidChangeContainer(({views:e,from:t,to:i})=>this.onDidChangeDefaultContainer(e,t,i))),this._register(this.viewContainersRegistry.onDidRegister(({viewContainer:e})=>{this.onDidRegisterViewContainer(e),this._onDidChangeViewContainers.fire({added:[{container:e,location:this.getViewContainerLocation(e)}],removed:[]})})),this._register(this.viewContainersRegistry.onDidDeregister(({viewContainer:e,viewContainerLocation:t})=>{this.onDidDeregisterViewContainer(e),this._onDidChangeViewContainers.fire({removed:[{container:e,location:t}],added:[]})})),this._register(this.storageService.onDidChangeValue(t4.StorageScope.PROFILE,u.VIEWS_CUSTOMIZATIONS,this._store)(()=>this.onDidStorageChange())),this.extensionService.whenInstalledExtensionsRegistered().then(()=>this.whenExtensionsRegistered())}migrateToViewsCustomizationsStorage(){if(this.storageService.get(u.VIEWS_CUSTOMIZATIONS,t4.StorageScope.PROFILE))return;let e=this.storageService.get("views.cachedViewContainerLocations",t4.StorageScope.PROFILE),t=this.storageService.get("views.cachedViewPositions",t4.StorageScope.PROFILE);if(!e&&!t)return;let i=e?JSON.parse(e):[],o=t?JSON.parse(t):[],r={viewContainerLocations:i.reduce((e,[t,i])=>(e[t]=i,e),{}),viewLocations:o.reduce((e,[t,{containerId:i}])=>(e[t]=i,e),{}),viewContainerBadgeEnablementStates:{}};this.storageService.store(u.VIEWS_CUSTOMIZATIONS,JSON.stringify(r),t4.StorageScope.PROFILE,t4.StorageTarget.USER),this.storageService.remove("views.cachedViewContainerLocations",t4.StorageScope.PROFILE),this.storageService.remove("views.cachedViewPositions",t4.StorageScope.PROFILE)}registerGroupedViews(e){for(let[t,i]of e.entries()){let e=this.viewContainersRegistry.get(t);if(!e||!this.viewContainerModels.has(e)){if(this.isGeneratedContainerId(t)){let e=this.viewContainersCustomLocations.get(t);void 0!==e&&this.registerGeneratedViewContainer(e,t)}continue}let o=i.filter(t=>0===this.getViewContainerModel(e).allViewDescriptors.filter(e=>e.id===t.id).length);this.addViews(e,o)}}deregisterGroupedViews(e){for(let[t,i]of e.entries()){let e=this.viewContainersRegistry.get(t);e&&this.viewContainerModels.has(e)&&this.removeViews(e,i)}}moveOrphanViewsToDefaultLocation(){for(let[e,t]of this.viewDescriptorsCustomLocations.entries()){if(this.viewContainersRegistry.get(t))continue;let i=this.viewsRegistry.getViewContainer(e),o=this.getViewDescriptorById(e);i&&o&&this.addViews(i,[o])}}whenExtensionsRegistered(){for(let e of(this.moveOrphanViewsToDefaultLocation(),[...this.viewContainersCustomLocations.keys()]))this.cleanUpGeneratedViewContainer(e);for(let[e,t]of(this.saveViewCustomizations(),this.viewContainerModels))this.registerViewsVisibilityActions(e,t);this.canRegisterViewsVisibilityActions=!0}onDidRegisterViews(e){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(({views:e,viewContainer:t})=>{let i=this.regroupViews(t.id,e);this.registerGroupedViews(i),e.forEach(e=>this.getOrCreateMovableViewContextKey(e).set(!!e.canMoveView))})})}isGeneratedContainerId(e){return e.startsWith(u.COMMON_CONTAINER_ID_PREFIX)}onDidDeregisterViews(e,t){let i=this.regroupViews(t.id,e);this.deregisterGroupedViews(i),this.contextKeyService.bufferChangeEvents(()=>{e.forEach(e=>this.getOrCreateMovableViewContextKey(e).set(!1))})}regroupViews(e,t){let i=new Map;for(let o of t){let t=this.viewDescriptorsCustomLocations.get(o.id)??e,r=i.get(t);r||i.set(t,r=[]),r.push(o)}return i}getViewDescriptorById(e){return this.viewsRegistry.getView(e)}getViewLocationById(e){let t=this.getViewContainerByViewId(e);return null===t?null:this.getViewContainerLocation(t)}getViewContainerByViewId(e){let t=this.viewDescriptorsCustomLocations.get(e);return t?this.viewContainersRegistry.get(t)??null:this.getDefaultContainerById(e)}getViewContainerLocation(e){return this.viewContainersCustomLocations.get(e.id)??this.getDefaultViewContainerLocation(e)}getDefaultViewContainerLocation(e){return this.viewContainersRegistry.getViewContainerLocation(e)}getDefaultContainerById(e){return this.viewsRegistry.getViewContainer(e)??null}getViewContainerModel(e){return this.getOrRegisterViewContainerModel(e)}getViewContainerById(e){return this.viewContainersRegistry.get(e)||null}getViewContainersByLocation(e){return this.viewContainers.filter(t=>this.getViewContainerLocation(t)===e)}getDefaultViewContainer(e){return this.viewContainersRegistry.getDefaultViewContainer(e)}moveViewContainerToLocation(e,t,i,o){this.logger.value.trace(`moveViewContainerToLocation: viewContainer:${e.id} location:${t} reason:${o}`),this.moveViewContainerToLocationWithoutSaving(e,t,i),this.saveViewCustomizations()}getViewContainerBadgeEnablementState(e){return this.viewContainerBadgeEnablementStates.get(e)??!0}setViewContainerBadgeEnablementState(e,t){this.viewContainerBadgeEnablementStates.set(e,t),this.saveViewCustomizations()}moveViewToLocation(e,t,i){this.logger.value.trace(`moveViewToLocation: view:${e.id} location:${t} reason:${i}`);let o=this.registerGeneratedViewContainer(t);this.moveViewsToContainer([e],o)}moveViewsToContainer(e,t,i,o){if(!e.length)return;this.logger.value.trace(`moveViewsToContainer: views:${e.map(e=>e.id).join(",")} viewContainer:${t.id} reason:${o}`);let r=this.getViewContainerByViewId(e[0].id);r&&t&&r!==t&&(this.moveViewsWithoutSaving(e,r,t,i),this.cleanUpGeneratedViewContainer(r.id),this.saveViewCustomizations(),this.reportMovedViews(e,r,t))}reset(){for(let e of this.viewContainers){for(let t of this.getViewContainerModel(e).allViewDescriptors){let e=this.getDefaultContainerById(t.id),i=this.getViewContainerByViewId(t.id);i&&e&&i!==e&&this.moveViewsWithoutSaving([t],i,e)}let t=this.getDefaultViewContainerLocation(e),i=this.getViewContainerLocation(e);null!==t&&i!==t&&this.moveViewContainerToLocationWithoutSaving(e,t),this.cleanUpGeneratedViewContainer(e.id)}this.viewContainersCustomLocations.clear(),this.viewDescriptorsCustomLocations.clear(),this.saveViewCustomizations()}isViewContainerRemovedPermanently(e){return this.isGeneratedContainerId(e)&&!this.viewContainersCustomLocations.has(e)}onDidChangeDefaultContainer(e,t,i){let o=e.filter(e=>!this.viewDescriptorsCustomLocations.has(e.id)||!this.viewContainers.includes(t)&&this.viewDescriptorsCustomLocations.get(e.id)===t.id);o.length&&this.moveViewsWithoutSaving(o,t,i)}reportMovedViews(e,t,i){let o=e=>e.id.startsWith(u.COMMON_CONTAINER_ID_PREFIX)?"custom":e.extensionId?"extension":e.id,r=this.getViewContainerLocation(t),s=this.getViewContainerLocation(i),n=e.length,a=o(t),d=o(i),l=r===t6.ViewContainerLocation.Panel?"panel":"sidebar",c=s===t6.ViewContainerLocation.Panel?"panel":"sidebar";this.telemetryService.publicLog2("viewDescriptorService.moveViews",{viewCount:n,fromContainer:a,toContainer:d,fromLocation:l,toLocation:c})}moveViewsWithoutSaving(e,t,i,o=t6.ViewVisibilityState.Expand){this.removeViews(t,e),this.addViews(i,e,o);let r=this.getViewContainerLocation(t),s=this.getViewContainerLocation(i);r!==s&&this._onDidChangeLocation.fire({views:e,from:r,to:s}),this._onDidChangeContainer.fire({views:e,from:t,to:i})}moveViewContainerToLocationWithoutSaving(e,t,i){let o=this.getViewContainerLocation(e);if(o!==t){let r=this.isGeneratedContainerId(e.id),s=t===this.getDefaultViewContainerLocation(e);r||!s?this.viewContainersCustomLocations.set(e.id,t):this.viewContainersCustomLocations.delete(e.id),this.getOrCreateDefaultViewContainerLocationContextKey(e).set(r||s),e.requestedIndex=i,this._onDidChangeContainerLocation.fire({viewContainer:e,from:o,to:t});let n=this.getViewsByContainer(e);this._onDidChangeLocation.fire({views:n,from:o,to:t})}}cleanUpGeneratedViewContainer(e){if(!this.isGeneratedContainerId(e))return;let t=this.getViewContainerById(e);t&&this.getViewContainerModel(t)?.allViewDescriptors.length||[...this.viewDescriptorsCustomLocations.values()].includes(e)||(t&&this.viewContainersRegistry.deregisterViewContainer(t),this.viewContainersCustomLocations.delete(e),this.viewContainerBadgeEnablementStates.delete(e),this.storageService.remove(io(t?.storageId||il(e)),t4.StorageScope.PROFILE))}registerGeneratedViewContainer(e,t){let i=t||this.generateContainerId(e),o=this.viewContainersRegistry.registerViewContainer({id:i,ctorDescriptor:new g.SyncDescriptor(t8.ViewPaneContainer,[i,{mergeViewWithContainerWhenSingleView:!0}]),title:{value:(0,m.localize)(14611,"User View Container"),original:"User View Container"},icon:e===t6.ViewContainerLocation.Sidebar?t6.defaultViewIcon:void 0,storageId:il(i),hideIfEmpty:!0},e,{doNotRegisterOpenCommand:!0});return this.viewContainersCustomLocations.get(o.id)!==e&&this.viewContainersCustomLocations.set(o.id,e),this.getOrCreateDefaultViewContainerLocationContextKey(o).set(!0),o}onDidStorageChange(){JSON.stringify(this.viewCustomizations)!==this.getStoredViewCustomizationsValue()&&this.onDidViewCustomizationsStorageChange()}onDidViewCustomizationsStorageChange(){this._viewCustomizations=void 0;let e=new Map(Object.entries(this.viewCustomizations.viewContainerLocations)),t=new Map(Object.entries(this.viewCustomizations.viewLocations)),i=[],o=[];for(let[t,o]of e.entries()){let e=this.getViewContainerById(t);e?o!==this.getViewContainerLocation(e)&&i.push([e,o]):this.isGeneratedContainerId(t)&&this.registerGeneratedViewContainer(o,t)}for(let t of this.viewContainers)if(!e.has(t.id)){let e=this.getViewContainerLocation(t),o=this.getDefaultViewContainerLocation(t);e!==o&&i.push([t,o])}for(let[e,i]of t.entries()){let t=this.getViewDescriptorById(e);if(t){let r=this.getViewContainerByViewId(e),s=this.viewContainersRegistry.get(i);r&&s&&s!==r&&o.push({views:[t],from:r,to:s})}}for(let e of this.viewContainers)for(let i of this.getViewContainerModel(e).allViewDescriptors)if(!t.has(i.id)){let e=this.getViewContainerByViewId(i.id),t=this.getDefaultContainerById(i.id);e&&t&&e!==t&&o.push({views:[i],from:e,to:t})}for(let[e,t]of i)this.moveViewContainerToLocationWithoutSaving(e,t);for(let{views:e,from:t,to:i}of o)this.moveViewsWithoutSaving(e,t,i,t6.ViewVisibilityState.Default);this.viewContainersCustomLocations=e,this.viewDescriptorsCustomLocations=t}generateContainerId(e){return`${u.COMMON_CONTAINER_ID_PREFIX}.${(0,t6.ViewContainerLocationToString)(e)}.${(0,t7.generateUuid)()}`}saveViewCustomizations(){let e={viewContainerLocations:{},viewLocations:{},viewContainerBadgeEnablementStates:{}};for(let[t,i]of this.viewContainersCustomLocations){let o=this.getViewContainerById(t);(!o||this.isGeneratedContainerId(t)||i!==this.getDefaultViewContainerLocation(o))&&(e.viewContainerLocations[t]=i)}for(let[t,i]of this.viewDescriptorsCustomLocations){let o=this.getViewContainerById(i);if(o){let e=this.getDefaultContainerById(t);if(e?.id===o.id)continue}e.viewLocations[t]=i}for(let[t,i]of this.viewContainerBadgeEnablementStates)!1===i&&(e.viewContainerBadgeEnablementStates[t]=i);this.viewCustomizations=e}get viewCustomizations(){return this._viewCustomizations||(this._viewCustomizations=JSON.parse(this.getStoredViewCustomizationsValue()),this._viewCustomizations.viewContainerLocations=this._viewCustomizations.viewContainerLocations??{},this._viewCustomizations.viewLocations=this._viewCustomizations.viewLocations??{},this._viewCustomizations.viewContainerBadgeEnablementStates=this._viewCustomizations.viewContainerBadgeEnablementStates??{}),this._viewCustomizations}set viewCustomizations(e){let t=JSON.stringify(e);JSON.stringify(this.viewCustomizations)!==t&&(this._viewCustomizations=e,this.setStoredViewCustomizationsValue(t))}getStoredViewCustomizationsValue(){return this.storageService.get(u.VIEWS_CUSTOMIZATIONS,t4.StorageScope.PROFILE,"{}")}setStoredViewCustomizationsValue(e){this.storageService.store(u.VIEWS_CUSTOMIZATIONS,e,t4.StorageScope.PROFILE,t4.StorageTarget.USER)}getViewsByContainer(e){let t=this.viewsRegistry.getViews(e).filter(t=>(this.viewDescriptorsCustomLocations.get(t.id)??e.id)===e.id);for(let[i,o]of this.viewDescriptorsCustomLocations.entries()){if(o!==e.id||this.viewsRegistry.getViewContainer(i)===e)continue;let r=this.getViewDescriptorById(i);r&&t.push(r)}return t}onDidRegisterViewContainer(e){let t=!!this.isGeneratedContainerId(e.id)||this.getViewContainerLocation(e)===this.getDefaultViewContainerLocation(e);this.getOrCreateDefaultViewContainerLocationContextKey(e).set(t),this.getOrRegisterViewContainerModel(e)}getOrRegisterViewContainerModel(e){let t=this.viewContainerModels.get(e)?.viewContainerModel;if(!t){let i=new t9.DisposableStore;t=i.add(this.instantiationService.createInstance(is,e)),this.onDidChangeActiveViews({added:t.activeViewDescriptors,removed:[]}),t.onDidChangeActiveViewDescriptors(e=>this.onDidChangeActiveViews(e),this,i),this.onDidChangeVisibleViews({added:[...t.visibleViewDescriptors],removed:[]}),t.onDidAddVisibleViewDescriptors(e=>this.onDidChangeVisibleViews({added:e.map(({viewDescriptor:e})=>e),removed:[]}),this,i),t.onDidRemoveVisibleViewDescriptors(e=>this.onDidChangeVisibleViews({added:[],removed:e.map(({viewDescriptor:e})=>e)}),this,i),i.add((0,t9.toDisposable)(()=>this.viewsVisibilityActionDisposables.deleteAndDispose(e))),i.add(this.registerResetViewContainerAction(e));let o={viewContainerModel:t,disposables:i,dispose:()=>i.dispose()};this.viewContainerModels.set(e,o),this.onDidRegisterViews([{views:this.viewsRegistry.getViews(e),viewContainer:e}]);let r=this.getViewsByContainer(e).filter(t=>this.getDefaultContainerById(t.id)!==e);r.length&&(this.addViews(e,r),this.contextKeyService.bufferChangeEvents(()=>{r.forEach(e=>this.getOrCreateMovableViewContextKey(e).set(!!e.canMoveView))})),this.canRegisterViewsVisibilityActions&&this.registerViewsVisibilityActions(e,o)}return t}onDidDeregisterViewContainer(e){this.viewContainerModels.deleteAndDispose(e),this.viewsVisibilityActionDisposables.deleteAndDispose(e)}onDidChangeActiveViews({added:e,removed:t}){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(e=>this.getOrCreateActiveViewContextKey(e).set(!0)),t.forEach(e=>this.getOrCreateActiveViewContextKey(e).set(!1))})}onDidChangeVisibleViews({added:e,removed:t}){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(e=>this.getOrCreateVisibleViewContextKey(e).set(!0)),t.forEach(e=>this.getOrCreateVisibleViewContextKey(e).set(!1))})}registerViewsVisibilityActions(e,{viewContainerModel:t,disposables:i}){this.viewsVisibilityActionDisposables.deleteAndDispose(e),this.viewsVisibilityActionDisposables.set(e,this.registerViewsVisibilityActionsForContainer(t)),i.add(S.Event.any(t.onDidChangeActiveViewDescriptors,t.onDidAddVisibleViewDescriptors,t.onDidRemoveVisibleViewDescriptors,t.onDidMoveVisibleViewDescriptors)(i=>{this.viewsVisibilityActionDisposables.deleteAndDispose(e),this.viewsVisibilityActionDisposables.set(e,this.registerViewsVisibilityActionsForContainer(t))}))}registerViewsVisibilityActionsForContainer(e){let t=new t9.DisposableStore;return e.activeViewDescriptors.forEach((i,o)=>{i.remoteAuthority||(t.add((0,ia.registerAction2)(class extends t8.ViewPaneContainerAction{constructor(){super({id:`${i.id}.toggleVisibility`,viewPaneContainerId:e.viewContainer.id,precondition:i.canToggleVisibility&&(!e.isVisible(i.id)||e.visibleViewDescriptors.length>1)?V.ContextKeyExpr.true():V.ContextKeyExpr.false(),toggled:V.ContextKeyExpr.has(`${i.id}.visible`),title:i.name,metadata:{description:(0,m.localize2)(14612,"Toggles the visibility of the {0} view if the view container it is located in is visible",i.name.value)},menu:[{id:t8.ViewsSubMenu,when:V.ContextKeyExpr.equals("viewContainer",e.viewContainer.id),order:o},{id:ia.MenuId.ViewContainerTitleContext,when:V.ContextKeyExpr.equals("viewContainer",e.viewContainer.id),order:o,group:"1_toggleVisibility"},{id:ia.MenuId.ViewTitleContext,when:V.ContextKeyExpr.or(...e.visibleViewDescriptors.map(e=>V.ContextKeyExpr.equals("view",e.id))),order:o,group:"2_toggleVisibility"}]})}async runInViewPaneContainer(e,t){t.toggleViewVisibility(i.id)}})),t.add((0,ia.registerAction2)(class extends t8.ViewPaneContainerAction{constructor(){super({id:`${i.id}.removeView`,viewPaneContainerId:e.viewContainer.id,title:(0,m.localize)(14613,"Hide '{0}'",i.name.value),metadata:{description:(0,m.localize2)(14614,"Hides the {0} view if it is visible and the view container it is located in is visible",i.name.value)},precondition:i.canToggleVisibility&&(!e.isVisible(i.id)||e.visibleViewDescriptors.length>1)?V.ContextKeyExpr.true():V.ContextKeyExpr.false(),menu:[{id:ia.MenuId.ViewTitleContext,when:V.ContextKeyExpr.and(V.ContextKeyExpr.equals("view",i.id),V.ContextKeyExpr.has(`${i.id}.visible`)),group:"1_hide",order:1}]})}async runInViewPaneContainer(e,t){t.getView(i.id)?.isVisible()&&t.toggleViewVisibility(i.id)}})))}),t}registerResetViewContainerAction(e){let t=this;return(0,ia.registerAction2)(class extends ia.Action2{constructor(){super({id:`${e.id}.resetViewContainerLocation`,title:(0,m.localize2)(14615,"Reset Location"),menu:[{id:ia.MenuId.ViewContainerTitleContext,group:"1_viewActions",when:V.ContextKeyExpr.or(V.ContextKeyExpr.and(V.ContextKeyExpr.equals("viewContainer",e.id),V.ContextKeyExpr.equals(`${e.id}.defaultViewContainerLocation`,!1)))}]})}run(i){t.moveViewContainerToLocation(e,t.getDefaultViewContainerLocation(e),void 0,this.desc.id),i.get(id.IViewsService).openViewContainer(e.id,!0)}})}addViews(e,t,i=t6.ViewVisibilityState.Default){this.contextKeyService.bufferChangeEvents(()=>{t.forEach(t=>{let i=this.getDefaultContainerById(t.id)===e;this.getOrCreateDefaultViewLocationContextKey(t).set(i),i?this.viewDescriptorsCustomLocations.delete(t.id):this.viewDescriptorsCustomLocations.set(t.id,e.id)})}),this.getViewContainerModel(e).add(t.map(e=>({viewDescriptor:e,collapsed:i===t6.ViewVisibilityState.Default&&void 0,visible:i!==t6.ViewVisibilityState.Default||void 0})))}removeViews(e,t){this.contextKeyService.bufferChangeEvents(()=>{t.forEach(t=>{this.viewDescriptorsCustomLocations.get(t.id)===e.id&&this.viewDescriptorsCustomLocations.delete(t.id),this.getOrCreateDefaultViewLocationContextKey(t).set(!1)})}),this.getViewContainerModel(e).remove(t)}getOrCreateActiveViewContextKey(e){let t=`${e.id}.active`,i=this.activeViewContextKeys.get(t);return i||(i=new V.RawContextKey(t,!1).bindTo(this.contextKeyService),this.activeViewContextKeys.set(t,i)),i}getOrCreateVisibleViewContextKey(e){let t=`${e.id}.visible`,i=this.activeViewContextKeys.get(t);return i||(i=new V.RawContextKey(t,!1).bindTo(this.contextKeyService),this.activeViewContextKeys.set(t,i)),i}getOrCreateMovableViewContextKey(e){let t=`${e.id}.canMove`,i=this.movableViewContextKeys.get(t);return i||(i=new V.RawContextKey(t,!1).bindTo(this.contextKeyService),this.movableViewContextKeys.set(t,i)),i}getOrCreateDefaultViewLocationContextKey(e){let t=`${e.id}.defaultViewLocation`,i=this.defaultViewLocationContextKeys.get(t);return i||(i=new V.RawContextKey(t,!1).bindTo(this.contextKeyService),this.defaultViewLocationContextKeys.set(t,i)),i}getOrCreateDefaultViewContainerLocationContextKey(e){let t=`${e.id}.defaultViewContainerLocation`,i=this.defaultViewContainerLocationContextKeys.get(t);return i||(i=new V.RawContextKey(t,!1).bindTo(this.contextKeyService),this.defaultViewContainerLocationContextKeys.set(t,i)),i}};ic=u=(0,p.__decorate)([(0,p.__param)(0,z.IInstantiationService),(0,p.__param)(1,K.IContextKeyService),(0,p.__param)(2,eZ.IStorageService),(0,p.__param)(3,ey.IExtensionService),(0,p.__param)(4,X.ITelemetryService),(0,p.__param)(5,q.ILoggerService)],ic),e.s(["ViewDescriptorService",0,ic],951264)},456592,e=>{"use strict";var t=e.i(281482),i=e.i(258861),o=e.i(611130);e.i(157255);var r=e.i(447186),s=e.i(727019),n=e.i(781808),a=e.i(488259);let d=class extends o.Disposable{constructor(e,t,i){super(),this.viewId=e,this.viewDescriptorService=t,this.activityService=i,this.activity=void 0,this.activityDisposable=o.Disposable.None,this._register(n.Event.filter(this.viewDescriptorService.onDidChangeContainer,t=>t.views.some(t=>t.id===e))(()=>this.update())),this._register(n.Event.filter(this.viewDescriptorService.onDidChangeLocation,t=>t.views.some(t=>t.id===e))(()=>this.update()))}setActivity(e){this.activity=e,this.update()}clearActivity(){this.activity=void 0,this.update()}update(){this.activityDisposable.dispose();let e=this.viewDescriptorService.getViewContainerByViewId(this.viewId);e&&this.activity&&(this.activityDisposable=this.activityService.showViewContainerActivity(e.id,this.activity))}dispose(){this.activityDisposable.dispose(),super.dispose()}};d=(0,t.__decorate)([(0,t.__param)(1,r.IViewDescriptorService),(0,t.__param)(2,i.IActivityService)],d);let l=class extends o.Disposable{constructor(e,t){super(),this.viewDescriptorService=e,this.instantiationService=t,this.viewActivities=new Map,this._onDidChangeActivity=this._register(new n.Emitter),this.onDidChangeActivity=this._onDidChangeActivity.event,this.viewContainerActivities=new Map,this.globalActivities=new Map}showViewContainerActivity(e,t){let i=this.viewDescriptorService.getViewContainerById(e);if(!i)return o.Disposable.None;let r=this.viewContainerActivities.get(e);return r||(r=[],this.viewContainerActivities.set(e,r)),r.push(t),this._onDidChangeActivity.fire(i),(0,o.toDisposable)(()=>{r.splice(r.indexOf(t),1),0===r.length&&this.viewContainerActivities.delete(e),this._onDidChangeActivity.fire(i)})}getViewContainerActivities(e){return this.viewDescriptorService.getViewContainerById(e)?this.viewContainerActivities.get(e)??[]:[]}showViewActivity(e,t){let i=this.viewActivities.get(e);i?i.id++:(i={id:1,activity:this.instantiationService.createInstance(d,e)},this.viewActivities.set(e,i));let r=i.id;i.activity.setActivity(t);let s=i;return(0,o.toDisposable)(()=>{s.id===r&&(s.activity.dispose(),this.viewActivities.delete(e))})}showAccountsActivity(e){return this.showActivity(s.ACCOUNTS_ACTIVITY_ID,e)}showGlobalActivity(e){return this.showActivity(s.GLOBAL_ACTIVITY_ID,e)}getActivity(e){return this.globalActivities.get(e)??[]}showActivity(e,t){let i=this.globalActivities.get(e);return i||(i=[],this.globalActivities.set(e,i)),i.push(t),this._onDidChangeActivity.fire(e),(0,o.toDisposable)(()=>{i.splice(i.indexOf(t),1),0===i.length&&this.globalActivities.delete(e),this._onDidChangeActivity.fire(e)})}};l=(0,t.__decorate)([(0,t.__param)(0,r.IViewDescriptorService),(0,t.__param)(1,a.IInstantiationService)],l),e.s(["ActivityService",0,l])},689241,80428,978336,197375,737450,83068,333906,282347,e=>{"use strict";let t,i;var o,r,s,n,a,d,l,c,h,u,p,g,m,v,y,C,b,w=e.i(281482),f=e.i(786091),S=e.i(454514),_=e.i(611130),E=e.i(693162),I=e.i(802136),D=e.i(731931),T=e.i(16046),A=e.i(193391),x=e.i(891110),R=e.i(702320),k=e.i(781112),M=e.i(488259),L=e.i(428048),O=e.i(650289),P=e.i(216822),V=e.i(975445),K=e.i(157255),N=e.i(701575),G=e.i(140889),F=e.i(981399),W=e.i(853457),z=e.i(559340),B=e.i(460096),U=e.i(781808),H=e.i(770326);let $=class extends _.Disposable{static{h=this}static{this.configureDefaultID="promptOpenWith.configureDefault"}static{this.cacheStorageID="editorOverrideService.cache"}static{this.conflictingDefaultsStorageID="editorOverrideService.conflictingDefaults"}constructor(e,t,i,o,r,s,n,a){super(),this.editorGroupService=e,this.instantiationService=t,this.configurationService=i,this.quickInputService=o,this.notificationService=r,this.storageService=s,this.extensionService=n,this.logService=a,this._onDidChangeEditorRegistrations=this._register(new U.PauseableEmitter),this.onDidChangeEditorRegistrations=this._onDidChangeEditorRegistrations.event,this._editors=new Map,this._flattenedEditors=new Map,this._shouldReFlattenEditors=!0,this.cache=new Set(JSON.parse(this.storageService.get(h.cacheStorageID,N.StorageScope.PROFILE,JSON.stringify([])))),this.storageService.remove(h.cacheStorageID,N.StorageScope.PROFILE),this._register(this.storageService.onWillSaveState(()=>{this.cacheEditors()})),this._register(this.extensionService.onDidRegisterExtensions(()=>{this.cache=void 0}))}resolveUntypedInputAndGroup(e,t){let i=this.instantiationService.invokeFunction(z.findGroup,e,t);if(i instanceof Promise)return i.then(([t,i])=>[e,t,i]);{let[t,o]=i;return[e,t,o]}}async resolveEditor(e,t){let i;if(this._flattenedEditors=this._flattenEditorsMap(),(0,A.isResourceSideBySideEditorInput)(e))return this.doResolveSideBySideEditor(e,t);let o=this.resolveUntypedInputAndGroup(e,t);if(!(i=o instanceof Promise?await o:o))return k.ResolvedStatus.NONE;let[r,s,n]=i;n&&(r.options={...r.options,activation:n});let a=A.EditorResourceAccessor.getCanonicalUri(r,{supportSideBySide:A.SideBySideEditor.PRIMARY});if(this.cache&&a&&this.resourceMatchesCache(a)&&await this.extensionService.whenInstalledExtensionsRegistered(),void 0===a)a=I.URI.from({scheme:R.Schemas.untitled});else if(void 0===a.scheme||null===a)return k.ResolvedStatus.NONE;if(r.options?.override===T.EditorResolution.PICK){let e=await this.doPickEditor(r);if(!e)return k.ResolvedStatus.ABORT;r.options=e}let{editor:d,conflictingDefault:l}=this.getEditor(a,r.options?.override);if(!d&&(r.options?.override||(0,A.isEditorInputWithOptions)(e)))return k.ResolvedStatus.NONE;if(!d){let e=this.getEditor(a,A.DEFAULT_EDITOR_ASSOCIATION.id);if(d=e?.editor,l=e?.conflictingDefault,!d)return k.ResolvedStatus.NONE}if((0,A.isResourceDiffEditorInput)(r)&&r.options?.override===void 0){let e=A.EditorResourceAccessor.getCanonicalUri(r,{supportSideBySide:A.SideBySideEditor.SECONDARY});e||(e=I.URI.from({scheme:R.Schemas.untitled}));let{editor:t}=this.getEditor(e,void 0);if(!t||d.editorInfo.id!==t.editorInfo.id){let{editor:e,conflictingDefault:t}=this.getEditor(a,A.DEFAULT_EDITOR_ASSOCIATION.id);d=e,l=t}if(!d)return k.ResolvedStatus.NONE}if(r.options={override:d.editorInfo.id,...r.options},void 0===d.editorFactoryObject.createDiffEditorInput&&(0,A.isResourceDiffEditorInput)(r))return k.ResolvedStatus.NONE;let c=await this.doResolveEditor(r,s,d);return(l&&c&&await this.doHandleConflictingDefaults(a,d.editorInfo.label,r,c.editor,s),c)?(c.editor.editorId!==d.editorInfo.id&&this.logService.warn(`Editor ID Mismatch: ${c.editor.editorId} !== ${d.editorInfo.id}. This will cause bugs. Please ensure editorInput.editorId matches the registered id`),{...c,group:s}):k.ResolvedStatus.ABORT}async doResolveSideBySideEditor(e,t){let i=await this.resolveEditor(e.primary,t);if(!(0,A.isEditorInputWithOptionsAndGroup)(i))return k.ResolvedStatus.NONE;let o=await this.resolveEditor(e.secondary,i.group??t);return(0,A.isEditorInputWithOptionsAndGroup)(o)?{group:i.group??o.group,editor:this.instantiationService.createInstance(B.SideBySideEditorInput,e.label,e.description,o.editor,i.editor),options:e.options}:k.ResolvedStatus.NONE}bufferChangeEvents(e){this._onDidChangeEditorRegistrations.pause();try{e()}finally{this._onDidChangeEditorRegistrations.resume()}}registerEditor(e,t,i,o){let r=this._editors.get(e);void 0===r&&(r=new Map,this._editors.set(e,r));let s=r.get(t.id);void 0===s&&(s=[]);let n=(0,S.insert)(s,{globPattern:e,editorInfo:t,options:i,editorFactoryObject:o});return r.set(t.id,s),this._shouldReFlattenEditors=!0,this._onDidChangeEditorRegistrations.fire(),(0,_.toDisposable)(()=>{n(),s&&0===s.length&&r?.delete(t.id),this._shouldReFlattenEditors=!0,this._onDidChangeEditorRegistrations.fire()})}getAssociationsForResource(e){let t=this.getAllUserAssociations().filter(t=>t.filenamePattern&&(0,k.globMatchesResource)(t.filenamePattern,e));t=t.sort((e,t)=>(t.filenamePattern?.length??0)-(e.filenamePattern?.length??0));let i=this._registeredEditors;return t.filter(e=>i.find(t=>t.editorInfo.id===e.viewType))}getAllUserAssociations(){let e=this.configurationService.inspect(k.editorsAssociationsSettingId)||{},t=e.defaultValue??{},i=e.workspaceValue??{},o=e.userValue??{},r={...i};for(let[e,i]of Object.entries({...t,...o}))void 0===r[e]&&(r[e]=i);let s=[];for(let[e,t]of Object.entries(r)){let i={filenamePattern:e,viewType:t};s.push(i)}return s}_flattenEditorsMap(){if(!this._shouldReFlattenEditors)return this._flattenedEditors;this._shouldReFlattenEditors=!1;let e=new Map;for(let[t,i]of this._editors){let o=[];for(let e of i.values()){let t;for(let i of e)t||(t={editorInfo:i.editorInfo,globPattern:i.globPattern,options:{},editorFactoryObject:{}}),t.options={...t.options,...i.options},t.editorFactoryObject={...t.editorFactoryObject,...i.editorFactoryObject};t&&o.push(t)}e.set(t,o)}return e}get _registeredEditors(){return Array.from(this._flattenedEditors.values()).flat()}updateUserAssociations(e,t){let i=this.getAllUserAssociations(),o=Object.create(null);for(let r of[...i,{viewType:t,filenamePattern:e}])r.filenamePattern&&(o[r.filenamePattern]=r.viewType);this.configurationService.updateValue(k.editorsAssociationsSettingId,o)}findMatchingEditors(e){let t=this.getAssociationsForResource(e),i=[];for(let[o,r]of this._flattenedEditors)for(let s of r)(t.find(e=>e.viewType===s.editorInfo.id)&&s.editorInfo.priority!==k.RegisteredEditorPriority.exclusive||(0,k.globMatchesResource)(o,e))&&i.push(s);return i.sort((e,t)=>(0,k.priorityToRank)(t.editorInfo.priority)===(0,k.priorityToRank)(e.editorInfo.priority)&&"string"==typeof t.globPattern&&"string"==typeof e.globPattern?t.globPattern.length-e.globPattern.length:(0,k.priorityToRank)(t.editorInfo.priority)-(0,k.priorityToRank)(e.editorInfo.priority))}getEditors(e){if(this._flattenedEditors=this._flattenEditorsMap(),I.URI.isUri(e)){let t=this.findMatchingEditors(e);return t.find(e=>e.editorInfo.priority===k.RegisteredEditorPriority.exclusive)?[]:t.map(e=>e.editorInfo)}return(0,S.distinct)(this._registeredEditors.map(e=>e.editorInfo),e=>e.id)}getEditor(e,t){let i=(t,i)=>t.find(t=>t.options?.canSupportResource!==void 0?t.editorInfo.id===i&&t.options.canSupportResource(e):t.editorInfo.id===i);if(t&&t!==T.EditorResolution.EXCLUSIVE_ONLY)return{editor:i(this._registeredEditors,t),conflictingDefault:!1};let o=this.findMatchingEditors(e),r=this.getAssociationsForResource(e),s=t===T.EditorResolution.EXCLUSIVE_ONLY?k.RegisteredEditorPriority.exclusive:k.RegisteredEditorPriority.builtin,n=o.filter(e=>(0,k.priorityToRank)(e.editorInfo.priority)>=(0,k.priorityToRank)(s)&&e.editorInfo.id!==A.DEFAULT_EDITOR_ASSOCIATION.id);if(0===n.length)return{editor:r[0]&&s!==k.RegisteredEditorPriority.exclusive?i(o,r[0].viewType):void 0,conflictingDefault:!1};let a=n[0].editorInfo.priority===k.RegisteredEditorPriority.exclusive?n[0].editorInfo.id:r[0]?.viewType||n.find(t=>!t.options?.canSupportResource||t.options.canSupportResource(e))?.editorInfo.id||n[0].editorInfo.id,d=!1;return n=n.filter(e=>e.editorInfo.priority!==k.RegisteredEditorPriority.exclusive).filter(t=>!t.options?.canSupportResource||t.options.canSupportResource(e)),0===r.length&&n.length>1&&(d=!0),{editor:i(o,a),conflictingDefault:d}}async doResolveEditor(e,t,i){let o=e.options,r=A.EditorResourceAccessor.getCanonicalUri(e,{supportSideBySide:A.SideBySideEditor.PRIMARY});if(o&&void 0===o.activation&&(o={...o,activation:o.preserveFocus?T.EditorActivation.RESTORE:void 0}),(0,A.isResourceMergeEditorInput)(e)){if(!i.editorFactoryObject.createMergeEditorInput)return;let r=await i.editorFactoryObject.createMergeEditorInput(e,t);return{editor:r.editor,options:r.options??o}}if((0,A.isResourceDiffEditorInput)(e)){if(!i.editorFactoryObject.createDiffEditorInput)return;let r=await i.editorFactoryObject.createDiffEditorInput(e,t);return{editor:r.editor,options:r.options??o}}if((0,A.isResourceMultiDiffEditorInput)(e)){if(!i.editorFactoryObject.createMultiDiffEditorInput)return;let r=await i.editorFactoryObject.createMultiDiffEditorInput(e,t);return{editor:r.editor,options:r.options??o}}if((0,A.isResourceSideBySideEditorInput)(e))throw Error("Untyped side by side editor input not supported here.");if((0,A.isUntitledResourceEditorInput)(e)){if(!i.editorFactoryObject.createUntitledEditorInput)return;let r=await i.editorFactoryObject.createUntitledEditorInput(e,t);return{editor:r.editor,options:r.options??o}}if(void 0===r)throw Error("Undefined resource on non untitled editor input.");if("function"==typeof i.options?.singlePerResource?i.options.singlePerResource():i.options?.singlePerResource){let e=this.findExistingEditorsForResource(r,i.editorInfo.id);if(e.length){let i=await this.moveExistingEditorForResource(e,t);return i?{editor:i,options:o}:void 0}}if(!i.editorFactoryObject.createEditorInput)return;let s=await i.editorFactoryObject.createEditorInput(e,t);return o=s.options??o,{editor:s.editor,options:o}}async moveExistingEditorForResource(e,t){let i=e[0];for(let{editor:t,group:o}of e)if(t!==i.editor&&!await o.closeEditor(t))return;if(t.id===i.group.id||i.group.moveEditor(i.editor,t))return i.editor}findExistingEditorsForResource(e,t){let i=[];for(let o of(0,S.distinct)([...this.editorGroupService.groups]))for(let r of o.editors)(0,E.isEqual)(r.resource,e)&&r.editorId===t&&i.push({editor:r,group:o});return i}async doHandleConflictingDefaults(e,t,i,o,r){let s=this.findMatchingEditors(e),n=JSON.parse(this.storageService.get(h.conflictingDefaultsStorageID,N.StorageScope.PROFILE,"{}")),a=`*${(0,E.extname)(e)}`,d=()=>{n[a]=[],s.forEach(e=>n[a].push(e.editorInfo.id)),this.storageService.store(h.conflictingDefaultsStorageID,JSON.stringify(n),N.StorageScope.PROFILE,N.StorageTarget.MACHINE)};if(n[a]?.find(e=>e===o.editorId))return;let l=this.notificationService.prompt(H.default.Warning,(0,O.localize)(13883,"There are multiple default editors available for the resource."),[{label:(0,O.localize)(13884,"Configure Default"),run:async()=>{let e=await this.doPickEditor(i,!0);if(!e)return;i.options=e;let t=await this.resolveEditor(i,r);t!==k.ResolvedStatus.ABORT&&t!==k.ResolvedStatus.NONE&&r.replaceEditors([{editor:o,replacement:t.editor,options:t.options??e}])}},{label:(0,O.localize)(13885,"Keep {0}",t),run:d}]).onDidClose(()=>{d(),l.dispose()})}mapEditorsToQuickPickEntry(e,t){let i=this.editorGroupService.activeGroup.findEditors(e).at(0),o=e.scheme===R.Schemas.untitled?this._registeredEditors.filter(e=>e.editorInfo.priority!==k.RegisteredEditorPriority.exclusive):this.findMatchingEditors(e);o=(0,S.distinct)(o,e=>e.editorInfo.id);let r=this.getAssociationsForResource(e)[0]?.viewType;o=o.sort((e,t)=>e.editorInfo.id===A.DEFAULT_EDITOR_ASSOCIATION.id?-1:t.editorInfo.id===A.DEFAULT_EDITOR_ASSOCIATION.id?1:(0,k.priorityToRank)(t.editorInfo.priority)-(0,k.priorityToRank)(e.editorInfo.priority));let s=[],n=(0,O.localize)(13886,"Active"),a=(0,O.localize)(13887,"Default"),d=(0,O.localize)(13888,"Active and Default"),l=r;if(!l&&o.length>2&&o[1]?.editorInfo.priority!==k.RegisteredEditorPriority.option&&(l=o[1]?.editorInfo.id),l||(l=A.DEFAULT_EDITOR_ASSOCIATION.id),o.forEach(e=>{let t=i?.editorId??A.DEFAULT_EDITOR_ASSOCIATION.id,o=!!i&&e.editorInfo.id===t,r=e.editorInfo.id===l,c={id:e.editorInfo.id,label:e.editorInfo.label,description:o&&r?d:o?n:r?a:void 0,detail:e.editorInfo.detail??e.editorInfo.priority};s.push(c)}),!t&&""!==(0,E.extname)(e)){s.push({type:"separator"});let t={id:h.configureDefaultID,label:(0,O.localize)(13889,"Configure default editor for '{0}'...",`*${(0,E.extname)(e)}`)};s.push(t)}return s}async doPickEditor(e,t){let i=A.EditorResourceAccessor.getOriginalUri(e,{supportSideBySide:A.SideBySideEditor.PRIMARY});void 0===i&&(i=I.URI.from({scheme:R.Schemas.untitled}));let o=this.mapEditorsToQuickPickEntry(i,t),r=new _.DisposableStore,s=r.add(this.quickInputService.createQuickPick({useSeparators:!0}));s.placeholder=t?(0,O.localize)(13890,"Select new default editor for '{0}'",`*${(0,E.extname)(i)}`):(0,O.localize)(13891,"Select editor for '{0}'",(0,E.basename)(i)),s.canAcceptInBackground=!0,s.items=o;let n=s.items.find(e=>"item"===e.type);n&&(s.selectedItems=[n]);let a=await new Promise(e=>{r.add(s.onDidAccept(o=>{let r;1===s.selectedItems.length&&(r={item:s.selectedItems[0],keyMods:s.keyMods,openInBackground:o.inBackground}),i&&t&&r?.item.id&&this.updateUserAssociations(`*${(0,E.extname)(i)}`,r.item.id),e(r)})),r.add(s.onDidHide(()=>{r.dispose(),e(void 0)})),r.add(s.onDidTriggerItemButton(t=>{e({item:t.item,openInBackground:!1}),i&&t.item?.id&&this.updateUserAssociations(`*${(0,E.extname)(i)}`,t.item.id)})),s.show()});if(s.dispose(),a)return a.item.id===h.configureDefaultID?this.doPickEditor(e,!0):{...e.options,override:a.item.id,preserveFocus:a.openInBackground||e.options?.preserveFocus}}cacheEditors(){let e=new Set;for(let[t,i]of this._flattenedEditors)i.find(e=>e.editorInfo.priority!==k.RegisteredEditorPriority.option&&e.editorInfo.id!==A.DEFAULT_EDITOR_ASSOCIATION.id)&&((0,f.isRelativePattern)(t)?e.add(`${t.pattern}`):e.add(t));for(let t of this.getAllUserAssociations())t.filenamePattern&&e.add(t.filenamePattern);this.storageService.store(h.cacheStorageID,JSON.stringify(Array.from(e)),N.StorageScope.PROFILE,N.StorageTarget.MACHINE)}resourceMatchesCache(e){if(!this.cache)return!1;for(let t of this.cache)if((0,k.globMatchesResource)(t,e))return!0;return!1}};$=h=(0,w.__decorate)([(0,w.__param)(0,x.IEditorGroupsService),(0,w.__param)(1,M.IInstantiationService),(0,w.__param)(2,D.IConfigurationService),(0,w.__param)(3,L.IQuickInputService),(0,w.__param)(4,V.INotificationService),(0,w.__param)(5,G.IStorageService),(0,w.__param)(6,F.IExtensionService),(0,w.__param)(7,W.ILogService)],$),e.s(["EditorResolverService",0,$],689241);var q=e.i(141103),Y=e.i(802186),j=_;let X=class extends j.Disposable{static{u=this}static{this.UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX=/Untitled-\d+/}constructor(e,t){super(),this.instantiationService=e,this.configurationService=t,this._onDidSave=this._register(new U.Emitter),this.onDidSave=this._onDidSave.event,this._onDidChangeDirty=this._register(new U.Emitter),this.onDidChangeDirty=this._onDidChangeDirty.event,this._onDidChangeEncoding=this._register(new U.Emitter),this.onDidChangeEncoding=this._onDidChangeEncoding.event,this._onDidCreate=this._register(new U.Emitter),this.onDidCreate=this._onDidCreate.event,this._onWillDispose=this._register(new U.Emitter),this.onWillDispose=this._onWillDispose.event,this._onDidChangeLabel=this._register(new U.Emitter),this.onDidChangeLabel=this._onDidChangeLabel.event,this.mapResourceToModel=new Y.ResourceMap}get(e){return this.mapResourceToModel.get(e)}getValue(e){return this.get(e)?.textEditorModel?.getValue()}async resolve(e){let t=this.doCreateOrGet(e);return await t.resolve(),t}create(e){return this.doCreateOrGet(e)}doCreateOrGet(e=Object.create(null)){let t=this.massageOptions(e);return t.untitledResource&&this.mapResourceToModel.has(t.untitledResource)?this.mapResourceToModel.get(t.untitledResource):this.doCreate(t)}massageOptions(e){let t=Object.create(null);if(e.associatedResource?(t.untitledResource=I.URI.from({scheme:R.Schemas.untitled,authority:e.associatedResource.authority,fragment:e.associatedResource.fragment,path:e.associatedResource.path,query:e.associatedResource.query}),t.associatedResource=e.associatedResource):e.untitledResource?.scheme===R.Schemas.untitled&&(t.untitledResource=e.untitledResource),e.languageId)t.languageId=e.languageId;else if(!t.associatedResource){let e=this.configurationService.getValue();e.files?.defaultLanguage&&(t.languageId=e.files.defaultLanguage)}return t.encoding=e.encoding,t.initialValue=e.initialValue,t}doCreate(e){let t=e.untitledResource;if(!t){let e=1;do t=I.URI.from({scheme:R.Schemas.untitled,path:`Untitled-${e}`}),e++;while(this.mapResourceToModel.has(t))}let i=this._register(this.instantiationService.createInstance(q.UntitledTextEditorModel,t,!!e.associatedResource,e.initialValue,e.languageId,e.encoding));return this.registerModel(i),i}registerModel(e){let t=new j.DisposableStore;t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onDidChangeName(()=>this._onDidChangeLabel.fire(e))),t.add(e.onDidChangeEncoding(()=>this._onDidChangeEncoding.fire(e))),t.add(e.onWillDispose(()=>this._onWillDispose.fire(e))),U.Event.once(e.onWillDispose)(()=>{this.mapResourceToModel.delete(e.resource),t.dispose()}),this.mapResourceToModel.set(e.resource,e),this._onDidCreate.fire(e),e.isDirty()&&this._onDidChangeDirty.fire(e)}isUntitledWithAssociatedResource(e){return e.scheme===R.Schemas.untitled&&e.path.length>1&&!u.UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX.test(e.path)}canDispose(e){return!!e.isDisposed()||this.doCanDispose(e)}async doCanDispose(e){return!e.isDirty()||(await U.Event.toPromise(e.onDidChangeDirty),this.canDispose(e))}notifyDidSave(e,t){this._onDidSave.fire({source:e,target:t})}};X=u=(0,w.__decorate)([(0,w.__param)(0,M.IInstantiationService),(0,w.__param)(1,D.IConfigurationService)],X),e.s(["UntitledTextEditorService",0,X],80428);var J=e.i(362361),Z=e.i(451062),Q=e.i(441201),ee=e.i(652731),et=e.i(553638),ei=e.i(399362),eo=_,er=e.i(341738),es=e.i(957994),en=e.i(568101),ea=e.i(9753),ed=e.i(850887),el=e.i(506986),ec=e.i(619122),eh=e.i(964814),eu=e.i(292035),ep=e.i(474320),eg=e.i(683578),em=e.i(278725),ev=e.i(290231),ey=e.i(865562);let eC=class extends eo.Disposable{static{p=this}static{this.MOUSE_NAVIGATION_SETTING="workbench.editor.mouseBackForwardToNavigate"}static{this.NAVIGATION_SCOPE_SETTING="workbench.editor.navigationScope"}constructor(e,t,i,o,r,s,n,a,d,l,c){super(),this.editorService=e,this.editorGroupService=t,this.contextService=i,this.storageService=o,this.configurationService=r,this.fileService=s,this.workspacesService=n,this.instantiationService=a,this.layoutService=d,this.contextKeyService=l,this.logService=c,this.activeEditorListeners=this._register(new eo.DisposableStore),this.lastActiveEditor=void 0,this._onDidChangeEditorNavigationStack=this._register(new U.Emitter),this.onDidChangeEditorNavigationStack=this._onDidChangeEditorNavigationStack.event,this.defaultScopedEditorNavigationStack=void 0,this.editorGroupScopedNavigationStacks=new Map,this.editorScopedNavigationStacks=new Map,this.editorNavigationScope=Z.GoScope.DEFAULT,this.recentlyUsedEditorsStack=void 0,this.recentlyUsedEditorsStackIndex=0,this.recentlyUsedEditorsInGroupStack=void 0,this.recentlyUsedEditorsInGroupStackIndex=0,this.navigatingInRecentlyUsedEditorsStack=!1,this.navigatingInRecentlyUsedEditorsInGroupStack=!1,this.recentlyClosedEditors=[],this.ignoreEditorCloseEvent=!1,this.history=void 0,this.editorHistoryListeners=this._register(new eo.DisposableMap),this.resourceExcludeMatcher=this._register(new ed.WindowIdleValue(ey.mainWindow,()=>{let e=this._register(this.instantiationService.createInstance(eh.ResourceGlobMatcher,e=>(0,er.getExcludes)(e?this.configurationService.getValue({resource:e}):this.configurationService.getValue())||Object.create(null),e=>e.affectsConfiguration(ee.FILES_EXCLUDE_CONFIG)||e.affectsConfiguration(er.SEARCH_EXCLUDE_CONFIG)));return this._register(e.onExpressionChange(()=>this.removeExcludedFromHistory())),e})),this.editorHelper=this.instantiationService.createInstance(e_),this.canNavigateBackContextKey=new en.RawContextKey("canNavigateBack",!1,(0,O.localize)(14103,"Whether it is possible to navigate back in editor history")).bindTo(this.contextKeyService),this.canNavigateForwardContextKey=new en.RawContextKey("canNavigateForward",!1,(0,O.localize)(14104,"Whether it is possible to navigate forward in editor history")).bindTo(this.contextKeyService),this.canNavigateBackInNavigationsContextKey=new en.RawContextKey("canNavigateBackInNavigationLocations",!1,(0,O.localize)(14105,"Whether it is possible to navigate back in editor navigation locations history")).bindTo(this.contextKeyService),this.canNavigateForwardInNavigationsContextKey=new en.RawContextKey("canNavigateForwardInNavigationLocations",!1,(0,O.localize)(14106,"Whether it is possible to navigate forward in editor navigation locations history")).bindTo(this.contextKeyService),this.canNavigateToLastNavigationLocationContextKey=new en.RawContextKey("canNavigateToLastNavigationLocation",!1,(0,O.localize)(14107,"Whether it is possible to navigate to the last editor navigation location")).bindTo(this.contextKeyService),this.canNavigateBackInEditsContextKey=new en.RawContextKey("canNavigateBackInEditLocations",!1,(0,O.localize)(14108,"Whether it is possible to navigate back in editor edit locations history")).bindTo(this.contextKeyService),this.canNavigateForwardInEditsContextKey=new en.RawContextKey("canNavigateForwardInEditLocations",!1,(0,O.localize)(14109,"Whether it is possible to navigate forward in editor edit locations history")).bindTo(this.contextKeyService),this.canNavigateToLastEditLocationContextKey=new en.RawContextKey("canNavigateToLastEditLocation",!1,(0,O.localize)(14110,"Whether it is possible to navigate to the last editor edit location")).bindTo(this.contextKeyService),this.canReopenClosedEditorContextKey=new en.RawContextKey("canReopenClosedEditor",!1,(0,O.localize)(14111,"Whether it is possible to reopen the last closed editor")).bindTo(this.contextKeyService),this.registerListeners(),this.editorService.activeEditorPane&&this.onDidActiveEditorChange()}registerListeners(){this.registerMouseNavigationListener(),this._register(this.editorService.onDidActiveEditorChange(()=>this.onDidActiveEditorChange())),this._register(this.editorService.onDidOpenEditorFail(e=>this.remove(e.editor))),this._register(this.editorService.onDidCloseEditor(e=>this.onDidCloseEditor(e))),this._register(this.editorService.onDidMostRecentlyActiveEditorsChange(()=>this.handleEditorEventInRecentEditorsStack())),this._register(this.editorGroupService.onDidRemoveGroup(e=>this.onDidRemoveGroup(e))),this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.fileService.onDidRunOperation(e=>this.onDidFilesChange(e))),this._register(this.storageService.onWillSaveState(()=>this.saveState())),this.registerEditorNavigationScopeChangeListener(),this._register(this.onDidChangeEditorNavigationStack(()=>this.updateContextKeys())),this._register(this.editorGroupService.onDidChangeActiveGroup(()=>this.updateContextKeys()))}onDidCloseEditor(e){this.handleEditorCloseEventInHistory(e),this.handleEditorCloseEventInReopen(e)}registerMouseNavigationListener(){let e=this._register(new eo.DisposableStore),t=()=>{e.clear(),this.configurationService.getValue(p.MOUSE_NAVIGATION_SETTING)&&this._register(U.Event.runAndSubscribe(this.layoutService.onDidAddContainer,({container:t,disposables:i})=>{let o=i.add(new eo.DisposableStore);o.add((0,ed.addDisposableListener)(t,ed.EventType.MOUSE_DOWN,e=>this.onMouseDownOrUp(e,!0))),o.add((0,ed.addDisposableListener)(t,ed.EventType.MOUSE_UP,e=>this.onMouseDownOrUp(e,!1))),e.add(o)},{container:this.layoutService.mainContainer,disposables:this._store}))};this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(p.MOUSE_NAVIGATION_SETTING)&&t()})),t()}onMouseDownOrUp(e,t){switch(e.button){case 3:ed.EventHelper.stop(e),t&&this.goBack();break;case 4:ed.EventHelper.stop(e),t&&this.goForward()}}onDidRemoveGroup(e){this.handleEditorGroupRemoveInNavigationStacks(e)}onDidActiveEditorChange(){let e=this.editorGroupService.activeGroup,t=e.activeEditorPane;if(!(this.lastActiveEditor&&this.editorHelper.matchesEditorIdentifier(this.lastActiveEditor,t))){if(this.lastActiveEditor=t?.input?{editor:t.input,groupId:t.group.id}:void 0,this.activeEditorListeners.clear(),t?.group.isTransient(t.input)){this.logService.trace(`[History]: ignoring transient editor change until becoming non-transient (editor: ${t.input?.resource?.toString()}})`);let i=e.onDidModelChange(o=>{o.kind!==A.GroupModelChangeKind.EDITOR_TRANSIENT||o.editor!==t.input||t.group.isTransient(t.input)||(i.dispose(),this.handleActiveEditorChange(e,t))});this.activeEditorListeners.add(i)}else this.handleActiveEditorChange(e,t);(0,A.isEditorPaneWithSelection)(t)&&this.activeEditorListeners.add(t.onDidChangeSelection(i=>{t.group.isTransient(t.input)?this.logService.trace(`[History]: ignoring transient editor selection change (editor: ${t.input?.resource?.toString()}})`):this.handleActiveEditorSelectionChangeEvent(e,t,i)})),this.updateContextKeys()}}onDidFilesChange(e){e instanceof ee.FileChangesEvent?e.gotDeleted()&&this.remove(e):e.isOperation(ee.FileOperation.DELETE)?this.remove(e):e.isOperation(ee.FileOperation.MOVE)&&e.target.isFile&&this.move(e)}handleActiveEditorChange(e,t){this.handleActiveEditorChangeInHistory(t),this.handleActiveEditorChangeInNavigationStacks(e,t)}handleActiveEditorSelectionChangeEvent(e,t,i){this.handleActiveEditorSelectionChangeInNavigationStacks(e,t,i)}move(e){this.moveInHistory(e),this.moveInEditorNavigationStacks(e)}remove(e){this.removeFromHistory(e),this.removeFromEditorNavigationStacks(e),this.removeFromRecentlyClosedEditors(e),this.removeFromRecentlyOpened(e)}removeFromRecentlyOpened(e){let t;(0,A.isEditorInput)(e)?t=A.EditorResourceAccessor.getOriginalUri(e):e instanceof ee.FileChangesEvent||(t=e.resource),t&&this.workspacesService.removeRecentlyOpened([t])}clear(){this.clearRecentlyOpened(),this.clearEditorNavigationStacks(),this.recentlyClosedEditors=[],this.updateContextKeys()}updateContextKeys(){this.contextKeyService.bufferChangeEvents(()=>{let e=this.getStack();this.canNavigateBackContextKey.set(e.canGoBack(Z.GoFilter.NONE)),this.canNavigateForwardContextKey.set(e.canGoForward(Z.GoFilter.NONE)),this.canNavigateBackInNavigationsContextKey.set(e.canGoBack(Z.GoFilter.NAVIGATION)),this.canNavigateForwardInNavigationsContextKey.set(e.canGoForward(Z.GoFilter.NAVIGATION)),this.canNavigateToLastNavigationLocationContextKey.set(e.canGoLast(Z.GoFilter.NAVIGATION)),this.canNavigateBackInEditsContextKey.set(e.canGoBack(Z.GoFilter.EDITS)),this.canNavigateForwardInEditsContextKey.set(e.canGoForward(Z.GoFilter.EDITS)),this.canNavigateToLastEditLocationContextKey.set(e.canGoLast(Z.GoFilter.EDITS)),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0)})}registerEditorNavigationScopeChangeListener(){let e=()=>{this.disposeEditorNavigationStacks();let e=this.configurationService.getValue(p.NAVIGATION_SCOPE_SETTING);"editorGroup"===e?this.editorNavigationScope=Z.GoScope.EDITOR_GROUP:"editor"===e?this.editorNavigationScope=Z.GoScope.EDITOR:this.editorNavigationScope=Z.GoScope.DEFAULT};this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(p.NAVIGATION_SCOPE_SETTING)&&e()})),e()}getStack(e=this.editorGroupService.activeGroup,t=e.activeEditor){switch(this.editorNavigationScope){case Z.GoScope.EDITOR:{if(!t)return new ef;let i=this.editorScopedNavigationStacks.get(e.id);i||(i=new Map,this.editorScopedNavigationStacks.set(e.id,i));let o=i.get(t)?.stack;if(!o){let e=new eo.DisposableStore;o=e.add(this.instantiationService.createInstance(ew,Z.GoScope.EDITOR)),e.add(o.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire())),i.set(t,{stack:o,disposable:e})}return o}case Z.GoScope.EDITOR_GROUP:{let t=this.editorGroupScopedNavigationStacks.get(e.id)?.stack;if(!t){let i=new eo.DisposableStore;t=i.add(this.instantiationService.createInstance(ew,Z.GoScope.EDITOR_GROUP)),i.add(t.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire())),this.editorGroupScopedNavigationStacks.set(e.id,{stack:t,disposable:i})}return t}case Z.GoScope.DEFAULT:return this.defaultScopedEditorNavigationStack||(this.defaultScopedEditorNavigationStack=this._register(this.instantiationService.createInstance(ew,Z.GoScope.DEFAULT)),this._register(this.defaultScopedEditorNavigationStack.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire()))),this.defaultScopedEditorNavigationStack}}goForward(e){return this.getStack().goForward(e)}goBack(e){return this.getStack().goBack(e)}goPrevious(e){return this.getStack().goPrevious(e)}goLast(e){return this.getStack().goLast(e)}handleActiveEditorChangeInNavigationStacks(e,t){this.getStack(e,t?.input).handleActiveEditorChange(t)}handleActiveEditorSelectionChangeInNavigationStacks(e,t,i){this.getStack(e,t.input).handleActiveEditorSelectionChange(t,i)}handleEditorCloseEventInHistory(e){let t=this.editorScopedNavigationStacks.get(e.groupId);if(t){let i=t.get(e.editor);i&&(i.disposable.dispose(),t.delete(e.editor)),0===t.size&&this.editorScopedNavigationStacks.delete(e.groupId)}}handleEditorGroupRemoveInNavigationStacks(e){this.defaultScopedEditorNavigationStack?.remove(e.id);let t=this.editorGroupScopedNavigationStacks.get(e.id);t&&(t.disposable.dispose(),this.editorGroupScopedNavigationStacks.delete(e.id))}clearEditorNavigationStacks(){this.withEachEditorNavigationStack(e=>e.clear())}removeFromEditorNavigationStacks(e){this.withEachEditorNavigationStack(t=>t.remove(e))}moveInEditorNavigationStacks(e){this.withEachEditorNavigationStack(t=>t.move(e))}withEachEditorNavigationStack(e){for(let[,t]of(this.defaultScopedEditorNavigationStack&&e(this.defaultScopedEditorNavigationStack),this.editorGroupScopedNavigationStacks))e(t.stack);for(let[,t]of this.editorScopedNavigationStacks)for(let[,i]of t)e(i.stack)}disposeEditorNavigationStacks(){for(let[,e]of(this.defaultScopedEditorNavigationStack?.dispose(),this.defaultScopedEditorNavigationStack=void 0,this.editorGroupScopedNavigationStacks))e.disposable.dispose();for(let[,e]of(this.editorGroupScopedNavigationStacks.clear(),this.editorScopedNavigationStacks))for(let[,t]of e)t.disposable.dispose();this.editorScopedNavigationStacks.clear()}openNextRecentlyUsedEditor(e){let[t,i]=this.ensureRecentlyUsedStack(e=>e-1,e);return this.doNavigateInRecentlyUsedEditorsStack(t[i],e)}openPreviouslyUsedEditor(e){let[t,i]=this.ensureRecentlyUsedStack(e=>e+1,e);return this.doNavigateInRecentlyUsedEditorsStack(t[i],e)}async doNavigateInRecentlyUsedEditorsStack(e,t){if(e){let i="number"!=typeof t||!this.editorGroupService.getGroup(t);i?this.navigatingInRecentlyUsedEditorsStack=!0:this.navigatingInRecentlyUsedEditorsInGroupStack=!0;let o=this.editorGroupService.getGroup(e.groupId)??this.editorGroupService.activeGroup;try{await o.openEditor(e.editor)}finally{i?this.navigatingInRecentlyUsedEditorsStack=!1:this.navigatingInRecentlyUsedEditorsInGroupStack=!1}}}ensureRecentlyUsedStack(e,t){let i,o,r="number"==typeof t?this.editorGroupService.getGroup(t):void 0;r?(i=this.recentlyUsedEditorsInGroupStack||r.getEditors(A.EditorsOrder.MOST_RECENTLY_ACTIVE).map(e=>({groupId:r.id,editor:e})),o=this.recentlyUsedEditorsInGroupStackIndex):(i=this.recentlyUsedEditorsStack||this.editorService.getEditors(A.EditorsOrder.MOST_RECENTLY_ACTIVE),o=this.recentlyUsedEditorsStackIndex);let s=e(o);return s<0?s=0:s>i.length-1&&(s=i.length-1),r?(this.recentlyUsedEditorsInGroupStack=i,this.recentlyUsedEditorsInGroupStackIndex=s):(this.recentlyUsedEditorsStack=i,this.recentlyUsedEditorsStackIndex=s),[i,s]}handleEditorEventInRecentEditorsStack(){this.navigatingInRecentlyUsedEditorsStack||(this.recentlyUsedEditorsStack=void 0,this.recentlyUsedEditorsStackIndex=0),this.navigatingInRecentlyUsedEditorsInGroupStack||(this.recentlyUsedEditorsInGroupStack=void 0,this.recentlyUsedEditorsInGroupStackIndex=0)}static{this.MAX_RECENTLY_CLOSED_EDITORS=20}handleEditorCloseEventInReopen(e){if(this.ignoreEditorCloseEvent)return;let{editor:t,context:i}=e;if(i===A.EditorCloseContext.REPLACE||i===A.EditorCloseContext.MOVE||!t.canReopen())return;let o=t.toUntyped();if(!o)return;let r=[],s=A.EditorResourceAccessor.getOriginalUri(t,{supportSideBySide:A.SideBySideEditor.BOTH});I.URI.isUri(s)?r.push(s):s&&r.push(...(0,S.coalesce)([s.primary,s.secondary])),this.removeFromRecentlyClosedEditors(t),this.recentlyClosedEditors.push({editorId:t.editorId,editor:o,resource:A.EditorResourceAccessor.getOriginalUri(t),associatedResources:r,index:e.index,sticky:e.sticky}),this.recentlyClosedEditors.length>p.MAX_RECENTLY_CLOSED_EDITORS&&this.recentlyClosedEditors.shift(),this.canReopenClosedEditorContextKey.set(!0)}async reopenLastClosedEditor(){let e,t=this.recentlyClosedEditors.pop();return t&&(e=this.doReopenLastClosedEditor(t)),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0),e}async doReopenLastClosedEditor(e){let t,i={pinned:!0,sticky:e.sticky,index:e.index,ignoreError:!0};if((e.sticky&&!this.editorGroupService.activeGroup.isSticky(e.index)||!e.sticky&&this.editorGroupService.activeGroup.isSticky(e.index))&&(i.index=void 0),!this.editorGroupService.activeGroup.contains(e.editor)){this.ignoreEditorCloseEvent=!0;try{t=await this.editorService.openEditor({...e.editor,options:{...e.editor.options,...i}})}finally{this.ignoreEditorCloseEvent=!1}}t||((0,S.remove)(this.recentlyClosedEditors,e),this.reopenLastClosedEditor())}removeFromRecentlyClosedEditors(e){this.recentlyClosedEditors=this.recentlyClosedEditors.filter(t=>!!(0,A.isEditorInput)(e)&&t.editorId!==e.editorId||!(t.resource&&this.editorHelper.matchesFile(t.resource,e)||t.associatedResources.some(t=>this.editorHelper.matchesFile(t,e)))),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0)}static{this.MAX_HISTORY_ITEMS=200}static{this.HISTORY_STORAGE_KEY="history.entries"}handleActiveEditorChangeInHistory(e){let t=e?.input;!(!t||t.isDisposed())&&this.includeInHistory(t)&&(this.removeFromHistory(t),this.addToHistory(t))}addToHistory(e,t=!0){this.ensureHistoryLoaded(this.history);let i=this.editorHelper.preferResourceEditorInput(e);i&&(t?this.history.unshift(i):this.history.push(i),this.history.length>p.MAX_HISTORY_ITEMS&&this.editorHelper.clearOnEditorDispose(this.history.pop(),this.editorHistoryListeners),(0,A.isEditorInput)(e)&&this.editorHelper.onEditorDispose(e,()=>this.updateHistoryOnEditorDispose(i),this.editorHistoryListeners))}updateHistoryOnEditorDispose(e){if((0,A.isEditorInput)(e))if((0,A.isSideBySideEditorInput)(e)){let t=[];for(let i of e.primary.matches(e.secondary)?[e.primary]:[e.primary,e.secondary]){let e=this.editorHelper.preferResourceEditorInput(i);(0,A.isResourceEditorInput)(e)&&this.includeInHistory(e)&&t.push(e)}this.replaceInHistory(e,...t)}else this.removeFromHistory(e);else this.includeInHistory(e)||this.removeFromHistory(e)}includeInHistory(e){return!!(0,A.isEditorInput)(e)||!this.resourceExcludeMatcher.value.matches(e.resource)}removeExcludedFromHistory(){this.ensureHistoryLoaded(this.history),this.history=this.history.filter(e=>{let t=this.includeInHistory(e);return t||this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),t})}moveInHistory(e){e.isOperation(ee.FileOperation.MOVE)&&this.removeFromHistory(e)&&this.addToHistory({resource:e.target.resource})}removeFromHistory(e){let t=!1;return this.ensureHistoryLoaded(this.history),this.history=this.history.filter(i=>{let o=this.editorHelper.matchesEditor(e,i);return o&&(this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),t=!0),!o}),t}replaceInHistory(e,...t){this.ensureHistoryLoaded(this.history);let i=!1,o=[];for(let r of this.history)this.editorHelper.matchesEditor(e,r)?(this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),i||(o.push(...t),i=!0)):t.some(e=>this.editorHelper.matchesEditor(e,r))||o.push(r);i||o.push(...t),this.history=o}clearRecentlyOpened(){this.history=[],this.editorHistoryListeners.clearAndDisposeAll()}getHistory(){return this.ensureHistoryLoaded(this.history),this.history}ensureHistoryLoaded(e){this.history||(this.history=[],this.editorGroupService.isReady?this.loadHistory():(async()=>{await this.editorGroupService.whenReady,this.loadHistory()})())}loadHistory(){this.history=[];let e=this.loadHistoryFromStorage(),t=[...this.editorService.getEditors(A.EditorsOrder.MOST_RECENTLY_ACTIVE)].reverse(),i=new Set;for(let{editor:e}of t)if(this.includeInHistory(e)){if(e.resource){let t=`${e.resource.toString()}/${e.editorId}`;if(i.has(t))continue;i.add(t)}this.addToHistory(e)}for(let t of e){let e=`${t.resource.toString()}/${t.options?.override}`;!i.has(e)&&this.includeInHistory(t)&&(i.add(e),this.addToHistory(t,!1))}}loadHistoryFromStorage(){let e=[],t=this.storageService.get(p.HISTORY_STORAGE_KEY,N.StorageScope.WORKSPACE);if(t)try{for(let i of JSON.parse(t))if(i.editor&&i.editor.resource)try{e.push({...i.editor,resource:"string"==typeof i.editor.resource?I.URI.parse(i.editor.resource):I.URI.from(i.editor.resource)})}catch(e){(0,ec.onUnexpectedError)(e)}}catch(e){(0,ec.onUnexpectedError)(e)}return e}saveState(){if(!this.history)return;let e=[];for(let t of this.history)!(0,A.isEditorInput)(t)&&(0,A.isResourceEditorInput)(t)&&e.push({editor:{...t,resource:t.resource.toString()}});this.storageService.store(p.HISTORY_STORAGE_KEY,JSON.stringify(e),N.StorageScope.WORKSPACE,N.StorageTarget.MACHINE)}getLastActiveWorkspaceRoot(e,t){let i=this.contextService.getWorkspace().folders;if(0!==i.length){if(1===i.length){let o=i[0].uri;return e&&o.scheme!==e||t&&o.authority!==t?void 0:o}for(let i of this.getHistory()){if((0,A.isEditorInput)(i)||e&&i.resource.scheme!==e||t&&i.resource.authority!==t)continue;let o=this.contextService.getWorkspaceFolder(i.resource);if(o)return o.uri}for(let o of i){let i=o.uri;if((!e||i.scheme===e)&&(!t||i.authority===t))return i}}}getLastActiveFile(e,t){for(let i of this.getHistory()){let o;if((o=(0,A.isEditorInput)(i)?A.EditorResourceAccessor.getOriginalUri(i,{filterByScheme:e}):i.resource)&&o.scheme===e&&(!t||o.authority===t))return o}}dispose(){for(let[,e]of(super.dispose(),this.editorGroupScopedNavigationStacks))e.disposable.dispose();for(let[,e]of this.editorScopedNavigationStacks)for(let[,t]of e)t.disposable.dispose();for(let[,e]of this.editorHistoryListeners)e.dispose()}};eC=p=(0,w.__decorate)([(0,w.__param)(0,J.IEditorService),(0,w.__param)(1,x.IEditorGroupsService),(0,w.__param)(2,ei.IWorkspaceContextService),(0,w.__param)(3,G.IStorageService),(0,w.__param)(4,D.IConfigurationService),(0,w.__param)(5,et.IFileService),(0,w.__param)(6,el.IWorkspacesService),(0,w.__param)(7,M.IInstantiationService),(0,w.__param)(8,es.IWorkbenchLayoutService),(0,w.__param)(9,ea.IContextKeyService),(0,w.__param)(10,W.ILogService)],eC),(0,K.registerSingleton)(Q.IHistoryService,eC,K.InstantiationType.Eager);class eb{constructor(e,t,i){this.editorIdentifier=e,this.selection=t,this.reason=i}justifiesNewNavigationEntry(e){if(this.editorIdentifier.groupId!==e.editorIdentifier.groupId||!this.editorIdentifier.editor.matches(e.editorIdentifier.editor)||!this.selection||!e.selection)return!0;let t=this.selection.compare(e.selection);return t===A.EditorPaneSelectionCompareResult.SIMILAR&&(e.reason===A.EditorPaneSelectionChangeReason.NAVIGATION||e.reason===A.EditorPaneSelectionChangeReason.JUMP)||t===A.EditorPaneSelectionCompareResult.DIFFERENT}}let ew=class extends eo.Disposable{constructor(e,t){super(),this.scope=e,this.instantiationService=t,this.selectionsStack=this._register(this.instantiationService.createInstance(eS,Z.GoFilter.NONE,this.scope)),this.editsStack=this._register(this.instantiationService.createInstance(eS,Z.GoFilter.EDITS,this.scope)),this.navigationsStack=this._register(this.instantiationService.createInstance(eS,Z.GoFilter.NAVIGATION,this.scope)),this.stacks=[this.selectionsStack,this.editsStack,this.navigationsStack],this.onDidChange=U.Event.any(this.selectionsStack.onDidChange,this.editsStack.onDidChange,this.navigationsStack.onDidChange)}canGoForward(e){return this.getStack(e).canGoForward()}goForward(e){return this.getStack(e).goForward()}canGoBack(e){return this.getStack(e).canGoBack()}goBack(e){return this.getStack(e).goBack()}goPrevious(e){return this.getStack(e).goPrevious()}canGoLast(e){return this.getStack(e).canGoLast()}goLast(e){return this.getStack(e).goLast()}getStack(e=Z.GoFilter.NONE){switch(e){case Z.GoFilter.NONE:return this.selectionsStack;case Z.GoFilter.EDITS:return this.editsStack;case Z.GoFilter.NAVIGATION:return this.navigationsStack}}handleActiveEditorChange(e){this.selectionsStack.notifyNavigation(e)}handleActiveEditorSelectionChange(e,t){let i=this.selectionsStack.current;this.selectionsStack.notifyNavigation(e,t),t.reason===A.EditorPaneSelectionChangeReason.EDIT?this.editsStack.notifyNavigation(e,t):t.reason!==A.EditorPaneSelectionChangeReason.NAVIGATION&&t.reason!==A.EditorPaneSelectionChangeReason.JUMP||this.selectionsStack.isNavigating()||(t.reason===A.EditorPaneSelectionChangeReason.JUMP&&!this.navigationsStack.isNavigating()&&i&&this.navigationsStack.addOrReplace(i.groupId,i.editor,i.selection),this.navigationsStack.notifyNavigation(e,t))}clear(){for(let e of this.stacks)e.clear()}remove(e){for(let t of this.stacks)t.remove(e)}move(e){for(let t of this.stacks)t.move(e)}};ew=(0,w.__decorate)([(0,w.__param)(1,M.IInstantiationService)],ew);class ef{constructor(){this.onDidChange=U.Event.None}canGoForward(){return!1}async goForward(){}canGoBack(){return!1}async goBack(){}async goPrevious(){}canGoLast(){return!1}async goLast(){}handleActiveEditorChange(){}handleActiveEditorSelectionChange(){}clear(){}remove(){}move(){}dispose(){}}let eS=class extends eo.Disposable{static{g=this}static{this.MAX_STACK_SIZE=50}get current(){return this.stack[this.index]}set current(e){e&&(this.stack[this.index]=e)}constructor(e,t,i,o,r,s){super(),this.filter=e,this.scope=t,this.editorService=o,this.editorGroupService=r,this.logService=s,this._onDidChange=this._register(new U.Emitter),this.onDidChange=this._onDidChange.event,this.mapEditorToDisposable=this._register(new eo.DisposableMap),this.mapGroupToDisposable=this._register(new eo.DisposableMap),this.stack=[],this.index=-1,this.previousIndex=-1,this.navigating=!1,this.currentSelectionState=void 0,this.editorHelper=i.createInstance(e_),this.registerListeners()}registerListeners(){this._register(this.onDidChange(()=>this.traceStack())),this._register(this.logService.onDidChangeLogLevel(()=>this.traceStack())),this._register(this.editorGroupService.onDidRemoveGroup(e=>{this.mapGroupToDisposable.deleteAndDispose(e.id)}))}traceStack(){if(this.logService.getLevel()!==ev.LogLevel.Trace)return;let e=[];for(let t of this.stack)"function"==typeof t.selection?.log?e.push(`- group: ${t.groupId}, editor: ${t.editor.resource?.toString()}, selection: ${t.selection.log()}`):e.push(`- group: ${t.groupId}, editor: ${t.editor.resource?.toString()}, selection: <none>`);0===e.length?this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}: <empty>`):this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}
144
+ ${e.join("\n")}
145
+ `)}trace(e,t=null,i){let o,r;if(this.logService.getLevel()===ev.LogLevel.Trace){switch(this.filter){case Z.GoFilter.NONE:o="global";break;case Z.GoFilter.EDITS:o="edits";break;case Z.GoFilter.NAVIGATION:o="navigation"}switch(this.scope){case Z.GoScope.DEFAULT:r="default";break;case Z.GoScope.EDITOR_GROUP:r="editorGroup";break;case Z.GoScope.EDITOR:r="editor"}null!==t?this.logService.trace(`[History stack ${o}-${r}]: ${e} (editor: ${t?.resource?.toString()}, event: ${this.traceEvent(i)})`):this.logService.trace(`[History stack ${o}-${r}]: ${e}`)}}traceEvent(e){if(!e)return"<none>";switch(e.reason){case A.EditorPaneSelectionChangeReason.EDIT:return"edit";case A.EditorPaneSelectionChangeReason.NAVIGATION:return"navigation";case A.EditorPaneSelectionChangeReason.JUMP:return"jump";case A.EditorPaneSelectionChangeReason.PROGRAMMATIC:return"programmatic";case A.EditorPaneSelectionChangeReason.USER:return"user"}}registerGroupListeners(e){if(!this.mapGroupToDisposable.has(e)){let t=this.editorGroupService.getGroup(e);t&&this.mapGroupToDisposable.set(e,t.onWillMoveEditor(e=>this.onWillMoveEditor(e)))}}onWillMoveEditor(e){if(this.trace("onWillMoveEditor()",e.editor),this.scope!==Z.GoScope.EDITOR_GROUP)for(let t of this.stack)t.groupId===e.groupId&&this.editorHelper.matchesEditor(e.editor,t.editor)&&(t.groupId=e.target)}notifyNavigation(e,t){this.trace("notifyNavigation()",e?.input,t);let i=(0,A.isEditorPaneWithSelection)(e),o=e?.input&&!e.input.isDisposed();this.navigating?(this.trace("notifyNavigation() ignoring (navigating)",e?.input,t),i&&o?(this.trace("notifyNavigation() updating current selection state",e?.input,t),this.currentSelectionState=new eb({groupId:e.group.id,editor:e.input},e.getSelection(),t?.reason)):(this.trace("notifyNavigation() dropping current selection state",e?.input,t),this.currentSelectionState=void 0)):(this.trace("notifyNavigation() not ignoring",e?.input,t),i&&o?this.onSelectionAwareEditorNavigation(e.group.id,e.input,e.getSelection(),t):(this.currentSelectionState=void 0,o&&this.onNonSelectionAwareEditorNavigation(e.group.id,e.input)))}onSelectionAwareEditorNavigation(e,t,i,o){if(this.current?.groupId===e&&!i&&this.editorHelper.matchesEditor(this.current.editor,t))return;this.trace("onSelectionAwareEditorNavigation()",t,o);let r=new eb({groupId:e,editor:t},i,o?.reason);!this.currentSelectionState||this.currentSelectionState.justifiesNewNavigationEntry(r)?this.doAdd(e,t,r.selection):this.doReplace(e,t,r.selection),this.currentSelectionState=r}onNonSelectionAwareEditorNavigation(e,t){this.current?.groupId===e&&this.editorHelper.matchesEditor(this.current.editor,t)||(this.trace("onNonSelectionAwareEditorNavigation()",t),this.doAdd(e,t))}doAdd(e,t,i){this.navigating||this.addOrReplace(e,t,i)}doReplace(e,t,i){this.navigating||this.addOrReplace(e,t,i,!0)}addOrReplace(e,t,i,o){this.registerGroupListeners(e);let r=!1;this.current&&(o?r=!0:this.shouldReplaceStackEntry(this.current,{groupId:e,editor:t,selection:i})&&(r=!0));let s=this.editorHelper.preferResourceEditorInput(t);if(!s)return;r?this.trace("replace()",s):this.trace("add()",s);let n={groupId:e,editor:s,selection:i},a=[];if(r)this.current&&a.push(this.current),this.current=n;else{if(this.stack.length>this.index+1){for(let e=this.index+1;e<this.stack.length;e++)a.push(this.stack[e]);this.stack=this.stack.slice(0,this.index+1)}this.stack.splice(this.index+1,0,n),this.stack.length>g.MAX_STACK_SIZE?(a.push(this.stack.shift()),this.previousIndex>=0&&this.previousIndex--):this.setIndex(this.index+1,!0)}for(let e of a)this.editorHelper.clearOnEditorDispose(e.editor,this.mapEditorToDisposable);(0,A.isEditorInput)(s)&&this.editorHelper.onEditorDispose(s,()=>this.remove(s),this.mapEditorToDisposable),this._onDidChange.fire()}shouldReplaceStackEntry(e,t){return e.groupId===t.groupId&&!!this.editorHelper.matchesEditor(e.editor,t.editor)&&(!e.selection||!!t.selection&&e.selection.compare(t.selection)===A.EditorPaneSelectionCompareResult.IDENTICAL)}move(e){if(e.isOperation(ee.FileOperation.MOVE))for(let t of this.stack)this.editorHelper.matchesEditor(e,t.editor)&&(t.editor={resource:e.target.resource})}remove(e){let t=this.stack.length;this.stack=this.stack.filter(t=>{let i="number"==typeof e?t.groupId===e:this.editorHelper.matchesEditor(e,t.editor);return i&&this.editorHelper.clearOnEditorDispose(t.editor,this.mapEditorToDisposable),!i}),t!==this.stack.length&&(this.flatten(),this.index=this.stack.length-1,this.previousIndex=-1,"number"==typeof e&&this.mapGroupToDisposable.deleteAndDispose(e),this._onDidChange.fire())}flatten(){let e,t=[];for(let i of this.stack)e&&this.shouldReplaceStackEntry(i,e)||(e=i,t.push(i));this.stack=t}clear(){this.index=-1,this.previousIndex=-1,this.stack.splice(0),this.mapEditorToDisposable.clearAndDisposeAll(),this.mapGroupToDisposable.clearAndDisposeAll()}dispose(){this.clear(),super.dispose()}canGoForward(){return this.stack.length>this.index+1}async goForward(){if(!await this.maybeGoCurrent()&&this.canGoForward())return this.setIndex(this.index+1),this.navigate()}canGoBack(){return this.index>0}async goBack(){if(!await this.maybeGoCurrent()&&this.canGoBack())return this.setIndex(this.index-1),this.navigate()}async goPrevious(){if(!await this.maybeGoCurrent())return -1===this.previousIndex?this.goBack():(this.setIndex(this.previousIndex),this.navigate())}canGoLast(){return this.stack.length>0}async goLast(){if(this.canGoLast())return this.setIndex(this.stack.length-1),this.navigate()}async maybeGoCurrent(){return!(this.filter===Z.GoFilter.NONE||this.isCurrentSelectionActive())&&(await this.navigate(),!0)}isCurrentSelectionActive(){if(!this.current?.selection)return!1;let e=this.editorService.activeEditorPane;if(!(0,A.isEditorPaneWithSelection)(e)||e.group.id!==this.current.groupId||!e.input||!this.editorHelper.matchesEditor(e.input,this.current.editor))return!1;let t=e.getSelection();return!!t&&t.compare(this.current.selection)===A.EditorPaneSelectionCompareResult.IDENTICAL}setIndex(e,t){this.previousIndex=this.index,this.index=e,t||this._onDidChange.fire()}async navigate(){this.navigating=!0;try{this.current&&await this.doNavigate(this.current)}finally{this.navigating=!1}}doNavigate(e){let t=Object.create(null);return(e.selection&&(t=e.selection.restore(t)),(0,A.isEditorInput)(e.editor))?this.editorService.openEditor(e.editor,t,e.groupId):this.editorService.openEditor({...e.editor,options:{...e.editor.options,...t}},e.groupId)}isNavigating(){return this.navigating}};eS=g=(0,w.__decorate)([(0,w.__param)(2,M.IInstantiationService),(0,w.__param)(3,J.IEditorService),(0,w.__param)(4,x.IEditorGroupsService),(0,w.__param)(5,W.ILogService)],eS);let e_=class{constructor(e,t,i,o){this.uriIdentityService=e,this.lifecycleService=t,this.fileService=i,this.pathService=o}preferResourceEditorInput(e){let t=A.EditorResourceAccessor.getOriginalUri(e);if(t?.scheme!==R.Schemas.file&&t?.scheme!==R.Schemas.vscodeRemote&&t?.scheme!==R.Schemas.vscodeUserData&&t?.scheme!==this.pathService.defaultUriScheme)return(0,A.isEditorInput)(e)?e:void 0;if((0,A.isEditorInput)(e)){let t=e.toUntyped();if((0,A.isResourceEditorInput)(t))return t}return e}matchesEditor(e,t){return e instanceof ee.FileChangesEvent||e instanceof ee.FileOperationEvent?!(0,A.isEditorInput)(t)&&(e instanceof ee.FileChangesEvent?e.contains(t.resource,ee.FileChangeType.DELETED):this.matchesFile(t.resource,e)):(0,A.isEditorInput)(e)?(0,A.isEditorInput)(t)?e.matches(t):this.matchesFile(t.resource,e):(0,A.isEditorInput)(t)?this.matchesFile(e.resource,t):e&&t&&this.uriIdentityService.extUri.isEqual(e.resource,t.resource)}matchesFile(e,t){if(t instanceof ee.FileChangesEvent)return t.contains(e,ee.FileChangeType.DELETED);if(t instanceof ee.FileOperationEvent)return this.uriIdentityService.extUri.isEqualOrParent(e,t.resource);if((0,A.isEditorInput)(t)){let i=t.resource;return!!i&&(!(this.lifecycleService.phase>=eg.LifecyclePhase.Restored)||!!this.fileService.hasProvider(i))&&this.uriIdentityService.extUri.isEqual(i,e)}return this.uriIdentityService.extUri.isEqual(t?.resource,e)}matchesEditorIdentifier(e,t){return!!t?.group&&e.groupId===t.group.id&&!!t.input&&e.editor.matches(t.input)}onEditorDispose(e,t,i){let o=U.Event.once(e.onWillDispose)(()=>t()),r=i.get(e);r||(r=new eo.DisposableStore,i.set(e,r)),r.add(o)}clearOnEditorDispose(e,t){(0,A.isEditorInput)(e)&&t.deleteAndDispose(e)}};e_=(0,w.__decorate)([(0,w.__param)(0,ep.IUriIdentityService),(0,w.__param)(1,em.ILifecycleService),(0,w.__param)(2,et.IFileService),(0,w.__param)(3,eu.IPathService)],e_),e.s(["HistoryService",0,eC],978336);var eE=e.i(654295),eI=_,eD=e.i(535567),eT=e.i(478697),eA=e.i(621826),ex=e.i(350803);let eR=new en.RawContextKey("activeCustomEditorId","",{type:"string",description:(0,O.localize)(6430,"The viewType of the currently active custom editor.")}),ek=new en.RawContextKey("focusedCustomEditorIsEditable",!1);(o=m||(m={})).default="default",o.builtin="builtin",o.option="option";class eM{constructor(e){this.id=e.id,this.displayName=e.displayName,this.providerDisplayName=e.providerDisplayName,this.priority=e.priority,this.selector=e.selector}matches(e){return this.selector.some(t=>t.filenamePattern&&(0,k.globMatchesResource)(t.filenamePattern,e))}}class eL{constructor(e){this.allEditors=(0,S.distinct)(e,e=>e.id)}get length(){return this.allEditors.length}get defaultEditor(){return this.allEditors.find(e=>{switch(e.priority){case k.RegisteredEditorPriority.default:case k.RegisteredEditorPriority.builtin:return this.allEditors.every(t=>{var i,o;return t===e||(i=t,o=e,(0,k.priorityToRank)(i.priority)<(0,k.priorityToRank)(o.priority))});default:return!1}})}get bestAvailableEditor(){return Array.from(this.allEditors).sort((e,t)=>(0,k.priorityToRank)(e.priority)-(0,k.priorityToRank)(t.priority))[0]}}var eO=e.i(537080);class eP{constructor(){this._references=new Map}async getAllModels(e){let t=`${e.toString()}@@@`,i=[];for(let[e,o]of this._references)e.startsWith(t)&&o.model&&i.push(await o.model);return i}async get(e,t){let i=this.key(e,t),o=this._references.get(i);return o?.model}tryRetain(e,t){let i=this.key(e,t),o=this._references.get(i);if(o)return o.counter++,o.model.then(e=>({object:e,dispose:(0,eO.createSingleCallFunction)(()=>{--o.counter<=0&&(o.model.then(e=>e.dispose()),this._references.delete(i))})}))}add(e,t,i){let o=this.key(e,t);if(this._references.get(o))throw Error("Model already exists");return this._references.set(o,{viewType:t,model:i,counter:0}),this.tryRetain(e,t)}disposeAllModelsForView(e){for(let[t,i]of this._references)i.viewType===e&&(i.model.then(e=>e.dispose()),this._references.delete(t))}key(e,t){return`${e.toString()}@@@${t}`}}var eV=e.i(865384),eK=_,eN=e.i(364078),eG=_,eF=e.i(526097),eW=e.i(888961),ez=e.i(425024),eB=e.i(695519);let eU=Object.freeze({viewType:"viewType",displayName:"displayName",selector:"selector",priority:"priority"}),eH={type:"object",required:[eU.viewType,eU.displayName,eU.selector],additionalProperties:!1,properties:{[eU.viewType]:{type:"string",markdownDescription:(0,O.localize)(6432,"Identifier for the custom editor. This must be unique across all custom editors, so we recommend including your extension id as part of `viewType`. The `viewType` is used when registering custom editors with `vscode.registerCustomEditorProvider` and in the `onCustomEditor:${id}` [activation event](https://code.visualstudio.com/api/references/activation-events).")},[eU.displayName]:{type:"string",description:(0,O.localize)(6433,"Human readable name of the custom editor. This is displayed to users when selecting which editor to use.")},[eU.selector]:{type:"array",description:(0,O.localize)(6434,"Set of globs that the custom editor is enabled for."),items:{type:"object",defaultSnippets:[{body:{filenamePattern:"$1"}}],additionalProperties:!1,properties:{filenamePattern:{type:"string",description:(0,O.localize)(6435,"Glob that the custom editor is enabled for.")}}}},[eU.priority]:{type:"string",markdownDeprecationMessage:(0,O.localize)(6436,"Controls if the custom editor is enabled automatically when the user opens a file. This may be overridden by users using the `workbench.editorAssociations` setting."),enum:[m.default,m.option],markdownEnumDescriptions:[(0,O.localize)(6437,"The editor is automatically used when the user opens a resource, provided that no other default custom editors are registered for that resource."),(0,O.localize)(6438,"The editor is not automatically used when the user opens a resource, but a user can switch to the editor using the `Reopen With` command.")],default:m.default}}},e$=ez.ExtensionsRegistry.registerExtensionPoint({extensionPoint:"customEditors",deps:[eB.languagesExtPoint],jsonSchema:{description:(0,O.localize)(6439,"Contributed custom editors."),type:"array",defaultSnippets:[{body:[{[eU.viewType]:"$1",[eU.displayName]:"$2",[eU.selector]:[{filenamePattern:"$3"}]}]}],items:eH},activationEventsGenerator:function*(e){for(let t of e){let e=t[eU.viewType];e&&(yield`onCustomEditor:${e}`)}}});class eq extends eG.Disposable{constructor(){super(...arguments),this.type="table"}shouldRender(e){return!!e.contributes?.customEditors}render(e){let t=e.contributes?.customEditors||[];return t.length?{data:{headers:[(0,O.localize)(6440,"View Type"),(0,O.localize)(6441,"Priority"),(0,O.localize)(6442,"Filename Pattern")],rows:t.map(e=>[e.viewType,e.priority??"",(0,S.coalesce)(e.selector.map(e=>e.filenamePattern)).join(", ")])},dispose:()=>{}}:{data:{headers:[],rows:[]},dispose:()=>{}}}}eA.Registry.as(eW.Extensions.ExtensionFeaturesRegistry).registerExtensionFeature({id:"customEditors",label:(0,O.localize)(6443,"Custom Editors"),access:{canToggle:!1},renderer:new eF.SyncDescriptor(eq)});class eY extends eK.Disposable{static{this.CUSTOM_EDITORS_STORAGE_ID="customEditors"}static{this.CUSTOM_EDITORS_ENTRY_ID="editors"}constructor(e){for(const t of(super(),this._editors=new Map,this._onChange=this._register(new U.Emitter),this.onChange=this._onChange.event,this._memento=new eN.Memento(eY.CUSTOM_EDITORS_STORAGE_ID,e),this._memento.getMemento(N.StorageScope.PROFILE,N.StorageTarget.MACHINE)[eY.CUSTOM_EDITORS_ENTRY_ID]||[]))this.add(new eM(t));this._register(e$.setHandler(e=>{this.update(e)}))}update(e){for(let t of(this._editors.clear(),e))for(let e of t.value)this.add(new eM({id:e.viewType,displayName:e.displayName,providerDisplayName:t.description.isBuiltin?(0,O.localize)(6429,"Built-in"):t.description.displayName||t.description.identifier.value,selector:e.selector||[],priority:function(e,t){switch(e.priority){case m.default:return k.RegisteredEditorPriority.default;case m.option:return k.RegisteredEditorPriority.option;case m.builtin:return t.isBuiltin?k.RegisteredEditorPriority.builtin:k.RegisteredEditorPriority.default;default:return k.RegisteredEditorPriority.default}}(e,t.description)}));this._memento.getMemento(N.StorageScope.PROFILE,N.StorageTarget.MACHINE)[eY.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._editors.values()),this._memento.saveMemento(),this._onChange.fire()}[Symbol.iterator](){return this._editors.values()}get(e){return this._editors.get(e)}getContributedEditors(e){return Array.from(this._editors.values()).filter(t=>t.matches(e))}add(e){this._editors.has(e.id)?console.error(`Custom editor with id '${e.id}' already registered`):this._editors.set(e.id,e)}}var ej=e.i(921217);(0,eE.registerCss)(void 0);let eX=class extends eI.Disposable{constructor(e,t,i,o,r,s,n){super(),this.editorService=i,this.editorGroupService=o,this.instantiationService=r,this.uriIdentityService=s,this.editorResolverService=n,this._untitledCounter=0,this._editorResolverDisposables=this._register(new eI.DisposableStore),this._editorCapabilities=new Map,this._onDidChangeEditorTypes=this._register(new U.Emitter),this.onDidChangeEditorTypes=this._onDidChangeEditorTypes.event,this._fileEditorFactory=eA.Registry.as(A.EditorExtensions.EditorFactory).getFileEditorFactory(),this._models=new eP,this._contributedEditors=this._register(new eY(t)),this.editorResolverService.bufferChangeEvents(this.registerContributionPoints.bind(this)),this._register(this._contributedEditors.onChange(()=>{this.editorResolverService.bufferChangeEvents(this.registerContributionPoints.bind(this)),this._onDidChangeEditorTypes.fire()}));const a={contextKey:eR,getGroupContextKeyValue:e=>this.getActiveCustomEditorId(e),onDidChange:this.onDidChangeEditorTypes},d={contextKey:ek,getGroupContextKeyValue:e=>this.getCustomEditorIsEditable(e),onDidChange:this.onDidChangeEditorTypes};this._register(this.editorGroupService.registerContextKeyProvider(a)),this._register(this.editorGroupService.registerContextKeyProvider(d)),this._register(e.onDidRunOperation(e=>{e.isOperation(ee.FileOperation.MOVE)&&this.handleMovedFileInOpenedFileEditors(e.resource,this.uriIdentityService.asCanonicalUri(e.target.resource))})),this._register(eT.UndoCommand.addImplementation(105,"custom-editor",()=>this.withActiveCustomEditor(e=>e.undo()))),this._register(eT.RedoCommand.addImplementation(105,"custom-editor",()=>this.withActiveCustomEditor(e=>e.redo())))}getEditorTypes(){return[...this._contributedEditors]}withActiveCustomEditor(e){let t=this.editorService.activeEditor;if(t instanceof ej.CustomEditorInput){let i=e(t);return!i||i}return!1}registerContributionPoints(){for(let e of(this._editorResolverDisposables.clear(),this._contributedEditors))for(let t of e.selector)t.filenamePattern&&this._editorResolverDisposables.add(this.editorResolverService.registerEditor(t.filenamePattern,{id:e.id,label:e.displayName,detail:e.providerDisplayName,priority:e.priority},{singlePerResource:()=>!this.getCustomEditorCapabilities(e.id)?.supportsMultipleEditorsPerDocument},{createEditorInput:({resource:t},i)=>({editor:ej.CustomEditorInput.create(this.instantiationService,{resource:t,viewType:e.id,webviewTitle:void 0,iconPath:void 0},i.id)}),createUntitledEditorInput:({resource:t},i)=>({editor:ej.CustomEditorInput.create(this.instantiationService,{resource:t??I.URI.from({scheme:R.Schemas.untitled,authority:`Untitled-${this._untitledCounter++}`}),viewType:e.id,webviewTitle:void 0,iconPath:void 0},i.id)}),createDiffEditorInput:(t,i)=>({editor:this.createDiffEditorInput(t,e.id,i)})}))}createDiffEditorInput(e,t,i){let o=ej.CustomEditorInput.create(this.instantiationService,{resource:(0,eD.assertReturnsDefined)(e.modified.resource),viewType:t,webviewTitle:void 0,iconPath:void 0},i.id,{customClasses:"modified"}),r=ej.CustomEditorInput.create(this.instantiationService,{resource:(0,eD.assertReturnsDefined)(e.original.resource),viewType:t,webviewTitle:void 0,iconPath:void 0},i.id,{customClasses:"original"});return this.instantiationService.createInstance(ex.DiffEditorInput,e.label,e.description,r,o,!0)}get models(){return this._models}getCustomEditor(e){return this._contributedEditors.get(e)}getContributedCustomEditors(e){return new eL(this._contributedEditors.getContributedEditors(e))}getUserConfiguredCustomEditors(e){let t=this.editorResolverService.getAssociationsForResource(e);return new eL((0,S.coalesce)(t.map(e=>this._contributedEditors.get(e.viewType))))}getAllCustomEditors(e){return new eL([...this.getUserConfiguredCustomEditors(e).allEditors,...this.getContributedCustomEditors(e).allEditors])}registerCustomEditorCapabilities(e,t){if(this._editorCapabilities.has(e))throw Error(`Capabilities for ${e} already set`);return this._editorCapabilities.set(e,t),(0,eI.toDisposable)(()=>{this._editorCapabilities.delete(e)})}getCustomEditorCapabilities(e){return this._editorCapabilities.get(e)}getActiveCustomEditorId(e){let t=e.activeEditorPane;return t?.input?.resource&&t?.input instanceof ej.CustomEditorInput?t.input.viewType:""}getCustomEditorIsEditable(e){let t=e.activeEditorPane;return!!t?.input?.resource&&t?.input instanceof ej.CustomEditorInput}async handleMovedFileInOpenedFileEditors(e,t){if((0,E.extname)(e).toLowerCase()===(0,E.extname)(t).toLowerCase())return;let i=this.getAllCustomEditors(t);if(!i.allEditors.some(e=>e.priority!==k.RegisteredEditorPriority.option))return;let o=new Map;for(let e of this.editorGroupService.groups)for(let i of e.editors)if(this._fileEditorFactory.isFileEditor(i)&&!(i instanceof ej.CustomEditorInput)&&(0,E.isEqual)(i.resource,t)){let t=o.get(e.id);t||(t=[],o.set(e.id,t)),t.push(i)}if(o.size)for(let[e,r]of o)this.editorService.replaceEditors(r.map(o=>{let r;if(i.defaultEditor){let o=i.defaultEditor.id;r=ej.CustomEditorInput.create(this.instantiationService,{resource:t,viewType:o,webviewTitle:void 0,iconPath:void 0},e)}else r={resource:t,options:{override:A.DEFAULT_EDITOR_ASSOCIATION.id}};return{editor:o,replacement:r,options:{preserveFocus:!0}}}),e)}};eX=(0,w.__decorate)([(0,w.__param)(0,et.IFileService),(0,w.__param)(1,G.IStorageService),(0,w.__param)(2,J.IEditorService),(0,w.__param)(3,x.IEditorGroupsService),(0,w.__param)(4,M.IInstantiationService),(0,w.__param)(5,ep.IUriIdentityService),(0,w.__param)(6,eV.IEditorResolverService)],eX),e.s(["CustomEditorService",0,eX],197375);var eJ=_,eZ=e.i(688857),eQ=_,e0=e.i(69150),e1=e.i(604634),e2=e.i(575129);e.i(698014),e.i(140331),e.i(471999),e.i(900329),e.i(785266),e.i(181268),e.i(70177),e.i(575210),e.i(890787),e.i(67920);var e3=e.i(232762),e5=e.i(905192);let e6=class extends eQ.Disposable{constructor(e,t){super(),this._themeService=e,this._configurationService=t,this._cachedWebViewThemeData=void 0,this._onThemeDataChanged=this._register(new U.Emitter),this.onThemeDataChanged=this._onThemeDataChanged.event,this._register(this._themeService.onDidColorThemeChange(()=>{this._reset()}));const i=["editor.fontFamily","editor.fontWeight","editor.fontSize","editor.fontLigatures","accessibility.underlineLinks"];this._register(this._configurationService.onDidChangeConfiguration(e=>{i.some(t=>e.affectsConfiguration(t))&&this._reset()}))}getTheme(){return this._themeService.getColorTheme()}getWebviewThemeData(){if(!this._cachedWebViewThemeData){let e=this._configurationService.getValue("editor"),t=e.fontFamily||e1.EDITOR_FONT_DEFAULTS.fontFamily,i=e.fontWeight||e1.EDITOR_FONT_DEFAULTS.fontWeight,o=e.fontSize||e1.EDITOR_FONT_DEFAULTS.fontSize,r=new e0.EditorFontLigatures().validate(e.fontLigatures),s=this._configurationService.getValue("accessibility.underlineLinks"),n=this._themeService.getColorTheme(),a=(0,e2.getColorRegistry)().getColors().reduce((e,t)=>{let i=n.getColor(t.id);return i&&(e["vscode-"+t.id.replace(".","-")]=i.toString()),e},{}),d={"vscode-font-family":eZ.DEFAULT_FONT_FAMILY,"vscode-font-weight":"normal","vscode-font-size":"13px","vscode-editor-font-family":t,"vscode-editor-font-weight":i,"vscode-editor-font-size":o+"px","text-link-decoration":s?"underline":"none",...a,"vscode-editor-font-feature-settings":r},l=v.fromTheme(n);this._cachedWebViewThemeData={styles:d,activeTheme:l,themeLabel:n.label,themeId:n.settingsId}}return this._cachedWebViewThemeData}_reset(){this._cachedWebViewThemeData=void 0,this._onThemeDataChanged.fire()}};e6=(0,w.__decorate)([(0,w.__param)(0,e5.IWorkbenchThemeService),(0,w.__param)(1,D.IConfigurationService)],e6),(r=v||(v={})).light="vscode-light",r.dark="vscode-dark",r.highContrast="vscode-high-contrast",r.highContrastLight="vscode-high-contrast-light",(s=v||(v={})).fromTheme=function(e){switch(e.type){case e3.ColorScheme.LIGHT:return s.light;case e3.ColorScheme.DARK:return s.dark;case e3.ColorScheme.HIGH_CONTRAST_DARK:return s.highContrast;case e3.ColorScheme.HIGH_CONTRAST_LIGHT:return s.highContrastLight}};var e4=e.i(322193),e9=e.i(64279),e8=e.i(590746),e7=e.i(107043),te=e.i(704994),tt=_;e.i(71224);var ti=e.i(193409),to=e.i(627886),tr=e.i(686380),ts=e.i(919101),tn=e.i(667499),ta=e.i(806987),td=e.i(914331);class tl{constructor(e,t,i){this._getExtensionLocation=e,this._getMappings=t,this.tunnelService=i,this._tunnels=new Map}async getRedirect(e,t){let i=I.URI.parse(t),o=(0,td.extractLocalHostUriMetaDataForPortMapping)(i);if(o){for(let t of this._getMappings())if(t.webviewPort===o.port){let r=this._getExtensionLocation();if(r&&r.scheme===R.Schemas.vscodeRemote){let o=e&&await this.getOrCreateTunnel(e,t.extensionHostPort);if(o){if(o.tunnelLocalPort===t.webviewPort)return;return encodeURI(i.with({authority:`127.0.0.1:${o.tunnelLocalPort}`}).toString(!0))}}if(t.webviewPort!==t.extensionHostPort)return encodeURI(i.with({authority:`${o.address}:${t.extensionHostPort}`}).toString(!0))}}}async dispose(){for(let e of this._tunnels.values())await e.dispose();this._tunnels.clear()}async getOrCreateTunnel(e,t){let i,o=this._tunnels.get(t);return o||("string"==typeof await this.tunnelService.openTunnel({getAddress:async()=>e},void 0,t)&&(i=void 0),i&&this._tunnels.set(t,i),i)}}var tc=e.i(772383),th=e.i(331508),tu=e.i(72469),tp=e.i(771275),tg=e.i(419031);let tm=new Map([[".svg","image/svg+xml"],[".txt",tg.Mimes.text],[".css","text/css"],[".js","application/javascript"],[".cjs","application/javascript"],[".mjs","application/javascript"],[".json","application/json"],[".html","text/html"],[".htm","text/html"],[".xhtml","application/xhtml+xml"],[".oft","font/otf"],[".xml","application/xml"],[".wasm","application/wasm"]]);async function tv(e,t,i,o,r){let s,n=function(e,t){for(let o of t)if(function(e,t){if(e.scheme!==t.scheme)return!1;let i=(0,tp.normalize)(t.fsPath),o=(0,tp.normalize)(e.fsPath+(e.fsPath.endsWith(tp.sep)?"":tp.sep));return(0,tu.isUNC)(e.fsPath)&&(0,tu.isUNC)(t.fsPath)&&(o=o.toLowerCase(),i=i.toLowerCase()),i.startsWith(o)}(o,e)){var i;return(i=e).scheme===R.Schemas.vscodeRemote?I.URI.from({scheme:R.Schemas.vscodeRemote,authority:i.authority,path:"/vscode-resource",query:JSON.stringify({requestResourcePath:i.path})}):i}}(e,t.roots);if(o.trace(`Webview.loadLocalResource - trying to load resource. requestUri=${e}, resourceToLoad=${n}`),!n)return o.trace(`Webview.loadLocalResource - access denied. requestUri=${e}, resourceToLoad=${n}`),y.AccessDenied;let a=(s=(0,tp.extname)(e.fsPath).toLowerCase(),tm.get(s)||(0,tg.getMediaMime)(e.fsPath)||tg.Mimes.unknown);try{let s=await i.readFileStream(n,{etag:t.ifNoneMatch},r);return o.trace(`Webview.loadLocalResource - Loaded. requestUri=${e}, resourceToLoad=${n}`),new y.StreamSuccess(s.value,s.etag,s.mtime,a)}catch(t){if(t instanceof ee.FileOperationError&&t.fileOperationResult===ee.FileOperationResult.FILE_NOT_MODIFIED_SINCE)return o.trace(`Webview.loadLocalResource - not modified. requestUri=${e}, resourceToLoad=${n}`),new y.NotModified(a,t.options?.mtime);return o.error(`Webview.loadLocalResource - Error using fileReader. requestUri=${e}, resourceToLoad=${n}`),y.Failed}}(a=t=(n=y||(y={})).Type||(n.Type={}))[a.Success=0]="Success",a[a.Failed=1]="Failed",a[a.AccessDenied=2]="AccessDenied",a[a.NotModified=3]="NotModified",n.StreamSuccess=class{constructor(e,i,o,r){this.stream=e,this.etag=i,this.mtime=o,this.mimeType=r,this.type=t.Success}},n.Failed={type:t.Failed},n.AccessDenied={type:t.AccessDenied},n.NotModified=class{constructor(e,i){this.mimeType=e,this.mtime=i,this.type=t.NotModified}};var ty=e.i(496119),tC=e.i(487495),tb=e.i(84513),tw=e.i(598720),tf=e.i(83823),tS=e.i(157602),t_=e.i(357234),tE=e.i(16198),tI=e.i(321012),tD=e.i(388064),tT=e.i(693205),tA=e.i(192514),tx=e.i(323325),tR=e.i(490819),tk=e.i(430807);(0,eE.registerCss)(void 0);let tM=(0,O.localize)(6165,"Find"),tL=(0,O.localize)(6166,"Find"),tO=(0,O.localize)(6167,"Previous Match"),tP=(0,O.localize)(6168,"Next Match"),tV=(0,O.localize)(6169,"Close");class tK extends tw.Widget{constructor(e,t,i,o,r){super(),this._keybindingService=r,this._isVisible=!1,this._foundMatch=!1,this._width=0,this.state=this._register(new tS.FindReplaceState),this._matchesLimit=e.matchesLimit??Number.MAX_SAFE_INTEGER,this._findInput=this._register(new tE.ContextScopedFindInput(null,t,{label:tM,placeholder:tL,validation:e=>{if(0===e.length||!this._findInput.getRegex())return null;try{return new RegExp(e),null}catch(e){return this._foundMatch=!1,this.updateButtons(this._foundMatch),{content:e.message}}},showCommonFindToggles:e.showCommonFindToggles,appendCaseSensitiveLabel:e.appendCaseSensitiveActionId?this._getKeybinding(e.appendCaseSensitiveActionId):void 0,appendRegexLabel:e.appendRegexActionId?this._getKeybinding(e.appendRegexActionId):void 0,appendWholeWordsLabel:e.appendWholeWordsActionId?this._getKeybinding(e.appendWholeWordsActionId):void 0,showHistoryHint:()=>(0,tA.showHistoryKeybindingHint)(r),inputBoxStyles:tR.defaultInputBoxStyles,toggleStyles:tR.defaultToggleStyles},i)),this._updateHistoryDelayer=this._register(new e8.Delayer(500)),this._register(this._findInput.onInput(async t=>{e.checkImeCompletionState&&this._findInput.isImeSessionInProgress||(this._foundMatch=this._onInputChanged(),e.showResultCount&&await this.updateResultCount(),this.updateButtons(this._foundMatch),this.focusFindBox(),this._delayedUpdateHistory())})),this._findInput.setRegex(!!this.state.isRegex),this._findInput.setCaseSensitive(!!this.state.matchCase),this._findInput.setWholeWords(!!this.state.wholeWord),this._register(this._findInput.onDidOptionChange(()=>{this.state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this.state.onFindReplaceStateChange(()=>{this._findInput.setRegex(this.state.isRegex),this._findInput.setWholeWords(this.state.wholeWord),this._findInput.setCaseSensitive(this.state.matchCase),this.findFirst()}));const s={groupId:"simple-find-widget"};this.prevBtn=this._register(new t_.SimpleButton({label:tO+(e.previousMatchActionId?this._getKeybinding(e.previousMatchActionId):""),icon:t_.findPreviousMatchIcon,hoverLifecycleOptions:s,onTrigger:()=>{this.find(!0)}},o)),this.nextBtn=this._register(new t_.SimpleButton({label:tP+(e.nextMatchActionId?this._getKeybinding(e.nextMatchActionId):""),icon:t_.findNextMatchIcon,hoverLifecycleOptions:s,onTrigger:()=>{this.find(!1)}},o));const n=this._register(new t_.SimpleButton({label:tV+(e.closeWidgetActionId?this._getKeybinding(e.closeWidgetActionId):""),icon:tI.widgetClose,hoverLifecycleOptions:s,onTrigger:()=>{this.hide()}},o));this._innerDomNode=(0,ed.createElement)("div"),this._innerDomNode.classList.add("simple-find-part"),this._innerDomNode.appendChild(this._findInput.domNode),this._innerDomNode.appendChild(this.prevBtn.domNode),this._innerDomNode.appendChild(this.nextBtn.domNode),this._innerDomNode.appendChild(n.domNode),this._domNode=(0,ed.createElement)("div"),this._domNode.classList.add("simple-find-part-wrapper"),this._domNode.appendChild(this._innerDomNode),this.onkeyup(this._innerDomNode,e=>{if(e.equals(tf.KeyCode.Escape)){this.hide(),e.preventDefault();return}}),this._focusTracker=this._register((0,ed.trackFocus)(this._innerDomNode)),this._register(this._focusTracker.onDidFocus(this._onFocusTrackerFocus.bind(this))),this._register(this._focusTracker.onDidBlur(this._onFocusTrackerBlur.bind(this))),this._findInputFocusTracker=this._register((0,ed.trackFocus)(this._findInput.domNode)),this._register(this._findInputFocusTracker.onDidFocus(this._onFindInputFocusTrackerFocus.bind(this))),this._register(this._findInputFocusTracker.onDidBlur(this._onFindInputFocusTrackerBlur.bind(this))),this._register((0,ed.addDisposableListener)(this._innerDomNode,"click",e=>{e.stopPropagation()})),e?.showResultCount&&(this._domNode.classList.add("result-count"),this._matchesCount=(0,ed.createElement)("div"),this._matchesCount.className="matchesCount",this._findInput.domNode.insertAdjacentElement("afterend",this._matchesCount),this._register(this._findInput.onDidChange(async()=>{await this.updateResultCount()})),this._register(this._findInput.onDidOptionChange(async()=>{this._foundMatch=this._onInputChanged(),await this.updateResultCount(),this.focusFindBox(),this._delayedUpdateHistory()})));let a=e?.initialWidth;if(a&&(a=a<310?310:a,this._domNode.style.width=`${a}px`),e?.enableSash){const e=a??310;let t=e;const i=this._register(new tk.Sash(this._innerDomNode,this,{orientation:tk.Orientation.VERTICAL,size:1}));this._register(i.onDidStart(()=>{t=parseFloat((0,ed.getComputedStyle)(this._domNode).width)})),this._register(i.onDidChange(i=>{let o=t+i.startX-i.currentX;o<e||(this._domNode.style.width=`${o}px`)})),this._register(i.onDidReset(t=>{parseFloat((0,ed.getComputedStyle)(this._domNode).width)===e?this._domNode.style.width="100%":this._domNode.style.width=`${e}px`}))}}getVerticalSashLeft(e){return 0}get inputValue(){return this._findInput.getValue()}get focusTracker(){return this._focusTracker}_getKeybinding(e){let t=this._keybindingService?.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}dispose(){super.dispose(),this._domNode?.remove()}isVisible(){return this._isVisible}getDomNode(){return this._domNode}getFindInputDomNode(){return this._findInput.domNode}reveal(e,t=!0){(e&&this._findInput.setValue(e),this._isVisible)?this._findInput.select():(this._isVisible=!0,this.updateResultCount(),this.layout(),setTimeout(()=>{this._innerDomNode.classList.toggle("suppress-transition",!t),this._innerDomNode.classList.add("visible","visible-transition"),this._innerDomNode.setAttribute("aria-hidden","false"),this._findInput.select(),t||setTimeout(()=>{this._innerDomNode.classList.remove("suppress-transition")},0)},0))}show(e){e&&!this._isVisible&&this._findInput.setValue(e),this._isVisible=!0,this.layout(),setTimeout(()=>{this._innerDomNode.classList.add("visible","visible-transition"),this._innerDomNode.setAttribute("aria-hidden","false")},0)}hide(e=!0){this._isVisible&&(this._innerDomNode.classList.toggle("suppress-transition",!e),this._innerDomNode.classList.remove("visible-transition"),this._innerDomNode.setAttribute("aria-hidden","true"),setTimeout(()=>{this._isVisible=!1,this.updateButtons(this._foundMatch),this._innerDomNode.classList.remove("visible","suppress-transition")},200*!!e))}layout(e=this._width){if(this._width=e,this._isVisible&&this._matchesCount){let t=!1;411>=e&&(t=!0),this._innerDomNode.classList.toggle("reduced-find-widget",t)}}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this))}_updateHistory(){this._findInput.inputBox.addToHistory()}_getRegexValue(){return this._findInput.getRegex()}_getWholeWordValue(){return this._findInput.getWholeWords()}_getCaseSensitiveValue(){return this._findInput.getCaseSensitive()}updateButtons(e){let t=this.inputValue.length>0;this.prevBtn.setEnabled(this._isVisible&&t&&e),this.nextBtn.setEnabled(this._isVisible&&t&&e)}focusFindBox(){this.nextBtn.focus(),this._findInput.inputBox.focus()}async updateResultCount(){if(!this._matchesCount)return void this.updateButtons(this._foundMatch);let e=await this._getResultCount();this._matchesCount.textContent="";let t=this.inputValue.length>0&&e?.resultCount===0;this._matchesCount.classList.toggle("no-results",t);let i="";if(e?.resultCount){let t=String(e.resultCount);e.resultCount>=this._matchesLimit&&(t+="+");let o=String(e.resultIndex+1);"0"===o&&(o="?"),i=(0,tT.format)(t_.NLS_MATCHES_LOCATION,o,t)}else i=t_.NLS_NO_RESULTS;(0,tx.status)(this._announceSearchResults(i,this.inputValue)),this._matchesCount.appendChild((0,ed.createTextNode)(i)),this._foundMatch=!!e&&e.resultCount>0,this.updateButtons(this._foundMatch)}changeState(e){this.state.change(e,!1)}_announceSearchResults(e,t){return t?e===t_.NLS_NO_RESULTS?""===t?(0,O.localize)(6171,"{0} found",e):(0,O.localize)(6172,"{0} found for '{1}'",e,t):(0,O.localize)(6173,"{0} found for '{1}'",e,t):(0,O.localize)(6170,"Enter search input")}}let tN=(0,e2.registerColor)("simpleFindWidget.sashBorder",{dark:"#454545",light:"#C8C8C8",hcDark:"#6FC3DF",hcLight:"#0F4A85"},(0,O.localize)(6174,"Border color of the sash border."));(0,tD.registerThemingParticipant)((e,t)=>{let i=e.getColor(tN);t.addRule(`.monaco-workbench .simple-find-part .monaco-sash { background-color: ${i}; border-color: ${i} }`)});let tG=class extends tK{async _getResultCount(e){}constructor(e,t,i,o,r){super({showCommonFindToggles:!1,checkImeCompletionState:e.checkImeCompletionState,enableSash:!0},t,i,o,r),this._delegate=e,this._findWidgetFocused=ty.KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED.bindTo(i),this._register(e.hasFindResult(e=>{this.updateButtons(e),this.focusFindBox()})),this._register(e.onDidStopFind(()=>{this.updateButtons(!1)}))}find(e){let t=this.inputValue;t&&this._delegate.find(t,e)}hide(e=!0){super.hide(e),this._delegate.stopFind(!0),this._delegate.focus()}_onInputChanged(){let e=this.inputValue;return e?this._delegate.updateFind(e):this._delegate.stopFind(!1),!1}_onFocusTrackerFocus(){this._findWidgetFocused.set(!0)}_onFocusTrackerBlur(){this._findWidgetFocused.reset()}_onFindInputFocusTrackerFocus(){}_onFindInputFocusTrackerBlur(){}findFirst(){}};tG=(0,w.__decorate)([(0,w.__param)(1,ts.IContextViewService),(0,w.__param)(2,ea.IContextKeyService),(0,w.__param)(3,tC.IHoverService),(0,w.__param)(4,tb.IKeybindingService)],tG);var tF=e.i(532816);(l=i=(d=C||(C={})).Type||(d.Type={}))[l.Initializing=0]="Initializing",l[l.Ready=1]="Ready",d.Initializing=class{constructor(e){this.pendingMessages=e,this.type=i.Initializing}},d.Ready={type:i.Ready};let tW=class extends tt.Disposable{get window(){return"number"==typeof this._windowId?(0,ed.getWindowById)(this._windowId)?.window:void 0}get platform(){return"browser"}get element(){return this._element}get isFocused(){if(!this._focused||!this.window)return!1;let e=(0,ed.getActiveElement)(this.window.document);return!e||e===this.element}constructor(e,t,i,o,r,s,n,a,d,l,c,h){super(),this.webviewThemeDataProvider=t,this._environmentService=s,this._fileService=n,this._logService=a,this._remoteAuthorityResolverService=d,this._tunnelService=l,this._accessibilityService=h,this.id=(0,ti.generateUuid)(),this._windowId=void 0,this._expectedServiceWorkerVersion=4,this._state=new C.Initializing([]),this._resourceLoadingCts=this._register(new te.CancellationTokenSource),this._focusDelayer=this._register(new e8.ThrottledDelayer(50)),this._onDidHtmlChange=this._register(new U.Emitter),this.onDidHtmlChange=this._onDidHtmlChange.event,this._messageHandlers=new Map,this.checkImeCompletionState=!0,this.intrinsicContentSize=(0,tF.observableValue)("WebviewIntrinsicContentSize",void 0),this._disposed=!1,this._onMissingCsp=this._register(new U.Emitter),this.onMissingCsp=this._onMissingCsp.event,this._onDidClickLink=this._register(new U.Emitter),this.onDidClickLink=this._onDidClickLink.event,this._onMessage=this._register(new U.Emitter),this.onMessage=this._onMessage.event,this._onDidScroll=this._register(new U.Emitter),this.onDidScroll=this._onDidScroll.event,this._onDidWheel=this._register(new U.Emitter),this.onDidWheel=this._onDidWheel.event,this._onDidUpdateState=this._register(new U.Emitter),this.onDidUpdateState=this._onDidUpdateState.event,this._onDidFocus=this._register(new U.Emitter),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new U.Emitter),this.onDidBlur=this._onDidBlur.event,this._onFatalError=this._register(new U.Emitter),this.onFatalError=this._onFatalError.event,this._onDidDispose=this._register(new U.Emitter),this.onDidDispose=this._onDidDispose.event,this._hasAlertedAboutMissingCsp=!1,this._hasFindResult=this._register(new U.Emitter),this.hasFindResult=this._hasFindResult.event,this._onDidStopFind=this._register(new U.Emitter),this.onDidStopFind=this._onDidStopFind.event,this.providedViewType=e.providedViewType,this.origin=e.origin??this.id,this._options=e.options,this.extension=e.extension,this._content={html:"",title:e.title,options:e.contentOptions,state:void 0},this._portMappingManager=this._register(new tl(()=>this.extension?.location,()=>this._content.options.portMapping||[],this._tunnelService)),this._element=this._createElement(e.options,e.contentOptions),this._register(this.on("no-csp-found",()=>{this.handleNoCspFound()})),this._register(this.on("did-click-link",({uri:e})=>{this._onDidClickLink.fire(e)})),this._register(this.on("onmessage",({message:e,transfer:t})=>{this._onMessage.fire({message:e,transfer:t})})),this._register(this.on("did-scroll",({scrollYPercentage:e})=>{this._onDidScroll.fire({scrollYPercentage:e})})),this._register(this.on("do-reload",()=>{this.reload()})),this._register(this.on("do-update-state",e=>{this.state=e,this._onDidUpdateState.fire(e)})),this._register(this.on("did-focus",()=>{this.handleFocusChange(!0)})),this._register(this.on("did-blur",()=>{this.handleFocusChange(!1)})),this._register(this.on("did-scroll-wheel",e=>{this._onDidWheel.fire(e)})),this._register(this.on("did-find",({didFind:e})=>{this._hasFindResult.fire(e)})),this._register(this.on("fatal-error",e=>{r.error((0,O.localize)(13158,"Error loading webview: {0}",e.message)),this._onFatalError.fire({message:e.message})})),this._register(this.on("did-keydown",e=>{this.handleKeyEvent("keydown",e)})),this._register(this.on("did-keyup",e=>{this.handleKeyEvent("keyup",e)})),this._register(this.on("did-context-menu",e=>{if(!this.element||!this._contextKeyService)return;let t=this.element.getBoundingClientRect(),i=this._contextKeyService.createOverlay([...Object.entries(e.context),["webviewId",this.providedViewType]]);o.showContextMenu({menuId:tr.MenuId.WebviewContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:i,getActionsContext:()=>({...e.context,webview:this.providedViewType}),getAnchor:()=>({x:t.x+e.clientX,y:t.y+e.clientY})}),this._send("set-context-menu-visible",{visible:!0})})),this._register(this.on("load-resource",async e=>{try{let t=(0,th.decodeAuthority)(e.authority),i=I.URI.from({scheme:e.scheme,authority:t,path:decodeURIComponent(e.path),query:e.query?decodeURIComponent(e.query):e.query});this.loadResource(e.id,i,e.ifNoneMatch)}catch(t){this._send("did-load-resource",{id:e.id,status:404,path:e.path})}})),this._register(this.on("load-localhost",e=>{this.localLocalhost(e.id,e.origin)})),this._register(U.Event.runAndSubscribe(t.onThemeDataChanged,()=>this.style())),this._register(h.onDidChangeReducedMotion(()=>this.style())),this._register(h.onDidChangeScreenReaderOptimized(()=>this.style())),this._register(o.onDidHideContextMenu(()=>this._send("set-context-menu-visible",{visible:!1}))),this._confirmBeforeClose=i.getValue("window.confirmBeforeClose"),this._register(i.onDidChangeConfiguration(e=>{e.affectsConfiguration("window.confirmBeforeClose")&&(this._confirmBeforeClose=i.getValue("window.confirmBeforeClose"),this._send("set-confirm-before-close",this._confirmBeforeClose))})),this._register(this.on("drag-start",()=>{this._startBlockingIframeDragEvents()})),this._register(this.on("drag",e=>{this.handleDragEvent("drag",e)})),this._register(this.on("updated-intrinsic-content-size",e=>{this.intrinsicContentSize.set({width:e.width,height:e.height},void 0,void 0)})),e.options.enableFindWidget&&(this._webviewFindWidget=this._register(c.createInstance(tG,this)))}dispose(){if(this._disposed=!0,this.element?.remove(),this._element=void 0,this._messagePort=void 0,this._state.type===C.Type.Initializing){for(let e of this._state.pendingMessages)e.resolve(!1);this._state.pendingMessages=[]}this._onDidDispose.fire(),this._resourceLoadingCts.dispose(!0),super.dispose()}setContextKeyService(e){this._contextKeyService=e}postMessage(e,t){return this._send("message",{message:e,transfer:t})}async _send(e,t,i=[]){if(this._state.type!==C.Type.Initializing)return this.doPostMessage(e,t,i);{let{promise:o,resolve:r}=(0,e8.promiseWithResolvers)();return this._state.pendingMessages.push({channel:e,data:t,transferable:i,resolve:r}),o}}_createElement(e,t){let i=(0,ed.createElement)("iframe");i.name=this.id,i.className=`webview ${e.customClasses||""}`,i.sandbox.add("allow-scripts","allow-same-origin","allow-forms","allow-pointer-lock","allow-downloads");let o=["cross-origin-isolated","autoplay","local-network-access"];return e4.isFirefox||o.push("clipboard-read","clipboard-write"),i.setAttribute("allow",o.join("; ")),i.style.border="none",i.style.width="100%",i.style.height="100%",i.focus=()=>{this._doFocus()},i}_initElement(e,t,i,o){let r={id:this.id,parentId:o.vscodeWindowId.toString(),origin:this.origin,swVersion:String(this._expectedServiceWorkerVersion),extensionId:t?.id.value??"",platform:this.platform,"vscode-resource-base-authority":th.webviewRootResourceAuthority,parentOrigin:o.origin};this._options.disableServiceWorker&&(r.disableServiceWorker="true"),this._environmentService.remoteAuthority&&(r.remoteAuthority=this._environmentService.remoteAuthority),i.purpose&&(r.purpose=i.purpose),r.serviceWorkerUri=R.FileAccess.asBrowserUri("vs/workbench/contrib/webview/browser/pre/service-worker.js").toString(!0),r.fakeHtmlUri=R.FileAccess.asBrowserUri("vs/workbench/contrib/webview/browser/pre/fake.html").toString(!0),R.COI.addSearchParam(r,!0,!0);let s=new URLSearchParams(r).toString();this.perfMark("init/set-src");let n=R.FileAccess.asBrowserUri("vs/workbench/contrib/webview/browser/pre/index.html");this.element.setAttribute("src",`${n.toString(!0)}?${s}`)}mountTo(e,t){if(this.element){for(let i of(this._windowId=t.vscodeWindowId,this._encodedWebviewOriginPromise=(0,e9.parentOriginHash)(t.origin,this.origin).then(e=>this._encodedWebviewOrigin=e),this._encodedWebviewOriginPromise.then(e=>{this._disposed||this._initElement(e,this.extension,this._options,t)}),this._registerMessageHandler(t),this._webviewFindWidget&&e.appendChild(this._webviewFindWidget.getDomNode()),[ed.EventType.MOUSE_DOWN,ed.EventType.MOUSE_MOVE,ed.EventType.DROP]))this._register((0,ed.addDisposableListener)(e,i,()=>{this._stopBlockingIframeDragEvents()}));for(let i of[e,t])this._register((0,ed.addDisposableListener)(i,ed.EventType.DRAG_END,()=>{this._stopBlockingIframeDragEvents()}));e.id=this.id,this.perfMark("mounted"),e.appendChild(this.element)}}_registerMessageHandler(e){let t=this._register((0,ed.addDisposableListener)(e,"message",e=>{this._encodedWebviewOrigin&&e?.data?.target===this.id&&"webview-ready"===e.data.channel&&(this._messagePort||(this.perfMark("webview-ready"),this._logService.trace(`Webview(${this.id}): webview ready`),this._messagePort=e.ports[0],this._messagePort.onmessage=e=>{let t=this._messageHandlers.get(e.data.channel);t?t?.forEach(t=>t(e.data.data,e)):console.log(`No handlers found for '${e.data.channel}'`)},this.element?.classList.add("ready"),this._state.type===C.Type.Initializing&&this._state.pendingMessages.forEach(({channel:e,data:t,resolve:i})=>i(this.doPostMessage(e,t))),this._state=C.Ready,t.dispose()))}))}perfMark(e){performance.mark(`webview/webviewElement/${e}`,{detail:{id:this.id}})}_startBlockingIframeDragEvents(){this.element&&(this.element.style.pointerEvents="none")}_stopBlockingIframeDragEvents(){this.element&&(this.element.style.pointerEvents="auto")}webviewContentEndpoint(e){let t=this._environmentService.webviewExternalEndpoint;if(!t)throw Error("'webviewExternalEndpoint' has not been configured. Webviews will not work!");let i=t.replace("{{uuid}}",e);return"/"===i[i.length-1]?i.slice(0,i.length-1):i}doPostMessage(e,t,i=[]){return!!this.element&&!!this._messagePort&&(this._messagePort.postMessage({channel:e,args:t},i),!0)}on(e,t){let i=this._messageHandlers.get(e);return i||(i=new Set,this._messageHandlers.set(e,i)),i.add(t),(0,tt.toDisposable)(()=>{this._messageHandlers.get(e)?.delete(t)})}handleNoCspFound(){!this._hasAlertedAboutMissingCsp&&(this._hasAlertedAboutMissingCsp=!0,this.extension?.id&&this._environmentService.isExtensionDevelopment&&this._onMissingCsp.fire(this.extension.id))}reload(){this.doUpdateContent(this._content)}reinitializeAfterDismount(){this._state=new C.Initializing([]),this._messagePort=void 0,this.mountTo(this.element.parentElement,(0,ed.getWindow)(this.element)),this.reload()}setHtml(e){this.doUpdateContent({...this._content,html:e}),this._onDidHtmlChange.fire(e)}setTitle(e){this._content={...this._content,title:e},this._send("set-title",e)}set contentOptions(e){(this._logService.debug(`Webview(${this.id}): will update content options`),(0,ty.areWebviewContentOptionsEqual)(e,this._content.options))?this._logService.debug(`Webview(${this.id}): skipping content options update`):this.doUpdateContent({...this._content,options:e})}set localResourcesRoot(e){this._content={...this._content,options:{...this._content.options,localResourceRoots:e}}}set state(e){this._content={...this._content,state:e}}set initialScrollProgress(e){this._send("initial-scroll-position",e)}doUpdateContent(e){this._logService.debug(`Webview(${this.id}): will update content`),this._content=e;let t=!!this._content.options.allowScripts;this.perfMark("set-content"),this._send("content",{contents:this._content.html,title:this._content.title,options:{allowMultipleAPIAcquire:!!this._content.options.allowMultipleAPIAcquire,allowScripts:t,allowForms:this._content.options.allowForms??t},state:this._content.state,cspSource:th.webviewGenericCspSource,confirmBeforeClose:this._confirmBeforeClose})}style(){let{styles:e,activeTheme:t,themeLabel:i,themeId:o}=this.webviewThemeDataProvider.getWebviewThemeData();this._options.transformCssVariables&&(e=this._options.transformCssVariables(e));let r=this._accessibilityService.isMotionReduced(),s=this._accessibilityService.isScreenReaderOptimized();this._send("styles",{styles:e,activeTheme:t,themeId:o,themeLabel:i,reduceMotion:r,screenReader:s})}handleFocusChange(e){this._focused=e,e?this._onDidFocus.fire():this._onDidBlur.fire()}handleKeyEvent(e,t){let i=new KeyboardEvent(e,t);Object.defineProperty(i,"target",{get:()=>this.element}),this.window?.dispatchEvent(i)}handleDragEvent(e,t){let i=new DragEvent(e,t);Object.defineProperty(i,"target",{get:()=>this.element}),this.window?.dispatchEvent(i)}windowDidDragStart(){this._startBlockingIframeDragEvents()}windowDidDragEnd(){this._stopBlockingIframeDragEvents()}selectAll(){this.execCommand("selectAll")}copy(){this.execCommand("copy")}paste(){this.execCommand("paste")}cut(){this.execCommand("cut")}undo(){this.execCommand("undo")}redo(){this.execCommand("redo")}execCommand(e){this.element&&this._send("execCommand",e)}async loadResource(e,t,i){try{let o=await tv(t,{ifNoneMatch:i,roots:this._content.options.localResourceRoots||[]},this._fileService,this._logService,this._resourceLoadingCts.token);switch(o.type){case y.Type.Success:{let i=await this.streamToBuffer(o.stream);return this._send("did-load-resource",{id:e,status:200,path:t.path,mime:o.mimeType,data:i,etag:o.etag,mtime:o.mtime},[i])}case y.Type.NotModified:return this._send("did-load-resource",{id:e,status:304,path:t.path,mime:o.mimeType,mtime:o.mtime});case y.Type.AccessDenied:return this._send("did-load-resource",{id:e,status:401,path:t.path})}}catch{}return this._send("did-load-resource",{id:e,status:404,path:t.path})}async streamToBuffer(e){return(await (0,e7.streamToBuffer)(e)).buffer.buffer}async localLocalhost(e,t){let i=this._environmentService.remoteAuthority,o=i?await this._remoteAuthorityResolverService.resolveAuthority(i):void 0,r=o?await this._portMappingManager.getRedirect(o.authority,t):void 0;return this._send("did-load-localhost",{id:e,origin:t,location:r})}focus(){this._doFocus(),this.handleFocusChange(!0)}_doFocus(){if(this.element){try{this.element.contentWindow?.focus()}catch{}this._focusDelayer.trigger(async()=>{if(this.isFocused&&this.element){if(this.window){let e=(0,ed.getActiveElement)(this.window?.document);if(e&&e!==this.element&&e?.tagName!=="BODY")return}this.window?.document.body?.focus(),this._send("focus",void 0)}})}}find(e,t){this.element&&this._send("find",{value:e,previous:t})}updateFind(e){e&&this.element&&this._send("find",{value:e})}stopFind(e){this.element&&(this._send("find-stop",{clearSelection:!e}),this._onDidStopFind.fire())}showFind(e=!0){this._webviewFindWidget?.reveal(void 0,e)}hideFind(e=!0){this._webviewFindWidget?.hide(e)}runFindAction(e){this._webviewFindWidget?.find(e)}};tW=(0,w.__decorate)([(0,w.__param)(2,D.IConfigurationService),(0,w.__param)(3,ts.IContextMenuService),(0,w.__param)(4,V.INotificationService),(0,w.__param)(5,tc.IWorkbenchEnvironmentService),(0,w.__param)(6,et.IFileService),(0,w.__param)(7,W.ILogService),(0,w.__param)(8,tn.IRemoteAuthorityResolverService),(0,w.__param)(9,ta.ITunnelService),(0,w.__param)(10,M.IInstantiationService),(0,w.__param)(11,to.IAccessibilityService)],tW);var tz=e.i(452088),tB=_,tU=e.i(913726),tH=e.i(896344);let t$=class extends tB.Disposable{get window(){return(0,ed.getWindowById)(this._windowId,!0).window}constructor(e,t,i,o){super(),this._layoutService=t,this._webviewService=i,this._baseContextKeyService=o,this._isFirstLoad=!0,this._firstLoadPendingMessages=new Set,this._webview=this._register(new tB.MutableDisposable),this._webviewEvents=this._register(new tB.DisposableStore),this._html="",this._initialScrollProgress=0,this._state=void 0,this._owner=void 0,this._windowId=void 0,this._scopedContextKeyService=this._register(new tB.MutableDisposable),this._shouldShowFindWidgetOnRestore=!1,this._isDisposed=!1,this._onDidDispose=this._register(new U.Emitter),this.onDidDispose=this._onDidDispose.event,this._onDidFocus=this._register(new U.Emitter),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new U.Emitter),this.onDidBlur=this._onDidBlur.event,this._onDidClickLink=this._register(new U.Emitter),this.onDidClickLink=this._onDidClickLink.event,this._onDidScroll=this._register(new U.Emitter),this.onDidScroll=this._onDidScroll.event,this._onDidUpdateState=this._register(new U.Emitter),this.onDidUpdateState=this._onDidUpdateState.event,this._onMessage=this._register(new U.Emitter),this.onMessage=this._onMessage.event,this._onMissingCsp=this._register(new U.Emitter),this.onMissingCsp=this._onMissingCsp.event,this._onDidWheel=this._register(new U.Emitter),this.onDidWheel=this._onDidWheel.event,this._onFatalError=this._register(new U.Emitter),this.onFatalError=this._onFatalError.event,this.intrinsicContentSize=(0,tF.observableValue)("WebviewIntrinsicContentSize",void 0),this.providedViewType=e.providedViewType,this.origin=e.origin??(0,ti.generateUuid)(),this._title=e.title,this._extension=e.extension,this._options=e.options,this._contentOptions=e.contentOptions}get isFocused(){return!!this._webview.value?.isFocused}dispose(){for(let e of(this._isDisposed=!0,this._container?.domNode.remove(),this._container=void 0,this._firstLoadPendingMessages))e.resolve(!1);this._firstLoadPendingMessages.clear(),this._onDidDispose.fire(),super.dispose()}get container(){if(this._isDisposed)throw Error("OverlayWebview has been disposed");if(!this._container){let e=(0,ed.createElement)("div");e.style.position="absolute",e.style.overflow="hidden",this._container=new tz.FastDomNode(e),this._container.setVisibility("hidden"),this._layoutService.getContainer(this.window).appendChild(e)}return this._container.domNode}claim(e,t,i){if(this._isDisposed)return;let o=this._owner;if(this._windowId!==t.vscodeWindowId&&(this.release(o),this._webview.clear(),this._webviewEvents.clear(),this._container?.domNode.remove(),this._container=void 0),this._owner=e,this._windowId=t.vscodeWindowId,this._show(t),o!==e){let e=i||this._baseContextKeyService;this._scopedContextKeyService.clear(),this._scopedContextKeyService.value=e.createScoped(this.container);let t=this._findWidgetVisible?.get();this._findWidgetVisible?.reset(),this._findWidgetVisible=ty.KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE.bindTo(e),this._findWidgetVisible.set(!!t),this._findWidgetEnabled?.reset(),this._findWidgetEnabled=ty.KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED.bindTo(e),this._findWidgetEnabled.set(!!this.options.enableFindWidget),this._webview.value?.setContextKeyService(this._scopedContextKeyService.value)}}release(e){this._owner===e&&(this._scopedContextKeyService.clear(),this._owner=void 0,this._container&&this._container.setVisibility("hidden"),this._options.retainContextWhenHidden?(this._shouldShowFindWidgetOnRestore=!!this._findWidgetVisible?.get(),this.hideFind(!1)):(this._webview.clear(),this._webviewEvents.clear()))}layoutWebviewOverElement(e,t,i){if(!this._container||!this._container.domNode.parentElement)return;let o=this._layoutService.whenContainerStylesLoaded(this.window);o?o.then(()=>this.doLayoutWebviewOverElement(e,t,i)):this.doLayoutWebviewOverElement(e,t,i)}doLayoutWebviewOverElement(e,t,i){if(!this._container||!this._container.domNode.parentElement)return;let o=e.getBoundingClientRect(),r=this._container.domNode.parentElement.getBoundingClientRect(),s=(r.height-this._container.domNode.parentElement.clientHeight)/2,n=(r.width-this._container.domNode.parentElement.clientWidth)/2;if(this._container.setTop(o.top-r.top-s),this._container.setLeft(o.left-r.left-n),this._container.setWidth(t?t.width:o.width),this._container.setHeight(t?t.height:o.height),i){var a;let e,t,{top:r,left:s,right:n,bottom:d}=(a=o,t=Math.max((e=i.getBoundingClientRect()).top-a.top,0),{top:t,right:Math.max(a.width-(a.right-e.right),0),bottom:Math.max(a.height-(a.bottom-e.bottom),0),left:Math.max(e.left-a.left,0)});this._container.domNode.style.clipPath=`polygon(${s}px ${r}px, ${n}px ${r}px, ${n}px ${d}px, ${s}px ${d}px)`}}_show(e){if(this._isDisposed)throw Error("OverlayWebview is disposed");if(!this._webview.value){let t=this._webviewService.createWebviewElement({providedViewType:this.providedViewType,origin:this.origin,title:this._title,options:this._options,contentOptions:this._contentOptions,extension:this.extension});this._webview.value=t,t.state=this._state,this._scopedContextKeyService.value&&this._webview.value.setContextKeyService(this._scopedContextKeyService.value),this._html&&t.setHtml(this._html),this._options.tryRestoreScrollPosition&&(t.initialScrollProgress=this._initialScrollProgress),this._findWidgetEnabled?.set(!!this.options.enableFindWidget),t.mountTo(this.container,e),this._webviewEvents.clear(),this._webviewEvents.add(t.onDidFocus(()=>{this._onDidFocus.fire()})),this._webviewEvents.add(t.onDidBlur(()=>{this._onDidBlur.fire()})),this._webviewEvents.add(t.onDidClickLink(e=>{this._onDidClickLink.fire(e)})),this._webviewEvents.add(t.onMessage(e=>{this._onMessage.fire(e)})),this._webviewEvents.add(t.onMissingCsp(e=>{this._onMissingCsp.fire(e)})),this._webviewEvents.add(t.onDidWheel(e=>{this._onDidWheel.fire(e)})),this._webviewEvents.add(t.onFatalError(e=>{this._onFatalError.fire(e)})),this._webviewEvents.add((0,tH.autorun)(e=>{this.intrinsicContentSize.set(e.readObservable(t.intrinsicContentSize),void 0,void 0)})),this._webviewEvents.add(t.onDidScroll(e=>{this._initialScrollProgress=e.scrollYPercentage,this._onDidScroll.fire(e)})),this._webviewEvents.add(t.onDidUpdateState(e=>{this._state=e,this._onDidUpdateState.fire(e)})),this._isFirstLoad&&this._firstLoadPendingMessages.forEach(async e=>{e.resolve(await t.postMessage(e.message,e.transfer))}),this._isFirstLoad=!1,this._firstLoadPendingMessages.clear()}this.options.retainContextWhenHidden&&this._shouldShowFindWidgetOnRestore&&(this.showFind(!1),this._shouldShowFindWidgetOnRestore=!1),this._container?.setVisibility("visible")}setHtml(e){this._html=e,this._withWebview(t=>t.setHtml(e))}setTitle(e){this._title=e,this._withWebview(t=>t.setTitle(e))}get initialScrollProgress(){return this._initialScrollProgress}set initialScrollProgress(e){this._initialScrollProgress=e,this._withWebview(t=>t.initialScrollProgress=e)}get state(){return this._state}set state(e){this._state=e,this._withWebview(t=>t.state=e)}get extension(){return this._extension}set extension(e){this._extension=e,this._withWebview(t=>t.extension=e)}get options(){return this._options}set options(e){this._options={customClasses:this._options.customClasses,...e}}get contentOptions(){return this._contentOptions}set contentOptions(e){this._contentOptions=e,this._withWebview(t=>t.contentOptions=e)}set localResourcesRoot(e){this._withWebview(t=>t.localResourcesRoot=e)}async postMessage(e,t){if(this._webview.value)return this._webview.value.postMessage(e,t);if(this._isFirstLoad){let i,o=new Promise(e=>i=e);return this._firstLoadPendingMessages.add({message:e,transfer:t,resolve:i}),o}return!1}focus(){this._webview.value?.focus()}reload(){this._webview.value?.reload()}selectAll(){this._webview.value?.selectAll()}copy(){this._webview.value?.copy()}paste(){this._webview.value?.paste()}cut(){this._webview.value?.cut()}undo(){this._webview.value?.undo()}redo(){this._webview.value?.redo()}showFind(e=!0){this._webview.value&&(this._webview.value.showFind(e),this._findWidgetVisible?.set(!0))}hideFind(e=!0){this._findWidgetVisible?.reset(),this._webview.value?.hideFind(e)}runFindAction(e){this._webview.value?.runFindAction(e)}_withWebview(e){this._webview.value&&e(this._webview.value)}windowDidDragStart(){this._webview.value?.windowDidDragStart()}windowDidDragEnd(){this._webview.value?.windowDidDragEnd()}setContextKeyService(e){this._webview.value?.setContextKeyService(e)}};t$=(0,w.__decorate)([(0,w.__param)(1,es.IWorkbenchLayoutService),(0,w.__param)(2,tU.IWebviewService),(0,w.__param)(3,ea.IContextKeyService)],t$);let tq=class extends eJ.Disposable{constructor(e){super(),this._instantiationService=e,this._webviews=new Set,this._onDidChangeActiveWebview=this._register(new U.Emitter),this.onDidChangeActiveWebview=this._onDidChangeActiveWebview.event,this._webviewThemeDataProvider=this._instantiationService.createInstance(e6)}get activeWebview(){return this._activeWebview}_updateActiveWebview(e){e!==this._activeWebview&&(this._activeWebview=e,this._onDidChangeActiveWebview.fire(e))}get webviews(){return this._webviews.values()}createWebviewElement(e){let t=this._instantiationService.createInstance(tW,e,this._webviewThemeDataProvider);return this.registerNewWebview(t),t}createWebviewOverlay(e){let t=this._instantiationService.createInstance(t$,e);return this.registerNewWebview(t),t}registerNewWebview(e){this._webviews.add(e);let t=new eJ.DisposableStore;t.add(e.onDidFocus(()=>{this._updateActiveWebview(e)}));let i=()=>{this._activeWebview===e&&this._updateActiveWebview(void 0)};t.add(e.onDidBlur(i)),t.add(e.onDidDispose(()=>{i(),t.dispose(),this._webviews.delete(e)}))}};tq=(0,w.__decorate)([(0,w.__param)(0,M.IInstantiationService)],tq),e.s(["WebviewService",0,tq],737450);var tY=_;class tj extends tY.Disposable{constructor(){super(...arguments),this._resolvers=new Map,this._awaitingRevival=new Map,this._onNewResolverRegistered=this._register(new U.Emitter),this.onNewResolverRegistered=this._onNewResolverRegistered.event}register(e,t){if(this._resolvers.has(e))throw Error(`View resolver already registered for ${e}`);this._resolvers.set(e,t),this._onNewResolverRegistered.fire({viewType:e});let i=this._awaitingRevival.get(e);return i&&t.resolve(i.webview,te.CancellationToken.None).then(()=>{this._awaitingRevival.delete(e),i.resolve()}),(0,tY.toDisposable)(()=>{this._resolvers.delete(e)})}resolve(e,t,i){let o=this._resolvers.get(e);if(!o){if(this._awaitingRevival.has(e))throw Error("View already awaiting revival");let{promise:i,resolve:o}=(0,e8.promiseWithResolvers)();return this._awaitingRevival.set(e,{webview:t,resolve:o}),i}return o.resolve(t,i)}}e.s(["WebviewViewService",0,tj],83068);var tX=_,tJ=e.i(34487),tZ=e.i(658493),tQ=e.i(85282),t0=e.i(497795),t1=e.i(258861),t2=e.i(701898),t3=e.i(947278),t5=e.i(842577),t6=e.i(32637),t4=e.i(984004),t9=e.i(459179),t8=e.i(795391),t7=e.i(155652),ie=e.i(536367),it=e.i(82648),ii=_,io=e.i(354244),ir=e.i(383378);(0,eE.registerCss)(void 0),(c=b||(b={}))[c.Horizontal=0]="Horizontal",c[c.Vertical=1]="Vertical";class is extends ii.Disposable{constructor(e,t,i,o){if(super(),this.container=e,this.message=t,this.options=o,this.modalElement=this.container.appendChild((0,ed.$)(".monaco-dialog-modal-block.dimmed")),this._register((0,ed.addStandardDisposableListener)(this.modalElement,ed.EventType.CLICK,e=>{e.target===this.modalElement&&this.element.focus()})),this.shadowElement=this.modalElement.appendChild((0,ed.$)(".dialog-shadow")),this.element=this.shadowElement.appendChild((0,ed.$)(".monaco-dialog-box")),o.alignment===b.Vertical&&this.element.classList.add("align-vertical"),o.extraClasses&&this.element.classList.add(...o.extraClasses),this.element.setAttribute("role","dialog"),this.element.tabIndex=-1,(0,ed.hide)(this.element),this.options.renderFooter){this.footerContainer=this.element.appendChild((0,ed.$)(".dialog-footer-row"));const e=this.footerContainer.appendChild((0,ed.$)("#monaco-dialog-footer.dialog-footer"));for(const t of(this.options.renderFooter(e),this.footerContainer.querySelectorAll("a")))t.tabIndex=0}this.buttonStyles=o.buttonStyles,Array.isArray(i)&&i.length>0?this.buttons=i:this.options.disableDefaultAction?this.buttons=[]:this.buttons=[(0,O.localize)(3,"OK")];const r=this.element.appendChild((0,ed.$)(".dialog-buttons-row"));this.buttonsContainer=r.appendChild((0,ed.$)(".dialog-buttons"));const s=this.element.appendChild((0,ed.$)(".dialog-message-row"));if(this.iconElement=s.appendChild((0,ed.$)("#monaco-dialog-icon.dialog-icon")),this.iconElement.setAttribute("aria-label",this.getIconAriaLabel()),this.messageContainer=s.appendChild((0,ed.$)(".dialog-message-container")),(this.options.detail||this.options.renderBody)&&(this.messageContainer.appendChild((0,ed.$)(".dialog-message")).appendChild((0,ed.$)("#monaco-dialog-message-text.dialog-message-text")).innerText=this.message),this.messageDetailElement=this.messageContainer.appendChild((0,ed.$)("#monaco-dialog-message-detail.dialog-message-detail")),this.options.detail||!this.options.renderBody?this.messageDetailElement.innerText=this.options.detail?this.options.detail:t:this.messageDetailElement.style.display="none",this.options.renderBody){const e=this.messageContainer.appendChild((0,ed.$)("#monaco-dialog-message-body.dialog-message-body"));for(const t of(this.options.renderBody(e),this.messageContainer.querySelectorAll("a")))t.tabIndex=0}if(this.options.inputs?this.inputs=this.options.inputs.map(e=>{let t=this.messageContainer.appendChild((0,ed.$)(".dialog-message-input")),i=this._register(new t8.InputBox(t,void 0,{placeholder:e.placeholder,type:e.type??"text",inputBoxStyles:o.inputBoxStyles}));return e.value&&(i.value=e.value),i}):this.inputs=[],this.options.checkboxLabel){const e=this.messageContainer.appendChild((0,ed.$)(".dialog-checkbox-row")),t=this.checkbox=this._register(new t9.Checkbox(this.options.checkboxLabel,!!this.options.checkboxChecked,o.checkboxStyles));e.appendChild(t.domNode);const i=e.appendChild((0,ed.$)(".dialog-checkbox-message"));i.innerText=this.options.checkboxLabel,this._register((0,ed.addDisposableListener)(i,ed.EventType.CLICK,()=>t.checked=!t.checked))}const n=this.element.appendChild((0,ed.$)(".dialog-toolbar-row"));this.toolbarContainer=n.appendChild((0,ed.$)(".dialog-toolbar")),this.applyStyles()}getIconAriaLabel(){let e=(0,O.localize)(4,"Info");switch(this.options.type){case"error":e=(0,O.localize)(5,"Error");break;case"warning":e=(0,O.localize)(6,"Warning");break;case"pending":e=(0,O.localize)(7,"In Progress")}return e}updateMessage(e){this.messageDetailElement.innerText=e}async show(){return this.focusToReturn=(0,ed.getActiveElement)(this.container.ownerDocument),new Promise(e=>{(0,ed.clearNode)(this.buttonsContainer);let t=()=>{e({button:this.options.cancelId||0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0})};this._register((0,ii.toDisposable)(t));let i=this.buttonBar=this._register(new t4.ButtonBar(this.buttonsContainer,{alignment:this.options?.alignment===b.Vertical?t4.ButtonBarAlignment.Vertical:t4.ButtonBarAlignment.Horizontal})),o=this.rearrangeButtons(this.buttons,this.options.cancelId),r=t=>{e({button:o[t].index,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(e=>e.value):void 0})};o.forEach((e,t)=>{let s,n=0===o[t].index,a=this.options.buttonOptions?.[o[t]?.index];if(n&&this.options?.primaryButtonDropdown){let e=(0,ir.isActionProvider)(this.options.primaryButtonDropdown.actions)?this.options.primaryButtonDropdown.actions.getActions():this.options.primaryButtonDropdown.actions;s=this._register(i.addButtonWithDropdown({...this.options.primaryButtonDropdown,...this.buttonStyles,dropdownLayer:2600,actions:e.map(e=>(0,t2.toAction)({...e,run:async()=>{await e.run(),r(t)}}))}))}else s=a?.sublabel?this._register(i.addButtonWithDescription({secondary:!n,...this.buttonStyles})):this._register(i.addButton({secondary:!n,...this.buttonStyles}));a?.styleButton&&a.styleButton(s),s.label=(0,it.mnemonicButtonLabel)(o[t].label,!0),s instanceof t4.ButtonWithDescription&&a?.sublabel&&(s.description=a?.sublabel),this._register(s.onDidClick(e=>{e&&ed.EventHelper.stop(e),r(t)}))});let s=(0,ed.getWindow)(this.container);this._register((0,ed.addDisposableListener)(s,"keydown",t=>{let i=new t5.StandardKeyboardEvent(t);if(i.equals(tf.KeyMod.Alt)&&i.preventDefault(),i.equals(tf.KeyCode.Enter)){this.inputs.some(e=>e.hasFocus())&&(ed.EventHelper.stop(t),e({button:o.find(e=>e.index!==this.options.cancelId)?.index??0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(e=>e.value):void 0}));return}if(io.isMacintosh&&i.equals(tf.KeyMod.CtrlCmd|tf.KeyCode.KeyD)){ed.EventHelper.stop(t);let i=o.find(e=>1===e.index&&e.index!==this.options.cancelId);i&&e({button:i.index,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(e=>e.value):void 0});return}if(i.equals(tf.KeyCode.Space))return;let r=!1;if(i.equals(tf.KeyCode.Tab)||i.equals(tf.KeyCode.RightArrow)||i.equals(tf.KeyMod.Shift|tf.KeyCode.Tab)||i.equals(tf.KeyCode.LeftArrow)){let e=[],t=-1;if(this.messageContainer)for(let i of this.messageContainer.querySelectorAll("a"))e.push(i),(0,ed.isActiveElement)(i)&&(t=e.length-1);for(let i of this.inputs)e.push(i),i.hasFocus()&&(t=e.length-1);if(this.checkbox&&(e.push(this.checkbox),this.checkbox.hasFocus()&&(t=e.length-1)),this.buttonBar)for(let i of this.buttonBar.buttons)i instanceof t4.ButtonWithDropdown?(e.push(i.primaryButton),i.primaryButton.hasFocus()&&(t=e.length-1),e.push(i.dropdownButton),i.dropdownButton.hasFocus()&&(t=e.length-1)):(e.push(i),i.hasFocus()&&(t=e.length-1));if(this.footerContainer)for(let i of this.footerContainer.querySelectorAll("a"))e.push(i),(0,ed.isActiveElement)(i)&&(t=e.length-1);if(i.equals(tf.KeyCode.Tab)||i.equals(tf.KeyCode.RightArrow)){let i=(t+1)%e.length;e[i].focus()}else{-1===t&&(t=e.length);let i=t-1;-1===i&&(i=e.length-1),e[i].focus()}r=!0}r?ed.EventHelper.stop(t,!0):this.options.keyEventProcessor&&this.options.keyEventProcessor(i)},!0)),this._register((0,ed.addDisposableListener)(s,"keyup",e=>{ed.EventHelper.stop(e,!0);let i=new t5.StandardKeyboardEvent(e);!this.options.disableCloseAction&&i.equals(tf.KeyCode.Escape)&&t()},!0)),this._register((0,ed.addDisposableListener)(this.element,"focusout",e=>{e.relatedTarget&&this.element&&!(0,ed.isAncestor)(e.relatedTarget,this.element)&&(this.focusToReturn=e.relatedTarget,e.target&&(e.target.focus(),ed.EventHelper.stop(e,!0)))},!1));let n="codicon-modifier-spin";if(this.iconElement.classList.remove(...ie.ThemeIcon.asClassNameArray(t7.Codicon.dialogError),...ie.ThemeIcon.asClassNameArray(t7.Codicon.dialogWarning),...ie.ThemeIcon.asClassNameArray(t7.Codicon.dialogInfo),...ie.ThemeIcon.asClassNameArray(t7.Codicon.loading),n),this.options.icon)this.iconElement.classList.add(...ie.ThemeIcon.asClassNameArray(this.options.icon));else switch(this.options.type){case"error":this.iconElement.classList.add(...ie.ThemeIcon.asClassNameArray(t7.Codicon.dialogError));break;case"warning":this.iconElement.classList.add(...ie.ThemeIcon.asClassNameArray(t7.Codicon.dialogWarning));break;case"pending":this.iconElement.classList.add(...ie.ThemeIcon.asClassNameArray(t7.Codicon.loading),n);break;case"none":this.iconElement.classList.add("no-codicon");break;default:this.iconElement.classList.add(...ie.ThemeIcon.asClassNameArray(t7.Codicon.dialogInfo))}if(!this.options.disableCloseAction&&!this.options.disableCloseButton){let t=this._register(new t6.ActionBar(this.toolbarContainer,{})),i=this._register(new t2.Action("dialog.close",(0,O.localize)(8,"Close Dialog"),ie.ThemeIcon.asClassName(t7.Codicon.dialogClose),!0,async()=>{e({button:this.options.cancelId||0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0})}));t.push(i,{icon:!0,label:!1})}this.applyStyles(),this.element.setAttribute("aria-modal","true"),this.element.setAttribute("aria-labelledby","monaco-dialog-icon monaco-dialog-message-text"),this.element.setAttribute("aria-describedby","monaco-dialog-icon monaco-dialog-message-text monaco-dialog-message-detail monaco-dialog-message-body monaco-dialog-footer"),(0,ed.show)(this.element),this.inputs.length>0?(this.inputs[0].focus(),this.inputs[0].select()):o.forEach((e,t)=>{0===e.index&&i.buttons[t].focus()})})}applyStyles(){let e,t=this.options.dialogStyles,i=t.dialogForeground,o=t.dialogBackground,r=t.dialogShadow?`0 0px 8px ${t.dialogShadow}`:"",s=t.dialogBorder?`1px solid ${t.dialogBorder}`:"",n=t.textLinkForeground;if(this.shadowElement.style.boxShadow=r,this.element.style.color=i??"",this.element.style.backgroundColor=o??"",this.element.style.border=s,n)for(let e of[...this.messageContainer.getElementsByTagName("a"),...this.footerContainer?.getElementsByTagName("a")??[]])e.style.color=n;switch(this.options.type){case"none":break;case"error":e=t.errorIconForeground;break;case"warning":e=t.warningIconForeground;break;default:e=t.infoIconForeground}e&&(this.iconElement.style.color=e)}dispose(){super.dispose(),this.modalElement&&(this.modalElement.remove(),this.modalElement=void 0),this.focusToReturn&&(0,ed.isAncestor)(this.focusToReturn,this.container.getRootNode())&&(this.focusToReturn.focus(),this.focusToReturn=void 0)}rearrangeButtons(e,t){let i=e.map((e,t)=>({label:e,index:t}));if(e.length<2||this.options.alignment===b.Vertical)return i;if(io.isMacintosh||io.isLinux){if("number"==typeof t&&i[t]){let e=i.splice(t,1)[0];i.splice(1,0,e)}i.reverse()}else if(io.isWindows&&"number"==typeof t&&i[t]){let e=i.splice(t,1)[0];i.push(e)}return i}}var ia=e.i(643936),id=e.i(305063),il=e.i(447186),ic=e.i(99419),ih=e.i(34422),iu=e.i(896783),ip=e.i(404214);e.i(643116);var ig=e.i(899890);let im=["workbench.action.quit","workbench.action.reloadWindow","copy","cut","editor.action.selectAll","editor.action.clipboardCopyAction","editor.action.clipboardCutAction","editor.action.clipboardPasteAction"];(0,eE.registerCss)(void 0);let iv=class extends tX.Disposable{constructor(e,t,i,o,r,s,n,a,d){super(),this.activityService=e,this.paneCompositeService=t,this.viewDescriptorService=i,this.viewsService=o,this.notificationService=r,this.statusbarService=s,this.layoutService=n,this.keybindingService=a,this.userActivityService=d,this.windowProgressStack=[],this.windowProgressStatusEntry=void 0}async withProgress(e,t,i){let{location:o}=e,r=async e=>{let i=this.userActivityService.markActive({extendOnly:!0,whenHeldFor:15e3});try{return await t(e)}finally{i.dispose()}},s=t=>{let i=this.viewDescriptorService.getViewContainerById(t);if(i){let o=this.viewDescriptorService.getViewContainerLocation(i);if(null!==o)return this.withPaneCompositeProgress(t,o,r,{...e,location:t})}if(null!==this.viewDescriptorService.getViewDescriptorById(t))return this.withViewProgress(t,r,{...e,location:t});throw Error(`Bad progress location: ${t}`)};if("string"==typeof o)return s(o);switch(o){case tJ.ProgressLocation.Notification:{let t=e.priority;return t!==P.NotificationPriority.URGENT&&(this.notificationService.getFilter()===P.NotificationsFilter.ERROR?t=P.NotificationPriority.SILENT:(0,P.isNotificationSource)(e.source)&&this.notificationService.getFilter(e.source)===P.NotificationsFilter.ERROR&&(t=P.NotificationPriority.SILENT)),this.withNotificationProgress({...e,location:o,priority:t},r,i)}case tJ.ProgressLocation.Window:{let t=e.type;if(e.command)return this.withWindowProgress({...e,location:o,type:t},r);return this.withNotificationProgress({delay:150,...e,priority:P.NotificationPriority.SILENT,location:tJ.ProgressLocation.Notification,type:t},r,i)}case tJ.ProgressLocation.Explorer:return this.withPaneCompositeProgress("workbench.view.explorer",id.ViewContainerLocation.Sidebar,r,{...e,location:o});case tJ.ProgressLocation.Scm:return s("workbench.scm");case tJ.ProgressLocation.Extensions:return this.withPaneCompositeProgress("workbench.view.extensions",id.ViewContainerLocation.Sidebar,r,{...e,location:o});case tJ.ProgressLocation.Dialog:return this.withDialogProgress(e,r,i);default:throw Error(`Bad progress location: ${o}`)}}withWindowProgress(e,t){let i=[e,new tJ.Progress(()=>this.updateWindowProgress())],o=t(i[1]),r=setTimeout(()=>{r=void 0,this.windowProgressStack.unshift(i),this.updateWindowProgress(),Promise.all([(0,e8.timeout)(150),o]).finally(()=>{let e=this.windowProgressStack.indexOf(i);this.windowProgressStack.splice(e,1),this.updateWindowProgress()})},150);return o.finally(()=>clearTimeout(r))}updateWindowProgress(e=0){if(e<this.windowProgressStack.length){let t,i,[o,r]=this.windowProgressStack[e],s=o.title,n=r.value?.message,a=o.command,d=o.source&&"string"!=typeof o.source?o.source.label:o.source;if(s&&n)t=(0,O.localize)(14238,"{0}: {1}",s,n),i=d?(0,O.localize)(14239,"[{0}] {1}: {2}",d,s,n):t;else if(s)t=s,i=d?(0,O.localize)(14240,"[{0}]: {1}",d,s):t;else{if(!n)return void this.updateWindowProgress(e+1);t=n,i=d?(0,O.localize)(14240,"[{0}]: {1}",d,n):t}let l={name:(0,O.localize)(14241,"Progress Message"),text:t,showProgress:o.type||!0,ariaLabel:t,tooltip:(0,iu.stripIcons)(i).trim(),command:a};this.windowProgressStatusEntry?this.windowProgressStatusEntry.update(l):this.windowProgressStatusEntry=this.statusbarService.addEntry(l,"status.progress",tZ.StatusbarAlignment.LEFT,-Number.MAX_VALUE)}else this.windowProgressStatusEntry?.dispose(),this.windowProgressStatusEntry=void 0}withNotificationProgress(e,t,i){let o,r,s,n=new class extends tX.Disposable{get step(){return this._step}get done(){return this._done}constructor(){super(),this._onDidReport=this._register(new U.Emitter),this.onDidReport=this._onDidReport.event,this._onWillDispose=this._register(new U.Emitter),this.onWillDispose=this._onWillDispose.event,this._step=void 0,this._done=!1,this.promise=t(this),this.promise.finally(()=>{this.dispose()})}report(e){this._step=e,this._onDidReport.fire(e)}cancel(e){i?.(e),this.dispose()}dispose(){this._done=!0,this._onWillDispose.fire(),super.dispose()}},a=()=>{let t=new e8.DeferredPromise;return this.withWindowProgress({location:tJ.ProgressLocation.Window,title:e.title?(0,ia.parseLinkedText)(e.title).toString():void 0,command:"notifications.showList",type:e.type},e=>{function i(t){t.message&&e.report({message:(0,ia.parseLinkedText)(t.message).toString()})}n.step&&i(n.step);let o=n.onDidReport(e=>i(e));return t.p.finally(()=>o.dispose()),U.Event.once(n.onWillDispose)(()=>t.complete()),t.p}),(0,tX.toDisposable)(()=>t.complete())},d=(t,i,o)=>{let r,s=new tX.DisposableStore,d=e.primaryActions?Array.from(e.primaryActions):[],l=e.secondaryActions?Array.from(e.secondaryActions):[];if(e.buttons&&e.buttons.forEach((e,t)=>{let i=new class extends t2.Action{constructor(){super(`progress.button.${e}`,e,void 0,!0)}async run(){n.cancel(t)}};s.add(i),d.push(i)}),e.cancellable){let t=new class extends t2.Action{constructor(){super("progress.cancel","string"==typeof e.cancellable?e.cancellable:(0,O.localize)(14242,"Cancel"),void 0,!0)}async run(){n.cancel()}};s.add(t),d.push(t)}let c=this.notificationService.notify({severity:H.default.Info,message:(0,iu.stripIcons)(t),source:e.source,actions:{primary:d,secondary:l},progress:"number"==typeof o&&o>=0?{total:100,worked:o}:{infinite:!0},priority:i}),h=e=>{(0,tX.dispose)(r),e||n.done||(r=a())};return s.add(c.onDidChangeVisibility(h)),i===P.NotificationPriority.SILENT&&h(!1),U.Event.once(c.onDidClose)(()=>{s.dispose(),(0,tX.dispose)(r)}),c},l=t=>{if(s=t?.message&&e.title?`${e.title}: ${t.message}`:e.title||t?.message,!o&&s&&("number"==typeof e.delay&&e.delay>0?void 0===r&&(r=setTimeout(()=>o=d(s,e.priority,t?.increment),e.delay)):o=d(s,e.priority,t?.increment)),o){var i,n;s&&o.updateMessage(s),"number"==typeof t?.increment&&(i=o,"number"==typeof(n=t.increment)&&n>=0?(i.progress.total(100),i.progress.worked(n)):i.progress.infinite())}};l(n.step);let c=n.onDidReport(e=>l(e));return U.Event.once(n.onWillDispose)(()=>c.dispose()),(async()=>{try{"number"==typeof e.delay&&e.delay>0?await n.promise:await Promise.all([(0,e8.timeout)(800),n.promise])}finally{clearTimeout(r),o?.close()}})(),n.promise}withPaneCompositeProgress(e,t,i,o){let r=this.paneCompositeService.getProgressIndicator(e,t),s=r?this.withCompositeProgress(r,i,o):i({report:()=>{}});return t===id.ViewContainerLocation.Sidebar&&this.showOnActivityBar(e,o,s),s}withViewProgress(e,t,i){let o=this.viewsService.getViewProgressIndicator(e),r=o?this.withCompositeProgress(o,t,i):t({report:()=>{}}),s=this.viewDescriptorService.getViewContainerByViewId(e)?.id;return void 0===s||this.showOnActivityBar(s,i,r),r}showOnActivityBar(e,t,i){let o,r=setTimeout(()=>{r=void 0;let t=this.activityService.showViewContainerActivity(e,{badge:new t0.ProgressBadge(()=>"")}),i=Date.now();o={dispose(){let e=Date.now()-i;e<300?setTimeout(()=>t.dispose(),300-e):t.dispose()}}},t.delay||300);i.finally(()=>{clearTimeout(r),(0,tX.dispose)(o)})}withCompositeProgress(e,t,i){let o;function r(t){let r,n;return void 0!==t&&("number"==typeof t?r=t:"number"==typeof t.increment&&(r=t.total??100,n=t.increment)),"number"==typeof r?(o||(o=e.show(r,i.delay),s.catch(()=>void 0).finally(()=>o?.done())),"number"==typeof n&&o.worked(n)):(o?.done(),e.showWhile(s,i.delay)),o}let s=t({report:e=>{r(e)}});return r(i.total),s}withDialogProgress(e,t,i){let o,r,s=new tX.DisposableStore,n=!1,a=t=>{let r=e.buttons||[];return e.sticky||r.push(e.cancellable?"boolean"==typeof e.cancellable?(0,O.localize)(14242,"Cancel"):e.cancellable:(0,O.localize)(14243,"Dismiss")),o=new is(this.layoutService.activeContainer,t,r,function(e,t,i,o=im){return{keyEventProcessor:e=>{let r=t.softDispatch(e,i.activeContainer);r.kind===ig.ResultKind.KbFound&&r.commandId&&!o.includes(r.commandId)&&ed.EventHelper.stop(e,!0)},buttonStyles:tR.defaultButtonStyles,checkboxStyles:tR.defaultCheckboxStyles,inputBoxStyles:tR.defaultInputBoxStyles,dialogStyles:tR.defaultDialogStyles,...e}}({type:"pending",detail:e.detail,cancelId:r.length-1,disableCloseAction:e.sticky,disableDefaultAction:e.sticky},this.keybindingService,this.layoutService)),s.add(o),o.show().then(e=>{n||i?.(e.button),(0,tX.dispose)(o)}),o},d=e.delay??0,l=s.add(new e8.RunOnceScheduler(()=>{d=0,r&&!o?o=a(r):r&&o.updateMessage(r)},0)),c=function(e){r=e,l.isScheduled()||l.schedule(d)},h=t({report:e=>{c(e.message)}});return h.finally(()=>{n=!0,(0,tX.dispose)(s)}),e.title&&c(e.title),h}};iv=(0,w.__decorate)([(0,w.__param)(0,t1.IActivityService),(0,w.__param)(1,ih.IPaneCompositePartService),(0,w.__param)(2,il.IViewDescriptorService),(0,w.__param)(3,ic.IViewsService),(0,w.__param)(4,V.INotificationService),(0,w.__param)(5,tQ.IStatusbarService),(0,w.__param)(6,t3.ILayoutService),(0,w.__param)(7,tb.IKeybindingService),(0,w.__param)(8,ip.IUserActivityService)],iv),e.s(["ProgressService",0,iv],333906);var iy=e.i(244416),iC=e.i(410676),ib=e.i(681874),iw=_;let iS=class extends iw.Disposable{constructor(e){super(),this.paneCompositeParts=new Map;const t=e.createInstance(iC.PanelPart),i=e.createInstance(ib.SidebarPart),o=e.createInstance(iy.AuxiliaryBarPart);this.paneCompositeParts.set(id.ViewContainerLocation.Panel,t),this.paneCompositeParts.set(id.ViewContainerLocation.Sidebar,i),this.paneCompositeParts.set(id.ViewContainerLocation.AuxiliaryBar,o);const r=this._register(new iw.DisposableStore);this.onDidPaneCompositeOpen=U.Event.any(...id.ViewContainerLocations.map(e=>U.Event.map(this.paneCompositeParts.get(e).onDidPaneCompositeOpen,t=>({composite:t,viewContainerLocation:e}),r))),this.onDidPaneCompositeClose=U.Event.any(...id.ViewContainerLocations.map(e=>U.Event.map(this.paneCompositeParts.get(e).onDidPaneCompositeClose,t=>({composite:t,viewContainerLocation:e}),r)))}openPaneComposite(e,t,i){return this.getPartByLocation(t).openPaneComposite(e,i)}getActivePaneComposite(e){return this.getPartByLocation(e).getActivePaneComposite()}getPaneComposite(e,t){return this.getPartByLocation(t).getPaneComposite(e)}getPaneComposites(e){return this.getPartByLocation(e).getPaneComposites()}getPinnedPaneCompositeIds(e){return this.getPartByLocation(e).getPinnedPaneCompositeIds()}getVisiblePaneCompositeIds(e){return this.getPartByLocation(e).getVisiblePaneCompositeIds()}getPaneCompositeIds(e){return this.getPartByLocation(e).getPaneCompositeIds()}getProgressIndicator(e,t){return this.getPartByLocation(t).getProgressIndicator(e)}hideActivePaneComposite(e){this.getPartByLocation(e).hideActivePaneComposite()}getLastActivePaneCompositeId(e){return this.getPartByLocation(e).getLastActivePaneCompositeId()}getPartByLocation(e){return(0,eD.assertReturnsDefined)(this.paneCompositeParts.get(e))}};iS=(0,w.__decorate)([(0,w.__param)(0,M.IInstantiationService)],iS),e.s(["PaneCompositePartService",0,iS],282347)},901769,313289,863637,873306,218532,817887,529027,6848,305273,982710,868328,731453,99935,739757,647427,514244,993056,101398,675700,e=>{"use strict";var t,i,o,r,s,n,a,d,l,c,h,u,p,g,m,v,y,C,b,w,f,S,_,E,I,D,T,A,x,R,k,M,L,O,P,V,K,N,G,F,W,z,B,U,H,$,q,Y,j,X,J,Z,Q,ee,et,ei=e.i(281482),eo=e.i(322193),er=e.i(850887),es=e.i(325438),en=e.i(865562),ea=e.i(454514),ed=e.i(590746),el=e.i(619122),ec=e.i(781808),eh=e.i(399119),eu=e.i(611130),ep=e.i(40577),eg=e.i(354244),em=e.i(770326),ev=e.i(650289),ey=e.i(731931),eC=e.i(919101),eb=e.i(324726);e.i(157255);var ew=e.i(536766),ef=e.i(670913),eS=e.i(377882),e_=e.i(772383),eE=e.i(74304),eI=e.i(957994),eD=e.i(488259);(t=g||(g={}))[t.Maximized=0]="Maximized",t[t.Normal=1]="Normal",t[t.Fullscreen=2]="Fullscreen";let eT=new er.Dimension(ef.DEFAULT_AUX_WINDOW_SIZE.width,ef.DEFAULT_AUX_WINDOW_SIZE.height),eA=class extends eS.BaseWindow{constructor(e,t,i,o,r,s,n,a){super(e,void 0,r,s,n,a),this.window=e,this.container=t,this.configurationService=o,this._onWillLayout=this._register(new ec.Emitter),this.onWillLayout=this._onWillLayout.event,this._onDidLayout=this._register(new ec.Emitter),this.onDidLayout=this._onDidLayout.event,this._onBeforeUnload=this._register(new ec.Emitter),this.onBeforeUnload=this._onBeforeUnload.event,this._onUnload=this._register(new ec.Emitter),this.onUnload=this._onUnload.event,this._onWillDispose=this._register(new ec.Emitter),this.onWillDispose=this._onWillDispose.event,this.compact=!1,this.whenStylesHaveLoaded=i.wait().then(()=>void 0),this.registerListeners()}updateOptions(e){this.compact=e.compact}registerListeners(){this._register((0,er.addDisposableListener)(this.window,er.EventType.BEFORE_UNLOAD,e=>this.handleBeforeUnload(e))),this._register((0,er.addDisposableListener)(this.window,er.EventType.UNLOAD,()=>this.handleUnload())),this._register((0,er.addDisposableListener)(this.window,"unhandledrejection",e=>{(0,el.onUnexpectedError)(e.reason),e.preventDefault()})),this._register((0,er.addDisposableListener)(this.window,er.EventType.RESIZE,()=>this.layout())),this._register((0,er.addDisposableListener)(this.container,er.EventType.SCROLL,()=>this.container.scrollTop=0)),eg.isWeb?(this._register((0,er.addDisposableListener)(this.container,er.EventType.DROP,e=>er.EventHelper.stop(e,!0))),this._register((0,er.addDisposableListener)(this.container,er.EventType.WHEEL,e=>e.preventDefault(),{passive:!1})),this._register((0,er.addDisposableListener)(this.container,er.EventType.CONTEXT_MENU,e=>er.EventHelper.stop(e,!0)))):(this._register((0,er.addDisposableListener)(this.window.document.body,er.EventType.DRAG_OVER,e=>er.EventHelper.stop(e))),this._register((0,er.addDisposableListener)(this.window.document.body,er.EventType.DROP,e=>er.EventHelper.stop(e)))),this._register((0,er.addDisposableListener)(window,er.EventType.UNLOAD,()=>{this.window?.close()}))}handleBeforeUnload(e){let t;if(this._onBeforeUnload.fire({veto(e){e&&(t=e)}}),t)return void this.handleVetoBeforeClose(e,t);let i=this.configurationService.getValue("window.confirmBeforeClose");("always"===i||"keyboardOnly"===i&&er.ModifierKeyEmitter.getInstance().isModifierPressed)&&this.confirmBeforeClose(e)}handleVetoBeforeClose(e,t){this.preventUnload(e)}preventUnload(e){e.preventDefault(),e.returnValue=(0,ev.localize)(13742,"Changes that you made may not be saved. Please check press 'Cancel' and try again.")}confirmBeforeClose(e){this.preventUnload(e)}handleUnload(){this._onUnload.fire()}layout(){let e=(0,er.getClientArea)(this.window.document.body,eT,this.container);this._onWillLayout.fire(e),this._onDidLayout.fire(e)}createState(){return{bounds:{x:this.window.screenX,y:this.window.screenY,width:this.window.outerWidth,height:this.window.outerHeight},zoomLevel:(0,eo.getZoomLevel)(this.window),compact:this.compact}}dispose(){this._store.isDisposed||(this._onWillDispose.fire(),super.dispose())}};eA=(0,ei.__decorate)([(0,ei.__param)(3,ey.IConfigurationService),(0,ei.__param)(4,eE.IHostService),(0,ei.__param)(5,e_.IWorkbenchEnvironmentService),(0,ei.__param)(6,eC.IContextMenuService),(0,ei.__param)(7,eI.IWorkbenchLayoutService)],eA);let ex=class extends eu.Disposable{static{p=this}static{this.WINDOW_IDS=(0,er.getWindowId)(en.mainWindow)+1}constructor(e,t,i,o,r,s,n){super(),this.layoutService=e,this.dialogService=t,this.configurationService=i,this.telemetryService=o,this.hostService=r,this.environmentService=s,this.contextMenuService=n,this._onDidOpenAuxiliaryWindow=this._register(new ec.Emitter),this.onDidOpenAuxiliaryWindow=this._onDidOpenAuxiliaryWindow.event,this.windows=new Map}async open(e){(0,ep.mark)("code/auxiliaryWindow/willOpen");let t=await this.openWindow(e);if(!t)throw Error((0,ev.localize)(13743,"Unable to open a new window."));let i=await this.resolveWindowId(t);(0,en.ensureCodeWindow)(t,i);let o=new eu.DisposableStore,{container:r,stylesLoaded:s}=this.createContainer(t,o,e),n=this.createAuxiliaryWindow(t,r,s);n.updateOptions({compact:e?.compact??!1});let a=new eu.DisposableStore;this.windows.set(t.vscodeWindowId,n),a.add((0,eu.toDisposable)(()=>this.windows.delete(t.vscodeWindowId)));let d=new eu.DisposableStore;return ec.Event.once(n.onWillDispose)(()=>{t.close(),o.dispose(),a.dispose(),d.dispose()}),a.add((0,er.registerWindow)(t)),this._onDidOpenAuxiliaryWindow.fire({window:n,disposables:d}),(0,ep.mark)("code/auxiliaryWindow/didOpen"),this.telemetryService.publicLog2("auxiliaryWindowOpen",{bounds:!!e?.bounds}),n}createAuxiliaryWindow(e,t,i){return new eA(e,t,i,this.configurationService,this.hostService,this.environmentService,this.contextMenuService,this.layoutService)}async openWindow(e){let t=(0,er.getActiveWindow)(),i={x:t.screenX,y:t.screenY,width:t.outerWidth,height:t.outerHeight},o=ef.DEFAULT_AUX_WINDOW_SIZE,r=Math.max(e?.bounds?.width??o.width,ef.WindowMinimumSize.WIDTH),s=Math.max(e?.bounds?.height??o.height,ef.WindowMinimumSize.HEIGHT),n={x:e?.bounds?.x??Math.max(i.x+i.width/2-r/2,0),y:e?.bounds?.y??Math.max(i.y+i.height/2-s/2,0),width:r,height:s};e?.bounds||n.x!==i.x||n.y!==i.y||(n={...n,x:n.x+30,y:n.y+30});let a=(0,ea.coalesce)(["popup=yes",`left=${n.x}`,`top=${n.y}`,`width=${n.width}`,`height=${n.height}`,e?.nativeTitlebar?"window-native-titlebar=yes":void 0,e?.disableFullscreen?"window-disable-fullscreen=yes":void 0,e?.alwaysOnTop?"window-always-on-top=yes":void 0,e?.mode===g.Maximized?"window-maximized=yes":void 0,e?.mode===g.Fullscreen?"window-fullscreen=yes":void 0]),d=en.mainWindow.open(eg.isFirefox?"":"about:blank",void 0,a.join(","));return!d&&eg.isWeb?(await this.dialogService.prompt({type:em.default.Warning,message:(0,ev.localize)(13744,"The browser blocked opening a new window. Press 'Retry' to try again."),custom:{markdownDetails:[{markdown:new eh.MarkdownString((0,ev.localize)(13745,"Please allow pop-ups for this website in your [browser settings]({0}).","https://aka.ms/allow-vscode-popup"),!0)}]},buttons:[{label:(0,ev.localize)(13746,"&&Retry"),run:()=>this.openWindow(e)}],cancelButton:!0})).result:d?.window}async resolveWindowId(e){return p.WINDOW_IDS++}createContainer(e,t,i){this.applyMeta(e);let{stylesLoaded:o}=this.applyCSS(e,t);return{stylesLoaded:o,container:this.applyHTML(e,t)}}applyMeta(e){for(let t of['meta[charset="utf-8"]','meta[http-equiv="Content-Security-Policy"]','meta[name="viewport"]','meta[name="theme-color"]']){let i=en.mainWindow.document.querySelector(t);if(i){let o=(0,er.createMetaElement)(e.document.head);if((0,er.copyAttributes)(i,o),'meta[http-equiv="Content-Security-Policy"]'===t){let e=o.getAttribute("content");e&&o.setAttribute("content",e.replace(/(script-src[^\;]*)/,"script-src 'none'"))}}}let t=en.mainWindow.document.querySelector('link[rel="icon"]');if(t){let i=(0,er.createLinkElement)(e.document.head);(0,er.copyAttributes)(t,i)}}applyCSS(e,t){(0,ep.mark)("code/auxiliaryWindow/willApplyCSS");let i=new e.CSSStyleSheet;i.insertRule(`body {
146
+ height: 100%;
147
+ width: 100%;
148
+ margin: 0;
149
+ padding: 0;
150
+ overflow: hidden;
151
+ font-size: 11px;
152
+ user-select: none;
153
+ -webkit-user-select: none;
154
+ }`),e.document.adoptedStyleSheets=[...e.document.adoptedStyleSheets,i,...(es.shadowRootContainer??en.mainWindow.document).adoptedStyleSheets.map(t=>{let i=new e.CSSStyleSheet;for(let e of t.cssRules)i.insertRule(e.cssText);return i})];let o=new Map,r=new ed.Barrier;r.wait().then(()=>(0,ep.mark)("code/auxiliaryWindow/didLoadCSSStyles"));let s=t.add(new eu.DisposableStore),n=0;function a(){0==--n&&(s.dispose(),r.open())}function d(t){if((0,es.isGlobalStylesheet)(t))return;let i=e.document.head.appendChild(t.cloneNode(!0));"link"===t.tagName.toLowerCase()&&(n++,s.add((0,er.addDisposableListener)(i,"load",a)),s.add((0,er.addDisposableListener)(i,"error",a))),o.set(t,i)}n++;try{for(let e of en.mainWindow.document.head.querySelectorAll('link[rel="stylesheet"], style'))d(e)}finally{a()}return t.add((0,es.cloneGlobalStylesheets)(e)),t.add(er.sharedMutationObserver.observe(en.mainWindow.document.head,t,{childList:!0,subtree:!0})(e=>{for(let t of e)if("childList"===t.type&&"title"!==t.target.nodeName.toLowerCase()&&"script"!==t.target.nodeName.toLowerCase()&&"meta"!==t.target.nodeName.toLowerCase()){for(let e of t.addedNodes)if((0,er.isHTMLElement)(e)&&("style"===e.tagName.toLowerCase()||"link"===e.tagName.toLowerCase()))d(e);else if(e.nodeType===Node.TEXT_NODE&&e.parentNode){let t=o.get(e.parentNode);t&&(t.textContent=e.textContent)}for(let e of t.removedNodes){let t=o.get(e);t&&(t.parentNode?.removeChild(t),o.delete(e))}}})),(0,ep.mark)("code/auxiliaryWindow/didApplyCSS"),{stylesLoaded:r}}applyHTML(e,t){(0,ep.mark)("code/auxiliaryWindow/willApplyHTML");let i=(0,er.$)("div",{role:"application"});return(0,er.position)(i,0,0,0,0,"relative"),i.style.display="flex",i.style.height="100%",i.style.flexDirection="column",e.document.body.append(i),t.add((0,er.trackAttributes)(en.mainWindow.document.documentElement,e.document.documentElement)),t.add((0,er.trackAttributes)(en.mainWindow.document.body,e.document.body)),t.add((0,er.trackAttributes)(this.layoutService.mainContainer,i,["class"])),(0,ep.mark)("code/auxiliaryWindow/didApplyHTML"),i}getWindow(e){return this.windows.get(e)}};ex=p=(0,ei.__decorate)([(0,ei.__param)(0,eI.IWorkbenchLayoutService),(0,ei.__param)(1,eb.IDialogService),(0,ei.__param)(2,ey.IConfigurationService),(0,ei.__param)(3,ew.ITelemetryService),(0,ei.__param)(4,eE.IHostService),(0,ei.__param)(5,e_.IWorkbenchEnvironmentService),(0,ei.__param)(6,eC.IContextMenuService)],ex),e.s(["BrowserAuxiliaryWindowService",0,ex],901769);var eR=eu,ek=e.i(305063),eM=e.i(447186),eL=e.i(856884),eO=e.i(621826),eP=e.i(140889),eV=e.i(568101),eK=e.i(9753),eN=e.i(535567),eG=e.i(686380),eF=e.i(718596),eW=e.i(970672),ez=e.i(981399),eB=e.i(399362),eU=e.i(740932),eH=e.i(536561),e$=e.i(802136),eq=e.i(262072),eY=e.i(891110),ej=e.i(443483),eX=e.i(853457);let eJ=class extends ej.ViewPaneContainer{constructor(e,t,i,o,r,s,n,a,d,l,c,h,u){super(e,{mergeViewWithContainerWhenSingleView:!1},n,i,o,d,r,l,a,s,c,h,u),this.constantViewDescriptors=new Map,this.allViews=new Map,this._register(t(e=>{this.filterValue=e,this.onFilterChanged(e)})),this._register(this.viewContainerModel.onDidChangeActiveViewDescriptors(()=>{this.updateAllViews(this.viewContainerModel.activeViewDescriptors)}))}updateAllViews(e){e.forEach(e=>{let t=this.getFilterOn(e);t&&(this.allViews.has(t)||this.allViews.set(t,new Map),this.allViews.get(t).set(e.id,e),this.filterValue&&!this.filterValue.includes(t)&&this.panes.find(t=>t.id===e.id)&&this.viewContainerModel.setVisible(e.id,!1))})}addConstantViewDescriptors(e){e.forEach(e=>this.constantViewDescriptors.set(e.id,e))}onFilterChanged(e){0===this.allViews.size&&this.updateAllViews(this.viewContainerModel.activeViewDescriptors),this.getViewsNotForTarget(e).forEach(e=>this.viewContainerModel.setVisible(e.id,!1)),this.getViewsForTarget(e).forEach(e=>this.viewContainerModel.setVisible(e.id,!0))}getViewsForTarget(e){let t=[];for(let i=0;i<e.length;i++)this.allViews.has(e[i])&&t.push(...Array.from(this.allViews.get(e[i]).values()));return t}getViewsNotForTarget(e){let t=this.allViews.keys(),i=t.next(),o=[];for(;!i.done;){let r=!1;e.forEach(e=>{i.value===e&&(r=!0)}),r||(o=o.concat(this.getViewsForTarget([i.value]))),i=t.next()}return o}onDidAddViewDescriptors(e){let t=super.onDidAddViewDescriptors(e);for(let i=0;i<e.length;i++)this.constantViewDescriptors.has(e[i].viewDescriptor.id)&&t[i].setExpanded(!1);return 0===this.allViews.size&&this.updateAllViews(this.viewContainerModel.activeViewDescriptors),t}openView(e,t){let i=super.openView(e,t);if(i){let t=Array.from(this.allViews.entries()).find(t=>t[1].has(e));t&&!this.filterValue?.includes(t[0])&&this.setFilter(t[1].get(e))}return i}};eJ=(0,ei.__decorate)([(0,ei.__param)(2,ey.IConfigurationService),(0,ei.__param)(3,eI.IWorkbenchLayoutService),(0,ei.__param)(4,ew.ITelemetryService),(0,ei.__param)(5,eP.IStorageService),(0,ei.__param)(6,eD.IInstantiationService),(0,ei.__param)(7,eW.IThemeService),(0,ei.__param)(8,eC.IContextMenuService),(0,ei.__param)(9,ez.IExtensionService),(0,ei.__param)(10,eB.IWorkspaceContextService),(0,ei.__param)(11,eM.IViewDescriptorService),(0,ei.__param)(12,eX.ILogService)],eJ);var eZ=e.i(34422),eQ=e.i(362361),e0=e.i(99419);let e1=class extends eR.Disposable{constructor(e,t,i,o,r){super(),this.viewDescriptorService=e,this.paneCompositeService=t,this.contextKeyService=i,this.layoutService=o,this.editorService=r,this._onDidChangeViewVisibility=this._register(new ec.Emitter),this.onDidChangeViewVisibility=this._onDidChangeViewVisibility.event,this._onDidChangeViewContainerVisibility=this._register(new ec.Emitter),this.onDidChangeViewContainerVisibility=this._onDidChangeViewContainerVisibility.event,this._onDidChangeFocusedView=this._register(new ec.Emitter),this.onDidChangeFocusedView=this._onDidChangeFocusedView.event,this.viewContainerDisposables=this._register(new eR.DisposableMap),this.viewDisposable=new Map,this.enabledViewContainersContextKeys=new Map,this.visibleViewContextKeys=new Map,this.viewPaneContainers=new Map,this._register((0,eR.toDisposable)(()=>{this.viewDisposable.forEach(e=>e.dispose()),this.viewDisposable.clear()})),this.viewDescriptorService.viewContainers.forEach(e=>this.onDidRegisterViewContainer(e,this.viewDescriptorService.getViewContainerLocation(e))),this._register(this.viewDescriptorService.onDidChangeViewContainers(({added:e,removed:t})=>this.onDidChangeContainers(e,t))),this._register(this.viewDescriptorService.onDidChangeContainerLocation(({viewContainer:e,from:t,to:i})=>this.onDidChangeContainerLocation(e,t,i))),this._register(this.paneCompositeService.onDidPaneCompositeOpen(e=>this._onDidChangeViewContainerVisibility.fire({id:e.composite.getId(),visible:!0,location:e.viewContainerLocation}))),this._register(this.paneCompositeService.onDidPaneCompositeClose(e=>this._onDidChangeViewContainerVisibility.fire({id:e.composite.getId(),visible:!1,location:e.viewContainerLocation}))),this.focusedViewContextKey=eL.FocusedViewContext.bindTo(i)}onViewsAdded(e){for(let t of e)this.onViewsVisibilityChanged(t,t.isBodyVisible())}onViewsVisibilityChanged(e,t){this.getOrCreateActiveViewContextKey(e).set(t),this._onDidChangeViewVisibility.fire({id:e.id,visible:t})}onViewsRemoved(e){for(let t of e)this.onViewsVisibilityChanged(t,!1)}getOrCreateActiveViewContextKey(e){let t=(0,eL.getVisbileViewContextKey)(e.id),i=this.visibleViewContextKeys.get(t);return i||(i=new eV.RawContextKey(t,!1).bindTo(this.contextKeyService),this.visibleViewContextKeys.set(t,i)),i}onDidChangeContainers(e,t){for(let{container:e,location:i}of t)this.onDidDeregisterViewContainer(e,i);for(let{container:t,location:i}of e)this.onDidRegisterViewContainer(t,i)}onDidRegisterViewContainer(e,t){this.registerPaneComposite(e,t);let i=new eR.DisposableStore,o=this.viewDescriptorService.getViewContainerModel(e);this.onViewDescriptorsAdded(o.allViewDescriptors,e),i.add(o.onDidChangeAllViewDescriptors(({added:t,removed:i})=>{this.onViewDescriptorsAdded(t,e),this.onViewDescriptorsRemoved(i)})),this.updateViewContainerEnablementContextKey(e),i.add(o.onDidChangeActiveViewDescriptors(()=>this.updateViewContainerEnablementContextKey(e))),i.add(this.registerOpenViewContainerAction(e)),this.viewContainerDisposables.set(e.id,i)}onDidDeregisterViewContainer(e,t){this.deregisterPaneComposite(e,t),this.viewContainerDisposables.deleteAndDispose(e.id)}onDidChangeContainerLocation(e,t,i){this.deregisterPaneComposite(e,t),this.registerPaneComposite(e,i),this.layoutService.isVisible(e5(i))&&1===this.viewDescriptorService.getViewContainersByLocation(i).filter(e=>this.isViewContainerActive(e.id)).length&&this.openViewContainer(e.id)}onViewDescriptorsAdded(e,t){if(null!==this.viewDescriptorService.getViewContainerLocation(t))for(let i of e){let e=new eR.DisposableStore;e.add(this.registerOpenViewAction(i)),e.add(this.registerFocusViewAction(i,t.title)),e.add(this.registerResetViewLocationAction(i)),this.viewDisposable.set(i,e)}}onViewDescriptorsRemoved(e){for(let t of e){let e=this.viewDisposable.get(t);e&&(e.dispose(),this.viewDisposable.delete(t))}}updateViewContainerEnablementContextKey(e){let t=this.enabledViewContainersContextKeys.get(e.id);t||(t=this.contextKeyService.createKey(e2(e.id),!1),this.enabledViewContainersContextKeys.set(e.id,t)),t.set(!(e.hideIfEmpty&&0===this.viewDescriptorService.getViewContainerModel(e).activeViewDescriptors.length))}async openComposite(e,t,i){return this.paneCompositeService.openPaneComposite(e,t,i)}getComposite(e,t){return this.paneCompositeService.getPaneComposite(e,t)}isViewContainerVisible(e){let t=this.viewDescriptorService.getViewContainerById(e);if(!t)return!1;let i=this.viewDescriptorService.getViewContainerLocation(t);return null!==i&&this.paneCompositeService.getActivePaneComposite(i)?.getId()===e}isViewContainerActive(e){let t=this.viewDescriptorService.getViewContainerById(e);return!!t&&!!this.contextKeyService.contextMatchesRules(t.when)&&(!t.hideIfEmpty||this.viewDescriptorService.getViewContainerModel(t).activeViewDescriptors.length>0)}getVisibleViewContainer(e){let t=this.paneCompositeService.getActivePaneComposite(e)?.getId();return t?this.viewDescriptorService.getViewContainerById(t):null}getActiveViewPaneContainerWithId(e){let t=this.viewDescriptorService.getViewContainerById(e);return t?this.getActiveViewPaneContainer(t):null}async openViewContainer(e,t){let i=this.viewDescriptorService.getViewContainerById(e);if(i){let o=this.viewDescriptorService.getViewContainerLocation(i);if(null!==o)return await this.paneCompositeService.openPaneComposite(e,o,t)||null}return null}async closeViewContainer(e){let t=this.viewDescriptorService.getViewContainerById(e);if(t){let e=this.viewDescriptorService.getViewContainerLocation(t),i=null!==e&&this.paneCompositeService.getActivePaneComposite(e);if(null!==e)return i?this.layoutService.setPartHidden(!0,e5(e)):void 0}}isViewVisible(e){let t=this.getActiveViewWithId(e);return t?.isBodyVisible()||!1}getActiveViewWithId(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){let i=this.getActiveViewPaneContainer(t);if(i)return i.getView(e)}return null}getViewWithId(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){let i=this.viewPaneContainers.get(t.id);if(i)return i.getView(e)}return null}getFocusedView(){let e=this.contextKeyService.getContextKeyValue(eL.FocusedViewContext.key)??"";return this.viewDescriptorService.getViewDescriptorById(e.toString())}getFocusedViewName(){let e=this.editorService.activeTextEditorControl?.hasTextFocus()?(0,ev.localize)(14616,"Text Editor"):void 0;return this.getFocusedView()?.name?.value??e??""}async openView(e,t){let i=this.viewDescriptorService.getViewContainerByViewId(e);if(!i||!this.viewDescriptorService.getViewContainerModel(i).activeViewDescriptors.some(t=>t.id===e))return null;let o=this.viewDescriptorService.getViewContainerLocation(i),r=this.getComposite(i.id,o);if(r){let i=await this.openComposite(r.id,o);if(i?.openView)return i.openView(e,t)||null;t&&i?.focus()}return null}closeView(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){let i=this.getActiveViewPaneContainer(t);if(i){let o=i.getView(e);if(o)if(1===i.views.length){let i=this.viewDescriptorService.getViewContainerLocation(t);i===ek.ViewContainerLocation.Sidebar?this.layoutService.setPartHidden(!0,eH.Parts.SIDEBAR_PART):(i===ek.ViewContainerLocation.Panel||i===ek.ViewContainerLocation.AuxiliaryBar)&&this.paneCompositeService.hideActivePaneComposite(i),this.focusedViewContextKey.get()===e&&this.focusedViewContextKey.reset()}else o.setExpanded(!1)}}}getActiveViewPaneContainer(e){let t=this.viewDescriptorService.getViewContainerLocation(e);if(null===t)return null;let i=this.paneCompositeService.getActivePaneComposite(t);return i?.getId()===e.id&&i.getViewPaneContainer()||null}getViewProgressIndicator(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(!t)return;let i=this.viewPaneContainers.get(t.id);if(!i)return;let o=i.getView(e);if(o)return i.isViewMergedWithContainer()?this.getViewContainerProgressIndicator(t):o.getProgressIndicator()}getViewContainerProgressIndicator(e){let t=this.viewDescriptorService.getViewContainerLocation(e);if(null!==t)return this.paneCompositeService.getProgressIndicator(e.id,t)}registerOpenViewContainerAction(e){let t=new eR.DisposableStore;if(e.openCommandActionDescriptor){let{id:i,mnemonicTitle:o,keybindings:r,order:s}=e.openCommandActionDescriptor??{id:e.id},n=e.openCommandActionDescriptor.title??e.title,a=this;if(t.add((0,eG.registerAction2)(class extends eG.Action2{constructor(){super({id:i,get title(){const t=a.viewDescriptorService.getViewContainerLocation(e),i="string"==typeof n?n:n.value,o="string"==typeof n?n:n.original;if(t===ek.ViewContainerLocation.Sidebar)return{value:(0,ev.localize)(14617,"Show {0}",i),original:`Show ${o}`};return{value:(0,ev.localize)(14618,"Toggle {0}",i),original:`Toggle ${o}`}},category:eq.Categories.View,precondition:eV.ContextKeyExpr.has(e2(e.id)),keybinding:r?{...r,weight:eF.KeybindingWeight.WorkbenchContrib}:void 0,f1:!0})}async run(t){let i=t.get(eY.IEditorGroupsService),o=t.get(eM.IViewDescriptorService),r=t.get(eI.IWorkbenchLayoutService),s=t.get(e0.IViewsService),n=o.getViewContainerLocation(e);switch(n){case ek.ViewContainerLocation.AuxiliaryBar:case ek.ViewContainerLocation.Sidebar:{let t=n===ek.ViewContainerLocation.Sidebar?eH.Parts.SIDEBAR_PART:eH.Parts.AUXILIARYBAR_PART;s.isViewContainerVisible(e.id)&&r.hasFocus(t)?i.activeGroup.focus():await s.openViewContainer(e.id,!0);break}case ek.ViewContainerLocation.Panel:s.isViewContainerVisible(e.id)&&r.hasFocus(eH.Parts.PANEL_PART)?s.closeViewContainer(e.id):await s.openViewContainer(e.id,!0)}}})),o){let r=this.viewDescriptorService.getDefaultViewContainerLocation(e);t.add(eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarViewMenu,{command:{id:i,title:o},group:r===ek.ViewContainerLocation.Sidebar?"3_sidebar":r===ek.ViewContainerLocation.AuxiliaryBar?"4_auxbar":"5_panel",when:eV.ContextKeyExpr.has(e2(e.id)),order:s??Number.MAX_VALUE}))}}return t}registerOpenViewAction(e){let t=new eR.DisposableStore,i=e.openCommandActionDescriptor?.title??e.name,o=e.openCommandActionDescriptor?.id??`${e.id}.open`,r=this;if(t.add((0,eG.registerAction2)(class extends eG.Action2{constructor(){super({id:o,get title(){const t=r.viewDescriptorService.getViewLocationById(e.id),o="string"==typeof i?i:i.value,s="string"==typeof i?i:i.original;if(t===ek.ViewContainerLocation.Sidebar)return{value:(0,ev.localize)(14617,"Show {0}",o),original:`Show ${s}`};return{value:(0,ev.localize)(14618,"Toggle {0}",o),original:`Toggle ${s}`}},category:eq.Categories.View,precondition:eV.ContextKeyExpr.has(`${e.id}.active`),keybinding:e.openCommandActionDescriptor?.keybindings?{...e.openCommandActionDescriptor.keybindings,weight:eF.KeybindingWeight.WorkbenchContrib}:void 0,f1:!!e.openCommandActionDescriptor||void 0,metadata:{description:(0,ev.localize)(14619,"Opens view {0}",e.name.value),args:[{name:"options",schema:{type:"object",properties:{preserveFocus:{type:"boolean",default:!1,description:(0,ev.localize)(14620,"Whether to preserve the existing focus when opening the view.")}}}}]}})}async run(t,i){let o=t.get(eY.IEditorGroupsService),r=t.get(eM.IViewDescriptorService),s=t.get(eI.IWorkbenchLayoutService),n=t.get(e0.IViewsService),a=t.get(eK.IContextKeyService);if(eL.FocusedViewContext.getValue(a)!==e.id||i?.preserveFocus)await n.openView(e.id,!i?.preserveFocus);else{let t=r.getViewLocationById(e.id);r.getViewLocationById(e.id)===ek.ViewContainerLocation.Sidebar?o.activeGroup.focus():null!==t&&s.setPartHidden(!0,e5(t))}}})),e.openCommandActionDescriptor?.mnemonicTitle){let i=this.viewDescriptorService.getDefaultContainerById(e.id);if(i){let r=this.viewDescriptorService.getDefaultViewContainerLocation(i);t.add(eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarViewMenu,{command:{id:o,title:e.openCommandActionDescriptor.mnemonicTitle},group:r===ek.ViewContainerLocation.Sidebar?"3_sidebar":r===ek.ViewContainerLocation.AuxiliaryBar?"4_auxbar":"5_panel",when:eV.ContextKeyExpr.has(`${e.id}.active`),order:e.openCommandActionDescriptor.order??Number.MAX_VALUE}))}}return t}registerFocusViewAction(e,t){return(0,eG.registerAction2)(class extends eG.Action2{constructor(){const i=(0,ev.localize2)(14621,"Focus on {0} View",e.name.value);super({id:e.focusCommand?e.focusCommand.id:`${e.id}.focus`,title:i,category:t,menu:[{id:eG.MenuId.CommandPalette,when:e.when}],keybinding:{when:eV.ContextKeyExpr.has(`${e.id}.active`),weight:eF.KeybindingWeight.WorkbenchContrib,primary:e.focusCommand?.keybindings?.primary,secondary:e.focusCommand?.keybindings?.secondary,linux:e.focusCommand?.keybindings?.linux,mac:e.focusCommand?.keybindings?.mac,win:e.focusCommand?.keybindings?.win},metadata:{description:i.value,args:[{name:"focusOptions",description:"Focus Options",schema:{type:"object",properties:{preserveFocus:{type:"boolean",default:!1}}}}]}})}run(t,i){t.get(e0.IViewsService).openView(e.id,!i?.preserveFocus)}})}registerResetViewLocationAction(e){return(0,eG.registerAction2)(class extends eG.Action2{constructor(){super({id:`${e.id}.resetViewLocation`,title:(0,ev.localize2)(14622,"Reset Location"),menu:[{id:eG.MenuId.ViewTitleContext,when:eV.ContextKeyExpr.or(eV.ContextKeyExpr.and(eV.ContextKeyExpr.equals("view",e.id),eV.ContextKeyExpr.equals(`${e.id}.defaultViewLocation`,!1))),group:"1_hide",order:2}]})}run(t){let i=t.get(eM.IViewDescriptorService),o=i.getDefaultContainerById(e.id),r=i.getViewContainerModel(o);if(o.hideIfEmpty&&0===r.visibleViewDescriptors.length){let e=i.getDefaultViewContainerLocation(o);i.moveViewContainerToLocation(o,e,void 0,this.desc.id)}i.moveViewsToContainer([e],o,void 0,this.desc.id),t.get(e0.IViewsService).openView(e.id,!0)}})}registerPaneComposite(e,t){let i=this,o=class extends eU.PaneComposite{constructor(t,i,o,r,s,n,a){super(e.id,t,o,r,s,n,a,i)}createViewPaneContainer(o){let r=this._register(new eR.DisposableStore),s=i.createViewPaneContainer(o,e,t,r,this.instantiationService);return s instanceof eJ||r.add(ec.Event.any(s.onDidAddViews,s.onDidRemoveViews,s.onTitleAreaUpdate)(()=>{this.updateTitleArea()})),s}};o=(0,ei.__decorate)([(0,ei.__param)(0,ew.ITelemetryService),(0,ei.__param)(1,eB.IWorkspaceContextService),(0,ei.__param)(2,eP.IStorageService),(0,ei.__param)(3,eD.IInstantiationService),(0,ei.__param)(4,eW.IThemeService),(0,ei.__param)(5,eC.IContextMenuService),(0,ei.__param)(6,ez.IExtensionService)],o),eO.Registry.as(e3(t)).registerPaneComposite(eU.PaneCompositeDescriptor.create(o,e.id,"string"==typeof e.title?e.title:e.title.value,(0,eN.isString)(e.icon)?e.icon:void 0,e.order,e.requestedIndex,e.icon instanceof e$.URI?e.icon:void 0))}deregisterPaneComposite(e,t){eO.Registry.as(e3(t)).deregisterPaneComposite(e.id)}createViewPaneContainer(e,t,i,o,r){let s=r.createInstance(t.ctorDescriptor.ctor,...t.ctorDescriptor.staticArguments||[]);return this.viewPaneContainers.set(s.getId(),s),o.add((0,eR.toDisposable)(()=>this.viewPaneContainers.delete(s.getId()))),o.add(s.onDidAddViews(e=>this.onViewsAdded(e))),o.add(s.onDidChangeViewVisibility(e=>this.onViewsVisibilityChanged(e,e.isBodyVisible()))),o.add(s.onDidRemoveViews(e=>this.onViewsRemoved(e))),o.add(s.onDidFocusView(e=>{this.focusedViewContextKey.get()!==e.id&&(this.focusedViewContextKey.set(e.id),this._onDidChangeFocusedView.fire())})),o.add(s.onDidBlurView(e=>{this.focusedViewContextKey.get()===e.id&&(this.focusedViewContextKey.reset(),this._onDidChangeFocusedView.fire())})),s}};function e2(e){return`viewContainer.${e}.enabled`}function e3(e){switch(e){case ek.ViewContainerLocation.AuxiliaryBar:return eU.Extensions.Auxiliary;case ek.ViewContainerLocation.Panel:return eU.Extensions.Panels;case ek.ViewContainerLocation.Sidebar:default:return eU.Extensions.Viewlets}}function e5(e){switch(e){case ek.ViewContainerLocation.AuxiliaryBar:return eH.Parts.AUXILIARYBAR_PART;case ek.ViewContainerLocation.Panel:return eH.Parts.PANEL_PART;case ek.ViewContainerLocation.Sidebar:default:return eH.Parts.SIDEBAR_PART}}e1=(0,ei.__decorate)([(0,ei.__param)(0,eM.IViewDescriptorService),(0,ei.__param)(1,eZ.IPaneCompositePartService),(0,ei.__param)(2,eK.IContextKeyService),(0,ei.__param)(3,eI.IWorkbenchLayoutService),(0,ei.__param)(4,eQ.IEditorService)],e1),e.s(["ViewsService",0,e1],313289);var e6=e.i(93114);e.s(["EditorPaneService",0,class{constructor(){this.onWillInstantiateEditorPane=e6.EditorPaneDescriptor.onWillInstantiateEditorPane}didInstantiateEditorPane(e){return e6.EditorPaneDescriptor.didInstantiateEditorPane(e)}}],863637),e.s(["ActionViewItemService",0,class{constructor(){this._providers=new Map,this._onDidChange=new ec.Emitter,this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}register(e,t,i,o){let r=this._makeKey(e,t);if(this._providers.has(r))throw Error(`A provider for the command ${t} and menu ${e} is already registered.`);this._providers.set(r,i);let s=o?.(()=>{this._onDidChange.fire(e)});return(0,eu.toDisposable)(()=>{s?.dispose(),this._providers.delete(r)})}lookUp(e,t){return this._providers.get(this._makeKey(e,t))}_makeKey(e,t){return`${e.id}/${t instanceof eG.MenuId?t.id:t}`}}],873306),e.i(487106);var e4=e.i(526097),e9=e.i(31366),e8=e.i(704994),e7=e.i(195603),te=e.i(802186),tt=e.i(163731),ti=e.i(327532),to=e.i(69150),tr=e.i(2267),ts=e.i(34487),tn=e.i(730440),ta=e.i(872229),td=e.i(652731),tl=e.i(553638),tc=e.i(464172),th=e.i(935144),tu=e.i(170774),tp=e.i(702320);class tg{constructor(){this.uris=[]}async perform(){return this}toString(){return"(noop)"}}class tm{constructor(e,t,i){this.newUri=e,this.oldUri=t,this.options=i,this.type="rename"}}let tv=m=class{constructor(e,t,i,o){this._edits=e,this._undoRedoInfo=t,this._workingCopyFileService=i,this._fileService=o}get uris(){return this._edits.flatMap(e=>[e.newUri,e.oldUri])}async perform(e){let t=[],i=[];for(let e of this._edits)void 0===e.options.overwrite&&e.options.ignoreIfExists&&await this._fileService.exists(e.newUri)||(t.push({file:{source:e.oldUri,target:e.newUri},overwrite:e.options.overwrite}),i.push(new tm(e.oldUri,e.newUri,e.options)));return 0===t.length?new tg:(await this._workingCopyFileService.move(t,e,this._undoRedoInfo),new m(i,{isUndoing:!0},this._workingCopyFileService,this._fileService))}toString(){return`(rename ${this._edits.map(e=>`${e.oldUri} to ${e.newUri}`).join(", ")})`}};tv=m=(0,ei.__decorate)([(0,ei.__param)(2,tc.IWorkingCopyFileService),(0,ei.__param)(3,tl.IFileService)],tv);class ty{constructor(e,t,i){this.newUri=e,this.oldUri=t,this.options=i,this.type="copy"}}let tC=class{constructor(e,t,i,o,r){this._edits=e,this._undoRedoInfo=t,this._workingCopyFileService=i,this._fileService=o,this._instaService=r}get uris(){return this._edits.flatMap(e=>[e.newUri,e.oldUri])}async perform(e){let t=[];for(let e of this._edits)void 0===e.options.overwrite&&e.options.ignoreIfExists&&await this._fileService.exists(e.newUri)||t.push({file:{source:e.oldUri,target:e.newUri},overwrite:e.options.overwrite});if(0===t.length)return new tg;let i=await this._workingCopyFileService.copy(t,e,this._undoRedoInfo),o=[];for(let e=0;e<i.length;e++){let t=i[e],r=this._edits[e];o.push(new tf(t.resource,{recursive:!0,folder:this._edits[e].options.folder||t.isDirectory,...r.options},!1))}return this._instaService.createInstance(tS,o,{isUndoing:!0})}toString(){return`(copy ${this._edits.map(e=>`${e.oldUri} to ${e.newUri}`).join(", ")})`}};tC=(0,ei.__decorate)([(0,ei.__param)(2,tc.IWorkingCopyFileService),(0,ei.__param)(3,tl.IFileService),(0,ei.__param)(4,eD.IInstantiationService)],tC);class tb{constructor(e,t,i){this.newUri=e,this.options=t,this.contents=i,this.type="create"}}let tw=class{constructor(e,t,i,o,r,s){this._edits=e,this._undoRedoInfo=t,this._fileService=i,this._workingCopyFileService=o,this._instaService=r,this._textFileService=s}get uris(){return this._edits.map(e=>e.newUri)}async perform(e){let t=[],i=[],o=[];for(let e of this._edits)if(e.newUri.scheme!==tp.Schemas.untitled&&!(void 0===e.options.overwrite&&e.options.ignoreIfExists&&await this._fileService.exists(e.newUri))){if(e.options.folder)t.push({resource:e.newUri});else{let t=void 0!==e.contents?e.contents:await this._textFileService.getEncodedReadable(e.newUri);i.push({resource:e.newUri,contents:t,overwrite:e.options.overwrite})}o.push(new tf(e.newUri,e.options,!e.options.folder&&!e.contents))}return 0===t.length&&0===i.length?new tg:(await this._workingCopyFileService.createFolder(t,e,this._undoRedoInfo),await this._workingCopyFileService.create(i,e,this._undoRedoInfo),this._instaService.createInstance(tS,o,{isUndoing:!0}))}toString(){return`(create ${this._edits.map(e=>e.options.folder?`folder ${e.newUri}`:`file ${e.newUri} with ${e.contents?.byteLength||0} bytes`).join(", ")})`}};tw=(0,ei.__decorate)([(0,ei.__param)(2,tl.IFileService),(0,ei.__param)(3,tc.IWorkingCopyFileService),(0,ei.__param)(4,eD.IInstantiationService),(0,ei.__param)(5,tu.ITextFileService)],tw);class tf{constructor(e,t,i){this.oldUri=e,this.options=t,this.undoesCreate=i,this.type="delete"}}let tS=class{constructor(e,t,i,o,r,s,n){this._edits=e,this._undoRedoInfo=t,this._workingCopyFileService=i,this._fileService=o,this._configurationService=r,this._instaService=s,this._logService=n}get uris(){return this._edits.map(e=>e.oldUri)}async perform(e){let t=[],i=[];for(let e of this._edits){let o,r;try{o=await this._fileService.resolve(e.oldUri,{resolveMetadata:!0})}catch(t){if(!e.options.ignoreIfNotExists)throw Error(`${e.oldUri} does not exist and can not be deleted`);continue}t.push({resource:e.oldUri,recursive:e.options.recursive,useTrash:!e.options.skipTrashBin&&this._fileService.hasCapability(e.oldUri,td.FileSystemProviderCapabilities.Trash)&&this._configurationService.getValue("files.enableTrash")});let s=!1;if(!e.undoesCreate&&!e.options.folder&&!(s="number"==typeof e.options.maxSize&&o.size>e.options.maxSize))try{r=await this._fileService.readFile(e.oldUri)}catch(e){this._logService.error(e)}s||i.push(new tb(e.oldUri,e.options,r?.value))}return 0===t.length||(await this._workingCopyFileService.delete(t,e,this._undoRedoInfo),0===i.length)?new tg:this._instaService.createInstance(tw,i,{isUndoing:!0})}toString(){return`(delete ${this._edits.map(e=>e.oldUri).join(", ")})`}};tS=(0,ei.__decorate)([(0,ei.__param)(2,tc.IWorkingCopyFileService),(0,ei.__param)(3,tl.IFileService),(0,ei.__param)(4,ey.IConfigurationService),(0,ei.__param)(5,eD.IInstantiationService),(0,ei.__param)(6,eX.ILogService)],tS);class t_{constructor(e,t,i,o){this.label=e,this.code=t,this.operations=i,this.confirmBeforeUndo=o,this.type=tn.UndoRedoElementType.Workspace,this.resources=i.flatMap(e=>e.uris)}async undo(){await this._reverse()}async redo(){await this._reverse()}async _reverse(){for(let e=0;e<this.operations.length;e++){let t=this.operations[e],i=await t.perform(e8.CancellationToken.None);this.operations[e]=i}}toString(){return this.operations.map(e=>String(e)).join(", ")}}let tE=class{constructor(e,t,i,o,r,s,n,a,d,l){this._label=e,this._code=t,this._undoRedoGroup=i,this._undoRedoSource=o,this._confirmBeforeUndo=r,this._progress=s,this._token=n,this._edits=a,this._instaService=d,this._undoRedoService=l}async apply(){let e=[],t={undoRedoGroupId:this._undoRedoGroup.id},i=[];for(let e of this._edits)e.newResource&&e.oldResource&&!e.options?.copy?i.push(new tm(e.newResource,e.oldResource,e.options??{})):e.newResource&&e.oldResource&&e.options?.copy?i.push(new ty(e.newResource,e.oldResource,e.options??{})):!e.newResource&&e.oldResource?i.push(new tf(e.oldResource,e.options??{},!1)):e.newResource&&!e.oldResource&&i.push(new tb(e.newResource,e.options??{},await e.options.contents));if(0===i.length)return[];let o=[];o[0]=[i[0]];for(let e=1;e<i.length;e++){let t=i[e],r=o.at(-1);r?.[0].type===t.type?r.push(t):o.push([t])}for(let i of o){let o;if(this._token.isCancellationRequested)break;switch(i[0].type){case"rename":o=this._instaService.createInstance(tv,i,t);break;case"copy":o=this._instaService.createInstance(tC,i,t);break;case"delete":o=this._instaService.createInstance(tS,i,t);break;case"create":o=this._instaService.createInstance(tw,i,t)}if(o){let t=await o.perform(this._token);e.push(t)}this._progress.report(void 0)}let r=new t_(this._label,this._code,e,this._confirmBeforeUndo);return this._undoRedoService.pushElement(r,this._undoRedoGroup,this._undoRedoSource),r.resources}};tE=(0,ei.__decorate)([(0,ei.__param)(8,eD.IInstantiationService),(0,ei.__param)(9,th.IUndoRedoService)],tE);var tI=e.i(315380),tD=e.i(166969),tT=e.i(905670),tA=e.i(107707),tx=e.i(565280),tR=e.i(326659),tk=e.i(725288),tM=e.i(660422);class tL{constructor(e){this._modelReference=e,this.model=this._modelReference.object.textEditorModel,this._edits=[]}dispose(){this._modelReference.dispose()}isNoOp(){return!(this._edits.length>0)&&(void 0===this._newEol||this._newEol===this.model.getEndOfLineSequence())}addEdit(e){let t;this._expectedModelVersionId=e.versionId;let{textEdit:i}=e;"number"==typeof i.eol&&(this._newEol=i.eol),(i.range||i.text)&&(!tD.Range.isEmpty(i.range)||i.text)&&(t=i.range?tD.Range.lift(i.range):this.model.getFullModelRange(),this._edits.push({...tI.EditOperation.replaceMove(t,i.text),insertAsSnippet:i.insertAsSnippet,keepWhitespace:i.keepWhitespace}))}validate(){return void 0===this._expectedModelVersionId||this.model.getVersionId()===this._expectedModelVersionId?{canApply:!0}:{canApply:!1,reason:this.model.uri}}getBeforeCursorState(){return null}apply(e){this._edits.length>0&&(this._edits=this._edits.map(this._transformSnippetStringToInsertText,this).sort((e,t)=>tD.Range.compareRangesUsingStarts(e.range,t.range)),this.model.pushEditOperations(null,this._edits,()=>null,void 0,e)),void 0!==this._newEol&&this.model.pushEOL(this._newEol)}_transformSnippetStringToInsertText(e){if(!e.insertAsSnippet||!e.text)return e;let t=tM.SnippetParser.asInsertText(e.text);return{...e,insertAsSnippet:!1,text:t}}}class tO extends tL{constructor(e,t){super(e),this._editor=t}getBeforeCursorState(){return this._canUseEditor()?this._editor.getSelections():null}apply(e){if(!this._canUseEditor())return void super.apply();if(this._edits.length>0){let t=tk.SnippetController2.get(this._editor);if(t&&this._edits.some(e=>e.insertAsSnippet)){let e=[];for(let t of this._edits)t.range&&null!==t.text&&e.push({range:tD.Range.lift(t.range),template:t.insertAsSnippet?t.text:tM.SnippetParser.escape(t.text),keepWhitespace:t.keepWhitespace});t.apply(e,{undoStopBefore:!1,undoStopAfter:!1})}else this._edits=this._edits.map(this._transformSnippetStringToInsertText,this).sort((e,t)=>tD.Range.compareRangesUsingStarts(e.range,t.range)),this._editor.executeEdits(e,this._edits)}void 0!==this._newEol&&this._editor.hasModel()&&this._editor.getModel().pushEOL(this._newEol)}_canUseEditor(){return this._editor?.getModel()?.uri.toString()===this.model.uri.toString()}}let tP=class{constructor(e,t,i,o,r,s,n,a,d,l,c,h){for(const u of(this._label=e,this._code=t,this._editor=i,this._undoRedoGroup=o,this._undoRedoSource=r,this._progress=s,this._token=n,this._editorWorker=d,this._modelService=l,this._textModelResolverService=c,this._undoRedoService=h,this._edits=new te.ResourceMap,a)){let e=this._edits.get(u.resource);e||(e=[],this._edits.set(u.resource,e)),e.push(u)}}_validateBeforePrepare(){for(let e of this._edits.values())for(let t of e)if("number"==typeof t.versionId){let e=this._modelService.getModel(t.resource);if(e&&e.getVersionId()!==t.versionId)throw Error(`${e.uri.toString()} has changed in the meantime`)}}async _createEditsTasks(){let e=[],t=[];for(let[i,o]of this._edits){let r=this._textModelResolverService.createModelReference(i).then(async t=>{let i,r=!1;if(this._editor?.getModel()?.uri.toString()===t.object.textEditorModel.uri.toString()?(i=new tO(t,this._editor),r=!0):i=new tL(t),e.push(i),!r)return void o.forEach(i.addEdit,i);let s=async(e,r)=>{let s=o.slice(e,r),n=await this._editorWorker.computeMoreMinimalEdits(t.object.textEditorModel.uri,s.map(e=>e.textEdit),!1);n?n.forEach(e=>i.addEdit(new ti.ResourceTextEdit(t.object.textEditorModel.uri,e,void 0,void 0))):s.forEach(i.addEdit,i)},n=0,a=0;for(;a<o.length;a++)(o[a].textEdit.insertAsSnippet||o[a].metadata)&&(await s(n,a),i.addEdit(o[a]),n=a+1);await s(n,a)});t.push(r)}return await Promise.all(t),e}_validateTasks(e){for(let t of e){let e=t.validate();if(!e.canApply)return e}return{canApply:!0}}async apply(e){this._validateBeforePrepare();let t=await this._createEditsTasks();try{if(this._token.isCancellationRequested)return[];let i=[],o=this._validateTasks(t);if(!o.canApply)throw Error(`${o.reason.toString()} has changed in the meantime`);if(1===t.length){let o=t[0];if(!o.isNoOp()){let t=new tx.SingleModelEditStackElement(this._label,this._code,o.model,o.getBeforeCursorState());this._undoRedoService.pushElement(t,this._undoRedoGroup,this._undoRedoSource),o.apply(e),t.close(),i.push(o.model.uri)}this._progress.report(void 0)}else{let e=new tx.MultiModelEditStackElement(this._label,this._code,t.map(e=>new tx.SingleModelEditStackElement(this._label,this._code,e.model,e.getBeforeCursorState())));for(let o of(this._undoRedoService.pushElement(e,this._undoRedoGroup,this._undoRedoSource),t))o.apply(),this._progress.report(void 0),i.push(o.model.uri);e.close()}return i}finally{(0,eu.dispose)(t)}}};tP=(0,ei.__decorate)([(0,ei.__param)(8,tA.IEditorWorkerService),(0,ei.__param)(9,tR.IModelService),(0,ei.__param)(10,tT.ITextModelService),(0,ei.__param)(11,th.IUndoRedoService)],tP);var tV=e.i(683578),tK=e.i(278725),tN=e.i(7542),tG=ti;class tF extends tG.ResourceEdit{static is(e){return e instanceof tF||(0,eN.isObject)(e)&&!!(e.undo&&e.redo)}static lift(e){return e instanceof tF?e:new tF(e.resource,e.undo,e.redo,e.metadata)}constructor(e,t,i,o){super(o),this.resource=e,this.undo=t,this.redo=i}}let tW=class{constructor(e,t,i,o,r,s){this._undoRedoGroup=e,this._undoRedoSource=t,this._progress=i,this._token=o,this._edits=r,this._undoRedoService=s}async apply(){let e=[];for(let t of this._edits){if(this._token.isCancellationRequested)break;await t.redo(),this._undoRedoService.pushElement({type:tn.UndoRedoElementType.Resource,resource:t.resource,label:t.metadata?.label||"Custom Edit",code:"paste",undo:t.undo,redo:t.redo},this._undoRedoGroup,this._undoRedoSource),this._progress.report(void 0),e.push(t.resource)}return e}};tW=(0,ei.__decorate)([(0,ei.__param)(5,th.IUndoRedoService)],tW);let tz=class{constructor(e,t,i,o,r,s,n,a,d,l,c){this._label=e,this._code=t,this._editor=i,this._progress=o,this._token=r,this._edits=s,this._undoRedoGroup=n,this._undoRedoSource=a,this._confirmBeforeUndo=d,this._instaService=l,this._logService=c}ariaMessage(){let e=new te.ResourceMap,t=new te.ResourceMap,i=0;for(let o of this._edits)o instanceof ti.ResourceTextEdit?(i+=1,t.set(o.resource,!0)):o instanceof ti.ResourceFileEdit&&e.set(o.oldResource??o.newResource,!0);return 0===this._edits.length?(0,ev.localize)(4506,"Made no edits"):0!==e.size?(0,ev.localize)(4509,"Made {0} text edits in {1} files, also created or deleted {2} files",i,t.size,e.size):i>1&&t.size>1?(0,ev.localize)(4507,"Made {0} text edits in {1} files",i,t.size):(0,ev.localize)(4508,"Made {0} text edits in one file",i)}async perform(e){if(0===this._edits.length)return[];let t=[1];for(let e=1;e<this._edits.length;e++)Object.getPrototypeOf(this._edits[e-1])===Object.getPrototypeOf(this._edits[e])?t[t.length-1]++:t.push(1);let i=this._edits.length>1?0:void 0;this._progress.report({increment:i,total:100});let o={report:e=>this._progress.report({increment:100/this._edits.length})},r=[],s=0;for(let i of t){if(this._token.isCancellationRequested)break;let t=this._edits.slice(s,s+i);t[0]instanceof ti.ResourceFileEdit?r.push(await this._performFileEdits(t,this._undoRedoGroup,this._undoRedoSource,this._confirmBeforeUndo,o)):t[0]instanceof ti.ResourceTextEdit?r.push(await this._performTextEdits(t,this._undoRedoGroup,this._undoRedoSource,o,e)):t[0]instanceof ta.ResourceNotebookCellEdit?r.push(await this._performCellEdits(t,this._undoRedoGroup,this._undoRedoSource,o)):t[0]instanceof tF?r.push(await this._performOpaqueEdits(t,this._undoRedoGroup,this._undoRedoSource,o)):console.log("UNKNOWN EDIT"),s+=i}return r.flat()}async _performFileEdits(e,t,i,o,r){this._logService.debug("_performFileEdits",JSON.stringify(e));let s=this._instaService.createInstance(tE,this._label||(0,ev.localize)(4510,"Workspace Edit"),this._code||"undoredo.workspaceEdit",t,i,o,r,this._token,e);return await s.apply()}async _performTextEdits(e,t,i,o,r){this._logService.debug("_performTextEdits",JSON.stringify(e));let s=this._instaService.createInstance(tP,this._label||(0,ev.localize)(4510,"Workspace Edit"),this._code||"undoredo.workspaceEdit",this._editor,t,i,o,this._token,e);return await s.apply(r)}async _performCellEdits(e,t,i,o){this._logService.debug("_performCellEdits",JSON.stringify(e));let r=this._instaService.createInstance(ta.BulkCellEdits,t,i,o,this._token,e);return await r.apply()}async _performOpaqueEdits(e,t,i,o){this._logService.debug("_performOpaqueEdits",JSON.stringify(e));let r=this._instaService.createInstance(tW,t,i,o,this._token,e);return await r.apply()}};tz=(0,ei.__decorate)([(0,ei.__param)(9,eD.IInstantiationService),(0,ei.__param)(10,eX.ILogService)],tz);let tB=class{constructor(e,t,i,o,r,s,n){this._instaService=e,this._logService=t,this._editorService=i,this._lifecycleService=o,this._dialogService=r,this._workingCopyService=s,this._configService=n,this._activeUndoRedoGroups=new e7.LinkedList}setPreviewHandler(e){return this._previewHandler=e,(0,eu.toDisposable)(()=>{this._previewHandler===e&&(this._previewHandler=void 0)})}hasPreviewHandler(){return!!this._previewHandler}async apply(e,t){let i,o,r=(Array.isArray(e)?e:e.edits).map(e=>{if(ti.ResourceTextEdit.is(e))return ti.ResourceTextEdit.lift(e);if(ti.ResourceFileEdit.is(e))return ti.ResourceFileEdit.lift(e);if(ta.ResourceNotebookCellEdit.is(e))return ta.ResourceNotebookCellEdit.lift(e);if(tF.is(e))return tF.lift(e);throw Error("Unsupported edit")});if(0===r.length)return{ariaSummary:(0,ev.localize)(4511,"Made no edits"),isApplied:!1};this._previewHandler&&(t?.showPreview||r.some(e=>e.metadata?.needsConfirmation))&&(r=await this._previewHandler(r,t));let s=t?.editor;if(!s){let e=this._editorService.activeTextEditorControl;(0,tt.isCodeEditor)(e)?s=e:(0,tt.isDiffEditor)(e)&&(s=e.getModifiedEditor())}s&&s.getOption(to.EditorOption.readOnly)&&(s=void 0);let n=()=>{};if("number"==typeof t?.undoRedoGroupId){for(let e of this._activeUndoRedoGroups)if(e.id===t.undoRedoGroupId){i=e;break}}i||(i=new tn.UndoRedoGroup,n=this._activeUndoRedoGroups.push(i));let a=t?.quotableLabel||t?.label,d=this._instaService.createInstance(tz,a,t?.code,s,t?.progress??ts.Progress.None,t?.token??e8.CancellationToken.None,r,i,t?.undoRedoSource,!!t?.confirmBeforeUndo);try{o=this._lifecycleService.onBeforeShutdown(e=>e.veto(this._shouldVeto(a,e.reason),"veto.blukEditService"));let e=await d.perform(t?.reason);return t?.respectAutoSaveConfig&&!0===this._configService.getValue(tU)&&e.length>1&&await this._saveAll(e),{ariaSummary:d.ariaMessage(),isApplied:r.length>0}}catch(e){throw this._logService.error(e),e}finally{o?.dispose(),n()}}async _saveAll(e){let t=new te.ResourceSet(e),i=this._workingCopyService.dirtyWorkingCopies.map(async e=>{t.has(e.resource)&&await e.save()});for(let e of(await Promise.allSettled(i)))"rejected"===e.status&&this._logService.warn(e.reason)}async _shouldVeto(e,t){let i;switch(t){case tV.ShutdownReason.CLOSE:i=(0,ev.localize)(4512,"Are you sure you want to close the window?");break;case tV.ShutdownReason.LOAD:i=(0,ev.localize)(4513,"Are you sure you want to change the workspace?");break;case tV.ShutdownReason.RELOAD:i=(0,ev.localize)(4514,"Are you sure you want to reload the window?");break;default:i=eg.isMacintosh?(0,ev.localize)(4515,"Are you sure you want to quit?"):(0,ev.localize)(4516,"Are you sure you want to exit?")}return!(await this._dialogService.confirm({message:i,detail:(0,ev.localize)(4517,"'{0}' is in progress.",e||(0,ev.localize)(4518,"File operation"))})).confirmed}};tB=(0,ei.__decorate)([(0,ei.__param)(0,eD.IInstantiationService),(0,ei.__param)(1,eX.ILogService),(0,ei.__param)(2,eQ.IEditorService),(0,ei.__param)(3,tK.ILifecycleService),(0,ei.__param)(4,eb.IDialogService),(0,ei.__param)(5,tN.IWorkingCopyService),(0,ei.__param)(6,ey.IConfigurationService)],tB);let tU="files.refactoring.autoSave";eO.Registry.as(tr.Extensions.Configuration).registerConfiguration({id:"files",properties:{[tU]:{description:(0,ev.localize)(4519,"Controls if files that were part of a refactoring are saved automatically"),default:!0,type:"boolean"}}});var tH=e.i(697786),t$=e.i(654295),tq=e.i(984004),tY=e.i(201642),tj=e.i(487495),tX=e.i(84513),tJ=e.i(370973),tZ=e.i(441340),tQ=e.i(65579),t0=e.i(701575),t1=e.i(490819),t2=e.i(599645),t3=e.i(502930),t5=e.i(58762),t6=e.i(327634);let t4=class{constructor(e,t,i,o){this._conflicts=new te.ResourceMap,this._disposables=new eu.DisposableStore,this._onDidConflict=new ec.Emitter,this.onDidConflict=this._onDidConflict.event;const r=new te.ResourceMap;for(const t of e)if(t instanceof ti.ResourceTextEdit){if(r.set(t.resource,!0),"number"==typeof t.versionId){const e=i.getModel(t.resource);e&&e.getVersionId()!==t.versionId&&(this._conflicts.set(t.resource,!0),this._onDidConflict.fire(this))}}else t instanceof ti.ResourceFileEdit?t.newResource?r.set(t.newResource,!0):t.oldResource&&r.set(t.oldResource,!0):t instanceof ta.ResourceNotebookCellEdit?r.set(t.resource,!0):o.warn("UNKNOWN edit type",t);this._disposables.add(t.onDidFilesChange(e=>{for(let t of r.keys())if(!i.getModel(t)&&e.contains(t)){this._conflicts.set(t,!0),this._onDidConflict.fire(this);break}}));const s=e=>{r.has(e.uri)&&(this._conflicts.set(e.uri,!0),this._onDidConflict.fire(this))};for(const e of i.getModels())this._disposables.add(e.onDidChangeContent(()=>s(e)))}dispose(){this._disposables.dispose(),this._onDidConflict.dispose()}list(){return[...this._conflicts.keys()]}hasConflicts(){return this._conflicts.size>0}};t4=(0,ei.__decorate)([(0,ei.__param)(1,tl.IFileService),(0,ei.__param)(2,tR.IModelService),(0,ei.__param)(3,eX.ILogService)],t4);var t9=e.i(693162),t8=e.i(155652),t7=e.i(193409),ie=e.i(298140);class it{constructor(){this._states=new WeakMap,this._checkedCount=0,this._onDidChange=new ec.Emitter,this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}get checkedCount(){return this._checkedCount}isChecked(e){return this._states.get(e)??!1}updateChecked(e,t){let i=this._states.get(e);i!==t&&(void 0===i?t&&(this._checkedCount+=1):t?this._checkedCount+=1:this._checkedCount-=1,this._states.set(e,t),this._onDidChange.fire(e))}}class ii{constructor(e,t){this.parent=e,this.textEdit=t}}(i=C||(C={}))[i.TextEdit=1]="TextEdit",i[i.Create=2]="Create",i[i.Delete=4]="Delete",i[i.Rename=8]="Rename";class io{constructor(e,t){this.uri=e,this.parent=t,this.type=0,this.textEdits=[],this.originalEdits=new Map}addEdit(e,t,i){this.type|=t,this.originalEdits.set(e,i),i instanceof ti.ResourceTextEdit?this.textEdits.push(new ii(this,i)):t===C.Rename&&(this.newUri=i.newResource)}needsConfirmation(){for(let[,e]of this.originalEdits)if(!this.parent.checked.isChecked(e))return!0;return!1}}class ir{static{this._defaultMetadata=Object.freeze({label:(0,ev.localize)(4536,"Other"),icon:t8.Codicon.symbolFile,needsConfirmation:!1})}static keyOf(e){return e?.label||"<default>"}constructor(e=ir._defaultMetadata){this.metadata=e,this.operationByResource=new Map}get fileOperations(){return this.operationByResource.values()}}let is=v=class{static async create(e,t){let i=e.get(eD.IInstantiationService).createInstance(v,t);return await i._init()}constructor(e,t,i){this._bulkEdit=e,this._fileService=t,this.checked=new it,this.fileOperations=[],this.categories=[],this.conflicts=i.createInstance(t4,e)}dispose(){this.checked.dispose(),this.conflicts.dispose()}async _init(){let e=new Map,t=new Map,i=new te.ResourceMap;for(let o=0;o<this._bulkEdit.length;o++){let r,s,n=this._bulkEdit[o];if(this.checked.updateChecked(n,!n.metadata?.needsConfirmation),n instanceof ti.ResourceTextEdit)s=C.TextEdit,r=n.resource;else if(!(n instanceof ti.ResourceFileEdit))continue;else if(n.newResource&&n.oldResource){if(s=C.Rename,r=n.oldResource,n.options?.overwrite===void 0&&n.options?.ignoreIfExists&&await this._fileService.exists(r))continue;i.set(n.newResource,r)}else if(n.oldResource){if(s=C.Delete,r=n.oldResource,n.options?.ignoreIfNotExists&&!await this._fileService.exists(r))continue}else if(!n.newResource)continue;else if(s=C.Create,r=n.newResource,n.options?.overwrite===void 0&&n.options?.ignoreIfExists&&await this._fileService.exists(r))continue;let a=(e,t)=>{let r=t9.extUri.getComparisonKey(e,!0),a=t.get(r);!a&&i.has(e)&&(e=i.get(e),r=t9.extUri.getComparisonKey(e,!0),a=t.get(r)),a||(a=new io(e,this),t.set(r,a)),a.addEdit(o,s,n)};a(r,e);let d=ir.keyOf(n.metadata),l=t.get(d);l||(l=new ir(n.metadata),t.set(d,l)),a(r,l.operationByResource)}for(let i of(e.forEach(e=>this.fileOperations.push(e)),t.forEach(e=>this.categories.push(e)),this.fileOperations))if(i.type!==C.TextEdit){let e=!0;for(let t of i.originalEdits.values())t instanceof ti.ResourceFileEdit&&(e=e&&this.checked.isChecked(t));if(!e)for(let t of i.originalEdits.values())this.checked.updateChecked(t,e)}return this.categories.sort((e,t)=>e.metadata.needsConfirmation===t.metadata.needsConfirmation?e.metadata.label.localeCompare(t.metadata.label):e.metadata.needsConfirmation?-1:1),this}getWorkspaceEdit(){let e=[],t=!0;for(let i=0;i<this._bulkEdit.length;i++){let o=this._bulkEdit[i];if(this.checked.isChecked(o)){e[i]=o;continue}t=!1}return t?this._bulkEdit:((0,ea.coalesceInPlace)(e),e)}async getFileEditOperation(e){let t=await e.options.contents;if(t)return tI.EditOperation.replaceMove(tD.Range.lift({startLineNumber:0,startColumn:0,endLineNumber:Number.MAX_VALUE,endColumn:0}),t.toString())}async getFileEdits(e){for(let t of this.fileOperations)if(t.uri.toString()===e.toString()){let e=[],i=!1;for(let o of t.originalEdits.values())o instanceof ti.ResourceFileEdit?e.push(this.getFileEditOperation(o)):o instanceof ti.ResourceTextEdit?this.checked.isChecked(o)&&e.push(Promise.resolve(tI.EditOperation.replaceMove(tD.Range.lift(o.textEdit.range),o.textEdit.insertAsSnippet?tM.SnippetParser.asInsertText(o.textEdit.text):o.textEdit.text))):this.checked.isChecked(o)||(i=!0);if(i)return[];return(await Promise.all(e)).filter(e=>void 0!==e).sort((e,t)=>tD.Range.compareRangesUsingStarts(e.range,t.range))}return[]}getUriOfEdit(e){for(let t of this.fileOperations)for(let i of t.originalEdits.values())if(i===e)return t.uri;throw Error("invalid edit")}};is=v=(0,ei.__decorate)([(0,ei.__param)(1,tl.IFileService),(0,ei.__param)(2,eD.IInstantiationService)],is);let ia=class{static{y=this}static{this.Schema="vscode-bulkeditpreview-editor"}static{this.emptyPreview=e$.URI.from({scheme:this.Schema,fragment:"empty"})}static fromPreviewUri(e){return e$.URI.parse(e.query)}constructor(e,t,i,o){this._operations=e,this._languageService=t,this._modelService=i,this._textModelResolverService=o,this._disposables=new eu.DisposableStore,this._modelPreviewEdits=new Map,this._instanceId=(0,t7.generateUuid)(),this._disposables.add(this._textModelResolverService.registerTextModelContentProvider(y.Schema,this)),this._ready=this._init()}dispose(){this._disposables.dispose()}asPreviewUri(e){let t=e.scheme===tp.Schemas.untitled?`/${e.path}`:e.path;return e$.URI.from({scheme:y.Schema,authority:this._instanceId,path:t,query:e.toString()})}async _init(){for(let e of this._operations.fileOperations)await this._applyTextEditsToPreviewModel(e.uri);this._disposables.add(ec.Event.debounce(this._operations.checked.onDidChange,(e,t)=>t,ie.MicrotaskDelay)(e=>{let t=this._operations.getUriOfEdit(e);this._applyTextEditsToPreviewModel(t)}))}async _applyTextEditsToPreviewModel(e){let t=await this._getOrCreatePreviewModel(e),i=this._modelPreviewEdits.get(t.id);i&&t.applyEdits(i);let o=await this._operations.getFileEdits(e),r=t.applyEdits(o,!0);this._modelPreviewEdits.set(t.id,r)}async _getOrCreatePreviewModel(e){let t=this.asPreviewUri(e),i=this._modelService.getModel(t);if(!i){try{let o=await this._textModelResolverService.createModelReference(e),r=o.object.textEditorModel;i=this._modelService.createModel((0,t6.createTextBufferFactoryFromSnapshot)(r.createSnapshot()),this._languageService.createById(r.getLanguageId()),t),o.dispose()}catch{i=this._modelService.createModel("",this._languageService.createByFilepathOrFirstLine(t),t)}queueMicrotask(async()=>{this._disposables.add(await this._textModelResolverService.createModelReference(i.uri))})}return i}async provideTextContent(e){return e.toString()===y.emptyPreview.toString()?this._modelService.createModel("",null,e):(await this._ready,this._modelService.getModel(e))}};ia=y=(0,ei.__decorate)([(0,ei.__param)(1,t5.ILanguageService),(0,ei.__param)(2,tR.IModelService),(0,ei.__param)(3,tT.ITextModelService)],ia);var id=e.i(546198),il=e.i(916766),ic=e.i(545411),ih=e.i(536367),iu=e.i(693205),ip=e.i(429200),ig=e.i(365808);class im{constructor(e,t){this.parent=e,this.category=t}isChecked(){let e=this.parent,t=!0;for(let i of this.category.fileOperations)for(let o of i.originalEdits.values())t=t&&e.checked.isChecked(o);return t}setChecked(e){let t=this.parent;for(let i of this.category.fileOperations)for(let o of i.originalEdits.values())t.checked.updateChecked(o,e)}}class iv{constructor(e,t){this.parent=e,this.edit=t}isChecked(){let e=this.parent instanceof im?this.parent.parent:this.parent,t=!0;for(let i of(this.edit.type===C.TextEdit&&(t=!this.edit.textEdits.every(t=>!e.checked.isChecked(t.textEdit))),this.edit.originalEdits.values()))i instanceof ti.ResourceFileEdit&&(t=t&&e.checked.isChecked(i));if(this.parent instanceof im&&this.edit.type===C.TextEdit){for(let i of e.categories)for(let o of i.fileOperations)if(o.uri.toString()===this.edit.uri.toString())for(let i of o.originalEdits.values())i instanceof ti.ResourceFileEdit&&(t=t&&e.checked.isChecked(i))}return t}setChecked(e){let t=this.parent instanceof im?this.parent.parent:this.parent;for(let i of this.edit.originalEdits.values())t.checked.updateChecked(i,e);if(this.parent instanceof im&&this.edit.type!==C.TextEdit){for(let i of t.categories)for(let o of i.fileOperations)if(o.uri.toString()===this.edit.uri.toString())for(let i of o.originalEdits.values())t.checked.updateChecked(i,e)}}isDisabled(){if(this.parent instanceof im&&this.edit.type===C.TextEdit){let e=this.parent.parent,t=!0;for(let i of e.categories)for(let o of i.fileOperations)if(o.uri.toString()===this.edit.uri.toString())for(let i of o.originalEdits.values())i instanceof ti.ResourceFileEdit&&(t=t&&e.checked.isChecked(i));return!t}return!1}}class iy{constructor(e,t,i,o,r,s,n){this.parent=e,this.idx=t,this.edit=i,this.prefix=o,this.selecting=r,this.inserting=s,this.suffix=n}isChecked(){let e=this.parent.parent;return e instanceof im&&(e=e.parent),e.checked.isChecked(this.edit.textEdit)}setChecked(e){let t=this.parent.parent;if(t instanceof im&&(t=t.parent),t.checked.updateChecked(this.edit.textEdit,e),e)for(let i of this.parent.edit.originalEdits.values())i instanceof ti.ResourceFileEdit&&t.checked.updateChecked(i,e)}isDisabled(){return this.parent.isDisabled()}}let iC=class{constructor(e,t){this._textModelService=e,this._instantiationService=t,this.groupByFile=!0}hasChildren(e){return e instanceof iv?e.edit.textEdits.length>0:!(e instanceof iy)}async getChildren(e){if(e instanceof is)return this.groupByFile?e.fileOperations.map(t=>new iv(e,t)):e.categories.map(t=>new im(e,t));if(e instanceof im)return Array.from(e.category.fileOperations,t=>new iv(e,t));if(e instanceof iv&&e.edit.textEdits.length>0){let t,i;try{let o=await this._textModelService.createModelReference(e.edit.uri);t=o.object.textEditorModel,i=o}catch{i=t=this._instantiationService.createInstance(t6.TextModel,"",ip.PLAINTEXT_LANGUAGE_ID,t6.TextModel.DEFAULT_CREATION_OPTIONS,null)}let o=e.edit.textEdits.map((i,o)=>{let r=t.validateRange(i.textEdit.textEdit.range),s=t.tokenization.getLineTokens(r.startLineNumber),n=23;for(let e=s.findTokenIndexAtOffset(r.startColumn-1)-1;n<50&&e>=0;e--)n=r.startColumn-s.getStartOffset(e);let a=t.tokenization.getLineTokens(r.endLineNumber),d=0;for(let e=a.findTokenIndexAtOffset(r.endColumn-1);d<50&&e<a.getCount();e++)d+=a.getEndOffset(e)-a.getStartOffset(e);return new iy(e,o,i,t.getValueInRange(new tD.Range(r.startLineNumber,r.startColumn-n,r.startLineNumber,r.startColumn)),t.getValueInRange(r),!i.textEdit.textEdit.insertAsSnippet?i.textEdit.textEdit.text:tM.SnippetParser.asInsertText(i.textEdit.textEdit.text),t.getValueInRange(new tD.Range(r.endLineNumber,r.endColumn,r.endLineNumber,r.endColumn+d)))});return i.dispose(),o}return[]}};iC=(0,ei.__decorate)([(0,ei.__param)(0,tT.ITextModelService),(0,ei.__param)(1,eD.IInstantiationService)],iC);class ib{compare(e,t){return e instanceof iv&&t instanceof iv?iw(e.edit,t.edit):e instanceof iy&&t instanceof iy?tD.Range.compareRangesUsingStarts(e.edit.textEdit.textEdit.range,t.edit.textEdit.textEdit.range):0}}function iw(e,t){return(0,iu.compare)(e.uri.toString(),t.uri.toString())}let iS=class{constructor(e){this._labelService=e}getWidgetAriaLabel(){return(0,ev.localize)(4537,"Bulk Edit")}getRole(e){return"checkbox"}getAriaLabel(e){if(e instanceof iv){if(e.edit.textEdits.length>0)if(e.edit.type&C.Rename&&e.edit.newUri)return(0,ev.localize)(4538,"Renaming {0} to {1}, also making text edits",this._labelService.getUriLabel(e.edit.uri,{relative:!0}),this._labelService.getUriLabel(e.edit.newUri,{relative:!0}));else if(e.edit.type&C.Create)return(0,ev.localize)(4539,"Creating {0}, also making text edits",this._labelService.getUriLabel(e.edit.uri,{relative:!0}));else if(e.edit.type&C.Delete)return(0,ev.localize)(4540,"Deleting {0}, also making text edits",this._labelService.getUriLabel(e.edit.uri,{relative:!0}));else return(0,ev.localize)(4541,"{0}, making text edits",this._labelService.getUriLabel(e.edit.uri,{relative:!0}));else if(e.edit.type&C.Rename&&e.edit.newUri)return(0,ev.localize)(4542,"Renaming {0} to {1}",this._labelService.getUriLabel(e.edit.uri,{relative:!0}),this._labelService.getUriLabel(e.edit.newUri,{relative:!0}));else if(e.edit.type&C.Create)return(0,ev.localize)(4543,"Creating {0}",this._labelService.getUriLabel(e.edit.uri,{relative:!0}));else if(e.edit.type&C.Delete)return(0,ev.localize)(4544,"Deleting {0}",this._labelService.getUriLabel(e.edit.uri,{relative:!0}))}if(e instanceof iy){if(e.selecting.length>0&&e.inserting.length>0)return(0,ev.localize)(4545,"line {0}, replacing {1} with {2}",e.edit.textEdit.textEdit.range.startLineNumber,e.selecting,e.inserting);else if(e.selecting.length>0&&0===e.inserting.length)return(0,ev.localize)(4546,"line {0}, removing {1}",e.edit.textEdit.textEdit.range.startLineNumber,e.selecting);else if(0===e.selecting.length&&e.inserting.length>0)return(0,ev.localize)(4547,"line {0}, inserting {1}",e.edit.textEdit.textEdit.range.startLineNumber,e.selecting)}return null}};iS=(0,ei.__decorate)([(0,ei.__param)(0,tJ.ILabelService)],iS);class i_{getId(e){return e instanceof iv?e.edit.uri+(e.parent instanceof im?JSON.stringify(e.parent.category.metadata):""):e instanceof iy?e.parent.edit.uri.toString()+e.idx:JSON.stringify(e.category.metadata)}}class iE{constructor(e){e.classList.add("category"),this.icon=(0,er.createElement)("div"),e.appendChild(this.icon),this.label=new ic.IconLabel(e)}}let iI=class{static{b=this}static{this.id="CategoryElementRenderer"}constructor(e){this._themeService=e,this.templateId=b.id}renderTemplate(e){return new iE(e)}renderElement(e,t,i){i.icon.style.setProperty("--background-dark",null),i.icon.style.setProperty("--background-light",null),i.icon.style.color="";let{metadata:o}=e.element.category;if(ih.ThemeIcon.isThemeIcon(o.iconPath)){let e=ih.ThemeIcon.asClassName(o.iconPath);i.icon.className=e?`theme-icon ${e}`:"",i.icon.style.color=o.iconPath.color?this._themeService.getColorTheme().getColor(o.iconPath.color.id)?.toString()??"":""}else e$.URI.isUri(o.iconPath)?(i.icon.className="uri-icon",i.icon.style.setProperty("--background-dark",(0,ig.asCSSUrl)(o.iconPath)),i.icon.style.setProperty("--background-light",(0,ig.asCSSUrl)(o.iconPath))):o.iconPath&&(i.icon.className="uri-icon",i.icon.style.setProperty("--background-dark",(0,ig.asCSSUrl)(o.iconPath.dark)),i.icon.style.setProperty("--background-light",(0,ig.asCSSUrl)(o.iconPath.light)));i.label.setLabel(o.label,o.description,{descriptionMatches:(0,id.createMatches)(e.filterData)})}disposeTemplate(e){e.label.dispose()}};iI=b=(0,ei.__decorate)([(0,ei.__param)(0,eW.IThemeService)],iI);let iD=class{constructor(e,t,i){this._labelService=i,this._disposables=new eu.DisposableStore,this._localDisposables=new eu.DisposableStore,this._checkbox=(0,er.createElement)("input"),this._checkbox.className="edit-checkbox",this._checkbox.type="checkbox",this._checkbox.setAttribute("role","checkbox"),e.appendChild(this._checkbox),this._label=t.create(e,{supportHighlights:!0}),this._details=(0,er.createElement)("span"),this._details.className="details",e.appendChild(this._details)}dispose(){this._localDisposables.dispose(),this._disposables.dispose(),this._label.dispose()}set(e,t){if(this._localDisposables.clear(),this._checkbox.checked=e.isChecked(),this._checkbox.disabled=e.isDisabled(),this._localDisposables.add((0,er.addDisposableListener)(this._checkbox,"change",()=>{e.setChecked(this._checkbox.checked)})),e.edit.type&C.Rename&&e.edit.newUri)this._label.setResource({resource:e.edit.uri,name:(0,ev.localize)(4548,"{0} → {1}",this._labelService.getUriLabel(e.edit.uri,{relative:!0}),this._labelService.getUriLabel(e.edit.newUri,{relative:!0}))},{fileDecorations:{colors:!0,badges:!1}}),this._details.innerText=(0,ev.localize)(4549,"(renaming)");else{let i={matches:(0,id.createMatches)(t),fileKind:td.FileKind.FILE,fileDecorations:{colors:!0,badges:!1},extraClasses:[]};e.edit.type&C.Create?this._details.innerText=(0,ev.localize)(4550,"(creating)"):e.edit.type&C.Delete?(this._details.innerText=(0,ev.localize)(4551,"(deleting)"),i.extraClasses.push("delete")):this._details.innerText="",this._label.setFile(e.edit.uri,i)}}};iD=(0,ei.__decorate)([(0,ei.__param)(2,tJ.ILabelService)],iD);let iT=class{static{w=this}static{this.id="FileElementRenderer"}constructor(e,t){this._resourceLabels=e,this._labelService=t,this.templateId=w.id}renderTemplate(e){return new iD(e,this._resourceLabels,this._labelService)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}};iT=w=(0,ei.__decorate)([(0,ei.__param)(1,tJ.ILabelService)],iT);let iA=class{constructor(e,t){this._themeService=t,this._disposables=new eu.DisposableStore,this._localDisposables=new eu.DisposableStore,e.classList.add("textedit"),this._checkbox=(0,er.createElement)("input"),this._checkbox.className="edit-checkbox",this._checkbox.type="checkbox",this._checkbox.setAttribute("role","checkbox"),e.appendChild(this._checkbox),this._icon=(0,er.createElement)("div"),e.appendChild(this._icon),this._label=this._disposables.add(new il.HighlightedLabel(e))}dispose(){this._localDisposables.dispose(),this._disposables.dispose()}set(e){let t;this._localDisposables.clear(),this._localDisposables.add((0,er.addDisposableListener)(this._checkbox,"change",t=>{e.setChecked(this._checkbox.checked),t.preventDefault()})),e.parent.isChecked(),this._checkbox.checked=e.isChecked(),this._checkbox.disabled=e.isDisabled();let i="";i+=e.prefix,i+=e.selecting,i+=e.inserting,i+=e.suffix;let o={start:e.prefix.length,end:e.prefix.length+e.selecting.length,extraClasses:["remove"]},r={start:o.end,end:o.end+e.inserting.length,extraClasses:["insert"]},{metadata:s}=e.edit.textEdit;s&&s.description?t=(0,ev.localize)(4552,"{0} - {1}",s.label,s.description):s&&(t=s.label);let n=s?.iconPath;if(n)if(this._icon.style.display="block",this._icon.style.setProperty("--background-dark",null),this._icon.style.setProperty("--background-light",null),ih.ThemeIcon.isThemeIcon(n)){let e=ih.ThemeIcon.asClassName(n);this._icon.className=e?`theme-icon ${e}`:"",this._icon.style.color=n.color?this._themeService.getColorTheme().getColor(n.color.id)?.toString()??"":""}else e$.URI.isUri(n)?(this._icon.className="uri-icon",this._icon.style.setProperty("--background-dark",(0,ig.asCSSUrl)(n)),this._icon.style.setProperty("--background-light",(0,ig.asCSSUrl)(n))):(this._icon.className="uri-icon",this._icon.style.setProperty("--background-dark",(0,ig.asCSSUrl)(n.dark)),this._icon.style.setProperty("--background-light",(0,ig.asCSSUrl)(n.light)));else this._icon.style.display="none";this._label.set(i,[o,r],t,!0),this._icon.title=t||""}};iA=(0,ei.__decorate)([(0,ei.__param)(1,eW.IThemeService)],iA);let ix=class{static{f=this}static{this.id="TextEditElementRenderer"}constructor(e){this._themeService=e,this.templateId=f.id}renderTemplate(e){return new iA(e,this._themeService)}renderElement({element:e},t,i){i.set(e)}disposeTemplate(e){}};ix=f=(0,ei.__decorate)([(0,ei.__param)(0,eW.IThemeService)],ix);class iR{getHeight(){return 23}getTemplateId(e){return e instanceof iv?iT.id:e instanceof iy?ix.id:iI.id}}class ik{getKeyboardNavigationLabel(e){return e instanceof iv?(0,t9.basename)(e.edit.uri):e instanceof im?e.category.metadata.label:void 0}}var iM=e.i(589377);(0,t$.registerCss)(void 0),(o=_||(_={})).Data="data",o.Message="message";let iL=class extends t3.ViewPane{static{S=this}static{this.ID="refactorPreview"}static{this.Schema="vscode-bulkeditpreview-multieditor"}static{this.ctxHasCategories=new eV.RawContextKey("refactorPreview.hasCategories",!1)}static{this.ctxGroupByFile=new eV.RawContextKey("refactorPreview.groupByFile",!0)}static{this.ctxHasCheckedChanges=new eV.RawContextKey("refactorPreview.hasCheckedChanges",!0)}static{this._memGroupByFile=`${this.ID}.groupByFile`}constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p,g,m){super({...e,titleMenuId:eG.MenuId.BulkEditTitle},c,h,u,d,l,t,p,g,m),this._instaService=t,this._editorService=i,this._labelService=o,this._textModelService=r,this._dialogService=s,this._contextMenuService=n,this._storageService=a,this._treeViewStates=new Map,this._disposables=new eu.DisposableStore,this._sessionDisposables=new eu.DisposableStore,this._computeResourceDiffEditorInputs=new tY.LRUCachedFunction(async e=>{let t=new tY.CachedFunction(async e=>{let t=e.uri,i=this._currentProvider.asPreviewUri(t);if(e.type&C.Delete)return{original:{resource:e$.URI.revive(i)},modified:{resource:void 0},goToFileResource:e.uri};{let e;try{(await this._textModelService.createModelReference(t)).dispose(),e=t}catch{e=ia.emptyPreview}return{original:{resource:e$.URI.revive(e)},modified:{resource:e$.URI.revive(i)},goToFileResource:e}}}),i=e.slice().sort(iw),o=[];for(let e of i)o.push(await t.get(e));return{resources:o,getResourceDiffEditorInputIdOfOperation:async e=>{let i=await t.get(e);return{original:i.original.resource,modified:i.modified.resource}}}}),this.element.classList.add("bulk-edit-panel","show-file-icons"),this._ctxHasCategories=S.ctxHasCategories.bindTo(d),this._ctxGroupByFile=S.ctxGroupByFile.bindTo(d),this._ctxHasCheckedChanges=S.ctxHasCheckedChanges.bindTo(d)}dispose(){this._tree.dispose(),this._disposables.dispose(),super.dispose()}renderBody(e){super.renderBody(e);let t=this._instaService.createInstance(t2.ResourceLabels,{onDidChangeVisibility:this.onDidChangeBodyVisibility});this._disposables.add(t);let i=(0,er.createElement)("div");i.className="content",e.appendChild(i);let o=(0,er.createElement)("div");i.appendChild(o),this._treeDataSource=this._instaService.createInstance(iC),this._treeDataSource.groupByFile=this._storageService.getBoolean(S._memGroupByFile,t0.StorageScope.PROFILE,!0),this._ctxGroupByFile.set(this._treeDataSource.groupByFile),this._tree=this._instaService.createInstance(tZ.WorkbenchAsyncDataTree,this.id,o,new iR,[this._instaService.createInstance(ix),this._instaService.createInstance(iT,t),this._instaService.createInstance(iI)],this._treeDataSource,{accessibilityProvider:this._instaService.createInstance(iS),identityProvider:new i_,expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,keyboardNavigationLabelProvider:new ik,sorter:new ib,selectionNavigation:!0}),this._disposables.add(this._tree.onContextMenu(this._onContextMenu,this)),this._disposables.add(this._tree.onDidOpen(e=>this._openElementInMultiDiffEditor(e)));let r=(0,er.createElement)("div");r.className="buttons",i.appendChild(r);let s=new tq.ButtonBar(r);this._disposables.add(s);let n=s.addButton({supportIcons:!0,...t1.defaultButtonStyles});n.label=(0,ev.localize)(4531,"Apply"),n.onDidClick(()=>this.accept(),this,this._disposables);let a=s.addButton({...t1.defaultButtonStyles,secondary:!0});a.label=(0,ev.localize)(4532,"Discard"),a.onDidClick(()=>this.discard(),this,this._disposables),this._message=(0,er.createElement)("span"),this._message.className="message",this._message.innerText=(0,ev.localize)(4533,"Invoke a code action, like rename, to see a preview of its changes here."),e.appendChild(this._message),this._setState(_.Message)}layoutBody(e,t){super.layoutBody(e,t);let i=e-50;this._tree.getHTMLElement().parentElement.style.height=`${i}px`,this._tree.layout(i,t)}_setState(e){this.element.dataset.state=e}async setInput(e,t){this._setState(_.Data),this._sessionDisposables.clear(),this._treeViewStates.clear(),this._currentResolve&&(this._currentResolve(void 0),this._currentResolve=void 0);let i=await this._instaService.invokeFunction(is.create,e);this._currentProvider=this._instaService.createInstance(ia,i),this._sessionDisposables.add(this._currentProvider),this._sessionDisposables.add(i);let o=i.categories.length>1;return this._ctxHasCategories.set(o),this._treeDataSource.groupByFile=!o||this._treeDataSource.groupByFile,this._ctxHasCheckedChanges.set(i.checked.checkedCount>0),this._currentInput=i,new Promise(e=>{t.onCancellationRequested(()=>e(void 0)),this._currentResolve=e,this._setTreeInput(i),this._sessionDisposables.add(i.checked.onDidChange(()=>{this._tree.updateChildren(),this._ctxHasCheckedChanges.set(i.checked.checkedCount>0)}))})}hasInput(){return!!this._currentInput}async _setTreeInput(e){let t=this._treeViewStates.get(this._treeDataSource.groupByFile);if(await this._tree.setInput(e,t),this._tree.domFocus(),t)return;let i=[...this._tree.getNode(e).children].slice(0,10);for(;i.length>0;){let{element:e}=i.shift();e instanceof iv&&await this._tree.expand(e,!0),e instanceof im&&(await this._tree.expand(e,!0),i.push(...this._tree.getNode(e).children))}}accept(){let e,t=this._currentInput?.conflicts.list();t&&0!==t.length?(e=1===t.length?(0,ev.localize)(4534,"Cannot apply refactoring because '{0}' has changed in the meantime.",this._labelService.getUriLabel(t[0],{relative:!0})):(0,ev.localize)(4535,"Cannot apply refactoring because {0} other files have changed in the meantime.",t.length),this._dialogService.warn(e).finally(()=>this._done(!1))):this._done(!0)}discard(){this._done(!1)}_done(e){this._currentResolve?.(e?this._currentInput?.getWorkspaceEdit():void 0),this._currentInput=void 0,this._setState(_.Message),this._sessionDisposables.clear()}toggleChecked(){let[e]=this._tree.getFocus();(e instanceof iv||e instanceof iy)&&!e.isDisabled()?e.setChecked(!e.isChecked()):e instanceof im&&e.setChecked(!e.isChecked())}groupByFile(){this._treeDataSource.groupByFile||this.toggleGrouping()}groupByType(){this._treeDataSource.groupByFile&&this.toggleGrouping()}toggleGrouping(){let e=this._tree.getInput();if(e){let t=this._tree.getViewState();this._treeViewStates.set(this._treeDataSource.groupByFile,t),this._treeDataSource.groupByFile=!this._treeDataSource.groupByFile,this._setTreeInput(e),this._storageService.store(S._memGroupByFile,this._treeDataSource.groupByFile,t0.StorageScope.PROFILE,t0.StorageTarget.USER),this._ctxGroupByFile.set(this._treeDataSource.groupByFile)}}async _openElementInMultiDiffEditor(e){let t,i,o=this._currentInput?.fileOperations;if(!o)return;if(e.element instanceof iy)t=e.element.parent,i=e.element.edit.textEdit.textEdit.range;else{if(!(e.element instanceof iv))return;t=e.element,i=e.element.edit.textEdits[0]?.textEdit.textEdit.range}let r=await this._computeResourceDiffEditorInputs.get(o),s=await r.getResourceDiffEditorInputIdOfOperation(t.edit),n={...e.editorOptions,viewState:{revealData:{resource:s,range:i}}},a=e$.URI.from({scheme:S.Schema}),d="Refactor Preview";this._editorService.openEditor({multiDiffSource:a,label:d,options:n,isTransient:!0,description:d,resources:r.resources},e.sideBySide?iM.SIDE_GROUP:iM.ACTIVE_GROUP)}_onContextMenu(e){this._contextMenuService.showContextMenu({menuId:eG.MenuId.BulkEditContext,contextKeyService:this.contextKeyService,getAnchor:()=>e.anchor})}};iL=S=(0,ei.__decorate)([(0,ei.__param)(1,eD.IInstantiationService),(0,ei.__param)(2,eQ.IEditorService),(0,ei.__param)(3,tJ.ILabelService),(0,ei.__param)(4,tT.ITextModelService),(0,ei.__param)(5,eb.IDialogService),(0,ei.__param)(6,eC.IContextMenuService),(0,ei.__param)(7,eP.IStorageService),(0,ei.__param)(8,eK.IContextKeyService),(0,ei.__param)(9,eM.IViewDescriptorService),(0,ei.__param)(10,tX.IKeybindingService),(0,ei.__param)(11,eC.IContextMenuService),(0,ei.__param)(12,ey.IConfigurationService),(0,ei.__param)(13,tQ.IOpenerService),(0,ei.__param)(14,eW.IThemeService),(0,ei.__param)(15,tj.IHoverService)],iL);var iO=e.i(83823),iP=eG,iV=e.i(193391),iK=e.i(321012);async function iN(e){let t=await e.openView(iL.ID,!0);if(t instanceof iL)return t}let iG=class{constructor(e,t){this._paneCompositeService=e,this._editorGroupsService=t,this._activePanel=e.getActivePaneComposite(ek.ViewContainerLocation.Panel)?.getId()}async restore(e,t){if(e&&("string"==typeof this._activePanel?await this._paneCompositeService.openPaneComposite(this._activePanel,ek.ViewContainerLocation.Panel):this._paneCompositeService.hideActivePaneComposite(ek.ViewContainerLocation.Panel)),t)for(let e of this._editorGroupsService.groups){let t=[];for(let i of e.editors){let e=iV.EditorResourceAccessor.getCanonicalUri(i,{supportSideBySide:iV.SideBySideEditor.PRIMARY});e?.scheme===iL.Schema&&t.push(i)}t.length&&e.closeEditors(t,{preserveFocus:!0})}}};iG=(0,ei.__decorate)([(0,ei.__param)(0,eZ.IPaneCompositePartService),(0,ei.__param)(1,eY.IEditorGroupsService)],iG);class iF{constructor(e,t=new e8.CancellationTokenSource){this.uxState=e,this.cts=t}}let iW=class{static{E=this}static{this.ID="workbench.contrib.bulkEditPreview"}static{this.ctxEnabled=new eV.RawContextKey("refactorPreview.enabled",!1)}constructor(e,t,i,o,r,s){this._paneCompositeService=e,this._viewsService=t,this._editorGroupsService=i,this._dialogService=o,r.setPreviewHandler(e=>this._previewEdit(e)),this._ctxEnabled=E.ctxEnabled.bindTo(s)}async _previewEdit(e){let t;this._ctxEnabled.set(!0);let i=this._activeSession?.uxState??new iG(this._paneCompositeService,this._editorGroupsService),o=await iN(this._viewsService);if(!o)return this._ctxEnabled.set(!1),e;if(o.hasInput()){let{confirmed:e}=await this._dialogService.confirm({type:em.default.Info,message:(0,ev.localize)(4520,"Another refactoring is being previewed."),detail:(0,ev.localize)(4521,"Press 'Continue' to discard the previous refactoring and continue with the current refactoring."),primaryButton:(0,ev.localize)(4522,"&&Continue")});if(!e)return[]}this._activeSession&&(await this._activeSession.uxState.restore(!1,!0),this._activeSession.cts.dispose(!0)),t=new iF(i),this._activeSession=t;try{return await o.setInput(e,t.cts.token)??[]}finally{this._activeSession===t&&(await this._activeSession.uxState.restore(!0,!0),this._activeSession.cts.dispose(),this._ctxEnabled.set(!1),this._activeSession=void 0)}}};iW=E=(0,ei.__decorate)([(0,ei.__param)(0,eZ.IPaneCompositePartService),(0,ei.__param)(1,e0.IViewsService),(0,ei.__param)(2,eY.IEditorGroupsService),(0,ei.__param)(3,eb.IDialogService),(0,ei.__param)(4,e9.IBulkEditService),(0,ei.__param)(5,eK.IContextKeyService)],iW),(0,iP.registerAction2)(class extends iP.Action2{constructor(){super({id:"refactorPreview.apply",title:(0,ev.localize2)(4523,"Apply Refactoring"),category:(0,ev.localize2)(4524,"Refactor Preview"),icon:t8.Codicon.check,precondition:eV.ContextKeyExpr.and(iW.ctxEnabled,iL.ctxHasCheckedChanges),menu:[{id:iP.MenuId.BulkEditContext,order:1}],keybinding:{weight:eF.KeybindingWeight.EditorContrib-10,when:eV.ContextKeyExpr.and(iW.ctxEnabled,eL.FocusedViewContext.isEqualTo(iL.ID)),primary:iO.KeyMod.CtrlCmd+iO.KeyCode.Enter}})}async run(e){let t=e.get(e0.IViewsService),i=await iN(t);i?.accept()}}),(0,iP.registerAction2)(class extends iP.Action2{constructor(){super({id:"refactorPreview.discard",title:(0,ev.localize2)(4525,"Discard Refactoring"),category:(0,ev.localize2)(4524,"Refactor Preview"),icon:t8.Codicon.clearAll,precondition:iW.ctxEnabled,menu:[{id:iP.MenuId.BulkEditContext,order:2}]})}async run(e){let t=e.get(e0.IViewsService),i=await iN(t);i?.discard()}}),(0,iP.registerAction2)(class extends iP.Action2{constructor(){super({id:"refactorPreview.toggleCheckedState",title:(0,ev.localize2)(4526,"Toggle Change"),category:(0,ev.localize2)(4524,"Refactor Preview"),precondition:iW.ctxEnabled,keybinding:{weight:eF.KeybindingWeight.WorkbenchContrib,when:tZ.WorkbenchListFocusContextKey,primary:iO.KeyCode.Space},menu:{id:iP.MenuId.BulkEditContext,group:"navigation"}})}async run(e){let t=e.get(e0.IViewsService),i=await iN(t);i?.toggleChecked()}}),(0,iP.registerAction2)(class extends iP.Action2{constructor(){super({id:"refactorPreview.groupByFile",title:(0,ev.localize2)(4527,"Group Changes By File"),category:(0,ev.localize2)(4524,"Refactor Preview"),icon:t8.Codicon.ungroupByRefType,precondition:eV.ContextKeyExpr.and(iL.ctxHasCategories,iL.ctxGroupByFile.negate(),iW.ctxEnabled),menu:[{id:iP.MenuId.BulkEditTitle,when:eV.ContextKeyExpr.and(iL.ctxHasCategories,iL.ctxGroupByFile.negate()),group:"navigation",order:3}]})}async run(e){let t=e.get(e0.IViewsService),i=await iN(t);i?.groupByFile()}}),(0,iP.registerAction2)(class extends iP.Action2{constructor(){super({id:"refactorPreview.groupByType",title:(0,ev.localize2)(4528,"Group Changes By Type"),category:(0,ev.localize2)(4524,"Refactor Preview"),icon:t8.Codicon.groupByRefType,precondition:eV.ContextKeyExpr.and(iL.ctxHasCategories,iL.ctxGroupByFile,iW.ctxEnabled),menu:[{id:iP.MenuId.BulkEditTitle,when:eV.ContextKeyExpr.and(iL.ctxHasCategories,iL.ctxGroupByFile),group:"navigation",order:3}]})}async run(e){let t=e.get(e0.IViewsService),i=await iN(t);i?.groupByType()}}),(0,iP.registerAction2)(class extends iP.Action2{constructor(){super({id:"refactorPreview.toggleGrouping",title:(0,ev.localize2)(4528,"Group Changes By Type"),category:(0,ev.localize2)(4524,"Refactor Preview"),icon:t8.Codicon.listTree,toggled:iL.ctxGroupByFile.negate(),precondition:eV.ContextKeyExpr.and(iL.ctxHasCategories,iW.ctxEnabled),menu:[{id:iP.MenuId.BulkEditContext,order:3}]})}async run(e){let t=e.get(e0.IViewsService),i=await iN(t);i?.toggleGrouping()}}),(0,tH.registerWorkbenchContribution2)(iW.ID,iW,tH.WorkbenchPhase.BlockRestore);let iz=(0,iK.registerIcon)("refactor-preview-view-icon",t8.Codicon.lightbulb,(0,ev.localize)(4529,"View icon of the refactor preview view.")),iB=eO.Registry.as(ek.Extensions.ViewContainersRegistry).registerViewContainer({id:iL.ID,title:(0,ev.localize2)(4530,"Refactor Preview"),hideIfEmpty:!0,ctorDescriptor:new e4.SyncDescriptor(ej.ViewPaneContainer,[iL.ID,{mergeViewWithContainerWhenSingleView:!0}]),icon:iz,storageId:iL.ID},ek.ViewContainerLocation.Panel);eO.Registry.as(ek.Extensions.ViewsRegistry).registerViews([{id:iL.ID,name:(0,ev.localize2)(4530,"Refactor Preview"),when:iW.ctxEnabled,ctorDescriptor:new e4.SyncDescriptor(iL),containerIcon:iz}],iB),e.s(["default",0,function(){return{[e9.IBulkEditService.toString()]:new e4.SyncDescriptor(tB,[],!0)}}],218532);var iU=e.i(709715),iH=tZ,i$=e.i(600345),iq=e.i(976098),iY=e.i(440049),ij=e.i(98342),iX=e.i(388064),iJ=e.i(144881),iZ=e.i(22148),iQ=e.i(94361),i0=e.i(2301),i1=e.i(772649);class i2{constructor(e,t,i,o){this.item=e,this.locations=t,this.model=i,this.parent=o}static compare(e,t){let i=(0,iu.compare)(e.item.uri.toString(),t.item.uri.toString());return 0===i&&(i=tD.Range.compareRangesUsingStarts(e.item.range,t.item.range)),i}}class i3{constructor(e){this.getDirection=e}hasChildren(){return!0}async getChildren(e){if(e instanceof iU.CallHierarchyModel)return e.roots.map(t=>new i2(t,void 0,e,void 0));let{model:t,item:i}=e;return this.getDirection()===iU.CallHierarchyDirection.CallsFrom?(await t.resolveOutgoingCalls(i,e8.CancellationToken.None)).map(o=>new i2(o.to,o.fromRanges.map(e=>({range:e,uri:i.uri})),t,e)):(await t.resolveIncomingCalls(i,e8.CancellationToken.None)).map(i=>new i2(i.from,i.fromRanges.map(e=>({range:e,uri:i.from.uri})),t,e))}}class i5{compare(e,t){return i2.compare(e,t)}}class i6{constructor(e){this.getDirection=e}getId(e){let t=this.getDirection()+JSON.stringify(e.item.uri)+JSON.stringify(e.item.range);return e.parent&&(t+=this.getId(e.parent)),t}}class i4{constructor(e,t){this.icon=e,this.label=t}}class i9{constructor(){this.templateId=i9.id}static{this.id="CallRenderer"}renderTemplate(e){e.classList.add("callhierarchy-element");let t=(0,er.createElement)("div");return e.appendChild(t),new i4(t,new ic.IconLabel(e,{supportHighlights:!0}))}renderElement(e,t,i){let{element:o,filterData:r}=e,s=o.item.tags?.includes(i1.SymbolTag.Deprecated);i.icon.className="",i.icon.classList.add("inline",...ih.ThemeIcon.asClassNameArray(i1.SymbolKinds.toIcon(o.item.kind))),i.label.setLabel(o.item.name,o.item.detail,{labelEscapeNewLines:!0,matches:(0,id.createMatches)(r),strikethrough:s})}disposeTemplate(e){e.label.dispose()}}class i8{getHeight(e){return 22}getTemplateId(e){return i9.id}}class i7{constructor(e){this.getDirection=e}getWidgetAriaLabel(){return(0,ev.localize)(4570,"Call Hierarchy")}getAriaLabel(e){return this.getDirection()===iU.CallHierarchyDirection.CallsFrom?(0,ev.localize)(4571,"calls from {0}",e.item.name):(0,ev.localize)(4572,"callers of {0}",e.item.name)}}var oe=e.i(696826),ot=e.i(378322),oi=e.i(430807);(0,t$.registerCss)(void 0),(r=D||(D={})).Loading="loading",r.Message="message",r.Data="data";class oo{static store(e,t){t.store("callHierarchyPeekLayout",JSON.stringify(e),t0.StorageScope.PROFILE,t0.StorageTarget.MACHINE)}static retrieve(e){let t=e.get("callHierarchyPeekLayout",t0.StorageScope.PROFILE,"{}"),i={ratio:.7,height:17};try{return{...i,...JSON.parse(t)}}catch{return i}}constructor(e,t){this.ratio=e,this.height=t}}class or extends iH.WorkbenchAsyncDataTree{}let os=class extends oe.PeekViewWidget{static{I=this}static{this.TitleMenu=new eG.MenuId("callhierarchy/title")}constructor(e,t,i,o,r,s,n,a,d,l,c){super(e,{showFrame:!0,showArrow:!0,isResizeable:!0,isAccessible:!0},c),this._where=t,this._direction=i,this._peekViewService=r,this._editorService=s,this._textModelService=n,this._storageService=a,this._menuService=d,this._contextKeyService=l,this._instantiationService=c,this._treeViewStates=new Map,this._previewDisposable=new eu.DisposableStore,this.create(),this._peekViewService.addExclusiveWidget(e,this),this._applyTheme(o.getColorTheme()),this._disposables.add(o.onDidColorThemeChange(this._applyTheme,this)),this._disposables.add(this._previewDisposable)}dispose(){oo.store(this._layoutInfo,this._storageService),this._splitView.dispose(),this._tree.dispose(),this._editor.dispose(),super.dispose()}get direction(){return this._direction}_applyTheme(e){let t=e.getColor(oe.peekViewBorder)||iJ.Color.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(oe.peekViewTitleBackground)||iJ.Color.transparent,primaryHeadingColor:e.getColor(oe.peekViewTitleForeground),secondaryHeadingColor:e.getColor(oe.peekViewTitleInfoForeground)})}_fillHead(e){super._fillHead(e,!0);let t=this._menuService.createMenu(I.TitleMenu,this._contextKeyService),i=()=>{let e=(0,i0.getFlatActionBarActions)(t.getActions());this._actionbarWidget.clear(),this._actionbarWidget.push(e,{label:!1,icon:!0})};this._disposables.add(t),this._disposables.add(t.onDidChange(i)),i()}_fillBody(e){this._layoutInfo=oo.retrieve(this._storageService),this._dim=new er.Dimension(0,0),this._parent=e,e.classList.add("call-hierarchy");let t=(0,er.createElement)("div");t.classList.add("message"),e.appendChild(t),this._message=t,this._message.tabIndex=0;let i=(0,er.createElement)("div");i.classList.add("results"),e.appendChild(i),this._splitView=new iq.SplitView(i,{orientation:oi.Orientation.HORIZONTAL});let o=(0,er.createElement)("div");o.classList.add("editor"),i.appendChild(o),this._editor=this._instantiationService.createInstance(iY.EmbeddedCodeEditorWidget,o,{scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}},{},this.editor);let r=(0,er.createElement)("div");r.classList.add("tree"),i.appendChild(r);let s={sorter:new i5,accessibilityProvider:new i7(()=>this._direction),identityProvider:new i6(()=>this._direction),expandOnlyOnTwistieClick:!0,overrideStyles:{listBackground:oe.peekViewResultsBackground}};this._tree=this._instantiationService.createInstance(or,"CallHierarchyPeek",r,new i8,[this._instantiationService.createInstance(i9)],this._instantiationService.createInstance(i3,()=>this._direction),s),this._splitView.addView({onDidChange:ec.Event.None,element:o,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:e=>{this._dim.height&&this._editor.layout({height:this._dim.height,width:e})}},iq.Sizing.Distribute),this._splitView.addView({onDidChange:ec.Event.None,element:r,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:e=>{this._dim.height&&this._tree.layout(this._dim.height,e)}},iq.Sizing.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this._layoutInfo.ratio=this._splitView.getViewSize(0)/this._dim.width)})),this._disposables.add(this._tree.onDidChangeFocus(this._updatePreview,this)),this._disposables.add(this._editor.onMouseDown(e=>{let{event:t,target:i}=e;if(2!==t.detail)return;let[o]=this._tree.getFocus();o&&(this.dispose(),this._editorService.openEditor({resource:o.item.uri,options:{selection:i.range}}))})),this._disposables.add(this._tree.onMouseDblClick(e=>{e.target!==iZ.TreeMouseEventTarget.Twistie&&e.element&&(this.dispose(),this._editorService.openEditor({resource:e.element.item.uri,options:{selection:e.element.item.selectionRange,pinned:!0}}))})),this._disposables.add(this._tree.onDidChangeSelection(e=>{let[t]=e.elements;t&&(0,er.isKeyboardEvent)(e.browserEvent)&&(this.dispose(),this._editorService.openEditor({resource:t.item.uri,options:{selection:t.item.selectionRange,pinned:!0}}))}))}async _updatePreview(){let e,t,[i]=this._tree.getFocus();if(!i)return;this._previewDisposable.clear();let o={description:"call-hierarchy-decoration",stickiness:ij.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,className:"call-decoration",overviewRuler:{color:(0,iX.themeColorFromId)(oe.peekViewEditorMatchHighlight),position:ij.OverviewRulerLane.Center}};e=this._direction===iU.CallHierarchyDirection.CallsFrom?i.parent?i.parent.item.uri:i.model.root.uri:i.item.uri;let r=await this._textModelService.createModelReference(e);this._editor.setModel(r.object.textEditorModel);let s=[],n=i.locations;for(let r of(n||(n=[{uri:i.item.uri,range:i.item.selectionRange}]),n))r.uri.toString()===e.toString()&&(s.push({range:r.range,options:o}),t=t?tD.Range.plusRange(r.range,t):r.range);if(t){this._editor.revealRangeInCenter(t,i$.ScrollType.Immediate);let e=this._editor.createDecorationsCollection(s);this._previewDisposable.add((0,eu.toDisposable)(()=>e.clear()))}this._previewDisposable.add(r);let a=this._direction===iU.CallHierarchyDirection.CallsFrom?(0,ev.localize)(4565,"Calls from '{0}'",i.model.root.name):(0,ev.localize)(4566,"Callers of '{0}'",i.model.root.name);this.setTitle(a)}showLoading(){this._parent.dataset.state=D.Loading,this.setTitle((0,ev.localize)(4567,"Loading...")),this._show()}showMessage(e){this._parent.dataset.state=D.Message,this.setTitle(""),this.setMetaTitle(""),this._message.innerText=e,this._show(),this._message.focus()}async showModel(e){this._show();let t=this._treeViewStates.get(this._direction);await this._tree.setInput(e,t);let i=this._tree.getNode(e).children[0];await this._tree.expand(i.element),0===i.children.length?this.showMessage(this._direction===iU.CallHierarchyDirection.CallsFrom?(0,ev.localize)(4568,"No calls from '{0}'",e.root.name):(0,ev.localize)(4569,"No callers of '{0}'",e.root.name)):(this._parent.dataset.state=D.Data,t&&0!==this._tree.getFocus().length||this._tree.setFocus([i.children[0].element]),this._tree.domFocus(),this._updatePreview())}getModel(){return this._tree.getInput()}getFocused(){return this._tree.getFocus()[0]}async updateDirection(e){let t=this._tree.getInput();t&&e!==this._direction&&(this._treeViewStates.set(this._direction,this._tree.getViewState()),this._direction=e,await this.showModel(t))}_show(){this._isShowing||(this.editor.revealLineInCenterIfOutsideViewport(this._where.lineNumber,i$.ScrollType.Smooth),super.show(tD.Range.fromPositions(this._where),this._layoutInfo.height))}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){(this._dim.height!==e||this._dim.width!==t)&&(super._doLayoutBody(e,t),this._dim=new er.Dimension(t,e),this._layoutInfo.height=this._viewZone?this._viewZone.heightInLines:this._layoutInfo.height,this._splitView.layout(t),this._splitView.resizeView(0,t*this._layoutInfo.ratio))}};os=I=(0,ei.__decorate)([(0,ei.__param)(3,eW.IThemeService),(0,ei.__param)(4,ot.IPeekViewService),(0,ei.__param)(5,eQ.IEditorService),(0,ei.__param)(6,tT.ITextModelService),(0,ei.__param)(7,eP.IStorageService),(0,ei.__param)(8,iQ.IMenuService),(0,ei.__param)(9,eK.IContextKeyService),(0,ei.__param)(10,eD.IInstantiationService)],os);var on=e.i(478697),oa=e.i(704409),od=e.i(79522);let ol=new eV.RawContextKey("editorHasCallHierarchyProvider",!1,(0,ev.localize)(4553,"Whether a call hierarchy provider is available")),oc=new eV.RawContextKey("callHierarchyVisible",!1,(0,ev.localize)(4554,"Whether call hierarchy peek is currently showing")),oh=new eV.RawContextKey("callHierarchyDirection",void 0,{type:"string",description:(0,ev.localize)(4555,"Whether call hierarchy shows incoming or outgoing calls")}),ou=class{static{T=this}static{this.Id="callHierarchy"}static get(e){return e.getContribution(T.Id)}static{this._StorageDirection="callHierarchy/defaultDirection"}constructor(e,t,i,o,r){this._editor=e,this._contextKeyService=t,this._storageService=i,this._editorService=o,this._instantiationService=r,this._dispoables=new eu.DisposableStore,this._sessionDisposables=new eu.DisposableStore,this._ctxIsVisible=oc.bindTo(this._contextKeyService),this._ctxHasProvider=ol.bindTo(this._contextKeyService),this._ctxDirection=oh.bindTo(this._contextKeyService),this._dispoables.add(ec.Event.any(e.onDidChangeModel,e.onDidChangeModelLanguage,iU.CallHierarchyProviderRegistry.onDidChange)(()=>{this._ctxHasProvider.set(e.hasModel()&&iU.CallHierarchyProviderRegistry.has(e.getModel()))})),this._dispoables.add(this._sessionDisposables)}dispose(){this._ctxHasProvider.reset(),this._ctxIsVisible.reset(),this._dispoables.dispose()}async startCallHierarchyFromEditor(){var e;if(this._sessionDisposables.clear(),!this._editor.hasModel())return;let t=this._editor.getModel(),i=this._editor.getPosition();if(!iU.CallHierarchyProviderRegistry.has(t))return;let o=new e8.CancellationTokenSource,r=iU.CallHierarchyModel.create(t,i,o.token),s=(e=this._storageService.get(T._StorageDirection,t0.StorageScope.PROFILE,iU.CallHierarchyDirection.CallsTo))===iU.CallHierarchyDirection.CallsFrom||e===iU.CallHierarchyDirection.CallsTo?e:iU.CallHierarchyDirection.CallsTo;this._showCallHierarchyWidget(i,s,r,o)}async startCallHierarchyFromCallHierarchy(){if(!this._widget)return;let e=this._widget.getModel(),t=this._widget.getFocused();if(!t||!e)return;let i=await this._editorService.openCodeEditor({resource:t.item.uri},this._editor);if(!i)return;let o=e.fork(t.item);this._sessionDisposables.clear(),T.get(i)?._showCallHierarchyWidget(tD.Range.lift(o.root.selectionRange).getStartPosition(),this._widget.direction,Promise.resolve(o),new e8.CancellationTokenSource)}_showCallHierarchyWidget(e,t,i,o){this._ctxIsVisible.set(!0),this._ctxDirection.set(t),ec.Event.any(this._editor.onDidChangeModel,this._editor.onDidChangeModelLanguage)(this.endCallHierarchy,this,this._sessionDisposables),this._widget=this._instantiationService.createInstance(os,this._editor,e,t),this._widget.showLoading(),this._sessionDisposables.add(this._widget.onDidClose(()=>{this.endCallHierarchy(),this._storageService.store(T._StorageDirection,this._widget.direction,t0.StorageScope.PROFILE,t0.StorageTarget.USER)})),this._sessionDisposables.add({dispose(){o.dispose(!0)}}),this._sessionDisposables.add(this._widget),i.then(e=>{o.token.isCancellationRequested||(e?(this._sessionDisposables.add(e),this._widget.showModel(e)):this._widget.showMessage((0,ev.localize)(4556,"No results")))}).catch(e=>{(0,el.isCancellationError)(e)?this.endCallHierarchy():this._widget.showMessage((0,ev.localize)(4557,"Failed to show call hierarchy"))})}showOutgoingCalls(){this._widget?.updateDirection(iU.CallHierarchyDirection.CallsFrom),this._ctxDirection.set(iU.CallHierarchyDirection.CallsFrom)}showIncomingCalls(){this._widget?.updateDirection(iU.CallHierarchyDirection.CallsTo),this._ctxDirection.set(iU.CallHierarchyDirection.CallsTo)}endCallHierarchy(){this._sessionDisposables.clear(),this._ctxIsVisible.set(!1),this._editor.focus()}};ou=T=(0,ei.__decorate)([(0,ei.__param)(1,eK.IContextKeyService),(0,ei.__param)(2,eP.IStorageService),(0,ei.__param)(3,od.ICodeEditorService),(0,ei.__param)(4,eD.IInstantiationService)],ou),(0,on.registerEditorContribution)(ou.Id,ou,on.EditorContributionInstantiation.Eager),(0,eG.registerAction2)(class extends on.EditorAction2{constructor(){super({id:"editor.showCallHierarchy",title:(0,ev.localize2)(4558,"Peek Call Hierarchy"),menu:{id:eG.MenuId.EditorContextPeek,group:"navigation",order:1e3,when:eV.ContextKeyExpr.and(ol,oe.PeekContext.notInPeekEditor,oa.EditorContextKeys.isInEmbeddedEditor.toNegated())},keybinding:{when:oa.EditorContextKeys.editorTextFocus,weight:eF.KeybindingWeight.WorkbenchContrib,primary:iO.KeyMod.Shift+iO.KeyMod.Alt+iO.KeyCode.KeyH},precondition:eV.ContextKeyExpr.and(ol,oe.PeekContext.notInPeekEditor),f1:!0})}async runEditorCommand(e,t){return ou.get(t)?.startCallHierarchyFromEditor()}}),(0,eG.registerAction2)(class extends on.EditorAction2{constructor(){super({id:"editor.showIncomingCalls",title:(0,ev.localize2)(4559,"Show Incoming Calls"),icon:(0,iK.registerIcon)("callhierarchy-incoming",t8.Codicon.callIncoming,(0,ev.localize)(4560,"Icon for incoming calls in the call hierarchy view.")),precondition:eV.ContextKeyExpr.and(oc,oh.isEqualTo(iU.CallHierarchyDirection.CallsFrom)),keybinding:{weight:eF.KeybindingWeight.WorkbenchContrib,primary:iO.KeyMod.Shift+iO.KeyMod.Alt+iO.KeyCode.KeyH},menu:{id:os.TitleMenu,when:oh.isEqualTo(iU.CallHierarchyDirection.CallsFrom),order:1}})}runEditorCommand(e,t){return ou.get(t)?.showIncomingCalls()}}),(0,eG.registerAction2)(class extends on.EditorAction2{constructor(){super({id:"editor.showOutgoingCalls",title:(0,ev.localize2)(4561,"Show Outgoing Calls"),icon:(0,iK.registerIcon)("callhierarchy-outgoing",t8.Codicon.callOutgoing,(0,ev.localize)(4562,"Icon for outgoing calls in the call hierarchy view.")),precondition:eV.ContextKeyExpr.and(oc,oh.isEqualTo(iU.CallHierarchyDirection.CallsTo)),keybinding:{weight:eF.KeybindingWeight.WorkbenchContrib,primary:iO.KeyMod.Shift+iO.KeyMod.Alt+iO.KeyCode.KeyH},menu:{id:os.TitleMenu,when:oh.isEqualTo(iU.CallHierarchyDirection.CallsTo),order:1}})}runEditorCommand(e,t){return ou.get(t)?.showOutgoingCalls()}}),(0,eG.registerAction2)(class extends on.EditorAction2{constructor(){super({id:"editor.refocusCallHierarchy",title:(0,ev.localize2)(4563,"Refocus Call Hierarchy"),precondition:oc,keybinding:{weight:eF.KeybindingWeight.WorkbenchContrib,primary:iO.KeyMod.Shift+iO.KeyCode.Enter}})}async runEditorCommand(e,t){return ou.get(t)?.startCallHierarchyFromCallHierarchy()}}),(0,eG.registerAction2)(class extends on.EditorAction2{constructor(){super({id:"editor.closeCallHierarchy",title:(0,ev.localize)(4564,"Close"),icon:t8.Codicon.close,precondition:oc,keybinding:{weight:eF.KeybindingWeight.WorkbenchContrib+10,primary:iO.KeyCode.Escape,when:eV.ContextKeyExpr.not("config.editor.stablePeek")},menu:{id:os.TitleMenu,order:1e3}})}runEditorCommand(e,t){return ou.get(t)?.endCallHierarchy()}}),e.s([],817887);var op=on,og=tZ,om=e.i(820554);class ov{constructor(e,t,i){this.item=e,this.model=t,this.parent=i}static compare(e,t){let i=(0,iu.compare)(e.item.uri.toString(),t.item.uri.toString());return 0===i&&(i=tD.Range.compareRangesUsingStarts(e.item.range,t.item.range)),i}}class oy{constructor(e){this.getDirection=e}hasChildren(){return!0}async getChildren(e){if(e instanceof om.TypeHierarchyModel)return e.roots.map(t=>new ov(t,e,void 0));let{model:t,item:i}=e;return this.getDirection()===om.TypeHierarchyDirection.Supertypes?(await t.provideSupertypes(i,e8.CancellationToken.None)).map(i=>new ov(i,t,e)):(await t.provideSubtypes(i,e8.CancellationToken.None)).map(i=>new ov(i,t,e))}}class oC{compare(e,t){return ov.compare(e,t)}}class ob{constructor(e){this.getDirection=e}getId(e){let t=this.getDirection()+JSON.stringify(e.item.uri)+JSON.stringify(e.item.range);return e.parent&&(t+=this.getId(e.parent)),t}}class ow{constructor(e,t){this.icon=e,this.label=t}}class of{constructor(){this.templateId=of.id}static{this.id="TypeRenderer"}renderTemplate(e){e.classList.add("typehierarchy-element");let t=(0,er.createElement)("div");return e.appendChild(t),new ow(t,new ic.IconLabel(e,{supportHighlights:!0}))}renderElement(e,t,i){let{element:o,filterData:r}=e,s=o.item.tags?.includes(i1.SymbolTag.Deprecated);i.icon.classList.add("inline",...ih.ThemeIcon.asClassNameArray(i1.SymbolKinds.toIcon(o.item.kind))),i.label.setLabel(o.item.name,o.item.detail,{labelEscapeNewLines:!0,matches:(0,id.createMatches)(r),strikethrough:s})}disposeTemplate(e){e.label.dispose()}}class oS{getHeight(e){return 22}getTemplateId(e){return of.id}}class o_{constructor(e){this.getDirection=e}getWidgetAriaLabel(){return(0,ev.localize)(12856,"Type Hierarchy")}getAriaLabel(e){return this.getDirection()===om.TypeHierarchyDirection.Supertypes?(0,ev.localize)(12857,"supertypes of {0}",e.item.name):(0,ev.localize)(12858,"subtypes of {0}",e.item.name)}}var oE=oe;(0,t$.registerCss)(void 0),(s=x||(x={})).Loading="loading",s.Message="message",s.Data="data";class oI{static store(e,t){t.store("typeHierarchyPeekLayout",JSON.stringify(e),t0.StorageScope.PROFILE,t0.StorageTarget.MACHINE)}static retrieve(e){let t=e.get("typeHierarchyPeekLayout",t0.StorageScope.PROFILE,"{}"),i={ratio:.7,height:17};try{return{...i,...JSON.parse(t)}}catch{return i}}constructor(e,t){this.ratio=e,this.height=t}}class oD extends og.WorkbenchAsyncDataTree{}let oT=class extends oE.PeekViewWidget{static{A=this}static{this.TitleMenu=new eG.MenuId("typehierarchy/title")}constructor(e,t,i,o,r,s,n,a,d,l,c){super(e,{showFrame:!0,showArrow:!0,isResizeable:!0,isAccessible:!0},c),this._where=t,this._direction=i,this._peekViewService=r,this._editorService=s,this._textModelService=n,this._storageService=a,this._menuService=d,this._contextKeyService=l,this._instantiationService=c,this._treeViewStates=new Map,this._previewDisposable=new eu.DisposableStore,this.create(),this._peekViewService.addExclusiveWidget(e,this),this._applyTheme(o.getColorTheme()),this._disposables.add(o.onDidColorThemeChange(this._applyTheme,this)),this._disposables.add(this._previewDisposable)}dispose(){oI.store(this._layoutInfo,this._storageService),this._splitView.dispose(),this._tree.dispose(),this._editor.dispose(),super.dispose()}get direction(){return this._direction}_applyTheme(e){let t=e.getColor(oE.peekViewBorder)||iJ.Color.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(oE.peekViewTitleBackground)||iJ.Color.transparent,primaryHeadingColor:e.getColor(oE.peekViewTitleForeground),secondaryHeadingColor:e.getColor(oE.peekViewTitleInfoForeground)})}_fillHead(e){super._fillHead(e,!0);let t=this._menuService.createMenu(A.TitleMenu,this._contextKeyService),i=()=>{let e=(0,i0.getFlatActionBarActions)(t.getActions());this._actionbarWidget.clear(),this._actionbarWidget.push(e,{label:!1,icon:!0})};this._disposables.add(t),this._disposables.add(t.onDidChange(i)),i()}_fillBody(e){this._layoutInfo=oI.retrieve(this._storageService),this._dim=new er.Dimension(0,0),this._parent=e,e.classList.add("type-hierarchy");let t=(0,er.createElement)("div");t.classList.add("message"),e.appendChild(t),this._message=t,this._message.tabIndex=0;let i=(0,er.createElement)("div");i.classList.add("results"),e.appendChild(i),this._splitView=new iq.SplitView(i,{orientation:oi.Orientation.HORIZONTAL});let o=(0,er.createElement)("div");o.classList.add("editor"),i.appendChild(o),this._editor=this._instantiationService.createInstance(iY.EmbeddedCodeEditorWidget,o,{scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}},{},this.editor);let r=(0,er.createElement)("div");r.classList.add("tree"),i.appendChild(r);let s={sorter:new oC,accessibilityProvider:new o_(()=>this._direction),identityProvider:new ob(()=>this._direction),expandOnlyOnTwistieClick:!0,overrideStyles:{listBackground:oE.peekViewResultsBackground}};this._tree=this._instantiationService.createInstance(oD,"TypeHierarchyPeek",r,new oS,[this._instantiationService.createInstance(of)],this._instantiationService.createInstance(oy,()=>this._direction),s),this._splitView.addView({onDidChange:ec.Event.None,element:o,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:e=>{this._dim.height&&this._editor.layout({height:this._dim.height,width:e})}},iq.Sizing.Distribute),this._splitView.addView({onDidChange:ec.Event.None,element:r,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:e=>{this._dim.height&&this._tree.layout(this._dim.height,e)}},iq.Sizing.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this._layoutInfo.ratio=this._splitView.getViewSize(0)/this._dim.width)})),this._disposables.add(this._tree.onDidChangeFocus(this._updatePreview,this)),this._disposables.add(this._editor.onMouseDown(e=>{let{event:t,target:i}=e;if(2!==t.detail)return;let[o]=this._tree.getFocus();o&&(this.dispose(),this._editorService.openEditor({resource:o.item.uri,options:{selection:i.range}}))})),this._disposables.add(this._tree.onMouseDblClick(e=>{e.target!==iZ.TreeMouseEventTarget.Twistie&&e.element&&(this.dispose(),this._editorService.openEditor({resource:e.element.item.uri,options:{selection:e.element.item.selectionRange,pinned:!0}}))})),this._disposables.add(this._tree.onDidChangeSelection(e=>{let[t]=e.elements;t&&(0,er.isKeyboardEvent)(e.browserEvent)&&(this.dispose(),this._editorService.openEditor({resource:t.item.uri,options:{selection:t.item.selectionRange,pinned:!0}}))}))}async _updatePreview(){let e,t,[i]=this._tree.getFocus();if(!i)return;this._previewDisposable.clear();let o={description:"type-hierarchy-decoration",stickiness:ij.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,className:"type-decoration",overviewRuler:{color:(0,iX.themeColorFromId)(oE.peekViewEditorMatchHighlight),position:ij.OverviewRulerLane.Center}};e=this._direction===om.TypeHierarchyDirection.Supertypes?i.parent?i.parent.item.uri:i.model.root.uri:i.item.uri;let r=await this._textModelService.createModelReference(e);this._editor.setModel(r.object.textEditorModel);let s=[],n={uri:i.item.uri,range:i.item.selectionRange};if(n.uri.toString()===e.toString()&&(s.push({range:n.range,options:o}),t=t?tD.Range.plusRange(n.range,t):n.range),t){this._editor.revealRangeInCenter(t,i$.ScrollType.Immediate);let e=this._editor.createDecorationsCollection(s);this._previewDisposable.add((0,eu.toDisposable)(()=>e.clear()))}this._previewDisposable.add(r);let a=this._direction===om.TypeHierarchyDirection.Supertypes?(0,ev.localize)(12851,"Supertypes of '{0}'",i.model.root.name):(0,ev.localize)(12852,"Subtypes of '{0}'",i.model.root.name);this.setTitle(a)}showLoading(){this._parent.dataset.state=x.Loading,this.setTitle((0,ev.localize)(12853,"Loading...")),this._show()}showMessage(e){this._parent.dataset.state=x.Message,this.setTitle(""),this.setMetaTitle(""),this._message.innerText=e,this._show(),this._message.focus()}async showModel(e){this._show();let t=this._treeViewStates.get(this._direction);await this._tree.setInput(e,t);let i=this._tree.getNode(e).children[0];await this._tree.expand(i.element),0===i.children.length?this.showMessage(this._direction===om.TypeHierarchyDirection.Supertypes?(0,ev.localize)(12854,"No supertypes of '{0}'",e.root.name):(0,ev.localize)(12855,"No subtypes of '{0}'",e.root.name)):(this._parent.dataset.state=x.Data,t&&0!==this._tree.getFocus().length||this._tree.setFocus([i.children[0].element]),this._tree.domFocus(),this._updatePreview())}getModel(){return this._tree.getInput()}getFocused(){return this._tree.getFocus()[0]}async updateDirection(e){let t=this._tree.getInput();t&&e!==this._direction&&(this._treeViewStates.set(this._direction,this._tree.getViewState()),this._direction=e,await this.showModel(t))}_show(){this._isShowing||(this.editor.revealLineInCenterIfOutsideViewport(this._where.lineNumber,i$.ScrollType.Smooth),super.show(tD.Range.fromPositions(this._where),this._layoutInfo.height))}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){(this._dim.height!==e||this._dim.width!==t)&&(super._doLayoutBody(e,t),this._dim=new er.Dimension(t,e),this._layoutInfo.height=this._viewZone?this._viewZone.heightInLines:this._layoutInfo.height,this._splitView.layout(t),this._splitView.resizeView(0,t*this._layoutInfo.ratio))}};oT=A=(0,ei.__decorate)([(0,ei.__param)(3,eW.IThemeService),(0,ei.__param)(4,ot.IPeekViewService),(0,ei.__param)(5,eQ.IEditorService),(0,ei.__param)(6,tT.ITextModelService),(0,ei.__param)(7,eP.IStorageService),(0,ei.__param)(8,iQ.IMenuService),(0,ei.__param)(9,eK.IContextKeyService),(0,ei.__param)(10,eD.IInstantiationService)],oT);let oA=new eV.RawContextKey("editorHasTypeHierarchyProvider",!1,(0,ev.localize)(12841,"Whether a type hierarchy provider is available")),ox=new eV.RawContextKey("typeHierarchyVisible",!1,(0,ev.localize)(12842,"Whether type hierarchy peek is currently showing")),oR=new eV.RawContextKey("typeHierarchyDirection",void 0,{type:"string",description:(0,ev.localize)(12843,"whether type hierarchy shows super types or subtypes")}),ok=class{static{R=this}static{this.Id="typeHierarchy"}static get(e){return e.getContribution(R.Id)}static{this._storageDirectionKey="typeHierarchy/defaultDirection"}constructor(e,t,i,o,r){this._editor=e,this._contextKeyService=t,this._storageService=i,this._editorService=o,this._instantiationService=r,this._disposables=new eu.DisposableStore,this._sessionDisposables=new eu.DisposableStore,this._ctxHasProvider=oA.bindTo(this._contextKeyService),this._ctxIsVisible=ox.bindTo(this._contextKeyService),this._ctxDirection=oR.bindTo(this._contextKeyService),this._disposables.add(ec.Event.any(e.onDidChangeModel,e.onDidChangeModelLanguage,om.TypeHierarchyProviderRegistry.onDidChange)(()=>{this._ctxHasProvider.set(e.hasModel()&&om.TypeHierarchyProviderRegistry.has(e.getModel()))})),this._disposables.add(this._sessionDisposables)}dispose(){this._disposables.dispose()}async startTypeHierarchyFromEditor(){var e;if(this._sessionDisposables.clear(),!this._editor.hasModel())return;let t=this._editor.getModel(),i=this._editor.getPosition();if(!om.TypeHierarchyProviderRegistry.has(t))return;let o=new e8.CancellationTokenSource,r=om.TypeHierarchyModel.create(t,i,o.token),s=(e=this._storageService.get(R._storageDirectionKey,t0.StorageScope.PROFILE,om.TypeHierarchyDirection.Subtypes))===om.TypeHierarchyDirection.Subtypes||e===om.TypeHierarchyDirection.Supertypes?e:om.TypeHierarchyDirection.Subtypes;this._showTypeHierarchyWidget(i,s,r,o)}_showTypeHierarchyWidget(e,t,i,o){this._ctxIsVisible.set(!0),this._ctxDirection.set(t),ec.Event.any(this._editor.onDidChangeModel,this._editor.onDidChangeModelLanguage)(this.endTypeHierarchy,this,this._sessionDisposables),this._widget=this._instantiationService.createInstance(oT,this._editor,e,t),this._widget.showLoading(),this._sessionDisposables.add(this._widget.onDidClose(()=>{this.endTypeHierarchy(),this._storageService.store(R._storageDirectionKey,this._widget.direction,t0.StorageScope.PROFILE,t0.StorageTarget.USER)})),this._sessionDisposables.add({dispose(){o.dispose(!0)}}),this._sessionDisposables.add(this._widget),i.then(e=>{o.token.isCancellationRequested||(e?(this._sessionDisposables.add(e),this._widget.showModel(e)):this._widget.showMessage((0,ev.localize)(12844,"No results")))}).catch(e=>{(0,el.isCancellationError)(e)?this.endTypeHierarchy():this._widget.showMessage((0,ev.localize)(12845,"Failed to show type hierarchy"))})}async startTypeHierarchyFromTypeHierarchy(){if(!this._widget)return;let e=this._widget.getModel(),t=this._widget.getFocused();if(!t||!e)return;let i=await this._editorService.openCodeEditor({resource:t.item.uri},this._editor);if(!i)return;let o=e.fork(t.item);this._sessionDisposables.clear(),R.get(i)?._showTypeHierarchyWidget(tD.Range.lift(o.root.selectionRange).getStartPosition(),this._widget.direction,Promise.resolve(o),new e8.CancellationTokenSource)}showSupertypes(){this._widget?.updateDirection(om.TypeHierarchyDirection.Supertypes),this._ctxDirection.set(om.TypeHierarchyDirection.Supertypes)}showSubtypes(){this._widget?.updateDirection(om.TypeHierarchyDirection.Subtypes),this._ctxDirection.set(om.TypeHierarchyDirection.Subtypes)}endTypeHierarchy(){this._sessionDisposables.clear(),this._ctxIsVisible.set(!1),this._editor.focus()}};ok=R=(0,ei.__decorate)([(0,ei.__param)(1,eK.IContextKeyService),(0,ei.__param)(2,eP.IStorageService),(0,ei.__param)(3,od.ICodeEditorService),(0,ei.__param)(4,eD.IInstantiationService)],ok),(0,op.registerEditorContribution)(ok.Id,ok,op.EditorContributionInstantiation.Eager),(0,eG.registerAction2)(class extends op.EditorAction2{constructor(){super({id:"editor.showTypeHierarchy",title:(0,ev.localize2)(12846,"Peek Type Hierarchy"),menu:{id:eG.MenuId.EditorContextPeek,group:"navigation",order:1e3,when:eV.ContextKeyExpr.and(oA,oe.PeekContext.notInPeekEditor)},precondition:eV.ContextKeyExpr.and(oA,oe.PeekContext.notInPeekEditor),f1:!0})}async runEditorCommand(e,t){return ok.get(t)?.startTypeHierarchyFromEditor()}}),(0,eG.registerAction2)(class extends op.EditorAction2{constructor(){super({id:"editor.showSupertypes",title:(0,ev.localize2)(12847,"Show Supertypes"),icon:t8.Codicon.typeHierarchySuper,precondition:eV.ContextKeyExpr.and(ox,oR.isEqualTo(om.TypeHierarchyDirection.Subtypes)),keybinding:{weight:eF.KeybindingWeight.WorkbenchContrib,primary:iO.KeyMod.Shift+iO.KeyMod.Alt+iO.KeyCode.KeyH},menu:{id:oT.TitleMenu,when:oR.isEqualTo(om.TypeHierarchyDirection.Subtypes),order:1}})}runEditorCommand(e,t){return ok.get(t)?.showSupertypes()}}),(0,eG.registerAction2)(class extends op.EditorAction2{constructor(){super({id:"editor.showSubtypes",title:(0,ev.localize2)(12848,"Show Subtypes"),icon:t8.Codicon.typeHierarchySub,precondition:eV.ContextKeyExpr.and(ox,oR.isEqualTo(om.TypeHierarchyDirection.Supertypes)),keybinding:{weight:eF.KeybindingWeight.WorkbenchContrib,primary:iO.KeyMod.Shift+iO.KeyMod.Alt+iO.KeyCode.KeyH},menu:{id:oT.TitleMenu,when:oR.isEqualTo(om.TypeHierarchyDirection.Supertypes),order:1}})}runEditorCommand(e,t){return ok.get(t)?.showSubtypes()}}),(0,eG.registerAction2)(class extends op.EditorAction2{constructor(){super({id:"editor.refocusTypeHierarchy",title:(0,ev.localize2)(12849,"Refocus Type Hierarchy"),precondition:ox,keybinding:{weight:eF.KeybindingWeight.WorkbenchContrib,primary:iO.KeyMod.Shift+iO.KeyCode.Enter}})}async runEditorCommand(e,t){return ok.get(t)?.startTypeHierarchyFromTypeHierarchy()}}),(0,eG.registerAction2)(class extends op.EditorAction2{constructor(){super({id:"editor.closeTypeHierarchy",title:(0,ev.localize)(12850,"Close"),icon:t8.Codicon.close,precondition:ox,keybinding:{weight:eF.KeybindingWeight.WorkbenchContrib+10,primary:iO.KeyCode.Escape,when:eV.ContextKeyExpr.not("config.editor.stablePeek")},menu:{id:oT.TitleMenu,order:1e3}})}runEditorCommand(e,t){return ok.get(t)?.endTypeHierarchy()}}),e.s([],529027);var oM=eu,oL=e.i(608326),oO=e.i(250147),oP=e.i(461822),oV=e.i(32637),oK=e.i(527180),oN=e.i(701898);class oG extends oN.Action{constructor(e,t){super("vs.tree.collapse",(0,ev.localize)(42,"Collapse All"),"collapse-all",t),this.viewer=e}async run(){this.viewer.collapseAll(),this.viewer.setSelection([]),this.viewer.setFocus([])}}var oF=oN,oW=eu,oz=e.i(419031),oB=e.i(914972),oU=eG,oH=e.i(318581),o$=e.i(846960),oq=tZ,oY=e.i(975445),oj=e.i(927842),oX=e.i(232762),oJ=e.i(134939),oZ=e.i(113535),oQ=t3,o0=e.i(497795),o1=e.i(258861),o2=e.i(400017),o3=e.i(827401),o5=e.i(65558),o6=e.i(459179),o4=eu;class o9 extends o4.Disposable{constructor(){super(...arguments),this._onDidChangeCheckboxState=this._register(new ec.Emitter),this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event}setCheckboxState(e){this._onDidChangeCheckboxState.fire([e])}}class o8 extends o4.Disposable{static{this.checkboxClass="custom-view-tree-node-item-checkbox"}constructor(e,t,i,o){super(),this.checkboxStateHandler=t,this.hoverDelegate=i,this.hoverService=o,this.checkboxContainer=e}render(e){e.checkbox&&(this.toggle?this.toggle.checked=e.checkbox.isChecked:this.createCheckbox(e))}createCheckbox(e){e.checkbox&&(this.toggle=new o6.Checkbox("",e.checkbox.isChecked,{...t1.defaultCheckboxStyles,size:15}),this.setHover(e.checkbox),this.setAccessibilityInformation(e.checkbox),this.toggle.domNode.classList.add(o8.checkboxClass),this.toggle.domNode.tabIndex=1,(0,er.append)(this.checkboxContainer,this.toggle.domNode),this.registerListener(e))}registerListener(e){this.toggle&&(this._register({dispose:()=>this.removeCheckbox()}),this._register(this.toggle),this._register(this.toggle.onChange(()=>{this.setCheckbox(e)})))}setHover(e){this.toggle&&(this.hover?this.hover.update(e.tooltip):this.hover=this._register(this.hoverService.setupManagedHover(this.hoverDelegate,this.toggle.domNode,this.checkboxHoverContent(e))))}setCheckbox(e){this.toggle&&e.checkbox&&(e.checkbox.isChecked=this.toggle.checked,this.setHover(e.checkbox),this.setAccessibilityInformation(e.checkbox),this.checkboxStateHandler.setCheckboxState(e))}checkboxHoverContent(e){return e.tooltip?e.tooltip:e.isChecked?(0,ev.localize)(3688,"Checked"):(0,ev.localize)(3689,"Unchecked")}setAccessibilityInformation(e){this.toggle&&e.accessibilityInformation&&(this.toggle.setTitle(e.accessibilityInformation.label),e.accessibilityInformation.role&&(this.toggle.domNode.role=e.accessibilityInformation.role))}removeCheckbox(){for(let e of this.checkboxContainer.children)e.remove()}}var o7=e.i(620943),re=e.i(744194),rt=e.i(334326),ri=e.i(202822),ro=e.i(643936),rr=e.i(7708);(0,t$.registerCss)(void 0);let rs=class extends oQ.ViewPane{constructor(e,t,i,o,r,s,n,a,d,l,c,h){super({...e,titleMenuId:oU.MenuId.ViewTitle,donotForwardArgs:!1},t,i,o,r,s,n,a,d,c,h);const{treeView:u}=eO.Registry.as(ek.Extensions.ViewsRegistry).getView(e.id);this.treeView=u,this._register(this.treeView.onDidChangeActions(()=>this.updateActions(),this)),this._register(this.treeView.onDidChangeTitle(e=>this.updateTitle(e))),this._register(this.treeView.onDidChangeDescription(e=>this.updateTitleDescription(e))),this._register((0,oW.toDisposable)(()=>{this._container&&this.treeView.container&&this._container===this.treeView.container&&this.treeView.setVisibility(!1)})),this._register(this.onDidChangeBodyVisibility(()=>this.updateTreeVisibility())),this._register(this.treeView.onDidChangeWelcomeState(()=>this._onDidChangeViewWelcomeState.fire())),e.title!==this.treeView.title&&this.updateTitle(this.treeView.title),e.titleDescription!==this.treeView.description&&this.updateTitleDescription(this.treeView.description),this._actionRunner=this._register(new rw(l,()=>this.treeView.getSelection())),this.updateTreeVisibility()}focus(){super.focus(),this.treeView.focus()}renderBody(e){this._container=e,super.renderBody(e),this.renderTreeView(e)}shouldShowWelcome(){return(void 0===this.treeView.dataProvider||!!this.treeView.dataProvider.isTreeEmpty)&&(void 0===this.treeView.message||""===this.treeView.message)}layoutBody(e,t){super.layoutBody(e,t),this.layoutTreeView(e,t)}getOptimalWidth(){return this.treeView.getOptimalWidth()}renderTreeView(e){this.treeView.show(e)}layoutTreeView(e,t){this.treeView.layout(e,t)}updateTreeVisibility(){this.treeView.setVisibility(this.isBodyVisible())}getActionRunner(){return this._actionRunner}getActionsContext(){return{$treeViewId:this.id,$focusedTreeItem:!0,$selectedTreeItems:!0}}};rs=(0,ei.__decorate)([(0,ei.__param)(1,tX.IKeybindingService),(0,ei.__param)(2,eC.IContextMenuService),(0,ei.__param)(3,ey.IConfigurationService),(0,ei.__param)(4,eK.IContextKeyService),(0,ei.__param)(5,eM.IViewDescriptorService),(0,ei.__param)(6,eD.IInstantiationService),(0,ei.__param)(7,tQ.IOpenerService),(0,ei.__param)(8,eW.IThemeService),(0,ei.__param)(9,oY.INotificationService),(0,ei.__param)(10,tj.IHoverService),(0,ei.__param)(11,rr.IAccessibleViewInformationService)],rs);class rn{constructor(){this.label={label:"root"},this.handle="0",this.parentHandle=void 0,this.collapsibleState=ek.TreeItemCollapsibleState.Expanded,this.children=void 0}}function ra(e){let t=oH.CommandsRegistry.getCommand(e);if(t){let e=oU.MenuRegistry.getCommand(t.id);return e?.precondition}}function rd(e,t){let i=ra(e.originalId?e.originalId:e.id);return!i||t.contextMatchesRules(i)}function rl(e){return!!e&&"string"!=typeof e&&!!e.element&&!!e.disposables}let rc=(0,ev.localize)(3690,"There is no data provider registered that can provide view data."),rh=new eV.RawContextKey("customTreeView",!1);class ru extends oq.WorkbenchAsyncDataTree{}let rp=class extends oW.Disposable{get onDidExpandItem(){return this._onDidExpandItem.event}get onDidCollapseItem(){return this._onDidCollapseItem.event}get onDidChangeSelectionAndFocus(){return this._onDidChangeSelectionAndFocus.event}get onDidChangeVisibility(){return this._onDidChangeVisibility.event}get onDidChangeActions(){return this._onDidChangeActions.event}get onDidChangeWelcomeState(){return this._onDidChangeWelcomeState.event}get onDidChangeTitle(){return this._onDidChangeTitle.event}get onDidChangeDescription(){return this._onDidChangeDescription.event}get onDidChangeCheckboxState(){return this._onDidChangeCheckboxState.event}constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p,g,m,v){super(),this.id=e,this._title=t,this.themeService=i,this.instantiationService=o,this.commandService=r,this.configurationService=s,this.progressService=n,this.contextMenuService=a,this.keybindingService=d,this.notificationService=l,this.viewDescriptorService=c,this.hoverService=h,this.contextKeyService=u,this.activityService=p,this.logService=g,this.openerService=m,this.markdownRendererService=v,this.isVisible=!1,this._hasIconForParentNode=!1,this._hasIconForLeafNode=!1,this.focused=!1,this._canSelectMany=!1,this._manuallyManageCheckboxes=!1,this.elementsToRefresh=[],this.lastSelection=[],this._onDidExpandItem=this._register(new ec.Emitter),this._onDidCollapseItem=this._register(new ec.Emitter),this._onDidChangeSelectionAndFocus=this._register(new ec.Emitter),this._onDidChangeVisibility=this._register(new ec.Emitter),this._onDidChangeActions=this._register(new ec.Emitter),this._onDidChangeWelcomeState=this._register(new ec.Emitter),this._onDidChangeTitle=this._register(new ec.Emitter),this._onDidChangeDescription=this._register(new ec.Emitter),this._onDidChangeCheckboxState=this._register(new ec.Emitter),this._onDidCompleteRefresh=this._register(new ec.Emitter),this._isInitialized=!1,this._activity=this._register(new oW.MutableDisposable),this.activated=!1,this.treeDisposables=this._register(new oW.DisposableStore),this._height=0,this._width=0,this.refreshing=!1,this.root=new rn,this.lastActive=this.root}initialize(){this._isInitialized||(this._isInitialized=!0,this.contextKeyService.bufferChangeEvents(()=>{this.initializeShowCollapseAllAction(),this.initializeCollapseAllToggle(),this.initializeShowRefreshAction()}),this.treeViewDnd=this.instantiationService.createInstance(r_,this.id),this._dragAndDropController&&(this.treeViewDnd.controller=this._dragAndDropController),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("explorer.decorations")&&this.doRefresh([this.root])})),this._register(this.viewDescriptorService.onDidChangeLocation(({views:e,from:t,to:i})=>{e.some(e=>e.id===this.id)&&this.tree?.updateOptions({overrideStyles:(0,oQ.getLocationBasedViewColors)(this.viewLocation).listOverrideStyles})})),this.registerActions(),this.create())}get viewContainer(){return this.viewDescriptorService.getViewContainerByViewId(this.id)}get viewLocation(){return this.viewDescriptorService.getViewLocationById(this.id)}get dragAndDropController(){return this._dragAndDropController}set dragAndDropController(e){this._dragAndDropController=e,this.treeViewDnd&&(this.treeViewDnd.controller=e)}get dataProvider(){return this._dataProvider}set dataProvider(e){if(e){this.visible&&this.activate();let t=this;this._dataProvider=new class{constructor(){this._isEmpty=!0,this._onDidChangeEmpty=new ec.Emitter,this.onDidChangeEmpty=this._onDidChangeEmpty.event}get isTreeEmpty(){return this._isEmpty}async getChildren(e){let t=await this.getChildrenBatch(e?[e]:void 0);return t?.[0]}updateEmptyState(e,t){if(1===e.length&&e[0]instanceof rn){let e=this._isEmpty;this._isEmpty=0===t.length||0===t[0].length,e!==this._isEmpty&&this._onDidChangeEmpty.fire()}}findCheckboxesUpdated(e,i){if(0===i.length)return[];let o=[];for(let r=0;r<e.length;r++){let s=e[r];for(let e of i[r])e.parent=s,t.manuallyManageCheckboxes||s?.checkbox?.isChecked!==!0||e.checkbox?.isChecked!==!1||(e.checkbox.isChecked=!0,o.push(e))}return o}async getChildrenBatch(i){let o,r=[];if(i?.every(e=>!!e.children))o=i.map(e=>e.children);else{i=i??[t.root];let s=await (1===i.length&&i[0]instanceof rn?rv(e,void 0):rv(e,i));for(let e=0;e<i.length;e++)i[e].children=s?s[e]:void 0;o=s??[],r=this.findCheckboxesUpdated(i,o)}return this.updateEmptyState(i,o),r.length>0&&t._onDidChangeCheckboxState.fire(r),o}},this._dataProvider.onDidChangeEmpty&&this._register(this._dataProvider.onDidChangeEmpty(()=>{this.updateCollapseAllToggle(),this._onDidChangeWelcomeState.fire()})),this.updateMessage(),this.refresh()}else this._dataProvider=void 0,this.treeDisposables.clear(),this.activated=!1,this.updateMessage();this._onDidChangeWelcomeState.fire()}get message(){return this._message}set message(e){this._message=e,this.updateMessage(),this._onDidChangeWelcomeState.fire()}get title(){return this._title}set title(e){this._title=e,this.tree&&(this.tree.ariaLabel=this._title),this._onDidChangeTitle.fire(this._title)}get description(){return this._description}set description(e){this._description=e,this._onDidChangeDescription.fire(this._description)}get badge(){return this._badge}set badge(e){if(this._badge?.value!==e?.value||this._badge?.tooltip!==e?.tooltip)if(this._badge=e,e){let t={badge:new o0.NumberBadge(e.value,()=>e.tooltip),priority:50};this._activity.value=this.activityService.showViewActivity(this.id,t)}else this._activity.clear()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){let t=this._canSelectMany;this._canSelectMany=e,this._canSelectMany!==t&&this.tree?.updateOptions({multipleSelectionSupport:this.canSelectMany})}get manuallyManageCheckboxes(){return this._manuallyManageCheckboxes}set manuallyManageCheckboxes(e){this._manuallyManageCheckboxes=e}get hasIconForParentNode(){return this._hasIconForParentNode}get hasIconForLeafNode(){return this._hasIconForLeafNode}get visible(){return this.isVisible}initializeShowCollapseAllAction(e=!1){return this.collapseAllContext||(this.collapseAllContextKey=new eV.RawContextKey(`treeView.${this.id}.enableCollapseAll`,e,(0,ev.localize)(3691,"Whether the tree view with id {0} enables collapse all.",this.id)),this.collapseAllContext=this.collapseAllContextKey.bindTo(this.contextKeyService)),!0}get showCollapseAllAction(){return this.initializeShowCollapseAllAction(),!!this.collapseAllContext?.get()}set showCollapseAllAction(e){this.initializeShowCollapseAllAction(e),this.collapseAllContext?.set(e)}initializeShowRefreshAction(e=!1){this.refreshContext||(this.refreshContextKey=new eV.RawContextKey(`treeView.${this.id}.enableRefresh`,e,(0,ev.localize)(3692,"Whether the tree view with id {0} enables refresh.",this.id)),this.refreshContext=this.refreshContextKey.bindTo(this.contextKeyService))}get showRefreshAction(){return this.initializeShowRefreshAction(),!!this.refreshContext?.get()}set showRefreshAction(e){this.initializeShowRefreshAction(e),this.refreshContext?.set(e)}registerActions(){let e=this;this._register((0,oU.registerAction2)(class extends oU.Action2{constructor(){super({id:`workbench.actions.treeView.${e.id}.refresh`,title:(0,ev.localize)(3693,"Refresh"),menu:{id:oU.MenuId.ViewTitle,when:eV.ContextKeyExpr.and(eV.ContextKeyExpr.equals("view",e.id),e.refreshContextKey),group:"navigation",order:Number.MAX_SAFE_INTEGER-1},icon:t8.Codicon.refresh})}async run(){return e.refresh()}})),this._register((0,oU.registerAction2)(class extends oU.Action2{constructor(){super({id:`workbench.actions.treeView.${e.id}.collapseAll`,title:(0,ev.localize)(3694,"Collapse All"),menu:{id:oU.MenuId.ViewTitle,when:eV.ContextKeyExpr.and(eV.ContextKeyExpr.equals("view",e.id),e.collapseAllContextKey),group:"navigation",order:Number.MAX_SAFE_INTEGER},precondition:e.collapseAllToggleContextKey,icon:t8.Codicon.collapseAll})}async run(){if(e.tree)return new oG(e.tree,!0).run()}}))}setVisibility(e){this.initialize(),e=!!e,this.isVisible!==e&&(this.isVisible=e,this.tree&&(this.isVisible?(0,er.show)(this.tree.getHTMLElement()):(0,er.hide)(this.tree.getHTMLElement()),this.isVisible&&this.elementsToRefresh.length&&this.dataProvider&&(this.doRefresh(this.elementsToRefresh),this.elementsToRefresh=[])),(0,eg.setTimeout0)(()=>{this.dataProvider&&this._onDidChangeVisibility.fire(this.isVisible)}),this.visible&&this.activate())}focus(e=!0,t){if(this.tree&&this.root.children&&this.root.children.length>0){let i=t??this.tree.getSelection()[0];i&&e&&this.tree.reveal(i,.5),this.tree.domFocus()}else this.tree&&this.treeContainer&&!this.treeContainer.classList.contains("hide")?this.tree.domFocus():this.domNode.focus()}show(e){this._container=e,(0,er.append)(e,this.domNode)}create(){this.domNode=(0,er.$)(".tree-explorer-viewlet-tree-view"),this.messageElement=(0,er.append)(this.domNode,(0,er.$)(".message")),this.updateMessage(),this.treeContainer=(0,er.append)(this.domNode,(0,er.$)(".customview-tree")),this.treeContainer.classList.add("file-icon-themable-tree","show-file-icons");let e=this._register((0,er.trackFocus)(this.domNode));this._register(e.onDidFocus(()=>this.focused=!0)),this._register(e.onDidBlur(()=>this.focused=!1))}createTree(){this.treeDisposables.clear();let e=i0.createActionViewItem.bind(void 0,this.instantiationService),t=this.treeDisposables.add(this.instantiationService.createInstance(rf,this.id));this.treeLabels=this.treeDisposables.add(this.instantiationService.createInstance(t2.ResourceLabels,this));let i=this.instantiationService.createInstance(ry,this,e=>this.progressService.withProgress({location:this.id},()=>e)),o=this.treeDisposables.add(new rb(this.themeService,this.logService)),r=this.treeDisposables.add(new o9),s=this.treeDisposables.add(this.instantiationService.createInstance(rC,this.id,t,this.treeLabels,e,o,r,()=>this.manuallyManageCheckboxes));this.treeDisposables.add(s.onDidChangeCheckboxState(e=>this._onDidChangeCheckboxState.fire(e)));let n=this._title;this.tree=this.treeDisposables.add(this.instantiationService.createInstance(ru,this.id,this.treeContainer,new rm,[s],i,{identityProvider:new rg,accessibilityProvider:{getAriaLabel(e){if(e.accessibilityInformation)return e.accessibilityInformation.label;if((0,eN.isString)(e.tooltip))return e.tooltip;{if(e.resourceUri&&!e.label)return null;let t="";return e.label&&(t+=((0,eh.isMarkdownString)(e.label.label)?e.label.label.value:e.label.label)+" "),e.description&&(t+=e.description),t}},getRole:e=>e.accessibilityInformation?.role??"treeitem",getWidgetAriaLabel:()=>n},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:e=>e.label?(0,eh.isMarkdownString)(e.label.label)?e.label.label.value:e.label.label:e.resourceUri?(0,t9.basename)(e$.URI.revive(e.resourceUri)):void 0},expandOnlyOnTwistieClick:e=>!!e.command||!!e.checkbox||"doubleClick"===this.configurationService.getValue("workbench.tree.expandMode"),collapseByDefault:e=>e.collapsibleState!==ek.TreeItemCollapsibleState.Expanded,multipleSelectionSupport:this.canSelectMany,dnd:this.treeViewDnd,overrideStyles:(0,oQ.getLocationBasedViewColors)(this.viewLocation).listOverrideStyles})),this.treeDisposables.add(s.onDidChangeMenuContext(e=>e.forEach(e=>this.tree?.rerender(e)))),this.treeDisposables.add(this.tree),t.setContextKeyService(this.tree.contextKeyService),o.tree=this.tree;let a=this.treeDisposables.add(new rw(this.notificationService,()=>this.tree.getSelection()));s.actionRunner=a,this.tree.contextKeyService.createKey(this.id,!0),rh.bindTo(this.tree.contextKeyService).set(!0),this.treeDisposables.add(this.tree.onContextMenu(e=>this.onContextMenu(t,e,a))),this.treeDisposables.add(this.tree.onDidChangeSelection(e=>{this.lastSelection=e.elements,this.lastActive=this.tree?.getFocus()[0]??this.lastActive,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive})})),this.treeDisposables.add(this.tree.onDidChangeFocus(e=>{e.elements.length&&e.elements[0]!==this.lastActive&&(this.lastActive=e.elements[0],this.lastSelection=this.tree?.getSelection()??this.lastSelection,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive}))})),this.treeDisposables.add(this.tree.onDidChangeCollapseState(e=>{if(!e.node.element)return;let t=Array.isArray(e.node.element.element)?e.node.element.element[0]:e.node.element.element;e.node.collapsed?this._onDidCollapseItem.fire(t):this._onDidExpandItem.fire(t)})),this.tree.setInput(this.root).then(()=>this.updateContentAreas()),this.treeDisposables.add(this.tree.onDidOpen(async e=>{if(!e.browserEvent||e.browserEvent.target&&e.browserEvent.target.classList.contains(o8.checkboxClass))return;let t=this.tree.getSelection(),i=await this.resolveCommand(1===t.length?t[0]:void 0);if(i&&rd(i,this.contextKeyService)){let t=i.arguments||[];(i.id===oZ.API_OPEN_EDITOR_COMMAND_ID||i.id===oZ.API_OPEN_DIFF_EDITOR_COMMAND_ID)&&(t=[...t,e]);try{await this.commandService.executeCommand(i.id,...t)}catch(e){this.notificationService.error(e)}}})),this.treeDisposables.add(t.onDidChange(e=>{this.tree?.hasNode(e)&&this.tree?.rerender(e)}))}async resolveCommand(e){let t=e?.command;return e&&!t&&e instanceof ek.ResolvableTreeItem&&e.hasResolve&&(await e.resolve(e8.CancellationToken.None),t=e.command),t}onContextMenu(e,t,i){this.hoverService.hideHover();let o=t.element;if(null===o)return;let r=t.browserEvent;r.preventDefault(),r.stopPropagation(),this.tree.setFocus([o]);let s=this.canSelectMany?this.getSelection():[];s.find(e=>e.handle===o.handle)||(s=[o]);let n=e.getResourceContextActions(s);n.length&&this.contextMenuService.showContextMenu({getAnchor:()=>t.anchor,getActions:()=>n,getActionViewItem:e=>{let t=this.keybindingService.lookupKeybinding(e.id);if(t)return new oK.ActionViewItem(e,e,{label:!0,keybinding:t.getLabel()})},onHide:e=>{e&&this.tree.domFocus()},getActionsContext:()=>({$treeViewId:this.id,$treeItemHandle:o.handle}),actionRunner:i})}updateMessage(){this._message?this.showMessage(this._message):this.dataProvider?this.hideMessage():this.showMessage(rc),this.updateContentAreas()}processMessage(e,t){let i=e.value.split("\n"),o=[],r=!1;for(let s of i){let i=(0,ro.parseLinkedText)(s);if(1===i.nodes.length&&"string"!=typeof i.nodes[0]){let e=i.nodes[0],s=(0,er.createElement)("div");s.classList.add("button-container");let n=new tq.Button(s,{title:e.title,secondary:r,supportIcons:!0,...t1.defaultButtonStyles});n.label=e.label,n.onDidClick(t=>{this.openerService.open(e.href,{allowCommands:!0})},null,t);let a=e$.URI.parse(e.href);if(a.scheme===tp.Schemas.command){let e=ra(a.path);e&&(n.enabled=this.contextKeyService.contextMatchesRules(e),t.add(this.contextKeyService.onDidChangeContext(t=>{t.affectsSome(new Set(e.keys()))&&(n.enabled=this.contextKeyService.contextMatchesRules(e))})))}t.add(n),r=!0,o.push(s)}else{r=!1;let i=this.markdownRendererService.render(new eh.MarkdownString(s,{isTrusted:e.isTrusted,supportThemeIcons:e.supportThemeIcons,supportHtml:e.supportHtml}));o.push(i.element),t.add(i)}}let s=(0,er.createElement)("div");for(let e of(s.classList.add("rendered-message"),o))(0,er.isHTMLElement)(e)?s.appendChild(e):s.appendChild(e.element);return s}showMessage(e){if(rl(this._messageValue)&&this._messageValue.disposables.dispose(),(0,eh.isMarkdownString)(e)){let t=new oW.DisposableStore,i=this.processMessage(e,t);this._messageValue={element:i,disposables:t}}else this._messageValue=e;this.messageElement&&(this.messageElement.classList.remove("hide"),this.resetMessageElement(),"string"!=typeof this._messageValue||(0,iu.isFalsyOrWhitespace)(this._messageValue)?rl(this._messageValue)&&this.messageElement.appendChild(this._messageValue.element):this.messageElement.textContent=this._messageValue,this.layout(this._height,this._width))}hideMessage(){this.resetMessageElement(),this.messageElement?.classList.add("hide"),this.layout(this._height,this._width)}resetMessageElement(){this.messageElement&&(0,er.clearNode)(this.messageElement)}layout(e,t){if(e&&t&&this.messageElement&&this.treeContainer){this._height=e,this._width=t;let i=e-(0,er.getTotalHeight)(this.messageElement);this.treeContainer.style.height=i+"px",this.tree?.layout(i,t)}}getOptimalWidth(){if(this.tree){let e=this.tree.getHTMLElement(),t=[].slice.call(e.querySelectorAll(".outline-item-label > a"));return(0,er.getLargestChildWidth)(e,t)}return 0}updateCheckboxes(e){return rE(e)}async refresh(e,t){if(this.dataProvider&&this.tree){for(let t of(this.refreshing&&await ec.Event.toPromise(this._onDidCompleteRefresh.event),e||(e=[this.root],this.elementsToRefresh=[]),e))t.children=void 0;if(this.isVisible){let i=this.updateCheckboxes(t??[]);return this.doRefresh(e.concat(i))}if(this.elementsToRefresh.length){let t=new Set;for(let i of(this.elementsToRefresh.forEach(e=>t.add(e.handle)),e))t.has(i.handle)||this.elementsToRefresh.push(i)}else this.elementsToRefresh.push(...e)}}async expand(e){let t=this.tree;if(t)try{for(let i of e=Array.isArray(e)?e:[e])await t.expand(i,!1)}catch(e){}}isCollapsed(e){return!!this.tree?.isCollapsed(e)}setSelection(e){this.tree?.setSelection(e)}getSelection(){return this.tree?.getSelection()??[]}setFocus(e){this.tree&&(e?(this.focus(!0,e),this.tree.setFocus([e])):0===this.tree.getFocus().length&&this.tree.setFocus([]))}async reveal(e){if(this.tree)return this.tree.reveal(e)}async doRefresh(e){let t=this.tree;if(t&&this.visible){this.refreshing=!0;let i=t.getSelection();try{await Promise.all(e.map(e=>t.updateChildren(e,!0,!0)))}catch(e){this.logService.error(e)}let o=t.getSelection();(i.length!==o.length||i.some((e,t)=>e.handle!==o[t].handle))&&(this.lastSelection=o,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive})),this.refreshing=!1,this._onDidCompleteRefresh.fire(),this.updateContentAreas(),this.focused&&this.focus(!1),this.updateCollapseAllToggle()}}initializeCollapseAllToggle(){this.collapseAllToggleContext||(this.collapseAllToggleContextKey=new eV.RawContextKey(`treeView.${this.id}.toggleCollapseAll`,!1,(0,ev.localize)(3695,"Whether collapse all is toggled for the tree view with id {0}.",this.id)),this.collapseAllToggleContext=this.collapseAllToggleContextKey.bindTo(this.contextKeyService))}updateCollapseAllToggle(){this.showCollapseAllAction&&(this.initializeCollapseAllToggle(),this.collapseAllToggleContext?.set(!!this.root.children&&this.root.children.length>0&&this.root.children.some(e=>e.collapsibleState!==ek.TreeItemCollapsibleState.None)))}updateContentAreas(){let e=!this.root.children||0===this.root.children.length;this._messageValue&&e&&!this.refreshing&&this.treeContainer?(this.dragAndDropController||this.treeContainer.classList.add("hide"),this.domNode.setAttribute("tabindex","0")):this.treeContainer&&(this.treeContainer.classList.remove("hide"),this.domNode===(0,er.getActiveElement)()&&this.focus(),this.domNode.removeAttribute("tabindex"))}get container(){return this._container}};rp=(0,ei.__decorate)([(0,ei.__param)(2,eW.IThemeService),(0,ei.__param)(3,eD.IInstantiationService),(0,ei.__param)(4,o$.ICommandService),(0,ei.__param)(5,ey.IConfigurationService),(0,ei.__param)(6,oj.IProgressService),(0,ei.__param)(7,eC.IContextMenuService),(0,ei.__param)(8,tX.IKeybindingService),(0,ei.__param)(9,oY.INotificationService),(0,ei.__param)(10,eM.IViewDescriptorService),(0,ei.__param)(11,tj.IHoverService),(0,ei.__param)(12,eK.IContextKeyService),(0,ei.__param)(13,o1.IActivityService),(0,ei.__param)(14,eX.ILogService),(0,ei.__param)(15,tQ.IOpenerService),(0,ei.__param)(16,ri.IMarkdownRendererService)],rp);class rg{getId(e){return e.handle}}class rm{getHeight(e){return rC.ITEM_HEIGHT}getTemplateId(e){return rC.TREE_TEMPLATE_ID}}async function rv(e,t){return e.getChildrenBatch?e.getChildrenBatch(t):t?Promise.all(t.map(t=>e.getChildren(t).then(e=>e??[]))):[await e.getChildren()].filter(e=>void 0!==e)}class ry{constructor(e,t){this.treeView=e,this.withProgress=t}hasChildren(e){return!!this.treeView.dataProvider&&e.collapsibleState!==ek.TreeItemCollapsibleState.None}async getChildren(e){let t=this.treeView.dataProvider;if(!t)return[];void 0===this.batch?(this.batch=[e],this.batchPromise=void 0):this.batch.push(e);let i=this.batch.length-1;return new Promise((e,o)=>{setTimeout(async()=>{let r=this.batch;this.batch=void 0,this.batchPromise||(this.batchPromise=this.withProgress(rv(t,r)));try{let t=await this.batchPromise;e(t&&i<t.length?t[i]:[])}catch(e){e.message.startsWith("Bad progress location:")||o(e)}},0)})}}let rC=class extends oW.Disposable{static{k=this}static{this.ITEM_HEIGHT=22}static{this.TREE_TEMPLATE_ID="treeExplorer"}constructor(e,t,i,o,r,s,n,a,d,l,c,h,u){super(),this.treeViewId=e,this.menus=t,this.labels=i,this.actionViewItemProvider=o,this.aligner=r,this.checkboxStateHandler=s,this.manuallyManageCheckboxes=n,this.themeService=a,this.configurationService=d,this.labelService=l,this.contextKeyService=c,this.hoverService=h,this._onDidChangeCheckboxState=this._register(new ec.Emitter),this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event,this._onDidChangeMenuContext=this._register(new ec.Emitter),this.onDidChangeMenuContext=this._onDidChangeMenuContext.event,this._hasCheckbox=!1,this._renderedElements=new Map,this._hoverDelegate=this._register(u.createInstance(o2.WorkbenchHoverDelegate,"mouse",void 0,{})),this._register(this.themeService.onDidFileIconThemeChange(()=>this.rerender())),this._register(this.themeService.onDidColorThemeChange(()=>this.rerender())),this._register(s.onDidChangeCheckboxState(e=>{this.updateCheckboxes(e)})),this._register(this.contextKeyService.onDidChangeContext(e=>this.onDidChangeContext(e)))}get templateId(){return k.TREE_TEMPLATE_ID}set actionRunner(e){this._actionRunner=e}renderTemplate(e){e.classList.add("custom-view-tree-node-item");let t=(0,er.append)(e,(0,er.$)("")),i=this.labels.create(e,{supportHighlights:!0,hoverDelegate:this._hoverDelegate}),o=(0,er.prepend)(i.element,(0,er.$)(".custom-view-tree-node-item-icon")),r=(0,er.append)(i.element,(0,er.$)(".actions"));return{resourceLabel:i,icon:o,checkboxContainer:t,actionBar:new oV.ActionBar(r,{actionViewItemProvider:this.actionViewItemProvider}),container:e}}getHover(e,t,i){if(!(i instanceof ek.ResolvableTreeItem)||!i.hasResolve)if(t&&!i.tooltip)return;else if(void 0===i.tooltip)if((0,eh.isMarkdownString)(e))return{markdown:e,markdownNotSupportedFallback:e.value};else return e;else if(!(0,eN.isString)(i.tooltip))return{markdown:i.tooltip,markdownNotSupportedFallback:t?void 0:(0,oP.renderAsPlaintext)(i.tooltip)};else if(""!==i.tooltip)return i.tooltip;else return;return{markdown:"string"==typeof i.tooltip?i.tooltip:e=>new Promise(t=>{i.resolve(e).then(()=>t(i.tooltip))}),markdownNotSupportedFallback:t?void 0:e?(0,eh.isMarkdownString)(e)?e.value:e:""}}processLabel(e,t){if(!(0,eh.isMarkdownString)(e))return{label:e};let i=e.value.trim(),o=!1,r=!1,s=!1,n=[{open:"~~",close:"~~",mark:()=>{s=!0}},{open:"**",close:"**",mark:()=>{o=!0}},{open:"*",close:"*",mark:()=>{r=!0}},{open:"_",close:"_",mark:()=>{r=!0}}];for(let e=0;e<10&&function(){let e=!1;for(let r of n)if(i.startsWith(r.open)&&i.endsWith(r.close)){if(t?.some(e=>e.start<r.open.length||e.end>i.length-r.close.length))return!1;r.mark(),i=i.substring(r.open.length,i.length-r.close.length);var o=r.open.length;if(t)for(let e of t)e.start-=o,e.end-=o;e=!0}return e}();e++);return{label:i,bold:o,italic:r,strikethrough:s,supportIcons:e.supportThemeIcons}}renderElement(e,t,i){let o=e.element,r=o.resourceUri?e$.URI.revive(o.resourceUri):null,s=o.label?o.label:r?{label:(0,t9.basename)(r)}:void 0,n=(0,eN.isString)(o.description)?o.description:r&&!0===o.description?this.labelService.getUriLabel((0,t9.dirname)(r),{relative:!0}):void 0,a=s?(0,eh.isMarkdownString)(s.label)?s.label.value:s.label:void 0,d=s?.highlights&&a?s.highlights.map(([e,t])=>{if(e<0&&(e=a.length+e),t<0&&(t=a.length+t),e>=a.length||t>a.length)return{start:0,end:0};if(e>t){let i=e;e=t,t=i}return{start:e,end:t}}):void 0,{label:l,bold:c,italic:h,strikethrough:u,supportIcons:p}=this.processLabel(s?.label,d),g=(0,oX.isDark)(this.themeService.getColorTheme().type)?o.iconDark:o.icon,m=g?e$.URI.revive(g):void 0,v=this.getHover(s?.label,r,o);i.actionBar.clear(),i.icon.style.color="";let y=!0;if(o.command&&(y=rd(o.command,this.contextKeyService)),this.renderCheckbox(o,i),r){let t=this.configurationService.getValue("explorer.decorations"),s=r||e$.URI.parse("missing:_icon_resource");i.resourceLabel.setResource({name:l,description:n,resource:s},{fileKind:this.getFileKind(o),title:v,hideIcon:this.shouldHideResourceLabelIcon(m,o.themeIcon),fileDecorations:t,extraClasses:["custom-view-tree-node-item-resourceLabel"],matches:d||(0,id.createMatches)(e.filterData),bold:c,italic:h,strikethrough:u,disabledCommand:!y,labelEscapeNewLines:!0,forceLabel:!!o.label,supportIcons:p})}else i.resourceLabel.setResource({name:l,description:n},{title:v,hideIcon:!0,extraClasses:["custom-view-tree-node-item-resourceLabel"],matches:d||(0,id.createMatches)(e.filterData),bold:c,italic:h,strikethrough:u,disabledCommand:!y,labelEscapeNewLines:!0,supportIcons:p});if(m)i.icon.className="custom-view-tree-node-item-icon",i.icon.style.backgroundImage=(0,ig.asCSSUrl)(m);else{let e;this.shouldShowThemeIcon(!!r,o.themeIcon)&&(e=ih.ThemeIcon.asClassName(o.themeIcon),o.themeIcon.color&&(i.icon.style.color=this.themeService.getColorTheme().getColor(o.themeIcon.color.id)?.toString()??"")),i.icon.className=e?`custom-view-tree-node-item-icon ${e}`:"",i.icon.style.backgroundImage=""}!y&&(i.icon.className=i.icon.className+" disabled",i.container.parentElement&&(i.container.parentElement.className=i.container.parentElement.className+" disabled")),i.actionBar.context={$treeViewId:this.treeViewId,$treeItemHandle:o.handle};let C=this.menus.getResourceActions([o]);i.actionBar.push(C,{icon:!0,label:!1}),this._actionRunner&&(i.actionBar.actionRunner=this._actionRunner),this.setAlignment(i.container,o);let b=this._renderedElements.get(e.element.handle)??[];this._renderedElements.set(e.element.handle,[...b,{original:e,rendered:i}])}rerender(){for(let e of new Set(this._renderedElements.keys()))for(let t of this._renderedElements.get(e)??[])this.disposeElement(t.original,0,t.rendered),this.renderElement(t.original,0,t.rendered)}renderCheckbox(e,t){if(e.checkbox){if(this._hasCheckbox||(this._hasCheckbox=!0,this.rerender()),!t.checkbox){let e=new o8(t.checkboxContainer,this.checkboxStateHandler,this._hoverDelegate,this.hoverService);t.checkbox=e}t.checkbox.render(e)}else t.checkbox&&(t.checkbox.dispose(),t.checkbox=void 0)}setAlignment(e,t){e.parentElement.classList.toggle("align-icon-with-twisty",this.aligner.alignIconWithTwisty(t))}shouldHideResourceLabelIcon(e,t){return!!e||!!t&&!this.isFileKindThemeIcon(t)}shouldShowThemeIcon(e,t){return!!t&&!(e&&this.isFileKindThemeIcon(t))}isFileKindThemeIcon(e){return ih.ThemeIcon.isFile(e)||ih.ThemeIcon.isFolder(e)}getFileKind(e){if(e.themeIcon)switch(e.themeIcon.id){case iX.FileThemeIcon.id:return td.FileKind.FILE;case iX.FolderThemeIcon.id:return td.FileKind.FOLDER}return e.collapsibleState===ek.TreeItemCollapsibleState.Collapsed||e.collapsibleState===ek.TreeItemCollapsibleState.Expanded?td.FileKind.FOLDER:td.FileKind.FILE}onDidChangeContext(e){let t=e.affectsSome(this.menus.getEntireMenuContexts()),i=[];for(let[o,r]of this._renderedElements)for(let o of r)(t||e.affectsSome(this.menus.getElementOverlayContexts(o.original.element)))&&i.push(o.original.element);i.length&&this._onDidChangeMenuContext.fire(i)}updateCheckboxes(e){let t=[];(t=this.manuallyManageCheckboxes()?e:rE(e)).forEach(e=>{let t=this._renderedElements.get(e.handle);t&&t.forEach(t=>t.rendered.checkbox?.render(e))}),this._onDidChangeCheckboxState.fire(t)}disposeElement(e,t,i){let o=this._renderedElements.get(e.element.handle)??[],r=o.findIndex(e=>i===e.rendered);1===o.length?this._renderedElements.delete(e.element.handle):o.length>0&&o.splice(r,1),i.checkbox?.dispose(),i.checkbox=void 0}disposeTemplate(e){e.resourceLabel.dispose(),e.actionBar.dispose()}};rC=k=(0,ei.__decorate)([(0,ei.__param)(7,eW.IThemeService),(0,ei.__param)(8,ey.IConfigurationService),(0,ei.__param)(9,tJ.ILabelService),(0,ei.__param)(10,eK.IContextKeyService),(0,ei.__param)(11,tj.IHoverService),(0,ei.__param)(12,eD.IInstantiationService)],rC);class rb extends oW.Disposable{constructor(e,t){super(),this.themeService=e,this.logService=t}set tree(e){this._tree=e}alignIconWithTwisty(e){if(e.collapsibleState!==ek.TreeItemCollapsibleState.None||!this.hasIconOrCheckbox(e)||!this._tree)return!1;{let t,i=this._tree.getInput();try{t=this._tree.getParentElement(e)||i}catch(t){return this.logService.error(`[TreeView] Failed to resolve parent for ${e.handle}`,t),!1}return this.hasIconOrCheckbox(t)?!!t.children&&t.children.some(e=>e.collapsibleState!==ek.TreeItemCollapsibleState.None&&!this.hasIconOrCheckbox(e)):!!t.children&&t.children.every(e=>e.collapsibleState===ek.TreeItemCollapsibleState.None||!this.hasIconOrCheckbox(e))}}hasIconOrCheckbox(e){return this.hasIcon(e)||!!e.checkbox}hasIcon(e){if((0,oX.isDark)(this.themeService.getColorTheme().type)?e.iconDark:e.icon)return!0;if(e.resourceUri||e.themeIcon){let t=this.themeService.getFileIconTheme();return(e.themeIcon?e.themeIcon.id===iX.FolderThemeIcon.id:e.collapsibleState!==ek.TreeItemCollapsibleState.None)?t.hasFileIcons&&t.hasFolderIcons:t.hasFileIcons}return!1}}class rw extends oF.ActionRunner{constructor(e,t){super(),this.getSelectedResources=t,this._register(this.onDidRun(t=>{t.error&&!(0,el.isCancellationError)(t.error)&&e.error((0,ev.localize)(3696,"Error running command {1}: {0}. This is likely caused by the extension that contributes {1}.",t.error.message,t.action.id))}))}async runAction(e,t){let i,o=this.getSelectedResources(),r=!1;o.length>1&&(i=o.map(e=>((e.handle===t.$treeItemHandle||t.$selectedTreeItems)&&(r=!0),{$treeViewId:t.$treeViewId,$treeItemHandle:e.handle}))),!r&&i&&(i=void 0),await e.run(t,i)}}let rf=class{constructor(e,t){this.id=e,this.menuService=t,this._onDidChange=new ec.Emitter,this.onDidChange=this._onDidChange.event}getResourceActions(e){return this.getActions(this.getMenuId(),e).primary}getResourceContextActions(e){return this.getActions(this.getMenuId(),e).secondary}setContextKeyService(e){this.contextKeyService=e}filterNonUniversalActions(e,t){let i=new Set(t.map(e=>e.id));for(let t of e)for(let e of t.keys())i.has(e)||t.delete(e)}buildMenu(e){let t=[];for(let i of e)i.size>0&&(t.length&&t.push(new oF.Separator),t.push(...i.values()));return t}createGroups(e){let t=[],i=new Map;for(let o of e)o instanceof oF.Separator?(t.push(i),i=new Map):i.set(o.id,o);return t.push(i),t}getElementOverlayContexts(e){return new Map([["view",this.id],["viewItem",e.contextValue]])}getEntireMenuContexts(){return this.menuService.getMenuContexts(this.getMenuId())}getMenuId(){return oU.MenuId.ViewItemContext}getActions(e,t){if(!this.contextKeyService)return{primary:[],secondary:[]};let i=[],o=[];for(let r=0;r<t.length;r++){let s=t[r],n=this.contextKeyService.createOverlay(this.getElementOverlayContexts(s)),a=this.menuService.getMenuActions(e,n,{shouldForwardArgs:!0}),d=(0,i0.getContextMenuActions)(a,"inline");0===r?(i=this.createGroups(d.primary),o=this.createGroups(d.secondary)):(this.filterNonUniversalActions(i,d.primary),this.filterNonUniversalActions(o,d.secondary))}return{primary:this.buildMenu(i),secondary:this.buildMenu(o)}}dispose(){this.contextKeyService=void 0}};rf=(0,ei.__decorate)([(0,ei.__param)(1,iQ.IMenuService)],rf);let rS=class extends rp{constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p,g,m,v,y,C,b){super(e,t,o,r,s,n,a,d,l,c,h,p,u,m,y,C,b),this.extensionId=i,this.extensionService=g,this.telemetryService=v}activate(){this.activated||(this.telemetryService.publicLog2("Extension:ViewActivate",{extensionId:new o7.TelemetryTrustedValue(this.extensionId),id:this.id}),this.createTree(),this.progressService.withProgress({location:this.id},()=>this.extensionService.activateByEvent(`onView:${this.id}`)).then(()=>(0,ed.timeout)(2e3)).then(()=>{this.updateMessage()}),this.activated=!0)}};rS=(0,ei.__decorate)([(0,ei.__param)(3,eW.IThemeService),(0,ei.__param)(4,eD.IInstantiationService),(0,ei.__param)(5,o$.ICommandService),(0,ei.__param)(6,ey.IConfigurationService),(0,ei.__param)(7,oj.IProgressService),(0,ei.__param)(8,eC.IContextMenuService),(0,ei.__param)(9,tX.IKeybindingService),(0,ei.__param)(10,oY.INotificationService),(0,ei.__param)(11,eM.IViewDescriptorService),(0,ei.__param)(12,eK.IContextKeyService),(0,ei.__param)(13,tj.IHoverService),(0,ei.__param)(14,ez.IExtensionService),(0,ei.__param)(15,o1.IActivityService),(0,ei.__param)(16,ew.ITelemetryService),(0,ei.__param)(17,eX.ILogService),(0,ei.__param)(18,tQ.IOpenerService),(0,ei.__param)(19,ri.IMarkdownRendererService)],rS);let r_=class{constructor(e,t,i,o,r){this.treeId=e,this.labelService=t,this.instantiationService=i,this.treeViewsDragAndDropService=o,this.logService=r,this.treeItemsTransfer=o3.LocalSelectionTransfer.getInstance(),this.treeMimeType=`application/vnd.code.tree.${e.toLowerCase()}`}set controller(e){this.dndController=e}handleDragAndLog(e,t,i,o){return e.handleDrag(t,i,o).then(t=>{if(t){let i=[];for(let o of t)o[0]!==this.treeMimeType&&0>e.dragMimeTypes.findIndex(e=>e===o[0])&&i.push(o[0]);i.length&&this.logService.warn(`Drag and drop controller for tree ${this.treeId} adds the following data transfer types but does not declare them in dragMimeTypes: ${i.join(", ")}`)}return t})}addExtensionProvidedTransferTypes(e,t){if(!e.dataTransfer||!this.dndController)return;let i=(0,t7.generateUuid)();this.dragCancellationToken=new e8.CancellationTokenSource,this.treeViewsDragAndDropService.addDragOperationTransfer(i,this.handleDragAndLog(this.dndController,t,i,this.dragCancellationToken.token)),this.treeItemsTransfer.setData([new rt.DraggedTreeItemsIdentifier(i)],rt.DraggedTreeItemsIdentifier.prototype),e.dataTransfer.clearData(oz.Mimes.text),this.dndController.dragMimeTypes.find(e=>e===oz.Mimes.uriList)&&e.dataTransfer?.setData(oO.DataTransfers.RESOURCES,""),this.dndController.dragMimeTypes.forEach(t=>{e.dataTransfer?.setData(t,"")})}addResourceInfoToTransfer(e,t){if(t.length&&e.dataTransfer){this.instantiationService.invokeFunction(i=>(0,oJ.fillEditorsDragData)(i,t,e));let i=t.filter(e=>e.scheme===tp.Schemas.file).map(e=>e.fsPath);i.length&&e.dataTransfer.setData(o3.CodeDataTransfers.FILES,JSON.stringify(i))}}onDragStart(e,t){if(t.dataTransfer){let i=e.getData(),o=[],r={id:this.treeId,itemHandles:[]};i.forEach(e=>{r.itemHandles.push(e.handle),e.resourceUri&&o.push(e$.URI.revive(e.resourceUri))}),this.addResourceInfoToTransfer(t,o),this.addExtensionProvidedTransferTypes(t,r.itemHandles),t.dataTransfer.setData(this.treeMimeType,JSON.stringify(r))}}debugLog(e){e.size?this.logService.debug(`TreeView dragged mime types: ${Array.from(e).join(", ")}`):this.logService.debug("TreeView dragged with no supported mime types.")}onDragOver(e,t,i,o,r){let s=new Set(Array.from((0,o5.toExternalVSDataTransfer)(r.dataTransfer),e=>e[0]));if(r.dataTransfer){for(let e of r.dataTransfer.items)if("file"===e.kind||e.type===oO.DataTransfers.RESOURCES.toLowerCase()){s.add(oz.Mimes.uriList);break}}this.debugLog(s);let n=this.dndController;return!!n&&!!r.dataTransfer&&0!==n.dropMimeTypes.length&&!!Array.from(s).some((e,t)=>e===this.treeMimeType||n.dropMimeTypes.indexOf(e)>=0)&&{accept:!0,bubble:iZ.TreeDragOverBubble.Down,autoExpand:!0}}getDragURI(e){return this.dndController?e.resourceUri?e$.URI.revive(e.resourceUri).toString():e.handle:null}getDragLabel(e){if(!this.dndController)return;if(e.length>1)return String(e.length);let t=e[0];return t.label?(0,eh.isMarkdownString)(t.label.label)?t.label.label.value:t.label.label:t.resourceUri?this.labelService.getUriLabel(e$.URI.revive(t.resourceUri)):void 0}async drop(e,t,i,o,r){let s,n,a=this.dndController;if(!r.dataTransfer||!a)return;this.treeItemsTransfer.hasData(rt.DraggedTreeItemsIdentifier.prototype)&&(n=this.treeItemsTransfer.getData(rt.DraggedTreeItemsIdentifier.prototype)[0].identifier);let d=(0,o5.toExternalVSDataTransfer)(r.dataTransfer,!0),l=new oB.VSDataTransfer;for(let[e,t]of d)if((e===this.treeMimeType||a.dropMimeTypes.includes(e)||t.asFile()&&a.dropMimeTypes.includes(oO.DataTransfers.FILES.toLowerCase()))&&(l.append(e,t),e===this.treeMimeType))try{s=JSON.parse(await t.asString())}catch{}let c=await this.treeViewsDragAndDropService.removeDragOperationTransfer(n);if(c)for(let[e,t]of c)l.append(e,t);return a.handleDrop(l,t,e8.CancellationToken.None,n,s?.id,s?.itemHandles)}onDragEnd(e){e.dataTransfer?.dropEffect==="none"&&this.dragCancellationToken?.cancel()}dispose(){}};function rE(e){let t=[];for(let i of e)if(void 0!==i.checkbox){let e=i=>{for(let o of i.children??[])void 0!==o.checkbox&&void 0!==i.checkbox&&o.checkbox.isChecked!==i.checkbox.isChecked&&(o.checkbox.isChecked=i.checkbox.isChecked,t.push(o),e(o))};e(i);let o=new Set,r=e=>{if(e.parent?.checkbox!==void 0&&e.parent.children){if(o.has(e.parent))return;o.add(e.parent);let i=!1,s=!1;for(let t of e.parent.children){if(i&&s)break;void 0!==t.checkbox&&(t.checkbox.isChecked?s=!0:i=!0)}s&&!i&&!0!==e.parent.checkbox.isChecked?(e.parent.checkbox.isChecked=!0,t.push(e.parent),r(e.parent)):i&&!1!==e.parent.checkbox.isChecked&&(e.parent.checkbox.isChecked=!1,t.push(e.parent),r(e.parent))}};r(i)}return e.concat(t)}r_=(0,ei.__decorate)([(0,ei.__param)(1,tJ.ILabelService),(0,ei.__param)(2,eD.IInstantiationService),(0,ei.__param)(3,re.ITreeViewsDnDService),(0,ei.__param)(4,eX.ILogService)],r_);var rI=e.i(423962),rD=e.i(51593),rT=eu,rA=e.i(47903),rx=e.i(488313),rR=e.i(628559),rk=e.i(13306),rM=e.i(428048),rL=eu,rO=e.i(95526),rP=e.i(216822),rV=e.i(795391),rK=e.i(537080),rN=t3,rG=e.i(914331),rF=e.i(806987);(0,iK.registerIcon)("remote-explorer-get-started",t8.Codicon.star,(0,ev.localize)(10268,"Getting started icon in the remote explorer view.")),(0,iK.registerIcon)("remote-explorer-documentation",t8.Codicon.book,(0,ev.localize)(10269,"Documentation icon in the remote explorer view.")),(0,iK.registerIcon)("remote-explorer-feedback",t8.Codicon.twitter,(0,ev.localize)(10270,"Feedback icon in the remote explorer view.")),(0,iK.registerIcon)("remote-explorer-review-issues",t8.Codicon.issues,(0,ev.localize)(10271,"Review issue icon in the remote explorer view.")),(0,iK.registerIcon)("remote-explorer-report-issues",t8.Codicon.comment,(0,ev.localize)(10272,"Report issue icon in the remote explorer view.")),(0,iK.registerIcon)("remote-explorer-view-icon",t8.Codicon.remoteExplorer,(0,ev.localize)(10273,"View icon of the remote explorer view."));let rW=(0,iK.registerIcon)("ports-view-icon",t8.Codicon.plug,(0,ev.localize)(10274,"View icon of the remote ports view."));(0,iK.registerIcon)("ports-view-icon",t8.Codicon.plug,(0,ev.localize)(10275,"Icon representing a remote port."));let rz=(0,iK.registerIcon)("private-ports-view-icon",t8.Codicon.lock,(0,ev.localize)(10276,"Icon representing a private remote port.")),rB=(0,iK.registerIcon)("ports-forward-icon",t8.Codicon.plus,(0,ev.localize)(10277,"Icon for the forward action.")),rU=(0,iK.registerIcon)("ports-stop-forward-icon",t8.Codicon.x,(0,ev.localize)(10278,"Icon for the stop forwarding action.")),rH=(0,iK.registerIcon)("ports-open-browser-icon",t8.Codicon.globe,(0,ev.localize)(10279,"Icon for the open browser action.")),r$=(0,iK.registerIcon)("ports-open-preview-icon",t8.Codicon.openPreview,(0,ev.localize)(10280,"Icon for the open preview action.")),rq=(0,iK.registerIcon)("ports-copy-address-icon",t8.Codicon.clippy,(0,ev.localize)(10281,"Icon for the copy local address action.")),rY=(0,iK.registerIcon)("ports-label-icon",t8.Codicon.tag,(0,ev.localize)(10282,"Icon for the label port action.")),rj=(0,iK.registerIcon)("ports-forwarded-without-process-icon",t8.Codicon.circleOutline,(0,ev.localize)(10283,"Icon for forwarded ports that don't have a running process.")),rX=(0,iK.registerIcon)("ports-forwarded-with-process-icon",t8.Codicon.circleFilled,(0,ev.localize)(10284,"Icon for forwarded ports that do have a running process."));var rJ=e.i(399108),rZ=e.i(575129),rQ=e.i(698014);e.i(140331);var r0=e.i(471999),r1=e.i(900329),r2=e.i(785266);e.i(181268),e.i(70177),e.i(575210),e.i(890787),e.i(67920);var r3=e.i(428521),r5=e.i(841203);(0,t$.registerCss)(void 0);let r6=new eV.RawContextKey("openPreviewEnabled",!1);class r4{constructor(e){this.remoteExplorerService=e,this.headerRowHeight=22}getHeight(e){return e.tunnelType!==rA.TunnelType.Add||this.remoteExplorerService.getEditableData(void 0)?22:30}}let r9=class{constructor(e,t){this.remoteExplorerService=e,this.tunnelService=t,this._candidates=new Map,this.input={label:(0,ev.localize)(10314,"Add Port"),icon:void 0,tunnelType:rA.TunnelType.Add,hasRunningProcess:!1,remoteHost:"",remotePort:0,processDescription:"",tooltipPostfix:"",iconTooltip:"",portTooltip:"",processTooltip:"",originTooltip:"",privacyTooltip:"",source:{source:rR.TunnelSource.User,description:""},protocol:rG.TunnelProtocol.Http,privacy:{id:rG.TunnelPrivacyId.Private,themeIcon:rz.id,label:(0,ev.localize)(10315,"Private")},strip:()=>void 0},this.model=e.tunnelModel,this.onForwardedPortsChanged=ec.Event.any(this.model.onForwardPort,this.model.onClosePort,this.model.onPortName,this.model.onCandidatesChanged)}get all(){let e=[];return this._candidates=new Map,this.model.candidates.forEach(e=>{this._candidates.set((0,rR.makeAddress)(e.host,e.port),e)}),(this.model.forwarded.size>0||this.remoteExplorerService.getEditableData(void 0))&&e.push(...this.forwarded),this.model.detected.size>0&&e.push(...this.detected),e.push(this.input),e}addProcessInfoFromCandidate(e){let t=(0,rR.makeAddress)(e.remoteHost,e.remotePort);this._candidates.has(t)&&(e.processDescription=this._candidates.get(t).detail)}get forwarded(){return Array.from(this.model.forwarded.values()).map(e=>{let t=sn.createFromTunnel(this.remoteExplorerService,this.tunnelService,e);return this.addProcessInfoFromCandidate(t),t}).sort((e,t)=>e.remotePort===t.remotePort?e.remoteHost<t.remoteHost?-1:1:e.remotePort<t.remotePort?-1:1)}get detected(){return Array.from(this.model.detected.values()).map(e=>{let t=sn.createFromTunnel(this.remoteExplorerService,this.tunnelService,e,rA.TunnelType.Detected,!1);return this.addProcessInfoFromCandidate(t),t})}isEmpty(){return 0===this.detected.length&&(0===this.forwarded.length||1===this.forwarded.length&&this.forwarded[0].tunnelType===rA.TunnelType.Add&&!this.remoteExplorerService.getEditableData(void 0))}};function r8(e){return{label:"",tunnel:e,editId:rA.TunnelEditId.None,tooltip:""}}r9=(0,ei.__decorate)([(0,ei.__param)(0,rx.IRemoteExplorerService),(0,ei.__param)(1,rF.ITunnelService)],r9);class r7{constructor(){this.label="",this.tooltip="",this.weight=1,this.minimumWidth=40,this.maximumWidth=40,this.templateId="actionbar"}project(e){if(e.tunnelType===rA.TunnelType.Add)return r8(e);let t=e.processDescription?rX:rj,i="";return e instanceof sn&&(i=`${e.iconTooltip} ${e.tooltipPostfix}`),{label:"",icon:t,tunnel:e,editId:rA.TunnelEditId.None,tooltip:i}}}class se{constructor(){this.label=(0,ev.localize)(10316,"Port"),this.tooltip=(0,ev.localize)(10317,"The label and remote port number of the forwarded port."),this.weight=1,this.templateId="actionbar"}project(e){let t=e.tunnelType===rA.TunnelType.Add,i=e.label,o="";return o=e instanceof sn&&!t?`${e.portTooltip} ${e.tooltipPostfix}`:i,{label:i,tunnel:e,menuId:eG.MenuId.TunnelPortInline,editId:e.tunnelType===rA.TunnelType.Add?rA.TunnelEditId.New:rA.TunnelEditId.Label,tooltip:o}}}class st{constructor(){this.label=(0,ev.localize)(10318,"Forwarded Address"),this.tooltip=(0,ev.localize)(10319,"The address that the forwarded port is available at."),this.weight=1,this.templateId="actionbar"}project(e){if(e.tunnelType===rA.TunnelType.Add)return r8(e);let t=e.localAddress??"",i=t;return e instanceof sn&&(i=e.tooltipPostfix),{label:t,menuId:eG.MenuId.TunnelLocalAddressInline,tunnel:e,editId:rA.TunnelEditId.LocalPort,tooltip:i,markdownTooltip:t?st.getHoverText(t):void 0}}static getHoverText(e){return function(t){let i=t.getValue("editor"),o="";o="ctrlCmd"===i.multiCursorModifier?eg.isMacintosh?(0,ev.localize)(10320,"option + click"):(0,ev.localize)(10321,"alt + click"):eg.isMacintosh?(0,ev.localize)(10322,"cmd + click"):(0,ev.localize)(10323,"ctrl + click");let r=new eh.MarkdownString("",!0),s=e.startsWith("http")?e:`http://${e}`;return r.appendLink(s,"Follow link").appendMarkdown(` (${o})`)}}}class si{constructor(){this.label=(0,ev.localize)(10324,"Running Process"),this.tooltip=(0,ev.localize)(10325,"The command line of the process that is using the port."),this.weight=2,this.templateId="actionbar"}project(e){return e.tunnelType===rA.TunnelType.Add?r8(e):{label:e.processDescription??"",tunnel:e,editId:rA.TunnelEditId.None,tooltip:e instanceof sn?e.processTooltip:""}}}class so{constructor(){this.label=(0,ev.localize)(10326,"Origin"),this.tooltip=(0,ev.localize)(10327,"The source that a forwarded port originates from. Can be an extension, user forwarded, statically forwarded, or automatically forwarded."),this.weight=1,this.templateId="actionbar"}project(e){if(e.tunnelType===rA.TunnelType.Add)return r8(e);let t=e.source.description,i=`${e instanceof sn?e.originTooltip:""}. ${e instanceof sn?e.tooltipPostfix:""}`;return{label:t,menuId:eG.MenuId.TunnelOriginInline,tunnel:e,editId:rA.TunnelEditId.None,tooltip:i}}}class sr{constructor(){this.label=(0,ev.localize)(10328,"Visibility"),this.tooltip=(0,ev.localize)(10329,"The availability of the forwarded port."),this.weight=1,this.templateId="actionbar"}project(e){if(e.tunnelType===rA.TunnelType.Add)return r8(e);let t=e.privacy?.label,i="";return e instanceof sn&&(i=`${e.privacy.label} ${e.tooltipPostfix}`),{label:t,tunnel:e,icon:{id:e.privacy.themeIcon},editId:rA.TunnelEditId.None,tooltip:i}}}let ss=class extends rL.Disposable{constructor(e,t,i,o,r,s,n){super(),this.instantiationService=e,this.contextKeyService=t,this.menuService=i,this.contextViewService=o,this.remoteExplorerService=r,this.commandService=s,this.configurationService=n,this.templateId="actionbar",this._hoverDelegate=(0,r5.getDefaultHoverDelegate)("mouse")}set actionRunner(e){this._actionRunner=e}renderTemplate(e){let t=(0,er.append)(e,(0,er.$)(".ports-view-actionbar-cell")),i=(0,er.append)(t,(0,er.$)(".ports-view-actionbar-cell-icon")),o=new ic.IconLabel(t,{supportHighlights:!0,hoverDelegate:this._hoverDelegate}),r=(0,er.append)(t,(0,er.$)(".actions"));return{label:o,icon:i,actionBar:new oV.ActionBar(r,{actionViewItemProvider:i0.createActionViewItem.bind(void 0,this.instantiationService),hoverDelegate:this._hoverDelegate}),container:t,elementDisposable:rL.Disposable.None}}renderElement(e,t,i){let o;i.actionBar.clear(),i.icon.className="ports-view-actionbar-cell-icon",i.icon.style.display="none",i.label.setLabel(""),i.label.element.style.display="none",i.container.style.height="22px",i.button&&(i.button.element.style.display="none",i.button.dispose()),i.container.style.paddingLeft="0px",i.elementDisposable.dispose(),e.editId===rA.TunnelEditId.New&&(o=this.remoteExplorerService.getEditableData(void 0))||(o=this.remoteExplorerService.getEditableData(e.tunnel,e.editId))?this.renderInputBox(i.container,o):e.tunnel.tunnelType===rA.TunnelType.Add&&e.menuId===eG.MenuId.TunnelPortInline?this.renderButton(e,i):this.renderActionBarItem(e,i)}renderButton(e,t){t.container.style.paddingLeft="7px",t.container.style.height="28px",t.button=this._register(new tq.Button(t.container,t1.defaultButtonStyles)),t.button.label=e.label,t.button.element.title=e.tooltip,this._register(t.button.onDidClick(()=>{this.commandService.executeCommand(O.INLINE_ID)}))}tunnelContext(e){let t;return e instanceof sn&&(t=e.strip()),t||(t={tunnelType:e.tunnelType,remoteHost:e.remoteHost,remotePort:e.remotePort,localAddress:e.localAddress,protocol:e.protocol,localUri:e.localUri,localPort:e.localPort,name:e.name,closeable:e.closeable,source:e.source,privacy:e.privacy,processDescription:e.processDescription,label:e.label}),t}renderActionBarItem(e,t){t.label.element.style.display="flex",t.label.setLabel(e.label,void 0,{title:e.markdownTooltip?{markdown:e.markdownTooltip(this.configurationService),markdownNotSupportedFallback:e.tooltip}:e.tooltip,extraClasses:e.menuId===eG.MenuId.TunnelLocalAddressInline?["ports-view-actionbar-cell-localaddress"]:void 0}),t.actionBar.context=this.tunnelContext(e.tunnel),t.container.style.paddingLeft="10px";let i=[["view",rA.TUNNEL_VIEW_ID],[sa.key,e.tunnel.tunnelType],[sd.key,e.tunnel.closeable],[sl.key,e.tunnel.privacy.id],[sh.key,e.tunnel.protocol]],o=this.contextKeyService.createOverlay(i),r=new rL.DisposableStore;if(t.elementDisposable=r,e.menuId){let i=r.add(this.menuService.createMenu(e.menuId,o)),s=(0,i0.getFlatActionBarActions)(i.getActions({shouldForwardArgs:!0}));if(s){let e=s.filter(e=>e.id.toLowerCase().indexOf("label")>=0);e.length>1&&(e.sort((e,t)=>e.label.length-t.label.length),e.pop(),s=s.filter(t=>0>e.indexOf(t))),t.actionBar.push(s,{icon:!0,label:!1}),this._actionRunner&&(t.actionBar.actionRunner=this._actionRunner)}}e.icon&&(t.icon.className=`ports-view-actionbar-cell-icon ${ih.ThemeIcon.asClassName(e.icon)}`,t.icon.title=e.tooltip,t.icon.style.display="inline")}renderInputBox(e,t){this.inputDone&&(this.inputDone(!1,!1),this.inputDone=void 0),e.style.paddingLeft="5px";let i=t.startingValue||"",o=new rV.InputBox(e,this.contextViewService,{ariaLabel:(0,ev.localize)(10330,"Press Enter to confirm or Escape to cancel."),validationOptions:{validation:e=>{let i=t.validationMessage(e);return i?{content:i.content,formatContent:!0,type:i.severity===em.default.Error?rV.MessageType.ERROR:rV.MessageType.INFO}:null}},placeholder:t.placeholder||"",inputBoxStyles:t1.defaultInputBoxStyles});o.value=i,o.focus(),o.select({start:0,end:t.startingValue?t.startingValue.length:0});let r=(0,rK.createSingleCallFunction)(async(e,i)=>{(0,rL.dispose)(s),this.inputDone&&(this.inputDone=void 0),o.element.style.display="none";let r=o.value;if(i)return t.onFinish(r,e)});this.inputDone=r;let s=[o,(0,er.addStandardDisposableListener)(o.inputElement,er.EventType.KEY_DOWN,async e=>e.equals(iO.KeyCode.Enter)?(e.stopPropagation(),o.validate()!==rV.MessageType.ERROR)?r(!0,!0):r(!1,!0):e.equals(iO.KeyCode.Escape)?(e.preventDefault(),e.stopPropagation(),r(!1,!0)):void 0),(0,er.addDisposableListener)(o.inputElement,er.EventType.BLUR,()=>r(o.validate()!==rV.MessageType.ERROR,!0))];return(0,rL.toDisposable)(()=>{r(!1,!1)})}disposeElement(e,t,i){i.elementDisposable.dispose()}disposeTemplate(e){e.label.dispose(),e.actionBar.dispose(),e.elementDisposable.dispose(),e.button?.dispose()}};ss=(0,ei.__decorate)([(0,ei.__param)(0,eD.IInstantiationService),(0,ei.__param)(1,eK.IContextKeyService),(0,ei.__param)(2,iQ.IMenuService),(0,ei.__param)(3,eC.IContextViewService),(0,ei.__param)(4,rx.IRemoteExplorerService),(0,ei.__param)(5,o$.ICommandService),(0,ei.__param)(6,ey.IConfigurationService)],ss);class sn{static createFromTunnel(e,t,i,o=rA.TunnelType.Forwarded,r){return new sn(o,i.remoteHost,i.remotePort,i.source,!!i.hasRunningProcess,i.protocol,i.localUri,i.localAddress,i.localPort,void 0===r?i.closeable:r,i.name,i.runningProcess,i.pid,i.privacy,e,t)}strip(){return new sn(this.tunnelType,this.remoteHost,this.remotePort,this.source,this.hasRunningProcess,this.protocol,this.localUri,this.localAddress,this.localPort,this.closeable,this.name,this.runningProcess,this.pid,this._privacy)}constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p,g,m){this.tunnelType=e,this.remoteHost=t,this.remotePort=i,this.source=o,this.hasRunningProcess=r,this.protocol=s,this.localUri=n,this.localAddress=a,this.localPort=d,this.closeable=l,this.name=c,this.runningProcess=h,this.pid=u,this._privacy=p,this.remoteExplorerService=g,this.tunnelService=m}get label(){if(this.tunnelType===rA.TunnelType.Add&&this.name)return this.name;let e=(0,rG.isLocalhost)(this.remoteHost)||(0,rG.isAllInterfaces)(this.remoteHost)?`${this.remotePort}`:`${this.remoteHost}:${this.remotePort}`;return this.name?`${this.name} (${e})`:e}set processDescription(e){this.runningProcess=e}get processDescription(){let e="";return this.runningProcess?(e=this.pid&&this.remoteExplorerService?.namedProcesses.has(this.pid)?this.remoteExplorerService.namedProcesses.get(this.pid):this.runningProcess.replace(/\0/g," ").trim(),this.pid&&(e+=` (${this.pid})`)):this.hasRunningProcess&&(e=(0,ev.localize)(10331,"Process information unavailable")),e}get tooltipPostfix(){return this.localAddress?(0,ev.localize)(10332,"Remote port {0}:{1} forwarded to local address {2}. ",this.remoteHost,this.remotePort,this.localAddress):(0,ev.localize)(10333,"Remote port {0}:{1} not forwarded. ",this.remoteHost,this.remotePort)}get iconTooltip(){return this.tunnelType!==rA.TunnelType.Add?`${this.processDescription?(0,ev.localize)(10334,"Port has running process."):(0,ev.localize)(10335,"No running process.")}`:this.label}get portTooltip(){return this.tunnelType!==rA.TunnelType.Add?`${this.name?(0,ev.localize)(10336,"Port labeled {0}. ",this.name):""}`:""}get processTooltip(){return this.processDescription??""}get originTooltip(){return this.source.description}get privacy(){return this.tunnelService?.privacyOptions?this.tunnelService?.privacyOptions.find(e=>e.id===this._privacy)??{id:"",themeIcon:t8.Codicon.question.id,label:(0,ev.localize)(10337,"Unknown")}:{id:rG.TunnelPrivacyId.Private,themeIcon:rz.id,label:(0,ev.localize)(10315,"Private")}}}let sa=new eV.RawContextKey("tunnelType",rA.TunnelType.Add,!0),sd=new eV.RawContextKey("tunnelCloseable",!1,!0),sl=new eV.RawContextKey("tunnelPrivacy",void 0,!0),sc=new eV.RawContextKey("tunnelPrivacyEnabled",!1,!0),sh=new eV.RawContextKey("tunnelProtocol",rG.TunnelProtocol.Http,!0),su=new eV.RawContextKey("tunnelViewFocus",!1,(0,ev.localize)(10338,"Whether the Ports view has focus.")),sp="tunnelViewSelection",sg=new eV.RawContextKey(sp,void 0,!0),sm="tunnelViewMultiSelection",sv=new eV.RawContextKey(sm,void 0,!0),sy=new eV.RawContextKey("portChangable",!1,!0),sC=new eV.RawContextKey("protocolChangable",!0,!0),sb=class extends rN.ViewPane{static{M=this}static{this.ID=rA.TUNNEL_VIEW_ID}static{this.TITLE=(0,ev.localize2)(10339,"Ports")}constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p,g,m,v){super(t,i,o,s,r,a,n,d,u,g),this.viewModel=e,this.quickInputService=l,this.commandService=c,this.menuService=h,this.remoteExplorerService=p,this.tunnelService=m,this.contextViewService=v,this.tableDisposables=this._register(new rL.DisposableStore),this.isEditing=!1,this.titleActions=[],this.lastFocus=[],this.height=0,this.width=0,this.tunnelTypeContext=sa.bindTo(r),this.tunnelCloseableContext=sd.bindTo(r),this.tunnelPrivacyContext=sl.bindTo(r),this.tunnelPrivacyEnabledContext=sc.bindTo(r),this.tunnelPrivacyEnabledContext.set(m.canChangePrivacy),this.protocolChangableContextKey=sC.bindTo(r),this.protocolChangableContextKey.set(m.canChangeProtocol),this.tunnelProtocolContext=sh.bindTo(r),this.tunnelViewFocusContext=su.bindTo(r),this.tunnelViewSelectionContext=sg.bindTo(r),this.tunnelViewMultiSelectionContext=sv.bindTo(r),this.portChangableContextKey=sy.bindTo(r);const y=this.contextKeyService.createOverlay([["view",M.ID]]),C=this._register(this.menuService.createMenu(eG.MenuId.TunnelTitle,y)),b=()=>{this.titleActions=(0,i0.getFlatActionBarActions)(C.getActions()),this.updateActions()};this._register(C.onDidChange(b)),b(),this._register((0,rL.toDisposable)(()=>{this.titleActions=[]})),this.registerPrivacyActions(),this._register(ec.Event.once(this.tunnelService.onAddedTunnelProvider)(()=>{let e=!1;!1===this.tunnelPrivacyEnabledContext.get()&&(this.tunnelPrivacyEnabledContext.set(m.canChangePrivacy),e=!0),!0===this.protocolChangableContextKey.get()&&(this.protocolChangableContextKey.set(m.canChangeProtocol),e=!0),e&&(b(),this.registerPrivacyActions(),this.createTable(),this.table?.layout(this.height,this.width))}))}registerPrivacyActions(){for(let e of this.tunnelService.privacyOptions){let t=`remote.tunnel.privacy${e.id}`;oH.CommandsRegistry.registerCommand(t,W.handler(e.id)),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelPrivacy,{order:0,command:{id:t,title:e.label,toggled:sl.isEqualTo(e.id)}})}}get portCount(){return this.remoteExplorerService.tunnelModel.forwarded.size+this.remoteExplorerService.tunnelModel.detected.size}createTable(){if(!this.panelContainer)return;this.tableDisposables.clear(),(0,er.clearNode)(this.panelContainer);let e=(0,er.append)(this.panelContainer,(0,er.$)(".customview-tree"));e.classList.add("ports-view"),e.classList.add("file-icon-themable-tree","show-file-icons");let t=new ss(this.instantiationService,this.contextKeyService,this.menuService,this.contextViewService,this.remoteExplorerService,this.commandService,this.configurationService),i=[new r7,new se,new st,new si];this.tunnelService.canChangePrivacy&&i.push(new sr),i.push(new so),this.table=this.instantiationService.createInstance(tZ.WorkbenchTable,"RemoteTunnels",e,new r4(this.remoteExplorerService),i,[t],{keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:e=>e.label},multipleSelectionSupport:!0,accessibilityProvider:{getAriaLabel:e=>e instanceof sn?`${e.tooltipPostfix} ${e.portTooltip} ${e.iconTooltip} ${e.processTooltip} ${e.originTooltip} ${this.tunnelService.canChangePrivacy?e.privacy.label:""}`:e.label,getWidgetAriaLabel:()=>(0,ev.localize)(10340,"Tunnel View")},openOnSingleClick:!0});let o=this.tableDisposables.add(new oN.ActionRunner);t.actionRunner=o,this.tableDisposables.add(this.table),this.tableDisposables.add(this.table.onContextMenu(e=>this.onContextMenu(e,o))),this.tableDisposables.add(this.table.onMouseDblClick(e=>this.onMouseDblClick(e))),this.tableDisposables.add(this.table.onDidChangeFocus(e=>this.onFocusChanged(e))),this.tableDisposables.add(this.table.onDidChangeSelection(e=>this.onSelectionChanged(e))),this.tableDisposables.add(this.table.onDidFocus(()=>this.tunnelViewFocusContext.set(!0))),this.tableDisposables.add(this.table.onDidBlur(()=>this.tunnelViewFocusContext.set(!1)));let r=()=>this.table?.splice(0,1/0,this.viewModel.all);r();let s=this.portCount;this.tableDisposables.add(ec.Event.debounce(this.viewModel.onForwardedPortsChanged,(e,t)=>t,50)(()=>{let e=this.portCount;(0===s||0===e)&&s!==e&&this._onDidChangeViewWelcomeState.fire(),s=e,r()})),this.tableDisposables.add(this.table.onMouseClick(e=>{if(this.hasOpenLinkModifier(e.browserEvent)&&this.table){let t=this.table.getSelectedElements();(0===t.length||1===t.length&&t[0]===e.element)&&this.commandService.executeCommand(V.ID,e.element)}})),this.tableDisposables.add(this.table.onDidOpen(e=>{e.element&&e.element.tunnelType===rA.TunnelType.Forwarded&&e.browserEvent?.type==="dblclick"&&this.commandService.executeCommand(L.ID)})),this.tableDisposables.add(this.remoteExplorerService.onDidChangeEditable(t=>{this.isEditing=!!this.remoteExplorerService.getEditableData(t?.tunnel,t?.editId),this._onDidChangeViewWelcomeState.fire(),this.isEditing||e.classList.remove("highlight"),r(),this.isEditing?(e.classList.add("highlight"),t||this.table?.reveal(this.table.indexOf(this.viewModel.input))):(t&&t.tunnel.tunnelType!==rA.TunnelType.Add&&this.table?.setFocus(this.lastFocus),this.focus())}))}renderBody(e){super.renderBody(e),this.panelContainer=(0,er.append)(e,(0,er.$)(".tree-explorer-viewlet-tree-view")),this.createTable()}shouldShowWelcome(){return this.viewModel.isEmpty()&&!this.isEditing}focus(){super.focus(),this.table?.domFocus()}onFocusChanged(e){e.indexes.length>0&&e.elements.length>0&&(this.lastFocus=[...e.indexes]);let t=e.elements,i=t&&t.length?t[0]:void 0;i?(this.tunnelViewSelectionContext.set((0,rR.makeAddress)(i.remoteHost,i.remotePort)),this.tunnelTypeContext.set(i.tunnelType),this.tunnelCloseableContext.set(!!i.closeable),this.tunnelPrivacyContext.set(i.privacy.id),this.tunnelProtocolContext.set((i.protocol===rG.TunnelProtocol.Https,rG.TunnelProtocol.Https)),this.portChangableContextKey.set(!!i.localPort)):(this.tunnelTypeContext.reset(),this.tunnelViewSelectionContext.reset(),this.tunnelCloseableContext.reset(),this.tunnelPrivacyContext.reset(),this.tunnelProtocolContext.reset(),this.portChangableContextKey.reset())}hasOpenLinkModifier(e){let t=this.configurationService.getValue("editor");return"ctrlCmd"===t.multiCursorModifier?e.altKey:eg.isMacintosh?e.metaKey:e.ctrlKey}onSelectionChanged(e){let t=e.elements;t.length>1?this.tunnelViewMultiSelectionContext.set(t.map(e=>(0,rR.makeAddress)(e.remoteHost,e.remotePort))):this.tunnelViewMultiSelectionContext.set(void 0)}onContextMenu(e,t){if(void 0!==e.element&&!(e.element instanceof sn))return;e.browserEvent.preventDefault(),e.browserEvent.stopPropagation();let i=e.element;i?(this.table?.setFocus([this.table.indexOf(i)]),this.tunnelTypeContext.set(i.tunnelType),this.tunnelCloseableContext.set(!!i.closeable),this.tunnelPrivacyContext.set(i.privacy.id),this.tunnelProtocolContext.set(i.protocol),this.portChangableContextKey.set(!!i.localPort)):(this.tunnelTypeContext.set(rA.TunnelType.Add),this.tunnelCloseableContext.set(!1),this.tunnelPrivacyContext.set(void 0),this.tunnelProtocolContext.set(void 0),this.portChangableContextKey.set(!1)),this.contextMenuService.showContextMenu({menuId:eG.MenuId.TunnelContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:this.table?.contextKeyService,getAnchor:()=>e.anchor,getActionViewItem:e=>{let t=this.keybindingService.lookupKeybinding(e.id);if(t)return new oK.ActionViewItem(e,e,{label:!0,keybinding:t.getLabel()})},onHide:e=>{e&&this.table?.domFocus()},getActionsContext:()=>i?.strip(),actionRunner:t})}onMouseDblClick(e){e.element||this.commandService.executeCommand(O.INLINE_ID)}layoutBody(e,t){this.height=e,this.width=t,super.layoutBody(e,t),this.table?.layout(e,t)}};sb=M=(0,ei.__decorate)([(0,ei.__param)(2,tX.IKeybindingService),(0,ei.__param)(3,eC.IContextMenuService),(0,ei.__param)(4,eK.IContextKeyService),(0,ei.__param)(5,ey.IConfigurationService),(0,ei.__param)(6,eD.IInstantiationService),(0,ei.__param)(7,eM.IViewDescriptorService),(0,ei.__param)(8,tQ.IOpenerService),(0,ei.__param)(9,rM.IQuickInputService),(0,ei.__param)(10,o$.ICommandService),(0,ei.__param)(11,iQ.IMenuService),(0,ei.__param)(12,eW.IThemeService),(0,ei.__param)(13,rx.IRemoteExplorerService),(0,ei.__param)(14,tj.IHoverService),(0,ei.__param)(15,rF.ITunnelService),(0,ei.__param)(16,eC.IContextViewService)],sb);class sw{constructor(e,t){this.id=sb.ID,this.name=sb.TITLE,this.canToggleVisibility=!0,this.hideByDefault=!1,this.group="details@0",this.order=-500,this.canMoveView=!0,this.containerIcon=rW,this.ctorDescriptor=new e4.SyncDescriptor(sb,[e]),this.remoteAuthority=t.remoteAuthority?t.remoteAuthority.split("+")[0]:void 0}}function sf(e){return e&&e.tunnelType&&e.remoteHost&&e.source}(n=L||(L={})).ID="remote.tunnel.label",n.LABEL=(0,ev.localize)(10341,"Set Port Label"),n.COMMAND_ID_KEYWORD="label",n.handler=function(){return async(e,t)=>{let i,o=e.get(rx.IRemoteExplorerService);if(sf(t))i=t;else{let t=e.get(eK.IContextKeyService).getContextKeyValue(sp),r=t?o.tunnelModel.forwarded.get(t):void 0;if(r){let t=e.get(rF.ITunnelService);i=sn.createFromTunnel(o,t,r)}}if(i){let e=i;return new Promise(t=>{let i=e.name?e.name:`${e.remotePort}`;o.setEditable(e,rA.TunnelEditId.Label,{onFinish:async(r,s)=>{r=r.trim(),o.setEditable(e,rA.TunnelEditId.Label,null);let n=s&&r!==i;n&&await o.tunnelModel.name(e.remoteHost,e.remotePort,r),t(n?{port:e.remotePort,label:r}:void 0)},validationMessage:()=>null,placeholder:(0,ev.localize)(10342,"Port label"),startingValue:i})})}}};let sS=(0,ev.localize)(10343,"Forwarded port should be a number or a host:port."),s_=(0,ev.localize)(10344,"Port number must be ≥ 0 and < {0}.",65536),sE=(0,ev.localize)(10345,"May Require Sudo"),sI=(0,ev.localize)(10346,"Port is already forwarded");function sD(e,t,i){let o=e.map(e=>{let o=sn.createFromTunnel(t,i,e);return{label:o.label,description:o.processDescription,tunnel:o}});return 0===o.length&&o.push({label:(0,ev.localize)(10352,"No ports currently forwarded. Try running the {0} command",O.LABEL.value)}),o}!function(e){e.INLINE_ID="remote.tunnel.forwardInline",e.COMMANDPALETTE_ID="remote.tunnel.forwardCommandPalette",e.LABEL=(0,ev.localize2)(10347,"Forward a Port"),e.TREEITEM_LABEL=(0,ev.localize)(10348,"Forward Port");let t=(0,ev.localize)(10349,"Port number or address (eg. 3000 or 10.10.10.10:2000).");function i(e,t,i,o){let r=(0,rR.parseAddress)(i);return r?r.port>=65536?{content:s_,severity:em.default.Error}:o&&t.isPortPrivileged(r.port)?{content:sE,severity:em.default.Info}:(0,rR.mapHasAddressLocalhostOrAllInterfaces)(e.tunnelModel.forwarded,r.host,r.port)?{content:sI,severity:em.default.Error}:null:{content:sS,severity:em.default.Error}}function o(e,t,i,o){t?"string"==typeof t&&e.warn((0,ev.localize)(10351,"Unable to forward {0}:{1}. {2}",i,o,t)):e.warn((0,ev.localize)(10350,"Unable to forward {0}:{1}. The host may not be available or that remote port may already be forwarded",i,o))}e.inlineHandler=function(){return async(e,r)=>{let s=e.get(rx.IRemoteExplorerService),n=e.get(oY.INotificationService),a=e.get(rF.ITunnelService);s.setEditable(void 0,rA.TunnelEditId.New,{onFinish:async(e,t)=>{let i;s.setEditable(void 0,rA.TunnelEditId.New,null),t&&(i=(0,rR.parseAddress)(e))&&s.forward({remote:{host:i.host,port:i.port},elevateIfNeeded:!0}).then(e=>o(n,e,i.host,i.port))},validationMessage:e=>i(s,a,e,a.canElevate),placeholder:t})}},e.commandPaletteHandler=function(){return async(e,r)=>{let s,n=e.get(rx.IRemoteExplorerService),a=e.get(oY.INotificationService),d=e.get(e0.IViewsService),l=e.get(rM.IQuickInputService),c=e.get(rF.ITunnelService);await d.openView(sb.ID,!0);let h=await l.input({prompt:t,validateInput:e=>Promise.resolve(i(n,c,e,c.canElevate))});h&&(s=(0,rR.parseAddress)(h))&&n.forward({remote:{host:s.host,port:s.port},elevateIfNeeded:!0}).then(e=>o(a,e,s.host,s.port))}}}(O||(O={})),(a=P||(P={})).INLINE_ID="remote.tunnel.closeInline",a.COMMANDPALETTE_ID="remote.tunnel.closeCommandPalette",a.LABEL=(0,ev.localize2)(10353,"Stop Forwarding Port"),a.inlineHandler=function(){return async(e,t)=>{let i=e.get(eK.IContextKeyService),o=e.get(rx.IRemoteExplorerService),r=[],s=i.getContextKeyValue(sm);if(s)s.forEach(e=>{let t=o.tunnelModel.forwarded.get(e);t&&r?.push(t)});else if(sf(t))r=[t];else{let e=i.getContextKeyValue(sp),t=e?o.tunnelModel.forwarded.get(e):void 0;t&&(r=[t])}if(r&&0!==r.length)return Promise.all(r.map(e=>o.close({host:e.remoteHost,port:e.remotePort},rR.TunnelCloseReason.User)))}},a.commandPaletteHandler=function(){return async e=>{let t=e.get(rM.IQuickInputService),i=e.get(rx.IRemoteExplorerService),o=e.get(rF.ITunnelService),r=e.get(o$.ICommandService),s=sD(Array.from(i.tunnelModel.forwarded.values()).filter(e=>e.closeable),i,o),n=await t.pick(s,{placeHolder:(0,ev.localize)(10354,"Choose a port to stop forwarding")});n&&n.tunnel?await i.close({host:n.tunnel.remoteHost,port:n.tunnel.remotePort},rR.TunnelCloseReason.User):n&&await r.executeCommand(O.COMMANDPALETTE_ID)}};var sT=V||(V={});function sA(e,t,i){let o=e.forwarded.get(i)||e.detected.get(i);return o?t.open(o.localUri,{allowContributedOpeners:!1}):Promise.resolve()}sT.ID="remote.tunnel.open",sT.LABEL=(0,ev.localize)(10355,"Open in Browser"),sT.handler=function(){return async(e,t)=>{let i;if(sf(t)?i=(0,rR.makeAddress)(t.remoteHost,t.remotePort):(0,rG.isRemoteTunnel)(t)&&(i=(0,rR.makeAddress)(t.tunnelRemoteHost,t.tunnelRemotePort)),i)return sA(e.get(rx.IRemoteExplorerService).tunnelModel,e.get(tQ.IOpenerService),i)}},sT.run=sA;var sx=K||(K={});async function sR(e,t,i,o){let r=e.forwarded.get(o)||e.detected.get(o);if(r){let e=r.remoteHost.includes(":")?`[${r.remoteHost}]`:r.remoteHost,o=e$.URI.parse(`http://${e}:${r.remotePort}`),s=await i.getOpener(r.localUri,{sourceUri:o},e8.CancellationToken.None);return s?s.openExternalUri(r.localUri,{sourceUri:o},e8.CancellationToken.None):t.open(r.localUri)}return Promise.resolve()}sx.ID="remote.tunnel.openPreview",sx.LABEL=(0,ev.localize)(10356,"Preview in Editor"),sx.handler=function(){return async(e,t)=>{let i;if(sf(t)?i=(0,rR.makeAddress)(t.remoteHost,t.remotePort):(0,rG.isRemoteTunnel)(t)&&(i=(0,rR.makeAddress)(t.tunnelRemoteHost,t.tunnelRemotePort)),i)return sR(e.get(rx.IRemoteExplorerService).tunnelModel,e.get(tQ.IOpenerService),e.get(rJ.IExternalUriOpenerService),i)}},sx.run=sR,(d=N||(N={})).ID="remote.tunnel.openCommandPalette",d.LABEL=(0,ev.localize)(10357,"Open Port in Browser"),d.handler=function(){return async(e,t)=>{let i=e.get(rx.IRemoteExplorerService),o=e.get(rF.ITunnelService),r=i.tunnelModel,s=e.get(rM.IQuickInputService),n=e.get(tQ.IOpenerService),a=e.get(o$.ICommandService),d=[...r.forwarded,...r.detected].map(e=>{let t=sn.createFromTunnel(i,o,e[1]);return{label:t.label,description:t.processDescription,tunnel:t}});0===d.length?d.push({label:(0,ev.localize)(10358,"No ports currently forwarded. Open the Ports view to get started.")}):d.push({label:(0,ev.localize)(10359,"Open the Ports view...")});let l=await s.pick(d,{placeHolder:(0,ev.localize)(10360,"Choose the port to open")});return l&&l.tunnel?V.run(r,n,(0,rR.makeAddress)(l.tunnel.remoteHost,l.tunnel.remotePort)):l?a.executeCommand(`${rA.TUNNEL_VIEW_ID}.focus`):void 0}};var sk=G||(G={});async function sM(e,t,i){let o=e.tunnelModel.address(i.remoteHost,i.remotePort);o&&await t.writeText(o.toString())}sk.INLINE_ID="remote.tunnel.copyAddressInline",sk.COMMANDPALETTE_ID="remote.tunnel.copyAddressCommandPalette",sk.INLINE_LABEL=(0,ev.localize)(10361,"Copy Local Address"),sk.COMMANDPALETTE_LABEL=(0,ev.localize)(10362,"Copy Forwarded Port Address"),sk.inlineHandler=function(){return async(e,t)=>{let i,o=e.get(rx.IRemoteExplorerService);if(sf(t))i=t;else{let t=e.get(eK.IContextKeyService).getContextKeyValue(sp);i=t?o.tunnelModel.forwarded.get(t):void 0}if(i)return sM(o,e.get(rO.IClipboardService),i)}},sk.commandPaletteHandler=function(){return async(e,t)=>{let i=e.get(rM.IQuickInputService),o=e.get(rx.IRemoteExplorerService),r=e.get(rF.ITunnelService),s=e.get(o$.ICommandService),n=e.get(rO.IClipboardService),a=Array.from(o.tunnelModel.forwarded.values()).concat(Array.from(o.tunnelModel.detected.values())),d=await i.pick(sD(a,o,r),{placeHolder:(0,ev.localize)(10363,"Choose a forwarded port")});d&&d.tunnel?await sM(o,n,d.tunnel):d&&await s.executeCommand(O.COMMANDPALETTE_ID)}},(l=F||(F={})).ID="remote.tunnel.changeLocalPort",l.LABEL=(0,ev.localize)(10364,"Change Local Address Port"),l.handler=function(){return async(e,t)=>{let i,o=e.get(rx.IRemoteExplorerService),r=e.get(oY.INotificationService),s=e.get(rF.ITunnelService);if(sf(t))i=t;else{let t=e.get(eK.IContextKeyService).getContextKeyValue(sp),r=t?o.tunnelModel.forwarded.get(t):void 0;if(r){let t=e.get(rF.ITunnelService);i=sn.createFromTunnel(o,t,r)}}if(i){let e=i;o.setEditable(e,rA.TunnelEditId.LocalPort,{onFinish:async(t,i)=>{if(o.setEditable(e,rA.TunnelEditId.LocalPort,null),i){await o.close({host:e.remoteHost,port:e.remotePort},rR.TunnelCloseReason.Other);let i=Number(t),s=await o.forward({remote:{host:e.remoteHost,port:e.remotePort},local:i,name:e.name,elevateIfNeeded:!0,source:e.source});s&&"string"!=typeof s&&s.tunnelLocalPort!==i&&r.warn((0,ev.localize)(10366,"The local port {0} is not available. Port number {1} has been used instead",t,s.tunnelLocalPort??s.localAddress))}},validationMessage:e=>{var t,i,o;return t=s,i=e,o=s.canElevate,i.match(/^[0-9]+$/)?Number(i)>=65536?{content:s_,severity:em.default.Error}:o&&t.isPortPrivileged(Number(i))?{content:sE,severity:em.default.Info}:null:{content:(0,ev.localize)(10365,"Local port should be a number."),severity:em.default.Error}},placeholder:(0,ev.localize)(10367,"New local port")})}}},(W||(W={})).handler=function(e){return async(t,i)=>{if(sf(i)){let o=t.get(rx.IRemoteExplorerService);return await o.close({host:i.remoteHost,port:i.remotePort},rR.TunnelCloseReason.Other),o.forward({remote:{host:i.remoteHost,port:i.remotePort},local:i.localPort,name:i.name,elevateIfNeeded:!0,privacy:e,source:i.source})}}};var sL=z||(z={});async function sO(e,t,i,o){if(sf(e)){let r=o.remoteAuthority?rk.ConfigurationTarget.USER_REMOTE:rk.ConfigurationTarget.USER_LOCAL;return i.tunnelModel.configPortsAttributes.addAttributes(e.remotePort,{protocol:t},r)}}sL.ID_HTTP="remote.tunnel.setProtocolHttp",sL.ID_HTTPS="remote.tunnel.setProtocolHttps",sL.LABEL_HTTP=(0,ev.localize)(10368,"HTTP"),sL.LABEL_HTTPS=(0,ev.localize)(10369,"HTTPS"),sL.handlerHttp=function(){return async(e,t)=>sO(t,rG.TunnelProtocol.Http,e.get(rx.IRemoteExplorerService),e.get(e_.IWorkbenchEnvironmentService))},sL.handlerHttps=function(){return async(e,t)=>sO(t,rG.TunnelProtocol.Https,e.get(rx.IRemoteExplorerService),e.get(e_.IWorkbenchEnvironmentService))};let sP=sa.isEqualTo(rA.TunnelType.Forwarded),sV=eV.ContextKeyExpr.or(sP,sa.isEqualTo(rA.TunnelType.Detected)),sK=sv.isEqualTo(void 0);eF.KeybindingsRegistry.registerCommandAndKeybindingRule({id:L.ID,weight:eF.KeybindingWeight.WorkbenchContrib+10,when:eV.ContextKeyExpr.and(su,sP,sK),primary:iO.KeyCode.F2,mac:{primary:iO.KeyCode.Enter},handler:L.handler()}),oH.CommandsRegistry.registerCommand(O.INLINE_ID,O.inlineHandler()),oH.CommandsRegistry.registerCommand(O.COMMANDPALETTE_ID,O.commandPaletteHandler()),eF.KeybindingsRegistry.registerCommandAndKeybindingRule({id:P.INLINE_ID,weight:eF.KeybindingWeight.WorkbenchContrib+10,when:eV.ContextKeyExpr.and(sd,su),primary:iO.KeyCode.Delete,mac:{primary:iO.KeyMod.CtrlCmd|iO.KeyCode.Backspace,secondary:[iO.KeyCode.Delete]},handler:P.inlineHandler()}),oH.CommandsRegistry.registerCommand(P.COMMANDPALETTE_ID,P.commandPaletteHandler()),oH.CommandsRegistry.registerCommand(V.ID,V.handler()),oH.CommandsRegistry.registerCommand(K.ID,K.handler()),oH.CommandsRegistry.registerCommand(N.ID,N.handler()),eF.KeybindingsRegistry.registerCommandAndKeybindingRule({id:G.INLINE_ID,weight:eF.KeybindingWeight.WorkbenchContrib+10,when:eV.ContextKeyExpr.and(su,sV,sK),primary:iO.KeyMod.CtrlCmd|iO.KeyCode.KeyC,handler:G.inlineHandler()}),oH.CommandsRegistry.registerCommand(G.COMMANDPALETTE_ID,G.commandPaletteHandler()),oH.CommandsRegistry.registerCommand(F.ID,F.handler()),oH.CommandsRegistry.registerCommand(z.ID_HTTP,z.handlerHttp()),oH.CommandsRegistry.registerCommand(z.ID_HTTPS,z.handlerHttps()),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:P.COMMANDPALETTE_ID,title:P.LABEL},when:rR.forwardedPortsViewEnabled}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:O.COMMANDPALETTE_ID,title:O.LABEL},when:rR.forwardedPortsViewEnabled}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:G.COMMANDPALETTE_ID,title:G.COMMANDPALETTE_LABEL},when:rR.forwardedPortsViewEnabled}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:N.ID,title:N.LABEL},when:rR.forwardedPortsViewEnabled}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelContext,{group:"._open",order:0,command:{id:V.ID,title:V.LABEL},when:eV.ContextKeyExpr.and(sV,sK)}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelContext,{group:"._open",order:1,command:{id:K.ID,title:K.LABEL},when:eV.ContextKeyExpr.and(sV,sK)}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelContext,{group:"0_manage",order:1,command:{id:L.ID,title:L.LABEL,icon:rY},when:eV.ContextKeyExpr.and(sP,sK)}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelContext,{group:"2_localaddress",order:0,command:{id:G.INLINE_ID,title:G.INLINE_LABEL},when:eV.ContextKeyExpr.and(sV,sK)}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelContext,{group:"2_localaddress",order:1,command:{id:F.ID,title:F.LABEL},when:eV.ContextKeyExpr.and(sP,sy,sK)}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelContext,{group:"2_localaddress",order:2,submenu:eG.MenuId.TunnelPrivacy,title:(0,ev.localize)(10370,"Port Visibility"),when:eV.ContextKeyExpr.and(sP,sc)}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelContext,{group:"2_localaddress",order:3,submenu:eG.MenuId.TunnelProtocol,title:(0,ev.localize)(10371,"Change Port Protocol"),when:eV.ContextKeyExpr.and(sP,sK,sC)}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelContext,{group:"3_forward",order:0,command:{id:P.INLINE_ID,title:P.LABEL},when:sd}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelContext,{group:"3_forward",order:1,command:{id:O.INLINE_ID,title:O.LABEL}}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelProtocol,{order:0,command:{id:z.ID_HTTP,title:z.LABEL_HTTP,toggled:sh.isEqualTo(rG.TunnelProtocol.Http)}}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelProtocol,{order:1,command:{id:z.ID_HTTPS,title:z.LABEL_HTTPS,toggled:sh.isEqualTo(rG.TunnelProtocol.Https)}}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelPortInline,{group:"0_manage",order:0,command:{id:O.INLINE_ID,title:O.TREEITEM_LABEL,icon:rB},when:sa.isEqualTo(rA.TunnelType.Candidate)}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelPortInline,{group:"0_manage",order:4,command:{id:L.ID,title:L.LABEL,icon:rY},when:sP}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelPortInline,{group:"0_manage",order:5,command:{id:P.INLINE_ID,title:P.LABEL,icon:rU},when:sd}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelLocalAddressInline,{order:-1,command:{id:G.INLINE_ID,title:G.INLINE_LABEL,icon:rq},when:sV}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelLocalAddressInline,{order:0,command:{id:V.ID,title:V.LABEL,icon:rH},when:sV}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TunnelLocalAddressInline,{order:1,command:{id:K.ID,title:K.LABEL,icon:r$},when:sV}),(0,rZ.registerColor)("ports.iconRunningProcessForeground",r3.STATUS_BAR_REMOTE_ITEM_BACKGROUND,(0,ev.localize)(10372,"The color of the icon for a port that has an associated running process."));var sN=e.i(658493),sG=e.i(85282),sF=eu;class sW extends sF.Disposable{static{this.localUrlRegex=/\b\w{0,20}(?::\/\/)?(?:localhost|127\.0\.0\.1|0\.0\.0\.0|:\d{2,5})[\w\-\.\~:\/\?\#[\]\@!\$&\(\)\*\+\,\;\=]*/gim}static{this.extractPortRegex=/(localhost|127\.0\.0\.1|0\.0\.0\.0):(\d{1,5})/}static{this.localPythonServerRegex=/HTTP\son\s(127\.0\.0\.1|0\.0\.0\.0)\sport\s(\d+)/}static{this.excludeTerminals=["Dev Containers"]}constructor(e,t){super(),this._onDidMatchLocalUrl=new ec.Emitter,this.onDidMatchLocalUrl=this._onDidMatchLocalUrl.event,this.listeners=new Map,this.replPositions=new Map,e.instances.forEach(e=>{this.registerTerminalInstance(e)}),this._register(e.onDidCreateInstance(e=>{this.registerTerminalInstance(e)})),this._register(e.onDidDisposeInstance(e=>{this.listeners.get(e)?.dispose(),this.listeners.delete(e)})),this._register(t.onDidNewSession(e=>{(!e.parentSession||e.parentSession&&e.hasSeparateRepl())&&this.listeners.set(e.getId(),e.onDidChangeReplElements(()=>{this.processNewReplElements(e)}))})),this._register(t.onDidEndSession(({session:e})=>{this.listeners.has(e.getId())&&(this.listeners.get(e.getId())?.dispose(),this.listeners.delete(e.getId()))}))}registerTerminalInstance(e){sW.excludeTerminals.includes(e.title)||this.listeners.set(e,e.onData(e=>{this.processData(e)}))}processNewReplElements(e){let t=this.replPositions.get(e.getId()),i=e.getReplElements();if(this.replPositions.set(e.getId(),{position:i.length-1,tail:i[i.length-1]}),!t&&i.length>0)i.forEach(e=>this.processData(e.toString()));else if(t&&i.length-1!==t.position)for(let e=i.length-1;e>=0;e--){let o=i[e];if(o===t.tail)break;this.processData(o.toString())}}dispose(){for(let e of(super.dispose(),this.listeners.values()))e.dispose()}processData(e){let t=(e=(0,iu.removeAnsiEscapeCodes)(e)).match(sW.localUrlRegex)||[];if(t&&t.length>0)t.forEach(t=>{let i;try{i=new URL(t)}catch(e){}if(i){let o=t.match(sW.extractPortRegex),r=parseFloat(i.port?i.port:o?o[2]:"NaN");if(!isNaN(r)&&Number.isInteger(r)&&r>0&&r<=65535){let t=i.hostname;if("0.0.0.0"!==t&&"127.0.0.1"!==t&&(t="localhost"),9229!==r&&e.startsWith("Debugger listening on"))return;this._onDidMatchLocalUrl.fire({port:r,host:t})}}});else{let t=e.match(sW.localPythonServerRegex);t&&3===t.length&&this._onDidMatchLocalUrl.fire({host:t[1],port:Number(t[2])})}}}var sz=e.i(195911),sB=e.i(352853),sU=e.i(436771),sH=e.i(386567),s$=e.i(509046);let sq="workbench.view.remote",sY=class extends rT.Disposable{constructor(e,t,i,o,r,s){super(),this.contextKeyService=e,this.environmentService=t,this.remoteExplorerService=i,this.tunnelService=o,this.activityService=r,this.statusbarService=s,this.contextKeyListener=this._register(new rT.MutableDisposable),this.activityBadge=this._register(new rT.MutableDisposable),this.hasPortsInSession=!1,this._register(eO.Registry.as(ek.Extensions.ViewsRegistry).registerViewWelcomeContent(rA.TUNNEL_VIEW_ID,{content:this.environmentService.remoteAuthority?(0,ev.localize)(10252,"No forwarded ports. Forward a port to access your running services locally.\n[Forward a Port]({0})",`command:${O.INLINE_ID}`):(0,ev.localize)(10253,"No forwarded ports. Forward a port to access your locally running services over the internet.\n[Forward a Port]({0})",`command:${O.INLINE_ID}`)})),this.enableBadgeAndStatusBar(),this.enableForwardedPortsFeatures(),this.environmentService.remoteAuthority||this._register(ec.Event.once(this.tunnelService.onTunnelOpened)(()=>{this.hasPortsInSession=!0}))}async getViewContainer(){return eO.Registry.as(ek.Extensions.ViewContainersRegistry).registerViewContainer({id:rA.TUNNEL_VIEW_CONTAINER_ID,title:(0,ev.localize2)(10254,"Ports"),icon:rW,ctorDescriptor:new e4.SyncDescriptor(ej.ViewPaneContainer,[rA.TUNNEL_VIEW_CONTAINER_ID,{mergeViewWithContainerWhenSingleView:!0}]),storageId:rA.TUNNEL_VIEW_CONTAINER_ID,hideIfEmpty:!0,order:5},ek.ViewContainerLocation.Panel)}async enableForwardedPortsFeatures(){this.contextKeyListener.clear();let e=!!rR.forwardedPortsFeaturesEnabled.getValue(this.contextKeyService),t=!!rR.forwardedPortsViewEnabled.getValue(this.contextKeyService);if(e||t){t||this.contextKeyService.createKey(rR.forwardedPortsViewEnabled.key,!0);let i=await this.getViewContainer(),o=new sw(new r9(this.remoteExplorerService,this.tunnelService),this.environmentService),r=eO.Registry.as(ek.Extensions.ViewsRegistry);i&&(this.remoteExplorerService.enablePortsFeatures(!e),r.registerViews([o],i))}else this.contextKeyListener.value=this.contextKeyService.onDidChangeContext(e=>{e.affectsSome(new Set([...rR.forwardedPortsFeaturesEnabled.keys(),...rR.forwardedPortsViewEnabled.keys()]))&&this.enableForwardedPortsFeatures()})}enableBadgeAndStatusBar(){let e=eO.Registry.as(ek.Extensions.ViewsRegistry).onViewsRegistered(t=>{t.find(e=>e.views.find(e=>e.id===rA.TUNNEL_VIEW_ID))&&(this._register(ec.Event.debounce(this.remoteExplorerService.tunnelModel.onForwardPort,(e,t)=>t,50)(()=>{this.updateActivityBadge(),this.updateStatusBar()})),this._register(ec.Event.debounce(this.remoteExplorerService.tunnelModel.onClosePort,(e,t)=>t,50)(()=>{this.updateActivityBadge(),this.updateStatusBar()})),this.updateActivityBadge(),this.updateStatusBar(),e.dispose())})}async updateActivityBadge(){this.remoteExplorerService.tunnelModel.forwarded.size>0?this.activityBadge.value=this.activityService.showViewActivity(rA.TUNNEL_VIEW_ID,{badge:new o0.NumberBadge(this.remoteExplorerService.tunnelModel.forwarded.size,e=>1===e?(0,ev.localize)(10255,"1 forwarded port"):(0,ev.localize)(10256,"{0} forwarded ports",e))}):this.activityBadge.clear()}updateStatusBar(){(this.environmentService.remoteAuthority||this.hasPortsInSession)&&(this.entryAccessor?this.entryAccessor.update(this.entry):this._register(this.entryAccessor=this.statusbarService.addEntry(this.entry,"status.forwardedPorts",sN.StatusbarAlignment.LEFT,40)))}get entry(){let e,t=this.remoteExplorerService.tunnelModel.forwarded.size+this.remoteExplorerService.tunnelModel.detected.size,i=`${t}`;if(0===t)e=(0,ev.localize)(10257,"No Ports Forwarded");else{let t=Array.from(this.remoteExplorerService.tunnelModel.forwarded.values());t.push(...Array.from(this.remoteExplorerService.tunnelModel.detected.values())),e=(0,ev.localize)(10258,"Forwarded Ports: {0}",t.map(e=>e.remotePort).join(", "))}return{name:(0,ev.localize)(10259,"Forwarded Ports"),text:`$(radio-tower) ${i}`,ariaLabel:e,tooltip:e,command:`${rA.TUNNEL_VIEW_ID}.focus`}}};sY=(0,ei.__decorate)([(0,ei.__param)(0,eK.IContextKeyService),(0,ei.__param)(1,e_.IWorkbenchEnvironmentService),(0,ei.__param)(2,rx.IRemoteExplorerService),(0,ei.__param)(3,rF.ITunnelService),(0,ei.__param)(4,o1.IActivityService),(0,ei.__param)(5,sG.IStatusbarService)],sY);let sj=class{constructor(e,t){this.remoteExplorerService=e,this.logService=t,this.remoteExplorerService.tunnelModel.environmentTunnelsSet?this.restore():ec.Event.once(this.remoteExplorerService.tunnelModel.onEnvironmentTunnelsSet)(async()=>{await this.restore()})}async restore(){return this.logService.trace("ForwardedPorts: Doing first restore."),this.remoteExplorerService.restore()}};sj=(0,ei.__decorate)([(0,ei.__param)(0,rx.IRemoteExplorerService),(0,ei.__param)(1,eX.ILogService)],sj);let sX=class extends rT.Disposable{constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p,g){if(super(),this.terminalService=e,this.notificationService=t,this.openerService=i,this.externalOpenerService=o,this.remoteExplorerService=r,this.contextKeyService=n,this.configurationService=a,this.debugService=d,this.tunnelService=c,this.hostService=h,this.logService=u,this.storageService=p,this.preferencesService=g,!s.remoteAuthority)return;a.whenRemoteConfigurationLoaded().then(()=>l.getEnvironment()).then(e=>{this.setup(e),this._register(a.onDidChangeConfiguration(t=>{t.affectsConfiguration(rA.PORT_AUTO_SOURCE_SETTING)?this.setup(e):t.affectsConfiguration(rA.PORT_AUTO_FALLBACK_SETTING)&&!this.portListener&&this.listenForPorts()}))}),this.storageService.getBoolean("processPortForwardingFallback",t0.StorageScope.WORKSPACE,!0)||this.configurationService.updateValue(rA.PORT_AUTO_FALLBACK_SETTING,0,rk.ConfigurationTarget.WORKSPACE)}getPortAutoFallbackNumber(){let e=this.configurationService.inspect(rA.PORT_AUTO_FALLBACK_SETTING);if(void 0!==e.value&&(0===e.value||e.value!==e.defaultValue))return e.value;let t=this.configurationService.inspect(rA.PORT_AUTO_SOURCE_SETTING);return t.applicationValue===rA.PORT_AUTO_SOURCE_SETTING_PROCESS||t.userValue===rA.PORT_AUTO_SOURCE_SETTING_PROCESS||t.userLocalValue===rA.PORT_AUTO_SOURCE_SETTING_PROCESS||t.userRemoteValue===rA.PORT_AUTO_SOURCE_SETTING_PROCESS||t.workspaceFolderValue===rA.PORT_AUTO_SOURCE_SETTING_PROCESS||t.workspaceValue===rA.PORT_AUTO_SOURCE_SETTING_PROCESS?0:e.value??20}listenForPorts(){let e=this.getPortAutoFallbackNumber();0===e?this.portListener?.dispose():this.procForwarder&&!this.portListener&&this.configurationService.getValue(rA.PORT_AUTO_SOURCE_SETTING)===rA.PORT_AUTO_SOURCE_SETTING_PROCESS?this.portListener=this._register(this.remoteExplorerService.tunnelModel.onForwardPort(async()=>{0===(e=this.getPortAutoFallbackNumber())?this.portListener?.dispose():Array.from(this.remoteExplorerService.tunnelModel.forwarded.values()).filter(e=>e.source.source===rR.TunnelSource.Auto).length>e&&(await this.configurationService.updateValue(rA.PORT_AUTO_SOURCE_SETTING,rA.PORT_AUTO_SOURCE_SETTING_HYBRID),this.notificationService.notify({message:(0,ev.localize)(10260,"Over 20 ports have been automatically forwarded. The `process` based automatic port forwarding has been switched to `hybrid` in settings. Some ports may no longer be detected."),severity:em.default.Warning,actions:{primary:[(0,oN.toAction)({id:"switchBack",label:(0,ev.localize)(10261,"Undo"),run:async()=>{await this.configurationService.updateValue(rA.PORT_AUTO_SOURCE_SETTING,rA.PORT_AUTO_SOURCE_SETTING_PROCESS),await this.configurationService.updateValue(rA.PORT_AUTO_FALLBACK_SETTING,0,rk.ConfigurationTarget.WORKSPACE),this.portListener?.dispose(),this.portListener=void 0}}),(0,oN.toAction)({id:"showPortSourceSetting",label:(0,ev.localize)(10262,"Show Setting"),run:async()=>{await this.preferencesService.openSettings({query:"remote.autoForwardPortsSource"})}})]}}))})):(this.portListener?.dispose(),this.portListener=void 0)}setup(e){let t=this.procForwarder?.forwarded,i=this.outputForwarder||this.procForwarder;if(this.procForwarder?.dispose(),this.procForwarder=void 0,this.outputForwarder?.dispose(),this.outputForwarder=void 0,e?.os!==eg.OperatingSystem.Linux)this.configurationService.inspect(rA.PORT_AUTO_SOURCE_SETTING).default?.value!==rA.PORT_AUTO_SOURCE_SETTING_OUTPUT&&eO.Registry.as(tr.Extensions.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":rA.PORT_AUTO_SOURCE_SETTING_OUTPUT}}]),this.outputForwarder=this._register(new sZ(this.terminalService,this.notificationService,this.openerService,this.externalOpenerService,this.remoteExplorerService,this.configurationService,this.debugService,this.tunnelService,this.hostService,this.logService,this.contextKeyService,()=>!1));else{let e=()=>this.configurationService.getValue(rA.PORT_AUTO_SOURCE_SETTING)===rA.PORT_AUTO_SOURCE_SETTING_PROCESS;e()?this.procForwarder=this._register(new sQ(!1,t,!i,this.configurationService,this.remoteExplorerService,this.notificationService,this.openerService,this.externalOpenerService,this.tunnelService,this.hostService,this.logService,this.contextKeyService)):this.configurationService.getValue(rA.PORT_AUTO_SOURCE_SETTING)===rA.PORT_AUTO_SOURCE_SETTING_HYBRID&&(this.procForwarder=this._register(new sQ(!0,t,!i,this.configurationService,this.remoteExplorerService,this.notificationService,this.openerService,this.externalOpenerService,this.tunnelService,this.hostService,this.logService,this.contextKeyService))),this.outputForwarder=this._register(new sZ(this.terminalService,this.notificationService,this.openerService,this.externalOpenerService,this.remoteExplorerService,this.configurationService,this.debugService,this.tunnelService,this.hostService,this.logService,this.contextKeyService,e))}this.listenForPorts()}};sX=(0,ei.__decorate)([(0,ei.__param)(0,sz.ITerminalService),(0,ei.__param)(1,oY.INotificationService),(0,ei.__param)(2,tQ.IOpenerService),(0,ei.__param)(3,rJ.IExternalUriOpenerService),(0,ei.__param)(4,rx.IRemoteExplorerService),(0,ei.__param)(5,e_.IWorkbenchEnvironmentService),(0,ei.__param)(6,eK.IContextKeyService),(0,ei.__param)(7,sH.IWorkbenchConfigurationService),(0,ei.__param)(8,sB.IDebugService),(0,ei.__param)(9,sU.IRemoteAgentService),(0,ei.__param)(10,rF.ITunnelService),(0,ei.__param)(11,eE.IHostService),(0,ei.__param)(12,eX.ILogService),(0,ei.__param)(13,eP.IStorageService),(0,ei.__param)(14,s$.IPreferencesService)],sX);class sJ extends rT.Disposable{static{this.NOTIFY_COOL_DOWN=5e3}constructor(e,t,i,o,r,s,n,a){super(),this.notificationService=e,this.remoteExplorerService=t,this.openerService=i,this.externalOpenerService=o,this.tunnelService=r,this.hostService=s,this.logService=n,this.contextKeyService=a,this.alreadyOpenedOnce=new Set,this.lastNotifyTime=new Date,this.lastNotifyTime.setFullYear(this.lastNotifyTime.getFullYear()-1)}async doAction(e){this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Starting action for ${e[0]?.tunnelRemotePort}`),this.doActionTunnels=e;let t=await this.portNumberHeuristicDelay();if(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose ${t?.tunnelRemotePort}`),t){let e=await this.remoteExplorerService.tunnelModel.getAttributes([{port:t.tunnelRemotePort,host:t.tunnelRemoteHost}]),i=e?.get(t.tunnelRemotePort)?.onAutoForward;switch(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) onAutoForward action is ${i}`),i){case rR.OnPortForward.OpenBrowserOnce:if(this.alreadyOpenedOnce.has(t.localAddress))break;this.alreadyOpenedOnce.add(t.localAddress);case rR.OnPortForward.OpenBrowser:{let e=(0,rR.makeAddress)(t.tunnelRemoteHost,t.tunnelRemotePort);await V.run(this.remoteExplorerService.tunnelModel,this.openerService,e);break}case rR.OnPortForward.OpenPreview:{let e=(0,rR.makeAddress)(t.tunnelRemoteHost,t.tunnelRemotePort);await K.run(this.remoteExplorerService.tunnelModel,this.openerService,this.externalOpenerService,e);break}case rR.OnPortForward.Silent:break;default:{let e=new Date().getTime()-this.lastNotifyTime.getTime();this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) time elapsed since last notification ${e} ms`),e>sJ.NOTIFY_COOL_DOWN&&await this.showNotification(t)}}}}hide(e){this.doActionTunnels&&(this.doActionTunnels=this.doActionTunnels.filter(t=>!e.includes(t.tunnelRemotePort))),this.lastShownPort&&e.indexOf(this.lastShownPort)>=0&&this.lastNotification?.close()}async portNumberHeuristicDelay(){if(this.logService.trace("ForwardedPorts: (OnAutoForwardedAction) Starting heuristic delay"),!this.doActionTunnels||0===this.doActionTunnels.length)return;this.doActionTunnels=this.doActionTunnels.sort((e,t)=>e.tunnelRemotePort-t.tunnelRemotePort);let e=this.doActionTunnels.shift();return e.tunnelRemotePort%1e3==0?(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose tunnel because % 1000: ${e.tunnelRemotePort}`),this.newerTunnel=e,e):e.tunnelRemotePort<1e4&&9229!==e.tunnelRemotePort?(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose tunnel because < 10000: ${e.tunnelRemotePort}`),this.newerTunnel=e,e):(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Waiting for "better" tunnel than ${e.tunnelRemotePort}`),this.newerTunnel=void 0,new Promise(t=>{setTimeout(()=>{this.newerTunnel?t(void 0):this.doActionTunnels?.includes(e)?t(e):t(void 0)},3e3)}))}async basicMessage(e){let t=await this.remoteExplorerService.tunnelModel.getAttributes([{host:e.tunnelRemoteHost,port:e.tunnelRemotePort}],!1),i=t?.get(e.tunnelRemotePort)?.label;return(0,ev.localize)(10263,"Your application{0} running on port {1} is available. ",i?` (${i})`:"",e.tunnelRemotePort)}linkMessage(){return(0,ev.localize)(10264,"[See all forwarded ports]({0})",`command:${sb.ID}.focus`)}async showNotification(e){if(!await this.hostService.hadLastFocus())return;this.lastNotification?.close();let t=await this.basicMessage(e),i=[this.openBrowserChoice(e)];(!eg.isWeb||r6.getValue(this.contextKeyService))&&i.push(this.openPreviewChoice(e)),e.tunnelLocalPort!==e.tunnelRemotePort&&this.tunnelService.canElevate&&this.tunnelService.isPortPrivileged(e.tunnelRemotePort)&&(t+=(0,ev.localize)(10265,"You'll need to run as superuser to use port {0} locally. ",e.tunnelRemotePort),i.unshift(this.elevateChoice(e))),e.privacy===rG.TunnelPrivacyId.Private&&eg.isWeb&&this.tunnelService.canChangePrivacy&&i.push(this.makePublicChoice(e)),t+=this.linkMessage(),this.lastNotification=this.notificationService.prompt(em.default.Info,t,i,{neverShowAgain:{id:"remote.tunnelsView.autoForwardNeverShow",isSecondary:!0}}),this.lastShownPort=e.tunnelRemotePort,this.lastNotifyTime=new Date,this.lastNotification.onDidClose(()=>{this.lastNotification=void 0,this.lastShownPort=void 0})}makePublicChoice(e){return{label:(0,ev.localize)(10266,"Make Public"),run:async()=>{let t=(0,rR.mapHasAddressLocalhostOrAllInterfaces)(this.remoteExplorerService.tunnelModel.forwarded,e.tunnelRemoteHost,e.tunnelRemotePort);return await this.remoteExplorerService.close({host:e.tunnelRemoteHost,port:e.tunnelRemotePort},rR.TunnelCloseReason.Other),this.remoteExplorerService.forward({remote:{host:e.tunnelRemoteHost,port:e.tunnelRemotePort},local:e.tunnelLocalPort,name:t?.name,elevateIfNeeded:!0,privacy:rG.TunnelPrivacyId.Public,source:t?.source})}}}openBrowserChoice(e){let t=(0,rR.makeAddress)(e.tunnelRemoteHost,e.tunnelRemotePort);return{label:V.LABEL,run:()=>V.run(this.remoteExplorerService.tunnelModel,this.openerService,t)}}openPreviewChoice(e){let t=(0,rR.makeAddress)(e.tunnelRemoteHost,e.tunnelRemotePort);return{label:K.LABEL,run:()=>K.run(this.remoteExplorerService.tunnelModel,this.openerService,this.externalOpenerService,t)}}elevateChoice(e){return{label:(0,ev.localize)(10267,"Use Port {0} as Sudo...",e.tunnelRemotePort),run:async()=>{await this.remoteExplorerService.close({host:e.tunnelRemoteHost,port:e.tunnelRemotePort},rR.TunnelCloseReason.Other);let t=await this.remoteExplorerService.forward({remote:{host:e.tunnelRemoteHost,port:e.tunnelRemotePort},local:e.tunnelRemotePort,elevateIfNeeded:!0,source:rR.AutoTunnelSource});t&&"string"!=typeof t&&(this.lastNotification?.close(),this.lastShownPort=t.tunnelRemotePort,this.lastNotification=this.notificationService.prompt(em.default.Info,await this.basicMessage(t)+this.linkMessage(),[this.openBrowserChoice(t),this.openPreviewChoice(e)],{neverShowAgain:{id:"remote.tunnelsView.autoForwardNeverShow",isSecondary:!0}}),this.lastNotification.onDidClose(()=>{this.lastNotification=void 0,this.lastShownPort=void 0}))}}}}class sZ extends rT.Disposable{constructor(e,t,i,o,r,s,n,a,d,l,c,h){super(),this.terminalService=e,this.notificationService=t,this.openerService=i,this.externalOpenerService=o,this.remoteExplorerService=r,this.configurationService=s,this.debugService=n,this.tunnelService=a,this.hostService=d,this.logService=l,this.contextKeyService=c,this.privilegedOnly=h,this.notifier=new sJ(t,r,i,o,a,d,l,c),this._register(s.onDidChangeConfiguration(e=>{e.affectsConfiguration(rA.PORT_AUTO_FORWARD_SETTING)&&this.tryStartStopUrlFinder()})),this.portsFeatures=this._register(this.remoteExplorerService.onEnabledPortsFeatures(()=>{this.tryStartStopUrlFinder()})),this.tryStartStopUrlFinder(),s.getValue(rA.PORT_AUTO_SOURCE_SETTING)===rA.PORT_AUTO_SOURCE_SETTING_HYBRID&&this._register(this.tunnelService.onTunnelClosed(e=>this.notifier.hide([e.port])))}tryStartStopUrlFinder(){this.configurationService.getValue(rA.PORT_AUTO_FORWARD_SETTING)?this.startUrlFinder():this.stopUrlFinder()}startUrlFinder(){(this.urlFinder||this.remoteExplorerService.portsFeaturesEnabled===rA.PortsEnablement.AdditionalFeatures)&&(this.portsFeatures?.dispose(),this.urlFinder=this._register(new sW(this.terminalService,this.debugService)),this._register(this.urlFinder.onDidMatchLocalUrl(async e=>{if((0,rR.mapHasAddressLocalhostOrAllInterfaces)(this.remoteExplorerService.tunnelModel.detected,e.host,e.port))return;let t=(await this.remoteExplorerService.tunnelModel.getAttributes([e]))?.get(e.port);if(t?.onAutoForward===rR.OnPortForward.Ignore||this.privilegedOnly()&&!this.tunnelService.isPortPrivileged(e.port))return;let i=await this.remoteExplorerService.forward({remote:e,source:rR.AutoTunnelSource},t??null);i&&"string"!=typeof i&&this.notifier.doAction([i])})))}stopUrlFinder(){this.urlFinder&&(this.urlFinder.dispose(),this.urlFinder=void 0)}}class sQ extends rT.Disposable{constructor(e,t,i,o,r,s,n,a,d,l,c,h){super(),this.unforwardOnly=e,this.alreadyAutoForwarded=t,this.needsInitialCandidates=i,this.configurationService=o,this.remoteExplorerService=r,this.notificationService=s,this.openerService=n,this.externalOpenerService=a,this.tunnelService=d,this.hostService=l,this.logService=c,this.contextKeyService=h,this.autoForwarded=new Set,this.notifiedOnly=new Set,this.initialCandidates=new Set,this.notifier=new sJ(s,r,n,a,d,l,c,h),t?.forEach(e=>this.autoForwarded.add(e)),this.initialize()}get forwarded(){return this.autoForwarded}async initialize(){this.remoteExplorerService.tunnelModel.environmentTunnelsSet||await new Promise(e=>this.remoteExplorerService.tunnelModel.onEnvironmentTunnelsSet(()=>e())),this._register(this.configurationService.onDidChangeConfiguration(async e=>{e.affectsConfiguration(rA.PORT_AUTO_FORWARD_SETTING)&&await this.startStopCandidateListener()})),this.portsFeatures=this._register(this.remoteExplorerService.onEnabledPortsFeatures(async()=>{await this.startStopCandidateListener()})),this.startStopCandidateListener()}async startStopCandidateListener(){this.configurationService.getValue(rA.PORT_AUTO_FORWARD_SETTING)?await this.startCandidateListener():this.stopCandidateListener()}stopCandidateListener(){this.candidateListener&&(this.candidateListener.dispose(),this.candidateListener=void 0)}async startCandidateListener(){!this.candidateListener&&this.remoteExplorerService.portsFeaturesEnabled===rA.PortsEnablement.AdditionalFeatures&&(this.portsFeatures?.dispose(),await this.setInitialCandidates(),this.configurationService.getValue(rA.PORT_AUTO_FORWARD_SETTING)&&(this.candidateListener=this._register(this.remoteExplorerService.tunnelModel.onCandidatesChanged(this.handleCandidateUpdate,this))))}async setInitialCandidates(){if(!this.needsInitialCandidates)return void this.logService.debug("ForwardedPorts: (ProcForwarding) Not setting initial candidates");let e=this.remoteExplorerService.tunnelModel.candidatesOrUndefined;for(let t of(e||(await new Promise(e=>this.remoteExplorerService.tunnelModel.onCandidatesChanged(()=>e())),e=this.remoteExplorerService.tunnelModel.candidates),e))this.initialCandidates.add((0,rR.makeAddress)(t.host,t.port));this.logService.debug(`ForwardedPorts: (ProcForwarding) Initial candidates set to ${e.map(e=>e.port).join(", ")}`)}async forwardCandidates(){let e,t=[];for(let i of(this.logService.trace(`ForwardedPorts: (ProcForwarding) Attempting to forward ${this.remoteExplorerService.tunnelModel.candidates.length} candidates`),this.remoteExplorerService.tunnelModel.candidates)){if(!i.detail){this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${i.port} missing detail`);continue}e||(e=await this.remoteExplorerService.tunnelModel.getAttributes(this.remoteExplorerService.tunnelModel.candidates));let o=e?.get(i.port),r=(0,rR.makeAddress)(i.host,i.port);if(this.initialCandidates.has(r)&&o?.onAutoForward===void 0||this.notifiedOnly.has(r)||this.autoForwarded.has(r))continue;let s=(0,rR.mapHasAddressLocalhostOrAllInterfaces)(this.remoteExplorerService.tunnelModel.forwarded,i.host,i.port);if((0,rR.mapHasAddressLocalhostOrAllInterfaces)(this.remoteExplorerService.tunnelModel.detected,i.host,i.port))continue;if(o?.onAutoForward===rR.OnPortForward.Ignore){this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${i.port} is ignored`);continue}let n=await this.remoteExplorerService.forward({remote:i,source:rR.AutoTunnelSource},o??null);!s&&n?(this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${i.port} has been forwarded`),this.autoForwarded.add(r)):n&&(this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${i.port} has been notified`),this.notifiedOnly.add(r)),n&&"string"!=typeof n&&t.push(n)}if(this.logService.trace(`ForwardedPorts: (ProcForwarding) Forwarded ${t.length} candidates`),0!==t.length)return t}async handleCandidateUpdate(e){let t,i=[];if(this.unforwardOnly)for(let e of(t=new Map,this.remoteExplorerService.tunnelModel.forwarded.entries()))e[1].source.source===rR.TunnelSource.Auto&&t.set(e[0],e[1]);else t=new Map(this.autoForwarded.entries());for(let o of e){let e=o[0],r=o[1],s=(0,rR.mapHasAddressLocalhostOrAllInterfaces)(t,r.host,r.port);s?("string"==typeof s?this.autoForwarded.delete(e):r={host:s.remoteHost,port:s.remotePort},await this.remoteExplorerService.close(r,rR.TunnelCloseReason.AutoForwardEnd),i.push(r.port)):this.notifiedOnly.delete(e)?i.push(r.port):this.initialCandidates.delete(e)}if(this.unforwardOnly)return;i.length>0&&await this.notifier.hide(i);let o=await this.forwardCandidates();o&&await this.notifier.doAction(o)}}var s0=e.i(975451),s1=t3,s2=e.i(364078),s3=e.i(496119),s5=e.i(913726),s6=e.i(728324),s4=e.i(571728);let s9="webviewState",s8=class extends s1.ViewPane{static{B=this}static getOriginStore(e){return this._originStore??=new s3.ExtensionKeyedWebviewOriginStore("webviewViews.origins",e),this._originStore}constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p,g,m,v){super({...e,titleMenuId:eG.MenuId.ViewTitle,showActions:s1.ViewPaneShowActions.WhenExpanded},s,o,t,i,l,r,n,d,a),this.activityService=c,this.extensionService=h,this.progressService=u,this.storageService=p,this.viewService=g,this.webviewService=m,this.webviewViewService=v,this._webview=this._register(new eu.MutableDisposable),this._webviewDisposables=this._register(new eu.DisposableStore),this._activated=!1,this.activity=this._register(new eu.MutableDisposable),this._onDidChangeVisibility=this._register(new ec.Emitter),this.onDidChangeVisibility=this._onDidChangeVisibility.event,this._onDispose=this._register(new ec.Emitter),this.onDispose=this._onDispose.event,this.extensionId=e.fromExtensionId,this.defaultTitle=this.title,this.memento=new s2.Memento(`webviewView.${this.id}`,p),this.viewState=this.memento.getMemento(t0.StorageScope.WORKSPACE,t0.StorageTarget.MACHINE),this._register(this.onDidChangeBodyVisibility(()=>this.updateTreeVisibility())),this._register(this.webviewViewService.onNewResolverRegistered(e=>{e.viewType===this.id&&this.updateTreeVisibility()})),this.updateTreeVisibility()}dispose(){this._onDispose.fire(),clearTimeout(this._repositionTimeout),super.dispose()}focus(){super.focus(),this._webview.value?.focus()}renderBody(e){super.renderBody(e),this._container=e,this._rootContainer=void 0,this._resizeObserver||(this._resizeObserver=new ResizeObserver(()=>{setTimeout(()=>{this.layoutWebview()},0)}),this._register((0,eu.toDisposable)(()=>{this._resizeObserver?.disconnect()})),this._resizeObserver.observe(e))}saveState(){this._webview.value&&(this.viewState[s9]=this._webview.value.state),this.memento.saveMemento(),super.saveState()}layoutBody(e,t){super.layoutBody(e,t),this.layoutWebview(new er.Dimension(t,e))}updateTreeVisibility(){this.isBodyVisible()?(this.activate(),this._webview.value?.claim(this,(0,er.getWindow)(this.element),void 0)):this._webview.value?.release(this)}activate(){if(this._activated)return;this._activated=!0;let e=this.extensionId?B.getOriginStore(this.storageService).getOrigin(this.id,this.extensionId):void 0,t=this.webviewService.createWebviewOverlay({origin:e,providedViewType:this.id,title:this.title,options:{purpose:s3.WebviewContentPurpose.WebviewView},contentOptions:{},extension:this.extensionId?{id:this.extensionId}:void 0});for(let e of(t.state=this.viewState[s9],this._webview.value=t,this._container&&this.layoutWebview(),this._webviewDisposables.add((0,eu.toDisposable)(()=>{this._webview.value?.release(this)})),this._webviewDisposables.add(t.onDidUpdateState(()=>{this.viewState[s9]=t.state})),[er.EventType.DRAG,er.EventType.DRAG_END,er.EventType.DRAG_ENTER,er.EventType.DRAG_LEAVE,er.EventType.DRAG_START]))this._webviewDisposables.add((0,er.addDisposableListener)(this._webview.value.container,e,e=>{e.preventDefault(),e.stopImmediatePropagation(),this.dropTargetElement.dispatchEvent(new DragEvent(e.type,e))}));this._webviewDisposables.add(new s6.WebviewWindowDragMonitor((0,er.getWindow)(this.element),()=>this._webview.value));let i=this._webviewDisposables.add(new e8.CancellationTokenSource);this.withProgress(async()=>{await this.extensionService.activateByEvent(`onView:${this.id}`);let e=this,o={webview:t,onDidChangeVisibility:this.onDidChangeBodyVisibility,onDispose:this.onDispose,get title(){return e.setTitle},set title(value){e.updateTitle(value)},get description(){return e.titleDescription},set description(value){e.updateTitleDescription(value)},get badge(){return e.badge},set badge(badge){e.updateBadge(badge)},dispose:()=>{this._activated=!1,this._webview.clear(),this._webviewDisposables.clear()},show:e=>{this.viewService.openView(this.id,!e)}};await this.webviewViewService.resolve(this.id,o,i.token)})}updateTitle(e){this.setTitle=e,super.updateTitle("string"==typeof e?e:this.defaultTitle)}updateBadge(e){if((this.badge?.value!==e?.value||this.badge?.tooltip!==e?.tooltip)&&(this.badge=e,e)){let t={badge:new o0.NumberBadge(e.value,()=>e.tooltip),priority:150};this.activity.value=this.activityService.showViewActivity(this.id,t)}}async withProgress(e){return this.progressService.withProgress({location:this.id,delay:500},e)}onDidScrollRoot(){this.layoutWebview()}doLayoutWebview(e){let t=this._webview.value;this._container&&t&&(this._rootContainer&&this._rootContainer.isConnected||(this._rootContainer=this.findRootContainer(this._container)),t.layoutWebviewOverElement(this._container,e,this._rootContainer))}layoutWebview(e){this.doLayoutWebview(e),clearTimeout(this._repositionTimeout),this._repositionTimeout=setTimeout(()=>this.doLayoutWebview(e),200)}findRootContainer(e){return(0,er.findParentWithClass)(e,"monaco-scrollable-element")??void 0}};s8=B=(0,ei.__decorate)([(0,ei.__param)(1,ey.IConfigurationService),(0,ei.__param)(2,eK.IContextKeyService),(0,ei.__param)(3,eC.IContextMenuService),(0,ei.__param)(4,eD.IInstantiationService),(0,ei.__param)(5,tX.IKeybindingService),(0,ei.__param)(6,tQ.IOpenerService),(0,ei.__param)(7,tj.IHoverService),(0,ei.__param)(8,eW.IThemeService),(0,ei.__param)(9,eM.IViewDescriptorService),(0,ei.__param)(10,o1.IActivityService),(0,ei.__param)(11,ez.IExtensionService),(0,ei.__param)(12,oj.IProgressService),(0,ei.__param)(13,eP.IStorageService),(0,ei.__param)(14,e0.IViewsService),(0,ei.__param)(15,s5.IWebviewService),(0,ei.__param)(16,s4.IWebviewViewService)],s8);var s7=e.i(888961),ne=e.i(774260),nt=e.i(425024);let ni={type:"object",properties:{id:{description:(0,ev.localize)(2576,"Unique id used to identify the container in which views can be contributed using 'views' contribution point"),type:"string",pattern:"^[a-zA-Z0-9_-]+$"},title:{description:(0,ev.localize)(2577,"Human readable string used to render the container"),type:"string"},icon:{description:(0,ev.localize)(2578,"Path to the container icon. Icons are 24x24 centered on a 50x40 block and have a fill color of 'rgb(215, 218, 224)' or '#d7dae0'. It is recommended that icons be in SVG, though any image file type is accepted."),type:"string"}},required:["id","title","icon"]},no={description:(0,ev.localize)(2579,"Contributes views containers to the editor"),type:"object",properties:{activitybar:{description:(0,ev.localize)(2580,"Contribute views containers to Activity Bar"),type:"array",items:ni},panel:{description:(0,ev.localize)(2581,"Contribute views containers to Panel"),type:"array",items:ni},secondarySidebar:{description:(0,ev.localize)(2582,"Contribute views containers to Secondary Side Bar"),type:"array",items:ni}},additionalProperties:!1};(c=U||(U={})).Tree="tree",c.Webview="webview",(h=H||(H={})).Visible="visible",h.Hidden="hidden",h.Collapsed="collapsed";let nr={type:"object",required:["id","name","icon"],defaultSnippets:[{body:{id:"${1:id}",name:"${2:name}",icon:"${3:icon}"}}],properties:{type:{markdownDescription:(0,ev.localize)(2583,"Type of the view. This can either be `tree` for a tree view based view or `webview` for a webview based view. The default is `tree`."),type:"string",enum:["tree","webview"],markdownEnumDescriptions:[(0,ev.localize)(2584,"The view is backed by a `TreeView` created by `createTreeView`."),(0,ev.localize)(2585,"The view is backed by a `WebviewView` registered by `registerWebviewViewProvider`.")]},id:{markdownDescription:(0,ev.localize)(2586,"Identifier of the view. This should be unique across all views. It is recommended to include your extension id as part of the view id. Use this to register a data provider through `vscode.window.registerTreeDataProviderForView` API. Also to trigger activating your extension by registering `onView:${id}` event to `activationEvents`."),type:"string"},name:{description:(0,ev.localize)(2587,"The human-readable name of the view. Will be shown"),type:"string"},when:{description:(0,ev.localize)(2588,"Condition which must be true to show this view"),type:"string"},icon:{description:(0,ev.localize)(2589,"Path to the view icon. View icons are displayed when the name of the view cannot be shown. It is recommended that icons be in SVG, though any image file type is accepted."),type:"string"},contextualTitle:{description:(0,ev.localize)(2590,"Human-readable context for when the view is moved out of its original location. By default, the view's container name will be used."),type:"string"},visibility:{description:(0,ev.localize)(2591,"Initial state of the view when the extension is first installed. Once the user has changed the view state by collapsing, moving, or hiding the view, the initial state will not be used again."),type:"string",enum:["visible","hidden","collapsed"],default:"visible",enumDescriptions:[(0,ev.localize)(2592,"The default initial state for the view. In most containers the view will be expanded, however; some built-in containers (explorer, scm, and debug) show all contributed views collapsed regardless of the `visibility`."),(0,ev.localize)(2593,"The view will not be shown in the view container, but will be discoverable through the views menu and other view entry points and can be un-hidden by the user."),(0,ev.localize)(2594,"The view will show in the view container, but will be collapsed.")]},initialSize:{type:"number",description:(0,ev.localize)(2595,"The initial size of the view. The size will behave like the css 'flex' property, and will set the initial size when the view is first shown. In the side bar, this is the height of the view. This value is only respected when the same extension owns both the view and the view container.")},accessibilityHelpContent:{type:"string",markdownDescription:(0,ev.localize)(2596,"When the accessibility help dialog is invoked in this view, this content will be presented to the user as a markdown string. Keybindings will be resolved when provided in the format of <keybinding:commandId>. If there is no keybinding, that will be indicated and this command will be included in a quickpick for easy configuration.")}}},ns={type:"object",required:["id","name"],properties:{id:{description:(0,ev.localize)(2586,"Identifier of the view. This should be unique across all views. It is recommended to include your extension id as part of the view id. Use this to register a data provider through `vscode.window.registerTreeDataProviderForView` API. Also to trigger activating your extension by registering `onView:${id}` event to `activationEvents`."),type:"string"},name:{description:(0,ev.localize)(2587,"The human-readable name of the view. Will be shown"),type:"string"},when:{description:(0,ev.localize)(2588,"Condition which must be true to show this view"),type:"string"},group:{description:(0,ev.localize)(2597,"Nested group in the viewlet"),type:"string"},remoteName:{description:(0,ev.localize)(2598,"The name of the remote type associated with this view"),type:["string","array"],items:{type:"string"}}}},nn={description:(0,ev.localize)(2599,"Contributes views to the editor"),type:"object",properties:{explorer:{description:(0,ev.localize)(2600,"Contributes views to Explorer container in the Activity bar"),type:"array",items:nr,default:[]},debug:{description:(0,ev.localize)(2601,"Contributes views to Debug container in the Activity bar"),type:"array",items:nr,default:[]},scm:{description:(0,ev.localize)(2602,"Contributes views to SCM container in the Activity bar"),type:"array",items:nr,default:[]},test:{description:(0,ev.localize)(2603,"Contributes views to Test container in the Activity bar"),type:"array",items:nr,default:[]},remote:{description:(0,ev.localize)(2604,"Contributes views to Remote container in the Activity bar. To contribute to this container, the 'contribViewsRemote' API proposal must be enabled."),type:"array",items:ns,default:[]}},additionalProperties:{description:(0,ev.localize)(2605,"Contributes views to contributed views container"),type:"array",items:nr,default:[]}},na=nt.ExtensionsRegistry.registerExtensionPoint({extensionPoint:"viewsContainers",jsonSchema:no}),nd=nt.ExtensionsRegistry.registerExtensionPoint({extensionPoint:"views",deps:[na],jsonSchema:nn,activationEventsGenerator:function*(e){for(let t of e)for(let e of Object.values(t))for(let t of e)t.id&&(yield`onView:${t.id}`)}}),nl=class{static{this.ID="workbench.contrib.viewsExtensionHandler"}constructor(e,t){this.instantiationService=e,this.logService=t,this.viewContainersRegistry=eO.Registry.as(ek.Extensions.ViewContainersRegistry),this.viewsRegistry=eO.Registry.as(ek.Extensions.ViewsRegistry),this.handleAndRegisterCustomViewContainers(),this.handleAndRegisterCustomViews()}handleAndRegisterCustomViewContainers(){na.setHandler((e,{added:t,removed:i})=>{i.length&&this.removeCustomViewContainers(i),t.length&&this.addCustomViewContainers(t,this.viewContainersRegistry.all)})}addCustomViewContainers(e,t){let i=eO.Registry.as(ek.Extensions.ViewContainersRegistry),o=7+i.all.filter(e=>!!e.extensionId&&i.getViewContainerLocation(e)===ek.ViewContainerLocation.Sidebar).length,r=5+i.all.filter(e=>!!e.extensionId&&i.getViewContainerLocation(e)===ek.ViewContainerLocation.Panel).length+1,s=100+i.all.filter(e=>!!e.extensionId&&i.getViewContainerLocation(e)===ek.ViewContainerLocation.AuxiliaryBar).length+1;for(let{value:i,collector:n,description:a}of e)Object.entries(i).forEach(([e,i])=>{if(this.isValidViewsContainer(i,n))switch(e){case"activitybar":o=this.registerCustomViewContainers(i,a,o,t,ek.ViewContainerLocation.Sidebar);break;case"panel":r=this.registerCustomViewContainers(i,a,r,t,ek.ViewContainerLocation.Panel);break;case"secondarySidebar":s=this.registerCustomViewContainers(i,a,s,t,ek.ViewContainerLocation.AuxiliaryBar)}})}removeCustomViewContainers(e){let t=eO.Registry.as(ek.Extensions.ViewContainersRegistry),i=e.reduce((e,t)=>(e.add(t.description.identifier),e),new oL.ExtensionIdentifierSet);for(let e of t.all)if(e.extensionId&&i.has(e.extensionId)){let t=this.viewsRegistry.getViews(e);t.length&&this.viewsRegistry.moveViews(t,this.getDefaultViewContainer()),this.deregisterCustomViewContainer(e)}}isValidViewsContainer(e,t){if(!Array.isArray(e))return t.error((0,ev.localize)(2606,"views containers must be an array")),!1;for(let i of e){if("string"!=typeof i.id&&(0,iu.isFalsyOrWhitespace)(i.id)||!/^[a-z0-9_-]+$/i.test(i.id))return t.error((0,ev.localize)(2607,"property `{0}` is mandatory and must be of type `string` with non-empty value. Only alphanumeric characters, '_', and '-' are allowed.","id")),!1;if("string"!=typeof i.title)return t.error((0,ev.localize)(2608,"property `{0}` is mandatory and must be of type `string`","title")),!1;if("string"!=typeof i.icon)return t.error((0,ev.localize)(2608,"property `{0}` is mandatory and must be of type `string`","icon")),!1;if((0,iu.isFalsyOrWhitespace)(i.title)){t.warn((0,ev.localize)(2609,"property `{0}` is mandatory and must be of type `string` with non-empty value","title"));break}}return!0}registerCustomViewContainers(e,t,i,o,r){return e.forEach(e=>{let s=ih.ThemeIcon.fromString(e.icon)||(0,t9.joinPath)(t.extensionLocation,e.icon),n=`workbench.view.extension.${e.id}`,a=e.title||n,d=this.registerCustomViewContainer(n,a,s,i++,t.identifier,r);if(o.length){let t=[];for(let i of o)d!==i&&t.push(...this.viewsRegistry.getViews(i).filter(t=>t.originalContainerId===e.id));t.length&&this.viewsRegistry.moveViews(t,d)}}),i}registerCustomViewContainer(e,t,i,o,r,s){let n=this.viewContainersRegistry.get(e);return n||(n=this.viewContainersRegistry.registerViewContainer({id:e,title:{value:t,original:t},extensionId:r,ctorDescriptor:new e4.SyncDescriptor(ej.ViewPaneContainer,[e,{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,order:o,icon:i},s)),n}deregisterCustomViewContainer(e){this.viewContainersRegistry.deregisterViewContainer(e),eO.Registry.as(eU.Extensions.Viewlets).deregisterPaneComposite(e.id)}handleAndRegisterCustomViews(){nd.setHandler((e,{added:t,removed:i})=>{i.length&&this.removeViews(i),t.length&&this.addViews(t)})}addViews(e){let t=new Set,i=[];for(let o of e){let{value:e,collector:r}=o;Object.entries(e).forEach(([e,s])=>{if(!this.isValidViewDescriptors(s,r))return;if("remote"===e&&!(0,ne.isProposedApiEnabled)(o.description,"contribViewsRemote"))return void r.warn((0,ev.localize)(2610,"View container '{0}' requires 'enabledApiProposals: [\"contribViewsRemote\"]' to be added to 'Remote'.",e));if("agentSessions"===e&&!(0,ne.isProposedApiEnabled)(o.description,"chatSessionsProvider"))return void r.warn((0,ev.localize)(2611,"View container '{0}' requires 'enabledApiProposals: [\"chatSessionsProvider\"]'.",e));let n=this.getViewContainer(e);n||r.warn((0,ev.localize)(2612,"View container '{0}' does not exist and all views registered to it will be added to 'Explorer'.",e));let a=n||this.getDefaultViewContainer(),d=[];for(let i=0;i<s.length;i++){let l,c,h,u=s[i];if(t.has(u.id)){r.error((0,ev.localize)(2613,"Cannot register multiple views with same id `{0}`",u.id));continue}if(null!==this.viewsRegistry.getView(u.id)){r.error((0,ev.localize)(2614,"A view with id `{0}` is already registered.",u.id));continue}let p=oL.ExtensionIdentifier.equals(o.description.identifier,a.extensionId)?i+1:a.viewOrderDelegate?a.viewOrderDelegate.getOrder(u.group):void 0;"string"==typeof u.icon&&(l=ih.ThemeIcon.fromString(u.icon)||(0,t9.joinPath)(o.description.extensionLocation,u.icon));let g=this.convertInitialVisibility(u.visibility),m=this.getViewType(u.type);if(!m){r.error((0,ev.localize)(2615,"Unknown view type `{0}`.",u.type));continue}"number"==typeof u.initialSize&&(a.extensionId?.value===o.description.identifier.value?h=u.initialSize:this.logService.warn(`${o.description.identifier.value} tried to set the view size of ${u.id} but it was ignored because the view container does not belong to it.`)),(0,ne.isProposedApiEnabled)(o.description,"contribAccessibilityHelpContent")&&u.accessibilityHelpContent&&(c=new eh.MarkdownString(u.accessibilityHelpContent));let v={type:m,ctorDescriptor:new e4.SyncDescriptor(m===U.Tree?rs:s8),id:u.id,name:{value:u.name,original:u.name},when:eV.ContextKeyExpr.deserialize(u.when),containerIcon:l||n?.icon,containerTitle:u.contextualTitle||n&&("string"==typeof n.title?n.title:n.title.value),canToggleVisibility:!0,canMoveView:n?.id!==sq,treeView:m===U.Tree?this.instantiationService.createInstance(rS,u.id,u.name,o.description.identifier.value):void 0,collapsed:this.showCollapsed(a)||g===H.Collapsed,order:p,extensionId:o.description.identifier,originalContainerId:e,group:u.group,remoteAuthority:u.remoteName||u.remoteAuthority,virtualWorkspace:u.virtualWorkspace,hideByDefault:g===H.Hidden,workspace:n?.id===sq||void 0,weight:h,accessibilityHelpContent:c};t.add(v.id),d.push(v)}i.push({viewContainer:a,views:d})})}this.viewsRegistry.registerViews2(i)}getViewType(e){return e===U.Webview?U.Webview:e&&e!==U.Tree?void 0:U.Tree}getDefaultViewContainer(){return this.viewContainersRegistry.get(rD.VIEWLET_ID)}removeViews(e){let t=e.reduce((e,t)=>(e.add(t.description.identifier),e),new oL.ExtensionIdentifierSet);for(let e of this.viewContainersRegistry.all){let i=this.viewsRegistry.getViews(e).filter(e=>e.extensionId&&t.has(e.extensionId));if(i.length)for(let t of(this.viewsRegistry.deregisterViews(i,e),i))t.treeView&&t.treeView.dispose()}}convertInitialVisibility(e){if(Object.values(H).includes(e))return e}isValidViewDescriptors(e,t){if(!Array.isArray(e))return t.error((0,ev.localize)(2616,"views must be an array")),!1;for(let i of e){if("string"!=typeof i.id)return t.error((0,ev.localize)(2608,"property `{0}` is mandatory and must be of type `string`","id")),!1;if("string"!=typeof i.name)return t.error((0,ev.localize)(2608,"property `{0}` is mandatory and must be of type `string`","name")),!1;if(i.when&&"string"!=typeof i.when)return t.error((0,ev.localize)(2617,"property `{0}` can be omitted or must be of type `string`","when")),!1;if(i.icon&&"string"!=typeof i.icon)return t.error((0,ev.localize)(2617,"property `{0}` can be omitted or must be of type `string`","icon")),!1;if(i.contextualTitle&&"string"!=typeof i.contextualTitle)return t.error((0,ev.localize)(2617,"property `{0}` can be omitted or must be of type `string`","contextualTitle")),!1;if(i.visibility&&!this.convertInitialVisibility(i.visibility))return t.error((0,ev.localize)(2618,"property `{0}` can be omitted or must be one of {1}","visibility",Object.values(H).join(", "))),!1}return!0}getViewContainer(e){switch(e){case"explorer":return this.viewContainersRegistry.get(rD.VIEWLET_ID);case"debug":return this.viewContainersRegistry.get(rI.VIEWLET_ID);case"scm":return this.viewContainersRegistry.get(s0.VIEWLET_ID);case"remote":return this.viewContainersRegistry.get(sq);default:return this.viewContainersRegistry.get(`workbench.view.extension.${e}`)}}showCollapsed(e){switch(e.id){case rD.VIEWLET_ID:case s0.VIEWLET_ID:case rI.VIEWLET_ID:return!0}return!1}};nl=(0,ei.__decorate)([(0,ei.__param)(0,eD.IInstantiationService),(0,ei.__param)(1,eX.ILogService)],nl);class nc extends oM.Disposable{constructor(){super(...arguments),this.type="table"}shouldRender(e){return!!e.contributes?.viewsContainers}render(e){let t=e.contributes?.viewsContainers||{},i=Object.keys(t).reduce((e,i)=>{let o=t[i];return e.push(...o.map(e=>({...e,location:i}))),e},[]);return i.length?{data:{headers:[(0,ev.localize)(2619,"ID"),(0,ev.localize)(2620,"Title"),(0,ev.localize)(2621,"Where")],rows:i.sort((e,t)=>e.id.localeCompare(t.id)).map(e=>[e.id,e.title,e.location])},dispose:()=>{}}:{data:{headers:[],rows:[]},dispose:()=>{}}}}class nh extends oM.Disposable{constructor(){super(...arguments),this.type="table"}shouldRender(e){return!!e.contributes?.views}render(e){let t=e.contributes?.views||{},i=Object.keys(t).reduce((e,i)=>{let o=t[i];return e.push(...o.map(e=>({...e,location:i}))),e},[]);return i.length?{data:{headers:[(0,ev.localize)(2622,"ID"),(0,ev.localize)(2623,"Name"),(0,ev.localize)(2621,"Where")],rows:i.sort((e,t)=>e.id.localeCompare(t.id)).map(e=>[e.id,e.name,e.location])},dispose:()=>{}}:{data:{headers:[],rows:[]},dispose:()=>{}}}}eO.Registry.as(s7.Extensions.ExtensionFeaturesRegistry).registerExtensionFeature({id:"viewsContainers",label:(0,ev.localize)(2624,"View Containers"),access:{canToggle:!1},renderer:new e4.SyncDescriptor(nc)}),eO.Registry.as(s7.Extensions.ExtensionFeaturesRegistry).registerExtensionFeature({id:"views",label:(0,ev.localize)(2625,"Views"),access:{canToggle:!1},renderer:new e4.SyncDescriptor(nh)}),(0,tH.registerWorkbenchContribution2)(nl.ID,nl,tH.WorkbenchPhase.BlockStartup),e.s([],6848);var nu=e.i(460096),np=e.i(323249),ng=e.i(83190),nm=e.i(915775),nv=e.i(859487),ny=e.i(963631),nC=e.i(979534);class nb extends nC.AbstractTextEditor{constructor(){super(...arguments),this.editorControl=void 0}get scopedContextKeyService(){return this.editorControl?.invokeWithinContext(e=>e.get(eK.IContextKeyService))}getTitle(){return this.input?this.input.getName():(0,ev.localize)(3508,"Text Editor")}createEditorControl(e,t){this.editorControl=this._register(this.instantiationService.createInstance(ny.CodeEditorWidget,e,t,this.getCodeEditorWidgetOptions()))}getCodeEditorWidgetOptions(){return Object.create(null)}updateEditorControlOptions(e){this.editorControl?.updateOptions(e)}getMainControl(){return this.editorControl}getControl(){return this.editorControl}computeEditorViewState(e){if(!this.editorControl)return;let t=this.editorControl.getModel();if(!t)return;let i=t.uri;if(i&&(0,t9.isEqual)(i,e))return this.editorControl.saveViewState()??void 0}setOptions(e){super.setOptions(e),e&&(0,np.applyTextEditorOptions)(e,(0,eN.assertReturnsDefined)(this.editorControl),i$.ScrollType.Smooth)}focus(){super.focus(),this.editorControl?.focus()}hasFocus(){return this.editorControl?.hasTextFocus()||super.hasFocus()}setEditorVisible(e){super.setEditorVisible(e),e?this.editorControl?.onVisible():this.editorControl?.onHide()}layout(e){this.editorControl?.layout(e)}}var nw=e.i(554250);let nf=class extends nb{constructor(e,t,i,o,r,s,n,a,d,l){super(e,t,i,o,r,s,n,d,a,l)}async setInput(e,t,i,o){await super.setInput(e,t,i,o);let r=await e.resolve();if(o.isCancellationRequested)return;if(!(r instanceof nm.BaseTextEditorModel))throw Error("Unable to open file as text");let s=(0,eN.assertReturnsDefined)(this.editorControl),n=r.textEditorModel;if(s.setModel(n),!(0,iV.isTextEditorViewState)(t?.viewState)){let o=this.loadEditorViewState(e,i);o&&(t?.selection&&(o.cursorState=[]),s.restoreViewState(o))}t&&(0,np.applyTextEditorOptions)(t,s,i$.ScrollType.Immediate),s.updateOptions(this.getReadonlyConfiguration(r.isReadonly()))}revealLastLine(){let e=this.editorControl;if(!e)return;let t=e.getModel();if(t){let i=t.getLineCount();e.revealPosition({lineNumber:i,column:t.getLineMaxColumn(i)},i$.ScrollType.Smooth)}}clearInput(){super.clearInput(),this.editorControl?.setModel(null)}tracksEditorViewState(e){return e instanceof nv.UntitledTextEditorInput||e instanceof ng.TextResourceEditorInput}};nf=(0,ei.__decorate)([(0,ei.__param)(2,ew.ITelemetryService),(0,ei.__param)(3,eD.IInstantiationService),(0,ei.__param)(4,eP.IStorageService),(0,ei.__param)(5,nw.ITextResourceConfigurationService),(0,ei.__param)(6,eW.IThemeService),(0,ei.__param)(7,eY.IEditorGroupsService),(0,ei.__param)(8,eQ.IEditorService),(0,ei.__param)(9,tl.IFileService)],nf);let nS=class extends nf{static{$=this}static{this.ID="workbench.editors.textResourceEditor"}constructor(e,t,i,o,r,s,n,a,d,l,c){super($.ID,e,t,i,o,r,s,a,n,c),this.modelService=d,this.languageService=l}createEditorControl(e,t){super.createEditorControl(e,t);let i=this.editorControl;i&&this._register(i.onDidPaste(e=>this.onDidEditorPaste(e,i)))}onDidEditorPaste(e,t){let i;if(this.input instanceof nv.UntitledTextEditorInput&&this.input.hasLanguageSetExplicitly||1!==e.range.startLineNumber||1!==e.range.startColumn||t.getOption(to.EditorOption.readOnly))return;let o=t.getModel();if(o&&o.getLineCount()===e.range.endLineNumber&&o.getLineMaxColumn(e.range.endLineNumber)===e.range.endColumn&&o.getLanguageId()===ip.PLAINTEXT_LANGUAGE_ID){if(e.languageId)i={id:e.languageId,source:"event"};else{let e=this.languageService.guessLanguageIdByFilepathOrFirstLine(o.uri,o.getLineContent(1).substr(0,ij.ModelConstants.FIRST_LINE_DETECTION_LENGTH_LIMIT))??void 0;e&&(i={id:e,source:"guess"})}if(i&&i.id!==ip.PLAINTEXT_LANGUAGE_ID){this.input instanceof nv.UntitledTextEditorInput&&"event"===i.source?this.input.setLanguageId(i.id):o.setLanguage(this.languageService.createById(i.id));let e=this.modelService.getCreationOptions(o.getLanguageId(),o.uri,o.isForSimpleWidget);o.detectIndentation(e.insertSpaces,e.tabSize)}}}};nS=$=(0,ei.__decorate)([(0,ei.__param)(1,ew.ITelemetryService),(0,ei.__param)(2,eD.IInstantiationService),(0,ei.__param)(3,eP.IStorageService),(0,ei.__param)(4,nw.ITextResourceConfigurationService),(0,ei.__param)(5,eW.IThemeService),(0,ei.__param)(6,eQ.IEditorService),(0,ei.__param)(7,eY.IEditorGroupsService),(0,ei.__param)(8,tR.IModelService),(0,ei.__param)(9,t5.ILanguageService),(0,ei.__param)(10,tl.IFileService)],nS);var n_=e.i(308271),nE=e.i(350803),nI=e.i(728489),nD=n_,nT=e.i(733550),nA=e.i(336166);let nx=class extends nA.EditorPlaceholder{constructor(e,t,i,o,r,s){super(e,t,o,r,s),this.callbacks=i,this._onDidChangeMetadata=this._register(new ec.Emitter),this.onDidChangeMetadata=this._onDidChangeMetadata.event,this._onDidOpenInPlace=this._register(new ec.Emitter),this.onDidOpenInPlace=this._onDidOpenInPlace.event}getTitle(){return this.input?this.input.getName():(0,ev.localize)(3053,"Binary Viewer")}async getContents(e,t){let i=await e.resolve();if(!(i instanceof nT.BinaryEditorModel))throw Error("Unable to open file as binary");let o=i.getSize();return this.handleMetadataChanged("number"==typeof o?td.ByteSize.formatSize(o):""),{icon:"$(warning)",label:(0,ev.localize)(3054,"The file is not displayed in the text editor because it is either binary or uses an unsupported text encoding."),actions:[{label:(0,ev.localize)(3055,"Open Anyway"),run:async()=>{await this.callbacks.openInternal(e,t),this._onDidOpenInPlace.fire()}}]}}handleMetadataChanged(e){this.metadata=e,this._onDidChangeMetadata.fire()}getMetadata(){return this.metadata}};nx=(0,ei.__decorate)([(0,ei.__param)(5,eP.IStorageService)],nx);let nR=class extends nD.SideBySideEditor{static{this.ID=iV.BINARY_DIFF_EDITOR_ID}constructor(e,t,i,o,r,s,n,a,d){super(e,t,i,o,r,s,n,a,d)}getMetadata(){let e=this.getPrimaryEditorPane(),t=this.getSecondaryEditorPane();if(e instanceof nx&&t instanceof nx)return(0,ev.localize)(3052,"{0} ↔ {1}",t.getMetadata(),e.getMetadata())}};nR=(0,ei.__decorate)([(0,ei.__param)(1,ew.ITelemetryService),(0,ei.__param)(2,eD.IInstantiationService),(0,ei.__param)(3,eW.IThemeService),(0,ei.__param)(4,eP.IStorageService),(0,ei.__param)(5,ey.IConfigurationService),(0,ei.__param)(6,nw.ITextResourceConfigurationService),(0,ei.__param)(7,eQ.IEditorService),(0,ei.__param)(8,eY.IEditorGroupsService)],nR);var nk=oN,nM=eu,nL=e.i(660273),nO=e.i(184053),nP=e.i(340793),nV=e.i(455162),nK=e.i(445152),nN=e.i(647576),nG=e.i(107700),nF=e.i(633450),nW=e.i(362787),nz=e.i(206548),nB=e.i(355482),nU=e.i(58467),nH=eG,n$=e.i(789482),nq=e.i(577296);(0,t$.registerCss)(void 0);class nY{constructor(e,t){this.primary=e,this.secondary=t}getEncoding(){return this.primary.getEncoding()}async setEncoding(e,t){await ed.Promises.settled([this.primary,this.secondary].map(i=>i.setEncoding(e,t)))}}class nj{constructor(e,t){this.primary=e,this.secondary=t}setLanguageId(e,t){[this.primary,this.secondary].forEach(i=>i.setLanguageId(e,t))}}function nX(e){if(e instanceof nv.UntitledTextEditorInput)return e;if(e instanceof nu.SideBySideEditorInput){let t=nX(e.primary),i=nX(e.secondary);return t&&i?new nY(t,i):t}return(0,eN.areFunctions)(e.setEncoding,e.getEncoding)?e:null}function nJ(e){if(e instanceof nv.UntitledTextEditorInput)return e;if(e instanceof nu.SideBySideEditorInput){let t=nJ(e.primary),i=nJ(e.secondary);return t&&i?new nj(t,i):t}return"function"==typeof e.setLanguageId?e:null}class nZ{constructor(){this.indentation=!1,this.selectionStatus=!1,this.languageId=!1,this.languageStatus=!1,this.encoding=!1,this.EOL=!1,this.tabFocusMode=!1,this.inputMode=!1,this.columnSelectionMode=!1,this.metadata=!1}combine(e){this.indentation=this.indentation||e.indentation,this.selectionStatus=this.selectionStatus||e.selectionStatus,this.languageId=this.languageId||e.languageId,this.languageStatus=this.languageStatus||e.languageStatus,this.encoding=this.encoding||e.encoding,this.EOL=this.EOL||e.EOL,this.tabFocusMode=this.tabFocusMode||e.tabFocusMode,this.inputMode=this.inputMode||e.inputMode,this.columnSelectionMode=this.columnSelectionMode||e.columnSelectionMode,this.metadata=this.metadata||e.metadata}hasChanges(){return this.indentation||this.selectionStatus||this.languageId||this.languageStatus||this.encoding||this.EOL||this.tabFocusMode||this.inputMode||this.columnSelectionMode||this.metadata}}class nQ{get selectionStatus(){return this._selectionStatus}get languageId(){return this._languageId}get encoding(){return this._encoding}get EOL(){return this._EOL}get indentation(){return this._indentation}get tabFocusMode(){return this._tabFocusMode}get inputMode(){return this._inputMode}get columnSelectionMode(){return this._columnSelectionMode}get metadata(){return this._metadata}update(e){let t=new nZ;switch(e.type){case"selectionStatus":this._selectionStatus!==e.selectionStatus&&(this._selectionStatus=e.selectionStatus,t.selectionStatus=!0);break;case"indentation":this._indentation!==e.indentation&&(this._indentation=e.indentation,t.indentation=!0);break;case"languageId":this._languageId!==e.languageId&&(this._languageId=e.languageId,t.languageId=!0);break;case"encoding":this._encoding!==e.encoding&&(this._encoding=e.encoding,t.encoding=!0);break;case"EOL":this._EOL!==e.EOL&&(this._EOL=e.EOL,t.EOL=!0);break;case"tabFocusMode":this._tabFocusMode!==e.tabFocusMode&&(this._tabFocusMode=e.tabFocusMode,t.tabFocusMode=!0);break;case"inputMode":this._inputMode!==e.inputMode&&(this._inputMode=e.inputMode,t.inputMode=!0);break;case"columnSelectionMode":this._columnSelectionMode!==e.columnSelectionMode&&(this._columnSelectionMode=e.columnSelectionMode,t.columnSelectionMode=!0);break;case"metadata":this._metadata!==e.metadata&&(this._metadata=e.metadata,t.metadata=!0)}return t}}let n0=class extends nM.Disposable{constructor(e){super(),this.configurationService=e,this._onDidChange=this._register(new ec.Emitter),this.onDidChange=this._onDidChange.event,this.registerListeners();const t=!0===e.getValue("editor.tabFocusMode");n$.TabFocus.setTabFocusMode(t)}registerListeners(){this._register(n$.TabFocus.onDidChangeTabFocus(e=>this._onDidChange.fire(e))),this._register(this.configurationService.onDidChangeConfiguration(e=>{if(e.affectsConfiguration("editor.tabFocusMode")){let e=!0===this.configurationService.getValue("editor.tabFocusMode");n$.TabFocus.setTabFocusMode(e),this._onDidChange.fire(e)}}))}};n0=(0,ei.__decorate)([(0,ei.__param)(0,ey.IConfigurationService)],n0);class n1 extends nM.Disposable{constructor(){super(),this._onDidChange=this._register(new ec.Emitter),this.onDidChange=this._onDidChange.event,nq.InputMode.setInputMode("insert"),this._register(nq.InputMode.onDidChangeInputMode(e=>this._onDidChange.fire(e)))}}let n2=(0,ev.localize)(3444,"Ln {0}, Col {1} ({2} selected)"),n3=(0,ev.localize)(3445,"Ln {0}, Col {1}"),n5=(0,ev.localize)(3446,"{0} selections ({1} characters selected)"),n6=(0,ev.localize)(3447,"{0} selections"),n4=(0,ev.localize)(3448,"LF"),n9=(0,ev.localize)(3449,"CRLF"),n8=class extends nM.Disposable{constructor(e,t,i,o,r,s,n,a){super(),this.targetWindowId=e,this.editorService=t,this.quickInputService=i,this.languageService=o,this.textFileService=r,this.statusbarService=s,this.configurationService=a,this.tabFocusModeElement=this._register(new nM.MutableDisposable),this.inputModeElement=this._register(new nM.MutableDisposable),this.columnSelectionModeElement=this._register(new nM.MutableDisposable),this.indentationElement=this._register(new nM.MutableDisposable),this.selectionElement=this._register(new nM.MutableDisposable),this.encodingElement=this._register(new nM.MutableDisposable),this.eolElement=this._register(new nM.MutableDisposable),this.languageElement=this._register(new nM.MutableDisposable),this.metadataElement=this._register(new nM.MutableDisposable),this.state=new nQ,this.toRender=void 0,this.activeEditorListeners=this._register(new nM.DisposableStore),this.delayedRender=this._register(new nM.MutableDisposable),this.currentMarkerStatus=this._register(n.createInstance(ae)),this.tabFocusMode=this._register(n.createInstance(n0)),this.inputMode=this._register(n.createInstance(n1)),this.registerCommands(),this.registerListeners()}registerListeners(){this._register(this.editorService.onDidActiveEditorChange(()=>this.updateStatusBar())),this._register(this.textFileService.untitled.onDidChangeEncoding(e=>this.onResourceEncodingChange(e.resource))),this._register(this.textFileService.files.onDidChangeEncoding(e=>this.onResourceEncodingChange(e.resource))),this._register(ec.Event.runAndSubscribe(this.tabFocusMode.onDidChange,e=>{void 0!==e?this.onTabFocusModeChange(e):this.onTabFocusModeChange(this.configurationService.getValue("editor.tabFocusMode"))})),this._register(ec.Event.runAndSubscribe(this.inputMode.onDidChange,e=>this.onInputModeChange(e??"insert")))}registerCommands(){this._register(oH.CommandsRegistry.registerCommand({id:`changeEditorIndentation${this.targetWindowId}`,handler:()=>this.showIndentationPicker()}))}async showIndentationPicker(){let e=(0,tt.getCodeEditor)(this.editorService.activeTextEditorControl);if(!e)return this.quickInputService.pick([{label:(0,ev.localize)(3450,"No text editor active at this time")}]);if(this.editorService.activeEditor?.isReadonly())return this.quickInputService.pick([{label:(0,ev.localize)(3451,"The active code editor is read-only.")}]);let t=[(0,eN.assertReturnsDefined)(e.getAction(nO.IndentUsingSpaces.ID)),(0,eN.assertReturnsDefined)(e.getAction(nO.IndentUsingTabs.ID)),(0,eN.assertReturnsDefined)(e.getAction(nO.ChangeTabDisplaySize.ID)),(0,eN.assertReturnsDefined)(e.getAction(nO.DetectIndentation.ID)),(0,eN.assertReturnsDefined)(e.getAction(nO.IndentationToSpacesAction.ID)),(0,eN.assertReturnsDefined)(e.getAction(nO.IndentationToTabsAction.ID)),(0,eN.assertReturnsDefined)(e.getAction(nL.TrimTrailingWhitespaceAction.ID))].map(t=>({id:t.id,label:t.label,detail:eg.Language.isDefaultVariant()||t.label===t.alias?void 0:t.alias,run:()=>{e.focus(),t.run()}}));t.splice(3,0,{type:"separator",label:(0,ev.localize)(3452,"convert file")}),t.unshift({type:"separator",label:(0,ev.localize)(3453,"change view")});let i=await this.quickInputService.pick(t,{placeHolder:(0,ev.localize)(3454,"Select Action"),matchOnDetail:!0});return i?.run()}updateTabFocusModeElement(e){if(e){if(!this.tabFocusModeElement.value){let e=(0,ev.localize)(3455,"Tab Moves Focus");this.tabFocusModeElement.value=this.statusbarService.addEntry({name:(0,ev.localize)(3456,"Accessibility Mode"),text:e,ariaLabel:e,tooltip:(0,ev.localize)(3457,"Disable Accessibility Mode"),command:"editor.action.toggleTabFocusMode",kind:"prominent"},"status.editor.tabFocusMode",sN.StatusbarAlignment.RIGHT,100.7)}}else this.tabFocusModeElement.clear()}updateInputModeElement(e){if("overtype"===e){if(!this.inputModeElement.value){let e=(0,ev.localize)(3458,"OVR"),t=(0,ev.localize)(3459,"Enable Insert Mode");this.inputModeElement.value=this.statusbarService.addEntry({name:t,text:e,ariaLabel:e,tooltip:t,command:"editor.action.toggleOvertypeInsertMode",kind:"prominent"},"status.editor.inputMode",sN.StatusbarAlignment.RIGHT,100.6)}}else this.inputModeElement.clear()}updateColumnSelectionModeElement(e){if(e){if(!this.columnSelectionModeElement.value){let e=(0,ev.localize)(3460,"Column Selection");this.columnSelectionModeElement.value=this.statusbarService.addEntry({name:(0,ev.localize)(3461,"Column Selection Mode"),text:e,ariaLabel:e,tooltip:(0,ev.localize)(3462,"Disable Column Selection Mode"),command:"editor.action.toggleColumnSelection",kind:"prominent"},"status.editor.columnSelectionMode",sN.StatusbarAlignment.RIGHT,100.8)}}else this.columnSelectionModeElement.clear()}updateSelectionElement(e){if(!e)return void this.selectionElement.clear();let t=(0,tt.getCodeEditor)(this.editorService.activeTextEditorControl)?.getModel()?.uri;if(t?.scheme===tp.Schemas.vscodeNotebookCell)return void this.selectionElement.clear();let i={name:(0,ev.localize)(3463,"Editor Selection"),text:e,ariaLabel:e,tooltip:(0,ev.localize)(3464,"Go to Line/Column"),command:"workbench.action.gotoLine"};this.updateElement(this.selectionElement,i,"status.editor.selection",sN.StatusbarAlignment.RIGHT,100.5)}updateIndentationElement(e){if(!e)return void this.indentationElement.clear();let t=(0,tt.getCodeEditor)(this.editorService.activeTextEditorControl)?.getModel()?.uri;if(t?.scheme===tp.Schemas.vscodeNotebookCell)return void this.indentationElement.clear();let i={name:(0,ev.localize)(3465,"Editor Indentation"),text:e,ariaLabel:e,tooltip:(0,ev.localize)(3466,"Select Indentation"),command:`changeEditorIndentation${this.targetWindowId}`};this.updateElement(this.indentationElement,i,"status.editor.indentation",sN.StatusbarAlignment.RIGHT,100.4)}updateEncodingElement(e){if(!e)return void this.encodingElement.clear();let t={name:(0,ev.localize)(3467,"Editor Encoding"),text:e,ariaLabel:e,tooltip:(0,ev.localize)(3468,"Select Encoding"),command:"workbench.action.editor.changeEncoding"};this.updateElement(this.encodingElement,t,"status.editor.encoding",sN.StatusbarAlignment.RIGHT,100.3)}updateEOLElement(e){if(!e)return void this.eolElement.clear();let t={name:(0,ev.localize)(3469,"Editor End of Line"),text:e,ariaLabel:e,tooltip:(0,ev.localize)(3470,"Select End of Line Sequence"),command:"workbench.action.editor.changeEOL"};this.updateElement(this.eolElement,t,"status.editor.eol",sN.StatusbarAlignment.RIGHT,100.2)}updateLanguageIdElement(e){if(!e)return void this.languageElement.clear();let t={name:(0,ev.localize)(3471,"Editor Language"),text:e,ariaLabel:e,tooltip:(0,ev.localize)(3472,"Select Language Mode"),command:"workbench.action.editor.changeLanguageMode"};this.updateElement(this.languageElement,t,"status.editor.mode",sN.StatusbarAlignment.RIGHT,100.1)}updateMetadataElement(e){if(!e)return void this.metadataElement.clear();let t={name:(0,ev.localize)(3473,"File Information"),text:e,ariaLabel:e,tooltip:(0,ev.localize)(3474,"File Information")};this.updateElement(this.metadataElement,t,"status.editor.info",sN.StatusbarAlignment.RIGHT,100)}updateElement(e,t,i,o,r){e.value?e.value.update(t):e.value=this.statusbarService.addEntry(t,i,o,r)}updateState(e){let t=this.state.update(e);t.hasChanges()&&(this.toRender?this.toRender.combine(t):(this.toRender=t,this.delayedRender.value=(0,er.runAtThisOrScheduleAtNextAnimationFrame)((0,er.getWindowById)(this.targetWindowId,!0).window,()=>{this.delayedRender.clear();let e=this.toRender;this.toRender=void 0,e&&this.doRenderNow()})))}doRenderNow(){this.updateTabFocusModeElement(!!this.state.tabFocusMode),this.updateInputModeElement(this.state.inputMode),this.updateColumnSelectionModeElement(!!this.state.columnSelectionMode),this.updateIndentationElement(this.state.indentation),this.updateSelectionElement(this.state.selectionStatus),this.updateEncodingElement(this.state.encoding),this.updateEOLElement(this.state.EOL?"\r\n"===this.state.EOL?n9:n4:void 0),this.updateLanguageIdElement(this.state.languageId),this.updateMetadataElement(this.state.metadata)}getSelectionLabel(e){if(e?.selections){if(1===e.selections.length)return e.charactersSelected?(0,iu.format)(n2,e.selections[0].positionLineNumber,e.selections[0].positionColumn,e.charactersSelected):(0,iu.format)(n3,e.selections[0].positionLineNumber,e.selections[0].positionColumn);if(e.charactersSelected)return(0,iu.format)(n5,e.selections.length,e.charactersSelected);if(e.selections.length>0)return(0,iu.format)(n6,e.selections.length)}}updateStatusBar(){let e=this.editorService.activeEditor,t=this.editorService.activeEditorPane,i=t?(0,tt.getCodeEditor)(t.getControl())??void 0:void 0;if(this.onColumnSelectionModeChange(i),this.onSelectionChange(i),this.onLanguageChange(i,e),this.onEOLChange(i),this.onEncodingChange(t,i),this.onIndentationChange(i),this.onMetadataChange(t),this.currentMarkerStatus.update(i),this.activeEditorListeners.clear(),t&&this.activeEditorListeners.add(t.onDidChangeControl(()=>{this.updateStatusBar()})),i)this.activeEditorListeners.add(i.onDidChangeConfiguration(e=>{e.hasChanged(to.EditorOption.columnSelection)&&this.onColumnSelectionModeChange(i)})),this.activeEditorListeners.add(ec.Event.defer(i.onDidChangeCursorPosition)(()=>{this.onSelectionChange(i),this.currentMarkerStatus.update(i)})),this.activeEditorListeners.add(i.onDidChangeModelLanguage(()=>{this.onLanguageChange(i,e)})),this.activeEditorListeners.add(ec.Event.accumulate(i.onDidChangeModelContent)(e=>{this.onEOLChange(i),this.currentMarkerStatus.update(i);let t=i.getSelections();if(t){for(let o of e)for(let e of o.changes)if(t.some(t=>tD.Range.areIntersecting(t,e.range))){this.onSelectionChange(i);break}}})),this.activeEditorListeners.add(i.onDidChangeModelOptions(()=>{this.onIndentationChange(i)}));else if(t instanceof nx||t instanceof nR){let e=[];if(t instanceof nR){let i=t.getPrimaryEditorPane();i instanceof nx&&e.push(i);let o=t.getSecondaryEditorPane();o instanceof nx&&e.push(o)}else e.push(t);for(let i of e)this.activeEditorListeners.add(i.onDidChangeMetadata(()=>{this.onMetadataChange(t)})),this.activeEditorListeners.add(i.onDidOpenInPlace(()=>{this.updateStatusBar()}))}}onLanguageChange(e,t){let i={type:"languageId",languageId:void 0};if(e&&t&&nJ(t)){let t=e.getModel();if(t){let e=t.getLanguageId();i.languageId=this.languageService.getLanguageName(e)??void 0}}this.updateState(i)}onIndentationChange(e){let t={type:"indentation",indentation:void 0};if(e){let i=e.getModel();if(i){let e=i.getOptions();t.indentation=e.insertSpaces?e.tabSize===e.indentSize?(0,ev.localize)(3475,"Spaces: {0}",e.indentSize):(0,ev.localize)(3476,"Spaces: {0} (Tab Size: {1})",e.indentSize,e.tabSize):(0,ev.localize)(3477,"Tab Size: {0}",e.tabSize)}}this.updateState(t)}onMetadataChange(e){let t={type:"metadata",metadata:void 0};(e instanceof nx||e instanceof nR)&&(t.metadata=e.getMetadata()),this.updateState(t)}onColumnSelectionModeChange(e){let t={type:"columnSelectionMode",columnSelectionMode:!1};e?.getOption(to.EditorOption.columnSelection)&&(t.columnSelectionMode=!0),this.updateState(t)}onSelectionChange(e){let t=Object.create(null);if(e){t.selections=e.getSelections()||[],t.charactersSelected=0;let i=e.getModel();if(i)for(let e of t.selections)"number"!=typeof t.charactersSelected&&(t.charactersSelected=0),t.charactersSelected+=i.getCharacterCountInRange(e);if(1===t.selections.length){let i=e.getPosition(),o=new nP.Selection(t.selections[0].selectionStartLineNumber,t.selections[0].selectionStartColumn,t.selections[0].positionLineNumber,i?e.getStatusbarColumn(i):t.selections[0].positionColumn);t.selections[0]=o}}this.updateState({type:"selectionStatus",selectionStatus:this.getSelectionLabel(t)})}onEOLChange(e){let t={type:"EOL",EOL:void 0};if(e&&!e.getOption(to.EditorOption.readOnly)){let i=e.getModel();i&&(t.EOL=i.getEOL())}this.updateState(t)}onEncodingChange(e,t){if(e&&!this.isActiveEditor(e))return;let i={type:"encoding",encoding:void 0};if(e&&t?.hasModel()){let t=e.input?nX(e.input):null;if(t){let e=t.getEncoding(),o="string"==typeof e?nN.SUPPORTED_ENCODINGS[e]:void 0;o?i.encoding=o.labelShort:i.encoding=e}}this.updateState(i)}onResourceEncodingChange(e){let t=this.editorService.activeEditorPane;if(t){let i=iV.EditorResourceAccessor.getCanonicalUri(t.input,{supportSideBySide:iV.SideBySideEditor.PRIMARY});if(i&&(0,t9.isEqual)(i,e)){let e=(0,tt.getCodeEditor)(t.getControl())??void 0;return this.onEncodingChange(t,e)}}}onTabFocusModeChange(e){this.updateState({type:"tabFocusMode",tabFocusMode:e})}onInputModeChange(e){this.updateState({type:"inputMode",inputMode:e})}isActiveEditor(e){let t=this.editorService.activeEditorPane;return!!t&&t===e}};n8=(0,ei.__decorate)([(0,ei.__param)(1,eQ.IEditorService),(0,ei.__param)(2,rM.IQuickInputService),(0,ei.__param)(3,t5.ILanguageService),(0,ei.__param)(4,tu.ITextFileService),(0,ei.__param)(5,sG.IStatusbarService),(0,ei.__param)(6,eD.IInstantiationService),(0,ei.__param)(7,ey.IConfigurationService)],n8);let n7=class extends nM.Disposable{static{this.ID="workbench.contrib.editorStatus"}constructor(e){for(const t of(super(),this.editorGroupService=e,e.parts))this.createEditorStatus(t);this._register(e.onDidCreateAuxiliaryEditorPart(e=>this.createEditorStatus(e)))}createEditorStatus(e){let t=new nM.DisposableStore;ec.Event.once(e.onWillDispose)(()=>t.dispose());let i=this.editorGroupService.getScopedInstantiationService(e);t.add(i.createInstance(n8,e.windowId))}};n7=(0,ei.__decorate)([(0,ei.__param)(0,eY.IEditorGroupsService)],n7);let ae=class extends nM.Disposable{constructor(e,t,i){super(),this.statusbarService=e,this.markerService=t,this.configurationService=i,this.editor=void 0,this.markers=[],this.currentMarker=null,this.statusBarEntryAccessor=this._register(new nM.MutableDisposable),this._register(t.onMarkerChanged(e=>this.onMarkerChanged(e))),this._register(ec.Event.filter(i.onDidChangeConfiguration,e=>e.affectsConfiguration("problems.showCurrentInStatus"))(()=>this.updateStatus()))}update(e){this.editor=e,this.updateMarkers(),this.updateStatus()}updateStatus(){let e=this.currentMarker;if(this.currentMarker=this.getMarker(),this.hasToUpdateStatus(e,this.currentMarker))if(this.currentMarker){let e=(0,iu.splitLines)(this.currentMarker.message)[0],t=`${this.getType(this.currentMarker)} ${e}`;this.statusBarEntryAccessor.value?this.statusBarEntryAccessor.value.update({name:(0,ev.localize)(3478,"Current Problem"),text:t,ariaLabel:t}):this.statusBarEntryAccessor.value=this.statusbarService.addEntry({name:(0,ev.localize)(3478,"Current Problem"),text:t,ariaLabel:t},"statusbar.currentProblem",sN.StatusbarAlignment.LEFT)}else this.statusBarEntryAccessor.clear()}hasToUpdateStatus(e,t){return!t||!e||nW.IMarkerData.makeKey(e)!==nW.IMarkerData.makeKey(t)}getType(e){switch(e.severity){case nW.MarkerSeverity.Error:return"$(error)";case nW.MarkerSeverity.Warning:return"$(warning)";case nW.MarkerSeverity.Info:return"$(info)"}return""}getMarker(){if(!this.configurationService.getValue("problems.showCurrentInStatus")||!this.editor||!this.editor.getModel())return null;let e=this.editor.getPosition();return e&&this.markers.find(t=>tD.Range.containsPosition(t,e))||null}onMarkerChanged(e){if(!this.editor)return;let t=this.editor.getModel();!t||(!t||e.some(e=>(0,t9.isEqual)(t.uri,e)))&&this.updateMarkers()}updateMarkers(){if(!this.editor)return;let e=this.editor.getModel();e&&(e?(this.markers=this.markerService.read({resource:e.uri,severities:nW.MarkerSeverity.Error|nW.MarkerSeverity.Warning|nW.MarkerSeverity.Info}),this.markers.sort(this.compareMarker)):this.markers=[],this.updateStatus())}compareMarker(e,t){let i=(0,iu.compare)(e.resource.toString(),t.resource.toString());return 0===i&&(i=nW.MarkerSeverity.compare(e.severity,t.severity)),0===i&&(i=tD.Range.compareRangesUsingStarts(e,t)),i}};ae=(0,ei.__decorate)([(0,ei.__param)(0,sG.IStatusbarService),(0,ei.__param)(1,nz.IMarkerService),(0,ei.__param)(2,ey.IConfigurationService)],ae);let at=class extends nk.Action{static{q=this}static{this.ID="workbench.action.showLanguageExtensions"}constructor(e,t,i){super(q.ID,(0,ev.localize)(3479,"Search Marketplace Extensions for '{0}'...",e)),this.fileExtension=e,this.commandService=t,this.enabled=i.isEnabled()}async run(){await this.commandService.executeCommand("workbench.extensions.action.showExtensionsForLanguage",this.fileExtension)}};at=q=(0,ei.__decorate)([(0,ei.__param)(1,o$.ICommandService),(0,ei.__param)(2,nV.IExtensionGalleryService)],at);class ai extends nH.Action2{static{this.ID="workbench.action.editor.changeLanguageMode"}constructor(){super({id:ai.ID,title:(0,ev.localize2)(3480,"Change Language Mode"),f1:!0,keybinding:{weight:eF.KeybindingWeight.WorkbenchContrib,primary:(0,iO.KeyChord)(iO.KeyMod.CtrlCmd|iO.KeyCode.KeyK,iO.KeyCode.KeyM)},precondition:eV.ContextKeyExpr.not("notebookEditorFocused"),metadata:{description:(0,ev.localize)(3481,"Change the language mode of the active text editor."),args:[{name:(0,ev.localize)(3482,"The name of the language mode to change to."),constraint:e=>"string"==typeof e}]}})}async run(e,t){let i,o,r,s,n,a=e.get(rM.IQuickInputService),d=e.get(eQ.IEditorService),l=e.get(t5.ILanguageService),c=e.get(nU.ILanguageDetectionService),h=e.get(tu.ITextFileService),u=e.get(s$.IPreferencesService),p=e.get(eD.IInstantiationService),g=e.get(ey.IConfigurationService),m=e.get(ew.ITelemetryService),v=(0,tt.getCodeEditor)(d.activeTextEditorControl);if(!v)return void await a.pick([{label:(0,ev.localize)(3450,"No text editor active at this time")}]);let y=v.getModel(),C=iV.EditorResourceAccessor.getOriginalUri(d.activeEditor,{supportSideBySide:iV.SideBySideEditor.PRIMARY});y&&(o=y.getLanguageId(),i=l.getLanguageName(o)??void 0);let b=!!C;C?.scheme!==tp.Schemas.untitled||h.untitled.get(C)?.hasAssociatedFilePath||(b=!1);let w=l.getSortedRegisteredLanguageNames().map(({languageName:e,languageId:t})=>{let o,r=l.getExtensions(t).join(" ");return o=i===e?(0,ev.localize)(3483,"({0}) - Configured Language",t):(0,ev.localize)(3484,"({0})",t),{label:e,meta:r,iconClasses:(0,nF.getIconClassesForLanguageId)(t),description:o}});if(w.unshift({type:"separator",label:(0,ev.localize)(3485,"languages (identifier)")}),b&&C){let e=(0,t9.extname)(C)||(0,t9.basename)(C);(n=p.createInstance(at,e)).enabled&&w.unshift(n),s={label:(0,ev.localize)(3486,"Configure '{0}' language based settings...",i)},w.unshift(s),r={label:(0,ev.localize)(3487,"Configure File Association for '{0}'...",e)},w.unshift(r)}let f={label:(0,ev.localize)(3488,"Auto Detect")};y&&y.getValueLength()>0&&w.unshift(f);let S="string"==typeof t?{label:t}:await a.pick(w,{placeHolder:(0,ev.localize)(3489,"Select Language Mode"),matchOnDescription:!0});if(!S)return;if(S===n)return void n.run();if(S===r){C&&this.configureFileAssociation(C,l,a,g);return}if(S===s)return void u.openUserSettings({jsonEditor:!0,revealSetting:{key:`[${o??null}]`,edit:!0}});let _=d.activeEditor;if(_){let e=nJ(_);if(e){let t;if(S===f){if(y){let e=iV.EditorResourceAccessor.getOriginalUri(_,{supportSideBySide:iV.SideBySideEditor.PRIMARY});if(e){let i=l.guessLanguageIdByFilepathOrFirstLine(e,y.getLineContent(1))??void 0;i&&"unknown"!==i||(i=await c.detectLanguage(e)),i&&(t=l.createById(i))}}}else{let e=l.getLanguageIdByLanguageName(S.label);t=l.createById(e),C&&c.detectLanguage(C).then(e=>{let t=l.getLanguageIdByLanguageName(S.label)||"unknown";if(e===o&&o!==t){let e=g.getValue("workbench.editor.preferHistoryBasedLanguageDetection")?"history":"classic";m.publicLog2(nB.AutomaticLanguageDetectionLikelyWrongId,{currentLanguageId:i??"unknown",nextLanguageId:S.label,lineCount:y?.getLineCount()??-1,modelPreference:e})}})}if(void 0!==t&&(e.setLanguageId(t.languageId,ai.ID),C?.scheme===tp.Schemas.untitled)){let e=g.getValue("workbench.editor.preferHistoryBasedLanguageDetection")?"history":"classic";m.publicLog2("setUntitledDocumentLanguage",{to:t.languageId,from:o??"none",modelPreference:e})}}v.focus()}}configureFileAssociation(e,t,i,o){let r=(0,t9.extname)(e),s=(0,t9.basename)(e),n=t.guessLanguageIdByFilepathOrFirstLine(e$.URI.file(s)),a=t.getSortedRegisteredLanguageNames().map(({languageName:e,languageId:t})=>({id:t,label:e,iconClasses:(0,nF.getIconClassesForLanguageId)(t),description:t===n?(0,ev.localize)(3490,"Current Association"):void 0}));setTimeout(async()=>{let e=await i.pick(a,{placeHolder:(0,ev.localize)(3491,"Select Language Mode to Associate with '{0}'",r||s)});if(e){let t,i=o.inspect(td.FILES_ASSOCIATIONS_CONFIG);t=r&&"."!==s[0]?`*${r}`:s;let n=rk.ConfigurationTarget.USER;i.workspaceValue?.[t]&&(n=rk.ConfigurationTarget.WORKSPACE);let a=(0,nG.deepClone)(n===rk.ConfigurationTarget.WORKSPACE?i.workspaceValue:i.userValue)||Object.create(null);a[t]=e.id,o.updateValue(td.FILES_ASSOCIATIONS_CONFIG,a,n)}},50)}}class ao extends nH.Action2{constructor(){super({id:"workbench.action.editor.changeEOL",title:(0,ev.localize2)(3492,"Change End of Line Sequence"),f1:!0})}async run(e){let t=e.get(eQ.IEditorService),i=e.get(rM.IQuickInputService),o=(0,tt.getCodeEditor)(t.activeTextEditorControl);if(!o)return void await i.pick([{label:(0,ev.localize)(3450,"No text editor active at this time")}]);if(t.activeEditor?.isReadonly())return void await i.pick([{label:(0,ev.localize)(3451,"The active code editor is read-only.")}]);let r=o.getModel(),s=[{label:n4,eol:ij.EndOfLineSequence.LF},{label:n9,eol:ij.EndOfLineSequence.CRLF}],n=+(r?.getEOL()!=="\n"),a=await i.pick(s,{placeHolder:(0,ev.localize)(3493,"Select End of Line Sequence"),activeItem:s[n]});if(a){let e=(0,tt.getCodeEditor)(t.activeTextEditorControl);e?.hasModel()&&!t.activeEditor?.isReadonly()&&((r=e.getModel()).pushStackElement(),r.pushEOL(a.eol),r.pushStackElement())}o.focus()}}class ar extends nH.Action2{constructor(){super({id:"workbench.action.editor.changeEncoding",title:(0,ev.localize2)(3494,"Change File Encoding"),f1:!0})}async run(e){let t,i,o,r,s=e.get(eQ.IEditorService),n=e.get(rM.IQuickInputService),a=e.get(tl.IFileService),d=e.get(tu.ITextFileService),l=e.get(nw.ITextResourceConfigurationService),c=e.get(eb.IDialogService),h=(0,tt.getCodeEditor)(s.activeTextEditorControl);if(!h)return void await n.pick([{label:(0,ev.localize)(3450,"No text editor active at this time")}]);let u=s.activeEditorPane;if(!u)return void await n.pick([{label:(0,ev.localize)(3450,"No text editor active at this time")}]);let p=nX(u.input);if(!p)return void await n.pick([{label:(0,ev.localize)(3495,"No file active at this time")}]);let g={label:(0,ev.localize)(3496,"Save with Encoding")},m={label:(0,ev.localize)(3497,"Reopen with Encoding")};if(!eg.Language.isDefaultVariant()){let e="Save with Encoding";e!==g.label&&(g.detail=e);let t="Reopen with Encoding";t!==m.label&&(m.detail=t)}if(!(t=p instanceof nv.UntitledTextEditorInput?g:u.input.isReadonly()?m:await n.pick([m,g],{placeHolder:(0,ev.localize)(3454,"Select Action"),matchOnDetail:!0})))return;await (0,ed.timeout)(50);let v=iV.EditorResourceAccessor.getOriginalUri(u.input,{supportSideBySide:iV.SideBySideEditor.PRIMARY});if(!v||!a.hasProvider(v)&&v.scheme!==tp.Schemas.untitled)return;a.hasProvider(v)&&(r=(await d.readStream(v,{autoGuessEncoding:!0,candidateGuessEncodings:l.getValue(v,"files.candidateGuessEncodings")})).encoding);let y=t===m,C=l.getValue(v,"files.encoding"),b=Object.keys(nN.SUPPORTED_ENCODINGS).sort((e,t)=>e===C?-1:t===C?1:nN.SUPPORTED_ENCODINGS[e].order-nN.SUPPORTED_ENCODINGS[t].order).filter(e=>(e!==r||r===C)&&(!y||!nN.SUPPORTED_ENCODINGS[e].encodeOnly)).map((e,t)=>(e===p.getEncoding()?i=t:nN.SUPPORTED_ENCODINGS[e].alias===p.getEncoding()&&(o=t),{id:e,label:nN.SUPPORTED_ENCODINGS[e].labelLong,description:e})),w=b.slice();r&&C!==r&&nN.SUPPORTED_ENCODINGS[r]&&(b.unshift({type:"separator"}),b.unshift({id:r,label:nN.SUPPORTED_ENCODINGS[r].labelLong,description:(0,ev.localize)(3498,"Guessed from content")}));let f=await n.pick(b,{placeHolder:y?(0,ev.localize)(3499,"Select File Encoding to Reopen File"):(0,ev.localize)(3500,"Select File Encoding to Save with"),activeItem:w["number"==typeof i?i:"number"==typeof o?o:-1]});if(!f||!s.activeEditorPane)return;let S=nX(s.activeEditorPane.input);if(void 0!==f.id&&S){if(y&&s.activeEditorPane.input.isDirty()){let{confirmed:e}=await c.confirm({message:(0,ev.localize)(3501,"Do you want to revert the active text editor and reopen with a different encoding?"),detail:(0,ev.localize)(3502,"This will discard any unsaved changes."),primaryButton:(0,ev.localize)(3503,"Discard Changes and Reopen")});if(!e)return;await s.activeEditorPane.input.revert(s.activeEditorPane.group.id)}await S.setEncoding(f.id,y?nK.EncodingMode.Decode:nK.EncodingMode.Encode)}h.focus()}}var as=e.i(602731),an=e.i(199466),aa=e.i(551950),ad=e.i(370507),al=e.i(988198),ac=eu,ah=e.i(1125),au=e.i(951129),ap=e.i(292035),ag=e.i(337161),am=e.i(826001),av=e.i(219170);let ay=class{constructor(e,t,i){this.filesConfigurationService=e,this.environmentService=t,this.pathService=i}canSerialize(e){return this.filesConfigurationService.isHotExitEnabled&&!e.isDisposed()}serialize(e){let t;if(!this.canSerialize(e))return;let i=e.resource;e.hasAssociatedFilePath&&(i=(0,t9.toLocalResource)(i,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme));let o=e.getLanguageId();return o!==ip.PLAINTEXT_LANGUAGE_ID?t=o:e.hasLanguageSetExplicitly&&(t=o),JSON.stringify({resourceJSON:i.toJSON(),modeId:t,encoding:e.getEncoding()})}deserialize(e,t){return e.invokeFunction(e=>{let i=JSON.parse(t),o=e$.URI.revive(i.resourceJSON),r=i.modeId,s=i.encoding;return e.get(ah.ITextEditorService).createTextEditor({resource:o,languageId:r,encoding:s,forceUntitled:!0})})}};ay=(0,ei.__decorate)([(0,ei.__param)(0,au.IFilesConfigurationService),(0,ei.__param)(1,e_.IWorkbenchEnvironmentService),(0,ei.__param)(2,ap.IPathService)],ay);let aC=class extends ac.Disposable{static{this.ID="workbench.contrib.untitledTextEditorWorkingCopyEditorHandler"}constructor(e,t,i,o,r){super(),this.environmentService=t,this.pathService=i,this.textEditorService=o,this.untitledTextEditorService=r,this._register(e.registerHandler(this))}handles(e){return e.resource.scheme===tp.Schemas.untitled&&e.typeId===ag.NO_TYPE_ID}isOpen(e,t){return!!this.handles(e)&&t instanceof nv.UntitledTextEditorInput&&(0,t9.isEqual)(e.resource,t.resource)}createEditor(e){let t;return t=this.untitledTextEditorService.isUntitledWithAssociatedResource(e.resource)?(0,t9.toLocalResource)(e.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme):e.resource,this.textEditorService.createTextEditor({resource:t,forceUntitled:!0})}};aC=(0,ei.__decorate)([(0,ei.__param)(0,am.IWorkingCopyEditorService),(0,ei.__param)(1,e_.IWorkbenchEnvironmentService),(0,ei.__param)(2,ap.IPathService),(0,ei.__param)(3,ah.ITextEditorService),(0,ei.__param)(4,av.IUntitledTextEditorService)],aC);var ab=eu,aw=e.i(803777),af=e.i(781112),aS=e.i(865384);let a_=class extends ab.Disposable{static{Y=this}static{this.ID="workbench.contrib.dynamicEditorConfigurations"}static{this.AUTO_LOCK_DEFAULT_ENABLED=new Set(["terminalEditor","mainThreadWebview-simpleBrowser.view","mainThreadWebview-browserPreview","workbench.editor.processExplorer"])}static{this.AUTO_LOCK_EXTRA_EDITORS=[{id:"workbench.input.interactive",label:(0,ev.localize)(3398,"Interactive Window"),priority:af.RegisteredEditorPriority.builtin},{id:"mainThreadWebview-markdown.preview",label:(0,ev.localize)(3399,"Markdown Preview"),priority:af.RegisteredEditorPriority.builtin},{id:"mainThreadWebview-simpleBrowser.view",label:(0,ev.localize)(3400,"Simple Browser"),priority:af.RegisteredEditorPriority.builtin},{id:"mainThreadWebview-browserPreview",label:(0,ev.localize)(3401,"Live Preview"),priority:af.RegisteredEditorPriority.builtin}]}static{this.AUTO_LOCK_REMOVE_EDITORS=new Set(["vscode-interactive-input","interactive","vscode.markdown.preview.editor"])}constructor(e,t,i){super(),this.editorResolverService=e,this.environmentService=i,this.configurationRegistry=eO.Registry.as(tr.Extensions.Configuration),(async()=>{await t.whenInstalledExtensionsRegistered(),this.updateDynamicEditorConfigurations(),this.registerListeners()})()}registerListeners(){this._register(ec.Event.debounce(this.editorResolverService.onDidChangeEditorRegistrations,(e,t)=>t)(()=>this.updateDynamicEditorConfigurations()))}updateDynamicEditorConfigurations(){let e=[...this.editorResolverService.getEditors(),...Y.AUTO_LOCK_EXTRA_EDITORS].filter(e=>!Y.AUTO_LOCK_REMOVE_EDITORS.has(e.id)),t=this.editorResolverService.getEditors().filter(e=>e.priority!==af.RegisteredEditorPriority.exclusive).map(e=>e.id),i=Object.create(null);for(let t of e)i[t.id]={type:"boolean",default:Y.AUTO_LOCK_DEFAULT_ENABLED.has(t.id),description:t.label};let o=Object.create(null);for(let t of e)o[t.id]=Y.AUTO_LOCK_DEFAULT_ENABLED.has(t.id);let r=this.autoLockConfigurationNode;this.autoLockConfigurationNode={...aw.workbenchConfigurationNodeBase,properties:{"workbench.editor.autoLockGroups":{type:"object",description:(0,ev.localize)(3402,"If an editor matching one of the listed types is opened as the first in an editor group and more than one group is open, the group is automatically locked. Locked groups will only be used for opening editors when explicitly chosen by a user gesture (for example drag and drop), but not by default. Consequently, the active editor in a locked group is less likely to be replaced accidentally with a different editor."),properties:i,default:o,additionalProperties:!1}}};let s=this.defaultBinaryEditorConfigurationNode;this.defaultBinaryEditorConfigurationNode={...aw.workbenchConfigurationNodeBase,properties:{"workbench.editor.defaultBinaryEditor":{type:"string",default:"",enum:[...t,""],description:(0,ev.localize)(3403,"The default editor for files detected as binary. If undefined, the user will be presented with a picker.")}}};let n=this.editorAssociationsConfigurationNode;this.editorAssociationsConfigurationNode={...aw.workbenchConfigurationNodeBase,properties:{"workbench.editorAssociations":{type:"object",markdownDescription:(0,ev.localize)(3404,'Configure [glob patterns](https://aka.ms/vscode-glob-patterns) to editors (for example `"*.hex": "hexEditor.hexedit"`). These have precedence over the default behavior.'),patternProperties:{".*":{type:"string",enum:t}}}}};let a=this.editorLargeFileConfirmationConfigurationNode;this.editorLargeFileConfirmationConfigurationNode={...aw.workbenchConfigurationNodeBase,properties:{"workbench.editorLargeFileConfirmation":{type:"number",default:(0,td.getLargeFileConfirmationLimit)(this.environmentService.remoteAuthority)/td.ByteSize.MB,minimum:1,scope:tr.ConfigurationScope.RESOURCE,markdownDescription:(0,ev.localize)(3405,"Controls the minimum size of a file in MB before asking for confirmation when opening in the editor. Note that this setting may not apply to all editor types and environments.")}}},this.configurationRegistry.updateConfigurations({add:[this.autoLockConfigurationNode,this.defaultBinaryEditorConfigurationNode,this.editorAssociationsConfigurationNode,this.editorLargeFileConfirmationConfigurationNode],remove:(0,ea.coalesce)([r,s,n,a])})}};a_=Y=(0,ei.__decorate)([(0,ei.__param)(0,aS.IEditorResolverService),(0,ei.__param)(1,ez.IExtensionService),(0,ei.__param)(2,e_.IWorkbenchEnvironmentService)],a_);var aE=e.i(508267),aI=e.i(688857),aD=e.i(936915);e.i(712418),eO.Registry.as(iV.EditorExtensions.EditorPane).registerEditorPane(e6.EditorPaneDescriptor.create(nS,nS.ID,(0,ev.localize)(3117,"Text Editor")),[new e4.SyncDescriptor(nv.UntitledTextEditorInput),new e4.SyncDescriptor(ng.TextResourceEditorInput)]),eO.Registry.as(iV.EditorExtensions.EditorPane).registerEditorPane(e6.EditorPaneDescriptor.create(nI.TextDiffEditor,nI.TextDiffEditor.ID,(0,ev.localize)(3118,"Text Diff Editor")),[new e4.SyncDescriptor(nE.DiffEditorInput)]),eO.Registry.as(iV.EditorExtensions.EditorPane).registerEditorPane(e6.EditorPaneDescriptor.create(nR,nR.ID,(0,ev.localize)(3119,"Binary Diff Editor")),[new e4.SyncDescriptor(nE.DiffEditorInput)]),eO.Registry.as(iV.EditorExtensions.EditorPane).registerEditorPane(e6.EditorPaneDescriptor.create(n_.SideBySideEditor,n_.SideBySideEditor.ID,(0,ev.localize)(3120,"Side by Side Editor")),[new e4.SyncDescriptor(nu.SideBySideEditorInput)]),eO.Registry.as(iV.EditorExtensions.EditorFactory).registerEditorSerializer(nv.UntitledTextEditorInput.ID,ay),eO.Registry.as(iV.EditorExtensions.EditorFactory).registerEditorSerializer(nu.SideBySideEditorInput.ID,nu.SideBySideEditorInputSerializer),eO.Registry.as(iV.EditorExtensions.EditorFactory).registerEditorSerializer(nE.DiffEditorInput.ID,nE.DiffEditorInputSerializer),(0,tH.registerWorkbenchContribution2)(n7.ID,n7,tH.WorkbenchPhase.BlockRestore),(0,tH.registerWorkbenchContribution2)(aC.ID,aC,tH.WorkbenchPhase.BlockRestore),(0,tH.registerWorkbenchContribution2)(a_.ID,a_,tH.WorkbenchPhase.BlockRestore);let aT=eO.Registry.as(ad.Extensions.Quickaccess),aA="inEditorsPicker",ax=eV.ContextKeyExpr.and(aa.inQuickPickContext,eV.ContextKeyExpr.has(aA));aT.registerQuickAccessProvider({ctor:al.ActiveGroupEditorsByMostRecentlyUsedQuickAccess,prefix:al.ActiveGroupEditorsByMostRecentlyUsedQuickAccess.PREFIX,contextKey:aA,placeholder:(0,ev.localize)(3121,"Type the name of an editor to open it."),helpEntries:[{description:(0,ev.localize)(3122,"Show Editors in Active Group by Most Recently Used"),commandId:as.ShowEditorsInActiveGroupByMostRecentlyUsedAction.ID}]}),aT.registerQuickAccessProvider({ctor:al.AllEditorsByAppearanceQuickAccess,prefix:al.AllEditorsByAppearanceQuickAccess.PREFIX,contextKey:aA,placeholder:(0,ev.localize)(3121,"Type the name of an editor to open it."),helpEntries:[{description:(0,ev.localize)(3123,"Show All Opened Editors By Appearance"),commandId:as.ShowAllEditorsByAppearanceAction.ID}]}),aT.registerQuickAccessProvider({ctor:al.AllEditorsByMostRecentlyUsedQuickAccess,prefix:al.AllEditorsByMostRecentlyUsedQuickAccess.PREFIX,contextKey:aA,placeholder:(0,ev.localize)(3121,"Type the name of an editor to open it."),helpEntries:[{description:(0,ev.localize)(3124,"Show All Opened Editors By Most Recently Used"),commandId:as.ShowAllEditorsByMostRecentlyUsedAction.ID}]}),(0,eG.registerAction2)(ai),(0,eG.registerAction2)(ao),(0,eG.registerAction2)(ar),(0,eG.registerAction2)(as.NavigateForwardAction),(0,eG.registerAction2)(as.NavigateBackwardsAction),(0,eG.registerAction2)(as.OpenNextEditor),(0,eG.registerAction2)(as.OpenPreviousEditor),(0,eG.registerAction2)(as.OpenNextEditorInGroup),(0,eG.registerAction2)(as.OpenPreviousEditorInGroup),(0,eG.registerAction2)(as.OpenFirstEditorInGroup),(0,eG.registerAction2)(as.OpenLastEditorInGroup),(0,eG.registerAction2)(as.OpenNextRecentlyUsedEditorAction),(0,eG.registerAction2)(as.OpenPreviousRecentlyUsedEditorAction),(0,eG.registerAction2)(as.OpenNextRecentlyUsedEditorInGroupAction),(0,eG.registerAction2)(as.OpenPreviousRecentlyUsedEditorInGroupAction),(0,eG.registerAction2)(as.ReopenClosedEditorAction),(0,eG.registerAction2)(as.ClearRecentFilesAction),(0,eG.registerAction2)(as.ShowAllEditorsByAppearanceAction),(0,eG.registerAction2)(as.ShowAllEditorsByMostRecentlyUsedAction),(0,eG.registerAction2)(as.ShowEditorsInActiveGroupByMostRecentlyUsedAction),(0,eG.registerAction2)(as.CloseAllEditorsAction),(0,eG.registerAction2)(as.CloseAllEditorGroupsAction),(0,eG.registerAction2)(as.CloseLeftEditorsInGroupAction),(0,eG.registerAction2)(as.CloseEditorsInOtherGroupsAction),(0,eG.registerAction2)(as.CloseEditorInAllGroupsAction),(0,eG.registerAction2)(as.RevertAndCloseEditorAction),(0,eG.registerAction2)(as.SplitEditorAction),(0,eG.registerAction2)(as.SplitEditorOrthogonalAction),(0,eG.registerAction2)(as.SplitEditorLeftAction),(0,eG.registerAction2)(as.SplitEditorRightAction),(0,eG.registerAction2)(as.SplitEditorUpAction),(0,eG.registerAction2)(as.SplitEditorDownAction),(0,eG.registerAction2)(as.JoinTwoGroupsAction),(0,eG.registerAction2)(as.JoinAllGroupsAction),(0,eG.registerAction2)(as.NavigateBetweenGroupsAction),(0,eG.registerAction2)(as.ResetGroupSizesAction),(0,eG.registerAction2)(as.ToggleGroupSizesAction),(0,eG.registerAction2)(as.MaximizeGroupHideSidebarAction),(0,eG.registerAction2)(as.ToggleMaximizeEditorGroupAction),(0,eG.registerAction2)(as.MinimizeOtherGroupsAction),(0,eG.registerAction2)(as.MinimizeOtherGroupsHideSidebarAction),(0,eG.registerAction2)(as.MoveEditorLeftInGroupAction),(0,eG.registerAction2)(as.MoveEditorRightInGroupAction),(0,eG.registerAction2)(as.MoveEditorToStartAction),(0,eG.registerAction2)(as.MoveEditorToEndAction),(0,eG.registerAction2)(as.MoveGroupLeftAction),(0,eG.registerAction2)(as.MoveGroupRightAction),(0,eG.registerAction2)(as.MoveGroupUpAction),(0,eG.registerAction2)(as.MoveGroupDownAction),(0,eG.registerAction2)(as.DuplicateGroupLeftAction),(0,eG.registerAction2)(as.DuplicateGroupRightAction),(0,eG.registerAction2)(as.DuplicateGroupUpAction),(0,eG.registerAction2)(as.DuplicateGroupDownAction),(0,eG.registerAction2)(as.MoveEditorToPreviousGroupAction),(0,eG.registerAction2)(as.MoveEditorToNextGroupAction),(0,eG.registerAction2)(as.MoveEditorToFirstGroupAction),(0,eG.registerAction2)(as.MoveEditorToLastGroupAction),(0,eG.registerAction2)(as.MoveEditorToLeftGroupAction),(0,eG.registerAction2)(as.MoveEditorToRightGroupAction),(0,eG.registerAction2)(as.MoveEditorToAboveGroupAction),(0,eG.registerAction2)(as.MoveEditorToBelowGroupAction),(0,eG.registerAction2)(as.SplitEditorToPreviousGroupAction),(0,eG.registerAction2)(as.SplitEditorToNextGroupAction),(0,eG.registerAction2)(as.SplitEditorToFirstGroupAction),(0,eG.registerAction2)(as.SplitEditorToLastGroupAction),(0,eG.registerAction2)(as.SplitEditorToLeftGroupAction),(0,eG.registerAction2)(as.SplitEditorToRightGroupAction),(0,eG.registerAction2)(as.SplitEditorToAboveGroupAction),(0,eG.registerAction2)(as.SplitEditorToBelowGroupAction),(0,eG.registerAction2)(as.FocusActiveGroupAction),(0,eG.registerAction2)(as.FocusFirstGroupAction),(0,eG.registerAction2)(as.FocusLastGroupAction),(0,eG.registerAction2)(as.FocusPreviousGroup),(0,eG.registerAction2)(as.FocusNextGroup),(0,eG.registerAction2)(as.FocusLeftGroup),(0,eG.registerAction2)(as.FocusRightGroup),(0,eG.registerAction2)(as.FocusAboveGroup),(0,eG.registerAction2)(as.FocusBelowGroup),(0,eG.registerAction2)(as.NewEditorGroupLeftAction),(0,eG.registerAction2)(as.NewEditorGroupRightAction),(0,eG.registerAction2)(as.NewEditorGroupAboveAction),(0,eG.registerAction2)(as.NewEditorGroupBelowAction),(0,eG.registerAction2)(as.NavigatePreviousAction),(0,eG.registerAction2)(as.NavigateForwardInEditsAction),(0,eG.registerAction2)(as.NavigateBackwardsInEditsAction),(0,eG.registerAction2)(as.NavigatePreviousInEditsAction),(0,eG.registerAction2)(as.NavigateToLastEditLocationAction),(0,eG.registerAction2)(as.NavigateForwardInNavigationsAction),(0,eG.registerAction2)(as.NavigateBackwardsInNavigationsAction),(0,eG.registerAction2)(as.NavigatePreviousInNavigationsAction),(0,eG.registerAction2)(as.NavigateToLastNavigationLocationAction),(0,eG.registerAction2)(as.ClearEditorHistoryAction),(0,eG.registerAction2)(as.ClearEditorHistoryWithoutConfirmAction),(0,eG.registerAction2)(as.EditorLayoutSingleAction),(0,eG.registerAction2)(as.EditorLayoutTwoColumnsAction),(0,eG.registerAction2)(as.EditorLayoutThreeColumnsAction),(0,eG.registerAction2)(as.EditorLayoutTwoRowsAction),(0,eG.registerAction2)(as.EditorLayoutThreeRowsAction),(0,eG.registerAction2)(as.EditorLayoutTwoByTwoGridAction),(0,eG.registerAction2)(as.EditorLayoutTwoRowsRightAction),(0,eG.registerAction2)(as.EditorLayoutTwoColumnsBottomAction),(0,eG.registerAction2)(as.ToggleEditorTypeAction),(0,eG.registerAction2)(as.ReOpenInTextEditorAction),(0,eG.registerAction2)(as.QuickAccessPreviousRecentlyUsedEditorAction),(0,eG.registerAction2)(as.QuickAccessLeastRecentlyUsedEditorAction),(0,eG.registerAction2)(as.QuickAccessPreviousRecentlyUsedEditorInGroupAction),(0,eG.registerAction2)(as.QuickAccessLeastRecentlyUsedEditorInGroupAction),(0,eG.registerAction2)(as.QuickAccessPreviousEditorFromHistoryAction),(0,eG.registerAction2)(as.MoveEditorToNewWindowAction),(0,eG.registerAction2)(as.CopyEditorToNewindowAction),(0,eG.registerAction2)(as.MoveEditorGroupToNewWindowAction),(0,eG.registerAction2)(as.CopyEditorGroupToNewWindowAction),(0,eG.registerAction2)(as.RestoreEditorsToMainWindowAction),(0,eG.registerAction2)(as.NewEmptyEditorWindowAction);let aR="workbench.action.quickOpenNavigateNextInEditorPicker";eF.KeybindingsRegistry.registerCommandAndKeybindingRule({id:aR,weight:eF.KeybindingWeight.WorkbenchContrib+50,handler:(0,aa.getQuickNavigateHandler)(aR,!0),when:ax,primary:iO.KeyMod.CtrlCmd|iO.KeyCode.Tab,mac:{primary:iO.KeyMod.WinCtrl|iO.KeyCode.Tab}});let ak="workbench.action.quickOpenNavigatePreviousInEditorPicker";function aM(e,t,i,o,r,s){let n={command:{id:e.id,title:e.title,icon:e.icon,toggled:e.toggled,precondition:r},group:"navigation",when:t,order:i};o&&(n.alt={id:o.id,title:o.title,icon:o.icon}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitle,n),s&&eG.MenuRegistry.appendMenuItem(eG.MenuId.CompactWindowEditorTitle,n)}eF.KeybindingsRegistry.registerCommandAndKeybindingRule({id:ak,weight:eF.KeybindingWeight.WorkbenchContrib+50,handler:(0,aa.getQuickNavigateHandler)(ak,!1),when:ax,primary:iO.KeyMod.CtrlCmd|iO.KeyMod.Shift|iO.KeyCode.Tab,mac:{primary:iO.KeyMod.WinCtrl|iO.KeyMod.Shift|iO.KeyCode.Tab}}),(0,oZ.setup)(),eg.isMacintosh&&(eG.MenuRegistry.appendMenuItem(eG.MenuId.TouchBarContext,{command:{id:as.NavigateBackwardsAction.ID,title:as.NavigateBackwardsAction.LABEL,icon:{dark:tp.FileAccess.asFileUri("vs/workbench/browser/parts/editor/media/back-tb.png")}},group:"navigation",order:0}),eG.MenuRegistry.appendMenuItem(eG.MenuId.TouchBarContext,{command:{id:as.NavigateForwardAction.ID,title:as.NavigateForwardAction.LABEL,icon:{dark:tp.FileAccess.asFileUri("vs/workbench/browser/parts/editor/media/forward-tb.png")}},group:"navigation",order:1})),eG.MenuRegistry.appendMenuItem(eG.MenuId.EmptyEditorGroup,{command:{id:oZ.LOCK_GROUP_COMMAND_ID,title:(0,ev.localize)(3125,"Lock Group"),icon:t8.Codicon.unlock},group:"navigation",order:10,when:eV.ContextKeyExpr.and(eL.IsAuxiliaryWindowContext,eL.ActiveEditorGroupLockedContext.toNegated())}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EmptyEditorGroup,{command:{id:oZ.UNLOCK_GROUP_COMMAND_ID,title:(0,ev.localize)(3126,"Unlock Group"),icon:t8.Codicon.lock,toggled:eV.ContextKeyExpr.true()},group:"navigation",order:10,when:eL.ActiveEditorGroupLockedContext}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EmptyEditorGroup,{command:{id:oZ.CLOSE_EDITOR_GROUP_COMMAND_ID,title:(0,ev.localize)(3127,"Close Group"),icon:t8.Codicon.close},group:"navigation",order:20,when:eV.ContextKeyExpr.or(eL.IsAuxiliaryWindowContext,eL.EditorPartMultipleEditorGroupsContext)}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EmptyEditorGroupContext,{command:{id:oZ.SPLIT_EDITOR_UP,title:(0,ev.localize)(3128,"Split Up")},group:"2_split",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EmptyEditorGroupContext,{command:{id:oZ.SPLIT_EDITOR_DOWN,title:(0,ev.localize)(3129,"Split Down")},group:"2_split",order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EmptyEditorGroupContext,{command:{id:oZ.SPLIT_EDITOR_LEFT,title:(0,ev.localize)(3130,"Split Left")},group:"2_split",order:30}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EmptyEditorGroupContext,{command:{id:oZ.SPLIT_EDITOR_RIGHT,title:(0,ev.localize)(3131,"Split Right")},group:"2_split",order:40}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EmptyEditorGroupContext,{command:{id:oZ.NEW_EMPTY_EDITOR_WINDOW_COMMAND_ID,title:(0,ev.localize)(3132,"New Window")},group:"3_window",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EmptyEditorGroupContext,{command:{id:oZ.TOGGLE_LOCK_GROUP_COMMAND_ID,title:(0,ev.localize)(3133,"Lock Group"),toggled:eL.ActiveEditorGroupLockedContext},group:"4_lock",order:10,when:eL.IsAuxiliaryWindowContext.toNegated()}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EmptyEditorGroupContext,{command:{id:oZ.CLOSE_EDITOR_GROUP_COMMAND_ID,title:(0,ev.localize)(3134,"Close")},group:"5_close",order:10,when:eL.MultipleEditorGroupsContext}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarContext,{command:{id:oZ.SPLIT_EDITOR_UP,title:(0,ev.localize)(3128,"Split Up")},group:"2_split",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarContext,{command:{id:oZ.SPLIT_EDITOR_DOWN,title:(0,ev.localize)(3129,"Split Down")},group:"2_split",order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarContext,{command:{id:oZ.SPLIT_EDITOR_LEFT,title:(0,ev.localize)(3130,"Split Left")},group:"2_split",order:30}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarContext,{command:{id:oZ.SPLIT_EDITOR_RIGHT,title:(0,ev.localize)(3131,"Split Right")},group:"2_split",order:40}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarContext,{command:{id:oZ.MOVE_EDITOR_GROUP_INTO_NEW_WINDOW_COMMAND_ID,title:(0,ev.localize)(3135,"Move into New Window")},group:"3_window",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarContext,{command:{id:oZ.COPY_EDITOR_GROUP_INTO_NEW_WINDOW_COMMAND_ID,title:(0,ev.localize)(3136,"Copy into New Window")},group:"3_window",order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarContext,{submenu:eG.MenuId.EditorTabsBarShowTabsSubmenu,title:(0,ev.localize)(3137,"Tab Bar"),group:"4_config",order:10,when:eL.InEditorZenModeContext.negate()}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarShowTabsSubmenu,{command:{id:aE.ShowMultipleEditorTabsAction.ID,title:(0,ev.localize)(3138,"Multiple Tabs"),toggled:eV.ContextKeyExpr.equals("config.workbench.editor.showTabs","multiple")},group:"1_config",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarShowTabsSubmenu,{command:{id:aE.ShowSingleEditorTabAction.ID,title:(0,ev.localize)(3139,"Single Tab"),toggled:eV.ContextKeyExpr.equals("config.workbench.editor.showTabs","single")},group:"1_config",order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarShowTabsSubmenu,{command:{id:aE.HideEditorTabsAction.ID,title:(0,ev.localize)(3140,"Hidden"),toggled:eV.ContextKeyExpr.equals("config.workbench.editor.showTabs","none")},group:"1_config",order:30}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarContext,{submenu:eG.MenuId.EditorTabsBarShowTabsZenModeSubmenu,title:(0,ev.localize)(3137,"Tab Bar"),group:"4_config",order:10,when:eL.InEditorZenModeContext}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:aE.ZenShowMultipleEditorTabsAction.ID,title:(0,ev.localize)(3138,"Multiple Tabs"),toggled:eV.ContextKeyExpr.equals("config.zenMode.showTabs","multiple")},group:"1_config",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:aE.ZenShowSingleEditorTabAction.ID,title:(0,ev.localize)(3139,"Single Tab"),toggled:eV.ContextKeyExpr.equals("config.zenMode.showTabs","single")},group:"1_config",order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:aE.ZenHideEditorTabsAction.ID,title:(0,ev.localize)(3140,"Hidden"),toggled:eV.ContextKeyExpr.equals("config.zenMode.showTabs","none")},group:"1_config",order:30}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarContext,{submenu:eG.MenuId.EditorActionsPositionSubmenu,title:(0,ev.localize)(3141,"Editor Actions Position"),group:"4_config",order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorActionsPositionSubmenu,{command:{id:aE.EditorActionsDefaultAction.ID,title:(0,ev.localize)(3137,"Tab Bar"),toggled:eV.ContextKeyExpr.equals("config.workbench.editor.editorActionsLocation","default")},group:"1_config",order:10,when:eV.ContextKeyExpr.equals("config.workbench.editor.showTabs","none").negate()}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorActionsPositionSubmenu,{command:{id:aE.EditorActionsTitleBarAction.ID,title:(0,ev.localize)(3142,"Title Bar"),toggled:eV.ContextKeyExpr.or(eV.ContextKeyExpr.equals("config.workbench.editor.editorActionsLocation","titleBar"),eV.ContextKeyExpr.and(eV.ContextKeyExpr.equals("config.workbench.editor.showTabs","none"),eV.ContextKeyExpr.equals("config.workbench.editor.editorActionsLocation","default")))},group:"1_config",order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorActionsPositionSubmenu,{command:{id:aE.HideEditorActionsAction.ID,title:(0,ev.localize)(3143,"Hidden"),toggled:eV.ContextKeyExpr.equals("config.workbench.editor.editorActionsLocation","hidden")},group:"1_config",order:30}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTabsBarContext,{command:{id:aE.ConfigureEditorTabsAction.ID,title:(0,ev.localize)(3144,"Configure Tabs")},group:"9_configure",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.CLOSE_EDITOR_COMMAND_ID,title:(0,ev.localize)(3134,"Close")},group:"1_close",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID,title:(0,ev.localize)(3145,"Close Others"),precondition:eL.EditorGroupEditorsCountContext.notEqualsTo("1")},group:"1_close",order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.CLOSE_EDITORS_TO_THE_RIGHT_COMMAND_ID,title:(0,ev.localize)(3146,"Close to the Right"),precondition:eV.ContextKeyExpr.and(eL.ActiveEditorLastInGroupContext.toNegated(),eL.MultipleEditorsSelectedInGroupContext.negate())},group:"1_close",order:30,when:eL.EditorTabsVisibleContext}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.CLOSE_SAVED_EDITORS_COMMAND_ID,title:(0,ev.localize)(3147,"Close Saved")},group:"1_close",order:40}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.CLOSE_EDITORS_IN_GROUP_COMMAND_ID,title:(0,ev.localize)(3148,"Close All")},group:"1_close",order:50}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.REOPEN_WITH_COMMAND_ID,title:(0,ev.localize)(3149,"Reopen Editor With...")},group:"1_open",order:10,when:eL.ActiveEditorAvailableEditorIdsContext}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.KEEP_EDITOR_COMMAND_ID,title:(0,ev.localize)(3150,"Keep Open"),precondition:eL.ActiveEditorPinnedContext.toNegated()},group:"3_preview",order:10,when:eV.ContextKeyExpr.has("config.workbench.editor.enablePreview")}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.PIN_EDITOR_COMMAND_ID,title:(0,ev.localize)(3151,"Pin")},group:"3_preview",order:20,when:eL.ActiveEditorStickyContext.toNegated()}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.UNPIN_EDITOR_COMMAND_ID,title:(0,ev.localize)(3152,"Unpin")},group:"3_preview",order:20,when:eL.ActiveEditorStickyContext}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.SPLIT_EDITOR,title:(0,ev.localize)(3131,"Split Right")},group:"5_split",order:10,when:eL.SplitEditorsVertically.negate()}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.SPLIT_EDITOR,title:(0,ev.localize)(3129,"Split Down")},group:"5_split",order:10,when:eL.SplitEditorsVertically}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{submenu:eG.MenuId.EditorSplitMoveSubmenu,title:(0,ev.localize)(3153,"Split & Move"),group:"5_split",order:15}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.MOVE_EDITOR_INTO_NEW_WINDOW_COMMAND_ID,title:(0,ev.localize)(3154,"Move into New Window")},group:"7_new_window",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{command:{id:oZ.COPY_EDITOR_INTO_NEW_WINDOW_COMMAND_ID,title:(0,ev.localize)(3155,"Copy into New Window")},group:"7_new_window",order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitleContext,{submenu:eG.MenuId.EditorTitleContextShare,title:(0,ev.localize)(3156,"Share"),group:"11_share",order:-1,when:eL.MultipleEditorsSelectedInGroupContext.negate()}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorSplitMoveSubmenu,{command:{id:oZ.SPLIT_EDITOR_UP,title:(0,ev.localize)(3128,"Split Up")},group:"1_split",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorSplitMoveSubmenu,{command:{id:oZ.SPLIT_EDITOR_DOWN,title:(0,ev.localize)(3129,"Split Down")},group:"1_split",order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorSplitMoveSubmenu,{command:{id:oZ.SPLIT_EDITOR_LEFT,title:(0,ev.localize)(3130,"Split Left")},group:"1_split",order:30}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorSplitMoveSubmenu,{command:{id:oZ.SPLIT_EDITOR_RIGHT,title:(0,ev.localize)(3131,"Split Right")},group:"1_split",order:40}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorSplitMoveSubmenu,{command:{id:oZ.MOVE_EDITOR_INTO_ABOVE_GROUP,title:(0,ev.localize)(3157,"Move Above")},group:"2_move",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorSplitMoveSubmenu,{command:{id:oZ.MOVE_EDITOR_INTO_BELOW_GROUP,title:(0,ev.localize)(3158,"Move Below")},group:"2_move",order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorSplitMoveSubmenu,{command:{id:oZ.MOVE_EDITOR_INTO_LEFT_GROUP,title:(0,ev.localize)(3159,"Move Left")},group:"2_move",order:30}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorSplitMoveSubmenu,{command:{id:oZ.MOVE_EDITOR_INTO_RIGHT_GROUP,title:(0,ev.localize)(3160,"Move Right")},group:"2_move",order:40}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorSplitMoveSubmenu,{command:{id:oZ.SPLIT_EDITOR_IN_GROUP,title:(0,ev.localize)(3161,"Split in Group"),precondition:eL.MultipleEditorsSelectedInGroupContext.negate()},group:"3_split_in_group",order:10,when:eL.ActiveEditorCanSplitInGroupContext}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorSplitMoveSubmenu,{command:{id:oZ.JOIN_EDITOR_IN_GROUP,title:(0,ev.localize)(3162,"Join in Group"),precondition:eL.MultipleEditorsSelectedInGroupContext.negate()},group:"3_split_in_group",order:10,when:eL.SideBySideEditorActiveContext}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitle,{command:{id:an.TOGGLE_DIFF_SIDE_BY_SIDE,title:(0,ev.localize)(3163,"Inline View"),toggled:eV.ContextKeyExpr.equals("config.diffEditor.renderSideBySide",!1)},group:"1_diff",order:10,when:eV.ContextKeyExpr.has("isInDiffEditor")}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitle,{command:{id:oZ.SHOW_EDITORS_IN_GROUP,title:(0,ev.localize)(3164,"Show Opened Editors")},group:"3_open",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitle,{command:{id:oZ.CLOSE_EDITORS_IN_GROUP_COMMAND_ID,title:(0,ev.localize)(3148,"Close All")},group:"5_close",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitle,{command:{id:oZ.CLOSE_SAVED_EDITORS_COMMAND_ID,title:(0,ev.localize)(3147,"Close Saved")},group:"5_close",order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitle,{command:{id:oZ.TOGGLE_KEEP_EDITORS_COMMAND_ID,title:(0,ev.localize)(3165,"Enable Preview Editors"),toggled:eV.ContextKeyExpr.has("config.workbench.editor.enablePreview")},group:"7_settings",order:10}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitle,{command:{id:oZ.TOGGLE_MAXIMIZE_EDITOR_GROUP,title:(0,ev.localize)(3166,"Maximize Group")},group:"8_group_operations",order:5,when:eV.ContextKeyExpr.and(eL.EditorPartMaximizedEditorGroupContext.negate(),eL.EditorPartMultipleEditorGroupsContext)}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitle,{command:{id:oZ.TOGGLE_MAXIMIZE_EDITOR_GROUP,title:(0,ev.localize)(3167,"Unmaximize Group")},group:"8_group_operations",order:5,when:eL.EditorPartMaximizedEditorGroupContext}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitle,{command:{id:oZ.TOGGLE_LOCK_GROUP_COMMAND_ID,title:(0,ev.localize)(3168,"Lock Group"),toggled:eL.ActiveEditorGroupLockedContext},group:"8_group_operations",order:10,when:eL.IsAuxiliaryWindowContext.toNegated()}),eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitle,{command:{id:aE.ConfigureEditorAction.ID,title:(0,ev.localize)(3169,"Configure Editors")},group:"9_configure",order:10}),aM({id:oZ.SPLIT_EDITOR,title:(0,ev.localize)(3170,"Split Editor Right"),icon:t8.Codicon.splitHorizontal},eL.SplitEditorsVertically.negate(),1e5,{id:oZ.SPLIT_EDITOR_DOWN,title:(0,ev.localize)(3171,"Split Editor Down"),icon:t8.Codicon.splitVertical}),aM({id:oZ.SPLIT_EDITOR,title:(0,ev.localize)(3171,"Split Editor Down"),icon:t8.Codicon.splitVertical},eL.SplitEditorsVertically,1e5,{id:oZ.SPLIT_EDITOR_RIGHT,title:(0,ev.localize)(3170,"Split Editor Right"),icon:t8.Codicon.splitHorizontal}),aM({id:oZ.TOGGLE_SPLIT_EDITOR_IN_GROUP_LAYOUT,title:(0,ev.localize)(3172,"Toggle Layout"),icon:t8.Codicon.editorLayout},eL.SideBySideEditorActiveContext,99999),aM({id:oZ.CLOSE_EDITOR_COMMAND_ID,title:(0,ev.localize)(3134,"Close"),icon:t8.Codicon.close},eV.ContextKeyExpr.and(eL.EditorTabsVisibleContext.toNegated(),eL.ActiveEditorDirtyContext.toNegated(),eL.ActiveEditorStickyContext.toNegated()),1e6,{id:oZ.CLOSE_EDITORS_IN_GROUP_COMMAND_ID,title:(0,ev.localize)(3148,"Close All"),icon:t8.Codicon.closeAll}),aM({id:oZ.CLOSE_EDITOR_COMMAND_ID,title:(0,ev.localize)(3134,"Close"),icon:t8.Codicon.closeDirty},eV.ContextKeyExpr.and(eL.EditorTabsVisibleContext.toNegated(),eL.ActiveEditorDirtyContext,eL.ActiveEditorStickyContext.toNegated()),1e6,{id:oZ.CLOSE_EDITORS_IN_GROUP_COMMAND_ID,title:(0,ev.localize)(3148,"Close All"),icon:t8.Codicon.closeAll}),aM({id:oZ.UNPIN_EDITOR_COMMAND_ID,title:(0,ev.localize)(3152,"Unpin"),icon:t8.Codicon.pinned},eV.ContextKeyExpr.and(eL.EditorTabsVisibleContext.toNegated(),eL.ActiveEditorDirtyContext.toNegated(),eL.ActiveEditorStickyContext),1e6,{id:oZ.CLOSE_EDITOR_COMMAND_ID,title:(0,ev.localize)(3134,"Close"),icon:t8.Codicon.close}),aM({id:oZ.UNPIN_EDITOR_COMMAND_ID,title:(0,ev.localize)(3152,"Unpin"),icon:t8.Codicon.pinnedDirty},eV.ContextKeyExpr.and(eL.EditorTabsVisibleContext.toNegated(),eL.ActiveEditorDirtyContext,eL.ActiveEditorStickyContext),1e6,{id:oZ.CLOSE_EDITOR_COMMAND_ID,title:(0,ev.localize)(3134,"Close"),icon:t8.Codicon.close}),aM({id:oZ.LOCK_GROUP_COMMAND_ID,title:(0,ev.localize)(3173,"Lock Group"),icon:t8.Codicon.unlock},eV.ContextKeyExpr.and(eL.IsAuxiliaryWindowContext,eL.ActiveEditorGroupLockedContext.toNegated()),999999),aM({id:oZ.UNLOCK_GROUP_COMMAND_ID,title:(0,ev.localize)(3174,"Unlock Group"),icon:t8.Codicon.lock,toggled:eV.ContextKeyExpr.true()},eL.ActiveEditorGroupLockedContext,999999);let aL=(0,iK.registerIcon)("diff-editor-previous-change",t8.Codicon.arrowUp,(0,ev.localize)(3175,"Icon for the previous change action in the diff editor."));aM({id:an.GOTO_PREVIOUS_CHANGE,title:(0,ev.localize)(3176,"Previous Change"),icon:aL},eL.TextCompareEditorActiveContext,10,void 0,oa.EditorContextKeys.hasChanges,!0);let aO=(0,iK.registerIcon)("diff-editor-next-change",t8.Codicon.arrowDown,(0,ev.localize)(3177,"Icon for the next change action in the diff editor."));aM({id:an.GOTO_NEXT_CHANGE,title:(0,ev.localize)(3178,"Next Change"),icon:aO},eL.TextCompareEditorActiveContext,11,void 0,oa.EditorContextKeys.hasChanges,!0),aM({id:an.DIFF_SWAP_SIDES,title:(0,ev.localize)(3179,"Swap Left and Right Side"),icon:t8.Codicon.arrowSwap},eV.ContextKeyExpr.and(eL.TextCompareEditorActiveContext,eL.ActiveCompareEditorCanSwapContext),15,void 0,void 0);let aP=(0,iK.registerIcon)("diff-editor-toggle-whitespace",t8.Codicon.whitespace,(0,ev.localize)(3180,"Icon for the toggle whitespace action in the diff editor."));eG.MenuRegistry.appendMenuItem(eG.MenuId.EditorTitle,{command:{id:an.TOGGLE_DIFF_IGNORE_TRIM_WHITESPACE,title:(0,ev.localize)(3181,"Show Leading/Trailing Whitespace Differences"),icon:aP,precondition:eL.TextCompareEditorActiveContext,toggled:eV.ContextKeyExpr.equals("config.diffEditor.ignoreTrimWhitespace",!1)},group:"navigation",when:eL.TextCompareEditorActiveContext,order:20}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:oZ.KEEP_EDITOR_COMMAND_ID,title:(0,ev.localize2)(3182,"Keep Editor"),category:eq.Categories.View},when:eV.ContextKeyExpr.has("config.workbench.editor.enablePreview")}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:oZ.PIN_EDITOR_COMMAND_ID,title:(0,ev.localize2)(3183,"Pin Editor"),category:eq.Categories.View}}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:oZ.UNPIN_EDITOR_COMMAND_ID,title:(0,ev.localize2)(3184,"Unpin Editor"),category:eq.Categories.View}}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:oZ.CLOSE_EDITOR_COMMAND_ID,title:(0,ev.localize2)(3185,"Close Editor"),category:eq.Categories.View}}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:oZ.CLOSE_PINNED_EDITOR_COMMAND_ID,title:(0,ev.localize2)(3186,"Close Pinned Editor"),category:eq.Categories.View}}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:oZ.CLOSE_EDITORS_IN_GROUP_COMMAND_ID,title:(0,ev.localize2)(3187,"Close All Editors in Group"),category:eq.Categories.View}}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:oZ.CLOSE_SAVED_EDITORS_COMMAND_ID,title:(0,ev.localize2)(3188,"Close Saved Editors in Group"),category:eq.Categories.View}}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:oZ.CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID,title:(0,ev.localize2)(3189,"Close Other Editors in Group"),category:eq.Categories.View}}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:oZ.CLOSE_EDITORS_TO_THE_RIGHT_COMMAND_ID,title:(0,ev.localize2)(3190,"Close Editors to the Right in Group"),category:eq.Categories.View},when:eL.ActiveEditorLastInGroupContext.toNegated()}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:oZ.CLOSE_EDITORS_AND_GROUP_COMMAND_ID,title:(0,ev.localize2)(3191,"Close Editor Group"),category:eq.Categories.View},when:eL.MultipleEditorGroupsContext}),eG.MenuRegistry.appendMenuItem(eG.MenuId.CommandPalette,{command:{id:oZ.REOPEN_WITH_COMMAND_ID,title:(0,ev.localize2)(3149,"Reopen Editor With..."),category:eq.Categories.View},when:eL.ActiveEditorAvailableEditorIdsContext}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarRecentMenu,{group:"1_editor",command:{id:as.ReopenClosedEditorAction.ID,title:(0,ev.localize)(3192,"&&Reopen Closed Editor"),precondition:eV.ContextKeyExpr.has("canReopenClosedEditor")},order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarRecentMenu,{group:"z_clear",command:{id:as.ClearRecentFilesAction.ID,title:(0,ev.localize)(3193,"&&Clear Recently Opened...")},order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarFileMenu,{title:(0,ev.localize)(3194,"Share"),submenu:eG.MenuId.MenubarShare,group:"45_share",order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarViewMenu,{group:"2_appearance",title:(0,ev.localize)(3195,"Editor &&Layout"),submenu:eG.MenuId.MenubarLayoutMenu,order:2}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"1_split",command:{id:oZ.SPLIT_EDITOR_UP,title:{...(0,ev.localize2)(3196,"Split Up"),mnemonicTitle:(0,ev.localize)(3197,"Split &&Up")}},order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"1_split",command:{id:oZ.SPLIT_EDITOR_DOWN,title:{...(0,ev.localize2)(3198,"Split Down"),mnemonicTitle:(0,ev.localize)(3199,"Split &&Down")}},order:2}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"1_split",command:{id:oZ.SPLIT_EDITOR_LEFT,title:{...(0,ev.localize2)(3200,"Split Left"),mnemonicTitle:(0,ev.localize)(3201,"Split &&Left")}},order:3}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"1_split",command:{id:oZ.SPLIT_EDITOR_RIGHT,title:{...(0,ev.localize2)(3202,"Split Right"),mnemonicTitle:(0,ev.localize)(3203,"Split &&Right")}},order:4}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"2_split_in_group",command:{id:oZ.SPLIT_EDITOR_IN_GROUP,title:{...(0,ev.localize2)(3204,"Split in Group"),mnemonicTitle:(0,ev.localize)(3205,"Split in &&Group")}},when:eL.ActiveEditorCanSplitInGroupContext,order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"2_split_in_group",command:{id:oZ.JOIN_EDITOR_IN_GROUP,title:{...(0,ev.localize2)(3206,"Join in Group"),mnemonicTitle:(0,ev.localize)(3207,"Join in &&Group")}},when:eL.SideBySideEditorActiveContext,order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"3_new_window",command:{id:oZ.MOVE_EDITOR_INTO_NEW_WINDOW_COMMAND_ID,title:{...(0,ev.localize2)(3208,"Move Editor into New Window"),mnemonicTitle:(0,ev.localize)(3209,"&&Move Editor into New Window")}},order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"3_new_window",command:{id:oZ.COPY_EDITOR_INTO_NEW_WINDOW_COMMAND_ID,title:{...(0,ev.localize2)(3210,"Copy Editor into New Window"),mnemonicTitle:(0,ev.localize)(3211,"&&Copy Editor into New Window")}},order:2}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"4_layouts",command:{id:as.EditorLayoutSingleAction.ID,title:{...(0,ev.localize2)(3212,"Single"),mnemonicTitle:(0,ev.localize)(3213,"&&Single")}},order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"4_layouts",command:{id:as.EditorLayoutTwoColumnsAction.ID,title:{...(0,ev.localize2)(3214,"Two Columns"),mnemonicTitle:(0,ev.localize)(3215,"&&Two Columns")}},order:3}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"4_layouts",command:{id:as.EditorLayoutThreeColumnsAction.ID,title:{...(0,ev.localize2)(3216,"Three Columns"),mnemonicTitle:(0,ev.localize)(3217,"T&&hree Columns")}},order:4}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"4_layouts",command:{id:as.EditorLayoutTwoRowsAction.ID,title:{...(0,ev.localize2)(3218,"Two Rows"),mnemonicTitle:(0,ev.localize)(3219,"T&&wo Rows")}},order:5}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"4_layouts",command:{id:as.EditorLayoutThreeRowsAction.ID,title:{...(0,ev.localize2)(3220,"Three Rows"),mnemonicTitle:(0,ev.localize)(3221,"Three &&Rows")}},order:6}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"4_layouts",command:{id:as.EditorLayoutTwoByTwoGridAction.ID,title:{...(0,ev.localize2)(3222,"Grid (2x2)"),mnemonicTitle:(0,ev.localize)(3223,"&&Grid (2x2)")}},order:7}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"4_layouts",command:{id:as.EditorLayoutTwoRowsRightAction.ID,title:{...(0,ev.localize2)(3224,"Two Rows Right"),mnemonicTitle:(0,ev.localize)(3225,"Two R&&ows Right")}},order:8}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarLayoutMenu,{group:"4_layouts",command:{id:as.EditorLayoutTwoColumnsBottomAction.ID,title:{...(0,ev.localize2)(3226,"Two Columns Bottom"),mnemonicTitle:(0,ev.localize)(3227,"Two &&Columns Bottom")}},order:9}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarGoMenu,{group:"1_history_nav",command:{id:"workbench.action.navigateToLastEditLocation",title:(0,ev.localize)(3228,"&&Last Edit Location"),precondition:eV.ContextKeyExpr.has("canNavigateToLastEditLocation")},order:3}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchEditorMenu,{group:"1_sideBySide",command:{id:oZ.FOCUS_FIRST_SIDE_EDITOR,title:(0,ev.localize)(3229,"&&First Side in Editor")},when:eV.ContextKeyExpr.or(eL.SideBySideEditorActiveContext,eL.TextCompareEditorActiveContext),order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchEditorMenu,{group:"1_sideBySide",command:{id:oZ.FOCUS_SECOND_SIDE_EDITOR,title:(0,ev.localize)(3230,"&&Second Side in Editor")},when:eV.ContextKeyExpr.or(eL.SideBySideEditorActiveContext,eL.TextCompareEditorActiveContext),order:2}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchEditorMenu,{group:"2_any",command:{id:"workbench.action.nextEditor",title:(0,ev.localize)(3231,"&&Next Editor")},order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchEditorMenu,{group:"2_any",command:{id:"workbench.action.previousEditor",title:(0,ev.localize)(3232,"&&Previous Editor")},order:2}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchEditorMenu,{group:"3_any_used",command:{id:"workbench.action.openNextRecentlyUsedEditor",title:(0,ev.localize)(3233,"&&Next Used Editor")},order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchEditorMenu,{group:"3_any_used",command:{id:"workbench.action.openPreviousRecentlyUsedEditor",title:(0,ev.localize)(3234,"&&Previous Used Editor")},order:2}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchEditorMenu,{group:"4_group",command:{id:"workbench.action.nextEditorInGroup",title:(0,ev.localize)(3235,"&&Next Editor in Group")},order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchEditorMenu,{group:"4_group",command:{id:"workbench.action.previousEditorInGroup",title:(0,ev.localize)(3236,"&&Previous Editor in Group")},order:2}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchEditorMenu,{group:"5_group_used",command:{id:"workbench.action.openNextRecentlyUsedEditorInGroup",title:(0,ev.localize)(3237,"&&Next Used Editor in Group")},order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchEditorMenu,{group:"5_group_used",command:{id:"workbench.action.openPreviousRecentlyUsedEditorInGroup",title:(0,ev.localize)(3238,"&&Previous Used Editor in Group")},order:2}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarGoMenu,{group:"2_editor_nav",title:(0,ev.localize)(3239,"Switch &&Editor"),submenu:eG.MenuId.MenubarSwitchEditorMenu,order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFirstEditorGroup",title:(0,ev.localize)(3240,"Group &&1")},order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusSecondEditorGroup",title:(0,ev.localize)(3241,"Group &&2")},order:2}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusThirdEditorGroup",title:(0,ev.localize)(3242,"Group &&3"),precondition:eL.MultipleEditorGroupsContext},order:3}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFourthEditorGroup",title:(0,ev.localize)(3243,"Group &&4"),precondition:eL.MultipleEditorGroupsContext},order:4}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFifthEditorGroup",title:(0,ev.localize)(3244,"Group &&5"),precondition:eL.MultipleEditorGroupsContext},order:5}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchGroupMenu,{group:"2_next_prev",command:{id:"workbench.action.focusNextGroup",title:(0,ev.localize)(3245,"&&Next Group"),precondition:eL.MultipleEditorGroupsContext},order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchGroupMenu,{group:"2_next_prev",command:{id:"workbench.action.focusPreviousGroup",title:(0,ev.localize)(3246,"&&Previous Group"),precondition:eL.MultipleEditorGroupsContext},order:2}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusLeftGroup",title:(0,ev.localize)(3247,"Group &&Left"),precondition:eL.MultipleEditorGroupsContext},order:1}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusRightGroup",title:(0,ev.localize)(3248,"Group &&Right"),precondition:eL.MultipleEditorGroupsContext},order:2}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusAboveGroup",title:(0,ev.localize)(3249,"Group &&Above"),precondition:eL.MultipleEditorGroupsContext},order:3}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusBelowGroup",title:(0,ev.localize)(3250,"Group &&Below"),precondition:eL.MultipleEditorGroupsContext},order:4}),eG.MenuRegistry.appendMenuItem(eG.MenuId.MenubarGoMenu,{group:"2_editor_nav",title:(0,ev.localize)(3251,"Switch &&Group"),submenu:eG.MenuId.MenubarSwitchGroupMenu,order:2}),(0,aD.registerEditorFontConfigurations)(aI.getFontSnippets),e.s([],305273);var aV=eu,aK=e.i(921217),aN=e.i(767053),aG=e.i(965545),aF=e.i(890428),aW=e.i(971629);let az=class{static{this.ID=aF.WebviewInput.typeId}constructor(e){this._webviewWorkbenchService=e}canSerialize(e){return this._webviewWorkbenchService.shouldPersist(e)}serialize(e){if(!this.canSerialize(e))return;let t=this.toJson(e);try{return JSON.stringify(t)}catch{return}}deserialize(e,t){let i=this.fromJson(JSON.parse(t));return this._webviewWorkbenchService.openRevivedWebview({webviewInitInfo:{providedViewType:i.providedId,origin:i.origin,title:i.title,options:i.webviewOptions,contentOptions:i.contentOptions,extension:i.extension},viewType:i.viewType,title:i.title,iconPath:i.iconPath,state:i.state,group:i.group})}fromJson(e){var t;return{...e,extension:aB(e.extensionId,e.extensionLocation),iconPath:aU(e.iconPath),state:"string"==typeof(t=e.state)?t:void 0,webviewOptions:e.options,contentOptions:a$(e.options)}}toJson(e){return{origin:e.webview.origin,viewType:e.viewType,providedId:e.providerId,title:e.getName(),options:{...e.webview.options,...e.webview.contentOptions},extensionLocation:e.extension?.location,extensionId:e.extension?.id.value,state:e.webview.state,iconPath:e.iconPath?ih.ThemeIcon.isThemeIcon(e.iconPath)?e.iconPath:{light:e.iconPath.light,dark:e.iconPath.dark}:void 0,group:e.group}}};function aB(e,t){if(!e)return;let i=aH(t);if(i)return{id:new oL.ExtensionIdentifier(e),location:i}}function aU(e){if(!e)return;if(ih.ThemeIcon.isThemeIcon(e))return e;let t=aH(e.light),i=aH(e.dark);return t&&i?{light:t,dark:i}:void 0}function aH(e){if(e)try{if("string"==typeof e)return e$.URI.parse(e);return e$.URI.from(e)}catch{return}}az=(0,ei.__decorate)([(0,ei.__param)(0,aW.IWebviewWorkbenchService)],az);function a$(e){return{...e,localResourceRoots:e.localResourceRoots?.map(e=>aH(e))}}var aq=e.i(732157);let aY=class extends az{static{this.ID=aK.CustomEditorInput.typeId}constructor(e,t,i){super(e),this._instantiationService=t,this._webviewService=i}serialize(e){let t=e.isDirty(),i={...this.toJson(e),editorResource:e.resource.toJSON(),dirty:t,backupId:t?e.backupId:void 0};try{return JSON.stringify(i)}catch{return}}fromJson(e){return{...super.fromJson(e),editorResource:e$.URI.from(e.editorResource),dirty:e.dirty}}deserialize(e,t){let i=this.fromJson(JSON.parse(t)),o=aj(this._webviewService,i),r=this._instantiationService.createInstance(aK.CustomEditorInput,{resource:i.editorResource,viewType:i.viewType,webviewTitle:i.title,iconPath:i.iconPath},o,{startsDirty:i.dirty,backupId:i.backupId});return"number"==typeof i.group&&r.updateGroup(i.group),r}};function aj(e,t){let i=e.createWebviewOverlay({providedViewType:t.viewType,origin:t.origin,title:t.title,options:{purpose:s3.WebviewContentPurpose.CustomEditor,enableFindWidget:t.webviewOptions.enableFindWidget,retainContextWhenHidden:t.webviewOptions.retainContextWhenHidden},contentOptions:t.contentOptions,extension:t.extension});return i.state=t.state,i}aY=(0,ei.__decorate)([(0,ei.__param)(0,aW.IWebviewWorkbenchService),(0,ei.__param)(1,eD.IInstantiationService),(0,ei.__param)(2,s5.IWebviewService)],aY);let aX=class extends aV.Disposable{static{this.ID="workbench.contrib.complexCustomWorkingCopyEditorHandler"}constructor(e,t,i,o,r){super(),this._instantiationService=e,this._workingCopyBackupService=i,this._webviewService=o,this._register(t.registerHandler(this))}handles(e){return e.resource.scheme===tp.Schemas.vscodeCustomEditor}isOpen(e,t){if(!this.handles(e))return!1;if("jupyter-notebook-ipynb"===e.resource.authority&&t instanceof aG.NotebookEditorInput)try{let i=JSON.parse(e.resource.query),o=e$.URI.from(i);return(0,t9.isEqual)(o,t.resource)}catch{return!1}if(!(t instanceof aK.CustomEditorInput)||e.resource.authority!==t.viewType.replace(/[^a-z0-9\-_]/gi,"-").toLowerCase())return!1;try{let i=JSON.parse(e.resource.query),o=e$.URI.from(i);return(0,t9.isEqual)(o,t.resource)}catch{return!1}}async createEditor(e){let t=await this._workingCopyBackupService.resolve(e);if(!t?.meta)throw Error(`No backup found for custom editor: ${e.resource}`);let i=t.meta,o=aB(i.extension?.id,i.extension?.location),r=aj(this._webviewService,{viewType:i.viewType,origin:i.webview.origin,webviewOptions:i.webview.options,contentOptions:a$(i.webview.options),state:i.webview.state,extension:o,title:i.customTitle}),s=this._instantiationService.createInstance(aK.CustomEditorInput,{resource:e$.URI.revive(i.editorResource),viewType:i.viewType,webviewTitle:i.customTitle,iconPath:aU(i.iconPath)},r,{backupId:i.backupId});return s.updateGroup(0),s}};aX=(0,ei.__decorate)([(0,ei.__param)(0,eD.IInstantiationService),(0,ei.__param)(1,am.IWorkingCopyEditorService),(0,ei.__param)(2,aq.IWorkingCopyBackupService),(0,ei.__param)(3,s5.IWebviewService),(0,ei.__param)(4,aN.ICustomEditorService)],aX);var aJ=e.i(261226);e.i(197375),eO.Registry.as(iV.EditorExtensions.EditorPane).registerEditorPane(e6.EditorPaneDescriptor.create(aJ.WebviewEditor,aJ.WebviewEditor.ID,"Webview Editor"),[new e4.SyncDescriptor(aK.CustomEditorInput)]),eO.Registry.as(iV.EditorExtensions.EditorFactory).registerEditorSerializer(aY.ID,aY),(0,tH.registerWorkbenchContribution2)(aX.ID,aX,tH.WorkbenchPhase.BlockStartup),e.s([],982710);var aZ=eu,aQ=eG;let a0=eV.ContextKeyExpr.and(eV.ContextKeyExpr.equals("activeEditor",aJ.WebviewEditor.ID),oa.EditorContextKeys.focus.toNegated());class a1 extends aQ.Action2{static{this.ID="editor.action.webvieweditor.showFind"}static{this.LABEL=(0,ev.localize)(13159,"Show find")}constructor(){super({id:a1.ID,title:a1.LABEL,keybinding:{when:eV.ContextKeyExpr.and(a0,s3.KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_ENABLED),primary:iO.KeyMod.CtrlCmd|iO.KeyCode.KeyF,weight:eF.KeybindingWeight.EditorContrib}})}run(e){a4(e)?.showFind()}}class a2 extends aQ.Action2{static{this.ID="editor.action.webvieweditor.hideFind"}static{this.LABEL=(0,ev.localize)(13160,"Stop find")}constructor(){super({id:a2.ID,title:a2.LABEL,keybinding:{when:eV.ContextKeyExpr.and(a0,s3.KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE),primary:iO.KeyCode.Escape,weight:eF.KeybindingWeight.EditorContrib}})}run(e){a4(e)?.hideFind()}}class a3 extends aQ.Action2{static{this.ID="editor.action.webvieweditor.findNext"}static{this.LABEL=(0,ev.localize)(13161,"Find next")}constructor(){super({id:a3.ID,title:a3.LABEL,keybinding:{when:eV.ContextKeyExpr.and(a0,s3.KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED),primary:iO.KeyCode.Enter,weight:eF.KeybindingWeight.EditorContrib}})}run(e){a4(e)?.runFindAction(!1)}}class a5 extends aQ.Action2{static{this.ID="editor.action.webvieweditor.findPrevious"}static{this.LABEL=(0,ev.localize)(13162,"Find previous")}constructor(){super({id:a5.ID,title:a5.LABEL,keybinding:{when:eV.ContextKeyExpr.and(a0,s3.KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_FOCUSED),primary:iO.KeyMod.Shift|iO.KeyCode.Enter,weight:eF.KeybindingWeight.EditorContrib}})}run(e){a4(e)?.runFindAction(!0)}}class a6 extends aQ.Action2{static{this.ID="workbench.action.webview.reloadWebviewAction"}static{this.LABEL=(0,ev.localize2)(13163,"Reload Webviews")}constructor(){super({id:a6.ID,title:a6.LABEL,category:eq.Categories.Developer,menu:[{id:aQ.MenuId.CommandPalette}]})}async run(e){for(let t of e.get(s5.IWebviewService).webviews)t.reload()}}function a4(e){let t=e.get(eQ.IEditorService).activeEditor;return t instanceof aF.WebviewInput?t.webview:void 0}e.i(693032),eO.Registry.as(iV.EditorExtensions.EditorPane).registerEditorPane(e6.EditorPaneDescriptor.create(aJ.WebviewEditor,aJ.WebviewEditor.ID,(0,ev.localize)(13165,"webview editor")),[new e4.SyncDescriptor(aF.WebviewInput)]);let a9=class extends aZ.Disposable{static{this.ID="workbench.contrib.webviewPanel"}constructor(e,t){super(),this.editorGroupService=t,this._register(e.onWillOpenEditor(e=>{let i=t.getGroup(e.groupId);i&&this.onEditorOpening(e.editor,i)}))}onEditorOpening(e,t){let i;if(!(!(e instanceof aF.WebviewInput)||e.typeId!==aF.WebviewInput.typeId||t.contains(e))){for(let t of this.editorGroupService.groups)if(t.contains(e)){i=t;break}i&&i.closeEditor(e)}}};a9=(0,ei.__decorate)([(0,ei.__param)(0,eQ.IEditorService),(0,ei.__param)(1,eY.IEditorGroupsService)],a9),(0,tH.registerWorkbenchContribution2)(a9.ID,a9,tH.WorkbenchPhase.BlockStartup),eO.Registry.as(iV.EditorExtensions.EditorFactory).registerEditorSerializer(az.ID,az),(0,eG.registerAction2)(a1),(0,eG.registerAction2)(a2),(0,eG.registerAction2)(a3),(0,eG.registerAction2)(a5),(0,eG.registerAction2)(a6),e.s([],868328);var a8=e.i(999146),a7=e.i(751753),de=eu,dt=e.i(770848);let di=class extends de.Disposable{constructor(e,t,i,o,r){super(),this.configurationService=t,this.logService=i,this.preferencesService=o,this.quickInputService=r,this._providers=new e7.LinkedList,this._register(e.registerExternalOpener(this))}registerExternalOpenerProvider(e){return{dispose:this._providers.push(e)}}async getOpeners(e,t,i,o){let r=await this.getAllOpenersForUri(e);if(0===r.size)return[];if(i.preferredOpenerId){if(i.preferredOpenerId===a8.defaultExternalUriOpenerId)return[];let e=r.get(i.preferredOpenerId);if(e)return[e]}let s=this.getConfiguredOpenerForUri(r,e);if(s)return s===a8.defaultExternalUriOpenerId?[]:[s];let n=[];if(await Promise.all(Array.from(r.values()).map(async e=>{let t;try{t=await e.canOpen(i.sourceUri,o)}catch(e){this.logService.error(e);return}switch(t){case i1.ExternalUriOpenerPriority.Option:case i1.ExternalUriOpenerPriority.Default:case i1.ExternalUriOpenerPriority.Preferred:n.push({opener:e,priority:t})}})),0===n.length)return[];let a=n.filter(e=>e.priority===i1.ExternalUriOpenerPriority.Preferred).at(0);return a?[a.opener]:!t&&n.every(e=>e.priority===i1.ExternalUriOpenerPriority.Option)?[]:n.map(e=>e.opener)}async openExternal(e,t,i){let o="string"==typeof e?e$.URI.parse(e):e,r=await this.getOpeners(o,!1,t,i);return 0!==r.length&&(1===r.length?r[0].openExternalUri(o,t,i):this.showOpenerPrompt(r,o,t,i))}async getOpener(e,t,i){let o=await this.getOpeners(e,!0,t,i);if(o.length>=1)return o[0]}async getAllOpenersForUri(e){let t=new Map;return await Promise.all(a7.Iterable.map(this._providers,async i=>{for await(let o of i.getOpeners(e))t.set(o.id,o)})),t}getConfiguredOpenerForUri(e,t){for(let[i,o]of Object.entries(this.configurationService.getValue(a8.externalUriOpenersSettingId)||{}))if((0,dt.testUrlMatchesGlob)(t,i)){if(o===a8.defaultExternalUriOpenerId)return"default";let t=e.get(o);if(t)return t}}async showOpenerPrompt(e,t,i,o){let r=e.map(e=>({label:e.label,opener:e}));r.push({label:eg.isWeb?(0,ev.localize)(7887,"Open in new browser window"):(0,ev.localize)(7888,"Open in default browser"),opener:void 0},{type:"separator"},{label:(0,ev.localize)(7889,"Configure default opener..."),opener:"configureDefault"});let s=await this.quickInputService.pick(r,{placeHolder:(0,ev.localize)(7890,"How would you like to open: {0}",t.toString())});return!s||void 0!==s.opener&&("configureDefault"===s.opener?(await this.preferencesService.openUserSettings({jsonEditor:!0,revealSetting:{key:a8.externalUriOpenersSettingId,edit:!0}}),!0):s.opener.openExternalUri(t,i,o))}};di=(0,ei.__decorate)([(0,ei.__param)(0,tQ.IOpenerService),(0,ei.__param)(1,ey.IConfigurationService),(0,ei.__param)(2,eX.ILogService),(0,ei.__param)(3,s$.IPreferencesService),(0,ei.__param)(4,rM.IQuickInputService)],di),eO.Registry.as(tr.Extensions.Configuration).registerConfiguration(a8.externalUriOpenersConfigurationNode),e.s([],731453);var dr=e.i(203037),ds=eu,dn=e.i(508898),da=e.i(833476),dd=eG;(0,t$.registerCss)(void 0);class dl{constructor(e,t){this.combined=e,this.dedicated=t}isEqual(e){return(0,ea.equals)(this.combined,e.combined)&&(0,ea.equals)(this.dedicated,e.dedicated)}}let dc=class{constructor(e,t){this._storageService=e,this._key=t}get value(){return this._storageService.getNumber(this._key,t0.StorageScope.PROFILE,0)}increment(){let e=this.value+1;return this._storageService.store(this._key,e,t0.StorageScope.PROFILE,t0.StorageTarget.MACHINE),e}};dc=(0,ei.__decorate)([(0,ei.__param)(0,eP.IStorageService)],dc);let dh=class extends ds.Disposable{static{this.Id="status.languageStatus"}constructor(e){for(const t of(super(),this.editorGroupService=e,e.parts))this.createLanguageStatus(t);this._register(e.onDidCreateAuxiliaryEditorPart(e=>this.createLanguageStatus(e)))}createLanguageStatus(e){let t=new ds.DisposableStore;ec.Event.once(e.onWillDispose)(()=>t.dispose());let i=this.editorGroupService.getScopedInstantiationService(e);t.add(i.createInstance(du))}};dh=(0,ei.__decorate)([(0,ei.__param)(0,eY.IEditorGroupsService)],dh);let du=class{static{j=this}static{this._id="status.languageStatus"}static{this._keyDedicatedItems="languageStatus.dedicated"}constructor(e,t,i,o,r,s){this._languageStatusService=e,this._statusBarService=t,this._editorService=i,this._hoverService=o,this._openerService=r,this._storageService=s,this._disposables=new ds.DisposableStore,this._dedicated=new Set,this._dedicatedEntries=new Map,this._renderDisposables=new ds.DisposableStore,this._combinedEntryTooltip=(0,er.createElement)("div"),s.onDidChangeValue(t0.StorageScope.PROFILE,j._keyDedicatedItems,this._disposables)(this._handleStorageChange,this,this._disposables),this._restoreState(),this._interactionCounter=new dc(s,"languageStatus.interactCount"),e.onDidChange(this._update,this,this._disposables),i.onDidActiveEditorChange(this._update,this,this._disposables),this._update(),t.onDidChangeEntryVisibility(e=>{!e.visible&&this._dedicated.has(e.id)&&(this._dedicated.delete(e.id),this._update(),this._storeState())},void 0,this._disposables)}dispose(){this._disposables.dispose(),this._combinedEntry?.dispose(),(0,ds.dispose)(this._dedicatedEntries.values()),this._renderDisposables.dispose()}_handleStorageChange(){this._restoreState(),this._update()}_restoreState(){let e=this._storageService.get(j._keyDedicatedItems,t0.StorageScope.PROFILE,"[]");try{let t=JSON.parse(e);this._dedicated=new Set(t)}catch{this._dedicated.clear()}}_storeState(){if(0===this._dedicated.size)this._storageService.remove(j._keyDedicatedItems,t0.StorageScope.PROFILE);else{let e=JSON.stringify(Array.from(this._dedicated.keys()));this._storageService.store(j._keyDedicatedItems,e,t0.StorageScope.PROFILE,t0.StorageTarget.USER)}}_createViewModel(e){if(!e?.hasModel())return new dl([],[]);let t=this._languageStatusService.getLanguageStatus(e.getModel()),i=[],o=[];for(let e of t)this._dedicated.has(e.id)&&o.push(e),i.push(e);return new dl(i,o)}_update(){let e=(0,tt.getCodeEditor)(this._editorService.activeTextEditorControl),t=this._createViewModel(e);if(this._model?.isEqual(t))return;if(this._renderDisposables.clear(),this._model=t,e?.onDidChangeModelLanguage(this._update,this,this._renderDisposables),0===t.combined.length)this._combinedEntry?.dispose(),this._combinedEntry=void 0;else{let[i]=t.combined,o=i.severity>=em.default.Warning,r=j._severityToComboCodicon(i.severity),s=!1,n=[];for(let e of t.combined){let i=t.dedicated.includes(e);this._renderStatus(this._combinedEntryTooltip,e,o,i,this._renderDisposables),n.push(j._accessibilityInformation(e).label),s=s||!i&&e.busy}let a={name:(0,ev.localize)(8508,"Editor Language Status"),ariaLabel:(0,ev.localize)(8509,"Editor Language Status: {0}",n.join(", next: ")),tooltip:this._combinedEntryTooltip,command:sN.ShowTooltipCommand,text:s?"$(loading~spin)":r};this._combinedEntry?this._combinedEntry.update(a):this._combinedEntry=this._statusBarService.addEntry(a,j._id,sN.StatusbarAlignment.RIGHT,{location:{id:"status.editor.mode",priority:100.1},alignment:sN.StatusbarAlignment.LEFT,compact:!0});let d=this._interactionCounter.value>=3,l=(0,er.getWindow)(e?.getContainerDomNode()),c=l.document.querySelector(".monaco-workbench .statusbar DIV#status\\.languageStatus A>SPAN.codicon"),h=l.document.querySelector(".monaco-workbench .statusbar DIV#status\\.languageStatus");if((0,er.isHTMLElement)(c)&&h){let e="wiggle",t="flash";s?(c.classList.remove(e),h.classList.remove(t)):(c.classList.toggle(e,o||!d),this._renderDisposables.add((0,er.addDisposableListener)(c,"animationend",t=>c.classList.remove(e))),h.classList.toggle(t,o),this._renderDisposables.add((0,er.addDisposableListener)(h,"animationend",e=>h.classList.remove(t))))}if(!d){let e=l.document.querySelector(".monaco-workbench .context-view");if((0,er.isHTMLElement)(e)){let t=new MutationObserver(()=>{l.document.contains(this._combinedEntryTooltip)&&(this._interactionCounter.increment(),t.disconnect())});t.observe(e,{childList:!0,subtree:!0}),this._renderDisposables.add((0,ds.toDisposable)(()=>t.disconnect()))}}}let i=new Map;for(let e of t.dedicated){let t=j._asStatusbarEntry(e),o=this._dedicatedEntries.get(e.id);o?(o.update(t),this._dedicatedEntries.delete(e.id)):o=this._statusBarService.addEntry(t,e.id,sN.StatusbarAlignment.RIGHT,{location:{id:"status.editor.mode",priority:100.1},alignment:sN.StatusbarAlignment.RIGHT}),i.set(e.id,o)}(0,ds.dispose)(this._dedicatedEntries.values()),this._dedicatedEntries=i}_renderStatus(e,t,i,o,r){let s,n=(0,er.createElement)("div");n.classList.add("hover-language-status"),e.appendChild(n),r.add((0,ds.toDisposable)(()=>n.remove()));let a=(0,er.createElement)("div");a.classList.add("severity",`sev${t.severity}`),a.classList.toggle("show",i);let d=j._severityToSingleCodicon(t.severity);(0,er.append)(a,...(0,dr.renderLabelWithIcons)(d)),n.appendChild(a);let l=(0,er.createElement)("div");l.classList.add("element"),n.appendChild(l);let c=(0,er.createElement)("div");c.classList.add("left"),l.appendChild(c);let h="string"==typeof t.label?t.label:t.label.value;(0,er.append)(c,...(0,dr.renderLabelWithIcons)(dg(h,t.busy))),this._renderTextPlus(c,t.detail,r);let u=(0,er.createElement)("div");u.classList.add("right"),l.appendChild(u);let{command:p}=t;p&&r.add(new da.Link(u,{label:p.title,title:p.tooltip,href:e$.URI.from({scheme:"command",path:p.id,query:p.arguments&&JSON.stringify(p.arguments)}).toString()},{hoverDelegate:o2.nativeHoverDelegate},this._hoverService,this._openerService));let g=new oV.ActionBar(u,{hoverDelegate:o2.nativeHoverDelegate}),m=o?(0,ev.localize)(8510,"Remove from Status Bar"):(0,ev.localize)(8511,"Add to Status Bar");return g.setAriaLabel(m),r.add(g),s=o?new oN.Action("unpin",m,ih.ThemeIcon.asClassName(t8.Codicon.pinned),!0,()=>{this._dedicated.delete(t.id),this._statusBarService.updateEntryVisibility(t.id,!1),this._update(),this._storeState()}):new oN.Action("pin",m,ih.ThemeIcon.asClassName(t8.Codicon.pin),!0,()=>{this._dedicated.add(t.id),this._statusBarService.updateEntryVisibility(t.id,!0),this._update(),this._storeState()}),g.push(s,{icon:!0,label:!1}),r.add(s),n}static _severityToComboCodicon(e){switch(e){case em.default.Error:return"$(bracket-error)";case em.default.Warning:return"$(bracket-dot)";default:return"$(bracket)"}}static _severityToSingleCodicon(e){switch(e){case em.default.Error:return"$(error)";case em.default.Warning:return"$(info)";default:return"$(check)"}}_renderTextPlus(e,t,i){let o=!1;for(let r of(0,ro.parseLinkedText)(t).nodes)if(o||((0,er.append)(e,(0,er.$)("span.separator")),o=!0),"string"==typeof r){let t=(0,dr.renderLabelWithIcons)(r);(0,er.append)(e,...t)}else i.add(new da.Link(e,r,void 0,this._hoverService,this._openerService))}static _accessibilityInformation(e){if(e.accessibilityInfo)return e.accessibilityInfo;let t="string"==typeof e.label?e.label:e.label.value;return e.detail?{label:(0,ev.localize)(8512,"{0}, {1}",t,e.detail)}:{label:(0,ev.localize)(8513,"{0}",t)}}static _asStatusbarEntry(e){let t;e.severity===em.default.Warning?t="warning":e.severity===em.default.Error&&(t="error");let i="string"==typeof e.label?e.label:e.label.shortValue;return{name:(0,ev.localize)(8514,"{0} (Language Status)",e.name),text:dg(i,e.busy),ariaLabel:j._accessibilityInformation(e).label,role:e.accessibilityInfo?.role,tooltip:e.command?.tooltip||new eh.MarkdownString(e.detail,{isTrusted:!0,supportThemeIcons:!0}),kind:t,command:e.command}}};du=j=(0,ei.__decorate)([(0,ei.__param)(0,dn.ILanguageStatusService),(0,ei.__param)(1,sG.IStatusbarService),(0,ei.__param)(2,eQ.IEditorService),(0,ei.__param)(3,tj.IHoverService),(0,ei.__param)(4,tQ.IOpenerService),(0,ei.__param)(5,eP.IStorageService)],du);class dp extends dd.Action2{constructor(){super({id:"editor.inlayHints.Reset",title:(0,ev.localize2)(8515,"Reset Language Status Interaction Counter"),category:eq.Categories.View,f1:!0})}run(e){e.get(eP.IStorageService).remove("languageStatus.interactCount",t0.StorageScope.PROFILE)}}function dg(e,t){return(0,iu.joinStrings)([""!==e&&e,t&&"$(loading~spin)"],"  ")}(0,tH.registerWorkbenchContribution2)(dh.Id,dh,tH.WorkbenchPhase.AfterRestored),(0,eG.registerAction2)(dp),e.s([],99935);var dm=eG,dv=e.i(269489),dy=e.i(523183),dC=eu;e.i(71224);var db=nC,dw=e.i(531707),df=e.i(926902);(0,rZ.registerColor)("mergeEditor.change.background","#9bb95533",(0,ev.localize)(9148,"The background color for changes.")),(0,rZ.registerColor)("mergeEditor.change.word.background",{dark:"#9ccc2c33",light:"#9ccc2c66",hcDark:"#9ccc2c33",hcLight:"#9ccc2c66"},(0,ev.localize)(9149,"The background color for word changes.")),(0,rZ.registerColor)("mergeEditor.changeBase.background",{dark:"#4B1818FF",light:"#FFCCCCFF",hcDark:"#4B1818FF",hcLight:"#FFCCCCFF"},(0,ev.localize)(9150,"The background color for changes in base.")),(0,rZ.registerColor)("mergeEditor.changeBase.word.background",{dark:"#6F1313FF",light:"#FFA3A3FF",hcDark:"#6F1313FF",hcLight:"#FFA3A3FF"},(0,ev.localize)(9151,"The background color for word changes in base.")),(0,rZ.registerColor)("mergeEditor.conflict.unhandledUnfocused.border",{dark:"#ffa6007a",light:"#ffa600FF",hcDark:"#ffa6007a",hcLight:"#ffa6007a"},(0,ev.localize)(9152,"The border color of unhandled unfocused conflicts.")),(0,rZ.registerColor)("mergeEditor.conflict.unhandledFocused.border","#ffa600",(0,ev.localize)(9153,"The border color of unhandled focused conflicts.")),(0,rZ.registerColor)("mergeEditor.conflict.handledUnfocused.border","#86868649",(0,ev.localize)(9154,"The border color of handled unfocused conflicts.")),(0,rZ.registerColor)("mergeEditor.conflict.handledFocused.border","#c1c1c1cc",(0,ev.localize)(9155,"The border color of handled focused conflicts."));let dS=(0,rZ.registerColor)("mergeEditor.conflict.handled.minimapOverViewRuler","#adaca8ee",(0,ev.localize)(9156,"The foreground color for changes in input 1.")),d_=(0,rZ.registerColor)("mergeEditor.conflict.unhandled.minimapOverViewRuler","#fcba03FF",(0,ev.localize)(9157,"The foreground color for changes in input 1."));(0,rZ.registerColor)("mergeEditor.conflictingLines.background","#ffea0047",(0,ev.localize)(9158,'The background of the "Conflicting Lines" text.')),(0,rZ.registerColor)("mergeEditor.conflict.input1.background",(0,rZ.transparent)(r0.mergeCurrentHeaderBackground,.4),(0,ev.localize)(9159,"The background color of decorations in input 1.")),(0,rZ.registerColor)("mergeEditor.conflict.input2.background",(0,rZ.transparent)(r0.mergeIncomingHeaderBackground,.4),(0,ev.localize)(9160,"The background color of decorations in input 2."));var dE=eu,dI=e.i(969647),dD=e.i(229081),dT=e.i(770127),dA=e.i(580424),dx=e.i(896344),dR=e.i(823288);class dk extends dE.Disposable{constructor(e,t,i){super(),this._editor=e,this._domNode=t,this.itemProvider=i,this.scrollTop=(0,dD.observableFromEvent)(this,this._editor.onDidScrollChange,e=>this._editor.getScrollTop()),this.isScrollTopZero=this.scrollTop.map(e=>0===e),this.modelAttached=(0,dD.observableFromEvent)(this,this._editor.onDidChangeModel,e=>this._editor.hasModel()),this.editorOnDidChangeViewZones=(0,dT.observableSignalFromEvent)("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=(0,dT.observableSignalFromEvent)("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=(0,dA.observableSignal)("domNodeSizeChanged"),this.views=new Map,this._domNode.className="gutter monaco-editor";const o=this._domNode.appendChild((0,er.h)("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),r=new ResizeObserver(()=>{(0,dR.transaction)(e=>{this.domNodeSizeChanged.trigger(e)})});r.observe(this._domNode),this._register((0,dE.toDisposable)(()=>r.disconnect())),this._register((0,dx.autorun)(e=>{o.className=this.isScrollTopZero.read(e)?"":"scroll-decoration"})),this._register((0,dx.autorun)(e=>this.render(e)))}dispose(){super.dispose(),(0,er.reset)(this._domNode)}render(e){if(!this.modelAttached.read(e))return;this.domNodeSizeChanged.read(e),this.editorOnDidChangeViewZones.read(e),this.editorOnDidContentSizeChange.read(e);let t=this.scrollTop.read(e),i=this._editor.getVisibleRanges(),o=new Set(this.views.keys());if(i.length>0){let r=i[0],s=dI.MergeEditorLineRange.fromLength(r.startLineNumber,r.endLineNumber-r.startLineNumber).deltaEnd(1);for(let i of this.itemProvider.getIntersectingGutterItems(s,e)){if(!i.range.intersectsOrTouches(s))continue;o.delete(i.id);let e=this.views.get(i.id);if(e)e.gutterItemView.update(i);else{let t=(0,er.createElement)("div");this._domNode.appendChild(t),e=new dM(this.itemProvider.createView(i,t),t),this.views.set(i.id,e)}let r=i.range.startLineNumber<=this._editor.getModel().getLineCount()?this._editor.getTopForLineNumber(i.range.startLineNumber,!0)-t:this._editor.getBottomForLineNumber(i.range.startLineNumber-1,!1)-t,n=this._editor.getBottomForLineNumber(i.range.endLineNumberExclusive-1,!0)-t-r;e.domNode.style.top=`${r}px`,e.domNode.style.height=`${n}px`,e.gutterItemView.layout(r,n,0,this._domNode.clientHeight)}}for(let e of o){let t=this.views.get(e);t.gutterItemView.dispose(),t.domNode.remove(),this.views.delete(e)}}}class dM{constructor(e,t){this.gutterItemView=e,this.domNode=t}}var dL=eu,dO=e.i(671524),dP=e.i(261968),dV=e.i(159868),dK=e.i(597556),dN=e.i(531452),dG=e.i(314122);class dF extends dL.Disposable{updateOptions(e){this.editor.updateOptions(e)}constructor(e,t,i){super(),this.instantiationService=e,this.viewModel=t,this.configurationService=i,this.model=this.viewModel.map(e=>e?.model),this.htmlElements=(0,er.h)("div.code-view",[(0,er.h)("div.header@header",[(0,er.h)("span.title@title"),(0,er.h)("span.description@description"),(0,er.h)("span.detail@detail"),(0,er.h)("span.toolbar@toolbar")]),(0,er.h)("div.container",[(0,er.h)("div.gutter@gutterDiv"),(0,er.h)("div@editor")])]),this._onDidViewChange=new ec.Emitter,this.view={element:this.htmlElements.root,minimumWidth:dK.DEFAULT_EDITOR_MIN_DIMENSIONS.width,maximumWidth:dK.DEFAULT_EDITOR_MAX_DIMENSIONS.width,minimumHeight:dK.DEFAULT_EDITOR_MIN_DIMENSIONS.height,maximumHeight:dK.DEFAULT_EDITOR_MAX_DIMENSIONS.height,onDidChange:this._onDidViewChange.event,layout:(e,t,i,o)=>{(0,df.setStyle)(this.htmlElements.root,{width:e,height:t,top:i,left:o}),this.editor.layout({width:e-this.htmlElements.gutterDiv.clientWidth,height:t-this.htmlElements.header.clientHeight})}},this.checkboxesVisible=(0,dN.observableConfigValue)("mergeEditor.showCheckboxes",!1,this.configurationService),this.showDeletionMarkers=(0,dN.observableConfigValue)("mergeEditor.showDeletionMarkers",!0,this.configurationService),this.useSimplifiedDecorations=(0,dN.observableConfigValue)("mergeEditor.useSimplifiedDecorations",!1,this.configurationService),this.editor=this.instantiationService.createInstance(ny.CodeEditorWidget,this.htmlElements.editor,{},{contributions:this.getEditorContributions()}),this.isFocused=(0,dD.observableFromEvent)(this,ec.Event.any(this.editor.onDidBlurEditorWidget,this.editor.onDidFocusEditorWidget),()=>this.editor.hasWidgetFocus()),this.cursorPosition=(0,dD.observableFromEvent)(this,this.editor.onDidChangeCursorPosition,()=>this.editor.getPosition()),this.selection=(0,dD.observableFromEvent)(this,this.editor.onDidChangeCursorSelection,()=>this.editor.getSelections()),this.cursorLineNumber=this.cursorPosition.map(e=>e?.lineNumber)}getEditorContributions(){return on.EditorExtensionsRegistry.getEditorContributions().filter(e=>e.id!==dP.FoldingController.ID&&e.id!==dO.CodeLensContribution.ID)}}function dW(e,t){let i=(0,dG.derived)(i=>{let o=e.viewModel.read(i);if(!o)return[];let r=o.selectionInBase.read(i);return r&&r.sourceEditor!==e?r.rangesInBase.map(e=>t(e,o)):[]});return(0,dx.autorun)(t=>{let o=i.read(t);0!==o.length&&e.editor.setSelections(o.map(e=>new nP.Selection(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn)))})}let dz=class extends dL.Disposable{constructor(e,t,i){super();const o=i.createInstance(dV.MenuWorkbenchToolBar,t,e,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:e=>"primary"===e}});this._store.add(o)}};dz=(0,ei.__decorate)([(0,ei.__param)(2,eD.IInstantiationService)],dz);let dB=class extends dF{constructor(e,t,i){super(t,e,i),this.decorations=(0,dG.derived)(this,e=>{let t=this.viewModel.read(e);if(!t)return[];let i=t.model,o=i.base,r=t.activeModifiedBaseRange.read(e),s=t.showNonConflictingChanges.read(e),n=this.showDeletionMarkers.read(e),a=[];for(let d of i.modifiedBaseRanges.read(e)){let l=d.baseRange;if(!l)continue;let c=i.isHandled(d).read(e);if(!d.isConflicting&&c&&!s)continue;let h=["merge-editor-block"],u=[0,0,0,0];c&&h.push("handled"),d===r&&(h.push("focused"),u=[0,2,0,2]),h.push("base");let p=t.baseShowDiffAgainst.read(e);if(p)for(let e of d.getInputDiffs(p)){let t=e.inputRange.toInclusiveRange();for(let i of(t&&a.push({range:t,options:{className:"merge-editor-diff base",description:"Merge Editor",isWholeLine:!0}}),e.rangeMappings))(n||!i.inputRange.isEmpty())&&a.push({range:i.inputRange,options:{className:i.inputRange.isEmpty()?"merge-editor-diff-empty-word base":"merge-editor-diff-word base",description:"Merge Editor",showIfCollapsed:!0}})}a.push({range:l.toInclusiveRangeOrEmpty(),options:{showIfCollapsed:!0,blockClassName:h.join(" "),blockPadding:u,blockIsAfterEnd:l.startLineNumber>o.getLineCount(),description:"Merge Editor",minimap:{position:ij.MinimapPosition.Gutter,color:{id:c?dS:d_}},overviewRuler:d.isConflicting?{position:ij.OverviewRulerLane.Center,color:{id:c?dS:d_}}:void 0}})}return a}),this._register(dW(this,(e,t)=>e)),this._register(t.createInstance(dz,eG.MenuId.MergeBaseToolbar,this.htmlElements.title)),this._register((0,dx.autorunWithStore)((e,t)=>{this.checkboxesVisible.read(e)&&t.add(new dk(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(e,t)=>[],createView:(e,t)=>{throw new el.BugIndicatingError}}))})),this._register((0,dx.autorun)(e=>{let t,i=this.viewModel.read(e);if(!i)return;this.editor.setModel(i.model.base),(0,er.reset)(this.htmlElements.title,...(0,dr.renderLabelWithIcons)((0,ev.localize)(9179,"Base")));let o=i.baseShowDiffAgainst.read(e);if(o){let e=(0,ev.localize)(9180,"Comparing with {0}",1===o?i.model.input1.title:i.model.input2.title),r=(0,ev.localize)(9181,"Differences are highlighted with a background color.");t=(0,er.h)("span",{title:r},[e]).root}(0,er.reset)(this.htmlElements.description,...t?[t]:[])})),this._register((0,df.applyObservableDecorations)(this.editor,this.decorations))}};dB=(0,ei.__decorate)([(0,ei.__param)(1,eD.IInstantiationService),(0,ei.__param)(2,ey.IConfigurationService)],dB);var dU=eu,dH=e.i(582106),d$=e.i(629565);class dq extends dU.Disposable{get model(){return this.viewModel.get()?.model}get lockResultWithInputs(){return"columns"===this.layout.get().kind}get lockBaseWithInputs(){return"mixed"===this.layout.get().kind&&!this.layout.get().showBaseAtTop}constructor(e,t,i,o,r,s){super(),this.viewModel=e,this.input1View=t,this.input2View=i,this.baseView=o,this.inputResultView=r,this.layout=s,this.reentrancyBarrier=new d$.ReentrancyBarrier,this._isSyncing=!0;const n=(0,dG.derived)(e=>{let t=this.baseView.read(e),i=[this.input1View,this.input2View,this.inputResultView,t].filter(eN.isDefined),o=(e,t,o)=>{this.reentrancyBarrier.runExclusivelyOrSkip(()=>{if(t){let t=e.editor.getScrollLeft();for(let o of i)o!==e&&o.editor.setScrollLeft(t,i$.ScrollType.Immediate)}if(o){let t=e.editor.getScrollTop();for(let o of i)if(o!==e)if(this._shouldLock(e,o))o.editor.setScrollTop(t,i$.ScrollType.Immediate);else{let t=this._getMapping(e,o);t&&this._synchronizeScrolling(e.editor,o.editor,t)}}})};for(let t of i)e.store.add(t.editor.onDidScrollChange(e=>{this._isSyncing&&o(t,e.scrollLeftChanged,e.scrollTopChanged)}));return{update:()=>{o(this.inputResultView,!0,!0)}}}).recomputeInitiallyAndOnChange(this._store);this.updateScrolling=()=>{n.get().update()}}stopSync(){this._isSyncing=!1}startSync(){this._isSyncing=!0}_shouldLock(e,t){let i=e=>e===this.input1View||e===this.input2View;return i(e)&&t===this.inputResultView||i(t)&&e===this.inputResultView?this.lockResultWithInputs:i(e)&&t===this.baseView.get()||i(t)&&e===this.baseView.get()?this.lockBaseWithInputs:!!(i(e)&&i(t))}_getMapping(e,t){if(e===this.input1View){if(t===this.input2View)return;else if(t===this.inputResultView)return this.model?.input1ResultMapping.get();else if(t===this.baseView.get()){let e=this.model?.baseInput1Diffs.get();if(!e)return;return new dH.DocumentLineRangeMap(e,-1).reverse()}}else if(e===this.input2View){if(t===this.input1View)return;else if(t===this.inputResultView)return this.model?.input2ResultMapping.get();else if(t===this.baseView.get()){let e=this.model?.baseInput2Diffs.get();if(!e)return;return new dH.DocumentLineRangeMap(e,-1).reverse()}}else if(e===this.inputResultView){if(t===this.input1View)return this.model?.resultInput1Mapping.get();else if(t===this.input2View)return this.model?.resultInput2Mapping.get();else if(t===this.baseView.get()){let e=this.model?.resultBaseMapping.get();if(!e)return;return e}}else if(e===this.baseView.get()){if(t===this.input1View){let e=this.model?.baseInput1Diffs.get();if(!e)return;return new dH.DocumentLineRangeMap(e,-1)}else if(t===this.input2View){let e=this.model?.baseInput2Diffs.get();if(!e)return;return new dH.DocumentLineRangeMap(e,-1)}else if(t===this.inputResultView){let e=this.model?.baseResultMapping.get();if(!e)return;return e}}throw new el.BugIndicatingError}_synchronizeScrolling(e,t,i){if(!i)return;let o=e.getVisibleRanges();if(0===o.length)return;let r=o[0].startLineNumber-1,s=i.project(r),n=s.inputRange,a=s.outputRange,d=t.getTopForLineNumber(a.startLineNumber),l=t.getTopForLineNumber(a.endLineNumberExclusive),c=e.getTopForLineNumber(n.startLineNumber),h=e.getTopForLineNumber(n.endLineNumberExclusive),u=Math.min((e.getScrollTop()-c)/(h-c),1);t.setScrollTop(d+(l-d)*u,i$.ScrollType.Immediate)}}var dY=e.i(237029),dj=eu,dX=e.i(532816),dJ=e.i(465376);let dZ=class extends dj.Disposable{constructor(e,t,i,o,r,s,n,a){super(),this.model=e,this.inputCodeEditorView1=t,this.inputCodeEditorView2=i,this.resultCodeEditorView=o,this.baseCodeEditorView=r,this.showNonConflictingChanges=s,this.configurationService=n,this.notificationService=a,this.manuallySetActiveModifiedBaseRange=(0,dX.observableValue)(this,{range:void 0,counter:0}),this.attachedHistory=this._register(new dQ(this.model.resultTextModel)),this.shouldUseAppendInsteadOfAccept=(0,dN.observableConfigValue)("mergeEditor.shouldUseAppendInsteadOfAccept",!1,this.configurationService),this.counter=0,this.lastFocusedEditor=(0,dJ.derivedObservableWithWritableCache)(this,(e,t)=>{let i=[this.inputCodeEditorView1,this.inputCodeEditorView2,this.resultCodeEditorView,this.baseCodeEditorView.read(e)].find(t=>t&&t.isFocused.read(e));return i?{view:i,counter:this.counter++}:t||{view:void 0,counter:this.counter++}}),this.baseShowDiffAgainst=(0,dG.derived)(this,e=>{let t=this.lastFocusedEditor.read(e);return t.view===this.inputCodeEditorView1?1:t.view===this.inputCodeEditorView2?2:void 0}),this.focusedEditorType=(0,dG.derived)(this,e=>{let t=this.lastFocusedEditor.read(e);if(t.view){if(t.view===this.inputCodeEditorView1)return"input1";else if(t.view===this.inputCodeEditorView2)return"input2";else if(t.view===this.resultCodeEditorView)return"result";else if(t.view===this.baseCodeEditorView.read(e))return"base"}}),this.selectionInBase=(0,dG.derived)(this,e=>{let t=this.lastFocusedEditor.read(e).view;if(t)return{rangesInBase:(t.selection.read(e)||[]).map(i=>t===this.inputCodeEditorView1?this.model.translateInputRangeToBase(1,i):t===this.inputCodeEditorView2?this.model.translateInputRangeToBase(2,i):t===this.resultCodeEditorView?this.model.translateResultRangeToBase(i):t===this.baseCodeEditorView.read(e)?i:i),sourceEditor:t}}),this.activeModifiedBaseRange=(0,dG.derived)(this,e=>{let t=this.lastFocusedEditor.read(e),i=this.manuallySetActiveModifiedBaseRange.read(e);if(i.counter>t.counter)return i.range;if(!t.view)return;let o=t.view.cursorLineNumber.read(e);if(o)return this.model.modifiedBaseRanges.read(e).find(i=>{let r=this.getRangeOfModifiedBaseRange(t.view,i,e);return r.isEmpty?r.startLineNumber===o:r.contains(o)})}),this._register(o.editor.onDidChangeModelContent(e=>{if(this.model.isApplyingEditInResult||e.isRedoing||e.isUndoing)return;let t=[];for(let i of e.changes){let e=this.model.translateResultRangeToBase(tD.Range.lift(i.range)),o=this.model.findModifiedBaseRangesInRange(dI.MergeEditorLineRange.fromLength(e.startLineNumber,e.endLineNumber-e.startLineNumber));1===o.length&&(this.model.isHandled(o[0]).get()||t.push(o[0]))}if(0===t.length)return;let i={model:this.model,redo(){(0,dR.transaction)(e=>{for(let i of t)this.model.setHandled(i,!0,e)})},undo(){(0,dR.transaction)(e=>{for(let i of t)this.model.setHandled(i,!1,e)})}};this.attachedHistory.pushAttachedHistoryElement(i),i.redo()}))}getRangeOfModifiedBaseRange(e,t,i){if(e===this.resultCodeEditorView)return this.model.getLineRangeInResult(t.baseRange,i);{if(e===this.baseCodeEditorView.get())return t.baseRange;let i=e===this.inputCodeEditorView1?1:2;return t.getInputRange(i)}}setActiveModifiedBaseRange(e,t){this.manuallySetActiveModifiedBaseRange.set({range:e,counter:this.counter++},t)}setState(e,t,i,o){this.manuallySetActiveModifiedBaseRange.set({range:e,counter:this.counter++},i),this.model.setState(e,t,o,i),this.lastFocusedEditor.clearCache(i)}goToConflict(e){let t=this.lastFocusedEditor.get().view;t||(t=this.resultCodeEditorView);let i=t.editor.getPosition()?.lineNumber;if(void 0===i)return;let o=e(t,i);if(o){let e=this.getRangeOfModifiedBaseRange(t,o,void 0);t.editor.focus();let i=e.startLineNumber,r=e.endLineNumberExclusive;e.startLineNumber>t.editor.getModel().getLineCount()&&((0,dR.transaction)(e=>{this.setActiveModifiedBaseRange(o,e)}),i=r=t.editor.getModel().getLineCount()),t.editor.setPosition({lineNumber:i,column:t.editor.getModel().getLineFirstNonWhitespaceColumn(i)}),t.editor.revealLinesNearTop(i,r,i$.ScrollType.Smooth)}}goToNextModifiedBaseRange(e){this.goToConflict((t,i)=>this.model.modifiedBaseRanges.get().find(o=>e(o)&&this.getRangeOfModifiedBaseRange(t,o,void 0).startLineNumber>i)||this.model.modifiedBaseRanges.get().find(t=>e(t)))}goToPreviousModifiedBaseRange(e){this.goToConflict((t,i)=>(0,dY.findLast)(this.model.modifiedBaseRanges.get(),o=>e(o)&&this.getRangeOfModifiedBaseRange(t,o,void 0).endLineNumberExclusive<i)||(0,dY.findLast)(this.model.modifiedBaseRanges.get(),t=>e(t)))}toggleActiveConflict(e){let t=this.activeModifiedBaseRange.get();t?(0,dR.transaction)(i=>{this.setState(t,this.model.getState(t).get().toggle(e),i,e)}):this.notificationService.error((0,ev.localize)(9198,"There is currently no conflict focused that can be toggled."))}acceptAll(e){(0,dR.transaction)(t=>{for(let i of this.model.modifiedBaseRanges.get())this.setState(i,this.model.getState(i).get().withInputValue(e,!0),t,e)})}};dZ=(0,ei.__decorate)([(0,ei.__param)(6,ey.IConfigurationService),(0,ei.__param)(7,oY.INotificationService)],dZ);class dQ extends dj.Disposable{constructor(e){super(),this.model=e,this.attachedHistory=[],this.previousAltId=this.model.getAlternativeVersionId(),this._register(e.onDidChangeContent(t=>{let i=e.getAlternativeVersionId();if(t.isRedoing)for(let e of this.attachedHistory)this.previousAltId<e.altId&&e.altId<=i&&e.element.redo();else if(t.isUndoing)for(let e=this.attachedHistory.length-1;e>=0;e--){let t=this.attachedHistory[e];i<t.altId&&t.altId<=this.previousAltId&&t.element.undo()}else for(;this.attachedHistory.length>0&&this.attachedHistory[this.attachedHistory.length-1].altId>this.previousAltId;)this.attachedHistory.pop();this.previousAltId=i}))}pushAttachedHistoryElement(e){this.attachedHistory.push({altId:this.model.getAlternativeVersionId(),element:e})}}var d0=e.i(182504),d1=eu,d2=e.i(604634),d3=e.i(371660),d5=eu;class d6 extends d5.Disposable{static{this.counter=0}constructor(e,t,i,o,r){super(),this.editor=e,this.overlayWidgetId=`fixedZoneWidget-${d6.counter++}`,this.widgetDomNode=(0,er.h)("div.fixed-zone-widget").root,this.overlayWidget={getId:()=>this.overlayWidgetId,getDomNode:()=>this.widgetDomNode,getPosition:()=>null},this.viewZoneId=t.addZone({domNode:(0,er.createElement)("div"),afterLineNumber:i,heightInPx:o,ordinal:50001,onComputedHeight:e=>{this.widgetDomNode.style.height=`${e}px`},onDomNodeTop:e=>{this.widgetDomNode.style.top=`${e}px`}}),r.push(this.viewZoneId),this._register(ec.Event.runAndSubscribe(this.editor.onDidLayoutChange,()=>{this.widgetDomNode.style.left=this.editor.getLayoutInfo().contentLeft+"px"})),this.editor.addOverlayWidget(this.overlayWidget),this._register({dispose:()=>{this.editor.removeOverlayWidget(this.overlayWidget)}})}}class d4 extends d1.Disposable{constructor(e){super(),this._editor=e,this._register(this._editor.onDidChangeConfiguration(e=>{(e.hasChanged(to.EditorOption.fontInfo)||e.hasChanged(to.EditorOption.codeLensFontSize)||e.hasChanged(to.EditorOption.codeLensFontFamily))&&this._updateLensStyle()})),this._styleClassName="_conflictActionsFactory_"+(0,d0.hash)(this._editor.getId()).toString(16),this._styleElement=(0,es.createStyleSheet)((0,er.isInShadowDOM)(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,void 0,this._store),this._updateLensStyle()}_updateLensStyle(){let{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(to.EditorOption.codeLensFontFamily),o=this._editor.getOption(to.EditorOption.fontInfo),r=`--codelens-font-family${this._styleClassName}`,s=`--codelens-font-features${this._styleClassName}`,n=`
155
+ .${this._styleClassName} { line-height: ${e}px; font-size: ${t}px; padding-right: ${Math.round(.5*t)}px; font-feature-settings: var(${s}) }
156
+ .monaco-workbench .${this._styleClassName} span.codicon { line-height: ${e}px; font-size: ${t}px; }
157
+ `;i&&(n+=`${this._styleClassName} { font-family: var(${r}), ${d2.EDITOR_FONT_DEFAULTS.fontFamily}}`),this._styleElement.textContent=n,this._editor.getContainerDomNode().style?.setProperty(r,i??"inherit"),this._editor.getContainerDomNode().style?.setProperty(s,o.fontFeatureSettings)}_getLayoutInfo(){let e=Math.max(1.3,this._editor.getOption(to.EditorOption.lineHeight)/this._editor.getOption(to.EditorOption.fontSize)),t=this._editor.getOption(to.EditorOption.codeLensFontSize);return(!t||t<5)&&(t=.9*this._editor.getOption(to.EditorOption.fontSize)|0),{fontSize:t,codeLensHeight:t*e|0}}createWidget(e,t,i,o){let r=this._getLayoutInfo();return new d7(this._editor,e,t,r.codeLensHeight+2,this._styleClassName,i,o)}}class d9{constructor(e,t){this.viewModel=e,this.modifiedBaseRange=t,this.itemsInput1=this.getItemsInput(1),this.itemsInput2=this.getItemsInput(2),this.resultItems=(0,dG.derived)(this,e=>{let t=this.viewModel,i=this.modifiedBaseRange,o=t.model.getState(i).read(e),r=t.model,s=[];if(o.kind===d3.ModifiedBaseRangeStateKind.unrecognized)s.push({text:(0,ev.localize)(9161,"Manual Resolution"),tooltip:(0,ev.localize)(9162,"This conflict has been resolved manually.")});else if(o.kind===d3.ModifiedBaseRangeStateKind.base)s.push({text:(0,ev.localize)(9163,"No Changes Accepted"),tooltip:(0,ev.localize)(9164,"The current resolution of this conflict equals the common ancestor of both the right and left changes.")});else{let e=[];o.includesInput1&&e.push(r.input1.title),o.includesInput2&&e.push(r.input2.title),o.kind===d3.ModifiedBaseRangeStateKind.both&&2===o.firstInput&&e.reverse(),s.push({text:`${e.join(" + ")}`})}let n=[];return o.includesInput1&&n.push(d8((0,ev.localize)(9165,"Remove {0}",r.input1.title),async()=>{(0,dR.transaction)(e=>{r.setState(i,o.withInputValue(1,!1),!0,e),r.telemetry.reportRemoveInvoked(1,o.includesInput(2))})},(0,ev.localize)(9166,"Remove {0} from the result document.",r.input1.title))),o.includesInput2&&n.push(d8((0,ev.localize)(9165,"Remove {0}",r.input2.title),async()=>{(0,dR.transaction)(e=>{r.setState(i,o.withInputValue(2,!1),!0,e),r.telemetry.reportRemoveInvoked(2,o.includesInput(1))})},(0,ev.localize)(9166,"Remove {0} from the result document.",r.input2.title))),o.kind===d3.ModifiedBaseRangeStateKind.both&&2===o.firstInput&&n.reverse(),s.push(...n),o.kind===d3.ModifiedBaseRangeStateKind.unrecognized&&s.push(d8((0,ev.localize)(9167,"Reset to base"),async()=>{(0,dR.transaction)(e=>{r.setState(i,d3.ModifiedBaseRangeState.base,!0,e),r.telemetry.reportResetToBaseInvoked()})},(0,ev.localize)(9168,"Reset this conflict to the common ancestor of both the right and left changes."))),s}),this.isEmpty=(0,dG.derived)(this,e=>this.itemsInput1.read(e).length+this.itemsInput2.read(e).length+this.resultItems.read(e).length===0),this.inputIsEmpty=(0,dG.derived)(this,e=>this.itemsInput1.read(e).length+this.itemsInput2.read(e).length===0)}getItemsInput(e){return(0,dG.derived)(t=>{let i=this.viewModel,o=this.modifiedBaseRange;if(!i.model.hasBaseRange(o))return[];let r=i.model.getState(o).read(t),s=i.model.isHandled(o).read(t),n=i.model,a=[],d=1===e?i.model.input1:i.model.input2,l=i.showNonConflictingChanges.read(t);if(!o.isConflicting&&s&&!l)return[];let c=1===e?2:1;if(r.kind!==d3.ModifiedBaseRangeStateKind.unrecognized&&!r.isInputIncluded(e)){if(r.isInputIncluded(c)&&this.viewModel.shouldUseAppendInsteadOfAccept.read(t))a.push(d8((0,ev.localize)(9174,"Append {0}",d.title),async()=>{(0,dR.transaction)(t=>{n.setState(o,r.withInputValue(e,!0,!1),e,t),n.telemetry.reportAcceptInvoked(e,r.includesInput(c))})},(0,ev.localize)(9175,"Append {0} to the result document.",d.title))),o.canBeCombined&&a.push(d8((0,ev.localize)(9176,"Accept Combination",d.title),async()=>{(0,dR.transaction)(t=>{n.setState(o,r.withInputValue(e,!0,!0),e,t),n.telemetry.reportSmartCombinationInvoked(r.includesInput(c))})},(0,ev.localize)(9173,"Accept an automatic combination of both sides in the result document.")));else if(a.push(d8((0,ev.localize)(9169,"Accept {0}",d.title),async()=>{(0,dR.transaction)(t=>{n.setState(o,r.withInputValue(e,!0,!1),e,t),n.telemetry.reportAcceptInvoked(e,r.includesInput(c))})},(0,ev.localize)(9170,"Accept {0} in the result document.",d.title))),o.canBeCombined){let t=o.isOrderRelevant?(0,ev.localize)(9171,"Accept Combination ({0} First)",d.title):(0,ev.localize)(9172,"Accept Combination");a.push(d8(t,async()=>{(0,dR.transaction)(t=>{n.setState(o,d3.ModifiedBaseRangeState.base.withInputValue(e,!0).withInputValue(c,!0,!0),!0,t),n.telemetry.reportSmartCombinationInvoked(r.includesInput(c))})},(0,ev.localize)(9173,"Accept an automatic combination of both sides in the result document.")))}n.isInputHandled(o,e).read(t)||a.push(d8((0,ev.localize)(9177,"Ignore"),async()=>{(0,dR.transaction)(t=>{n.setInputHandled(o,e,!0,t)})},(0,ev.localize)(9178,"Don't take this side of the conflict.")))}return a})}}function d8(e,t,i){return{text:e,action:t,tooltip:i}}class d7 extends d6{constructor(e,t,i,o,r,s,n){super(e,t,i,o,n),this._domNode=(0,er.h)("div.merge-editor-conflict-actions").root,this.widgetDomNode.appendChild(this._domNode),this._domNode.classList.add(r),this._register((0,dx.autorun)(e=>{let t=s.read(e);this.setState(t)}))}setState(e){let t=[],i=!0;for(let o of e){i?i=!1:t.push((0,er.$)("span",void 0," | "));let e=(0,dr.renderLabelWithIcons)(o.text);o.action?t.push((0,er.$)("a",{title:o.tooltip,role:"button",onclick:()=>o.action()},...e)):t.push((0,er.$)("span",{title:o.tooltip},...e))}(0,er.reset)(this._domNode,...t)}}var le=e.i(957235),lt=e.i(819593),li=e.i(312636),lo=e.i(215813);function lr(e,t,i){let o=[],r=t.getStartPosition(),s=i.getStartPosition();for(let t of e){let e=new dH.RangeMapping(tD.Range.fromPositions(r,t.inputRange.getStartPosition()),tD.Range.fromPositions(s,t.outputRange.getStartPosition()));(0,le.assertFn)(()=>(0,lo.lengthOfRange)(e.inputRange).equals((0,lo.lengthOfRange)(e.outputRange))),e.inputRange.isEmpty()||o.push(e),r=t.inputRange.getEndPosition(),s=t.outputRange.getEndPosition()}let n=new dH.RangeMapping(tD.Range.fromPositions(r,t.getEndPosition()),tD.Range.fromPositions(s,i.getEndPosition()));return(0,le.assertFn)(()=>(0,lo.lengthOfRange)(n.inputRange).equals((0,lo.lengthOfRange)(n.outputRange))),n.inputRange.isEmpty()||o.push(n),o}class ls{constructor(e,t,i){this.input1Editor=e,this.input2Editor=t,this.resultEditor=i,this.conflictActionsFactoryInput1=new d4(this.input1Editor),this.conflictActionsFactoryInput2=new d4(this.input2Editor),this.conflictActionsFactoryResult=new d4(this.resultEditor)}computeViewZones(e,t,i){let o,r,s=0,n=0,a=0,d=0,l=[],c=[],h=[],u=[],p=t.model,g=p.baseResultDiffs.read(e),m=(0,df.join)(p.modifiedBaseRanges.read(e),g,(e,t)=>e.baseRange.intersectsOrTouches(t.inputRange)?ea.CompareResult.neitherLessOrGreaterThan:dI.MergeEditorLineRange.compareByStart(e.baseRange,t.inputRange)),v=i.codeLensesVisible,y=i.showNonConflictingChanges;for(let g of m){let m;if(v&&g.left&&(g.left.isConflicting||y||!p.isHandled(g.left).read(e))){let o=new d9(t,g.left);(i.shouldAlignResult||!o.inputIsEmpty.read(e))&&(l.push(new lc(this.conflictActionsFactoryInput1,g.left.input1Range.startLineNumber-1,o.itemsInput1)),c.push(new lc(this.conflictActionsFactoryInput2,g.left.input2Range.startLineNumber-1,o.itemsInput2)),i.shouldAlignBase&&h.push(new ll(g.left.baseRange.startLineNumber-1,16)));let s=g.left.baseRange.startLineNumber+(r?.resultingDeltaFromOriginalToModified??0)-1;u.push(new lc(this.conflictActionsFactoryResult,s,o.resultItems))}let C=g.rights.at(-1);for(let{input1Line:e,baseLine:t,input2Line:p,resultLine:v}of(C&&(r=C),g.left?(m=(function(e){let t=function(e,t){let i,o=[],r=[];for(let[i,o]of[[0,e],[1,t]])for(let e of o)r.push({input:i,start:!0,inputPos:e.inputRange.getStartPosition(),outputPos:e.outputRange.getStartPosition()}),r.push({input:i,start:!1,inputPos:e.inputRange.getEndPosition(),outputPos:e.outputRange.getEndPosition()});r.sort((0,ea.compareBy)(e=>e.inputPos,lt.Position.compare));let s=[void 0,void 0];for(let e of r){if(i&&s.some(e=>!!e)){let t=(0,lo.lengthBetweenPositions)(i,e.inputPos);!t.isZero()&&(o.push({inputPos:i,length:t,output1Pos:s[0],output2Pos:s[1]}),s[0]&&(s[0]=(0,lo.addLength)(s[0],t)),s[1]&&(s[1]=(0,lo.addLength)(s[1],t)))}s[e.input]=e.start?e.outputPos:void 0,i=e.inputPos}return o}(lr(e.input1Diffs.flatMap(e=>e.rangeMappings),e.baseRange.toExclusiveRange(),e.input1Range.toExclusiveRange()),lr(e.input2Diffs.flatMap(e=>e.rangeMappings),e.baseRange.toExclusiveRange(),e.input2Range.toExclusiveRange())),i=[];function o(e){return e.every(e=>void 0!==e)}for(let r of(i.push([e.input1Range.startLineNumber-1,e.baseRange.startLineNumber-1,e.input2Range.startLineNumber-1]),t)){let e=[r.output1Pos?.lineNumber,r.inputPos.lineNumber,r.output2Pos?.lineNumber],t=o(e),s=!0;if(t){let t=!i.some(t=>o(t)&&t.some((t,i)=>void 0!==t&&t===e[i]));t&&(i=i.filter(t=>!t.some((t,i)=>void 0!==t&&t===e[i]))),s=t}else s=!i.some(t=>t.some((t,i)=>void 0!==t&&t===e[i]));s?i.push(e):r.length.isGreaterThan(new li.TextLength(1,0))&&i.push([r.output1Pos?r.output1Pos.lineNumber+1:void 0,r.inputPos.lineNumber+1,r.output2Pos?r.output2Pos.lineNumber+1:void 0])}let r=[e.input1Range.endLineNumberExclusive,e.baseRange.endLineNumberExclusive,e.input2Range.endLineNumberExclusive];return(i=i.filter(e=>e.every((e,t)=>e!==r[t]))).push(r),(0,le.assertFn)(()=>(0,le.checkAdjacentItems)(i.map(e=>e[0]).filter(eN.isDefined),(e,t)=>e<t)&&(0,le.checkAdjacentItems)(i.map(e=>e[1]).filter(eN.isDefined),(e,t)=>e<=t)&&(0,le.checkAdjacentItems)(i.map(e=>e[2]).filter(eN.isDefined),(e,t)=>e<t)&&i.every(e=>e.filter(eN.isDefined).length>=2)),i})(g.left).map(e=>({input1Line:e[0],baseLine:e[1],input2Line:e[2],resultLine:void 0})),o=g.left,m[m.length-1].resultLine=g.left.baseRange.endLineNumberExclusive+(r?r.resultingDeltaFromOriginalToModified:0)):m=[{baseLine:C.inputRange.endLineNumberExclusive,input1Line:C.inputRange.endLineNumberExclusive+(o?o.input1Range.endLineNumberExclusive-o.baseRange.endLineNumberExclusive:0),input2Line:C.inputRange.endLineNumberExclusive+(o?o.input2Range.endLineNumberExclusive-o.baseRange.endLineNumberExclusive:0),resultLine:C.outputRange.endLineNumberExclusive}],m)){if(!i.shouldAlignBase&&(void 0===e||void 0===p))continue;let o=void 0!==e?e+s:-1,r=void 0!==p?p+n:-1,g=t+a,m=void 0!==v?v+d:-1,y=Math.max(i.shouldAlignBase?g:0,o,r,i.shouldAlignResult?m:0);if(void 0!==e){let t=y-o;t>0&&(l.push(new ld(e-1,t)),s+=t)}if(void 0!==p){let e=y-r;e>0&&(c.push(new ld(p-1,e)),n+=e)}if(i.shouldAlignBase){let e=y-g;e>0&&(h.push(new ld(t-1,e)),a+=e)}if(i.shouldAlignResult&&void 0!==v){let e=y-m;e>0&&(u.push(new ld(v-1,e)),d+=e)}}}return new ln(l,c,h,u)}}class ln{constructor(e,t,i,o){this.input1ViewZones=e,this.input2ViewZones=t,this.baseViewZones=i,this.resultViewZones=o}}class la{}class ld extends la{constructor(e,t){super(),this.afterLineNumber=e,this.heightInLines=t}create(e,t,i){t.push(e.addZone({afterLineNumber:this.afterLineNumber,heightInLines:this.heightInLines,domNode:(0,er.$)("div.diagonal-fill")}))}}class ll extends la{constructor(e,t){super(),this.afterLineNumber=e,this.heightPx=t}create(e,t,i){t.push(e.addZone({afterLineNumber:this.afterLineNumber,heightInPx:this.heightPx,domNode:(0,er.$)("div.conflict-actions-placeholder")}))}}class lc extends la{constructor(e,t,i){super(),this.conflictActionsFactory=e,this.lineNumber=t,this.items=i}create(e,t,i){i.add(this.conflictActionsFactory.createWidget(e,this.lineNumber,this.items,t))}}var lh=e.i(42331);let lu=(0,rZ.registerColor)("settings.headerForeground",{light:"#444444",dark:"#e7e7e7",hcDark:"#ffffff",hcLight:"#292929"},(0,ev.localize)(10153,"The foreground color for a section header or active title."));(0,rZ.registerColor)("settings.settingsHeaderHoverForeground",(0,rZ.transparent)(lu,.7),(0,ev.localize)(10154,"The foreground color for a section header or hovered title.")),(0,rZ.registerColor)("settings.modifiedItemIndicator",{light:new iJ.Color(new iJ.RGBA(102,175,224)),dark:new iJ.Color(new iJ.RGBA(12,125,157)),hcDark:new iJ.Color(new iJ.RGBA(0,73,122)),hcLight:new iJ.Color(new iJ.RGBA(102,175,224))},(0,ev.localize)(10155,"The color of the modified setting indicator.")),(0,rZ.registerColor)("settings.headerBorder",r3.PANEL_BORDER,(0,ev.localize)(10156,"The color of the header container border."));let lp=(0,rZ.registerColor)("settings.sashBorder",r3.PANEL_BORDER,(0,ev.localize)(10157,"The color of the Settings editor splitview sash border."));(0,rZ.registerColor)("settings.dropdownBackground",r1.selectBackground,(0,ev.localize)(10158,"Settings editor dropdown background.")),(0,rZ.registerColor)("settings.dropdownForeground",r1.selectForeground,(0,ev.localize)(10159,"Settings editor dropdown foreground.")),(0,rZ.registerColor)("settings.dropdownBorder",r1.selectBorder,(0,ev.localize)(10160,"Settings editor dropdown border.")),(0,rZ.registerColor)("settings.dropdownListBorder",r0.editorWidgetBorder,(0,ev.localize)(10161,"Settings editor dropdown list border. This surrounds the options and separates the options from the description.")),(0,rZ.registerColor)("settings.checkboxBackground",r1.checkboxBackground,(0,ev.localize)(10162,"Settings editor checkbox background.")),(0,rZ.registerColor)("settings.checkboxForeground",r1.checkboxForeground,(0,ev.localize)(10163,"Settings editor checkbox foreground.")),(0,rZ.registerColor)("settings.checkboxBorder",r1.checkboxBorder,(0,ev.localize)(10164,"Settings editor checkbox border.")),(0,rZ.registerColor)("settings.textInputBackground",r1.inputBackground,(0,ev.localize)(10165,"Settings editor text input box background.")),(0,rZ.registerColor)("settings.textInputForeground",r1.inputForeground,(0,ev.localize)(10166,"Settings editor text input box foreground.")),(0,rZ.registerColor)("settings.textInputBorder",r1.inputBorder,(0,ev.localize)(10167,"Settings editor text input box border.")),(0,rZ.registerColor)("settings.numberInputBackground",r1.inputBackground,(0,ev.localize)(10168,"Settings editor number input box background.")),(0,rZ.registerColor)("settings.numberInputForeground",r1.inputForeground,(0,ev.localize)(10169,"Settings editor number input box foreground.")),(0,rZ.registerColor)("settings.numberInputBorder",r1.inputBorder,(0,ev.localize)(10170,"Settings editor number input box border.")),(0,rZ.registerColor)("settings.focusedRowBackground",{dark:(0,rZ.transparent)(r2.listHoverBackground,.6),light:(0,rZ.transparent)(r2.listHoverBackground,.6),hcDark:null,hcLight:null},(0,ev.localize)(10171,"The background color of a settings row when focused.")),(0,rZ.registerColor)("settings.rowHoverBackground",{dark:(0,rZ.transparent)(r2.listHoverBackground,.3),light:(0,rZ.transparent)(r2.listHoverBackground,.3),hcDark:null,hcLight:null},(0,ev.localize)(10172,"The background color of a settings row when hovered.")),(0,rZ.registerColor)("settings.focusedRowBorder",rQ.focusBorder,(0,ev.localize)(10173,"The color of the row's top and bottom border when the row is focused."));var lg=eu,lm=e.i(57660);let lv=class extends dF{constructor(e,t,i,o,r){super(i,t,r),this.inputNumber=e,this.otherInputNumber=1===this.inputNumber?2:1,this.modifiedBaseRangeGutterItemInfos=(0,dG.derivedOpts)({debugName:`input${this.inputNumber}.modifiedBaseRangeGutterItemInfos`},e=>{let t=this.viewModel.read(e);if(!t)return[];let i=t.model,o=this.inputNumber,r=t.showNonConflictingChanges.read(e);return i.modifiedBaseRanges.read(e).filter(t=>t.getInputDiffs(this.inputNumber).length>0&&(r||t.isConflicting||!i.isHandled(t).read(e))).map((e,i)=>new ly(i.toString(),e,o,t))}),this.decorations=(0,dG.derivedOpts)({debugName:`input${this.inputNumber}.decorations`},e=>{let t=this.viewModel.read(e);if(!t)return[];let i=t.model,o=(1===this.inputNumber?i.input1:i.input2).textModel,r=t.activeModifiedBaseRange.read(e),s=[],n=t.showNonConflictingChanges.read(e),a=this.showDeletionMarkers.read(e),d=(void 0===t.baseCodeEditorView.read(e)||t.baseShowDiffAgainst.read(e)!==this.inputNumber)&&this.useSimplifiedDecorations.read(e);for(let t of i.modifiedBaseRanges.read(e)){let l=t.getInputRange(this.inputNumber);if(!l)continue;let c=["merge-editor-block"],h=[0,0,0,0],u=i.isInputHandled(t,this.inputNumber).read(e);u&&c.push("handled"),t===r&&(c.push("focused"),h=[0,2,0,2]),t.isConflicting&&c.push("conflicting");let p=1===this.inputNumber?"input i1":"input i2";if(c.push(p),(t.isConflicting||n||!u)&&(d&&!u&&c.push("use-simplified-decorations"),s.push({range:l.toInclusiveRangeOrEmpty(),options:{showIfCollapsed:!0,blockClassName:c.join(" "),blockPadding:h,blockIsAfterEnd:l.startLineNumber>o.getLineCount(),description:"Merge Editor",minimap:{position:ij.MinimapPosition.Gutter,color:{id:u?dS:d_}},overviewRuler:t.isConflicting?{position:ij.OverviewRulerLane.Center,color:{id:u?dS:d_}}:void 0}}),!d&&(t.isConflicting||!i.isHandled(t).read(e))))for(let e of t.getInputDiffs(this.inputNumber)){let t=e.outputRange.toInclusiveRange();if(t&&s.push({range:t,options:{className:`merge-editor-diff ${p}`,description:"Merge Editor",isWholeLine:!0}}),e.rangeMappings)for(let t of e.rangeMappings)(a||!t.outputRange.isEmpty())&&s.push({range:t.outputRange,options:{className:t.outputRange.isEmpty()?`merge-editor-diff-empty-word ${p}`:`merge-editor-diff-word ${p}`,description:"Merge Editor",showIfCollapsed:!0}})}}return s}),this.htmlElements.root.classList.add("input"),this._register(new dk(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(e,t)=>this.checkboxesVisible.read(t)?this.modifiedBaseRangeGutterItemInfos.read(t):[],createView:(e,t)=>new lC(e,t,o)})),this._register(dW(this,(e,t)=>t.model.translateBaseRangeToInput(this.inputNumber,e))),this._register(i.createInstance(dz,1===e?eG.MenuId.MergeInput1Toolbar:eG.MenuId.MergeInput2Toolbar,this.htmlElements.toolbar)),this._register((0,dx.autorunOpts)({debugName:`input${this.inputNumber}: update labels & text model`},e=>{let t=this.viewModel.read(e);if(!t)return;this.editor.setModel(1===this.inputNumber?t.model.input1.textModel:t.model.input2.textModel);let i=1===this.inputNumber?t.model.input1.title||(0,ev.localize)(9182,"Input 1"):t.model.input2.title||(0,ev.localize)(9183,"Input 2"),o=1===this.inputNumber?t.model.input1.description:t.model.input2.description,r=1===this.inputNumber?t.model.input1.detail:t.model.input2.detail;(0,er.reset)(this.htmlElements.title,...(0,dr.renderLabelWithIcons)(i)),(0,er.reset)(this.htmlElements.description,...o?(0,dr.renderLabelWithIcons)(o):[]),(0,er.reset)(this.htmlElements.detail,...r?(0,dr.renderLabelWithIcons)(r):[])})),this._register((0,df.applyObservableDecorations)(this.editor,this.decorations))}};lv=(0,ei.__decorate)([(0,ei.__param)(2,eD.IInstantiationService),(0,ei.__param)(3,eC.IContextMenuService),(0,ei.__param)(4,ey.IConfigurationService)],lv);class ly{constructor(e,t,i,o){this.id=e,this.baseRange=t,this.inputNumber=i,this.viewModel=o,this.model=this.viewModel.model,this.range=this.baseRange.getInputRange(this.inputNumber),this.enabled=this.model.isUpToDate,this.toggleState=(0,dG.derived)(this,e=>{let t=this.model.getState(this.baseRange).read(e).getInput(this.inputNumber);return t!==d3.InputState.second||this.baseRange.isOrderRelevant?t:d3.InputState.first}),this.state=(0,dG.derived)(this,e=>{let t=this.viewModel.activeModifiedBaseRange.read(e);return this.model.hasBaseRange(this.baseRange)?{handled:this.model.isHandled(this.baseRange).read(e),focused:this.baseRange===t}:{handled:!1,focused:!1}})}setState(e,t){this.viewModel.setState(this.baseRange,this.model.getState(this.baseRange).get().withInputValue(this.inputNumber,e),t,this.inputNumber)}toggleBothSides(){(0,dR.transaction)(e=>{let t=this.model.getState(this.baseRange).get();this.model.setState(this.baseRange,t.toggle(this.inputNumber).toggle(1===this.inputNumber?2:1),!0,e)})}getContextMenuActions(){let e=this.model.getState(this.baseRange).get(),t=this.model.isHandled(this.baseRange).get(),i=e=>{(0,dR.transaction)(t=>this.viewModel.setState(this.baseRange,e,t,this.inputNumber))};function o(e,t,o,r){let s=new oN.Action(e,t,void 0,!0,()=>{i(o)});return s.checked=r,s}let r=e.includesInput1&&e.includesInput2;return[this.baseRange.input1Diffs.length>0?o("mergeEditor.acceptInput1",(0,ev.localize)(9184,"Accept {0}",this.model.input1.title),e.toggle(1),e.includesInput1):void 0,this.baseRange.input2Diffs.length>0?o("mergeEditor.acceptInput2",(0,ev.localize)(9184,"Accept {0}",this.model.input2.title),e.toggle(2),e.includesInput2):void 0,this.baseRange.isConflicting?(0,df.setFields)(o("mergeEditor.acceptBoth",(0,ev.localize)(9185,"Accept Both"),e.withInputValue(1,!r).withInputValue(2,!r),r),{enabled:this.baseRange.canBeCombined}):void 0,new oN.Separator,this.baseRange.isConflicting?(0,df.setFields)(o("mergeEditor.swap",(0,ev.localize)(9186,"Swap"),e.swap(),!1),{enabled:!e.kind&&(!r||this.baseRange.isOrderRelevant)}):void 0,(0,df.setFields)(new oN.Action("mergeEditor.markAsHandled",(0,ev.localize)(9187,"Mark as Handled"),void 0,!0,()=>{(0,dR.transaction)(e=>{this.model.setHandled(this.baseRange,!t,e)})}),{checked:t})].filter(eN.isDefined)}}class lC extends lg.Disposable{constructor(e,t,i){super(),this.isMultiLine=(0,dX.observableValue)(this,!1),this.item=(0,dX.observableValue)(this,e);const o=new o6.Toggle({isChecked:!1,title:"",icon:t8.Codicon.check,...t1.defaultToggleStyles});o.domNode.classList.add("accept-conflict-group"),this._register((0,er.addDisposableListener)(o.domNode,er.EventType.MOUSE_DOWN,e=>{let t=this.item.get();t&&(2===e.button?(e.stopPropagation(),e.preventDefault(),i.showContextMenu({getAnchor:()=>o.domNode,getActions:()=>t.getContextMenuActions()})):1===e.button&&(e.stopPropagation(),e.preventDefault(),t.toggleBothSides()))})),this._register((0,dx.autorun)(e=>{let t=this.item.read(e),i=t.toggleState.read(e),r={[d3.InputState.excluded]:{icon:void 0,checked:!1,title:(0,ev.localize)(9188,"Accept")},[d3.InputState.unrecognized]:{icon:t8.Codicon.circleFilled,checked:!1,title:(0,ev.localize)(9189,"Accept (result is dirty)")},[d3.InputState.first]:{icon:t8.Codicon.check,checked:!0,title:(0,ev.localize)(9190,"Undo accept")},[d3.InputState.second]:{icon:t8.Codicon.checkAll,checked:!0,title:(0,ev.localize)(9191,"Undo accept (currently second)")}}[i];o.setIcon(r.icon),o.checked=r.checked,o.setTitle(r.title),t.enabled.read(e)?o.enable():o.disable()})),this._register((0,dx.autorun)(e=>{let i=this.item.read(e).state.read(e);t.className=["merge-accept-gutter-marker",i.handled&&"handled",i.focused&&"focused",this.isMultiLine.read(e)?"multi-line":"single-line"].filter(e=>"string"==typeof e).join(" ")})),this._register(o.onChange(()=>{(0,dR.transaction)(e=>{this.item.get().setState(o.checked,e)})})),t.appendChild((0,er.h)("div.background",[iu.noBreakWhitespace]).root),t.appendChild(this.checkboxDiv=(0,er.h)("div.checkbox",[(0,er.h)("div.checkbox-background",[o.domNode])]).root)}layout(e,t,i,o){let r=this.checkboxDiv.clientHeight,s=e+(t/2-r/2),n=[r,i+o-r-r],a=[e+r,e+t-r-r];a[0]<a[1]&&(s=(0,lm.clamp)(s,n[0],n[1]),s=(0,lm.clamp)(s,a[0],a[1])),this.checkboxDiv.style.top=`${s-e}px`,(0,dR.transaction)(e=>{this.isMultiLine.set(t>30,e)})}update(e){(0,dR.transaction)(t=>{this.item.set(e,t)})}}let lb=class extends dF{constructor(e,t,i,o){super(t,e,o),this._labelService=i,this.decorations=(0,dG.derived)(this,e=>{let t=this.viewModel.read(e);if(!t)return[];let i=t.model,o=i.resultTextModel,r=[],s=(0,df.join)(i.modifiedBaseRanges.read(e),i.baseResultDiffs.read(e),(e,t)=>e.baseRange.intersectsOrTouches(t.inputRange)?ea.CompareResult.neitherLessOrGreaterThan:dI.MergeEditorLineRange.compareByStart(e.baseRange,t.inputRange)),n=t.activeModifiedBaseRange.read(e),a=t.showNonConflictingChanges.read(e);for(let t of s){let s=t.left;if(s){let t=["merge-editor-block"],d=[0,0,0,0],l=i.isHandled(s).read(e);if(l&&t.push("handled"),s===n&&(t.push("focused"),d=[0,2,0,2]),s.isConflicting&&t.push("conflicting"),t.push("result"),!s.isConflicting&&!a&&l)continue;let c=i.getLineRangeInResult(s.baseRange,e);r.push({range:c.toInclusiveRangeOrEmpty(),options:{showIfCollapsed:!0,blockClassName:t.join(" "),blockPadding:d,blockIsAfterEnd:c.startLineNumber>o.getLineCount(),description:"Result Diff",minimap:{position:ij.MinimapPosition.Gutter,color:{id:l?dS:d_}},overviewRuler:s.isConflicting?{position:ij.OverviewRulerLane.Center,color:{id:l?dS:d_}}:void 0}})}if(!s||s.isConflicting)for(let e of t.rights){let t=e.outputRange.toInclusiveRange();if(t&&r.push({range:t,options:{className:"merge-editor-diff result",description:"Merge Editor",isWholeLine:!0}}),e.rangeMappings)for(let t of e.rangeMappings)r.push({range:t.outputRange,options:{className:"merge-editor-diff-word result",description:"Merge Editor"}})}}return r}),this.editor.invokeWithinContext(e=>{let t=e.get(eK.IContextKeyService),i=lh.ctxIsMergeResultEditor.bindTo(t);i.set(!0),this._register((0,eu.toDisposable)(()=>i.reset()))}),this.htmlElements.gutterDiv.style.width="5px",this.htmlElements.root.classList.add("result"),this._register((0,dx.autorunWithStore)((e,t)=>{this.checkboxesVisible.read(e)&&t.add(new dk(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(e,t)=>[],createView:(e,t)=>{throw new el.BugIndicatingError}}))})),this._register((0,dx.autorun)(e=>{let t=this.viewModel.read(e);t&&(this.editor.setModel(t.model.resultTextModel),(0,er.reset)(this.htmlElements.title,...(0,dr.renderLabelWithIcons)((0,ev.localize)(9192,"Result"))),(0,er.reset)(this.htmlElements.description,...(0,dr.renderLabelWithIcons)(this._labelService.getUriLabel(t.model.resultTextModel.uri,{relative:!0}))))}));const r=this._register(new oV.ActionBar(this.htmlElements.detail));this._register((0,dx.autorun)(e=>{let t=this.viewModel.read(e);if(!t)return;let i=t.model;if(!i)return;let o=i.unhandledConflictsCount.read(e),s=1===o?(0,ev.localize)(9193,"{0} Conflict Remaining",o):(0,ev.localize)(9194,"{0} Conflicts Remaining ",o);r.clear(),r.push({class:void 0,enabled:o>0,id:"nextConflict",label:s,run(){t.model.telemetry.reportConflictCounterClicked(),t.goToNextModifiedBaseRange(e=>!i.isHandled(e).read(void 0))},tooltip:o>0?(0,ev.localize)(9195,"Go to next conflict"):(0,ev.localize)(9196,"All conflicts handled, the merge can be completed now.")})})),this._register((0,df.applyObservableDecorations)(this.editor,this.decorations)),this._register(dW(this,(e,t)=>t.model.translateBaseRangeToResult(e))),this._register(t.createInstance(dz,eG.MenuId.MergeInputResultToolbar,this.htmlElements.toolbar))}};lb=(0,ei.__decorate)([(0,ei.__param)(1,eD.IInstantiationService),(0,ei.__param)(2,tJ.ILabelService),(0,ei.__param)(3,ey.IConfigurationService)],lb),(0,t$.registerCss)(void 0);let lw=class extends db.AbstractTextEditor{static{X=this}static{this.ID="mergeEditor"}get viewModel(){return this._viewModel}get inputModel(){return this._inputModel}get model(){return this.inputModel.get()?.model}constructor(e,t,i,o,r,s,n,a,d,l,c){super(X.ID,e,o,t,r,n,s,a,d,l),this.contextKeyService=i,this._codeEditorService=c,this._sessionDisposables=new dC.DisposableStore,this._viewModel=(0,dX.observableValue)(this,void 0),this._grid=this._register(new dC.MutableDisposable),this.input1View=this._register(this.instantiationService.createInstance(lv,1,this._viewModel)),this.baseView=(0,dX.observableValue)(this,void 0),this.baseViewOptions=(0,dX.observableValue)(this,void 0),this.input2View=this._register(this.instantiationService.createInstance(lv,2,this._viewModel)),this.inputResultView=this._register(this.instantiationService.createInstance(lb,this._viewModel)),this._layoutMode=this.instantiationService.createInstance(lf),this._layoutModeObs=(0,dX.observableValue)(this,this._layoutMode.value),this._ctxIsMergeEditor=lh.ctxIsMergeEditor.bindTo(this.contextKeyService),this._ctxUsesColumnLayout=lh.ctxMergeEditorLayout.bindTo(this.contextKeyService),this._ctxShowBase=lh.ctxMergeEditorShowBase.bindTo(this.contextKeyService),this._ctxShowBaseAtTop=lh.ctxMergeEditorShowBaseAtTop.bindTo(this.contextKeyService),this._ctxResultUri=lh.ctxMergeResultUri.bindTo(this.contextKeyService),this._ctxBaseUri=lh.ctxMergeBaseUri.bindTo(this.contextKeyService),this._ctxShowNonConflictingChanges=lh.ctxMergeEditorShowNonConflictingChanges.bindTo(this.contextKeyService),this._inputModel=(0,dX.observableValue)(this,void 0),this.viewZoneComputer=new ls(this.input1View.editor,this.input2View.editor,this.inputResultView.editor),this.scrollSynchronizer=this._register(new dq(this._viewModel,this.input1View,this.input2View,this.baseView,this.inputResultView,this._layoutModeObs)),this._onDidChangeSizeConstraints=new ec.Emitter,this.onDidChangeSizeConstraints=this._onDidChangeSizeConstraints.event,this.baseViewDisposables=this._register(new dC.DisposableStore),this.showNonConflictingChangesStore=this.instantiationService.createInstance(df.PersistentStore,"mergeEditor/showNonConflictingChanges"),this.showNonConflictingChanges=(0,dX.observableValue)(this,this.showNonConflictingChangesStore.get()??!1)}dispose(){this._sessionDisposables.dispose(),this._ctxIsMergeEditor.reset(),this._ctxUsesColumnLayout.reset(),this._ctxShowNonConflictingChanges.reset(),super.dispose()}get minimumWidth(){return"mixed"===this._layoutMode.value.kind?this.input1View.view.minimumWidth+this.input2View.view.minimumWidth:this.input1View.view.minimumWidth+this.input2View.view.minimumWidth+this.inputResultView.view.minimumWidth}getTitle(){return this.input?this.input.getName():(0,ev.localize)(9197,"Text Merge Editor")}createEditorControl(e,t){this.rootHtmlElement=e,e.classList.add("merge-editor"),this.applyLayout(this._layoutMode.value),this.applyOptions(t)}updateEditorControlOptions(e){this.applyOptions(e)}applyOptions(e){let t=(0,df.deepMerge)(e,{minimap:{enabled:!1},glyphMargin:!1,lineNumbersMinChars:2}),i=(0,df.deepMerge)(t,{readOnly:!0,readOnlyMessage:void 0});this.input1View.updateOptions(i),this.input2View.updateOptions(i),this.baseViewOptions.set({...this.input2View.editor.getRawOptions()},void 0),this.inputResultView.updateOptions(t)}getMainControl(){return this.inputResultView.editor}layout(e){this._grid.value?.layout(e.width,e.height)}async setInput(e,t,i,o){if(!(e instanceof dv.MergeEditorInput))throw new el.BugIndicatingError("ONLY MergeEditorInput is supported");await super.setInput(e,t,i,o),this._sessionDisposables.clear(),(0,dR.transaction)(e=>{this._viewModel.set(void 0,e),this._inputModel.set(void 0,e)});let r=await e.resolve(),s=r.model,n=this.instantiationService.createInstance(dZ,s,this.input1View,this.input2View,this.inputResultView,this.baseView,this.showNonConflictingChanges);s.telemetry.reportMergeEditorOpened({combinableConflictCount:s.combinableConflictCount,conflictCount:s.conflictCount,baseTop:this._layoutModeObs.get().showBaseAtTop,baseVisible:this._layoutModeObs.get().showBase,isColumnView:"columns"===this._layoutModeObs.get().kind}),(0,dR.transaction)(e=>{this._viewModel.set(n,e),this._inputModel.set(r,e)}),this._sessionDisposables.add(n),this._sessionDisposables.add((0,dx.autorun)(t=>{let i=n.focusedEditorType.read(t);e instanceof dv.MergeEditorInput&&e.updateFocusedEditor(i||"result")})),this._ctxResultUri.set(r.resultUri.toString()),this._ctxBaseUri.set(s.base.uri.toString()),this._sessionDisposables.add((0,dC.toDisposable)(()=>{this._ctxBaseUri.reset(),this._ctxResultUri.reset()}));let a=new dC.DisposableStore;this._sessionDisposables.add(a),this._sessionDisposables.add((0,dx.autorunWithStore)(e=>{let t=this.baseView.read(e),i=this.inputResultView.editor.getScrollTop();this.scrollSynchronizer.stopSync(),a.clear(),this.inputResultView.editor.changeViewZones(i=>{let o=this._layoutModeObs.read(e),r="columns"===o.kind,s="mixed"===o.kind&&!o.showBaseAtTop;this.input1View.editor.changeViewZones(o=>{this.input2View.editor.changeViewZones(d=>{t?t.editor.changeViewZones(l=>{a.add(this.setViewZones(e,n,this.input1View.editor,o,this.input2View.editor,d,t.editor,l,s,this.inputResultView.editor,i,r))}):a.add(this.setViewZones(e,n,this.input1View.editor,o,this.input2View.editor,d,void 0,void 0,!1,this.inputResultView.editor,i,r))})})}),this.inputResultView.editor.setScrollTop(i,i$.ScrollType.Smooth),this.scrollSynchronizer.startSync(),this.scrollSynchronizer.updateScrolling()}));let d=this.loadEditorViewState(e,i);d?this._applyViewState(d):this._sessionDisposables.add((0,dC.thenIfNotDisposed)(s.onInitialized,()=>{let e=s.modifiedBaseRanges.get().find(e=>e.isConflicting);e&&(this.input1View.editor.revealLineInCenter(e.input1Range.startLineNumber),(0,dR.transaction)(t=>{n.setActiveModifiedBaseRange(e,t)}))}));let l=e=>{let t=(0,dw.readTransientState)(e,this._codeEditorService);(0,dw.writeTransientState)(s.input2.textModel,t,this._codeEditorService),(0,dw.writeTransientState)(s.input1.textModel,t,this._codeEditorService),(0,dw.writeTransientState)(s.resultTextModel,t,this._codeEditorService);let i=this.baseView.get()?.editor.getModel();i&&(0,dw.writeTransientState)(i,t,this._codeEditorService)};this._sessionDisposables.add(this._codeEditorService.onDidChangeTransientModelProperty(e=>{l(e)})),l(this.inputResultView.editor.getModel());let c=this;this._sessionDisposables.add(new class{constructor(){for(const e of(this._disposable=new dC.DisposableStore,this.baseInput1Input2()))this._disposable.add(e.onDidChangeContent(()=>this._checkBaseInput1Input2AllEmpty()))}dispose(){this._disposable.dispose()}*baseInput1Input2(){yield s.base,yield s.input1.textModel,yield s.input2.textModel}_checkBaseInput1Input2AllEmpty(){for(let e of this.baseInput1Input2())if(e.getValueLength()>0)return;c.editorService.replaceEditors([{editor:e,replacement:{resource:e.result,options:{preserveFocus:!0}},forceReplaceDirty:!0}],c.group)}})}setViewZones(e,t,i,o,r,s,n,a,d,l,c,h){let u=[],p=[],g=[],m=[],v=this.viewZoneComputer.computeViewZones(e,t,{codeLensesVisible:!0,showNonConflictingChanges:this.showNonConflictingChanges.read(e),shouldAlignBase:d,shouldAlignResult:h}),y=new dC.DisposableStore;if(a)for(let e of v.baseViewZones)e.create(a,g,y);for(let e of v.resultViewZones)e.create(c,m,y);for(let e of v.input1ViewZones)e.create(o,u,y);for(let e of v.input2ViewZones)e.create(s,p,y);return y.add({dispose:()=>{i.changeViewZones(e=>{for(let t of u)e.removeZone(t)}),r.changeViewZones(e=>{for(let t of p)e.removeZone(t)}),n?.changeViewZones(e=>{for(let t of g)e.removeZone(t)}),l.changeViewZones(e=>{for(let t of m)e.removeZone(t)})}}),y}setOptions(e){super.setOptions(e),e&&(0,np.applyTextEditorOptions)(e,this.inputResultView.editor,i$.ScrollType.Smooth)}clearInput(){for(let{editor:e}of(super.clearInput(),this._sessionDisposables.clear(),[this.input1View,this.input2View,this.inputResultView]))e.setModel(null)}focus(){super.focus(),(this.getControl()??this.inputResultView.editor).focus()}hasFocus(){for(let{editor:e}of[this.input1View,this.input2View,this.inputResultView])if(e.hasTextFocus())return!0;return super.hasFocus()}setEditorVisible(e){for(let{editor:t}of(super.setEditorVisible(e),[this.input1View,this.input2View,this.inputResultView]))e?t.onVisible():t.onHide();this._ctxIsMergeEditor.set(e)}getControl(){return this.inputResultView.editor}get scopedContextKeyService(){let e=this.getControl();return e?.invokeWithinContext(e=>e.get(eK.IContextKeyService))}toggleBase(){this.setLayout({...this._layoutMode.value,showBase:!this._layoutMode.value.showBase})}toggleShowBaseTop(){let e=this._layoutMode.value.showBase&&this._layoutMode.value.showBaseAtTop;this.setLayout({...this._layoutMode.value,showBaseAtTop:!0,showBase:!e})}toggleShowBaseCenter(){let e=this._layoutMode.value.showBase&&!this._layoutMode.value.showBaseAtTop;this.setLayout({...this._layoutMode.value,showBaseAtTop:!1,showBase:!e})}setLayoutKind(e){this.setLayout({...this._layoutMode.value,kind:e})}setLayout(e){JSON.stringify(this._layoutMode.value)!==JSON.stringify(e)&&(this.model?.telemetry.reportLayoutChange({baseTop:e.showBaseAtTop,baseVisible:e.showBase,isColumnView:"columns"===e.kind}),this.applyLayout(e))}applyLayout(e){(0,dR.transaction)(t=>{if(e.showBase&&!this.baseView.get()){this.baseViewDisposables.clear();let e=this.baseViewDisposables.add(this.instantiationService.createInstance(dB,this.viewModel));this.baseViewDisposables.add((0,dx.autorun)(t=>{let i=this.baseViewOptions.read(t);i&&e.updateOptions(i)})),this.baseView.set(e,t)}else!e.showBase&&this.baseView.get()&&(this.baseView.set(void 0,t),this.baseViewDisposables.clear());"mixed"===e.kind?this.setGrid([e.showBaseAtTop&&e.showBase?{size:38,data:this.baseView.get().view}:void 0,{size:38,groups:[{data:this.input1View.view},!e.showBaseAtTop&&e.showBase?{data:this.baseView.get().view}:void 0,{data:this.input2View.view}].filter(eN.isDefined)},{size:62,data:this.inputResultView.view}].filter(eN.isDefined)):"columns"===e.kind&&this.setGrid([e.showBase?{size:40,data:this.baseView.get().view}:void 0,{size:60,groups:[{data:this.input1View.view},{data:this.inputResultView.view},{data:this.input2View.view}]}].filter(eN.isDefined)),this._layoutMode.value=e,this._ctxUsesColumnLayout.set(e.kind),this._ctxShowBase.set(e.showBase),this._ctxShowBaseAtTop.set(e.showBaseAtTop),this._onDidChangeSizeConstraints.fire(),this._layoutModeObs.set(e,t)})}setGrid(e){let t=-1,i=-1;this._grid.value&&(t=this._grid.value.width,i=this._grid.value.height),this._grid.value=dy.SerializableGrid.from({orientation:oi.Orientation.VERTICAL,size:100,groups:e},{styles:{separatorBorder:this.theme.getColor(lp)??iJ.Color.transparent},proportionalLayout:!0}),(0,er.reset)(this.rootHtmlElement,this._grid.value.element),-1!==t&&this._grid.value.layout(t,i)}_applyViewState(e){e&&(this.inputResultView.editor.restoreViewState(e),e.input1State&&this.input1View.editor.restoreViewState(e.input1State),e.input2State&&this.input2View.editor.restoreViewState(e.input2State),e.focusIndex>=0&&[this.input1View.editor,this.input2View.editor,this.inputResultView.editor][e.focusIndex].focus())}computeEditorViewState(e){if(!(0,t9.isEqual)(this.inputModel.get()?.resultUri,e))return;let t=this.inputResultView.editor.saveViewState();if(!t)return;let i=this.input1View.editor.saveViewState()??void 0,o=this.input2View.editor.saveViewState()??void 0,r=[this.input1View.editor,this.input2View.editor,this.inputResultView.editor].findIndex(e=>e.hasWidgetFocus());return{...t,input1State:i,input2State:o,focusIndex:r}}tracksEditorViewState(e){return e instanceof dv.MergeEditorInput}toggleShowNonConflictingChanges(){this.showNonConflictingChanges.set(!this.showNonConflictingChanges.get(),void 0),this.showNonConflictingChangesStore.set(this.showNonConflictingChanges.get()),this._ctxShowNonConflictingChanges.set(this.showNonConflictingChanges.get())}};lw=X=(0,ei.__decorate)([(0,ei.__param)(1,eD.IInstantiationService),(0,ei.__param)(2,eK.IContextKeyService),(0,ei.__param)(3,ew.ITelemetryService),(0,ei.__param)(4,eP.IStorageService),(0,ei.__param)(5,eW.IThemeService),(0,ei.__param)(6,nw.ITextResourceConfigurationService),(0,ei.__param)(7,eQ.IEditorService),(0,ei.__param)(8,eY.IEditorGroupsService),(0,ei.__param)(9,tl.IFileService),(0,ei.__param)(10,od.ICodeEditorService)],lw);let lf=class{static{J=this}static{this._key="mergeEditor/layout"}constructor(e){this._storageService=e,this._value={kind:"mixed",showBase:!1,showBaseAtTop:!0};const t=e.get(J._key,t0.StorageScope.PROFILE,"mixed");if("mixed"===t||"columns"===t)this._value={kind:t,showBase:!1,showBaseAtTop:!0};else if(t)try{this._value=JSON.parse(t)}catch(e){(0,el.onUnexpectedError)(e)}}get value(){return this._value}set value(e){this._value!==e&&(this._value=e,this._storageService.store(J._key,JSON.stringify(this._value),t0.StorageScope.PROFILE,t0.StorageTarget.USER))}};lf=J=(0,ei.__decorate)([(0,ei.__param)(0,eP.IStorageService)],lf);let lS=class extends dC.Disposable{constructor(e,t){super(),this._editorService=e,this._store.add(t.registerCodeEditorOpenHandler(this.openCodeEditorFromMergeEditor.bind(this)))}async openCodeEditorFromMergeEditor(e,t,i){let o=this._editorService.activeEditorPane;if(!i&&e.options&&o instanceof lw&&o.getControl()&&o.input instanceof dv.MergeEditorInput&&(0,t9.isEqual)(e.resource,o.input.result)){let t=o.getControl();return(0,np.applyTextEditorOptions)(e.options,t,i$.ScrollType.Smooth),t}return null}};lS=(0,ei.__decorate)([(0,ei.__param)(0,eQ.IEditorService),(0,ei.__param)(1,od.ICodeEditorService)],lS);let l_=class extends dC.Disposable{static{this.ID="workbench.contrib.mergeEditorResolver"}constructor(e,t){super(),this._register(e.registerEditor("*",{id:iV.DEFAULT_EDITOR_ASSOCIATION.id,label:iV.DEFAULT_EDITOR_ASSOCIATION.displayName,detail:iV.DEFAULT_EDITOR_ASSOCIATION.providerDisplayName,priority:af.RegisteredEditorPriority.builtin},{},{createMergeEditorInput:e=>({editor:t.createInstance(dv.MergeEditorInput,e.base.resource,{uri:e.input1.resource,title:e.input1.label??(0,t9.basename)(e.input1.resource),description:e.input1.description??"",detail:e.input1.detail},{uri:e.input2.resource,title:e.input2.label??(0,t9.basename)(e.input2.resource),description:e.input2.description??"",detail:e.input2.detail},e.result.resource)})}))}};l_=(0,ei.__decorate)([(0,ei.__param)(0,aS.IEditorResolverService),(0,ei.__param)(1,eD.IInstantiationService)],l_);class lE extends dm.Action2{constructor(e){super(e)}run(e){let{activeEditorPane:t}=e.get(eQ.IEditorService);if(t instanceof lw){let i=t.viewModel.get();if(!i)return;this.runWithViewModel(i,e)}}}class lI extends dm.Action2{constructor(e){super(e)}run(e,...t){let{activeEditorPane:i}=e.get(eQ.IEditorService);if(i instanceof lw){let o=i.viewModel.get();if(!o)return;return this.runWithMergeEditor({viewModel:o,inputModel:i.inputModel.get(),input:i.input,editorIdentifier:{editor:i.input,groupId:i.group.id}},e,...t)}}}class lD extends dm.Action2{constructor(){super({id:"_open.mergeEditor",title:(0,ev.localize2)(9068,"Open Merge Editor")})}run(e,...t){let i=Z.validate(t[0]),o={base:{resource:i.base},input1:{resource:i.input1.uri,label:i.input1.title,description:i.input1.description,detail:i.input1.detail},input2:{resource:i.input2.uri,label:i.input2.title,description:i.input2.description,detail:i.input2.detail},result:{resource:i.output},options:{preserveFocus:!0}};e.get(eQ.IEditorService).openEditor(o)}}function lT(e){var t;if("string"==typeof e)return new dv.MergeEditorInputData(e$.URI.parse(e,!0),void 0,void 0,void 0);if(!e||"object"!=typeof e)throw TypeError("invalid argument");if((t=e)&&"object"==typeof t&&"string"==typeof t.scheme&&"string"==typeof t.authority&&"string"==typeof t.path&&"string"==typeof t.query&&"string"==typeof t.fragment)return new dv.MergeEditorInputData(e$.URI.revive(e),void 0,void 0,void 0);let i=e.title,o=lA(e.uri),r=e.detail,s=e.description;return new dv.MergeEditorInputData(o,i,r,s)}function lA(e){if("string"==typeof e)return e$.URI.parse(e,!0);if(e&&"object"==typeof e)return e$.URI.revive(e);throw TypeError("invalid argument")}(Z||(Z={})).validate=function(e){if(!e||"object"!=typeof e)throw TypeError("invalid argument");let t=lA(e.base),i=lA(e.output);return{base:t,input1:lT(e.input1),input2:lT(e.input2),output:i}};class lx extends dm.Action2{constructor(){super({id:"merge.mixedLayout",title:(0,ev.localize2)(9069,"Mixed Layout"),toggled:lh.ctxMergeEditorLayout.isEqualTo("mixed"),menu:[{id:dm.MenuId.EditorTitle,when:lh.ctxIsMergeEditor,group:"1_merge",order:9}],precondition:lh.ctxIsMergeEditor})}run(e){let{activeEditorPane:t}=e.get(eQ.IEditorService);t instanceof lw&&t.setLayoutKind("mixed")}}class lR extends dm.Action2{constructor(){super({id:"merge.columnLayout",title:(0,ev.localize2)(9070,"Column Layout"),toggled:lh.ctxMergeEditorLayout.isEqualTo("columns"),menu:[{id:dm.MenuId.EditorTitle,when:lh.ctxIsMergeEditor,group:"1_merge",order:10}],precondition:lh.ctxIsMergeEditor})}run(e){let{activeEditorPane:t}=e.get(eQ.IEditorService);t instanceof lw&&t.setLayoutKind("columns")}}class lk extends dm.Action2{constructor(){super({id:"merge.showNonConflictingChanges",title:(0,ev.localize2)(9071,"Show Non-Conflicting Changes"),toggled:lh.ctxMergeEditorShowNonConflictingChanges.isEqualTo(!0),menu:[{id:dm.MenuId.EditorTitle,when:lh.ctxIsMergeEditor,group:"3_merge",order:9}],precondition:lh.ctxIsMergeEditor})}run(e){let{activeEditorPane:t}=e.get(eQ.IEditorService);t instanceof lw&&t.toggleShowNonConflictingChanges()}}class lM extends dm.Action2{constructor(){super({id:"merge.showBase",title:(0,ev.localize2)(9072,"Show Base"),toggled:lh.ctxMergeEditorShowBase.isEqualTo(!0),menu:[{id:dm.MenuId.EditorTitle,when:eV.ContextKeyExpr.and(lh.ctxIsMergeEditor,lh.ctxMergeEditorLayout.isEqualTo("columns")),group:"2_merge",order:9}]})}run(e){let{activeEditorPane:t}=e.get(eQ.IEditorService);t instanceof lw&&t.toggleBase()}}class lL extends dm.Action2{constructor(){super({id:"merge.showBaseTop",title:(0,ev.localize2)(9073,"Show Base Top"),toggled:eV.ContextKeyExpr.and(lh.ctxMergeEditorShowBase,lh.ctxMergeEditorShowBaseAtTop),menu:[{id:dm.MenuId.EditorTitle,when:eV.ContextKeyExpr.and(lh.ctxIsMergeEditor,lh.ctxMergeEditorLayout.isEqualTo("mixed")),group:"2_merge",order:10}]})}run(e){let{activeEditorPane:t}=e.get(eQ.IEditorService);t instanceof lw&&t.toggleShowBaseTop()}}class lO extends dm.Action2{constructor(){super({id:"merge.showBaseCenter",title:(0,ev.localize2)(9074,"Show Base Center"),toggled:eV.ContextKeyExpr.and(lh.ctxMergeEditorShowBase,lh.ctxMergeEditorShowBaseAtTop.negate()),menu:[{id:dm.MenuId.EditorTitle,when:eV.ContextKeyExpr.and(lh.ctxIsMergeEditor,lh.ctxMergeEditorLayout.isEqualTo("mixed")),group:"2_merge",order:11}]})}run(e){let{activeEditorPane:t}=e.get(eQ.IEditorService);t instanceof lw&&t.toggleShowBaseCenter()}}let lP=(0,ev.localize2)(9075,"Merge Editor");async function lV(e,t,i){t.openEditor(t.activeEditor,{pinned:!0});let o=e.model.base,r=1===i?e.inputCodeEditorView1.editor:e.inputCodeEditorView2.editor,s=r.getPosition().lineNumber;await t.openEditor({original:{resource:o.uri},modified:{resource:r.getModel().uri},options:{selection:{startLineNumber:s,startColumn:1},revealIfOpened:!0,revealIfVisible:!0}})}class lK extends dm.Action2{constructor(){super({id:"mergeEditor.resetCloseWithConflictsChoice",category:lP,title:(0,ev.localize2)(9089,"Reset Choice for 'Close with Conflicts'"),f1:!0})}run(e){e.get(eP.IStorageService).remove(lh.StorageCloseWithConflicts,t0.StorageScope.PROFILE)}}var lN=e.i(107043),lG=eG;let lF=(0,ev.localize2)(9096,"Merge Editor (Dev)");class lW extends lG.Action2{constructor(){super({id:"merge.dev.copyContentsJson",category:lF,title:(0,ev.localize2)(9097,"Copy Merge Editor State as JSON"),icon:t8.Codicon.layoutCentered,f1:!0,precondition:lh.ctxIsMergeEditor})}run(e){let{activeEditorPane:t}=e.get(eQ.IEditorService),i=e.get(rO.IClipboardService),o=e.get(oY.INotificationService);if(!(t instanceof lw))return void o.info({name:(0,ev.localize)(9098,"Merge Editor"),message:(0,ev.localize)(9099,"No active merge editor")});let r=t.model;if(!r)return;let s=JSON.stringify({languageId:r.resultTextModel.getLanguageId(),base:r.base.getValue(),input1:r.input1.textModel.getValue(),input2:r.input2.textModel.getValue(),result:r.resultTextModel.getValue(),initialResult:r.getInitialResultValue()},void 0,4);i.writeText(s),o.info({name:(0,ev.localize)(9098,"Merge Editor"),message:(0,ev.localize)(9100,"Successfully copied merge editor state")})}}class lz extends lG.Action2{constructor(){super({id:"merge.dev.saveContentsToFolder",category:lF,title:(0,ev.localize2)(9101,"Save Merge Editor State to Folder"),icon:t8.Codicon.layoutCentered,f1:!0,precondition:lh.ctxIsMergeEditor})}async run(e){let{activeEditorPane:t}=e.get(eQ.IEditorService),i=e.get(oY.INotificationService),o=e.get(eb.IFileDialogService),r=e.get(tl.IFileService),s=e.get(t5.ILanguageService);if(!(t instanceof lw))return void i.info({name:(0,ev.localize)(9098,"Merge Editor"),message:(0,ev.localize)(9099,"No active merge editor")});let n=t.model;if(!n)return;let a=await o.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:(0,ev.localize)(9102,"Select folder to save to")});if(!a)return;let d=a[0],l=s.getExtensions(n.resultTextModel.getLanguageId())[0]||"";async function c(e,t){await r.writeFile(e$.URI.joinPath(d,e+l),lN.VSBuffer.fromString(t),{})}await Promise.all([c("base",n.base.getValue()),c("input1",n.input1.textModel.getValue()),c("input2",n.input2.textModel.getValue()),c("result",n.resultTextModel.getValue()),c("initialResult",n.getInitialResultValue())]),i.info({name:(0,ev.localize)(9098,"Merge Editor"),message:(0,ev.localize)(9103,"Successfully saved merge editor state to folder")})}}class lB extends lG.Action2{constructor(){super({id:"merge.dev.loadContentsFromFolder",category:lF,title:(0,ev.localize2)(9104,"Load Merge Editor State from Folder"),icon:t8.Codicon.layoutCentered,f1:!0})}async run(e,t){let i,o=e.get(eb.IFileDialogService),r=e.get(eQ.IEditorService),s=e.get(tl.IFileService),n=e.get(rM.IQuickInputService);if(t||(t={}),t.folderUri)i=t.folderUri;else{let e=await o.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:(0,ev.localize)(9102,"Select folder to save to")});if(!e)return;i=e[0]}let a=await s.resolve(i);function d(e){return a.children.find(t=>t.name.startsWith(e))?.resource}let l=await lU(n,t.resultState),c=d("base"),h=d("input1"),u=d("input2"),p=d(l?"initialResult":"result");r.openEditor({base:{resource:c},input1:{resource:h,label:"Input 1",description:"Input 1",detail:"(from file)"},input2:{resource:u,label:"Input 2",description:"Input 2",detail:"(from file)"},result:{resource:p}})}}async function lU(e,t){if(t)return"initial"===t;let i=await e.pick([{label:"result",result:!1},{label:"initial result",result:!0}],{canPickMany:!1});return i?.result}var lH=e.i(960948),l$=e.i(947413),lq=e.i(915550),lY=e.i(781080);eO.Registry.as(iV.EditorExtensions.EditorPane).registerEditorPane(e6.EditorPaneDescriptor.create(lw,lw.ID,(0,ev.localize)(9105,"Merge Editor")),[new e4.SyncDescriptor(dv.MergeEditorInput)]),eO.Registry.as(iV.EditorExtensions.EditorFactory).registerEditorSerializer(dv.MergeEditorInput.ID,class{canSerialize(){return!0}serialize(e){return JSON.stringify(this.toJSON(e))}toJSON(e){return{base:e.base,input1:e.input1,input2:e.input2,result:e.result}}deserialize(e,t){try{let i=(0,lH.parse)(t);return e.createInstance(dv.MergeEditorInput,i.base,new dv.MergeEditorInputData(i.input1.uri,i.input1.title,i.input1.detail,i.input1.description),new dv.MergeEditorInputData(i.input2.uri,i.input2.title,i.input2.detail,i.input2.description),i.result)}catch(e){(0,el.onUnexpectedError)(e);return}}}),eO.Registry.as(tr.Extensions.Configuration).registerConfiguration({properties:{"mergeEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:"advanced",markdownEnumDescriptions:[(0,ev.localize)(9106,"Uses the legacy diffing algorithm."),(0,ev.localize)(9107,"Uses the advanced diffing algorithm.")]},"mergeEditor.showDeletionMarkers":{type:"boolean",default:!0,description:"Controls if deletions in base or one of the inputs should be indicated by a vertical bar."}}}),(0,eG.registerAction2)(class extends lE{constructor(){super({id:"merge.openResult",icon:t8.Codicon.goToFile,title:(0,ev.localize2)(9076,"Open File"),category:lP,menu:[{id:dm.MenuId.EditorTitle,when:lh.ctxIsMergeEditor,group:"navigation",order:1}],precondition:lh.ctxIsMergeEditor})}runWithViewModel(e,t){t.get(eQ.IEditorService).openEditor({resource:e.model.resultTextModel.uri})}}),(0,eG.registerAction2)(lx),(0,eG.registerAction2)(lR),(0,eG.registerAction2)(lD),(0,eG.registerAction2)(class extends lE{constructor(){super({id:"merge.openBaseEditor",category:lP,title:(0,ev.localize2)(9084,"Open Base File"),f1:!0,precondition:lh.ctxIsMergeEditor})}runWithViewModel(e,t){t.get(tQ.IOpenerService).open(e.model.base.uri)}}),(0,eG.registerAction2)(lk),(0,eG.registerAction2)(lM),(0,eG.registerAction2)(lL),(0,eG.registerAction2)(lO),(0,eG.registerAction2)(class extends lE{constructor(){super({id:"merge.goToNextUnhandledConflict",category:lP,title:(0,ev.localize2)(9077,"Go to Next Unhandled Conflict"),icon:t8.Codicon.arrowDown,menu:[{id:dm.MenuId.EditorTitle,when:lh.ctxIsMergeEditor,group:"navigation",order:3}],f1:!0,precondition:lh.ctxIsMergeEditor})}runWithViewModel(e){e.model.telemetry.reportNavigationToNextConflict(),e.goToNextModifiedBaseRange(t=>!e.model.isHandled(t).get())}}),(0,eG.registerAction2)(class extends lE{constructor(){super({id:"merge.goToPreviousUnhandledConflict",category:lP,title:(0,ev.localize2)(9078,"Go to Previous Unhandled Conflict"),icon:t8.Codicon.arrowUp,menu:[{id:dm.MenuId.EditorTitle,when:lh.ctxIsMergeEditor,group:"navigation",order:2}],f1:!0,precondition:lh.ctxIsMergeEditor})}runWithViewModel(e){e.model.telemetry.reportNavigationToPreviousConflict(),e.goToPreviousModifiedBaseRange(t=>!e.model.isHandled(t).get())}}),(0,eG.registerAction2)(class extends lE{constructor(){super({id:"merge.toggleActiveConflictInput1",category:lP,title:(0,ev.localize2)(9079,"Toggle Current Conflict from Left"),f1:!0,precondition:lh.ctxIsMergeEditor})}runWithViewModel(e){e.toggleActiveConflict(1)}}),(0,eG.registerAction2)(class extends lE{constructor(){super({id:"merge.toggleActiveConflictInput2",category:lP,title:(0,ev.localize2)(9080,"Toggle Current Conflict from Right"),f1:!0,precondition:lh.ctxIsMergeEditor})}runWithViewModel(e){e.toggleActiveConflict(2)}}),(0,eG.registerAction2)(class extends lE{constructor(){super({id:"mergeEditor.compareInput1WithBase",category:lP,title:(0,ev.localize2)(9081,"Compare Input 1 With Base"),shortTitle:(0,ev.localize)(9082,"Compare With Base"),f1:!0,precondition:lh.ctxIsMergeEditor,menu:{id:dm.MenuId.MergeInput1Toolbar,group:"primary"},icon:t8.Codicon.compareChanges})}runWithViewModel(e,t){lV(e,t.get(eQ.IEditorService),1)}}),(0,eG.registerAction2)(class extends lE{constructor(){super({id:"mergeEditor.compareInput2WithBase",category:lP,title:(0,ev.localize2)(9083,"Compare Input 2 With Base"),shortTitle:(0,ev.localize)(9082,"Compare With Base"),f1:!0,precondition:lh.ctxIsMergeEditor,menu:{id:dm.MenuId.MergeInput2Toolbar,group:"primary"},icon:t8.Codicon.compareChanges})}runWithViewModel(e,t){lV(e,t.get(eQ.IEditorService),2)}}),(0,eG.registerAction2)(class extends lE{constructor(){super({id:"merge.acceptAllInput1",category:lP,title:(0,ev.localize2)(9085,"Accept All Incoming Changes from Left"),f1:!0,precondition:lh.ctxIsMergeEditor,menu:{id:dm.MenuId.MergeInput1Toolbar,group:"primary"},icon:t8.Codicon.checkAll})}runWithViewModel(e){e.acceptAll(1)}}),(0,eG.registerAction2)(class extends lE{constructor(){super({id:"merge.acceptAllInput2",category:lP,title:(0,ev.localize2)(9086,"Accept All Current Changes from Right"),f1:!0,precondition:lh.ctxIsMergeEditor,menu:{id:dm.MenuId.MergeInput2Toolbar,group:"primary"},icon:t8.Codicon.checkAll})}runWithViewModel(e){e.acceptAll(2)}}),(0,eG.registerAction2)(class extends lE{constructor(){super({id:"mergeEditor.resetResultToBaseAndAutoMerge",category:lP,title:(0,ev.localize2)(9087,"Reset Result"),shortTitle:(0,ev.localize)(9088,"Reset"),f1:!0,precondition:lh.ctxIsMergeEditor,menu:{id:dm.MenuId.MergeInputResultToolbar,group:"primary"},icon:t8.Codicon.discard})}runWithViewModel(e,t){e.model.reset()}}),(0,eG.registerAction2)(class extends lI{constructor(){super({id:"mergeEditor.acceptMerge",category:lP,title:(0,ev.localize2)(9091,"Complete Merge"),f1:!0,precondition:lh.ctxIsMergeEditor,keybinding:[{primary:iO.KeyMod.CtrlCmd|iO.KeyCode.Enter,weight:eF.KeybindingWeight.EditorContrib,when:lh.ctxIsMergeEditor}]})}async runWithMergeEditor({inputModel:e,editorIdentifier:t,viewModel:i},o){let r=o.get(eb.IDialogService),s=o.get(eQ.IEditorService);if(i.model.unhandledConflictsCount.get()>0){let{confirmed:t}=await r.confirm({message:(0,ev.localize)(9092,"Do you want to complete the merge of {0}?",(0,t9.basename)(e.resultUri)),detail:(0,ev.localize)(9093,"The file contains unhandled conflicts."),primaryButton:(0,ev.localize)(9094,"&&Complete with Conflicts")});if(!t)return{successful:!1}}return await e.accept(),await s.closeEditor(t),{successful:!0}}}),(0,eG.registerAction2)(lK),(0,eG.registerAction2)(class extends lI{constructor(){super({id:"mergeEditor.acceptAllCombination",category:lP,title:(0,ev.localize2)(9090,"Accept All Combination"),f1:!0})}runWithMergeEditor(e,t){let{viewModel:i}=e,o=i.model.modifiedBaseRanges.get(),r=i.model;return(0,dR.transaction)(e=>{for(let t of o){let o=r.getState(t).get();o.kind===d3.ModifiedBaseRangeStateKind.unrecognized||o.isInputIncluded(1)||o.isInputIncluded(2)&&i.shouldUseAppendInsteadOfAccept.get()||!t.canBeCombined||(r.setState(t,o.withInputValue(1,!0).withInputValue(2,!0,!0),!0,e),r.telemetry.reportSmartCombinationInvoked(o.includesInput(2)))}}),{success:!0}}}),(0,eG.registerAction2)(class extends lI{constructor(){super({id:"mergeEditor.toggleBetweenInputs",category:lP,title:(0,ev.localize2)(9095,"Toggle Between Merge Editor Inputs"),f1:!0,precondition:lh.ctxIsMergeEditor,keybinding:[{primary:iO.KeyMod.CtrlCmd|iO.KeyMod.Shift|iO.KeyCode.KeyT,weight:eF.KeybindingWeight.WorkbenchContrib+10,when:lh.ctxIsMergeEditor}]})}runWithMergeEditor({viewModel:e},t){e.inputCodeEditorView1.editor.hasWidgetFocus()?e.inputCodeEditorView2.editor.focus():e.inputCodeEditorView1.editor.focus()}}),(0,eG.registerAction2)(lW),(0,eG.registerAction2)(lz),(0,eG.registerAction2)(lB),eO.Registry.as(tH.Extensions.Workbench).registerWorkbenchContribution(lS,tV.LifecyclePhase.Restored),(0,tH.registerWorkbenchContribution2)(l_.ID,l_,tH.WorkbenchPhase.BlockStartup),l$.AccessibleViewRegistry.register(new class{constructor(){this.name="mergeEditor",this.type=lq.AccessibleViewType.Help,this.priority=125,this.when=eV.ContextKeyEqualsExpr.create("isMergeEditor",!0)}getProvider(e){let t=e.get(od.ICodeEditorService),i=t.getActiveCodeEditor()||t.getFocusedCodeEditor();if(!i)return;let o=[(0,ev.localize)(9108,"You are in a merge editor."),(0,ev.localize)(9109,"Navigate between merge conflicts using the commands Go to Next Unhandled Conflict{0} and Go to Previous Unhandled Conflict{1}.","<keybinding:merge.goToNextUnhandledConflict>","<keybinding:merge.goToPreviousUnhandledConflict>"),(0,ev.localize)(9110,"Run the command Merge Editor: Accept All Incoming Changes from the Left{0} and Merge Editor: Accept All Current Changes from the Right{1}","<keybinding:merge.acceptAllInput1>","<keybinding:merge.acceptAllInput2>"),(0,ev.localize)(9111,"Complete the Merge{0}.","<keybinding:mergeEditor.acceptMerge>"),(0,ev.localize)(9112,"Toggle between merge editor inputs, incoming and current changes {0}.","<keybinding:mergeEditor.toggleBetweenInputs>")];return new lq.AccessibleContentProvider(lq.AccessibleViewProviderId.MergeEditor,{type:lq.AccessibleViewType.Help},()=>o.join("\n"),()=>i.focus(),lY.AccessibilityVerbositySettingId.MergeEditor)}}),e.s([],739757);var lj=e.i(453364);function lX(e,t){e?.addImplementation(100,"webview",e=>{let i=e.get(s5.IWebviewService).activeWebview;if(i?.isFocused)return t(i),!0;if((0,er.getActiveElement)()?.classList.contains("action-menu-item")){let i=e.get(eQ.IEditorService);if(i.activeEditor instanceof aF.WebviewInput)return t(i.activeEditor.webview),!0}return!1})}lX(on.UndoCommand,e=>e.undo()),lX(on.RedoCommand,e=>e.redo()),lX(on.SelectAllCommand,e=>e.selectAll()),lX(lj.CopyAction,e=>e.copy()),lX(lj.PasteAction,e=>e.paste()),lX(lj.CutAction,e=>e.cut());let lJ="preventDefaultContextMenuItems";lj.CutAction&&eG.MenuRegistry.appendMenuItem(eG.MenuId.WebviewContext,{command:{id:lj.CutAction.id,title:(0,ev.localize)(13155,"Cut")},group:"5_cutcopypaste",order:1,when:eV.ContextKeyExpr.not(lJ)}),lj.CopyAction&&eG.MenuRegistry.appendMenuItem(eG.MenuId.WebviewContext,{command:{id:lj.CopyAction.id,title:(0,ev.localize)(13156,"Copy")},group:"5_cutcopypaste",order:2,when:eV.ContextKeyExpr.not(lJ)}),lj.PasteAction&&eG.MenuRegistry.appendMenuItem(eG.MenuId.WebviewContext,{command:{id:lj.PasteAction.id,title:(0,ev.localize)(13157,"Paste")},group:"5_cutcopypaste",order:3,when:eV.ContextKeyExpr.not(lJ)}),e.s([],647427);var lZ=eu,lQ=e.i(59876);let l0=(0,ev.localize)(8516,"Configure"),l1=class extends lZ.Disposable{constructor(e,t){let i;super();const o=[new l2,new l3].map(e=>new l5(t,e));o.forEach(e=>this._register(e));const r=()=>{let t=e.activeTextEditorControl;if(t===i)return;i=t;let r=(0,tt.getCodeEditor)(t);o.forEach(e=>e.onActiveEditorChanged(r))};this._register(e.onDidActiveEditorChange(r)),r()}};l1=(0,ei.__decorate)([(0,ei.__param)(0,eQ.IEditorService),(0,ei.__param)(1,dn.ILanguageStatusService)],l1);class l2{constructor(){this.id="decoratorsLimitInfo",this.name=(0,ev.localize)(8517,"Color Decorator Status"),this.label=(0,ev.localize)(8518,"Color decorators"),this.source=(0,ev.localize)(8519,"Color Decorators"),this.settingsId="editor.colorDecoratorsLimit"}getLimitReporter(e){return lQ.ColorDetector.get(e)?.limitReporter}}class l3{constructor(){this.id="foldingLimitInfo",this.name=(0,ev.localize)(8520,"Folding Status"),this.label=(0,ev.localize)(8521,"Folding ranges"),this.source=(0,ev.localize)(8522,"Folding"),this.settingsId="editor.foldingMaximumRegions"}getLimitReporter(e){return dP.FoldingController.get(e)?.limitReporter}}class l5{constructor(e,t){this.languageStatusService=e,this.accessor=t}onActiveEditorChanged(e){let t;return this._indicatorChangeListener&&(this._indicatorChangeListener.dispose(),this._indicatorChangeListener=void 0),e&&(t=this.accessor.getLimitReporter(e)),this.updateStatusItem(t),!!t&&(this._indicatorChangeListener=t.onDidChange(e=>{this.updateStatusItem(t)}),!0)}updateStatusItem(e){if(this._limitStatusItem&&(this._limitStatusItem.dispose(),this._limitStatusItem=void 0),e&&!1!==e.limited){let t={id:this.accessor.id,selector:"*",name:this.accessor.name,severity:em.default.Warning,label:this.accessor.label,detail:(0,ev.localize)(8523,"only {0} shown for performance reasons",e.limited),command:{id:"workbench.action.openSettings",arguments:[this.accessor.settingsId],title:l0},accessibilityInfo:void 0,source:this.accessor.source,busy:!1};this._limitStatusItem=this.languageStatusService.addStatus(t)}}dispose(){this._limitStatusItem?.dispose(),this._limitStatusItem=void 0,this._indicatorChangeListener?.dispose(),this._indicatorChangeListener=void 0}}eO.Registry.as(tH.Extensions.Workbench).registerWorkbenchContribution(l1,tV.LifecyclePhase.Restored),e.s([],514244);var l6=eu;let l4=class extends l6.Disposable{static{this.ID="workbench.contrib.sash"}constructor(e){super(),this.configurationService=e,this.styleSheet=(0,es.createStyleSheet)(),ec.Event.filter(e.onDidChangeConfiguration,e=>e.affectsConfiguration("workbench.sash.size"))(this.onDidChangeSize,this,this._store),this.onDidChangeSize(),ec.Event.filter(e.onDidChangeConfiguration,e=>e.affectsConfiguration("workbench.sash.hoverDelay"))(this.onDidChangeHoverDelay,this,this._store),this.onDidChangeHoverDelay()}onDidChangeSize(){let e=this.configurationService.getValue("workbench.sash.size"),t=(0,lm.clamp)(e,4,20),i=(0,lm.clamp)(e,1,8);this.styleSheet.textContent=`
158
+ .monaco-workbench {
159
+ --vscode-sash-size: ${t}px;
160
+ --vscode-sash-hover-size: ${i}px;
161
+ }
162
+ `,(0,oi.setGlobalSashSize)(t)}onDidChangeHoverDelay(){(0,oi.setGlobalHoverDelay)(this.configurationService.getValue("workbench.sash.hoverDelay"))}};l4=(0,ei.__decorate)([(0,ei.__param)(0,ey.IConfigurationService)],l4),(0,tH.registerWorkbenchContribution2)(l4.ID,l4,tH.WorkbenchPhase.AfterRestored),eO.Registry.as(tr.Extensions.Configuration).registerConfiguration({...aw.workbenchConfigurationNodeBase,properties:{"workbench.sash.size":{type:"number",default:eg.isIOS?20:4,minimum:1,maximum:20,description:(0,ev.localize)(10434,"Controls the feedback area size in pixels of the dragging area in between views/editors. Set it to a larger value if you feel it's hard to resize views using the mouse.")},"workbench.sash.hoverDelay":{type:"number",default:300,minimum:0,maximum:2e3,description:(0,ev.localize)(10435,"Controls the hover feedback delay in milliseconds of the dragging area in between views/editors.")}}}),e.s([],993056);var l9=eu,l8=e.i(434566),l7=e.i(317679);new eV.RawContextKey("inPreferencesSearch",!1),new eV.RawContextKey("inSettingsEditor",!1),new eV.RawContextKey("inSettingsJSONEditor",!1),new eV.RawContextKey("inSettingsSearch",!1),new eV.RawContextKey("settingsTocRowFocus",!1),new eV.RawContextKey("settingRowFocus",!1),new eV.RawContextKey("inKeybindings",!1),new eV.RawContextKey("inKeybindingsSearch",!1),new eV.RawContextKey("keybindingsSearchHasValue",!1),new eV.RawContextKey("keybindingFocus",!1),new eV.RawContextKey("whenFocus",!1),new eV.RawContextKey("aiSettingResultsAvailable",!1);let ce="workbench.action.openKeyboardLayoutPicker";(u=Q||(Q={})).ShowAISearchToggle="workbench.settings.showAISearchToggle",u.EnableNaturalLanguageSearch="workbench.settings.enableNaturalLanguageSearch",(0,ev.localize)(10145,"Preview setting: this setting controls a new feature that is still under refinement yet ready to use. Feedback is welcome."),(0,ev.localize)(10146,"Experimental setting: this setting controls a new feature that is actively being developed and may be unstable. It is subject to change or removal."),(0,ev.localize)(10147,"Advanced setting: this setting is intended for advanced scenarios and configurations. Only modify this if you know what it does.");let ct=new Set;["css","html","scss","less","json","js","ts","ie","id","php","scm"].forEach(e=>ct.add(e));let ci=new Map;ci.set("power shell","PowerShell"),ci.set("powershell","PowerShell"),ci.set("javascript","JavaScript"),ci.set("typescript","TypeScript"),ci.set("github","GitHub"),ci.set("jet brains","JetBrains"),ci.set("jetbrains","JetBrains"),ci.set("re sharper","ReSharper"),ci.set("resharper","ReSharper");var co=eG,cr=e.i(253642);let cs=class extends l9.Disposable{static{this.ID="workbench.contrib.keyboardLayoutPicker"}constructor(e,t){super(),this.keyboardLayoutService=e,this.statusbarService=t,this.pickerElement=this._register(new l9.MutableDisposable);const i=(0,ev.localize)(9874,"Keyboard Layout"),o=this.keyboardLayoutService.getCurrentKeyboardLayout();if(o){const e=(0,l8.parseKeyboardLayoutDescription)(o),t=(0,ev.localize)(9875,"Layout: {0}",e.label);this.pickerElement.value=this.statusbarService.addEntry({name:i,text:t,ariaLabel:t,command:ce},"status.workbench.keyboardLayout",sN.StatusbarAlignment.RIGHT)}this._register(this.keyboardLayoutService.onDidChangeKeyboardLayout(()=>{let e=this.keyboardLayoutService.getCurrentKeyboardLayout(),t=(0,l8.parseKeyboardLayoutDescription)(e);if(this.pickerElement.value){let e=(0,ev.localize)(9875,"Layout: {0}",t.label);this.pickerElement.value.update({name:i,text:e,ariaLabel:e,command:ce})}else{let e=(0,ev.localize)(9875,"Layout: {0}",t.label);this.pickerElement.value=this.statusbarService.addEntry({name:i,text:e,ariaLabel:e,command:ce},"status.workbench.keyboardLayout",sN.StatusbarAlignment.RIGHT)}}))}};cs=(0,ei.__decorate)([(0,ei.__param)(0,l7.IKeyboardLayoutService),(0,ei.__param)(1,sG.IStatusbarService)],cs),(0,tH.registerWorkbenchContribution2)(cs.ID,cs,tH.WorkbenchPhase.BlockStartup);let cn=`// ${(0,ev.localize)(9876,"Defines the keyboard layout used in VS Code in the browser environment.")}
163
+ // ${(0,ev.localize)(9877,'Open VS Code and run "Developer: Inspect Key Mappings (JSON)" from Command Palette.')}
164
+
165
+ // Once you have the keyboard layout info, please paste it below.
166
+
167
+ `;(0,co.registerAction2)(class extends co.Action2{constructor(){super({id:ce,title:(0,ev.localize2)(9878,"Change Keyboard Layout"),f1:!0})}async run(e){let t=e.get(l7.IKeyboardLayoutService),i=e.get(rM.IQuickInputService),o=e.get(ey.IConfigurationService),r=e.get(cr.IEnvironmentService),s=e.get(eQ.IEditorService),n=e.get(tl.IFileService),a=t.getAllKeyboardLayouts(),d=t.getCurrentKeyboardLayout(),l="autodetect"===o.getValue("keyboard.layout"),c=a.map(e=>{let t=!l&&(0,l8.areKeyboardLayoutsEqual)(d,e),i=(0,l8.parseKeyboardLayoutDescription)(e);return{layout:e,label:[i.label,e&&e.isUserKeyboardLayout?"(User configured layout)":""].join(" "),id:e.text||e.lang||e.layout,description:i.description+(t?" (Current layout)":""),picked:!l&&(0,l8.areKeyboardLayoutsEqual)(d,e)}}).sort((e,t)=>e.label<t.label?-1:+(e.label>t.label));if(c.length>0){let e=eg.isMacintosh?"Mac":eg.isWindows?"Win":"Linux";c.unshift({type:"separator",label:(0,ev.localize)(9879,"Keyboard Layouts ({0})",e)})}let h={label:(0,ev.localize)(9880,"Configure Keyboard Layout")};c.unshift(h);let u={label:(0,ev.localize)(9881,"Auto Detect"),description:l?`Current: ${(0,l8.parseKeyboardLayoutDescription)(d).label}`:void 0,picked:!!l||void 0};c.unshift(u);let p=await i.pick(c,{placeHolder:(0,ev.localize)(9882,"Select Keyboard Layout"),matchOnDescription:!0});if(p){if(p===u)return void o.updateValue("keyboard.layout","autodetect");if(p===h){let e=r.keyboardLayoutResource;return await n.stat(e).then(void 0,()=>n.createFile(e,lN.VSBuffer.fromString(cn))).then(e=>{if(e)return s.openEditor({resource:e.resource,languageId:"jsonc",options:{pinned:!0}})},t=>{throw Error((0,ev.localize)(9883,"Unable to create '{0}' ({1}).",e.toString(),t))}),Promise.resolve()}o.updateValue("keyboard.layout",(0,l8.getKeyboardLayoutId)(p.layout))}}}),e.s([],101398);var ca=e.i(771275),cd=eu;let cl=class extends cd.Disposable{static{this.ID="workbench.contrib.dirtyFilesIndicator"}constructor(e,t,i){super(),this.activityService=e,this.workingCopyService=t,this.filesConfigurationService=i,this.badgeHandle=this._register(new cd.MutableDisposable),this.lastKnownDirtyCount=0,this.updateActivityBadge(),this.registerListeners()}registerListeners(){this._register(this.workingCopyService.onDidChangeDirty(e=>this.onWorkingCopyDidChangeDirty(e)))}onWorkingCopyDidChangeDirty(e){let t=e.isDirty();!(t&&!(e.capabilities&ag.WorkingCopyCapabilities.Untitled)&&this.filesConfigurationService.hasShortAutoSaveDelay(e.resource))&&(t||this.lastKnownDirtyCount>0)&&this.updateActivityBadge()}updateActivityBadge(){let e=this.lastKnownDirtyCount=this.workingCopyService.dirtyCount;e>0?this.badgeHandle.value=this.activityService.showViewContainerActivity(rD.VIEWLET_ID,{badge:new o0.NumberBadge(e,t=>1===t?(0,ev.localize)(8257,"1 unsaved file"):(0,ev.localize)(8258,"{0} unsaved files",e))}):this.badgeHandle.clear()}};cl=(0,ei.__decorate)([(0,ei.__param)(0,o1.IActivityService),(0,ei.__param)(1,tN.IWorkingCopyService),(0,ei.__param)(2,au.IFilesConfigurationService)],cl);var cc=e.i(437030),ch=e.i(16046);let cu=class extends nx{static{ee=this}static{this.ID=rD.BINARY_FILE_EDITOR_ID}constructor(e,t,i,o,r){super(ee.ID,e,{openInternal:(e,t)=>this.openInternal(e,t)},t,i,r),this.editorResolverService=o}async openInternal(e,t){if(e instanceof cc.FileEditorInput&&this.group.activeEditor){let i=this.group.activeEditor,o=i?.toUntyped();if(!o)return;let r=await this.editorResolverService.resolveEditor({...o,options:{...t,override:ch.EditorResolution.PICK}},this.group);if(r===af.ResolvedStatus.NONE)r=void 0;else if(r===af.ResolvedStatus.ABORT)return;if((0,iV.isEditorInputWithOptions)(r))for(let e of r.editor instanceof nE.DiffEditorInput?[r.editor.original,r.editor.modified]:[r.editor])e instanceof cc.FileEditorInput&&(e.setForceOpenAsText(),e.setPreferredLanguageId(rD.BINARY_TEXT_FILE_MODE));await this.group.replaceEditors([{editor:i,replacement:r?.editor??e,options:{...r?.options??t}}])}}getTitle(){return this.input?this.input.getName():(0,ev.localize)(7891,"Binary File Viewer")}};cu=ee=(0,ei.__decorate)([(0,ei.__param)(1,ew.ITelemetryService),(0,ei.__param)(2,eW.IThemeService),(0,ei.__param)(3,aS.IEditorResolverService),(0,ei.__param)(4,eP.IStorageService)],cu);var cp=eu;let cg=class extends cp.Disposable{static{this.ID="workbench.contrib.fileEditorWorkingCopyEditorHandler"}constructor(e,t,i){super(),this.textEditorService=t,this.fileService=i,this._register(e.registerHandler(this))}handles(e){return e.typeId===ag.NO_TYPE_ID&&this.fileService.canHandleResource(e.resource)}handlesSync(e){return e.typeId===ag.NO_TYPE_ID&&this.fileService.hasProvider(e.resource)}isOpen(e,t){return!!this.handlesSync(e)&&(0,t9.isEqual)(e.resource,t.resource)}createEditor(e){return this.textEditorService.createTextEditor({resource:e.resource,forceFile:!0})}};cg=(0,ei.__decorate)([(0,ei.__param)(0,am.IWorkingCopyEditorService),(0,ei.__param)(1,ah.ITextEditorService),(0,ei.__param)(2,tl.IFileService)],cg);var cm=e.i(474320),cv=e.i(867227);let cy=class extends nb{static{et=this}static{this.ID=rD.TEXT_FILE_EDITOR_ID}constructor(e,t,i,o,r,s,n,a,d,l,c,h,u,p,g,m,v,y,C){super(et.ID,e,t,r,n,a,l,d,c,i),this.paneCompositeService=o,this.contextService=s,this.textFileService=h,this.explorerService=u,this.uriIdentityService=p,this.pathService=g,this.configurationService=m,this.preferencesService=v,this.hostService=y,this.filesConfigurationService=C,this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.fileService.onDidRunOperation(e=>this.onDidRunOperation(e)))}onDidFilesChange(e){for(let t of e.rawDeleted)this.clearEditorViewState(t)}onDidRunOperation(e){e.operation===td.FileOperation.MOVE&&e.target&&this.moveEditorViewState(e.resource,e.target.resource,this.uriIdentityService.extUri)}getTitle(){return this.input?this.input.getName():(0,ev.localize)(7892,"Text File Editor")}get input(){return this._input}async setInput(e,t,i,o){(0,ep.mark)("code/willSetInputToTextFileEditor"),await super.setInput(e,t,i,o);try{let r=await e.resolve(t);if(o.isCancellationRequested)return;if(r instanceof nT.BinaryEditorModel)return this.openAsBinary(e,t);let s=(0,eN.assertReturnsDefined)(this.editorControl);if(s.setModel(r.textEditorModel),!(0,iV.isTextEditorViewState)(t?.viewState)){let o=this.loadEditorViewState(e,i);o&&(t?.selection&&(o.cursorState=[]),s.restoreViewState(o))}t&&(0,np.applyTextEditorOptions)(t,s,i$.ScrollType.Immediate),s.updateOptions(this.getReadonlyConfiguration(r.isReadonly())),s.handleInitialized&&s.handleInitialized()}catch(i){await this.handleSetInputError(i,e,t)}(0,ep.mark)("code/didSetInputToTextFileEditor")}async handleSetInputError(e,t,i){if(e.textFileOperationResult===nK.TextFileOperationResult.FILE_IS_BINARY)return this.openAsBinary(t,i);if(e.fileOperationResult===td.FileOperationResult.FILE_IS_DIRECTORY){let e=[];throw e.push((0,oN.toAction)({id:"workbench.files.action.openFolder",label:(0,ev.localize)(7893,"Open Folder"),run:async()=>this.hostService.openWindow([{folderUri:t.resource}],{forceNewWindow:!0})})),this.contextService.isInsideWorkspace(t.preferredResource)&&e.push((0,oN.toAction)({id:"workbench.files.action.reveal",label:(0,ev.localize)(7894,"Reveal Folder"),run:async()=>(await this.paneCompositeService.openPaneComposite(rD.VIEWLET_ID,ek.ViewContainerLocation.Sidebar,!0),this.explorerService.select(t.preferredResource,!0))})),(0,iV.createEditorOpenError)((0,ev.localize)(7895,"The file is not displayed in the text editor because it is a directory."),e,{forceMessage:!0})}if(e.fileOperationResult===td.FileOperationResult.FILE_TOO_LARGE){let o;throw o=e instanceof td.TooLargeFileOperationError?(0,ev.localize)(7896,"The file is not displayed in the text editor because it is very large ({0}).",td.ByteSize.formatSize(e.size)):(0,ev.localize)(7897,"The file is not displayed in the text editor because it is very large."),(0,iV.createTooLargeFileError)(this.group,t,i,o,this.preferencesService)}if(e.fileOperationResult===td.FileOperationResult.FILE_NOT_FOUND&&!this.filesConfigurationService.isReadonly(t.preferredResource)&&await this.pathService.hasValidBasename(t.preferredResource))throw(0,iV.createEditorOpenError)(new td.FileOperationError((0,ev.localize)(7898,"The editor could not be opened because the file was not found."),td.FileOperationResult.FILE_NOT_FOUND),[(0,oN.toAction)({id:"workbench.files.action.createMissingFile",label:(0,ev.localize)(7899,"Create File"),run:async()=>(await this.textFileService.create([{resource:t.preferredResource}]),this.editorService.openEditor({resource:t.preferredResource,options:{pinned:!0}}))})],{allowDialog:!0});throw e}openAsBinary(e,t){let i=this.configurationService.getValue("workbench.editor.defaultBinaryEditor"),o={...t,activation:ch.EditorActivation.PRESERVE};i&&""!==i&&i!==iV.DEFAULT_EDITOR_ASSOCIATION.id?this.doOpenAsBinaryInDifferentEditor(this.group,i,e,o):this.doOpenAsBinaryInSameEditor(this.group,i,e,o)}doOpenAsBinaryInDifferentEditor(e,t,i,o){this.editorService.replaceEditors([{editor:i,replacement:{resource:i.resource,options:{...o,override:t}}}],e)}doOpenAsBinaryInSameEditor(e,t,i,o){t===iV.DEFAULT_EDITOR_ASSOCIATION.id?(i.setForceOpenAsText(),i.setPreferredLanguageId(rD.BINARY_TEXT_FILE_MODE),o={...o,forceReload:!0}):i.setForceOpenAsBinary(),e.openEditor(i,o)}clearInput(){super.clearInput(),this.editorControl?.setModel(null)}createEditorControl(e,t){(0,ep.mark)("code/willCreateTextFileEditorControl"),super.createEditorControl(e,t),(0,ep.mark)("code/didCreateTextFileEditorControl")}tracksEditorViewState(e){return e instanceof cc.FileEditorInput}tracksDisposedEditorViewState(){return!0}};cy=et=(0,ei.__decorate)([(0,ei.__param)(1,ew.ITelemetryService),(0,ei.__param)(2,tl.IFileService),(0,ei.__param)(3,eZ.IPaneCompositePartService),(0,ei.__param)(4,eD.IInstantiationService),(0,ei.__param)(5,eB.IWorkspaceContextService),(0,ei.__param)(6,eP.IStorageService),(0,ei.__param)(7,nw.ITextResourceConfigurationService),(0,ei.__param)(8,eQ.IEditorService),(0,ei.__param)(9,eW.IThemeService),(0,ei.__param)(10,eY.IEditorGroupsService),(0,ei.__param)(11,tu.ITextFileService),(0,ei.__param)(12,cv.IExplorerService),(0,ei.__param)(13,cm.IUriIdentityService),(0,ei.__param)(14,ap.IPathService),(0,ei.__param)(15,ey.IConfigurationService),(0,ei.__param)(16,s$.IPreferencesService),(0,ei.__param)(17,eE.IHostService),(0,ei.__param)(18,au.IFilesConfigurationService)],cy);var cC=eu;let cb=class extends cC.Disposable{static{this.ID="workbench.contrib.textFileEditorTracker"}constructor(e,t,i,o,r,s,n){super(),this.editorService=e,this.textFileService=t,this.lifecycleService=i,this.hostService=o,this.codeEditorService=r,this.filesConfigurationService=s,this.workingCopyEditorService=n,this.ensureDirtyFilesAreOpenedWorker=this._register(new ed.RunOnceWorker(e=>this.ensureDirtyTextFilesAreOpened(e),this.getDirtyTextFileTrackerDelay())),this.registerListeners()}registerListeners(){this._register(this.textFileService.files.onDidChangeDirty(e=>this.ensureDirtyFilesAreOpenedWorker.work(e.resource))),this._register(this.textFileService.files.onDidSaveError(e=>this.ensureDirtyFilesAreOpenedWorker.work(e.resource))),this._register(this.textFileService.untitled.onDidChangeDirty(e=>this.ensureDirtyFilesAreOpenedWorker.work(e.resource))),this._register(this.hostService.onDidChangeFocus(e=>e?this.reloadVisibleTextFileEditors():void 0)),this._register(this.lifecycleService.onDidShutdown(()=>this.dispose()))}getDirtyTextFileTrackerDelay(){return 800}ensureDirtyTextFilesAreOpened(e){this.doEnsureDirtyTextFilesAreOpened((0,ea.distinct)(e.filter(e=>{if(!this.textFileService.isDirty(e))return!1;let t=this.textFileService.files.get(e);if(t?.hasState(nK.TextFileEditorModelState.PENDING_SAVE)||e.scheme!==tp.Schemas.untitled&&!t?.hasState(nK.TextFileEditorModelState.ERROR)&&this.filesConfigurationService.hasShortAutoSaveDelay(e)||this.editorService.isOpened({resource:e,typeId:e.scheme===tp.Schemas.untitled?nv.UntitledTextEditorInput.ID:rD.FILE_EDITOR_INPUT_ID,editorId:iV.DEFAULT_EDITOR_ASSOCIATION.id}))return!1;let i=t??this.textFileService.untitled.get(e);return!(i&&this.workingCopyEditorService.findEditor(i))}),e=>e.toString()))}doEnsureDirtyTextFilesAreOpened(e){e.length&&this.editorService.openEditors(e.map(e=>({resource:e,options:{inactive:!0,pinned:!0,preserveFocus:!0}})))}reloadVisibleTextFileEditors(){(0,ea.distinct)((0,ea.coalesce)(this.codeEditorService.listCodeEditors().map(e=>{let t=e.getModel()?.uri;if(!t)return;let i=this.textFileService.files.get(t);if(!(!i||i.isDirty())&&i.isResolved())return i})),e=>e.resource.toString()).forEach(e=>this.textFileService.files.resolve(e.resource,{reload:{async:!0}}))}};cb=(0,ei.__decorate)([(0,ei.__param)(0,eQ.IEditorService),(0,ei.__param)(1,tu.ITextFileService),(0,ei.__param)(2,tK.ILifecycleService),(0,ei.__param)(3,eE.IHostService),(0,ei.__param)(4,od.ICodeEditorService),(0,ei.__param)(5,au.IFilesConfigurationService),(0,ei.__param)(6,am.IWorkingCopyEditorService)],cb);var cw=e.i(431110),cf=oN,cS=eu,c_=e.i(427505),cE=e.i(347589);let cI="conflictResolution",cD="learnMoreDirtyWriteError",cT=(0,ev.localize)(7900,"Use the actions in the editor tool bar to either undo your changes or overwrite the content of the file with your changes."),cA=class extends cS.Disposable{static{this.ID="workbench.contrib.textFileSaveErrorHandler"}constructor(e,t,i,o,r,s,n){super(),this.notificationService=e,this.textFileService=t,this.editorService=o,this.instantiationService=s,this.storageService=n,this.messages=new te.ResourceMap,this.activeConflictResolutionResource=void 0,this.conflictResolutionContext=new eV.RawContextKey("saveConflictResolutionContext",!1,!0).bindTo(i);const a=this._register(s.createInstance(rD.TextFileContentProvider));this._register(r.registerTextModelContentProvider(cI,a)),this.textFileService.files.saveErrorHandler=this,this.registerListeners()}registerListeners(){this._register(this.textFileService.files.onDidSave(e=>this.onFileSavedOrReverted(e.model.resource))),this._register(this.textFileService.files.onDidRevert(e=>this.onFileSavedOrReverted(e.resource))),this._register(this.editorService.onDidActiveEditorChange(()=>this.onActiveEditorChanged()))}onActiveEditorChanged(){let e,t=!1,i=this.editorService.activeEditor;if(i instanceof nE.DiffEditorInput){let o=i.original.resource;o?.scheme===cI&&(t=!0,e=i.modified.resource)}this.conflictResolutionContext.set(t),this.activeConflictResolutionResource=e}onFileSavedOrReverted(e){let t=this.messages.get(e);t&&(t.close(),this.messages.delete(e))}onSaveError(e,t,i){let o,r=t.resource,s=[],n=[];if(e.fileOperationResult===td.FileOperationResult.FILE_MODIFIED_SINCE)if(this.activeConflictResolutionResource&&(0,t9.isEqual)(this.activeConflictResolutionResource,t.resource)){if(this.storageService.getBoolean(cD,t0.StorageScope.APPLICATION))return;o=cT,s.push(this.instantiationService.createInstance(cR)),n.push(this.instantiationService.createInstance(ck))}else o=(0,ev.localize)(7901,"Failed to save '{0}': The content of the file is newer. Please compare your version with the file contents or overwrite the content of the file with your changes.",(0,t9.basename)(r)),s.push(this.instantiationService.createInstance(cM,t)),s.push(this.instantiationService.createInstance(cN,t,i)),n.push(this.instantiationService.createInstance(cG));else{let n=e.fileOperationResult===td.FileOperationResult.FILE_WRITE_LOCKED,a=n&&e.options?.unlock,d=e.fileOperationResult===td.FileOperationResult.FILE_PERMISSION_DENIED,l=r.scheme===tp.Schemas.file;l&&(d||a)?s.push(this.instantiationService.createInstance(cL,t,i,!!a)):n?s.push(this.instantiationService.createInstance(cK,t,i)):s.push(this.instantiationService.createInstance(cO,t,i)),s.push(this.instantiationService.createInstance(cV,t)),s.push(this.instantiationService.createInstance(cP,t)),o=n?a&&l?eg.isWindows?(0,ev.localize)(7902,"Failed to save '{0}': File is read-only. Select 'Overwrite as Admin' to retry as administrator.",(0,t9.basename)(r)):(0,ev.localize)(7903,"Failed to save '{0}': File is read-only. Select 'Overwrite as Sudo' to retry as superuser.",(0,t9.basename)(r)):(0,ev.localize)(7904,"Failed to save '{0}': File is read-only. Select 'Overwrite' to attempt to make it writeable.",(0,t9.basename)(r)):l&&d?eg.isWindows?(0,ev.localize)(7905,"Failed to save '{0}': Insufficient permissions. Select 'Retry as Admin' to retry as administrator.",(0,t9.basename)(r)):(0,ev.localize)(7906,"Failed to save '{0}': Insufficient permissions. Select 'Retry as Sudo' to retry as superuser.",(0,t9.basename)(r)):(0,ev.localize)(7907,"Failed to save '{0}': {1}",(0,t9.basename)(r),(0,cw.toErrorMessage)(e,!1))}let a=this.notificationService.notify({id:`${(0,d0.hash)(t.resource.toString())}`,severity:em.default.Error,message:o,actions:{primary:s,secondary:n}});ec.Event.once(a.onDidClose)(()=>{(0,cS.dispose)(s),(0,cS.dispose)(n)}),this.messages.set(t.resource,a)}dispose(){super.dispose(),this.messages.clear()}};cA=(0,ei.__decorate)([(0,ei.__param)(0,oY.INotificationService),(0,ei.__param)(1,tu.ITextFileService),(0,ei.__param)(2,eK.IContextKeyService),(0,ei.__param)(3,eQ.IEditorService),(0,ei.__param)(4,tT.ITextModelService),(0,ei.__param)(5,eD.IInstantiationService),(0,ei.__param)(6,eP.IStorageService)],cA);let cx=[],cR=class extends cf.Action{constructor(e){super("workbench.files.action.resolveConflictLearnMore",(0,ev.localize)(7908,"Learn More")),this.openerService=e}async run(){await this.openerService.open(e$.URI.parse("https://go.microsoft.com/fwlink/?linkid=868264"))}};cR=(0,ei.__decorate)([(0,ei.__param)(0,tQ.IOpenerService)],cR);let ck=class extends cf.Action{constructor(e){super("workbench.files.action.resolveConflictLearnMoreDoNotShowAgain",(0,ev.localize)(7909,"Don't Show Again")),this.storageService=e}async run(e){this.storageService.store(cD,!0,t0.StorageScope.APPLICATION,t0.StorageTarget.USER),e.dispose()}};ck=(0,ei.__decorate)([(0,ei.__param)(0,eP.IStorageService)],ck);let cM=class extends cf.Action{constructor(e,t,i,o,r){super("workbench.files.action.resolveConflict",(0,ev.localize)(7910,"Compare")),this.model=e,this.editorService=t,this.notificationService=i,this.instantiationService=o,this.productService=r}async run(){if(!this.model.isDisposed()){let e=this.model.resource,t=(0,t9.basename)(e),i=(0,ev.localize)(7911,"{0} (in file) ↔ {1} (in {2}) - Resolve save conflict",t,t,this.productService.nameLong);await rD.TextFileContentProvider.open(e,cI,i,this.editorService,{pinned:!0});let o={primary:[this.instantiationService.createInstance(cR)]},r=this.notificationService.notify({id:`${(0,d0.hash)(e.toString())}`,severity:em.default.Info,message:cT,actions:o,neverShowAgain:{id:cD,isSecondary:!0}});ec.Event.once(r.onDidClose)(()=>(0,cS.dispose)(o.primary)),cx.push(r)}}};cM=(0,ei.__decorate)([(0,ei.__param)(1,eQ.IEditorService),(0,ei.__param)(2,oY.INotificationService),(0,ei.__param)(3,eD.IInstantiationService),(0,ei.__param)(4,cE.IProductService)],cM);class cL extends cf.Action{constructor(e,t,i){super("workbench.files.action.saveModelElevated",i?eg.isWindows?(0,ev.localize)(7912,"Overwrite as Admin..."):(0,ev.localize)(7913,"Overwrite as Sudo..."):eg.isWindows?(0,ev.localize)(7914,"Retry as Admin..."):(0,ev.localize)(7915,"Retry as Sudo...")),this.model=e,this.options=t,this.triedToUnlock=i}async run(){this.model.isDisposed()||await this.model.save({...this.options,writeElevated:!0,writeUnlock:this.triedToUnlock,reason:iV.SaveReason.EXPLICIT})}}class cO extends cf.Action{constructor(e,t){super("workbench.files.action.saveModel",(0,ev.localize)(7916,"Retry")),this.model=e,this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,reason:iV.SaveReason.EXPLICIT})}}class cP extends cf.Action{constructor(e){super("workbench.files.action.revertModel",(0,ev.localize)(7917,"Revert")),this.model=e}async run(){this.model.isDisposed()||await this.model.revert()}}let cV=class extends cf.Action{constructor(e,t){super("workbench.files.action.saveModelAs",c_.SAVE_FILE_AS_LABEL.value),this.model=e,this.editorService=t}async run(){if(!this.model.isDisposed()){let e=this.findEditor();e&&await this.editorService.save(e,{saveAs:!0,reason:iV.SaveReason.EXPLICIT})}}findEditor(){let e;for(let t of this.editorService.findEditors(this.model.resource,{supportSideBySide:iV.SideBySideEditor.PRIMARY}))if(t.editor instanceof cc.FileEditorInput){e=t;break}else e||(e=t);return e}};cV=(0,ei.__decorate)([(0,ei.__param)(1,eQ.IEditorService)],cV);class cK extends cf.Action{constructor(e,t){super("workbench.files.action.unlock",(0,ev.localize)(7918,"Overwrite")),this.model=e,this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,writeUnlock:!0,reason:iV.SaveReason.EXPLICIT})}}class cN extends cf.Action{constructor(e,t){super("workbench.files.action.saveIgnoreModifiedSince",(0,ev.localize)(7918,"Overwrite")),this.model=e,this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,ignoreModifiedSince:!0,reason:iV.SaveReason.EXPLICIT})}}let cG=class extends cf.Action{constructor(e){super("workbench.files.action.configureSaveConflict",(0,ev.localize)(7919,"Configure")),this.preferencesService=e}async run(){this.preferencesService.openSettings({query:"files.saveConflictResolution"})}};cG=(0,ei.__decorate)([(0,ei.__param)(0,s$.IPreferencesService)],cG),e.i(769083);var cF=eu;let cW=class extends cF.Disposable{static{this.ID="workbench.contrib.workspaceWatcher"}constructor(e,t,i,o,r,s,n,a){super(),this.fileService=e,this.configurationService=t,this.contextService=i,this.notificationService=o,this.openerService=r,this.uriIdentityService=s,this.hostService=n,this.telemetryService=a,this.watchedWorkspaces=new te.ResourceMap(e=>this.uriIdentityService.extUri.getComparisonKey(e)),this.registerListeners(),this.refresh()}registerListeners(){this._register(this.contextService.onDidChangeWorkspaceFolders(e=>this.onDidChangeWorkspaceFolders(e))),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onDidChangeWorkbenchState())),this._register(this.configurationService.onDidChangeConfiguration(e=>this.onDidChangeConfiguration(e))),this._register(this.fileService.onDidWatchError(e=>this.onDidWatchError(e)))}onDidChangeWorkspaceFolders(e){for(let t of e.removed)this.unwatchWorkspace(t);for(let t of e.added)this.watchWorkspace(t)}onDidChangeWorkbenchState(){this.refresh()}onDidChangeConfiguration(e){(e.affectsConfiguration("files.watcherExclude")||e.affectsConfiguration("files.watcherInclude"))&&this.refresh()}onDidWatchError(e){let t,i=e.toString();i.indexOf("ENOSPC")>=0?(t="ENOSPC",this.notificationService.prompt(em.default.Warning,(0,ev.localize)(8253,"Unable to watch for file changes. Please follow the instructions link to resolve this issue."),[{label:(0,ev.localize)(8254,"Instructions"),run:()=>this.openerService.open(e$.URI.parse("https://go.microsoft.com/fwlink/?linkid=867693"))}],{sticky:!0,neverShowAgain:{id:"ignoreEnospcError",isSecondary:!0,scope:rP.NeverShowAgainScope.WORKSPACE}})):i.indexOf("EUNKNOWN")>=0?(t="EUNKNOWN",this.notificationService.prompt(em.default.Warning,(0,ev.localize)(8255,"File changes watcher stopped unexpectedly. A reload of the window may enable the watcher again unless the workspace cannot be watched for file changes."),[{label:(0,ev.localize)(8256,"Reload"),run:()=>this.hostService.reload()}],{sticky:!0,priority:rP.NotificationPriority.SILENT})):i.indexOf("ETERM")>=0&&(t="ETERM"),t&&this.telemetryService.publicLog2("fileWatcherError",{reason:t})}watchWorkspace(e){let t=[],i=this.configurationService.getValue({resource:e.uri});if(i.files?.watcherExclude)for(let e in i.files.watcherExclude)e&&!0===i.files.watcherExclude[e]&&t.push(e);let o=new te.ResourceMap(e=>this.uriIdentityService.extUri.getComparisonKey(e));if(o.set(e.uri,e.uri),i.files?.watcherInclude){for(let t of i.files.watcherInclude)if(t)if((0,ca.isAbsolute)(t)){let i=e$.URI.file(t).with({scheme:e.uri.scheme});this.uriIdentityService.extUri.isEqualOrParent(i,e.uri)&&o.set(i,i)}else{let i=e.toResource(t);o.set(i,i)}}let r=new cF.DisposableStore;for(let[,e]of o)r.add(this.fileService.watch(e,{recursive:!0,excludes:t}));this.watchedWorkspaces.set(e.uri,r)}unwatchWorkspace(e){this.watchedWorkspaces.has(e.uri)&&((0,cF.dispose)(this.watchedWorkspaces.get(e.uri)),this.watchedWorkspaces.delete(e.uri))}refresh(){for(let e of(this.unwatchWorkspaces(),this.contextService.getWorkspace().folders))this.watchWorkspace(e)}unwatchWorkspaces(){for(let[,e]of this.watchedWorkspaces)e.dispose();this.watchedWorkspaces.clear()}dispose(){super.dispose(),this.unwatchWorkspaces()}};cW=(0,ei.__decorate)([(0,ei.__param)(0,tl.IFileService),(0,ei.__param)(1,ey.IConfigurationService),(0,ei.__param)(2,eB.IWorkspaceContextService),(0,ei.__param)(3,oY.INotificationService),(0,ei.__param)(4,tQ.IOpenerService),(0,ei.__param)(5,cm.IUriIdentityService),(0,ei.__param)(6,eE.IHostService),(0,ei.__param)(7,ew.ITelemetryService)],cW);let cz=class{static{this.ID="workbench.contrib.fileUriLabel"}constructor(e){e.registerFormatter({scheme:tp.Schemas.file,formatting:{label:"${authority}${path}",separator:ca.sep,tildify:!eg.isWindows,normalizeDriveLetter:eg.isWindows,authorityPrefix:ca.sep+ca.sep,workspaceSuffix:""}})}};cz=(0,ei.__decorate)([(0,ei.__param)(0,tJ.ILabelService)],cz),eO.Registry.as(iV.EditorExtensions.EditorPane).registerEditorPane(e6.EditorPaneDescriptor.create(cy,cy.ID,(0,ev.localize)(8159,"Text File Editor")),[new e4.SyncDescriptor(cc.FileEditorInput)]),eO.Registry.as(iV.EditorExtensions.EditorPane).registerEditorPane(e6.EditorPaneDescriptor.create(cu,cu.ID,(0,ev.localize)(8160,"Binary File Editor")),[new e4.SyncDescriptor(cc.FileEditorInput)]),eO.Registry.as(iV.EditorExtensions.EditorFactory).registerEditorSerializer(rD.FILE_EDITOR_INPUT_ID,class{canSerialize(e){return!0}serialize(e){let t=e.resource,i=e.preferredResource;return JSON.stringify({resourceJSON:t.toJSON(),preferredResourceJSON:(0,t9.isEqual)(t,i)?void 0:i,name:e.getPreferredName(),description:e.getPreferredDescription(),encoding:e.getEncoding(),modeId:e.getPreferredLanguageId()})}deserialize(e,t){return e.invokeFunction(e=>{let i=JSON.parse(t),o=e$.URI.revive(i.resourceJSON),r=e$.URI.revive(i.preferredResourceJSON),s=i.name,n=i.description,a=i.encoding,d=i.modeId,l=e.get(ah.ITextEditorService).createTextEditor({resource:o,label:s,description:n,encoding:a,languageId:d,forceFile:!0});return r&&l.setPreferredResource(r),l})}}),(0,tH.registerWorkbenchContribution2)(cg.ID,cg,tH.WorkbenchPhase.BlockRestore),(0,tH.registerWorkbenchContribution2)(cb.ID,cb,tH.WorkbenchPhase.BlockStartup),(0,tH.registerWorkbenchContribution2)(cA.ID,cA,tH.WorkbenchPhase.BlockStartup),(0,tH.registerWorkbenchContribution2)(cz.ID,cz,tH.WorkbenchPhase.BlockStartup),(0,tH.registerWorkbenchContribution2)(cW.ID,cW,tH.WorkbenchPhase.AfterRestored),(0,tH.registerWorkbenchContribution2)(cl.ID,cl,tH.WorkbenchPhase.BlockStartup),ip.ModesRegistry.registerLanguage({id:rD.BINARY_TEXT_FILE_MODE,aliases:["Binary"],mimetypes:["text/x-code-binary"]}),e.s([],675700)},765129,490499,e=>{"use strict";let t;var i=e.i(526097),o=e.i(447186),r=e.i(951264),s=e.i(258861),n=e.i(456592),a=e.i(34422),d=e.i(865384),l=e.i(689241),c=e.i(558364),h=e.i(613036),u=e.i(919101),p=e.i(963198),g=e.i(79522),m=e.i(164216),v=e.i(1125),y=e.i(419486),C=e.i(80428),b=e.i(219170),w=e.i(441201),f=e.i(978336),S=e.i(767053),_=e.i(197375),E=e.i(737450),I=e.i(693032),D=e.i(971629),T=e.i(913726),A=e.i(83068),x=e.i(571728),R=e.i(927842),k=e.i(333906),M=e.i(282347),L=e.i(901769),O=e.i(669414),P=e.i(99419),V=e.i(313289),K=e.i(50788),N=e.i(863637),G=e.i(612158),F=e.i(824489),W=e.i(873306),z=e.i(108527),B=e.i(218532),U=e.i(618591),H=e.i(903712),$=e.i(130722);e.i(817887),e.i(529027),e.i(6848),e.i(305273),e.i(706925),e.i(982710),e.i(868328),e.i(731453),e.i(99935),e.i(739757),e.i(647427),e.i(514244),e.i(993056),e.i(101398),e.i(712418),e.i(675700),e.i(614411),e.i(190379);var q=e.i(697786),Y=e.i(281482),j=e.i(611130),X=e.i(650289),J=e.i(262072),Z=e.i(686380),Q=e.i(84513),ee=e.i(308271),et=e.i(193391),ei=e.i(629565),eo=e.i(362361),er=e.i(658493),es=e.i(85282);let en=class extends j.Disposable{static{this.ID="workbench.contrib.syncScrolling"}constructor(e,t){super(),this.editorService=e,this.statusbarService=t,this.paneInitialScrollTop=new Map,this.syncScrollDispoasbles=this._register(new j.DisposableStore),this.paneDisposables=new j.DisposableStore,this.statusBarEntry=this._register(new j.MutableDisposable),this.isActive=!1,this._reentrancyBarrier=new ei.ReentrancyBarrier,this.registerActions()}registerActiveListeners(){this.syncScrollDispoasbles.add(this.editorService.onDidVisibleEditorsChange(()=>this.trackVisiblePanes()))}activate(){this.registerActiveListeners(),this.trackVisiblePanes()}toggle(){this.isActive?this.deactivate():this.activate(),this.isActive=!this.isActive,this.toggleStatusbarItem(this.isActive)}trackVisiblePanes(){for(let e of(this.paneDisposables.clear(),this.paneInitialScrollTop.clear(),this.getAllVisiblePanes()))(0,et.isEditorPaneWithScrolling)(e)&&(this.paneInitialScrollTop.set(e,e.getScrollPosition()),this.paneDisposables.add(e.onDidChangeScroll(()=>this._reentrancyBarrier.runExclusivelyOrSkip(()=>{this.onDidEditorPaneScroll(e)}))))}onDidEditorPaneScroll(e){let t=this.paneInitialScrollTop.get(e);if(void 0===t)throw Error("Scrolled pane not tracked");if(!(0,et.isEditorPaneWithScrolling)(e))throw Error("Scrolled pane does not support scrolling");let i=e.getScrollPosition(),o={scrollTop:i.scrollTop-t.scrollTop,scrollLeft:void 0!==i.scrollLeft&&void 0!==t.scrollLeft?i.scrollLeft-t.scrollLeft:void 0};for(let t of this.getAllVisiblePanes()){if(t===e||!(0,et.isEditorPaneWithScrolling)(t))continue;let i=this.paneInitialScrollTop.get(t);if(void 0===i)throw Error("Could not find initial offset for pane");let r=t.getScrollPosition(),s={scrollTop:i.scrollTop+o.scrollTop,scrollLeft:void 0!==i.scrollLeft&&void 0!==o.scrollLeft?i.scrollLeft+o.scrollLeft:void 0};(r.scrollTop!==s.scrollTop||r.scrollLeft!==s.scrollLeft)&&t.setScrollPosition(s)}}getAllVisiblePanes(){let e=[];for(let t of this.editorService.visibleEditorPanes){if(t instanceof ee.SideBySideEditor){let i=t.getPrimaryEditorPane(),o=t.getSecondaryEditorPane();i&&e.push(i),o&&e.push(o);continue}e.push(t)}return e}deactivate(){this.paneDisposables.clear(),this.syncScrollDispoasbles.clear(),this.paneInitialScrollTop.clear()}toggleStatusbarItem(e){if(e){if(!this.statusBarEntry.value){let e=(0,X.localize)(10651,"Scrolling Locked"),t=(0,X.localize)(10652,"Lock Scrolling Enabled");this.statusBarEntry.value=this.statusbarService.addEntry({name:e,text:e,tooltip:t,ariaLabel:e,command:{id:"workbench.action.toggleLockedScrolling",title:""},kind:"prominent",showInAllWindows:!0},"status.scrollLockingEnabled",er.StatusbarAlignment.RIGHT,102)}}else this.statusBarEntry.clear()}registerActions(){let e=this;this._register((0,Z.registerAction2)(class extends Z.Action2{constructor(){super({id:"workbench.action.toggleLockedScrolling",title:{...(0,X.localize2)(10653,"Toggle Locked Scrolling Across Editors"),mnemonicTitle:(0,X.localize)(10654,"Locked Scrolling")},category:J.Categories.View,f1:!0,metadata:{description:(0,X.localize)(10655,"Synchronize Scrolling Editors")}})}run(){e.toggle()}})),this._register((0,Z.registerAction2)(class extends Z.Action2{constructor(){super({id:"workbench.action.holdLockedScrolling",title:{...(0,X.localize2)(10656,"Hold Locked Scrolling Across Editors"),mnemonicTitle:(0,X.localize)(10657,"Locked Scrolling")},category:J.Categories.View})}run(t){let i=t.get(Q.IKeybindingService);e.toggle();let o=i.enableKeybindingHoldMode("workbench.action.holdLockedScrolling");o&&o.finally(()=>{e.toggle()})}}))}dispose(){this.deactivate(),super.dispose()}};en=(0,Y.__decorate)([(0,Y.__param)(0,eo.IEditorService),(0,Y.__param)(1,es.IStatusbarService)],en),(0,q.registerWorkbenchContribution2)(en.ID,en,q.WorkbenchPhase.Eventually);var ea=e.i(701898),ed=e.i(957994),el=j,ec=e.i(850887),eh=e.i(95526),eu=e.i(828318),ep=e.i(781808),eg=e.i(682807),em=e.i(853457);let ev=class extends el.Disposable{static{this.ID="workbench.contrib.textInputActionsProvider"}constructor(e,t,i,o){super(),this.layoutService=e,this.contextMenuService=t,this.clipboardService=i,this.logService=o,this.textInputActions=new eg.Lazy(()=>{var e,t;return e=this.clipboardService,t=this.logService,[(0,ea.toAction)({id:"undo",label:(0,X.localize)(2918,"Undo"),run:()=>(0,ec.getActiveDocument)().execCommand("undo")}),(0,ea.toAction)({id:"redo",label:(0,X.localize)(2919,"Redo"),run:()=>(0,ec.getActiveDocument)().execCommand("redo")}),new ea.Separator,(0,ea.toAction)({id:"editor.action.clipboardCutAction",label:(0,X.localize)(2920,"Cut"),run:()=>{t.trace("TextInputActionsProvider#cut"),(0,ec.getActiveDocument)().execCommand("cut")}}),(0,ea.toAction)({id:"editor.action.clipboardCopyAction",label:(0,X.localize)(2921,"Copy"),run:()=>{t.trace("TextInputActionsProvider#copy"),(0,ec.getActiveDocument)().execCommand("copy")}}),(0,ea.toAction)({id:"editor.action.clipboardPasteAction",label:(0,X.localize)(2922,"Paste"),run:async i=>{t.trace("TextInputActionsProvider#paste");let o=await e.readText();if((0,ec.isHTMLTextAreaElement)(i)||(0,ec.isHTMLInputElement)(i)){let e=i.selectionStart||0,t=i.selectionEnd||0;i.value=`${i.value.substring(0,e)}${o}${i.value.substring(t,i.value.length)}`,i.selectionStart=e+o.length,i.selectionEnd=i.selectionStart,i.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0}))}}}),new ea.Separator,(0,ea.toAction)({id:"editor.action.selectAll",label:(0,X.localize)(2923,"Select All"),run:()=>(0,ec.getActiveDocument)().execCommand("selectAll")})]}),this.registerListeners()}registerListeners(){this._register(ep.Event.runAndSubscribe(this.layoutService.onDidAddContainer,({container:e,disposables:t})=>{t.add((0,ec.addDisposableListener)(e,"contextmenu",t=>this.onContextMenu((0,ec.getWindow)(e),t)))},{container:this.layoutService.mainContainer,disposables:this._store}))}onContextMenu(e,t){if(t.defaultPrevented)return;let i=t.target;if(!(0,ec.isHTMLTextAreaElement)(i)&&!(0,ec.isHTMLInputElement)(i))return;ec.EventHelper.stop(t,!0);let o=new eu.StandardMouseEvent(e,t);this.contextMenuService.showContextMenu({getAnchor:()=>o,getActions:()=>this.textInputActions.value,getActionsContext:()=>i})}};ev=(0,Y.__decorate)([(0,Y.__param)(0,ed.IWorkbenchLayoutService),(0,Y.__param)(1,u.IContextMenuService),(0,Y.__param)(2,eh.IClipboardService),(0,Y.__param)(3,em.ILogService)],ev),(0,q.registerWorkbenchContribution2)(ev.ID,ev,q.WorkbenchPhase.BlockRestore);var ey=e.i(367835),eC=e.i(354244),eb=e.i(536766),ew=e.i(65579),ef=e.i(802136),eS=Z,e_=e.i(83823),eE=e.i(347589),eI=e.i(718596),eD=e.i(846960),eT=e.i(568101);class eA extends eS.Action2{static{this.ID="workbench.action.keybindingsReference"}static{this.AVAILABLE=!!(eC.isLinux?ey.default.keyboardShortcutsUrlLinux:eC.isMacintosh?ey.default.keyboardShortcutsUrlMac:ey.default.keyboardShortcutsUrlWin)}constructor(){super({id:eA.ID,title:{...(0,X.localize2)(2755,"Keyboard Shortcuts Reference"),mnemonicTitle:(0,X.localize)(2756,"&&Keyboard Shortcuts Reference")},category:J.Categories.Help,f1:!0,keybinding:{weight:eI.KeybindingWeight.WorkbenchContrib,when:null,primary:(0,e_.KeyChord)(e_.KeyMod.CtrlCmd|e_.KeyCode.KeyK,e_.KeyMod.CtrlCmd|e_.KeyCode.KeyR)},menu:{id:eS.MenuId.MenubarHelpMenu,group:"2_reference",order:1}})}run(e){let t=e.get(eE.IProductService),i=e.get(ew.IOpenerService),o=eC.isLinux?t.keyboardShortcutsUrlLinux:eC.isMacintosh?t.keyboardShortcutsUrlMac:t.keyboardShortcutsUrlWin;o&&i.open(ef.URI.parse(o))}}class ex extends eS.Action2{static{this.ID="workbench.action.openVideoTutorialsUrl"}static{this.AVAILABLE=!!ey.default.introductoryVideosUrl}constructor(){super({id:ex.ID,title:{...(0,X.localize2)(2757,"Video Tutorials"),mnemonicTitle:(0,X.localize)(2758,"&&Video Tutorials")},category:J.Categories.Help,f1:!0,menu:{id:eS.MenuId.MenubarHelpMenu,group:"2_reference",order:2}})}run(e){let t=e.get(eE.IProductService),i=e.get(ew.IOpenerService);t.introductoryVideosUrl&&i.open(ef.URI.parse(t.introductoryVideosUrl))}}class eR extends eS.Action2{static{this.ID="workbench.action.openTipsAndTricksUrl"}static{this.AVAILABLE=!!ey.default.tipsAndTricksUrl}constructor(){super({id:eR.ID,title:{...(0,X.localize2)(2759,"Tips and Tricks"),mnemonicTitle:(0,X.localize)(2760,"Tips and Tri&&cks")},category:J.Categories.Help,f1:!0,menu:{id:eS.MenuId.MenubarHelpMenu,group:"2_reference",order:3}})}run(e){let t=e.get(eE.IProductService),i=e.get(ew.IOpenerService);t.tipsAndTricksUrl&&i.open(ef.URI.parse(t.tipsAndTricksUrl))}}class ek extends eS.Action2{static{this.ID="workbench.action.openDocumentationUrl"}static{this.AVAILABLE=!!(eC.isWeb?ey.default.serverDocumentationUrl:ey.default.documentationUrl)}constructor(){super({id:ek.ID,title:{...(0,X.localize2)(2761,"Documentation"),mnemonicTitle:(0,X.localize)(2762,"&&Documentation")},category:J.Categories.Help,f1:!0,menu:{id:eS.MenuId.MenubarHelpMenu,group:"1_welcome",order:3}})}run(e){let t=e.get(eE.IProductService),i=e.get(ew.IOpenerService),o=eC.isWeb?t.serverDocumentationUrl:t.documentationUrl;o&&i.open(ef.URI.parse(o))}}class eM extends eS.Action2{static{this.ID="workbench.action.openNewsletterSignupUrl"}static{this.AVAILABLE=!!ey.default.newsletterSignupUrl}constructor(){super({id:eM.ID,title:(0,X.localize2)(2763,"Signup for the VS Code Newsletter"),category:J.Categories.Help,f1:!0})}run(e){let t=e.get(eE.IProductService),i=e.get(ew.IOpenerService),o=e.get(eb.ITelemetryService);i.open(ef.URI.parse(`${t.newsletterSignupUrl}?machineId=${encodeURIComponent(o.machineId)}`))}}class eL extends eS.Action2{static{this.ID="workbench.action.openYouTubeUrl"}static{this.AVAILABLE=!!ey.default.youTubeUrl}constructor(){super({id:eL.ID,title:{...(0,X.localize2)(2764,"Join Us on YouTube"),mnemonicTitle:(0,X.localize)(2765,"&&Join Us on YouTube")},category:J.Categories.Help,f1:!0,menu:{id:eS.MenuId.MenubarHelpMenu,group:"3_feedback",order:1}})}run(e){let t=e.get(eE.IProductService),i=e.get(ew.IOpenerService);t.youTubeUrl&&i.open(ef.URI.parse(t.youTubeUrl))}}class eO extends eS.Action2{static{this.ID="workbench.action.openRequestFeatureUrl"}static{this.AVAILABLE=!!ey.default.requestFeatureUrl}constructor(){super({id:eO.ID,title:{...(0,X.localize2)(2766,"Search Feature Requests"),mnemonicTitle:(0,X.localize)(2767,"&&Search Feature Requests")},category:J.Categories.Help,f1:!0,menu:{id:eS.MenuId.MenubarHelpMenu,group:"3_feedback",order:2}})}run(e){let t=e.get(eE.IProductService),i=e.get(ew.IOpenerService);t.requestFeatureUrl&&i.open(ef.URI.parse(t.requestFeatureUrl))}}class eP extends eS.Action2{static{this.ID="workbench.action.openLicenseUrl"}static{this.AVAILABLE=!!(eC.isWeb?ey.default.serverLicense:ey.default.licenseUrl)}constructor(){super({id:eP.ID,title:{...(0,X.localize2)(2768,"View License"),mnemonicTitle:(0,X.localize)(2769,"View &&License")},category:J.Categories.Help,f1:!0,menu:{id:eS.MenuId.MenubarHelpMenu,group:"4_legal",order:1}})}run(e){let t=e.get(eE.IProductService),i=e.get(ew.IOpenerService),o=eC.isWeb?t.serverLicenseUrl:t.licenseUrl;if(o)if(eC.language){let e=o.indexOf("?")>0?"&":"?";i.open(ef.URI.parse(`${o}${e}lang=${eC.language}`))}else i.open(ef.URI.parse(o))}}class eV extends eS.Action2{static{this.ID="workbench.action.openPrivacyStatementUrl"}static{this.AVAILABLE=!!ey.default.privacyStatementUrl}constructor(){super({id:eV.ID,title:{...(0,X.localize2)(2770,"Privacy Statement"),mnemonicTitle:(0,X.localize)(2771,"Privac&&y Statement")},category:J.Categories.Help,f1:!0,menu:{id:eS.MenuId.MenubarHelpMenu,group:"4_legal",order:2}})}run(e){let t=e.get(eE.IProductService),i=e.get(ew.IOpenerService);t.privacyStatementUrl&&i.open(ef.URI.parse(t.privacyStatementUrl))}}class eK extends eS.Action2{static{this.ID="workbench.action.getStartedWithAccessibilityFeatures"}constructor(){super({id:eK.ID,title:(0,X.localize2)(2772,"Get Started with Accessibility Features"),category:J.Categories.Help,f1:!0,menu:{id:eS.MenuId.MenubarHelpMenu,group:"1_welcome",order:6}})}run(e){e.get(eD.ICommandService).executeCommand("workbench.action.openWalkthrough","SetupAccessibility")}}class eN extends eS.Action2{static{this.ID="workbench.action.askVScode"}constructor(){super({id:eN.ID,title:(0,X.localize2)(2773,"Ask @vscode"),category:J.Categories.Help,f1:!0,precondition:eT.ContextKeyExpr.equals("chatSetupHidden",!1)})}async run(e){e.get(eD.ICommandService).executeCommand("workbench.action.chat.open",{mode:"ask",query:"@vscode ",isPartialQuery:!0})}}eS.MenuRegistry.appendMenuItem(eS.MenuId.MenubarHelpMenu,{command:{id:eN.ID,title:(0,X.localize2)(2773,"Ask @vscode")},order:7,group:"1_welcome",when:eT.ContextKeyExpr.equals("chatSetupHidden",!1)}),eA.AVAILABLE&&(0,eS.registerAction2)(eA),ex.AVAILABLE&&(0,eS.registerAction2)(ex),eR.AVAILABLE&&(0,eS.registerAction2)(eR),ek.AVAILABLE&&(0,eS.registerAction2)(ek),eM.AVAILABLE&&(0,eS.registerAction2)(eM),eL.AVAILABLE&&(0,eS.registerAction2)(eL),eO.AVAILABLE&&(0,eS.registerAction2)(eO),eP.AVAILABLE&&(0,eS.registerAction2)(eP),eV.AVAILABLE&&(0,eS.registerAction2)(eV),(0,eS.registerAction2)(eK),(0,eS.registerAction2)(eN),e.i(508267);var eG=e.i(556407),eF=e.i(441340),eW=e.i(122667),ez=e.i(637768),eB=e.i(454514),eU=e.i(997897),eH=e.i(172005),e$=e.i(472989),eq=e.i(318581),eY=e.i(999552),ej=e.i(615978),eX=Z,eJ=e.i(731931),eZ=e.i(487495);function eQ(e){let t=e?.getHTMLElement();t&&!(0,ec.isActiveElement)(t)&&e?.domFocus()}async function e0(e,t){if(!eF.WorkbenchListSelectionNavigation.getValue(e.contextKeyService))return t(e);let i=e.getFocus(),o=e.getSelection();await t(e);let r=e.getFocus();if(o.length>1||!(0,eB.equals)(i,o)||(0,eB.equals)(i,r))return;let s=new KeyboardEvent("keydown");e.setSelection(r,s)}async function e1(e,t){if(!e)return;await e0(e,t);let i=e.getFocus();i.length&&e.reveal(i[0]),e.setAnchor(i[0]),eQ(e)}function e2(e,t){if(e instanceof eG.List||e instanceof ez.PagedList||e instanceof eY.Table){let i=e.getFocus()?e.getFocus()[0]:void 0,o=e.getSelection();o&&"number"==typeof i&&o.indexOf(i)>=0?e.setSelection(o.filter(e=>e!==t)):"number"==typeof i&&e.setSelection(o.concat(i))}else if(e instanceof eU.ObjectTree||e instanceof e$.DataTree||e instanceof eH.AsyncDataTree){let i=e.getFocus()?e.getFocus()[0]:void 0;if(t===i)return;let o=e.getSelection(),r=new KeyboardEvent("keydown",{shiftKey:!0});o&&o.indexOf(i)>=0?e.setSelection(o.filter(e=>e!==t),r):e.setSelection(o.concat(i),r)}}function e3(e,t){let i=e.getStickyScrollFocus();if(0===i.length)throw Error("StickyScroll has no focus");if(i.length>1)throw Error("StickyScroll can only have a single focused item");e.reveal(i[0]),e.getHTMLElement().focus(),e.setFocus(i),t?.(i[0])}function e5(e,t){let i=e.get(eW.IListService).lastFocusedList,o=(0,eF.getSelectionKeyboardEvent)("keydown",t);if(i instanceof eG.List||i instanceof ez.PagedList||i instanceof eY.Table)i.setAnchor(i.getFocus()[0]),i.setSelection(i.getFocus(),o);else if(i instanceof eU.ObjectTree||i instanceof e$.DataTree||i instanceof eH.AsyncDataTree){let e=i.getFocus();if(e.length>0){let t=!0;!0===i.expandOnlyOnTwistieClick?t=!1:"boolean"!=typeof i.expandOnlyOnTwistieClick&&i.expandOnlyOnTwistieClick(e[0])&&(t=!1),t&&i.toggleCollapsed(e[0])}i.setAnchor(e[0]),i.setSelection(e,o)}}eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.focusDown",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyCode.DownArrow,mac:{primary:e_.KeyCode.DownArrow,secondary:[e_.KeyMod.WinCtrl|e_.KeyCode.KeyN]},handler:(e,t)=>{e1(e.get(eW.IListService).lastFocusedList,async e=>{let i=new KeyboardEvent("keydown");await e.focusNext("number"==typeof t?t:1,!1,i)})}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.focusUp",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyCode.UpArrow,mac:{primary:e_.KeyCode.UpArrow,secondary:[e_.KeyMod.WinCtrl|e_.KeyCode.KeyP]},handler:(e,t)=>{e1(e.get(eW.IListService).lastFocusedList,async e=>{let i=new KeyboardEvent("keydown");await e.focusPrevious("number"==typeof t?t:1,!1,i)})}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.focusAnyDown",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyMod.Alt|e_.KeyCode.DownArrow,mac:{primary:e_.KeyMod.Alt|e_.KeyCode.DownArrow,secondary:[e_.KeyMod.WinCtrl|e_.KeyMod.Alt|e_.KeyCode.KeyN]},handler:(e,t)=>{e1(e.get(eW.IListService).lastFocusedList,async e=>{let i=new KeyboardEvent("keydown",{altKey:!0});await e.focusNext("number"==typeof t?t:1,!1,i)})}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.focusAnyUp",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyMod.Alt|e_.KeyCode.UpArrow,mac:{primary:e_.KeyMod.Alt|e_.KeyCode.UpArrow,secondary:[e_.KeyMod.WinCtrl|e_.KeyMod.Alt|e_.KeyCode.KeyP]},handler:(e,t)=>{e1(e.get(eW.IListService).lastFocusedList,async e=>{let i=new KeyboardEvent("keydown",{altKey:!0});await e.focusPrevious("number"==typeof t?t:1,!1,i)})}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.focusPageDown",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyCode.PageDown,handler:e=>{e1(e.get(eW.IListService).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown");await e.focusNextPage(t)})}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.focusPageUp",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyCode.PageUp,handler:e=>{e1(e.get(eW.IListService).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown");await e.focusPreviousPage(t)})}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.focusFirst",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyCode.Home,handler:e=>{e1(e.get(eW.IListService).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown");await e.focusFirst(t)})}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.focusLast",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyCode.End,handler:e=>{e1(e.get(eW.IListService).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown");await e.focusLast(t)})}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.focusAnyFirst",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyMod.Alt|e_.KeyCode.Home,handler:e=>{e1(e.get(eW.IListService).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown",{altKey:!0});await e.focusFirst(t)})}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.focusAnyLast",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyMod.Alt|e_.KeyCode.End,handler:e=>{e1(e.get(eW.IListService).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown",{altKey:!0});await e.focusLast(t)})}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.expandSelectionDown",weight:eI.KeybindingWeight.WorkbenchContrib,when:eT.ContextKeyExpr.and(eF.WorkbenchListFocusContextKey,eF.WorkbenchListSupportsMultiSelectContextKey),primary:e_.KeyMod.Shift|e_.KeyCode.DownArrow,handler:(e,t)=>{let i=e.get(eW.IListService).lastFocusedList;if(!i)return;let o=i.getFocus()?i.getFocus()[0]:void 0,r=new KeyboardEvent("keydown");i.focusNext("number"==typeof t?t:1,!1,r),e2(i,o);let s=i.getFocus();s.length&&i.reveal(s[0]),eQ(i)}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.expandSelectionUp",weight:eI.KeybindingWeight.WorkbenchContrib,when:eT.ContextKeyExpr.and(eF.WorkbenchListFocusContextKey,eF.WorkbenchListSupportsMultiSelectContextKey),primary:e_.KeyMod.Shift|e_.KeyCode.UpArrow,handler:(e,t)=>{let i=e.get(eW.IListService).lastFocusedList;if(!i)return;let o=i.getFocus()?i.getFocus()[0]:void 0,r=new KeyboardEvent("keydown");i.focusPrevious("number"==typeof t?t:1,!1,r),e2(i,o);let s=i.getFocus();s.length&&i.reveal(s[0]),eQ(i)}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.collapse",weight:eI.KeybindingWeight.WorkbenchContrib,when:eT.ContextKeyExpr.and(eF.WorkbenchListFocusContextKey,eT.ContextKeyExpr.or(eF.WorkbenchTreeElementCanCollapse,eF.WorkbenchTreeElementHasParent)),primary:e_.KeyCode.LeftArrow,mac:{primary:e_.KeyCode.LeftArrow,secondary:[e_.KeyMod.CtrlCmd|e_.KeyCode.UpArrow]},handler:e=>{let t=e.get(eW.IListService).lastFocusedList;if(!t||!(t instanceof eU.ObjectTree||t instanceof e$.DataTree||t instanceof eH.AsyncDataTree))return;let i=t.getFocus();if(0===i.length)return;let o=i[0];if(!t.collapse(o)){let e=t.getParentElement(o);e&&e1(t,t=>{let i=new KeyboardEvent("keydown");t.setFocus([e],i)})}}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.stickyScroll.collapse",weight:eI.KeybindingWeight.WorkbenchContrib+50,when:eF.WorkbenchTreeStickyScrollFocused,primary:e_.KeyCode.LeftArrow,mac:{primary:e_.KeyCode.LeftArrow,secondary:[e_.KeyMod.CtrlCmd|e_.KeyCode.UpArrow]},handler:e=>{let t=e.get(eW.IListService).lastFocusedList;t&&(t instanceof eU.ObjectTree||t instanceof e$.DataTree||t instanceof eH.AsyncDataTree)&&e3(t,e=>t.collapse(e))}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.collapseAll",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyMod.CtrlCmd|e_.KeyCode.LeftArrow,mac:{primary:e_.KeyMod.CtrlCmd|e_.KeyCode.LeftArrow,secondary:[e_.KeyMod.CtrlCmd|e_.KeyMod.Shift|e_.KeyCode.UpArrow]},handler:e=>{let t=e.get(eW.IListService).lastFocusedList;t&&!(t instanceof eG.List||t instanceof ez.PagedList||t instanceof eY.Table)&&t.collapseAll()}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.collapseAllToFocus",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,handler:e=>{let t=e.get(eW.IListService).lastFocusedList,i=(0,eF.getSelectionKeyboardEvent)("keydown",!0);if(t instanceof eU.ObjectTree||t instanceof e$.DataTree||t instanceof eH.AsyncDataTree){let e=t.getFocus();e.length>0&&t.collapse(e[0],!0),t.setSelection(e,i),t.setAnchor(e[0])}}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.focusParent",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,handler:e=>{let t=e.get(eW.IListService).lastFocusedList;if(!t||!(t instanceof eU.ObjectTree||t instanceof e$.DataTree||t instanceof eH.AsyncDataTree))return;let i=t.getFocus();if(0===i.length)return;let o=i[0],r=t.getParentElement(o);r&&e1(t,e=>{let t=new KeyboardEvent("keydown");e.setFocus([r],t)})}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.expand",weight:eI.KeybindingWeight.WorkbenchContrib,when:eT.ContextKeyExpr.and(eF.WorkbenchListFocusContextKey,eT.ContextKeyExpr.or(eF.WorkbenchTreeElementCanExpand,eF.WorkbenchTreeElementHasChild)),primary:e_.KeyCode.RightArrow,handler:e=>{let t=e.get(eW.IListService).lastFocusedList;if(t){if(t instanceof eU.ObjectTree||t instanceof e$.DataTree){let e=t.getFocus();if(0===e.length)return;let i=e[0];if(!t.expand(i)){let e=t.getFirstElementChild(i);e&&t.getNode(e).visible&&e1(t,t=>{let i=new KeyboardEvent("keydown");t.setFocus([e],i)})}}else if(t instanceof eH.AsyncDataTree){let e=t.getFocus();if(0===e.length)return;let i=e[0];t.expand(i).then(e=>{if(i&&!e){let e=t.getFirstElementChild(i);e&&t.getNode(e).visible&&e1(t,t=>{let i=new KeyboardEvent("keydown");t.setFocus([e],i)})}})}}}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.select",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyCode.Enter,mac:{primary:e_.KeyCode.Enter,secondary:[e_.KeyMod.CtrlCmd|e_.KeyCode.DownArrow]},handler:e=>{e5(e,!1)}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.stickyScrollselect",weight:eI.KeybindingWeight.WorkbenchContrib+50,when:eF.WorkbenchTreeStickyScrollFocused,primary:e_.KeyCode.Enter,mac:{primary:e_.KeyCode.Enter,secondary:[e_.KeyMod.CtrlCmd|e_.KeyCode.DownArrow]},handler:e=>{let t=e.get(eW.IListService).lastFocusedList;t&&(t instanceof eU.ObjectTree||t instanceof e$.DataTree||t instanceof eH.AsyncDataTree)&&e3(t,e=>t.setSelection([e]))}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.selectAndPreserveFocus",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,handler:e=>{e5(e,!0)}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.selectAll",weight:eI.KeybindingWeight.WorkbenchContrib,when:eT.ContextKeyExpr.and(eF.WorkbenchListFocusContextKey,eF.WorkbenchListSupportsMultiSelectContextKey),primary:e_.KeyMod.CtrlCmd|e_.KeyCode.KeyA,handler:e=>{let t=e.get(eW.IListService).lastFocusedList;if(t instanceof eG.List||t instanceof ez.PagedList||t instanceof eY.Table){let e=new KeyboardEvent("keydown");t.setSelection((0,eB.range)(t.length),e)}else if(t instanceof eU.ObjectTree||t instanceof e$.DataTree||t instanceof eH.AsyncDataTree){let e,i,o=t.getFocus(),r=t.getSelection();o.length>0&&(0===r.length||!r.includes(o[0]))&&(e=o[0]),!e&&r.length>0&&(e=r[0]),i=e?t.getParentElement(e):void 0;let s=[],n=e=>{for(let t of e.children)t.visible&&(s.push(t.element),t.collapsed||n(t))};n(t.getNode(i)),i&&r.length===s.length&&s.unshift(i);let a=new KeyboardEvent("keydown");t.setSelection(s,a)}}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.toggleSelection",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyMod.CtrlCmd|e_.KeyMod.Shift|e_.KeyCode.Enter,handler:e=>{let t=e.get(eW.IListService).lastFocusedList;if(!t)return;let i=t.getFocus();if(0===i.length)return;let o=t.getSelection(),r=o.indexOf(i[0]);r>-1?t.setSelection([...o.slice(0,r),...o.slice(r+1)]):t.setSelection([...o,i[0]])}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.showHover",weight:eI.KeybindingWeight.WorkbenchContrib,primary:(0,e_.KeyChord)(e_.KeyMod.CtrlCmd|e_.KeyCode.KeyK,e_.KeyMod.CtrlCmd|e_.KeyCode.KeyI),when:eF.WorkbenchListFocusContextKey,handler:async e=>{let t=e.get(eW.IListService).lastFocusedList;if(!t)return;let i=t.getFocus();if(!i||0===i.length)return;let o=t.getHTMLElement().querySelector(".monaco-scrollable-element"),r=o?.querySelector(".monaco-list-rows"),s=r?.querySelector(".focused");if(!s)return;let n=function(e){if(e.matches('[custom-hover="true"]'))return e;let t=e.querySelector('[custom-hover="true"]:not([tabindex]):not(.action-item)');if(t)return t}(s);n&&e.get(eZ.IHoverService).showManagedHover(n)}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.toggleExpand",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,primary:e_.KeyCode.Space,handler:e=>{let t=e.get(eW.IListService).lastFocusedList;if(t instanceof eU.ObjectTree||t instanceof e$.DataTree||t instanceof eH.AsyncDataTree){let e=t.getFocus();if(!t.options.disableExpandOnSpacebar&&e.length>0&&t.isCollapsible(e[0]))return void t.toggleCollapsed(e[0])}e5(e,!0)}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.stickyScrolltoggleExpand",weight:eI.KeybindingWeight.WorkbenchContrib+50,when:eF.WorkbenchTreeStickyScrollFocused,primary:e_.KeyCode.Space,handler:e=>{let t=e.get(eW.IListService).lastFocusedList;t&&(t instanceof eU.ObjectTree||t instanceof e$.DataTree||t instanceof eH.AsyncDataTree)&&e3(t)}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.clear",weight:eI.KeybindingWeight.WorkbenchContrib,when:eT.ContextKeyExpr.and(eF.WorkbenchListFocusContextKey,eF.WorkbenchListHasSelectionOrFocus),primary:e_.KeyCode.Escape,handler:e=>{let t=e.get(eW.IListService).lastFocusedList;if(!t)return;let i=t.getSelection(),o=new KeyboardEvent("keydown");if(i.length>1)if(eF.WorkbenchListSelectionNavigation.getValue(t.contextKeyService)){let e=t.getFocus();t.setSelection([e[0]],o)}else t.setSelection([],o);else t.setSelection([],o),t.setFocus([],o);t.setAnchor(void 0)}}),eq.CommandsRegistry.registerCommand({id:"list.triggerTypeNavigation",handler:e=>{let t=e.get(eW.IListService).lastFocusedList;t?.triggerTypeNavigation()}}),eq.CommandsRegistry.registerCommand({id:"list.toggleFindMode",handler:e=>{let t=e.get(eW.IListService).lastFocusedList;(t instanceof ej.AbstractTree||t instanceof eH.AsyncDataTree)&&(t.findMode=t.findMode===ej.TreeFindMode.Filter?ej.TreeFindMode.Highlight:ej.TreeFindMode.Filter)}}),eq.CommandsRegistry.registerCommand({id:"list.toggleFindMatchType",handler:e=>{let t=e.get(eW.IListService).lastFocusedList;(t instanceof ej.AbstractTree||t instanceof eH.AsyncDataTree)&&(t.findMatchType=t.findMatchType===ej.TreeFindMatchType.Contiguous?ej.TreeFindMatchType.Fuzzy:ej.TreeFindMatchType.Contiguous)}}),eq.CommandsRegistry.registerCommandAlias("list.toggleKeyboardNavigation","list.triggerTypeNavigation"),eq.CommandsRegistry.registerCommandAlias("list.toggleFilterOnType","list.toggleFindMode"),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.find",weight:eI.KeybindingWeight.WorkbenchContrib,when:eT.ContextKeyExpr.and(eF.RawWorkbenchListFocusContextKey,eF.WorkbenchListSupportsFind),primary:e_.KeyMod.CtrlCmd|e_.KeyMod.Alt|e_.KeyCode.KeyF,secondary:[e_.KeyCode.F3],handler:e=>{let t=e.get(eW.IListService).lastFocusedList;t instanceof eG.List||t instanceof ez.PagedList||t instanceof eY.Table||(t instanceof ej.AbstractTree||t instanceof eH.AsyncDataTree)&&t.openFind()}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.closeFind",weight:eI.KeybindingWeight.WorkbenchContrib,when:eT.ContextKeyExpr.and(eF.RawWorkbenchListFocusContextKey,eF.WorkbenchTreeFindOpen),primary:e_.KeyCode.Escape,handler:e=>{let t=e.get(eW.IListService).lastFocusedList;(t instanceof ej.AbstractTree||t instanceof eH.AsyncDataTree)&&t.closeFind()}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.scrollUp",weight:eI.KeybindingWeight.WorkbenchContrib,when:eT.ContextKeyExpr.and(eF.WorkbenchListFocusContextKey,eF.WorkbenchListScrollAtTopContextKey?.negate()),primary:e_.KeyMod.CtrlCmd|e_.KeyCode.UpArrow,handler:e=>{let t=e.get(eW.IListService).lastFocusedList;t&&(t.scrollTop-=10)}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.scrollDown",weight:eI.KeybindingWeight.WorkbenchContrib,when:eT.ContextKeyExpr.and(eF.WorkbenchListFocusContextKey,eF.WorkbenchListScrollAtBottomContextKey?.negate()),primary:e_.KeyMod.CtrlCmd|e_.KeyCode.DownArrow,handler:e=>{let t=e.get(eW.IListService).lastFocusedList;t&&(t.scrollTop+=10)}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.scrollLeft",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,handler:e=>{let t=e.get(eW.IListService).lastFocusedList;t&&(t.scrollLeft-=10)}}),eI.KeybindingsRegistry.registerCommandAndKeybindingRule({id:"list.scrollRight",weight:eI.KeybindingWeight.WorkbenchContrib,when:eF.WorkbenchListFocusContextKey,handler:e=>{let t=e.get(eW.IListService).lastFocusedList;t&&(t.scrollLeft+=10)}}),(0,eX.registerAction2)(class extends eX.Action2{constructor(){super({id:"tree.toggleStickyScroll",title:{...(0,X.localize2)(2903,"Toggle Tree Sticky Scroll"),mnemonicTitle:(0,X.localize)(2904,"&&Toggle Tree Sticky Scroll")},category:"View",metadata:{description:(0,X.localize)(2905,"Toggles Sticky Scroll widget at the top of tree structures such as the File Explorer and Debug variables View.")},f1:!0})}run(e){let t=e.get(eJ.IConfigurationService),i=!t.getValue("workbench.tree.enableStickyScroll");t.updateValue("workbench.tree.enableStickyScroll",i)}});var e6=e.i(1391),e4=e.i(891110),e9=e.i(536561),e8=Z,e7=e.i(523183),te=e.i(305063),tt=e.i(865562);class ti extends e8.Action2{constructor(e,t){super(e),this.direction=t}run(e){let t,i=e.get(ed.IWorkbenchLayoutService),o=e.get(e4.IEditorGroupsService),r=e.get(a.IPaneCompositePartService),s=i.hasFocus(e9.Parts.EDITOR_PART),n=i.hasFocus(e9.Parts.PANEL_PART),d=i.hasFocus(e9.Parts.SIDEBAR_PART),l=i.hasFocus(e9.Parts.AUXILIARYBAR_PART);if(s){if(this.navigateAcrossEditorGroup(this.toGroupDirection(this.direction),o))return;t=i.getVisibleNeighborPart(e9.Parts.EDITOR_PART,this.direction)}n&&(t=i.getVisibleNeighborPart(e9.Parts.PANEL_PART,this.direction)),d&&(t=i.getVisibleNeighborPart(e9.Parts.SIDEBAR_PART,this.direction)),l&&(t=t=i.getVisibleNeighborPart(e9.Parts.AUXILIARYBAR_PART,this.direction)),t===e9.Parts.EDITOR_PART?this.navigateBackToEditorGroup(this.toGroupDirection(this.direction),o)||this.navigateToEditorGroup(this.direction===e7.Direction.Right?e6.GroupLocation.FIRST:e6.GroupLocation.LAST,o):t===e9.Parts.SIDEBAR_PART?this.navigateToSidebar(i,r):t===e9.Parts.PANEL_PART?this.navigateToPanel(i,r):t===e9.Parts.AUXILIARYBAR_PART&&this.navigateToAuxiliaryBar(i,r)}async navigateToPanel(e,t){if(!e.isVisible(e9.Parts.PANEL_PART))return!1;let i=t.getActivePaneComposite(te.ViewContainerLocation.Panel);if(!i)return!1;let o=i.getId(),r=await t.openPaneComposite(o,te.ViewContainerLocation.Panel,!0);return!!r&&r}async navigateToSidebar(e,t){if(!e.isVisible(e9.Parts.SIDEBAR_PART))return!1;let i=t.getActivePaneComposite(te.ViewContainerLocation.Sidebar);if(!i)return!1;let o=i.getId();return!!await t.openPaneComposite(o,te.ViewContainerLocation.Sidebar,!0)}async navigateToAuxiliaryBar(e,t){if(!e.isVisible(e9.Parts.AUXILIARYBAR_PART))return!1;let i=t.getActivePaneComposite(te.ViewContainerLocation.AuxiliaryBar);if(!i)return!1;let o=i.getId(),r=await t.openPaneComposite(o,te.ViewContainerLocation.AuxiliaryBar,!0);return!!r&&r}navigateAcrossEditorGroup(e,t){return this.doNavigateToEditorGroup({direction:e},t)}navigateToEditorGroup(e,t){return this.doNavigateToEditorGroup({location:e},t)}navigateBackToEditorGroup(e,t){if(!t.activeGroup)return!1;let i=this.toOppositeDirection(e);return!t.findGroup({direction:i},t.activeGroup)&&(t.activeGroup.focus(),!0)}toGroupDirection(e){switch(e){case e7.Direction.Down:return e6.GroupDirection.DOWN;case e7.Direction.Left:return e6.GroupDirection.LEFT;case e7.Direction.Right:return e6.GroupDirection.RIGHT;case e7.Direction.Up:return e6.GroupDirection.UP}}toOppositeDirection(e){switch(e){case e6.GroupDirection.UP:return e6.GroupDirection.DOWN;case e6.GroupDirection.RIGHT:return e6.GroupDirection.LEFT;case e6.GroupDirection.LEFT:return e6.GroupDirection.RIGHT;case e6.GroupDirection.DOWN:return e6.GroupDirection.UP}}doNavigateToEditorGroup(e,t){let i=t.findGroup(e,t.activeGroup);return!!i&&(i.focus(),!0)}}(0,e8.registerAction2)(class extends ti{constructor(){super({id:"workbench.action.navigateLeft",title:(0,X.localize2)(2906,"Navigate to the View on the Left"),category:J.Categories.View,f1:!0},e7.Direction.Left)}}),(0,e8.registerAction2)(class extends ti{constructor(){super({id:"workbench.action.navigateRight",title:(0,X.localize2)(2907,"Navigate to the View on the Right"),category:J.Categories.View,f1:!0},e7.Direction.Right)}}),(0,e8.registerAction2)(class extends ti{constructor(){super({id:"workbench.action.navigateUp",title:(0,X.localize2)(2908,"Navigate to the View Above"),category:J.Categories.View,f1:!0},e7.Direction.Up)}}),(0,e8.registerAction2)(class extends ti{constructor(){super({id:"workbench.action.navigateDown",title:(0,X.localize2)(2909,"Navigate to the View Below"),category:J.Categories.View,f1:!0},e7.Direction.Down)}});class to extends e8.Action2{constructor(e,t){super(e),this.focusNext=t}run(e){let t=e.get(ed.IWorkbenchLayoutService),i=e.get(eo.IEditorService);this.focusNextOrPreviousPart(t,i,this.focusNext)}findVisibleNeighbour(e,t,i){let o,r=(0,ec.getActiveWindow)();if((0,tt.isAuxiliaryWindow)(r))o=t===e9.Parts.EDITOR_PART?e9.Parts.STATUSBAR_PART:e9.Parts.EDITOR_PART;else switch(t){case e9.Parts.EDITOR_PART:o=i?e9.Parts.PANEL_PART:e9.Parts.SIDEBAR_PART;break;case e9.Parts.PANEL_PART:o=i?e9.Parts.AUXILIARYBAR_PART:e9.Parts.EDITOR_PART;break;case e9.Parts.AUXILIARYBAR_PART:o=i?e9.Parts.STATUSBAR_PART:e9.Parts.PANEL_PART;break;case e9.Parts.STATUSBAR_PART:o=i?e9.Parts.ACTIVITYBAR_PART:e9.Parts.AUXILIARYBAR_PART;break;case e9.Parts.ACTIVITYBAR_PART:o=i?e9.Parts.SIDEBAR_PART:e9.Parts.STATUSBAR_PART;break;case e9.Parts.SIDEBAR_PART:o=i?e9.Parts.EDITOR_PART:e9.Parts.ACTIVITYBAR_PART;break;default:o=e9.Parts.EDITOR_PART}return e.isVisible(o,r)||o===e9.Parts.EDITOR_PART?o:this.findVisibleNeighbour(e,o,i)}focusNextOrPreviousPart(e,t,i){let o;t.activeEditorPane?.hasFocus()||e.hasFocus(e9.Parts.EDITOR_PART)?o=e9.Parts.EDITOR_PART:e.hasFocus(e9.Parts.ACTIVITYBAR_PART)?o=e9.Parts.ACTIVITYBAR_PART:e.hasFocus(e9.Parts.STATUSBAR_PART)?o=e9.Parts.STATUSBAR_PART:e.hasFocus(e9.Parts.SIDEBAR_PART)?o=e9.Parts.SIDEBAR_PART:e.hasFocus(e9.Parts.AUXILIARYBAR_PART)?o=e9.Parts.AUXILIARYBAR_PART:e.hasFocus(e9.Parts.PANEL_PART)&&(o=e9.Parts.PANEL_PART),e.focusPart(o?this.findVisibleNeighbour(e,o,i):e9.Parts.EDITOR_PART,(0,ec.getActiveWindow)())}}(0,e8.registerAction2)(class extends to{constructor(){super({id:"workbench.action.focusNextPart",title:(0,X.localize2)(2910,"Focus Next Part"),category:J.Categories.View,f1:!0,keybinding:{primary:e_.KeyCode.F6,weight:eI.KeybindingWeight.WorkbenchContrib}},!0)}}),(0,e8.registerAction2)(class extends to{constructor(){super({id:"workbench.action.focusPreviousPart",title:(0,X.localize2)(2911,"Focus Previous Part"),category:J.Categories.View,f1:!0,keybinding:{primary:e_.KeyMod.Shift|e_.KeyCode.F6,weight:eI.KeybindingWeight.WorkbenchContrib}},!1)}}),e.i(296847);var tr=e.i(578953),ts=e.i(399362),tn=e.i(973265),ta=e.i(693162),td=e.i(704994),tl=e.i(82648),tc=e.i(652731),th=e.i(370973),tu=e.i(428048),tp=e.i(633450),tg=e.i(326659),tm=e.i(58762),tv=e.i(324726),ty=e.i(702320),tC=e.i(506986),tb=e.i(292035);let tw="addRootFolder",tf=(0,X.localize2)(2976,"Add Folder to Workspace..."),tS="setRootFolder",t_="_workbench.pickWorkspaceFolder";async function tE(e){let t=e.get(tv.IFileDialogService),i=e.get(tb.IPathService);return await t.showOpenDialog({openLabel:(0,tl.mnemonicButtonLabel)((0,X.localize)(2977,"&&Add")),title:(0,X.localize)(2978,"Add Folder to Workspace"),canSelectFolders:!0,canSelectMany:!0,defaultUri:await t.defaultFolderPath(),availableFileSystems:[i.defaultUriScheme]})}eq.CommandsRegistry.registerCommand({id:"workbench.action.files.openFileFolderInNewWindow",handler:e=>e.get(tv.IFileDialogService).pickFileFolderAndOpen({forceNewWindow:!0})}),eq.CommandsRegistry.registerCommand({id:"_files.pickFolderAndOpen",handler:(e,t)=>e.get(tv.IFileDialogService).pickFolderAndOpen(t)}),eq.CommandsRegistry.registerCommand({id:"workbench.action.files.openFolderInNewWindow",handler:e=>e.get(tv.IFileDialogService).pickFolderAndOpen({forceNewWindow:!0})}),eq.CommandsRegistry.registerCommand({id:"workbench.action.files.openFileInNewWindow",handler:e=>e.get(tv.IFileDialogService).pickFileAndOpen({forceNewWindow:!0})}),eq.CommandsRegistry.registerCommand({id:"workbench.action.openWorkspaceInNewWindow",handler:e=>e.get(tv.IFileDialogService).pickWorkspaceAndOpen({forceNewWindow:!0})}),eq.CommandsRegistry.registerCommand({id:tw,handler:async e=>{let t=e.get(tn.IWorkspaceEditingService),i=await tE(e);i?.length&&await t.addFolders(i.map(e=>({uri:e})))}}),eq.CommandsRegistry.registerCommand({id:tS,handler:async e=>{let t=e.get(tn.IWorkspaceEditingService),i=e.get(ts.IWorkspaceContextService),o=await tE(e);o?.length&&await t.updateFolders(0,i.getWorkspace().folders.length,o.map(e=>({uri:e})))}}),eq.CommandsRegistry.registerCommand(t_,async function(e,t){let i=e.get(tu.IQuickInputService),o=e.get(th.ILabelService),r=e.get(ts.IWorkspaceContextService),s=e.get(tg.IModelService),n=e.get(tm.ILanguageService),a=r.getWorkspace().folders;if(!a.length)return;let d=a.map(e=>{let t=e.name,i=o.getUriLabel((0,ta.dirname)(e.uri),{relative:!0});return{label:t,description:i!==t?i:void 0,folder:e,iconClasses:(0,tp.getIconClasses)(s,n,e.uri,tc.FileKind.ROOT_FOLDER)}}),l=(t?t[0]:void 0)||Object.create(null);l.activeItem||(l.activeItem=d[0]),l.placeHolder||(l.placeHolder=(0,X.localize)(2979,"Select workspace folder")),"boolean"!=typeof l.matchOnDescription&&(l.matchOnDescription=!0);let c=(t?t[1]:void 0)||td.CancellationToken.None,h=await i.pick(d,l,c);if(h)return a[d.indexOf(h)]}),eq.CommandsRegistry.registerCommand({id:"vscode.openFolder",handler:(e,t,i)=>{let o=e.get(eD.ICommandService);if("boolean"==typeof i&&(i={forceNewWindow:i}),!t){let e={forceNewWindow:i?.forceNewWindow};return i?.forceLocalWindow&&(e.remoteAuthority=null,e.availableFileSystems=["file"]),o.executeCommand("_files.pickFolderAndOpen",e)}let r=ef.URI.from(t,!0),s={forceNewWindow:i?.forceNewWindow,forceReuseWindow:i?.forceReuseWindow,noRecentEntry:i?.noRecentEntry,remoteAuthority:i?.forceLocalWindow?null:void 0,forceProfile:i?.forceProfile,forceTempProfile:i?.forceTempProfile},n=(0,tr.hasWorkspaceFileExtension)(r)||r.scheme===ty.Schemas.untitled?{workspaceUri:r}:{folderUri:r},a=i?.filesToOpen?.map(e=>({fileUri:ef.URI.from(e,!0)}))??[];return o.executeCommand("_files.windowOpen",[n,...a],s)},metadata:{description:"Open a folder or workspace in the current window or new window depending on the newWindow argument. Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder/workspace unless the newWindow parameter is set to true.",args:[{name:"uri",description:"(optional) Uri of the folder or workspace file to open. If not provided, a native dialog will ask the user for the folder",constraint:e=>null==e||e instanceof ef.URI},{name:"options",description:"(optional) Options. Object with the following properties: `forceNewWindow`: Whether to open the folder/workspace in a new window or the same. Defaults to opening in the same window. `forceReuseWindow`: Whether to force opening the folder/workspace in the same window. Defaults to false. `noRecentEntry`: Whether the opened URI will appear in the 'Open Recent' list. Defaults to false. `forceLocalWindow`: Whether to force opening the folder/workspace in a local window. Defaults to false. `forceProfile`: The profile to use when opening the folder/workspace. Defaults to the current profile. `forceTempProfile`: Whether to use a temporary profile when opening the folder/workspace. Defaults to false. `filesToOpen`: An array of files to open in the new window. Defaults to an empty array. Note, for backward compatibility, options can also be of type boolean, representing the `forceNewWindow` setting.",constraint:e=>void 0===e||"object"==typeof e||"boolean"==typeof e}]}}),eq.CommandsRegistry.registerCommand({id:"vscode.newWindow",handler:(e,t)=>{let i=e.get(eD.ICommandService),o={forceReuseWindow:t?.reuseWindow,remoteAuthority:t?.remoteAuthority};return i.executeCommand("_files.newWindow",o)},metadata:{description:"Opens an new window depending on the newWindow argument.",args:[{name:"options",description:"(optional) Options. Object with the following properties: `reuseWindow`: Whether to open a new window or the same. Defaults to opening in a new window. ",constraint:e=>void 0===e||"object"==typeof e}]}}),eq.CommandsRegistry.registerCommand("_workbench.removeFromRecentlyOpened",function(e,t){return e.get(tC.IWorkspacesService).removeRecentlyOpened([t])}),eq.CommandsRegistry.registerCommand({id:"vscode.removeFromRecentlyOpened",handler:(e,t)=>{let i=e.get(tC.IWorkspacesService);return t="string"==typeof t?t.match(/^[^:/?#]+:\/\//)?ef.URI.parse(t):ef.URI.file(t):ef.URI.revive(t),i.removeRecentlyOpened([t])},metadata:{description:"Removes an entry with the given path from the recently opened list.",args:[{name:"path",description:"URI or URI string to remove from recently opened.",constraint:e=>"string"==typeof e||e instanceof ef.URI}]}}),eq.CommandsRegistry.registerCommand("_workbench.addToRecentlyOpened",async function(e,t){let i,o=e.get(tC.IWorkspacesService),r=t.uri,s=t.label,n=t.remoteAuthority;return i="workspace"===t.type?{workspace:await o.getWorkspaceIdentifier(r),label:s,remoteAuthority:n}:"folder"===t.type?{folderUri:r,label:s,remoteAuthority:n}:{fileUri:r,label:s,remoteAuthority:n},o.addRecentlyOpened([i])}),eq.CommandsRegistry.registerCommand("_workbench.getRecentlyOpened",async function(e){return e.get(tC.IWorkspacesService).getRecentlyOpened()});var tI=Z,tD=e.i(856884),tT=e.i(74304),tA=e.i(772383),tx=e.i(777997);let tR=(0,X.localize2)(2957,"Workspaces");class tk extends tI.Action2{static{this.ID="workbench.action.files.openFile"}constructor(){super({id:tk.ID,title:(0,X.localize2)(2958,"Open File..."),category:J.Categories.File,f1:!0,keybinding:{when:tx.IsMacNativeContext.toNegated(),weight:eI.KeybindingWeight.WorkbenchContrib,primary:e_.KeyMod.CtrlCmd|e_.KeyCode.KeyO}})}async run(e,t){return e.get(tv.IFileDialogService).pickFileAndOpen({forceNewWindow:!1,telemetryExtraData:t})}}class tM extends tI.Action2{static{this.ID="workbench.action.files.openFolder"}constructor(){super({id:tM.ID,title:(0,X.localize2)(2959,"Open Folder..."),category:J.Categories.File,f1:!0,precondition:tD.OpenFolderWorkspaceSupportContext,keybinding:{weight:eI.KeybindingWeight.WorkbenchContrib,primary:void 0,linux:{primary:(0,e_.KeyChord)(e_.KeyMod.CtrlCmd|e_.KeyCode.KeyK,e_.KeyMod.CtrlCmd|e_.KeyCode.KeyO)},win:{primary:(0,e_.KeyChord)(e_.KeyMod.CtrlCmd|e_.KeyCode.KeyK,e_.KeyMod.CtrlCmd|e_.KeyCode.KeyO)}}})}async run(e,t){return e.get(tv.IFileDialogService).pickFolderAndOpen({forceNewWindow:!1,telemetryExtraData:t})}}class tL extends tI.Action2{static{this.ID="workbench.action.files.openFolderViaWorkspace"}constructor(){super({id:tL.ID,title:(0,X.localize2)(2959,"Open Folder..."),category:J.Categories.File,f1:!0,precondition:eT.ContextKeyExpr.and(tD.OpenFolderWorkspaceSupportContext.toNegated(),tD.WorkbenchStateContext.isEqualTo("workspace")),keybinding:{weight:eI.KeybindingWeight.WorkbenchContrib,primary:e_.KeyMod.CtrlCmd|e_.KeyCode.KeyO}})}run(e){return e.get(eD.ICommandService).executeCommand(tS)}}class tO extends tI.Action2{static{this.ID="workbench.action.files.openFileFolder"}static{this.LABEL=(0,X.localize2)(2960,"Open...")}constructor(){super({id:tO.ID,title:tO.LABEL,category:J.Categories.File,f1:!0,precondition:eT.ContextKeyExpr.and(tx.IsMacNativeContext,tD.OpenFolderWorkspaceSupportContext),keybinding:{weight:eI.KeybindingWeight.WorkbenchContrib,primary:e_.KeyMod.CtrlCmd|e_.KeyCode.KeyO}})}async run(e,t){return e.get(tv.IFileDialogService).pickFileFolderAndOpen({forceNewWindow:!1,telemetryExtraData:t})}}class tP extends tI.Action2{static{this.ID="workbench.action.openWorkspace"}constructor(){super({id:tP.ID,title:(0,X.localize2)(2961,"Open Workspace from File..."),category:J.Categories.File,f1:!0,precondition:tD.EnterMultiRootWorkspaceSupportContext})}async run(e,t){return e.get(tv.IFileDialogService).pickWorkspaceAndOpen({telemetryExtraData:t})}}class tV extends tI.Action2{static{this.ID="workbench.action.closeFolder"}constructor(){super({id:tV.ID,title:(0,X.localize2)(2962,"Close Workspace"),category:tR,f1:!0,precondition:eT.ContextKeyExpr.and(tD.WorkbenchStateContext.notEqualsTo("empty"),tD.EmptyWorkspaceSupportContext),keybinding:{weight:eI.KeybindingWeight.WorkbenchContrib,primary:(0,e_.KeyChord)(e_.KeyMod.CtrlCmd|e_.KeyCode.KeyK,e_.KeyCode.KeyF)}})}async run(e){let t=e.get(tT.IHostService),i=e.get(tA.IWorkbenchEnvironmentService);return t.openWindow({forceReuseWindow:!0,remoteAuthority:i.remoteAuthority})}}class tK extends tI.Action2{static{this.ID="workbench.action.openWorkspaceConfigFile"}constructor(){super({id:tK.ID,title:(0,X.localize2)(2963,"Open Workspace Configuration File"),category:tR,f1:!0,precondition:tD.WorkbenchStateContext.isEqualTo("workspace")})}async run(e){let t=e.get(ts.IWorkspaceContextService),i=e.get(eo.IEditorService),o=t.getWorkspace().configuration;o&&await i.openEditor({resource:o,options:{pinned:!0}})}}class tN extends tI.Action2{static{this.ID="workbench.action.addRootFolder"}constructor(){super({id:tN.ID,title:tf,category:tR,f1:!0,precondition:eT.ContextKeyExpr.or(tD.EnterMultiRootWorkspaceSupportContext,tD.WorkbenchStateContext.isEqualTo("workspace"))})}run(e){return e.get(eD.ICommandService).executeCommand(tw)}}class tG extends tI.Action2{static{this.ID="workbench.action.removeRootFolder"}constructor(){super({id:tG.ID,title:(0,X.localize2)(2964,"Remove Folder from Workspace..."),category:tR,f1:!0,precondition:eT.ContextKeyExpr.and(tD.WorkspaceFolderCountContext.notEqualsTo("0"),eT.ContextKeyExpr.or(tD.EnterMultiRootWorkspaceSupportContext,tD.WorkbenchStateContext.isEqualTo("workspace")))})}async run(e){let t=e.get(eD.ICommandService),i=e.get(tn.IWorkspaceEditingService),o=await t.executeCommand(t_);o&&await i.removeFolders([o.uri])}}class tF extends tI.Action2{static{this.ID="workbench.action.saveWorkspaceAs"}constructor(){super({id:tF.ID,title:(0,X.localize2)(2965,"Save Workspace As..."),category:tR,f1:!0,precondition:tD.EnterMultiRootWorkspaceSupportContext})}async run(e){let t=e.get(tn.IWorkspaceEditingService),i=e.get(ts.IWorkspaceContextService),o=await t.pickNewWorkspacePath();if(o&&(0,tr.hasWorkspaceFileExtension)(o))switch(i.getWorkbenchState()){case tr.WorkbenchState.EMPTY:case tr.WorkbenchState.FOLDER:{let e=i.getWorkspace().folders.map(e=>({uri:e.uri}));return t.createAndEnterWorkspace(e,o)}case tr.WorkbenchState.WORKSPACE:return t.saveAndEnterWorkspace(o)}}}class tW extends tI.Action2{static{this.ID="workbench.action.duplicateWorkspaceInNewWindow"}constructor(){super({id:tW.ID,title:(0,X.localize2)(2966,"Duplicate As Workspace in New Window"),category:tR,f1:!0,precondition:tD.EnterMultiRootWorkspaceSupportContext})}async run(e){let t=e.get(ts.IWorkspaceContextService),i=e.get(tn.IWorkspaceEditingService),o=e.get(tT.IHostService),r=e.get(tC.IWorkspacesService),s=e.get(tA.IWorkbenchEnvironmentService),n=t.getWorkspace().folders,a=s.remoteAuthority,d=await r.createUntitledWorkspace(n,a);return await i.copyWorkspaceSettings(d),o.openWindow([{workspaceUri:d.configPath}],{forceNewWindow:!0,remoteAuthority:a})}}(0,tI.registerAction2)(tN),(0,tI.registerAction2)(tG),(0,tI.registerAction2)(tk),(0,tI.registerAction2)(tM),(0,tI.registerAction2)(tL),(0,tI.registerAction2)(tO),(0,tI.registerAction2)(tP),(0,tI.registerAction2)(tK),(0,tI.registerAction2)(tV),(0,tI.registerAction2)(tF),(0,tI.registerAction2)(tW),tI.MenuRegistry.appendMenuItem(tI.MenuId.MenubarFileMenu,{group:"2_open",command:{id:tk.ID,title:(0,X.localize)(2967,"&&Open File...")},order:1,when:tx.IsMacNativeContext.toNegated()}),tI.MenuRegistry.appendMenuItem(tI.MenuId.MenubarFileMenu,{group:"2_open",command:{id:tM.ID,title:(0,X.localize)(2968,"Open &&Folder...")},order:2,when:tD.OpenFolderWorkspaceSupportContext}),tI.MenuRegistry.appendMenuItem(tI.MenuId.MenubarFileMenu,{group:"2_open",command:{id:tL.ID,title:(0,X.localize)(2968,"Open &&Folder...")},order:2,when:eT.ContextKeyExpr.and(tD.OpenFolderWorkspaceSupportContext.toNegated(),tD.WorkbenchStateContext.isEqualTo("workspace"))}),tI.MenuRegistry.appendMenuItem(tI.MenuId.MenubarFileMenu,{group:"2_open",command:{id:tO.ID,title:(0,X.localize)(2969,"&&Open...")},order:1,when:eT.ContextKeyExpr.and(tx.IsMacNativeContext,tD.OpenFolderWorkspaceSupportContext)}),tI.MenuRegistry.appendMenuItem(tI.MenuId.MenubarFileMenu,{group:"2_open",command:{id:tP.ID,title:(0,X.localize)(2970,"Open Wor&&kspace from File...")},order:3,when:tD.EnterMultiRootWorkspaceSupportContext}),tI.MenuRegistry.appendMenuItem(tI.MenuId.MenubarFileMenu,{group:"3_workspace",command:{id:tw,title:(0,X.localize)(2971,"A&&dd Folder to Workspace...")},when:eT.ContextKeyExpr.or(tD.EnterMultiRootWorkspaceSupportContext,tD.WorkbenchStateContext.isEqualTo("workspace")),order:1}),tI.MenuRegistry.appendMenuItem(tI.MenuId.MenubarFileMenu,{group:"3_workspace",command:{id:tF.ID,title:(0,X.localize)(2972,"Save Workspace As...")},order:2,when:tD.EnterMultiRootWorkspaceSupportContext}),tI.MenuRegistry.appendMenuItem(tI.MenuId.MenubarFileMenu,{group:"3_workspace",command:{id:tW.ID,title:(0,X.localize)(2973,"Duplicate Workspace")},order:3,when:tD.EnterMultiRootWorkspaceSupportContext}),tI.MenuRegistry.appendMenuItem(tI.MenuId.MenubarFileMenu,{group:"6_close",command:{id:tV.ID,title:(0,X.localize)(2974,"Close &&Folder")},order:3,when:eT.ContextKeyExpr.and(tD.WorkbenchStateContext.isEqualTo("folder"),tD.EmptyWorkspaceSupportContext)}),tI.MenuRegistry.appendMenuItem(tI.MenuId.MenubarFileMenu,{group:"6_close",command:{id:tV.ID,title:(0,X.localize)(2975,"Close &&Workspace")},order:3,when:eT.ContextKeyExpr.and(tD.WorkbenchStateContext.isEqualTo("workspace"),tD.EmptyWorkspaceSupportContext)}),e.i(316291);var tz={"vs/workbench/contrib/debug/browser/media/continue-tb.png":new e.U(e.r(928565)).href,"vs/workbench/contrib/debug/browser/media/pause-tb.png":new e.U(e.r(235929)).href,"vs/workbench/contrib/debug/browser/media/restart-tb.png":new e.U(e.r(299e3)).href,"vs/workbench/contrib/debug/browser/media/run-with-debugging-tb.png":new e.U(e.r(553072)).href,"vs/workbench/contrib/debug/browser/media/stepinto-tb.png":new e.U(e.r(858636)).href,"vs/workbench/contrib/debug/browser/media/stepout-tb.png":new e.U(e.r(904800)).href,"vs/workbench/contrib/debug/browser/media/stepover-tb.png":new e.U(e.r(352833)).href,"vs/workbench/contrib/debug/browser/media/stop-tb.png":new e.U(e.r(132850)).href};(0,H.registerAssets)(tz),e.i(900340),(0,H.registerAssets)({"vs/workbench/contrib/webview/browser/pre/service-worker.js":()=>(0,U.changeUrlDomain)(new e.U(e.r(23537)).href,t),"vs/workbench/contrib/webview/browser/pre/index.html":()=>(0,U.changeUrlDomain)(new e.U(e.r(331223)).href,t),"vs/workbench/contrib/webview/browser/pre/fake.html":()=>(0,U.changeUrlDomain)(new e.U(e.r(217486)).href,t)}),(0,$.registerServiceInitializePostParticipant)(async e=>{e.get(w.IHistoryService)}),e.s(["default",0,function(e){return null!=e&&(t=e),{...(0,B.default)(),[P.IViewsService.toString()]:new i.SyncDescriptor(V.ViewsService,[],!1),[o.IViewDescriptorService.toString()]:new i.SyncDescriptor(r.ViewDescriptorService,[],!0),[s.IActivityService.toString()]:new i.SyncDescriptor(n.ActivityService,[],!0),[a.IPaneCompositePartService.toString()]:new i.SyncDescriptor(M.PaneCompositePartService,[],!0),[g.ICodeEditorService.toString()]:new i.SyncDescriptor(y.CodeEditorService,[],!0),[v.ITextEditorService.toString()]:new i.SyncDescriptor(m.TextEditorService,[],!1),[d.IEditorResolverService.toString()]:new i.SyncDescriptor(l.EditorResolverService,[],!1),[h.IBreadcrumbsService.toString()]:new i.SyncDescriptor(c.BreadcrumbsService,[],!0),[u.IContextViewService.toString()]:new i.SyncDescriptor(p.ContextViewService,[],!0),[b.IUntitledTextEditorService.toString()]:new i.SyncDescriptor(C.UntitledTextEditorService,[],!0),[w.IHistoryService.toString()]:new i.SyncDescriptor(f.HistoryService,[],!1),[S.ICustomEditorService.toString()]:new i.SyncDescriptor(_.CustomEditorService,[],!0),[T.IWebviewService.toString()]:new i.SyncDescriptor(E.WebviewService,[],!0),[x.IWebviewViewService.toString()]:new i.SyncDescriptor(A.WebviewViewService,[],!0),[D.IWebviewWorkbenchService.toString()]:new i.SyncDescriptor(I.WebviewEditorService,[],!0),[R.IProgressService.toString()]:new i.SyncDescriptor(k.ProgressService,[],!0),[O.IAuxiliaryWindowService.toString()]:new i.SyncDescriptor(L.BrowserAuxiliaryWindowService,[],!0),[K.IEditorPaneService.toString()]:new i.SyncDescriptor(N.EditorPaneService,[],!0),[F.ICustomEditorLabelService.toString()]:new i.SyncDescriptor(G.CustomEditorLabelService,[],!0),[z.IActionViewItemService.toString()]:new i.SyncDescriptor(W.ActionViewItemService,[],!0)}}],765129);var tB=e.i(502930),tU=e.i(621826),tH=e.i(443483),t$=e.i(155652);e.i(781112);var tq=e.i(456076),tY=Z,tj=e.i(93114),tX=e.i(739942),tJ=e.i(140889),tZ=e.i(970672),tQ=e.i(46373),t0=e.i(535567),t1=e.i(920042);e.i(240159),e.i(243529),e.i(83190);var t2=e.i(487106);e.i(976098);var t3=e.i(861593);class t5 extends tX.EditorPane{constructor(e,t){super(e,t,t2.StandaloneServices.get(eb.ITelemetryService),t2.StandaloneServices.get(tZ.IThemeService),t2.StandaloneServices.get(tJ.IStorageService))}}class t6 extends tq.EditorInput{constructor(e,t){super(),this.closeHandler=t,this.dirty=!1,this._capabilities=0,this.resource=e}get capabilities(){return this._capabilities}addCapability(e){this._capabilities|=e,this._onDidChangeCapabilities.fire()}removeCapability(e){this._capabilities&=~e,this._onDidChangeCapabilities.fire()}get editorId(){return this.typeId}setName(e){this.name=e,this._onDidChangeLabel.fire()}setTitle(e){this.title=e,this._onDidChangeLabel.fire()}setDescription(e){this.description=e,this._onDidChangeLabel.fire()}getLabelValue(e,t){if("string"==typeof e)return e;switch(t){case et.Verbosity.SHORT:return e.short;case et.Verbosity.LONG:return e.long;case et.Verbosity.MEDIUM:default:return e.medium}}getName(){return this.name??"Unnamed"}getTitle(e){return this.getLabelValue(this.title??this.getName(),e)}getDescription(e){return this.getLabelValue(this.description??this.getName(),e)}isDirty(){return this.dirty}setDirty(e){this.dirty=e,this._onDidChangeDirty.fire()}toUntyped(){if(null!=this.resource)return{resource:this.resource}}}let t4=tU.Registry.as(te.Extensions.ViewContainersRegistry),t9=tU.Registry.as(te.Extensions.ViewsRegistry);e.s(["EditorPane",0,t5,"SimpleEditorInput",0,t6,"SimpleEditorPane",0,class extends t5{constructor(){super(...arguments),this.inputDisposable=this._register(new j.MutableDisposable)}createEditor(e){this.container=this.initialize(),this.wrapper=document.createElement("div"),this.wrapper.append(this.container),this.scrollbar=this._register(new tQ.DomScrollableElement(this.wrapper,{horizontal:t1.ScrollbarVisibility.Auto,vertical:t1.ScrollbarVisibility.Auto})),e.appendChild(this.scrollbar.getDomNode());let t=new ResizeObserver(()=>{(0,t0.assertReturnsDefined)(this.scrollbar).scanDomNode()});t.observe(this.container),this._register({dispose(){t.disconnect()}})}async setInput(e,t,i,o){await super.setInput(e,t,i,o),o.isCancellationRequested||(this.inputDisposable.value=await this.renderInput?.(e,t,i,o),(0,t0.assertReturnsDefined)(this.scrollbar).scanDomNode())}layout(e){let[t,i]=(0,t0.assertReturnsAllDefined)(this.wrapper,this.scrollbar);(0,ec.size)(t,e.width,e.height),i.scanDomNode()}focus(){(0,t0.assertReturnsDefined)(this.container).focus()}clearInput(){this.inputDisposable.clear(),super.clearInput()}},"getPanelPosition",0,function(){return t2.StandaloneServices.get(ed.IWorkbenchLayoutService).getPanelPosition()},"getSideBarPosition",0,function(){return t2.StandaloneServices.get(ed.IWorkbenchLayoutService).getSideBarPosition()},"isPartVisibile",0,function(e){return t2.StandaloneServices.get(ed.IWorkbenchLayoutService).isVisible(e,window)},"onDidChangePanelPosition",0,e=>t2.StandaloneServices.get(ed.IWorkbenchLayoutService).onDidChangePanelPosition(e),"onDidChangeSideBarPosition",0,e=>t2.StandaloneServices.get(ed.IWorkbenchLayoutService).onDidChangeSideBarPosition(e),"registerCustomView",0,function(e){let t=null!=e.icon?ef.URI.parse(e.icon):void 0,o=e.viewContainer??t4.registerViewContainer({id:e.id,title:{value:e.name,original:e.name},order:e.order,ctorDescriptor:new i.SyncDescriptor(tH.ViewPaneContainer,[e.id,{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,icon:t},e.location,{isDefault:e.default}),r=[{id:e.id,name:{value:e.name,original:e.name},ctorDescriptor:new i.SyncDescriptor(class extends tB.ViewPane{renderBody(t){super.renderBody(t),this.wrapper=document.createElement("div"),this.scrollbar=this._register(new tQ.DomScrollableElement(this.wrapper,{horizontal:t1.ScrollbarVisibility.Auto,vertical:t1.ScrollbarVisibility.Auto})),this.container=(0,ec.$)(".view-pane-content"),this.container.style.display="flex",this.container.style.alignItems="stretch",this._register(e.renderBody(this.container,this.scrollbar)),this.wrapper.append(this.container),t.appendChild(this.scrollbar.getDomNode());let i=new ResizeObserver(()=>{(0,t0.assertReturnsDefined)(this.scrollbar).scanDomNode()});i.observe(this.container),this._register({dispose(){i.disconnect()}})}layoutBody(e,t){let[i,o]=(0,t0.assertReturnsAllDefined)(this.wrapper,this.scrollbar);(0,ec.size)(i,t,e),o.scanDomNode()}}),canMoveView:e.canMoveView??!0,canToggleVisibility:e.canToggleVisibility??!1,hideByDefault:e.hideByDefault??!1,collapsed:e.collapsed??!1,order:e.order,containerIcon:t}];t9.registerViews(r,o);let s=new j.DisposableStore;for(let t of(s.add({dispose(){t9.deregisterViews(r,o),null==e.viewContainer&&t4.deregisterViewContainer(o)}}),e.actions??[]))s.add((0,tY.registerAction2)(class extends tY.Action2{constructor(){super({id:t.id,title:{value:t.title,original:t.title},category:J.Categories.View,menu:[{id:tY.MenuId.ViewTitle,when:eT.ContextKeyExpr.equals("view",e.id),group:"navigation",order:t.order},{id:tY.MenuId.CommandPalette}],tooltip:t.tooltip,icon:null!=t.icon?t$.Codicon[t.icon]:void 0}),this.run=t.run??(async()=>{})}}));return s},"registerEditor",0,function(e,t,i,o){return(0,t3.withReadyServices)(r=>r.get(d.IEditorResolverService).registerEditor(e,t,i,o))},"registerEditorPane",0,function(e,t,o,r){return tU.Registry.as(et.EditorExtensions.EditorPane).registerEditorPane(tj.EditorPaneDescriptor.create(o,e,t),r.map(e=>new i.SyncDescriptor(e)))},"registerEditorSerializer",0,function(e,t){return tU.Registry.as(et.EditorExtensions.EditorFactory).registerEditorSerializer(e,t)},"setPartVisibility",0,function(e,t){t2.StandaloneServices.get(ed.IWorkbenchLayoutService).setPartHidden(!t,e)},"viewContainerRegistry",0,t4,"viewRegistry",0,t9],490499)}]);