c0ckp1t 1.0.0

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 (676) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +5 -0
  3. package/c0ckp1t-demo/Constants.mjs +125 -0
  4. package/c0ckp1t-demo/components/sidebar.vue +82 -0
  5. package/c0ckp1t-demo/main.vue +39 -0
  6. package/c0ckp1t-demo/pages/devices.vue +63 -0
  7. package/c0ckp1t-demo/pages/homepage.vue +63 -0
  8. package/c0ckp1t-demo/pages/report.vue +63 -0
  9. package/c0ckp1t-demo/store.mjs +133 -0
  10. package/components/ExecButton.vue +62 -0
  11. package/components/FsTree.vue +550 -0
  12. package/components/Markdown.mjs +274 -0
  13. package/components/MarkdownUtils.mjs +180 -0
  14. package/components/Tree.mjs +175 -0
  15. package/components/code-mirror.vue +445 -0
  16. package/components/vue3-ace-editor.vue +331 -0
  17. package/components/xbutton.vue +45 -0
  18. package/components/xcard-h.vue +175 -0
  19. package/components/xcard.vue +76 -0
  20. package/components/xcheck.vue +35 -0
  21. package/components/xcheckbox.vue +52 -0
  22. package/components/xcode.vue +139 -0
  23. package/components/xcollapse.vue +52 -0
  24. package/components/xcolor.vue +84 -0
  25. package/components/xdropdown.vue +104 -0
  26. package/components/xdropdown2.vue +140 -0
  27. package/components/xhidden.vue +30 -0
  28. package/components/xinput.vue +101 -0
  29. package/components/xinput2.vue +101 -0
  30. package/components/xjson.vue +95 -0
  31. package/components/xkv.vue +41 -0
  32. package/components/xlabel.vue +56 -0
  33. package/components/xlist.vue +83 -0
  34. package/components/xmap.vue +106 -0
  35. package/components/xmarkdown.vue +269 -0
  36. package/components/xnav.vue +98 -0
  37. package/components/xsection.vue +164 -0
  38. package/components/xsound.vue +251 -0
  39. package/components/xtable-open.vue +179 -0
  40. package/components/xtabs.vue +72 -0
  41. package/components/xterminal.vue +456 -0
  42. package/components/xtextarea.vue +83 -0
  43. package/components/xtoggle.vue +68 -0
  44. package/components/xtoggle3.vue +67 -0
  45. package/components/xtree.vue +140 -0
  46. package/components/xupload.vue +129 -0
  47. package/core/Content.mjs +92 -0
  48. package/core/DocUtils.mjs +189 -0
  49. package/core/GlobalStore.mjs +329 -0
  50. package/core/Island.mjs +429 -0
  51. package/core/IslandDefault.mjs +229 -0
  52. package/core/JsUtils.mjs +483 -0
  53. package/core/Logging.mjs +59 -0
  54. package/core/Page404.vue +152 -0
  55. package/core/PageFallback.vue +168 -0
  56. package/core/PageMain.vue +181 -0
  57. package/core/Theme.mjs +1759 -0
  58. package/core/VueUtils.mjs +200 -0
  59. package/core/WsUtils.mjs +274 -0
  60. package/core/img/Flag_of_the_United_States.svg +25 -0
  61. package/core/img/logo_v1.svg +98 -0
  62. package/core/img/logo_v2.svg +98 -0
  63. package/core/img/state-uniqueId-8k.wav +0 -0
  64. package/core/main-offcanvas.vue +99 -0
  65. package/core/nodes/_api.vue +82 -0
  66. package/core/nodes/node-container.vue +103 -0
  67. package/core/nodes/node.vue +246 -0
  68. package/core/nodes/place-holder.vue +47 -0
  69. package/core/nodes/root.vue +52 -0
  70. package/core/notify/NotifyUtils.mjs +150 -0
  71. package/core/notify/toast.vue +150 -0
  72. package/core/pages/About.vue +57 -0
  73. package/core/pages/Cache.vue +155 -0
  74. package/core/pages/Connection.vue +192 -0
  75. package/core/pages/Connections.vue +102 -0
  76. package/core/pages/Documentation.vue +263 -0
  77. package/core/pages/Notifies.vue +156 -0
  78. package/core/pages/Traffic.vue +152 -0
  79. package/core/pages/connections/connection-header-details.vue +80 -0
  80. package/core/pages/connections/page-connection-default.vue +92 -0
  81. package/core/pages/connections/page-connection.vue +176 -0
  82. package/core/pages/connections/ws-connection.vue +146 -0
  83. package/core/pages/frontend/Bootstrap.vue +1140 -0
  84. package/core/pages/frontend/Components.vue +56 -0
  85. package/core/pages/frontend/ComponentsAdv.vue +203 -0
  86. package/core/pages/frontend/ComponentsBasic.vue +336 -0
  87. package/core/pages/frontend/Theme.vue +473 -0
  88. package/core/pages/frontend/component-view.vue +65 -0
  89. package/core/pages/traffic/WsLogUtils.mjs +91 -0
  90. package/core/pages/traffic/log-ws-exec.vue +124 -0
  91. package/core/pages/traffic/log-ws-exec2.vue +129 -0
  92. package/core/sfc/code-item.vue +169 -0
  93. package/core/sfc/connection-header.vue +62 -0
  94. package/core/sfc/info-api.vue +158 -0
  95. package/core/sfc/md-toc.vue +346 -0
  96. package/core/sfc/scroll-to-top.vue +69 -0
  97. package/core/sfc/task.vue +98 -0
  98. package/core/sfc/text-to-md.vue +25 -0
  99. package/core/sfc/toc-list.vue +175 -0
  100. package/core/ws-client/AuthNState.mjs +84 -0
  101. package/core/ws-client/Connection.mjs +580 -0
  102. package/core/ws-client/Session.mjs +72 -0
  103. package/core/ws-client/WsClient.mjs +230 -0
  104. package/core/ws-client/WsLogUtils.mjs +91 -0
  105. package/core/ws-client/ws-connection.vue +144 -0
  106. package/css/Changa-Medium.ttf +0 -0
  107. package/css/Makefile +10 -0
  108. package/css/README.md +25 -0
  109. package/css/bootstrap-c0ckp1t.css +11861 -0
  110. package/css/bootstrap.min.css +6 -0
  111. package/css/fontawesome/brands.min.css +6 -0
  112. package/css/fontawesome/fontawesome.min.css +8 -0
  113. package/css/fontawesome/regular.min.css +6 -0
  114. package/css/fontawesome/solid.min.css +6 -0
  115. package/css/webfonts/fa-brands-400.woff2 +0 -0
  116. package/css/webfonts/fa-regular-400.woff2 +0 -0
  117. package/css/webfonts/fa-solid-900.woff2 +0 -0
  118. package/docs/Introduction.md +3 -0
  119. package/favicon-192x192.png +0 -0
  120. package/favicon-32x32.png +0 -0
  121. package/favicon-64x64.png +0 -0
  122. package/favicon.ico +0 -0
  123. package/index-cdn.html +66 -0
  124. package/js_ext/Makefile +26 -0
  125. package/js_ext/ace-editor/ace.js +22037 -0
  126. package/js_ext/ace-editor/ext-beautify.js +343 -0
  127. package/js_ext/ace-editor/ext-code_lens.js +204 -0
  128. package/js_ext/ace-editor/ext-command_bar.js +469 -0
  129. package/js_ext/ace-editor/ext-diff.js +4265 -0
  130. package/js_ext/ace-editor/ext-elastic_tabstops_lite.js +238 -0
  131. package/js_ext/ace-editor/ext-emmet.js +1303 -0
  132. package/js_ext/ace-editor/ext-error_marker.js +9 -0
  133. package/js_ext/ace-editor/ext-hardwrap.js +127 -0
  134. package/js_ext/ace-editor/ext-inline_autocomplete.js +3547 -0
  135. package/js_ext/ace-editor/ext-keybinding_menu.js +185 -0
  136. package/js_ext/ace-editor/ext-language_tools.js +2724 -0
  137. package/js_ext/ace-editor/ext-linking.js +66 -0
  138. package/js_ext/ace-editor/ext-modelist.js +276 -0
  139. package/js_ext/ace-editor/ext-options.js +859 -0
  140. package/js_ext/ace-editor/ext-prompt.js +3161 -0
  141. package/js_ext/ace-editor/ext-rtl.js +146 -0
  142. package/js_ext/ace-editor/ext-searchbox.js +385 -0
  143. package/js_ext/ace-editor/ext-settings_menu.js +859 -0
  144. package/js_ext/ace-editor/ext-simple_tokenizer.js +137 -0
  145. package/js_ext/ace-editor/ext-spellcheck.js +79 -0
  146. package/js_ext/ace-editor/ext-split.js +203 -0
  147. package/js_ext/ace-editor/ext-static_highlight.js +194 -0
  148. package/js_ext/ace-editor/ext-statusbar.js +63 -0
  149. package/js_ext/ace-editor/ext-textarea.js +400 -0
  150. package/js_ext/ace-editor/ext-themelist.js +80 -0
  151. package/js_ext/ace-editor/ext-whitespace.js +201 -0
  152. package/js_ext/ace-editor/keybinding-emacs.js +1067 -0
  153. package/js_ext/ace-editor/keybinding-sublime.js +409 -0
  154. package/js_ext/ace-editor/keybinding-vim.js +7101 -0
  155. package/js_ext/ace-editor/keybinding-vscode.js +255 -0
  156. package/js_ext/ace-editor/mode-abap.js +200 -0
  157. package/js_ext/ace-editor/mode-abc.js +243 -0
  158. package/js_ext/ace-editor/mode-actionscript.js +234 -0
  159. package/js_ext/ace-editor/mode-ada.js +108 -0
  160. package/js_ext/ace-editor/mode-alda.js +279 -0
  161. package/js_ext/ace-editor/mode-apache_conf.js +318 -0
  162. package/js_ext/ace-editor/mode-apex.js +402 -0
  163. package/js_ext/ace-editor/mode-applescript.js +232 -0
  164. package/js_ext/ace-editor/mode-aql.js +92 -0
  165. package/js_ext/ace-editor/mode-asciidoc.js +311 -0
  166. package/js_ext/ace-editor/mode-asl.js +357 -0
  167. package/js_ext/ace-editor/mode-assembly_arm32.js +185 -0
  168. package/js_ext/ace-editor/mode-assembly_x86.js +170 -0
  169. package/js_ext/ace-editor/mode-astro.js +2474 -0
  170. package/js_ext/ace-editor/mode-autohotkey.js +208 -0
  171. package/js_ext/ace-editor/mode-basic.js +201 -0
  172. package/js_ext/ace-editor/mode-batchfile.js +199 -0
  173. package/js_ext/ace-editor/mode-bibtex.js +318 -0
  174. package/js_ext/ace-editor/mode-c9search.js +250 -0
  175. package/js_ext/ace-editor/mode-c_cpp.js +417 -0
  176. package/js_ext/ace-editor/mode-cirru.js +192 -0
  177. package/js_ext/ace-editor/mode-clojure.js +322 -0
  178. package/js_ext/ace-editor/mode-clue.js +361 -0
  179. package/js_ext/ace-editor/mode-cobol.js +82 -0
  180. package/js_ext/ace-editor/mode-coffee.js +335 -0
  181. package/js_ext/ace-editor/mode-coldfusion.js +2409 -0
  182. package/js_ext/ace-editor/mode-crystal.js +586 -0
  183. package/js_ext/ace-editor/mode-csharp.js +413 -0
  184. package/js_ext/ace-editor/mode-csound_document.js +4072 -0
  185. package/js_ext/ace-editor/mode-csound_orchestra.js +2923 -0
  186. package/js_ext/ace-editor/mode-csound_score.js +409 -0
  187. package/js_ext/ace-editor/mode-csp.js +59 -0
  188. package/js_ext/ace-editor/mode-css.js +632 -0
  189. package/js_ext/ace-editor/mode-csv.js +97 -0
  190. package/js_ext/ace-editor/mode-curly.js +2381 -0
  191. package/js_ext/ace-editor/mode-cuttlefish.js +56 -0
  192. package/js_ext/ace-editor/mode-d.js +450 -0
  193. package/js_ext/ace-editor/mode-dart.js +618 -0
  194. package/js_ext/ace-editor/mode-diff.js +129 -0
  195. package/js_ext/ace-editor/mode-django.js +2422 -0
  196. package/js_ext/ace-editor/mode-dockerfile.js +427 -0
  197. package/js_ext/ace-editor/mode-dot.js +348 -0
  198. package/js_ext/ace-editor/mode-drools.js +607 -0
  199. package/js_ext/ace-editor/mode-edifact.js +130 -0
  200. package/js_ext/ace-editor/mode-eiffel.js +120 -0
  201. package/js_ext/ace-editor/mode-ejs.js +3277 -0
  202. package/js_ext/ace-editor/mode-elixir.js +443 -0
  203. package/js_ext/ace-editor/mode-elm.js +274 -0
  204. package/js_ext/ace-editor/mode-erlang.js +836 -0
  205. package/js_ext/ace-editor/mode-flix.js +164 -0
  206. package/js_ext/ace-editor/mode-forth.js +253 -0
  207. package/js_ext/ace-editor/mode-fortran.js +361 -0
  208. package/js_ext/ace-editor/mode-fsharp.js +277 -0
  209. package/js_ext/ace-editor/mode-fsl.js +226 -0
  210. package/js_ext/ace-editor/mode-ftl.js +1255 -0
  211. package/js_ext/ace-editor/mode-gcode.js +74 -0
  212. package/js_ext/ace-editor/mode-gherkin.js +154 -0
  213. package/js_ext/ace-editor/mode-gitignore.js +49 -0
  214. package/js_ext/ace-editor/mode-glsl.js +475 -0
  215. package/js_ext/ace-editor/mode-gobstones.js +1459 -0
  216. package/js_ext/ace-editor/mode-golang.js +341 -0
  217. package/js_ext/ace-editor/mode-graphqlschema.js +174 -0
  218. package/js_ext/ace-editor/mode-groovy.js +1401 -0
  219. package/js_ext/ace-editor/mode-haml.js +1906 -0
  220. package/js_ext/ace-editor/mode-handlebars.js +2438 -0
  221. package/js_ext/ace-editor/mode-haskell.js +324 -0
  222. package/js_ext/ace-editor/mode-haskell_cabal.js +135 -0
  223. package/js_ext/ace-editor/mode-haxe.js +313 -0
  224. package/js_ext/ace-editor/mode-hjson.js +318 -0
  225. package/js_ext/ace-editor/mode-html.js +2339 -0
  226. package/js_ext/ace-editor/mode-html_elixir.js +2845 -0
  227. package/js_ext/ace-editor/mode-html_ruby.js +3294 -0
  228. package/js_ext/ace-editor/mode-ini.js +138 -0
  229. package/js_ext/ace-editor/mode-io.js +210 -0
  230. package/js_ext/ace-editor/mode-ion.js +477 -0
  231. package/js_ext/ace-editor/mode-jack.js +293 -0
  232. package/js_ext/ace-editor/mode-jade.js +2017 -0
  233. package/js_ext/ace-editor/mode-java.js +1565 -0
  234. package/js_ext/ace-editor/mode-javascript.js +1191 -0
  235. package/js_ext/ace-editor/mode-jexl.js +270 -0
  236. package/js_ext/ace-editor/mode-json.js +275 -0
  237. package/js_ext/ace-editor/mode-json5.js +308 -0
  238. package/js_ext/ace-editor/mode-jsoniq.js +2577 -0
  239. package/js_ext/ace-editor/mode-jsp.js +1618 -0
  240. package/js_ext/ace-editor/mode-jssm.js +293 -0
  241. package/js_ext/ace-editor/mode-jsx.js +1209 -0
  242. package/js_ext/ace-editor/mode-julia.js +254 -0
  243. package/js_ext/ace-editor/mode-kotlin.js +445 -0
  244. package/js_ext/ace-editor/mode-latex.js +252 -0
  245. package/js_ext/ace-editor/mode-latte.js +2522 -0
  246. package/js_ext/ace-editor/mode-less.js +742 -0
  247. package/js_ext/ace-editor/mode-liquid.js +2741 -0
  248. package/js_ext/ace-editor/mode-lisp.js +104 -0
  249. package/js_ext/ace-editor/mode-livescript.js +272 -0
  250. package/js_ext/ace-editor/mode-logiql.js +272 -0
  251. package/js_ext/ace-editor/mode-logtalk.js +309 -0
  252. package/js_ext/ace-editor/mode-lsl.js +287 -0
  253. package/js_ext/ace-editor/mode-lua.js +393 -0
  254. package/js_ext/ace-editor/mode-luapage.js +2785 -0
  255. package/js_ext/ace-editor/mode-lucene.js +145 -0
  256. package/js_ext/ace-editor/mode-makefile.js +374 -0
  257. package/js_ext/ace-editor/mode-markdown.js +2935 -0
  258. package/js_ext/ace-editor/mode-mask.js +1757 -0
  259. package/js_ext/ace-editor/mode-matlab.js +239 -0
  260. package/js_ext/ace-editor/mode-maze.js +256 -0
  261. package/js_ext/ace-editor/mode-mediawiki.js +580 -0
  262. package/js_ext/ace-editor/mode-mel.js +213 -0
  263. package/js_ext/ace-editor/mode-mips.js +231 -0
  264. package/js_ext/ace-editor/mode-mixal.js +110 -0
  265. package/js_ext/ace-editor/mode-mushcode.js +642 -0
  266. package/js_ext/ace-editor/mode-mysql.js +150 -0
  267. package/js_ext/ace-editor/mode-nasal.js +513 -0
  268. package/js_ext/ace-editor/mode-nginx.js +262 -0
  269. package/js_ext/ace-editor/mode-nim.js +325 -0
  270. package/js_ext/ace-editor/mode-nix.js +555 -0
  271. package/js_ext/ace-editor/mode-nsis.js +279 -0
  272. package/js_ext/ace-editor/mode-nunjucks.js +2677 -0
  273. package/js_ext/ace-editor/mode-objectivec.js +626 -0
  274. package/js_ext/ace-editor/mode-ocaml.js +378 -0
  275. package/js_ext/ace-editor/mode-odin.js +449 -0
  276. package/js_ext/ace-editor/mode-partiql.js +750 -0
  277. package/js_ext/ace-editor/mode-pascal.js +204 -0
  278. package/js_ext/ace-editor/mode-perl.js +318 -0
  279. package/js_ext/ace-editor/mode-pgsql.js +1860 -0
  280. package/js_ext/ace-editor/mode-php.js +14072 -0
  281. package/js_ext/ace-editor/mode-php_laravel_blade.js +14260 -0
  282. package/js_ext/ace-editor/mode-pig.js +278 -0
  283. package/js_ext/ace-editor/mode-plain_text.js +27 -0
  284. package/js_ext/ace-editor/mode-plsql.js +268 -0
  285. package/js_ext/ace-editor/mode-powershell.js +567 -0
  286. package/js_ext/ace-editor/mode-praat.js +412 -0
  287. package/js_ext/ace-editor/mode-prisma.js +457 -0
  288. package/js_ext/ace-editor/mode-prolog.js +305 -0
  289. package/js_ext/ace-editor/mode-properties.js +69 -0
  290. package/js_ext/ace-editor/mode-protobuf.js +498 -0
  291. package/js_ext/ace-editor/mode-prql.js +323 -0
  292. package/js_ext/ace-editor/mode-puppet.js +316 -0
  293. package/js_ext/ace-editor/mode-python.js +476 -0
  294. package/js_ext/ace-editor/mode-qml.js +346 -0
  295. package/js_ext/ace-editor/mode-r.js +387 -0
  296. package/js_ext/ace-editor/mode-raku.js +516 -0
  297. package/js_ext/ace-editor/mode-razor.js +2697 -0
  298. package/js_ext/ace-editor/mode-rdoc.js +286 -0
  299. package/js_ext/ace-editor/mode-red.js +388 -0
  300. package/js_ext/ace-editor/mode-redshift.js +321 -0
  301. package/js_ext/ace-editor/mode-rhtml.js +2750 -0
  302. package/js_ext/ace-editor/mode-robot.js +168 -0
  303. package/js_ext/ace-editor/mode-rst.js +245 -0
  304. package/js_ext/ace-editor/mode-ruby.js +921 -0
  305. package/js_ext/ace-editor/mode-rust.js +393 -0
  306. package/js_ext/ace-editor/mode-sac.js +349 -0
  307. package/js_ext/ace-editor/mode-sass.js +480 -0
  308. package/js_ext/ace-editor/mode-scad.js +350 -0
  309. package/js_ext/ace-editor/mode-scala.js +1395 -0
  310. package/js_ext/ace-editor/mode-scheme.js +210 -0
  311. package/js_ext/ace-editor/mode-scrypt.js +317 -0
  312. package/js_ext/ace-editor/mode-scss.js +768 -0
  313. package/js_ext/ace-editor/mode-sh.js +387 -0
  314. package/js_ext/ace-editor/mode-sjs.js +1393 -0
  315. package/js_ext/ace-editor/mode-slim.js +4770 -0
  316. package/js_ext/ace-editor/mode-smarty.js +2436 -0
  317. package/js_ext/ace-editor/mode-smithy.js +456 -0
  318. package/js_ext/ace-editor/mode-snippets.js +183 -0
  319. package/js_ext/ace-editor/mode-soy_template.js +2611 -0
  320. package/js_ext/ace-editor/mode-space.js +151 -0
  321. package/js_ext/ace-editor/mode-sparql.js +288 -0
  322. package/js_ext/ace-editor/mode-sql.js +221 -0
  323. package/js_ext/ace-editor/mode-sqlserver.js +391 -0
  324. package/js_ext/ace-editor/mode-stylus.js +443 -0
  325. package/js_ext/ace-editor/mode-svg.js +1487 -0
  326. package/js_ext/ace-editor/mode-swift.js +342 -0
  327. package/js_ext/ace-editor/mode-tcl.js +338 -0
  328. package/js_ext/ace-editor/mode-terraform.js +346 -0
  329. package/js_ext/ace-editor/mode-tex.js +212 -0
  330. package/js_ext/ace-editor/mode-text.js +9 -0
  331. package/js_ext/ace-editor/mode-textile.js +125 -0
  332. package/js_ext/ace-editor/mode-toml.js +129 -0
  333. package/js_ext/ace-editor/mode-tsv.js +124 -0
  334. package/js_ext/ace-editor/mode-tsx.js +1276 -0
  335. package/js_ext/ace-editor/mode-turtle.js +264 -0
  336. package/js_ext/ace-editor/mode-twig.js +2502 -0
  337. package/js_ext/ace-editor/mode-typescript.js +1254 -0
  338. package/js_ext/ace-editor/mode-vala.js +554 -0
  339. package/js_ext/ace-editor/mode-vbscript.js +731 -0
  340. package/js_ext/ace-editor/mode-velocity.js +2580 -0
  341. package/js_ext/ace-editor/mode-verilog.js +98 -0
  342. package/js_ext/ace-editor/mode-vhdl.js +94 -0
  343. package/js_ext/ace-editor/mode-visualforce.js +2454 -0
  344. package/js_ext/ace-editor/mode-vue.js +3834 -0
  345. package/js_ext/ace-editor/mode-wollok.js +1329 -0
  346. package/js_ext/ace-editor/mode-xml.js +477 -0
  347. package/js_ext/ace-editor/mode-xquery.js +2589 -0
  348. package/js_ext/ace-editor/mode-yaml.js +395 -0
  349. package/js_ext/ace-editor/mode-zeek.js +502 -0
  350. package/js_ext/ace-editor/mode-zig.js +585 -0
  351. package/js_ext/ace-editor/snippets/abap.js +9 -0
  352. package/js_ext/ace-editor/snippets/abc.js +16 -0
  353. package/js_ext/ace-editor/snippets/actionscript.js +16 -0
  354. package/js_ext/ace-editor/snippets/ada.js +9 -0
  355. package/js_ext/ace-editor/snippets/alda.js +9 -0
  356. package/js_ext/ace-editor/snippets/apache_conf.js +9 -0
  357. package/js_ext/ace-editor/snippets/apex.js +9 -0
  358. package/js_ext/ace-editor/snippets/applescript.js +9 -0
  359. package/js_ext/ace-editor/snippets/aql.js +9 -0
  360. package/js_ext/ace-editor/snippets/asciidoc.js +9 -0
  361. package/js_ext/ace-editor/snippets/asl.js +9 -0
  362. package/js_ext/ace-editor/snippets/assembly_arm32.js +9 -0
  363. package/js_ext/ace-editor/snippets/assembly_x86.js +9 -0
  364. package/js_ext/ace-editor/snippets/astro.js +9 -0
  365. package/js_ext/ace-editor/snippets/autohotkey.js +9 -0
  366. package/js_ext/ace-editor/snippets/basic.js +9 -0
  367. package/js_ext/ace-editor/snippets/batchfile.js +9 -0
  368. package/js_ext/ace-editor/snippets/bibtex.js +9 -0
  369. package/js_ext/ace-editor/snippets/c9search.js +9 -0
  370. package/js_ext/ace-editor/snippets/c_cpp.js +16 -0
  371. package/js_ext/ace-editor/snippets/cirru.js +9 -0
  372. package/js_ext/ace-editor/snippets/clojure.js +16 -0
  373. package/js_ext/ace-editor/snippets/clue.js +9 -0
  374. package/js_ext/ace-editor/snippets/cobol.js +9 -0
  375. package/js_ext/ace-editor/snippets/coffee.js +16 -0
  376. package/js_ext/ace-editor/snippets/coldfusion.js +9 -0
  377. package/js_ext/ace-editor/snippets/crystal.js +9 -0
  378. package/js_ext/ace-editor/snippets/csharp.js +9 -0
  379. package/js_ext/ace-editor/snippets/csound_document.js +16 -0
  380. package/js_ext/ace-editor/snippets/csound_orchestra.js +16 -0
  381. package/js_ext/ace-editor/snippets/csound_score.js +9 -0
  382. package/js_ext/ace-editor/snippets/csp.js +9 -0
  383. package/js_ext/ace-editor/snippets/css.js +16 -0
  384. package/js_ext/ace-editor/snippets/csv.js +9 -0
  385. package/js_ext/ace-editor/snippets/curly.js +9 -0
  386. package/js_ext/ace-editor/snippets/cuttlefish.js +9 -0
  387. package/js_ext/ace-editor/snippets/d.js +9 -0
  388. package/js_ext/ace-editor/snippets/dart.js +16 -0
  389. package/js_ext/ace-editor/snippets/diff.js +16 -0
  390. package/js_ext/ace-editor/snippets/django.js +16 -0
  391. package/js_ext/ace-editor/snippets/dockerfile.js +9 -0
  392. package/js_ext/ace-editor/snippets/dot.js +9 -0
  393. package/js_ext/ace-editor/snippets/drools.js +16 -0
  394. package/js_ext/ace-editor/snippets/edifact.js +16 -0
  395. package/js_ext/ace-editor/snippets/eiffel.js +9 -0
  396. package/js_ext/ace-editor/snippets/ejs.js +9 -0
  397. package/js_ext/ace-editor/snippets/elixir.js +9 -0
  398. package/js_ext/ace-editor/snippets/elm.js +9 -0
  399. package/js_ext/ace-editor/snippets/erlang.js +16 -0
  400. package/js_ext/ace-editor/snippets/flix.js +9 -0
  401. package/js_ext/ace-editor/snippets/forth.js +9 -0
  402. package/js_ext/ace-editor/snippets/fortran.js +9 -0
  403. package/js_ext/ace-editor/snippets/fsharp.js +9 -0
  404. package/js_ext/ace-editor/snippets/fsl.js +16 -0
  405. package/js_ext/ace-editor/snippets/ftl.js +9 -0
  406. package/js_ext/ace-editor/snippets/gcode.js +9 -0
  407. package/js_ext/ace-editor/snippets/gherkin.js +9 -0
  408. package/js_ext/ace-editor/snippets/gitignore.js +9 -0
  409. package/js_ext/ace-editor/snippets/glsl.js +9 -0
  410. package/js_ext/ace-editor/snippets/gobstones.js +16 -0
  411. package/js_ext/ace-editor/snippets/golang.js +9 -0
  412. package/js_ext/ace-editor/snippets/graphqlschema.js +16 -0
  413. package/js_ext/ace-editor/snippets/groovy.js +9 -0
  414. package/js_ext/ace-editor/snippets/haml.js +16 -0
  415. package/js_ext/ace-editor/snippets/handlebars.js +9 -0
  416. package/js_ext/ace-editor/snippets/haskell.js +16 -0
  417. package/js_ext/ace-editor/snippets/haskell_cabal.js +9 -0
  418. package/js_ext/ace-editor/snippets/haxe.js +9 -0
  419. package/js_ext/ace-editor/snippets/hjson.js +9 -0
  420. package/js_ext/ace-editor/snippets/html.js +16 -0
  421. package/js_ext/ace-editor/snippets/html_elixir.js +9 -0
  422. package/js_ext/ace-editor/snippets/html_ruby.js +9 -0
  423. package/js_ext/ace-editor/snippets/ini.js +9 -0
  424. package/js_ext/ace-editor/snippets/io.js +74 -0
  425. package/js_ext/ace-editor/snippets/ion.js +9 -0
  426. package/js_ext/ace-editor/snippets/jack.js +9 -0
  427. package/js_ext/ace-editor/snippets/jade.js +9 -0
  428. package/js_ext/ace-editor/snippets/java.js +16 -0
  429. package/js_ext/ace-editor/snippets/javascript.js +16 -0
  430. package/js_ext/ace-editor/snippets/jexl.js +9 -0
  431. package/js_ext/ace-editor/snippets/json.js +9 -0
  432. package/js_ext/ace-editor/snippets/json5.js +9 -0
  433. package/js_ext/ace-editor/snippets/jsoniq.js +78 -0
  434. package/js_ext/ace-editor/snippets/jsp.js +16 -0
  435. package/js_ext/ace-editor/snippets/jssm.js +9 -0
  436. package/js_ext/ace-editor/snippets/jsx.js +9 -0
  437. package/js_ext/ace-editor/snippets/julia.js +9 -0
  438. package/js_ext/ace-editor/snippets/kotlin.js +9 -0
  439. package/js_ext/ace-editor/snippets/latex.js +9 -0
  440. package/js_ext/ace-editor/snippets/latte.js +9 -0
  441. package/js_ext/ace-editor/snippets/less.js +9 -0
  442. package/js_ext/ace-editor/snippets/liquid.js +16 -0
  443. package/js_ext/ace-editor/snippets/lisp.js +9 -0
  444. package/js_ext/ace-editor/snippets/livescript.js +9 -0
  445. package/js_ext/ace-editor/snippets/logiql.js +9 -0
  446. package/js_ext/ace-editor/snippets/logtalk.js +9 -0
  447. package/js_ext/ace-editor/snippets/lsl.js +16 -0
  448. package/js_ext/ace-editor/snippets/lua.js +16 -0
  449. package/js_ext/ace-editor/snippets/luapage.js +9 -0
  450. package/js_ext/ace-editor/snippets/lucene.js +9 -0
  451. package/js_ext/ace-editor/snippets/makefile.js +16 -0
  452. package/js_ext/ace-editor/snippets/markdown.js +16 -0
  453. package/js_ext/ace-editor/snippets/mask.js +9 -0
  454. package/js_ext/ace-editor/snippets/matlab.js +9 -0
  455. package/js_ext/ace-editor/snippets/maze.js +16 -0
  456. package/js_ext/ace-editor/snippets/mediawiki.js +9 -0
  457. package/js_ext/ace-editor/snippets/mel.js +9 -0
  458. package/js_ext/ace-editor/snippets/mips.js +9 -0
  459. package/js_ext/ace-editor/snippets/mixal.js +9 -0
  460. package/js_ext/ace-editor/snippets/mushcode.js +9 -0
  461. package/js_ext/ace-editor/snippets/mysql.js +9 -0
  462. package/js_ext/ace-editor/snippets/nasal.js +9 -0
  463. package/js_ext/ace-editor/snippets/nginx.js +9 -0
  464. package/js_ext/ace-editor/snippets/nim.js +9 -0
  465. package/js_ext/ace-editor/snippets/nix.js +9 -0
  466. package/js_ext/ace-editor/snippets/nsis.js +9 -0
  467. package/js_ext/ace-editor/snippets/nunjucks.js +9 -0
  468. package/js_ext/ace-editor/snippets/objectivec.js +9 -0
  469. package/js_ext/ace-editor/snippets/ocaml.js +9 -0
  470. package/js_ext/ace-editor/snippets/odin.js +9 -0
  471. package/js_ext/ace-editor/snippets/partiql.js +9 -0
  472. package/js_ext/ace-editor/snippets/pascal.js +9 -0
  473. package/js_ext/ace-editor/snippets/perl.js +16 -0
  474. package/js_ext/ace-editor/snippets/pgsql.js +9 -0
  475. package/js_ext/ace-editor/snippets/php.js +16 -0
  476. package/js_ext/ace-editor/snippets/php_laravel_blade.js +9 -0
  477. package/js_ext/ace-editor/snippets/pig.js +9 -0
  478. package/js_ext/ace-editor/snippets/plain_text.js +9 -0
  479. package/js_ext/ace-editor/snippets/plsql.js +9 -0
  480. package/js_ext/ace-editor/snippets/powershell.js +9 -0
  481. package/js_ext/ace-editor/snippets/praat.js +9 -0
  482. package/js_ext/ace-editor/snippets/prisma.js +9 -0
  483. package/js_ext/ace-editor/snippets/prolog.js +9 -0
  484. package/js_ext/ace-editor/snippets/properties.js +9 -0
  485. package/js_ext/ace-editor/snippets/protobuf.js +9 -0
  486. package/js_ext/ace-editor/snippets/prql.js +9 -0
  487. package/js_ext/ace-editor/snippets/puppet.js +9 -0
  488. package/js_ext/ace-editor/snippets/python.js +16 -0
  489. package/js_ext/ace-editor/snippets/qml.js +9 -0
  490. package/js_ext/ace-editor/snippets/r.js +16 -0
  491. package/js_ext/ace-editor/snippets/raku.js +9 -0
  492. package/js_ext/ace-editor/snippets/razor.js +16 -0
  493. package/js_ext/ace-editor/snippets/rdoc.js +9 -0
  494. package/js_ext/ace-editor/snippets/red.js +9 -0
  495. package/js_ext/ace-editor/snippets/redshift.js +9 -0
  496. package/js_ext/ace-editor/snippets/rhtml.js +9 -0
  497. package/js_ext/ace-editor/snippets/robot.js +16 -0
  498. package/js_ext/ace-editor/snippets/rst.js +16 -0
  499. package/js_ext/ace-editor/snippets/ruby.js +16 -0
  500. package/js_ext/ace-editor/snippets/rust.js +9 -0
  501. package/js_ext/ace-editor/snippets/sac.js +9 -0
  502. package/js_ext/ace-editor/snippets/sass.js +9 -0
  503. package/js_ext/ace-editor/snippets/scad.js +9 -0
  504. package/js_ext/ace-editor/snippets/scala.js +9 -0
  505. package/js_ext/ace-editor/snippets/scheme.js +9 -0
  506. package/js_ext/ace-editor/snippets/scrypt.js +9 -0
  507. package/js_ext/ace-editor/snippets/scss.js +9 -0
  508. package/js_ext/ace-editor/snippets/sh.js +16 -0
  509. package/js_ext/ace-editor/snippets/sjs.js +9 -0
  510. package/js_ext/ace-editor/snippets/slim.js +9 -0
  511. package/js_ext/ace-editor/snippets/smarty.js +9 -0
  512. package/js_ext/ace-editor/snippets/smithy.js +9 -0
  513. package/js_ext/ace-editor/snippets/snippets.js +16 -0
  514. package/js_ext/ace-editor/snippets/soy_template.js +9 -0
  515. package/js_ext/ace-editor/snippets/space.js +9 -0
  516. package/js_ext/ace-editor/snippets/sparql.js +9 -0
  517. package/js_ext/ace-editor/snippets/sql.js +16 -0
  518. package/js_ext/ace-editor/snippets/sqlserver.js +16 -0
  519. package/js_ext/ace-editor/snippets/stylus.js +9 -0
  520. package/js_ext/ace-editor/snippets/svg.js +9 -0
  521. package/js_ext/ace-editor/snippets/swift.js +9 -0
  522. package/js_ext/ace-editor/snippets/tcl.js +16 -0
  523. package/js_ext/ace-editor/snippets/terraform.js +9 -0
  524. package/js_ext/ace-editor/snippets/tex.js +16 -0
  525. package/js_ext/ace-editor/snippets/text.js +9 -0
  526. package/js_ext/ace-editor/snippets/textile.js +16 -0
  527. package/js_ext/ace-editor/snippets/toml.js +9 -0
  528. package/js_ext/ace-editor/snippets/tsv.js +9 -0
  529. package/js_ext/ace-editor/snippets/tsx.js +9 -0
  530. package/js_ext/ace-editor/snippets/turtle.js +9 -0
  531. package/js_ext/ace-editor/snippets/twig.js +9 -0
  532. package/js_ext/ace-editor/snippets/typescript.js +9 -0
  533. package/js_ext/ace-editor/snippets/vala.js +199 -0
  534. package/js_ext/ace-editor/snippets/vbscript.js +9 -0
  535. package/js_ext/ace-editor/snippets/velocity.js +17 -0
  536. package/js_ext/ace-editor/snippets/verilog.js +9 -0
  537. package/js_ext/ace-editor/snippets/vhdl.js +9 -0
  538. package/js_ext/ace-editor/snippets/visualforce.js +9 -0
  539. package/js_ext/ace-editor/snippets/vue.js +9 -0
  540. package/js_ext/ace-editor/snippets/wollok.js +16 -0
  541. package/js_ext/ace-editor/snippets/xml.js +9 -0
  542. package/js_ext/ace-editor/snippets/xquery.js +78 -0
  543. package/js_ext/ace-editor/snippets/yaml.js +9 -0
  544. package/js_ext/ace-editor/snippets/zeek.js +9 -0
  545. package/js_ext/ace-editor/snippets/zig.js +9 -0
  546. package/js_ext/ace-editor/theme-ambiance.js +18 -0
  547. package/js_ext/ace-editor/theme-chaos.js +18 -0
  548. package/js_ext/ace-editor/theme-chrome.js +18 -0
  549. package/js_ext/ace-editor/theme-cloud9_day.js +19 -0
  550. package/js_ext/ace-editor/theme-cloud9_night.js +18 -0
  551. package/js_ext/ace-editor/theme-cloud9_night_low_color.js +18 -0
  552. package/js_ext/ace-editor/theme-cloud_editor.js +19 -0
  553. package/js_ext/ace-editor/theme-cloud_editor_dark.js +19 -0
  554. package/js_ext/ace-editor/theme-clouds.js +18 -0
  555. package/js_ext/ace-editor/theme-clouds_midnight.js +18 -0
  556. package/js_ext/ace-editor/theme-cobalt.js +18 -0
  557. package/js_ext/ace-editor/theme-crimson_editor.js +18 -0
  558. package/js_ext/ace-editor/theme-dawn.js +18 -0
  559. package/js_ext/ace-editor/theme-dracula.js +19 -0
  560. package/js_ext/ace-editor/theme-dreamweaver.js +18 -0
  561. package/js_ext/ace-editor/theme-eclipse.js +19 -0
  562. package/js_ext/ace-editor/theme-github.js +18 -0
  563. package/js_ext/ace-editor/theme-github_dark.js +18 -0
  564. package/js_ext/ace-editor/theme-github_light_default.js +18 -0
  565. package/js_ext/ace-editor/theme-gob.js +18 -0
  566. package/js_ext/ace-editor/theme-gruvbox.js +18 -0
  567. package/js_ext/ace-editor/theme-gruvbox_dark_hard.js +18 -0
  568. package/js_ext/ace-editor/theme-gruvbox_light_hard.js +18 -0
  569. package/js_ext/ace-editor/theme-idle_fingers.js +18 -0
  570. package/js_ext/ace-editor/theme-iplastic.js +18 -0
  571. package/js_ext/ace-editor/theme-katzenmilch.js +18 -0
  572. package/js_ext/ace-editor/theme-kr_theme.js +18 -0
  573. package/js_ext/ace-editor/theme-kuroir.js +18 -0
  574. package/js_ext/ace-editor/theme-merbivore.js +18 -0
  575. package/js_ext/ace-editor/theme-merbivore_soft.js +18 -0
  576. package/js_ext/ace-editor/theme-mono_industrial.js +18 -0
  577. package/js_ext/ace-editor/theme-monokai.js +18 -0
  578. package/js_ext/ace-editor/theme-nord_dark.js +19 -0
  579. package/js_ext/ace-editor/theme-one_dark.js +18 -0
  580. package/js_ext/ace-editor/theme-pastel_on_dark.js +18 -0
  581. package/js_ext/ace-editor/theme-solarized_dark.js +18 -0
  582. package/js_ext/ace-editor/theme-solarized_light.js +18 -0
  583. package/js_ext/ace-editor/theme-sqlserver.js +18 -0
  584. package/js_ext/ace-editor/theme-terminal.js +18 -0
  585. package/js_ext/ace-editor/theme-textmate.js +16 -0
  586. package/js_ext/ace-editor/theme-tomorrow.js +18 -0
  587. package/js_ext/ace-editor/theme-tomorrow_night.js +18 -0
  588. package/js_ext/ace-editor/theme-tomorrow_night_blue.js +18 -0
  589. package/js_ext/ace-editor/theme-tomorrow_night_bright.js +18 -0
  590. package/js_ext/ace-editor/theme-tomorrow_night_eighties.js +18 -0
  591. package/js_ext/ace-editor/theme-twilight.js +18 -0
  592. package/js_ext/ace-editor/theme-vibrant_ink.js +18 -0
  593. package/js_ext/ace-editor/theme-xcode.js +18 -0
  594. package/js_ext/ace-editor/worker-base.js +1332 -0
  595. package/js_ext/ace-editor/worker-coffee.js +1381 -0
  596. package/js_ext/ace-editor/worker-css.js +8913 -0
  597. package/js_ext/ace-editor/worker-html.js +10843 -0
  598. package/js_ext/ace-editor/worker-javascript.js +15353 -0
  599. package/js_ext/ace-editor/worker-json.js +1626 -0
  600. package/js_ext/ace-editor/worker-lua.js +3519 -0
  601. package/js_ext/ace-editor/worker-php.js +3788 -0
  602. package/js_ext/ace-editor/worker-xml.js +3122 -0
  603. package/js_ext/ace-editor/worker-xquery.js +57579 -0
  604. package/js_ext/ace-editor/worker-yaml.js +5819 -0
  605. package/js_ext/bootstrap.bundle.min.js +7 -0
  606. package/js_ext/highlight/default.min.css +9 -0
  607. package/js_ext/highlight/go.min.js +14 -0
  608. package/js_ext/highlight/highlight.min.js +1207 -0
  609. package/js_ext/highlight/stackoverflow-dark.min.css +13 -0
  610. package/js_ext/idb-keyval-6.2.2.mjs +7 -0
  611. package/js_ext/json-viewer.bundle.js +52 -0
  612. package/js_ext/loglevel-plugin-prefix.min.js +1 -0
  613. package/js_ext/loglevel.min.js +2 -0
  614. package/js_ext/markdown/auto-render.min.js +1 -0
  615. package/js_ext/markdown/auto-render.mjs +245 -0
  616. package/js_ext/markdown/fonts/KaTeX_AMS-Regular.woff +0 -0
  617. package/js_ext/markdown/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  618. package/js_ext/markdown/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  619. package/js_ext/markdown/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  620. package/js_ext/markdown/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  621. package/js_ext/markdown/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  622. package/js_ext/markdown/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  623. package/js_ext/markdown/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  624. package/js_ext/markdown/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  625. package/js_ext/markdown/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  626. package/js_ext/markdown/fonts/KaTeX_Main-Bold.woff +0 -0
  627. package/js_ext/markdown/fonts/KaTeX_Main-Bold.woff2 +0 -0
  628. package/js_ext/markdown/fonts/KaTeX_Main-Italic.woff +0 -0
  629. package/js_ext/markdown/fonts/KaTeX_Main-Italic.woff2 +0 -0
  630. package/js_ext/markdown/fonts/KaTeX_Main-Regular.woff +0 -0
  631. package/js_ext/markdown/fonts/KaTeX_Main-Regular.woff2 +0 -0
  632. package/js_ext/markdown/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  633. package/js_ext/markdown/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  634. package/js_ext/markdown/fonts/KaTeX_Math-Italic.woff +0 -0
  635. package/js_ext/markdown/fonts/KaTeX_Math-Italic.woff2 +0 -0
  636. package/js_ext/markdown/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  637. package/js_ext/markdown/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  638. package/js_ext/markdown/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  639. package/js_ext/markdown/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  640. package/js_ext/markdown/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  641. package/js_ext/markdown/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  642. package/js_ext/markdown/fonts/KaTeX_Script-Regular.ttf +0 -0
  643. package/js_ext/markdown/fonts/KaTeX_Script-Regular.woff +0 -0
  644. package/js_ext/markdown/fonts/KaTeX_Script-Regular.woff2 +0 -0
  645. package/js_ext/markdown/fonts/KaTeX_Size1-Regular.ttf +0 -0
  646. package/js_ext/markdown/fonts/KaTeX_Size1-Regular.woff +0 -0
  647. package/js_ext/markdown/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  648. package/js_ext/markdown/fonts/KaTeX_Size2-Regular.woff +0 -0
  649. package/js_ext/markdown/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  650. package/js_ext/markdown/fonts/KaTeX_Size3-Regular.woff +0 -0
  651. package/js_ext/markdown/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  652. package/js_ext/markdown/fonts/KaTeX_Size4-Regular.ttf +0 -0
  653. package/js_ext/markdown/fonts/KaTeX_Size4-Regular.woff +0 -0
  654. package/js_ext/markdown/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  655. package/js_ext/markdown/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  656. package/js_ext/markdown/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  657. package/js_ext/markdown/katex.min.css +1 -0
  658. package/js_ext/markdown/katex.min.js +1 -0
  659. package/js_ext/markdown/katex.mjs +18416 -0
  660. package/js_ext/markdown/markdown-it.min.js +3 -0
  661. package/js_ext/markdown/markdownItAnchor.umd.js +2 -0
  662. package/js_ext/mitt.mjs +2 -0
  663. package/js_ext/moment.min.js +1 -0
  664. package/js_ext/msgpack.mjs +1612 -0
  665. package/js_ext/rxjs.umd.min.js +195 -0
  666. package/js_ext/rxjs.umd.min.js.map +1 -0
  667. package/js_ext/vue-router.esm-browser.prod.js +6 -0
  668. package/js_ext/vue.esm-browser.min.js +18 -0
  669. package/js_ext/vue.esm-browser.prod.min.js +3 -0
  670. package/js_ext/vue3-sfc-loader.esm.js +1840 -0
  671. package/js_ext/vue3-sfc-loader.esm.js.map +4 -0
  672. package/js_ext/vue3-sfc-loader.js +1839 -0
  673. package/js_ext/wavesurfer.esm.mjs +1 -0
  674. package/js_ext/xstate.web.mjs +15 -0
  675. package/package.json +50 -0
  676. package/style.css +31 -0
