@hyperpuncher/pi-ui 0.38.2

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 (448) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +161 -0
  3. package/dist/npm/server-main.js +633 -0
  4. package/package.json +77 -0
  5. package/static/app/attachment-file.js +99 -0
  6. package/static/app/basecoat.js +57 -0
  7. package/static/app/code-copy.js +32 -0
  8. package/static/app/dialogs.js +153 -0
  9. package/static/app/display-refresh.js +125 -0
  10. package/static/app/display-refresh_test.ts +86 -0
  11. package/static/app/file-links.js +69 -0
  12. package/static/app/file-links_test.ts +13 -0
  13. package/static/app/file-transfer.js +463 -0
  14. package/static/app/file-transfer_test.ts +174 -0
  15. package/static/app/main.js +122 -0
  16. package/static/app/message-scroll.js +343 -0
  17. package/static/app/message-scroll_test.ts +28 -0
  18. package/static/app/model-search.js +37 -0
  19. package/static/app/model-search_test.ts +31 -0
  20. package/static/app/pickers.js +289 -0
  21. package/static/app/pickers_test.ts +40 -0
  22. package/static/app/prompt-history.js +100 -0
  23. package/static/app/prompt-history_test.ts +51 -0
  24. package/static/app/prompt.js +99 -0
  25. package/static/app/session-performance.js +56 -0
  26. package/static/app/vim-scroll.js +161 -0
  27. package/static/app/window-focus.js +43 -0
  28. package/static/app/window-focus_test.ts +83 -0
  29. package/static/app.css +2 -0
  30. package/static/basecoat.vendor.js +1 -0
  31. package/static/build/chunks/abap-sc56dbra.js +1 -0
  32. package/static/build/chunks/actionscript-3-8wkk0yve.js +1 -0
  33. package/static/build/chunks/ada-wkh6yxhp.js +1 -0
  34. package/static/build/chunks/ahk-vk45ms9x.js +1 -0
  35. package/static/build/chunks/ahk2-ap9fnbvc.js +1 -0
  36. package/static/build/chunks/andromeeda-zy6mvqwb.js +1 -0
  37. package/static/build/chunks/angular-html-61dpttc3.js +1 -0
  38. package/static/build/chunks/angular-ts-hwtqv276.js +1 -0
  39. package/static/build/chunks/apache-750k8mss.js +1 -0
  40. package/static/build/chunks/apex-vpts0jxm.js +1 -0
  41. package/static/build/chunks/apl-jkh6rwt8.js +1 -0
  42. package/static/build/chunks/applescript-zb2jfj46.js +1 -0
  43. package/static/build/chunks/ara-4yjpz89z.js +1 -0
  44. package/static/build/chunks/asciidoc-5xj8s3ay.js +1 -0
  45. package/static/build/chunks/asm-x6ejak5x.js +1 -0
  46. package/static/build/chunks/astro-9cd9b7yr.js +1 -0
  47. package/static/build/chunks/aurora-x-gp6v3669.js +1 -0
  48. package/static/build/chunks/awk-mpdee6bv.js +1 -0
  49. package/static/build/chunks/ayu-dark-hbtcbdtr.js +1 -0
  50. package/static/build/chunks/ayu-light-m7rwwssv.js +1 -0
  51. package/static/build/chunks/ayu-mirage-5z71k1jj.js +1 -0
  52. package/static/build/chunks/ballerina-7c4wt1p4.js +1 -0
  53. package/static/build/chunks/bat-9778z743.js +1 -0
  54. package/static/build/chunks/beancount-xs0qfpeg.js +1 -0
  55. package/static/build/chunks/berry-pmbyf94p.js +1 -0
  56. package/static/build/chunks/bibtex-nnkgf3bz.js +1 -0
  57. package/static/build/chunks/bicep-vqhsh01p.js +1 -0
  58. package/static/build/chunks/bird2-za6bpr1n.js +1 -0
  59. package/static/build/chunks/blade-s6ew6vqn.js +1 -0
  60. package/static/build/chunks/bsl-z36cmzeg.js +1 -0
  61. package/static/build/chunks/c-kmp7y11e.js +1 -0
  62. package/static/build/chunks/c3-1g0cgjqv.js +1 -0
  63. package/static/build/chunks/cadence-a23a7f13.js +1 -0
  64. package/static/build/chunks/cairo-r6vd4awx.js +1 -0
  65. package/static/build/chunks/catppuccin-frappe-05b7n5ms.js +1 -0
  66. package/static/build/chunks/catppuccin-latte-c7x59n84.js +1 -0
  67. package/static/build/chunks/catppuccin-macchiato-xq6zfjrk.js +1 -0
  68. package/static/build/chunks/catppuccin-mocha-xreqmgt9.js +1 -0
  69. package/static/build/chunks/chapel-717mc8q1.js +1 -0
  70. package/static/build/chunks/clarity-g6gq1dzn.js +1 -0
  71. package/static/build/chunks/clojure-pm54sv44.js +1 -0
  72. package/static/build/chunks/cmake-f1skxqyd.js +1 -0
  73. package/static/build/chunks/cobol-mys3qens.js +1 -0
  74. package/static/build/chunks/code-theme-y49p9zss.js +5 -0
  75. package/static/build/chunks/codeowners-1ys5r05d.js +1 -0
  76. package/static/build/chunks/codeql-tdw0bqwy.js +1 -0
  77. package/static/build/chunks/coffee-t9hejzk2.js +1 -0
  78. package/static/build/chunks/common-lisp-9hjzm22t.js +1 -0
  79. package/static/build/chunks/coq-fjr6d63p.js +1 -0
  80. package/static/build/chunks/cpp-1r5860gr.js +1 -0
  81. package/static/build/chunks/crystal-a1jynptt.js +1 -0
  82. package/static/build/chunks/csharp-4zp5c1yn.js +1 -0
  83. package/static/build/chunks/css-j5q0mhnm.js +1 -0
  84. package/static/build/chunks/csv-a39nx9ry.js +1 -0
  85. package/static/build/chunks/cue-tg9vgj1q.js +1 -0
  86. package/static/build/chunks/cypher-p1j7vh0k.js +1 -0
  87. package/static/build/chunks/d-1f7cc6re.js +1 -0
  88. package/static/build/chunks/dark-plus-zvzcxs8s.js +1 -0
  89. package/static/build/chunks/dart-8jekq66r.js +1 -0
  90. package/static/build/chunks/dax-2aph6zqg.js +1 -0
  91. package/static/build/chunks/desktop-fqy4qx2w.js +1 -0
  92. package/static/build/chunks/diff-hqj2qf6m.js +1 -0
  93. package/static/build/chunks/docker-cht4a1ht.js +1 -0
  94. package/static/build/chunks/dotenv-txd2x2vy.js +1 -0
  95. package/static/build/chunks/dracula-6abcnchd.js +1 -0
  96. package/static/build/chunks/dracula-soft-zyfsdrw6.js +1 -0
  97. package/static/build/chunks/dream-maker-0gsm31aq.js +1 -0
  98. package/static/build/chunks/edge-9h036g3s.js +1 -0
  99. package/static/build/chunks/elixir-7pyn80vc.js +1 -0
  100. package/static/build/chunks/elm-62v0vnec.js +1 -0
  101. package/static/build/chunks/emacs-lisp-58kh6hv8.js +1 -0
  102. package/static/build/chunks/erb-947psegf.js +1 -0
  103. package/static/build/chunks/erlang-vbf5hbwd.js +1 -0
  104. package/static/build/chunks/everforest-dark-g7rhmq33.js +1 -0
  105. package/static/build/chunks/everforest-light-spn7qghr.js +1 -0
  106. package/static/build/chunks/fennel-h323g5dt.js +1 -0
  107. package/static/build/chunks/fish-7qbmmjce.js +1 -0
  108. package/static/build/chunks/fluent-3sdffhr3.js +1 -0
  109. package/static/build/chunks/fonts-pcnzbv4q.js +1 -0
  110. package/static/build/chunks/fortran-fixed-form-azemmg4k.js +1 -0
  111. package/static/build/chunks/fortran-free-form-5njt96mh.js +1 -0
  112. package/static/build/chunks/fsharp-9eex114p.js +1 -0
  113. package/static/build/chunks/gdresource-v8yzpggb.js +1 -0
  114. package/static/build/chunks/gdscript-1snw12w7.js +1 -0
  115. package/static/build/chunks/gdshader-fmknssp0.js +1 -0
  116. package/static/build/chunks/genie-4gwgqcc6.js +1 -0
  117. package/static/build/chunks/gherkin-vjt0p14p.js +1 -0
  118. package/static/build/chunks/git-commit-z15avpkz.js +1 -0
  119. package/static/build/chunks/git-rebase-wj5kdx44.js +1 -0
  120. package/static/build/chunks/github-dark-default-q5m3jmep.js +1 -0
  121. package/static/build/chunks/github-dark-dimmed-0v34f529.js +1 -0
  122. package/static/build/chunks/github-dark-high-contrast-62grsqa6.js +1 -0
  123. package/static/build/chunks/github-dark-r3j6b7er.js +1 -0
  124. package/static/build/chunks/github-light-default-xgca5we2.js +1 -0
  125. package/static/build/chunks/github-light-high-contrast-0ee3g9rt.js +1 -0
  126. package/static/build/chunks/github-light-z1qp6zt5.js +1 -0
  127. package/static/build/chunks/gleam-znte7hjc.js +1 -0
  128. package/static/build/chunks/glimmer-js-nph8hwdq.js +1 -0
  129. package/static/build/chunks/glimmer-ts-fzpx4w3e.js +1 -0
  130. package/static/build/chunks/glsl-mzc3yta4.js +1 -0
  131. package/static/build/chunks/gn-3cqh8dtz.js +1 -0
  132. package/static/build/chunks/gnuplot-r8spf6zm.js +1 -0
  133. package/static/build/chunks/go-ac27dc57.js +1 -0
  134. package/static/build/chunks/graphql-f6vq7p23.js +1 -0
  135. package/static/build/chunks/groovy-p8r8bd0c.js +1 -0
  136. package/static/build/chunks/gruvbox-dark-hard-0zvxnx0e.js +1 -0
  137. package/static/build/chunks/gruvbox-dark-medium-qvjwy81n.js +1 -0
  138. package/static/build/chunks/gruvbox-dark-soft-mhtpt38s.js +1 -0
  139. package/static/build/chunks/gruvbox-light-hard-nrwjbbts.js +1 -0
  140. package/static/build/chunks/gruvbox-light-medium-qbwkw432.js +1 -0
  141. package/static/build/chunks/gruvbox-light-soft-rmkm778k.js +1 -0
  142. package/static/build/chunks/hack-a2wva0c2.js +1 -0
  143. package/static/build/chunks/haml-hmfn055t.js +1 -0
  144. package/static/build/chunks/handlebars-54kh2jwn.js +1 -0
  145. package/static/build/chunks/haskell-vkvkgtsh.js +1 -0
  146. package/static/build/chunks/haxe-yk1p58qs.js +1 -0
  147. package/static/build/chunks/hcl-mq3znmzm.js +1 -0
  148. package/static/build/chunks/hjson-ma7dfjrp.js +1 -0
  149. package/static/build/chunks/hlsl-jcfmchrk.js +1 -0
  150. package/static/build/chunks/horizon-bright-9s4tt51x.js +1 -0
  151. package/static/build/chunks/horizon-fm23m9qj.js +1 -0
  152. package/static/build/chunks/houston-fx2psmvq.js +1 -0
  153. package/static/build/chunks/html-derivative-xw79bbzd.js +1 -0
  154. package/static/build/chunks/html-nawteed7.js +1 -0
  155. package/static/build/chunks/http-72kn3sp8.js +1 -0
  156. package/static/build/chunks/hurl-eve0v3e8.js +1 -0
  157. package/static/build/chunks/hxml-8pcfrsh9.js +1 -0
  158. package/static/build/chunks/hy-989jkx6q.js +1 -0
  159. package/static/build/chunks/imba-cm19z6hg.js +1 -0
  160. package/static/build/chunks/index-gt9ev6v8.js +518 -0
  161. package/static/build/chunks/ini-a7zcn1v0.js +1 -0
  162. package/static/build/chunks/java-mjc9q3md.js +1 -0
  163. package/static/build/chunks/javascript-n8j33v1m.js +1 -0
  164. package/static/build/chunks/jinja-a6q4x5tm.js +1 -0
  165. package/static/build/chunks/jison-nj6cbyz2.js +1 -0
  166. package/static/build/chunks/json-bvza2dkb.js +1 -0
  167. package/static/build/chunks/json5-a53a0ked.js +1 -0
  168. package/static/build/chunks/jsonc-5tyv9mjd.js +1 -0
  169. package/static/build/chunks/jsonl-prv0dcjv.js +1 -0
  170. package/static/build/chunks/jsonnet-5gdjahsx.js +1 -0
  171. package/static/build/chunks/jssm-mwsp2p7j.js +1 -0
  172. package/static/build/chunks/jsx-75v76p5q.js +1 -0
  173. package/static/build/chunks/julia-45twp29b.js +1 -0
  174. package/static/build/chunks/just-ct7367ec.js +1 -0
  175. package/static/build/chunks/kanagawa-dragon-fbqq2bhk.js +1 -0
  176. package/static/build/chunks/kanagawa-lotus-zgxv1mgm.js +1 -0
  177. package/static/build/chunks/kanagawa-wave-wedn0ksa.js +1 -0
  178. package/static/build/chunks/kdl-n6ez9ngv.js +1 -0
  179. package/static/build/chunks/kotlin-ghtz1y98.js +1 -0
  180. package/static/build/chunks/kusto-43yprh9t.js +1 -0
  181. package/static/build/chunks/laserwave-2fz4nxs5.js +1 -0
  182. package/static/build/chunks/latex-httjryda.js +1 -0
  183. package/static/build/chunks/lean-49ww85t0.js +1 -0
  184. package/static/build/chunks/less-47m6fdq2.js +1 -0
  185. package/static/build/chunks/light-plus-5tghbj4b.js +1 -0
  186. package/static/build/chunks/liquid-r4gqgph0.js +1 -0
  187. package/static/build/chunks/llvm-zesbzx6h.js +1 -0
  188. package/static/build/chunks/log-n0g1tx1y.js +1 -0
  189. package/static/build/chunks/logo-j5ze60v0.js +1 -0
  190. package/static/build/chunks/lua-15pct4hw.js +1 -0
  191. package/static/build/chunks/luau-75hm4mxn.js +1 -0
  192. package/static/build/chunks/main-02cnngb2.js +2 -0
  193. package/static/build/chunks/main-06tnp3sh.js +2 -0
  194. package/static/build/chunks/main-0a9vnbak.js +2 -0
  195. package/static/build/chunks/main-0b281zv9.js +2 -0
  196. package/static/build/chunks/main-0nb87rgr.js +2 -0
  197. package/static/build/chunks/main-0w2eqgkm.js +2 -0
  198. package/static/build/chunks/main-1n8jg8rf.js +2 -0
  199. package/static/build/chunks/main-1q6650cv.js +2 -0
  200. package/static/build/chunks/main-1swy7s7h.js +2 -0
  201. package/static/build/chunks/main-1xeedcwa.js +2 -0
  202. package/static/build/chunks/main-2xnnvrcx.js +2 -0
  203. package/static/build/chunks/main-2zhgrhtb.js +2 -0
  204. package/static/build/chunks/main-3r9xmt0z.js +2 -0
  205. package/static/build/chunks/main-3s35k63z.js +2 -0
  206. package/static/build/chunks/main-3srxnktc.js +2 -0
  207. package/static/build/chunks/main-4sa6jbv9.js +2 -0
  208. package/static/build/chunks/main-61mzprk0.js +9 -0
  209. package/static/build/chunks/main-689tj0r4.js +2 -0
  210. package/static/build/chunks/main-6e7tjcht.js +2 -0
  211. package/static/build/chunks/main-6hjptvkk.js +2 -0
  212. package/static/build/chunks/main-6v87p7j0.js +2 -0
  213. package/static/build/chunks/main-77tx7a8q.js +2 -0
  214. package/static/build/chunks/main-7fchxg57.js +7 -0
  215. package/static/build/chunks/main-83kpz2vm.js +2 -0
  216. package/static/build/chunks/main-8vy6mdxc.js +2 -0
  217. package/static/build/chunks/main-98b1m2e8.js +2 -0
  218. package/static/build/chunks/main-9hkj1fvj.js +2 -0
  219. package/static/build/chunks/main-9r4kp1re.js +2 -0
  220. package/static/build/chunks/main-9rd1xskg.js +2 -0
  221. package/static/build/chunks/main-9rh1hxyw.js +2 -0
  222. package/static/build/chunks/main-9v5c2hm4.js +2 -0
  223. package/static/build/chunks/main-aw75bv70.js +2 -0
  224. package/static/build/chunks/main-b1wctdb9.js +2 -0
  225. package/static/build/chunks/main-brrygrcd.js +2 -0
  226. package/static/build/chunks/main-bxkfh3s9.js +2 -0
  227. package/static/build/chunks/main-capt12kv.js +2 -0
  228. package/static/build/chunks/main-cbea0k4t.js +2 -0
  229. package/static/build/chunks/main-cs7592x8.js +2 -0
  230. package/static/build/chunks/main-d04rg092.js +2 -0
  231. package/static/build/chunks/main-d4pbngvb.js +2 -0
  232. package/static/build/chunks/main-d96ygjmk.js +2 -0
  233. package/static/build/chunks/main-dbxf9vvb.js +2 -0
  234. package/static/build/chunks/main-e0bf1hc7.js +2 -0
  235. package/static/build/chunks/main-e1qp4v0e.js +2 -0
  236. package/static/build/chunks/main-ed67cb17.js +2 -0
  237. package/static/build/chunks/main-ef0zm6td.js +2 -0
  238. package/static/build/chunks/main-epkkzhsq.js +2 -0
  239. package/static/build/chunks/main-f1t9zy21.js +2 -0
  240. package/static/build/chunks/main-g4ry2z87.js +2 -0
  241. package/static/build/chunks/main-h9p54b6w.js +2 -0
  242. package/static/build/chunks/main-hp9qyk20.js +2 -0
  243. package/static/build/chunks/main-hv1v7a2c.js +2 -0
  244. package/static/build/chunks/main-jr2gz2ea.js +2 -0
  245. package/static/build/chunks/main-kktqjawn.js +2 -0
  246. package/static/build/chunks/main-knre9pdj.js +2 -0
  247. package/static/build/chunks/main-m9qkdc8e.js +2 -0
  248. package/static/build/chunks/main-mcptmf3e.js +2 -0
  249. package/static/build/chunks/main-mmmydrw7.js +2 -0
  250. package/static/build/chunks/main-mqmtpd6m.js +2 -0
  251. package/static/build/chunks/main-n8b99y0n.js +2 -0
  252. package/static/build/chunks/main-nex51cmy.js +2 -0
  253. package/static/build/chunks/main-nzkzztjw.js +2 -0
  254. package/static/build/chunks/main-p5c2apac.js +2 -0
  255. package/static/build/chunks/main-p8efbnm1.js +2 -0
  256. package/static/build/chunks/main-q9q129d1.js +2 -0
  257. package/static/build/chunks/main-qbf61mtn.js +2 -0
  258. package/static/build/chunks/main-rb1nkcm0.js +2 -0
  259. package/static/build/chunks/main-spgna5r3.js +2 -0
  260. package/static/build/chunks/main-tqpmccz6.js +2 -0
  261. package/static/build/chunks/main-v7n0f428.js +2 -0
  262. package/static/build/chunks/main-v9j8veta.js +2 -0
  263. package/static/build/chunks/main-w5g9070a.js +2 -0
  264. package/static/build/chunks/main-wbpws0v9.js +2 -0
  265. package/static/build/chunks/main-wcnadmhs.js +1530 -0
  266. package/static/build/chunks/main-x61973bh.js +2 -0
  267. package/static/build/chunks/main-xqc8f31a.js +2 -0
  268. package/static/build/chunks/main-xtaq3qt4.js +2 -0
  269. package/static/build/chunks/main-xvgwadfa.js +2 -0
  270. package/static/build/chunks/main-y0dvfpw7.js +2 -0
  271. package/static/build/chunks/main-ynjqm60c.js +2 -0
  272. package/static/build/chunks/main-ypk8hvc0.js +2 -0
  273. package/static/build/chunks/main-zjsthwaz.js +2 -0
  274. package/static/build/chunks/main-zy79z3j0.js +2 -0
  275. package/static/build/chunks/make-82gdkt9b.js +1 -0
  276. package/static/build/chunks/markdown-5tkrg1ah.js +1 -0
  277. package/static/build/chunks/marko-qafrqcsm.js +1 -0
  278. package/static/build/chunks/material-theme-darker-fnv6smqw.js +1 -0
  279. package/static/build/chunks/material-theme-lighter-35th362e.js +1 -0
  280. package/static/build/chunks/material-theme-ocean-4dq3ahw3.js +1 -0
  281. package/static/build/chunks/material-theme-p7k291d1.js +1 -0
  282. package/static/build/chunks/material-theme-palenight-yhd4pmvh.js +1 -0
  283. package/static/build/chunks/matlab-mbnxwt6q.js +1 -0
  284. package/static/build/chunks/mdc-w29armgh.js +1 -0
  285. package/static/build/chunks/mdx-53tq2vwd.js +1 -0
  286. package/static/build/chunks/mermaid-kp8v57t9.js +1 -0
  287. package/static/build/chunks/min-dark-rtx0tqrz.js +1 -0
  288. package/static/build/chunks/min-light-5m66fg5h.js +1 -0
  289. package/static/build/chunks/mipsasm-may8rjf3.js +1 -0
  290. package/static/build/chunks/mojo-ezqmbs71.js +1 -0
  291. package/static/build/chunks/monokai-79awbcqn.js +1 -0
  292. package/static/build/chunks/moonbit-57vh5qgn.js +1 -0
  293. package/static/build/chunks/move-71jrpzz7.js +1 -0
  294. package/static/build/chunks/narrat-n4xxr8p6.js +1 -0
  295. package/static/build/chunks/nextflow-c0gn0hzt.js +1 -0
  296. package/static/build/chunks/nextflow-groovy-13xg49y5.js +1 -0
  297. package/static/build/chunks/nginx-vtb8rwdx.js +1 -0
  298. package/static/build/chunks/night-owl-light-05jd94v7.js +1 -0
  299. package/static/build/chunks/night-owl-y5p2e2yz.js +1 -0
  300. package/static/build/chunks/nim-nfvgqc30.js +1 -0
  301. package/static/build/chunks/nix-rkxmnaat.js +1 -0
  302. package/static/build/chunks/nord-akta5pm4.js +1 -0
  303. package/static/build/chunks/nsis-6c1fw7sy.js +1 -0
  304. package/static/build/chunks/nushell-pvtw3a6j.js +1 -0
  305. package/static/build/chunks/objective-c-jd7171g7.js +1 -0
  306. package/static/build/chunks/objective-cpp-6v7n9hk7.js +1 -0
  307. package/static/build/chunks/ocaml-kjv8t7w5.js +1 -0
  308. package/static/build/chunks/odin-58v0n0xa.js +1 -0
  309. package/static/build/chunks/one-dark-pro-pbp84hvh.js +1 -0
  310. package/static/build/chunks/one-light-jpadzfmm.js +1 -0
  311. package/static/build/chunks/openscad-0xnz3sah.js +1 -0
  312. package/static/build/chunks/org-xe4jzp20.js +1 -0
  313. package/static/build/chunks/pascal-f75emr3j.js +1 -0
  314. package/static/build/chunks/perl-zp07ased.js +1 -0
  315. package/static/build/chunks/php-fjm4srka.js +1 -0
  316. package/static/build/chunks/pierre-dark-2sng8cw6.js +1 -0
  317. package/static/build/chunks/pierre-dark-protanopia-deuteranopia-615mrd5v.js +1 -0
  318. package/static/build/chunks/pierre-dark-soft-xpc8stwc.js +1 -0
  319. package/static/build/chunks/pierre-dark-tritanopia-nw71c9hw.js +1 -0
  320. package/static/build/chunks/pierre-dark-vibrant-dtc0vftx.js +1 -0
  321. package/static/build/chunks/pierre-light-mtkcs9xq.js +1 -0
  322. package/static/build/chunks/pierre-light-protanopia-deuteranopia-d84wh0sh.js +1 -0
  323. package/static/build/chunks/pierre-light-soft-f0vxkd08.js +1 -0
  324. package/static/build/chunks/pierre-light-tritanopia-prpe8fpj.js +1 -0
  325. package/static/build/chunks/pierre-light-vibrant-y1syd51f.js +1 -0
  326. package/static/build/chunks/pkl-x0wayphd.js +1 -0
  327. package/static/build/chunks/plastic-5dg6r26t.js +1 -0
  328. package/static/build/chunks/plsql-259gvzn9.js +1 -0
  329. package/static/build/chunks/po-6kcxkqtd.js +1 -0
  330. package/static/build/chunks/poimandres-p8seewrs.js +1 -0
  331. package/static/build/chunks/polar-b1ev80vb.js +1 -0
  332. package/static/build/chunks/postcss-kxdxws93.js +1 -0
  333. package/static/build/chunks/powerquery-ved4pq1y.js +1 -0
  334. package/static/build/chunks/powershell-6j0w6ann.js +1 -0
  335. package/static/build/chunks/prisma-7r1mj2qq.js +1 -0
  336. package/static/build/chunks/prolog-7a8gwgvm.js +1 -0
  337. package/static/build/chunks/proto-s5e2jd7n.js +1 -0
  338. package/static/build/chunks/pug-8cxb8b6f.js +1 -0
  339. package/static/build/chunks/puppet-d1048c00.js +1 -0
  340. package/static/build/chunks/purescript-vqffe1a1.js +1 -0
  341. package/static/build/chunks/python-7z2eacwy.js +1 -0
  342. package/static/build/chunks/qml-51nrq0re.js +1 -0
  343. package/static/build/chunks/qmldir-q0jk1gzg.js +1 -0
  344. package/static/build/chunks/qss-6far86jw.js +1 -0
  345. package/static/build/chunks/r-qkm8ck5x.js +1 -0
  346. package/static/build/chunks/racket-mzbdy2fp.js +1 -0
  347. package/static/build/chunks/raku-se52tvjp.js +1 -0
  348. package/static/build/chunks/razor-y9b1j8td.js +1 -0
  349. package/static/build/chunks/rbs-00y9vc5r.js +1 -0
  350. package/static/build/chunks/red-tkj5bw1z.js +1 -0
  351. package/static/build/chunks/reg-9z4ax2nc.js +1 -0
  352. package/static/build/chunks/regexp-99svsrmp.js +1 -0
  353. package/static/build/chunks/rel-tf2jya2v.js +1 -0
  354. package/static/build/chunks/riscv-hpebp724.js +1 -0
  355. package/static/build/chunks/ron-s3mfhwnh.js +1 -0
  356. package/static/build/chunks/rose-pine-dawn-apmj5y1p.js +1 -0
  357. package/static/build/chunks/rose-pine-moon-mgx7zgjy.js +1 -0
  358. package/static/build/chunks/rose-pine-vgbee1jh.js +1 -0
  359. package/static/build/chunks/rosmsg-vgsgfpe4.js +1 -0
  360. package/static/build/chunks/rst-xnf3rrzd.js +1 -0
  361. package/static/build/chunks/ruby-gysj44ty.js +1 -0
  362. package/static/build/chunks/rust-bzv74qkx.js +1 -0
  363. package/static/build/chunks/sas-t4zftd7j.js +1 -0
  364. package/static/build/chunks/sass-tnsj7t5t.js +1 -0
  365. package/static/build/chunks/scala-vsjg5eg2.js +1 -0
  366. package/static/build/chunks/scheme-yhv7mnk9.js +1 -0
  367. package/static/build/chunks/scss-vt2fyer8.js +1 -0
  368. package/static/build/chunks/sdbl-jv670bae.js +1 -0
  369. package/static/build/chunks/shaderlab-csszkf9s.js +1 -0
  370. package/static/build/chunks/shellscript-t3jf42zg.js +1 -0
  371. package/static/build/chunks/shellsession-e1m2zj1m.js +1 -0
  372. package/static/build/chunks/slack-dark-ntnagayj.js +1 -0
  373. package/static/build/chunks/slack-ochin-kge218j8.js +1 -0
  374. package/static/build/chunks/smalltalk-q8bgts0p.js +1 -0
  375. package/static/build/chunks/smithy-m7r7jeg3.js +1 -0
  376. package/static/build/chunks/snazzy-light-57mzezsa.js +1 -0
  377. package/static/build/chunks/solarized-dark-0r80rpr7.js +1 -0
  378. package/static/build/chunks/solarized-light-1e0p6z46.js +1 -0
  379. package/static/build/chunks/solidity-vb1zcsry.js +1 -0
  380. package/static/build/chunks/soy-bzh2aynk.js +1 -0
  381. package/static/build/chunks/sparql-6t8g6rdd.js +1 -0
  382. package/static/build/chunks/splunk-50bpjgv6.js +1 -0
  383. package/static/build/chunks/sql-kkaf039q.js +1 -0
  384. package/static/build/chunks/ssh-config-715bkrac.js +1 -0
  385. package/static/build/chunks/stata-zhvjkw4g.js +1 -0
  386. package/static/build/chunks/stylus-b8aj4z6s.js +1 -0
  387. package/static/build/chunks/surrealql-4w27b1xf.js +1 -0
  388. package/static/build/chunks/svelte-6vty1ayf.js +1 -0
  389. package/static/build/chunks/swift-2w2k3des.js +1 -0
  390. package/static/build/chunks/synthwave-84-007ndkbp.js +1 -0
  391. package/static/build/chunks/system-verilog-hzg0fpex.js +1 -0
  392. package/static/build/chunks/systemd-d3k4d1av.js +1 -0
  393. package/static/build/chunks/talonscript-fw295t4h.js +1 -0
  394. package/static/build/chunks/tasl-8n3br9kn.js +1 -0
  395. package/static/build/chunks/tcl-e485436v.js +1 -0
  396. package/static/build/chunks/templ-535cbmg6.js +1 -0
  397. package/static/build/chunks/terraform-k8aqghnt.js +1 -0
  398. package/static/build/chunks/tex-9yx3fnmk.js +1 -0
  399. package/static/build/chunks/tokyo-night-rvkd4sna.js +1 -0
  400. package/static/build/chunks/toml-bypjcbh1.js +1 -0
  401. package/static/build/chunks/ts-tags-zyfv802m.js +1 -0
  402. package/static/build/chunks/tsv-2n58sktq.js +1 -0
  403. package/static/build/chunks/tsx-gnkw8sgq.js +1 -0
  404. package/static/build/chunks/turtle-sf93b8kj.js +1 -0
  405. package/static/build/chunks/twig-8gw76pn3.js +1 -0
  406. package/static/build/chunks/typescript-077c9w1h.js +1 -0
  407. package/static/build/chunks/typespec-8r8ncprb.js +1 -0
  408. package/static/build/chunks/typst-yg6690gs.js +1 -0
  409. package/static/build/chunks/v-tdjz29z1.js +1 -0
  410. package/static/build/chunks/vala-trffggt0.js +1 -0
  411. package/static/build/chunks/vb-1dx16kyy.js +1 -0
  412. package/static/build/chunks/verilog-sv7hb60t.js +1 -0
  413. package/static/build/chunks/vesper-005phtef.js +1 -0
  414. package/static/build/chunks/vhdl-qck3dqgh.js +1 -0
  415. package/static/build/chunks/viml-m54vetp0.js +1 -0
  416. package/static/build/chunks/vitesse-black-sxfaa2kz.js +1 -0
  417. package/static/build/chunks/vitesse-dark-fhxvesec.js +1 -0
  418. package/static/build/chunks/vitesse-light-cygqrsgb.js +1 -0
  419. package/static/build/chunks/vue-html-5ex4htv4.js +1 -0
  420. package/static/build/chunks/vue-n8p10w4p.js +1 -0
  421. package/static/build/chunks/vue-vine-y2qnwmqn.js +1 -0
  422. package/static/build/chunks/vyper-r9v6ymtz.js +1 -0
  423. package/static/build/chunks/wasm-c0aw8acq.js +1 -0
  424. package/static/build/chunks/wasm-eftreyx0.js +1 -0
  425. package/static/build/chunks/wenyan-pn35fr2w.js +1 -0
  426. package/static/build/chunks/wgsl-akmafmem.js +1 -0
  427. package/static/build/chunks/wikitext-yp9d6pan.js +1 -0
  428. package/static/build/chunks/wit-rg9t2t2j.js +1 -0
  429. package/static/build/chunks/wolfram-m5vswcfg.js +1 -0
  430. package/static/build/chunks/workspace-review-3scrbyaw.js +1361 -0
  431. package/static/build/chunks/xml-8pftb6y7.js +1 -0
  432. package/static/build/chunks/xsl-w4bvqyjy.js +1 -0
  433. package/static/build/chunks/yaml-a56qt88c.js +1 -0
  434. package/static/build/chunks/zenscript-pp2pffj8.js +1 -0
  435. package/static/build/chunks/zig-53aewpf9.js +1 -0
  436. package/static/build/main.js +6 -0
  437. package/static/build/pierre-worker.js +156 -0
  438. package/static/favicon.svg +1 -0
  439. package/static/file-uri.js +18 -0
  440. package/static/file-uri_test.ts +35 -0
  441. package/static/icon-180.png +0 -0
  442. package/static/icon-192.png +0 -0
  443. package/static/icon-512.png +0 -0
  444. package/static/manifest.webmanifest +23 -0
  445. package/static/notification-icon.png +0 -0
  446. package/static/theme.js +17 -0
  447. package/static/vendor/datastar-inspector.min.js +1021 -0
  448. package/static/vendor/datastar.js +10 -0
@@ -0,0 +1,518 @@
1
+ import{O as ie,da as se,fa as X,ga as ut,ha as ce,ia as le,ja as Ve,ka as Rt,na as _t,oa as ye,ra as Pn,sa as J,ta as vt}from"./main-7fchxg57.js";import"./main-x61973bh.js";var pt=class{#e=[];#t=[];#r;#n=!1;constructor(t){this.#r=Math.max(1,t?.maxEntries??100)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}clear(){this.#e.length=0,this.#t.length=0,this.#n=!1}clearRedo(){this.#t.length=0}push(t){if(this.#e.push(t),this.clearRedo(),this.#n=!0,this.#e.length>this.#r)this.#e.shift()}setLastUndoSelectionsAfter(t){let e=this.#e[this.#e.length-1];if(e!==void 0)e.selectionsAfter=t.map((n)=>({...n}))}setLastUndoLineAnnotations(t,e){let n=this.#e[this.#e.length-1];if(n!==void 0)n.lineAnnotationsBefore=t.slice(),n.lineAnnotationsAfter=e.slice()}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#n?this.peekUndo():void 0}replaceLastUndo(t){if(this.#e.length===0){this.push(t);return}this.#e[this.#e.length-1]=t,this.clearRedo(),this.#n=!0}popUndoToRedo(){let t=this.#e.pop();if(t!==void 0)return this.#t.push(t),this.#n=!1,t}popRedoToUndo(){let t=this.#t.pop();if(t!==void 0)return this.#e.push(t),this.#n=!1,t}};function fe(t,e,n,i,s,r,o,a){let c=[...e].sort((l,f)=>l.start-f.start),h=[],d;if(s?.length===c.length){let l=[];for(let f of s){if(f.start.line!==f.end.line||f.start.character!==f.end.character)break;l.push(t.offsetAt(f.start))}if(l.length===c.length){l.sort((m,p)=>m-p);let f=!0,u=!0;for(let m=0;m<c.length;m++){let p=c[m];if(p.text.length>0||p.start===p.end){f=!1,u=!1;break}f&&=l[m]===p.end,u&&=l[m]===p.start}d=f?2:u?3:void 0}}for(let l=0,f=0;l<c.length;l++){let u=c[l],m=t.getTextSlice(u.start,u.end),p=u.start+f;h.push({start:p,end:p+u.text.length,text:m}),f+=u.text.length-(u.end-u.start)}return{forwardEdits:c.map((l)=>({...l})),inverseEdits:h,versionBefore:n,versionAfter:i,selectionsBefore:s?.map((l)=>({...l})),selectionsAfter:r?.map((l)=>({...l})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:a?.slice(),coalescingMode:d}}function ue(t,e){if(t===void 0||t.undoBoundary===!0||e.undoBoundary===!0||t.forwardEdits.length===0||t.forwardEdits.length!==t.inverseEdits.length||t.forwardEdits.length!==e.forwardEdits.length||e.forwardEdits.length!==e.inverseEdits.length)return!1;let n;for(let i=0;i<t.forwardEdits.length;i++){let s=t.forwardEdits[i],r=t.inverseEdits[i],o=e.forwardEdits[i],a=e.inverseEdits[i],c=ge(o.start,t.forwardEdits),h=s.start<=s.end&&s.text.length>0&&!s.text.includes(`
2
+ `)&&!r.text.includes(`
3
+ `),d=o.start===o.end&&o.text.length>0&&!o.text.includes(`
4
+ `)&&a.text.length===0;if(h&&d){if(o.start!==r.end)return!1;if(n??=1,n!==1||t.coalescingMode!==void 0&&t.coalescingMode!==1||e.coalescingMode!==void 0&&e.coalescingMode!==1)return!1;continue}let l=s.text.length===0&&s.end>s.start&&r.text.length>0,f=o.text.length===0&&o.end>o.start&&a.text.length>0;if(l&&f){let u;if(c===s.end)u=3;else if(c+(o.end-o.start)!==s.start)return!1;else u=2;if(n??=u,n!==u||t.coalescingMode!==void 0&&t.coalescingMode!==u||e.coalescingMode!==void 0&&e.coalescingMode!==u)return!1;continue}return!1}return n!==void 0}function pe(t,e){let n=[],i=[],s;for(let r=0;r<t.forwardEdits.length;r++){let o=t.forwardEdits[r],a=t.inverseEdits[r],c=e.forwardEdits[r],h=e.inverseEdits[r],d=ge(c.start,t.forwardEdits);if(o.text.length>0){s??=1,n.push({start:o.start,end:o.end,text:o.text+c.text}),i.push(a.text);continue}if(d===o.end){s??=3,n.push({start:o.start,end:d+(c.end-c.start),text:""}),i.push(a.text+h.text);continue}s??=2,n.push({start:Math.min(o.start,d),end:o.end,text:""}),i.push(h.text+a.text)}return{forwardEdits:n,inverseEdits:zn(n,i),versionBefore:t.versionBefore,versionAfter:e.versionAfter,selectionsBefore:t.selectionsBefore?.slice(),selectionsAfter:e.selectionsAfter?.slice(),lineAnnotationsBefore:t.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:e.lineAnnotationsAfter?.slice(),coalescingMode:s}}function zn(t,e){let n=[];for(let i=0,s=0;i<t.length;i++){let r=t[i],o=r.start+s;n.push({start:o,end:o+r.text.length,text:e[i]}),s+=r.text.length-(r.end-r.start)}return n}function ge(t,e){let n=t;for(let i of e){let s=i.end-i.start,r=i.text.length,o=r-s;if(n<i.start)continue;if(n>=i.start+r){n-=o;continue}n=i.start+Math.min(n-i.start,s)}return n}var Hn=1e5,Bt=10,mt=13,Fn="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?",ot=class{source;offset;length;lineOffsetStart;lineOffsetEnd;hasVirtualTrailingCRBreak;firstCharCode;lastCharCode;static Original=0;static Added=1;constructor(t,e,n,i,s,r,o,a){this.source=t,this.offset=e,this.length=n,this.lineOffsetStart=i,this.lineOffsetEnd=s,this.hasVirtualTrailingCRBreak=r,this.firstCharCode=o,this.lastCharCode=a}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart+(this.hasVirtualTrailingCRBreak?1:0)}},me=class{text;lineOffsets;constructor(t){this.text=t,this.lineOffsets=_t(t)}append(t){let e=this.text.length;for(let n=0;n<t.length;n++){let i=t.charCodeAt(n);if(i!==Bt&&i!==mt)continue;if(i===mt&&t.charCodeAt(n+1)===Bt)n++;this.lineOffsets.push(e+n+1)}return this.text+=t,e}},gt=class{piece;subtreeLength;subtreeLineBreakCount;subtreeFirstCharCode;subtreeLastCharCode;left=null;right=null;parent=null;priority=0;constructor(t,e=t.length,n=t.lineBreakCount,i=t.firstCharCode,s=t.lastCharCode){this.piece=t,this.subtreeLength=e,this.subtreeLineBreakCount=n,this.subtreeFirstCharCode=i,this.subtreeLastCharCode=s}updateSubtreeLength(){this.subtreeLength=(this.left?.subtreeLength??0)+this.piece.length+(this.right?.subtreeLength??0),this.subtreeLineBreakCount=(this.left?.subtreeLineBreakCount??0)+this.piece.lineBreakCount+(this.right?.subtreeLineBreakCount??0)-(V(this.left?.subtreeLastCharCode,this.piece.firstCharCode)?1:0)-(V(this.piece.lastCharCode,this.right?.subtreeFirstCharCode)?1:0),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},xe=class{#e;#t=new me("");#r=null;#n=0;#a=0;#l=null;#c=null;#m=null;#y=2654435769;constructor(t){this.#e=new me(t);let e=this.#k(ot.Original,0,t.length);this.#r=e.length>0?this.#q(e):null,this.#n=this.#r?.subtreeLength??0,this.#a=(this.#r?.subtreeLineBreakCount??0)+1}get lineCount(){return this.#a}getText(t){if(t===void 0)return this.#P();let e=this.offsetAt(t.start),n=this.offsetAt(t.end);return this.getTextSlice(e,n)}getLineText(t,e=!1){if(this.#l!==null&&this.#l[0]===t&&this.#l[1]===e)return this.#l[2];let n=this.#w(t);if(n===void 0)throw Error(`Line index out of range: ${t}`);let i=this.getTextSlice(n[0],n[1],!e);return this.#l=[t,e,i],this.#c=[t,e,i.length],i}getLineLength(t,e=!1){let n=this.#c,i=this.#l;if(n!==null&&n[0]===t&&n[1]===e)return n[2];if(i!==null&&i[0]===t&&i[1]===e){let c=i[2].length;return this.#c=[t,e,c],c}let s=this.#w(t);if(s===void 0)throw Error(`Line index out of range: ${t}`);let[r,o]=s,a=o-r;if(!e)while(a>0&&Nt(this.charAt(r+a-1).charCodeAt(0)))a--;return this.#c=[t,e,a],a}getTextSlice(t,e,n=!1){if(t>=e)return"";let i=F(t,0,this.#n),s=F(e,i,this.#n);if(i>=s)return"";let r=this.#x(i);if(r===void 0)return"";let o=[],[a,c]=r,h=s-i;while(a!==null&&h>0){let d=Math.min(a.piece.length-c,h),l=this.#v(a.piece.source),f=a.piece.offset+c,u=f+d;if(n)while(u>f&&Nt(l.text.charCodeAt(u-1)))u--;o.push(l.text.slice(f,u)),h-=d,c=0,a=this.#u(a)}return o.join("")}charAt(t){let e=this.#x(t);if(e===void 0)return"";let[n,i]=e;return this.#v(n.piece.source).text.charAt(n.piece.offset+i)}includes(t){if(t.length===0)return!0;let e=ve(t),n=0,i=!1;return this.#L((s)=>{for(let r=s.start;r<s.end;r++){let o=s.text.charCodeAt(r);while(n>0&&o!==t.charCodeAt(n))n=e[n-1];if(o===t.charCodeAt(n))n++;if(n===t.length)return i=!0,!1}return!0}),i}findNextNonOverlappingSubstring(t,e){if(t.length===0||t.length>this.#n)return;let n=Wn(e,this.#n),i=n.reduce((h,[,d])=>Math.max(h,d),0),s=ve(t),r=0,o=0,a,c;return this.#L((h)=>{for(let d=h.start;d<h.end;d++){let l=h.text.charCodeAt(d);while(r>0&&l!==t.charCodeAt(r))r=s[r-1];if(l===t.charCodeAt(r))r++;if(r===t.length){let f=o-t.length+1;if(!Un(n,f,f+t.length)){if(f>=i)return c=f,!1;a??=f}r=s[r-1]}o++}return!0}),c??a}search(t){if(t.text.length===0||this.#n===0)return[];if(t.text.includes(`
5
+ `)||t.text.includes("\r")||t.regex&&(t.text.includes("\\n")||t.text.includes("\\r")))return[];let e;try{e=Se(t.text,t.regex,t.caseSensitive)}catch{return[]}return this.#p(e,t.wholeWord,Hn)}#p(t,e,n){let i=[],s=this.#P(),r=s.length,o=_t(s);for(let a=0;a<o.length;a++){let c=o[a],h=o[a+1]??r;while(h>c&&Nt(s.charCodeAt(h-1)))h--;let d=s.slice(c,h);t.lastIndex=0;let l;while((l=t.exec(d))!==null){let f=l.index,u=l[0];if(u.length===0){t.lastIndex=Le(d,f);continue}let m=c+f;if(!e||Gn(s,m,u.length)){if(i.push([m,m+u.length]),i.length>=n)return i}if(f===t.lastIndex)t.lastIndex=Le(d,f)}}return i}insert(t,e){if(t.length===0)return;let n=F(e,0,this.#n);this.#g(n,n,t),this.#M()}delete(t,e){if(e<=0||this.#n===0)return;let n=F(t,0,this.#n),i=F(n+e,n,this.#n);if(n===i)return;this.#g(n,i,""),this.#M()}applyEdits(t){if(t.length===0)return;for(let e=t.length-1;e>=0;e--){let n=t[e],i=F(n.start,0,this.#n),s=F(n.end,i,this.#n);this.#g(i,s,n.text)}this.#M()}positionAt(t){let e=F(t,0,this.#n);if(this.#n===0)return{line:0,character:0};let n=this.#A(e),i=e-(n===0?0:this.#H(n-1));return this.#m=[n,i,e],{line:n,character:i}}positionsAt(t){let e=Array.from({length:t.length});if(t.length===0)return e;if(this.#n===0)return e.fill({line:0,character:0});for(let n=0;n<t.length;n++)e[n]=this.positionAt(t[n]);return e}offsetAt(t){if(t.line<0||this.#n===0)return 0;if(t.line>=this.#a)throw Error(`Line index out of range: ${t.line}`);let e=this.#m;if(e!==null&&e[0]===t.line&&e[1]===t.character)return e[2];let n=this.#w(t.line);if(n===void 0)throw Error(`Line index out of range: ${t.line}`);let i=F(t.character,0,n[1]-n[0]);return n[0]+i}#x(t){if(t<0||t>=this.#n)return;let e=this.#r,n=t;while(e!==null){let i=e.left?.subtreeLength??0;if(n<i){e=e.left;continue}if(n-=i,n<e.piece.length)return[e,n];n-=e.piece.length,e=e.right}}#u(t){if(t.right!==null){let n=t.right;while(n.left!==null)n=n.left;return n}let e=t;while(e.parent!==null&&e===e.parent.right)e=e.parent;return e.parent}#w(t){if(t<0)throw Error(`Line index out of range: ${t}`);if(this.#n===0){if(t===0)return[0,0];throw Error(`Line index out of range: ${t}`)}if(t>=this.#a)throw Error(`Line index out of range: ${t}`);return[t===0?0:this.#H(t-1),t<this.#a-1?this.#H(t):this.#n]}#A(t){let e=this.#r,n=F(t,0,this.#n),i=0;while(e!==null){let s=e.left?.subtreeLength??0;if(n<s){e=e.left;continue}if(i+=(e.left?.subtreeLineBreakCount??0)-(V(e.left?.subtreeLastCharCode,e.piece.firstCharCode)?1:0),n-=s,n<=e.piece.length){let r=this.#v(e.piece.source),o=Math.min(Pt(r.lineOffsets,e.piece.offset+n),e.piece.lineOffsetEnd);if(i+=o-e.piece.lineOffsetStart,n===e.piece.length&&e.piece.hasVirtualTrailingCRBreak)i++;if(n===e.piece.length&&V(e.piece.lastCharCode,this.#u(e)?.piece.firstCharCode))i--;return i}i+=e.piece.lineBreakCount-(V(e.piece.lastCharCode,e.right?.subtreeFirstCharCode)?1:0),n-=e.piece.length,e=e.right}return this.#a-1}#H(t){let e=this.#r,n=t,i=0,s;while(e!==null){let r=(e.left?.subtreeLineBreakCount??0)-(V(e.left?.subtreeLastCharCode,e.piece.firstCharCode)?1:0);if(n<r){s=e.piece.firstCharCode,e=e.left;continue}let o=e.left?.subtreeLength??0;i+=o,n-=r;let a=e.right?.subtreeFirstCharCode??s,c=e.piece.lineBreakCount-(V(e.piece.lastCharCode,a)?1:0);if(n<c)return i+this.#o(e.piece,n);i+=e.piece.length,n-=c,e=e.right}return this.#n}#o(t,e){if(e<t.lineOffsetEnd-t.lineOffsetStart)return this.#v(t.source).lineOffsets[t.lineOffsetStart+e]-t.offset;return t.length}#P(){let t=[];return this.#L((e)=>{t.push(e.text.slice(e.start,e.end))}),t.join("")}#L(t){this.#W(this.#r,(e)=>{let n=this.#v(e.piece.source);return t({text:n.text,lineOffsets:n.lineOffsets,lineOffsetStart:e.piece.lineOffsetStart,lineOffsetEnd:e.piece.lineOffsetEnd,start:e.piece.offset,end:e.piece.offset+e.piece.length})})}#v(t){return t===ot.Original?this.#e:this.#t}#k(t,e,n){let i=this.#v(t),s=e+n,r=Pt(i.lineOffsets,e),o=Pt(i.lineOffsets,s),a=i.text.charCodeAt(s-1);return new ot(t,e,n,r,o,a===mt&&i.lineOffsets[o-1]!==s,i.text.charCodeAt(e),a)}#g(t,e,n){if(t===e&&n.length===0)return;let[i,s]=this.#U(this.#r,t),r=this.#b(s,e-t),o;if(n.length>0){let a=this.#k(ot.Added,this.#t.append(n),n.length);o=this.#R(this.#h(i,a),r)}else{let[a,c]=this.#V(r);o=a===void 0?i:this.#R(this.#h(i,a),c)}if(o!==null)o.parent=null;this.#r=o,this.#n=o?.subtreeLength??0,this.#a=(o?.subtreeLineBreakCount??0)+1}#M(){this.#l=null,this.#c=null,this.#m=null}#C(){return this.#y=Math.imul(this.#y,1664525)+1013904223>>>0,this.#y}#q(t){let e=new gt(t);return e.priority=this.#C(),e}#E(t,e){if(t.left=e,e!==null)e.parent=t}#N(t,e){if(t.right=e,e!==null)e.parent=t}#U(t,e){if(t===null)return[null,null];if(e<=0)return[null,t];if(e>=t.subtreeLength)return[t,null];let n=t.left?.subtreeLength??0;if(e<=n){let[a,c]=this.#U(t.left,e);return this.#E(t,c),t.updateSubtreeLength(),[a,t]}let i=t.piece.length;if(e>=n+i){let[a,c]=this.#U(t.right,e-n-i);return this.#N(t,a),t.updateSubtreeLength(),[t,c]}let s=e-n,r=new gt(this.#k(t.piece.source,t.piece.offset,s)),o=new gt(this.#k(t.piece.source,t.piece.offset+s,i-s));return r.priority=t.priority,o.priority=t.priority,this.#E(r,t.left),this.#N(o,t.right),r.updateSubtreeLength(),o.updateSubtreeLength(),[r,o]}#b(t,e){if(t===null||e>=t.subtreeLength)return null;if(e<=0)return t;let n=t.left?.subtreeLength??0;if(e<=n)return this.#E(t,this.#b(t.left,e)),t.updateSubtreeLength(),t;let i=n+t.piece.length;if(e>=i)return this.#b(t.right,e-i);let s=e-n,r=new gt(this.#k(t.piece.source,t.piece.offset+s,t.piece.length-s));return r.priority=t.priority,this.#N(r,t.right),r.updateSubtreeLength(),r}#R(t,e){if(t===null)return e;if(e===null)return t;if(t.priority>=e.priority)return this.#N(t,this.#R(t.right,e)),t.updateSubtreeLength(),t;return this.#E(e,this.#R(t,e.left)),e.updateSubtreeLength(),e}#h(t,e){if(t===null)return this.#q(e);let n=t;while(n.right!==null)n=n.right;if(Vn(n.piece,e)){n.piece=Kn(n.piece,e);for(let i=n;i!==null;){if(i.updateSubtreeLength(),i===t)break;i=i.parent}return t}return this.#R(t,this.#q(e))}#V(t){if(t===null)return[void 0,null];if(t.left===null)return[t.piece,t.right];let[e,n]=this.#V(t.left);return this.#E(t,n),t.updateSubtreeLength(),[e,t]}#W(t,e){if(t===null)return!0;if(!this.#W(t.left,e))return!1;if(e(t)===!1)return!1;return this.#W(t.right,e)}};function Nt(t){return t===10||t===13}function F(t,e,n){return Math.min(Math.max(t,e),n)}function ve(t){let e=Array.from({length:t.length}).fill(0),n=0;for(let i=1;i<t.length;i++){let s=t.charCodeAt(i);while(n>0&&s!==t.charCodeAt(n))n=e[n-1];if(s===t.charCodeAt(n))n++;e[i]=n}return e}function Wn(t,e){let n=[];for(let[s,r]of t){let o=F(s,0,e),a=F(r,o,e);if(o<a)n.push([o,a])}n.sort((s,r)=>s[0]-r[0]);let i=[];for(let s of n){let r=i[i.length-1];if(r!==void 0&&s[0]<=r[1]){r[1]=Math.max(r[1],s[1]);continue}i.push(s)}return i}function Un(t,e,n){let i=0,s=t.length;while(i<s){let o=i+Math.floor((s-i)/2);if(t[o][1]<=e)i=o+1;else s=o}let r=t[i];return r!==void 0&&r[0]<n}function Vn(t,e){return t.source===e.source&&t.offset+t.length===e.offset&&!V(t.lastCharCode,e.firstCharCode)}function Kn(t,e){return new ot(t.source,t.offset,t.length+e.length,t.lineOffsetStart,e.lineOffsetEnd,e.hasVirtualTrailingCRBreak,t.firstCharCode,e.lastCharCode)}function V(t,e){return t===mt&&e===Bt}function Pt(t,e){let n=0,i=t.length;while(n<i){let s=n+Math.floor((i-n)/2);if(t[s]<=e)n=s+1;else i=s}return n}function $n(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ce(t){if(t<=32||t===127)return!0;let e=String.fromCharCode(t);return Fn.includes(e)}function Gn(t,e,n){let i=e<=0||Ce(t.charCodeAt(e-1)),s=e+n>=t.length||Ce(t.charCodeAt(e+n));return i&&s}function Se(t,e,n){let i=e?t:$n(t);return new RegExp(i,`g${n?"":"i"}${e?"m":""}`)}function jn(t,e){return t.replace(/\$([$&]|\d+)/g,(n,i)=>{if(i==="$")return"$";if(i==="&")return e[0]??"";return e[Number(i)]??""})}function be(t,e,n,i,s,r){if(!i.regex)return i.replaceText;let o=t(s),a=n(o.line),c=s-e({line:o.line,character:0}),h;try{h=Se(i.text,!0,i.caseSensitive)}catch{return i.replaceText}h.lastIndex=c;let d=h.exec(a);if(d===null||d.index!==c||d[0].length!==r-s)return i.replaceText;return jn(i.replaceText,d)}function Le(t,e){if(e+1<t.length){let n=t.charCodeAt(e),i=t.charCodeAt(e+1);if(n>=55296&&n<=56319&&i>=56320&&i<=57343)return e+2}return e+1}var Dt=class t{#e;#t;#r;#n;#a;#l;constructor(e,n,i="text",s=0,r=new pt){this.#e=new URL(e,"file://").toString(),this.#t=i,this.#r=s,this.#n=new xe(n),this.#a=r;let o=this.#n.getLineText(0,!0);if(o.endsWith(`\r
6
+ `))this.#l=`\r
7
+ `;else if(o.endsWith("\r"))this.#l="\r";else this.#l=`
8
+ `}get uri(){return this.#e}get languageId(){return this.#t}get version(){return this.#r}get lineCount(){return this.#n.lineCount}get eol(){return this.#l}get canUndo(){return this.#a.canUndo}get canRedo(){return this.#a.canRedo}positionAt(e){return this.normalizePosition(this.#n.positionAt(e))}positionsAt(e){let n=this.#n.positionsAt(e);for(let i=0;i<n.length;i++)n[i]=this.normalizePosition(n[i]);return n}offsetAt(e){return this.#n.offsetAt(this.normalizePosition(e))}getText(e){if(e===void 0)return this.#n.getText();return this.#n.getText({start:this.normalizePosition(e.start),end:this.normalizePosition(e.end)})}getLineText(e,n){return this.#n.getLineText(e,n)}normalizeEol(e){return e.replace(/\r\n|\r|\n/g,this.eol)}getLineLength(e,n){return this.#n.getLineLength(e,n)}charAt(e){if(typeof e==="number")return this.#n.charAt(e);return this.#n.charAt(this.offsetAt(e))}getTextSlice(e,n){return this.#n.getTextSlice(e,n)}findNextNonOverlappingSubstring(e,n){return this.#n.findNextNonOverlappingSubstring(e,n)}search(e){return this.#n.search(e)}applyEdits(e,n=!0,i,s,r=!1){if(e.length===0)return;return this.#c(this.#u(this.resolveEdits(e)),n,i,s,r)}resolveEdits(e){return e.map((n)=>this.#y(n))}applyResolvedEdits(e,n=!0,i,s,r=!1){if(e.length===0)return;return this.#c(this.#u(e.map((o)=>this.#p(o))),n,i,s,r)}#c(e,n,i,s,r){let o=fe(this,e,this.#r,this.#r+1,n?i:void 0,n?s:void 0);if(n&&r)o.undoBoundary=!0;let a=this.#a.peekUndoForCoalescing(),c=this.#w(e);if(this.#r++,c.lineDelta===0&&ue(a,o))this.#a.replaceLastUndo(pe(a,o));else this.#a.push(o);return c}setLastUndoSelectionsAfter(e){this.#a.setLastUndoSelectionsAfter(e)}setLastUndoLineAnnotations(e,n){this.#a.setLastUndoLineAnnotations(e,n)}undo(){let e=this.#a.popUndoToRedo();if(e===void 0)return;let n=this.#w(e.inverseEdits);if(n===void 0)return;this.#r=e.versionBefore;let i=e.selectionsBefore?.slice();return[n,i,e.lineAnnotationsBefore?.slice(),i===void 0?e.inverseEdits.map((s)=>({...s})):void 0]}redo(){let e=this.#a.popRedoToUndo();if(e===void 0)return;let n=this.#w(e.forwardEdits);if(n===void 0)return;this.#r=e.versionAfter;let i=e.selectionsAfter?.slice();return[n,i,e.lineAnnotationsAfter?.slice(),i===void 0?e.forwardEdits.map((s)=>({...s})):void 0]}normalizePosition(e){let n=t.#m(e.line,this.lineCount-1);return{line:n,character:t.#m(e.character,this.getLineLength(n))}}static#m(e,n){if(Number.isNaN(e))return 0;return Math.max(0,Math.min(Math.floor(e),n))}#y(e){let n=this.offsetAt(e.range.start),i=this.offsetAt(e.range.end);if(n>i){let s=n;n=i,i=s}return this.#p({start:n,end:i,text:e.newText})}#p(e){let{start:n,end:i}=e,s=n===i;if(this.#x(n))n--;if(s)i=n;else if(this.#x(i))i++;return{start:n,end:i,text:e.text}}#x(e){let n=this.#n.charAt(e-1).charCodeAt(0),i=this.#n.charAt(e).charCodeAt(0);return n>=55296&&n<=56319&&i>=56320&&i<=57343}#u(e){let n=[...e].sort((i,s)=>{let r=i.start-s.start;return r===0?i.end-s.end:r});for(let i=0;i<n.length-1;i++)if(n[i].end>n[i+1].start)throw Error("Overlapping text edits are not supported");return n}#w(e){let n=this.#n.lineCount,i=this.positionsAt(e.flatMap((h)=>[h.start,h.end])),s=this.#A(e,i),r=i[0],o=i[i.length-1],a=o.line===n-1&&o.character===this.#n.getLineLength(o.line);this.#n.applyEdits(e);let c=this.#n.lineCount;return{changes:e.map((h,d)=>({...h,range:{start:i[d*2],end:i[d*2+1]}})),startLine:s.startLine,startCharacter:r.character,endCharacter:o.character,endLine:Math.min(s.endLine,Math.max(0,c-1)),endedAtDocumentEnd:a,previousLineCount:n,lineCount:c,lineDelta:c-n,changedLineRanges:s.ranges,changedLineChanges:s.changes}}#A(e,n){let i=1/0,s=0,r=0,o=[],a=[],c=this.#n.lineCount-1,h=this.#n.getLineLength(c);for(let d=0;d<e.length;d++){let l=e[d],f=n[d*2],u=n[d*2+1],m=f.line,p=u.line,g=ye(l.text),v=m+r,C=v+g,x=g-(p-m);i=Math.min(i,m),s=Math.max(s,C);let L=o[o.length-1];if(L!==void 0&&v<=L[1]+1)o[o.length-1]=[L[0],Math.max(L[1],C)];else o.push([v,C]);a.push([v,C,x,f.character,u.character,p===c&&u.character===h]),r+=x}if(i===1/0)return{startLine:0,endLine:0,ranges:[[0,0]],changes:[[0,0,0,0,0,!1]]};return{startLine:i,endLine:s,ranges:o,changes:a}}};function K({metaKey:t,ctrlKey:e},n=J()){return n?t&&!e:e&&!t}function we(t){if(J()&&t.ctrlKey&&!t.altKey&&!t.metaKey)switch(t.key){case"a":return"start";case"e":return"end";case"p":return"up";case"n":return"down";case"f":return"right";case"b":return"left"}if(!t.altKey&&!t.ctrlKey&&!t.metaKey){if(t.key==="ArrowUp")return"up";else if(t.key==="ArrowDown")return"down";else if(t.key==="ArrowLeft")return"left";else if(t.key==="ArrowRight")return"right";else if(t.key==="Home")return"start";else if(t.key==="End")return"end"}if(K(t)){if(t.key==="ArrowLeft")return"textStart";else if(t.key==="ArrowRight")return"end"}}var ke=new WeakMap,qn=Ee([{bindings:{Tab:"indent","shift+Tab":"outdent","cmdOrCtrl+[":"indentLess","cmdOrCtrl+]":"indentMore","cmdOrCtrl+z":"undo","cmdOrCtrl+shift+z":"redo","cmdOrCtrl+a":"selectAll","cmdOrCtrl+d":"findNextMatch","cmdOrCtrl+f":"openSearchPanel","cmdOrCtrl+alt+f":"openSearchReplacePanel","alt+ArrowUp":"moveLineUp","alt+ArrowDown":"moveLineDown","shift+alt+ArrowUp":"copyLineUp","shift+alt+ArrowDown":"copyLineDown",Escape:"simplifySelection","cmdOrCtrl+Enter":"insertBlankLine","cmdOrCtrl+/":"toggleComment","shift+alt+a":"toggleBlockComment","cmdOrCtrl+Home":"moveCursorToDocStart","cmdOrCtrl+End":"moveCursorToDocEnd","cmdOrCtrl+shift+Home":"expandSelectionDocStart","cmdOrCtrl+shift+End":"expandSelectionDocEnd"}},{platform:"mac",bindings:{"ctrl+k":"deleteHardLineForward","ctrl+alt+p":"moveLineUp","ctrl+alt+n":"moveLineDown","cmd+ArrowUp":"moveCursorToDocStart","cmd+ArrowDown":"moveCursorToDocEnd","cmd+shift+ArrowUp":"expandSelectionDocStart","cmd+shift+ArrowDown":"expandSelectionDocEnd"}},{platform:"windows",bindings:{"ctrl+y":"redo"}},{platform:"linux",bindings:{"ctrl+y":"redo","ctrl+alt+p":"moveLineUp","ctrl+alt+n":"moveLineDown"}}]),Xn={Backquote:"`",Minus:"-",Equal:"=",Comma:",",Period:".",Slash:"/",Semicolon:";",Quote:"'",BracketLeft:"[",BracketRight:"]",Backslash:"\\",Space:"Space"};function Ee(t){let e=ke.get(t);if(e===void 0){e={mac:new Map,windows:new Map,linux:new Map};for(let n of t)for(let i of Object.keys(n.bindings)){let s=n.bindings[i];if(s===void 0)continue;let r=i.split("+"),o=r.pop();for(let a of["mac","windows","linux"]){if(n.platform!==void 0&&n.platform!==a)continue;let c=0;for(let d of r)if(d==="alt")c|=1;else if(d==="ctrl")c|=2;else if(d==="cmd")c|=4;else if(d==="shift")c|=8;else if(d==="cmdOrCtrl")c|=a==="mac"?4:2;let h=e[a].get(c);if(h===void 0)h=new Map,e[a].set(c,h);h.set(o,s)}}ke.set(t,e)}return e}function Te(t,e,n=J()){let i=t.key===" "?"Space":t.key.length===1?t.key.toLowerCase():t.key,s=t.code??"",r=s.startsWith("Key")&&s.length===4?s.slice(3).toLowerCase():s.startsWith("Digit")&&s.length===6?s.slice(5):Xn[s],o=n?"mac":globalThis.navigator?.platform.includes("Linux")===!0?"linux":"windows",a=(t.altKey?1:0)|(t.ctrlKey?2:0)|(t.metaKey?4:0)|(t.shiftKey?8:0);if(e!==void 0){let h=Ee(e)[o].get(a),d=h?.get(i)??(r===void 0?void 0:h?.get(r));if(d!==void 0)return d}let c=qn[o].get(a);return c?.get(i)??(r===void 0?void 0:c?.get(r))}function at(t,e=J()){if(t.altKey)return;if(!K(t,e))return;if((t.key.length===1?t.key.toLowerCase():t.key)==="g"||t.code==="KeyG")return t.shiftKey?"previous":"next"}var Ae=`::selection {
9
+ background-color: #0000;
10
+ }
11
+
12
+ [data-deleted-text-selection] [data-deletions] ::selection, [data-deleted-text-selection] [data-line-type="change-deletion"] ::selection {
13
+ background-color: var(--diffs-editor-selection-bg);
14
+ }
15
+
16
+ @keyframes blinking {
17
+ 0% {
18
+ opacity: 1;
19
+ }
20
+
21
+ 50% {
22
+ opacity: 0;
23
+ }
24
+
25
+ 100% {
26
+ opacity: 1;
27
+ }
28
+ }
29
+
30
+ :host, [data-code], [data-content], [data-diff-type="split"][data-overflow="wrap"] {
31
+ position: relative;
32
+ }
33
+
34
+ [data-code] {
35
+ container-type: inline-size;
36
+ }
37
+
38
+ [data-content] {
39
+ cursor: text;
40
+ caret-color: var(--diffs-bg-caret);
41
+ background-color: #0000;
42
+ outline: none;
43
+ }
44
+
45
+ [data-line] {
46
+ cursor: text;
47
+ background-color: #0000;
48
+ }
49
+
50
+ [data-line]:after {
51
+ content: "";
52
+ z-index: -20;
53
+ background-color: var(--diffs-line-bg);
54
+ pointer-events: none;
55
+ position: absolute;
56
+ inset: 0;
57
+ }
58
+
59
+ [data-line][data-editor-active-line]:after {
60
+ box-shadow: inset 0 0 0 1px var(--diffs-editor-line-highlight-border);
61
+ }
62
+
63
+ [data-editor-overlay] {
64
+ display: contents;
65
+ }
66
+
67
+ [data-caret], [data-selection-range], [data-match-range], [data-bracket-match-range], [data-marker-range] {
68
+ height: 1lh;
69
+ line-height: var(--diffs-line-height);
70
+ pointer-events: none;
71
+ position: absolute;
72
+ top: 0;
73
+ left: 0;
74
+ }
75
+
76
+ [data-caret] {
77
+ background-color: var(--diffs-bg-caret-override, var(--diffs-editor-cursor-fg, light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));
78
+ visibility: hidden;
79
+ width: 2px;
80
+ }
81
+
82
+ @media (prefers-reduced-motion: no-preference) {
83
+ [data-caret] {
84
+ animation: 1.2s .8s infinite blinking;
85
+ }
86
+ }
87
+
88
+ [data-selection-range] {
89
+ z-index: -10;
90
+ background-color: var(--diffs-editor-selection-bg);
91
+ }
92
+
93
+ [data-selection-corner] {
94
+ background-color: var(--diffs-selection-corner-bg, var(--diffs-bg));
95
+ width: 100%;
96
+ height: 100%;
97
+ }
98
+
99
+ [data-match-range] {
100
+ z-index: -10;
101
+ background-color: var(--diffs-editor-match-bg, var(--diffs-editor-selection-bg));
102
+ }
103
+
104
+ [data-match-range]:not([data-focus]) {
105
+ background-color: var(--diffs-editor-match-highlight-bg, light-dark(#ff963288, #ff963266));
106
+ }
107
+
108
+ [data-bracket-match-range] {
109
+ z-index: -9;
110
+ box-sizing: border-box;
111
+ border-bottom: 1px solid
112
+ var(--diffs-editor-bracket-match-border, color-mix(in lab, var(--diffs-fg) 60%, transparent));
113
+ background-color: var(--diffs-editor-bracket-match-bg, color-mix(in lab, var(--diffs-fg) 5%, transparent));
114
+ }
115
+
116
+ [data-rtl] {
117
+ border-top-left-radius: 3px;
118
+ }
119
+
120
+ [data-rtr] {
121
+ border-top-right-radius: 3px;
122
+ }
123
+
124
+ [data-rbl] {
125
+ border-bottom-left-radius: 3px;
126
+ }
127
+
128
+ [data-rbr] {
129
+ border-bottom-right-radius: 3px;
130
+ }
131
+
132
+ [data-marker-range] {
133
+ z-index: 1;
134
+ background-color: var(--diffs-marker-bg);
135
+ mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+");
136
+ mask-position: 0 100%;
137
+ mask-size: 6px 3px;
138
+ mask-repeat: repeat-x;
139
+ }
140
+
141
+ [data-marker-error] {
142
+ --diffs-marker-contrast: light-dark(#fff, #000);
143
+ --diffs-marker-bg: var(--diffs-editor-error-fg, var(--diffs-deletion-base));
144
+ }
145
+
146
+ [data-marker-warning] {
147
+ --diffs-marker-contrast: #000;
148
+ --diffs-marker-bg: var(--diffs-editor-warning-fg, light-dark(var(--diffs-warning-light), var(--diffs-warning-dark)));
149
+ }
150
+
151
+ [data-marker-info] {
152
+ --diffs-marker-contrast: #000;
153
+ --diffs-marker-bg: var(--diffs-editor-info-fg, var(--diffs-modified-base));
154
+ }
155
+
156
+ [data-marker-hint] {
157
+ --diffs-marker-contrast: light-dark(#fff, #000);
158
+ --diffs-marker-bg: var(--diffs-editor-hint-fg, var(--diffs-fg-number));
159
+ }
160
+
161
+ @media (width >= 480px) {
162
+ [data-content] {
163
+ caret-color: #0000;
164
+ }
165
+
166
+ [data-content]:focus ~ [data-editor-overlay] [data-caret] {
167
+ visibility: visible;
168
+ }
169
+ }
170
+
171
+ [data-editor-widget] {
172
+ --diffs-widget-fg: var(--diffs-fg);
173
+ --diffs-widget-bg: color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));
174
+ --diffs-widget-border: color-mix(in lab, var(--diffs-fg) 20%, transparent);
175
+ --diffs-widget-shadow: inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013,
176
+ 0 6px 18px #00000013;
177
+ z-index: 100;
178
+ width: fit-content;
179
+ max-width: calc(100% - 24px);
180
+ font: 14px/20px var(--diffs-header-font-fallback);
181
+ border: 1px solid var(--diffs-widget-border);
182
+ background-color: var(--diffs-widget-bg);
183
+ box-shadow: var(--diffs-widget-shadow);
184
+ background-clip: padding-box;
185
+ border-radius: 9px;
186
+ position: absolute;
187
+ top: 0;
188
+ left: 0;
189
+ }
190
+
191
+ [data-marker-popover], [data-selection-action-popover] {
192
+ --popover-gap: var(--diffs-popover-gap, var(--diffs-gap-fallback, 8px));
193
+ --popover-viewport-left: 0px;
194
+ --popover-viewport-right: 100cqw;
195
+ --popover-viewport-top: -99999px;
196
+ --popover-viewport-bottom: 99999px;
197
+ --popover-min-left: calc(var(--popover-viewport-left) + var(--gutter-width, 0px) + var(--popover-gap));
198
+ --popover-available-width: max(0px,
199
+ calc(var(--popover-viewport-right) - var(--popover-min-left) -
200
+ var(--popover-gap)));
201
+ max-width: min(640px, var(--popover-available-width));
202
+ translate: clamp(var(--popover-min-left),
203
+ var(--popover-x, var(--popover-min-left)),
204
+ calc(var(--popover-viewport-right) - var(--popover-gap) - 100%))
205
+ /* Clamp into the scrollport so a popover with no fitting side stays in view. */
206
+ clamp(var(--popover-viewport-top),
207
+ calc(var(--popover-y, 0px) + var(--popover-y-shift, 0px)),
208
+ calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%));
209
+ }
210
+
211
+ [data-marker-popover] {
212
+ --diffs-widget-bg: var(--diffs-marker-bg);
213
+ --diffs-widget-shadow: 0 4px 8px #00000026, 0 6px 18px #00000026;
214
+ min-width: min(180px, var(--popover-available-width));
215
+ overflow-wrap: anywhere;
216
+ color: var(--diffs-marker-contrast);
217
+ white-space: normal;
218
+ pointer-events: auto;
219
+ border: 0;
220
+ padding: 8px 12px;
221
+
222
+ @supports (color: contrast-color(red)) {
223
+ color: contrast-color(var(--diffs-marker-bg, var(--diffs-bg)));
224
+ }
225
+
226
+ & [data-marker-message] {
227
+ white-space: normal;
228
+ overflow-wrap: anywhere;
229
+
230
+ & code {
231
+ white-space: normal;
232
+ color: inherit;
233
+ background-color: #0000;
234
+ display: inline;
235
+ }
236
+ }
237
+ }
238
+
239
+ [data-selection-action-popover] {
240
+ pointer-events: auto;
241
+ flex-wrap: wrap;
242
+ align-items: center;
243
+ gap: 4px;
244
+ width: max-content;
245
+ padding: 4px;
246
+ display: flex;
247
+ }
248
+
249
+ [data-search-panel] {
250
+ z-index: 100;
251
+ flex-direction: column;
252
+ justify-content: right;
253
+ width: 100%;
254
+ height: 0;
255
+ display: flex;
256
+ position: sticky;
257
+ top: 16px;
258
+ right: 16px;
259
+ container: search-panel / inline-size;
260
+
261
+ & [data-editor-widget] {
262
+ z-index: 100;
263
+ flex-shrink: 0;
264
+ align-items: stretch;
265
+ gap: 8px;
266
+ min-width: 260px;
267
+ max-width: 100%;
268
+ margin-inline: auto 16px;
269
+ padding: 4px;
270
+ display: flex;
271
+ position: relative;
272
+ }
273
+
274
+ & svg {
275
+ fill: currentColor;
276
+ width: 12px;
277
+ height: 12px;
278
+ display: block;
279
+ }
280
+ }
281
+
282
+ [data-search-grid] {
283
+ grid-template-columns: auto auto auto;
284
+ grid-template-areas: "find matches nav"
285
+ "replace actions .";
286
+ align-items: center;
287
+ gap: 4px 6px;
288
+ width: 100%;
289
+ display: grid;
290
+ }
291
+
292
+ [data-input-box][data-find] {
293
+ grid-area: find;
294
+ }
295
+
296
+ [data-search-nav] {
297
+ grid-area: nav;
298
+ }
299
+
300
+ [data-input-box][data-replace] {
301
+ grid-area: replace;
302
+ }
303
+
304
+ [data-replace-actions] {
305
+ grid-area: actions;
306
+ }
307
+
308
+ [data-search-grid][data-mode="find"] {
309
+ grid-template-areas: "find matches nav";
310
+ }
311
+
312
+ [data-search-grid][data-mode="find"] [data-replace-cell] {
313
+ display: none;
314
+ }
315
+
316
+ @container search-panel (width < 400px) {
317
+ [data-search-panel] [data-editor-widget] {
318
+ padding: 10px;
319
+ }
320
+
321
+ [data-search-grid][data-mode="replace"] {
322
+ grid-template-columns: auto 1fr auto;
323
+ grid-template-areas: "find find find"
324
+ "replace replace replace"
325
+ "nav matches actions";
326
+ }
327
+
328
+ [data-search-grid][data-mode="find"] {
329
+ grid-template-columns: auto 1fr auto;
330
+ grid-template-areas: "find find find"
331
+ "nav matches matches";
332
+ }
333
+
334
+ [data-replace-actions] {
335
+ justify-self: end;
336
+ }
337
+
338
+ [data-search-grid] [data-input-box] {
339
+ width: auto;
340
+ }
341
+ }
342
+
343
+ [data-input-box] {
344
+ align-items: center;
345
+ width: 200px;
346
+ display: flex;
347
+ position: relative;
348
+
349
+ & input {
350
+ width: 100%;
351
+ min-width: 0;
352
+ color: var(--diffs-fg);
353
+ background-color: var(--diffs-bg);
354
+ border: 1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));
355
+ border-radius: 6px;
356
+ outline: none;
357
+ flex-grow: 1;
358
+ padding-inline: 6px;
359
+ font-size: 13px;
360
+ line-height: 24px;
361
+
362
+ &::selection {
363
+ background-color: color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg));
364
+ }
365
+
366
+ &:focus-visible {
367
+ outline: 1px solid var(--diffs-modified-base);
368
+ }
369
+ }
370
+
371
+ &[data-find] input {
372
+ padding-inline-end: 72px;
373
+ }
374
+
375
+ & [data-search-icon] {
376
+ --diffs-search-icon-size: 20px;
377
+ }
378
+ }
379
+
380
+ [data-search-toggles] {
381
+ align-items: center;
382
+ gap: 1px;
383
+ display: flex;
384
+ position: absolute;
385
+ top: 50%;
386
+ right: 4px;
387
+ transform: translateY(-50%);
388
+ }
389
+
390
+ [data-matches] {
391
+ white-space: nowrap;
392
+ min-width: 50px;
393
+ color: color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));
394
+ flex-shrink: 0;
395
+ grid-area: matches;
396
+ font-size: 12px;
397
+ font-weight: 500;
398
+ line-height: 20px;
399
+
400
+ &[data-no-matches] {
401
+ color: color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg));
402
+ }
403
+ }
404
+
405
+ [data-replace-actions], [data-search-nav] {
406
+ align-items: center;
407
+ display: flex;
408
+ }
409
+
410
+ [data-search-icon] {
411
+ appearance: none;
412
+ width: var(--diffs-search-icon-size, 24px);
413
+ height: var(--diffs-search-icon-size, 24px);
414
+ color: color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));
415
+ border-radius: var(--diffs-search-icon-radius, 4px);
416
+ cursor: pointer;
417
+ background: none;
418
+ border: 0;
419
+ flex-shrink: 0;
420
+ justify-content: center;
421
+ align-items: center;
422
+ margin: 0;
423
+ padding: 0;
424
+ transition: background-color .1s ease-in-out, color .1s ease-in-out;
425
+ display: flex;
426
+
427
+ &:disabled {
428
+ opacity: .25;
429
+ cursor: default;
430
+ }
431
+
432
+ &:not(:disabled):hover {
433
+ color: var(--diffs-fg);
434
+ }
435
+
436
+ &:focus-visible {
437
+ outline: 1px solid var(--diffs-modified-base);
438
+ }
439
+
440
+ &[aria-pressed="true"] {
441
+ color: var(--diffs-modified-base);
442
+ }
443
+ }
444
+
445
+ [data-search-close] {
446
+ --diffs-search-icon-size: 20px;
447
+ --diffs-search-icon-radius: 50%;
448
+ color: var(--diffs-widget-bg);
449
+ background-color: color-mix(in lab,
450
+ var(--diffs-widget-fg) 50%,
451
+ var(--diffs-bg));
452
+ position: absolute;
453
+ top: 0;
454
+ right: 0;
455
+ transform: translate(50%, -50%);
456
+
457
+ &:not(:disabled):hover {
458
+ opacity: 1;
459
+ color: var(--diffs-widget-bg);
460
+ background-color: var(--diffs-widget-fg);
461
+ }
462
+ }
463
+ `;var Zn=["/*","*/"],Yn={sql:{lineComment:"--"},ruby:{lineComment:"#",blockComment:["=begin","=end"]},rst:{lineComment:".."},coffeescript:{lineComment:"#",blockComment:["###","###"]},cmd:{lineComment:"@REM"},julia:{lineComment:"#",blockComment:["#=","=#"]},yaml:{lineComment:"#"},yml:{lineComment:"#"},markdown:{lineComment:null,blockComment:["<!--","-->"]},zsh:{lineComment:"#"},makefile:{lineComment:"#"},handlebars:{lineComment:null,blockComment:["{{!--","--}}"]},ini:{lineComment:";",blockComment:[";"," "]},powershell:{lineComment:"#",blockComment:["<#","#>"]},vb:{lineComment:"'"},xml:{lineComment:null,blockComment:["<!--","-->"]},lua:{lineComment:"--",blockComment:["--[[","]]"]},html:{lineComment:null,blockComment:["<!--","-->"]},diff:{lineComment:"#",blockComment:["#"," "]},r:{lineComment:"#"},fsharp:{blockComment:["(*","*)"]},pug:{lineComment:"//-"},perl:{lineComment:"#"},tex:{lineComment:"%"},clojure:{lineComment:";;"},css:{lineComment:null},python:{lineComment:"#",blockComment:['"""','"""']},dotenv:{lineComment:"#"},dockerfile:{lineComment:"#"},razor:{lineComment:null,blockComment:["<!--","-->"]},prompt:{lineComment:null,blockComment:["<!--","-->"]}};function Re(t,e){let n={...Yn[t],...e?.[t]};return{lineComment:n.lineComment===void 0?"//":n.lineComment,blockComment:n.blockComment??Zn}}function Oe(t,e,n){let i=[],s=new Set;for(let a of e){let c=a.end.line;if(a.start.line<c&&a.end.character===0)c--;let h=i.length,d=1/0;for(let l=a.start.line;l<=c;l++){if(s.has(l))continue;s.add(l);let f=t.getLineText(l),u=f.length-f.trimStart().length,m=u===f.length;if(!m)d=Math.min(d,u);i.push({line:l,comment:f.slice(u,u+n.length)===n?u:-1,empty:m,indent:u,single:!1})}if(d!==1/0){for(let l=h;l<i.length;l++)if(!i[l].empty)i[l].indent=d}if(i.length===h+1)i[h].single=!0}let r=i.some((a)=>a.comment<0&&(!a.empty||a.single)),o=[];if(r){for(let a of i){if(a.empty&&!a.single)continue;let c={line:a.line,character:a.indent};o.push({range:{start:c,end:c},newText:n+" "})}return o}for(let a of i){if(a.comment<0)continue;let c=t.getLineText(a.line),h=a.comment,d=h+n.length+(c[h+n.length]===" "?1:0);o.push({range:{start:{line:a.line,character:h},end:{line:a.line,character:d}},newText:""})}return o}var ct=50;function Qn(t,e,n,i,s){let r=Math.max(0,i-ct),o=t.getTextSlice(r,i),a=t.getTextSlice(s,s+ct),c=o.length-o.trimEnd().length,h=a.length-a.trimStart().length,d=o.length-c;if(o.slice(d-e.length,d)===e&&a.slice(h,h+n.length)===n)return{open:{start:i-c-e.length,end:i-c+(c>0?1:0),text:""},close:{start:s+h-(h>0?1:0),end:s+h+n.length,text:""},contentStart:i,contentEnd:s};let l=s-i<=ct*2?t.getTextSlice(i,s):void 0,f=l??t.getTextSlice(i,i+ct),u=l??t.getTextSlice(s-ct,s),m=f.length-f.trimStart().length,p=s-(u.length-u.trimEnd().length)-n.length;if(f.slice(m,m+e.length)!==e||t.getTextSlice(p,p+n.length)!==n)return;let g=i+m,v=g+e.length+(/\s/.test(f[e.length+m]??"")?1:0),C=p-(/\s/.test(t.getTextSlice(p-1,p))?1:0);return{open:{start:g,end:v,text:""},close:{start:C,end:p+n.length,text:""},contentStart:v,contentEnd:C}}function Me(t,e,n,i){let s=0,r=e.length;while(s<r){let a=s+r>>>1;if(e[a].end<t)s=a+1;else r=a}let o=n[s];for(let a=s;a<e.length;a++){let c=e[a];if(t<c.start)break;if(c.start===c.end&&t===c.start){if(i<0)break;o+=c.text.length;continue}if(t>c.end){o+=c.text.length-(c.end-c.start);continue}if(t===c.end)return c.start+o+c.text.length;return c.start+o+(i>0?c.text.length:0)}return t+o}function Ie(t,e,[n,i],s=!1){let r=e.map((l)=>{let{start:f,end:u}=l;if(s){let m=u.line;if(f.line<m&&u.character===0)m--;let p=t.getLineText(f.line),g=p.length-p.trimStart().length;f={line:f.line,character:g},u={line:m,character:t.getLineLength(m)}}return{from:t.offsetAt(f),to:t.offsetAt(u),direction:l.direction,comment:void 0}});if(s&&r.length>1){r.sort((f,u)=>{let m=f.from-u.from;return m!==0?m:f.to-u.to});let l=0;for(let f=1;f<r.length;f++){let u=r[l],m=r[f];if(m.from<=u.to)u.to=Math.max(u.to,m.to);else r[++l]=m}r.length=l+1}for(let l of r)l.comment=Qn(t,n,i,l.from,l.to);let o=r.every((l)=>l.comment!==void 0),a=[];for(let l of r){let f=l.comment;if(o&&f!==void 0){a.push(f.open,f.close);continue}if(f!==void 0)continue;if(l.from===l.to){a.push({start:l.from,end:l.to,text:n+" "+i});continue}a.push({start:l.from,end:l.from,text:n+" "},{start:l.to,end:l.to,text:" "+i})}if(a.length===0)return;a.sort((l,f)=>{let u=l.start-f.start;return u!==0?u:l.end-f.end});let c=a.map((l)=>({range:{start:t.positionAt(l.start),end:t.positionAt(l.end)},newText:l.text}));if(s)return{edits:c,nextSelectionOffsets:[]};let h=r.map((l)=>{let f=l.comment;if(o&&f!==void 0)return{start:f.contentStart,end:f.contentEnd,startAssociation:1,endAssociation:-1};if(f!==void 0)return{start:l.from,end:l.to,startAssociation:1,endAssociation:1};if(l.from===l.to)return{start:l.from,end:l.to,startAssociation:-1,endAssociation:-1,collapsedInset:n.length+1};return{start:l.from,end:l.to,startAssociation:1,endAssociation:-1}}),d=Array(a.length+1);d[0]=0;for(let l=0;l<a.length;l++){let f=a[l];d[l+1]=d[l]+f.text.length-(f.end-f.start)}return{edits:c,nextSelectionOffsets:h.map((l,f)=>{let u=Me(l.start,a,d,l.startAssociation)+(l.collapsedInset??0);return[u,l.collapsedInset===void 0?Me(l.end,a,d,l.endAssociation):u,r[f].direction]})}}function y(t,e,n){let{style:i,dataset:s,children:r,...o}=e??{},a=document.createElement(t);if(Object.assign(a,o),i!==void 0)if(typeof i==="string")a.style.cssText=i;else Object.assign(a.style,i);if(s!==void 0)if(typeof s==="string")a.dataset[s]="";else if(Array.isArray(s))s.forEach((c)=>{a.dataset[c]=""});else Object.assign(a.dataset,s);if(r!==void 0)a.replaceChildren(...r);if(n!==void 0)n.appendChild(a);return a}function k(t,e,n,i){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n,i)}function z(t,e="line"){let n=t.dataset[e];if(n===void 0)return;let i=parseInt(n,10);if(Number.isNaN(i))return;return i}function zt(t,e){if(t.nodeType===3){let n=t.textContent?.length??0;return Math.max(0,Math.min(e,n))}if(t.nodeType===1)return Math.max(0,Math.min(e,t.childNodes.length));return 0}function Be(t,e){return Object.assign(t,e)}function _e(t,e){let n;return function(...i){clearTimeout(n),n=setTimeout(()=>t.apply(this,i),e)}}function G(t,e=1000){return Math.round(t*e)/e}function De(t){return t.endsWith(`
464
+ `)||t.endsWith("\r")}function Ht(t){if(typeof Intl>"u"||typeof Intl.Segmenter!=="function")return;return new Intl.Segmenter(void 0,t)}var Ne,Pe=!1;function j(){if(!Pe)Ne=Ht({granularity:"grapheme"}),Pe=!0;return Ne}function ze(t){let{ownerDocument:e,parentElement:n}=t;while(n!=null&&n!==e.body&&n!==e.documentElement){let i=n.ownerDocument.defaultView?.getComputedStyle(n).overflowY;if(i==="auto"||i==="scroll"||i==="overlay")return n;n=n.parentElement}return e}function tt(t,e){let n=Jn(t);if(n.length===0)return;let i=[],s=!1;for(let r of e){if(r.side==="deletions"||r.lineNumber<=0){i.push(r);continue}let o=r.lineNumber-1,a=t.previousLineCount,c=!1;for(let d of n){let l=Math.max(1,a+d.lineDelta),f=ti(o,d,l);if(f===void 0){c=!0,o=void 0;break}if(f!==o||ni(o,d))c=!0;o=f,a=l}if(o===void 0){s=!0;continue}let h=o+1;if(c){i.push(h===r.lineNumber?r:{...r,lineNumber:h}),s=!0;continue}i.push(r)}return s?i:void 0}function Jn(t){if(t.changedLineChanges!==void 0)return t.changedLineChanges.flatMap(([i,s,r,o=0,a=0,c=!1])=>{if(r===0)return[];let h=Math.max(0,s-i);return[{startLine:i,startCharacter:o,endLine:i+Math.max(0,h-r),deletesEndLine:r<0&&c,insertedLineBreaks:h,lineDelta:r}]});if(t.lineDelta===0)return t.changedLineRanges.flatMap(([i,s])=>{let r=s-i;if(r<=0)return[];return[{startLine:i,startCharacter:0,endLine:i,deletesEndLine:!1,insertedLineBreaks:r,lineDelta:r}]});let e=Math.max(0,-t.lineDelta),n=t.endedAtDocumentEnd&&t.startLine+e===t.previousLineCount-1;return[{startLine:t.startLine,startCharacter:t.startCharacter,endLine:t.startLine+e,deletesEndLine:n,insertedLineBreaks:Math.max(0,t.lineDelta),lineDelta:t.lineDelta}]}function ti(t,e,n){if(t<e.startLine)return t;if(t>e.endLine||e.endLine>e.startLine&&t===e.endLine&&!e.deletesEndLine)return t+e.lineDelta;if(e.startLine===e.endLine){if(e.startCharacter===0)return t+e.insertedLineBreaks;return t}if(ei(t,e))return;let i=Math.min(Math.max(0,t-e.startLine),e.insertedLineBreaks);return ii(e.startLine+i,n)}function ei(t,e){if(e.lineDelta>=0||t<e.startLine||t>e.endLine)return!1;if(t===e.startLine&&e.startCharacter>0)return!1;if(t===e.endLine&&!e.deletesEndLine)return!1;return!0}function ni(t,e){if(e.lineDelta===0||t<e.startLine||t>e.endLine)return!1;return!(e.endLine>e.startLine&&t===e.endLine&&!e.deletesEndLine)}function ii(t,e){return Math.max(0,Math.min(t,Math.max(0,e-1)))}function Ke(t,e,n){let i=new Map,s=new Map;for(let d of t){let l=d.lineNumber;if(!i.has(l))i.set(l,[]);if(!s.has(l))s.set(l,[]);(d.side==="deletions"?s:i).get(l).push(Ve(d))}let r=e.parentElement?.previousElementSibling,o,a;if(r!=null&&r instanceof HTMLElement&&r.dataset.deletions!==void 0)for(let d of r.children){let l=d,{gutter:f,content:u}=l.dataset;if(f!==void 0)o=l;else if(u!==void 0)a=l}if(He(e,n),a!==void 0)He(a,o);let c=Fe(i,e,n);if(a===void 0)return;let h=Fe(s,a,o);requestAnimationFrame(()=>{si(i,s,c,h)})}function He(t,e){let n=[];for(let i=1;i<t.childElementCount;i++){let s=t.children[i];if(s.dataset.lineAnnotation!==void 0){if(n.push(s),e!==void 0)n.push(e.children[i])}}for(let i of n)i.remove()}function Fe(t,e,n){let i=new Map;for(let s of e.children){let r=z(s);if(r!==void 0){let o=t.get(r);if(o!==void 0){let a=y("div",{dataset:{lineAnnotation:"0,"+(r-1)},children:[y("div",{dataset:"annotationContent",children:o.map((c)=>y("slot",{name:c}))})]});s.after(a),i.set(r,a)}}}if(n!==void 0)for(let s of n.children){let r=z(s,"columnNumber");if(r!==void 0&&t.has(r)){let o=y("div",{dataset:{gutterBuffer:"annotation",bufferSize:"1"},style:{gridRow:"span 1"}});s.after(o)}}return i}function si(t,e,n,i){let s=new Map;for(let[r,o]of t.entries()){let a=i.get(r);if(o.length===0&&a!==void 0){let c=We(a);if(c>0)s.set(r,c)}}for(let[r,o]of e.entries()){let a=n.get(r);if(o.length===0&&a!==void 0){let c=We(a);if(c>0)s.set(r,c)}}Ue(t,n,s),Ue(e,i,s)}function We(t){let e=t.firstElementChild;if(!(e instanceof HTMLElement))return 0;return e.getBoundingClientRect().height}function Ue(t,e,n){for(let[i,s]of e.entries()){let r=t.get(i),o=n.get(i);if(r?.length===0&&o!==void 0)s.style.setProperty("--diffs-annotation-min-height",`${o}px`)}}var $e=class{#e;#t;#r;#n;#a;#l;#c=0;#m=0;#y=0;#p=!0;#x;#u=new Map;#w;#A;constructor(t){this.#w=t.hasActivePopover,this.#A=t.updateActivePopover}setViewportElements(t,e){let n=this.#e!==t||this.#t!==e;if(this.#e=t,!n)return;this.#t=e,this.#p=!0,this.#x?.forEach((i)=>i()),this.#x=void 0}cleanUp(){this.#t=void 0,this.#e=void 0,this.#r=void 0,this.#n=void 0,this.#a=void 0,this.#l=void 0,this.#c=0,this.#m=0,this.#y=0,this.#p=!0,this.#x?.forEach((t)=>t()),this.#x=void 0,this.#u.clear()}resetPlacement(t="default"){this.#u.delete(t)}setPlacement(t,e="default"){this.#u.set(e,t)}choosePlacement(t){let{preferred:e,fallback:n,viewport:i,popoverHeight:s,atDocumentEdge:r,placementKey:o="default"}=t,a=this.#u.get(o),c;if(i!==void 0&&s>0){let h=(d,l=0)=>d.top>=i.top+l&&d.bottom<=i.bottom-l;if(a==="fallback"&&h(n)&&!h(e,4))c="fallback";else if(!h(e)&&h(n))c="fallback";else c="preferred"}else c=r?"fallback":"preferred";return this.#u.set(o,c),c}getPlacementBounds(){let t=this.#P();if(t===void 0)return;let e=this.#L(),n,i;if(e!==void 0)n=e.top,i=e.bottom;else n=0,i=window.innerHeight;if(n=Math.max(n,t.top),i=Math.min(i,t.bottom),i<=n)return;let s=this.#c,r=this.#m,o=this.#y>0?this.#y:t.width,a=e!==void 0?e.left:0,c=e!==void 0?e.right:window.innerWidth,h=s,d=s+o,l=Math.max(h,a-t.left+s),f=Math.min(d,c-t.left+s);return{top:n-t.top+r,bottom:i-t.top+r,left:l,right:Math.max(l,f)}}#H(){let t=this.#e;if(t===void 0)return;if(this.#n===t){if(this.#r===void 0||this.#r.isConnected)return this.#r}let e=t.parentElement;while(e!==null){let n=getComputedStyle(e).overflowY;if(n==="auto"||n==="scroll"||n==="overlay")return this.#r=e,this.#n=t,e;e=e.parentElement}this.#r=void 0,this.#n=t}#o(){if(!this.#p)return;this.#v();let t=this.#t;this.#a=t?.getBoundingClientRect(),this.#c=t?.scrollLeft??0,this.#m=t?.scrollTop??0,this.#y=t?.clientWidth??0,this.#l=this.#H()?.getBoundingClientRect(),this.#p=!1}#P(){return this.#o(),this.#a}#L(){return this.#o(),this.#l}#v(){if(this.#x!==void 0)return;let t,e=()=>{if(this.#p=!0,!this.#w()||t!==void 0)return;t=requestAnimationFrame(()=>{t=void 0,this.#A()})},n=this.#H(),i=this.#t;this.#x=[n!==void 0?k(n,"scroll",e,{passive:!0}):k(window,"scroll",e,{passive:!0}),...i!==void 0?[k(i,"scroll",e,{passive:!0})]:[],k(window,"resize",e,{passive:!0}),()=>{if(t!==void 0)cancelAnimationFrame(t),t=void 0}]}};function Ct(t,{gutterWidth:e,placeAbove:n,viewport:i,x:s,y:r}){if(t.style.setProperty("--gutter-width",e+"px"),t.style.setProperty("--popover-x",s+"px"),t.style.setProperty("--popover-y",r+"px"),t.style.setProperty("--popover-y-shift",n?"-100%":"0px"),i===void 0){t.style.removeProperty("--popover-viewport-left"),t.style.removeProperty("--popover-viewport-right"),t.style.removeProperty("--popover-viewport-top"),t.style.removeProperty("--popover-viewport-bottom");return}t.style.setProperty("--popover-viewport-left",i.left+"px"),t.style.setProperty("--popover-viewport-right",i.right+"px"),t.style.setProperty("--popover-viewport-top",i.top+"px"),t.style.setProperty("--popover-viewport-bottom",i.bottom+"px")}var Ze=new Map([["'","'"],['"','"'],["`","`"],["{","}"],["[","]"],["<",">"],["(",")"]]),ri=new Set(["'",'"',"`"]),oi=new Set(["{","[","(","<"]);function Ye(t,e=0){let n=qe(t.startContainer,t.startOffset),i=qe(t.endContainer,t.endOffset);if(n===null||i===null)return;return{start:n,end:i,direction:e}}function Qe(t,e,n,i){if(t===void 0)return[[],e];let{start:s,end:r}=e,o=[],a={...e},c=s.line!==r.line,h=r.line;if(s.line<r.line&&r.character===0)h--;for(let d=s.line;d<=h;d++){let l=t.getLineText(d);if(l===void 0)continue;if(c&&l.trim().length===0)continue;let f=l.startsWith("\t")?"\t":" ".repeat(n),u=0,m=f;if(i){if(l.startsWith("\t"))u=1;else if(l.startsWith(" ")){let g=l.length-l.trimStart().length;u=Math.min(f.length,g)}if(u===0)continue;m=""}o.push({range:{start:{line:d,character:0},end:{line:d,character:u}},newText:m});let p=m.length-u;if(d===s.line)a={...a,start:{...s,character:Math.max(0,s.character+p)}};if(d===r.line)a={...a,end:{...r,character:Math.max(0,r.character+p)}}}return[o,a]}function Kt(t,e,n,i={}){let s=t.lineCount;return e.map((r)=>{let{line:o,character:a}=n==="up"||n==="left"?r.start:r.end;if(n==="textStart"||n==="start"||n==="end"){let h=N(r);o=h.line,a=h.character;let d=Je(t,o,a,i);if(n==="textStart"){let l=t.getLineText(o).slice(d.start,d.end),f=d.start+vn(l);a=a===f?d.start:f}else a=n==="start"?d.start:d.end}else if(n==="up"){let h=Ge(t,o,a,-1,i);if(h!==void 0)o=h.line,a=h.character;else if(o>0)o=i.resolveRenderableLine==null?o-1:i.resolveRenderableLine(o-1,"up")??o}else if(n==="down"){let h=Ge(t,o,a,1,i);if(h!==void 0)o=h.line,a=h.character;else{let d=Math.max(s-1,0);if(o<d)o=i.resolveRenderableLine==null?o+1:Math.min(i.resolveRenderableLine(o+1,"down")??o,d)}}else if(O(r)){let h=t.getLineLength(o);if(a=Math.min(a,h),n==="left"){if(a>0)a=xt(t,o,a,!1);else if(o>0){let d=i.resolveRenderableLine==null?o-1:i.resolveRenderableLine(o-1,"up");if(d!==void 0)o=d,a=t.getLineLength(o)}}else if(a<h)a=xt(t,o,a,!0);else if(o<s-1){let d=i.resolveRenderableLine==null?o+1:i.resolveRenderableLine(o+1,"down");if(d!==void 0)o=Math.min(d,s-1),a=0}}let c={line:o,character:a};return{start:c,end:c,direction:0}})}function Ge(t,e,n,i,s){if(s.getSoftLineOffsets===void 0)return;let r=Je(t,e,n,s),o=r.index+i,a=e,c;if(o>=0&&o<r.count)c=Lt(t,a,o,s);else{let u=e+i;if(u<0||u>=t.lineCount)return{line:e,character:n};let m=s.resolveRenderableLine==null?u:s.resolveRenderableLine(u,i<0?"up":"down");if(m===void 0)return{line:e,character:n};a=Math.min(m,t.lineCount-1);let p=ai(t,a,s);c=Lt(t,a,i<0?p-1:0,s)}let h=Math.max(0,n-r.start),d=c.start+h,l=c.index===c.count-1?d:Math.min(d,c.end),f=t.getLineText(a);return{line:a,character:l>f.length?l:bt(f,l)}}function bt(t,e){if(e<=0||e>=t.length)return e;let n=j();if(n!==void 0){for(let s of n.segment(t)){if(e<=s.index)return e;let r=s.index+s.segment.length;if(e<r)return r}return e}let i=0;for(let s of t){if(e<=i)return e;let r=i+s.length;if(e<r)return r;i=r}return e}function Je(t,e,n,i){let s=t.getLineLength(e),r=i.getSoftLineOffsets?.(e);if(r===void 0||r.length<2)return{start:0,end:s,index:0,count:1};for(let o=0;o+1<r.length;o++){let a=Lt(t,e,o,i);if(n>=a.start&&n<=a.end)return a}return Lt(t,e,n<(r[0]??0)?0:r.length-2,i)}function ai(t,e,n){let i=n.getSoftLineOffsets?.(e);return i===void 0||i.length<2?1:i.length-1}function Lt(t,e,n,i){let s=t.getLineLength(e),r=i.getSoftLineOffsets?.(e);if(r===void 0||r.length<2)return{start:0,end:s,index:0,count:1};let o=r.length-1,a=Math.max(0,Math.min(n,o-1)),c=Math.max(0,Math.min(s,r[a]??0));return{start:c,end:Math.max(c,Math.min(s,r[a+1]??s)),index:a,count:o}}function tn(t,e,n,i={}){return e.map((s)=>{let r=s.direction===-1?s.start:s.end,[o]=Kt(t,[{start:r,end:r,direction:0}],n,i);return kt(s,o)})}function en(t,e,n,i,s=2,r=!1){if(e[e.length-1]===void 0)return{nextSelections:[]};let o=[];for(let L of e)o.push(L.start,L.end);let a=o.map((L)=>t.offsetAt(L)),c=a[(e.length-1)*2],h=a[(e.length-1)*2+1],d=[],l=!0;for(let L=0;L<e.length;L++){let b={index:L,start:a[L*2],end:a[L*2+1]},w=d[d.length-1];if(w!==void 0&&(b.start<w.start||b.start===w.start&&b.end<w.end))l=!1;d.push(b)}if(!l)d.sort((L,b)=>{let w=L.start-b.start;if(w!==0)return w;let R=L.end-b.end;if(R!==0)return R;return L.index-b.index});let f=Ut(t,n,s),u=[],m=Array.from({length:e.length}),p=0,g,v=()=>{if(g===void 0)return;let L=Ut(t,{start:g.start,end:g.end,text:f.text},s),b=mn(t,L.text,L.start);u.push({start:L.start,end:L.end,text:b});let w=[g.start+p+b.length,g.start+p+b.length];for(let R of g.indices)m[R]=w;p+=b.length-(L.end-L.start),g=void 0};for(let L of d){let b=Math.max(0,L.start+(f.start-c)),w=Math.max(b,L.end+(f.end-h));if(g!==void 0&&b<g.end){g.end=Math.max(g.end,w),g.indices.push(L.index);continue}v(),g={start:b,end:w,indices:[L.index]}}v();let C=t.applyResolvedEdits(u,!0,e,void 0,r),x=Zt(t,m.map((L)=>{if(L===void 0)throw Error("Missing next selection offsets");return L}));if(t.setLastUndoSelectionsAfter(x),C!==void 0&&i!==void 0){let L=tt(C,i);if(L!==void 0)t.setLastUndoLineAnnotations(i,L)}return{nextSelections:x,change:C}}function ci(t,e){if(e.length!==t.length+2)return;let n=Ze.get(e[0]);if(n===void 0||e[e.length-1]!==n||e.slice(1,-1)!==t)return;return 1}function li(t,e,n,i){let s=e.start+n,r=s+i.length;if(e.end-e.start>0){let o=t.getTextSlice(e.start,e.end),a=ci(o,i)??i.indexOf(o);if(a!==-1&&a+o.length<=i.length){let c=s+a;return[c,c+o.length]}}return[r,r]}function nt(t,e,n,i,s=!1,r="selection"){if(e.length!==n.length)throw Error("Selection text replacements must match the selection count");let o=[];for(let p of e)o.push(p.start,p.end);let a=o.map((p)=>t.offsetAt(p)),c=[],h=!0;for(let p=0;p<e.length;p++){let g={index:p,start:a[p*2],end:a[p*2+1]},v=c[c.length-1];if(v!==void 0&&(g.start<v.start||g.start===v.start&&g.end<v.end))h=!1;c.push(g)}if(!h)c.sort((p,g)=>{let v=p.start-g.start;if(v!==0)return v;let C=p.end-g.end;if(C!==0)return C;return p.index-g.index});let d=n.every((p)=>p===""),l,f=Array.from({length:e.length});if(d){l=[];let p=!1;for(let g of c){if(f[g.index]=[g.end,g.end],g.start>=g.end)continue;p=!0;let v=l[l.length-1];if(v!==void 0&&g.start<v.end)l[l.length-1]={start:v.start,end:Math.max(v.end,g.end),text:""};else l.push({start:g.start,end:g.end,text:""})}if(!p)return{nextSelections:e};for(let g of c){let v=g.end,C=0,x=v;for(let L of l){if(v<=L.start)break;if(v>=L.end){C-=L.end-L.start;continue}x=L.start+C;break}if(x===v)x+=C;f[g.index]=[x,x]}}else{l=[];let p=0,g=-1;for(let v=0;v<c.length;v++){let C=c[v];if(C.start<g)throw Error("Overlapping multi-selection edits are not supported");g=C.end;let x=mn(t,n[r==="document"?v:C.index],C.start);l.push({start:C.start,end:C.end,text:x}),f[C.index]=li(t,C,p,x),p+=x.length-(C.end-C.start)}}let u=t.applyResolvedEdits(l,!0,e,void 0,s),m=Zt(t,f.map((p)=>{if(p===void 0)throw Error("Missing next selection offsets");return p}));if(t.setLastUndoSelectionsAfter(m),u!==void 0&&i!==void 0){let p=tt(u,i);if(p!==void 0)t.setLastUndoLineAnnotations(i,p)}return{nextSelections:m,change:u}}function hi(t,e){if(t==="never")return!1;if(t==="brackets")return oi.has(e);if(t==="quotes")return ri.has(e);return!0}function nn(t,e,n,i){if(n.length!==1||e.length===0)return;let s=Ze.get(n);if(s===void 0||!hi(i,n))return;let r=[];for(let o of e){if(O(o))return;r.push(n+t.getText(o)+s)}return r}function sn(t,e,n){let i=[],s=[];for(let a of e){let[c,h]=Li(t,a);if(!O(a)){s.push([c,h]);continue}let{line:d,character:l}=a.start,f=c,u=t.getLineText(d),m=u.length,p=f-l,g=Wt(u),v;if(l>0&&l<m){let C=lt(u,l,!1,g),x=lt(u,l,!0,g);v={start:p+C,end:p+x,text:u.slice(l,x)+u.slice(C,l)},s.push([p+x,p+x])}else if(l===m&&g.length>=2){let C=g[g.length-1],x=g[g.length-2];v={start:p+x,end:f,text:u.slice(C,m)+u.slice(x,C)},s.push([f,f])}else if(l===0&&d>0&&m>0){let C=d-1,x=t.getLineText(C),L=x.length,b=t.offsetAt({line:C,character:L}),w=L>0?lt(x,L,!1,Wt(x)):L,R=lt(u,0,!0,g),I=b-(L-w),E=u.slice(0,R)+t.getTextSlice(b,f)+x.slice(w,L);v={start:I,end:f+R,text:E};let A=I+E.length;s.push([A,A])}else{s.push([c,h]);continue}i.push(v)}if(i.length===0)return{nextSelections:e};i.sort((a,c)=>a.start-c.start);for(let a=1;a<i.length;a++)if(i[a].start<i[a-1].end)throw Error("Overlapping multi-selection edits are not supported");let r=t.applyResolvedEdits(i,!0,e),o=Zt(t,s);if(t.setLastUndoSelectionsAfter(o),r!==void 0&&n!==void 0){let a=tt(r,n);if(a!==void 0)t.setLastUndoLineAnnotations(n,a)}return{nextSelections:o,change:r}}function rn(t,e,n){let i=e.map((s)=>{let r=xi(t,s);return{start:r.start,end:r.end,direction:0}});return nt(t,i,i.map(()=>""),n)}function on(t,e,n,i){let s=e.map((r)=>{if(!O(r))return{start:r.start,end:r.end,direction:0};let o=N(r),{line:a,character:c}=o,h=n?.(a,c)??0;if(c>h)return{start:{line:a,character:h},end:{line:a,character:c},direction:0};if(a===0)return{start:o,end:o,direction:0};let d=t.getLineLength(a-1);return{start:{line:a-1,character:d},end:{line:a,character:0},direction:0}});return nt(t,s,s.map(()=>""),i)}function an(t,e,n){let i=e.map((s)=>{let[r,o]=Ci(t,s);return{start:r,end:o,direction:0}});return nt(t,i,i.map(()=>""),n)}function di(t,e,n){if(!O(e))return[e.start,e.end];let i=N(e),{line:s,character:r}=i,o=t.getLineLength(s),a=t.lineCount;if(r=Math.min(r,o),n){if(r<o)return[{line:s,character:r},{line:s,character:xt(t,s,r,!0)}];if(s<a-1)return[{line:s,character:o},{line:s+1,character:0}];return[i,i]}if(r>0)return[{line:s,character:xt(t,s,r,!1)},{line:s,character:r}];if(s>0){let c=t.getLineLength(s-1);return[{line:s-1,character:c},{line:s,character:0}]}return[i,i]}function cn(t,e,n,i,s=2){let r=e.map((o)=>{let[a,c]=di(t,o,n);if(!n&&O(o)){let h=Ut(t,{start:t.offsetAt(a),end:t.offsetAt(c),text:""},s);a=t.positionAt(h.start),c=t.positionAt(h.end)}return{start:a,end:c,direction:0}});return nt(t,r,r.map(()=>""),i)}function O(t){return t.start.line===t.end.line&&t.start.character===t.end.character}function N(t){let{start:e,end:n,direction:i}=t;return i===-1?e:n}function it(t){return t==="context"||t==="context-expanded"||t==="change-addition"}function ht(t,e){let n=O(t),i=O(e);if(n&&i)return T(t.start,e.start)===0;if(n)return T(e.start,t.start)<=0&&T(t.start,e.end)<=0;if(i)return T(t.start,e.start)<=0&&T(e.start,t.end)<=0;return T(t.start,e.end)<0&&T(e.start,t.end)<0}function T(t,e){if(t.line!==e.line)return t.line-e.line;return t.character-e.character}function yt(t,e,n){let i=e===n?0:e<n?1:-1,s=Math.min(e,n),r=Math.max(e,n);return{start:t.positionAt(s),end:t.positionAt(r),direction:i}}function je(t,e){let n=0;for(let i of e){if(t<i.start)break;if(t>=i.end)n+=i.text.length-(i.end-i.start);else return i.start+n+i.text.length}return t+n}function wt(t,e,n,i){return e.map((s,r)=>{let[o,a]=n[r],c=je(o,i),h=je(a,i);return yt(t,s.direction===-1?h:c,s.direction===-1?c:h)})}function kt(t,e){let n=t.direction===-1?t.end:t.start,i=T(n,e.start),s=T(n,e.end),r=e.end;if(i<=0)r=e.end;else if(s>=0)r=e.start;else r=i===0?e.end:e.start;let o=T(n,r);return{start:o<=0?n:r,end:o<=0?r:n,direction:o===0?0:o<0?1:-1}}function $t(t,e){let n=T(e.start,t.start)<0,i=T(e.end,t.end)>0;if(n&&!i)return{start:e.start,end:t.end,direction:-1};if(i&&!n)return{start:t.start,end:e.end,direction:1};if(t.direction===-1)return{start:e.start,end:t.end,direction:T(e.start,t.end)===0?0:-1};return{start:t.start,end:e.end,direction:T(t.start,e.end)===0?0:1}}function ln(t,e){return Gt(t.map((n)=>$t(n,e)))}function Gt(t){if(t.length<=1)return t;let e=t.map((s,r)=>({index:r,selection:s})).sort((s,r)=>{let o=T(s.selection.start,r.selection.start);if(o!==0)return o;let a=T(s.selection.end,r.selection.end);return a!==0?a:s.index-r.index}),n=[],i=e[0];for(let s of e.slice(1)){if(ht(i.selection,s.selection)){let r=s.index>i.index?s:i,o=T(s.selection.start,i.selection.start)<0?s.selection.start:i.selection.start,a=T(s.selection.end,i.selection.end)>0?s.selection.end:i.selection.end,c=r.selection.direction;if(c===0&&T(o,a)!==0)c=T(r.selection.start,o)===0?-1:1;i={index:r.index,selection:{direction:c,end:a,start:o}};continue}n.push(i),i=s}return n.push(i),n.sort((s,r)=>s.index-r.index).map(({selection:s})=>s)}function jt(t){let e=t.map((i)=>{let s=i.end.line;if(i.end.character===0&&T(i.start,i.end)!==0)s--;return{startLine:i.start.line,endLine:Math.max(i.start.line,s)}}).sort((i,s)=>{let r=i.startLine-s.startLine;return r!==0?r:i.endLine-s.endLine}),n=[];for(let i of e){let s=n.at(-1);if(s!==void 0&&i.startLine<=s.endLine+1)s.endLine=Math.max(s.endLine,i.endLine);else n.push({...i})}return n}function hn(t,e,n,i){let s=(r)=>{let o=r.line+e;if(o>=n){let a=Math.max(0,n-1);return{line:a,character:i(a)}}if(o<0)return{line:0,character:0};return{line:o,character:r.character}};return{start:s(t.start),end:s(t.end),direction:t.direction}}function dn(t,e){if(e.length===0)return;let n=e.map((c)=>O(c)?Tt(t,c):c),i=n.map((c)=>t.getText(c)),s=i[0];if(s.length===0||i.some((c)=>c!==s))return;let r=n.map((c)=>[t.offsetAt(c.start),t.offsetAt(c.end)]),o=t.findNextNonOverlappingSubstring(s,r);if(o===void 0)return n.some((c,h)=>{let d=e[h];return T(c.start,d.start)!==0||T(c.end,d.end)!==0||c.direction!==d.direction})?n:void 0;let a=yt(t,o,o+s.length);return[...n,a]}function fn(t){let e=t.lineCount-1;return{start:{line:0,character:0},end:{line:e,character:t.getLineLength(e)},direction:1}}function qt(t,e,n){let i=0;if(e){let o=t.lineCount-1;i=n===!0&&o>0&&t.getLineLength(o)===0?o-1:o}let s=e?t.getLineLength(i):0,r={line:i,character:s};return{start:r,end:r,direction:1}}function fi(t,e){if(O(e)){let s=e.start.line;return{start:t.offsetAt({line:s,character:0}),end:s<t.lineCount-1?t.offsetAt({line:s+1,character:0}):t.offsetAt({line:s,character:t.getLineLength(s)})}}let n=t.offsetAt(e.start),i=t.offsetAt(e.end);return n<=i?{start:n,end:i}:{start:i,end:n}}function un(t,e){return e.map((n)=>fi(t,n)).sort((n,i)=>{let s=n.start-i.start;return s!==0?s:n.end-i.end})}function pn(t,e){return un(t,e).map(({start:n,end:i})=>t.getTextSlice(n,i))}function Et(t,e){let n=un(t,e),i=t.eol,s="",r=-1;for(let o of n){if(o.end<=o.start)continue;if(o.start<=r){if(o.end>r)s+=t.getTextSlice(r,o.end),r=o.end;continue}if(s.length>0&&!De(s))s+=i;s+=t.getTextSlice(o.start,o.end),r=o.end}return s}function ui(t,e){if(O(e))return pi(t,e);let[n,i]=T(e.start,e.end)<=0?[e.start,e.end]:[e.end,e.start];return{start:t.offsetAt(n),end:t.offsetAt(i),text:""}}function pi(t,e){let n=e.start.line,i=t.offsetAt({line:n,character:0}),s=t.offsetAt({line:n,character:t.getLineLength(n)});if(n<t.lineCount-1)return{start:i,end:t.offsetAt({line:n+1,character:0}),text:""};if(n>0)return{start:t.offsetAt({line:n-1,character:t.getLineLength(n-1)}),end:s,text:""};return{start:i,end:s,text:""}}function gi(t){let e=[];for(let{edit:n}of t){if(n.start>=n.end)continue;let i=e.at(-1);if(i!==void 0&&n.start<=i.end)e[e.length-1]={start:i.start,end:Math.max(i.end,n.end),text:""};else e.push(n)}return e}function mi(t,e){let n=Array.from({length:t.length}),i=0,s=0;for(let r of t){while(i<e.length&&r.edit.start>e[i].end){let a=e[i];s-=a.end-a.start,i++}let o=e[i];if(o!==void 0&&r.edit.start>=o.start&&r.edit.start<=o.end)n[r.index]=o.start+s;else n[r.index]=r.edit.start+s}return n}function gn(t,e){let n=[...e.map((s,r)=>({index:r,edit:ui(t,s)}))].sort((s,r)=>{let o=s.edit.start-r.edit.start;if(o!==0)return o;let a=s.edit.end-r.edit.end;if(a!==0)return a;return s.index-r.index}),i=gi(n);return{text:Et(t,e),edits:i,nextSelectionOffsets:mi(n,i)}}function Xt(t,e){let n=Math.max(0,e),i=Cn(t),s=null;for(let a of i){s=a;let c=U(a);if(n<=c+(a.textContent?.length??0)){let h=Xe(a,n<c?0:n-c);if(h!==null)return h}}if(s!==null){let a=Xe(s,s.textContent?.length??0);if(a!==null)return a;return[s,0]}let r=0,o=null;for(let a of t.childNodes){if(a.nodeType===1&&a.tagName==="BR")return[a,0];if(a.nodeType!==3)continue;o=a;let c=q(o.textContent,o.textContent?.length??0);if(n<=r+c)return[o,q(o.textContent,n-r)];r+=c}if(o!==null)return[o,q(o.textContent,o.textContent?.length??0)];return[t,0]}function Tt(t,e){let{line:n,character:i}=e.start,s=t.getLineText(n),r=vi(s,Math.max(0,Math.min(i,s.length)));if(r===void 0)return e;return{start:{line:n,character:r.start},end:{line:n,character:r.end},direction:1}}function vi(t,e){let n=Ht({granularity:"word"});if(n!==void 0){for(let r of n.segment(t)){if(r.isWordLike!==!0)continue;let o=r.index,a=o+r.segment.length;if(e>=o&&e<=a)return{start:o,end:a}}return}let i=/[\p{Alphabetic}\p{Number}_]+/gu,s;while((s=i.exec(t))!==null){let r=s.index,o=r+s[0].length;if(e>=r&&e<=o)return{start:r,end:o}}}function Ci(t,e){if(!O(e))return[e.start,e.end];let n=N(e),{line:i,character:s}=n;if(s===0){if(i===0)return[n,n];let h=t.getLineLength(i-1);return[{line:i-1,character:h},{line:i,character:0}]}let r=t.getLineText(i),o=Wt(r),a=s,c;while(a>0){let h=lt(r,a,!1,o),d=r.slice(h,a),l=!/\S/.test(d)?0:/\p{Alphabetic}|\p{Number}|_/u.test(d)?1:2;if(c!==void 0&&l!==c)break;if(l!==0||a!==s)c=l;a=h}return[{line:i,character:a},{line:i,character:s}]}function lt(t,e,n,i){if(n){for(let s of i)if(s>e)return s;return t.length}for(let s=i.length-1;s>=0;s--){let r=i[s];if(r<e)return r}return 0}function Wt(t){let e=[0],n=j();if(n!==void 0){for(let s of n.segment(t))if(s.index>0)e.push(s.index);return e}let i=0;for(let s of t){if(i>0)e.push(i);i+=s.length}return e}function xt(t,e,n,i){let s=t.getLineLength(e);if(i){if(n>=s)return s;let d=t.offsetAt({line:e,character:0}),l=t.getTextSlice(d+n,d+s),f=j();if(f!==void 0){for(let u of f.segment(l))return n+u.segment.length;return s}for(let u of l)return n+u.length;return s}if(n<=0)return 0;let r=t.offsetAt({line:e,character:0}),o=t.getTextSlice(r,r+n),a=0,c=j();if(c!==void 0){for(let d of c.segment(o))a=d.index;return a}let h=0;for(let d of o)a=h,h+=d.length;return a}function Li(t,e){let n=e.direction===-1;return[t.offsetAt(n?e.end:e.start),t.offsetAt(N(e))]}function xi(t,e){if(!O(e))return{start:e.start,end:e.end};let{line:n,character:i}=e.start,s=t.getLineText(n).length;if(i<s)return{start:{line:n,character:i},end:{line:n,character:s}};if(n<t.lineCount-1)return{start:{line:n,character:i},end:{line:n+1,character:0}};return{start:{line:n,character:i},end:{line:n,character:i}}}function mn(t,e,n){if(e!==`
465
+ `&&e!=="\r"&&e!==`\r
466
+ `)return e;let i=t.positionAt(n).line,s=t.getLineText(i),r=vn(s);if(r===0)return e;return e+s.slice(0,r)}function vn(t){let e=0;for(;e<t.length;e++){let n=t.charCodeAt(e);if(n!==32&&n!==9)break}return e}function Zt(t,e){let n=[];for(let[s,r]of e)n.push(Math.min(s,r),Math.max(s,r));let i=t.positionsAt(n);return e.map(([s,r],o)=>{let a=s===r?0:s<r?1:-1;return{start:i[o*2],end:i[o*2+1],direction:a}})}function Ut(t,e,n){if(e.text!==""||e.start!==e.end-1)return e;let i=t.positionAt(e.end);if(i.character===0)return e;let s=t.getLineText(i.line),r=s.slice(0,i.character);if(/[^ \t]/.test(r))return e;if(s[i.character-1]==="\t")return e;let o=Math.max(0,i.character-n),a=s.slice(o,i.character);if(a.length===n&&/^ +$/.test(a))return{...e,start:e.end-a.length};return e}function qe(t,e){let n=t.nodeType===1?t:t.parentElement;while(n!==null&&St(n)===void 0)n=n.parentElement;if(n===null)return null;let i=St(n);if(i===void 0)return null;if(t.nodeType===3){if(t.parentElement===null)return null;if(Vt(t.parentElement)!==null)return{line:i,character:et(t,e)};return{line:i,character:Ft(n,t)+q(t.textContent,e)}}if(t.nodeType===1){let s=t;if(s.tagName==="DIV"){let r=0;for(let o=0;o<e;o++)r=et(s.childNodes[o]);return{line:i,character:r}}if(s.tagName==="BR")return{line:i,character:0};if(s.tagName==="SPAN"){if(e<s.childNodes.length){let r=s.childNodes[e];if(r?.nodeType===1){let o=U(r);if(o!==void 0)return{line:i,character:o};let a=Vt(r),c=a===null?void 0:U(a);if(c!==void 0)return{line:i,character:c}}}return{line:i,character:e>0?et(s.childNodes[e-1]):Ft(n,s)}}return{line:i,character:Ft(n,s)}}return null}function Cn(t){let e=[];for(let n of t.childNodes){if(n.nodeType!==1)continue;let i=n;if(i.tagName!=="SPAN")continue;if(U(i)!==void 0){e.push(i);continue}for(let s of i.childNodes)if(s.nodeType===1&&U(s)!==void 0)e.push(s)}return e}function Xe(t,e){let n=Math.max(0,e),i=[{container:t,index:0}];while(i.length>0){let s=i[i.length-1];if(s.index>=s.container.childNodes.length){i.pop();continue}let r=s.container.childNodes[s.index];if(s.index++,r.nodeType===3){let o=q(r.textContent,r.textContent?.length??0);if(n<=o)return[r,n];n-=o}else if(r.nodeType===1)i.push({container:r,index:0})}return null}function Ln(t,e){let n=0,i=[{container:t,index:0}];while(i.length>0){let s=i[i.length-1];if(s.index>=s.container.childNodes.length){i.pop();continue}let r=s.container.childNodes[s.index];if(r===e)return n;if(s.index++,r.nodeType===3)n+=q(r.textContent,r.textContent?.length??0);else if(r.nodeType===1)i.push({container:r,index:0})}return n}function Si(t,e){let n=e;while(n!==null){if(n===t)return!0;n=n.parentElement}return!1}function Ft(t,e){if(e.parentElement===t){let s=0,r=Array.prototype.indexOf.call(t.childNodes,e);for(let o=0;o<r;o++)s=et(t.childNodes[o]);return s}for(let s of Cn(t))if(Si(s,e))return U(s)+(e.nodeType===3?Ln(s,e):0);let n=0,i=e.nodeType===1?e:e.parentElement;while(i!==null&&i.parentElement!==null){if(St(i.parentElement)!==void 0)break;let s=i.parentElement,r=Array.prototype.indexOf.call(s.childNodes,i);for(let o=0;o<r;o++)n=et(s.childNodes[o]);i=s}return n}function Vt(t){let e=t;while(e!==null){if(St(e)!==void 0)return null;if(U(e)!==void 0)return e;e=e.parentElement}return null}function et(t,e){if(t===void 0)return 0;if(t.nodeType===3){let r=t.parentElement;if(r===null)return 0;let o=Vt(r);if(o===null)return 0;let a=U(o);if(a===void 0)return 0;let c=e===void 0?q(t.textContent,t.textContent?.length??0):q(t.textContent,e);return a+Ln(o,t)+c}if(t.nodeType!==1)return 0;let n=t;if(n.tagName!=="SPAN"&&n.tagName!=="BR")return 0;let i=U(n);if(i!==void 0)return i+(n.textContent?.length??0);let s=0;for(let r of n.childNodes)s=Math.max(s,et(r));return s}function St(t){let{line:e,lineType:n}=t.dataset;if(e!==void 0&&n!=="change-deletion"){let i=parseInt(e,10);if(!Number.isNaN(i))return i-1}}function U(t){let{char:e}=t.dataset;if(e!==void 0){let n=parseInt(e,10);if(!Number.isNaN(n))return n}}function q(t,e){let n=t??"",i=n.search(/[\r\n]/);return Math.min(e,i===-1?n.length:i)}var bi=300,yi=100,Yt="marker-popover",xn=class{#e;#t=[];#r=0;#n;#a;#l;#c;#m;#y;#p;#x=!1;constructor(t){this.#e=t}get markers(){return this.#t}isPopoverVisible(){return this.#p!==void 0}updatePopoverPosition(){let t=this.#p,e=this.#n;if(t===void 0||e===void 0)return;let n=this.#t[t];if(n===void 0){this.removePopover();return}this.#L(e,n.start.line,n.start.character)}setMarkers(t,e){this.#r=e.lineCount,this.#t=t.map((n)=>({...n,start:e.normalizePosition(n.start),end:e.normalizePosition(n.end)})),this.removePopover()}listenHover(t){if(this.#l?.forEach((e)=>e()),this.#l=void 0,this.#t.length===0)return;this.#l=[k(t,"mouseover",(e)=>{if(this.#e.isMouseDown())return;let n=e.composedPath()[0];if(n===void 0)return;let i=this.#u(n);if(i!==void 0)this.#H(i);else this.#w(),this.#o()}),k(t,"mouseleave",()=>{this.#w(),this.#o()})]}removePopover(){this.#w(),this.#A(),this.#v()}cleanup(){this.#l?.forEach((t)=>t()),this.#l=void 0,this.removePopover(),this.#t=[]}#u(t){let e=t.closest("[data-line]");if(e==null)return;let n=z(e);if(n===void 0)return;let i;if(t.tagName==="SPAN"){let r=t.dataset.char;if(r===void 0)return;if(i=parseInt(r,10),Number.isNaN(i))return}else if(t.tagName==="BR")i=0;else return;let s={line:n-1,character:i};for(let r=this.#t.length-1;r>=0;r--)if(ht({start:s,end:s},this.#t[r]))return r}#w(){if(this.#c!==void 0)clearTimeout(this.#c),this.#c=void 0;this.#y=void 0}#A(){if(this.#m!==void 0)clearTimeout(this.#m),this.#m=void 0}#H(t){if(t===this.#p||t===this.#y){this.#A();return}if(this.#w(),this.#A(),this.#n!==void 0){this.#k(t);return}this.#y=t,this.#c=setTimeout(()=>{this.#c=void 0,this.#y=void 0,this.#k(t)},bi)}#o(){if(this.#x)return;this.#A(),this.#m=setTimeout(()=>{if(this.#m=void 0,!this.#x)this.removePopover()},yi)}#P(t,e,n,i,s=this.#e.popoverManager.getPlacementBounds()){Ct(t,{gutterWidth:this.#e.getGutterWidth(),placeAbove:i,viewport:s,x:e,y:n})}#L(t,e,n){let{getCharX:i,getLineY:s,getLineHeight:r,popoverManager:o}=this.#e,[a,c]=i(e,n),h=r(),d=s(e)+c*h,l=t.offsetHeight,f={top:d+h,bottom:d+h+l},u={top:d-l,bottom:d},m=e>=this.#r-3,p=o.getPlacementBounds(),g=o.choosePlacement({preferred:f,fallback:u,viewport:p,popoverHeight:l,atDocumentEdge:m,placementKey:Yt})==="fallback";this.#P(t,a,g?d:d+h,g,p)}#v(){this.#a?.forEach((t)=>t()),this.#a=void 0,this.#n?.remove(),this.#n=void 0,this.#p=void 0,this.#x=!1,this.#e.popoverManager.resetPlacement(Yt)}#k(t){if(t===this.#p)return;let e=this.#e.getOverlayElement();if(t>=this.#t.length||e==null)return;let{start:n,message:i,severity:s}=this.#t[t],{line:r,character:o}=n,a=this.#n;if(this.#e.popoverManager.resetPlacement(Yt),a!==void 0){ki(a,s);let c=a.firstElementChild;if(c?.dataset.markerMessage!==void 0)if(typeof i==="string")c.textContent=i;else if(i instanceof HTMLElement)c.replaceChildren(i);else c.innerHTML=i.html;this.#L(a,r,o),this.#p=t;return}this.#n=y("div",{dataset:{editorWidget:"",markerPopover:"",[dt(s)]:""},children:[y("div",{dataset:"markerMessage",...typeof i==="string"?{textContent:i}:i instanceof HTMLElement?{children:[i]}:{innerHTML:i.html}})]},e),this.#L(this.#n,r,o),this.#p=t,this.#a=[k(this.#n,"mouseenter",()=>{this.#x=!0,this.#A()}),k(this.#n,"mouseleave",()=>{this.#x=!1,this.#o()})]}},wi=["error","warning","info","hint"];function ki(t,e){for(let n of wi)delete t.dataset[dt(n)];t.dataset[dt(e)]=""}function dt(t){switch(t){case"error":return"markerError";case"warning":return"markerWarning";case"info":return"markerInfo";case"hint":return"markerHint"}}var Qt=new Map([["(",")"],["[","]"],["{","}"]]),wn=new Map([...Qt].map(([t,e])=>[e,t]));function kn(t,e,n){let i=Ei(t,e,t.normalizePosition(n));if(i===void 0)return;let s=Qt.get(i.char),r=wn.get(i.char);if(s!==void 0)return bn(i,Ai(t,e,i,s));if(r!==void 0)return bn(Mi(t,e,i,r),i)}function Ei(t,e,n){let i=Ti(n);if(i!==void 0){let s=Sn(t,e,i);if(s!==void 0)return s}return Sn(t,e,n)}function Ti(t){if(t.character>0)return{line:t.line,character:t.character-1}}function Sn(t,e,n){let i=t.getLineText(n.line)[n.character];if(i===void 0||!Qt.has(i)&&!wn.has(i)||Ri(e,n))return;return{...n,char:i}}function Ai(t,e,n,i){let s=0,r=0,o=0;for(let a=n.line;a<t.lineCount;a++){if(r>=1000)return;r++;let c=t.getLineText(a),h=e.getStringCommentRegexpRangesInLine(a),d={index:0},l=a===n.line?n.character:0;for(let f=l;f<c.length;f++){if(o>=50000)return;if(o++,Ii(h,f,d))continue;let u=c[f];if(u===n.char)s++;else if(u===i){if(s--,s===0)return{line:a,character:f,char:u}}}}}function Mi(t,e,n,i){let s=0,r=0,o=0;for(let a=n.line;a>=0;a--){if(r>=1000)return;r++;let c=t.getLineText(a),h=e.getStringCommentRegexpRangesInLine(a),d={index:h===null?-1:h.length-1},l=a===n.line?n.character:c.length-1;for(let f=l;f>=0;f--){if(o>=50000)return;if(o++,Ni(h,f,d))continue;let u=c[f];if(u===n.char)s++;else if(u===i){if(s--,s===0)return{line:a,character:f,char:u}}}}}function Ri(t,e){return Oi(t.getStringCommentRegexpRangesInLine(e.line),e.character)}function Oi(t,e){if(t===null)return!1;for(let[n,i]of t){if(e<n)return!1;if(e<i)return!0}return!1}function Ii(t,e,n){if(t===null)return!1;while(n.index<t.length&&e>=t[n.index][1])n.index++;let i=t[n.index];return i!==void 0&&e>=i[0]}function Ni(t,e,n){if(t===null)return!1;while(n.index>=0&&e<t[n.index][0])n.index--;let i=t[n.index];return i!==void 0&&e<i[1]}function bn(t,e){if(t===void 0||e===void 0)return;return[yn(t),yn(e)]}function yn(t){return{start:{line:t.line,character:t.character},end:{line:t.line,character:t.character+1}}}var En=()=>{let t=document.createElement("div");t.innerHTML=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
467
+ <symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
468
+ <path fill="currentColor" d="M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z"></path>
469
+ </symbol>
470
+ <symbol id="diffs-editor-icon-arrow-up" viewBox="0 0 16 16">
471
+ <path fill="currentColor" transform="rotate(-90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
472
+ </symbol>
473
+ <symbol id="diffs-editor-icon-arrow-down" viewBox="0 0 16 16">
474
+ <path fill="currentColor" transform="rotate(90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
475
+ </symbol>
476
+ <symbol id="diffs-editor-icon-case" viewBox="0 0 16 16">
477
+ <path fill="currentColor" d="M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z"></path>
478
+ <path fill="currentColor" d="M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z"></path>
479
+ </symbol>
480
+ <symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
481
+ <path fill="currentColor" d="M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z"></path>
482
+ <path fill="currentColor" d="M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z"></path>
483
+ <path fill="currentColor" d="M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z"></path>
484
+ </symbol>
485
+ <symbol id="diffs-editor-icon-regex" viewBox="0 0 16 16">
486
+ <path fill="currentColor" d="M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z"></path>
487
+ <path fill="currentColor" d="M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z"></path>
488
+ </symbol>
489
+ <symbol id="diffs-editor-icon-replace" viewBox="0 0 16 16">
490
+ <path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z"></path>
491
+ </symbol>
492
+ <symbol id="diffs-editor-icon-replace-all" viewBox="0 0 16 16">
493
+ <path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z"></path>
494
+ </symbol>
495
+ </svg>`;let e=t.firstElementChild;if(e===null||!(e instanceof SVGSVGElement))throw Error("Failed to create sprite element");return e},Tn=(t,e=16)=>`<svg width="${e}" height="${e}" aria-hidden="true" focusable="false">
496
+ <use href="#diffs-editor-icon-${t}"></use>
497
+ </svg>`;var An=class{#e;#t;#r;#n;#a;#l;constructor(t){let{textDocument:e,containerElement:n,defaultQuery:i,mode:s="find",initialMatch:r,scrollToMatch:o,applyReplace:a,onUpdate:c,onClose:h}=t,d={text:i,replaceText:"",caseSensitive:!1,wholeWord:!1,regex:!1},l={all:[],current:void 0},f=y("div",{dataset:{matches:"",noMatches:""},textContent:"No results"}),u=(S)=>{l.all=d.text!==""?e.search(d):[];let M=l.all.length===0;if(Ot.disabled=M,It.disabled=M,M){f.textContent="No results",f.dataset.noMatches="",l.current=void 0,c([]);return}if(delete f.dataset.noMatches,S?.syncSelection===!1){m(c(l.all,{syncSelection:!1}));return}m(c(l.all))};this.#r=u;let m=(S)=>{if(S===void 0)f.textContent=`${l.all.length} results`;else{let[M,_]=S;f.textContent=`${l.all.findIndex((D)=>D[0]===M&&D[1]===_)+1} of ${l.all.length}`}l.current=S},p=(S,M)=>{d[S]=M,u()},g=(S=!1,M=!1)=>{let _=l.all,D=_[0];if(_.length>0)if(S){let Q=l.current?.[0]??0;D=_.at(-1);for(let rt of _)if(rt[1]<=Q)D=rt;else break}else{let Q=l.current?.[1]??0;for(let rt of _)if(rt[0]>=Q){D=rt;break}}if(D!==void 0)m(D),o(D,M);l.current=D};this.#a=(S)=>g(S,!0);let v=(S,M)=>({start:S,end:M,text:be((_)=>e.positionAt(_),(_)=>e.offsetAt(_),(_)=>e.getLineText(_),d,S,M)}),C=()=>{if(d.text===""||l.all.length===0)return;let S=l.current;if(S===void 0){if(g(!1,!0),S=l.current,S===void 0)return}let[M,_]=S,D=v(M,_);a([D]),o([M+D.text.length,M+D.text.length],!0),l.current=void 0,u()},x=()=>{if(d.text===""||l.all.length===0)return;a(l.all.map(([S,M])=>v(S,M))),l.current=void 0,u()},L=()=>{this.cleanup(),h()};this.#l=L;let b=(S)=>y("button",{type:"button",title:S.label,ariaLabel:S.label,dataset:{searchIcon:"",...S.dataset},innerHTML:Tn(S.icon,S.size??16),onclick:S.onClick}),w=(S,M,_)=>{let D=b({icon:S,label:M,size:14,onClick:()=>{let Q=!d[_];D.ariaPressed=String(Q),p(_,Q)}});return D.ariaPressed=String(d[_]),D},R=w("case","Match Case","caseSensitive"),I=w("whole-word","Whole Word","wholeWord"),E=w("regex","Regexp","regex"),A=y("input",{type:"text",placeholder:"Replace",dataset:"replace",value:"",oninput:(S)=>{d.replaceText=S.target.value},onkeydown:(S)=>{if(S.isComposing||S.keyCode===229)return;let M=at(S);if(S.key==="Escape")S.preventDefault(),L();else if(S.key==="Enter")S.preventDefault(),C();else if(M!==void 0)S.preventDefault(),g(M==="previous",!0)}});this.#t=y("input",{type:"text",placeholder:"Search",dataset:"search",value:i,oninput:(S)=>{d.text=S.target.value,l.current=void 0,u()},onkeydown:(S)=>{if(S.isComposing||S.keyCode===229)return;let M=at(S);if(S.key==="Escape")S.preventDefault(),L();else if(S.key==="Enter")S.preventDefault(),g(S.shiftKey,!0);else if(M!==void 0)S.preventDefault(),g(M==="previous",!0);else if(K(S)&&(S.key==="f"||S.code==="KeyF"))S.preventDefault(),de(S.altKey?"replace":"find")}});let B=y("div",{dataset:"searchToggles",children:[R,I,E]}),P=y("div",{dataset:{inputBox:"",find:""},children:[this.#t,B]}),H=y("div",{dataset:{inputBox:"",replace:"",replaceCell:""},children:[A]}),W=y("div",{dataset:{replaceActions:"",replaceCell:""},children:[b({icon:"replace",label:"Replace",onClick:C}),b({icon:"replace-all",label:"Replace All",onClick:x})]}),Ot=b({icon:"arrow-up",label:"Previous",onClick:()=>{g(!0)}}),It=b({icon:"arrow-down",label:"Next",onClick:()=>{g()}});Ot.disabled=!0,It.disabled=!0;let _n=y("div",{dataset:"searchNav",children:[Ot,It]}),Dn=b({icon:"close",label:"Close",onClick:L,dataset:{searchClose:""}}),he=y("div",{dataset:{searchGrid:"",mode:s},children:[P,H,W,f,_n,Dn]}),de=(S)=>{he.dataset.mode=S,this.#t.focus(),this.#t.select()};this.#n=de,this.#e=y("div",{dataset:"searchPanel",children:[y("div",{dataset:"editorWidget",children:[he]})]}),l.current=r,n.before(this.#e),requestAnimationFrame(()=>{if(r!==void 0)u();else c([]);this.#t.select()})}focus(){this.#t.focus()}navigate(t){this.#a?.(t)}updateMatches(t){this.#r?.(t)}setMode(t){this.#n?.(t)}close(){this.#l?.()}cleanup(){this.#e.remove()}};var Mn=class{#e;#t;#r;constructor(t,e,n){this.#e=y("div",{dataset:{editorWidget:"",selectionActionPopover:""},contentEditable:"false",children:[t]},e),this.#t=this.#e.offsetHeight,this.#r=new ResizeObserver(()=>{let i=this.#e.offsetHeight;if(i!==this.#t)this.#t=i,n()}),this.#r.observe(this.#e)}reposition(t,e,n,i,s,r){this.#e.style.visibility=s?"":"hidden",Ct(this.#e,{gutterWidth:n,placeAbove:i,viewport:r,x:t,y:e})}get height(){return this.#t}cleanup(){this.#r.disconnect(),this.#e.remove()}};function Z(t){return{selections:t.selections?.map((e)=>({start:{...e.start},end:{...e.end},direction:e.direction})),view:t.view===void 0?void 0:{...t.view}}}function Rn(t){return typeof t==="object"?t:t==="indexedDB"?new Di:new Pi}var Pi=class{#e=new Map;get(t){let e=this.#e.get(t);return e===void 0?void 0:Z(e)}set(t,e){this.#e.set(t,Z(e))}},Bi="pierre-diffs-editor-state",_i=1,st="states",Di=class{#e=zi();async get(t){let e=await this.#e;if(e===void 0)return;let n=await Jt(e.transaction(st,"readonly").objectStore(st).get(t));return n===void 0?void 0:Z(n)}async set(t,e){let n=await this.#e;if(n===void 0)return;await Jt(n.transaction(st,"readwrite").objectStore(st).put(Z(e),t))}};function zi(){try{let t=globalThis.indexedDB;if(t===void 0)return Promise.resolve(void 0);let e=t.open(Bi,_i);return e.onupgradeneeded=()=>{let n=e.result;if(!n.objectStoreNames.contains(st))n.createObjectStore(st)},Jt(e)}catch{return Promise.resolve(void 0)}}function Jt(t){return new Promise((e,n)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>n(t.error)})}var Hi=4096,Fi=/\p{Mark}/u,On=class{#e;#t;#r;#n=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(t){if(this.#e===t&&this.#t!==void 0&&this.ch!==-1)return;if(this.#e=t,this.#t??=document.createElement("canvas").getContext("2d")??void 0,this.#t===void 0)throw Error("Could not get canvas context");let e=t.parentElement;if(e!==null){let{paddingTop:c}=getComputedStyle(e);if(c.endsWith("px"))this.paddingTop=parseFloat(c.slice(0,-2))}let{fontSize:n,fontFamily:i,tabSize:s,lineHeight:r}=getComputedStyle(t);if(r.endsWith("px"))this.lineHeight=parseFloat(r.slice(0,-2));else if(n.endsWith("px"))this.lineHeight=G(parseFloat(n.slice(0,-2))*parseFloat(r));let o=n+" "+i;if(this.#r!==o||this.ch===-1)this.#r=o,this.#t.font=o,this.ch=this.canvasMeasureTextWidth("0"),this.clearTextWidthCache();let a=parseInt(s,10);if(!Number.isNaN(a))this.tabSize=a}remeasureCharacterWidth(){if(this.#t===void 0||this.#r===void 0)return!1;this.#t.font=this.#r;let t=this.canvasMeasureTextWidth("0"),e=t!==this.ch;if(e)this.ch=t;let n=this.#l();return e||n}measureTextWidth(t){if(!t.includes("\t"))return this.#a(t);if(this.#t===void 0)throw Error("Metrics not initialized");let e=ft(t,this.tabSize);if(e!==-1)return e*this.ch;let n=0,i=0,s=this.tabSize*this.ch;for(let r=0;r<t.length;r++){if(t.charCodeAt(r)!==9)continue;if(r>i)n+=this.#a(t.slice(i,r));if(s>0){let o=n%s;n+=o===0?s:s-o}i=r+1}if(i<t.length)n+=this.#a(t.slice(i));return G(n)}#a(t){if(te(t))return this.domMeasureTextWidth(t);return this.canvasMeasureTextWidth(t)}canvasMeasureTextWidth(t){if(this.#t===void 0)throw Error("Metrics not initialized");return G(this.#t.measureText(t).width)}domMeasureTextWidth(t){if(this.#e===void 0)throw Error("Metrics not initialized");let e=t+"|"+this.#r,n=this.#n.get(e);if(n!==void 0)return n;let i=y("span",{style:{position:"absolute",top:"0",left:"0",visibility:"hidden",pointerEvents:"none",whiteSpace:"pre",font:"inherit"},textContent:t},this.#e),s;try{s=G(i.getBoundingClientRect().width)}finally{i.remove()}if(this.#n.size>=Hi){let r=this.#n.keys().next().value;if(r!==void 0)this.#n.delete(r)}return this.#n.set(e,s),s}clearTextWidthCache(){this.#l()}#l(){let t=this.#n.size>0;return this.#n.clear(),t}};function te(t){for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&Fi.test(t.charAt(e)))return!0}return!1}function In(t,e){let n=Math.max(0,Math.min(e,t.length));if(n===0||n===t.length||!te(t))return n;let i=j();if(i!==void 0){for(let r of i.segment(t)){let o=r.index,a=o+r.segment.length;if(n>o&&n<a)return a;if(n<=o)break}return n}let s=0;for(let r of t){let o=s+r.length;if(n>s&&n<o)return o;if(n<=s)break;s=o}return n}function Nn(t){if(!te(t))return;let e=[0],n=j();if(n!==void 0){for(let s of n.segment(t))e.push(s.index+s.segment.length);return e}let i=0;for(let s of t)i+=s.length,e.push(i);return e}function ft(t,e){let n=0;for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);if(s>127)return-1;n+=s===9?e-n%e:1}return n}var ee=500,Wi=0,Bn=class{#e;#t;#r;#n="dark";#a="";#l;#c;#m;#y;#p;#x;#u;#w;#A;#H=!1;#o=[X];#P=[];#L=0;#v=[];#k=-1;#g=!0;#M=!1;#C=0;#q=++Wi;#E=-1;#N=-1;#U;#b=0;#R=[];#h=!1;#V=_e(async(t)=>{if(this.#H)return;let{startingLine:e=0,totalLines:n=1/0}=t??{},i=Math.min(n===1/0?1/0:e+n,this.#c.lineCount);if(this.#t===void 0&&!At(this.#c.languageId)){if(await this.#e.loadLanguage(this.#c.languageId),this.#H)return;this.#t=this.#e.getLanguage(this.#c.languageId)}this.#_(),this.#B(i)},500);#W=({data:t})=>{if(typeof t!=="object"||t===null)return;let{type:e,tokenizerId:n,jobId:i}=t;if(e==="tokenize"&&n===this.#q&&typeof i==="number"&&i===this.#C)if(this.#E>=0)this.#I(i);else this.#Lt(i)};get themeType(){return this.#n}getStringCommentRegexpRangesInLine(t){if(!this.#u||t<0||t>=this.#c.lineCount)return null;if(this.#T(),this.#t===void 0)return null;if(this.#R[t]===void 0){this.#O(t);let e=this.#o[t]??X,n=this.#D(t,e);this.#o[t+1]=n.state}return this.#R[t]??null}constructor({codeOptions:t,highlighter:e,textDocument:n,matchBrackets:i,setStyle:s,onDeferTokenize:r,onThemeChange:o,__debug:a}){let{themeType:c="system",theme:h=ie,tokenizeMaxLineLength:d=1000}=t;this.#r=window.matchMedia("(prefers-color-scheme: dark)");let l;if(c==="system")l=this.#Z();else l=c;if(typeof h!=="string"&&c==="system"){let f=new MutationObserver((u)=>{for(let{type:m,attributeName:p}of u)if(m==="attributes"&&p!==null&&(p==="class"||p.startsWith("data-"))){let g=this.#Z();this.#X(h[g],g);break}});f.observe(document.documentElement,{attributes:!0}),f.observe(document.body,{attributes:!0}),this.#A=[k(this.#r,"change",()=>{let u=this.#Z();this.#X(h[u],u)}),()=>f.disconnect()]}this.#e=e,this.#c=n,this.#m=d,this.#y=s,this.#p=r,this.#x=o,this.#u=i!==!1,this.#w=a??!1,this.#T(),this.#l=[],this.#f(typeof h==="string"?h:h[l],typeof h==="string"?void 0:l)}#X(t,e){if(t===this.#a&&e===this.#n)return;if(this.#f(t,e),this.stopBackgroundTokenize(),this.#o=[X],this.#P=[],this.#L=0,this.#v=[],this.#t!==void 0&&this.#c.lineCount>0)this.#S(0);this.#x?.()}#Z(){try{if(typeof document<"u"&&typeof getComputedStyle==="function"&&document.body!=null){let t=getComputedStyle(document.body).colorScheme.split(/\s+/),e=t.includes("dark");if(e!==t.includes("light"))return e?"dark":"light"}}catch{}return this.#r.matches?"dark":"light"}syncTheme(t){let{themeType:e="system",theme:n=ie}=t;if(typeof n==="string"){let r=this.#e.getTheme(n).type;if(n===this.#a&&r===this.#n)return;this.#X(n,r);return}let i=e==="system"?this.#Z():e,s=n[i];if(i===this.#n&&s===this.#a)return;this.#X(s,i)}#f(t,e){let{theme:n,colorMap:i}=this.#e.setTheme(t),{colors:s={}}=this.#e.getTheme(t),r=s["editor.selectionBackground"],o=s["editor.lineHighlightBackground"],a=o!=null&&o.trim()!==""&&!Pn.isFullyTransparent(o)?o:void 0,c=s["editor.lineHighlightBorder"]??(a==null?"color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))":"transparent"),h=a==null?"100%":"85%",d=s["editorCursor.foreground"],l=s["editor.findMatchBackground"],f=s["editor.findMatchHighlightBackground"],u=s["editorBracketMatch.background"],m=s["editorBracketMatch.border"],p=s["editorHint.foreground"],g=s["editorInfo.foreground"],v=s["editorWarning.foreground"],C=s["editorError.foreground"];this.#y(`:host {
498
+ --diffs-editor-selection-bg: ${r??"var(--diffs-line-bg)"};
499
+ --diffs-editor-line-highlight-border: ${c};
500
+ --diffs-editor-active-line-source-mix: ${h};
501
+ --diffs-editor-match-bg: ${l??"initial"};
502
+ --diffs-editor-match-highlight-bg: ${f??"initial"};
503
+ --diffs-editor-bracket-match-bg: ${u??"initial"};
504
+ --diffs-editor-bracket-match-border: ${m??"initial"};
505
+ --diffs-editor-cursor-fg: ${d??"initial"};
506
+ --diffs-editor-hint-fg: ${p??"initial"};
507
+ --diffs-editor-info-fg: ${g??"initial"};
508
+ --diffs-editor-warning-fg: ${v??"initial"};
509
+ --diffs-editor-error-fg: ${C??"initial"};
510
+ }`),this.#a=t,this.#n=e??n.type,this.#l=i}#_(){if(this.#a==="")return;let{colorMap:t}=this.#e.setTheme(this.#a);this.#l=t}cleanUp(){this.#H=!0,this.stopBackgroundTokenize(),this.#K(),this.#A?.forEach((t)=>t()),this.#A=void 0}tokenize(t,e,n=!1){if(this.#T(),this.#_(),this.#t===void 0&&!At(this.#c.languageId))throw Error(`Grammar for language "${this.#c.languageId}" not loaded`);let{lineCount:i}=this.#c,{startingLine:s=0,totalLines:r=1/0}=e??{},o=r===1/0?i:Math.min(s+r,i),a=t.startLine,c=Math.max(s,a),h=e!==void 0&&r!==1/0&&t.lineDelta>0&&a<o&&t.endLine>=o,d=t.lineDelta===0&&(t.changedLineChanges?.every(([,,E])=>E===0)??!0);if(this.#u&&!d)this.#R.length=Math.min(this.#R.length,t.startLine);let l=n&&t.lineDelta!==0&&a>=s,f=d||e===void 0||a>=c,u=t.changedLineRanges??[[a,t.endLine]];this.#P=[],this.#L=0,this.#v=[];let m=-1;if(a<c){for(let[E,A]of u)if(E<c)m=Math.max(m,Math.min(A,c-1))}let p=m>=a&&(d||t.lineDelta<0);if(d)this.#O(a);else if(this.#F(t),e===void 0||a>=c)this.#O(c);let g=0,v=u[g][1],C,x=0,L=d?u[g][0]:c,b=!1,w=new Map,R=p?new Map:void 0;if(R!==void 0&&!d){let E=Math.min(m+1,c,o);if(E>a){this.#O(E);let A=a,B=this.#o[A]??X;for(;A<E;A++){let P=this.#D(A,B);B=P.state,R.set(A,P.resolvedTokens)}this.#o[E]=B}}let I=this.#o[L]??X;for(;L<o;){let E=d?this.#o[L+1]:l?this.#Y(L+1):void 0;if(f)this.#o[L]=I;let{resolvedTokens:A,state:B}=this.#D(L,I);if(I=B,L>=c)w.set(L,A);else R?.set(L,A);if(f)this.#o[L+1]=I;if(b=L>=v&&(d||l)&&E!==void 0&&I.equals(E),b){g++;let P=u[g];if(P===void 0)break;if(P[0]>=o){C=P[0],x=g;break}let H=this.#o[P[0]];if(l)for(let W=L+2;W<=P[0];W++){if(H=this.#Y(W),H===void 0)break;this.#o[W]=H}if(H===void 0)v=P[1],L++;else L=P[0],I=H,v=P[1];b=!1;continue}L++}if(f)if(L<o)this.#o[L+1]=I;else this.#o[L]=I;if(b&&l&&C===void 0){for(let E=L+2;E<=i;E++){let A=this.#Y(E);if(A===void 0)break;this.#o[E]=A}this.#P=[],this.#L=0,this.#v=[]}if(R!==void 0&&R.size>0)this.#p(R,this.#n);if(C!==void 0){if(this.#u&&d)this.#R.length=Math.min(this.#R.length,C);this.#S(C,u,x)}else if(!b&&L<i){let E=h&&a>=c?o:a<c&&!d?a:L;if(this.#u&&d)this.#R.length=Math.min(this.#R.length,E);this.#S(E,u,g)}return w}prebuildStateStack(t){this.#T(),this.#V(t)}stopBackgroundTokenize(){if(this.#N=-1,this.#g)return;this.#g=!0,this.#M=!1,this.#k=-1,this.#E=-1,this.#U=void 0,this.#b=0,this.#P=[],this.#L=0,this.#v=[],this.#K()}pauseBackgroundTokenize(){if(this.#g||this.#M)return;if(this.#w)console.log("[diffs/editor] background tokenization paused",{jobId:this.#C});this.#M=!0}resumeBackgroundTokenize(){if(this.#g||!this.#M||this.#t===void 0||this.#k<0)return;if(this.#w)console.log("[diffs/editor] background tokenization resumed",{jobId:this.#C});this.#M=!1,this.#J(this.#C)}#T(){if(this.#t===void 0&&!At(this.#c.languageId)&&this.#e.getLoadedLanguages().includes(this.#c.languageId))this.#t=this.#e.getLanguage(this.#c.languageId)}#s(){if(this.#h)return;globalThis.addEventListener("message",this.#W),this.#h=!0}#K(){if(!this.#h)return;globalThis.removeEventListener("message",this.#W),this.#h=!1}#J(t){globalThis.postMessage({type:"tokenize",tokenizerId:this.#q,jobId:t})}#S(t,e,n=0){if(At(this.#c.languageId))return;let i=++this.#C;if(this.#w)console.log("[diffs/editor] background tokenization scheduled",{jobId:i,startLine:t,changedLineRanges:e,changedRangeIndex:n});if(this.#g=!1,this.#M=!1,this.#k=t,this.#E>=0)this.#N=Math.max(this.#N,this.#E);this.#E=-1,this.#U=e,this.#b=n,this.#s(),this.#J(i)}#B(t){if(this.#t===void 0||this.#o.length>t)return;if(!this.#g){if(this.#E>=0)this.#E=Math.max(this.#E,t);else this.#N=Math.max(this.#N,t);return}let e=++this.#C;this.#g=!1,this.#M=!1,this.#k=this.#o.length-1,this.#E=t,this.#N=-1,this.#U=void 0,this.#b=0,this.#s(),this.#J(e)}#D(t,e){let n=this.#c.getLineText(t);if(n.length>this.#m)return console.warn(`[diffs] Line(${t}) too long to tokenize: ${n.length}`),this.#z(t,null),{resolvedTokens:[[0,"",n]],state:e};if(this.#t===void 0||n===""||n.trim()==="")return this.#z(t,null),{resolvedTokens:[[0,"",n]],state:e};let i=ne(this.#t,this.#l,n,e,ee,this.#u);return this.#z(t,i.bracketIgnoredRanges),{resolvedTokens:i.resolvedTokens,state:i.ruleStack}}#z(t,e){if(this.#u)this.#R[t]=e}#F(t){let e=t.changedLineChanges??[[t.startLine,t.endLine,t.lineDelta]],n=t.startLine+1;if(n<=this.#o.length-n)this.#P=this.#o,this.#L=0,this.#o=this.#o.slice(0,n);else this.#L=n,this.#P=this.#o.slice(n),this.#o.length=Math.min(this.#o.length,n);this.#v=e}#Y(t){let e=t;for(let n=this.#v.length-1;n>=0;n--){let[i,s,r]=this.#v[n];if(r===0)continue;if(e>s)e-=r;else if(e>i)return this.#o[t]}return this.#P[e-this.#L]??this.#o[t]}#O(t,e){let n=Math.min(Math.max(0,t),this.#c.lineCount);if(this.#o.length>n||this.#t===void 0)return!0;let i=e===void 0?0:performance.now(),s=this.#o.length-1,r=this.#o[s]??X;while(s<n){this.#o[s]=r;let o=this.#c.getLineText(s);if(o.length<=this.#m&&o!==""&&o.trim()!==""){let a=ne(this.#t,this.#l,o,r,ee,this.#u,!1);this.#z(s,a.bracketIgnoredRanges),r=a.ruleStack}else this.#z(s,null);if(s++,this.#o[s]=r,e!==void 0&&performance.now()-i>e)break}return s>=n}#I(t){if(this.#g||this.#M||this.#t===void 0||t!==this.#C)return;this.#_();let e=this.#O(this.#E,1);if(this.#g||this.#M||t!==this.#C)return;if(e){this.stopBackgroundTokenize();return}this.#k=this.#o.length-1,this.#J(t)}#Lt(t){if(this.#g||this.#M||this.#t===void 0||t!==this.#C)return;this.#_();let e=performance.now(),n=new Map,i=this.#c.lineCount,s=this.#U,r=this.#k,o=this.#o[r]??X,a=!1,c=this.#b,h=s?.[c]?.[1];for(;r<i;){this.#o[r]=o;let d=h!==void 0?this.#Y(r+1):void 0,l=this.#c.getLineText(r);if(l.length>this.#m)console.warn(`[diffs] Line(${r}) too long to tokenize: ${l.length}`),n.set(r,[[0,"",l]]),this.#z(r,null);else if(l===""||l.trim()==="")n.set(r,[[0,"",l]]),this.#z(r,null);else{let f=ne(this.#t,this.#l,l,o,ee,this.#u);n.set(r,f.resolvedTokens),this.#z(r,f.bracketIgnoredRanges),o=f.ruleStack}if(this.#o[r+1]=o,a=h!==void 0&&r>=h&&d!==void 0&&o.equals(d),r++,a){c++;let f=s?.[c];if(f===void 0)break;if(h=f[1],this.#o[f[0]]===void 0)a=!1;else{r=f[0],o=this.#o[r]??o,a=!1;continue}}if(performance.now()-e>1)break}if(this.#p(n,this.#n),this.#g||this.#M||t!==this.#C)return;if(a||r>=i){let d=this.#N;if(this.stopBackgroundTokenize(),d>=0)this.#B(d);return}this.#k=r,this.#b=c,this.#J(t)}};function ne(t,e,n,i,s,r=!0,o=!0){let a=t.tokenizeLine2(n,i,s);if(a.stoppedEarly)console.warn(`[diffs] Time limit reached when tokenizing line: ${n.substring(0,100)}`);let c=a.tokens,h=c.length/2,d=[],l=[];if(!o&&!r)return{ruleStack:a.ruleStack,resolvedTokens:d,bracketIgnoredRanges:l};for(let f=0;f<h;f++){let u=c[2*f],m=f+1<h?c[2*f+2]:n.length;if(u===m)continue;let p=c[2*f+1];if(o){let g=se.getForeground(p);d.push([u,e[g],n.slice(u,m)])}if(r&&se.getTokenType(p)>0)l.push([u,m])}return{ruleStack:a.ruleStack,resolvedTokens:d,bracketIgnoredRanges:l}}function Mt(t){return t.map(([e,n,i])=>{if(e===0&&n===""){if(i==="")return y("br");return i}return y("span",{dataset:{char:e.toString()},style:`color:${n};`,textContent:i})})}function At(t){return t==="text"||t==="ansi"}function Ui(t){let e=t.getSelection?.();if(e==null||e.rangeCount===0)return;let n=e.getRangeAt(0);return{collapsed:n.collapsed,startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}}function Y(t){if(typeof t.cacheKey!=="string"||t.cacheKey.length===0)throw Error(`Editor persistState requires a non-empty file.cacheKey for "${t.name}". Provide a unique, stable cacheKey for every editable file.`);return t.cacheKey}function re(t){return typeof t==="object"&&t!==null&&"then"in t&&typeof t.then==="function"}var Vi=2,Ki=1e4,oe="selection-action",ae="application/vnd.pierre.diffs-selections+json",$i=class{#e;#t=new On;#r;#n;#a=new Map;#l;#c;#m=new Map;#y;#p=0;#x=!1;#u;#w;#A;#H;#o={generation:0,callback:void 0,delivered:!1};#P;#L;#v;#k=new Map;#g=new Map;#M=new Map;#C;#q;#E;#N;#U;#b;#R;#h;#V;#W;#X;#Z;#f;#_;#T;#s;#K;#J;#S;#B;#D;#z=!0;#F=!1;#Y=!1;#O=!1;#I;#Lt=!1;#xt=!1;#st=!1;#at;#Pt=!1;#$;#St="";#bt;#Bt;#i;#Q;#tt;#dt;#kt=!1;#ft=!1;#ct=!1;#_t=!1;#ut;#Se=(t,e)=>{if(this.#f?.updateRenderCache(t,e),this.#K!==void 0&&this.#K.totalLines!==1/0){let{startingLine:n,totalLines:i}=this.#K,s=Math.min(n+i,this.#s?.lineCount??0);for(let[r,o]of t)if(r>=n&&r<s){let a=this.#ht(r);if(a!==void 0)a.replaceChildren(...Mt(o))}}};constructor(t={}){this.#e=t}setOptions(t){let e=this.#e.persistStateStorage??"inMemory",n={...this.#e,...t};if(n.persistState===!0&&this.#f?.type==="file"){let i=this.#f.__getCurrentFile?.()??this.#_;if(i!==void 0)Y(i)}if(this.#e=n,this.#e.persistState!==!0)this.#a.clear(),this.#p++,this.#x=!1;if((this.#e.persistStateStorage??"inMemory")!==e)this.#p++,this.#l=void 0,this.#c=void 0,this.#m.clear()}edit(t){if(this.#e.persistState===!0&&t.type==="file"){let e=t.__getCurrentFile?.();if(e!==void 0)Y(e)}return this.#zt(),this.#f=t,this.#Te(),this.#H=t.attachEditor(this),()=>this.cleanUp()}applyEdits(t,e=!0){let n=this.#s;if(n==null)throw Error("Editor is not attached");let i=this.#O,s=this.#i,r=s?.map((h)=>[n.offsetAt(h.start),n.offsetAt(h.end)]),o=s===void 0?void 0:n.resolveEdits(t).sort((h,d)=>h.start-d.start),a=n.applyEdits(t,e,s);if(a===void 0)return;let c;if(s!==void 0&&r!==void 0&&o!==void 0){if(c=wt(n,s,r,o),e)n.setLastUndoSelectionsAfter(c)}this.#j(a,c,this.#it(a),{skipFocus:!i})}get canUndo(){return this.#s?.canUndo??!1}get canRedo(){return this.#s?.canRedo??!1}undo(){this.#Ft("undo")}redo(){this.#Ft("redo")}getFile(){let t=this.#_,e=this.#s;if(t===void 0||e===void 0)return;let n={...t};return Object.defineProperty(n,"contents",{enumerable:!0,get:()=>e.getText()}),n}getText(){return this.#s?.getText()??""}getState(){let t=this.#f;return{selections:this.#i,view:t!=null?{scrollLeft:t.getCodeScrollLeft(),scrollTop:this.#Ee()}:void 0}}setState({selections:t,view:e}){if(this.#f===void 0||this.#s===void 0)throw Error("Editor is not attached");if(this.#z=!1,this.#d(t??[]),e!=null){if(this.#f.setCodeScrollLeft(e.scrollLeft),e.scrollTop!==void 0)this.#Qt(e.scrollTop);return}this.#nt()}setSelections(t){let e=this.#s;if(e===void 0)throw Error("Text document is not initialized");let n=t.map((s)=>{let r=e.normalizePosition(s.start),o=e.normalizePosition(s.end),a=s.direction==="none"?0:s.direction==="backward"?-1:1;if(T(r,o)>0){if([r,o]=[o,r],a!==0)a=a===1?-1:1}return{direction:a,start:r,end:o}});this.#z=!1,this.#d(n);let i=n.at(-1);if(i!==void 0)this.#lt(N(i).line);this.#nt()}setMarkers(t){let e=this.#s;if(e===void 0)throw Error("Text document is not initialized");if(t.length===0){this.#S?.cleanup(),this.#S=void 0,this.#d(this.#i??[]);return}if(this.#S??=new xn({popoverManager:this.#Tt(),getLineHeight:()=>this.#t.lineHeight,getOverlayElement:()=>this.#V,getGutterWidth:()=>this.#ot(),getCharX:(n,i)=>this.#Ct(n,i),getLineY:(n)=>this.#vt(n),isMouseDown:()=>this.#st||this.#xt}),this.#S.setMarkers(t,e),this.#h!==void 0)this.#S.listenHover(this.#h);this.#d(this.#i??[])}focus(t){let e=t?.preventScroll??!1,n=t?.lineNumber;if(n==="first-visible"||typeof n==="number"){let s=this.#s;if(s==null||this.#f==null)return;let r=n==="first-visible"?this.#_e(t?.offset):n;if(r==null)return;let o=s.normalizePosition({line:r-1,character:n==="first-visible"?0:t?.character??0});this.#De(o,e);return}let i=this.#i?.at(-1);if(i!==void 0){let s=i.direction===-1?i.end:i.start;this.#G(s,e)}else this.#G(void 0,e)}blur(){this.#I=void 0,this.#O=!1,this.#F=!1,this.#h?.blur()}cleanUp(t=!1){if(this.#zt(),!t)this.#o.delivered=!1;let e=this.#f!=null,n=this.#e.persistState===!0;if(this.#p++,this.#qt(),e)this.#x=n;if(ce(this.#ee),this.#r?.cleanUp(),this.#r=void 0,!t)this.#s=void 0,this.#_=void 0;if(this.#w?.forEach((i)=>i()),this.#w=void 0,this.#u?.forEach((i)=>i()),this.#u=void 0,this.#H?.(t),this.#H=void 0,this.#L=void 0,this.#v=void 0,this.#k.clear(),this.#g.clear(),this.#M.clear(),this.#C=void 0,this.#q?.remove(),this.#q=void 0,this.#E?.remove(),this.#E=void 0,this.#N?.remove(),this.#N=void 0,this.#U?.remove(),this.#U=void 0,this.#b=void 0,this.#n?.cleanUp(),this.#n=void 0,this.#R=void 0,this.#h?.removeAttribute("contentEditable"),this.#h=void 0,this.#I=void 0,this.#O=!1,this.#V?.remove(),this.#V=void 0,this.#Z?.disconnect(),this.#Z=void 0,this.#_t=!1,this.#ut!==void 0)cancelAnimationFrame(this.#ut),this.#ut=void 0;this.#Yt(),this.#f=void 0}__prepareFile(t){if(this.#e.persistState!==!0)return t;let e=Y(t),n=this.#_,i=t.lang??Rt(t.name);if(n!==void 0&&(Y(n)!==e||n.name!==t.name||this.#s?.languageId!==i))this.#p++,this.#qt();let s=this.#Gt(t,e);if(s===void 0||s.getText()===t.contents)return t;return{...t,contents:s.getText()}}__postponeBgTokenizeToNextFrame(){let t=this.#r;if(t!==void 0)t.pauseBackgroundTokenize(),requestAnimationFrame(()=>{t.resumeBackgroundTokenize()})}__captureFocusForDOMReplacement(){let t=this.#h,e=this.#b?.shadowRoot?.activeElement;if(t!=null&&(this.#O||e===t||e!=null&&t.contains(e)))this.#I={}}__syncRenderView=(t,e,n,i,s)=>{let r=this.#f;if(r==null)return;let o=e.shadowRoot;if(o==null){console.error("[editor] Could not find the shadow root.");return}let a,c,h;for(let m of o.querySelectorAll("[data-code]"))if(m.dataset.deletions===void 0){a=m;for(let p of m.children){let g=p,{gutter:v,content:C}=g.dataset;if(v!==void 0)c=g;else if(C!==void 0)h=g}break}if(a===void 0||h===void 0){this.#I=void 0;return}if(this.#Tt().setViewportElements(e,a),this.#b!==e){if(this.#b=e,this.#q!==void 0)e.appendChild(this.#q);if(this.#E!==void 0)o.appendChild(this.#E);if(this.#N!==void 0)o.appendChild(this.#N);if(this.#U!==void 0)o.prepend(this.#U)}let d=this.#s===void 0||this.#_===void 0||this.#_.name!==n.name||this.#_.lang!==n.lang||this.#_.cacheKey!==n.cacheKey,l=this.#e.persistState===!0?Y(n):void 0,f;if(d){this.#zt();let m="";if("contents"in n)m=n.contents;else m=n.additionLines.join("");let p=new pt({maxEntries:this.#e.historyMaxEntries}),{name:g,lang:v,cacheKey:C}=n,x=v??Rt(n.name),L=l!==void 0?this.#Gt(n,l):void 0,b=r.type==="file"||L?.getText()===m?L:void 0,w=b??new Dt(n.name,m,x,0,p);if(this.#_={name:g,lang:v,cacheKey:C},this.#s=w,l!==void 0)this.#a.set(l,w),f={cacheKey:l,textDocument:w};if(this.#r?.cleanUp(),this.#r=void 0,this.#Yt(),this.#g.clear(),this.#i=this.#Bt,this.#e.__debug===!0)console.log(b!==void 0?"[diffs/editor] cached text document reused for":"[diffs/editor] text document rebuilt from",n.name)}if(f===void 0&&this.#x&&l!==void 0&&this.#s!==void 0)f={cacheKey:l,textDocument:this.#s};let u=this.#s;if(this.#r==null&&u!=null)this.#r=new Bn({highlighter:t,textDocument:u,codeOptions:this.#f?.__getEffectiveCodeOptions()??{},matchBrackets:this.#e.matchBrackets,onDeferTokenize:this.#Se,onThemeChange:()=>this.#He(),setStyle:(m)=>{this.#N.textContent=m},__debug:this.#e.__debug});if(this.#h!==h){if(this.#R=c,this.#h=Be(h,{contentEditable:"true",role:"textbox",ariaMultiLine:"true",autocapitalize:"off",writingSuggestions:"off",autocorrect:!1,spellcheck:!1,translate:!1}),this.#V!==void 0)h.after(this.#V);if(this.#t.init(h),this.#Pe(),this.#Ae(h,c),this.#h!==void 0&&this.#e.__debug===!0)console.log("[diffs/editor] full re-render triggered !!!")}if(this.#I!=null)this.#I.target=h;if(h.ariaLabel!==n.name)h.ariaLabel=n.name;if(i!==void 0&&i.length>0||this.#et)for(let m of this.#h.children){let p=m,{lineAnnotation:g,lineType:v,separator:C}=p.dataset;if(g!==void 0||C!==void 0||v==="change-deletion")p.setAttribute("contenteditable","false")}if(this.#Dt(),this.#r?.syncTheme(this.#f?.__getEffectiveCodeOptions()??{}),this.#T=i,this.#K=s,this.#J=s?.totalLines,this.#r?.prebuildStateStack(s),this.#S?.removePopover(),this.#i!==void 0||this.#Q!==void 0||this.#S!==void 0)this.#d(this.#i??[]);if(this.#Bt!==void 0&&this.#X!==void 0)this.#Bt=void 0,this.#nt(!1,"center");else if(this.#tt!==void 0)this.#Ut(this.#tt,this.#dt,this.#ft);else if(this.#I!==void 0)this.#Wt();else if(this.#i!==void 0&&this.#i.length>0&&this.#O&&!this.#ct)this.focus({preventScroll:!0});if(this.#ct)this.#B?.focus();if(this.#e.__debug===!0&&s!==void 0){let{startingLine:m,totalLines:p}=s;console.log("[diffs/editor] render file:",n.name,"RenderRange:",m+"-"+(m+p),"of",this.#s?.lineCount,"lines")}if(f!==void 0)this.#x=!1,this.#be(f.cacheKey,f.textDocument);this.#ke(r)};#Gt(t,e){let n=this.#a.get(e),i=t.lang??Rt(t.name);return n?.languageId===i?n:void 0}#jt(){let t=this.#e.persistStateStorage??"inMemory";if(this.#l===void 0||this.#c!==t)this.#l=Rn(t),this.#c=t;return this.#l}#qt(){let t=this.#_,e=this.#s;if(this.#e.persistState!==!0||this.#f===void 0||t===void 0||e===void 0)return;let n=Y(t);this.#a.set(n,e);let i;try{i=this.#jt()}catch{return}let s=Z(this.getState()),r=this.#y;if(r?.cacheKey===n&&r.textDocument===e){if(this.#y=void 0,e.version===r.documentVersion&&this.#i===r.selections&&s.view?.scrollLeft===r.view?.scrollLeft&&s.view?.scrollTop===r.view?.scrollTop)return;this.#Xt(i,n,s,r.completion);return}this.#Xt(i,n,s)}#Xt(t,e,n,i){let s=this.#m.get(e);if(i!==void 0||s!==void 0){let o=i??Promise.resolve();if(s!==void 0)o=o.then(()=>s);this.#Zt(e,o.then(()=>t.set(e,n)));return}let r;try{r=t.set(e,n)}catch{return}if(!re(r))return;this.#Zt(e,r)}#Zt(t,e){let n=e.catch(()=>{});this.#m.set(t,n),n.finally(()=>{if(this.#m.get(t)===n)this.#m.delete(t)})}#be(t,e){let n=++this.#p,i=e.version,s=this.#i,r=this.getState().view,o,a=(l)=>{let f=this.getState().view;if(n!==this.#p||this.#s!==e||e.version!==i||this.#i!==s||f?.scrollLeft!==r?.scrollLeft||this.#_===void 0||Y(this.#_)!==t)return;let u=o?.userScrolled()===!0;if(l===void 0){if(this.#f?.setCodeScrollLeft(0),!u)this.#Qt(0);return}let m=Z(l);if(u&&m.view!==void 0)m.view={scrollLeft:m.view.scrollLeft};this.setState(m)},c=()=>{let l;try{l=this.#jt().get(t)}catch{return}if(re(l))return l.then(a).catch(()=>{});else try{a(l)}catch{}},h=this.#m.get(t),d=h===void 0?c():h.then(c);if(re(d)){o=this.#ye();let l={cacheKey:t,textDocument:e,documentVersion:i,selections:s,view:r,completion:d.catch(()=>{})};this.#y=l,l.completion.finally(()=>{if(o?.dispose(),this.#y===l)this.#y=void 0})}}#ye(){let t=this.#At();if(!(t instanceof HTMLElement))return;let e=!1,n=["wheel","touchstart","mousedown"],i=()=>{for(let r of n)t.removeEventListener(r,s,{capture:!0})},s=()=>{e=!0,i()};for(let r of n)t.addEventListener(r,s,{capture:!0,passive:!0});return{userScrolled:()=>e,dispose:i}}#pt(t){return this.#f?.isLineRenderable?.(t+1)??!0}get#we(){let t=this.#f;if(t?.getNearestRenderableLine==null)return;return(e,n)=>{let i=t.getNearestRenderableLine(e+1,n);return i==null?void 0:i-1}}#lt(t){if(!this.#pt(t))this.#f?.revealLine?.(t+1)}get#Et(){return this.#f?.options.diffStyle??"split"}get#et(){return this.#f?.type==="file-diff"}get#rt(){return this.#f?.options.overflow==="wrap"}#Tt(){return this.#n??=new $e({hasActivePopover:()=>this.#D!==void 0||this.#S?.isPopoverVisible()===!0,updateActivePopover:()=>{this.#Vt(),this.#S?.updatePopoverPosition()}})}#Dt(){this.#k.clear(),this.#M.clear(),this.#C=void 0}#Yt(){this.#wt(null),this.#L=void 0,this.#v=void 0,this.#Jt(),this.#Y=!1,this.#W?.forEach((t)=>t.remove()),this.#W=void 0,this.#i=void 0,this.#tt=void 0,this.#S?.cleanup(),this.#S=void 0,this.#B?.cleanup(),this.#B=void 0,this.#D?.cleanup(),this.#D=void 0,this.#z=!0}#zt(){let t=this.#o;if(t.generation++,t.callback!=null)ce(t.callback),t.callback=void 0}#ke(t){let e=this.#o,n=this.#s;if(e.delivered||e.callback!=null||n==null)return;let{generation:i}=e,s=()=>{if(e.callback!==s)return;if(e.callback=void 0,i!==e.generation||this.#f!==t||this.#s!==n)return;let r=this.#h,o=this.#b?.shadowRoot;if(r==null||o==null||!o.contains(r))return;e.delivered=!0,this.#e.onAttach?.(this,t)};e.callback=s,ut(s)}#At(){let t=this.#f?.getEditorViewport?.();if(t!==void 0)return t;let e=this.#b;if(this.#f==null||e==null)return;return ze(e)}#Ee(){let t=this.#At();if(t instanceof HTMLElement)return t.scrollTop;return t?.defaultView?.scrollY??0}#Qt(t){let e=this.#At();if(e instanceof HTMLElement)e.scrollTop=t;else if(e instanceof Document)e.defaultView?.scrollTo({top:t})}#Te(){this.#q=y("style",{dataset:"editorGlobalCss",textContent:`
511
+ [data-annotation-slot] {
512
+ user-select: none;
513
+ -webkit-user-select: none;
514
+ }
515
+ `}),this.#E=y("style",{dataset:"editorCss",textContent:Ae}),this.#N=y("style",{dataset:"editorThemeCss"}),this.#U=En(),this.#V=y("div",{dataset:"editorOverlay"});let t=(i)=>{let s=i.composedPath()[0];return s instanceof Node&&this.#h?.contains(s)===!0},e=()=>{if(this.#I==null)return;this.#I=void 0,this.#O=!1,this.#F=!1},n=(i)=>{if(i.pointerType!=="mouse")return;let s=this.#xt;if(this.#Jt(),s)this.#G();if(this.#e.enabledSelectionAction===!0&&this.#i!==void 0&&this.#i.length>0&&!O(this.#i.at(-1)))this.#d(this.#i)};this.#w=[k(document,"focusin",(i)=>{if(!t(i))e()},{passive:!0}),k(document,"pointerdown",(i)=>{if(!t(i))queueMicrotask(e)},{capture:!0,passive:!0}),k(document,"selectionchange",()=>{let i=this.#b?.shadowRoot;if(this.#F||this.#Y||i==null||!this.#O)return;if(this.#i!==void 0&&this.#i.length>1&&!this.#st)return;let s=document.getSelection();if(s==null)return;let r=typeof s.getComposedRanges==="function"?s.getComposedRanges({shadowRoots:[i]})?.[0]:Ui(i);if(r===void 0||!this.#Ze(r))return;let o=Ye(r,0);if(o===void 0)return;if(this.#st&&this.#Pt&&this.#i!==void 0&&this.#i.length>0){let a=this.#i.at(-1);this.#d([$t(a,o)]);return}if(this.#st)if(this.#$!==void 0)o=kt(this.#$,o);else this.#$=o;else if(this.#$!==void 0)o.direction=kt(this.#$,o).direction;else if(this.#i!==void 0&&this.#i.length===1){let a=this.#i[0];if(T(a.start,o.start)===0&&T(a.end,o.end)===0)o.direction=a.direction}if(this.#at!==void 0){if(this.#at.focusLine=N(o).line,this.#fe())return}if(this.#bt!==void 0)this.#d([...this.#bt.filter((a)=>!ht(a,o)),o]);else this.#d([o])},{passive:!0}),k(document,"pointerup",n,{passive:!0}),k(document,"pointercancel",n,{passive:!0}),k(document,"keydown",(i)=>{if(i.key==="Shift")this.#$=this.#i?.at(-1)},{passive:!0}),k(document,"keyup",(i)=>{if(i.key==="Shift")this.#$=void 0},{passive:!0})]}#Jt(){this.#A?.forEach((t)=>t()),this.#A=void 0,this.#F=!1,this.#xt=!1,this.#st=!1,this.#at=void 0,this.#Pt=!1,this.#$=void 0,this.#bt=void 0}#Ht(t){this.#A?.forEach((e)=>e()),this.#A=t}#te(){return this.#f?.options.enableLineSelection===!0}#Mt(){this.#Y=this.#i!==void 0}#Ae(t,e){let{onFocus:n,onBlur:i}=this.#e,s=(o)=>{let a=o.composedPath()[0];return a!==void 0&&(a===t||t.contains(a))};this.#u?.forEach((o)=>o()),this.#u=[k(t,"focus",()=>{if(this.#O=!0,n?.(),!this.#st&&!this.#F&&this.#i!==void 0&&this.#i.length>0)this.#yt(this.#i.at(-1))},{passive:!0}),k(t,"blur",()=>{if(this.#I?.target===t)this.#I=void 0,this.#F=!1;this.#O=!1,i?.()},{passive:!0}),k(t,"pointerdown",(o)=>{if(this.#z=!0,this.#Y=!1,o.pointerType!=="mouse")return;if(this.#at=void 0,this.#ze(o)){if(this.#Ot(!0),this.#i!==void 0)this.#d([]);return}this.#Ot(!1),this.#S?.removePopover();let a=[];if(vt()&&this.#T!==void 0&&this.#T.length>0){let h=[...t.querySelectorAll("[data-line-annotation]")].map((d)=>[k(d,"mouseenter",()=>{this.#F=!0}),k(d,"mouseleave",()=>{this.#F=!1})]).flat();a.push(...h)}this.#st=!0;let c=o.button===0&&o.altKey&&!o.ctrlKey&&!o.metaKey&&!o.shiftKey;if(this.#$=void 0,c)this.#at={pointerId:o.pointerId,startClientX:o.clientX,clientX:o.clientX,startScrollLeft:t.parentElement?.scrollLeft??0},this.#bt=void 0,this.#i=void 0,this.#d([]),a.push(k(document,"pointermove",(h)=>{let d=this.#at;if(d===void 0||h.pointerType!=="mouse"||h.pointerId!==d.pointerId)return;d.clientX=h.clientX,this.#fe()},{capture:!0,passive:!0}));else if(o.button===0&&K(o))this.#bt=this.#i?.map((h)=>({...h}));if(this.#Ht(a),o.shiftKey){let h=this.#i?.at(-1);if(h!==void 0){let d=h.direction===-1?h.end:h.start;this.#yt({start:d,end:d,direction:0})}this.#Pt=!0}},{passive:!0}),k(t,"keydown",(o)=>{if(!s(o))return;if(this.#z=!0,this.#Y=!1,o.isComposing||o.keyCode===229)return;let a=Te(o,this.#e.keymap);if(a!==void 0){if(o.preventDefault(),a==="simplifySelection")this.#B?.close(),this.#B=void 0,this.#ct=!1,this.#D?.cleanup(),this.#D=void 0;this.#Ft(a);return}let c=we(o),h=this.#s;if(this.#i!==void 0&&this.#i.length>0&&c!==void 0&&h!==void 0){let d={getSoftLineOffsets:this.#rt?(l)=>this.#$t(l):void 0,resolveRenderableLine:this.#we};if(o.shiftKey)this.#d(tn(h,this.#i,c,d));else this.#d(Kt(h,this.#i,c,d));this.#nt(),o.preventDefault();return}if((o.key.length===1?o.key.toLowerCase():o.key)==="v"&&K(o)){if(o.repeat&&this.#et){o.preventDefault();return}if(this.#e.clipboard!==void 0){o.preventDefault(),ut(this.#ee);return}}if(this.#B!==void 0){let d=at(o);if(d!==void 0){o.preventDefault(),this.#B.navigate(d==="previous");return}}}),k(t,"copy",(o)=>{if(!s(o))return;if(o.preventDefault(),this.#he())o.clipboardData?.setData("text",this.#de());else this.#ve(o.clipboardData,this.#Ve(),this.#me())}),k(t,"cut",(o)=>{if(!s(o))return;if(o.preventDefault(),this.#he())o.clipboardData?.setData("text",this.#de());else{let a=this.#me();this.#ve(o.clipboardData,this.#Ke(),a)}}),k(t,"paste",(o)=>{if(!s(o))return;o.preventDefault();let a=o.clipboardData,c=this.#s;if(a===null||c===void 0)return;let h=a.getData("text"),d=this.#i?.length??0;if(d>1){let l=a.getData(ae);if(l!==void 0)try{let f=JSON.parse(l);if(Array.isArray(f)&&f.length===d)h=f}catch{}}this.#mt(Array.isArray(h)?h.map((l)=>c.normalizeEol(l)):c.normalizeEol(h),void 0,!0,"document")}),k(t,"beforeinput",(o)=>{if(!s(o))return;if(o.inputType==="insertCompositionText")return;o.preventDefault(),this.#ie(o.inputType,o.data)}),k(t,"drop",(o)=>{if(!s(o))return;o.preventDefault()}),k(t,"compositionstart",(o)=>{if(!s(o))return;this.#Lt=!0,this.#F=!0},{passive:!0}),k(t,"compositionend",(o)=>{if(!s(o))return;this.#F=!1;let a=this.#Lt;if(this.#Lt=!1,o.data!==""||!a)this.#ie("insertText",o.data)},{passive:!0})];let r=this.#b?.shadowRoot?.querySelector("[data-deletions]");if(r!=null)this.#u.push(k(r,"pointerdown",(o)=>{let a=o.composedPath();if(le(a)){this.#Mt();return}let c=a[0],h=c instanceof HTMLElement?c.closest("[data-column-number]"):null;if(h instanceof HTMLElement){if(this.#te()){this.#Mt();return}if(this.#le(h,r,o.pointerType==="mouse"))return}if(this.#Ot(!0),this.#i!==void 0)this.#d([])},{passive:!0}));if(e!==void 0){let o=(c,h=!1)=>{let d=c;if(d?.dataset.lineNumberContent!==void 0)d=d.parentElement??void 0;else if(h&&d?.tagName==="SPAN")d=d.closest("[data-line]");return d},a=(c)=>{if(c===void 0)return;let h=c.dataset.lineType,d=z(c)??z(c,"columnNumber");if(d===void 0||h===void 0||!it(h))return;return d-1};this.#u.push(k(e,"pointerdown",(c)=>{let h=c.composedPath();if(le(h)){this.#Mt();return}let d=o(h[0]);if(d!==void 0&&this.#te()){this.#Mt();return}if(d?.dataset.lineType==="change-deletion"){let m=d.closest("[data-code]");if(m!=null)this.#le(d,m,c.pointerType==="mouse");return}if(c.pointerType!=="mouse")return;let l=this.#s,f=a(d);if(f===void 0||l===void 0)return;this.#z=!0,this.#S?.removePopover();let u=this.#oe(f,f,l);this.#xt=!0,this.#$=u,this.#d([u]),this.#yt(u),this.#G(),this.#Ht([k(document,"mousemove",(m)=>{if(!this.#xt)return;let p=this.#s,g=a(o(m.composedPath()[0],!0));if(g===void 0||p===void 0)return;let v=this.#$?.start.line??g,C=this.#oe(v,g,p);this.#$??=C,this.#d([C]),this.#G(C.direction===-1?C.start:C.end)},{passive:!0})])},{passive:!0}))}this.#S?.listenHover(t),this.#Z?.disconnect(),this.#Z=new ResizeObserver(this.#Ne),this.#Z.observe(t),this.#Z.observe(t.parentElement),this.#ne(t)}#ee=async()=>{let t=this.#e.clipboard;if(t!==void 0){let e=await t.readText(),n=this.#i?.length??0;if(n>1){let s=await t.readText(ae);try{let r=JSON.parse(s);if(Array.isArray(r)&&r.length===n)e=r}catch{}}let i=this.#s;if(i!==void 0)this.#mt(Array.isArray(e)?e.map((s)=>i.normalizeEol(s)):i.normalizeEol(e),void 0,!0,"document")}};#ne(t){if(this.#et&&this.#Et==="split"&&this.#rt){if(this.#P={top:t.offsetTop,left:t.offsetLeft-this.#ot()},this.#e.__debug===!0)console.log("[diffs/editor] content offset:",this.#P)}}get#gt(){if(this.#et&&this.#Et==="split"&&this.#rt)return this.#P}#Ft(t){let e=this.#s;if(e===void 0)return;switch(t){case"openSearchPanel":this.#ge("find");break;case"openSearchReplacePanel":this.#ge("replace");break;case"findNextMatch":{let n=this.#i;if(n===void 0)break;if(n.some(O)){let i=n.map((s)=>{if(O(s))return Tt(e,s);return s});this.#d(i),this.focus()}else{let i=dn(e,n);if(i!==void 0){this.#d(i);let s=i.at(-1);if(s!==void 0)this.#lt(N(s).line);this.#nt()}}break}case"moveLineUp":case"moveLineDown":this.#Ie(t==="moveLineUp"?-1:1);break;case"copyLineUp":case"copyLineDown":this.#Re(t==="copyLineUp"?-1:1);break;case"simplifySelection":{let n=this.#i,i=n?.at(-1);if(n===void 0||i===void 0)break;if(n.length>1)this.#d([i]),this.#G(N(i));else if(!O(i)){let s=N(i);this.#d([{start:s,end:s,direction:0}]),this.#G(s)}break}case"insertBlankLine":this.#Oe();break;case"deleteHardLineForward":this.#qe();break;case"toggleComment":case"toggleBlockComment":{let n=this.#i;if(n===void 0)break;let{lineComment:i,blockComment:s}=Re(e.languageId,this.#e.languageCommentConfig);if(t==="toggleComment"&&i!==null){this.#Rt(Oe(e,n,i));break}let r=t==="toggleComment",o=Ie(e,n,s,r);if(o!==void 0)this.#Rt(o.edits,r?void 0:(a)=>o.nextSelectionOffsets.map(([c,h,d])=>({start:a.positionAt(c),end:a.positionAt(h),direction:d})));break}case"indent":case"outdent":case"indentLess":case"indentMore":if(this.#i!==void 0){let n=[],i=[],s=new Set,r=[];for(let a of this.#i){let c=a.start.line,h=t==="outdent"||t==="indentLess",d=t==="indentLess"||t==="indentMore";if(c!==a.end.line||h||d){let l=Qe(e,a,this.#t.tabSize,h);for(let f of l[0]){let u=f.range.start.line;if(!s.has(u))s.add(u),n.push(f)}i.push(l[1])}else{let l=e.charAt({line:c,character:0})==="\t"?"\t":" ".repeat(this.#t.tabSize);n.push({range:a,newText:l}),r.push({line:c,startCharacter:a.start.character,addedLength:l.length-(a.end.character-a.start.character),selectionIndex:i.length});let f={line:a.start.line,character:a.start.character+l.length};i.push({start:f,end:f,direction:0})}}for(let a of r){let c=0;for(let h of r)if(h.line===a.line&&h.startCharacter<a.startCharacter)c+=h.addedLength;if(c!==0){let h=i[a.selectionIndex],d={line:a.line,character:h.start.character+c};i[a.selectionIndex]={start:d,end:d,direction:0}}}let o=e.applyEdits(n,!0,this.#i,i);if(o!==void 0)this.#j(o,i)}break;case"selectAll":{let n=fn(e);this.#d([n]),this.focus();let i=this.#Le(),s=i[0]?.[0],r=i.at(-1)?.[1];if(s!==void 0&&r!==void 0)this.#Y=!0,this.#yt({start:{line:s,character:0},end:{line:r,character:e.getLineLength(r)},direction:1});break}case"moveCursorToDocStart":case"moveCursorToDocEnd":{let n=qt(e,t==="moveCursorToDocEnd",this.#et);this.#d([n]),this.#lt(N(n).line),this.#nt()}break;case"expandSelectionDocStart":case"expandSelectionDocEnd":{let n=t==="expandSelectionDocEnd",i=this.#i;if(i!==void 0){let s=qt(e,n,this.#et);this.#d(ln(i,s)),this.#lt(N(s).line),this.#nt()}}break;case"undo":case"redo":this.#Me(t);break}}#Me(t){let e=this.#s;if(e===void 0)return;if(t==="undo"&&!e.canUndo||t==="redo"&&!e.canRedo)return;let n=this.#i,i=n?.map((d)=>[e.offsetAt(d.start),e.offsetAt(d.end)]),s=t==="undo"?e.undo():e.redo();if(s===void 0)return;let[r,o,a,c]=s,h=o??(n!==void 0&&i!==void 0&&c!==void 0?wt(e,n,i,c):void 0);this.#j(r,h,a)}#Rt(t,e){let n=this.#s,i=this.#i;if(n===void 0||i===void 0)return;let s=e===void 0,r=s?i.map((h)=>[n.offsetAt(h.start),n.offsetAt(h.end)]):void 0,o=s?t.map((h)=>{let d=n.offsetAt(h.range.start),l=n.offsetAt(h.range.end);return{start:Math.min(d,l),end:Math.max(d,l),text:h.newText}}).sort((h,d)=>{let l=h.start-d.start;return l!==0?l:h.end-d.end}):void 0,a=n.applyEdits(t,!0,i,void 0,!0);if(a===void 0)return;let c=s?wt(n,i,r,o):e(n);n.setLastUndoSelectionsAfter(c),this.#j(a,c,this.#it(a))}#Re(t){let e=this.#s,n=this.#i;if(e===void 0||n===void 0)return;let i=jt(n);if(i.length===0)return;let s=[],r=0,o=[];for(let c of i){s.push(r);let h=c.endLine-c.startLine+1;r+=h;let d=e.getText({start:{line:c.startLine,character:0},end:{line:c.endLine,character:e.getLineLength(c.endLine)}});if(t>0){let l={line:c.startLine,character:0};o.push({range:{start:l,end:l},newText:d+e.eol})}else if(c.endLine<e.lineCount-1){let l={line:c.endLine+1,character:0};o.push({range:{start:l,end:l},newText:d+e.eol})}else{let l={line:c.endLine,character:e.getLineLength(c.endLine)};o.push({range:{start:l,end:l},newText:e.eol+d})}}let a=n.map((c)=>{let h=c.start.line,d=0,l=i.length-1;while(d<=l){let p=d+l>>>1,g=i[p];if(h<g.startLine)l=p-1;else if(h>g.endLine)d=p+1;else{d=p;break}}let f=Math.max(0,d<=l?d:l),u=i[f],m=s[f]+(t>0?u.endLine-u.startLine+1:0);return{start:{...c.start,line:c.start.line+m},end:{...c.end,line:c.end.line+m},direction:c.direction}});this.#Rt(o,()=>a)}#Oe(){let t=this.#s,e=this.#i;if(t===void 0||e===void 0)return;let n=e.map((c)=>N(c).line),i=Array.from(new Set(n)).sort((c,h)=>c-h),s=new Map,r=new Map,o=[];for(let c=0;c<i.length;c++){let h=i[c],d=t.getLineText(h),l=/^\s*/.exec(d)?.[0]??"";s.set(h,c),r.set(h,l);let f={line:h,character:t.getLineLength(h)};o.push({range:{start:f,end:f},newText:t.eol+l})}let a=e.map((c,h)=>{let d=n[h],l={line:d+1+s.get(d),character:r.get(d).length};return{start:l,end:l,direction:0}});this.#Rt(o,()=>a)}#Ie(t){let e=this.#s,n=this.#i;if(e===void 0||n===void 0)return;let i=jt(n);if(i.length===0||t<0&&i[0].startLine===0||t>0&&i.at(-1).endLine>=e.lineCount-1)return;let s=e.lineCount,r=(f)=>f<s-1?{line:f+1,character:0}:{line:f,character:e.getLineLength(f)},o=(f,u)=>{let m=f.map((p)=>e.getLineText(p)).join(e.eol);return u?m+e.eol:m},a=[];if(t<0)for(let f of i){let u=f.startLine-1,m=[];for(let p=f.startLine;p<=f.endLine;p++)m.push(p);a.push({range:{start:{line:u,character:0},end:r(f.endLine)},newText:o([...m,u],f.endLine<s-1)})}else for(let f=i.length-1;f>=0;f--){let u=i[f],m=u.endLine+1,p=[];for(let g=u.startLine;g<=u.endLine;g++)p.push(g);a.push({range:{start:{line:u.startLine,character:0},end:r(m)},newText:o([m,...p],m<s-1)})}let c=i.at(-1),h=t>0&&c.endLine===s-2?e.getLineLength(c.endLine):e.getLineLength(s-1),d=n.map((f)=>hn(f,t,s,(u)=>u===s-1?h:e.getLineLength(u))),l=e.applyEdits(a,!0,n,d,!0);if(l!==void 0)this.#j(l,d)}#Ne=()=>{let t=this.#T?.length??0,e=this.#L,n=this.#v;this.#L=void 0,this.#v=void 0;let i=this.#ot()!==e,s=this.#Kt()!==n;if(!i&&!s)return;if(this.#M.clear(),this.#C=void 0,this.#t.clearTextWidthCache(),s){if(this.#g.clear(),this.#rt||t>0)this.#k.clear()}if(this.#i!==void 0||this.#Q!==void 0||this.#S!==void 0){if(this.#d(this.#i??[]),this.#i!==void 0&&this.#O)this.focus()}this.#S?.removePopover(),this.#ne(this.#h)};#Pe(){if(this.#_t)return;let t=document.fonts;if(t===void 0)return;this.#_t=!0,t.ready.then(()=>{if(this.#h===void 0||!this.#t.remeasureCharacterWidth())return;if(this.#L=void 0,this.#v=void 0,this.#Dt(),this.#g.clear(),this.#i!==void 0||this.#Q!==void 0||this.#S!==void 0)this.#d(this.#i??[]);this.#S?.removePopover()})}#Be(t,e,n=this.#K,i){let s=this.#r,r=this.#f,o=this.#s,a=this.#R,c=this.#h;if(s===void 0||r===void 0||o===void 0||c===void 0)return;s.stopBackgroundTokenize();let h=performance.now(),d=s.tokenize(t,n,!this.#et&&r.getLinePosition!==void 0),l=performance.now();if(d.size>0){let u=c.children,m=new Set;for(let p of d.keys())if(this.#pt(p))m.add(p);for(let p=0;p<u.length;p++){let g=u[p];if(g!==void 0){let v=z(g),C=g.dataset.lineType;if(v===void 0||C==="change-deletion")continue;let x=v-1;if(m.has(x)){let L=d.get(x);if(g.replaceChildren(...Mt(L)),m.delete(x),m.size===0)break}}}if(m.size>0){let p=0;for(let g=u.length-1;g>=0;g--){let v=u[g],C=z(v);if(C!==void 0&&v.dataset.lineType!=="change-deletion"){p=C;break}}for(let g of m){if(g<p)continue;let v=d.get(g),C=String(g+1);if(y("div",{dataset:{line:C,lineType:"context",lineIndex:g.toString()},children:Mt(v)},c),a!==void 0)y("div",{dataset:{lineType:"context",columnNumber:C,lineIndex:g.toString()},children:[y("span",{dataset:{lineNumberContent:""},textContent:C})]},a)}}}if(t.lineDelta<0)for(let u of[c.children,a?.children??[]])for(let m=u.length-1;m>=0;m--){let p=u[m],g=z(p)??z(p,"columnNumber"),v=p.dataset.lineType;if(g===void 0||v==="change-deletion")continue;if(g-1<t.lineCount)break;p.remove()}let f=t.lineDelta!==0;if(f){let u=c.children.length;for(let m of c.children){let{bufferSize:p}=m.dataset;if(p!==void 0)u+=parseInt(p)-1}if(c.style.gridRow="span "+u,a!==void 0)a.style.gridRow="span "+u}if(r.updateRenderCache(d,s.themeType,{shouldRefreshDiffsView:this.#et&&!f,lineCountChangeInFlight:f}),f)r.applyDocumentChange(o,e,i);if(f||this.#et&&this.#Et==="unified")this.#Dt();if(e!==void 0)this.#T=e,Ke(e,c,a);if(this.#e.__debug===!0)console.log(`[diffs/editor] re-render in: ${G(performance.now()-l)}ms,`,`tokenize in: ${G(l-h)}ms (${d.size} dirty lines)`)}#ie(t,e){switch(t){case"insertText":{let n=e??"",i=this.#s,s=this.#i,r=i!==void 0&&s!==void 0?nn(i,s,n,this.#e.autoSurround):void 0;this.#mt(r??n);break}case"insertCompositionText":break;case"insertLineBreak":case"insertParagraph":this.#mt(this.#s?.eol??`
516
+ `);break;case"deleteContentBackward":this.#Ce();break;case"deleteContentForward":this.#Ce(!0);break;case"deleteSoftLineBackward":case"deleteHardLineBackward":this.#Ge();break;case"deleteWordBackward":this.#je();break;case"insertTranspose":this.#Xe();break;default:console.warn(`[diffs] Unknown input type: ${t}`,e);break}}#G(t,e=!0,n){if(this.#O=!0,t!==void 0)this.#F=!0,this.#yt({start:t,end:t,direction:0}),ut(()=>{if(n?.()===!1||!this.#O){this.#F=!1;return}this.#h?.focus({preventScroll:e}),ut(()=>{this.#F=!1})});else if(n?.()!==!1)this.#h?.focus({preventScroll:e});else this.#O=!1}#Wt(t){let e=this.#I;if(e==null)return;if(this.#ct){this.#I=void 0,this.#O=!1,this.#F=!1;return}let n=this.#h;if(n==null||!this.#se(n)){this.#I=void 0,this.#O=!1;return}let i=()=>{if(this.#I!==e)return!1;let o=this.#se(n);return this.#I=void 0,o};if(t!=null){this.#G(t,!0,i);return}let s=this.#i?.at(-1);if(s==null){this.#G(void 0,!0,i);return}let r=s.direction===-1?s.end:s.start;this.#G(r,!0,i)}#se(t){let e=this.#b,n=e?.shadowRoot;if(e==null||n==null||this.#h!==t||!n.contains(t))return!1;let{activeElement:i}=n;if(i===t||i!=null&&t.contains(i))return!0;if(i!=null)return!1;let{ownerDocument:s}=e,{activeElement:r}=s;return r==null||r===s.body||r===s.documentElement||r===e}#_e(t=0){let e=this.#h,n=this.#b;if(this.#s==null||e==null||n==null)return;let i=this.#At();if(i===void 0)return;let s,r;if(i instanceof HTMLElement){let a=i.getBoundingClientRect();s=a.top,r=a.bottom}else s=0,r=i.defaultView?.innerHeight??0;let o=n.shadowRoot?.querySelector("[data-diffs-header][data-sticky]");if(o!=null)s=Math.max(s,o.getBoundingClientRect().bottom);if(Number.isFinite(t))s+=Math.max(0,t);if(r<=s)return;for(let a of e.children){let c=a,h=z(c),d=c.dataset.lineType;if(h==null||d==null||!it(d))continue;let l=c.getBoundingClientRect();if(l.bottom<=l.top)continue;if(l.top>=s&&l.top<r)return h}}#De(t,e){let n={start:t,end:t,direction:0};if(this.#z=!1,this.#d([n]),this.#lt(t.line),e)this.#G(t,!0);else this.#nt()}#yt(t){let e=window.getSelection();if(e===null)return;let{start:n,end:i,direction:s}=t;if(T(n,i)>0)[n,i]=[i,n];let r=this.#ht(n.line),o=this.#ht(i.line);if(r===void 0||o===void 0)return;let[a,c]=Xt(r,n.character),[h,d]=Xt(o,i.character);if(s===-1)[a,c,h,d]=[h,d,a,c];try{e.setBaseAndExtent(a,zt(a,c),h,zt(h,d))}catch(l){console.error("[diffs/editor] failed to update window selection:",l)}}#nt(t=!1,e="nearest"){let n=this.#i?.at(-1);if(n===void 0)return;let i=this.#X;if(i!==void 0){if(i.scrollIntoView({block:e,inline:"nearest"}),!t){let s=n.direction===-1?n.end:n.start;if(this.#I!==void 0)this.#Wt(s);else this.#G(s)}}else{let s=N(n);this.#Ut(s.line,s.character,t)}}#re(){let t=this.#B!==void 0?48:0,e=this.#ot()+this.#t.ch;return`${t}px ${this.#t.ch}px 0 ${e}px`}#Ut(t,e=0,n=!1){this.__postponeBgTokenizeToNextFrame();let i=y("div",{style:{position:"absolute",left:"0",width:"2px",height:this.#t.lineHeight+"px",scrollMargin:this.#re()}});if(this.#ht(t)!==void 0){let[s,r]=this.#Ct(t,e),o=this.#vt(t)+r*this.#t.lineHeight;if(i.style.top=o+"px",i.style.left=s+"px",this.#V?.appendChild(i),i.scrollIntoView({block:"center",inline:"nearest"}),!n){let a={line:t,character:e};if(this.#I!==void 0)this.#Wt(a);else this.#G(a)}this.#tt=void 0,this.#dt=void 0,this.#kt=!1,this.#ft=!1}else{let s=this.#f?.getLinePosition?.(t+1);if(s!==void 0)if(i.style.top=s.top+"px",this.#b?.shadowRoot?.appendChild(i),i.scrollIntoView({block:"center",inline:"nearest"}),s.height>0&&this.#pt(t))this.#tt=t,this.#dt=e,this.#ft=n;else this.#tt=void 0,this.#dt=void 0,this.#ft=!1;else{let r=0;if(this.#tt===t&&this.#h!==void 0)for(let a=this.#h.childElementCount-1;a>=0;a--){let c=this.#h.children[a],h=c.dataset.lineType,d=z(c);if(h!==void 0&&it(h)&&d!==void 0){r=(t-(d-1))*this.#t.lineHeight;break}}let o=((this.#T??[]).filter((a)=>a.lineNumber<t).length+t)*this.#t.lineHeight+r;if(i.style.top=o+"px",this.#b?.shadowRoot?.appendChild(i),i.scrollIntoView({block:"center",inline:"nearest"}),this.#tt===t&&(r===0||this.#kt)||!this.#pt(t))this.#tt=void 0,this.#dt=void 0,this.#kt=!1,this.#ft=!1;else this.#tt=t,this.#dt=e,this.#kt=r!==0,this.#ft=n}}i.remove()}#oe(t,e,n){let i=(r)=>({line:r,character:0}),s=(r)=>({line:r,character:n.getLineText(r).length});if(e<t)return{start:i(e),end:s(t),direction:-1};return{start:i(t),end:s(e),direction:1}}#ze(t){let e=t.composedPath()[0];return e instanceof HTMLElement&&e.closest("[data-line]")?.getAttribute("data-line-type")==="change-deletion"}#ae(t,e,n){let i=[...n.querySelectorAll("[data-content] > [data-line]")],s=i.indexOf(t),r=i.indexOf(e),[o,a]=r<s?[e,t]:[t,e],c=window.getSelection();if(c!==null){let l=document.createRange();l.setStart(o,0),l.setEnd(a,a.childNodes.length),c.removeAllRanges(),c.addRange(l)}this.#Ot(!0),this.#d([]),this.#wt(z(e)??null,!0,"deletions");let h=Math.min(s,r),d=Math.max(s,r);this.#St=h<0?"":i.slice(h,d+1).filter((l)=>l.getAttribute("data-line-type")==="change-deletion").map((l)=>l.textContent??"").join(`
517
+ `)}#ce(t,e){let n=t.parentElement;if(n==null||e==null)return;let i=[...n.children].indexOf(t),s=e.children[i];return s instanceof HTMLElement?s:void 0}#le(t,e,n){let i=e.querySelector("[data-content]"),s=this.#ce(t,i);if(s===void 0)return!1;if(this.#ae(s,s,e),n)this.#Ht([k(document,"mousemove",(r)=>{let o=r.composedPath()[0],a=o instanceof HTMLElement?o.closest("[data-column-number]"):null;if(a instanceof HTMLElement&&e.contains(a)){let c=this.#ce(a,i);if(c!==void 0)this.#ae(s,c,e)}},{passive:!0})]);return!0}#he(){return this.#b?.shadowRoot?.querySelector("pre")?.hasAttribute("data-deleted-text-selection")??!1}#de(){return this.#St!==""?this.#St:window.getSelection()?.toString()??""}#Ot(t){let e=this.#b?.shadowRoot?.querySelector("pre");if(e==null)return;if(t)e.setAttribute("data-deleted-text-selection",""),this.#wt(null),this.#St="";else e.removeAttribute("data-deleted-text-selection"),this.#St=""}#wt(t,e=!1,n="additions"){try{this.#f?.setEditorActiveLine(t,{lineNumberOnly:e,side:n})}catch{}}#He(){if(this.#ut!==void 0)return;this.#ut=requestAnimationFrame(()=>{if(this.#ut=void 0,this.#i!==void 0||this.#Q!==void 0||this.#S!==void 0)this.#d(this.#i??[])})}#fe(){let t=this.#at,e=this.#$,n=this.#s;if(t===void 0||t.focusLine===void 0||e===void 0||n===void 0)return!1;let i=e.direction===-1?e.end:e.start,s=this.#h?.parentElement?.scrollLeft??0,r=(t.clientX-t.startClientX+s-t.startScrollLeft)/this.#t.ch,o=r<0?-Math.round(-r):Math.round(r),a=Math.max(0,i.character+o),c={line:t.focusLine,character:a};if(t.renderedGoal!==void 0&&T(t.renderedGoal,c)===0)return!0;t.renderedGoal=c;let h=[],d=c.line<i.line?-1:1;for(let l=i.line;;l+=d){if(this.#pt(l)){let f=n.getLineText(l),u=Math.min(i.character,f.length),m=Math.min(a,f.length),p=bt(f,u),g=m===u?p:bt(f,m);h.push({start:{line:l,character:Math.min(p,g)},end:{line:l,character:Math.max(p,g)},direction:p===g?0:p<g?1:-1})}if(l===c.line)break}return this.#d(h),!0}#d(t){if(this.__postponeBgTokenizeToNextFrame(),this.#X=void 0,this.#wt(null),t.length===0&&this.#Q===void 0&&this.#S===void 0){this.#i=void 0,this.#W?.forEach((s)=>s.remove()),this.#W?.clear(),this.#D?.cleanup(),this.#D=void 0;return}let e=document.createDocumentFragment(),n={fragment:e,elements:new Map};if(t.length>0){let s=Gt(t),r=s.at(-1);this.#i=s;let o=s.some((h)=>!O(h)),a=N(r).line+1;this.#wt(a,o);for(let h of s){if(!O(h))this.#It(n,"selection",h);this.#We(n,h,h===r)}let c=this.#e.matchBrackets!==!1&&this.#s!==void 0&&this.#r!==void 0&&O(r)?kn(this.#s,this.#r,r.start):void 0;if(c!==void 0)for(let h of c)this.#It(n,"bracketMatch",h)}let i=this.#s;if(this.#Q!==void 0&&i!==void 0){let s=this.#Q,r=this.#K,o=r!==void 0&&Number.isFinite(r.totalLines)||this.#et&&this.#f?.options.expandUnchanged!==!0?this.#Le():void 0,a=this.#i?.at(-1),c=a!==void 0?i.offsetAt(a.start):-1,h=a!==void 0?i.offsetAt(a.end):-1,d=0,l=o?.length??1;for(let f=0;f<l;f++){let u=1/0,m=o?.[f];if(m!==void 0){let[p,g]=m,v=i.offsetAt({line:p,character:0}),C=g+1;u=C<i.lineCount?i.offsetAt({line:C,character:0}):i.offsetAt({line:C-1,character:i.getLineLength(C-1)});let x=d,L=s.length;while(x<L){let b=x+Math.floor((L-x)/2);if(s[b][1]<=v)x=b+1;else L=b}d=x}for(;d<s.length;d++){let[p,g]=s[d];if(p>=u)break;let v={start:i.positionAt(p),end:i.positionAt(g)},C=c===p&&h===g;this.#It(n,"match",v,C?"focus":void 0)}}}if(this.#S!==void 0&&i!==void 0)for(let s of this.#S.markers)this.#It(n,"marker",s,dt(s.severity));this.#V?.appendChild(e),this.#W?.forEach((s)=>s.remove()),this.#W?.clear(),this.#W=n.elements,this.#Vt()}#It(t,e,n,i){if(this.#s===void 0)return;let{start:s,end:r}=n,o=s.line,a=r.line+1;if(this.#K!==void 0){let{startingLine:c,totalLines:h}=this.#K;o=Math.max(o,c),a=Math.min(a,c+h)}for(let c=o;c<a;c++){if(!this.#Nt(c))continue;let h=c===r.line,d=c===s.line?s.character:0,l=h?r.character:this.#s.getLineLength(c);if(this.#rt){let p=this.#Kt(),g=this.#s.getLineText(c);if(2*this.#t.ch+this.#t.measureTextWidth(g)>p){this.#Fe(t,c,g,d,l,h,e,i);continue}}let f=0,u=0,m=0;if(d===0)f=this.#ot()+this.#t.ch+(this.#gt?.left??0);else f=this.#Ct(c,d)[0];if(!h&&e==="selection")m=this.#t.ch;if(d===l)u=m;else u=this.#Ct(c,l)[0]-f+m;this.#pe(t,e,c,0,f,u,i)}}#Fe(t,e,n,i,s,r,o,a){let c=this.#$t(e),h=c.length-1,d=this.#ot()+this.#t.ch+(this.#gt?.left??0);for(let l=0;l<h;l++){let f=c[l],u=c[l+1],m=Math.max(i,f),p=Math.min(s,u);if(m>p)continue;let g=this.#ue(n,f,m),v=d+g,C=0;if(!r&&l===h-1&&o==="selection")C=this.#t.ch;let x=m===p?C:this.#ue(n,f,p)-g+C;this.#pe(t,o,e,l,v,x,a)}}#ue(t,e,n){if(n<=e)return 0;let i=t.slice(e,n),s=ft(i,this.#t.tabSize);return s!==-1?s*this.#t.ch:this.#t.measureTextWidth(i)}#pe(t,e,n,i,s,r,o){if(r===0)return;let{ch:a,lineHeight:c}=this.#t,h=this.#vt(n)+i*c,d=`${e}-${n}/${i}-${s}-${r} ${o??""}`,l=this.#W,f=(this.#e.roundedSelection??!0)&&e==="selection",u=(g,v,C,x)=>{let L=this.#vt(g)+v*c,b=this.#ht(g),w="initial";if(b!==void 0&&(b.dataset.lineType==="change-addition"||b.dataset.selectedLine!==void 0))w=getComputedStyle(b).getPropertyValue("--diffs-line-bg");let R=`width:${a}px;transform:translateX(${C}px) translateY(${L}px);--diffs-selection-corner-bg:${w}`,I={selectionCorner:"",[x]:""},E=`${e}-block-${g}/${v}-${C}-1ch`,A=E+"-"+x;if(x==="rbl"){let P=E+"-rtl",H=t.elements.get(P);if(H!==void 0)H.remove(),t.elements.delete(P),A+="-rtl",I.rtl=""}let B=t.elements.get(A);if(B!==void 0)return;if(l?.has(A)===!0)B=l.get(A),B.style.cssText=R,l.delete(A);else B=y("div",{dataset:"selectionRange",style:{cssText:R},children:[y("div",{dataset:I})]},t.fragment);t.elements.set(A,B)},m=(g)=>{let v=s+r,C=g.dataset,x=t.previousSelectionRange;if(x===void 0||x.line!==n||x.wrapLine!==i)t.previousSelectionRange={element:g,line:n,wrapLine:i,left:s,width:r};if(x===void 0||v<=x.left)["rtl","rtr","rbl","rbr"].forEach((L)=>{C[L]=""});else{let{line:L,wrapLine:b,left:w}=x,R=x.element.dataset,I=w+x.width;if(w>s)u(L,b,w-a,"rbr");if(delete R.rbl,delete C.rtl,delete C.rtr,v>=I)delete R.rbr;if(v>I)u(L,b,I,"rbl"),C.rtr="";if(v<I)u(n,i,v,"rtl");if(s<w)C.rtl="";C.rbl="",C.rbr=""}},p=t.elements.get(d);if(p!==void 0){if(f)m(p);return}if(l?.has(d)===!0)p=l.get(d),l.delete(d);else p=y("div",{dataset:o?[e+"Range",o]:e+"Range"},t.fragment);if(p.style.width=`${r}px`,p.style.transform=`translateX(${s}px) translateY(${h}px)`,f)m(p);t.elements.set(d,p)}#We(t,e,n){let{line:i,character:s}=N(e);if(!this.#Nt(i))return;let[r,o]=this.#Ct(i,s),a="caret-"+i+"/"+o+":"+s;if(t.elements.has(a))return;let c=y("div",{dataset:"caret",style:{transform:`translateX(${r-1}px) translateY(${this.#vt(i)+o*this.#t.lineHeight}px)`}},t.fragment);if(t.elements.set(a,c),n)c.style.scrollMargin=this.#re(),this.#X=c}#Vt(){let t=this.#i?.at(-1),e=this.#V,n=this.#s,i=this.#e.renderSelectionAction,s=()=>{this.#D?.cleanup(),this.#D=void 0};if(this.#e.enabledSelectionAction!==!0||i===void 0||t===void 0||O(t)||this.#st||e===void 0||n===void 0){s();return}let r=N(t);if(!this.#Nt(r.line)){s();return}if(this.#D===void 0){if(!this.#z)return;let E=()=>this.#i?.at(-1)??t,A=i({textDocument:n,get selection(){return E()},applyEdits:(B)=>this.applyEdits(B),getSelectionText:()=>this.#s?.getText(E())??"",replaceSelectionText:(B)=>{this.#mt(B,[E()])},close:()=>{s(),this.#nt()}});this.#D=new Mn(A,e,()=>this.#Vt()),this.#Tt().resetPlacement(oe)}let o=this.#t.lineHeight,a=t.direction===-1,c={placeAbove:a,anchor:r},h=a?{placeAbove:!1,anchor:t.end}:{placeAbove:!0,anchor:t.start},d=this.#D.height,l=(E)=>{let[A,B]=this.#Ct(E.anchor.line,E.anchor.character),P=this.#vt(E.anchor.line)+B*o,H=E.placeAbove?P:P+o,W=E.placeAbove?H-d:H;return{top:W,bottom:W+d,left:A,anchorTop:H,rowTop:P}},f=l(c),u=n.lineCount,m=a?r.line<3:r.line>=u-3,p=this.#Nt(h.anchor.line)?l(h):void 0,g=this.#Tt(),v=g.getPlacementBounds(),C=p!==void 0&&g.choosePlacement({preferred:f,fallback:p,viewport:v,popoverHeight:d,atDocumentEdge:m,placementKey:oe})==="fallback";if(p===void 0)g.setPlacement("preferred",oe);let{placeAbove:x}=C?h:c,{left:L,anchorTop:b}=C&&p!==void 0?p:f,w=a?f.rowTop:p?.rowTop??-1/0,R=(a?p?.rowTop??1/0:f.rowTop)+(t.end.line>t.start.line&&t.end.character===0?0:o),I=v===void 0||R>v.top&&w<v.bottom;this.#D.reposition(L,b,this.#ot(),x,I,v)}#ge(t){if(this.#B!==void 0){this.#B.setMode(t);return}this.#Ue(t)}#Ue(t){this.#B?.cleanup();let e=this.#s,n=this.#b?.shadowRoot?.querySelector("pre"),i=this.#i;if(e===void 0||n==null)return;let s="",r=void 0;if(i!==void 0&&i.length>0){let c=i.at(-1);if(O(c)){c=Tt(e,c),this.#d([...i.slice(0,-1),c]);let h=e.getText(c);if(h!==""&&!h.includes(`
518
+ `))s=h,r=[e.offsetAt(c.start),e.offsetAt(c.end)]}}let o=([c,h],d)=>{let l=yt(e,c,h);this.#d([l]),this.#lt(N(l).line),this.#nt(!0),this.#ct=d},a=new An({textDocument:e,containerElement:n,defaultQuery:s,mode:t,initialMatch:r,scrollToMatch:o,applyReplace:(c)=>{if(c.length===0)return;let h=e.applyEdits(c.map((d)=>({range:{start:e.positionAt(d.start),end:e.positionAt(d.end)},newText:d.text})),!0,this.#i);if(h!==void 0)this.#j(h,void 0,this.#it(h),{skipSearchRefresh:!0})},onUpdate:(c,h)=>{if(c.length===0){this.#Q=void 0,this.#d(this.#i??[]);return}if(this.#Q=c,h?.syncSelection===!1){this.#d(this.#i??[]);let u=this.#i?.at(-1);if(u!==void 0){let m=e.offsetAt(u.start),p=e.offsetAt(u.end);for(let g of c)if(g[0]===m&&g[1]===p)return g}return}let d=this.#i?.at(-1),l=0,f;if(d!==void 0)l=e.offsetAt(d.start);for(let u of c)if(u[0]>=l){f=u;break}if(f!==void 0)o(f,!0);else this.#d(this.#i??[]);return f},onClose:()=>{this.#B=void 0,this.#ct=!1,this.#Q=void 0,this.#d(this.#i??[])}});this.#B=a,this.#ct=!1}#Ve(){let t=this.#s,e=this.#i;if(t===void 0||e===void 0)return"";return Et(t,e)}#me(){let t=this.#s,e=this.#i;if(t===void 0||e===void 0)return[];return pn(t,e)}#ve(t,e,n){if(t===null)return;if(t.setData("text",e),n.length>1)t.setData(ae,JSON.stringify(n))}#Ke(){let t=this.#s,e=this.#i;if(t===void 0||e===void 0||e.length===0)return"";if(e.some((i)=>O(i))){let i=gn(t,e);return this.#$e(i.edits,i.nextSelectionOffsets),i.text}let n=Et(t,e);return this.#mt("",void 0,!0),n}#$e(t,e){let n=this.#s,i=this.#i;if(n===void 0||i===void 0||t.length===0)return;let s=n.applyResolvedEdits(t,!0,i,void 0,!0);if(s===void 0)return;let r=e.map((o)=>{let a=n.positionAt(o);return{start:a,end:a,direction:0}});n.setLastUndoSelectionsAfter(r),this.#j(s,r,this.#it(s))}#mt(t,e=this.#i,n=!1,i="selection"){if(e===void 0)return;let s=this.#s,r=e.at(-1);if(s===void 0||r===void 0)return;let{nextSelections:o,change:a}=Array.isArray(t)&&t.length===e.length?nt(s,e,t,this.#T,n,i):en(s,e,{start:s.offsetAt(r.start),end:s.offsetAt(r.end),text:Array.isArray(t)?t.join(s.eol):t},this.#T,void 0,n);if(a!==void 0)this.#j(a,o,this.#it(a))}#Ce(t=!1){let e=this.#i,n=this.#s;if(e===void 0||n===void 0)return;let{nextSelections:i,change:s}=cn(n,e,t,this.#T,this.#t.tabSize);if(s!==void 0)this.#j(s,i,this.#it(s))}#Ge(){let t=this.#i,e=this.#s;if(t===void 0||e===void 0)return;let{nextSelections:n,change:i}=on(e,t,this.#rt?(s,r)=>{let o=this.#$t(s);for(let a=0;a+1<o.length;a++){let c=o[a],h=o[a+1];if(r>=c&&r<=h)return c}return 0}:void 0,this.#T);if(i!==void 0)this.#j(i,n,this.#it(i))}#je(){let t=this.#i,e=this.#s;if(t===void 0||e===void 0)return;let{nextSelections:n,change:i}=an(e,t,this.#T);if(i!==void 0)this.#j(i,n,this.#it(i))}#qe(){let t=this.#i,e=this.#s;if(t===void 0||e===void 0)return;let{nextSelections:n,change:i}=rn(e,t,this.#T);if(i!==void 0)this.#j(i,n,this.#it(i))}#Xe(){let t=this.#i,e=this.#s;if(t===void 0||e===void 0)return;let{nextSelections:n,change:i}=sn(e,t,this.#T);if(i!==void 0)this.#j(i,n,this.#it(i))}#j(t,e,n,i){let s=this.getFile(),r=this.#e.onChange;if(s!==void 0&&r!==void 0){let c=n??this.#T;r(s,c,{changes:t.changes,file:s,lineAnnotations:c})}if(t.lineDelta!==0||this.#rt){for(let c of this.#k.keys())if(c>=t.startLine)this.#k.delete(c)}if(this.#g.size>0){if(t.lineDelta===0&&(t.changedLineRanges.length===1||t.changedLineChanges?.every(([,,c])=>c===0)===!0))for(let[c,h]of t.changedLineRanges)for(let d=c;d<=h;d++)this.#g.delete(d);else for(let c of this.#g.keys())if(c>=t.startLine)this.#g.delete(c)}this.#C=void 0;let o=this.#K,a;if(o!==void 0&&e!==void 0&&e.length>0){let c=e.at(-1),h=o.startingLine+o.totalLines;if(c.end.line>=h){let d=c.end.line-o.startingLine+1,l=this.#J===void 0||this.#J===1/0?1/0:this.#J*Vi;if(t.startLine<=h&&d<=l&&this.#pt(c.end.line)){if(c.end.line>h)a=!0;o={...o,totalLines:d},this.#K=o}else a=!0}}if(this.#Be(t,n,o,a),i?.skipSearchRefresh!==!0&&this.#B!==void 0&&this.#Q!==void 0)this.#B.updateMatches({syncSelection:!1});if(e!==void 0){if(this.#d(e),i?.skipFocus!==!0){let c=e.at(-1);if(c!==void 0)this.#lt(N(c).line);if(this.#X!==void 0)requestAnimationFrame(()=>{this.#X?.scrollIntoView({block:"nearest",inline:"nearest"})});else if(e.length>0){let h=N(e.at(-1));this.#Ut(h.line,h.character)}this.focus({preventScroll:!0})}}}#it(t){if(this.#T!==void 0){let e=tt(t,this.#T);if(e!==void 0)return this.#s?.setLastUndoLineAnnotations(this.#T,e),e}}#Le(){let t=this.#h;if(t===void 0)return[];let e=[];for(let n of t.children){let i=n,s=i.dataset.lineType,r=z(i);if(r===void 0||s===void 0||!it(s))continue;let o=r-1,a=e.at(-1);if(a!==void 0&&o<=a[1]+1)a[1]=Math.max(a[1],o);else e.push([o,o])}return e}#ht(t){let e=this.#M.get(t);if(e!==void 0)return e??void 0;let n=this.#K;if(n!==void 0&&(t<n.startingLine||t>=n.startingLine+n.totalLines))return;let i=this.#h;if(i===void 0)return;if(n!==void 0){let{startingLine:s}=n,{children:r}=i;for(let o=t-s;o<=r.length;o++){let a=r[o];if(a===void 0)break;let c=z(a),h=a.dataset.lineType;if(c!==void 0&&c===t+1&&h!==void 0&&it(h)){e=a;break}}}if(e??=i.querySelector(`[data-line="${t+1}"]`+(this.#Et==="unified"?':not([data-line-type="change-deletion"])':"")),e!==void 0)this.#M.set(t,e);return e??void 0}#ot(){if(this.#R===void 0)return 0;if(this.#L===void 0){let t=this.#h?.parentElement?.style.getPropertyValue("--diffs-column-number-width");if(t!==void 0&&t.length>2&&t.endsWith("px"))this.#L=parseInt(t.slice(0,-2),10);else this.#L=this.#R.offsetWidth}return this.#L}#Kt(){if(this.#h===void 0)return 0;if(this.#v===void 0){let t=this.#h.parentElement?.style.getPropertyValue("--diffs-column-content-width");if(t!==void 0&&t.length>2&&t.endsWith("px"))this.#v=parseFloat(t.slice(0,-2));else this.#v=this.#h.offsetWidth}return this.#v}#vt(t){let e=this.#k.get(t);if(e!==void 0)return e;let n=this.#ht(t);if(n===void 0)return-1;let i=n.offsetTop+this.#t.paddingTop;return i+=this.#gt?.top??0,this.#k.set(t,i),i}#Ct(t,e){if(this.#C!==void 0&&this.#C[0]===t&&this.#C[1]===e)return[this.#C[2],this.#C[3]];let n=this.#s?.getLineText(t),i=this.#ot()+this.#t.ch;if(n===void 0||n.length===0||e<=0)return[i+(this.#gt?.left??0),0];let s=In(n,Math.min(e,n.length)),r=n.slice(0,s),o=ft(r,this.#t.tabSize),a=0,c=0;if(o!==-1)a=i+o*this.#t.ch;else a=i+this.#t.measureTextWidth(r);if(this.#rt){let h=this.#Kt();if(2*this.#t.ch+this.#t.measureTextWidth(n)>h){let d=this.#xe(t);if(d==null)return[a+(this.#gt?.left??0),0];for(let l=0;l+1<d.length;l++){let f=d[l];if(s<=d[l+1]){c=l;let u=n.slice(f,s),m=ft(u,this.#t.tabSize);if(m!==-1)a=i+m*this.#t.ch;else a=i+this.#t.measureTextWidth(u);break}}}a+=this.#gt?.left??0}if(this.#C!==void 0)this.#C[0]=t,this.#C[1]=e,this.#C[2]=a,this.#C[3]=c;else this.#C=[t,e,a,c];return[a,c]}#xe(t){let e=this.#g.get(t);if(e!==void 0)return e;if(this.#g.size>=Ki)this.#g.clear();let n=this.#s?.getLineText(t);if(n===void 0||n.length===0){let c=new Uint32Array([0]);return this.#g.set(t,c),c}let i=this.#h;if(i==null||!i.isConnected)return;let s=y("div",{style:{position:"absolute",top:"0",left:"0",width:"100%",boxSizing:"border-box",visibility:"hidden",pointerEvents:"none",whiteSpace:"pre-wrap",wordBreak:"break-word",font:"inherit",paddingInline:"1ch",tabSize:this.#t.tabSize.toString()},textContent:n},i),r=s.firstChild,o=document.createRange(),a=[];try{let c=s.getBoundingClientRect();if(c.width===0)return;let h=Nn(n),d=c.left+this.#t.ch,l=h===void 0?n.length:h.length-1,f=(v)=>h===void 0?v:h[v],u=(v)=>(o.setStart(r,f(v)),o.setEnd(r,f(v+1)),o.getBoundingClientRect());a.push(0);let m=u(0).top,p=1;while(p<l){let v=p,C=l;while(v<C){let w=v+C>>1;if(u(w).top>m)C=w;else v=w+1}if(v>=l)break;let{left:x,top:L}=u(v),b=vt()&&x-d>this.#t.ch/2;a.push(f(b?v-1:v)),m=L,p=v+1}let g=new Uint32Array(a.length+1);for(let v=0;v<a.length;v++)g[v]=a[v];return g[a.length]=n.length,this.#g.set(t,g),g}finally{s.remove()}}#$t(t){let e=this.#xe(t);if(e!==void 0)return e;let n=this.#s?.getLineText(t)?.length??0;return Uint32Array.of(0,n)}#Ze({startContainer:t,endContainer:e}){let n=this.#h;if(n===void 0)return!1;return n.contains(t)&&n.contains(e)}#Nt(t){let e=this.#s?.lineCount??0;if(t<0||t>=e)return!1;return this.#ht(t)!==void 0}};export{$i as Editor,Dt as TextDocument};