@@ -0,0 +1,3161 @@
1
+ ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/config","ace/lib/useragent"], function(require, exports, module){"use strict";
2
+ var Renderer = require("../virtual_renderer").VirtualRenderer;
3
+ var Editor = require("../editor").Editor;
4
+ var Range = require("../range").Range;
5
+ var event = require("../lib/event");
6
+ var lang = require("../lib/lang");
7
+ var dom = require("../lib/dom");
8
+ var nls = require("../config").nls;
9
+ var userAgent = require("./../lib/useragent");
10
+ var getAriaId = function (index) {
11
+ return "suggest-aria-id:".concat(index);
12
+ };
13
+ var popupAriaRole = userAgent.isSafari ? "menu" : "listbox";
14
+ var optionAriaRole = userAgent.isSafari ? "menuitem" : "option";
15
+ var ariaActiveState = userAgent.isSafari ? "aria-current" : "aria-selected";
16
+ var $singleLineEditor = function (el) {
17
+ var renderer = new Renderer(el);
18
+ renderer.$maxLines = 4;
19
+ var editor = new Editor(renderer);
20
+ editor.setHighlightActiveLine(false);
21
+ editor.setShowPrintMargin(false);
22
+ editor.renderer.setShowGutter(false);
23
+ editor.renderer.setHighlightGutterLine(false);
24
+ editor.$mouseHandler.$focusTimeout = 0;
25
+ editor.$highlightTagPending = true;
26
+ return editor;
27
+ };
28
+ var AcePopup = /** @class */ (function () {
29
+ function AcePopup(parentNode) {
30
+ var el = dom.createElement("div");
31
+ var popup = $singleLineEditor(el);
32
+ if (parentNode) {
33
+ parentNode.appendChild(el);
34
+ }
35
+ el.style.display = "none";
36
+ popup.renderer.content.style.cursor = "default";
37
+ popup.renderer.setStyle("ace_autocomplete");
38
+ popup.renderer.$textLayer.element.setAttribute("role", popupAriaRole);
39
+ popup.renderer.$textLayer.element.setAttribute("aria-roledescription", nls("autocomplete.popup.aria-roledescription", "Autocomplete suggestions"));
40
+ popup.renderer.$textLayer.element.setAttribute("aria-label", nls("autocomplete.popup.aria-label", "Autocomplete suggestions"));
41
+ popup.renderer.textarea.setAttribute("aria-hidden", "true");
42
+ popup.setOption("displayIndentGuides", false);
43
+ popup.setOption("dragDelay", 150);
44
+ var noop = function () { };
45
+ popup.focus = noop;
46
+ popup.$isFocused = true;
47
+ popup.renderer.$cursorLayer.restartTimer = noop;
48
+ popup.renderer.$cursorLayer.element.style.opacity = "0";
49
+ popup.renderer.$maxLines = 8;
50
+ popup.renderer.$keepTextAreaAtCursor = false;
51
+ popup.setHighlightActiveLine(false);
52
+ popup.session.highlight("");
53
+ popup.session.$searchHighlight.clazz = "ace_highlight-marker";
54
+ popup.on("mousedown", function (e) {
55
+ var pos = e.getDocumentPosition();
56
+ popup.selection.moveToPosition(pos);
57
+ selectionMarker.start.row = selectionMarker.end.row = pos.row;
58
+ e.stop();
59
+ });
60
+ var lastMouseEvent;
61
+ var hoverMarker = new Range(-1, 0, -1, Infinity);
62
+ var selectionMarker = new Range(-1, 0, -1, Infinity);
63
+ selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
64
+ popup.setSelectOnHover = function (val) {
65
+ if (!val) {
66
+ hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
67
+ }
68
+ else if (hoverMarker.id) {
69
+ popup.session.removeMarker(hoverMarker.id);
70
+ hoverMarker.id = null;
71
+ }
72
+ };
73
+ popup.setSelectOnHover(false);
74
+ popup.on("mousemove", function (e) {
75
+ if (!lastMouseEvent) {
76
+ lastMouseEvent = e;
77
+ return;
78
+ }
79
+ if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
80
+ return;
81
+ }
82
+ lastMouseEvent = e;
83
+ lastMouseEvent.scrollTop = popup.renderer.scrollTop;
84
+ popup.isMouseOver = true;
85
+ var row = lastMouseEvent.getDocumentPosition().row;
86
+ if (hoverMarker.start.row != row) {
87
+ if (!hoverMarker.id)
88
+ popup.setRow(row);
89
+ setHoverMarker(row);
90
+ }
91
+ });
92
+ popup.renderer.on("beforeRender", function () {
93
+ if (lastMouseEvent && hoverMarker.start.row != -1) {
94
+ lastMouseEvent.$pos = null;
95
+ var row = lastMouseEvent.getDocumentPosition().row;
96
+ if (!hoverMarker.id)
97
+ popup.setRow(row);
98
+ setHoverMarker(row, true);
99
+ }
100
+ });
101
+ popup.renderer.on("afterRender", function () {
102
+ var t = popup.renderer.$textLayer;
103
+ for (var row = t.config.firstRow, l = t.config.lastRow; row <= l; row++) {
104
+ var popupRowElement = /** @type {HTMLElement|null} */ (t.element.childNodes[row - t.config.firstRow]);
105
+ popupRowElement.setAttribute("role", optionAriaRole);
106
+ popupRowElement.setAttribute("aria-roledescription", nls("autocomplete.popup.item.aria-roledescription", "item"));
107
+ popupRowElement.setAttribute("aria-setsize", popup.data.length);
108
+ popupRowElement.setAttribute("aria-describedby", "doc-tooltip");
109
+ popupRowElement.setAttribute("aria-posinset", row + 1);
110
+ var rowData = popup.getData(row);
111
+ if (rowData) {
112
+ var ariaLabel = "".concat(rowData.caption || rowData.value).concat(rowData.meta ? ", ".concat(rowData.meta) : '');
113
+ popupRowElement.setAttribute("aria-label", ariaLabel);
114
+ }
115
+ var highlightedSpans = popupRowElement.querySelectorAll(".ace_completion-highlight");
116
+ highlightedSpans.forEach(function (span) {
117
+ span.setAttribute("role", "mark");
118
+ });
119
+ }
120
+ });
121
+ popup.renderer.on("afterRender", function () {
122
+ var row = popup.getRow();
123
+ var t = popup.renderer.$textLayer;
124
+ var selected = /** @type {HTMLElement|null} */ (t.element.childNodes[row - t.config.firstRow]);
125
+ var el = document.activeElement; // Active element is textarea of main editor
126
+ if (selected !== popup.selectedNode && popup.selectedNode) {
127
+ dom.removeCssClass(popup.selectedNode, "ace_selected");
128
+ popup.selectedNode.removeAttribute(ariaActiveState);
129
+ popup.selectedNode.removeAttribute("id");
130
+ }
131
+ el.removeAttribute("aria-activedescendant");
132
+ popup.selectedNode = selected;
133
+ if (selected) {
134
+ var ariaId = getAriaId(row);
135
+ dom.addCssClass(selected, "ace_selected");
136
+ selected.id = ariaId;
137
+ t.element.setAttribute("aria-activedescendant", ariaId);
138
+ el.setAttribute("aria-activedescendant", ariaId);
139
+ selected.setAttribute(ariaActiveState, "true");
140
+ }
141
+ });
142
+ var hideHoverMarker = function () { setHoverMarker(-1); };
143
+ var setHoverMarker = function (row, suppressRedraw) {
144
+ if (row !== hoverMarker.start.row) {
145
+ hoverMarker.start.row = hoverMarker.end.row = row;
146
+ if (!suppressRedraw)
147
+ popup.session._emit("changeBackMarker");
148
+ popup._emit("changeHoverMarker");
149
+ }
150
+ };
151
+ popup.getHoveredRow = function () {
152
+ return hoverMarker.start.row;
153
+ };
154
+ event.addListener(popup.container, "mouseout", function () {
155
+ popup.isMouseOver = false;
156
+ hideHoverMarker();
157
+ });
158
+ popup.on("hide", hideHoverMarker);
159
+ popup.on("changeSelection", hideHoverMarker);
160
+ popup.session.doc.getLength = function () {
161
+ return popup.data.length;
162
+ };
163
+ popup.session.doc.getLine = function (i) {
164
+ var data = popup.data[i];
165
+ if (typeof data == "string")
166
+ return data;
167
+ return (data && data.value) || "";
168
+ };
169
+ var bgTokenizer = popup.session.bgTokenizer;
170
+ bgTokenizer.$tokenizeRow = function (row) {
171
+ var data = popup.data[row];
172
+ var tokens = [];
173
+ if (!data)
174
+ return tokens;
175
+ if (typeof data == "string")
176
+ data = { value: data };
177
+ var caption = data.caption || data.value || data.name;
178
+ function addToken(value, className) {
179
+ value && tokens.push({
180
+ type: (data.className || "") + (className || ""),
181
+ value: value
182
+ });
183
+ }
184
+ var lower = caption.toLowerCase();
185
+ var filterText = (popup.filterText || "").toLowerCase();
186
+ var lastIndex = 0;
187
+ var lastI = 0;
188
+ for (var i = 0; i <= filterText.length; i++) {
189
+ if (i != lastI && (data.matchMask & (1 << i) || i == filterText.length)) {
190
+ var sub = filterText.slice(lastI, i);
191
+ lastI = i;
192
+ var index = lower.indexOf(sub, lastIndex);
193
+ if (index == -1)
194
+ continue;
195
+ addToken(caption.slice(lastIndex, index), "");
196
+ lastIndex = index + sub.length;
197
+ addToken(caption.slice(index, lastIndex), "completion-highlight");
198
+ }
199
+ }
200
+ addToken(caption.slice(lastIndex, caption.length), "");
201
+ tokens.push({ type: "completion-spacer", value: " " });
202
+ if (data.meta)
203
+ tokens.push({ type: "completion-meta", value: data.meta });
204
+ if (data.message)
205
+ tokens.push({ type: "completion-message", value: data.message });
206
+ return tokens;
207
+ };
208
+ bgTokenizer.$updateOnChange = noop;
209
+ bgTokenizer.start = noop;
210
+ popup.session.$computeWidth = function () {
211
+ return this.screenWidth = 0;
212
+ };
213
+ popup.isOpen = false;
214
+ popup.isTopdown = false;
215
+ popup.autoSelect = true;
216
+ popup.filterText = "";
217
+ popup.isMouseOver = false;
218
+ popup.data = [];
219
+ popup.setData = function (list, filterText) {
220
+ popup.filterText = filterText || "";
221
+ popup.setValue(lang.stringRepeat("\n", list.length), -1);
222
+ popup.data = list || [];
223
+ popup.setRow(0);
224
+ };
225
+ popup.getData = function (row) {
226
+ return popup.data[row];
227
+ };
228
+ popup.getRow = function () {
229
+ return selectionMarker.start.row;
230
+ };
231
+ popup.setRow = function (line) {
232
+ line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length - 1, line));
233
+ if (selectionMarker.start.row != line) {
234
+ popup.selection.clearSelection();
235
+ selectionMarker.start.row = selectionMarker.end.row = line || 0;
236
+ popup.session._emit("changeBackMarker");
237
+ popup.moveCursorTo(line || 0, 0);
238
+ if (popup.isOpen)
239
+ popup._signal("select");
240
+ }
241
+ };
242
+ popup.on("changeSelection", function () {
243
+ if (popup.isOpen)
244
+ popup.setRow(popup.selection.lead.row);
245
+ popup.renderer.scrollCursorIntoView();
246
+ });
247
+ popup.hide = function () {
248
+ this.container.style.display = "none";
249
+ popup.anchorPos = null;
250
+ popup.anchor = null;
251
+ if (popup.isOpen) {
252
+ popup.isOpen = false;
253
+ this._signal("hide");
254
+ }
255
+ };
256
+ popup.tryShow = function (pos, lineHeight, anchor, forceShow) {
257
+ if (!forceShow && popup.isOpen && popup.anchorPos && popup.anchor &&
258
+ popup.anchorPos.top === pos.top && popup.anchorPos.left === pos.left &&
259
+ popup.anchor === anchor) {
260
+ return true;
261
+ }
262
+ var el = this.container;
263
+ var scrollBarSize = this.renderer.scrollBar.width || 10;
264
+ var screenHeight = window.innerHeight - scrollBarSize;
265
+ var screenWidth = window.innerWidth - scrollBarSize;
266
+ var renderer = this.renderer;
267
+ var maxH = renderer.$maxLines * lineHeight * 1.4;
268
+ var dims = { top: 0, bottom: 0, left: 0 };
269
+ var spaceBelow = screenHeight - pos.top - 3 * this.$borderSize - lineHeight;
270
+ var spaceAbove = pos.top - 3 * this.$borderSize;
271
+ if (!anchor) {
272
+ if (spaceAbove <= spaceBelow || spaceBelow >= maxH) {
273
+ anchor = "bottom";
274
+ }
275
+ else {
276
+ anchor = "top";
277
+ }
278
+ }
279
+ if (anchor === "top") {
280
+ dims.bottom = pos.top - this.$borderSize;
281
+ dims.top = dims.bottom - maxH;
282
+ }
283
+ else if (anchor === "bottom") {
284
+ dims.top = pos.top + lineHeight + this.$borderSize;
285
+ dims.bottom = dims.top + maxH;
286
+ }
287
+ var fitsX = dims.top >= 0 && dims.bottom <= screenHeight;
288
+ if (!forceShow && !fitsX) {
289
+ return false;
290
+ }
291
+ if (!fitsX) {
292
+ if (anchor === "top") {
293
+ renderer.$maxPixelHeight = spaceAbove;
294
+ }
295
+ else {
296
+ renderer.$maxPixelHeight = spaceBelow;
297
+ }
298
+ }
299
+ else {
300
+ renderer.$maxPixelHeight = null;
301
+ }
302
+ if (anchor === "top") {
303
+ el.style.top = "";
304
+ el.style.bottom = (screenHeight + scrollBarSize - dims.bottom) + "px";
305
+ popup.isTopdown = false;
306
+ }
307
+ else {
308
+ el.style.top = dims.top + "px";
309
+ el.style.bottom = "";
310
+ popup.isTopdown = true;
311
+ }
312
+ el.style.display = "";
313
+ var left = pos.left;
314
+ if (left + el.offsetWidth > screenWidth)
315
+ left = screenWidth - el.offsetWidth;
316
+ el.style.left = left + "px";
317
+ el.style.right = "";
318
+ dom.$fixPositionBug(el);
319
+ if (!popup.isOpen) {
320
+ popup.isOpen = true;
321
+ this._signal("show");
322
+ lastMouseEvent = null;
323
+ }
324
+ popup.anchorPos = pos;
325
+ popup.anchor = anchor;
326
+ return true;
327
+ };
328
+ popup.show = function (pos, lineHeight, topdownOnly) {
329
+ this.tryShow(pos, lineHeight, topdownOnly ? "bottom" : undefined, true);
330
+ };
331
+ popup.goTo = function (where) {
332
+ var row = this.getRow();
333
+ var max = this.session.getLength() - 1;
334
+ switch (where) {
335
+ case "up":
336
+ row = row <= 0 ? max : row - 1;
337
+ break;
338
+ case "down":
339
+ row = row >= max ? -1 : row + 1;
340
+ break;
341
+ case "start":
342
+ row = 0;
343
+ break;
344
+ case "end":
345
+ row = max;
346
+ break;
347
+ }
348
+ this.setRow(row);
349
+ };
350
+ popup.getTextLeftOffset = function () {
351
+ return this.$borderSize + this.renderer.$padding + this.$imageSize;
352
+ };
353
+ popup.$imageSize = 0;
354
+ popup.$borderSize = 1;
355
+ return popup;
356
+ }
357
+ return AcePopup;
358
+ }());
359
+ dom.importCssString("\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #CAD6FA;\n z-index: 1;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #3a674e;\n}\n.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid #abbffe;\n margin-top: -1px;\n background: rgba(233,233,253,0.4);\n position: absolute;\n z-index: 2;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid rgba(109, 150, 13, 0.8);\n background: rgba(58, 103, 78, 0.62);\n}\n.ace_completion-meta {\n opacity: 0.5;\n margin-left: 0.9em;\n}\n.ace_completion-message {\n margin-left: 0.9em;\n color: blue;\n}\n.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #2d69c7;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #93ca12;\n}\n.ace_editor.ace_autocomplete {\n width: 300px;\n z-index: 200000;\n border: 1px lightgray solid;\n position: fixed;\n box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n line-height: 1.4;\n background: #fefefe;\n color: #111;\n}\n.ace_dark.ace_editor.ace_autocomplete {\n border: 1px #484747 solid;\n box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\n line-height: 1.4;\n background: #25282c;\n color: #c1c1c1;\n}\n.ace_autocomplete .ace_text-layer {\n width: calc(100% - 8px);\n}\n.ace_autocomplete .ace_line {\n display: flex;\n align-items: center;\n}\n.ace_autocomplete .ace_line > * {\n min-width: 0;\n flex: 0 0 auto;\n}\n.ace_autocomplete .ace_line .ace_ {\n flex: 0 1 auto;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.ace_autocomplete .ace_completion-spacer {\n flex: 1;\n}\n.ace_autocomplete.ace_loading:after {\n content: \"\";\n position: absolute;\n top: 0px;\n height: 2px;\n width: 8%;\n background: blue;\n z-index: 100;\n animation: ace_progress 3s infinite linear;\n animation-delay: 300ms;\n transform: translateX(-100%) scaleX(1);\n}\n@keyframes ace_progress {\n 0% { transform: translateX(-100%) scaleX(1) }\n 50% { transform: translateX(625%) scaleX(2) } \n 100% { transform: translateX(1500%) scaleX(3) } \n}\n@media (prefers-reduced-motion) {\n .ace_autocomplete.ace_loading:after {\n transform: translateX(625%) scaleX(2);\n animation: none;\n }\n}\n", "autocompletion.css", false);
360
+ exports.AcePopup = AcePopup;
361
+ exports.$singleLineEditor = $singleLineEditor;
362
+ exports.getAriaId = getAriaId;
363
+
364
+ });
365
+
366
+ ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"], function(require, exports, module){"use strict";
367
+ var dom = require("./lib/dom");
368
+ var oop = require("./lib/oop");
369
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
370
+ var lang = require("./lib/lang");
371
+ var Range = require("./range").Range;
372
+ var RangeList = require("./range_list").RangeList;
373
+ var HashHandler = require("./keyboard/hash_handler").HashHandler;
374
+ var Tokenizer = require("./tokenizer").Tokenizer;
375
+ var clipboard = require("./clipboard");
376
+ var VARIABLES = {
377
+ CURRENT_WORD: function (editor) {
378
+ return editor.session.getTextRange(editor.session.getWordRange());
379
+ },
380
+ SELECTION: function (editor, name, indentation) {
381
+ var text = editor.session.getTextRange();
382
+ if (indentation)
383
+ return text.replace(/\n\r?([ \t]*\S)/g, "\n" + indentation + "$1");
384
+ return text;
385
+ },
386
+ CURRENT_LINE: function (editor) {
387
+ return editor.session.getLine(editor.getCursorPosition().row);
388
+ },
389
+ PREV_LINE: function (editor) {
390
+ return editor.session.getLine(editor.getCursorPosition().row - 1);
391
+ },
392
+ LINE_INDEX: function (editor) {
393
+ return editor.getCursorPosition().row;
394
+ },
395
+ LINE_NUMBER: function (editor) {
396
+ return editor.getCursorPosition().row + 1;
397
+ },
398
+ SOFT_TABS: function (editor) {
399
+ return editor.session.getUseSoftTabs() ? "YES" : "NO";
400
+ },
401
+ TAB_SIZE: function (editor) {
402
+ return editor.session.getTabSize();
403
+ },
404
+ CLIPBOARD: function (editor) {
405
+ return clipboard.getText && clipboard.getText();
406
+ },
407
+ FILENAME: function (editor) {
408
+ return /[^/\\]*$/.exec(this.FILEPATH(editor))[0];
409
+ },
410
+ FILENAME_BASE: function (editor) {
411
+ return /[^/\\]*$/.exec(this.FILEPATH(editor))[0].replace(/\.[^.]*$/, "");
412
+ },
413
+ DIRECTORY: function (editor) {
414
+ return this.FILEPATH(editor).replace(/[^/\\]*$/, "");
415
+ },
416
+ FILEPATH: function (editor) { return "/not implemented.txt"; },
417
+ WORKSPACE_NAME: function () { return "Unknown"; },
418
+ FULLNAME: function () { return "Unknown"; },
419
+ BLOCK_COMMENT_START: function (editor) {
420
+ var mode = editor.session.$mode || {};
421
+ return mode.blockComment && mode.blockComment.start || "";
422
+ },
423
+ BLOCK_COMMENT_END: function (editor) {
424
+ var mode = editor.session.$mode || {};
425
+ return mode.blockComment && mode.blockComment.end || "";
426
+ },
427
+ LINE_COMMENT: function (editor) {
428
+ var mode = editor.session.$mode || {};
429
+ return mode.lineCommentStart || "";
430
+ },
431
+ CURRENT_YEAR: date.bind(null, { year: "numeric" }),
432
+ CURRENT_YEAR_SHORT: date.bind(null, { year: "2-digit" }),
433
+ CURRENT_MONTH: date.bind(null, { month: "numeric" }),
434
+ CURRENT_MONTH_NAME: date.bind(null, { month: "long" }),
435
+ CURRENT_MONTH_NAME_SHORT: date.bind(null, { month: "short" }),
436
+ CURRENT_DATE: date.bind(null, { day: "2-digit" }),
437
+ CURRENT_DAY_NAME: date.bind(null, { weekday: "long" }),
438
+ CURRENT_DAY_NAME_SHORT: date.bind(null, { weekday: "short" }),
439
+ CURRENT_HOUR: date.bind(null, { hour: "2-digit", hour12: false }),
440
+ CURRENT_MINUTE: date.bind(null, { minute: "2-digit" }),
441
+ CURRENT_SECOND: date.bind(null, { second: "2-digit" })
442
+ };
443
+ VARIABLES.SELECTED_TEXT = VARIABLES.SELECTION;
444
+ function date(dateFormat) {
445
+ var str = new Date().toLocaleString("en-us", dateFormat);
446
+ return str.length == 1 ? "0" + str : str;
447
+ }
448
+ var SnippetManager = /** @class */ (function () {
449
+ function SnippetManager() {
450
+ this.snippetMap = {};
451
+ this.snippetNameMap = {};
452
+ this.variables = VARIABLES;
453
+ }
454
+ SnippetManager.prototype.getTokenizer = function () {
455
+ return SnippetManager["$tokenizer"] || this.createTokenizer();
456
+ };
457
+ SnippetManager.prototype.createTokenizer = function () {
458
+ function TabstopToken(str) {
459
+ str = str.substr(1);
460
+ if (/^\d+$/.test(str))
461
+ return [{ tabstopId: parseInt(str, 10) }];
462
+ return [{ text: str }];
463
+ }
464
+ function escape(ch) {
465
+ return "(?:[^\\\\" + ch + "]|\\\\.)";
466
+ }
467
+ var formatMatcher = {
468
+ regex: "/(" + escape("/") + "+)/",
469
+ onMatch: function (val, state, stack) {
470
+ var ts = stack[0];
471
+ ts.fmtString = true;
472
+ ts.guard = val.slice(1, -1);
473
+ ts.flag = "";
474
+ return "";
475
+ },
476
+ next: "formatString"
477
+ };
478
+ SnippetManager["$tokenizer"] = new Tokenizer({
479
+ start: [
480
+ { regex: /\\./, onMatch: function (val, state, stack) {
481
+ var ch = val[1];
482
+ if (ch == "}" && stack.length) {
483
+ val = ch;
484
+ }
485
+ else if ("`$\\".indexOf(ch) != -1) {
486
+ val = ch;
487
+ }
488
+ return [val];
489
+ } },
490
+ { regex: /}/, onMatch: function (val, state, stack) {
491
+ return [stack.length ? stack.shift() : val];
492
+ } },
493
+ { regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken },
494
+ { regex: /\$\{[\dA-Z_a-z]+/, onMatch: function (str, state, stack) {
495
+ var t = TabstopToken(str.substr(1));
496
+ stack.unshift(t[0]);
497
+ return t;
498
+ }, next: "snippetVar" },
499
+ { regex: /\n/, token: "newline", merge: false }
500
+ ],
501
+ snippetVar: [
502
+ { regex: "\\|" + escape("\\|") + "*\\|", onMatch: function (val, state, stack) {
503
+ var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function (operator) {
504
+ return operator.length == 2 ? operator[1] : "\x00";
505
+ }).split("\x00").map(function (value) {
506
+ return { value: value };
507
+ });
508
+ stack[0].choices = choices;
509
+ return [choices[0]];
510
+ }, next: "start" },
511
+ formatMatcher,
512
+ { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start" }
513
+ ],
514
+ formatString: [
515
+ { regex: /:/, onMatch: function (val, state, stack) {
516
+ if (stack.length && stack[0].expectElse) {
517
+ stack[0].expectElse = false;
518
+ stack[0].ifEnd = { elseEnd: stack[0] };
519
+ return [stack[0].ifEnd];
520
+ }
521
+ return ":";
522
+ } },
523
+ { regex: /\\./, onMatch: function (val, state, stack) {
524
+ var ch = val[1];
525
+ if (ch == "}" && stack.length)
526
+ val = ch;
527
+ else if ("`$\\".indexOf(ch) != -1)
528
+ val = ch;
529
+ else if (ch == "n")
530
+ val = "\n";
531
+ else if (ch == "t")
532
+ val = "\t";
533
+ else if ("ulULE".indexOf(ch) != -1)
534
+ val = { changeCase: ch, local: ch > "a" };
535
+ return [val];
536
+ } },
537
+ { regex: "/\\w*}", onMatch: function (val, state, stack) {
538
+ var next = stack.shift();
539
+ if (next)
540
+ next.flag = val.slice(1, -1);
541
+ this.next = next && next.tabstopId ? "start" : "";
542
+ return [next || val];
543
+ }, next: "start" },
544
+ { regex: /\$(?:\d+|\w+)/, onMatch: function (val, state, stack) {
545
+ return [{ text: val.slice(1) }];
546
+ } },
547
+ { regex: /\${\w+/, onMatch: function (val, state, stack) {
548
+ var token = { text: val.slice(2) };
549
+ stack.unshift(token);
550
+ return [token];
551
+ }, next: "formatStringVar" },
552
+ { regex: /\n/, token: "newline", merge: false },
553
+ { regex: /}/, onMatch: function (val, state, stack) {
554
+ var next = stack.shift();
555
+ this.next = next && next.tabstopId ? "start" : "";
556
+ return [next || val];
557
+ }, next: "start" }
558
+ ],
559
+ formatStringVar: [
560
+ { regex: /:\/\w+}/, onMatch: function (val, state, stack) {
561
+ var ts = stack[0];
562
+ ts.formatFunction = val.slice(2, -1);
563
+ return [stack.shift()];
564
+ }, next: "formatString" },
565
+ formatMatcher,
566
+ { regex: /:[\?\-+]?/, onMatch: function (val, state, stack) {
567
+ if (val[1] == "+")
568
+ stack[0].ifEnd = stack[0];
569
+ if (val[1] == "?")
570
+ stack[0].expectElse = true;
571
+ }, next: "formatString" },
572
+ { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString" }
573
+ ]
574
+ });
575
+ return SnippetManager["$tokenizer"];
576
+ };
577
+ SnippetManager.prototype.tokenizeTmSnippet = function (str, startState) {
578
+ return this.getTokenizer().getLineTokens(str, startState).tokens.map(function (x) {
579
+ return x.value || x;
580
+ });
581
+ };
582
+ SnippetManager.prototype.getVariableValue = function (editor, name, indentation) {
583
+ if (/^\d+$/.test(name))
584
+ return (this.variables.__ || {})[name] || "";
585
+ if (/^[A-Z]\d+$/.test(name))
586
+ return (this.variables[name[0] + "__"] || {})[name.substr(1)] || "";
587
+ name = name.replace(/^TM_/, "");
588
+ if (!this.variables.hasOwnProperty(name))
589
+ return "";
590
+ var value = this.variables[name];
591
+ if (typeof value == "function")
592
+ value = this.variables[name](editor, name, indentation);
593
+ return value == null ? "" : value;
594
+ };
595
+ SnippetManager.prototype.tmStrFormat = function (str, ch, editor) {
596
+ if (!ch.fmt)
597
+ return str;
598
+ var flag = ch.flag || "";
599
+ var re = ch.guard;
600
+ re = new RegExp(re, flag.replace(/[^gim]/g, ""));
601
+ var fmtTokens = typeof ch.fmt == "string" ? this.tokenizeTmSnippet(ch.fmt, "formatString") : ch.fmt;
602
+ var _self = this;
603
+ var formatted = str.replace(re, function () {
604
+ var oldArgs = _self.variables.__;
605
+ _self.variables.__ = [].slice.call(arguments);
606
+ var fmtParts = _self.resolveVariables(fmtTokens, editor);
607
+ var gChangeCase = "E";
608
+ for (var i = 0; i < fmtParts.length; i++) {
609
+ var ch = fmtParts[i];
610
+ if (typeof ch == "object") {
611
+ fmtParts[i] = "";
612
+ if (ch.changeCase && ch.local) {
613
+ var next = fmtParts[i + 1];
614
+ if (next && typeof next == "string") {
615
+ if (ch.changeCase == "u")
616
+ fmtParts[i] = next[0].toUpperCase();
617
+ else
618
+ fmtParts[i] = next[0].toLowerCase();
619
+ fmtParts[i + 1] = next.substr(1);
620
+ }
621
+ }
622
+ else if (ch.changeCase) {
623
+ gChangeCase = ch.changeCase;
624
+ }
625
+ }
626
+ else if (gChangeCase == "U") {
627
+ fmtParts[i] = ch.toUpperCase();
628
+ }
629
+ else if (gChangeCase == "L") {
630
+ fmtParts[i] = ch.toLowerCase();
631
+ }
632
+ }
633
+ _self.variables.__ = oldArgs;
634
+ return fmtParts.join("");
635
+ });
636
+ return formatted;
637
+ };
638
+ SnippetManager.prototype.tmFormatFunction = function (str, ch, editor) {
639
+ if (ch.formatFunction == "upcase")
640
+ return str.toUpperCase();
641
+ if (ch.formatFunction == "downcase")
642
+ return str.toLowerCase();
643
+ return str;
644
+ };
645
+ SnippetManager.prototype.resolveVariables = function (snippet, editor) {
646
+ var result = [];
647
+ var indentation = "";
648
+ var afterNewLine = true;
649
+ for (var i = 0; i < snippet.length; i++) {
650
+ var ch = snippet[i];
651
+ if (typeof ch == "string") {
652
+ result.push(ch);
653
+ if (ch == "\n") {
654
+ afterNewLine = true;
655
+ indentation = "";
656
+ }
657
+ else if (afterNewLine) {
658
+ indentation = /^\t*/.exec(ch)[0];
659
+ afterNewLine = /\S/.test(ch);
660
+ }
661
+ continue;
662
+ }
663
+ if (!ch)
664
+ continue;
665
+ afterNewLine = false;
666
+ if (ch.fmtString) {
667
+ var j = snippet.indexOf(ch, i + 1);
668
+ if (j == -1)
669
+ j = snippet.length;
670
+ ch.fmt = snippet.slice(i + 1, j);
671
+ i = j;
672
+ }
673
+ if (ch.text) {
674
+ var value = this.getVariableValue(editor, ch.text, indentation) + "";
675
+ if (ch.fmtString)
676
+ value = this.tmStrFormat(value, ch, editor);
677
+ if (ch.formatFunction)
678
+ value = this.tmFormatFunction(value, ch, editor);
679
+ if (value && !ch.ifEnd) {
680
+ result.push(value);
681
+ gotoNext(ch);
682
+ }
683
+ else if (!value && ch.ifEnd) {
684
+ gotoNext(ch.ifEnd);
685
+ }
686
+ }
687
+ else if (ch.elseEnd) {
688
+ gotoNext(ch.elseEnd);
689
+ }
690
+ else if (ch.tabstopId != null) {
691
+ result.push(ch);
692
+ }
693
+ else if (ch.changeCase != null) {
694
+ result.push(ch);
695
+ }
696
+ }
697
+ function gotoNext(ch) {
698
+ var i1 = snippet.indexOf(ch, i + 1);
699
+ if (i1 != -1)
700
+ i = i1;
701
+ }
702
+ return result;
703
+ };
704
+ SnippetManager.prototype.getDisplayTextForSnippet = function (editor, snippetText) {
705
+ var processedSnippet = processSnippetText.call(this, editor, snippetText);
706
+ return processedSnippet.text;
707
+ };
708
+ SnippetManager.prototype.insertSnippetForSelection = function (editor, snippetText, options) {
709
+ if (options === void 0) { options = {}; }
710
+ var processedSnippet = processSnippetText.call(this, editor, snippetText, options);
711
+ var range = editor.getSelectionRange();
712
+ var end = editor.session.replace(range, processedSnippet.text);
713
+ var tabstopManager = new TabstopManager(editor);
714
+ var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
715
+ tabstopManager.addTabstops(processedSnippet.tabstops, range.start, end, selectionId);
716
+ };
717
+ SnippetManager.prototype.insertSnippet = function (editor, snippetText, options) {
718
+ if (options === void 0) { options = {}; }
719
+ var self = this;
720
+ if (editor.inVirtualSelectionMode)
721
+ return self.insertSnippetForSelection(editor, snippetText, options);
722
+ editor.forEachSelection(function () {
723
+ self.insertSnippetForSelection(editor, snippetText, options);
724
+ }, null, { keepOrder: true });
725
+ if (editor.tabstopManager)
726
+ editor.tabstopManager.tabNext();
727
+ };
728
+ SnippetManager.prototype.$getScope = function (editor) {
729
+ var scope = editor.session.$mode.$id || "";
730
+ scope = scope.split("/").pop();
731
+ if (scope === "html" || scope === "php") {
732
+ if (scope === "php" && !editor.session.$mode.inlinePhp)
733
+ scope = "html";
734
+ var c = editor.getCursorPosition();
735
+ var state = editor.session.getState(c.row);
736
+ if (typeof state === "object") {
737
+ state = state[0];
738
+ }
739
+ if (state.substring) {
740
+ if (state.substring(0, 3) == "js-")
741
+ scope = "javascript";
742
+ else if (state.substring(0, 4) == "css-")
743
+ scope = "css";
744
+ else if (state.substring(0, 4) == "php-")
745
+ scope = "php";
746
+ }
747
+ }
748
+ return scope;
749
+ };
750
+ SnippetManager.prototype.getActiveScopes = function (editor) {
751
+ var scope = this.$getScope(editor);
752
+ var scopes = [scope];
753
+ var snippetMap = this.snippetMap;
754
+ if (snippetMap[scope] && snippetMap[scope].includeScopes) {
755
+ scopes.push.apply(scopes, snippetMap[scope].includeScopes);
756
+ }
757
+ scopes.push("_");
758
+ return scopes;
759
+ };
760
+ SnippetManager.prototype.expandWithTab = function (editor, options) {
761
+ var self = this;
762
+ var result = editor.forEachSelection(function () {
763
+ return self.expandSnippetForSelection(editor, options);
764
+ }, null, { keepOrder: true });
765
+ if (result && editor.tabstopManager)
766
+ editor.tabstopManager.tabNext();
767
+ return result;
768
+ };
769
+ SnippetManager.prototype.expandSnippetForSelection = function (editor, options) {
770
+ var cursor = editor.getCursorPosition();
771
+ var line = editor.session.getLine(cursor.row);
772
+ var before = line.substring(0, cursor.column);
773
+ var after = line.substr(cursor.column);
774
+ var snippetMap = this.snippetMap;
775
+ var snippet;
776
+ this.getActiveScopes(editor).some(function (scope) {
777
+ var snippets = snippetMap[scope];
778
+ if (snippets)
779
+ snippet = this.findMatchingSnippet(snippets, before, after);
780
+ return !!snippet;
781
+ }, this);
782
+ if (!snippet)
783
+ return false;
784
+ if (options && options.dryRun)
785
+ return true;
786
+ editor.session.doc.removeInLine(cursor.row, cursor.column - snippet.replaceBefore.length, cursor.column + snippet.replaceAfter.length);
787
+ this.variables.M__ = snippet.matchBefore;
788
+ this.variables.T__ = snippet.matchAfter;
789
+ this.insertSnippetForSelection(editor, snippet.content);
790
+ this.variables.M__ = this.variables.T__ = null;
791
+ return true;
792
+ };
793
+ SnippetManager.prototype.findMatchingSnippet = function (snippetList, before, after) {
794
+ for (var i = snippetList.length; i--;) {
795
+ var s = snippetList[i];
796
+ if (s.startRe && !s.startRe.test(before))
797
+ continue;
798
+ if (s.endRe && !s.endRe.test(after))
799
+ continue;
800
+ if (!s.startRe && !s.endRe)
801
+ continue;
802
+ s.matchBefore = s.startRe ? s.startRe.exec(before) : [""];
803
+ s.matchAfter = s.endRe ? s.endRe.exec(after) : [""];
804
+ s.replaceBefore = s.triggerRe ? s.triggerRe.exec(before)[0] : "";
805
+ s.replaceAfter = s.endTriggerRe ? s.endTriggerRe.exec(after)[0] : "";
806
+ return s;
807
+ }
808
+ };
809
+ SnippetManager.prototype.register = function (snippets, scope) {
810
+ var snippetMap = this.snippetMap;
811
+ var snippetNameMap = this.snippetNameMap;
812
+ var self = this;
813
+ if (!snippets)
814
+ snippets = [];
815
+ function wrapRegexp(src) {
816
+ if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
817
+ src = "(?:" + src + ")";
818
+ return src || "";
819
+ }
820
+ function guardedRegexp(re, guard, opening) {
821
+ re = wrapRegexp(re);
822
+ guard = wrapRegexp(guard);
823
+ if (opening) {
824
+ re = guard + re;
825
+ if (re && re[re.length - 1] != "$")
826
+ re = re + "$";
827
+ }
828
+ else {
829
+ re = re + guard;
830
+ if (re && re[0] != "^")
831
+ re = "^" + re;
832
+ }
833
+ return new RegExp(re);
834
+ }
835
+ function addSnippet(s) {
836
+ if (!s.scope)
837
+ s.scope = scope || "_";
838
+ scope = s.scope;
839
+ if (!snippetMap[scope]) {
840
+ snippetMap[scope] = [];
841
+ snippetNameMap[scope] = {};
842
+ }
843
+ var map = snippetNameMap[scope];
844
+ if (s.name) {
845
+ var old = map[s.name];
846
+ if (old)
847
+ self.unregister(old);
848
+ map[s.name] = s;
849
+ }
850
+ snippetMap[scope].push(s);
851
+ if (s.prefix)
852
+ s.tabTrigger = s.prefix;
853
+ if (!s.content && s.body)
854
+ s.content = Array.isArray(s.body) ? s.body.join("\n") : s.body;
855
+ if (s.tabTrigger && !s.trigger) {
856
+ if (!s.guard && /^\w/.test(s.tabTrigger))
857
+ s.guard = "\\b";
858
+ s.trigger = lang.escapeRegExp(s.tabTrigger);
859
+ }
860
+ if (!s.trigger && !s.guard && !s.endTrigger && !s.endGuard)
861
+ return;
862
+ s.startRe = guardedRegexp(s.trigger, s.guard, true);
863
+ s.triggerRe = new RegExp(s.trigger);
864
+ s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
865
+ s.endTriggerRe = new RegExp(s.endTrigger);
866
+ }
867
+ if (Array.isArray(snippets)) {
868
+ snippets.forEach(addSnippet);
869
+ }
870
+ else {
871
+ Object.keys(snippets).forEach(function (key) {
872
+ addSnippet(snippets[key]);
873
+ });
874
+ }
875
+ this._signal("registerSnippets", { scope: scope });
876
+ };
877
+ SnippetManager.prototype.unregister = function (snippets, scope) {
878
+ var snippetMap = this.snippetMap;
879
+ var snippetNameMap = this.snippetNameMap;
880
+ function removeSnippet(s) {
881
+ var nameMap = snippetNameMap[s.scope || scope];
882
+ if (nameMap && nameMap[s.name]) {
883
+ delete nameMap[s.name];
884
+ var map = snippetMap[s.scope || scope];
885
+ var i = map && map.indexOf(s);
886
+ if (i >= 0)
887
+ map.splice(i, 1);
888
+ }
889
+ }
890
+ if (snippets.content)
891
+ removeSnippet(snippets);
892
+ else if (Array.isArray(snippets))
893
+ snippets.forEach(removeSnippet);
894
+ };
895
+ SnippetManager.prototype.parseSnippetFile = function (str) {
896
+ str = str.replace(/\r/g, "");
897
+ var list = [], /**@type{Snippet}*/ snippet = {};
898
+ var re = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
899
+ var m;
900
+ while (m = re.exec(str)) {
901
+ if (m[1]) {
902
+ try {
903
+ snippet = JSON.parse(m[1]);
904
+ list.push(snippet);
905
+ }
906
+ catch (e) { }
907
+ }
908
+ if (m[4]) {
909
+ snippet.content = m[4].replace(/^\t/gm, "");
910
+ list.push(snippet);
911
+ snippet = {};
912
+ }
913
+ else {
914
+ var key = m[2], val = m[3];
915
+ if (key == "regex") {
916
+ var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
917
+ snippet.guard = guardRe.exec(val)[1];
918
+ snippet.trigger = guardRe.exec(val)[1];
919
+ snippet.endTrigger = guardRe.exec(val)[1];
920
+ snippet.endGuard = guardRe.exec(val)[1];
921
+ }
922
+ else if (key == "snippet") {
923
+ snippet.tabTrigger = val.match(/^\S*/)[0];
924
+ if (!snippet.name)
925
+ snippet.name = val;
926
+ }
927
+ else if (key) {
928
+ snippet[key] = val;
929
+ }
930
+ }
931
+ }
932
+ return list;
933
+ };
934
+ SnippetManager.prototype.getSnippetByName = function (name, editor) {
935
+ var snippetMap = this.snippetNameMap;
936
+ var snippet;
937
+ this.getActiveScopes(editor).some(function (scope) {
938
+ var snippets = snippetMap[scope];
939
+ if (snippets)
940
+ snippet = snippets[name];
941
+ return !!snippet;
942
+ }, this);
943
+ return snippet;
944
+ };
945
+ return SnippetManager;
946
+ }());
947
+ oop.implement(SnippetManager.prototype, EventEmitter);
948
+ var processSnippetText = function (editor, snippetText, options) {
949
+ if (options === void 0) { options = {}; }
950
+ var cursor = editor.getCursorPosition();
951
+ var line = editor.session.getLine(cursor.row);
952
+ var tabString = editor.session.getTabString();
953
+ var indentString = line.match(/^\s*/)[0];
954
+ if (cursor.column < indentString.length)
955
+ indentString = indentString.slice(0, cursor.column);
956
+ snippetText = snippetText.replace(/\r/g, "");
957
+ var tokens = this.tokenizeTmSnippet(snippetText);
958
+ tokens = this.resolveVariables(tokens, editor);
959
+ tokens = tokens.map(function (x) {
960
+ if (x == "\n" && !options.excludeExtraIndent)
961
+ return x + indentString;
962
+ if (typeof x == "string")
963
+ return x.replace(/\t/g, tabString);
964
+ return x;
965
+ });
966
+ var tabstops = [];
967
+ tokens.forEach(function (p, i) {
968
+ if (typeof p != "object")
969
+ return;
970
+ var id = p.tabstopId;
971
+ var ts = tabstops[id];
972
+ if (!ts) {
973
+ ts = tabstops[id] = [];
974
+ ts.index = id;
975
+ ts.value = "";
976
+ ts.parents = {};
977
+ }
978
+ if (ts.indexOf(p) !== -1)
979
+ return;
980
+ if (p.choices && !ts.choices)
981
+ ts.choices = p.choices;
982
+ ts.push(p);
983
+ var i1 = tokens.indexOf(p, i + 1);
984
+ if (i1 === -1)
985
+ return;
986
+ var value = tokens.slice(i + 1, i1);
987
+ var isNested = value.some(function (t) { return typeof t === "object"; });
988
+ if (isNested && !ts.value) {
989
+ ts.value = value;
990
+ }
991
+ else if (value.length && (!ts.value || typeof ts.value !== "string")) {
992
+ ts.value = value.join("");
993
+ }
994
+ });
995
+ tabstops.forEach(function (ts) { ts.length = 0; });
996
+ var expanding = {};
997
+ function copyValue(val) {
998
+ var copy = [];
999
+ for (var i = 0; i < val.length; i++) {
1000
+ var p = val[i];
1001
+ if (typeof p == "object") {
1002
+ if (expanding[p.tabstopId])
1003
+ continue;
1004
+ var j = val.lastIndexOf(p, i - 1);
1005
+ p = copy[j] || { tabstopId: p.tabstopId };
1006
+ }
1007
+ copy[i] = p;
1008
+ }
1009
+ return copy;
1010
+ }
1011
+ for (var i = 0; i < tokens.length; i++) {
1012
+ var p = tokens[i];
1013
+ if (typeof p != "object")
1014
+ continue;
1015
+ var id = p.tabstopId;
1016
+ var ts = tabstops[id];
1017
+ var i1 = tokens.indexOf(p, i + 1);
1018
+ if (expanding[id]) {
1019
+ if (expanding[id] === p) {
1020
+ delete expanding[id];
1021
+ Object.keys(expanding).forEach(function (parentId) {
1022
+ ts.parents[parentId] = true;
1023
+ });
1024
+ }
1025
+ continue;
1026
+ }
1027
+ expanding[id] = p;
1028
+ var value = ts.value;
1029
+ if (typeof value !== "string")
1030
+ value = copyValue(value);
1031
+ else if (p.fmt)
1032
+ value = this.tmStrFormat(value, p, editor);
1033
+ tokens.splice.apply(tokens, [i + 1, Math.max(0, i1 - i)].concat(value, p));
1034
+ if (ts.indexOf(p) === -1)
1035
+ ts.push(p);
1036
+ }
1037
+ var row = 0, column = 0;
1038
+ var text = "";
1039
+ tokens.forEach(function (t) {
1040
+ if (typeof t === "string") {
1041
+ var lines = t.split("\n");
1042
+ if (lines.length > 1) {
1043
+ column = lines[lines.length - 1].length;
1044
+ row += lines.length - 1;
1045
+ }
1046
+ else
1047
+ column += t.length;
1048
+ text += t;
1049
+ }
1050
+ else if (t) {
1051
+ if (!t.start)
1052
+ t.start = { row: row, column: column };
1053
+ else
1054
+ t.end = { row: row, column: column };
1055
+ }
1056
+ });
1057
+ return {
1058
+ text: text,
1059
+ tabstops: tabstops,
1060
+ tokens: tokens
1061
+ };
1062
+ };
1063
+ var TabstopManager = /** @class */ (function () {
1064
+ function TabstopManager(editor) {
1065
+ this.index = 0;
1066
+ this.ranges = [];
1067
+ this.tabstops = [];
1068
+ if (editor.tabstopManager)
1069
+ return editor.tabstopManager;
1070
+ editor.tabstopManager = this;
1071
+ this.$onChange = this.onChange.bind(this);
1072
+ this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
1073
+ this.$onChangeSession = this.onChangeSession.bind(this);
1074
+ this.$onAfterExec = this.onAfterExec.bind(this);
1075
+ this.attach(editor);
1076
+ }
1077
+ TabstopManager.prototype.attach = function (editor) {
1078
+ this.$openTabstops = null;
1079
+ this.selectedTabstop = null;
1080
+ this.editor = editor;
1081
+ this.session = editor.session;
1082
+ this.editor.on("change", this.$onChange);
1083
+ this.editor.on("changeSelection", this.$onChangeSelection);
1084
+ this.editor.on("changeSession", this.$onChangeSession);
1085
+ this.editor.commands.on("afterExec", this.$onAfterExec);
1086
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
1087
+ };
1088
+ TabstopManager.prototype.detach = function () {
1089
+ this.tabstops.forEach(this.removeTabstopMarkers, this);
1090
+ this.ranges.length = 0;
1091
+ this.tabstops.length = 0;
1092
+ this.selectedTabstop = null;
1093
+ this.editor.off("change", this.$onChange);
1094
+ this.editor.off("changeSelection", this.$onChangeSelection);
1095
+ this.editor.off("changeSession", this.$onChangeSession);
1096
+ this.editor.commands.off("afterExec", this.$onAfterExec);
1097
+ this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
1098
+ this.editor.tabstopManager = null;
1099
+ this.session = null;
1100
+ this.editor = null;
1101
+ };
1102
+ TabstopManager.prototype.onChange = function (delta) {
1103
+ var isRemove = delta.action[0] == "r";
1104
+ var selectedTabstop = this.selectedTabstop || {};
1105
+ var parents = selectedTabstop.parents || {};
1106
+ var tabstops = this.tabstops.slice();
1107
+ for (var i = 0; i < tabstops.length; i++) {
1108
+ var ts = tabstops[i];
1109
+ var active = ts == selectedTabstop || parents[ts.index];
1110
+ ts.rangeList.$bias = active ? 0 : 1;
1111
+ if (delta.action == "remove" && ts !== selectedTabstop) {
1112
+ var parentActive = ts.parents && ts.parents[selectedTabstop.index];
1113
+ var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
1114
+ startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
1115
+ var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
1116
+ endIndex = endIndex < 0 ? -endIndex - 1 : endIndex - 1;
1117
+ var toRemove = ts.rangeList.ranges.slice(startIndex, endIndex);
1118
+ for (var j = 0; j < toRemove.length; j++)
1119
+ this.removeRange(toRemove[j]);
1120
+ }
1121
+ ts.rangeList.$onChange(delta);
1122
+ }
1123
+ var session = this.session;
1124
+ if (!this.$inChange && isRemove && session.getLength() == 1 && !session.getValue())
1125
+ this.detach();
1126
+ };
1127
+ TabstopManager.prototype.updateLinkedFields = function () {
1128
+ var ts = this.selectedTabstop;
1129
+ if (!ts || !ts.hasLinkedRanges || !ts.firstNonLinked)
1130
+ return;
1131
+ this.$inChange = true;
1132
+ var session = this.session;
1133
+ var text = session.getTextRange(ts.firstNonLinked);
1134
+ for (var i = 0; i < ts.length; i++) {
1135
+ var range = ts[i];
1136
+ if (!range.linked)
1137
+ continue;
1138
+ var original = range.original;
1139
+ var fmt = exports.snippetManager.tmStrFormat(text, original, this.editor);
1140
+ session.replace(range, fmt);
1141
+ }
1142
+ this.$inChange = false;
1143
+ };
1144
+ TabstopManager.prototype.onAfterExec = function (e) {
1145
+ if (e.command && !e.command.readOnly)
1146
+ this.updateLinkedFields();
1147
+ };
1148
+ TabstopManager.prototype.onChangeSelection = function () {
1149
+ if (!this.editor)
1150
+ return;
1151
+ var lead = this.editor.selection.lead;
1152
+ var anchor = this.editor.selection.anchor;
1153
+ var isEmpty = this.editor.selection.isEmpty();
1154
+ for (var i = 0; i < this.ranges.length; i++) {
1155
+ if (this.ranges[i].linked)
1156
+ continue;
1157
+ var containsLead = this.ranges[i].contains(lead.row, lead.column);
1158
+ var containsAnchor = isEmpty || this.ranges[i].contains(anchor.row, anchor.column);
1159
+ if (containsLead && containsAnchor)
1160
+ return;
1161
+ }
1162
+ this.detach();
1163
+ };
1164
+ TabstopManager.prototype.onChangeSession = function () {
1165
+ this.detach();
1166
+ };
1167
+ TabstopManager.prototype.tabNext = function (dir) {
1168
+ var max = this.tabstops.length;
1169
+ var index = this.index + (dir || 1);
1170
+ index = Math.min(Math.max(index, 1), max);
1171
+ if (index == max)
1172
+ index = 0;
1173
+ this.selectTabstop(index);
1174
+ this.updateTabstopMarkers();
1175
+ if (index === 0) {
1176
+ this.detach();
1177
+ }
1178
+ };
1179
+ TabstopManager.prototype.selectTabstop = function (index) {
1180
+ this.$openTabstops = null;
1181
+ var ts = this.tabstops[this.index];
1182
+ if (ts)
1183
+ this.addTabstopMarkers(ts);
1184
+ this.index = index;
1185
+ ts = this.tabstops[this.index];
1186
+ if (!ts || !ts.length)
1187
+ return;
1188
+ this.selectedTabstop = ts;
1189
+ var range = ts.firstNonLinked || ts;
1190
+ if (ts.choices)
1191
+ range.cursor = range.start;
1192
+ if (!this.editor.inVirtualSelectionMode) {
1193
+ var sel = this.editor.multiSelect;
1194
+ sel.toSingleRange(range);
1195
+ for (var i = 0; i < ts.length; i++) {
1196
+ if (ts.hasLinkedRanges && ts[i].linked)
1197
+ continue;
1198
+ sel.addRange(ts[i].clone(), true);
1199
+ }
1200
+ }
1201
+ else {
1202
+ this.editor.selection.fromOrientedRange(range);
1203
+ }
1204
+ this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
1205
+ if (this.selectedTabstop && this.selectedTabstop.choices)
1206
+ this.editor.execCommand("startAutocomplete", { matches: this.selectedTabstop.choices });
1207
+ };
1208
+ TabstopManager.prototype.addTabstops = function (tabstops, start, end) {
1209
+ var useLink = this.useLink || !this.editor.getOption("enableMultiselect");
1210
+ if (!this.$openTabstops)
1211
+ this.$openTabstops = [];
1212
+ if (!tabstops[0]) {
1213
+ var p = Range.fromPoints(end, end);
1214
+ moveRelative(p.start, start);
1215
+ moveRelative(p.end, start);
1216
+ tabstops[0] = [p];
1217
+ tabstops[0].index = 0;
1218
+ }
1219
+ var i = this.index;
1220
+ var arg = [i + 1, 0];
1221
+ var ranges = this.ranges;
1222
+ var snippetId = this.snippetId = (this.snippetId || 0) + 1;
1223
+ tabstops.forEach(function (ts, index) {
1224
+ var dest = this.$openTabstops[index] || ts;
1225
+ dest.snippetId = snippetId;
1226
+ for (var i = 0; i < ts.length; i++) {
1227
+ var p = ts[i];
1228
+ var range = Range.fromPoints(p.start, p.end || p.start);
1229
+ movePoint(range.start, start);
1230
+ movePoint(range.end, start);
1231
+ range.original = p;
1232
+ range.tabstop = dest;
1233
+ ranges.push(range);
1234
+ if (dest != ts)
1235
+ dest.unshift(range);
1236
+ else
1237
+ dest[i] = range;
1238
+ if (p.fmtString || (dest.firstNonLinked && useLink)) {
1239
+ range.linked = true;
1240
+ dest.hasLinkedRanges = true;
1241
+ }
1242
+ else if (!dest.firstNonLinked)
1243
+ dest.firstNonLinked = range;
1244
+ }
1245
+ if (!dest.firstNonLinked)
1246
+ dest.hasLinkedRanges = false;
1247
+ if (dest === ts) {
1248
+ arg.push(dest);
1249
+ this.$openTabstops[index] = dest;
1250
+ }
1251
+ this.addTabstopMarkers(dest);
1252
+ dest.rangeList = dest.rangeList || new RangeList();
1253
+ dest.rangeList.$bias = 0;
1254
+ dest.rangeList.addList(dest);
1255
+ }, this);
1256
+ if (arg.length > 2) {
1257
+ if (this.tabstops.length)
1258
+ arg.push(arg.splice(2, 1)[0]);
1259
+ this.tabstops.splice.apply(this.tabstops, arg);
1260
+ }
1261
+ };
1262
+ TabstopManager.prototype.addTabstopMarkers = function (ts) {
1263
+ var session = this.session;
1264
+ ts.forEach(function (range) {
1265
+ if (!range.markerId)
1266
+ range.markerId = session.addMarker(range, "ace_snippet-marker", "text");
1267
+ });
1268
+ };
1269
+ TabstopManager.prototype.removeTabstopMarkers = function (ts) {
1270
+ var session = this.session;
1271
+ ts.forEach(function (range) {
1272
+ session.removeMarker(range.markerId);
1273
+ range.markerId = null;
1274
+ });
1275
+ };
1276
+ TabstopManager.prototype.updateTabstopMarkers = function () {
1277
+ if (!this.selectedTabstop)
1278
+ return;
1279
+ var currentSnippetId = this.selectedTabstop.snippetId;
1280
+ if (this.selectedTabstop.index === 0) {
1281
+ currentSnippetId--;
1282
+ }
1283
+ this.tabstops.forEach(function (ts) {
1284
+ if (ts.snippetId === currentSnippetId)
1285
+ this.addTabstopMarkers(ts);
1286
+ else
1287
+ this.removeTabstopMarkers(ts);
1288
+ }, this);
1289
+ };
1290
+ TabstopManager.prototype.removeRange = function (range) {
1291
+ var i = range.tabstop.indexOf(range);
1292
+ if (i != -1)
1293
+ range.tabstop.splice(i, 1);
1294
+ i = this.ranges.indexOf(range);
1295
+ if (i != -1)
1296
+ this.ranges.splice(i, 1);
1297
+ i = range.tabstop.rangeList.ranges.indexOf(range);
1298
+ if (i != -1)
1299
+ range.tabstop.splice(i, 1);
1300
+ this.session.removeMarker(range.markerId);
1301
+ if (!range.tabstop.length) {
1302
+ i = this.tabstops.indexOf(range.tabstop);
1303
+ if (i != -1)
1304
+ this.tabstops.splice(i, 1);
1305
+ if (!this.tabstops.length)
1306
+ this.detach();
1307
+ }
1308
+ };
1309
+ return TabstopManager;
1310
+ }());
1311
+ TabstopManager.prototype.keyboardHandler = new HashHandler();
1312
+ TabstopManager.prototype.keyboardHandler.bindKeys({
1313
+ "Tab": function (editor) {
1314
+ if (exports.snippetManager && exports.snippetManager.expandWithTab(editor))
1315
+ return;
1316
+ editor.tabstopManager.tabNext(1);
1317
+ editor.renderer.scrollCursorIntoView();
1318
+ },
1319
+ "Shift-Tab": function (editor) {
1320
+ editor.tabstopManager.tabNext(-1);
1321
+ editor.renderer.scrollCursorIntoView();
1322
+ },
1323
+ "Esc": function (editor) {
1324
+ editor.tabstopManager.detach();
1325
+ }
1326
+ });
1327
+ var movePoint = function (point, diff) {
1328
+ if (point.row == 0)
1329
+ point.column += diff.column;
1330
+ point.row += diff.row;
1331
+ };
1332
+ var moveRelative = function (point, start) {
1333
+ if (point.row == start.row)
1334
+ point.column -= start.column;
1335
+ point.row -= start.row;
1336
+ };
1337
+ dom.importCssString("\n.ace_snippet-marker {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n background: rgba(194, 193, 208, 0.09);\n border: 1px dotted rgba(211, 208, 235, 0.62);\n position: absolute;\n}", "snippets.css", false);
1338
+ exports.snippetManager = new SnippetManager();
1339
+ var Editor = require("./editor").Editor;
1340
+ (function () {
1341
+ this.insertSnippet = function (content, options) {
1342
+ return exports.snippetManager.insertSnippet(this, content, options);
1343
+ };
1344
+ this.expandSnippet = function (options) {
1345
+ return exports.snippetManager.expandWithTab(this, options);
1346
+ };
1347
+ }).call(Editor.prototype);
1348
+
1349
+ });
1350
+
1351
+ ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"], function(require, exports, module){"use strict";
1352
+ var AceInlineScreenReader = /** @class */ (function () {
1353
+ function AceInlineScreenReader(editor) {
1354
+ this.editor = editor;
1355
+ this.screenReaderDiv = document.createElement("div");
1356
+ this.screenReaderDiv.classList.add("ace_screenreader-only");
1357
+ this.editor.container.appendChild(this.screenReaderDiv);
1358
+ }
1359
+ AceInlineScreenReader.prototype.setScreenReaderContent = function (content) {
1360
+ if (!this.popup && this.editor.completer && /**@type{import("../autocomplete").Autocomplete}*/ (this.editor.completer).popup) {
1361
+ this.popup = /**@type{import("../autocomplete").Autocomplete}*/ (this.editor.completer).popup;
1362
+ this.popup.renderer.on("afterRender", function () {
1363
+ var row = this.popup.getRow();
1364
+ var t = this.popup.renderer.$textLayer;
1365
+ var selected = t.element.childNodes[row - t.config.firstRow];
1366
+ if (selected) {
1367
+ var idString = "doc-tooltip ";
1368
+ for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
1369
+ idString += "ace-inline-screenreader-line-".concat(lineIndex, " ");
1370
+ }
1371
+ selected.setAttribute("aria-describedby", idString);
1372
+ }
1373
+ }.bind(this));
1374
+ }
1375
+ while (this.screenReaderDiv.firstChild) {
1376
+ this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);
1377
+ }
1378
+ this._lines = content.split(/\r\n|\r|\n/);
1379
+ var codeElement = this.createCodeBlock();
1380
+ this.screenReaderDiv.appendChild(codeElement);
1381
+ };
1382
+ AceInlineScreenReader.prototype.destroy = function () {
1383
+ this.screenReaderDiv.remove();
1384
+ };
1385
+ AceInlineScreenReader.prototype.createCodeBlock = function () {
1386
+ var container = document.createElement("pre");
1387
+ container.setAttribute("id", "ace-inline-screenreader");
1388
+ for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
1389
+ var codeElement = document.createElement("code");
1390
+ codeElement.setAttribute("id", "ace-inline-screenreader-line-".concat(lineIndex));
1391
+ var line = document.createTextNode(this._lines[lineIndex]);
1392
+ codeElement.appendChild(line);
1393
+ container.appendChild(codeElement);
1394
+ }
1395
+ return container;
1396
+ };
1397
+ return AceInlineScreenReader;
1398
+ }());
1399
+ exports.AceInlineScreenReader = AceInlineScreenReader;
1400
+
1401
+ });
1402
+
1403
+ ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"], function(require, exports, module){"use strict";
1404
+ var snippetManager = require("../snippets").snippetManager;
1405
+ var AceInlineScreenReader = require("./inline_screenreader").AceInlineScreenReader;
1406
+ var AceInline = /** @class */ (function () {
1407
+ function AceInline() {
1408
+ this.editor = null;
1409
+ }
1410
+ AceInline.prototype.show = function (editor, completion, prefix) {
1411
+ prefix = prefix || "";
1412
+ if (editor && this.editor && this.editor !== editor) {
1413
+ this.hide();
1414
+ this.editor = null;
1415
+ this.inlineScreenReader = null;
1416
+ }
1417
+ if (!editor || !completion) {
1418
+ return false;
1419
+ }
1420
+ if (!this.inlineScreenReader) {
1421
+ this.inlineScreenReader = new AceInlineScreenReader(editor);
1422
+ }
1423
+ var displayText = completion.snippet ? snippetManager.getDisplayTextForSnippet(editor, completion.snippet) : completion.value;
1424
+ if (completion.hideInlinePreview || !displayText || !displayText.startsWith(prefix)) {
1425
+ return false;
1426
+ }
1427
+ this.editor = editor;
1428
+ this.inlineScreenReader.setScreenReaderContent(displayText);
1429
+ displayText = displayText.slice(prefix.length);
1430
+ if (displayText === "") {
1431
+ editor.removeGhostText();
1432
+ }
1433
+ else {
1434
+ editor.setGhostText(displayText);
1435
+ }
1436
+ return true;
1437
+ };
1438
+ AceInline.prototype.isOpen = function () {
1439
+ if (!this.editor) {
1440
+ return false;
1441
+ }
1442
+ return !!this.editor.renderer.$ghostText;
1443
+ };
1444
+ AceInline.prototype.hide = function () {
1445
+ if (!this.editor) {
1446
+ return false;
1447
+ }
1448
+ this.editor.removeGhostText();
1449
+ return true;
1450
+ };
1451
+ AceInline.prototype.destroy = function () {
1452
+ this.hide();
1453
+ this.editor = null;
1454
+ if (this.inlineScreenReader) {
1455
+ this.inlineScreenReader.destroy();
1456
+ this.inlineScreenReader = null;
1457
+ }
1458
+ };
1459
+ return AceInline;
1460
+ }());
1461
+ exports.AceInline = AceInline;
1462
+
1463
+ });
1464
+
1465
+ ace.define("ace/autocomplete/util",["require","exports","module"], function(require, exports, module){"use strict";
1466
+ exports.parForEach = function (array, fn, callback) {
1467
+ var completed = 0;
1468
+ var arLength = array.length;
1469
+ if (arLength === 0)
1470
+ callback();
1471
+ for (var i = 0; i < arLength; i++) {
1472
+ fn(array[i], function (result, err) {
1473
+ completed++;
1474
+ if (completed === arLength)
1475
+ callback(result, err);
1476
+ });
1477
+ }
1478
+ };
1479
+ var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
1480
+ exports.retrievePrecedingIdentifier = function (text, pos, regex) {
1481
+ regex = regex || ID_REGEX;
1482
+ var buf = [];
1483
+ for (var i = pos - 1; i >= 0; i--) {
1484
+ if (regex.test(text[i]))
1485
+ buf.push(text[i]);
1486
+ else
1487
+ break;
1488
+ }
1489
+ return buf.reverse().join("");
1490
+ };
1491
+ exports.retrieveFollowingIdentifier = function (text, pos, regex) {
1492
+ regex = regex || ID_REGEX;
1493
+ var buf = [];
1494
+ for (var i = pos; i < text.length; i++) {
1495
+ if (regex.test(text[i]))
1496
+ buf.push(text[i]);
1497
+ else
1498
+ break;
1499
+ }
1500
+ return buf;
1501
+ };
1502
+ exports.getCompletionPrefix = function (editor) {
1503
+ var pos = editor.getCursorPosition();
1504
+ var line = editor.session.getLine(pos.row);
1505
+ var prefix;
1506
+ editor.completers.forEach(function (completer) {
1507
+ if (completer.identifierRegexps) {
1508
+ completer.identifierRegexps.forEach(function (identifierRegex) {
1509
+ if (!prefix && identifierRegex)
1510
+ prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
1511
+ }.bind(this));
1512
+ }
1513
+ }.bind(this));
1514
+ return prefix || this.retrievePrecedingIdentifier(line, pos.column);
1515
+ };
1516
+ exports.triggerAutocomplete = function (editor, previousChar) {
1517
+ var previousChar = previousChar == null
1518
+ ? editor.session.getPrecedingCharacter()
1519
+ : previousChar;
1520
+ return editor.completers.some(function (completer) {
1521
+ if (completer.triggerCharacters && Array.isArray(completer.triggerCharacters)) {
1522
+ return completer.triggerCharacters.includes(previousChar);
1523
+ }
1524
+ });
1525
+ };
1526
+
1527
+ });
1528
+
1529
+ ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/inline","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config","ace/lib/event","ace/lib/scroll"], function(require, exports, module){"use strict";
1530
+ var HashHandler = require("./keyboard/hash_handler").HashHandler;
1531
+ var AcePopup = require("./autocomplete/popup").AcePopup;
1532
+ var AceInline = require("./autocomplete/inline").AceInline;
1533
+ var getAriaId = require("./autocomplete/popup").getAriaId;
1534
+ var util = require("./autocomplete/util");
1535
+ var lang = require("./lib/lang");
1536
+ var dom = require("./lib/dom");
1537
+ var snippetManager = require("./snippets").snippetManager;
1538
+ var config = require("./config");
1539
+ var event = require("./lib/event");
1540
+ var preventParentScroll = require("./lib/scroll").preventParentScroll;
1541
+ var destroyCompleter = function (e, editor) {
1542
+ editor.completer && editor.completer.destroy();
1543
+ };
1544
+ var Autocomplete = /** @class */ (function () {
1545
+ function Autocomplete() {
1546
+ this.autoInsert = false;
1547
+ this.autoSelect = true;
1548
+ this.autoShown = false;
1549
+ this.exactMatch = false;
1550
+ this.inlineEnabled = false;
1551
+ this.keyboardHandler = new HashHandler();
1552
+ this.keyboardHandler.bindKeys(this.commands);
1553
+ this.parentNode = null;
1554
+ this.setSelectOnHover = false;
1555
+ this.hasSeen = new Set();
1556
+ this.showLoadingState = false;
1557
+ this.stickySelectionDelay = 500;
1558
+ this.blurListener = this.blurListener.bind(this);
1559
+ this.changeListener = this.changeListener.bind(this);
1560
+ this.mousedownListener = this.mousedownListener.bind(this);
1561
+ this.mousewheelListener = this.mousewheelListener.bind(this);
1562
+ this.onLayoutChange = this.onLayoutChange.bind(this);
1563
+ this.changeTimer = lang.delayedCall(function () {
1564
+ this.updateCompletions(true);
1565
+ }.bind(this));
1566
+ this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
1567
+ this.popupTimer = lang.delayedCall(this.$updatePopupPosition.bind(this), 50);
1568
+ this.stickySelectionTimer = lang.delayedCall(function () {
1569
+ this.stickySelection = true;
1570
+ }.bind(this), this.stickySelectionDelay);
1571
+ this.$firstOpenTimer = lang.delayedCall(/**@this{Autocomplete}*/ function () {
1572
+ var initialPosition = this.completionProvider && this.completionProvider.initialPosition;
1573
+ if (this.autoShown || (this.popup && this.popup.isOpen) || !initialPosition || this.editor.completers.length === 0)
1574
+ return;
1575
+ this.completions = new FilteredList(Autocomplete.completionsForLoading);
1576
+ this.openPopup(this.editor, initialPosition.prefix, false);
1577
+ this.popup.renderer.setStyle("ace_loading", true);
1578
+ }.bind(this), this.stickySelectionDelay);
1579
+ }
1580
+ Object.defineProperty(Autocomplete, "completionsForLoading", {
1581
+ get: function () {
1582
+ return [{
1583
+ caption: config.nls("autocomplete.loading", "Loading..."),
1584
+ value: ""
1585
+ }];
1586
+ },
1587
+ enumerable: false,
1588
+ configurable: true
1589
+ });
1590
+ Autocomplete.prototype.$init = function () {
1591
+ this.popup = new AcePopup(this.parentNode || document.body || document.documentElement);
1592
+ this.popup.on("click", function (e) {
1593
+ this.insertMatch();
1594
+ e.stop();
1595
+ }.bind(this));
1596
+ this.popup.focus = this.editor.focus.bind(this.editor);
1597
+ this.popup.on("show", this.$onPopupShow.bind(this));
1598
+ this.popup.on("hide", this.$onHidePopup.bind(this));
1599
+ this.popup.on("select", this.$onPopupChange.bind(this));
1600
+ event.addListener(this.popup.container, "mouseout", this.mouseOutListener.bind(this));
1601
+ this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
1602
+ this.popup.renderer.on("afterRender", this.$onPopupRender.bind(this));
1603
+ return this.popup;
1604
+ };
1605
+ Autocomplete.prototype.$initInline = function () {
1606
+ if (!this.inlineEnabled || this.inlineRenderer)
1607
+ return;
1608
+ this.inlineRenderer = new AceInline();
1609
+ return this.inlineRenderer;
1610
+ };
1611
+ Autocomplete.prototype.getPopup = function () {
1612
+ return this.popup || this.$init();
1613
+ };
1614
+ Autocomplete.prototype.$onHidePopup = function () {
1615
+ if (this.inlineRenderer) {
1616
+ this.inlineRenderer.hide();
1617
+ }
1618
+ this.hideDocTooltip();
1619
+ this.stickySelectionTimer.cancel();
1620
+ this.popupTimer.cancel();
1621
+ this.stickySelection = false;
1622
+ };
1623
+ Autocomplete.prototype.$seen = function (completion) {
1624
+ if (!this.hasSeen.has(completion) && completion && completion.completer && completion.completer.onSeen && typeof completion.completer.onSeen === "function") {
1625
+ completion.completer.onSeen(this.editor, completion);
1626
+ this.hasSeen.add(completion);
1627
+ }
1628
+ };
1629
+ Autocomplete.prototype.$onPopupChange = function (hide) {
1630
+ if (this.inlineRenderer && this.inlineEnabled) {
1631
+ var completion = hide ? null : this.popup.getData(this.popup.getRow());
1632
+ this.$updateGhostText(completion);
1633
+ if (this.popup.isMouseOver && this.setSelectOnHover) {
1634
+ this.tooltipTimer.call(null, null);
1635
+ return;
1636
+ }
1637
+ this.popupTimer.schedule();
1638
+ this.tooltipTimer.schedule();
1639
+ }
1640
+ else {
1641
+ this.popupTimer.call(null, null);
1642
+ this.tooltipTimer.call(null, null);
1643
+ }
1644
+ };
1645
+ Autocomplete.prototype.$updateGhostText = function (completion) {
1646
+ var row = this.base.row;
1647
+ var column = this.base.column;
1648
+ var cursorColumn = this.editor.getCursorPosition().column;
1649
+ var prefix = this.editor.session.getLine(row).slice(column, cursorColumn);
1650
+ if (!this.inlineRenderer.show(this.editor, completion, prefix)) {
1651
+ this.inlineRenderer.hide();
1652
+ }
1653
+ else {
1654
+ this.$seen(completion);
1655
+ }
1656
+ };
1657
+ Autocomplete.prototype.$onPopupRender = function () {
1658
+ var inlineEnabled = this.inlineRenderer && this.inlineEnabled;
1659
+ if (this.completions && this.completions.filtered && this.completions.filtered.length > 0) {
1660
+ for (var i = this.popup.getFirstVisibleRow(); i <= this.popup.getLastVisibleRow(); i++) {
1661
+ var completion = this.popup.getData(i);
1662
+ if (completion && (!inlineEnabled || completion.hideInlinePreview)) {
1663
+ this.$seen(completion);
1664
+ }
1665
+ }
1666
+ }
1667
+ };
1668
+ Autocomplete.prototype.$onPopupShow = function (hide) {
1669
+ this.$onPopupChange(hide);
1670
+ this.stickySelection = false;
1671
+ if (this.stickySelectionDelay >= 0)
1672
+ this.stickySelectionTimer.schedule(this.stickySelectionDelay);
1673
+ };
1674
+ Autocomplete.prototype.observeLayoutChanges = function () {
1675
+ if (this.$elements || !this.editor)
1676
+ return;
1677
+ window.addEventListener("resize", this.onLayoutChange, { passive: true });
1678
+ window.addEventListener("wheel", this.mousewheelListener);
1679
+ var el = this.editor.container.parentNode;
1680
+ var elements = [];
1681
+ while (el) {
1682
+ elements.push(el);
1683
+ el.addEventListener("scroll", this.onLayoutChange, { passive: true });
1684
+ el = el.parentNode;
1685
+ }
1686
+ this.$elements = elements;
1687
+ };
1688
+ Autocomplete.prototype.unObserveLayoutChanges = function () {
1689
+ var _this = this;
1690
+ window.removeEventListener("resize", this.onLayoutChange, { passive: true });
1691
+ window.removeEventListener("wheel", this.mousewheelListener);
1692
+ this.$elements && this.$elements.forEach(function (el) {
1693
+ el.removeEventListener("scroll", _this.onLayoutChange, { passive: true });
1694
+ });
1695
+ this.$elements = null;
1696
+ };
1697
+ Autocomplete.prototype.onLayoutChange = function () {
1698
+ if (!this.popup.isOpen)
1699
+ return this.unObserveLayoutChanges();
1700
+ this.$updatePopupPosition();
1701
+ this.updateDocTooltip();
1702
+ };
1703
+ Autocomplete.prototype.$updatePopupPosition = function () {
1704
+ var editor = this.editor;
1705
+ var renderer = editor.renderer;
1706
+ var lineHeight = renderer.layerConfig.lineHeight;
1707
+ var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
1708
+ pos.left -= this.popup.getTextLeftOffset();
1709
+ var rect = editor.container.getBoundingClientRect();
1710
+ pos.top += rect.top - renderer.layerConfig.offset;
1711
+ pos.left += rect.left - editor.renderer.scrollLeft;
1712
+ pos.left += renderer.gutterWidth;
1713
+ var posGhostText = {
1714
+ top: pos.top,
1715
+ left: pos.left
1716
+ };
1717
+ if (renderer.$ghostText && renderer.$ghostTextWidget) {
1718
+ if (this.base.row === renderer.$ghostText.position.row) {
1719
+ posGhostText.top += renderer.$ghostTextWidget.el.offsetHeight;
1720
+ }
1721
+ }
1722
+ var editorContainerBottom = editor.container.getBoundingClientRect().bottom - lineHeight;
1723
+ var lowestPosition = editorContainerBottom < posGhostText.top ?
1724
+ { top: editorContainerBottom, left: posGhostText.left } :
1725
+ posGhostText;
1726
+ if (this.popup.tryShow(lowestPosition, lineHeight, "bottom")) {
1727
+ return;
1728
+ }
1729
+ if (this.popup.tryShow(pos, lineHeight, "top")) {
1730
+ return;
1731
+ }
1732
+ this.popup.show(pos, lineHeight);
1733
+ };
1734
+ Autocomplete.prototype.openPopup = function (editor, prefix, keepPopupPosition) {
1735
+ this.$firstOpenTimer.cancel();
1736
+ if (!this.popup)
1737
+ this.$init();
1738
+ if (this.inlineEnabled && !this.inlineRenderer)
1739
+ this.$initInline();
1740
+ this.popup.autoSelect = this.autoSelect;
1741
+ this.popup.setSelectOnHover(this.setSelectOnHover);
1742
+ var oldRow = this.popup.getRow();
1743
+ var previousSelectedItem = this.popup.data[oldRow];
1744
+ this.popup.setData(this.completions.filtered, this.completions.filterText);
1745
+ if (this.editor.textInput.setAriaOptions) {
1746
+ this.editor.textInput.setAriaOptions({
1747
+ activeDescendant: getAriaId(this.popup.getRow()),
1748
+ inline: this.inlineEnabled
1749
+ });
1750
+ }
1751
+ editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
1752
+ var newRow;
1753
+ if (this.stickySelection)
1754
+ newRow = this.popup.data.indexOf(previousSelectedItem);
1755
+ if (!newRow || newRow === -1)
1756
+ newRow = 0;
1757
+ this.popup.setRow(this.autoSelect ? newRow : -1);
1758
+ if (newRow === oldRow && previousSelectedItem !== this.completions.filtered[newRow])
1759
+ this.$onPopupChange();
1760
+ var inlineEnabled = this.inlineRenderer && this.inlineEnabled;
1761
+ if (newRow === oldRow && inlineEnabled) {
1762
+ var completion = this.popup.getData(this.popup.getRow());
1763
+ this.$updateGhostText(completion);
1764
+ }
1765
+ if (!keepPopupPosition) {
1766
+ this.popup.setTheme(editor.getTheme());
1767
+ this.popup.setFontSize(editor.getFontSize());
1768
+ this.$updatePopupPosition();
1769
+ if (this.tooltipNode) {
1770
+ this.updateDocTooltip();
1771
+ }
1772
+ }
1773
+ this.changeTimer.cancel();
1774
+ this.observeLayoutChanges();
1775
+ };
1776
+ Autocomplete.prototype.detach = function () {
1777
+ if (this.editor) {
1778
+ this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
1779
+ this.editor.off("changeSelection", this.changeListener);
1780
+ this.editor.off("blur", this.blurListener);
1781
+ this.editor.off("mousedown", this.mousedownListener);
1782
+ this.editor.off("mousewheel", this.mousewheelListener);
1783
+ }
1784
+ this.$firstOpenTimer.cancel();
1785
+ this.changeTimer.cancel();
1786
+ this.hideDocTooltip();
1787
+ if (this.completionProvider) {
1788
+ this.completionProvider.detach();
1789
+ }
1790
+ if (this.popup && this.popup.isOpen)
1791
+ this.popup.hide();
1792
+ if (this.popup && this.popup.renderer) {
1793
+ this.popup.renderer.off("afterRender", this.$onPopupRender);
1794
+ }
1795
+ if (this.base)
1796
+ this.base.detach();
1797
+ this.activated = false;
1798
+ this.completionProvider = this.completions = this.base = null;
1799
+ this.unObserveLayoutChanges();
1800
+ };
1801
+ Autocomplete.prototype.changeListener = function (e) {
1802
+ var cursor = this.editor.selection.lead;
1803
+ if (cursor.row != this.base.row || cursor.column < this.base.column) {
1804
+ this.detach();
1805
+ }
1806
+ if (this.activated)
1807
+ this.changeTimer.schedule();
1808
+ else
1809
+ this.detach();
1810
+ };
1811
+ Autocomplete.prototype.blurListener = function (e) {
1812
+ var el = document.activeElement;
1813
+ var text = this.editor.textInput.getElement();
1814
+ var fromTooltip = e.relatedTarget && this.tooltipNode && this.tooltipNode.contains(e.relatedTarget);
1815
+ var container = this.popup && this.popup.container;
1816
+ if (el != text && el.parentNode != container && !fromTooltip
1817
+ && el != this.tooltipNode && e.relatedTarget != text) {
1818
+ this.detach();
1819
+ }
1820
+ };
1821
+ Autocomplete.prototype.mousedownListener = function (e) {
1822
+ this.detach();
1823
+ };
1824
+ Autocomplete.prototype.mousewheelListener = function (e) {
1825
+ if (this.popup && !this.popup.isMouseOver)
1826
+ this.detach();
1827
+ };
1828
+ Autocomplete.prototype.mouseOutListener = function (e) {
1829
+ if (this.popup.isOpen)
1830
+ this.$updatePopupPosition();
1831
+ };
1832
+ Autocomplete.prototype.goTo = function (where) {
1833
+ this.popup.goTo(where);
1834
+ };
1835
+ Autocomplete.prototype.insertMatch = function (data, options) {
1836
+ if (!data)
1837
+ data = this.popup.getData(this.popup.getRow());
1838
+ if (!data)
1839
+ return false;
1840
+ if (data.value === "") // Explicitly given nothing to insert, e.g. "No suggestion state"
1841
+ return this.detach();
1842
+ var completions = this.completions;
1843
+ var result = this.getCompletionProvider().insertMatch(this.editor, data, completions.filterText, options);
1844
+ if (this.completions == completions)
1845
+ this.detach();
1846
+ return result;
1847
+ };
1848
+ Autocomplete.prototype.showPopup = function (editor, options) {
1849
+ if (this.editor)
1850
+ this.detach();
1851
+ this.activated = true;
1852
+ this.editor = editor;
1853
+ if (editor.completer != this) {
1854
+ if (editor.completer)
1855
+ editor.completer.detach();
1856
+ editor.completer = this;
1857
+ }
1858
+ editor.on("changeSelection", this.changeListener);
1859
+ editor.on("blur", this.blurListener);
1860
+ editor.on("mousedown", this.mousedownListener);
1861
+ editor.on("mousewheel", this.mousewheelListener);
1862
+ this.updateCompletions(false, options);
1863
+ };
1864
+ Autocomplete.prototype.getCompletionProvider = function (initialPosition) {
1865
+ if (!this.completionProvider)
1866
+ this.completionProvider = new CompletionProvider(initialPosition);
1867
+ return this.completionProvider;
1868
+ };
1869
+ Autocomplete.prototype.gatherCompletions = function (editor, callback) {
1870
+ return this.getCompletionProvider().gatherCompletions(editor, callback);
1871
+ };
1872
+ Autocomplete.prototype.updateCompletions = function (keepPopupPosition, options) {
1873
+ if (keepPopupPosition && this.base && this.completions) {
1874
+ var pos = this.editor.getCursorPosition();
1875
+ var prefix = this.editor.session.getTextRange({ start: this.base, end: pos });
1876
+ if (prefix == this.completions.filterText)
1877
+ return;
1878
+ this.completions.setFilter(prefix);
1879
+ if (!this.completions.filtered.length)
1880
+ return this.detach();
1881
+ if (this.completions.filtered.length == 1
1882
+ && this.completions.filtered[0].value == prefix
1883
+ && !this.completions.filtered[0].snippet)
1884
+ return this.detach();
1885
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1886
+ return;
1887
+ }
1888
+ if (options && options.matches) {
1889
+ var pos = this.editor.getSelectionRange().start;
1890
+ this.base = this.editor.session.doc.createAnchor(pos.row, pos.column);
1891
+ this.base.$insertRight = true;
1892
+ this.completions = new FilteredList(options.matches);
1893
+ this.getCompletionProvider().completions = this.completions;
1894
+ return this.openPopup(this.editor, "", keepPopupPosition);
1895
+ }
1896
+ var session = this.editor.getSession();
1897
+ var pos = this.editor.getCursorPosition();
1898
+ var prefix = util.getCompletionPrefix(this.editor);
1899
+ this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
1900
+ this.base.$insertRight = true;
1901
+ var completionOptions = {
1902
+ exactMatch: this.exactMatch,
1903
+ ignoreCaption: this.ignoreCaption
1904
+ };
1905
+ this.getCompletionProvider({
1906
+ prefix: prefix,
1907
+ pos: pos
1908
+ }).provideCompletions(this.editor, completionOptions,
1909
+ function (err, completions, finished) {
1910
+ var filtered = completions.filtered;
1911
+ var prefix = util.getCompletionPrefix(this.editor);
1912
+ this.$firstOpenTimer.cancel();
1913
+ if (finished) {
1914
+ if (!filtered.length) {
1915
+ var emptyMessage = !this.autoShown && this.emptyMessage;
1916
+ if (typeof emptyMessage == "function")
1917
+ emptyMessage = this.emptyMessage(prefix);
1918
+ if (emptyMessage) {
1919
+ var completionsForEmpty = [{
1920
+ caption: emptyMessage,
1921
+ value: ""
1922
+ }
1923
+ ];
1924
+ this.completions = new FilteredList(completionsForEmpty);
1925
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1926
+ this.popup.renderer.setStyle("ace_loading", false);
1927
+ this.popup.renderer.setStyle("ace_empty-message", true);
1928
+ return;
1929
+ }
1930
+ return this.detach();
1931
+ }
1932
+ if (filtered.length == 1 && filtered[0].value == prefix
1933
+ && !filtered[0].snippet)
1934
+ return this.detach();
1935
+ if (this.autoInsert && !this.autoShown && filtered.length == 1)
1936
+ return this.insertMatch(filtered[0]);
1937
+ }
1938
+ this.completions = !finished && this.showLoadingState ?
1939
+ new FilteredList(Autocomplete.completionsForLoading.concat(filtered), completions.filterText) :
1940
+ completions;
1941
+ this.openPopup(this.editor, prefix, keepPopupPosition);
1942
+ this.popup.renderer.setStyle("ace_empty-message", false);
1943
+ this.popup.renderer.setStyle("ace_loading", !finished);
1944
+ }.bind(this));
1945
+ if (this.showLoadingState && !this.autoShown && !(this.popup && this.popup.isOpen)) {
1946
+ this.$firstOpenTimer.delay(this.stickySelectionDelay / 2);
1947
+ }
1948
+ };
1949
+ Autocomplete.prototype.cancelContextMenu = function () {
1950
+ this.editor.$mouseHandler.cancelContextMenu();
1951
+ };
1952
+ Autocomplete.prototype.updateDocTooltip = function () {
1953
+ var popup = this.popup;
1954
+ var all = this.completions && this.completions.filtered;
1955
+ var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]);
1956
+ var doc = null;
1957
+ if (!selected || !this.editor || !this.popup.isOpen)
1958
+ return this.hideDocTooltip();
1959
+ var completersLength = this.editor.completers.length;
1960
+ for (var i = 0; i < completersLength; i++) {
1961
+ var completer = this.editor.completers[i];
1962
+ if (completer.getDocTooltip && selected.completerId === completer.id) {
1963
+ doc = completer.getDocTooltip(selected);
1964
+ break;
1965
+ }
1966
+ }
1967
+ if (!doc && typeof selected != "string")
1968
+ doc = selected;
1969
+ if (typeof doc == "string")
1970
+ doc = { docText: doc };
1971
+ if (!doc || !(doc.docHTML || doc.docText))
1972
+ return this.hideDocTooltip();
1973
+ this.showDocTooltip(doc);
1974
+ };
1975
+ Autocomplete.prototype.showDocTooltip = function (item) {
1976
+ if (!this.tooltipNode) {
1977
+ this.tooltipNode = dom.createElement("div");
1978
+ this.tooltipNode.style.margin = "0";
1979
+ this.tooltipNode.style.pointerEvents = "auto";
1980
+ this.tooltipNode.style.overscrollBehavior = "contain";
1981
+ this.tooltipNode.tabIndex = -1;
1982
+ this.tooltipNode.onblur = this.blurListener.bind(this);
1983
+ this.tooltipNode.onclick = this.onTooltipClick.bind(this);
1984
+ this.tooltipNode.id = "doc-tooltip";
1985
+ this.tooltipNode.setAttribute("role", "tooltip");
1986
+ this.tooltipNode.addEventListener("wheel", preventParentScroll);
1987
+ }
1988
+ var theme = this.editor.renderer.theme;
1989
+ this.tooltipNode.className = "ace_tooltip ace_doc-tooltip " +
1990
+ (theme.isDark ? "ace_dark " : "") + (theme.cssClass || "");
1991
+ var tooltipNode = this.tooltipNode;
1992
+ if (item.docHTML) {
1993
+ tooltipNode.innerHTML = item.docHTML;
1994
+ }
1995
+ else if (item.docText) {
1996
+ tooltipNode.textContent = item.docText;
1997
+ }
1998
+ if (!tooltipNode.parentNode)
1999
+ this.popup.container.appendChild(this.tooltipNode);
2000
+ var popup = this.popup;
2001
+ var rect = popup.container.getBoundingClientRect();
2002
+ var targetWidth = 400;
2003
+ var targetHeight = 300;
2004
+ var scrollBarSize = popup.renderer.scrollBar.width || 10;
2005
+ var leftSize = rect.left;
2006
+ var rightSize = window.innerWidth - rect.right - scrollBarSize;
2007
+ var topSize = popup.isTopdown ? window.innerHeight - scrollBarSize - rect.bottom : rect.top;
2008
+ var scores = [
2009
+ Math.min(rightSize / targetWidth, 1),
2010
+ Math.min(leftSize / targetWidth, 1),
2011
+ Math.min(topSize / targetHeight, 1) * 0.9,
2012
+ ];
2013
+ var max = Math.max.apply(Math, scores);
2014
+ var tooltipStyle = tooltipNode.style;
2015
+ tooltipStyle.display = "block";
2016
+ if (max == scores[0] || scores[0] >= 1) {
2017
+ tooltipStyle.left = (rect.right + 1) + "px";
2018
+ tooltipStyle.right = "";
2019
+ tooltipStyle.maxWidth = targetWidth * max + "px";
2020
+ tooltipStyle.top = rect.top + "px";
2021
+ tooltipStyle.bottom = "";
2022
+ tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.top, targetHeight) + "px";
2023
+ }
2024
+ else if (max == scores[1] || scores[1] >= 1) {
2025
+ tooltipStyle.right = window.innerWidth - rect.left + "px";
2026
+ tooltipStyle.left = "";
2027
+ tooltipStyle.maxWidth = targetWidth * max + "px";
2028
+ tooltipStyle.top = rect.top + "px";
2029
+ tooltipStyle.bottom = "";
2030
+ tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.top, targetHeight) + "px";
2031
+ }
2032
+ else if (max == scores[2]) {
2033
+ tooltipStyle.left = rect.left + "px";
2034
+ tooltipStyle.right = "";
2035
+ tooltipStyle.maxWidth = Math.min(targetWidth, window.innerWidth - rect.left) + "px";
2036
+ if (popup.isTopdown) {
2037
+ tooltipStyle.top = rect.bottom + "px";
2038
+ tooltipStyle.bottom = "";
2039
+ tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.bottom, targetHeight) + "px";
2040
+ }
2041
+ else {
2042
+ tooltipStyle.top = "";
2043
+ tooltipStyle.bottom = (window.innerHeight - rect.top) + "px";
2044
+ tooltipStyle.maxHeight = Math.min(rect.top, targetHeight) + "px";
2045
+ }
2046
+ }
2047
+ dom.$fixPositionBug(tooltipNode);
2048
+ };
2049
+ Autocomplete.prototype.hideDocTooltip = function () {
2050
+ this.tooltipTimer.cancel();
2051
+ if (!this.tooltipNode)
2052
+ return;
2053
+ var el = this.tooltipNode;
2054
+ if (!this.editor.isFocused() && document.activeElement == el)
2055
+ this.editor.focus();
2056
+ this.tooltipNode = null;
2057
+ if (el.parentNode)
2058
+ el.parentNode.removeChild(el);
2059
+ };
2060
+ Autocomplete.prototype.onTooltipClick = function (e) {
2061
+ var a = e.target;
2062
+ while (a && a != this.tooltipNode) {
2063
+ if (a.nodeName == "A" && a.href) {
2064
+ a.rel = "noreferrer";
2065
+ a.target = "_blank";
2066
+ break;
2067
+ }
2068
+ a = a.parentNode;
2069
+ }
2070
+ };
2071
+ Autocomplete.prototype.destroy = function () {
2072
+ this.detach();
2073
+ if (this.popup) {
2074
+ this.popup.destroy();
2075
+ var el = this.popup.container;
2076
+ if (el && el.parentNode)
2077
+ el.parentNode.removeChild(el);
2078
+ }
2079
+ if (this.editor && this.editor.completer == this) {
2080
+ this.editor.off("destroy", destroyCompleter);
2081
+ this.editor.completer = null;
2082
+ }
2083
+ this.inlineRenderer = this.popup = this.editor = null;
2084
+ };
2085
+ Autocomplete.for = function (editor) {
2086
+ if (editor.completer instanceof Autocomplete) {
2087
+ return editor.completer;
2088
+ }
2089
+ if (editor.completer) {
2090
+ editor.completer.destroy();
2091
+ editor.completer = null;
2092
+ }
2093
+ if (config.get("sharedPopups")) {
2094
+ if (!Autocomplete["$sharedInstance"])
2095
+ Autocomplete["$sharedInstance"] = new Autocomplete();
2096
+ editor.completer = Autocomplete["$sharedInstance"];
2097
+ }
2098
+ else {
2099
+ editor.completer = new Autocomplete();
2100
+ editor.once("destroy", destroyCompleter);
2101
+ }
2102
+ return editor.completer;
2103
+ };
2104
+ return Autocomplete;
2105
+ }());
2106
+ Autocomplete.prototype.commands = {
2107
+ "Up": function (editor) { editor.completer.goTo("up"); },
2108
+ "Down": function (editor) { editor.completer.goTo("down"); },
2109
+ "Ctrl-Up|Ctrl-Home": function (editor) { editor.completer.goTo("start"); },
2110
+ "Ctrl-Down|Ctrl-End": function (editor) { editor.completer.goTo("end"); },
2111
+ "Esc": function (editor) { editor.completer.detach(); },
2112
+ "Return": function (editor) { return editor.completer.insertMatch(); },
2113
+ "Shift-Return": function (editor) { editor.completer.insertMatch(null, { deleteSuffix: true }); },
2114
+ "Tab": function (editor) {
2115
+ var result = editor.completer.insertMatch();
2116
+ if (!result && !editor.tabstopManager)
2117
+ editor.completer.goTo("down");
2118
+ else
2119
+ return result;
2120
+ },
2121
+ "Backspace": function (editor) {
2122
+ editor.execCommand("backspace");
2123
+ var prefix = util.getCompletionPrefix(editor);
2124
+ if (!prefix && editor.completer)
2125
+ editor.completer.detach();
2126
+ },
2127
+ "PageUp": function (editor) { editor.completer.popup.gotoPageUp(); },
2128
+ "PageDown": function (editor) { editor.completer.popup.gotoPageDown(); }
2129
+ };
2130
+ Autocomplete.startCommand = {
2131
+ name: "startAutocomplete",
2132
+ exec: function (editor, options) {
2133
+ var completer = Autocomplete.for(editor);
2134
+ completer.autoInsert = false;
2135
+ completer.autoSelect = true;
2136
+ completer.autoShown = false;
2137
+ completer.showPopup(editor, options);
2138
+ completer.cancelContextMenu();
2139
+ },
2140
+ bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
2141
+ };
2142
+ var CompletionProvider = /** @class */ (function () {
2143
+ function CompletionProvider(initialPosition) {
2144
+ this.initialPosition = initialPosition;
2145
+ this.active = true;
2146
+ }
2147
+ CompletionProvider.prototype.insertByIndex = function (editor, index, options) {
2148
+ if (!this.completions || !this.completions.filtered) {
2149
+ return false;
2150
+ }
2151
+ return this.insertMatch(editor, this.completions.filtered[index], options);
2152
+ };
2153
+ CompletionProvider.prototype.insertMatch = function (editor, data, options) {
2154
+ if (!data)
2155
+ return false;
2156
+ editor.startOperation({ command: { name: "insertMatch" } });
2157
+ if (data.completer && data.completer.insertMatch) {
2158
+ data.completer.insertMatch(editor, data);
2159
+ }
2160
+ else {
2161
+ if (!this.completions)
2162
+ return false;
2163
+ var replaceBefore = this.completions.filterText.length;
2164
+ var replaceAfter = 0;
2165
+ if (data.range && data.range.start.row === data.range.end.row) {
2166
+ replaceBefore -= this.initialPosition.prefix.length;
2167
+ replaceBefore += this.initialPosition.pos.column - data.range.start.column;
2168
+ replaceAfter += data.range.end.column - this.initialPosition.pos.column;
2169
+ }
2170
+ if (replaceBefore || replaceAfter) {
2171
+ var ranges;
2172
+ if (editor.selection.getAllRanges) {
2173
+ ranges = editor.selection.getAllRanges();
2174
+ }
2175
+ else {
2176
+ ranges = [editor.getSelectionRange()];
2177
+ }
2178
+ for (var i = 0, range; range = ranges[i]; i++) {
2179
+ range.start.column -= replaceBefore;
2180
+ range.end.column += replaceAfter;
2181
+ editor.session.remove(range);
2182
+ }
2183
+ }
2184
+ if (data.snippet) {
2185
+ snippetManager.insertSnippet(editor, data.snippet);
2186
+ }
2187
+ else {
2188
+ this.$insertString(editor, data);
2189
+ }
2190
+ if (data.completer && data.completer.onInsert && typeof data.completer.onInsert == "function") {
2191
+ data.completer.onInsert(editor, data);
2192
+ }
2193
+ if (data.command && data.command === "startAutocomplete") {
2194
+ editor.execCommand(data.command);
2195
+ }
2196
+ }
2197
+ editor.endOperation();
2198
+ return true;
2199
+ };
2200
+ CompletionProvider.prototype.$insertString = function (editor, data) {
2201
+ var text = data.value || data;
2202
+ editor.execCommand("insertstring", text);
2203
+ };
2204
+ CompletionProvider.prototype.gatherCompletions = function (editor, callback) {
2205
+ var session = editor.getSession();
2206
+ var pos = editor.getCursorPosition();
2207
+ var prefix = util.getCompletionPrefix(editor);
2208
+ var matches = [];
2209
+ this.completers = editor.completers;
2210
+ var total = editor.completers.length;
2211
+ editor.completers.forEach(function (completer, i) {
2212
+ completer.getCompletions(editor, session, pos, prefix, function (err, results) {
2213
+ if (completer.hideInlinePreview)
2214
+ results = results.map(function (result) {
2215
+ return Object.assign(result, { hideInlinePreview: completer.hideInlinePreview });
2216
+ });
2217
+ if (!err && results)
2218
+ matches = matches.concat(results);
2219
+ callback(null, {
2220
+ prefix: util.getCompletionPrefix(editor),
2221
+ matches: matches,
2222
+ finished: (--total === 0)
2223
+ });
2224
+ });
2225
+ });
2226
+ return true;
2227
+ };
2228
+ CompletionProvider.prototype.provideCompletions = function (editor, options, callback) {
2229
+ var processResults = function (results) {
2230
+ var prefix = results.prefix;
2231
+ var matches = results.matches;
2232
+ this.completions = new FilteredList(matches);
2233
+ if (options.exactMatch)
2234
+ this.completions.exactMatch = true;
2235
+ if (options.ignoreCaption)
2236
+ this.completions.ignoreCaption = true;
2237
+ this.completions.setFilter(prefix);
2238
+ if (results.finished || this.completions.filtered.length)
2239
+ callback(null, this.completions, results.finished);
2240
+ }.bind(this);
2241
+ var isImmediate = true;
2242
+ var immediateResults = null;
2243
+ this.gatherCompletions(editor, function (err, results) {
2244
+ if (!this.active) {
2245
+ return;
2246
+ }
2247
+ if (err) {
2248
+ callback(err, [], true);
2249
+ this.detach();
2250
+ }
2251
+ var prefix = results.prefix;
2252
+ if (prefix.indexOf(results.prefix) !== 0)
2253
+ return;
2254
+ if (isImmediate) {
2255
+ immediateResults = results;
2256
+ return;
2257
+ }
2258
+ processResults(results);
2259
+ }.bind(this));
2260
+ isImmediate = false;
2261
+ if (immediateResults) {
2262
+ var results = immediateResults;
2263
+ immediateResults = null;
2264
+ processResults(results);
2265
+ }
2266
+ };
2267
+ CompletionProvider.prototype.detach = function () {
2268
+ this.active = false;
2269
+ this.completers && this.completers.forEach(function (completer) {
2270
+ if (typeof completer.cancel === "function") {
2271
+ completer.cancel();
2272
+ }
2273
+ });
2274
+ };
2275
+ return CompletionProvider;
2276
+ }());
2277
+ var FilteredList = /** @class */ (function () {
2278
+ function FilteredList(array, filterText) {
2279
+ this.all = array;
2280
+ this.filtered = array;
2281
+ this.filterText = filterText || "";
2282
+ this.exactMatch = false;
2283
+ this.ignoreCaption = false;
2284
+ }
2285
+ FilteredList.prototype.setFilter = function (str) {
2286
+ if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
2287
+ var matches = this.filtered;
2288
+ else
2289
+ var matches = this.all;
2290
+ this.filterText = str;
2291
+ matches = this.filterCompletions(matches, this.filterText);
2292
+ matches = matches.sort(function (a, b) {
2293
+ return b.exactMatch - a.exactMatch || b.$score - a.$score
2294
+ || (a.caption || a.value).localeCompare(b.caption || b.value);
2295
+ });
2296
+ var prev = null;
2297
+ matches = matches.filter(function (item) {
2298
+ var caption = item.snippet || item.caption || item.value;
2299
+ if (caption === prev)
2300
+ return false;
2301
+ prev = caption;
2302
+ return true;
2303
+ });
2304
+ this.filtered = matches;
2305
+ };
2306
+ FilteredList.prototype.filterCompletions = function (items, needle) {
2307
+ var results = [];
2308
+ var upper = needle.toUpperCase();
2309
+ var lower = needle.toLowerCase();
2310
+ loop: for (var i = 0, item; item = items[i]; i++) {
2311
+ if (item.skipFilter) {
2312
+ item.$score = item.score;
2313
+ results.push(item);
2314
+ continue;
2315
+ }
2316
+ var caption = (!this.ignoreCaption && item.caption) || item.value || item.snippet;
2317
+ if (!caption)
2318
+ continue;
2319
+ var lastIndex = -1;
2320
+ var matchMask = 0;
2321
+ var penalty = 0;
2322
+ var index, distance;
2323
+ if (this.exactMatch) {
2324
+ if (needle !== caption.substr(0, needle.length))
2325
+ continue loop;
2326
+ }
2327
+ else {
2328
+ var fullMatchIndex = caption.toLowerCase().indexOf(lower);
2329
+ if (fullMatchIndex > -1) {
2330
+ penalty = fullMatchIndex;
2331
+ }
2332
+ else {
2333
+ for (var j = 0; j < needle.length; j++) {
2334
+ var i1 = caption.indexOf(lower[j], lastIndex + 1);
2335
+ var i2 = caption.indexOf(upper[j], lastIndex + 1);
2336
+ index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
2337
+ if (index < 0)
2338
+ continue loop;
2339
+ distance = index - lastIndex - 1;
2340
+ if (distance > 0) {
2341
+ if (lastIndex === -1)
2342
+ penalty += 10;
2343
+ penalty += distance;
2344
+ matchMask = matchMask | (1 << j);
2345
+ }
2346
+ lastIndex = index;
2347
+ }
2348
+ }
2349
+ }
2350
+ item.matchMask = matchMask;
2351
+ item.exactMatch = penalty ? 0 : 1;
2352
+ item.$score = (item.score || 0) - penalty;
2353
+ results.push(item);
2354
+ }
2355
+ return results;
2356
+ };
2357
+ return FilteredList;
2358
+ }());
2359
+ exports.Autocomplete = Autocomplete;
2360
+ exports.CompletionProvider = CompletionProvider;
2361
+ exports.FilteredList = FilteredList;
2362
+
2363
+ });
2364
+
2365
+ ace.define("ace/ext/menu_tools/settings_menu.css",["require","exports","module"], function(require, exports, module){module.exports = "#ace_settingsmenu, #kbshortcutmenu {\n background-color: #F7F7F7;\n color: black;\n box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\n padding: 1em 0.5em 2em 1em;\n overflow: auto;\n position: absolute;\n margin: 0;\n bottom: 0;\n right: 0;\n top: 0;\n z-index: 9991;\n cursor: default;\n}\n\n.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\n box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\n background-color: rgba(255, 255, 255, 0.6);\n color: black;\n}\n\n.ace_optionsMenuEntry:hover {\n background-color: rgba(100, 100, 100, 0.1);\n transition: all 0.3s\n}\n\n.ace_closeButton {\n background: rgba(245, 146, 146, 0.5);\n border: 1px solid #F48A8A;\n border-radius: 50%;\n padding: 7px;\n position: absolute;\n right: -8px;\n top: -8px;\n z-index: 100000;\n}\n.ace_closeButton{\n background: rgba(245, 146, 146, 0.9);\n}\n.ace_optionsMenuKey {\n color: darkslateblue;\n font-weight: bold;\n}\n.ace_optionsMenuCommand {\n color: darkcyan;\n font-weight: normal;\n}\n.ace_optionsMenuEntry input, .ace_optionsMenuEntry button {\n vertical-align: middle;\n}\n\n.ace_optionsMenuEntry button[ace_selected_button=true] {\n background: #e7e7e7;\n box-shadow: 1px 0px 2px 0px #adadad inset;\n border-color: #adadad;\n}\n.ace_optionsMenuEntry button {\n background: white;\n border: 1px solid lightgray;\n margin: 0px;\n}\n.ace_optionsMenuEntry button:hover{\n background: #f0f0f0;\n}";
2366
+
2367
+ });
2368
+
2369
+ ace.define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/ext/menu_tools/overlay_page","ace/lib/dom","ace/ext/menu_tools/settings_menu.css"], function(require, exports, module){/**
2370
+ * ## Overlay Page utility
2371
+ *
2372
+ * Provides modal overlay functionality for displaying editor extension interfaces. Creates a full-screen overlay with
2373
+ * configurable backdrop behavior, keyboard navigation (ESC to close), and focus management. Used by various extensions
2374
+ * to display menus, settings panels, and other interactive content over the editor interface.
2375
+ *
2376
+ * **Usage:**
2377
+ * ```javascript
2378
+ * var overlayPage = require('./overlay_page').overlayPage;
2379
+ * var contentElement = document.createElement('div');
2380
+ * contentElement.innerHTML = '<h1>Settings</h1>';
2381
+ *
2382
+ * var overlay = overlayPage(editor, contentElement, function() {
2383
+ * console.log('Overlay closed');
2384
+ * });
2385
+ * ```
2386
+ *
2387
+ * @module
2388
+ */
2389
+ 'use strict';
2390
+ var dom = require("../../lib/dom");
2391
+ var cssText = require("./settings_menu.css");
2392
+ dom.importCssString(cssText, "settings_menu.css", false);
2393
+ module.exports.overlayPage = function overlayPage(editor, contentElement, callback) {
2394
+ var closer = document.createElement('div');
2395
+ var ignoreFocusOut = false;
2396
+ function documentEscListener(e) {
2397
+ if (e.keyCode === 27) {
2398
+ close();
2399
+ }
2400
+ }
2401
+ function close() {
2402
+ if (!closer)
2403
+ return;
2404
+ document.removeEventListener('keydown', documentEscListener);
2405
+ closer.parentNode.removeChild(closer);
2406
+ if (editor) {
2407
+ editor.focus();
2408
+ }
2409
+ closer = null;
2410
+ callback && callback();
2411
+ }
2412
+ function setIgnoreFocusOut(ignore) {
2413
+ ignoreFocusOut = ignore;
2414
+ if (ignore) {
2415
+ closer.style.pointerEvents = "none";
2416
+ contentElement.style.pointerEvents = "auto";
2417
+ }
2418
+ }
2419
+ closer.style.cssText = 'margin: 0; padding: 0; ' +
2420
+ 'position: fixed; top:0; bottom:0; left:0; right:0;' +
2421
+ 'z-index: 9990; ' +
2422
+ (editor ? 'background-color: rgba(0, 0, 0, 0.3);' : '');
2423
+ closer.addEventListener('click', function (e) {
2424
+ if (!ignoreFocusOut) {
2425
+ close();
2426
+ }
2427
+ });
2428
+ document.addEventListener('keydown', documentEscListener);
2429
+ contentElement.addEventListener('click', function (e) {
2430
+ e.stopPropagation();
2431
+ });
2432
+ closer.appendChild(contentElement);
2433
+ document.body.appendChild(closer);
2434
+ if (editor) {
2435
+ editor.blur();
2436
+ }
2437
+ return {
2438
+ close: close,
2439
+ setIgnoreFocusOut: setIgnoreFocusOut
2440
+ };
2441
+ };
2442
+
2443
+ });
2444
+
2445
+ ace.define("ace/ext/modelist",["require","exports","module"], function(require, exports, module){/**
2446
+ * ## File mode detection utility
2447
+ *
2448
+ * Provides automatic detection of editor syntax modes based on file paths and extensions. Maps file extensions to
2449
+ * appropriate Ace Editor syntax highlighting modes for over 100 programming languages and file formats including
2450
+ * JavaScript, TypeScript, HTML, CSS, Python, Java, C++, and many others. Supports complex extension patterns and
2451
+ * provides fallback mechanisms for unknown file types.
2452
+ *
2453
+ * @module
2454
+ */
2455
+ "use strict";
2456
+ var modes = [];
2457
+ function getModeForPath(path) {
2458
+ var mode = modesByName.text;
2459
+ var fileName = path.split(/[\/\\]/).pop();
2460
+ for (var i = 0; i < modes.length; i++) {
2461
+ if (modes[i].supportsFile(fileName)) {
2462
+ mode = modes[i];
2463
+ break;
2464
+ }
2465
+ }
2466
+ return mode;
2467
+ }
2468
+ var Mode = /** @class */ (function () {
2469
+ function Mode(name, caption, extensions) {
2470
+ this.name = name;
2471
+ this.caption = caption;
2472
+ this.mode = "ace/mode/" + name;
2473
+ this.extensions = extensions;
2474
+ var re;
2475
+ if (/\^/.test(extensions)) {
2476
+ re = extensions.replace(/\|(\^)?/g, function (a, b) {
2477
+ return "$|" + (b ? "^" : "^.*\\.");
2478
+ }) + "$";
2479
+ }
2480
+ else {
2481
+ re = "\\.(" + extensions + ")$";
2482
+ }
2483
+ this.extRe = new RegExp(re, "gi");
2484
+ }
2485
+ Mode.prototype.supportsFile = function (filename) {
2486
+ return filename.match(this.extRe);
2487
+ };
2488
+ return Mode;
2489
+ }());
2490
+ var supportedModes = {
2491
+ ABAP: ["abap"],
2492
+ ABC: ["abc"],
2493
+ ActionScript: ["as"],
2494
+ ADA: ["ada|adb"],
2495
+ Alda: ["alda"],
2496
+ Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
2497
+ Apex: ["apex|cls|trigger|tgr"],
2498
+ AQL: ["aql"],
2499
+ AsciiDoc: ["asciidoc|adoc"],
2500
+ ASL: ["dsl|asl|asl.json"],
2501
+ Assembly_ARM32: ["s"],
2502
+ Assembly_x86: ["asm|a"],
2503
+ Astro: ["astro"],
2504
+ AutoHotKey: ["ahk"],
2505
+ Basic: ["bas|bak"],
2506
+ BatchFile: ["bat|cmd"],
2507
+ BibTeX: ["bib"],
2508
+ C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
2509
+ C9Search: ["c9search_results"],
2510
+ Cirru: ["cirru|cr"],
2511
+ Clojure: ["clj|cljs"],
2512
+ Clue: ["clue"],
2513
+ Cobol: ["CBL|COB"],
2514
+ coffee: ["coffee|cf|cson|^Cakefile"],
2515
+ ColdFusion: ["cfm|cfc"],
2516
+ Crystal: ["cr"],
2517
+ CSharp: ["cs"],
2518
+ Csound_Document: ["csd"],
2519
+ Csound_Orchestra: ["orc"],
2520
+ Csound_Score: ["sco"],
2521
+ CSS: ["css"],
2522
+ CSV: ["csv"],
2523
+ Curly: ["curly"],
2524
+ Cuttlefish: ["conf"],
2525
+ D: ["d|di"],
2526
+ Dart: ["dart"],
2527
+ Diff: ["diff|patch"],
2528
+ Django: ["djt|html.djt|dj.html|djhtml"],
2529
+ Dockerfile: ["^Dockerfile"],
2530
+ Dot: ["dot"],
2531
+ Drools: ["drl"],
2532
+ Edifact: ["edi"],
2533
+ Eiffel: ["e|ge"],
2534
+ EJS: ["ejs"],
2535
+ Elixir: ["ex|exs"],
2536
+ Elm: ["elm"],
2537
+ Erlang: ["erl|hrl"],
2538
+ Flix: ["flix"],
2539
+ Forth: ["frt|fs|ldr|fth|4th"],
2540
+ Fortran: ["f|f90"],
2541
+ FSharp: ["fsi|fs|ml|mli|fsx|fsscript"],
2542
+ FSL: ["fsl"],
2543
+ FTL: ["ftl"],
2544
+ Gcode: ["gcode"],
2545
+ Gherkin: ["feature"],
2546
+ Gitignore: ["^.gitignore"],
2547
+ Glsl: ["glsl|frag|vert"],
2548
+ Gobstones: ["gbs"],
2549
+ golang: ["go"],
2550
+ GraphQLSchema: ["gql"],
2551
+ Groovy: ["groovy"],
2552
+ HAML: ["haml"],
2553
+ Handlebars: ["hbs|handlebars|tpl|mustache"],
2554
+ Haskell: ["hs"],
2555
+ Haskell_Cabal: ["cabal"],
2556
+ haXe: ["hx"],
2557
+ Hjson: ["hjson"],
2558
+ HTML: ["html|htm|xhtml|we|wpy"],
2559
+ HTML_Elixir: ["eex|html.eex"],
2560
+ HTML_Ruby: ["erb|rhtml|html.erb"],
2561
+ INI: ["ini|conf|cfg|prefs"],
2562
+ Io: ["io"],
2563
+ Ion: ["ion"],
2564
+ Jack: ["jack"],
2565
+ Jade: ["jade|pug"],
2566
+ Java: ["java"],
2567
+ JavaScript: ["js|jsm|cjs|mjs"],
2568
+ JEXL: ["jexl"],
2569
+ JSON: ["json"],
2570
+ JSON5: ["json5"],
2571
+ JSONiq: ["jq"],
2572
+ JSP: ["jsp"],
2573
+ JSSM: ["jssm|jssm_state"],
2574
+ JSX: ["jsx"],
2575
+ Julia: ["jl"],
2576
+ Kotlin: ["kt|kts"],
2577
+ LaTeX: ["tex|latex|ltx|bib"],
2578
+ Latte: ["latte"],
2579
+ LESS: ["less"],
2580
+ Liquid: ["liquid"],
2581
+ Lisp: ["lisp"],
2582
+ LiveScript: ["ls"],
2583
+ Log: ["log"],
2584
+ LogiQL: ["logic|lql"],
2585
+ Logtalk: ["lgt"],
2586
+ LSL: ["lsl"],
2587
+ Lua: ["lua"],
2588
+ LuaPage: ["lp"],
2589
+ Lucene: ["lucene"],
2590
+ Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
2591
+ Markdown: ["md|markdown"],
2592
+ Mask: ["mask"],
2593
+ MATLAB: ["matlab"],
2594
+ Maze: ["mz"],
2595
+ MediaWiki: ["wiki|mediawiki"],
2596
+ MEL: ["mel"],
2597
+ MIPS: ["s|asm"],
2598
+ MIXAL: ["mixal"],
2599
+ MUSHCode: ["mc|mush"],
2600
+ MySQL: ["mysql"],
2601
+ Nasal: ["nas"],
2602
+ Nginx: ["nginx|conf"],
2603
+ Nim: ["nim"],
2604
+ Nix: ["nix"],
2605
+ NSIS: ["nsi|nsh"],
2606
+ Nunjucks: ["nunjucks|nunjs|nj|njk"],
2607
+ ObjectiveC: ["m|mm"],
2608
+ OCaml: ["ml|mli"],
2609
+ Odin: ["odin"],
2610
+ PartiQL: ["partiql|pql"],
2611
+ Pascal: ["pas|p"],
2612
+ Perl: ["pl|pm"],
2613
+ pgSQL: ["pgsql"],
2614
+ PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
2615
+ PHP_Laravel_blade: ["blade.php"],
2616
+ Pig: ["pig"],
2617
+ PLSQL: ["plsql"],
2618
+ Powershell: ["ps1"],
2619
+ Praat: ["praat|praatscript|psc|proc"],
2620
+ Prisma: ["prisma"],
2621
+ Prolog: ["plg|prolog"],
2622
+ Properties: ["properties"],
2623
+ Protobuf: ["proto"],
2624
+ PRQL: ["prql"],
2625
+ Puppet: ["epp|pp"],
2626
+ Python: ["py"],
2627
+ QML: ["qml"],
2628
+ R: ["r"],
2629
+ Raku: ["raku|rakumod|rakutest|p6|pl6|pm6"],
2630
+ Razor: ["cshtml|asp"],
2631
+ RDoc: ["Rd"],
2632
+ Red: ["red|reds"],
2633
+ RHTML: ["Rhtml"],
2634
+ Robot: ["robot|resource"],
2635
+ RST: ["rst"],
2636
+ Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
2637
+ Rust: ["rs"],
2638
+ SaC: ["sac"],
2639
+ SASS: ["sass"],
2640
+ SCAD: ["scad"],
2641
+ Scala: ["scala|sbt"],
2642
+ Scheme: ["scm|sm|rkt|oak|scheme"],
2643
+ Scrypt: ["scrypt"],
2644
+ SCSS: ["scss"],
2645
+ SH: ["sh|bash|^.bashrc"],
2646
+ SJS: ["sjs"],
2647
+ Slim: ["slim|skim"],
2648
+ Smarty: ["smarty|tpl"],
2649
+ Smithy: ["smithy"],
2650
+ snippets: ["snippets"],
2651
+ Soy_Template: ["soy"],
2652
+ Space: ["space"],
2653
+ SPARQL: ["rq"],
2654
+ SQL: ["sql"],
2655
+ SQLServer: ["sqlserver"],
2656
+ Stylus: ["styl|stylus"],
2657
+ SVG: ["svg"],
2658
+ Swift: ["swift"],
2659
+ Tcl: ["tcl"],
2660
+ Terraform: ["tf", "tfvars", "terragrunt"],
2661
+ Tex: ["tex"],
2662
+ Text: ["txt"],
2663
+ Textile: ["textile"],
2664
+ Toml: ["toml"],
2665
+ TSV: ["tsv"],
2666
+ TSX: ["tsx"],
2667
+ Turtle: ["ttl"],
2668
+ Twig: ["twig|swig"],
2669
+ Typescript: ["ts|mts|cts|typescript|str"],
2670
+ Vala: ["vala"],
2671
+ VBScript: ["vbs|vb"],
2672
+ Velocity: ["vm"],
2673
+ Verilog: ["v|vh|sv|svh"],
2674
+ VHDL: ["vhd|vhdl"],
2675
+ Visualforce: ["vfp|component|page"],
2676
+ Vue: ["vue"],
2677
+ Wollok: ["wlk|wpgm|wtest"],
2678
+ XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
2679
+ XQuery: ["xq"],
2680
+ YAML: ["yaml|yml"],
2681
+ Zeek: ["zeek|bro"],
2682
+ Zig: ["zig"]
2683
+ };
2684
+ var nameOverrides = {
2685
+ ObjectiveC: "Objective-C",
2686
+ CSharp: "C#",
2687
+ golang: "Go",
2688
+ C_Cpp: "C and C++",
2689
+ Csound_Document: "Csound Document",
2690
+ Csound_Orchestra: "Csound",
2691
+ Csound_Score: "Csound Score",
2692
+ coffee: "CoffeeScript",
2693
+ HTML_Ruby: "HTML (Ruby)",
2694
+ HTML_Elixir: "HTML (Elixir)",
2695
+ FTL: "FreeMarker",
2696
+ PHP_Laravel_blade: "PHP (Blade Template)",
2697
+ Perl6: "Perl 6",
2698
+ AutoHotKey: "AutoHotkey / AutoIt"
2699
+ };
2700
+ var modesByName = {};
2701
+ for (var name in supportedModes) {
2702
+ var data = supportedModes[name];
2703
+ var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
2704
+ var filename = name.toLowerCase();
2705
+ var mode = new Mode(filename, displayName, data[0]);
2706
+ modesByName[filename] = mode;
2707
+ modes.push(mode);
2708
+ }
2709
+ exports.getModeForPath = getModeForPath;
2710
+ exports.modes = modes;
2711
+ exports.modesByName = modesByName;
2712
+
2713
+ });
2714
+
2715
+ ace.define("ace/ext/prompt",["require","exports","module","ace/config","ace/range","ace/lib/dom","ace/autocomplete","ace/autocomplete/popup","ace/autocomplete/popup","ace/undomanager","ace/tokenizer","ace/ext/menu_tools/overlay_page","ace/ext/modelist"], function(require, exports, module){/**
2716
+ * ## User Input Prompt extension
2717
+ *
2718
+ * Provides customizable modal prompts for gathering user input with support for autocompletion, validation, and
2719
+ * specialized input types. Includes built-in prompt types for navigation (goto line), command palette, and mode
2720
+ * selection, with extensible architecture for custom prompt implementations.
2721
+ *
2722
+ * **Built-in Prompt Types:**
2723
+ * - `gotoLine`: Navigate to specific line numbers with selection support
2724
+ * - `commands`: Command palette with searchable editor commands and shortcuts
2725
+ * - `modes`: Language mode selector with filtering capabilities
2726
+ *
2727
+ * **Usage:**
2728
+ * ```javascript
2729
+ * // Basic prompt
2730
+ * prompt(editor, "Default value", {
2731
+ * placeholder: "Enter text...",
2732
+ * onAccept: (data) => console.log(data.value)
2733
+ * });
2734
+ *
2735
+ * // Built-in prompts
2736
+ * prompt.gotoLine(editor);
2737
+ * prompt.commands(editor);
2738
+ * prompt.modes(editor);
2739
+ * ```
2740
+ *
2741
+ * @module
2742
+ */
2743
+ "use strict";
2744
+ var nls = require("../config").nls;
2745
+ var Range = require("../range").Range;
2746
+ var dom = require("../lib/dom");
2747
+ var FilteredList = require("../autocomplete").FilteredList;
2748
+ var AcePopup = require('../autocomplete/popup').AcePopup;
2749
+ var $singleLineEditor = require('../autocomplete/popup').$singleLineEditor;
2750
+ var UndoManager = require("../undomanager").UndoManager;
2751
+ var Tokenizer = require("../tokenizer").Tokenizer;
2752
+ var overlayPage = require("./menu_tools/overlay_page").overlayPage;
2753
+ var modelist = require("./modelist");
2754
+ var openPrompt;
2755
+ function prompt(editor, message, options, callback) {
2756
+ if (typeof message == "object") {
2757
+ return prompt(editor, "", message, options);
2758
+ }
2759
+ if (openPrompt) {
2760
+ var lastPrompt = openPrompt;
2761
+ editor = lastPrompt.editor;
2762
+ lastPrompt.close();
2763
+ if (lastPrompt.name && lastPrompt.name == options.name)
2764
+ return;
2765
+ }
2766
+ if (options.$type)
2767
+ return prompt[options.$type](editor, callback);
2768
+ var cmdLine = $singleLineEditor();
2769
+ cmdLine.session.setUndoManager(new UndoManager());
2770
+ var el = dom.buildDom(["div", { class: "ace_prompt_container" + (options.hasDescription ? " input-box-with-description" : "") }]);
2771
+ var overlay = overlayPage(editor, el, done);
2772
+ el.appendChild(cmdLine.container);
2773
+ if (editor) {
2774
+ editor.cmdLine = cmdLine;
2775
+ cmdLine.setOption("fontSize", editor.getOption("fontSize"));
2776
+ }
2777
+ if (message) {
2778
+ cmdLine.setValue(message, 1);
2779
+ }
2780
+ if (options.selection) {
2781
+ cmdLine.selection.setRange({
2782
+ start: cmdLine.session.doc.indexToPosition(options.selection[0]),
2783
+ end: cmdLine.session.doc.indexToPosition(options.selection[1])
2784
+ });
2785
+ }
2786
+ if (options.getCompletions) {
2787
+ var popup = new AcePopup();
2788
+ popup.renderer.setStyle("ace_autocomplete_inline");
2789
+ popup.container.style.display = "block";
2790
+ popup.container.style.maxWidth = "600px";
2791
+ popup.container.style.width = "100%";
2792
+ popup.container.style.marginTop = "3px";
2793
+ popup.renderer.setScrollMargin(2, 2, 0, 0);
2794
+ popup.autoSelect = false;
2795
+ popup.renderer.$maxLines = 15;
2796
+ popup.setRow(-1);
2797
+ popup.on("click", function (e) {
2798
+ var data = popup.getData(popup.getRow());
2799
+ if (!data["error"]) {
2800
+ cmdLine.setValue(data.value || data["name"] || data);
2801
+ accept();
2802
+ e.stop();
2803
+ }
2804
+ });
2805
+ el.appendChild(popup.container);
2806
+ updateCompletions();
2807
+ }
2808
+ if (options.$rules) {
2809
+ var tokenizer = new Tokenizer(options.$rules);
2810
+ cmdLine.session.bgTokenizer.setTokenizer(tokenizer);
2811
+ }
2812
+ if (options.placeholder) {
2813
+ cmdLine.setOption("placeholder", options.placeholder);
2814
+ }
2815
+ if (options.hasDescription) {
2816
+ var promptTextContainer = dom.buildDom(["div", { class: "ace_prompt_text_container" }]);
2817
+ dom.buildDom(options.prompt || "Press 'Enter' to confirm or 'Escape' to cancel", promptTextContainer);
2818
+ el.appendChild(promptTextContainer);
2819
+ }
2820
+ overlay.setIgnoreFocusOut(options.ignoreFocusOut);
2821
+ function accept() {
2822
+ var val;
2823
+ if (popup && popup.getCursorPosition().row > 0) {
2824
+ val = valueFromRecentList();
2825
+ }
2826
+ else {
2827
+ val = cmdLine.getValue();
2828
+ }
2829
+ var curData = popup ? popup.getData(popup.getRow()) : val;
2830
+ if (curData && !curData["error"]) {
2831
+ done();
2832
+ options.onAccept && options.onAccept({
2833
+ value: val,
2834
+ item: curData
2835
+ }, cmdLine);
2836
+ }
2837
+ }
2838
+ var keys = {
2839
+ "Enter": accept,
2840
+ "Esc|Shift-Esc": function () {
2841
+ options.onCancel && options.onCancel(cmdLine.getValue(), cmdLine);
2842
+ done();
2843
+ }
2844
+ };
2845
+ if (popup) {
2846
+ Object.assign(keys, {
2847
+ "Up": function (editor) { popup.goTo("up"); valueFromRecentList(); },
2848
+ "Down": function (editor) { popup.goTo("down"); valueFromRecentList(); },
2849
+ "Ctrl-Up|Ctrl-Home": function (editor) { popup.goTo("start"); valueFromRecentList(); },
2850
+ "Ctrl-Down|Ctrl-End": function (editor) { popup.goTo("end"); valueFromRecentList(); },
2851
+ "Tab": function (editor) {
2852
+ popup.goTo("down");
2853
+ valueFromRecentList();
2854
+ },
2855
+ "PageUp": function (editor) { popup.gotoPageUp(); valueFromRecentList(); },
2856
+ "PageDown": function (editor) { popup.gotoPageDown(); valueFromRecentList(); }
2857
+ });
2858
+ }
2859
+ cmdLine.commands.bindKeys(keys);
2860
+ function done() {
2861
+ overlay.close();
2862
+ callback && callback();
2863
+ openPrompt = null;
2864
+ }
2865
+ cmdLine.on("input", function () {
2866
+ options.onInput && options.onInput();
2867
+ updateCompletions();
2868
+ });
2869
+ function updateCompletions() {
2870
+ if (options.getCompletions) {
2871
+ var prefix;
2872
+ if (options.getPrefix) {
2873
+ prefix = options.getPrefix(cmdLine);
2874
+ }
2875
+ var completions = options.getCompletions(cmdLine);
2876
+ popup.setData(completions, prefix);
2877
+ popup.resize(true);
2878
+ }
2879
+ }
2880
+ function valueFromRecentList() {
2881
+ var current = popup.getData(popup.getRow());
2882
+ if (current && !current["error"])
2883
+ return current.value || current.caption || current;
2884
+ }
2885
+ cmdLine.resize(true);
2886
+ if (popup) {
2887
+ popup.resize(true);
2888
+ }
2889
+ cmdLine.focus();
2890
+ openPrompt = {
2891
+ close: done,
2892
+ name: options.name,
2893
+ editor: editor
2894
+ };
2895
+ }
2896
+ prompt.gotoLine = function (editor, callback) {
2897
+ function stringifySelection(selection) {
2898
+ if (!Array.isArray(selection))
2899
+ selection = [selection];
2900
+ return selection.map(function (r) {
2901
+ var cursor = r.isBackwards ? r.start : r.end;
2902
+ var anchor = r.isBackwards ? r.end : r.start;
2903
+ var row = anchor.row;
2904
+ var s = (row + 1) + ":" + anchor.column;
2905
+ if (anchor.row == cursor.row) {
2906
+ if (anchor.column != cursor.column)
2907
+ s += ">" + ":" + cursor.column;
2908
+ }
2909
+ else {
2910
+ s += ">" + (cursor.row + 1) + ":" + cursor.column;
2911
+ }
2912
+ return s;
2913
+ }).reverse().join(", ");
2914
+ }
2915
+ prompt(editor, ":" + stringifySelection(editor.selection.toJSON()), {
2916
+ name: "gotoLine",
2917
+ selection: [1, Number.MAX_VALUE],
2918
+ onAccept: function (data) {
2919
+ var value = data.value;
2920
+ var _history = prompt.gotoLine["_history"];
2921
+ if (!_history)
2922
+ prompt.gotoLine["_history"] = _history = [];
2923
+ if (_history.indexOf(value) != -1)
2924
+ _history.splice(_history.indexOf(value), 1);
2925
+ _history.unshift(value);
2926
+ if (_history.length > 20)
2927
+ _history.length = 20;
2928
+ var pos = editor.getCursorPosition();
2929
+ var ranges = [];
2930
+ value.replace(/^:/, "").split(/,/).map(function (str) {
2931
+ var parts = str.split(/([<>:+-]|c?\d+)|[^c\d<>:+-]+/).filter(Boolean);
2932
+ var i = 0;
2933
+ function readPosition() {
2934
+ var c = parts[i++];
2935
+ if (!c)
2936
+ return;
2937
+ if (c[0] == "c") {
2938
+ var index = parseInt(c.slice(1)) || 0;
2939
+ return editor.session.doc.indexToPosition(index);
2940
+ }
2941
+ var row = pos.row;
2942
+ var column = 0;
2943
+ if (/\d/.test(c)) {
2944
+ row = parseInt(c) - 1;
2945
+ c = parts[i++];
2946
+ }
2947
+ if (c == ":") {
2948
+ c = parts[i++];
2949
+ if (/\d/.test(c)) {
2950
+ column = parseInt(c) || 0;
2951
+ }
2952
+ }
2953
+ return { row: row, column: column };
2954
+ }
2955
+ pos = readPosition();
2956
+ var range = Range.fromPoints(pos, pos);
2957
+ if (parts[i] == ">") {
2958
+ i++;
2959
+ range.end = readPosition();
2960
+ }
2961
+ else if (parts[i] == "<") {
2962
+ i++;
2963
+ range.start = readPosition();
2964
+ }
2965
+ ranges.unshift(range);
2966
+ });
2967
+ editor.selection.fromJSON(ranges);
2968
+ var scrollTop = editor.renderer.scrollTop;
2969
+ editor.renderer.scrollSelectionIntoView(editor.selection.anchor, editor.selection.cursor, 0.5);
2970
+ editor.renderer.animateScrolling(scrollTop);
2971
+ },
2972
+ history: function () {
2973
+ if (!prompt.gotoLine["_history"])
2974
+ return [];
2975
+ return prompt.gotoLine["_history"];
2976
+ },
2977
+ getCompletions: function (cmdLine) {
2978
+ var value = cmdLine.getValue();
2979
+ var m = value.replace(/^:/, "").split(":");
2980
+ var row = Math.min(parseInt(m[0]) || 1, editor.session.getLength()) - 1;
2981
+ var line = editor.session.getLine(row);
2982
+ var current = value + " " + line;
2983
+ return [current].concat(this.history());
2984
+ },
2985
+ $rules: {
2986
+ start: [{
2987
+ regex: /\d+/,
2988
+ token: "string"
2989
+ }, {
2990
+ regex: /[:,><+\-c]/,
2991
+ token: "keyword"
2992
+ }]
2993
+ }
2994
+ });
2995
+ };
2996
+ prompt.commands = function (editor, callback) {
2997
+ function normalizeName(name) {
2998
+ return (name || "").replace(/^./, function (x) {
2999
+ return x.toUpperCase(x);
3000
+ }).replace(/[a-z][A-Z]/g, function (x) {
3001
+ return x[0] + " " + x[1].toLowerCase(x);
3002
+ });
3003
+ }
3004
+ function getEditorCommandsByName(excludeCommands) {
3005
+ var commandsByName = [];
3006
+ var commandMap = {};
3007
+ editor.keyBinding.$handlers.forEach(function (handler) {
3008
+ var platform = handler["platform"];
3009
+ var cbn = handler["byName"];
3010
+ for (var i in cbn) {
3011
+ var key = cbn[i].bindKey;
3012
+ if (typeof key !== "string") {
3013
+ key = key && key[platform] || "";
3014
+ }
3015
+ var commands = cbn[i];
3016
+ var description = commands.description || normalizeName(commands.name);
3017
+ if (!Array.isArray(commands))
3018
+ commands = [commands];
3019
+ commands.forEach(function (command) {
3020
+ if (typeof command != "string")
3021
+ command = command.name;
3022
+ var needle = excludeCommands.find(function (el) {
3023
+ return el === command;
3024
+ });
3025
+ if (!needle) {
3026
+ if (commandMap[command]) {
3027
+ commandMap[command].key += "|" + key;
3028
+ }
3029
+ else {
3030
+ commandMap[command] = { key: key, command: command, description: description };
3031
+ commandsByName.push(commandMap[command]);
3032
+ }
3033
+ }
3034
+ });
3035
+ }
3036
+ });
3037
+ return commandsByName;
3038
+ }
3039
+ var excludeCommandsList = ["insertstring", "inserttext", "setIndentation", "paste"];
3040
+ var shortcutsArray = getEditorCommandsByName(excludeCommandsList);
3041
+ shortcutsArray = shortcutsArray.map(function (item) {
3042
+ return { value: item.description, meta: item.key, command: item.command };
3043
+ });
3044
+ prompt(editor, "", {
3045
+ name: "commands",
3046
+ selection: [0, Number.MAX_VALUE],
3047
+ maxHistoryCount: 5,
3048
+ onAccept: function (data) {
3049
+ if (data.item) {
3050
+ var commandName = data.item.command;
3051
+ this.addToHistory(data.item);
3052
+ editor.execCommand(commandName);
3053
+ }
3054
+ },
3055
+ addToHistory: function (item) {
3056
+ var history = this.history();
3057
+ history.unshift(item);
3058
+ delete item.message;
3059
+ for (var i = 1; i < history.length; i++) {
3060
+ if (history[i]["command"] == item.command) {
3061
+ history.splice(i, 1);
3062
+ break;
3063
+ }
3064
+ }
3065
+ if (this.maxHistoryCount > 0 && history.length > this.maxHistoryCount) {
3066
+ history.splice(history.length - 1, 1);
3067
+ }
3068
+ prompt.commands["history"] = history;
3069
+ },
3070
+ history: function () {
3071
+ return prompt.commands["history"] || [];
3072
+ },
3073
+ getPrefix: function (cmdLine) {
3074
+ var currentPos = cmdLine.getCursorPosition();
3075
+ var filterValue = cmdLine.getValue();
3076
+ return filterValue.substring(0, currentPos.column);
3077
+ },
3078
+ getCompletions: function (cmdLine) {
3079
+ function getFilteredCompletions(commands, prefix) {
3080
+ var resultCommands = JSON.parse(JSON.stringify(commands));
3081
+ var filtered = new FilteredList(resultCommands);
3082
+ return filtered.filterCompletions(resultCommands, prefix);
3083
+ }
3084
+ function getUniqueCommandList(commands, usedCommands) {
3085
+ if (!usedCommands || !usedCommands.length) {
3086
+ return commands;
3087
+ }
3088
+ var excludeCommands = [];
3089
+ usedCommands.forEach(function (item) {
3090
+ excludeCommands.push(item.command);
3091
+ });
3092
+ var resultCommands = [];
3093
+ commands.forEach(function (item) {
3094
+ if (excludeCommands.indexOf(item.command) === -1) {
3095
+ resultCommands.push(item);
3096
+ }
3097
+ });
3098
+ return resultCommands;
3099
+ }
3100
+ var prefix = this.getPrefix(cmdLine);
3101
+ var recentlyUsedCommands = getFilteredCompletions(this.history(), prefix);
3102
+ var otherCommands = getUniqueCommandList(shortcutsArray, recentlyUsedCommands);
3103
+ otherCommands = getFilteredCompletions(otherCommands, prefix);
3104
+ if (recentlyUsedCommands.length && otherCommands.length) {
3105
+ recentlyUsedCommands[0].message = nls("prompt.recently-used", "Recently used");
3106
+ otherCommands[0].message = nls("prompt.other-commands", "Other commands");
3107
+ }
3108
+ var completions = recentlyUsedCommands.concat(otherCommands);
3109
+ return completions.length > 0 ? completions : [{
3110
+ value: nls("prompt.no-matching-commands", "No matching commands"),
3111
+ error: 1
3112
+ }];
3113
+ }
3114
+ });
3115
+ };
3116
+ prompt.modes = function (editor, callback) {
3117
+ var modesArray = modelist.modes;
3118
+ modesArray = modesArray.map(function (item) {
3119
+ return { value: item.caption, mode: item.name };
3120
+ });
3121
+ prompt(editor, "", {
3122
+ name: "modes",
3123
+ selection: [0, Number.MAX_VALUE],
3124
+ onAccept: function (data) {
3125
+ if (data.item) {
3126
+ var modeName = "ace/mode/" + data.item.mode;
3127
+ editor.session.setMode(modeName);
3128
+ }
3129
+ },
3130
+ getPrefix: function (cmdLine) {
3131
+ var currentPos = cmdLine.getCursorPosition();
3132
+ var filterValue = cmdLine.getValue();
3133
+ return filterValue.substring(0, currentPos.column);
3134
+ },
3135
+ getCompletions: function (cmdLine) {
3136
+ function getFilteredCompletions(modes, prefix) {
3137
+ var resultCommands = JSON.parse(JSON.stringify(modes));
3138
+ var filtered = new FilteredList(resultCommands);
3139
+ return filtered.filterCompletions(resultCommands, prefix);
3140
+ }
3141
+ var prefix = this.getPrefix(cmdLine);
3142
+ var completions = getFilteredCompletions(modesArray, prefix);
3143
+ return completions.length > 0 ? completions : [{
3144
+ "caption": "No mode matching",
3145
+ "value": "No mode matching",
3146
+ "error": 1
3147
+ }];
3148
+ }
3149
+ });
3150
+ };
3151
+ dom.importCssString(".ace_prompt_container {\n max-width: 603px;\n width: 100%;\n margin: 20px auto;\n padding: 3px;\n background: white;\n border-radius: 2px;\n box-shadow: 0px 2px 3px 0px #555;\n}", "promtp.css", false);
3152
+ exports.prompt = prompt;
3153
+
3154
+ }); (function() {
3155
+ ace.require(["ace/ext/prompt"], function(m) {
3156
+ if (typeof module == "object" && typeof exports == "object" && module) {
3157
+ module.exports = m;
3158
+ }
3159
+ });
3160
+ })();
3161
+